From 2040c2f7fd8004127215890ae955326ebc53de41 Mon Sep 17 00:00:00 2001 From: derpylz Date: Thu, 24 Mar 2022 14:48:32 +0100 Subject: [PATCH] Fix labels in line plot json export. --- build/babyplots.d.ts | 2 +- build/babyplots.js | 7 +++++-- build/babyplots.js.map | 2 +- build/plotTypes/Line.js | 2 +- build/plotTypes/Line.js.map | 2 +- build/plotTypes/PointCloud.js | 2 +- build/plotTypes/PointCloud.js.map | 2 +- build/utils/Label.d.ts | 11 ++++++----- build/utils/Label.js | 19 ++++++++++++++----- build/utils/Label.js.map | 2 +- dist/babyplots.js | 2 +- dist/babyplots.js.map | 2 +- package.json | 2 +- src/babyplots.d.ts | 2 +- src/babyplots.ts | 9 ++++++--- src/plotTypes/Line.ts | 2 +- src/plotTypes/PointCloud.ts | 2 +- src/utils/Label.d.ts | 11 ++++++----- src/utils/Label.ts | 31 ++++++++++++++++++++----------- 19 files changed, 70 insertions(+), 44 deletions(-) diff --git a/build/babyplots.d.ts b/build/babyplots.d.ts index ad8524c..01e73e0 100644 --- a/build/babyplots.d.ts +++ b/build/babyplots.d.ts @@ -271,5 +271,5 @@ export declare class Plots { resize(width?: number, height?: number): Plots; thumbnail(size: number, saveCallback: (data: string) => void): void; dispose(): void; - addLabels(labelList: [[number, number, number, string]]): void; + addLabels(labelList: [[number, number, number, string, string?, number?]]): void; } diff --git a/build/babyplots.js b/build/babyplots.js index 39561c7..7ed1d57 100644 --- a/build/babyplots.js +++ b/build/babyplots.js @@ -477,7 +477,7 @@ var Plots = (function () { meshOffset: plot["meshOffset"] }); } - else if (["pointCloud", "heatMap", "surface", "shapeCloud"].indexOf(plot["plotType"]) !== -1) { + else if (["pointCloud", "heatMap", "surface", "shapeCloud", "line"].indexOf(plot["plotType"]) !== -1) { this.addPlot(plot["coordinates"], plot["plotType"], plot["colorBy"], plot["colorVar"], { name: plot["name"], size: plot["size"], @@ -514,7 +514,10 @@ var Plots = (function () { shape: plot["shape"], shading: plot["shading"], dpInfo: plot["dpInfo"], - addClusterLabels: plot["addClusterLabels"] + addClusterLabels: plot["addClusterLabels"], + labels: plot["labels"], + labelSize: plot["labelSize"], + labelColor: plot["labelColor"] }); } } diff --git a/build/babyplots.js.map b/build/babyplots.js.map index 460e86b..5661571 100644 --- a/build/babyplots.js.map +++ b/build/babyplots.js.map @@ -1 +1 @@ -{"version":3,"file":"babyplots.js","sourceRoot":"","sources":["../src/babyplots.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FG;;;;;;;;;;;;;;;;;;;;;AAEH,+CAA8C;AAC9C,yDAAwD;AAExD,2EAA0E;AAC1E,4EAA2E;AAC3E,mDAAqE;AACrE,yEAAwE;AACxE,mFAAkF;AAClF,uDAAwF;AACxF,wEAAuE;AAEvE,wDAA+B;AAC/B,0DAAkC;AAClC,6BAAoC;AACpC,2CAA2D;AAE3D,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;AAEvC,uCAAkD;AAsBlD,qCAAoC;AAyCpC;IAGI,6BAAmB,aAAqB;QAArB,kBAAa,GAAb,aAAa,CAAQ;IAAI,CAAC;IACtC,8CAAgB,GAAvB;IACA,CAAC;IAEM,2CAAa,GAApB;IACA,CAAC;IACL,0BAAC;AAAD,CAAC,AATD,IASC;AATY,kDAAmB;AAWhC;IAcI,cACI,IAAY,EACZ,KAAa,EACb,KAAY,EACZ,UAAsB,EACtB,MAAkB,EAClB,MAAkB,EAClB,MAAkB;QAFlB,uBAAA,EAAA,UAAkB;QAClB,uBAAA,EAAA,UAAkB;QAClB,uBAAA,EAAA,UAAkB;QAlBtB,cAAS,GAAY,KAAK,CAAC;QAS3B,aAAQ,GAAY,KAAK,CAAC;QAWtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;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c,CAAC,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QACvE,QAAQ,CAAC,MAAM,EAAE,CAAC;IACtB,CAAC;IAOD,yBAAS,GAAT,UAAU,SAA+D;QACrE,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACjD,CAAC;IAEL,YAAC;AAAD,CAAC,AAnjED,IAmjEC;AAnjEY,sBAAK"} \ No newline at end of file diff --git a/build/plotTypes/Line.js b/build/plotTypes/Line.js index 01c504c..dd2a708 100644 --- a/build/plotTypes/Line.js +++ b/build/plotTypes/Line.js @@ -62,7 +62,7 @@ var Line = (function (_super) { if (this.labelColor === "match") { col = this._coordColors[i]; } - annotationManager.addLabel(this.labels[i], this._coords[i], col, this.labelSize); + annotationManager.addLabel(this.labels[i], this._coords[i], col, this.labelSize, true); } annotationManager.fixLabels(); }; diff --git a/build/plotTypes/Line.js.map b/build/plotTypes/Line.js.map index d639d77..5e59ed7 100644 --- a/build/plotTypes/Line.js.map +++ b/build/plotTypes/Line.js.map @@ -1 +1 @@ -{"version":3,"file":"Line.js","sourceRoot":"","sources":["../../src/plotTypes/Line.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,mDAA6D;AAC7D,0CAA0D;AAE1D,6EAA4E;AAE5E;IAA0B,wBAAc;IAUpC,cACI,KAAY,EACZ,WAAuB,EACvB,QAAkB,EAClB,IAAY,EACZ,UAAsB,EACtB,YAAsB,EACtB,cAAuB,EACvB,iBAA0B,EAC1B,MAAkB,EAClB,MAAkB,EAClB,MAAkB,EAClB,IAAqB,EACrB,MAAiB,EACjB,SAAkB,EAClB,UAAmB,EACnB,iBAAqC;QAPrC,uBAAA,EAAA,UAAkB;QAClB,uBAAA,EAAA,UAAkB;QAClB,uBAAA,EAAA,UAAkB;QAClB,qBAAA,EAAA,aAAqB;QAZzB,YAkBI,kBAAM,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,IA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C,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/C,IAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YACxC,UAAU,CAAC,IAAI,CAAC,aAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;SACrD;QACD,IAAI,KAAK,GAAG,2BAAY,CAAC,WAAW,CAChC,OAAO,EACP,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,CAC7C,CAAA;QAED,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IACtB,CAAC;IAEO,yBAAU,GAAlB,UAAmB,iBAAoC;QACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACzC,IAAI,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC;YAC1B,IAAI,IAAI,CAAC,UAAU,KAAK,OAAO,EAAE;gBAC7B,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;aAC9B;YACD,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SAC1F;QACD,iBAAiB,CAAC,SAAS,EAAE,CAAC;IAClC,CAAC;IACL,WAAC;AAAD,CAAC,AAvED,CAA0B,0BAAc,GAuEvC;AAvEY,oBAAI"} \ No newline at end of file diff --git a/build/plotTypes/PointCloud.js b/build/plotTypes/PointCloud.js index 2a7a2ee..25a656e 100644 --- a/build/plotTypes/PointCloud.js +++ b/build/plotTypes/PointCloud.js @@ -150,7 +150,7 @@ var PointCloud = (function (_super) { var pointGroup = pointGroups[i]; var sum = pointGroup.reduce(sumFun); var centroid = [sum[0] / pointGroup.length, sum[1] / pointGroup.length, sum[2] / pointGroup.length]; - annotationManager.addLabel(pointGroupNames[i], centroid); + annotationManager.addLabel(pointGroupNames[i], centroid, undefined, undefined, true); } annotationManager.fixLabels(); }; diff --git a/build/plotTypes/PointCloud.js.map b/build/plotTypes/PointCloud.js.map index 1a29dd8..65da102 100644 --- a/build/plotTypes/PointCloud.js.map +++ b/build/plotTypes/PointCloud.js.map @@ -1 +1 @@ -{"version":3,"file":"PointCloud.js","sourceRoot":"","sources":["../../src/plotTypes/PointCloud.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,oDAAmD;AACnD,mDAAqE;AACrE,0EAAoE;AACpE,+EAA8E;AAE9E,0CAA0D;AAE1D,wDAA+B;AAE/B;IAAgC,8BAAc;IAU1C,oBACI,KAAY,EACZ,WAAuB,EACvB,QAAkB,EAClB,IAAY,EACZ,UAAsB,EACtB,YAAsB,EACtB,gBAA6B,EAC7B,cAAuB,EACvB,iBAA0B,EAC1B,MAAkB,EAClB,MAAkB,EAClB,MAAkB,EAClB,IAA4B,EAC5B,SAA0B,EAC1B,iBAAqC;QALrC,uBAAA,EAAA,UAAkB;QAClB,uBAAA,EAAA,UAAkB;QAClB,uBAAA,EAAA,UAAkB;QAClB,qBAAA,EAAA,oBAA4B;QAC5B,0BAAA,EAAA,iBAA0B;QAd9B,YAiBI,kBAAM,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,SAmD/F;QA5EO,cAAQ,GAAY,KAAK,CAAC;QAC1B,oBAAc,GAAW,CAAC,CAAC;QAE3B,uBAAiB,GAAc,EAAE,CAAC;QAClC,uBAAiB,GAAW,CAAC,CAAC;QAC9B,sBAAgB,GAAW,GAAG,CAAC;QAC/B,2BAAqB,GAAc,EAAE,CAAC;QACtC,qBAAe,GAAW,GAAG,CAAC;QAmBlC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AG,gBAAgB,EAAE,CAAC,EAAE,EAAE;4BACvC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;4BACpD,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;4BACxD,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;yBAC3D;oBACL,CAAC,CAAA;oBACD,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;iBACpE;gBACD,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;aACnC;SACJ;QACD,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IACL,iBAAC;AAAD,CAAC,AA5OD,CAAgC,0BAAc,GA4O7C;AA5OY,gCAAU"} \ No newline at end of file diff --git a/build/utils/Label.d.ts b/build/utils/Label.d.ts index e846721..34c41ce 100644 --- a/build/utils/Label.d.ts +++ b/build/utils/Label.d.ts @@ -24,13 +24,14 @@ declare class Label { size: number; color: string; fixed: boolean; - constructor(text: string, position: Vector3, scene: Scene, color?: string, size?: number); + plotCreated: boolean; + constructor(text: string, position: Vector3, scene: Scene, color?: string, size?: number, plotCreated?: boolean); setText(text: string): void; update(camera: ArcRotateCamera, scene: Scene): void; fix(): void; unfix(): void; dispose(): void; - export(): [number, number, number, string]; + export(): [number, number, number, string, string, number]; } export declare class AnnotationManager { private _canvas; @@ -61,11 +62,11 @@ export declare class AnnotationManager { redrawInfo(): void; displayInfo(text: string, target: TransformNode): void; clearInfo(): void; - addLabel(text: string, position?: number[], color?: string, size?: number): number; - addLabels(labelList: [[number, number, number, string]]): void; + addLabel(text: string, position?: number[], color?: string, size?: number, plotCreated?: boolean): number; + addLabels(labelList: [number, number, number, string, string?, number?][]): void; private _editLabelText; private _removeLabel; - exportLabels(): any[]; + exportLabels(): [number, number, number, string, string, number][]; fixLabels(): void; unfixLabels(): void; } diff --git a/build/utils/Label.js b/build/utils/Label.js index 6520c07..3ec5138 100644 --- a/build/utils/Label.js +++ b/build/utils/Label.js @@ -99,7 +99,8 @@ var dpInfo = (function () { return dpInfo; }()); var Label = (function () { - function Label(text, position, scene, color, size) { + function Label(text, position, scene, color, size, plotCreated) { + if (plotCreated === void 0) { plotCreated = false; } this.size = 100; this.color = "black"; this.fixed = false; @@ -113,6 +114,7 @@ var Label = (function () { if (color !== undefined) { this.color = color; } + this.plotCreated = plotCreated; plane.position = position; var advancedTexture = advancedDynamicTexture_1.AdvancedDynamicTexture.CreateForMesh(plane); var background = new controls_1.Rectangle(); @@ -167,7 +169,9 @@ var Label = (function () { this._label.position.x, this._label.position.y, this._label.position.z, - this._text.text + this._text.text, + this.color, + this.size ]; }; return Label; @@ -286,7 +290,8 @@ var AnnotationManager = (function () { } this.dpInfos = []; }; - AnnotationManager.prototype.addLabel = function (text, position, color, size) { + AnnotationManager.prototype.addLabel = function (text, position, color, size, plotCreated) { + if (plotCreated === void 0) { plotCreated = false; } this._addLabelTextInput.value = ""; var labelIdx = this.labels.length; var pos; @@ -302,7 +307,7 @@ var AnnotationManager = (function () { if (color !== undefined) { col = color; } - var newLabel = new Label(text, pos, this._scene, col, size); + var newLabel = new Label(text, pos, this._scene, col, size, plotCreated); this.labels.push(newLabel); var editLabelForm = document.createElement("div"); editLabelForm.className = "label-form"; @@ -333,7 +338,7 @@ var AnnotationManager = (function () { var label = labelList[i]; var text = label[3]; var position = label.slice(0, 3); - this.addLabel(text, position); + this.addLabel(text, position, label[4], label[5]); } }; AnnotationManager.prototype._editLabelText = function (ev) { @@ -365,6 +370,10 @@ var AnnotationManager = (function () { AnnotationManager.prototype.exportLabels = function () { var labels = []; for (var i = 0; i < this.labels.length; i++) { + var l = this.labels[i]; + if (l.plotCreated) { + continue; + } labels.push(this.labels[i].export()); } return labels; diff --git a/build/utils/Label.js.map b/build/utils/Label.js.map index 64e9008..4258af2 100644 --- a/build/utils/Label.js.map +++ b/build/utils/Label.js.map @@ -1 +1 @@ -{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../src/utils/Label.ts"],"names":[],"mappings":";;;;;;AAsBA,mDAAmE;AACnE,6EAA4E;AAC5E,4FAA2F;AAC3F,mFAAkF;AAClF,uDAA0E;AAC1E,6EAA4E;AAE5E,mFAAkF;AAElF,wDAA+B;AAE/B;IAMI,eAAY,IAAa,EAAE,EAAW,EAAE,KAAY,EAAE,KAAc;QAFpE,SAAI,GAAW,CAAC,CAAC;QAGb,IAAI,KAAK,GAAG,2BAAY,CAAC,gBAAgB,CAAC,IAAI,EAAE;YAC5C,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACnB,SAAS,EAAE,IAAI;SAClB,EAAE,KAAK,CAAC,CAAC;QAEV,KAAK,CAAC,KAAK,GAAG,IAAI,aAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAClC,IAAI,KAAK,KAAK,SAAS,EAAE;YACrB,KAAK,CAAC,KAAK,GAAG,aAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;SAC7C;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,GAAG,GAAG,iCAAe,CAAC,cAAc,CAAC,KAAK,EAAE;YAC5C,WAAW,EAAE,CAAC;YACd,cAAc,EAAE,IAAI,CAAC,IAAI;YACzB,YAAY,EAAE,EAAE;SACnB,EAAE,KAAK,CAAC,CAAC;QACV,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,GAAG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AAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACzC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;SAC1B;QACD,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC7B,CAAC;IACL,wBAAC;AAAD,CAAC,AAjQD,IAiQC;AAjQY,8CAAiB;AAmQ9B,SAAS,aAAa,CAAC,KAAW;IAC9B,IAAI,iBAAiB,GAAG,IAAI,yCAAmB,EAAE,CAAC;IAClD,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;AACzC,CAAC"} \ No newline at end of file diff --git a/dist/babyplots.js b/dist/babyplots.js index a7c6e9c..3aff774 100644 --- a/dist/babyplots.js +++ b/dist/babyplots.js @@ -1,3 +1,3 @@ /*! For license information please see babyplots.js.LICENSE.txt */ -var Baby;(()=>{var e={4635:(e,t,i)=>{"use strict";i.d(t,{f:()=>d});var n=i(2973),r=i(8362),o=i(9018),s=i(9023),a=i(6132),l=i(5569),h=i(2117),c=i(2686),u=i(488),f=i(2840),d=function(){function e(t,i,n,r,o,s){this.name=t,this.targetProperty=i,this.framePerSecond=n,this.dataType=r,this.loopMode=o,this.enableBlending=s,this._runtimeAnimations=new Array,this._events=new Array,this.blendingSpeed=.01,this._ranges={},this.targetPropertyPath=i.split("."),this.dataType=r,this.loopMode=void 0===o?e.ANIMATIONLOOPMODE_CYCLE:o}return e._PrepareAnimation=function(t,i,o,s,a,l,h,c){var f=void 0;if(!isNaN(parseFloat(a))&&isFinite(a)?f=e.ANIMATIONTYPE_FLOAT:a instanceof n._f?f=e.ANIMATIONTYPE_QUATERNION:a instanceof n.P?f=e.ANIMATIONTYPE_VECTOR3:a instanceof n.FM?f=e.ANIMATIONTYPE_VECTOR2:a instanceof r.Wo?f=e.ANIMATIONTYPE_COLOR3:a instanceof r.HE?f=e.ANIMATIONTYPE_COLOR4:a instanceof u.$&&(f=e.ANIMATIONTYPE_SIZE),null==f)return null;var d=new e(t,i,o,f,h),p=[{frame:0,value:a},{frame:s,value:l}];return d.setKeys(p),void 0!==c&&d.setEasingFunction(c),d},e.CreateAnimation=function(t,i,n,r){var o=new e(t+"Animation",t,n,i,e.ANIMATIONLOOPMODE_CONSTANT);return o.setEasingFunction(r),o},e.CreateAndStartAnimation=function(t,i,n,r,o,s,a,l,h,c){var u=e._PrepareAnimation(t,n,r,o,s,a,l,h);return u?i.getScene().beginDirectAnimation(i,[u],0,o,1===u.loopMode,1,c):null},e.CreateAndStartHierarchyAnimation=function(t,i,n,r,o,s,a,l,h,c,u){var f=e._PrepareAnimation(t,r,o,s,a,l,h,c);return f?i.getScene().beginDirectHierarchyAnimation(i,n,[f],0,s,1===f.loopMode,1,u):null},e.CreateMergeAndStartAnimation=function(t,i,n,r,o,s,a,l,h,c){var u=e._PrepareAnimation(t,n,r,o,s,a,l,h);return u?(i.animations.push(u),i.getScene().beginAnimation(i,0,o,1===u.loopMode,1,c)):null},e.MakeAnimationAdditive=function(t,i,r,o,s){void 0===i&&(i=0),void 0===o&&(o=!1);var a=t;if(o&&((a=t.clone()).name=s||a.name),!a._keys.length)return a;i=i>=0?i:0;var l=0,h=a._keys[0],c=a._keys.length-1,u=a._keys[c],f={referenceValue:h.value,referencePosition:n.jp.Vector3[0],referenceQuaternion:n.jp.Quaternion[0],referenceScaling:n.jp.Vector3[1],keyPosition:n.jp.Vector3[2],keyQuaternion:n.jp.Quaternion[1],keyScaling:n.jp.Vector3[3]},d=!1,p=h.frame,_=u.frame;if(r){var g=a.getRange(r);g&&(p=g.from,_=g.to)}var m=h.frame===p,v=u.frame===_;if(1===a._keys.length){var y=a._getKeyValue(a._keys[0]);f.referenceValue=y.clone?y.clone():y,d=!0}else if(i<=h.frame){y=a._getKeyValue(h.value);f.referenceValue=y.clone?y.clone():y,d=!0}else if(i>=u.frame){y=a._getKeyValue(u.value);f.referenceValue=y.clone?y.clone():y,d=!0}for(var b=0;!d||!m||!v&&b=T.frame&&i<=A.frame){y=void 0;if(i===T.frame)y=a._getKeyValue(T.value);else if(i===A.frame)y=a._getKeyValue(A.value);else{var E={key:b,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT};y=a._interpolate(i,E)}f.referenceValue=y.clone?y.clone():y,d=!0}if(!m&&p>=T.frame&&p<=A.frame){if(p===T.frame)l=b;else if(p===A.frame)l=b+1;else{E={key:b,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT};var C={frame:p,value:(y=a._interpolate(p,E)).clone?y.clone():y};a._keys.splice(b+1,0,C),l=b+1}m=!0}if(!v&&_>=T.frame&&_<=A.frame){if(_===T.frame)c=b;else if(_===A.frame)c=b+1;else{E={key:b,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT},C={frame:_,value:(y=a._interpolate(_,E)).clone?y.clone():y};a._keys.splice(b+1,0,C),c=b+1}v=!0}b++}a.dataType===e.ANIMATIONTYPE_QUATERNION?f.referenceValue.normalize().conjugateInPlace():a.dataType===e.ANIMATIONTYPE_MATRIX&&(f.referenceValue.decompose(f.referenceScaling,f.referenceQuaternion,f.referencePosition),f.referenceQuaternion.normalize().conjugateInPlace());for(b=l;b<=c;b++){C=a._keys[b];if(!b||a.dataType===e.ANIMATIONTYPE_FLOAT||C.value!==h.value)switch(a.dataType){case e.ANIMATIONTYPE_MATRIX:C.value.decompose(f.keyScaling,f.keyQuaternion,f.keyPosition),f.keyPosition.subtractInPlace(f.referencePosition),f.keyScaling.divideInPlace(f.referenceScaling),f.referenceQuaternion.multiplyToRef(f.keyQuaternion,f.keyQuaternion),n.y3.ComposeToRef(f.keyScaling,f.keyQuaternion,f.keyPosition,C.value);break;case e.ANIMATIONTYPE_QUATERNION:f.referenceValue.multiplyToRef(C.value,C.value);break;case e.ANIMATIONTYPE_VECTOR2:case e.ANIMATIONTYPE_VECTOR3:case e.ANIMATIONTYPE_COLOR3:case e.ANIMATIONTYPE_COLOR4:C.value.subtractToRef(f.referenceValue,C.value);break;case e.ANIMATIONTYPE_SIZE:C.value.width-=f.referenceValue.width,C.value.height-=f.referenceValue.height;break;default:C.value-=f.referenceValue}}return a},e.TransitionTo=function(e,t,i,n,r,o,s,a){if(void 0===a&&(a=null),s<=0)return i[e]=t,a&&a(),null;var l=r*(s/1e3);o.setKeys([{frame:0,value:i[e].clone?i[e].clone():i[e]},{frame:l,value:t}]),i.animations||(i.animations=[]),i.animations.push(o);var h=n.beginAnimation(i,0,l,!1);return h.onAnimationEnd=a,h},Object.defineProperty(e.prototype,"runtimeAnimations",{get:function(){return this._runtimeAnimations},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRunningRuntimeAnimations",{get:function(){for(var e=0,t=this._runtimeAnimations;e=0;o--)this._keys[o].frame>=n&&this._keys[o].frame<=r&&this._keys.splice(o,1);this._ranges[e]=null}},e.prototype.getRange=function(e){return this._ranges[e]},e.prototype.getKeys=function(){return this._keys},e.prototype.getHighestFrame=function(){for(var e=0,t=0,i=this._keys.length;t0)return i.highLimitValue.clone?i.highLimitValue.clone():i.highLimitValue;var n=this._keys;if(1===n.length)return this._getKeyValue(n[0].value);var r=i.key;if(n[r].frame>=t)for(;r-1>=0&&n[r].frame>=t;)r--;for(var o=r;o=t){i.key=o;var a=n[o],h=this._getKeyValue(a.value);if(a.interpolation===l.N.STEP)return h;var c=this._getKeyValue(s.value),u=void 0!==a.outTangent&&void 0!==s.inTangent,f=s.frame-a.frame,d=(t-a.frame)/f,p=this.getEasingFunction();switch(null!=p&&(d=p.ease(d)),this.dataType){case e.ANIMATIONTYPE_FLOAT:var _=u?this.floatInterpolateFunctionWithTangents(h,a.outTangent*f,c,s.inTangent*f,d):this.floatInterpolateFunction(h,c,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return _;case e.ANIMATIONLOOPMODE_RELATIVE:return i.offsetValue*i.repeatCount+_}break;case e.ANIMATIONTYPE_QUATERNION:var g=u?this.quaternionInterpolateFunctionWithTangents(h,a.outTangent.scale(f),c,s.inTangent.scale(f),d):this.quaternionInterpolateFunction(h,c,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return g;case e.ANIMATIONLOOPMODE_RELATIVE:return g.addInPlace(i.offsetValue.scale(i.repeatCount))}return g;case e.ANIMATIONTYPE_VECTOR3:var m=u?this.vector3InterpolateFunctionWithTangents(h,a.outTangent.scale(f),c,s.inTangent.scale(f),d):this.vector3InterpolateFunction(h,c,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return m;case e.ANIMATIONLOOPMODE_RELATIVE:return m.add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_VECTOR2:var v=u?this.vector2InterpolateFunctionWithTangents(h,a.outTangent.scale(f),c,s.inTangent.scale(f),d):this.vector2InterpolateFunction(h,c,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return v;case e.ANIMATIONLOOPMODE_RELATIVE:return v.add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_SIZE:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return this.sizeInterpolateFunction(h,c,d);case e.ANIMATIONLOOPMODE_RELATIVE:return this.sizeInterpolateFunction(h,c,d).add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_COLOR3:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return this.color3InterpolateFunction(h,c,d);case e.ANIMATIONLOOPMODE_RELATIVE:return this.color3InterpolateFunction(h,c,d).add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_COLOR4:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return this.color4InterpolateFunction(h,c,d);case e.ANIMATIONLOOPMODE_RELATIVE:return this.color4InterpolateFunction(h,c,d).add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_MATRIX:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:if(e.AllowMatricesInterpolation)return this.matrixInterpolateFunction(h,c,d,i.workValue);case e.ANIMATIONLOOPMODE_RELATIVE:return h}}break}}return this._getKeyValue(n[n.length-1].value)},e.prototype.matrixInterpolateFunction=function(t,i,r,o){return e.AllowMatrixDecomposeForInterpolation?o?(n.y3.DecomposeLerpToRef(t,i,r,o),o):n.y3.DecomposeLerp(t,i,r):o?(n.y3.LerpToRef(t,i,r,o),o):n.y3.Lerp(t,i,r)},e.prototype.clone=function(){var t=new e(this.name,this.targetPropertyPath.join("."),this.framePerSecond,this.dataType,this.loopMode);if(t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed,this._keys&&t.setKeys(this._keys),this._ranges)for(var i in t._ranges={},this._ranges){var n=this._ranges[i];n&&(t._ranges[i]=n.clone())}return t},e.prototype.setKeys=function(e){this._keys=e.slice(0)},e.prototype.serialize=function(){var t={};t.name=this.name,t.property=this.targetProperty,t.framePerSecond=this.framePerSecond,t.dataType=this.dataType,t.loopBehavior=this.loopMode,t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed;var i=this.dataType;t.keys=[];for(var n=this.getKeys(),r=0;r=1&&(h=u.values[1]),u.values.length>=2&&(c=u.values[2]);break;case e.ANIMATIONTYPE_QUATERNION:if(i=n._f.FromArray(u.values),u.values.length>=8){var f=n._f.FromArray(u.values.slice(4,8));f.equals(n._f.Zero())||(h=f)}if(u.values.length>=12){var d=n._f.FromArray(u.values.slice(8,12));d.equals(n._f.Zero())||(c=d)}break;case e.ANIMATIONTYPE_MATRIX:i=n.y3.FromArray(u.values);break;case e.ANIMATIONTYPE_COLOR3:i=r.Wo.FromArray(u.values);break;case e.ANIMATIONTYPE_COLOR4:i=r.HE.FromArray(u.values);break;case e.ANIMATIONTYPE_VECTOR3:default:i=n.P.FromArray(u.values)}var p={};p.frame=u.frame,p.value=i,null!=h&&(p.inTangent=h),null!=c&&(p.outTangent=c),l.push(p)}if(s.setKeys(l),t.ranges)for(o=0;o{"use strict";var n;i.d(t,{N:()=>n}),function(e){e[e.STEP=1]="STEP"}(n||(n={}))},2117:(e,t,i)=>{"use strict";i.d(t,{X:()=>n});var n=function(){function e(e,t,i){this.name=e,this.from=t,this.to=i}return e.prototype.clone=function(){return new e(this.name,this.from,this.to)},e}()},5850:(e,t,i)=>{"use strict";i.r(t),i.d(t,{PointerDragBehavior:()=>p});var n=i(6212),r=i(4391),o=i(475),s=i(2973),a=i(5441),l=i(8035),h=i(9626),c=i(746),u=i(7659),f=function(){function e(e,t,i){void 0===i&&(i=Number.MAX_VALUE),this.origin=e,this.direction=t,this.length=i}return e.prototype.intersectsBoxMinMax=function(t,i,n){void 0===n&&(n=0);var r,o,s,a,l=e._TmpVector3[0].copyFromFloats(t.x-n,t.y-n,t.z-n),h=e._TmpVector3[1].copyFromFloats(i.x+n,i.y+n,i.z+n),c=0,u=Number.MAX_VALUE;if(Math.abs(this.direction.x)<1e-7){if(this.origin.xh.x)return!1}else if(r=1/this.direction.x,o=(l.x-this.origin.x)*r,(s=(h.x-this.origin.x)*r)===-1/0&&(s=1/0),o>s&&(a=o,o=s,s=a),(c=Math.max(o,c))>(u=Math.min(s,u)))return!1;if(Math.abs(this.direction.y)<1e-7){if(this.origin.yh.y)return!1}else if(r=1/this.direction.y,o=(l.y-this.origin.y)*r,(s=(h.y-this.origin.y)*r)===-1/0&&(s=1/0),o>s&&(a=o,o=s,s=a),(c=Math.max(o,c))>(u=Math.min(s,u)))return!1;if(Math.abs(this.direction.z)<1e-7){if(this.origin.zh.z)return!1}else if(r=1/this.direction.z,o=(l.z-this.origin.z)*r,(s=(h.z-this.origin.z)*r)===-1/0&&(s=1/0),o>s&&(a=o,o=s,s=a),(c=Math.max(o,c))>(u=Math.min(s,u)))return!1;return!0},e.prototype.intersectsBox=function(e,t){return void 0===t&&(t=0),this.intersectsBoxMinMax(e.minimum,e.maximum,t)},e.prototype.intersectsSphere=function(e,t){void 0===t&&(t=0);var i=e.center.x-this.origin.x,n=e.center.y-this.origin.y,r=e.center.z-this.origin.z,o=i*i+n*n+r*r,s=e.radius+t,a=s*s;if(o<=a)return!0;var l=i*this.direction.x+n*this.direction.y+r*this.direction.z;return!(l<0)&&o-l*l<=a},e.prototype.intersectsTriangle=function(t,i,n){var r=e._TmpVector3[0],o=e._TmpVector3[1],a=e._TmpVector3[2],l=e._TmpVector3[3],h=e._TmpVector3[4];i.subtractToRef(t,r),n.subtractToRef(t,o),s.P.CrossToRef(this.direction,o,a);var u=s.P.Dot(r,a);if(0===u)return null;var f=1/u;this.origin.subtractToRef(t,l);var d=s.P.Dot(l,a)*f;if(d<0||d>1)return null;s.P.CrossToRef(l,r,h);var p=s.P.Dot(this.direction,h)*f;if(p<0||d+p>1)return null;var _=s.P.Dot(o,h)*f;return _>this.length?null:new c.c(1-d-p,d,_)},e.prototype.intersectsPlane=function(e){var t,i=s.P.Dot(e.normal,this.direction);if(Math.abs(i)<9.99999997475243e-7)return null;var n=s.P.Dot(e.normal,this.origin);return(t=(-e.d-n)/i)<0?t<-9.99999997475243e-7?null:0:t},e.prototype.intersectsAxis=function(e,t){switch(void 0===t&&(t=0),e){case"y":return(i=(this.origin.y-t)/this.direction.y)>0?null:new s.P(this.origin.x+this.direction.x*-i,t,this.origin.z+this.direction.z*-i);case"x":return(i=(this.origin.x-t)/this.direction.x)>0?null:new s.P(t,this.origin.y+this.direction.y*-i,this.origin.z+this.direction.z*-i);case"z":var i;return(i=(this.origin.z-t)/this.direction.z)>0?null:new s.P(this.origin.x+this.direction.x*-i,this.origin.y+this.direction.y*-i,t);default:return null}},e.prototype.intersectsMesh=function(t,i){var n=s.jp.Matrix[0];return t.getWorldMatrix().invertToRef(n),this._tmpRay?e.TransformToRef(this,n,this._tmpRay):this._tmpRay=e.Transform(this,n),t.intersects(this._tmpRay,i)},e.prototype.intersectsMeshes=function(e,t,i){i?i.length=0:i=[];for(var n=0;nt.distance?1:0},e.prototype.intersectionSegment=function(t,i,n){var r=this.origin,o=s.jp.Vector3[0],a=s.jp.Vector3[1],l=s.jp.Vector3[2],h=s.jp.Vector3[3];i.subtractToRef(t,o),this.direction.scaleToRef(e.rayl,l),r.addToRef(l,a),t.subtractToRef(r,h);var c,u,f,d,p=s.P.Dot(o,o),_=s.P.Dot(o,l),g=s.P.Dot(l,l),m=s.P.Dot(o,h),v=s.P.Dot(l,h),y=p*g-_*_,b=y,T=y;yb&&(u=b,d=v+_,T=g)),d<0?(d=0,-m<0?u=0:-m>p?u=b:(u=-m,b=p)):d>T&&(d=T,-m+_<0?u=0:-m+_>p?u=b:(u=-m+_,b=p)),c=Math.abs(u)0&&f<=this.length&&C.lengthSquared()=e.distance?null:h:null},r.Scene.prototype._internalPick=function(e,t,i,n,r){if(!h.p)return null;for(var o=null,a=0;a1)throw"Multiple drag modes specified in dragBehavior options. Only one expected"}return Object.defineProperty(e.prototype,"options",{get:function(){return this._options},set:function(e){this._options=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return"PointerDrag"},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(t,i){var o=this;this._scene=t.getScene(),this.attachedNode=t,e._planeScene||(this._debugMode?e._planeScene=this._scene:(e._planeScene=new r.Scene(this._scene.getEngine(),{virtual:!0}),e._planeScene.detachControl(),this._scene.onDisposeObservable.addOnce((function(){e._planeScene.dispose(),e._planeScene=null})))),this._dragPlane=n.Mesh.CreatePlane("pointerDragPlane",this._debugMode?1:1e4,e._planeScene,!1,n.Mesh.DOUBLESIDE),this.lastDragPosition=new s.P(0,0,0);var l=i||function(e){return o.attachedNode==e||e.isDescendantOf(o.attachedNode)};this._pointerObserver=this._scene.onPointerObservable.add((function(t,i){if(o.enabled)if(t.type==a.kD.POINTERDOWN)o.startAndReleaseDragOnPointerEvents&&!o.dragging&&t.pickInfo&&t.pickInfo.hit&&t.pickInfo.pickedMesh&&t.pickInfo.pickedPoint&&t.pickInfo.ray&&l(t.pickInfo.pickedMesh)&&o._startDrag(t.event.pointerId,t.pickInfo.ray,t.pickInfo.pickedPoint);else if(t.type==a.kD.POINTERUP)o.startAndReleaseDragOnPointerEvents&&o.currentDraggingPointerID==t.event.pointerId&&o.releaseDrag();else if(t.type==a.kD.POINTERMOVE){var n=t.event.pointerId;if(o.currentDraggingPointerID===e._AnyMouseID&&n!==e._AnyMouseID){var r=t.event;("mouse"===r.pointerType||!o._scene.getEngine().hostInformation.isMobile&&r instanceof MouseEvent)&&(o._lastPointerRay[o.currentDraggingPointerID]&&(o._lastPointerRay[n]=o._lastPointerRay[o.currentDraggingPointerID],delete o._lastPointerRay[o.currentDraggingPointerID]),o.currentDraggingPointerID=n)}o._lastPointerRay[n]||(o._lastPointerRay[n]=new f(new s.P,new s.P)),t.pickInfo&&t.pickInfo.ray&&(o._lastPointerRay[n].origin.copyFrom(t.pickInfo.ray.origin),o._lastPointerRay[n].direction.copyFrom(t.pickInfo.ray.direction),o.currentDraggingPointerID==n&&o.dragging&&o._moveDrag(t.pickInfo.ray))}})),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add((function(){o._moving&&o.moveAttached&&(d._RemoveAndStorePivotPoint(o.attachedNode),o._targetPosition.subtractToRef(o.attachedNode.absolutePosition,o._tmpVector),o._tmpVector.scaleInPlace(o.dragDeltaRatio),o.attachedNode.getAbsolutePosition().addToRef(o._tmpVector,o._tmpVector),o.validateDrag(o._tmpVector)&&o.attachedNode.setAbsolutePosition(o._tmpVector),d._RestorePivotPoint(o.attachedNode))}))},e.prototype.releaseDrag=function(){if(this.dragging&&(this.dragging=!1,this.onDragEndObservable.notifyObservers({dragPlanePoint:this.lastDragPosition,pointerId:this.currentDraggingPointerID})),this.currentDraggingPointerID=-1,this._moving=!1,this.detachCameraControls&&this._attachedToElement&&this._scene.activeCamera&&!this._scene.activeCamera.leftCamera){if("ArcRotateCamera"===this._scene.activeCamera.getClassName()){var e=this._scene.activeCamera;e.attachControl(!e.inputs||e.inputs.noPreventDefault,e._useCtrlForPanning,e._panningMouseButton)}else this._scene.activeCamera.attachControl(!this._scene.activeCamera.inputs||this._scene.activeCamera.inputs.noPreventDefault);this._attachedToElement=!1}},e.prototype.startDrag=function(t,i,n){void 0===t&&(t=e._AnyMouseID),this._startDrag(t,i,n);var r=this._lastPointerRay[t];t===e._AnyMouseID&&(r=this._lastPointerRay[Object.keys(this._lastPointerRay)[0]]),r&&this._moveDrag(r)},e.prototype._startDrag=function(e,t,i){if(this._scene.activeCamera&&!this.dragging&&this.attachedNode){d._RemoveAndStorePivotPoint(this.attachedNode),t?(this._startDragRay.direction.copyFrom(t.direction),this._startDragRay.origin.copyFrom(t.origin)):(this._startDragRay.origin.copyFrom(this._scene.activeCamera.position),this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector),this._tmpVector.subtractToRef(this._scene.activeCamera.position,this._startDragRay.direction)),this._updateDragPlanePosition(this._startDragRay,i||this._tmpVector);var n=this._pickWithRayOnDragPlane(this._startDragRay);n&&(this.dragging=!0,this.currentDraggingPointerID=e,this.lastDragPosition.copyFrom(n),this.onDragStartObservable.notifyObservers({dragPlanePoint:n,pointerId:this.currentDraggingPointerID}),this._targetPosition.copyFrom(this.attachedNode.absolutePosition),this.detachCameraControls&&this._scene.activeCamera&&this._scene.activeCamera.inputs&&!this._scene.activeCamera.leftCamera&&(this._scene.activeCamera.inputs.attachedToElement?(this._scene.activeCamera.detachControl(),this._attachedToElement=!0):this._attachedToElement=!1)),d._RestorePivotPoint(this.attachedNode)}},e.prototype._moveDrag=function(e){this._moving=!0;var t=this._pickWithRayOnDragPlane(e);if(t){this.updateDragPlane&&this._updateDragPlanePosition(e,t);var i=0;this._options.dragAxis?(this.useObjectOrientationForDragging?s.P.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._worldDragAxis):this._worldDragAxis.copyFrom(this._options.dragAxis),t.subtractToRef(this.lastDragPosition,this._tmpVector),i=s.P.Dot(this._tmpVector,this._worldDragAxis),this._worldDragAxis.scaleToRef(i,this._dragDelta)):(i=this._dragDelta.length(),t.subtractToRef(this.lastDragPosition,this._dragDelta)),this._targetPosition.addInPlace(this._dragDelta),this.onDragObservable.notifyObservers({dragDistance:i,delta:this._dragDelta,dragPlanePoint:t,dragPlaneNormal:this._dragPlane.forward,pointerId:this.currentDraggingPointerID}),this.lastDragPosition.copyFrom(t)}},e.prototype._pickWithRayOnDragPlane=function(t){var i=this;if(!t)return null;var n=Math.acos(s.P.Dot(this._dragPlane.forward,t.direction));if(n>Math.PI/2&&(n=Math.PI-n),this.maxDragAngle>0&&n>this.maxDragAngle){if(this._useAlternatePickedPointAboveMaxDragAngle){this._tmpVector.copyFrom(t.direction),this.attachedNode.absolutePosition.subtractToRef(t.origin,this._alternatePickedPoint),this._alternatePickedPoint.normalize(),this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed*s.P.Dot(this._alternatePickedPoint,this._tmpVector)),this._tmpVector.addInPlace(this._alternatePickedPoint);var r=s.P.Dot(this._dragPlane.forward,this._tmpVector);return this._dragPlane.forward.scaleToRef(-r,this._alternatePickedPoint),this._alternatePickedPoint.addInPlace(this._tmpVector),this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition),this._alternatePickedPoint}return null}var o=e._planeScene.pickWithRay(t,(function(e){return e==i._dragPlane}));return o&&o.hit&&o.pickedMesh&&o.pickedPoint?o.pickedPoint:null},e.prototype._updateDragPlanePosition=function(e,t){this._pointA.copyFrom(t),this._options.dragAxis?(this.useObjectOrientationForDragging?s.P.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragAxis),e.origin.subtractToRef(this._pointA,this._pointC),this._pointC.normalize(),Math.abs(s.P.Dot(this._localAxis,this._pointC))>.999?Math.abs(s.P.Dot(s.P.UpReadOnly,this._pointC))>.999?this._lookAt.copyFrom(s.P.Right()):this._lookAt.copyFrom(s.P.UpReadOnly):(s.P.CrossToRef(this._localAxis,this._pointC,this._lookAt),s.P.CrossToRef(this._localAxis,this._lookAt,this._lookAt),this._lookAt.normalize()),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._lookAt,this._lookAt),this._dragPlane.lookAt(this._lookAt)):this._options.dragPlaneNormal?(this.useObjectOrientationForDragging?s.P.TransformCoordinatesToRef(this._options.dragPlaneNormal,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragPlaneNormal),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._localAxis,this._lookAt),this._dragPlane.lookAt(this._lookAt)):(this._dragPlane.position.copyFrom(this._pointA),this._dragPlane.lookAt(e.origin)),this._dragPlane.position.copyFrom(this.attachedNode.absolutePosition),this._dragPlane.computeWorldMatrix(!0)},e.prototype.detach=function(){this._pointerObserver&&this._scene.onPointerObservable.remove(this._pointerObserver),this._beforeRenderObserver&&this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver),this.releaseDrag()},e._AnyMouseID=-2,e}())},4752:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ArcRotateCamera:()=>I});var n=i(655),r=i(9023),o=i(475),s=i(2973),a=i(2686),l=i(6212),h=i(5441),c=i(5273),u=function(){function e(){this._zoomStopsAnimation=!1,this._idleRotationSpeed=.05,this._idleRotationWaitTime=2e3,this._idleRotationSpinupTime=2e3,this._isPointerDown=!1,this._lastFrameTime=null,this._lastInteractionTime=-1/0,this._cameraRotationSpeed=0,this._lastFrameRadius=0}return Object.defineProperty(e.prototype,"name",{get:function(){return"AutoRotation"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zoomStopsAnimation",{get:function(){return this._zoomStopsAnimation},set:function(e){this._zoomStopsAnimation=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idleRotationSpeed",{get:function(){return this._idleRotationSpeed},set:function(e){this._idleRotationSpeed=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idleRotationWaitTime",{get:function(){return this._idleRotationWaitTime},set:function(e){this._idleRotationWaitTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idleRotationSpinupTime",{get:function(){return this._idleRotationSpinupTime},set:function(e){this._idleRotationSpinupTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotationInProgress",{get:function(){return Math.abs(this._cameraRotationSpeed)>0},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){var t=this;this._attachedCamera=e;var i=this._attachedCamera.getScene();this._onPrePointerObservableObserver=i.onPrePointerObservable.add((function(e){e.type!==h.kD.POINTERDOWN?e.type===h.kD.POINTERUP&&(t._isPointerDown=!1):t._isPointerDown=!0})),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((function(){var e=c.F.Now,i=0;null!=t._lastFrameTime&&(i=e-t._lastFrameTime),t._lastFrameTime=e,t._applyUserInteraction();var n=e-t._lastInteractionTime-t._idleRotationWaitTime,r=Math.max(Math.min(n/t._idleRotationSpinupTime,1),0);t._cameraRotationSpeed=t._idleRotationSpeed*r,t._attachedCamera&&(t._attachedCamera.alpha-=t._cameraRotationSpeed*(i/1e3))}))},e.prototype.detach=function(){if(this._attachedCamera){var e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._attachedCamera=null}},e.prototype._userIsZooming=function(){return!!this._attachedCamera&&0!==this._attachedCamera.inertialRadiusOffset},e.prototype._shouldAnimationStopForInteraction=function(){if(!this._attachedCamera)return!1;var e=!1;return this._lastFrameRadius===this._attachedCamera.radius&&0!==this._attachedCamera.inertialRadiusOffset&&(e=!0),this._lastFrameRadius=this._attachedCamera.radius,this._zoomStopsAnimation?e:this._userIsZooming()},e.prototype._applyUserInteraction=function(){this._userIsMoving()&&!this._shouldAnimationStopForInteraction()&&(this._lastInteractionTime=c.F.Now)},e.prototype._userIsMoving=function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},e}(),f=i(7580),d=function(){function e(){this._easingMode=e.EASINGMODE_EASEIN}return e.prototype.setEasingMode=function(e){var t=Math.min(Math.max(e,0),2);this._easingMode=t},e.prototype.getEasingMode=function(){return this._easingMode},e.prototype.easeInCore=function(e){throw new Error("You must implement this method")},e.prototype.ease=function(t){switch(this._easingMode){case e.EASINGMODE_EASEIN:return this.easeInCore(t);case e.EASINGMODE_EASEOUT:return 1-this.easeInCore(1-t)}return t>=.5?.5*(1-this.easeInCore(2*(1-t)))+.5:.5*this.easeInCore(2*t)},e.EASINGMODE_EASEIN=0,e.EASINGMODE_EASEOUT=1,e.EASINGMODE_EASEINOUT=2,e}(),p=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return e=Math.max(0,Math.min(1,e)),1-Math.sqrt(1-e*e)}}(d),function(e){function t(t){void 0===t&&(t=1);var i=e.call(this)||this;return i.amplitude=t,i}return(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.amplitude);return Math.pow(e,3)-e*t*Math.sin(3.141592653589793*e)},t}(d)),_=(function(e){function t(t,i){void 0===t&&(t=3),void 0===i&&(i=2);var n=e.call(this)||this;return n.bounces=t,n.bounciness=i,n}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.bounces),i=this.bounciness;i<=1&&(i=1.001);var n=Math.pow(i,t),r=1-i,o=(1-n)/r+.5*n,s=e*o,a=Math.log(-s*(1-i)+1)/Math.log(i),l=Math.floor(a),h=l+1,c=(1-Math.pow(i,l))/(r*o),u=.5*(c+(1-Math.pow(i,h))/(r*o)),f=e-u,d=u-c;return-Math.pow(1/i,t-l)/(d*d)*(f-d)*(f+d)}}(d),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return e*e*e}}(d),function(e){function t(t,i){void 0===t&&(t=3),void 0===i&&(i=3);var n=e.call(this)||this;return n.oscillations=t,n.springiness=i,n}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.oscillations),i=Math.max(0,this.springiness);return(0==i?e:(Math.exp(i*e)-1)/(Math.exp(i)-1))*Math.sin((6.283185307179586*t+1.5707963267948966)*e)}}(d),function(e){function t(t){void 0===t&&(t=2);var i=e.call(this)||this;return i.exponent=t,i}return(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return this.exponent<=0?e:(Math.exp(this.exponent*e)-1)/(Math.exp(this.exponent)-1)},t}(d)),g=(function(e){function t(t){void 0===t&&(t=2);var i=e.call(this)||this;return i.power=t,i}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.power);return Math.pow(e,t)}}(d),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return e*e}}(d),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return e*e*e*e}}(d),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return e*e*e*e*e}}(d),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return 1-Math.sin(1.5707963267948966*(1-e))}}(d),function(e){function t(t,i,n,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1);var o=e.call(this)||this;return o.x1=t,o.y1=i,o.x2=n,o.y2=r,o}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return f.hr.Interpolate(e,this.x1,this.y1,this.x2,this.y2)}}(d),i(4635)),m=function(){function e(){this.transitionDuration=450,this.lowerRadiusTransitionRange=2,this.upperRadiusTransitionRange=-2,this._autoTransitionRange=!1,this._radiusIsAnimating=!1,this._radiusBounceTransition=null,this._animatables=new Array}return Object.defineProperty(e.prototype,"name",{get:function(){return"Bouncing"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoTransitionRange",{get:function(){return this._autoTransitionRange},set:function(e){var t=this;if(this._autoTransitionRange!==e){this._autoTransitionRange=e;var i=this._attachedCamera;i&&(e?this._onMeshTargetChangedObserver=i.onMeshTargetChangedObservable.add((function(e){if(e){e.computeWorldMatrix(!0);var i=e.getBoundingInfo().diagonalLength;t.lowerRadiusTransitionRange=.05*i,t.upperRadiusTransitionRange=.05*i}})):this._onMeshTargetChangedObserver&&i.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver))}},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){var t=this;this._attachedCamera=e,this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((function(){t._attachedCamera&&(t._isRadiusAtLimit(t._attachedCamera.lowerRadiusLimit)&&t._applyBoundRadiusAnimation(t.lowerRadiusTransitionRange),t._isRadiusAtLimit(t._attachedCamera.upperRadiusLimit)&&t._applyBoundRadiusAnimation(t.upperRadiusTransitionRange))}))},e.prototype.detach=function(){this._attachedCamera&&(this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null)},e.prototype._isRadiusAtLimit=function(e){return!!this._attachedCamera&&(this._attachedCamera.radius===e&&!this._radiusIsAnimating)},e.prototype._applyBoundRadiusAnimation=function(t){var i=this;if(this._attachedCamera){this._radiusBounceTransition||(e.EasingFunction.setEasingMode(e.EasingMode),this._radiusBounceTransition=g.f.CreateAnimation("radius",g.f.ANIMATIONTYPE_FLOAT,60,e.EasingFunction)),this._cachedWheelPrecision=this._attachedCamera.wheelPrecision,this._attachedCamera.wheelPrecision=1/0,this._attachedCamera.inertialRadiusOffset=0,this.stopAllAnimations(),this._radiusIsAnimating=!0;var n=g.f.TransitionTo("radius",this._attachedCamera.radius+t,this._attachedCamera,this._attachedCamera.getScene(),60,this._radiusBounceTransition,this.transitionDuration,(function(){return i._clearAnimationLocks()}));n&&this._animatables.push(n)}},e.prototype._clearAnimationLocks=function(){this._radiusIsAnimating=!1,this._attachedCamera&&(this._attachedCamera.wheelPrecision=this._cachedWheelPrecision)},e.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0].onAnimationEnd=null,this._animatables[0].stop(),this._animatables.shift()},e.EasingFunction=new p(.3),e.EasingMode=d.EASINGMODE_EASEOUT,e}(),v=function(){function e(){this._mode=e.FitFrustumSidesMode,this._radiusScale=1,this._positionScale=.5,this._defaultElevation=.3,this._elevationReturnTime=1500,this._elevationReturnWaitTime=1e3,this._zoomStopsAnimation=!1,this._framingTime=1500,this.autoCorrectCameraLimitsAndSensibility=!0,this._isPointerDown=!1,this._lastInteractionTime=-1/0,this._animatables=new Array,this._betaIsAnimating=!1}return Object.defineProperty(e.prototype,"name",{get:function(){return"Framing"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mode",{get:function(){return this._mode},set:function(e){this._mode=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radiusScale",{get:function(){return this._radiusScale},set:function(e){this._radiusScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"positionScale",{get:function(){return this._positionScale},set:function(e){this._positionScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultElevation",{get:function(){return this._defaultElevation},set:function(e){this._defaultElevation=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"elevationReturnTime",{get:function(){return this._elevationReturnTime},set:function(e){this._elevationReturnTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"elevationReturnWaitTime",{get:function(){return this._elevationReturnWaitTime},set:function(e){this._elevationReturnWaitTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zoomStopsAnimation",{get:function(){return this._zoomStopsAnimation},set:function(e){this._zoomStopsAnimation=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"framingTime",{get:function(){return this._framingTime},set:function(e){this._framingTime=e},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(t){var i=this;this._attachedCamera=t;var n=this._attachedCamera.getScene();e.EasingFunction.setEasingMode(e.EasingMode),this._onPrePointerObservableObserver=n.onPrePointerObservable.add((function(e){e.type!==h.kD.POINTERDOWN?e.type===h.kD.POINTERUP&&(i._isPointerDown=!1):i._isPointerDown=!0})),this._onMeshTargetChangedObserver=t.onMeshTargetChangedObservable.add((function(e){e&&i.zoomOnMesh(e)})),this._onAfterCheckInputsObserver=t.onAfterCheckInputsObservable.add((function(){i._applyUserInteraction(),i._maintainCameraAboveGround()}))},e.prototype.detach=function(){if(this._attachedCamera){var e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null}},e.prototype.zoomOnMesh=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null),e.computeWorldMatrix(!0);var n=e.getBoundingInfo().boundingBox;this.zoomOnBoundingInfo(n.minimumWorld,n.maximumWorld,t,i)},e.prototype.zoomOnMeshHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null),e.computeWorldMatrix(!0);var n=e.getHierarchyBoundingVectors(!0);this.zoomOnBoundingInfo(n.min,n.max,t,i)},e.prototype.zoomOnMeshesHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null);for(var n=new s.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r=new s.P(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),o=0;oh.upperRadiusLimit?h.upperRadiusLimit:l),l):0},e.prototype._maintainCameraAboveGround=function(){var t=this;if(!(this._elevationReturnTime<0)){var i=c.F.Now-this._lastInteractionTime,n=.5*Math.PI-this._defaultElevation,r=.5*Math.PI;if(this._attachedCamera&&!this._betaIsAnimating&&this._attachedCamera.beta>r&&i>=this._elevationReturnWaitTime){this._betaIsAnimating=!0,this.stopAllAnimations(),this._betaTransition||(this._betaTransition=g.f.CreateAnimation("beta",g.f.ANIMATIONTYPE_FLOAT,60,e.EasingFunction));var o=g.f.TransitionTo("beta",n,this._attachedCamera,this._attachedCamera.getScene(),60,this._betaTransition,this._elevationReturnTime,(function(){t._clearAnimationLocks(),t.stopAllAnimations()}));o&&this._animatables.push(o)}}},e.prototype._getFrustumSlope=function(){var e=this._attachedCamera;if(!e)return s.FM.Zero();var t=e.getScene().getEngine().getAspectRatio(e),i=Math.tan(e.fov/2),n=i*t;return new s.FM(n,i)},e.prototype._clearAnimationLocks=function(){this._betaIsAnimating=!1},e.prototype._applyUserInteraction=function(){this.isUserIsMoving&&(this._lastInteractionTime=c.F.Now,this.stopAllAnimations(),this._clearAnimationLocks())},e.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0]&&(this._animatables[0].onAnimationEnd=null,this._animatables[0].stop()),this._animatables.shift()},Object.defineProperty(e.prototype,"isUserIsMoving",{get:function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},enumerable:!1,configurable:!0}),e.EasingFunction=new _,e.EasingMode=d.EASINGMODE_EASEINOUT,e.IgnoreBoundsSizeMode=0,e.FitFrustumSidesMode=1,e}(),y=i(7659),b=i(6955),T=i(748),A=i(5540),E=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.buttons=[0,1,2],t.angularSensibilityX=1e3,t.angularSensibilityY=1e3,t.pinchPrecision=12,t.pinchDeltaPercentage=0,t.useNaturalPinchZoom=!1,t.panningSensibility=1e3,t.multiTouchPanning=!0,t.multiTouchPanAndZoom=!0,t.pinchInwards=!0,t._isPanClick=!1,t._twoFingerActivityCount=0,t._isPinching=!1,t}return(0,n.ZT)(t,e),t.prototype.getClassName=function(){return"ArcRotateCameraPointersInput"},t.prototype.onTouch=function(e,t,i){0!==this.panningSensibility&&(this._ctrlKey&&this.camera._useCtrlForPanning||this._isPanClick)?(this.camera.inertialPanningX+=-t/this.panningSensibility,this.camera.inertialPanningY+=i/this.panningSensibility):(this.camera.inertialAlphaOffset-=t/this.angularSensibilityX,this.camera.inertialBetaOffset-=i/this.angularSensibilityY)},t.prototype.onDoubleTap=function(e){this.camera.useInputToRestoreState&&this.camera.restoreState()},t.prototype.onMultiTouch=function(e,t,i,n,r,o){if(!(0===i&&null===r||0===n&&null===o)){var s=this.pinchInwards?1:-1;if(this.multiTouchPanAndZoom){if(this.useNaturalPinchZoom?this.camera.radius=this.camera.radius*Math.sqrt(i)/Math.sqrt(n):this.pinchDeltaPercentage?this.camera.inertialRadiusOffset+=.001*(n-i)*this.camera.radius*this.pinchDeltaPercentage:this.camera.inertialRadiusOffset+=(n-i)/(this.pinchPrecision*s*(this.angularSensibilityX+this.angularSensibilityY)/2),0!==this.panningSensibility&&r&&o){var a=o.x-r.x,l=o.y-r.y;this.camera.inertialPanningX+=-a/this.panningSensibility,this.camera.inertialPanningY+=l/this.panningSensibility}}else{this._twoFingerActivityCount++;var h=Math.sqrt(i),c=Math.sqrt(n);if(this._isPinching||this._twoFingerActivityCount<20&&Math.abs(c-h)>this.camera.pinchToPanMaxDistance)this.pinchDeltaPercentage?this.camera.inertialRadiusOffset+=.001*(n-i)*this.camera.radius*this.pinchDeltaPercentage:this.camera.inertialRadiusOffset+=(n-i)/(this.pinchPrecision*s*(this.angularSensibilityX+this.angularSensibilityY)/2),this._isPinching=!0;else if(0!==this.panningSensibility&&this.multiTouchPanning&&o&&r){a=o.x-r.x,l=o.y-r.y;this.camera.inertialPanningX+=-a/this.panningSensibility,this.camera.inertialPanningY+=l/this.panningSensibility}}}},t.prototype.onButtonDown=function(e){this._isPanClick=e.button===this.camera._panningMouseButton},t.prototype.onButtonUp=function(e){this._twoFingerActivityCount=0,this._isPinching=!1},t.prototype.onLostFocus=function(){this._isPanClick=!1,this._twoFingerActivityCount=0,this._isPinching=!1},(0,n.gn)([(0,r.qC)()],t.prototype,"buttons",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"angularSensibilityX",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"angularSensibilityY",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"pinchPrecision",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"pinchDeltaPercentage",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"useNaturalPinchZoom",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"panningSensibility",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"multiTouchPanning",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"multiTouchPanAndZoom",void 0),t}(function(){function e(){this.buttons=[0,1,2]}return e.prototype.attachControl=function(e){var t=this;e=A.w1.BackCompatCameraNoPreventDefault(arguments);var i=this.camera.getEngine(),n=i.getInputElement(),r=0,o=null;this.pointA=null,this.pointB=null,this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._buttonsPressed=0,this._pointerInput=function(s,a){var l=s.event,c="touch"===l.pointerType;if(!i.isInVRExclusivePointerMode&&(s.type===h.kD.POINTERMOVE||-1!==t.buttons.indexOf(l.button))){var u=l.srcElement||l.target;if(t._altKey=l.altKey,t._ctrlKey=l.ctrlKey,t._metaKey=l.metaKey,t._shiftKey=l.shiftKey,t._buttonsPressed=l.buttons,i.isPointerLock){var f=l.movementX||l.mozMovementX||l.webkitMovementX||l.msMovementX||0,d=l.movementY||l.mozMovementY||l.webkitMovementY||l.msMovementY||0;t.onTouch(null,f,d),t.pointA=null,t.pointB=null}else if(s.type===h.kD.POINTERDOWN&&u){try{u.setPointerCapture(l.pointerId)}catch(e){}null===t.pointA?t.pointA={x:l.clientX,y:l.clientY,pointerId:l.pointerId,type:l.pointerType}:null===t.pointB&&(t.pointB={x:l.clientX,y:l.clientY,pointerId:l.pointerId,type:l.pointerType}),t.onButtonDown(l),e||(l.preventDefault(),n&&n.focus())}else if(s.type===h.kD.POINTERDOUBLETAP)t.onDoubleTap(l.pointerType);else if(s.type===h.kD.POINTERUP&&u){try{u.releasePointerCapture(l.pointerId)}catch(e){}c||(t.pointB=null),i._badOS?t.pointA=t.pointB=null:t.pointB&&t.pointA&&t.pointA.pointerId==l.pointerId?(t.pointA=t.pointB,t.pointB=null):t.pointA&&t.pointB&&t.pointB.pointerId==l.pointerId?t.pointB=null:t.pointA=t.pointB=null,(0!==r||o)&&(t.onMultiTouch(t.pointA,t.pointB,r,0,o,null),r=0,o=null),t.onButtonUp(l),e||l.preventDefault()}else if(s.type===h.kD.POINTERMOVE)if(e||l.preventDefault(),t.pointA&&null===t.pointB){f=l.clientX-t.pointA.x,d=l.clientY-t.pointA.y;t.onTouch(t.pointA,f,d),t.pointA.x=l.clientX,t.pointA.y=l.clientY}else if(t.pointA&&t.pointB){var p=t.pointA.pointerId===l.pointerId?t.pointA:t.pointB;p.x=l.clientX,p.y=l.clientY;var _=t.pointA.x-t.pointB.x,g=t.pointA.y-t.pointB.y,m=_*_+g*g,v={x:(t.pointA.x+t.pointB.x)/2,y:(t.pointA.y+t.pointB.y)/2,pointerId:l.pointerId,type:s.type};t.onMultiTouch(t.pointA,t.pointB,r,m,o,v),o=v,r=m}}},this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,h.kD.POINTERDOWN|h.kD.POINTERUP|h.kD.POINTERMOVE),this._onLostFocus=function(){t.pointA=t.pointB=null,r=0,o=null,t.onLostFocus()},n&&n.addEventListener("contextmenu",this.onContextMenu.bind(this),!1);var s=this.camera.getScene().getEngine().getHostWindow();s&&A.w1.RegisterTopRootEvents(s,[{name:"blur",handler:this._onLostFocus}])},e.prototype.detachControl=function(e){if(this._onLostFocus){var t=this.camera.getScene().getEngine().getHostWindow();t&&A.w1.UnregisterTopRootEvents(t,[{name:"blur",handler:this._onLostFocus}])}if(this._observer){if(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this.onContextMenu){var i=this.camera.getScene().getEngine().getInputElement();i&&i.removeEventListener("contextmenu",this.onContextMenu)}this._onLostFocus=null}this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._buttonsPressed=0},e.prototype.getClassName=function(){return"BaseCameraPointersInput"},e.prototype.getSimpleName=function(){return"pointers"},e.prototype.onDoubleTap=function(e){},e.prototype.onTouch=function(e,t,i){},e.prototype.onMultiTouch=function(e,t,i,n,r,o){},e.prototype.onContextMenu=function(e){e.preventDefault()},e.prototype.onButtonDown=function(e){},e.prototype.onButtonUp=function(e){},e.prototype.onLostFocus=function(){},(0,n.gn)([(0,r.qC)()],e.prototype,"buttons",void 0),e}());T.u.ArcRotateCameraPointersInput=E;var C=i(3997),x=function(){function e(){this.keysUp=[38],this.keysDown=[40],this.keysLeft=[37],this.keysRight=[39],this.keysReset=[220],this.panningSensibility=50,this.zoomingSensibility=25,this.useAltToZoom=!0,this.angularSpeed=.01,this._keys=new Array}return e.prototype.attachControl=function(e){var t=this;e=A.w1.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((function(){t._keys=[]})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((function(i){var n,r=i.event;r.metaKey||(i.type===C.OG.KEYDOWN?(t._ctrlPressed=r.ctrlKey,t._altPressed=r.altKey,(-1!==t.keysUp.indexOf(r.keyCode)||-1!==t.keysDown.indexOf(r.keyCode)||-1!==t.keysLeft.indexOf(r.keyCode)||-1!==t.keysRight.indexOf(r.keyCode)||-1!==t.keysReset.indexOf(r.keyCode))&&(-1===(n=t._keys.indexOf(r.keyCode))&&t._keys.push(r.keyCode),r.preventDefault&&(e||r.preventDefault()))):-1===t.keysUp.indexOf(r.keyCode)&&-1===t.keysDown.indexOf(r.keyCode)&&-1===t.keysLeft.indexOf(r.keyCode)&&-1===t.keysRight.indexOf(r.keyCode)&&-1===t.keysReset.indexOf(r.keyCode)||((n=t._keys.indexOf(r.keyCode))>=0&&t._keys.splice(n,1),r.preventDefault&&(e||r.preventDefault())))})))},e.prototype.detachControl=function(e){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys=[]},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t0?i/(1+this.wheelDeltaPercentage):i*(1+this.wheelDeltaPercentage)},e.prototype.attachControl=function(e){var t=this;e=A.w1.BackCompatCameraNoPreventDefault(arguments),this._wheel=function(i,n){if(i.type===h.kD.POINTERWHEEL){var r=i.event,o=0,s=r,a=0;if(a=s.wheelDelta?s.wheelDelta:60*-(r.deltaY||r.detail),t.wheelDeltaPercentage){if((o=t.computeDeltaFromMouseWheelLegacyEvent(a,t.camera.radius))>0){for(var l=t.camera.radius,c=t.camera.inertialRadiusOffset+o,u=0;u<20&&Math.abs(c)>.001;u++)l-=c,c*=t.camera.inertia;l=S.R.Clamp(l,0,Number.MAX_VALUE),o=t.computeDeltaFromMouseWheelLegacyEvent(a,l)}}else o=a/(40*t.wheelPrecision);o&&(t.camera.inertialRadiusOffset+=o),r.preventDefault&&(e||r.preventDefault())}},this._observer=this.camera.getScene().onPointerObservable.add(this._wheel,h.kD.POINTERWHEEL)},e.prototype.detachControl=function(e){this._observer&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._wheel=null)},e.prototype.getClassName=function(){return"ArcRotateCameraMouseWheelInput"},e.prototype.getSimpleName=function(){return"mousewheel"},(0,n.gn)([(0,r.qC)()],e.prototype,"wheelPrecision",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"wheelDeltaPercentage",void 0),e}();T.u.ArcRotateCameraMouseWheelInput=R;var M=function(e){function t(t){return e.call(this,t)||this}return(0,n.ZT)(t,e),t.prototype.addMouseWheel=function(){return this.add(new R),this},t.prototype.addPointers=function(){return this.add(new E),this},t.prototype.addKeyboard=function(){return this.add(new x),this},t}(T.p),P=i(2782);a.N.AddNodeConstructor("ArcRotateCamera",(function(e,t){return function(){return new I(e,0,0,1,s.P.Zero(),t)}}));var I=function(e){function t(t,i,n,r,a,l,h){void 0===h&&(h=!0);var c=e.call(this,t,s.P.Zero(),l,h)||this;return c.inertialAlphaOffset=0,c.inertialBetaOffset=0,c.inertialRadiusOffset=0,c.lowerAlphaLimit=null,c.upperAlphaLimit=null,c.lowerBetaLimit=.01,c.upperBetaLimit=Math.PI-.01,c.lowerRadiusLimit=null,c.upperRadiusLimit=null,c.inertialPanningX=0,c.inertialPanningY=0,c.pinchToPanMaxDistance=20,c.panningDistanceLimit=null,c.panningOriginTarget=s.P.Zero(),c.panningInertia=.9,c.zoomOnFactor=1,c.targetScreenOffset=s.FM.Zero(),c.allowUpsideDown=!0,c.useInputToRestoreState=!0,c._viewMatrix=new s.y3,c.panningAxis=new s.P(1,1,0),c.onMeshTargetChangedObservable=new o.y$,c.checkCollisions=!1,c.collisionRadius=new s.P(.5,.5,.5),c._previousPosition=s.P.Zero(),c._collisionVelocity=s.P.Zero(),c._newPosition=s.P.Zero(),c._computationVector=s.P.Zero(),c._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),i?(c.setPosition(t),c.onCollide&&c.onCollide(i)):c._previousPosition.copyFrom(c._position);var n=Math.cos(c.alpha),r=Math.sin(c.alpha),o=Math.cos(c.beta),s=Math.sin(c.beta);0===s&&(s=1e-4);var a=c._getTargetPosition();c._computationVector.copyFromFloats(c.radius*n*s,c.radius*o,c.radius*r*s),a.addToRef(c._computationVector,c._newPosition),c._position.copyFrom(c._newPosition);var l=c.upVector;c.allowUpsideDown&&c.beta<0&&(l=(l=l.clone()).negate()),c._computeViewMatrix(c._position,a,l),c._viewMatrix.addAtIndex(12,c.targetScreenOffset.x),c._viewMatrix.addAtIndex(13,c.targetScreenOffset.y),c._collisionTriggered=!1},c._target=s.P.Zero(),a&&c.setTarget(a),c.alpha=i,c.beta=n,c.radius=r,c.getViewMatrix(),c.inputs=new M(c),c.inputs.addKeyboard().addMouseWheel().addPointers(),c}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(e){this.setTarget(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){this.setPosition(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"upVector",{get:function(){return this._upVector},set:function(e){this._upToYMatrix||(this._YToUpMatrix=new s.y3,this._upToYMatrix=new s.y3,this._upVector=s.P.Zero()),e.normalize(),this._upVector.copyFrom(e),this.setMatUp()},enumerable:!1,configurable:!0}),t.prototype.setMatUp=function(){s.y3.RotationAlignToRef(s.P.UpReadOnly,this._upVector,this._YToUpMatrix),s.y3.RotationAlignToRef(this._upVector,s.P.UpReadOnly,this._upToYMatrix)},Object.defineProperty(t.prototype,"angularSensibilityX",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityX:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityX=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"angularSensibilityY",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityY:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityY=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pinchPrecision",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchPrecision:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchPrecision=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pinchDeltaPercentage",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchDeltaPercentage:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchDeltaPercentage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useNaturalPinchZoom",{get:function(){var e=this.inputs.attached.pointers;return!!e&&e.useNaturalPinchZoom},set:function(e){var t=this.inputs.attached.pointers;t&&(t.useNaturalPinchZoom=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panningSensibility",{get:function(){var e=this.inputs.attached.pointers;return e?e.panningSensibility:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.panningSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wheelPrecision",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelPrecision:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelPrecision=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wheelDeltaPercentage",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelDeltaPercentage:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelDeltaPercentage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bouncingBehavior",{get:function(){return this._bouncingBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useBouncingBehavior",{get:function(){return null!=this._bouncingBehavior},set:function(e){e!==this.useBouncingBehavior&&(e?(this._bouncingBehavior=new m,this.addBehavior(this._bouncingBehavior)):this._bouncingBehavior&&(this.removeBehavior(this._bouncingBehavior),this._bouncingBehavior=null))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"framingBehavior",{get:function(){return this._framingBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useFramingBehavior",{get:function(){return null!=this._framingBehavior},set:function(e){e!==this.useFramingBehavior&&(e?(this._framingBehavior=new v,this.addBehavior(this._framingBehavior)):this._framingBehavior&&(this.removeBehavior(this._framingBehavior),this._framingBehavior=null))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoRotationBehavior",{get:function(){return this._autoRotationBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useAutoRotationBehavior",{get:function(){return null!=this._autoRotationBehavior},set:function(e){e!==this.useAutoRotationBehavior&&(e?(this._autoRotationBehavior=new u,this.addBehavior(this._autoRotationBehavior)):this._autoRotationBehavior&&(this.removeBehavior(this._autoRotationBehavior),this._autoRotationBehavior=null))},enumerable:!1,configurable:!0}),t.prototype._initCache=function(){e.prototype._initCache.call(this),this._cache._target=new s.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.alpha=void 0,this._cache.beta=void 0,this._cache.radius=void 0,this._cache.targetScreenOffset=s.FM.Zero()},t.prototype._updateCache=function(t){t||e.prototype._updateCache.call(this),this._cache._target.copyFrom(this._getTargetPosition()),this._cache.alpha=this.alpha,this._cache.beta=this.beta,this._cache.radius=this.radius,this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset)},t.prototype._getTargetPosition=function(){if(this._targetHost&&this._targetHost.getAbsolutePosition){var e=this._targetHost.absolutePosition;this._targetBoundingCenter?e.addToRef(this._targetBoundingCenter,this._target):this._target.copyFrom(e)}var t=this._getLockedTargetPosition();return t||this._target},t.prototype.storeState=function(){return this._storedAlpha=this.alpha,this._storedBeta=this.beta,this._storedRadius=this.radius,this._storedTarget=this._getTargetPosition().clone(),this._storedTargetScreenOffset=this.targetScreenOffset.clone(),e.prototype.storeState.call(this)},t.prototype._restoreStateValues=function(){return!!e.prototype._restoreStateValues.call(this)&&(this.setTarget(this._storedTarget.clone()),this.alpha=this._storedAlpha,this.beta=this._storedBeta,this.radius=this._storedRadius,this.targetScreenOffset=this._storedTargetScreenOffset.clone(),this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,this.inertialPanningY=0,!0)},t.prototype._isSynchronizedViewMatrix=function(){return!!e.prototype._isSynchronizedViewMatrix.call(this)&&(this._cache._target.equals(this._getTargetPosition())&&this._cache.alpha===this.alpha&&this._cache.beta===this.beta&&this._cache.radius===this.radius&&this._cache.targetScreenOffset.equals(this.targetScreenOffset))},t.prototype.attachControl=function(e,t,i,n){var r=this;void 0===i&&(i=!0),void 0===n&&(n=2),t=A.w1.BackCompatCameraNoPreventDefault(arguments),this._useCtrlForPanning=i,this._panningMouseButton=n,"boolean"==typeof arguments[0]&&(arguments.length>1&&(this._useCtrlForPanning=arguments[1]),arguments.length>2&&(this._panningMouseButton=arguments[2])),this.inputs.attachElement(t),this._reset=function(){r.inertialAlphaOffset=0,r.inertialBetaOffset=0,r.inertialRadiusOffset=0,r.inertialPanningX=0,r.inertialPanningY=0}},t.prototype.detachControl=function(e){this.inputs.detachElement(),this._reset&&this._reset()},t.prototype._checkInputs=function(){if(!this._collisionTriggered){if(this.inputs.checkInputs(),0!==this.inertialAlphaOffset||0!==this.inertialBetaOffset||0!==this.inertialRadiusOffset){var t=this.inertialAlphaOffset;this.beta<=0&&(t*=-1),this.getScene().useRightHandedSystem&&(t*=-1),this.parent&&this.parent._getWorldMatrixDeterminant()<0&&(t*=-1),this.alpha+=t,this.beta+=this.inertialBetaOffset,this.radius-=this.inertialRadiusOffset,this.inertialAlphaOffset*=this.inertia,this.inertialBetaOffset*=this.inertia,this.inertialRadiusOffset*=this.inertia,Math.abs(this.inertialAlphaOffset)Math.PI&&(this.beta=this.beta-2*Math.PI):this.betathis.upperBetaLimit&&(this.beta=this.upperBetaLimit),null!==this.lowerAlphaLimit&&this.alphathis.upperAlphaLimit&&(this.alpha=this.upperAlphaLimit),null!==this.lowerRadiusLimit&&this.radiusthis.upperRadiusLimit&&(this.radius=this.upperRadiusLimit,this.inertialRadiusOffset=0)},t.prototype.rebuildAnglesAndRadius=function(){this._position.subtractToRef(this._getTargetPosition(),this._computationVector),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||s.P.TransformCoordinatesToRef(this._computationVector,this._upToYMatrix,this._computationVector),this.radius=this._computationVector.length(),0===this.radius&&(this.radius=1e-4);var e=this.alpha;0===this._computationVector.x&&0===this._computationVector.z?this.alpha=Math.PI/2:this.alpha=Math.acos(this._computationVector.x/Math.sqrt(Math.pow(this._computationVector.x,2)+Math.pow(this._computationVector.z,2))),this._computationVector.z<0&&(this.alpha=2*Math.PI-this.alpha);var t=Math.round((e-this.alpha)/(2*Math.PI));this.alpha+=2*t*Math.PI,this.beta=Math.acos(this._computationVector.y/this.radius),this._checkLimits()},t.prototype.setPosition=function(e){this._position.equals(e)||(this._position.copyFrom(e),this.rebuildAnglesAndRadius())},t.prototype.setTarget=function(e,t,i){if(void 0===t&&(t=!1),void 0===i&&(i=!1),e.getBoundingInfo)this._targetBoundingCenter=t?e.getBoundingInfo().boundingBox.centerWorld.clone():null,e.computeWorldMatrix(),this._targetHost=e,this._target=this._getTargetPosition(),this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);else{var n=e,r=this._getTargetPosition();if(r&&!i&&r.equals(n))return;this._targetHost=null,this._target=n,this._targetBoundingCenter=null,this.onMeshTargetChangedObservable.notifyObservers(null)}this.rebuildAnglesAndRadius()},t.prototype._getViewMatrix=function(){var e=Math.cos(this.alpha),t=Math.sin(this.alpha),i=Math.cos(this.beta),n=Math.sin(this.beta);0===n&&(n=1e-4),0===this.radius&&(this.radius=1e-4);var r=this._getTargetPosition();if(this._computationVector.copyFromFloats(this.radius*e*n,this.radius*i,this.radius*t*n),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||s.P.TransformCoordinatesToRef(this._computationVector,this._YToUpMatrix,this._computationVector),r.addToRef(this._computationVector,this._newPosition),this.getScene().collisionsEnabled&&this.checkCollisions){var o=this.getScene().collisionCoordinator;this._collider||(this._collider=o.createCollider()),this._collider._radius=this.collisionRadius,this._newPosition.subtractToRef(this._position,this._collisionVelocity),this._collisionTriggered=!0,o.getNewPosition(this._position,this._collisionVelocity,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)}else{this._position.copyFrom(this._newPosition);var a=this.upVector;this.allowUpsideDown&&n<0&&(a=a.negate()),this._computeViewMatrix(this._position,r,a),this._viewMatrix.addAtIndex(12,this.targetScreenOffset.x),this._viewMatrix.addAtIndex(13,this.targetScreenOffset.y)}return this._currentTarget=r,this._viewMatrix},t.prototype.zoomOn=function(e,t){void 0===t&&(t=!1),e=e||this.getScene().meshes;var i=l.Mesh.MinMax(e),n=s.P.Distance(i.min,i.max);this.radius=n*this.zoomOnFactor,this.focusOn({min:i.min,max:i.max,distance:n},t)},t.prototype.focusOn=function(e,t){var i,n;if(void 0===t&&(t=!1),void 0===e.min){var r=e||this.getScene().meshes;i=l.Mesh.MinMax(r),n=s.P.Distance(i.min,i.max)}else{i=e,n=e.distance}this._target=l.Mesh.Center(i),t||(this.maxZ=2*n)},t.prototype.createRigCamera=function(e,i){var n=0;switch(this.cameraRigMode){case y.V.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case y.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case y.V.RIG_MODE_STEREOSCOPIC_OVERUNDER:case y.V.RIG_MODE_STEREOSCOPIC_INTERLACED:case y.V.RIG_MODE_VR:n=this._cameraRigParams.stereoHalfAngle*(0===i?1:-1);break;case y.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:n=this._cameraRigParams.stereoHalfAngle*(0===i?-1:1)}var r=new t(e,this.alpha+n,this.beta,this.radius,this._target,this.getScene());return r._cameraRigParams={},r.isRigCamera=!0,r.rigParent=this,r.upVector=this.upVector,r},t.prototype._updateRigCameras=function(){var t=this._rigCameras[0],i=this._rigCameras[1];switch(t.beta=i.beta=this.beta,this.cameraRigMode){case y.V.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case y.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case y.V.RIG_MODE_STEREOSCOPIC_OVERUNDER:case y.V.RIG_MODE_STEREOSCOPIC_INTERLACED:case y.V.RIG_MODE_VR:t.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle,i.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle;break;case y.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:t.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle,i.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle}e.prototype._updateRigCameras.call(this)},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return"ArcRotateCamera"},(0,n.gn)([(0,r.qC)()],t.prototype,"alpha",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"beta",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"radius",void 0),(0,n.gn)([(0,r.hd)("target")],t.prototype,"_target",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"inertialAlphaOffset",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"inertialBetaOffset",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"inertialRadiusOffset",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"lowerAlphaLimit",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"upperAlphaLimit",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"lowerBetaLimit",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"upperBetaLimit",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"lowerRadiusLimit",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"upperRadiusLimit",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"inertialPanningX",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"inertialPanningY",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"pinchToPanMaxDistance",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"panningDistanceLimit",void 0),(0,n.gn)([(0,r.hd)()],t.prototype,"panningOriginTarget",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"panningInertia",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"zoomOnFactor",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"targetScreenOffset",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"allowUpsideDown",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"useInputToRestoreState",void 0),t}(b.C)},7659:(e,t,i)=>{"use strict";i.d(t,{V:()=>_});var n=i(655),r=i(9023),o=i(6936),s=i(5540),a=i(475),l=i(2973),h=i(2686),c=i(3734),u=i(6132),f=i(106),d=i(4272),p=i(131),_=function(e){function t(i,n,r,s){void 0===s&&(s=!0);var h=e.call(this,i,r)||this;return h._position=l.P.Zero(),h._upVector=l.P.Up(),h.orthoLeft=null,h.orthoRight=null,h.orthoBottom=null,h.orthoTop=null,h.fov=.8,h.minZ=1,h.maxZ=1e4,h.inertia=.9,h.mode=t.PERSPECTIVE_CAMERA,h.isIntermediate=!1,h.viewport=new d.l(0,0,1,1),h.layerMask=268435455,h.fovMode=t.FOVMODE_VERTICAL_FIXED,h.cameraRigMode=t.RIG_MODE_NONE,h.customRenderTargets=new Array,h.outputRenderTarget=null,h.onViewMatrixChangedObservable=new a.y$,h.onProjectionMatrixChangedObservable=new a.y$,h.onAfterCheckInputsObservable=new a.y$,h.onRestoreStateObservable=new a.y$,h.isRigCamera=!1,h._rigCameras=new Array,h._webvrViewMatrix=l.y3.Identity(),h._skipRendering=!1,h._projectionMatrix=new l.y3,h._postProcesses=new Array,h._activeMeshes=new o.t(256),h._globalPosition=l.P.Zero(),h._computedViewMatrix=l.y3.Identity(),h._doNotComputeProjectionMatrix=!1,h._transformMatrix=l.y3.Zero(),h._refreshFrustumPlanes=!0,h._isCamera=!0,h._isLeftCamera=!1,h._isRightCamera=!1,h.getScene().addCamera(h),s&&!h.getScene().activeCamera&&(h.getScene().activeCamera=h),h.position=n,h}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"upVector",{get:function(){return this._upVector},set:function(e){this._upVector=e},enumerable:!1,configurable:!0}),t.prototype.storeState=function(){return this._stateStored=!0,this._storedFov=this.fov,this},t.prototype._restoreStateValues=function(){return!!this._stateStored&&(this.fov=this._storedFov,!0)},t.prototype.restoreState=function(){return!!this._restoreStateValues()&&(this.onRestoreStateObservable.notifyObservers(this),!0)},t.prototype.getClassName=function(){return"Camera"},t.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+this.getClassName(),this.animations)for(var i=0;i-1?(c.Y.Error("You're trying to reuse a post process not defined as reusable."),0):(null==t||t<0?this._postProcesses.push(e):null===this._postProcesses[t]?this._postProcesses[t]=e:this._postProcesses.splice(t,0,e),this._cascadePostProcessesToRigCams(),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._postProcesses.indexOf(e))},t.prototype.detachPostProcess=function(e){var t=this._postProcesses.indexOf(e);-1!==t&&(this._postProcesses[t]=null),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._cascadePostProcessesToRigCams()},t.prototype.getWorldMatrix=function(){return this._isSynchronizedViewMatrix()||this.getViewMatrix(),this._worldMatrix},t.prototype._getViewMatrix=function(){return l.y3.Identity()},t.prototype.getViewMatrix=function(e){return!e&&this._isSynchronizedViewMatrix()||(this.updateCache(),this._computedViewMatrix=this._getViewMatrix(),this._currentRenderId=this.getScene().getRenderId(),this._childUpdateId++,this._refreshFrustumPlanes=!0,this._cameraRigParams&&this._cameraRigParams.vrPreViewMatrix&&this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix,this._computedViewMatrix),this.parent&&this.parent.onViewMatrixChangedObservable&&this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent),this.onViewMatrixChangedObservable.notifyObservers(this),this._computedViewMatrix.invertToRef(this._worldMatrix)),this._computedViewMatrix},t.prototype.freezeProjectionMatrix=function(e){this._doNotComputeProjectionMatrix=!0,void 0!==e&&(this._projectionMatrix=e)},t.prototype.unfreezeProjectionMatrix=function(){this._doNotComputeProjectionMatrix=!1},t.prototype.getProjectionMatrix=function(e){var i,n,r,o,s,a,h,c;if(this._doNotComputeProjectionMatrix||!e&&this._isSynchronizedProjectionMatrix())return this._projectionMatrix;this._cache.mode=this.mode,this._cache.minZ=this.minZ,this._cache.maxZ=this.maxZ,this._refreshFrustumPlanes=!0;var u=this.getEngine(),f=this.getScene();if(this.mode===t.PERSPECTIVE_CAMERA){this._cache.fov=this.fov,this._cache.fovMode=this.fovMode,this._cache.aspectRatio=u.getAspectRatio(this),this.minZ<=0&&(this.minZ=.1);var d=u.useReverseDepthBuffer;(f.useRightHandedSystem?d?l.y3.PerspectiveFovReverseRHToRef:l.y3.PerspectiveFovRHToRef:d?l.y3.PerspectiveFovReverseLHToRef:l.y3.PerspectiveFovLHToRef)(this.fov,u.getAspectRatio(this),this.minZ,this.maxZ,this._projectionMatrix,this.fovMode===t.FOVMODE_VERTICAL_FIXED)}else{var p=u.getRenderWidth()/2,_=u.getRenderHeight()/2;f.useRightHandedSystem?l.y3.OrthoOffCenterRHToRef(null!==(i=this.orthoLeft)&&void 0!==i?i:-p,null!==(n=this.orthoRight)&&void 0!==n?n:p,null!==(r=this.orthoBottom)&&void 0!==r?r:-_,null!==(o=this.orthoTop)&&void 0!==o?o:_,this.minZ,this.maxZ,this._projectionMatrix):l.y3.OrthoOffCenterLHToRef(null!==(s=this.orthoLeft)&&void 0!==s?s:-p,null!==(a=this.orthoRight)&&void 0!==a?a:p,null!==(h=this.orthoBottom)&&void 0!==h?h:-_,null!==(c=this.orthoTop)&&void 0!==c?c:_,this.minZ,this.maxZ,this._projectionMatrix),this._cache.orthoLeft=this.orthoLeft,this._cache.orthoRight=this.orthoRight,this._cache.orthoBottom=this.orthoBottom,this._cache.orthoTop=this.orthoTop,this._cache.renderWidth=u.getRenderWidth(),this._cache.renderHeight=u.getRenderHeight()}return this.onProjectionMatrixChangedObservable.notifyObservers(this),this._projectionMatrix},t.prototype.getTransformationMatrix=function(){return this._computedViewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._transformMatrix},t.prototype._updateFrustumPlanes=function(){this._refreshFrustumPlanes&&(this.getTransformationMatrix(),this._frustumPlanes?p.i.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=p.i.GetPlanes(this._transformMatrix),this._refreshFrustumPlanes=!1)},t.prototype.isInFrustum=function(e,t){if(void 0===t&&(t=!1),this._updateFrustumPlanes(),t&&this.rigCameras.length>0){var i=!1;return this.rigCameras.forEach((function(t){t._updateFrustumPlanes(),i=i||e.isInFrustum(t._frustumPlanes)})),i}return e.isInFrustum(this._frustumPlanes)},t.prototype.isCompletelyInFrustum=function(e){return this._updateFrustumPlanes(),e.isCompletelyInFrustum(this._frustumPlanes)},t.prototype.getForwardRay=function(e,t,i){throw void 0===e&&(e=100),f.f.WarnImport("Ray")},t.prototype.getForwardRayToRef=function(e,t,i,n){throw void 0===t&&(t=100),f.f.WarnImport("Ray")},t.prototype.dispose=function(i,n){for(void 0===n&&(n=!1),this.onViewMatrixChangedObservable.clear(),this.onProjectionMatrixChangedObservable.clear(),this.onAfterCheckInputsObservable.clear(),this.onRestoreStateObservable.clear(),this.inputs&&this.inputs.clear(),this.getScene().stopAnimation(this),this.getScene().removeCamera(this);this._rigCameras.length>0;){var r=this._rigCameras.pop();r&&r.dispose()}if(this._rigPostProcess)this._rigPostProcess.dispose(this),this._rigPostProcess=null,this._postProcesses=[];else if(this.cameraRigMode!==t.RIG_MODE_NONE)this._rigPostProcess=null,this._postProcesses=[];else for(var o=this._postProcesses.length;--o>=0;){var s=this._postProcesses[o];s&&s.dispose(this)}for(o=this.customRenderTargets.length;--o>=0;)this.customRenderTargets[o].dispose();this.customRenderTargets=[],this._activeMeshes.dispose(),e.prototype.dispose.call(this,i,n)},Object.defineProperty(t.prototype,"isLeftCamera",{get:function(){return this._isLeftCamera},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRightCamera",{get:function(){return this._isRightCamera},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftCamera",{get:function(){return this._rigCameras.length<1?null:this._rigCameras[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightCamera",{get:function(){return this._rigCameras.length<2?null:this._rigCameras[1]},enumerable:!1,configurable:!0}),t.prototype.getLeftTarget=function(){return this._rigCameras.length<1?null:this._rigCameras[0].getTarget()},t.prototype.getRightTarget=function(){return this._rigCameras.length<2?null:this._rigCameras[1].getTarget()},t.prototype.setCameraRigMode=function(e,i){if(this.cameraRigMode!==e){for(;this._rigCameras.length>0;){var n=this._rigCameras.pop();n&&n.dispose()}if(this.cameraRigMode=e,this._cameraRigParams={},this._cameraRigParams.interaxialDistance=i.interaxialDistance||.0637,this._cameraRigParams.stereoHalfAngle=s.w1.ToRadians(this._cameraRigParams.interaxialDistance/.0637),this.cameraRigMode!==t.RIG_MODE_NONE){var r=this.createRigCamera(this.name+"_L",0);r&&(r._isLeftCamera=!0);var o=this.createRigCamera(this.name+"_R",1);o&&(o._isRightCamera=!0),r&&o&&(this._rigCameras.push(r),this._rigCameras.push(o))}switch(this.cameraRigMode){case t.RIG_MODE_STEREOSCOPIC_ANAGLYPH:t._setStereoscopicAnaglyphRigMode(this);break;case t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:case t.RIG_MODE_STEREOSCOPIC_OVERUNDER:case t.RIG_MODE_STEREOSCOPIC_INTERLACED:t._setStereoscopicRigMode(this);break;case t.RIG_MODE_VR:t._setVRRigMode(this,i);break;case t.RIG_MODE_WEBVR:t._setWebVRRigMode(this,i)}this._cascadePostProcessesToRigCams(),this.update()}},t._setStereoscopicRigMode=function(e){throw"Import Cameras/RigModes/stereoscopicRigMode before using stereoscopic rig mode"},t._setStereoscopicAnaglyphRigMode=function(e){throw"Import Cameras/RigModes/stereoscopicAnaglyphRigMode before using stereoscopic anaglyph rig mode"},t._setVRRigMode=function(e,t){throw"Import Cameras/RigModes/vrRigMode before using VR rig mode"},t._setWebVRRigMode=function(e,t){throw"Import Cameras/RigModes/WebVRRigMode before using Web VR rig mode"},t.prototype._getVRProjectionMatrix=function(){return l.y3.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov,this._cameraRigParams.vrMetrics.aspectRatio,this.minZ,this.maxZ,this._cameraRigParams.vrWorkMatrix),this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix,this._projectionMatrix),this._projectionMatrix},t.prototype._updateCameraRotationMatrix=function(){},t.prototype._updateWebVRCameraRotationMatrix=function(){},t.prototype._getWebVRProjectionMatrix=function(){return l.y3.Identity()},t.prototype._getWebVRViewMatrix=function(){return l.y3.Identity()},t.prototype.setCameraRigParameter=function(e,t){this._cameraRigParams||(this._cameraRigParams={}),this._cameraRigParams[e]=t,"interaxialDistance"===e&&(this._cameraRigParams.stereoHalfAngle=s.w1.ToRadians(t/.0637))},t.prototype.createRigCamera=function(e,t){return null},t.prototype._updateRigCameras=function(){for(var e=0;e{"use strict";i.d(t,{u:()=>s,p:()=>a});var n=i(3734),r=i(9023),o=i(7659),s={},a=function(){function e(e){this.attachedToElement=!1,this.attached={},this.camera=e,this.checkInputs=function(){}}return e.prototype.add=function(e){var t=e.getSimpleName();this.attached[t]?n.Y.Warn("camera input of type "+t+" already exists on camera"):(this.attached[t]=e,e.camera=this.camera,e.checkInputs&&(this.checkInputs=this._addCheckInputs(e.checkInputs.bind(e))),this.attachedToElement&&e.attachControl())},e.prototype.remove=function(e){for(var t in this.attached){var i=this.attached[t];i===e&&(i.detachControl(),i.camera=null,delete this.attached[t],this.rebuildInputCheck())}},e.prototype.removeByType=function(e){for(var t in this.attached){var i=this.attached[t];i.getClassName()===e&&(i.detachControl(),i.camera=null,delete this.attached[t],this.rebuildInputCheck())}},e.prototype._addCheckInputs=function(e){var t=this.checkInputs;return function(){t(),e()}},e.prototype.attachInput=function(e){this.attachedToElement&&e.attachControl(this.noPreventDefault)},e.prototype.attachElement=function(e){if(void 0===e&&(e=!1),!this.attachedToElement)for(var t in e=!o.V.ForceAttachControlToAlwaysPreventDefault&&e,this.attachedToElement=!0,this.noPreventDefault=e,this.attached)this.attached[t].attachControl(e)},e.prototype.detachElement=function(e){for(var t in void 0===e&&(e=!1),this.attached)this.attached[t].detachControl(),e&&(this.attached[t].camera=null);this.attachedToElement=!1},e.prototype.rebuildInputCheck=function(){for(var e in this.checkInputs=function(){},this.attached){var t=this.attached[e];t.checkInputs&&(this.checkInputs=this._addCheckInputs(t.checkInputs.bind(t)))}},e.prototype.clear=function(){this.attachedToElement&&this.detachElement(!0),this.attached={},this.attachedToElement=!1,this.checkInputs=function(){}},e.prototype.serialize=function(e){var t={};for(var i in this.attached){var n=this.attached[i],o=r.p4.Serialize(n);t[n.getClassName()]=o}e.inputsmgr=t},e.prototype.parse=function(e){var t=e.inputsmgr;if(t)for(var i in this.clear(),t){if(a=s[i]){var n=t[i],o=r.p4.Parse((function(){return new a}),n,null);this.add(o)}}else for(var i in this.attached){var a;if(a=s[this.attached[i].getClassName()]){o=r.p4.Parse((function(){return new a}),e,null);this.remove(this.attached[i]),this.add(o)}}},e}()},6955:(e,t,i)=>{"use strict";i.d(t,{C:()=>h});var n=i(655),r=i(9023),o=i(7659),s=i(2973),a=i(2782),l=i(9068),h=function(e){function t(t,i,n,r){void 0===r&&(r=!0);var o=e.call(this,t,i,n,r)||this;return o._tmpUpVector=s.P.Zero(),o._tmpTargetVector=s.P.Zero(),o.cameraDirection=new s.P(0,0,0),o.cameraRotation=new s.FM(0,0),o.ignoreParentScaling=!1,o.updateUpVectorFromRotation=!1,o._tmpQuaternion=new s._f,o.rotation=new s.P(0,0,0),o.speed=2,o.noRotationConstraint=!1,o.invertRotation=!1,o.inverseRotationSpeed=.2,o.lockedTarget=null,o._currentTarget=s.P.Zero(),o._initialFocalDistance=1,o._viewMatrix=s.y3.Zero(),o._camMatrix=s.y3.Zero(),o._cameraTransformMatrix=s.y3.Zero(),o._cameraRotationMatrix=s.y3.Zero(),o._referencePoint=new s.P(0,0,1),o._transformedReferencePoint=s.P.Zero(),o._defaultUp=s.P.Up(),o._cachedRotationZ=0,o._cachedQuaternionRotationZ=0,o}return(0,n.ZT)(t,e),t.prototype.getFrontPosition=function(e){this.getWorldMatrix();var t=this.getTarget().subtract(this.position);return t.normalize(),t.scaleInPlace(e),this.globalPosition.add(t)},t.prototype._getLockedTargetPosition=function(){return this.lockedTarget?(this.lockedTarget.absolutePosition&&this.lockedTarget.computeWorldMatrix(),this.lockedTarget.absolutePosition||this.lockedTarget):null},t.prototype.storeState=function(){return this._storedPosition=this.position.clone(),this._storedRotation=this.rotation.clone(),this.rotationQuaternion&&(this._storedRotationQuaternion=this.rotationQuaternion.clone()),e.prototype.storeState.call(this)},t.prototype._restoreStateValues=function(){return!!e.prototype._restoreStateValues.call(this)&&(this.position=this._storedPosition.clone(),this.rotation=this._storedRotation.clone(),this.rotationQuaternion&&(this.rotationQuaternion=this._storedRotationQuaternion.clone()),this.cameraDirection.copyFromFloats(0,0,0),this.cameraRotation.copyFromFloats(0,0),!0)},t.prototype._initCache=function(){e.prototype._initCache.call(this),this._cache.lockedTarget=new s.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotation=new s.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotationQuaternion=new s._f(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)},t.prototype._updateCache=function(t){t||e.prototype._updateCache.call(this);var i=this._getLockedTargetPosition();i?this._cache.lockedTarget?this._cache.lockedTarget.copyFrom(i):this._cache.lockedTarget=i.clone():this._cache.lockedTarget=null,this._cache.rotation.copyFrom(this.rotation),this.rotationQuaternion&&this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion)},t.prototype._isSynchronizedViewMatrix=function(){if(!e.prototype._isSynchronizedViewMatrix.call(this))return!1;var t=this._getLockedTargetPosition();return(this._cache.lockedTarget?this._cache.lockedTarget.equals(t):!t)&&(this.rotationQuaternion?this.rotationQuaternion.equals(this._cache.rotationQuaternion):this._cache.rotation.equals(this.rotation))},t.prototype._computeLocalCameraSpeed=function(){var e=this.getEngine();return this.speed*Math.sqrt(e.getDeltaTime()/(100*e.getFps()))},t.prototype.setTarget=function(e){this.upVector.normalize(),this._initialFocalDistance=e.subtract(this.position).length(),this.position.z===e.z&&(this.position.z+=a.kn),this._referencePoint.normalize().scaleInPlace(this._initialFocalDistance),s.y3.LookAtLHToRef(this.position,e,this._defaultUp,this._camMatrix),this._camMatrix.invert(),this.rotation.x=Math.atan(this._camMatrix.m[6]/this._camMatrix.m[10]);var t=e.subtract(this.position);t.x>=0?this.rotation.y=-Math.atan(t.z/t.x)+Math.PI/2:this.rotation.y=-Math.atan(t.z/t.x)-Math.PI/2,this.rotation.z=0,isNaN(this.rotation.x)&&(this.rotation.x=0),isNaN(this.rotation.y)&&(this.rotation.y=0),isNaN(this.rotation.z)&&(this.rotation.z=0),this.rotationQuaternion&&s._f.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)},Object.defineProperty(t.prototype,"target",{get:function(){return this.getTarget()},set:function(e){this.setTarget(e)},enumerable:!1,configurable:!0}),t.prototype.getTarget=function(){return this._currentTarget},t.prototype._decideIfNeedsToMove=function(){return Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){if(this.parent)return this.parent.getWorldMatrix().invertToRef(s.jp.Matrix[0]),s.P.TransformNormalToRef(this.cameraDirection,s.jp.Matrix[0],s.jp.Vector3[0]),void this.position.addInPlace(s.jp.Vector3[0]);this.position.addInPlace(this.cameraDirection)},t.prototype._checkInputs=function(){var t=this.invertRotation?-this.inverseRotationSpeed:1,i=this._decideIfNeedsToMove(),n=Math.abs(this.cameraRotation.x)>0||Math.abs(this.cameraRotation.y)>0;if(i&&this._updatePosition(),n){if(this.rotationQuaternion&&this.rotationQuaternion.toEulerAnglesToRef(this.rotation),this.rotation.x+=this.cameraRotation.x*t,this.rotation.y+=this.cameraRotation.y*t,!this.noRotationConstraint){var r=1.570796;this.rotation.x>r&&(this.rotation.x=r),this.rotation.x<-r&&(this.rotation.x=-r)}if(this.rotationQuaternion)this.rotation.lengthSquared()&&s._f.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)}i&&(Math.abs(this.cameraDirection.x){"use strict";i.d(t,{c:()=>n});var n=function(e,t,i){this.bu=e,this.bv=t,this.distance=i,this.faceId=0,this.subMeshId=0}},9626:(e,t,i)=>{"use strict";i.d(t,{p:()=>o});var n=i(2973),r=i(6738),o=function(){function e(){this._pickingUnavailable=!1,this.hit=!1,this.distance=0,this.pickedPoint=null,this.pickedMesh=null,this.bu=0,this.bv=0,this.faceId=-1,this.subMeshFaceId=-1,this.subMeshId=0,this.pickedSprite=null,this.thinInstanceIndex=-1,this.originMesh=null,this.ray=null}return e.prototype.getNormal=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!0),!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(r.o.NormalKind))return null;var i,o=this.pickedMesh.getIndices();if(!o)return null;if(t){var s=this.pickedMesh.getVerticesData(r.o.NormalKind),a=n.P.FromArray(s,3*o[3*this.faceId]),l=n.P.FromArray(s,3*o[3*this.faceId+1]),h=n.P.FromArray(s,3*o[3*this.faceId+2]);a=a.scale(this.bu),l=l.scale(this.bv),h=h.scale(1-this.bu-this.bv),i=new n.P(a.x+l.x+h.x,a.y+l.y+h.y,a.z+l.z+h.z)}else{var c=this.pickedMesh.getVerticesData(r.o.PositionKind),u=n.P.FromArray(c,3*o[3*this.faceId]),f=n.P.FromArray(c,3*o[3*this.faceId+1]),d=n.P.FromArray(c,3*o[3*this.faceId+2]),p=u.subtract(f),_=d.subtract(f);i=n.P.Cross(p,_)}if(e){var g=this.pickedMesh.getWorldMatrix();this.pickedMesh.nonUniformScaling&&(n.jp.Matrix[0].copyFrom(g),(g=n.jp.Matrix[0]).setTranslationFromFloats(0,0,0),g.invert(),g.transposeToRef(n.jp.Matrix[1]),g=n.jp.Matrix[1]),i=n.P.TransformNormal(i,g)}return i.normalize(),i},e.prototype.getTextureCoordinates=function(){if(!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(r.o.UVKind))return null;var e=this.pickedMesh.getIndices();if(!e)return null;var t=this.pickedMesh.getVerticesData(r.o.UVKind);if(!t)return null;var i=n.FM.FromArray(t,2*e[3*this.faceId]),o=n.FM.FromArray(t,2*e[3*this.faceId+1]),s=n.FM.FromArray(t,2*e[3*this.faceId+2]);return i=i.scale(this.bu),o=o.scale(this.bv),s=s.scale(1-this.bu-this.bv),new n.FM(i.x+o.x+s.x,i.y+o.y+s.y)},e}()},2520:(e,t,i)=>{"use strict";i.d(t,{j:()=>f});var n=i(8035),r=i(2973),o=i(2782),s=function(){function e(e,t,i){this.vectors=n.B.BuildArray(8,r.P.Zero),this.center=r.P.Zero(),this.centerWorld=r.P.Zero(),this.extendSize=r.P.Zero(),this.extendSizeWorld=r.P.Zero(),this.directions=n.B.BuildArray(3,r.P.Zero),this.vectorsWorld=n.B.BuildArray(8,r.P.Zero),this.minimumWorld=r.P.Zero(),this.maximumWorld=r.P.Zero(),this.minimum=r.P.Zero(),this.maximum=r.P.Zero(),this.reConstruct(e,t,i)}return e.prototype.reConstruct=function(e,t,i){var n=e.x,o=e.y,s=e.z,a=t.x,l=t.y,h=t.z,c=this.vectors;this.minimum.copyFromFloats(n,o,s),this.maximum.copyFromFloats(a,l,h),c[0].copyFromFloats(n,o,s),c[1].copyFromFloats(a,l,h),c[2].copyFromFloats(a,o,s),c[3].copyFromFloats(n,l,s),c[4].copyFromFloats(n,o,h),c[5].copyFromFloats(a,l,s),c[6].copyFromFloats(n,l,h),c[7].copyFromFloats(a,o,h),t.addToRef(e,this.center).scaleInPlace(.5),t.subtractToRef(e,this.extendSize).scaleInPlace(.5),this._worldMatrix=i||r.y3.IdentityReadOnly,this._update(this._worldMatrix)},e.prototype.scale=function(t){var i=e.TmpVector3,n=this.maximum.subtractToRef(this.minimum,i[0]),r=n.length();n.normalizeFromLength(r);var o=r*t,s=n.scaleInPlace(.5*o),a=this.center.subtractToRef(s,i[1]),l=this.center.addToRef(s,i[2]);return this.reConstruct(a,l,this._worldMatrix),this},e.prototype.getWorldMatrix=function(){return this._worldMatrix},e.prototype._update=function(e){var t=this.minimumWorld,i=this.maximumWorld,n=this.directions,o=this.vectorsWorld,s=this.vectors;if(e.isIdentity()){t.copyFrom(this.minimum),i.copyFrom(this.maximum);for(a=0;a<8;++a)o[a].copyFrom(s[a]);this.extendSizeWorld.copyFrom(this.extendSize),this.centerWorld.copyFrom(this.center)}else{t.setAll(Number.MAX_VALUE),i.setAll(-Number.MAX_VALUE);for(var a=0;a<8;++a){var l=o[a];r.P.TransformCoordinatesToRef(s[a],e,l),t.minimizeInPlace(l),i.maximizeInPlace(l)}i.subtractToRef(t,this.extendSizeWorld).scaleInPlace(.5),i.addToRef(t,this.centerWorld).scaleInPlace(.5)}r.P.FromArrayToRef(e.m,0,n[0]),r.P.FromArrayToRef(e.m,4,n[1]),r.P.FromArrayToRef(e.m,8,n[2]),this._worldMatrix=e},e.prototype.isInFrustum=function(t){return e.IsInFrustum(this.vectorsWorld,t)},e.prototype.isCompletelyInFrustum=function(t){return e.IsCompletelyInFrustum(this.vectorsWorld,t)},e.prototype.intersectsPoint=function(e){var t=this.minimumWorld,i=this.maximumWorld,n=t.x,r=t.y,s=t.z,a=i.x,l=i.y,h=i.z,c=e.x,u=e.y,f=e.z,d=-o.kn;return!(a-cc-n)&&(!(l-uu-r)&&!(h-ff-s))},e.prototype.intersectsSphere=function(t){return e.IntersectsSphere(this.minimumWorld,this.maximumWorld,t.centerWorld,t.radiusWorld)},e.prototype.intersectsMinMax=function(e,t){var i=this.minimumWorld,n=this.maximumWorld,r=i.x,o=i.y,s=i.z,a=n.x,l=n.y,h=n.z,c=e.x,u=e.y,f=e.z,d=t.x,p=t.y,_=t.z;return!(ad)&&(!(lp)&&!(h_))},e.Intersects=function(e,t){return e.intersectsMinMax(t.minimumWorld,t.maximumWorld)},e.IntersectsSphere=function(t,i,n,o){var s=e.TmpVector3[0];return r.P.ClampToRef(n,t,i,s),r.P.DistanceSquared(n,s)<=o*o},e.IsCompletelyInFrustum=function(e,t){for(var i=0;i<6;++i)for(var n=t[i],r=0;r<8;++r)if(n.dotCoordinate(e[r])<0)return!1;return!0},e.IsInFrustum=function(e,t){for(var i=0;i<6;++i){for(var n=!0,r=t[i],o=0;o<8;++o)if(r.dotCoordinate(e[o])>=0){n=!1;break}if(n)return!1}return!0},e.TmpVector3=n.B.BuildArray(3,r.P.Zero),e}(),a=function(){function e(e,t,i){this.center=r.P.Zero(),this.centerWorld=r.P.Zero(),this.minimum=r.P.Zero(),this.maximum=r.P.Zero(),this.reConstruct(e,t,i)}return e.prototype.reConstruct=function(e,t,i){this.minimum.copyFrom(e),this.maximum.copyFrom(t);var n=r.P.Distance(e,t);t.addToRef(e,this.center).scaleInPlace(.5),this.radius=.5*n,this._update(i||r.y3.IdentityReadOnly)},e.prototype.scale=function(t){var i=this.radius*t,n=e.TmpVector3,r=n[0].setAll(i),o=this.center.subtractToRef(r,n[1]),s=this.center.addToRef(r,n[2]);return this.reConstruct(o,s,this._worldMatrix),this},e.prototype.getWorldMatrix=function(){return this._worldMatrix},e.prototype._update=function(t){if(t.isIdentity())this.centerWorld.copyFrom(this.center),this.radiusWorld=this.radius;else{r.P.TransformCoordinatesToRef(this.center,t,this.centerWorld);var i=e.TmpVector3[0];r.P.TransformNormalFromFloatsToRef(1,1,1,t,i),this.radiusWorld=Math.max(Math.abs(i.x),Math.abs(i.y),Math.abs(i.z))*this.radius}},e.prototype.isInFrustum=function(e){for(var t=this.centerWorld,i=this.radiusWorld,n=0;n<6;n++)if(e[n].dotCoordinate(t)<=-i)return!1;return!0},e.prototype.isCenterInFrustum=function(e){for(var t=this.centerWorld,i=0;i<6;i++)if(e[i].dotCoordinate(t)<0)return!1;return!0},e.prototype.intersectsPoint=function(e){var t=r.P.DistanceSquared(this.centerWorld,e);return!(this.radiusWorld*this.radiusWorldh.max||h.min>l.max)},f=function(){function e(e,t,i){this._isLocked=!1,this.boundingBox=new s(e,t,i),this.boundingSphere=new a(e,t,i)}return e.prototype.reConstruct=function(e,t,i){this.boundingBox.reConstruct(e,t,i),this.boundingSphere.reConstruct(e,t,i)},Object.defineProperty(e.prototype,"minimum",{get:function(){return this.boundingBox.minimum},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maximum",{get:function(){return this.boundingBox.maximum},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLocked",{get:function(){return this._isLocked},set:function(e){this._isLocked=e},enumerable:!1,configurable:!0}),e.prototype.update=function(e){this._isLocked||(this.boundingBox._update(e),this.boundingSphere._update(e))},e.prototype.centerOn=function(t,i){var n=e.TmpVector3[0].copyFrom(t).subtractInPlace(i),r=e.TmpVector3[1].copyFrom(t).addInPlace(i);return this.boundingBox.reConstruct(n,r,this.boundingBox.getWorldMatrix()),this.boundingSphere.reConstruct(n,r,this.boundingBox.getWorldMatrix()),this},e.prototype.scale=function(e){return this.boundingBox.scale(e),this.boundingSphere.scale(e),this},e.prototype.isInFrustum=function(e,t){return void 0===t&&(t=0),!(2!==t&&3!==t||!this.boundingSphere.isCenterInFrustum(e))||!!this.boundingSphere.isInFrustum(e)&&(!(1!==t&&3!==t)||this.boundingBox.isInFrustum(e))},Object.defineProperty(e.prototype,"diagonalLength",{get:function(){var t=this.boundingBox;return t.maximumWorld.subtractToRef(t.minimumWorld,e.TmpVector3[0]).length()},enumerable:!1,configurable:!0}),e.prototype.isCompletelyInFrustum=function(e){return this.boundingBox.isCompletelyInFrustum(e)},e.prototype._checkCollision=function(e){return e._canDoCollision(this.boundingSphere.centerWorld,this.boundingSphere.radiusWorld,this.boundingBox.minimumWorld,this.boundingBox.maximumWorld)},e.prototype.intersectsPoint=function(e){return!!this.boundingSphere.centerWorld&&(!!this.boundingSphere.intersectsPoint(e)&&!!this.boundingBox.intersectsPoint(e))},e.prototype.intersects=function(e,t){if(!a.Intersects(this.boundingSphere,e.boundingSphere))return!1;if(!s.Intersects(this.boundingBox,e.boundingBox))return!1;if(!t)return!0;var i=this.boundingBox,n=e.boundingBox;return!!u(i.directions[0],i,n)&&(!!u(i.directions[1],i,n)&&(!!u(i.directions[2],i,n)&&(!!u(n.directions[0],i,n)&&(!!u(n.directions[1],i,n)&&(!!u(n.directions[2],i,n)&&(!!u(r.P.Cross(i.directions[0],n.directions[0]),i,n)&&(!!u(r.P.Cross(i.directions[0],n.directions[1]),i,n)&&(!!u(r.P.Cross(i.directions[0],n.directions[2]),i,n)&&(!!u(r.P.Cross(i.directions[1],n.directions[0]),i,n)&&(!!u(r.P.Cross(i.directions[1],n.directions[1]),i,n)&&(!!u(r.P.Cross(i.directions[1],n.directions[2]),i,n)&&(!!u(r.P.Cross(i.directions[2],n.directions[0]),i,n)&&(!!u(r.P.Cross(i.directions[2],n.directions[1]),i,n)&&!!u(r.P.Cross(i.directions[2],n.directions[2]),i,n))))))))))))))},e.TmpVector3=n.B.BuildArray(2,r.P.Zero),e}()},6135:(e,t,i)=>{"use strict";i(2131).B.prototype._readTexturePixels=function(e,t,i,n,r,o){void 0===n&&(n=-1),void 0===r&&(r=0),void 0===o&&(o=null);var s=this._gl;if(!s)throw new Error("Engine does not have gl rendering context.");if(!this._dummyFramebuffer){var a=s.createFramebuffer();if(!a)throw new Error("Unable to create dummy framebuffer");this._dummyFramebuffer=a}s.bindFramebuffer(s.FRAMEBUFFER,this._dummyFramebuffer),n>-1?s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+n,e._webGLTexture,r):s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,e._webGLTexture,r);var l=void 0!==e.type?this._getWebGLTextureType(e.type):s.UNSIGNED_BYTE;switch(l){case s.UNSIGNED_BYTE:o||(o=new Uint8Array(4*t*i)),l=s.UNSIGNED_BYTE;break;default:o||(o=new Float32Array(4*t*i)),l=s.FLOAT}return s.readPixels(0,0,t,i,s.RGBA,l,o),s.bindFramebuffer(s.FRAMEBUFFER,this._currentFramebuffer),o}},6593:(e,t,i)=>{"use strict";var n=i(655),r=i(7627),o=i(3734),s=i(7533),a=i(2131);a.B.prototype.createRenderTargetTexture=function(e,t){var i=new s.L;void 0!==t&&"object"==typeof t?(i.generateMipMaps=t.generateMipMaps,i.generateDepthBuffer=!!t.generateDepthBuffer,i.generateStencilBuffer=!!t.generateStencilBuffer,i.type=void 0===t.type?0:t.type,i.samplingMode=void 0===t.samplingMode?3:t.samplingMode,i.format=void 0===t.format?5:t.format):(i.generateMipMaps=t,i.generateDepthBuffer=!0,i.generateStencilBuffer=!1,i.type=0,i.samplingMode=3,i.format=5),(1!==i.type||this._caps.textureFloatLinearFiltering)&&(2!==i.type||this._caps.textureHalfFloatLinearFiltering)||(i.samplingMode=1),1!==i.type||this._caps.textureFloat||(i.type=0,o.Y.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type"));var n=this._gl,a=new r.l(this,r.S.RenderTarget),l=e.width||e,h=e.height||e,c=e.layers||0,u=this._getSamplingParameters(i.samplingMode,!!i.generateMipMaps),f=0!==c?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D,d=this._getRGBABufferInternalSizedFormat(i.type,i.format),p=this._getInternalFormat(i.format),_=this._getWebGLTextureType(i.type);this._bindTextureDirectly(f,a),0!==c?(a.is2DArray=!0,n.texImage3D(f,0,d,l,h,c,0,p,_,null)):n.texImage2D(f,0,d,l,h,0,p,_,null),n.texParameteri(f,n.TEXTURE_MAG_FILTER,u.mag),n.texParameteri(f,n.TEXTURE_MIN_FILTER,u.min),n.texParameteri(f,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(f,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),i.generateMipMaps&&this._gl.generateMipmap(f),this._bindTextureDirectly(f,null);var g=this._currentFramebuffer,m=n.createFramebuffer();return this._bindUnboundFramebuffer(m),a._depthStencilBuffer=this._setupFramebufferDepthAttachments(!!i.generateStencilBuffer,i.generateDepthBuffer,l,h),a.is2DArray||n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,a._webGLTexture,0),this._bindUnboundFramebuffer(g),a._framebuffer=m,a.baseWidth=l,a.baseHeight=h,a.width=l,a.height=h,a.depth=c,a.isReady=!0,a.samples=1,a.generateMipMaps=!!i.generateMipMaps,a.samplingMode=i.samplingMode,a.type=i.type,a.format=i.format,a._generateDepthBuffer=i.generateDepthBuffer,a._generateStencilBuffer=!!i.generateStencilBuffer,this._internalTexturesCache.push(a),a},a.B.prototype.createDepthStencilTexture=function(e,t){if(t.isCube){var i=e.width||e;return this._createDepthStencilCubeTexture(i,t)}return this._createDepthStencilTexture(e,t)},a.B.prototype._createDepthStencilTexture=function(e,t){var i=this._gl,s=e.layers||0,a=0!==s?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D,l=new r.l(this,r.S.Depth);if(!this._caps.depthTextureExtension)return o.Y.Error("Depth texture is not supported by your browser or hardware."),l;var h=(0,n.pi)({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t);this._bindTextureDirectly(a,l,!0),this._setupDepthStencilTexture(l,e,h.generateStencil,h.bilinearFiltering,h.comparisonFunction);var c=h.generateStencil?i.UNSIGNED_INT_24_8:i.UNSIGNED_INT,u=h.generateStencil?i.DEPTH_STENCIL:i.DEPTH_COMPONENT,f=u;return this.webGLVersion>1&&(f=h.generateStencil?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24),l.is2DArray?i.texImage3D(a,0,f,l.width,l.height,s,0,u,c,null):i.texImage2D(a,0,f,l.width,l.height,0,u,c,null),this._bindTextureDirectly(a,null),l}},1744:(e,t,i)=>{"use strict";var n=i(655),r=i(7627),o=i(3734);i(2131).B.prototype.createRenderTargetCubeTexture=function(e,t){var i=(0,n.pi)({generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:0,samplingMode:3,format:5},t);i.generateStencilBuffer=i.generateDepthBuffer&&i.generateStencilBuffer,(1!==i.type||this._caps.textureFloatLinearFiltering)&&(2!==i.type||this._caps.textureHalfFloatLinearFiltering)||(i.samplingMode=1);var s=this._gl,a=new r.l(this,r.S.RenderTarget);this._bindTextureDirectly(s.TEXTURE_CUBE_MAP,a,!0);var l=this._getSamplingParameters(i.samplingMode,i.generateMipMaps);1!==i.type||this._caps.textureFloat||(i.type=0,o.Y.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type")),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MAG_FILTER,l.mag),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MIN_FILTER,l.min),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);for(var h=0;h<6;h++)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,this._getRGBABufferInternalSizedFormat(i.type,i.format),e,e,0,this._getInternalFormat(i.format),this._getWebGLTextureType(i.type),null);var c=s.createFramebuffer();return this._bindUnboundFramebuffer(c),a._depthStencilBuffer=this._setupFramebufferDepthAttachments(i.generateStencilBuffer,i.generateDepthBuffer,e,e),i.generateMipMaps&&s.generateMipmap(s.TEXTURE_CUBE_MAP),this._bindTextureDirectly(s.TEXTURE_CUBE_MAP,null),this._bindUnboundFramebuffer(null),a._framebuffer=c,a.width=e,a.height=e,a.isReady=!0,a.isCube=!0,a.samples=1,a.generateMipMaps=i.generateMipMaps,a.samplingMode=i.samplingMode,a.type=i.type,a.format=i.format,a._generateDepthBuffer=i.generateDepthBuffer,a._generateStencilBuffer=i.generateStencilBuffer,this._internalTexturesCache.push(a),a}},3857:(e,t,i)=>{"use strict";i.d(t,{L:()=>m});var n=i(1373),r=function(){function e(){this.children=[]}return e.prototype.isValid=function(e){return!0},e.prototype.process=function(e,t){var i="";if(this.line){var r=this.line,o=t.processor;if(o){if(o.lineProcessor&&(r=o.lineProcessor(r,t.isFragment)),o.attributeProcessor&&n.M.StartsWith(this.line,"attribute"))r=o.attributeProcessor(this.line);else if(o.varyingProcessor&&n.M.StartsWith(this.line,"varying"))r=o.varyingProcessor(this.line,t.isFragment);else if((o.uniformProcessor||o.uniformBufferProcessor)&&n.M.StartsWith(this.line,"uniform")){/uniform (.+) (.+)/.test(this.line)?o.uniformProcessor&&(r=o.uniformProcessor(this.line,t.isFragment)):o.uniformBufferProcessor&&(r=o.uniformBufferProcessor(this.line,t.isFragment),t.lookForClosingBracketForUniformBuffer=!0)}o.endOfUniformBufferProcessor&&t.lookForClosingBracketForUniformBuffer&&-1!==this.line.indexOf("}")&&(t.lookForClosingBracketForUniformBuffer=!1,r=o.endOfUniformBufferProcessor(this.line,t.isFragment))}i+=r+"\r\n"}return this.children.forEach((function(n){i+=n.process(e,t)})),this.additionalDefineKey&&(e[this.additionalDefineKey]=this.additionalDefineValue||"true"),i},e}(),o=function(){function e(){}return Object.defineProperty(e.prototype,"currentLine",{get:function(){return this._lines[this.lineIndex]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"canRead",{get:function(){return this.lineIndex1){for(r();-1!==n&&e._OperatorPriority[s()]>=e._OperatorPriority[u];)i.push(a());o(u),l++}else h+=c;l++}for(r();-1!==n;)"("===s()?a():i.push(a());return i},e._OperatorPriority={")":0,"(":1,"||":2,"&&":3},e._Stack=["","","","","","","","","","","","","","","","","","","",""],e}(),c=function(e){function t(t,i){void 0===i&&(i=!1);var n=e.call(this)||this;return n.define=t,n.not=i,n}return(0,s.ZT)(t,e),t.prototype.isTrue=function(e){var t=void 0!==e[this.define];return this.not&&(t=!t),t},t}(h),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,s.ZT)(t,e),t.prototype.isTrue=function(e){return this.leftOperand.isTrue(e)||this.rightOperand.isTrue(e)},t}(h),f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,s.ZT)(t,e),t.prototype.isTrue=function(e){return this.leftOperand.isTrue(e)&&this.rightOperand.isTrue(e)},t}(h),d=function(e){function t(t,i,n){var r=e.call(this)||this;return r.define=t,r.operand=i,r.testValue=n,r}return(0,s.ZT)(t,e),t.prototype.isTrue=function(e){var t=e[this.define];void 0===t&&(t=this.define);var i=!1,n=parseInt(t),r=parseInt(this.testValue);switch(this.operand){case">":i=n>r;break;case"<":i=n=":i=n>=r;break;case"==":i=n===r}return i},t}(h),p=i(106),_=/defined\s*?\((.+?)\)/g,g=/defined\s*?\[(.+?)\]/g,m=function(){function e(){}return e.Process=function(e,t,i,n){var r=this;this._ProcessIncludes(e,t,(function(e){var o=r._ProcessShaderConversion(e,t,n);i(o)}))},e._ProcessPrecision=function(e,t){var i=t.shouldUseHighPrecisionShader;return-1===e.indexOf("precision highp float")?e=i?"precision highp float;\n"+e:"precision mediump float;\n"+e:i||(e=e.replace("precision highp float","precision mediump float")),e},e._ExtractOperation=function(e){var t=/defined\((.+)\)/.exec(e);if(t&&t.length)return new c(t[1].trim(),"!"===e[0]);for(var i="",n=0,r=0,o=["==",">=","<=","<",">"];r-1));r++);if(-1===n)return new c(e);var s=e.substring(0,n).trim(),a=e.substring(n+i.length).trim();return new d(s,i,a)},e._BuildSubExpression=function(e){e=e.replace(_,"defined[$1]");for(var t=[],i=0,n=h.infixToPostfix(e);i=2){var o=t[t.length-1],s=t[t.length-2];t.length-=2;var a="&&"==r?new f:new u;"string"==typeof o&&(o=o.replace(g,"defined($1)")),"string"==typeof s&&(s=s.replace(g,"defined($1)")),a.leftOperand="string"==typeof s?this._ExtractOperation(s):s,a.rightOperand="string"==typeof o?this._ExtractOperation(o):o,t.push(a)}}var l=t[t.length-1];return"string"==typeof l&&(l=l.replace(g,"defined($1)")),"string"==typeof l?this._ExtractOperation(l):l},e._BuildExpression=function(e,t){var i=new l,n=e.substring(0,t),r=e.substring(t);return r=r.substring(0,(r.indexOf("//")+1||r.length+1)-1).trim(),i.testExpression="#ifdef"===n?new c(r):"#ifndef"===n?new c(r,!0):this._BuildSubExpression(r),i},e._MoveCursorWithinIf=function(e,t,i){for(var n=e.currentLine;this._MoveCursor(e,i);){var o=(n=e.currentLine).substring(0,5).toLowerCase();if("#else"===o){var s=new r;return t.children.push(s),void this._MoveCursor(e,s)}if("#elif"===o){var a=this._BuildExpression(n,5);t.children.push(a),i=a}}},e._MoveCursor=function(e,t){for(;e.canRead;){e.lineIndex++;var i=e.currentLine,n=/(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/.exec(i);if(n&&n.length){switch(n[0]){case"#ifdef":var o=new a;t.children.push(o);var s=this._BuildExpression(i,6);o.children.push(s),this._MoveCursorWithinIf(e,o,s);break;case"#else":case"#elif":return!0;case"#endif":return!1;case"#ifndef":o=new a;t.children.push(o);s=this._BuildExpression(i,7);o.children.push(s),this._MoveCursorWithinIf(e,o,s);break;case"#if":o=new a,s=this._BuildExpression(i,3);t.children.push(o),o.children.push(s),this._MoveCursorWithinIf(e,o,s)}}else{var l=new r;if(l.line=i,t.children.push(l),"#"===i[0]&&"d"===i[1]){var h=i.replace(";","").split(" ");l.additionalDefineKey=h[1],3===h.length&&(l.additionalDefineValue=h[2])}}}return!1},e._EvaluatePreProcessors=function(e,t,i){var n=new r,s=new o;return s.lineIndex=-1,s.lines=e.split("\n"),this._MoveCursor(s,n),n.process(t,i)},e._PreparePreProcessors=function(e){for(var t={},i=0,n=e.defines;i1?r[1]:""}return t.GL_ES="true",t.__VERSION__=e.version,t[e.platformName]="true",t},e._ProcessShaderConversion=function(e,t,i){var n=this._ProcessPrecision(e,t);if(!t.processor)return n;if(-1!==n.indexOf("#version 3"))return n.replace("#version 300 es","");var r=t.defines,o=this._PreparePreProcessors(t);return t.processor.preProcessor&&(n=t.processor.preProcessor(n,r,t.isFragment)),n=this._EvaluatePreProcessors(n,o,t),t.processor.postProcessor&&(n=t.processor.postProcessor(n,r,t.isFragment,i)),n},e._ProcessIncludes=function(t,i,n){for(var r=this,o=/#include<(.+)>(\((.*)\))*(\[(.*)\])*/g,s=o.exec(t),a=new String(t),l=!1;null!=s;){var h=s[1];if(-1!==h.indexOf("__decl__")&&(h=h.replace(/__decl__/,""),i.supportsUniformBuffers&&(h=(h=h.replace(/Vertex/,"Ubo")).replace(/Fragment/,"Ubo")),h+="Declaration"),!i.includesShadersStore[h]){var c=i.shadersRepository+"ShadersInclude/"+h+".fx";return void e._FileToolsLoadFile(c,(function(e){i.includesShadersStore[h]=e,r._ProcessIncludes(a,i,n)}))}var u=i.includesShadersStore[h];if(s[2])for(var f=s[3].split(","),d=0;d=0,s=o.exec(t)}l?this._ProcessIncludes(a.toString(),i,n):n(a)},e._FileToolsLoadFile=function(e,t,i,n,r,o){throw p.f.WarnImport("FileTools")},e}()},3393:(e,t,i)=>{"use strict";i.d(t,{g:()=>n});var n=function(){function e(){}return e.ALPHA_DISABLE=0,e.ALPHA_ADD=1,e.ALPHA_COMBINE=2,e.ALPHA_SUBTRACT=3,e.ALPHA_MULTIPLY=4,e.ALPHA_MAXIMIZED=5,e.ALPHA_ONEONE=6,e.ALPHA_PREMULTIPLIED=7,e.ALPHA_PREMULTIPLIED_PORTERDUFF=8,e.ALPHA_INTERPOLATE=9,e.ALPHA_SCREENMODE=10,e.ALPHA_ONEONE_ONEONE=11,e.ALPHA_ALPHATOCOLOR=12,e.ALPHA_REVERSEONEMINUS=13,e.ALPHA_SRC_DSTONEMINUSSRCALPHA=14,e.ALPHA_ONEONE_ONEZERO=15,e.ALPHA_EXCLUSION=16,e.ALPHA_EQUATION_ADD=0,e.ALPHA_EQUATION_SUBSTRACT=1,e.ALPHA_EQUATION_REVERSE_SUBTRACT=2,e.ALPHA_EQUATION_MAX=3,e.ALPHA_EQUATION_MIN=4,e.ALPHA_EQUATION_DARKEN=5,e.DELAYLOADSTATE_NONE=0,e.DELAYLOADSTATE_LOADED=1,e.DELAYLOADSTATE_LOADING=2,e.DELAYLOADSTATE_NOTLOADED=4,e.NEVER=512,e.ALWAYS=519,e.LESS=513,e.EQUAL=514,e.LEQUAL=515,e.GREATER=516,e.GEQUAL=518,e.NOTEQUAL=517,e.KEEP=7680,e.REPLACE=7681,e.INCR=7682,e.DECR=7683,e.INVERT=5386,e.INCR_WRAP=34055,e.DECR_WRAP=34056,e.TEXTURE_CLAMP_ADDRESSMODE=0,e.TEXTURE_WRAP_ADDRESSMODE=1,e.TEXTURE_MIRROR_ADDRESSMODE=2,e.TEXTUREFORMAT_ALPHA=0,e.TEXTUREFORMAT_LUMINANCE=1,e.TEXTUREFORMAT_LUMINANCE_ALPHA=2,e.TEXTUREFORMAT_RGB=4,e.TEXTUREFORMAT_RGBA=5,e.TEXTUREFORMAT_RED=6,e.TEXTUREFORMAT_R=6,e.TEXTUREFORMAT_RG=7,e.TEXTUREFORMAT_RED_INTEGER=8,e.TEXTUREFORMAT_R_INTEGER=8,e.TEXTUREFORMAT_RG_INTEGER=9,e.TEXTUREFORMAT_RGB_INTEGER=10,e.TEXTUREFORMAT_RGBA_INTEGER=11,e.TEXTURETYPE_UNSIGNED_BYTE=0,e.TEXTURETYPE_UNSIGNED_INT=0,e.TEXTURETYPE_FLOAT=1,e.TEXTURETYPE_HALF_FLOAT=2,e.TEXTURETYPE_BYTE=3,e.TEXTURETYPE_SHORT=4,e.TEXTURETYPE_UNSIGNED_SHORT=5,e.TEXTURETYPE_INT=6,e.TEXTURETYPE_UNSIGNED_INTEGER=7,e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=8,e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=9,e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=10,e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=11,e.TEXTURETYPE_UNSIGNED_INT_24_8=12,e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=13,e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=14,e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=15,e.TEXTURE_NEAREST_SAMPLINGMODE=1,e.TEXTURE_NEAREST_NEAREST=1,e.TEXTURE_BILINEAR_SAMPLINGMODE=2,e.TEXTURE_LINEAR_LINEAR=2,e.TEXTURE_TRILINEAR_SAMPLINGMODE=3,e.TEXTURE_LINEAR_LINEAR_MIPLINEAR=3,e.TEXTURE_NEAREST_NEAREST_MIPNEAREST=4,e.TEXTURE_NEAREST_LINEAR_MIPNEAREST=5,e.TEXTURE_NEAREST_LINEAR_MIPLINEAR=6,e.TEXTURE_NEAREST_LINEAR=7,e.TEXTURE_NEAREST_NEAREST_MIPLINEAR=8,e.TEXTURE_LINEAR_NEAREST_MIPNEAREST=9,e.TEXTURE_LINEAR_NEAREST_MIPLINEAR=10,e.TEXTURE_LINEAR_LINEAR_MIPNEAREST=11,e.TEXTURE_LINEAR_NEAREST=12,e.TEXTURE_EXPLICIT_MODE=0,e.TEXTURE_SPHERICAL_MODE=1,e.TEXTURE_PLANAR_MODE=2,e.TEXTURE_CUBIC_MODE=3,e.TEXTURE_PROJECTION_MODE=4,e.TEXTURE_SKYBOX_MODE=5,e.TEXTURE_INVCUBIC_MODE=6,e.TEXTURE_EQUIRECTANGULAR_MODE=7,e.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=8,e.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,e.TEXTURE_FILTERING_QUALITY_OFFLINE=4096,e.TEXTURE_FILTERING_QUALITY_HIGH=64,e.TEXTURE_FILTERING_QUALITY_MEDIUM=16,e.TEXTURE_FILTERING_QUALITY_LOW=8,e.SCALEMODE_FLOOR=1,e.SCALEMODE_NEAREST=2,e.SCALEMODE_CEILING=3,e.MATERIAL_TextureDirtyFlag=1,e.MATERIAL_LightDirtyFlag=2,e.MATERIAL_FresnelDirtyFlag=4,e.MATERIAL_AttributesDirtyFlag=8,e.MATERIAL_MiscDirtyFlag=16,e.MATERIAL_PrePassDirtyFlag=32,e.MATERIAL_AllDirtyFlag=63,e.MATERIAL_TriangleFillMode=0,e.MATERIAL_WireFrameFillMode=1,e.MATERIAL_PointFillMode=2,e.MATERIAL_PointListDrawMode=3,e.MATERIAL_LineListDrawMode=4,e.MATERIAL_LineLoopDrawMode=5,e.MATERIAL_LineStripDrawMode=6,e.MATERIAL_TriangleStripDrawMode=7,e.MATERIAL_TriangleFanDrawMode=8,e.MATERIAL_ClockWiseSideOrientation=0,e.MATERIAL_CounterClockWiseSideOrientation=1,e.ACTION_NothingTrigger=0,e.ACTION_OnPickTrigger=1,e.ACTION_OnLeftPickTrigger=2,e.ACTION_OnRightPickTrigger=3,e.ACTION_OnCenterPickTrigger=4,e.ACTION_OnPickDownTrigger=5,e.ACTION_OnDoublePickTrigger=6,e.ACTION_OnPickUpTrigger=7,e.ACTION_OnPickOutTrigger=16,e.ACTION_OnLongPressTrigger=8,e.ACTION_OnPointerOverTrigger=9,e.ACTION_OnPointerOutTrigger=10,e.ACTION_OnEveryFrameTrigger=11,e.ACTION_OnIntersectionEnterTrigger=12,e.ACTION_OnIntersectionExitTrigger=13,e.ACTION_OnKeyDownTrigger=14,e.ACTION_OnKeyUpTrigger=15,e.PARTICLES_BILLBOARDMODE_Y=2,e.PARTICLES_BILLBOARDMODE_ALL=7,e.PARTICLES_BILLBOARDMODE_STRETCHED=8,e.MESHES_CULLINGSTRATEGY_STANDARD=0,e.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY=1,e.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION=2,e.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY=3,e.SCENELOADER_NO_LOGGING=0,e.SCENELOADER_MINIMAL_LOGGING=1,e.SCENELOADER_SUMMARY_LOGGING=2,e.SCENELOADER_DETAILED_LOGGING=3,e.PREPASS_IRRADIANCE_TEXTURE_TYPE=0,e.PREPASS_POSITION_TEXTURE_TYPE=1,e.PREPASS_VELOCITY_TEXTURE_TYPE=2,e.PREPASS_REFLECTIVITY_TEXTURE_TYPE=3,e.PREPASS_COLOR_TEXTURE_TYPE=4,e.PREPASS_DEPTHNORMAL_TEXTURE_TYPE=5,e.PREPASS_ALBEDO_TEXTURE_TYPE=6,e}()},2905:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Engine:()=>_});var n=i(655),r=i(475),o=i(6327),s=i(2733),a=i(106),l=i(2131),h=i(5273),c=function(){function e(e){void 0===e&&(e=30),this._enabled=!0,this._rollingFrameTime=new u(e)}return e.prototype.sampleFrame=function(e){if(void 0===e&&(e=h.F.Now),this._enabled){if(null!=this._lastFrameTimeMs){var t=e-this._lastFrameTimeMs;this._rollingFrameTime.add(t)}this._lastFrameTimeMs=e}},Object.defineProperty(e.prototype,"averageFrameTime",{get:function(){return this._rollingFrameTime.average},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageFrameTimeVariance",{get:function(){return this._rollingFrameTime.variance},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"instantaneousFrameTime",{get:function(){return this._rollingFrameTime.history(0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageFPS",{get:function(){return 1e3/this._rollingFrameTime.average},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"instantaneousFPS",{get:function(){var e=this._rollingFrameTime.history(0);return 0===e?0:1e3/e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSaturated",{get:function(){return this._rollingFrameTime.isSaturated()},enumerable:!1,configurable:!0}),e.prototype.enable=function(){this._enabled=!0},e.prototype.disable=function(){this._enabled=!1,this._lastFrameTimeMs=null},Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this._lastFrameTimeMs=null,this._rollingFrameTime.reset()},e}(),u=function(){function e(e){this._samples=new Array(e),this.reset()}return e.prototype.add=function(e){var t;if(this.isSaturated()){var i=this._samples[this._pos];t=i-this.average,this.average-=t/(this._sampleCount-1),this._m2-=t*(i-this.average)}else this._sampleCount++;t=e-this.average,this.average+=t/this._sampleCount,this._m2+=t*(e-this.average),this.variance=this._m2/(this._sampleCount-1),this._samples[this._pos]=e,this._pos++,this._pos%=this._samples.length},e.prototype.history=function(e){if(e>=this._sampleCount||e>=this._samples.length)return 0;var t=this._wrapPosition(this._pos-1);return this._samples[this._wrapPosition(t-e)]},e.prototype.isSaturated=function(){return this._sampleCount>=this._samples.length},e.prototype.reset=function(){this.average=0,this.variance=0,this._sampleCount=0,this._pos=0,this._m2=0},e.prototype._wrapPosition=function(e){var t=this._samples.length;return(e%t+t)%t},e}(),f=i(1952),d=i(5146),p=i(3734);l.B.prototype.setAlphaConstants=function(e,t,i,n){this._alphaState.setAlphaBlendConstants(e,t,i,n)},l.B.prototype.setAlphaMode=function(e,t){if(void 0===t&&(t=!1),this._alphaMode!==e){switch(e){case 0:this._alphaState.alphaBlend=!1;break;case 7:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 8:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case 2:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 6:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 1:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 3:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 4:this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR,this._gl.ZERO,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 5:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 9:this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR,this._gl.ONE_MINUS_CONSTANT_COLOR,this._gl.CONSTANT_ALPHA,this._gl.ONE_MINUS_CONSTANT_ALPHA),this._alphaState.alphaBlend=!0;break;case 10:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case 11:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 12:this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA,this._gl.ONE,this._gl.ZERO,this._gl.ZERO),this._alphaState.alphaBlend=!0;break;case 13:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE_MINUS_DST_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case 14:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case 15:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ONE,this._gl.ZERO),this._alphaState.alphaBlend=!0;break;case 16:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0}t||(this.depthCullingState.depthMask=0===e),this._alphaMode=e}},l.B.prototype.getAlphaMode=function(){return this._alphaMode},l.B.prototype.setAlphaEquation=function(e){if(this._alphaEquation!==e){switch(e){case 0:this._alphaState.setAlphaEquationParameters(this._gl.FUNC_ADD,this._gl.FUNC_ADD);break;case 1:this._alphaState.setAlphaEquationParameters(this._gl.FUNC_SUBTRACT,this._gl.FUNC_SUBTRACT);break;case 2:this._alphaState.setAlphaEquationParameters(this._gl.FUNC_REVERSE_SUBTRACT,this._gl.FUNC_REVERSE_SUBTRACT);break;case 3:this._alphaState.setAlphaEquationParameters(this._gl.MAX,this._gl.MAX);break;case 4:this._alphaState.setAlphaEquationParameters(this._gl.MIN,this._gl.MIN);break;case 5:this._alphaState.setAlphaEquationParameters(this._gl.MIN,this._gl.FUNC_ADD)}this._alphaEquation=e}},l.B.prototype.getAlphaEquation=function(){return this._alphaEquation};i(6135);l.B.prototype.updateDynamicIndexBuffer=function(e,t,i){var n;void 0===i&&(i=0),this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER]=null,this.bindIndexBuffer(e),n=t instanceof Uint16Array||t instanceof Uint32Array?t:e.is32Bits?new Uint32Array(t):new Uint16Array(t),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,n,this._gl.DYNAMIC_DRAW),this._resetIndexBufferBinding()},l.B.prototype.updateDynamicVertexBuffer=function(e,t,i,n){this.bindArrayBuffer(e),void 0===i&&(i=0);var r=t.length||t.byteLength;void 0===n||n>=r&&0===i?t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,new Float32Array(t)):this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,t):t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,new Float32Array(t).subarray(i,i+n)):(t=t instanceof ArrayBuffer?new Uint8Array(t,i,n):new Uint8Array(t.buffer,t.byteOffset+i,n),this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t)),this._resetVertexBufferBinding()};var _=function(e){function t(i,n,s,a){void 0===a&&(a=!1);var l=e.call(this,i,n,s,a)||this;if(l.enableOfflineSupport=!1,l.disableManifestCheck=!1,l.scenes=new Array,l.onNewSceneAddedObservable=new r.y$,l.postProcesses=new Array,l.isPointerLock=!1,l.onResizeObservable=new r.y$,l.onCanvasBlurObservable=new r.y$,l.onCanvasFocusObservable=new r.y$,l.onCanvasPointerOutObservable=new r.y$,l.onBeginFrameObservable=new r.y$,l.customAnimationFrameRequester=null,l.onEndFrameObservable=new r.y$,l.onBeforeShaderCompilationObservable=new r.y$,l.onAfterShaderCompilationObservable=new r.y$,l._deterministicLockstep=!1,l._lockstepMaxSteps=4,l._timeStep=1/60,l._fps=60,l._deltaTime=0,l._drawCalls=new f.z,l.canvasTabIndex=1,l.disablePerformanceMonitorInBackground=!1,l._performanceMonitor=new c,t.Instances.push(l),!i)return l;if(s=l._creationOptions,i.getContext){var h=i;if(l._onCanvasFocus=function(){l.onCanvasFocusObservable.notifyObservers(l)},l._onCanvasBlur=function(){l.onCanvasBlurObservable.notifyObservers(l)},h.addEventListener("focus",l._onCanvasFocus),h.addEventListener("blur",l._onCanvasBlur),l._onBlur=function(){l.disablePerformanceMonitorInBackground&&l._performanceMonitor.disable(),l._windowIsBackground=!0},l._onFocus=function(){l.disablePerformanceMonitorInBackground&&l._performanceMonitor.enable(),l._windowIsBackground=!1},l._onCanvasPointerOut=function(e){l.onCanvasPointerOutObservable.notifyObservers(e)},h.addEventListener("pointerout",l._onCanvasPointerOut),o.M.IsWindowObjectExist()){var u=l.getHostWindow();u.addEventListener("blur",l._onBlur),u.addEventListener("focus",l._onFocus);var d=document;l._onFullscreenChange=function(){void 0!==d.fullscreen?l.isFullscreen=d.fullscreen:void 0!==d.mozFullScreen?l.isFullscreen=d.mozFullScreen:void 0!==d.webkitIsFullScreen?l.isFullscreen=d.webkitIsFullScreen:void 0!==d.msIsFullScreen&&(l.isFullscreen=d.msIsFullScreen),l.isFullscreen&&l._pointerLockRequested&&h&&t._RequestPointerlock(h)},document.addEventListener("fullscreenchange",l._onFullscreenChange,!1),document.addEventListener("mozfullscreenchange",l._onFullscreenChange,!1),document.addEventListener("webkitfullscreenchange",l._onFullscreenChange,!1),document.addEventListener("msfullscreenchange",l._onFullscreenChange,!1),l._onPointerLockChange=function(){l.isPointerLock=d.mozPointerLockElement===h||d.webkitPointerLockElement===h||d.msPointerLockElement===h||d.pointerLockElement===h},document.addEventListener("pointerlockchange",l._onPointerLockChange,!1),document.addEventListener("mspointerlockchange",l._onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",l._onPointerLockChange,!1),document.addEventListener("webkitpointerlockchange",l._onPointerLockChange,!1),!t.audioEngine&&s.audioEngine&&t.AudioEngineFactory&&(t.audioEngine=t.AudioEngineFactory(l.getRenderingCanvas()))}l._connectVREvents(),l.enableOfflineSupport=void 0!==t.OfflineProviderFactory,s.doNotHandleTouchAction||l._disableTouchAction(),l._deterministicLockstep=!!s.deterministicLockstep,l._lockstepMaxSteps=s.lockstepMaxSteps||0,l._timeStep=s.timeStep||1/60}return l._prepareVRComponent(),s.autoEnableWebVR&&l.initWebVR(),l}return(0,n.ZT)(t,e),Object.defineProperty(t,"NpmPackage",{get:function(){return l.B.NpmPackage},enumerable:!1,configurable:!0}),Object.defineProperty(t,"Version",{get:function(){return l.B.Version},enumerable:!1,configurable:!0}),Object.defineProperty(t,"Instances",{get:function(){return s.l.Instances},enumerable:!1,configurable:!0}),Object.defineProperty(t,"LastCreatedEngine",{get:function(){return s.l.LastCreatedEngine},enumerable:!1,configurable:!0}),Object.defineProperty(t,"LastCreatedScene",{get:function(){return s.l.LastCreatedScene},enumerable:!1,configurable:!0}),t.MarkAllMaterialsAsDirty=function(e,i){for(var n=0;n0?this.customAnimationFrameRequester?(this.customAnimationFrameRequester.requestID=this._queueNewFrame(this.customAnimationFrameRequester.renderFunction||this._boundRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this.isVRPresenting()?this._requestVRFrame():this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1},t.prototype._renderViews=function(){return!1},t.prototype.switchFullscreen=function(e){this.isFullscreen?this.exitFullscreen():this.enterFullscreen(e)},t.prototype.enterFullscreen=function(e){this.isFullscreen||(this._pointerLockRequested=e,this._renderingCanvas&&t._RequestFullscreen(this._renderingCanvas))},t.prototype.exitFullscreen=function(){this.isFullscreen&&t._ExitFullscreen()},t.prototype.enterPointerlock=function(){this._renderingCanvas&&t._RequestPointerlock(this._renderingCanvas)},t.prototype.exitPointerlock=function(){t._ExitPointerlock()},t.prototype.beginFrame=function(){this._measureFps(),this.onBeginFrameObservable.notifyObservers(this),e.prototype.beginFrame.call(this)},t.prototype.endFrame=function(){e.prototype.endFrame.call(this),this._submitVRFrame(),this.onEndFrameObservable.notifyObservers(this)},t.prototype.resize=function(){this.isVRPresenting()||e.prototype.resize.call(this)},t.prototype.setSize=function(t,i){if(!this._renderingCanvas)return!1;if(!e.prototype.setSize.call(this,t,i))return!1;if(this.scenes){for(var n=0;n1&&r){var s=this.createTransformFeedback();this.bindTransformFeedback(s),this.setTranformFeedbackVaryings(o,r),e.transformFeedback=s}return n.linkProgram(o),this.webGLVersion>1&&r&&this.bindTransformFeedback(null),e.context=n,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),o},t.prototype._releaseTexture=function(t){e.prototype._releaseTexture.call(this,t),this.scenes.forEach((function(e){e.postProcesses.forEach((function(e){e._outputTexture==t&&(e._outputTexture=null)})),e.cameras.forEach((function(e){e._postProcesses.forEach((function(e){e&&e._outputTexture==t&&(e._outputTexture=null)}))}))}))},t.prototype._rescaleTexture=function(e,i,n,r,o){var s=this;this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,this._gl.LINEAR),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,this._gl.LINEAR),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_S,this._gl.CLAMP_TO_EDGE),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_T,this._gl.CLAMP_TO_EDGE);var a=this.createRenderTargetTexture({width:i.width,height:i.height},{generateMipMaps:!1,type:0,samplingMode:2,generateDepthBuffer:!1,generateStencilBuffer:!1});!this._rescalePostProcess&&t._RescalePostProcessFactory&&(this._rescalePostProcess=t._RescalePostProcessFactory(this)),this._rescalePostProcess.getEffect().executeWhenCompiled((function(){s._rescalePostProcess.onApply=function(t){t._bindTexture("textureSampler",e)};var t=n;t||(t=s.scenes[s.scenes.length-1]),t.postProcessManager.directRender([s._rescalePostProcess],a,!0),s._bindTextureDirectly(s._gl.TEXTURE_2D,i,!0),s._gl.copyTexImage2D(s._gl.TEXTURE_2D,0,r,0,0,i.width,i.height,0),s.unBindFramebuffer(a),s._releaseTexture(a),o&&o()}))},t.prototype.getFps=function(){return this._fps},t.prototype.getDeltaTime=function(){return this._deltaTime},t.prototype._measureFps=function(){this._performanceMonitor.sampleFrame(),this._fps=this._performanceMonitor.averageFPS,this._deltaTime=this._performanceMonitor.instantaneousFrameTime||0},t.prototype._uploadImageToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var r=this._gl,o=this._getWebGLTextureType(e.type),s=this._getInternalFormat(e.format),a=this._getRGBABufferInternalSizedFormat(e.type,s),l=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(l,e,!0),this._unpackFlipY(e.invertY);var h=r.TEXTURE_2D;e.isCube&&(h=r.TEXTURE_CUBE_MAP_POSITIVE_X+i),r.texImage2D(h,n,a,s,o,t),this._bindTextureDirectly(l,null,!0)},t.prototype.updateRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e)return 1;if(e.samples===t)return t;var i=this._gl;if(t=Math.min(t,this.getCaps().maxMSAASamples),e._depthStencilBuffer&&(i.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(i.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),e._MSAARenderBuffer&&(i.deleteRenderbuffer(e._MSAARenderBuffer),e._MSAARenderBuffer=null),t>1&&i.renderbufferStorageMultisample){var n=i.createFramebuffer();if(!n)throw new Error("Unable to create multi sampled framebuffer");e._MSAAFramebuffer=n,this._bindUnboundFramebuffer(e._MSAAFramebuffer);var r=i.createRenderbuffer();if(!r)throw new Error("Unable to create multi sampled framebuffer");i.bindRenderbuffer(i.RENDERBUFFER,r),i.renderbufferStorageMultisample(i.RENDERBUFFER,t,this._getRGBAMultiSampleBufferFormat(e.type),e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,r),e._MSAARenderBuffer=r}else this._bindUnboundFramebuffer(e._framebuffer);return e.samples=t,e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.width,e.height,t),this._bindUnboundFramebuffer(null),t},t.prototype.updateTextureComparisonFunction=function(e,t){if(1!==this.webGLVersion){var i=this._gl;e.isCube?(this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,e,!0),0===t?(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,515),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):(this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),0===t?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,515),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),e._comparisonFunction=t}else p.Y.Error("WebGL 1 does not support texture comparison.")},t.prototype.createInstancesBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create instance buffer");var i=new d.M(t);return i.capacity=e,this.bindArrayBuffer(i),this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.DYNAMIC_DRAW),i},t.prototype.deleteInstancesBuffer=function(e){this._gl.deleteBuffer(e)},t.prototype._clientWaitAsync=function(e,t,i){void 0===t&&(t=0),void 0===i&&(i=10);var n=this._gl;return new Promise((function(r,o){var s=function(){var a=n.clientWaitSync(e,t,0);a!=n.WAIT_FAILED?a!=n.TIMEOUT_EXPIRED?r():setTimeout(s,i):o()};s()}))},t.prototype._readPixelsAsync=function(e,t,i,n,r,o,s){if(this._webGLVersion<2)throw new Error("_readPixelsAsync only work on WebGL2+");var a=this._gl,l=a.createBuffer();a.bindBuffer(a.PIXEL_PACK_BUFFER,l),a.bufferData(a.PIXEL_PACK_BUFFER,s.byteLength,a.STREAM_READ),a.readPixels(e,t,i,n,r,o,0),a.bindBuffer(a.PIXEL_PACK_BUFFER,null);var h=a.fenceSync(a.SYNC_GPU_COMMANDS_COMPLETE,0);return h?(a.flush(),this._clientWaitAsync(h,0,10).then((function(){return a.deleteSync(h),a.bindBuffer(a.PIXEL_PACK_BUFFER,l),a.getBufferSubData(a.PIXEL_PACK_BUFFER,0,s),a.bindBuffer(a.PIXEL_PACK_BUFFER,null),a.deleteBuffer(l),s}))):null},t.prototype.dispose=function(){for(this.hideLoadingUI(),this.onNewSceneAddedObservable.clear();this.postProcesses.length;)this.postProcesses[0].dispose();for(this._rescalePostProcess&&this._rescalePostProcess.dispose();this.scenes.length;)this.scenes[0].dispose();1===t.Instances.length&&t.audioEngine&&t.audioEngine.dispose(),this.disableVR(),o.M.IsWindowObjectExist()&&(window.removeEventListener("blur",this._onBlur),window.removeEventListener("focus",this._onFocus),this._renderingCanvas&&(this._renderingCanvas.removeEventListener("focus",this._onCanvasFocus),this._renderingCanvas.removeEventListener("blur",this._onCanvasBlur),this._renderingCanvas.removeEventListener("pointerout",this._onCanvasPointerOut)),o.M.IsDocumentAvailable()&&(document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("mozfullscreenchange",this._onFullscreenChange),document.removeEventListener("webkitfullscreenchange",this._onFullscreenChange),document.removeEventListener("msfullscreenchange",this._onFullscreenChange),document.removeEventListener("pointerlockchange",this._onPointerLockChange),document.removeEventListener("mspointerlockchange",this._onPointerLockChange),document.removeEventListener("mozpointerlockchange",this._onPointerLockChange),document.removeEventListener("webkitpointerlockchange",this._onPointerLockChange))),e.prototype.dispose.call(this);var i=t.Instances.indexOf(this);i>=0&&t.Instances.splice(i,1),this.onResizeObservable.clear(),this.onCanvasBlurObservable.clear(),this.onCanvasFocusObservable.clear(),this.onCanvasPointerOutObservable.clear(),this.onBeginFrameObservable.clear(),this.onEndFrameObservable.clear()},t.prototype._disableTouchAction=function(){this._renderingCanvas&&this._renderingCanvas.setAttribute&&(this._renderingCanvas.setAttribute("touch-action","none"),this._renderingCanvas.style.touchAction="none",this._renderingCanvas.style.msTouchAction="none")},t.prototype.displayLoadingUI=function(){if(o.M.IsWindowObjectExist()){var e=this.loadingScreen;e&&e.displayLoadingUI()}},t.prototype.hideLoadingUI=function(){if(o.M.IsWindowObjectExist()){var e=this._loadingScreen;e&&e.hideLoadingUI()}},Object.defineProperty(t.prototype,"loadingScreen",{get:function(){return!this._loadingScreen&&this._renderingCanvas&&(this._loadingScreen=t.DefaultLoadingScreenFactory(this._renderingCanvas)),this._loadingScreen},set:function(e){this._loadingScreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadingUIText",{set:function(e){this.loadingScreen.loadingUIText=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadingUIBackgroundColor",{set:function(e){this.loadingScreen.loadingUIBackgroundColor=e},enumerable:!1,configurable:!0}),t._RequestPointerlock=function(e){e.requestPointerLock=e.requestPointerLock||e.msRequestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock,e.requestPointerLock&&e.requestPointerLock()},t._ExitPointerlock=function(){var e=document;document.exitPointerLock=document.exitPointerLock||e.msExitPointerLock||e.mozExitPointerLock||e.webkitExitPointerLock,document.exitPointerLock&&document.exitPointerLock()},t._RequestFullscreen=function(e){var t=e.requestFullscreen||e.msRequestFullscreen||e.webkitRequestFullscreen||e.mozRequestFullScreen;t&&t.call(e)},t._ExitFullscreen=function(){var e=document;document.exitFullscreen?document.exitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.webkitCancelFullScreen?e.webkitCancelFullScreen():e.msCancelFullScreen&&e.msCancelFullScreen()},t.ALPHA_DISABLE=0,t.ALPHA_ADD=1,t.ALPHA_COMBINE=2,t.ALPHA_SUBTRACT=3,t.ALPHA_MULTIPLY=4,t.ALPHA_MAXIMIZED=5,t.ALPHA_ONEONE=6,t.ALPHA_PREMULTIPLIED=7,t.ALPHA_PREMULTIPLIED_PORTERDUFF=8,t.ALPHA_INTERPOLATE=9,t.ALPHA_SCREENMODE=10,t.DELAYLOADSTATE_NONE=0,t.DELAYLOADSTATE_LOADED=1,t.DELAYLOADSTATE_LOADING=2,t.DELAYLOADSTATE_NOTLOADED=4,t.NEVER=512,t.ALWAYS=519,t.LESS=513,t.EQUAL=514,t.LEQUAL=515,t.GREATER=516,t.GEQUAL=518,t.NOTEQUAL=517,t.KEEP=7680,t.REPLACE=7681,t.INCR=7682,t.DECR=7683,t.INVERT=5386,t.INCR_WRAP=34055,t.DECR_WRAP=34056,t.TEXTURE_CLAMP_ADDRESSMODE=0,t.TEXTURE_WRAP_ADDRESSMODE=1,t.TEXTURE_MIRROR_ADDRESSMODE=2,t.TEXTUREFORMAT_ALPHA=0,t.TEXTUREFORMAT_LUMINANCE=1,t.TEXTUREFORMAT_LUMINANCE_ALPHA=2,t.TEXTUREFORMAT_RGB=4,t.TEXTUREFORMAT_RGBA=5,t.TEXTUREFORMAT_RED=6,t.TEXTUREFORMAT_R=6,t.TEXTUREFORMAT_RG=7,t.TEXTUREFORMAT_RED_INTEGER=8,t.TEXTUREFORMAT_R_INTEGER=8,t.TEXTUREFORMAT_RG_INTEGER=9,t.TEXTUREFORMAT_RGB_INTEGER=10,t.TEXTUREFORMAT_RGBA_INTEGER=11,t.TEXTURETYPE_UNSIGNED_BYTE=0,t.TEXTURETYPE_UNSIGNED_INT=0,t.TEXTURETYPE_FLOAT=1,t.TEXTURETYPE_HALF_FLOAT=2,t.TEXTURETYPE_BYTE=3,t.TEXTURETYPE_SHORT=4,t.TEXTURETYPE_UNSIGNED_SHORT=5,t.TEXTURETYPE_INT=6,t.TEXTURETYPE_UNSIGNED_INTEGER=7,t.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=8,t.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=9,t.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=10,t.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=11,t.TEXTURETYPE_UNSIGNED_INT_24_8=12,t.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=13,t.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=14,t.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=15,t.TEXTURE_NEAREST_SAMPLINGMODE=1,t.TEXTURE_BILINEAR_SAMPLINGMODE=2,t.TEXTURE_TRILINEAR_SAMPLINGMODE=3,t.TEXTURE_NEAREST_NEAREST_MIPLINEAR=8,t.TEXTURE_LINEAR_LINEAR_MIPNEAREST=11,t.TEXTURE_LINEAR_LINEAR_MIPLINEAR=3,t.TEXTURE_NEAREST_NEAREST_MIPNEAREST=4,t.TEXTURE_NEAREST_LINEAR_MIPNEAREST=5,t.TEXTURE_NEAREST_LINEAR_MIPLINEAR=6,t.TEXTURE_NEAREST_LINEAR=7,t.TEXTURE_NEAREST_NEAREST=1,t.TEXTURE_LINEAR_NEAREST_MIPNEAREST=9,t.TEXTURE_LINEAR_NEAREST_MIPLINEAR=10,t.TEXTURE_LINEAR_LINEAR=2,t.TEXTURE_LINEAR_NEAREST=12,t.TEXTURE_EXPLICIT_MODE=0,t.TEXTURE_SPHERICAL_MODE=1,t.TEXTURE_PLANAR_MODE=2,t.TEXTURE_CUBIC_MODE=3,t.TEXTURE_PROJECTION_MODE=4,t.TEXTURE_SKYBOX_MODE=5,t.TEXTURE_INVCUBIC_MODE=6,t.TEXTURE_EQUIRECTANGULAR_MODE=7,t.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=8,t.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,t.SCALEMODE_FLOOR=1,t.SCALEMODE_NEAREST=2,t.SCALEMODE_CEILING=3,t._RescalePostProcessFactory=null,t}(l.B)},2733:(e,t,i)=>{"use strict";i.d(t,{l:()=>n});var n=function(){function e(){}return Object.defineProperty(e,"LastCreatedEngine",{get:function(){return 0===this.Instances.length?null:this.Instances[this.Instances.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LastCreatedScene",{get:function(){return this._LastCreatedScene},enumerable:!1,configurable:!0}),e.Instances=new Array,e._LastCreatedScene=null,e.UseFallbackTexture=!0,e.FallbackTexture="",e}()},8868:(e,t,i)=>{"use strict";i.d(t,{Z:()=>n});var n=function(){function e(){}return e.SetMatrixPrecision=function(t){if(e.MatrixTrackPrecisionChange=!1,t&&!e.MatrixUse64Bits&&e.MatrixTrackedMatrices)for(var i=0;i{"use strict";i.d(t,{B:()=>b});var n=i(2733),r=i(7947),o=i(106),s=i(475),a=function(){function e(){this._isDepthTestDirty=!1,this._isDepthMaskDirty=!1,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1,this.reset()}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isDepthFuncDirty||this._isDepthTestDirty||this._isDepthMaskDirty||this._isCullFaceDirty||this._isCullDirty||this._isZOffsetDirty||this._isFrontFaceDirty},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zOffset",{get:function(){return this._zOffset},set:function(e){this._zOffset!==e&&(this._zOffset=e,this._isZOffsetDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cullFace",{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,this._isCullFaceDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cull",{get:function(){return this._cull},set:function(e){this._cull!==e&&(this._cull=e,this._isCullDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthFunc",{get:function(){return this._depthFunc},set:function(e){this._depthFunc!==e&&(this._depthFunc=e,this._isDepthFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthMask",{get:function(){return this._depthMask},set:function(e){this._depthMask!==e&&(this._depthMask=e,this._isDepthMaskDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthTest",{get:function(){return this._depthTest},set:function(e){this._depthTest!==e&&(this._depthTest=e,this._isDepthTestDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontFace",{get:function(){return this._frontFace},set:function(e){this._frontFace!==e&&(this._frontFace=e,this._isFrontFaceDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this._depthMask=!0,this._depthTest=!0,this._depthFunc=null,this._cullFace=null,this._cull=null,this._zOffset=0,this._frontFace=null,this._isDepthTestDirty=!0,this._isDepthMaskDirty=!0,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1},e.prototype.apply=function(e){this.isDirty&&(this._isCullDirty&&(this.cull?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this._isCullDirty=!1),this._isCullFaceDirty&&(e.cullFace(this.cullFace),this._isCullFaceDirty=!1),this._isDepthMaskDirty&&(e.depthMask(this.depthMask),this._isDepthMaskDirty=!1),this._isDepthTestDirty&&(this.depthTest?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this._isDepthTestDirty=!1),this._isDepthFuncDirty&&(e.depthFunc(this.depthFunc),this._isDepthFuncDirty=!1),this._isZOffsetDirty&&(this.zOffset?(e.enable(e.POLYGON_OFFSET_FILL),e.polygonOffset(this.zOffset,0)):e.disable(e.POLYGON_OFFSET_FILL),this._isZOffsetDirty=!1),this._isFrontFaceDirty&&(e.frontFace(this.frontFace),this._isFrontFaceDirty=!1))},e}(),l=function(){function e(){this._isStencilTestDirty=!1,this._isStencilMaskDirty=!1,this._isStencilFuncDirty=!1,this._isStencilOpDirty=!1,this.reset()}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isStencilTestDirty||this._isStencilMaskDirty||this._isStencilFuncDirty||this._isStencilOpDirty},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilFunc",{get:function(){return this._stencilFunc},set:function(e){this._stencilFunc!==e&&(this._stencilFunc=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilFuncRef",{get:function(){return this._stencilFuncRef},set:function(e){this._stencilFuncRef!==e&&(this._stencilFuncRef=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilFuncMask",{get:function(){return this._stencilFuncMask},set:function(e){this._stencilFuncMask!==e&&(this._stencilFuncMask=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpStencilFail",{get:function(){return this._stencilOpStencilFail},set:function(e){this._stencilOpStencilFail!==e&&(this._stencilOpStencilFail=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpDepthFail",{get:function(){return this._stencilOpDepthFail},set:function(e){this._stencilOpDepthFail!==e&&(this._stencilOpDepthFail=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpStencilDepthPass",{get:function(){return this._stencilOpStencilDepthPass},set:function(e){this._stencilOpStencilDepthPass!==e&&(this._stencilOpStencilDepthPass=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilMask",{get:function(){return this._stencilMask},set:function(e){this._stencilMask!==e&&(this._stencilMask=e,this._isStencilMaskDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilTest",{get:function(){return this._stencilTest},set:function(e){this._stencilTest!==e&&(this._stencilTest=e,this._isStencilTestDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this._stencilTest=!1,this._stencilMask=255,this._stencilFunc=e.ALWAYS,this._stencilFuncRef=1,this._stencilFuncMask=255,this._stencilOpStencilFail=e.KEEP,this._stencilOpDepthFail=e.KEEP,this._stencilOpStencilDepthPass=e.REPLACE,this._isStencilTestDirty=!0,this._isStencilMaskDirty=!0,this._isStencilFuncDirty=!0,this._isStencilOpDirty=!0},e.prototype.apply=function(e){this.isDirty&&(this._isStencilTestDirty&&(this.stencilTest?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this._isStencilTestDirty=!1),this._isStencilMaskDirty&&(e.stencilMask(this.stencilMask),this._isStencilMaskDirty=!1),this._isStencilFuncDirty&&(e.stencilFunc(this.stencilFunc,this.stencilFuncRef,this.stencilFuncMask),this._isStencilFuncDirty=!1),this._isStencilOpDirty&&(e.stencilOp(this.stencilOpStencilFail,this.stencilOpDepthFail,this.stencilOpStencilDepthPass),this._isStencilOpDirty=!1))},e.ALWAYS=519,e.KEEP=7680,e.REPLACE=7681,e}(),h=function(){function e(){this._isAlphaBlendDirty=!1,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1,this._alphaBlend=!1,this._blendFunctionParameters=new Array(4),this._blendEquationParameters=new Array(2),this._blendConstants=new Array(4),this.reset()}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isAlphaBlendDirty||this._isBlendFunctionParametersDirty},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaBlend",{get:function(){return this._alphaBlend},set:function(e){this._alphaBlend!==e&&(this._alphaBlend=e,this._isAlphaBlendDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.setAlphaBlendConstants=function(e,t,i,n){this._blendConstants[0]===e&&this._blendConstants[1]===t&&this._blendConstants[2]===i&&this._blendConstants[3]===n||(this._blendConstants[0]=e,this._blendConstants[1]=t,this._blendConstants[2]=i,this._blendConstants[3]=n,this._isBlendConstantsDirty=!0)},e.prototype.setAlphaBlendFunctionParameters=function(e,t,i,n){this._blendFunctionParameters[0]===e&&this._blendFunctionParameters[1]===t&&this._blendFunctionParameters[2]===i&&this._blendFunctionParameters[3]===n||(this._blendFunctionParameters[0]=e,this._blendFunctionParameters[1]=t,this._blendFunctionParameters[2]=i,this._blendFunctionParameters[3]=n,this._isBlendFunctionParametersDirty=!0)},e.prototype.setAlphaEquationParameters=function(e,t){this._blendEquationParameters[0]===e&&this._blendEquationParameters[1]===t||(this._blendEquationParameters[0]=e,this._blendEquationParameters[1]=t,this._isBlendEquationParametersDirty=!0)},e.prototype.reset=function(){this._alphaBlend=!1,this._blendFunctionParameters[0]=null,this._blendFunctionParameters[1]=null,this._blendFunctionParameters[2]=null,this._blendFunctionParameters[3]=null,this._blendEquationParameters[0]=null,this._blendEquationParameters[1]=null,this._blendConstants[0]=null,this._blendConstants[1]=null,this._blendConstants[2]=null,this._blendConstants[3]=null,this._isAlphaBlendDirty=!0,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1},e.prototype.apply=function(e){this.isDirty&&(this._isAlphaBlendDirty&&(this._alphaBlend?e.enable(e.BLEND):e.disable(e.BLEND),this._isAlphaBlendDirty=!1),this._isBlendFunctionParametersDirty&&(e.blendFuncSeparate(this._blendFunctionParameters[0],this._blendFunctionParameters[1],this._blendFunctionParameters[2],this._blendFunctionParameters[3]),this._isBlendFunctionParametersDirty=!1),this._isBlendEquationParametersDirty&&(e.blendEquationSeparate(this._blendEquationParameters[0],this._blendEquationParameters[1]),this._isBlendEquationParametersDirty=!1),this._isBlendConstantsDirty&&(e.blendColor(this._blendConstants[0],this._blendConstants[1],this._blendConstants[2],this._blendConstants[3]),this._isBlendConstantsDirty=!1))},e}(),c=i(7627),u=i(3734),f=i(6327),d=function(){function e(){}return e.prototype.postProcessor=function(e,t,i,n){if(!n.getCaps().drawBuffersExtension){e=e.replace(/#extension.+GL_EXT_draw_buffers.+(enable|require)/g,"")}return e},e}(),p=function(){function e(){}return e.prototype.attributeProcessor=function(e){return e.replace("attribute","in")},e.prototype.varyingProcessor=function(e,t){return e.replace("varying",t?"in":"out")},e.prototype.postProcessor=function(e,t,i){var n=-1!==e.search(/#extension.+GL_EXT_draw_buffers.+require/);if(e=(e=e.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"")).replace(/texture2D\s*\(/g,"texture("),i)e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/void\s+?main\s*\(/g,(n?"":"out vec4 glFragColor;\n")+"void main(");else if(-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;return e},e}(),_=i(5146),g=function(){function e(){this.vertexCompilationError=null,this.fragmentCompilationError=null,this.programLinkError=null,this.programValidationError=null}return Object.defineProperty(e.prototype,"isAsync",{get:function(){return this.isParallelCompiled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isReady",{get:function(){return!!this.program&&(!this.isParallelCompiled||this.engine._isRenderingStateCompiled(this))},enumerable:!1,configurable:!0}),e.prototype._handlesSpectorRebuildCallback=function(e){e&&this.program&&e(this.program)},e.prototype._getVertexShaderCode=function(){return this.vertexShader?this.engine._getShaderSource(this.vertexShader):null},e.prototype._getFragmentShaderCode=function(){return this.fragmentShader?this.engine._getShaderSource(this.fragmentShader):null},e}(),m=i(1370),v=i(8868),y=function(){},b=function(){function e(t,i,n,r){var o=this;void 0===r&&(r=!1),this.forcePOTTextures=!1,this.isFullscreen=!1,this.cullBackFaces=!0,this.renderEvenInBackground=!0,this.preventCacheWipeBetweenFrames=!1,this.validateShaderPrograms=!1,this.useReverseDepthBuffer=!1,this.disableUniformBuffers=!1,this._uniformBuffers=new Array,this._webGLVersion=1,this._windowIsBackground=!1,this._highPrecisionShadersAllowed=!0,this._badOS=!1,this._badDesktopOS=!1,this._renderingQueueLaunched=!1,this._activeRenderLoops=new Array,this.onContextLostObservable=new s.y$,this.onContextRestoredObservable=new s.y$,this._contextWasLost=!1,this._doNotHandleContextLost=!1,this.disableVertexArrayObjects=!1,this._colorWrite=!0,this._colorWriteChanged=!0,this._depthCullingState=new a,this._stencilState=new l,this._alphaState=new h,this._alphaMode=1,this._alphaEquation=0,this._internalTexturesCache=new Array,this._activeChannel=0,this._currentTextureChannel=-1,this._boundTexturesCache={},this._compiledEffects={},this._vertexAttribArraysEnabled=[],this._uintIndicesCurrentlySet=!1,this._currentBoundBuffer=new Array,this._currentFramebuffer=null,this._dummyFramebuffer=null,this._currentBufferPointers=new Array,this._currentInstanceLocations=new Array,this._currentInstanceBuffers=new Array,this._vaoRecordInProgress=!1,this._mustWipeVertexAttributes=!1,this._nextFreeTextureSlots=new Array,this._maxSimultaneousTextures=0,this._activeRequests=new Array,this._transformTextureUrl=null,this.hostInformation={isMobile:!1},this.premultipliedAlpha=!0,this.onBeforeTextureInitObservable=new s.y$,this._viewportCached={x:0,y:0,z:0,w:0},this._unpackFlipYCached=null,this.enableUnpackFlipYCached=!0,this._getDepthStencilBuffer=function(e,t,i,n,r,s){var a=o._gl,l=a.createRenderbuffer();return a.bindRenderbuffer(a.RENDERBUFFER,l),i>1&&a.renderbufferStorageMultisample?a.renderbufferStorageMultisample(a.RENDERBUFFER,i,r,e,t):a.renderbufferStorage(a.RENDERBUFFER,n,e,t),a.framebufferRenderbuffer(a.FRAMEBUFFER,s,a.RENDERBUFFER,l),a.bindRenderbuffer(a.RENDERBUFFER,null),l},this._boundUniforms={};var c=null;if(t){if(n=n||{},v.Z.SetMatrixPrecision(!!n.useHighPrecisionMatrix),t.getContext){if(c=t,this._renderingCanvas=c,null!=i&&(n.antialias=i),void 0===n.deterministicLockstep&&(n.deterministicLockstep=!1),void 0===n.lockstepMaxSteps&&(n.lockstepMaxSteps=4),void 0===n.timeStep&&(n.timeStep=1/60),void 0===n.preserveDrawingBuffer&&(n.preserveDrawingBuffer=!1),void 0===n.audioEngine&&(n.audioEngine=!0),void 0===n.stencil&&(n.stencil=!0),!1===n.premultipliedAlpha&&(this.premultipliedAlpha=!1),void 0===n.xrCompatible&&(n.xrCompatible=!0),this._doNotHandleContextLost=!!n.doNotHandleContextLost,navigator&&navigator.userAgent){var _=navigator.userAgent;this.hostInformation.isMobile=-1!==_.indexOf("Mobile");for(var g=0,m=e.ExceptionList;g0)if(parseInt(x[x.length-1])>=C)continue}for(var S=0,R=A;S1?this._shaderProcessor=new p:this._shaderProcessor=new d,this._badOS=/iPad/i.test(navigator.userAgent)||/iPhone/i.test(navigator.userAgent),this._badDesktopOS=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),this._creationOptions=n,console.log("Babylon.js v"+e.Version+" - "+this.description)}}return Object.defineProperty(e,"NpmPackage",{get:function(){return"babylonjs@4.2.0"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"Version",{get:function(){return"4.2.0"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"description",{get:function(){var e="WebGL"+this.webGLVersion;return this._caps.parallelShaderCompile&&(e+=" - Parallel shader compilation"),e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ShadersRepository",{get:function(){return r.Q.ShadersRepository},set:function(e){r.Q.ShadersRepository=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"supportsUniformBuffers",{get:function(){return this.webGLVersion>1&&!this.disableUniformBuffers},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_shouldUseHighPrecisionShader",{get:function(){return!(!this._caps.highPrecisionShaderSupported||!this._highPrecisionShadersAllowed)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needPOTTextures",{get:function(){return this._webGLVersion<2||this.forcePOTTextures},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"doNotHandleContextLost",{get:function(){return this._doNotHandleContextLost},set:function(e){this._doNotHandleContextLost=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_supportsHardwareTextureRescaling",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"framebufferDimensionsObject",{set:function(e){this._framebufferDimensionsObject=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentViewport",{get:function(){return this._cachedViewport},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emptyTexture",{get:function(){return this._emptyTexture||(this._emptyTexture=this.createRawTexture(new Uint8Array(4),1,1,5,!1,!1,1)),this._emptyTexture},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emptyTexture3D",{get:function(){return this._emptyTexture3D||(this._emptyTexture3D=this.createRawTexture3D(new Uint8Array(4),1,1,1,5,!1,!1,1)),this._emptyTexture3D},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emptyTexture2DArray",{get:function(){return this._emptyTexture2DArray||(this._emptyTexture2DArray=this.createRawTexture2DArray(new Uint8Array(4),1,1,1,5,!1,!1,1)),this._emptyTexture2DArray},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emptyCubeTexture",{get:function(){if(!this._emptyCubeTexture){var e=new Uint8Array(4),t=[e,e,e,e,e,e];this._emptyCubeTexture=this.createRawCubeTexture(t,1,5,0,!1,!1,1)}return this._emptyCubeTexture},enumerable:!1,configurable:!0}),e.prototype._rebuildInternalTextures=function(){for(var e=0,t=this._internalTexturesCache.slice();e1?this._gl.getParameter(this._gl.MAX_SAMPLES):1,maxCubemapTextureSize:this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),maxRenderTextureSize:this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),maxVertexAttribs:this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),maxVaryingVectors:this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),maxFragmentUniformVectors:this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),maxVertexUniformVectors:this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),parallelShaderCompile:this._gl.getExtension("KHR_parallel_shader_compile"),standardDerivatives:this._webGLVersion>1||null!==this._gl.getExtension("OES_standard_derivatives"),maxAnisotropy:1,astc:this._gl.getExtension("WEBGL_compressed_texture_astc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"),bptc:this._gl.getExtension("EXT_texture_compression_bptc")||this._gl.getExtension("WEBKIT_EXT_texture_compression_bptc"),s3tc:this._gl.getExtension("WEBGL_compressed_texture_s3tc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),pvrtc:this._gl.getExtension("WEBGL_compressed_texture_pvrtc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:this._gl.getExtension("WEBGL_compressed_texture_etc1")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),etc2:this._gl.getExtension("WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBGL_compressed_texture_es3_0"),textureAnisotropicFilterExtension:this._gl.getExtension("EXT_texture_filter_anisotropic")||this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"),uintIndices:this._webGLVersion>1||null!==this._gl.getExtension("OES_element_index_uint"),fragmentDepthSupported:this._webGLVersion>1||null!==this._gl.getExtension("EXT_frag_depth"),highPrecisionShaderSupported:!1,timerQuery:this._gl.getExtension("EXT_disjoint_timer_query_webgl2")||this._gl.getExtension("EXT_disjoint_timer_query"),canUseTimestampForTimerQuery:!1,drawBuffersExtension:!1,maxMSAASamples:1,colorBufferFloat:this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_float"),textureFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_float")),textureHalfFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_half_float")),textureHalfFloatRender:!1,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloatLinearFiltering:!1,vertexArrayObject:!1,instancedArrays:!1,textureLOD:!!(this._webGLVersion>1||this._gl.getExtension("EXT_shader_texture_lod")),blendMinMax:!1,multiview:this._gl.getExtension("OVR_multiview2"),oculusMultiview:this._gl.getExtension("OCULUS_multiview"),depthTextureExtension:!1},this._glVersion=this._gl.getParameter(this._gl.VERSION);var e=this._gl.getExtension("WEBGL_debug_renderer_info");if(null!=e&&(this._glRenderer=this._gl.getParameter(e.UNMASKED_RENDERER_WEBGL),this._glVendor=this._gl.getParameter(e.UNMASKED_VENDOR_WEBGL)),this._glVendor||(this._glVendor="Unknown vendor"),this._glRenderer||(this._glRenderer="Unknown renderer"),36193!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=36193),34842!==this._gl.RGBA16F&&(this._gl.RGBA16F=34842),34836!==this._gl.RGBA32F&&(this._gl.RGBA32F=34836),35056!==this._gl.DEPTH24_STENCIL8&&(this._gl.DEPTH24_STENCIL8=35056),this._caps.timerQuery&&(1===this._webGLVersion&&(this._gl.getQuery=this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)),this._caps.canUseTimestampForTimerQuery=this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT,this._caps.timerQuery.QUERY_COUNTER_BITS_EXT)>0),this._caps.maxAnisotropy=this._caps.textureAnisotropicFilterExtension?this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,this._caps.textureFloatLinearFiltering=!(!this._caps.textureFloat||!this._gl.getExtension("OES_texture_float_linear")),this._caps.textureFloatRender=!(!this._caps.textureFloat||!this._canRenderToFloatFramebuffer()),this._caps.textureHalfFloatLinearFiltering=!!(this._webGLVersion>1||this._caps.textureHalfFloat&&this._gl.getExtension("OES_texture_half_float_linear")),this._webGLVersion>1&&5131!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=5131),this._caps.textureHalfFloatRender=this._caps.textureHalfFloat&&this._canRenderToHalfFloatFramebuffer(),this._webGLVersion>1)this._caps.drawBuffersExtension=!0,this._caps.maxMSAASamples=this._gl.getParameter(this._gl.MAX_SAMPLES);else{var t=this._gl.getExtension("WEBGL_draw_buffers");if(null!==t){this._caps.drawBuffersExtension=!0,this._gl.drawBuffers=t.drawBuffersWEBGL.bind(t),this._gl.DRAW_FRAMEBUFFER=this._gl.FRAMEBUFFER;for(var i=0;i<16;i++)this._gl["COLOR_ATTACHMENT"+i+"_WEBGL"]=t["COLOR_ATTACHMENT"+i+"_WEBGL"]}}if(this._webGLVersion>1)this._caps.depthTextureExtension=!0;else{var n=this._gl.getExtension("WEBGL_depth_texture");null!=n&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=n.UNSIGNED_INT_24_8_WEBGL)}if(this.disableVertexArrayObjects)this._caps.vertexArrayObject=!1;else if(this._webGLVersion>1)this._caps.vertexArrayObject=!0;else{var r=this._gl.getExtension("OES_vertex_array_object");null!=r&&(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=r.createVertexArrayOES.bind(r),this._gl.bindVertexArray=r.bindVertexArrayOES.bind(r),this._gl.deleteVertexArray=r.deleteVertexArrayOES.bind(r))}if(this._webGLVersion>1)this._caps.instancedArrays=!0;else{var o=this._gl.getExtension("ANGLE_instanced_arrays");null!=o?(this._caps.instancedArrays=!0,this._gl.drawArraysInstanced=o.drawArraysInstancedANGLE.bind(o),this._gl.drawElementsInstanced=o.drawElementsInstancedANGLE.bind(o),this._gl.vertexAttribDivisor=o.vertexAttribDivisorANGLE.bind(o)):this._caps.instancedArrays=!1}if(this._gl.getShaderPrecisionFormat){var s=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),a=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);s&&a&&(this._caps.highPrecisionShaderSupported=0!==s.precision&&0!==a.precision)}if(this._webGLVersion>1)this._caps.blendMinMax=!0;else{var l=this._gl.getExtension("EXT_blend_minmax");null!=l&&(this._caps.blendMinMax=!0,this._gl.MAX=l.MAX_EXT,this._gl.MIN=l.MIN_EXT)}this._depthCullingState.depthTest=!0,this._depthCullingState.depthFunc=this._gl.LEQUAL,this._depthCullingState.depthMask=!0,this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(var h=0;h=0&&this._activeRenderLoops.splice(t,1)}else this._activeRenderLoops=[]},e.prototype._renderLoop=function(){if(!this._contextWasLost){var e=!0;if(!this.renderEvenInBackground&&this._windowIsBackground&&(e=!1),e){this.beginFrame();for(var t=0;t0?this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1},e.prototype.getRenderingCanvas=function(){return this._renderingCanvas},e.prototype.getHostWindow=function(){return f.M.IsWindowObjectExist()?this._renderingCanvas&&this._renderingCanvas.ownerDocument&&this._renderingCanvas.ownerDocument.defaultView?this._renderingCanvas.ownerDocument.defaultView:window:null},e.prototype.getRenderWidth=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferWidth:this._gl.drawingBufferWidth},e.prototype.getRenderHeight=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferHeight:this._gl.drawingBufferHeight},e.prototype._queueNewFrame=function(t,i){return e.QueueNewFrame(t,i)},e.prototype.runRenderLoop=function(e){-1===this._activeRenderLoops.indexOf(e)&&(this._activeRenderLoops.push(e),this._renderingQueueLaunched||(this._renderingQueueLaunched=!0,this._boundRenderFunction=this._renderLoop.bind(this),this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow())))},e.prototype.clear=function(e,t,i,n){void 0===n&&(n=!1),this.applyStates();var r=0;t&&e&&(this._gl.clearColor(e.r,e.g,e.b,void 0!==e.a?e.a:1),r|=this._gl.COLOR_BUFFER_BIT),i&&(this.useReverseDepthBuffer?(this._depthCullingState.depthFunc=this._gl.GREATER,this._gl.clearDepth(0)):this._gl.clearDepth(1),r|=this._gl.DEPTH_BUFFER_BIT),n&&(this._gl.clearStencil(0),r|=this._gl.STENCIL_BUFFER_BIT),this._gl.clear(r)},e.prototype._viewport=function(e,t,i,n){e===this._viewportCached.x&&t===this._viewportCached.y&&i===this._viewportCached.z&&n===this._viewportCached.w||(this._viewportCached.x=e,this._viewportCached.y=t,this._viewportCached.z=i,this._viewportCached.w=n,this._gl.viewport(e,t,i,n))},e.prototype.setViewport=function(e,t,i){var n=t||this.getRenderWidth(),r=i||this.getRenderHeight(),o=e.x||0,s=e.y||0;this._cachedViewport=e,this._viewport(o*n,s*r,n*e.width,r*e.height)},e.prototype.beginFrame=function(){},e.prototype.endFrame=function(){this._badOS&&this.flushFramebuffer()},e.prototype.resize=function(){var e,t;f.M.IsWindowObjectExist()?(e=this._renderingCanvas?this._renderingCanvas.clientWidth||this._renderingCanvas.width:window.innerWidth,t=this._renderingCanvas?this._renderingCanvas.clientHeight||this._renderingCanvas.height:window.innerHeight):(e=this._renderingCanvas?this._renderingCanvas.width:100,t=this._renderingCanvas?this._renderingCanvas.height:100),this.setSize(e/this._hardwareScalingLevel,t/this._hardwareScalingLevel)},e.prototype.setSize=function(e,t){return!!this._renderingCanvas&&(e|=0,t|=0,(this._renderingCanvas.width!==e||this._renderingCanvas.height!==t)&&(this._renderingCanvas.width=e,this._renderingCanvas.height=t,!0))},e.prototype.bindFramebuffer=function(e,t,i,n,r,o,s){void 0===t&&(t=0),void 0===o&&(o=0),void 0===s&&(s=0),this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._bindUnboundFramebuffer(e._MSAAFramebuffer?e._MSAAFramebuffer:e._framebuffer);var a=this._gl;e.is2DArray?a.framebufferTextureLayer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,e._webGLTexture,o,s):e.isCube&&a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+t,e._webGLTexture,o);var l=e._depthStencilTexture;if(l){var h=l._generateStencilBuffer?a.DEPTH_STENCIL_ATTACHMENT:a.DEPTH_ATTACHMENT;e.is2DArray?a.framebufferTextureLayer(a.FRAMEBUFFER,h,l._webGLTexture,o,s):e.isCube?a.framebufferTexture2D(a.FRAMEBUFFER,h,a.TEXTURE_CUBE_MAP_POSITIVE_X+t,l._webGLTexture,o):a.framebufferTexture2D(a.FRAMEBUFFER,h,a.TEXTURE_2D,l._webGLTexture,o)}this._cachedViewport&&!r?this.setViewport(this._cachedViewport,i,n):(i||(i=e.width,o&&(i/=Math.pow(2,o))),n||(n=e.height,o&&(n/=Math.pow(2,o))),this._viewport(0,0,i,n)),this.wipeCaches()},e.prototype._bindUnboundFramebuffer=function(e){this._currentFramebuffer!==e&&(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,e),this._currentFramebuffer=e)},e.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null;var n=this._gl;if(e._MSAAFramebuffer){if(e._textureArray)return void this.unBindMultiColorAttachmentFramebuffer(e._textureArray,t,i);n.bindFramebuffer(n.READ_FRAMEBUFFER,e._MSAAFramebuffer),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,e._framebuffer),n.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,n.COLOR_BUFFER_BIT,n.NEAREST)}!e.generateMipMaps||t||e.isCube||(this._bindTextureDirectly(n.TEXTURE_2D,e,!0),n.generateMipmap(n.TEXTURE_2D),this._bindTextureDirectly(n.TEXTURE_2D,null)),i&&(e._MSAAFramebuffer&&this._bindUnboundFramebuffer(e._framebuffer),i()),this._bindUnboundFramebuffer(null)},e.prototype.flushFramebuffer=function(){this._gl.flush()},e.prototype.restoreDefaultFramebuffer=function(){this._currentRenderTarget?this.unBindFramebuffer(this._currentRenderTarget):this._bindUnboundFramebuffer(null),this._cachedViewport&&this.setViewport(this._cachedViewport),this.wipeCaches()},e.prototype._resetVertexBufferBinding=function(){this.bindArrayBuffer(null),this._cachedVertexBuffers=null},e.prototype.createVertexBuffer=function(e){return this._createVertexBuffer(e,this._gl.STATIC_DRAW)},e.prototype._createVertexBuffer=function(e,t){var i=this._gl.createBuffer();if(!i)throw new Error("Unable to create vertex buffer");var n=new _.M(i);return this.bindArrayBuffer(n),e instanceof Array?this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),this._gl.STATIC_DRAW):this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.STATIC_DRAW),this._resetVertexBufferBinding(),n.references=1,n},e.prototype.createDynamicVertexBuffer=function(e){return this._createVertexBuffer(e,this._gl.DYNAMIC_DRAW)},e.prototype._resetIndexBufferBinding=function(){this.bindIndexBuffer(null),this._cachedIndexBuffer=null},e.prototype.createIndexBuffer=function(e,t){var i=this._gl.createBuffer(),n=new _.M(i);if(!i)throw new Error("Unable to create index buffer");this.bindIndexBuffer(n);var r=this._normalizeIndexData(e);return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,r,t?this._gl.DYNAMIC_DRAW:this._gl.STATIC_DRAW),this._resetIndexBufferBinding(),n.references=1,n.is32Bits=4===r.BYTES_PER_ELEMENT,n},e.prototype._normalizeIndexData=function(e){if(e instanceof Uint16Array)return e;if(this._caps.uintIndices){if(e instanceof Uint32Array)return e;for(var t=0;t=65535)return new Uint32Array(e);return new Uint16Array(e)}return new Uint16Array(e)},e.prototype.bindArrayBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ARRAY_BUFFER)},e.prototype.bindUniformBlock=function(e,t,i){var n=e.program,r=this._gl.getUniformBlockIndex(n,t);this._gl.uniformBlockBinding(n,r,i)},e.prototype.bindIndexBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)},e.prototype.bindBuffer=function(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)},e.prototype.updateArrayBuffer=function(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)},e.prototype._vertexAttribPointer=function(e,t,i,n,r,o,s){var a=this._currentBufferPointers[t];if(a){var l=!1;a.active?(a.buffer!==e&&(a.buffer=e,l=!0),a.size!==i&&(a.size=i,l=!0),a.type!==n&&(a.type=n,l=!0),a.normalized!==r&&(a.normalized=r,l=!0),a.stride!==o&&(a.stride=o,l=!0),a.offset!==s&&(a.offset=s,l=!0)):(l=!0,a.active=!0,a.index=t,a.size=i,a.type=n,a.normalized=r,a.stride=o,a.offset=s,a.buffer=e),(l||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),this._gl.vertexAttribPointer(t,i,n,r,o,s))}},e.prototype._bindIndexBufferWithCache=function(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)},e.prototype._bindVertexBuffersAttributes=function(e,t){var i=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var n=0;n=0){var o=e[i[n]];if(!o)continue;this._gl.enableVertexAttribArray(r),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[r]=!0);var s=o.getBuffer();s&&(this._vertexAttribPointer(s,r,o.getSize(),o.type,o.normalized,o.byteStride,o.byteOffset),o.getIsInstanced()&&(this._gl.vertexAttribDivisor(r,o.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(r),this._currentInstanceBuffers.push(s))))}}},e.prototype.recordVertexArrayObject=function(e,t,i){var n=this._gl.createVertexArray();return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(n),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,i),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),n},e.prototype.bindVertexArrayObject=function(e,t){this._cachedVertexArrayObject!==e&&(this._cachedVertexArrayObject=e,this._gl.bindVertexArray(e),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._uintIndicesCurrentlySet=null!=t&&t.is32Bits,this._mustWipeVertexAttributes=!0)},e.prototype.bindBuffersDirectly=function(e,t,i,n,r){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==r){this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=r;var o=r.getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var s=0,a=0;a=0&&(this._gl.enableVertexAttribArray(l),this._vertexAttribArraysEnabled[l]=!0,this._vertexAttribPointer(e,l,i[a],this._gl.FLOAT,!1,n,s)),s+=4*i[a]}}this._bindIndexBufferWithCache(t)},e.prototype._unbindVertexArrayObject=function(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))},e.prototype.bindBuffers=function(e,t,i){this._cachedVertexBuffers===e&&this._cachedEffectForVertexBuffers===i||(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=i,this._bindVertexBuffersAttributes(e,i)),this._bindIndexBufferWithCache(t)},e.prototype.unbindInstanceAttributes=function(){for(var e,t=0,i=this._currentInstanceLocations.length;t1?"#version 300 es\n#define WEBGL2 \n":"",a=this._compileShader(t,"vertex",n,s),l=this._compileShader(i,"fragment",n,s);return this._createShaderProgram(e,a,l,r,o)},e.prototype.createPipelineContext=function(){var e=new g;return e.engine=this,this._caps.parallelShaderCompile&&(e.isParallelCompiled=!0),e},e.prototype._createShaderProgram=function(e,t,i,n,r){void 0===r&&(r=null);var o=n.createProgram();if(e.program=o,!o)throw new Error("Unable to create program");return n.attachShader(o,t),n.attachShader(o,i),n.linkProgram(o),e.context=n,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),o},e.prototype._finalizePipelineContext=function(e){var t=e.context,i=e.vertexShader,n=e.fragmentShader,r=e.program;if(!t.getProgramParameter(r,t.LINK_STATUS)){var o,s;if(!this._gl.getShaderParameter(i,this._gl.COMPILE_STATUS))if(o=this._gl.getShaderInfoLog(i))throw e.vertexCompilationError=o,new Error("VERTEX SHADER "+o);if(!this._gl.getShaderParameter(n,this._gl.COMPILE_STATUS))if(o=this._gl.getShaderInfoLog(n))throw e.fragmentCompilationError=o,new Error("FRAGMENT SHADER "+o);if(s=t.getProgramInfoLog(r))throw e.programLinkError=s,new Error(s)}if(this.validateShaderPrograms&&(t.validateProgram(r),!t.getProgramParameter(r,t.VALIDATE_STATUS)&&(s=t.getProgramInfoLog(r))))throw e.programValidationError=s,new Error(s);t.deleteShader(i),t.deleteShader(n),e.vertexShader=void 0,e.fragmentShader=void 0,e.onCompiled&&(e.onCompiled(),e.onCompiled=void 0)},e.prototype._preparePipelineContext=function(e,t,i,n,r,o,s){var a=e;a.program=n?this.createRawShaderProgram(a,t,i,void 0,s):this.createShaderProgram(a,t,i,o,void 0,s),a.program.__SPECTOR_rebuildProgram=r},e.prototype._isRenderingStateCompiled=function(e){var t=e;return!!this._gl.getProgramParameter(t.program,this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)&&(this._finalizePipelineContext(t),!0)},e.prototype._executeWhenRenderingStateIsCompiled=function(e,t){var i=e;if(i.isParallelCompiled){var n=i.onCompiled;i.onCompiled=n?function(){n(),t()}:t}else t()},e.prototype.getUniforms=function(e,t){for(var i=new Array,n=e,r=0;r-1?t.substring(E).toLowerCase():""),x=null;C.indexOf("?")>-1&&(C=C.split("?")[0]);for(var S=0,R=e._TextureLoaders;Sl||e.height>l||!m._supportsHardwareTextureRescaling)return m._prepareWorkingCanvas(),!(!m._workingCanvas||!m._workingContext)&&(m._workingCanvas.width=t,m._workingCanvas.height=i,m._workingContext.drawImage(e,0,0,e.width,e.height,0,0,t,i),r.texImage2D(r.TEXTURE_2D,0,a,a,r.UNSIGNED_BYTE,m._workingCanvas),T.width=t,T.height=i,!1);var h=new c.l(m,c.S.Temp);return m._bindTextureDirectly(r.TEXTURE_2D,h,!0),r.texImage2D(r.TEXTURE_2D,0,a,a,r.UNSIGNED_BYTE,e),m._rescaleTexture(h,T,o,a,(function(){m._releaseTexture(h),m._bindTextureDirectly(r.TEXTURE_2D,T,!0),n()})),!0}),s)};!v||b?h&&(h.decoding||h.close)?D(h):e._FileToolsLoadImage(t,D,I,o?o.offlineProvider:null,_):"string"==typeof h||h instanceof ArrayBuffer||ArrayBuffer.isView(h)||h instanceof Blob?e._FileToolsLoadImage(h,D,I,o?o.offlineProvider:null,_):h&&D(h)}return T},e._FileToolsLoadImage=function(e,t,i,n,r){throw o.f.WarnImport("FileTools")},e.prototype._rescaleTexture=function(e,t,i,n,r){},e.prototype.createRawTexture=function(e,t,i,n,r,s,a,l,h){throw void 0===l&&(l=null),void 0===h&&(h=0),o.f.WarnImport("Engine.RawTexture")},e.prototype.createRawCubeTexture=function(e,t,i,n,r,s,a,l){throw void 0===l&&(l=null),o.f.WarnImport("Engine.RawTexture")},e.prototype.createRawTexture3D=function(e,t,i,n,r,s,a,l,h,c){throw void 0===h&&(h=null),void 0===c&&(c=0),o.f.WarnImport("Engine.RawTexture")},e.prototype.createRawTexture2DArray=function(e,t,i,n,r,s,a,l,h,c){throw void 0===h&&(h=null),void 0===c&&(c=0),o.f.WarnImport("Engine.RawTexture")},e.prototype._unpackFlipY=function(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,e?1:0),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))},e.prototype._getUnpackAlignement=function(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)},e.prototype._getTextureTarget=function(e){return e.isCube?this._gl.TEXTURE_CUBE_MAP:e.is3D?this._gl.TEXTURE_3D:e.is2DArray||e.isMultiview?this._gl.TEXTURE_2D_ARRAY:this._gl.TEXTURE_2D},e.prototype.updateTextureSamplingMode=function(e,t,i){void 0===i&&(i=!1);var n=this._getTextureTarget(t),r=this._getSamplingParameters(e,t.generateMipMaps||i);this._setTextureParameterInteger(n,this._gl.TEXTURE_MAG_FILTER,r.mag,t),this._setTextureParameterInteger(n,this._gl.TEXTURE_MIN_FILTER,r.min),i&&(t.generateMipMaps=!0,this._gl.generateMipmap(n)),this._bindTextureDirectly(n,null),t.samplingMode=e},e.prototype.updateTextureWrappingMode=function(e,t,i,n){void 0===i&&(i=null),void 0===n&&(n=null);var r=this._getTextureTarget(e);null!==t&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t),e),e._cachedWrapU=t),null!==i&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(i),e),e._cachedWrapV=i),(e.is2DArray||e.is3D)&&null!==n&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(n),e),e._cachedWrapR=n),this._bindTextureDirectly(r,null)},e.prototype._setupDepthStencilTexture=function(e,t,i,n,r){var o=t.width||t,s=t.height||t,a=t.layers||0;e.baseWidth=o,e.baseHeight=s,e.width=o,e.height=s,e.is2DArray=a>0,e.depth=a,e.isReady=!0,e.samples=1,e.generateMipMaps=!1,e._generateDepthBuffer=!0,e._generateStencilBuffer=i,e.samplingMode=n?2:1,e.type=0,e._comparisonFunction=r;var l=this._gl,h=this._getTextureTarget(e),c=this._getSamplingParameters(e.samplingMode,!1);l.texParameteri(h,l.TEXTURE_MAG_FILTER,c.mag),l.texParameteri(h,l.TEXTURE_MIN_FILTER,c.min),l.texParameteri(h,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(h,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),0===r?(l.texParameteri(h,l.TEXTURE_COMPARE_FUNC,515),l.texParameteri(h,l.TEXTURE_COMPARE_MODE,l.NONE)):(l.texParameteri(h,l.TEXTURE_COMPARE_FUNC,r),l.texParameteri(h,l.TEXTURE_COMPARE_MODE,l.COMPARE_REF_TO_TEXTURE))},e.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,s){void 0===o&&(o=0),void 0===s&&(s=0);var a=this._gl,l=a.TEXTURE_2D;e.isCube&&(l=a.TEXTURE_CUBE_MAP_POSITIVE_X+o),this._gl.compressedTexImage2D(l,s,t,i,n,0,r)},e.prototype._uploadDataToTextureDirectly=function(e,t,i,n,r,o){void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=!1);var s=this._gl,a=this._getWebGLTextureType(e.type),l=this._getInternalFormat(e.format),h=void 0===r?this._getRGBABufferInternalSizedFormat(e.type,e.format):this._getInternalFormat(r);this._unpackFlipY(e.invertY);var c=s.TEXTURE_2D;e.isCube&&(c=s.TEXTURE_CUBE_MAP_POSITIVE_X+i);var u=Math.round(Math.log(e.width)*Math.LOG2E),f=Math.round(Math.log(e.height)*Math.LOG2E),d=o?e.width:Math.pow(2,Math.max(u-n,0)),p=o?e.height:Math.pow(2,Math.max(f-n,0));s.texImage2D(c,n,h,d,p,0,l,a,t)},e.prototype.updateTextureData=function(e,t,i,n,r,o,s,a){void 0===s&&(s=0),void 0===a&&(a=0);var l=this._gl,h=this._getWebGLTextureType(e.type),c=this._getInternalFormat(e.format);this._unpackFlipY(e.invertY);var u=l.TEXTURE_2D;e.isCube&&(u=l.TEXTURE_CUBE_MAP_POSITIVE_X+s),l.texSubImage2D(u,a,i,n,r,o,c,h,t)},e.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var r=this._gl,o=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(o,e,!0),this._uploadDataToTextureDirectly(e,t,i,n),this._bindTextureDirectly(o,null,!0)},e.prototype._prepareWebGLTextureContinuation=function(e,t,i,n,r){var o=this._gl;if(o){var s=this._getSamplingParameters(r,!i);o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,s.mag),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,s.min),i||n||o.generateMipmap(o.TEXTURE_2D),this._bindTextureDirectly(o.TEXTURE_2D,null),t&&t._removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}},e.prototype._prepareWebGLTexture=function(t,i,n,r,o,s,a,l,h){var c=this;void 0===h&&(h=3);var u=this.getCaps().maxTextureSize,f=Math.min(u,this.needPOTTextures?e.GetExponentOfTwo(n,u):n),d=Math.min(u,this.needPOTTextures?e.GetExponentOfTwo(r,u):r),p=this._gl;p&&(t._webGLTexture?(this._bindTextureDirectly(p.TEXTURE_2D,t,!0),this._unpackFlipY(void 0===o||!!o),t.baseWidth=n,t.baseHeight=r,t.width=f,t.height=d,t.isReady=!0,l(f,d,(function(){c._prepareWebGLTextureContinuation(t,i,s,a,h)}))||this._prepareWebGLTextureContinuation(t,i,s,a,h)):i&&i._removePendingData(t))},e.prototype._setupFramebufferDepthAttachments=function(e,t,i,n,r){void 0===r&&(r=1);var o=this._gl;if(e&&t)return this._getDepthStencilBuffer(i,n,r,o.DEPTH_STENCIL,o.DEPTH24_STENCIL8,o.DEPTH_STENCIL_ATTACHMENT);if(t){var s=o.DEPTH_COMPONENT16;return this._webGLVersion>1&&(s=o.DEPTH_COMPONENT32F),this._getDepthStencilBuffer(i,n,r,s,s,o.DEPTH_ATTACHMENT)}return e?this._getDepthStencilBuffer(i,n,r,o.STENCIL_INDEX8,o.STENCIL_INDEX8,o.STENCIL_ATTACHMENT):null},e.prototype._releaseFramebufferObjects=function(e){var t=this._gl;e._framebuffer&&(t.deleteFramebuffer(e._framebuffer),e._framebuffer=null),e._depthStencilBuffer&&(t.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(t.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),e._MSAARenderBuffer&&(t.deleteRenderbuffer(e._MSAARenderBuffer),e._MSAARenderBuffer=null)},e.prototype._releaseTexture=function(e){this._releaseFramebufferObjects(e),this._deleteTexture(e._webGLTexture),this.unbindAllTextures();var t=this._internalTexturesCache.indexOf(e);-1!==t&&this._internalTexturesCache.splice(t,1),e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureLow&&e._lodTextureLow.dispose(),e._irradianceTexture&&e._irradianceTexture.dispose()},e.prototype._deleteTexture=function(e){this._gl.deleteTexture(e)},e.prototype._setProgram=function(e){this._currentProgram!==e&&(this._gl.useProgram(e),this._currentProgram=e)},e.prototype.bindSamplers=function(e){var t=e.getPipelineContext();this._setProgram(t.program);for(var i=e.getSamplers(),n=0;n-1;return i&&o&&(this._activeChannel=t._associatedChannel),this._boundTexturesCache[this._activeChannel]!==t||n?(this._activateCurrentTexture(),t&&t.isMultiview?this._gl.bindTexture(e,t?t._colorTextureArray:null):this._gl.bindTexture(e,t?t._webGLTexture:null),this._boundTexturesCache[this._activeChannel]=t,t&&(t._associatedChannel=this._activeChannel)):i&&(r=!0,this._activateCurrentTexture()),o&&!i&&this._bindSamplerUniformToChannel(t._associatedChannel,this._activeChannel),r},e.prototype._bindTexture=function(e,t){if(void 0!==e){t&&(t._associatedChannel=e),this._activeChannel=e;var i=t?this._getTextureTarget(t):this._gl.TEXTURE_2D;this._bindTextureDirectly(i,t)}},e.prototype.unbindAllTextures=function(){for(var e=0;e1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))},e.prototype.setTexture=function(e,t,i){void 0!==e&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,i))},e.prototype._bindSamplerUniformToChannel=function(e,t){var i=this._boundUniforms[e];i&&i._currentState!==t&&(this._gl.uniform1i(i,t),i._currentState=t)},e.prototype._getTextureWrapMode=function(e){switch(e){case 1:return this._gl.REPEAT;case 0:return this._gl.CLAMP_TO_EDGE;case 2:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT},e.prototype._setTexture=function(e,t,i,n){if(void 0===i&&(i=!1),void 0===n&&(n=!1),!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))),!1;if(t.video)this._activeChannel=e,t.update();else if(4===t.delayLoadState)return t.delayLoad(),!1;var r;r=n?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,!i&&r&&(r._associatedChannel=e);var o=!0;this._boundTexturesCache[e]===r&&(i||this._bindSamplerUniformToChannel(r._associatedChannel,e),o=!1),this._activeChannel=e;var s=this._getTextureTarget(r);if(o&&this._bindTextureDirectly(s,r,i),r&&!r.isMultiview){if(r.isCube&&r._cachedCoordinatesMode!==t.coordinatesMode){r._cachedCoordinatesMode=t.coordinatesMode;var a=3!==t.coordinatesMode&&5!==t.coordinatesMode?1:0;t.wrapU=a,t.wrapV=a}r._cachedWrapU!==t.wrapU&&(r._cachedWrapU=t.wrapU,this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t.wrapU),r)),r._cachedWrapV!==t.wrapV&&(r._cachedWrapV=t.wrapV,this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(t.wrapV),r)),r.is3D&&r._cachedWrapR!==t.wrapR&&(r._cachedWrapR=t.wrapR,this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(t.wrapR),r)),this._setAnisotropicLevel(s,r,t.anisotropicFilteringLevel)}return!0},e.prototype.setTextureArray=function(e,t,i){if(void 0!==e&&t){this._textureUnits&&this._textureUnits.length===i.length||(this._textureUnits=new Int32Array(i.length));for(var n=0;n=this._caps.maxVertexAttribs||!this._vertexAttribArraysEnabled[e]||this.disableAttributeByIndex(e)}},e.prototype.releaseEffects=function(){for(var e in this._compiledEffects){var t=this._compiledEffects[e].getPipelineContext();this._deletePipelineContext(t)}this._compiledEffects={}},e.prototype.dispose=function(){this.stopRenderLoop(),this.onBeforeTextureInitObservable&&this.onBeforeTextureInitObservable.clear(),this._emptyTexture&&(this._releaseTexture(this._emptyTexture),this._emptyTexture=null),this._emptyCubeTexture&&(this._releaseTexture(this._emptyCubeTexture),this._emptyCubeTexture=null),this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.releaseEffects(),this.unbindAllAttributes(),this._boundUniforms=[],f.M.IsWindowObjectExist()&&this._renderingCanvas&&(this._doNotHandleContextLost||(this._renderingCanvas.removeEventListener("webglcontextlost",this._onContextLost),this._renderingCanvas.removeEventListener("webglcontextrestored",this._onContextRestored))),this._workingCanvas=null,this._workingContext=null,this._currentBufferPointers=[],this._renderingCanvas=null,this._currentProgram=null,this._boundRenderFunction=null,r.Q.ResetCache();for(var e=0,t=this._activeRequests;e1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(1)},e.prototype._canRenderToHalfFloatFramebuffer=function(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(2)},e.prototype._canRenderToFramebuffer=function(e){for(var t=this._gl;t.getError()!==t.NO_ERROR;);var i=!0,n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texImage2D(t.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(e),1,1,0,t.RGBA,this._getWebGLTextureType(e),null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST);var r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0);var o=t.checkFramebufferStatus(t.FRAMEBUFFER);if((i=(i=i&&o===t.FRAMEBUFFER_COMPLETE)&&t.getError()===t.NO_ERROR)&&(t.clear(t.COLOR_BUFFER_BIT),i=i&&t.getError()===t.NO_ERROR),i){t.bindFramebuffer(t.FRAMEBUFFER,null);var s=t.RGBA,a=t.UNSIGNED_BYTE,l=new Uint8Array(4);t.readPixels(0,0,1,1,s,a,l),i=i&&t.getError()===t.NO_ERROR}for(t.deleteTexture(n),t.deleteFramebuffer(r),t.bindFramebuffer(t.FRAMEBUFFER,null);!i&&t.getError()!==t.NO_ERROR;);return i},e.prototype._getWebGLTextureType=function(e){if(1===this._webGLVersion){switch(e){case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT_OES;case 0:return this._gl.UNSIGNED_BYTE;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5}return this._gl.UNSIGNED_BYTE}switch(e){case 3:return this._gl.BYTE;case 0:return this._gl.UNSIGNED_BYTE;case 4:return this._gl.SHORT;case 5:return this._gl.UNSIGNED_SHORT;case 6:return this._gl.INT;case 7:return this._gl.UNSIGNED_INT;case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5;case 11:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case 12:return this._gl.UNSIGNED_INT_24_8;case 13:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case 14:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case 15:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE},e.prototype._getInternalFormat=function(e){var t=this._gl.RGBA;switch(e){case 0:t=this._gl.ALPHA;break;case 1:t=this._gl.LUMINANCE;break;case 2:t=this._gl.LUMINANCE_ALPHA;break;case 6:t=this._gl.RED;break;case 7:t=this._gl.RG;break;case 4:t=this._gl.RGB;break;case 5:t=this._gl.RGBA}if(this._webGLVersion>1)switch(e){case 8:t=this._gl.RED_INTEGER;break;case 9:t=this._gl.RG_INTEGER;break;case 10:t=this._gl.RGB_INTEGER;break;case 11:t=this._gl.RGBA_INTEGER}return t},e.prototype._getRGBABufferInternalSizedFormat=function(e,t){if(1===this._webGLVersion){if(void 0!==t)switch(t){case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;case 4:return this._gl.RGB}return this._gl.RGBA}switch(e){case 3:switch(t){case 6:return this._gl.R8_SNORM;case 7:return this._gl.RG8_SNORM;case 4:return this._gl.RGB8_SNORM;case 8:return this._gl.R8I;case 9:return this._gl.RG8I;case 10:return this._gl.RGB8I;case 11:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case 0:switch(t){case 6:return this._gl.R8;case 7:return this._gl.RG8;case 4:return this._gl.RGB8;case 5:return this._gl.RGBA8;case 8:return this._gl.R8UI;case 9:return this._gl.RG8UI;case 10:return this._gl.RGB8UI;case 11:return this._gl.RGBA8UI;case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;default:return this._gl.RGBA8}case 4:switch(t){case 8:return this._gl.R16I;case 9:return this._gl.RG16I;case 10:return this._gl.RGB16I;case 11:default:return this._gl.RGBA16I}case 5:switch(t){case 8:return this._gl.R16UI;case 9:return this._gl.RG16UI;case 10:return this._gl.RGB16UI;case 11:default:return this._gl.RGBA16UI}case 6:switch(t){case 8:return this._gl.R32I;case 9:return this._gl.RG32I;case 10:return this._gl.RGB32I;case 11:default:return this._gl.RGBA32I}case 7:switch(t){case 8:return this._gl.R32UI;case 9:return this._gl.RG32UI;case 10:return this._gl.RGB32UI;case 11:default:return this._gl.RGBA32UI}case 1:switch(t){case 6:return this._gl.R32F;case 7:return this._gl.RG32F;case 4:return this._gl.RGB32F;case 5:default:return this._gl.RGBA32F}case 2:switch(t){case 6:return this._gl.R16F;case 7:return this._gl.RG16F;case 4:return this._gl.RGB16F;case 5:default:return this._gl.RGBA16F}case 10:return this._gl.RGB565;case 13:return this._gl.R11F_G11F_B10F;case 14:return this._gl.RGB9_E5;case 8:return this._gl.RGBA4;case 9:return this._gl.RGB5_A1;case 11:switch(t){case 5:return this._gl.RGB10_A2;case 11:return this._gl.RGB10_A2UI;default:return this._gl.RGB10_A2}}return this._gl.RGBA8},e.prototype._getRGBAMultiSampleBufferFormat=function(e){return 1===e?this._gl.RGBA32F:2===e?this._gl.RGBA16F:this._gl.RGBA8},e.prototype._loadFile=function(t,i,n,r,o,s){var a=this,l=e._FileToolsLoadFile(t,i,n,r,o,s);return this._activeRequests.push(l),l.onCompleteObservable.add((function(e){a._activeRequests.splice(a._activeRequests.indexOf(e),1)})),l},e._FileToolsLoadFile=function(e,t,i,n,r,s){throw o.f.WarnImport("FileTools")},e.prototype.readPixels=function(e,t,i,n,r){void 0===r&&(r=!0);var o=r?4:3,s=r?this._gl.RGBA:this._gl.RGB,a=new Uint8Array(n*i*o);return this._gl.readPixels(e,t,i,n,s,this._gl.UNSIGNED_BYTE,a),a},Object.defineProperty(e,"IsSupported",{get:function(){return this.isSupported()},enumerable:!1,configurable:!0}),e.isSupported=function(){if(null!==this._HasMajorPerformanceCaveat)return!this._HasMajorPerformanceCaveat;if(null===this._IsSupported)try{var e=m.x.CreateCanvas(1,1),t=e.getContext("webgl")||e.getContext("experimental-webgl");this._IsSupported=null!=t&&!!window.WebGLRenderingContext}catch(e){this._IsSupported=!1}return this._IsSupported},Object.defineProperty(e,"HasMajorPerformanceCaveat",{get:function(){if(null===this._HasMajorPerformanceCaveat)try{var e=m.x.CreateCanvas(1,1),t=e.getContext("webgl",{failIfMajorPerformanceCaveat:!0})||e.getContext("experimental-webgl",{failIfMajorPerformanceCaveat:!0});this._HasMajorPerformanceCaveat=!t}catch(e){this._HasMajorPerformanceCaveat=!1}return this._HasMajorPerformanceCaveat},enumerable:!1,configurable:!0}),e.CeilingPOT=function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},e.FloorPOT=function(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)-(e>>1)},e.NearestPOT=function(t){var i=e.CeilingPOT(t),n=e.FloorPOT(t);return i-t>t-n?n:i},e.GetExponentOfTwo=function(t,i,n){var r;switch(void 0===n&&(n=2),n){case 1:r=e.FloorPOT(t);break;case 2:r=e.NearestPOT(t);break;case 3:default:r=e.CeilingPOT(t)}return Math.min(r,i)},e.QueueNewFrame=function(e,t){return f.M.IsWindowObjectExist()?(t||(t=window),t.requestPostAnimationFrame?t.requestPostAnimationFrame(e):t.requestAnimationFrame?t.requestAnimationFrame(e):t.msRequestAnimationFrame?t.msRequestAnimationFrame(e):t.webkitRequestAnimationFrame?t.webkitRequestAnimationFrame(e):t.mozRequestAnimationFrame?t.mozRequestAnimationFrame(e):t.oRequestAnimationFrame?t.oRequestAnimationFrame(e):window.setTimeout(e,16)):"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(e):setTimeout(e,16)},e.prototype.getHostDocument=function(){return this._renderingCanvas&&this._renderingCanvas.ownerDocument?this._renderingCanvas.ownerDocument:document},e.ExceptionList=[{key:"Chrome/63.0",capture:"63\\.0\\.3239\\.(\\d+)",captureConstraint:108,targets:["uniformBuffer"]},{key:"Firefox/58",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Firefox/59",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Chrome/72.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/73.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/74.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/71",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/72",capture:null,captureConstraint:null,targets:["vao"]}],e._TextureLoaders=[],e.CollisionsEpsilon=.001,e._IsSupported=null,e._HasMajorPerformanceCaveat=null,e}()},96:(e,t,i)=>{"use strict";i.d(t,{p:()=>n,o:()=>r});var n=function(){function e(){}return e.COPY=1,e.CUT=2,e.PASTE=3,e}(),r=function(){function e(e,t){this.type=e,this.event=t}return e.GetTypeFromCharacter=function(e){switch(e){case 67:return n.COPY;case 86:return n.PASTE;case 88:return n.CUT;default:return-1}},e}()},3997:(e,t,i)=>{"use strict";i.d(t,{OG:()=>r,NG:()=>o,WZ:()=>s});var n=i(655),r=function(){function e(){}return e.KEYDOWN=1,e.KEYUP=2,e}(),o=function(e,t){this.type=e,this.event=t},s=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.type=t,n.event=i,n.skipOnPointerObservable=!1,n}return(0,n.ZT)(t,e),t}(o)},5441:(e,t,i)=>{"use strict";i.d(t,{kD:()=>o,FV:()=>a,R5:()=>l});var n=i(655),r=i(2973),o=function(){function e(){}return e.POINTERDOWN=1,e.POINTERUP=2,e.POINTERMOVE=4,e.POINTERWHEEL=8,e.POINTERPICK=16,e.POINTERTAP=32,e.POINTERDOUBLETAP=64,e}(),s=function(e,t){this.type=e,this.event=t},a=function(e){function t(t,i,n,o){var s=e.call(this,t,i)||this;return s.ray=null,s.skipOnPointerObservable=!1,s.localPosition=new r.FM(n,o),s}return(0,n.ZT)(t,e),t}(s),l=function(e){function t(t,i,n){var r=e.call(this,t,i)||this;return r.pickInfo=n,r}return(0,n.ZT)(t,e),t}(s)},6182:(e,t,i)=>{"use strict";i.r(t),i.d(t,{HemisphericLight:()=>h});var n=i(655),r=i(9023),o=i(2973),s=i(8362),a=i(2686),l=i(5697);a.N.AddNodeConstructor("Light_Type_3",(function(e,t){return function(){return new h(e,o.P.Zero(),t)}}));var h=function(e){function t(t,i,n){var r=e.call(this,t,n)||this;return r.groundColor=new s.Wo(0,0,0),r.direction=i||o.P.Up(),r}return(0,n.ZT)(t,e),t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightGround",3),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},t.prototype.getClassName=function(){return"HemisphericLight"},t.prototype.setDirectionToTarget=function(e){return this.direction=o.P.Normalize(e.subtract(o.P.Zero())),this.direction},t.prototype.getShadowGenerator=function(){return null},t.prototype.transferToEffect=function(e,t){var i=o.P.Normalize(this.direction);return this._uniformBuffer.updateFloat4("vLightData",i.x,i.y,i.z,0,t),this._uniformBuffer.updateColor3("vLightGround",this.groundColor.scale(this.intensity),t),this},t.prototype.transferToNodeMaterialEffect=function(e,t){var i=o.P.Normalize(this.direction);return e.setFloat3(t,i.x,i.y,i.z),this},t.prototype.computeWorldMatrix=function(){return this._worldMatrix||(this._worldMatrix=o.y3.Identity()),this._worldMatrix},t.prototype.getTypeID=function(){return l._.LIGHTTYPEID_HEMISPHERICLIGHT},t.prototype.prepareLightSpecificDefines=function(e,t){e["HEMILIGHT"+t]=!0},(0,n.gn)([(0,r.n9)()],t.prototype,"groundColor",void 0),(0,n.gn)([(0,r.hd)()],t.prototype,"direction",void 0),t}(l._)},5697:(e,t,i)=>{"use strict";i.d(t,{_:()=>c});var n=i(655),r=i(9023),o=i(2973),s=i(8362),a=i(2686),l=i(356),h=i(6132),c=function(e){function t(i,n){var r=e.call(this,i,n)||this;return r.diffuse=new s.Wo(1,1,1),r.specular=new s.Wo(1,1,1),r.falloffType=t.FALLOFF_DEFAULT,r.intensity=1,r._range=Number.MAX_VALUE,r._inverseSquaredRange=0,r._photometricScale=1,r._intensityMode=t.INTENSITYMODE_AUTOMATIC,r._radius=1e-5,r.renderPriority=0,r._shadowEnabled=!0,r._excludeWithLayerMask=0,r._includeOnlyWithLayerMask=0,r._lightmapMode=0,r._excludedMeshesIds=new Array,r._includedOnlyMeshesIds=new Array,r._isLight=!0,r.getScene().addLight(r),r._uniformBuffer=new l.M(r.getScene().getEngine()),r._buildUniformLayout(),r.includedOnlyMeshes=new Array,r.excludedMeshes=new Array,r._resyncMeshes(),r}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"range",{get:function(){return this._range},set:function(e){this._range=e,this._inverseSquaredRange=1/(this.range*this.range)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"intensityMode",{get:function(){return this._intensityMode},set:function(e){this._intensityMode=e,this._computePhotometricScale()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._computePhotometricScale()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowEnabled",{get:function(){return this._shadowEnabled},set:function(e){this._shadowEnabled!==e&&(this._shadowEnabled=e,this._markMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"includedOnlyMeshes",{get:function(){return this._includedOnlyMeshes},set:function(e){this._includedOnlyMeshes=e,this._hookArrayForIncludedOnly(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"excludedMeshes",{get:function(){return this._excludedMeshes},set:function(e){this._excludedMeshes=e,this._hookArrayForExcluded(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"excludeWithLayerMask",{get:function(){return this._excludeWithLayerMask},set:function(e){this._excludeWithLayerMask=e,this._resyncMeshes()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"includeOnlyWithLayerMask",{get:function(){return this._includeOnlyWithLayerMask},set:function(e){this._includeOnlyWithLayerMask=e,this._resyncMeshes()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lightmapMode",{get:function(){return this._lightmapMode},set:function(e){this._lightmapMode!==e&&(this._lightmapMode=e,this._markMeshesAsLightDirty())},enumerable:!1,configurable:!0}),t.prototype.transferTexturesToEffect=function(e,t){return this},t.prototype._bindLight=function(e,t,i,n,r){void 0===r&&(r=!1);var o=e.toString(),a=!1;if(!r||!this._uniformBuffer._alreadyBound){if(this._uniformBuffer.bindToEffect(i,"Light"+o),this._renderId!==t.getRenderId()||!this._uniformBuffer.useUbo){this._renderId=t.getRenderId();var l=this.getScaledIntensity();this.transferToEffect(i,o),this.diffuse.scaleToRef(l,s.zZ.Color3[0]),this._uniformBuffer.updateColor4("vLightDiffuse",s.zZ.Color3[0],this.range,o),n&&(this.specular.scaleToRef(l,s.zZ.Color3[1]),this._uniformBuffer.updateColor4("vLightSpecular",s.zZ.Color3[1],this.radius,o)),a=!0}if(this.transferTexturesToEffect(i,o),t.shadowsEnabled&&this.shadowEnabled){var h=this.getShadowGenerator();h&&(h.bindShadowLight(o,i),a=!0)}a&&this._uniformBuffer.update()}},t.prototype.getClassName=function(){return"Light"},t.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+["Point","Directional","Spot","Hemispheric"][this.getTypeID()],this.animations)for(var i=0;i0&&-1===this.includedOnlyMeshes.indexOf(e))&&(!(this.excludedMeshes&&this.excludedMeshes.length>0&&-1!==this.excludedMeshes.indexOf(e))&&((0===this.includeOnlyWithLayerMask||0!=(this.includeOnlyWithLayerMask&e.layerMask))&&!(0!==this.excludeWithLayerMask&&this.excludeWithLayerMask&e.layerMask)))},t.CompareLightsPriority=function(e,t){return e.shadowEnabled!==t.shadowEnabled?(t.shadowEnabled?1:0)-(e.shadowEnabled?1:0):t.renderPriority-e.renderPriority},t.prototype.dispose=function(t,i){void 0===i&&(i=!1),this._shadowGenerator&&(this._shadowGenerator.dispose(),this._shadowGenerator=null),this.getScene().stopAnimation(this);for(var n=0,r=this.getScene().meshes;n0&&(e.excludedMeshesIds=[],this.excludedMeshes.forEach((function(t){e.excludedMeshesIds.push(t.id)}))),this.includedOnlyMeshes.length>0&&(e.includedOnlyMeshesIds=[],this.includedOnlyMeshes.forEach((function(t){e.includedOnlyMeshesIds.push(t.id)}))),r.p4.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e},t.GetConstructorFromName=function(e,t,i){var n=a.N.Construct("Light_Type_"+e,t,i);return n||null},t.Parse=function(e,i){var n=t.GetConstructorFromName(e.type,e.name,i);if(!n)return null;var o=r.p4.Parse(n,e,i);if(e.excludedMeshesIds&&(o._excludedMeshesIds=e.excludedMeshesIds),e.includedOnlyMeshesIds&&(o._includedOnlyMeshesIds=e.includedOnlyMeshesIds),e.parentId&&(o._waitingParentId=e.parentId),void 0!==e.falloffType&&(o.falloffType=e.falloffType),void 0!==e.lightmapMode&&(o.lightmapMode=e.lightmapMode),e.animations){for(var s=0;s{"use strict";i.r(t),i.d(t,{SceneLoaderAnimationGroupLoadingMode:()=>n,SceneLoader:()=>f});var n,r=i(5540),o=i(475),s=i(3483),a=i(4391),l=i(2905),h=i(2733),c=i(3734),u=i(9995);!function(e){e[e.Clean=0]="Clean",e[e.Stop=1]="Stop",e[e.Sync=2]="Sync",e[e.NoSync=3]="NoSync"}(n||(n={}));var f=function(){function e(){}return Object.defineProperty(e,"ForceFullSceneLoadingForIncremental",{get:function(){return u.Z.ForceFullSceneLoadingForIncremental},set:function(e){u.Z.ForceFullSceneLoadingForIncremental=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ShowLoadingScreen",{get:function(){return u.Z.ShowLoadingScreen},set:function(e){u.Z.ShowLoadingScreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"loggingLevel",{get:function(){return u.Z.loggingLevel},set:function(e){u.Z.loggingLevel=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"CleanBoneMatrixWeights",{get:function(){return u.Z.CleanBoneMatrixWeights},set:function(e){u.Z.CleanBoneMatrixWeights=e},enumerable:!1,configurable:!0}),e.GetDefaultPlugin=function(){return e._registeredPlugins[".babylon"]},e._GetPluginForExtension=function(t){var i=e._registeredPlugins[t];return i||(c.Y.Warn("Unable to find a plugin to load "+t+" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/how_to/load_from_any_file_type"),e.GetDefaultPlugin())},e._GetPluginForDirectLoad=function(t){for(var i in e._registeredPlugins){var n=e._registeredPlugins[i].plugin;if(n.canDirectLoad&&n.canDirectLoad(t))return e._registeredPlugins[i]}return e.GetDefaultPlugin()},e._GetPluginForFilename=function(t){var i=t.indexOf("?");-1!==i&&(t=t.substring(0,i));var n=t.lastIndexOf("."),r=t.substring(n,t.length).toLowerCase();return e._GetPluginForExtension(r)},e._GetDirectLoad=function(e){return"data:"===e.substr(0,5)?e.substr(5):null},e._LoadData=function(t,i,n,r,o,a,h){var c,u=e._GetDirectLoad(t.name),f=h?e._GetPluginForExtension(h):u?e._GetPluginForDirectLoad(t.name):e._GetPluginForFilename(t.name);if(!(c=void 0!==f.plugin.createPlugin?f.plugin.createPlugin():f.plugin))throw"The loader plugin corresponding to the file type you are trying to load has not been found. If using es6, please import the plugin you wish to use before.";if(e.OnPluginActivatedObservable.notifyObservers(c),u){if(c.directLoad){var d=c.directLoad(i,u);d.then?d.then((function(e){n(c,e)})).catch((function(e){o("Error in directLoad of _loadData: "+e,e)})):n(c,d)}else n(c,u);return c}var p=f.isBinary,_=function(e,t){i.isDisposed?o("Scene has been disposed"):n(c,e,t)},g=null,m=!1,v=c.onDisposeObservable;v&&v.add((function(){m=!0,g&&(g.abort(),g=null),a()}));var y=function(){if(!m){var e=function(e,t){_(e,t?t.responseURL:void 0)},n=function(e){o(e.message,e)};g=c.requestFile?c.requestFile(i,t.url,e,r,p,n):i._requestFile(t.url,e,r,!0,p,n)}},b=t.file||s.X.FilesToLoad[t.name.toLowerCase()];if(-1===t.rootUrl.indexOf("file:")||-1!==t.rootUrl.indexOf("file:")&&!b){var T=i.getEngine(),A=T.enableOfflineSupport;if(A){for(var E=!1,C=0,x=i.disableOfflineSupportExceptionRules;C{"use strict";i.d(t,{Z:()=>n});var n=function(){function e(){}return Object.defineProperty(e,"ForceFullSceneLoadingForIncremental",{get:function(){return e._ForceFullSceneLoadingForIncremental},set:function(t){e._ForceFullSceneLoadingForIncremental=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ShowLoadingScreen",{get:function(){return e._ShowLoadingScreen},set:function(t){e._ShowLoadingScreen=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"loggingLevel",{get:function(){return e._loggingLevel},set:function(t){e._loggingLevel=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"CleanBoneMatrixWeights",{get:function(){return e._CleanBoneMatrixWeights},set:function(t){e._CleanBoneMatrixWeights=t},enumerable:!1,configurable:!0}),e._ForceFullSceneLoadingForIncremental=!1,e._ShowLoadingScreen=!0,e._CleanBoneMatrixWeights=!1,e._loggingLevel=0,e}()},4664:(e,t,i)=>{"use strict";i.d(t,{V:()=>c});var n=i(655),r=i(9023),o=i(475),s=i(2973),a=i(2733),l=i(8927),h=(i(5684),i(488)),c=function(e){function t(i){var n=e.call(this,null)||this;return n.metadata=null,n.reservedDataStore=null,n._hasAlpha=!1,n.getAlphaFromRGB=!1,n.level=1,n.coordinatesIndex=0,n._coordinatesMode=0,n.wrapR=1,n.anisotropicFilteringLevel=t.DEFAULT_ANISOTROPIC_FILTERING_LEVEL,n._isCube=!1,n._gammaSpace=!0,n.invertZ=!1,n.lodLevelInAlpha=!1,n.isRenderTarget=!1,n._prefiltered=!1,n.animations=new Array,n.onDisposeObservable=new o.y$,n._onDisposeObserver=null,n._scene=null,n._texture=null,n._uid=null,i?t._isScene(i)?n._scene=i:n._engine=i:n._scene=a.l.LastCreatedScene,n._scene&&(n.uniqueId=n._scene.getUniqueId(),n._scene.addTexture(n),n._engine=n._scene.getEngine()),n._uid=null,n}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"hasAlpha",{get:function(){return this._hasAlpha},set:function(e){this._hasAlpha!==e&&(this._hasAlpha=e,this._scene&&this._scene.markAllMaterialsAsDirty(17))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"coordinatesMode",{get:function(){return this._coordinatesMode},set:function(e){this._coordinatesMode!==e&&(this._coordinatesMode=e,this._scene&&this._scene.markAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wrapU",{get:function(){return this._wrapU},set:function(e){this._wrapU=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wrapV",{get:function(){return this._wrapV},set:function(e){this._wrapV=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isCube",{get:function(){return this._texture?this._texture.isCube:this._isCube},set:function(e){this._texture?this._texture.isCube=e:this._isCube=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"is3D",{get:function(){return!!this._texture&&this._texture.is3D},set:function(e){this._texture&&(this._texture.is3D=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"is2DArray",{get:function(){return!!this._texture&&this._texture.is2DArray},set:function(e){this._texture&&(this._texture.is2DArray=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gammaSpace",{get:function(){return this._texture?(null===this._texture._gammaSpace&&(this._texture._gammaSpace=this._gammaSpace),this._texture._gammaSpace):this._gammaSpace},set:function(e){if(this._texture){if(this._texture._gammaSpace===e)return;this._texture._gammaSpace=e}else{if(this._gammaSpace===e)return;this._gammaSpace=e}this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRGBD",{get:function(){return null!=this._texture&&this._texture._isRGBD},set:function(e){this._texture&&(this._texture._isRGBD=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"noMipmap",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodGenerationOffset",{get:function(){return this._texture?this._texture._lodGenerationOffset:0},set:function(e){this._texture&&(this._texture._lodGenerationOffset=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodGenerationScale",{get:function(){return this._texture?this._texture._lodGenerationScale:0},set:function(e){this._texture&&(this._texture._lodGenerationScale=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linearSpecularLOD",{get:function(){return!!this._texture&&this._texture._linearSpecularLOD},set:function(e){this._texture&&(this._texture._linearSpecularLOD=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"irradianceTexture",{get:function(){return this._texture?this._texture._irradianceTexture:null},set:function(e){this._texture&&(this._texture._irradianceTexture=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uid",{get:function(){return this._uid||(this._uid=l.x.RandomId()),this._uid},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return this.name},t.prototype.getClassName=function(){return"BaseTexture"},Object.defineProperty(t.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isBlocking",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.getScene=function(){return this._scene},t.prototype._getEngine=function(){return this._engine},t.prototype.checkTransformsAreIdentical=function(e){return null!==e},t.prototype.getTextureMatrix=function(){return s.y3.IdentityReadOnly},t.prototype.getReflectionTextureMatrix=function(){return s.y3.IdentityReadOnly},t.prototype.isReadyOrNotBlocking=function(){return!this.isBlocking||this.isReady()},t.prototype.scale=function(e){},Object.defineProperty(t.prototype,"canRescale",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype._getFromCache=function(e,t,i,n){var r=this._getEngine();if(!r)return null;for(var o=r.getLoadedTexturesCache(),s=0;s=0&&this._scene.textures.splice(t,1),this._scene.onTextureRemovedObservable.notifyObservers(this),this._scene=null}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),e.prototype.dispose.call(this)},t.prototype.serialize=function(){if(!this.name)return null;var e=r.p4.Serialize(this);return r.p4.AppendSerializedAnimations(this,e),e},t.WhenAllReady=function(e,t){var i=e.length;if(0!==i)for(var n=0;n{"use strict";i.r(t),i.d(t,{DynamicTexture:()=>h});var n=i(655),r=i(3734),o=i(4283),s=i(2131),a=i(7627);s.B.prototype.createDynamicTexture=function(e,t,i,n){var r=new a.l(this,a.S.Dynamic);return r.baseWidth=e,r.baseHeight=t,i&&(e=this.needPOTTextures?s.B.GetExponentOfTwo(e,this._caps.maxTextureSize):e,t=this.needPOTTextures?s.B.GetExponentOfTwo(t,this._caps.maxTextureSize):t),r.width=e,r.height=t,r.isReady=!1,r.generateMipMaps=i,r.samplingMode=n,this.updateTextureSamplingMode(n,r),this._internalTexturesCache.push(r),r},s.B.prototype.updateDynamicTexture=function(e,t,i,n,r,o){if(void 0===n&&(n=!1),void 0===o&&(o=!1),e){var s=this._gl,a=s.TEXTURE_2D,l=this._bindTextureDirectly(a,e,!0,o);this._unpackFlipY(void 0===i?e.invertY:i),n&&s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1);var h=this._getWebGLTextureType(e.type),c=this._getInternalFormat(r||e.format),u=this._getRGBABufferInternalSizedFormat(e.type,c);s.texImage2D(a,0,u,c,h,t),e.generateMipMaps&&s.generateMipmap(a),l||this._bindTextureDirectly(a,null),n&&s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.isReady=!0}};var l=i(1370),h=function(e){function t(t,i,n,r,s,a,h){void 0===n&&(n=null),void 0===s&&(s=3),void 0===a&&(a=5);var c=e.call(this,null,n,!r,h,s,void 0,void 0,void 0,void 0,a)||this;c.name=t,c.wrapU=o.x.CLAMP_ADDRESSMODE,c.wrapV=o.x.CLAMP_ADDRESSMODE,c._generateMipMaps=r;var u=c._getEngine();if(!u)return c;i.getContext?(c._canvas=i,c._texture=u.createDynamicTexture(i.width,i.height,r,s)):(c._canvas=l.x.CreateCanvas(1,1),i.width||0===i.width?c._texture=u.createDynamicTexture(i.width,i.height,r,s):c._texture=u.createDynamicTexture(i,i,r,s));var f=c.getSize();return c._canvas.width=f.width,c._canvas.height=f.height,c._context=c._canvas.getContext("2d"),c}return(0,n.ZT)(t,e),t.prototype.getClassName=function(){return"DynamicTexture"},Object.defineProperty(t.prototype,"canRescale",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype._recreate=function(e){this._canvas.width=e.width,this._canvas.height=e.height,this.releaseInternalTexture(),this._texture=this._getEngine().createDynamicTexture(e.width,e.height,this._generateMipMaps,this.samplingMode)},t.prototype.scale=function(e){var t=this.getSize();t.width*=e,t.height*=e,this._recreate(t)},t.prototype.scaleTo=function(e,t){var i=this.getSize();i.width=e,i.height=t,this._recreate(i)},t.prototype.getContext=function(){return this._context},t.prototype.clear=function(){var e=this.getSize();this._context.fillRect(0,0,e.width,e.height)},t.prototype.update=function(e,t){void 0===t&&(t=!1),this._getEngine().updateDynamicTexture(this._texture,this._canvas,void 0===e||e,t,this._format||void 0)},t.prototype.drawText=function(e,t,i,n,r,o,s,a){void 0===a&&(a=!0);var l=this.getSize();if(o&&(this._context.fillStyle=o,this._context.fillRect(0,0,l.width,l.height)),this._context.font=n,null==t){var h=this._context.measureText(e);t=(l.width-h.width)/2}if(null==i){var c=parseInt(n.replace(/\D/g,""));i=l.height/2+c/3.65}this._context.fillStyle=r||"",this._context.fillText(e,t,i),a&&this.update(s)},t.prototype.clone=function(){var e=this.getScene();if(!e)return this;var i=this.getSize(),n=new t(this.name,i,e,this._generateMipMaps);return n.hasAlpha=this.hasAlpha,n.level=this.level,n.wrapU=this.wrapU,n.wrapV=this.wrapV,n},t.prototype.serialize=function(){var t=this.getScene();t&&!t.isReady()&&r.Y.Warn("The scene must be ready before serializing the dynamic texture");var i=e.prototype.serialize.call(this);return this._IsCanvasElement(this._canvas)&&(i.base64String=this._canvas.toDataURL()),i.invertY=this._invertY,i.samplingMode=this.samplingMode,i},t.prototype._IsCanvasElement=function(e){return void 0!==e.toDataURL},t.prototype._rebuild=function(){this.update()},t}(o.x)},7627:(e,t,i)=>{"use strict";i.d(t,{S:()=>n,l:()=>a});var n,r=i(475),o=i(7533),s=i(106);!function(e){e[e.Unknown=0]="Unknown",e[e.Url=1]="Url",e[e.Temp=2]="Temp",e[e.Raw=3]="Raw",e[e.Dynamic=4]="Dynamic",e[e.RenderTarget=5]="RenderTarget",e[e.MultiRenderTarget=6]="MultiRenderTarget",e[e.Cube=7]="Cube",e[e.CubeRaw=8]="CubeRaw",e[e.CubePrefiltered=9]="CubePrefiltered",e[e.Raw3D=10]="Raw3D",e[e.Raw2DArray=11]="Raw2DArray",e[e.Depth=12]="Depth",e[e.CubeRawRGBD=13]="CubeRawRGBD"}(n||(n={}));var a=function(){function e(e,t,i){void 0===i&&(i=!1),this.isReady=!1,this.isCube=!1,this.is3D=!1,this.is2DArray=!1,this.isMultiview=!1,this.url="",this.samplingMode=-1,this.generateMipMaps=!1,this.samples=0,this.type=-1,this.format=-1,this.onLoadedObservable=new r.y$,this.width=0,this.height=0,this.depth=0,this.baseWidth=0,this.baseHeight=0,this.baseDepth=0,this.invertY=!1,this._invertVScale=!1,this._associatedChannel=-1,this._source=n.Unknown,this._buffer=null,this._bufferView=null,this._bufferViewArray=null,this._bufferViewArrayArray=null,this._size=0,this._extension="",this._files=null,this._workingCanvas=null,this._workingContext=null,this._framebuffer=null,this._depthStencilBuffer=null,this._MSAAFramebuffer=null,this._MSAARenderBuffer=null,this._attachments=null,this._textureArray=null,this._cachedCoordinatesMode=null,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedWrapR=null,this._cachedAnisotropicFilteringLevel=null,this._isDisabled=!1,this._compression=null,this._generateStencilBuffer=!1,this._generateDepthBuffer=!1,this._comparisonFunction=0,this._sphericalPolynomial=null,this._lodGenerationScale=0,this._lodGenerationOffset=0,this._colorTextureArray=null,this._depthStencilTextureArray=null,this._lodTextureHigh=null,this._lodTextureMid=null,this._lodTextureLow=null,this._isRGBD=!1,this._linearSpecularLOD=!1,this._irradianceTexture=null,this._webGLTexture=null,this._references=1,this._gammaSpace=null,this._engine=e,this._source=t,i||(this._webGLTexture=e._createTexture())}return e.prototype.getEngine=function(){return this._engine},Object.defineProperty(e.prototype,"source",{get:function(){return this._source},enumerable:!1,configurable:!0}),e.prototype.incrementReferences=function(){this._references++},e.prototype.updateSize=function(e,t,i){void 0===i&&(i=1),this.width=e,this.height=t,this.depth=i,this.baseWidth=e,this.baseHeight=t,this.baseDepth=i,this._size=e*t*i},e.prototype._rebuild=function(){var t,i,r=this;switch(this.isReady=!1,this._cachedCoordinatesMode=null,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedAnisotropicFilteringLevel=null,this.source){case n.Temp:return;case n.Url:return void(i=this._engine.createTexture(null!==(t=this._originalUrl)&&void 0!==t?t:this.url,!this.generateMipMaps,this.invertY,null,this.samplingMode,(function(){i._swapAndDie(r),r.isReady=!0}),null,this._buffer,void 0,this.format));case n.Raw:return(i=this._engine.createRawTexture(this._bufferView,this.baseWidth,this.baseHeight,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case n.Raw3D:return(i=this._engine.createRawTexture3D(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case n.Raw2DArray:return(i=this._engine.createRawTexture2DArray(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case n.Dynamic:return(i=this._engine.createDynamicTexture(this.baseWidth,this.baseHeight,this.generateMipMaps,this.samplingMode))._swapAndDie(this),void this._engine.updateDynamicTexture(this,this._engine.getRenderingCanvas(),this.invertY,void 0,void 0,!0);case n.RenderTarget:var s=new o.L;if(s.generateDepthBuffer=this._generateDepthBuffer,s.generateMipMaps=this.generateMipMaps,s.generateStencilBuffer=this._generateStencilBuffer,s.samplingMode=this.samplingMode,s.type=this.type,this.isCube)i=this._engine.createRenderTargetCubeTexture(this.width,s);else{var a={width:this.width,height:this.height,layers:this.is2DArray?this.depth:void 0};i=this._engine.createRenderTargetTexture(a,s)}return i._swapAndDie(this),void(this.isReady=!0);case n.Depth:var l={bilinearFiltering:2!==this.samplingMode,comparisonFunction:this._comparisonFunction,generateStencil:this._generateStencilBuffer,isCube:this.isCube},h={width:this.width,height:this.height,layers:this.is2DArray?this.depth:void 0};return(i=this._engine.createDepthStencilTexture(h,l))._swapAndDie(this),void(this.isReady=!0);case n.Cube:return void(i=this._engine.createCubeTexture(this.url,null,this._files,!this.generateMipMaps,(function(){i._swapAndDie(r),r.isReady=!0}),null,this.format,this._extension));case n.CubeRaw:return(i=this._engine.createRawCubeTexture(this._bufferViewArray,this.width,this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case n.CubeRawRGBD:return i=this._engine.createRawCubeTexture(null,this.width,this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression),void e._UpdateRGBDAsync(i,this._bufferViewArrayArray,this._sphericalPolynomial,this._lodGenerationScale,this._lodGenerationOffset).then((function(){i._swapAndDie(r),r.isReady=!0}));case n.CubePrefiltered:return void((i=this._engine.createPrefilteredCubeTexture(this.url,null,this._lodGenerationScale,this._lodGenerationOffset,(function(e){e&&e._swapAndDie(r),r.isReady=!0}),null,this.format,this._extension))._sphericalPolynomial=this._sphericalPolynomial)}},e.prototype._swapAndDie=function(e){e._webGLTexture=this._webGLTexture,e._isRGBD=this._isRGBD,this._framebuffer&&(e._framebuffer=this._framebuffer),this._depthStencilBuffer&&(e._depthStencilBuffer=this._depthStencilBuffer),e._depthStencilTexture=this._depthStencilTexture,this._lodTextureHigh&&(e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureHigh=this._lodTextureHigh),this._lodTextureMid&&(e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureMid=this._lodTextureMid),this._lodTextureLow&&(e._lodTextureLow&&e._lodTextureLow.dispose(),e._lodTextureLow=this._lodTextureLow),this._irradianceTexture&&(e._irradianceTexture&&e._irradianceTexture.dispose(),e._irradianceTexture=this._irradianceTexture);var t,i=this._engine.getLoadedTexturesCache();-1!==(t=i.indexOf(this))&&i.splice(t,1),-1===(t=i.indexOf(e))&&i.push(e)},e.prototype.dispose=function(){this._webGLTexture&&(this._references--,0===this._references&&(this._engine._releaseTexture(this),this._webGLTexture=null))},e._UpdateRGBDAsync=function(e,t,i,n,r){throw s.f.WarnImport("environmentTextureTools")},e}()},7533:(e,t,i)=>{"use strict";i.d(t,{L:()=>n});var n=function(){}},5082:(e,t,i)=>{"use strict";i.d(t,{_:()=>u});var n=i(655),r=i(475),o=i(5540),s=i(2973),a=i(4283),l=i(4761),h=i(7555),c=(i(6593),i(1744),i(2905)),u=function(e){function t(t,i,n,o,l,c,u,f,d,p,_,g,m){void 0===l&&(l=!0),void 0===c&&(c=0),void 0===u&&(u=!1),void 0===f&&(f=a.x.TRILINEAR_SAMPLINGMODE),void 0===d&&(d=!0),void 0===p&&(p=!1),void 0===_&&(_=!1),void 0===g&&(g=5),void 0===m&&(m=!1);var v=e.call(this,null,n,!o)||this;return v.renderParticles=!0,v.renderSprites=!1,v.ignoreCameraViewport=!1,v.onBeforeBindObservable=new r.y$,v.onAfterUnbindObservable=new r.y$,v.onBeforeRenderObservable=new r.y$,v.onAfterRenderObservable=new r.y$,v.onClearObservable=new r.y$,v.onResizeObservable=new r.y$,v._currentRefreshId=-1,v._refreshRate=1,v._samples=1,v.boundingBoxPosition=s.P.Zero(),(n=v.getScene())?(v._coordinatesMode=a.x.PROJECTION_MODE,v.renderList=new Array,v.name=t,v.isRenderTarget=!0,v._initialSizeParameter=i,v._processSizeParameter(i),v._resizeObserver=v.getScene().getEngine().onResizeObservable.add((function(){})),v._generateMipMaps=!!o,v._doNotChangeAspectRatio=l,v._renderingManager=new h.$(n),v._renderingManager._useSceneAutoClearSetup=!0,_||(v._renderTargetOptions={generateMipMaps:o,type:c,format:g,samplingMode:f,generateDepthBuffer:d,generateStencilBuffer:p},f===a.x.NEAREST_SAMPLINGMODE&&(v.wrapU=a.x.CLAMP_ADDRESSMODE,v.wrapV=a.x.CLAMP_ADDRESSMODE),m||(u?(v._texture=n.getEngine().createRenderTargetCubeTexture(v.getRenderSize(),v._renderTargetOptions),v.coordinatesMode=a.x.INVCUBIC_MODE,v._textureMatrix=s.y3.Identity()):v._texture=n.getEngine().createRenderTargetTexture(v._size,v._renderTargetOptions))),v):v}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"renderList",{get:function(){return this._renderList},set:function(e){this._renderList=e,this._renderList&&this._hookArray(this._renderList)},enumerable:!1,configurable:!0}),t.prototype._hookArray=function(e){var t=this,i=e.push;e.push=function(){for(var n=[],r=0;r0&&(this._postProcesses[0].autoClear=!1))}},t.prototype._shouldRender=function(){return-1===this._currentRefreshId||this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,!0):(this._currentRefreshId++,!1)},t.prototype.getRenderSize=function(){return this.getRenderWidth()},t.prototype.getRenderWidth=function(){return this._size.width?this._size.width:this._size},t.prototype.getRenderHeight=function(){return this._size.width?this._size.height:this._size},t.prototype.getRenderLayers=function(){var e=this._size.layers;return e||0},Object.defineProperty(t.prototype,"canRescale",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.scale=function(e){var t=Math.max(1,this.getRenderSize()*e);this.resize(t)},t.prototype.getReflectionTextureMatrix=function(){return this.isCube?this._textureMatrix:e.prototype.getReflectionTextureMatrix.call(this)},t.prototype.resize=function(e){var t=this.isCube;this.releaseInternalTexture();var i=this.getScene();i&&(this._processSizeParameter(e),this._texture=t?i.getEngine().createRenderTargetCubeTexture(this.getRenderSize(),this._renderTargetOptions):i.getEngine().createRenderTargetTexture(this._size,this._renderTargetOptions),this.onResizeObservable.hasObservers()&&this.onResizeObservable.notifyObservers(this))},t.prototype.render=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!1),a=this.getScene()){var i,n=a.getEngine();if(void 0!==this.useCameraPostProcesses&&(e=this.useCameraPostProcesses),this._waitingRenderList){this.renderList=[];for(var r=0;r1||this.activeCamera&&this.activeCamera!==a.activeCamera)&&a.setTransformMatrix(a.activeCamera.getViewMatrix(),a.activeCamera.getProjectionMatrix(!0)),n.setViewport(a.activeCamera.viewport)),a.resetCachedMaterial()}},t.prototype._bestReflectionRenderTargetDimension=function(e,t){var i=e*t,n=c.Engine.NearestPOT(i+16384/(128+i));return Math.min(c.Engine.FloorPOT(e),n)},t.prototype._prepareRenderingManager=function(e,t,i,n){var r=this.getScene();if(r){this._renderingManager.reset();for(var o=r.getRenderId(),s=0;s=0&&this._renderingManager.dispatchParticles(d))}}},t.prototype._bindFrameBuffer=function(e,t){void 0===e&&(e=0),void 0===t&&(t=0);var i=this.getScene();if(i){var n=i.getEngine();this._texture&&n.bindFramebuffer(this._texture,this.isCube?e:void 0,void 0,void 0,this.ignoreCameraViewport,0,t)}},t.prototype.unbindFrameBuffer=function(e,t){var i=this;this._texture&&e.unBindFramebuffer(this._texture,this.isCube,(function(){i.onAfterRenderObservable.notifyObservers(t)}))},t.prototype.renderToTarget=function(e,t,i,n,r){void 0===n&&(n=0),void 0===r&&(r=null);var s=this.getScene();if(s){var a=s.getEngine();if(this._texture){this._postProcessManager?this._postProcessManager._prepareFrame(this._texture,this._postProcesses):t&&s.postProcessManager._prepareFrame(this._texture)||this._bindFrameBuffer(e,n),this.is2DArray?this.onBeforeRenderObservable.notifyObservers(n):this.onBeforeRenderObservable.notifyObservers(e);var l=null,h=this.renderList?this.renderList:s.getActiveMeshes().data,c=this.renderList?this.renderList.length:s.getActiveMeshes().length;this.getCustomRenderList&&(l=this.getCustomRenderList(this.is2DArray?n:e,h,c)),l?this._prepareRenderingManager(l,l.length,r,!1):(this._defaultRenderListPrepared||(this._prepareRenderingManager(h,c,r,!this.renderList),this._defaultRenderListPrepared=!0),l=h),this.onClearObservable.hasObservers()?this.onClearObservable.notifyObservers(a):a.clear(this.clearColor||s.clearColor,!0,!0,!0),this._doNotChangeAspectRatio||s.updateTransformMatrix(!0);for(var u=0,f=s._beforeRenderTargetDrawStage;u=0&&t.customRenderTargets.splice(i,1);for(var n=0,r=t.cameras;n=0&&o.customRenderTargets.splice(i,1)}this.depthStencilTexture&&this.getScene().getEngine()._releaseTexture(this.depthStencilTexture),e.prototype.dispose.call(this)}},t.prototype._rebuild=function(){this.refreshRate===t.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=t.REFRESHRATE_RENDER_ONCE),this._postProcessManager&&this._postProcessManager._rebuild()},t.prototype.freeRenderingGroups=function(){this._renderingManager&&this._renderingManager.freeRenderingGroups()},t.prototype.getViewCount=function(){return 1},t.REFRESHRATE_RENDER_ONCE=0,t.REFRESHRATE_RENDER_ONEVERYFRAME=1,t.REFRESHRATE_RENDER_ONEVERYTWOFRAMES=2,t}(a.x);a.x._CreateRenderTargetTexture=function(e,t,i,n){return new u(e,t,i,n)}},4283:(e,t,i)=>{"use strict";i.d(t,{x:()=>_});var n=i(655),r=i(9023),o=i(475),s=i(2973),a=i(4664),l=i(6132),h=i(106),c=i(7549),u=i(6761),f=i(3405),d=i(1373),p=function(){function e(){}return e.GenerateBase64StringFromTexture=function(e,t,i){void 0===t&&(t=0),void 0===i&&(i=0);var n=e.getInternalTexture();if(!n)return null;var r=e.readPixels(t,i);if(!r)return null;var o=e.getSize(),s=o.width,a=o.height;if(r instanceof Float32Array){for(var l=r.byteLength/r.BYTES_PER_ELEMENT,h=new Uint8Array(l);--l>=0;){var c=r[l];c<0?c=0:c>1&&(c=1),h[l]=255*c}r=h}var u=document.createElement("canvas");u.width=s,u.height=a;var f=u.getContext("2d");if(!f)return null;var d=f.createImageData(s,a);if(d.data.set(r),f.putImageData(d,0,0),n.invertY){var p=document.createElement("canvas");p.width=s,p.height=a;var _=p.getContext("2d");return _?(_.translate(0,a),_.scale(1,-1),_.drawImage(u,0,0),p.toDataURL("image/png")):null}return u.toDataURL("image/png")},e}(),_=function(e){function t(i,n,r,s,a,l,h,u,f,d,p,_){void 0===r&&(r=!1),void 0===s&&(s=!0),void 0===a&&(a=t.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=null),void 0===h&&(h=null),void 0===u&&(u=null),void 0===f&&(f=!1);var g=e.call(this,n)||this;g.url=null,g.uOffset=0,g.vOffset=0,g.uScale=1,g.vScale=1,g.uAng=0,g.vAng=0,g.wAng=0,g.uRotationCenter=.5,g.vRotationCenter=.5,g.wRotationCenter=.5,g.homogeneousRotationInUVTransform=!1,g.inspectableCustomProperties=null,g._noMipmap=!1,g._invertY=!1,g._rowGenerationMatrix=null,g._cachedTextureMatrix=null,g._projectionModeMatrix=null,g._t0=null,g._t1=null,g._t2=null,g._cachedUOffset=-1,g._cachedVOffset=-1,g._cachedUScale=0,g._cachedVScale=0,g._cachedUAng=-1,g._cachedVAng=-1,g._cachedWAng=-1,g._cachedProjectionMatrixId=-1,g._cachedURotationCenter=-1,g._cachedVRotationCenter=-1,g._cachedWRotationCenter=-1,g._cachedHomogeneousRotationInUVTransform=!1,g._cachedCoordinatesMode=-1,g._initialSamplingMode=t.BILINEAR_SAMPLINGMODE,g._buffer=null,g._deleteBuffer=!1,g._format=null,g._delayedOnLoad=null,g._delayedOnError=null,g.onLoadObservable=new o.y$,g._isBlocking=!0,g.name=i||"",g.url=i,g._noMipmap=r,g._invertY=s,g._initialSamplingMode=a,g._buffer=u,g._deleteBuffer=f,g._mimeType=p,g._loaderOptions=_,d&&(g._format=d);var m=g.getScene(),v=g._getEngine();if(!v)return g;v.onBeforeTextureInitObservable.notifyObservers(g);var y=function(){g._texture&&(g._texture._invertVScale&&(g.vScale*=-1,g.vOffset+=1),null!==g._texture._cachedWrapU&&(g.wrapU=g._texture._cachedWrapU,g._texture._cachedWrapU=null),null!==g._texture._cachedWrapV&&(g.wrapV=g._texture._cachedWrapV,g._texture._cachedWrapV=null),null!==g._texture._cachedWrapR&&(g.wrapR=g._texture._cachedWrapR,g._texture._cachedWrapR=null)),g.onLoadObservable.hasObservers()&&g.onLoadObservable.notifyObservers(g),l&&l(),!g.isBlocking&&m&&m.resetCachedMaterial()};return g.url?(g._texture=g._getFromCache(g.url,r,a,s),g._texture?g._texture.isReady?c.Q.SetImmediate((function(){return y()})):g._texture.onLoadedObservable.add(y):m&&m.useDelayedTextureLoading?(g.delayLoadState=4,g._delayedOnLoad=y,g._delayedOnError=h):(g._texture=v.createTexture(g.url,r,s,m,a,y,h,g._buffer,void 0,g._format,null,p,_),f&&(g._buffer=null)),g):(g._delayedOnLoad=y,g._delayedOnError=h,g)}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"noMipmap",{get:function(){return this._noMipmap},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mimeType",{get:function(){return this._mimeType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isBlocking",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"samplingMode",{get:function(){return this._texture?this._texture.samplingMode:this._initialSamplingMode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"invertY",{get:function(){return this._invertY},enumerable:!1,configurable:!0}),t.prototype.updateURL=function(e,t,i){void 0===t&&(t=null),this.url&&(this.releaseInternalTexture(),this.getScene().markAllMaterialsAsDirty(1)),this.name&&!d.M.StartsWith(this.name,"data:")||(this.name=e),this.url=e,this._buffer=t,this.delayLoadState=4,i&&(this._delayedOnLoad=i),this.delayLoad()},t.prototype.delayLoad=function(){if(4===this.delayLoadState){var e=this.getScene();e&&(this.delayLoadState=1,this._texture=this._getFromCache(this.url,this._noMipmap,this.samplingMode,this._invertY),this._texture?this._delayedOnLoad&&(this._texture.isReady?c.Q.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(this.url,this._noMipmap,this._invertY,e,this.samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format,null,this._mimeType,this._loaderOptions),this._deleteBuffer&&(this._buffer=null)),this._delayedOnLoad=null,this._delayedOnError=null)}},t.prototype._prepareRowForTextureGeneration=function(e,t,i,n){e*=this._cachedUScale,t*=this._cachedVScale,e-=this.uRotationCenter*this._cachedUScale,t-=this.vRotationCenter*this._cachedVScale,i-=this.wRotationCenter,s.P.TransformCoordinatesFromFloatsToRef(e,t,i,this._rowGenerationMatrix,n),n.x+=this.uRotationCenter*this._cachedUScale+this._cachedUOffset,n.y+=this.vRotationCenter*this._cachedVScale+this._cachedVOffset,n.z+=this.wRotationCenter},t.prototype.checkTransformsAreIdentical=function(e){return null!==e&&this.uOffset===e.uOffset&&this.vOffset===e.vOffset&&this.uScale===e.uScale&&this.vScale===e.vScale&&this.uAng===e.uAng&&this.vAng===e.vAng&&this.wAng===e.wAng},t.prototype.getTextureMatrix=function(e){var t=this;if(void 0===e&&(e=1),this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale*e===this._cachedUScale&&this.vScale===this._cachedVScale&&this.uAng===this._cachedUAng&&this.vAng===this._cachedVAng&&this.wAng===this._cachedWAng&&this.uRotationCenter===this._cachedURotationCenter&&this.vRotationCenter===this._cachedVRotationCenter&&this.wRotationCenter===this._cachedWRotationCenter&&this.homogeneousRotationInUVTransform===this._cachedHomogeneousRotationInUVTransform)return this._cachedTextureMatrix;this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale*e,this._cachedVScale=this.vScale,this._cachedUAng=this.uAng,this._cachedVAng=this.vAng,this._cachedWAng=this.wAng,this._cachedURotationCenter=this.uRotationCenter,this._cachedVRotationCenter=this.vRotationCenter,this._cachedWRotationCenter=this.wRotationCenter,this._cachedHomogeneousRotationInUVTransform=this.homogeneousRotationInUVTransform,this._cachedTextureMatrix&&this._rowGenerationMatrix||(this._cachedTextureMatrix=s.y3.Zero(),this._rowGenerationMatrix=new s.y3,this._t0=s.P.Zero(),this._t1=s.P.Zero(),this._t2=s.P.Zero()),s.y3.RotationYawPitchRollToRef(this.vAng,this.uAng,this.wAng,this._rowGenerationMatrix),this.homogeneousRotationInUVTransform?(s.y3.TranslationToRef(-this._cachedURotationCenter,-this._cachedVRotationCenter,-this._cachedWRotationCenter,s.jp.Matrix[0]),s.y3.TranslationToRef(this._cachedURotationCenter,this._cachedVRotationCenter,this._cachedWRotationCenter,s.jp.Matrix[1]),s.y3.ScalingToRef(this._cachedUScale,this._cachedVScale,0,s.jp.Matrix[2]),s.y3.TranslationToRef(this._cachedUOffset,this._cachedVOffset,0,s.jp.Matrix[3]),s.jp.Matrix[0].multiplyToRef(this._rowGenerationMatrix,this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(s.jp.Matrix[1],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(s.jp.Matrix[2],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(s.jp.Matrix[3],this._cachedTextureMatrix),this._cachedTextureMatrix.setRowFromFloats(2,this._cachedTextureMatrix.m[12],this._cachedTextureMatrix.m[13],this._cachedTextureMatrix.m[14],1)):(this._prepareRowForTextureGeneration(0,0,0,this._t0),this._prepareRowForTextureGeneration(1,0,0,this._t1),this._prepareRowForTextureGeneration(0,1,0,this._t2),this._t1.subtractInPlace(this._t0),this._t2.subtractInPlace(this._t0),s.y3.FromValuesToRef(this._t1.x,this._t1.y,this._t1.z,0,this._t2.x,this._t2.y,this._t2.z,0,this._t0.x,this._t0.y,this._t0.z,0,0,0,0,1,this._cachedTextureMatrix));var i=this.getScene();return i?(i.markAllMaterialsAsDirty(1,(function(e){return e.hasTexture(t)})),this._cachedTextureMatrix):this._cachedTextureMatrix},t.prototype.getReflectionTextureMatrix=function(){var e=this,i=this.getScene();if(!i)return this._cachedTextureMatrix;if(this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale===this._cachedUScale&&this.vScale===this._cachedVScale&&this.coordinatesMode===this._cachedCoordinatesMode){if(this.coordinatesMode!==t.PROJECTION_MODE)return this._cachedTextureMatrix;if(this._cachedProjectionMatrixId===i.getProjectionMatrix().updateFlag)return this._cachedTextureMatrix}switch(this._cachedTextureMatrix||(this._cachedTextureMatrix=s.y3.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=s.y3.Zero()),this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale,this._cachedVScale=this.vScale,this._cachedCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case t.PLANAR_MODE:s.y3.IdentityToRef(this._cachedTextureMatrix),this._cachedTextureMatrix[0]=this.uScale,this._cachedTextureMatrix[5]=this.vScale,this._cachedTextureMatrix[12]=this.uOffset,this._cachedTextureMatrix[13]=this.vOffset;break;case t.PROJECTION_MODE:s.y3.FromValuesToRef(.5,0,0,0,0,-.5,0,0,0,0,0,0,.5,.5,1,1,this._projectionModeMatrix);var n=i.getProjectionMatrix();this._cachedProjectionMatrixId=n.updateFlag,n.multiplyToRef(this._projectionModeMatrix,this._cachedTextureMatrix);break;default:s.y3.IdentityToRef(this._cachedTextureMatrix)}return i.markAllMaterialsAsDirty(1,(function(t){return-1!==t.getActiveTextures().indexOf(e)})),this._cachedTextureMatrix},t.prototype.clone=function(){var e=this;return r.p4.Clone((function(){return new t(e._texture?e._texture.url:null,e.getScene(),e._noMipmap,e._invertY,e.samplingMode,void 0,void 0,e._texture?e._texture._buffer:void 0)}),this)},t.prototype.serialize=function(){var i=this.name;t.SerializeBuffers||d.M.StartsWith(this.name,"data:")&&(this.name=""),d.M.StartsWith(this.name,"data:")&&this.url===this.name&&(this.url="");var n=e.prototype.serialize.call(this);return n?((t.SerializeBuffers||t.ForceSerializeBuffers)&&("string"==typeof this._buffer&&"data:"===this._buffer.substr(0,5)?(n.base64String=this._buffer,n.name=n.name.replace("data:","")):this.url&&d.M.StartsWith(this.url,"data:")&&this._buffer instanceof Uint8Array?n.base64String="data:image/png;base64,"+d.M.EncodeArrayBufferToBase64(this._buffer):t.ForceSerializeBuffers&&(n.base64String=p.GenerateBase64StringFromTexture(this))),n.invertY=this._invertY,n.samplingMode=this.samplingMode,this.name=i,n):null},t.prototype.getClassName=function(){return"Texture"},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null},t.Parse=function(e,i,n){if(e.customType){var o=u.K.Instantiate(e.customType).Parse(e,i,n);return e.samplingMode&&o.updateSamplingMode&&o._samplingMode&&o._samplingMode!==e.samplingMode&&o.updateSamplingMode(e.samplingMode),o}if(e.isCube&&!e.isRenderTarget)return t._CubeTextureParser(e,i,n);if(!e.name&&!e.isRenderTarget)return null;var s=function(){if(a&&a._texture&&(a._texture._cachedWrapU=null,a._texture._cachedWrapV=null,a._texture._cachedWrapR=null),e.samplingMode){var t=e.samplingMode;a&&a.samplingMode!==t&&a.updateSamplingMode(t)}if(a&&e.animations)for(var i=0;i0?e.name:n+e.name,(d.M.StartsWith(e.url,"data:")||t.UseSerializedUrlIfAny&&e.url)&&(u=e.url),r=new t(u,i,!o,e.invertY,void 0,s)}return r}),e,i);return a},t.CreateFromBase64String=function(e,i,n,r,o,s,a,l,h){return void 0===s&&(s=t.TRILINEAR_SAMPLINGMODE),void 0===a&&(a=null),void 0===l&&(l=null),void 0===h&&(h=5),new t("data:"+i,n,r,o,s,a,l,e,!1,h)},t.LoadFromDataString=function(e,i,n,r,o,s,a,l,h,c){return void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===s&&(s=!0),void 0===a&&(a=t.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=null),void 0===h&&(h=null),void 0===c&&(c=5),"data:"!==e.substr(0,5)&&(e="data:"+e),new t(e,n,o,s,a,l,h,i,r,c)},t.SerializeBuffers=!0,t.ForceSerializeBuffers=!1,t._CubeTextureParser=function(e,t,i){throw h.f.WarnImport("CubeTexture")},t._CreateMirror=function(e,t,i,n){throw h.f.WarnImport("MirrorTexture")},t._CreateRenderTargetTexture=function(e,t,i,n){throw h.f.WarnImport("RenderTargetTexture")},t.NEAREST_SAMPLINGMODE=1,t.NEAREST_NEAREST_MIPLINEAR=8,t.BILINEAR_SAMPLINGMODE=2,t.LINEAR_LINEAR_MIPNEAREST=11,t.TRILINEAR_SAMPLINGMODE=3,t.LINEAR_LINEAR_MIPLINEAR=3,t.NEAREST_NEAREST_MIPNEAREST=4,t.NEAREST_LINEAR_MIPNEAREST=5,t.NEAREST_LINEAR_MIPLINEAR=6,t.NEAREST_LINEAR=7,t.NEAREST_NEAREST=1,t.LINEAR_NEAREST_MIPNEAREST=9,t.LINEAR_NEAREST_MIPLINEAR=10,t.LINEAR_LINEAR=2,t.LINEAR_NEAREST=12,t.EXPLICIT_MODE=0,t.SPHERICAL_MODE=1,t.PLANAR_MODE=2,t.CUBIC_MODE=3,t.PROJECTION_MODE=4,t.SKYBOX_MODE=5,t.INVCUBIC_MODE=6,t.EQUIRECTANGULAR_MODE=7,t.FIXED_EQUIRECTANGULAR_MODE=8,t.FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,t.CLAMP_ADDRESSMODE=0,t.WRAP_ADDRESSMODE=1,t.MIRROR_ADDRESSMODE=2,t.UseSerializedUrlIfAny=!1,(0,n.gn)([(0,r.qC)()],t.prototype,"url",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"uOffset",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"vOffset",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"uScale",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"vScale",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"uAng",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"vAng",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"wAng",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"uRotationCenter",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"vRotationCenter",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"wRotationCenter",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"homogeneousRotationInUVTransform",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"isBlocking",null),t}(a.V);l.Q.RegisteredTypes["BABYLON.Texture"]=_,r.p4._TextureParser=_.Parse},7947:(e,t,i)=>{"use strict";i.d(t,{Q:()=>a});var n=i(475),r=i(6327),o=i(3734),s=i(3857),a=function(){function e(t,i,o,a,l,h,c,u,f,d){var p,_=this;void 0===a&&(a=null),void 0===h&&(h=null),void 0===c&&(c=null),void 0===u&&(u=null),void 0===f&&(f=null),this.name=null,this.defines="",this.onCompiled=null,this.onError=null,this.onBind=null,this.uniqueId=0,this.onCompileObservable=new n.y$,this.onErrorObservable=new n.y$,this._onBindObservable=null,this._wasPreviouslyReady=!1,this._bonesComputationForcedToCPU=!1,this._multiTarget=!1,this._uniformBuffersNames={},this._samplers={},this._isReady=!1,this._compilationError="",this._allFallbacksProcessed=!1,this._uniforms={},this._key="",this._fallbacks=null,this._vertexSourceCode="",this._fragmentSourceCode="",this._vertexSourceCodeOverride="",this._fragmentSourceCodeOverride="",this._transformFeedbackVaryings=null,this._rawVertexSourceCode="",this._rawFragmentSourceCode="",this._pipelineContext=null,this._valueCache={},this.name=t;var g,m,v=null;if(i.attributes){var y=i;if(this._engine=o,this._attributesNames=y.attributes,this._uniformsNames=y.uniformsNames.concat(y.samplers),this._samplerList=y.samplers.slice(),this.defines=y.defines,this.onError=y.onError,this.onCompiled=y.onCompiled,this._fallbacks=y.fallbacks,this._indexParameters=y.indexParameters,this._transformFeedbackVaryings=y.transformFeedbackVaryings||null,this._multiTarget=!!y.multiTarget,y.uniformBuffersNames){this._uniformBuffersNamesList=y.uniformBuffersNames.slice();for(var b=0;b=2?"WEBGL2":"WEBGL1"};this._loadShader(g,"Vertex","",(function(e){_._rawVertexSourceCode=e,_._loadShader(m,"Fragment","Pixel",(function(i){_._rawFragmentSourceCode=i,s.L.Process(e,A,(function(e){v&&(e=v("vertex",e)),A.isFragment=!0,s.L.Process(i,A,(function(i){v&&(i=v("fragment",i)),_._useFinalCode(e,i,t)}),_._engine)}),_._engine)}))}))}return Object.defineProperty(e.prototype,"onBindObservable",{get:function(){return this._onBindObservable||(this._onBindObservable=new n.y$),this._onBindObservable},enumerable:!1,configurable:!0}),e.prototype._useFinalCode=function(e,t,i){if(i){var n=i.vertexElement||i.vertex||i.spectorName||i,r=i.fragmentElement||i.fragment||i.spectorName||i;this._vertexSourceCode="#define SHADER_NAME vertex:"+n+"\n"+e,this._fragmentSourceCode="#define SHADER_NAME fragment:"+r+"\n"+t}else this._vertexSourceCode=e,this._fragmentSourceCode=t;this._prepareEffect()},Object.defineProperty(e.prototype,"key",{get:function(){return this._key},enumerable:!1,configurable:!0}),e.prototype.isReady=function(){try{return this._isReadyInternal()}catch(e){return!1}},e.prototype._isReadyInternal=function(){return!!this._isReady||!!this._pipelineContext&&this._pipelineContext.isReady},e.prototype.getEngine=function(){return this._engine},e.prototype.getPipelineContext=function(){return this._pipelineContext},e.prototype.getAttributesNames=function(){return this._attributesNames},e.prototype.getAttributeLocation=function(e){return this._attributes[e]},e.prototype.getAttributeLocationByName=function(e){return this._attributeLocationByName[e]},e.prototype.getAttributesCount=function(){return this._attributes.length},e.prototype.getUniformIndex=function(e){return this._uniformsNames.indexOf(e)},e.prototype.getUniform=function(e){return this._uniforms[e]},e.prototype.getSamplers=function(){return this._samplerList},e.prototype.getUniformNames=function(){return this._uniformsNames},e.prototype.getUniformBuffersNames=function(){return this._uniformBuffersNamesList},e.prototype.getIndexParameters=function(){return this._indexParameters},e.prototype.getCompilationError=function(){return this._compilationError},e.prototype.allFallbacksProcessed=function(){return this._allFallbacksProcessed},e.prototype.executeWhenCompiled=function(e){var t=this;this.isReady()?e(this):(this.onCompileObservable.add((function(t){e(t)})),this._pipelineContext&&!this._pipelineContext.isAsync||setTimeout((function(){t._checkIsReady(null)}),16))},e.prototype._checkIsReady=function(e){var t=this;try{if(this._isReadyInternal())return}catch(t){return void this._processCompilationErrors(t,e)}setTimeout((function(){t._checkIsReady(e)}),16)},e.prototype._loadShader=function(t,i,n,o){var s;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return void o(r.M.GetDOMTextContent(t));"source:"!==t.substr(0,7)?"base64:"!==t.substr(0,7)?e.ShadersStore[t+i+"Shader"]?o(e.ShadersStore[t+i+"Shader"]):n&&e.ShadersStore[t+n+"Shader"]?o(e.ShadersStore[t+n+"Shader"]):(s="."===t[0]||"/"===t[0]||t.indexOf("http")>-1?t:e.ShadersRepository+t,this._engine._loadFile(s+"."+i.toLowerCase()+".fx",o)):o(window.atob(t.substr(7))):o(t.substr(7))},Object.defineProperty(e.prototype,"vertexSourceCode",{get:function(){return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._vertexSourceCodeOverride:this._vertexSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fragmentSourceCode",{get:function(){return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._fragmentSourceCodeOverride:this._fragmentSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rawVertexSourceCode",{get:function(){return this._rawVertexSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rawFragmentSourceCode",{get:function(){return this._rawFragmentSourceCode},enumerable:!1,configurable:!0}),e.prototype._rebuildProgram=function(e,t,i,n){var r=this;this._isReady=!1,this._vertexSourceCodeOverride=e,this._fragmentSourceCodeOverride=t,this.onError=function(e,t){n&&n(t)},this.onCompiled=function(){var e=r.getEngine().scenes;if(e)for(var t=0;t=s&&(r="Offending line ["+s+"] in "+(i?"fragment":"vertex")+" code: "+a[s-1])}}return[e,r]},e.prototype._processCompilationErrors=function(t,i){var n,r,s,a,l;void 0===i&&(i=null),this._compilationError=t.message;var h=this._attributesNames,c=this._fallbacks;if(o.Y.Error("Unable to compile effect:"),o.Y.Error("Uniforms: "+this._uniformsNames.map((function(e){return" "+e}))),o.Y.Error("Attributes: "+h.map((function(e){return" "+e}))),o.Y.Error("Defines:\r\n"+this.defines),e.LogShaderCodeOnCompilationError){var u=null,f=null,d=null;(null===(s=this._pipelineContext)||void 0===s?void 0:s._getVertexShaderCode())&&(d=(n=this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(),this._compilationError,!1))[0],u=n[1],d&&(o.Y.Error("Vertex code:"),o.Y.Error(d))),(null===(a=this._pipelineContext)||void 0===a?void 0:a._getFragmentShaderCode())&&(d=(r=this._getShaderCodeAndErrorLine(null===(l=this._pipelineContext)||void 0===l?void 0:l._getFragmentShaderCode(),this._compilationError,!0))[0],f=r[1],d&&(o.Y.Error("Fragment code:"),o.Y.Error(d))),u&&o.Y.Error(u),f&&o.Y.Error(f)}o.Y.Error("Error: "+this._compilationError),i&&(this._pipelineContext=i,this._isReady=!0,this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this)),c?(this._pipelineContext=null,c.hasMoreFallbacks?(this._allFallbacksProcessed=!1,o.Y.Error("Trying next fallback."),this.defines=c.reduce(this.defines,this),this._prepareEffect()):(this._allFallbacksProcessed=!0,this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this),this.onErrorObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh())):this._allFallbacksProcessed=!0},Object.defineProperty(e.prototype,"isSupported",{get:function(){return""===this._compilationError},enumerable:!1,configurable:!0}),e.prototype._bindTexture=function(e,t){this._engine._bindTexture(this._samplers[e],t)},e.prototype.setTexture=function(e,t){this._engine.setTexture(this._samplers[e],this._uniforms[e],t)},e.prototype.setDepthStencilTexture=function(e,t){this._engine.setDepthStencilTexture(this._samplers[e],this._uniforms[e],t)},e.prototype.setTextureArray=function(e,t){var i=e+"Ex";if(-1===this._samplerList.indexOf(i+"0")){for(var n=this._samplerList.indexOf(e),r=1;r{"use strict";i.d(t,{L:()=>n});var n=function(){function e(){this._defines={},this._currentRank=32,this._maxRank=-1,this._mesh=null}return e.prototype.unBindMesh=function(){this._mesh=null},e.prototype.addFallback=function(e,t){this._defines[e]||(ethis._maxRank&&(this._maxRank=e),this._defines[e]=new Array),this._defines[e].push(t)},e.prototype.addCPUSkinningFallback=function(e,t){this._mesh=t,ethis._maxRank&&(this._maxRank=e)},Object.defineProperty(e.prototype,"hasMoreFallbacks",{get:function(){return this._currentRank<=this._maxRank},enumerable:!1,configurable:!0}),e.prototype.reduce=function(e,t){if(this._mesh&&this._mesh.computeBonesUsingShaders&&this._mesh.numBoneInfluencers>0){this._mesh.computeBonesUsingShaders=!1,e=e.replace("#define NUM_BONE_INFLUENCERS "+this._mesh.numBoneInfluencers,"#define NUM_BONE_INFLUENCERS 0"),t._bonesComputationForcedToCPU=!0;for(var i=this._mesh.getScene(),n=0;n0&&(r.computeBonesUsingShaders=!1)}}else{var a=this._defines[this._currentRank];if(a)for(n=0;n{"use strict";i.d(t,{$:()=>c});var n=i(655),r=i(9023),o=i(475),s=i(5540),a=i(8362),l=i(1345),h=function(){function e(){this._dirty=!0,this._tempColor=new a.HE(0,0,0,0),this._globalCurve=new a.HE(0,0,0,0),this._highlightsCurve=new a.HE(0,0,0,0),this._midtonesCurve=new a.HE(0,0,0,0),this._shadowsCurve=new a.HE(0,0,0,0),this._positiveCurve=new a.HE(0,0,0,0),this._negativeCurve=new a.HE(0,0,0,0),this._globalHue=30,this._globalDensity=0,this._globalSaturation=0,this._globalExposure=0,this._highlightsHue=30,this._highlightsDensity=0,this._highlightsSaturation=0,this._highlightsExposure=0,this._midtonesHue=30,this._midtonesDensity=0,this._midtonesSaturation=0,this._midtonesExposure=0,this._shadowsHue=30,this._shadowsDensity=0,this._shadowsSaturation=0,this._shadowsExposure=0}return Object.defineProperty(e.prototype,"globalHue",{get:function(){return this._globalHue},set:function(e){this._globalHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalDensity",{get:function(){return this._globalDensity},set:function(e){this._globalDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalSaturation",{get:function(){return this._globalSaturation},set:function(e){this._globalSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalExposure",{get:function(){return this._globalExposure},set:function(e){this._globalExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightsHue",{get:function(){return this._highlightsHue},set:function(e){this._highlightsHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightsDensity",{get:function(){return this._highlightsDensity},set:function(e){this._highlightsDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightsSaturation",{get:function(){return this._highlightsSaturation},set:function(e){this._highlightsSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightsExposure",{get:function(){return this._highlightsExposure},set:function(e){this._highlightsExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midtonesHue",{get:function(){return this._midtonesHue},set:function(e){this._midtonesHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midtonesDensity",{get:function(){return this._midtonesDensity},set:function(e){this._midtonesDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midtonesSaturation",{get:function(){return this._midtonesSaturation},set:function(e){this._midtonesSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midtonesExposure",{get:function(){return this._midtonesExposure},set:function(e){this._midtonesExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowsHue",{get:function(){return this._shadowsHue},set:function(e){this._shadowsHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowsDensity",{get:function(){return this._shadowsDensity},set:function(e){this._shadowsDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowsSaturation",{get:function(){return this._shadowsSaturation},set:function(e){this._shadowsSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowsExposure",{get:function(){return this._shadowsExposure},set:function(e){this._shadowsExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"ColorCurves"},e.Bind=function(e,t,i,n,r){void 0===i&&(i="vCameraColorCurvePositive"),void 0===n&&(n="vCameraColorCurveNeutral"),void 0===r&&(r="vCameraColorCurveNegative"),e._dirty&&(e._dirty=!1,e.getColorGradingDataToRef(e._globalHue,e._globalDensity,e._globalSaturation,e._globalExposure,e._globalCurve),e.getColorGradingDataToRef(e._highlightsHue,e._highlightsDensity,e._highlightsSaturation,e._highlightsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._highlightsCurve),e.getColorGradingDataToRef(e._midtonesHue,e._midtonesDensity,e._midtonesSaturation,e._midtonesExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._midtonesCurve),e.getColorGradingDataToRef(e._shadowsHue,e._shadowsDensity,e._shadowsSaturation,e._shadowsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._shadowsCurve),e._highlightsCurve.subtractToRef(e._midtonesCurve,e._positiveCurve),e._midtonesCurve.subtractToRef(e._shadowsCurve,e._negativeCurve)),t&&(t.setFloat4(i,e._positiveCurve.r,e._positiveCurve.g,e._positiveCurve.b,e._positiveCurve.a),t.setFloat4(n,e._midtonesCurve.r,e._midtonesCurve.g,e._midtonesCurve.b,e._midtonesCurve.a),t.setFloat4(r,e._negativeCurve.r,e._negativeCurve.g,e._negativeCurve.b,e._negativeCurve.a))},e.PrepareUniforms=function(e){e.push("vCameraColorCurveNeutral","vCameraColorCurvePositive","vCameraColorCurveNegative")},e.prototype.getColorGradingDataToRef=function(t,i,n,r,o){null!=t&&(t=e.clamp(t,0,360),i=e.clamp(i,-100,100),n=e.clamp(n,-100,100),r=e.clamp(r,-100,100),i=e.applyColorGradingSliderNonlinear(i),i*=.5,r=e.applyColorGradingSliderNonlinear(r),i<0&&(i*=-1,t=(t+180)%360),e.fromHSBToRef(t,i,50+.25*r,o),o.scaleToRef(2,o),o.a=1+.01*n)},e.applyColorGradingSliderNonlinear=function(e){e/=100;var t=Math.abs(e);return t=Math.pow(t,2),e<0&&(t*=-1),t*=100},e.fromHSBToRef=function(t,i,n,r){var o=e.clamp(t,0,360),s=e.clamp(i/100,0,1),a=e.clamp(n/100,0,1);if(0===s)r.r=a,r.g=a,r.b=a;else{o/=60;var l=Math.floor(o),h=o-l,c=a*(1-s),u=a*(1-s*h),f=a*(1-s*(1-h));switch(l){case 0:r.r=a,r.g=f,r.b=c;break;case 1:r.r=u,r.g=a,r.b=c;break;case 2:r.r=c,r.g=a,r.b=f;break;case 3:r.r=c,r.g=u,r.b=a;break;case 4:r.r=f,r.g=c,r.b=a;break;default:r.r=a,r.g=c,r.b=u}}r.a=1},e.clamp=function(e,t,i){return Math.min(Math.max(e,t),i)},e.prototype.clone=function(){return r.p4.Clone((function(){return new e}),this)},e.prototype.serialize=function(){return r.p4.Serialize(this)},e.Parse=function(t){return r.p4.Parse((function(){return new e}),t,null,null)},(0,n.gn)([(0,r.qC)()],e.prototype,"_globalHue",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_globalDensity",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_globalSaturation",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_globalExposure",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_highlightsHue",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_highlightsDensity",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_highlightsSaturation",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_highlightsExposure",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_midtonesHue",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_midtonesDensity",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_midtonesSaturation",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_midtonesExposure",void 0),e}();r.p4._ColorCurvesParser=h.Parse;!function(e){function t(){var t=e.call(this)||this;return t.IMAGEPROCESSING=!1,t.VIGNETTE=!1,t.VIGNETTEBLENDMODEMULTIPLY=!1,t.VIGNETTEBLENDMODEOPAQUE=!1,t.TONEMAPPING=!1,t.TONEMAPPING_ACES=!1,t.CONTRAST=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=!1,t.SAMPLER3DBGRMAP=!1,t.IMAGEPROCESSINGPOSTPROCESS=!1,t.EXPOSURE=!1,t.rebuild(),t}(0,n.ZT)(t,e)}(l.H);var c=function(){function e(){this.colorCurves=new h,this._colorCurvesEnabled=!1,this._colorGradingEnabled=!1,this._colorGradingWithGreenDepth=!0,this._colorGradingBGR=!0,this._exposure=1,this._toneMappingEnabled=!1,this._toneMappingType=e.TONEMAPPING_STANDARD,this._contrast=1,this.vignetteStretch=0,this.vignetteCentreX=0,this.vignetteCentreY=0,this.vignetteWeight=1.5,this.vignetteColor=new a.HE(0,0,0,0),this.vignetteCameraFov=.5,this._vignetteBlendMode=e.VIGNETTEMODE_MULTIPLY,this._vignetteEnabled=!1,this._applyByPostProcess=!1,this._isEnabled=!0,this.onUpdateParameters=new o.y$}return Object.defineProperty(e.prototype,"colorCurvesEnabled",{get:function(){return this._colorCurvesEnabled},set:function(e){this._colorCurvesEnabled!==e&&(this._colorCurvesEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorGradingTexture",{get:function(){return this._colorGradingTexture},set:function(e){this._colorGradingTexture!==e&&(this._colorGradingTexture=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorGradingEnabled",{get:function(){return this._colorGradingEnabled},set:function(e){this._colorGradingEnabled!==e&&(this._colorGradingEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorGradingWithGreenDepth",{get:function(){return this._colorGradingWithGreenDepth},set:function(e){this._colorGradingWithGreenDepth!==e&&(this._colorGradingWithGreenDepth=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorGradingBGR",{get:function(){return this._colorGradingBGR},set:function(e){this._colorGradingBGR!==e&&(this._colorGradingBGR=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"exposure",{get:function(){return this._exposure},set:function(e){this._exposure!==e&&(this._exposure=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"toneMappingEnabled",{get:function(){return this._toneMappingEnabled},set:function(e){this._toneMappingEnabled!==e&&(this._toneMappingEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"toneMappingType",{get:function(){return this._toneMappingType},set:function(e){this._toneMappingType!==e&&(this._toneMappingType=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contrast",{get:function(){return this._contrast},set:function(e){this._contrast!==e&&(this._contrast=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetteBlendMode",{get:function(){return this._vignetteBlendMode},set:function(e){this._vignetteBlendMode!==e&&(this._vignetteBlendMode=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetteEnabled",{get:function(){return this._vignetteEnabled},set:function(e){this._vignetteEnabled!==e&&(this._vignetteEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"applyByPostProcess",{get:function(){return this._applyByPostProcess},set:function(e){this._applyByPostProcess!==e&&(this._applyByPostProcess=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled!==e&&(this._isEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),e.prototype._updateParameters=function(){this.onUpdateParameters.notifyObservers(this)},e.prototype.getClassName=function(){return"ImageProcessingConfiguration"},e.PrepareUniforms=function(e,t){t.EXPOSURE&&e.push("exposureLinear"),t.CONTRAST&&e.push("contrast"),t.COLORGRADING&&e.push("colorTransformSettings"),t.VIGNETTE&&(e.push("vInverseScreenSize"),e.push("vignetteSettings1"),e.push("vignetteSettings2")),t.COLORCURVES&&h.PrepareUniforms(e)},e.PrepareSamplers=function(e,t){t.COLORGRADING&&e.push("txColorTransform")},e.prototype.prepareDefines=function(t,i){if(void 0===i&&(i=!1),i!==this.applyByPostProcess||!this._isEnabled)return t.VIGNETTE=!1,t.TONEMAPPING=!1,t.TONEMAPPING_ACES=!1,t.CONTRAST=!1,t.EXPOSURE=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.IMAGEPROCESSING=!1,void(t.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess&&this._isEnabled);switch(t.VIGNETTE=this.vignetteEnabled,t.VIGNETTEBLENDMODEMULTIPLY=this.vignetteBlendMode===e._VIGNETTEMODE_MULTIPLY,t.VIGNETTEBLENDMODEOPAQUE=!t.VIGNETTEBLENDMODEMULTIPLY,t.TONEMAPPING=this.toneMappingEnabled,this._toneMappingType){case e.TONEMAPPING_ACES:t.TONEMAPPING_ACES=!0;break;default:t.TONEMAPPING_ACES=!1}t.CONTRAST=1!==this.contrast,t.EXPOSURE=1!==this.exposure,t.COLORCURVES=this.colorCurvesEnabled&&!!this.colorCurves,t.COLORGRADING=this.colorGradingEnabled&&!!this.colorGradingTexture,t.COLORGRADING?t.COLORGRADING3D=this.colorGradingTexture.is3D:t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=this.colorGradingWithGreenDepth,t.SAMPLER3DBGRMAP=this.colorGradingBGR,t.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess,t.IMAGEPROCESSING=t.VIGNETTE||t.TONEMAPPING||t.CONTRAST||t.EXPOSURE||t.COLORCURVES||t.COLORGRADING},e.prototype.isReady=function(){return!this.colorGradingEnabled||!this.colorGradingTexture||this.colorGradingTexture.isReady()},e.prototype.bind=function(e,t){if(this._colorCurvesEnabled&&this.colorCurves&&h.Bind(this.colorCurves,e),this._vignetteEnabled){var i=1/e.getEngine().getRenderWidth(),n=1/e.getEngine().getRenderHeight();e.setFloat2("vInverseScreenSize",i,n);var r=null!=t?t:n/i,o=Math.tan(.5*this.vignetteCameraFov),a=o*r,l=Math.sqrt(a*o);a=s.w1.Mix(a,l,this.vignetteStretch),o=s.w1.Mix(o,l,this.vignetteStretch),e.setFloat4("vignetteSettings1",a,o,-a*this.vignetteCentreX,-o*this.vignetteCentreY);var c=-2*this.vignetteWeight;e.setFloat4("vignetteSettings2",this.vignetteColor.r,this.vignetteColor.g,this.vignetteColor.b,c)}if(e.setFloat("exposureLinear",this.exposure),e.setFloat("contrast",this.contrast),this.colorGradingTexture){e.setTexture("txColorTransform",this.colorGradingTexture);var u=this.colorGradingTexture.getSize().height;e.setFloat4("colorTransformSettings",(u-1)/u,.5/u,u,this.colorGradingTexture.level)}},e.prototype.clone=function(){return r.p4.Clone((function(){return new e}),this)},e.prototype.serialize=function(){return r.p4.Serialize(this)},e.Parse=function(t){return r.p4.Parse((function(){return new e}),t,null,null)},Object.defineProperty(e,"VIGNETTEMODE_MULTIPLY",{get:function(){return this._VIGNETTEMODE_MULTIPLY},enumerable:!1,configurable:!0}),Object.defineProperty(e,"VIGNETTEMODE_OPAQUE",{get:function(){return this._VIGNETTEMODE_OPAQUE},enumerable:!1,configurable:!0}),e.TONEMAPPING_STANDARD=0,e.TONEMAPPING_ACES=1,e._VIGNETTEMODE_MULTIPLY=0,e._VIGNETTEMODE_OPAQUE=1,(0,n.gn)([(0,r.N$)()],e.prototype,"colorCurves",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_colorCurvesEnabled",void 0),(0,n.gn)([(0,r.oU)("colorGradingTexture")],e.prototype,"_colorGradingTexture",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_colorGradingEnabled",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_colorGradingWithGreenDepth",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_colorGradingBGR",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_exposure",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_toneMappingEnabled",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_toneMappingType",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_contrast",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"vignetteStretch",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"vignetteCentreX",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"vignetteCentreY",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"vignetteWeight",void 0),(0,n.gn)([(0,r.XX)()],e.prototype,"vignetteColor",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"vignetteCameraFov",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_vignetteBlendMode",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_vignetteEnabled",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_applyByPostProcess",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_isEnabled",void 0),e}();r.p4._ImageProcessingConfigurationParser=c.Parse},8555:(e,t,i)=>{"use strict";i.d(t,{p:()=>l});var n=i(655),r=i(511),o=i(9023),s=i(5660),a=i(3552),l=function(){function e(e){this._texture=null,this.diffuseBlendLevel=1,this.roughnessBlendLevel=1,this.bumpLevel=1,this._normalBlendMethod=r.F.MATERIAL_NORMALBLENDMETHOD_WHITEOUT,this._isEnabled=!1,this.isEnabled=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t){var i=t.getEngine();return!(e._areTexturesDirty&&t.texturesEnabled&&i.getCaps().standardDerivatives&&this._texture&&s.k.DetailTextureEnabled&&!this._texture.isReady())},e.prototype.prepareDefines=function(e,t){if(this._isEnabled){e.DETAIL_NORMALBLENDMETHOD=this._normalBlendMethod;var i=t.getEngine();e._areTexturesDirty&&(i.getCaps().standardDerivatives&&this._texture&&s.k.DetailTextureEnabled&&this._isEnabled?(a.G.PrepareDefinesForMergedUV(this._texture,e,"DETAIL"),e.DETAIL_NORMALBLENDMETHOD=this._normalBlendMethod):e.DETAIL=!1)}else e.DETAIL=!1},e.prototype.bindForSubMesh=function(e,t,i){this._isEnabled&&(e.useUbo&&i&&e.isSync||this._texture&&s.k.DetailTextureEnabled&&(e.updateFloat4("vDetailInfos",this._texture.coordinatesIndex,this.diffuseBlendLevel,this.bumpLevel,this.roughnessBlendLevel),a.G.BindTextureMatrix(this._texture,e,"detail")),t.texturesEnabled&&this._texture&&s.k.DetailTextureEnabled&&e.setTexture("detailSampler",this._texture))},e.prototype.hasTexture=function(e){return this._texture===e},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)},e.prototype.dispose=function(e){var t;e&&(null===(t=this._texture)||void 0===t||t.dispose())},e.prototype.getClassName=function(){return"DetailMap"},e.AddUniforms=function(e){e.push("vDetailInfos")},e.AddSamplers=function(e){e.push("detailSampler")},e.PrepareUniformBuffer=function(e){e.addUniform("vDetailInfos",4),e.addUniform("detailMatrix",16)},e.prototype.copyTo=function(e){o.p4.Clone((function(){return e}),this)},e.prototype.serialize=function(){return o.p4.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;o.p4.Parse((function(){return n}),e,t,i)},(0,n.gn)([(0,o.oU)("detailTexture"),(0,o.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),(0,n.gn)([(0,o.qC)()],e.prototype,"diffuseBlendLevel",void 0),(0,n.gn)([(0,o.qC)()],e.prototype,"roughnessBlendLevel",void 0),(0,n.gn)([(0,o.qC)()],e.prototype,"bumpLevel",void 0),(0,n.gn)([(0,o.qC)(),(0,o.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"normalBlendMethod",void 0),(0,n.gn)([(0,o.qC)(),(0,o.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),e}()},511:(e,t,i)=>{"use strict";i.d(t,{F:()=>f});var n=i(655),r=i(9023),o=i(5540),s=i(475),a=i(2733),l=i(3335),h=i(356),c=i(3734),u=i(3405),f=function(){function e(t,i,n){this.shadowDepthWrapper=null,this.allowShaderHotSwapping=!0,this.metadata=null,this.reservedDataStore=null,this.checkReadyOnEveryCall=!1,this.checkReadyOnlyOnce=!1,this.state="",this._alpha=1,this._backFaceCulling=!0,this.onCompiled=null,this.onError=null,this.getRenderTargetTextures=null,this.doNotSerialize=!1,this._storeEffectOnSubMeshes=!1,this.animations=null,this.onDisposeObservable=new s.y$,this._onDisposeObserver=null,this._onUnBindObservable=null,this._onBindObserver=null,this._alphaMode=2,this._needDepthPrePass=!1,this.disableDepthWrite=!1,this.disableColorWrite=!1,this.forceDepthWrite=!1,this.depthFunction=0,this.separateCullingPass=!1,this._fogEnabled=!0,this.pointSize=1,this.zOffset=0,this._effect=null,this._useUBO=!1,this._fillMode=e.TriangleFillMode,this._cachedDepthWriteState=!1,this._cachedColorWriteState=!1,this._cachedDepthFunctionState=0,this._indexInSceneMaterialArray=-1,this.meshMap=null,this._forceAlphaTest=!1,this._transparencyMode=null,this.name=t;var r=1;for(this._scene=i||a.l.LastCreatedScene,this.id=t||o.w1.RandomId();this._scene.getMaterialByID(this.id);)this.id=t+" "+r++;this.uniqueId=this._scene.getUniqueId(),this._scene.useRightHandedSystem?this.sideOrientation=e.ClockWiseSideOrientation:this.sideOrientation=e.CounterClockWiseSideOrientation,this._uniformBuffer=new h.M(this._scene.getEngine()),this._useUBO=this.getScene().getEngine().supportsUniformBuffers,n||this._scene.addMaterial(this),this._scene.useMaterialMeshMap&&(this.meshMap={})}return Object.defineProperty(e.prototype,"canRenderToMRT",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha!==t&&(this._alpha=t,this.markAsDirty(e.MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backFaceCulling",{get:function(){return this._backFaceCulling},set:function(t){this._backFaceCulling!==t&&(this._backFaceCulling=t,this.markAsDirty(e.TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRenderTargetTextures",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBindObservable",{get:function(){return this._onBindObservable||(this._onBindObservable=new s.y$),this._onBindObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBind",{set:function(e){this._onBindObserver&&this.onBindObservable.remove(this._onBindObserver),this._onBindObserver=this.onBindObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onUnBindObservable",{get:function(){return this._onUnBindObservable||(this._onUnBindObservable=new s.y$),this._onUnBindObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onEffectCreatedObservable",{get:function(){return this._onEffectCreatedObservable||(this._onEffectCreatedObservable=new s.y$),this._onEffectCreatedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaMode",{get:function(){return this._alphaMode},set:function(t){this._alphaMode!==t&&(this._alphaMode=t,this.markAsDirty(e.TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needDepthPrePass",{get:function(){return this._needDepthPrePass},set:function(e){this._needDepthPrePass!==e&&(this._needDepthPrePass=e,this._needDepthPrePass&&(this.checkReadyOnEveryCall=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fogEnabled",{get:function(){return this._fogEnabled},set:function(t){this._fogEnabled!==t&&(this._fogEnabled=t,this.markAsDirty(e.MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wireframe",{get:function(){switch(this._fillMode){case e.WireFrameFillMode:case e.LineListDrawMode:case e.LineLoopDrawMode:case e.LineStripDrawMode:return!0}return this._scene.forceWireframe},set:function(t){this.fillMode=t?e.WireFrameFillMode:e.TriangleFillMode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pointsCloud",{get:function(){switch(this._fillMode){case e.PointFillMode:case e.PointListDrawMode:return!0}return this._scene.forcePointsCloud},set:function(t){this.fillMode=t?e.PointFillMode:e.TriangleFillMode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fillMode",{get:function(){return this._fillMode},set:function(t){this._fillMode!==t&&(this._fillMode=t,this.markAsDirty(e.MiscDirtyFlag))},enumerable:!1,configurable:!0}),e.prototype.toString=function(e){return"Name: "+this.name},e.prototype.getClassName=function(){return"Material"},Object.defineProperty(e.prototype,"isFrozen",{get:function(){return this.checkReadyOnlyOnce},enumerable:!1,configurable:!0}),e.prototype.freeze=function(){this.markDirty(),this.checkReadyOnlyOnce=!0},e.prototype.unfreeze=function(){this.markDirty(),this.checkReadyOnlyOnce=!1},e.prototype.isReady=function(e,t){return!0},e.prototype.isReadyForSubMesh=function(e,t,i){return!1},e.prototype.getEffect=function(){return this._effect},e.prototype.getScene=function(){return this._scene},Object.defineProperty(e.prototype,"transparencyMode",{get:function(){return this._transparencyMode},set:function(t){this._transparencyMode!==t&&(this._transparencyMode=t,this._forceAlphaTest=t===e.MATERIAL_ALPHATESTANDBLEND,this._markAllSubMeshesAsTexturesAndMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_disableAlphaBlending",{get:function(){return this._transparencyMode===e.MATERIAL_OPAQUE||this._transparencyMode===e.MATERIAL_ALPHATEST},enumerable:!1,configurable:!0}),e.prototype.needAlphaBlending=function(){return!this._disableAlphaBlending&&this.alpha<1},e.prototype.needAlphaBlendingForMesh=function(e){return!(this._disableAlphaBlending&&e.visibility>=1)&&(this.needAlphaBlending()||e.visibility<1||e.hasVertexAlpha)},e.prototype.needAlphaTesting=function(){return!!this._forceAlphaTest},e.prototype._shouldTurnAlphaTestOn=function(e){return!this.needAlphaBlendingForMesh(e)&&this.needAlphaTesting()},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.markDirty=function(){for(var e=0,t=this.getScene().meshes;e{"use strict";i.d(t,{H:()=>n});var n=function(){function e(){this._isDirty=!0,this._areLightsDirty=!0,this._areLightsDisposed=!1,this._areAttributesDirty=!0,this._areTexturesDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._arePrePassDirty=!0,this._areImageProcessingDirty=!0,this._normals=!1,this._uvs=!1,this._needNormals=!1,this._needUVs=!1}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!1,configurable:!0}),e.prototype.markAsProcessed=function(){this._isDirty=!1,this._areAttributesDirty=!1,this._areTexturesDirty=!1,this._areFresnelDirty=!1,this._areLightsDirty=!1,this._areLightsDisposed=!1,this._areMiscDirty=!1,this._arePrePassDirty=!1,this._areImageProcessingDirty=!1},e.prototype.markAsUnprocessed=function(){this._isDirty=!0},e.prototype.markAllAsDirty=function(){this._areTexturesDirty=!0,this._areAttributesDirty=!0,this._areLightsDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._areImageProcessingDirty=!0,this._isDirty=!0},e.prototype.markAsImageProcessingDirty=function(){this._areImageProcessingDirty=!0,this._isDirty=!0},e.prototype.markAsLightDirty=function(e){void 0===e&&(e=!1),this._areLightsDirty=!0,this._areLightsDisposed=this._areLightsDisposed||e,this._isDirty=!0},e.prototype.markAsAttributesDirty=function(){this._areAttributesDirty=!0,this._isDirty=!0},e.prototype.markAsTexturesDirty=function(){this._areTexturesDirty=!0,this._isDirty=!0},e.prototype.markAsFresnelDirty=function(){this._areFresnelDirty=!0,this._isDirty=!0},e.prototype.markAsMiscDirty=function(){this._areMiscDirty=!0,this._isDirty=!0},e.prototype.markAsPrePassDirty=function(){this._arePrePassDirty=!0,this._isDirty=!0},e.prototype.rebuild=function(){this._keys=[];for(var e=0,t=Object.keys(this);e{"use strict";i.d(t,{k:()=>r});var n=i(2905),r=function(){function e(){}return Object.defineProperty(e,"DiffuseTextureEnabled",{get:function(){return this._DiffuseTextureEnabled},set:function(e){this._DiffuseTextureEnabled!==e&&(this._DiffuseTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"DetailTextureEnabled",{get:function(){return this._DetailTextureEnabled},set:function(e){this._DetailTextureEnabled!==e&&(this._DetailTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"AmbientTextureEnabled",{get:function(){return this._AmbientTextureEnabled},set:function(e){this._AmbientTextureEnabled!==e&&(this._AmbientTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"OpacityTextureEnabled",{get:function(){return this._OpacityTextureEnabled},set:function(e){this._OpacityTextureEnabled!==e&&(this._OpacityTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ReflectionTextureEnabled",{get:function(){return this._ReflectionTextureEnabled},set:function(e){this._ReflectionTextureEnabled!==e&&(this._ReflectionTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EmissiveTextureEnabled",{get:function(){return this._EmissiveTextureEnabled},set:function(e){this._EmissiveTextureEnabled!==e&&(this._EmissiveTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"SpecularTextureEnabled",{get:function(){return this._SpecularTextureEnabled},set:function(e){this._SpecularTextureEnabled!==e&&(this._SpecularTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"BumpTextureEnabled",{get:function(){return this._BumpTextureEnabled},set:function(e){this._BumpTextureEnabled!==e&&(this._BumpTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LightmapTextureEnabled",{get:function(){return this._LightmapTextureEnabled},set:function(e){this._LightmapTextureEnabled!==e&&(this._LightmapTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"RefractionTextureEnabled",{get:function(){return this._RefractionTextureEnabled},set:function(e){this._RefractionTextureEnabled!==e&&(this._RefractionTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ColorGradingTextureEnabled",{get:function(){return this._ColorGradingTextureEnabled},set:function(e){this._ColorGradingTextureEnabled!==e&&(this._ColorGradingTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"FresnelEnabled",{get:function(){return this._FresnelEnabled},set:function(e){this._FresnelEnabled!==e&&(this._FresnelEnabled=e,n.Engine.MarkAllMaterialsAsDirty(4))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ClearCoatTextureEnabled",{get:function(){return this._ClearCoatTextureEnabled},set:function(e){this._ClearCoatTextureEnabled!==e&&(this._ClearCoatTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ClearCoatBumpTextureEnabled",{get:function(){return this._ClearCoatBumpTextureEnabled},set:function(e){this._ClearCoatBumpTextureEnabled!==e&&(this._ClearCoatBumpTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ClearCoatTintTextureEnabled",{get:function(){return this._ClearCoatTintTextureEnabled},set:function(e){this._ClearCoatTintTextureEnabled!==e&&(this._ClearCoatTintTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"SheenTextureEnabled",{get:function(){return this._SheenTextureEnabled},set:function(e){this._SheenTextureEnabled!==e&&(this._SheenTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"AnisotropicTextureEnabled",{get:function(){return this._AnisotropicTextureEnabled},set:function(e){this._AnisotropicTextureEnabled!==e&&(this._AnisotropicTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ThicknessTextureEnabled",{get:function(){return this._ThicknessTextureEnabled},set:function(e){this._ThicknessTextureEnabled!==e&&(this._ThicknessTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),e._DiffuseTextureEnabled=!0,e._DetailTextureEnabled=!0,e._AmbientTextureEnabled=!0,e._OpacityTextureEnabled=!0,e._ReflectionTextureEnabled=!0,e._EmissiveTextureEnabled=!0,e._SpecularTextureEnabled=!0,e._BumpTextureEnabled=!0,e._LightmapTextureEnabled=!0,e._RefractionTextureEnabled=!0,e._ColorGradingTextureEnabled=!0,e._FresnelEnabled=!0,e._ClearCoatTextureEnabled=!0,e._ClearCoatBumpTextureEnabled=!0,e._ClearCoatTintTextureEnabled=!0,e._SheenTextureEnabled=!0,e._AnisotropicTextureEnabled=!0,e._ThicknessTextureEnabled=!0,e}()},3552:(e,t,i)=>{"use strict";i.d(t,{G:()=>c});var n=i(3734),r=i(4391),o=i(2733),s=i(6738),a=i(5697),l=i(8362),h=function(){function e(){}return e.BindClipPlane=function(e,t){if(t.clipPlane){var i=t.clipPlane;e.setFloat4("vClipPlane",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane2){i=t.clipPlane2;e.setFloat4("vClipPlane2",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane3){i=t.clipPlane3;e.setFloat4("vClipPlane3",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane4){i=t.clipPlane4;e.setFloat4("vClipPlane4",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane5){i=t.clipPlane5;e.setFloat4("vClipPlane5",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane6){i=t.clipPlane6;e.setFloat4("vClipPlane6",i.normal.x,i.normal.y,i.normal.z,i.d)}},e}(),c=function(){function e(){}return e.BindEyePosition=function(e,t,i){if(void 0===i&&(i="vEyePosition"),t._forcedViewPosition)e.setVector3(i,t._forcedViewPosition);else{var n=t.activeCamera.globalPosition;n||(n=t.activeCamera.devicePosition),e.setVector3(i,t._mirroredCameraPosition?t._mirroredCameraPosition:n)}},e.PrepareDefinesForMergedUV=function(e,t,i){t._needUVs=!0,t[i]=!0,e.getTextureMatrix().isIdentityAs3x2()?(t[i+"DIRECTUV"]=e.coordinatesIndex+1,0===e.coordinatesIndex?t.MAINUV1=!0:t.MAINUV2=!0):t[i+"DIRECTUV"]=0},e.BindTextureMatrix=function(e,t,i){var n=e.getTextureMatrix();t.updateMatrix(i+"Matrix",n)},e.GetFogState=function(e,t){return t.fogEnabled&&e.applyFog&&t.fogMode!==r.Scene.FOGMODE_NONE},e.PrepareDefinesForMisc=function(e,t,i,n,r,o,s){s._areMiscDirty&&(s.LOGARITHMICDEPTH=i,s.POINTSIZE=n,s.FOG=r&&this.GetFogState(e,t),s.NONUNIFORMSCALING=e.nonUniformScaling,s.ALPHATEST=o)},e.PrepareDefinesForFrameBoundValues=function(e,t,i,n,r,o){void 0===r&&(r=null),void 0===o&&(o=!1);var s,a,l,h,c,u,f=!1;s=null==r?void 0!==e.clipPlane&&null!==e.clipPlane:r,a=null==r?void 0!==e.clipPlane2&&null!==e.clipPlane2:r,l=null==r?void 0!==e.clipPlane3&&null!==e.clipPlane3:r,h=null==r?void 0!==e.clipPlane4&&null!==e.clipPlane4:r,c=null==r?void 0!==e.clipPlane5&&null!==e.clipPlane5:r,u=null==r?void 0!==e.clipPlane6&&null!==e.clipPlane6:r,i.CLIPPLANE!==s&&(i.CLIPPLANE=s,f=!0),i.CLIPPLANE2!==a&&(i.CLIPPLANE2=a,f=!0),i.CLIPPLANE3!==l&&(i.CLIPPLANE3=l,f=!0),i.CLIPPLANE4!==h&&(i.CLIPPLANE4=h,f=!0),i.CLIPPLANE5!==c&&(i.CLIPPLANE5=c,f=!0),i.CLIPPLANE6!==u&&(i.CLIPPLANE6=u,f=!0),i.DEPTHPREPASS!==!t.getColorWrite()&&(i.DEPTHPREPASS=!i.DEPTHPREPASS,f=!0),i.INSTANCES!==n&&(i.INSTANCES=n,f=!0),i.THIN_INSTANCES!==o&&(i.THIN_INSTANCES=o,f=!0),f&&i.markAsUnprocessed()},e.PrepareDefinesForBones=function(e,t){if(e.useBones&&e.computeBonesUsingShaders&&e.skeleton){t.NUM_BONE_INFLUENCERS=e.numBoneInfluencers;var i=void 0!==t.BONETEXTURE;if(e.skeleton.isUsingTextureForMatrices&&i)t.BONETEXTURE=!0;else{t.BonesPerMesh=e.skeleton.bones.length+1,t.BONETEXTURE=!i&&void 0;var n=e.getScene().prePassRenderer;if(n&&n.enabled){var r=-1===n.excludedSkinnedMesh.indexOf(e);t.BONES_VELOCITY_ENABLED=r}}}else t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0},e.PrepareDefinesForMorphTargets=function(e,t){var i=e.morphTargetManager;i?(t.MORPHTARGETS_UV=i.supportsUVs&&t.UV1,t.MORPHTARGETS_TANGENT=i.supportsTangents&&t.TANGENT,t.MORPHTARGETS_NORMAL=i.supportsNormals&&t.NORMAL,t.MORPHTARGETS=i.numInfluencers>0,t.NUM_MORPH_INFLUENCERS=i.numInfluencers):(t.MORPHTARGETS_UV=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS=!1,t.NUM_MORPH_INFLUENCERS=0)},e.PrepareDefinesForAttributes=function(e,t,i,n,r,o){if(void 0===r&&(r=!1),void 0===o&&(o=!0),!t._areAttributesDirty&&t._needNormals===t._normals&&t._needUVs===t._uvs)return!1;if(t._normals=t._needNormals,t._uvs=t._needUVs,t.NORMAL=t._needNormals&&e.isVerticesDataPresent(s.o.NormalKind),t._needNormals&&e.isVerticesDataPresent(s.o.TangentKind)&&(t.TANGENT=!0),t._needUVs?(t.UV1=e.isVerticesDataPresent(s.o.UVKind),t.UV2=e.isVerticesDataPresent(s.o.UV2Kind)):(t.UV1=!1,t.UV2=!1),i){var a=e.useVertexColors&&e.isVerticesDataPresent(s.o.ColorKind);t.VERTEXCOLOR=a,t.VERTEXALPHA=e.hasVertexAlpha&&a&&o}return n&&this.PrepareDefinesForBones(e,t),r&&this.PrepareDefinesForMorphTargets(e,t),!0},e.PrepareDefinesForMultiview=function(e,t){if(e.activeCamera){var i=t.MULTIVIEW;t.MULTIVIEW=null!==e.activeCamera.outputRenderTarget&&e.activeCamera.outputRenderTarget.getViewCount()>1,t.MULTIVIEW!=i&&t.markAsUnprocessed()}},e.PrepareDefinesForPrePass=function(e,t,i){var n=t.PREPASS;if(t._arePrePassDirty){var r=[{type:1,define:"PREPASS_POSITION",index:"PREPASS_POSITION_INDEX"},{type:2,define:"PREPASS_VELOCITY",index:"PREPASS_VELOCITY_INDEX"},{type:3,define:"PREPASS_REFLECTIVITY",index:"PREPASS_REFLECTIVITY_INDEX"},{type:0,define:"PREPASS_IRRADIANCE",index:"PREPASS_IRRADIANCE_INDEX"},{type:6,define:"PREPASS_ALBEDO",index:"PREPASS_ALBEDO_INDEX"},{type:5,define:"PREPASS_DEPTHNORMAL",index:"PREPASS_DEPTHNORMAL_INDEX"}];if(e.prePassRenderer&&e.prePassRenderer.enabled&&i){t.PREPASS=!0,t.SCENE_MRT_COUNT=e.prePassRenderer.mrtCount;for(var o=0;o0&&(s.shadowEnabled=!0,l.prepareDefines(r,n))}}i.lightmapMode!=a._.LIGHTMAP_DEFAULT?(s.lightmapMode=!0,r["LIGHTMAPEXCLUDED"+n]=!0,r["LIGHTMAPNOSPECULAR"+n]=i.lightmapMode==a._.LIGHTMAP_SHADOWSONLY):(r["LIGHTMAPEXCLUDED"+n]=!1,r["LIGHTMAPNOSPECULAR"+n]=!1)},e.PrepareDefinesForLights=function(e,t,i,n,r,o){if(void 0===r&&(r=4),void 0===o&&(o=!1),!i._areLightsDirty)return i._needNormals;var s=0,a={needNormals:!1,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};if(e.lightsEnabled&&!o)for(var l=0,h=t.lightSources;l0&&(r=n+o,t.addFallback(r,"LIGHT"+o)),e.SHADOWS||(e["SHADOW"+o]&&t.addFallback(n,"SHADOW"+o),e["SHADOWPCF"+o]&&t.addFallback(n,"SHADOWPCF"+o),e["SHADOWPCSS"+o]&&t.addFallback(n,"SHADOWPCSS"+o),e["SHADOWPOISSON"+o]&&t.addFallback(n,"SHADOWPOISSON"+o),e["SHADOWESM"+o]&&t.addFallback(n,"SHADOWESM"+o),e["SHADOWCLOSEESM"+o]&&t.addFallback(n,"SHADOWCLOSEESM"+o));return r++},e.PrepareAttributesForMorphTargetsInfluencers=function(e,t,i){this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS=i,this.PrepareAttributesForMorphTargets(e,t,this._TmpMorphInfluencers)},e.PrepareAttributesForMorphTargets=function(e,t,i){var r=i.NUM_MORPH_INFLUENCERS;if(r>0&&o.l.LastCreatedEngine)for(var a=o.l.LastCreatedEngine.getCaps().maxVertexAttribs,l=t.morphTargetManager,h=l&&l.supportsNormals&&i.NORMAL,c=l&&l.supportsTangents&&i.TANGENT,u=l&&l.supportsUVs&&i.UV1,f=0;fa&&n.Y.Error("Cannot add more vertex attributes for mesh "+t.name)},e.PrepareAttributesForBones=function(e,t,i,n){i.NUM_BONE_INFLUENCERS>0&&(n.addCPUSkinningFallback(0,t),e.push(s.o.MatricesIndicesKind),e.push(s.o.MatricesWeightsKind),i.NUM_BONE_INFLUENCERS>4&&(e.push(s.o.MatricesIndicesExtraKind),e.push(s.o.MatricesWeightsExtraKind)))},e.PrepareAttributesForInstances=function(e,t){(t.INSTANCES||t.THIN_INSTANCES)&&this.PushAttributesForInstances(e)},e.PushAttributesForInstances=function(e){e.push("world0"),e.push("world1"),e.push("world2"),e.push("world3")},e.BindLightProperties=function(e,t,i){e.transferToEffect(t,i+"")},e.BindLight=function(e,t,i,n,r,o){void 0===o&&(o=!1),e._bindLight(t,i,n,r,o)},e.BindLights=function(e,t,i,n,r,o){void 0===r&&(r=4),void 0===o&&(o=!1);for(var s=Math.min(t.lightSources.length,r),a=0;a-1){var o=r.getTransformMatrixTexture(t);i.setTexture("boneSampler",o),i.setFloat("boneTextureWidth",4*(r.bones.length+1))}else{var s=r.getTransformMatrices(t);s&&(i.setMatrices("mBones",s),n&&t.getScene().prePassRenderer&&t.getScene().prePassRenderer.getIndex(2)&&(n.previousBones[t.uniqueId]&&i.setMatrices("mPreviousBones",n.previousBones[t.uniqueId]),e._CopyBonesTransformationMatrices(s,n.previousBones[t.uniqueId])))}}},e._CopyBonesTransformationMatrices=function(e,t){return t.set(e),t},e.BindMorphTargetParameters=function(e,t){var i=e.morphTargetManager;e&&i&&t.setFloatArray("morphTargetInfluences",i.influences)},e.BindLogDepth=function(e,t,i){e.LOGARITHMICDEPTH&&t.setFloat("logarithmicDepthConstant",2/(Math.log(i.activeCamera.maxZ+1)/Math.LN2))},e.BindClipPlane=function(e,t){h.BindClipPlane(e,t)},e._TmpMorphInfluencers={NUM_MORPH_INFLUENCERS:0},e._tempFogColor=l.Wo.Black(),e}()},9541:(e,t,i)=>{"use strict";i.d(t,{G:()=>a});var n=i(655),r=i(511),o=i(4115),s=i(6132),a=function(e){function t(t,i){var n=e.call(this,t,i,!0)||this;return i.multiMaterials.push(n),n.subMaterials=new Array,n._storeEffectOnSubMeshes=!0,n}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"subMaterials",{get:function(){return this._subMaterials},set:function(e){this._subMaterials=e,this._hookArray(e)},enumerable:!1,configurable:!0}),t.prototype.getChildren=function(){return this.subMaterials},t.prototype._hookArray=function(e){var t=this,i=e.push;e.push=function(){for(var n=[],r=0;r=this.subMaterials.length?this.getScene().defaultMaterial:this.subMaterials[e]},t.prototype.getActiveTextures=function(){var t;return(t=e.prototype.getActiveTextures.call(this)).concat.apply(t,this.subMaterials.map((function(e){return e?e.getActiveTextures():[]})))},t.prototype.hasTexture=function(t){var i;if(e.prototype.hasTexture.call(this,t))return!0;for(var n=0;n=0&&r.multiMaterials.splice(o,1),e.prototype.dispose.call(this,t,i)}},t.ParseMultiMaterial=function(e,i){var n=new t(e.name,i);n.id=e.id,o.$&&o.$.AddTagsTo(n,e.tags);for(var r=0;r{"use strict";i.d(t,{o:()=>r});var n=i(2973),r=function(){function e(){this.previousWorldMatrices={},this.previousBones={}}return e.AddUniforms=function(e){e.push("previousWorld","previousViewProjection")},e.AddSamplers=function(e){},e.prototype.bindForSubMesh=function(e,t,i,r,o){t.prePassRenderer&&t.prePassRenderer.enabled&&-1!==t.prePassRenderer.getIndex(2)&&(this.previousWorldMatrices[i.uniqueId]||(this.previousWorldMatrices[i.uniqueId]=n.y3.Identity()),this.previousViewProjection||(this.previousViewProjection=t.getTransformMatrix()),e.setMatrix("previousWorld",this.previousWorldMatrices[i.uniqueId]),e.setMatrix("previousViewProjection",this.previousViewProjection),this.previousWorldMatrices[i.uniqueId]=r.clone(),this.previousViewProjection=t.getTransformMatrix().clone())},e}()},872:(e,t,i)=>{"use strict";i.d(t,{a:()=>o});var n=i(655),r=i(2973),o=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n._normalMatrix=new r.y3,n._storeEffectOnSubMeshes=!0,n}return(0,n.ZT)(t,e),t.prototype.getEffect=function(){return this._activeEffect},t.prototype.isReady=function(e,t){return!!e&&(!e.subMeshes||0===e.subMeshes.length||this.isReadyForSubMesh(e,e.subMeshes[0],t))},t.prototype._isReadyForSubMesh=function(e){var t=e._materialDefines;return!(this.checkReadyOnEveryCall||!e.effect||!t||t._renderId!==this.getScene().getRenderId())},t.prototype.bindOnlyWorldMatrix=function(e){this._activeEffect.setMatrix("world",e)},t.prototype.bindOnlyNormalMatrix=function(e){this._activeEffect.setMatrix("normalMatrix",e)},t.prototype.bind=function(e,t){t&&this.bindForSubMesh(e,t,t.subMeshes[0])},t.prototype._afterBind=function(t,i){void 0===i&&(i=null),e.prototype._afterBind.call(this,t),this.getScene()._cachedEffect=i},t.prototype._mustRebind=function(e,t,i){return void 0===i&&(i=1),e.isCachedMaterialInvalid(this,t,i)},t}(i(511).F)},4730:(e,t,i)=>{"use strict";i.d(t,{j:()=>g});var n=i(655),r=i(9023),o=i(2973),s=i(6738),a=i(4283),l=i(3552),h=i(511),c=i(6132),u=i(8362),f=i(8237),d=i(2840),p=i(2905),_={effect:null,subMesh:null},g=function(e){function t(t,i,r,s){void 0===s&&(s={});var a=e.call(this,t,i)||this;return a._textures={},a._textureArrays={},a._floats={},a._ints={},a._floatsArrays={},a._colors3={},a._colors3Arrays={},a._colors4={},a._colors4Arrays={},a._vectors2={},a._vectors3={},a._vectors4={},a._matrices={},a._matrixArrays={},a._matrices3x3={},a._matrices2x2={},a._vectors2Arrays={},a._vectors3Arrays={},a._vectors4Arrays={},a._cachedWorldViewMatrix=new o.y3,a._cachedWorldViewProjectionMatrix=new o.y3,a._multiview=!1,a._shaderPath=r,a._options=(0,n.pi)({needAlphaBlending:!1,needAlphaTesting:!1,attributes:["position","normal","uv"],uniforms:["worldViewProjection"],uniformBuffers:[],samplers:[],defines:[]},s),a}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"shaderPath",{get:function(){return this._shaderPath},set:function(e){this._shaderPath=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"ShaderMaterial"},t.prototype.needAlphaBlending=function(){return this.alpha<1||this._options.needAlphaBlending},t.prototype.needAlphaTesting=function(){return this._options.needAlphaTesting},t.prototype._checkUniform=function(e){-1===this._options.uniforms.indexOf(e)&&this._options.uniforms.push(e)},t.prototype.setTexture=function(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._textures[e]=t,this},t.prototype.setTextureArray=function(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._checkUniform(e),this._textureArrays[e]=t,this},t.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},t.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},t.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},t.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},t.prototype.setColor3Array=function(e,t){return this._checkUniform(e),this._colors3Arrays[e]=t.reduce((function(e,t){return t.toArray(e,e.length),e}),[]),this},t.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},t.prototype.setColor4Array=function(e,t){return this._checkUniform(e),this._colors4Arrays[e]=t.reduce((function(e,t){return t.toArray(e,e.length),e}),[]),this},t.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},t.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this},t.prototype.setVector4=function(e,t){return this._checkUniform(e),this._vectors4[e]=t,this},t.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},t.prototype.setMatrices=function(e,t){this._checkUniform(e);for(var i=new Float32Array(16*t.length),n=0;n1&&(this._multiview=!0,a.push("#define MULTIVIEW"),-1!==this._options.uniforms.indexOf("viewProjection")&&-1===this._options.uniforms.push("viewProjectionR")&&this._options.uniforms.push("viewProjectionR"));for(var u=0;u4&&(h.push(s.o.MatricesIndicesExtraKind),h.push(s.o.MatricesWeightsExtraKind));var p=e.skeleton;d=e.numBoneInfluencers,a.push("#define NUM_BONE_INFLUENCERS "+d),c.addCPUSkinningFallback(0,e),p.isUsingTextureForMatrices?(a.push("#define BONETEXTURE"),-1===this._options.uniforms.indexOf("boneTextureWidth")&&this._options.uniforms.push("boneTextureWidth"),-1===this._options.samplers.indexOf("boneSampler")&&this._options.samplers.push("boneSampler")):(a.push("#define BonesPerMesh "+(p.bones.length+1)),-1===this._options.uniforms.indexOf("mBones")&&this._options.uniforms.push("mBones"))}else a.push("#define NUM_BONE_INFLUENCERS 0");for(var g in this._textures)if(!this._textures[g].isReady())return!1;e&&this._shouldTurnAlphaTestOn(e)&&a.push("#define ALPHATEST");var m=this._shaderPath,v=this._options.uniforms,y=this._options.uniformBuffers,b=this._options.samplers;this.customShaderNameResolve&&(v=v.slice(),y=y.slice(),b=b.slice(),m=this.customShaderNameResolve(m,v,y,b,a,h));var T=this._effect,A=a.join("\n");return this._cachedDefines!==A&&(this._cachedDefines=A,this._effect=o.createEffect(m,{attributes:h,uniformsNames:v,uniformBuffersNames:y,samplers:b,defines:A,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousMorphTargets:d}},o),this._onEffectCreatedObservable&&(_.effect=this._effect,this._onEffectCreatedObservable.notifyObservers(_))),null!==(n=!(null===(i=this._effect)||void 0===i?void 0:i.isReady()))&&void 0!==n&&!n&&(T!==this._effect&&r.resetCachedMaterial(),this._renderId=r.getRenderId(),this._effect._wasPreviouslyReady=!0,!0)},t.prototype.bindOnlyWorldMatrix=function(e,t){var i=this.getScene(),n=null!=t?t:this._effect;n&&(-1!==this._options.uniforms.indexOf("world")&&n.setMatrix("world",e),-1!==this._options.uniforms.indexOf("worldView")&&(e.multiplyToRef(i.getViewMatrix(),this._cachedWorldViewMatrix),n.setMatrix("worldView",this._cachedWorldViewMatrix)),-1!==this._options.uniforms.indexOf("worldViewProjection")&&(e.multiplyToRef(i.getTransformMatrix(),this._cachedWorldViewProjectionMatrix),n.setMatrix("worldViewProjection",this._cachedWorldViewProjectionMatrix)))},t.prototype.bindForSubMesh=function(e,t,i){this.bind(e,t,i._effectOverride)},t.prototype.bind=function(e,t,i){this.bindOnlyWorldMatrix(e,i);var n=null!=i?i:this._effect;if(n&&this.getScene().getCachedMaterial()!==this){var r;for(r in-1!==this._options.uniforms.indexOf("view")&&n.setMatrix("view",this.getScene().getViewMatrix()),-1!==this._options.uniforms.indexOf("projection")&&n.setMatrix("projection",this.getScene().getProjectionMatrix()),-1!==this._options.uniforms.indexOf("viewProjection")&&(n.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._multiview&&n.setMatrix("viewProjectionR",this.getScene()._transformMatrixR)),this.getScene().activeCamera&&-1!==this._options.uniforms.indexOf("cameraPosition")&&n.setVector3("cameraPosition",this.getScene().activeCamera.globalPosition),l.G.BindBonesParameters(t,n),this._textures)n.setTexture(r,this._textures[r]);for(r in this._textureArrays)n.setTextureArray(r,this._textureArrays[r]);for(r in this._ints)n.setInt(r,this._ints[r]);for(r in this._floats)n.setFloat(r,this._floats[r]);for(r in this._floatsArrays)n.setArray(r,this._floatsArrays[r]);for(r in this._colors3)n.setColor3(r,this._colors3[r]);for(r in this._colors3Arrays)n.setArray3(r,this._colors3Arrays[r]);for(r in this._colors4){var o=this._colors4[r];n.setFloat4(r,o.r,o.g,o.b,o.a)}for(r in this._colors4Arrays)n.setArray4(r,this._colors4Arrays[r]);for(r in this._vectors2)n.setVector2(r,this._vectors2[r]);for(r in this._vectors3)n.setVector3(r,this._vectors3[r]);for(r in this._vectors4)n.setVector4(r,this._vectors4[r]);for(r in this._matrices)n.setMatrix(r,this._matrices[r]);for(r in this._matrixArrays)n.setMatrices(r,this._matrixArrays[r]);for(r in this._matrices3x3)n.setMatrix3x3(r,this._matrices3x3[r]);for(r in this._matrices2x2)n.setMatrix2x2(r,this._matrices2x2[r]);for(r in this._vectors2Arrays)n.setArray2(r,this._vectors2Arrays[r]);for(r in this._vectors3Arrays)n.setArray3(r,this._vectors3Arrays[r]);for(r in this._vectors4Arrays)n.setArray4(r,this._vectors4Arrays[r])}var s=this._effect;this._effect=n,this._afterBind(t),this._effect=s},t.prototype._afterBind=function(t){e.prototype._afterBind.call(this,t),this.getScene()._cachedEffect=this._effect},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);for(var i in this._textures)t.push(this._textures[i]);for(var i in this._textureArrays)for(var n=this._textureArrays[i],r=0;r{"use strict";i.r(t),i.d(t,{StandardMaterial:()=>D,StandardMaterialDefines:()=>O});var n=i(655),r=i(9023),o=i(6936),s=i(4391),a=i(2973),l=i(8362),h=i(6738),c=i(9640),u=i(2659),f=i(511),d=i(1345),p=i(872),_=i(3552),g=i(4283),m=i(6132),v=i(5660),y=i(7947),b="uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;\nuniform float visibility;\n\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifndef REFRACTIONMAP_3D\nuniform mat4 refractionMatrix;\n#endif\n#ifdef REFRACTIONFRESNEL\nuniform vec4 refractionLeftColor;\nuniform vec4 refractionRightColor;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\n#endif\n#ifdef DIFFUSEFRESNEL\nuniform vec4 diffuseLeftColor;\nuniform vec4 diffuseRightColor;\n#endif\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;\nuniform vec4 emissiveRightColor;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)\nuniform mat4 reflectionMatrix;\n#endif\n#ifndef REFLECTIONMAP_SKYBOX\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize;\n#endif\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;\nuniform vec4 reflectionRightColor;\n#endif\n#endif";y.Q.IncludesShadersStore.defaultFragmentDeclaration=b;var T="layout(std140,column_major) uniform;\nuniform Material\n{\nvec4 diffuseLeftColor;\nvec4 diffuseRightColor;\nvec4 opacityParts;\nvec4 reflectionLeftColor;\nvec4 reflectionRightColor;\nvec4 refractionLeftColor;\nvec4 refractionRightColor;\nvec4 emissiveLeftColor;\nvec4 emissiveRightColor;\nvec2 vDiffuseInfos;\nvec2 vAmbientInfos;\nvec2 vOpacityInfos;\nvec2 vReflectionInfos;\nvec3 vReflectionPosition;\nvec3 vReflectionSize;\nvec2 vEmissiveInfos;\nvec2 vLightmapInfos;\nvec2 vSpecularInfos;\nvec3 vBumpInfos;\nmat4 diffuseMatrix;\nmat4 ambientMatrix;\nmat4 opacityMatrix;\nmat4 reflectionMatrix;\nmat4 emissiveMatrix;\nmat4 lightmapMatrix;\nmat4 specularMatrix;\nmat4 bumpMatrix;\nvec2 vTangentSpaceParams;\nfloat pointSize;\nmat4 refractionMatrix;\nvec4 vRefractionInfos;\nvec4 vSpecularColor;\nvec3 vEmissiveColor;\nfloat visibility;\nvec4 vDiffuseColor;\nvec4 vDetailInfos;\nmat4 detailMatrix;\n};\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};\n";y.Q.IncludesShadersStore.defaultUboDeclaration=T;i(2213),i(8662),i(8806),i(8644);var A="\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef NDOTL\nfloat ndl;\n#endif\n};\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 lightVectorW;\nfloat attenuation=1.0;\nif (lightData.w == 0.)\n{\nvec3 direction=lightData.xyz-vPositionW;\nattenuation=max(0.,1.0-length(direction)/range);\nlightVectorW=normalize(direction);\n}\nelse\n{\nlightVectorW=normalize(-lightData.xyz);\n}\n\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 direction=lightData.xyz-vPositionW;\nvec3 lightVectorW=normalize(direction);\nfloat attenuation=max(0.,1.0-length(direction)/range);\n\nfloat cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));\nif (cosAngle>=lightDirection.w)\n{\ncosAngle=max(0.,pow(cosAngle,lightData.w));\nattenuation*=cosAngle;\n\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nresult.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;\n}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\nlightingInfo result;\n\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor;\n#endif\nreturn result;\n}\n#define inline\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\nstrq/=strq.w;\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\nreturn textureColor;\n}";y.Q.IncludesShadersStore.lightsFragmentFunctions=A;i(7867);var E="#ifdef FRESNEL\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\n{\nfloat fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);\nreturn clamp(fresnelTerm,0.,1.);\n}\n#endif";y.Q.IncludesShadersStore.fresnelFunction=E;i(2678),i(7176),i(9012),i(3110),i(4711),i(1655),i(8136),i(6733),i(3120),i(9421),i(7236),i(1130),i(8516),i(6635);var C="#include<__decl__defaultFragment>\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#include[SCENE_MRT_COUNT]\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n\n#define RECIPROCAL_PI2 0.15915494\nuniform vec3 vEyePosition;\nuniform vec3 vAmbientColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef DIFFUSE\n#if DIFFUSEDIRECTUV == 1\n#define vDiffuseUV vMainUV1\n#elif DIFFUSEDIRECTUV == 2\n#define vDiffuseUV vMainUV2\n#else\nvarying vec2 vDiffuseUV;\n#endif\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef AMBIENT\n#if AMBIENTDIRECTUV == 1\n#define vAmbientUV vMainUV1\n#elif AMBIENTDIRECTUV == 2\n#define vAmbientUV vMainUV2\n#else\nvarying vec2 vAmbientUV;\n#endif\nuniform sampler2D ambientSampler;\n#endif\n#ifdef OPACITY\n#if OPACITYDIRECTUV == 1\n#define vOpacityUV vMainUV1\n#elif OPACITYDIRECTUV == 2\n#define vOpacityUV vMainUV2\n#else\nvarying vec2 vOpacityUV;\n#endif\nuniform sampler2D opacitySampler;\n#endif\n#ifdef EMISSIVE\n#if EMISSIVEDIRECTUV == 1\n#define vEmissiveUV vMainUV1\n#elif EMISSIVEDIRECTUV == 2\n#define vEmissiveUV vMainUV2\n#else\nvarying vec2 vEmissiveUV;\n#endif\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef LIGHTMAP\n#if LIGHTMAPDIRECTUV == 1\n#define vLightmapUV vMainUV1\n#elif LIGHTMAPDIRECTUV == 2\n#define vLightmapUV vMainUV2\n#else\nvarying vec2 vLightmapUV;\n#endif\nuniform sampler2D lightmapSampler;\n#endif\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\n#if SPECULARDIRECTUV == 1\n#define vSpecularUV vMainUV1\n#elif SPECULARDIRECTUV == 2\n#define vSpecularUV vMainUV2\n#else\nvarying vec2 vSpecularUV;\n#endif\nuniform sampler2D specularSampler;\n#endif\n#ifdef ALPHATEST\nuniform float alphaCutOff;\n#endif\n\n#include\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include\n#endif\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#include\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)\nif (baseColor.a\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef DETAIL\nbaseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\n\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\n\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULAR\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);\nspecularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#else\nfloat glossiness=0.;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;\n#ifdef LIGHTMAP\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor.rgb=fromRGBD(lightmapColor);\n#endif\nlightmapColor.rgb*=vLightmapInfos.y;\n#endif\n#include[0..maxSimultaneousLights]\n\nvec4 refractionColor=vec4(0.,0.,0.,1.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nif (dot(refractionVector,viewDirectionW)<1.0) {\nrefractionColor=textureCube(refractionCubeSampler,refractionVector);\n}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\nrefractionColor=texture2D(refraction2DSampler,refractionCoords);\n#endif\n#ifdef RGBDREFRACTION\nrefractionColor.rgb=fromRGBD(refractionColor);\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor.rgb=toGammaSpace(refractionColor.rgb);\n#endif\nrefractionColor.rgb*=vRefractionInfos.x;\n#endif\n\nvec4 reflectionColor=vec4(0.,0.,0.,1.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;\nreflectionColor=texture2D(reflection2DSampler,coords);\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor.rgb=toGammaSpace(reflectionColor.rgb);\n#endif\nreflectionColor.rgb*=vReflectionInfos.x;\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);\nrefractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n#ifdef ALPHATEST\n#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS\nif (alpha\n#include\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#else\n#ifdef IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\n#endif\ncolor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\n\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\ngl_FragData[0]=color;\n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,1.0);\n#endif\n#ifdef PREPASS_VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\nvec2 velocity=abs(a-b);\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\ngl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n#ifdef PREPASS_IRRADIANCE\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,1.0);\n#endif\n#ifdef PREPASS_DEPTHNORMAL\ngl_FragData[PREPASS_DEPTHNORMAL_INDEX]=vec4(vViewPos.z,(view*vec4(normalW,0.0)).rgb);\n#endif\n#ifdef PREPASS_ALBEDO\ngl_FragData[PREPASS_ALBEDO_INDEX]=vec4(0.0,0.0,0.0,1.0);\n#endif\n#ifdef PREPASS_REFLECTIVITY\n#if defined(SPECULAR)\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=specularMapColor;\n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(0.0,0.0,0.0,1.0);\n#endif\n#endif\n#endif\n#if !defined(PREPASS) || defined(WEBGL2)\ngl_FragColor=color;\n#endif\n}\n";y.Q.ShadersStore.defaultPixelShader=C;var x="\nuniform mat4 viewProjection;\nuniform mat4 view;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\nuniform mat4 specularMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef REFLECTION\nuniform mat4 reflectionMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n";y.Q.IncludesShadersStore.defaultVertexDeclaration=x;i(3600),i(3191),i(3235),i(4344),i(8738),i(5183),i(9781),i(1892),i(2389),i(6838),i(9686),i(1889),i(5866),i(6403),i(5724),i(5581);var S="#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif";y.Q.IncludesShadersStore.pointCloudVertex=S;i(2753);var R="#include<__decl__defaultVertex>\n\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n\n#include\n#include\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nvarying vec2 vDiffuseUV;\n#endif\n#if defined(DETAIL) && DETAILDIRECTUV == 0\nvarying vec2 vDetailUV;\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nvarying vec2 vAmbientUV;\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nvarying vec2 vOpacityUV;\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nvarying vec2 vEmissiveUV;\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nvarying vec2 vLightmapUV;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\nvarying vec2 vSpecularUV;\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nvarying vec2 vBumpUV;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\n\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\n#endif\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));\nvNormalW=normalize(normalWorld*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\nvPositionW=vec3(worldPos);\n#include\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uvUpdated=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(DETAIL) && DETAILDIRECTUV == 0\nif (vDetailInfos.x == 0.)\n{\nvDetailUV=vec2(detailMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvDetailUV=vec2(detailMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\nif (vSpecularInfos.x == 0.)\n{\nvSpecularUV=vec2(specularMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}\n";y.Q.ShadersStore.defaultVertexShader=R;var M=i(8237),P=i(8555),I={effect:null,subMesh:null},O=function(e){function t(){var t=e.call(this)||this;return t.MAINUV1=!1,t.MAINUV2=!1,t.DIFFUSE=!1,t.DIFFUSEDIRECTUV=0,t.DETAIL=!1,t.DETAILDIRECTUV=0,t.DETAIL_NORMALBLENDMETHOD=0,t.AMBIENT=!1,t.AMBIENTDIRECTUV=0,t.OPACITY=!1,t.OPACITYDIRECTUV=0,t.OPACITYRGB=!1,t.REFLECTION=!1,t.EMISSIVE=!1,t.EMISSIVEDIRECTUV=0,t.SPECULAR=!1,t.SPECULARDIRECTUV=0,t.BUMP=!1,t.BUMPDIRECTUV=0,t.PARALLAX=!1,t.PARALLAXOCCLUSION=!1,t.SPECULAROVERALPHA=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.CLIPPLANE5=!1,t.CLIPPLANE6=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.ALPHAFROMDIFFUSE=!1,t.POINTSIZE=!1,t.FOG=!1,t.SPECULARTERM=!1,t.DIFFUSEFRESNEL=!1,t.OPACITYFRESNEL=!1,t.REFLECTIONFRESNEL=!1,t.REFRACTIONFRESNEL=!1,t.EMISSIVEFRESNEL=!1,t.FRESNEL=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.BONETEXTURE=!1,t.BONES_VELOCITY_ENABLED=!1,t.INSTANCES=!1,t.THIN_INSTANCES=!1,t.GLOSSINESS=!1,t.ROUGHNESS=!1,t.EMISSIVEASILLUMINATION=!1,t.LINKEMISSIVEWITHDIFFUSE=!1,t.REFLECTIONFRESNELFROMSPECULAR=!1,t.LIGHTMAP=!1,t.LIGHTMAPDIRECTUV=0,t.OBJECTSPACE_NORMALMAP=!1,t.USELIGHTMAPASSHADOWMAP=!1,t.REFLECTIONMAP_3D=!1,t.REFLECTIONMAP_SPHERICAL=!1,t.REFLECTIONMAP_PLANAR=!1,t.REFLECTIONMAP_CUBIC=!1,t.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,t.REFLECTIONMAP_PROJECTION=!1,t.REFLECTIONMAP_SKYBOX=!1,t.REFLECTIONMAP_EXPLICIT=!1,t.REFLECTIONMAP_EQUIRECTANGULAR=!1,t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,t.INVERTCUBICMAP=!1,t.LOGARITHMICDEPTH=!1,t.REFRACTION=!1,t.REFRACTIONMAP_3D=!1,t.REFLECTIONOVERALPHA=!1,t.TWOSIDEDLIGHTING=!1,t.SHADOWFLOAT=!1,t.MORPHTARGETS=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_UV=!1,t.NUM_MORPH_INFLUENCERS=0,t.NONUNIFORMSCALING=!1,t.PREMULTIPLYALPHA=!1,t.ALPHATEST_AFTERALLALPHACOMPUTATIONS=!1,t.ALPHABLEND=!0,t.PREPASS=!1,t.PREPASS_IRRADIANCE=!1,t.PREPASS_IRRADIANCE_INDEX=-1,t.PREPASS_ALBEDO=!1,t.PREPASS_ALBEDO_INDEX=-1,t.PREPASS_DEPTHNORMAL=!1,t.PREPASS_DEPTHNORMAL_INDEX=-1,t.PREPASS_POSITION=!1,t.PREPASS_POSITION_INDEX=-1,t.PREPASS_VELOCITY=!1,t.PREPASS_VELOCITY_INDEX=-1,t.PREPASS_REFLECTIVITY=!1,t.PREPASS_REFLECTIVITY_INDEX=-1,t.SCENE_MRT_COUNT=0,t.RGBDLIGHTMAP=!1,t.RGBDREFLECTION=!1,t.RGBDREFRACTION=!1,t.IMAGEPROCESSING=!1,t.VIGNETTE=!1,t.VIGNETTEBLENDMODEMULTIPLY=!1,t.VIGNETTEBLENDMODEOPAQUE=!1,t.TONEMAPPING=!1,t.TONEMAPPING_ACES=!1,t.CONTRAST=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=!1,t.SAMPLER3DBGRMAP=!1,t.IMAGEPROCESSINGPOSTPROCESS=!1,t.MULTIVIEW=!1,t.IS_REFLECTION_LINEAR=!1,t.IS_REFRACTION_LINEAR=!1,t.EXPOSURE=!1,t.rebuild(),t}return(0,n.ZT)(t,e),t.prototype.setReflectionMode=function(e){for(var t=0,i=["REFLECTIONMAP_CUBIC","REFLECTIONMAP_EXPLICIT","REFLECTIONMAP_PLANAR","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_SKYBOX","REFLECTIONMAP_SPHERICAL","REFLECTIONMAP_EQUIRECTANGULAR","REFLECTIONMAP_EQUIRECTANGULAR_FIXED","REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"];t0,o.REFLECTIONOVERALPHA=this._useReflectionOverAlpha,o.INVERTCUBICMAP=this._reflectionTexture.coordinatesMode===g.x.INVCUBIC_MODE,o.REFLECTIONMAP_3D=this._reflectionTexture.isCube,o.RGBDREFLECTION=this._reflectionTexture.isRGBD,this._reflectionTexture.coordinatesMode){case g.x.EXPLICIT_MODE:o.setReflectionMode("REFLECTIONMAP_EXPLICIT");break;case g.x.PLANAR_MODE:o.setReflectionMode("REFLECTIONMAP_PLANAR");break;case g.x.PROJECTION_MODE:o.setReflectionMode("REFLECTIONMAP_PROJECTION");break;case g.x.SKYBOX_MODE:o.setReflectionMode("REFLECTIONMAP_SKYBOX");break;case g.x.SPHERICAL_MODE:o.setReflectionMode("REFLECTIONMAP_SPHERICAL");break;case g.x.EQUIRECTANGULAR_MODE:o.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR");break;case g.x.FIXED_EQUIRECTANGULAR_MODE:o.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR_FIXED");break;case g.x.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:o.setReflectionMode("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED");break;case g.x.CUBIC_MODE:case g.x.INVCUBIC_MODE:default:o.setReflectionMode("REFLECTIONMAP_CUBIC")}o.USE_LOCAL_REFLECTIONMAP_CUBIC=!!this._reflectionTexture.boundingBoxSize}else o.REFLECTION=!1;if(this._emissiveTexture&&t.EmissiveTextureEnabled){if(!this._emissiveTexture.isReadyOrNotBlocking())return!1;_.G.PrepareDefinesForMergedUV(this._emissiveTexture,o,"EMISSIVE")}else o.EMISSIVE=!1;if(this._lightmapTexture&&t.LightmapTextureEnabled){if(!this._lightmapTexture.isReadyOrNotBlocking())return!1;_.G.PrepareDefinesForMergedUV(this._lightmapTexture,o,"LIGHTMAP"),o.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,o.RGBDLIGHTMAP=this._lightmapTexture.isRGBD}else o.LIGHTMAP=!1;if(this._specularTexture&&t.SpecularTextureEnabled){if(!this._specularTexture.isReadyOrNotBlocking())return!1;_.G.PrepareDefinesForMergedUV(this._specularTexture,o,"SPECULAR"),o.GLOSSINESS=this._useGlossinessFromSpecularMapAlpha}else o.SPECULAR=!1;if(r.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&t.BumpTextureEnabled){if(!this._bumpTexture.isReady())return!1;_.G.PrepareDefinesForMergedUV(this._bumpTexture,o,"BUMP"),o.PARALLAX=this._useParallax,o.PARALLAXOCCLUSION=this._useParallaxOcclusion,o.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap}else o.BUMP=!1;if(this._refractionTexture&&t.RefractionTextureEnabled){if(!this._refractionTexture.isReadyOrNotBlocking())return!1;o._needUVs=!0,o.REFRACTION=!0,o.REFRACTIONMAP_3D=this._refractionTexture.isCube,o.RGBDREFRACTION=this._refractionTexture.isRGBD}else o.REFRACTION=!1;o.TWOSIDEDLIGHTING=!this._backFaceCulling&&this._twoSidedLighting}else o.DIFFUSE=!1,o.AMBIENT=!1,o.OPACITY=!1,o.REFLECTION=!1,o.EMISSIVE=!1,o.LIGHTMAP=!1,o.BUMP=!1,o.REFRACTION=!1;o.ALPHAFROMDIFFUSE=this._shouldUseAlphaFromDiffuseTexture(),o.EMISSIVEASILLUMINATION=this._useEmissiveAsIllumination,o.LINKEMISSIVEWITHDIFFUSE=this._linkEmissiveWithDiffuse,o.SPECULAROVERALPHA=this._useSpecularOverAlpha,o.PREMULTIPLYALPHA=7===this.alphaMode||8===this.alphaMode,o.ALPHATEST_AFTERALLALPHACOMPUTATIONS=null!==this.transparencyMode,o.ALPHABLEND=null===this.transparencyMode||this.needAlphaBlendingForMesh(e)}if(!this.detailMap.isReadyForSubMesh(o,r))return!1;if(o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(o._areFresnelDirty&&(t.FresnelEnabled?(this._diffuseFresnelParameters||this._opacityFresnelParameters||this._emissiveFresnelParameters||this._refractionFresnelParameters||this._reflectionFresnelParameters)&&(o.DIFFUSEFRESNEL=this._diffuseFresnelParameters&&this._diffuseFresnelParameters.isEnabled,o.OPACITYFRESNEL=this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled,o.REFLECTIONFRESNEL=this._reflectionFresnelParameters&&this._reflectionFresnelParameters.isEnabled,o.REFLECTIONFRESNELFROMSPECULAR=this._useReflectionFresnelFromSpecular,o.REFRACTIONFRESNEL=this._refractionFresnelParameters&&this._refractionFresnelParameters.isEnabled,o.EMISSIVEFRESNEL=this._emissiveFresnelParameters&&this._emissiveFresnelParameters.isEnabled,o._needNormals=!0,o.FRESNEL=!0):o.FRESNEL=!1),_.G.PrepareDefinesForMisc(e,r,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,o),_.G.PrepareDefinesForAttributes(e,o,!0,!0,!0),_.G.PrepareDefinesForFrameBoundValues(r,s,o,n,null,i.getRenderingMesh().hasThinInstances),this.detailMap.prepareDefines(o,r),o.isDirty){var a=o._areLightsDisposed;o.markAsProcessed();var l=new M.L;o.REFLECTION&&l.addFallback(0,"REFLECTION"),o.SPECULAR&&l.addFallback(0,"SPECULAR"),o.BUMP&&l.addFallback(0,"BUMP"),o.PARALLAX&&l.addFallback(1,"PARALLAX"),o.PARALLAXOCCLUSION&&l.addFallback(0,"PARALLAXOCCLUSION"),o.SPECULAROVERALPHA&&l.addFallback(0,"SPECULAROVERALPHA"),o.FOG&&l.addFallback(1,"FOG"),o.POINTSIZE&&l.addFallback(0,"POINTSIZE"),o.LOGARITHMICDEPTH&&l.addFallback(0,"LOGARITHMICDEPTH"),_.G.HandleFallbacksForShadows(o,l,this._maxSimultaneousLights),o.SPECULARTERM&&l.addFallback(0,"SPECULARTERM"),o.DIFFUSEFRESNEL&&l.addFallback(1,"DIFFUSEFRESNEL"),o.OPACITYFRESNEL&&l.addFallback(2,"OPACITYFRESNEL"),o.REFLECTIONFRESNEL&&l.addFallback(3,"REFLECTIONFRESNEL"),o.EMISSIVEFRESNEL&&l.addFallback(4,"EMISSIVEFRESNEL"),o.FRESNEL&&l.addFallback(4,"FRESNEL"),o.MULTIVIEW&&l.addFallback(0,"MULTIVIEW");var f=[h.o.PositionKind];o.NORMAL&&f.push(h.o.NormalKind),o.UV1&&f.push(h.o.UVKind),o.UV2&&f.push(h.o.UV2Kind),o.VERTEXCOLOR&&f.push(h.o.ColorKind),_.G.PrepareAttributesForBones(f,e,o,l),_.G.PrepareAttributesForInstances(f,o),_.G.PrepareAttributesForMorphTargets(f,e,o);var d="default",p=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vDiffuseColor","vSpecularColor","vEmissiveColor","visibility","vFogInfos","vFogColor","pointSize","vDiffuseInfos","vAmbientInfos","vOpacityInfos","vReflectionInfos","vEmissiveInfos","vSpecularInfos","vBumpInfos","vLightmapInfos","vRefractionInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","diffuseMatrix","ambientMatrix","opacityMatrix","reflectionMatrix","emissiveMatrix","specularMatrix","bumpMatrix","normalMatrix","lightmapMatrix","refractionMatrix","diffuseLeftColor","diffuseRightColor","opacityParts","reflectionLeftColor","reflectionRightColor","emissiveLeftColor","emissiveRightColor","refractionLeftColor","refractionRightColor","vReflectionPosition","vReflectionSize","logarithmicDepthConstant","vTangentSpaceParams","alphaCutOff","boneTextureWidth"],m=["diffuseSampler","ambientSampler","opacitySampler","reflectionCubeSampler","reflection2DSampler","emissiveSampler","specularSampler","bumpSampler","lightmapSampler","refractionCubeSampler","refraction2DSampler","boneSampler"],v=["Material","Scene"];P.p.AddUniforms(p),P.p.AddSamplers(m),c.o.AddUniforms(p),c.o.AddSamplers(p),u.$&&(u.$.PrepareUniforms(p,o),u.$.PrepareSamplers(m,o)),_.G.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:v,samplers:m,defines:o,maxSimultaneousLights:this._maxSimultaneousLights});var y={};this.customShaderNameResolve&&(d=this.customShaderNameResolve(d,p,v,m,o,f,y));var b=o.toString(),T=i.effect,A=r.getEngine().createEffect(d,{attributes:f,uniformsNames:p,uniformBuffersNames:v,samplers:m,defines:b,fallbacks:l,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:o.NUM_MORPH_INFLUENCERS},processFinalCode:y.processFinalCode,multiTarget:o.PREPASS},s);if(A)if(this._onEffectCreatedObservable&&(I.effect=A,I.subMesh=i,this._onEffectCreatedObservable.notifyObservers(I)),this.allowShaderHotSwapping&&T&&!A.isReady()){if(A=T,this._rebuildInParallel=!0,o.markAsUnprocessed(),a)return o._areLightsDisposed=!0,!1}else this._rebuildInParallel=!1,r.resetCachedMaterial(),i.setEffect(A,o),this.buildUniformLayout()}return!(!i.effect||!i.effect.isReady())&&(o._renderId=r.getRenderId(),i.effect._wasPreviouslyReady=!0,!0)},t.prototype.buildUniformLayout=function(){var e=this._uniformBuffer;e.addUniform("diffuseLeftColor",4),e.addUniform("diffuseRightColor",4),e.addUniform("opacityParts",4),e.addUniform("reflectionLeftColor",4),e.addUniform("reflectionRightColor",4),e.addUniform("refractionLeftColor",4),e.addUniform("refractionRightColor",4),e.addUniform("emissiveLeftColor",4),e.addUniform("emissiveRightColor",4),e.addUniform("vDiffuseInfos",2),e.addUniform("vAmbientInfos",2),e.addUniform("vOpacityInfos",2),e.addUniform("vReflectionInfos",2),e.addUniform("vReflectionPosition",3),e.addUniform("vReflectionSize",3),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vSpecularInfos",2),e.addUniform("vBumpInfos",3),e.addUniform("diffuseMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("reflectionMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("specularMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("pointSize",1),e.addUniform("refractionMatrix",16),e.addUniform("vRefractionInfos",4),e.addUniform("vSpecularColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("visibility",1),e.addUniform("vDiffuseColor",4),P.p.PrepareUniformBuffer(e),e.create()},t.prototype.unbind=function(){if(this._activeEffect){var t=!1;this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&(this._activeEffect.setTexture("reflection2DSampler",null),t=!0),this._refractionTexture&&this._refractionTexture.isRenderTarget&&(this._activeEffect.setTexture("refraction2DSampler",null),t=!0),t&&this._markAllSubMeshesAsTexturesDirty()}e.prototype.unbind.call(this)},t.prototype.bindForSubMesh=function(e,i,n){var r=this.getScene(),o=n._materialDefines;if(o){var a=n.effect;if(a){this._activeEffect=a,o.INSTANCES&&!o.THIN_INSTANCES||this.bindOnlyWorldMatrix(e),this.prePassConfiguration.bindForSubMesh(this._activeEffect,r,i,e,this.isFrozen),o.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var h=this._mustRebind(r,a,i.visibility);_.G.BindBonesParameters(i,a);var c=this._uniformBuffer;if(h){if(c.bindToEffect(a,"Material"),this.bindViewProjection(a),!c.useUbo||!this.isFrozen||!c.isSync){if(t.FresnelEnabled&&o.FRESNEL&&(this.diffuseFresnelParameters&&this.diffuseFresnelParameters.isEnabled&&(c.updateColor4("diffuseLeftColor",this.diffuseFresnelParameters.leftColor,this.diffuseFresnelParameters.power),c.updateColor4("diffuseRightColor",this.diffuseFresnelParameters.rightColor,this.diffuseFresnelParameters.bias)),this.opacityFresnelParameters&&this.opacityFresnelParameters.isEnabled&&c.updateColor4("opacityParts",new l.Wo(this.opacityFresnelParameters.leftColor.toLuminance(),this.opacityFresnelParameters.rightColor.toLuminance(),this.opacityFresnelParameters.bias),this.opacityFresnelParameters.power),this.reflectionFresnelParameters&&this.reflectionFresnelParameters.isEnabled&&(c.updateColor4("reflectionLeftColor",this.reflectionFresnelParameters.leftColor,this.reflectionFresnelParameters.power),c.updateColor4("reflectionRightColor",this.reflectionFresnelParameters.rightColor,this.reflectionFresnelParameters.bias)),this.refractionFresnelParameters&&this.refractionFresnelParameters.isEnabled&&(c.updateColor4("refractionLeftColor",this.refractionFresnelParameters.leftColor,this.refractionFresnelParameters.power),c.updateColor4("refractionRightColor",this.refractionFresnelParameters.rightColor,this.refractionFresnelParameters.bias)),this.emissiveFresnelParameters&&this.emissiveFresnelParameters.isEnabled&&(c.updateColor4("emissiveLeftColor",this.emissiveFresnelParameters.leftColor,this.emissiveFresnelParameters.power),c.updateColor4("emissiveRightColor",this.emissiveFresnelParameters.rightColor,this.emissiveFresnelParameters.bias))),r.texturesEnabled){if(this._diffuseTexture&&t.DiffuseTextureEnabled&&(c.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),_.G.BindTextureMatrix(this._diffuseTexture,c,"diffuse")),this._ambientTexture&&t.AmbientTextureEnabled&&(c.updateFloat2("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level),_.G.BindTextureMatrix(this._ambientTexture,c,"ambient")),this._opacityTexture&&t.OpacityTextureEnabled&&(c.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),_.G.BindTextureMatrix(this._opacityTexture,c,"opacity")),this._hasAlphaChannel()&&a.setFloat("alphaCutOff",this.alphaCutOff),this._reflectionTexture&&t.ReflectionTextureEnabled&&(c.updateFloat2("vReflectionInfos",this._reflectionTexture.level,this.roughness),c.updateMatrix("reflectionMatrix",this._reflectionTexture.getReflectionTextureMatrix()),this._reflectionTexture.boundingBoxSize)){var u=this._reflectionTexture;c.updateVector3("vReflectionPosition",u.boundingBoxPosition),c.updateVector3("vReflectionSize",u.boundingBoxSize)}if(this._emissiveTexture&&t.EmissiveTextureEnabled&&(c.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),_.G.BindTextureMatrix(this._emissiveTexture,c,"emissive")),this._lightmapTexture&&t.LightmapTextureEnabled&&(c.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),_.G.BindTextureMatrix(this._lightmapTexture,c,"lightmap")),this._specularTexture&&t.SpecularTextureEnabled&&(c.updateFloat2("vSpecularInfos",this._specularTexture.coordinatesIndex,this._specularTexture.level),_.G.BindTextureMatrix(this._specularTexture,c,"specular")),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&t.BumpTextureEnabled&&(c.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,1/this._bumpTexture.level,this.parallaxScaleBias),_.G.BindTextureMatrix(this._bumpTexture,c,"bump"),r._mirroredCameraPosition?c.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):c.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),this._refractionTexture&&t.RefractionTextureEnabled){var f=1;this._refractionTexture.isCube||(c.updateMatrix("refractionMatrix",this._refractionTexture.getReflectionTextureMatrix()),this._refractionTexture.depth&&(f=this._refractionTexture.depth)),c.updateFloat4("vRefractionInfos",this._refractionTexture.level,this.indexOfRefraction,f,this.invertRefractionY?-1:1)}}this.pointsCloud&&c.updateFloat("pointSize",this.pointSize),o.SPECULARTERM&&c.updateColor4("vSpecularColor",this.specularColor,this.specularPower),c.updateColor3("vEmissiveColor",t.EmissiveTextureEnabled?this.emissiveColor:l.Wo.BlackReadOnly),c.updateColor4("vDiffuseColor",this.diffuseColor,this.alpha)}if(c.updateFloat("visibility",i.visibility),r.texturesEnabled&&(this._diffuseTexture&&t.DiffuseTextureEnabled&&a.setTexture("diffuseSampler",this._diffuseTexture),this._ambientTexture&&t.AmbientTextureEnabled&&a.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&t.OpacityTextureEnabled&&a.setTexture("opacitySampler",this._opacityTexture),this._reflectionTexture&&t.ReflectionTextureEnabled&&(this._reflectionTexture.isCube?a.setTexture("reflectionCubeSampler",this._reflectionTexture):a.setTexture("reflection2DSampler",this._reflectionTexture)),this._emissiveTexture&&t.EmissiveTextureEnabled&&a.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&t.LightmapTextureEnabled&&a.setTexture("lightmapSampler",this._lightmapTexture),this._specularTexture&&t.SpecularTextureEnabled&&a.setTexture("specularSampler",this._specularTexture),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&t.BumpTextureEnabled&&a.setTexture("bumpSampler",this._bumpTexture),this._refractionTexture&&t.RefractionTextureEnabled)){f=1;this._refractionTexture.isCube?a.setTexture("refractionCubeSampler",this._refractionTexture):a.setTexture("refraction2DSampler",this._refractionTexture)}this.detailMap.bindForSubMesh(c,r,this.isFrozen),_.G.BindClipPlane(a,r),r.ambientColor.multiplyToRef(this.ambientColor,this._globalAmbientColor),_.G.BindEyePosition(a,r),a.setColor3("vAmbientColor",this._globalAmbientColor)}!h&&this.isFrozen||(r.lightsEnabled&&!this._disableLighting&&_.G.BindLights(r,i,a,o,this._maxSimultaneousLights,this._rebuildInParallel),(r.fogEnabled&&i.applyFog&&r.fogMode!==s.Scene.FOGMODE_NONE||this._reflectionTexture||this._refractionTexture)&&this.bindView(a),_.G.BindFogParameters(r,i,a),o.NUM_MORPH_INFLUENCERS&&_.G.BindMorphTargetParameters(i,a),this.useLogarithmicDepth&&_.G.BindLogDepth(o,a,r),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect)),c.update(),this._afterBind(i,this._activeEffect)}}},t.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&e.push(this._emissiveTexture),this._specularTexture&&this._specularTexture.animations&&this._specularTexture.animations.length>0&&e.push(this._specularTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&e.push(this._lightmapTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&e.push(this._refractionTexture),this.detailMap.getAnimatables(e),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),this._ambientTexture&&t.push(this._ambientTexture),this._opacityTexture&&t.push(this._opacityTexture),this._reflectionTexture&&t.push(this._reflectionTexture),this._emissiveTexture&&t.push(this._emissiveTexture),this._specularTexture&&t.push(this._specularTexture),this._bumpTexture&&t.push(this._bumpTexture),this._lightmapTexture&&t.push(this._lightmapTexture),this._refractionTexture&&t.push(this._refractionTexture),this.detailMap.getActiveTextures(t),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._diffuseTexture===t||(this._ambientTexture===t||(this._opacityTexture===t||(this._reflectionTexture===t||(this._emissiveTexture===t||(this._specularTexture===t||(this._bumpTexture===t||(this._lightmapTexture===t||(this._refractionTexture===t||this.detailMap.hasTexture(t))))))))))},t.prototype.dispose=function(t,i){var n,r,o,s,a,l,h,c,u;i&&(null===(n=this._diffuseTexture)||void 0===n||n.dispose(),null===(r=this._ambientTexture)||void 0===r||r.dispose(),null===(o=this._opacityTexture)||void 0===o||o.dispose(),null===(s=this._reflectionTexture)||void 0===s||s.dispose(),null===(a=this._emissiveTexture)||void 0===a||a.dispose(),null===(l=this._specularTexture)||void 0===l||l.dispose(),null===(h=this._bumpTexture)||void 0===h||h.dispose(),null===(c=this._lightmapTexture)||void 0===c||c.dispose(),null===(u=this._refractionTexture)||void 0===u||u.dispose()),this.detailMap.dispose(i),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t,i)},t.prototype.clone=function(e){var i=this,n=r.p4.Clone((function(){return new t(e,i.getScene())}),this);return n.name=e,n.id=e,n},t.prototype.serialize=function(){return r.p4.Serialize(this)},t.Parse=function(e,i,n){return r.p4.Parse((function(){return new t(e.name,i)}),e,i,n)},Object.defineProperty(t,"DiffuseTextureEnabled",{get:function(){return v.k.DiffuseTextureEnabled},set:function(e){v.k.DiffuseTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"DetailTextureEnabled",{get:function(){return v.k.DetailTextureEnabled},set:function(e){v.k.DetailTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"AmbientTextureEnabled",{get:function(){return v.k.AmbientTextureEnabled},set:function(e){v.k.AmbientTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"OpacityTextureEnabled",{get:function(){return v.k.OpacityTextureEnabled},set:function(e){v.k.OpacityTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ReflectionTextureEnabled",{get:function(){return v.k.ReflectionTextureEnabled},set:function(e){v.k.ReflectionTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"EmissiveTextureEnabled",{get:function(){return v.k.EmissiveTextureEnabled},set:function(e){v.k.EmissiveTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"SpecularTextureEnabled",{get:function(){return v.k.SpecularTextureEnabled},set:function(e){v.k.SpecularTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BumpTextureEnabled",{get:function(){return v.k.BumpTextureEnabled},set:function(e){v.k.BumpTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"LightmapTextureEnabled",{get:function(){return v.k.LightmapTextureEnabled},set:function(e){v.k.LightmapTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"RefractionTextureEnabled",{get:function(){return v.k.RefractionTextureEnabled},set:function(e){v.k.RefractionTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ColorGradingTextureEnabled",{get:function(){return v.k.ColorGradingTextureEnabled},set:function(e){v.k.ColorGradingTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"FresnelEnabled",{get:function(){return v.k.FresnelEnabled},set:function(e){v.k.FresnelEnabled=e},enumerable:!1,configurable:!0}),(0,n.gn)([(0,r.oU)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"diffuseTexture",void 0),(0,n.gn)([(0,r.oU)("ambientTexture")],t.prototype,"_ambientTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTexture",void 0),(0,n.gn)([(0,r.oU)("opacityTexture")],t.prototype,"_opacityTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"opacityTexture",void 0),(0,n.gn)([(0,r.oU)("reflectionTexture")],t.prototype,"_reflectionTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),(0,n.gn)([(0,r.oU)("emissiveTexture")],t.prototype,"_emissiveTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveTexture",void 0),(0,n.gn)([(0,r.oU)("specularTexture")],t.prototype,"_specularTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"specularTexture",void 0),(0,n.gn)([(0,r.oU)("bumpTexture")],t.prototype,"_bumpTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),(0,n.gn)([(0,r.oU)("lightmapTexture")],t.prototype,"_lightmapTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"lightmapTexture",void 0),(0,n.gn)([(0,r.oU)("refractionTexture")],t.prototype,"_refractionTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"refractionTexture",void 0),(0,n.gn)([(0,r.n9)("ambient")],t.prototype,"ambientColor",void 0),(0,n.gn)([(0,r.n9)("diffuse")],t.prototype,"diffuseColor",void 0),(0,n.gn)([(0,r.n9)("specular")],t.prototype,"specularColor",void 0),(0,n.gn)([(0,r.n9)("emissive")],t.prototype,"emissiveColor",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"specularPower",void 0),(0,n.gn)([(0,r.qC)("useAlphaFromDiffuseTexture")],t.prototype,"_useAlphaFromDiffuseTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"useAlphaFromDiffuseTexture",void 0),(0,n.gn)([(0,r.qC)("useEmissiveAsIllumination")],t.prototype,"_useEmissiveAsIllumination",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useEmissiveAsIllumination",void 0),(0,n.gn)([(0,r.qC)("linkEmissiveWithDiffuse")],t.prototype,"_linkEmissiveWithDiffuse",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"linkEmissiveWithDiffuse",void 0),(0,n.gn)([(0,r.qC)("useSpecularOverAlpha")],t.prototype,"_useSpecularOverAlpha",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useSpecularOverAlpha",void 0),(0,n.gn)([(0,r.qC)("useReflectionOverAlpha")],t.prototype,"_useReflectionOverAlpha",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useReflectionOverAlpha",void 0),(0,n.gn)([(0,r.qC)("disableLighting")],t.prototype,"_disableLighting",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),(0,n.gn)([(0,r.qC)("useObjectSpaceNormalMap")],t.prototype,"_useObjectSpaceNormalMap",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useObjectSpaceNormalMap",void 0),(0,n.gn)([(0,r.qC)("useParallax")],t.prototype,"_useParallax",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallax",void 0),(0,n.gn)([(0,r.qC)("useParallaxOcclusion")],t.prototype,"_useParallaxOcclusion",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallaxOcclusion",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"parallaxScaleBias",void 0),(0,n.gn)([(0,r.qC)("roughness")],t.prototype,"_roughness",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"roughness",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"indexOfRefraction",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"invertRefractionY",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"alphaCutOff",void 0),(0,n.gn)([(0,r.qC)("useLightmapAsShadowmap")],t.prototype,"_useLightmapAsShadowmap",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLightmapAsShadowmap",void 0),(0,n.gn)([(0,r.qQ)("diffuseFresnelParameters")],t.prototype,"_diffuseFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"diffuseFresnelParameters",void 0),(0,n.gn)([(0,r.qQ)("opacityFresnelParameters")],t.prototype,"_opacityFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelAndMiscDirty")],t.prototype,"opacityFresnelParameters",void 0),(0,n.gn)([(0,r.qQ)("reflectionFresnelParameters")],t.prototype,"_reflectionFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"reflectionFresnelParameters",void 0),(0,n.gn)([(0,r.qQ)("refractionFresnelParameters")],t.prototype,"_refractionFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"refractionFresnelParameters",void 0),(0,n.gn)([(0,r.qQ)("emissiveFresnelParameters")],t.prototype,"_emissiveFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"emissiveFresnelParameters",void 0),(0,n.gn)([(0,r.qC)("useReflectionFresnelFromSpecular")],t.prototype,"_useReflectionFresnelFromSpecular",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"useReflectionFresnelFromSpecular",void 0),(0,n.gn)([(0,r.qC)("useGlossinessFromSpecularMapAlpha")],t.prototype,"_useGlossinessFromSpecularMapAlpha",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useGlossinessFromSpecularMapAlpha",void 0),(0,n.gn)([(0,r.qC)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),(0,n.gn)([(0,r.qC)("invertNormalMapX")],t.prototype,"_invertNormalMapX",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapX",void 0),(0,n.gn)([(0,r.qC)("invertNormalMapY")],t.prototype,"_invertNormalMapY",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapY",void 0),(0,n.gn)([(0,r.qC)("twoSidedLighting")],t.prototype,"_twoSidedLighting",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"twoSidedLighting",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"useLogarithmicDepth",null),t}(p.a);m.Q.RegisteredTypes["BABYLON.StandardMaterial"]=D,s.Scene.DefaultMaterialFactory=function(e){return new D("default material",e)}},356:(e,t,i)=>{"use strict";i.d(t,{M:()=>s});var n=i(3734),r=i(2131),o=i(5146);r.B.prototype.createUniformBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create uniform buffer");var i=new o.M(t);return this.bindUniformBuffer(i),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.STATIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.STATIC_DRAW),this.bindUniformBuffer(null),i.references=1,i},r.B.prototype.createDynamicUniformBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create dynamic uniform buffer");var i=new o.M(t);return this.bindUniformBuffer(i),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.DYNAMIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.DYNAMIC_DRAW),this.bindUniformBuffer(null),i.references=1,i},r.B.prototype.updateUniformBuffer=function(e,t,i,n){this.bindUniformBuffer(e),void 0===i&&(i=0),void 0===n?t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,i,t):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,i,new Float32Array(t)):t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,t.subarray(i,i+n)):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,new Float32Array(t).subarray(i,i+n)),this.bindUniformBuffer(null)},r.B.prototype.bindUniformBuffer=function(e){this._gl.bindBuffer(this._gl.UNIFORM_BUFFER,e?e.underlyingResource:null)},r.B.prototype.bindUniformBufferBase=function(e,t){this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER,t,e?e.underlyingResource:null)},r.B.prototype.bindUniformBlock=function(e,t,i){var n=e.program,r=this._gl.getUniformBlockIndex(n,t);this._gl.uniformBlockBinding(n,r,i)};var s=function(){function e(e,t,i){this._alreadyBound=!1,this._valueCache={},this._engine=e,this._noUBO=!e.supportsUniformBuffers,this._dynamic=i,this._data=t||[],this._uniformLocations={},this._uniformSizes={},this._uniformLocationPointer=0,this._needSync=!1,this._noUBO?(this.updateMatrix3x3=this._updateMatrix3x3ForEffect,this.updateMatrix2x2=this._updateMatrix2x2ForEffect,this.updateFloat=this._updateFloatForEffect,this.updateFloat2=this._updateFloat2ForEffect,this.updateFloat3=this._updateFloat3ForEffect,this.updateFloat4=this._updateFloat4ForEffect,this.updateMatrix=this._updateMatrixForEffect,this.updateVector3=this._updateVector3ForEffect,this.updateVector4=this._updateVector4ForEffect,this.updateColor3=this._updateColor3ForEffect,this.updateColor4=this._updateColor4ForEffect):(this._engine._uniformBuffers.push(this),this.updateMatrix3x3=this._updateMatrix3x3ForUniform,this.updateMatrix2x2=this._updateMatrix2x2ForUniform,this.updateFloat=this._updateFloatForUniform,this.updateFloat2=this._updateFloat2ForUniform,this.updateFloat3=this._updateFloat3ForUniform,this.updateFloat4=this._updateFloat4ForUniform,this.updateMatrix=this._updateMatrixForUniform,this.updateVector3=this._updateVector3ForUniform,this.updateVector4=this._updateVector4ForUniform,this.updateColor3=this._updateColor3ForUniform,this.updateColor4=this._updateColor4ForUniform)}return Object.defineProperty(e.prototype,"useUbo",{get:function(){return!this._noUBO},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSync",{get:function(){return!this._needSync},enumerable:!1,configurable:!0}),e.prototype.isDynamic=function(){return void 0!==this._dynamic},e.prototype.getData=function(){return this._bufferData},e.prototype.getBuffer=function(){return this._buffer},e.prototype._fillAlignment=function(e){var t;if(t=e<=2?e:4,this._uniformLocationPointer%t!=0){var i=this._uniformLocationPointer;this._uniformLocationPointer+=t-this._uniformLocationPointer%t;for(var n=this._uniformLocationPointer-i,r=0;r{"use strict";i.d(t,{T:()=>n,RD:()=>s,c7:()=>o});var n,r=i(2973);!function(e){e[e.LOCAL=0]="LOCAL",e[e.WORLD=1]="WORLD",e[e.BONE=2]="BONE"}(n||(n={}));var o,s=function(){function e(){}return e.X=new r.P(1,0,0),e.Y=new r.P(0,1,0),e.Z=new r.P(0,0,1),e}();!function(e){e[e.X=0]="X",e[e.Y=1]="Y",e[e.Z=2]="Z"}(o||(o={}))},8362:(e,t,i)=>{"use strict";i.d(t,{Wo:()=>a,HE:()=>l,zZ:()=>h});var n=i(9018),r=i(2782),o=i(8035),s=i(6132),a=function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this.r=e,this.g=t,this.b=i}return e.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"},e.prototype.getClassName=function(){return"Color3"},e.prototype.getHashCode=function(){var e=255*this.r|0;return e=397*(e=397*e^(255*this.g|0))^(255*this.b|0)},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,this},e.prototype.fromArray=function(t,i){return void 0===i&&(i=0),e.FromArrayToRef(t,i,this),this},e.prototype.toColor4=function(e){return void 0===e&&(e=1),new l(this.r,this.g,this.b,e)},e.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},e.prototype.toLuminance=function(){return.3*this.r+.59*this.g+.11*this.b},e.prototype.multiply=function(t){return new e(this.r*t.r,this.g*t.g,this.b*t.b)},e.prototype.multiplyToRef=function(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,this},e.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b},e.prototype.equalsFloats=function(e,t,i){return this.r===e&&this.g===t&&this.b===i},e.prototype.scale=function(t){return new e(this.r*t,this.g*t,this.b*t)},e.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,this},e.prototype.clampToRef=function(e,t,i){return void 0===e&&(e=0),void 0===t&&(t=1),i.r=n.R.Clamp(this.r,e,t),i.g=n.R.Clamp(this.g,e,t),i.b=n.R.Clamp(this.b,e,t),this},e.prototype.add=function(t){return new e(this.r+t.r,this.g+t.g,this.b+t.b)},e.prototype.addToRef=function(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,this},e.prototype.subtract=function(t){return new e(this.r-t.r,this.g-t.g,this.b-t.b)},e.prototype.subtractToRef=function(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,this},e.prototype.clone=function(){return new e(this.r,this.g,this.b)},e.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},e.prototype.copyFromFloats=function(e,t,i){return this.r=e,this.g=t,this.b=i,this},e.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},e.prototype.toHexString=function(){var e=255*this.r|0,t=255*this.g|0,i=255*this.b|0;return"#"+n.R.ToHex(e)+n.R.ToHex(t)+n.R.ToHex(i)},e.prototype.toLinearSpace=function(){var t=new e;return this.toLinearSpaceToRef(t),t},e.prototype.toHSV=function(){var t=new e;return this.toHSVToRef(t),t},e.prototype.toHSVToRef=function(e){var t=this.r,i=this.g,n=this.b,r=Math.max(t,i,n),o=Math.min(t,i,n),s=0,a=0,l=r,h=r-o;0!==r&&(a=h/r),r!=o&&(r==t?(s=(i-n)/h,i=0&&o<=1?(a=r,l=s):o>=1&&o<=2?(a=s,l=r):o>=2&&o<=3?(l=r,h=s):o>=3&&o<=4?(l=s,h=r):o>=4&&o<=5?(a=s,h=r):o>=5&&o<=6&&(a=r,h=s);var c=i-r;n.set(a+c,l+c,h+c)},e.FromHexString=function(t){if("#"!==t.substring(0,1)||7!==t.length)return new e(0,0,0);var i=parseInt(t.substring(1,3),16),n=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16);return e.FromInts(i,n,r)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1],t[i+2])},e.FromArrayToRef=function(e,t,i){void 0===t&&(t=0),i.r=e[t],i.g=e[t+1],i.b=e[t+2]},e.FromInts=function(t,i,n){return new e(t/255,i/255,n/255)},e.Lerp=function(t,i,n){var r=new e(0,0,0);return e.LerpToRef(t,i,n,r),r},e.LerpToRef=function(e,t,i,n){n.r=e.r+(t.r-e.r)*i,n.g=e.g+(t.g-e.g)*i,n.b=e.b+(t.b-e.b)*i},e.Red=function(){return new e(1,0,0)},e.Green=function(){return new e(0,1,0)},e.Blue=function(){return new e(0,0,1)},e.Black=function(){return new e(0,0,0)},Object.defineProperty(e,"BlackReadOnly",{get:function(){return e._BlackReadOnly},enumerable:!1,configurable:!0}),e.White=function(){return new e(1,1,1)},e.Purple=function(){return new e(.5,0,.5)},e.Magenta=function(){return new e(1,0,1)},e.Yellow=function(){return new e(1,1,0)},e.Gray=function(){return new e(.5,.5,.5)},e.Teal=function(){return new e(0,1,1)},e.Random=function(){return new e(Math.random(),Math.random(),Math.random())},e._BlackReadOnly=e.Black(),e}(),l=function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),this.r=e,this.g=t,this.b=i,this.a=n}return e.prototype.addInPlace=function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this},e.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e[t+3]=this.a,this},e.prototype.fromArray=function(t,i){return void 0===i&&(i=0),e.FromArrayToRef(t,i,this),this},e.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a},e.prototype.add=function(t){return new e(this.r+t.r,this.g+t.g,this.b+t.b,this.a+t.a)},e.prototype.subtract=function(t){return new e(this.r-t.r,this.g-t.g,this.b-t.b,this.a-t.a)},e.prototype.subtractToRef=function(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t.a=this.a-e.a,this},e.prototype.scale=function(t){return new e(this.r*t,this.g*t,this.b*t,this.a*t)},e.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t.a=this.a*e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t.a+=this.a*e,this},e.prototype.clampToRef=function(e,t,i){return void 0===e&&(e=0),void 0===t&&(t=1),i.r=n.R.Clamp(this.r,e,t),i.g=n.R.Clamp(this.g,e,t),i.b=n.R.Clamp(this.b,e,t),i.a=n.R.Clamp(this.a,e,t),this},e.prototype.multiply=function(t){return new e(this.r*t.r,this.g*t.g,this.b*t.b,this.a*t.a)},e.prototype.multiplyToRef=function(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t.a=this.a*e.a,t},e.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"},e.prototype.getClassName=function(){return"Color4"},e.prototype.getHashCode=function(){var e=255*this.r|0;return e=397*(e=397*(e=397*e^(255*this.g|0))^(255*this.b|0))^(255*this.a|0)},e.prototype.clone=function(){return new e(this.r,this.g,this.b,this.a)},e.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this},e.prototype.copyFromFloats=function(e,t,i,n){return this.r=e,this.g=t,this.b=i,this.a=n,this},e.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},e.prototype.toHexString=function(e){void 0===e&&(e=!1);var t=255*this.r|0,i=255*this.g|0,r=255*this.b|0;if(e)return"#"+n.R.ToHex(t)+n.R.ToHex(i)+n.R.ToHex(r);var o=255*this.a|0;return"#"+n.R.ToHex(t)+n.R.ToHex(i)+n.R.ToHex(r)+n.R.ToHex(o)},e.prototype.toLinearSpace=function(){var t=new e;return this.toLinearSpaceToRef(t),t},e.prototype.toLinearSpaceToRef=function(e){return e.r=Math.pow(this.r,r.Nn),e.g=Math.pow(this.g,r.Nn),e.b=Math.pow(this.b,r.Nn),e.a=this.a,this},e.prototype.toGammaSpace=function(){var t=new e;return this.toGammaSpaceToRef(t),t},e.prototype.toGammaSpaceToRef=function(e){return e.r=Math.pow(this.r,r.zp),e.g=Math.pow(this.g,r.zp),e.b=Math.pow(this.b,r.zp),e.a=this.a,this},e.FromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length)return new e(0,0,0,0);var i=parseInt(t.substring(1,3),16),n=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16),o=parseInt(t.substring(7,9),16);return e.FromInts(i,n,r,o)},e.Lerp=function(t,i,n){var r=new e(0,0,0,0);return e.LerpToRef(t,i,n,r),r},e.LerpToRef=function(e,t,i,n){n.r=e.r+(t.r-e.r)*i,n.g=e.g+(t.g-e.g)*i,n.b=e.b+(t.b-e.b)*i,n.a=e.a+(t.a-e.a)*i},e.FromColor3=function(t,i){return void 0===i&&(i=1),new e(t.r,t.g,t.b,i)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1],t[i+2],t[i+3])},e.FromArrayToRef=function(e,t,i){void 0===t&&(t=0),i.r=e[t],i.g=e[t+1],i.b=e[t+2],i.a=e[t+3]},e.FromInts=function(t,i,n,r){return new e(t/255,i/255,n/255,r/255)},e.CheckColors4=function(e,t){if(e.length===3*t){for(var i=[],n=0;n{"use strict";i.d(t,{zp:()=>n,Nn:()=>r,kn:()=>o});var n=1/2.2,r=2.2,o=.001},131:(e,t,i)=>{"use strict";i.d(t,{i:()=>r});var n=i(3405),r=function(){function e(){}return e.GetPlanes=function(t){for(var i=[],r=0;r<6;r++)i.push(new n.J(0,0,0,0));return e.GetPlanesToRef(t,i),i},e.GetNearPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]+i[2],t.normal.y=i[7]+i[6],t.normal.z=i[11]+i[10],t.d=i[15]+i[14],t.normalize()},e.GetFarPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]-i[2],t.normal.y=i[7]-i[6],t.normal.z=i[11]-i[10],t.d=i[15]-i[14],t.normalize()},e.GetLeftPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]+i[0],t.normal.y=i[7]+i[4],t.normal.z=i[11]+i[8],t.d=i[15]+i[12],t.normalize()},e.GetRightPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]-i[0],t.normal.y=i[7]-i[4],t.normal.z=i[11]-i[8],t.d=i[15]-i[12],t.normalize()},e.GetTopPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]-i[1],t.normal.y=i[7]-i[5],t.normal.z=i[11]-i[9],t.d=i[15]-i[13],t.normalize()},e.GetBottomPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]+i[1],t.normal.y=i[7]+i[5],t.normal.z=i[11]+i[9],t.d=i[15]+i[13],t.normalize()},e.GetPlanesToRef=function(t,i){e.GetNearPlaneToRef(t,i[0]),e.GetFarPlaneToRef(t,i[1]),e.GetLeftPlaneToRef(t,i[2]),e.GetRightPlaneToRef(t,i[3]),e.GetTopPlaneToRef(t,i[4]),e.GetBottomPlaneToRef(t,i[5])},e}()},5168:(e,t,i)=>{"use strict";i.d(t,{y:()=>r,k:()=>o});var n=i(2973);function r(e,t,i,r,o){void 0===o&&(o=null);for(var s=new n.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),a=new n.P(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),l=i;l{"use strict";i.r(t),i.d(t,{Angle:()=>a.RZ,Arc2:()=>a.Q,Axis:()=>n.RD,BezierCurve:()=>a.hr,Color3:()=>r.Wo,Color4:()=>r.HE,Coordinate:()=>n.c7,Curve3:()=>a.j_,Epsilon:()=>o.kn,Frustum:()=>s.i,Matrix:()=>c.y3,Orientation:()=>a.i5,Path2:()=>a.ZZ,Path3D:()=>a.$B,Plane:()=>l.J,PositionNormalTextureVertex:()=>f,PositionNormalVertex:()=>u,Quaternion:()=>c._f,Size:()=>h.$,Space:()=>n.T,TmpColors:()=>r.zZ,TmpVectors:()=>c.jp,ToGammaSpace:()=>o.zp,ToLinearSpace:()=>o.Nn,Vector2:()=>c.FM,Vector3:()=>c.P,Vector4:()=>c.Lt,Viewport:()=>d.l});var n=i(9068),r=i(8362),o=i(2782),s=i(131),a=i(7580),l=i(3405),h=i(488),c=i(2973),u=function(){function e(e,t){void 0===e&&(e=c.P.Zero()),void 0===t&&(t=c.P.Up()),this.position=e,this.normal=t}return e.prototype.clone=function(){return new e(this.position.clone(),this.normal.clone())},e}(),f=function(){function e(e,t,i){void 0===e&&(e=c.P.Zero()),void 0===t&&(t=c.P.Up()),void 0===i&&(i=c.FM.Zero()),this.position=e,this.normal=t,this.uv=i}return e.prototype.clone=function(){return new e(this.position.clone(),this.normal.clone(),this.uv.clone())},e}(),d=i(4272)},7580:(e,t,i)=>{"use strict";i.d(t,{i5:()=>n,hr:()=>a,RZ:()=>l,Q:()=>h,ZZ:()=>c,$B:()=>u,j_:()=>f});var n,r=i(9018),o=i(2973),s=i(2782);!function(e){e[e.CW=0]="CW",e[e.CCW=1]="CCW"}(n||(n={}));var a=function(){function e(){}return e.Interpolate=function(e,t,i,n,r){for(var o=1-3*n+3*t,s=3*n-6*t,a=3*t,l=e,h=0;h<5;h++){var c=l*l;l-=(o*(c*l)+s*c+a*l-e)*(1/(3*o*c+2*s*l+a)),l=Math.min(1,Math.max(0,l))}return 3*Math.pow(1-l,2)*l*i+3*(1-l)*Math.pow(l,2)*r+Math.pow(l,3)},e}(),l=function(){function e(e){this._radians=e,this._radians<0&&(this._radians+=2*Math.PI)}return e.prototype.degrees=function(){return 180*this._radians/Math.PI},e.prototype.radians=function(){return this._radians},e.BetweenTwoPoints=function(t,i){var n=i.subtract(t);return new e(Math.atan2(n.y,n.x))},e.FromRadians=function(t){return new e(t)},e.FromDegrees=function(t){return new e(t*Math.PI/180)},e}(),h=function(e,t,i){this.startPoint=e,this.midPoint=t,this.endPoint=i;var r=Math.pow(t.x,2)+Math.pow(t.y,2),s=(Math.pow(e.x,2)+Math.pow(e.y,2)-r)/2,a=(r-Math.pow(i.x,2)-Math.pow(i.y,2))/2,h=(e.x-t.x)*(t.y-i.y)-(t.x-i.x)*(e.y-t.y);this.centerPoint=new o.FM((s*(t.y-i.y)-a*(e.y-t.y))/h,((e.x-t.x)*a-(t.x-i.x)*s)/h),this.radius=this.centerPoint.subtract(this.startPoint).length(),this.startAngle=l.BetweenTwoPoints(this.centerPoint,this.startPoint);var c=this.startAngle.degrees(),u=l.BetweenTwoPoints(this.centerPoint,this.midPoint).degrees(),f=l.BetweenTwoPoints(this.centerPoint,this.endPoint).degrees();u-c>180&&(u-=360),u-c<-180&&(u+=360),f-u>180&&(f-=360),f-u<-180&&(f+=360),this.orientation=u-c<0?n.CW:n.CCW,this.angle=l.FromDegrees(this.orientation===n.CW?c-f:f-c)},c=function(){function e(e,t){this._points=new Array,this._length=0,this.closed=!1,this._points.push(new o.FM(e,t))}return e.prototype.addLineTo=function(e,t){if(this.closed)return this;var i=new o.FM(e,t),n=this._points[this._points.length-1];return this._points.push(i),this._length+=i.subtract(n).length(),this},e.prototype.addArcTo=function(e,t,i,r,s){if(void 0===s&&(s=36),this.closed)return this;var a=this._points[this._points.length-1],l=new o.FM(e,t),c=new o.FM(i,r),u=new h(a,l,c),f=u.angle.radians()/s;u.orientation===n.CW&&(f*=-1);for(var d=u.startAngle.radians()+f,p=0;p1)return o.FM.Zero();for(var t=e*this.length(),i=0,n=0;n=i&&t<=l){var h=a.normalize(),c=t-i;return new o.FM(s.x+h.x*c,s.y+h.y*c)}i=l}return o.FM.Zero()},e.StartingAt=function(t,i){return new e(t,i)},e}(),u=function(){function e(e,t,i,n){void 0===t&&(t=null),void 0===n&&(n=!1),this.path=e,this._curve=new Array,this._distances=new Array,this._tangents=new Array,this._normals=new Array,this._binormals=new Array,this._pointAtData={id:0,point:o.P.Zero(),previousPointArrayIndex:0,position:0,subPosition:0,interpolateReady:!1,interpolationMatrix:o.y3.Identity()};for(var r=0;ri){var n=t;t=i,i=n}var r=this.getCurve(),o=this.getPointAt(t),s=this.getPreviousPointIndexAt(t),a=this.getPointAt(i),l=this.getPreviousPointIndexAt(i)+1,h=[];return 0!==t&&(s++,h.push(o)),h.push.apply(h,r.slice(s,l)),1===i&&1!==t||h.push(a),new e(h,this.getNormalAt(t),this._raw,this._alignTangentsWithPath)},e.prototype.update=function(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!1);for(var n=0;nt+1;)t++,i=this._curve[e].subtract(this._curve[e-t]);return i},e.prototype._normalVector=function(e,t){var i,n,a=e.length();(0===a&&(a=1),null==t)?(n=r.R.WithinEpsilon(Math.abs(e.y)/a,1,s.kn)?r.R.WithinEpsilon(Math.abs(e.x)/a,1,s.kn)?r.R.WithinEpsilon(Math.abs(e.z)/a,1,s.kn)?o.P.Zero():new o.P(0,0,1):new o.P(1,0,0):new o.P(0,-1,0),i=o.P.Cross(e,n)):(i=o.P.Cross(e,t),o.P.CrossToRef(i,e,i));return i.normalize(),i},e.prototype._updatePointAtData=function(e,t){if(void 0===t&&(t=!1),this._pointAtData.id===e)return this._pointAtData.interpolateReady||this._updateInterpolationMatrix(),this._pointAtData;this._pointAtData.id=e;var i=this.getPoints();if(e<=0)return this._setPointAtData(0,0,i[0],0,t);if(e>=1)return this._setPointAtData(1,1,i[i.length-1],i.length-1,t);for(var n,r=i[0],s=0,a=e*this.length(),l=1;la){var c=(s-a)/h,u=r.subtract(n),f=n.add(u.scaleInPlace(c));return this._setPointAtData(e,1-c,f,l-1,t)}r=n}return this._pointAtData},e.prototype._setPointAtData=function(e,t,i,n,r){return this._pointAtData.point=i,this._pointAtData.position=e,this._pointAtData.subPosition=t,this._pointAtData.previousPointArrayIndex=n,this._pointAtData.interpolateReady=r,r&&this._updateInterpolationMatrix(),this._pointAtData},e.prototype._updateInterpolationMatrix=function(){this._pointAtData.interpolationMatrix=o.y3.Identity();var e=this._pointAtData.previousPointArrayIndex;if(e!==this._tangents.length-1){var t=e+1,i=this._tangents[e].clone(),n=this._normals[e].clone(),r=this._binormals[e].clone(),s=this._tangents[t].clone(),a=this._normals[t].clone(),l=this._binormals[t].clone(),h=o._f.RotationQuaternionFromAxis(n,r,i),c=o._f.RotationQuaternionFromAxis(a,l,s);o._f.Slerp(h,c,this._pointAtData.subPosition).toRotationMatrix(this._pointAtData.interpolationMatrix)}},e}(),f=function(){function e(e){this._length=0,this._points=e,this._length=this._computeLength(e)}return e.CreateQuadraticBezier=function(t,i,n,r){r=r>2?r:3;for(var s=new Array,a=function(e,t,i,n){return(1-e)*(1-e)*t+2*e*(1-e)*i+e*e*n},l=0;l<=r;l++)s.push(new o.P(a(l/r,t.x,i.x,n.x),a(l/r,t.y,i.y,n.y),a(l/r,t.z,i.z,n.z)));return new e(s)},e.CreateCubicBezier=function(t,i,n,r,s){s=s>3?s:4;for(var a=new Array,l=function(e,t,i,n,r){return(1-e)*(1-e)*(1-e)*t+3*e*(1-e)*(1-e)*i+3*e*e*(1-e)*n+e*e*e*r},h=0;h<=s;h++)a.push(new o.P(l(h/s,t.x,i.x,n.x,r.x),l(h/s,t.y,i.y,n.y,r.y),l(h/s,t.z,i.z,n.z,r.z)));return new e(a)},e.CreateHermiteSpline=function(t,i,n,r,s){for(var a=new Array,l=1/s,h=0;h<=s;h++)a.push(o.P.Hermite(t,i,n,r,h*l));return new e(a)},e.CreateCatmullRomSpline=function(t,i,n){var r=new Array,s=1/i,a=0;if(n){for(var l=t.length,h=0;h{"use strict";i.d(t,{J:()=>r});var n=i(2973),r=function(){function e(e,t,i,r){this.normal=new n.P(e,t,i),this.d=r}return e.prototype.asArray=function(){return[this.normal.x,this.normal.y,this.normal.z,this.d]},e.prototype.clone=function(){return new e(this.normal.x,this.normal.y,this.normal.z,this.d)},e.prototype.getClassName=function(){return"Plane"},e.prototype.getHashCode=function(){var e=this.normal.getHashCode();return e=397*e^(0|this.d)},e.prototype.normalize=function(){var e=Math.sqrt(this.normal.x*this.normal.x+this.normal.y*this.normal.y+this.normal.z*this.normal.z),t=0;return 0!==e&&(t=1/e),this.normal.x*=t,this.normal.y*=t,this.normal.z*=t,this.d*=t,this},e.prototype.transform=function(t){var i=e._TmpMatrix;t.invertToRef(i);var n=i.m,r=this.normal.x,o=this.normal.y,s=this.normal.z,a=this.d;return new e(r*n[0]+o*n[1]+s*n[2]+a*n[3],r*n[4]+o*n[5]+s*n[6]+a*n[7],r*n[8]+o*n[9]+s*n[10]+a*n[11],r*n[12]+o*n[13]+s*n[14]+a*n[15])},e.prototype.dotCoordinate=function(e){return this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z+this.d},e.prototype.copyFromPoints=function(e,t,i){var n,r=t.x-e.x,o=t.y-e.y,s=t.z-e.z,a=i.x-e.x,l=i.y-e.y,h=i.z-e.z,c=o*h-s*l,u=s*a-r*h,f=r*l-o*a,d=Math.sqrt(c*c+u*u+f*f);return n=0!==d?1/d:0,this.normal.x=c*n,this.normal.y=u*n,this.normal.z=f*n,this.d=-(this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z),this},e.prototype.isFrontFacingTo=function(e,t){return n.P.Dot(this.normal,e)<=t},e.prototype.signedDistanceTo=function(e){return n.P.Dot(e,this.normal)+this.d},e.FromArray=function(t){return new e(t[0],t[1],t[2],t[3])},e.FromPoints=function(t,i,n){var r=new e(0,0,0,0);return r.copyFromPoints(t,i,n),r},e.FromPositionAndNormal=function(t,i){var n=new e(0,0,0,0);return i.normalize(),n.normal=i,n.d=-(i.x*t.x+i.y*t.y+i.z*t.z),n},e.SignedDistanceToPlaneFromPositionAndNormal=function(e,t,i){var r=-(t.x*e.x+t.y*e.y+t.z*e.z);return n.P.Dot(i,t)+r},e._TmpMatrix=n.y3.Identity(),e}()},9018:(e,t,i)=>{"use strict";i.d(t,{R:()=>n});var n=function(){function e(){}return e.WithinEpsilon=function(e,t,i){void 0===i&&(i=1401298e-51);var n=e-t;return-i<=n&&n<=i},e.ToHex=function(e){var t=e.toString(16);return e<=15?("0"+t).toUpperCase():t.toUpperCase()},e.Sign=function(e){return 0===(e=+e)||isNaN(e)?e:e>0?1:-1},e.Clamp=function(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=1),Math.min(i,Math.max(t,e))},e.Log2=function(e){return Math.log(e)*Math.LOG2E},e.Repeat=function(e,t){return e-Math.floor(e/t)*t},e.Normalize=function(e,t,i){return(e-t)/(i-t)},e.Denormalize=function(e,t,i){return e*(i-t)+t},e.DeltaAngle=function(t,i){var n=e.Repeat(i-t,360);return n>180&&(n-=360),n},e.PingPong=function(t,i){var n=e.Repeat(t,2*i);return i-Math.abs(n-i)},e.SmoothStep=function(t,i,n){var r=e.Clamp(n);return i*(r=-2*r*r*r+3*r*r)+t*(1-r)},e.MoveTowards=function(t,i,n){return Math.abs(i-t)<=n?i:t+e.Sign(i-t)*n},e.MoveTowardsAngle=function(t,i,n){var r=e.DeltaAngle(t,i),o=0;return-n180&&(r-=360),t+r*e.Clamp(n)},e.InverseLerp=function(t,i,n){return t!=i?e.Clamp((n-t)/(i-t)):0},e.Hermite=function(e,t,i,n,r){var o=r*r,s=r*o;return e*(2*s-3*o+1)+i*(-2*s+3*o)+t*(s-2*o+r)+n*(s-o)},e.RandomRange=function(e,t){return e===t?e:Math.random()*(t-e)+e},e.RangeToPercent=function(e,t,i){return(e-t)/(i-t)},e.PercentToRange=function(e,t,i){return(i-t)*e+t},e.NormalizeRadians=function(t){return t-=e.TwoPi*Math.floor((t+Math.PI)/e.TwoPi)},e.TwoPi=2*Math.PI,e}()},488:(e,t,i)=>{"use strict";i.d(t,{$:()=>n});var n=function(){function e(e,t){this.width=e,this.height=t}return e.prototype.toString=function(){return"{W: "+this.width+", H: "+this.height+"}"},e.prototype.getClassName=function(){return"Size"},e.prototype.getHashCode=function(){var e=0|this.width;return e=397*e^(0|this.height)},e.prototype.copyFrom=function(e){this.width=e.width,this.height=e.height},e.prototype.copyFromFloats=function(e,t){return this.width=e,this.height=t,this},e.prototype.set=function(e,t){return this.copyFromFloats(e,t)},e.prototype.multiplyByFloats=function(t,i){return new e(this.width*t,this.height*i)},e.prototype.clone=function(){return new e(this.width,this.height)},e.prototype.equals=function(e){return!!e&&(this.width===e.width&&this.height===e.height)},Object.defineProperty(e.prototype,"surface",{get:function(){return this.width*this.height},enumerable:!1,configurable:!0}),e.Zero=function(){return new e(0,0)},e.prototype.add=function(t){return new e(this.width+t.width,this.height+t.height)},e.prototype.subtract=function(t){return new e(this.width-t.width,this.height-t.height)},e.Lerp=function(t,i,n){return new e(t.width+(i.width-t.width)*n,t.height+(i.height-t.height)*n)},e}()},2973:(e,t,i)=>{"use strict";i.d(t,{FM:()=>l,P:()=>h,Lt:()=>c,_f:()=>u,y3:()=>f,jp:()=>p});var n=i(9018),r=i(2782),o=i(8035),s=i(6132),a=i(8868),l=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=0),this.x=e,this.y=t}return e.prototype.toString=function(){return"{X: "+this.x+" Y: "+this.y+"}"},e.prototype.getClassName=function(){return"Vector2"},e.prototype.getHashCode=function(){var e=0|this.x;return e=397*e^(0|this.y)},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,this},e.prototype.fromArray=function(t,i){return void 0===i&&(i=0),e.FromArrayToRef(t,i,this),this},e.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},e.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this},e.prototype.copyFromFloats=function(e,t){return this.x=e,this.y=t,this},e.prototype.set=function(e,t){return this.copyFromFloats(e,t)},e.prototype.add=function(t){return new e(this.x+t.x,this.y+t.y)},e.prototype.addToRef=function(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,this},e.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this},e.prototype.addVector3=function(t){return new e(this.x+t.x,this.y+t.y)},e.prototype.subtract=function(t){return new e(this.x-t.x,this.y-t.y)},e.prototype.subtractToRef=function(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,this},e.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.y,this},e.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this},e.prototype.multiply=function(t){return new e(this.x*t.x,this.y*t.y)},e.prototype.multiplyToRef=function(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,this},e.prototype.multiplyByFloats=function(t,i){return new e(this.x*t,this.y*i)},e.prototype.divide=function(t){return new e(this.x/t.x,this.y/t.y)},e.prototype.divideToRef=function(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,this},e.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},e.prototype.negate=function(){return new e(-this.x,-this.y)},e.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this},e.prototype.negateToRef=function(e){return e.copyFromFloats(-1*this.x,-1*this.y)},e.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this},e.prototype.scale=function(t){var i=new e(0,0);return this.scaleToRef(t,i),i},e.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,this},e.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y},e.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=r.kn),e&&n.R.WithinEpsilon(this.x,e.x,t)&&n.R.WithinEpsilon(this.y,e.y,t)},e.prototype.floor=function(){return new e(Math.floor(this.x),Math.floor(this.y))},e.prototype.fract=function(){return new e(this.x-Math.floor(this.x),this.y-Math.floor(this.y))},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.prototype.normalize=function(){var e=this.length();return 0===e||(this.x/=e,this.y/=e),this},e.prototype.clone=function(){return new e(this.x,this.y)},e.Zero=function(){return new e(0,0)},e.One=function(){return new e(1,1)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1])},e.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1]},e.CatmullRom=function(t,i,n,r,o){var s=o*o,a=o*s;return new e(.5*(2*i.x+(-t.x+n.x)*o+(2*t.x-5*i.x+4*n.x-r.x)*s+(-t.x+3*i.x-3*n.x+r.x)*a),.5*(2*i.y+(-t.y+n.y)*o+(2*t.y-5*i.y+4*n.y-r.y)*s+(-t.y+3*i.y-3*n.y+r.y)*a))},e.Clamp=function(t,i,n){var r=t.x;r=(r=r>n.x?n.x:r)n.y?n.y:o)i.x?t.x:i.x,t.y>i.y?t.y:i.y)},e.Transform=function(t,i){var n=e.Zero();return e.TransformToRef(t,i,n),n},e.TransformToRef=function(e,t,i){var n=t.m,r=e.x*n[0]+e.y*n[4]+n[12],o=e.x*n[1]+e.y*n[5]+n[13];i.x=r,i.y=o},e.PointInTriangle=function(e,t,i,n){var r=.5*(-i.y*n.x+t.y*(-i.x+n.x)+t.x*(i.y-n.y)+i.x*n.y),o=r<0?-1:1,s=(t.y*n.x-t.x*n.y+(n.y-t.y)*e.x+(t.x-n.x)*e.y)*o,a=(t.x*i.y-t.y*i.x+(t.y-i.y)*e.x+(i.x-t.x)*e.y)*o;return s>0&&a>0&&s+a<2*r*o},e.Distance=function(t,i){return Math.sqrt(e.DistanceSquared(t,i))},e.DistanceSquared=function(e,t){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n},e.Center=function(e,t){var i=e.add(t);return i.scaleInPlace(.5),i},e.DistanceOfPointFromSegment=function(t,i,n){var r=e.DistanceSquared(i,n);if(0===r)return e.Distance(t,i);var o=n.subtract(i),s=Math.max(0,Math.min(1,e.Dot(t.subtract(i),o)/r)),a=i.add(o.multiplyByFloats(s,s));return e.Distance(t,a)},e}(),h=function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this._isDirty=!0,this._x=e,this._y=t,this._z=i}return Object.defineProperty(e.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"z",{get:function(){return this._z},set:function(e){this._z=e,this._isDirty=!0},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return"{X: "+this._x+" Y:"+this._y+" Z:"+this._z+"}"},e.prototype.getClassName=function(){return"Vector3"},e.prototype.getHashCode=function(){var e=0|this._x;return e=397*(e=397*e^(0|this._y))^(0|this._z)},e.prototype.asArray=function(){var e=[];return this.toArray(e,0),e},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,this},e.prototype.fromArray=function(t,i){return void 0===i&&(i=0),e.FromArrayToRef(t,i,this),this},e.prototype.toQuaternion=function(){return u.RotationYawPitchRoll(this._y,this._x,this._z)},e.prototype.addInPlace=function(e){return this.addInPlaceFromFloats(e._x,e._y,e._z)},e.prototype.addInPlaceFromFloats=function(e,t,i){return this.x+=e,this.y+=t,this.z+=i,this},e.prototype.add=function(t){return new e(this._x+t._x,this._y+t._y,this._z+t._z)},e.prototype.addToRef=function(e,t){return t.copyFromFloats(this._x+e._x,this._y+e._y,this._z+e._z)},e.prototype.subtractInPlace=function(e){return this.x-=e._x,this.y-=e._y,this.z-=e._z,this},e.prototype.subtract=function(t){return new e(this._x-t._x,this._y-t._y,this._z-t._z)},e.prototype.subtractToRef=function(e,t){return this.subtractFromFloatsToRef(e._x,e._y,e._z,t)},e.prototype.subtractFromFloats=function(t,i,n){return new e(this._x-t,this._y-i,this._z-n)},e.prototype.subtractFromFloatsToRef=function(e,t,i,n){return n.copyFromFloats(this._x-e,this._y-t,this._z-i)},e.prototype.negate=function(){return new e(-this._x,-this._y,-this._z)},e.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},e.prototype.negateToRef=function(e){return e.copyFromFloats(-1*this._x,-1*this._y,-1*this._z)},e.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this},e.prototype.scale=function(t){return new e(this._x*t,this._y*t,this._z*t)},e.prototype.scaleToRef=function(e,t){return t.copyFromFloats(this._x*e,this._y*e,this._z*e)},e.prototype.scaleAndAddToRef=function(e,t){return t.addInPlaceFromFloats(this._x*e,this._y*e,this._z*e)},e.prototype.projectOnPlane=function(t,i){var n=e.Zero();return this.projectOnPlaneToRef(t,i,n),n},e.prototype.projectOnPlaneToRef=function(t,i,n){var r=t.normal,o=t.d,s=d.Vector3[0];this.subtractToRef(i,s),s.normalize();var a=e.Dot(s,r),l=-(e.Dot(i,r)+o)/a,h=s.scaleInPlace(l);i.addToRef(h,n)},e.prototype.equals=function(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z},e.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=r.kn),e&&n.R.WithinEpsilon(this._x,e._x,t)&&n.R.WithinEpsilon(this._y,e._y,t)&&n.R.WithinEpsilon(this._z,e._z,t)},e.prototype.equalsToFloats=function(e,t,i){return this._x===e&&this._y===t&&this._z===i},e.prototype.multiplyInPlace=function(e){return this.x*=e._x,this.y*=e._y,this.z*=e._z,this},e.prototype.multiply=function(e){return this.multiplyByFloats(e._x,e._y,e._z)},e.prototype.multiplyToRef=function(e,t){return t.copyFromFloats(this._x*e._x,this._y*e._y,this._z*e._z)},e.prototype.multiplyByFloats=function(t,i,n){return new e(this._x*t,this._y*i,this._z*n)},e.prototype.divide=function(t){return new e(this._x/t._x,this._y/t._y,this._z/t._z)},e.prototype.divideToRef=function(e,t){return t.copyFromFloats(this._x/e._x,this._y/e._y,this._z/e._z)},e.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},e.prototype.minimizeInPlace=function(e){return this.minimizeInPlaceFromFloats(e._x,e._y,e._z)},e.prototype.maximizeInPlace=function(e){return this.maximizeInPlaceFromFloats(e._x,e._y,e._z)},e.prototype.minimizeInPlaceFromFloats=function(e,t,i){return ethis._x&&(this.x=e),t>this._y&&(this.y=t),i>this._z&&(this.z=i),this},e.prototype.isNonUniformWithinEpsilon=function(e){var t=Math.abs(this._x),i=Math.abs(this._y);if(!n.R.WithinEpsilon(t,i,e))return!0;var r=Math.abs(this._z);return!n.R.WithinEpsilon(t,r,e)||!n.R.WithinEpsilon(i,r,e)},Object.defineProperty(e.prototype,"isNonUniform",{get:function(){var e=Math.abs(this._x);return e!==Math.abs(this._y)||e!==Math.abs(this._z)},enumerable:!1,configurable:!0}),e.prototype.floor=function(){return new e(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))},e.prototype.fract=function(){return new e(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))},e.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z)},e.prototype.lengthSquared=function(){return this._x*this._x+this._y*this._y+this._z*this._z},e.prototype.normalize=function(){return this.normalizeFromLength(this.length())},e.prototype.reorderInPlace=function(e){var t=this;return"xyz"===(e=e.toLowerCase())||(d.Vector3[0].copyFrom(this),["x","y","z"].forEach((function(i,n){t[i]=d.Vector3[0][e[n]]}))),this},e.prototype.rotateByQuaternionToRef=function(t,i){return t.toRotationMatrix(d.Matrix[0]),e.TransformCoordinatesToRef(this,d.Matrix[0],i),i},e.prototype.rotateByQuaternionAroundPointToRef=function(e,t,i){return this.subtractToRef(t,d.Vector3[0]),d.Vector3[0].rotateByQuaternionToRef(e,d.Vector3[0]),t.addToRef(d.Vector3[0],i),i},e.prototype.cross=function(t){return e.Cross(this,t)},e.prototype.normalizeFromLength=function(e){return 0===e||1===e?this:this.scaleInPlace(1/e)},e.prototype.normalizeToNew=function(){var t=new e(0,0,0);return this.normalizeToRef(t),t},e.prototype.normalizeToRef=function(e){var t=this.length();return 0===t||1===t?e.copyFromFloats(this._x,this._y,this._z):this.scaleToRef(1/t,e)},e.prototype.clone=function(){return new e(this._x,this._y,this._z)},e.prototype.copyFrom=function(e){return this.copyFromFloats(e._x,e._y,e._z)},e.prototype.copyFromFloats=function(e,t,i){return this.x=e,this.y=t,this.z=i,this},e.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},e.prototype.setAll=function(e){return this.x=this.y=this.z=e,this},e.GetClipFactor=function(t,i,n,r){var o=e.Dot(t,n)-r;return o/(o-(e.Dot(i,n)-r))},e.GetAngleBetweenVectors=function(t,i,n){var r=t.normalizeToRef(d.Vector3[1]),o=i.normalizeToRef(d.Vector3[2]),s=e.Dot(r,o),a=d.Vector3[3];return e.CrossToRef(r,o,a),e.Dot(a,n)>0?Math.acos(s):-Math.acos(s)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1],t[i+2])},e.FromFloatArray=function(t,i){return e.FromArray(t,i)},e.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2]},e.FromFloatArrayToRef=function(t,i,n){return e.FromArrayToRef(t,i,n)},e.FromFloatsToRef=function(e,t,i,n){n.copyFromFloats(e,t,i)},e.Zero=function(){return new e(0,0,0)},e.One=function(){return new e(1,1,1)},e.Up=function(){return new e(0,1,0)},Object.defineProperty(e,"UpReadOnly",{get:function(){return e._UpReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ZeroReadOnly",{get:function(){return e._ZeroReadOnly},enumerable:!1,configurable:!0}),e.Down=function(){return new e(0,-1,0)},e.Forward=function(t){return void 0===t&&(t=!1),new e(0,0,t?-1:1)},e.Backward=function(t){return void 0===t&&(t=!1),new e(0,0,t?1:-1)},e.Right=function(){return new e(1,0,0)},e.Left=function(){return new e(-1,0,0)},e.TransformCoordinates=function(t,i){var n=e.Zero();return e.TransformCoordinatesToRef(t,i,n),n},e.TransformCoordinatesToRef=function(t,i,n){e.TransformCoordinatesFromFloatsToRef(t._x,t._y,t._z,i,n)},e.TransformCoordinatesFromFloatsToRef=function(e,t,i,n,r){var o=n.m,s=e*o[0]+t*o[4]+i*o[8]+o[12],a=e*o[1]+t*o[5]+i*o[9]+o[13],l=e*o[2]+t*o[6]+i*o[10]+o[14],h=1/(e*o[3]+t*o[7]+i*o[11]+o[15]);r.x=s*h,r.y=a*h,r.z=l*h},e.TransformNormal=function(t,i){var n=e.Zero();return e.TransformNormalToRef(t,i,n),n},e.TransformNormalToRef=function(e,t,i){this.TransformNormalFromFloatsToRef(e._x,e._y,e._z,t,i)},e.TransformNormalFromFloatsToRef=function(e,t,i,n,r){var o=n.m;r.x=e*o[0]+t*o[4]+i*o[8],r.y=e*o[1]+t*o[5]+i*o[9],r.z=e*o[2]+t*o[6]+i*o[10]},e.CatmullRom=function(t,i,n,r,o){var s=o*o,a=o*s;return new e(.5*(2*i._x+(-t._x+n._x)*o+(2*t._x-5*i._x+4*n._x-r._x)*s+(-t._x+3*i._x-3*n._x+r._x)*a),.5*(2*i._y+(-t._y+n._y)*o+(2*t._y-5*i._y+4*n._y-r._y)*s+(-t._y+3*i._y-3*n._y+r._y)*a),.5*(2*i._z+(-t._z+n._z)*o+(2*t._z-5*i._z+4*n._z-r._z)*s+(-t._z+3*i._z-3*n._z+r._z)*a))},e.Clamp=function(t,i,n){var r=new e;return e.ClampToRef(t,i,n,r),r},e.ClampToRef=function(e,t,i,n){var r=e._x;r=(r=r>i._x?i._x:r)i._y?i._y:o)i._z?i._z:s)this.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),e.z>this.z&&(this.z=e.z),e.w>this.w&&(this.w=e.w),this},e.prototype.floor=function(){return new e(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w))},e.prototype.fract=function(){return new e(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z),this.w-Math.floor(this.w))},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.prototype.normalize=function(){var e=this.length();return 0===e?this:this.scaleInPlace(1/e)},e.prototype.toVector3=function(){return new h(this.x,this.y,this.z)},e.prototype.clone=function(){return new e(this.x,this.y,this.z,this.w)},e.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},e.prototype.copyFromFloats=function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},e.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},e.prototype.setAll=function(e){return this.x=this.y=this.z=this.w=e,this},e.FromArray=function(t,i){return i||(i=0),new e(t[i],t[i+1],t[i+2],t[i+3])},e.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3]},e.FromFloatArrayToRef=function(t,i,n){e.FromArrayToRef(t,i,n)},e.FromFloatsToRef=function(e,t,i,n,r){r.x=e,r.y=t,r.z=i,r.w=n},e.Zero=function(){return new e(0,0,0,0)},e.One=function(){return new e(1,1,1,1)},e.Normalize=function(t){var i=e.Zero();return e.NormalizeToRef(t,i),i},e.NormalizeToRef=function(e,t){t.copyFrom(e),t.normalize()},e.Minimize=function(e,t){var i=e.clone();return i.minimizeInPlace(t),i},e.Maximize=function(e,t){var i=e.clone();return i.maximizeInPlace(t),i},e.Distance=function(t,i){return Math.sqrt(e.DistanceSquared(t,i))},e.DistanceSquared=function(e,t){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,o=e.w-t.w;return i*i+n*n+r*r+o*o},e.Center=function(e,t){var i=e.add(t);return i.scaleInPlace(.5),i},e.TransformNormal=function(t,i){var n=e.Zero();return e.TransformNormalToRef(t,i,n),n},e.TransformNormalToRef=function(e,t,i){var n=t.m,r=e.x*n[0]+e.y*n[4]+e.z*n[8],o=e.x*n[1]+e.y*n[5]+e.z*n[9],s=e.x*n[2]+e.y*n[6]+e.z*n[10];i.x=r,i.y=o,i.z=s,i.w=e.w},e.TransformNormalFromFloatsToRef=function(e,t,i,n,r,o){var s=r.m;o.x=e*s[0]+t*s[4]+i*s[8],o.y=e*s[1]+t*s[5]+i*s[9],o.z=e*s[2]+t*s[6]+i*s[10],o.w=n},e.FromVector3=function(t,i){return void 0===i&&(i=0),new e(t._x,t._y,t._z,i)},e}(),u=function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),this._isDirty=!0,this._x=e,this._y=t,this._z=i,this._w=n}return Object.defineProperty(e.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"z",{get:function(){return this._z},set:function(e){this._z=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"w",{get:function(){return this._w},set:function(e){this._w=e,this._isDirty=!0},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return"{X: "+this._x+" Y:"+this._y+" Z:"+this._z+" W:"+this._w+"}"},e.prototype.getClassName=function(){return"Quaternion"},e.prototype.getHashCode=function(){var e=0|this._x;return e=397*(e=397*(e=397*e^(0|this._y))^(0|this._z))^(0|this._w)},e.prototype.asArray=function(){return[this._x,this._y,this._z,this._w]},e.prototype.equals=function(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z&&this._w===e._w},e.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=r.kn),e&&n.R.WithinEpsilon(this._x,e._x,t)&&n.R.WithinEpsilon(this._y,e._y,t)&&n.R.WithinEpsilon(this._z,e._z,t)&&n.R.WithinEpsilon(this._w,e._w,t)},e.prototype.clone=function(){return new e(this._x,this._y,this._z,this._w)},e.prototype.copyFrom=function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this.w=e._w,this},e.prototype.copyFromFloats=function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},e.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},e.prototype.add=function(t){return new e(this._x+t._x,this._y+t._y,this._z+t._z,this._w+t._w)},e.prototype.addInPlace=function(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._w+=e._w,this},e.prototype.subtract=function(t){return new e(this._x-t._x,this._y-t._y,this._z-t._z,this._w-t._w)},e.prototype.scale=function(t){return new e(this._x*t,this._y*t,this._z*t,this._w*t)},e.prototype.scaleToRef=function(e,t){return t.x=this._x*e,t.y=this._y*e,t.z=this._z*e,t.w=this._w*e,this},e.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.x+=this._x*e,t.y+=this._y*e,t.z+=this._z*e,t.w+=this._w*e,this},e.prototype.multiply=function(t){var i=new e(0,0,0,1);return this.multiplyToRef(t,i),i},e.prototype.multiplyToRef=function(e,t){var i=this._x*e._w+this._y*e._z-this._z*e._y+this._w*e._x,n=-this._x*e._z+this._y*e._w+this._z*e._x+this._w*e._y,r=this._x*e._y-this._y*e._x+this._z*e._w+this._w*e._z,o=-this._x*e._x-this._y*e._y-this._z*e._z+this._w*e._w;return t.copyFromFloats(i,n,r,o),this},e.prototype.multiplyInPlace=function(e){return this.multiplyToRef(e,this),this},e.prototype.conjugateToRef=function(e){return e.copyFromFloats(-this._x,-this._y,-this._z,this._w),this},e.prototype.conjugateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},e.prototype.conjugate=function(){return new e(-this._x,-this._y,-this._z,this._w)},e.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},e.prototype.normalize=function(){var e=this.length();if(0===e)return this;var t=1/e;return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.prototype.toEulerAngles=function(e){void 0===e&&(e="YZX");var t=h.Zero();return this.toEulerAnglesToRef(t),t},e.prototype.toEulerAnglesToRef=function(e){var t=this._z,i=this._x,n=this._y,r=this._w,o=r*r,s=t*t,a=i*i,l=n*n,h=n*t-i*r,c=.4999999;return h<-c?(e.y=2*Math.atan2(n,r),e.x=Math.PI/2,e.z=0):h>c?(e.y=2*Math.atan2(n,r),e.x=-Math.PI/2,e.z=0):(e.z=Math.atan2(2*(i*n+t*r),-s-a+l+o),e.x=Math.asin(-2*(t*n-i*r)),e.y=Math.atan2(2*(t*i+n*r),s-a-l+o)),this},e.prototype.toRotationMatrix=function(e){return f.FromQuaternionToRef(this,e),this},e.prototype.fromRotationMatrix=function(t){return e.FromRotationMatrixToRef(t,this),this},e.FromRotationMatrix=function(t){var i=new e;return e.FromRotationMatrixToRef(t,i),i},e.FromRotationMatrixToRef=function(e,t){var i,n=e.m,r=n[0],o=n[4],s=n[8],a=n[1],l=n[5],h=n[9],c=n[2],u=n[6],f=n[10],d=r+l+f;d>0?(i=.5/Math.sqrt(d+1),t.w=.25/i,t.x=(u-h)*i,t.y=(s-c)*i,t.z=(a-o)*i):r>l&&r>f?(i=2*Math.sqrt(1+r-l-f),t.w=(u-h)/i,t.x=.25*i,t.y=(o+a)/i,t.z=(s+c)/i):l>f?(i=2*Math.sqrt(1+l-r-f),t.w=(s-c)/i,t.x=(o+a)/i,t.y=.25*i,t.z=(h+u)/i):(i=2*Math.sqrt(1+f-r-l),t.w=(a-o)/i,t.x=(s+c)/i,t.y=(h+u)/i,t.z=.25*i)},e.Dot=function(e,t){return e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w},e.AreClose=function(t,i){return e.Dot(t,i)>=0},e.Zero=function(){return new e(0,0,0,0)},e.Inverse=function(t){return new e(-t._x,-t._y,-t._z,t._w)},e.InverseToRef=function(e,t){return t.set(-e._x,-e._y,-e._z,e._w),t},e.Identity=function(){return new e(0,0,0,1)},e.IsIdentity=function(e){return e&&0===e._x&&0===e._y&&0===e._z&&1===e._w},e.RotationAxis=function(t,i){return e.RotationAxisToRef(t,i,new e)},e.RotationAxisToRef=function(e,t,i){var n=Math.sin(t/2);return e.normalize(),i.w=Math.cos(t/2),i.x=e._x*n,i.y=e._y*n,i.z=e._z*n,i},e.FromArray=function(t,i){return i||(i=0),new e(t[i],t[i+1],t[i+2],t[i+3])},e.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3]},e.FromEulerAngles=function(t,i,n){var r=new e;return e.RotationYawPitchRollToRef(i,t,n,r),r},e.FromEulerAnglesToRef=function(t,i,n,r){return e.RotationYawPitchRollToRef(i,t,n,r),r},e.FromEulerVector=function(t){var i=new e;return e.RotationYawPitchRollToRef(t._y,t._x,t._z,i),i},e.FromEulerVectorToRef=function(t,i){return e.RotationYawPitchRollToRef(t._y,t._x,t._z,i),i},e.RotationYawPitchRoll=function(t,i,n){var r=new e;return e.RotationYawPitchRollToRef(t,i,n,r),r},e.RotationYawPitchRollToRef=function(e,t,i,n){var r=.5*i,o=.5*t,s=.5*e,a=Math.sin(r),l=Math.cos(r),h=Math.sin(o),c=Math.cos(o),u=Math.sin(s),f=Math.cos(s);n.x=f*h*l+u*c*a,n.y=u*c*l-f*h*a,n.z=f*c*a-u*h*l,n.w=f*c*l+u*h*a},e.RotationAlphaBetaGamma=function(t,i,n){var r=new e;return e.RotationAlphaBetaGammaToRef(t,i,n,r),r},e.RotationAlphaBetaGammaToRef=function(e,t,i,n){var r=.5*(i+e),o=.5*(i-e),s=.5*t;n.x=Math.cos(o)*Math.sin(s),n.y=Math.sin(o)*Math.sin(s),n.z=Math.sin(r)*Math.cos(s),n.w=Math.cos(r)*Math.cos(s)},e.RotationQuaternionFromAxis=function(t,i,n){var r=new e(0,0,0,0);return e.RotationQuaternionFromAxisToRef(t,i,n,r),r},e.RotationQuaternionFromAxisToRef=function(t,i,n,r){var o=d.Matrix[0];f.FromXYZAxesToRef(t.normalize(),i.normalize(),n.normalize(),o),e.FromRotationMatrixToRef(o,r)},e.Slerp=function(t,i,n){var r=e.Identity();return e.SlerpToRef(t,i,n,r),r},e.SlerpToRef=function(e,t,i,n){var r,o,s=e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w,a=!1;if(s<0&&(a=!0,s=-s),s>.999999)o=1-i,r=a?-i:i;else{var l=Math.acos(s),h=1/Math.sin(l);o=Math.sin((1-i)*l)*h,r=a?-Math.sin(i*l)*h:Math.sin(i*l)*h}n.x=o*e._x+r*t._x,n.y=o*e._y+r*t._y,n.z=o*e._z+r*t._z,n.w=o*e._w+r*t._w},e.Hermite=function(t,i,n,r,o){var s=o*o,a=o*s,l=2*a-3*s+1,h=-2*a+3*s,c=a-2*s+o,u=a-s;return new e(t._x*l+n._x*h+i._x*c+r._x*u,t._y*l+n._y*h+i._y*c+r._y*u,t._z*l+n._z*h+i._z*c+r._z*u,t._w*l+n._w*h+i._w*c+r._w*u)},e}(),f=function(){function e(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,a.Z.MatrixTrackPrecisionChange&&a.Z.MatrixTrackedMatrices.push(this),this._m=new a.Z.MatrixCurrentType(16),this._updateIdentityStatus(!1)}return Object.defineProperty(e,"Use64Bits",{get:function(){return a.Z.MatrixUse64Bits},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"m",{get:function(){return this._m},enumerable:!1,configurable:!0}),e.prototype._markAsUpdated=function(){this.updateFlag=e._updateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0},e.prototype._updateIdentityStatus=function(t,i,n,r){void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===r&&(r=!0),this.updateFlag=e._updateFlagSeed++,this._isIdentity=t,this._isIdentity3x2=t||n,this._isIdentityDirty=!this._isIdentity&&i,this._isIdentity3x2Dirty=!this._isIdentity3x2&&r},e.prototype.isIdentity=function(){if(this._isIdentityDirty){this._isIdentityDirty=!1;var e=this._m;this._isIdentity=1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]}return this._isIdentity},e.prototype.isIdentityAs3x2=function(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,1!==this._m[0]||1!==this._m[5]||1!==this._m[15]||0!==this._m[1]||0!==this._m[2]||0!==this._m[3]||0!==this._m[4]||0!==this._m[6]||0!==this._m[7]||0!==this._m[8]||0!==this._m[9]||0!==this._m[10]||0!==this._m[11]||0!==this._m[12]||0!==this._m[13]||0!==this._m[14]?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2},e.prototype.determinant=function(){if(!0===this._isIdentity)return 1;var e=this._m,t=e[0],i=e[1],n=e[2],r=e[3],o=e[4],s=e[5],a=e[6],l=e[7],h=e[8],c=e[9],u=e[10],f=e[11],d=e[12],p=e[13],_=e[14],g=e[15],m=u*g-_*f,v=c*g-p*f,y=c*_-p*u,b=h*g-d*f,T=h*_-u*d,A=h*p-d*c;return t*+(s*m-a*v+l*y)+i*-(o*m-a*b+l*T)+n*+(o*v-s*b+l*A)+r*-(o*y-s*T+a*A)},e.prototype.toArray=function(){return this._m},e.prototype.asArray=function(){return this._m},e.prototype.invert=function(){return this.invertToRef(this),this},e.prototype.reset=function(){return e.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this},e.prototype.add=function(t){var i=new e;return this.addToRef(t,i),i},e.prototype.addToRef=function(e,t){for(var i=this._m,n=t._m,r=e.m,o=0;o<16;o++)n[o]=i[o]+r[o];return t._markAsUpdated(),this},e.prototype.addToSelf=function(e){for(var t=this._m,i=e.m,n=0;n<16;n++)t[n]+=i[n];return this._markAsUpdated(),this},e.prototype.invertToRef=function(t){if(!0===this._isIdentity)return e.IdentityToRef(t),this;var i=this._m,n=i[0],r=i[1],o=i[2],s=i[3],a=i[4],l=i[5],h=i[6],c=i[7],u=i[8],f=i[9],d=i[10],p=i[11],_=i[12],g=i[13],m=i[14],v=i[15],y=d*v-m*p,b=f*v-g*p,T=f*m-g*d,A=u*v-_*p,E=u*m-d*_,C=u*g-_*f,x=+(l*y-h*b+c*T),S=-(a*y-h*A+c*E),R=+(a*b-l*A+c*C),M=-(a*T-l*E+h*C),P=n*x+r*S+o*R+s*M;if(0===P)return t.copyFrom(this),this;var I=1/P,O=h*v-m*c,D=l*v-g*c,L=l*m-g*h,w=a*v-_*c,N=a*m-_*h,F=a*g-_*l,B=h*p-d*c,U=l*p-f*c,k=l*d-f*h,V=a*p-u*c,G=a*d-u*h,H=a*f-u*l,z=-(r*y-o*b+s*T),W=+(n*y-o*A+s*E),X=-(n*b-r*A+s*C),j=+(n*T-r*E+o*C),Y=+(r*O-o*D+s*L),K=-(n*O-o*w+s*N),q=+(n*D-r*w+s*F),Z=-(n*L-r*N+o*F),Q=-(r*B-o*U+s*k),J=+(n*B-o*V+s*G),$=-(n*U-r*V+s*H),ee=+(n*k-r*G+o*H);return e.FromValuesToRef(x*I,z*I,Y*I,Q*I,S*I,W*I,K*I,J*I,R*I,X*I,q*I,$*I,M*I,j*I,Z*I,ee*I,t),this},e.prototype.addAtIndex=function(e,t){return this._m[e]+=t,this._markAsUpdated(),this},e.prototype.multiplyAtIndex=function(e,t){return this._m[e]*=t,this._markAsUpdated(),this},e.prototype.setTranslationFromFloats=function(e,t,i){return this._m[12]=e,this._m[13]=t,this._m[14]=i,this._markAsUpdated(),this},e.prototype.addTranslationFromFloats=function(e,t,i){return this._m[12]+=e,this._m[13]+=t,this._m[14]+=i,this._markAsUpdated(),this},e.prototype.setTranslation=function(e){return this.setTranslationFromFloats(e._x,e._y,e._z)},e.prototype.getTranslation=function(){return new h(this._m[12],this._m[13],this._m[14])},e.prototype.getTranslationToRef=function(e){return e.x=this._m[12],e.y=this._m[13],e.z=this._m[14],this},e.prototype.removeRotationAndScaling=function(){var t=this.m;return e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t[12],t[13],t[14],t[15],this),this._updateIdentityStatus(0===t[12]&&0===t[13]&&0===t[14]&&1===t[15]),this},e.prototype.multiply=function(t){var i=new e;return this.multiplyToRef(t,i),i},e.prototype.copyFrom=function(e){e.copyToArray(this._m);var t=e;return this._updateIdentityStatus(t._isIdentity,t._isIdentityDirty,t._isIdentity3x2,t._isIdentity3x2Dirty),this},e.prototype.copyToArray=function(e,t){void 0===t&&(t=0);var i=this._m;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],this},e.prototype.multiplyToRef=function(e,t){return this._isIdentity?(t.copyFrom(e),this):e._isIdentity?(t.copyFrom(this),this):(this.multiplyToArray(e,t._m,0),t._markAsUpdated(),this)},e.prototype.multiplyToArray=function(e,t,i){var n=this._m,r=e.m,o=n[0],s=n[1],a=n[2],l=n[3],h=n[4],c=n[5],u=n[6],f=n[7],d=n[8],p=n[9],_=n[10],g=n[11],m=n[12],v=n[13],y=n[14],b=n[15],T=r[0],A=r[1],E=r[2],C=r[3],x=r[4],S=r[5],R=r[6],M=r[7],P=r[8],I=r[9],O=r[10],D=r[11],L=r[12],w=r[13],N=r[14],F=r[15];return t[i]=o*T+s*x+a*P+l*L,t[i+1]=o*A+s*S+a*I+l*w,t[i+2]=o*E+s*R+a*O+l*N,t[i+3]=o*C+s*M+a*D+l*F,t[i+4]=h*T+c*x+u*P+f*L,t[i+5]=h*A+c*S+u*I+f*w,t[i+6]=h*E+c*R+u*O+f*N,t[i+7]=h*C+c*M+u*D+f*F,t[i+8]=d*T+p*x+_*P+g*L,t[i+9]=d*A+p*S+_*I+g*w,t[i+10]=d*E+p*R+_*O+g*N,t[i+11]=d*C+p*M+_*D+g*F,t[i+12]=m*T+v*x+y*P+b*L,t[i+13]=m*A+v*S+y*I+b*w,t[i+14]=m*E+v*R+y*O+b*N,t[i+15]=m*C+v*M+y*D+b*F,this},e.prototype.equals=function(e){var t=e;if(!t)return!1;if((this._isIdentity||t._isIdentity)&&!this._isIdentityDirty&&!t._isIdentityDirty)return this._isIdentity&&t._isIdentity;var i=this.m,n=t.m;return i[0]===n[0]&&i[1]===n[1]&&i[2]===n[2]&&i[3]===n[3]&&i[4]===n[4]&&i[5]===n[5]&&i[6]===n[6]&&i[7]===n[7]&&i[8]===n[8]&&i[9]===n[9]&&i[10]===n[10]&&i[11]===n[11]&&i[12]===n[12]&&i[13]===n[13]&&i[14]===n[14]&&i[15]===n[15]},e.prototype.clone=function(){var t=new e;return t.copyFrom(this),t},e.prototype.getClassName=function(){return"Matrix"},e.prototype.getHashCode=function(){for(var e=0|this._m[0],t=1;t<16;t++)e=397*e^(0|this._m[t]);return e},e.prototype.decompose=function(t,i,n){if(this._isIdentity)return n&&n.setAll(0),t&&t.setAll(1),i&&i.copyFromFloats(0,0,0,1),!0;var r=this._m;if(n&&n.copyFromFloats(r[12],r[13],r[14]),(t=t||d.Vector3[0]).x=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]),t.y=Math.sqrt(r[4]*r[4]+r[5]*r[5]+r[6]*r[6]),t.z=Math.sqrt(r[8]*r[8]+r[9]*r[9]+r[10]*r[10]),this.determinant()<=0&&(t.y*=-1),0===t._x||0===t._y||0===t._z)return i&&i.copyFromFloats(0,0,0,1),!1;if(i){var o=1/t._x,s=1/t._y,a=1/t._z;e.FromValuesToRef(r[0]*o,r[1]*o,r[2]*o,0,r[4]*s,r[5]*s,r[6]*s,0,r[8]*a,r[9]*a,r[10]*a,0,0,0,0,1,d.Matrix[0]),u.FromRotationMatrixToRef(d.Matrix[0],i)}return!0},e.prototype.getRow=function(e){if(e<0||e>3)return null;var t=4*e;return new c(this._m[t+0],this._m[t+1],this._m[t+2],this._m[t+3])},e.prototype.setRow=function(e,t){return this.setRowFromFloats(e,t.x,t.y,t.z,t.w)},e.prototype.transpose=function(){return e.Transpose(this)},e.prototype.transposeToRef=function(t){return e.TransposeToRef(this,t),this},e.prototype.setRowFromFloats=function(e,t,i,n,r){if(e<0||e>3)return this;var o=4*e;return this._m[o+0]=t,this._m[o+1]=i,this._m[o+2]=n,this._m[o+3]=r,this._markAsUpdated(),this},e.prototype.scale=function(t){var i=new e;return this.scaleToRef(t,i),i},e.prototype.scaleToRef=function(e,t){for(var i=0;i<16;i++)t._m[i]=this._m[i]*e;return t._markAsUpdated(),this},e.prototype.scaleAndAddToRef=function(e,t){for(var i=0;i<16;i++)t._m[i]+=this._m[i]*e;return t._markAsUpdated(),this},e.prototype.toNormalMatrix=function(t){var i=d.Matrix[0];this.invertToRef(i),i.transposeToRef(t);var n=t._m;e.FromValuesToRef(n[0],n[1],n[2],0,n[4],n[5],n[6],0,n[8],n[9],n[10],0,0,0,0,1,t)},e.prototype.getRotationMatrix=function(){var t=new e;return this.getRotationMatrixToRef(t),t},e.prototype.getRotationMatrixToRef=function(t){var i=d.Vector3[0];if(!this.decompose(i))return e.IdentityToRef(t),this;var n=this._m,r=1/i._x,o=1/i._y,s=1/i._z;return e.FromValuesToRef(n[0]*r,n[1]*r,n[2]*r,0,n[4]*o,n[5]*o,n[6]*o,0,n[8]*s,n[9]*s,n[10]*s,0,0,0,0,1,t),this},e.prototype.toggleModelMatrixHandInPlace=function(){var e=this._m;e[2]*=-1,e[6]*=-1,e[8]*=-1,e[9]*=-1,e[14]*=-1,this._markAsUpdated()},e.prototype.toggleProjectionMatrixHandInPlace=function(){var e=this._m;e[8]*=-1,e[9]*=-1,e[10]*=-1,e[11]*=-1,this._markAsUpdated()},e.FromArray=function(t,i){void 0===i&&(i=0);var n=new e;return e.FromArrayToRef(t,i,n),n},e.FromArrayToRef=function(e,t,i){for(var n=0;n<16;n++)i._m[n]=e[n+t];i._markAsUpdated()},e.FromFloat32ArrayToRefScaled=function(e,t,i,n){for(var r=0;r<16;r++)n._m[r]=e[r+t]*i;n._markAsUpdated()},Object.defineProperty(e,"IdentityReadOnly",{get:function(){return e._identityReadOnly},enumerable:!1,configurable:!0}),e.FromValuesToRef=function(e,t,i,n,r,o,s,a,l,h,c,u,f,d,p,_,g){var m=g._m;m[0]=e,m[1]=t,m[2]=i,m[3]=n,m[4]=r,m[5]=o,m[6]=s,m[7]=a,m[8]=l,m[9]=h,m[10]=c,m[11]=u,m[12]=f,m[13]=d,m[14]=p,m[15]=_,g._markAsUpdated()},e.FromValues=function(t,i,n,r,o,s,a,l,h,c,u,f,d,p,_,g){var m=new e,v=m._m;return v[0]=t,v[1]=i,v[2]=n,v[3]=r,v[4]=o,v[5]=s,v[6]=a,v[7]=l,v[8]=h,v[9]=c,v[10]=u,v[11]=f,v[12]=d,v[13]=p,v[14]=_,v[15]=g,m._markAsUpdated(),m},e.Compose=function(t,i,n){var r=new e;return e.ComposeToRef(t,i,n,r),r},e.ComposeToRef=function(e,t,i,n){var r=n._m,o=t._x,s=t._y,a=t._z,l=t._w,h=o+o,c=s+s,u=a+a,f=o*h,d=o*c,p=o*u,_=s*c,g=s*u,m=a*u,v=l*h,y=l*c,b=l*u,T=e._x,A=e._y,E=e._z;r[0]=(1-(_+m))*T,r[1]=(d+b)*T,r[2]=(p-y)*T,r[3]=0,r[4]=(d-b)*A,r[5]=(1-(f+m))*A,r[6]=(g+v)*A,r[7]=0,r[8]=(p+y)*E,r[9]=(g-v)*E,r[10]=(1-(f+_))*E,r[11]=0,r[12]=i._x,r[13]=i._y,r[14]=i._z,r[15]=1,n._markAsUpdated()},e.Identity=function(){var t=e.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return t._updateIdentityStatus(!0),t},e.IdentityToRef=function(t){e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(!0)},e.Zero=function(){var t=e.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return t._updateIdentityStatus(!1),t},e.RotationX=function(t){var i=new e;return e.RotationXToRef(t,i),i},e.Invert=function(t){var i=new e;return t.invertToRef(i),i},e.RotationXToRef=function(t,i){var n=Math.sin(t),r=Math.cos(t);e.FromValuesToRef(1,0,0,0,0,r,n,0,0,-n,r,0,0,0,0,1,i),i._updateIdentityStatus(1===r&&0===n)},e.RotationY=function(t){var i=new e;return e.RotationYToRef(t,i),i},e.RotationYToRef=function(t,i){var n=Math.sin(t),r=Math.cos(t);e.FromValuesToRef(r,0,-n,0,0,1,0,0,n,0,r,0,0,0,0,1,i),i._updateIdentityStatus(1===r&&0===n)},e.RotationZ=function(t){var i=new e;return e.RotationZToRef(t,i),i},e.RotationZToRef=function(t,i){var n=Math.sin(t),r=Math.cos(t);e.FromValuesToRef(r,n,0,0,-n,r,0,0,0,0,1,0,0,0,0,1,i),i._updateIdentityStatus(1===r&&0===n)},e.RotationAxis=function(t,i){var n=new e;return e.RotationAxisToRef(t,i,n),n},e.RotationAxisToRef=function(e,t,i){var n=Math.sin(-t),r=Math.cos(-t),o=1-r;e.normalize();var s=i._m;s[0]=e._x*e._x*o+r,s[1]=e._x*e._y*o-e._z*n,s[2]=e._x*e._z*o+e._y*n,s[3]=0,s[4]=e._y*e._x*o+e._z*n,s[5]=e._y*e._y*o+r,s[6]=e._y*e._z*o-e._x*n,s[7]=0,s[8]=e._z*e._x*o-e._y*n,s[9]=e._z*e._y*o+e._x*n,s[10]=e._z*e._z*o+r,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,i._markAsUpdated()},e.RotationAlignToRef=function(e,t,i){var n=h.Cross(t,e),r=h.Dot(t,e),o=1/(1+r),s=i._m;s[0]=n._x*n._x*o+r,s[1]=n._y*n._x*o-n._z,s[2]=n._z*n._x*o+n._y,s[3]=0,s[4]=n._x*n._y*o+n._z,s[5]=n._y*n._y*o+r,s[6]=n._z*n._y*o-n._x,s[7]=0,s[8]=n._x*n._z*o-n._y,s[9]=n._y*n._z*o+n._x,s[10]=n._z*n._z*o+r,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,i._markAsUpdated()},e.RotationYawPitchRoll=function(t,i,n){var r=new e;return e.RotationYawPitchRollToRef(t,i,n,r),r},e.RotationYawPitchRollToRef=function(e,t,i,n){u.RotationYawPitchRollToRef(e,t,i,d.Quaternion[0]),d.Quaternion[0].toRotationMatrix(n)},e.Scaling=function(t,i,n){var r=new e;return e.ScalingToRef(t,i,n,r),r},e.ScalingToRef=function(t,i,n,r){e.FromValuesToRef(t,0,0,0,0,i,0,0,0,0,n,0,0,0,0,1,r),r._updateIdentityStatus(1===t&&1===i&&1===n)},e.Translation=function(t,i,n){var r=new e;return e.TranslationToRef(t,i,n,r),r},e.TranslationToRef=function(t,i,n,r){e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t,i,n,1,r),r._updateIdentityStatus(0===t&&0===i&&0===n)},e.Lerp=function(t,i,n){var r=new e;return e.LerpToRef(t,i,n,r),r},e.LerpToRef=function(e,t,i,n){for(var r=n._m,o=e.m,s=t.m,a=0;a<16;a++)r[a]=o[a]*(1-i)+s[a]*i;n._markAsUpdated()},e.DecomposeLerp=function(t,i,n){var r=new e;return e.DecomposeLerpToRef(t,i,n,r),r},e.DecomposeLerpToRef=function(t,i,n,r){var o=d.Vector3[0],s=d.Quaternion[0],a=d.Vector3[1];t.decompose(o,s,a);var l=d.Vector3[2],c=d.Quaternion[1],f=d.Vector3[3];i.decompose(l,c,f);var p=d.Vector3[4];h.LerpToRef(o,l,n,p);var _=d.Quaternion[2];u.SlerpToRef(s,c,n,_);var g=d.Vector3[5];h.LerpToRef(a,f,n,g),e.ComposeToRef(p,_,g,r)},e.LookAtLH=function(t,i,n){var r=new e;return e.LookAtLHToRef(t,i,n,r),r},e.LookAtLHToRef=function(t,i,n,r){var o=d.Vector3[0],s=d.Vector3[1],a=d.Vector3[2];i.subtractToRef(t,a),a.normalize(),h.CrossToRef(n,a,o);var l=o.lengthSquared();0===l?o.x=1:o.normalizeFromLength(Math.sqrt(l)),h.CrossToRef(a,o,s),s.normalize();var c=-h.Dot(o,t),u=-h.Dot(s,t),f=-h.Dot(a,t);e.FromValuesToRef(o._x,s._x,a._x,0,o._y,s._y,a._y,0,o._z,s._z,a._z,0,c,u,f,1,r)},e.LookAtRH=function(t,i,n){var r=new e;return e.LookAtRHToRef(t,i,n,r),r},e.LookAtRHToRef=function(t,i,n,r){var o=d.Vector3[0],s=d.Vector3[1],a=d.Vector3[2];t.subtractToRef(i,a),a.normalize(),h.CrossToRef(n,a,o);var l=o.lengthSquared();0===l?o.x=1:o.normalizeFromLength(Math.sqrt(l)),h.CrossToRef(a,o,s),s.normalize();var c=-h.Dot(o,t),u=-h.Dot(s,t),f=-h.Dot(a,t);e.FromValuesToRef(o._x,s._x,a._x,0,o._y,s._y,a._y,0,o._z,s._z,a._z,0,c,u,f,1,r)},e.OrthoLH=function(t,i,n,r){var o=new e;return e.OrthoLHToRef(t,i,n,r,o),o},e.OrthoLHToRef=function(t,i,n,r,o){var s=2/t,a=2/i,l=2/(r-n),h=-(r+n)/(r-n);e.FromValuesToRef(s,0,0,0,0,a,0,0,0,0,l,0,0,0,h,1,o),o._updateIdentityStatus(1===s&&1===a&&1===l&&0===h)},e.OrthoOffCenterLH=function(t,i,n,r,o,s){var a=new e;return e.OrthoOffCenterLHToRef(t,i,n,r,o,s,a),a},e.OrthoOffCenterLHToRef=function(t,i,n,r,o,s,a){var l=2/(i-t),h=2/(r-n),c=2/(s-o),u=-(s+o)/(s-o),f=(t+i)/(t-i),d=(r+n)/(n-r);e.FromValuesToRef(l,0,0,0,0,h,0,0,0,0,c,0,f,d,u,1,a),a._markAsUpdated()},e.OrthoOffCenterRH=function(t,i,n,r,o,s){var a=new e;return e.OrthoOffCenterRHToRef(t,i,n,r,o,s,a),a},e.OrthoOffCenterRHToRef=function(t,i,n,r,o,s,a){e.OrthoOffCenterLHToRef(t,i,n,r,o,s,a),a._m[10]*=-1},e.PerspectiveLH=function(t,i,n,r){var o=new e,s=2*n/t,a=2*n/i,l=(r+n)/(r-n),h=-2*r*n/(r-n);return e.FromValuesToRef(s,0,0,0,0,a,0,0,0,0,l,1,0,0,h,0,o),o._updateIdentityStatus(!1),o},e.PerspectiveFovLH=function(t,i,n,r){var o=new e;return e.PerspectiveFovLHToRef(t,i,n,r,o),o},e.PerspectiveFovLHToRef=function(t,i,n,r,o,s){void 0===s&&(s=!0);var a=n,l=r,h=1/Math.tan(.5*t),c=s?h/i:h,u=s?h:h*i,f=(l+a)/(l-a),d=-2*l*a/(l-a);e.FromValuesToRef(c,0,0,0,0,u,0,0,0,0,f,1,0,0,d,0,o),o._updateIdentityStatus(!1)},e.PerspectiveFovReverseLHToRef=function(t,i,n,r,o,s){void 0===s&&(s=!0);var a=1/Math.tan(.5*t),l=s?a/i:a,h=s?a:a*i;e.FromValuesToRef(l,0,0,0,0,h,0,0,0,0,-n,1,0,0,1,0,o),o._updateIdentityStatus(!1)},e.PerspectiveFovRH=function(t,i,n,r){var o=new e;return e.PerspectiveFovRHToRef(t,i,n,r,o),o},e.PerspectiveFovRHToRef=function(t,i,n,r,o,s){void 0===s&&(s=!0);var a=n,l=r,h=1/Math.tan(.5*t),c=s?h/i:h,u=s?h:h*i,f=-(l+a)/(l-a),d=-2*l*a/(l-a);e.FromValuesToRef(c,0,0,0,0,u,0,0,0,0,f,-1,0,0,d,0,o),o._updateIdentityStatus(!1)},e.PerspectiveFovReverseRHToRef=function(t,i,n,r,o,s){void 0===s&&(s=!0);var a=1/Math.tan(.5*t),l=s?a/i:a,h=s?a:a*i;e.FromValuesToRef(l,0,0,0,0,h,0,0,0,0,-n,-1,0,0,-1,0,o),o._updateIdentityStatus(!1)},e.PerspectiveFovWebVRToRef=function(e,t,i,n,r){void 0===r&&(r=!1);var o=r?-1:1,s=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),l=Math.tan(e.leftDegrees*Math.PI/180),h=Math.tan(e.rightDegrees*Math.PI/180),c=2/(l+h),u=2/(s+a),f=n._m;f[0]=c,f[1]=f[2]=f[3]=f[4]=0,f[5]=u,f[6]=f[7]=0,f[8]=(l-h)*c*.5,f[9]=-(s-a)*u*.5,f[10]=-i/(t-i),f[11]=1*o,f[12]=f[13]=f[15]=0,f[14]=-2*i*t/(i-t),n._markAsUpdated()},e.GetFinalMatrix=function(t,i,n,r,o,s){var a=t.width,l=t.height,h=t.x,c=t.y,u=e.FromValues(a/2,0,0,0,0,-l/2,0,0,0,0,s-o,0,h+a/2,l/2+c,o,1),f=d.Matrix[0];return i.multiplyToRef(n,f),f.multiplyToRef(r,f),f.multiply(u)},e.GetAsMatrix2x2=function(e){var t=e.m,i=[t[0],t[1],t[4],t[5]];return a.Z.MatrixUse64Bits?i:new Float32Array(i)},e.GetAsMatrix3x3=function(e){var t=e.m,i=[t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10]];return a.Z.MatrixUse64Bits?i:new Float32Array(i)},e.Transpose=function(t){var i=new e;return e.TransposeToRef(t,i),i},e.TransposeToRef=function(e,t){var i=t._m,n=e.m;i[0]=n[0],i[1]=n[4],i[2]=n[8],i[3]=n[12],i[4]=n[1],i[5]=n[5],i[6]=n[9],i[7]=n[13],i[8]=n[2],i[9]=n[6],i[10]=n[10],i[11]=n[14],i[12]=n[3],i[13]=n[7],i[14]=n[11],i[15]=n[15],t._updateIdentityStatus(e._isIdentity,e._isIdentityDirty)},e.Reflection=function(t){var i=new e;return e.ReflectionToRef(t,i),i},e.ReflectionToRef=function(t,i){t.normalize();var n=t.normal.x,r=t.normal.y,o=t.normal.z,s=-2*n,a=-2*r,l=-2*o;e.FromValuesToRef(s*n+1,a*n,l*n,0,s*r,a*r+1,l*r,0,s*o,a*o,l*o+1,0,s*t.d,a*t.d,l*t.d,1,i)},e.FromXYZAxesToRef=function(t,i,n,r){e.FromValuesToRef(t._x,t._y,t._z,0,i._x,i._y,i._z,0,n._x,n._y,n._z,0,0,0,0,1,r)},e.FromQuaternionToRef=function(e,t){var i=e._x*e._x,n=e._y*e._y,r=e._z*e._z,o=e._x*e._y,s=e._z*e._w,a=e._z*e._x,l=e._y*e._w,h=e._y*e._z,c=e._x*e._w;t._m[0]=1-2*(n+r),t._m[1]=2*(o+s),t._m[2]=2*(a-l),t._m[3]=0,t._m[4]=2*(o-s),t._m[5]=1-2*(r+i),t._m[6]=2*(h+c),t._m[7]=0,t._m[8]=2*(a+l),t._m[9]=2*(h-c),t._m[10]=1-2*(n+i),t._m[11]=0,t._m[12]=0,t._m[13]=0,t._m[14]=0,t._m[15]=1,t._markAsUpdated()},e._updateFlagSeed=0,e._identityReadOnly=e.Identity(),e}(),d=function(){function e(){}return e.Vector3=o.B.BuildArray(6,h.Zero),e.Matrix=o.B.BuildArray(2,f.Identity),e.Quaternion=o.B.BuildArray(3,u.Zero),e}(),p=function(){function e(){}return e.Vector2=o.B.BuildArray(3,l.Zero),e.Vector3=o.B.BuildArray(13,h.Zero),e.Vector4=o.B.BuildArray(3,c.Zero),e.Quaternion=o.B.BuildArray(2,u.Zero),e.Matrix=o.B.BuildArray(8,f.Identity),e}();s.Q.RegisteredTypes["BABYLON.Vector2"]=l,s.Q.RegisteredTypes["BABYLON.Vector3"]=h,s.Q.RegisteredTypes["BABYLON.Vector4"]=c,s.Q.RegisteredTypes["BABYLON.Matrix"]=f},4272:(e,t,i)=>{"use strict";i.d(t,{l:()=>n});var n=function(){function e(e,t,i,n){this.x=e,this.y=t,this.width=i,this.height=n}return e.prototype.toGlobal=function(t,i){return new e(this.x*t,this.y*i,this.width*t,this.height*i)},e.prototype.toGlobalToRef=function(e,t,i){return i.x=this.x*e,i.y=this.y*t,i.width=this.width*e,i.height=this.height*t,this},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e}()},4960:(e,t,i)=>{"use strict";i.r(t),i.d(t,{BoxBuilder:()=>a});var n=i(2973),r=i(8362),o=i(6212),s=i(128);s.VertexData.CreateBox=function(e){var t,i=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23],o=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0],a=[],l=e.width||e.size||1,h=e.height||e.size||1,c=e.depth||e.size||1,u=e.wrap||!1,f=void 0===e.topBaseAt?1:e.topBaseAt,d=void 0===e.bottomBaseAt?0:e.bottomBaseAt,p=[2,0,3,1][f=(f+4)%4],_=[2,0,1,3][d=(d+4)%4],g=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1];if(u){i=[2,3,0,2,0,1,4,5,6,4,6,7,9,10,11,9,11,8,12,14,15,12,13,14],g=[-1,1,1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1];for(var m=[[1,1,1],[-1,1,1],[-1,1,-1],[1,1,-1]],v=[[-1,-1,1],[1,-1,1],[1,-1,-1],[-1,-1,-1]],y=[17,18,19,16],b=[22,23,20,21];p>0;)m.unshift(m.pop()),y.unshift(y.pop()),p--;for(;_>0;)v.unshift(v.pop()),b.unshift(b.pop()),_--;m=m.flat(),v=v.flat(),g=g.concat(m).concat(v),i.push(y[0],y[2],y[3],y[0],y[1],y[2]),i.push(b[0],b[2],b[3],b[0],b[1],b[2])}var T=[l/2,h/2,c/2];t=g.reduce((function(e,t,i){return e.concat(t*T[i%3])}),[]);for(var A=0===e.sideOrientation?0:e.sideOrientation||s.VertexData.DEFAULTSIDE,E=e.faceUV||new Array(6),C=e.faceColors,x=[],S=0;S<6;S++)void 0===E[S]&&(E[S]=new n.Lt(0,0,1,1)),C&&void 0===C[S]&&(C[S]=new r.HE(1,1,1,1));for(var R=0;R<6;R++)if(a.push(E[R].z,E[R].w),a.push(E[R].x,E[R].w),a.push(E[R].x,E[R].y),a.push(E[R].z,E[R].y),C)for(var M=0;M<4;M++)x.push(C[R].r,C[R].g,C[R].b,C[R].a);s.VertexData._ComputeSides(A,t,i,o,a,e.frontUVs,e.backUVs);var P=new s.VertexData;if(P.indices=i,P.positions=t,P.normals=o,P.uvs=a,C){var I=A===s.VertexData.DOUBLESIDE?x.concat(x):x;P.colors=I}return P},o.Mesh.CreateBox=function(e,t,i,n,r){void 0===i&&(i=null);var o={size:t,sideOrientation:r,updatable:n};return a.CreateBox(e,o,i)};var a=function(){function e(){}return e.CreateBox=function(e,t,i){void 0===i&&(i=null);var n=new o.Mesh(e,i);return t.sideOrientation=o.Mesh._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,s.VertexData.CreateBox(t).applyToMesh(n,t.updatable),n},e}()},3521:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CylinderBuilder:()=>h});var n=i(2973),r=i(8362),o=i(6212),s=i(128),a=i(4391),l=i(9068);s.VertexData.CreateCylinder=function(e){var t=e.height||2,i=0===e.diameterTop?0:e.diameterTop||e.diameter||1,a=0===e.diameterBottom?0:e.diameterBottom||e.diameter||1;i=i||1e-5,a=a||1e-5;var h,c=e.tessellation||24,u=e.subdivisions||1,f=!!e.hasRings,d=!!e.enclose,p=0===e.cap?0:e.cap||o.Mesh.CAP_ALL,_=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,g=0===e.sideOrientation?0:e.sideOrientation||s.VertexData.DEFAULTSIDE,m=e.faceUV||new Array(3),v=e.faceColors,y=2+(1+(1!==_&&d?2:0))*(f?u:1);for(h=0;h{"use strict";i.r(t),i.d(t,{LinesBuilder:()=>C});var n=i(2973),r=i(6212),o=i(128),s=i(655),a=i(8362),l=i(6738),h=i(3734),c=i(5385),u=i(789),f=i(5511),d=i(2520),p=i(5540);r.Mesh._instancedMeshFactory=function(e,t){var i=new _(e,t);if(t.instancedBuffers)for(var n in i.instancedBuffers={},t.instancedBuffers)i.instancedBuffers[n]=t.instancedBuffers[n];return i};var _=function(e){function t(t,i){var n=e.call(this,t,i.getScene())||this;n._indexInSourceMeshInstanceArray=-1,i.addInstance(n),n._sourceMesh=i,n._unIndexed=i._unIndexed,n.position.copyFrom(i.position),n.rotation.copyFrom(i.rotation),n.scaling.copyFrom(i.scaling),i.rotationQuaternion&&(n.rotationQuaternion=i.rotationQuaternion.clone()),n.animations=p.w1.Slice(i.animations);for(var r=0,o=i.getAnimationRanges();r0!=this._getWorldMatrixDeterminant()>0)return this._internalAbstractMeshDataInfo._actAsRegularMesh=!0,!0;if(this._internalAbstractMeshDataInfo._actAsRegularMesh=!1,this._currentLOD._registerInstanceForRenderId(this,e),t){if(!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate=!0,!0}else if(!this._currentLOD._internalAbstractMeshDataInfo._isActive)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances=!0,!0}return!1},t.prototype._postActivate=function(){this._sourceMesh.edgesShareWithInstances&&this._sourceMesh._edgesRenderer&&this._sourceMesh._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup?(this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer),this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix())):this._edgesRenderer&&this._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup&&this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer)},t.prototype.getWorldMatrix=function(){if(this._currentLOD&&this._currentLOD.billboardMode!==f.TransformNode.BILLBOARDMODE_NONE&&this._currentLOD._masterMesh!==this){var t=this._currentLOD._masterMesh;return this._currentLOD._masterMesh=this,n.jp.Vector3[7].copyFrom(this._currentLOD.position),this._currentLOD.position.set(0,0,0),n.jp.Matrix[0].copyFrom(this._currentLOD.computeWorldMatrix(!0)),this._currentLOD.position.copyFrom(n.jp.Vector3[7]),this._currentLOD._masterMesh=t,n.jp.Matrix[0]}return e.prototype.getWorldMatrix.call(this)},Object.defineProperty(t.prototype,"isAnInstance",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.getLOD=function(e){if(!e)return this;var t=this.getBoundingInfo();return this._currentLOD=this.sourceMesh.getLOD(e,t.boundingSphere),this._currentLOD===this.sourceMesh?this.sourceMesh:this._currentLOD},t.prototype._preActivateForIntermediateRendering=function(e){return this.sourceMesh._preActivateForIntermediateRendering(e)},t.prototype._syncSubMeshes=function(){if(this.releaseSubMeshes(),this._sourceMesh.subMeshes)for(var e=0;e\nvoid main(void) {\n#include\n#ifdef VERTEXCOLOR\ngl_FragColor=vColor;\n#else\ngl_FragColor=color;\n#endif\n}");y.Q.ShadersStore.colorPixelShader=b;i(3600),i(8738),i(3191),i(6838),i(9686),i(6403);var T="\nattribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n\n#include\nuniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\n\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\nvoid main(void) {\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#include\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n}";y.Q.ShadersStore.colorVertexShader=T;var A=function(e){function t(t,i,n,r,o,s,h){void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null);var c=e.call(this,t,i,n,r,o)||this;c.useVertexColor=s,c.useVertexAlpha=h,c.color=new a.Wo(1,1,1),c.alpha=1,r&&(c.color=r.color.clone(),c.alpha=r.alpha,c.useVertexColor=r.useVertexColor,c.useVertexAlpha=r.useVertexAlpha),c.intersectionThreshold=.1;var u={attributes:[l.o.PositionKind,"world0","world1","world2","world3"],uniforms:["vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","world","viewProjection"],needAlphaBlending:!0,defines:[]};return!1===h&&(u.needAlphaBlending=!1),s?(u.defines.push("#define VERTEXCOLOR"),u.attributes.push(l.o.ColorKind)):(u.uniforms.push("color"),c.color4=new a.HE),c._colorShader=new m.j("colorShader",c.getScene(),"color",u),c}return(0,s.ZT)(t,e),t.prototype._addClipPlaneDefine=function(e){var t="#define "+e;-1===this._colorShader.options.defines.indexOf(t)&&this._colorShader.options.defines.push(t)},t.prototype._removeClipPlaneDefine=function(e){var t="#define "+e,i=this._colorShader.options.defines.indexOf(t);-1!==i&&this._colorShader.options.defines.splice(i,1)},t.prototype.isReady=function(){var t=this.getScene();return t.clipPlane?this._addClipPlaneDefine("CLIPPLANE"):this._removeClipPlaneDefine("CLIPPLANE"),t.clipPlane2?this._addClipPlaneDefine("CLIPPLANE2"):this._removeClipPlaneDefine("CLIPPLANE2"),t.clipPlane3?this._addClipPlaneDefine("CLIPPLANE3"):this._removeClipPlaneDefine("CLIPPLANE3"),t.clipPlane4?this._addClipPlaneDefine("CLIPPLANE4"):this._removeClipPlaneDefine("CLIPPLANE4"),t.clipPlane5?this._addClipPlaneDefine("CLIPPLANE5"):this._removeClipPlaneDefine("CLIPPLANE5"),t.clipPlane6?this._addClipPlaneDefine("CLIPPLANE6"):this._removeClipPlaneDefine("CLIPPLANE6"),!!this._colorShader.isReady(this)&&e.prototype.isReady.call(this)},t.prototype.getClassName=function(){return"LinesMesh"},Object.defineProperty(t.prototype,"material",{get:function(){return this._colorShader},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"checkCollisions",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype._bind=function(e,t,i){if(!this._geometry)return this;var n=this._colorShader.getEffect(),r=this.isUnIndexed?null:this._geometry.getIndexBuffer();if(this._geometry._bind(n,r),!this.useVertexColor){var o=this.color,s=o.r,a=o.g,l=o.b;this.color4.set(s,a,l,this.alpha),this._colorShader.setColor4("color",this.color4)}return v.G.BindClipPlane(n,this.getScene()),this},t.prototype._draw=function(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;var n=this.getScene().getEngine();return this._unIndexed?n.drawArraysType(g.F.LineListDrawMode,e.verticesStart,e.verticesCount,i):n.drawElementsType(g.F.LineListDrawMode,e.indexStart,e.indexCount,i),this},t.prototype.dispose=function(t){this._colorShader.dispose(!1,!1,!0),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e,i,n){return void 0===i&&(i=null),new t(e,this.getScene(),i,this,n)},t.prototype.createInstance=function(e){return new E(e,this)},t}(r.Mesh),E=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.intersectionThreshold=i.intersectionThreshold,n}return(0,s.ZT)(t,e),t.prototype.getClassName=function(){return"InstancedLinesMesh"},t}(_);o.VertexData.CreateLineSystem=function(e){for(var t=[],i=[],n=e.lines,r=e.colors,s=[],a=0,l=0;l0&&(t.push(a-1),t.push(a)),a++}var f=new o.VertexData;return f.indices=t,f.positions=i,r&&(f.colors=s),f},o.VertexData.CreateDashedLines=function(e){var t,i,r=e.dashSize||3,s=e.gapSize||1,a=e.dashNb||200,l=e.points,h=new Array,c=new Array,u=n.P.Zero(),f=0,d=0,p=0,_=0,g=0;for(g=0;g{"use strict";i.r(t),i.d(t,{PlaneBuilder:()=>o});var n=i(6212),r=i(128);r.VertexData.CreatePlane=function(e){var t=[],i=[],n=[],o=[],s=e.width||e.size||1,a=e.height||e.size||1,l=0===e.sideOrientation?0:e.sideOrientation||r.VertexData.DEFAULTSIDE,h=s/2,c=a/2;i.push(-h,-c,0),n.push(0,0,-1),o.push(0,0),i.push(h,-c,0),n.push(0,0,-1),o.push(1,0),i.push(h,c,0),n.push(0,0,-1),o.push(1,1),i.push(-h,c,0),n.push(0,0,-1),o.push(0,1),t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),r.VertexData._ComputeSides(l,i,t,n,o,e.frontUVs,e.backUVs);var u=new r.VertexData;return u.indices=t,u.positions=i,u.normals=n,u.uvs=o,u},n.Mesh.CreatePlane=function(e,t,i,n,r){var s={size:t,width:t,height:t,sideOrientation:r,updatable:n};return o.CreatePlane(e,s,i)};var o=function(){function e(){}return e.CreatePlane=function(e,t,i){void 0===i&&(i=null);var o=new n.Mesh(e,i);return t.sideOrientation=n.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,r.VertexData.CreatePlane(t).applyToMesh(o,t.updatable),t.sourcePlane&&(o.translate(t.sourcePlane.normal,-t.sourcePlane.d),o.setDirection(t.sourcePlane.normal.scale(-1))),o},e}()},8991:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SphereBuilder:()=>s});var n=i(2973),r=i(6212),o=i(128);o.VertexData.CreateSphere=function(e){for(var t=e.segments||32,i=e.diameterX||e.diameter||1,r=e.diameterY||e.diameter||1,s=e.diameterZ||e.diameter||1,a=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,l=e.slice&&e.slice<=0?1:e.slice||1,h=0===e.sideOrientation?0:e.sideOrientation||o.VertexData.DEFAULTSIDE,c=!!e.dedupTopBottomIndices,u=new n.P(i/2,r/2,s/2),f=2+t,d=2*f,p=[],_=[],g=[],m=[],v=0;v<=f;v++){for(var y=v/f,b=y*Math.PI*l,T=0;T<=d;T++){var A=T/d,E=A*Math.PI*2*a,C=n.y3.RotationZ(-b),x=n.y3.RotationY(E),S=n.P.TransformCoordinates(n.P.Up(),C),R=n.P.TransformCoordinates(S,x),M=R.multiply(u),P=R.divide(u).normalize();_.push(M.x,M.y,M.z),g.push(P.x,P.y,P.z),m.push(A,y)}if(v>0)for(var I=_.length/3,O=I-2*(d+1);O+d+21&&(p.push(O),p.push(O+1),p.push(O+d+1)),(v{"use strict";i.r(t),i.d(t,{TorusBuilder:()=>s});var n=i(2973),r=i(6212),o=i(128);o.VertexData.CreateTorus=function(e){for(var t=[],i=[],r=[],s=[],a=e.diameter||1,l=e.thickness||.5,h=e.tessellation||16,c=0===e.sideOrientation?0:e.sideOrientation||o.VertexData.DEFAULTSIDE,u=h+1,f=0;f<=h;f++)for(var d=f/h,p=f*Math.PI*2/h-Math.PI/2,_=n.y3.Translation(a/2,0,0).multiply(n.y3.RotationY(p)),g=0;g<=h;g++){var m=1-g/h,v=g*Math.PI*2/h+Math.PI,y=Math.cos(v),b=Math.sin(v),T=new n.P(y,b,0),A=T.scale(l/2),E=new n.FM(d,m);A=n.P.TransformCoordinates(A,_),T=n.P.TransformNormal(T,_),i.push(A.x,A.y,A.z),r.push(T.x,T.y,T.z),s.push(E.x,E.y);var C=(f+1)%u,x=(g+1)%u;t.push(f*u+g),t.push(f*u+x),t.push(C*u+g),t.push(f*u+x),t.push(C*u+x),t.push(C*u+g)}o.VertexData._ComputeSides(c,i,t,r,s,e.frontUVs,e.backUVs);var S=new o.VertexData;return S.indices=t,S.positions=i,S.normals=r,S.uvs=s,S},r.Mesh.CreateTorus=function(e,t,i,n,r,o,a){var l={diameter:t,thickness:i,tessellation:n,sideOrientation:a,updatable:o};return s.CreateTorus(e,l,r)};var s=function(){function e(){}return e.CreateTorus=function(e,t,i){var n=new r.Mesh(e,i);return t.sideOrientation=r.Mesh._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,o.VertexData.CreateTorus(t).applyToMesh(n,t.updatable),n},e}()},5146:(e,t,i)=>{"use strict";i.d(t,{M:()=>r});var n=i(655),r=function(e){function t(t){var i=e.call(this)||this;return i._buffer=t,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"underlyingResource",{get:function(){return this._buffer},enumerable:!1,configurable:!0}),t}(function(){function e(){this.references=0,this.capacity=0,this.is32Bits=!1}return Object.defineProperty(e.prototype,"underlyingResource",{get:function(){return null},enumerable:!1,configurable:!0}),e}())},5385:(e,t,i)=>{"use strict";i.d(t,{x:()=>A});var n=i(655),r=i(5540),o=i(475),s=i(2973),a=i(2905),l=i(6738),h=i(128),c=i(5511),u=i(9626),f=i(2520),d=function(){this._checkCollisions=!1,this._collisionMask=-1,this._collisionGroup=-1,this._surroundingMeshes=null,this._collider=null,this._oldPositionForCollisions=new s.P(0,0,0),this._diffPositionForCollisions=new s.P(0,0,0),this._collisionResponse=!0},p=i(106),_=i(5168),g=i(8362),m=i(2782),v=i(9068),y=i(6132),b=function(){this.facetNb=0,this.partitioningSubdivisions=10,this.partitioningBBoxRatio=1.01,this.facetDataEnabled=!1,this.facetParameters={},this.bbSize=s.P.Zero(),this.subDiv={max:1,X:1,Y:1,Z:1},this.facetDepthSort=!1,this.facetDepthSortEnabled=!1},T=function(){this._hasVertexAlpha=!1,this._useVertexColors=!0,this._numBoneInfluencers=4,this._applyFog=!0,this._receiveShadows=!1,this._facetData=new b,this._visibility=1,this._skeleton=null,this._layerMask=268435455,this._computeBonesUsingShaders=!0,this._isActive=!1,this._onlyForInstances=!1,this._isActiveIntermediate=!1,this._onlyForInstancesIntermediate=!1,this._actAsRegularMesh=!1,this._currentLOD=null,this._currentLODIsUpToDate=!1},A=function(e){function t(i,n){void 0===n&&(n=null);var r=e.call(this,i,n,!1)||this;return r._internalAbstractMeshDataInfo=new T,r.cullingStrategy=t.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY,r.onCollideObservable=new o.y$,r.onCollisionPositionChangeObservable=new o.y$,r.onMaterialChangedObservable=new o.y$,r.definedFacingForward=!0,r._occlusionQuery=null,r._renderingGroup=null,r.alphaIndex=Number.MAX_VALUE,r.isVisible=!0,r.isPickable=!0,r.showSubMeshesBoundingBox=!1,r.isBlocker=!1,r.enablePointerMoveEvents=!1,r._renderingGroupId=0,r._material=null,r.outlineColor=g.Wo.Red(),r.outlineWidth=.02,r.overlayColor=g.Wo.Red(),r.overlayAlpha=.5,r.useOctreeForRenderingSelection=!0,r.useOctreeForPicking=!0,r.useOctreeForCollisions=!0,r.alwaysSelectAsActiveMesh=!1,r.doNotSyncBoundingInfo=!1,r.actionManager=null,r._meshCollisionData=new d,r.ellipsoid=new s.P(.5,1,.5),r.ellipsoidOffset=new s.P(0,0,0),r.edgesWidth=1,r.edgesColor=new g.HE(1,0,0,1),r._edgesRenderer=null,r._masterMesh=null,r._boundingInfo=null,r._renderId=0,r._intersectionsInProgress=new Array,r._unIndexed=!1,r._lightSources=new Array,r._waitingData={lods:null,actions:null,freezeWorldMatrix:null},r._bonesTransformMatrices=null,r._transformMatrixTexture=null,r.onRebuildObservable=new o.y$,r._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),t.subtractToRef(r._meshCollisionData._oldPositionForCollisions,r._meshCollisionData._diffPositionForCollisions),r._meshCollisionData._diffPositionForCollisions.length()>a.Engine.CollisionsEpsilon&&r.position.addInPlace(r._meshCollisionData._diffPositionForCollisions),i&&r.onCollideObservable.notifyObservers(i),r.onCollisionPositionChangeObservable.notifyObservers(r.position)},r.getScene().addMesh(r),r._resyncLightSources(),r}return(0,n.ZT)(t,e),Object.defineProperty(t,"BILLBOARDMODE_NONE",{get:function(){return c.TransformNode.BILLBOARDMODE_NONE},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_X",{get:function(){return c.TransformNode.BILLBOARDMODE_X},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_Y",{get:function(){return c.TransformNode.BILLBOARDMODE_Y},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_Z",{get:function(){return c.TransformNode.BILLBOARDMODE_Z},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_ALL",{get:function(){return c.TransformNode.BILLBOARDMODE_ALL},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_USE_POSITION",{get:function(){return c.TransformNode.BILLBOARDMODE_USE_POSITION},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"facetNb",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetNb},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"partitioningSubdivisions",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"partitioningBBoxRatio",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mustDepthSortFacets",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSort},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSort=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"facetDepthSortFrom",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isFacetDataEnabled",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled},enumerable:!1,configurable:!0}),t.prototype._updateNonUniformScalingState=function(t){return!!e.prototype._updateNonUniformScalingState.call(this,t)&&(this._markSubMeshesAsMiscDirty(),!0)},Object.defineProperty(t.prototype,"onCollide",{set:function(e){this._meshCollisionData._onCollideObserver&&this.onCollideObservable.remove(this._meshCollisionData._onCollideObserver),this._meshCollisionData._onCollideObserver=this.onCollideObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCollisionPositionChange",{set:function(e){this._meshCollisionData._onCollisionPositionChangeObserver&&this.onCollisionPositionChangeObservable.remove(this._meshCollisionData._onCollisionPositionChangeObserver),this._meshCollisionData._onCollisionPositionChangeObserver=this.onCollisionPositionChangeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"visibility",{get:function(){return this._internalAbstractMeshDataInfo._visibility},set:function(e){this._internalAbstractMeshDataInfo._visibility!==e&&(this._internalAbstractMeshDataInfo._visibility=e,this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderingGroupId",{get:function(){return this._renderingGroupId},set:function(e){this._renderingGroupId=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"material",{get:function(){return this._material},set:function(e){this._material!==e&&(this._material&&this._material.meshMap&&(this._material.meshMap[this.uniqueId]=void 0),this._material=e,e&&e.meshMap&&(e.meshMap[this.uniqueId]=this),this.onMaterialChangedObservable.hasObservers()&&this.onMaterialChangedObservable.notifyObservers(this),this.subMeshes&&this._unBindEffect())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"receiveShadows",{get:function(){return this._internalAbstractMeshDataInfo._receiveShadows},set:function(e){this._internalAbstractMeshDataInfo._receiveShadows!==e&&(this._internalAbstractMeshDataInfo._receiveShadows=e,this._markSubMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasVertexAlpha",{get:function(){return this._internalAbstractMeshDataInfo._hasVertexAlpha},set:function(e){this._internalAbstractMeshDataInfo._hasVertexAlpha!==e&&(this._internalAbstractMeshDataInfo._hasVertexAlpha=e,this._markSubMeshesAsAttributesDirty(),this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useVertexColors",{get:function(){return this._internalAbstractMeshDataInfo._useVertexColors},set:function(e){this._internalAbstractMeshDataInfo._useVertexColors!==e&&(this._internalAbstractMeshDataInfo._useVertexColors=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"computeBonesUsingShaders",{get:function(){return this._internalAbstractMeshDataInfo._computeBonesUsingShaders},set:function(e){this._internalAbstractMeshDataInfo._computeBonesUsingShaders!==e&&(this._internalAbstractMeshDataInfo._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numBoneInfluencers",{get:function(){return this._internalAbstractMeshDataInfo._numBoneInfluencers},set:function(e){this._internalAbstractMeshDataInfo._numBoneInfluencers!==e&&(this._internalAbstractMeshDataInfo._numBoneInfluencers=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"applyFog",{get:function(){return this._internalAbstractMeshDataInfo._applyFog},set:function(e){this._internalAbstractMeshDataInfo._applyFog!==e&&(this._internalAbstractMeshDataInfo._applyFog=e,this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerMask",{get:function(){return this._internalAbstractMeshDataInfo._layerMask},set:function(e){e!==this._internalAbstractMeshDataInfo._layerMask&&(this._internalAbstractMeshDataInfo._layerMask=e,this._resyncLightSources())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"collisionMask",{get:function(){return this._meshCollisionData._collisionMask},set:function(e){this._meshCollisionData._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"collisionResponse",{get:function(){return this._meshCollisionData._collisionResponse},set:function(e){this._meshCollisionData._collisionResponse=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"collisionGroup",{get:function(){return this._meshCollisionData._collisionGroup},set:function(e){this._meshCollisionData._collisionGroup=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"surroundingMeshes",{get:function(){return this._meshCollisionData._surroundingMeshes},set:function(e){this._meshCollisionData._surroundingMeshes=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lightSources",{get:function(){return this._lightSources},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_positions",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skeleton",{get:function(){return this._internalAbstractMeshDataInfo._skeleton},set:function(e){var t=this._internalAbstractMeshDataInfo._skeleton;t&&t.needInitialSkinMatrix&&t._unregisterMeshWithPoseMatrix(this),e&&e.needInitialSkinMatrix&&e._registerMeshWithPoseMatrix(this),this._internalAbstractMeshDataInfo._skeleton=e,this._internalAbstractMeshDataInfo._skeleton||(this._bonesTransformMatrices=null),this._markSubMeshesAsAttributesDirty()},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"AbstractMesh"},t.prototype.toString=function(e){var t="Name: "+this.name+", isInstance: "+("InstancedMesh"!==this.getClassName()?"YES":"NO");t+=", # of submeshes: "+(this.subMeshes?this.subMeshes.length:0);var i=this._internalAbstractMeshDataInfo._skeleton;return i&&(t+=", skeleton: "+i.name),e&&(t+=", billboard mode: "+["NONE","X","Y",null,"Z",null,null,"ALL"][this.billboardMode],t+=", freeze wrld mat: "+(this._isWorldMatrixFrozen||this._waitingData.freezeWorldMatrix?"YES":"NO")),t},t.prototype._getEffectiveParent=function(){return this._masterMesh&&this.billboardMode!==c.TransformNode.BILLBOARDMODE_NONE?this._masterMesh:e.prototype._getEffectiveParent.call(this)},t.prototype._getActionManagerForTrigger=function(e,t){if(void 0===t&&(t=!0),this.actionManager&&(t||this.actionManager.isRecursive)){if(!e)return this.actionManager;if(this.actionManager.hasSpecificTrigger(e))return this.actionManager}return this.parent?this.parent._getActionManagerForTrigger(e,!1):null},t.prototype._rebuild=function(){if(this.onRebuildObservable.notifyObservers(this),this._occlusionQuery&&(this._occlusionQuery=null),this.subMeshes)for(var e=0,t=this.subMeshes;e4,a=o?this.getVerticesData(l.o.MatricesIndicesExtraKind):null,h=o?this.getVerticesData(l.o.MatricesWeightsExtraKind):null;this.skeleton.prepare();for(var c=this.skeleton.getTransformMatrices(this),u=s.jp.Vector3[0],f=s.jp.Matrix[0],d=s.jp.Matrix[1],p=0,_=0;_0&&(s.y3.FromFloat32ArrayToRefScaled(c,Math.floor(16*i[p+g]),m,d),f.addToSelf(d));if(o)for(g=0;g<4;g++)(m=h[p+g])>0&&(s.y3.FromFloat32ArrayToRefScaled(c,Math.floor(16*a[p+g]),m,d),f.addToSelf(d));s.P.TransformCoordinatesFromFloatsToRef(t[_],t[_+1],t[_+2],f,u),u.toArray(t,_),this._positions&&this._positions[_/3].copyFrom(u)}}}return t},t.prototype._updateBoundingInfo=function(){var e=this._effectiveMesh;return this._boundingInfo?this._boundingInfo.update(e.worldMatrixFromCache):this._boundingInfo=new f.j(this.absolutePosition,this.absolutePosition,e.worldMatrixFromCache),this._updateSubMeshesBoundingInfo(e.worldMatrixFromCache),this},t.prototype._updateSubMeshesBoundingInfo=function(e){if(!this.subMeshes)return this;for(var t=this.subMeshes.length,i=0;i1||!n.IsGlobal)&&n.updateBoundingInfo(e)}return this},t.prototype._afterComputeWorldMatrix=function(){this.doNotSyncBoundingInfo||this._updateBoundingInfo()},Object.defineProperty(t.prototype,"_effectiveMesh",{get:function(){return this.skeleton&&this.skeleton.overrideMesh||this},enumerable:!1,configurable:!0}),t.prototype.isInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isInFrustum(e,this.cullingStrategy)},t.prototype.isCompletelyInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isCompletelyInFrustum(e)},t.prototype.intersectsMesh=function(e,t,i){if(void 0===t&&(t=!1),!this._boundingInfo||!e._boundingInfo)return!1;if(this._boundingInfo.intersects(e._boundingInfo,t))return!0;if(i)for(var n=0,r=this.getChildMeshes();n1&&!o._checkCollision(e)||this._collideForSubMesh(o,t,e)}return this},t.prototype._checkCollision=function(e){if(!this._boundingInfo||!this._boundingInfo._checkCollision(e))return this;var t=s.jp.Matrix[0],i=s.jp.Matrix[1];return s.y3.ScalingToRef(1/e._radius.x,1/e._radius.y,1/e._radius.z,t),this.worldMatrixFromCache.multiplyToRef(t,i),this._processCollisionsForSubMeshes(e,i),this},t.prototype._generatePointsArray=function(){return!1},t.prototype.intersects=function(e,t,i,n,r,o){var a;void 0===n&&(n=!1),void 0===o&&(o=!1);var l=new u.p,h="InstancedLinesMesh"===this.getClassName()||"LinesMesh"===this.getClassName()?this.intersectionThreshold:0,c=this._boundingInfo;if(!this.subMeshes||!c)return l;if(!(o||e.intersectsSphere(c.boundingSphere,h)&&e.intersectsBox(c.boundingBox,h)))return l;if(n)return l.hit=!o,l.pickedMesh=o?null:this,l.distance=o?0:s.P.Distance(e.origin,c.boundingSphere.center),l.subMeshId=0,l;if(!this._generatePointsArray())return l;for(var f=null,d=this._scene.getIntersectingSubMeshCandidates(this,e),p=d.length,_=!1,g=0;g1)||v.canIntersects(e)){var y=v.intersects(e,this._positions,this.getIndices(),t,i);if(y&&(t||!f||y.distance65535){o=!0;break}e.depthSortedIndices=o?new Uint32Array(i):new Uint16Array(i)}if(e.facetDepthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},!e.facetDepthSortFrom){var c=this.getScene().activeCamera;e.facetDepthSortFrom=c?c.position:s.P.Zero()}e.depthSortedFacets=[];for(var u=0;um.kn?r.maximum.x-r.minimum.x:m.kn,e.bbSize.y=r.maximum.y-r.minimum.y>m.kn?r.maximum.y-r.minimum.y:m.kn,e.bbSize.z=r.maximum.z-r.minimum.z>m.kn?r.maximum.z-r.minimum.z:m.kn;var d=e.bbSize.x>e.bbSize.y?e.bbSize.x:e.bbSize.y;if(d=d>e.bbSize.z?d:e.bbSize.z,e.subDiv.max=e.partitioningSubdivisions,e.subDiv.X=Math.floor(e.subDiv.max*e.bbSize.x/d),e.subDiv.Y=Math.floor(e.subDiv.max*e.bbSize.y/d),e.subDiv.Z=Math.floor(e.subDiv.max*e.bbSize.z/d),e.subDiv.X=e.subDiv.X<1?1:e.subDiv.X,e.subDiv.Y=e.subDiv.Y<1?1:e.subDiv.Y,e.subDiv.Z=e.subDiv.Z<1?1:e.subDiv.Z,e.facetParameters.facetNormals=this.getFacetLocalNormals(),e.facetParameters.facetPositions=this.getFacetLocalPositions(),e.facetParameters.facetPartitioning=this.getFacetLocalPartitioning(),e.facetParameters.bInfo=r,e.facetParameters.bbSize=e.bbSize,e.facetParameters.subDiv=e.subDiv,e.facetParameters.ratio=this.partitioningBBoxRatio,e.facetParameters.depthSort=e.facetDepthSort,e.facetDepthSort&&e.facetDepthSortEnabled&&(this.computeWorldMatrix(!0),this._worldMatrix.invertToRef(e.invertedMatrix),s.P.TransformCoordinatesToRef(e.facetDepthSortFrom,e.invertedMatrix,e.facetDepthSortOrigin),e.facetParameters.distanceTo=e.facetDepthSortOrigin),e.facetParameters.depthSortedFacets=e.depthSortedFacets,h.VertexData.ComputeNormals(t,i,n,e.facetParameters),e.facetDepthSort&&e.facetDepthSortEnabled){e.depthSortedFacets.sort(e.facetDepthSortFunction);var p=e.depthSortedIndices.length/3|0;for(u=0;ur.subDiv.max||s<0||s>r.subDiv.max||a<0||a>r.subDiv.max?null:r.facetPartitioning[o+r.subDiv.max*s+r.subDiv.max*r.subDiv.max*a]},t.prototype.getClosestFacetAtCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var a=this.getWorldMatrix(),l=s.jp.Matrix[5];a.invertToRef(l);var h=s.jp.Vector3[8];s.P.TransformCoordinatesFromFloatsToRef(e,t,i,l,h);var c=this.getClosestFacetAtLocalCoordinates(h.x,h.y,h.z,n,r,o);return n&&s.P.TransformCoordinatesFromFloatsToRef(n.x,n.y,n.z,a,n),c},t.prototype.getClosestFacetAtLocalCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var s=null,a=0,l=0,h=0,c=0,u=0,f=0,d=0,p=0,_=this.getFacetLocalPositions(),g=this.getFacetLocalNormals(),m=this.getFacetsAtLocalCoordinates(e,t,i);if(!m)return null;for(var v,y,b,T=Number.MAX_VALUE,A=T,E=0;E=0||r&&!o&&c<=0)&&(c=y.x*b.x+y.y*b.y+y.z*b.z,u=-(y.x*e+y.y*t+y.z*i-c)/(y.x*y.x+y.y*y.y+y.z*y.z),(A=(a=(f=e+y.x*u)-e)*a+(l=(d=t+y.y*u)-t)*l+(h=(p=i+y.z*u)-i)*h){"use strict";i.d(t,{l:()=>n,o:()=>r});var n=function(){function e(e,t,i,n,r,o,s,a){void 0===n&&(n=0),void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===s&&(s=!1),this._isAlreadyOwned=!1,e.getScene?this._engine=e.getScene().getEngine():this._engine=e,this._updatable=i,this._instanced=o,this._divisor=a||1,this._data=t,this.byteStride=s?n:n*Float32Array.BYTES_PER_ELEMENT,r||this.create()}return e.prototype.createVertexBuffer=function(e,t,i,n,o,s,a){void 0===s&&(s=!1);var l=s?t:t*Float32Array.BYTES_PER_ELEMENT,h=n?s?n:n*Float32Array.BYTES_PER_ELEMENT:this.byteStride;return new r(this._engine,this,e,this._updatable,!0,h,void 0===o?this._instanced:o,l,i,void 0,void 0,!0,this._divisor||a)},e.prototype.isUpdatable=function(){return this._updatable},e.prototype.getData=function(){return this._data},e.prototype.getBuffer=function(){return this._buffer},e.prototype.getStrideSize=function(){return this.byteStride/Float32Array.BYTES_PER_ELEMENT},e.prototype.create=function(e){void 0===e&&(e=null),!e&&this._buffer||(e=e||this._data)&&(this._buffer?this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e),this._data=e):this._updatable?(this._buffer=this._engine.createDynamicVertexBuffer(e),this._data=e):this._buffer=this._engine.createVertexBuffer(e))},e.prototype._rebuild=function(){this._buffer=null,this.create(this._data)},e.prototype.update=function(e){this.create(e)},e.prototype.updateDirectly=function(e,t,i,n){void 0===n&&(n=!1),this._buffer&&this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e,n?t:t*Float32Array.BYTES_PER_ELEMENT,i?i*this.byteStride:void 0),this._data=null)},e.prototype._increaseReferences=function(){this._buffer&&(this._isAlreadyOwned?this._buffer.references++:this._isAlreadyOwned=!0)},e.prototype.dispose=function(){this._buffer&&this._engine._releaseBuffer(this._buffer)&&(this._buffer=null)},e}(),r=function(){function e(t,i,r,o,s,a,l,h,c,u,f,d,p,_){if(void 0===f&&(f=!1),void 0===d&&(d=!1),void 0===p&&(p=1),void 0===_&&(_=!1),i instanceof n?(this._buffer=i,this._ownsBuffer=_,_&&this._buffer._increaseReferences()):(this._buffer=new n(t,i,o,a,s,l,d),this._ownsBuffer=!0),this._kind=r,null==u){var g=this.getData();this.type=e.FLOAT,g instanceof Int8Array?this.type=e.BYTE:g instanceof Uint8Array?this.type=e.UNSIGNED_BYTE:g instanceof Int16Array?this.type=e.SHORT:g instanceof Uint16Array?this.type=e.UNSIGNED_SHORT:g instanceof Int32Array?this.type=e.INT:g instanceof Uint32Array&&(this.type=e.UNSIGNED_INT)}else this.type=u;var m=e.GetTypeByteLength(this.type);d?(this._size=c||(a?a/m:e.DeduceStride(r)),this.byteStride=a||this._buffer.byteStride||this._size*m,this.byteOffset=h||0):(this._size=c||a||e.DeduceStride(r),this.byteStride=a?a*m:this._buffer.byteStride||this._size*m,this.byteOffset=(h||0)*m),this.normalized=f,this._instanced=void 0!==l&&l,this._instanceDivisor=l?p:0}return Object.defineProperty(e.prototype,"instanceDivisor",{get:function(){return this._instanceDivisor},set:function(e){this._instanceDivisor=e,this._instanced=0!=e},enumerable:!1,configurable:!0}),e.prototype._rebuild=function(){this._buffer&&this._buffer._rebuild()},e.prototype.getKind=function(){return this._kind},e.prototype.isUpdatable=function(){return this._buffer.isUpdatable()},e.prototype.getData=function(){return this._buffer.getData()},e.prototype.getBuffer=function(){return this._buffer.getBuffer()},e.prototype.getStrideSize=function(){return this.byteStride/e.GetTypeByteLength(this.type)},e.prototype.getOffset=function(){return this.byteOffset/e.GetTypeByteLength(this.type)},e.prototype.getSize=function(){return this._size},e.prototype.getIsInstanced=function(){return this._instanced},e.prototype.getInstanceDivisor=function(){return this._instanceDivisor},e.prototype.create=function(e){this._buffer.create(e)},e.prototype.update=function(e){this._buffer.update(e)},e.prototype.updateDirectly=function(e,t,i){void 0===i&&(i=!1),this._buffer.updateDirectly(e,t,void 0,i)},e.prototype.dispose=function(){this._ownsBuffer&&this._buffer.dispose()},e.prototype.forEach=function(t,i){e.ForEach(this._buffer.getData(),this.byteOffset,this.byteStride,this._size,this.type,t,this.normalized,i)},e.DeduceStride=function(t){switch(t){case e.UVKind:case e.UV2Kind:case e.UV3Kind:case e.UV4Kind:case e.UV5Kind:case e.UV6Kind:return 2;case e.NormalKind:case e.PositionKind:return 3;case e.ColorKind:case e.MatricesIndicesKind:case e.MatricesIndicesExtraKind:case e.MatricesWeightsKind:case e.MatricesWeightsExtraKind:case e.TangentKind:return 4;default:throw new Error("Invalid kind '"+t+"'")}},e.GetTypeByteLength=function(t){switch(t){case e.BYTE:case e.UNSIGNED_BYTE:return 1;case e.SHORT:case e.UNSIGNED_SHORT:return 2;case e.INT:case e.UNSIGNED_INT:case e.FLOAT:return 4;default:throw new Error("Invalid type '"+t+"'")}},e.ForEach=function(t,i,n,r,o,s,a,l){if(t instanceof Array)for(var h=i/4,c=n/4,u=0;u{"use strict";i.d(t,{Z:()=>d});var n=i(2973),r=i(8362),o=i(128),s=i(6738),a=i(3335),l=i(9995),h=i(2520),c=i(5540),u=i(4115),f=i(5168),d=function(){function e(e,t,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=null),this.delayLoadState=0,this._totalVertices=0,this._isDisposed=!1,this._indexBufferIsUpdatable=!1,this._positionsCache=[],this.useBoundingInfoFromGeometry=!1,this.id=e,this.uniqueId=t.getUniqueId(),this._engine=t.getEngine(),this._meshes=[],this._scene=t,this._vertexBuffers={},this._indices=[],this._updatable=n,i?this.setAllVerticesData(i,n):(this._totalVertices=0,this._indices=[]),this._engine.getCaps().vertexArrayObject&&(this._vertexArrayObjects={}),r&&(this.applyToMesh(r),r.computeWorldMatrix(!0))}return Object.defineProperty(e.prototype,"boundingBias",{get:function(){return this._boundingBias},set:function(e){this._boundingBias?this._boundingBias.copyFrom(e):this._boundingBias=e.clone(),this._updateBoundingInfo(!0,null)},enumerable:!1,configurable:!0}),e.CreateGeometryForMesh=function(t){var i=new e(e.RandomId(),t.getScene());return i.applyToMesh(t),i},Object.defineProperty(e.prototype,"meshes",{get:function(){return this._meshes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extend",{get:function(){return this._extend},enumerable:!1,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype.getEngine=function(){return this._engine},e.prototype.isReady=function(){return 1===this.delayLoadState||0===this.delayLoadState},Object.defineProperty(e.prototype,"doNotSerialize",{get:function(){for(var e=0;e0&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices)),this._indexBuffer&&(this._indexBuffer.references=t),e._syncGeometryWithMorphTargetManager(),e.synchronizeInstances()},e.prototype.notifyUpdate=function(e){this.onGeometryUpdated&&this.onGeometryUpdated(this,e);for(var t=0,i=this._meshes;t0){for(var t=0;t0){for(t=0;t0){for(t=0;t0){var c=new Float32Array(t,h.positionsAttrDesc.offset,h.positionsAttrDesc.count);i.setVerticesData(s.o.PositionKind,c,!1)}if(h.normalsAttrDesc&&h.normalsAttrDesc.count>0){var u=new Float32Array(t,h.normalsAttrDesc.offset,h.normalsAttrDesc.count);i.setVerticesData(s.o.NormalKind,u,!1)}if(h.tangetsAttrDesc&&h.tangetsAttrDesc.count>0){var f=new Float32Array(t,h.tangetsAttrDesc.offset,h.tangetsAttrDesc.count);i.setVerticesData(s.o.TangentKind,f,!1)}if(h.uvsAttrDesc&&h.uvsAttrDesc.count>0){var d=new Float32Array(t,h.uvsAttrDesc.offset,h.uvsAttrDesc.count);i.setVerticesData(s.o.UVKind,d,!1)}if(h.uvs2AttrDesc&&h.uvs2AttrDesc.count>0){var p=new Float32Array(t,h.uvs2AttrDesc.offset,h.uvs2AttrDesc.count);i.setVerticesData(s.o.UV2Kind,p,!1)}if(h.uvs3AttrDesc&&h.uvs3AttrDesc.count>0){var _=new Float32Array(t,h.uvs3AttrDesc.offset,h.uvs3AttrDesc.count);i.setVerticesData(s.o.UV3Kind,_,!1)}if(h.uvs4AttrDesc&&h.uvs4AttrDesc.count>0){var g=new Float32Array(t,h.uvs4AttrDesc.offset,h.uvs4AttrDesc.count);i.setVerticesData(s.o.UV4Kind,g,!1)}if(h.uvs5AttrDesc&&h.uvs5AttrDesc.count>0){var m=new Float32Array(t,h.uvs5AttrDesc.offset,h.uvs5AttrDesc.count);i.setVerticesData(s.o.UV5Kind,m,!1)}if(h.uvs6AttrDesc&&h.uvs6AttrDesc.count>0){var v=new Float32Array(t,h.uvs6AttrDesc.offset,h.uvs6AttrDesc.count);i.setVerticesData(s.o.UV6Kind,v,!1)}if(h.colorsAttrDesc&&h.colorsAttrDesc.count>0){var y=new Float32Array(t,h.colorsAttrDesc.offset,h.colorsAttrDesc.count);i.setVerticesData(s.o.ColorKind,y,!1,h.colorsAttrDesc.stride)}if(h.matricesIndicesAttrDesc&&h.matricesIndicesAttrDesc.count>0){for(var b=new Int32Array(t,h.matricesIndicesAttrDesc.offset,h.matricesIndicesAttrDesc.count),T=[],A=0;A>8),T.push((16711680&E)>>16),T.push(E>>24&255)}i.setVerticesData(s.o.MatricesIndicesKind,T,!1)}if(h.matricesIndicesExtraAttrDesc&&h.matricesIndicesExtraAttrDesc.count>0){for(b=new Int32Array(t,h.matricesIndicesExtraAttrDesc.offset,h.matricesIndicesExtraAttrDesc.count),T=[],A=0;A>8),T.push((16711680&E)>>16),T.push(E>>24&255)}i.setVerticesData(s.o.MatricesIndicesExtraKind,T,!1)}if(h.matricesWeightsAttrDesc&&h.matricesWeightsAttrDesc.count>0){var C=new Float32Array(t,h.matricesWeightsAttrDesc.offset,h.matricesWeightsAttrDesc.count);i.setVerticesData(s.o.MatricesWeightsKind,C,!1)}if(h.indicesAttrDesc&&h.indicesAttrDesc.count>0){var x=new Int32Array(t,h.indicesAttrDesc.offset,h.indicesAttrDesc.count);i.setIndices(x,null)}if(h.subMeshesAttrDesc&&h.subMeshesAttrDesc.count>0){var S=new Int32Array(t,h.subMeshesAttrDesc.offset,5*h.subMeshesAttrDesc.count);i.subMeshes=[];for(A=0;A>8),T.push((16711680&D)>>16),T.push(D>>24&255)}i.setVerticesData(s.o.MatricesIndicesKind,T,t.matricesIndices._updatable)}if(t.matricesIndicesExtra)if(t.matricesIndicesExtra._isExpanded)delete t.matricesIndices._isExpanded,i.setVerticesData(s.o.MatricesIndicesExtraKind,t.matricesIndicesExtra,t.matricesIndicesExtra._updatable);else{for(T=[],A=0;A>8),T.push((16711680&D)>>16),T.push(D>>24&255)}i.setVerticesData(s.o.MatricesIndicesExtraKind,T,t.matricesIndicesExtra._updatable)}t.matricesWeights&&(e._CleanMatricesWeights(t,i),i.setVerticesData(s.o.MatricesWeightsKind,t.matricesWeights,t.matricesWeights._updatable)),t.matricesWeightsExtra&&i.setVerticesData(s.o.MatricesWeightsExtraKind,t.matricesWeightsExtra,t.matricesWeights._updatable),i.setIndices(t.indices,null)}if(t.subMeshes){i.subMeshes=[];for(var L=0;L-1){var r=t.getScene().getLastSkeletonByID(e.skeletonId);if(r){n=r.bones.length;for(var o=t.getVerticesData(s.o.MatricesIndicesKind),a=t.getVerticesData(s.o.MatricesIndicesExtraKind),h=e.matricesWeights,c=e.matricesWeightsExtra,u=e.numBoneInfluencer,f=h.length,d=0;du-1)&&(_=u-1),p>i){var v=1/p;for(g=0;g<4;g++)h[d+g]*=v;if(c)for(g=0;g<4;g++)c[d+g]*=v}else _>=4?(c[d+_-4]=1-p,a[d+_-4]=n):(h[d+_]=1-p,o[d+_]=n)}t.setVerticesData(s.o.MatricesIndicesKind,o),e.matricesWeightsExtra&&t.setVerticesData(s.o.MatricesIndicesExtraKind,a)}}}},e.Parse=function(t,i,r){if(i.getGeometryByID(t.id))return null;var a=new e(t.id,i,void 0,t.updatable);return u.$&&u.$.AddTagsTo(a,t.tags),t.delayLoadingFile?(a.delayLoadState=4,a.delayLoadingFile=r+t.delayLoadingFile,a._boundingInfo=new h.j(n.P.FromArray(t.boundingBoxMinimum),n.P.FromArray(t.boundingBoxMaximum)),a._delayInfo=[],t.hasUVs&&a._delayInfo.push(s.o.UVKind),t.hasUVs2&&a._delayInfo.push(s.o.UV2Kind),t.hasUVs3&&a._delayInfo.push(s.o.UV3Kind),t.hasUVs4&&a._delayInfo.push(s.o.UV4Kind),t.hasUVs5&&a._delayInfo.push(s.o.UV5Kind),t.hasUVs6&&a._delayInfo.push(s.o.UV6Kind),t.hasColors&&a._delayInfo.push(s.o.ColorKind),t.hasMatricesIndices&&a._delayInfo.push(s.o.MatricesIndicesKind),t.hasMatricesWeights&&a._delayInfo.push(s.o.MatricesWeightsKind),a._delayLoadingFunction=o.VertexData.ImportVertexData):o.VertexData.ImportVertexData(t,a),i.pushGeometry(a,!0),a},e}()},6212:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Mesh:()=>D,_CreationDataStorage:()=>R,_InstancesBatch:()=>P});var n=i(655),r=i(475),o=i(5540),s=i(789),a=i(4115),l=i(2973),h=i(8362),c=i(2686),u=i(6738),f=i(128),d=i(3953),p=i(5385),_=i(3335),g=i(2520),m=i(511),v=i(9541),y=i(9995),b=i(9023),T=i(3734),A=i(6132),E=i(106),C=i(7383),x=function(e,t){this.distance=e,this.mesh=t},S=i(1370),R=function(){},M=function(){this.visibleInstances={},this.batchCache=new P,this.instancesBufferSize=2048},P=function(){this.mustReturn=!1,this.visibleInstances=new Array,this.renderSelf=new Array,this.hardwareInstancedRendering=new Array},I=function(){this.instancesCount=0,this.matrixBuffer=null,this.matrixBufferSize=512,this.boundingVectors=[],this.worldMatrices=null},O=function(){this._areNormalsFrozen=!1,this._source=null,this.meshMap=null,this._preActivateId=-1,this._LODLevels=new Array,this._morphTargetManager=null},D=function(e){function t(i,n,r,o,l,h){void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===h&&(h=!0);var c=e.call(this,i,n)||this;if(c._internalMeshDataInfo=new O,c.delayLoadState=0,c.instances=new Array,c._creationDataStorage=null,c._geometry=null,c._instanceDataStorage=new M,c._thinInstanceDataStorage=new I,c._effectiveMaterial=null,c._shouldGenerateFlatShading=!1,c._originalBuilderSideOrientation=t.DEFAULTSIDE,c.overrideMaterialSideOrientation=null,n=c.getScene(),o){if(o._geometry&&o._geometry.applyToMesh(c),s.j.DeepCopy(o,c,["name","material","skeleton","instances","parent","uniqueId","source","metadata","morphTargetManager","hasInstances","source","worldMatrixInstancedBuffer","hasLODLevels","geometry","isBlocked","areNormalsFrozen","facetNb","isFacetDataEnabled","lightSources","useBones","isAnInstance","collider","edgesRenderer","forward","up","right","absolutePosition","absoluteScaling","absoluteRotationQuaternion","isWorldMatrixFrozen","nonUniformScaling","behaviors","worldMatrixFromCache","hasThinInstances","cloneMeshMap"],["_poseMatrix"]),c._internalMeshDataInfo._source=o,n.useClonedMeshMap&&(o._internalMeshDataInfo.meshMap||(o._internalMeshDataInfo.meshMap={}),o._internalMeshDataInfo.meshMap[c.uniqueId]=c),c._originalBuilderSideOrientation=o._originalBuilderSideOrientation,c._creationDataStorage=o._creationDataStorage,o._ranges){var u=o._ranges;for(var i in u)u.hasOwnProperty(i)&&u[i]&&c.createAnimationRange(i,u[i].from,u[i].to)}var f;if(o.metadata&&o.metadata.clone?c.metadata=o.metadata.clone():c.metadata=o.metadata,a.$&&a.$.HasTags(o)&&a.$.AddTagsTo(c,a.$.GetTags(o,!0)),c.setEnabled(o.isEnabled()),c.parent=o.parent,c.setPivotMatrix(o.getPivotMatrix()),c.id=i+"."+o.id,c.material=o.material,!l)for(var d=o.getDescendants(!0),p=0;p0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasThinInstances",{get:function(){var e;return(null!==(e=this._thinInstanceDataStorage.instancesCount)&&void 0!==e?e:0)>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"morphTargetManager",{get:function(){return this._internalMeshDataInfo._morphTargetManager},set:function(e){this._internalMeshDataInfo._morphTargetManager!==e&&(this._internalMeshDataInfo._morphTargetManager=e,this._syncGeometryWithMorphTargetManager())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"source",{get:function(){return this._internalMeshDataInfo._source},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cloneMeshMap",{get:function(){return this._internalMeshDataInfo.meshMap},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUnIndexed",{get:function(){return this._unIndexed},set:function(e){this._unIndexed!==e&&(this._unIndexed=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldMatrixInstancedBuffer",{get:function(){return this._instanceDataStorage.instancesData},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"manualUpdateOfWorldMatrixInstancedBuffer",{get:function(){return this._instanceDataStorage.manualUpdate},set:function(e){this._instanceDataStorage.manualUpdate=e},enumerable:!1,configurable:!0}),t.prototype.instantiateHierarchy=function(e,t,i){void 0===e&&(e=null);var n=!(this.getTotalVertices()>0)||t&&t.doNotInstantiate?this.clone("Clone of "+(this.name||this.id),e||this.parent,!0):this.createInstance("instance of "+(this.name||this.id));n&&(n.parent=e||this.parent,n.position=this.position.clone(),n.scaling=this.scaling.clone(),this.rotationQuaternion?n.rotationQuaternion=this.rotationQuaternion.clone():n.rotation=this.rotation.clone(),i&&i(this,n));for(var r=0,o=this.getChildTransformNodes(!0);r0},enumerable:!1,configurable:!0}),t.prototype.getLODLevels=function(){return this._internalMeshDataInfo._LODLevels},t.prototype._sortLODLevels=function(){this._internalMeshDataInfo._LODLevels.sort((function(e,t){return e.distancet.distance?-1:0}))},t.prototype.addLODLevel=function(e,t){if(t&&t._masterMesh)return T.Y.Warn("You cannot use a mesh as LOD level twice"),this;var i=new x(e,t);return this._internalMeshDataInfo._LODLevels.push(i),t&&(t._masterMesh=this),this._sortLODLevels(),this},t.prototype.getLODLevelAtDistance=function(e){for(var t=this._internalMeshDataInfo,i=0;ir)return this.onLODLevelSelection&&this.onLODLevelSelection(r,this,this),this;for(var o=0;o0||this.hasThinInstances);this.computeWorldMatrix();var f=this.material||c.defaultMaterial;if(f)if(f._storeEffectOnSubMeshes)for(var d=0,p=this.subMeshes;d0){var i=this.getIndices();if(!i)return null;var n=i.length,r=!1;if(e)r=!0;else for(var o=0,s=this.subMeshes;on){r=!0;break}if(a.verticesStart+a.verticesCount>t){r=!0;break}}if(!r)return this.subMeshes[0]}return this.releaseSubMeshes(),new _.P(0,0,t,0,this.getTotalIndices(),this)},t.prototype.subdivide=function(e){if(!(e<1)){for(var t=this.getTotalIndices(),i=t/e|0,n=0;i%3!=0;)i++;this.releaseSubMeshes();for(var r=0;r=t);r++)_.P.CreateFromIndices(0,n,r===e-1?t-n:i,this),n+=i;this.synchronizeInstances()}},t.prototype.setVerticesData=function(e,t,i,n){if(void 0===i&&(i=!1),this._geometry)this._geometry.setVerticesData(e,t,i,n);else{var r=new f.VertexData;r.set(t,e);var o=this.getScene();new d.Z(d.Z.RandomId(),o,r,i,this)}return this},t.prototype.removeVerticesData=function(e){this._geometry&&this._geometry.removeVerticesData(e)},t.prototype.markVerticesDataAsUpdatable=function(e,t){void 0===t&&(t=!0);var i=this.getVertexBuffer(e);i&&i.isUpdatable()!==t&&this.setVerticesData(e,this.getVerticesData(e),t)},t.prototype.setVerticesBuffer=function(e){return this._geometry||(this._geometry=d.Z.CreateGeometryForMesh(this)),this._geometry.setVerticesBuffer(e),this},t.prototype.updateVerticesData=function(e,t,i,n){return this._geometry?(n?(this.makeGeometryUnique(),this.updateVerticesData(e,t,i,!1)):this._geometry.updateVerticesData(e,t,i),this):this},t.prototype.updateMeshPositions=function(e,t){void 0===t&&(t=!0);var i=this.getVerticesData(u.o.PositionKind);if(!i)return this;if(e(i),this.updateVerticesData(u.o.PositionKind,i,!1,!1),t){var n=this.getIndices(),r=this.getVerticesData(u.o.NormalKind);if(!r)return this;f.VertexData.ComputeNormals(i,n,r),this.updateVerticesData(u.o.NormalKind,r,!1,!1)}return this},t.prototype.makeGeometryUnique=function(){if(!this._geometry)return this;if(1===this._geometry.meshes.length)return this;var e=this._geometry,t=this._geometry.copy(d.Z.RandomId());return e.releaseForMesh(this,!0),t.applyToMesh(this),this},t.prototype.setIndices=function(e,t,i){if(void 0===t&&(t=null),void 0===i&&(i=!1),this._geometry)this._geometry.setIndices(e,t,i);else{var n=new f.VertexData;n.indices=e;var r=this.getScene();new d.Z(d.Z.RandomId(),r,n,i,this)}return this},t.prototype.updateIndices=function(e,t,i){return void 0===i&&(i=!1),this._geometry?(this._geometry.updateIndices(e,t,i),this):this},t.prototype.toLeftHanded=function(){return this._geometry?(this._geometry.toLeftHanded(),this):this},t.prototype._bind=function(e,t,i){if(!this._geometry)return this;var n,r=this.getScene().getEngine();if(this._unIndexed)n=null;else switch(i){case m.F.PointFillMode:n=null;break;case m.F.WireFrameFillMode:n=e._getLinesIndexBuffer(this.getIndices(),r);break;default:case m.F.TriangleFillMode:n=this._geometry.getIndexBuffer()}return this._geometry._bind(t,n),this},t.prototype._draw=function(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this._internalMeshDataInfo._onBeforeDrawObservable&&this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);var n=this.getScene().getEngine();return this._unIndexed||t==m.F.PointFillMode?n.drawArraysType(t,e.verticesStart,e.verticesCount,i):t==m.F.WireFrameFillMode?n.drawElementsType(t,0,e._linesIndexCount,i):n.drawElementsType(t,e.indexStart,e.indexCount,i),this},t.prototype.registerBeforeRender=function(e){return this.onBeforeRenderObservable.add(e),this},t.prototype.unregisterBeforeRender=function(e){return this.onBeforeRenderObservable.removeCallback(e),this},t.prototype.registerAfterRender=function(e){return this.onAfterRenderObservable.add(e),this},t.prototype.unregisterAfterRender=function(e){return this.onAfterRenderObservable.removeCallback(e),this},t.prototype._getInstancesRenderList=function(e,t){if(void 0===t&&(t=!1),this._instanceDataStorage.isFrozen&&this._instanceDataStorage.previousBatch)return this._instanceDataStorage.previousBatch;var i=this.getScene(),n=i._isInIntermediateRendering(),r=n?this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate:this._internalAbstractMeshDataInfo._onlyForInstances,o=this._instanceDataStorage.batchCache;if(o.mustReturn=!1,o.renderSelf[e]=t||!r&&this.isEnabled()&&this.isVisible,o.visibleInstances[e]=null,this._instanceDataStorage.visibleInstances&&!t){var s=this._instanceDataStorage.visibleInstances,a=i.getRenderId(),l=n?s.intermediateDefaultRenderId:s.defaultRenderId;o.visibleInstances[e]=s[a],!o.visibleInstances[e]&&l&&(o.visibleInstances[e]=s[l])}return o.hardwareInstancedRendering[e]=!t&&this._instanceDataStorage.hardwareInstancedRendering&&null!==o.visibleInstances[e]&&void 0!==o.visibleInstances[e],this._instanceDataStorage.previousBatch=o,o},t.prototype._renderWithInstances=function(e,t,i,n,r){var o=i.visibleInstances[e._id];if(!o)return this;for(var s=this._instanceDataStorage,a=s.instancesBufferSize,l=s.instancesBuffer,h=16*(o.length+1)*4;s.instancesBufferSizec&&n++,0!==_&&d++,f+=_,c=_}if(l[d]++,d>o&&(o=d),0===f)r++;else{var g=1/f,m=0;for(p=0;p.001&&s++}}var v=this.skeleton.bones.length,y=this.getVerticesData(u.o.MatricesIndicesKind),b=this.getVerticesData(u.o.MatricesIndicesExtraKind),T=0;for(h=0;h=v||A<0)&&T++}return{skinned:!0,valid:0===r&&0===s&&0===T,report:"Number of Weights = "+i/4+"\nMaximum influences = "+o+"\nMissing Weights = "+r+"\nNot Sorted = "+n+"\nNot Normalized = "+s+"\nWeightCounts = ["+l+"]\nNumber of bones = "+v+"\nBad Bone Indices = "+T}},t.prototype._checkDelayState=function(){var e=this.getScene();return this._geometry?this._geometry.load(e):4===this.delayLoadState&&(this.delayLoadState=2,this._queueLoad(e)),this},t.prototype._queueLoad=function(e){var t=this;e._addPendingData(this);var i=-1!==this.delayLoadingFile.indexOf(".babylonbinarymeshdata");return o.w1.LoadFile(this.delayLoadingFile,(function(i){i instanceof ArrayBuffer?t._delayLoadingFunction(i,t):t._delayLoadingFunction(JSON.parse(i),t),t.instances.forEach((function(e){e.refreshBoundingInfo(),e._syncSubMeshes()})),t.delayLoadState=1,e._removePendingData(t)}),(function(){}),e.offlineProvider,i),this},t.prototype.isInFrustum=function(t){return 2!==this.delayLoadState&&(!!e.prototype.isInFrustum.call(this,t)&&(this._checkDelayState(),!0))},t.prototype.setMaterialByID=function(e){var t,i=this.getScene().materials;for(t=i.length-1;t>-1;t--)if(i[t].id===e)return this.material=i[t],this;var n=this.getScene().multiMaterials;for(t=n.length-1;t>-1;t--)if(n[t].id===e)return this.material=n[t],this;return this},t.prototype.getAnimatables=function(){var e=new Array;return this.material&&e.push(this.material),this.skeleton&&e.push(this.skeleton),e},t.prototype.bakeTransformIntoVertices=function(e){if(!this.isVerticesDataPresent(u.o.PositionKind))return this;var t=this.subMeshes.splice(0);this._resetPointsArrayCache();var i,n=this.getVerticesData(u.o.PositionKind),r=new Array;for(i=0;i1)for(var n=0,r=i.meshes.slice(0);n-1&&(r.morphTargetManager=i.getMorphTargetManagerById(e.morphTargetManagerId)),void 0!==e.skeletonId&&null!==e.skeletonId&&(r.skeleton=i.getLastSkeletonByID(e.skeletonId),e.numBoneInfluencers&&(r.numBoneInfluencers=e.numBoneInfluencers)),e.animations){for(var o=0;o4,f=c?this.getVerticesData(u.o.MatricesIndicesExtraKind):null,d=c?this.getVerticesData(u.o.MatricesWeightsExtraKind):null,p=e.getTransformMatrices(this),_=l.P.Zero(),g=new l.y3,m=new l.y3,v=0,y=0;y0&&(l.y3.FromFloat32ArrayToRefScaled(p,Math.floor(16*s[v+h]),b,m),g.addToSelf(m));if(c)for(h=0;h<4;h++)(b=d[v+h])>0&&(l.y3.FromFloat32ArrayToRefScaled(p,Math.floor(16*f[v+h]),b,m),g.addToSelf(m));l.P.TransformCoordinatesFromFloatsToRef(i._sourcePositions[y],i._sourcePositions[y+1],i._sourcePositions[y+2],g,_),_.toArray(r,y),t&&(l.P.TransformNormalFromFloatsToRef(i._sourceNormals[y],i._sourceNormals[y+1],i._sourceNormals[y+2],g,_),_.toArray(o,y)),g.reset()}return this.updateVerticesData(u.o.PositionKind,r),t&&this.updateVerticesData(u.o.NormalKind,o),this},t.MinMax=function(e){var t=null,i=null;return e.forEach((function(e){var n=e.getBoundingInfo().boundingBox;t&&i?(t.minimizeInPlace(n.minimumWorld),i.maximizeInPlace(n.maximumWorld)):(t=n.minimumWorld,i=n.maximumWorld)})),t&&i?{min:t,max:i}:{min:l.P.Zero(),max:l.P.Zero()}},t.Center=function(e){var i=e instanceof Array?t.MinMax(e):e;return l.P.Center(i.min,i.max)},t.MergeMeshes=function(e,i,n,r,o,s){var a;if(void 0===i&&(i=!0),!n){var l=0;for(a=0;a=65536)return T.Y.Warn("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"),null}if(s){var h,c,u=null;o=!1}var d,p=new Array,g=new Array,m=null,y=new Array,b=null;for(a=0;a{"use strict";i.r(t),i.d(t,{VertexData:()=>l});var n=i(2973),r=i(6738),o=i(106),s=i(8362),a=i(3734),l=function(){function e(){}return e.prototype.set=function(e,t){switch(e.length||a.Y.Warn("Setting vertex data kind '"+t+"' with an empty array"),t){case r.o.PositionKind:this.positions=e;break;case r.o.NormalKind:this.normals=e;break;case r.o.TangentKind:this.tangents=e;break;case r.o.UVKind:this.uvs=e;break;case r.o.UV2Kind:this.uvs2=e;break;case r.o.UV3Kind:this.uvs3=e;break;case r.o.UV4Kind:this.uvs4=e;break;case r.o.UV5Kind:this.uvs5=e;break;case r.o.UV6Kind:this.uvs6=e;break;case r.o.ColorKind:this.colors=e;break;case r.o.MatricesIndicesKind:this.matricesIndices=e;break;case r.o.MatricesWeightsKind:this.matricesWeights=e;break;case r.o.MatricesIndicesExtraKind:this.matricesIndicesExtra=e;break;case r.o.MatricesWeightsExtraKind:this.matricesWeightsExtra=e}},e.prototype.applyToMesh=function(e,t){return this._applyTo(e,t),this},e.prototype.applyToGeometry=function(e,t){return this._applyTo(e,t),this},e.prototype.updateMesh=function(e){return this._update(e),this},e.prototype.updateGeometry=function(e){return this._update(e),this},e.prototype._applyTo=function(e,t){return void 0===t&&(t=!1),this.positions&&e.setVerticesData(r.o.PositionKind,this.positions,t),this.normals&&e.setVerticesData(r.o.NormalKind,this.normals,t),this.tangents&&e.setVerticesData(r.o.TangentKind,this.tangents,t),this.uvs&&e.setVerticesData(r.o.UVKind,this.uvs,t),this.uvs2&&e.setVerticesData(r.o.UV2Kind,this.uvs2,t),this.uvs3&&e.setVerticesData(r.o.UV3Kind,this.uvs3,t),this.uvs4&&e.setVerticesData(r.o.UV4Kind,this.uvs4,t),this.uvs5&&e.setVerticesData(r.o.UV5Kind,this.uvs5,t),this.uvs6&&e.setVerticesData(r.o.UV6Kind,this.uvs6,t),this.colors&&e.setVerticesData(r.o.ColorKind,this.colors,t),this.matricesIndices&&e.setVerticesData(r.o.MatricesIndicesKind,this.matricesIndices,t),this.matricesWeights&&e.setVerticesData(r.o.MatricesWeightsKind,this.matricesWeights,t),this.matricesIndicesExtra&&e.setVerticesData(r.o.MatricesIndicesExtraKind,this.matricesIndicesExtra,t),this.matricesWeightsExtra&&e.setVerticesData(r.o.MatricesWeightsExtraKind,this.matricesWeightsExtra,t),this.indices?e.setIndices(this.indices,null,t):e.setIndices([],null),this},e.prototype._update=function(e,t,i){return this.positions&&e.updateVerticesData(r.o.PositionKind,this.positions,t,i),this.normals&&e.updateVerticesData(r.o.NormalKind,this.normals,t,i),this.tangents&&e.updateVerticesData(r.o.TangentKind,this.tangents,t,i),this.uvs&&e.updateVerticesData(r.o.UVKind,this.uvs,t,i),this.uvs2&&e.updateVerticesData(r.o.UV2Kind,this.uvs2,t,i),this.uvs3&&e.updateVerticesData(r.o.UV3Kind,this.uvs3,t,i),this.uvs4&&e.updateVerticesData(r.o.UV4Kind,this.uvs4,t,i),this.uvs5&&e.updateVerticesData(r.o.UV5Kind,this.uvs5,t,i),this.uvs6&&e.updateVerticesData(r.o.UV6Kind,this.uvs6,t,i),this.colors&&e.updateVerticesData(r.o.ColorKind,this.colors,t,i),this.matricesIndices&&e.updateVerticesData(r.o.MatricesIndicesKind,this.matricesIndices,t,i),this.matricesWeights&&e.updateVerticesData(r.o.MatricesWeightsKind,this.matricesWeights,t,i),this.matricesIndicesExtra&&e.updateVerticesData(r.o.MatricesIndicesExtraKind,this.matricesIndicesExtra,t,i),this.matricesWeightsExtra&&e.updateVerticesData(r.o.MatricesWeightsExtraKind,this.matricesWeightsExtra,t,i),this.indices&&e.setIndices(this.indices,null),this},e.prototype.transform=function(e){var t,i=e.determinant()<0,r=n.P.Zero();if(this.positions){var o=n.P.Zero();for(t=0;tr.bbSize.y?r.bbSize.x:r.bbSize.y;$=$>r.bbSize.z?$:r.bbSize.z,L=r.subDiv.X*I/r.bbSize.x,w=r.subDiv.Y*I/r.bbSize.y,N=r.subDiv.Z*I/r.bbSize.z,F=r.subDiv.max*r.subDiv.max,r.facetPartitioning.length=0}for(o=0;o{"use strict";i.d(t,{P:()=>a});var n=i(6738),r=i(746),o=i(2520),s=i(5168),a=function(){function e(e,t,i,n,r,o,s,a,l){void 0===a&&(a=!0),void 0===l&&(l=!0),this.materialIndex=e,this.verticesStart=t,this.verticesCount=i,this.indexStart=n,this.indexCount=r,this._materialDefines=null,this._materialEffect=null,this._effectOverride=null,this._linesIndexCount=0,this._linesIndexBuffer=null,this._lastColliderWorldVertices=null,this._lastColliderTransformMatrix=null,this._renderId=0,this._alphaIndex=0,this._distanceToCamera=0,this._currentMaterial=null,this._mesh=o,this._renderingMesh=s||o,l&&o.subMeshes.push(this),this._trianglePlanes=[],this._id=o.subMeshes.length-1,a&&(this.refreshBoundingInfo(),o.computeWorldMatrix(!0))}return Object.defineProperty(e.prototype,"materialDefines",{get:function(){return this._materialDefines},set:function(e){this._materialDefines=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"effect",{get:function(){var e;return null!==(e=this._effectOverride)&&void 0!==e?e:this._materialEffect},enumerable:!1,configurable:!0}),e.prototype.setEffect=function(e,t){void 0===t&&(t=null),this._materialEffect!==e?(this._materialDefines=t,this._materialEffect=e):e||(this._materialDefines=null)},e.AddToMesh=function(t,i,n,r,o,s,a,l){return void 0===l&&(l=!0),new e(t,i,n,r,o,s,a,l)},Object.defineProperty(e.prototype,"IsGlobal",{get:function(){return 0===this.verticesStart&&this.verticesCount===this._mesh.getTotalVertices()},enumerable:!1,configurable:!0}),e.prototype.getBoundingInfo=function(){return this.IsGlobal?this._mesh.getBoundingInfo():this._boundingInfo},e.prototype.setBoundingInfo=function(e){return this._boundingInfo=e,this},e.prototype.getMesh=function(){return this._mesh},e.prototype.getRenderingMesh=function(){return this._renderingMesh},e.prototype.getReplacementMesh=function(){return this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null},e.prototype.getEffectiveMesh=function(){var e=this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null;return e||this._renderingMesh},e.prototype.getMaterial=function(){var e=this._renderingMesh.material;if(null==e)return this._mesh.getScene().defaultMaterial;if(this._IsMultiMaterial(e)){var t=e.getSubMaterial(this.materialIndex);return this._currentMaterial!==t&&(this._currentMaterial=t,this._materialDefines=null),t}return e},e.prototype._IsMultiMaterial=function(e){return void 0!==e.getSubMaterial},e.prototype.refreshBoundingInfo=function(e){if(void 0===e&&(e=null),this._lastColliderWorldVertices=null,this.IsGlobal||!this._renderingMesh||!this._renderingMesh.geometry)return this;if(e||(e=this._renderingMesh.getVerticesData(n.o.PositionKind)),!e)return this._boundingInfo=this._mesh.getBoundingInfo(),this;var t,i=this._renderingMesh.getIndices();if(0===this.indexStart&&this.indexCount===i.length){var r=this._renderingMesh.getBoundingInfo();t={minimum:r.minimum.clone(),maximum:r.maximum.clone()}}else t=(0,s.y)(e,i,this.indexStart,this.indexCount,this._renderingMesh.geometry.boundingBias);return this._boundingInfo?this._boundingInfo.reConstruct(t.minimum,t.maximum):this._boundingInfo=new o.j(t.minimum,t.maximum),this},e.prototype._checkCollision=function(e){return this.getBoundingInfo()._checkCollision(e)},e.prototype.updateBoundingInfo=function(e){var t=this.getBoundingInfo();return t||(this.refreshBoundingInfo(),t=this.getBoundingInfo()),t&&t.update(e),this},e.prototype.isInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isInFrustum(e,this._mesh.cullingStrategy)},e.prototype.isCompletelyInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isCompletelyInFrustum(e)},e.prototype.render=function(e){return this._renderingMesh.render(this,e,this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:void 0),this},e.prototype._getLinesIndexBuffer=function(e,t){if(!this._linesIndexBuffer){for(var i=[],n=this.indexStart;na&&(a=c)}return new e(t,s,a-s+1,i,n,r,o)},e}()},3934:(e,t,i)=>{"use strict";i.r(t);var n=i(6212),r=i(6738),o=i(2973);n.Mesh.prototype.thinInstanceAdd=function(e,t){void 0===t&&(t=!0),this._thinInstanceUpdateBufferSize("matrix",Array.isArray(e)?e.length:1);var i=this._thinInstanceDataStorage.instancesCount;if(Array.isArray(e))for(var n=0;n=this._thinInstanceDataStorage.instancesCount)return!1;var n=this._thinInstanceDataStorage.matrixData;return t.copyToArray(n,16*e),this._thinInstanceDataStorage.worldMatrices&&(this._thinInstanceDataStorage.worldMatrices[e]=t),i&&(this.thinInstanceBufferUpdated("matrix"),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)),!0},n.Mesh.prototype.thinInstanceSetAttributeAt=function(e,t,i,n){return void 0===n&&(n=!0),!(!this._userThinInstanceBuffersStorage||!this._userThinInstanceBuffersStorage.data[e]||t>=this._thinInstanceDataStorage.instancesCount)&&(this._thinInstanceUpdateBufferSize(e,0),this._userThinInstanceBuffersStorage.data[e].set(i,t*this._userThinInstanceBuffersStorage.strides[e]),n&&this.thinInstanceBufferUpdated(e),!0)},Object.defineProperty(n.Mesh.prototype,"thinInstanceCount",{get:function(){return this._thinInstanceDataStorage.instancesCount},set:function(e){var t,i;e<=(null!==(i=null===(t=this._thinInstanceDataStorage.matrixData)||void 0===t?void 0:t.length)&&void 0!==i?i:0)/16&&(this._thinInstanceDataStorage.instancesCount=e)},enumerable:!0,configurable:!0}),n.Mesh.prototype.thinInstanceSetBuffer=function(e,t,i,n){var o,s;if(void 0===i&&(i=0),void 0===n&&(n=!1),i=i||16,"matrix"===e)if(null===(o=this._thinInstanceDataStorage.matrixBuffer)||void 0===o||o.dispose(),this._thinInstanceDataStorage.matrixBuffer=null,this._thinInstanceDataStorage.matrixBufferSize=t?t.length:32*i,this._thinInstanceDataStorage.matrixData=t,this._thinInstanceDataStorage.worldMatrices=null,null!==t){this._thinInstanceDataStorage.instancesCount=t.length/i;var a=new r.l(this.getEngine(),t,!n,i,!1,!0);this._thinInstanceDataStorage.matrixBuffer=a,this.setVerticesBuffer(a.createVertexBuffer("world0",0,4)),this.setVerticesBuffer(a.createVertexBuffer("world1",4,4)),this.setVerticesBuffer(a.createVertexBuffer("world2",8,4)),this.setVerticesBuffer(a.createVertexBuffer("world3",12,4)),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)}else this._thinInstanceDataStorage.instancesCount=0,this.doNotSyncBoundingInfo||this.refreshBoundingInfo(!0);else null===t?(null===(s=this._userThinInstanceBuffersStorage)||void 0===s?void 0:s.data[e])&&(this.removeVerticesData(e),delete this._userThinInstanceBuffersStorage.data[e],delete this._userThinInstanceBuffersStorage.strides[e],delete this._userThinInstanceBuffersStorage.sizes[e],delete this._userThinInstanceBuffersStorage.vertexBuffers[e]):(this._thinInstanceInitializeUserStorage(),this._userThinInstanceBuffersStorage.data[e]=t,this._userThinInstanceBuffersStorage.strides[e]=i,this._userThinInstanceBuffersStorage.sizes[e]=t.length,this._userThinInstanceBuffersStorage.vertexBuffers[e]=new r.o(this.getEngine(),t,e,!n,!1,i,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[e]))},n.Mesh.prototype.thinInstanceBufferUpdated=function(e){var t;"matrix"===e?this._thinInstanceDataStorage.matrixBuffer&&this._thinInstanceDataStorage.matrixBuffer.updateDirectly(this._thinInstanceDataStorage.matrixData,0,this._thinInstanceDataStorage.instancesCount):(null===(t=this._userThinInstanceBuffersStorage)||void 0===t?void 0:t.vertexBuffers[e])&&this._userThinInstanceBuffersStorage.vertexBuffers[e].updateDirectly(this._userThinInstanceBuffersStorage.data[e],0)},n.Mesh.prototype.thinInstancePartialBufferUpdate=function(e,t,i){var n;"matrix"===e?this._thinInstanceDataStorage.matrixBuffer&&this._thinInstanceDataStorage.matrixBuffer.updateDirectly(t,i):(null===(n=this._userThinInstanceBuffersStorage)||void 0===n?void 0:n.vertexBuffers[e])&&this._userThinInstanceBuffersStorage.vertexBuffers[e].updateDirectly(t,i)},n.Mesh.prototype.thinInstanceGetWorldMatrices=function(){if(!this._thinInstanceDataStorage.matrixData||!this._thinInstanceDataStorage.matrixBuffer)return[];var e=this._thinInstanceDataStorage.matrixData;if(!this._thinInstanceDataStorage.worldMatrices){this._thinInstanceDataStorage.worldMatrices=new Array;for(var t=0;t{"use strict";i.r(t),i.d(t,{TransformNode:()=>h});var n=i(655),r=i(9023),o=i(475),s=i(2973),a=i(2686),l=i(9068),h=function(e){function t(i,n,r){void 0===n&&(n=null),void 0===r&&(r=!0);var a=e.call(this,i,n)||this;return a._forward=new s.P(0,0,1),a._forwardInverted=new s.P(0,0,-1),a._up=new s.P(0,1,0),a._right=new s.P(1,0,0),a._rightInverted=new s.P(-1,0,0),a._position=s.P.Zero(),a._rotation=s.P.Zero(),a._rotationQuaternion=null,a._scaling=s.P.One(),a._isDirty=!1,a._transformToBoneReferal=null,a._isAbsoluteSynced=!1,a._billboardMode=t.BILLBOARDMODE_NONE,a._preserveParentRotationForBillboard=!1,a.scalingDeterminant=1,a._infiniteDistance=!1,a.ignoreNonUniformScaling=!1,a.reIntegrateRotationIntoRotationQuaternion=!1,a._poseMatrix=null,a._localMatrix=s.y3.Zero(),a._usePivotMatrix=!1,a._absolutePosition=s.P.Zero(),a._absoluteScaling=s.P.Zero(),a._absoluteRotationQuaternion=s._f.Identity(),a._pivotMatrix=s.y3.Identity(),a._postMultiplyPivotMatrix=!1,a._isWorldMatrixFrozen=!1,a._indexInSceneTransformNodesArray=-1,a.onAfterWorldMatrixUpdateObservable=new o.y$,a._nonUniformScaling=!1,r&&a.getScene().addTransformNode(a),a}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"billboardMode",{get:function(){return this._billboardMode},set:function(e){this._billboardMode!==e&&(this._billboardMode=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"preserveParentRotationForBillboard",{get:function(){return this._preserveParentRotationForBillboard},set:function(e){e!==this._preserveParentRotationForBillboard&&(this._preserveParentRotationForBillboard=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"infiniteDistance",{get:function(){return this._infiniteDistance},set:function(e){this._infiniteDistance!==e&&(this._infiniteDistance=e)},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"TransformNode"},Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._rotationQuaternion=null,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this._scaling},set:function(e){this._scaling=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotationQuaternion",{get:function(){return this._rotationQuaternion},set:function(e){this._rotationQuaternion=e,e&&this._rotation.setAll(0),this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"forward",{get:function(){return s.P.Normalize(s.P.TransformNormal(this.getScene().useRightHandedSystem?this._forwardInverted:this._forward,this.getWorldMatrix()))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"up",{get:function(){return s.P.Normalize(s.P.TransformNormal(this._up,this.getWorldMatrix()))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return s.P.Normalize(s.P.TransformNormal(this.getScene().useRightHandedSystem?this._rightInverted:this._right,this.getWorldMatrix()))},enumerable:!1,configurable:!0}),t.prototype.updatePoseMatrix=function(e){return this._poseMatrix?(this._poseMatrix.copyFrom(e),this):(this._poseMatrix=e.clone(),this)},t.prototype.getPoseMatrix=function(){return this._poseMatrix||(this._poseMatrix=s.y3.Identity()),this._poseMatrix},t.prototype._isSynchronized=function(){var e=this._cache;return this.billboardMode===e.billboardMode&&this.billboardMode===t.BILLBOARDMODE_NONE&&(!e.pivotMatrixUpdated&&(!this.infiniteDistance&&(!this.position._isDirty&&(!this.scaling._isDirty&&!(this._rotationQuaternion&&this._rotationQuaternion._isDirty||this.rotation._isDirty)))))},t.prototype._initCache=function(){e.prototype._initCache.call(this);var t=this._cache;t.localMatrixUpdated=!1,t.billboardMode=-1,t.infiniteDistance=!1},t.prototype.markAsDirty=function(e){return this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this},Object.defineProperty(t.prototype,"absolutePosition",{get:function(){return this._absolutePosition},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"absoluteScaling",{get:function(){return this._syncAbsoluteScalingAndRotation(),this._absoluteScaling},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"absoluteRotationQuaternion",{get:function(){return this._syncAbsoluteScalingAndRotation(),this._absoluteRotationQuaternion},enumerable:!1,configurable:!0}),t.prototype.setPreTransformMatrix=function(e){return this.setPivotMatrix(e,!1)},t.prototype.setPivotMatrix=function(e,t){return void 0===t&&(t=!0),this._pivotMatrix.copyFrom(e),this._usePivotMatrix=!this._pivotMatrix.isIdentity(),this._cache.pivotMatrixUpdated=!0,this._postMultiplyPivotMatrix=t,this._postMultiplyPivotMatrix&&(this._pivotMatrixInverse?this._pivotMatrix.invertToRef(this._pivotMatrixInverse):this._pivotMatrixInverse=s.y3.Invert(this._pivotMatrix)),this},t.prototype.getPivotMatrix=function(){return this._pivotMatrix},t.prototype.instantiateHierarchy=function(e,t,i){void 0===e&&(e=null);var n=this.clone("Clone of "+(this.name||this.id),e||this.parent,!0);n&&i&&i(this,n);for(var r=0,o=this.getChildTransformNodes(!0);r{"use strict";i.d(t,{B:()=>n});var n=function(){function e(){}return e.BuildArray=function(e,t){for(var i=[],n=0;n{"use strict";i.d(t,{x:()=>n});var n=function(){function e(){}return e.CreateCanvas=function(e,t){if("undefined"==typeof document)return new OffscreenCanvas(e,t);var i=document.createElement("canvas");return i.width=e,i.height=t,i},e}()},9023:(e,t,i)=>{"use strict";i.d(t,{wz:()=>f,qC:()=>d,oU:()=>p,n9:()=>_,qQ:()=>g,QC:()=>m,hd:()=>v,RR:()=>y,N$:()=>b,XX:()=>T,rX:()=>A,mv:()=>E,oQ:()=>C,p4:()=>x});var n=i(4115),r=i(2973),o=i(106),s=i(8362),a={},l={},h=function(e,t,i){var r=e();n.$&&n.$.AddTagsTo(r,t.tags);var o=c(r);for(var s in o){var a=o[s],l=t[s],h=a.type;if(null!=l&&"uniqueId"!==s)switch(h){case 0:case 6:case 11:r[s]=l;break;case 1:r[s]=i||l.isRenderTarget?l:l.clone();break;case 2:case 3:case 4:case 5:case 7:case 10:case 12:r[s]=i?l:l.clone()}}return r};function c(e){var t=e.getClassName();if(l[t])return l[t];l[t]={};for(var i=l[t],n=e,r=t;r;){var o=a[r];for(var s in o)i[s]=o[s];var h=void 0,c=!1;do{if(!(h=Object.getPrototypeOf(n)).getClassName){c=!0;break}if(h.getClassName()!==r)break;n=h}while(h);if(c)break;r=h.getClassName(),n=h}return i}function u(e,t){return function(i,n){var r=function(e){var t=e.getClassName();return a[t]||(a[t]={}),a[t]}(i);r[n]||(r[n]={type:e,sourceName:t})}}function f(e,t){return void 0===t&&(t=null),function(e,t){return void 0===t&&(t=null),function(i,n){var r=t||"_"+n;Object.defineProperty(i,n,{get:function(){return this[r]},set:function(t){this[r]!==t&&(this[r]=t,i[e].apply(this))},enumerable:!0,configurable:!0})}}(e,t)}function d(e){return u(0,e)}function p(e){return u(1,e)}function _(e){return u(2,e)}function g(e){return u(3,e)}function m(e){return u(4,e)}function v(e){return u(5,e)}function y(e){return u(6,e)}function b(e){return u(7,e)}function T(e){return u(8,e)}function A(e){return u(9,e)}function E(e){return u(10,e)}function C(e){return u(12,e)}var x=function(){function e(){}return e.AppendSerializedAnimations=function(e,t){if(e.animations){t.animations=[];for(var i=0;i{"use strict";i.d(t,{j:()=>s});var n=i(1373),r=i(3734),o=function(e,t){return e?e.getClassName&&"Mesh"===e.getClassName()?null:e.getClassName&&"SubMesh"===e.getClassName()?e.clone(t):e.clone?e.clone():null:null};var s=function(){function e(){}return e.DeepCopy=function(e,t,i,s){for(var a=0,l=function(e){var t=[];do{Object.getOwnPropertyNames(e).forEach((function(e){-1===t.indexOf(e)&&t.push(e)}))}while(e=Object.getPrototypeOf(e));return t}(e);a0)if("object"==typeof c[0])for(var f=0;f{"use strict";i.d(t,{f:()=>n});var n=function(){function e(){}return e.WarnImport=function(e){return e+" needs to be imported before as it contains a side-effect required by your code."},e}()},6327:(e,t,i)=>{"use strict";i.d(t,{M:()=>n});var n=function(){function e(){}return e.IsWindowObjectExist=function(){return"undefined"!=typeof window},e.IsNavigatorAvailable=function(){return"undefined"!=typeof navigator},e.IsDocumentAvailable=function(){return"undefined"!=typeof document},e.GetDOMTextContent=function(e){for(var t="",i=e.firstChild;i;)3===i.nodeType&&(t+=i.textContent),i=i.nextSibling;return t},e}()},5684:(e,t,i)=>{"use strict";i.d(t,{e0:()=>g,eh:()=>d});var n=i(655),r=i(2840),o=i(6327),s=i(475),a=i(3483),l=function(){function e(){}return e.ExponentialBackoff=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=500),function(i,n,r){return 0!==n.status||r>=e||-1!==i.indexOf("file:")?-1:Math.pow(2,r)*t}},e}(),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,n.ZT)(t,e),t._setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t}(Error),c=i(1373),u=i(2131),f=i(3857),d=function(e){function t(i,n){var o=e.call(this,i)||this;return o.name="LoadFileError",h._setPrototypeOf(o,t.prototype),n instanceof r.g?o.request=n:o.file=n,o}return(0,n.ZT)(t,e),t}(h),p=function(e){function t(i,n){var r=e.call(this,i)||this;return r.request=n,r.name="RequestFileError",h._setPrototypeOf(r,t.prototype),r}return(0,n.ZT)(t,e),t}(h),_=function(e){function t(i,n){var r=e.call(this,i)||this;return r.file=n,r.name="ReadFileError",h._setPrototypeOf(r,t.prototype),r}return(0,n.ZT)(t,e),t}(h),g=function(){function e(){}return e._CleanUrl=function(e){return e=e.replace(/#/gm,"%23")},e.SetCorsBehavior=function(t,i){if((!t||0!==t.indexOf("data:"))&&e.CorsBehavior)if("string"==typeof e.CorsBehavior||this.CorsBehavior instanceof String)i.crossOrigin=e.CorsBehavior;else{var n=e.CorsBehavior(t);n&&(i.crossOrigin=n)}},e.LoadImage=function(t,i,n,r,o){var s;void 0===o&&(o="");var l=!1;if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)?"undefined"!=typeof Blob?(s=URL.createObjectURL(new Blob([t],{type:o})),l=!0):s="data:"+o+";base64,"+c.M.EncodeArrayBufferToBase64(t):t instanceof Blob?(s=URL.createObjectURL(t),l=!0):(s=e._CleanUrl(t),s=e.PreprocessUrl(t)),"undefined"==typeof Image)return e.LoadFile(s,(function(e){createImageBitmap(new Blob([e],{type:o})).then((function(e){i(e),l&&URL.revokeObjectURL(s)})).catch((function(e){n&&n("Error while trying to load image: "+t,e)}))}),void 0,r||void 0,!0,(function(e,i){n&&n("Error while trying to load image: "+t,i)})),null;var h=new Image;e.SetCorsBehavior(s,h);var u=function(){h.removeEventListener("load",u),h.removeEventListener("error",f),i(h),l&&h.src&&URL.revokeObjectURL(h.src)},f=function(e){if(h.removeEventListener("load",u),h.removeEventListener("error",f),n){var i=t.toString();n("Error while trying to load image: "+(i.length<32?i:i.slice(0,32)+"..."),e)}l&&h.src&&URL.revokeObjectURL(h.src)};h.addEventListener("load",u),h.addEventListener("error",f);var d=function(){h.src=s};if("data:"!==s.substr(0,5)&&r&&r.enableTexturesOffline)r.open((function(){r&&r.loadImage(s,h)}),d);else{if(-1!==s.indexOf("file:")){var p=decodeURIComponent(s.substring(5).toLowerCase());if(a.X.FilesToLoad[p]){try{var _;try{_=URL.createObjectURL(a.X.FilesToLoad[p])}catch(e){_=URL.createObjectURL(a.X.FilesToLoad[p])}h.src=_,l=!0}catch(e){h.src=""}return h}}d()}return h},e.ReadFile=function(e,t,i,n,r){var o=new FileReader,a={onCompleteObservable:new s.y$,abort:function(){return o.abort()}};return o.onloadend=function(e){return a.onCompleteObservable.notifyObservers(a)},r&&(o.onerror=function(t){r(new _("Unable to read "+e.name,e))}),o.onload=function(e){t(e.target.result)},i&&(o.onprogress=i),n?o.readAsArrayBuffer(e):o.readAsText(e),a},e.LoadFile=function(t,i,n,r,o,s){if(-1!==t.indexOf("file:")){var l=decodeURIComponent(t.substring(5).toLowerCase());0===l.indexOf("./")&&(l=l.substring(2));var h=a.X.FilesToLoad[l];if(h)return e.ReadFile(h,i,n,o,s?function(e){return s(void 0,new d(e.message,e.file))}:void 0)}return e.RequestFile(t,(function(e,t){i(e,t?t.responseURL:void 0)}),n,r,o,s?function(e){s(e.request,new d(e.message,e.request))}:void 0)},e.RequestFile=function(t,i,n,a,l,h,c){t=e._CleanUrl(t),t=e.PreprocessUrl(t);var u=e.BaseUrl+t,f=!1,d={onCompleteObservable:new s.y$,abort:function(){return f=!0}},_=function(){var t=new r.g,s=null;d.abort=function(){f=!0,t.readyState!==(XMLHttpRequest.DONE||4)&&t.abort(),null!==s&&(clearTimeout(s),s=null)};var a=function(_){t.open("GET",u),c&&c(t),l&&(t.responseType="arraybuffer"),n&&t.addEventListener("progress",n);var g=function(){t.removeEventListener("loadend",g),d.onCompleteObservable.notifyObservers(d),d.onCompleteObservable.clear()};t.addEventListener("loadend",g);var m=function(){if(!f&&t.readyState===(XMLHttpRequest.DONE||4)){if(t.removeEventListener("readystatechange",m),t.status>=200&&t.status<300||0===t.status&&(!o.M.IsWindowObjectExist()||e.IsFileURL()))return void i(l?t.response:t.responseText,t);var n=e.DefaultRetryStrategy;if(n){var c=n(u,t,_);if(-1!==c)return t.removeEventListener("loadend",g),t=new r.g,void(s=setTimeout((function(){return a(_+1)}),c))}var d=new p("Error status: "+t.status+" "+t.statusText+" - Unable to load "+u,t);h&&h(d)}};t.addEventListener("readystatechange",m),t.send()};a(0)};if(a&&a.enableSceneOffline){var g=function(e){e&&e.status>400?h&&h(e):_()};a.open((function(){a&&a.loadFile(e.BaseUrl+t,(function(e){f||i(e),d.onCompleteObservable.notifyObservers(d)}),n?function(e){f||n(e)}:void 0,g,l)}),g)}else _();return d},e.IsFileURL=function(){return"undefined"!=typeof location&&"file:"===location.protocol},e.DefaultRetryStrategy=l.ExponentialBackoff(),e.BaseUrl="",e.CorsBehavior="anonymous",e.PreprocessUrl=function(e){return e},e}();u.B._FileToolsLoadImage=g.LoadImage.bind(g),u.B._FileToolsLoadFile=g.LoadFile.bind(g),f.L._FileToolsLoadFile=g.LoadFile.bind(g)},3483:(e,t,i)=>{"use strict";i.d(t,{X:()=>n});var n=function(){function e(){}return e.FilesToLoad={},e}()},8927:(e,t,i)=>{"use strict";i.d(t,{x:()=>n});var n=function(){function e(){}return e.RandomId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e}()},6761:(e,t,i)=>{"use strict";i.d(t,{K:()=>o});var n=i(3734),r=i(6132),o=function(){function e(){}return e.Instantiate=function(e){if(this.RegisteredExternalClasses&&this.RegisteredExternalClasses[e])return this.RegisteredExternalClasses[e];var t=r.Q.GetClass(e);if(t)return t;n.Y.Warn(e+" not found, you may have missed an import.");for(var i=e.split("."),o=window||this,s=0,a=i.length;s{"use strict";i.d(t,{Y:()=>n});var n=function(){function e(){}return e._AddLogEntry=function(t){e._LogCache=t+e._LogCache,e.OnNewCacheEntry&&e.OnNewCacheEntry(t)},e._FormatMessage=function(e){var t=function(e){return e<10?"0"+e:""+e},i=new Date;return"["+t(i.getHours())+":"+t(i.getMinutes())+":"+t(i.getSeconds())+"]: "+e},e._LogDisabled=function(e){},e._LogEnabled=function(t){var i=e._FormatMessage(t);console.log("BJS - "+i);var n="
"+i+"

";e._AddLogEntry(n)},e._WarnDisabled=function(e){},e._WarnEnabled=function(t){var i=e._FormatMessage(t);console.warn("BJS - "+i);var n="
"+i+"

";e._AddLogEntry(n)},e._ErrorDisabled=function(e){},e._ErrorEnabled=function(t){e.errorsCount++;var i=e._FormatMessage(t);console.error("BJS - "+i);var n="
"+i+"

";e._AddLogEntry(n)},Object.defineProperty(e,"LogCache",{get:function(){return e._LogCache},enumerable:!1,configurable:!0}),e.ClearLogCache=function(){e._LogCache="",e.errorsCount=0},Object.defineProperty(e,"LogLevels",{set:function(t){(t&e.MessageLogLevel)===e.MessageLogLevel?e.Log=e._LogEnabled:e.Log=e._LogDisabled,(t&e.WarningLogLevel)===e.WarningLogLevel?e.Warn=e._WarnEnabled:e.Warn=e._WarnDisabled,(t&e.ErrorLogLevel)===e.ErrorLogLevel?e.Error=e._ErrorEnabled:e.Error=e._ErrorDisabled},enumerable:!1,configurable:!0}),e.NoneLogLevel=0,e.MessageLogLevel=1,e.WarningLogLevel=2,e.ErrorLogLevel=4,e.AllLogLevel=7,e._LogCache="",e.errorsCount=0,e.Log=e._LogEnabled,e.Warn=e._WarnEnabled,e.Error=e._ErrorEnabled,e}()},475:(e,t,i)=>{"use strict";i.d(t,{y$:()=>o});var n=function(){function e(e,t,i,n){void 0===t&&(t=!1),this.initalize(e,t,i,n)}return e.prototype.initalize=function(e,t,i,n){return void 0===t&&(t=!1),this.mask=e,this.skipNextObservers=t,this.target=i,this.currentTarget=n,this},e}(),r=function(e,t,i){void 0===i&&(i=null),this.callback=e,this.mask=t,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1},o=(function(){function e(){}e.prototype.dispose=function(){if(this._observers&&this._observables)for(var e=0;e0},e.prototype.clear=function(){this._observers=new Array,this._onObserverAdded=null},e.prototype.clone=function(){var t=new e;return t._observers=this._observers.slice(0),t},e.prototype.hasSpecificMask=function(e){void 0===e&&(e=-1);for(var t=0,i=this._observers;t{"use strict";i.d(t,{z:()=>r});var n=i(5273),r=function(){function e(){this._startMonitoringTime=0,this._min=0,this._max=0,this._average=0,this._lastSecAverage=0,this._current=0,this._totalValueCount=0,this._totalAccumulated=0,this._lastSecAccumulated=0,this._lastSecTime=0,this._lastSecValueCount=0}return Object.defineProperty(e.prototype,"min",{get:function(){return this._min},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this._max},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"average",{get:function(){return this._average},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastSecAverage",{get:function(){return this._lastSecAverage},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"current",{get:function(){return this._current},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"total",{get:function(){return this._totalAccumulated},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"count",{get:function(){return this._totalValueCount},enumerable:!1,configurable:!0}),e.prototype.fetchNewFrame=function(){this._totalValueCount++,this._current=0,this._lastSecValueCount++},e.prototype.addCount=function(t,i){e.Enabled&&(this._current+=t,i&&this._fetchResult())},e.prototype.beginMonitoring=function(){e.Enabled&&(this._startMonitoringTime=n.F.Now)},e.prototype.endMonitoring=function(t){if(void 0===t&&(t=!0),e.Enabled){t&&this.fetchNewFrame();var i=n.F.Now;this._current=i-this._startMonitoringTime,t&&this._fetchResult()}},e.prototype._fetchResult=function(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;var e=n.F.Now;e-this._lastSecTime>1e3&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=e,this._lastSecAccumulated=0,this._lastSecValueCount=0)},e.Enabled=!0,e}()},5273:(e,t,i)=>{"use strict";i.d(t,{F:()=>r});var n=i(6327),r=function(){function e(){}return Object.defineProperty(e,"Now",{get:function(){return n.M.IsWindowObjectExist()&&window.performance&&window.performance.now?window.performance.now():Date.now()},enumerable:!1,configurable:!0}),e}()},9073:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ScreenshotTools:()=>_});var n=i(4283),r=i(5082),o=i(655),s=i(4277),a=i(7947),l="uniform sampler2D textureSampler;\nuniform vec2 texelSize;\nvarying vec2 vUV;\nvarying vec2 sampleCoordS;\nvarying vec2 sampleCoordE;\nvarying vec2 sampleCoordN;\nvarying vec2 sampleCoordW;\nvarying vec2 sampleCoordNW;\nvarying vec2 sampleCoordSE;\nvarying vec2 sampleCoordNE;\nvarying vec2 sampleCoordSW;\nconst float fxaaQualitySubpix=1.0;\nconst float fxaaQualityEdgeThreshold=0.166;\nconst float fxaaQualityEdgeThresholdMin=0.0833;\nconst vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);\n#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)\nvoid main(){\nvec2 posM;\nposM.x=vUV.x;\nposM.y=vUV.y;\nvec4 rgbyM=texture2D(textureSampler,vUV,0.0);\nfloat lumaM=FxaaLuma(rgbyM);\nfloat lumaS=FxaaLuma(texture2D(textureSampler,sampleCoordS,0.0));\nfloat lumaE=FxaaLuma(texture2D(textureSampler,sampleCoordE,0.0));\nfloat lumaN=FxaaLuma(texture2D(textureSampler,sampleCoordN,0.0));\nfloat lumaW=FxaaLuma(texture2D(textureSampler,sampleCoordW,0.0));\nfloat maxSM=max(lumaS,lumaM);\nfloat minSM=min(lumaS,lumaM);\nfloat maxESM=max(lumaE,maxSM);\nfloat minESM=min(lumaE,minSM);\nfloat maxWN=max(lumaN,lumaW);\nfloat minWN=min(lumaN,lumaW);\nfloat rangeMax=max(maxWN,maxESM);\nfloat rangeMin=min(minWN,minESM);\nfloat rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;\nfloat range=rangeMax-rangeMin;\nfloat rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\n#ifndef MALI\nif(range=edgeVert;\nfloat subpixA=subpixNSWE*2.0+subpixNWSWNESE;\nif (!horzSpan)\n{\nlumaN=lumaW;\n}\nif (!horzSpan)\n{\nlumaS=lumaE;\n}\nif (horzSpan)\n{\nlengthSign=texelSize.y;\n}\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;\nfloat gradientN=lumaN-lumaM;\nfloat gradientS=lumaS-lumaM;\nfloat lumaNN=lumaN+lumaM;\nfloat lumaSS=lumaS+lumaM;\nbool pairN=abs(gradientN)>=abs(gradientS);\nfloat gradient=max(abs(gradientN),abs(gradientS));\nif (pairN)\n{\nlengthSign=-lengthSign;\n}\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);\nvec2 posB;\nposB.x=posM.x;\nposB.y=posM.y;\nvec2 offNP;\noffNP.x=(!horzSpan) ? 0.0 : texelSize.x;\noffNP.y=(horzSpan) ? 0.0 : texelSize.y;\nif (!horzSpan)\n{\nposB.x+=lengthSign*0.5;\n}\nif (horzSpan)\n{\nposB.y+=lengthSign*0.5;\n}\nvec2 posN;\nposN.x=posB.x-offNP.x*1.5;\nposN.y=posB.y-offNP.y*1.5;\nvec2 posP;\nposP.x=posB.x+offNP.x*1.5;\nposP.y=posB.y+offNP.y*1.5;\nfloat subpixD=((-2.0)*subpixC)+3.0;\nfloat lumaEndN=FxaaLuma(texture2D(textureSampler,posN,0.0));\nfloat subpixE=subpixC*subpixC;\nfloat lumaEndP=FxaaLuma(texture2D(textureSampler,posP,0.0));\nif (!pairN)\n{\nlumaNN=lumaSS;\n}\nfloat gradientScaled=gradient*1.0/4.0;\nfloat lumaMM=lumaM-lumaNN*0.5;\nfloat subpixF=subpixD*subpixE;\nbool lumaMLTZero=lumaMM<0.0;\nlumaEndN-=lumaNN*0.5;\nlumaEndP-=lumaNN*0.5;\nbool doneN=abs(lumaEndN)>=gradientScaled;\nbool doneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN)\n{\nposN.x-=offNP.x*3.0;\n}\nif (!doneN)\n{\nposN.y-=offNP.y*3.0;\n}\nbool doneNP=(!doneN) || (!doneP);\nif (!doneP)\n{\nposP.x+=offNP.x*3.0;\n}\nif (!doneP)\n{\nposP.y+=offNP.y*3.0;\n}\nif (doneNP)\n{\nif (!doneN) lumaEndN=FxaaLuma(texture2D(textureSampler,posN.xy,0.0));\nif (!doneP) lumaEndP=FxaaLuma(texture2D(textureSampler,posP.xy,0.0));\nif (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;\nif (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;\ndoneN=abs(lumaEndN)>=gradientScaled;\ndoneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN) posN.x-=offNP.x*12.0;\nif (!doneN) posN.y-=offNP.y*12.0;\ndoneNP=(!doneN) || (!doneP);\nif (!doneP) posP.x+=offNP.x*12.0;\nif (!doneP) posP.y+=offNP.y*12.0;\n}\nfloat dstN=posM.x-posN.x;\nfloat dstP=posP.x-posM.x;\nif (!horzSpan)\n{\ndstN=posM.y-posN.y;\n}\nif (!horzSpan)\n{\ndstP=posP.y-posM.y;\n}\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;\nfloat spanLength=(dstP+dstN);\nbool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;\nfloat spanLengthRcp=1.0/spanLength;\nbool directionN=dstN-1?"#define MALI 1\n":null},t._Parse=function(e,i,n,r){return u.p4.Parse((function(){return new t(e.name,e.options,i,e.renderTargetSamplingMode,n.getEngine(),e.reusable)}),e,n,r)},t}(s.D);c.Q.RegisteredTypes["BABYLON.FxaaPostProcess"]=f;var d=i(3734),p=i(5540),_=function(){function e(){}return e.CreateScreenshot=function(t,i,n,r,o){void 0===o&&(o="image/png");var s=e._getScreenshotSize(t,i,n),a=s.height,l=s.width;if(a&&l){p.w1._ScreenshotCanvas||(p.w1._ScreenshotCanvas=document.createElement("canvas")),p.w1._ScreenshotCanvas.width=l,p.w1._ScreenshotCanvas.height=a;var h=p.w1._ScreenshotCanvas.getContext("2d"),c=t.getRenderWidth()/t.getRenderHeight(),u=l,f=u/c;f>a&&(u=(f=a)*c);var _=Math.max(0,l-u)/2,g=Math.max(0,a-f)/2,m=t.getRenderingCanvas();h&&m&&h.drawImage(m,_,g,u,f),p.w1.EncodeScreenshotCanvasData(r,o)}else d.Y.Error("Invalid 'size' parameter !")},e.CreateScreenshotAsync=function(t,i,n,r){return void 0===r&&(r="image/png"),new Promise((function(o,s){e.CreateScreenshot(t,i,n,(function(e){void 0!==e?o(e):s(new Error("Data is undefined"))}),r)}))},e.CreateScreenshotUsingRenderTarget=function(t,i,o,s,a,l,h,c,u,_){void 0===a&&(a="image/png"),void 0===l&&(l=1),void 0===h&&(h=!1),void 0===u&&(u=!1),void 0===_&&(_=!1);var g=e._getScreenshotSize(t,i,o),m=g.height,v=g.width,y={width:v,height:m};if(m&&v){var b=t.getRenderingCanvas();if(b){var T={width:b.width,height:b.height};t.setSize(v,m);var A=i.getScene(),E=null,C=A.activeCameras;(A.activeCamera!==i||A.activeCameras&&A.activeCameras.length)&&(E=A.activeCamera,A.activeCamera=i),A.render();var x=new r._("screenShot",y,A,!1,!1,0,!1,n.x.NEAREST_SAMPLINGMODE,void 0,_);x.renderList=null,x.samples=l,x.renderSprites=u,x.onAfterRenderObservable.add((function(){p.w1.DumpFramebuffer(v,m,t,s,a,c)}));var S=function(){A.incrementRenderId(),A.resetCachedMaterial(),x.render(!0),x.dispose(),E&&(A.activeCamera=E),A.activeCameras=C,t.setSize(T.width,T.height),i.getProjectionMatrix(!0)};if(h){var R=new f("antialiasing",1,A.activeCamera);x.addPostProcess(R),R.getEffect().isReady()?S():R.getEffect().onCompiled=function(){S()}}else S()}else d.Y.Error("No rendering canvas found !")}else d.Y.Error("Invalid 'size' parameter !")},e.CreateScreenshotUsingRenderTargetAsync=function(t,i,n,r,o,s,a,l){return void 0===r&&(r="image/png"),void 0===o&&(o=1),void 0===s&&(s=!1),void 0===l&&(l=!1),new Promise((function(h,c){e.CreateScreenshotUsingRenderTarget(t,i,n,(function(e){void 0!==e?h(e):c(new Error("Data is undefined"))}),r,o,s,a,l)}))},e._getScreenshotSize=function(e,t,i){var n=0,r=0;if("object"==typeof i){var o=i.precision?Math.abs(i.precision):1;i.width&&i.height?(n=i.height*o,r=i.width*o):i.width&&!i.height?(r=i.width*o,n=Math.round(r/e.getAspectRatio(t))):i.height&&!i.width?(n=i.height*o,r=Math.round(n*e.getAspectRatio(t))):(r=Math.round(e.getRenderWidth()*o),n=Math.round(r/e.getAspectRatio(t)))}else isNaN(i)||(n=i,r=i);return r&&(r=Math.floor(r)),n&&(n=Math.floor(n)),{height:0|n,width:0|r}},e}();p.w1.CreateScreenshot=_.CreateScreenshot,p.w1.CreateScreenshotAsync=_.CreateScreenshotAsync,p.w1.CreateScreenshotUsingRenderTarget=_.CreateScreenshotUsingRenderTarget,p.w1.CreateScreenshotUsingRenderTargetAsync=_.CreateScreenshotUsingRenderTargetAsync},6936:(e,t,i)=>{"use strict";i.d(t,{t:()=>r,f:()=>o});var n=i(655),r=function(){function e(t){this.length=0,this.data=new Array(t),this._id=e._GlobalId++}return e.prototype.push=function(e){this.data[this.length++]=e,this.length>this.data.length&&(this.data.length*=2)},e.prototype.forEach=function(e){for(var t=0;tthis.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t=this.length?-1:t},e.prototype.contains=function(e){return-1!==this.indexOf(e)},e._GlobalId=0,e}(),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._duplicateId=0,t}return(0,n.ZT)(t,e),t.prototype.push=function(t){e.prototype.push.call(this,t),t.__smartArrayFlags||(t.__smartArrayFlags={}),t.__smartArrayFlags[this._id]=this._duplicateId},t.prototype.pushNoDuplicate=function(e){return(!e.__smartArrayFlags||e.__smartArrayFlags[this._id]!==this._duplicateId)&&(this.push(e),!0)},t.prototype.reset=function(){e.prototype.reset.call(this),this._duplicateId++},t.prototype.concatWithNoDuplicate=function(e){if(0!==e.length){this.length+e.length>this.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t{"use strict";i.d(t,{M:()=>n});var n=function(){function e(){}return e.EndsWith=function(e,t){return-1!==e.indexOf(t,e.length-t.length)},e.StartsWith=function(e,t){return!!e&&0===e.indexOf(t)},e.Decode=function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",i=0;i>2,o=(3&t)<<4|(i=c>4,s=(15&i)<<2|(n=c>6,a=63&n,isNaN(i)?s=a=64:isNaN(n)&&(a=64),h+=l.charAt(r)+l.charAt(o)+l.charAt(s)+l.charAt(a);return h},e.PadNumber=function(e,t){for(var i=String(e);i.length{"use strict";i.d(t,{$:()=>r});var n=function(){function e(){}return e.Eval=function(t,i){return"true"===(t=t.match(/\([^\(\)]*\)/g)?t.replace(/\([^\(\)]*\)/g,(function(t){return t=t.slice(1,t.length-1),e._HandleParenthesisContent(t,i)})):e._HandleParenthesisContent(t,i))||"false"!==t&&e.Eval(t,i)},e._HandleParenthesisContent=function(t,i){var n;i=i||function(e){return"true"===e};var r=t.split("||");for(var o in r)if(r.hasOwnProperty(o)){var s=e._SimplifyNegation(r[o].trim()),a=s.split("&&");if(a.length>1)for(var l=0;l{"use strict";i.d(t,{Q:()=>r});var n=i(6327),r=function(){function e(){}return e.SetImmediate=function(e){n.M.IsWindowObjectExist()&&window.setImmediate?window.setImmediate(e):setTimeout(e,1)},e}()},5540:(e,t,i)=>{"use strict";i.d(t,{$g:()=>b,w1:()=>y});var n,r=i(475),o=i(6327),s=i(3734),a=i(789),l=i(5273),h=i(106),c=i(2840),u=i(2733),f=i(5684);!function(e){e[e.Pending=0]="Pending",e[e.Fulfilled=1]="Fulfilled",e[e.Rejected=2]="Rejected"}(n||(n={}));var d=function(){this.count=0,this.target=0,this.results=[]},p=function(){function e(e){var t=this;if(this._state=n.Pending,this._children=new Array,this._rejectWasConsumed=!1,e)try{e((function(e){t._resolve(e)}),(function(e){t._reject(e)}))}catch(e){this._reject(e)}}return Object.defineProperty(e.prototype,"_result",{get:function(){return this._resultValue},set:function(e){this._resultValue=e,this._parent&&void 0===this._parent._result&&(this._parent._result=e)},enumerable:!1,configurable:!0}),e.prototype.catch=function(e){return this.then(void 0,e)},e.prototype.then=function(t,i){var r=this,o=new e;return o._onFulfilled=t,o._onRejected=i,this._children.push(o),o._parent=this,this._state!==n.Pending&&setTimeout((function(){if(r._state===n.Fulfilled||r._rejectWasConsumed){var e=o._resolve(r._result);if(null!=e)if(void 0!==e._state){var t=e;o._children.push(t),t._parent=o,o=t}else o._result=e}else o._reject(r._reason)})),o},e.prototype._moveChildren=function(e){var t,i=this;if((t=this._children).push.apply(t,e.splice(0,e.length)),this._children.forEach((function(e){e._parent=i})),this._state===n.Fulfilled)for(var r=0,o=this._children;r=t)break;if(n(s),o&&o()){e.breakLoop();break}}e.executeNext()}),s)}),r)},e}();u.l.FallbackTexture="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhY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KK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z",_.Apply()},6132:(e,t,i)=>{"use strict";i.d(t,{Q:()=>n});var n=function(){function e(){}return e.GetClass=function(e){return this.RegisteredTypes&&this.RegisteredTypes[e]?this.RegisteredTypes[e]:null},e.RegisteredTypes={},e}()},2840:(e,t,i)=>{"use strict";i.d(t,{g:()=>n});var n=function(){function e(){this._xhr="undefined"!=typeof _native&&_native.XMLHttpRequest?new _native.XMLHttpRequest:new XMLHttpRequest}return e.prototype._injectCustomRequestHeaders=function(){for(var t in e.CustomRequestHeaders){var i=e.CustomRequestHeaders[t];i&&this._xhr.setRequestHeader(t,i)}},Object.defineProperty(e.prototype,"onprogress",{get:function(){return this._xhr.onprogress},set:function(e){this._xhr.onprogress=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._xhr.readyState},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._xhr.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statusText",{get:function(){return this._xhr.statusText},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"response",{get:function(){return this._xhr.response},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"responseURL",{get:function(){return this._xhr.responseURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"responseText",{get:function(){return this._xhr.responseText},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"responseType",{get:function(){return this._xhr.responseType},set:function(e){this._xhr.responseType=e},enumerable:!1,configurable:!0}),e.prototype.addEventListener=function(e,t,i){this._xhr.addEventListener(e,t,i)},e.prototype.removeEventListener=function(e,t,i){this._xhr.removeEventListener(e,t,i)},e.prototype.abort=function(){this._xhr.abort()},e.prototype.send=function(t){e.CustomRequestHeaders&&this._injectCustomRequestHeaders(),this._xhr.send(t)},e.prototype.open=function(t,i){for(var n=0,r=e.CustomRequestModifiers;n{"use strict";i.d(t,{D:()=>u});var n=i(655),r=i(6936),o=i(475),s=i(2973),a="\nattribute vec2 position;\nuniform vec2 scale;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=(position*madd+madd)*scale;\ngl_Position=vec4(position,0.0,1.0);\n}";i(7947).Q.ShadersStore.postprocessVertexShader=a;var l=i(2905),h=(i(6593),i(9023)),c=i(6132),u=function(){function e(e,t,i,n,a,l,h,c,u,f,d,p,_,g,m){void 0===h&&(h=1),void 0===f&&(f=null),void 0===d&&(d=0),void 0===p&&(p="postprocess"),void 0===g&&(g=!1),void 0===m&&(m=5),this.width=-1,this.height=-1,this.nodeMaterialSource=null,this._outputTexture=null,this.autoClear=!0,this.alphaMode=0,this.animations=new Array,this.enablePixelPerfectMode=!1,this.forceFullscreenViewport=!0,this.scaleMode=1,this.alwaysForcePOT=!1,this._samples=1,this.adaptScaleToCurrentViewport=!1,this._reusable=!1,this._textures=new r.t(2),this._currentRenderTextureInd=0,this._scaleRatio=new s.FM(1,1),this._texelSize=s.FM.Zero(),this.onActivateObservable=new o.y$,this.onSizeChangedObservable=new o.y$,this.onApplyObservable=new o.y$,this.onBeforeRenderObservable=new o.y$,this.onAfterRenderObservable=new o.y$,this.name=e,null!=l?(this._camera=l,this._scene=l.getScene(),l.attachPostProcess(this),this._engine=this._scene.getEngine(),this._scene.postProcesses.push(this),this.uniqueId=this._scene.getUniqueId()):c&&(this._engine=c,this._engine.postProcesses.push(this)),this._options=a,this.renderTargetSamplingMode=h||1,this._reusable=u||!1,this._textureType=d,this._textureFormat=m,this._samplers=n||[],this._samplers.push("textureSampler"),this._fragmentUrl=t,this._vertexUrl=p,this._parameters=i||[],this._parameters.push("scale"),this._indexParameters=_,g||this.updateEffect(f)}return Object.defineProperty(e.prototype,"samples",{get:function(){return this._samples},set:function(e){var t=this;this._samples=Math.min(e,this._engine.getCaps().maxMSAASamples),this._textures.forEach((function(e){e.samples!==t._samples&&t._engine.updateRenderTargetTextureSampleCount(e,t._samples)}))},enumerable:!1,configurable:!0}),e.prototype.getEffectName=function(){return this._fragmentUrl},Object.defineProperty(e.prototype,"onActivate",{set:function(e){this._onActivateObserver&&this.onActivateObservable.remove(this._onActivateObserver),e&&(this._onActivateObserver=this.onActivateObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSizeChanged",{set:function(e){this._onSizeChangedObserver&&this.onSizeChangedObservable.remove(this._onSizeChangedObserver),this._onSizeChangedObserver=this.onSizeChangedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onApply",{set:function(e){this._onApplyObserver&&this.onApplyObservable.remove(this._onApplyObserver),this._onApplyObserver=this.onApplyObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"inputTexture",{get:function(){return this._textures.data[this._currentRenderTextureInd]},set:function(e){this._forcedOutputTexture=e},enumerable:!1,configurable:!0}),e.prototype.restoreDefaultInputTexture=function(){this._forcedOutputTexture=null},e.prototype.getCamera=function(){return this._camera},Object.defineProperty(e.prototype,"texelSize",{get:function(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.texelSize:(this._forcedOutputTexture&&this._texelSize.copyFromFloats(1/this._forcedOutputTexture.width,1/this._forcedOutputTexture.height),this._texelSize)},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"PostProcess"},e.prototype.getEngine=function(){return this._engine},e.prototype.getEffect=function(){return this._effect},e.prototype.shareOutputWith=function(e){return this._disposeTextures(),this._shareOutputWithPostProcess=e,this},e.prototype.useOwnOutput=function(){0==this._textures.length&&(this._textures=new r.t(2)),this._shareOutputWithPostProcess=null},e.prototype.updateEffect=function(e,t,i,n,r,o,s,a){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null),this._effect=this._engine.createEffect({vertex:null!=s?s:this._vertexUrl,fragment:null!=a?a:this._fragmentUrl},["position"],t||this._parameters,i||this._samplers,null!==e?e:"",void 0,r,o,n||this._indexParameters)},e.prototype.isReusable=function(){return this._reusable},e.prototype.markTextureDirty=function(){this.width=-1},e.prototype.activate=function(e,t,i){var n=this;void 0===t&&(t=null);var r=(e=e||this._camera).getScene(),o=r.getEngine(),s=o.getCaps().maxTextureSize,a=(t?t.width:this._engine.getRenderWidth(!0))*this._options|0,h=(t?t.height:this._engine.getRenderHeight(!0))*this._options|0,c=e.parent;!c||c.leftCamera!=e&&c.rightCamera!=e||(a/=2);var u,f=this._options.width||a,d=this._options.height||h,p=7!==this.renderTargetSamplingMode&&1!==this.renderTargetSamplingMode&&2!==this.renderTargetSamplingMode;if(!this._shareOutputWithPostProcess&&!this._forcedOutputTexture){if(this.adaptScaleToCurrentViewport){var _=o.currentViewport;_&&(f*=_.width,d*=_.height)}if((p||this.alwaysForcePOT)&&(this._options.width||(f=o.needPOTTextures?l.Engine.GetExponentOfTwo(f,s,this.scaleMode):f),this._options.height||(d=o.needPOTTextures?l.Engine.GetExponentOfTwo(d,s,this.scaleMode):d)),this.width!==f||this.height!==d){if(this._textures.length>0){for(var g=0;g0)for(var e=0;e0){var i=this._camera._getFirstPostProcess();i&&i.markTextureDirty()}this.onActivateObservable.clear(),this.onAfterRenderObservable.clear(),this.onApplyObservable.clear(),this.onBeforeRenderObservable.clear(),this.onSizeChangedObservable.clear()}},e.prototype.serialize=function(){var e=h.p4.Serialize(this);return e.customType="BABYLON."+this.getClassName(),e.cameraId=this.getCamera().id,e.reusable=this._reusable,e.options=this._options,e.textureType=this._textureType,e},e.Parse=function(e,t,i){var n=c.Q.GetClass(e.customType);if(!n||!n._Parse)return null;var r=t.getCameraByID(e.cameraId);return r?n._Parse(e,r,t,i):null},(0,n.gn)([(0,h.qC)()],e.prototype,"uniqueId",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"name",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"width",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"height",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"renderTargetSamplingMode",void 0),(0,n.gn)([(0,h.XX)()],e.prototype,"clearColor",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"autoClear",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"alphaMode",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"alphaConstants",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"enablePixelPerfectMode",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"forceFullscreenViewport",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"scaleMode",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"alwaysForcePOT",void 0),(0,n.gn)([(0,h.qC)("samples")],e.prototype,"_samples",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"adaptScaleToCurrentViewport",void 0),e}();c.Q.RegisteredTypes["BABYLON.PostProcess"]=u},4761:(e,t,i)=>{"use strict";i.d(t,{O:()=>o});var n=i(511),r=i(6738),o=function(){function e(e){this._vertexBuffers={},this._scene=e}return e.prototype._prepareBuffers=function(){if(!this._vertexBuffers[r.o.PositionKind]){var e=[];e.push(1,1),e.push(-1,1),e.push(-1,-1),e.push(1,-1),this._vertexBuffers[r.o.PositionKind]=new r.o(this._scene.getEngine(),e,r.o.PositionKind,!1,!1,2),this._buildIndexBuffer()}},e.prototype._buildIndexBuffer=function(){var e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)},e.prototype._rebuild=function(){var e=this._vertexBuffers[r.o.PositionKind];e&&(e._rebuild(),this._buildIndexBuffer())},e.prototype._prepareFrame=function(e,t){void 0===e&&(e=null),void 0===t&&(t=null);var i=this._scene.activeCamera;return!!i&&(!(!(t=t||i._postProcesses.filter((function(e){return null!=e})))||0===t.length||!this._scene.postProcessesEnabled)&&(t[0].activate(i,e,null!=t),!0))},e.prototype.directRender=function(e,t,i,r,o,s){void 0===t&&(t=null),void 0===i&&(i=!1),void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s=!1);for(var a=this._scene.getEngine(),l=0;l{"use strict";i.d(t,{$:()=>a});var n=i(6936),r=i(2973),o=function(){function e(e,t,i,r,o){void 0===i&&(i=null),void 0===r&&(r=null),void 0===o&&(o=null),this.index=e,this._opaqueSubMeshes=new n.t(256),this._transparentSubMeshes=new n.t(256),this._alphaTestSubMeshes=new n.t(256),this._depthOnlySubMeshes=new n.t(256),this._particleSystems=new n.t(256),this._spriteManagers=new n.t(256),this._edgesRenderers=new n.f(16),this._scene=t,this.opaqueSortCompareFn=i,this.alphaTestSortCompareFn=r,this.transparentSortCompareFn=o}return Object.defineProperty(e.prototype,"opaqueSortCompareFn",{set:function(t){this._opaqueSortCompareFn=t,this._renderOpaque=t?this.renderOpaqueSorted:e.renderUnsorted},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaTestSortCompareFn",{set:function(t){this._alphaTestSortCompareFn=t,this._renderAlphaTest=t?this.renderAlphaTestSorted:e.renderUnsorted},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transparentSortCompareFn",{set:function(t){this._transparentSortCompareFn=t||e.defaultTransparentSortCompare,this._renderTransparent=this.renderTransparentSorted},enumerable:!1,configurable:!0}),e.prototype.render=function(e,t,i,n){if(e)e(this._opaqueSubMeshes,this._alphaTestSubMeshes,this._transparentSubMeshes,this._depthOnlySubMeshes);else{var r=this._scene.getEngine();0!==this._depthOnlySubMeshes.length&&(r.setColorWrite(!1),this._renderAlphaTest(this._depthOnlySubMeshes),r.setColorWrite(!0)),0!==this._opaqueSubMeshes.length&&this._renderOpaque(this._opaqueSubMeshes),0!==this._alphaTestSubMeshes.length&&this._renderAlphaTest(this._alphaTestSubMeshes);var o=r.getStencilBuffer();if(r.setStencilBuffer(!1),t&&this._renderSprites(),i&&this._renderParticles(n),this.onBeforeTransparentRendering&&this.onBeforeTransparentRendering(),0!==this._transparentSubMeshes.length&&(r.setStencilBuffer(o),this._renderTransparent(this._transparentSubMeshes),r.setAlphaMode(0)),r.setStencilBuffer(!1),this._edgesRenderers.length){for(var s=0;si._alphaIndex?1:t._alphaIndext._distanceToCamera?-1:0},e.frontToBackSortCompare=function(e,t){return e._distanceToCamerat._distanceToCamera?1:0},e.prototype.prepare=function(){this._opaqueSubMeshes.reset(),this._transparentSubMeshes.reset(),this._alphaTestSubMeshes.reset(),this._depthOnlySubMeshes.reset(),this._particleSystems.reset(),this._spriteManagers.reset(),this._edgesRenderers.reset()},e.prototype.dispose=function(){this._opaqueSubMeshes.dispose(),this._transparentSubMeshes.dispose(),this._alphaTestSubMeshes.dispose(),this._depthOnlySubMeshes.dispose(),this._particleSystems.dispose(),this._spriteManagers.dispose(),this._edgesRenderers.dispose()},e.prototype.dispatch=function(e,t,i){void 0===t&&(t=e.getMesh()),void 0===i&&(i=e.getMaterial()),null!=i&&(i.needAlphaBlendingForMesh(t)?this._transparentSubMeshes.push(e):i.needAlphaTesting()?(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._alphaTestSubMeshes.push(e)):(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._opaqueSubMeshes.push(e)),t._renderingGroup=this,t._edgesRenderer&&t._edgesRenderer.isEnabled&&this._edgesRenderers.pushNoDuplicate(t._edgesRenderer))},e.prototype.dispatchSprites=function(e){this._spriteManagers.push(e)},e.prototype.dispatchParticles=function(e){this._particleSystems.push(e)},e.prototype._renderParticles=function(e){if(0!==this._particleSystems.length){var t=this._scene.activeCamera;this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);for(var i=0;i{"use strict";var n="bonesDeclaration",r="#if NUM_BONE_INFLUENCERS>0\n#ifdef BONETEXTURE\nuniform sampler2D boneSampler;\nuniform float boneTextureWidth;\n#else\nuniform mat4 mBones[BonesPerMesh];\n#ifdef BONES_VELOCITY_ENABLED\nuniform mat4 mPreviousBones[BonesPerMesh];\n#endif\n#endif\nattribute vec4 matricesIndices;\nattribute vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nattribute vec4 matricesIndicesExtra;\nattribute vec4 matricesWeightsExtra;\n#endif\n#ifdef BONETEXTURE\n#define inline\nmat4 readMatrixFromRawSampler(sampler2D smp,float index)\n{\nfloat offset=index*4.0;\nfloat dx=1.0/boneTextureWidth;\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));\nreturn mat4(m0,m1,m2,m3);\n}\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},9686:(e,t,i)=>{"use strict";var n="bonesVertex",r="#if NUM_BONE_INFLUENCERS>0\nmat4 influence;\n#ifdef BONETEXTURE\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\n#endif\n#else\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\n#endif\nfinalWorld=finalWorld*influence;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},9421:(e,t,i)=>{"use strict";var n="bumpFragment",r="vec2 uvOffset=vec2(0.0,0.0);\n#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)\n#ifdef NORMALXYSCALE\nfloat normalScale=1.0;\n#elif defined(BUMP)\nfloat normalScale=vBumpInfos.y;\n#else\nfloat normalScale=1.0;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#elif defined(BUMP)\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vBumpUV);\n#else\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vDetailUV,vec2(1.,1.));\n#endif\n#elif defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#else\nmat3 TBN=cotangent_frame(normalW,vPositionW,vMainUV1,vec2(1.,1.));\n#endif\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\n#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\n#endif\n#endif\n#ifdef DETAIL\nvec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);\nvec2 detailNormalRG=detailColor.wy*2.0-1.0;\nfloat detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));\nvec3 detailNormal=vec3(detailNormalRG,detailNormalB);\n#endif\n#ifdef BUMP\n#ifdef OBJECTSPACE_NORMALMAP\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz*2.0-1.0);\nnormalW=normalize(mat3(normalMatrix)*normalW);\n#elif !defined(DETAIL)\nnormalW=perturbNormal(TBN,vBumpUV+uvOffset);\n#else\nvec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0;\n\n#if DETAIL_NORMALBLENDMETHOD == 0\ndetailNormal.xy*=vDetailInfos.z;\nvec3 blendedNormal=normalize(vec3(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z));\n#elif DETAIL_NORMALBLENDMETHOD == 1\ndetailNormal.xy*=vDetailInfos.z;\nbumpNormal+=vec3(0.0,0.0,1.0);\ndetailNormal*=vec3(-1.0,-1.0,1.0);\nvec3 blendedNormal=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal;\n#endif\nnormalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y);\n#endif\n#elif defined(DETAIL)\ndetailNormal.xy*=vDetailInfos.z;\nnormalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);\n#endif";i(7947).Q.IncludesShadersStore[n]=r},4711:(e,t,i)=>{"use strict";var n="bumpFragmentFunctions",r="#if defined(BUMP)\n#if BUMPDIRECTUV == 1\n#define vBumpUV vMainUV1\n#elif BUMPDIRECTUV == 2\n#define vBumpUV vMainUV2\n#else\nvarying vec2 vBumpUV;\n#endif\nuniform sampler2D bumpSampler;\nvec3 perturbNormal(mat3 cotangentFrame,vec2 uv)\n{\nreturn perturbNormal(cotangentFrame,texture2D(bumpSampler,uv).xyz,vBumpInfos.y);\n}\n#endif\n#if defined(DETAIL)\n#if DETAILDIRECTUV == 1\n#define vDetailUV vMainUV1\n#elif DETAILDIRECTUV == 2\n#define vDetailUV vMainUV2\n#else\nvarying vec2 vDetailUV;\n#endif\nuniform sampler2D detailSampler;\n#endif\n#if defined(BUMP)\nvec3 perturbNormal(mat3 cotangentFrame,vec3 color)\n{\nreturn perturbNormal(cotangentFrame,color,vBumpInfos.y);\n}\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{\nreturn cotangent_frame(normal,p,uv,vTangentSpaceParams);\n}\n#endif\n#if defined(BUMP) && defined(PARALLAX)\nconst float minSamples=4.;\nconst float maxSamples=15.;\nconst int iMaxSamples=15;\n\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\nparallaxLimit*=parallaxScale;\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\nfloat stepSize=1.0/numSamples;\n\nfloat currRayHeight=1.0;\nvec2 vCurrOffset=vec2(0,0);\nvec2 vLastOffset=vec2(0,0);\nfloat lastSampledHeight=1.0;\nfloat currSampledHeight=1.0;\nfor (int i=0; icurrRayHeight)\n{\nfloat delta1=currSampledHeight-currRayHeight;\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\nfloat ratio=delta1/(delta1+delta2);\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\n\nbreak;\n}\nelse\n{\ncurrRayHeight-=stepSize;\nvLastOffset=vCurrOffset;\nvCurrOffset+=stepSize*vMaxOffset;\nlastSampledHeight=currSampledHeight;\n}\n}\nreturn vCurrOffset;\n}\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\n{\n\nfloat height=texture2D(bumpSampler,vBumpUV).w;\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\nreturn -texCoordOffset;\n}\n#endif";i(7947).Q.IncludesShadersStore[n]=r},3110:(e,t,i)=>{"use strict";var n="bumpFragmentMainFunctions",r="#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL)\n#if defined(TANGENT) && defined(NORMAL)\nvarying mat3 vTBN;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform mat4 normalMatrix;\n#endif\nvec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)\n{\n#ifdef NORMALXYSCALE\nnormal=normalize(normal*vec3(scale,scale,1.0));\n#endif\nreturn normalize(cotangentFrame*normal);\n}\nvec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)\n{\nreturn perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);\n}\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\n{\n\nuv=gl_FrontFacing ? uv : -uv;\n\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\n\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;\n\ntangent*=tangentSpaceParams.x;\nbitangent*=tangentSpaceParams.y;\n\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(bitangent,bitangent)));\nreturn mat3(tangent*invmax,bitangent*invmax,normal);\n}\n#endif\n";i(7947).Q.IncludesShadersStore[n]=r},5866:(e,t,i)=>{"use strict";var n="bumpVertex",r="#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nvec3 tbnNormal=normalize(normalUpdated);\nvec3 tbnTangent=normalize(tangentUpdated.xyz);\nvec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;\nvTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},4344:(e,t,i)=>{"use strict";var n="bumpVertexDeclaration",r="#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nvarying mat3 vTBN;\n#endif\n#endif\n";i(7947).Q.IncludesShadersStore[n]=r},3120:(e,t,i)=>{"use strict";var n="clipPlaneFragment",r="#ifdef CLIPPLANE\nif (fClipDistance>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE2\nif (fClipDistance2>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE3\nif (fClipDistance3>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE4\nif (fClipDistance4>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE5\nif (fClipDistance5>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE6\nif (fClipDistance6>0.0)\n{\ndiscard;\n}\n#endif";i(7947).Q.IncludesShadersStore[n]=r},1655:(e,t,i)=>{"use strict";var n="clipPlaneFragmentDeclaration",r="#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nvarying float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nvarying float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nvarying float fClipDistance6;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},6403:(e,t,i)=>{"use strict";var n="clipPlaneVertex",r="#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,vClipPlane);\n#endif\n#ifdef CLIPPLANE2\nfClipDistance2=dot(worldPos,vClipPlane2);\n#endif\n#ifdef CLIPPLANE3\nfClipDistance3=dot(worldPos,vClipPlane3);\n#endif\n#ifdef CLIPPLANE4\nfClipDistance4=dot(worldPos,vClipPlane4);\n#endif\n#ifdef CLIPPLANE5\nfClipDistance5=dot(worldPos,vClipPlane5);\n#endif\n#ifdef CLIPPLANE6\nfClipDistance6=dot(worldPos,vClipPlane6);\n#endif";i(7947).Q.IncludesShadersStore[n]=r},8738:(e,t,i)=>{"use strict";var n="clipPlaneVertexDeclaration",r="#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;\nvarying float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nuniform vec4 vClipPlane5;\nvarying float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nuniform vec4 vClipPlane6;\nvarying float fClipDistance6;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},7236:(e,t,i)=>{"use strict";var n="depthPrePass",r="#ifdef DEPTHPREPASS\ngl_FragColor=vec4(0.,0.,0.,1.0);\nreturn;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},6635:(e,t,i)=>{"use strict";var n="fogFragment",r="#ifdef FOG\nfloat fog=CalcFogFactor();\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},6733:(e,t,i)=>{"use strict";var n="fogFragmentDeclaration",r="#ifdef FOG\n#define FOGMODE_NONE 0.\n#define FOGMODE_EXP 1.\n#define FOGMODE_EXP2 2.\n#define FOGMODE_LINEAR 3.\n#define E 2.71828\nuniform vec4 vFogInfos;\nuniform vec3 vFogColor;\nvarying vec3 vFogDistance;\nfloat CalcFogFactor()\n{\nfloat fogCoeff=1.0;\nfloat fogStart=vFogInfos.y;\nfloat fogEnd=vFogInfos.z;\nfloat fogDensity=vFogInfos.w;\nfloat fogDistance=length(vFogDistance);\nif (FOGMODE_LINEAR == vFogInfos.x)\n{\nfogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);\n}\nelse if (FOGMODE_EXP == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDensity);\n}\nelse if (FOGMODE_EXP2 == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);\n}\nreturn clamp(fogCoeff,0.0,1.0);\n}\n#endif";i(7947).Q.IncludesShadersStore[n]=r},5724:(e,t,i)=>{"use strict";var n="fogVertex",r="#ifdef FOG\nvFogDistance=(view*worldPos).xyz;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},5183:(e,t,i)=>{"use strict";var n="fogVertexDeclaration",r="#ifdef FOG\nvarying vec3 vFogDistance;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},8662:(e,t,i)=>{"use strict";var n="helperFunctions",r="const float PI=3.1415926535897932384626433832795;\nconst float HALF_MIN=5.96046448e-08;\nconst float LinearEncodePowerApprox=2.2;\nconst float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;\nconst vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);\nconst float Epsilon=0.0000001;\n#define saturate(x) clamp(x,0.0,1.0)\n#define absEps(x) abs(x)+Epsilon\n#define maxEps(x) max(x,Epsilon)\n#define saturateEps(x) clamp(x,Epsilon,1.0)\nmat3 transposeMat3(mat3 inMatrix) {\nvec3 i0=inMatrix[0];\nvec3 i1=inMatrix[1];\nvec3 i2=inMatrix[2];\nmat3 outMatrix=mat3(\nvec3(i0.x,i1.x,i2.x),\nvec3(i0.y,i1.y,i2.y),\nvec3(i0.z,i1.z,i2.z)\n);\nreturn outMatrix;\n}\n\nmat3 inverseMat3(mat3 inMatrix) {\nfloat a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];\nfloat a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];\nfloat a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];\nfloat b01=a22*a11-a12*a21;\nfloat b11=-a22*a10+a12*a20;\nfloat b21=a21*a10-a11*a20;\nfloat det=a00*b01+a01*b11+a02*b21;\nreturn mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;\n}\nfloat toLinearSpace(float color)\n{\nreturn pow(color,LinearEncodePowerApprox);\n}\nvec3 toLinearSpace(vec3 color)\n{\nreturn pow(color,vec3(LinearEncodePowerApprox));\n}\nvec4 toLinearSpace(vec4 color)\n{\nreturn vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);\n}\nvec3 toGammaSpace(vec3 color)\n{\nreturn pow(color,vec3(GammaEncodePowerApprox));\n}\nvec4 toGammaSpace(vec4 color)\n{\nreturn vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);\n}\nfloat toGammaSpace(float color)\n{\nreturn pow(color,GammaEncodePowerApprox);\n}\nfloat square(float value)\n{\nreturn value*value;\n}\nfloat pow5(float value) {\nfloat sq=value*value;\nreturn sq*sq*value;\n}\nfloat getLuminance(vec3 color)\n{\nreturn clamp(dot(color,LuminanceEncodeApprox),0.,1.);\n}\n\nfloat getRand(vec2 seed) {\nreturn fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);\n}\nfloat dither(vec2 seed,float varianceAmount) {\nfloat rand=getRand(seed);\nfloat dither=mix(-varianceAmount/255.0,varianceAmount/255.0,rand);\nreturn dither;\n}\n\nconst float rgbdMaxRange=255.0;\nvec4 toRGBD(vec3 color) {\nfloat maxRGB=maxEps(max(color.r,max(color.g,color.b)));\nfloat D=max(rgbdMaxRange/maxRGB,1.);\nD=clamp(floor(D)/255.0,0.,1.);\n\nvec3 rgb=color.rgb*D;\n\nrgb=toGammaSpace(rgb);\nreturn vec4(rgb,D);\n}\nvec3 fromRGBD(vec4 rgbd) {\n\nrgbd.rgb=toLinearSpace(rgbd.rgb);\n\nreturn rgbd.rgb/rgbd.a;\n}\n";i(7947).Q.IncludesShadersStore[n]=r},7176:(e,t,i)=>{"use strict";var n="imageProcessingDeclaration",r="#ifdef EXPOSURE\nuniform float exposureLinear;\n#endif\n#ifdef CONTRAST\nuniform float contrast;\n#endif\n#ifdef VIGNETTE\nuniform vec2 vInverseScreenSize;\nuniform vec4 vignetteSettings1;\nuniform vec4 vignetteSettings2;\n#endif\n#ifdef COLORCURVES\nuniform vec4 vCameraColorCurveNegative;\nuniform vec4 vCameraColorCurveNeutral;\nuniform vec4 vCameraColorCurvePositive;\n#endif\n#ifdef COLORGRADING\n#ifdef COLORGRADING3D\nuniform highp sampler3D txColorTransform;\n#else\nuniform sampler2D txColorTransform;\n#endif\nuniform vec4 colorTransformSettings;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},9012:(e,t,i)=>{"use strict";var n="imageProcessingFunctions",r="#if defined(COLORGRADING) && !defined(COLORGRADING3D)\n\n#define inline\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\n{\nfloat sliceSize=2.0*sampler3dSetting.x;\n#ifdef SAMPLER3DGREENDEPTH\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\n#else\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\n#endif\nfloat sliceInteger=floor(sliceContinuous);\n\n\nfloat sliceFraction=sliceContinuous-sliceInteger;\n#ifdef SAMPLER3DGREENDEPTH\nvec2 sliceUV=color.rb;\n#else\nvec2 sliceUV=color.rg;\n#endif\nsliceUV.x*=sliceSize;\nsliceUV.x+=sliceInteger*sliceSize;\nsliceUV=saturate(sliceUV);\nvec4 slice0Color=texture2D(colorTransform,sliceUV);\nsliceUV.x+=sliceSize;\nsliceUV=saturate(sliceUV);\nvec4 slice1Color=texture2D(colorTransform,sliceUV);\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\n#ifdef SAMPLER3DBGRMAP\ncolor.rgb=result.rgb;\n#else\ncolor.rgb=result.bgr;\n#endif\nreturn color;\n}\n#endif\n#ifdef TONEMAPPING_ACES\n\n\n\n\n\nconst mat3 ACESInputMat=mat3(\nvec3(0.59719,0.07600,0.02840),\nvec3(0.35458,0.90834,0.13383),\nvec3(0.04823,0.01566,0.83777)\n);\n\nconst mat3 ACESOutputMat=mat3(\nvec3( 1.60475,-0.10208,-0.00327),\nvec3(-0.53108,1.10813,-0.07276),\nvec3(-0.07367,-0.00605,1.07602)\n);\nvec3 RRTAndODTFit(vec3 v)\n{\nvec3 a=v*(v+0.0245786)-0.000090537;\nvec3 b=v*(0.983729*v+0.4329510)+0.238081;\nreturn a/b;\n}\nvec3 ACESFitted(vec3 color)\n{\ncolor=ACESInputMat*color;\n\ncolor=RRTAndODTFit(color);\ncolor=ACESOutputMat*color;\n\ncolor=saturate(color);\nreturn color;\n}\n#endif\nvec4 applyImageProcessing(vec4 result) {\n#ifdef EXPOSURE\nresult.rgb*=exposureLinear;\n#endif\n#ifdef VIGNETTE\n\nvec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;\nviewportXY=viewportXY*2.0-1.0;\nvec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);\nfloat vignetteTerm=dot(vignetteXY1,vignetteXY1);\nfloat vignette=pow(vignetteTerm,vignetteSettings2.w);\n\nvec3 vignetteColor=vignetteSettings2.rgb;\n#ifdef VIGNETTEBLENDMODEMULTIPLY\nvec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);\nresult.rgb*=vignetteColorMultiplier;\n#endif\n#ifdef VIGNETTEBLENDMODEOPAQUE\nresult.rgb=mix(vignetteColor,result.rgb,vignette);\n#endif\n#endif\n#ifdef TONEMAPPING\n#ifdef TONEMAPPING_ACES\nresult.rgb=ACESFitted(result.rgb);\n#else\nconst float tonemappingCalibration=1.590579;\nresult.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\n#endif\n#endif\n\nresult.rgb=toGammaSpace(result.rgb);\nresult.rgb=saturate(result.rgb);\n#ifdef CONTRAST\n\nvec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);\nif (contrast<1.0) {\n\nresult.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);\n} else {\n\nresult.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);\n}\n#endif\n\n#ifdef COLORGRADING\nvec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;\n#ifdef COLORGRADING3D\nvec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;\n#else\nvec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;\n#endif\nresult.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);\n#endif\n#ifdef COLORCURVES\n\nfloat luma=getLuminance(result.rgb);\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\nresult.rgb*=colorCurve.rgb;\nresult.rgb=mix(vec3(luma),result.rgb,colorCurve.a);\n#endif\nreturn result;\n}";i(7947).Q.IncludesShadersStore[n]=r},3191:(e,t,i)=>{"use strict";var n="instancesDeclaration",r="#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#ifdef THIN_INSTANCES\nuniform mat4 world;\n#endif\n#else\nuniform mat4 world;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},6838:(e,t,i)=>{"use strict";var n="instancesVertex",r="#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#ifdef THIN_INSTANCES\nfinalWorld=world*finalWorld;\n#endif\n#else\nmat4 finalWorld=world;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},1130:(e,t,i)=>{"use strict";var n="lightFragment",r="#ifdef LIGHT{X}\n#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\n\n#else\n#ifdef PBR\n\n#ifdef SPOTLIGHT{X}\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(POINTLIGHT{X})\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(HEMILIGHT{X})\npreInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(DIRLIGHT{X})\npreInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#endif\npreInfo.NdotV=NdotV;\n\n#ifdef SPOTLIGHT{X}\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\npreInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\npreInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\npreInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\npreInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#endif\n#elif defined(POINTLIGHT{X})\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\n#endif\n#else\npreInfo.attenuation=1.0;\n#endif\n\n\n#ifdef HEMILIGHT{X}\npreInfo.roughness=roughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n\n#ifdef HEMILIGHT{X}\ninfo.diffuse=computeHemisphericDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb,light{X}.vLightGround);\n#elif defined(SS_TRANSLUCENCY)\ninfo.diffuse=computeDiffuseAndTransmittedLighting(preInfo,light{X}.vLightDiffuse.rgb,subSurfaceOut.transmittance);\n#else\ninfo.diffuse=computeDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb);\n#endif\n\n#ifdef SPECULARTERM\n#ifdef ANISOTROPIC\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#else\ninfo.specular=computeSpecularLighting(preInfo,normalW,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#endif\n#endif\n\n#ifdef SHEEN\n#ifdef SHEEN_LINKWITHALBEDO\n\npreInfo.roughness=sheenOut.sheenIntensity;\n#else\n#ifdef HEMILIGHT{X}\npreInfo.roughness=sheenOut.sheenRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n#endif\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#endif\n\n#ifdef CLEARCOAT\n\n#ifdef HEMILIGHT{X}\npreInfo.roughness=clearcoatOut.clearCoatRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\ninfo.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,light{X}.vLightDiffuse.rgb);\n#ifdef CLEARCOAT_TINT\n\nabsorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);\ninfo.diffuse*=absorption;\n#ifdef SPECULARTERM\ninfo.specular*=absorption;\n#endif\n#endif\n\ninfo.diffuse*=info.clearCoat.w;\n#ifdef SPECULARTERM\ninfo.specular*=info.clearCoat.w;\n#endif\n#ifdef SHEEN\ninfo.sheen*=info.clearCoat.w;\n#endif\n#endif\n#else\n#ifdef SPOTLIGHT{X}\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\n#elif defined(HEMILIGHT{X})\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness);\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\n#endif\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightSampler{X},textureProjectionMatrix{X});\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nfor (int i=0; i=0.) {\nindex{X}=i;\nbreak;\n}\n}\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nif (index{X}>=0)\n#endif\n{\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nshadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nshadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=vec3(shadow)*vCascadeColorsMultiplier{X}[index{X}];\n#endif\n#ifndef SHADOWCSMNOBLEND{X}\nfloat frustumLength=frustumLengths{X}[index{X}];\nfloat diffRatio=clamp(diff{X}/frustumLength,0.,1.)*cascadeBlendFactor{X};\nif (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.)\n{\nindex{X}+=1;\nfloat nextShadow=0.;\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nnextShadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nnextShadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nnextShadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\nshadow=mix(nextShadow,shadow,diffRatio);\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio);\n#endif\n}\n#endif\n}\n#elif defined(SHADOWCLOSEESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithCloseESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPOISSON{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithPoissonSamplingCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#else\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#endif\n#ifdef SHADOWONLY\n#ifndef SHADOWINUSE\n#define SHADOWINUSE\n#endif\nglobalShadow+=shadow;\nshadowLightCount+=1.0;\n#endif\n#else\nshadow=1.;\n#endif\n#ifndef SHADOWONLY\n#ifdef CUSTOMUSERLIGHTING\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\n#ifdef SPECULARTERM\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\n#endif\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\ndiffuseBase+=lightmapColor.rgb*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef CLEARCOAT\n#ifndef LIGHTMAPNOSPECULAR{X}\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef SHEEN\n#ifndef LIGHTMAPNOSPECULAR{X}\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#else\n#ifdef SHADOWCSMDEBUG{X}\ndiffuseBase+=info.diffuse*shadowDebug{X};\n#else\ndiffuseBase+=info.diffuse*shadow;\n#endif\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#ifdef CLEARCOAT\nclearCoatBase+=info.clearCoat.rgb*shadow;\n#endif\n#ifdef SHEEN\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},8806:(e,t,i)=>{"use strict";var n="lightFragmentDeclaration",r="#ifdef LIGHT{X}\nuniform vec4 vLightData{X};\nuniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec4 vLightSpecular{X};\n#else\nvec4 vLightSpecular{X}=vec4(0.);\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float cascadeBlendFactor{X};\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\nuniform highp sampler2DArray depthSampler{X};\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\n#else\nuniform highp sampler2DArray shadowSampler{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);\nvec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};\nuniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};\nuniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},8644:(e,t,i)=>{"use strict";var n="lightUboDeclaration",r="#ifdef LIGHT{X}\nuniform Light{X}\n{\nvec4 vLightData;\nvec4 vLightDiffuse;\nvec4 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;\nvec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;\nvec2 depthValues;\n} light{X};\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float cascadeBlendFactor{X};\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\nuniform highp sampler2DArray depthSampler{X};\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\n#else\nuniform highp sampler2DArray shadowSampler{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);\nvec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},8136:(e,t,i)=>{"use strict";var n="logDepthDeclaration",r="#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;\nvarying float vFragmentDepth;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},8516:(e,t,i)=>{"use strict";var n="logDepthFragment",r="#ifdef LOGARITHMICDEPTH\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},2753:(e,t,i)=>{"use strict";var n="logDepthVertex",r="#ifdef LOGARITHMICDEPTH\nvFragmentDepth=1.0+gl_Position.w;\ngl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},2389:(e,t,i)=>{"use strict";var n="morphTargetsVertex",r="#ifdef MORPHTARGETS\npositionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated+=(uv_{X}-uv)*morphTargetInfluences[{X}];\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},1892:(e,t,i)=>{"use strict";var n="morphTargetsVertexDeclaration",r="#ifdef MORPHTARGETS\nattribute vec3 position{X};\n#ifdef MORPHTARGETS_NORMAL\nattribute vec3 normal{X};\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute vec3 tangent{X};\n#endif\n#ifdef MORPHTARGETS_UV\nattribute vec2 uv_{X};\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},9781:(e,t,i)=>{"use strict";var n="morphTargetsVertexGlobalDeclaration",r="#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#endif";i(7947).Q.IncludesShadersStore[n]=r},2213:(e,t,i)=>{"use strict";var n="prePassDeclaration",r="#ifdef PREPASS\n#extension GL_EXT_draw_buffers : require\n#ifdef WEBGL2\nlayout(location=0) out highp vec4 glFragData[{X}];\nhighp vec4 gl_FragColor;\n#endif\n#ifdef PREPASS_DEPTHNORMAL\nvarying highp vec3 vViewPos;\n#endif\n#ifdef PREPASS_VELOCITY\nvarying highp vec4 vCurrentPosition;\nvarying highp vec4 vPreviousPosition;\n#endif\n#endif\n";i(7947).Q.IncludesShadersStore[n]=r},1889:(e,t,i)=>{"use strict";var n="prePassVertex",r="#ifdef PREPASS_DEPTHNORMAL\nvViewPos=(view*worldPos).rgb;\n#endif\n#if defined(PREPASS_VELOCITY) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*worldPos;\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;\npreviousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*previousWorld*previousInfluence*vec4(positionUpdated,1.0);\n#else\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},3235:(e,t,i)=>{"use strict";var n="prePassVertexDeclaration",r="#ifdef PREPASS\n#ifdef PREPASS_DEPTHNORMAL\nvarying vec3 vViewPos;\n#endif\n#ifdef PREPASS_VELOCITY\nuniform mat4 previousWorld;\nuniform mat4 previousViewProjection;\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},2678:(e,t,i)=>{"use strict";var n="reflectionFunction",r="vec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {\n\nvec3 invOrigVec=vec3(1.0,1.0,1.0)/origVec;\nvec3 halfSize=cubeSize*0.5;\nvec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;\nvec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;\n\nvec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);\n\nfloat distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);\n\nvec3 intersectPositionWS=vertexPos+origVec*distance;\n\nreturn intersectPositionWS-cubePos;\n}\nvec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\n{\nfloat lon=atan(direction.z,direction.x);\nfloat lat=acos(direction.y);\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\nfloat s=sphereCoords.x*0.5+0.5;\nfloat t=sphereCoords.y;\nreturn vec3(s,t,0);\n}\nvec3 computeMirroredFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\n{\nfloat lon=atan(direction.z,direction.x);\nfloat lat=acos(direction.y);\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\nfloat s=sphereCoords.x*0.5+0.5;\nfloat t=sphereCoords.y;\nreturn vec3(1.0-s,t,0);\n}\nvec3 computeEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{\nvec3 cameraToVertex=normalize(worldPos.xyz-eyePosition);\nvec3 r=normalize(reflect(cameraToVertex,worldNormal));\nr=vec3(reflectionMatrix*vec4(r,0));\nfloat lon=atan(r.z,r.x);\nfloat lat=acos(r.y);\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\nfloat s=sphereCoords.x*0.5+0.5;\nfloat t=sphereCoords.y;\nreturn vec3(s,t,0);\n}\nvec3 computeSphericalCoords(vec4 worldPos,vec3 worldNormal,mat4 view,mat4 reflectionMatrix)\n{\nvec3 viewDir=normalize(vec3(view*worldPos));\nvec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));\nvec3 r=reflect(viewDir,viewNormal);\nr=vec3(reflectionMatrix*vec4(r,0));\nr.z=r.z-1.0;\nfloat m=2.0*length(r);\nreturn vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);\n}\nvec3 computePlanarCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{\nvec3 viewDir=worldPos.xyz-eyePosition;\nvec3 coords=normalize(reflect(viewDir,worldNormal));\nreturn vec3(reflectionMatrix*vec4(coords,1));\n}\nvec3 computeCubicCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\n\nvec3 coords=reflect(viewDir,worldNormal);\ncoords=vec3(reflectionMatrix*vec4(coords,0));\n#ifdef INVERTCUBICMAP\ncoords.y*=-1.0;\n#endif\nreturn coords;\n}\nvec3 computeCubicLocalCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix,vec3 reflectionSize,vec3 reflectionPosition)\n{\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\n\nvec3 coords=reflect(viewDir,worldNormal);\ncoords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);\ncoords=vec3(reflectionMatrix*vec4(coords,0));\n#ifdef INVERTCUBICMAP\ncoords.y*=-1.0;\n#endif\nreturn coords;\n}\nvec3 computeProjectionCoords(vec4 worldPos,mat4 view,mat4 reflectionMatrix)\n{\nreturn vec3(reflectionMatrix*(view*worldPos));\n}\nvec3 computeSkyBoxCoords(vec3 positionW,mat4 reflectionMatrix)\n{\nreturn vec3(reflectionMatrix*vec4(positionW,1.));\n}\n#ifdef REFLECTION\nvec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)\n{\n#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\nvec3 direction=normalize(vDirectionW);\nreturn computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction);\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvec3 direction=normalize(vDirectionW);\nreturn computeFixedEquirectangularCoords(worldPos,worldNormal,direction);\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\nreturn computeEquirectangularCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_SPHERICAL\nreturn computeSphericalCoords(worldPos,worldNormal,view,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_PLANAR\nreturn computePlanarCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_CUBIC\n#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC\nreturn computeCubicLocalCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix,vReflectionSize,vReflectionPosition);\n#else\nreturn computeCubicCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#endif\n#ifdef REFLECTIONMAP_PROJECTION\nreturn computeProjectionCoords(worldPos,view,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nreturn computeSkyBoxCoords(vPositionUVW,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_EXPLICIT\nreturn vec3(0,0,0);\n#endif\n}\n#endif";i(7947).Q.IncludesShadersStore[n]=r},7867:(e,t,i)=>{"use strict";var n="shadowsFragmentFunctions",r="#ifdef SHADOWS\n#ifndef SHADOWFLOAT\n\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}\n#endif\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\n{\nfloat mask=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));\nreturn mix(value,1.0,mask);\n}\n#define inline\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\n#endif\nreturn depth>shadow ? darkness : 1.0;\n}\n#define inline\nfloat computeShadowWithPoissonSamplingCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\nfloat visibility=1.;\nvec3 poissonDisk[4];\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\n\n#ifndef SHADOWFLOAT\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;\n}\n#endif\n#define inline\nfloat computeShadow(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadow=texture2D(shadowSampler,uv).x;\n#endif\nreturn shadowPixelDepth>shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;\n}\n}\n#define inline\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\nfloat visibility=1.;\nvec2 poissonDisk[4];\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\npoissonDisk[3]=vec2(0.34495938,0.29387760);\n\n#ifndef SHADOWFLOAT\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n#define inline\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n#ifdef WEBGL2\n#define GREATEST_LESS_THAN_ONE 0.99999994\n\n#define inline\nfloat computeShadowWithCSMPCF1(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);\nfloat shadow=texture(shadowSampler,uvDepthLayer);\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n\n\n#define inline\nfloat computeShadowWithCSMPCF3(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\n\n\nvec2 uvw0=3.-2.*st;\nvec2 uvw1=1.+2.*st;\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));\nshadow=shadow/16.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n\n\n#define inline\nfloat computeShadowWithCSMPCF5(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\nvec2 uvw0=4.-3.*st;\nvec2 uvw1=vec2(7.);\nvec2 uvw2=1.+3.*st;\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[0]),layer,uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[1]),layer,uvDepth.z));\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[2]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[2]),layer,uvDepth.z));\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[2]),layer,uvDepth.z));\nshadow=shadow/144.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n#define inline\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nfloat shadow=texture2D(shadowSampler,uvDepth);\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n\n\n\n#define inline\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\n\n\nvec2 uvw0=3.-2.*st;\nvec2 uvw1=1.+2.*st;\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\nshadow=shadow/16.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n\n\n\n#define inline\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\nvec2 uvw0=4.-3.*st;\nvec2 uvw1=vec2(7.);\nvec2 uvw2=1.+3.*st;\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z));\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z));\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z));\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z));\nshadow=shadow/144.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\nconst vec3 PoissonSamplers32[64]=vec3[64](\nvec3(0.06407013,0.05409927,0.),\nvec3(0.7366577,0.5789394,0.),\nvec3(-0.6270542,-0.5320278,0.),\nvec3(-0.4096107,0.8411095,0.),\nvec3(0.6849564,-0.4990818,0.),\nvec3(-0.874181,-0.04579735,0.),\nvec3(0.9989998,0.0009880066,0.),\nvec3(-0.004920578,-0.9151649,0.),\nvec3(0.1805763,0.9747483,0.),\nvec3(-0.2138451,0.2635818,0.),\nvec3(0.109845,0.3884785,0.),\nvec3(0.06876755,-0.3581074,0.),\nvec3(0.374073,-0.7661266,0.),\nvec3(0.3079132,-0.1216763,0.),\nvec3(-0.3794335,-0.8271583,0.),\nvec3(-0.203878,-0.07715034,0.),\nvec3(0.5912697,0.1469799,0.),\nvec3(-0.88069,0.3031784,0.),\nvec3(0.5040108,0.8283722,0.),\nvec3(-0.5844124,0.5494877,0.),\nvec3(0.6017799,-0.1726654,0.),\nvec3(-0.5554981,0.1559997,0.),\nvec3(-0.3016369,-0.3900928,0.),\nvec3(-0.5550632,-0.1723762,0.),\nvec3(0.925029,0.2995041,0.),\nvec3(-0.2473137,0.5538505,0.),\nvec3(0.9183037,-0.2862392,0.),\nvec3(0.2469421,0.6718712,0.),\nvec3(0.3916397,-0.4328209,0.),\nvec3(-0.03576927,-0.6220032,0.),\nvec3(-0.04661255,0.7995201,0.),\nvec3(0.4402924,0.3640312,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.)\n);\nconst vec3 PoissonSamplers64[64]=vec3[64](\nvec3(-0.613392,0.617481,0.),\nvec3(0.170019,-0.040254,0.),\nvec3(-0.299417,0.791925,0.),\nvec3(0.645680,0.493210,0.),\nvec3(-0.651784,0.717887,0.),\nvec3(0.421003,0.027070,0.),\nvec3(-0.817194,-0.271096,0.),\nvec3(-0.705374,-0.668203,0.),\nvec3(0.977050,-0.108615,0.),\nvec3(0.063326,0.142369,0.),\nvec3(0.203528,0.214331,0.),\nvec3(-0.667531,0.326090,0.),\nvec3(-0.098422,-0.295755,0.),\nvec3(-0.885922,0.215369,0.),\nvec3(0.566637,0.605213,0.),\nvec3(0.039766,-0.396100,0.),\nvec3(0.751946,0.453352,0.),\nvec3(0.078707,-0.715323,0.),\nvec3(-0.075838,-0.529344,0.),\nvec3(0.724479,-0.580798,0.),\nvec3(0.222999,-0.215125,0.),\nvec3(-0.467574,-0.405438,0.),\nvec3(-0.248268,-0.814753,0.),\nvec3(0.354411,-0.887570,0.),\nvec3(0.175817,0.382366,0.),\nvec3(0.487472,-0.063082,0.),\nvec3(-0.084078,0.898312,0.),\nvec3(0.488876,-0.783441,0.),\nvec3(0.470016,0.217933,0.),\nvec3(-0.696890,-0.549791,0.),\nvec3(-0.149693,0.605762,0.),\nvec3(0.034211,0.979980,0.),\nvec3(0.503098,-0.308878,0.),\nvec3(-0.016205,-0.872921,0.),\nvec3(0.385784,-0.393902,0.),\nvec3(-0.146886,-0.859249,0.),\nvec3(0.643361,0.164098,0.),\nvec3(0.634388,-0.049471,0.),\nvec3(-0.688894,0.007843,0.),\nvec3(0.464034,-0.188818,0.),\nvec3(-0.440840,0.137486,0.),\nvec3(0.364483,0.511704,0.),\nvec3(0.034028,0.325968,0.),\nvec3(0.099094,-0.308023,0.),\nvec3(0.693960,-0.366253,0.),\nvec3(0.678884,-0.204688,0.),\nvec3(0.001801,0.780328,0.),\nvec3(0.145177,-0.898984,0.),\nvec3(0.062655,-0.611866,0.),\nvec3(0.315226,-0.604297,0.),\nvec3(-0.780145,0.486251,0.),\nvec3(-0.371868,0.882138,0.),\nvec3(0.200476,0.494430,0.),\nvec3(-0.494552,-0.711051,0.),\nvec3(0.612476,0.705252,0.),\nvec3(-0.578845,-0.768792,0.),\nvec3(-0.772454,-0.090976,0.),\nvec3(0.504440,0.372295,0.),\nvec3(0.155736,0.065157,0.),\nvec3(0.391522,0.849605,0.),\nvec3(-0.620106,-0.328104,0.),\nvec3(0.789239,-0.419965,0.),\nvec3(-0.545396,0.538133,0.),\nvec3(-0.178564,-0.596057,0.)\n);\n\n\n\n\n\n#define inline\nfloat computeShadowWithCSMPCSS(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);\nfloat blockerDepth=0.0;\nfloat sumBlockerDepth=0.0;\nfloat numBlocker=0.0;\nfor (int i=0; i1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nfloat blockerDepth=0.0;\nfloat sumBlockerDepth=0.0;\nfloat numBlocker=0.0;\nfor (int i=0; i{"use strict";var n="shadowsVertex",r="#ifdef SHADOWS\n#if defined(SHADOWCSM{X})\nvPositionFromCamera{X}=view*worldPos;\nfor (int i=0; i{"use strict";i.d(t,{p:()=>n});var n=function(){function e(){this.rootNodes=new Array,this.cameras=new Array,this.lights=new Array,this.meshes=new Array,this.skeletons=new Array,this.particleSystems=new Array,this.animations=[],this.animationGroups=new Array,this.multiMaterials=new Array,this.materials=new Array,this.morphTargetManagers=new Array,this.geometries=new Array,this.transformNodes=new Array,this.actionManagers=new Array,this.textures=new Array,this._environmentTexture=null,this.postProcesses=new Array}return e.AddParser=function(e,t){this._BabylonFileParsers[e]=t},e.GetParser=function(e){return this._BabylonFileParsers[e]?this._BabylonFileParsers[e]:null},e.AddIndividualParser=function(e,t){this._IndividualBabylonFileParsers[e]=t},e.GetIndividualParser=function(e){return this._IndividualBabylonFileParsers[e]?this._IndividualBabylonFileParsers[e]:null},e.Parse=function(e,t,i,n){for(var r in this._BabylonFileParsers)this._BabylonFileParsers.hasOwnProperty(r)&&this._BabylonFileParsers[r](e,t,i,n)},Object.defineProperty(e.prototype,"environmentTexture",{get:function(){return this._environmentTexture},set:function(e){this._environmentTexture=e},enumerable:!1,configurable:!0}),e.prototype.getNodes=function(){var e=new Array;return e=(e=(e=(e=e.concat(this.meshes)).concat(this.lights)).concat(this.cameras)).concat(this.transformNodes),this.skeletons.forEach((function(t){return e=e.concat(t.bones)})),e},e._BabylonFileParsers={},e._IndividualBabylonFileParsers={},e}()},2686:(e,t,i)=>{"use strict";i.d(t,{N:()=>h});var n=i(655),r=i(2973),o=i(9023),s=i(475),a=i(2733),l=i(106),h=function(){function e(e,t){void 0===t&&(t=null),this.state="",this.metadata=null,this.reservedDataStore=null,this._doNotSerialize=!1,this._isDisposed=!1,this.animations=new Array,this._ranges={},this.onReady=null,this._isEnabled=!0,this._isParentEnabled=!0,this._isReady=!0,this._currentRenderId=-1,this._parentUpdateId=-1,this._childUpdateId=-1,this._waitingParentId=null,this._cache={},this._parentNode=null,this._children=null,this._worldMatrix=r.y3.Identity(),this._worldMatrixDeterminant=0,this._worldMatrixDeterminantIsDirty=!0,this._sceneRootNodesIndex=-1,this._animationPropertiesOverride=null,this._isNode=!0,this.onDisposeObservable=new s.y$,this._onDisposeObserver=null,this._behaviors=new Array,this.name=e,this.id=e,this._scene=t||a.l.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._initCache()}return e.AddNodeConstructor=function(e,t){this._NodeConstructors[e]=t},e.Construct=function(e,t,i,n){var r=this._NodeConstructors[e];return r?r(t,i,n):null},Object.defineProperty(e.prototype,"doNotSerialize",{get:function(){return!!this._doNotSerialize||!!this._parentNode&&this._parentNode.doNotSerialize},set:function(e){this._doNotSerialize=e},enumerable:!1,configurable:!0}),e.prototype.isDisposed=function(){return this._isDisposed},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parentNode},set:function(e){if(this._parentNode!==e){var t=this._parentNode;if(this._parentNode&&void 0!==this._parentNode._children&&null!==this._parentNode._children){var i=this._parentNode._children.indexOf(this);-1!==i&&this._parentNode._children.splice(i,1),e||this._isDisposed||this._addToSceneRootNodes()}this._parentNode=e,this._parentNode&&(void 0!==this._parentNode._children&&null!==this._parentNode._children||(this._parentNode._children=new Array),this._parentNode._children.push(this),t||this._removeFromSceneRootNodes()),this._syncParentEnabledState()}},enumerable:!1,configurable:!0}),e.prototype._addToSceneRootNodes=function(){-1===this._sceneRootNodesIndex&&(this._sceneRootNodesIndex=this._scene.rootNodes.length,this._scene.rootNodes.push(this))},e.prototype._removeFromSceneRootNodes=function(){if(-1!==this._sceneRootNodesIndex){var e=this._scene.rootNodes,t=e.length-1;e[this._sceneRootNodesIndex]=e[t],e[this._sceneRootNodesIndex]._sceneRootNodesIndex=this._sceneRootNodesIndex,this._scene.rootNodes.pop(),this._sceneRootNodesIndex=-1}},Object.defineProperty(e.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"Node"},Object.defineProperty(e.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype.getEngine=function(){return this._scene.getEngine()},e.prototype.addBehavior=function(e,t){var i=this;return void 0===t&&(t=!1),-1!==this._behaviors.indexOf(e)||(e.init(),this._scene.isLoading&&!t?this._scene.onDataLoadedObservable.addOnce((function(){e.attach(i)})):e.attach(this),this._behaviors.push(e)),this},e.prototype.removeBehavior=function(e){var t=this._behaviors.indexOf(e);return-1===t||(this._behaviors[t].detach(),this._behaviors.splice(t,1)),this},Object.defineProperty(e.prototype,"behaviors",{get:function(){return this._behaviors},enumerable:!1,configurable:!0}),e.prototype.getBehaviorByName=function(e){for(var t=0,i=this._behaviors;t{"use strict";i.r(t),i.d(t,{Scene:()=>B});var n=i(655),r=i(5540),o=i(5273),s=i(475),a=i(6936),l=function(){function e(){this._count=0,this._data={}}return e.prototype.copyFrom=function(e){var t=this;this.clear(),e.forEach((function(e,i){return t.add(e,i)}))},e.prototype.get=function(e){var t=this._data[e];if(void 0!==t)return t},e.prototype.getOrAddWithFactory=function(e,t){var i=this.get(e);return void 0!==i||(i=t(e))&&this.add(e,i),i},e.prototype.getOrAdd=function(e,t){var i=this.get(e);return void 0!==i?i:(this.add(e,t),t)},e.prototype.contains=function(e){return void 0!==this._data[e]},e.prototype.add=function(e,t){return void 0===this._data[e]&&(this._data[e]=t,++this._count,!0)},e.prototype.set=function(e,t){return void 0!==this._data[e]&&(this._data[e]=t,!0)},e.prototype.getAndRemove=function(e){var t=this.get(e);return void 0!==t?(delete this._data[e],--this._count,t):null},e.prototype.remove=function(e){return!!this.contains(e)&&(delete this._data[e],--this._count,!0)},e.prototype.clear=function(){this._data={},this._count=0},Object.defineProperty(e.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),e.prototype.forEach=function(e){for(var t in this._data){e(t,this._data[t])}},e.prototype.first=function(e){for(var t in this._data){var i=e(t,this._data[t]);if(i)return i}return null},e}(),h=i(4115),c=i(2973),u=i(5511),f=i(5385),d=i(7659),p=i(2611),_=i(2659),g=i(356),m=i(5697),v=i(9626),y=function(){function e(e,t,i,n,r,o){this.source=e,this.pointerX=t,this.pointerY=i,this.meshUnderPointer=n,this.sourceEvent=r,this.additionalData=o}return e.CreateNew=function(t,i,n){var r=t.getScene();return new e(t,r.pointerX,r.pointerY,r.meshUnderPointer||t,i,n)},e.CreateNewFromSprite=function(t,i,n,r){return new e(t,i.pointerX,i.pointerY,i.meshUnderPointer,n,r)},e.CreateNewFromScene=function(t,i){return new e(null,t.pointerX,t.pointerY,t.meshUnderPointer,i)},e.CreateNewFromPrimitive=function(t,i,n,r){return new e(t,i.x,i.y,null,n,r)},e}(),b=i(4761),T=i(7555),A=i(7383),E=i(6327),C=i(3734),x=i(2733),S=i(106),R=i(5441),M=function(){function e(){this.hoverCursor="",this.actions=new Array,this.isRecursive=!1}return Object.defineProperty(e,"HasTriggers",{get:function(){for(var t in e.Triggers)if(e.Triggers.hasOwnProperty(t))return!0;return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e,"HasPickTriggers",{get:function(){for(var t in e.Triggers)if(e.Triggers.hasOwnProperty(t)){var i=parseInt(t);if(i>=1&&i<=7)return!0}return!1},enumerable:!1,configurable:!0}),e.HasSpecificTrigger=function(t){for(var i in e.Triggers){if(e.Triggers.hasOwnProperty(i))if(parseInt(i)===t)return!0}return!1},e.Triggers={},e}(),P=i(3997),I=function(){function e(){this._singleClick=!1,this._doubleClick=!1,this._hasSwiped=!1,this._ignore=!1}return Object.defineProperty(e.prototype,"singleClick",{get:function(){return this._singleClick},set:function(e){this._singleClick=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"doubleClick",{get:function(){return this._doubleClick},set:function(e){this._doubleClick=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasSwiped",{get:function(){return this._hasSwiped},set:function(e){this._hasSwiped=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ignore",{get:function(){return this._ignore},set:function(e){this._ignore=e},enumerable:!1,configurable:!0}),e}(),O=function(){function e(e){this._alreadyAttached=!1,this._wheelEventName="",this._meshPickProceed=!1,this._currentPickResult=null,this._previousPickResult=null,this._totalPointersPressed=0,this._doubleClickOccured=!1,this._pointerX=0,this._pointerY=0,this._startingPointerPosition=new c.FM(0,0),this._previousStartingPointerPosition=new c.FM(0,0),this._startingPointerTime=0,this._previousStartingPointerTime=0,this._pointerCaptures={},this._meshUnderPointerId=[],this._keyboardIsAttached=!1,this._scene=e}return Object.defineProperty(e.prototype,"meshUnderPointer",{get:function(){return this._pointerOverMesh},enumerable:!1,configurable:!0}),e.prototype.getMeshUnderPointerByPointerId=function(e){return this._meshUnderPointerId[e]},Object.defineProperty(e.prototype,"unTranslatedPointer",{get:function(){return new c.FM(this._unTranslatedPointerX,this._unTranslatedPointerY)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pointerX",{get:function(){return this._pointerX},set:function(e){this._pointerX=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pointerY",{get:function(){return this._pointerY},set:function(e){this._pointerY=e},enumerable:!1,configurable:!0}),e.prototype._updatePointerPosition=function(e){var t=this._scene.getEngine().getInputElementClientRect();t&&(this._pointerX=e.clientX-t.left,this._pointerY=e.clientY-t.top,this._unTranslatedPointerX=this._pointerX,this._unTranslatedPointerY=this._pointerY)},e.prototype._processPointerMove=function(e,t){var i=this._scene,n=i.getEngine(),r=n.getInputElement();if(r){r.tabIndex=n.canvasTabIndex,i.doNotHandleCursors||(r.style.cursor=i.defaultCursor);var o=!!(e&&e.hit&&e.pickedMesh);o?(i.setPointerOverMesh(e.pickedMesh,t.pointerId),this._pointerOverMesh&&this._pointerOverMesh.actionManager&&this._pointerOverMesh.actionManager.hasPointerTriggers&&(i.doNotHandleCursors||(this._pointerOverMesh.actionManager.hoverCursor?r.style.cursor=this._pointerOverMesh.actionManager.hoverCursor:r.style.cursor=i.hoverCursor))):i.setPointerOverMesh(null,t.pointerId);for(var s=0,a=i._pointerMoveStage;se.LongPressDelay&&!n._isPointerSwiping()&&(n._startingPointerTime=0,o.processTrigger(8,y.CreateNew(t.pickedMesh,i)))}),e.LongPressDelay)}}else for(var s=0,a=r._pointerDownStage;se.DragMovementThreshold||Math.abs(this._startingPointerPosition.y-this._pointerY)>e.DragMovementThreshold},e.prototype.simulatePointerUp=function(e,t,i){var n=new PointerEvent("pointerup",t),r=new I;i?r.doubleClick=!0:r.singleClick=!0,this._checkPrePointerObservable(e,n,R.kD.POINTERUP)||this._processPointerUp(e,n,r)},e.prototype._processPointerUp=function(e,t,i){var n=this._scene;if(e&&e&&e.pickedMesh){if(this._pickedUpMesh=e.pickedMesh,this._pickedDownMesh===this._pickedUpMesh&&(n.onPointerPick&&n.onPointerPick(t,e),i.singleClick&&!i.ignore&&n.onPointerObservable.hasObservers())){var r=R.kD.POINTERPICK,o=new R.R5(r,t,e);this._setRayOnPointerInfo(o),n.onPointerObservable.notifyObservers(o,r)}var s=e.pickedMesh._getActionManagerForTrigger();if(s&&!i.ignore){s.processTrigger(7,y.CreateNew(e.pickedMesh,t)),!i.hasSwiped&&i.singleClick&&s.processTrigger(1,y.CreateNew(e.pickedMesh,t));var a=e.pickedMesh._getActionManagerForTrigger(6);i.doubleClick&&a&&a.processTrigger(6,y.CreateNew(e.pickedMesh,t))}}else if(!i.ignore)for(var l=0,h=n._pointerUpStage;le.DoubleClickDelay&&!s._doubleClickOccured||t!==s._previousButtonPressed)&&(s._doubleClickOccured=!1,i.singleClick=!0,i.ignore=!1,n(i,s._currentPickResult))},this._initClickEvent=function(t,i,n,r){var o=new I;s._currentPickResult=null;var a=null,l=t.hasSpecificMask(R.kD.POINTERPICK)||i.hasSpecificMask(R.kD.POINTERPICK)||t.hasSpecificMask(R.kD.POINTERTAP)||i.hasSpecificMask(R.kD.POINTERTAP)||t.hasSpecificMask(R.kD.POINTERDOUBLETAP)||i.hasSpecificMask(R.kD.POINTERDOUBLETAP);!l&&M&&(a=s._initActionManager(a,o))&&(l=a.hasPickTriggers);var h=!1;if(l){var c=n.button;if(o.hasSwiped=s._isPointerSwiping(),!o.hasSwiped){var u=!e.ExclusiveDoubleClickMode;u||(u=!t.hasSpecificMask(R.kD.POINTERDOUBLETAP)&&!i.hasSpecificMask(R.kD.POINTERDOUBLETAP))&&!M.HasSpecificTrigger(6)&&(a=s._initActionManager(a,o))&&(u=!a.hasSpecificTrigger(6)),u?(Date.now()-s._previousStartingPointerTime>e.DoubleClickDelay||c!==s._previousButtonPressed)&&(o.singleClick=!0,r(o,s._currentPickResult),h=!0):(s._previousDelayedSimpleClickTimeout=s._delayedSimpleClickTimeout,s._delayedSimpleClickTimeout=window.setTimeout(s._delayedSimpleClick.bind(s,c,o,r),e.DoubleClickDelay));var f=t.hasSpecificMask(R.kD.POINTERDOUBLETAP)||i.hasSpecificMask(R.kD.POINTERDOUBLETAP);!f&&M.HasSpecificTrigger(6)&&(a=s._initActionManager(a,o))&&(f=a.hasSpecificTrigger(6)),f&&(c===s._previousButtonPressed&&Date.now()-s._previousStartingPointerTime0){for(var e=0,t=this._transientComponents;e0)return!1;for(e=0;e0,r=0,o=this._isReadyForMeshStage;r0)for(var s=0,a=this.activeCameras;s0},enumerable:!1,configurable:!0}),t.prototype.executeWhenReady=function(e){var t=this;this.onReadyObservable.add(e),-1===this._executeWhenReadyTimeoutId&&(this._executeWhenReadyTimeoutId=setTimeout((function(){t._checkIsReady()}),150))},t.prototype.whenReadyAsync=function(){var e=this;return new Promise((function(t){e.executeWhenReady((function(){t()}))}))},t.prototype._checkIsReady=function(){var e=this;return this._registerTransientComponents(),this.isReady()?(this.onReadyObservable.notifyObservers(this),this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=-1)):this._isDisposed?(this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=-1)):void(this._executeWhenReadyTimeoutId=setTimeout((function(){e._checkIsReady()}),150))},Object.defineProperty(t.prototype,"animatables",{get:function(){return this._activeAnimatables},enumerable:!1,configurable:!0}),t.prototype.resetLastAnimationTimeFrame=function(){this._animationTimeLast=o.F.Now},t.prototype.getViewMatrix=function(){return this._viewMatrix},t.prototype.getProjectionMatrix=function(){return this._projectionMatrix},t.prototype.getTransformMatrix=function(){return this._transformMatrix},t.prototype.setTransformMatrix=function(e,t,i,n){this._viewUpdateFlag===e.updateFlag&&this._projectionUpdateFlag===t.updateFlag||(this._viewUpdateFlag=e.updateFlag,this._projectionUpdateFlag=t.updateFlag,this._viewMatrix=e,this._projectionMatrix=t,this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._frustumPlanes?w.i.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=w.i.GetPlanes(this._transformMatrix),this._multiviewSceneUbo&&this._multiviewSceneUbo.useUbo?this._updateMultiviewUbo(i,n):this._sceneUbo.useUbo&&(this._sceneUbo.updateMatrix("viewProjection",this._transformMatrix),this._sceneUbo.updateMatrix("view",this._viewMatrix),this._sceneUbo.update()))},t.prototype.getSceneUniformBuffer=function(){return this._multiviewSceneUbo?this._multiviewSceneUbo:this._sceneUbo},t.prototype.getUniqueId=function(){return N.UniqueId},t.prototype.addMesh=function(e,t){var i=this;void 0===t&&(t=!1),this._blockEntityCollection||(this.meshes.push(e),e._resyncLightSources(),e.parent||e._addToSceneRootNodes(),this.onNewMeshAddedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach((function(e){i.addMesh(e)})))},t.prototype.removeMesh=function(e,t){var i=this;void 0===t&&(t=!1);var n=this.meshes.indexOf(e);return-1!==n&&(this.meshes[n]=this.meshes[this.meshes.length-1],this.meshes.pop(),e.parent||e._removeFromSceneRootNodes()),this.onMeshRemovedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach((function(e){i.removeMesh(e)})),n},t.prototype.addTransformNode=function(e){this._blockEntityCollection||(e._indexInSceneTransformNodesArray=this.transformNodes.length,this.transformNodes.push(e),e.parent||e._addToSceneRootNodes(),this.onNewTransformNodeAddedObservable.notifyObservers(e))},t.prototype.removeTransformNode=function(e){var t=e._indexInSceneTransformNodesArray;if(-1!==t){if(t!==this.transformNodes.length-1){var i=this.transformNodes[this.transformNodes.length-1];this.transformNodes[t]=i,i._indexInSceneTransformNodesArray=t}e._indexInSceneTransformNodesArray=-1,this.transformNodes.pop(),e.parent||e._removeFromSceneRootNodes()}return this.onTransformNodeRemovedObservable.notifyObservers(e),t},t.prototype.removeSkeleton=function(e){var t=this.skeletons.indexOf(e);return-1!==t&&(this.skeletons.splice(t,1),this.onSkeletonRemovedObservable.notifyObservers(e)),t},t.prototype.removeMorphTargetManager=function(e){var t=this.morphTargetManagers.indexOf(e);return-1!==t&&this.morphTargetManagers.splice(t,1),t},t.prototype.removeLight=function(e){var t=this.lights.indexOf(e);if(-1!==t){for(var i=0,n=this.meshes;i0?this.activeCamera=this.cameras[0]:this.activeCamera=null),this.onCameraRemovedObservable.notifyObservers(e),t},t.prototype.removeParticleSystem=function(e){var t=this.particleSystems.indexOf(e);return-1!==t&&this.particleSystems.splice(t,1),t},t.prototype.removeAnimation=function(e){var t=this.animations.indexOf(e);return-1!==t&&this.animations.splice(t,1),t},t.prototype.stopAnimation=function(e,t,i){},t.prototype.removeAnimationGroup=function(e){var t=this.animationGroups.indexOf(e);return-1!==t&&this.animationGroups.splice(t,1),t},t.prototype.removeMultiMaterial=function(e){var t=this.multiMaterials.indexOf(e);return-1!==t&&this.multiMaterials.splice(t,1),this.onMultiMaterialRemovedObservable.notifyObservers(e),t},t.prototype.removeMaterial=function(e){var t=e._indexInSceneMaterialArray;if(-1!==t&&t=0;t--)if(this.materials[t].id===e)return this.materials[t];return null},t.prototype.getMaterialByName=function(e){for(var t=0;t=0;t--)if(this.meshes[t].id===e)return this.meshes[t];return null},t.prototype.getLastEntryByID=function(e){var t;for(t=this.meshes.length-1;t>=0;t--)if(this.meshes[t].id===e)return this.meshes[t];for(t=this.transformNodes.length-1;t>=0;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];for(t=this.cameras.length-1;t>=0;t--)if(this.cameras[t].id===e)return this.cameras[t];for(t=this.lights.length-1;t>=0;t--)if(this.lights[t].id===e)return this.lights[t];return null},t.prototype.getNodeByID=function(e){var t=this.getMeshByID(e);if(t)return t;var i=this.getTransformNodeByID(e);if(i)return i;var n=this.getLightByID(e);if(n)return n;var r=this.getCameraByID(e);if(r)return r;var o=this.getBoneByID(e);return o||null},t.prototype.getNodeByName=function(e){var t=this.getMeshByName(e);if(t)return t;var i=this.getTransformNodeByName(e);if(i)return i;var n=this.getLightByName(e);if(n)return n;var r=this.getCameraByName(e);if(r)return r;var o=this.getBoneByName(e);return o||null},t.prototype.getMeshByName=function(e){for(var t=0;t=0;t--)if(this.skeletons[t].id===e)return this.skeletons[t];return null},t.prototype.getSkeletonByUniqueId=function(e){for(var t=0;t0&&0!=(a.layerMask&this.activeCamera.layerMask)&&(this._skipFrustumClipping||a.alwaysSelectAsActiveMesh||a.isInFrustum(this._frustumPlanes)))){this._activeMeshes.push(a),this.activeCamera._activeMeshes.push(a),l!==a&&l._activate(this._renderId,!1);for(var h=0,c=this._preActiveMeshStage;h0)for(var i=this.getActiveSubMeshCandidates(t),n=i.length,r=0;r1)this.activeCamera.outputRenderTarget._bindFrameBuffer();else{var e=this.activeCamera.outputRenderTarget.getInternalTexture();e?this.getEngine().bindFramebuffer(e):C.Y.Error("Camera contains invalid customDefaultRenderTarget")}}else this.getEngine().restoreDefaultFramebuffer()},t.prototype._renderForCamera=function(e,t){if(!e||!e._skipRendering){var i=this._engine;if(this._activeCamera=e,!this.activeCamera)throw new Error("Active camera not set");i.setViewport(this.activeCamera.viewport),this.resetCachedMaterial(),this._renderId++,this.getEngine().getCaps().multiview&&e.outputRenderTarget&&e.outputRenderTarget.getViewCount()>1?this.setTransformMatrix(e._rigCameras[0].getViewMatrix(),e._rigCameras[0].getProjectionMatrix(),e._rigCameras[1].getViewMatrix(),e._rigCameras[1].getProjectionMatrix()):this.updateTransformMatrix(),this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera),this._evaluateActiveMeshes();for(var n=0;n0&&this._renderTargets.concatWithNoDuplicate(e.customRenderTargets),t&&t.customRenderTargets&&t.customRenderTargets.length>0&&this._renderTargets.concatWithNoDuplicate(t.customRenderTargets);for(var s=0,a=this._gatherActiveCameraRenderTargetsStage;s0){r.w1.StartPerformanceCounter("Render targets",this._renderTargets.length>0);for(var h=0;h0),this._renderId++}for(var f=0,d=this._cameraDrawRenderTargetStage;f1&&this.getEngine().getCaps().multiview)return this._renderForCamera(e),void this.onAfterRenderCameraObservable.notifyObservers(e);if(e._useMultiviewToSingleView)this._renderMultiviewToSingleView(e);else for(var t=0;t-1&&(13===n.trigger&&n._executeCurrent(y.CreateNew(t,void 0,o)),t.actionManager.hasSpecificTrigger(13,(function(e){var t=e instanceof f.x?e:e.mesh;return o===t}))&&13!==n.trigger||t._intersectionsInProgress.splice(a,1))}}}},t.prototype._advancePhysicsEngineStep=function(e){},t.prototype._animate=function(){},t.prototype.animate=function(){if(this._engine.isDeterministicLockStep()){var e=Math.max(t.MinDeltaTime,Math.min(this._engine.getDeltaTime(),t.MaxDeltaTime))+this._timeAccumulator,i=this._engine.getTimeStep(),n=1e3/i/1e3,r=0,o=this._engine.getLockstepMaxSteps(),s=Math.floor(e/i);for(s=Math.min(s,o);e>0&&r0)for(var o=0;o0),this._intermediateRendering=!0;for(var c=0;c0),this._intermediateRendering=!1,this._renderId++}this.activeCamera=h,this._activeCamera&&this._activeCamera.cameraRigMode!==d.V.RIG_MODE_CUSTOM&&!this.prePass&&this._bindFrameBuffer(),this.onAfterRenderTargetsRenderObservable.notifyObservers(this);for(var f=0,p=this._beforeClearStage;f0)for(o=0;o0&&this._engine.clear(null,!1,!0,!0),this._processSubCameras(this.activeCameras[o]);else{if(!this.activeCamera)throw new Error("No camera defined");this._processSubCameras(this.activeCamera)}this._checkIntersections();for(var m=0,v=this._afterRenderStage;m-1&&this._engine.scenes.splice(r,1),this._engine.wipeCaches(!0),this._isDisposed=!0},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!1,configurable:!0}),t.prototype.clearCachedVertexData=function(){for(var e=0;e{"use strict";i.d(t,{l:()=>r,H:()=>o});var n=i(655),r=function(){function e(){}return e.NAME_EFFECTLAYER="EffectLayer",e.NAME_LAYER="Layer",e.NAME_LENSFLARESYSTEM="LensFlareSystem",e.NAME_BOUNDINGBOXRENDERER="BoundingBoxRenderer",e.NAME_PARTICLESYSTEM="ParticleSystem",e.NAME_GAMEPAD="Gamepad",e.NAME_SIMPLIFICATIONQUEUE="SimplificationQueue",e.NAME_GEOMETRYBUFFERRENDERER="GeometryBufferRenderer",e.NAME_PREPASSRENDERER="PrePassRenderer",e.NAME_DEPTHRENDERER="DepthRenderer",e.NAME_POSTPROCESSRENDERPIPELINEMANAGER="PostProcessRenderPipelineManager",e.NAME_SPRITE="Sprite",e.NAME_SUBSURFACE="SubSurface",e.NAME_OUTLINERENDERER="Outline",e.NAME_PROCEDURALTEXTURE="ProceduralTexture",e.NAME_SHADOWGENERATOR="ShadowGenerator",e.NAME_OCTREE="Octree",e.NAME_PHYSICSENGINE="PhysicsEngine",e.NAME_AUDIO="Audio",e.STEP_ISREADYFORMESH_EFFECTLAYER=0,e.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER=0,e.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER=0,e.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER=0,e.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER=1,e.STEP_BEFORECAMERADRAW_EFFECTLAYER=0,e.STEP_BEFORECAMERADRAW_LAYER=1,e.STEP_BEFORECAMERADRAW_PREPASS=2,e.STEP_BEFORERENDERTARGETDRAW_LAYER=0,e.STEP_BEFORERENDERINGMESH_PREPASS=0,e.STEP_BEFORERENDERINGMESH_OUTLINE=1,e.STEP_AFTERRENDERINGMESH_PREPASS=0,e.STEP_AFTERRENDERINGMESH_OUTLINE=1,e.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW=0,e.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER=1,e.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE=0,e.STEP_BEFORECAMERAUPDATE_GAMEPAD=1,e.STEP_BEFORECLEAR_PROCEDURALTEXTURE=0,e.STEP_AFTERRENDERTARGETDRAW_LAYER=0,e.STEP_AFTERCAMERADRAW_EFFECTLAYER=0,e.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM=1,e.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW=2,e.STEP_AFTERCAMERADRAW_LAYER=3,e.STEP_AFTERCAMERADRAW_PREPASS=4,e.STEP_AFTERRENDER_AUDIO=0,e.STEP_GATHERRENDERTARGETS_DEPTHRENDERER=0,e.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER=1,e.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR=2,e.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER=3,e.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER=0,e.STEP_BEFORECLEARSTAGE_PREPASS=0,e.STEP_POINTERMOVE_SPRITE=0,e.STEP_POINTERDOWN_SPRITE=0,e.STEP_POINTERUP_SPRITE=0,e}(),o=function(e){function t(t){return e.apply(this,t)||this}return(0,n.ZT)(t,e),t.Create=function(){return Object.create(t.prototype)},t.prototype.registerStep=function(e,t,i){var n=0;for(Number.MAX_VALUE;n{"use strict";i.r(t),i.d(t,{AdvancedDynamicTexture:()=>P});var n=i(655),r=i(475),o=i(2973),s=i(5540),a=i(5441),l=i(96),h=i(3997),c=i(5328),u=i(4283),f=i(5016),d=i(8362),p=i(2733),_=i(6738),g=i(511),m=i(7383),v=function(){function e(e){this.name=m.l.NAME_LAYER,this.scene=e,this._engine=e.getEngine(),e.layers=new Array}return e.prototype.register=function(){this.scene._beforeCameraDrawStage.registerStep(m.l.STEP_BEFORECAMERADRAW_LAYER,this,this._drawCameraBackground),this.scene._afterCameraDrawStage.registerStep(m.l.STEP_AFTERCAMERADRAW_LAYER,this,this._drawCameraForeground),this.scene._beforeRenderTargetDrawStage.registerStep(m.l.STEP_BEFORERENDERTARGETDRAW_LAYER,this,this._drawRenderTargetBackground),this.scene._afterRenderTargetDrawStage.registerStep(m.l.STEP_AFTERRENDERTARGETDRAW_LAYER,this,this._drawRenderTargetForeground)},e.prototype.rebuild=function(){for(var e=0,t=this.scene.layers;e0&&e.isBackground===t&&e.renderTargetTextures.indexOf(n)>-1&&0!=(e.layerMask&i)},e.prototype._drawRenderTargetBackground=function(e){var t=this;this._draw((function(i){return t._drawRenderTargetPredicate(i,!0,t.scene.activeCamera.layerMask,e)}))},e.prototype._drawRenderTargetForeground=function(e){var t=this;this._draw((function(i){return t._drawRenderTargetPredicate(i,!1,t.scene.activeCamera.layerMask,e)}))},e.prototype.addFromContainer=function(e){var t=this;e.layers&&e.layers.forEach((function(e){t.scene.layers.push(e)}))},e.prototype.removeFromContainer=function(e,t){var i=this;void 0===t&&(t=!1),e.layers&&e.layers.forEach((function(e){var n=i.scene.layers.indexOf(e);-1!==n&&i.scene.layers.splice(n,1),t&&e.dispose()}))},e}(),y=i(7947),b=(i(8662),"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\n\n#include\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef LINEAR\nbaseColor.rgb=toGammaSpace(baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=baseColor*color;\n}");y.Q.ShadersStore.layerPixelShader=b;var T="\nattribute vec2 position;\n\nuniform vec2 scale;\nuniform vec2 offset;\nuniform mat4 textureMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvec2 shiftedPosition=position*scale+offset;\nvUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));\ngl_Position=vec4(shiftedPosition,0.0,1.0);\n}";y.Q.ShadersStore.layerVertexShader=T;var A=function(){function e(e,t,i,n,s){this.name=e,this.scale=new o.FM(1,1),this.offset=new o.FM(0,0),this.alphaBlendingMode=2,this.layerMask=268435455,this.renderTargetTextures=[],this.renderOnlyInRenderTargetTextures=!1,this._vertexBuffers={},this.onDisposeObservable=new r.y$,this.onBeforeRenderObservable=new r.y$,this.onAfterRenderObservable=new r.y$,this.texture=t?new u.x(t,i,!0):null,this.isBackground=void 0===n||n,this.color=void 0===s?new d.HE(1,1,1,1):s,this._scene=i||p.l.LastCreatedScene;var a=this._scene._getComponent(m.l.NAME_LAYER);a||(a=new v(this._scene),this._scene._addComponent(a)),this._scene.layers.push(this);var l=this._scene.getEngine(),h=[];h.push(1,1),h.push(-1,1),h.push(-1,-1),h.push(1,-1);var c=new _.o(l,h,_.o.PositionKind,!1,!1,2);this._vertexBuffers[_.o.PositionKind]=c,this._createIndexBuffer()}return Object.defineProperty(e.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!1,configurable:!0}),e.prototype._createIndexBuffer=function(){var e=this._scene.getEngine(),t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)},e.prototype._rebuild=function(){var e=this._vertexBuffers[_.o.PositionKind];e&&e._rebuild(),this._createIndexBuffer()},e.prototype.render=function(){var e=this._scene.getEngine(),t="";this.alphaTest&&(t="#define ALPHATEST"),this.texture&&!this.texture.gammaSpace&&(t+="\r\n#define LINEAR"),this._previousDefines!==t&&(this._previousDefines=t,this._effect=e.createEffect("layer",[_.o.PositionKind],["textureMatrix","color","scale","offset"],["textureSampler"],t));var i=this._effect;if(i&&i.isReady()&&this.texture&&this.texture.isReady()){e=this._scene.getEngine();this.onBeforeRenderObservable.notifyObservers(this),e.enableEffect(i),e.setState(!1),i.setTexture("textureSampler",this.texture),i.setMatrix("textureMatrix",this.texture.getTextureMatrix()),i.setFloat4("color",this.color.r,this.color.g,this.color.b,this.color.a),i.setVector2("offset",this.offset),i.setVector2("scale",this.scale),e.bindBuffers(this._vertexBuffers,this._indexBuffer,i),this.alphaTest?e.drawElementsType(g.F.TriangleFillMode,0,6):(e.setAlphaMode(this.alphaBlendingMode),e.drawElementsType(g.F.TriangleFillMode,0,6),e.setAlphaMode(0)),this.onAfterRenderObservable.notifyObservers(this)}},e.prototype.dispose=function(){var e=this._vertexBuffers[_.o.PositionKind];e&&(e.dispose(),this._vertexBuffers[_.o.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this.texture&&(this.texture.dispose(),this.texture=null),this.renderTargetTextures=[];var t=this._scene.layers.indexOf(this);this._scene.layers.splice(t,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderObservable.clear()},e}(),E=i(6397),C=i(4872),x=function(){function e(e){this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new C.s(18,C.s.UNITMODE_PIXEL,!1),this.onChangedObservable=new r.y$,this._host=e}return Object.defineProperty(e.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(e){this._fontSize.toString(this._host)!==e&&this._fontSize.fromString(e)&&this.onChangedObservable.notifyObservers(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(e){this._fontFamily!==e&&(this._fontFamily=e,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(e){this._fontStyle!==e&&(this._fontStyle=e,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(e){this._fontWeight!==e&&(this._fontWeight=e,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this.onChangedObservable.clear()},e}(),S=i(5958),R=i(3393),M=i(4272),P=function(e){function t(t,i,n,o,s,a,c){void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=!1),void 0===a&&(a=u.x.NEAREST_SAMPLINGMODE);var f=e.call(this,t,{width:i,height:n},o,s,a,R.g.TEXTUREFORMAT_RGBA,c)||this;return f._isDirty=!1,f._rootContainer=new E.W("root"),f._lastControlOver={},f._lastControlDown={},f._capturingControl={},f._linkedControls=new Array,f._isFullscreen=!1,f._fullscreenViewport=new M.l(0,0,1,1),f._idealWidth=0,f._idealHeight=0,f._useSmallestIdeal=!1,f._renderAtIdealSize=!1,f._blockNextFocusCheck=!1,f._renderScale=1,f._cursorChanged=!1,f._defaultMousePointerId=0,f._numLayoutCalls=0,f._numRenderCalls=0,f._clipboardData="",f.onClipboardObservable=new r.y$,f.onControlPickedObservable=new r.y$,f.onBeginLayoutObservable=new r.y$,f.onEndLayoutObservable=new r.y$,f.onBeginRenderObservable=new r.y$,f.onEndRenderObservable=new r.y$,f.premulAlpha=!1,f.applyYInversionOnUpdate=!0,f._useInvalidateRectOptimization=!0,f._invalidatedRectangle=null,f._clearMeasure=new S.U(0,0,0,0),f.onClipboardCopy=function(e){var t=e,i=new l.o(l.p.COPY,t);f.onClipboardObservable.notifyObservers(i),t.preventDefault()},f.onClipboardCut=function(e){var t=e,i=new l.o(l.p.CUT,t);f.onClipboardObservable.notifyObservers(i),t.preventDefault()},f.onClipboardPaste=function(e){var t=e,i=new l.o(l.p.PASTE,t);f.onClipboardObservable.notifyObservers(i),t.preventDefault()},(o=f.getScene())&&f._texture?(f._rootElement=o.getEngine().getInputElement(),f._renderObserver=o.onBeforeCameraRenderObservable.add((function(e){return f._checkUpdate(e)})),f._preKeyboardObserver=o.onPreKeyboardObservable.add((function(e){f._focusedControl&&(e.type===h.OG.KEYDOWN&&f._focusedControl.processKeyboard(e.event),e.skipOnPointerObservable=!0)})),f._rootContainer._link(f),f.hasAlpha=!0,i&&n||(f._resizeObserver=o.getEngine().onResizeObservable.add((function(){return f._onResize()})),f._onResize()),f._texture.isReady=!0,f):f}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"numLayoutCalls",{get:function(){return this._numLayoutCalls},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numRenderCalls",{get:function(){return this._numRenderCalls},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderScale",{get:function(){return this._renderScale},set:function(e){e!==this._renderScale&&(this._renderScale=e,this._onResize())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this.markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"idealWidth",{get:function(){return this._idealWidth},set:function(e){this._idealWidth!==e&&(this._idealWidth=e,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"idealHeight",{get:function(){return this._idealHeight},set:function(e){this._idealHeight!==e&&(this._idealHeight=e,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useSmallestIdeal",{get:function(){return this._useSmallestIdeal},set:function(e){this._useSmallestIdeal!==e&&(this._useSmallestIdeal=e,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderAtIdealSize",{get:function(){return this._renderAtIdealSize},set:function(e){this._renderAtIdealSize!==e&&(this._renderAtIdealSize=e,this._onResize())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"idealRatio",{get:function(){var e=0,t=0;return this._idealWidth&&(e=this.getSize().width/this._idealWidth),this._idealHeight&&(t=this.getSize().height/this._idealHeight),this._useSmallestIdeal&&this._idealWidth&&this._idealHeight?window.innerWidth1)return e.notRenderable=!0,"continue";e.notRenderable=!1,l.scaleInPlace(r.renderScale),e._moveToProjectedPosition(l)},r=this,a=0,l=this._linkedControls;a{"use strict";i.d(t,{W:()=>l});var n=i(655),r=i(3734),o=i(2040),s=i(5958),a=i(6132),l=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._children=new Array,i._measureForChildren=s.U.Empty(),i._background="",i._adaptWidthToChildren=!1,i._adaptHeightToChildren=!1,i.logLayoutCycleErrors=!1,i.maxLayoutCycle=3,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"adaptHeightToChildren",{get:function(){return this._adaptHeightToChildren},set:function(e){this._adaptHeightToChildren!==e&&(this._adaptHeightToChildren=e,e&&(this.height="100%"),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"adaptWidthToChildren",{get:function(){return this._adaptWidthToChildren},set:function(e){this._adaptWidthToChildren!==e&&(this._adaptWidthToChildren=e,e&&(this.width="100%"),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"Container"},t.prototype._flagDescendantsAsMatrixDirty=function(){for(var e=0,t=this.children;ee.zIndex){this._children.splice(i,0,e),t=!0;break}t||this._children.push(e),e.parent=this,this._markAsDirty()},t.prototype._offsetLeft=function(t){e.prototype._offsetLeft.call(this,t);for(var i=0,n=this._children;i=0&&(n+=this.paddingLeftInPixels+this.paddingRightInPixels,this.width!==n+"px"&&(this.width=n+"px",this._rebuildLayout=!0)),this.adaptHeightToChildren&&o>=0&&(o+=this.paddingTopInPixels+this.paddingBottomInPixels,this.height!==o+"px"&&(this.height=o+"px",this._rebuildLayout=!0)),this._postMeasure()}i++}while(this._rebuildLayout&&i=3&&this.logLayoutCycleErrors&&r.Y.Error("Layout cycle detected in GUI (Container name="+this.name+", uniqueId="+this.uniqueId+")"),t.restore(),this._isDirty&&(this.invalidateRect(),this._isDirty=!1),!0},t.prototype._postMeasure=function(){},t.prototype._draw=function(e,t){this._localDraw(e),this.clipChildren&&this._clipForChildren(e);for(var i=0,n=this._children;i=0;h--){var c=this._children[h];if(c._processPicking(t,i,n,r,o,s,a,l))return c.hoverCursor&&this._host._changeCursor(c.hoverCursor),!0}return!!this.isHitTestVisible&&this._processObservables(r,t,i,n,o,s,a,l)},t.prototype._additionalProcessing=function(t,i){e.prototype._additionalProcessing.call(this,t,i),this._measureForChildren.copyFrom(this._currentMeasure)},t.prototype.dispose=function(){e.prototype.dispose.call(this);for(var t=this.children.length-1;t>=0;t--)this.children[t].dispose()},t}(o.o);a.Q.RegisteredTypes["BABYLON.GUI.Container"]=l},2040:(e,t,i)=>{"use strict";i.d(t,{o:()=>_});var n=i(475),r=i(2973),o=i(5441),s=i(3734),a=i(5540),l=i(4872),h=i(5958),c=i(655),u=i(2782),f=function(e){function t(t,i){void 0===i&&(i=0);var n=e.call(this,t.x,t.y)||this;return n.buttonIndex=i,n}return(0,c.ZT)(t,e),t}(r.FM),d=function(){function e(e,t,i,n,r,o){this.m=new Float32Array(6),this.fromValues(e,t,i,n,r,o)}return e.prototype.fromValues=function(e,t,i,n,r,o){return this.m[0]=e,this.m[1]=t,this.m[2]=i,this.m[3]=n,this.m[4]=r,this.m[5]=o,this},e.prototype.determinant=function(){return this.m[0]*this.m[3]-this.m[1]*this.m[2]},e.prototype.invertToRef=function(e){var t=this.m[0],i=this.m[1],n=this.m[2],r=this.m[3],o=this.m[4],s=this.m[5],a=this.determinant();if(a1?this.notRenderable=!0:this.notRenderable=!1}else a.w1.Error("Cannot move a control to a vector3 if the control is not at root level")},e.prototype.getDescendantsToRef=function(e,t,i){void 0===t&&(t=!1)},e.prototype.getDescendants=function(e,t){var i=new Array;return this.getDescendantsToRef(i,e,t),i},e.prototype.linkWithMesh=function(t){if(!this._host||this.parent&&this.parent!==this._host._rootContainer)t&&a.w1.Error("Cannot link a control to a mesh if the control is not at root level");else{var i=this._host._linkedControls.indexOf(this);if(-1!==i)return this._linkedMesh=t,void(t||this._host._linkedControls.splice(i,1));t&&(this.horizontalAlignment=e.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=e.VERTICAL_ALIGNMENT_TOP,this._linkedMesh=t,this._host._linkedControls.push(this))}},e.prototype._moveToProjectedPosition=function(e){var t=this._left.getValue(this._host),i=this._top.getValue(this._host),n=e.x+this._linkOffsetX.getValue(this._host)-this._currentMeasure.width/2,r=e.y+this._linkOffsetY.getValue(this._host)-this._currentMeasure.height/2;this._left.ignoreAdaptiveScaling&&this._top.ignoreAdaptiveScaling&&(Math.abs(n-t)<.5&&(n=t),Math.abs(r-i)<.5&&(r=i)),this.left=n+"px",this.top=r+"px",this._left.ignoreAdaptiveScaling=!0,this._top.ignoreAdaptiveScaling=!0,this._markAsDirty()},e.prototype._offsetLeft=function(e){this._isDirty=!0,this._currentMeasure.left+=e},e.prototype._offsetTop=function(e){this._isDirty=!0,this._currentMeasure.top+=e},e.prototype._markMatrixAsDirty=function(){this._isMatrixDirty=!0,this._flagDescendantsAsMatrixDirty()},e.prototype._flagDescendantsAsMatrixDirty=function(){},e.prototype._intersectsRect=function(e){return this._currentMeasure.transformToRef(this._transformMatrix,this._tmpMeasureA),!(this._tmpMeasureA.left>=e.left+e.width)&&(!(this._tmpMeasureA.top>=e.top+e.height)&&(!(this._tmpMeasureA.left+this._tmpMeasureA.width<=e.left)&&!(this._tmpMeasureA.top+this._tmpMeasureA.height<=e.top)))},e.prototype.invalidateRect=function(){if(this._transform(),this.host&&this.host.useInvalidateRectOptimization)if(this._currentMeasure.transformToRef(this._transformMatrix,this._tmpMeasureA),h.U.CombineToRef(this._tmpMeasureA,this._prevCurrentMeasureTransformedIntoGlobalSpace,this._tmpMeasureA),this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY){var e=this.shadowOffsetX,t=this.shadowOffsetY,i=this.shadowBlur,n=Math.min(Math.min(e,0)-2*i,0),r=Math.max(Math.max(e,0)+2*i,0),o=Math.min(Math.min(t,0)-2*i,0),s=Math.max(Math.max(t,0)+2*i,0);this.host.invalidateRect(Math.floor(this._tmpMeasureA.left+n),Math.floor(this._tmpMeasureA.top+o),Math.ceil(this._tmpMeasureA.left+this._tmpMeasureA.width+r),Math.ceil(this._tmpMeasureA.top+this._tmpMeasureA.height+s))}else this.host.invalidateRect(Math.floor(this._tmpMeasureA.left),Math.floor(this._tmpMeasureA.top),Math.ceil(this._tmpMeasureA.left+this._tmpMeasureA.width),Math.ceil(this._tmpMeasureA.top+this._tmpMeasureA.height))},e.prototype._markAsDirty=function(e){void 0===e&&(e=!1),(this._isVisible||e)&&(this._isDirty=!0,this._host&&this._host.markAsDirty())},e.prototype._markAllAsDirty=function(){this._markAsDirty(),this._font&&this._prepareFont()},e.prototype._link=function(e){this._host=e,this._host&&(this.uniqueId=this._host.getScene().getUniqueId())},e.prototype._transform=function(e){if(this._isMatrixDirty||1!==this._scaleX||1!==this._scaleY||0!==this._rotation){var t=this._currentMeasure.width*this._transformCenterX+this._currentMeasure.left,i=this._currentMeasure.height*this._transformCenterY+this._currentMeasure.top;e&&(e.translate(t,i),e.rotate(this._rotation),e.scale(this._scaleX,this._scaleY),e.translate(-t,-i)),(this._isMatrixDirty||this._cachedOffsetX!==t||this._cachedOffsetY!==i)&&(this._cachedOffsetX=t,this._cachedOffsetY=i,this._isMatrixDirty=!1,this._flagDescendantsAsMatrixDirty(),d.ComposeToRef(-t,-i,this._rotation,this._scaleX,this._scaleY,this.parent?this.parent._transformMatrix:null,this._transformMatrix),this._transformMatrix.invertToRef(this._invertTransformMatrix))}},e.prototype._renderHighlight=function(e){this.isHighlighted&&(e.save(),e.strokeStyle="#4affff",e.lineWidth=2,this._renderHighlightSpecific(e),e.restore())},e.prototype._renderHighlightSpecific=function(e){e.strokeRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)},e.prototype._applyStates=function(t){this._isFontSizeInPercentage&&(this._fontSet=!0),this._fontSet&&(this._prepareFont(),this._fontSet=!1),this._font&&(t.font=this._font),this._color&&(t.fillStyle=this._color),e.AllowAlphaInheritance?t.globalAlpha*=this._alpha:this._alphaSet&&(t.globalAlpha=this.parent?this.parent.alpha*this._alpha:this._alpha)},e.prototype._layout=function(e,t){if(!this.isDirty&&(!this.isVisible||this.notRenderable))return!1;if(this._isDirty||!this._cachedParentMeasure.isEqualsTo(e)){this.host._numLayoutCalls++,this._currentMeasure.addAndTransformToRef(this._transformMatrix,0|-this.paddingLeftInPixels,0|-this.paddingTopInPixels,0|this.paddingRightInPixels,0|this.paddingBottomInPixels,this._prevCurrentMeasureTransformedIntoGlobalSpace),t.save(),this._applyStates(t);var i=0;do{this._rebuildLayout=!1,this._processMeasures(e,t),i++}while(this._rebuildLayout&&i<3);i>=3&&s.Y.Error("Layout cycle detected in GUI (Control name="+this.name+", uniqueId="+this.uniqueId+")"),t.restore(),this.invalidateRect(),this._evaluateClippingState(e)}return this._wasDirty=this._isDirty,this._isDirty=!1,!0},e.prototype._processMeasures=function(e,t){this._currentMeasure.copyFrom(e),this._preMeasure(e,t),this._measure(),this._computeAlignment(e,t),this._currentMeasure.left=0|this._currentMeasure.left,this._currentMeasure.top=0|this._currentMeasure.top,this._currentMeasure.width=0|this._currentMeasure.width,this._currentMeasure.height=0|this._currentMeasure.height,this._additionalProcessing(e,t),this._cachedParentMeasure.copyFrom(e),this.onDirtyObservable.hasObservers()&&this.onDirtyObservable.notifyObservers(this)},e.prototype._evaluateClippingState=function(e){if(this.parent&&this.parent.clipChildren){if(this._currentMeasure.left>e.left+e.width)return void(this._isClipped=!0);if(this._currentMeasure.left+this._currentMeasure.widthe.top+e.height)return void(this._isClipped=!0);if(this._currentMeasure.top+this._currentMeasure.heightthis._currentMeasure.left+this._currentMeasure.width)&&(!(tthis._currentMeasure.top+this._currentMeasure.height)&&(this.isPointerBlocker&&(this._host._shouldBlockPointer=!0),!0))))},e.prototype._processPicking=function(e,t,i,n,r,o,s,a){return!!this._isEnabled&&(!(!this.isHitTestVisible||!this.isVisible||this._doNotRender)&&(!!this.contains(e,t)&&(this._processObservables(n,e,t,i,r,o,s,a),!0)))},e.prototype._onPointerMove=function(e,t,i,n){this.onPointerMoveObservable.notifyObservers(t,-1,e,this,n)&&null!=this.parent&&this.parent._onPointerMove(e,t,i,n)},e.prototype._onPointerEnter=function(e,t){return!!this._isEnabled&&(!(this._enterCount>0)&&(-1===this._enterCount&&(this._enterCount=0),this._enterCount++,this.onPointerEnterObservable.notifyObservers(this,-1,e,this,t)&&null!=this.parent&&this.parent._onPointerEnter(e,t),!0))},e.prototype._onPointerOut=function(e,t,i){if(void 0===i&&(i=!1),i||this._isEnabled&&e!==this){this._enterCount=0;var n=!0;e.isAscendant(this)||(n=this.onPointerOutObservable.notifyObservers(this,-1,e,this,t)),n&&null!=this.parent&&this.parent._onPointerOut(e,t,i)}},e.prototype._onPointerDown=function(e,t,i,n,r){return this._onPointerEnter(this,r),0===this._downCount&&(this._downCount++,this._downPointerIds[i]=!0,this.onPointerDownObservable.notifyObservers(new f(t,n),-1,e,this,r)&&null!=this.parent&&this.parent._onPointerDown(e,t,i,n,r),!0)},e.prototype._onPointerUp=function(e,t,i,n,r,o){if(this._isEnabled){this._downCount=0,delete this._downPointerIds[i];var s=r;r&&(this._enterCount>0||-1===this._enterCount)&&(s=this.onPointerClickObservable.notifyObservers(new f(t,n),-1,e,this,o)),this.onPointerUpObservable.notifyObservers(new f(t,n),-1,e,this,o)&&null!=this.parent&&this.parent._onPointerUp(e,t,i,n,s,o)}},e.prototype._forcePointerUp=function(e){if(void 0===e&&(e=null),null!==e)this._onPointerUp(this,r.FM.Zero(),e,0,!0);else for(var t in this._downPointerIds)this._onPointerUp(this,r.FM.Zero(),+t,0,!0)},e.prototype._onWheelScroll=function(e,t){this._isEnabled&&(this.onWheelObservable.notifyObservers(new r.FM(e,t))&&null!=this.parent&&this.parent._onWheelScroll(e,t))},e.prototype._onCanvasBlur=function(){},e.prototype._processObservables=function(e,t,i,n,r,s,a,l){if(!this._isEnabled)return!1;if(this._dummyVector2.copyFromFloats(t,i),e===o.kD.POINTERMOVE){this._onPointerMove(this,this._dummyVector2,r,n);var h=this._host._lastControlOver[r];return h&&h!==this&&h._onPointerOut(this,n),h!==this&&this._onPointerEnter(this,n),this._host._lastControlOver[r]=this,!0}return e===o.kD.POINTERDOWN?(this._onPointerDown(this,this._dummyVector2,r,s,n),this._host._registerLastControlDown(this,r),this._host._lastPickedControl=this,!0):e===o.kD.POINTERUP?(this._host._lastControlDown[r]&&this._host._lastControlDown[r]._onPointerUp(this,this._dummyVector2,r,s,!0,n),delete this._host._lastControlDown[r],!0):!(e!==o.kD.POINTERWHEEL||!this._host._lastControlOver[r])&&(this._host._lastControlOver[r]._onWheelScroll(a,l),!0)},e.prototype._prepareFont=function(){(this._font||this._fontSet)&&(this._style?this._font=this._style.fontStyle+" "+this._style.fontWeight+" "+this.fontSizeInPixels+"px "+this._style.fontFamily:this._font=this._fontStyle+" "+this._fontWeight+" "+this.fontSizeInPixels+"px "+this._fontFamily,this._fontOffset=e._GetFontOffset(this._font))},e.prototype.dispose=function(){(this.onDirtyObservable.clear(),this.onBeforeDrawObservable.clear(),this.onAfterDrawObservable.clear(),this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this.onWheelObservable.clear(),this._styleObserver&&this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this.parent&&(this.parent.removeControl(this),this.parent=null),this._host)&&(this._host._linkedControls.indexOf(this)>-1&&this.linkWithMesh(null));this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},Object.defineProperty(e,"HORIZONTAL_ALIGNMENT_LEFT",{get:function(){return e._HORIZONTAL_ALIGNMENT_LEFT},enumerable:!1,configurable:!0}),Object.defineProperty(e,"HORIZONTAL_ALIGNMENT_RIGHT",{get:function(){return e._HORIZONTAL_ALIGNMENT_RIGHT},enumerable:!1,configurable:!0}),Object.defineProperty(e,"HORIZONTAL_ALIGNMENT_CENTER",{get:function(){return e._HORIZONTAL_ALIGNMENT_CENTER},enumerable:!1,configurable:!0}),Object.defineProperty(e,"VERTICAL_ALIGNMENT_TOP",{get:function(){return e._VERTICAL_ALIGNMENT_TOP},enumerable:!1,configurable:!0}),Object.defineProperty(e,"VERTICAL_ALIGNMENT_BOTTOM",{get:function(){return e._VERTICAL_ALIGNMENT_BOTTOM},enumerable:!1,configurable:!0}),Object.defineProperty(e,"VERTICAL_ALIGNMENT_CENTER",{get:function(){return e._VERTICAL_ALIGNMENT_CENTER},enumerable:!1,configurable:!0}),e._GetFontOffset=function(t){if(e._FontHeightSizes[t])return e._FontHeightSizes[t];var i=document.createElement("span");i.innerHTML="Hg",i.style.font=t;var n=document.createElement("div");n.style.display="inline-block",n.style.width="1px",n.style.height="0px",n.style.verticalAlign="bottom";var r=document.createElement("div");r.style.whiteSpace="nowrap",r.appendChild(i),r.appendChild(n),document.body.appendChild(r);var o=0,s=0;try{s=n.getBoundingClientRect().top-i.getBoundingClientRect().top,n.style.verticalAlign="baseline",o=n.getBoundingClientRect().top-i.getBoundingClientRect().top}finally{document.body.removeChild(r)}var a={ascent:o,height:s,descent:s-o};return e._FontHeightSizes[t]=a,a},e.drawEllipse=function(e,t,i,n,r){r.translate(e,t),r.scale(i,n),r.beginPath(),r.arc(0,0,1,0,2*Math.PI),r.closePath(),r.scale(1/i,1/n),r.translate(-e,-t)},e.AllowAlphaInheritance=!1,e._ClipMeasure=new h.U(0,0,0,0),e._HORIZONTAL_ALIGNMENT_LEFT=0,e._HORIZONTAL_ALIGNMENT_RIGHT=1,e._HORIZONTAL_ALIGNMENT_CENTER=2,e._VERTICAL_ALIGNMENT_TOP=0,e._VERTICAL_ALIGNMENT_BOTTOM=1,e._VERTICAL_ALIGNMENT_CENTER=2,e._FontHeightSizes={},e.AddHeader=function(){},e}();p.Q.RegisteredTypes["BABYLON.GUI.Control"]=_},8396:(e,t,i)=>{"use strict";i.r(t),i.d(t,{BaseSlider:()=>L,Button:()=>p,Checkbox:()=>g,CheckboxGroup:()=>F,ColorPicker:()=>E,Container:()=>r.W,Control:()=>l.o,DisplayGrid:()=>Y,Ellipse:()=>C,Grid:()=>T,Image:()=>d,ImageBasedSlider:()=>K,ImageScrollBar:()=>z,InputPassword:()=>x,InputText:()=>b,KeyPropertySet:()=>X,Line:()=>R,MultiLine:()=>O,RadioButton:()=>D,RadioGroup:()=>B,Rectangle:()=>s,ScrollBar:()=>H,ScrollViewer:()=>W,SelectionPanel:()=>k,SelectorGroup:()=>N,Slider:()=>w,SliderGroup:()=>U,StackPanel:()=>_,TextBlock:()=>u,TextWrapper:()=>y,TextWrapping:()=>a,VirtualKeyboard:()=>j,name:()=>q});var n=i(655),r=i(6397),o=i(6132),s=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._thickness=1,i._cornerRadius=0,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"thickness",{get:function(){return this._thickness},set:function(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cornerRadius",{get:function(){return this._cornerRadius},set:function(e){e<0&&(e=0),this._cornerRadius!==e&&(this._cornerRadius=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"Rectangle"},t.prototype._localDraw=function(e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._background&&(e.fillStyle=this._background,this._cornerRadius?(this._drawRoundedRect(e,this._thickness/2),e.fill()):e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._thickness&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,this._cornerRadius?(this._drawRoundedRect(e,this._thickness/2),e.stroke()):e.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),e.restore()},t.prototype._additionalProcessing=function(t,i){e.prototype._additionalProcessing.call(this,t,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},t.prototype._drawRoundedRect=function(e,t){void 0===t&&(t=0);var i=this._currentMeasure.left+t,n=this._currentMeasure.top+t,r=this._currentMeasure.width-2*t,o=this._currentMeasure.height-2*t,s=Math.min(o/2-2,Math.min(r/2-2,this._cornerRadius));e.beginPath(),e.moveTo(i+s,n),e.lineTo(i+r-s,n),e.quadraticCurveTo(i+r,n,i+r,n+s),e.lineTo(i+r,n+o-s),e.quadraticCurveTo(i+r,n+o,i+r-s,n+o),e.lineTo(i+s,n+o),e.quadraticCurveTo(i,n+o,i,n+o-s),e.lineTo(i,n+s),e.quadraticCurveTo(i,n,i+s,n),e.closePath()},t.prototype._clipForChildren=function(e){this._cornerRadius&&(this._drawRoundedRect(e,this._thickness),e.clip())},t}(r.W);o.Q.RegisteredTypes["BABYLON.GUI.Rectangle"]=s;var a,l=i(2040),h=i(475),c=i(4872);!function(e){e[e.Clip=0]="Clip",e[e.WordWrap=1]="WordWrap",e[e.Ellipsis=2]="Ellipsis"}(a||(a={}));var u=function(e){function t(t,i){void 0===i&&(i="");var n=e.call(this,t)||this;return n.name=t,n._text="",n._textWrapping=a.Clip,n._textHorizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_CENTER,n._textVerticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,n._resizeToFit=!1,n._lineSpacing=new c.s(0),n._outlineWidth=0,n._outlineColor="white",n._underline=!1,n._lineThrough=!1,n.onTextChangedObservable=new h.y$,n.onLinesReadyObservable=new h.y$,n.text=i,n}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"lines",{get:function(){return this._lines},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resizeToFit",{get:function(){return this._resizeToFit},set:function(e){this._resizeToFit!==e&&(this._resizeToFit=e,this._resizeToFit&&(this._width.ignoreAdaptiveScaling=!0,this._height.ignoreAdaptiveScaling=!0),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textWrapping",{get:function(){return this._textWrapping},set:function(e){this._textWrapping!==e&&(this._textWrapping=+e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(e){this._text!==e&&(this._text=e,this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textHorizontalAlignment",{get:function(){return this._textHorizontalAlignment},set:function(e){this._textHorizontalAlignment!==e&&(this._textHorizontalAlignment=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textVerticalAlignment",{get:function(){return this._textVerticalAlignment},set:function(e){this._textVerticalAlignment!==e&&(this._textVerticalAlignment=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineSpacing",{get:function(){return this._lineSpacing.toString(this._host)},set:function(e){this._lineSpacing.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"underline",{get:function(){return this._underline},set:function(e){this._underline!==e&&(this._underline=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineThrough",{get:function(){return this._lineThrough},set:function(e){this._lineThrough!==e&&(this._lineThrough=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(e){this._outlineColor!==e&&(this._outlineColor=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"TextBlock"},t.prototype._processMeasures=function(t,i){this._fontOffset||(this._fontOffset=l.o._GetFontOffset(i.font)),e.prototype._processMeasures.call(this,t,i),this._lines=this._breakLines(this._currentMeasure.width,i),this.onLinesReadyObservable.notifyObservers(this);for(var n=0,r=0;rn&&(n=o.width)}if(this._resizeToFit){if(this._textWrapping===a.Clip){var s=this.paddingLeftInPixels+this.paddingRightInPixels+n|0;s!==this._width.internalValue&&(this._width.updateInPlace(s,c.s.UNITMODE_PIXEL),this._rebuildLayout=!0)}var h=this.paddingTopInPixels+this.paddingBottomInPixels+this._fontOffset.height*this._lines.length|0;if(this._lines.length>0&&0!==this._lineSpacing.internalValue){var u=0;u=this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height),h+=(this._lines.length-1)*u}h!==this._height.internalValue&&(this._height.updateInPlace(h,c.s.UNITMODE_PIXEL),this._rebuildLayout=!0)}},t.prototype._drawText=function(e,t,i,n){var r=this._currentMeasure.width,o=0;switch(this._textHorizontalAlignment){case l.o.HORIZONTAL_ALIGNMENT_LEFT:o=0;break;case l.o.HORIZONTAL_ALIGNMENT_RIGHT:o=r-t;break;case l.o.HORIZONTAL_ALIGNMENT_CENTER:o=(r-t)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&n.strokeText(e,this._currentMeasure.left+o,i),n.fillText(e,this._currentMeasure.left+o,i),this._underline&&(n.beginPath(),n.lineWidth=Math.round(.05*this.fontSizeInPixels),n.moveTo(this._currentMeasure.left+o,i+3),n.lineTo(this._currentMeasure.left+o+t,i+3),n.stroke(),n.closePath()),this._lineThrough&&(n.beginPath(),n.lineWidth=Math.round(.05*this.fontSizeInPixels),n.moveTo(this._currentMeasure.left+o,i-this.fontSizeInPixels/3),n.lineTo(this._currentMeasure.left+o+t,i-this.fontSizeInPixels/3),n.stroke(),n.closePath())},t.prototype._draw=function(e,t){e.save(),this._applyStates(e),this._renderLines(e),e.restore()},t.prototype._applyStates=function(t){e.prototype._applyStates.call(this,t),this.outlineWidth&&(t.lineWidth=this.outlineWidth,t.strokeStyle=this.outlineColor,t.lineJoin="miter",t.miterLimit=2)},t.prototype._breakLines=function(e,t){var i=[],n=this.text.split("\n");if(this._textWrapping===a.Ellipsis)for(var r=0,o=n;rt&&(e+="…");var r=Array.from&&Array.from(e);if(r)for(;r.length&&n>t;)r.pop(),e=r.join("")+"...",n=i.measureText(e).width;else for(;e.length>2&&n>t;)e=e.slice(0,-2)+"…",n=i.measureText(e).width;return{text:e,width:n}},t.prototype._parseLineWordWrap=function(e,t,i){void 0===e&&(e="");for(var n=[],r=this.wordSplittingFunction?this.wordSplittingFunction(e):e.split(" "),o=0,s=0;s0?e+" "+r[s]:r[0],l=i.measureText(a).width;l>t&&s>0?(n.push({text:e,width:o}),e=r[s],o=i.measureText(e).width):(o=l,e=a)}return n.push({text:e,width:o}),n},t.prototype._renderLines=function(e){var t=this._currentMeasure.height,i=0;switch(this._textVerticalAlignment){case l.o.VERTICAL_ALIGNMENT_TOP:i=this._fontOffset.ascent;break;case l.o.VERTICAL_ALIGNMENT_BOTTOM:i=t-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case l.o.VERTICAL_ALIGNMENT_CENTER:i=this._fontOffset.ascent+(t-this._fontOffset.height*this._lines.length)/2}i+=this._currentMeasure.top;for(var n=0;n0&&0!==this._lineSpacing.internalValue){var n=0;n=this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height),i+=(t.length-1)*n}return i}}return 0},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onTextChangedObservable.clear()},t}(l.o);o.Q.RegisteredTypes["BABYLON.GUI.TextBlock"]=u;var f=i(5540),d=function(e){function t(i,n){void 0===n&&(n=null);var r=e.call(this,i)||this;return r.name=i,r._workingCanvas=null,r._loaded=!1,r._stretch=t.STRETCH_FILL,r._autoScale=!1,r._sourceLeft=0,r._sourceTop=0,r._sourceWidth=0,r._sourceHeight=0,r._svgAttributesComputationCompleted=!1,r._isSVG=!1,r._cellWidth=0,r._cellHeight=0,r._cellId=-1,r._populateNinePatchSlicesFromImage=!1,r._imageDataCache={data:null,key:""},r.onImageLoadedObservable=new h.y$,r.onSVGAttributesComputedObservable=new h.y$,r.source=n,r}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"isLoaded",{get:function(){return this._loaded},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"populateNinePatchSlicesFromImage",{get:function(){return this._populateNinePatchSlicesFromImage},set:function(e){this._populateNinePatchSlicesFromImage!==e&&(this._populateNinePatchSlicesFromImage=e,this._populateNinePatchSlicesFromImage&&this._loaded&&this._extractNinePatchSliceDataFromImage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"detectPointerOnOpaqueOnly",{get:function(){return this._detectPointerOnOpaqueOnly},set:function(e){this._detectPointerOnOpaqueOnly!==e&&(this._detectPointerOnOpaqueOnly=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sliceLeft",{get:function(){return this._sliceLeft},set:function(e){this._sliceLeft!==e&&(this._sliceLeft=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sliceRight",{get:function(){return this._sliceRight},set:function(e){this._sliceRight!==e&&(this._sliceRight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sliceTop",{get:function(){return this._sliceTop},set:function(e){this._sliceTop!==e&&(this._sliceTop=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sliceBottom",{get:function(){return this._sliceBottom},set:function(e){this._sliceBottom!==e&&(this._sliceBottom=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sourceLeft",{get:function(){return this._sourceLeft},set:function(e){this._sourceLeft!==e&&(this._sourceLeft=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sourceTop",{get:function(){return this._sourceTop},set:function(e){this._sourceTop!==e&&(this._sourceTop=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sourceWidth",{get:function(){return this._sourceWidth},set:function(e){this._sourceWidth!==e&&(this._sourceWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sourceHeight",{get:function(){return this._sourceHeight},set:function(e){this._sourceHeight!==e&&(this._sourceHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSVG",{get:function(){return this._isSVG},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"svgAttributesComputationCompleted",{get:function(){return this._svgAttributesComputationCompleted},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoScale",{get:function(){return this._autoScale},set:function(e){this._autoScale!==e&&(this._autoScale=e,e&&this._loaded&&this.synchronizeSizeWithContent())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stretch",{get:function(){return this._stretch},set:function(e){this._stretch!==e&&(this._stretch=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._rotate90=function(e,i){void 0===i&&(i=!1);var n=document.createElement("canvas"),r=n.getContext("2d"),o=this._domImage.width,s=this._domImage.height;n.width=s,n.height=o,r.translate(n.width/2,n.height/2),r.rotate(e*Math.PI/2),r.drawImage(this._domImage,0,0,o,s,-o/2,-s/2,o,s);var a=n.toDataURL("image/jpg"),l=new t(this.name+"rotated",a);return i&&(l._stretch=this._stretch,l._autoScale=this._autoScale,l._cellId=this._cellId,l._cellWidth=e%1?this._cellHeight:this._cellWidth,l._cellHeight=e%1?this._cellWidth:this._cellHeight),this._handleRotationForSVGImage(this,l,e),this._imageDataCache.data=null,l},t.prototype._handleRotationForSVGImage=function(e,t,i){var n=this;e._isSVG&&(e._svgAttributesComputationCompleted?(this._rotate90SourceProperties(e,t,i),this._markAsDirty()):e.onSVGAttributesComputedObservable.addOnce((function(){n._rotate90SourceProperties(e,t,i),n._markAsDirty()})))},t.prototype._rotate90SourceProperties=function(e,t,i){var n,r,o=e.sourceLeft,s=e.sourceTop,a=e.domImage.width,l=e.domImage.height,h=o,c=s,u=e.sourceWidth,f=e.sourceHeight;if(0!=i){var d=i<0?-1:1;i%=4;for(var p=0;p127&&-1===this._sliceLeft)this._sliceLeft=o;else if(a<127&&this._sliceLeft>-1){this._sliceRight=o;break}}this._sliceTop=-1,this._sliceBottom=-1;for(var s=0;s127&&-1===this._sliceTop)this._sliceTop=s;else if(a<127&&this._sliceTop>-1){this._sliceBottom=s;break}}},Object.defineProperty(t.prototype,"source",{set:function(e){var t=this;this._source!==e&&(this._loaded=!1,this._source=e,this._imageDataCache.data=null,e&&(e=this._svgCheck(e)),this._domImage=document.createElement("img"),this._domImage.onload=function(){t._onImageLoaded()},e&&(f.w1.SetCorsBehavior(e,this._domImage),this._domImage.src=e))},enumerable:!1,configurable:!0}),t.prototype._svgCheck=function(e){var t=this;if(window.SVGSVGElement&&-1!==e.search(/.svg#/gi)&&e.indexOf("#")===e.lastIndexOf("#")){this._isSVG=!0;var i=e.split("#")[0],n=e.split("#")[1],r=document.body.querySelector('object[data="'+i+'"]');if(r){var o=r.contentDocument;if(o&&o.documentElement){var s=o.documentElement.getAttribute("viewBox"),a=Number(o.documentElement.getAttribute("width")),l=Number(o.documentElement.getAttribute("height"));if(o.getElementById(n)&&s&&a&&l)return this._getSVGAttribs(r,n),e}r.addEventListener("load",(function(){t._getSVGAttribs(r,n)}))}else{var h=document.createElement("object");h.data=i,h.type="image/svg+xml",h.width="0%",h.height="0%",document.body.appendChild(h),h.onload=function(){var e=document.body.querySelector('object[data="'+i+'"]');e&&t._getSVGAttribs(e,n)}}return i}return e},t.prototype._getSVGAttribs=function(e,t){var i=e.contentDocument;if(i&&i.documentElement){var n=i.documentElement.getAttribute("viewBox"),r=Number(i.documentElement.getAttribute("width")),o=Number(i.documentElement.getAttribute("height")),s=i.getElementById(t);if(n&&r&&o&&s){var a=Number(n.split(" ")[2]),l=Number(n.split(" ")[3]),h=s.getBBox(),c=1,u=1,f=0,d=0;s.transform&&s.transform.baseVal.consolidate()&&(c=s.transform.baseVal.consolidate().matrix.a,u=s.transform.baseVal.consolidate().matrix.d,f=s.transform.baseVal.consolidate().matrix.e,d=s.transform.baseVal.consolidate().matrix.f),this.sourceLeft=(c*h.x+f)*r/a,this.sourceTop=(u*h.y+d)*o/l,this.sourceWidth=h.width*c*(r/a),this.sourceHeight=h.height*u*(o/l),this._svgAttributesComputationCompleted=!0,this.onSVGAttributesComputedObservable.notifyObservers(this)}}},Object.defineProperty(t.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(e){this._cellWidth!==e&&(this._cellWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(e){this._cellHeight!==e&&(this._cellHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cellId",{get:function(){return this._cellId},set:function(e){this._cellId!==e&&(this._cellId=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype.contains=function(t,i){if(!e.prototype.contains.call(this,t,i))return!1;if(!this._detectPointerOnOpaqueOnly||!this._workingCanvas)return!0;var n=0|this._currentMeasure.width,r=0|this._currentMeasure.height,o=n+"_"+r,s=this._imageDataCache.data;if(!s||this._imageDataCache.key!==o){var a=this._workingCanvas.getContext("2d");this._imageDataCache.data=s=a.getImageData(0,0,n,r).data,this._imageDataCache.key=o}return s[4*((t=t-this._currentMeasure.left|0)+(i=i-this._currentMeasure.top|0)*n)+3]>0},t.prototype._getTypeName=function(){return"Image"},t.prototype.synchronizeSizeWithContent=function(){this._loaded&&(this.width=this._domImage.width+"px",this.height=this._domImage.height+"px")},t.prototype._processMeasures=function(i,n){if(this._loaded)switch(this._stretch){case t.STRETCH_NONE:case t.STRETCH_FILL:case t.STRETCH_UNIFORM:case t.STRETCH_NINE_PATCH:break;case t.STRETCH_EXTEND:this._autoScale&&this.synchronizeSizeWithContent(),this.parent&&this.parent.parent&&(this.parent.adaptWidthToChildren=!0,this.parent.adaptHeightToChildren=!0)}e.prototype._processMeasures.call(this,i,n)},t.prototype._prepareWorkingCanvasForOpaqueDetection=function(){if(this._detectPointerOnOpaqueOnly){this._workingCanvas||(this._workingCanvas=document.createElement("canvas"));var e=this._workingCanvas,t=this._currentMeasure.width,i=this._currentMeasure.height,n=e.getContext("2d");e.width=t,e.height=i,n.clearRect(0,0,t,i)}},t.prototype._drawImage=function(e,t,i,n,r,o,s,a,l){(e.drawImage(this._domImage,t,i,n,r,o,s,a,l),this._detectPointerOnOpaqueOnly)&&(e=this._workingCanvas.getContext("2d")).drawImage(this._domImage,t,i,n,r,o-this._currentMeasure.left,s-this._currentMeasure.top,a,l)},t.prototype._draw=function(e){var i,n,r,o;if(e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),-1==this.cellId)i=this._sourceLeft,n=this._sourceTop,r=this._sourceWidth?this._sourceWidth:this._imageWidth,o=this._sourceHeight?this._sourceHeight:this._imageHeight;else{var s=this._domImage.naturalWidth/this.cellWidth,a=this.cellId/s>>0,l=this.cellId%s;i=this.cellWidth*l,n=this.cellHeight*a,r=this.cellWidth,o=this.cellHeight}if(this._prepareWorkingCanvasForOpaqueDetection(),this._applyStates(e),this._loaded)switch(this._stretch){case t.STRETCH_NONE:case t.STRETCH_FILL:this._drawImage(e,i,n,r,o,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case t.STRETCH_UNIFORM:var h=this._currentMeasure.width/r,c=this._currentMeasure.height/o,u=Math.min(h,c),f=(this._currentMeasure.width-r*u)/2,d=(this._currentMeasure.height-o*u)/2;this._drawImage(e,i,n,r,o,this._currentMeasure.left+f,this._currentMeasure.top+d,r*u,o*u);break;case t.STRETCH_EXTEND:this._drawImage(e,i,n,r,o,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case t.STRETCH_NINE_PATCH:this._renderNinePatch(e)}e.restore()},t.prototype._renderCornerPatch=function(e,t,i,n,r,o,s){this._drawImage(e,t,i,n,r,this._currentMeasure.left+o,this._currentMeasure.top+s,n,r)},t.prototype._renderNinePatch=function(e){var t=this._imageHeight,i=this._sliceLeft,n=this._sliceTop,r=this._imageHeight-this._sliceBottom,o=this._imageWidth-this._sliceRight,s=0,a=0;this._populateNinePatchSlicesFromImage&&(s=1,a=1,t-=2,i-=1,n-=1,r-=1,o-=1);var l=this._sliceRight-this._sliceLeft,h=this._currentMeasure.width-o-this.sliceLeft,c=this._currentMeasure.height-t+this._sliceBottom;this._renderCornerPatch(e,s,a,i,n,0,0),this._renderCornerPatch(e,s,this._sliceBottom,i,t-this._sliceBottom,0,c),this._renderCornerPatch(e,this._sliceRight,a,o,n,this._currentMeasure.width-o,0),this._renderCornerPatch(e,this._sliceRight,this._sliceBottom,o,t-this._sliceBottom,this._currentMeasure.width-o,c),this._drawImage(e,this._sliceLeft,this._sliceTop,l,this._sliceBottom-this._sliceTop,this._currentMeasure.left+i,this._currentMeasure.top+n,h,c-n),this._drawImage(e,s,this._sliceTop,i,this._sliceBottom-this._sliceTop,this._currentMeasure.left,this._currentMeasure.top+n,i,c-n),this._drawImage(e,this._sliceRight,this._sliceTop,i,this._sliceBottom-this._sliceTop,this._currentMeasure.left+this._currentMeasure.width-o,this._currentMeasure.top+n,i,c-n),this._drawImage(e,this._sliceLeft,a,l,n,this._currentMeasure.left+i,this._currentMeasure.top,h,n),this._drawImage(e,this._sliceLeft,this._sliceBottom,l,r,this._currentMeasure.left+i,this._currentMeasure.top+c,h,r)},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onImageLoadedObservable.clear(),this.onSVGAttributesComputedObservable.clear()},t.STRETCH_NONE=0,t.STRETCH_FILL=1,t.STRETCH_UNIFORM=2,t.STRETCH_EXTEND=3,t.STRETCH_NINE_PATCH=4,t}(l.o);o.Q.RegisteredTypes["BABYLON.GUI.Image"]=d;var p=function(e){function t(t){var i=e.call(this,t)||this;i.name=t,i.delegatePickingToChildren=!1,i.thickness=1,i.isPointerBlocker=!0;var n=null;return i.pointerEnterAnimation=function(){n=i.alpha,i.alpha-=.1},i.pointerOutAnimation=function(){null!==n&&(i.alpha=n)},i.pointerDownAnimation=function(){i.scaleX-=.05,i.scaleY-=.05},i.pointerUpAnimation=function(){i.scaleX+=.05,i.scaleY+=.05},i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"image",{get:function(){return this._image},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textBlock",{get:function(){return this._textBlock},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"Button"},t.prototype._processPicking=function(t,i,n,r,o,s,a,l){if(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this.notRenderable)return!1;if(!e.prototype.contains.call(this,t,i))return!1;if(this.delegatePickingToChildren){for(var h=!1,c=this._children.length-1;c>=0;c--){var u=this._children[c];if(u.isEnabled&&u.isHitTestVisible&&u.isVisible&&!u.notRenderable&&u.contains(t,i)){h=!0;break}}if(!h)return!1}return this._processObservables(r,t,i,n,o,s,a,l),!0},t.prototype._onPointerEnter=function(t,i){return!!e.prototype._onPointerEnter.call(this,t,i)&&(this.pointerEnterAnimation&&this.pointerEnterAnimation(),!0)},t.prototype._onPointerOut=function(t,i,n){void 0===n&&(n=!1),this.pointerOutAnimation&&this.pointerOutAnimation(),e.prototype._onPointerOut.call(this,t,i,n)},t.prototype._onPointerDown=function(t,i,n,r,o){return!!e.prototype._onPointerDown.call(this,t,i,n,r,o)&&(this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},t.prototype._onPointerUp=function(t,i,n,r,o,s){this.pointerUpAnimation&&this.pointerUpAnimation(),e.prototype._onPointerUp.call(this,t,i,n,r,o,s)},t.CreateImageButton=function(e,i,n){var r=new t(e),o=new u(e+"_button",i);o.textWrapping=!0,o.textHorizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_CENTER,o.paddingLeft="20%",r.addControl(o);var s=new d(e+"_icon",n);return s.width="20%",s.stretch=d.STRETCH_UNIFORM,s.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,r.addControl(s),r._image=s,r._textBlock=o,r},t.CreateImageOnlyButton=function(e,i){var n=new t(e),r=new d(e+"_icon",i);return r.stretch=d.STRETCH_FILL,r.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,n.addControl(r),n._image=r,n},t.CreateSimpleButton=function(e,i){var n=new t(e),r=new u(e+"_button",i);return r.textWrapping=!0,r.textHorizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_CENTER,n.addControl(r),n._textBlock=r,n},t.CreateImageWithCenterTextButton=function(e,i,n){var r=new t(e),o=new d(e+"_icon",n);o.stretch=d.STRETCH_FILL,r.addControl(o);var s=new u(e+"_button",i);return s.textWrapping=!0,s.textHorizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_CENTER,r.addControl(s),r._image=o,r._textBlock=s,r},t}(s);o.Q.RegisteredTypes["BABYLON.GUI.Button"]=p;var _=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._isVertical=!0,i._manualWidth=!1,i._manualHeight=!1,i._doNotTrackManualChanges=!1,i.ignoreLayoutWarnings=!1,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"isVertical",{get:function(){return this._isVertical},set:function(e){this._isVertical!==e&&(this._isVertical=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(e){this._doNotTrackManualChanges||(this._manualWidth=!0),this._width.toString(this._host)!==e&&this._width.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(e){this._doNotTrackManualChanges||(this._manualHeight=!0),this._height.toString(this._host)!==e&&this._height.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"StackPanel"},t.prototype._preMeasure=function(t,i){for(var n=0,r=this._children;n=0?Math.min(e,this._characters.length):this._characters.length+Math.max(e,-this._characters.length),void 0===t?t=this._characters.length-e:(isNaN(t)||t<0)&&(t=0);for(var i=[];--t>=0;)i[t]=this._characters[e+t];return i.join("")}return this._text.substr(e,t)},e.prototype.substring=function(e,t){if(this._characters){isNaN(e)?e=0:e>this._characters.length?e=this._characters.length:e<0&&(e=0),void 0===t?t=this._characters.length:isNaN(t)?t=0:t>this._characters.length?t=this._characters.length:t<0&&(t=0);for(var i=[],n=0;e0){if(this._isTextHighlightOn)return this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this._isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this._blinkIsEven=!1,void(i&&i.preventDefault());if(0===this._cursorOffset)this.text=this._textWrapper.substr(0,this._textWrapper.length-1);else(n=this._textWrapper.length-this._cursorOffset)>0&&(this._textWrapper.removePart(n-1,n),this._textHasChanged())}return void(i&&i.preventDefault());case 46:if(this._isTextHighlightOn)return this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this._isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,void(i&&i.preventDefault());if(this._textWrapper.text&&this._textWrapper.length>0&&this._cursorOffset>0){var n=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(n,n+1),this._textHasChanged(),this._cursorOffset--}return void(i&&i.preventDefault());case 13:return this._host.focusedControl=null,void(this._isTextHighlightOn=!1);case 35:return this._cursorOffset=0,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case 36:return this._cursorOffset=this._textWrapper.length,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case 37:if(this._cursorOffset++,this._cursorOffset>this._textWrapper.length&&(this._cursorOffset=this._textWrapper.length),i&&i.shiftKey){if(this._blinkIsEven=!1,i.ctrlKey||i.metaKey){if(!this._isTextHighlightOn){if(this._textWrapper.length===this._cursorOffset)return;this._endHighlightIndex=this._textWrapper.length-this._cursorOffset+1}return this._startHighlightIndex=0,this._cursorIndex=this._textWrapper.length-this._endHighlightIndex,this._cursorOffset=this._textWrapper.length,this._isTextHighlightOn=!0,void this._markAsDirty()}return this._isTextHighlightOn?-1===this._cursorIndex&&(this._cursorIndex=this._textWrapper.length-this._endHighlightIndex,this._cursorOffset=0===this._startHighlightIndex?this._textWrapper.length:this._textWrapper.length-this._startHighlightIndex+1):(this._isTextHighlightOn=!0,this._cursorIndex=this._cursorOffset>=this._textWrapper.length?this._textWrapper.length:this._cursorOffset-1),this._cursorIndexthis._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex):this._isTextHighlightOn=!1,void this._markAsDirty()}return this._isTextHighlightOn&&(this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this._isTextHighlightOn=!1),i&&(i.ctrlKey||i.metaKey)&&(this._cursorOffset=this._textWrapper.length,i.preventDefault()),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._cursorIndex=-1,void this._markAsDirty();case 39:if(this._cursorOffset--,this._cursorOffset<0&&(this._cursorOffset=0),i&&i.shiftKey){if(this._blinkIsEven=!1,i.ctrlKey||i.metaKey){if(!this._isTextHighlightOn){if(0===this._cursorOffset)return;this._startHighlightIndex=this._textWrapper.length-this._cursorOffset-1}return this._endHighlightIndex=this._textWrapper.length,this._isTextHighlightOn=!0,this._cursorIndex=this._textWrapper.length-this._startHighlightIndex,this._cursorOffset=0,void this._markAsDirty()}return this._isTextHighlightOn?-1===this._cursorIndex&&(this._cursorIndex=this._textWrapper.length-this._startHighlightIndex,this._cursorOffset=this._textWrapper.length===this._endHighlightIndex?0:this._textWrapper.length-this._endHighlightIndex-1):(this._isTextHighlightOn=!0,this._cursorIndex=this._cursorOffset<=0?0:this._cursorOffset+1),this._cursorIndexthis._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex):this._isTextHighlightOn=!1,void this._markAsDirty()}return this._isTextHighlightOn&&(this._cursorOffset=this._textWrapper.length-this._endHighlightIndex,this._isTextHighlightOn=!1),i&&(i.ctrlKey||i.metaKey)&&(this._cursorOffset=0,i.preventDefault()),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._cursorIndex=-1,void this._markAsDirty();case 222:i&&i.preventDefault(),this._cursorIndex=-1,this.deadKey=!0}if(t&&(-1===e||32===e||e>47&&e<64||e>64&&e<91||e>159&&e<193||e>218&&e<223||e>95&&e<112)&&(this._currentKey=t,this.onBeforeKeyAddObservable.notifyObservers(this),t=this._currentKey,this._addKey))if(this._isTextHighlightOn)this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex,t),this._textHasChanged(),this._cursorOffset=this._textWrapper.length-(this._startHighlightIndex+1),this._isTextHighlightOn=!1,this._blinkIsEven=!1,this._markAsDirty();else if(0===this._cursorOffset)this.text+=t;else{var r=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(r,r,t),this._textHasChanged()}}},t.prototype._updateValueFromCursorIndex=function(e){if(this._blinkIsEven=!1,-1===this._cursorIndex)this._cursorIndex=e;else if(this._cursorIndexthis._cursorOffset))return this._isTextHighlightOn=!1,void this._markAsDirty();this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex}this._isTextHighlightOn=!0,this._markAsDirty()},t.prototype._processDblClick=function(e){var t,i;this._startHighlightIndex=this._textWrapper.length-this._cursorOffset,this._endHighlightIndex=this._startHighlightIndex;do{i=this._endHighlightIndex0&&this._textWrapper.isWord(this._startHighlightIndex-1)?--this._startHighlightIndex:0}while(t||i);this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this.onTextHighlightObservable.notifyObservers(this),this._isTextHighlightOn=!0,this._clickedCoordinate=null,this._blinkIsEven=!0,this._cursorIndex=-1,this._markAsDirty()},t.prototype._selectAllText=function(){this._blinkIsEven=!0,this._isTextHighlightOn=!0,this._startHighlightIndex=0,this._endHighlightIndex=this._textWrapper.length,this._cursorOffset=this._textWrapper.length,this._cursorIndex=-1,this._markAsDirty()},t.prototype.processKeyboard=function(e){this.processKey(e.keyCode,e.key,e),this.onKeyboardEventProcessedObservable.notifyObservers(e)},t.prototype._onCopyText=function(e){this._isTextHighlightOn=!1;try{e.clipboardData&&e.clipboardData.setData("text/plain",this._highlightedText)}catch(e){}this._host.clipboardData=this._highlightedText},t.prototype._onCutText=function(e){if(this._highlightedText){this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this._isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex;try{e.clipboardData&&e.clipboardData.setData("text/plain",this._highlightedText)}catch(e){}this._host.clipboardData=this._highlightedText,this._highlightedText=""}},t.prototype._onPasteText=function(e){var t="";t=e.clipboardData&&-1!==e.clipboardData.types.indexOf("text/plain")?e.clipboardData.getData("text/plain"):this._host.clipboardData;var i=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(i,i,t),this._textHasChanged()},t.prototype._draw=function(e,t){var i=this;e.save(),this._applyStates(e),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._isFocused?this._focusedBackground&&(e.fillStyle=this._isEnabled?this._focusedBackground:this._disabledColor,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._fontOffset||(this._fontOffset=l.o._GetFontOffset(e.font));var n=this._currentMeasure.left+this._margin.getValueInPixel(this._host,this._tempParentMeasure.width);this.color&&(e.fillStyle=this.color);var r=this._beforeRenderText(this._textWrapper);this._isFocused||this._textWrapper.text||!this._placeholderText||((r=new y).text=this._placeholderText,this._placeholderColor&&(e.fillStyle=this._placeholderColor)),this._textWidth=e.measureText(r.text).width;var o=2*this._margin.getValueInPixel(this._host,this._tempParentMeasure.width);this._autoStretchWidth&&(this.width=Math.min(this._maxWidth.getValueInPixel(this._host,this._tempParentMeasure.width),this._textWidth+o)+"px");var s=this._fontOffset.ascent+(this._currentMeasure.height-this._fontOffset.height)/2,a=this._width.getValueInPixel(this._host,this._tempParentMeasure.width)-o;if(e.save(),e.beginPath(),e.rect(n,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,a+2,this._currentMeasure.height),e.clip(),this._isFocused&&this._textWidth>a){var h=n-this._textWidth+a;this._scrollLeft||(this._scrollLeft=h)}else this._scrollLeft=n;if(e.fillText(r.text,this._scrollLeft,this._currentMeasure.top+s),this._isFocused){if(this._clickedCoordinate){var c=this._scrollLeft+this._textWidth-this._clickedCoordinate,u=0;this._cursorOffset=0;var f=0;do{this._cursorOffset&&(f=Math.abs(c-u)),this._cursorOffset++,u=e.measureText(r.substr(r.length-this._cursorOffset,this._cursorOffset)).width}while(u=this._cursorOffset);Math.abs(c-u)>f&&this._cursorOffset--,this._blinkIsEven=!1,this._clickedCoordinate=null}if(!this._blinkIsEven){var d=r.substr(r.length-this._cursorOffset),p=e.measureText(d).width,_=this._scrollLeft+this._textWidth-p;_n+a&&(this._scrollLeft+=n+a-_,_=n+a,this._markAsDirty()),this._isTextHighlightOn||e.fillRect(_,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,2,this._fontOffset.height)}if(clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((function(){i._blinkIsEven=!i._blinkIsEven,i._markAsDirty()}),500),this._isTextHighlightOn){clearTimeout(this._blinkTimeout);var g=e.measureText(r.substring(this._startHighlightIndex)).width,m=this._scrollLeft+this._textWidth-g;this._highlightedText=r.substring(this._startHighlightIndex,this._endHighlightIndex);var v=e.measureText(r.substring(this._startHighlightIndex,this._endHighlightIndex)).width;m=this._rowDefinitions.length?null:this._rowDefinitions[e]},t.prototype.getColumnDefinition=function(e){return e<0||e>=this._columnDefinitions.length?null:this._columnDefinitions[e]},t.prototype.addRowDefinition=function(e,t){return void 0===t&&(t=!1),this._rowDefinitions.push(new c.s(e,t?c.s.UNITMODE_PIXEL:c.s.UNITMODE_PERCENTAGE)),this._markAsDirty(),this},t.prototype.addColumnDefinition=function(e,t){return void 0===t&&(t=!1),this._columnDefinitions.push(new c.s(e,t?c.s.UNITMODE_PIXEL:c.s.UNITMODE_PERCENTAGE)),this._markAsDirty(),this},t.prototype.setRowDefinition=function(e,t,i){if(void 0===i&&(i=!1),e<0||e>=this._rowDefinitions.length)return this;var n=this._rowDefinitions[e];return n&&n.isPixel===i&&n.internalValue===t||(this._rowDefinitions[e]=new c.s(t,i?c.s.UNITMODE_PIXEL:c.s.UNITMODE_PERCENTAGE),this._markAsDirty()),this},t.prototype.setColumnDefinition=function(e,t,i){if(void 0===i&&(i=!1),e<0||e>=this._columnDefinitions.length)return this;var n=this._columnDefinitions[e];return n&&n.isPixel===i&&n.internalValue===t||(this._columnDefinitions[e]=new c.s(t,i?c.s.UNITMODE_PIXEL:c.s.UNITMODE_PERCENTAGE),this._markAsDirty()),this},t.prototype.getChildrenAt=function(e,t){var i=this._cells[e+":"+t];return i?i.children:null},t.prototype.getChildCellInfo=function(e){return e._tag},t.prototype._removeCell=function(t,i){if(t){e.prototype.removeControl.call(this,t);for(var n=0,r=t.children;n=this._columnDefinitions.length)return this;for(var t=0;t=this._rowDefinitions.length)return this;for(var t=0;t=1-t._Epsilon&&(this._value.r=1),this._value.g>=1-t._Epsilon&&(this._value.g=1),this._value.b>=1-t._Epsilon&&(this._value.b=1),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(e){this._width.toString(this._host)!==e&&this._width.fromString(e)&&(this._height.fromString(e),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(e){this._height.toString(this._host)!==e&&this._height.fromString(e)&&(this._width.fromString(e),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.width},set:function(e){this.width=e},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"ColorPicker"},t.prototype._preMeasure=function(e,t){e.widtha||f150?.04:-.16*(e-50)/100+.2;var m=(d-l)/(e-l);o[_+3]=m1-g?255*(1-(m-(1-g))/g):255}}return n.putImageData(r,0,0),i},t.prototype._draw=function(e){e.save(),this._applyStates(e);var t=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),i=.2*t,n=this._currentMeasure.left,r=this._currentMeasure.top;this._colorWheelCanvas&&this._colorWheelCanvas.width==2*t||(this._colorWheelCanvas=this._createColorWheelCanvas(t,i)),this._updateSquareProps(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY,e.fillRect(this._squareLeft,this._squareTop,this._squareSize,this._squareSize)),e.drawImage(this._colorWheelCanvas,n,r),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._drawGradientSquare(this._h,this._squareLeft,this._squareTop,this._squareSize,this._squareSize,e);var o=this._squareLeft+this._squareSize*this._s,s=this._squareTop+this._squareSize*(1-this._v);this._drawCircle(o,s,.04*t,e);var a=t-.5*i;o=n+t+Math.cos((this._h-180)*Math.PI/180)*a,s=r+t+Math.sin((this._h-180)*Math.PI/180)*a,this._drawCircle(o,s,.35*i,e),e.restore()},t.prototype._updateValueFromPointer=function(e,i){if(this._pointerStartedOnWheel){var n=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),r=n+this._currentMeasure.left,o=n+this._currentMeasure.top;this._h=180*Math.atan2(i-o,e-r)/Math.PI+180}else this._pointerStartedOnSquare&&(this._updateSquareProps(),this._s=(e-this._squareLeft)/this._squareSize,this._v=1-(i-this._squareTop)/this._squareSize,this._s=Math.min(this._s,1),this._s=Math.max(this._s,t._Epsilon),this._v=Math.min(this._v,1),this._v=Math.max(this._v,t._Epsilon));A.Wo.HSVtoRGBToRef(this._h,this._s,this._v,this._tmpColor),this.value=this._tmpColor},t.prototype._isPointOnSquare=function(e,t){this._updateSquareProps();var i=this._squareLeft,n=this._squareTop,r=this._squareSize;return e>=i&&e<=i+r&&t>=n&&t<=n+r},t.prototype._isPointOnWheel=function(e,t){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),n=i-.2*i,r=e-(i+this._currentMeasure.left),o=t-(i+this._currentMeasure.top),s=r*r+o*o;return s<=i*i&&s>=n*n},t.prototype._onPointerDown=function(t,i,n,r,o){if(!e.prototype._onPointerDown.call(this,t,i,n,r,o))return!1;this._pointerIsDown=!0,this._pointerStartedOnSquare=!1,this._pointerStartedOnWheel=!1,this._invertTransformMatrix.transformCoordinates(i.x,i.y,this._transformedPosition);var s=this._transformedPosition.x,a=this._transformedPosition.y;return this._isPointOnSquare(s,a)?this._pointerStartedOnSquare=!0:this._isPointOnWheel(s,a)&&(this._pointerStartedOnWheel=!0),this._updateValueFromPointer(s,a),this._host._capturingControl[n]=this,this._lastPointerDownID=n,!0},t.prototype._onPointerMove=function(t,i,n,r){if(n==this._lastPointerDownID){this._invertTransformMatrix.transformCoordinates(i.x,i.y,this._transformedPosition);var o=this._transformedPosition.x,s=this._transformedPosition.y;this._pointerIsDown&&this._updateValueFromPointer(o,s),e.prototype._onPointerMove.call(this,t,i,n,r)}},t.prototype._onPointerUp=function(t,i,n,r,o,s){this._pointerIsDown=!1,delete this._host._capturingControl[n],e.prototype._onPointerUp.call(this,t,i,n,r,o,s)},t.prototype._onCanvasBlur=function(){this._forcePointerUp(),e.prototype._onCanvasBlur.call(this)},t.ShowPickerDialogAsync=function(e,i){return new Promise((function(n,r){i.pickerWidth=i.pickerWidth||"640px",i.pickerHeight=i.pickerHeight||"400px",i.headerHeight=i.headerHeight||"35px",i.lastColor=i.lastColor||"#000000",i.swatchLimit=i.swatchLimit||20,i.numSwatchesPerLine=i.numSwatchesPerLine||10;var o,a,h,c,f,d,_,g,m,v,y,E,C,x,S,R,M,P,I,O=i.swatchLimit/i.numSwatchesPerLine,D=parseFloat(i.pickerWidth)/i.numSwatchesPerLine,L=Math.floor(.25*D),w=L*(i.numSwatchesPerLine+1),N=Math.floor((parseFloat(i.pickerWidth)-w)/i.numSwatchesPerLine),F=N*O+L*(O+1),B=(parseInt(i.pickerHeight)+F+Math.floor(.25*N)).toString()+"px",U="#c0c0c0",k="#535353",V="#414141",G="515151",H=A.Wo.FromHexString("#dddddd"),z=H.r+H.g+H.b,W=["R","G","B"],X="#454545",j="#f0f0f0",Y=!1;function K(e,t){I=t;var i=e.toHexString();if(M.background=i,v.name!=I&&(v.text=Math.floor(255*e.r).toString()),y.name!=I&&(y.text=Math.floor(255*e.g).toString()),E.name!=I&&(E.text=Math.floor(255*e.b).toString()),C.name!=I&&(C.text=e.r.toString()),x.name!=I&&(x.text=e.g.toString()),S.name!=I&&(S.text=e.b.toString()),R.name!=I){var n=i.split("#");R.text=n[1]}m.name!=I&&(m.value=e)}function q(e,t){var i=e.text;if(/[^0-9]/g.test(i))e.text=P;else if(""!=i&&(Math.floor(parseInt(i))<0?i="0":Math.floor(parseInt(i))>255?i="255":isNaN(parseInt(i))&&(i="0")),I==e.name&&(P=i),""!=i){i=parseInt(i).toString(),e.text=i;var n=A.Wo.FromHexString(M.background);I==e.name&&K("r"==t?new A.Wo(parseInt(i)/255,n.g,n.b):"g"==t?new A.Wo(n.r,parseInt(i)/255,n.b):new A.Wo(n.r,n.g,parseInt(i)/255),e.name)}}function Z(e,t){var i=e.text;if(/[^0-9\.]/g.test(i))e.text=P;else{""!=i&&"."!=i&&0!=parseFloat(i)&&(parseFloat(i)<0?i="0.0":parseFloat(i)>1?i="1.0":isNaN(parseFloat(i))&&(i="0.0")),I==e.name&&(P=i),""!=i&&"."!=i&&0!=parseFloat(i)?(i=parseFloat(i).toString(),e.text=i):i="0.0";var n=A.Wo.FromHexString(M.background);I==e.name&&K("r"==t?new A.Wo(parseFloat(i),n.g,n.b):"g"==t?new A.Wo(n.r,parseFloat(i),n.b):new A.Wo(n.r,n.g,parseFloat(i)),e.name)}}function Q(){if(i.savedColors&&i.savedColors[_]){if(Y)var e="b";else e="";var t=p.CreateSimpleButton("Swatch_"+_,e);t.fontFamily="BabylonJSglyphs";var n=A.Wo.FromHexString(i.savedColors[_]),r=n.r+n.g+n.b;t.color=r>z?"#aaaaaa":"#ffffff",t.fontSize=Math.floor(.7*N),t.textBlock.verticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,t.height=t.width=N.toString()+"px",t.background=i.savedColors[_],t.thickness=2;var o=_;return t.pointerDownAnimation=function(){t.thickness=4},t.pointerUpAnimation=function(){t.thickness=3},t.pointerEnterAnimation=function(){t.thickness=3},t.pointerOutAnimation=function(){t.thickness=2},t.onPointerClickObservable.add((function(){var e;Y?(e=o,i.savedColors&&i.savedColors.splice(e,1),i.savedColors&&0==i.savedColors.length&&(ee(!1),Y=!1),$("",Ne)):i.savedColors&&K(A.Wo.FromHexString(i.savedColors[o]),t.name)})),t}return null}function J(e){if(void 0!==e&&(Y=e),Y){for(var t=0;tl*i.numSwatchesPerLine)var h=i.numSwatchesPerLine;else h=i.savedColors.length-(l-1)*i.numSwatchesPerLine;for(var c=Math.min(Math.max(h,0),i.numSwatchesPerLine),u=0,f=1;ui.numSwatchesPerLine)){var d=Q();null!=d&&(g.addControl(d,a,f),f+=2,_++)}}i.savedColors.length>=i.swatchLimit?te(t,!0):te(t,!1)}}function ee(e){e?((h=p.CreateSimpleButton("butEdit","Edit")).width=c,h.height=f,h.left=Math.floor(.1*parseInt(c)).toString()+"px",h.top=(-1*parseFloat(h.left)).toString()+"px",h.verticalAlignment=l.o.VERTICAL_ALIGNMENT_BOTTOM,h.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,h.thickness=2,h.color=U,h.fontSize=a,h.background=k,h.onPointerEnterObservable.add((function(){h.background=V})),h.onPointerOutObservable.add((function(){h.background=k})),h.pointerDownAnimation=function(){h.background=G},h.pointerUpAnimation=function(){h.background=V},h.onPointerClickObservable.add((function(){Y=!Y,J()})),ge.addControl(h,1,0)):ge.removeControl(h)}function te(e,t){t?(e.color="#555555",e.background="#454545"):(e.color=U,e.background=k)}function ie(t){i.savedColors&&i.savedColors.length>0?n({savedColors:i.savedColors,pickedColor:t}):n({pickedColor:t}),e.removeControl(ne)}var ne=new T;if(ne.name="Dialog Container",ne.width=i.pickerWidth,i.savedColors){ne.height=B;var re=parseInt(i.pickerHeight)/parseInt(B);ne.addRowDefinition(re,!1),ne.addRowDefinition(1-re,!1)}else ne.height=i.pickerHeight,ne.addRowDefinition(1,!1);if(e.addControl(ne),i.savedColors){(g=new T).name="Swatch Drawer",g.verticalAlignment=l.o.VERTICAL_ALIGNMENT_TOP,g.background=k,g.width=i.pickerWidth;var oe=i.savedColors.length/i.numSwatchesPerLine;if(0==oe)var se=0;else se=oe+1;g.height=(N*oe+se*L).toString()+"px",g.top=Math.floor(.25*N).toString()+"px";for(var ae=0;ae<2*Math.ceil(i.savedColors.length/i.numSwatchesPerLine)+1;ae++)ae%2!=0?g.addRowDefinition(N,!0):g.addRowDefinition(L,!0);for(ae=0;ae<2*i.numSwatchesPerLine+1;ae++)ae%2!=0?g.addColumnDefinition(N,!0):g.addColumnDefinition(L,!0);ne.addControl(g,1,0)}var le=new T;le.name="Picker Panel",le.height=i.pickerHeight;var he=parseInt(i.headerHeight)/parseInt(i.pickerHeight),ce=[he,1-he];le.addRowDefinition(ce[0],!1),le.addRowDefinition(ce[1],!1),ne.addControl(le,0,0);var ue=new s;ue.name="Dialogue Header Bar",ue.background="#cccccc",ue.thickness=0,le.addControl(ue,0,0);var fe=p.CreateSimpleButton("closeButton","a");fe.fontFamily="BabylonJSglyphs";var de=A.Wo.FromHexString(ue.background);o=new A.Wo(1-de.r,1-de.g,1-de.b),fe.color=o.toHexString(),fe.fontSize=Math.floor(.6*parseInt(i.headerHeight)),fe.textBlock.textVerticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,fe.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_RIGHT,fe.height=fe.width=i.headerHeight,fe.background=ue.background,fe.thickness=0,fe.pointerDownAnimation=function(){},fe.pointerUpAnimation=function(){fe.background=ue.background},fe.pointerEnterAnimation=function(){fe.color=ue.background,fe.background="red"},fe.pointerOutAnimation=function(){fe.color=o.toHexString(),fe.background=ue.background},fe.onPointerClickObservable.add((function(){ie(Me.background)})),le.addControl(fe,0,0);var pe=new T;pe.name="Dialogue Body",pe.background=k;var _e=[.4375,.5625];pe.addRowDefinition(1,!1),pe.addColumnDefinition(_e[0],!1),pe.addColumnDefinition(_e[1],!1),le.addControl(pe,1,0);var ge=new T;ge.name="Picker Grid",ge.addRowDefinition(.85,!1),ge.addRowDefinition(.15,!1),pe.addControl(ge,0,0),(m=new t).name="GUI Color Picker",i.pickerHeighti.pickerHeight)var Se=xe;else Se=Ce;var Re=new u;Re.text="new",Re.name="New Color Label",Re.color=U,Re.fontSize=Se,Te.addControl(Re,1,0),(M=new s).name="New Color Swatch",M.background=i.lastColor,M.thickness=0,Ee.addControl(M,0,0);var Me=p.CreateSimpleButton("currentSwatch","");Me.background=i.lastColor,Me.thickness=0,Me.onPointerClickObservable.add((function(){K(A.Wo.FromHexString(Me.background),Me.name),J(!1)})),Me.pointerDownAnimation=function(){},Me.pointerUpAnimation=function(){},Me.pointerEnterAnimation=function(){},Me.pointerOutAnimation=function(){},Ee.addControl(Me,1,0);var Pe=new s;Pe.name="Swatch Outline",Pe.width=.67,Pe.thickness=2,Pe.color="#404040",Pe.isHitTestVisible=!1,Te.addControl(Pe,2,0);var Ie=new u;Ie.name="Current Color Label",Ie.text="current",Ie.color=U,Ie.fontSize=Se,Te.addControl(Ie,3,0);var Oe=new T;Oe.name="Button Grid",Oe.height=.8;var De=1/3;Oe.addRowDefinition(De,!1),Oe.addRowDefinition(De,!1),Oe.addRowDefinition(De,!1),ye.addControl(Oe,0,1),c=Math.floor(parseInt(i.pickerWidth)*_e[1]*be[1]*.67).toString()+"px",f=Math.floor(parseInt(i.pickerHeight)*ce[1]*ve[0]*(parseFloat(Oe.height.toString())/100)*De*.7).toString()+"px",a=parseFloat(c)>parseFloat(f)?Math.floor(.45*parseFloat(f)):Math.floor(.11*parseFloat(c));var Le=p.CreateSimpleButton("butOK","OK");Le.width=c,Le.height=f,Le.verticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,Le.thickness=2,Le.color=U,Le.fontSize=a,Le.background=k,Le.onPointerEnterObservable.add((function(){Le.background=V})),Le.onPointerOutObservable.add((function(){Le.background=k})),Le.pointerDownAnimation=function(){Le.background=G},Le.pointerUpAnimation=function(){Le.background=V},Le.onPointerClickObservable.add((function(){J(!1),ie(M.background)})),Oe.addControl(Le,0,0);var we=p.CreateSimpleButton("butCancel","Cancel");if(we.width=c,we.height=f,we.verticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,we.thickness=2,we.color=U,we.fontSize=a,we.background=k,we.onPointerEnterObservable.add((function(){we.background=V})),we.onPointerOutObservable.add((function(){we.background=k})),we.pointerDownAnimation=function(){we.background=G},we.pointerUpAnimation=function(){we.background=V},we.onPointerClickObservable.add((function(){J(!1),ie(Me.background)})),Oe.addControl(we,1,0),i.savedColors){var Ne=p.CreateSimpleButton("butSave","Save");Ne.width=c,Ne.height=f,Ne.verticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,Ne.thickness=2,Ne.fontSize=a,i.savedColors.length0&&ee(!0),Oe.addControl(Ne,2,0)}var Fe=new T;Fe.name="Dialog Lower Right",Fe.addRowDefinition(.02,!1),Fe.addRowDefinition(.63,!1),Fe.addRowDefinition(.21,!1),Fe.addRowDefinition(.14,!1),me.addControl(Fe,1,0),d=A.Wo.FromHexString(i.lastColor);var Be=new T;Be.name="RGB Values",Be.width=.82,Be.verticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,Be.addRowDefinition(1/3,!1),Be.addRowDefinition(1/3,!1),Be.addRowDefinition(1/3,!1),Be.addColumnDefinition(.1,!1),Be.addColumnDefinition(.2,!1),Be.addColumnDefinition(.7,!1),Fe.addControl(Be,1,0);for(ae=0;ae6||t)&&I==R.name)R.text=P;else{if(R.text.length<6)for(var i=6-R.text.length,n=0;n0&&$("",Ne)}))},t._Epsilon=1e-6,t}(l.o);o.Q.RegisteredTypes["BABYLON.GUI.ColorPicker"]=E;var C=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._thickness=1,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"thickness",{get:function(){return this._thickness},set:function(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"Ellipse"},t.prototype._localDraw=function(e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),l.o.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._thickness/2,this._currentMeasure.height/2-this._thickness/2,e),this._background&&(e.fillStyle=this._background,e.fill()),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._thickness&&(this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,e.stroke()),e.restore()},t.prototype._additionalProcessing=function(t,i){e.prototype._additionalProcessing.call(this,t,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},t.prototype._clipForChildren=function(e){l.o.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2,this._currentMeasure.height/2,e),e.clip()},t}(r.W);o.Q.RegisteredTypes["BABYLON.GUI.Ellipse"]=C;var x=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,n.ZT)(t,e),t.prototype._beforeRenderText=function(e){for(var t=new y,i="",n=0;n1?this.notRenderable=!0:this.notRenderable=!1}else f.w1.Error("Cannot move a control to a vector3 if the control is not at root level")},t.prototype._moveToProjectedPosition=function(e,t){void 0===t&&(t=!1);var i=e.x+this._linkOffsetX.getValue(this._host)+"px",n=e.y+this._linkOffsetY.getValue(this._host)+"px";t?(this.x2=i,this.y2=n,this._x2.ignoreAdaptiveScaling=!0,this._y2.ignoreAdaptiveScaling=!0):(this.x1=i,this.y1=n,this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0)},t}(l.o);o.Q.RegisteredTypes["BABYLON.GUI.Line"]=R;var M=i(5385),P=i(2782),I=function(){function e(e){this._multiLine=e,this._x=new c.s(0),this._y=new c.s(0),this._point=new S.P(0,0,0)}return Object.defineProperty(e.prototype,"x",{get:function(){return this._x.toString(this._multiLine._host)},set:function(e){this._x.toString(this._multiLine._host)!==e&&this._x.fromString(e)&&this._multiLine._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this._y.toString(this._multiLine._host)},set:function(e){this._y.toString(this._multiLine._host)!==e&&this._y.fromString(e)&&this._multiLine._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"control",{get:function(){return this._control},set:function(e){this._control!==e&&(this._control&&this._controlObserver&&(this._control.onDirtyObservable.remove(this._controlObserver),this._controlObserver=null),this._control=e,this._control&&(this._controlObserver=this._control.onDirtyObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{get:function(){return this._mesh},set:function(e){this._mesh!==e&&(this._mesh&&this._meshObserver&&this._mesh.getScene().onAfterCameraRenderObservable.remove(this._meshObserver),this._mesh=e,this._mesh&&(this._meshObserver=this._mesh.getScene().onAfterCameraRenderObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype.resetLinks=function(){this.control=null,this.mesh=null},e.prototype.translate=function(){return this._point=this._translatePoint(),this._point},e.prototype._translatePoint=function(){if(null!=this._mesh)return this._multiLine._host.getProjectedPositionWithZ(this._mesh.getBoundingInfo().boundingSphere.center,this._mesh.getWorldMatrix());if(null!=this._control)return new S.P(this._control.centerX,this._control.centerY,1-P.kn);var e=this._multiLine._host,t=this._x.getValueInPixel(e,Number(e._canvas.width)),i=this._y.getValueInPixel(e,Number(e._canvas.height));return new S.P(t,i,1-P.kn)},e.prototype.dispose=function(){this.resetLinks()},e}(),O=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._lineWidth=1,i.onPointUpdate=function(){i._markAsDirty()},i._automaticSize=!0,i.isHitTestVisible=!1,i._horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=l.o.VERTICAL_ALIGNMENT_TOP,i._dash=[],i._points=[],i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"dash",{get:function(){return this._dash},set:function(e){this._dash!==e&&(this._dash=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype.getAt=function(e){return this._points[e]||(this._points[e]=new I(this)),this._points[e]},t.prototype.add=function(){for(var e=this,t=[],i=0;i0;)this.remove(this._points.length-1)},t.prototype.resetLinks=function(){this._points.forEach((function(e){null!=e&&e.resetLinks()}))},Object.defineProperty(t.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(e){this._lineWidth!==e&&(this._lineWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalAlignment",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalAlignment",{set:function(e){},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"MultiLine"},t.prototype._draw=function(e,t){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._applyStates(e),e.strokeStyle=this.color,e.lineWidth=this._lineWidth,e.setLineDash(this._dash),e.beginPath();var i,n=!0;this._points.forEach((function(t){t&&(n?(e.moveTo(t._point.x,t._point.y),n=!1):t._point.z<1&&i.z<1?e.lineTo(t._point.x,t._point.y):e.moveTo(t._point.x,t._point.y),i=t._point)})),e.stroke(),e.restore()},t.prototype._additionalProcessing=function(e,t){var i=this;this._minX=null,this._minY=null,this._maxX=null,this._maxY=null,this._points.forEach((function(e,t){e&&(e.translate(),(null==i._minX||e._point.xi._maxX)&&(i._maxX=e._point.x),(null==i._maxY||e._point.y>i._maxY)&&(i._maxY=e._point.y))})),null==this._minX&&(this._minX=0),null==this._minY&&(this._minY=0),null==this._maxX&&(this._maxX=0),null==this._maxY&&(this._maxY=0)},t.prototype._measure=function(){null!=this._minX&&null!=this._maxX&&null!=this._minY&&null!=this._maxY&&(this._currentMeasure.width=Math.abs(this._maxX-this._minX)+this._lineWidth,this._currentMeasure.height=Math.abs(this._maxY-this._minY)+this._lineWidth)},t.prototype._computeAlignment=function(e,t){null!=this._minX&&null!=this._minY&&(this._currentMeasure.left=this._minX-this._lineWidth/2,this._currentMeasure.top=this._minY-this._lineWidth/2)},t.prototype.dispose=function(){this.reset(),e.prototype.dispose.call(this)},t}(l.o);o.Q.RegisteredTypes["BABYLON.GUI.MultiLine"]=O;var D=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._isChecked=!1,i._background="black",i._checkSizeRatio=.8,i._thickness=1,i.group="",i.onIsCheckedChangedObservable=new h.y$,i.isPointerBlocker=!0,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"thickness",{get:function(){return this._thickness},set:function(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"checkSizeRatio",{get:function(){return this._checkSizeRatio},set:function(e){e=Math.max(Math.min(1,e),0),this._checkSizeRatio!==e&&(this._checkSizeRatio=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isChecked",{get:function(){return this._isChecked},set:function(e){var t=this;this._isChecked!==e&&(this._isChecked=e,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(e),this._isChecked&&this._host&&this._host.executeOnAllControls((function(e){if(e!==t&&void 0!==e.group){var i=e;i.group===t.group&&(i.isChecked=!1)}})))},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"RadioButton"},t.prototype._draw=function(e){e.save(),this._applyStates(e);var t=this._currentMeasure.width-this._thickness,i=this._currentMeasure.height-this._thickness;if((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),l.o.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._thickness/2,this._currentMeasure.height/2-this._thickness/2,e),e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.strokeStyle=this.color,e.lineWidth=this._thickness,e.stroke(),this._isChecked){e.fillStyle=this._isEnabled?this.color:this._disabledColor;var n=t*this._checkSizeRatio,r=i*this._checkSizeRatio;l.o.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,n/2-this._thickness/2,r/2-this._thickness/2,e),e.fill()}e.restore()},t.prototype._onPointerDown=function(t,i,n,r,o){return!!e.prototype._onPointerDown.call(this,t,i,n,r,o)&&(this.isChecked||(this.isChecked=!0),!0)},t.AddRadioButtonWithHeader=function(e,i,n,r){var o=new _;o.isVertical=!1,o.height="30px";var s=new t;s.width="20px",s.height="20px",s.isChecked=n,s.color="green",s.group=i,s.onIsCheckedChangedObservable.add((function(e){return r(s,e)})),o.addControl(s);var a=new u;return a.text=e,a.width="180px",a.paddingLeft="5px",a.textHorizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,a.color="white",o.addControl(a),o},t}(l.o);o.Q.RegisteredTypes["BABYLON.GUI.RadioButton"]=D;var L=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._thumbWidth=new c.s(20,c.s.UNITMODE_PIXEL,!1),i._minimum=0,i._maximum=100,i._value=50,i._isVertical=!1,i._barOffset=new c.s(5,c.s.UNITMODE_PIXEL,!1),i._isThumbClamped=!1,i._displayThumb=!0,i._step=0,i._lastPointerDownID=-1,i._effectiveBarOffset=0,i.onValueChangedObservable=new h.y$,i._pointerIsDown=!1,i.isPointerBlocker=!0,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"displayThumb",{get:function(){return this._displayThumb},set:function(e){this._displayThumb!==e&&(this._displayThumb=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"step",{get:function(){return this._step},set:function(e){this._step!==e&&(this._step=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barOffset",{get:function(){return this._barOffset.toString(this._host)},set:function(e){this._barOffset.toString(this._host)!==e&&this._barOffset.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barOffsetInPixels",{get:function(){return this._barOffset.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbWidth",{get:function(){return this._thumbWidth.toString(this._host)},set:function(e){this._thumbWidth.toString(this._host)!==e&&this._thumbWidth.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbWidthInPixels",{get:function(){return this._thumbWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minimum",{get:function(){return this._minimum},set:function(e){this._minimum!==e&&(this._minimum=e,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maximum",{get:function(){return this._maximum},set:function(e){this._maximum!==e&&(this._maximum=e,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(e){e=Math.max(Math.min(e,this._maximum),this._minimum),this._value!==e&&(this._value=e,this._markAsDirty(),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isVertical",{get:function(){return this._isVertical},set:function(e){this._isVertical!==e&&(this._isVertical=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isThumbClamped",{get:function(){return this._isThumbClamped},set:function(e){this._isThumbClamped!==e&&(this._isThumbClamped=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"BaseSlider"},t.prototype._getThumbPosition=function(){return this.isVertical?(this.maximum-this.value)/(this.maximum-this.minimum)*this._backgroundBoxLength:(this.value-this.minimum)/(this.maximum-this.minimum)*this._backgroundBoxLength},t.prototype._getThumbThickness=function(e){var t=0;switch(e){case"circle":t=this._thumbWidth.isPixel?Math.max(this._thumbWidth.getValue(this._host),this._backgroundBoxThickness):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host);break;case"rectangle":t=this._thumbWidth.isPixel?Math.min(this._thumbWidth.getValue(this._host),this._backgroundBoxThickness):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)}return t},t.prototype._prepareRenderingData=function(e){this._effectiveBarOffset=0,this._renderLeft=this._currentMeasure.left,this._renderTop=this._currentMeasure.top,this._renderWidth=this._currentMeasure.width,this._renderHeight=this._currentMeasure.height,this._backgroundBoxLength=Math.max(this._currentMeasure.width,this._currentMeasure.height),this._backgroundBoxThickness=Math.min(this._currentMeasure.width,this._currentMeasure.height),this._effectiveThumbThickness=this._getThumbThickness(e),this.displayThumb&&(this._backgroundBoxLength-=this._effectiveThumbThickness),this.isVertical&&this._currentMeasure.height=this._selectors.length))return this._selectors[e]},e.prototype.removeSelector=function(e){e<0||e>=this._selectors.length||(this._groupPanel.removeControl(this._selectors[e]),this._selectors.splice(e,1))},e}(),F=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,n.ZT)(t,e),t.prototype.addCheckbox=function(e,t,i){void 0===t&&(t=function(e){}),void 0===i&&(i=!1);i=i||!1;var n=new g;n.width="20px",n.height="20px",n.color="#364249",n.background="#CCCCCC",n.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,n.onIsCheckedChangedObservable.add((function(e){t(e)}));var r=l.o.AddHeader(n,e,"200px",{isHorizontal:!0,controlFirst:!0});r.height="30px",r.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,r.left="4px",this.groupPanel.addControl(r),this.selectors.push(r),n.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(n.color=this.groupPanel.parent.parent.buttonColor,n.background=this.groupPanel.parent.parent.buttonBackground)},t.prototype._setSelectorLabel=function(e,t){this.selectors[e].children[1].text=t},t.prototype._setSelectorLabelColor=function(e,t){this.selectors[e].children[1].color=t},t.prototype._setSelectorButtonColor=function(e,t){this.selectors[e].children[0].color=t},t.prototype._setSelectorButtonBackground=function(e,t){this.selectors[e].children[0].background=t},t}(N),B=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._selectNb=0,t}return(0,n.ZT)(t,e),t.prototype.addRadio=function(e,t,i){void 0===t&&(t=function(e){}),void 0===i&&(i=!1);var n=this._selectNb++,r=new D;r.name=e,r.width="20px",r.height="20px",r.color="#364249",r.background="#CCCCCC",r.group=this.name,r.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,r.onIsCheckedChangedObservable.add((function(e){e&&t(n)}));var o=l.o.AddHeader(r,e,"200px",{isHorizontal:!0,controlFirst:!0});o.height="30px",o.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,o.left="4px",this.groupPanel.addControl(o),this.selectors.push(o),r.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(r.color=this.groupPanel.parent.parent.buttonColor,r.background=this.groupPanel.parent.parent.buttonBackground)},t.prototype._setSelectorLabel=function(e,t){this.selectors[e].children[1].text=t},t.prototype._setSelectorLabelColor=function(e,t){this.selectors[e].children[1].color=t},t.prototype._setSelectorButtonColor=function(e,t){this.selectors[e].children[0].color=t},t.prototype._setSelectorButtonBackground=function(e,t){this.selectors[e].children[0].background=t},t}(N),U=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,n.ZT)(t,e),t.prototype.addSlider=function(e,t,i,n,r,o,s){void 0===t&&(t=function(e){}),void 0===i&&(i="Units"),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s=function(e){return 0|e});var a=new w;a.name=i,a.value=o,a.minimum=n,a.maximum=r,a.width=.9,a.height="20px",a.color="#364249",a.background="#CCCCCC",a.borderColor="black",a.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,a.left="4px",a.paddingBottom="4px",a.onValueChangedObservable.add((function(e){a.parent.children[0].text=a.parent.children[0].name+": "+s(e)+" "+a.name,t(e)}));var h=l.o.AddHeader(a,e+": "+s(o)+" "+i,"30px",{isHorizontal:!1,controlFirst:!1});h.height="60px",h.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,h.left="4px",h.children[0].name=e,this.groupPanel.addControl(h),this.selectors.push(h),this.groupPanel.parent&&this.groupPanel.parent.parent&&(a.color=this.groupPanel.parent.parent.buttonColor,a.background=this.groupPanel.parent.parent.buttonBackground)},t.prototype._setSelectorLabel=function(e,t){this.selectors[e].children[0].name=t,this.selectors[e].children[0].text=t+": "+this.selectors[e].children[1].value+" "+this.selectors[e].children[1].name},t.prototype._setSelectorLabelColor=function(e,t){this.selectors[e].children[0].color=t},t.prototype._setSelectorButtonColor=function(e,t){this.selectors[e].children[1].color=t},t.prototype._setSelectorButtonBackground=function(e,t){this.selectors[e].children[1].background=t},t}(N),k=function(e){function t(t,i){void 0===i&&(i=[]);var n=e.call(this,t)||this;if(n.name=t,n.groups=i,n._buttonColor="#364249",n._buttonBackground="#CCCCCC",n._headerColor="black",n._barColor="white",n._barHeight="2px",n._spacerHeight="20px",n._bars=new Array,n._groups=i,n.thickness=2,n._panel=new _,n._panel.verticalAlignment=l.o.VERTICAL_ALIGNMENT_TOP,n._panel.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,n._panel.top=5,n._panel.left=5,n._panel.width=.95,i.length>0){for(var r=0;r0&&this._addSpacer(),this._panel.addControl(e.groupPanel),this._groups.push(e),e.groupPanel.children[0].color=this._headerColor;for(var t=0;t=this._groups.length)){var t=this._groups[e];this._panel.removeControl(t.groupPanel),this._groups.splice(e,1),e=this._groups.length||(this._groups[t].groupPanel.children[0].text=e)},t.prototype.relabel=function(e,t,i){if(!(t<0||t>=this._groups.length)){var n=this._groups[t];i<0||i>=n.selectors.length||n._setSelectorLabel(i,e)}},t.prototype.removeFromGroupSelector=function(e,t){if(!(e<0||e>=this._groups.length)){var i=this._groups[e];t<0||t>=i.selectors.length||i.removeSelector(t)}},t.prototype.addToGroupCheckbox=function(e,t,i,n){(void 0===i&&(i=function(){}),void 0===n&&(n=!1),e<0||e>=this._groups.length)||this._groups[e].addCheckbox(t,i,n)},t.prototype.addToGroupRadio=function(e,t,i,n){(void 0===i&&(i=function(){}),void 0===n&&(n=!1),e<0||e>=this._groups.length)||this._groups[e].addRadio(t,i,n)},t.prototype.addToGroupSlider=function(e,t,i,n,r,o,s,a){(void 0===i&&(i=function(){}),void 0===n&&(n="Units"),void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===a&&(a=function(e){return 0|e}),e<0||e>=this._groups.length)||this._groups[e].addSlider(t,i,n,r,o,s,a)},t}(s),V=i(5958),G=function(e){function t(t){var i=e.call(this,t)||this;return i._freezeControls=!1,i._bucketWidth=0,i._bucketHeight=0,i._buckets={},i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"freezeControls",{get:function(){return this._freezeControls},set:function(e){if(this._freezeControls!==e){e||this._restoreMeasures(),this._freezeControls=!1;var t=this.host.getSize(),i=t.width,n=t.height,r=this.host.getContext(),o=new V.U(0,0,i,n);this.host._numLayoutCalls=0,this.host._rootContainer._layout(o,r),e&&(this._updateMeasures(),this._useBuckets()&&this._makeBuckets()),this._freezeControls=e,this.host.markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bucketWidth",{get:function(){return this._bucketWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bucketHeight",{get:function(){return this._bucketHeight},enumerable:!1,configurable:!0}),t.prototype.setBucketSizes=function(e,t){this._bucketWidth=e,this._bucketHeight=t,this._useBuckets()?this._freezeControls&&this._makeBuckets():this._buckets={}},t.prototype._useBuckets=function(){return this._bucketWidth>0&&this._bucketHeight>0},t.prototype._makeBuckets=function(){this._buckets={},this._bucketLen=Math.ceil(this.widthInPixels/this._bucketWidth),this._dispatchInBuckets(this._children),this._oldLeft=null,this._oldTop=null},t.prototype._dispatchInBuckets=function(e){for(var t=0;t0&&this._dispatchInBuckets(i._children)}},t.prototype._updateMeasures=function(){var e=0|this.leftInPixels,t=0|this.topInPixels;this._measureForChildren.left-=e,this._measureForChildren.top-=t,this._currentMeasure.left-=e,this._currentMeasure.top-=t,this._customData.origLeftForChildren=this._measureForChildren.left,this._customData.origTopForChildren=this._measureForChildren.top,this._customData.origLeft=this._currentMeasure.left,this._customData.origTop=this._currentMeasure.top,this._updateChildrenMeasures(this._children,e,t)},t.prototype._updateChildrenMeasures=function(e,t,i){for(var n=0;n0&&this._updateChildrenMeasures(o._children,t,i)}},t.prototype._restoreMeasures=function(){var e=0|this.leftInPixels,t=0|this.topInPixels;this._measureForChildren.left=this._customData.origLeftForChildren+e,this._measureForChildren.top=this._customData.origTopForChildren+t,this._currentMeasure.left=this._customData.origLeft+e,this._currentMeasure.top=this._customData.origTop+t},t.prototype._getTypeName=function(){return"ScrollViewerWindow"},t.prototype._additionalProcessing=function(t,i){e.prototype._additionalProcessing.call(this,t,i),this._parentMeasure=t,this._measureForChildren.left=this._currentMeasure.left,this._measureForChildren.top=this._currentMeasure.top,this._measureForChildren.width=t.width,this._measureForChildren.height=t.height},t.prototype._layout=function(t,i){return this._freezeControls?(this.invalidateRect(),!1):e.prototype._layout.call(this,t,i)},t.prototype._scrollChildren=function(e,t,i){for(var n=0;n0&&this._scrollChildren(o._children,t,i)}},t.prototype._scrollChildrenWithBuckets=function(e,t,i,n){for(var r=Math.max(0,Math.floor(-e/this._bucketWidth)),o=Math.floor((-e+this._parentMeasure.width-1)/this._bucketWidth),s=Math.max(0,Math.floor(-t/this._bucketHeight)),a=Math.floor((-t+this._parentMeasure.height-1)/this._bucketHeight);s<=a;){for(var l=r;l<=o;++l){var h=s*this._bucketLen+l,c=this._buckets[h];if(c)for(var u=0;uthis._tempMeasure.left+this._tempMeasure.width||tthis._tempMeasure.top+this._tempMeasure.height)&&(this.isVertical?this.value=this.minimum+(1-(t-this._currentMeasure.top)/this._currentMeasure.height)*(this.maximum-this.minimum):this.value=this.minimum+(e-this._currentMeasure.left)/this._currentMeasure.width*(this.maximum-this.minimum)));var i=0;i=this.isVertical?-(t-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(e-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*(this.maximum-this.minimum),this._originX=e,this._originY=t},t.prototype._onPointerDown=function(t,i,n,r,o){return this._first=!0,e.prototype._onPointerDown.call(this,t,i,n,r,o)},t}(L),z=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._thumbLength=.5,i._thumbHeight=1,i._barImageHeight=1,i._tempMeasure=new V.U(0,0,0,0),i.num90RotationInVerticalMode=1,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"backgroundImage",{get:function(){return this._backgroundBaseImage},set:function(e){var t=this;this._backgroundBaseImage!==e&&(this._backgroundBaseImage=e,this.isVertical&&0!==this.num90RotationInVerticalMode?e.isLoaded?(this._backgroundImage=e._rotate90(this.num90RotationInVerticalMode,!0),this._markAsDirty()):e.onImageLoadedObservable.addOnce((function(){var i=e._rotate90(t.num90RotationInVerticalMode,!0);t._backgroundImage=i,i.isLoaded||i.onImageLoadedObservable.addOnce((function(){t._markAsDirty()})),t._markAsDirty()})):(this._backgroundImage=e,e&&!e.isLoaded&&e.onImageLoadedObservable.addOnce((function(){t._markAsDirty()})),this._markAsDirty()))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbImage",{get:function(){return this._thumbBaseImage},set:function(e){var t=this;this._thumbBaseImage!==e&&(this._thumbBaseImage=e,this.isVertical&&0!==this.num90RotationInVerticalMode?e.isLoaded?(this._thumbImage=e._rotate90(-this.num90RotationInVerticalMode,!0),this._markAsDirty()):e.onImageLoadedObservable.addOnce((function(){var i=e._rotate90(-t.num90RotationInVerticalMode,!0);t._thumbImage=i,i.isLoaded||i.onImageLoadedObservable.addOnce((function(){t._markAsDirty()})),t._markAsDirty()})):(this._thumbImage=e,e&&!e.isLoaded&&e.onImageLoadedObservable.addOnce((function(){t._markAsDirty()})),this._markAsDirty()))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbLength",{get:function(){return this._thumbLength},set:function(e){this._thumbLength!==e&&(this._thumbLength=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbHeight",{get:function(){return this._thumbHeight},set:function(e){this._thumbLength!==e&&(this._thumbHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barImageHeight",{get:function(){return this._barImageHeight},set:function(e){this._barImageHeight!==e&&(this._barImageHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"ImageScrollBar"},t.prototype._getThumbThickness=function(){return this._thumbWidth.isPixel?this._thumbWidth.getValue(this._host):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)},t.prototype._draw=function(e){e.save(),this._applyStates(e),this._prepareRenderingData("rectangle");var t=this._getThumbPosition(),i=this._renderLeft,n=this._renderTop,r=this._renderWidth,o=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,n,r,o),this.isVertical?(this._tempMeasure.copyFromFloats(i+r*(1-this._barImageHeight)*.5,this._currentMeasure.top,r*this._barImageHeight,o),this._tempMeasure.height+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)):(this._tempMeasure.copyFromFloats(this._currentMeasure.left,n+o*(1-this._barImageHeight)*.5,r,o*this._barImageHeight),this._tempMeasure.width+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)),this._backgroundImage._draw(e)),this.isVertical?this._tempMeasure.copyFromFloats(i-this._effectiveBarOffset+this._currentMeasure.width*(1-this._thumbHeight)*.5,this._currentMeasure.top+t,this._currentMeasure.width*this._thumbHeight,this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(this._currentMeasure.left+t,this._currentMeasure.top+this._currentMeasure.height*(1-this._thumbHeight)*.5,this._effectiveThumbThickness,this._currentMeasure.height*this._thumbHeight),this._thumbImage&&(this._thumbImage._currentMeasure.copyFrom(this._tempMeasure),this._thumbImage._draw(e)),e.restore()},t.prototype._updateValueFromPointer=function(e,t){0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(e,t,this._transformedPosition),e=this._transformedPosition.x,t=this._transformedPosition.y),this._first&&(this._first=!1,this._originX=e,this._originY=t,(ethis._tempMeasure.left+this._tempMeasure.width||tthis._tempMeasure.top+this._tempMeasure.height)&&(this.isVertical?this.value=this.minimum+(1-(t-this._currentMeasure.top)/this._currentMeasure.height)*(this.maximum-this.minimum):this.value=this.minimum+(e-this._currentMeasure.left)/this._currentMeasure.width*(this.maximum-this.minimum)));var i=0;i=this.isVertical?-(t-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(e-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*(this.maximum-this.minimum),this._originX=e,this._originY=t},t.prototype._onPointerDown=function(t,i,n,r,o){return this._first=!0,e.prototype._onPointerDown.call(this,t,i,n,r,o)},t}(L),W=function(e){function t(t,i){var n=e.call(this,t)||this;return n._barSize=20,n._pointerIsOver=!1,n._wheelPrecision=.05,n._thumbLength=.5,n._thumbHeight=1,n._barImageHeight=1,n._horizontalBarImageHeight=1,n._verticalBarImageHeight=1,n._oldWindowContentsWidth=0,n._oldWindowContentsHeight=0,n._forceHorizontalBar=!1,n._forceVerticalBar=!1,n._useImageBar=i||!1,n.onDirtyObservable.add((function(){n._horizontalBarSpace.color=n.color,n._verticalBarSpace.color=n.color,n._dragSpace.color=n.color})),n.onPointerEnterObservable.add((function(){n._pointerIsOver=!0})),n.onPointerOutObservable.add((function(){n._pointerIsOver=!1})),n._grid=new T,n._useImageBar?(n._horizontalBar=new z,n._verticalBar=new z):(n._horizontalBar=new H,n._verticalBar=new H),n._window=new G("scrollViewer_window"),n._window.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,n._window.verticalAlignment=l.o.VERTICAL_ALIGNMENT_TOP,n._grid.addColumnDefinition(1),n._grid.addColumnDefinition(0,!0),n._grid.addRowDefinition(1),n._grid.addRowDefinition(0,!0),e.prototype.addControl.call(n,n._grid),n._grid.addControl(n._window,0,0),n._verticalBarSpace=new s,n._verticalBarSpace.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,n._verticalBarSpace.verticalAlignment=l.o.VERTICAL_ALIGNMENT_TOP,n._verticalBarSpace.thickness=1,n._grid.addControl(n._verticalBarSpace,0,1),n._addBar(n._verticalBar,n._verticalBarSpace,!0,Math.PI),n._horizontalBarSpace=new s,n._horizontalBarSpace.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,n._horizontalBarSpace.verticalAlignment=l.o.VERTICAL_ALIGNMENT_TOP,n._horizontalBarSpace.thickness=1,n._grid.addControl(n._horizontalBarSpace,1,0),n._addBar(n._horizontalBar,n._horizontalBarSpace,!1,0),n._dragSpace=new s,n._dragSpace.thickness=1,n._grid.addControl(n._dragSpace,1,1),n._useImageBar||(n.barColor="grey",n.barBackground="transparent"),n}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"horizontalBar",{get:function(){return this._horizontalBar},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalBar",{get:function(){return this._verticalBar},enumerable:!1,configurable:!0}),t.prototype.addControl=function(e){return e?(this._window.addControl(e),this):this},t.prototype.removeControl=function(e){return this._window.removeControl(e),this},Object.defineProperty(t.prototype,"children",{get:function(){return this._window.children},enumerable:!1,configurable:!0}),t.prototype._flagDescendantsAsMatrixDirty=function(){for(var e=0,t=this._children;e1&&(e=1),this._wheelPrecision=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scrollBackground",{get:function(){return this._horizontalBarSpace.background},set:function(e){this._horizontalBarSpace.background!==e&&(this._horizontalBarSpace.background=e,this._verticalBarSpace.background=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barColor",{get:function(){return this._barColor},set:function(e){this._barColor!==e&&(this._barColor=e,this._horizontalBar.color=e,this._verticalBar.color=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbImage",{get:function(){return this._barImage},set:function(e){if(this._barImage!==e){this._barImage=e;var t=this._horizontalBar,i=this._verticalBar;t.thumbImage=e,i.thumbImage=e}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalThumbImage",{get:function(){return this._horizontalBarImage},set:function(e){this._horizontalBarImage!==e&&(this._horizontalBarImage=e,this._horizontalBar.thumbImage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalThumbImage",{get:function(){return this._verticalBarImage},set:function(e){this._verticalBarImage!==e&&(this._verticalBarImage=e,this._verticalBar.thumbImage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barSize",{get:function(){return this._barSize},set:function(e){this._barSize!==e&&(this._barSize=e,this._markAsDirty(),this._horizontalBar.isVisible&&this._grid.setRowDefinition(1,this._barSize,!0),this._verticalBar.isVisible&&this._grid.setColumnDefinition(1,this._barSize,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbLength",{get:function(){return this._thumbLength},set:function(e){if(this._thumbLength!==e){e<=0&&(e=.1),e>1&&(e=1),this._thumbLength=e;var t=this._horizontalBar,i=this._verticalBar;t.thumbLength=e,i.thumbLength=e,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbHeight",{get:function(){return this._thumbHeight},set:function(e){if(this._thumbHeight!==e){e<=0&&(e=.1),e>1&&(e=1),this._thumbHeight=e;var t=this._horizontalBar,i=this._verticalBar;t.thumbHeight=e,i.thumbHeight=e,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barImageHeight",{get:function(){return this._barImageHeight},set:function(e){if(this._barImageHeight!==e){e<=0&&(e=.1),e>1&&(e=1),this._barImageHeight=e;var t=this._horizontalBar,i=this._verticalBar;t.barImageHeight=e,i.barImageHeight=e,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalBarImageHeight",{get:function(){return this._horizontalBarImageHeight},set:function(e){this._horizontalBarImageHeight!==e&&(e<=0&&(e=.1),e>1&&(e=1),this._horizontalBarImageHeight=e,this._horizontalBar.barImageHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalBarImageHeight",{get:function(){return this._verticalBarImageHeight},set:function(e){this._verticalBarImageHeight!==e&&(e<=0&&(e=.1),e>1&&(e=1),this._verticalBarImageHeight=e,this._verticalBar.barImageHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barBackground",{get:function(){return this._barBackground},set:function(e){if(this._barBackground!==e){this._barBackground=e;var t=this._horizontalBar,i=this._verticalBar;t.background=e,i.background=e,this._dragSpace.background=e}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barImage",{get:function(){return this._barBackgroundImage},set:function(e){this._barBackgroundImage,this._barBackgroundImage=e;var t=this._horizontalBar,i=this._verticalBar;t.backgroundImage=e,i.backgroundImage=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalBarImage",{get:function(){return this._horizontalBarBackgroundImage},set:function(e){this._horizontalBarBackgroundImage,this._horizontalBarBackgroundImage=e,this._horizontalBar.backgroundImage=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalBarImage",{get:function(){return this._verticalBarBackgroundImage},set:function(e){this._verticalBarBackgroundImage,this._verticalBarBackgroundImage=e,this._verticalBar.backgroundImage=e},enumerable:!1,configurable:!0}),t.prototype._setWindowPosition=function(e){void 0===e&&(e=!0);var t=this.host.idealRatio,i=this._window._currentMeasure.width,n=this._window._currentMeasure.height;if(e||this._oldWindowContentsWidth!==i||this._oldWindowContentsHeight!==n){this._oldWindowContentsWidth=i,this._oldWindowContentsHeight=n;var r=this._clientWidth-i,o=this._clientHeight-n,s=this._horizontalBar.value/t*r+"px",a=this._verticalBar.value/t*o+"px";s!==this._window.left&&(this._window.left=s,this.freezeControls||(this._rebuildLayout=!0)),a!==this._window.top&&(this._window.top=a,this.freezeControls||(this._rebuildLayout=!0))}},t.prototype._updateScroller=function(){var e=this._window._currentMeasure.width,t=this._window._currentMeasure.height;this._horizontalBar.isVisible&&e<=this._clientWidth&&!this.forceHorizontalBar?(this._grid.setRowDefinition(1,0,!0),this._horizontalBar.isVisible=!1,this._horizontalBar.value=0,this._rebuildLayout=!0):!this._horizontalBar.isVisible&&(e>this._clientWidth||this.forceHorizontalBar)&&(this._grid.setRowDefinition(1,this._barSize,!0),this._horizontalBar.isVisible=!0,this._rebuildLayout=!0),this._verticalBar.isVisible&&t<=this._clientHeight&&!this.forceVerticalBar?(this._grid.setColumnDefinition(1,0,!0),this._verticalBar.isVisible=!1,this._verticalBar.value=0,this._rebuildLayout=!0):!this._verticalBar.isVisible&&(t>this._clientHeight||this.forceVerticalBar)&&(this._grid.setColumnDefinition(1,this._barSize,!0),this._verticalBar.isVisible=!0,this._rebuildLayout=!0),this._buildClientSizes();var i=this.host.idealRatio;this._horizontalBar.thumbWidth=.9*this._thumbLength*(this._clientWidth/i)+"px",this._verticalBar.thumbWidth=.9*this._thumbLength*(this._clientHeight/i)+"px"},t.prototype._link=function(t){e.prototype._link.call(this,t),this._attachWheel()},t.prototype._addBar=function(e,t,i,n){var r=this;e.paddingLeft=0,e.width="100%",e.height="100%",e.barOffset=0,e.value=0,e.maximum=1,e.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_CENTER,e.verticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,e.isVertical=i,e.rotation=n,e.isVisible=!1,t.addControl(e),e.onValueChangedObservable.add((function(e){r._setWindowPosition()}))},t.prototype._attachWheel=function(){var e=this;this._host&&!this._onWheelObserver&&(this._onWheelObserver=this.onWheelObservable.add((function(t){e._pointerIsOver&&(1==e._verticalBar.isVisible&&(t.y<0&&e._verticalBar.value>0?e._verticalBar.value-=e._wheelPrecision:t.y>0&&e._verticalBar.value0&&e._horizontalBar.value>0&&(e._horizontalBar.value-=e._wheelPrecision)))})))},t.prototype._renderHighlightSpecific=function(t){this.isHighlighted&&(e.prototype._renderHighlightSpecific.call(this,t),this._grid._renderHighlightSpecific(t),t.restore())},t.prototype.dispose=function(){this.onWheelObservable.remove(this._onWheelObserver),this._onWheelObserver=null,e.prototype.dispose.call(this)},t}(s);o.Q.RegisteredTypes["BABYLON.GUI.ScrollViewer"]=W;var X=function(){},j=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onKeyPressObservable=new h.y$,t.defaultButtonWidth="40px",t.defaultButtonHeight="40px",t.defaultButtonPaddingLeft="2px",t.defaultButtonPaddingRight="2px",t.defaultButtonPaddingTop="2px",t.defaultButtonPaddingBottom="2px",t.defaultButtonColor="#DDD",t.defaultButtonBackground="#070707",t.shiftButtonColor="#7799FF",t.selectedShiftThickness=1,t.shiftState=0,t._currentlyConnectedInputText=null,t._connectedInputTexts=[],t._onKeyPressObserver=null,t}return(0,n.ZT)(t,e),t.prototype._getTypeName=function(){return"VirtualKeyboard"},t.prototype._createKey=function(e,t){var i=this,n=p.CreateSimpleButton(e,e);return n.width=t&&t.width?t.width:this.defaultButtonWidth,n.height=t&&t.height?t.height:this.defaultButtonHeight,n.color=t&&t.color?t.color:this.defaultButtonColor,n.background=t&&t.background?t.background:this.defaultButtonBackground,n.paddingLeft=t&&t.paddingLeft?t.paddingLeft:this.defaultButtonPaddingLeft,n.paddingRight=t&&t.paddingRight?t.paddingRight:this.defaultButtonPaddingRight,n.paddingTop=t&&t.paddingTop?t.paddingTop:this.defaultButtonPaddingTop,n.paddingBottom=t&&t.paddingBottom?t.paddingBottom:this.defaultButtonPaddingBottom,n.thickness=0,n.isFocusInvisible=!0,n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY,n.onPointerUpObservable.add((function(){i.onKeyPressObservable.notifyObservers(e)})),n},t.prototype.addKeysRow=function(e,t){var i=new _;i.isVertical=!1,i.isFocusInvisible=!0;for(var n=null,r=0;rn.heightInPixels)&&(n=s),i.addControl(s)}i.height=n?n.height:this.defaultButtonHeight,this.addControl(i)},t.prototype.applyShiftState=function(e){if(this.children)for(var t=0;t1?this.selectedShiftThickness:0),s.text=e>0?s.text.toUpperCase():s.text.toLowerCase()}}}},Object.defineProperty(t.prototype,"connectedInputText",{get:function(){return this._currentlyConnectedInputText},enumerable:!1,configurable:!0}),t.prototype.connect=function(e){var t=this;if(!this._connectedInputTexts.some((function(t){return t.input===e}))){null===this._onKeyPressObserver&&(this._onKeyPressObserver=this.onKeyPressObservable.add((function(e){if(t._currentlyConnectedInputText){switch(t._currentlyConnectedInputText._host.focusedControl=t._currentlyConnectedInputText,e){case"⇧":return t.shiftState++,t.shiftState>2&&(t.shiftState=0),void t.applyShiftState(t.shiftState);case"←":return void t._currentlyConnectedInputText.processKey(8);case"↵":return void t._currentlyConnectedInputText.processKey(13)}t._currentlyConnectedInputText.processKey(-1,t.shiftState?e.toUpperCase():e),1===t.shiftState&&(t.shiftState=0,t.applyShiftState(t.shiftState))}}))),this.isVisible=!1,this._currentlyConnectedInputText=e,e._connectedVirtualKeyboard=this;var i=e.onFocusObservable.add((function(){t._currentlyConnectedInputText=e,e._connectedVirtualKeyboard=t,t.isVisible=!0})),n=e.onBlurObservable.add((function(){e._connectedVirtualKeyboard=null,t._currentlyConnectedInputText=null,t.isVisible=!1}));this._connectedInputTexts.push({input:e,onBlurObserver:n,onFocusObserver:i})}},t.prototype.disconnect=function(e){var t=this;if(e){var i=this._connectedInputTexts.filter((function(t){return t.input===e}));1===i.length&&(this._removeConnectedInputObservables(i[0]),this._connectedInputTexts=this._connectedInputTexts.filter((function(t){return t.input!==e})),this._currentlyConnectedInputText===e&&(this._currentlyConnectedInputText=null))}else this._connectedInputTexts.forEach((function(e){t._removeConnectedInputObservables(e)})),this._connectedInputTexts=[];0===this._connectedInputTexts.length&&(this._currentlyConnectedInputText=null,this.onKeyPressObservable.remove(this._onKeyPressObserver),this._onKeyPressObserver=null)},t.prototype._removeConnectedInputObservables=function(e){e.input._connectedVirtualKeyboard=null,e.input.onFocusObservable.remove(e.onFocusObserver),e.input.onBlurObservable.remove(e.onBlurObserver)},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.disconnect()},t.CreateDefaultLayout=function(e){var i=new t(e);return i.addKeysRow(["1","2","3","4","5","6","7","8","9","0","←"]),i.addKeysRow(["q","w","e","r","t","y","u","i","o","p"]),i.addKeysRow(["a","s","d","f","g","h","j","k","l",";","'","↵"]),i.addKeysRow(["⇧","z","x","c","v","b","n","m",",",".","/"]),i.addKeysRow([" "],[{width:"200px"}]),i},t}(_);o.Q.RegisteredTypes["BABYLON.GUI.VirtualKeyboard"]=j;var Y=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._cellWidth=20,i._cellHeight=20,i._minorLineTickness=1,i._minorLineColor="DarkGray",i._majorLineTickness=2,i._majorLineColor="White",i._majorLineFrequency=5,i._background="Black",i._displayMajorLines=!0,i._displayMinorLines=!0,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"displayMinorLines",{get:function(){return this._displayMinorLines},set:function(e){this._displayMinorLines!==e&&(this._displayMinorLines=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"displayMajorLines",{get:function(){return this._displayMajorLines},set:function(e){this._displayMajorLines!==e&&(this._displayMajorLines=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(e){this._cellWidth=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(e){this._cellHeight=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorLineTickness",{get:function(){return this._minorLineTickness},set:function(e){this._minorLineTickness=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorLineColor",{get:function(){return this._minorLineColor},set:function(e){this._minorLineColor=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorLineTickness",{get:function(){return this._majorLineTickness},set:function(e){this._majorLineTickness=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorLineColor",{get:function(){return this._majorLineColor},set:function(e){this._majorLineColor=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorLineFrequency",{get:function(){return this._majorLineFrequency},set:function(e){this._majorLineFrequency=e,this._markAsDirty()},enumerable:!1,configurable:!0}),t.prototype._draw=function(e,t){if(e.save(),this._applyStates(e),this._isEnabled){this._background&&(e.fillStyle=this._background,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height));var i=this._currentMeasure.width/this._cellWidth,n=this._currentMeasure.height/this._cellHeight,r=this._currentMeasure.left+this._currentMeasure.width/2,o=this._currentMeasure.top+this._currentMeasure.height/2;if(this._displayMinorLines){e.strokeStyle=this._minorLineColor,e.lineWidth=this._minorLineTickness;for(var s=-i/2;s{"use strict";i.d(t,{U:()=>l});var n=i(2973),r=[new n.FM(0,0),new n.FM(0,0),new n.FM(0,0),new n.FM(0,0)],o=[new n.FM(0,0),new n.FM(0,0),new n.FM(0,0),new n.FM(0,0)],s=new n.FM(0,0),a=new n.FM(0,0),l=function(){function e(e,t,i,n){this.left=e,this.top=t,this.width=i,this.height=n}return e.prototype.copyFrom=function(e){this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height},e.prototype.copyFromFloats=function(e,t,i,n){this.left=e,this.top=t,this.width=i,this.height=n},e.CombineToRef=function(e,t,i){var n=Math.min(e.left,t.left),r=Math.min(e.top,t.top),o=Math.max(e.left+e.width,t.left+t.width),s=Math.max(e.top+e.height,t.top+t.height);i.left=n,i.top=r,i.width=o-n,i.height=s-r},e.prototype.addAndTransformToRef=function(e,t,i,n,l,h){var c=this.left+t,u=this.top+i,f=this.width+n,d=this.height+l;r[0].copyFromFloats(c,u),r[1].copyFromFloats(c+f,u),r[2].copyFromFloats(c+f,u+d),r[3].copyFromFloats(c,u+d),s.copyFromFloats(Number.MAX_VALUE,Number.MAX_VALUE),a.copyFromFloats(0,0);for(var p=0;p<4;p++)e.transformCoordinates(r[p].x,r[p].y,o[p]),s.x=Math.floor(Math.min(s.x,o[p].x)),s.y=Math.floor(Math.min(s.y,o[p].y)),a.x=Math.ceil(Math.max(a.x,o[p].x)),a.y=Math.ceil(Math.max(a.y,o[p].y));h.left=s.x,h.top=s.y,h.width=a.x-s.x,h.height=a.y-s.y},e.prototype.transformToRef=function(e,t){this.addAndTransformToRef(e,0,0,0,0,t)},e.prototype.isEqualsTo=function(e){return this.left===e.left&&(this.top===e.top&&(this.width===e.width&&this.height===e.height))},e.Empty=function(){return new e(0,0,0,0)},e}()},4872:(e,t,i)=>{"use strict";i.d(t,{s:()=>n});var n=function(){function e(t,i,n){void 0===i&&(i=e.UNITMODE_PIXEL),void 0===n&&(n=!0),this.unit=i,this.negativeValueAllowed=n,this._value=1,this.ignoreAdaptiveScaling=!1,this._value=t,this._originalUnit=i}return Object.defineProperty(e.prototype,"isPercentage",{get:function(){return this.unit===e.UNITMODE_PERCENTAGE},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPixel",{get:function(){return this.unit===e.UNITMODE_PIXEL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"internalValue",{get:function(){return this._value},enumerable:!1,configurable:!0}),e.prototype.getValueInPixel=function(e,t){return this.isPixel?this.getValue(e):this.getValue(e)*t},e.prototype.updateInPlace=function(t,i){return void 0===i&&(i=e.UNITMODE_PIXEL),this._value=t,this.unit=i,this},e.prototype.getValue=function(t){if(t&&!this.ignoreAdaptiveScaling&&this.unit!==e.UNITMODE_PERCENTAGE){var i=0,n=0;if(t.idealWidth&&(i=this._value*t.getSize().width/t.idealWidth),t.idealHeight&&(n=this._value*t.getSize().height/t.idealHeight),t.useSmallestIdeal&&t.idealWidth&&t.idealHeight)return window.innerWidth{"use strict";i.r(t),i.d(t,{GLTF1:()=>n,GLTF2:()=>r,GLTFFileLoader:()=>D,GLTFLoaderAnimationStartMode:()=>T,GLTFLoaderCoordinateSystemMode:()=>b,GLTFLoaderState:()=>A,GLTFValidation:()=>E});var n={};i.r(n),i.d(n,{EBlendingFunction:()=>O,EComponentType:()=>C,ECullingType:()=>I,EParameterType:()=>S,EShaderType:()=>x,ETextureFilterType:()=>M,ETextureFormat:()=>P,ETextureWrapMode:()=>R,GLTFBinaryExtension:()=>tt,GLTFLoader:()=>$e,GLTFLoaderBase:()=>Je,GLTFLoaderExtension:()=>et,GLTFMaterialsCommonExtension:()=>it,GLTFUtils:()=>Me});var r={};i.r(r),i.d(r,{ArrayItem:()=>Vi,EXT_lights_image_based:()=>Yi,EXT_mesh_gpu_instancing:()=>qi,EXT_texture_webp:()=>Qi,ExtrasAsMetadata:()=>Yn,GLTFLoader:()=>Gi,KHR_draco_mesh_compression:()=>on,KHR_lights:()=>an,KHR_materials_clearcoat:()=>dn,KHR_materials_ior:()=>yn,KHR_materials_pbrSpecularGlossiness:()=>hn,KHR_materials_sheen:()=>_n,KHR_materials_specular:()=>mn,KHR_materials_translucency:()=>Rn,KHR_materials_transmission:()=>xn,KHR_materials_unlit:()=>un,KHR_materials_variants:()=>Tn,KHR_mesh_quantization:()=>Pn,KHR_texture_basisu:()=>On,KHR_texture_transform:()=>Ln,MSFT_audio_emitter:()=>kn,MSFT_lod:()=>Gn,MSFT_minecraftMesh:()=>zn,MSFT_sRGBFactors:()=>Xn});var o=i(475),s=i(5540),a=i(7595),l=i(655),h=i(2611),c=i(6212),u=i(3734),f=i(2733),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,l.ZT)(t,e),t}(h.p),p=function(){this.rootNodes=[],this.skeletons=[],this.animationGroups=[]},_=function(e){function t(t){var i=e.call(this)||this;return i._wasAddedToScene=!1,i.scene=t,i.sounds=[],i.effectLayers=[],i.layers=[],i.lensFlareSystems=[],i.proceduralTextures=[],i.reflectionProbes=[],t.onDisposeObservable.add((function(){i._wasAddedToScene||i.dispose()})),i}return(0,l.ZT)(t,e),t.prototype.instantiateModelsToScene=function(e,t){var i=this;void 0===t&&(t=!1);var n={},r={},o=new p,s=[],a=[],l={doNotInstantiate:!0},h=function(t,i){if(n[t.uniqueId]=i.uniqueId,r[i.uniqueId]=i,e&&(i.name=e(t.name)),i instanceof c.Mesh){var o=i;if(o.morphTargetManager){var s=t.morphTargetManager;o.morphTargetManager=s.clone();for(var a=0;a-1&&t.animations.splice(o,1)}},r=0,o=e.animations;r-1&&s.materials.splice(t,1),(t=a.indexOf(e))>-1&&a.splice(t,1)}))}));var l=[];o.onTextureLoadedObservable.add((function(e){l.push(e),e.onDisposeObservable.addOnce((function(){var t=s.textures.indexOf(e);t>-1&&s.textures.splice(t,1),(t=l.indexOf(e))>-1&&l.splice(t,1)}))}));var h=[];return o.onCameraLoadedObservable.add((function(e){h.push(e)})),o._loader.importMeshAsync(null,e,!0,t,i,n,r).then((function(e){return Array.prototype.push.apply(s.geometries,e.geometries),Array.prototype.push.apply(s.meshes,e.meshes),Array.prototype.push.apply(s.particleSystems,e.particleSystems),Array.prototype.push.apply(s.skeletons,e.skeletons),Array.prototype.push.apply(s.animationGroups,e.animationGroups),Array.prototype.push.apply(s.materials,a),Array.prototype.push.apply(s.textures,l),Array.prototype.push.apply(s.lights,e.lights),Array.prototype.push.apply(s.transformNodes,e.transformNodes),Array.prototype.push.apply(s.cameras,h),s}))}))},e.prototype.canDirectLoad=function(t){return-1!==t.indexOf("asset")&&-1!==t.indexOf("version")||g.M.StartsWith(t,"data:base64,"+e.magicBase64Encoded)||g.M.StartsWith(t,"data:application/octet-stream;base64,"+e.magicBase64Encoded)||g.M.StartsWith(t,"data:model/gltf-binary;base64,"+e.magicBase64Encoded)},e.prototype.directLoad=function(t,i){if(g.M.StartsWith(i,"base64,"+e.magicBase64Encoded)||g.M.StartsWith(i,"application/octet-stream;base64,"+e.magicBase64Encoded)||g.M.StartsWith(i,"model/gltf-binary;base64,"+e.magicBase64Encoded)){var n=s.w1.DecodeBase64(i);return this._validate(t,n),this._unpackBinaryAsync(new m({readAsync:function(e,t){return Promise.resolve(new Uint8Array(n,e,t))},byteLength:n.byteLength}))}return this._validate(t,i),Promise.resolve({json:this._parseJson(i)})},e.prototype.createPlugin=function(){return new e},Object.defineProperty(e.prototype,"loaderState",{get:function(){return this._loader?this._loader.state:null},enumerable:!1,configurable:!0}),e.prototype.whenCompleteAsync=function(){var e=this;return new Promise((function(t,i){e.onCompleteObservable.addOnce((function(){t()})),e.onErrorObservable.addOnce((function(e){i(e)}))}))},e.prototype._loadFile=function(e,t,i,n,r){var o=this,s=t._loadFile(e,i,(function(e){o._onProgress(e,s)}),void 0,n,r);return s.onCompleteObservable.add((function(e){o._requests.splice(o._requests.indexOf(e),1)})),this._requests.push(s),s},e.prototype._requestFile=function(e,t,i,n,r,o){var s=this,a=t._requestFile(e,i,(function(e){s._onProgress(e,a)}),void 0,n,r,o);return a.onCompleteObservable.add((function(e){s._requests.splice(s._requests.indexOf(e),1)})),this._requests.push(a),a},e.prototype._onProgress=function(e,t){if(this._progressCallback){t._lengthComputable=e.lengthComputable,t._loaded=e.loaded,t._total=e.total;for(var i=!0,n=0,r=0,o=0,s=this._requests;o0)throw new Error("Incompatible minimum version: "+i.minVersion)}var o={1:e._CreateGLTF1Loader,2:e._CreateGLTF2Loader}[n.major];if(!o)throw new Error("Unsupported version: "+i.version);return o(this)},e.prototype._parseJson=function(e){this._startPerformanceCounter("Parse JSON"),this._log("JSON length: "+e.length);var t=JSON.parse(e);return this._endPerformanceCounter("Parse JSON"),t},e.prototype._unpackBinaryAsync=function(e){var t=this;return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then((function(){var i=e.readUint32();if(1179937895!==i)throw new Error("Unexpected magic: "+i);var n=e.readUint32();t.loggingEnabled&&t._log("Binary version: "+n);var r,o=e.readUint32();if(0!==e.buffer.byteLength&&o!==e.buffer.byteLength)throw new Error("Length in header does not match actual data length: "+o+" != "+e.buffer.byteLength);switch(n){case 1:r=t._unpackBinaryV1Async(e,o);break;case 2:r=t._unpackBinaryV2Async(e,o);break;default:throw new Error("Unsupported version: "+n)}return t._endPerformanceCounter("Unpack Binary"),r}))},e.prototype._unpackBinaryV1Async=function(e,t){var i=e.readUint32(),n=e.readUint32();if(0!==n)throw new Error("Unexpected content format: "+n);var r=t-e.byteOffset,o={json:this._parseJson(e.readString(i)),bin:null};if(0!==r){var s=e.byteOffset;o.bin={readAsync:function(t,i){return e.buffer.readAsync(s+t,i)},byteLength:r}}return Promise.resolve(o)},e.prototype._unpackBinaryV2Async=function(e,t){var i=this,n=1313821514,r=5130562,o=e.readUint32();if(e.readUint32()!==n)throw new Error("First chunk format is not JSON");return e.byteOffset+o===t?e.loadAsync(o).then((function(){return{json:i._parseJson(e.readString(o)),bin:null}})):e.loadAsync(o+8).then((function(){var s={json:i._parseJson(e.readString(o)),bin:null},a=function(){var i=e.readUint32();switch(e.readUint32()){case n:throw new Error("Unexpected JSON chunk");case r:var o=e.byteOffset;s.bin={readAsync:function(t,i){return e.buffer.readAsync(o+t,i)},byteLength:i},e.skipBytes(i);break;default:e.skipBytes(i)}return e.byteOffset!==t?e.loadAsync(8).then(a):Promise.resolve(s)};return a()}))},e._parseVersion=function(e){if("1.0"===e||"1.0.1"===e)return{major:1,minor:0};var t=(e+"").match(/^(\d+)\.(\d+)/);return t?{major:parseInt(t[1]),minor:parseInt(t[2])}:null},e._compareVersion=function(e,t){return e.major>t.major?1:e.majort.minor?1:e.minor=0&&t._keys.splice(n,1),e||r.preventDefault()))})))},e.prototype.detachControl=function(e){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys=[]},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t1)e.cameraRotation.x=-this._offsetY/this.touchAngularSensibility;else{var t=e._computeLocalCameraSpeed(),i=new L.P(0,0,t*this._offsetY/this.touchMoveSensibility);L.y3.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,e._cameraRotationMatrix),e.cameraDirection.addInPlace(L.P.TransformCoordinates(i,e._cameraRotationMatrix))}}},e.prototype.getClassName=function(){return"FreeCameraTouchInput"},e.prototype.getSimpleName=function(){return"touch"},(0,l.gn)([(0,F.qC)()],e.prototype,"touchAngularSensibility",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"touchMoveSensibility",void 0),e}();k.u.FreeCameraTouchInput=K;var q=function(e){function t(t){var i=e.call(this,t)||this;return i._mouseInput=null,i._mouseWheelInput=null,i}return(0,l.ZT)(t,e),t.prototype.addKeyboard=function(){return this.add(new G),this},t.prototype.addMouse=function(e){return void 0===e&&(e=!0),this._mouseInput||(this._mouseInput=new z(e),this.add(this._mouseInput)),this},t.prototype.removeMouse=function(){return this._mouseInput&&this.remove(this._mouseInput),this},t.prototype.addMouseWheel=function(){return this._mouseWheelInput||(this._mouseWheelInput=new Y,this.add(this._mouseWheelInput)),this},t.prototype.removeMouseWheel=function(){return this._mouseWheelInput&&this.remove(this._mouseWheelInput),this},t.prototype.addTouch=function(){return this.add(new K),this},t.prototype.clear=function(){e.prototype.clear.call(this),this._mouseInput=null},t}(k.p),Z=function(e){function t(t,i,n,r){void 0===r&&(r=!0);var o=e.call(this,t,i,n,r)||this;return o.ellipsoid=new L.P(.5,1,.5),o.ellipsoidOffset=new L.P(0,0,0),o.checkCollisions=!1,o.applyGravity=!1,o._needMoveForGravity=!1,o._oldPosition=L.P.Zero(),o._diffPosition=L.P.Zero(),o._newPosition=L.P.Zero(),o._collisionMask=-1,o._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null);var n;n=t,o._newPosition.copyFrom(n),o._newPosition.subtractToRef(o._oldPosition,o._diffPosition),o._diffPosition.length()>B.Engine.CollisionsEpsilon&&(o.position.addInPlace(o._diffPosition),o.onCollide&&i&&o.onCollide(i))},o.inputs=new q(o),o.inputs.addKeyboard().addMouse(),o}return(0,l.ZT)(t,e),Object.defineProperty(t.prototype,"angularSensibility",{get:function(){var e=this.inputs.attached.mouse;return e?e.angularSensibility:0},set:function(e){var t=this.inputs.attached.mouse;t&&(t.angularSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysUpward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUpward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUpward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysDownward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDownward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDownward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!1,configurable:!0}),t.prototype.attachControl=function(e,t){t=s.w1.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t)},t.prototype.detachControl=function(e){this.inputs.detachElement(),this.cameraDirection=new L.P(0,0,0),this.cameraRotation=new L.FM(0,0)},Object.defineProperty(t.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),t.prototype._collideWithWorld=function(e){(this.parent?L.P.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);var t=this.getScene().collisionCoordinator;this._collider||(this._collider=t.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var i=e;this.applyGravity&&(i=e.add(this.getScene().gravity)),t.getNewPosition(this._oldPosition,i,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},t.prototype._checkInputs=function(){this._localDirection||(this._localDirection=L.P.Zero(),this._transformedDirection=L.P.Zero()),this.inputs.checkInputs(),e.prototype._checkInputs.call(this)},t.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):e.prototype._updatePosition.call(this)},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return"FreeCamera"},(0,l.gn)([(0,F.hd)()],t.prototype,"ellipsoid",void 0),(0,l.gn)([(0,F.hd)()],t.prototype,"ellipsoidOffset",void 0),(0,l.gn)([(0,F.qC)()],t.prototype,"checkCollisions",void 0),(0,l.gn)([(0,F.qC)()],t.prototype,"applyGravity",void 0),t}(U.C),Q=i(4635),J=i(8035),$=i(2686),ee=function(e){function t(t,i,n,r,o,s,a){void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===a&&(a=null);var l=e.call(this,t,i.getScene())||this;return l.name=t,l.children=new Array,l.animations=new Array,l._index=null,l._absoluteTransform=new L.y3,l._invertedAbsoluteTransform=new L.y3,l._scalingDeterminant=1,l._worldTransform=new L.y3,l._needToDecompose=!0,l._needToCompose=!1,l._linkedTransformNode=null,l._waitingTransformNodeId=null,l._skeleton=i,l._localMatrix=r?r.clone():L.y3.Identity(),l._restPose=o||l._localMatrix.clone(),l._bindPose=l._localMatrix.clone(),l._baseMatrix=s||l._localMatrix.clone(),l._index=a,i.bones.push(l),l.setParent(n,!1),(s||r)&&l._updateDifferenceMatrix(),l}return(0,l.ZT)(t,e),Object.defineProperty(t.prototype,"_matrix",{get:function(){return this._compose(),this._localMatrix},set:function(e){this._localMatrix.copyFrom(e),this._needToDecompose=!0},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"Bone"},t.prototype.getSkeleton=function(){return this._skeleton},t.prototype.getParent=function(){return this._parent},t.prototype.getChildren=function(){return this.children},t.prototype.getIndex=function(){return null===this._index?this.getSkeleton().bones.indexOf(this):this._index},t.prototype.setParent=function(e,t){if(void 0===t&&(t=!0),this._parent!==e){if(this._parent){var i=this._parent.children.indexOf(this);-1!==i&&this._parent.children.splice(i,1)}this._parent=e,this._parent&&this._parent.children.push(this),t&&this._updateDifferenceMatrix(),this.markAsDirty()}},t.prototype.getLocalMatrix=function(){return this._compose(),this._localMatrix},t.prototype.getBaseMatrix=function(){return this._baseMatrix},t.prototype.getRestPose=function(){return this._restPose},t.prototype.setRestPose=function(e){this._restPose.copyFrom(e)},t.prototype.getBindPose=function(){return this._bindPose},t.prototype.setBindPose=function(e){this._bindPose.copyFrom(e)},t.prototype.getWorldMatrix=function(){return this._worldTransform},t.prototype.returnToRest=function(){this._skeleton._numBonesWithLinkedTransformNode>0?this.updateMatrix(this._restPose,!1,!1):this.updateMatrix(this._restPose,!1,!0)},t.prototype.getInvertedAbsoluteTransform=function(){return this._invertedAbsoluteTransform},t.prototype.getAbsoluteTransform=function(){return this._absoluteTransform},t.prototype.linkTransformNode=function(e){this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode--,this._linkedTransformNode=e,this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode++},t.prototype.getTransformNode=function(){return this._linkedTransformNode},Object.defineProperty(t.prototype,"position",{get:function(){return this._decompose(),this._localPosition},set:function(e){this._decompose(),this._localPosition.copyFrom(e),this._markAsDirtyAndCompose()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this.getRotation()},set:function(e){this.setRotation(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotationQuaternion",{get:function(){return this._decompose(),this._localRotation},set:function(e){this.setRotationQuaternion(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this.getScale()},set:function(e){this.setScale(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"animationPropertiesOverride",{get:function(){return this._skeleton.animationPropertiesOverride},enumerable:!1,configurable:!0}),t.prototype._decompose=function(){this._needToDecompose&&(this._needToDecompose=!1,this._localScaling||(this._localScaling=L.P.Zero(),this._localRotation=L._f.Zero(),this._localPosition=L.P.Zero()),this._localMatrix.decompose(this._localScaling,this._localRotation,this._localPosition))},t.prototype._compose=function(){this._needToCompose&&(this._localScaling?(this._needToCompose=!1,L.y3.ComposeToRef(this._localScaling,this._localRotation,this._localPosition,this._localMatrix)):this._needToCompose=!1)},t.prototype.updateMatrix=function(e,t,i){void 0===t&&(t=!0),void 0===i&&(i=!0),this._baseMatrix.copyFrom(e),t&&this._updateDifferenceMatrix(),i?(this._needToCompose=!1,this._localMatrix.copyFrom(e),this._markAsDirtyAndDecompose()):this.markAsDirty()},t.prototype._updateDifferenceMatrix=function(e,t){if(void 0===t&&(t=!0),e||(e=this._baseMatrix),this._parent?e.multiplyToRef(this._parent._absoluteTransform,this._absoluteTransform):this._absoluteTransform.copyFrom(e),this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform),t)for(var i=0;i>v,b=0;b<6;b++){var T=m[v][b];g&&(T=re(T,y,y,r)),d.texImage2D(b,v,_,y,y,0,c,h,T)}f._bindTextureDirectly(d.TEXTURE_CUBE_MAP,null)}else f.updateRawCubeTexture(p,o,n,r,u);p.isReady=!0,null==t||t._removePendingData(p),l&&l()}}(e)}),void 0,null==t?void 0:t.offlineProvider,!0,(function(e,i){null==t||t._removePendingData(p),h&&e&&h(e.status+" "+e.statusText,i)})),p},ne.B.prototype.createRawTexture2DArray=oe(!1),ne.B.prototype.createRawTexture3D=oe(!0),ne.B.prototype.updateRawTexture2DArray=se(!1),ne.B.prototype.updateRawTexture3D=se(!0);var ae=function(e){function t(t,i,n,r,o,s,a,l,h){void 0===s&&(s=!0),void 0===a&&(a=!1),void 0===l&&(l=3),void 0===h&&(h=0);var c=e.call(this,null,o,!s,a)||this;return c.format=r,c._engine?(c._texture=c._engine.createRawTexture(t,i,n,r,s,a,l,null,h),c.wrapU=te.x.CLAMP_ADDRESSMODE,c.wrapV=te.x.CLAMP_ADDRESSMODE,c):c}return(0,l.ZT)(t,e),t.prototype.update=function(e){this._getEngine().updateRawTexture(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type)},t.CreateLuminanceTexture=function(e,i,n,r,o,s,a){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=3),new t(e,i,n,1,r,o,s,a)},t.CreateLuminanceAlphaTexture=function(e,i,n,r,o,s,a){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=3),new t(e,i,n,2,r,o,s,a)},t.CreateAlphaTexture=function(e,i,n,r,o,s,a){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=3),new t(e,i,n,0,r,o,s,a)},t.CreateRGBTexture=function(e,i,n,r,o,s,a,l){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=3),void 0===l&&(l=0),new t(e,i,n,4,r,o,s,a,l)},t.CreateRGBATexture=function(e,i,n,r,o,s,a,l){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=3),void 0===l&&(l=0),new t(e,i,n,5,r,o,s,a,l)},t.CreateRTexture=function(e,i,n,r,o,s,a,l){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=te.x.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=1),new t(e,i,n,6,r,o,s,a,l)},t}(te.x),le=i(2117),he=i(789),ce=function(){function e(e,t,i){this.name=e,this.id=t,this.bones=new Array,this.needInitialSkinMatrix=!1,this.overrideMesh=null,this._isDirty=!0,this._meshesWithPoseMatrix=new Array,this._identity=L.y3.Identity(),this._ranges={},this._lastAbsoluteTransformsUpdateId=-1,this._canUseTextureForBones=!1,this._uniqueId=0,this._numBonesWithLinkedTransformNode=0,this._hasWaitingData=null,this._waitingOverrideMeshId=null,this.doNotSerialize=!1,this._useTextureToStoreBoneMatrices=!0,this._animationPropertiesOverride=null,this.onBeforeComputeObservable=new o.y$,this.bones=[],this._scene=i||f.l.LastCreatedScene,this._uniqueId=this._scene.getUniqueId(),this._scene.addSkeleton(this),this._isDirty=!0;var n=this._scene.getEngine().getCaps();this._canUseTextureForBones=n.textureFloat&&n.maxVertexTextureImageUnits>0}return Object.defineProperty(e.prototype,"useTextureToStoreBoneMatrices",{get:function(){return this._useTextureToStoreBoneMatrices},set:function(e){this._useTextureToStoreBoneMatrices=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUsingTextureForMatrices",{get:function(){return this.useTextureToStoreBoneMatrices&&this._canUseTextureForBones},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"Skeleton"},e.prototype.getChildren=function(){return this.bones.filter((function(e){return!e.getParent()}))},e.prototype.getTransformMatrices=function(e){return this.needInitialSkinMatrix&&e._bonesTransformMatrices?e._bonesTransformMatrices:(this._transformMatrices||this.prepare(),this._transformMatrices)},e.prototype.getTransformMatrixTexture=function(e){return this.needInitialSkinMatrix&&e._transformMatrixTexture?e._transformMatrixTexture:this._transformMatrixTexture},e.prototype.getScene=function(){return this._scene},e.prototype.toString=function(e){var t="Name: "+this.name+", nBones: "+this.bones.length;if(t+=", nAnimationRanges: "+(this._ranges?Object.keys(this._ranges).length:"none"),e){t+=", Ranges: {";var i=!0;for(var n in this._ranges)i&&(t+=", ",i=!1),t+=n;t+="}"}return t},e.prototype.getBoneIndexByName=function(e){for(var t=0,i=this.bones.length;t-1&&this._meshesWithPoseMatrix.splice(t,1)},e.prototype._computeTransformMatrices=function(e,t){this.onBeforeComputeObservable.notifyObservers(this);for(var i=0;i0)for(var e=0,t=this.bones;e0&&(s.animation=r.animations[0].serialize()),i.ranges=[],this._ranges){var l=this._ranges[a];if(l){var h={};h.name=a,h.from=l.from,h.to=l.to,i.ranges.push(h)}}}return i},e.Parse=function(t,i){var n,r=new e(t.name,t.id,i);for(t.dimensionsAtRest&&(r.dimensionsAtRest=L.P.FromArray(t.dimensionsAtRest)),r.needInitialSkinMatrix=t.needInitialSkinMatrix,t.overrideMeshId&&(r._hasWaitingData=!0,r._waitingOverrideMeshId=t.overrideMeshId),n=0;n-1&&(a=r.bones[o.parentBoneIndex]);var l=o.rest?L.y3.FromArray(o.rest):null,h=new ee(o.name,r,a,L.y3.FromArray(o.matrix),l,null,s);void 0!==o.id&&null!==o.id&&(h.id=o.id),o.length&&(h.length=o.length),o.metadata&&(h.metadata=o.metadata),o.animation&&h.animations.push(Q.f.Parse(o.animation)),void 0!==o.linkedTransformNodeId&&null!==o.linkedTransformNodeId&&(r._hasWaitingData=!0,h._waitingTransformNodeId=o.linkedTransformNodeId)}if(t.ranges)for(n=0;n0&&(e=this._meshesWithPoseMatrix[0].getPoseMatrix()),e},e.prototype.sortBones=function(){for(var e=new Array,t=new Array(this.bones.length),i=0;i0?this._setDefaultFixedFrustumShadowProjectionMatrix(e):this._setDefaultAutoExtendShadowProjectionMatrix(e,t,i)},t.prototype._setDefaultFixedFrustumShadowProjectionMatrix=function(e){var t=this.getScene().activeCamera;t&&L.y3.OrthoLHToRef(this.shadowFrustumSize,this.shadowFrustumSize,void 0!==this.shadowMinZ?this.shadowMinZ:t.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:t.maxZ,e)},t.prototype._setDefaultAutoExtendShadowProjectionMatrix=function(e,t,i){var n=this.getScene().activeCamera;if(n){if(this.autoUpdateExtends||this._orthoLeft===Number.MAX_VALUE){var r=L.P.Zero();this._orthoLeft=Number.MAX_VALUE,this._orthoRight=Number.MIN_VALUE,this._orthoTop=Number.MIN_VALUE,this._orthoBottom=Number.MAX_VALUE;for(var o=Number.MAX_VALUE,s=Number.MIN_VALUE,a=0;athis._orthoRight&&(this._orthoRight=r.x),r.y>this._orthoTop&&(this._orthoTop=r.y),this.autoCalcShadowZBounds&&(r.zs&&(s=r.z))}this.autoCalcShadowZBounds&&(this._shadowMinZ=o,this._shadowMaxZ=s)}var u=this._orthoRight-this._orthoLeft,f=this._orthoTop-this._orthoBottom;L.y3.OrthoOffCenterLHToRef(this._orthoLeft-u*this.shadowOrthoScale,this._orthoRight+u*this.shadowOrthoScale,this._orthoBottom-f*this.shadowOrthoScale,this._orthoTop+f*this.shadowOrthoScale,void 0!==this.shadowMinZ?this.shadowMinZ:n.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:n.maxZ,e)}},t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},t.prototype.transferToEffect=function(e,t){return this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z,1,t),this):(this._uniformBuffer.updateFloat4("vLightData",this.direction.x,this.direction.y,this.direction.z,1,t),this)},t.prototype.transferToNodeMaterialEffect=function(e,t){return this.computeTransformedInformation()?(e.setFloat3(t,this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z),this):(e.setFloat3(t,this.direction.x,this.direction.y,this.direction.z),this)},t.prototype.getDepthMinZ=function(e){return 1},t.prototype.getDepthMaxZ=function(e){return 1},t.prototype.prepareLightSpecificDefines=function(e,t){e["DIRLIGHT"+t]=!0},(0,l.gn)([(0,F.qC)()],t.prototype,"shadowFrustumSize",null),(0,l.gn)([(0,F.qC)()],t.prototype,"shadowOrthoScale",null),(0,l.gn)([(0,F.qC)()],t.prototype,"autoUpdateExtends",void 0),(0,l.gn)([(0,F.qC)()],t.prototype,"autoCalcShadowZBounds",void 0),t}(Ee);$.N.AddNodeConstructor("Light_Type_0",(function(e,t){return function(){return new xe(e,L.P.Zero(),t)}}));var xe=function(e){function t(t,i,n){var r=e.call(this,t,n)||this;return r._shadowAngle=Math.PI/2,r.position=i,r}return(0,l.ZT)(t,e),Object.defineProperty(t.prototype,"shadowAngle",{get:function(){return this._shadowAngle},set:function(e){this._shadowAngle=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"direction",{get:function(){return this._direction},set:function(e){var t=this.needCube();this._direction=e,this.needCube()!==t&&this._shadowGenerator&&this._shadowGenerator.recreateShadowMap()},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"PointLight"},t.prototype.getTypeID=function(){return Ae._.LIGHTTYPEID_POINTLIGHT},t.prototype.needCube=function(){return!this.direction},t.prototype.getShadowDirection=function(t){if(this.direction)return e.prototype.getShadowDirection.call(this,t);switch(t){case 0:return new L.P(1,0,0);case 1:return new L.P(-1,0,0);case 2:return new L.P(0,-1,0);case 3:return new L.P(0,1,0);case 4:return new L.P(0,0,1);case 5:return new L.P(0,0,-1)}return L.P.Zero()},t.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){var n=this.getScene().activeCamera;n&&L.y3.PerspectiveFovLHToRef(this.shadowAngle,1,this.getDepthMinZ(n),this.getDepthMaxZ(n),e)},t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},t.prototype.transferToEffect=function(e,t){return this.computeTransformedInformation()?this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z,0,t):this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,0,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,0,0,t),this},t.prototype.transferToNodeMaterialEffect=function(e,t){return this.computeTransformedInformation()?e.setFloat3(t,this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z):e.setFloat3(t,this.position.x,this.position.y,this.position.z),this},t.prototype.prepareLightSpecificDefines=function(e,t){e["POINTLIGHT"+t]=!0},(0,l.gn)([(0,F.qC)()],t.prototype,"shadowAngle",null),t}(Ee);$.N.AddNodeConstructor("Light_Type_2",(function(e,t){return function(){return new Re(e,L.P.Zero(),L.P.Zero(),0,0,t)}}));var Se,Re=function(e){function t(t,i,n,r,o,s){var a=e.call(this,t,s)||this;return a._innerAngle=0,a._projectionTextureMatrix=L.y3.Zero(),a._projectionTextureLightNear=1e-6,a._projectionTextureLightFar=1e3,a._projectionTextureUpDirection=L.P.Up(),a._projectionTextureViewLightDirty=!0,a._projectionTextureProjectionLightDirty=!0,a._projectionTextureDirty=!0,a._projectionTextureViewTargetVector=L.P.Zero(),a._projectionTextureViewLightMatrix=L.y3.Zero(),a._projectionTextureProjectionLightMatrix=L.y3.Zero(),a._projectionTextureScalingMatrix=L.y3.FromValues(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1),a.position=i,a.direction=n,a.angle=r,a.exponent=o,a}return(0,l.ZT)(t,e),Object.defineProperty(t.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this._cosHalfAngle=Math.cos(.5*e),this._projectionTextureProjectionLightDirty=!0,this.forceProjectionMatrixCompute(),this._computeAngleValues()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"innerAngle",{get:function(){return this._innerAngle},set:function(e){this._innerAngle=e,this._computeAngleValues()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowAngleScale",{get:function(){return this._shadowAngleScale},set:function(e){this._shadowAngleScale=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureMatrix",{get:function(){return this._projectionTextureMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureLightNear",{get:function(){return this._projectionTextureLightNear},set:function(e){this._projectionTextureLightNear=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureLightFar",{get:function(){return this._projectionTextureLightFar},set:function(e){this._projectionTextureLightFar=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureUpDirection",{get:function(){return this._projectionTextureUpDirection},set:function(e){this._projectionTextureUpDirection=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"projectionTexture",{get:function(){return this._projectionTexture},set:function(e){var i=this;this._projectionTexture!==e&&(this._projectionTexture=e,this._projectionTextureDirty=!0,this._projectionTexture&&!this._projectionTexture.isReady()&&(t._IsProceduralTexture(this._projectionTexture)?this._projectionTexture.getEffect().executeWhenCompiled((function(){i._markMeshesAsLightDirty()})):t._IsTexture(this._projectionTexture)&&this._projectionTexture.onLoadObservable.addOnce((function(){i._markMeshesAsLightDirty()}))))},enumerable:!1,configurable:!0}),t._IsProceduralTexture=function(e){return void 0!==e.onGeneratedObservable},t._IsTexture=function(e){return void 0!==e.onLoadObservable},t.prototype.getClassName=function(){return"SpotLight"},t.prototype.getTypeID=function(){return Ae._.LIGHTTYPEID_SPOTLIGHT},t.prototype._setDirection=function(t){e.prototype._setDirection.call(this,t),this._projectionTextureViewLightDirty=!0},t.prototype._setPosition=function(t){e.prototype._setPosition.call(this,t),this._projectionTextureViewLightDirty=!0},t.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){var n=this.getScene().activeCamera;if(n){this._shadowAngleScale=this._shadowAngleScale||1;var r=this._shadowAngleScale*this._angle;L.y3.PerspectiveFovLHToRef(r,1,this.getDepthMinZ(n),this.getDepthMaxZ(n),e)}},t.prototype._computeProjectionTextureViewLightMatrix=function(){this._projectionTextureViewLightDirty=!1,this._projectionTextureDirty=!0,this.position.addToRef(this.direction,this._projectionTextureViewTargetVector),L.y3.LookAtLHToRef(this.position,this._projectionTextureViewTargetVector,this._projectionTextureUpDirection,this._projectionTextureViewLightMatrix)},t.prototype._computeProjectionTextureProjectionLightMatrix=function(){this._projectionTextureProjectionLightDirty=!1,this._projectionTextureDirty=!0;var e=this.projectionTextureLightFar,t=this.projectionTextureLightNear,i=e/(e-t),n=-i*t,r=1/Math.tan(this._angle/2);L.y3.FromValuesToRef(r/1,0,0,0,0,r,0,0,0,0,i,1,0,0,n,0,this._projectionTextureProjectionLightMatrix)},t.prototype._computeProjectionTextureMatrix=function(){if(this._projectionTextureDirty=!1,this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix,this._projectionTextureMatrix),this._projectionTexture instanceof te.x){var e=this._projectionTexture.uScale/2,t=this._projectionTexture.vScale/2;L.y3.FromValuesToRef(e,0,0,0,0,t,0,0,0,0,.5,0,.5,.5,.5,1,this._projectionTextureScalingMatrix)}this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix,this._projectionTextureMatrix)},t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightDirection",3),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},t.prototype._computeAngleValues=function(){this._lightAngleScale=1/Math.max(.001,Math.cos(.5*this._innerAngle)-this._cosHalfAngle),this._lightAngleOffset=-this._cosHalfAngle*this._lightAngleScale},t.prototype.transferTexturesToEffect=function(e,t){return this.projectionTexture&&this.projectionTexture.isReady()&&(this._projectionTextureViewLightDirty&&this._computeProjectionTextureViewLightMatrix(),this._projectionTextureProjectionLightDirty&&this._computeProjectionTextureProjectionLightMatrix(),this._projectionTextureDirty&&this._computeProjectionTextureMatrix(),e.setMatrix("textureProjectionMatrix"+t,this._projectionTextureMatrix),e.setTexture("projectionLightSampler"+t,this.projectionTexture)),this},t.prototype.transferToEffect=function(e,t){var i;return this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z,this.exponent,t),i=L.P.Normalize(this.transformedDirection)):(this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,this.exponent,t),i=L.P.Normalize(this.direction)),this._uniformBuffer.updateFloat4("vLightDirection",i.x,i.y,i.z,this._cosHalfAngle,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,this._lightAngleScale,this._lightAngleOffset,t),this},t.prototype.transferToNodeMaterialEffect=function(e,t){var i;return i=this.computeTransformedInformation()?L.P.Normalize(this.transformedDirection):L.P.Normalize(this.direction),this.getScene().useRightHandedSystem?e.setFloat3(t,-i.x,-i.y,-i.z):e.setFloat3(t,i.x,i.y,i.z),this},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._projectionTexture&&this._projectionTexture.dispose()},t.prototype.prepareLightSpecificDefines=function(e,t){e["SPOTLIGHT"+t]=!0,e["PROJECTEDLIGHTTEXTURE"+t]=!(!this.projectionTexture||!this.projectionTexture.isReady())},(0,l.gn)([(0,F.qC)()],t.prototype,"angle",null),(0,l.gn)([(0,F.qC)()],t.prototype,"innerAngle",null),(0,l.gn)([(0,F.qC)()],t.prototype,"shadowAngleScale",null),(0,l.gn)([(0,F.qC)()],t.prototype,"exponent",void 0),(0,l.gn)([(0,F.qC)()],t.prototype,"projectionTextureLightNear",null),(0,l.gn)([(0,F.qC)()],t.prototype,"projectionTextureLightFar",null),(0,l.gn)([(0,F.qC)()],t.prototype,"projectionTextureUpDirection",null),(0,l.gn)([(0,F.oU)("projectedLightTexture")],t.prototype,"_projectionTexture",void 0),t}(Ee),Me=function(){function e(){}return e.SetMatrix=function(e,t,i,n,r){var o=null;if("MODEL"===i.semantic?o=t.getWorldMatrix():"PROJECTION"===i.semantic?o=e.getProjectionMatrix():"VIEW"===i.semantic?o=e.getViewMatrix():"MODELVIEWINVERSETRANSPOSE"===i.semantic?o=L.y3.Transpose(t.getWorldMatrix().multiply(e.getViewMatrix()).invert()):"MODELVIEW"===i.semantic?o=t.getWorldMatrix().multiply(e.getViewMatrix()):"MODELVIEWPROJECTION"===i.semantic?o=t.getWorldMatrix().multiply(e.getTransformMatrix()):"MODELINVERSE"===i.semantic?o=t.getWorldMatrix().invert():"VIEWINVERSE"===i.semantic?o=e.getViewMatrix().invert():"PROJECTIONINVERSE"===i.semantic?o=e.getProjectionMatrix().invert():"MODELVIEWINVERSE"===i.semantic?o=t.getWorldMatrix().multiply(e.getViewMatrix()).invert():"MODELVIEWPROJECTIONINVERSE"===i.semantic?o=t.getWorldMatrix().multiply(e.getTransformMatrix()).invert():"MODELINVERSETRANSPOSE"===i.semantic&&(o=L.y3.Transpose(t.getWorldMatrix().invert())),o)switch(i.type){case S.FLOAT_MAT2:r.setMatrix2x2(n,L.y3.GetAsMatrix2x2(o));break;case S.FLOAT_MAT3:r.setMatrix3x3(n,L.y3.GetAsMatrix3x3(o));break;case S.FLOAT_MAT4:r.setMatrix(n,o)}},e.SetUniform=function(e,t,i,n){switch(n){case S.FLOAT:return e.setFloat(t,i),!0;case S.FLOAT_VEC2:return e.setVector2(t,L.FM.FromArray(i)),!0;case S.FLOAT_VEC3:return e.setVector3(t,L.P.FromArray(i)),!0;case S.FLOAT_VEC4:return e.setVector4(t,L.Lt.FromArray(i)),!0;default:return!1}},e.GetWrapMode=function(e){switch(e){case R.CLAMP_TO_EDGE:return te.x.CLAMP_ADDRESSMODE;case R.MIRRORED_REPEAT:return te.x.MIRROR_ADDRESSMODE;case R.REPEAT:default:return te.x.WRAP_ADDRESSMODE}},e.GetByteStrideFromType=function(e){switch(e.type){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}},e.GetTextureFilterMode=function(e){switch(e){case M.LINEAR:case M.LINEAR_MIPMAP_NEAREST:case M.LINEAR_MIPMAP_LINEAR:return te.x.TRILINEAR_SAMPLINGMODE;case M.NEAREST:case M.NEAREST_MIPMAP_NEAREST:return te.x.NEAREST_SAMPLINGMODE;default:return te.x.BILINEAR_SAMPLINGMODE}},e.GetBufferFromBufferView=function(e,t,i,n,r){i=t.byteOffset+i;var o=e.loadedBufferViews[t.buffer];if(i+n>o.byteLength)throw new Error("Buffer access is out of range");var s=o.buffer;switch(i+=o.byteOffset,r){case C.BYTE:return new Int8Array(s,i,n);case C.UNSIGNED_BYTE:return new Uint8Array(s,i,n);case C.SHORT:return new Int16Array(s,i,n);case C.UNSIGNED_SHORT:return new Uint16Array(s,i,n);default:return new Float32Array(s,i,n)}},e.GetBufferFromAccessor=function(t,i){var n=t.bufferViews[i.bufferView],r=i.count*e.GetByteStrideFromType(i);return e.GetBufferFromBufferView(t,n,i.byteOffset,r,i.componentType)},e.DecodeBufferToText=function(e){for(var t="",i=e.byteLength,n=0;n=this._maxPos},e}(),Oe=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],De=["world","view","projection","worldView","worldViewProjection","mBones"],Le=["translation","rotation","scale"],we=["position","rotationQuaternion","scaling"],Ne=function(e,t,i){for(var n in e){var r=e[n];i[t][n]=r}},Fe=function(e){if(e)for(var t=0;t0&&(f=Ve(o,r))&&-1===a.indexOf(f)&&a.push(f),new ee(h.jointName||"",n,f,v).id=r}}else s.w1.Warn("Joint named "+t.jointNames[l]+" does not exist")}}var y=n.bones;n.bones=[];for(l=0;l1?(o=new de.G("multimat"+n,e.scene)).subMaterials=s:o=new pe.StandardMaterial("multimat"+n,e.scene),1===s.length&&(o=s[0]),r.material||(r.material=o),new ve.Z(n,e.scene,a,!1,r),r.computeWorldMatrix(!0),e.scene._blockEntityCollection=!1,r.subMeshes=[];var M=0;for(d=0;d0&&-1===e.importMeshesNames.indexOf(t.name||""))return null;if(t.skin){if(t.meshes){var o=e.skins[t.skin];(s=We(e,t,t.meshes,i,t.babylonNode)).skeleton=e.scene.getLastSkeletonByID(t.skin),null===s.skeleton&&(s.skeleton=ze(e,o,0,o.babylonSkeleton,t.skin),o.babylonSkeleton||(o.babylonSkeleton=s.skeleton)),r=s}}else if(t.meshes){var s;r=s=We(e,t,t.mesh?[t.mesh]:t.meshes,i,t.babylonNode)}else if(!t.light||t.babylonNode||e.importOnlyMeshes){if(t.camera&&!t.babylonNode&&!e.importOnlyMeshes){var a=e.cameras[t.camera];if(a){if(e.scene._blockEntityCollection=e.forAssetContainer,"orthographic"===a.type){var l=new Z(t.camera,L.P.Zero(),e.scene,!1);l.name=t.name||"",l.mode=N.V.ORTHOGRAPHIC_CAMERA,l.attachControl(),r=l}else if("perspective"===a.type){var h=a[a.type],u=new Z(t.camera,L.P.Zero(),e.scene,!1);u.name=t.name||"",u.attachControl(),h.aspectRatio||(h.aspectRatio=e.scene.getEngine().getRenderWidth()/e.scene.getEngine().getRenderHeight()),h.znear&&h.zfar&&(u.maxZ=h.zfar,u.minZ=h.znear),r=u}e.scene._blockEntityCollection=!1}}}else{var f=e.lights[t.light];if(f)if("ambient"===f.type){var d=f[f.type],p=new Te.HemisphericLight(t.light,L.P.Zero(),e.scene);p.name=t.name||"",d.color&&(p.diffuse=w.Wo.FromArray(d.color)),r=p}else if("directional"===f.type){var _=f[f.type],g=new Ce(t.light,L.P.Zero(),e.scene);g.name=t.name||"",_.color&&(g.diffuse=w.Wo.FromArray(_.color)),r=g}else if("point"===f.type){var m=f[f.type],v=new xe(t.light,L.P.Zero(),e.scene);v.name=t.name||"",m.color&&(v.diffuse=w.Wo.FromArray(m.color)),r=v}else if("spot"===f.type){var y=f[f.type],b=new Re(t.light,L.P.Zero(),L.P.Zero(),0,0,e.scene);b.name=t.name||"",y.color&&(b.diffuse=w.Wo.FromArray(y.color)),y.fallOfAngle&&(b.angle=y.fallOfAngle),y.fallOffExponent&&(b.exponent=y.fallOffExponent),r=b}}if(!t.jointName){if(t.babylonNode)return t.babylonNode;if(null===r){e.scene._blockEntityCollection=e.forAssetContainer;var T=new c.Mesh(t.name||"",e.scene);e.scene._blockEntityCollection=!1,t.babylonNode=T,r=T}}if(null!==r){if(t.matrix&&r instanceof c.Mesh)!function(e,t,i){if(t.matrix){var n=new L.P(0,0,0),r=new L._f,o=new L.P(0,0,0);L.y3.FromArray(t.matrix).decompose(o,r,n),Xe(e,n,r,o)}else t.translation&&t.rotation&&t.scale&&Xe(e,L.P.FromArray(t.translation),L._f.FromArray(t.rotation),L.P.FromArray(t.scale));e.computeWorldMatrix(!0)}(r,t);else{var A=t.translation||[0,0,0],E=t.rotation||[0,0,0,1],C=t.scale||[1,1,1];Xe(r,L.P.FromArray(A),L._f.FromArray(E),L.P.FromArray(C))}r.updateCache(!0),t.babylonNode=r}return r},Ye=function(e,t,i,n){void 0===n&&(n=!1);var r=e.nodes[t],o=null;if(n=!(e.importOnlyMeshes&&!n&&e.importMeshesNames)||(-1!==e.importMeshesNames.indexOf(r.name||"")||0===e.importMeshesNames.length),!r.jointName&&n&&null!==(o=je(e,r,t))&&(o.id=t,o.parent=i),r.children)for(var s=0;s0&&c.forEach((function(e){r._events.push(e._clone())})),this._enableBlending=e&&e.animationPropertiesOverride?e.animationPropertiesOverride.enableBlending:this._animation.enableBlending}return Object.defineProperty(e.prototype,"currentFrame",{get:function(){return this._currentFrame},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"weight",{get:function(){return this._weight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentValue",{get:function(){return this._currentValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"targetPath",{get:function(){return this._targetPath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._currentActiveTarget},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isAdditive",{get:function(){return this._host&&this._host.isAdditive},enumerable:!1,configurable:!0}),e.prototype._preparePath=function(e,t){void 0===t&&(t=0);var i=this._animation.targetPropertyPath;if(i.length>1){for(var n=e[i[0]],r=1;r-1&&this._animation.runtimeAnimations.splice(e,1)},e.prototype.setValue=function(e,t){if(this._targetIsArray)for(var i=0;it[t.length-1].frame&&(e=t[t.length-1].frame);var i=this._events;if(i.length)for(var n=0;nthis._maxFrame)&&(t=this._minFrame),(ithis._maxFrame)&&(i=this._maxFrame);var h,c,u=i-t,f=e*(s.framePerSecond*r)/1e3+this._ratioOffset,d=0;if(this._previousDelay=e,this._previousRatio=f,!n&&i>=t&&f>=u)l=!1,d=s._getKeyValue(this._maxValue);else if(!n&&t>=i&&f<=u)l=!1,d=s._getKeyValue(this._minValue);else if(this._animationState.loopMode!==Q.f.ANIMATIONLOOPMODE_CYCLE){var p=i.toString()+t.toString();if(!this._offsetsCache[p]){this._animationState.repeatCount=0,this._animationState.loopMode=Q.f.ANIMATIONLOOPMODE_CYCLE;var _=s._interpolate(t,this._animationState),g=s._interpolate(i,this._animationState);switch(this._animationState.loopMode=this._getCorrectLoopMode(),s.dataType){case Q.f.ANIMATIONTYPE_FLOAT:this._offsetsCache[p]=g-_;break;case Q.f.ANIMATIONTYPE_QUATERNION:this._offsetsCache[p]=g.subtract(_);break;case Q.f.ANIMATIONTYPE_VECTOR3:this._offsetsCache[p]=g.subtract(_);case Q.f.ANIMATIONTYPE_VECTOR2:this._offsetsCache[p]=g.subtract(_);case Q.f.ANIMATIONTYPE_SIZE:this._offsetsCache[p]=g.subtract(_);case Q.f.ANIMATIONTYPE_COLOR3:this._offsetsCache[p]=g.subtract(_)}this._highLimitsCache[p]=g}d=this._highLimitsCache[p],h=this._offsetsCache[p]}if(void 0===h)switch(s.dataType){case Q.f.ANIMATIONTYPE_FLOAT:h=0;break;case Q.f.ANIMATIONTYPE_QUATERNION:h=ot;break;case Q.f.ANIMATIONTYPE_VECTOR3:h=st;break;case Q.f.ANIMATIONTYPE_VECTOR2:h=at;break;case Q.f.ANIMATIONTYPE_SIZE:h=lt;break;case Q.f.ANIMATIONTYPE_COLOR3:h=ht}if(this._host&&this._host.syncRoot){var m=this._host.syncRoot;c=t+(i-t)*((m.masterFrame-m.fromFrame)/(m.toFrame-m.fromFrame))}else c=l&&0!==u?t+f%u:i;var v=this._events;if((u>0&&this.currentFrame>c||u<0&&this.currentFrame>0,this._animationState.highLimitValue=d,this._animationState.offsetValue=h;var b=s._interpolate(c,this._animationState);if(this.setValue(b,o),v.length)for(y=0;y0&&c>=v[y].frame&&v[y].frame>=t||u<0&&c<=v[y].frame&&v[y].frame<=t){var T=v[y];T.isDone||(T.onlyOnce&&(v.splice(y,1),y--),T.isDone=!0,T.action(c))}return l||(this._stopped=!0),l},e}(),ut=i(4391),ft=i(5273),dt=function(){function e(e,t,i,n,r,s,a,l,h,c){void 0===i&&(i=0),void 0===n&&(n=100),void 0===r&&(r=!1),void 0===s&&(s=1),void 0===c&&(c=!1),this.target=t,this.fromFrame=i,this.toFrame=n,this.loopAnimation=r,this.onAnimationEnd=a,this.onAnimationLoop=h,this.isAdditive=c,this._localDelayOffset=null,this._pausedDelay=null,this._runtimeAnimations=new Array,this._paused=!1,this._speedRatio=1,this._weight=-1,this._syncRoot=null,this.disposeOnEnd=!0,this.animationStarted=!1,this.onAnimationEndObservable=new o.y$,this.onAnimationLoopObservable=new o.y$,this._scene=e,l&&this.appendAnimations(t,l),this._speedRatio=s,e._activeAnimatables.push(this)}return Object.defineProperty(e.prototype,"syncRoot",{get:function(){return this._syncRoot},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"masterFrame",{get:function(){return 0===this._runtimeAnimations.length?0:this._runtimeAnimations[0].currentFrame},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"weight",{get:function(){return this._weight},set:function(e){this._weight=-1!==e?Math.min(Math.max(e,0),1):-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speedRatio",{get:function(){return this._speedRatio},set:function(e){for(var t=0;t-1&&(this._scene._activeAnimatables.splice(t,1),this._scene._activeAnimatables.push(this))}return this},e.prototype.getAnimations=function(){return this._runtimeAnimations},e.prototype.appendAnimations=function(e,t){for(var i=this,n=0;n-1){for(var n=(o=this._runtimeAnimations).length-1;n>=0;n--){var r=o[n];e&&r.animation.name!=e||(t&&!t(r.target)||(r.dispose(),o.splice(n,1)))}0==o.length&&(this._scene._activeAnimatables.splice(i,1),this._raiseOnAnimationEnd())}}else{if((n=this._scene._activeAnimatables.indexOf(this))>-1){this._scene._activeAnimatables.splice(n,1);var o=this._runtimeAnimations;for(n=0;n0)return;this._animationTimeLast=e}this.deltaTime=this.useConstantAnimationDeltaTime?16:(e-this._animationTimeLast)*this.animationTimeScale,this._animationTimeLast=e;var t=this._activeAnimatables;if(0!==t.length){this._animationTime+=this.deltaTime;for(var i=this._animationTime,n=0;ni&&r>0&&(r*=-1),a&&this.stopAnimation(e,void 0,l),s||(s=new dt(this,e,t,i,n,r,o,void 0,h,c));var u=!l||l(e);if(e.animations&&u&&s.appendAnimations(e,e.animations),e.getAnimatables)for(var f=e.getAnimatables(),d=0;dn&&o>0&&(o*=-1),new dt(this,e,i,n,r,o,s,t,a,l)},ut.Scene.prototype.beginDirectHierarchyAnimation=function(e,t,i,n,r,o,s,a,l,h){void 0===h&&(h=!1);var c=e.getDescendants(t),u=[];u.push(this.beginDirectAnimation(e,i,n,r,o,s,a,l,h));for(var f=0,d=c;f0)r.copyFrom(n);else if(1===e.animations.length){if(L._f.SlerpToRef(n,i.currentValue,Math.min(1,e.totalWeight),r),0===e.totalAdditiveWeight)return r}else if(e.animations.length>1){var o=1,s=void 0,a=void 0;if(e.totalWeight<1){var l=1-e.totalWeight;a=[],(s=[]).push(n),a.push(l)}else{if(2===e.animations.length&&(L._f.SlerpToRef(e.animations[0].currentValue,e.animations[1].currentValue,e.animations[1].weight/e.totalWeight,t),0===e.totalAdditiveWeight))return t;s=[],a=[],o=e.totalWeight}for(var h=0;h=h&&s.frame<=c&&(n?(l=s.value.clone(),_?(a=l.getTranslation(),l.setTranslation(a.scaleInPlace(g))):m&&r?(a=l.getTranslation(),l.setTranslation(a.multiplyInPlace(r))):l=s.value):l=s.value,v.push({frame:s.frame+i,value:l}));return this.animations[0].createRange(t,h+i,c+i),!0};var pt=function(){function e(){}return e.prototype.getClassName=function(){return"TargetedAnimation"},e.prototype.serialize=function(){var e={};return e.animation=this.animation.serialize(),e.targetId=this.target.id,e},e}(),_t=function(){function e(e,t){void 0===t&&(t=null),this.name=e,this._targetedAnimations=new Array,this._animatables=new Array,this._from=Number.MAX_VALUE,this._to=-Number.MAX_VALUE,this._speedRatio=1,this._loopAnimation=!1,this._isAdditive=!1,this.onAnimationEndObservable=new o.y$,this.onAnimationLoopObservable=new o.y$,this.onAnimationGroupLoopObservable=new o.y$,this.onAnimationGroupEndObservable=new o.y$,this.onAnimationGroupPauseObservable=new o.y$,this.onAnimationGroupPlayObservable=new o.y$,this._scene=t||f.l.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._scene.addAnimationGroup(this)}return Object.defineProperty(e.prototype,"from",{get:function(){return this._from},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"to",{get:function(){return this._to},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isStarted",{get:function(){return this._isStarted},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPlaying",{get:function(){return this._isStarted&&!this._isPaused},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speedRatio",{get:function(){return this._speedRatio},set:function(e){if(this._speedRatio!==e){this._speedRatio=e;for(var t=0;tn[0].frame&&(this._from=n[0].frame),this._toe){var s={frame:e,value:r.value,inTangent:r.inTangent,outTangent:r.outTangent,interpolation:r.interpolation};n.splice(0,0,s)}if(o.framen&&this._speedRatio>0&&(this._speedRatio=-t);return this._isStarted=!0,this._isPaused=!1,this.onAnimationGroupPlayObservable.notifyObservers(this),this},e.prototype.pause=function(){if(!this._isStarted)return this;this._isPaused=!0;for(var e=0;e-1&&this._scene.animationGroups.splice(e,1),this.onAnimationEndObservable.clear(),this.onAnimationGroupEndObservable.clear(),this.onAnimationGroupPauseObservable.clear(),this.onAnimationGroupPlayObservable.clear(),this.onAnimationLoopObservable.clear(),this.onAnimationGroupLoopObservable.clear()},e.prototype._checkAnimationGroupEnded=function(e){var t=this._animatables.indexOf(e);t>-1&&this._animatables.splice(t,1),0===this._animatables.length&&(this._isStarted=!1,this.onAnimationGroupEndObservable.notifyObservers(this))},e.prototype.clone=function(t,i){for(var n=new e(t||this.name,this._scene),r=0,o=this._targetedAnimations;r\nvoid main(void)\n{\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\n}");ue.Q.ShadersStore.rgbdDecodePixelShader=mt;i(6593);var vt=function(){function e(){}return e.ExpandRGBDTexture=function(e){var t=e._texture;if(t&&e.isRGBD){var i=t.getEngine(),n=i.getCaps(),r=!1;n.textureHalfFloatRender&&n.textureHalfFloatLinearFiltering?(r=!0,t.type=2):n.textureFloatRender&&n.textureFloatLinearFiltering&&(r=!0,t.type=1),r&&(t.isReady=!1,t._isRGBD=!1,t.invertY=!1),e.onLoadObservable.addOnce((function(){if(r){var n=new gt.D("rgbdDecode","rgbdDecode",null,null,1,null,3,i,!1,void 0,t.type,void 0,null,!1),o=i.createRenderTargetTexture(t.width,{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:t.samplingMode,type:t.type,format:5});n.getEffect().executeWhenCompiled((function(){n.onApply=function(e){e._bindTexture("textureSampler",t),e.setFloat2("scale",1,1)},e.getScene().postProcessManager.directRender([n],o,!0),i.restoreDefaultFramebuffer(),i._releaseTexture(t),i._releaseFramebufferObjects(o),n&&n.dispose(),o._swapAndDie(t),t.isReady=!0}))}}))}},e}(),yt=function(){function e(){}return e.GetEnvironmentBRDFTexture=function(e){if(!e.environmentBRDFTexture){var t=e.useDelayedTextureLoading;e.useDelayedTextureLoading=!1;var i=e._blockEntityCollection;e._blockEntityCollection=!1;var n=te.x.CreateFromBase64String(this._environmentBRDFBase64Texture,"EnvironmentBRDFTexture"+this._instanceNumber++,e,!0,!1,te.x.BILINEAR_SAMPLINGMODE);e._blockEntityCollection=i;var r=e.getEngine().getLoadedTexturesCache(),o=r.indexOf(n.getInternalTexture());-1!==o&&r.splice(o,1),n.isRGBD=!0,n.wrapU=te.x.CLAMP_ADDRESSMODE,n.wrapV=te.x.CLAMP_ADDRESSMODE,e.environmentBRDFTexture=n,e.useDelayedTextureLoading=t,vt.ExpandRGBDTexture(n)}return e.environmentBRDFTexture},e._instanceNumber=0,e._environmentBRDFBase64Texture="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR42u29yY5tWXIlZnbuiSaTbZFUkZRKrCKhElASQA0EoQABgn6hJvoXzfUP+gP9hWb6Bg00IgRoQJaKqUxmZmTEe8/v0uB2u7Fm2T7HIyIrnz88uPvt3f2a2WrMbOvf/u3PvvzP/sUf/N6//i8vf/lv/3v5H//d//Sb//Uq/5u8yf8hV/m/5Cp/L1f5hVzlG7nKJ7mKyJuIXN/hPwqXI/g++zq6rPI5u8z+WqfLre+zy7PrVv9L8brsMiGvk8XLmM/sdfHXal4e3ad6GXPdyu2ij8u/+uv/5cuf/OSLfdtEfvUr+dnf/d0X//t3H/7bf/hP//N/928h/0Yg/4VA/kogfyGQP5Wr/IFAvhbIlwK5CGQTPP+9z5uPeePJSW+yo2+s/GtN30Rnv1E+f5zxof9R/lSXv/nr//mrr3+i+5dfyX7ZZQP07Tffys//8R/l/9TtX7790T/7r/8G8pdy+/8XAvnnAvkzgfwzgfyxQP5AIL8vkJ8K5KsmMVzu1U7p5PA5AXxOAJ8TwPf7sX/51ZeXfcemqnp9w/W77/S7X/6T/vzf/7383RWCX3/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FXz9w/en0ZjD8kCDoKPNGwlB01BmoWQbh+AxR689mBponGJOr9OwmMu3dtJ/ylW1Tik4ElUPmR9RqII+pVhD9ychABMQ51gOIZg+/G+5mGIzLB1JJC5WhzYjhJ7IWmLDpA8jzsAafUPkB2WnFBF4iSxkq1ty7f25rv/+EQLOxs2oUdTSA9HIR9swdBlCcFe9owPC3XWDDC0ISVzsEVbSCF/sWdA5Fu4HJqankp2SeQCYYrImNalfmhpVxYrGkUS4LeSUjg8dD7+D7w/ybIfy7vlB9/HJ978zr7/45Qgajzj+4EjIK/ULHPRAOlKr/aG0AFcqCyu0GcW45Igh6JMJmhA49/U+cEssHNJhtXDC1MOya3j/sAiAGcrEtqtgjBD6wEzSDc7D8o6C8rIqAZyPk+NQoNLAZ1hR64Yl1FBY648smUYKnSg1Xwk/0DyRyArByMUobyByhCcPnOaPyoegREFS4jNfYAw+IHCjdC1J2WDZBke/OyN85J24WiXwDYPoJyYuCD238ulvuzwt6KgHf0shWKsqCFFGjB/w8HU8eeTED9wAAAAABJRU5ErkJggg==",e}(),bt=i(6936),Tt=i(5660),At=i(3552),Et=function(){function e(t){this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.roughness=0,this._indexOfRefraction=e._DefaultIndexOfRefraction,this.indexOfRefraction=e._DefaultIndexOfRefraction,this._texture=null,this.texture=null,this._useRoughnessFromMainTexture=!0,this.useRoughnessFromMainTexture=!0,this._textureRoughness=null,this.textureRoughness=null,this._remapF0OnInterfaceChange=!0,this.remapF0OnInterfaceChange=!0,this._bumpTexture=null,this.bumpTexture=null,this._isTintEnabled=!1,this.isTintEnabled=!1,this.tintColor=w.Wo.White(),this.tintColorAtDistance=1,this.tintThickness=1,this._tintTexture=null,this.tintTexture=null,this._internalMarkAllSubMeshesAsTexturesDirty=t}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t,i,n){if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&Tt.k.ClearCoatTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._textureRoughness&&Tt.k.ClearCoatTextureEnabled&&!this._textureRoughness.isReadyOrNotBlocking())return!1;if(i.getCaps().standardDerivatives&&this._bumpTexture&&Tt.k.ClearCoatBumpTextureEnabled&&!n&&!this._bumpTexture.isReady())return!1;if(this._isTintEnabled&&this._tintTexture&&Tt.k.ClearCoatTintTextureEnabled&&!this._tintTexture.isReadyOrNotBlocking())return!1}return!0},e.prototype.prepareDefines=function(t,i){var n;this._isEnabled?(t.CLEARCOAT=!0,t.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=this._useRoughnessFromMainTexture,t.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL=null!==this._texture&&this._texture._texture===(null===(n=this._textureRoughness)||void 0===n?void 0:n._texture)&&this._texture.checkTransformsAreIdentical(this._textureRoughness),t.CLEARCOAT_REMAP_F0=this._remapF0OnInterfaceChange,t._areTexturesDirty&&i.texturesEnabled&&(this._texture&&Tt.k.ClearCoatTextureEnabled?At.G.PrepareDefinesForMergedUV(this._texture,t,"CLEARCOAT_TEXTURE"):t.CLEARCOAT_TEXTURE=!1,this._textureRoughness&&Tt.k.ClearCoatTextureEnabled?At.G.PrepareDefinesForMergedUV(this._textureRoughness,t,"CLEARCOAT_TEXTURE_ROUGHNESS"):t.CLEARCOAT_TEXTURE_ROUGHNESS=!1,this._bumpTexture&&Tt.k.ClearCoatBumpTextureEnabled?At.G.PrepareDefinesForMergedUV(this._bumpTexture,t,"CLEARCOAT_BUMP"):t.CLEARCOAT_BUMP=!1,t.CLEARCOAT_DEFAULTIOR=this._indexOfRefraction===e._DefaultIndexOfRefraction,this._isTintEnabled?(t.CLEARCOAT_TINT=!0,this._tintTexture&&Tt.k.ClearCoatTintTextureEnabled?At.G.PrepareDefinesForMergedUV(this._tintTexture,t,"CLEARCOAT_TINT_TEXTURE"):t.CLEARCOAT_TINT_TEXTURE=!1):(t.CLEARCOAT_TINT=!1,t.CLEARCOAT_TINT_TEXTURE=!1))):(t.CLEARCOAT=!1,t.CLEARCOAT_TEXTURE=!1,t.CLEARCOAT_TEXTURE_ROUGHNESS=!1,t.CLEARCOAT_BUMP=!1,t.CLEARCOAT_TINT=!1,t.CLEARCOAT_TINT_TEXTURE=!1,t.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,t.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL=!1)},e.prototype.bindForSubMesh=function(e,t,i,n,r,o,s,a){var l,h,c,u,f,d,p,_,g=a._materialDefines,m=g.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL;if(!e.useUbo||!r||!e.isSync){m&&Tt.k.ClearCoatTextureEnabled?(e.updateFloat4("vClearCoatInfos",this._texture.coordinatesIndex,this._texture.level,-1,-1),At.G.BindTextureMatrix(this._texture,e,"clearCoat")):(this._texture||this._textureRoughness)&&Tt.k.ClearCoatTextureEnabled&&(e.updateFloat4("vClearCoatInfos",null!==(h=null===(l=this._texture)||void 0===l?void 0:l.coordinatesIndex)&&void 0!==h?h:0,null!==(u=null===(c=this._texture)||void 0===c?void 0:c.level)&&void 0!==u?u:0,null!==(d=null===(f=this._textureRoughness)||void 0===f?void 0:f.coordinatesIndex)&&void 0!==d?d:0,null!==(_=null===(p=this._textureRoughness)||void 0===p?void 0:p.level)&&void 0!==_?_:0),this._texture&&At.G.BindTextureMatrix(this._texture,e,"clearCoat"),!this._textureRoughness||m||g.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE||At.G.BindTextureMatrix(this._textureRoughness,e,"clearCoatRoughness")),this._bumpTexture&&i.getCaps().standardDerivatives&&Tt.k.ClearCoatTextureEnabled&&!n&&(e.updateFloat2("vClearCoatBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level),At.G.BindTextureMatrix(this._bumpTexture,e,"clearCoatBump"),t._mirroredCameraPosition?e.updateFloat2("vClearCoatTangentSpaceParams",o?1:-1,s?1:-1):e.updateFloat2("vClearCoatTangentSpaceParams",o?-1:1,s?-1:1)),this._tintTexture&&Tt.k.ClearCoatTintTextureEnabled&&(e.updateFloat2("vClearCoatTintInfos",this._tintTexture.coordinatesIndex,this._tintTexture.level),At.G.BindTextureMatrix(this._tintTexture,e,"clearCoatTint")),e.updateFloat2("vClearCoatParams",this.intensity,this.roughness);var v=1-this._indexOfRefraction,y=1+this._indexOfRefraction,b=Math.pow(-v/y,2),T=1/this._indexOfRefraction;e.updateFloat4("vClearCoatRefractionParams",b,T,v,y),this._isTintEnabled&&(e.updateFloat4("vClearCoatTintParams",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintThickness)),e.updateFloat("clearCoatColorAtDistance",Math.max(1e-5,this.tintColorAtDistance)))}t.texturesEnabled&&(this._texture&&Tt.k.ClearCoatTextureEnabled&&e.setTexture("clearCoatSampler",this._texture),this._textureRoughness&&!m&&!g.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE&&Tt.k.ClearCoatTextureEnabled&&e.setTexture("clearCoatRoughnessSampler",this._textureRoughness),this._bumpTexture&&i.getCaps().standardDerivatives&&Tt.k.ClearCoatBumpTextureEnabled&&!n&&e.setTexture("clearCoatBumpSampler",this._bumpTexture),this._isTintEnabled&&this._tintTexture&&Tt.k.ClearCoatTintTextureEnabled&&e.setTexture("clearCoatTintSampler",this._tintTexture))},e.prototype.hasTexture=function(e){return this._texture===e||(this._textureRoughness===e||(this._bumpTexture===e||this._tintTexture===e))},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._textureRoughness&&e.push(this._textureRoughness),this._bumpTexture&&e.push(this._bumpTexture),this._tintTexture&&e.push(this._tintTexture)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._textureRoughness&&this._textureRoughness.animations&&this._textureRoughness.animations.length>0&&e.push(this._textureRoughness),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._tintTexture&&this._tintTexture.animations&&this._tintTexture.animations.length>0&&e.push(this._tintTexture)},e.prototype.dispose=function(e){var t,i,n,r;e&&(null===(t=this._texture)||void 0===t||t.dispose(),null===(i=this._textureRoughness)||void 0===i||i.dispose(),null===(n=this._bumpTexture)||void 0===n||n.dispose(),null===(r=this._tintTexture)||void 0===r||r.dispose())},e.prototype.getClassName=function(){return"PBRClearCoatConfiguration"},e.AddFallbacks=function(e,t,i){return e.CLEARCOAT_BUMP&&t.addFallback(i++,"CLEARCOAT_BUMP"),e.CLEARCOAT_TINT&&t.addFallback(i++,"CLEARCOAT_TINT"),e.CLEARCOAT&&t.addFallback(i++,"CLEARCOAT"),i},e.AddUniforms=function(e){e.push("vClearCoatTangentSpaceParams","vClearCoatParams","vClearCoatRefractionParams","vClearCoatTintParams","clearCoatColorAtDistance","clearCoatMatrix","clearCoatRoughnessMatrix","clearCoatBumpMatrix","clearCoatTintMatrix","vClearCoatInfos","vClearCoatBumpInfos","vClearCoatTintInfos")},e.AddSamplers=function(e){e.push("clearCoatSampler","clearCoatRoughnessSampler","clearCoatBumpSampler","clearCoatTintSampler")},e.PrepareUniformBuffer=function(e){e.addUniform("vClearCoatParams",2),e.addUniform("vClearCoatRefractionParams",4),e.addUniform("vClearCoatInfos",4),e.addUniform("clearCoatMatrix",16),e.addUniform("clearCoatRoughnessMatrix",16),e.addUniform("vClearCoatBumpInfos",2),e.addUniform("vClearCoatTangentSpaceParams",2),e.addUniform("clearCoatBumpMatrix",16),e.addUniform("vClearCoatTintParams",4),e.addUniform("clearCoatColorAtDistance",1),e.addUniform("vClearCoatTintInfos",2),e.addUniform("clearCoatTintMatrix",16)},e.prototype.copyTo=function(e){F.p4.Clone((function(){return e}),this)},e.prototype.serialize=function(){return F.p4.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.p4.Parse((function(){return n}),e,t,i)},e._DefaultIndexOfRefraction=1.5,(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"intensity",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"roughness",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"indexOfRefraction",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"useRoughnessFromMainTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"textureRoughness",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"remapF0OnInterfaceChange",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"bumpTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isTintEnabled",void 0),(0,l.gn)([(0,F.n9)()],e.prototype,"tintColor",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"tintColorAtDistance",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"tintThickness",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"tintTexture",void 0),e}(),Ct=function(){function e(e){this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.direction=new L.FM(1,0),this._texture=null,this.texture=null,this._internalMarkAllSubMeshesAsTexturesDirty=e}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t){return!(e._areTexturesDirty&&t.texturesEnabled&&this._texture&&Tt.k.AnisotropicTextureEnabled&&!this._texture.isReadyOrNotBlocking())},e.prototype.prepareDefines=function(e,t,i){this._isEnabled?(e.ANISOTROPIC=this._isEnabled,this._isEnabled&&!t.isVerticesDataPresent(me.o.TangentKind)&&(e._needUVs=!0,e.MAINUV1=!0),e._areTexturesDirty&&i.texturesEnabled&&(this._texture&&Tt.k.AnisotropicTextureEnabled?At.G.PrepareDefinesForMergedUV(this._texture,e,"ANISOTROPIC_TEXTURE"):e.ANISOTROPIC_TEXTURE=!1)):(e.ANISOTROPIC=!1,e.ANISOTROPIC_TEXTURE=!1)},e.prototype.bindForSubMesh=function(e,t,i){e.useUbo&&i&&e.isSync||(this._texture&&Tt.k.AnisotropicTextureEnabled&&(e.updateFloat2("vAnisotropyInfos",this._texture.coordinatesIndex,this._texture.level),At.G.BindTextureMatrix(this._texture,e,"anisotropy")),e.updateFloat3("vAnisotropy",this.direction.x,this.direction.y,this.intensity)),t.texturesEnabled&&this._texture&&Tt.k.AnisotropicTextureEnabled&&e.setTexture("anisotropySampler",this._texture)},e.prototype.hasTexture=function(e){return this._texture===e},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)},e.prototype.dispose=function(e){e&&this._texture&&this._texture.dispose()},e.prototype.getClassName=function(){return"PBRAnisotropicConfiguration"},e.AddFallbacks=function(e,t,i){return e.ANISOTROPIC&&t.addFallback(i++,"ANISOTROPIC"),i},e.AddUniforms=function(e){e.push("vAnisotropy","vAnisotropyInfos","anisotropyMatrix")},e.PrepareUniformBuffer=function(e){e.addUniform("vAnisotropy",3),e.addUniform("vAnisotropyInfos",2),e.addUniform("anisotropyMatrix",16)},e.AddSamplers=function(e){e.push("anisotropySampler")},e.prototype.copyTo=function(e){F.p4.Clone((function(){return e}),this)},e.prototype.serialize=function(){return F.p4.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.p4.Parse((function(){return n}),e,t,i)},(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"intensity",void 0),(0,l.gn)([(0,F.QC)()],e.prototype,"direction",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),e}(),xt=function(){function e(t){this._useEnergyConservation=e.DEFAULT_USE_ENERGY_CONSERVATION,this.useEnergyConservation=e.DEFAULT_USE_ENERGY_CONSERVATION,this._useSmithVisibilityHeightCorrelated=e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,this.useSmithVisibilityHeightCorrelated=e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,this._useSphericalHarmonics=e.DEFAULT_USE_SPHERICAL_HARMONICS,this.useSphericalHarmonics=e.DEFAULT_USE_SPHERICAL_HARMONICS,this._useSpecularGlossinessInputEnergyConservation=e.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION,this.useSpecularGlossinessInputEnergyConservation=e.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION,this._internalMarkAllSubMeshesAsMiscDirty=t}return e.prototype._markAllSubMeshesAsMiscDirty=function(){this._internalMarkAllSubMeshesAsMiscDirty()},e.prototype.prepareDefines=function(e){e.BRDF_V_HEIGHT_CORRELATED=this._useSmithVisibilityHeightCorrelated,e.MS_BRDF_ENERGY_CONSERVATION=this._useEnergyConservation&&this._useSmithVisibilityHeightCorrelated,e.SPHERICAL_HARMONICS=this._useSphericalHarmonics,e.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION=this._useSpecularGlossinessInputEnergyConservation},e.prototype.getClassName=function(){return"PBRBRDFConfiguration"},e.prototype.copyTo=function(e){F.p4.Clone((function(){return e}),this)},e.prototype.serialize=function(){return F.p4.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.p4.Parse((function(){return n}),e,t,i)},e.DEFAULT_USE_ENERGY_CONSERVATION=!0,e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED=!0,e.DEFAULT_USE_SPHERICAL_HARMONICS=!0,e.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION=!0,(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useEnergyConservation",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useSmithVisibilityHeightCorrelated",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useSphericalHarmonics",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useSpecularGlossinessInputEnergyConservation",void 0),e}(),St=function(){function e(e){this._isEnabled=!1,this.isEnabled=!1,this._linkSheenWithAlbedo=!1,this.linkSheenWithAlbedo=!1,this.intensity=1,this.color=w.Wo.White(),this._texture=null,this.texture=null,this._useRoughnessFromMainTexture=!0,this.useRoughnessFromMainTexture=!0,this._roughness=null,this.roughness=null,this._textureRoughness=null,this.textureRoughness=null,this._albedoScaling=!1,this.albedoScaling=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t){if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&Tt.k.SheenTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._textureRoughness&&Tt.k.SheenTextureEnabled&&!this._textureRoughness.isReadyOrNotBlocking())return!1}return!0},e.prototype.prepareDefines=function(e,t){var i;this._isEnabled?(e.SHEEN=this._isEnabled,e.SHEEN_LINKWITHALBEDO=this._linkSheenWithAlbedo,e.SHEEN_ROUGHNESS=null!==this._roughness,e.SHEEN_ALBEDOSCALING=this._albedoScaling,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=this._useRoughnessFromMainTexture,e.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL=null!==this._texture&&this._texture._texture===(null===(i=this._textureRoughness)||void 0===i?void 0:i._texture)&&this._texture.checkTransformsAreIdentical(this._textureRoughness),e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&Tt.k.SheenTextureEnabled?At.G.PrepareDefinesForMergedUV(this._texture,e,"SHEEN_TEXTURE"):e.SHEEN_TEXTURE=!1,this._textureRoughness&&Tt.k.SheenTextureEnabled?At.G.PrepareDefinesForMergedUV(this._textureRoughness,e,"SHEEN_TEXTURE_ROUGHNESS"):e.SHEEN_TEXTURE_ROUGHNESS=!1)):(e.SHEEN=!1,e.SHEEN_TEXTURE=!1,e.SHEEN_TEXTURE_ROUGHNESS=!1,e.SHEEN_LINKWITHALBEDO=!1,e.SHEEN_ROUGHNESS=!1,e.SHEEN_ALBEDOSCALING=!1,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,e.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL=!1)},e.prototype.bindForSubMesh=function(e,t,i,n){var r,o,s,a,l,h,c,u,f=n._materialDefines,d=f.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL;e.useUbo&&i&&e.isSync||(d&&Tt.k.SheenTextureEnabled?(e.updateFloat4("vSheenInfos",this._texture.coordinatesIndex,this._texture.level,-1,-1),At.G.BindTextureMatrix(this._texture,e,"sheen")):(this._texture||this._textureRoughness)&&Tt.k.SheenTextureEnabled&&(e.updateFloat4("vSheenInfos",null!==(o=null===(r=this._texture)||void 0===r?void 0:r.coordinatesIndex)&&void 0!==o?o:0,null!==(a=null===(s=this._texture)||void 0===s?void 0:s.level)&&void 0!==a?a:0,null!==(h=null===(l=this._textureRoughness)||void 0===l?void 0:l.coordinatesIndex)&&void 0!==h?h:0,null!==(u=null===(c=this._textureRoughness)||void 0===c?void 0:c.level)&&void 0!==u?u:0),this._texture&&At.G.BindTextureMatrix(this._texture,e,"sheen"),!this._textureRoughness||d||f.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE||At.G.BindTextureMatrix(this._textureRoughness,e,"sheenRoughness")),e.updateFloat4("vSheenColor",this.color.r,this.color.g,this.color.b,this.intensity),null!==this._roughness&&e.updateFloat("vSheenRoughness",this._roughness)),t.texturesEnabled&&(this._texture&&Tt.k.SheenTextureEnabled&&e.setTexture("sheenSampler",this._texture),this._textureRoughness&&!d&&!f.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE&&Tt.k.SheenTextureEnabled&&e.setTexture("sheenRoughnessSampler",this._textureRoughness))},e.prototype.hasTexture=function(e){return this._texture===e||this._textureRoughness===e},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._textureRoughness&&e.push(this._textureRoughness)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._textureRoughness&&this._textureRoughness.animations&&this._textureRoughness.animations.length>0&&e.push(this._textureRoughness)},e.prototype.dispose=function(e){var t,i;e&&(null===(t=this._texture)||void 0===t||t.dispose(),null===(i=this._textureRoughness)||void 0===i||i.dispose())},e.prototype.getClassName=function(){return"PBRSheenConfiguration"},e.AddFallbacks=function(e,t,i){return e.SHEEN&&t.addFallback(i++,"SHEEN"),i},e.AddUniforms=function(e){e.push("vSheenColor","vSheenRoughness","vSheenInfos","sheenMatrix","sheenRoughnessMatrix")},e.PrepareUniformBuffer=function(e){e.addUniform("vSheenColor",4),e.addUniform("vSheenRoughness",1),e.addUniform("vSheenInfos",4),e.addUniform("sheenMatrix",16),e.addUniform("sheenRoughnessMatrix",16)},e.AddSamplers=function(e){e.push("sheenSampler"),e.push("sheenRoughnessSampler")},e.prototype.copyTo=function(e){F.p4.Clone((function(){return e}),this)},e.prototype.serialize=function(){return F.p4.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.p4.Parse((function(){return n}),e,t,i)},(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"linkSheenWithAlbedo",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"intensity",void 0),(0,l.gn)([(0,F.n9)()],e.prototype,"color",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"useRoughnessFromMainTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"roughness",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"textureRoughness",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"albedoScaling",void 0),e}(),Rt=i(9018),Mt=function(){function e(e,t,i){this._isRefractionEnabled=!1,this.isRefractionEnabled=!1,this._isTranslucencyEnabled=!1,this.isTranslucencyEnabled=!1,this._isScatteringEnabled=!1,this.isScatteringEnabled=!1,this._scatteringDiffusionProfileIndex=0,this.refractionIntensity=1,this.translucencyIntensity=1,this.useAlbedoToTintRefraction=!1,this._thicknessTexture=null,this.thicknessTexture=null,this._refractionTexture=null,this.refractionTexture=null,this._indexOfRefraction=1.5,this.indexOfRefraction=1.5,this._volumeIndexOfRefraction=-1,this._invertRefractionY=!1,this.invertRefractionY=!1,this._linkRefractionWithTransparency=!1,this.linkRefractionWithTransparency=!1,this.minimumThickness=0,this.maximumThickness=1,this.tintColor=w.Wo.White(),this.tintColorAtDistance=1,this.diffusionDistance=w.Wo.White(),this._useMaskFromThicknessTexture=!1,this.useMaskFromThicknessTexture=!1,this._useMaskFromThicknessTextureGltf=!1,this.useMaskFromThicknessTextureGltf=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e,this._internalMarkScenePrePassDirty=t,this._scene=i}return Object.defineProperty(e.prototype,"scatteringDiffusionProfile",{get:function(){return this._scene.subSurfaceConfiguration?this._scene.subSurfaceConfiguration.ssDiffusionProfileColors[this._scatteringDiffusionProfileIndex]:null},set:function(e){this._scene.enableSubSurfaceForPrePass()&&e&&(this._scatteringDiffusionProfileIndex=this._scene.subSurfaceConfiguration.addDiffusionProfile(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeIndexOfRefraction",{get:function(){return this._volumeIndexOfRefraction>=1?this._volumeIndexOfRefraction:this._indexOfRefraction},set:function(e){this._volumeIndexOfRefraction=e>=1?e:-1},enumerable:!1,configurable:!0}),e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype._markScenePrePassDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty(),this._internalMarkScenePrePassDirty()},e.prototype.isReadyForSubMesh=function(e,t){if(e._areTexturesDirty&&t.texturesEnabled){if(this._thicknessTexture&&Tt.k.ThicknessTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1;var i=this._getRefractionTexture(t);if(i&&Tt.k.RefractionTextureEnabled&&!i.isReadyOrNotBlocking())return!1}return!0},e.prototype.prepareDefines=function(e,t){if(e._areTexturesDirty&&(e.SUBSURFACE=!1,e.SS_TRANSLUCENCY=this._isTranslucencyEnabled,e.SS_SCATTERING=this._isScatteringEnabled,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_MASK_FROM_THICKNESS_TEXTURE=!1,e.SS_MASK_FROM_THICKNESS_TEXTURE_GLTF=!1,e.SS_REFRACTION=!1,e.SS_REFRACTIONMAP_3D=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,e.SS_ALBEDOFORREFRACTIONTINT=!1,(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled)&&(e.SUBSURFACE=!0,e._areTexturesDirty&&t.texturesEnabled&&this._thicknessTexture&&Tt.k.ThicknessTextureEnabled&&At.G.PrepareDefinesForMergedUV(this._thicknessTexture,e,"SS_THICKNESSANDMASK_TEXTURE"),e.SS_MASK_FROM_THICKNESS_TEXTURE=this._useMaskFromThicknessTexture,e.SS_MASK_FROM_THICKNESS_TEXTURE_GLTF=this._useMaskFromThicknessTextureGltf),this._isRefractionEnabled&&t.texturesEnabled)){var i=this._getRefractionTexture(t);i&&Tt.k.RefractionTextureEnabled&&(e.SS_REFRACTION=!0,e.SS_REFRACTIONMAP_3D=i.isCube,e.SS_GAMMAREFRACTION=i.gammaSpace,e.SS_RGBDREFRACTION=i.isRGBD,e.SS_LINEARSPECULARREFRACTION=i.linearSpecularLOD,e.SS_REFRACTIONMAP_OPPOSITEZ=i.invertZ,e.SS_LODINREFRACTIONALPHA=i.lodLevelInAlpha,e.SS_LINKREFRACTIONTOTRANSPARENCY=this._linkRefractionWithTransparency,e.SS_ALBEDOFORREFRACTIONTINT=this.useAlbedoToTintRefraction)}},e.prototype.bindForSubMesh=function(e,t,i,n,r,o){var s=this._getRefractionTexture(t);if(!e.useUbo||!n||!e.isSync){if(this._thicknessTexture&&Tt.k.ThicknessTextureEnabled&&(e.updateFloat2("vThicknessInfos",this._thicknessTexture.coordinatesIndex,this._thicknessTexture.level),At.G.BindTextureMatrix(this._thicknessTexture,e,"thickness")),e.updateFloat2("vThicknessParam",this.minimumThickness,this.maximumThickness-this.minimumThickness),s&&Tt.k.RefractionTextureEnabled){e.updateMatrix("refractionMatrix",s.getReflectionTextureMatrix());var a=1;s.isCube||s.depth&&(a=s.depth);var l=s.getSize().width,h=this.volumeIndexOfRefraction;e.updateFloat4("vRefractionInfos",s.level,1/h,a,this._invertRefractionY?-1:1),e.updateFloat3("vRefractionMicrosurfaceInfos",l,s.lodGenerationScale,s.lodGenerationOffset),o&&e.updateFloat2("vRefractionFilteringInfo",l,Rt.R.Log2(l))}this.isScatteringEnabled&&e.updateFloat("scatteringDiffusionProfile",this._scatteringDiffusionProfileIndex),e.updateColor3("vDiffusionDistance",this.diffusionDistance),e.updateFloat4("vTintColor",this.tintColor.r,this.tintColor.g,this.tintColor.b,this.tintColorAtDistance),e.updateFloat3("vSubSurfaceIntensity",this.refractionIntensity,this.translucencyIntensity,0)}t.texturesEnabled&&(this._thicknessTexture&&Tt.k.ThicknessTextureEnabled&&e.setTexture("thicknessSampler",this._thicknessTexture),s&&Tt.k.RefractionTextureEnabled&&(r?e.setTexture("refractionSampler",s):(e.setTexture("refractionSampler",s._lodTextureMid||s),e.setTexture("refractionSamplerLow",s._lodTextureLow||s),e.setTexture("refractionSamplerHigh",s._lodTextureHigh||s))))},e.prototype.unbind=function(e){return!(!this._refractionTexture||!this._refractionTexture.isRenderTarget)&&(e.setTexture("refractionSampler",null),!0)},e.prototype._getRefractionTexture=function(e){return this._refractionTexture?this._refractionTexture:this._isRefractionEnabled?e.environmentTexture:null},Object.defineProperty(e.prototype,"disableAlphaBlending",{get:function(){return this.isRefractionEnabled&&this._linkRefractionWithTransparency},enumerable:!1,configurable:!0}),e.prototype.fillRenderTargetTextures=function(e){Tt.k.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget&&e.push(this._refractionTexture)},e.prototype.hasTexture=function(e){return this._thicknessTexture===e||this._refractionTexture===e},e.prototype.hasRenderTargetTextures=function(){return!!(Tt.k.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)},e.prototype.getActiveTextures=function(e){this._thicknessTexture&&e.push(this._thicknessTexture),this._refractionTexture&&e.push(this._refractionTexture)},e.prototype.getAnimatables=function(e){this._thicknessTexture&&this._thicknessTexture.animations&&this._thicknessTexture.animations.length>0&&e.push(this._thicknessTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&e.push(this._refractionTexture)},e.prototype.dispose=function(e){e&&(this._thicknessTexture&&this._thicknessTexture.dispose(),this._refractionTexture&&this._refractionTexture.dispose())},e.prototype.getClassName=function(){return"PBRSubSurfaceConfiguration"},e.AddFallbacks=function(e,t,i){return e.SS_SCATTERING&&t.addFallback(i++,"SS_SCATTERING"),e.SS_TRANSLUCENCY&&t.addFallback(i++,"SS_TRANSLUCENCY"),i},e.AddUniforms=function(e){e.push("vDiffusionDistance","vTintColor","vSubSurfaceIntensity","vRefractionMicrosurfaceInfos","vRefractionFilteringInfo","vRefractionInfos","vThicknessInfos","vThicknessParam","refractionMatrix","thicknessMatrix","scatteringDiffusionProfile")},e.AddSamplers=function(e){e.push("thicknessSampler","refractionSampler","refractionSamplerLow","refractionSamplerHigh")},e.PrepareUniformBuffer=function(e){e.addUniform("vRefractionMicrosurfaceInfos",3),e.addUniform("vRefractionFilteringInfo",2),e.addUniform("vRefractionInfos",4),e.addUniform("refractionMatrix",16),e.addUniform("vThicknessInfos",2),e.addUniform("thicknessMatrix",16),e.addUniform("vThicknessParam",2),e.addUniform("vDiffusionDistance",3),e.addUniform("vTintColor",4),e.addUniform("vSubSurfaceIntensity",3),e.addUniform("scatteringDiffusionProfile",1)},e.prototype.copyTo=function(e){F.p4.Clone((function(){return e}),this)},e.prototype.serialize=function(){return F.p4.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.p4.Parse((function(){return n}),e,t,i)},(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isRefractionEnabled",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isTranslucencyEnabled",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markScenePrePassDirty")],e.prototype,"isScatteringEnabled",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"_scatteringDiffusionProfileIndex",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"refractionIntensity",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"translucencyIntensity",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"useAlbedoToTintRefraction",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"thicknessTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"refractionTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"indexOfRefraction",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"_volumeIndexOfRefraction",void 0),(0,l.gn)([(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"volumeIndexOfRefraction",null),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"invertRefractionY",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"linkRefractionWithTransparency",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"minimumThickness",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"maximumThickness",void 0),(0,l.gn)([(0,F.n9)()],e.prototype,"tintColor",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"tintColorAtDistance",void 0),(0,l.gn)([(0,F.n9)()],e.prototype,"diffusionDistance",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"useMaskFromThicknessTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"useMaskFromThicknessTextureGltf",void 0),e}(),Pt=i(9640),It=i(2659),Ot=i(1345),Dt=i(872),Lt=[Math.sqrt(1/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(3/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(15/(4*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(5/(16*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(15/(16*Math.PI))],wt=[function(e){return 1},function(e){return e.y},function(e){return e.z},function(e){return e.x},function(e){return e.x*e.y},function(e){return e.y*e.z},function(e){return 3*e.z*e.z-1},function(e){return e.x*e.z},function(e){return e.x*e.x-e.y*e.y}],Nt=function(e,t){return Lt[e]*wt[e](t)},Ft=[Math.PI,2*Math.PI/3,2*Math.PI/3,2*Math.PI/3,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4],Bt=function(){function e(){this.preScaled=!1,this.l00=L.P.Zero(),this.l1_1=L.P.Zero(),this.l10=L.P.Zero(),this.l11=L.P.Zero(),this.l2_2=L.P.Zero(),this.l2_1=L.P.Zero(),this.l20=L.P.Zero(),this.l21=L.P.Zero(),this.l22=L.P.Zero()}return e.prototype.addLight=function(e,t,i){var n=new L.P(t.r,t.g,t.b).scale(i);this.l00=this.l00.add(n.scale(Nt(0,e))),this.l1_1=this.l1_1.add(n.scale(Nt(1,e))),this.l10=this.l10.add(n.scale(Nt(2,e))),this.l11=this.l11.add(n.scale(Nt(3,e))),this.l2_2=this.l2_2.add(n.scale(Nt(4,e))),this.l2_1=this.l2_1.add(n.scale(Nt(5,e))),this.l20=this.l20.add(n.scale(Nt(6,e))),this.l21=this.l21.add(n.scale(Nt(7,e))),this.l22=this.l22.add(n.scale(Nt(8,e)))},e.prototype.scaleInPlace=function(e){this.l00.scaleInPlace(e),this.l1_1.scaleInPlace(e),this.l10.scaleInPlace(e),this.l11.scaleInPlace(e),this.l2_2.scaleInPlace(e),this.l2_1.scaleInPlace(e),this.l20.scaleInPlace(e),this.l21.scaleInPlace(e),this.l22.scaleInPlace(e)},e.prototype.convertIncidentRadianceToIrradiance=function(){this.l00.scaleInPlace(Ft[0]),this.l1_1.scaleInPlace(Ft[1]),this.l10.scaleInPlace(Ft[2]),this.l11.scaleInPlace(Ft[3]),this.l2_2.scaleInPlace(Ft[4]),this.l2_1.scaleInPlace(Ft[5]),this.l20.scaleInPlace(Ft[6]),this.l21.scaleInPlace(Ft[7]),this.l22.scaleInPlace(Ft[8])},e.prototype.convertIrradianceToLambertianRadiance=function(){this.scaleInPlace(1/Math.PI)},e.prototype.preScaleForRendering=function(){this.preScaled=!0,this.l00.scaleInPlace(Lt[0]),this.l1_1.scaleInPlace(Lt[1]),this.l10.scaleInPlace(Lt[2]),this.l11.scaleInPlace(Lt[3]),this.l2_2.scaleInPlace(Lt[4]),this.l2_1.scaleInPlace(Lt[5]),this.l20.scaleInPlace(Lt[6]),this.l21.scaleInPlace(Lt[7]),this.l22.scaleInPlace(Lt[8])},e.FromArray=function(t){var i=new e;return L.P.FromArrayToRef(t[0],0,i.l00),L.P.FromArrayToRef(t[1],0,i.l1_1),L.P.FromArrayToRef(t[2],0,i.l10),L.P.FromArrayToRef(t[3],0,i.l11),L.P.FromArrayToRef(t[4],0,i.l2_2),L.P.FromArrayToRef(t[5],0,i.l2_1),L.P.FromArrayToRef(t[6],0,i.l20),L.P.FromArrayToRef(t[7],0,i.l21),L.P.FromArrayToRef(t[8],0,i.l22),i},e.FromPolynomial=function(t){var i=new e;return i.l00=t.xx.scale(.376127).add(t.yy.scale(.376127)).add(t.zz.scale(.376126)),i.l1_1=t.y.scale(.977204),i.l10=t.z.scale(.977204),i.l11=t.x.scale(.977204),i.l2_2=t.xy.scale(1.16538),i.l2_1=t.yz.scale(1.16538),i.l20=t.zz.scale(1.34567).subtract(t.xx.scale(.672834)).subtract(t.yy.scale(.672834)),i.l21=t.zx.scale(1.16538),i.l22=t.xx.scale(1.16538).subtract(t.yy.scale(1.16538)),i.l1_1.scaleInPlace(-1),i.l11.scaleInPlace(-1),i.l2_1.scaleInPlace(-1),i.l21.scaleInPlace(-1),i.scaleInPlace(Math.PI),i},e}(),Ut=function(){function e(){this.x=L.P.Zero(),this.y=L.P.Zero(),this.z=L.P.Zero(),this.xx=L.P.Zero(),this.yy=L.P.Zero(),this.zz=L.P.Zero(),this.xy=L.P.Zero(),this.yz=L.P.Zero(),this.zx=L.P.Zero()}return Object.defineProperty(e.prototype,"preScaledHarmonics",{get:function(){return this._harmonics||(this._harmonics=Bt.FromPolynomial(this)),this._harmonics.preScaled||this._harmonics.preScaleForRendering(),this._harmonics},enumerable:!1,configurable:!0}),e.prototype.addAmbient=function(e){var t=new L.P(e.r,e.g,e.b);this.xx=this.xx.add(t),this.yy=this.yy.add(t),this.zz=this.zz.add(t)},e.prototype.scaleInPlace=function(e){this.x.scaleInPlace(e),this.y.scaleInPlace(e),this.z.scaleInPlace(e),this.xx.scaleInPlace(e),this.yy.scaleInPlace(e),this.zz.scaleInPlace(e),this.yz.scaleInPlace(e),this.zx.scaleInPlace(e),this.xy.scaleInPlace(e)},e.FromHarmonics=function(t){var i=new e;return i._harmonics=t,i.x=t.l11.scale(1.02333).scale(-1),i.y=t.l1_1.scale(1.02333).scale(-1),i.z=t.l10.scale(1.02333),i.xx=t.l00.scale(.886277).subtract(t.l20.scale(.247708)).add(t.l22.scale(.429043)),i.yy=t.l00.scale(.886277).subtract(t.l20.scale(.247708)).subtract(t.l22.scale(.429043)),i.zz=t.l00.scale(.886277).add(t.l20.scale(.495417)),i.yz=t.l2_1.scale(.858086).scale(-1),i.zx=t.l21.scale(.858086).scale(-1),i.xy=t.l2_2.scale(.858086),i.scaleInPlace(1/Math.PI),i},e.FromArray=function(t){var i=new e;return L.P.FromArrayToRef(t[0],0,i.x),L.P.FromArrayToRef(t[1],0,i.y),L.P.FromArrayToRef(t[2],0,i.z),L.P.FromArrayToRef(t[3],0,i.xx),L.P.FromArrayToRef(t[4],0,i.yy),L.P.FromArrayToRef(t[5],0,i.zz),L.P.FromArrayToRef(t[6],0,i.yz),L.P.FromArrayToRef(t[7],0,i.zx),L.P.FromArrayToRef(t[8],0,i.xy),i},e}(),kt=i(2782),Vt=function(e,t,i,n){this.name=e,this.worldAxisForNormal=t,this.worldAxisForFileX=i,this.worldAxisForFileY=n},Gt=function(){function e(){}return e.ConvertCubeMapTextureToSphericalPolynomial=function(e){if(!e.isCube)return null;var t,i,n=e.getSize().width,r=e.readPixels(0),o=e.readPixels(1);e.isRenderTarget?(t=e.readPixels(3),i=e.readPixels(2)):(t=e.readPixels(2),i=e.readPixels(3));var s=e.readPixels(4),a=e.readPixels(5),l=e.gammaSpace,h=0;1!=e.textureType&&2!=e.textureType||(h=1);var c={size:n,right:r,left:o,up:t,down:i,front:s,back:a,format:5,type:h,gammaSpace:l};return this.ConvertCubeMapToSphericalPolynomial(c)},e.ConvertCubeMapToSphericalPolynomial=function(e){for(var t=new Bt,i=0,n=2/e.size,r=n,o=.5*n-1,s=0;s<6;s++)for(var a=this.FileFaces[s],l=e[a.name],h=o,c=5===e.format?4:3,u=0;u0?(i.NUM_SAMPLES=""+this.realTimeFilteringQuality,a.webGLVersion>1&&(i.NUM_SAMPLES=i.NUM_SAMPLES+"u"),i.REALTIME_FILTERING=!0):i.REALTIME_FILTERING=!1,l.coordinatesMode===te.x.INVCUBIC_MODE&&(i.INVERTCUBICMAP=!0),i.REFLECTIONMAP_3D=l.isCube,i.REFLECTIONMAP_CUBIC=!1,i.REFLECTIONMAP_EXPLICIT=!1,i.REFLECTIONMAP_PLANAR=!1,i.REFLECTIONMAP_PROJECTION=!1,i.REFLECTIONMAP_SKYBOX=!1,i.REFLECTIONMAP_SPHERICAL=!1,i.REFLECTIONMAP_EQUIRECTANGULAR=!1,i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,l.coordinatesMode){case te.x.EXPLICIT_MODE:i.REFLECTIONMAP_EXPLICIT=!0;break;case te.x.PLANAR_MODE:i.REFLECTIONMAP_PLANAR=!0;break;case te.x.PROJECTION_MODE:i.REFLECTIONMAP_PROJECTION=!0;break;case te.x.SKYBOX_MODE:i.REFLECTIONMAP_SKYBOX=!0;break;case te.x.SPHERICAL_MODE:i.REFLECTIONMAP_SPHERICAL=!0;break;case te.x.EQUIRECTANGULAR_MODE:i.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case te.x.FIXED_EQUIRECTANGULAR_MODE:i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case te.x.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case te.x.CUBIC_MODE:case te.x.INVCUBIC_MODE:default:i.REFLECTIONMAP_CUBIC=!0,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!!l.boundingBoxSize}l.coordinatesMode!==te.x.SKYBOX_MODE&&(l.irradianceTexture?(i.USEIRRADIANCEMAP=!0,i.USESPHERICALFROMREFLECTIONMAP=!1):l.isCube&&(i.USESPHERICALFROMREFLECTIONMAP=!0,i.USEIRRADIANCEMAP=!1,this._forceIrradianceInFragment||this.realTimeFiltering||s.getEngine().getCaps().maxVaryingVectors<=8?i.USESPHERICALINVERTEX=!1:i.USESPHERICALINVERTEX=!0))}else i.REFLECTION=!1,i.REFLECTIONMAP_3D=!1,i.REFLECTIONMAP_SPHERICAL=!1,i.REFLECTIONMAP_PLANAR=!1,i.REFLECTIONMAP_CUBIC=!1,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,i.REFLECTIONMAP_PROJECTION=!1,i.REFLECTIONMAP_SKYBOX=!1,i.REFLECTIONMAP_EXPLICIT=!1,i.REFLECTIONMAP_EQUIRECTANGULAR=!1,i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,i.INVERTCUBICMAP=!1,i.USESPHERICALFROMREFLECTIONMAP=!1,i.USEIRRADIANCEMAP=!1,i.USESPHERICALINVERTEX=!1,i.REFLECTIONMAP_OPPOSITEZ=!1,i.LODINREFLECTIONALPHA=!1,i.GAMMAREFLECTION=!1,i.RGBDREFLECTION=!1,i.LINEARSPECULARREFLECTION=!1;this._lightmapTexture&&Tt.k.LightmapTextureEnabled?(At.G.PrepareDefinesForMergedUV(this._lightmapTexture,i,"LIGHTMAP"),i.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,i.GAMMALIGHTMAP=this._lightmapTexture.gammaSpace,i.RGBDLIGHTMAP=this._lightmapTexture.isRGBD):i.LIGHTMAP=!1,this._emissiveTexture&&Tt.k.EmissiveTextureEnabled?At.G.PrepareDefinesForMergedUV(this._emissiveTexture,i,"EMISSIVE"):i.EMISSIVE=!1,Tt.k.SpecularTextureEnabled?(this._metallicTexture?(At.G.PrepareDefinesForMergedUV(this._metallicTexture,i,"REFLECTIVITY"),i.ROUGHNESSSTOREINMETALMAPALPHA=this._useRoughnessFromMetallicTextureAlpha,i.ROUGHNESSSTOREINMETALMAPGREEN=!this._useRoughnessFromMetallicTextureAlpha&&this._useRoughnessFromMetallicTextureGreen,i.METALLNESSSTOREINMETALMAPBLUE=this._useMetallnessFromMetallicTextureBlue,i.AOSTOREINMETALMAPRED=this._useAmbientOcclusionFromMetallicTextureRed):this._reflectivityTexture?(At.G.PrepareDefinesForMergedUV(this._reflectivityTexture,i,"REFLECTIVITY"),i.MICROSURFACEFROMREFLECTIVITYMAP=this._useMicroSurfaceFromReflectivityMapAlpha,i.MICROSURFACEAUTOMATIC=this._useAutoMicroSurfaceFromReflectivityMap):i.REFLECTIVITY=!1,this._metallicReflectanceTexture?At.G.PrepareDefinesForMergedUV(this._metallicReflectanceTexture,i,"METALLIC_REFLECTANCE"):i.METALLIC_REFLECTANCE=!1,this._microSurfaceTexture?At.G.PrepareDefinesForMergedUV(this._microSurfaceTexture,i,"MICROSURFACEMAP"):i.MICROSURFACEMAP=!1):(i.REFLECTIVITY=!1,i.MICROSURFACEMAP=!1),s.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&Tt.k.BumpTextureEnabled&&!this._disableBumpMap?(At.G.PrepareDefinesForMergedUV(this._bumpTexture,i,"BUMP"),this._useParallax&&this._albedoTexture&&Tt.k.DiffuseTextureEnabled?(i.PARALLAX=!0,i.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):i.PARALLAX=!1,i.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):i.BUMP=!1,this._environmentBRDFTexture&&Tt.k.ReflectionTextureEnabled?(i.ENVIRONMENTBRDF=!0,i.ENVIRONMENTBRDF_RGBD=this._environmentBRDFTexture.isRGBD):(i.ENVIRONMENTBRDF=!1,i.ENVIRONMENTBRDF_RGBD=!1),this._shouldUseAlphaFromAlbedoTexture()?i.ALPHAFROMALBEDO=!0:i.ALPHAFROMALBEDO=!1}i.SPECULAROVERALPHA=this._useSpecularOverAlpha,this._lightFalloff===t.LIGHTFALLOFF_STANDARD?(i.USEPHYSICALLIGHTFALLOFF=!1,i.USEGLTFLIGHTFALLOFF=!1):this._lightFalloff===t.LIGHTFALLOFF_GLTF?(i.USEPHYSICALLIGHTFALLOFF=!1,i.USEGLTFLIGHTFALLOFF=!0):(i.USEPHYSICALLIGHTFALLOFF=!0,i.USEGLTFLIGHTFALLOFF=!1),i.RADIANCEOVERALPHA=this._useRadianceOverAlpha,!this.backFaceCulling&&this._twoSidedLighting?i.TWOSIDEDLIGHTING=!0:i.TWOSIDEDLIGHTING=!1,i.SPECULARAA=s.getEngine().getCaps().standardDerivatives&&this._enableSpecularAntiAliasing}(i._areTexturesDirty||i._areMiscDirty)&&(i.ALPHATESTVALUE=this._alphaCutOff+(this._alphaCutOff%1==0?".":""),i.PREMULTIPLYALPHA=7===this.alphaMode||8===this.alphaMode,i.ALPHABLEND=this.needAlphaBlendingForMesh(e),i.ALPHAFRESNEL=this._useAlphaFresnel||this._useLinearAlphaFresnel,i.LINEARALPHAFRESNEL=this._useLinearAlphaFresnel),i._areImageProcessingDirty&&this._imageProcessingConfiguration&&this._imageProcessingConfiguration.prepareDefines(i),i.FORCENORMALFORWARD=this._forceNormalForward,i.RADIANCEOCCLUSION=this._useRadianceOcclusion,i.HORIZONOCCLUSION=this._useHorizonOcclusion,i._areMiscDirty&&(At.G.PrepareDefinesForMisc(e,s,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,i),i.UNLIT=this._unlit||(this.pointsCloud||this.wireframe)&&!e.isVerticesDataPresent(me.o.NormalKind),i.DEBUGMODE=this._debugMode),this.detailMap.prepareDefines(i,s),this.subSurface.prepareDefines(i,s),this.clearCoat.prepareDefines(i,s),this.anisotropy.prepareDefines(i,e,s),this.brdf.prepareDefines(i),this.sheen.prepareDefines(i,s),At.G.PrepareDefinesForFrameBoundValues(s,a,i,!!n,r,o),At.G.PrepareDefinesForAttributes(e,i,!0,!0,!0,this._transparencyMode!==t.PBRMATERIAL_OPAQUE)},t.prototype.forceCompilation=function(e,t,i){var n=this,r=(0,l.pi)({clipPlane:!1,useInstances:!1},i),o=new Ii,s=this._prepareEffect(e,o,void 0,void 0,r.useInstances,r.clipPlane,e.hasThinInstances);this._onEffectCreatedObservable&&(Pi.effect=s,Pi.subMesh=null,this._onEffectCreatedObservable.notifyObservers(Pi)),s.isReady()?t&&t(this):s.onCompileObservable.add((function(){t&&t(n)}))},t.prototype.buildUniformLayout=function(){var e=this._uniformBuffer;e.addUniform("vAlbedoInfos",2),e.addUniform("vAmbientInfos",4),e.addUniform("vOpacityInfos",2),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vReflectivityInfos",3),e.addUniform("vMicroSurfaceSamplerInfos",2),e.addUniform("vReflectionInfos",2),e.addUniform("vReflectionFilteringInfo",2),e.addUniform("vReflectionPosition",3),e.addUniform("vReflectionSize",3),e.addUniform("vBumpInfos",3),e.addUniform("albedoMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("reflectivityMatrix",16),e.addUniform("microSurfaceSamplerMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("reflectionMatrix",16),e.addUniform("vReflectionColor",3),e.addUniform("vAlbedoColor",4),e.addUniform("vLightingIntensity",4),e.addUniform("vReflectionMicrosurfaceInfos",3),e.addUniform("pointSize",1),e.addUniform("vReflectivityColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("visibility",1),e.addUniform("vMetallicReflectanceFactors",4),e.addUniform("vMetallicReflectanceInfos",2),e.addUniform("metallicReflectanceMatrix",16),Et.PrepareUniformBuffer(e),Ct.PrepareUniformBuffer(e),St.PrepareUniformBuffer(e),Mt.PrepareUniformBuffer(e),Mi.p.PrepareUniformBuffer(e),e.create()},t.prototype.unbind=function(){if(this._activeEffect){var t=!1;this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&(this._activeEffect.setTexture("reflection2DSampler",null),t=!0),this.subSurface.unbind(this._activeEffect)&&(t=!0),t&&this._markAllSubMeshesAsTexturesDirty()}e.prototype.unbind.call(this)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i._materialDefines;if(r){var o=i.effect;if(o){this._activeEffect=o,r.INSTANCES&&!r.THIN_INSTANCES||this.bindOnlyWorldMatrix(e),this.prePassConfiguration.bindForSubMesh(this._activeEffect,n,t,e,this.isFrozen),r.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var s=this._mustRebind(n,o,t.visibility);At.G.BindBonesParameters(t,this._activeEffect,this.prePassConfiguration);var a=null,l=this._uniformBuffer;if(s){var h=n.getEngine();if(l.bindToEffect(o,"Material"),this.bindViewProjection(o),a=this._getReflectionTexture(),!l.useUbo||!this.isFrozen||!l.isSync){if(n.texturesEnabled){if(this._albedoTexture&&Tt.k.DiffuseTextureEnabled&&(l.updateFloat2("vAlbedoInfos",this._albedoTexture.coordinatesIndex,this._albedoTexture.level),At.G.BindTextureMatrix(this._albedoTexture,l,"albedo")),this._ambientTexture&&Tt.k.AmbientTextureEnabled&&(l.updateFloat4("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level,this._ambientTextureStrength,this._ambientTextureImpactOnAnalyticalLights),At.G.BindTextureMatrix(this._ambientTexture,l,"ambient")),this._opacityTexture&&Tt.k.OpacityTextureEnabled&&(l.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),At.G.BindTextureMatrix(this._opacityTexture,l,"opacity")),a&&Tt.k.ReflectionTextureEnabled){if(l.updateMatrix("reflectionMatrix",a.getReflectionTextureMatrix()),l.updateFloat2("vReflectionInfos",a.level,0),a.boundingBoxSize){var c=a;l.updateVector3("vReflectionPosition",c.boundingBoxPosition),l.updateVector3("vReflectionSize",c.boundingBoxSize)}if(this.realTimeFiltering){var u=a.getSize().width;l.updateFloat2("vReflectionFilteringInfo",u,Rt.R.Log2(u))}if(!r.USEIRRADIANCEMAP){var f=a.sphericalPolynomial;if(r.USESPHERICALFROMREFLECTIONMAP&&f)if(r.SPHERICAL_HARMONICS){var d=f.preScaledHarmonics;this._activeEffect.setVector3("vSphericalL00",d.l00),this._activeEffect.setVector3("vSphericalL1_1",d.l1_1),this._activeEffect.setVector3("vSphericalL10",d.l10),this._activeEffect.setVector3("vSphericalL11",d.l11),this._activeEffect.setVector3("vSphericalL2_2",d.l2_2),this._activeEffect.setVector3("vSphericalL2_1",d.l2_1),this._activeEffect.setVector3("vSphericalL20",d.l20),this._activeEffect.setVector3("vSphericalL21",d.l21),this._activeEffect.setVector3("vSphericalL22",d.l22)}else this._activeEffect.setFloat3("vSphericalX",f.x.x,f.x.y,f.x.z),this._activeEffect.setFloat3("vSphericalY",f.y.x,f.y.y,f.y.z),this._activeEffect.setFloat3("vSphericalZ",f.z.x,f.z.y,f.z.z),this._activeEffect.setFloat3("vSphericalXX_ZZ",f.xx.x-f.zz.x,f.xx.y-f.zz.y,f.xx.z-f.zz.z),this._activeEffect.setFloat3("vSphericalYY_ZZ",f.yy.x-f.zz.x,f.yy.y-f.zz.y,f.yy.z-f.zz.z),this._activeEffect.setFloat3("vSphericalZZ",f.zz.x,f.zz.y,f.zz.z),this._activeEffect.setFloat3("vSphericalXY",f.xy.x,f.xy.y,f.xy.z),this._activeEffect.setFloat3("vSphericalYZ",f.yz.x,f.yz.y,f.yz.z),this._activeEffect.setFloat3("vSphericalZX",f.zx.x,f.zx.y,f.zx.z)}l.updateFloat3("vReflectionMicrosurfaceInfos",a.getSize().width,a.lodGenerationScale,a.lodGenerationOffset)}this._emissiveTexture&&Tt.k.EmissiveTextureEnabled&&(l.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),At.G.BindTextureMatrix(this._emissiveTexture,l,"emissive")),this._lightmapTexture&&Tt.k.LightmapTextureEnabled&&(l.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),At.G.BindTextureMatrix(this._lightmapTexture,l,"lightmap")),Tt.k.SpecularTextureEnabled&&(this._metallicTexture?(l.updateFloat3("vReflectivityInfos",this._metallicTexture.coordinatesIndex,this._metallicTexture.level,this._ambientTextureStrength),At.G.BindTextureMatrix(this._metallicTexture,l,"reflectivity")):this._reflectivityTexture&&(l.updateFloat3("vReflectivityInfos",this._reflectivityTexture.coordinatesIndex,this._reflectivityTexture.level,1),At.G.BindTextureMatrix(this._reflectivityTexture,l,"reflectivity")),this._metallicReflectanceTexture&&(l.updateFloat2("vMetallicReflectanceInfos",this._metallicReflectanceTexture.coordinatesIndex,this._metallicReflectanceTexture.level),At.G.BindTextureMatrix(this._metallicReflectanceTexture,l,"metallicReflectance")),this._microSurfaceTexture&&(l.updateFloat2("vMicroSurfaceSamplerInfos",this._microSurfaceTexture.coordinatesIndex,this._microSurfaceTexture.level),At.G.BindTextureMatrix(this._microSurfaceTexture,l,"microSurfaceSampler"))),this._bumpTexture&&h.getCaps().standardDerivatives&&Tt.k.BumpTextureEnabled&&!this._disableBumpMap&&(l.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level,this._parallaxScaleBias),At.G.BindTextureMatrix(this._bumpTexture,l,"bump"),n._mirroredCameraPosition?l.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):l.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1))}if(this.pointsCloud&&l.updateFloat("pointSize",this.pointSize),r.METALLICWORKFLOW){w.zZ.Color3[0].r=void 0===this._metallic||null===this._metallic?1:this._metallic,w.zZ.Color3[0].g=void 0===this._roughness||null===this._roughness?1:this._roughness,l.updateColor4("vReflectivityColor",w.zZ.Color3[0],1);var p=this.subSurface.indexOfRefraction,_=Math.pow((p-1)/(p+1),2);this._metallicReflectanceColor.scaleToRef(_*this._metallicF0Factor,w.zZ.Color3[0]);var g=this._metallicF0Factor;l.updateColor4("vMetallicReflectanceFactors",w.zZ.Color3[0],g)}else l.updateColor4("vReflectivityColor",this._reflectivityColor,this._microSurface);l.updateColor3("vEmissiveColor",Tt.k.EmissiveTextureEnabled?this._emissiveColor:w.Wo.BlackReadOnly),l.updateColor3("vReflectionColor",this._reflectionColor),!r.SS_REFRACTION&&this.subSurface.linkRefractionWithTransparency?l.updateColor4("vAlbedoColor",this._albedoColor,1):l.updateColor4("vAlbedoColor",this._albedoColor,this.alpha),this._lightingInfos.x=this._directIntensity,this._lightingInfos.y=this._emissiveIntensity,this._lightingInfos.z=this._environmentIntensity*n.environmentIntensity,this._lightingInfos.w=this._specularIntensity,l.updateVector4("vLightingIntensity",this._lightingInfos)}l.updateFloat("visibility",t.visibility),n.texturesEnabled&&(this._albedoTexture&&Tt.k.DiffuseTextureEnabled&&l.setTexture("albedoSampler",this._albedoTexture),this._ambientTexture&&Tt.k.AmbientTextureEnabled&&l.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&Tt.k.OpacityTextureEnabled&&l.setTexture("opacitySampler",this._opacityTexture),a&&Tt.k.ReflectionTextureEnabled&&(r.LODBASEDMICROSFURACE?l.setTexture("reflectionSampler",a):(l.setTexture("reflectionSampler",a._lodTextureMid||a),l.setTexture("reflectionSamplerLow",a._lodTextureLow||a),l.setTexture("reflectionSamplerHigh",a._lodTextureHigh||a)),r.USEIRRADIANCEMAP&&l.setTexture("irradianceSampler",a.irradianceTexture)),r.ENVIRONMENTBRDF&&l.setTexture("environmentBrdfSampler",this._environmentBRDFTexture),this._emissiveTexture&&Tt.k.EmissiveTextureEnabled&&l.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&Tt.k.LightmapTextureEnabled&&l.setTexture("lightmapSampler",this._lightmapTexture),Tt.k.SpecularTextureEnabled&&(this._metallicTexture?l.setTexture("reflectivitySampler",this._metallicTexture):this._reflectivityTexture&&l.setTexture("reflectivitySampler",this._reflectivityTexture),this._metallicReflectanceTexture&&l.setTexture("metallicReflectanceSampler",this._metallicReflectanceTexture),this._microSurfaceTexture&&l.setTexture("microSurfaceSampler",this._microSurfaceTexture)),this._bumpTexture&&h.getCaps().standardDerivatives&&Tt.k.BumpTextureEnabled&&!this._disableBumpMap&&l.setTexture("bumpSampler",this._bumpTexture)),this.detailMap.bindForSubMesh(l,n,this.isFrozen),this.subSurface.bindForSubMesh(l,n,h,this.isFrozen,r.LODBASEDMICROSFURACE,this.realTimeFiltering),this.clearCoat.bindForSubMesh(l,n,h,this._disableBumpMap,this.isFrozen,this._invertNormalMapX,this._invertNormalMapY,i),this.anisotropy.bindForSubMesh(l,n,this.isFrozen),this.sheen.bindForSubMesh(l,n,this.isFrozen,i),At.G.BindClipPlane(this._activeEffect,n),n.ambientColor.multiplyToRef(this._ambientColor,this._globalAmbientColor);var m=n._forcedViewPosition?n._forcedViewPosition:n._mirroredCameraPosition?n._mirroredCameraPosition:n.activeCamera.globalPosition,v=n.useRightHandedSystem===(null!=n._mirroredCameraPosition);o.setFloat4("vEyePosition",m.x,m.y,m.z,v?-1:1),o.setColor3("vAmbientColor",this._globalAmbientColor),o.setFloat2("vDebugMode",this.debugLimit,this.debugFactor)}!s&&this.isFrozen||(n.lightsEnabled&&!this._disableLighting&&At.G.BindLights(n,t,this._activeEffect,r,this._maxSimultaneousLights,this._rebuildInParallel),(n.fogEnabled&&t.applyFog&&n.fogMode!==ut.Scene.FOGMODE_NONE||a)&&this.bindView(o),At.G.BindFogParameters(n,t,this._activeEffect,!0),r.NUM_MORPH_INFLUENCERS&&At.G.BindMorphTargetParameters(t,this._activeEffect),this._imageProcessingConfiguration.bind(this._activeEffect),At.G.BindLogDepth(r,this._activeEffect,n)),l.update(),this._afterBind(t,this._activeEffect)}}},t.prototype.getAnimatables=function(){var e=[];return this._albedoTexture&&this._albedoTexture.animations&&this._albedoTexture.animations.length>0&&e.push(this._albedoTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&e.push(this._emissiveTexture),this._metallicTexture&&this._metallicTexture.animations&&this._metallicTexture.animations.length>0?e.push(this._metallicTexture):this._reflectivityTexture&&this._reflectivityTexture.animations&&this._reflectivityTexture.animations.length>0&&e.push(this._reflectivityTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&e.push(this._lightmapTexture),this.detailMap.getAnimatables(e),this.subSurface.getAnimatables(e),this.clearCoat.getAnimatables(e),this.sheen.getAnimatables(e),this.anisotropy.getAnimatables(e),e},t.prototype._getReflectionTexture=function(){return this._reflectionTexture?this._reflectionTexture:this.getScene().environmentTexture},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._albedoTexture&&t.push(this._albedoTexture),this._ambientTexture&&t.push(this._ambientTexture),this._opacityTexture&&t.push(this._opacityTexture),this._reflectionTexture&&t.push(this._reflectionTexture),this._emissiveTexture&&t.push(this._emissiveTexture),this._reflectivityTexture&&t.push(this._reflectivityTexture),this._metallicTexture&&t.push(this._metallicTexture),this._metallicReflectanceTexture&&t.push(this._metallicReflectanceTexture),this._microSurfaceTexture&&t.push(this._microSurfaceTexture),this._bumpTexture&&t.push(this._bumpTexture),this._lightmapTexture&&t.push(this._lightmapTexture),this.detailMap.getActiveTextures(t),this.subSurface.getActiveTextures(t),this.clearCoat.getActiveTextures(t),this.sheen.getActiveTextures(t),this.anisotropy.getActiveTextures(t),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._albedoTexture===t||(this._ambientTexture===t||(this._opacityTexture===t||(this._reflectionTexture===t||(this._reflectivityTexture===t||(this._metallicTexture===t||(this._metallicReflectanceTexture===t||(this._microSurfaceTexture===t||(this._bumpTexture===t||(this._lightmapTexture===t||(this.detailMap.hasTexture(t)||this.subSurface.hasTexture(t)||this.clearCoat.hasTexture(t)||this.sheen.hasTexture(t)||this.anisotropy.hasTexture(t))))))))))))},t.prototype.setPrePassRenderer=function(e){if(this.subSurface.isScatteringEnabled){var t=this.getScene().enableSubSurfaceForPrePass();return t&&(t.enabled=!0),!0}return!1},t.prototype.dispose=function(t,i){var n,r,o,s,a,l,h,c,u,f,d;i&&(this._environmentBRDFTexture&&this.getScene().environmentBRDFTexture!==this._environmentBRDFTexture&&this._environmentBRDFTexture.dispose(),null===(n=this._albedoTexture)||void 0===n||n.dispose(),null===(r=this._ambientTexture)||void 0===r||r.dispose(),null===(o=this._opacityTexture)||void 0===o||o.dispose(),null===(s=this._reflectionTexture)||void 0===s||s.dispose(),null===(a=this._emissiveTexture)||void 0===a||a.dispose(),null===(l=this._metallicTexture)||void 0===l||l.dispose(),null===(h=this._reflectivityTexture)||void 0===h||h.dispose(),null===(c=this._bumpTexture)||void 0===c||c.dispose(),null===(u=this._lightmapTexture)||void 0===u||u.dispose(),null===(f=this._metallicReflectanceTexture)||void 0===f||f.dispose(),null===(d=this._microSurfaceTexture)||void 0===d||d.dispose()),this.detailMap.dispose(i),this.subSurface.dispose(i),this.clearCoat.dispose(i),this.sheen.dispose(i),this.anisotropy.dispose(i),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t,i)},t.PBRMATERIAL_OPAQUE=fe.F.MATERIAL_OPAQUE,t.PBRMATERIAL_ALPHATEST=fe.F.MATERIAL_ALPHATEST,t.PBRMATERIAL_ALPHABLEND=fe.F.MATERIAL_ALPHABLEND,t.PBRMATERIAL_ALPHATESTANDBLEND=fe.F.MATERIAL_ALPHATESTANDBLEND,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=0,t.LIGHTFALLOFF_PHYSICAL=0,t.LIGHTFALLOFF_GLTF=1,t.LIGHTFALLOFF_STANDARD=2,(0,l.gn)([(0,F.rX)()],t.prototype,"_imageProcessingConfiguration",void 0),(0,l.gn)([(0,F.wz)("_markAllSubMeshesAsMiscDirty")],t.prototype,"debugMode",void 0),(0,l.gn)([(0,F.qC)()],t.prototype,"useLogarithmicDepth",null),t}(Dt.a),Di=i(6132),Li=function(e){function t(i,n){var r=e.call(this,i,n)||this;return r.directIntensity=1,r.emissiveIntensity=1,r.environmentIntensity=1,r.specularIntensity=1,r.disableBumpMap=!1,r.ambientTextureStrength=1,r.ambientTextureImpactOnAnalyticalLights=t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,r.metallicF0Factor=1,r.metallicReflectanceColor=w.Wo.White(),r.ambientColor=new w.Wo(0,0,0),r.albedoColor=new w.Wo(1,1,1),r.reflectivityColor=new w.Wo(1,1,1),r.reflectionColor=new w.Wo(1,1,1),r.emissiveColor=new w.Wo(0,0,0),r.microSurface=1,r.useLightmapAsShadowmap=!1,r.useAlphaFromAlbedoTexture=!1,r.forceAlphaTest=!1,r.alphaCutOff=.4,r.useSpecularOverAlpha=!0,r.useMicroSurfaceFromReflectivityMapAlpha=!1,r.useRoughnessFromMetallicTextureAlpha=!0,r.useRoughnessFromMetallicTextureGreen=!1,r.useMetallnessFromMetallicTextureBlue=!1,r.useAmbientOcclusionFromMetallicTextureRed=!1,r.useAmbientInGrayScale=!1,r.useAutoMicroSurfaceFromReflectivityMap=!1,r.useRadianceOverAlpha=!0,r.useObjectSpaceNormalMap=!1,r.useParallax=!1,r.useParallaxOcclusion=!1,r.parallaxScaleBias=.05,r.disableLighting=!1,r.forceIrradianceInFragment=!1,r.maxSimultaneousLights=4,r.invertNormalMapX=!1,r.invertNormalMapY=!1,r.twoSidedLighting=!1,r.useAlphaFresnel=!1,r.useLinearAlphaFresnel=!1,r.environmentBRDFTexture=null,r.forceNormalForward=!1,r.enableSpecularAntiAliasing=!1,r.useHorizonOcclusion=!0,r.useRadianceOcclusion=!0,r.unlit=!1,r._environmentBRDFTexture=yt.GetEnvironmentBRDFTexture(n),r}return(0,l.ZT)(t,e),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this.subSurface.refractionTexture},set:function(e){this.subSurface.refractionTexture=e,e?this.subSurface.isRefractionEnabled=!0:this.subSurface.linkRefractionWithTransparency||(this.subSurface.isRefractionEnabled=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"indexOfRefraction",{get:function(){return this.subSurface.indexOfRefraction},set:function(e){this.subSurface.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"invertRefractionY",{get:function(){return this.subSurface.invertRefractionY},set:function(e){this.subSurface.invertRefractionY=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkRefractionWithTransparency",{get:function(){return this.subSurface.linkRefractionWithTransparency},set:function(e){this.subSurface.linkRefractionWithTransparency=e,e&&(this.subSurface.isRefractionEnabled=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"usePhysicalLightFalloff",{get:function(){return this._lightFalloff===Oi.LIGHTFALLOFF_PHYSICAL},set:function(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?Oi.LIGHTFALLOFF_PHYSICAL:Oi.LIGHTFALLOFF_STANDARD)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useGLTFLightFalloff",{get:function(){return this._lightFalloff===Oi.LIGHTFALLOFF_GLTF},set:function(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?Oi.LIGHTFALLOFF_GLTF:Oi.LIGHTFALLOFF_STANDARD)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraToneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraExposure",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraContrast",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorGradingTexture",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this._imageProcessingConfiguration.colorGradingTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorCurves",{get:function(){return this._imageProcessingConfiguration.colorCurves},set:function(e){this._imageProcessingConfiguration.colorCurves=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"PBRMaterial"},t.prototype.clone=function(e){var i=this,n=F.p4.Clone((function(){return new t(e,i.getScene())}),this);return n.id=e,n.name=e,this.clearCoat.copyTo(n.clearCoat),this.anisotropy.copyTo(n.anisotropy),this.brdf.copyTo(n.brdf),this.sheen.copyTo(n.sheen),this.subSurface.copyTo(n.subSurface),n},t.prototype.serialize=function(){var e=F.p4.Serialize(this);return e.customType="BABYLON.PBRMaterial",e.clearCoat=this.clearCoat.serialize(),e.anisotropy=this.anisotropy.serialize(),e.brdf=this.brdf.serialize(),e.sheen=this.sheen.serialize(),e.subSurface=this.subSurface.serialize(),e},t.Parse=function(e,i,n){var r=F.p4.Parse((function(){return new t(e.name,i)}),e,i,n);return e.clearCoat&&r.clearCoat.parse(e.clearCoat,i,n),e.anisotropy&&r.anisotropy.parse(e.anisotropy,i,n),e.brdf&&r.brdf.parse(e.brdf,i,n),e.sheen&&r.sheen.parse(e.sheen,i,n),e.subSurface&&r.subSurface.parse(e.subSurface,i,n),r},t.PBRMATERIAL_OPAQUE=Oi.PBRMATERIAL_OPAQUE,t.PBRMATERIAL_ALPHATEST=Oi.PBRMATERIAL_ALPHATEST,t.PBRMATERIAL_ALPHABLEND=Oi.PBRMATERIAL_ALPHABLEND,t.PBRMATERIAL_ALPHATESTANDBLEND=Oi.PBRMATERIAL_ALPHATESTANDBLEND,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=Oi.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"directIntensity",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveIntensity",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"environmentIntensity",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"specularIntensity",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"disableBumpMap",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"albedoTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTextureStrength",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTextureImpactOnAnalyticalLights",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"opacityTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectivityTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallic",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"roughness",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicF0Factor",void 0),(0,l.gn)([(0,F.n9)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicReflectanceColor",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicReflectanceTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"microSurfaceTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty",null)],t.prototype,"lightmapTexture",void 0),(0,l.gn)([(0,F.n9)("ambient"),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientColor",void 0),(0,l.gn)([(0,F.n9)("albedo"),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"albedoColor",void 0),(0,l.gn)([(0,F.n9)("reflectivity"),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectivityColor",void 0),(0,l.gn)([(0,F.n9)("reflection"),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionColor",void 0),(0,l.gn)([(0,F.n9)("emissive"),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveColor",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"microSurface",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLightmapAsShadowmap",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"useAlphaFromAlbedoTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"forceAlphaTest",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"alphaCutOff",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useSpecularOverAlpha",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useMicroSurfaceFromReflectivityMapAlpha",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRoughnessFromMetallicTextureAlpha",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRoughnessFromMetallicTextureGreen",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useMetallnessFromMetallicTextureBlue",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAmbientInGrayScale",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAutoMicroSurfaceFromReflectivityMap",void 0),(0,l.gn)([(0,F.qC)()],t.prototype,"usePhysicalLightFalloff",null),(0,l.gn)([(0,F.qC)()],t.prototype,"useGLTFLightFalloff",null),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRadianceOverAlpha",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useObjectSpaceNormalMap",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallax",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallaxOcclusion",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"parallaxScaleBias",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"forceIrradianceInFragment",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapX",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapY",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"twoSidedLighting",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAlphaFresnel",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLinearAlphaFresnel",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"environmentBRDFTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"forceNormalForward",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"enableSpecularAntiAliasing",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useHorizonOcclusion",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRadianceOcclusion",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsMiscDirty")],t.prototype,"unlit",void 0),t}(Oi);Di.Q.RegisteredTypes["BABYLON.PBRMaterial"]=Li;var wi=i(5511),Ni=function(){function e(e,t,i){void 0===t&&(t=0),void 0===i&&(i=null),this.name=e,this.animations=new Array,this._positions=null,this._normals=null,this._tangents=null,this._uvs=null,this._uniqueId=0,this.onInfluenceChanged=new o.y$,this._onDataLayoutChanged=new o.y$,this._animationPropertiesOverride=null,this._scene=i||f.l.LastCreatedScene,this.influence=t,this._scene&&(this._uniqueId=this._scene.getUniqueId())}return Object.defineProperty(e.prototype,"influence",{get:function(){return this._influence},set:function(e){if(this._influence!==e){var t=this._influence;this._influence=e,this.onInfluenceChanged.hasObservers()&&this.onInfluenceChanged.notifyObservers(0===t||0===e)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"animationPropertiesOverride",{get:function(){return!this._animationPropertiesOverride&&this._scene?this._scene.animationPropertiesOverride:this._animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasPositions",{get:function(){return!!this._positions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNormals",{get:function(){return!!this._normals},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasTangents",{get:function(){return!!this._tangents},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasUVs",{get:function(){return!!this._uvs},enumerable:!1,configurable:!0}),e.prototype.setPositions=function(e){var t=this.hasPositions;this._positions=e,t!==this.hasPositions&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getPositions=function(){return this._positions},e.prototype.setNormals=function(e){var t=this.hasNormals;this._normals=e,t!==this.hasNormals&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getNormals=function(){return this._normals},e.prototype.setTangents=function(e){var t=this.hasTangents;this._tangents=e,t!==this.hasTangents&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getTangents=function(){return this._tangents},e.prototype.setUVs=function(e){var t=this.hasUVs;this._uvs=e,t!==this.hasUVs&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getUVs=function(){return this._uvs},e.prototype.clone=function(){var t=this,i=F.p4.Clone((function(){return new e(t.name,t.influence,t._scene)}),this);return i._positions=this._positions,i._normals=this._normals,i._tangents=this._tangents,i._uvs=this._uvs,i},e.prototype.serialize=function(){var e={};return e.name=this.name,e.influence=this.influence,e.positions=Array.prototype.slice.call(this.getPositions()),null!=this.id&&(e.id=this.id),this.hasNormals&&(e.normals=Array.prototype.slice.call(this.getNormals())),this.hasTangents&&(e.tangents=Array.prototype.slice.call(this.getTangents())),this.hasUVs&&(e.uvs=Array.prototype.slice.call(this.getUVs())),F.p4.AppendSerializedAnimations(this,e),e},e.prototype.getClassName=function(){return"MorphTarget"},e.Parse=function(t){var i=new e(t.name,t.influence);if(i.setPositions(t.positions),null!=t.id&&(i.id=t.id),t.normals&&i.setNormals(t.normals),t.tangents&&i.setTangents(t.tangents),t.uvs&&i.setUVs(t.uvs),t.animations)for(var n=0;n=0&&(this._targets.splice(t,1),e.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(t,1)[0]),e._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(t,1)[0]),this._syncActiveTargets(!0))},e.prototype.clone=function(){for(var t=new e(this._scene),i=0,n=this._targets;i "+A[A.READY],r=A[A.LOADING]+" => "+A[A.COMPLETE];i._parent._startPerformanceCounter(n),i._parent._startPerformanceCounter(r),i._setState(A.LOADING),i._extensionsOnLoading();var o=new Array,a=i._babylonScene.blockMaterialDirtyMechanism;if(i._babylonScene.blockMaterialDirtyMechanism=!0,e)o.push(i.loadSceneAsync("/nodes",{nodes:e,index:-1}));else if(null!=i._gltf.scene||i._gltf.scenes&&i._gltf.scenes[0]){var l=Vi.Get("/scene",i._gltf.scenes,i._gltf.scene||0);o.push(i.loadSceneAsync("/scenes/"+l.index,l))}if(i.parent.loadAllMaterials&&i._gltf.materials)for(var h=0;he.bin.byteLength)&&u.Y.Warn("Binary buffer length ("+i.byteLength+") from JSON does not match chunk length ("+e.bin.byteLength+")"),this._bin=e.bin}else u.Y.Warn("Unexpected BIN chunk")}},e.prototype._setupData=function(){if(Vi.Assign(this._gltf.accessors),Vi.Assign(this._gltf.animations),Vi.Assign(this._gltf.buffers),Vi.Assign(this._gltf.bufferViews),Vi.Assign(this._gltf.cameras),Vi.Assign(this._gltf.images),Vi.Assign(this._gltf.materials),Vi.Assign(this._gltf.meshes),Vi.Assign(this._gltf.nodes),Vi.Assign(this._gltf.samplers),Vi.Assign(this._gltf.scenes),Vi.Assign(this._gltf.skins),Vi.Assign(this._gltf.textures),this._gltf.nodes){for(var e={},t=0,i=this._gltf.nodes;t=2)throw new Error(t+"/texCoord: Invalid value ("+i.texCoord+")");var s=Vi.Get(t+"/index",this._gltf.textures,i.index);s._textureInfo=i;var a=this._loadTextureAsync("/textures/"+i.index,s,(function(o){o.coordinatesIndex=i.texCoord||0,e.AddPointerMetadata(o,t),r._parent.onTextureLoadedObservable.notifyObservers(o),n(o)}));return this.logClose(),a},e.prototype._loadTextureAsync=function(t,i,n){void 0===n&&(n=function(){});var r=this._extensionsLoadTextureAsync(t,i,n);if(r)return r;this.logOpen(t+" "+(i.name||""));var o=null==i.sampler?e.DefaultSampler:Vi.Get(t+"/sampler",this._gltf.samplers,i.sampler),s=Vi.Get(t+"/source",this._gltf.images,i.source),a=this._createTextureAsync(t,o,s,n);return this.logClose(),a},e.prototype._createTextureAsync=function(e,t,i,n,r){var o=this;void 0===n&&(n=function(){});var s=this._loadSampler("/samplers/"+t.index,t),a=new Array,l=new nt;this._babylonScene._blockEntityCollection=this._forAssetContainer;var h=new te.x(null,this._babylonScene,s.noMipMaps,!1,s.samplingMode,(function(){o._disposed||l.resolve()}),(function(t,i){o._disposed||l.reject(new Error(e+": "+(i&&i.message?i.message:t||"Failed to load texture")))}),void 0,void 0,void 0,i.mimeType,r);return this._babylonScene._blockEntityCollection=!1,a.push(l.promise),a.push(this.loadImageAsync("/images/"+i.index,i).then((function(e){var t=i.uri||o._fileName+"#image"+i.index,n="data:"+o._uniqueRootUrl+t;h.updateURL(n,e)}))),h.wrapU=s.wrapU,h.wrapV=s.wrapV,n(h),Promise.all(a).then((function(){return h}))},e.prototype._loadSampler=function(t,i){return i._data||(i._data={noMipMaps:9728===i.minFilter||9729===i.minFilter,samplingMode:e._GetTextureSamplingMode(t,i),wrapU:e._GetTextureWrapMode(t+"/wrapS",i.wrapS),wrapV:e._GetTextureWrapMode(t+"/wrapT",i.wrapT)}),i._data},e.prototype.loadImageAsync=function(e,t){if(!t._data){if(this.logOpen(e+" "+(t.name||"")),t.uri)t._data=this.loadUriAsync(e+"/uri",t,t.uri);else{var i=Vi.Get(e+"/bufferView",this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync("/bufferViews/"+i.index,i)}this.logClose()}return t._data},e.prototype.loadUriAsync=function(t,i,n){var r=this,o=this._extensionsLoadUriAsync(t,i,n);if(o)return o;if(!e._ValidateUri(n))throw new Error(t+": '"+n+"' is invalid");if(s.w1.IsBase64(n)){var a=new Uint8Array(s.w1.DecodeBase64(n));return this.log("Decoded "+n.substr(0,64)+"... ("+a.length+" bytes)"),Promise.resolve(a)}return this.log("Loading "+n),this._parent.preprocessUrlAsync(this._rootUrl+n).then((function(e){return new Promise((function(i,o){r._parent._loadFile(e,r._babylonScene,(function(e){r._disposed||(r.log("Loaded "+n+" ("+e.byteLength+" bytes)"),i(new Uint8Array(e)))}),!0,(function(e){o(new Ui.eh(t+": Failed to load '"+n+"'"+(e?": "+e.status+" "+e.statusText:""),e))}))}))}))},e.AddPointerMetadata=function(e,t){var i=e.metadata=e.metadata||{},n=i.gltf=i.gltf||{};(n.pointers=n.pointers||[]).push(t)},e._GetTextureWrapMode=function(e,t){switch(t=null==t?10497:t){case 33071:return te.x.CLAMP_ADDRESSMODE;case 33648:return te.x.MIRROR_ADDRESSMODE;case 10497:return te.x.WRAP_ADDRESSMODE;default:return u.Y.Warn(e+": Invalid value ("+t+")"),te.x.WRAP_ADDRESSMODE}},e._GetTextureSamplingMode=function(e,t){var i=null==t.magFilter?9729:t.magFilter,n=null==t.minFilter?9987:t.minFilter;if(9729===i)switch(n){case 9728:return te.x.LINEAR_NEAREST;case 9729:return te.x.LINEAR_LINEAR;case 9984:return te.x.LINEAR_NEAREST_MIPNEAREST;case 9985:return te.x.LINEAR_LINEAR_MIPNEAREST;case 9986:return te.x.LINEAR_NEAREST_MIPLINEAR;case 9987:return te.x.LINEAR_LINEAR_MIPLINEAR;default:return u.Y.Warn(e+"/minFilter: Invalid value ("+n+")"),te.x.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==i&&u.Y.Warn(e+"/magFilter: Invalid value ("+i+")"),n){case 9728:return te.x.NEAREST_NEAREST;case 9729:return te.x.NEAREST_LINEAR;case 9984:return te.x.NEAREST_NEAREST_MIPNEAREST;case 9985:return te.x.NEAREST_LINEAR_MIPNEAREST;case 9986:return te.x.NEAREST_NEAREST_MIPLINEAR;case 9987:return te.x.NEAREST_LINEAR_MIPLINEAR;default:return u.Y.Warn(e+"/minFilter: Invalid value ("+n+")"),te.x.NEAREST_NEAREST_MIPNEAREST}},e._GetTypedArrayConstructor=function(e,t){switch(t){case 5120:return Int8Array;case 5121:return Uint8Array;case 5122:return Int16Array;case 5123:return Uint16Array;case 5125:return Uint32Array;case 5126:return Float32Array;default:throw new Error(e+": Invalid component type "+t)}},e._GetTypedArray=function(t,i,n,r,o){var s=n.buffer;r=n.byteOffset+(r||0);var a=e._GetTypedArrayConstructor(t+"/componentType",i);try{return new a(s,r,o)}catch(e){throw new Error(t+": "+e)}},e._GetNumComponents=function(e,t){switch(t){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}throw new Error(e+": Invalid type ("+t+")")},e._ValidateUri=function(e){return s.w1.IsBase64(e)||-1===e.indexOf("..")},e._GetDrawMode=function(e,t){switch(null==t&&(t=4),t){case 0:return fe.F.PointListDrawMode;case 1:return fe.F.LineListDrawMode;case 2:return fe.F.LineLoopDrawMode;case 3:return fe.F.LineStripDrawMode;case 4:return fe.F.TriangleFillMode;case 5:return fe.F.TriangleStripDrawMode;case 6:return fe.F.TriangleFanDrawMode}throw new Error(e+": Invalid mesh primitive mode ("+t+")")},e.prototype._compileMaterialsAsync=function(){var e=this;this._parent._startPerformanceCounter("Compile materials");var t=new Array;if(this._gltf.materials)for(var i=0,n=this._gltf.materials;i-1?e.substring(v).toLowerCase():""),b=null,T=0,A=ne.B._TextureLoaders;T-1?t.substring(y).toLowerCase():""),T=".dds"===b,A=".env"===b;if(A?(v.gammaSpace=!1,v._prefiltered=!1,v.anisotropicFilteringLevel=1):(v._prefiltered=u,u&&(v.gammaSpace=!1,v.anisotropicFilteringLevel=1)),v._texture=v._getFromCache(t,r),!a&&(A||T||n||(n=["_px.jpg","_py.jpg","_pz.jpg","_nx.jpg","_ny.jpg","_nz.jpg"]),a=[],n))for(var E=0;E=0&&a.renderTargetTextures.splice(r,1)}if(this._opaqueRenderTarget&&(t=this._scene.customRenderTargets.indexOf(this._opaqueRenderTarget),this._opaqueRenderTarget.dispose()),this._opaqueRenderTarget=new An._("opaqueSceneTexture",this._options.renderSize,this._scene,!0),this._opaqueRenderTarget.renderList=this._opaqueMeshesCache,this._opaqueRenderTarget.gammaSpace=!0,this._opaqueRenderTarget.lodGenerationScale=1,this._opaqueRenderTarget.lodGenerationOffset=-4,t>=0?this._scene.customRenderTargets.splice(t,0,this._opaqueRenderTarget):(t=this._scene.customRenderTargets.length,this._scene.customRenderTargets.push(this._opaqueRenderTarget)),this._scene.layers&&this._opaqueRenderTarget)for(var o=0,s=this._scene.layers;o0&&(g=!0,this._soundLoaded(i));break;case"String":_.push(i);case"Array":0===_.length&&(_=i);for(var m=0;m<_.length;m++){var v=_[m];if(g=a&&a.skipCodecCheck||-1!==v.indexOf(".mp3",v.length-4)&&B.Engine.audioEngine.isMP3supported||-1!==v.indexOf(".ogg",v.length-4)&&B.Engine.audioEngine.isOGGsupported||-1!==v.indexOf(".wav",v.length-4)||-1!==v.indexOf(".m4a",v.length-4)||-1!==v.indexOf("blob:")){this._streaming?(this._htmlAudioElement=new Audio(v),this._htmlAudioElement.controls=!1,this._htmlAudioElement.loop=this.loop,s.w1.SetCorsBehavior(v,this._htmlAudioElement),this._htmlAudioElement.preload="auto",this._htmlAudioElement.addEventListener("canplaythrough",(function(){d._isReadyToPlay=!0,d.autoplay&&d.play(0,d._offset,d._length),d._readyToPlayCallback&&d._readyToPlayCallback()})),document.body.appendChild(this._htmlAudioElement),this._htmlAudioElement.load()):this._scene._loadFile(v,(function(e){d._soundLoaded(e)}),void 0,!0,!0,(function(e){e&&u.Y.Error("XHR "+e.status+" error on: "+v+"."),u.Y.Error("Sound creation aborted."),d._scene.mainSoundTrack.removeSound(d)}));break}}break;default:p=!1}p?g||(this._isReadyToPlay=!0,this._readyToPlayCallback&&window.setTimeout((function(){d._readyToPlayCallback&&d._readyToPlayCallback()}),1e3)):u.Y.Error("Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.")}catch(e){u.Y.Error("Unexpected error. Sound creation aborted."),this._scene.mainSoundTrack.removeSound(this)}}else this._scene.mainSoundTrack.addSound(this),B.Engine.audioEngine.WarnedWebAudioUnsupported||(u.Y.Error("Web Audio is not supported by your browser."),B.Engine.audioEngine.WarnedWebAudioUnsupported=!0),this._readyToPlayCallback&&window.setTimeout((function(){d._readyToPlayCallback&&d._readyToPlayCallback()}),1e3)}return Object.defineProperty(e.prototype,"currentTime",{get:function(){if(this._htmlAudioElement)return this._htmlAudioElement.currentTime;var e=this._startOffset;return this.isPlaying&&B.Engine.audioEngine.audioContext&&(e+=B.Engine.audioEngine.audioContext.currentTime-this._startTime),e},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){B.Engine.audioEngine.canUseWebAudio&&(this.isPlaying&&this.stop(),this._isReadyToPlay=!1,-1===this.soundTrackId?this._scene.mainSoundTrack.removeSound(this):this._scene.soundTracks&&this._scene.soundTracks[this.soundTrackId].removeSound(this),this._soundGain&&(this._soundGain.disconnect(),this._soundGain=null),this._soundPanner&&(this._soundPanner.disconnect(),this._soundPanner=null),this._soundSource&&(this._soundSource.disconnect(),this._soundSource=null),this._audioBuffer=null,this._htmlAudioElement&&(this._htmlAudioElement.pause(),this._htmlAudioElement.src="",document.body.removeChild(this._htmlAudioElement)),this._streamingSource&&this._streamingSource.disconnect(),this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._connectedTransformNode=null))},e.prototype.isReady=function(){return this._isReadyToPlay},e.prototype._soundLoaded=function(e){var t=this;B.Engine.audioEngine.audioContext&&B.Engine.audioEngine.audioContext.decodeAudioData(e,(function(e){t._audioBuffer=e,t._isReadyToPlay=!0,t.autoplay&&t.play(0,t._offset,t._length),t._readyToPlayCallback&&t._readyToPlayCallback()}),(function(e){u.Y.Error("Error while decoding audio data for: "+t.name+" / Error: "+e)}))},e.prototype.setAudioBuffer=function(e){B.Engine.audioEngine.canUseWebAudio&&(this._audioBuffer=e,this._isReadyToPlay=!0)},e.prototype.updateOptions=function(e){var t,i,n,r,o,s,a,l,h;e&&(this.loop=null!==(t=e.loop)&&void 0!==t?t:this.loop,this.maxDistance=null!==(i=e.maxDistance)&&void 0!==i?i:this.maxDistance,this.useCustomAttenuation=null!==(n=e.useCustomAttenuation)&&void 0!==n?n:this.useCustomAttenuation,this.rolloffFactor=null!==(r=e.rolloffFactor)&&void 0!==r?r:this.rolloffFactor,this.refDistance=null!==(o=e.refDistance)&&void 0!==o?o:this.refDistance,this.distanceModel=null!==(s=e.distanceModel)&&void 0!==s?s:this.distanceModel,this._playbackRate=null!==(a=e.playbackRate)&&void 0!==a?a:this._playbackRate,this._length=null!==(l=e.length)&&void 0!==l?l:void 0,this._offset=null!==(h=e.offset)&&void 0!==h?h:void 0,this._updateSpatialParameters(),this.isPlaying&&(this._streaming&&this._htmlAudioElement?(this._htmlAudioElement.playbackRate=this._playbackRate,this._htmlAudioElement.loop!==this.loop&&(this._htmlAudioElement.loop=this.loop)):this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate,this._soundSource.loop!==this.loop&&(this._soundSource.loop=this.loop),void 0!==this._offset&&this._soundSource.loopStart!==this._offset&&(this._soundSource.loopStart=this._offset),void 0!==this._length&&this._length!==this._soundSource.loopEnd&&(this._soundSource.loopEnd=(0|this._offset)+this._length))))},e.prototype._createSpatialParameters=function(){B.Engine.audioEngine.canUseWebAudio&&B.Engine.audioEngine.audioContext&&(this._scene.headphone&&(this._panningModel="HRTF"),this._soundPanner=B.Engine.audioEngine.audioContext.createPanner(),this._soundPanner&&this._outputAudioNode&&(this._updateSpatialParameters(),this._soundPanner.connect(this._outputAudioNode),this._inputAudioNode=this._soundPanner))},e.prototype._updateSpatialParameters=function(){this.spatialSound&&this._soundPanner&&(this.useCustomAttenuation?(this._soundPanner.distanceModel="linear",this._soundPanner.maxDistance=Number.MAX_VALUE,this._soundPanner.refDistance=1,this._soundPanner.rolloffFactor=1,this._soundPanner.panningModel=this._panningModel):(this._soundPanner.distanceModel=this.distanceModel,this._soundPanner.maxDistance=this.maxDistance,this._soundPanner.refDistance=this.refDistance,this._soundPanner.rolloffFactor=this.rolloffFactor,this._soundPanner.panningModel=this._panningModel))},e.prototype.switchPanningModelToHRTF=function(){this._panningModel="HRTF",this._switchPanningModel()},e.prototype.switchPanningModelToEqualPower=function(){this._panningModel="equalpower",this._switchPanningModel()},e.prototype._switchPanningModel=function(){B.Engine.audioEngine.canUseWebAudio&&this.spatialSound&&this._soundPanner&&(this._soundPanner.panningModel=this._panningModel)},e.prototype.connectToSoundTrackAudioNode=function(e){B.Engine.audioEngine.canUseWebAudio&&this._outputAudioNode&&(this._isOutputConnected&&this._outputAudioNode.disconnect(),this._outputAudioNode.connect(e),this._isOutputConnected=!0)},e.prototype.setDirectionalCone=function(e,t,i){t0&&(this._htmlAudioElement.currentTime=0)):this._streamingSource.disconnect(),this.isPlaying=!1;else if(B.Engine.audioEngine.audioContext&&this._soundSource){var i=e?B.Engine.audioEngine.audioContext.currentTime+e:B.Engine.audioEngine.audioContext.currentTime;this._soundSource.stop(i),this._soundSource.onended=function(){t.isPlaying=!1},this.isPaused||(this._startOffset=0)}},e.prototype.pause=function(){this.isPlaying&&(this.isPaused=!0,this._streaming?this._htmlAudioElement?this._htmlAudioElement.pause():this._streamingSource.disconnect():B.Engine.audioEngine.audioContext&&(this.stop(0),this._startOffset+=B.Engine.audioEngine.audioContext.currentTime-this._startTime))},e.prototype.setVolume=function(e,t){B.Engine.audioEngine.canUseWebAudio&&this._soundGain&&(t&&B.Engine.audioEngine.audioContext?(this._soundGain.gain.cancelScheduledValues(B.Engine.audioEngine.audioContext.currentTime),this._soundGain.gain.setValueAtTime(this._soundGain.gain.value,B.Engine.audioEngine.audioContext.currentTime),this._soundGain.gain.linearRampToValueAtTime(e,B.Engine.audioEngine.audioContext.currentTime+t)):this._soundGain.gain.value=e),this._volume=e},e.prototype.setPlaybackRate=function(e){this._playbackRate=e,this.isPlaying&&(this._streaming&&this._htmlAudioElement?this._htmlAudioElement.playbackRate=this._playbackRate:this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate))},e.prototype.getVolume=function(){return this._volume},e.prototype.attachToMesh=function(e){var t=this;this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null),this._connectedTransformNode=e,this.spatialSound||(this.spatialSound=!0,this._createSpatialParameters(),this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._offset,this._length))),this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode),this._registerFunc=function(e){return t._onRegisterAfterWorldMatrixUpdate(e)},this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc)},e.prototype.detachFromMesh=function(){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null,this._connectedTransformNode=null)},e.prototype._onRegisterAfterWorldMatrixUpdate=function(e){if(this._positionInEmitterSpace)e.worldMatrixFromCache.invertToRef(L.jp.Matrix[0]),this.setPosition(L.jp.Matrix[0].getTranslation());else if(e.getBoundingInfo){var t=e.getBoundingInfo();this.setPosition(t.boundingSphere.centerWorld)}else this.setPosition(e.absolutePosition);B.Engine.audioEngine.canUseWebAudio&&this._isDirectional&&this.isPlaying&&this._updateDirection()},e.prototype.clone=function(){var t=this;if(this._streaming)return null;var i=function(){t._isReadyToPlay?(r._audioBuffer=t.getAudioBuffer(),r._isReadyToPlay=!0,r.autoplay&&r.play(0,t._offset,t._length)):window.setTimeout(i,300)},n={autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this.spatialSound,maxDistance:this.maxDistance,useCustomAttenuation:this.useCustomAttenuation,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel},r=new e(this.name+"_cloned",new ArrayBuffer(0),this._scene,null,n);return this.useCustomAttenuation&&r.setAttenuationFunction(this._customAttenuationFunction),r.setPosition(this._position),r.setPlaybackRate(this._playbackRate),i(),r},e.prototype.getAudioBuffer=function(){return this._audioBuffer},e.prototype.getSoundSource=function(){return this._soundSource},e.prototype.getSoundGain=function(){return this._soundGain},e.prototype.serialize=function(){var e={name:this.name,url:this.name,autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this.spatialSound,maxDistance:this.maxDistance,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel,playbackRate:this._playbackRate,panningModel:this._panningModel,soundTrackId:this.soundTrackId,metadata:this.metadata};return this.spatialSound&&(this._connectedTransformNode&&(e.connectedMeshId=this._connectedTransformNode.id),e.position=this._position.asArray(),e.refDistance=this.refDistance,e.distanceModel=this.distanceModel,e.isDirectional=this._isDirectional,e.localDirectionToMesh=this._localDirection.asArray(),e.coneInnerAngle=this._coneInnerAngle,e.coneOuterAngle=this._coneOuterAngle,e.coneOuterGain=this._coneOuterGain),e},e.Parse=function(t,i,n,r){var o,s=t.name;o=t.url?n+t.url:n+s;var a,l={autoplay:t.autoplay,loop:t.loop,volume:t.volume,spatialSound:t.spatialSound,maxDistance:t.maxDistance,rolloffFactor:t.rolloffFactor,refDistance:t.refDistance,distanceModel:t.distanceModel,playbackRate:t.playbackRate};if(r){var h=function(){r._isReadyToPlay?(a._audioBuffer=r.getAudioBuffer(),a._isReadyToPlay=!0,a.autoplay&&a.play(0,a._offset,a._length)):window.setTimeout(h,300)};a=new e(s,new ArrayBuffer(0),i,null,l),h()}else a=new e(s,o,i,(function(){i._removePendingData(a)}),l),i._addPendingData(a);if(t.position){var c=L.P.FromArray(t.position);a.setPosition(c)}if(t.isDirectional&&(a.setDirectionalCone(t.coneInnerAngle||360,t.coneOuterAngle||360,t.coneOuterGain||0),t.localDirectionToMesh)){var u=L.P.FromArray(t.localDirectionToMesh);a.setLocalDirectionToMesh(u)}if(t.connectedMeshId){var f=i.getMeshByID(t.connectedMeshId);f&&a.attachToMesh(f)}return t.metadata&&(a.metadata=t.metadata),a},e._SceneComponentInitialization=function(e){throw Nn.f.WarnImport("AudioSceneComponent")},e}(),Bn=function(){function e(e,t,i){var n=this;if(this.loop=!1,this._coneInnerAngle=360,this._coneOuterAngle=360,this._volume=1,this.isPlaying=!1,this.isPaused=!1,this._sounds=[],this._weights=[],t.length!==i.length)throw new Error("Sounds length does not equal weights length");this.loop=e,this._weights=i;for(var r=0,o=0,s=i;o0?1/r:0,l=0;l=0;o--)if(r.push(Vi.Get(e+"/ids/"+n[o],i,n[o])),r.length===this.maxLODsToLoad)return r;return r.push(t),r},e.prototype._disposeTransformNode=function(e){var t=this,i=new Array,n=e.material;n&&i.push(n);for(var r=0,o=e.getChildMeshes();r0){var i=e.metadata=e.metadata||{};(i.gltf=i.gltf||{}).extras=t.extras}},e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,t,i){var n=this;return this._loader.loadNodeAsync(e,t,(function(e){n._assignExtras(e,t),i(e)}))},e.prototype.loadCameraAsync=function(e,t,i){var n=this;return this._loader.loadCameraAsync(e,t,(function(e){n._assignExtras(e,t),i(e)}))},e.prototype.createMaterial=function(e,t,i){var n=this._loader.createMaterial(e,t,i);return this._assignExtras(n,t),n},e}();Gi.RegisterExtension(jn,(function(e){return new Yn(e)}))},9669:(e,t,i)=>{e.exports=i(1609)},5448:(e,t,i)=>{"use strict";var n=i(4867),r=i(6026),o=i(4372),s=i(5327),a=i(4097),l=i(4109),h=i(7985),c=i(5061);e.exports=function(e){return new Promise((function(t,i){var u=e.data,f=e.headers,d=e.responseType;n.isFormData(u)&&delete f["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var _=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";f.Authorization="Basic "+btoa(_+":"+g)}var m=a(e.baseURL,e.url);function v(){if(p){var n="getAllResponseHeaders"in p?l(p.getAllResponseHeaders()):null,o={data:d&&"text"!==d&&"json"!==d?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:n,config:e,request:p};r(t,i,o),p=null}}if(p.open(e.method.toUpperCase(),s(m,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,"onloadend"in p?p.onloadend=v:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(v)},p.onabort=function(){p&&(i(c("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){i(c("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),i(c(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},n.isStandardBrowserEnv()){var y=(e.withCredentials||h(m))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;y&&(f[e.xsrfHeaderName]=y)}"setRequestHeader"in p&&n.forEach(f,(function(e,t){void 0===u&&"content-type"===t.toLowerCase()?delete f[t]:p.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),d&&"json"!==d&&(p.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),i(e),p=null)})),u||(u=null),p.send(u)}))}},1609:(e,t,i)=>{"use strict";var n=i(4867),r=i(1849),o=i(321),s=i(7185);function a(e){var t=new o(e),i=r(o.prototype.request,t);return n.extend(i,o.prototype,t),n.extend(i,t),i}var l=a(i(5655));l.Axios=o,l.create=function(e){return a(s(l.defaults,e))},l.Cancel=i(5263),l.CancelToken=i(4972),l.isCancel=i(6502),l.all=function(e){return Promise.all(e)},l.spread=i(8713),l.isAxiosError=i(6268),e.exports=l,e.exports.default=l},5263:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},4972:(e,t,i)=>{"use strict";var n=i(5263);function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var i=this;e((function(e){i.reason||(i.reason=new n(e),t(i.reason))}))}r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e;return{token:new r((function(t){e=t})),cancel:e}},e.exports=r},6502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,i)=>{"use strict";var n=i(4867),r=i(5327),o=i(782),s=i(3572),a=i(7185),l=i(4875),h=l.validators;function c(e){this.defaults=e,this.interceptors={request:new o,response:new o}}c.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&l.assertOptions(t,{silentJSONParsing:h.transitional(h.boolean,"1.0.0"),forcedJSONParsing:h.transitional(h.boolean,"1.0.0"),clarifyTimeoutError:h.transitional(h.boolean,"1.0.0")},!1);var i=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,i.unshift(t.fulfilled,t.rejected))}));var r,o=[];if(this.interceptors.response.forEach((function(e){o.push(e.fulfilled,e.rejected)})),!n){var c=[s,void 0];for(Array.prototype.unshift.apply(c,i),c.concat(o),r=Promise.resolve(e);c.length;)r=r.then(c.shift(),c.shift());return r}for(var u=e;i.length;){var f=i.shift(),d=i.shift();try{u=f(u)}catch(e){d(e);break}}try{r=s(u)}catch(e){return Promise.reject(e)}for(;o.length;)r=r.then(o.shift(),o.shift());return r},c.prototype.getUri=function(e){return e=a(this.defaults,e),r(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,i){return this.request(a(i||{},{method:e,url:t,data:(i||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){c.prototype[e]=function(t,i,n){return this.request(a(n||{},{method:e,url:t,data:i}))}})),e.exports=c},782:(e,t,i)=>{"use strict";var n=i(4867);function r(){this.handlers=[]}r.prototype.use=function(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=r},4097:(e,t,i)=>{"use strict";var n=i(1793),r=i(7303);e.exports=function(e,t){return e&&!n(t)?r(e,t):t}},5061:(e,t,i)=>{"use strict";var n=i(481);e.exports=function(e,t,i,r,o){var s=new Error(e);return n(s,t,i,r,o)}},3572:(e,t,i)=>{"use strict";var n=i(4867),r=i(8527),o=i(6502),s=i(5655);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=r.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return a(e),t.data=r.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(a(e),t&&t.response&&(t.response.data=r.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:e=>{"use strict";e.exports=function(e,t,i,n,r){return e.config=t,i&&(e.code=i),e.request=n,e.response=r,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},7185:(e,t,i)=>{"use strict";var n=i(4867);e.exports=function(e,t){t=t||{};var i={},r=["url","method","data"],o=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function l(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function h(r){n.isUndefined(t[r])?n.isUndefined(e[r])||(i[r]=l(void 0,e[r])):i[r]=l(e[r],t[r])}n.forEach(r,(function(e){n.isUndefined(t[e])||(i[e]=l(void 0,t[e]))})),n.forEach(o,h),n.forEach(s,(function(r){n.isUndefined(t[r])?n.isUndefined(e[r])||(i[r]=l(void 0,e[r])):i[r]=l(void 0,t[r])})),n.forEach(a,(function(n){n in t?i[n]=l(e[n],t[n]):n in e&&(i[n]=l(void 0,e[n]))}));var c=r.concat(o).concat(s).concat(a),u=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===c.indexOf(e)}));return n.forEach(u,h),i}},6026:(e,t,i)=>{"use strict";var n=i(5061);e.exports=function(e,t,i){var r=i.config.validateStatus;i.status&&r&&!r(i.status)?t(n("Request failed with status code "+i.status,i.config,null,i.request,i)):e(i)}},8527:(e,t,i)=>{"use strict";var n=i(4867),r=i(5655);e.exports=function(e,t,i){var o=this||r;return n.forEach(i,(function(i){e=i.call(o,e,t)})),e}},5655:(e,t,i)=>{"use strict";var n=i(4867),r=i(6016),o=i(481),s={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var l,h={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(l=i(5448)),l),transformRequest:[function(e,t){return r(t,"Accept"),r(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),JSON.stringify(e)):e}],transformResponse:[function(e){var t=this.transitional,i=t&&t.silentJSONParsing,r=t&&t.forcedJSONParsing,s=!i&&"json"===this.responseType;if(s||r&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};h.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],(function(e){h.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){h.headers[e]=n.merge(s)})),e.exports=h},1849:e=>{"use strict";e.exports=function(e,t){return function(){for(var i=new Array(arguments.length),n=0;n{"use strict";var n=i(4867);function r(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,i){if(!t)return e;var o;if(i)o=i(t);else if(n.isURLSearchParams(t))o=t.toString();else{var s=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),s.push(r(t)+"="+r(e))})))})),o=s.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},7303:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},4372:(e,t,i)=>{"use strict";var n=i(4867);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,i,r,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(i)&&a.push("expires="+new Date(i).toGMTString()),n.isString(r)&&a.push("path="+r),n.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},1793:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},6268:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},7985:(e,t,i)=>{"use strict";var n=i(4867);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");function r(e){var n=e;return t&&(i.setAttribute("href",n),n=i.href),i.setAttribute("href",n),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}return e=r(window.location.href),function(t){var i=n.isString(t)?r(t):t;return i.protocol===e.protocol&&i.host===e.host}}():function(){return!0}},6016:(e,t,i)=>{"use strict";var n=i(4867);e.exports=function(e,t){n.forEach(e,(function(i,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=i,delete e[n])}))}},4109:(e,t,i)=>{"use strict";var n=i(4867),r=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,i,o,s={};return e?(n.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),i=n.trim(e.substr(o+1)),t){if(s[t]&&r.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([i]):s[t]?s[t]+", "+i:i}})),s):s}},8713:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},4875:(e,t,i)=>{"use strict";var n=i(696),r={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){r[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));var o={},s=n.version.split(".");function a(e,t){for(var i=t?t.split("."):s,n=e.split("."),r=0;r<3;r++){if(i[r]>n[r])return!0;if(i[r]0;){var o=n[r],s=t[o];if(s){var a=e[o],l=void 0===a||s(a,o,e);if(!0!==l)throw new TypeError("option "+o+" must be "+l)}else if(!0!==i)throw Error("Unknown option "+o)}},validators:r}},4867:(e,t,i)=>{"use strict";var n=i(1849),r=Object.prototype.toString;function o(e){return"[object Array]"===r.call(e)}function s(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function l(e){if("[object Object]"!==r.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function h(e){return"[object Function]"===r.call(e)}function c(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),o(e))for(var i=0,n=e.length;i{"use strict";e.exports=JSON.parse('{"_args":[["axios@0.21.2","C:\\\\Users\\\\nilst\\\\Documents\\\\repos\\\\babyplots_lib"]],"_from":"axios@0.21.2","_id":"axios@0.21.2","_inBundle":false,"_integrity":"sha512-87otirqUw3e8CzHTMO+/9kh/FSgXt/eVDvipijwDtEuwbkySWZ9SBm6VEubmJ/kLKEoLQV/POhxXFb66bfekfg==","_location":"/axios","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"axios@0.21.2","name":"axios","escapedName":"axios","rawSpec":"0.21.2","saveSpec":null,"fetchSpec":"0.21.2"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/axios/-/axios-0.21.2.tgz","_spec":"0.21.2","_where":"C:\\\\Users\\\\nilst\\\\Documents\\\\repos\\\\babyplots_lib","author":{"name":"Matt Zabriskie"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"bugs":{"url":"https://github.com/axios/axios/issues"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}],"dependencies":{"follow-redirects":"^1.14.0"},"description":"Promise based HTTP client for the browser and node.js","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"homepage":"https://axios-http.com","jsdelivr":"dist/axios.min.js","keywords":["xhr","http","ajax","promise","node"],"license":"MIT","main":"index.js","name":"axios","repository":{"type":"git","url":"git+https://github.com/axios/axios.git"},"scripts":{"build":"NODE_ENV=production grunt build","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","examples":"node ./examples/server.js","fix":"eslint --fix lib/**/*.js","postversion":"git push && git push --tags","preversion":"npm test","start":"node ./sandbox/server.js","test":"grunt test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"},"typings":"./index.d.ts","unpkg":"dist/axios.min.js","version":"0.21.2"}')},5792:function(e){e.exports=function(){"use strict";for(var e=function(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=1),ei?i:e},t=function(t){t._clipped=!1,t._unclipped=t.slice(0);for(var i=0;i<=3;i++)i<3?((t[i]<0||t[i]>255)&&(t._clipped=!0),t[i]=e(t[i],0,255)):3===i&&(t[i]=e(t[i],0,1));return t},i={},n=0,r=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];n=3?Array.prototype.slice.call(e):"object"==s(e[0])&&t?t.split("").filter((function(t){return void 0!==e[0][t]})).map((function(t){return e[0][t]})):e[0]},l=function(e){if(e.length<2)return null;var t=e.length-1;return"string"==s(e[t])?e[t].toLowerCase():null},h=Math.PI,c={clip_rgb:t,limit:e,type:s,unpack:a,last:l,PI:h,TWOPI:2*h,PITHIRD:h/3,DEG2RAD:h/180,RAD2DEG:180/h},u={format:{},autodetect:[]},f=c.last,d=c.clip_rgb,p=c.type,_=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=this;if("object"===p(e[0])&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];var n=f(e),r=!1;if(!n){r=!0,u.sorted||(u.autodetect=u.autodetect.sort((function(e,t){return t.p-e.p})),u.sorted=!0);for(var o=0,s=u.autodetect;o4?e[4]:1;return 1===o?[0,0,0,s]:[i>=1?0:255*(1-i)*(1-o),n>=1?0:255*(1-n)*(1-o),r>=1?0:255*(1-r)*(1-o),s]},C=c.unpack,x=c.type;g.prototype.cmyk=function(){return T(this._rgb)},v.cmyk=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["cmyk"])))},u.format.cmyk=E,u.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=C(e,"cmyk"),"array"===x(e)&&4===e.length)return"cmyk"}});var S=c.unpack,R=c.last,M=function(e){return Math.round(100*e)/100},P=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=S(e,"hsla"),n=R(e)||"lsa";return i[0]=M(i[0]||0),i[1]=M(100*i[1])+"%",i[2]=M(100*i[2])+"%","hsla"===n||i.length>3&&i[3]<1?(i[3]=i.length>3?i[3]:1,n="hsla"):i.length=3,n+"("+i.join(",")+")"},I=c.unpack,O=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=(e=I(e,"rgba"))[0],n=e[1],r=e[2];i/=255,n/=255,r/=255;var o,s,a=Math.min(i,n,r),l=Math.max(i,n,r),h=(l+a)/2;return l===a?(o=0,s=Number.NaN):o=h<.5?(l-a)/(l+a):(l-a)/(2-l-a),i==l?s=(n-r)/(l-a):n==l?s=2+(r-i)/(l-a):r==l&&(s=4+(i-n)/(l-a)),(s*=60)<0&&(s+=360),e.length>3&&void 0!==e[3]?[s,o,h,e[3]]:[s,o,h]},D=c.unpack,L=c.last,w=Math.round,N=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=D(e,"rgba"),n=L(e)||"rgb";return"hsl"==n.substr(0,3)?P(O(i),n):(i[0]=w(i[0]),i[1]=w(i[1]),i[2]=w(i[2]),("rgba"===n||i.length>3&&i[3]<1)&&(i[3]=i.length>3?i[3]:1,n="rgba"),n+"("+i.slice(0,"rgb"===n?3:4).join(",")+")")},F=c.unpack,B=Math.round,U=function(){for(var e,t=[],i=arguments.length;i--;)t[i]=arguments[i];var n,r,o,s=(t=F(t,"hsl"))[0],a=t[1],l=t[2];if(0===a)n=r=o=255*l;else{var h=[0,0,0],c=[0,0,0],u=l<.5?l*(1+a):l+a-l*a,f=2*l-u,d=s/360;h[0]=d+1/3,h[1]=d,h[2]=d-1/3;for(var p=0;p<3;p++)h[p]<0&&(h[p]+=1),h[p]>1&&(h[p]-=1),6*h[p]<1?c[p]=f+6*(u-f)*h[p]:2*h[p]<1?c[p]=u:3*h[p]<2?c[p]=f+(u-f)*(2/3-h[p])*6:c[p]=f;n=(e=[B(255*c[0]),B(255*c[1]),B(255*c[2])])[0],r=e[1],o=e[2]}return t.length>3?[n,r,o,t[3]]:[n,r,o,1]},k=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,V=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,G=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,H=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,z=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,W=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,X=Math.round,j=function(e){var t;if(e=e.toLowerCase().trim(),u.format.named)try{return u.format.named(e)}catch(e){}if(t=e.match(k)){for(var i=t.slice(1,4),n=0;n<3;n++)i[n]=+i[n];return i[3]=1,i}if(t=e.match(V)){for(var r=t.slice(1,5),o=0;o<4;o++)r[o]=+r[o];return r}if(t=e.match(G)){for(var s=t.slice(1,4),a=0;a<3;a++)s[a]=X(2.55*s[a]);return s[3]=1,s}if(t=e.match(H)){for(var l=t.slice(1,5),h=0;h<3;h++)l[h]=X(2.55*l[h]);return l[3]=+l[3],l}if(t=e.match(z)){var c=t.slice(1,4);c[1]*=.01,c[2]*=.01;var f=U(c);return f[3]=1,f}if(t=e.match(W)){var d=t.slice(1,4);d[1]*=.01,d[2]*=.01;var p=U(d);return p[3]=+t[4],p}};j.test=function(e){return k.test(e)||V.test(e)||G.test(e)||H.test(e)||z.test(e)||W.test(e)};var Y=j,K=c.type;g.prototype.css=function(e){return N(this._rgb,e)},v.css=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["css"])))},u.format.css=Y,u.autodetect.push({p:5,test:function(e){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];if(!t.length&&"string"===K(e)&&Y.test(e))return"css"}});var q=c.unpack;u.format.gl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=q(e,"rgba");return i[0]*=255,i[1]*=255,i[2]*=255,i},v.gl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["gl"])))},g.prototype.gl=function(){var e=this._rgb;return[e[0]/255,e[1]/255,e[2]/255,e[3]]};var Z=c.unpack,Q=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i,n=Z(e,"rgb"),r=n[0],o=n[1],s=n[2],a=Math.min(r,o,s),l=Math.max(r,o,s),h=l-a,c=100*h/255,u=a/(255-h)*100;return 0===h?i=Number.NaN:(r===l&&(i=(o-s)/h),o===l&&(i=2+(s-r)/h),s===l&&(i=4+(r-o)/h),(i*=60)<0&&(i+=360)),[i,c,u]},J=c.unpack,$=Math.floor,ee=function(){for(var e,t,i,n,r,o,s=[],a=arguments.length;a--;)s[a]=arguments[a];var l,h,c,u=(s=J(s,"hcg"))[0],f=s[1],d=s[2];d*=255;var p=255*f;if(0===f)l=h=c=d;else{360===u&&(u=0),u>360&&(u-=360),u<0&&(u+=360);var _=$(u/=60),g=u-_,m=d*(1-f),v=m+p*(1-g),y=m+p*g,b=m+p;switch(_){case 0:l=(e=[b,y,m])[0],h=e[1],c=e[2];break;case 1:l=(t=[v,b,m])[0],h=t[1],c=t[2];break;case 2:l=(i=[m,b,y])[0],h=i[1],c=i[2];break;case 3:l=(n=[m,v,b])[0],h=n[1],c=n[2];break;case 4:l=(r=[y,m,b])[0],h=r[1],c=r[2];break;case 5:l=(o=[b,m,v])[0],h=o[1],c=o[2]}}return[l,h,c,s.length>3?s[3]:1]},te=c.unpack,ie=c.type;g.prototype.hcg=function(){return Q(this._rgb)},v.hcg=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["hcg"])))},u.format.hcg=ee,u.autodetect.push({p:1,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=te(e,"hcg"),"array"===ie(e)&&3===e.length)return"hcg"}});var ne=c.unpack,re=c.last,oe=Math.round,se=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=ne(e,"rgba"),n=i[0],r=i[1],o=i[2],s=i[3],a=re(e)||"auto";void 0===s&&(s=1),"auto"===a&&(a=s<1?"rgba":"rgb");var l="000000"+((n=oe(n))<<16|(r=oe(r))<<8|(o=oe(o))).toString(16);l=l.substr(l.length-6);var h="0"+oe(255*s).toString(16);switch(h=h.substr(h.length-2),a.toLowerCase()){case"rgba":return"#"+l+h;case"argb":return"#"+h+l;default:return"#"+l}},ae=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,le=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,he=function(e){if(e.match(ae)){4!==e.length&&7!==e.length||(e=e.substr(1)),3===e.length&&(e=(e=e.split(""))[0]+e[0]+e[1]+e[1]+e[2]+e[2]);var t=parseInt(e,16);return[t>>16,t>>8&255,255&t,1]}if(e.match(le)){5!==e.length&&9!==e.length||(e=e.substr(1)),4===e.length&&(e=(e=e.split(""))[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);var i=parseInt(e,16);return[i>>24&255,i>>16&255,i>>8&255,Math.round((255&i)/255*100)/100]}throw new Error("unknown hex color: "+e)},ce=c.type;g.prototype.hex=function(e){return se(this._rgb,e)},v.hex=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["hex"])))},u.format.hex=he,u.autodetect.push({p:4,test:function(e){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];if(!t.length&&"string"===ce(e)&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return"hex"}});var ue=c.unpack,fe=c.TWOPI,de=Math.min,pe=Math.sqrt,_e=Math.acos,ge=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i,n=ue(e,"rgb"),r=n[0],o=n[1],s=n[2],a=de(r/=255,o/=255,s/=255),l=(r+o+s)/3,h=l>0?1-a/l:0;return 0===h?i=NaN:(i=(r-o+(r-s))/2,i/=pe((r-o)*(r-o)+(r-s)*(o-s)),i=_e(i),s>o&&(i=fe-i),i/=fe),[360*i,h,l]},me=c.unpack,ve=c.limit,ye=c.TWOPI,be=c.PITHIRD,Te=Math.cos,Ae=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i,n,r,o=(e=me(e,"hsi"))[0],s=e[1],a=e[2];return isNaN(o)&&(o=0),isNaN(s)&&(s=0),o>360&&(o-=360),o<0&&(o+=360),(o/=360)<1/3?n=1-((r=(1-s)/3)+(i=(1+s*Te(ye*o)/Te(be-ye*o))/3)):o<2/3?r=1-((i=(1-s)/3)+(n=(1+s*Te(ye*(o-=1/3))/Te(be-ye*o))/3)):i=1-((n=(1-s)/3)+(r=(1+s*Te(ye*(o-=2/3))/Te(be-ye*o))/3)),[255*(i=ve(a*i*3)),255*(n=ve(a*n*3)),255*(r=ve(a*r*3)),e.length>3?e[3]:1]},Ee=c.unpack,Ce=c.type;g.prototype.hsi=function(){return ge(this._rgb)},v.hsi=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["hsi"])))},u.format.hsi=Ae,u.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Ee(e,"hsi"),"array"===Ce(e)&&3===e.length)return"hsi"}});var xe=c.unpack,Se=c.type;g.prototype.hsl=function(){return O(this._rgb)},v.hsl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["hsl"])))},u.format.hsl=U,u.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=xe(e,"hsl"),"array"===Se(e)&&3===e.length)return"hsl"}});var Re=c.unpack,Me=Math.min,Pe=Math.max,Ie=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i,n,r,o=(e=Re(e,"rgb"))[0],s=e[1],a=e[2],l=Me(o,s,a),h=Pe(o,s,a),c=h-l;return r=h/255,0===h?(i=Number.NaN,n=0):(n=c/h,o===h&&(i=(s-a)/c),s===h&&(i=2+(a-o)/c),a===h&&(i=4+(o-s)/c),(i*=60)<0&&(i+=360)),[i,n,r]},Oe=c.unpack,De=Math.floor,Le=function(){for(var e,t,i,n,r,o,s=[],a=arguments.length;a--;)s[a]=arguments[a];var l,h,c,u=(s=Oe(s,"hsv"))[0],f=s[1],d=s[2];if(d*=255,0===f)l=h=c=d;else{360===u&&(u=0),u>360&&(u-=360),u<0&&(u+=360);var p=De(u/=60),_=u-p,g=d*(1-f),m=d*(1-f*_),v=d*(1-f*(1-_));switch(p){case 0:l=(e=[d,v,g])[0],h=e[1],c=e[2];break;case 1:l=(t=[m,d,g])[0],h=t[1],c=t[2];break;case 2:l=(i=[g,d,v])[0],h=i[1],c=i[2];break;case 3:l=(n=[g,m,d])[0],h=n[1],c=n[2];break;case 4:l=(r=[v,g,d])[0],h=r[1],c=r[2];break;case 5:l=(o=[d,g,m])[0],h=o[1],c=o[2]}}return[l,h,c,s.length>3?s[3]:1]},we=c.unpack,Ne=c.type;g.prototype.hsv=function(){return Ie(this._rgb)},v.hsv=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["hsv"])))},u.format.hsv=Le,u.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=we(e,"hsv"),"array"===Ne(e)&&3===e.length)return"hsv"}});var Fe={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},Be=c.unpack,Ue=Math.pow,ke=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=Be(e,"rgb"),n=i[0],r=i[1],o=i[2],s=He(n,r,o),a=s[0],l=s[1],h=116*l-16;return[h<0?0:h,500*(a-l),200*(l-s[2])]},Ve=function(e){return(e/=255)<=.04045?e/12.92:Ue((e+.055)/1.055,2.4)},Ge=function(e){return e>Fe.t3?Ue(e,1/3):e/Fe.t2+Fe.t0},He=function(e,t,i){return e=Ve(e),t=Ve(t),i=Ve(i),[Ge((.4124564*e+.3575761*t+.1804375*i)/Fe.Xn),Ge((.2126729*e+.7151522*t+.072175*i)/Fe.Yn),Ge((.0193339*e+.119192*t+.9503041*i)/Fe.Zn)]},ze=ke,We=c.unpack,Xe=Math.pow,je=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i,n,r,o=(e=We(e,"lab"))[0],s=e[1],a=e[2];return n=(o+16)/116,i=isNaN(s)?n:n+s/500,r=isNaN(a)?n:n-a/200,n=Fe.Yn*Ke(n),i=Fe.Xn*Ke(i),r=Fe.Zn*Ke(r),[Ye(3.2404542*i-1.5371385*n-.4985314*r),Ye(-.969266*i+1.8760108*n+.041556*r),Ye(.0556434*i-.2040259*n+1.0572252*r),e.length>3?e[3]:1]},Ye=function(e){return 255*(e<=.00304?12.92*e:1.055*Xe(e,1/2.4)-.055)},Ke=function(e){return e>Fe.t1?e*e*e:Fe.t2*(e-Fe.t0)},qe=je,Ze=c.unpack,Qe=c.type;g.prototype.lab=function(){return ze(this._rgb)},v.lab=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["lab"])))},u.format.lab=qe,u.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Ze(e,"lab"),"array"===Qe(e)&&3===e.length)return"lab"}});var Je=c.unpack,$e=c.RAD2DEG,et=Math.sqrt,tt=Math.atan2,it=Math.round,nt=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=Je(e,"lab"),n=i[0],r=i[1],o=i[2],s=et(r*r+o*o),a=(tt(o,r)*$e+360)%360;return 0===it(1e4*s)&&(a=Number.NaN),[n,s,a]},rt=c.unpack,ot=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=rt(e,"rgb"),n=i[0],r=i[1],o=i[2],s=ze(n,r,o),a=s[0],l=s[1],h=s[2];return nt(a,l,h)},st=c.unpack,at=c.DEG2RAD,lt=Math.sin,ht=Math.cos,ct=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=st(e,"lch"),n=i[0],r=i[1],o=i[2];return isNaN(o)&&(o=0),[n,ht(o*=at)*r,lt(o)*r]},ut=c.unpack,ft=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=(e=ut(e,"lch"))[0],n=e[1],r=e[2],o=ct(i,n,r),s=o[0],a=o[1],l=o[2],h=qe(s,a,l);return[h[0],h[1],h[2],e.length>3?e[3]:1]},dt=c.unpack,pt=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=dt(e,"hcl").reverse();return ft.apply(void 0,i)},_t=c.unpack,gt=c.type;g.prototype.lch=function(){return ot(this._rgb)},g.prototype.hcl=function(){return ot(this._rgb).reverse()},v.lch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["lch"])))},v.hcl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["hcl"])))},u.format.lch=ft,u.format.hcl=pt,["lch","hcl"].forEach((function(e){return u.autodetect.push({p:2,test:function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];if(t=_t(t,e),"array"===gt(t)&&3===t.length)return e}})}));var mt={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},vt=c.type;g.prototype.name=function(){for(var e=se(this._rgb,"rgb"),t=0,i=Object.keys(mt);t0;)t[i]=arguments[i+1];if(!t.length&&"string"===vt(e)&&mt[e.toLowerCase()])return"named"}});var yt=c.unpack,bt=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=yt(e,"rgb");return(i[0]<<16)+(i[1]<<8)+i[2]},Tt=c.type,At=function(e){if("number"==Tt(e)&&e>=0&&e<=16777215)return[e>>16,e>>8&255,255&e,1];throw new Error("unknown num color: "+e)},Et=c.type;g.prototype.num=function(){return bt(this._rgb)},v.num=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["num"])))},u.format.num=At,u.autodetect.push({p:5,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(1===e.length&&"number"===Et(e[0])&&e[0]>=0&&e[0]<=16777215)return"num"}});var Ct=c.unpack,xt=c.type,St=Math.round;g.prototype.rgb=function(e){return void 0===e&&(e=!0),!1===e?this._rgb.slice(0,3):this._rgb.slice(0,3).map(St)},g.prototype.rgba=function(e){return void 0===e&&(e=!0),this._rgb.slice(0,4).map((function(t,i){return i<3?!1===e?t:St(t):t}))},v.rgb=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["rgb"])))},u.format.rgb=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=Ct(e,"rgba");return void 0===i[3]&&(i[3]=1),i},u.autodetect.push({p:3,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Ct(e,"rgba"),"array"===xt(e)&&(3===e.length||4===e.length&&"number"==xt(e[3])&&e[3]>=0&&e[3]<=1))return"rgb"}});var Rt=Math.log,Mt=function(e){var t,i,n,r=e/100;return r<66?(t=255,i=-155.25485562709179-.44596950469579133*(i=r-2)+104.49216199393888*Rt(i),n=r<20?0:.8274096064007395*(n=r-10)-254.76935184120902+115.67994401066147*Rt(n)):(t=351.97690566805693+.114206453784165*(t=r-55)-40.25366309332127*Rt(t),i=325.4494125711974+.07943456536662342*(i=r-50)-28.0852963507957*Rt(i),n=255),[t,i,n,1]},Pt=c.unpack,It=Math.round,Ot=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var i,n=Pt(e,"rgb"),r=n[0],o=n[2],s=1e3,a=4e4,l=.4;a-s>l;){var h=Mt(i=.5*(a+s));h[2]/h[0]>=o/r?a=i:s=i}return It(i)};g.prototype.temp=g.prototype.kelvin=g.prototype.temperature=function(){return Ot(this._rgb)},v.temp=v.kelvin=v.temperature=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["temp"])))},u.format.temp=u.format.kelvin=u.format.temperature=Mt;var Dt=c.type;g.prototype.alpha=function(e,t){return void 0===t&&(t=!1),void 0!==e&&"number"===Dt(e)?t?(this._rgb[3]=e,this):new g([this._rgb[0],this._rgb[1],this._rgb[2],e],"rgb"):this._rgb[3]},g.prototype.clipped=function(){return this._rgb._clipped||!1},g.prototype.darken=function(e){void 0===e&&(e=1);var t=this,i=t.lab();return i[0]-=Fe.Kn*e,new g(i,"lab").alpha(t.alpha(),!0)},g.prototype.brighten=function(e){return void 0===e&&(e=1),this.darken(-e)},g.prototype.darker=g.prototype.darken,g.prototype.brighter=g.prototype.brighten,g.prototype.get=function(e){var t=e.split("."),i=t[0],n=t[1],r=this[i]();if(n){var o=i.indexOf(n);if(o>-1)return r[o];throw new Error("unknown channel "+n+" in mode "+i)}return r};var Lt=c.type,wt=Math.pow,Nt=1e-7,Ft=20;g.prototype.luminance=function(e){if(void 0!==e&&"number"===Lt(e)){if(0===e)return new g([0,0,0,this._rgb[3]],"rgb");if(1===e)return new g([255,255,255,this._rgb[3]],"rgb");var t=this.luminance(),i="rgb",n=Ft,r=function(t,o){var s=t.interpolate(o,.5,i),a=s.luminance();return Math.abs(e-a)e?r(t,s):r(s,o)},o=(t>e?r(new g([0,0,0]),this):r(this,new g([255,255,255]))).rgb();return new g(o.concat([this._rgb[3]]))}return Bt.apply(void 0,this._rgb.slice(0,3))};var Bt=function(e,t,i){return.2126*(e=Ut(e))+.7152*(t=Ut(t))+.0722*(i=Ut(i))},Ut=function(e){return(e/=255)<=.03928?e/12.92:wt((e+.055)/1.055,2.4)},kt={},Vt=c.type,Gt=function(e,t,i){void 0===i&&(i=.5);for(var n=[],r=arguments.length-3;r-- >0;)n[r]=arguments[r+3];var o=n[0]||"lrgb";if(kt[o]||n.length||(o=Object.keys(kt)[0]),!kt[o])throw new Error("interpolation mode "+o+" is not defined");return"object"!==Vt(e)&&(e=new g(e)),"object"!==Vt(t)&&(t=new g(t)),kt[o](e,t,i).alpha(e.alpha()+i*(t.alpha()-e.alpha()))};g.prototype.mix=g.prototype.interpolate=function(e,t){void 0===t&&(t=.5);for(var i=[],n=arguments.length-2;n-- >0;)i[n]=arguments[n+2];return Gt.apply(void 0,[this,e,t].concat(i))},g.prototype.premultiply=function(e){void 0===e&&(e=!1);var t=this._rgb,i=t[3];return e?(this._rgb=[t[0]*i,t[1]*i,t[2]*i,i],this):new g([t[0]*i,t[1]*i,t[2]*i,i],"rgb")},g.prototype.saturate=function(e){void 0===e&&(e=1);var t=this,i=t.lch();return i[1]+=Fe.Kn*e,i[1]<0&&(i[1]=0),new g(i,"lch").alpha(t.alpha(),!0)},g.prototype.desaturate=function(e){return void 0===e&&(e=1),this.saturate(-e)};var Ht=c.type;g.prototype.set=function(e,t,i){void 0===i&&(i=!1);var n=e.split("."),r=n[0],o=n[1],s=this[r]();if(o){var a=r.indexOf(o);if(a>-1){if("string"==Ht(t))switch(t.charAt(0)){case"+":case"-":s[a]+=+t;break;case"*":s[a]*=+t.substr(1);break;case"/":s[a]/=+t.substr(1);break;default:s[a]=+t}else{if("number"!==Ht(t))throw new Error("unsupported value for Color.set");s[a]=t}var l=new g(s,r);return i?(this._rgb=l._rgb,this):l}throw new Error("unknown channel "+o+" in mode "+r)}return s};var zt=function(e,t,i){var n=e._rgb,r=t._rgb;return new g(n[0]+i*(r[0]-n[0]),n[1]+i*(r[1]-n[1]),n[2]+i*(r[2]-n[2]),"rgb")};kt.rgb=zt;var Wt=Math.sqrt,Xt=Math.pow,jt=function(e,t,i){var n=e._rgb,r=n[0],o=n[1],s=n[2],a=t._rgb,l=a[0],h=a[1],c=a[2];return new g(Wt(Xt(r,2)*(1-i)+Xt(l,2)*i),Wt(Xt(o,2)*(1-i)+Xt(h,2)*i),Wt(Xt(s,2)*(1-i)+Xt(c,2)*i),"rgb")};kt.lrgb=jt;var Yt=function(e,t,i){var n=e.lab(),r=t.lab();return new g(n[0]+i*(r[0]-n[0]),n[1]+i*(r[1]-n[1]),n[2]+i*(r[2]-n[2]),"lab")};kt.lab=Yt;var Kt=function(e,t,i,n){var r,o,s,a,l,h,c,u,f,d,p,_;return"hsl"===n?(s=e.hsl(),a=t.hsl()):"hsv"===n?(s=e.hsv(),a=t.hsv()):"hcg"===n?(s=e.hcg(),a=t.hcg()):"hsi"===n?(s=e.hsi(),a=t.hsi()):"lch"!==n&&"hcl"!==n||(n="hcl",s=e.hcl(),a=t.hcl()),"h"===n.substr(0,1)&&(l=(r=s)[0],c=r[1],f=r[2],h=(o=a)[0],u=o[1],d=o[2]),isNaN(l)||isNaN(h)?isNaN(l)?isNaN(h)?_=Number.NaN:(_=h,1!=f&&0!=f||"hsv"==n||(p=u)):(_=l,1!=d&&0!=d||"hsv"==n||(p=c)):_=l+i*(h>l&&h-l>180?h-(l+360):h180?h+360-l:h-l),void 0===p&&(p=c+i*(u-c)),new g([_,p,f+i*(d-f)],n)},qt=function(e,t,i){return Kt(e,t,i,"lch")};kt.lch=qt,kt.hcl=qt;var Zt=function(e,t,i){var n=e.num(),r=t.num();return new g(n+i*(r-n),"num")};kt.num=Zt;var Qt=function(e,t,i){return Kt(e,t,i,"hcg")};kt.hcg=Qt;var Jt=function(e,t,i){return Kt(e,t,i,"hsi")};kt.hsi=Jt;var $t=function(e,t,i){return Kt(e,t,i,"hsl")};kt.hsl=$t;var ei=function(e,t,i){return Kt(e,t,i,"hsv")};kt.hsv=ei;var ti=c.clip_rgb,ii=Math.pow,ni=Math.sqrt,ri=Math.PI,oi=Math.cos,si=Math.sin,ai=Math.atan2,li=function(e,t,i){void 0===t&&(t="lrgb"),void 0===i&&(i=null);var n=e.length;i||(i=Array.from(new Array(n)).map((function(){return 1})));var r=n/i.reduce((function(e,t){return e+t}));if(i.forEach((function(e,t){i[t]*=r})),e=e.map((function(e){return new g(e)})),"lrgb"===t)return hi(e,i);for(var o=e.shift(),s=o.get(t),a=[],l=0,h=0,c=0;c=360;)p-=360;s[d]=p}else s[d]=s[d]/a[d];return f/=n,new g(s,t).alpha(f>.99999?1:f,!0)},hi=function(e,t){for(var i=e.length,n=[0,0,0,0],r=0;r.9999999&&(n[3]=1),new g(ti(n))},ci=c.type,ui=Math.pow,fi=function(e){var t="rgb",i=v("#ccc"),n=0,r=[0,1],o=[],s=[0,0],a=!1,l=[],h=!1,c=0,u=1,f=!1,d={},p=!0,_=1,g=function(e){if((e=e||["#fff","#000"])&&"string"===ci(e)&&v.brewer&&v.brewer[e.toLowerCase()]&&(e=v.brewer[e.toLowerCase()]),"array"===ci(e)){1===e.length&&(e=[e[0],e[0]]),e=e.slice(0);for(var t=0;t=a[i];)i++;return i-1}return 0},y=function(e){return e},b=function(e){return e},T=function(e,n){var r,h;if(null==n&&(n=!1),isNaN(e)||null===e)return i;h=n?e:a&&a.length>2?m(e)/(a.length-2):u!==c?(e-c)/(u-c):1,h=b(h),n||(h=y(h)),1!==_&&(h=ui(h,_)),h=s[0]+h*(1-s[0]-s[1]),h=Math.min(1,Math.max(0,h));var f=Math.floor(1e4*h);if(p&&d[f])r=d[f];else{if("array"===ci(l))for(var g=0;g=T&&g===o.length-1){r=l[g];break}if(h>T&&h2){var h=e.map((function(t,i){return i/(e.length-1)})),f=e.map((function(e){return(e-c)/(u-c)}));f.every((function(e,t){return h[t]===e}))||(b=function(e){if(e<=0||e>=1)return e;for(var t=0;e>=f[t+1];)t++;var i=(e-f[t])/(f[t+1]-f[t]);return h[t]+i*(h[t+1]-h[t])})}}return r=[c,u],E},E.mode=function(e){return arguments.length?(t=e,A(),E):t},E.range=function(e,t){return g(e,t),E},E.out=function(e){return h=e,E},E.spread=function(e){return arguments.length?(n=e,E):n},E.correctLightness=function(e){return null==e&&(e=!0),f=e,A(),y=f?function(e){for(var t=T(0,!0).lab()[0],i=T(1,!0).lab()[0],n=t>i,r=T(e,!0).lab()[0],o=t+(i-t)*e,s=r-o,a=0,l=1,h=20;Math.abs(s)>.01&&h-- >0;)n&&(s*=-1),s<0?(a=e,e+=.5*(l-e)):(l=e,e+=.5*(a-e)),r=T(e,!0).lab()[0],s=r-o;return e}:function(e){return e},E},E.padding=function(e){return null!=e?("number"===ci(e)&&(e=[e,e]),s=e,E):s},E.colors=function(t,i){arguments.length<2&&(i="hex");var n=[];if(0===arguments.length)n=l.slice(0);else if(1===t)n=[E(.5)];else if(t>1){var o=r[0],s=r[1]-o;n=di(0,t,!1).map((function(e){return E(o+e/(t-1)*s)}))}else{e=[];var h=[];if(a&&a.length>2)for(var c=1,u=a.length,f=1<=u;f?cu;f?c++:c--)h.push(.5*(a[c-1]+a[c]));else h=r;n=h.map((function(e){return E(e)}))}return v[i]&&(n=n.map((function(e){return e[i]()}))),n},E.cache=function(e){return null!=e?(p=e,E):p},E.gamma=function(e){return null!=e?(_=e,E):_},E.nodata=function(e){return null!=e?(i=v(e),E):i},E};function di(e,t,i){for(var n=[],r=eo;r?s++:s--)n.push(s);return n}var pi=function(e){var t,i,n,r,o,s,a;if(2===(e=e.map((function(e){return new g(e)}))).length)t=e.map((function(e){return e.lab()})),o=t[0],s=t[1],r=function(e){var t=[0,1,2].map((function(t){return o[t]+e*(s[t]-o[t])}));return new g(t,"lab")};else if(3===e.length)i=e.map((function(e){return e.lab()})),o=i[0],s=i[1],a=i[2],r=function(e){var t=[0,1,2].map((function(t){return(1-e)*(1-e)*o[t]+2*(1-e)*e*s[t]+e*e*a[t]}));return new g(t,"lab")};else if(4===e.length){var l;n=e.map((function(e){return e.lab()})),o=n[0],s=n[1],a=n[2],l=n[3],r=function(e){var t=[0,1,2].map((function(t){return(1-e)*(1-e)*(1-e)*o[t]+3*(1-e)*(1-e)*e*s[t]+3*(1-e)*e*e*a[t]+e*e*e*l[t]}));return new g(t,"lab")}}else if(5===e.length){var h=pi(e.slice(0,3)),c=pi(e.slice(2,5));r=function(e){return e<.5?h(2*e):c(2*(e-.5))}}return r},_i=function(e){var t=pi(e);return t.scale=function(){return fi(t)},t},gi=function(e,t,i){if(!gi[i])throw new Error("unknown blend mode "+i);return gi[i](e,t)},mi=function(e){return function(t,i){var n=v(i).rgb(),r=v(t).rgb();return v.rgb(e(n,r))}},vi=function(e){return function(t,i){var n=[];return n[0]=e(t[0],i[0]),n[1]=e(t[1],i[1]),n[2]=e(t[2],i[2]),n}},yi=function(e){return e},bi=function(e,t){return e*t/255},Ti=function(e,t){return e>t?t:e},Ai=function(e,t){return e>t?e:t},Ei=function(e,t){return 255*(1-(1-e/255)*(1-t/255))},Ci=function(e,t){return t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255))},xi=function(e,t){return 255*(1-(1-t/255)/(e/255))},Si=function(e,t){return 255===e||(e=t/255*255/(1-e/255))>255?255:e};gi.normal=mi(vi(yi)),gi.multiply=mi(vi(bi)),gi.screen=mi(vi(Ei)),gi.overlay=mi(vi(Ci)),gi.darken=mi(vi(Ti)),gi.lighten=mi(vi(Ai)),gi.dodge=mi(vi(Si)),gi.burn=mi(vi(xi));for(var Ri=gi,Mi=c.type,Pi=c.clip_rgb,Ii=c.TWOPI,Oi=Math.pow,Di=Math.sin,Li=Math.cos,wi=function(e,t,i,n,r){void 0===e&&(e=300),void 0===t&&(t=-1.5),void 0===i&&(i=1),void 0===n&&(n=1),void 0===r&&(r=[0,1]);var o,s=0;"array"===Mi(r)?o=r[1]-r[0]:(o=0,r=[r,r]);var a=function(a){var l=Ii*((e+120)/360+t*a),h=Oi(r[0]+o*a,n),c=(0!==s?i[0]+a*s:i)*h*(1-h)/2,u=Li(l),f=Di(l);return v(Pi([255*(h+c*(-.14861*u+1.78277*f)),255*(h+c*(-.29227*u-.90649*f)),255*(h+c*(1.97294*u)),1]))};return a.start=function(t){return null==t?e:(e=t,a)},a.rotations=function(e){return null==e?t:(t=e,a)},a.gamma=function(e){return null==e?n:(n=e,a)},a.hue=function(e){return null==e?i:("array"===Mi(i=e)?0==(s=i[1]-i[0])&&(i=i[1]):s=0,a)},a.lightness=function(e){return null==e?r:("array"===Mi(e)?(r=e,o=e[1]-e[0]):(r=[e,e],o=0),a)},a.scale=function(){return v.scale(a)},a.hue(i),a},Ni="0123456789abcdef",Fi=Math.floor,Bi=Math.random,Ui=function(){for(var e="#",t=0;t<6;t++)e+=Ni.charAt(Fi(16*Bi()));return new g(e,"hex")},ki=Math.log,Vi=Math.pow,Gi=Math.floor,Hi=Math.abs,zi=function(e,t){void 0===t&&(t=null);var i={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===s(e)&&(e=Object.values(e)),e.forEach((function(e){t&&"object"===s(e)&&(e=e[t]),null==e||isNaN(e)||(i.values.push(e),i.sum+=e,ei.max&&(i.max=e),i.count+=1)})),i.domain=[i.min,i.max],i.limits=function(e,t){return Wi(i,e,t)},i},Wi=function(e,t,i){void 0===t&&(t="equal"),void 0===i&&(i=7),"array"==s(e)&&(e=zi(e));var n=e.min,r=e.max,o=e.values.sort((function(e,t){return e-t}));if(1===i)return[n,r];var a=[];if("c"===t.substr(0,1)&&(a.push(n),a.push(r)),"e"===t.substr(0,1)){a.push(n);for(var l=1;l 0");var h=Math.LOG10E*ki(n),c=Math.LOG10E*ki(r);a.push(n);for(var u=1;u200&&(b=!1)}for(var F={},B=0;Bn?(i+.05)/(n+.05):(n+.05)/(i+.05)},Yi=Math.sqrt,Ki=Math.atan2,qi=Math.abs,Zi=Math.cos,Qi=Math.PI,Ji=function(e,t,i,n){void 0===i&&(i=1),void 0===n&&(n=1),e=new g(e),t=new g(t);for(var r=Array.from(e.lab()),o=r[0],s=r[1],a=r[2],l=Array.from(t.lab()),h=l[0],c=l[1],u=l[2],f=Yi(s*s+a*a),d=Yi(c*c+u*u),p=o<16?.511:.040975*o/(1+.01765*o),_=.0638*f/(1+.0131*f)+.638,m=f<1e-6?0:180*Ki(a,s)/Qi;m<0;)m+=360;for(;m>=360;)m-=360;var v=m>=164&&m<=345?.56+qi(.2*Zi(Qi*(m+168)/180)):.36+qi(.4*Zi(Qi*(m+35)/180)),y=f*f*f*f,b=Yi(y/(y+1900)),T=_*(b*v+1-b),A=f-d,E=s-c,C=a-u,x=(o-h)/(i*p),S=A/(n*_);return Yi(x*x+S*S+(E*E+C*C-A*A)/(T*T))},$i=function(e,t,i){void 0===i&&(i="lab"),e=new g(e),t=new g(t);var n=e.get(i),r=t.get(i),o=0;for(var s in n){var a=(n[s]||0)-(r[s]||0);o+=a*a}return Math.sqrt(o)},en=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return new(Function.prototype.bind.apply(g,[null].concat(e))),!0}catch(e){return!1}},tn={cool:function(){return fi([v.hsl(180,1,.9),v.hsl(250,.7,.4)])},hot:function(){return fi(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")}},nn={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},rn=0,on=Object.keys(nn);rn2096103.424&&d!==f))return navigator.msSaveBlob?navigator.msSaveBlob(y(h),p):b(h);l=(h=y(h)).type||a}else if(/([\x80-\xff])/.test(h)){for(var g=0,m=new Uint8Array(h.length),v=m.length;g65536){var e=this[0];return this.forEach((function(t,i,n){t65536){var e=this[0];return this.forEach((function(t,i,n){t>e&&(e=t)})),e}return Math.max.apply(null,this)},t.matrixMax=x,t.matrixMin=S,t.getUniqueVals=R;var M=i(4472),P=i(7398),I=i(3245),O=i(1761),D=i(2644),L=i(6668),w=i(7412),N=i(8233),F=i(788),B=i(9903);t.PLOTTYPES={pointCloud:["coordinates","colorBy","colorVar"],shapeCloud:["coordinates","colorBy","colorVar"],surface:["coordinates","colorBy","colorVar"],heatMap:["coordinates","colorBy","colorVar"],imageStack:["values","indices","attributes"],meshObject:["meshString"],Line:["coordinates","colorBy","colorVar"]},t.isValidPlot=function(e){for(var i=0;i0)if(Array.isArray(n[0]))this._annotationManager.addLabels(n);else for(var r=0;r0&&(this.shapeLegendTitle&&""!==this.shapeLegendTitle&&(o+=100),this._shapeLegendPosition=n?"right":r?"left":i<=t?"right":"left");var c={title:this.shapeLegendTitle,spacing:o,shapes:s},u=!1;for(a=0;a1)for(R=0;Rr?T.addRowDefinition(1/r):T.addRowDefinition(1/s);g.addControl(T,1,0);x=void 0;x="custom"===e.colorScale?_.default.scale(e.customColorScale).mode("lch").colors(s):_.default.scale(_.default.brewer[e.colorScale]).mode("lch").colors(s);for(R=0;R0){var h=r*this.yScale;(c=s.BoxBuilder.CreateBox("box_"+t+"-"+n,{height:h,width:this.xScale*this._size,depth:this.zScale*this._size},this._scene)).position=new o.Vector3(t*this.xScale+.5*this.xScale,h/2,n*this.zScale+.5*this.zScale),(u=new l.StandardMaterial("box_"+t+"-"+n+"_color",this._scene)).alpha=1,u.diffuseColor=o.Color3.FromHexString(this._coordColors[n+t*i.length].substring(0,7)),c.material=u,e.push(c)}else{var c,u;(c=a.PlaneBuilder.CreatePlane("box_"+t+"-"+n,{width:this.xScale*this._size,height:this.zScale*this._size},this._scene)).position=new o.Vector3(t*this.xScale+.5*this.xScale,0,n*this.zScale+.5*this.zScale),c.rotation.x=Math.PI/2,(u=new l.StandardMaterial("box_"+t+"-"+n+"_color",this._scene)).alpha=1,u.diffuseColor=o.Color3.FromHexString(this._coordColors[n+t*i.length].substring(0,7)),u.backFaceCulling=!1,c.material=u,e.push(c)}}this.meshes=e,Object.defineProperty(this,"alpha",{set:function(e){for(var t=0;t0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=0&&ethis.frameDelay&&(this._prevTime=e,0===this.frameIndex?this._containers[this._containers.length-1].removeAllFromScene():this._containers[this.frameIndex-1].removeAllFromScene(),this._containers[this.frameIndex].addAllToScene(),this.frameIndex===this._containers.length-1?this.frameIndex=0:this.frameIndex++)}return!0},t}(l.Plot);t.MeshStream=c},3245:function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PointCloud=void 0;var s=i(6212),a=i(4701),l=i(128),h=i(5328),c=i(5420),u=o(i(5792)),f=function(e){function t(t,i,n,r,o,s,l,h,c,u,f,d,p,_,g){void 0===u&&(u=1),void 0===f&&(f=1),void 0===d&&(d=1),void 0===p&&(p="point cloud"),void 0===_&&(_=!1);var m=e.call(this,p,"point",t,i,n,r,o,u,f,d)||this;if(m._looping=!1,m._animDirection=1,m._animationVectors=[],m._animationCounter=0,m._animationFrames=200,m._animationVectorFract=[],m._animationDelay=100,m._hasAnimation=s,h&&(m._animationDelay=h),c&&(m._animationFrames=c),s)if(l){for(var v=0;v{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Axes=void 0;var n=i(6212),r=i(4627),o=i(4701),s=i(5016),a=i(5328),l=function(){function e(e,t,i){void 0===i&&(i=!1),this._axes=[],this._axisLabels=[],this._ticks=[],this._tickLabels=[],this._tickLines=[],this.axisData=e,this._scene=t,this._createAxes(i)}return e.prototype._roundTicks=function(e,t){if(void 0===t&&(t=2),(""+e).includes("e")){var i=(""+e).split("e"),n="";return+i[1]+t>0&&(n="+"),+(Math.round(parseFloat(+i[0].toString()+"e"+n.toString()+(+i[1].toString()+t.toString())))+"e-"+t)}return+(Math.round(parseFloat(e.toString()+"e+"+t.toString()))+"e-"+t)},e.prototype._createAxes=function(e){void 0===e&&(e=!1),e&&(this.axisData.tickBreaks[0]=1,this.axisData.tickBreaks[2]=1);var t=this.axisData.tickBreaks[0]*this.axisData.scale[0],i=this.axisData.tickBreaks[1]*this.axisData.scale[1],n=this.axisData.tickBreaks[2]*this.axisData.scale[2],s=Math.floor(this.axisData.range[0][0]/t)*t,a=Math.floor(this.axisData.range[1][0]/i)*i,l=Math.floor(this.axisData.range[2][0]/n)*n,h=Math.ceil(this.axisData.range[0][1]/t)*t,c=Math.ceil(this.axisData.range[1][1]/i)*i,u=Math.ceil(this.axisData.range[2][1]/n)*n;if(this.axisData.showAxes[0]){var f=r.LinesBuilder.CreateLines("axisX",{points:[new o.Vector3(s,a,l),new o.Vector3(h,a,l)]},this._scene);f.color=o.Color3.FromHexString(this.axisData.color[0]),f.isPickable=!1,this._axes.push(f);var d=this._makeTextPlane(this.axisData.axisLabels[0],1,this.axisData.color[0]);d.position=new o.Vector3(h/2,a-.5*c,l),d.isPickable=!1,this._axisLabels.push(d);for(var p=[],_=0;_<-Math.ceil(this.axisData.range[0][0]/t);_++)p.push(-(_+1)*t);for(_=0;_<=Math.ceil(this.axisData.range[0][1]/t);_++)p.push(_*t);var g=0;e&&(g=1);for(_=g;_t&&(t=n.length)}this._background.widthInPixels=12*t+6,this._background.heightInPixels=16*e.length+6,this._background.linkWithMesh(this.target),this._background.background=this._bgColor,this._background.alpha=.8,this._background.linkOffsetY=-10,this._textBlock=new l.TextBlock,this._textBlock.text=this._text,this._textBlock.fontSize=12,this._textBlock.color=this._txtColor,this._background.addControl(this._textBlock),this._closeBtn=l.Button.CreateSimpleButton("close","x"),this._background.addControl(this._closeBtn),this._closeBtn.topInPixels=-this._background.heightInPixels/2+10,this._closeBtn.leftInPixels=this._background.widthInPixels/2-10,this._closeBtn.widthInPixels=20,this._closeBtn.heightInPixels=20,this._closeBtn.fontSize=10,this._closeBtn.background=this._txtColor,this._closeBtn.color=this._bgColor,this._closeBtn.onPointerClickObservable.add(function(){this.dispose()}.bind(this))},e.prototype.dispose=function(){this._textBlock&&(this._textBlock.dispose(),this._textBlock=void 0),this._background&&(this._background.dispose(),this._background=void 0),this._closeBtn&&(this._closeBtn.dispose(),this._closeBtn=void 0),this.disposed=!0},e}(),p=function(){function e(e,t,i,n,r){this.size=100,this.color="black",this.fixed=!1,void 0!==r&&(this.size=r);var s=o.PlaneBuilder.CreatePlane("label",{width:.05*this.size,height:.05*this.size},i);void 0!==n&&(this.color=n),s.position=t;var h=a.AdvancedDynamicTexture.CreateForMesh(s),c=new l.Rectangle;c.color="red",c.alpha=0,h.addControl(c),this._background=c;var u=new l.TextBlock;u.text=e,u.color=this.color,u.fontSize=this.size,h.addControl(u),this._text=u,this.fixed||g(s),this._label=s}return e.prototype.setText=function(e){this._text.text=e},e.prototype.update=function(e,t){var i=r.Vector3.Cross(e.position,r.Axis.Y),n=r.Vector3.Cross(i,e.position),o=r.Vector3.Cross(i,n);if(this._label.rotation=r.Vector3.RotationFromAxis(i,n,o),!this.fixed){var s=t.meshUnderPointer;this._label===s?this._background.alpha=1:this._background.alpha=0}},e.prototype.fix=function(){this._label.removeBehavior(this._label.getBehaviorByName("PointerDrag")),this.fixed=!0},e.prototype.unfix=function(){g(this._label),this.fixed=!1},e.prototype.dispose=function(){this._text.dispose(),this._background.dispose(),this._label.dispose()},e.prototype.export=function(){return[this._label.position.x,this._label.position.y,this._label.position.z,this._text.text]},e}(),_=function(){function e(e,t,i,n,r,o,s){this._editLabelForms=[],this._showLabels=!1,this._arrows=[],this._showArrows=!1,this.dpInfos=[],this.labels=[],this.fixedLabels=!1,this.fixedArrows=!1,this._canvas=e,this._scene=t,this._ymax=i,this._camera=n,this._bgColor=r,this._fgColor="white",this._fullScreenUI=o,this._uniqID=s,u.default(r).luminance()>.5&&(this._fgColor="black"),this._createLabelForms()}return e.prototype._createLabelForms=function(){var e=document.createElement("div");e.id="labelControl_"+this._uniqID,e.className="bbp label-control",e.style.display="none",e.style.top=this._canvas.clientTop+40+"px",e.style.left=this._canvas.clientTop+5+"px";var t=document.createElement("div");t.className="label-form";var i=document.createElement("label");i.innerText="Label Text:",i.htmlFor="addLabelInput";var n=document.createElement("input");n.name="addLabelInput",n.type="text",this._addLabelTextInput=n;var r=document.createElement("button");r.innerText="Add Label",r.onclick=this._addLabelBtnClick.bind(this),t.appendChild(i),t.appendChild(n),t.appendChild(r),e.appendChild(t);var o=document.createElement("div");o.className="edit-container",o.style.maxHeight=(this._canvas.height-100).toString()+"px",e.appendChild(o),this._editLabelContainer=o,this._labelControlBox=e,this._canvas.parentNode.appendChild(e)},e.prototype.update=function(){if(this._showArrows,this._showLabels)for(var e=0;e=0;e--){var t=this.dpInfos[e];t.disposed?this.dpInfos.splice(e,1):(t.dispose(),t.draw())}},e.prototype.displayInfo=function(e,t){for(var i=!1,n=0;nn){var i=parseInt(e.dataset.labelnum),r=(i-1).toString();e.dataset.labelnum=r,e.querySelector('input[data-labelnum="'+i+'"]').dataset.labelnum=r,e.querySelector('button[data-labelnum="'+i+'"]').dataset.labelnum=r}})),t.parentNode.removeChild(t)},e.prototype.exportLabels=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.legendSVGs=t.buttonSVGs=void 0,t.buttonSVGs={logo:'',toJson:'',labels:'',publish:'',replay:'',loop:'',record:'',play:'',pause:'',loading:'',turntable:''},t.legendSVGs={heatmap:'',point:'',surface:'',shape_box:'',shape_cone:'',shape_cylinder:'',shape_sphere:'',shape_torus:''}},8043:(e,t)=>{"use strict";function i(e){console.log("%c"+e,"color:orange;")}Object.defineProperty(t,"__esModule",{value:!0}),t.deprecationWarning=t.warn=void 0,t.warn=i,t.deprecationWarning=function(e,t){i(t?'The use of "'+e+'" is deprecated and might be removed in a future version. Please use "'+t+'" instead.':'The use of "'+e+'" is deprecated and might be removed in a future version.')}},788:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.styleText=void 0,t.styleText=[".bbp.button-bar { position: absolute; z-index: 2; overflow: hidden; padding: 0 10px 4px 0; }",".bbp.button-bar>.button.hidden { display: none; }",".bbp.button-bar>.anim-slider { display: block; float: right; width: 150px; height: 30px }",".bbp.button-bar>.anim-slider.hidden { display: none; }",".bbp.button-bar>.button { float: right; width: 75px; height: 30px; cursor: pointer; border-radius: 2px; background-color: #f0f0f0; margin: 0 4px 0 0; }",".bbp.button-bar>.button:hover { background-color: #ddd; }",".bbp.button-bar>.button>svg { width: 75px; height: 30px; }",".bbp.button-bar>.button.active { background-color: #afafaf; }",".bbp.button-bar>.button.active:hover { background-color: #9f9f9f; }",".bbp.button-bar>.button.streamctrl.loading { cursor: progress; }",".bbp.button-bar>.button.streamctrl.loading:hover { background-color: #f0f0f0; }",".bbp.button-bar>.button.streamctrl.loading>.btn-label.play,.bbp.button-bar>.button.streamctrl.loading>.btn-label.pause {display: none; }",".bbp.button-bar>.button.streamctrl.loading>.btn-label.loading {display: block; }",".bbp.button-bar>.button.streamctrl.play>.btn-label.pause,.bbp.button-bar>.button.streamctrl.play>.btn-label.loading {display: none; }",".bbp.button-bar>.button.streamctrl.play>.btn-label.play {display: block; }",".bbp.button-bar>.button.streamctrl.pause>.btn-label.play,.bbp.button-bar>.button.streamctrl.pause>.btn-label.loading {display: none; }",".bbp.button-bar>.button.streamctrl.pause>.btn-label.pause {display: block; }",".bbp.label-control { position: absolute; z-index: 3; font-family: sans-serif; width: 200px; background-color: #f0f0f0; padding: 5px; border-radius: 2px; }",".bbp.label-control>label { font-size: 11pt; }",".bbp.label-control>.edit-container { overflow: auto; }",".bbp.label-control>.edit-container>.label-form { margin-top: 5px; padding-top: 20px; border-top: solid thin #ccc; }",".bbp.label-control .label-form>input { width: 100%; box-sizing: border-box; }",".bbp.label-control .label-form>button { border: none; font-weight: bold; background-color: white; padding: 5px 10px; margin: 5px 0 2px 0; width: 100%; cursor: pointer; }",".bbp.label-control .label-form>button:hover { background-color: #ddd; }",".bbp.overlay { position: absolute; z-index: 3; overflow: hidden; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; background-color: #fff5; display: flex; justify-content: center; align-items: center;}",".bbp.overlay>h5.loading-message { color: #000; font-family: Verdana, sans-serif;}",".bbp.publish-form>label { display: block; text-align: left; font-family: Verdana, sans-serif; }",".bbp.publish-form>input { width: 100%; margin-bottom: 15px; box-sizing: border-box; }",".bbp.publish-form>.publish-btn { border: none; font-weight: bold; background-color: #e95420; color: white; padding: 5px 10px; margin: 5px 0 2px 0; width: 100%; cursor: pointer; }",".bbp.publish-form>.publish-btn:hover { background-color: #ca491a }",".bbp.publish-form>.close-btn, .bbp.publish-form>.cancel-btn { border: none; font-weight: bold; background-color: white; padding: 5px 10px; margin: 5px 0 2px 0; width: 100%; cursor: pointer; }",".bbp.publish-form>.close-btn:hover, .bbp.publish-form>.cancel-btn:hover { background-color: #ddd }",".bbp.publish-form>p.form-info { font-size: 8pt; font-family: Verdana, sans-serif; }",".bbp.publish-form>p.message { font-size: 10pt; font-family: Verdana, sans-serif; }",".bbp.publish-form>p.message.warning { color: red; margin-top: 0px; }",".bbp.publish-form>p.message.success { color: green; }"].join(" ")},655:(e,t,i)=>{"use strict";i.d(t,{ZT:()=>r,pi:()=>o,gn:()=>s,pr:()=>a});var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)};function r(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var o=function(){return(o=Object.assign||function(e){for(var t,i=1,n=arguments.length;i=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s}Object.create;function a(){for(var e=0,t=0,i=arguments.length;t{"use strict";i.r(t),i.d(t,{NIL:()=>I,parse:()=>g,stringify:()=>c,v1:()=>_,v3:()=>x,v4:()=>S,v5:()=>P,validate:()=>a,version:()=>O});var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),r=new Uint8Array(16);function o(){if(!n)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(r)}const s=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const a=function(e){return"string"==typeof e&&s.test(e)};for(var l=[],h=0;h<256;++h)l.push((h+256).toString(16).substr(1));const c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase();if(!a(i))throw TypeError("Stringified UUID is invalid");return i};var u,f,d=0,p=0;const _=function(e,t,i){var n=t&&i||0,r=t||new Array(16),s=(e=e||{}).node||u,a=void 0!==e.clockseq?e.clockseq:f;if(null==s||null==a){var l=e.random||(e.rng||o)();null==s&&(s=u=[1|l[0],l[1],l[2],l[3],l[4],l[5]]),null==a&&(a=f=16383&(l[6]<<8|l[7]))}var h=void 0!==e.msecs?e.msecs:Date.now(),_=void 0!==e.nsecs?e.nsecs:p+1,g=h-d+(_-p)/1e4;if(g<0&&void 0===e.clockseq&&(a=a+1&16383),(g<0||h>d)&&void 0===e.nsecs&&(_=0),_>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");d=h,p=_,f=a;var m=(1e4*(268435455&(h+=122192928e5))+_)%4294967296;r[n++]=m>>>24&255,r[n++]=m>>>16&255,r[n++]=m>>>8&255,r[n++]=255&m;var v=h/4294967296*1e4&268435455;r[n++]=v>>>8&255,r[n++]=255&v,r[n++]=v>>>24&15|16,r[n++]=v>>>16&255,r[n++]=a>>>8|128,r[n++]=255&a;for(var y=0;y<6;++y)r[n+y]=s[y];return t||c(r)};const g=function(e){if(!a(e))throw TypeError("Invalid UUID");var t,i=new Uint8Array(16);return i[0]=(t=parseInt(e.slice(0,8),16))>>>24,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i[4]=(t=parseInt(e.slice(9,13),16))>>>8,i[5]=255&t,i[6]=(t=parseInt(e.slice(14,18),16))>>>8,i[7]=255&t,i[8]=(t=parseInt(e.slice(19,23),16))>>>8,i[9]=255&t,i[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,i[11]=t/4294967296&255,i[12]=t>>>24&255,i[13]=t>>>16&255,i[14]=t>>>8&255,i[15]=255&t,i};function m(e,t,i){function n(e,n,r,o){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],i=0;i>>9<<4)+1}function y(e,t){var i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}function b(e,t,i,n,r,o){return y((s=y(y(t,e),y(n,o)))<<(a=r)|s>>>32-a,i);var s,a}function T(e,t,i,n,r,o,s){return b(t&i|~t&n,e,t,r,o,s)}function A(e,t,i,n,r,o,s){return b(t&n|i&~n,e,t,r,o,s)}function E(e,t,i,n,r,o,s){return b(t^i^n,e,t,r,o,s)}function C(e,t,i,n,r,o,s){return b(i^(t|~n),e,t,r,o,s)}const x=m("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var i=0;i>5]>>>r%32&255,s=parseInt(n.charAt(o>>>4&15)+n.charAt(15&o),16);t.push(s)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[n/8])<>>32-t}const P=m("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var r=0;r>>0;y=v,v=m,m=M(g,30)>>>0,g=_,_=A}i[0]=i[0]+_>>>0,i[1]=i[1]+g>>>0,i[2]=i[2]+m>>>0,i[3]=i[3]+v>>>0,i[4]=i[4]+y>>>0}return[i[0]>>24&255,i[0]>>16&255,i[0]>>8&255,255&i[0],i[1]>>24&255,i[1]>>16&255,i[1]>>8&255,255&i[1],i[2]>>24&255,i[2]>>16&255,i[2]>>8&255,255&i[2],i[3]>>24&255,i[3]>>16&255,i[3]>>8&255,255&i[3],i[4]>>24&255,i[4]>>16&255,i[4]>>8&255,255&i[4]]})),I="00000000-0000-0000-0000-000000000000";const O=function(e){if(!a(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=i(5420);Baby=n})(); +var Baby;(()=>{var e={4635:(e,t,i)=>{"use strict";i.d(t,{f:()=>d});var n=i(2973),r=i(8362),o=i(9018),s=i(9023),a=i(6132),l=i(5569),h=i(2117),c=i(2686),u=i(488),f=i(2840),d=function(){function e(t,i,n,r,o,s){this.name=t,this.targetProperty=i,this.framePerSecond=n,this.dataType=r,this.loopMode=o,this.enableBlending=s,this._runtimeAnimations=new Array,this._events=new Array,this.blendingSpeed=.01,this._ranges={},this.targetPropertyPath=i.split("."),this.dataType=r,this.loopMode=void 0===o?e.ANIMATIONLOOPMODE_CYCLE:o}return e._PrepareAnimation=function(t,i,o,s,a,l,h,c){var f=void 0;if(!isNaN(parseFloat(a))&&isFinite(a)?f=e.ANIMATIONTYPE_FLOAT:a instanceof n._f?f=e.ANIMATIONTYPE_QUATERNION:a instanceof n.P?f=e.ANIMATIONTYPE_VECTOR3:a instanceof n.FM?f=e.ANIMATIONTYPE_VECTOR2:a instanceof r.Wo?f=e.ANIMATIONTYPE_COLOR3:a instanceof r.HE?f=e.ANIMATIONTYPE_COLOR4:a instanceof u.$&&(f=e.ANIMATIONTYPE_SIZE),null==f)return null;var d=new e(t,i,o,f,h),p=[{frame:0,value:a},{frame:s,value:l}];return d.setKeys(p),void 0!==c&&d.setEasingFunction(c),d},e.CreateAnimation=function(t,i,n,r){var o=new e(t+"Animation",t,n,i,e.ANIMATIONLOOPMODE_CONSTANT);return o.setEasingFunction(r),o},e.CreateAndStartAnimation=function(t,i,n,r,o,s,a,l,h,c){var u=e._PrepareAnimation(t,n,r,o,s,a,l,h);return u?i.getScene().beginDirectAnimation(i,[u],0,o,1===u.loopMode,1,c):null},e.CreateAndStartHierarchyAnimation=function(t,i,n,r,o,s,a,l,h,c,u){var f=e._PrepareAnimation(t,r,o,s,a,l,h,c);return f?i.getScene().beginDirectHierarchyAnimation(i,n,[f],0,s,1===f.loopMode,1,u):null},e.CreateMergeAndStartAnimation=function(t,i,n,r,o,s,a,l,h,c){var u=e._PrepareAnimation(t,n,r,o,s,a,l,h);return u?(i.animations.push(u),i.getScene().beginAnimation(i,0,o,1===u.loopMode,1,c)):null},e.MakeAnimationAdditive=function(t,i,r,o,s){void 0===i&&(i=0),void 0===o&&(o=!1);var a=t;if(o&&((a=t.clone()).name=s||a.name),!a._keys.length)return a;i=i>=0?i:0;var l=0,h=a._keys[0],c=a._keys.length-1,u=a._keys[c],f={referenceValue:h.value,referencePosition:n.jp.Vector3[0],referenceQuaternion:n.jp.Quaternion[0],referenceScaling:n.jp.Vector3[1],keyPosition:n.jp.Vector3[2],keyQuaternion:n.jp.Quaternion[1],keyScaling:n.jp.Vector3[3]},d=!1,p=h.frame,_=u.frame;if(r){var g=a.getRange(r);g&&(p=g.from,_=g.to)}var m=h.frame===p,v=u.frame===_;if(1===a._keys.length){var y=a._getKeyValue(a._keys[0]);f.referenceValue=y.clone?y.clone():y,d=!0}else if(i<=h.frame){y=a._getKeyValue(h.value);f.referenceValue=y.clone?y.clone():y,d=!0}else if(i>=u.frame){y=a._getKeyValue(u.value);f.referenceValue=y.clone?y.clone():y,d=!0}for(var b=0;!d||!m||!v&&b=T.frame&&i<=A.frame){y=void 0;if(i===T.frame)y=a._getKeyValue(T.value);else if(i===A.frame)y=a._getKeyValue(A.value);else{var E={key:b,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT};y=a._interpolate(i,E)}f.referenceValue=y.clone?y.clone():y,d=!0}if(!m&&p>=T.frame&&p<=A.frame){if(p===T.frame)l=b;else if(p===A.frame)l=b+1;else{E={key:b,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT};var C={frame:p,value:(y=a._interpolate(p,E)).clone?y.clone():y};a._keys.splice(b+1,0,C),l=b+1}m=!0}if(!v&&_>=T.frame&&_<=A.frame){if(_===T.frame)c=b;else if(_===A.frame)c=b+1;else{E={key:b,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT},C={frame:_,value:(y=a._interpolate(_,E)).clone?y.clone():y};a._keys.splice(b+1,0,C),c=b+1}v=!0}b++}a.dataType===e.ANIMATIONTYPE_QUATERNION?f.referenceValue.normalize().conjugateInPlace():a.dataType===e.ANIMATIONTYPE_MATRIX&&(f.referenceValue.decompose(f.referenceScaling,f.referenceQuaternion,f.referencePosition),f.referenceQuaternion.normalize().conjugateInPlace());for(b=l;b<=c;b++){C=a._keys[b];if(!b||a.dataType===e.ANIMATIONTYPE_FLOAT||C.value!==h.value)switch(a.dataType){case e.ANIMATIONTYPE_MATRIX:C.value.decompose(f.keyScaling,f.keyQuaternion,f.keyPosition),f.keyPosition.subtractInPlace(f.referencePosition),f.keyScaling.divideInPlace(f.referenceScaling),f.referenceQuaternion.multiplyToRef(f.keyQuaternion,f.keyQuaternion),n.y3.ComposeToRef(f.keyScaling,f.keyQuaternion,f.keyPosition,C.value);break;case e.ANIMATIONTYPE_QUATERNION:f.referenceValue.multiplyToRef(C.value,C.value);break;case e.ANIMATIONTYPE_VECTOR2:case e.ANIMATIONTYPE_VECTOR3:case e.ANIMATIONTYPE_COLOR3:case e.ANIMATIONTYPE_COLOR4:C.value.subtractToRef(f.referenceValue,C.value);break;case e.ANIMATIONTYPE_SIZE:C.value.width-=f.referenceValue.width,C.value.height-=f.referenceValue.height;break;default:C.value-=f.referenceValue}}return a},e.TransitionTo=function(e,t,i,n,r,o,s,a){if(void 0===a&&(a=null),s<=0)return i[e]=t,a&&a(),null;var l=r*(s/1e3);o.setKeys([{frame:0,value:i[e].clone?i[e].clone():i[e]},{frame:l,value:t}]),i.animations||(i.animations=[]),i.animations.push(o);var h=n.beginAnimation(i,0,l,!1);return h.onAnimationEnd=a,h},Object.defineProperty(e.prototype,"runtimeAnimations",{get:function(){return this._runtimeAnimations},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRunningRuntimeAnimations",{get:function(){for(var e=0,t=this._runtimeAnimations;e=0;o--)this._keys[o].frame>=n&&this._keys[o].frame<=r&&this._keys.splice(o,1);this._ranges[e]=null}},e.prototype.getRange=function(e){return this._ranges[e]},e.prototype.getKeys=function(){return this._keys},e.prototype.getHighestFrame=function(){for(var e=0,t=0,i=this._keys.length;t0)return i.highLimitValue.clone?i.highLimitValue.clone():i.highLimitValue;var n=this._keys;if(1===n.length)return this._getKeyValue(n[0].value);var r=i.key;if(n[r].frame>=t)for(;r-1>=0&&n[r].frame>=t;)r--;for(var o=r;o=t){i.key=o;var a=n[o],h=this._getKeyValue(a.value);if(a.interpolation===l.N.STEP)return h;var c=this._getKeyValue(s.value),u=void 0!==a.outTangent&&void 0!==s.inTangent,f=s.frame-a.frame,d=(t-a.frame)/f,p=this.getEasingFunction();switch(null!=p&&(d=p.ease(d)),this.dataType){case e.ANIMATIONTYPE_FLOAT:var _=u?this.floatInterpolateFunctionWithTangents(h,a.outTangent*f,c,s.inTangent*f,d):this.floatInterpolateFunction(h,c,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return _;case e.ANIMATIONLOOPMODE_RELATIVE:return i.offsetValue*i.repeatCount+_}break;case e.ANIMATIONTYPE_QUATERNION:var g=u?this.quaternionInterpolateFunctionWithTangents(h,a.outTangent.scale(f),c,s.inTangent.scale(f),d):this.quaternionInterpolateFunction(h,c,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return g;case e.ANIMATIONLOOPMODE_RELATIVE:return g.addInPlace(i.offsetValue.scale(i.repeatCount))}return g;case e.ANIMATIONTYPE_VECTOR3:var m=u?this.vector3InterpolateFunctionWithTangents(h,a.outTangent.scale(f),c,s.inTangent.scale(f),d):this.vector3InterpolateFunction(h,c,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return m;case e.ANIMATIONLOOPMODE_RELATIVE:return m.add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_VECTOR2:var v=u?this.vector2InterpolateFunctionWithTangents(h,a.outTangent.scale(f),c,s.inTangent.scale(f),d):this.vector2InterpolateFunction(h,c,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return v;case e.ANIMATIONLOOPMODE_RELATIVE:return v.add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_SIZE:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return this.sizeInterpolateFunction(h,c,d);case e.ANIMATIONLOOPMODE_RELATIVE:return this.sizeInterpolateFunction(h,c,d).add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_COLOR3:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return this.color3InterpolateFunction(h,c,d);case e.ANIMATIONLOOPMODE_RELATIVE:return this.color3InterpolateFunction(h,c,d).add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_COLOR4:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return this.color4InterpolateFunction(h,c,d);case e.ANIMATIONLOOPMODE_RELATIVE:return this.color4InterpolateFunction(h,c,d).add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_MATRIX:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:if(e.AllowMatricesInterpolation)return this.matrixInterpolateFunction(h,c,d,i.workValue);case e.ANIMATIONLOOPMODE_RELATIVE:return h}}break}}return this._getKeyValue(n[n.length-1].value)},e.prototype.matrixInterpolateFunction=function(t,i,r,o){return e.AllowMatrixDecomposeForInterpolation?o?(n.y3.DecomposeLerpToRef(t,i,r,o),o):n.y3.DecomposeLerp(t,i,r):o?(n.y3.LerpToRef(t,i,r,o),o):n.y3.Lerp(t,i,r)},e.prototype.clone=function(){var t=new e(this.name,this.targetPropertyPath.join("."),this.framePerSecond,this.dataType,this.loopMode);if(t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed,this._keys&&t.setKeys(this._keys),this._ranges)for(var i in t._ranges={},this._ranges){var n=this._ranges[i];n&&(t._ranges[i]=n.clone())}return t},e.prototype.setKeys=function(e){this._keys=e.slice(0)},e.prototype.serialize=function(){var t={};t.name=this.name,t.property=this.targetProperty,t.framePerSecond=this.framePerSecond,t.dataType=this.dataType,t.loopBehavior=this.loopMode,t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed;var i=this.dataType;t.keys=[];for(var n=this.getKeys(),r=0;r=1&&(h=u.values[1]),u.values.length>=2&&(c=u.values[2]);break;case e.ANIMATIONTYPE_QUATERNION:if(i=n._f.FromArray(u.values),u.values.length>=8){var f=n._f.FromArray(u.values.slice(4,8));f.equals(n._f.Zero())||(h=f)}if(u.values.length>=12){var d=n._f.FromArray(u.values.slice(8,12));d.equals(n._f.Zero())||(c=d)}break;case e.ANIMATIONTYPE_MATRIX:i=n.y3.FromArray(u.values);break;case e.ANIMATIONTYPE_COLOR3:i=r.Wo.FromArray(u.values);break;case e.ANIMATIONTYPE_COLOR4:i=r.HE.FromArray(u.values);break;case e.ANIMATIONTYPE_VECTOR3:default:i=n.P.FromArray(u.values)}var p={};p.frame=u.frame,p.value=i,null!=h&&(p.inTangent=h),null!=c&&(p.outTangent=c),l.push(p)}if(s.setKeys(l),t.ranges)for(o=0;o{"use strict";var n;i.d(t,{N:()=>n}),function(e){e[e.STEP=1]="STEP"}(n||(n={}))},2117:(e,t,i)=>{"use strict";i.d(t,{X:()=>n});var n=function(){function e(e,t,i){this.name=e,this.from=t,this.to=i}return e.prototype.clone=function(){return new e(this.name,this.from,this.to)},e}()},5850:(e,t,i)=>{"use strict";i.r(t),i.d(t,{PointerDragBehavior:()=>p});var n=i(6212),r=i(4391),o=i(475),s=i(2973),a=i(5441),l=i(8035),h=i(9626),c=i(746),u=i(7659),f=function(){function e(e,t,i){void 0===i&&(i=Number.MAX_VALUE),this.origin=e,this.direction=t,this.length=i}return e.prototype.intersectsBoxMinMax=function(t,i,n){void 0===n&&(n=0);var r,o,s,a,l=e._TmpVector3[0].copyFromFloats(t.x-n,t.y-n,t.z-n),h=e._TmpVector3[1].copyFromFloats(i.x+n,i.y+n,i.z+n),c=0,u=Number.MAX_VALUE;if(Math.abs(this.direction.x)<1e-7){if(this.origin.xh.x)return!1}else if(r=1/this.direction.x,o=(l.x-this.origin.x)*r,(s=(h.x-this.origin.x)*r)===-1/0&&(s=1/0),o>s&&(a=o,o=s,s=a),(c=Math.max(o,c))>(u=Math.min(s,u)))return!1;if(Math.abs(this.direction.y)<1e-7){if(this.origin.yh.y)return!1}else if(r=1/this.direction.y,o=(l.y-this.origin.y)*r,(s=(h.y-this.origin.y)*r)===-1/0&&(s=1/0),o>s&&(a=o,o=s,s=a),(c=Math.max(o,c))>(u=Math.min(s,u)))return!1;if(Math.abs(this.direction.z)<1e-7){if(this.origin.zh.z)return!1}else if(r=1/this.direction.z,o=(l.z-this.origin.z)*r,(s=(h.z-this.origin.z)*r)===-1/0&&(s=1/0),o>s&&(a=o,o=s,s=a),(c=Math.max(o,c))>(u=Math.min(s,u)))return!1;return!0},e.prototype.intersectsBox=function(e,t){return void 0===t&&(t=0),this.intersectsBoxMinMax(e.minimum,e.maximum,t)},e.prototype.intersectsSphere=function(e,t){void 0===t&&(t=0);var i=e.center.x-this.origin.x,n=e.center.y-this.origin.y,r=e.center.z-this.origin.z,o=i*i+n*n+r*r,s=e.radius+t,a=s*s;if(o<=a)return!0;var l=i*this.direction.x+n*this.direction.y+r*this.direction.z;return!(l<0)&&o-l*l<=a},e.prototype.intersectsTriangle=function(t,i,n){var r=e._TmpVector3[0],o=e._TmpVector3[1],a=e._TmpVector3[2],l=e._TmpVector3[3],h=e._TmpVector3[4];i.subtractToRef(t,r),n.subtractToRef(t,o),s.P.CrossToRef(this.direction,o,a);var u=s.P.Dot(r,a);if(0===u)return null;var f=1/u;this.origin.subtractToRef(t,l);var d=s.P.Dot(l,a)*f;if(d<0||d>1)return null;s.P.CrossToRef(l,r,h);var p=s.P.Dot(this.direction,h)*f;if(p<0||d+p>1)return null;var _=s.P.Dot(o,h)*f;return _>this.length?null:new c.c(1-d-p,d,_)},e.prototype.intersectsPlane=function(e){var t,i=s.P.Dot(e.normal,this.direction);if(Math.abs(i)<9.99999997475243e-7)return null;var n=s.P.Dot(e.normal,this.origin);return(t=(-e.d-n)/i)<0?t<-9.99999997475243e-7?null:0:t},e.prototype.intersectsAxis=function(e,t){switch(void 0===t&&(t=0),e){case"y":return(i=(this.origin.y-t)/this.direction.y)>0?null:new s.P(this.origin.x+this.direction.x*-i,t,this.origin.z+this.direction.z*-i);case"x":return(i=(this.origin.x-t)/this.direction.x)>0?null:new s.P(t,this.origin.y+this.direction.y*-i,this.origin.z+this.direction.z*-i);case"z":var i;return(i=(this.origin.z-t)/this.direction.z)>0?null:new s.P(this.origin.x+this.direction.x*-i,this.origin.y+this.direction.y*-i,t);default:return null}},e.prototype.intersectsMesh=function(t,i){var n=s.jp.Matrix[0];return t.getWorldMatrix().invertToRef(n),this._tmpRay?e.TransformToRef(this,n,this._tmpRay):this._tmpRay=e.Transform(this,n),t.intersects(this._tmpRay,i)},e.prototype.intersectsMeshes=function(e,t,i){i?i.length=0:i=[];for(var n=0;nt.distance?1:0},e.prototype.intersectionSegment=function(t,i,n){var r=this.origin,o=s.jp.Vector3[0],a=s.jp.Vector3[1],l=s.jp.Vector3[2],h=s.jp.Vector3[3];i.subtractToRef(t,o),this.direction.scaleToRef(e.rayl,l),r.addToRef(l,a),t.subtractToRef(r,h);var c,u,f,d,p=s.P.Dot(o,o),_=s.P.Dot(o,l),g=s.P.Dot(l,l),m=s.P.Dot(o,h),v=s.P.Dot(l,h),y=p*g-_*_,b=y,T=y;yb&&(u=b,d=v+_,T=g)),d<0?(d=0,-m<0?u=0:-m>p?u=b:(u=-m,b=p)):d>T&&(d=T,-m+_<0?u=0:-m+_>p?u=b:(u=-m+_,b=p)),c=Math.abs(u)0&&f<=this.length&&C.lengthSquared()=e.distance?null:h:null},r.Scene.prototype._internalPick=function(e,t,i,n,r){if(!h.p)return null;for(var o=null,a=0;a1)throw"Multiple drag modes specified in dragBehavior options. Only one expected"}return Object.defineProperty(e.prototype,"options",{get:function(){return this._options},set:function(e){this._options=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return"PointerDrag"},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(t,i){var o=this;this._scene=t.getScene(),this.attachedNode=t,e._planeScene||(this._debugMode?e._planeScene=this._scene:(e._planeScene=new r.Scene(this._scene.getEngine(),{virtual:!0}),e._planeScene.detachControl(),this._scene.onDisposeObservable.addOnce((function(){e._planeScene.dispose(),e._planeScene=null})))),this._dragPlane=n.Mesh.CreatePlane("pointerDragPlane",this._debugMode?1:1e4,e._planeScene,!1,n.Mesh.DOUBLESIDE),this.lastDragPosition=new s.P(0,0,0);var l=i||function(e){return o.attachedNode==e||e.isDescendantOf(o.attachedNode)};this._pointerObserver=this._scene.onPointerObservable.add((function(t,i){if(o.enabled)if(t.type==a.kD.POINTERDOWN)o.startAndReleaseDragOnPointerEvents&&!o.dragging&&t.pickInfo&&t.pickInfo.hit&&t.pickInfo.pickedMesh&&t.pickInfo.pickedPoint&&t.pickInfo.ray&&l(t.pickInfo.pickedMesh)&&o._startDrag(t.event.pointerId,t.pickInfo.ray,t.pickInfo.pickedPoint);else if(t.type==a.kD.POINTERUP)o.startAndReleaseDragOnPointerEvents&&o.currentDraggingPointerID==t.event.pointerId&&o.releaseDrag();else if(t.type==a.kD.POINTERMOVE){var n=t.event.pointerId;if(o.currentDraggingPointerID===e._AnyMouseID&&n!==e._AnyMouseID){var r=t.event;("mouse"===r.pointerType||!o._scene.getEngine().hostInformation.isMobile&&r instanceof MouseEvent)&&(o._lastPointerRay[o.currentDraggingPointerID]&&(o._lastPointerRay[n]=o._lastPointerRay[o.currentDraggingPointerID],delete o._lastPointerRay[o.currentDraggingPointerID]),o.currentDraggingPointerID=n)}o._lastPointerRay[n]||(o._lastPointerRay[n]=new f(new s.P,new s.P)),t.pickInfo&&t.pickInfo.ray&&(o._lastPointerRay[n].origin.copyFrom(t.pickInfo.ray.origin),o._lastPointerRay[n].direction.copyFrom(t.pickInfo.ray.direction),o.currentDraggingPointerID==n&&o.dragging&&o._moveDrag(t.pickInfo.ray))}})),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add((function(){o._moving&&o.moveAttached&&(d._RemoveAndStorePivotPoint(o.attachedNode),o._targetPosition.subtractToRef(o.attachedNode.absolutePosition,o._tmpVector),o._tmpVector.scaleInPlace(o.dragDeltaRatio),o.attachedNode.getAbsolutePosition().addToRef(o._tmpVector,o._tmpVector),o.validateDrag(o._tmpVector)&&o.attachedNode.setAbsolutePosition(o._tmpVector),d._RestorePivotPoint(o.attachedNode))}))},e.prototype.releaseDrag=function(){if(this.dragging&&(this.dragging=!1,this.onDragEndObservable.notifyObservers({dragPlanePoint:this.lastDragPosition,pointerId:this.currentDraggingPointerID})),this.currentDraggingPointerID=-1,this._moving=!1,this.detachCameraControls&&this._attachedToElement&&this._scene.activeCamera&&!this._scene.activeCamera.leftCamera){if("ArcRotateCamera"===this._scene.activeCamera.getClassName()){var e=this._scene.activeCamera;e.attachControl(!e.inputs||e.inputs.noPreventDefault,e._useCtrlForPanning,e._panningMouseButton)}else this._scene.activeCamera.attachControl(!this._scene.activeCamera.inputs||this._scene.activeCamera.inputs.noPreventDefault);this._attachedToElement=!1}},e.prototype.startDrag=function(t,i,n){void 0===t&&(t=e._AnyMouseID),this._startDrag(t,i,n);var r=this._lastPointerRay[t];t===e._AnyMouseID&&(r=this._lastPointerRay[Object.keys(this._lastPointerRay)[0]]),r&&this._moveDrag(r)},e.prototype._startDrag=function(e,t,i){if(this._scene.activeCamera&&!this.dragging&&this.attachedNode){d._RemoveAndStorePivotPoint(this.attachedNode),t?(this._startDragRay.direction.copyFrom(t.direction),this._startDragRay.origin.copyFrom(t.origin)):(this._startDragRay.origin.copyFrom(this._scene.activeCamera.position),this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector),this._tmpVector.subtractToRef(this._scene.activeCamera.position,this._startDragRay.direction)),this._updateDragPlanePosition(this._startDragRay,i||this._tmpVector);var n=this._pickWithRayOnDragPlane(this._startDragRay);n&&(this.dragging=!0,this.currentDraggingPointerID=e,this.lastDragPosition.copyFrom(n),this.onDragStartObservable.notifyObservers({dragPlanePoint:n,pointerId:this.currentDraggingPointerID}),this._targetPosition.copyFrom(this.attachedNode.absolutePosition),this.detachCameraControls&&this._scene.activeCamera&&this._scene.activeCamera.inputs&&!this._scene.activeCamera.leftCamera&&(this._scene.activeCamera.inputs.attachedToElement?(this._scene.activeCamera.detachControl(),this._attachedToElement=!0):this._attachedToElement=!1)),d._RestorePivotPoint(this.attachedNode)}},e.prototype._moveDrag=function(e){this._moving=!0;var t=this._pickWithRayOnDragPlane(e);if(t){this.updateDragPlane&&this._updateDragPlanePosition(e,t);var i=0;this._options.dragAxis?(this.useObjectOrientationForDragging?s.P.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._worldDragAxis):this._worldDragAxis.copyFrom(this._options.dragAxis),t.subtractToRef(this.lastDragPosition,this._tmpVector),i=s.P.Dot(this._tmpVector,this._worldDragAxis),this._worldDragAxis.scaleToRef(i,this._dragDelta)):(i=this._dragDelta.length(),t.subtractToRef(this.lastDragPosition,this._dragDelta)),this._targetPosition.addInPlace(this._dragDelta),this.onDragObservable.notifyObservers({dragDistance:i,delta:this._dragDelta,dragPlanePoint:t,dragPlaneNormal:this._dragPlane.forward,pointerId:this.currentDraggingPointerID}),this.lastDragPosition.copyFrom(t)}},e.prototype._pickWithRayOnDragPlane=function(t){var i=this;if(!t)return null;var n=Math.acos(s.P.Dot(this._dragPlane.forward,t.direction));if(n>Math.PI/2&&(n=Math.PI-n),this.maxDragAngle>0&&n>this.maxDragAngle){if(this._useAlternatePickedPointAboveMaxDragAngle){this._tmpVector.copyFrom(t.direction),this.attachedNode.absolutePosition.subtractToRef(t.origin,this._alternatePickedPoint),this._alternatePickedPoint.normalize(),this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed*s.P.Dot(this._alternatePickedPoint,this._tmpVector)),this._tmpVector.addInPlace(this._alternatePickedPoint);var r=s.P.Dot(this._dragPlane.forward,this._tmpVector);return this._dragPlane.forward.scaleToRef(-r,this._alternatePickedPoint),this._alternatePickedPoint.addInPlace(this._tmpVector),this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition),this._alternatePickedPoint}return null}var o=e._planeScene.pickWithRay(t,(function(e){return e==i._dragPlane}));return o&&o.hit&&o.pickedMesh&&o.pickedPoint?o.pickedPoint:null},e.prototype._updateDragPlanePosition=function(e,t){this._pointA.copyFrom(t),this._options.dragAxis?(this.useObjectOrientationForDragging?s.P.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragAxis),e.origin.subtractToRef(this._pointA,this._pointC),this._pointC.normalize(),Math.abs(s.P.Dot(this._localAxis,this._pointC))>.999?Math.abs(s.P.Dot(s.P.UpReadOnly,this._pointC))>.999?this._lookAt.copyFrom(s.P.Right()):this._lookAt.copyFrom(s.P.UpReadOnly):(s.P.CrossToRef(this._localAxis,this._pointC,this._lookAt),s.P.CrossToRef(this._localAxis,this._lookAt,this._lookAt),this._lookAt.normalize()),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._lookAt,this._lookAt),this._dragPlane.lookAt(this._lookAt)):this._options.dragPlaneNormal?(this.useObjectOrientationForDragging?s.P.TransformCoordinatesToRef(this._options.dragPlaneNormal,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragPlaneNormal),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._localAxis,this._lookAt),this._dragPlane.lookAt(this._lookAt)):(this._dragPlane.position.copyFrom(this._pointA),this._dragPlane.lookAt(e.origin)),this._dragPlane.position.copyFrom(this.attachedNode.absolutePosition),this._dragPlane.computeWorldMatrix(!0)},e.prototype.detach=function(){this._pointerObserver&&this._scene.onPointerObservable.remove(this._pointerObserver),this._beforeRenderObserver&&this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver),this.releaseDrag()},e._AnyMouseID=-2,e}())},4752:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ArcRotateCamera:()=>I});var n=i(655),r=i(9023),o=i(475),s=i(2973),a=i(2686),l=i(6212),h=i(5441),c=i(5273),u=function(){function e(){this._zoomStopsAnimation=!1,this._idleRotationSpeed=.05,this._idleRotationWaitTime=2e3,this._idleRotationSpinupTime=2e3,this._isPointerDown=!1,this._lastFrameTime=null,this._lastInteractionTime=-1/0,this._cameraRotationSpeed=0,this._lastFrameRadius=0}return Object.defineProperty(e.prototype,"name",{get:function(){return"AutoRotation"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zoomStopsAnimation",{get:function(){return this._zoomStopsAnimation},set:function(e){this._zoomStopsAnimation=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idleRotationSpeed",{get:function(){return this._idleRotationSpeed},set:function(e){this._idleRotationSpeed=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idleRotationWaitTime",{get:function(){return this._idleRotationWaitTime},set:function(e){this._idleRotationWaitTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"idleRotationSpinupTime",{get:function(){return this._idleRotationSpinupTime},set:function(e){this._idleRotationSpinupTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotationInProgress",{get:function(){return Math.abs(this._cameraRotationSpeed)>0},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){var t=this;this._attachedCamera=e;var i=this._attachedCamera.getScene();this._onPrePointerObservableObserver=i.onPrePointerObservable.add((function(e){e.type!==h.kD.POINTERDOWN?e.type===h.kD.POINTERUP&&(t._isPointerDown=!1):t._isPointerDown=!0})),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((function(){var e=c.F.Now,i=0;null!=t._lastFrameTime&&(i=e-t._lastFrameTime),t._lastFrameTime=e,t._applyUserInteraction();var n=e-t._lastInteractionTime-t._idleRotationWaitTime,r=Math.max(Math.min(n/t._idleRotationSpinupTime,1),0);t._cameraRotationSpeed=t._idleRotationSpeed*r,t._attachedCamera&&(t._attachedCamera.alpha-=t._cameraRotationSpeed*(i/1e3))}))},e.prototype.detach=function(){if(this._attachedCamera){var e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._attachedCamera=null}},e.prototype._userIsZooming=function(){return!!this._attachedCamera&&0!==this._attachedCamera.inertialRadiusOffset},e.prototype._shouldAnimationStopForInteraction=function(){if(!this._attachedCamera)return!1;var e=!1;return this._lastFrameRadius===this._attachedCamera.radius&&0!==this._attachedCamera.inertialRadiusOffset&&(e=!0),this._lastFrameRadius=this._attachedCamera.radius,this._zoomStopsAnimation?e:this._userIsZooming()},e.prototype._applyUserInteraction=function(){this._userIsMoving()&&!this._shouldAnimationStopForInteraction()&&(this._lastInteractionTime=c.F.Now)},e.prototype._userIsMoving=function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},e}(),f=i(7580),d=function(){function e(){this._easingMode=e.EASINGMODE_EASEIN}return e.prototype.setEasingMode=function(e){var t=Math.min(Math.max(e,0),2);this._easingMode=t},e.prototype.getEasingMode=function(){return this._easingMode},e.prototype.easeInCore=function(e){throw new Error("You must implement this method")},e.prototype.ease=function(t){switch(this._easingMode){case e.EASINGMODE_EASEIN:return this.easeInCore(t);case e.EASINGMODE_EASEOUT:return 1-this.easeInCore(1-t)}return t>=.5?.5*(1-this.easeInCore(2*(1-t)))+.5:.5*this.easeInCore(2*t)},e.EASINGMODE_EASEIN=0,e.EASINGMODE_EASEOUT=1,e.EASINGMODE_EASEINOUT=2,e}(),p=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return e=Math.max(0,Math.min(1,e)),1-Math.sqrt(1-e*e)}}(d),function(e){function t(t){void 0===t&&(t=1);var i=e.call(this)||this;return i.amplitude=t,i}return(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.amplitude);return Math.pow(e,3)-e*t*Math.sin(3.141592653589793*e)},t}(d)),_=(function(e){function t(t,i){void 0===t&&(t=3),void 0===i&&(i=2);var n=e.call(this)||this;return n.bounces=t,n.bounciness=i,n}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.bounces),i=this.bounciness;i<=1&&(i=1.001);var n=Math.pow(i,t),r=1-i,o=(1-n)/r+.5*n,s=e*o,a=Math.log(-s*(1-i)+1)/Math.log(i),l=Math.floor(a),h=l+1,c=(1-Math.pow(i,l))/(r*o),u=.5*(c+(1-Math.pow(i,h))/(r*o)),f=e-u,d=u-c;return-Math.pow(1/i,t-l)/(d*d)*(f-d)*(f+d)}}(d),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return e*e*e}}(d),function(e){function t(t,i){void 0===t&&(t=3),void 0===i&&(i=3);var n=e.call(this)||this;return n.oscillations=t,n.springiness=i,n}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.oscillations),i=Math.max(0,this.springiness);return(0==i?e:(Math.exp(i*e)-1)/(Math.exp(i)-1))*Math.sin((6.283185307179586*t+1.5707963267948966)*e)}}(d),function(e){function t(t){void 0===t&&(t=2);var i=e.call(this)||this;return i.exponent=t,i}return(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return this.exponent<=0?e:(Math.exp(this.exponent*e)-1)/(Math.exp(this.exponent)-1)},t}(d)),g=(function(e){function t(t){void 0===t&&(t=2);var i=e.call(this)||this;return i.power=t,i}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.power);return Math.pow(e,t)}}(d),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return e*e}}(d),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return e*e*e*e}}(d),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return e*e*e*e*e}}(d),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return 1-Math.sin(1.5707963267948966*(1-e))}}(d),function(e){function t(t,i,n,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1);var o=e.call(this)||this;return o.x1=t,o.y1=i,o.x2=n,o.y2=r,o}(0,n.ZT)(t,e),t.prototype.easeInCore=function(e){return f.hr.Interpolate(e,this.x1,this.y1,this.x2,this.y2)}}(d),i(4635)),m=function(){function e(){this.transitionDuration=450,this.lowerRadiusTransitionRange=2,this.upperRadiusTransitionRange=-2,this._autoTransitionRange=!1,this._radiusIsAnimating=!1,this._radiusBounceTransition=null,this._animatables=new Array}return Object.defineProperty(e.prototype,"name",{get:function(){return"Bouncing"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"autoTransitionRange",{get:function(){return this._autoTransitionRange},set:function(e){var t=this;if(this._autoTransitionRange!==e){this._autoTransitionRange=e;var i=this._attachedCamera;i&&(e?this._onMeshTargetChangedObserver=i.onMeshTargetChangedObservable.add((function(e){if(e){e.computeWorldMatrix(!0);var i=e.getBoundingInfo().diagonalLength;t.lowerRadiusTransitionRange=.05*i,t.upperRadiusTransitionRange=.05*i}})):this._onMeshTargetChangedObserver&&i.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver))}},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){var t=this;this._attachedCamera=e,this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((function(){t._attachedCamera&&(t._isRadiusAtLimit(t._attachedCamera.lowerRadiusLimit)&&t._applyBoundRadiusAnimation(t.lowerRadiusTransitionRange),t._isRadiusAtLimit(t._attachedCamera.upperRadiusLimit)&&t._applyBoundRadiusAnimation(t.upperRadiusTransitionRange))}))},e.prototype.detach=function(){this._attachedCamera&&(this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null)},e.prototype._isRadiusAtLimit=function(e){return!!this._attachedCamera&&(this._attachedCamera.radius===e&&!this._radiusIsAnimating)},e.prototype._applyBoundRadiusAnimation=function(t){var i=this;if(this._attachedCamera){this._radiusBounceTransition||(e.EasingFunction.setEasingMode(e.EasingMode),this._radiusBounceTransition=g.f.CreateAnimation("radius",g.f.ANIMATIONTYPE_FLOAT,60,e.EasingFunction)),this._cachedWheelPrecision=this._attachedCamera.wheelPrecision,this._attachedCamera.wheelPrecision=1/0,this._attachedCamera.inertialRadiusOffset=0,this.stopAllAnimations(),this._radiusIsAnimating=!0;var n=g.f.TransitionTo("radius",this._attachedCamera.radius+t,this._attachedCamera,this._attachedCamera.getScene(),60,this._radiusBounceTransition,this.transitionDuration,(function(){return i._clearAnimationLocks()}));n&&this._animatables.push(n)}},e.prototype._clearAnimationLocks=function(){this._radiusIsAnimating=!1,this._attachedCamera&&(this._attachedCamera.wheelPrecision=this._cachedWheelPrecision)},e.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0].onAnimationEnd=null,this._animatables[0].stop(),this._animatables.shift()},e.EasingFunction=new p(.3),e.EasingMode=d.EASINGMODE_EASEOUT,e}(),v=function(){function e(){this._mode=e.FitFrustumSidesMode,this._radiusScale=1,this._positionScale=.5,this._defaultElevation=.3,this._elevationReturnTime=1500,this._elevationReturnWaitTime=1e3,this._zoomStopsAnimation=!1,this._framingTime=1500,this.autoCorrectCameraLimitsAndSensibility=!0,this._isPointerDown=!1,this._lastInteractionTime=-1/0,this._animatables=new Array,this._betaIsAnimating=!1}return Object.defineProperty(e.prototype,"name",{get:function(){return"Framing"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mode",{get:function(){return this._mode},set:function(e){this._mode=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radiusScale",{get:function(){return this._radiusScale},set:function(e){this._radiusScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"positionScale",{get:function(){return this._positionScale},set:function(e){this._positionScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultElevation",{get:function(){return this._defaultElevation},set:function(e){this._defaultElevation=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"elevationReturnTime",{get:function(){return this._elevationReturnTime},set:function(e){this._elevationReturnTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"elevationReturnWaitTime",{get:function(){return this._elevationReturnWaitTime},set:function(e){this._elevationReturnWaitTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zoomStopsAnimation",{get:function(){return this._zoomStopsAnimation},set:function(e){this._zoomStopsAnimation=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"framingTime",{get:function(){return this._framingTime},set:function(e){this._framingTime=e},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(t){var i=this;this._attachedCamera=t;var n=this._attachedCamera.getScene();e.EasingFunction.setEasingMode(e.EasingMode),this._onPrePointerObservableObserver=n.onPrePointerObservable.add((function(e){e.type!==h.kD.POINTERDOWN?e.type===h.kD.POINTERUP&&(i._isPointerDown=!1):i._isPointerDown=!0})),this._onMeshTargetChangedObserver=t.onMeshTargetChangedObservable.add((function(e){e&&i.zoomOnMesh(e)})),this._onAfterCheckInputsObserver=t.onAfterCheckInputsObservable.add((function(){i._applyUserInteraction(),i._maintainCameraAboveGround()}))},e.prototype.detach=function(){if(this._attachedCamera){var e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null}},e.prototype.zoomOnMesh=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null),e.computeWorldMatrix(!0);var n=e.getBoundingInfo().boundingBox;this.zoomOnBoundingInfo(n.minimumWorld,n.maximumWorld,t,i)},e.prototype.zoomOnMeshHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null),e.computeWorldMatrix(!0);var n=e.getHierarchyBoundingVectors(!0);this.zoomOnBoundingInfo(n.min,n.max,t,i)},e.prototype.zoomOnMeshesHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null);for(var n=new s.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r=new s.P(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),o=0;oh.upperRadiusLimit?h.upperRadiusLimit:l),l):0},e.prototype._maintainCameraAboveGround=function(){var t=this;if(!(this._elevationReturnTime<0)){var i=c.F.Now-this._lastInteractionTime,n=.5*Math.PI-this._defaultElevation,r=.5*Math.PI;if(this._attachedCamera&&!this._betaIsAnimating&&this._attachedCamera.beta>r&&i>=this._elevationReturnWaitTime){this._betaIsAnimating=!0,this.stopAllAnimations(),this._betaTransition||(this._betaTransition=g.f.CreateAnimation("beta",g.f.ANIMATIONTYPE_FLOAT,60,e.EasingFunction));var o=g.f.TransitionTo("beta",n,this._attachedCamera,this._attachedCamera.getScene(),60,this._betaTransition,this._elevationReturnTime,(function(){t._clearAnimationLocks(),t.stopAllAnimations()}));o&&this._animatables.push(o)}}},e.prototype._getFrustumSlope=function(){var e=this._attachedCamera;if(!e)return s.FM.Zero();var t=e.getScene().getEngine().getAspectRatio(e),i=Math.tan(e.fov/2),n=i*t;return new s.FM(n,i)},e.prototype._clearAnimationLocks=function(){this._betaIsAnimating=!1},e.prototype._applyUserInteraction=function(){this.isUserIsMoving&&(this._lastInteractionTime=c.F.Now,this.stopAllAnimations(),this._clearAnimationLocks())},e.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0]&&(this._animatables[0].onAnimationEnd=null,this._animatables[0].stop()),this._animatables.shift()},Object.defineProperty(e.prototype,"isUserIsMoving",{get:function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},enumerable:!1,configurable:!0}),e.EasingFunction=new _,e.EasingMode=d.EASINGMODE_EASEINOUT,e.IgnoreBoundsSizeMode=0,e.FitFrustumSidesMode=1,e}(),y=i(7659),b=i(6955),T=i(748),A=i(5540),E=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.buttons=[0,1,2],t.angularSensibilityX=1e3,t.angularSensibilityY=1e3,t.pinchPrecision=12,t.pinchDeltaPercentage=0,t.useNaturalPinchZoom=!1,t.panningSensibility=1e3,t.multiTouchPanning=!0,t.multiTouchPanAndZoom=!0,t.pinchInwards=!0,t._isPanClick=!1,t._twoFingerActivityCount=0,t._isPinching=!1,t}return(0,n.ZT)(t,e),t.prototype.getClassName=function(){return"ArcRotateCameraPointersInput"},t.prototype.onTouch=function(e,t,i){0!==this.panningSensibility&&(this._ctrlKey&&this.camera._useCtrlForPanning||this._isPanClick)?(this.camera.inertialPanningX+=-t/this.panningSensibility,this.camera.inertialPanningY+=i/this.panningSensibility):(this.camera.inertialAlphaOffset-=t/this.angularSensibilityX,this.camera.inertialBetaOffset-=i/this.angularSensibilityY)},t.prototype.onDoubleTap=function(e){this.camera.useInputToRestoreState&&this.camera.restoreState()},t.prototype.onMultiTouch=function(e,t,i,n,r,o){if(!(0===i&&null===r||0===n&&null===o)){var s=this.pinchInwards?1:-1;if(this.multiTouchPanAndZoom){if(this.useNaturalPinchZoom?this.camera.radius=this.camera.radius*Math.sqrt(i)/Math.sqrt(n):this.pinchDeltaPercentage?this.camera.inertialRadiusOffset+=.001*(n-i)*this.camera.radius*this.pinchDeltaPercentage:this.camera.inertialRadiusOffset+=(n-i)/(this.pinchPrecision*s*(this.angularSensibilityX+this.angularSensibilityY)/2),0!==this.panningSensibility&&r&&o){var a=o.x-r.x,l=o.y-r.y;this.camera.inertialPanningX+=-a/this.panningSensibility,this.camera.inertialPanningY+=l/this.panningSensibility}}else{this._twoFingerActivityCount++;var h=Math.sqrt(i),c=Math.sqrt(n);if(this._isPinching||this._twoFingerActivityCount<20&&Math.abs(c-h)>this.camera.pinchToPanMaxDistance)this.pinchDeltaPercentage?this.camera.inertialRadiusOffset+=.001*(n-i)*this.camera.radius*this.pinchDeltaPercentage:this.camera.inertialRadiusOffset+=(n-i)/(this.pinchPrecision*s*(this.angularSensibilityX+this.angularSensibilityY)/2),this._isPinching=!0;else if(0!==this.panningSensibility&&this.multiTouchPanning&&o&&r){a=o.x-r.x,l=o.y-r.y;this.camera.inertialPanningX+=-a/this.panningSensibility,this.camera.inertialPanningY+=l/this.panningSensibility}}}},t.prototype.onButtonDown=function(e){this._isPanClick=e.button===this.camera._panningMouseButton},t.prototype.onButtonUp=function(e){this._twoFingerActivityCount=0,this._isPinching=!1},t.prototype.onLostFocus=function(){this._isPanClick=!1,this._twoFingerActivityCount=0,this._isPinching=!1},(0,n.gn)([(0,r.qC)()],t.prototype,"buttons",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"angularSensibilityX",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"angularSensibilityY",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"pinchPrecision",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"pinchDeltaPercentage",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"useNaturalPinchZoom",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"panningSensibility",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"multiTouchPanning",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"multiTouchPanAndZoom",void 0),t}(function(){function e(){this.buttons=[0,1,2]}return e.prototype.attachControl=function(e){var t=this;e=A.w1.BackCompatCameraNoPreventDefault(arguments);var i=this.camera.getEngine(),n=i.getInputElement(),r=0,o=null;this.pointA=null,this.pointB=null,this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._buttonsPressed=0,this._pointerInput=function(s,a){var l=s.event,c="touch"===l.pointerType;if(!i.isInVRExclusivePointerMode&&(s.type===h.kD.POINTERMOVE||-1!==t.buttons.indexOf(l.button))){var u=l.srcElement||l.target;if(t._altKey=l.altKey,t._ctrlKey=l.ctrlKey,t._metaKey=l.metaKey,t._shiftKey=l.shiftKey,t._buttonsPressed=l.buttons,i.isPointerLock){var f=l.movementX||l.mozMovementX||l.webkitMovementX||l.msMovementX||0,d=l.movementY||l.mozMovementY||l.webkitMovementY||l.msMovementY||0;t.onTouch(null,f,d),t.pointA=null,t.pointB=null}else if(s.type===h.kD.POINTERDOWN&&u){try{u.setPointerCapture(l.pointerId)}catch(e){}null===t.pointA?t.pointA={x:l.clientX,y:l.clientY,pointerId:l.pointerId,type:l.pointerType}:null===t.pointB&&(t.pointB={x:l.clientX,y:l.clientY,pointerId:l.pointerId,type:l.pointerType}),t.onButtonDown(l),e||(l.preventDefault(),n&&n.focus())}else if(s.type===h.kD.POINTERDOUBLETAP)t.onDoubleTap(l.pointerType);else if(s.type===h.kD.POINTERUP&&u){try{u.releasePointerCapture(l.pointerId)}catch(e){}c||(t.pointB=null),i._badOS?t.pointA=t.pointB=null:t.pointB&&t.pointA&&t.pointA.pointerId==l.pointerId?(t.pointA=t.pointB,t.pointB=null):t.pointA&&t.pointB&&t.pointB.pointerId==l.pointerId?t.pointB=null:t.pointA=t.pointB=null,(0!==r||o)&&(t.onMultiTouch(t.pointA,t.pointB,r,0,o,null),r=0,o=null),t.onButtonUp(l),e||l.preventDefault()}else if(s.type===h.kD.POINTERMOVE)if(e||l.preventDefault(),t.pointA&&null===t.pointB){f=l.clientX-t.pointA.x,d=l.clientY-t.pointA.y;t.onTouch(t.pointA,f,d),t.pointA.x=l.clientX,t.pointA.y=l.clientY}else if(t.pointA&&t.pointB){var p=t.pointA.pointerId===l.pointerId?t.pointA:t.pointB;p.x=l.clientX,p.y=l.clientY;var _=t.pointA.x-t.pointB.x,g=t.pointA.y-t.pointB.y,m=_*_+g*g,v={x:(t.pointA.x+t.pointB.x)/2,y:(t.pointA.y+t.pointB.y)/2,pointerId:l.pointerId,type:s.type};t.onMultiTouch(t.pointA,t.pointB,r,m,o,v),o=v,r=m}}},this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,h.kD.POINTERDOWN|h.kD.POINTERUP|h.kD.POINTERMOVE),this._onLostFocus=function(){t.pointA=t.pointB=null,r=0,o=null,t.onLostFocus()},n&&n.addEventListener("contextmenu",this.onContextMenu.bind(this),!1);var s=this.camera.getScene().getEngine().getHostWindow();s&&A.w1.RegisterTopRootEvents(s,[{name:"blur",handler:this._onLostFocus}])},e.prototype.detachControl=function(e){if(this._onLostFocus){var t=this.camera.getScene().getEngine().getHostWindow();t&&A.w1.UnregisterTopRootEvents(t,[{name:"blur",handler:this._onLostFocus}])}if(this._observer){if(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this.onContextMenu){var i=this.camera.getScene().getEngine().getInputElement();i&&i.removeEventListener("contextmenu",this.onContextMenu)}this._onLostFocus=null}this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._buttonsPressed=0},e.prototype.getClassName=function(){return"BaseCameraPointersInput"},e.prototype.getSimpleName=function(){return"pointers"},e.prototype.onDoubleTap=function(e){},e.prototype.onTouch=function(e,t,i){},e.prototype.onMultiTouch=function(e,t,i,n,r,o){},e.prototype.onContextMenu=function(e){e.preventDefault()},e.prototype.onButtonDown=function(e){},e.prototype.onButtonUp=function(e){},e.prototype.onLostFocus=function(){},(0,n.gn)([(0,r.qC)()],e.prototype,"buttons",void 0),e}());T.u.ArcRotateCameraPointersInput=E;var C=i(3997),x=function(){function e(){this.keysUp=[38],this.keysDown=[40],this.keysLeft=[37],this.keysRight=[39],this.keysReset=[220],this.panningSensibility=50,this.zoomingSensibility=25,this.useAltToZoom=!0,this.angularSpeed=.01,this._keys=new Array}return e.prototype.attachControl=function(e){var t=this;e=A.w1.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((function(){t._keys=[]})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((function(i){var n,r=i.event;r.metaKey||(i.type===C.OG.KEYDOWN?(t._ctrlPressed=r.ctrlKey,t._altPressed=r.altKey,(-1!==t.keysUp.indexOf(r.keyCode)||-1!==t.keysDown.indexOf(r.keyCode)||-1!==t.keysLeft.indexOf(r.keyCode)||-1!==t.keysRight.indexOf(r.keyCode)||-1!==t.keysReset.indexOf(r.keyCode))&&(-1===(n=t._keys.indexOf(r.keyCode))&&t._keys.push(r.keyCode),r.preventDefault&&(e||r.preventDefault()))):-1===t.keysUp.indexOf(r.keyCode)&&-1===t.keysDown.indexOf(r.keyCode)&&-1===t.keysLeft.indexOf(r.keyCode)&&-1===t.keysRight.indexOf(r.keyCode)&&-1===t.keysReset.indexOf(r.keyCode)||((n=t._keys.indexOf(r.keyCode))>=0&&t._keys.splice(n,1),r.preventDefault&&(e||r.preventDefault())))})))},e.prototype.detachControl=function(e){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys=[]},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t0?i/(1+this.wheelDeltaPercentage):i*(1+this.wheelDeltaPercentage)},e.prototype.attachControl=function(e){var t=this;e=A.w1.BackCompatCameraNoPreventDefault(arguments),this._wheel=function(i,n){if(i.type===h.kD.POINTERWHEEL){var r=i.event,o=0,s=r,a=0;if(a=s.wheelDelta?s.wheelDelta:60*-(r.deltaY||r.detail),t.wheelDeltaPercentage){if((o=t.computeDeltaFromMouseWheelLegacyEvent(a,t.camera.radius))>0){for(var l=t.camera.radius,c=t.camera.inertialRadiusOffset+o,u=0;u<20&&Math.abs(c)>.001;u++)l-=c,c*=t.camera.inertia;l=S.R.Clamp(l,0,Number.MAX_VALUE),o=t.computeDeltaFromMouseWheelLegacyEvent(a,l)}}else o=a/(40*t.wheelPrecision);o&&(t.camera.inertialRadiusOffset+=o),r.preventDefault&&(e||r.preventDefault())}},this._observer=this.camera.getScene().onPointerObservable.add(this._wheel,h.kD.POINTERWHEEL)},e.prototype.detachControl=function(e){this._observer&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._wheel=null)},e.prototype.getClassName=function(){return"ArcRotateCameraMouseWheelInput"},e.prototype.getSimpleName=function(){return"mousewheel"},(0,n.gn)([(0,r.qC)()],e.prototype,"wheelPrecision",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"wheelDeltaPercentage",void 0),e}();T.u.ArcRotateCameraMouseWheelInput=R;var M=function(e){function t(t){return e.call(this,t)||this}return(0,n.ZT)(t,e),t.prototype.addMouseWheel=function(){return this.add(new R),this},t.prototype.addPointers=function(){return this.add(new E),this},t.prototype.addKeyboard=function(){return this.add(new x),this},t}(T.p),P=i(2782);a.N.AddNodeConstructor("ArcRotateCamera",(function(e,t){return function(){return new I(e,0,0,1,s.P.Zero(),t)}}));var I=function(e){function t(t,i,n,r,a,l,h){void 0===h&&(h=!0);var c=e.call(this,t,s.P.Zero(),l,h)||this;return c.inertialAlphaOffset=0,c.inertialBetaOffset=0,c.inertialRadiusOffset=0,c.lowerAlphaLimit=null,c.upperAlphaLimit=null,c.lowerBetaLimit=.01,c.upperBetaLimit=Math.PI-.01,c.lowerRadiusLimit=null,c.upperRadiusLimit=null,c.inertialPanningX=0,c.inertialPanningY=0,c.pinchToPanMaxDistance=20,c.panningDistanceLimit=null,c.panningOriginTarget=s.P.Zero(),c.panningInertia=.9,c.zoomOnFactor=1,c.targetScreenOffset=s.FM.Zero(),c.allowUpsideDown=!0,c.useInputToRestoreState=!0,c._viewMatrix=new s.y3,c.panningAxis=new s.P(1,1,0),c.onMeshTargetChangedObservable=new o.y$,c.checkCollisions=!1,c.collisionRadius=new s.P(.5,.5,.5),c._previousPosition=s.P.Zero(),c._collisionVelocity=s.P.Zero(),c._newPosition=s.P.Zero(),c._computationVector=s.P.Zero(),c._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),i?(c.setPosition(t),c.onCollide&&c.onCollide(i)):c._previousPosition.copyFrom(c._position);var n=Math.cos(c.alpha),r=Math.sin(c.alpha),o=Math.cos(c.beta),s=Math.sin(c.beta);0===s&&(s=1e-4);var a=c._getTargetPosition();c._computationVector.copyFromFloats(c.radius*n*s,c.radius*o,c.radius*r*s),a.addToRef(c._computationVector,c._newPosition),c._position.copyFrom(c._newPosition);var l=c.upVector;c.allowUpsideDown&&c.beta<0&&(l=(l=l.clone()).negate()),c._computeViewMatrix(c._position,a,l),c._viewMatrix.addAtIndex(12,c.targetScreenOffset.x),c._viewMatrix.addAtIndex(13,c.targetScreenOffset.y),c._collisionTriggered=!1},c._target=s.P.Zero(),a&&c.setTarget(a),c.alpha=i,c.beta=n,c.radius=r,c.getViewMatrix(),c.inputs=new M(c),c.inputs.addKeyboard().addMouseWheel().addPointers(),c}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(e){this.setTarget(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){this.setPosition(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"upVector",{get:function(){return this._upVector},set:function(e){this._upToYMatrix||(this._YToUpMatrix=new s.y3,this._upToYMatrix=new s.y3,this._upVector=s.P.Zero()),e.normalize(),this._upVector.copyFrom(e),this.setMatUp()},enumerable:!1,configurable:!0}),t.prototype.setMatUp=function(){s.y3.RotationAlignToRef(s.P.UpReadOnly,this._upVector,this._YToUpMatrix),s.y3.RotationAlignToRef(this._upVector,s.P.UpReadOnly,this._upToYMatrix)},Object.defineProperty(t.prototype,"angularSensibilityX",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityX:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityX=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"angularSensibilityY",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityY:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityY=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pinchPrecision",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchPrecision:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchPrecision=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pinchDeltaPercentage",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchDeltaPercentage:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchDeltaPercentage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useNaturalPinchZoom",{get:function(){var e=this.inputs.attached.pointers;return!!e&&e.useNaturalPinchZoom},set:function(e){var t=this.inputs.attached.pointers;t&&(t.useNaturalPinchZoom=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"panningSensibility",{get:function(){var e=this.inputs.attached.pointers;return e?e.panningSensibility:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.panningSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wheelPrecision",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelPrecision:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelPrecision=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wheelDeltaPercentage",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelDeltaPercentage:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelDeltaPercentage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bouncingBehavior",{get:function(){return this._bouncingBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useBouncingBehavior",{get:function(){return null!=this._bouncingBehavior},set:function(e){e!==this.useBouncingBehavior&&(e?(this._bouncingBehavior=new m,this.addBehavior(this._bouncingBehavior)):this._bouncingBehavior&&(this.removeBehavior(this._bouncingBehavior),this._bouncingBehavior=null))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"framingBehavior",{get:function(){return this._framingBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useFramingBehavior",{get:function(){return null!=this._framingBehavior},set:function(e){e!==this.useFramingBehavior&&(e?(this._framingBehavior=new v,this.addBehavior(this._framingBehavior)):this._framingBehavior&&(this.removeBehavior(this._framingBehavior),this._framingBehavior=null))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoRotationBehavior",{get:function(){return this._autoRotationBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useAutoRotationBehavior",{get:function(){return null!=this._autoRotationBehavior},set:function(e){e!==this.useAutoRotationBehavior&&(e?(this._autoRotationBehavior=new u,this.addBehavior(this._autoRotationBehavior)):this._autoRotationBehavior&&(this.removeBehavior(this._autoRotationBehavior),this._autoRotationBehavior=null))},enumerable:!1,configurable:!0}),t.prototype._initCache=function(){e.prototype._initCache.call(this),this._cache._target=new s.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.alpha=void 0,this._cache.beta=void 0,this._cache.radius=void 0,this._cache.targetScreenOffset=s.FM.Zero()},t.prototype._updateCache=function(t){t||e.prototype._updateCache.call(this),this._cache._target.copyFrom(this._getTargetPosition()),this._cache.alpha=this.alpha,this._cache.beta=this.beta,this._cache.radius=this.radius,this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset)},t.prototype._getTargetPosition=function(){if(this._targetHost&&this._targetHost.getAbsolutePosition){var e=this._targetHost.absolutePosition;this._targetBoundingCenter?e.addToRef(this._targetBoundingCenter,this._target):this._target.copyFrom(e)}var t=this._getLockedTargetPosition();return t||this._target},t.prototype.storeState=function(){return this._storedAlpha=this.alpha,this._storedBeta=this.beta,this._storedRadius=this.radius,this._storedTarget=this._getTargetPosition().clone(),this._storedTargetScreenOffset=this.targetScreenOffset.clone(),e.prototype.storeState.call(this)},t.prototype._restoreStateValues=function(){return!!e.prototype._restoreStateValues.call(this)&&(this.setTarget(this._storedTarget.clone()),this.alpha=this._storedAlpha,this.beta=this._storedBeta,this.radius=this._storedRadius,this.targetScreenOffset=this._storedTargetScreenOffset.clone(),this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,this.inertialPanningY=0,!0)},t.prototype._isSynchronizedViewMatrix=function(){return!!e.prototype._isSynchronizedViewMatrix.call(this)&&(this._cache._target.equals(this._getTargetPosition())&&this._cache.alpha===this.alpha&&this._cache.beta===this.beta&&this._cache.radius===this.radius&&this._cache.targetScreenOffset.equals(this.targetScreenOffset))},t.prototype.attachControl=function(e,t,i,n){var r=this;void 0===i&&(i=!0),void 0===n&&(n=2),t=A.w1.BackCompatCameraNoPreventDefault(arguments),this._useCtrlForPanning=i,this._panningMouseButton=n,"boolean"==typeof arguments[0]&&(arguments.length>1&&(this._useCtrlForPanning=arguments[1]),arguments.length>2&&(this._panningMouseButton=arguments[2])),this.inputs.attachElement(t),this._reset=function(){r.inertialAlphaOffset=0,r.inertialBetaOffset=0,r.inertialRadiusOffset=0,r.inertialPanningX=0,r.inertialPanningY=0}},t.prototype.detachControl=function(e){this.inputs.detachElement(),this._reset&&this._reset()},t.prototype._checkInputs=function(){if(!this._collisionTriggered){if(this.inputs.checkInputs(),0!==this.inertialAlphaOffset||0!==this.inertialBetaOffset||0!==this.inertialRadiusOffset){var t=this.inertialAlphaOffset;this.beta<=0&&(t*=-1),this.getScene().useRightHandedSystem&&(t*=-1),this.parent&&this.parent._getWorldMatrixDeterminant()<0&&(t*=-1),this.alpha+=t,this.beta+=this.inertialBetaOffset,this.radius-=this.inertialRadiusOffset,this.inertialAlphaOffset*=this.inertia,this.inertialBetaOffset*=this.inertia,this.inertialRadiusOffset*=this.inertia,Math.abs(this.inertialAlphaOffset)Math.PI&&(this.beta=this.beta-2*Math.PI):this.betathis.upperBetaLimit&&(this.beta=this.upperBetaLimit),null!==this.lowerAlphaLimit&&this.alphathis.upperAlphaLimit&&(this.alpha=this.upperAlphaLimit),null!==this.lowerRadiusLimit&&this.radiusthis.upperRadiusLimit&&(this.radius=this.upperRadiusLimit,this.inertialRadiusOffset=0)},t.prototype.rebuildAnglesAndRadius=function(){this._position.subtractToRef(this._getTargetPosition(),this._computationVector),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||s.P.TransformCoordinatesToRef(this._computationVector,this._upToYMatrix,this._computationVector),this.radius=this._computationVector.length(),0===this.radius&&(this.radius=1e-4);var e=this.alpha;0===this._computationVector.x&&0===this._computationVector.z?this.alpha=Math.PI/2:this.alpha=Math.acos(this._computationVector.x/Math.sqrt(Math.pow(this._computationVector.x,2)+Math.pow(this._computationVector.z,2))),this._computationVector.z<0&&(this.alpha=2*Math.PI-this.alpha);var t=Math.round((e-this.alpha)/(2*Math.PI));this.alpha+=2*t*Math.PI,this.beta=Math.acos(this._computationVector.y/this.radius),this._checkLimits()},t.prototype.setPosition=function(e){this._position.equals(e)||(this._position.copyFrom(e),this.rebuildAnglesAndRadius())},t.prototype.setTarget=function(e,t,i){if(void 0===t&&(t=!1),void 0===i&&(i=!1),e.getBoundingInfo)this._targetBoundingCenter=t?e.getBoundingInfo().boundingBox.centerWorld.clone():null,e.computeWorldMatrix(),this._targetHost=e,this._target=this._getTargetPosition(),this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);else{var n=e,r=this._getTargetPosition();if(r&&!i&&r.equals(n))return;this._targetHost=null,this._target=n,this._targetBoundingCenter=null,this.onMeshTargetChangedObservable.notifyObservers(null)}this.rebuildAnglesAndRadius()},t.prototype._getViewMatrix=function(){var e=Math.cos(this.alpha),t=Math.sin(this.alpha),i=Math.cos(this.beta),n=Math.sin(this.beta);0===n&&(n=1e-4),0===this.radius&&(this.radius=1e-4);var r=this._getTargetPosition();if(this._computationVector.copyFromFloats(this.radius*e*n,this.radius*i,this.radius*t*n),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||s.P.TransformCoordinatesToRef(this._computationVector,this._YToUpMatrix,this._computationVector),r.addToRef(this._computationVector,this._newPosition),this.getScene().collisionsEnabled&&this.checkCollisions){var o=this.getScene().collisionCoordinator;this._collider||(this._collider=o.createCollider()),this._collider._radius=this.collisionRadius,this._newPosition.subtractToRef(this._position,this._collisionVelocity),this._collisionTriggered=!0,o.getNewPosition(this._position,this._collisionVelocity,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)}else{this._position.copyFrom(this._newPosition);var a=this.upVector;this.allowUpsideDown&&n<0&&(a=a.negate()),this._computeViewMatrix(this._position,r,a),this._viewMatrix.addAtIndex(12,this.targetScreenOffset.x),this._viewMatrix.addAtIndex(13,this.targetScreenOffset.y)}return this._currentTarget=r,this._viewMatrix},t.prototype.zoomOn=function(e,t){void 0===t&&(t=!1),e=e||this.getScene().meshes;var i=l.Mesh.MinMax(e),n=s.P.Distance(i.min,i.max);this.radius=n*this.zoomOnFactor,this.focusOn({min:i.min,max:i.max,distance:n},t)},t.prototype.focusOn=function(e,t){var i,n;if(void 0===t&&(t=!1),void 0===e.min){var r=e||this.getScene().meshes;i=l.Mesh.MinMax(r),n=s.P.Distance(i.min,i.max)}else{i=e,n=e.distance}this._target=l.Mesh.Center(i),t||(this.maxZ=2*n)},t.prototype.createRigCamera=function(e,i){var n=0;switch(this.cameraRigMode){case y.V.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case y.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case y.V.RIG_MODE_STEREOSCOPIC_OVERUNDER:case y.V.RIG_MODE_STEREOSCOPIC_INTERLACED:case y.V.RIG_MODE_VR:n=this._cameraRigParams.stereoHalfAngle*(0===i?1:-1);break;case y.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:n=this._cameraRigParams.stereoHalfAngle*(0===i?-1:1)}var r=new t(e,this.alpha+n,this.beta,this.radius,this._target,this.getScene());return r._cameraRigParams={},r.isRigCamera=!0,r.rigParent=this,r.upVector=this.upVector,r},t.prototype._updateRigCameras=function(){var t=this._rigCameras[0],i=this._rigCameras[1];switch(t.beta=i.beta=this.beta,this.cameraRigMode){case y.V.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case y.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case y.V.RIG_MODE_STEREOSCOPIC_OVERUNDER:case y.V.RIG_MODE_STEREOSCOPIC_INTERLACED:case y.V.RIG_MODE_VR:t.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle,i.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle;break;case y.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:t.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle,i.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle}e.prototype._updateRigCameras.call(this)},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return"ArcRotateCamera"},(0,n.gn)([(0,r.qC)()],t.prototype,"alpha",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"beta",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"radius",void 0),(0,n.gn)([(0,r.hd)("target")],t.prototype,"_target",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"inertialAlphaOffset",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"inertialBetaOffset",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"inertialRadiusOffset",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"lowerAlphaLimit",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"upperAlphaLimit",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"lowerBetaLimit",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"upperBetaLimit",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"lowerRadiusLimit",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"upperRadiusLimit",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"inertialPanningX",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"inertialPanningY",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"pinchToPanMaxDistance",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"panningDistanceLimit",void 0),(0,n.gn)([(0,r.hd)()],t.prototype,"panningOriginTarget",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"panningInertia",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"zoomOnFactor",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"targetScreenOffset",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"allowUpsideDown",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"useInputToRestoreState",void 0),t}(b.C)},7659:(e,t,i)=>{"use strict";i.d(t,{V:()=>_});var n=i(655),r=i(9023),o=i(6936),s=i(5540),a=i(475),l=i(2973),h=i(2686),c=i(3734),u=i(6132),f=i(106),d=i(4272),p=i(131),_=function(e){function t(i,n,r,s){void 0===s&&(s=!0);var h=e.call(this,i,r)||this;return h._position=l.P.Zero(),h._upVector=l.P.Up(),h.orthoLeft=null,h.orthoRight=null,h.orthoBottom=null,h.orthoTop=null,h.fov=.8,h.minZ=1,h.maxZ=1e4,h.inertia=.9,h.mode=t.PERSPECTIVE_CAMERA,h.isIntermediate=!1,h.viewport=new d.l(0,0,1,1),h.layerMask=268435455,h.fovMode=t.FOVMODE_VERTICAL_FIXED,h.cameraRigMode=t.RIG_MODE_NONE,h.customRenderTargets=new Array,h.outputRenderTarget=null,h.onViewMatrixChangedObservable=new a.y$,h.onProjectionMatrixChangedObservable=new a.y$,h.onAfterCheckInputsObservable=new a.y$,h.onRestoreStateObservable=new a.y$,h.isRigCamera=!1,h._rigCameras=new Array,h._webvrViewMatrix=l.y3.Identity(),h._skipRendering=!1,h._projectionMatrix=new l.y3,h._postProcesses=new Array,h._activeMeshes=new o.t(256),h._globalPosition=l.P.Zero(),h._computedViewMatrix=l.y3.Identity(),h._doNotComputeProjectionMatrix=!1,h._transformMatrix=l.y3.Zero(),h._refreshFrustumPlanes=!0,h._isCamera=!0,h._isLeftCamera=!1,h._isRightCamera=!1,h.getScene().addCamera(h),s&&!h.getScene().activeCamera&&(h.getScene().activeCamera=h),h.position=n,h}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"upVector",{get:function(){return this._upVector},set:function(e){this._upVector=e},enumerable:!1,configurable:!0}),t.prototype.storeState=function(){return this._stateStored=!0,this._storedFov=this.fov,this},t.prototype._restoreStateValues=function(){return!!this._stateStored&&(this.fov=this._storedFov,!0)},t.prototype.restoreState=function(){return!!this._restoreStateValues()&&(this.onRestoreStateObservable.notifyObservers(this),!0)},t.prototype.getClassName=function(){return"Camera"},t.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+this.getClassName(),this.animations)for(var i=0;i-1?(c.Y.Error("You're trying to reuse a post process not defined as reusable."),0):(null==t||t<0?this._postProcesses.push(e):null===this._postProcesses[t]?this._postProcesses[t]=e:this._postProcesses.splice(t,0,e),this._cascadePostProcessesToRigCams(),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._postProcesses.indexOf(e))},t.prototype.detachPostProcess=function(e){var t=this._postProcesses.indexOf(e);-1!==t&&(this._postProcesses[t]=null),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._cascadePostProcessesToRigCams()},t.prototype.getWorldMatrix=function(){return this._isSynchronizedViewMatrix()||this.getViewMatrix(),this._worldMatrix},t.prototype._getViewMatrix=function(){return l.y3.Identity()},t.prototype.getViewMatrix=function(e){return!e&&this._isSynchronizedViewMatrix()||(this.updateCache(),this._computedViewMatrix=this._getViewMatrix(),this._currentRenderId=this.getScene().getRenderId(),this._childUpdateId++,this._refreshFrustumPlanes=!0,this._cameraRigParams&&this._cameraRigParams.vrPreViewMatrix&&this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix,this._computedViewMatrix),this.parent&&this.parent.onViewMatrixChangedObservable&&this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent),this.onViewMatrixChangedObservable.notifyObservers(this),this._computedViewMatrix.invertToRef(this._worldMatrix)),this._computedViewMatrix},t.prototype.freezeProjectionMatrix=function(e){this._doNotComputeProjectionMatrix=!0,void 0!==e&&(this._projectionMatrix=e)},t.prototype.unfreezeProjectionMatrix=function(){this._doNotComputeProjectionMatrix=!1},t.prototype.getProjectionMatrix=function(e){var i,n,r,o,s,a,h,c;if(this._doNotComputeProjectionMatrix||!e&&this._isSynchronizedProjectionMatrix())return this._projectionMatrix;this._cache.mode=this.mode,this._cache.minZ=this.minZ,this._cache.maxZ=this.maxZ,this._refreshFrustumPlanes=!0;var u=this.getEngine(),f=this.getScene();if(this.mode===t.PERSPECTIVE_CAMERA){this._cache.fov=this.fov,this._cache.fovMode=this.fovMode,this._cache.aspectRatio=u.getAspectRatio(this),this.minZ<=0&&(this.minZ=.1);var d=u.useReverseDepthBuffer;(f.useRightHandedSystem?d?l.y3.PerspectiveFovReverseRHToRef:l.y3.PerspectiveFovRHToRef:d?l.y3.PerspectiveFovReverseLHToRef:l.y3.PerspectiveFovLHToRef)(this.fov,u.getAspectRatio(this),this.minZ,this.maxZ,this._projectionMatrix,this.fovMode===t.FOVMODE_VERTICAL_FIXED)}else{var p=u.getRenderWidth()/2,_=u.getRenderHeight()/2;f.useRightHandedSystem?l.y3.OrthoOffCenterRHToRef(null!==(i=this.orthoLeft)&&void 0!==i?i:-p,null!==(n=this.orthoRight)&&void 0!==n?n:p,null!==(r=this.orthoBottom)&&void 0!==r?r:-_,null!==(o=this.orthoTop)&&void 0!==o?o:_,this.minZ,this.maxZ,this._projectionMatrix):l.y3.OrthoOffCenterLHToRef(null!==(s=this.orthoLeft)&&void 0!==s?s:-p,null!==(a=this.orthoRight)&&void 0!==a?a:p,null!==(h=this.orthoBottom)&&void 0!==h?h:-_,null!==(c=this.orthoTop)&&void 0!==c?c:_,this.minZ,this.maxZ,this._projectionMatrix),this._cache.orthoLeft=this.orthoLeft,this._cache.orthoRight=this.orthoRight,this._cache.orthoBottom=this.orthoBottom,this._cache.orthoTop=this.orthoTop,this._cache.renderWidth=u.getRenderWidth(),this._cache.renderHeight=u.getRenderHeight()}return this.onProjectionMatrixChangedObservable.notifyObservers(this),this._projectionMatrix},t.prototype.getTransformationMatrix=function(){return this._computedViewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._transformMatrix},t.prototype._updateFrustumPlanes=function(){this._refreshFrustumPlanes&&(this.getTransformationMatrix(),this._frustumPlanes?p.i.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=p.i.GetPlanes(this._transformMatrix),this._refreshFrustumPlanes=!1)},t.prototype.isInFrustum=function(e,t){if(void 0===t&&(t=!1),this._updateFrustumPlanes(),t&&this.rigCameras.length>0){var i=!1;return this.rigCameras.forEach((function(t){t._updateFrustumPlanes(),i=i||e.isInFrustum(t._frustumPlanes)})),i}return e.isInFrustum(this._frustumPlanes)},t.prototype.isCompletelyInFrustum=function(e){return this._updateFrustumPlanes(),e.isCompletelyInFrustum(this._frustumPlanes)},t.prototype.getForwardRay=function(e,t,i){throw void 0===e&&(e=100),f.f.WarnImport("Ray")},t.prototype.getForwardRayToRef=function(e,t,i,n){throw void 0===t&&(t=100),f.f.WarnImport("Ray")},t.prototype.dispose=function(i,n){for(void 0===n&&(n=!1),this.onViewMatrixChangedObservable.clear(),this.onProjectionMatrixChangedObservable.clear(),this.onAfterCheckInputsObservable.clear(),this.onRestoreStateObservable.clear(),this.inputs&&this.inputs.clear(),this.getScene().stopAnimation(this),this.getScene().removeCamera(this);this._rigCameras.length>0;){var r=this._rigCameras.pop();r&&r.dispose()}if(this._rigPostProcess)this._rigPostProcess.dispose(this),this._rigPostProcess=null,this._postProcesses=[];else if(this.cameraRigMode!==t.RIG_MODE_NONE)this._rigPostProcess=null,this._postProcesses=[];else for(var o=this._postProcesses.length;--o>=0;){var s=this._postProcesses[o];s&&s.dispose(this)}for(o=this.customRenderTargets.length;--o>=0;)this.customRenderTargets[o].dispose();this.customRenderTargets=[],this._activeMeshes.dispose(),e.prototype.dispose.call(this,i,n)},Object.defineProperty(t.prototype,"isLeftCamera",{get:function(){return this._isLeftCamera},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRightCamera",{get:function(){return this._isRightCamera},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftCamera",{get:function(){return this._rigCameras.length<1?null:this._rigCameras[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightCamera",{get:function(){return this._rigCameras.length<2?null:this._rigCameras[1]},enumerable:!1,configurable:!0}),t.prototype.getLeftTarget=function(){return this._rigCameras.length<1?null:this._rigCameras[0].getTarget()},t.prototype.getRightTarget=function(){return this._rigCameras.length<2?null:this._rigCameras[1].getTarget()},t.prototype.setCameraRigMode=function(e,i){if(this.cameraRigMode!==e){for(;this._rigCameras.length>0;){var n=this._rigCameras.pop();n&&n.dispose()}if(this.cameraRigMode=e,this._cameraRigParams={},this._cameraRigParams.interaxialDistance=i.interaxialDistance||.0637,this._cameraRigParams.stereoHalfAngle=s.w1.ToRadians(this._cameraRigParams.interaxialDistance/.0637),this.cameraRigMode!==t.RIG_MODE_NONE){var r=this.createRigCamera(this.name+"_L",0);r&&(r._isLeftCamera=!0);var o=this.createRigCamera(this.name+"_R",1);o&&(o._isRightCamera=!0),r&&o&&(this._rigCameras.push(r),this._rigCameras.push(o))}switch(this.cameraRigMode){case t.RIG_MODE_STEREOSCOPIC_ANAGLYPH:t._setStereoscopicAnaglyphRigMode(this);break;case t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:case t.RIG_MODE_STEREOSCOPIC_OVERUNDER:case t.RIG_MODE_STEREOSCOPIC_INTERLACED:t._setStereoscopicRigMode(this);break;case t.RIG_MODE_VR:t._setVRRigMode(this,i);break;case t.RIG_MODE_WEBVR:t._setWebVRRigMode(this,i)}this._cascadePostProcessesToRigCams(),this.update()}},t._setStereoscopicRigMode=function(e){throw"Import Cameras/RigModes/stereoscopicRigMode before using stereoscopic rig mode"},t._setStereoscopicAnaglyphRigMode=function(e){throw"Import Cameras/RigModes/stereoscopicAnaglyphRigMode before using stereoscopic anaglyph rig mode"},t._setVRRigMode=function(e,t){throw"Import Cameras/RigModes/vrRigMode before using VR rig mode"},t._setWebVRRigMode=function(e,t){throw"Import Cameras/RigModes/WebVRRigMode before using Web VR rig mode"},t.prototype._getVRProjectionMatrix=function(){return l.y3.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov,this._cameraRigParams.vrMetrics.aspectRatio,this.minZ,this.maxZ,this._cameraRigParams.vrWorkMatrix),this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix,this._projectionMatrix),this._projectionMatrix},t.prototype._updateCameraRotationMatrix=function(){},t.prototype._updateWebVRCameraRotationMatrix=function(){},t.prototype._getWebVRProjectionMatrix=function(){return l.y3.Identity()},t.prototype._getWebVRViewMatrix=function(){return l.y3.Identity()},t.prototype.setCameraRigParameter=function(e,t){this._cameraRigParams||(this._cameraRigParams={}),this._cameraRigParams[e]=t,"interaxialDistance"===e&&(this._cameraRigParams.stereoHalfAngle=s.w1.ToRadians(t/.0637))},t.prototype.createRigCamera=function(e,t){return null},t.prototype._updateRigCameras=function(){for(var e=0;e{"use strict";i.d(t,{u:()=>s,p:()=>a});var n=i(3734),r=i(9023),o=i(7659),s={},a=function(){function e(e){this.attachedToElement=!1,this.attached={},this.camera=e,this.checkInputs=function(){}}return e.prototype.add=function(e){var t=e.getSimpleName();this.attached[t]?n.Y.Warn("camera input of type "+t+" already exists on camera"):(this.attached[t]=e,e.camera=this.camera,e.checkInputs&&(this.checkInputs=this._addCheckInputs(e.checkInputs.bind(e))),this.attachedToElement&&e.attachControl())},e.prototype.remove=function(e){for(var t in this.attached){var i=this.attached[t];i===e&&(i.detachControl(),i.camera=null,delete this.attached[t],this.rebuildInputCheck())}},e.prototype.removeByType=function(e){for(var t in this.attached){var i=this.attached[t];i.getClassName()===e&&(i.detachControl(),i.camera=null,delete this.attached[t],this.rebuildInputCheck())}},e.prototype._addCheckInputs=function(e){var t=this.checkInputs;return function(){t(),e()}},e.prototype.attachInput=function(e){this.attachedToElement&&e.attachControl(this.noPreventDefault)},e.prototype.attachElement=function(e){if(void 0===e&&(e=!1),!this.attachedToElement)for(var t in e=!o.V.ForceAttachControlToAlwaysPreventDefault&&e,this.attachedToElement=!0,this.noPreventDefault=e,this.attached)this.attached[t].attachControl(e)},e.prototype.detachElement=function(e){for(var t in void 0===e&&(e=!1),this.attached)this.attached[t].detachControl(),e&&(this.attached[t].camera=null);this.attachedToElement=!1},e.prototype.rebuildInputCheck=function(){for(var e in this.checkInputs=function(){},this.attached){var t=this.attached[e];t.checkInputs&&(this.checkInputs=this._addCheckInputs(t.checkInputs.bind(t)))}},e.prototype.clear=function(){this.attachedToElement&&this.detachElement(!0),this.attached={},this.attachedToElement=!1,this.checkInputs=function(){}},e.prototype.serialize=function(e){var t={};for(var i in this.attached){var n=this.attached[i],o=r.p4.Serialize(n);t[n.getClassName()]=o}e.inputsmgr=t},e.prototype.parse=function(e){var t=e.inputsmgr;if(t)for(var i in this.clear(),t){if(a=s[i]){var n=t[i],o=r.p4.Parse((function(){return new a}),n,null);this.add(o)}}else for(var i in this.attached){var a;if(a=s[this.attached[i].getClassName()]){o=r.p4.Parse((function(){return new a}),e,null);this.remove(this.attached[i]),this.add(o)}}},e}()},6955:(e,t,i)=>{"use strict";i.d(t,{C:()=>h});var n=i(655),r=i(9023),o=i(7659),s=i(2973),a=i(2782),l=i(9068),h=function(e){function t(t,i,n,r){void 0===r&&(r=!0);var o=e.call(this,t,i,n,r)||this;return o._tmpUpVector=s.P.Zero(),o._tmpTargetVector=s.P.Zero(),o.cameraDirection=new s.P(0,0,0),o.cameraRotation=new s.FM(0,0),o.ignoreParentScaling=!1,o.updateUpVectorFromRotation=!1,o._tmpQuaternion=new s._f,o.rotation=new s.P(0,0,0),o.speed=2,o.noRotationConstraint=!1,o.invertRotation=!1,o.inverseRotationSpeed=.2,o.lockedTarget=null,o._currentTarget=s.P.Zero(),o._initialFocalDistance=1,o._viewMatrix=s.y3.Zero(),o._camMatrix=s.y3.Zero(),o._cameraTransformMatrix=s.y3.Zero(),o._cameraRotationMatrix=s.y3.Zero(),o._referencePoint=new s.P(0,0,1),o._transformedReferencePoint=s.P.Zero(),o._defaultUp=s.P.Up(),o._cachedRotationZ=0,o._cachedQuaternionRotationZ=0,o}return(0,n.ZT)(t,e),t.prototype.getFrontPosition=function(e){this.getWorldMatrix();var t=this.getTarget().subtract(this.position);return t.normalize(),t.scaleInPlace(e),this.globalPosition.add(t)},t.prototype._getLockedTargetPosition=function(){return this.lockedTarget?(this.lockedTarget.absolutePosition&&this.lockedTarget.computeWorldMatrix(),this.lockedTarget.absolutePosition||this.lockedTarget):null},t.prototype.storeState=function(){return this._storedPosition=this.position.clone(),this._storedRotation=this.rotation.clone(),this.rotationQuaternion&&(this._storedRotationQuaternion=this.rotationQuaternion.clone()),e.prototype.storeState.call(this)},t.prototype._restoreStateValues=function(){return!!e.prototype._restoreStateValues.call(this)&&(this.position=this._storedPosition.clone(),this.rotation=this._storedRotation.clone(),this.rotationQuaternion&&(this.rotationQuaternion=this._storedRotationQuaternion.clone()),this.cameraDirection.copyFromFloats(0,0,0),this.cameraRotation.copyFromFloats(0,0),!0)},t.prototype._initCache=function(){e.prototype._initCache.call(this),this._cache.lockedTarget=new s.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotation=new s.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotationQuaternion=new s._f(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)},t.prototype._updateCache=function(t){t||e.prototype._updateCache.call(this);var i=this._getLockedTargetPosition();i?this._cache.lockedTarget?this._cache.lockedTarget.copyFrom(i):this._cache.lockedTarget=i.clone():this._cache.lockedTarget=null,this._cache.rotation.copyFrom(this.rotation),this.rotationQuaternion&&this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion)},t.prototype._isSynchronizedViewMatrix=function(){if(!e.prototype._isSynchronizedViewMatrix.call(this))return!1;var t=this._getLockedTargetPosition();return(this._cache.lockedTarget?this._cache.lockedTarget.equals(t):!t)&&(this.rotationQuaternion?this.rotationQuaternion.equals(this._cache.rotationQuaternion):this._cache.rotation.equals(this.rotation))},t.prototype._computeLocalCameraSpeed=function(){var e=this.getEngine();return this.speed*Math.sqrt(e.getDeltaTime()/(100*e.getFps()))},t.prototype.setTarget=function(e){this.upVector.normalize(),this._initialFocalDistance=e.subtract(this.position).length(),this.position.z===e.z&&(this.position.z+=a.kn),this._referencePoint.normalize().scaleInPlace(this._initialFocalDistance),s.y3.LookAtLHToRef(this.position,e,this._defaultUp,this._camMatrix),this._camMatrix.invert(),this.rotation.x=Math.atan(this._camMatrix.m[6]/this._camMatrix.m[10]);var t=e.subtract(this.position);t.x>=0?this.rotation.y=-Math.atan(t.z/t.x)+Math.PI/2:this.rotation.y=-Math.atan(t.z/t.x)-Math.PI/2,this.rotation.z=0,isNaN(this.rotation.x)&&(this.rotation.x=0),isNaN(this.rotation.y)&&(this.rotation.y=0),isNaN(this.rotation.z)&&(this.rotation.z=0),this.rotationQuaternion&&s._f.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)},Object.defineProperty(t.prototype,"target",{get:function(){return this.getTarget()},set:function(e){this.setTarget(e)},enumerable:!1,configurable:!0}),t.prototype.getTarget=function(){return this._currentTarget},t.prototype._decideIfNeedsToMove=function(){return Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){if(this.parent)return this.parent.getWorldMatrix().invertToRef(s.jp.Matrix[0]),s.P.TransformNormalToRef(this.cameraDirection,s.jp.Matrix[0],s.jp.Vector3[0]),void this.position.addInPlace(s.jp.Vector3[0]);this.position.addInPlace(this.cameraDirection)},t.prototype._checkInputs=function(){var t=this.invertRotation?-this.inverseRotationSpeed:1,i=this._decideIfNeedsToMove(),n=Math.abs(this.cameraRotation.x)>0||Math.abs(this.cameraRotation.y)>0;if(i&&this._updatePosition(),n){if(this.rotationQuaternion&&this.rotationQuaternion.toEulerAnglesToRef(this.rotation),this.rotation.x+=this.cameraRotation.x*t,this.rotation.y+=this.cameraRotation.y*t,!this.noRotationConstraint){var r=1.570796;this.rotation.x>r&&(this.rotation.x=r),this.rotation.x<-r&&(this.rotation.x=-r)}if(this.rotationQuaternion)this.rotation.lengthSquared()&&s._f.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)}i&&(Math.abs(this.cameraDirection.x){"use strict";i.d(t,{c:()=>n});var n=function(e,t,i){this.bu=e,this.bv=t,this.distance=i,this.faceId=0,this.subMeshId=0}},9626:(e,t,i)=>{"use strict";i.d(t,{p:()=>o});var n=i(2973),r=i(6738),o=function(){function e(){this._pickingUnavailable=!1,this.hit=!1,this.distance=0,this.pickedPoint=null,this.pickedMesh=null,this.bu=0,this.bv=0,this.faceId=-1,this.subMeshFaceId=-1,this.subMeshId=0,this.pickedSprite=null,this.thinInstanceIndex=-1,this.originMesh=null,this.ray=null}return e.prototype.getNormal=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!0),!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(r.o.NormalKind))return null;var i,o=this.pickedMesh.getIndices();if(!o)return null;if(t){var s=this.pickedMesh.getVerticesData(r.o.NormalKind),a=n.P.FromArray(s,3*o[3*this.faceId]),l=n.P.FromArray(s,3*o[3*this.faceId+1]),h=n.P.FromArray(s,3*o[3*this.faceId+2]);a=a.scale(this.bu),l=l.scale(this.bv),h=h.scale(1-this.bu-this.bv),i=new n.P(a.x+l.x+h.x,a.y+l.y+h.y,a.z+l.z+h.z)}else{var c=this.pickedMesh.getVerticesData(r.o.PositionKind),u=n.P.FromArray(c,3*o[3*this.faceId]),f=n.P.FromArray(c,3*o[3*this.faceId+1]),d=n.P.FromArray(c,3*o[3*this.faceId+2]),p=u.subtract(f),_=d.subtract(f);i=n.P.Cross(p,_)}if(e){var g=this.pickedMesh.getWorldMatrix();this.pickedMesh.nonUniformScaling&&(n.jp.Matrix[0].copyFrom(g),(g=n.jp.Matrix[0]).setTranslationFromFloats(0,0,0),g.invert(),g.transposeToRef(n.jp.Matrix[1]),g=n.jp.Matrix[1]),i=n.P.TransformNormal(i,g)}return i.normalize(),i},e.prototype.getTextureCoordinates=function(){if(!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(r.o.UVKind))return null;var e=this.pickedMesh.getIndices();if(!e)return null;var t=this.pickedMesh.getVerticesData(r.o.UVKind);if(!t)return null;var i=n.FM.FromArray(t,2*e[3*this.faceId]),o=n.FM.FromArray(t,2*e[3*this.faceId+1]),s=n.FM.FromArray(t,2*e[3*this.faceId+2]);return i=i.scale(this.bu),o=o.scale(this.bv),s=s.scale(1-this.bu-this.bv),new n.FM(i.x+o.x+s.x,i.y+o.y+s.y)},e}()},2520:(e,t,i)=>{"use strict";i.d(t,{j:()=>f});var n=i(8035),r=i(2973),o=i(2782),s=function(){function e(e,t,i){this.vectors=n.B.BuildArray(8,r.P.Zero),this.center=r.P.Zero(),this.centerWorld=r.P.Zero(),this.extendSize=r.P.Zero(),this.extendSizeWorld=r.P.Zero(),this.directions=n.B.BuildArray(3,r.P.Zero),this.vectorsWorld=n.B.BuildArray(8,r.P.Zero),this.minimumWorld=r.P.Zero(),this.maximumWorld=r.P.Zero(),this.minimum=r.P.Zero(),this.maximum=r.P.Zero(),this.reConstruct(e,t,i)}return e.prototype.reConstruct=function(e,t,i){var n=e.x,o=e.y,s=e.z,a=t.x,l=t.y,h=t.z,c=this.vectors;this.minimum.copyFromFloats(n,o,s),this.maximum.copyFromFloats(a,l,h),c[0].copyFromFloats(n,o,s),c[1].copyFromFloats(a,l,h),c[2].copyFromFloats(a,o,s),c[3].copyFromFloats(n,l,s),c[4].copyFromFloats(n,o,h),c[5].copyFromFloats(a,l,s),c[6].copyFromFloats(n,l,h),c[7].copyFromFloats(a,o,h),t.addToRef(e,this.center).scaleInPlace(.5),t.subtractToRef(e,this.extendSize).scaleInPlace(.5),this._worldMatrix=i||r.y3.IdentityReadOnly,this._update(this._worldMatrix)},e.prototype.scale=function(t){var i=e.TmpVector3,n=this.maximum.subtractToRef(this.minimum,i[0]),r=n.length();n.normalizeFromLength(r);var o=r*t,s=n.scaleInPlace(.5*o),a=this.center.subtractToRef(s,i[1]),l=this.center.addToRef(s,i[2]);return this.reConstruct(a,l,this._worldMatrix),this},e.prototype.getWorldMatrix=function(){return this._worldMatrix},e.prototype._update=function(e){var t=this.minimumWorld,i=this.maximumWorld,n=this.directions,o=this.vectorsWorld,s=this.vectors;if(e.isIdentity()){t.copyFrom(this.minimum),i.copyFrom(this.maximum);for(a=0;a<8;++a)o[a].copyFrom(s[a]);this.extendSizeWorld.copyFrom(this.extendSize),this.centerWorld.copyFrom(this.center)}else{t.setAll(Number.MAX_VALUE),i.setAll(-Number.MAX_VALUE);for(var a=0;a<8;++a){var l=o[a];r.P.TransformCoordinatesToRef(s[a],e,l),t.minimizeInPlace(l),i.maximizeInPlace(l)}i.subtractToRef(t,this.extendSizeWorld).scaleInPlace(.5),i.addToRef(t,this.centerWorld).scaleInPlace(.5)}r.P.FromArrayToRef(e.m,0,n[0]),r.P.FromArrayToRef(e.m,4,n[1]),r.P.FromArrayToRef(e.m,8,n[2]),this._worldMatrix=e},e.prototype.isInFrustum=function(t){return e.IsInFrustum(this.vectorsWorld,t)},e.prototype.isCompletelyInFrustum=function(t){return e.IsCompletelyInFrustum(this.vectorsWorld,t)},e.prototype.intersectsPoint=function(e){var t=this.minimumWorld,i=this.maximumWorld,n=t.x,r=t.y,s=t.z,a=i.x,l=i.y,h=i.z,c=e.x,u=e.y,f=e.z,d=-o.kn;return!(a-cc-n)&&(!(l-uu-r)&&!(h-ff-s))},e.prototype.intersectsSphere=function(t){return e.IntersectsSphere(this.minimumWorld,this.maximumWorld,t.centerWorld,t.radiusWorld)},e.prototype.intersectsMinMax=function(e,t){var i=this.minimumWorld,n=this.maximumWorld,r=i.x,o=i.y,s=i.z,a=n.x,l=n.y,h=n.z,c=e.x,u=e.y,f=e.z,d=t.x,p=t.y,_=t.z;return!(ad)&&(!(lp)&&!(h_))},e.Intersects=function(e,t){return e.intersectsMinMax(t.minimumWorld,t.maximumWorld)},e.IntersectsSphere=function(t,i,n,o){var s=e.TmpVector3[0];return r.P.ClampToRef(n,t,i,s),r.P.DistanceSquared(n,s)<=o*o},e.IsCompletelyInFrustum=function(e,t){for(var i=0;i<6;++i)for(var n=t[i],r=0;r<8;++r)if(n.dotCoordinate(e[r])<0)return!1;return!0},e.IsInFrustum=function(e,t){for(var i=0;i<6;++i){for(var n=!0,r=t[i],o=0;o<8;++o)if(r.dotCoordinate(e[o])>=0){n=!1;break}if(n)return!1}return!0},e.TmpVector3=n.B.BuildArray(3,r.P.Zero),e}(),a=function(){function e(e,t,i){this.center=r.P.Zero(),this.centerWorld=r.P.Zero(),this.minimum=r.P.Zero(),this.maximum=r.P.Zero(),this.reConstruct(e,t,i)}return e.prototype.reConstruct=function(e,t,i){this.minimum.copyFrom(e),this.maximum.copyFrom(t);var n=r.P.Distance(e,t);t.addToRef(e,this.center).scaleInPlace(.5),this.radius=.5*n,this._update(i||r.y3.IdentityReadOnly)},e.prototype.scale=function(t){var i=this.radius*t,n=e.TmpVector3,r=n[0].setAll(i),o=this.center.subtractToRef(r,n[1]),s=this.center.addToRef(r,n[2]);return this.reConstruct(o,s,this._worldMatrix),this},e.prototype.getWorldMatrix=function(){return this._worldMatrix},e.prototype._update=function(t){if(t.isIdentity())this.centerWorld.copyFrom(this.center),this.radiusWorld=this.radius;else{r.P.TransformCoordinatesToRef(this.center,t,this.centerWorld);var i=e.TmpVector3[0];r.P.TransformNormalFromFloatsToRef(1,1,1,t,i),this.radiusWorld=Math.max(Math.abs(i.x),Math.abs(i.y),Math.abs(i.z))*this.radius}},e.prototype.isInFrustum=function(e){for(var t=this.centerWorld,i=this.radiusWorld,n=0;n<6;n++)if(e[n].dotCoordinate(t)<=-i)return!1;return!0},e.prototype.isCenterInFrustum=function(e){for(var t=this.centerWorld,i=0;i<6;i++)if(e[i].dotCoordinate(t)<0)return!1;return!0},e.prototype.intersectsPoint=function(e){var t=r.P.DistanceSquared(this.centerWorld,e);return!(this.radiusWorld*this.radiusWorldh.max||h.min>l.max)},f=function(){function e(e,t,i){this._isLocked=!1,this.boundingBox=new s(e,t,i),this.boundingSphere=new a(e,t,i)}return e.prototype.reConstruct=function(e,t,i){this.boundingBox.reConstruct(e,t,i),this.boundingSphere.reConstruct(e,t,i)},Object.defineProperty(e.prototype,"minimum",{get:function(){return this.boundingBox.minimum},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maximum",{get:function(){return this.boundingBox.maximum},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLocked",{get:function(){return this._isLocked},set:function(e){this._isLocked=e},enumerable:!1,configurable:!0}),e.prototype.update=function(e){this._isLocked||(this.boundingBox._update(e),this.boundingSphere._update(e))},e.prototype.centerOn=function(t,i){var n=e.TmpVector3[0].copyFrom(t).subtractInPlace(i),r=e.TmpVector3[1].copyFrom(t).addInPlace(i);return this.boundingBox.reConstruct(n,r,this.boundingBox.getWorldMatrix()),this.boundingSphere.reConstruct(n,r,this.boundingBox.getWorldMatrix()),this},e.prototype.scale=function(e){return this.boundingBox.scale(e),this.boundingSphere.scale(e),this},e.prototype.isInFrustum=function(e,t){return void 0===t&&(t=0),!(2!==t&&3!==t||!this.boundingSphere.isCenterInFrustum(e))||!!this.boundingSphere.isInFrustum(e)&&(!(1!==t&&3!==t)||this.boundingBox.isInFrustum(e))},Object.defineProperty(e.prototype,"diagonalLength",{get:function(){var t=this.boundingBox;return t.maximumWorld.subtractToRef(t.minimumWorld,e.TmpVector3[0]).length()},enumerable:!1,configurable:!0}),e.prototype.isCompletelyInFrustum=function(e){return this.boundingBox.isCompletelyInFrustum(e)},e.prototype._checkCollision=function(e){return e._canDoCollision(this.boundingSphere.centerWorld,this.boundingSphere.radiusWorld,this.boundingBox.minimumWorld,this.boundingBox.maximumWorld)},e.prototype.intersectsPoint=function(e){return!!this.boundingSphere.centerWorld&&(!!this.boundingSphere.intersectsPoint(e)&&!!this.boundingBox.intersectsPoint(e))},e.prototype.intersects=function(e,t){if(!a.Intersects(this.boundingSphere,e.boundingSphere))return!1;if(!s.Intersects(this.boundingBox,e.boundingBox))return!1;if(!t)return!0;var i=this.boundingBox,n=e.boundingBox;return!!u(i.directions[0],i,n)&&(!!u(i.directions[1],i,n)&&(!!u(i.directions[2],i,n)&&(!!u(n.directions[0],i,n)&&(!!u(n.directions[1],i,n)&&(!!u(n.directions[2],i,n)&&(!!u(r.P.Cross(i.directions[0],n.directions[0]),i,n)&&(!!u(r.P.Cross(i.directions[0],n.directions[1]),i,n)&&(!!u(r.P.Cross(i.directions[0],n.directions[2]),i,n)&&(!!u(r.P.Cross(i.directions[1],n.directions[0]),i,n)&&(!!u(r.P.Cross(i.directions[1],n.directions[1]),i,n)&&(!!u(r.P.Cross(i.directions[1],n.directions[2]),i,n)&&(!!u(r.P.Cross(i.directions[2],n.directions[0]),i,n)&&(!!u(r.P.Cross(i.directions[2],n.directions[1]),i,n)&&!!u(r.P.Cross(i.directions[2],n.directions[2]),i,n))))))))))))))},e.TmpVector3=n.B.BuildArray(2,r.P.Zero),e}()},6135:(e,t,i)=>{"use strict";i(2131).B.prototype._readTexturePixels=function(e,t,i,n,r,o){void 0===n&&(n=-1),void 0===r&&(r=0),void 0===o&&(o=null);var s=this._gl;if(!s)throw new Error("Engine does not have gl rendering context.");if(!this._dummyFramebuffer){var a=s.createFramebuffer();if(!a)throw new Error("Unable to create dummy framebuffer");this._dummyFramebuffer=a}s.bindFramebuffer(s.FRAMEBUFFER,this._dummyFramebuffer),n>-1?s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+n,e._webGLTexture,r):s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,e._webGLTexture,r);var l=void 0!==e.type?this._getWebGLTextureType(e.type):s.UNSIGNED_BYTE;switch(l){case s.UNSIGNED_BYTE:o||(o=new Uint8Array(4*t*i)),l=s.UNSIGNED_BYTE;break;default:o||(o=new Float32Array(4*t*i)),l=s.FLOAT}return s.readPixels(0,0,t,i,s.RGBA,l,o),s.bindFramebuffer(s.FRAMEBUFFER,this._currentFramebuffer),o}},6593:(e,t,i)=>{"use strict";var n=i(655),r=i(7627),o=i(3734),s=i(7533),a=i(2131);a.B.prototype.createRenderTargetTexture=function(e,t){var i=new s.L;void 0!==t&&"object"==typeof t?(i.generateMipMaps=t.generateMipMaps,i.generateDepthBuffer=!!t.generateDepthBuffer,i.generateStencilBuffer=!!t.generateStencilBuffer,i.type=void 0===t.type?0:t.type,i.samplingMode=void 0===t.samplingMode?3:t.samplingMode,i.format=void 0===t.format?5:t.format):(i.generateMipMaps=t,i.generateDepthBuffer=!0,i.generateStencilBuffer=!1,i.type=0,i.samplingMode=3,i.format=5),(1!==i.type||this._caps.textureFloatLinearFiltering)&&(2!==i.type||this._caps.textureHalfFloatLinearFiltering)||(i.samplingMode=1),1!==i.type||this._caps.textureFloat||(i.type=0,o.Y.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type"));var n=this._gl,a=new r.l(this,r.S.RenderTarget),l=e.width||e,h=e.height||e,c=e.layers||0,u=this._getSamplingParameters(i.samplingMode,!!i.generateMipMaps),f=0!==c?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D,d=this._getRGBABufferInternalSizedFormat(i.type,i.format),p=this._getInternalFormat(i.format),_=this._getWebGLTextureType(i.type);this._bindTextureDirectly(f,a),0!==c?(a.is2DArray=!0,n.texImage3D(f,0,d,l,h,c,0,p,_,null)):n.texImage2D(f,0,d,l,h,0,p,_,null),n.texParameteri(f,n.TEXTURE_MAG_FILTER,u.mag),n.texParameteri(f,n.TEXTURE_MIN_FILTER,u.min),n.texParameteri(f,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(f,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),i.generateMipMaps&&this._gl.generateMipmap(f),this._bindTextureDirectly(f,null);var g=this._currentFramebuffer,m=n.createFramebuffer();return this._bindUnboundFramebuffer(m),a._depthStencilBuffer=this._setupFramebufferDepthAttachments(!!i.generateStencilBuffer,i.generateDepthBuffer,l,h),a.is2DArray||n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,a._webGLTexture,0),this._bindUnboundFramebuffer(g),a._framebuffer=m,a.baseWidth=l,a.baseHeight=h,a.width=l,a.height=h,a.depth=c,a.isReady=!0,a.samples=1,a.generateMipMaps=!!i.generateMipMaps,a.samplingMode=i.samplingMode,a.type=i.type,a.format=i.format,a._generateDepthBuffer=i.generateDepthBuffer,a._generateStencilBuffer=!!i.generateStencilBuffer,this._internalTexturesCache.push(a),a},a.B.prototype.createDepthStencilTexture=function(e,t){if(t.isCube){var i=e.width||e;return this._createDepthStencilCubeTexture(i,t)}return this._createDepthStencilTexture(e,t)},a.B.prototype._createDepthStencilTexture=function(e,t){var i=this._gl,s=e.layers||0,a=0!==s?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D,l=new r.l(this,r.S.Depth);if(!this._caps.depthTextureExtension)return o.Y.Error("Depth texture is not supported by your browser or hardware."),l;var h=(0,n.pi)({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t);this._bindTextureDirectly(a,l,!0),this._setupDepthStencilTexture(l,e,h.generateStencil,h.bilinearFiltering,h.comparisonFunction);var c=h.generateStencil?i.UNSIGNED_INT_24_8:i.UNSIGNED_INT,u=h.generateStencil?i.DEPTH_STENCIL:i.DEPTH_COMPONENT,f=u;return this.webGLVersion>1&&(f=h.generateStencil?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24),l.is2DArray?i.texImage3D(a,0,f,l.width,l.height,s,0,u,c,null):i.texImage2D(a,0,f,l.width,l.height,0,u,c,null),this._bindTextureDirectly(a,null),l}},1744:(e,t,i)=>{"use strict";var n=i(655),r=i(7627),o=i(3734);i(2131).B.prototype.createRenderTargetCubeTexture=function(e,t){var i=(0,n.pi)({generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:0,samplingMode:3,format:5},t);i.generateStencilBuffer=i.generateDepthBuffer&&i.generateStencilBuffer,(1!==i.type||this._caps.textureFloatLinearFiltering)&&(2!==i.type||this._caps.textureHalfFloatLinearFiltering)||(i.samplingMode=1);var s=this._gl,a=new r.l(this,r.S.RenderTarget);this._bindTextureDirectly(s.TEXTURE_CUBE_MAP,a,!0);var l=this._getSamplingParameters(i.samplingMode,i.generateMipMaps);1!==i.type||this._caps.textureFloat||(i.type=0,o.Y.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type")),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MAG_FILTER,l.mag),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MIN_FILTER,l.min),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);for(var h=0;h<6;h++)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,this._getRGBABufferInternalSizedFormat(i.type,i.format),e,e,0,this._getInternalFormat(i.format),this._getWebGLTextureType(i.type),null);var c=s.createFramebuffer();return this._bindUnboundFramebuffer(c),a._depthStencilBuffer=this._setupFramebufferDepthAttachments(i.generateStencilBuffer,i.generateDepthBuffer,e,e),i.generateMipMaps&&s.generateMipmap(s.TEXTURE_CUBE_MAP),this._bindTextureDirectly(s.TEXTURE_CUBE_MAP,null),this._bindUnboundFramebuffer(null),a._framebuffer=c,a.width=e,a.height=e,a.isReady=!0,a.isCube=!0,a.samples=1,a.generateMipMaps=i.generateMipMaps,a.samplingMode=i.samplingMode,a.type=i.type,a.format=i.format,a._generateDepthBuffer=i.generateDepthBuffer,a._generateStencilBuffer=i.generateStencilBuffer,this._internalTexturesCache.push(a),a}},3857:(e,t,i)=>{"use strict";i.d(t,{L:()=>m});var n=i(1373),r=function(){function e(){this.children=[]}return e.prototype.isValid=function(e){return!0},e.prototype.process=function(e,t){var i="";if(this.line){var r=this.line,o=t.processor;if(o){if(o.lineProcessor&&(r=o.lineProcessor(r,t.isFragment)),o.attributeProcessor&&n.M.StartsWith(this.line,"attribute"))r=o.attributeProcessor(this.line);else if(o.varyingProcessor&&n.M.StartsWith(this.line,"varying"))r=o.varyingProcessor(this.line,t.isFragment);else if((o.uniformProcessor||o.uniformBufferProcessor)&&n.M.StartsWith(this.line,"uniform")){/uniform (.+) (.+)/.test(this.line)?o.uniformProcessor&&(r=o.uniformProcessor(this.line,t.isFragment)):o.uniformBufferProcessor&&(r=o.uniformBufferProcessor(this.line,t.isFragment),t.lookForClosingBracketForUniformBuffer=!0)}o.endOfUniformBufferProcessor&&t.lookForClosingBracketForUniformBuffer&&-1!==this.line.indexOf("}")&&(t.lookForClosingBracketForUniformBuffer=!1,r=o.endOfUniformBufferProcessor(this.line,t.isFragment))}i+=r+"\r\n"}return this.children.forEach((function(n){i+=n.process(e,t)})),this.additionalDefineKey&&(e[this.additionalDefineKey]=this.additionalDefineValue||"true"),i},e}(),o=function(){function e(){}return Object.defineProperty(e.prototype,"currentLine",{get:function(){return this._lines[this.lineIndex]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"canRead",{get:function(){return this.lineIndex1){for(r();-1!==n&&e._OperatorPriority[s()]>=e._OperatorPriority[u];)i.push(a());o(u),l++}else h+=c;l++}for(r();-1!==n;)"("===s()?a():i.push(a());return i},e._OperatorPriority={")":0,"(":1,"||":2,"&&":3},e._Stack=["","","","","","","","","","","","","","","","","","","",""],e}(),c=function(e){function t(t,i){void 0===i&&(i=!1);var n=e.call(this)||this;return n.define=t,n.not=i,n}return(0,s.ZT)(t,e),t.prototype.isTrue=function(e){var t=void 0!==e[this.define];return this.not&&(t=!t),t},t}(h),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,s.ZT)(t,e),t.prototype.isTrue=function(e){return this.leftOperand.isTrue(e)||this.rightOperand.isTrue(e)},t}(h),f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,s.ZT)(t,e),t.prototype.isTrue=function(e){return this.leftOperand.isTrue(e)&&this.rightOperand.isTrue(e)},t}(h),d=function(e){function t(t,i,n){var r=e.call(this)||this;return r.define=t,r.operand=i,r.testValue=n,r}return(0,s.ZT)(t,e),t.prototype.isTrue=function(e){var t=e[this.define];void 0===t&&(t=this.define);var i=!1,n=parseInt(t),r=parseInt(this.testValue);switch(this.operand){case">":i=n>r;break;case"<":i=n=":i=n>=r;break;case"==":i=n===r}return i},t}(h),p=i(106),_=/defined\s*?\((.+?)\)/g,g=/defined\s*?\[(.+?)\]/g,m=function(){function e(){}return e.Process=function(e,t,i,n){var r=this;this._ProcessIncludes(e,t,(function(e){var o=r._ProcessShaderConversion(e,t,n);i(o)}))},e._ProcessPrecision=function(e,t){var i=t.shouldUseHighPrecisionShader;return-1===e.indexOf("precision highp float")?e=i?"precision highp float;\n"+e:"precision mediump float;\n"+e:i||(e=e.replace("precision highp float","precision mediump float")),e},e._ExtractOperation=function(e){var t=/defined\((.+)\)/.exec(e);if(t&&t.length)return new c(t[1].trim(),"!"===e[0]);for(var i="",n=0,r=0,o=["==",">=","<=","<",">"];r-1));r++);if(-1===n)return new c(e);var s=e.substring(0,n).trim(),a=e.substring(n+i.length).trim();return new d(s,i,a)},e._BuildSubExpression=function(e){e=e.replace(_,"defined[$1]");for(var t=[],i=0,n=h.infixToPostfix(e);i=2){var o=t[t.length-1],s=t[t.length-2];t.length-=2;var a="&&"==r?new f:new u;"string"==typeof o&&(o=o.replace(g,"defined($1)")),"string"==typeof s&&(s=s.replace(g,"defined($1)")),a.leftOperand="string"==typeof s?this._ExtractOperation(s):s,a.rightOperand="string"==typeof o?this._ExtractOperation(o):o,t.push(a)}}var l=t[t.length-1];return"string"==typeof l&&(l=l.replace(g,"defined($1)")),"string"==typeof l?this._ExtractOperation(l):l},e._BuildExpression=function(e,t){var i=new l,n=e.substring(0,t),r=e.substring(t);return r=r.substring(0,(r.indexOf("//")+1||r.length+1)-1).trim(),i.testExpression="#ifdef"===n?new c(r):"#ifndef"===n?new c(r,!0):this._BuildSubExpression(r),i},e._MoveCursorWithinIf=function(e,t,i){for(var n=e.currentLine;this._MoveCursor(e,i);){var o=(n=e.currentLine).substring(0,5).toLowerCase();if("#else"===o){var s=new r;return t.children.push(s),void this._MoveCursor(e,s)}if("#elif"===o){var a=this._BuildExpression(n,5);t.children.push(a),i=a}}},e._MoveCursor=function(e,t){for(;e.canRead;){e.lineIndex++;var i=e.currentLine,n=/(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/.exec(i);if(n&&n.length){switch(n[0]){case"#ifdef":var o=new a;t.children.push(o);var s=this._BuildExpression(i,6);o.children.push(s),this._MoveCursorWithinIf(e,o,s);break;case"#else":case"#elif":return!0;case"#endif":return!1;case"#ifndef":o=new a;t.children.push(o);s=this._BuildExpression(i,7);o.children.push(s),this._MoveCursorWithinIf(e,o,s);break;case"#if":o=new a,s=this._BuildExpression(i,3);t.children.push(o),o.children.push(s),this._MoveCursorWithinIf(e,o,s)}}else{var l=new r;if(l.line=i,t.children.push(l),"#"===i[0]&&"d"===i[1]){var h=i.replace(";","").split(" ");l.additionalDefineKey=h[1],3===h.length&&(l.additionalDefineValue=h[2])}}}return!1},e._EvaluatePreProcessors=function(e,t,i){var n=new r,s=new o;return s.lineIndex=-1,s.lines=e.split("\n"),this._MoveCursor(s,n),n.process(t,i)},e._PreparePreProcessors=function(e){for(var t={},i=0,n=e.defines;i1?r[1]:""}return t.GL_ES="true",t.__VERSION__=e.version,t[e.platformName]="true",t},e._ProcessShaderConversion=function(e,t,i){var n=this._ProcessPrecision(e,t);if(!t.processor)return n;if(-1!==n.indexOf("#version 3"))return n.replace("#version 300 es","");var r=t.defines,o=this._PreparePreProcessors(t);return t.processor.preProcessor&&(n=t.processor.preProcessor(n,r,t.isFragment)),n=this._EvaluatePreProcessors(n,o,t),t.processor.postProcessor&&(n=t.processor.postProcessor(n,r,t.isFragment,i)),n},e._ProcessIncludes=function(t,i,n){for(var r=this,o=/#include<(.+)>(\((.*)\))*(\[(.*)\])*/g,s=o.exec(t),a=new String(t),l=!1;null!=s;){var h=s[1];if(-1!==h.indexOf("__decl__")&&(h=h.replace(/__decl__/,""),i.supportsUniformBuffers&&(h=(h=h.replace(/Vertex/,"Ubo")).replace(/Fragment/,"Ubo")),h+="Declaration"),!i.includesShadersStore[h]){var c=i.shadersRepository+"ShadersInclude/"+h+".fx";return void e._FileToolsLoadFile(c,(function(e){i.includesShadersStore[h]=e,r._ProcessIncludes(a,i,n)}))}var u=i.includesShadersStore[h];if(s[2])for(var f=s[3].split(","),d=0;d=0,s=o.exec(t)}l?this._ProcessIncludes(a.toString(),i,n):n(a)},e._FileToolsLoadFile=function(e,t,i,n,r,o){throw p.f.WarnImport("FileTools")},e}()},3393:(e,t,i)=>{"use strict";i.d(t,{g:()=>n});var n=function(){function e(){}return e.ALPHA_DISABLE=0,e.ALPHA_ADD=1,e.ALPHA_COMBINE=2,e.ALPHA_SUBTRACT=3,e.ALPHA_MULTIPLY=4,e.ALPHA_MAXIMIZED=5,e.ALPHA_ONEONE=6,e.ALPHA_PREMULTIPLIED=7,e.ALPHA_PREMULTIPLIED_PORTERDUFF=8,e.ALPHA_INTERPOLATE=9,e.ALPHA_SCREENMODE=10,e.ALPHA_ONEONE_ONEONE=11,e.ALPHA_ALPHATOCOLOR=12,e.ALPHA_REVERSEONEMINUS=13,e.ALPHA_SRC_DSTONEMINUSSRCALPHA=14,e.ALPHA_ONEONE_ONEZERO=15,e.ALPHA_EXCLUSION=16,e.ALPHA_EQUATION_ADD=0,e.ALPHA_EQUATION_SUBSTRACT=1,e.ALPHA_EQUATION_REVERSE_SUBTRACT=2,e.ALPHA_EQUATION_MAX=3,e.ALPHA_EQUATION_MIN=4,e.ALPHA_EQUATION_DARKEN=5,e.DELAYLOADSTATE_NONE=0,e.DELAYLOADSTATE_LOADED=1,e.DELAYLOADSTATE_LOADING=2,e.DELAYLOADSTATE_NOTLOADED=4,e.NEVER=512,e.ALWAYS=519,e.LESS=513,e.EQUAL=514,e.LEQUAL=515,e.GREATER=516,e.GEQUAL=518,e.NOTEQUAL=517,e.KEEP=7680,e.REPLACE=7681,e.INCR=7682,e.DECR=7683,e.INVERT=5386,e.INCR_WRAP=34055,e.DECR_WRAP=34056,e.TEXTURE_CLAMP_ADDRESSMODE=0,e.TEXTURE_WRAP_ADDRESSMODE=1,e.TEXTURE_MIRROR_ADDRESSMODE=2,e.TEXTUREFORMAT_ALPHA=0,e.TEXTUREFORMAT_LUMINANCE=1,e.TEXTUREFORMAT_LUMINANCE_ALPHA=2,e.TEXTUREFORMAT_RGB=4,e.TEXTUREFORMAT_RGBA=5,e.TEXTUREFORMAT_RED=6,e.TEXTUREFORMAT_R=6,e.TEXTUREFORMAT_RG=7,e.TEXTUREFORMAT_RED_INTEGER=8,e.TEXTUREFORMAT_R_INTEGER=8,e.TEXTUREFORMAT_RG_INTEGER=9,e.TEXTUREFORMAT_RGB_INTEGER=10,e.TEXTUREFORMAT_RGBA_INTEGER=11,e.TEXTURETYPE_UNSIGNED_BYTE=0,e.TEXTURETYPE_UNSIGNED_INT=0,e.TEXTURETYPE_FLOAT=1,e.TEXTURETYPE_HALF_FLOAT=2,e.TEXTURETYPE_BYTE=3,e.TEXTURETYPE_SHORT=4,e.TEXTURETYPE_UNSIGNED_SHORT=5,e.TEXTURETYPE_INT=6,e.TEXTURETYPE_UNSIGNED_INTEGER=7,e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=8,e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=9,e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=10,e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=11,e.TEXTURETYPE_UNSIGNED_INT_24_8=12,e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=13,e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=14,e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=15,e.TEXTURE_NEAREST_SAMPLINGMODE=1,e.TEXTURE_NEAREST_NEAREST=1,e.TEXTURE_BILINEAR_SAMPLINGMODE=2,e.TEXTURE_LINEAR_LINEAR=2,e.TEXTURE_TRILINEAR_SAMPLINGMODE=3,e.TEXTURE_LINEAR_LINEAR_MIPLINEAR=3,e.TEXTURE_NEAREST_NEAREST_MIPNEAREST=4,e.TEXTURE_NEAREST_LINEAR_MIPNEAREST=5,e.TEXTURE_NEAREST_LINEAR_MIPLINEAR=6,e.TEXTURE_NEAREST_LINEAR=7,e.TEXTURE_NEAREST_NEAREST_MIPLINEAR=8,e.TEXTURE_LINEAR_NEAREST_MIPNEAREST=9,e.TEXTURE_LINEAR_NEAREST_MIPLINEAR=10,e.TEXTURE_LINEAR_LINEAR_MIPNEAREST=11,e.TEXTURE_LINEAR_NEAREST=12,e.TEXTURE_EXPLICIT_MODE=0,e.TEXTURE_SPHERICAL_MODE=1,e.TEXTURE_PLANAR_MODE=2,e.TEXTURE_CUBIC_MODE=3,e.TEXTURE_PROJECTION_MODE=4,e.TEXTURE_SKYBOX_MODE=5,e.TEXTURE_INVCUBIC_MODE=6,e.TEXTURE_EQUIRECTANGULAR_MODE=7,e.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=8,e.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,e.TEXTURE_FILTERING_QUALITY_OFFLINE=4096,e.TEXTURE_FILTERING_QUALITY_HIGH=64,e.TEXTURE_FILTERING_QUALITY_MEDIUM=16,e.TEXTURE_FILTERING_QUALITY_LOW=8,e.SCALEMODE_FLOOR=1,e.SCALEMODE_NEAREST=2,e.SCALEMODE_CEILING=3,e.MATERIAL_TextureDirtyFlag=1,e.MATERIAL_LightDirtyFlag=2,e.MATERIAL_FresnelDirtyFlag=4,e.MATERIAL_AttributesDirtyFlag=8,e.MATERIAL_MiscDirtyFlag=16,e.MATERIAL_PrePassDirtyFlag=32,e.MATERIAL_AllDirtyFlag=63,e.MATERIAL_TriangleFillMode=0,e.MATERIAL_WireFrameFillMode=1,e.MATERIAL_PointFillMode=2,e.MATERIAL_PointListDrawMode=3,e.MATERIAL_LineListDrawMode=4,e.MATERIAL_LineLoopDrawMode=5,e.MATERIAL_LineStripDrawMode=6,e.MATERIAL_TriangleStripDrawMode=7,e.MATERIAL_TriangleFanDrawMode=8,e.MATERIAL_ClockWiseSideOrientation=0,e.MATERIAL_CounterClockWiseSideOrientation=1,e.ACTION_NothingTrigger=0,e.ACTION_OnPickTrigger=1,e.ACTION_OnLeftPickTrigger=2,e.ACTION_OnRightPickTrigger=3,e.ACTION_OnCenterPickTrigger=4,e.ACTION_OnPickDownTrigger=5,e.ACTION_OnDoublePickTrigger=6,e.ACTION_OnPickUpTrigger=7,e.ACTION_OnPickOutTrigger=16,e.ACTION_OnLongPressTrigger=8,e.ACTION_OnPointerOverTrigger=9,e.ACTION_OnPointerOutTrigger=10,e.ACTION_OnEveryFrameTrigger=11,e.ACTION_OnIntersectionEnterTrigger=12,e.ACTION_OnIntersectionExitTrigger=13,e.ACTION_OnKeyDownTrigger=14,e.ACTION_OnKeyUpTrigger=15,e.PARTICLES_BILLBOARDMODE_Y=2,e.PARTICLES_BILLBOARDMODE_ALL=7,e.PARTICLES_BILLBOARDMODE_STRETCHED=8,e.MESHES_CULLINGSTRATEGY_STANDARD=0,e.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY=1,e.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION=2,e.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY=3,e.SCENELOADER_NO_LOGGING=0,e.SCENELOADER_MINIMAL_LOGGING=1,e.SCENELOADER_SUMMARY_LOGGING=2,e.SCENELOADER_DETAILED_LOGGING=3,e.PREPASS_IRRADIANCE_TEXTURE_TYPE=0,e.PREPASS_POSITION_TEXTURE_TYPE=1,e.PREPASS_VELOCITY_TEXTURE_TYPE=2,e.PREPASS_REFLECTIVITY_TEXTURE_TYPE=3,e.PREPASS_COLOR_TEXTURE_TYPE=4,e.PREPASS_DEPTHNORMAL_TEXTURE_TYPE=5,e.PREPASS_ALBEDO_TEXTURE_TYPE=6,e}()},2905:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Engine:()=>_});var n=i(655),r=i(475),o=i(6327),s=i(2733),a=i(106),l=i(2131),h=i(5273),c=function(){function e(e){void 0===e&&(e=30),this._enabled=!0,this._rollingFrameTime=new u(e)}return e.prototype.sampleFrame=function(e){if(void 0===e&&(e=h.F.Now),this._enabled){if(null!=this._lastFrameTimeMs){var t=e-this._lastFrameTimeMs;this._rollingFrameTime.add(t)}this._lastFrameTimeMs=e}},Object.defineProperty(e.prototype,"averageFrameTime",{get:function(){return this._rollingFrameTime.average},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageFrameTimeVariance",{get:function(){return this._rollingFrameTime.variance},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"instantaneousFrameTime",{get:function(){return this._rollingFrameTime.history(0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageFPS",{get:function(){return 1e3/this._rollingFrameTime.average},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"instantaneousFPS",{get:function(){var e=this._rollingFrameTime.history(0);return 0===e?0:1e3/e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSaturated",{get:function(){return this._rollingFrameTime.isSaturated()},enumerable:!1,configurable:!0}),e.prototype.enable=function(){this._enabled=!0},e.prototype.disable=function(){this._enabled=!1,this._lastFrameTimeMs=null},Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this._lastFrameTimeMs=null,this._rollingFrameTime.reset()},e}(),u=function(){function e(e){this._samples=new Array(e),this.reset()}return e.prototype.add=function(e){var t;if(this.isSaturated()){var i=this._samples[this._pos];t=i-this.average,this.average-=t/(this._sampleCount-1),this._m2-=t*(i-this.average)}else this._sampleCount++;t=e-this.average,this.average+=t/this._sampleCount,this._m2+=t*(e-this.average),this.variance=this._m2/(this._sampleCount-1),this._samples[this._pos]=e,this._pos++,this._pos%=this._samples.length},e.prototype.history=function(e){if(e>=this._sampleCount||e>=this._samples.length)return 0;var t=this._wrapPosition(this._pos-1);return this._samples[this._wrapPosition(t-e)]},e.prototype.isSaturated=function(){return this._sampleCount>=this._samples.length},e.prototype.reset=function(){this.average=0,this.variance=0,this._sampleCount=0,this._pos=0,this._m2=0},e.prototype._wrapPosition=function(e){var t=this._samples.length;return(e%t+t)%t},e}(),f=i(1952),d=i(5146),p=i(3734);l.B.prototype.setAlphaConstants=function(e,t,i,n){this._alphaState.setAlphaBlendConstants(e,t,i,n)},l.B.prototype.setAlphaMode=function(e,t){if(void 0===t&&(t=!1),this._alphaMode!==e){switch(e){case 0:this._alphaState.alphaBlend=!1;break;case 7:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 8:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case 2:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 6:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 1:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 3:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 4:this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR,this._gl.ZERO,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 5:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 9:this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR,this._gl.ONE_MINUS_CONSTANT_COLOR,this._gl.CONSTANT_ALPHA,this._gl.ONE_MINUS_CONSTANT_ALPHA),this._alphaState.alphaBlend=!0;break;case 10:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case 11:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case 12:this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA,this._gl.ONE,this._gl.ZERO,this._gl.ZERO),this._alphaState.alphaBlend=!0;break;case 13:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE_MINUS_DST_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case 14:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case 15:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ONE,this._gl.ZERO),this._alphaState.alphaBlend=!0;break;case 16:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0}t||(this.depthCullingState.depthMask=0===e),this._alphaMode=e}},l.B.prototype.getAlphaMode=function(){return this._alphaMode},l.B.prototype.setAlphaEquation=function(e){if(this._alphaEquation!==e){switch(e){case 0:this._alphaState.setAlphaEquationParameters(this._gl.FUNC_ADD,this._gl.FUNC_ADD);break;case 1:this._alphaState.setAlphaEquationParameters(this._gl.FUNC_SUBTRACT,this._gl.FUNC_SUBTRACT);break;case 2:this._alphaState.setAlphaEquationParameters(this._gl.FUNC_REVERSE_SUBTRACT,this._gl.FUNC_REVERSE_SUBTRACT);break;case 3:this._alphaState.setAlphaEquationParameters(this._gl.MAX,this._gl.MAX);break;case 4:this._alphaState.setAlphaEquationParameters(this._gl.MIN,this._gl.MIN);break;case 5:this._alphaState.setAlphaEquationParameters(this._gl.MIN,this._gl.FUNC_ADD)}this._alphaEquation=e}},l.B.prototype.getAlphaEquation=function(){return this._alphaEquation};i(6135);l.B.prototype.updateDynamicIndexBuffer=function(e,t,i){var n;void 0===i&&(i=0),this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER]=null,this.bindIndexBuffer(e),n=t instanceof Uint16Array||t instanceof Uint32Array?t:e.is32Bits?new Uint32Array(t):new Uint16Array(t),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,n,this._gl.DYNAMIC_DRAW),this._resetIndexBufferBinding()},l.B.prototype.updateDynamicVertexBuffer=function(e,t,i,n){this.bindArrayBuffer(e),void 0===i&&(i=0);var r=t.length||t.byteLength;void 0===n||n>=r&&0===i?t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,new Float32Array(t)):this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,t):t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,new Float32Array(t).subarray(i,i+n)):(t=t instanceof ArrayBuffer?new Uint8Array(t,i,n):new Uint8Array(t.buffer,t.byteOffset+i,n),this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t)),this._resetVertexBufferBinding()};var _=function(e){function t(i,n,s,a){void 0===a&&(a=!1);var l=e.call(this,i,n,s,a)||this;if(l.enableOfflineSupport=!1,l.disableManifestCheck=!1,l.scenes=new Array,l.onNewSceneAddedObservable=new r.y$,l.postProcesses=new Array,l.isPointerLock=!1,l.onResizeObservable=new r.y$,l.onCanvasBlurObservable=new r.y$,l.onCanvasFocusObservable=new r.y$,l.onCanvasPointerOutObservable=new r.y$,l.onBeginFrameObservable=new r.y$,l.customAnimationFrameRequester=null,l.onEndFrameObservable=new r.y$,l.onBeforeShaderCompilationObservable=new r.y$,l.onAfterShaderCompilationObservable=new r.y$,l._deterministicLockstep=!1,l._lockstepMaxSteps=4,l._timeStep=1/60,l._fps=60,l._deltaTime=0,l._drawCalls=new f.z,l.canvasTabIndex=1,l.disablePerformanceMonitorInBackground=!1,l._performanceMonitor=new c,t.Instances.push(l),!i)return l;if(s=l._creationOptions,i.getContext){var h=i;if(l._onCanvasFocus=function(){l.onCanvasFocusObservable.notifyObservers(l)},l._onCanvasBlur=function(){l.onCanvasBlurObservable.notifyObservers(l)},h.addEventListener("focus",l._onCanvasFocus),h.addEventListener("blur",l._onCanvasBlur),l._onBlur=function(){l.disablePerformanceMonitorInBackground&&l._performanceMonitor.disable(),l._windowIsBackground=!0},l._onFocus=function(){l.disablePerformanceMonitorInBackground&&l._performanceMonitor.enable(),l._windowIsBackground=!1},l._onCanvasPointerOut=function(e){l.onCanvasPointerOutObservable.notifyObservers(e)},h.addEventListener("pointerout",l._onCanvasPointerOut),o.M.IsWindowObjectExist()){var u=l.getHostWindow();u.addEventListener("blur",l._onBlur),u.addEventListener("focus",l._onFocus);var d=document;l._onFullscreenChange=function(){void 0!==d.fullscreen?l.isFullscreen=d.fullscreen:void 0!==d.mozFullScreen?l.isFullscreen=d.mozFullScreen:void 0!==d.webkitIsFullScreen?l.isFullscreen=d.webkitIsFullScreen:void 0!==d.msIsFullScreen&&(l.isFullscreen=d.msIsFullScreen),l.isFullscreen&&l._pointerLockRequested&&h&&t._RequestPointerlock(h)},document.addEventListener("fullscreenchange",l._onFullscreenChange,!1),document.addEventListener("mozfullscreenchange",l._onFullscreenChange,!1),document.addEventListener("webkitfullscreenchange",l._onFullscreenChange,!1),document.addEventListener("msfullscreenchange",l._onFullscreenChange,!1),l._onPointerLockChange=function(){l.isPointerLock=d.mozPointerLockElement===h||d.webkitPointerLockElement===h||d.msPointerLockElement===h||d.pointerLockElement===h},document.addEventListener("pointerlockchange",l._onPointerLockChange,!1),document.addEventListener("mspointerlockchange",l._onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",l._onPointerLockChange,!1),document.addEventListener("webkitpointerlockchange",l._onPointerLockChange,!1),!t.audioEngine&&s.audioEngine&&t.AudioEngineFactory&&(t.audioEngine=t.AudioEngineFactory(l.getRenderingCanvas()))}l._connectVREvents(),l.enableOfflineSupport=void 0!==t.OfflineProviderFactory,s.doNotHandleTouchAction||l._disableTouchAction(),l._deterministicLockstep=!!s.deterministicLockstep,l._lockstepMaxSteps=s.lockstepMaxSteps||0,l._timeStep=s.timeStep||1/60}return l._prepareVRComponent(),s.autoEnableWebVR&&l.initWebVR(),l}return(0,n.ZT)(t,e),Object.defineProperty(t,"NpmPackage",{get:function(){return l.B.NpmPackage},enumerable:!1,configurable:!0}),Object.defineProperty(t,"Version",{get:function(){return l.B.Version},enumerable:!1,configurable:!0}),Object.defineProperty(t,"Instances",{get:function(){return s.l.Instances},enumerable:!1,configurable:!0}),Object.defineProperty(t,"LastCreatedEngine",{get:function(){return s.l.LastCreatedEngine},enumerable:!1,configurable:!0}),Object.defineProperty(t,"LastCreatedScene",{get:function(){return s.l.LastCreatedScene},enumerable:!1,configurable:!0}),t.MarkAllMaterialsAsDirty=function(e,i){for(var n=0;n0?this.customAnimationFrameRequester?(this.customAnimationFrameRequester.requestID=this._queueNewFrame(this.customAnimationFrameRequester.renderFunction||this._boundRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this.isVRPresenting()?this._requestVRFrame():this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1},t.prototype._renderViews=function(){return!1},t.prototype.switchFullscreen=function(e){this.isFullscreen?this.exitFullscreen():this.enterFullscreen(e)},t.prototype.enterFullscreen=function(e){this.isFullscreen||(this._pointerLockRequested=e,this._renderingCanvas&&t._RequestFullscreen(this._renderingCanvas))},t.prototype.exitFullscreen=function(){this.isFullscreen&&t._ExitFullscreen()},t.prototype.enterPointerlock=function(){this._renderingCanvas&&t._RequestPointerlock(this._renderingCanvas)},t.prototype.exitPointerlock=function(){t._ExitPointerlock()},t.prototype.beginFrame=function(){this._measureFps(),this.onBeginFrameObservable.notifyObservers(this),e.prototype.beginFrame.call(this)},t.prototype.endFrame=function(){e.prototype.endFrame.call(this),this._submitVRFrame(),this.onEndFrameObservable.notifyObservers(this)},t.prototype.resize=function(){this.isVRPresenting()||e.prototype.resize.call(this)},t.prototype.setSize=function(t,i){if(!this._renderingCanvas)return!1;if(!e.prototype.setSize.call(this,t,i))return!1;if(this.scenes){for(var n=0;n1&&r){var s=this.createTransformFeedback();this.bindTransformFeedback(s),this.setTranformFeedbackVaryings(o,r),e.transformFeedback=s}return n.linkProgram(o),this.webGLVersion>1&&r&&this.bindTransformFeedback(null),e.context=n,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),o},t.prototype._releaseTexture=function(t){e.prototype._releaseTexture.call(this,t),this.scenes.forEach((function(e){e.postProcesses.forEach((function(e){e._outputTexture==t&&(e._outputTexture=null)})),e.cameras.forEach((function(e){e._postProcesses.forEach((function(e){e&&e._outputTexture==t&&(e._outputTexture=null)}))}))}))},t.prototype._rescaleTexture=function(e,i,n,r,o){var s=this;this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,this._gl.LINEAR),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,this._gl.LINEAR),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_S,this._gl.CLAMP_TO_EDGE),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_T,this._gl.CLAMP_TO_EDGE);var a=this.createRenderTargetTexture({width:i.width,height:i.height},{generateMipMaps:!1,type:0,samplingMode:2,generateDepthBuffer:!1,generateStencilBuffer:!1});!this._rescalePostProcess&&t._RescalePostProcessFactory&&(this._rescalePostProcess=t._RescalePostProcessFactory(this)),this._rescalePostProcess.getEffect().executeWhenCompiled((function(){s._rescalePostProcess.onApply=function(t){t._bindTexture("textureSampler",e)};var t=n;t||(t=s.scenes[s.scenes.length-1]),t.postProcessManager.directRender([s._rescalePostProcess],a,!0),s._bindTextureDirectly(s._gl.TEXTURE_2D,i,!0),s._gl.copyTexImage2D(s._gl.TEXTURE_2D,0,r,0,0,i.width,i.height,0),s.unBindFramebuffer(a),s._releaseTexture(a),o&&o()}))},t.prototype.getFps=function(){return this._fps},t.prototype.getDeltaTime=function(){return this._deltaTime},t.prototype._measureFps=function(){this._performanceMonitor.sampleFrame(),this._fps=this._performanceMonitor.averageFPS,this._deltaTime=this._performanceMonitor.instantaneousFrameTime||0},t.prototype._uploadImageToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var r=this._gl,o=this._getWebGLTextureType(e.type),s=this._getInternalFormat(e.format),a=this._getRGBABufferInternalSizedFormat(e.type,s),l=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(l,e,!0),this._unpackFlipY(e.invertY);var h=r.TEXTURE_2D;e.isCube&&(h=r.TEXTURE_CUBE_MAP_POSITIVE_X+i),r.texImage2D(h,n,a,s,o,t),this._bindTextureDirectly(l,null,!0)},t.prototype.updateRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e)return 1;if(e.samples===t)return t;var i=this._gl;if(t=Math.min(t,this.getCaps().maxMSAASamples),e._depthStencilBuffer&&(i.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(i.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),e._MSAARenderBuffer&&(i.deleteRenderbuffer(e._MSAARenderBuffer),e._MSAARenderBuffer=null),t>1&&i.renderbufferStorageMultisample){var n=i.createFramebuffer();if(!n)throw new Error("Unable to create multi sampled framebuffer");e._MSAAFramebuffer=n,this._bindUnboundFramebuffer(e._MSAAFramebuffer);var r=i.createRenderbuffer();if(!r)throw new Error("Unable to create multi sampled framebuffer");i.bindRenderbuffer(i.RENDERBUFFER,r),i.renderbufferStorageMultisample(i.RENDERBUFFER,t,this._getRGBAMultiSampleBufferFormat(e.type),e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,r),e._MSAARenderBuffer=r}else this._bindUnboundFramebuffer(e._framebuffer);return e.samples=t,e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.width,e.height,t),this._bindUnboundFramebuffer(null),t},t.prototype.updateTextureComparisonFunction=function(e,t){if(1!==this.webGLVersion){var i=this._gl;e.isCube?(this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,e,!0),0===t?(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,515),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):(this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),0===t?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,515),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),e._comparisonFunction=t}else p.Y.Error("WebGL 1 does not support texture comparison.")},t.prototype.createInstancesBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create instance buffer");var i=new d.M(t);return i.capacity=e,this.bindArrayBuffer(i),this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.DYNAMIC_DRAW),i},t.prototype.deleteInstancesBuffer=function(e){this._gl.deleteBuffer(e)},t.prototype._clientWaitAsync=function(e,t,i){void 0===t&&(t=0),void 0===i&&(i=10);var n=this._gl;return new Promise((function(r,o){var s=function(){var a=n.clientWaitSync(e,t,0);a!=n.WAIT_FAILED?a!=n.TIMEOUT_EXPIRED?r():setTimeout(s,i):o()};s()}))},t.prototype._readPixelsAsync=function(e,t,i,n,r,o,s){if(this._webGLVersion<2)throw new Error("_readPixelsAsync only work on WebGL2+");var a=this._gl,l=a.createBuffer();a.bindBuffer(a.PIXEL_PACK_BUFFER,l),a.bufferData(a.PIXEL_PACK_BUFFER,s.byteLength,a.STREAM_READ),a.readPixels(e,t,i,n,r,o,0),a.bindBuffer(a.PIXEL_PACK_BUFFER,null);var h=a.fenceSync(a.SYNC_GPU_COMMANDS_COMPLETE,0);return h?(a.flush(),this._clientWaitAsync(h,0,10).then((function(){return a.deleteSync(h),a.bindBuffer(a.PIXEL_PACK_BUFFER,l),a.getBufferSubData(a.PIXEL_PACK_BUFFER,0,s),a.bindBuffer(a.PIXEL_PACK_BUFFER,null),a.deleteBuffer(l),s}))):null},t.prototype.dispose=function(){for(this.hideLoadingUI(),this.onNewSceneAddedObservable.clear();this.postProcesses.length;)this.postProcesses[0].dispose();for(this._rescalePostProcess&&this._rescalePostProcess.dispose();this.scenes.length;)this.scenes[0].dispose();1===t.Instances.length&&t.audioEngine&&t.audioEngine.dispose(),this.disableVR(),o.M.IsWindowObjectExist()&&(window.removeEventListener("blur",this._onBlur),window.removeEventListener("focus",this._onFocus),this._renderingCanvas&&(this._renderingCanvas.removeEventListener("focus",this._onCanvasFocus),this._renderingCanvas.removeEventListener("blur",this._onCanvasBlur),this._renderingCanvas.removeEventListener("pointerout",this._onCanvasPointerOut)),o.M.IsDocumentAvailable()&&(document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("mozfullscreenchange",this._onFullscreenChange),document.removeEventListener("webkitfullscreenchange",this._onFullscreenChange),document.removeEventListener("msfullscreenchange",this._onFullscreenChange),document.removeEventListener("pointerlockchange",this._onPointerLockChange),document.removeEventListener("mspointerlockchange",this._onPointerLockChange),document.removeEventListener("mozpointerlockchange",this._onPointerLockChange),document.removeEventListener("webkitpointerlockchange",this._onPointerLockChange))),e.prototype.dispose.call(this);var i=t.Instances.indexOf(this);i>=0&&t.Instances.splice(i,1),this.onResizeObservable.clear(),this.onCanvasBlurObservable.clear(),this.onCanvasFocusObservable.clear(),this.onCanvasPointerOutObservable.clear(),this.onBeginFrameObservable.clear(),this.onEndFrameObservable.clear()},t.prototype._disableTouchAction=function(){this._renderingCanvas&&this._renderingCanvas.setAttribute&&(this._renderingCanvas.setAttribute("touch-action","none"),this._renderingCanvas.style.touchAction="none",this._renderingCanvas.style.msTouchAction="none")},t.prototype.displayLoadingUI=function(){if(o.M.IsWindowObjectExist()){var e=this.loadingScreen;e&&e.displayLoadingUI()}},t.prototype.hideLoadingUI=function(){if(o.M.IsWindowObjectExist()){var e=this._loadingScreen;e&&e.hideLoadingUI()}},Object.defineProperty(t.prototype,"loadingScreen",{get:function(){return!this._loadingScreen&&this._renderingCanvas&&(this._loadingScreen=t.DefaultLoadingScreenFactory(this._renderingCanvas)),this._loadingScreen},set:function(e){this._loadingScreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadingUIText",{set:function(e){this.loadingScreen.loadingUIText=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadingUIBackgroundColor",{set:function(e){this.loadingScreen.loadingUIBackgroundColor=e},enumerable:!1,configurable:!0}),t._RequestPointerlock=function(e){e.requestPointerLock=e.requestPointerLock||e.msRequestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock,e.requestPointerLock&&e.requestPointerLock()},t._ExitPointerlock=function(){var e=document;document.exitPointerLock=document.exitPointerLock||e.msExitPointerLock||e.mozExitPointerLock||e.webkitExitPointerLock,document.exitPointerLock&&document.exitPointerLock()},t._RequestFullscreen=function(e){var t=e.requestFullscreen||e.msRequestFullscreen||e.webkitRequestFullscreen||e.mozRequestFullScreen;t&&t.call(e)},t._ExitFullscreen=function(){var e=document;document.exitFullscreen?document.exitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.webkitCancelFullScreen?e.webkitCancelFullScreen():e.msCancelFullScreen&&e.msCancelFullScreen()},t.ALPHA_DISABLE=0,t.ALPHA_ADD=1,t.ALPHA_COMBINE=2,t.ALPHA_SUBTRACT=3,t.ALPHA_MULTIPLY=4,t.ALPHA_MAXIMIZED=5,t.ALPHA_ONEONE=6,t.ALPHA_PREMULTIPLIED=7,t.ALPHA_PREMULTIPLIED_PORTERDUFF=8,t.ALPHA_INTERPOLATE=9,t.ALPHA_SCREENMODE=10,t.DELAYLOADSTATE_NONE=0,t.DELAYLOADSTATE_LOADED=1,t.DELAYLOADSTATE_LOADING=2,t.DELAYLOADSTATE_NOTLOADED=4,t.NEVER=512,t.ALWAYS=519,t.LESS=513,t.EQUAL=514,t.LEQUAL=515,t.GREATER=516,t.GEQUAL=518,t.NOTEQUAL=517,t.KEEP=7680,t.REPLACE=7681,t.INCR=7682,t.DECR=7683,t.INVERT=5386,t.INCR_WRAP=34055,t.DECR_WRAP=34056,t.TEXTURE_CLAMP_ADDRESSMODE=0,t.TEXTURE_WRAP_ADDRESSMODE=1,t.TEXTURE_MIRROR_ADDRESSMODE=2,t.TEXTUREFORMAT_ALPHA=0,t.TEXTUREFORMAT_LUMINANCE=1,t.TEXTUREFORMAT_LUMINANCE_ALPHA=2,t.TEXTUREFORMAT_RGB=4,t.TEXTUREFORMAT_RGBA=5,t.TEXTUREFORMAT_RED=6,t.TEXTUREFORMAT_R=6,t.TEXTUREFORMAT_RG=7,t.TEXTUREFORMAT_RED_INTEGER=8,t.TEXTUREFORMAT_R_INTEGER=8,t.TEXTUREFORMAT_RG_INTEGER=9,t.TEXTUREFORMAT_RGB_INTEGER=10,t.TEXTUREFORMAT_RGBA_INTEGER=11,t.TEXTURETYPE_UNSIGNED_BYTE=0,t.TEXTURETYPE_UNSIGNED_INT=0,t.TEXTURETYPE_FLOAT=1,t.TEXTURETYPE_HALF_FLOAT=2,t.TEXTURETYPE_BYTE=3,t.TEXTURETYPE_SHORT=4,t.TEXTURETYPE_UNSIGNED_SHORT=5,t.TEXTURETYPE_INT=6,t.TEXTURETYPE_UNSIGNED_INTEGER=7,t.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=8,t.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=9,t.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=10,t.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=11,t.TEXTURETYPE_UNSIGNED_INT_24_8=12,t.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=13,t.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=14,t.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=15,t.TEXTURE_NEAREST_SAMPLINGMODE=1,t.TEXTURE_BILINEAR_SAMPLINGMODE=2,t.TEXTURE_TRILINEAR_SAMPLINGMODE=3,t.TEXTURE_NEAREST_NEAREST_MIPLINEAR=8,t.TEXTURE_LINEAR_LINEAR_MIPNEAREST=11,t.TEXTURE_LINEAR_LINEAR_MIPLINEAR=3,t.TEXTURE_NEAREST_NEAREST_MIPNEAREST=4,t.TEXTURE_NEAREST_LINEAR_MIPNEAREST=5,t.TEXTURE_NEAREST_LINEAR_MIPLINEAR=6,t.TEXTURE_NEAREST_LINEAR=7,t.TEXTURE_NEAREST_NEAREST=1,t.TEXTURE_LINEAR_NEAREST_MIPNEAREST=9,t.TEXTURE_LINEAR_NEAREST_MIPLINEAR=10,t.TEXTURE_LINEAR_LINEAR=2,t.TEXTURE_LINEAR_NEAREST=12,t.TEXTURE_EXPLICIT_MODE=0,t.TEXTURE_SPHERICAL_MODE=1,t.TEXTURE_PLANAR_MODE=2,t.TEXTURE_CUBIC_MODE=3,t.TEXTURE_PROJECTION_MODE=4,t.TEXTURE_SKYBOX_MODE=5,t.TEXTURE_INVCUBIC_MODE=6,t.TEXTURE_EQUIRECTANGULAR_MODE=7,t.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=8,t.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,t.SCALEMODE_FLOOR=1,t.SCALEMODE_NEAREST=2,t.SCALEMODE_CEILING=3,t._RescalePostProcessFactory=null,t}(l.B)},2733:(e,t,i)=>{"use strict";i.d(t,{l:()=>n});var n=function(){function e(){}return Object.defineProperty(e,"LastCreatedEngine",{get:function(){return 0===this.Instances.length?null:this.Instances[this.Instances.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LastCreatedScene",{get:function(){return this._LastCreatedScene},enumerable:!1,configurable:!0}),e.Instances=new Array,e._LastCreatedScene=null,e.UseFallbackTexture=!0,e.FallbackTexture="",e}()},8868:(e,t,i)=>{"use strict";i.d(t,{Z:()=>n});var n=function(){function e(){}return e.SetMatrixPrecision=function(t){if(e.MatrixTrackPrecisionChange=!1,t&&!e.MatrixUse64Bits&&e.MatrixTrackedMatrices)for(var i=0;i{"use strict";i.d(t,{B:()=>b});var n=i(2733),r=i(7947),o=i(106),s=i(475),a=function(){function e(){this._isDepthTestDirty=!1,this._isDepthMaskDirty=!1,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1,this.reset()}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isDepthFuncDirty||this._isDepthTestDirty||this._isDepthMaskDirty||this._isCullFaceDirty||this._isCullDirty||this._isZOffsetDirty||this._isFrontFaceDirty},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zOffset",{get:function(){return this._zOffset},set:function(e){this._zOffset!==e&&(this._zOffset=e,this._isZOffsetDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cullFace",{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,this._isCullFaceDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cull",{get:function(){return this._cull},set:function(e){this._cull!==e&&(this._cull=e,this._isCullDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthFunc",{get:function(){return this._depthFunc},set:function(e){this._depthFunc!==e&&(this._depthFunc=e,this._isDepthFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthMask",{get:function(){return this._depthMask},set:function(e){this._depthMask!==e&&(this._depthMask=e,this._isDepthMaskDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthTest",{get:function(){return this._depthTest},set:function(e){this._depthTest!==e&&(this._depthTest=e,this._isDepthTestDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontFace",{get:function(){return this._frontFace},set:function(e){this._frontFace!==e&&(this._frontFace=e,this._isFrontFaceDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this._depthMask=!0,this._depthTest=!0,this._depthFunc=null,this._cullFace=null,this._cull=null,this._zOffset=0,this._frontFace=null,this._isDepthTestDirty=!0,this._isDepthMaskDirty=!0,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1},e.prototype.apply=function(e){this.isDirty&&(this._isCullDirty&&(this.cull?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this._isCullDirty=!1),this._isCullFaceDirty&&(e.cullFace(this.cullFace),this._isCullFaceDirty=!1),this._isDepthMaskDirty&&(e.depthMask(this.depthMask),this._isDepthMaskDirty=!1),this._isDepthTestDirty&&(this.depthTest?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this._isDepthTestDirty=!1),this._isDepthFuncDirty&&(e.depthFunc(this.depthFunc),this._isDepthFuncDirty=!1),this._isZOffsetDirty&&(this.zOffset?(e.enable(e.POLYGON_OFFSET_FILL),e.polygonOffset(this.zOffset,0)):e.disable(e.POLYGON_OFFSET_FILL),this._isZOffsetDirty=!1),this._isFrontFaceDirty&&(e.frontFace(this.frontFace),this._isFrontFaceDirty=!1))},e}(),l=function(){function e(){this._isStencilTestDirty=!1,this._isStencilMaskDirty=!1,this._isStencilFuncDirty=!1,this._isStencilOpDirty=!1,this.reset()}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isStencilTestDirty||this._isStencilMaskDirty||this._isStencilFuncDirty||this._isStencilOpDirty},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilFunc",{get:function(){return this._stencilFunc},set:function(e){this._stencilFunc!==e&&(this._stencilFunc=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilFuncRef",{get:function(){return this._stencilFuncRef},set:function(e){this._stencilFuncRef!==e&&(this._stencilFuncRef=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilFuncMask",{get:function(){return this._stencilFuncMask},set:function(e){this._stencilFuncMask!==e&&(this._stencilFuncMask=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpStencilFail",{get:function(){return this._stencilOpStencilFail},set:function(e){this._stencilOpStencilFail!==e&&(this._stencilOpStencilFail=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpDepthFail",{get:function(){return this._stencilOpDepthFail},set:function(e){this._stencilOpDepthFail!==e&&(this._stencilOpDepthFail=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpStencilDepthPass",{get:function(){return this._stencilOpStencilDepthPass},set:function(e){this._stencilOpStencilDepthPass!==e&&(this._stencilOpStencilDepthPass=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilMask",{get:function(){return this._stencilMask},set:function(e){this._stencilMask!==e&&(this._stencilMask=e,this._isStencilMaskDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilTest",{get:function(){return this._stencilTest},set:function(e){this._stencilTest!==e&&(this._stencilTest=e,this._isStencilTestDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this._stencilTest=!1,this._stencilMask=255,this._stencilFunc=e.ALWAYS,this._stencilFuncRef=1,this._stencilFuncMask=255,this._stencilOpStencilFail=e.KEEP,this._stencilOpDepthFail=e.KEEP,this._stencilOpStencilDepthPass=e.REPLACE,this._isStencilTestDirty=!0,this._isStencilMaskDirty=!0,this._isStencilFuncDirty=!0,this._isStencilOpDirty=!0},e.prototype.apply=function(e){this.isDirty&&(this._isStencilTestDirty&&(this.stencilTest?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this._isStencilTestDirty=!1),this._isStencilMaskDirty&&(e.stencilMask(this.stencilMask),this._isStencilMaskDirty=!1),this._isStencilFuncDirty&&(e.stencilFunc(this.stencilFunc,this.stencilFuncRef,this.stencilFuncMask),this._isStencilFuncDirty=!1),this._isStencilOpDirty&&(e.stencilOp(this.stencilOpStencilFail,this.stencilOpDepthFail,this.stencilOpStencilDepthPass),this._isStencilOpDirty=!1))},e.ALWAYS=519,e.KEEP=7680,e.REPLACE=7681,e}(),h=function(){function e(){this._isAlphaBlendDirty=!1,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1,this._alphaBlend=!1,this._blendFunctionParameters=new Array(4),this._blendEquationParameters=new Array(2),this._blendConstants=new Array(4),this.reset()}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isAlphaBlendDirty||this._isBlendFunctionParametersDirty},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaBlend",{get:function(){return this._alphaBlend},set:function(e){this._alphaBlend!==e&&(this._alphaBlend=e,this._isAlphaBlendDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.setAlphaBlendConstants=function(e,t,i,n){this._blendConstants[0]===e&&this._blendConstants[1]===t&&this._blendConstants[2]===i&&this._blendConstants[3]===n||(this._blendConstants[0]=e,this._blendConstants[1]=t,this._blendConstants[2]=i,this._blendConstants[3]=n,this._isBlendConstantsDirty=!0)},e.prototype.setAlphaBlendFunctionParameters=function(e,t,i,n){this._blendFunctionParameters[0]===e&&this._blendFunctionParameters[1]===t&&this._blendFunctionParameters[2]===i&&this._blendFunctionParameters[3]===n||(this._blendFunctionParameters[0]=e,this._blendFunctionParameters[1]=t,this._blendFunctionParameters[2]=i,this._blendFunctionParameters[3]=n,this._isBlendFunctionParametersDirty=!0)},e.prototype.setAlphaEquationParameters=function(e,t){this._blendEquationParameters[0]===e&&this._blendEquationParameters[1]===t||(this._blendEquationParameters[0]=e,this._blendEquationParameters[1]=t,this._isBlendEquationParametersDirty=!0)},e.prototype.reset=function(){this._alphaBlend=!1,this._blendFunctionParameters[0]=null,this._blendFunctionParameters[1]=null,this._blendFunctionParameters[2]=null,this._blendFunctionParameters[3]=null,this._blendEquationParameters[0]=null,this._blendEquationParameters[1]=null,this._blendConstants[0]=null,this._blendConstants[1]=null,this._blendConstants[2]=null,this._blendConstants[3]=null,this._isAlphaBlendDirty=!0,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1},e.prototype.apply=function(e){this.isDirty&&(this._isAlphaBlendDirty&&(this._alphaBlend?e.enable(e.BLEND):e.disable(e.BLEND),this._isAlphaBlendDirty=!1),this._isBlendFunctionParametersDirty&&(e.blendFuncSeparate(this._blendFunctionParameters[0],this._blendFunctionParameters[1],this._blendFunctionParameters[2],this._blendFunctionParameters[3]),this._isBlendFunctionParametersDirty=!1),this._isBlendEquationParametersDirty&&(e.blendEquationSeparate(this._blendEquationParameters[0],this._blendEquationParameters[1]),this._isBlendEquationParametersDirty=!1),this._isBlendConstantsDirty&&(e.blendColor(this._blendConstants[0],this._blendConstants[1],this._blendConstants[2],this._blendConstants[3]),this._isBlendConstantsDirty=!1))},e}(),c=i(7627),u=i(3734),f=i(6327),d=function(){function e(){}return e.prototype.postProcessor=function(e,t,i,n){if(!n.getCaps().drawBuffersExtension){e=e.replace(/#extension.+GL_EXT_draw_buffers.+(enable|require)/g,"")}return e},e}(),p=function(){function e(){}return e.prototype.attributeProcessor=function(e){return e.replace("attribute","in")},e.prototype.varyingProcessor=function(e,t){return e.replace("varying",t?"in":"out")},e.prototype.postProcessor=function(e,t,i){var n=-1!==e.search(/#extension.+GL_EXT_draw_buffers.+require/);if(e=(e=e.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"")).replace(/texture2D\s*\(/g,"texture("),i)e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/void\s+?main\s*\(/g,(n?"":"out vec4 glFragColor;\n")+"void main(");else if(-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;return e},e}(),_=i(5146),g=function(){function e(){this.vertexCompilationError=null,this.fragmentCompilationError=null,this.programLinkError=null,this.programValidationError=null}return Object.defineProperty(e.prototype,"isAsync",{get:function(){return this.isParallelCompiled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isReady",{get:function(){return!!this.program&&(!this.isParallelCompiled||this.engine._isRenderingStateCompiled(this))},enumerable:!1,configurable:!0}),e.prototype._handlesSpectorRebuildCallback=function(e){e&&this.program&&e(this.program)},e.prototype._getVertexShaderCode=function(){return this.vertexShader?this.engine._getShaderSource(this.vertexShader):null},e.prototype._getFragmentShaderCode=function(){return this.fragmentShader?this.engine._getShaderSource(this.fragmentShader):null},e}(),m=i(1370),v=i(8868),y=function(){},b=function(){function e(t,i,n,r){var o=this;void 0===r&&(r=!1),this.forcePOTTextures=!1,this.isFullscreen=!1,this.cullBackFaces=!0,this.renderEvenInBackground=!0,this.preventCacheWipeBetweenFrames=!1,this.validateShaderPrograms=!1,this.useReverseDepthBuffer=!1,this.disableUniformBuffers=!1,this._uniformBuffers=new Array,this._webGLVersion=1,this._windowIsBackground=!1,this._highPrecisionShadersAllowed=!0,this._badOS=!1,this._badDesktopOS=!1,this._renderingQueueLaunched=!1,this._activeRenderLoops=new Array,this.onContextLostObservable=new s.y$,this.onContextRestoredObservable=new s.y$,this._contextWasLost=!1,this._doNotHandleContextLost=!1,this.disableVertexArrayObjects=!1,this._colorWrite=!0,this._colorWriteChanged=!0,this._depthCullingState=new a,this._stencilState=new l,this._alphaState=new h,this._alphaMode=1,this._alphaEquation=0,this._internalTexturesCache=new Array,this._activeChannel=0,this._currentTextureChannel=-1,this._boundTexturesCache={},this._compiledEffects={},this._vertexAttribArraysEnabled=[],this._uintIndicesCurrentlySet=!1,this._currentBoundBuffer=new Array,this._currentFramebuffer=null,this._dummyFramebuffer=null,this._currentBufferPointers=new Array,this._currentInstanceLocations=new Array,this._currentInstanceBuffers=new Array,this._vaoRecordInProgress=!1,this._mustWipeVertexAttributes=!1,this._nextFreeTextureSlots=new Array,this._maxSimultaneousTextures=0,this._activeRequests=new Array,this._transformTextureUrl=null,this.hostInformation={isMobile:!1},this.premultipliedAlpha=!0,this.onBeforeTextureInitObservable=new s.y$,this._viewportCached={x:0,y:0,z:0,w:0},this._unpackFlipYCached=null,this.enableUnpackFlipYCached=!0,this._getDepthStencilBuffer=function(e,t,i,n,r,s){var a=o._gl,l=a.createRenderbuffer();return a.bindRenderbuffer(a.RENDERBUFFER,l),i>1&&a.renderbufferStorageMultisample?a.renderbufferStorageMultisample(a.RENDERBUFFER,i,r,e,t):a.renderbufferStorage(a.RENDERBUFFER,n,e,t),a.framebufferRenderbuffer(a.FRAMEBUFFER,s,a.RENDERBUFFER,l),a.bindRenderbuffer(a.RENDERBUFFER,null),l},this._boundUniforms={};var c=null;if(t){if(n=n||{},v.Z.SetMatrixPrecision(!!n.useHighPrecisionMatrix),t.getContext){if(c=t,this._renderingCanvas=c,null!=i&&(n.antialias=i),void 0===n.deterministicLockstep&&(n.deterministicLockstep=!1),void 0===n.lockstepMaxSteps&&(n.lockstepMaxSteps=4),void 0===n.timeStep&&(n.timeStep=1/60),void 0===n.preserveDrawingBuffer&&(n.preserveDrawingBuffer=!1),void 0===n.audioEngine&&(n.audioEngine=!0),void 0===n.stencil&&(n.stencil=!0),!1===n.premultipliedAlpha&&(this.premultipliedAlpha=!1),void 0===n.xrCompatible&&(n.xrCompatible=!0),this._doNotHandleContextLost=!!n.doNotHandleContextLost,navigator&&navigator.userAgent){var _=navigator.userAgent;this.hostInformation.isMobile=-1!==_.indexOf("Mobile");for(var g=0,m=e.ExceptionList;g0)if(parseInt(x[x.length-1])>=C)continue}for(var S=0,R=A;S1?this._shaderProcessor=new p:this._shaderProcessor=new d,this._badOS=/iPad/i.test(navigator.userAgent)||/iPhone/i.test(navigator.userAgent),this._badDesktopOS=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),this._creationOptions=n,console.log("Babylon.js v"+e.Version+" - "+this.description)}}return Object.defineProperty(e,"NpmPackage",{get:function(){return"babylonjs@4.2.0"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"Version",{get:function(){return"4.2.0"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"description",{get:function(){var e="WebGL"+this.webGLVersion;return this._caps.parallelShaderCompile&&(e+=" - Parallel shader compilation"),e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ShadersRepository",{get:function(){return r.Q.ShadersRepository},set:function(e){r.Q.ShadersRepository=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"supportsUniformBuffers",{get:function(){return this.webGLVersion>1&&!this.disableUniformBuffers},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_shouldUseHighPrecisionShader",{get:function(){return!(!this._caps.highPrecisionShaderSupported||!this._highPrecisionShadersAllowed)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needPOTTextures",{get:function(){return this._webGLVersion<2||this.forcePOTTextures},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"doNotHandleContextLost",{get:function(){return this._doNotHandleContextLost},set:function(e){this._doNotHandleContextLost=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_supportsHardwareTextureRescaling",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"framebufferDimensionsObject",{set:function(e){this._framebufferDimensionsObject=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentViewport",{get:function(){return this._cachedViewport},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emptyTexture",{get:function(){return this._emptyTexture||(this._emptyTexture=this.createRawTexture(new Uint8Array(4),1,1,5,!1,!1,1)),this._emptyTexture},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emptyTexture3D",{get:function(){return this._emptyTexture3D||(this._emptyTexture3D=this.createRawTexture3D(new Uint8Array(4),1,1,1,5,!1,!1,1)),this._emptyTexture3D},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emptyTexture2DArray",{get:function(){return this._emptyTexture2DArray||(this._emptyTexture2DArray=this.createRawTexture2DArray(new Uint8Array(4),1,1,1,5,!1,!1,1)),this._emptyTexture2DArray},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emptyCubeTexture",{get:function(){if(!this._emptyCubeTexture){var e=new Uint8Array(4),t=[e,e,e,e,e,e];this._emptyCubeTexture=this.createRawCubeTexture(t,1,5,0,!1,!1,1)}return this._emptyCubeTexture},enumerable:!1,configurable:!0}),e.prototype._rebuildInternalTextures=function(){for(var e=0,t=this._internalTexturesCache.slice();e1?this._gl.getParameter(this._gl.MAX_SAMPLES):1,maxCubemapTextureSize:this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),maxRenderTextureSize:this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),maxVertexAttribs:this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),maxVaryingVectors:this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),maxFragmentUniformVectors:this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),maxVertexUniformVectors:this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),parallelShaderCompile:this._gl.getExtension("KHR_parallel_shader_compile"),standardDerivatives:this._webGLVersion>1||null!==this._gl.getExtension("OES_standard_derivatives"),maxAnisotropy:1,astc:this._gl.getExtension("WEBGL_compressed_texture_astc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"),bptc:this._gl.getExtension("EXT_texture_compression_bptc")||this._gl.getExtension("WEBKIT_EXT_texture_compression_bptc"),s3tc:this._gl.getExtension("WEBGL_compressed_texture_s3tc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),pvrtc:this._gl.getExtension("WEBGL_compressed_texture_pvrtc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:this._gl.getExtension("WEBGL_compressed_texture_etc1")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),etc2:this._gl.getExtension("WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBGL_compressed_texture_es3_0"),textureAnisotropicFilterExtension:this._gl.getExtension("EXT_texture_filter_anisotropic")||this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"),uintIndices:this._webGLVersion>1||null!==this._gl.getExtension("OES_element_index_uint"),fragmentDepthSupported:this._webGLVersion>1||null!==this._gl.getExtension("EXT_frag_depth"),highPrecisionShaderSupported:!1,timerQuery:this._gl.getExtension("EXT_disjoint_timer_query_webgl2")||this._gl.getExtension("EXT_disjoint_timer_query"),canUseTimestampForTimerQuery:!1,drawBuffersExtension:!1,maxMSAASamples:1,colorBufferFloat:this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_float"),textureFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_float")),textureHalfFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_half_float")),textureHalfFloatRender:!1,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloatLinearFiltering:!1,vertexArrayObject:!1,instancedArrays:!1,textureLOD:!!(this._webGLVersion>1||this._gl.getExtension("EXT_shader_texture_lod")),blendMinMax:!1,multiview:this._gl.getExtension("OVR_multiview2"),oculusMultiview:this._gl.getExtension("OCULUS_multiview"),depthTextureExtension:!1},this._glVersion=this._gl.getParameter(this._gl.VERSION);var e=this._gl.getExtension("WEBGL_debug_renderer_info");if(null!=e&&(this._glRenderer=this._gl.getParameter(e.UNMASKED_RENDERER_WEBGL),this._glVendor=this._gl.getParameter(e.UNMASKED_VENDOR_WEBGL)),this._glVendor||(this._glVendor="Unknown vendor"),this._glRenderer||(this._glRenderer="Unknown renderer"),36193!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=36193),34842!==this._gl.RGBA16F&&(this._gl.RGBA16F=34842),34836!==this._gl.RGBA32F&&(this._gl.RGBA32F=34836),35056!==this._gl.DEPTH24_STENCIL8&&(this._gl.DEPTH24_STENCIL8=35056),this._caps.timerQuery&&(1===this._webGLVersion&&(this._gl.getQuery=this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)),this._caps.canUseTimestampForTimerQuery=this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT,this._caps.timerQuery.QUERY_COUNTER_BITS_EXT)>0),this._caps.maxAnisotropy=this._caps.textureAnisotropicFilterExtension?this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,this._caps.textureFloatLinearFiltering=!(!this._caps.textureFloat||!this._gl.getExtension("OES_texture_float_linear")),this._caps.textureFloatRender=!(!this._caps.textureFloat||!this._canRenderToFloatFramebuffer()),this._caps.textureHalfFloatLinearFiltering=!!(this._webGLVersion>1||this._caps.textureHalfFloat&&this._gl.getExtension("OES_texture_half_float_linear")),this._webGLVersion>1&&5131!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=5131),this._caps.textureHalfFloatRender=this._caps.textureHalfFloat&&this._canRenderToHalfFloatFramebuffer(),this._webGLVersion>1)this._caps.drawBuffersExtension=!0,this._caps.maxMSAASamples=this._gl.getParameter(this._gl.MAX_SAMPLES);else{var t=this._gl.getExtension("WEBGL_draw_buffers");if(null!==t){this._caps.drawBuffersExtension=!0,this._gl.drawBuffers=t.drawBuffersWEBGL.bind(t),this._gl.DRAW_FRAMEBUFFER=this._gl.FRAMEBUFFER;for(var i=0;i<16;i++)this._gl["COLOR_ATTACHMENT"+i+"_WEBGL"]=t["COLOR_ATTACHMENT"+i+"_WEBGL"]}}if(this._webGLVersion>1)this._caps.depthTextureExtension=!0;else{var n=this._gl.getExtension("WEBGL_depth_texture");null!=n&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=n.UNSIGNED_INT_24_8_WEBGL)}if(this.disableVertexArrayObjects)this._caps.vertexArrayObject=!1;else if(this._webGLVersion>1)this._caps.vertexArrayObject=!0;else{var r=this._gl.getExtension("OES_vertex_array_object");null!=r&&(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=r.createVertexArrayOES.bind(r),this._gl.bindVertexArray=r.bindVertexArrayOES.bind(r),this._gl.deleteVertexArray=r.deleteVertexArrayOES.bind(r))}if(this._webGLVersion>1)this._caps.instancedArrays=!0;else{var o=this._gl.getExtension("ANGLE_instanced_arrays");null!=o?(this._caps.instancedArrays=!0,this._gl.drawArraysInstanced=o.drawArraysInstancedANGLE.bind(o),this._gl.drawElementsInstanced=o.drawElementsInstancedANGLE.bind(o),this._gl.vertexAttribDivisor=o.vertexAttribDivisorANGLE.bind(o)):this._caps.instancedArrays=!1}if(this._gl.getShaderPrecisionFormat){var s=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),a=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);s&&a&&(this._caps.highPrecisionShaderSupported=0!==s.precision&&0!==a.precision)}if(this._webGLVersion>1)this._caps.blendMinMax=!0;else{var l=this._gl.getExtension("EXT_blend_minmax");null!=l&&(this._caps.blendMinMax=!0,this._gl.MAX=l.MAX_EXT,this._gl.MIN=l.MIN_EXT)}this._depthCullingState.depthTest=!0,this._depthCullingState.depthFunc=this._gl.LEQUAL,this._depthCullingState.depthMask=!0,this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(var h=0;h=0&&this._activeRenderLoops.splice(t,1)}else this._activeRenderLoops=[]},e.prototype._renderLoop=function(){if(!this._contextWasLost){var e=!0;if(!this.renderEvenInBackground&&this._windowIsBackground&&(e=!1),e){this.beginFrame();for(var t=0;t0?this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1},e.prototype.getRenderingCanvas=function(){return this._renderingCanvas},e.prototype.getHostWindow=function(){return f.M.IsWindowObjectExist()?this._renderingCanvas&&this._renderingCanvas.ownerDocument&&this._renderingCanvas.ownerDocument.defaultView?this._renderingCanvas.ownerDocument.defaultView:window:null},e.prototype.getRenderWidth=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferWidth:this._gl.drawingBufferWidth},e.prototype.getRenderHeight=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferHeight:this._gl.drawingBufferHeight},e.prototype._queueNewFrame=function(t,i){return e.QueueNewFrame(t,i)},e.prototype.runRenderLoop=function(e){-1===this._activeRenderLoops.indexOf(e)&&(this._activeRenderLoops.push(e),this._renderingQueueLaunched||(this._renderingQueueLaunched=!0,this._boundRenderFunction=this._renderLoop.bind(this),this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow())))},e.prototype.clear=function(e,t,i,n){void 0===n&&(n=!1),this.applyStates();var r=0;t&&e&&(this._gl.clearColor(e.r,e.g,e.b,void 0!==e.a?e.a:1),r|=this._gl.COLOR_BUFFER_BIT),i&&(this.useReverseDepthBuffer?(this._depthCullingState.depthFunc=this._gl.GREATER,this._gl.clearDepth(0)):this._gl.clearDepth(1),r|=this._gl.DEPTH_BUFFER_BIT),n&&(this._gl.clearStencil(0),r|=this._gl.STENCIL_BUFFER_BIT),this._gl.clear(r)},e.prototype._viewport=function(e,t,i,n){e===this._viewportCached.x&&t===this._viewportCached.y&&i===this._viewportCached.z&&n===this._viewportCached.w||(this._viewportCached.x=e,this._viewportCached.y=t,this._viewportCached.z=i,this._viewportCached.w=n,this._gl.viewport(e,t,i,n))},e.prototype.setViewport=function(e,t,i){var n=t||this.getRenderWidth(),r=i||this.getRenderHeight(),o=e.x||0,s=e.y||0;this._cachedViewport=e,this._viewport(o*n,s*r,n*e.width,r*e.height)},e.prototype.beginFrame=function(){},e.prototype.endFrame=function(){this._badOS&&this.flushFramebuffer()},e.prototype.resize=function(){var e,t;f.M.IsWindowObjectExist()?(e=this._renderingCanvas?this._renderingCanvas.clientWidth||this._renderingCanvas.width:window.innerWidth,t=this._renderingCanvas?this._renderingCanvas.clientHeight||this._renderingCanvas.height:window.innerHeight):(e=this._renderingCanvas?this._renderingCanvas.width:100,t=this._renderingCanvas?this._renderingCanvas.height:100),this.setSize(e/this._hardwareScalingLevel,t/this._hardwareScalingLevel)},e.prototype.setSize=function(e,t){return!!this._renderingCanvas&&(e|=0,t|=0,(this._renderingCanvas.width!==e||this._renderingCanvas.height!==t)&&(this._renderingCanvas.width=e,this._renderingCanvas.height=t,!0))},e.prototype.bindFramebuffer=function(e,t,i,n,r,o,s){void 0===t&&(t=0),void 0===o&&(o=0),void 0===s&&(s=0),this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._bindUnboundFramebuffer(e._MSAAFramebuffer?e._MSAAFramebuffer:e._framebuffer);var a=this._gl;e.is2DArray?a.framebufferTextureLayer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,e._webGLTexture,o,s):e.isCube&&a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+t,e._webGLTexture,o);var l=e._depthStencilTexture;if(l){var h=l._generateStencilBuffer?a.DEPTH_STENCIL_ATTACHMENT:a.DEPTH_ATTACHMENT;e.is2DArray?a.framebufferTextureLayer(a.FRAMEBUFFER,h,l._webGLTexture,o,s):e.isCube?a.framebufferTexture2D(a.FRAMEBUFFER,h,a.TEXTURE_CUBE_MAP_POSITIVE_X+t,l._webGLTexture,o):a.framebufferTexture2D(a.FRAMEBUFFER,h,a.TEXTURE_2D,l._webGLTexture,o)}this._cachedViewport&&!r?this.setViewport(this._cachedViewport,i,n):(i||(i=e.width,o&&(i/=Math.pow(2,o))),n||(n=e.height,o&&(n/=Math.pow(2,o))),this._viewport(0,0,i,n)),this.wipeCaches()},e.prototype._bindUnboundFramebuffer=function(e){this._currentFramebuffer!==e&&(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,e),this._currentFramebuffer=e)},e.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null;var n=this._gl;if(e._MSAAFramebuffer){if(e._textureArray)return void this.unBindMultiColorAttachmentFramebuffer(e._textureArray,t,i);n.bindFramebuffer(n.READ_FRAMEBUFFER,e._MSAAFramebuffer),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,e._framebuffer),n.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,n.COLOR_BUFFER_BIT,n.NEAREST)}!e.generateMipMaps||t||e.isCube||(this._bindTextureDirectly(n.TEXTURE_2D,e,!0),n.generateMipmap(n.TEXTURE_2D),this._bindTextureDirectly(n.TEXTURE_2D,null)),i&&(e._MSAAFramebuffer&&this._bindUnboundFramebuffer(e._framebuffer),i()),this._bindUnboundFramebuffer(null)},e.prototype.flushFramebuffer=function(){this._gl.flush()},e.prototype.restoreDefaultFramebuffer=function(){this._currentRenderTarget?this.unBindFramebuffer(this._currentRenderTarget):this._bindUnboundFramebuffer(null),this._cachedViewport&&this.setViewport(this._cachedViewport),this.wipeCaches()},e.prototype._resetVertexBufferBinding=function(){this.bindArrayBuffer(null),this._cachedVertexBuffers=null},e.prototype.createVertexBuffer=function(e){return this._createVertexBuffer(e,this._gl.STATIC_DRAW)},e.prototype._createVertexBuffer=function(e,t){var i=this._gl.createBuffer();if(!i)throw new Error("Unable to create vertex buffer");var n=new _.M(i);return this.bindArrayBuffer(n),e instanceof Array?this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),this._gl.STATIC_DRAW):this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.STATIC_DRAW),this._resetVertexBufferBinding(),n.references=1,n},e.prototype.createDynamicVertexBuffer=function(e){return this._createVertexBuffer(e,this._gl.DYNAMIC_DRAW)},e.prototype._resetIndexBufferBinding=function(){this.bindIndexBuffer(null),this._cachedIndexBuffer=null},e.prototype.createIndexBuffer=function(e,t){var i=this._gl.createBuffer(),n=new _.M(i);if(!i)throw new Error("Unable to create index buffer");this.bindIndexBuffer(n);var r=this._normalizeIndexData(e);return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,r,t?this._gl.DYNAMIC_DRAW:this._gl.STATIC_DRAW),this._resetIndexBufferBinding(),n.references=1,n.is32Bits=4===r.BYTES_PER_ELEMENT,n},e.prototype._normalizeIndexData=function(e){if(e instanceof Uint16Array)return e;if(this._caps.uintIndices){if(e instanceof Uint32Array)return e;for(var t=0;t=65535)return new Uint32Array(e);return new Uint16Array(e)}return new Uint16Array(e)},e.prototype.bindArrayBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ARRAY_BUFFER)},e.prototype.bindUniformBlock=function(e,t,i){var n=e.program,r=this._gl.getUniformBlockIndex(n,t);this._gl.uniformBlockBinding(n,r,i)},e.prototype.bindIndexBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)},e.prototype.bindBuffer=function(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)},e.prototype.updateArrayBuffer=function(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)},e.prototype._vertexAttribPointer=function(e,t,i,n,r,o,s){var a=this._currentBufferPointers[t];if(a){var l=!1;a.active?(a.buffer!==e&&(a.buffer=e,l=!0),a.size!==i&&(a.size=i,l=!0),a.type!==n&&(a.type=n,l=!0),a.normalized!==r&&(a.normalized=r,l=!0),a.stride!==o&&(a.stride=o,l=!0),a.offset!==s&&(a.offset=s,l=!0)):(l=!0,a.active=!0,a.index=t,a.size=i,a.type=n,a.normalized=r,a.stride=o,a.offset=s,a.buffer=e),(l||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),this._gl.vertexAttribPointer(t,i,n,r,o,s))}},e.prototype._bindIndexBufferWithCache=function(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)},e.prototype._bindVertexBuffersAttributes=function(e,t){var i=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var n=0;n=0){var o=e[i[n]];if(!o)continue;this._gl.enableVertexAttribArray(r),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[r]=!0);var s=o.getBuffer();s&&(this._vertexAttribPointer(s,r,o.getSize(),o.type,o.normalized,o.byteStride,o.byteOffset),o.getIsInstanced()&&(this._gl.vertexAttribDivisor(r,o.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(r),this._currentInstanceBuffers.push(s))))}}},e.prototype.recordVertexArrayObject=function(e,t,i){var n=this._gl.createVertexArray();return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(n),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,i),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),n},e.prototype.bindVertexArrayObject=function(e,t){this._cachedVertexArrayObject!==e&&(this._cachedVertexArrayObject=e,this._gl.bindVertexArray(e),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._uintIndicesCurrentlySet=null!=t&&t.is32Bits,this._mustWipeVertexAttributes=!0)},e.prototype.bindBuffersDirectly=function(e,t,i,n,r){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==r){this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=r;var o=r.getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var s=0,a=0;a=0&&(this._gl.enableVertexAttribArray(l),this._vertexAttribArraysEnabled[l]=!0,this._vertexAttribPointer(e,l,i[a],this._gl.FLOAT,!1,n,s)),s+=4*i[a]}}this._bindIndexBufferWithCache(t)},e.prototype._unbindVertexArrayObject=function(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))},e.prototype.bindBuffers=function(e,t,i){this._cachedVertexBuffers===e&&this._cachedEffectForVertexBuffers===i||(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=i,this._bindVertexBuffersAttributes(e,i)),this._bindIndexBufferWithCache(t)},e.prototype.unbindInstanceAttributes=function(){for(var e,t=0,i=this._currentInstanceLocations.length;t1?"#version 300 es\n#define WEBGL2 \n":"",a=this._compileShader(t,"vertex",n,s),l=this._compileShader(i,"fragment",n,s);return this._createShaderProgram(e,a,l,r,o)},e.prototype.createPipelineContext=function(){var e=new g;return e.engine=this,this._caps.parallelShaderCompile&&(e.isParallelCompiled=!0),e},e.prototype._createShaderProgram=function(e,t,i,n,r){void 0===r&&(r=null);var o=n.createProgram();if(e.program=o,!o)throw new Error("Unable to create program");return n.attachShader(o,t),n.attachShader(o,i),n.linkProgram(o),e.context=n,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),o},e.prototype._finalizePipelineContext=function(e){var t=e.context,i=e.vertexShader,n=e.fragmentShader,r=e.program;if(!t.getProgramParameter(r,t.LINK_STATUS)){var o,s;if(!this._gl.getShaderParameter(i,this._gl.COMPILE_STATUS))if(o=this._gl.getShaderInfoLog(i))throw e.vertexCompilationError=o,new Error("VERTEX SHADER "+o);if(!this._gl.getShaderParameter(n,this._gl.COMPILE_STATUS))if(o=this._gl.getShaderInfoLog(n))throw e.fragmentCompilationError=o,new Error("FRAGMENT SHADER "+o);if(s=t.getProgramInfoLog(r))throw e.programLinkError=s,new Error(s)}if(this.validateShaderPrograms&&(t.validateProgram(r),!t.getProgramParameter(r,t.VALIDATE_STATUS)&&(s=t.getProgramInfoLog(r))))throw e.programValidationError=s,new Error(s);t.deleteShader(i),t.deleteShader(n),e.vertexShader=void 0,e.fragmentShader=void 0,e.onCompiled&&(e.onCompiled(),e.onCompiled=void 0)},e.prototype._preparePipelineContext=function(e,t,i,n,r,o,s){var a=e;a.program=n?this.createRawShaderProgram(a,t,i,void 0,s):this.createShaderProgram(a,t,i,o,void 0,s),a.program.__SPECTOR_rebuildProgram=r},e.prototype._isRenderingStateCompiled=function(e){var t=e;return!!this._gl.getProgramParameter(t.program,this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)&&(this._finalizePipelineContext(t),!0)},e.prototype._executeWhenRenderingStateIsCompiled=function(e,t){var i=e;if(i.isParallelCompiled){var n=i.onCompiled;i.onCompiled=n?function(){n(),t()}:t}else t()},e.prototype.getUniforms=function(e,t){for(var i=new Array,n=e,r=0;r-1?t.substring(E).toLowerCase():""),x=null;C.indexOf("?")>-1&&(C=C.split("?")[0]);for(var S=0,R=e._TextureLoaders;Sl||e.height>l||!m._supportsHardwareTextureRescaling)return m._prepareWorkingCanvas(),!(!m._workingCanvas||!m._workingContext)&&(m._workingCanvas.width=t,m._workingCanvas.height=i,m._workingContext.drawImage(e,0,0,e.width,e.height,0,0,t,i),r.texImage2D(r.TEXTURE_2D,0,a,a,r.UNSIGNED_BYTE,m._workingCanvas),T.width=t,T.height=i,!1);var h=new c.l(m,c.S.Temp);return m._bindTextureDirectly(r.TEXTURE_2D,h,!0),r.texImage2D(r.TEXTURE_2D,0,a,a,r.UNSIGNED_BYTE,e),m._rescaleTexture(h,T,o,a,(function(){m._releaseTexture(h),m._bindTextureDirectly(r.TEXTURE_2D,T,!0),n()})),!0}),s)};!v||b?h&&(h.decoding||h.close)?D(h):e._FileToolsLoadImage(t,D,I,o?o.offlineProvider:null,_):"string"==typeof h||h instanceof ArrayBuffer||ArrayBuffer.isView(h)||h instanceof Blob?e._FileToolsLoadImage(h,D,I,o?o.offlineProvider:null,_):h&&D(h)}return T},e._FileToolsLoadImage=function(e,t,i,n,r){throw o.f.WarnImport("FileTools")},e.prototype._rescaleTexture=function(e,t,i,n,r){},e.prototype.createRawTexture=function(e,t,i,n,r,s,a,l,h){throw void 0===l&&(l=null),void 0===h&&(h=0),o.f.WarnImport("Engine.RawTexture")},e.prototype.createRawCubeTexture=function(e,t,i,n,r,s,a,l){throw void 0===l&&(l=null),o.f.WarnImport("Engine.RawTexture")},e.prototype.createRawTexture3D=function(e,t,i,n,r,s,a,l,h,c){throw void 0===h&&(h=null),void 0===c&&(c=0),o.f.WarnImport("Engine.RawTexture")},e.prototype.createRawTexture2DArray=function(e,t,i,n,r,s,a,l,h,c){throw void 0===h&&(h=null),void 0===c&&(c=0),o.f.WarnImport("Engine.RawTexture")},e.prototype._unpackFlipY=function(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,e?1:0),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))},e.prototype._getUnpackAlignement=function(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)},e.prototype._getTextureTarget=function(e){return e.isCube?this._gl.TEXTURE_CUBE_MAP:e.is3D?this._gl.TEXTURE_3D:e.is2DArray||e.isMultiview?this._gl.TEXTURE_2D_ARRAY:this._gl.TEXTURE_2D},e.prototype.updateTextureSamplingMode=function(e,t,i){void 0===i&&(i=!1);var n=this._getTextureTarget(t),r=this._getSamplingParameters(e,t.generateMipMaps||i);this._setTextureParameterInteger(n,this._gl.TEXTURE_MAG_FILTER,r.mag,t),this._setTextureParameterInteger(n,this._gl.TEXTURE_MIN_FILTER,r.min),i&&(t.generateMipMaps=!0,this._gl.generateMipmap(n)),this._bindTextureDirectly(n,null),t.samplingMode=e},e.prototype.updateTextureWrappingMode=function(e,t,i,n){void 0===i&&(i=null),void 0===n&&(n=null);var r=this._getTextureTarget(e);null!==t&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t),e),e._cachedWrapU=t),null!==i&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(i),e),e._cachedWrapV=i),(e.is2DArray||e.is3D)&&null!==n&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(n),e),e._cachedWrapR=n),this._bindTextureDirectly(r,null)},e.prototype._setupDepthStencilTexture=function(e,t,i,n,r){var o=t.width||t,s=t.height||t,a=t.layers||0;e.baseWidth=o,e.baseHeight=s,e.width=o,e.height=s,e.is2DArray=a>0,e.depth=a,e.isReady=!0,e.samples=1,e.generateMipMaps=!1,e._generateDepthBuffer=!0,e._generateStencilBuffer=i,e.samplingMode=n?2:1,e.type=0,e._comparisonFunction=r;var l=this._gl,h=this._getTextureTarget(e),c=this._getSamplingParameters(e.samplingMode,!1);l.texParameteri(h,l.TEXTURE_MAG_FILTER,c.mag),l.texParameteri(h,l.TEXTURE_MIN_FILTER,c.min),l.texParameteri(h,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(h,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),0===r?(l.texParameteri(h,l.TEXTURE_COMPARE_FUNC,515),l.texParameteri(h,l.TEXTURE_COMPARE_MODE,l.NONE)):(l.texParameteri(h,l.TEXTURE_COMPARE_FUNC,r),l.texParameteri(h,l.TEXTURE_COMPARE_MODE,l.COMPARE_REF_TO_TEXTURE))},e.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,s){void 0===o&&(o=0),void 0===s&&(s=0);var a=this._gl,l=a.TEXTURE_2D;e.isCube&&(l=a.TEXTURE_CUBE_MAP_POSITIVE_X+o),this._gl.compressedTexImage2D(l,s,t,i,n,0,r)},e.prototype._uploadDataToTextureDirectly=function(e,t,i,n,r,o){void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=!1);var s=this._gl,a=this._getWebGLTextureType(e.type),l=this._getInternalFormat(e.format),h=void 0===r?this._getRGBABufferInternalSizedFormat(e.type,e.format):this._getInternalFormat(r);this._unpackFlipY(e.invertY);var c=s.TEXTURE_2D;e.isCube&&(c=s.TEXTURE_CUBE_MAP_POSITIVE_X+i);var u=Math.round(Math.log(e.width)*Math.LOG2E),f=Math.round(Math.log(e.height)*Math.LOG2E),d=o?e.width:Math.pow(2,Math.max(u-n,0)),p=o?e.height:Math.pow(2,Math.max(f-n,0));s.texImage2D(c,n,h,d,p,0,l,a,t)},e.prototype.updateTextureData=function(e,t,i,n,r,o,s,a){void 0===s&&(s=0),void 0===a&&(a=0);var l=this._gl,h=this._getWebGLTextureType(e.type),c=this._getInternalFormat(e.format);this._unpackFlipY(e.invertY);var u=l.TEXTURE_2D;e.isCube&&(u=l.TEXTURE_CUBE_MAP_POSITIVE_X+s),l.texSubImage2D(u,a,i,n,r,o,c,h,t)},e.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var r=this._gl,o=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(o,e,!0),this._uploadDataToTextureDirectly(e,t,i,n),this._bindTextureDirectly(o,null,!0)},e.prototype._prepareWebGLTextureContinuation=function(e,t,i,n,r){var o=this._gl;if(o){var s=this._getSamplingParameters(r,!i);o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,s.mag),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,s.min),i||n||o.generateMipmap(o.TEXTURE_2D),this._bindTextureDirectly(o.TEXTURE_2D,null),t&&t._removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}},e.prototype._prepareWebGLTexture=function(t,i,n,r,o,s,a,l,h){var c=this;void 0===h&&(h=3);var u=this.getCaps().maxTextureSize,f=Math.min(u,this.needPOTTextures?e.GetExponentOfTwo(n,u):n),d=Math.min(u,this.needPOTTextures?e.GetExponentOfTwo(r,u):r),p=this._gl;p&&(t._webGLTexture?(this._bindTextureDirectly(p.TEXTURE_2D,t,!0),this._unpackFlipY(void 0===o||!!o),t.baseWidth=n,t.baseHeight=r,t.width=f,t.height=d,t.isReady=!0,l(f,d,(function(){c._prepareWebGLTextureContinuation(t,i,s,a,h)}))||this._prepareWebGLTextureContinuation(t,i,s,a,h)):i&&i._removePendingData(t))},e.prototype._setupFramebufferDepthAttachments=function(e,t,i,n,r){void 0===r&&(r=1);var o=this._gl;if(e&&t)return this._getDepthStencilBuffer(i,n,r,o.DEPTH_STENCIL,o.DEPTH24_STENCIL8,o.DEPTH_STENCIL_ATTACHMENT);if(t){var s=o.DEPTH_COMPONENT16;return this._webGLVersion>1&&(s=o.DEPTH_COMPONENT32F),this._getDepthStencilBuffer(i,n,r,s,s,o.DEPTH_ATTACHMENT)}return e?this._getDepthStencilBuffer(i,n,r,o.STENCIL_INDEX8,o.STENCIL_INDEX8,o.STENCIL_ATTACHMENT):null},e.prototype._releaseFramebufferObjects=function(e){var t=this._gl;e._framebuffer&&(t.deleteFramebuffer(e._framebuffer),e._framebuffer=null),e._depthStencilBuffer&&(t.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(t.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),e._MSAARenderBuffer&&(t.deleteRenderbuffer(e._MSAARenderBuffer),e._MSAARenderBuffer=null)},e.prototype._releaseTexture=function(e){this._releaseFramebufferObjects(e),this._deleteTexture(e._webGLTexture),this.unbindAllTextures();var t=this._internalTexturesCache.indexOf(e);-1!==t&&this._internalTexturesCache.splice(t,1),e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureLow&&e._lodTextureLow.dispose(),e._irradianceTexture&&e._irradianceTexture.dispose()},e.prototype._deleteTexture=function(e){this._gl.deleteTexture(e)},e.prototype._setProgram=function(e){this._currentProgram!==e&&(this._gl.useProgram(e),this._currentProgram=e)},e.prototype.bindSamplers=function(e){var t=e.getPipelineContext();this._setProgram(t.program);for(var i=e.getSamplers(),n=0;n-1;return i&&o&&(this._activeChannel=t._associatedChannel),this._boundTexturesCache[this._activeChannel]!==t||n?(this._activateCurrentTexture(),t&&t.isMultiview?this._gl.bindTexture(e,t?t._colorTextureArray:null):this._gl.bindTexture(e,t?t._webGLTexture:null),this._boundTexturesCache[this._activeChannel]=t,t&&(t._associatedChannel=this._activeChannel)):i&&(r=!0,this._activateCurrentTexture()),o&&!i&&this._bindSamplerUniformToChannel(t._associatedChannel,this._activeChannel),r},e.prototype._bindTexture=function(e,t){if(void 0!==e){t&&(t._associatedChannel=e),this._activeChannel=e;var i=t?this._getTextureTarget(t):this._gl.TEXTURE_2D;this._bindTextureDirectly(i,t)}},e.prototype.unbindAllTextures=function(){for(var e=0;e1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))},e.prototype.setTexture=function(e,t,i){void 0!==e&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,i))},e.prototype._bindSamplerUniformToChannel=function(e,t){var i=this._boundUniforms[e];i&&i._currentState!==t&&(this._gl.uniform1i(i,t),i._currentState=t)},e.prototype._getTextureWrapMode=function(e){switch(e){case 1:return this._gl.REPEAT;case 0:return this._gl.CLAMP_TO_EDGE;case 2:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT},e.prototype._setTexture=function(e,t,i,n){if(void 0===i&&(i=!1),void 0===n&&(n=!1),!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))),!1;if(t.video)this._activeChannel=e,t.update();else if(4===t.delayLoadState)return t.delayLoad(),!1;var r;r=n?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,!i&&r&&(r._associatedChannel=e);var o=!0;this._boundTexturesCache[e]===r&&(i||this._bindSamplerUniformToChannel(r._associatedChannel,e),o=!1),this._activeChannel=e;var s=this._getTextureTarget(r);if(o&&this._bindTextureDirectly(s,r,i),r&&!r.isMultiview){if(r.isCube&&r._cachedCoordinatesMode!==t.coordinatesMode){r._cachedCoordinatesMode=t.coordinatesMode;var a=3!==t.coordinatesMode&&5!==t.coordinatesMode?1:0;t.wrapU=a,t.wrapV=a}r._cachedWrapU!==t.wrapU&&(r._cachedWrapU=t.wrapU,this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t.wrapU),r)),r._cachedWrapV!==t.wrapV&&(r._cachedWrapV=t.wrapV,this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(t.wrapV),r)),r.is3D&&r._cachedWrapR!==t.wrapR&&(r._cachedWrapR=t.wrapR,this._setTextureParameterInteger(s,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(t.wrapR),r)),this._setAnisotropicLevel(s,r,t.anisotropicFilteringLevel)}return!0},e.prototype.setTextureArray=function(e,t,i){if(void 0!==e&&t){this._textureUnits&&this._textureUnits.length===i.length||(this._textureUnits=new Int32Array(i.length));for(var n=0;n=this._caps.maxVertexAttribs||!this._vertexAttribArraysEnabled[e]||this.disableAttributeByIndex(e)}},e.prototype.releaseEffects=function(){for(var e in this._compiledEffects){var t=this._compiledEffects[e].getPipelineContext();this._deletePipelineContext(t)}this._compiledEffects={}},e.prototype.dispose=function(){this.stopRenderLoop(),this.onBeforeTextureInitObservable&&this.onBeforeTextureInitObservable.clear(),this._emptyTexture&&(this._releaseTexture(this._emptyTexture),this._emptyTexture=null),this._emptyCubeTexture&&(this._releaseTexture(this._emptyCubeTexture),this._emptyCubeTexture=null),this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.releaseEffects(),this.unbindAllAttributes(),this._boundUniforms=[],f.M.IsWindowObjectExist()&&this._renderingCanvas&&(this._doNotHandleContextLost||(this._renderingCanvas.removeEventListener("webglcontextlost",this._onContextLost),this._renderingCanvas.removeEventListener("webglcontextrestored",this._onContextRestored))),this._workingCanvas=null,this._workingContext=null,this._currentBufferPointers=[],this._renderingCanvas=null,this._currentProgram=null,this._boundRenderFunction=null,r.Q.ResetCache();for(var e=0,t=this._activeRequests;e1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(1)},e.prototype._canRenderToHalfFloatFramebuffer=function(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(2)},e.prototype._canRenderToFramebuffer=function(e){for(var t=this._gl;t.getError()!==t.NO_ERROR;);var i=!0,n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texImage2D(t.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(e),1,1,0,t.RGBA,this._getWebGLTextureType(e),null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST);var r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0);var o=t.checkFramebufferStatus(t.FRAMEBUFFER);if((i=(i=i&&o===t.FRAMEBUFFER_COMPLETE)&&t.getError()===t.NO_ERROR)&&(t.clear(t.COLOR_BUFFER_BIT),i=i&&t.getError()===t.NO_ERROR),i){t.bindFramebuffer(t.FRAMEBUFFER,null);var s=t.RGBA,a=t.UNSIGNED_BYTE,l=new Uint8Array(4);t.readPixels(0,0,1,1,s,a,l),i=i&&t.getError()===t.NO_ERROR}for(t.deleteTexture(n),t.deleteFramebuffer(r),t.bindFramebuffer(t.FRAMEBUFFER,null);!i&&t.getError()!==t.NO_ERROR;);return i},e.prototype._getWebGLTextureType=function(e){if(1===this._webGLVersion){switch(e){case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT_OES;case 0:return this._gl.UNSIGNED_BYTE;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5}return this._gl.UNSIGNED_BYTE}switch(e){case 3:return this._gl.BYTE;case 0:return this._gl.UNSIGNED_BYTE;case 4:return this._gl.SHORT;case 5:return this._gl.UNSIGNED_SHORT;case 6:return this._gl.INT;case 7:return this._gl.UNSIGNED_INT;case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5;case 11:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case 12:return this._gl.UNSIGNED_INT_24_8;case 13:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case 14:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case 15:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE},e.prototype._getInternalFormat=function(e){var t=this._gl.RGBA;switch(e){case 0:t=this._gl.ALPHA;break;case 1:t=this._gl.LUMINANCE;break;case 2:t=this._gl.LUMINANCE_ALPHA;break;case 6:t=this._gl.RED;break;case 7:t=this._gl.RG;break;case 4:t=this._gl.RGB;break;case 5:t=this._gl.RGBA}if(this._webGLVersion>1)switch(e){case 8:t=this._gl.RED_INTEGER;break;case 9:t=this._gl.RG_INTEGER;break;case 10:t=this._gl.RGB_INTEGER;break;case 11:t=this._gl.RGBA_INTEGER}return t},e.prototype._getRGBABufferInternalSizedFormat=function(e,t){if(1===this._webGLVersion){if(void 0!==t)switch(t){case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;case 4:return this._gl.RGB}return this._gl.RGBA}switch(e){case 3:switch(t){case 6:return this._gl.R8_SNORM;case 7:return this._gl.RG8_SNORM;case 4:return this._gl.RGB8_SNORM;case 8:return this._gl.R8I;case 9:return this._gl.RG8I;case 10:return this._gl.RGB8I;case 11:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case 0:switch(t){case 6:return this._gl.R8;case 7:return this._gl.RG8;case 4:return this._gl.RGB8;case 5:return this._gl.RGBA8;case 8:return this._gl.R8UI;case 9:return this._gl.RG8UI;case 10:return this._gl.RGB8UI;case 11:return this._gl.RGBA8UI;case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;default:return this._gl.RGBA8}case 4:switch(t){case 8:return this._gl.R16I;case 9:return this._gl.RG16I;case 10:return this._gl.RGB16I;case 11:default:return this._gl.RGBA16I}case 5:switch(t){case 8:return this._gl.R16UI;case 9:return this._gl.RG16UI;case 10:return this._gl.RGB16UI;case 11:default:return this._gl.RGBA16UI}case 6:switch(t){case 8:return this._gl.R32I;case 9:return this._gl.RG32I;case 10:return this._gl.RGB32I;case 11:default:return this._gl.RGBA32I}case 7:switch(t){case 8:return this._gl.R32UI;case 9:return this._gl.RG32UI;case 10:return this._gl.RGB32UI;case 11:default:return this._gl.RGBA32UI}case 1:switch(t){case 6:return this._gl.R32F;case 7:return this._gl.RG32F;case 4:return this._gl.RGB32F;case 5:default:return this._gl.RGBA32F}case 2:switch(t){case 6:return this._gl.R16F;case 7:return this._gl.RG16F;case 4:return this._gl.RGB16F;case 5:default:return this._gl.RGBA16F}case 10:return this._gl.RGB565;case 13:return this._gl.R11F_G11F_B10F;case 14:return this._gl.RGB9_E5;case 8:return this._gl.RGBA4;case 9:return this._gl.RGB5_A1;case 11:switch(t){case 5:return this._gl.RGB10_A2;case 11:return this._gl.RGB10_A2UI;default:return this._gl.RGB10_A2}}return this._gl.RGBA8},e.prototype._getRGBAMultiSampleBufferFormat=function(e){return 1===e?this._gl.RGBA32F:2===e?this._gl.RGBA16F:this._gl.RGBA8},e.prototype._loadFile=function(t,i,n,r,o,s){var a=this,l=e._FileToolsLoadFile(t,i,n,r,o,s);return this._activeRequests.push(l),l.onCompleteObservable.add((function(e){a._activeRequests.splice(a._activeRequests.indexOf(e),1)})),l},e._FileToolsLoadFile=function(e,t,i,n,r,s){throw o.f.WarnImport("FileTools")},e.prototype.readPixels=function(e,t,i,n,r){void 0===r&&(r=!0);var o=r?4:3,s=r?this._gl.RGBA:this._gl.RGB,a=new Uint8Array(n*i*o);return this._gl.readPixels(e,t,i,n,s,this._gl.UNSIGNED_BYTE,a),a},Object.defineProperty(e,"IsSupported",{get:function(){return this.isSupported()},enumerable:!1,configurable:!0}),e.isSupported=function(){if(null!==this._HasMajorPerformanceCaveat)return!this._HasMajorPerformanceCaveat;if(null===this._IsSupported)try{var e=m.x.CreateCanvas(1,1),t=e.getContext("webgl")||e.getContext("experimental-webgl");this._IsSupported=null!=t&&!!window.WebGLRenderingContext}catch(e){this._IsSupported=!1}return this._IsSupported},Object.defineProperty(e,"HasMajorPerformanceCaveat",{get:function(){if(null===this._HasMajorPerformanceCaveat)try{var e=m.x.CreateCanvas(1,1),t=e.getContext("webgl",{failIfMajorPerformanceCaveat:!0})||e.getContext("experimental-webgl",{failIfMajorPerformanceCaveat:!0});this._HasMajorPerformanceCaveat=!t}catch(e){this._HasMajorPerformanceCaveat=!1}return this._HasMajorPerformanceCaveat},enumerable:!1,configurable:!0}),e.CeilingPOT=function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},e.FloorPOT=function(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)-(e>>1)},e.NearestPOT=function(t){var i=e.CeilingPOT(t),n=e.FloorPOT(t);return i-t>t-n?n:i},e.GetExponentOfTwo=function(t,i,n){var r;switch(void 0===n&&(n=2),n){case 1:r=e.FloorPOT(t);break;case 2:r=e.NearestPOT(t);break;case 3:default:r=e.CeilingPOT(t)}return Math.min(r,i)},e.QueueNewFrame=function(e,t){return f.M.IsWindowObjectExist()?(t||(t=window),t.requestPostAnimationFrame?t.requestPostAnimationFrame(e):t.requestAnimationFrame?t.requestAnimationFrame(e):t.msRequestAnimationFrame?t.msRequestAnimationFrame(e):t.webkitRequestAnimationFrame?t.webkitRequestAnimationFrame(e):t.mozRequestAnimationFrame?t.mozRequestAnimationFrame(e):t.oRequestAnimationFrame?t.oRequestAnimationFrame(e):window.setTimeout(e,16)):"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(e):setTimeout(e,16)},e.prototype.getHostDocument=function(){return this._renderingCanvas&&this._renderingCanvas.ownerDocument?this._renderingCanvas.ownerDocument:document},e.ExceptionList=[{key:"Chrome/63.0",capture:"63\\.0\\.3239\\.(\\d+)",captureConstraint:108,targets:["uniformBuffer"]},{key:"Firefox/58",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Firefox/59",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Chrome/72.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/73.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/74.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/71",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/72",capture:null,captureConstraint:null,targets:["vao"]}],e._TextureLoaders=[],e.CollisionsEpsilon=.001,e._IsSupported=null,e._HasMajorPerformanceCaveat=null,e}()},96:(e,t,i)=>{"use strict";i.d(t,{p:()=>n,o:()=>r});var n=function(){function e(){}return e.COPY=1,e.CUT=2,e.PASTE=3,e}(),r=function(){function e(e,t){this.type=e,this.event=t}return e.GetTypeFromCharacter=function(e){switch(e){case 67:return n.COPY;case 86:return n.PASTE;case 88:return n.CUT;default:return-1}},e}()},3997:(e,t,i)=>{"use strict";i.d(t,{OG:()=>r,NG:()=>o,WZ:()=>s});var n=i(655),r=function(){function e(){}return e.KEYDOWN=1,e.KEYUP=2,e}(),o=function(e,t){this.type=e,this.event=t},s=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.type=t,n.event=i,n.skipOnPointerObservable=!1,n}return(0,n.ZT)(t,e),t}(o)},5441:(e,t,i)=>{"use strict";i.d(t,{kD:()=>o,FV:()=>a,R5:()=>l});var n=i(655),r=i(2973),o=function(){function e(){}return e.POINTERDOWN=1,e.POINTERUP=2,e.POINTERMOVE=4,e.POINTERWHEEL=8,e.POINTERPICK=16,e.POINTERTAP=32,e.POINTERDOUBLETAP=64,e}(),s=function(e,t){this.type=e,this.event=t},a=function(e){function t(t,i,n,o){var s=e.call(this,t,i)||this;return s.ray=null,s.skipOnPointerObservable=!1,s.localPosition=new r.FM(n,o),s}return(0,n.ZT)(t,e),t}(s),l=function(e){function t(t,i,n){var r=e.call(this,t,i)||this;return r.pickInfo=n,r}return(0,n.ZT)(t,e),t}(s)},6182:(e,t,i)=>{"use strict";i.r(t),i.d(t,{HemisphericLight:()=>h});var n=i(655),r=i(9023),o=i(2973),s=i(8362),a=i(2686),l=i(5697);a.N.AddNodeConstructor("Light_Type_3",(function(e,t){return function(){return new h(e,o.P.Zero(),t)}}));var h=function(e){function t(t,i,n){var r=e.call(this,t,n)||this;return r.groundColor=new s.Wo(0,0,0),r.direction=i||o.P.Up(),r}return(0,n.ZT)(t,e),t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightGround",3),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},t.prototype.getClassName=function(){return"HemisphericLight"},t.prototype.setDirectionToTarget=function(e){return this.direction=o.P.Normalize(e.subtract(o.P.Zero())),this.direction},t.prototype.getShadowGenerator=function(){return null},t.prototype.transferToEffect=function(e,t){var i=o.P.Normalize(this.direction);return this._uniformBuffer.updateFloat4("vLightData",i.x,i.y,i.z,0,t),this._uniformBuffer.updateColor3("vLightGround",this.groundColor.scale(this.intensity),t),this},t.prototype.transferToNodeMaterialEffect=function(e,t){var i=o.P.Normalize(this.direction);return e.setFloat3(t,i.x,i.y,i.z),this},t.prototype.computeWorldMatrix=function(){return this._worldMatrix||(this._worldMatrix=o.y3.Identity()),this._worldMatrix},t.prototype.getTypeID=function(){return l._.LIGHTTYPEID_HEMISPHERICLIGHT},t.prototype.prepareLightSpecificDefines=function(e,t){e["HEMILIGHT"+t]=!0},(0,n.gn)([(0,r.n9)()],t.prototype,"groundColor",void 0),(0,n.gn)([(0,r.hd)()],t.prototype,"direction",void 0),t}(l._)},5697:(e,t,i)=>{"use strict";i.d(t,{_:()=>c});var n=i(655),r=i(9023),o=i(2973),s=i(8362),a=i(2686),l=i(356),h=i(6132),c=function(e){function t(i,n){var r=e.call(this,i,n)||this;return r.diffuse=new s.Wo(1,1,1),r.specular=new s.Wo(1,1,1),r.falloffType=t.FALLOFF_DEFAULT,r.intensity=1,r._range=Number.MAX_VALUE,r._inverseSquaredRange=0,r._photometricScale=1,r._intensityMode=t.INTENSITYMODE_AUTOMATIC,r._radius=1e-5,r.renderPriority=0,r._shadowEnabled=!0,r._excludeWithLayerMask=0,r._includeOnlyWithLayerMask=0,r._lightmapMode=0,r._excludedMeshesIds=new Array,r._includedOnlyMeshesIds=new Array,r._isLight=!0,r.getScene().addLight(r),r._uniformBuffer=new l.M(r.getScene().getEngine()),r._buildUniformLayout(),r.includedOnlyMeshes=new Array,r.excludedMeshes=new Array,r._resyncMeshes(),r}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"range",{get:function(){return this._range},set:function(e){this._range=e,this._inverseSquaredRange=1/(this.range*this.range)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"intensityMode",{get:function(){return this._intensityMode},set:function(e){this._intensityMode=e,this._computePhotometricScale()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._computePhotometricScale()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowEnabled",{get:function(){return this._shadowEnabled},set:function(e){this._shadowEnabled!==e&&(this._shadowEnabled=e,this._markMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"includedOnlyMeshes",{get:function(){return this._includedOnlyMeshes},set:function(e){this._includedOnlyMeshes=e,this._hookArrayForIncludedOnly(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"excludedMeshes",{get:function(){return this._excludedMeshes},set:function(e){this._excludedMeshes=e,this._hookArrayForExcluded(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"excludeWithLayerMask",{get:function(){return this._excludeWithLayerMask},set:function(e){this._excludeWithLayerMask=e,this._resyncMeshes()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"includeOnlyWithLayerMask",{get:function(){return this._includeOnlyWithLayerMask},set:function(e){this._includeOnlyWithLayerMask=e,this._resyncMeshes()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lightmapMode",{get:function(){return this._lightmapMode},set:function(e){this._lightmapMode!==e&&(this._lightmapMode=e,this._markMeshesAsLightDirty())},enumerable:!1,configurable:!0}),t.prototype.transferTexturesToEffect=function(e,t){return this},t.prototype._bindLight=function(e,t,i,n,r){void 0===r&&(r=!1);var o=e.toString(),a=!1;if(!r||!this._uniformBuffer._alreadyBound){if(this._uniformBuffer.bindToEffect(i,"Light"+o),this._renderId!==t.getRenderId()||!this._uniformBuffer.useUbo){this._renderId=t.getRenderId();var l=this.getScaledIntensity();this.transferToEffect(i,o),this.diffuse.scaleToRef(l,s.zZ.Color3[0]),this._uniformBuffer.updateColor4("vLightDiffuse",s.zZ.Color3[0],this.range,o),n&&(this.specular.scaleToRef(l,s.zZ.Color3[1]),this._uniformBuffer.updateColor4("vLightSpecular",s.zZ.Color3[1],this.radius,o)),a=!0}if(this.transferTexturesToEffect(i,o),t.shadowsEnabled&&this.shadowEnabled){var h=this.getShadowGenerator();h&&(h.bindShadowLight(o,i),a=!0)}a&&this._uniformBuffer.update()}},t.prototype.getClassName=function(){return"Light"},t.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+["Point","Directional","Spot","Hemispheric"][this.getTypeID()],this.animations)for(var i=0;i0&&-1===this.includedOnlyMeshes.indexOf(e))&&(!(this.excludedMeshes&&this.excludedMeshes.length>0&&-1!==this.excludedMeshes.indexOf(e))&&((0===this.includeOnlyWithLayerMask||0!=(this.includeOnlyWithLayerMask&e.layerMask))&&!(0!==this.excludeWithLayerMask&&this.excludeWithLayerMask&e.layerMask)))},t.CompareLightsPriority=function(e,t){return e.shadowEnabled!==t.shadowEnabled?(t.shadowEnabled?1:0)-(e.shadowEnabled?1:0):t.renderPriority-e.renderPriority},t.prototype.dispose=function(t,i){void 0===i&&(i=!1),this._shadowGenerator&&(this._shadowGenerator.dispose(),this._shadowGenerator=null),this.getScene().stopAnimation(this);for(var n=0,r=this.getScene().meshes;n0&&(e.excludedMeshesIds=[],this.excludedMeshes.forEach((function(t){e.excludedMeshesIds.push(t.id)}))),this.includedOnlyMeshes.length>0&&(e.includedOnlyMeshesIds=[],this.includedOnlyMeshes.forEach((function(t){e.includedOnlyMeshesIds.push(t.id)}))),r.p4.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e},t.GetConstructorFromName=function(e,t,i){var n=a.N.Construct("Light_Type_"+e,t,i);return n||null},t.Parse=function(e,i){var n=t.GetConstructorFromName(e.type,e.name,i);if(!n)return null;var o=r.p4.Parse(n,e,i);if(e.excludedMeshesIds&&(o._excludedMeshesIds=e.excludedMeshesIds),e.includedOnlyMeshesIds&&(o._includedOnlyMeshesIds=e.includedOnlyMeshesIds),e.parentId&&(o._waitingParentId=e.parentId),void 0!==e.falloffType&&(o.falloffType=e.falloffType),void 0!==e.lightmapMode&&(o.lightmapMode=e.lightmapMode),e.animations){for(var s=0;s{"use strict";i.r(t),i.d(t,{SceneLoaderAnimationGroupLoadingMode:()=>n,SceneLoader:()=>f});var n,r=i(5540),o=i(475),s=i(3483),a=i(4391),l=i(2905),h=i(2733),c=i(3734),u=i(9995);!function(e){e[e.Clean=0]="Clean",e[e.Stop=1]="Stop",e[e.Sync=2]="Sync",e[e.NoSync=3]="NoSync"}(n||(n={}));var f=function(){function e(){}return Object.defineProperty(e,"ForceFullSceneLoadingForIncremental",{get:function(){return u.Z.ForceFullSceneLoadingForIncremental},set:function(e){u.Z.ForceFullSceneLoadingForIncremental=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ShowLoadingScreen",{get:function(){return u.Z.ShowLoadingScreen},set:function(e){u.Z.ShowLoadingScreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"loggingLevel",{get:function(){return u.Z.loggingLevel},set:function(e){u.Z.loggingLevel=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"CleanBoneMatrixWeights",{get:function(){return u.Z.CleanBoneMatrixWeights},set:function(e){u.Z.CleanBoneMatrixWeights=e},enumerable:!1,configurable:!0}),e.GetDefaultPlugin=function(){return e._registeredPlugins[".babylon"]},e._GetPluginForExtension=function(t){var i=e._registeredPlugins[t];return i||(c.Y.Warn("Unable to find a plugin to load "+t+" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/how_to/load_from_any_file_type"),e.GetDefaultPlugin())},e._GetPluginForDirectLoad=function(t){for(var i in e._registeredPlugins){var n=e._registeredPlugins[i].plugin;if(n.canDirectLoad&&n.canDirectLoad(t))return e._registeredPlugins[i]}return e.GetDefaultPlugin()},e._GetPluginForFilename=function(t){var i=t.indexOf("?");-1!==i&&(t=t.substring(0,i));var n=t.lastIndexOf("."),r=t.substring(n,t.length).toLowerCase();return e._GetPluginForExtension(r)},e._GetDirectLoad=function(e){return"data:"===e.substr(0,5)?e.substr(5):null},e._LoadData=function(t,i,n,r,o,a,h){var c,u=e._GetDirectLoad(t.name),f=h?e._GetPluginForExtension(h):u?e._GetPluginForDirectLoad(t.name):e._GetPluginForFilename(t.name);if(!(c=void 0!==f.plugin.createPlugin?f.plugin.createPlugin():f.plugin))throw"The loader plugin corresponding to the file type you are trying to load has not been found. If using es6, please import the plugin you wish to use before.";if(e.OnPluginActivatedObservable.notifyObservers(c),u){if(c.directLoad){var d=c.directLoad(i,u);d.then?d.then((function(e){n(c,e)})).catch((function(e){o("Error in directLoad of _loadData: "+e,e)})):n(c,d)}else n(c,u);return c}var p=f.isBinary,_=function(e,t){i.isDisposed?o("Scene has been disposed"):n(c,e,t)},g=null,m=!1,v=c.onDisposeObservable;v&&v.add((function(){m=!0,g&&(g.abort(),g=null),a()}));var y=function(){if(!m){var e=function(e,t){_(e,t?t.responseURL:void 0)},n=function(e){o(e.message,e)};g=c.requestFile?c.requestFile(i,t.url,e,r,p,n):i._requestFile(t.url,e,r,!0,p,n)}},b=t.file||s.X.FilesToLoad[t.name.toLowerCase()];if(-1===t.rootUrl.indexOf("file:")||-1!==t.rootUrl.indexOf("file:")&&!b){var T=i.getEngine(),A=T.enableOfflineSupport;if(A){for(var E=!1,C=0,x=i.disableOfflineSupportExceptionRules;C{"use strict";i.d(t,{Z:()=>n});var n=function(){function e(){}return Object.defineProperty(e,"ForceFullSceneLoadingForIncremental",{get:function(){return e._ForceFullSceneLoadingForIncremental},set:function(t){e._ForceFullSceneLoadingForIncremental=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ShowLoadingScreen",{get:function(){return e._ShowLoadingScreen},set:function(t){e._ShowLoadingScreen=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"loggingLevel",{get:function(){return e._loggingLevel},set:function(t){e._loggingLevel=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,"CleanBoneMatrixWeights",{get:function(){return e._CleanBoneMatrixWeights},set:function(t){e._CleanBoneMatrixWeights=t},enumerable:!1,configurable:!0}),e._ForceFullSceneLoadingForIncremental=!1,e._ShowLoadingScreen=!0,e._CleanBoneMatrixWeights=!1,e._loggingLevel=0,e}()},4664:(e,t,i)=>{"use strict";i.d(t,{V:()=>c});var n=i(655),r=i(9023),o=i(475),s=i(2973),a=i(2733),l=i(8927),h=(i(5684),i(488)),c=function(e){function t(i){var n=e.call(this,null)||this;return n.metadata=null,n.reservedDataStore=null,n._hasAlpha=!1,n.getAlphaFromRGB=!1,n.level=1,n.coordinatesIndex=0,n._coordinatesMode=0,n.wrapR=1,n.anisotropicFilteringLevel=t.DEFAULT_ANISOTROPIC_FILTERING_LEVEL,n._isCube=!1,n._gammaSpace=!0,n.invertZ=!1,n.lodLevelInAlpha=!1,n.isRenderTarget=!1,n._prefiltered=!1,n.animations=new Array,n.onDisposeObservable=new o.y$,n._onDisposeObserver=null,n._scene=null,n._texture=null,n._uid=null,i?t._isScene(i)?n._scene=i:n._engine=i:n._scene=a.l.LastCreatedScene,n._scene&&(n.uniqueId=n._scene.getUniqueId(),n._scene.addTexture(n),n._engine=n._scene.getEngine()),n._uid=null,n}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"hasAlpha",{get:function(){return this._hasAlpha},set:function(e){this._hasAlpha!==e&&(this._hasAlpha=e,this._scene&&this._scene.markAllMaterialsAsDirty(17))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"coordinatesMode",{get:function(){return this._coordinatesMode},set:function(e){this._coordinatesMode!==e&&(this._coordinatesMode=e,this._scene&&this._scene.markAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wrapU",{get:function(){return this._wrapU},set:function(e){this._wrapU=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wrapV",{get:function(){return this._wrapV},set:function(e){this._wrapV=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isCube",{get:function(){return this._texture?this._texture.isCube:this._isCube},set:function(e){this._texture?this._texture.isCube=e:this._isCube=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"is3D",{get:function(){return!!this._texture&&this._texture.is3D},set:function(e){this._texture&&(this._texture.is3D=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"is2DArray",{get:function(){return!!this._texture&&this._texture.is2DArray},set:function(e){this._texture&&(this._texture.is2DArray=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gammaSpace",{get:function(){return this._texture?(null===this._texture._gammaSpace&&(this._texture._gammaSpace=this._gammaSpace),this._texture._gammaSpace):this._gammaSpace},set:function(e){if(this._texture){if(this._texture._gammaSpace===e)return;this._texture._gammaSpace=e}else{if(this._gammaSpace===e)return;this._gammaSpace=e}this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRGBD",{get:function(){return null!=this._texture&&this._texture._isRGBD},set:function(e){this._texture&&(this._texture._isRGBD=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"noMipmap",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodGenerationOffset",{get:function(){return this._texture?this._texture._lodGenerationOffset:0},set:function(e){this._texture&&(this._texture._lodGenerationOffset=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lodGenerationScale",{get:function(){return this._texture?this._texture._lodGenerationScale:0},set:function(e){this._texture&&(this._texture._lodGenerationScale=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linearSpecularLOD",{get:function(){return!!this._texture&&this._texture._linearSpecularLOD},set:function(e){this._texture&&(this._texture._linearSpecularLOD=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"irradianceTexture",{get:function(){return this._texture?this._texture._irradianceTexture:null},set:function(e){this._texture&&(this._texture._irradianceTexture=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uid",{get:function(){return this._uid||(this._uid=l.x.RandomId()),this._uid},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return this.name},t.prototype.getClassName=function(){return"BaseTexture"},Object.defineProperty(t.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isBlocking",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.getScene=function(){return this._scene},t.prototype._getEngine=function(){return this._engine},t.prototype.checkTransformsAreIdentical=function(e){return null!==e},t.prototype.getTextureMatrix=function(){return s.y3.IdentityReadOnly},t.prototype.getReflectionTextureMatrix=function(){return s.y3.IdentityReadOnly},t.prototype.isReadyOrNotBlocking=function(){return!this.isBlocking||this.isReady()},t.prototype.scale=function(e){},Object.defineProperty(t.prototype,"canRescale",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype._getFromCache=function(e,t,i,n){var r=this._getEngine();if(!r)return null;for(var o=r.getLoadedTexturesCache(),s=0;s=0&&this._scene.textures.splice(t,1),this._scene.onTextureRemovedObservable.notifyObservers(this),this._scene=null}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),e.prototype.dispose.call(this)},t.prototype.serialize=function(){if(!this.name)return null;var e=r.p4.Serialize(this);return r.p4.AppendSerializedAnimations(this,e),e},t.WhenAllReady=function(e,t){var i=e.length;if(0!==i)for(var n=0;n{"use strict";i.r(t),i.d(t,{DynamicTexture:()=>h});var n=i(655),r=i(3734),o=i(4283),s=i(2131),a=i(7627);s.B.prototype.createDynamicTexture=function(e,t,i,n){var r=new a.l(this,a.S.Dynamic);return r.baseWidth=e,r.baseHeight=t,i&&(e=this.needPOTTextures?s.B.GetExponentOfTwo(e,this._caps.maxTextureSize):e,t=this.needPOTTextures?s.B.GetExponentOfTwo(t,this._caps.maxTextureSize):t),r.width=e,r.height=t,r.isReady=!1,r.generateMipMaps=i,r.samplingMode=n,this.updateTextureSamplingMode(n,r),this._internalTexturesCache.push(r),r},s.B.prototype.updateDynamicTexture=function(e,t,i,n,r,o){if(void 0===n&&(n=!1),void 0===o&&(o=!1),e){var s=this._gl,a=s.TEXTURE_2D,l=this._bindTextureDirectly(a,e,!0,o);this._unpackFlipY(void 0===i?e.invertY:i),n&&s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1);var h=this._getWebGLTextureType(e.type),c=this._getInternalFormat(r||e.format),u=this._getRGBABufferInternalSizedFormat(e.type,c);s.texImage2D(a,0,u,c,h,t),e.generateMipMaps&&s.generateMipmap(a),l||this._bindTextureDirectly(a,null),n&&s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.isReady=!0}};var l=i(1370),h=function(e){function t(t,i,n,r,s,a,h){void 0===n&&(n=null),void 0===s&&(s=3),void 0===a&&(a=5);var c=e.call(this,null,n,!r,h,s,void 0,void 0,void 0,void 0,a)||this;c.name=t,c.wrapU=o.x.CLAMP_ADDRESSMODE,c.wrapV=o.x.CLAMP_ADDRESSMODE,c._generateMipMaps=r;var u=c._getEngine();if(!u)return c;i.getContext?(c._canvas=i,c._texture=u.createDynamicTexture(i.width,i.height,r,s)):(c._canvas=l.x.CreateCanvas(1,1),i.width||0===i.width?c._texture=u.createDynamicTexture(i.width,i.height,r,s):c._texture=u.createDynamicTexture(i,i,r,s));var f=c.getSize();return c._canvas.width=f.width,c._canvas.height=f.height,c._context=c._canvas.getContext("2d"),c}return(0,n.ZT)(t,e),t.prototype.getClassName=function(){return"DynamicTexture"},Object.defineProperty(t.prototype,"canRescale",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype._recreate=function(e){this._canvas.width=e.width,this._canvas.height=e.height,this.releaseInternalTexture(),this._texture=this._getEngine().createDynamicTexture(e.width,e.height,this._generateMipMaps,this.samplingMode)},t.prototype.scale=function(e){var t=this.getSize();t.width*=e,t.height*=e,this._recreate(t)},t.prototype.scaleTo=function(e,t){var i=this.getSize();i.width=e,i.height=t,this._recreate(i)},t.prototype.getContext=function(){return this._context},t.prototype.clear=function(){var e=this.getSize();this._context.fillRect(0,0,e.width,e.height)},t.prototype.update=function(e,t){void 0===t&&(t=!1),this._getEngine().updateDynamicTexture(this._texture,this._canvas,void 0===e||e,t,this._format||void 0)},t.prototype.drawText=function(e,t,i,n,r,o,s,a){void 0===a&&(a=!0);var l=this.getSize();if(o&&(this._context.fillStyle=o,this._context.fillRect(0,0,l.width,l.height)),this._context.font=n,null==t){var h=this._context.measureText(e);t=(l.width-h.width)/2}if(null==i){var c=parseInt(n.replace(/\D/g,""));i=l.height/2+c/3.65}this._context.fillStyle=r||"",this._context.fillText(e,t,i),a&&this.update(s)},t.prototype.clone=function(){var e=this.getScene();if(!e)return this;var i=this.getSize(),n=new t(this.name,i,e,this._generateMipMaps);return n.hasAlpha=this.hasAlpha,n.level=this.level,n.wrapU=this.wrapU,n.wrapV=this.wrapV,n},t.prototype.serialize=function(){var t=this.getScene();t&&!t.isReady()&&r.Y.Warn("The scene must be ready before serializing the dynamic texture");var i=e.prototype.serialize.call(this);return this._IsCanvasElement(this._canvas)&&(i.base64String=this._canvas.toDataURL()),i.invertY=this._invertY,i.samplingMode=this.samplingMode,i},t.prototype._IsCanvasElement=function(e){return void 0!==e.toDataURL},t.prototype._rebuild=function(){this.update()},t}(o.x)},7627:(e,t,i)=>{"use strict";i.d(t,{S:()=>n,l:()=>a});var n,r=i(475),o=i(7533),s=i(106);!function(e){e[e.Unknown=0]="Unknown",e[e.Url=1]="Url",e[e.Temp=2]="Temp",e[e.Raw=3]="Raw",e[e.Dynamic=4]="Dynamic",e[e.RenderTarget=5]="RenderTarget",e[e.MultiRenderTarget=6]="MultiRenderTarget",e[e.Cube=7]="Cube",e[e.CubeRaw=8]="CubeRaw",e[e.CubePrefiltered=9]="CubePrefiltered",e[e.Raw3D=10]="Raw3D",e[e.Raw2DArray=11]="Raw2DArray",e[e.Depth=12]="Depth",e[e.CubeRawRGBD=13]="CubeRawRGBD"}(n||(n={}));var a=function(){function e(e,t,i){void 0===i&&(i=!1),this.isReady=!1,this.isCube=!1,this.is3D=!1,this.is2DArray=!1,this.isMultiview=!1,this.url="",this.samplingMode=-1,this.generateMipMaps=!1,this.samples=0,this.type=-1,this.format=-1,this.onLoadedObservable=new r.y$,this.width=0,this.height=0,this.depth=0,this.baseWidth=0,this.baseHeight=0,this.baseDepth=0,this.invertY=!1,this._invertVScale=!1,this._associatedChannel=-1,this._source=n.Unknown,this._buffer=null,this._bufferView=null,this._bufferViewArray=null,this._bufferViewArrayArray=null,this._size=0,this._extension="",this._files=null,this._workingCanvas=null,this._workingContext=null,this._framebuffer=null,this._depthStencilBuffer=null,this._MSAAFramebuffer=null,this._MSAARenderBuffer=null,this._attachments=null,this._textureArray=null,this._cachedCoordinatesMode=null,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedWrapR=null,this._cachedAnisotropicFilteringLevel=null,this._isDisabled=!1,this._compression=null,this._generateStencilBuffer=!1,this._generateDepthBuffer=!1,this._comparisonFunction=0,this._sphericalPolynomial=null,this._lodGenerationScale=0,this._lodGenerationOffset=0,this._colorTextureArray=null,this._depthStencilTextureArray=null,this._lodTextureHigh=null,this._lodTextureMid=null,this._lodTextureLow=null,this._isRGBD=!1,this._linearSpecularLOD=!1,this._irradianceTexture=null,this._webGLTexture=null,this._references=1,this._gammaSpace=null,this._engine=e,this._source=t,i||(this._webGLTexture=e._createTexture())}return e.prototype.getEngine=function(){return this._engine},Object.defineProperty(e.prototype,"source",{get:function(){return this._source},enumerable:!1,configurable:!0}),e.prototype.incrementReferences=function(){this._references++},e.prototype.updateSize=function(e,t,i){void 0===i&&(i=1),this.width=e,this.height=t,this.depth=i,this.baseWidth=e,this.baseHeight=t,this.baseDepth=i,this._size=e*t*i},e.prototype._rebuild=function(){var t,i,r=this;switch(this.isReady=!1,this._cachedCoordinatesMode=null,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedAnisotropicFilteringLevel=null,this.source){case n.Temp:return;case n.Url:return void(i=this._engine.createTexture(null!==(t=this._originalUrl)&&void 0!==t?t:this.url,!this.generateMipMaps,this.invertY,null,this.samplingMode,(function(){i._swapAndDie(r),r.isReady=!0}),null,this._buffer,void 0,this.format));case n.Raw:return(i=this._engine.createRawTexture(this._bufferView,this.baseWidth,this.baseHeight,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case n.Raw3D:return(i=this._engine.createRawTexture3D(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case n.Raw2DArray:return(i=this._engine.createRawTexture2DArray(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case n.Dynamic:return(i=this._engine.createDynamicTexture(this.baseWidth,this.baseHeight,this.generateMipMaps,this.samplingMode))._swapAndDie(this),void this._engine.updateDynamicTexture(this,this._engine.getRenderingCanvas(),this.invertY,void 0,void 0,!0);case n.RenderTarget:var s=new o.L;if(s.generateDepthBuffer=this._generateDepthBuffer,s.generateMipMaps=this.generateMipMaps,s.generateStencilBuffer=this._generateStencilBuffer,s.samplingMode=this.samplingMode,s.type=this.type,this.isCube)i=this._engine.createRenderTargetCubeTexture(this.width,s);else{var a={width:this.width,height:this.height,layers:this.is2DArray?this.depth:void 0};i=this._engine.createRenderTargetTexture(a,s)}return i._swapAndDie(this),void(this.isReady=!0);case n.Depth:var l={bilinearFiltering:2!==this.samplingMode,comparisonFunction:this._comparisonFunction,generateStencil:this._generateStencilBuffer,isCube:this.isCube},h={width:this.width,height:this.height,layers:this.is2DArray?this.depth:void 0};return(i=this._engine.createDepthStencilTexture(h,l))._swapAndDie(this),void(this.isReady=!0);case n.Cube:return void(i=this._engine.createCubeTexture(this.url,null,this._files,!this.generateMipMaps,(function(){i._swapAndDie(r),r.isReady=!0}),null,this.format,this._extension));case n.CubeRaw:return(i=this._engine.createRawCubeTexture(this._bufferViewArray,this.width,this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case n.CubeRawRGBD:return i=this._engine.createRawCubeTexture(null,this.width,this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression),void e._UpdateRGBDAsync(i,this._bufferViewArrayArray,this._sphericalPolynomial,this._lodGenerationScale,this._lodGenerationOffset).then((function(){i._swapAndDie(r),r.isReady=!0}));case n.CubePrefiltered:return void((i=this._engine.createPrefilteredCubeTexture(this.url,null,this._lodGenerationScale,this._lodGenerationOffset,(function(e){e&&e._swapAndDie(r),r.isReady=!0}),null,this.format,this._extension))._sphericalPolynomial=this._sphericalPolynomial)}},e.prototype._swapAndDie=function(e){e._webGLTexture=this._webGLTexture,e._isRGBD=this._isRGBD,this._framebuffer&&(e._framebuffer=this._framebuffer),this._depthStencilBuffer&&(e._depthStencilBuffer=this._depthStencilBuffer),e._depthStencilTexture=this._depthStencilTexture,this._lodTextureHigh&&(e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureHigh=this._lodTextureHigh),this._lodTextureMid&&(e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureMid=this._lodTextureMid),this._lodTextureLow&&(e._lodTextureLow&&e._lodTextureLow.dispose(),e._lodTextureLow=this._lodTextureLow),this._irradianceTexture&&(e._irradianceTexture&&e._irradianceTexture.dispose(),e._irradianceTexture=this._irradianceTexture);var t,i=this._engine.getLoadedTexturesCache();-1!==(t=i.indexOf(this))&&i.splice(t,1),-1===(t=i.indexOf(e))&&i.push(e)},e.prototype.dispose=function(){this._webGLTexture&&(this._references--,0===this._references&&(this._engine._releaseTexture(this),this._webGLTexture=null))},e._UpdateRGBDAsync=function(e,t,i,n,r){throw s.f.WarnImport("environmentTextureTools")},e}()},7533:(e,t,i)=>{"use strict";i.d(t,{L:()=>n});var n=function(){}},5082:(e,t,i)=>{"use strict";i.d(t,{_:()=>u});var n=i(655),r=i(475),o=i(5540),s=i(2973),a=i(4283),l=i(4761),h=i(7555),c=(i(6593),i(1744),i(2905)),u=function(e){function t(t,i,n,o,l,c,u,f,d,p,_,g,m){void 0===l&&(l=!0),void 0===c&&(c=0),void 0===u&&(u=!1),void 0===f&&(f=a.x.TRILINEAR_SAMPLINGMODE),void 0===d&&(d=!0),void 0===p&&(p=!1),void 0===_&&(_=!1),void 0===g&&(g=5),void 0===m&&(m=!1);var v=e.call(this,null,n,!o)||this;return v.renderParticles=!0,v.renderSprites=!1,v.ignoreCameraViewport=!1,v.onBeforeBindObservable=new r.y$,v.onAfterUnbindObservable=new r.y$,v.onBeforeRenderObservable=new r.y$,v.onAfterRenderObservable=new r.y$,v.onClearObservable=new r.y$,v.onResizeObservable=new r.y$,v._currentRefreshId=-1,v._refreshRate=1,v._samples=1,v.boundingBoxPosition=s.P.Zero(),(n=v.getScene())?(v._coordinatesMode=a.x.PROJECTION_MODE,v.renderList=new Array,v.name=t,v.isRenderTarget=!0,v._initialSizeParameter=i,v._processSizeParameter(i),v._resizeObserver=v.getScene().getEngine().onResizeObservable.add((function(){})),v._generateMipMaps=!!o,v._doNotChangeAspectRatio=l,v._renderingManager=new h.$(n),v._renderingManager._useSceneAutoClearSetup=!0,_||(v._renderTargetOptions={generateMipMaps:o,type:c,format:g,samplingMode:f,generateDepthBuffer:d,generateStencilBuffer:p},f===a.x.NEAREST_SAMPLINGMODE&&(v.wrapU=a.x.CLAMP_ADDRESSMODE,v.wrapV=a.x.CLAMP_ADDRESSMODE),m||(u?(v._texture=n.getEngine().createRenderTargetCubeTexture(v.getRenderSize(),v._renderTargetOptions),v.coordinatesMode=a.x.INVCUBIC_MODE,v._textureMatrix=s.y3.Identity()):v._texture=n.getEngine().createRenderTargetTexture(v._size,v._renderTargetOptions))),v):v}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"renderList",{get:function(){return this._renderList},set:function(e){this._renderList=e,this._renderList&&this._hookArray(this._renderList)},enumerable:!1,configurable:!0}),t.prototype._hookArray=function(e){var t=this,i=e.push;e.push=function(){for(var n=[],r=0;r0&&(this._postProcesses[0].autoClear=!1))}},t.prototype._shouldRender=function(){return-1===this._currentRefreshId||this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,!0):(this._currentRefreshId++,!1)},t.prototype.getRenderSize=function(){return this.getRenderWidth()},t.prototype.getRenderWidth=function(){return this._size.width?this._size.width:this._size},t.prototype.getRenderHeight=function(){return this._size.width?this._size.height:this._size},t.prototype.getRenderLayers=function(){var e=this._size.layers;return e||0},Object.defineProperty(t.prototype,"canRescale",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.scale=function(e){var t=Math.max(1,this.getRenderSize()*e);this.resize(t)},t.prototype.getReflectionTextureMatrix=function(){return this.isCube?this._textureMatrix:e.prototype.getReflectionTextureMatrix.call(this)},t.prototype.resize=function(e){var t=this.isCube;this.releaseInternalTexture();var i=this.getScene();i&&(this._processSizeParameter(e),this._texture=t?i.getEngine().createRenderTargetCubeTexture(this.getRenderSize(),this._renderTargetOptions):i.getEngine().createRenderTargetTexture(this._size,this._renderTargetOptions),this.onResizeObservable.hasObservers()&&this.onResizeObservable.notifyObservers(this))},t.prototype.render=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!1),a=this.getScene()){var i,n=a.getEngine();if(void 0!==this.useCameraPostProcesses&&(e=this.useCameraPostProcesses),this._waitingRenderList){this.renderList=[];for(var r=0;r1||this.activeCamera&&this.activeCamera!==a.activeCamera)&&a.setTransformMatrix(a.activeCamera.getViewMatrix(),a.activeCamera.getProjectionMatrix(!0)),n.setViewport(a.activeCamera.viewport)),a.resetCachedMaterial()}},t.prototype._bestReflectionRenderTargetDimension=function(e,t){var i=e*t,n=c.Engine.NearestPOT(i+16384/(128+i));return Math.min(c.Engine.FloorPOT(e),n)},t.prototype._prepareRenderingManager=function(e,t,i,n){var r=this.getScene();if(r){this._renderingManager.reset();for(var o=r.getRenderId(),s=0;s=0&&this._renderingManager.dispatchParticles(d))}}},t.prototype._bindFrameBuffer=function(e,t){void 0===e&&(e=0),void 0===t&&(t=0);var i=this.getScene();if(i){var n=i.getEngine();this._texture&&n.bindFramebuffer(this._texture,this.isCube?e:void 0,void 0,void 0,this.ignoreCameraViewport,0,t)}},t.prototype.unbindFrameBuffer=function(e,t){var i=this;this._texture&&e.unBindFramebuffer(this._texture,this.isCube,(function(){i.onAfterRenderObservable.notifyObservers(t)}))},t.prototype.renderToTarget=function(e,t,i,n,r){void 0===n&&(n=0),void 0===r&&(r=null);var s=this.getScene();if(s){var a=s.getEngine();if(this._texture){this._postProcessManager?this._postProcessManager._prepareFrame(this._texture,this._postProcesses):t&&s.postProcessManager._prepareFrame(this._texture)||this._bindFrameBuffer(e,n),this.is2DArray?this.onBeforeRenderObservable.notifyObservers(n):this.onBeforeRenderObservable.notifyObservers(e);var l=null,h=this.renderList?this.renderList:s.getActiveMeshes().data,c=this.renderList?this.renderList.length:s.getActiveMeshes().length;this.getCustomRenderList&&(l=this.getCustomRenderList(this.is2DArray?n:e,h,c)),l?this._prepareRenderingManager(l,l.length,r,!1):(this._defaultRenderListPrepared||(this._prepareRenderingManager(h,c,r,!this.renderList),this._defaultRenderListPrepared=!0),l=h),this.onClearObservable.hasObservers()?this.onClearObservable.notifyObservers(a):a.clear(this.clearColor||s.clearColor,!0,!0,!0),this._doNotChangeAspectRatio||s.updateTransformMatrix(!0);for(var u=0,f=s._beforeRenderTargetDrawStage;u=0&&t.customRenderTargets.splice(i,1);for(var n=0,r=t.cameras;n=0&&o.customRenderTargets.splice(i,1)}this.depthStencilTexture&&this.getScene().getEngine()._releaseTexture(this.depthStencilTexture),e.prototype.dispose.call(this)}},t.prototype._rebuild=function(){this.refreshRate===t.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=t.REFRESHRATE_RENDER_ONCE),this._postProcessManager&&this._postProcessManager._rebuild()},t.prototype.freeRenderingGroups=function(){this._renderingManager&&this._renderingManager.freeRenderingGroups()},t.prototype.getViewCount=function(){return 1},t.REFRESHRATE_RENDER_ONCE=0,t.REFRESHRATE_RENDER_ONEVERYFRAME=1,t.REFRESHRATE_RENDER_ONEVERYTWOFRAMES=2,t}(a.x);a.x._CreateRenderTargetTexture=function(e,t,i,n){return new u(e,t,i,n)}},4283:(e,t,i)=>{"use strict";i.d(t,{x:()=>_});var n=i(655),r=i(9023),o=i(475),s=i(2973),a=i(4664),l=i(6132),h=i(106),c=i(7549),u=i(6761),f=i(3405),d=i(1373),p=function(){function e(){}return e.GenerateBase64StringFromTexture=function(e,t,i){void 0===t&&(t=0),void 0===i&&(i=0);var n=e.getInternalTexture();if(!n)return null;var r=e.readPixels(t,i);if(!r)return null;var o=e.getSize(),s=o.width,a=o.height;if(r instanceof Float32Array){for(var l=r.byteLength/r.BYTES_PER_ELEMENT,h=new Uint8Array(l);--l>=0;){var c=r[l];c<0?c=0:c>1&&(c=1),h[l]=255*c}r=h}var u=document.createElement("canvas");u.width=s,u.height=a;var f=u.getContext("2d");if(!f)return null;var d=f.createImageData(s,a);if(d.data.set(r),f.putImageData(d,0,0),n.invertY){var p=document.createElement("canvas");p.width=s,p.height=a;var _=p.getContext("2d");return _?(_.translate(0,a),_.scale(1,-1),_.drawImage(u,0,0),p.toDataURL("image/png")):null}return u.toDataURL("image/png")},e}(),_=function(e){function t(i,n,r,s,a,l,h,u,f,d,p,_){void 0===r&&(r=!1),void 0===s&&(s=!0),void 0===a&&(a=t.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=null),void 0===h&&(h=null),void 0===u&&(u=null),void 0===f&&(f=!1);var g=e.call(this,n)||this;g.url=null,g.uOffset=0,g.vOffset=0,g.uScale=1,g.vScale=1,g.uAng=0,g.vAng=0,g.wAng=0,g.uRotationCenter=.5,g.vRotationCenter=.5,g.wRotationCenter=.5,g.homogeneousRotationInUVTransform=!1,g.inspectableCustomProperties=null,g._noMipmap=!1,g._invertY=!1,g._rowGenerationMatrix=null,g._cachedTextureMatrix=null,g._projectionModeMatrix=null,g._t0=null,g._t1=null,g._t2=null,g._cachedUOffset=-1,g._cachedVOffset=-1,g._cachedUScale=0,g._cachedVScale=0,g._cachedUAng=-1,g._cachedVAng=-1,g._cachedWAng=-1,g._cachedProjectionMatrixId=-1,g._cachedURotationCenter=-1,g._cachedVRotationCenter=-1,g._cachedWRotationCenter=-1,g._cachedHomogeneousRotationInUVTransform=!1,g._cachedCoordinatesMode=-1,g._initialSamplingMode=t.BILINEAR_SAMPLINGMODE,g._buffer=null,g._deleteBuffer=!1,g._format=null,g._delayedOnLoad=null,g._delayedOnError=null,g.onLoadObservable=new o.y$,g._isBlocking=!0,g.name=i||"",g.url=i,g._noMipmap=r,g._invertY=s,g._initialSamplingMode=a,g._buffer=u,g._deleteBuffer=f,g._mimeType=p,g._loaderOptions=_,d&&(g._format=d);var m=g.getScene(),v=g._getEngine();if(!v)return g;v.onBeforeTextureInitObservable.notifyObservers(g);var y=function(){g._texture&&(g._texture._invertVScale&&(g.vScale*=-1,g.vOffset+=1),null!==g._texture._cachedWrapU&&(g.wrapU=g._texture._cachedWrapU,g._texture._cachedWrapU=null),null!==g._texture._cachedWrapV&&(g.wrapV=g._texture._cachedWrapV,g._texture._cachedWrapV=null),null!==g._texture._cachedWrapR&&(g.wrapR=g._texture._cachedWrapR,g._texture._cachedWrapR=null)),g.onLoadObservable.hasObservers()&&g.onLoadObservable.notifyObservers(g),l&&l(),!g.isBlocking&&m&&m.resetCachedMaterial()};return g.url?(g._texture=g._getFromCache(g.url,r,a,s),g._texture?g._texture.isReady?c.Q.SetImmediate((function(){return y()})):g._texture.onLoadedObservable.add(y):m&&m.useDelayedTextureLoading?(g.delayLoadState=4,g._delayedOnLoad=y,g._delayedOnError=h):(g._texture=v.createTexture(g.url,r,s,m,a,y,h,g._buffer,void 0,g._format,null,p,_),f&&(g._buffer=null)),g):(g._delayedOnLoad=y,g._delayedOnError=h,g)}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"noMipmap",{get:function(){return this._noMipmap},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mimeType",{get:function(){return this._mimeType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isBlocking",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"samplingMode",{get:function(){return this._texture?this._texture.samplingMode:this._initialSamplingMode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"invertY",{get:function(){return this._invertY},enumerable:!1,configurable:!0}),t.prototype.updateURL=function(e,t,i){void 0===t&&(t=null),this.url&&(this.releaseInternalTexture(),this.getScene().markAllMaterialsAsDirty(1)),this.name&&!d.M.StartsWith(this.name,"data:")||(this.name=e),this.url=e,this._buffer=t,this.delayLoadState=4,i&&(this._delayedOnLoad=i),this.delayLoad()},t.prototype.delayLoad=function(){if(4===this.delayLoadState){var e=this.getScene();e&&(this.delayLoadState=1,this._texture=this._getFromCache(this.url,this._noMipmap,this.samplingMode,this._invertY),this._texture?this._delayedOnLoad&&(this._texture.isReady?c.Q.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(this.url,this._noMipmap,this._invertY,e,this.samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format,null,this._mimeType,this._loaderOptions),this._deleteBuffer&&(this._buffer=null)),this._delayedOnLoad=null,this._delayedOnError=null)}},t.prototype._prepareRowForTextureGeneration=function(e,t,i,n){e*=this._cachedUScale,t*=this._cachedVScale,e-=this.uRotationCenter*this._cachedUScale,t-=this.vRotationCenter*this._cachedVScale,i-=this.wRotationCenter,s.P.TransformCoordinatesFromFloatsToRef(e,t,i,this._rowGenerationMatrix,n),n.x+=this.uRotationCenter*this._cachedUScale+this._cachedUOffset,n.y+=this.vRotationCenter*this._cachedVScale+this._cachedVOffset,n.z+=this.wRotationCenter},t.prototype.checkTransformsAreIdentical=function(e){return null!==e&&this.uOffset===e.uOffset&&this.vOffset===e.vOffset&&this.uScale===e.uScale&&this.vScale===e.vScale&&this.uAng===e.uAng&&this.vAng===e.vAng&&this.wAng===e.wAng},t.prototype.getTextureMatrix=function(e){var t=this;if(void 0===e&&(e=1),this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale*e===this._cachedUScale&&this.vScale===this._cachedVScale&&this.uAng===this._cachedUAng&&this.vAng===this._cachedVAng&&this.wAng===this._cachedWAng&&this.uRotationCenter===this._cachedURotationCenter&&this.vRotationCenter===this._cachedVRotationCenter&&this.wRotationCenter===this._cachedWRotationCenter&&this.homogeneousRotationInUVTransform===this._cachedHomogeneousRotationInUVTransform)return this._cachedTextureMatrix;this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale*e,this._cachedVScale=this.vScale,this._cachedUAng=this.uAng,this._cachedVAng=this.vAng,this._cachedWAng=this.wAng,this._cachedURotationCenter=this.uRotationCenter,this._cachedVRotationCenter=this.vRotationCenter,this._cachedWRotationCenter=this.wRotationCenter,this._cachedHomogeneousRotationInUVTransform=this.homogeneousRotationInUVTransform,this._cachedTextureMatrix&&this._rowGenerationMatrix||(this._cachedTextureMatrix=s.y3.Zero(),this._rowGenerationMatrix=new s.y3,this._t0=s.P.Zero(),this._t1=s.P.Zero(),this._t2=s.P.Zero()),s.y3.RotationYawPitchRollToRef(this.vAng,this.uAng,this.wAng,this._rowGenerationMatrix),this.homogeneousRotationInUVTransform?(s.y3.TranslationToRef(-this._cachedURotationCenter,-this._cachedVRotationCenter,-this._cachedWRotationCenter,s.jp.Matrix[0]),s.y3.TranslationToRef(this._cachedURotationCenter,this._cachedVRotationCenter,this._cachedWRotationCenter,s.jp.Matrix[1]),s.y3.ScalingToRef(this._cachedUScale,this._cachedVScale,0,s.jp.Matrix[2]),s.y3.TranslationToRef(this._cachedUOffset,this._cachedVOffset,0,s.jp.Matrix[3]),s.jp.Matrix[0].multiplyToRef(this._rowGenerationMatrix,this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(s.jp.Matrix[1],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(s.jp.Matrix[2],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(s.jp.Matrix[3],this._cachedTextureMatrix),this._cachedTextureMatrix.setRowFromFloats(2,this._cachedTextureMatrix.m[12],this._cachedTextureMatrix.m[13],this._cachedTextureMatrix.m[14],1)):(this._prepareRowForTextureGeneration(0,0,0,this._t0),this._prepareRowForTextureGeneration(1,0,0,this._t1),this._prepareRowForTextureGeneration(0,1,0,this._t2),this._t1.subtractInPlace(this._t0),this._t2.subtractInPlace(this._t0),s.y3.FromValuesToRef(this._t1.x,this._t1.y,this._t1.z,0,this._t2.x,this._t2.y,this._t2.z,0,this._t0.x,this._t0.y,this._t0.z,0,0,0,0,1,this._cachedTextureMatrix));var i=this.getScene();return i?(i.markAllMaterialsAsDirty(1,(function(e){return e.hasTexture(t)})),this._cachedTextureMatrix):this._cachedTextureMatrix},t.prototype.getReflectionTextureMatrix=function(){var e=this,i=this.getScene();if(!i)return this._cachedTextureMatrix;if(this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale===this._cachedUScale&&this.vScale===this._cachedVScale&&this.coordinatesMode===this._cachedCoordinatesMode){if(this.coordinatesMode!==t.PROJECTION_MODE)return this._cachedTextureMatrix;if(this._cachedProjectionMatrixId===i.getProjectionMatrix().updateFlag)return this._cachedTextureMatrix}switch(this._cachedTextureMatrix||(this._cachedTextureMatrix=s.y3.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=s.y3.Zero()),this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale,this._cachedVScale=this.vScale,this._cachedCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case t.PLANAR_MODE:s.y3.IdentityToRef(this._cachedTextureMatrix),this._cachedTextureMatrix[0]=this.uScale,this._cachedTextureMatrix[5]=this.vScale,this._cachedTextureMatrix[12]=this.uOffset,this._cachedTextureMatrix[13]=this.vOffset;break;case t.PROJECTION_MODE:s.y3.FromValuesToRef(.5,0,0,0,0,-.5,0,0,0,0,0,0,.5,.5,1,1,this._projectionModeMatrix);var n=i.getProjectionMatrix();this._cachedProjectionMatrixId=n.updateFlag,n.multiplyToRef(this._projectionModeMatrix,this._cachedTextureMatrix);break;default:s.y3.IdentityToRef(this._cachedTextureMatrix)}return i.markAllMaterialsAsDirty(1,(function(t){return-1!==t.getActiveTextures().indexOf(e)})),this._cachedTextureMatrix},t.prototype.clone=function(){var e=this;return r.p4.Clone((function(){return new t(e._texture?e._texture.url:null,e.getScene(),e._noMipmap,e._invertY,e.samplingMode,void 0,void 0,e._texture?e._texture._buffer:void 0)}),this)},t.prototype.serialize=function(){var i=this.name;t.SerializeBuffers||d.M.StartsWith(this.name,"data:")&&(this.name=""),d.M.StartsWith(this.name,"data:")&&this.url===this.name&&(this.url="");var n=e.prototype.serialize.call(this);return n?((t.SerializeBuffers||t.ForceSerializeBuffers)&&("string"==typeof this._buffer&&"data:"===this._buffer.substr(0,5)?(n.base64String=this._buffer,n.name=n.name.replace("data:","")):this.url&&d.M.StartsWith(this.url,"data:")&&this._buffer instanceof Uint8Array?n.base64String="data:image/png;base64,"+d.M.EncodeArrayBufferToBase64(this._buffer):t.ForceSerializeBuffers&&(n.base64String=p.GenerateBase64StringFromTexture(this))),n.invertY=this._invertY,n.samplingMode=this.samplingMode,this.name=i,n):null},t.prototype.getClassName=function(){return"Texture"},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null},t.Parse=function(e,i,n){if(e.customType){var o=u.K.Instantiate(e.customType).Parse(e,i,n);return e.samplingMode&&o.updateSamplingMode&&o._samplingMode&&o._samplingMode!==e.samplingMode&&o.updateSamplingMode(e.samplingMode),o}if(e.isCube&&!e.isRenderTarget)return t._CubeTextureParser(e,i,n);if(!e.name&&!e.isRenderTarget)return null;var s=function(){if(a&&a._texture&&(a._texture._cachedWrapU=null,a._texture._cachedWrapV=null,a._texture._cachedWrapR=null),e.samplingMode){var t=e.samplingMode;a&&a.samplingMode!==t&&a.updateSamplingMode(t)}if(a&&e.animations)for(var i=0;i0?e.name:n+e.name,(d.M.StartsWith(e.url,"data:")||t.UseSerializedUrlIfAny&&e.url)&&(u=e.url),r=new t(u,i,!o,e.invertY,void 0,s)}return r}),e,i);return a},t.CreateFromBase64String=function(e,i,n,r,o,s,a,l,h){return void 0===s&&(s=t.TRILINEAR_SAMPLINGMODE),void 0===a&&(a=null),void 0===l&&(l=null),void 0===h&&(h=5),new t("data:"+i,n,r,o,s,a,l,e,!1,h)},t.LoadFromDataString=function(e,i,n,r,o,s,a,l,h,c){return void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===s&&(s=!0),void 0===a&&(a=t.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=null),void 0===h&&(h=null),void 0===c&&(c=5),"data:"!==e.substr(0,5)&&(e="data:"+e),new t(e,n,o,s,a,l,h,i,r,c)},t.SerializeBuffers=!0,t.ForceSerializeBuffers=!1,t._CubeTextureParser=function(e,t,i){throw h.f.WarnImport("CubeTexture")},t._CreateMirror=function(e,t,i,n){throw h.f.WarnImport("MirrorTexture")},t._CreateRenderTargetTexture=function(e,t,i,n){throw h.f.WarnImport("RenderTargetTexture")},t.NEAREST_SAMPLINGMODE=1,t.NEAREST_NEAREST_MIPLINEAR=8,t.BILINEAR_SAMPLINGMODE=2,t.LINEAR_LINEAR_MIPNEAREST=11,t.TRILINEAR_SAMPLINGMODE=3,t.LINEAR_LINEAR_MIPLINEAR=3,t.NEAREST_NEAREST_MIPNEAREST=4,t.NEAREST_LINEAR_MIPNEAREST=5,t.NEAREST_LINEAR_MIPLINEAR=6,t.NEAREST_LINEAR=7,t.NEAREST_NEAREST=1,t.LINEAR_NEAREST_MIPNEAREST=9,t.LINEAR_NEAREST_MIPLINEAR=10,t.LINEAR_LINEAR=2,t.LINEAR_NEAREST=12,t.EXPLICIT_MODE=0,t.SPHERICAL_MODE=1,t.PLANAR_MODE=2,t.CUBIC_MODE=3,t.PROJECTION_MODE=4,t.SKYBOX_MODE=5,t.INVCUBIC_MODE=6,t.EQUIRECTANGULAR_MODE=7,t.FIXED_EQUIRECTANGULAR_MODE=8,t.FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,t.CLAMP_ADDRESSMODE=0,t.WRAP_ADDRESSMODE=1,t.MIRROR_ADDRESSMODE=2,t.UseSerializedUrlIfAny=!1,(0,n.gn)([(0,r.qC)()],t.prototype,"url",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"uOffset",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"vOffset",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"uScale",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"vScale",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"uAng",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"vAng",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"wAng",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"uRotationCenter",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"vRotationCenter",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"wRotationCenter",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"homogeneousRotationInUVTransform",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"isBlocking",null),t}(a.V);l.Q.RegisteredTypes["BABYLON.Texture"]=_,r.p4._TextureParser=_.Parse},7947:(e,t,i)=>{"use strict";i.d(t,{Q:()=>a});var n=i(475),r=i(6327),o=i(3734),s=i(3857),a=function(){function e(t,i,o,a,l,h,c,u,f,d){var p,_=this;void 0===a&&(a=null),void 0===h&&(h=null),void 0===c&&(c=null),void 0===u&&(u=null),void 0===f&&(f=null),this.name=null,this.defines="",this.onCompiled=null,this.onError=null,this.onBind=null,this.uniqueId=0,this.onCompileObservable=new n.y$,this.onErrorObservable=new n.y$,this._onBindObservable=null,this._wasPreviouslyReady=!1,this._bonesComputationForcedToCPU=!1,this._multiTarget=!1,this._uniformBuffersNames={},this._samplers={},this._isReady=!1,this._compilationError="",this._allFallbacksProcessed=!1,this._uniforms={},this._key="",this._fallbacks=null,this._vertexSourceCode="",this._fragmentSourceCode="",this._vertexSourceCodeOverride="",this._fragmentSourceCodeOverride="",this._transformFeedbackVaryings=null,this._rawVertexSourceCode="",this._rawFragmentSourceCode="",this._pipelineContext=null,this._valueCache={},this.name=t;var g,m,v=null;if(i.attributes){var y=i;if(this._engine=o,this._attributesNames=y.attributes,this._uniformsNames=y.uniformsNames.concat(y.samplers),this._samplerList=y.samplers.slice(),this.defines=y.defines,this.onError=y.onError,this.onCompiled=y.onCompiled,this._fallbacks=y.fallbacks,this._indexParameters=y.indexParameters,this._transformFeedbackVaryings=y.transformFeedbackVaryings||null,this._multiTarget=!!y.multiTarget,y.uniformBuffersNames){this._uniformBuffersNamesList=y.uniformBuffersNames.slice();for(var b=0;b=2?"WEBGL2":"WEBGL1"};this._loadShader(g,"Vertex","",(function(e){_._rawVertexSourceCode=e,_._loadShader(m,"Fragment","Pixel",(function(i){_._rawFragmentSourceCode=i,s.L.Process(e,A,(function(e){v&&(e=v("vertex",e)),A.isFragment=!0,s.L.Process(i,A,(function(i){v&&(i=v("fragment",i)),_._useFinalCode(e,i,t)}),_._engine)}),_._engine)}))}))}return Object.defineProperty(e.prototype,"onBindObservable",{get:function(){return this._onBindObservable||(this._onBindObservable=new n.y$),this._onBindObservable},enumerable:!1,configurable:!0}),e.prototype._useFinalCode=function(e,t,i){if(i){var n=i.vertexElement||i.vertex||i.spectorName||i,r=i.fragmentElement||i.fragment||i.spectorName||i;this._vertexSourceCode="#define SHADER_NAME vertex:"+n+"\n"+e,this._fragmentSourceCode="#define SHADER_NAME fragment:"+r+"\n"+t}else this._vertexSourceCode=e,this._fragmentSourceCode=t;this._prepareEffect()},Object.defineProperty(e.prototype,"key",{get:function(){return this._key},enumerable:!1,configurable:!0}),e.prototype.isReady=function(){try{return this._isReadyInternal()}catch(e){return!1}},e.prototype._isReadyInternal=function(){return!!this._isReady||!!this._pipelineContext&&this._pipelineContext.isReady},e.prototype.getEngine=function(){return this._engine},e.prototype.getPipelineContext=function(){return this._pipelineContext},e.prototype.getAttributesNames=function(){return this._attributesNames},e.prototype.getAttributeLocation=function(e){return this._attributes[e]},e.prototype.getAttributeLocationByName=function(e){return this._attributeLocationByName[e]},e.prototype.getAttributesCount=function(){return this._attributes.length},e.prototype.getUniformIndex=function(e){return this._uniformsNames.indexOf(e)},e.prototype.getUniform=function(e){return this._uniforms[e]},e.prototype.getSamplers=function(){return this._samplerList},e.prototype.getUniformNames=function(){return this._uniformsNames},e.prototype.getUniformBuffersNames=function(){return this._uniformBuffersNamesList},e.prototype.getIndexParameters=function(){return this._indexParameters},e.prototype.getCompilationError=function(){return this._compilationError},e.prototype.allFallbacksProcessed=function(){return this._allFallbacksProcessed},e.prototype.executeWhenCompiled=function(e){var t=this;this.isReady()?e(this):(this.onCompileObservable.add((function(t){e(t)})),this._pipelineContext&&!this._pipelineContext.isAsync||setTimeout((function(){t._checkIsReady(null)}),16))},e.prototype._checkIsReady=function(e){var t=this;try{if(this._isReadyInternal())return}catch(t){return void this._processCompilationErrors(t,e)}setTimeout((function(){t._checkIsReady(e)}),16)},e.prototype._loadShader=function(t,i,n,o){var s;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return void o(r.M.GetDOMTextContent(t));"source:"!==t.substr(0,7)?"base64:"!==t.substr(0,7)?e.ShadersStore[t+i+"Shader"]?o(e.ShadersStore[t+i+"Shader"]):n&&e.ShadersStore[t+n+"Shader"]?o(e.ShadersStore[t+n+"Shader"]):(s="."===t[0]||"/"===t[0]||t.indexOf("http")>-1?t:e.ShadersRepository+t,this._engine._loadFile(s+"."+i.toLowerCase()+".fx",o)):o(window.atob(t.substr(7))):o(t.substr(7))},Object.defineProperty(e.prototype,"vertexSourceCode",{get:function(){return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._vertexSourceCodeOverride:this._vertexSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fragmentSourceCode",{get:function(){return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._fragmentSourceCodeOverride:this._fragmentSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rawVertexSourceCode",{get:function(){return this._rawVertexSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rawFragmentSourceCode",{get:function(){return this._rawFragmentSourceCode},enumerable:!1,configurable:!0}),e.prototype._rebuildProgram=function(e,t,i,n){var r=this;this._isReady=!1,this._vertexSourceCodeOverride=e,this._fragmentSourceCodeOverride=t,this.onError=function(e,t){n&&n(t)},this.onCompiled=function(){var e=r.getEngine().scenes;if(e)for(var t=0;t=s&&(r="Offending line ["+s+"] in "+(i?"fragment":"vertex")+" code: "+a[s-1])}}return[e,r]},e.prototype._processCompilationErrors=function(t,i){var n,r,s,a,l;void 0===i&&(i=null),this._compilationError=t.message;var h=this._attributesNames,c=this._fallbacks;if(o.Y.Error("Unable to compile effect:"),o.Y.Error("Uniforms: "+this._uniformsNames.map((function(e){return" "+e}))),o.Y.Error("Attributes: "+h.map((function(e){return" "+e}))),o.Y.Error("Defines:\r\n"+this.defines),e.LogShaderCodeOnCompilationError){var u=null,f=null,d=null;(null===(s=this._pipelineContext)||void 0===s?void 0:s._getVertexShaderCode())&&(d=(n=this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(),this._compilationError,!1))[0],u=n[1],d&&(o.Y.Error("Vertex code:"),o.Y.Error(d))),(null===(a=this._pipelineContext)||void 0===a?void 0:a._getFragmentShaderCode())&&(d=(r=this._getShaderCodeAndErrorLine(null===(l=this._pipelineContext)||void 0===l?void 0:l._getFragmentShaderCode(),this._compilationError,!0))[0],f=r[1],d&&(o.Y.Error("Fragment code:"),o.Y.Error(d))),u&&o.Y.Error(u),f&&o.Y.Error(f)}o.Y.Error("Error: "+this._compilationError),i&&(this._pipelineContext=i,this._isReady=!0,this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this)),c?(this._pipelineContext=null,c.hasMoreFallbacks?(this._allFallbacksProcessed=!1,o.Y.Error("Trying next fallback."),this.defines=c.reduce(this.defines,this),this._prepareEffect()):(this._allFallbacksProcessed=!0,this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this),this.onErrorObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh())):this._allFallbacksProcessed=!0},Object.defineProperty(e.prototype,"isSupported",{get:function(){return""===this._compilationError},enumerable:!1,configurable:!0}),e.prototype._bindTexture=function(e,t){this._engine._bindTexture(this._samplers[e],t)},e.prototype.setTexture=function(e,t){this._engine.setTexture(this._samplers[e],this._uniforms[e],t)},e.prototype.setDepthStencilTexture=function(e,t){this._engine.setDepthStencilTexture(this._samplers[e],this._uniforms[e],t)},e.prototype.setTextureArray=function(e,t){var i=e+"Ex";if(-1===this._samplerList.indexOf(i+"0")){for(var n=this._samplerList.indexOf(e),r=1;r{"use strict";i.d(t,{L:()=>n});var n=function(){function e(){this._defines={},this._currentRank=32,this._maxRank=-1,this._mesh=null}return e.prototype.unBindMesh=function(){this._mesh=null},e.prototype.addFallback=function(e,t){this._defines[e]||(ethis._maxRank&&(this._maxRank=e),this._defines[e]=new Array),this._defines[e].push(t)},e.prototype.addCPUSkinningFallback=function(e,t){this._mesh=t,ethis._maxRank&&(this._maxRank=e)},Object.defineProperty(e.prototype,"hasMoreFallbacks",{get:function(){return this._currentRank<=this._maxRank},enumerable:!1,configurable:!0}),e.prototype.reduce=function(e,t){if(this._mesh&&this._mesh.computeBonesUsingShaders&&this._mesh.numBoneInfluencers>0){this._mesh.computeBonesUsingShaders=!1,e=e.replace("#define NUM_BONE_INFLUENCERS "+this._mesh.numBoneInfluencers,"#define NUM_BONE_INFLUENCERS 0"),t._bonesComputationForcedToCPU=!0;for(var i=this._mesh.getScene(),n=0;n0&&(r.computeBonesUsingShaders=!1)}}else{var a=this._defines[this._currentRank];if(a)for(n=0;n{"use strict";i.d(t,{$:()=>c});var n=i(655),r=i(9023),o=i(475),s=i(5540),a=i(8362),l=i(1345),h=function(){function e(){this._dirty=!0,this._tempColor=new a.HE(0,0,0,0),this._globalCurve=new a.HE(0,0,0,0),this._highlightsCurve=new a.HE(0,0,0,0),this._midtonesCurve=new a.HE(0,0,0,0),this._shadowsCurve=new a.HE(0,0,0,0),this._positiveCurve=new a.HE(0,0,0,0),this._negativeCurve=new a.HE(0,0,0,0),this._globalHue=30,this._globalDensity=0,this._globalSaturation=0,this._globalExposure=0,this._highlightsHue=30,this._highlightsDensity=0,this._highlightsSaturation=0,this._highlightsExposure=0,this._midtonesHue=30,this._midtonesDensity=0,this._midtonesSaturation=0,this._midtonesExposure=0,this._shadowsHue=30,this._shadowsDensity=0,this._shadowsSaturation=0,this._shadowsExposure=0}return Object.defineProperty(e.prototype,"globalHue",{get:function(){return this._globalHue},set:function(e){this._globalHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalDensity",{get:function(){return this._globalDensity},set:function(e){this._globalDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalSaturation",{get:function(){return this._globalSaturation},set:function(e){this._globalSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalExposure",{get:function(){return this._globalExposure},set:function(e){this._globalExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightsHue",{get:function(){return this._highlightsHue},set:function(e){this._highlightsHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightsDensity",{get:function(){return this._highlightsDensity},set:function(e){this._highlightsDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightsSaturation",{get:function(){return this._highlightsSaturation},set:function(e){this._highlightsSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightsExposure",{get:function(){return this._highlightsExposure},set:function(e){this._highlightsExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midtonesHue",{get:function(){return this._midtonesHue},set:function(e){this._midtonesHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midtonesDensity",{get:function(){return this._midtonesDensity},set:function(e){this._midtonesDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midtonesSaturation",{get:function(){return this._midtonesSaturation},set:function(e){this._midtonesSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"midtonesExposure",{get:function(){return this._midtonesExposure},set:function(e){this._midtonesExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowsHue",{get:function(){return this._shadowsHue},set:function(e){this._shadowsHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowsDensity",{get:function(){return this._shadowsDensity},set:function(e){this._shadowsDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowsSaturation",{get:function(){return this._shadowsSaturation},set:function(e){this._shadowsSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowsExposure",{get:function(){return this._shadowsExposure},set:function(e){this._shadowsExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"ColorCurves"},e.Bind=function(e,t,i,n,r){void 0===i&&(i="vCameraColorCurvePositive"),void 0===n&&(n="vCameraColorCurveNeutral"),void 0===r&&(r="vCameraColorCurveNegative"),e._dirty&&(e._dirty=!1,e.getColorGradingDataToRef(e._globalHue,e._globalDensity,e._globalSaturation,e._globalExposure,e._globalCurve),e.getColorGradingDataToRef(e._highlightsHue,e._highlightsDensity,e._highlightsSaturation,e._highlightsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._highlightsCurve),e.getColorGradingDataToRef(e._midtonesHue,e._midtonesDensity,e._midtonesSaturation,e._midtonesExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._midtonesCurve),e.getColorGradingDataToRef(e._shadowsHue,e._shadowsDensity,e._shadowsSaturation,e._shadowsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._shadowsCurve),e._highlightsCurve.subtractToRef(e._midtonesCurve,e._positiveCurve),e._midtonesCurve.subtractToRef(e._shadowsCurve,e._negativeCurve)),t&&(t.setFloat4(i,e._positiveCurve.r,e._positiveCurve.g,e._positiveCurve.b,e._positiveCurve.a),t.setFloat4(n,e._midtonesCurve.r,e._midtonesCurve.g,e._midtonesCurve.b,e._midtonesCurve.a),t.setFloat4(r,e._negativeCurve.r,e._negativeCurve.g,e._negativeCurve.b,e._negativeCurve.a))},e.PrepareUniforms=function(e){e.push("vCameraColorCurveNeutral","vCameraColorCurvePositive","vCameraColorCurveNegative")},e.prototype.getColorGradingDataToRef=function(t,i,n,r,o){null!=t&&(t=e.clamp(t,0,360),i=e.clamp(i,-100,100),n=e.clamp(n,-100,100),r=e.clamp(r,-100,100),i=e.applyColorGradingSliderNonlinear(i),i*=.5,r=e.applyColorGradingSliderNonlinear(r),i<0&&(i*=-1,t=(t+180)%360),e.fromHSBToRef(t,i,50+.25*r,o),o.scaleToRef(2,o),o.a=1+.01*n)},e.applyColorGradingSliderNonlinear=function(e){e/=100;var t=Math.abs(e);return t=Math.pow(t,2),e<0&&(t*=-1),t*=100},e.fromHSBToRef=function(t,i,n,r){var o=e.clamp(t,0,360),s=e.clamp(i/100,0,1),a=e.clamp(n/100,0,1);if(0===s)r.r=a,r.g=a,r.b=a;else{o/=60;var l=Math.floor(o),h=o-l,c=a*(1-s),u=a*(1-s*h),f=a*(1-s*(1-h));switch(l){case 0:r.r=a,r.g=f,r.b=c;break;case 1:r.r=u,r.g=a,r.b=c;break;case 2:r.r=c,r.g=a,r.b=f;break;case 3:r.r=c,r.g=u,r.b=a;break;case 4:r.r=f,r.g=c,r.b=a;break;default:r.r=a,r.g=c,r.b=u}}r.a=1},e.clamp=function(e,t,i){return Math.min(Math.max(e,t),i)},e.prototype.clone=function(){return r.p4.Clone((function(){return new e}),this)},e.prototype.serialize=function(){return r.p4.Serialize(this)},e.Parse=function(t){return r.p4.Parse((function(){return new e}),t,null,null)},(0,n.gn)([(0,r.qC)()],e.prototype,"_globalHue",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_globalDensity",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_globalSaturation",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_globalExposure",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_highlightsHue",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_highlightsDensity",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_highlightsSaturation",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_highlightsExposure",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_midtonesHue",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_midtonesDensity",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_midtonesSaturation",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_midtonesExposure",void 0),e}();r.p4._ColorCurvesParser=h.Parse;!function(e){function t(){var t=e.call(this)||this;return t.IMAGEPROCESSING=!1,t.VIGNETTE=!1,t.VIGNETTEBLENDMODEMULTIPLY=!1,t.VIGNETTEBLENDMODEOPAQUE=!1,t.TONEMAPPING=!1,t.TONEMAPPING_ACES=!1,t.CONTRAST=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=!1,t.SAMPLER3DBGRMAP=!1,t.IMAGEPROCESSINGPOSTPROCESS=!1,t.EXPOSURE=!1,t.rebuild(),t}(0,n.ZT)(t,e)}(l.H);var c=function(){function e(){this.colorCurves=new h,this._colorCurvesEnabled=!1,this._colorGradingEnabled=!1,this._colorGradingWithGreenDepth=!0,this._colorGradingBGR=!0,this._exposure=1,this._toneMappingEnabled=!1,this._toneMappingType=e.TONEMAPPING_STANDARD,this._contrast=1,this.vignetteStretch=0,this.vignetteCentreX=0,this.vignetteCentreY=0,this.vignetteWeight=1.5,this.vignetteColor=new a.HE(0,0,0,0),this.vignetteCameraFov=.5,this._vignetteBlendMode=e.VIGNETTEMODE_MULTIPLY,this._vignetteEnabled=!1,this._applyByPostProcess=!1,this._isEnabled=!0,this.onUpdateParameters=new o.y$}return Object.defineProperty(e.prototype,"colorCurvesEnabled",{get:function(){return this._colorCurvesEnabled},set:function(e){this._colorCurvesEnabled!==e&&(this._colorCurvesEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorGradingTexture",{get:function(){return this._colorGradingTexture},set:function(e){this._colorGradingTexture!==e&&(this._colorGradingTexture=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorGradingEnabled",{get:function(){return this._colorGradingEnabled},set:function(e){this._colorGradingEnabled!==e&&(this._colorGradingEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorGradingWithGreenDepth",{get:function(){return this._colorGradingWithGreenDepth},set:function(e){this._colorGradingWithGreenDepth!==e&&(this._colorGradingWithGreenDepth=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorGradingBGR",{get:function(){return this._colorGradingBGR},set:function(e){this._colorGradingBGR!==e&&(this._colorGradingBGR=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"exposure",{get:function(){return this._exposure},set:function(e){this._exposure!==e&&(this._exposure=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"toneMappingEnabled",{get:function(){return this._toneMappingEnabled},set:function(e){this._toneMappingEnabled!==e&&(this._toneMappingEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"toneMappingType",{get:function(){return this._toneMappingType},set:function(e){this._toneMappingType!==e&&(this._toneMappingType=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contrast",{get:function(){return this._contrast},set:function(e){this._contrast!==e&&(this._contrast=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetteBlendMode",{get:function(){return this._vignetteBlendMode},set:function(e){this._vignetteBlendMode!==e&&(this._vignetteBlendMode=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetteEnabled",{get:function(){return this._vignetteEnabled},set:function(e){this._vignetteEnabled!==e&&(this._vignetteEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"applyByPostProcess",{get:function(){return this._applyByPostProcess},set:function(e){this._applyByPostProcess!==e&&(this._applyByPostProcess=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled!==e&&(this._isEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),e.prototype._updateParameters=function(){this.onUpdateParameters.notifyObservers(this)},e.prototype.getClassName=function(){return"ImageProcessingConfiguration"},e.PrepareUniforms=function(e,t){t.EXPOSURE&&e.push("exposureLinear"),t.CONTRAST&&e.push("contrast"),t.COLORGRADING&&e.push("colorTransformSettings"),t.VIGNETTE&&(e.push("vInverseScreenSize"),e.push("vignetteSettings1"),e.push("vignetteSettings2")),t.COLORCURVES&&h.PrepareUniforms(e)},e.PrepareSamplers=function(e,t){t.COLORGRADING&&e.push("txColorTransform")},e.prototype.prepareDefines=function(t,i){if(void 0===i&&(i=!1),i!==this.applyByPostProcess||!this._isEnabled)return t.VIGNETTE=!1,t.TONEMAPPING=!1,t.TONEMAPPING_ACES=!1,t.CONTRAST=!1,t.EXPOSURE=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.IMAGEPROCESSING=!1,void(t.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess&&this._isEnabled);switch(t.VIGNETTE=this.vignetteEnabled,t.VIGNETTEBLENDMODEMULTIPLY=this.vignetteBlendMode===e._VIGNETTEMODE_MULTIPLY,t.VIGNETTEBLENDMODEOPAQUE=!t.VIGNETTEBLENDMODEMULTIPLY,t.TONEMAPPING=this.toneMappingEnabled,this._toneMappingType){case e.TONEMAPPING_ACES:t.TONEMAPPING_ACES=!0;break;default:t.TONEMAPPING_ACES=!1}t.CONTRAST=1!==this.contrast,t.EXPOSURE=1!==this.exposure,t.COLORCURVES=this.colorCurvesEnabled&&!!this.colorCurves,t.COLORGRADING=this.colorGradingEnabled&&!!this.colorGradingTexture,t.COLORGRADING?t.COLORGRADING3D=this.colorGradingTexture.is3D:t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=this.colorGradingWithGreenDepth,t.SAMPLER3DBGRMAP=this.colorGradingBGR,t.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess,t.IMAGEPROCESSING=t.VIGNETTE||t.TONEMAPPING||t.CONTRAST||t.EXPOSURE||t.COLORCURVES||t.COLORGRADING},e.prototype.isReady=function(){return!this.colorGradingEnabled||!this.colorGradingTexture||this.colorGradingTexture.isReady()},e.prototype.bind=function(e,t){if(this._colorCurvesEnabled&&this.colorCurves&&h.Bind(this.colorCurves,e),this._vignetteEnabled){var i=1/e.getEngine().getRenderWidth(),n=1/e.getEngine().getRenderHeight();e.setFloat2("vInverseScreenSize",i,n);var r=null!=t?t:n/i,o=Math.tan(.5*this.vignetteCameraFov),a=o*r,l=Math.sqrt(a*o);a=s.w1.Mix(a,l,this.vignetteStretch),o=s.w1.Mix(o,l,this.vignetteStretch),e.setFloat4("vignetteSettings1",a,o,-a*this.vignetteCentreX,-o*this.vignetteCentreY);var c=-2*this.vignetteWeight;e.setFloat4("vignetteSettings2",this.vignetteColor.r,this.vignetteColor.g,this.vignetteColor.b,c)}if(e.setFloat("exposureLinear",this.exposure),e.setFloat("contrast",this.contrast),this.colorGradingTexture){e.setTexture("txColorTransform",this.colorGradingTexture);var u=this.colorGradingTexture.getSize().height;e.setFloat4("colorTransformSettings",(u-1)/u,.5/u,u,this.colorGradingTexture.level)}},e.prototype.clone=function(){return r.p4.Clone((function(){return new e}),this)},e.prototype.serialize=function(){return r.p4.Serialize(this)},e.Parse=function(t){return r.p4.Parse((function(){return new e}),t,null,null)},Object.defineProperty(e,"VIGNETTEMODE_MULTIPLY",{get:function(){return this._VIGNETTEMODE_MULTIPLY},enumerable:!1,configurable:!0}),Object.defineProperty(e,"VIGNETTEMODE_OPAQUE",{get:function(){return this._VIGNETTEMODE_OPAQUE},enumerable:!1,configurable:!0}),e.TONEMAPPING_STANDARD=0,e.TONEMAPPING_ACES=1,e._VIGNETTEMODE_MULTIPLY=0,e._VIGNETTEMODE_OPAQUE=1,(0,n.gn)([(0,r.N$)()],e.prototype,"colorCurves",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_colorCurvesEnabled",void 0),(0,n.gn)([(0,r.oU)("colorGradingTexture")],e.prototype,"_colorGradingTexture",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_colorGradingEnabled",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_colorGradingWithGreenDepth",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_colorGradingBGR",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_exposure",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_toneMappingEnabled",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_toneMappingType",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_contrast",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"vignetteStretch",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"vignetteCentreX",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"vignetteCentreY",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"vignetteWeight",void 0),(0,n.gn)([(0,r.XX)()],e.prototype,"vignetteColor",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"vignetteCameraFov",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_vignetteBlendMode",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_vignetteEnabled",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_applyByPostProcess",void 0),(0,n.gn)([(0,r.qC)()],e.prototype,"_isEnabled",void 0),e}();r.p4._ImageProcessingConfigurationParser=c.Parse},8555:(e,t,i)=>{"use strict";i.d(t,{p:()=>l});var n=i(655),r=i(511),o=i(9023),s=i(5660),a=i(3552),l=function(){function e(e){this._texture=null,this.diffuseBlendLevel=1,this.roughnessBlendLevel=1,this.bumpLevel=1,this._normalBlendMethod=r.F.MATERIAL_NORMALBLENDMETHOD_WHITEOUT,this._isEnabled=!1,this.isEnabled=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t){var i=t.getEngine();return!(e._areTexturesDirty&&t.texturesEnabled&&i.getCaps().standardDerivatives&&this._texture&&s.k.DetailTextureEnabled&&!this._texture.isReady())},e.prototype.prepareDefines=function(e,t){if(this._isEnabled){e.DETAIL_NORMALBLENDMETHOD=this._normalBlendMethod;var i=t.getEngine();e._areTexturesDirty&&(i.getCaps().standardDerivatives&&this._texture&&s.k.DetailTextureEnabled&&this._isEnabled?(a.G.PrepareDefinesForMergedUV(this._texture,e,"DETAIL"),e.DETAIL_NORMALBLENDMETHOD=this._normalBlendMethod):e.DETAIL=!1)}else e.DETAIL=!1},e.prototype.bindForSubMesh=function(e,t,i){this._isEnabled&&(e.useUbo&&i&&e.isSync||this._texture&&s.k.DetailTextureEnabled&&(e.updateFloat4("vDetailInfos",this._texture.coordinatesIndex,this.diffuseBlendLevel,this.bumpLevel,this.roughnessBlendLevel),a.G.BindTextureMatrix(this._texture,e,"detail")),t.texturesEnabled&&this._texture&&s.k.DetailTextureEnabled&&e.setTexture("detailSampler",this._texture))},e.prototype.hasTexture=function(e){return this._texture===e},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)},e.prototype.dispose=function(e){var t;e&&(null===(t=this._texture)||void 0===t||t.dispose())},e.prototype.getClassName=function(){return"DetailMap"},e.AddUniforms=function(e){e.push("vDetailInfos")},e.AddSamplers=function(e){e.push("detailSampler")},e.PrepareUniformBuffer=function(e){e.addUniform("vDetailInfos",4),e.addUniform("detailMatrix",16)},e.prototype.copyTo=function(e){o.p4.Clone((function(){return e}),this)},e.prototype.serialize=function(){return o.p4.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;o.p4.Parse((function(){return n}),e,t,i)},(0,n.gn)([(0,o.oU)("detailTexture"),(0,o.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),(0,n.gn)([(0,o.qC)()],e.prototype,"diffuseBlendLevel",void 0),(0,n.gn)([(0,o.qC)()],e.prototype,"roughnessBlendLevel",void 0),(0,n.gn)([(0,o.qC)()],e.prototype,"bumpLevel",void 0),(0,n.gn)([(0,o.qC)(),(0,o.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"normalBlendMethod",void 0),(0,n.gn)([(0,o.qC)(),(0,o.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),e}()},511:(e,t,i)=>{"use strict";i.d(t,{F:()=>f});var n=i(655),r=i(9023),o=i(5540),s=i(475),a=i(2733),l=i(3335),h=i(356),c=i(3734),u=i(3405),f=function(){function e(t,i,n){this.shadowDepthWrapper=null,this.allowShaderHotSwapping=!0,this.metadata=null,this.reservedDataStore=null,this.checkReadyOnEveryCall=!1,this.checkReadyOnlyOnce=!1,this.state="",this._alpha=1,this._backFaceCulling=!0,this.onCompiled=null,this.onError=null,this.getRenderTargetTextures=null,this.doNotSerialize=!1,this._storeEffectOnSubMeshes=!1,this.animations=null,this.onDisposeObservable=new s.y$,this._onDisposeObserver=null,this._onUnBindObservable=null,this._onBindObserver=null,this._alphaMode=2,this._needDepthPrePass=!1,this.disableDepthWrite=!1,this.disableColorWrite=!1,this.forceDepthWrite=!1,this.depthFunction=0,this.separateCullingPass=!1,this._fogEnabled=!0,this.pointSize=1,this.zOffset=0,this._effect=null,this._useUBO=!1,this._fillMode=e.TriangleFillMode,this._cachedDepthWriteState=!1,this._cachedColorWriteState=!1,this._cachedDepthFunctionState=0,this._indexInSceneMaterialArray=-1,this.meshMap=null,this._forceAlphaTest=!1,this._transparencyMode=null,this.name=t;var r=1;for(this._scene=i||a.l.LastCreatedScene,this.id=t||o.w1.RandomId();this._scene.getMaterialByID(this.id);)this.id=t+" "+r++;this.uniqueId=this._scene.getUniqueId(),this._scene.useRightHandedSystem?this.sideOrientation=e.ClockWiseSideOrientation:this.sideOrientation=e.CounterClockWiseSideOrientation,this._uniformBuffer=new h.M(this._scene.getEngine()),this._useUBO=this.getScene().getEngine().supportsUniformBuffers,n||this._scene.addMaterial(this),this._scene.useMaterialMeshMap&&(this.meshMap={})}return Object.defineProperty(e.prototype,"canRenderToMRT",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha!==t&&(this._alpha=t,this.markAsDirty(e.MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backFaceCulling",{get:function(){return this._backFaceCulling},set:function(t){this._backFaceCulling!==t&&(this._backFaceCulling=t,this.markAsDirty(e.TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRenderTargetTextures",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBindObservable",{get:function(){return this._onBindObservable||(this._onBindObservable=new s.y$),this._onBindObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBind",{set:function(e){this._onBindObserver&&this.onBindObservable.remove(this._onBindObserver),this._onBindObserver=this.onBindObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onUnBindObservable",{get:function(){return this._onUnBindObservable||(this._onUnBindObservable=new s.y$),this._onUnBindObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onEffectCreatedObservable",{get:function(){return this._onEffectCreatedObservable||(this._onEffectCreatedObservable=new s.y$),this._onEffectCreatedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaMode",{get:function(){return this._alphaMode},set:function(t){this._alphaMode!==t&&(this._alphaMode=t,this.markAsDirty(e.TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needDepthPrePass",{get:function(){return this._needDepthPrePass},set:function(e){this._needDepthPrePass!==e&&(this._needDepthPrePass=e,this._needDepthPrePass&&(this.checkReadyOnEveryCall=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fogEnabled",{get:function(){return this._fogEnabled},set:function(t){this._fogEnabled!==t&&(this._fogEnabled=t,this.markAsDirty(e.MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wireframe",{get:function(){switch(this._fillMode){case e.WireFrameFillMode:case e.LineListDrawMode:case e.LineLoopDrawMode:case e.LineStripDrawMode:return!0}return this._scene.forceWireframe},set:function(t){this.fillMode=t?e.WireFrameFillMode:e.TriangleFillMode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pointsCloud",{get:function(){switch(this._fillMode){case e.PointFillMode:case e.PointListDrawMode:return!0}return this._scene.forcePointsCloud},set:function(t){this.fillMode=t?e.PointFillMode:e.TriangleFillMode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fillMode",{get:function(){return this._fillMode},set:function(t){this._fillMode!==t&&(this._fillMode=t,this.markAsDirty(e.MiscDirtyFlag))},enumerable:!1,configurable:!0}),e.prototype.toString=function(e){return"Name: "+this.name},e.prototype.getClassName=function(){return"Material"},Object.defineProperty(e.prototype,"isFrozen",{get:function(){return this.checkReadyOnlyOnce},enumerable:!1,configurable:!0}),e.prototype.freeze=function(){this.markDirty(),this.checkReadyOnlyOnce=!0},e.prototype.unfreeze=function(){this.markDirty(),this.checkReadyOnlyOnce=!1},e.prototype.isReady=function(e,t){return!0},e.prototype.isReadyForSubMesh=function(e,t,i){return!1},e.prototype.getEffect=function(){return this._effect},e.prototype.getScene=function(){return this._scene},Object.defineProperty(e.prototype,"transparencyMode",{get:function(){return this._transparencyMode},set:function(t){this._transparencyMode!==t&&(this._transparencyMode=t,this._forceAlphaTest=t===e.MATERIAL_ALPHATESTANDBLEND,this._markAllSubMeshesAsTexturesAndMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_disableAlphaBlending",{get:function(){return this._transparencyMode===e.MATERIAL_OPAQUE||this._transparencyMode===e.MATERIAL_ALPHATEST},enumerable:!1,configurable:!0}),e.prototype.needAlphaBlending=function(){return!this._disableAlphaBlending&&this.alpha<1},e.prototype.needAlphaBlendingForMesh=function(e){return!(this._disableAlphaBlending&&e.visibility>=1)&&(this.needAlphaBlending()||e.visibility<1||e.hasVertexAlpha)},e.prototype.needAlphaTesting=function(){return!!this._forceAlphaTest},e.prototype._shouldTurnAlphaTestOn=function(e){return!this.needAlphaBlendingForMesh(e)&&this.needAlphaTesting()},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.markDirty=function(){for(var e=0,t=this.getScene().meshes;e{"use strict";i.d(t,{H:()=>n});var n=function(){function e(){this._isDirty=!0,this._areLightsDirty=!0,this._areLightsDisposed=!1,this._areAttributesDirty=!0,this._areTexturesDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._arePrePassDirty=!0,this._areImageProcessingDirty=!0,this._normals=!1,this._uvs=!1,this._needNormals=!1,this._needUVs=!1}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!1,configurable:!0}),e.prototype.markAsProcessed=function(){this._isDirty=!1,this._areAttributesDirty=!1,this._areTexturesDirty=!1,this._areFresnelDirty=!1,this._areLightsDirty=!1,this._areLightsDisposed=!1,this._areMiscDirty=!1,this._arePrePassDirty=!1,this._areImageProcessingDirty=!1},e.prototype.markAsUnprocessed=function(){this._isDirty=!0},e.prototype.markAllAsDirty=function(){this._areTexturesDirty=!0,this._areAttributesDirty=!0,this._areLightsDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._areImageProcessingDirty=!0,this._isDirty=!0},e.prototype.markAsImageProcessingDirty=function(){this._areImageProcessingDirty=!0,this._isDirty=!0},e.prototype.markAsLightDirty=function(e){void 0===e&&(e=!1),this._areLightsDirty=!0,this._areLightsDisposed=this._areLightsDisposed||e,this._isDirty=!0},e.prototype.markAsAttributesDirty=function(){this._areAttributesDirty=!0,this._isDirty=!0},e.prototype.markAsTexturesDirty=function(){this._areTexturesDirty=!0,this._isDirty=!0},e.prototype.markAsFresnelDirty=function(){this._areFresnelDirty=!0,this._isDirty=!0},e.prototype.markAsMiscDirty=function(){this._areMiscDirty=!0,this._isDirty=!0},e.prototype.markAsPrePassDirty=function(){this._arePrePassDirty=!0,this._isDirty=!0},e.prototype.rebuild=function(){this._keys=[];for(var e=0,t=Object.keys(this);e{"use strict";i.d(t,{k:()=>r});var n=i(2905),r=function(){function e(){}return Object.defineProperty(e,"DiffuseTextureEnabled",{get:function(){return this._DiffuseTextureEnabled},set:function(e){this._DiffuseTextureEnabled!==e&&(this._DiffuseTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"DetailTextureEnabled",{get:function(){return this._DetailTextureEnabled},set:function(e){this._DetailTextureEnabled!==e&&(this._DetailTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"AmbientTextureEnabled",{get:function(){return this._AmbientTextureEnabled},set:function(e){this._AmbientTextureEnabled!==e&&(this._AmbientTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"OpacityTextureEnabled",{get:function(){return this._OpacityTextureEnabled},set:function(e){this._OpacityTextureEnabled!==e&&(this._OpacityTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ReflectionTextureEnabled",{get:function(){return this._ReflectionTextureEnabled},set:function(e){this._ReflectionTextureEnabled!==e&&(this._ReflectionTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"EmissiveTextureEnabled",{get:function(){return this._EmissiveTextureEnabled},set:function(e){this._EmissiveTextureEnabled!==e&&(this._EmissiveTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"SpecularTextureEnabled",{get:function(){return this._SpecularTextureEnabled},set:function(e){this._SpecularTextureEnabled!==e&&(this._SpecularTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"BumpTextureEnabled",{get:function(){return this._BumpTextureEnabled},set:function(e){this._BumpTextureEnabled!==e&&(this._BumpTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"LightmapTextureEnabled",{get:function(){return this._LightmapTextureEnabled},set:function(e){this._LightmapTextureEnabled!==e&&(this._LightmapTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"RefractionTextureEnabled",{get:function(){return this._RefractionTextureEnabled},set:function(e){this._RefractionTextureEnabled!==e&&(this._RefractionTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ColorGradingTextureEnabled",{get:function(){return this._ColorGradingTextureEnabled},set:function(e){this._ColorGradingTextureEnabled!==e&&(this._ColorGradingTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"FresnelEnabled",{get:function(){return this._FresnelEnabled},set:function(e){this._FresnelEnabled!==e&&(this._FresnelEnabled=e,n.Engine.MarkAllMaterialsAsDirty(4))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ClearCoatTextureEnabled",{get:function(){return this._ClearCoatTextureEnabled},set:function(e){this._ClearCoatTextureEnabled!==e&&(this._ClearCoatTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ClearCoatBumpTextureEnabled",{get:function(){return this._ClearCoatBumpTextureEnabled},set:function(e){this._ClearCoatBumpTextureEnabled!==e&&(this._ClearCoatBumpTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ClearCoatTintTextureEnabled",{get:function(){return this._ClearCoatTintTextureEnabled},set:function(e){this._ClearCoatTintTextureEnabled!==e&&(this._ClearCoatTintTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"SheenTextureEnabled",{get:function(){return this._SheenTextureEnabled},set:function(e){this._SheenTextureEnabled!==e&&(this._SheenTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"AnisotropicTextureEnabled",{get:function(){return this._AnisotropicTextureEnabled},set:function(e){this._AnisotropicTextureEnabled!==e&&(this._AnisotropicTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ThicknessTextureEnabled",{get:function(){return this._ThicknessTextureEnabled},set:function(e){this._ThicknessTextureEnabled!==e&&(this._ThicknessTextureEnabled=e,n.Engine.MarkAllMaterialsAsDirty(1))},enumerable:!1,configurable:!0}),e._DiffuseTextureEnabled=!0,e._DetailTextureEnabled=!0,e._AmbientTextureEnabled=!0,e._OpacityTextureEnabled=!0,e._ReflectionTextureEnabled=!0,e._EmissiveTextureEnabled=!0,e._SpecularTextureEnabled=!0,e._BumpTextureEnabled=!0,e._LightmapTextureEnabled=!0,e._RefractionTextureEnabled=!0,e._ColorGradingTextureEnabled=!0,e._FresnelEnabled=!0,e._ClearCoatTextureEnabled=!0,e._ClearCoatBumpTextureEnabled=!0,e._ClearCoatTintTextureEnabled=!0,e._SheenTextureEnabled=!0,e._AnisotropicTextureEnabled=!0,e._ThicknessTextureEnabled=!0,e}()},3552:(e,t,i)=>{"use strict";i.d(t,{G:()=>c});var n=i(3734),r=i(4391),o=i(2733),s=i(6738),a=i(5697),l=i(8362),h=function(){function e(){}return e.BindClipPlane=function(e,t){if(t.clipPlane){var i=t.clipPlane;e.setFloat4("vClipPlane",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane2){i=t.clipPlane2;e.setFloat4("vClipPlane2",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane3){i=t.clipPlane3;e.setFloat4("vClipPlane3",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane4){i=t.clipPlane4;e.setFloat4("vClipPlane4",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane5){i=t.clipPlane5;e.setFloat4("vClipPlane5",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane6){i=t.clipPlane6;e.setFloat4("vClipPlane6",i.normal.x,i.normal.y,i.normal.z,i.d)}},e}(),c=function(){function e(){}return e.BindEyePosition=function(e,t,i){if(void 0===i&&(i="vEyePosition"),t._forcedViewPosition)e.setVector3(i,t._forcedViewPosition);else{var n=t.activeCamera.globalPosition;n||(n=t.activeCamera.devicePosition),e.setVector3(i,t._mirroredCameraPosition?t._mirroredCameraPosition:n)}},e.PrepareDefinesForMergedUV=function(e,t,i){t._needUVs=!0,t[i]=!0,e.getTextureMatrix().isIdentityAs3x2()?(t[i+"DIRECTUV"]=e.coordinatesIndex+1,0===e.coordinatesIndex?t.MAINUV1=!0:t.MAINUV2=!0):t[i+"DIRECTUV"]=0},e.BindTextureMatrix=function(e,t,i){var n=e.getTextureMatrix();t.updateMatrix(i+"Matrix",n)},e.GetFogState=function(e,t){return t.fogEnabled&&e.applyFog&&t.fogMode!==r.Scene.FOGMODE_NONE},e.PrepareDefinesForMisc=function(e,t,i,n,r,o,s){s._areMiscDirty&&(s.LOGARITHMICDEPTH=i,s.POINTSIZE=n,s.FOG=r&&this.GetFogState(e,t),s.NONUNIFORMSCALING=e.nonUniformScaling,s.ALPHATEST=o)},e.PrepareDefinesForFrameBoundValues=function(e,t,i,n,r,o){void 0===r&&(r=null),void 0===o&&(o=!1);var s,a,l,h,c,u,f=!1;s=null==r?void 0!==e.clipPlane&&null!==e.clipPlane:r,a=null==r?void 0!==e.clipPlane2&&null!==e.clipPlane2:r,l=null==r?void 0!==e.clipPlane3&&null!==e.clipPlane3:r,h=null==r?void 0!==e.clipPlane4&&null!==e.clipPlane4:r,c=null==r?void 0!==e.clipPlane5&&null!==e.clipPlane5:r,u=null==r?void 0!==e.clipPlane6&&null!==e.clipPlane6:r,i.CLIPPLANE!==s&&(i.CLIPPLANE=s,f=!0),i.CLIPPLANE2!==a&&(i.CLIPPLANE2=a,f=!0),i.CLIPPLANE3!==l&&(i.CLIPPLANE3=l,f=!0),i.CLIPPLANE4!==h&&(i.CLIPPLANE4=h,f=!0),i.CLIPPLANE5!==c&&(i.CLIPPLANE5=c,f=!0),i.CLIPPLANE6!==u&&(i.CLIPPLANE6=u,f=!0),i.DEPTHPREPASS!==!t.getColorWrite()&&(i.DEPTHPREPASS=!i.DEPTHPREPASS,f=!0),i.INSTANCES!==n&&(i.INSTANCES=n,f=!0),i.THIN_INSTANCES!==o&&(i.THIN_INSTANCES=o,f=!0),f&&i.markAsUnprocessed()},e.PrepareDefinesForBones=function(e,t){if(e.useBones&&e.computeBonesUsingShaders&&e.skeleton){t.NUM_BONE_INFLUENCERS=e.numBoneInfluencers;var i=void 0!==t.BONETEXTURE;if(e.skeleton.isUsingTextureForMatrices&&i)t.BONETEXTURE=!0;else{t.BonesPerMesh=e.skeleton.bones.length+1,t.BONETEXTURE=!i&&void 0;var n=e.getScene().prePassRenderer;if(n&&n.enabled){var r=-1===n.excludedSkinnedMesh.indexOf(e);t.BONES_VELOCITY_ENABLED=r}}}else t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0},e.PrepareDefinesForMorphTargets=function(e,t){var i=e.morphTargetManager;i?(t.MORPHTARGETS_UV=i.supportsUVs&&t.UV1,t.MORPHTARGETS_TANGENT=i.supportsTangents&&t.TANGENT,t.MORPHTARGETS_NORMAL=i.supportsNormals&&t.NORMAL,t.MORPHTARGETS=i.numInfluencers>0,t.NUM_MORPH_INFLUENCERS=i.numInfluencers):(t.MORPHTARGETS_UV=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS=!1,t.NUM_MORPH_INFLUENCERS=0)},e.PrepareDefinesForAttributes=function(e,t,i,n,r,o){if(void 0===r&&(r=!1),void 0===o&&(o=!0),!t._areAttributesDirty&&t._needNormals===t._normals&&t._needUVs===t._uvs)return!1;if(t._normals=t._needNormals,t._uvs=t._needUVs,t.NORMAL=t._needNormals&&e.isVerticesDataPresent(s.o.NormalKind),t._needNormals&&e.isVerticesDataPresent(s.o.TangentKind)&&(t.TANGENT=!0),t._needUVs?(t.UV1=e.isVerticesDataPresent(s.o.UVKind),t.UV2=e.isVerticesDataPresent(s.o.UV2Kind)):(t.UV1=!1,t.UV2=!1),i){var a=e.useVertexColors&&e.isVerticesDataPresent(s.o.ColorKind);t.VERTEXCOLOR=a,t.VERTEXALPHA=e.hasVertexAlpha&&a&&o}return n&&this.PrepareDefinesForBones(e,t),r&&this.PrepareDefinesForMorphTargets(e,t),!0},e.PrepareDefinesForMultiview=function(e,t){if(e.activeCamera){var i=t.MULTIVIEW;t.MULTIVIEW=null!==e.activeCamera.outputRenderTarget&&e.activeCamera.outputRenderTarget.getViewCount()>1,t.MULTIVIEW!=i&&t.markAsUnprocessed()}},e.PrepareDefinesForPrePass=function(e,t,i){var n=t.PREPASS;if(t._arePrePassDirty){var r=[{type:1,define:"PREPASS_POSITION",index:"PREPASS_POSITION_INDEX"},{type:2,define:"PREPASS_VELOCITY",index:"PREPASS_VELOCITY_INDEX"},{type:3,define:"PREPASS_REFLECTIVITY",index:"PREPASS_REFLECTIVITY_INDEX"},{type:0,define:"PREPASS_IRRADIANCE",index:"PREPASS_IRRADIANCE_INDEX"},{type:6,define:"PREPASS_ALBEDO",index:"PREPASS_ALBEDO_INDEX"},{type:5,define:"PREPASS_DEPTHNORMAL",index:"PREPASS_DEPTHNORMAL_INDEX"}];if(e.prePassRenderer&&e.prePassRenderer.enabled&&i){t.PREPASS=!0,t.SCENE_MRT_COUNT=e.prePassRenderer.mrtCount;for(var o=0;o0&&(s.shadowEnabled=!0,l.prepareDefines(r,n))}}i.lightmapMode!=a._.LIGHTMAP_DEFAULT?(s.lightmapMode=!0,r["LIGHTMAPEXCLUDED"+n]=!0,r["LIGHTMAPNOSPECULAR"+n]=i.lightmapMode==a._.LIGHTMAP_SHADOWSONLY):(r["LIGHTMAPEXCLUDED"+n]=!1,r["LIGHTMAPNOSPECULAR"+n]=!1)},e.PrepareDefinesForLights=function(e,t,i,n,r,o){if(void 0===r&&(r=4),void 0===o&&(o=!1),!i._areLightsDirty)return i._needNormals;var s=0,a={needNormals:!1,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};if(e.lightsEnabled&&!o)for(var l=0,h=t.lightSources;l0&&(r=n+o,t.addFallback(r,"LIGHT"+o)),e.SHADOWS||(e["SHADOW"+o]&&t.addFallback(n,"SHADOW"+o),e["SHADOWPCF"+o]&&t.addFallback(n,"SHADOWPCF"+o),e["SHADOWPCSS"+o]&&t.addFallback(n,"SHADOWPCSS"+o),e["SHADOWPOISSON"+o]&&t.addFallback(n,"SHADOWPOISSON"+o),e["SHADOWESM"+o]&&t.addFallback(n,"SHADOWESM"+o),e["SHADOWCLOSEESM"+o]&&t.addFallback(n,"SHADOWCLOSEESM"+o));return r++},e.PrepareAttributesForMorphTargetsInfluencers=function(e,t,i){this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS=i,this.PrepareAttributesForMorphTargets(e,t,this._TmpMorphInfluencers)},e.PrepareAttributesForMorphTargets=function(e,t,i){var r=i.NUM_MORPH_INFLUENCERS;if(r>0&&o.l.LastCreatedEngine)for(var a=o.l.LastCreatedEngine.getCaps().maxVertexAttribs,l=t.morphTargetManager,h=l&&l.supportsNormals&&i.NORMAL,c=l&&l.supportsTangents&&i.TANGENT,u=l&&l.supportsUVs&&i.UV1,f=0;fa&&n.Y.Error("Cannot add more vertex attributes for mesh "+t.name)},e.PrepareAttributesForBones=function(e,t,i,n){i.NUM_BONE_INFLUENCERS>0&&(n.addCPUSkinningFallback(0,t),e.push(s.o.MatricesIndicesKind),e.push(s.o.MatricesWeightsKind),i.NUM_BONE_INFLUENCERS>4&&(e.push(s.o.MatricesIndicesExtraKind),e.push(s.o.MatricesWeightsExtraKind)))},e.PrepareAttributesForInstances=function(e,t){(t.INSTANCES||t.THIN_INSTANCES)&&this.PushAttributesForInstances(e)},e.PushAttributesForInstances=function(e){e.push("world0"),e.push("world1"),e.push("world2"),e.push("world3")},e.BindLightProperties=function(e,t,i){e.transferToEffect(t,i+"")},e.BindLight=function(e,t,i,n,r,o){void 0===o&&(o=!1),e._bindLight(t,i,n,r,o)},e.BindLights=function(e,t,i,n,r,o){void 0===r&&(r=4),void 0===o&&(o=!1);for(var s=Math.min(t.lightSources.length,r),a=0;a-1){var o=r.getTransformMatrixTexture(t);i.setTexture("boneSampler",o),i.setFloat("boneTextureWidth",4*(r.bones.length+1))}else{var s=r.getTransformMatrices(t);s&&(i.setMatrices("mBones",s),n&&t.getScene().prePassRenderer&&t.getScene().prePassRenderer.getIndex(2)&&(n.previousBones[t.uniqueId]&&i.setMatrices("mPreviousBones",n.previousBones[t.uniqueId]),e._CopyBonesTransformationMatrices(s,n.previousBones[t.uniqueId])))}}},e._CopyBonesTransformationMatrices=function(e,t){return t.set(e),t},e.BindMorphTargetParameters=function(e,t){var i=e.morphTargetManager;e&&i&&t.setFloatArray("morphTargetInfluences",i.influences)},e.BindLogDepth=function(e,t,i){e.LOGARITHMICDEPTH&&t.setFloat("logarithmicDepthConstant",2/(Math.log(i.activeCamera.maxZ+1)/Math.LN2))},e.BindClipPlane=function(e,t){h.BindClipPlane(e,t)},e._TmpMorphInfluencers={NUM_MORPH_INFLUENCERS:0},e._tempFogColor=l.Wo.Black(),e}()},9541:(e,t,i)=>{"use strict";i.d(t,{G:()=>a});var n=i(655),r=i(511),o=i(4115),s=i(6132),a=function(e){function t(t,i){var n=e.call(this,t,i,!0)||this;return i.multiMaterials.push(n),n.subMaterials=new Array,n._storeEffectOnSubMeshes=!0,n}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"subMaterials",{get:function(){return this._subMaterials},set:function(e){this._subMaterials=e,this._hookArray(e)},enumerable:!1,configurable:!0}),t.prototype.getChildren=function(){return this.subMaterials},t.prototype._hookArray=function(e){var t=this,i=e.push;e.push=function(){for(var n=[],r=0;r=this.subMaterials.length?this.getScene().defaultMaterial:this.subMaterials[e]},t.prototype.getActiveTextures=function(){var t;return(t=e.prototype.getActiveTextures.call(this)).concat.apply(t,this.subMaterials.map((function(e){return e?e.getActiveTextures():[]})))},t.prototype.hasTexture=function(t){var i;if(e.prototype.hasTexture.call(this,t))return!0;for(var n=0;n=0&&r.multiMaterials.splice(o,1),e.prototype.dispose.call(this,t,i)}},t.ParseMultiMaterial=function(e,i){var n=new t(e.name,i);n.id=e.id,o.$&&o.$.AddTagsTo(n,e.tags);for(var r=0;r{"use strict";i.d(t,{o:()=>r});var n=i(2973),r=function(){function e(){this.previousWorldMatrices={},this.previousBones={}}return e.AddUniforms=function(e){e.push("previousWorld","previousViewProjection")},e.AddSamplers=function(e){},e.prototype.bindForSubMesh=function(e,t,i,r,o){t.prePassRenderer&&t.prePassRenderer.enabled&&-1!==t.prePassRenderer.getIndex(2)&&(this.previousWorldMatrices[i.uniqueId]||(this.previousWorldMatrices[i.uniqueId]=n.y3.Identity()),this.previousViewProjection||(this.previousViewProjection=t.getTransformMatrix()),e.setMatrix("previousWorld",this.previousWorldMatrices[i.uniqueId]),e.setMatrix("previousViewProjection",this.previousViewProjection),this.previousWorldMatrices[i.uniqueId]=r.clone(),this.previousViewProjection=t.getTransformMatrix().clone())},e}()},872:(e,t,i)=>{"use strict";i.d(t,{a:()=>o});var n=i(655),r=i(2973),o=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n._normalMatrix=new r.y3,n._storeEffectOnSubMeshes=!0,n}return(0,n.ZT)(t,e),t.prototype.getEffect=function(){return this._activeEffect},t.prototype.isReady=function(e,t){return!!e&&(!e.subMeshes||0===e.subMeshes.length||this.isReadyForSubMesh(e,e.subMeshes[0],t))},t.prototype._isReadyForSubMesh=function(e){var t=e._materialDefines;return!(this.checkReadyOnEveryCall||!e.effect||!t||t._renderId!==this.getScene().getRenderId())},t.prototype.bindOnlyWorldMatrix=function(e){this._activeEffect.setMatrix("world",e)},t.prototype.bindOnlyNormalMatrix=function(e){this._activeEffect.setMatrix("normalMatrix",e)},t.prototype.bind=function(e,t){t&&this.bindForSubMesh(e,t,t.subMeshes[0])},t.prototype._afterBind=function(t,i){void 0===i&&(i=null),e.prototype._afterBind.call(this,t),this.getScene()._cachedEffect=i},t.prototype._mustRebind=function(e,t,i){return void 0===i&&(i=1),e.isCachedMaterialInvalid(this,t,i)},t}(i(511).F)},4730:(e,t,i)=>{"use strict";i.d(t,{j:()=>g});var n=i(655),r=i(9023),o=i(2973),s=i(6738),a=i(4283),l=i(3552),h=i(511),c=i(6132),u=i(8362),f=i(8237),d=i(2840),p=i(2905),_={effect:null,subMesh:null},g=function(e){function t(t,i,r,s){void 0===s&&(s={});var a=e.call(this,t,i)||this;return a._textures={},a._textureArrays={},a._floats={},a._ints={},a._floatsArrays={},a._colors3={},a._colors3Arrays={},a._colors4={},a._colors4Arrays={},a._vectors2={},a._vectors3={},a._vectors4={},a._matrices={},a._matrixArrays={},a._matrices3x3={},a._matrices2x2={},a._vectors2Arrays={},a._vectors3Arrays={},a._vectors4Arrays={},a._cachedWorldViewMatrix=new o.y3,a._cachedWorldViewProjectionMatrix=new o.y3,a._multiview=!1,a._shaderPath=r,a._options=(0,n.pi)({needAlphaBlending:!1,needAlphaTesting:!1,attributes:["position","normal","uv"],uniforms:["worldViewProjection"],uniformBuffers:[],samplers:[],defines:[]},s),a}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"shaderPath",{get:function(){return this._shaderPath},set:function(e){this._shaderPath=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"ShaderMaterial"},t.prototype.needAlphaBlending=function(){return this.alpha<1||this._options.needAlphaBlending},t.prototype.needAlphaTesting=function(){return this._options.needAlphaTesting},t.prototype._checkUniform=function(e){-1===this._options.uniforms.indexOf(e)&&this._options.uniforms.push(e)},t.prototype.setTexture=function(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._textures[e]=t,this},t.prototype.setTextureArray=function(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._checkUniform(e),this._textureArrays[e]=t,this},t.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},t.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},t.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},t.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},t.prototype.setColor3Array=function(e,t){return this._checkUniform(e),this._colors3Arrays[e]=t.reduce((function(e,t){return t.toArray(e,e.length),e}),[]),this},t.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},t.prototype.setColor4Array=function(e,t){return this._checkUniform(e),this._colors4Arrays[e]=t.reduce((function(e,t){return t.toArray(e,e.length),e}),[]),this},t.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},t.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this},t.prototype.setVector4=function(e,t){return this._checkUniform(e),this._vectors4[e]=t,this},t.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},t.prototype.setMatrices=function(e,t){this._checkUniform(e);for(var i=new Float32Array(16*t.length),n=0;n1&&(this._multiview=!0,a.push("#define MULTIVIEW"),-1!==this._options.uniforms.indexOf("viewProjection")&&-1===this._options.uniforms.push("viewProjectionR")&&this._options.uniforms.push("viewProjectionR"));for(var u=0;u4&&(h.push(s.o.MatricesIndicesExtraKind),h.push(s.o.MatricesWeightsExtraKind));var p=e.skeleton;d=e.numBoneInfluencers,a.push("#define NUM_BONE_INFLUENCERS "+d),c.addCPUSkinningFallback(0,e),p.isUsingTextureForMatrices?(a.push("#define BONETEXTURE"),-1===this._options.uniforms.indexOf("boneTextureWidth")&&this._options.uniforms.push("boneTextureWidth"),-1===this._options.samplers.indexOf("boneSampler")&&this._options.samplers.push("boneSampler")):(a.push("#define BonesPerMesh "+(p.bones.length+1)),-1===this._options.uniforms.indexOf("mBones")&&this._options.uniforms.push("mBones"))}else a.push("#define NUM_BONE_INFLUENCERS 0");for(var g in this._textures)if(!this._textures[g].isReady())return!1;e&&this._shouldTurnAlphaTestOn(e)&&a.push("#define ALPHATEST");var m=this._shaderPath,v=this._options.uniforms,y=this._options.uniformBuffers,b=this._options.samplers;this.customShaderNameResolve&&(v=v.slice(),y=y.slice(),b=b.slice(),m=this.customShaderNameResolve(m,v,y,b,a,h));var T=this._effect,A=a.join("\n");return this._cachedDefines!==A&&(this._cachedDefines=A,this._effect=o.createEffect(m,{attributes:h,uniformsNames:v,uniformBuffersNames:y,samplers:b,defines:A,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousMorphTargets:d}},o),this._onEffectCreatedObservable&&(_.effect=this._effect,this._onEffectCreatedObservable.notifyObservers(_))),null!==(n=!(null===(i=this._effect)||void 0===i?void 0:i.isReady()))&&void 0!==n&&!n&&(T!==this._effect&&r.resetCachedMaterial(),this._renderId=r.getRenderId(),this._effect._wasPreviouslyReady=!0,!0)},t.prototype.bindOnlyWorldMatrix=function(e,t){var i=this.getScene(),n=null!=t?t:this._effect;n&&(-1!==this._options.uniforms.indexOf("world")&&n.setMatrix("world",e),-1!==this._options.uniforms.indexOf("worldView")&&(e.multiplyToRef(i.getViewMatrix(),this._cachedWorldViewMatrix),n.setMatrix("worldView",this._cachedWorldViewMatrix)),-1!==this._options.uniforms.indexOf("worldViewProjection")&&(e.multiplyToRef(i.getTransformMatrix(),this._cachedWorldViewProjectionMatrix),n.setMatrix("worldViewProjection",this._cachedWorldViewProjectionMatrix)))},t.prototype.bindForSubMesh=function(e,t,i){this.bind(e,t,i._effectOverride)},t.prototype.bind=function(e,t,i){this.bindOnlyWorldMatrix(e,i);var n=null!=i?i:this._effect;if(n&&this.getScene().getCachedMaterial()!==this){var r;for(r in-1!==this._options.uniforms.indexOf("view")&&n.setMatrix("view",this.getScene().getViewMatrix()),-1!==this._options.uniforms.indexOf("projection")&&n.setMatrix("projection",this.getScene().getProjectionMatrix()),-1!==this._options.uniforms.indexOf("viewProjection")&&(n.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._multiview&&n.setMatrix("viewProjectionR",this.getScene()._transformMatrixR)),this.getScene().activeCamera&&-1!==this._options.uniforms.indexOf("cameraPosition")&&n.setVector3("cameraPosition",this.getScene().activeCamera.globalPosition),l.G.BindBonesParameters(t,n),this._textures)n.setTexture(r,this._textures[r]);for(r in this._textureArrays)n.setTextureArray(r,this._textureArrays[r]);for(r in this._ints)n.setInt(r,this._ints[r]);for(r in this._floats)n.setFloat(r,this._floats[r]);for(r in this._floatsArrays)n.setArray(r,this._floatsArrays[r]);for(r in this._colors3)n.setColor3(r,this._colors3[r]);for(r in this._colors3Arrays)n.setArray3(r,this._colors3Arrays[r]);for(r in this._colors4){var o=this._colors4[r];n.setFloat4(r,o.r,o.g,o.b,o.a)}for(r in this._colors4Arrays)n.setArray4(r,this._colors4Arrays[r]);for(r in this._vectors2)n.setVector2(r,this._vectors2[r]);for(r in this._vectors3)n.setVector3(r,this._vectors3[r]);for(r in this._vectors4)n.setVector4(r,this._vectors4[r]);for(r in this._matrices)n.setMatrix(r,this._matrices[r]);for(r in this._matrixArrays)n.setMatrices(r,this._matrixArrays[r]);for(r in this._matrices3x3)n.setMatrix3x3(r,this._matrices3x3[r]);for(r in this._matrices2x2)n.setMatrix2x2(r,this._matrices2x2[r]);for(r in this._vectors2Arrays)n.setArray2(r,this._vectors2Arrays[r]);for(r in this._vectors3Arrays)n.setArray3(r,this._vectors3Arrays[r]);for(r in this._vectors4Arrays)n.setArray4(r,this._vectors4Arrays[r])}var s=this._effect;this._effect=n,this._afterBind(t),this._effect=s},t.prototype._afterBind=function(t){e.prototype._afterBind.call(this,t),this.getScene()._cachedEffect=this._effect},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);for(var i in this._textures)t.push(this._textures[i]);for(var i in this._textureArrays)for(var n=this._textureArrays[i],r=0;r{"use strict";i.r(t),i.d(t,{StandardMaterial:()=>D,StandardMaterialDefines:()=>O});var n=i(655),r=i(9023),o=i(6936),s=i(4391),a=i(2973),l=i(8362),h=i(6738),c=i(9640),u=i(2659),f=i(511),d=i(1345),p=i(872),_=i(3552),g=i(4283),m=i(6132),v=i(5660),y=i(7947),b="uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;\nuniform float visibility;\n\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifndef REFRACTIONMAP_3D\nuniform mat4 refractionMatrix;\n#endif\n#ifdef REFRACTIONFRESNEL\nuniform vec4 refractionLeftColor;\nuniform vec4 refractionRightColor;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\n#endif\n#ifdef DIFFUSEFRESNEL\nuniform vec4 diffuseLeftColor;\nuniform vec4 diffuseRightColor;\n#endif\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;\nuniform vec4 emissiveRightColor;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)\nuniform mat4 reflectionMatrix;\n#endif\n#ifndef REFLECTIONMAP_SKYBOX\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize;\n#endif\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;\nuniform vec4 reflectionRightColor;\n#endif\n#endif";y.Q.IncludesShadersStore.defaultFragmentDeclaration=b;var T="layout(std140,column_major) uniform;\nuniform Material\n{\nvec4 diffuseLeftColor;\nvec4 diffuseRightColor;\nvec4 opacityParts;\nvec4 reflectionLeftColor;\nvec4 reflectionRightColor;\nvec4 refractionLeftColor;\nvec4 refractionRightColor;\nvec4 emissiveLeftColor;\nvec4 emissiveRightColor;\nvec2 vDiffuseInfos;\nvec2 vAmbientInfos;\nvec2 vOpacityInfos;\nvec2 vReflectionInfos;\nvec3 vReflectionPosition;\nvec3 vReflectionSize;\nvec2 vEmissiveInfos;\nvec2 vLightmapInfos;\nvec2 vSpecularInfos;\nvec3 vBumpInfos;\nmat4 diffuseMatrix;\nmat4 ambientMatrix;\nmat4 opacityMatrix;\nmat4 reflectionMatrix;\nmat4 emissiveMatrix;\nmat4 lightmapMatrix;\nmat4 specularMatrix;\nmat4 bumpMatrix;\nvec2 vTangentSpaceParams;\nfloat pointSize;\nmat4 refractionMatrix;\nvec4 vRefractionInfos;\nvec4 vSpecularColor;\nvec3 vEmissiveColor;\nfloat visibility;\nvec4 vDiffuseColor;\nvec4 vDetailInfos;\nmat4 detailMatrix;\n};\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};\n";y.Q.IncludesShadersStore.defaultUboDeclaration=T;i(2213),i(8662),i(8806),i(8644);var A="\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef NDOTL\nfloat ndl;\n#endif\n};\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 lightVectorW;\nfloat attenuation=1.0;\nif (lightData.w == 0.)\n{\nvec3 direction=lightData.xyz-vPositionW;\nattenuation=max(0.,1.0-length(direction)/range);\nlightVectorW=normalize(direction);\n}\nelse\n{\nlightVectorW=normalize(-lightData.xyz);\n}\n\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 direction=lightData.xyz-vPositionW;\nvec3 lightVectorW=normalize(direction);\nfloat attenuation=max(0.,1.0-length(direction)/range);\n\nfloat cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));\nif (cosAngle>=lightDirection.w)\n{\ncosAngle=max(0.,pow(cosAngle,lightData.w));\nattenuation*=cosAngle;\n\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nresult.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;\n}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\nlightingInfo result;\n\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor;\n#endif\nreturn result;\n}\n#define inline\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\nstrq/=strq.w;\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\nreturn textureColor;\n}";y.Q.IncludesShadersStore.lightsFragmentFunctions=A;i(7867);var E="#ifdef FRESNEL\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\n{\nfloat fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);\nreturn clamp(fresnelTerm,0.,1.);\n}\n#endif";y.Q.IncludesShadersStore.fresnelFunction=E;i(2678),i(7176),i(9012),i(3110),i(4711),i(1655),i(8136),i(6733),i(3120),i(9421),i(7236),i(1130),i(8516),i(6635);var C="#include<__decl__defaultFragment>\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#include[SCENE_MRT_COUNT]\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n\n#define RECIPROCAL_PI2 0.15915494\nuniform vec3 vEyePosition;\nuniform vec3 vAmbientColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n\n#include\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n\n#ifdef DIFFUSE\n#if DIFFUSEDIRECTUV == 1\n#define vDiffuseUV vMainUV1\n#elif DIFFUSEDIRECTUV == 2\n#define vDiffuseUV vMainUV2\n#else\nvarying vec2 vDiffuseUV;\n#endif\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef AMBIENT\n#if AMBIENTDIRECTUV == 1\n#define vAmbientUV vMainUV1\n#elif AMBIENTDIRECTUV == 2\n#define vAmbientUV vMainUV2\n#else\nvarying vec2 vAmbientUV;\n#endif\nuniform sampler2D ambientSampler;\n#endif\n#ifdef OPACITY\n#if OPACITYDIRECTUV == 1\n#define vOpacityUV vMainUV1\n#elif OPACITYDIRECTUV == 2\n#define vOpacityUV vMainUV2\n#else\nvarying vec2 vOpacityUV;\n#endif\nuniform sampler2D opacitySampler;\n#endif\n#ifdef EMISSIVE\n#if EMISSIVEDIRECTUV == 1\n#define vEmissiveUV vMainUV1\n#elif EMISSIVEDIRECTUV == 2\n#define vEmissiveUV vMainUV2\n#else\nvarying vec2 vEmissiveUV;\n#endif\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef LIGHTMAP\n#if LIGHTMAPDIRECTUV == 1\n#define vLightmapUV vMainUV1\n#elif LIGHTMAPDIRECTUV == 2\n#define vLightmapUV vMainUV2\n#else\nvarying vec2 vLightmapUV;\n#endif\nuniform sampler2D lightmapSampler;\n#endif\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\n#if SPECULARDIRECTUV == 1\n#define vSpecularUV vMainUV1\n#elif SPECULARDIRECTUV == 2\n#define vSpecularUV vMainUV2\n#else\nvarying vec2 vSpecularUV;\n#endif\nuniform sampler2D specularSampler;\n#endif\n#ifdef ALPHATEST\nuniform float alphaCutOff;\n#endif\n\n#include\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include\n#endif\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#include\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)\nif (baseColor.a\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef DETAIL\nbaseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\n\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\n\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULAR\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);\nspecularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#else\nfloat glossiness=0.;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;\n#ifdef LIGHTMAP\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor.rgb=fromRGBD(lightmapColor);\n#endif\nlightmapColor.rgb*=vLightmapInfos.y;\n#endif\n#include[0..maxSimultaneousLights]\n\nvec4 refractionColor=vec4(0.,0.,0.,1.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nif (dot(refractionVector,viewDirectionW)<1.0) {\nrefractionColor=textureCube(refractionCubeSampler,refractionVector);\n}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\nrefractionColor=texture2D(refraction2DSampler,refractionCoords);\n#endif\n#ifdef RGBDREFRACTION\nrefractionColor.rgb=fromRGBD(refractionColor);\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor.rgb=toGammaSpace(refractionColor.rgb);\n#endif\nrefractionColor.rgb*=vRefractionInfos.x;\n#endif\n\nvec4 reflectionColor=vec4(0.,0.,0.,1.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;\nreflectionColor=texture2D(reflection2DSampler,coords);\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor.rgb=toGammaSpace(reflectionColor.rgb);\n#endif\nreflectionColor.rgb*=vReflectionInfos.x;\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);\nrefractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n#ifdef ALPHATEST\n#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS\nif (alpha\n#include\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#else\n#ifdef IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\n#endif\ncolor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\n\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\ngl_FragData[0]=color;\n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,1.0);\n#endif\n#ifdef PREPASS_VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\nvec2 velocity=abs(a-b);\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\ngl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n#ifdef PREPASS_IRRADIANCE\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,1.0);\n#endif\n#ifdef PREPASS_DEPTHNORMAL\ngl_FragData[PREPASS_DEPTHNORMAL_INDEX]=vec4(vViewPos.z,(view*vec4(normalW,0.0)).rgb);\n#endif\n#ifdef PREPASS_ALBEDO\ngl_FragData[PREPASS_ALBEDO_INDEX]=vec4(0.0,0.0,0.0,1.0);\n#endif\n#ifdef PREPASS_REFLECTIVITY\n#if defined(SPECULAR)\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=specularMapColor;\n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(0.0,0.0,0.0,1.0);\n#endif\n#endif\n#endif\n#if !defined(PREPASS) || defined(WEBGL2)\ngl_FragColor=color;\n#endif\n}\n";y.Q.ShadersStore.defaultPixelShader=C;var x="\nuniform mat4 viewProjection;\nuniform mat4 view;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\nuniform mat4 specularMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef REFLECTION\nuniform mat4 reflectionMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n";y.Q.IncludesShadersStore.defaultVertexDeclaration=x;i(3600),i(3191),i(3235),i(4344),i(8738),i(5183),i(9781),i(1892),i(2389),i(6838),i(9686),i(1889),i(5866),i(6403),i(5724),i(5581);var S="#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif";y.Q.IncludesShadersStore.pointCloudVertex=S;i(2753);var R="#include<__decl__defaultVertex>\n\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n\n#include\n#include\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nvarying vec2 vDiffuseUV;\n#endif\n#if defined(DETAIL) && DETAILDIRECTUV == 0\nvarying vec2 vDetailUV;\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nvarying vec2 vAmbientUV;\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nvarying vec2 vOpacityUV;\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nvarying vec2 vEmissiveUV;\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nvarying vec2 vLightmapUV;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\nvarying vec2 vSpecularUV;\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nvarying vec2 vBumpUV;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\n\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\n#endif\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));\nvNormalW=normalize(normalWorld*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\nvPositionW=vec3(worldPos);\n#include\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uvUpdated=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(DETAIL) && DETAILDIRECTUV == 0\nif (vDetailInfos.x == 0.)\n{\nvDetailUV=vec2(detailMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvDetailUV=vec2(detailMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\nif (vSpecularInfos.x == 0.)\n{\nvSpecularUV=vec2(specularMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}\n";y.Q.ShadersStore.defaultVertexShader=R;var M=i(8237),P=i(8555),I={effect:null,subMesh:null},O=function(e){function t(){var t=e.call(this)||this;return t.MAINUV1=!1,t.MAINUV2=!1,t.DIFFUSE=!1,t.DIFFUSEDIRECTUV=0,t.DETAIL=!1,t.DETAILDIRECTUV=0,t.DETAIL_NORMALBLENDMETHOD=0,t.AMBIENT=!1,t.AMBIENTDIRECTUV=0,t.OPACITY=!1,t.OPACITYDIRECTUV=0,t.OPACITYRGB=!1,t.REFLECTION=!1,t.EMISSIVE=!1,t.EMISSIVEDIRECTUV=0,t.SPECULAR=!1,t.SPECULARDIRECTUV=0,t.BUMP=!1,t.BUMPDIRECTUV=0,t.PARALLAX=!1,t.PARALLAXOCCLUSION=!1,t.SPECULAROVERALPHA=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.CLIPPLANE5=!1,t.CLIPPLANE6=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.ALPHAFROMDIFFUSE=!1,t.POINTSIZE=!1,t.FOG=!1,t.SPECULARTERM=!1,t.DIFFUSEFRESNEL=!1,t.OPACITYFRESNEL=!1,t.REFLECTIONFRESNEL=!1,t.REFRACTIONFRESNEL=!1,t.EMISSIVEFRESNEL=!1,t.FRESNEL=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.BONETEXTURE=!1,t.BONES_VELOCITY_ENABLED=!1,t.INSTANCES=!1,t.THIN_INSTANCES=!1,t.GLOSSINESS=!1,t.ROUGHNESS=!1,t.EMISSIVEASILLUMINATION=!1,t.LINKEMISSIVEWITHDIFFUSE=!1,t.REFLECTIONFRESNELFROMSPECULAR=!1,t.LIGHTMAP=!1,t.LIGHTMAPDIRECTUV=0,t.OBJECTSPACE_NORMALMAP=!1,t.USELIGHTMAPASSHADOWMAP=!1,t.REFLECTIONMAP_3D=!1,t.REFLECTIONMAP_SPHERICAL=!1,t.REFLECTIONMAP_PLANAR=!1,t.REFLECTIONMAP_CUBIC=!1,t.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,t.REFLECTIONMAP_PROJECTION=!1,t.REFLECTIONMAP_SKYBOX=!1,t.REFLECTIONMAP_EXPLICIT=!1,t.REFLECTIONMAP_EQUIRECTANGULAR=!1,t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,t.INVERTCUBICMAP=!1,t.LOGARITHMICDEPTH=!1,t.REFRACTION=!1,t.REFRACTIONMAP_3D=!1,t.REFLECTIONOVERALPHA=!1,t.TWOSIDEDLIGHTING=!1,t.SHADOWFLOAT=!1,t.MORPHTARGETS=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_UV=!1,t.NUM_MORPH_INFLUENCERS=0,t.NONUNIFORMSCALING=!1,t.PREMULTIPLYALPHA=!1,t.ALPHATEST_AFTERALLALPHACOMPUTATIONS=!1,t.ALPHABLEND=!0,t.PREPASS=!1,t.PREPASS_IRRADIANCE=!1,t.PREPASS_IRRADIANCE_INDEX=-1,t.PREPASS_ALBEDO=!1,t.PREPASS_ALBEDO_INDEX=-1,t.PREPASS_DEPTHNORMAL=!1,t.PREPASS_DEPTHNORMAL_INDEX=-1,t.PREPASS_POSITION=!1,t.PREPASS_POSITION_INDEX=-1,t.PREPASS_VELOCITY=!1,t.PREPASS_VELOCITY_INDEX=-1,t.PREPASS_REFLECTIVITY=!1,t.PREPASS_REFLECTIVITY_INDEX=-1,t.SCENE_MRT_COUNT=0,t.RGBDLIGHTMAP=!1,t.RGBDREFLECTION=!1,t.RGBDREFRACTION=!1,t.IMAGEPROCESSING=!1,t.VIGNETTE=!1,t.VIGNETTEBLENDMODEMULTIPLY=!1,t.VIGNETTEBLENDMODEOPAQUE=!1,t.TONEMAPPING=!1,t.TONEMAPPING_ACES=!1,t.CONTRAST=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=!1,t.SAMPLER3DBGRMAP=!1,t.IMAGEPROCESSINGPOSTPROCESS=!1,t.MULTIVIEW=!1,t.IS_REFLECTION_LINEAR=!1,t.IS_REFRACTION_LINEAR=!1,t.EXPOSURE=!1,t.rebuild(),t}return(0,n.ZT)(t,e),t.prototype.setReflectionMode=function(e){for(var t=0,i=["REFLECTIONMAP_CUBIC","REFLECTIONMAP_EXPLICIT","REFLECTIONMAP_PLANAR","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_SKYBOX","REFLECTIONMAP_SPHERICAL","REFLECTIONMAP_EQUIRECTANGULAR","REFLECTIONMAP_EQUIRECTANGULAR_FIXED","REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"];t0,o.REFLECTIONOVERALPHA=this._useReflectionOverAlpha,o.INVERTCUBICMAP=this._reflectionTexture.coordinatesMode===g.x.INVCUBIC_MODE,o.REFLECTIONMAP_3D=this._reflectionTexture.isCube,o.RGBDREFLECTION=this._reflectionTexture.isRGBD,this._reflectionTexture.coordinatesMode){case g.x.EXPLICIT_MODE:o.setReflectionMode("REFLECTIONMAP_EXPLICIT");break;case g.x.PLANAR_MODE:o.setReflectionMode("REFLECTIONMAP_PLANAR");break;case g.x.PROJECTION_MODE:o.setReflectionMode("REFLECTIONMAP_PROJECTION");break;case g.x.SKYBOX_MODE:o.setReflectionMode("REFLECTIONMAP_SKYBOX");break;case g.x.SPHERICAL_MODE:o.setReflectionMode("REFLECTIONMAP_SPHERICAL");break;case g.x.EQUIRECTANGULAR_MODE:o.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR");break;case g.x.FIXED_EQUIRECTANGULAR_MODE:o.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR_FIXED");break;case g.x.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:o.setReflectionMode("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED");break;case g.x.CUBIC_MODE:case g.x.INVCUBIC_MODE:default:o.setReflectionMode("REFLECTIONMAP_CUBIC")}o.USE_LOCAL_REFLECTIONMAP_CUBIC=!!this._reflectionTexture.boundingBoxSize}else o.REFLECTION=!1;if(this._emissiveTexture&&t.EmissiveTextureEnabled){if(!this._emissiveTexture.isReadyOrNotBlocking())return!1;_.G.PrepareDefinesForMergedUV(this._emissiveTexture,o,"EMISSIVE")}else o.EMISSIVE=!1;if(this._lightmapTexture&&t.LightmapTextureEnabled){if(!this._lightmapTexture.isReadyOrNotBlocking())return!1;_.G.PrepareDefinesForMergedUV(this._lightmapTexture,o,"LIGHTMAP"),o.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,o.RGBDLIGHTMAP=this._lightmapTexture.isRGBD}else o.LIGHTMAP=!1;if(this._specularTexture&&t.SpecularTextureEnabled){if(!this._specularTexture.isReadyOrNotBlocking())return!1;_.G.PrepareDefinesForMergedUV(this._specularTexture,o,"SPECULAR"),o.GLOSSINESS=this._useGlossinessFromSpecularMapAlpha}else o.SPECULAR=!1;if(r.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&t.BumpTextureEnabled){if(!this._bumpTexture.isReady())return!1;_.G.PrepareDefinesForMergedUV(this._bumpTexture,o,"BUMP"),o.PARALLAX=this._useParallax,o.PARALLAXOCCLUSION=this._useParallaxOcclusion,o.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap}else o.BUMP=!1;if(this._refractionTexture&&t.RefractionTextureEnabled){if(!this._refractionTexture.isReadyOrNotBlocking())return!1;o._needUVs=!0,o.REFRACTION=!0,o.REFRACTIONMAP_3D=this._refractionTexture.isCube,o.RGBDREFRACTION=this._refractionTexture.isRGBD}else o.REFRACTION=!1;o.TWOSIDEDLIGHTING=!this._backFaceCulling&&this._twoSidedLighting}else o.DIFFUSE=!1,o.AMBIENT=!1,o.OPACITY=!1,o.REFLECTION=!1,o.EMISSIVE=!1,o.LIGHTMAP=!1,o.BUMP=!1,o.REFRACTION=!1;o.ALPHAFROMDIFFUSE=this._shouldUseAlphaFromDiffuseTexture(),o.EMISSIVEASILLUMINATION=this._useEmissiveAsIllumination,o.LINKEMISSIVEWITHDIFFUSE=this._linkEmissiveWithDiffuse,o.SPECULAROVERALPHA=this._useSpecularOverAlpha,o.PREMULTIPLYALPHA=7===this.alphaMode||8===this.alphaMode,o.ALPHATEST_AFTERALLALPHACOMPUTATIONS=null!==this.transparencyMode,o.ALPHABLEND=null===this.transparencyMode||this.needAlphaBlendingForMesh(e)}if(!this.detailMap.isReadyForSubMesh(o,r))return!1;if(o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(o._areFresnelDirty&&(t.FresnelEnabled?(this._diffuseFresnelParameters||this._opacityFresnelParameters||this._emissiveFresnelParameters||this._refractionFresnelParameters||this._reflectionFresnelParameters)&&(o.DIFFUSEFRESNEL=this._diffuseFresnelParameters&&this._diffuseFresnelParameters.isEnabled,o.OPACITYFRESNEL=this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled,o.REFLECTIONFRESNEL=this._reflectionFresnelParameters&&this._reflectionFresnelParameters.isEnabled,o.REFLECTIONFRESNELFROMSPECULAR=this._useReflectionFresnelFromSpecular,o.REFRACTIONFRESNEL=this._refractionFresnelParameters&&this._refractionFresnelParameters.isEnabled,o.EMISSIVEFRESNEL=this._emissiveFresnelParameters&&this._emissiveFresnelParameters.isEnabled,o._needNormals=!0,o.FRESNEL=!0):o.FRESNEL=!1),_.G.PrepareDefinesForMisc(e,r,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,o),_.G.PrepareDefinesForAttributes(e,o,!0,!0,!0),_.G.PrepareDefinesForFrameBoundValues(r,s,o,n,null,i.getRenderingMesh().hasThinInstances),this.detailMap.prepareDefines(o,r),o.isDirty){var a=o._areLightsDisposed;o.markAsProcessed();var l=new M.L;o.REFLECTION&&l.addFallback(0,"REFLECTION"),o.SPECULAR&&l.addFallback(0,"SPECULAR"),o.BUMP&&l.addFallback(0,"BUMP"),o.PARALLAX&&l.addFallback(1,"PARALLAX"),o.PARALLAXOCCLUSION&&l.addFallback(0,"PARALLAXOCCLUSION"),o.SPECULAROVERALPHA&&l.addFallback(0,"SPECULAROVERALPHA"),o.FOG&&l.addFallback(1,"FOG"),o.POINTSIZE&&l.addFallback(0,"POINTSIZE"),o.LOGARITHMICDEPTH&&l.addFallback(0,"LOGARITHMICDEPTH"),_.G.HandleFallbacksForShadows(o,l,this._maxSimultaneousLights),o.SPECULARTERM&&l.addFallback(0,"SPECULARTERM"),o.DIFFUSEFRESNEL&&l.addFallback(1,"DIFFUSEFRESNEL"),o.OPACITYFRESNEL&&l.addFallback(2,"OPACITYFRESNEL"),o.REFLECTIONFRESNEL&&l.addFallback(3,"REFLECTIONFRESNEL"),o.EMISSIVEFRESNEL&&l.addFallback(4,"EMISSIVEFRESNEL"),o.FRESNEL&&l.addFallback(4,"FRESNEL"),o.MULTIVIEW&&l.addFallback(0,"MULTIVIEW");var f=[h.o.PositionKind];o.NORMAL&&f.push(h.o.NormalKind),o.UV1&&f.push(h.o.UVKind),o.UV2&&f.push(h.o.UV2Kind),o.VERTEXCOLOR&&f.push(h.o.ColorKind),_.G.PrepareAttributesForBones(f,e,o,l),_.G.PrepareAttributesForInstances(f,o),_.G.PrepareAttributesForMorphTargets(f,e,o);var d="default",p=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vDiffuseColor","vSpecularColor","vEmissiveColor","visibility","vFogInfos","vFogColor","pointSize","vDiffuseInfos","vAmbientInfos","vOpacityInfos","vReflectionInfos","vEmissiveInfos","vSpecularInfos","vBumpInfos","vLightmapInfos","vRefractionInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","diffuseMatrix","ambientMatrix","opacityMatrix","reflectionMatrix","emissiveMatrix","specularMatrix","bumpMatrix","normalMatrix","lightmapMatrix","refractionMatrix","diffuseLeftColor","diffuseRightColor","opacityParts","reflectionLeftColor","reflectionRightColor","emissiveLeftColor","emissiveRightColor","refractionLeftColor","refractionRightColor","vReflectionPosition","vReflectionSize","logarithmicDepthConstant","vTangentSpaceParams","alphaCutOff","boneTextureWidth"],m=["diffuseSampler","ambientSampler","opacitySampler","reflectionCubeSampler","reflection2DSampler","emissiveSampler","specularSampler","bumpSampler","lightmapSampler","refractionCubeSampler","refraction2DSampler","boneSampler"],v=["Material","Scene"];P.p.AddUniforms(p),P.p.AddSamplers(m),c.o.AddUniforms(p),c.o.AddSamplers(p),u.$&&(u.$.PrepareUniforms(p,o),u.$.PrepareSamplers(m,o)),_.G.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:v,samplers:m,defines:o,maxSimultaneousLights:this._maxSimultaneousLights});var y={};this.customShaderNameResolve&&(d=this.customShaderNameResolve(d,p,v,m,o,f,y));var b=o.toString(),T=i.effect,A=r.getEngine().createEffect(d,{attributes:f,uniformsNames:p,uniformBuffersNames:v,samplers:m,defines:b,fallbacks:l,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:o.NUM_MORPH_INFLUENCERS},processFinalCode:y.processFinalCode,multiTarget:o.PREPASS},s);if(A)if(this._onEffectCreatedObservable&&(I.effect=A,I.subMesh=i,this._onEffectCreatedObservable.notifyObservers(I)),this.allowShaderHotSwapping&&T&&!A.isReady()){if(A=T,this._rebuildInParallel=!0,o.markAsUnprocessed(),a)return o._areLightsDisposed=!0,!1}else this._rebuildInParallel=!1,r.resetCachedMaterial(),i.setEffect(A,o),this.buildUniformLayout()}return!(!i.effect||!i.effect.isReady())&&(o._renderId=r.getRenderId(),i.effect._wasPreviouslyReady=!0,!0)},t.prototype.buildUniformLayout=function(){var e=this._uniformBuffer;e.addUniform("diffuseLeftColor",4),e.addUniform("diffuseRightColor",4),e.addUniform("opacityParts",4),e.addUniform("reflectionLeftColor",4),e.addUniform("reflectionRightColor",4),e.addUniform("refractionLeftColor",4),e.addUniform("refractionRightColor",4),e.addUniform("emissiveLeftColor",4),e.addUniform("emissiveRightColor",4),e.addUniform("vDiffuseInfos",2),e.addUniform("vAmbientInfos",2),e.addUniform("vOpacityInfos",2),e.addUniform("vReflectionInfos",2),e.addUniform("vReflectionPosition",3),e.addUniform("vReflectionSize",3),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vSpecularInfos",2),e.addUniform("vBumpInfos",3),e.addUniform("diffuseMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("reflectionMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("specularMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("pointSize",1),e.addUniform("refractionMatrix",16),e.addUniform("vRefractionInfos",4),e.addUniform("vSpecularColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("visibility",1),e.addUniform("vDiffuseColor",4),P.p.PrepareUniformBuffer(e),e.create()},t.prototype.unbind=function(){if(this._activeEffect){var t=!1;this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&(this._activeEffect.setTexture("reflection2DSampler",null),t=!0),this._refractionTexture&&this._refractionTexture.isRenderTarget&&(this._activeEffect.setTexture("refraction2DSampler",null),t=!0),t&&this._markAllSubMeshesAsTexturesDirty()}e.prototype.unbind.call(this)},t.prototype.bindForSubMesh=function(e,i,n){var r=this.getScene(),o=n._materialDefines;if(o){var a=n.effect;if(a){this._activeEffect=a,o.INSTANCES&&!o.THIN_INSTANCES||this.bindOnlyWorldMatrix(e),this.prePassConfiguration.bindForSubMesh(this._activeEffect,r,i,e,this.isFrozen),o.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var h=this._mustRebind(r,a,i.visibility);_.G.BindBonesParameters(i,a);var c=this._uniformBuffer;if(h){if(c.bindToEffect(a,"Material"),this.bindViewProjection(a),!c.useUbo||!this.isFrozen||!c.isSync){if(t.FresnelEnabled&&o.FRESNEL&&(this.diffuseFresnelParameters&&this.diffuseFresnelParameters.isEnabled&&(c.updateColor4("diffuseLeftColor",this.diffuseFresnelParameters.leftColor,this.diffuseFresnelParameters.power),c.updateColor4("diffuseRightColor",this.diffuseFresnelParameters.rightColor,this.diffuseFresnelParameters.bias)),this.opacityFresnelParameters&&this.opacityFresnelParameters.isEnabled&&c.updateColor4("opacityParts",new l.Wo(this.opacityFresnelParameters.leftColor.toLuminance(),this.opacityFresnelParameters.rightColor.toLuminance(),this.opacityFresnelParameters.bias),this.opacityFresnelParameters.power),this.reflectionFresnelParameters&&this.reflectionFresnelParameters.isEnabled&&(c.updateColor4("reflectionLeftColor",this.reflectionFresnelParameters.leftColor,this.reflectionFresnelParameters.power),c.updateColor4("reflectionRightColor",this.reflectionFresnelParameters.rightColor,this.reflectionFresnelParameters.bias)),this.refractionFresnelParameters&&this.refractionFresnelParameters.isEnabled&&(c.updateColor4("refractionLeftColor",this.refractionFresnelParameters.leftColor,this.refractionFresnelParameters.power),c.updateColor4("refractionRightColor",this.refractionFresnelParameters.rightColor,this.refractionFresnelParameters.bias)),this.emissiveFresnelParameters&&this.emissiveFresnelParameters.isEnabled&&(c.updateColor4("emissiveLeftColor",this.emissiveFresnelParameters.leftColor,this.emissiveFresnelParameters.power),c.updateColor4("emissiveRightColor",this.emissiveFresnelParameters.rightColor,this.emissiveFresnelParameters.bias))),r.texturesEnabled){if(this._diffuseTexture&&t.DiffuseTextureEnabled&&(c.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),_.G.BindTextureMatrix(this._diffuseTexture,c,"diffuse")),this._ambientTexture&&t.AmbientTextureEnabled&&(c.updateFloat2("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level),_.G.BindTextureMatrix(this._ambientTexture,c,"ambient")),this._opacityTexture&&t.OpacityTextureEnabled&&(c.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),_.G.BindTextureMatrix(this._opacityTexture,c,"opacity")),this._hasAlphaChannel()&&a.setFloat("alphaCutOff",this.alphaCutOff),this._reflectionTexture&&t.ReflectionTextureEnabled&&(c.updateFloat2("vReflectionInfos",this._reflectionTexture.level,this.roughness),c.updateMatrix("reflectionMatrix",this._reflectionTexture.getReflectionTextureMatrix()),this._reflectionTexture.boundingBoxSize)){var u=this._reflectionTexture;c.updateVector3("vReflectionPosition",u.boundingBoxPosition),c.updateVector3("vReflectionSize",u.boundingBoxSize)}if(this._emissiveTexture&&t.EmissiveTextureEnabled&&(c.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),_.G.BindTextureMatrix(this._emissiveTexture,c,"emissive")),this._lightmapTexture&&t.LightmapTextureEnabled&&(c.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),_.G.BindTextureMatrix(this._lightmapTexture,c,"lightmap")),this._specularTexture&&t.SpecularTextureEnabled&&(c.updateFloat2("vSpecularInfos",this._specularTexture.coordinatesIndex,this._specularTexture.level),_.G.BindTextureMatrix(this._specularTexture,c,"specular")),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&t.BumpTextureEnabled&&(c.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,1/this._bumpTexture.level,this.parallaxScaleBias),_.G.BindTextureMatrix(this._bumpTexture,c,"bump"),r._mirroredCameraPosition?c.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):c.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),this._refractionTexture&&t.RefractionTextureEnabled){var f=1;this._refractionTexture.isCube||(c.updateMatrix("refractionMatrix",this._refractionTexture.getReflectionTextureMatrix()),this._refractionTexture.depth&&(f=this._refractionTexture.depth)),c.updateFloat4("vRefractionInfos",this._refractionTexture.level,this.indexOfRefraction,f,this.invertRefractionY?-1:1)}}this.pointsCloud&&c.updateFloat("pointSize",this.pointSize),o.SPECULARTERM&&c.updateColor4("vSpecularColor",this.specularColor,this.specularPower),c.updateColor3("vEmissiveColor",t.EmissiveTextureEnabled?this.emissiveColor:l.Wo.BlackReadOnly),c.updateColor4("vDiffuseColor",this.diffuseColor,this.alpha)}if(c.updateFloat("visibility",i.visibility),r.texturesEnabled&&(this._diffuseTexture&&t.DiffuseTextureEnabled&&a.setTexture("diffuseSampler",this._diffuseTexture),this._ambientTexture&&t.AmbientTextureEnabled&&a.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&t.OpacityTextureEnabled&&a.setTexture("opacitySampler",this._opacityTexture),this._reflectionTexture&&t.ReflectionTextureEnabled&&(this._reflectionTexture.isCube?a.setTexture("reflectionCubeSampler",this._reflectionTexture):a.setTexture("reflection2DSampler",this._reflectionTexture)),this._emissiveTexture&&t.EmissiveTextureEnabled&&a.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&t.LightmapTextureEnabled&&a.setTexture("lightmapSampler",this._lightmapTexture),this._specularTexture&&t.SpecularTextureEnabled&&a.setTexture("specularSampler",this._specularTexture),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&t.BumpTextureEnabled&&a.setTexture("bumpSampler",this._bumpTexture),this._refractionTexture&&t.RefractionTextureEnabled)){f=1;this._refractionTexture.isCube?a.setTexture("refractionCubeSampler",this._refractionTexture):a.setTexture("refraction2DSampler",this._refractionTexture)}this.detailMap.bindForSubMesh(c,r,this.isFrozen),_.G.BindClipPlane(a,r),r.ambientColor.multiplyToRef(this.ambientColor,this._globalAmbientColor),_.G.BindEyePosition(a,r),a.setColor3("vAmbientColor",this._globalAmbientColor)}!h&&this.isFrozen||(r.lightsEnabled&&!this._disableLighting&&_.G.BindLights(r,i,a,o,this._maxSimultaneousLights,this._rebuildInParallel),(r.fogEnabled&&i.applyFog&&r.fogMode!==s.Scene.FOGMODE_NONE||this._reflectionTexture||this._refractionTexture)&&this.bindView(a),_.G.BindFogParameters(r,i,a),o.NUM_MORPH_INFLUENCERS&&_.G.BindMorphTargetParameters(i,a),this.useLogarithmicDepth&&_.G.BindLogDepth(o,a,r),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect)),c.update(),this._afterBind(i,this._activeEffect)}}},t.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&e.push(this._emissiveTexture),this._specularTexture&&this._specularTexture.animations&&this._specularTexture.animations.length>0&&e.push(this._specularTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&e.push(this._lightmapTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&e.push(this._refractionTexture),this.detailMap.getAnimatables(e),e},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),this._ambientTexture&&t.push(this._ambientTexture),this._opacityTexture&&t.push(this._opacityTexture),this._reflectionTexture&&t.push(this._reflectionTexture),this._emissiveTexture&&t.push(this._emissiveTexture),this._specularTexture&&t.push(this._specularTexture),this._bumpTexture&&t.push(this._bumpTexture),this._lightmapTexture&&t.push(this._lightmapTexture),this._refractionTexture&&t.push(this._refractionTexture),this.detailMap.getActiveTextures(t),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._diffuseTexture===t||(this._ambientTexture===t||(this._opacityTexture===t||(this._reflectionTexture===t||(this._emissiveTexture===t||(this._specularTexture===t||(this._bumpTexture===t||(this._lightmapTexture===t||(this._refractionTexture===t||this.detailMap.hasTexture(t))))))))))},t.prototype.dispose=function(t,i){var n,r,o,s,a,l,h,c,u;i&&(null===(n=this._diffuseTexture)||void 0===n||n.dispose(),null===(r=this._ambientTexture)||void 0===r||r.dispose(),null===(o=this._opacityTexture)||void 0===o||o.dispose(),null===(s=this._reflectionTexture)||void 0===s||s.dispose(),null===(a=this._emissiveTexture)||void 0===a||a.dispose(),null===(l=this._specularTexture)||void 0===l||l.dispose(),null===(h=this._bumpTexture)||void 0===h||h.dispose(),null===(c=this._lightmapTexture)||void 0===c||c.dispose(),null===(u=this._refractionTexture)||void 0===u||u.dispose()),this.detailMap.dispose(i),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t,i)},t.prototype.clone=function(e){var i=this,n=r.p4.Clone((function(){return new t(e,i.getScene())}),this);return n.name=e,n.id=e,n},t.prototype.serialize=function(){return r.p4.Serialize(this)},t.Parse=function(e,i,n){return r.p4.Parse((function(){return new t(e.name,i)}),e,i,n)},Object.defineProperty(t,"DiffuseTextureEnabled",{get:function(){return v.k.DiffuseTextureEnabled},set:function(e){v.k.DiffuseTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"DetailTextureEnabled",{get:function(){return v.k.DetailTextureEnabled},set:function(e){v.k.DetailTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"AmbientTextureEnabled",{get:function(){return v.k.AmbientTextureEnabled},set:function(e){v.k.AmbientTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"OpacityTextureEnabled",{get:function(){return v.k.OpacityTextureEnabled},set:function(e){v.k.OpacityTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ReflectionTextureEnabled",{get:function(){return v.k.ReflectionTextureEnabled},set:function(e){v.k.ReflectionTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"EmissiveTextureEnabled",{get:function(){return v.k.EmissiveTextureEnabled},set:function(e){v.k.EmissiveTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"SpecularTextureEnabled",{get:function(){return v.k.SpecularTextureEnabled},set:function(e){v.k.SpecularTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BumpTextureEnabled",{get:function(){return v.k.BumpTextureEnabled},set:function(e){v.k.BumpTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"LightmapTextureEnabled",{get:function(){return v.k.LightmapTextureEnabled},set:function(e){v.k.LightmapTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"RefractionTextureEnabled",{get:function(){return v.k.RefractionTextureEnabled},set:function(e){v.k.RefractionTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"ColorGradingTextureEnabled",{get:function(){return v.k.ColorGradingTextureEnabled},set:function(e){v.k.ColorGradingTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"FresnelEnabled",{get:function(){return v.k.FresnelEnabled},set:function(e){v.k.FresnelEnabled=e},enumerable:!1,configurable:!0}),(0,n.gn)([(0,r.oU)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"diffuseTexture",void 0),(0,n.gn)([(0,r.oU)("ambientTexture")],t.prototype,"_ambientTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTexture",void 0),(0,n.gn)([(0,r.oU)("opacityTexture")],t.prototype,"_opacityTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"opacityTexture",void 0),(0,n.gn)([(0,r.oU)("reflectionTexture")],t.prototype,"_reflectionTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),(0,n.gn)([(0,r.oU)("emissiveTexture")],t.prototype,"_emissiveTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveTexture",void 0),(0,n.gn)([(0,r.oU)("specularTexture")],t.prototype,"_specularTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"specularTexture",void 0),(0,n.gn)([(0,r.oU)("bumpTexture")],t.prototype,"_bumpTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),(0,n.gn)([(0,r.oU)("lightmapTexture")],t.prototype,"_lightmapTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"lightmapTexture",void 0),(0,n.gn)([(0,r.oU)("refractionTexture")],t.prototype,"_refractionTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"refractionTexture",void 0),(0,n.gn)([(0,r.n9)("ambient")],t.prototype,"ambientColor",void 0),(0,n.gn)([(0,r.n9)("diffuse")],t.prototype,"diffuseColor",void 0),(0,n.gn)([(0,r.n9)("specular")],t.prototype,"specularColor",void 0),(0,n.gn)([(0,r.n9)("emissive")],t.prototype,"emissiveColor",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"specularPower",void 0),(0,n.gn)([(0,r.qC)("useAlphaFromDiffuseTexture")],t.prototype,"_useAlphaFromDiffuseTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"useAlphaFromDiffuseTexture",void 0),(0,n.gn)([(0,r.qC)("useEmissiveAsIllumination")],t.prototype,"_useEmissiveAsIllumination",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useEmissiveAsIllumination",void 0),(0,n.gn)([(0,r.qC)("linkEmissiveWithDiffuse")],t.prototype,"_linkEmissiveWithDiffuse",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"linkEmissiveWithDiffuse",void 0),(0,n.gn)([(0,r.qC)("useSpecularOverAlpha")],t.prototype,"_useSpecularOverAlpha",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useSpecularOverAlpha",void 0),(0,n.gn)([(0,r.qC)("useReflectionOverAlpha")],t.prototype,"_useReflectionOverAlpha",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useReflectionOverAlpha",void 0),(0,n.gn)([(0,r.qC)("disableLighting")],t.prototype,"_disableLighting",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),(0,n.gn)([(0,r.qC)("useObjectSpaceNormalMap")],t.prototype,"_useObjectSpaceNormalMap",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useObjectSpaceNormalMap",void 0),(0,n.gn)([(0,r.qC)("useParallax")],t.prototype,"_useParallax",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallax",void 0),(0,n.gn)([(0,r.qC)("useParallaxOcclusion")],t.prototype,"_useParallaxOcclusion",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallaxOcclusion",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"parallaxScaleBias",void 0),(0,n.gn)([(0,r.qC)("roughness")],t.prototype,"_roughness",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"roughness",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"indexOfRefraction",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"invertRefractionY",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"alphaCutOff",void 0),(0,n.gn)([(0,r.qC)("useLightmapAsShadowmap")],t.prototype,"_useLightmapAsShadowmap",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLightmapAsShadowmap",void 0),(0,n.gn)([(0,r.qQ)("diffuseFresnelParameters")],t.prototype,"_diffuseFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"diffuseFresnelParameters",void 0),(0,n.gn)([(0,r.qQ)("opacityFresnelParameters")],t.prototype,"_opacityFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelAndMiscDirty")],t.prototype,"opacityFresnelParameters",void 0),(0,n.gn)([(0,r.qQ)("reflectionFresnelParameters")],t.prototype,"_reflectionFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"reflectionFresnelParameters",void 0),(0,n.gn)([(0,r.qQ)("refractionFresnelParameters")],t.prototype,"_refractionFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"refractionFresnelParameters",void 0),(0,n.gn)([(0,r.qQ)("emissiveFresnelParameters")],t.prototype,"_emissiveFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"emissiveFresnelParameters",void 0),(0,n.gn)([(0,r.qC)("useReflectionFresnelFromSpecular")],t.prototype,"_useReflectionFresnelFromSpecular",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"useReflectionFresnelFromSpecular",void 0),(0,n.gn)([(0,r.qC)("useGlossinessFromSpecularMapAlpha")],t.prototype,"_useGlossinessFromSpecularMapAlpha",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useGlossinessFromSpecularMapAlpha",void 0),(0,n.gn)([(0,r.qC)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),(0,n.gn)([(0,r.qC)("invertNormalMapX")],t.prototype,"_invertNormalMapX",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapX",void 0),(0,n.gn)([(0,r.qC)("invertNormalMapY")],t.prototype,"_invertNormalMapY",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapY",void 0),(0,n.gn)([(0,r.qC)("twoSidedLighting")],t.prototype,"_twoSidedLighting",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"twoSidedLighting",void 0),(0,n.gn)([(0,r.qC)()],t.prototype,"useLogarithmicDepth",null),t}(p.a);m.Q.RegisteredTypes["BABYLON.StandardMaterial"]=D,s.Scene.DefaultMaterialFactory=function(e){return new D("default material",e)}},356:(e,t,i)=>{"use strict";i.d(t,{M:()=>s});var n=i(3734),r=i(2131),o=i(5146);r.B.prototype.createUniformBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create uniform buffer");var i=new o.M(t);return this.bindUniformBuffer(i),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.STATIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.STATIC_DRAW),this.bindUniformBuffer(null),i.references=1,i},r.B.prototype.createDynamicUniformBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create dynamic uniform buffer");var i=new o.M(t);return this.bindUniformBuffer(i),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.DYNAMIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.DYNAMIC_DRAW),this.bindUniformBuffer(null),i.references=1,i},r.B.prototype.updateUniformBuffer=function(e,t,i,n){this.bindUniformBuffer(e),void 0===i&&(i=0),void 0===n?t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,i,t):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,i,new Float32Array(t)):t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,t.subarray(i,i+n)):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,new Float32Array(t).subarray(i,i+n)),this.bindUniformBuffer(null)},r.B.prototype.bindUniformBuffer=function(e){this._gl.bindBuffer(this._gl.UNIFORM_BUFFER,e?e.underlyingResource:null)},r.B.prototype.bindUniformBufferBase=function(e,t){this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER,t,e?e.underlyingResource:null)},r.B.prototype.bindUniformBlock=function(e,t,i){var n=e.program,r=this._gl.getUniformBlockIndex(n,t);this._gl.uniformBlockBinding(n,r,i)};var s=function(){function e(e,t,i){this._alreadyBound=!1,this._valueCache={},this._engine=e,this._noUBO=!e.supportsUniformBuffers,this._dynamic=i,this._data=t||[],this._uniformLocations={},this._uniformSizes={},this._uniformLocationPointer=0,this._needSync=!1,this._noUBO?(this.updateMatrix3x3=this._updateMatrix3x3ForEffect,this.updateMatrix2x2=this._updateMatrix2x2ForEffect,this.updateFloat=this._updateFloatForEffect,this.updateFloat2=this._updateFloat2ForEffect,this.updateFloat3=this._updateFloat3ForEffect,this.updateFloat4=this._updateFloat4ForEffect,this.updateMatrix=this._updateMatrixForEffect,this.updateVector3=this._updateVector3ForEffect,this.updateVector4=this._updateVector4ForEffect,this.updateColor3=this._updateColor3ForEffect,this.updateColor4=this._updateColor4ForEffect):(this._engine._uniformBuffers.push(this),this.updateMatrix3x3=this._updateMatrix3x3ForUniform,this.updateMatrix2x2=this._updateMatrix2x2ForUniform,this.updateFloat=this._updateFloatForUniform,this.updateFloat2=this._updateFloat2ForUniform,this.updateFloat3=this._updateFloat3ForUniform,this.updateFloat4=this._updateFloat4ForUniform,this.updateMatrix=this._updateMatrixForUniform,this.updateVector3=this._updateVector3ForUniform,this.updateVector4=this._updateVector4ForUniform,this.updateColor3=this._updateColor3ForUniform,this.updateColor4=this._updateColor4ForUniform)}return Object.defineProperty(e.prototype,"useUbo",{get:function(){return!this._noUBO},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSync",{get:function(){return!this._needSync},enumerable:!1,configurable:!0}),e.prototype.isDynamic=function(){return void 0!==this._dynamic},e.prototype.getData=function(){return this._bufferData},e.prototype.getBuffer=function(){return this._buffer},e.prototype._fillAlignment=function(e){var t;if(t=e<=2?e:4,this._uniformLocationPointer%t!=0){var i=this._uniformLocationPointer;this._uniformLocationPointer+=t-this._uniformLocationPointer%t;for(var n=this._uniformLocationPointer-i,r=0;r{"use strict";i.d(t,{T:()=>n,RD:()=>s,c7:()=>o});var n,r=i(2973);!function(e){e[e.LOCAL=0]="LOCAL",e[e.WORLD=1]="WORLD",e[e.BONE=2]="BONE"}(n||(n={}));var o,s=function(){function e(){}return e.X=new r.P(1,0,0),e.Y=new r.P(0,1,0),e.Z=new r.P(0,0,1),e}();!function(e){e[e.X=0]="X",e[e.Y=1]="Y",e[e.Z=2]="Z"}(o||(o={}))},8362:(e,t,i)=>{"use strict";i.d(t,{Wo:()=>a,HE:()=>l,zZ:()=>h});var n=i(9018),r=i(2782),o=i(8035),s=i(6132),a=function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this.r=e,this.g=t,this.b=i}return e.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"},e.prototype.getClassName=function(){return"Color3"},e.prototype.getHashCode=function(){var e=255*this.r|0;return e=397*(e=397*e^(255*this.g|0))^(255*this.b|0)},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,this},e.prototype.fromArray=function(t,i){return void 0===i&&(i=0),e.FromArrayToRef(t,i,this),this},e.prototype.toColor4=function(e){return void 0===e&&(e=1),new l(this.r,this.g,this.b,e)},e.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},e.prototype.toLuminance=function(){return.3*this.r+.59*this.g+.11*this.b},e.prototype.multiply=function(t){return new e(this.r*t.r,this.g*t.g,this.b*t.b)},e.prototype.multiplyToRef=function(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,this},e.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b},e.prototype.equalsFloats=function(e,t,i){return this.r===e&&this.g===t&&this.b===i},e.prototype.scale=function(t){return new e(this.r*t,this.g*t,this.b*t)},e.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,this},e.prototype.clampToRef=function(e,t,i){return void 0===e&&(e=0),void 0===t&&(t=1),i.r=n.R.Clamp(this.r,e,t),i.g=n.R.Clamp(this.g,e,t),i.b=n.R.Clamp(this.b,e,t),this},e.prototype.add=function(t){return new e(this.r+t.r,this.g+t.g,this.b+t.b)},e.prototype.addToRef=function(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,this},e.prototype.subtract=function(t){return new e(this.r-t.r,this.g-t.g,this.b-t.b)},e.prototype.subtractToRef=function(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,this},e.prototype.clone=function(){return new e(this.r,this.g,this.b)},e.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},e.prototype.copyFromFloats=function(e,t,i){return this.r=e,this.g=t,this.b=i,this},e.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},e.prototype.toHexString=function(){var e=255*this.r|0,t=255*this.g|0,i=255*this.b|0;return"#"+n.R.ToHex(e)+n.R.ToHex(t)+n.R.ToHex(i)},e.prototype.toLinearSpace=function(){var t=new e;return this.toLinearSpaceToRef(t),t},e.prototype.toHSV=function(){var t=new e;return this.toHSVToRef(t),t},e.prototype.toHSVToRef=function(e){var t=this.r,i=this.g,n=this.b,r=Math.max(t,i,n),o=Math.min(t,i,n),s=0,a=0,l=r,h=r-o;0!==r&&(a=h/r),r!=o&&(r==t?(s=(i-n)/h,i=0&&o<=1?(a=r,l=s):o>=1&&o<=2?(a=s,l=r):o>=2&&o<=3?(l=r,h=s):o>=3&&o<=4?(l=s,h=r):o>=4&&o<=5?(a=s,h=r):o>=5&&o<=6&&(a=r,h=s);var c=i-r;n.set(a+c,l+c,h+c)},e.FromHexString=function(t){if("#"!==t.substring(0,1)||7!==t.length)return new e(0,0,0);var i=parseInt(t.substring(1,3),16),n=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16);return e.FromInts(i,n,r)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1],t[i+2])},e.FromArrayToRef=function(e,t,i){void 0===t&&(t=0),i.r=e[t],i.g=e[t+1],i.b=e[t+2]},e.FromInts=function(t,i,n){return new e(t/255,i/255,n/255)},e.Lerp=function(t,i,n){var r=new e(0,0,0);return e.LerpToRef(t,i,n,r),r},e.LerpToRef=function(e,t,i,n){n.r=e.r+(t.r-e.r)*i,n.g=e.g+(t.g-e.g)*i,n.b=e.b+(t.b-e.b)*i},e.Red=function(){return new e(1,0,0)},e.Green=function(){return new e(0,1,0)},e.Blue=function(){return new e(0,0,1)},e.Black=function(){return new e(0,0,0)},Object.defineProperty(e,"BlackReadOnly",{get:function(){return e._BlackReadOnly},enumerable:!1,configurable:!0}),e.White=function(){return new e(1,1,1)},e.Purple=function(){return new e(.5,0,.5)},e.Magenta=function(){return new e(1,0,1)},e.Yellow=function(){return new e(1,1,0)},e.Gray=function(){return new e(.5,.5,.5)},e.Teal=function(){return new e(0,1,1)},e.Random=function(){return new e(Math.random(),Math.random(),Math.random())},e._BlackReadOnly=e.Black(),e}(),l=function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),this.r=e,this.g=t,this.b=i,this.a=n}return e.prototype.addInPlace=function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this},e.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e[t+3]=this.a,this},e.prototype.fromArray=function(t,i){return void 0===i&&(i=0),e.FromArrayToRef(t,i,this),this},e.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a},e.prototype.add=function(t){return new e(this.r+t.r,this.g+t.g,this.b+t.b,this.a+t.a)},e.prototype.subtract=function(t){return new e(this.r-t.r,this.g-t.g,this.b-t.b,this.a-t.a)},e.prototype.subtractToRef=function(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t.a=this.a-e.a,this},e.prototype.scale=function(t){return new e(this.r*t,this.g*t,this.b*t,this.a*t)},e.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t.a=this.a*e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t.a+=this.a*e,this},e.prototype.clampToRef=function(e,t,i){return void 0===e&&(e=0),void 0===t&&(t=1),i.r=n.R.Clamp(this.r,e,t),i.g=n.R.Clamp(this.g,e,t),i.b=n.R.Clamp(this.b,e,t),i.a=n.R.Clamp(this.a,e,t),this},e.prototype.multiply=function(t){return new e(this.r*t.r,this.g*t.g,this.b*t.b,this.a*t.a)},e.prototype.multiplyToRef=function(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t.a=this.a*e.a,t},e.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"},e.prototype.getClassName=function(){return"Color4"},e.prototype.getHashCode=function(){var e=255*this.r|0;return e=397*(e=397*(e=397*e^(255*this.g|0))^(255*this.b|0))^(255*this.a|0)},e.prototype.clone=function(){return new e(this.r,this.g,this.b,this.a)},e.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this},e.prototype.copyFromFloats=function(e,t,i,n){return this.r=e,this.g=t,this.b=i,this.a=n,this},e.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},e.prototype.toHexString=function(e){void 0===e&&(e=!1);var t=255*this.r|0,i=255*this.g|0,r=255*this.b|0;if(e)return"#"+n.R.ToHex(t)+n.R.ToHex(i)+n.R.ToHex(r);var o=255*this.a|0;return"#"+n.R.ToHex(t)+n.R.ToHex(i)+n.R.ToHex(r)+n.R.ToHex(o)},e.prototype.toLinearSpace=function(){var t=new e;return this.toLinearSpaceToRef(t),t},e.prototype.toLinearSpaceToRef=function(e){return e.r=Math.pow(this.r,r.Nn),e.g=Math.pow(this.g,r.Nn),e.b=Math.pow(this.b,r.Nn),e.a=this.a,this},e.prototype.toGammaSpace=function(){var t=new e;return this.toGammaSpaceToRef(t),t},e.prototype.toGammaSpaceToRef=function(e){return e.r=Math.pow(this.r,r.zp),e.g=Math.pow(this.g,r.zp),e.b=Math.pow(this.b,r.zp),e.a=this.a,this},e.FromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length)return new e(0,0,0,0);var i=parseInt(t.substring(1,3),16),n=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16),o=parseInt(t.substring(7,9),16);return e.FromInts(i,n,r,o)},e.Lerp=function(t,i,n){var r=new e(0,0,0,0);return e.LerpToRef(t,i,n,r),r},e.LerpToRef=function(e,t,i,n){n.r=e.r+(t.r-e.r)*i,n.g=e.g+(t.g-e.g)*i,n.b=e.b+(t.b-e.b)*i,n.a=e.a+(t.a-e.a)*i},e.FromColor3=function(t,i){return void 0===i&&(i=1),new e(t.r,t.g,t.b,i)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1],t[i+2],t[i+3])},e.FromArrayToRef=function(e,t,i){void 0===t&&(t=0),i.r=e[t],i.g=e[t+1],i.b=e[t+2],i.a=e[t+3]},e.FromInts=function(t,i,n,r){return new e(t/255,i/255,n/255,r/255)},e.CheckColors4=function(e,t){if(e.length===3*t){for(var i=[],n=0;n{"use strict";i.d(t,{zp:()=>n,Nn:()=>r,kn:()=>o});var n=1/2.2,r=2.2,o=.001},131:(e,t,i)=>{"use strict";i.d(t,{i:()=>r});var n=i(3405),r=function(){function e(){}return e.GetPlanes=function(t){for(var i=[],r=0;r<6;r++)i.push(new n.J(0,0,0,0));return e.GetPlanesToRef(t,i),i},e.GetNearPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]+i[2],t.normal.y=i[7]+i[6],t.normal.z=i[11]+i[10],t.d=i[15]+i[14],t.normalize()},e.GetFarPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]-i[2],t.normal.y=i[7]-i[6],t.normal.z=i[11]-i[10],t.d=i[15]-i[14],t.normalize()},e.GetLeftPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]+i[0],t.normal.y=i[7]+i[4],t.normal.z=i[11]+i[8],t.d=i[15]+i[12],t.normalize()},e.GetRightPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]-i[0],t.normal.y=i[7]-i[4],t.normal.z=i[11]-i[8],t.d=i[15]-i[12],t.normalize()},e.GetTopPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]-i[1],t.normal.y=i[7]-i[5],t.normal.z=i[11]-i[9],t.d=i[15]-i[13],t.normalize()},e.GetBottomPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]+i[1],t.normal.y=i[7]+i[5],t.normal.z=i[11]+i[9],t.d=i[15]+i[13],t.normalize()},e.GetPlanesToRef=function(t,i){e.GetNearPlaneToRef(t,i[0]),e.GetFarPlaneToRef(t,i[1]),e.GetLeftPlaneToRef(t,i[2]),e.GetRightPlaneToRef(t,i[3]),e.GetTopPlaneToRef(t,i[4]),e.GetBottomPlaneToRef(t,i[5])},e}()},5168:(e,t,i)=>{"use strict";i.d(t,{y:()=>r,k:()=>o});var n=i(2973);function r(e,t,i,r,o){void 0===o&&(o=null);for(var s=new n.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),a=new n.P(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),l=i;l{"use strict";i.r(t),i.d(t,{Angle:()=>a.RZ,Arc2:()=>a.Q,Axis:()=>n.RD,BezierCurve:()=>a.hr,Color3:()=>r.Wo,Color4:()=>r.HE,Coordinate:()=>n.c7,Curve3:()=>a.j_,Epsilon:()=>o.kn,Frustum:()=>s.i,Matrix:()=>c.y3,Orientation:()=>a.i5,Path2:()=>a.ZZ,Path3D:()=>a.$B,Plane:()=>l.J,PositionNormalTextureVertex:()=>f,PositionNormalVertex:()=>u,Quaternion:()=>c._f,Size:()=>h.$,Space:()=>n.T,TmpColors:()=>r.zZ,TmpVectors:()=>c.jp,ToGammaSpace:()=>o.zp,ToLinearSpace:()=>o.Nn,Vector2:()=>c.FM,Vector3:()=>c.P,Vector4:()=>c.Lt,Viewport:()=>d.l});var n=i(9068),r=i(8362),o=i(2782),s=i(131),a=i(7580),l=i(3405),h=i(488),c=i(2973),u=function(){function e(e,t){void 0===e&&(e=c.P.Zero()),void 0===t&&(t=c.P.Up()),this.position=e,this.normal=t}return e.prototype.clone=function(){return new e(this.position.clone(),this.normal.clone())},e}(),f=function(){function e(e,t,i){void 0===e&&(e=c.P.Zero()),void 0===t&&(t=c.P.Up()),void 0===i&&(i=c.FM.Zero()),this.position=e,this.normal=t,this.uv=i}return e.prototype.clone=function(){return new e(this.position.clone(),this.normal.clone(),this.uv.clone())},e}(),d=i(4272)},7580:(e,t,i)=>{"use strict";i.d(t,{i5:()=>n,hr:()=>a,RZ:()=>l,Q:()=>h,ZZ:()=>c,$B:()=>u,j_:()=>f});var n,r=i(9018),o=i(2973),s=i(2782);!function(e){e[e.CW=0]="CW",e[e.CCW=1]="CCW"}(n||(n={}));var a=function(){function e(){}return e.Interpolate=function(e,t,i,n,r){for(var o=1-3*n+3*t,s=3*n-6*t,a=3*t,l=e,h=0;h<5;h++){var c=l*l;l-=(o*(c*l)+s*c+a*l-e)*(1/(3*o*c+2*s*l+a)),l=Math.min(1,Math.max(0,l))}return 3*Math.pow(1-l,2)*l*i+3*(1-l)*Math.pow(l,2)*r+Math.pow(l,3)},e}(),l=function(){function e(e){this._radians=e,this._radians<0&&(this._radians+=2*Math.PI)}return e.prototype.degrees=function(){return 180*this._radians/Math.PI},e.prototype.radians=function(){return this._radians},e.BetweenTwoPoints=function(t,i){var n=i.subtract(t);return new e(Math.atan2(n.y,n.x))},e.FromRadians=function(t){return new e(t)},e.FromDegrees=function(t){return new e(t*Math.PI/180)},e}(),h=function(e,t,i){this.startPoint=e,this.midPoint=t,this.endPoint=i;var r=Math.pow(t.x,2)+Math.pow(t.y,2),s=(Math.pow(e.x,2)+Math.pow(e.y,2)-r)/2,a=(r-Math.pow(i.x,2)-Math.pow(i.y,2))/2,h=(e.x-t.x)*(t.y-i.y)-(t.x-i.x)*(e.y-t.y);this.centerPoint=new o.FM((s*(t.y-i.y)-a*(e.y-t.y))/h,((e.x-t.x)*a-(t.x-i.x)*s)/h),this.radius=this.centerPoint.subtract(this.startPoint).length(),this.startAngle=l.BetweenTwoPoints(this.centerPoint,this.startPoint);var c=this.startAngle.degrees(),u=l.BetweenTwoPoints(this.centerPoint,this.midPoint).degrees(),f=l.BetweenTwoPoints(this.centerPoint,this.endPoint).degrees();u-c>180&&(u-=360),u-c<-180&&(u+=360),f-u>180&&(f-=360),f-u<-180&&(f+=360),this.orientation=u-c<0?n.CW:n.CCW,this.angle=l.FromDegrees(this.orientation===n.CW?c-f:f-c)},c=function(){function e(e,t){this._points=new Array,this._length=0,this.closed=!1,this._points.push(new o.FM(e,t))}return e.prototype.addLineTo=function(e,t){if(this.closed)return this;var i=new o.FM(e,t),n=this._points[this._points.length-1];return this._points.push(i),this._length+=i.subtract(n).length(),this},e.prototype.addArcTo=function(e,t,i,r,s){if(void 0===s&&(s=36),this.closed)return this;var a=this._points[this._points.length-1],l=new o.FM(e,t),c=new o.FM(i,r),u=new h(a,l,c),f=u.angle.radians()/s;u.orientation===n.CW&&(f*=-1);for(var d=u.startAngle.radians()+f,p=0;p1)return o.FM.Zero();for(var t=e*this.length(),i=0,n=0;n=i&&t<=l){var h=a.normalize(),c=t-i;return new o.FM(s.x+h.x*c,s.y+h.y*c)}i=l}return o.FM.Zero()},e.StartingAt=function(t,i){return new e(t,i)},e}(),u=function(){function e(e,t,i,n){void 0===t&&(t=null),void 0===n&&(n=!1),this.path=e,this._curve=new Array,this._distances=new Array,this._tangents=new Array,this._normals=new Array,this._binormals=new Array,this._pointAtData={id:0,point:o.P.Zero(),previousPointArrayIndex:0,position:0,subPosition:0,interpolateReady:!1,interpolationMatrix:o.y3.Identity()};for(var r=0;ri){var n=t;t=i,i=n}var r=this.getCurve(),o=this.getPointAt(t),s=this.getPreviousPointIndexAt(t),a=this.getPointAt(i),l=this.getPreviousPointIndexAt(i)+1,h=[];return 0!==t&&(s++,h.push(o)),h.push.apply(h,r.slice(s,l)),1===i&&1!==t||h.push(a),new e(h,this.getNormalAt(t),this._raw,this._alignTangentsWithPath)},e.prototype.update=function(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!1);for(var n=0;nt+1;)t++,i=this._curve[e].subtract(this._curve[e-t]);return i},e.prototype._normalVector=function(e,t){var i,n,a=e.length();(0===a&&(a=1),null==t)?(n=r.R.WithinEpsilon(Math.abs(e.y)/a,1,s.kn)?r.R.WithinEpsilon(Math.abs(e.x)/a,1,s.kn)?r.R.WithinEpsilon(Math.abs(e.z)/a,1,s.kn)?o.P.Zero():new o.P(0,0,1):new o.P(1,0,0):new o.P(0,-1,0),i=o.P.Cross(e,n)):(i=o.P.Cross(e,t),o.P.CrossToRef(i,e,i));return i.normalize(),i},e.prototype._updatePointAtData=function(e,t){if(void 0===t&&(t=!1),this._pointAtData.id===e)return this._pointAtData.interpolateReady||this._updateInterpolationMatrix(),this._pointAtData;this._pointAtData.id=e;var i=this.getPoints();if(e<=0)return this._setPointAtData(0,0,i[0],0,t);if(e>=1)return this._setPointAtData(1,1,i[i.length-1],i.length-1,t);for(var n,r=i[0],s=0,a=e*this.length(),l=1;la){var c=(s-a)/h,u=r.subtract(n),f=n.add(u.scaleInPlace(c));return this._setPointAtData(e,1-c,f,l-1,t)}r=n}return this._pointAtData},e.prototype._setPointAtData=function(e,t,i,n,r){return this._pointAtData.point=i,this._pointAtData.position=e,this._pointAtData.subPosition=t,this._pointAtData.previousPointArrayIndex=n,this._pointAtData.interpolateReady=r,r&&this._updateInterpolationMatrix(),this._pointAtData},e.prototype._updateInterpolationMatrix=function(){this._pointAtData.interpolationMatrix=o.y3.Identity();var e=this._pointAtData.previousPointArrayIndex;if(e!==this._tangents.length-1){var t=e+1,i=this._tangents[e].clone(),n=this._normals[e].clone(),r=this._binormals[e].clone(),s=this._tangents[t].clone(),a=this._normals[t].clone(),l=this._binormals[t].clone(),h=o._f.RotationQuaternionFromAxis(n,r,i),c=o._f.RotationQuaternionFromAxis(a,l,s);o._f.Slerp(h,c,this._pointAtData.subPosition).toRotationMatrix(this._pointAtData.interpolationMatrix)}},e}(),f=function(){function e(e){this._length=0,this._points=e,this._length=this._computeLength(e)}return e.CreateQuadraticBezier=function(t,i,n,r){r=r>2?r:3;for(var s=new Array,a=function(e,t,i,n){return(1-e)*(1-e)*t+2*e*(1-e)*i+e*e*n},l=0;l<=r;l++)s.push(new o.P(a(l/r,t.x,i.x,n.x),a(l/r,t.y,i.y,n.y),a(l/r,t.z,i.z,n.z)));return new e(s)},e.CreateCubicBezier=function(t,i,n,r,s){s=s>3?s:4;for(var a=new Array,l=function(e,t,i,n,r){return(1-e)*(1-e)*(1-e)*t+3*e*(1-e)*(1-e)*i+3*e*e*(1-e)*n+e*e*e*r},h=0;h<=s;h++)a.push(new o.P(l(h/s,t.x,i.x,n.x,r.x),l(h/s,t.y,i.y,n.y,r.y),l(h/s,t.z,i.z,n.z,r.z)));return new e(a)},e.CreateHermiteSpline=function(t,i,n,r,s){for(var a=new Array,l=1/s,h=0;h<=s;h++)a.push(o.P.Hermite(t,i,n,r,h*l));return new e(a)},e.CreateCatmullRomSpline=function(t,i,n){var r=new Array,s=1/i,a=0;if(n){for(var l=t.length,h=0;h{"use strict";i.d(t,{J:()=>r});var n=i(2973),r=function(){function e(e,t,i,r){this.normal=new n.P(e,t,i),this.d=r}return e.prototype.asArray=function(){return[this.normal.x,this.normal.y,this.normal.z,this.d]},e.prototype.clone=function(){return new e(this.normal.x,this.normal.y,this.normal.z,this.d)},e.prototype.getClassName=function(){return"Plane"},e.prototype.getHashCode=function(){var e=this.normal.getHashCode();return e=397*e^(0|this.d)},e.prototype.normalize=function(){var e=Math.sqrt(this.normal.x*this.normal.x+this.normal.y*this.normal.y+this.normal.z*this.normal.z),t=0;return 0!==e&&(t=1/e),this.normal.x*=t,this.normal.y*=t,this.normal.z*=t,this.d*=t,this},e.prototype.transform=function(t){var i=e._TmpMatrix;t.invertToRef(i);var n=i.m,r=this.normal.x,o=this.normal.y,s=this.normal.z,a=this.d;return new e(r*n[0]+o*n[1]+s*n[2]+a*n[3],r*n[4]+o*n[5]+s*n[6]+a*n[7],r*n[8]+o*n[9]+s*n[10]+a*n[11],r*n[12]+o*n[13]+s*n[14]+a*n[15])},e.prototype.dotCoordinate=function(e){return this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z+this.d},e.prototype.copyFromPoints=function(e,t,i){var n,r=t.x-e.x,o=t.y-e.y,s=t.z-e.z,a=i.x-e.x,l=i.y-e.y,h=i.z-e.z,c=o*h-s*l,u=s*a-r*h,f=r*l-o*a,d=Math.sqrt(c*c+u*u+f*f);return n=0!==d?1/d:0,this.normal.x=c*n,this.normal.y=u*n,this.normal.z=f*n,this.d=-(this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z),this},e.prototype.isFrontFacingTo=function(e,t){return n.P.Dot(this.normal,e)<=t},e.prototype.signedDistanceTo=function(e){return n.P.Dot(e,this.normal)+this.d},e.FromArray=function(t){return new e(t[0],t[1],t[2],t[3])},e.FromPoints=function(t,i,n){var r=new e(0,0,0,0);return r.copyFromPoints(t,i,n),r},e.FromPositionAndNormal=function(t,i){var n=new e(0,0,0,0);return i.normalize(),n.normal=i,n.d=-(i.x*t.x+i.y*t.y+i.z*t.z),n},e.SignedDistanceToPlaneFromPositionAndNormal=function(e,t,i){var r=-(t.x*e.x+t.y*e.y+t.z*e.z);return n.P.Dot(i,t)+r},e._TmpMatrix=n.y3.Identity(),e}()},9018:(e,t,i)=>{"use strict";i.d(t,{R:()=>n});var n=function(){function e(){}return e.WithinEpsilon=function(e,t,i){void 0===i&&(i=1401298e-51);var n=e-t;return-i<=n&&n<=i},e.ToHex=function(e){var t=e.toString(16);return e<=15?("0"+t).toUpperCase():t.toUpperCase()},e.Sign=function(e){return 0===(e=+e)||isNaN(e)?e:e>0?1:-1},e.Clamp=function(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=1),Math.min(i,Math.max(t,e))},e.Log2=function(e){return Math.log(e)*Math.LOG2E},e.Repeat=function(e,t){return e-Math.floor(e/t)*t},e.Normalize=function(e,t,i){return(e-t)/(i-t)},e.Denormalize=function(e,t,i){return e*(i-t)+t},e.DeltaAngle=function(t,i){var n=e.Repeat(i-t,360);return n>180&&(n-=360),n},e.PingPong=function(t,i){var n=e.Repeat(t,2*i);return i-Math.abs(n-i)},e.SmoothStep=function(t,i,n){var r=e.Clamp(n);return i*(r=-2*r*r*r+3*r*r)+t*(1-r)},e.MoveTowards=function(t,i,n){return Math.abs(i-t)<=n?i:t+e.Sign(i-t)*n},e.MoveTowardsAngle=function(t,i,n){var r=e.DeltaAngle(t,i),o=0;return-n180&&(r-=360),t+r*e.Clamp(n)},e.InverseLerp=function(t,i,n){return t!=i?e.Clamp((n-t)/(i-t)):0},e.Hermite=function(e,t,i,n,r){var o=r*r,s=r*o;return e*(2*s-3*o+1)+i*(-2*s+3*o)+t*(s-2*o+r)+n*(s-o)},e.RandomRange=function(e,t){return e===t?e:Math.random()*(t-e)+e},e.RangeToPercent=function(e,t,i){return(e-t)/(i-t)},e.PercentToRange=function(e,t,i){return(i-t)*e+t},e.NormalizeRadians=function(t){return t-=e.TwoPi*Math.floor((t+Math.PI)/e.TwoPi)},e.TwoPi=2*Math.PI,e}()},488:(e,t,i)=>{"use strict";i.d(t,{$:()=>n});var n=function(){function e(e,t){this.width=e,this.height=t}return e.prototype.toString=function(){return"{W: "+this.width+", H: "+this.height+"}"},e.prototype.getClassName=function(){return"Size"},e.prototype.getHashCode=function(){var e=0|this.width;return e=397*e^(0|this.height)},e.prototype.copyFrom=function(e){this.width=e.width,this.height=e.height},e.prototype.copyFromFloats=function(e,t){return this.width=e,this.height=t,this},e.prototype.set=function(e,t){return this.copyFromFloats(e,t)},e.prototype.multiplyByFloats=function(t,i){return new e(this.width*t,this.height*i)},e.prototype.clone=function(){return new e(this.width,this.height)},e.prototype.equals=function(e){return!!e&&(this.width===e.width&&this.height===e.height)},Object.defineProperty(e.prototype,"surface",{get:function(){return this.width*this.height},enumerable:!1,configurable:!0}),e.Zero=function(){return new e(0,0)},e.prototype.add=function(t){return new e(this.width+t.width,this.height+t.height)},e.prototype.subtract=function(t){return new e(this.width-t.width,this.height-t.height)},e.Lerp=function(t,i,n){return new e(t.width+(i.width-t.width)*n,t.height+(i.height-t.height)*n)},e}()},2973:(e,t,i)=>{"use strict";i.d(t,{FM:()=>l,P:()=>h,Lt:()=>c,_f:()=>u,y3:()=>f,jp:()=>p});var n=i(9018),r=i(2782),o=i(8035),s=i(6132),a=i(8868),l=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=0),this.x=e,this.y=t}return e.prototype.toString=function(){return"{X: "+this.x+" Y: "+this.y+"}"},e.prototype.getClassName=function(){return"Vector2"},e.prototype.getHashCode=function(){var e=0|this.x;return e=397*e^(0|this.y)},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,this},e.prototype.fromArray=function(t,i){return void 0===i&&(i=0),e.FromArrayToRef(t,i,this),this},e.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},e.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this},e.prototype.copyFromFloats=function(e,t){return this.x=e,this.y=t,this},e.prototype.set=function(e,t){return this.copyFromFloats(e,t)},e.prototype.add=function(t){return new e(this.x+t.x,this.y+t.y)},e.prototype.addToRef=function(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,this},e.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this},e.prototype.addVector3=function(t){return new e(this.x+t.x,this.y+t.y)},e.prototype.subtract=function(t){return new e(this.x-t.x,this.y-t.y)},e.prototype.subtractToRef=function(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,this},e.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.y,this},e.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this},e.prototype.multiply=function(t){return new e(this.x*t.x,this.y*t.y)},e.prototype.multiplyToRef=function(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,this},e.prototype.multiplyByFloats=function(t,i){return new e(this.x*t,this.y*i)},e.prototype.divide=function(t){return new e(this.x/t.x,this.y/t.y)},e.prototype.divideToRef=function(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,this},e.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},e.prototype.negate=function(){return new e(-this.x,-this.y)},e.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this},e.prototype.negateToRef=function(e){return e.copyFromFloats(-1*this.x,-1*this.y)},e.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this},e.prototype.scale=function(t){var i=new e(0,0);return this.scaleToRef(t,i),i},e.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,this},e.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y},e.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=r.kn),e&&n.R.WithinEpsilon(this.x,e.x,t)&&n.R.WithinEpsilon(this.y,e.y,t)},e.prototype.floor=function(){return new e(Math.floor(this.x),Math.floor(this.y))},e.prototype.fract=function(){return new e(this.x-Math.floor(this.x),this.y-Math.floor(this.y))},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.prototype.normalize=function(){var e=this.length();return 0===e||(this.x/=e,this.y/=e),this},e.prototype.clone=function(){return new e(this.x,this.y)},e.Zero=function(){return new e(0,0)},e.One=function(){return new e(1,1)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1])},e.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1]},e.CatmullRom=function(t,i,n,r,o){var s=o*o,a=o*s;return new e(.5*(2*i.x+(-t.x+n.x)*o+(2*t.x-5*i.x+4*n.x-r.x)*s+(-t.x+3*i.x-3*n.x+r.x)*a),.5*(2*i.y+(-t.y+n.y)*o+(2*t.y-5*i.y+4*n.y-r.y)*s+(-t.y+3*i.y-3*n.y+r.y)*a))},e.Clamp=function(t,i,n){var r=t.x;r=(r=r>n.x?n.x:r)n.y?n.y:o)i.x?t.x:i.x,t.y>i.y?t.y:i.y)},e.Transform=function(t,i){var n=e.Zero();return e.TransformToRef(t,i,n),n},e.TransformToRef=function(e,t,i){var n=t.m,r=e.x*n[0]+e.y*n[4]+n[12],o=e.x*n[1]+e.y*n[5]+n[13];i.x=r,i.y=o},e.PointInTriangle=function(e,t,i,n){var r=.5*(-i.y*n.x+t.y*(-i.x+n.x)+t.x*(i.y-n.y)+i.x*n.y),o=r<0?-1:1,s=(t.y*n.x-t.x*n.y+(n.y-t.y)*e.x+(t.x-n.x)*e.y)*o,a=(t.x*i.y-t.y*i.x+(t.y-i.y)*e.x+(i.x-t.x)*e.y)*o;return s>0&&a>0&&s+a<2*r*o},e.Distance=function(t,i){return Math.sqrt(e.DistanceSquared(t,i))},e.DistanceSquared=function(e,t){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n},e.Center=function(e,t){var i=e.add(t);return i.scaleInPlace(.5),i},e.DistanceOfPointFromSegment=function(t,i,n){var r=e.DistanceSquared(i,n);if(0===r)return e.Distance(t,i);var o=n.subtract(i),s=Math.max(0,Math.min(1,e.Dot(t.subtract(i),o)/r)),a=i.add(o.multiplyByFloats(s,s));return e.Distance(t,a)},e}(),h=function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this._isDirty=!0,this._x=e,this._y=t,this._z=i}return Object.defineProperty(e.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"z",{get:function(){return this._z},set:function(e){this._z=e,this._isDirty=!0},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return"{X: "+this._x+" Y:"+this._y+" Z:"+this._z+"}"},e.prototype.getClassName=function(){return"Vector3"},e.prototype.getHashCode=function(){var e=0|this._x;return e=397*(e=397*e^(0|this._y))^(0|this._z)},e.prototype.asArray=function(){var e=[];return this.toArray(e,0),e},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,this},e.prototype.fromArray=function(t,i){return void 0===i&&(i=0),e.FromArrayToRef(t,i,this),this},e.prototype.toQuaternion=function(){return u.RotationYawPitchRoll(this._y,this._x,this._z)},e.prototype.addInPlace=function(e){return this.addInPlaceFromFloats(e._x,e._y,e._z)},e.prototype.addInPlaceFromFloats=function(e,t,i){return this.x+=e,this.y+=t,this.z+=i,this},e.prototype.add=function(t){return new e(this._x+t._x,this._y+t._y,this._z+t._z)},e.prototype.addToRef=function(e,t){return t.copyFromFloats(this._x+e._x,this._y+e._y,this._z+e._z)},e.prototype.subtractInPlace=function(e){return this.x-=e._x,this.y-=e._y,this.z-=e._z,this},e.prototype.subtract=function(t){return new e(this._x-t._x,this._y-t._y,this._z-t._z)},e.prototype.subtractToRef=function(e,t){return this.subtractFromFloatsToRef(e._x,e._y,e._z,t)},e.prototype.subtractFromFloats=function(t,i,n){return new e(this._x-t,this._y-i,this._z-n)},e.prototype.subtractFromFloatsToRef=function(e,t,i,n){return n.copyFromFloats(this._x-e,this._y-t,this._z-i)},e.prototype.negate=function(){return new e(-this._x,-this._y,-this._z)},e.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},e.prototype.negateToRef=function(e){return e.copyFromFloats(-1*this._x,-1*this._y,-1*this._z)},e.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this},e.prototype.scale=function(t){return new e(this._x*t,this._y*t,this._z*t)},e.prototype.scaleToRef=function(e,t){return t.copyFromFloats(this._x*e,this._y*e,this._z*e)},e.prototype.scaleAndAddToRef=function(e,t){return t.addInPlaceFromFloats(this._x*e,this._y*e,this._z*e)},e.prototype.projectOnPlane=function(t,i){var n=e.Zero();return this.projectOnPlaneToRef(t,i,n),n},e.prototype.projectOnPlaneToRef=function(t,i,n){var r=t.normal,o=t.d,s=d.Vector3[0];this.subtractToRef(i,s),s.normalize();var a=e.Dot(s,r),l=-(e.Dot(i,r)+o)/a,h=s.scaleInPlace(l);i.addToRef(h,n)},e.prototype.equals=function(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z},e.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=r.kn),e&&n.R.WithinEpsilon(this._x,e._x,t)&&n.R.WithinEpsilon(this._y,e._y,t)&&n.R.WithinEpsilon(this._z,e._z,t)},e.prototype.equalsToFloats=function(e,t,i){return this._x===e&&this._y===t&&this._z===i},e.prototype.multiplyInPlace=function(e){return this.x*=e._x,this.y*=e._y,this.z*=e._z,this},e.prototype.multiply=function(e){return this.multiplyByFloats(e._x,e._y,e._z)},e.prototype.multiplyToRef=function(e,t){return t.copyFromFloats(this._x*e._x,this._y*e._y,this._z*e._z)},e.prototype.multiplyByFloats=function(t,i,n){return new e(this._x*t,this._y*i,this._z*n)},e.prototype.divide=function(t){return new e(this._x/t._x,this._y/t._y,this._z/t._z)},e.prototype.divideToRef=function(e,t){return t.copyFromFloats(this._x/e._x,this._y/e._y,this._z/e._z)},e.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},e.prototype.minimizeInPlace=function(e){return this.minimizeInPlaceFromFloats(e._x,e._y,e._z)},e.prototype.maximizeInPlace=function(e){return this.maximizeInPlaceFromFloats(e._x,e._y,e._z)},e.prototype.minimizeInPlaceFromFloats=function(e,t,i){return ethis._x&&(this.x=e),t>this._y&&(this.y=t),i>this._z&&(this.z=i),this},e.prototype.isNonUniformWithinEpsilon=function(e){var t=Math.abs(this._x),i=Math.abs(this._y);if(!n.R.WithinEpsilon(t,i,e))return!0;var r=Math.abs(this._z);return!n.R.WithinEpsilon(t,r,e)||!n.R.WithinEpsilon(i,r,e)},Object.defineProperty(e.prototype,"isNonUniform",{get:function(){var e=Math.abs(this._x);return e!==Math.abs(this._y)||e!==Math.abs(this._z)},enumerable:!1,configurable:!0}),e.prototype.floor=function(){return new e(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))},e.prototype.fract=function(){return new e(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))},e.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z)},e.prototype.lengthSquared=function(){return this._x*this._x+this._y*this._y+this._z*this._z},e.prototype.normalize=function(){return this.normalizeFromLength(this.length())},e.prototype.reorderInPlace=function(e){var t=this;return"xyz"===(e=e.toLowerCase())||(d.Vector3[0].copyFrom(this),["x","y","z"].forEach((function(i,n){t[i]=d.Vector3[0][e[n]]}))),this},e.prototype.rotateByQuaternionToRef=function(t,i){return t.toRotationMatrix(d.Matrix[0]),e.TransformCoordinatesToRef(this,d.Matrix[0],i),i},e.prototype.rotateByQuaternionAroundPointToRef=function(e,t,i){return this.subtractToRef(t,d.Vector3[0]),d.Vector3[0].rotateByQuaternionToRef(e,d.Vector3[0]),t.addToRef(d.Vector3[0],i),i},e.prototype.cross=function(t){return e.Cross(this,t)},e.prototype.normalizeFromLength=function(e){return 0===e||1===e?this:this.scaleInPlace(1/e)},e.prototype.normalizeToNew=function(){var t=new e(0,0,0);return this.normalizeToRef(t),t},e.prototype.normalizeToRef=function(e){var t=this.length();return 0===t||1===t?e.copyFromFloats(this._x,this._y,this._z):this.scaleToRef(1/t,e)},e.prototype.clone=function(){return new e(this._x,this._y,this._z)},e.prototype.copyFrom=function(e){return this.copyFromFloats(e._x,e._y,e._z)},e.prototype.copyFromFloats=function(e,t,i){return this.x=e,this.y=t,this.z=i,this},e.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},e.prototype.setAll=function(e){return this.x=this.y=this.z=e,this},e.GetClipFactor=function(t,i,n,r){var o=e.Dot(t,n)-r;return o/(o-(e.Dot(i,n)-r))},e.GetAngleBetweenVectors=function(t,i,n){var r=t.normalizeToRef(d.Vector3[1]),o=i.normalizeToRef(d.Vector3[2]),s=e.Dot(r,o),a=d.Vector3[3];return e.CrossToRef(r,o,a),e.Dot(a,n)>0?Math.acos(s):-Math.acos(s)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1],t[i+2])},e.FromFloatArray=function(t,i){return e.FromArray(t,i)},e.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2]},e.FromFloatArrayToRef=function(t,i,n){return e.FromArrayToRef(t,i,n)},e.FromFloatsToRef=function(e,t,i,n){n.copyFromFloats(e,t,i)},e.Zero=function(){return new e(0,0,0)},e.One=function(){return new e(1,1,1)},e.Up=function(){return new e(0,1,0)},Object.defineProperty(e,"UpReadOnly",{get:function(){return e._UpReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ZeroReadOnly",{get:function(){return e._ZeroReadOnly},enumerable:!1,configurable:!0}),e.Down=function(){return new e(0,-1,0)},e.Forward=function(t){return void 0===t&&(t=!1),new e(0,0,t?-1:1)},e.Backward=function(t){return void 0===t&&(t=!1),new e(0,0,t?1:-1)},e.Right=function(){return new e(1,0,0)},e.Left=function(){return new e(-1,0,0)},e.TransformCoordinates=function(t,i){var n=e.Zero();return e.TransformCoordinatesToRef(t,i,n),n},e.TransformCoordinatesToRef=function(t,i,n){e.TransformCoordinatesFromFloatsToRef(t._x,t._y,t._z,i,n)},e.TransformCoordinatesFromFloatsToRef=function(e,t,i,n,r){var o=n.m,s=e*o[0]+t*o[4]+i*o[8]+o[12],a=e*o[1]+t*o[5]+i*o[9]+o[13],l=e*o[2]+t*o[6]+i*o[10]+o[14],h=1/(e*o[3]+t*o[7]+i*o[11]+o[15]);r.x=s*h,r.y=a*h,r.z=l*h},e.TransformNormal=function(t,i){var n=e.Zero();return e.TransformNormalToRef(t,i,n),n},e.TransformNormalToRef=function(e,t,i){this.TransformNormalFromFloatsToRef(e._x,e._y,e._z,t,i)},e.TransformNormalFromFloatsToRef=function(e,t,i,n,r){var o=n.m;r.x=e*o[0]+t*o[4]+i*o[8],r.y=e*o[1]+t*o[5]+i*o[9],r.z=e*o[2]+t*o[6]+i*o[10]},e.CatmullRom=function(t,i,n,r,o){var s=o*o,a=o*s;return new e(.5*(2*i._x+(-t._x+n._x)*o+(2*t._x-5*i._x+4*n._x-r._x)*s+(-t._x+3*i._x-3*n._x+r._x)*a),.5*(2*i._y+(-t._y+n._y)*o+(2*t._y-5*i._y+4*n._y-r._y)*s+(-t._y+3*i._y-3*n._y+r._y)*a),.5*(2*i._z+(-t._z+n._z)*o+(2*t._z-5*i._z+4*n._z-r._z)*s+(-t._z+3*i._z-3*n._z+r._z)*a))},e.Clamp=function(t,i,n){var r=new e;return e.ClampToRef(t,i,n,r),r},e.ClampToRef=function(e,t,i,n){var r=e._x;r=(r=r>i._x?i._x:r)i._y?i._y:o)i._z?i._z:s)this.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),e.z>this.z&&(this.z=e.z),e.w>this.w&&(this.w=e.w),this},e.prototype.floor=function(){return new e(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w))},e.prototype.fract=function(){return new e(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z),this.w-Math.floor(this.w))},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.prototype.normalize=function(){var e=this.length();return 0===e?this:this.scaleInPlace(1/e)},e.prototype.toVector3=function(){return new h(this.x,this.y,this.z)},e.prototype.clone=function(){return new e(this.x,this.y,this.z,this.w)},e.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},e.prototype.copyFromFloats=function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},e.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},e.prototype.setAll=function(e){return this.x=this.y=this.z=this.w=e,this},e.FromArray=function(t,i){return i||(i=0),new e(t[i],t[i+1],t[i+2],t[i+3])},e.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3]},e.FromFloatArrayToRef=function(t,i,n){e.FromArrayToRef(t,i,n)},e.FromFloatsToRef=function(e,t,i,n,r){r.x=e,r.y=t,r.z=i,r.w=n},e.Zero=function(){return new e(0,0,0,0)},e.One=function(){return new e(1,1,1,1)},e.Normalize=function(t){var i=e.Zero();return e.NormalizeToRef(t,i),i},e.NormalizeToRef=function(e,t){t.copyFrom(e),t.normalize()},e.Minimize=function(e,t){var i=e.clone();return i.minimizeInPlace(t),i},e.Maximize=function(e,t){var i=e.clone();return i.maximizeInPlace(t),i},e.Distance=function(t,i){return Math.sqrt(e.DistanceSquared(t,i))},e.DistanceSquared=function(e,t){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,o=e.w-t.w;return i*i+n*n+r*r+o*o},e.Center=function(e,t){var i=e.add(t);return i.scaleInPlace(.5),i},e.TransformNormal=function(t,i){var n=e.Zero();return e.TransformNormalToRef(t,i,n),n},e.TransformNormalToRef=function(e,t,i){var n=t.m,r=e.x*n[0]+e.y*n[4]+e.z*n[8],o=e.x*n[1]+e.y*n[5]+e.z*n[9],s=e.x*n[2]+e.y*n[6]+e.z*n[10];i.x=r,i.y=o,i.z=s,i.w=e.w},e.TransformNormalFromFloatsToRef=function(e,t,i,n,r,o){var s=r.m;o.x=e*s[0]+t*s[4]+i*s[8],o.y=e*s[1]+t*s[5]+i*s[9],o.z=e*s[2]+t*s[6]+i*s[10],o.w=n},e.FromVector3=function(t,i){return void 0===i&&(i=0),new e(t._x,t._y,t._z,i)},e}(),u=function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),this._isDirty=!0,this._x=e,this._y=t,this._z=i,this._w=n}return Object.defineProperty(e.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"z",{get:function(){return this._z},set:function(e){this._z=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"w",{get:function(){return this._w},set:function(e){this._w=e,this._isDirty=!0},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return"{X: "+this._x+" Y:"+this._y+" Z:"+this._z+" W:"+this._w+"}"},e.prototype.getClassName=function(){return"Quaternion"},e.prototype.getHashCode=function(){var e=0|this._x;return e=397*(e=397*(e=397*e^(0|this._y))^(0|this._z))^(0|this._w)},e.prototype.asArray=function(){return[this._x,this._y,this._z,this._w]},e.prototype.equals=function(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z&&this._w===e._w},e.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=r.kn),e&&n.R.WithinEpsilon(this._x,e._x,t)&&n.R.WithinEpsilon(this._y,e._y,t)&&n.R.WithinEpsilon(this._z,e._z,t)&&n.R.WithinEpsilon(this._w,e._w,t)},e.prototype.clone=function(){return new e(this._x,this._y,this._z,this._w)},e.prototype.copyFrom=function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this.w=e._w,this},e.prototype.copyFromFloats=function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},e.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},e.prototype.add=function(t){return new e(this._x+t._x,this._y+t._y,this._z+t._z,this._w+t._w)},e.prototype.addInPlace=function(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._w+=e._w,this},e.prototype.subtract=function(t){return new e(this._x-t._x,this._y-t._y,this._z-t._z,this._w-t._w)},e.prototype.scale=function(t){return new e(this._x*t,this._y*t,this._z*t,this._w*t)},e.prototype.scaleToRef=function(e,t){return t.x=this._x*e,t.y=this._y*e,t.z=this._z*e,t.w=this._w*e,this},e.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.x+=this._x*e,t.y+=this._y*e,t.z+=this._z*e,t.w+=this._w*e,this},e.prototype.multiply=function(t){var i=new e(0,0,0,1);return this.multiplyToRef(t,i),i},e.prototype.multiplyToRef=function(e,t){var i=this._x*e._w+this._y*e._z-this._z*e._y+this._w*e._x,n=-this._x*e._z+this._y*e._w+this._z*e._x+this._w*e._y,r=this._x*e._y-this._y*e._x+this._z*e._w+this._w*e._z,o=-this._x*e._x-this._y*e._y-this._z*e._z+this._w*e._w;return t.copyFromFloats(i,n,r,o),this},e.prototype.multiplyInPlace=function(e){return this.multiplyToRef(e,this),this},e.prototype.conjugateToRef=function(e){return e.copyFromFloats(-this._x,-this._y,-this._z,this._w),this},e.prototype.conjugateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},e.prototype.conjugate=function(){return new e(-this._x,-this._y,-this._z,this._w)},e.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},e.prototype.normalize=function(){var e=this.length();if(0===e)return this;var t=1/e;return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.prototype.toEulerAngles=function(e){void 0===e&&(e="YZX");var t=h.Zero();return this.toEulerAnglesToRef(t),t},e.prototype.toEulerAnglesToRef=function(e){var t=this._z,i=this._x,n=this._y,r=this._w,o=r*r,s=t*t,a=i*i,l=n*n,h=n*t-i*r,c=.4999999;return h<-c?(e.y=2*Math.atan2(n,r),e.x=Math.PI/2,e.z=0):h>c?(e.y=2*Math.atan2(n,r),e.x=-Math.PI/2,e.z=0):(e.z=Math.atan2(2*(i*n+t*r),-s-a+l+o),e.x=Math.asin(-2*(t*n-i*r)),e.y=Math.atan2(2*(t*i+n*r),s-a-l+o)),this},e.prototype.toRotationMatrix=function(e){return f.FromQuaternionToRef(this,e),this},e.prototype.fromRotationMatrix=function(t){return e.FromRotationMatrixToRef(t,this),this},e.FromRotationMatrix=function(t){var i=new e;return e.FromRotationMatrixToRef(t,i),i},e.FromRotationMatrixToRef=function(e,t){var i,n=e.m,r=n[0],o=n[4],s=n[8],a=n[1],l=n[5],h=n[9],c=n[2],u=n[6],f=n[10],d=r+l+f;d>0?(i=.5/Math.sqrt(d+1),t.w=.25/i,t.x=(u-h)*i,t.y=(s-c)*i,t.z=(a-o)*i):r>l&&r>f?(i=2*Math.sqrt(1+r-l-f),t.w=(u-h)/i,t.x=.25*i,t.y=(o+a)/i,t.z=(s+c)/i):l>f?(i=2*Math.sqrt(1+l-r-f),t.w=(s-c)/i,t.x=(o+a)/i,t.y=.25*i,t.z=(h+u)/i):(i=2*Math.sqrt(1+f-r-l),t.w=(a-o)/i,t.x=(s+c)/i,t.y=(h+u)/i,t.z=.25*i)},e.Dot=function(e,t){return e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w},e.AreClose=function(t,i){return e.Dot(t,i)>=0},e.Zero=function(){return new e(0,0,0,0)},e.Inverse=function(t){return new e(-t._x,-t._y,-t._z,t._w)},e.InverseToRef=function(e,t){return t.set(-e._x,-e._y,-e._z,e._w),t},e.Identity=function(){return new e(0,0,0,1)},e.IsIdentity=function(e){return e&&0===e._x&&0===e._y&&0===e._z&&1===e._w},e.RotationAxis=function(t,i){return e.RotationAxisToRef(t,i,new e)},e.RotationAxisToRef=function(e,t,i){var n=Math.sin(t/2);return e.normalize(),i.w=Math.cos(t/2),i.x=e._x*n,i.y=e._y*n,i.z=e._z*n,i},e.FromArray=function(t,i){return i||(i=0),new e(t[i],t[i+1],t[i+2],t[i+3])},e.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3]},e.FromEulerAngles=function(t,i,n){var r=new e;return e.RotationYawPitchRollToRef(i,t,n,r),r},e.FromEulerAnglesToRef=function(t,i,n,r){return e.RotationYawPitchRollToRef(i,t,n,r),r},e.FromEulerVector=function(t){var i=new e;return e.RotationYawPitchRollToRef(t._y,t._x,t._z,i),i},e.FromEulerVectorToRef=function(t,i){return e.RotationYawPitchRollToRef(t._y,t._x,t._z,i),i},e.RotationYawPitchRoll=function(t,i,n){var r=new e;return e.RotationYawPitchRollToRef(t,i,n,r),r},e.RotationYawPitchRollToRef=function(e,t,i,n){var r=.5*i,o=.5*t,s=.5*e,a=Math.sin(r),l=Math.cos(r),h=Math.sin(o),c=Math.cos(o),u=Math.sin(s),f=Math.cos(s);n.x=f*h*l+u*c*a,n.y=u*c*l-f*h*a,n.z=f*c*a-u*h*l,n.w=f*c*l+u*h*a},e.RotationAlphaBetaGamma=function(t,i,n){var r=new e;return e.RotationAlphaBetaGammaToRef(t,i,n,r),r},e.RotationAlphaBetaGammaToRef=function(e,t,i,n){var r=.5*(i+e),o=.5*(i-e),s=.5*t;n.x=Math.cos(o)*Math.sin(s),n.y=Math.sin(o)*Math.sin(s),n.z=Math.sin(r)*Math.cos(s),n.w=Math.cos(r)*Math.cos(s)},e.RotationQuaternionFromAxis=function(t,i,n){var r=new e(0,0,0,0);return e.RotationQuaternionFromAxisToRef(t,i,n,r),r},e.RotationQuaternionFromAxisToRef=function(t,i,n,r){var o=d.Matrix[0];f.FromXYZAxesToRef(t.normalize(),i.normalize(),n.normalize(),o),e.FromRotationMatrixToRef(o,r)},e.Slerp=function(t,i,n){var r=e.Identity();return e.SlerpToRef(t,i,n,r),r},e.SlerpToRef=function(e,t,i,n){var r,o,s=e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w,a=!1;if(s<0&&(a=!0,s=-s),s>.999999)o=1-i,r=a?-i:i;else{var l=Math.acos(s),h=1/Math.sin(l);o=Math.sin((1-i)*l)*h,r=a?-Math.sin(i*l)*h:Math.sin(i*l)*h}n.x=o*e._x+r*t._x,n.y=o*e._y+r*t._y,n.z=o*e._z+r*t._z,n.w=o*e._w+r*t._w},e.Hermite=function(t,i,n,r,o){var s=o*o,a=o*s,l=2*a-3*s+1,h=-2*a+3*s,c=a-2*s+o,u=a-s;return new e(t._x*l+n._x*h+i._x*c+r._x*u,t._y*l+n._y*h+i._y*c+r._y*u,t._z*l+n._z*h+i._z*c+r._z*u,t._w*l+n._w*h+i._w*c+r._w*u)},e}(),f=function(){function e(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,a.Z.MatrixTrackPrecisionChange&&a.Z.MatrixTrackedMatrices.push(this),this._m=new a.Z.MatrixCurrentType(16),this._updateIdentityStatus(!1)}return Object.defineProperty(e,"Use64Bits",{get:function(){return a.Z.MatrixUse64Bits},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"m",{get:function(){return this._m},enumerable:!1,configurable:!0}),e.prototype._markAsUpdated=function(){this.updateFlag=e._updateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0},e.prototype._updateIdentityStatus=function(t,i,n,r){void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===r&&(r=!0),this.updateFlag=e._updateFlagSeed++,this._isIdentity=t,this._isIdentity3x2=t||n,this._isIdentityDirty=!this._isIdentity&&i,this._isIdentity3x2Dirty=!this._isIdentity3x2&&r},e.prototype.isIdentity=function(){if(this._isIdentityDirty){this._isIdentityDirty=!1;var e=this._m;this._isIdentity=1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]}return this._isIdentity},e.prototype.isIdentityAs3x2=function(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,1!==this._m[0]||1!==this._m[5]||1!==this._m[15]||0!==this._m[1]||0!==this._m[2]||0!==this._m[3]||0!==this._m[4]||0!==this._m[6]||0!==this._m[7]||0!==this._m[8]||0!==this._m[9]||0!==this._m[10]||0!==this._m[11]||0!==this._m[12]||0!==this._m[13]||0!==this._m[14]?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2},e.prototype.determinant=function(){if(!0===this._isIdentity)return 1;var e=this._m,t=e[0],i=e[1],n=e[2],r=e[3],o=e[4],s=e[5],a=e[6],l=e[7],h=e[8],c=e[9],u=e[10],f=e[11],d=e[12],p=e[13],_=e[14],g=e[15],m=u*g-_*f,v=c*g-p*f,y=c*_-p*u,b=h*g-d*f,T=h*_-u*d,A=h*p-d*c;return t*+(s*m-a*v+l*y)+i*-(o*m-a*b+l*T)+n*+(o*v-s*b+l*A)+r*-(o*y-s*T+a*A)},e.prototype.toArray=function(){return this._m},e.prototype.asArray=function(){return this._m},e.prototype.invert=function(){return this.invertToRef(this),this},e.prototype.reset=function(){return e.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this},e.prototype.add=function(t){var i=new e;return this.addToRef(t,i),i},e.prototype.addToRef=function(e,t){for(var i=this._m,n=t._m,r=e.m,o=0;o<16;o++)n[o]=i[o]+r[o];return t._markAsUpdated(),this},e.prototype.addToSelf=function(e){for(var t=this._m,i=e.m,n=0;n<16;n++)t[n]+=i[n];return this._markAsUpdated(),this},e.prototype.invertToRef=function(t){if(!0===this._isIdentity)return e.IdentityToRef(t),this;var i=this._m,n=i[0],r=i[1],o=i[2],s=i[3],a=i[4],l=i[5],h=i[6],c=i[7],u=i[8],f=i[9],d=i[10],p=i[11],_=i[12],g=i[13],m=i[14],v=i[15],y=d*v-m*p,b=f*v-g*p,T=f*m-g*d,A=u*v-_*p,E=u*m-d*_,C=u*g-_*f,x=+(l*y-h*b+c*T),S=-(a*y-h*A+c*E),R=+(a*b-l*A+c*C),M=-(a*T-l*E+h*C),P=n*x+r*S+o*R+s*M;if(0===P)return t.copyFrom(this),this;var I=1/P,O=h*v-m*c,D=l*v-g*c,L=l*m-g*h,w=a*v-_*c,N=a*m-_*h,F=a*g-_*l,B=h*p-d*c,U=l*p-f*c,k=l*d-f*h,V=a*p-u*c,G=a*d-u*h,H=a*f-u*l,z=-(r*y-o*b+s*T),W=+(n*y-o*A+s*E),X=-(n*b-r*A+s*C),j=+(n*T-r*E+o*C),Y=+(r*O-o*D+s*L),K=-(n*O-o*w+s*N),q=+(n*D-r*w+s*F),Z=-(n*L-r*N+o*F),Q=-(r*B-o*U+s*k),J=+(n*B-o*V+s*G),$=-(n*U-r*V+s*H),ee=+(n*k-r*G+o*H);return e.FromValuesToRef(x*I,z*I,Y*I,Q*I,S*I,W*I,K*I,J*I,R*I,X*I,q*I,$*I,M*I,j*I,Z*I,ee*I,t),this},e.prototype.addAtIndex=function(e,t){return this._m[e]+=t,this._markAsUpdated(),this},e.prototype.multiplyAtIndex=function(e,t){return this._m[e]*=t,this._markAsUpdated(),this},e.prototype.setTranslationFromFloats=function(e,t,i){return this._m[12]=e,this._m[13]=t,this._m[14]=i,this._markAsUpdated(),this},e.prototype.addTranslationFromFloats=function(e,t,i){return this._m[12]+=e,this._m[13]+=t,this._m[14]+=i,this._markAsUpdated(),this},e.prototype.setTranslation=function(e){return this.setTranslationFromFloats(e._x,e._y,e._z)},e.prototype.getTranslation=function(){return new h(this._m[12],this._m[13],this._m[14])},e.prototype.getTranslationToRef=function(e){return e.x=this._m[12],e.y=this._m[13],e.z=this._m[14],this},e.prototype.removeRotationAndScaling=function(){var t=this.m;return e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t[12],t[13],t[14],t[15],this),this._updateIdentityStatus(0===t[12]&&0===t[13]&&0===t[14]&&1===t[15]),this},e.prototype.multiply=function(t){var i=new e;return this.multiplyToRef(t,i),i},e.prototype.copyFrom=function(e){e.copyToArray(this._m);var t=e;return this._updateIdentityStatus(t._isIdentity,t._isIdentityDirty,t._isIdentity3x2,t._isIdentity3x2Dirty),this},e.prototype.copyToArray=function(e,t){void 0===t&&(t=0);var i=this._m;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],this},e.prototype.multiplyToRef=function(e,t){return this._isIdentity?(t.copyFrom(e),this):e._isIdentity?(t.copyFrom(this),this):(this.multiplyToArray(e,t._m,0),t._markAsUpdated(),this)},e.prototype.multiplyToArray=function(e,t,i){var n=this._m,r=e.m,o=n[0],s=n[1],a=n[2],l=n[3],h=n[4],c=n[5],u=n[6],f=n[7],d=n[8],p=n[9],_=n[10],g=n[11],m=n[12],v=n[13],y=n[14],b=n[15],T=r[0],A=r[1],E=r[2],C=r[3],x=r[4],S=r[5],R=r[6],M=r[7],P=r[8],I=r[9],O=r[10],D=r[11],L=r[12],w=r[13],N=r[14],F=r[15];return t[i]=o*T+s*x+a*P+l*L,t[i+1]=o*A+s*S+a*I+l*w,t[i+2]=o*E+s*R+a*O+l*N,t[i+3]=o*C+s*M+a*D+l*F,t[i+4]=h*T+c*x+u*P+f*L,t[i+5]=h*A+c*S+u*I+f*w,t[i+6]=h*E+c*R+u*O+f*N,t[i+7]=h*C+c*M+u*D+f*F,t[i+8]=d*T+p*x+_*P+g*L,t[i+9]=d*A+p*S+_*I+g*w,t[i+10]=d*E+p*R+_*O+g*N,t[i+11]=d*C+p*M+_*D+g*F,t[i+12]=m*T+v*x+y*P+b*L,t[i+13]=m*A+v*S+y*I+b*w,t[i+14]=m*E+v*R+y*O+b*N,t[i+15]=m*C+v*M+y*D+b*F,this},e.prototype.equals=function(e){var t=e;if(!t)return!1;if((this._isIdentity||t._isIdentity)&&!this._isIdentityDirty&&!t._isIdentityDirty)return this._isIdentity&&t._isIdentity;var i=this.m,n=t.m;return i[0]===n[0]&&i[1]===n[1]&&i[2]===n[2]&&i[3]===n[3]&&i[4]===n[4]&&i[5]===n[5]&&i[6]===n[6]&&i[7]===n[7]&&i[8]===n[8]&&i[9]===n[9]&&i[10]===n[10]&&i[11]===n[11]&&i[12]===n[12]&&i[13]===n[13]&&i[14]===n[14]&&i[15]===n[15]},e.prototype.clone=function(){var t=new e;return t.copyFrom(this),t},e.prototype.getClassName=function(){return"Matrix"},e.prototype.getHashCode=function(){for(var e=0|this._m[0],t=1;t<16;t++)e=397*e^(0|this._m[t]);return e},e.prototype.decompose=function(t,i,n){if(this._isIdentity)return n&&n.setAll(0),t&&t.setAll(1),i&&i.copyFromFloats(0,0,0,1),!0;var r=this._m;if(n&&n.copyFromFloats(r[12],r[13],r[14]),(t=t||d.Vector3[0]).x=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]),t.y=Math.sqrt(r[4]*r[4]+r[5]*r[5]+r[6]*r[6]),t.z=Math.sqrt(r[8]*r[8]+r[9]*r[9]+r[10]*r[10]),this.determinant()<=0&&(t.y*=-1),0===t._x||0===t._y||0===t._z)return i&&i.copyFromFloats(0,0,0,1),!1;if(i){var o=1/t._x,s=1/t._y,a=1/t._z;e.FromValuesToRef(r[0]*o,r[1]*o,r[2]*o,0,r[4]*s,r[5]*s,r[6]*s,0,r[8]*a,r[9]*a,r[10]*a,0,0,0,0,1,d.Matrix[0]),u.FromRotationMatrixToRef(d.Matrix[0],i)}return!0},e.prototype.getRow=function(e){if(e<0||e>3)return null;var t=4*e;return new c(this._m[t+0],this._m[t+1],this._m[t+2],this._m[t+3])},e.prototype.setRow=function(e,t){return this.setRowFromFloats(e,t.x,t.y,t.z,t.w)},e.prototype.transpose=function(){return e.Transpose(this)},e.prototype.transposeToRef=function(t){return e.TransposeToRef(this,t),this},e.prototype.setRowFromFloats=function(e,t,i,n,r){if(e<0||e>3)return this;var o=4*e;return this._m[o+0]=t,this._m[o+1]=i,this._m[o+2]=n,this._m[o+3]=r,this._markAsUpdated(),this},e.prototype.scale=function(t){var i=new e;return this.scaleToRef(t,i),i},e.prototype.scaleToRef=function(e,t){for(var i=0;i<16;i++)t._m[i]=this._m[i]*e;return t._markAsUpdated(),this},e.prototype.scaleAndAddToRef=function(e,t){for(var i=0;i<16;i++)t._m[i]+=this._m[i]*e;return t._markAsUpdated(),this},e.prototype.toNormalMatrix=function(t){var i=d.Matrix[0];this.invertToRef(i),i.transposeToRef(t);var n=t._m;e.FromValuesToRef(n[0],n[1],n[2],0,n[4],n[5],n[6],0,n[8],n[9],n[10],0,0,0,0,1,t)},e.prototype.getRotationMatrix=function(){var t=new e;return this.getRotationMatrixToRef(t),t},e.prototype.getRotationMatrixToRef=function(t){var i=d.Vector3[0];if(!this.decompose(i))return e.IdentityToRef(t),this;var n=this._m,r=1/i._x,o=1/i._y,s=1/i._z;return e.FromValuesToRef(n[0]*r,n[1]*r,n[2]*r,0,n[4]*o,n[5]*o,n[6]*o,0,n[8]*s,n[9]*s,n[10]*s,0,0,0,0,1,t),this},e.prototype.toggleModelMatrixHandInPlace=function(){var e=this._m;e[2]*=-1,e[6]*=-1,e[8]*=-1,e[9]*=-1,e[14]*=-1,this._markAsUpdated()},e.prototype.toggleProjectionMatrixHandInPlace=function(){var e=this._m;e[8]*=-1,e[9]*=-1,e[10]*=-1,e[11]*=-1,this._markAsUpdated()},e.FromArray=function(t,i){void 0===i&&(i=0);var n=new e;return e.FromArrayToRef(t,i,n),n},e.FromArrayToRef=function(e,t,i){for(var n=0;n<16;n++)i._m[n]=e[n+t];i._markAsUpdated()},e.FromFloat32ArrayToRefScaled=function(e,t,i,n){for(var r=0;r<16;r++)n._m[r]=e[r+t]*i;n._markAsUpdated()},Object.defineProperty(e,"IdentityReadOnly",{get:function(){return e._identityReadOnly},enumerable:!1,configurable:!0}),e.FromValuesToRef=function(e,t,i,n,r,o,s,a,l,h,c,u,f,d,p,_,g){var m=g._m;m[0]=e,m[1]=t,m[2]=i,m[3]=n,m[4]=r,m[5]=o,m[6]=s,m[7]=a,m[8]=l,m[9]=h,m[10]=c,m[11]=u,m[12]=f,m[13]=d,m[14]=p,m[15]=_,g._markAsUpdated()},e.FromValues=function(t,i,n,r,o,s,a,l,h,c,u,f,d,p,_,g){var m=new e,v=m._m;return v[0]=t,v[1]=i,v[2]=n,v[3]=r,v[4]=o,v[5]=s,v[6]=a,v[7]=l,v[8]=h,v[9]=c,v[10]=u,v[11]=f,v[12]=d,v[13]=p,v[14]=_,v[15]=g,m._markAsUpdated(),m},e.Compose=function(t,i,n){var r=new e;return e.ComposeToRef(t,i,n,r),r},e.ComposeToRef=function(e,t,i,n){var r=n._m,o=t._x,s=t._y,a=t._z,l=t._w,h=o+o,c=s+s,u=a+a,f=o*h,d=o*c,p=o*u,_=s*c,g=s*u,m=a*u,v=l*h,y=l*c,b=l*u,T=e._x,A=e._y,E=e._z;r[0]=(1-(_+m))*T,r[1]=(d+b)*T,r[2]=(p-y)*T,r[3]=0,r[4]=(d-b)*A,r[5]=(1-(f+m))*A,r[6]=(g+v)*A,r[7]=0,r[8]=(p+y)*E,r[9]=(g-v)*E,r[10]=(1-(f+_))*E,r[11]=0,r[12]=i._x,r[13]=i._y,r[14]=i._z,r[15]=1,n._markAsUpdated()},e.Identity=function(){var t=e.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return t._updateIdentityStatus(!0),t},e.IdentityToRef=function(t){e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(!0)},e.Zero=function(){var t=e.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return t._updateIdentityStatus(!1),t},e.RotationX=function(t){var i=new e;return e.RotationXToRef(t,i),i},e.Invert=function(t){var i=new e;return t.invertToRef(i),i},e.RotationXToRef=function(t,i){var n=Math.sin(t),r=Math.cos(t);e.FromValuesToRef(1,0,0,0,0,r,n,0,0,-n,r,0,0,0,0,1,i),i._updateIdentityStatus(1===r&&0===n)},e.RotationY=function(t){var i=new e;return e.RotationYToRef(t,i),i},e.RotationYToRef=function(t,i){var n=Math.sin(t),r=Math.cos(t);e.FromValuesToRef(r,0,-n,0,0,1,0,0,n,0,r,0,0,0,0,1,i),i._updateIdentityStatus(1===r&&0===n)},e.RotationZ=function(t){var i=new e;return e.RotationZToRef(t,i),i},e.RotationZToRef=function(t,i){var n=Math.sin(t),r=Math.cos(t);e.FromValuesToRef(r,n,0,0,-n,r,0,0,0,0,1,0,0,0,0,1,i),i._updateIdentityStatus(1===r&&0===n)},e.RotationAxis=function(t,i){var n=new e;return e.RotationAxisToRef(t,i,n),n},e.RotationAxisToRef=function(e,t,i){var n=Math.sin(-t),r=Math.cos(-t),o=1-r;e.normalize();var s=i._m;s[0]=e._x*e._x*o+r,s[1]=e._x*e._y*o-e._z*n,s[2]=e._x*e._z*o+e._y*n,s[3]=0,s[4]=e._y*e._x*o+e._z*n,s[5]=e._y*e._y*o+r,s[6]=e._y*e._z*o-e._x*n,s[7]=0,s[8]=e._z*e._x*o-e._y*n,s[9]=e._z*e._y*o+e._x*n,s[10]=e._z*e._z*o+r,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,i._markAsUpdated()},e.RotationAlignToRef=function(e,t,i){var n=h.Cross(t,e),r=h.Dot(t,e),o=1/(1+r),s=i._m;s[0]=n._x*n._x*o+r,s[1]=n._y*n._x*o-n._z,s[2]=n._z*n._x*o+n._y,s[3]=0,s[4]=n._x*n._y*o+n._z,s[5]=n._y*n._y*o+r,s[6]=n._z*n._y*o-n._x,s[7]=0,s[8]=n._x*n._z*o-n._y,s[9]=n._y*n._z*o+n._x,s[10]=n._z*n._z*o+r,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,i._markAsUpdated()},e.RotationYawPitchRoll=function(t,i,n){var r=new e;return e.RotationYawPitchRollToRef(t,i,n,r),r},e.RotationYawPitchRollToRef=function(e,t,i,n){u.RotationYawPitchRollToRef(e,t,i,d.Quaternion[0]),d.Quaternion[0].toRotationMatrix(n)},e.Scaling=function(t,i,n){var r=new e;return e.ScalingToRef(t,i,n,r),r},e.ScalingToRef=function(t,i,n,r){e.FromValuesToRef(t,0,0,0,0,i,0,0,0,0,n,0,0,0,0,1,r),r._updateIdentityStatus(1===t&&1===i&&1===n)},e.Translation=function(t,i,n){var r=new e;return e.TranslationToRef(t,i,n,r),r},e.TranslationToRef=function(t,i,n,r){e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t,i,n,1,r),r._updateIdentityStatus(0===t&&0===i&&0===n)},e.Lerp=function(t,i,n){var r=new e;return e.LerpToRef(t,i,n,r),r},e.LerpToRef=function(e,t,i,n){for(var r=n._m,o=e.m,s=t.m,a=0;a<16;a++)r[a]=o[a]*(1-i)+s[a]*i;n._markAsUpdated()},e.DecomposeLerp=function(t,i,n){var r=new e;return e.DecomposeLerpToRef(t,i,n,r),r},e.DecomposeLerpToRef=function(t,i,n,r){var o=d.Vector3[0],s=d.Quaternion[0],a=d.Vector3[1];t.decompose(o,s,a);var l=d.Vector3[2],c=d.Quaternion[1],f=d.Vector3[3];i.decompose(l,c,f);var p=d.Vector3[4];h.LerpToRef(o,l,n,p);var _=d.Quaternion[2];u.SlerpToRef(s,c,n,_);var g=d.Vector3[5];h.LerpToRef(a,f,n,g),e.ComposeToRef(p,_,g,r)},e.LookAtLH=function(t,i,n){var r=new e;return e.LookAtLHToRef(t,i,n,r),r},e.LookAtLHToRef=function(t,i,n,r){var o=d.Vector3[0],s=d.Vector3[1],a=d.Vector3[2];i.subtractToRef(t,a),a.normalize(),h.CrossToRef(n,a,o);var l=o.lengthSquared();0===l?o.x=1:o.normalizeFromLength(Math.sqrt(l)),h.CrossToRef(a,o,s),s.normalize();var c=-h.Dot(o,t),u=-h.Dot(s,t),f=-h.Dot(a,t);e.FromValuesToRef(o._x,s._x,a._x,0,o._y,s._y,a._y,0,o._z,s._z,a._z,0,c,u,f,1,r)},e.LookAtRH=function(t,i,n){var r=new e;return e.LookAtRHToRef(t,i,n,r),r},e.LookAtRHToRef=function(t,i,n,r){var o=d.Vector3[0],s=d.Vector3[1],a=d.Vector3[2];t.subtractToRef(i,a),a.normalize(),h.CrossToRef(n,a,o);var l=o.lengthSquared();0===l?o.x=1:o.normalizeFromLength(Math.sqrt(l)),h.CrossToRef(a,o,s),s.normalize();var c=-h.Dot(o,t),u=-h.Dot(s,t),f=-h.Dot(a,t);e.FromValuesToRef(o._x,s._x,a._x,0,o._y,s._y,a._y,0,o._z,s._z,a._z,0,c,u,f,1,r)},e.OrthoLH=function(t,i,n,r){var o=new e;return e.OrthoLHToRef(t,i,n,r,o),o},e.OrthoLHToRef=function(t,i,n,r,o){var s=2/t,a=2/i,l=2/(r-n),h=-(r+n)/(r-n);e.FromValuesToRef(s,0,0,0,0,a,0,0,0,0,l,0,0,0,h,1,o),o._updateIdentityStatus(1===s&&1===a&&1===l&&0===h)},e.OrthoOffCenterLH=function(t,i,n,r,o,s){var a=new e;return e.OrthoOffCenterLHToRef(t,i,n,r,o,s,a),a},e.OrthoOffCenterLHToRef=function(t,i,n,r,o,s,a){var l=2/(i-t),h=2/(r-n),c=2/(s-o),u=-(s+o)/(s-o),f=(t+i)/(t-i),d=(r+n)/(n-r);e.FromValuesToRef(l,0,0,0,0,h,0,0,0,0,c,0,f,d,u,1,a),a._markAsUpdated()},e.OrthoOffCenterRH=function(t,i,n,r,o,s){var a=new e;return e.OrthoOffCenterRHToRef(t,i,n,r,o,s,a),a},e.OrthoOffCenterRHToRef=function(t,i,n,r,o,s,a){e.OrthoOffCenterLHToRef(t,i,n,r,o,s,a),a._m[10]*=-1},e.PerspectiveLH=function(t,i,n,r){var o=new e,s=2*n/t,a=2*n/i,l=(r+n)/(r-n),h=-2*r*n/(r-n);return e.FromValuesToRef(s,0,0,0,0,a,0,0,0,0,l,1,0,0,h,0,o),o._updateIdentityStatus(!1),o},e.PerspectiveFovLH=function(t,i,n,r){var o=new e;return e.PerspectiveFovLHToRef(t,i,n,r,o),o},e.PerspectiveFovLHToRef=function(t,i,n,r,o,s){void 0===s&&(s=!0);var a=n,l=r,h=1/Math.tan(.5*t),c=s?h/i:h,u=s?h:h*i,f=(l+a)/(l-a),d=-2*l*a/(l-a);e.FromValuesToRef(c,0,0,0,0,u,0,0,0,0,f,1,0,0,d,0,o),o._updateIdentityStatus(!1)},e.PerspectiveFovReverseLHToRef=function(t,i,n,r,o,s){void 0===s&&(s=!0);var a=1/Math.tan(.5*t),l=s?a/i:a,h=s?a:a*i;e.FromValuesToRef(l,0,0,0,0,h,0,0,0,0,-n,1,0,0,1,0,o),o._updateIdentityStatus(!1)},e.PerspectiveFovRH=function(t,i,n,r){var o=new e;return e.PerspectiveFovRHToRef(t,i,n,r,o),o},e.PerspectiveFovRHToRef=function(t,i,n,r,o,s){void 0===s&&(s=!0);var a=n,l=r,h=1/Math.tan(.5*t),c=s?h/i:h,u=s?h:h*i,f=-(l+a)/(l-a),d=-2*l*a/(l-a);e.FromValuesToRef(c,0,0,0,0,u,0,0,0,0,f,-1,0,0,d,0,o),o._updateIdentityStatus(!1)},e.PerspectiveFovReverseRHToRef=function(t,i,n,r,o,s){void 0===s&&(s=!0);var a=1/Math.tan(.5*t),l=s?a/i:a,h=s?a:a*i;e.FromValuesToRef(l,0,0,0,0,h,0,0,0,0,-n,-1,0,0,-1,0,o),o._updateIdentityStatus(!1)},e.PerspectiveFovWebVRToRef=function(e,t,i,n,r){void 0===r&&(r=!1);var o=r?-1:1,s=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),l=Math.tan(e.leftDegrees*Math.PI/180),h=Math.tan(e.rightDegrees*Math.PI/180),c=2/(l+h),u=2/(s+a),f=n._m;f[0]=c,f[1]=f[2]=f[3]=f[4]=0,f[5]=u,f[6]=f[7]=0,f[8]=(l-h)*c*.5,f[9]=-(s-a)*u*.5,f[10]=-i/(t-i),f[11]=1*o,f[12]=f[13]=f[15]=0,f[14]=-2*i*t/(i-t),n._markAsUpdated()},e.GetFinalMatrix=function(t,i,n,r,o,s){var a=t.width,l=t.height,h=t.x,c=t.y,u=e.FromValues(a/2,0,0,0,0,-l/2,0,0,0,0,s-o,0,h+a/2,l/2+c,o,1),f=d.Matrix[0];return i.multiplyToRef(n,f),f.multiplyToRef(r,f),f.multiply(u)},e.GetAsMatrix2x2=function(e){var t=e.m,i=[t[0],t[1],t[4],t[5]];return a.Z.MatrixUse64Bits?i:new Float32Array(i)},e.GetAsMatrix3x3=function(e){var t=e.m,i=[t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10]];return a.Z.MatrixUse64Bits?i:new Float32Array(i)},e.Transpose=function(t){var i=new e;return e.TransposeToRef(t,i),i},e.TransposeToRef=function(e,t){var i=t._m,n=e.m;i[0]=n[0],i[1]=n[4],i[2]=n[8],i[3]=n[12],i[4]=n[1],i[5]=n[5],i[6]=n[9],i[7]=n[13],i[8]=n[2],i[9]=n[6],i[10]=n[10],i[11]=n[14],i[12]=n[3],i[13]=n[7],i[14]=n[11],i[15]=n[15],t._updateIdentityStatus(e._isIdentity,e._isIdentityDirty)},e.Reflection=function(t){var i=new e;return e.ReflectionToRef(t,i),i},e.ReflectionToRef=function(t,i){t.normalize();var n=t.normal.x,r=t.normal.y,o=t.normal.z,s=-2*n,a=-2*r,l=-2*o;e.FromValuesToRef(s*n+1,a*n,l*n,0,s*r,a*r+1,l*r,0,s*o,a*o,l*o+1,0,s*t.d,a*t.d,l*t.d,1,i)},e.FromXYZAxesToRef=function(t,i,n,r){e.FromValuesToRef(t._x,t._y,t._z,0,i._x,i._y,i._z,0,n._x,n._y,n._z,0,0,0,0,1,r)},e.FromQuaternionToRef=function(e,t){var i=e._x*e._x,n=e._y*e._y,r=e._z*e._z,o=e._x*e._y,s=e._z*e._w,a=e._z*e._x,l=e._y*e._w,h=e._y*e._z,c=e._x*e._w;t._m[0]=1-2*(n+r),t._m[1]=2*(o+s),t._m[2]=2*(a-l),t._m[3]=0,t._m[4]=2*(o-s),t._m[5]=1-2*(r+i),t._m[6]=2*(h+c),t._m[7]=0,t._m[8]=2*(a+l),t._m[9]=2*(h-c),t._m[10]=1-2*(n+i),t._m[11]=0,t._m[12]=0,t._m[13]=0,t._m[14]=0,t._m[15]=1,t._markAsUpdated()},e._updateFlagSeed=0,e._identityReadOnly=e.Identity(),e}(),d=function(){function e(){}return e.Vector3=o.B.BuildArray(6,h.Zero),e.Matrix=o.B.BuildArray(2,f.Identity),e.Quaternion=o.B.BuildArray(3,u.Zero),e}(),p=function(){function e(){}return e.Vector2=o.B.BuildArray(3,l.Zero),e.Vector3=o.B.BuildArray(13,h.Zero),e.Vector4=o.B.BuildArray(3,c.Zero),e.Quaternion=o.B.BuildArray(2,u.Zero),e.Matrix=o.B.BuildArray(8,f.Identity),e}();s.Q.RegisteredTypes["BABYLON.Vector2"]=l,s.Q.RegisteredTypes["BABYLON.Vector3"]=h,s.Q.RegisteredTypes["BABYLON.Vector4"]=c,s.Q.RegisteredTypes["BABYLON.Matrix"]=f},4272:(e,t,i)=>{"use strict";i.d(t,{l:()=>n});var n=function(){function e(e,t,i,n){this.x=e,this.y=t,this.width=i,this.height=n}return e.prototype.toGlobal=function(t,i){return new e(this.x*t,this.y*i,this.width*t,this.height*i)},e.prototype.toGlobalToRef=function(e,t,i){return i.x=this.x*e,i.y=this.y*t,i.width=this.width*e,i.height=this.height*t,this},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e}()},4960:(e,t,i)=>{"use strict";i.r(t),i.d(t,{BoxBuilder:()=>a});var n=i(2973),r=i(8362),o=i(6212),s=i(128);s.VertexData.CreateBox=function(e){var t,i=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23],o=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0],a=[],l=e.width||e.size||1,h=e.height||e.size||1,c=e.depth||e.size||1,u=e.wrap||!1,f=void 0===e.topBaseAt?1:e.topBaseAt,d=void 0===e.bottomBaseAt?0:e.bottomBaseAt,p=[2,0,3,1][f=(f+4)%4],_=[2,0,1,3][d=(d+4)%4],g=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1];if(u){i=[2,3,0,2,0,1,4,5,6,4,6,7,9,10,11,9,11,8,12,14,15,12,13,14],g=[-1,1,1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1];for(var m=[[1,1,1],[-1,1,1],[-1,1,-1],[1,1,-1]],v=[[-1,-1,1],[1,-1,1],[1,-1,-1],[-1,-1,-1]],y=[17,18,19,16],b=[22,23,20,21];p>0;)m.unshift(m.pop()),y.unshift(y.pop()),p--;for(;_>0;)v.unshift(v.pop()),b.unshift(b.pop()),_--;m=m.flat(),v=v.flat(),g=g.concat(m).concat(v),i.push(y[0],y[2],y[3],y[0],y[1],y[2]),i.push(b[0],b[2],b[3],b[0],b[1],b[2])}var T=[l/2,h/2,c/2];t=g.reduce((function(e,t,i){return e.concat(t*T[i%3])}),[]);for(var A=0===e.sideOrientation?0:e.sideOrientation||s.VertexData.DEFAULTSIDE,E=e.faceUV||new Array(6),C=e.faceColors,x=[],S=0;S<6;S++)void 0===E[S]&&(E[S]=new n.Lt(0,0,1,1)),C&&void 0===C[S]&&(C[S]=new r.HE(1,1,1,1));for(var R=0;R<6;R++)if(a.push(E[R].z,E[R].w),a.push(E[R].x,E[R].w),a.push(E[R].x,E[R].y),a.push(E[R].z,E[R].y),C)for(var M=0;M<4;M++)x.push(C[R].r,C[R].g,C[R].b,C[R].a);s.VertexData._ComputeSides(A,t,i,o,a,e.frontUVs,e.backUVs);var P=new s.VertexData;if(P.indices=i,P.positions=t,P.normals=o,P.uvs=a,C){var I=A===s.VertexData.DOUBLESIDE?x.concat(x):x;P.colors=I}return P},o.Mesh.CreateBox=function(e,t,i,n,r){void 0===i&&(i=null);var o={size:t,sideOrientation:r,updatable:n};return a.CreateBox(e,o,i)};var a=function(){function e(){}return e.CreateBox=function(e,t,i){void 0===i&&(i=null);var n=new o.Mesh(e,i);return t.sideOrientation=o.Mesh._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,s.VertexData.CreateBox(t).applyToMesh(n,t.updatable),n},e}()},3521:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CylinderBuilder:()=>h});var n=i(2973),r=i(8362),o=i(6212),s=i(128),a=i(4391),l=i(9068);s.VertexData.CreateCylinder=function(e){var t=e.height||2,i=0===e.diameterTop?0:e.diameterTop||e.diameter||1,a=0===e.diameterBottom?0:e.diameterBottom||e.diameter||1;i=i||1e-5,a=a||1e-5;var h,c=e.tessellation||24,u=e.subdivisions||1,f=!!e.hasRings,d=!!e.enclose,p=0===e.cap?0:e.cap||o.Mesh.CAP_ALL,_=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,g=0===e.sideOrientation?0:e.sideOrientation||s.VertexData.DEFAULTSIDE,m=e.faceUV||new Array(3),v=e.faceColors,y=2+(1+(1!==_&&d?2:0))*(f?u:1);for(h=0;h{"use strict";i.r(t),i.d(t,{LinesBuilder:()=>C});var n=i(2973),r=i(6212),o=i(128),s=i(655),a=i(8362),l=i(6738),h=i(3734),c=i(5385),u=i(789),f=i(5511),d=i(2520),p=i(5540);r.Mesh._instancedMeshFactory=function(e,t){var i=new _(e,t);if(t.instancedBuffers)for(var n in i.instancedBuffers={},t.instancedBuffers)i.instancedBuffers[n]=t.instancedBuffers[n];return i};var _=function(e){function t(t,i){var n=e.call(this,t,i.getScene())||this;n._indexInSourceMeshInstanceArray=-1,i.addInstance(n),n._sourceMesh=i,n._unIndexed=i._unIndexed,n.position.copyFrom(i.position),n.rotation.copyFrom(i.rotation),n.scaling.copyFrom(i.scaling),i.rotationQuaternion&&(n.rotationQuaternion=i.rotationQuaternion.clone()),n.animations=p.w1.Slice(i.animations);for(var r=0,o=i.getAnimationRanges();r0!=this._getWorldMatrixDeterminant()>0)return this._internalAbstractMeshDataInfo._actAsRegularMesh=!0,!0;if(this._internalAbstractMeshDataInfo._actAsRegularMesh=!1,this._currentLOD._registerInstanceForRenderId(this,e),t){if(!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate=!0,!0}else if(!this._currentLOD._internalAbstractMeshDataInfo._isActive)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances=!0,!0}return!1},t.prototype._postActivate=function(){this._sourceMesh.edgesShareWithInstances&&this._sourceMesh._edgesRenderer&&this._sourceMesh._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup?(this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer),this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix())):this._edgesRenderer&&this._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup&&this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer)},t.prototype.getWorldMatrix=function(){if(this._currentLOD&&this._currentLOD.billboardMode!==f.TransformNode.BILLBOARDMODE_NONE&&this._currentLOD._masterMesh!==this){var t=this._currentLOD._masterMesh;return this._currentLOD._masterMesh=this,n.jp.Vector3[7].copyFrom(this._currentLOD.position),this._currentLOD.position.set(0,0,0),n.jp.Matrix[0].copyFrom(this._currentLOD.computeWorldMatrix(!0)),this._currentLOD.position.copyFrom(n.jp.Vector3[7]),this._currentLOD._masterMesh=t,n.jp.Matrix[0]}return e.prototype.getWorldMatrix.call(this)},Object.defineProperty(t.prototype,"isAnInstance",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.getLOD=function(e){if(!e)return this;var t=this.getBoundingInfo();return this._currentLOD=this.sourceMesh.getLOD(e,t.boundingSphere),this._currentLOD===this.sourceMesh?this.sourceMesh:this._currentLOD},t.prototype._preActivateForIntermediateRendering=function(e){return this.sourceMesh._preActivateForIntermediateRendering(e)},t.prototype._syncSubMeshes=function(){if(this.releaseSubMeshes(),this._sourceMesh.subMeshes)for(var e=0;e\nvoid main(void) {\n#include\n#ifdef VERTEXCOLOR\ngl_FragColor=vColor;\n#else\ngl_FragColor=color;\n#endif\n}");y.Q.ShadersStore.colorPixelShader=b;i(3600),i(8738),i(3191),i(6838),i(9686),i(6403);var T="\nattribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n\n#include\nuniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\n\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\nvoid main(void) {\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#include\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n}";y.Q.ShadersStore.colorVertexShader=T;var A=function(e){function t(t,i,n,r,o,s,h){void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null);var c=e.call(this,t,i,n,r,o)||this;c.useVertexColor=s,c.useVertexAlpha=h,c.color=new a.Wo(1,1,1),c.alpha=1,r&&(c.color=r.color.clone(),c.alpha=r.alpha,c.useVertexColor=r.useVertexColor,c.useVertexAlpha=r.useVertexAlpha),c.intersectionThreshold=.1;var u={attributes:[l.o.PositionKind,"world0","world1","world2","world3"],uniforms:["vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","world","viewProjection"],needAlphaBlending:!0,defines:[]};return!1===h&&(u.needAlphaBlending=!1),s?(u.defines.push("#define VERTEXCOLOR"),u.attributes.push(l.o.ColorKind)):(u.uniforms.push("color"),c.color4=new a.HE),c._colorShader=new m.j("colorShader",c.getScene(),"color",u),c}return(0,s.ZT)(t,e),t.prototype._addClipPlaneDefine=function(e){var t="#define "+e;-1===this._colorShader.options.defines.indexOf(t)&&this._colorShader.options.defines.push(t)},t.prototype._removeClipPlaneDefine=function(e){var t="#define "+e,i=this._colorShader.options.defines.indexOf(t);-1!==i&&this._colorShader.options.defines.splice(i,1)},t.prototype.isReady=function(){var t=this.getScene();return t.clipPlane?this._addClipPlaneDefine("CLIPPLANE"):this._removeClipPlaneDefine("CLIPPLANE"),t.clipPlane2?this._addClipPlaneDefine("CLIPPLANE2"):this._removeClipPlaneDefine("CLIPPLANE2"),t.clipPlane3?this._addClipPlaneDefine("CLIPPLANE3"):this._removeClipPlaneDefine("CLIPPLANE3"),t.clipPlane4?this._addClipPlaneDefine("CLIPPLANE4"):this._removeClipPlaneDefine("CLIPPLANE4"),t.clipPlane5?this._addClipPlaneDefine("CLIPPLANE5"):this._removeClipPlaneDefine("CLIPPLANE5"),t.clipPlane6?this._addClipPlaneDefine("CLIPPLANE6"):this._removeClipPlaneDefine("CLIPPLANE6"),!!this._colorShader.isReady(this)&&e.prototype.isReady.call(this)},t.prototype.getClassName=function(){return"LinesMesh"},Object.defineProperty(t.prototype,"material",{get:function(){return this._colorShader},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"checkCollisions",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype._bind=function(e,t,i){if(!this._geometry)return this;var n=this._colorShader.getEffect(),r=this.isUnIndexed?null:this._geometry.getIndexBuffer();if(this._geometry._bind(n,r),!this.useVertexColor){var o=this.color,s=o.r,a=o.g,l=o.b;this.color4.set(s,a,l,this.alpha),this._colorShader.setColor4("color",this.color4)}return v.G.BindClipPlane(n,this.getScene()),this},t.prototype._draw=function(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;var n=this.getScene().getEngine();return this._unIndexed?n.drawArraysType(g.F.LineListDrawMode,e.verticesStart,e.verticesCount,i):n.drawElementsType(g.F.LineListDrawMode,e.indexStart,e.indexCount,i),this},t.prototype.dispose=function(t){this._colorShader.dispose(!1,!1,!0),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e,i,n){return void 0===i&&(i=null),new t(e,this.getScene(),i,this,n)},t.prototype.createInstance=function(e){return new E(e,this)},t}(r.Mesh),E=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.intersectionThreshold=i.intersectionThreshold,n}return(0,s.ZT)(t,e),t.prototype.getClassName=function(){return"InstancedLinesMesh"},t}(_);o.VertexData.CreateLineSystem=function(e){for(var t=[],i=[],n=e.lines,r=e.colors,s=[],a=0,l=0;l0&&(t.push(a-1),t.push(a)),a++}var f=new o.VertexData;return f.indices=t,f.positions=i,r&&(f.colors=s),f},o.VertexData.CreateDashedLines=function(e){var t,i,r=e.dashSize||3,s=e.gapSize||1,a=e.dashNb||200,l=e.points,h=new Array,c=new Array,u=n.P.Zero(),f=0,d=0,p=0,_=0,g=0;for(g=0;g{"use strict";i.r(t),i.d(t,{PlaneBuilder:()=>o});var n=i(6212),r=i(128);r.VertexData.CreatePlane=function(e){var t=[],i=[],n=[],o=[],s=e.width||e.size||1,a=e.height||e.size||1,l=0===e.sideOrientation?0:e.sideOrientation||r.VertexData.DEFAULTSIDE,h=s/2,c=a/2;i.push(-h,-c,0),n.push(0,0,-1),o.push(0,0),i.push(h,-c,0),n.push(0,0,-1),o.push(1,0),i.push(h,c,0),n.push(0,0,-1),o.push(1,1),i.push(-h,c,0),n.push(0,0,-1),o.push(0,1),t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),r.VertexData._ComputeSides(l,i,t,n,o,e.frontUVs,e.backUVs);var u=new r.VertexData;return u.indices=t,u.positions=i,u.normals=n,u.uvs=o,u},n.Mesh.CreatePlane=function(e,t,i,n,r){var s={size:t,width:t,height:t,sideOrientation:r,updatable:n};return o.CreatePlane(e,s,i)};var o=function(){function e(){}return e.CreatePlane=function(e,t,i){void 0===i&&(i=null);var o=new n.Mesh(e,i);return t.sideOrientation=n.Mesh._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,r.VertexData.CreatePlane(t).applyToMesh(o,t.updatable),t.sourcePlane&&(o.translate(t.sourcePlane.normal,-t.sourcePlane.d),o.setDirection(t.sourcePlane.normal.scale(-1))),o},e}()},8991:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SphereBuilder:()=>s});var n=i(2973),r=i(6212),o=i(128);o.VertexData.CreateSphere=function(e){for(var t=e.segments||32,i=e.diameterX||e.diameter||1,r=e.diameterY||e.diameter||1,s=e.diameterZ||e.diameter||1,a=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,l=e.slice&&e.slice<=0?1:e.slice||1,h=0===e.sideOrientation?0:e.sideOrientation||o.VertexData.DEFAULTSIDE,c=!!e.dedupTopBottomIndices,u=new n.P(i/2,r/2,s/2),f=2+t,d=2*f,p=[],_=[],g=[],m=[],v=0;v<=f;v++){for(var y=v/f,b=y*Math.PI*l,T=0;T<=d;T++){var A=T/d,E=A*Math.PI*2*a,C=n.y3.RotationZ(-b),x=n.y3.RotationY(E),S=n.P.TransformCoordinates(n.P.Up(),C),R=n.P.TransformCoordinates(S,x),M=R.multiply(u),P=R.divide(u).normalize();_.push(M.x,M.y,M.z),g.push(P.x,P.y,P.z),m.push(A,y)}if(v>0)for(var I=_.length/3,O=I-2*(d+1);O+d+21&&(p.push(O),p.push(O+1),p.push(O+d+1)),(v{"use strict";i.r(t),i.d(t,{TorusBuilder:()=>s});var n=i(2973),r=i(6212),o=i(128);o.VertexData.CreateTorus=function(e){for(var t=[],i=[],r=[],s=[],a=e.diameter||1,l=e.thickness||.5,h=e.tessellation||16,c=0===e.sideOrientation?0:e.sideOrientation||o.VertexData.DEFAULTSIDE,u=h+1,f=0;f<=h;f++)for(var d=f/h,p=f*Math.PI*2/h-Math.PI/2,_=n.y3.Translation(a/2,0,0).multiply(n.y3.RotationY(p)),g=0;g<=h;g++){var m=1-g/h,v=g*Math.PI*2/h+Math.PI,y=Math.cos(v),b=Math.sin(v),T=new n.P(y,b,0),A=T.scale(l/2),E=new n.FM(d,m);A=n.P.TransformCoordinates(A,_),T=n.P.TransformNormal(T,_),i.push(A.x,A.y,A.z),r.push(T.x,T.y,T.z),s.push(E.x,E.y);var C=(f+1)%u,x=(g+1)%u;t.push(f*u+g),t.push(f*u+x),t.push(C*u+g),t.push(f*u+x),t.push(C*u+x),t.push(C*u+g)}o.VertexData._ComputeSides(c,i,t,r,s,e.frontUVs,e.backUVs);var S=new o.VertexData;return S.indices=t,S.positions=i,S.normals=r,S.uvs=s,S},r.Mesh.CreateTorus=function(e,t,i,n,r,o,a){var l={diameter:t,thickness:i,tessellation:n,sideOrientation:a,updatable:o};return s.CreateTorus(e,l,r)};var s=function(){function e(){}return e.CreateTorus=function(e,t,i){var n=new r.Mesh(e,i);return t.sideOrientation=r.Mesh._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,o.VertexData.CreateTorus(t).applyToMesh(n,t.updatable),n},e}()},5146:(e,t,i)=>{"use strict";i.d(t,{M:()=>r});var n=i(655),r=function(e){function t(t){var i=e.call(this)||this;return i._buffer=t,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"underlyingResource",{get:function(){return this._buffer},enumerable:!1,configurable:!0}),t}(function(){function e(){this.references=0,this.capacity=0,this.is32Bits=!1}return Object.defineProperty(e.prototype,"underlyingResource",{get:function(){return null},enumerable:!1,configurable:!0}),e}())},5385:(e,t,i)=>{"use strict";i.d(t,{x:()=>A});var n=i(655),r=i(5540),o=i(475),s=i(2973),a=i(2905),l=i(6738),h=i(128),c=i(5511),u=i(9626),f=i(2520),d=function(){this._checkCollisions=!1,this._collisionMask=-1,this._collisionGroup=-1,this._surroundingMeshes=null,this._collider=null,this._oldPositionForCollisions=new s.P(0,0,0),this._diffPositionForCollisions=new s.P(0,0,0),this._collisionResponse=!0},p=i(106),_=i(5168),g=i(8362),m=i(2782),v=i(9068),y=i(6132),b=function(){this.facetNb=0,this.partitioningSubdivisions=10,this.partitioningBBoxRatio=1.01,this.facetDataEnabled=!1,this.facetParameters={},this.bbSize=s.P.Zero(),this.subDiv={max:1,X:1,Y:1,Z:1},this.facetDepthSort=!1,this.facetDepthSortEnabled=!1},T=function(){this._hasVertexAlpha=!1,this._useVertexColors=!0,this._numBoneInfluencers=4,this._applyFog=!0,this._receiveShadows=!1,this._facetData=new b,this._visibility=1,this._skeleton=null,this._layerMask=268435455,this._computeBonesUsingShaders=!0,this._isActive=!1,this._onlyForInstances=!1,this._isActiveIntermediate=!1,this._onlyForInstancesIntermediate=!1,this._actAsRegularMesh=!1,this._currentLOD=null,this._currentLODIsUpToDate=!1},A=function(e){function t(i,n){void 0===n&&(n=null);var r=e.call(this,i,n,!1)||this;return r._internalAbstractMeshDataInfo=new T,r.cullingStrategy=t.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY,r.onCollideObservable=new o.y$,r.onCollisionPositionChangeObservable=new o.y$,r.onMaterialChangedObservable=new o.y$,r.definedFacingForward=!0,r._occlusionQuery=null,r._renderingGroup=null,r.alphaIndex=Number.MAX_VALUE,r.isVisible=!0,r.isPickable=!0,r.showSubMeshesBoundingBox=!1,r.isBlocker=!1,r.enablePointerMoveEvents=!1,r._renderingGroupId=0,r._material=null,r.outlineColor=g.Wo.Red(),r.outlineWidth=.02,r.overlayColor=g.Wo.Red(),r.overlayAlpha=.5,r.useOctreeForRenderingSelection=!0,r.useOctreeForPicking=!0,r.useOctreeForCollisions=!0,r.alwaysSelectAsActiveMesh=!1,r.doNotSyncBoundingInfo=!1,r.actionManager=null,r._meshCollisionData=new d,r.ellipsoid=new s.P(.5,1,.5),r.ellipsoidOffset=new s.P(0,0,0),r.edgesWidth=1,r.edgesColor=new g.HE(1,0,0,1),r._edgesRenderer=null,r._masterMesh=null,r._boundingInfo=null,r._renderId=0,r._intersectionsInProgress=new Array,r._unIndexed=!1,r._lightSources=new Array,r._waitingData={lods:null,actions:null,freezeWorldMatrix:null},r._bonesTransformMatrices=null,r._transformMatrixTexture=null,r.onRebuildObservable=new o.y$,r._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),t.subtractToRef(r._meshCollisionData._oldPositionForCollisions,r._meshCollisionData._diffPositionForCollisions),r._meshCollisionData._diffPositionForCollisions.length()>a.Engine.CollisionsEpsilon&&r.position.addInPlace(r._meshCollisionData._diffPositionForCollisions),i&&r.onCollideObservable.notifyObservers(i),r.onCollisionPositionChangeObservable.notifyObservers(r.position)},r.getScene().addMesh(r),r._resyncLightSources(),r}return(0,n.ZT)(t,e),Object.defineProperty(t,"BILLBOARDMODE_NONE",{get:function(){return c.TransformNode.BILLBOARDMODE_NONE},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_X",{get:function(){return c.TransformNode.BILLBOARDMODE_X},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_Y",{get:function(){return c.TransformNode.BILLBOARDMODE_Y},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_Z",{get:function(){return c.TransformNode.BILLBOARDMODE_Z},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_ALL",{get:function(){return c.TransformNode.BILLBOARDMODE_ALL},enumerable:!1,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_USE_POSITION",{get:function(){return c.TransformNode.BILLBOARDMODE_USE_POSITION},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"facetNb",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetNb},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"partitioningSubdivisions",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"partitioningBBoxRatio",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mustDepthSortFacets",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSort},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSort=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"facetDepthSortFrom",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isFacetDataEnabled",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled},enumerable:!1,configurable:!0}),t.prototype._updateNonUniformScalingState=function(t){return!!e.prototype._updateNonUniformScalingState.call(this,t)&&(this._markSubMeshesAsMiscDirty(),!0)},Object.defineProperty(t.prototype,"onCollide",{set:function(e){this._meshCollisionData._onCollideObserver&&this.onCollideObservable.remove(this._meshCollisionData._onCollideObserver),this._meshCollisionData._onCollideObserver=this.onCollideObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCollisionPositionChange",{set:function(e){this._meshCollisionData._onCollisionPositionChangeObserver&&this.onCollisionPositionChangeObservable.remove(this._meshCollisionData._onCollisionPositionChangeObserver),this._meshCollisionData._onCollisionPositionChangeObserver=this.onCollisionPositionChangeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"visibility",{get:function(){return this._internalAbstractMeshDataInfo._visibility},set:function(e){this._internalAbstractMeshDataInfo._visibility!==e&&(this._internalAbstractMeshDataInfo._visibility=e,this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderingGroupId",{get:function(){return this._renderingGroupId},set:function(e){this._renderingGroupId=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"material",{get:function(){return this._material},set:function(e){this._material!==e&&(this._material&&this._material.meshMap&&(this._material.meshMap[this.uniqueId]=void 0),this._material=e,e&&e.meshMap&&(e.meshMap[this.uniqueId]=this),this.onMaterialChangedObservable.hasObservers()&&this.onMaterialChangedObservable.notifyObservers(this),this.subMeshes&&this._unBindEffect())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"receiveShadows",{get:function(){return this._internalAbstractMeshDataInfo._receiveShadows},set:function(e){this._internalAbstractMeshDataInfo._receiveShadows!==e&&(this._internalAbstractMeshDataInfo._receiveShadows=e,this._markSubMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasVertexAlpha",{get:function(){return this._internalAbstractMeshDataInfo._hasVertexAlpha},set:function(e){this._internalAbstractMeshDataInfo._hasVertexAlpha!==e&&(this._internalAbstractMeshDataInfo._hasVertexAlpha=e,this._markSubMeshesAsAttributesDirty(),this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useVertexColors",{get:function(){return this._internalAbstractMeshDataInfo._useVertexColors},set:function(e){this._internalAbstractMeshDataInfo._useVertexColors!==e&&(this._internalAbstractMeshDataInfo._useVertexColors=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"computeBonesUsingShaders",{get:function(){return this._internalAbstractMeshDataInfo._computeBonesUsingShaders},set:function(e){this._internalAbstractMeshDataInfo._computeBonesUsingShaders!==e&&(this._internalAbstractMeshDataInfo._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numBoneInfluencers",{get:function(){return this._internalAbstractMeshDataInfo._numBoneInfluencers},set:function(e){this._internalAbstractMeshDataInfo._numBoneInfluencers!==e&&(this._internalAbstractMeshDataInfo._numBoneInfluencers=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"applyFog",{get:function(){return this._internalAbstractMeshDataInfo._applyFog},set:function(e){this._internalAbstractMeshDataInfo._applyFog!==e&&(this._internalAbstractMeshDataInfo._applyFog=e,this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerMask",{get:function(){return this._internalAbstractMeshDataInfo._layerMask},set:function(e){e!==this._internalAbstractMeshDataInfo._layerMask&&(this._internalAbstractMeshDataInfo._layerMask=e,this._resyncLightSources())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"collisionMask",{get:function(){return this._meshCollisionData._collisionMask},set:function(e){this._meshCollisionData._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"collisionResponse",{get:function(){return this._meshCollisionData._collisionResponse},set:function(e){this._meshCollisionData._collisionResponse=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"collisionGroup",{get:function(){return this._meshCollisionData._collisionGroup},set:function(e){this._meshCollisionData._collisionGroup=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"surroundingMeshes",{get:function(){return this._meshCollisionData._surroundingMeshes},set:function(e){this._meshCollisionData._surroundingMeshes=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lightSources",{get:function(){return this._lightSources},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_positions",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skeleton",{get:function(){return this._internalAbstractMeshDataInfo._skeleton},set:function(e){var t=this._internalAbstractMeshDataInfo._skeleton;t&&t.needInitialSkinMatrix&&t._unregisterMeshWithPoseMatrix(this),e&&e.needInitialSkinMatrix&&e._registerMeshWithPoseMatrix(this),this._internalAbstractMeshDataInfo._skeleton=e,this._internalAbstractMeshDataInfo._skeleton||(this._bonesTransformMatrices=null),this._markSubMeshesAsAttributesDirty()},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"AbstractMesh"},t.prototype.toString=function(e){var t="Name: "+this.name+", isInstance: "+("InstancedMesh"!==this.getClassName()?"YES":"NO");t+=", # of submeshes: "+(this.subMeshes?this.subMeshes.length:0);var i=this._internalAbstractMeshDataInfo._skeleton;return i&&(t+=", skeleton: "+i.name),e&&(t+=", billboard mode: "+["NONE","X","Y",null,"Z",null,null,"ALL"][this.billboardMode],t+=", freeze wrld mat: "+(this._isWorldMatrixFrozen||this._waitingData.freezeWorldMatrix?"YES":"NO")),t},t.prototype._getEffectiveParent=function(){return this._masterMesh&&this.billboardMode!==c.TransformNode.BILLBOARDMODE_NONE?this._masterMesh:e.prototype._getEffectiveParent.call(this)},t.prototype._getActionManagerForTrigger=function(e,t){if(void 0===t&&(t=!0),this.actionManager&&(t||this.actionManager.isRecursive)){if(!e)return this.actionManager;if(this.actionManager.hasSpecificTrigger(e))return this.actionManager}return this.parent?this.parent._getActionManagerForTrigger(e,!1):null},t.prototype._rebuild=function(){if(this.onRebuildObservable.notifyObservers(this),this._occlusionQuery&&(this._occlusionQuery=null),this.subMeshes)for(var e=0,t=this.subMeshes;e4,a=o?this.getVerticesData(l.o.MatricesIndicesExtraKind):null,h=o?this.getVerticesData(l.o.MatricesWeightsExtraKind):null;this.skeleton.prepare();for(var c=this.skeleton.getTransformMatrices(this),u=s.jp.Vector3[0],f=s.jp.Matrix[0],d=s.jp.Matrix[1],p=0,_=0;_0&&(s.y3.FromFloat32ArrayToRefScaled(c,Math.floor(16*i[p+g]),m,d),f.addToSelf(d));if(o)for(g=0;g<4;g++)(m=h[p+g])>0&&(s.y3.FromFloat32ArrayToRefScaled(c,Math.floor(16*a[p+g]),m,d),f.addToSelf(d));s.P.TransformCoordinatesFromFloatsToRef(t[_],t[_+1],t[_+2],f,u),u.toArray(t,_),this._positions&&this._positions[_/3].copyFrom(u)}}}return t},t.prototype._updateBoundingInfo=function(){var e=this._effectiveMesh;return this._boundingInfo?this._boundingInfo.update(e.worldMatrixFromCache):this._boundingInfo=new f.j(this.absolutePosition,this.absolutePosition,e.worldMatrixFromCache),this._updateSubMeshesBoundingInfo(e.worldMatrixFromCache),this},t.prototype._updateSubMeshesBoundingInfo=function(e){if(!this.subMeshes)return this;for(var t=this.subMeshes.length,i=0;i1||!n.IsGlobal)&&n.updateBoundingInfo(e)}return this},t.prototype._afterComputeWorldMatrix=function(){this.doNotSyncBoundingInfo||this._updateBoundingInfo()},Object.defineProperty(t.prototype,"_effectiveMesh",{get:function(){return this.skeleton&&this.skeleton.overrideMesh||this},enumerable:!1,configurable:!0}),t.prototype.isInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isInFrustum(e,this.cullingStrategy)},t.prototype.isCompletelyInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isCompletelyInFrustum(e)},t.prototype.intersectsMesh=function(e,t,i){if(void 0===t&&(t=!1),!this._boundingInfo||!e._boundingInfo)return!1;if(this._boundingInfo.intersects(e._boundingInfo,t))return!0;if(i)for(var n=0,r=this.getChildMeshes();n1&&!o._checkCollision(e)||this._collideForSubMesh(o,t,e)}return this},t.prototype._checkCollision=function(e){if(!this._boundingInfo||!this._boundingInfo._checkCollision(e))return this;var t=s.jp.Matrix[0],i=s.jp.Matrix[1];return s.y3.ScalingToRef(1/e._radius.x,1/e._radius.y,1/e._radius.z,t),this.worldMatrixFromCache.multiplyToRef(t,i),this._processCollisionsForSubMeshes(e,i),this},t.prototype._generatePointsArray=function(){return!1},t.prototype.intersects=function(e,t,i,n,r,o){var a;void 0===n&&(n=!1),void 0===o&&(o=!1);var l=new u.p,h="InstancedLinesMesh"===this.getClassName()||"LinesMesh"===this.getClassName()?this.intersectionThreshold:0,c=this._boundingInfo;if(!this.subMeshes||!c)return l;if(!(o||e.intersectsSphere(c.boundingSphere,h)&&e.intersectsBox(c.boundingBox,h)))return l;if(n)return l.hit=!o,l.pickedMesh=o?null:this,l.distance=o?0:s.P.Distance(e.origin,c.boundingSphere.center),l.subMeshId=0,l;if(!this._generatePointsArray())return l;for(var f=null,d=this._scene.getIntersectingSubMeshCandidates(this,e),p=d.length,_=!1,g=0;g1)||v.canIntersects(e)){var y=v.intersects(e,this._positions,this.getIndices(),t,i);if(y&&(t||!f||y.distance65535){o=!0;break}e.depthSortedIndices=o?new Uint32Array(i):new Uint16Array(i)}if(e.facetDepthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},!e.facetDepthSortFrom){var c=this.getScene().activeCamera;e.facetDepthSortFrom=c?c.position:s.P.Zero()}e.depthSortedFacets=[];for(var u=0;um.kn?r.maximum.x-r.minimum.x:m.kn,e.bbSize.y=r.maximum.y-r.minimum.y>m.kn?r.maximum.y-r.minimum.y:m.kn,e.bbSize.z=r.maximum.z-r.minimum.z>m.kn?r.maximum.z-r.minimum.z:m.kn;var d=e.bbSize.x>e.bbSize.y?e.bbSize.x:e.bbSize.y;if(d=d>e.bbSize.z?d:e.bbSize.z,e.subDiv.max=e.partitioningSubdivisions,e.subDiv.X=Math.floor(e.subDiv.max*e.bbSize.x/d),e.subDiv.Y=Math.floor(e.subDiv.max*e.bbSize.y/d),e.subDiv.Z=Math.floor(e.subDiv.max*e.bbSize.z/d),e.subDiv.X=e.subDiv.X<1?1:e.subDiv.X,e.subDiv.Y=e.subDiv.Y<1?1:e.subDiv.Y,e.subDiv.Z=e.subDiv.Z<1?1:e.subDiv.Z,e.facetParameters.facetNormals=this.getFacetLocalNormals(),e.facetParameters.facetPositions=this.getFacetLocalPositions(),e.facetParameters.facetPartitioning=this.getFacetLocalPartitioning(),e.facetParameters.bInfo=r,e.facetParameters.bbSize=e.bbSize,e.facetParameters.subDiv=e.subDiv,e.facetParameters.ratio=this.partitioningBBoxRatio,e.facetParameters.depthSort=e.facetDepthSort,e.facetDepthSort&&e.facetDepthSortEnabled&&(this.computeWorldMatrix(!0),this._worldMatrix.invertToRef(e.invertedMatrix),s.P.TransformCoordinatesToRef(e.facetDepthSortFrom,e.invertedMatrix,e.facetDepthSortOrigin),e.facetParameters.distanceTo=e.facetDepthSortOrigin),e.facetParameters.depthSortedFacets=e.depthSortedFacets,h.VertexData.ComputeNormals(t,i,n,e.facetParameters),e.facetDepthSort&&e.facetDepthSortEnabled){e.depthSortedFacets.sort(e.facetDepthSortFunction);var p=e.depthSortedIndices.length/3|0;for(u=0;ur.subDiv.max||s<0||s>r.subDiv.max||a<0||a>r.subDiv.max?null:r.facetPartitioning[o+r.subDiv.max*s+r.subDiv.max*r.subDiv.max*a]},t.prototype.getClosestFacetAtCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var a=this.getWorldMatrix(),l=s.jp.Matrix[5];a.invertToRef(l);var h=s.jp.Vector3[8];s.P.TransformCoordinatesFromFloatsToRef(e,t,i,l,h);var c=this.getClosestFacetAtLocalCoordinates(h.x,h.y,h.z,n,r,o);return n&&s.P.TransformCoordinatesFromFloatsToRef(n.x,n.y,n.z,a,n),c},t.prototype.getClosestFacetAtLocalCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var s=null,a=0,l=0,h=0,c=0,u=0,f=0,d=0,p=0,_=this.getFacetLocalPositions(),g=this.getFacetLocalNormals(),m=this.getFacetsAtLocalCoordinates(e,t,i);if(!m)return null;for(var v,y,b,T=Number.MAX_VALUE,A=T,E=0;E=0||r&&!o&&c<=0)&&(c=y.x*b.x+y.y*b.y+y.z*b.z,u=-(y.x*e+y.y*t+y.z*i-c)/(y.x*y.x+y.y*y.y+y.z*y.z),(A=(a=(f=e+y.x*u)-e)*a+(l=(d=t+y.y*u)-t)*l+(h=(p=i+y.z*u)-i)*h){"use strict";i.d(t,{l:()=>n,o:()=>r});var n=function(){function e(e,t,i,n,r,o,s,a){void 0===n&&(n=0),void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===s&&(s=!1),this._isAlreadyOwned=!1,e.getScene?this._engine=e.getScene().getEngine():this._engine=e,this._updatable=i,this._instanced=o,this._divisor=a||1,this._data=t,this.byteStride=s?n:n*Float32Array.BYTES_PER_ELEMENT,r||this.create()}return e.prototype.createVertexBuffer=function(e,t,i,n,o,s,a){void 0===s&&(s=!1);var l=s?t:t*Float32Array.BYTES_PER_ELEMENT,h=n?s?n:n*Float32Array.BYTES_PER_ELEMENT:this.byteStride;return new r(this._engine,this,e,this._updatable,!0,h,void 0===o?this._instanced:o,l,i,void 0,void 0,!0,this._divisor||a)},e.prototype.isUpdatable=function(){return this._updatable},e.prototype.getData=function(){return this._data},e.prototype.getBuffer=function(){return this._buffer},e.prototype.getStrideSize=function(){return this.byteStride/Float32Array.BYTES_PER_ELEMENT},e.prototype.create=function(e){void 0===e&&(e=null),!e&&this._buffer||(e=e||this._data)&&(this._buffer?this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e),this._data=e):this._updatable?(this._buffer=this._engine.createDynamicVertexBuffer(e),this._data=e):this._buffer=this._engine.createVertexBuffer(e))},e.prototype._rebuild=function(){this._buffer=null,this.create(this._data)},e.prototype.update=function(e){this.create(e)},e.prototype.updateDirectly=function(e,t,i,n){void 0===n&&(n=!1),this._buffer&&this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e,n?t:t*Float32Array.BYTES_PER_ELEMENT,i?i*this.byteStride:void 0),this._data=null)},e.prototype._increaseReferences=function(){this._buffer&&(this._isAlreadyOwned?this._buffer.references++:this._isAlreadyOwned=!0)},e.prototype.dispose=function(){this._buffer&&this._engine._releaseBuffer(this._buffer)&&(this._buffer=null)},e}(),r=function(){function e(t,i,r,o,s,a,l,h,c,u,f,d,p,_){if(void 0===f&&(f=!1),void 0===d&&(d=!1),void 0===p&&(p=1),void 0===_&&(_=!1),i instanceof n?(this._buffer=i,this._ownsBuffer=_,_&&this._buffer._increaseReferences()):(this._buffer=new n(t,i,o,a,s,l,d),this._ownsBuffer=!0),this._kind=r,null==u){var g=this.getData();this.type=e.FLOAT,g instanceof Int8Array?this.type=e.BYTE:g instanceof Uint8Array?this.type=e.UNSIGNED_BYTE:g instanceof Int16Array?this.type=e.SHORT:g instanceof Uint16Array?this.type=e.UNSIGNED_SHORT:g instanceof Int32Array?this.type=e.INT:g instanceof Uint32Array&&(this.type=e.UNSIGNED_INT)}else this.type=u;var m=e.GetTypeByteLength(this.type);d?(this._size=c||(a?a/m:e.DeduceStride(r)),this.byteStride=a||this._buffer.byteStride||this._size*m,this.byteOffset=h||0):(this._size=c||a||e.DeduceStride(r),this.byteStride=a?a*m:this._buffer.byteStride||this._size*m,this.byteOffset=(h||0)*m),this.normalized=f,this._instanced=void 0!==l&&l,this._instanceDivisor=l?p:0}return Object.defineProperty(e.prototype,"instanceDivisor",{get:function(){return this._instanceDivisor},set:function(e){this._instanceDivisor=e,this._instanced=0!=e},enumerable:!1,configurable:!0}),e.prototype._rebuild=function(){this._buffer&&this._buffer._rebuild()},e.prototype.getKind=function(){return this._kind},e.prototype.isUpdatable=function(){return this._buffer.isUpdatable()},e.prototype.getData=function(){return this._buffer.getData()},e.prototype.getBuffer=function(){return this._buffer.getBuffer()},e.prototype.getStrideSize=function(){return this.byteStride/e.GetTypeByteLength(this.type)},e.prototype.getOffset=function(){return this.byteOffset/e.GetTypeByteLength(this.type)},e.prototype.getSize=function(){return this._size},e.prototype.getIsInstanced=function(){return this._instanced},e.prototype.getInstanceDivisor=function(){return this._instanceDivisor},e.prototype.create=function(e){this._buffer.create(e)},e.prototype.update=function(e){this._buffer.update(e)},e.prototype.updateDirectly=function(e,t,i){void 0===i&&(i=!1),this._buffer.updateDirectly(e,t,void 0,i)},e.prototype.dispose=function(){this._ownsBuffer&&this._buffer.dispose()},e.prototype.forEach=function(t,i){e.ForEach(this._buffer.getData(),this.byteOffset,this.byteStride,this._size,this.type,t,this.normalized,i)},e.DeduceStride=function(t){switch(t){case e.UVKind:case e.UV2Kind:case e.UV3Kind:case e.UV4Kind:case e.UV5Kind:case e.UV6Kind:return 2;case e.NormalKind:case e.PositionKind:return 3;case e.ColorKind:case e.MatricesIndicesKind:case e.MatricesIndicesExtraKind:case e.MatricesWeightsKind:case e.MatricesWeightsExtraKind:case e.TangentKind:return 4;default:throw new Error("Invalid kind '"+t+"'")}},e.GetTypeByteLength=function(t){switch(t){case e.BYTE:case e.UNSIGNED_BYTE:return 1;case e.SHORT:case e.UNSIGNED_SHORT:return 2;case e.INT:case e.UNSIGNED_INT:case e.FLOAT:return 4;default:throw new Error("Invalid type '"+t+"'")}},e.ForEach=function(t,i,n,r,o,s,a,l){if(t instanceof Array)for(var h=i/4,c=n/4,u=0;u{"use strict";i.d(t,{Z:()=>d});var n=i(2973),r=i(8362),o=i(128),s=i(6738),a=i(3335),l=i(9995),h=i(2520),c=i(5540),u=i(4115),f=i(5168),d=function(){function e(e,t,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=null),this.delayLoadState=0,this._totalVertices=0,this._isDisposed=!1,this._indexBufferIsUpdatable=!1,this._positionsCache=[],this.useBoundingInfoFromGeometry=!1,this.id=e,this.uniqueId=t.getUniqueId(),this._engine=t.getEngine(),this._meshes=[],this._scene=t,this._vertexBuffers={},this._indices=[],this._updatable=n,i?this.setAllVerticesData(i,n):(this._totalVertices=0,this._indices=[]),this._engine.getCaps().vertexArrayObject&&(this._vertexArrayObjects={}),r&&(this.applyToMesh(r),r.computeWorldMatrix(!0))}return Object.defineProperty(e.prototype,"boundingBias",{get:function(){return this._boundingBias},set:function(e){this._boundingBias?this._boundingBias.copyFrom(e):this._boundingBias=e.clone(),this._updateBoundingInfo(!0,null)},enumerable:!1,configurable:!0}),e.CreateGeometryForMesh=function(t){var i=new e(e.RandomId(),t.getScene());return i.applyToMesh(t),i},Object.defineProperty(e.prototype,"meshes",{get:function(){return this._meshes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extend",{get:function(){return this._extend},enumerable:!1,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype.getEngine=function(){return this._engine},e.prototype.isReady=function(){return 1===this.delayLoadState||0===this.delayLoadState},Object.defineProperty(e.prototype,"doNotSerialize",{get:function(){for(var e=0;e0&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices)),this._indexBuffer&&(this._indexBuffer.references=t),e._syncGeometryWithMorphTargetManager(),e.synchronizeInstances()},e.prototype.notifyUpdate=function(e){this.onGeometryUpdated&&this.onGeometryUpdated(this,e);for(var t=0,i=this._meshes;t0){for(var t=0;t0){for(t=0;t0){for(t=0;t0){var c=new Float32Array(t,h.positionsAttrDesc.offset,h.positionsAttrDesc.count);i.setVerticesData(s.o.PositionKind,c,!1)}if(h.normalsAttrDesc&&h.normalsAttrDesc.count>0){var u=new Float32Array(t,h.normalsAttrDesc.offset,h.normalsAttrDesc.count);i.setVerticesData(s.o.NormalKind,u,!1)}if(h.tangetsAttrDesc&&h.tangetsAttrDesc.count>0){var f=new Float32Array(t,h.tangetsAttrDesc.offset,h.tangetsAttrDesc.count);i.setVerticesData(s.o.TangentKind,f,!1)}if(h.uvsAttrDesc&&h.uvsAttrDesc.count>0){var d=new Float32Array(t,h.uvsAttrDesc.offset,h.uvsAttrDesc.count);i.setVerticesData(s.o.UVKind,d,!1)}if(h.uvs2AttrDesc&&h.uvs2AttrDesc.count>0){var p=new Float32Array(t,h.uvs2AttrDesc.offset,h.uvs2AttrDesc.count);i.setVerticesData(s.o.UV2Kind,p,!1)}if(h.uvs3AttrDesc&&h.uvs3AttrDesc.count>0){var _=new Float32Array(t,h.uvs3AttrDesc.offset,h.uvs3AttrDesc.count);i.setVerticesData(s.o.UV3Kind,_,!1)}if(h.uvs4AttrDesc&&h.uvs4AttrDesc.count>0){var g=new Float32Array(t,h.uvs4AttrDesc.offset,h.uvs4AttrDesc.count);i.setVerticesData(s.o.UV4Kind,g,!1)}if(h.uvs5AttrDesc&&h.uvs5AttrDesc.count>0){var m=new Float32Array(t,h.uvs5AttrDesc.offset,h.uvs5AttrDesc.count);i.setVerticesData(s.o.UV5Kind,m,!1)}if(h.uvs6AttrDesc&&h.uvs6AttrDesc.count>0){var v=new Float32Array(t,h.uvs6AttrDesc.offset,h.uvs6AttrDesc.count);i.setVerticesData(s.o.UV6Kind,v,!1)}if(h.colorsAttrDesc&&h.colorsAttrDesc.count>0){var y=new Float32Array(t,h.colorsAttrDesc.offset,h.colorsAttrDesc.count);i.setVerticesData(s.o.ColorKind,y,!1,h.colorsAttrDesc.stride)}if(h.matricesIndicesAttrDesc&&h.matricesIndicesAttrDesc.count>0){for(var b=new Int32Array(t,h.matricesIndicesAttrDesc.offset,h.matricesIndicesAttrDesc.count),T=[],A=0;A>8),T.push((16711680&E)>>16),T.push(E>>24&255)}i.setVerticesData(s.o.MatricesIndicesKind,T,!1)}if(h.matricesIndicesExtraAttrDesc&&h.matricesIndicesExtraAttrDesc.count>0){for(b=new Int32Array(t,h.matricesIndicesExtraAttrDesc.offset,h.matricesIndicesExtraAttrDesc.count),T=[],A=0;A>8),T.push((16711680&E)>>16),T.push(E>>24&255)}i.setVerticesData(s.o.MatricesIndicesExtraKind,T,!1)}if(h.matricesWeightsAttrDesc&&h.matricesWeightsAttrDesc.count>0){var C=new Float32Array(t,h.matricesWeightsAttrDesc.offset,h.matricesWeightsAttrDesc.count);i.setVerticesData(s.o.MatricesWeightsKind,C,!1)}if(h.indicesAttrDesc&&h.indicesAttrDesc.count>0){var x=new Int32Array(t,h.indicesAttrDesc.offset,h.indicesAttrDesc.count);i.setIndices(x,null)}if(h.subMeshesAttrDesc&&h.subMeshesAttrDesc.count>0){var S=new Int32Array(t,h.subMeshesAttrDesc.offset,5*h.subMeshesAttrDesc.count);i.subMeshes=[];for(A=0;A>8),T.push((16711680&D)>>16),T.push(D>>24&255)}i.setVerticesData(s.o.MatricesIndicesKind,T,t.matricesIndices._updatable)}if(t.matricesIndicesExtra)if(t.matricesIndicesExtra._isExpanded)delete t.matricesIndices._isExpanded,i.setVerticesData(s.o.MatricesIndicesExtraKind,t.matricesIndicesExtra,t.matricesIndicesExtra._updatable);else{for(T=[],A=0;A>8),T.push((16711680&D)>>16),T.push(D>>24&255)}i.setVerticesData(s.o.MatricesIndicesExtraKind,T,t.matricesIndicesExtra._updatable)}t.matricesWeights&&(e._CleanMatricesWeights(t,i),i.setVerticesData(s.o.MatricesWeightsKind,t.matricesWeights,t.matricesWeights._updatable)),t.matricesWeightsExtra&&i.setVerticesData(s.o.MatricesWeightsExtraKind,t.matricesWeightsExtra,t.matricesWeights._updatable),i.setIndices(t.indices,null)}if(t.subMeshes){i.subMeshes=[];for(var L=0;L-1){var r=t.getScene().getLastSkeletonByID(e.skeletonId);if(r){n=r.bones.length;for(var o=t.getVerticesData(s.o.MatricesIndicesKind),a=t.getVerticesData(s.o.MatricesIndicesExtraKind),h=e.matricesWeights,c=e.matricesWeightsExtra,u=e.numBoneInfluencer,f=h.length,d=0;du-1)&&(_=u-1),p>i){var v=1/p;for(g=0;g<4;g++)h[d+g]*=v;if(c)for(g=0;g<4;g++)c[d+g]*=v}else _>=4?(c[d+_-4]=1-p,a[d+_-4]=n):(h[d+_]=1-p,o[d+_]=n)}t.setVerticesData(s.o.MatricesIndicesKind,o),e.matricesWeightsExtra&&t.setVerticesData(s.o.MatricesIndicesExtraKind,a)}}}},e.Parse=function(t,i,r){if(i.getGeometryByID(t.id))return null;var a=new e(t.id,i,void 0,t.updatable);return u.$&&u.$.AddTagsTo(a,t.tags),t.delayLoadingFile?(a.delayLoadState=4,a.delayLoadingFile=r+t.delayLoadingFile,a._boundingInfo=new h.j(n.P.FromArray(t.boundingBoxMinimum),n.P.FromArray(t.boundingBoxMaximum)),a._delayInfo=[],t.hasUVs&&a._delayInfo.push(s.o.UVKind),t.hasUVs2&&a._delayInfo.push(s.o.UV2Kind),t.hasUVs3&&a._delayInfo.push(s.o.UV3Kind),t.hasUVs4&&a._delayInfo.push(s.o.UV4Kind),t.hasUVs5&&a._delayInfo.push(s.o.UV5Kind),t.hasUVs6&&a._delayInfo.push(s.o.UV6Kind),t.hasColors&&a._delayInfo.push(s.o.ColorKind),t.hasMatricesIndices&&a._delayInfo.push(s.o.MatricesIndicesKind),t.hasMatricesWeights&&a._delayInfo.push(s.o.MatricesWeightsKind),a._delayLoadingFunction=o.VertexData.ImportVertexData):o.VertexData.ImportVertexData(t,a),i.pushGeometry(a,!0),a},e}()},6212:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Mesh:()=>D,_CreationDataStorage:()=>R,_InstancesBatch:()=>P});var n=i(655),r=i(475),o=i(5540),s=i(789),a=i(4115),l=i(2973),h=i(8362),c=i(2686),u=i(6738),f=i(128),d=i(3953),p=i(5385),_=i(3335),g=i(2520),m=i(511),v=i(9541),y=i(9995),b=i(9023),T=i(3734),A=i(6132),E=i(106),C=i(7383),x=function(e,t){this.distance=e,this.mesh=t},S=i(1370),R=function(){},M=function(){this.visibleInstances={},this.batchCache=new P,this.instancesBufferSize=2048},P=function(){this.mustReturn=!1,this.visibleInstances=new Array,this.renderSelf=new Array,this.hardwareInstancedRendering=new Array},I=function(){this.instancesCount=0,this.matrixBuffer=null,this.matrixBufferSize=512,this.boundingVectors=[],this.worldMatrices=null},O=function(){this._areNormalsFrozen=!1,this._source=null,this.meshMap=null,this._preActivateId=-1,this._LODLevels=new Array,this._morphTargetManager=null},D=function(e){function t(i,n,r,o,l,h){void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===h&&(h=!0);var c=e.call(this,i,n)||this;if(c._internalMeshDataInfo=new O,c.delayLoadState=0,c.instances=new Array,c._creationDataStorage=null,c._geometry=null,c._instanceDataStorage=new M,c._thinInstanceDataStorage=new I,c._effectiveMaterial=null,c._shouldGenerateFlatShading=!1,c._originalBuilderSideOrientation=t.DEFAULTSIDE,c.overrideMaterialSideOrientation=null,n=c.getScene(),o){if(o._geometry&&o._geometry.applyToMesh(c),s.j.DeepCopy(o,c,["name","material","skeleton","instances","parent","uniqueId","source","metadata","morphTargetManager","hasInstances","source","worldMatrixInstancedBuffer","hasLODLevels","geometry","isBlocked","areNormalsFrozen","facetNb","isFacetDataEnabled","lightSources","useBones","isAnInstance","collider","edgesRenderer","forward","up","right","absolutePosition","absoluteScaling","absoluteRotationQuaternion","isWorldMatrixFrozen","nonUniformScaling","behaviors","worldMatrixFromCache","hasThinInstances","cloneMeshMap"],["_poseMatrix"]),c._internalMeshDataInfo._source=o,n.useClonedMeshMap&&(o._internalMeshDataInfo.meshMap||(o._internalMeshDataInfo.meshMap={}),o._internalMeshDataInfo.meshMap[c.uniqueId]=c),c._originalBuilderSideOrientation=o._originalBuilderSideOrientation,c._creationDataStorage=o._creationDataStorage,o._ranges){var u=o._ranges;for(var i in u)u.hasOwnProperty(i)&&u[i]&&c.createAnimationRange(i,u[i].from,u[i].to)}var f;if(o.metadata&&o.metadata.clone?c.metadata=o.metadata.clone():c.metadata=o.metadata,a.$&&a.$.HasTags(o)&&a.$.AddTagsTo(c,a.$.GetTags(o,!0)),c.setEnabled(o.isEnabled()),c.parent=o.parent,c.setPivotMatrix(o.getPivotMatrix()),c.id=i+"."+o.id,c.material=o.material,!l)for(var d=o.getDescendants(!0),p=0;p0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasThinInstances",{get:function(){var e;return(null!==(e=this._thinInstanceDataStorage.instancesCount)&&void 0!==e?e:0)>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"morphTargetManager",{get:function(){return this._internalMeshDataInfo._morphTargetManager},set:function(e){this._internalMeshDataInfo._morphTargetManager!==e&&(this._internalMeshDataInfo._morphTargetManager=e,this._syncGeometryWithMorphTargetManager())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"source",{get:function(){return this._internalMeshDataInfo._source},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cloneMeshMap",{get:function(){return this._internalMeshDataInfo.meshMap},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUnIndexed",{get:function(){return this._unIndexed},set:function(e){this._unIndexed!==e&&(this._unIndexed=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldMatrixInstancedBuffer",{get:function(){return this._instanceDataStorage.instancesData},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"manualUpdateOfWorldMatrixInstancedBuffer",{get:function(){return this._instanceDataStorage.manualUpdate},set:function(e){this._instanceDataStorage.manualUpdate=e},enumerable:!1,configurable:!0}),t.prototype.instantiateHierarchy=function(e,t,i){void 0===e&&(e=null);var n=!(this.getTotalVertices()>0)||t&&t.doNotInstantiate?this.clone("Clone of "+(this.name||this.id),e||this.parent,!0):this.createInstance("instance of "+(this.name||this.id));n&&(n.parent=e||this.parent,n.position=this.position.clone(),n.scaling=this.scaling.clone(),this.rotationQuaternion?n.rotationQuaternion=this.rotationQuaternion.clone():n.rotation=this.rotation.clone(),i&&i(this,n));for(var r=0,o=this.getChildTransformNodes(!0);r0},enumerable:!1,configurable:!0}),t.prototype.getLODLevels=function(){return this._internalMeshDataInfo._LODLevels},t.prototype._sortLODLevels=function(){this._internalMeshDataInfo._LODLevels.sort((function(e,t){return e.distancet.distance?-1:0}))},t.prototype.addLODLevel=function(e,t){if(t&&t._masterMesh)return T.Y.Warn("You cannot use a mesh as LOD level twice"),this;var i=new x(e,t);return this._internalMeshDataInfo._LODLevels.push(i),t&&(t._masterMesh=this),this._sortLODLevels(),this},t.prototype.getLODLevelAtDistance=function(e){for(var t=this._internalMeshDataInfo,i=0;ir)return this.onLODLevelSelection&&this.onLODLevelSelection(r,this,this),this;for(var o=0;o0||this.hasThinInstances);this.computeWorldMatrix();var f=this.material||c.defaultMaterial;if(f)if(f._storeEffectOnSubMeshes)for(var d=0,p=this.subMeshes;d0){var i=this.getIndices();if(!i)return null;var n=i.length,r=!1;if(e)r=!0;else for(var o=0,s=this.subMeshes;on){r=!0;break}if(a.verticesStart+a.verticesCount>t){r=!0;break}}if(!r)return this.subMeshes[0]}return this.releaseSubMeshes(),new _.P(0,0,t,0,this.getTotalIndices(),this)},t.prototype.subdivide=function(e){if(!(e<1)){for(var t=this.getTotalIndices(),i=t/e|0,n=0;i%3!=0;)i++;this.releaseSubMeshes();for(var r=0;r=t);r++)_.P.CreateFromIndices(0,n,r===e-1?t-n:i,this),n+=i;this.synchronizeInstances()}},t.prototype.setVerticesData=function(e,t,i,n){if(void 0===i&&(i=!1),this._geometry)this._geometry.setVerticesData(e,t,i,n);else{var r=new f.VertexData;r.set(t,e);var o=this.getScene();new d.Z(d.Z.RandomId(),o,r,i,this)}return this},t.prototype.removeVerticesData=function(e){this._geometry&&this._geometry.removeVerticesData(e)},t.prototype.markVerticesDataAsUpdatable=function(e,t){void 0===t&&(t=!0);var i=this.getVertexBuffer(e);i&&i.isUpdatable()!==t&&this.setVerticesData(e,this.getVerticesData(e),t)},t.prototype.setVerticesBuffer=function(e){return this._geometry||(this._geometry=d.Z.CreateGeometryForMesh(this)),this._geometry.setVerticesBuffer(e),this},t.prototype.updateVerticesData=function(e,t,i,n){return this._geometry?(n?(this.makeGeometryUnique(),this.updateVerticesData(e,t,i,!1)):this._geometry.updateVerticesData(e,t,i),this):this},t.prototype.updateMeshPositions=function(e,t){void 0===t&&(t=!0);var i=this.getVerticesData(u.o.PositionKind);if(!i)return this;if(e(i),this.updateVerticesData(u.o.PositionKind,i,!1,!1),t){var n=this.getIndices(),r=this.getVerticesData(u.o.NormalKind);if(!r)return this;f.VertexData.ComputeNormals(i,n,r),this.updateVerticesData(u.o.NormalKind,r,!1,!1)}return this},t.prototype.makeGeometryUnique=function(){if(!this._geometry)return this;if(1===this._geometry.meshes.length)return this;var e=this._geometry,t=this._geometry.copy(d.Z.RandomId());return e.releaseForMesh(this,!0),t.applyToMesh(this),this},t.prototype.setIndices=function(e,t,i){if(void 0===t&&(t=null),void 0===i&&(i=!1),this._geometry)this._geometry.setIndices(e,t,i);else{var n=new f.VertexData;n.indices=e;var r=this.getScene();new d.Z(d.Z.RandomId(),r,n,i,this)}return this},t.prototype.updateIndices=function(e,t,i){return void 0===i&&(i=!1),this._geometry?(this._geometry.updateIndices(e,t,i),this):this},t.prototype.toLeftHanded=function(){return this._geometry?(this._geometry.toLeftHanded(),this):this},t.prototype._bind=function(e,t,i){if(!this._geometry)return this;var n,r=this.getScene().getEngine();if(this._unIndexed)n=null;else switch(i){case m.F.PointFillMode:n=null;break;case m.F.WireFrameFillMode:n=e._getLinesIndexBuffer(this.getIndices(),r);break;default:case m.F.TriangleFillMode:n=this._geometry.getIndexBuffer()}return this._geometry._bind(t,n),this},t.prototype._draw=function(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this._internalMeshDataInfo._onBeforeDrawObservable&&this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);var n=this.getScene().getEngine();return this._unIndexed||t==m.F.PointFillMode?n.drawArraysType(t,e.verticesStart,e.verticesCount,i):t==m.F.WireFrameFillMode?n.drawElementsType(t,0,e._linesIndexCount,i):n.drawElementsType(t,e.indexStart,e.indexCount,i),this},t.prototype.registerBeforeRender=function(e){return this.onBeforeRenderObservable.add(e),this},t.prototype.unregisterBeforeRender=function(e){return this.onBeforeRenderObservable.removeCallback(e),this},t.prototype.registerAfterRender=function(e){return this.onAfterRenderObservable.add(e),this},t.prototype.unregisterAfterRender=function(e){return this.onAfterRenderObservable.removeCallback(e),this},t.prototype._getInstancesRenderList=function(e,t){if(void 0===t&&(t=!1),this._instanceDataStorage.isFrozen&&this._instanceDataStorage.previousBatch)return this._instanceDataStorage.previousBatch;var i=this.getScene(),n=i._isInIntermediateRendering(),r=n?this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate:this._internalAbstractMeshDataInfo._onlyForInstances,o=this._instanceDataStorage.batchCache;if(o.mustReturn=!1,o.renderSelf[e]=t||!r&&this.isEnabled()&&this.isVisible,o.visibleInstances[e]=null,this._instanceDataStorage.visibleInstances&&!t){var s=this._instanceDataStorage.visibleInstances,a=i.getRenderId(),l=n?s.intermediateDefaultRenderId:s.defaultRenderId;o.visibleInstances[e]=s[a],!o.visibleInstances[e]&&l&&(o.visibleInstances[e]=s[l])}return o.hardwareInstancedRendering[e]=!t&&this._instanceDataStorage.hardwareInstancedRendering&&null!==o.visibleInstances[e]&&void 0!==o.visibleInstances[e],this._instanceDataStorage.previousBatch=o,o},t.prototype._renderWithInstances=function(e,t,i,n,r){var o=i.visibleInstances[e._id];if(!o)return this;for(var s=this._instanceDataStorage,a=s.instancesBufferSize,l=s.instancesBuffer,h=16*(o.length+1)*4;s.instancesBufferSizec&&n++,0!==_&&d++,f+=_,c=_}if(l[d]++,d>o&&(o=d),0===f)r++;else{var g=1/f,m=0;for(p=0;p.001&&s++}}var v=this.skeleton.bones.length,y=this.getVerticesData(u.o.MatricesIndicesKind),b=this.getVerticesData(u.o.MatricesIndicesExtraKind),T=0;for(h=0;h=v||A<0)&&T++}return{skinned:!0,valid:0===r&&0===s&&0===T,report:"Number of Weights = "+i/4+"\nMaximum influences = "+o+"\nMissing Weights = "+r+"\nNot Sorted = "+n+"\nNot Normalized = "+s+"\nWeightCounts = ["+l+"]\nNumber of bones = "+v+"\nBad Bone Indices = "+T}},t.prototype._checkDelayState=function(){var e=this.getScene();return this._geometry?this._geometry.load(e):4===this.delayLoadState&&(this.delayLoadState=2,this._queueLoad(e)),this},t.prototype._queueLoad=function(e){var t=this;e._addPendingData(this);var i=-1!==this.delayLoadingFile.indexOf(".babylonbinarymeshdata");return o.w1.LoadFile(this.delayLoadingFile,(function(i){i instanceof ArrayBuffer?t._delayLoadingFunction(i,t):t._delayLoadingFunction(JSON.parse(i),t),t.instances.forEach((function(e){e.refreshBoundingInfo(),e._syncSubMeshes()})),t.delayLoadState=1,e._removePendingData(t)}),(function(){}),e.offlineProvider,i),this},t.prototype.isInFrustum=function(t){return 2!==this.delayLoadState&&(!!e.prototype.isInFrustum.call(this,t)&&(this._checkDelayState(),!0))},t.prototype.setMaterialByID=function(e){var t,i=this.getScene().materials;for(t=i.length-1;t>-1;t--)if(i[t].id===e)return this.material=i[t],this;var n=this.getScene().multiMaterials;for(t=n.length-1;t>-1;t--)if(n[t].id===e)return this.material=n[t],this;return this},t.prototype.getAnimatables=function(){var e=new Array;return this.material&&e.push(this.material),this.skeleton&&e.push(this.skeleton),e},t.prototype.bakeTransformIntoVertices=function(e){if(!this.isVerticesDataPresent(u.o.PositionKind))return this;var t=this.subMeshes.splice(0);this._resetPointsArrayCache();var i,n=this.getVerticesData(u.o.PositionKind),r=new Array;for(i=0;i1)for(var n=0,r=i.meshes.slice(0);n-1&&(r.morphTargetManager=i.getMorphTargetManagerById(e.morphTargetManagerId)),void 0!==e.skeletonId&&null!==e.skeletonId&&(r.skeleton=i.getLastSkeletonByID(e.skeletonId),e.numBoneInfluencers&&(r.numBoneInfluencers=e.numBoneInfluencers)),e.animations){for(var o=0;o4,f=c?this.getVerticesData(u.o.MatricesIndicesExtraKind):null,d=c?this.getVerticesData(u.o.MatricesWeightsExtraKind):null,p=e.getTransformMatrices(this),_=l.P.Zero(),g=new l.y3,m=new l.y3,v=0,y=0;y0&&(l.y3.FromFloat32ArrayToRefScaled(p,Math.floor(16*s[v+h]),b,m),g.addToSelf(m));if(c)for(h=0;h<4;h++)(b=d[v+h])>0&&(l.y3.FromFloat32ArrayToRefScaled(p,Math.floor(16*f[v+h]),b,m),g.addToSelf(m));l.P.TransformCoordinatesFromFloatsToRef(i._sourcePositions[y],i._sourcePositions[y+1],i._sourcePositions[y+2],g,_),_.toArray(r,y),t&&(l.P.TransformNormalFromFloatsToRef(i._sourceNormals[y],i._sourceNormals[y+1],i._sourceNormals[y+2],g,_),_.toArray(o,y)),g.reset()}return this.updateVerticesData(u.o.PositionKind,r),t&&this.updateVerticesData(u.o.NormalKind,o),this},t.MinMax=function(e){var t=null,i=null;return e.forEach((function(e){var n=e.getBoundingInfo().boundingBox;t&&i?(t.minimizeInPlace(n.minimumWorld),i.maximizeInPlace(n.maximumWorld)):(t=n.minimumWorld,i=n.maximumWorld)})),t&&i?{min:t,max:i}:{min:l.P.Zero(),max:l.P.Zero()}},t.Center=function(e){var i=e instanceof Array?t.MinMax(e):e;return l.P.Center(i.min,i.max)},t.MergeMeshes=function(e,i,n,r,o,s){var a;if(void 0===i&&(i=!0),!n){var l=0;for(a=0;a=65536)return T.Y.Warn("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"),null}if(s){var h,c,u=null;o=!1}var d,p=new Array,g=new Array,m=null,y=new Array,b=null;for(a=0;a{"use strict";i.r(t),i.d(t,{VertexData:()=>l});var n=i(2973),r=i(6738),o=i(106),s=i(8362),a=i(3734),l=function(){function e(){}return e.prototype.set=function(e,t){switch(e.length||a.Y.Warn("Setting vertex data kind '"+t+"' with an empty array"),t){case r.o.PositionKind:this.positions=e;break;case r.o.NormalKind:this.normals=e;break;case r.o.TangentKind:this.tangents=e;break;case r.o.UVKind:this.uvs=e;break;case r.o.UV2Kind:this.uvs2=e;break;case r.o.UV3Kind:this.uvs3=e;break;case r.o.UV4Kind:this.uvs4=e;break;case r.o.UV5Kind:this.uvs5=e;break;case r.o.UV6Kind:this.uvs6=e;break;case r.o.ColorKind:this.colors=e;break;case r.o.MatricesIndicesKind:this.matricesIndices=e;break;case r.o.MatricesWeightsKind:this.matricesWeights=e;break;case r.o.MatricesIndicesExtraKind:this.matricesIndicesExtra=e;break;case r.o.MatricesWeightsExtraKind:this.matricesWeightsExtra=e}},e.prototype.applyToMesh=function(e,t){return this._applyTo(e,t),this},e.prototype.applyToGeometry=function(e,t){return this._applyTo(e,t),this},e.prototype.updateMesh=function(e){return this._update(e),this},e.prototype.updateGeometry=function(e){return this._update(e),this},e.prototype._applyTo=function(e,t){return void 0===t&&(t=!1),this.positions&&e.setVerticesData(r.o.PositionKind,this.positions,t),this.normals&&e.setVerticesData(r.o.NormalKind,this.normals,t),this.tangents&&e.setVerticesData(r.o.TangentKind,this.tangents,t),this.uvs&&e.setVerticesData(r.o.UVKind,this.uvs,t),this.uvs2&&e.setVerticesData(r.o.UV2Kind,this.uvs2,t),this.uvs3&&e.setVerticesData(r.o.UV3Kind,this.uvs3,t),this.uvs4&&e.setVerticesData(r.o.UV4Kind,this.uvs4,t),this.uvs5&&e.setVerticesData(r.o.UV5Kind,this.uvs5,t),this.uvs6&&e.setVerticesData(r.o.UV6Kind,this.uvs6,t),this.colors&&e.setVerticesData(r.o.ColorKind,this.colors,t),this.matricesIndices&&e.setVerticesData(r.o.MatricesIndicesKind,this.matricesIndices,t),this.matricesWeights&&e.setVerticesData(r.o.MatricesWeightsKind,this.matricesWeights,t),this.matricesIndicesExtra&&e.setVerticesData(r.o.MatricesIndicesExtraKind,this.matricesIndicesExtra,t),this.matricesWeightsExtra&&e.setVerticesData(r.o.MatricesWeightsExtraKind,this.matricesWeightsExtra,t),this.indices?e.setIndices(this.indices,null,t):e.setIndices([],null),this},e.prototype._update=function(e,t,i){return this.positions&&e.updateVerticesData(r.o.PositionKind,this.positions,t,i),this.normals&&e.updateVerticesData(r.o.NormalKind,this.normals,t,i),this.tangents&&e.updateVerticesData(r.o.TangentKind,this.tangents,t,i),this.uvs&&e.updateVerticesData(r.o.UVKind,this.uvs,t,i),this.uvs2&&e.updateVerticesData(r.o.UV2Kind,this.uvs2,t,i),this.uvs3&&e.updateVerticesData(r.o.UV3Kind,this.uvs3,t,i),this.uvs4&&e.updateVerticesData(r.o.UV4Kind,this.uvs4,t,i),this.uvs5&&e.updateVerticesData(r.o.UV5Kind,this.uvs5,t,i),this.uvs6&&e.updateVerticesData(r.o.UV6Kind,this.uvs6,t,i),this.colors&&e.updateVerticesData(r.o.ColorKind,this.colors,t,i),this.matricesIndices&&e.updateVerticesData(r.o.MatricesIndicesKind,this.matricesIndices,t,i),this.matricesWeights&&e.updateVerticesData(r.o.MatricesWeightsKind,this.matricesWeights,t,i),this.matricesIndicesExtra&&e.updateVerticesData(r.o.MatricesIndicesExtraKind,this.matricesIndicesExtra,t,i),this.matricesWeightsExtra&&e.updateVerticesData(r.o.MatricesWeightsExtraKind,this.matricesWeightsExtra,t,i),this.indices&&e.setIndices(this.indices,null),this},e.prototype.transform=function(e){var t,i=e.determinant()<0,r=n.P.Zero();if(this.positions){var o=n.P.Zero();for(t=0;tr.bbSize.y?r.bbSize.x:r.bbSize.y;$=$>r.bbSize.z?$:r.bbSize.z,L=r.subDiv.X*I/r.bbSize.x,w=r.subDiv.Y*I/r.bbSize.y,N=r.subDiv.Z*I/r.bbSize.z,F=r.subDiv.max*r.subDiv.max,r.facetPartitioning.length=0}for(o=0;o{"use strict";i.d(t,{P:()=>a});var n=i(6738),r=i(746),o=i(2520),s=i(5168),a=function(){function e(e,t,i,n,r,o,s,a,l){void 0===a&&(a=!0),void 0===l&&(l=!0),this.materialIndex=e,this.verticesStart=t,this.verticesCount=i,this.indexStart=n,this.indexCount=r,this._materialDefines=null,this._materialEffect=null,this._effectOverride=null,this._linesIndexCount=0,this._linesIndexBuffer=null,this._lastColliderWorldVertices=null,this._lastColliderTransformMatrix=null,this._renderId=0,this._alphaIndex=0,this._distanceToCamera=0,this._currentMaterial=null,this._mesh=o,this._renderingMesh=s||o,l&&o.subMeshes.push(this),this._trianglePlanes=[],this._id=o.subMeshes.length-1,a&&(this.refreshBoundingInfo(),o.computeWorldMatrix(!0))}return Object.defineProperty(e.prototype,"materialDefines",{get:function(){return this._materialDefines},set:function(e){this._materialDefines=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"effect",{get:function(){var e;return null!==(e=this._effectOverride)&&void 0!==e?e:this._materialEffect},enumerable:!1,configurable:!0}),e.prototype.setEffect=function(e,t){void 0===t&&(t=null),this._materialEffect!==e?(this._materialDefines=t,this._materialEffect=e):e||(this._materialDefines=null)},e.AddToMesh=function(t,i,n,r,o,s,a,l){return void 0===l&&(l=!0),new e(t,i,n,r,o,s,a,l)},Object.defineProperty(e.prototype,"IsGlobal",{get:function(){return 0===this.verticesStart&&this.verticesCount===this._mesh.getTotalVertices()},enumerable:!1,configurable:!0}),e.prototype.getBoundingInfo=function(){return this.IsGlobal?this._mesh.getBoundingInfo():this._boundingInfo},e.prototype.setBoundingInfo=function(e){return this._boundingInfo=e,this},e.prototype.getMesh=function(){return this._mesh},e.prototype.getRenderingMesh=function(){return this._renderingMesh},e.prototype.getReplacementMesh=function(){return this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null},e.prototype.getEffectiveMesh=function(){var e=this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null;return e||this._renderingMesh},e.prototype.getMaterial=function(){var e=this._renderingMesh.material;if(null==e)return this._mesh.getScene().defaultMaterial;if(this._IsMultiMaterial(e)){var t=e.getSubMaterial(this.materialIndex);return this._currentMaterial!==t&&(this._currentMaterial=t,this._materialDefines=null),t}return e},e.prototype._IsMultiMaterial=function(e){return void 0!==e.getSubMaterial},e.prototype.refreshBoundingInfo=function(e){if(void 0===e&&(e=null),this._lastColliderWorldVertices=null,this.IsGlobal||!this._renderingMesh||!this._renderingMesh.geometry)return this;if(e||(e=this._renderingMesh.getVerticesData(n.o.PositionKind)),!e)return this._boundingInfo=this._mesh.getBoundingInfo(),this;var t,i=this._renderingMesh.getIndices();if(0===this.indexStart&&this.indexCount===i.length){var r=this._renderingMesh.getBoundingInfo();t={minimum:r.minimum.clone(),maximum:r.maximum.clone()}}else t=(0,s.y)(e,i,this.indexStart,this.indexCount,this._renderingMesh.geometry.boundingBias);return this._boundingInfo?this._boundingInfo.reConstruct(t.minimum,t.maximum):this._boundingInfo=new o.j(t.minimum,t.maximum),this},e.prototype._checkCollision=function(e){return this.getBoundingInfo()._checkCollision(e)},e.prototype.updateBoundingInfo=function(e){var t=this.getBoundingInfo();return t||(this.refreshBoundingInfo(),t=this.getBoundingInfo()),t&&t.update(e),this},e.prototype.isInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isInFrustum(e,this._mesh.cullingStrategy)},e.prototype.isCompletelyInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isCompletelyInFrustum(e)},e.prototype.render=function(e){return this._renderingMesh.render(this,e,this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:void 0),this},e.prototype._getLinesIndexBuffer=function(e,t){if(!this._linesIndexBuffer){for(var i=[],n=this.indexStart;na&&(a=c)}return new e(t,s,a-s+1,i,n,r,o)},e}()},3934:(e,t,i)=>{"use strict";i.r(t);var n=i(6212),r=i(6738),o=i(2973);n.Mesh.prototype.thinInstanceAdd=function(e,t){void 0===t&&(t=!0),this._thinInstanceUpdateBufferSize("matrix",Array.isArray(e)?e.length:1);var i=this._thinInstanceDataStorage.instancesCount;if(Array.isArray(e))for(var n=0;n=this._thinInstanceDataStorage.instancesCount)return!1;var n=this._thinInstanceDataStorage.matrixData;return t.copyToArray(n,16*e),this._thinInstanceDataStorage.worldMatrices&&(this._thinInstanceDataStorage.worldMatrices[e]=t),i&&(this.thinInstanceBufferUpdated("matrix"),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)),!0},n.Mesh.prototype.thinInstanceSetAttributeAt=function(e,t,i,n){return void 0===n&&(n=!0),!(!this._userThinInstanceBuffersStorage||!this._userThinInstanceBuffersStorage.data[e]||t>=this._thinInstanceDataStorage.instancesCount)&&(this._thinInstanceUpdateBufferSize(e,0),this._userThinInstanceBuffersStorage.data[e].set(i,t*this._userThinInstanceBuffersStorage.strides[e]),n&&this.thinInstanceBufferUpdated(e),!0)},Object.defineProperty(n.Mesh.prototype,"thinInstanceCount",{get:function(){return this._thinInstanceDataStorage.instancesCount},set:function(e){var t,i;e<=(null!==(i=null===(t=this._thinInstanceDataStorage.matrixData)||void 0===t?void 0:t.length)&&void 0!==i?i:0)/16&&(this._thinInstanceDataStorage.instancesCount=e)},enumerable:!0,configurable:!0}),n.Mesh.prototype.thinInstanceSetBuffer=function(e,t,i,n){var o,s;if(void 0===i&&(i=0),void 0===n&&(n=!1),i=i||16,"matrix"===e)if(null===(o=this._thinInstanceDataStorage.matrixBuffer)||void 0===o||o.dispose(),this._thinInstanceDataStorage.matrixBuffer=null,this._thinInstanceDataStorage.matrixBufferSize=t?t.length:32*i,this._thinInstanceDataStorage.matrixData=t,this._thinInstanceDataStorage.worldMatrices=null,null!==t){this._thinInstanceDataStorage.instancesCount=t.length/i;var a=new r.l(this.getEngine(),t,!n,i,!1,!0);this._thinInstanceDataStorage.matrixBuffer=a,this.setVerticesBuffer(a.createVertexBuffer("world0",0,4)),this.setVerticesBuffer(a.createVertexBuffer("world1",4,4)),this.setVerticesBuffer(a.createVertexBuffer("world2",8,4)),this.setVerticesBuffer(a.createVertexBuffer("world3",12,4)),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)}else this._thinInstanceDataStorage.instancesCount=0,this.doNotSyncBoundingInfo||this.refreshBoundingInfo(!0);else null===t?(null===(s=this._userThinInstanceBuffersStorage)||void 0===s?void 0:s.data[e])&&(this.removeVerticesData(e),delete this._userThinInstanceBuffersStorage.data[e],delete this._userThinInstanceBuffersStorage.strides[e],delete this._userThinInstanceBuffersStorage.sizes[e],delete this._userThinInstanceBuffersStorage.vertexBuffers[e]):(this._thinInstanceInitializeUserStorage(),this._userThinInstanceBuffersStorage.data[e]=t,this._userThinInstanceBuffersStorage.strides[e]=i,this._userThinInstanceBuffersStorage.sizes[e]=t.length,this._userThinInstanceBuffersStorage.vertexBuffers[e]=new r.o(this.getEngine(),t,e,!n,!1,i,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[e]))},n.Mesh.prototype.thinInstanceBufferUpdated=function(e){var t;"matrix"===e?this._thinInstanceDataStorage.matrixBuffer&&this._thinInstanceDataStorage.matrixBuffer.updateDirectly(this._thinInstanceDataStorage.matrixData,0,this._thinInstanceDataStorage.instancesCount):(null===(t=this._userThinInstanceBuffersStorage)||void 0===t?void 0:t.vertexBuffers[e])&&this._userThinInstanceBuffersStorage.vertexBuffers[e].updateDirectly(this._userThinInstanceBuffersStorage.data[e],0)},n.Mesh.prototype.thinInstancePartialBufferUpdate=function(e,t,i){var n;"matrix"===e?this._thinInstanceDataStorage.matrixBuffer&&this._thinInstanceDataStorage.matrixBuffer.updateDirectly(t,i):(null===(n=this._userThinInstanceBuffersStorage)||void 0===n?void 0:n.vertexBuffers[e])&&this._userThinInstanceBuffersStorage.vertexBuffers[e].updateDirectly(t,i)},n.Mesh.prototype.thinInstanceGetWorldMatrices=function(){if(!this._thinInstanceDataStorage.matrixData||!this._thinInstanceDataStorage.matrixBuffer)return[];var e=this._thinInstanceDataStorage.matrixData;if(!this._thinInstanceDataStorage.worldMatrices){this._thinInstanceDataStorage.worldMatrices=new Array;for(var t=0;t{"use strict";i.r(t),i.d(t,{TransformNode:()=>h});var n=i(655),r=i(9023),o=i(475),s=i(2973),a=i(2686),l=i(9068),h=function(e){function t(i,n,r){void 0===n&&(n=null),void 0===r&&(r=!0);var a=e.call(this,i,n)||this;return a._forward=new s.P(0,0,1),a._forwardInverted=new s.P(0,0,-1),a._up=new s.P(0,1,0),a._right=new s.P(1,0,0),a._rightInverted=new s.P(-1,0,0),a._position=s.P.Zero(),a._rotation=s.P.Zero(),a._rotationQuaternion=null,a._scaling=s.P.One(),a._isDirty=!1,a._transformToBoneReferal=null,a._isAbsoluteSynced=!1,a._billboardMode=t.BILLBOARDMODE_NONE,a._preserveParentRotationForBillboard=!1,a.scalingDeterminant=1,a._infiniteDistance=!1,a.ignoreNonUniformScaling=!1,a.reIntegrateRotationIntoRotationQuaternion=!1,a._poseMatrix=null,a._localMatrix=s.y3.Zero(),a._usePivotMatrix=!1,a._absolutePosition=s.P.Zero(),a._absoluteScaling=s.P.Zero(),a._absoluteRotationQuaternion=s._f.Identity(),a._pivotMatrix=s.y3.Identity(),a._postMultiplyPivotMatrix=!1,a._isWorldMatrixFrozen=!1,a._indexInSceneTransformNodesArray=-1,a.onAfterWorldMatrixUpdateObservable=new o.y$,a._nonUniformScaling=!1,r&&a.getScene().addTransformNode(a),a}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"billboardMode",{get:function(){return this._billboardMode},set:function(e){this._billboardMode!==e&&(this._billboardMode=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"preserveParentRotationForBillboard",{get:function(){return this._preserveParentRotationForBillboard},set:function(e){e!==this._preserveParentRotationForBillboard&&(this._preserveParentRotationForBillboard=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"infiniteDistance",{get:function(){return this._infiniteDistance},set:function(e){this._infiniteDistance!==e&&(this._infiniteDistance=e)},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"TransformNode"},Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._rotationQuaternion=null,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this._scaling},set:function(e){this._scaling=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotationQuaternion",{get:function(){return this._rotationQuaternion},set:function(e){this._rotationQuaternion=e,e&&this._rotation.setAll(0),this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"forward",{get:function(){return s.P.Normalize(s.P.TransformNormal(this.getScene().useRightHandedSystem?this._forwardInverted:this._forward,this.getWorldMatrix()))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"up",{get:function(){return s.P.Normalize(s.P.TransformNormal(this._up,this.getWorldMatrix()))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return s.P.Normalize(s.P.TransformNormal(this.getScene().useRightHandedSystem?this._rightInverted:this._right,this.getWorldMatrix()))},enumerable:!1,configurable:!0}),t.prototype.updatePoseMatrix=function(e){return this._poseMatrix?(this._poseMatrix.copyFrom(e),this):(this._poseMatrix=e.clone(),this)},t.prototype.getPoseMatrix=function(){return this._poseMatrix||(this._poseMatrix=s.y3.Identity()),this._poseMatrix},t.prototype._isSynchronized=function(){var e=this._cache;return this.billboardMode===e.billboardMode&&this.billboardMode===t.BILLBOARDMODE_NONE&&(!e.pivotMatrixUpdated&&(!this.infiniteDistance&&(!this.position._isDirty&&(!this.scaling._isDirty&&!(this._rotationQuaternion&&this._rotationQuaternion._isDirty||this.rotation._isDirty)))))},t.prototype._initCache=function(){e.prototype._initCache.call(this);var t=this._cache;t.localMatrixUpdated=!1,t.billboardMode=-1,t.infiniteDistance=!1},t.prototype.markAsDirty=function(e){return this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this},Object.defineProperty(t.prototype,"absolutePosition",{get:function(){return this._absolutePosition},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"absoluteScaling",{get:function(){return this._syncAbsoluteScalingAndRotation(),this._absoluteScaling},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"absoluteRotationQuaternion",{get:function(){return this._syncAbsoluteScalingAndRotation(),this._absoluteRotationQuaternion},enumerable:!1,configurable:!0}),t.prototype.setPreTransformMatrix=function(e){return this.setPivotMatrix(e,!1)},t.prototype.setPivotMatrix=function(e,t){return void 0===t&&(t=!0),this._pivotMatrix.copyFrom(e),this._usePivotMatrix=!this._pivotMatrix.isIdentity(),this._cache.pivotMatrixUpdated=!0,this._postMultiplyPivotMatrix=t,this._postMultiplyPivotMatrix&&(this._pivotMatrixInverse?this._pivotMatrix.invertToRef(this._pivotMatrixInverse):this._pivotMatrixInverse=s.y3.Invert(this._pivotMatrix)),this},t.prototype.getPivotMatrix=function(){return this._pivotMatrix},t.prototype.instantiateHierarchy=function(e,t,i){void 0===e&&(e=null);var n=this.clone("Clone of "+(this.name||this.id),e||this.parent,!0);n&&i&&i(this,n);for(var r=0,o=this.getChildTransformNodes(!0);r{"use strict";i.d(t,{B:()=>n});var n=function(){function e(){}return e.BuildArray=function(e,t){for(var i=[],n=0;n{"use strict";i.d(t,{x:()=>n});var n=function(){function e(){}return e.CreateCanvas=function(e,t){if("undefined"==typeof document)return new OffscreenCanvas(e,t);var i=document.createElement("canvas");return i.width=e,i.height=t,i},e}()},9023:(e,t,i)=>{"use strict";i.d(t,{wz:()=>f,qC:()=>d,oU:()=>p,n9:()=>_,qQ:()=>g,QC:()=>m,hd:()=>v,RR:()=>y,N$:()=>b,XX:()=>T,rX:()=>A,mv:()=>E,oQ:()=>C,p4:()=>x});var n=i(4115),r=i(2973),o=i(106),s=i(8362),a={},l={},h=function(e,t,i){var r=e();n.$&&n.$.AddTagsTo(r,t.tags);var o=c(r);for(var s in o){var a=o[s],l=t[s],h=a.type;if(null!=l&&"uniqueId"!==s)switch(h){case 0:case 6:case 11:r[s]=l;break;case 1:r[s]=i||l.isRenderTarget?l:l.clone();break;case 2:case 3:case 4:case 5:case 7:case 10:case 12:r[s]=i?l:l.clone()}}return r};function c(e){var t=e.getClassName();if(l[t])return l[t];l[t]={};for(var i=l[t],n=e,r=t;r;){var o=a[r];for(var s in o)i[s]=o[s];var h=void 0,c=!1;do{if(!(h=Object.getPrototypeOf(n)).getClassName){c=!0;break}if(h.getClassName()!==r)break;n=h}while(h);if(c)break;r=h.getClassName(),n=h}return i}function u(e,t){return function(i,n){var r=function(e){var t=e.getClassName();return a[t]||(a[t]={}),a[t]}(i);r[n]||(r[n]={type:e,sourceName:t})}}function f(e,t){return void 0===t&&(t=null),function(e,t){return void 0===t&&(t=null),function(i,n){var r=t||"_"+n;Object.defineProperty(i,n,{get:function(){return this[r]},set:function(t){this[r]!==t&&(this[r]=t,i[e].apply(this))},enumerable:!0,configurable:!0})}}(e,t)}function d(e){return u(0,e)}function p(e){return u(1,e)}function _(e){return u(2,e)}function g(e){return u(3,e)}function m(e){return u(4,e)}function v(e){return u(5,e)}function y(e){return u(6,e)}function b(e){return u(7,e)}function T(e){return u(8,e)}function A(e){return u(9,e)}function E(e){return u(10,e)}function C(e){return u(12,e)}var x=function(){function e(){}return e.AppendSerializedAnimations=function(e,t){if(e.animations){t.animations=[];for(var i=0;i{"use strict";i.d(t,{j:()=>s});var n=i(1373),r=i(3734),o=function(e,t){return e?e.getClassName&&"Mesh"===e.getClassName()?null:e.getClassName&&"SubMesh"===e.getClassName()?e.clone(t):e.clone?e.clone():null:null};var s=function(){function e(){}return e.DeepCopy=function(e,t,i,s){for(var a=0,l=function(e){var t=[];do{Object.getOwnPropertyNames(e).forEach((function(e){-1===t.indexOf(e)&&t.push(e)}))}while(e=Object.getPrototypeOf(e));return t}(e);a0)if("object"==typeof c[0])for(var f=0;f{"use strict";i.d(t,{f:()=>n});var n=function(){function e(){}return e.WarnImport=function(e){return e+" needs to be imported before as it contains a side-effect required by your code."},e}()},6327:(e,t,i)=>{"use strict";i.d(t,{M:()=>n});var n=function(){function e(){}return e.IsWindowObjectExist=function(){return"undefined"!=typeof window},e.IsNavigatorAvailable=function(){return"undefined"!=typeof navigator},e.IsDocumentAvailable=function(){return"undefined"!=typeof document},e.GetDOMTextContent=function(e){for(var t="",i=e.firstChild;i;)3===i.nodeType&&(t+=i.textContent),i=i.nextSibling;return t},e}()},5684:(e,t,i)=>{"use strict";i.d(t,{e0:()=>g,eh:()=>d});var n=i(655),r=i(2840),o=i(6327),s=i(475),a=i(3483),l=function(){function e(){}return e.ExponentialBackoff=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=500),function(i,n,r){return 0!==n.status||r>=e||-1!==i.indexOf("file:")?-1:Math.pow(2,r)*t}},e}(),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,n.ZT)(t,e),t._setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t}(Error),c=i(1373),u=i(2131),f=i(3857),d=function(e){function t(i,n){var o=e.call(this,i)||this;return o.name="LoadFileError",h._setPrototypeOf(o,t.prototype),n instanceof r.g?o.request=n:o.file=n,o}return(0,n.ZT)(t,e),t}(h),p=function(e){function t(i,n){var r=e.call(this,i)||this;return r.request=n,r.name="RequestFileError",h._setPrototypeOf(r,t.prototype),r}return(0,n.ZT)(t,e),t}(h),_=function(e){function t(i,n){var r=e.call(this,i)||this;return r.file=n,r.name="ReadFileError",h._setPrototypeOf(r,t.prototype),r}return(0,n.ZT)(t,e),t}(h),g=function(){function e(){}return e._CleanUrl=function(e){return e=e.replace(/#/gm,"%23")},e.SetCorsBehavior=function(t,i){if((!t||0!==t.indexOf("data:"))&&e.CorsBehavior)if("string"==typeof e.CorsBehavior||this.CorsBehavior instanceof String)i.crossOrigin=e.CorsBehavior;else{var n=e.CorsBehavior(t);n&&(i.crossOrigin=n)}},e.LoadImage=function(t,i,n,r,o){var s;void 0===o&&(o="");var l=!1;if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)?"undefined"!=typeof Blob?(s=URL.createObjectURL(new Blob([t],{type:o})),l=!0):s="data:"+o+";base64,"+c.M.EncodeArrayBufferToBase64(t):t instanceof Blob?(s=URL.createObjectURL(t),l=!0):(s=e._CleanUrl(t),s=e.PreprocessUrl(t)),"undefined"==typeof Image)return e.LoadFile(s,(function(e){createImageBitmap(new Blob([e],{type:o})).then((function(e){i(e),l&&URL.revokeObjectURL(s)})).catch((function(e){n&&n("Error while trying to load image: "+t,e)}))}),void 0,r||void 0,!0,(function(e,i){n&&n("Error while trying to load image: "+t,i)})),null;var h=new Image;e.SetCorsBehavior(s,h);var u=function(){h.removeEventListener("load",u),h.removeEventListener("error",f),i(h),l&&h.src&&URL.revokeObjectURL(h.src)},f=function(e){if(h.removeEventListener("load",u),h.removeEventListener("error",f),n){var i=t.toString();n("Error while trying to load image: "+(i.length<32?i:i.slice(0,32)+"..."),e)}l&&h.src&&URL.revokeObjectURL(h.src)};h.addEventListener("load",u),h.addEventListener("error",f);var d=function(){h.src=s};if("data:"!==s.substr(0,5)&&r&&r.enableTexturesOffline)r.open((function(){r&&r.loadImage(s,h)}),d);else{if(-1!==s.indexOf("file:")){var p=decodeURIComponent(s.substring(5).toLowerCase());if(a.X.FilesToLoad[p]){try{var _;try{_=URL.createObjectURL(a.X.FilesToLoad[p])}catch(e){_=URL.createObjectURL(a.X.FilesToLoad[p])}h.src=_,l=!0}catch(e){h.src=""}return h}}d()}return h},e.ReadFile=function(e,t,i,n,r){var o=new FileReader,a={onCompleteObservable:new s.y$,abort:function(){return o.abort()}};return o.onloadend=function(e){return a.onCompleteObservable.notifyObservers(a)},r&&(o.onerror=function(t){r(new _("Unable to read "+e.name,e))}),o.onload=function(e){t(e.target.result)},i&&(o.onprogress=i),n?o.readAsArrayBuffer(e):o.readAsText(e),a},e.LoadFile=function(t,i,n,r,o,s){if(-1!==t.indexOf("file:")){var l=decodeURIComponent(t.substring(5).toLowerCase());0===l.indexOf("./")&&(l=l.substring(2));var h=a.X.FilesToLoad[l];if(h)return e.ReadFile(h,i,n,o,s?function(e){return s(void 0,new d(e.message,e.file))}:void 0)}return e.RequestFile(t,(function(e,t){i(e,t?t.responseURL:void 0)}),n,r,o,s?function(e){s(e.request,new d(e.message,e.request))}:void 0)},e.RequestFile=function(t,i,n,a,l,h,c){t=e._CleanUrl(t),t=e.PreprocessUrl(t);var u=e.BaseUrl+t,f=!1,d={onCompleteObservable:new s.y$,abort:function(){return f=!0}},_=function(){var t=new r.g,s=null;d.abort=function(){f=!0,t.readyState!==(XMLHttpRequest.DONE||4)&&t.abort(),null!==s&&(clearTimeout(s),s=null)};var a=function(_){t.open("GET",u),c&&c(t),l&&(t.responseType="arraybuffer"),n&&t.addEventListener("progress",n);var g=function(){t.removeEventListener("loadend",g),d.onCompleteObservable.notifyObservers(d),d.onCompleteObservable.clear()};t.addEventListener("loadend",g);var m=function(){if(!f&&t.readyState===(XMLHttpRequest.DONE||4)){if(t.removeEventListener("readystatechange",m),t.status>=200&&t.status<300||0===t.status&&(!o.M.IsWindowObjectExist()||e.IsFileURL()))return void i(l?t.response:t.responseText,t);var n=e.DefaultRetryStrategy;if(n){var c=n(u,t,_);if(-1!==c)return t.removeEventListener("loadend",g),t=new r.g,void(s=setTimeout((function(){return a(_+1)}),c))}var d=new p("Error status: "+t.status+" "+t.statusText+" - Unable to load "+u,t);h&&h(d)}};t.addEventListener("readystatechange",m),t.send()};a(0)};if(a&&a.enableSceneOffline){var g=function(e){e&&e.status>400?h&&h(e):_()};a.open((function(){a&&a.loadFile(e.BaseUrl+t,(function(e){f||i(e),d.onCompleteObservable.notifyObservers(d)}),n?function(e){f||n(e)}:void 0,g,l)}),g)}else _();return d},e.IsFileURL=function(){return"undefined"!=typeof location&&"file:"===location.protocol},e.DefaultRetryStrategy=l.ExponentialBackoff(),e.BaseUrl="",e.CorsBehavior="anonymous",e.PreprocessUrl=function(e){return e},e}();u.B._FileToolsLoadImage=g.LoadImage.bind(g),u.B._FileToolsLoadFile=g.LoadFile.bind(g),f.L._FileToolsLoadFile=g.LoadFile.bind(g)},3483:(e,t,i)=>{"use strict";i.d(t,{X:()=>n});var n=function(){function e(){}return e.FilesToLoad={},e}()},8927:(e,t,i)=>{"use strict";i.d(t,{x:()=>n});var n=function(){function e(){}return e.RandomId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e}()},6761:(e,t,i)=>{"use strict";i.d(t,{K:()=>o});var n=i(3734),r=i(6132),o=function(){function e(){}return e.Instantiate=function(e){if(this.RegisteredExternalClasses&&this.RegisteredExternalClasses[e])return this.RegisteredExternalClasses[e];var t=r.Q.GetClass(e);if(t)return t;n.Y.Warn(e+" not found, you may have missed an import.");for(var i=e.split("."),o=window||this,s=0,a=i.length;s{"use strict";i.d(t,{Y:()=>n});var n=function(){function e(){}return e._AddLogEntry=function(t){e._LogCache=t+e._LogCache,e.OnNewCacheEntry&&e.OnNewCacheEntry(t)},e._FormatMessage=function(e){var t=function(e){return e<10?"0"+e:""+e},i=new Date;return"["+t(i.getHours())+":"+t(i.getMinutes())+":"+t(i.getSeconds())+"]: "+e},e._LogDisabled=function(e){},e._LogEnabled=function(t){var i=e._FormatMessage(t);console.log("BJS - "+i);var n="
"+i+"

";e._AddLogEntry(n)},e._WarnDisabled=function(e){},e._WarnEnabled=function(t){var i=e._FormatMessage(t);console.warn("BJS - "+i);var n="
"+i+"

";e._AddLogEntry(n)},e._ErrorDisabled=function(e){},e._ErrorEnabled=function(t){e.errorsCount++;var i=e._FormatMessage(t);console.error("BJS - "+i);var n="
"+i+"

";e._AddLogEntry(n)},Object.defineProperty(e,"LogCache",{get:function(){return e._LogCache},enumerable:!1,configurable:!0}),e.ClearLogCache=function(){e._LogCache="",e.errorsCount=0},Object.defineProperty(e,"LogLevels",{set:function(t){(t&e.MessageLogLevel)===e.MessageLogLevel?e.Log=e._LogEnabled:e.Log=e._LogDisabled,(t&e.WarningLogLevel)===e.WarningLogLevel?e.Warn=e._WarnEnabled:e.Warn=e._WarnDisabled,(t&e.ErrorLogLevel)===e.ErrorLogLevel?e.Error=e._ErrorEnabled:e.Error=e._ErrorDisabled},enumerable:!1,configurable:!0}),e.NoneLogLevel=0,e.MessageLogLevel=1,e.WarningLogLevel=2,e.ErrorLogLevel=4,e.AllLogLevel=7,e._LogCache="",e.errorsCount=0,e.Log=e._LogEnabled,e.Warn=e._WarnEnabled,e.Error=e._ErrorEnabled,e}()},475:(e,t,i)=>{"use strict";i.d(t,{y$:()=>o});var n=function(){function e(e,t,i,n){void 0===t&&(t=!1),this.initalize(e,t,i,n)}return e.prototype.initalize=function(e,t,i,n){return void 0===t&&(t=!1),this.mask=e,this.skipNextObservers=t,this.target=i,this.currentTarget=n,this},e}(),r=function(e,t,i){void 0===i&&(i=null),this.callback=e,this.mask=t,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1},o=(function(){function e(){}e.prototype.dispose=function(){if(this._observers&&this._observables)for(var e=0;e0},e.prototype.clear=function(){this._observers=new Array,this._onObserverAdded=null},e.prototype.clone=function(){var t=new e;return t._observers=this._observers.slice(0),t},e.prototype.hasSpecificMask=function(e){void 0===e&&(e=-1);for(var t=0,i=this._observers;t{"use strict";i.d(t,{z:()=>r});var n=i(5273),r=function(){function e(){this._startMonitoringTime=0,this._min=0,this._max=0,this._average=0,this._lastSecAverage=0,this._current=0,this._totalValueCount=0,this._totalAccumulated=0,this._lastSecAccumulated=0,this._lastSecTime=0,this._lastSecValueCount=0}return Object.defineProperty(e.prototype,"min",{get:function(){return this._min},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this._max},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"average",{get:function(){return this._average},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastSecAverage",{get:function(){return this._lastSecAverage},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"current",{get:function(){return this._current},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"total",{get:function(){return this._totalAccumulated},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"count",{get:function(){return this._totalValueCount},enumerable:!1,configurable:!0}),e.prototype.fetchNewFrame=function(){this._totalValueCount++,this._current=0,this._lastSecValueCount++},e.prototype.addCount=function(t,i){e.Enabled&&(this._current+=t,i&&this._fetchResult())},e.prototype.beginMonitoring=function(){e.Enabled&&(this._startMonitoringTime=n.F.Now)},e.prototype.endMonitoring=function(t){if(void 0===t&&(t=!0),e.Enabled){t&&this.fetchNewFrame();var i=n.F.Now;this._current=i-this._startMonitoringTime,t&&this._fetchResult()}},e.prototype._fetchResult=function(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;var e=n.F.Now;e-this._lastSecTime>1e3&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=e,this._lastSecAccumulated=0,this._lastSecValueCount=0)},e.Enabled=!0,e}()},5273:(e,t,i)=>{"use strict";i.d(t,{F:()=>r});var n=i(6327),r=function(){function e(){}return Object.defineProperty(e,"Now",{get:function(){return n.M.IsWindowObjectExist()&&window.performance&&window.performance.now?window.performance.now():Date.now()},enumerable:!1,configurable:!0}),e}()},9073:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ScreenshotTools:()=>_});var n=i(4283),r=i(5082),o=i(655),s=i(4277),a=i(7947),l="uniform sampler2D textureSampler;\nuniform vec2 texelSize;\nvarying vec2 vUV;\nvarying vec2 sampleCoordS;\nvarying vec2 sampleCoordE;\nvarying vec2 sampleCoordN;\nvarying vec2 sampleCoordW;\nvarying vec2 sampleCoordNW;\nvarying vec2 sampleCoordSE;\nvarying vec2 sampleCoordNE;\nvarying vec2 sampleCoordSW;\nconst float fxaaQualitySubpix=1.0;\nconst float fxaaQualityEdgeThreshold=0.166;\nconst float fxaaQualityEdgeThresholdMin=0.0833;\nconst vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);\n#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)\nvoid main(){\nvec2 posM;\nposM.x=vUV.x;\nposM.y=vUV.y;\nvec4 rgbyM=texture2D(textureSampler,vUV,0.0);\nfloat lumaM=FxaaLuma(rgbyM);\nfloat lumaS=FxaaLuma(texture2D(textureSampler,sampleCoordS,0.0));\nfloat lumaE=FxaaLuma(texture2D(textureSampler,sampleCoordE,0.0));\nfloat lumaN=FxaaLuma(texture2D(textureSampler,sampleCoordN,0.0));\nfloat lumaW=FxaaLuma(texture2D(textureSampler,sampleCoordW,0.0));\nfloat maxSM=max(lumaS,lumaM);\nfloat minSM=min(lumaS,lumaM);\nfloat maxESM=max(lumaE,maxSM);\nfloat minESM=min(lumaE,minSM);\nfloat maxWN=max(lumaN,lumaW);\nfloat minWN=min(lumaN,lumaW);\nfloat rangeMax=max(maxWN,maxESM);\nfloat rangeMin=min(minWN,minESM);\nfloat rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;\nfloat range=rangeMax-rangeMin;\nfloat rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\n#ifndef MALI\nif(range=edgeVert;\nfloat subpixA=subpixNSWE*2.0+subpixNWSWNESE;\nif (!horzSpan)\n{\nlumaN=lumaW;\n}\nif (!horzSpan)\n{\nlumaS=lumaE;\n}\nif (horzSpan)\n{\nlengthSign=texelSize.y;\n}\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;\nfloat gradientN=lumaN-lumaM;\nfloat gradientS=lumaS-lumaM;\nfloat lumaNN=lumaN+lumaM;\nfloat lumaSS=lumaS+lumaM;\nbool pairN=abs(gradientN)>=abs(gradientS);\nfloat gradient=max(abs(gradientN),abs(gradientS));\nif (pairN)\n{\nlengthSign=-lengthSign;\n}\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);\nvec2 posB;\nposB.x=posM.x;\nposB.y=posM.y;\nvec2 offNP;\noffNP.x=(!horzSpan) ? 0.0 : texelSize.x;\noffNP.y=(horzSpan) ? 0.0 : texelSize.y;\nif (!horzSpan)\n{\nposB.x+=lengthSign*0.5;\n}\nif (horzSpan)\n{\nposB.y+=lengthSign*0.5;\n}\nvec2 posN;\nposN.x=posB.x-offNP.x*1.5;\nposN.y=posB.y-offNP.y*1.5;\nvec2 posP;\nposP.x=posB.x+offNP.x*1.5;\nposP.y=posB.y+offNP.y*1.5;\nfloat subpixD=((-2.0)*subpixC)+3.0;\nfloat lumaEndN=FxaaLuma(texture2D(textureSampler,posN,0.0));\nfloat subpixE=subpixC*subpixC;\nfloat lumaEndP=FxaaLuma(texture2D(textureSampler,posP,0.0));\nif (!pairN)\n{\nlumaNN=lumaSS;\n}\nfloat gradientScaled=gradient*1.0/4.0;\nfloat lumaMM=lumaM-lumaNN*0.5;\nfloat subpixF=subpixD*subpixE;\nbool lumaMLTZero=lumaMM<0.0;\nlumaEndN-=lumaNN*0.5;\nlumaEndP-=lumaNN*0.5;\nbool doneN=abs(lumaEndN)>=gradientScaled;\nbool doneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN)\n{\nposN.x-=offNP.x*3.0;\n}\nif (!doneN)\n{\nposN.y-=offNP.y*3.0;\n}\nbool doneNP=(!doneN) || (!doneP);\nif (!doneP)\n{\nposP.x+=offNP.x*3.0;\n}\nif (!doneP)\n{\nposP.y+=offNP.y*3.0;\n}\nif (doneNP)\n{\nif (!doneN) lumaEndN=FxaaLuma(texture2D(textureSampler,posN.xy,0.0));\nif (!doneP) lumaEndP=FxaaLuma(texture2D(textureSampler,posP.xy,0.0));\nif (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;\nif (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;\ndoneN=abs(lumaEndN)>=gradientScaled;\ndoneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN) posN.x-=offNP.x*12.0;\nif (!doneN) posN.y-=offNP.y*12.0;\ndoneNP=(!doneN) || (!doneP);\nif (!doneP) posP.x+=offNP.x*12.0;\nif (!doneP) posP.y+=offNP.y*12.0;\n}\nfloat dstN=posM.x-posN.x;\nfloat dstP=posP.x-posM.x;\nif (!horzSpan)\n{\ndstN=posM.y-posN.y;\n}\nif (!horzSpan)\n{\ndstP=posP.y-posM.y;\n}\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;\nfloat spanLength=(dstP+dstN);\nbool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;\nfloat spanLengthRcp=1.0/spanLength;\nbool directionN=dstN-1?"#define MALI 1\n":null},t._Parse=function(e,i,n,r){return u.p4.Parse((function(){return new t(e.name,e.options,i,e.renderTargetSamplingMode,n.getEngine(),e.reusable)}),e,n,r)},t}(s.D);c.Q.RegisteredTypes["BABYLON.FxaaPostProcess"]=f;var d=i(3734),p=i(5540),_=function(){function e(){}return e.CreateScreenshot=function(t,i,n,r,o){void 0===o&&(o="image/png");var s=e._getScreenshotSize(t,i,n),a=s.height,l=s.width;if(a&&l){p.w1._ScreenshotCanvas||(p.w1._ScreenshotCanvas=document.createElement("canvas")),p.w1._ScreenshotCanvas.width=l,p.w1._ScreenshotCanvas.height=a;var h=p.w1._ScreenshotCanvas.getContext("2d"),c=t.getRenderWidth()/t.getRenderHeight(),u=l,f=u/c;f>a&&(u=(f=a)*c);var _=Math.max(0,l-u)/2,g=Math.max(0,a-f)/2,m=t.getRenderingCanvas();h&&m&&h.drawImage(m,_,g,u,f),p.w1.EncodeScreenshotCanvasData(r,o)}else d.Y.Error("Invalid 'size' parameter !")},e.CreateScreenshotAsync=function(t,i,n,r){return void 0===r&&(r="image/png"),new Promise((function(o,s){e.CreateScreenshot(t,i,n,(function(e){void 0!==e?o(e):s(new Error("Data is undefined"))}),r)}))},e.CreateScreenshotUsingRenderTarget=function(t,i,o,s,a,l,h,c,u,_){void 0===a&&(a="image/png"),void 0===l&&(l=1),void 0===h&&(h=!1),void 0===u&&(u=!1),void 0===_&&(_=!1);var g=e._getScreenshotSize(t,i,o),m=g.height,v=g.width,y={width:v,height:m};if(m&&v){var b=t.getRenderingCanvas();if(b){var T={width:b.width,height:b.height};t.setSize(v,m);var A=i.getScene(),E=null,C=A.activeCameras;(A.activeCamera!==i||A.activeCameras&&A.activeCameras.length)&&(E=A.activeCamera,A.activeCamera=i),A.render();var x=new r._("screenShot",y,A,!1,!1,0,!1,n.x.NEAREST_SAMPLINGMODE,void 0,_);x.renderList=null,x.samples=l,x.renderSprites=u,x.onAfterRenderObservable.add((function(){p.w1.DumpFramebuffer(v,m,t,s,a,c)}));var S=function(){A.incrementRenderId(),A.resetCachedMaterial(),x.render(!0),x.dispose(),E&&(A.activeCamera=E),A.activeCameras=C,t.setSize(T.width,T.height),i.getProjectionMatrix(!0)};if(h){var R=new f("antialiasing",1,A.activeCamera);x.addPostProcess(R),R.getEffect().isReady()?S():R.getEffect().onCompiled=function(){S()}}else S()}else d.Y.Error("No rendering canvas found !")}else d.Y.Error("Invalid 'size' parameter !")},e.CreateScreenshotUsingRenderTargetAsync=function(t,i,n,r,o,s,a,l){return void 0===r&&(r="image/png"),void 0===o&&(o=1),void 0===s&&(s=!1),void 0===l&&(l=!1),new Promise((function(h,c){e.CreateScreenshotUsingRenderTarget(t,i,n,(function(e){void 0!==e?h(e):c(new Error("Data is undefined"))}),r,o,s,a,l)}))},e._getScreenshotSize=function(e,t,i){var n=0,r=0;if("object"==typeof i){var o=i.precision?Math.abs(i.precision):1;i.width&&i.height?(n=i.height*o,r=i.width*o):i.width&&!i.height?(r=i.width*o,n=Math.round(r/e.getAspectRatio(t))):i.height&&!i.width?(n=i.height*o,r=Math.round(n*e.getAspectRatio(t))):(r=Math.round(e.getRenderWidth()*o),n=Math.round(r/e.getAspectRatio(t)))}else isNaN(i)||(n=i,r=i);return r&&(r=Math.floor(r)),n&&(n=Math.floor(n)),{height:0|n,width:0|r}},e}();p.w1.CreateScreenshot=_.CreateScreenshot,p.w1.CreateScreenshotAsync=_.CreateScreenshotAsync,p.w1.CreateScreenshotUsingRenderTarget=_.CreateScreenshotUsingRenderTarget,p.w1.CreateScreenshotUsingRenderTargetAsync=_.CreateScreenshotUsingRenderTargetAsync},6936:(e,t,i)=>{"use strict";i.d(t,{t:()=>r,f:()=>o});var n=i(655),r=function(){function e(t){this.length=0,this.data=new Array(t),this._id=e._GlobalId++}return e.prototype.push=function(e){this.data[this.length++]=e,this.length>this.data.length&&(this.data.length*=2)},e.prototype.forEach=function(e){for(var t=0;tthis.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t=this.length?-1:t},e.prototype.contains=function(e){return-1!==this.indexOf(e)},e._GlobalId=0,e}(),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._duplicateId=0,t}return(0,n.ZT)(t,e),t.prototype.push=function(t){e.prototype.push.call(this,t),t.__smartArrayFlags||(t.__smartArrayFlags={}),t.__smartArrayFlags[this._id]=this._duplicateId},t.prototype.pushNoDuplicate=function(e){return(!e.__smartArrayFlags||e.__smartArrayFlags[this._id]!==this._duplicateId)&&(this.push(e),!0)},t.prototype.reset=function(){e.prototype.reset.call(this),this._duplicateId++},t.prototype.concatWithNoDuplicate=function(e){if(0!==e.length){this.length+e.length>this.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t{"use strict";i.d(t,{M:()=>n});var n=function(){function e(){}return e.EndsWith=function(e,t){return-1!==e.indexOf(t,e.length-t.length)},e.StartsWith=function(e,t){return!!e&&0===e.indexOf(t)},e.Decode=function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",i=0;i>2,o=(3&t)<<4|(i=c>4,s=(15&i)<<2|(n=c>6,a=63&n,isNaN(i)?s=a=64:isNaN(n)&&(a=64),h+=l.charAt(r)+l.charAt(o)+l.charAt(s)+l.charAt(a);return h},e.PadNumber=function(e,t){for(var i=String(e);i.length{"use strict";i.d(t,{$:()=>r});var n=function(){function e(){}return e.Eval=function(t,i){return"true"===(t=t.match(/\([^\(\)]*\)/g)?t.replace(/\([^\(\)]*\)/g,(function(t){return t=t.slice(1,t.length-1),e._HandleParenthesisContent(t,i)})):e._HandleParenthesisContent(t,i))||"false"!==t&&e.Eval(t,i)},e._HandleParenthesisContent=function(t,i){var n;i=i||function(e){return"true"===e};var r=t.split("||");for(var o in r)if(r.hasOwnProperty(o)){var s=e._SimplifyNegation(r[o].trim()),a=s.split("&&");if(a.length>1)for(var l=0;l{"use strict";i.d(t,{Q:()=>r});var n=i(6327),r=function(){function e(){}return e.SetImmediate=function(e){n.M.IsWindowObjectExist()&&window.setImmediate?window.setImmediate(e):setTimeout(e,1)},e}()},5540:(e,t,i)=>{"use strict";i.d(t,{$g:()=>b,w1:()=>y});var n,r=i(475),o=i(6327),s=i(3734),a=i(789),l=i(5273),h=i(106),c=i(2840),u=i(2733),f=i(5684);!function(e){e[e.Pending=0]="Pending",e[e.Fulfilled=1]="Fulfilled",e[e.Rejected=2]="Rejected"}(n||(n={}));var d=function(){this.count=0,this.target=0,this.results=[]},p=function(){function e(e){var t=this;if(this._state=n.Pending,this._children=new Array,this._rejectWasConsumed=!1,e)try{e((function(e){t._resolve(e)}),(function(e){t._reject(e)}))}catch(e){this._reject(e)}}return Object.defineProperty(e.prototype,"_result",{get:function(){return this._resultValue},set:function(e){this._resultValue=e,this._parent&&void 0===this._parent._result&&(this._parent._result=e)},enumerable:!1,configurable:!0}),e.prototype.catch=function(e){return this.then(void 0,e)},e.prototype.then=function(t,i){var r=this,o=new e;return o._onFulfilled=t,o._onRejected=i,this._children.push(o),o._parent=this,this._state!==n.Pending&&setTimeout((function(){if(r._state===n.Fulfilled||r._rejectWasConsumed){var e=o._resolve(r._result);if(null!=e)if(void 0!==e._state){var t=e;o._children.push(t),t._parent=o,o=t}else o._result=e}else o._reject(r._reason)})),o},e.prototype._moveChildren=function(e){var t,i=this;if((t=this._children).push.apply(t,e.splice(0,e.length)),this._children.forEach((function(e){e._parent=i})),this._state===n.Fulfilled)for(var r=0,o=this._children;r=t)break;if(n(s),o&&o()){e.breakLoop();break}}e.executeNext()}),s)}),r)},e}();u.l.FallbackTexture="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAA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KK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z",_.Apply()},6132:(e,t,i)=>{"use strict";i.d(t,{Q:()=>n});var n=function(){function e(){}return e.GetClass=function(e){return this.RegisteredTypes&&this.RegisteredTypes[e]?this.RegisteredTypes[e]:null},e.RegisteredTypes={},e}()},2840:(e,t,i)=>{"use strict";i.d(t,{g:()=>n});var n=function(){function e(){this._xhr="undefined"!=typeof _native&&_native.XMLHttpRequest?new _native.XMLHttpRequest:new XMLHttpRequest}return e.prototype._injectCustomRequestHeaders=function(){for(var t in e.CustomRequestHeaders){var i=e.CustomRequestHeaders[t];i&&this._xhr.setRequestHeader(t,i)}},Object.defineProperty(e.prototype,"onprogress",{get:function(){return this._xhr.onprogress},set:function(e){this._xhr.onprogress=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._xhr.readyState},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._xhr.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statusText",{get:function(){return this._xhr.statusText},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"response",{get:function(){return this._xhr.response},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"responseURL",{get:function(){return this._xhr.responseURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"responseText",{get:function(){return this._xhr.responseText},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"responseType",{get:function(){return this._xhr.responseType},set:function(e){this._xhr.responseType=e},enumerable:!1,configurable:!0}),e.prototype.addEventListener=function(e,t,i){this._xhr.addEventListener(e,t,i)},e.prototype.removeEventListener=function(e,t,i){this._xhr.removeEventListener(e,t,i)},e.prototype.abort=function(){this._xhr.abort()},e.prototype.send=function(t){e.CustomRequestHeaders&&this._injectCustomRequestHeaders(),this._xhr.send(t)},e.prototype.open=function(t,i){for(var n=0,r=e.CustomRequestModifiers;n{"use strict";i.d(t,{D:()=>u});var n=i(655),r=i(6936),o=i(475),s=i(2973),a="\nattribute vec2 position;\nuniform vec2 scale;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=(position*madd+madd)*scale;\ngl_Position=vec4(position,0.0,1.0);\n}";i(7947).Q.ShadersStore.postprocessVertexShader=a;var l=i(2905),h=(i(6593),i(9023)),c=i(6132),u=function(){function e(e,t,i,n,a,l,h,c,u,f,d,p,_,g,m){void 0===h&&(h=1),void 0===f&&(f=null),void 0===d&&(d=0),void 0===p&&(p="postprocess"),void 0===g&&(g=!1),void 0===m&&(m=5),this.width=-1,this.height=-1,this.nodeMaterialSource=null,this._outputTexture=null,this.autoClear=!0,this.alphaMode=0,this.animations=new Array,this.enablePixelPerfectMode=!1,this.forceFullscreenViewport=!0,this.scaleMode=1,this.alwaysForcePOT=!1,this._samples=1,this.adaptScaleToCurrentViewport=!1,this._reusable=!1,this._textures=new r.t(2),this._currentRenderTextureInd=0,this._scaleRatio=new s.FM(1,1),this._texelSize=s.FM.Zero(),this.onActivateObservable=new o.y$,this.onSizeChangedObservable=new o.y$,this.onApplyObservable=new o.y$,this.onBeforeRenderObservable=new o.y$,this.onAfterRenderObservable=new o.y$,this.name=e,null!=l?(this._camera=l,this._scene=l.getScene(),l.attachPostProcess(this),this._engine=this._scene.getEngine(),this._scene.postProcesses.push(this),this.uniqueId=this._scene.getUniqueId()):c&&(this._engine=c,this._engine.postProcesses.push(this)),this._options=a,this.renderTargetSamplingMode=h||1,this._reusable=u||!1,this._textureType=d,this._textureFormat=m,this._samplers=n||[],this._samplers.push("textureSampler"),this._fragmentUrl=t,this._vertexUrl=p,this._parameters=i||[],this._parameters.push("scale"),this._indexParameters=_,g||this.updateEffect(f)}return Object.defineProperty(e.prototype,"samples",{get:function(){return this._samples},set:function(e){var t=this;this._samples=Math.min(e,this._engine.getCaps().maxMSAASamples),this._textures.forEach((function(e){e.samples!==t._samples&&t._engine.updateRenderTargetTextureSampleCount(e,t._samples)}))},enumerable:!1,configurable:!0}),e.prototype.getEffectName=function(){return this._fragmentUrl},Object.defineProperty(e.prototype,"onActivate",{set:function(e){this._onActivateObserver&&this.onActivateObservable.remove(this._onActivateObserver),e&&(this._onActivateObserver=this.onActivateObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSizeChanged",{set:function(e){this._onSizeChangedObserver&&this.onSizeChangedObservable.remove(this._onSizeChangedObserver),this._onSizeChangedObserver=this.onSizeChangedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onApply",{set:function(e){this._onApplyObserver&&this.onApplyObservable.remove(this._onApplyObserver),this._onApplyObserver=this.onApplyObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"inputTexture",{get:function(){return this._textures.data[this._currentRenderTextureInd]},set:function(e){this._forcedOutputTexture=e},enumerable:!1,configurable:!0}),e.prototype.restoreDefaultInputTexture=function(){this._forcedOutputTexture=null},e.prototype.getCamera=function(){return this._camera},Object.defineProperty(e.prototype,"texelSize",{get:function(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.texelSize:(this._forcedOutputTexture&&this._texelSize.copyFromFloats(1/this._forcedOutputTexture.width,1/this._forcedOutputTexture.height),this._texelSize)},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"PostProcess"},e.prototype.getEngine=function(){return this._engine},e.prototype.getEffect=function(){return this._effect},e.prototype.shareOutputWith=function(e){return this._disposeTextures(),this._shareOutputWithPostProcess=e,this},e.prototype.useOwnOutput=function(){0==this._textures.length&&(this._textures=new r.t(2)),this._shareOutputWithPostProcess=null},e.prototype.updateEffect=function(e,t,i,n,r,o,s,a){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null),this._effect=this._engine.createEffect({vertex:null!=s?s:this._vertexUrl,fragment:null!=a?a:this._fragmentUrl},["position"],t||this._parameters,i||this._samplers,null!==e?e:"",void 0,r,o,n||this._indexParameters)},e.prototype.isReusable=function(){return this._reusable},e.prototype.markTextureDirty=function(){this.width=-1},e.prototype.activate=function(e,t,i){var n=this;void 0===t&&(t=null);var r=(e=e||this._camera).getScene(),o=r.getEngine(),s=o.getCaps().maxTextureSize,a=(t?t.width:this._engine.getRenderWidth(!0))*this._options|0,h=(t?t.height:this._engine.getRenderHeight(!0))*this._options|0,c=e.parent;!c||c.leftCamera!=e&&c.rightCamera!=e||(a/=2);var u,f=this._options.width||a,d=this._options.height||h,p=7!==this.renderTargetSamplingMode&&1!==this.renderTargetSamplingMode&&2!==this.renderTargetSamplingMode;if(!this._shareOutputWithPostProcess&&!this._forcedOutputTexture){if(this.adaptScaleToCurrentViewport){var _=o.currentViewport;_&&(f*=_.width,d*=_.height)}if((p||this.alwaysForcePOT)&&(this._options.width||(f=o.needPOTTextures?l.Engine.GetExponentOfTwo(f,s,this.scaleMode):f),this._options.height||(d=o.needPOTTextures?l.Engine.GetExponentOfTwo(d,s,this.scaleMode):d)),this.width!==f||this.height!==d){if(this._textures.length>0){for(var g=0;g0)for(var e=0;e0){var i=this._camera._getFirstPostProcess();i&&i.markTextureDirty()}this.onActivateObservable.clear(),this.onAfterRenderObservable.clear(),this.onApplyObservable.clear(),this.onBeforeRenderObservable.clear(),this.onSizeChangedObservable.clear()}},e.prototype.serialize=function(){var e=h.p4.Serialize(this);return e.customType="BABYLON."+this.getClassName(),e.cameraId=this.getCamera().id,e.reusable=this._reusable,e.options=this._options,e.textureType=this._textureType,e},e.Parse=function(e,t,i){var n=c.Q.GetClass(e.customType);if(!n||!n._Parse)return null;var r=t.getCameraByID(e.cameraId);return r?n._Parse(e,r,t,i):null},(0,n.gn)([(0,h.qC)()],e.prototype,"uniqueId",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"name",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"width",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"height",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"renderTargetSamplingMode",void 0),(0,n.gn)([(0,h.XX)()],e.prototype,"clearColor",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"autoClear",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"alphaMode",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"alphaConstants",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"enablePixelPerfectMode",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"forceFullscreenViewport",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"scaleMode",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"alwaysForcePOT",void 0),(0,n.gn)([(0,h.qC)("samples")],e.prototype,"_samples",void 0),(0,n.gn)([(0,h.qC)()],e.prototype,"adaptScaleToCurrentViewport",void 0),e}();c.Q.RegisteredTypes["BABYLON.PostProcess"]=u},4761:(e,t,i)=>{"use strict";i.d(t,{O:()=>o});var n=i(511),r=i(6738),o=function(){function e(e){this._vertexBuffers={},this._scene=e}return e.prototype._prepareBuffers=function(){if(!this._vertexBuffers[r.o.PositionKind]){var e=[];e.push(1,1),e.push(-1,1),e.push(-1,-1),e.push(1,-1),this._vertexBuffers[r.o.PositionKind]=new r.o(this._scene.getEngine(),e,r.o.PositionKind,!1,!1,2),this._buildIndexBuffer()}},e.prototype._buildIndexBuffer=function(){var e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)},e.prototype._rebuild=function(){var e=this._vertexBuffers[r.o.PositionKind];e&&(e._rebuild(),this._buildIndexBuffer())},e.prototype._prepareFrame=function(e,t){void 0===e&&(e=null),void 0===t&&(t=null);var i=this._scene.activeCamera;return!!i&&(!(!(t=t||i._postProcesses.filter((function(e){return null!=e})))||0===t.length||!this._scene.postProcessesEnabled)&&(t[0].activate(i,e,null!=t),!0))},e.prototype.directRender=function(e,t,i,r,o,s){void 0===t&&(t=null),void 0===i&&(i=!1),void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s=!1);for(var a=this._scene.getEngine(),l=0;l{"use strict";i.d(t,{$:()=>a});var n=i(6936),r=i(2973),o=function(){function e(e,t,i,r,o){void 0===i&&(i=null),void 0===r&&(r=null),void 0===o&&(o=null),this.index=e,this._opaqueSubMeshes=new n.t(256),this._transparentSubMeshes=new n.t(256),this._alphaTestSubMeshes=new n.t(256),this._depthOnlySubMeshes=new n.t(256),this._particleSystems=new n.t(256),this._spriteManagers=new n.t(256),this._edgesRenderers=new n.f(16),this._scene=t,this.opaqueSortCompareFn=i,this.alphaTestSortCompareFn=r,this.transparentSortCompareFn=o}return Object.defineProperty(e.prototype,"opaqueSortCompareFn",{set:function(t){this._opaqueSortCompareFn=t,this._renderOpaque=t?this.renderOpaqueSorted:e.renderUnsorted},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaTestSortCompareFn",{set:function(t){this._alphaTestSortCompareFn=t,this._renderAlphaTest=t?this.renderAlphaTestSorted:e.renderUnsorted},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transparentSortCompareFn",{set:function(t){this._transparentSortCompareFn=t||e.defaultTransparentSortCompare,this._renderTransparent=this.renderTransparentSorted},enumerable:!1,configurable:!0}),e.prototype.render=function(e,t,i,n){if(e)e(this._opaqueSubMeshes,this._alphaTestSubMeshes,this._transparentSubMeshes,this._depthOnlySubMeshes);else{var r=this._scene.getEngine();0!==this._depthOnlySubMeshes.length&&(r.setColorWrite(!1),this._renderAlphaTest(this._depthOnlySubMeshes),r.setColorWrite(!0)),0!==this._opaqueSubMeshes.length&&this._renderOpaque(this._opaqueSubMeshes),0!==this._alphaTestSubMeshes.length&&this._renderAlphaTest(this._alphaTestSubMeshes);var o=r.getStencilBuffer();if(r.setStencilBuffer(!1),t&&this._renderSprites(),i&&this._renderParticles(n),this.onBeforeTransparentRendering&&this.onBeforeTransparentRendering(),0!==this._transparentSubMeshes.length&&(r.setStencilBuffer(o),this._renderTransparent(this._transparentSubMeshes),r.setAlphaMode(0)),r.setStencilBuffer(!1),this._edgesRenderers.length){for(var s=0;si._alphaIndex?1:t._alphaIndext._distanceToCamera?-1:0},e.frontToBackSortCompare=function(e,t){return e._distanceToCamerat._distanceToCamera?1:0},e.prototype.prepare=function(){this._opaqueSubMeshes.reset(),this._transparentSubMeshes.reset(),this._alphaTestSubMeshes.reset(),this._depthOnlySubMeshes.reset(),this._particleSystems.reset(),this._spriteManagers.reset(),this._edgesRenderers.reset()},e.prototype.dispose=function(){this._opaqueSubMeshes.dispose(),this._transparentSubMeshes.dispose(),this._alphaTestSubMeshes.dispose(),this._depthOnlySubMeshes.dispose(),this._particleSystems.dispose(),this._spriteManagers.dispose(),this._edgesRenderers.dispose()},e.prototype.dispatch=function(e,t,i){void 0===t&&(t=e.getMesh()),void 0===i&&(i=e.getMaterial()),null!=i&&(i.needAlphaBlendingForMesh(t)?this._transparentSubMeshes.push(e):i.needAlphaTesting()?(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._alphaTestSubMeshes.push(e)):(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._opaqueSubMeshes.push(e)),t._renderingGroup=this,t._edgesRenderer&&t._edgesRenderer.isEnabled&&this._edgesRenderers.pushNoDuplicate(t._edgesRenderer))},e.prototype.dispatchSprites=function(e){this._spriteManagers.push(e)},e.prototype.dispatchParticles=function(e){this._particleSystems.push(e)},e.prototype._renderParticles=function(e){if(0!==this._particleSystems.length){var t=this._scene.activeCamera;this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);for(var i=0;i{"use strict";var n="bonesDeclaration",r="#if NUM_BONE_INFLUENCERS>0\n#ifdef BONETEXTURE\nuniform sampler2D boneSampler;\nuniform float boneTextureWidth;\n#else\nuniform mat4 mBones[BonesPerMesh];\n#ifdef BONES_VELOCITY_ENABLED\nuniform mat4 mPreviousBones[BonesPerMesh];\n#endif\n#endif\nattribute vec4 matricesIndices;\nattribute vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nattribute vec4 matricesIndicesExtra;\nattribute vec4 matricesWeightsExtra;\n#endif\n#ifdef BONETEXTURE\n#define inline\nmat4 readMatrixFromRawSampler(sampler2D smp,float index)\n{\nfloat offset=index*4.0;\nfloat dx=1.0/boneTextureWidth;\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));\nreturn mat4(m0,m1,m2,m3);\n}\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},9686:(e,t,i)=>{"use strict";var n="bonesVertex",r="#if NUM_BONE_INFLUENCERS>0\nmat4 influence;\n#ifdef BONETEXTURE\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\n#endif\n#else\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\n#endif\nfinalWorld=finalWorld*influence;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},9421:(e,t,i)=>{"use strict";var n="bumpFragment",r="vec2 uvOffset=vec2(0.0,0.0);\n#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)\n#ifdef NORMALXYSCALE\nfloat normalScale=1.0;\n#elif defined(BUMP)\nfloat normalScale=vBumpInfos.y;\n#else\nfloat normalScale=1.0;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#elif defined(BUMP)\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vBumpUV);\n#else\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vDetailUV,vec2(1.,1.));\n#endif\n#elif defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#else\nmat3 TBN=cotangent_frame(normalW,vPositionW,vMainUV1,vec2(1.,1.));\n#endif\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\n#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\n#endif\n#endif\n#ifdef DETAIL\nvec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);\nvec2 detailNormalRG=detailColor.wy*2.0-1.0;\nfloat detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));\nvec3 detailNormal=vec3(detailNormalRG,detailNormalB);\n#endif\n#ifdef BUMP\n#ifdef OBJECTSPACE_NORMALMAP\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz*2.0-1.0);\nnormalW=normalize(mat3(normalMatrix)*normalW);\n#elif !defined(DETAIL)\nnormalW=perturbNormal(TBN,vBumpUV+uvOffset);\n#else\nvec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0;\n\n#if DETAIL_NORMALBLENDMETHOD == 0\ndetailNormal.xy*=vDetailInfos.z;\nvec3 blendedNormal=normalize(vec3(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z));\n#elif DETAIL_NORMALBLENDMETHOD == 1\ndetailNormal.xy*=vDetailInfos.z;\nbumpNormal+=vec3(0.0,0.0,1.0);\ndetailNormal*=vec3(-1.0,-1.0,1.0);\nvec3 blendedNormal=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal;\n#endif\nnormalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y);\n#endif\n#elif defined(DETAIL)\ndetailNormal.xy*=vDetailInfos.z;\nnormalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);\n#endif";i(7947).Q.IncludesShadersStore[n]=r},4711:(e,t,i)=>{"use strict";var n="bumpFragmentFunctions",r="#if defined(BUMP)\n#if BUMPDIRECTUV == 1\n#define vBumpUV vMainUV1\n#elif BUMPDIRECTUV == 2\n#define vBumpUV vMainUV2\n#else\nvarying vec2 vBumpUV;\n#endif\nuniform sampler2D bumpSampler;\nvec3 perturbNormal(mat3 cotangentFrame,vec2 uv)\n{\nreturn perturbNormal(cotangentFrame,texture2D(bumpSampler,uv).xyz,vBumpInfos.y);\n}\n#endif\n#if defined(DETAIL)\n#if DETAILDIRECTUV == 1\n#define vDetailUV vMainUV1\n#elif DETAILDIRECTUV == 2\n#define vDetailUV vMainUV2\n#else\nvarying vec2 vDetailUV;\n#endif\nuniform sampler2D detailSampler;\n#endif\n#if defined(BUMP)\nvec3 perturbNormal(mat3 cotangentFrame,vec3 color)\n{\nreturn perturbNormal(cotangentFrame,color,vBumpInfos.y);\n}\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{\nreturn cotangent_frame(normal,p,uv,vTangentSpaceParams);\n}\n#endif\n#if defined(BUMP) && defined(PARALLAX)\nconst float minSamples=4.;\nconst float maxSamples=15.;\nconst int iMaxSamples=15;\n\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\nparallaxLimit*=parallaxScale;\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\nfloat stepSize=1.0/numSamples;\n\nfloat currRayHeight=1.0;\nvec2 vCurrOffset=vec2(0,0);\nvec2 vLastOffset=vec2(0,0);\nfloat lastSampledHeight=1.0;\nfloat currSampledHeight=1.0;\nfor (int i=0; icurrRayHeight)\n{\nfloat delta1=currSampledHeight-currRayHeight;\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\nfloat ratio=delta1/(delta1+delta2);\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\n\nbreak;\n}\nelse\n{\ncurrRayHeight-=stepSize;\nvLastOffset=vCurrOffset;\nvCurrOffset+=stepSize*vMaxOffset;\nlastSampledHeight=currSampledHeight;\n}\n}\nreturn vCurrOffset;\n}\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\n{\n\nfloat height=texture2D(bumpSampler,vBumpUV).w;\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\nreturn -texCoordOffset;\n}\n#endif";i(7947).Q.IncludesShadersStore[n]=r},3110:(e,t,i)=>{"use strict";var n="bumpFragmentMainFunctions",r="#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL)\n#if defined(TANGENT) && defined(NORMAL)\nvarying mat3 vTBN;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform mat4 normalMatrix;\n#endif\nvec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)\n{\n#ifdef NORMALXYSCALE\nnormal=normalize(normal*vec3(scale,scale,1.0));\n#endif\nreturn normalize(cotangentFrame*normal);\n}\nvec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)\n{\nreturn perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);\n}\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\n{\n\nuv=gl_FrontFacing ? uv : -uv;\n\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\n\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;\n\ntangent*=tangentSpaceParams.x;\nbitangent*=tangentSpaceParams.y;\n\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(bitangent,bitangent)));\nreturn mat3(tangent*invmax,bitangent*invmax,normal);\n}\n#endif\n";i(7947).Q.IncludesShadersStore[n]=r},5866:(e,t,i)=>{"use strict";var n="bumpVertex",r="#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nvec3 tbnNormal=normalize(normalUpdated);\nvec3 tbnTangent=normalize(tangentUpdated.xyz);\nvec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;\nvTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},4344:(e,t,i)=>{"use strict";var n="bumpVertexDeclaration",r="#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nvarying mat3 vTBN;\n#endif\n#endif\n";i(7947).Q.IncludesShadersStore[n]=r},3120:(e,t,i)=>{"use strict";var n="clipPlaneFragment",r="#ifdef CLIPPLANE\nif (fClipDistance>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE2\nif (fClipDistance2>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE3\nif (fClipDistance3>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE4\nif (fClipDistance4>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE5\nif (fClipDistance5>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE6\nif (fClipDistance6>0.0)\n{\ndiscard;\n}\n#endif";i(7947).Q.IncludesShadersStore[n]=r},1655:(e,t,i)=>{"use strict";var n="clipPlaneFragmentDeclaration",r="#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nvarying float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nvarying float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nvarying float fClipDistance6;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},6403:(e,t,i)=>{"use strict";var n="clipPlaneVertex",r="#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,vClipPlane);\n#endif\n#ifdef CLIPPLANE2\nfClipDistance2=dot(worldPos,vClipPlane2);\n#endif\n#ifdef CLIPPLANE3\nfClipDistance3=dot(worldPos,vClipPlane3);\n#endif\n#ifdef CLIPPLANE4\nfClipDistance4=dot(worldPos,vClipPlane4);\n#endif\n#ifdef CLIPPLANE5\nfClipDistance5=dot(worldPos,vClipPlane5);\n#endif\n#ifdef CLIPPLANE6\nfClipDistance6=dot(worldPos,vClipPlane6);\n#endif";i(7947).Q.IncludesShadersStore[n]=r},8738:(e,t,i)=>{"use strict";var n="clipPlaneVertexDeclaration",r="#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;\nvarying float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nuniform vec4 vClipPlane5;\nvarying float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nuniform vec4 vClipPlane6;\nvarying float fClipDistance6;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},7236:(e,t,i)=>{"use strict";var n="depthPrePass",r="#ifdef DEPTHPREPASS\ngl_FragColor=vec4(0.,0.,0.,1.0);\nreturn;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},6635:(e,t,i)=>{"use strict";var n="fogFragment",r="#ifdef FOG\nfloat fog=CalcFogFactor();\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},6733:(e,t,i)=>{"use strict";var n="fogFragmentDeclaration",r="#ifdef FOG\n#define FOGMODE_NONE 0.\n#define FOGMODE_EXP 1.\n#define FOGMODE_EXP2 2.\n#define FOGMODE_LINEAR 3.\n#define E 2.71828\nuniform vec4 vFogInfos;\nuniform vec3 vFogColor;\nvarying vec3 vFogDistance;\nfloat CalcFogFactor()\n{\nfloat fogCoeff=1.0;\nfloat fogStart=vFogInfos.y;\nfloat fogEnd=vFogInfos.z;\nfloat fogDensity=vFogInfos.w;\nfloat fogDistance=length(vFogDistance);\nif (FOGMODE_LINEAR == vFogInfos.x)\n{\nfogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);\n}\nelse if (FOGMODE_EXP == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDensity);\n}\nelse if (FOGMODE_EXP2 == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);\n}\nreturn clamp(fogCoeff,0.0,1.0);\n}\n#endif";i(7947).Q.IncludesShadersStore[n]=r},5724:(e,t,i)=>{"use strict";var n="fogVertex",r="#ifdef FOG\nvFogDistance=(view*worldPos).xyz;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},5183:(e,t,i)=>{"use strict";var n="fogVertexDeclaration",r="#ifdef FOG\nvarying vec3 vFogDistance;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},8662:(e,t,i)=>{"use strict";var n="helperFunctions",r="const float PI=3.1415926535897932384626433832795;\nconst float HALF_MIN=5.96046448e-08;\nconst float LinearEncodePowerApprox=2.2;\nconst float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;\nconst vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);\nconst float Epsilon=0.0000001;\n#define saturate(x) clamp(x,0.0,1.0)\n#define absEps(x) abs(x)+Epsilon\n#define maxEps(x) max(x,Epsilon)\n#define saturateEps(x) clamp(x,Epsilon,1.0)\nmat3 transposeMat3(mat3 inMatrix) {\nvec3 i0=inMatrix[0];\nvec3 i1=inMatrix[1];\nvec3 i2=inMatrix[2];\nmat3 outMatrix=mat3(\nvec3(i0.x,i1.x,i2.x),\nvec3(i0.y,i1.y,i2.y),\nvec3(i0.z,i1.z,i2.z)\n);\nreturn outMatrix;\n}\n\nmat3 inverseMat3(mat3 inMatrix) {\nfloat a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];\nfloat a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];\nfloat a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];\nfloat b01=a22*a11-a12*a21;\nfloat b11=-a22*a10+a12*a20;\nfloat b21=a21*a10-a11*a20;\nfloat det=a00*b01+a01*b11+a02*b21;\nreturn mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;\n}\nfloat toLinearSpace(float color)\n{\nreturn pow(color,LinearEncodePowerApprox);\n}\nvec3 toLinearSpace(vec3 color)\n{\nreturn pow(color,vec3(LinearEncodePowerApprox));\n}\nvec4 toLinearSpace(vec4 color)\n{\nreturn vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);\n}\nvec3 toGammaSpace(vec3 color)\n{\nreturn pow(color,vec3(GammaEncodePowerApprox));\n}\nvec4 toGammaSpace(vec4 color)\n{\nreturn vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);\n}\nfloat toGammaSpace(float color)\n{\nreturn pow(color,GammaEncodePowerApprox);\n}\nfloat square(float value)\n{\nreturn value*value;\n}\nfloat pow5(float value) {\nfloat sq=value*value;\nreturn sq*sq*value;\n}\nfloat getLuminance(vec3 color)\n{\nreturn clamp(dot(color,LuminanceEncodeApprox),0.,1.);\n}\n\nfloat getRand(vec2 seed) {\nreturn fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);\n}\nfloat dither(vec2 seed,float varianceAmount) {\nfloat rand=getRand(seed);\nfloat dither=mix(-varianceAmount/255.0,varianceAmount/255.0,rand);\nreturn dither;\n}\n\nconst float rgbdMaxRange=255.0;\nvec4 toRGBD(vec3 color) {\nfloat maxRGB=maxEps(max(color.r,max(color.g,color.b)));\nfloat D=max(rgbdMaxRange/maxRGB,1.);\nD=clamp(floor(D)/255.0,0.,1.);\n\nvec3 rgb=color.rgb*D;\n\nrgb=toGammaSpace(rgb);\nreturn vec4(rgb,D);\n}\nvec3 fromRGBD(vec4 rgbd) {\n\nrgbd.rgb=toLinearSpace(rgbd.rgb);\n\nreturn rgbd.rgb/rgbd.a;\n}\n";i(7947).Q.IncludesShadersStore[n]=r},7176:(e,t,i)=>{"use strict";var n="imageProcessingDeclaration",r="#ifdef EXPOSURE\nuniform float exposureLinear;\n#endif\n#ifdef CONTRAST\nuniform float contrast;\n#endif\n#ifdef VIGNETTE\nuniform vec2 vInverseScreenSize;\nuniform vec4 vignetteSettings1;\nuniform vec4 vignetteSettings2;\n#endif\n#ifdef COLORCURVES\nuniform vec4 vCameraColorCurveNegative;\nuniform vec4 vCameraColorCurveNeutral;\nuniform vec4 vCameraColorCurvePositive;\n#endif\n#ifdef COLORGRADING\n#ifdef COLORGRADING3D\nuniform highp sampler3D txColorTransform;\n#else\nuniform sampler2D txColorTransform;\n#endif\nuniform vec4 colorTransformSettings;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},9012:(e,t,i)=>{"use strict";var n="imageProcessingFunctions",r="#if defined(COLORGRADING) && !defined(COLORGRADING3D)\n\n#define inline\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\n{\nfloat sliceSize=2.0*sampler3dSetting.x;\n#ifdef SAMPLER3DGREENDEPTH\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\n#else\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\n#endif\nfloat sliceInteger=floor(sliceContinuous);\n\n\nfloat sliceFraction=sliceContinuous-sliceInteger;\n#ifdef SAMPLER3DGREENDEPTH\nvec2 sliceUV=color.rb;\n#else\nvec2 sliceUV=color.rg;\n#endif\nsliceUV.x*=sliceSize;\nsliceUV.x+=sliceInteger*sliceSize;\nsliceUV=saturate(sliceUV);\nvec4 slice0Color=texture2D(colorTransform,sliceUV);\nsliceUV.x+=sliceSize;\nsliceUV=saturate(sliceUV);\nvec4 slice1Color=texture2D(colorTransform,sliceUV);\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\n#ifdef SAMPLER3DBGRMAP\ncolor.rgb=result.rgb;\n#else\ncolor.rgb=result.bgr;\n#endif\nreturn color;\n}\n#endif\n#ifdef TONEMAPPING_ACES\n\n\n\n\n\nconst mat3 ACESInputMat=mat3(\nvec3(0.59719,0.07600,0.02840),\nvec3(0.35458,0.90834,0.13383),\nvec3(0.04823,0.01566,0.83777)\n);\n\nconst mat3 ACESOutputMat=mat3(\nvec3( 1.60475,-0.10208,-0.00327),\nvec3(-0.53108,1.10813,-0.07276),\nvec3(-0.07367,-0.00605,1.07602)\n);\nvec3 RRTAndODTFit(vec3 v)\n{\nvec3 a=v*(v+0.0245786)-0.000090537;\nvec3 b=v*(0.983729*v+0.4329510)+0.238081;\nreturn a/b;\n}\nvec3 ACESFitted(vec3 color)\n{\ncolor=ACESInputMat*color;\n\ncolor=RRTAndODTFit(color);\ncolor=ACESOutputMat*color;\n\ncolor=saturate(color);\nreturn color;\n}\n#endif\nvec4 applyImageProcessing(vec4 result) {\n#ifdef EXPOSURE\nresult.rgb*=exposureLinear;\n#endif\n#ifdef VIGNETTE\n\nvec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;\nviewportXY=viewportXY*2.0-1.0;\nvec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);\nfloat vignetteTerm=dot(vignetteXY1,vignetteXY1);\nfloat vignette=pow(vignetteTerm,vignetteSettings2.w);\n\nvec3 vignetteColor=vignetteSettings2.rgb;\n#ifdef VIGNETTEBLENDMODEMULTIPLY\nvec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);\nresult.rgb*=vignetteColorMultiplier;\n#endif\n#ifdef VIGNETTEBLENDMODEOPAQUE\nresult.rgb=mix(vignetteColor,result.rgb,vignette);\n#endif\n#endif\n#ifdef TONEMAPPING\n#ifdef TONEMAPPING_ACES\nresult.rgb=ACESFitted(result.rgb);\n#else\nconst float tonemappingCalibration=1.590579;\nresult.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\n#endif\n#endif\n\nresult.rgb=toGammaSpace(result.rgb);\nresult.rgb=saturate(result.rgb);\n#ifdef CONTRAST\n\nvec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);\nif (contrast<1.0) {\n\nresult.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);\n} else {\n\nresult.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);\n}\n#endif\n\n#ifdef COLORGRADING\nvec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;\n#ifdef COLORGRADING3D\nvec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;\n#else\nvec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;\n#endif\nresult.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);\n#endif\n#ifdef COLORCURVES\n\nfloat luma=getLuminance(result.rgb);\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\nresult.rgb*=colorCurve.rgb;\nresult.rgb=mix(vec3(luma),result.rgb,colorCurve.a);\n#endif\nreturn result;\n}";i(7947).Q.IncludesShadersStore[n]=r},3191:(e,t,i)=>{"use strict";var n="instancesDeclaration",r="#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#ifdef THIN_INSTANCES\nuniform mat4 world;\n#endif\n#else\nuniform mat4 world;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},6838:(e,t,i)=>{"use strict";var n="instancesVertex",r="#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#ifdef THIN_INSTANCES\nfinalWorld=world*finalWorld;\n#endif\n#else\nmat4 finalWorld=world;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},1130:(e,t,i)=>{"use strict";var n="lightFragment",r="#ifdef LIGHT{X}\n#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\n\n#else\n#ifdef PBR\n\n#ifdef SPOTLIGHT{X}\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(POINTLIGHT{X})\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(HEMILIGHT{X})\npreInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(DIRLIGHT{X})\npreInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#endif\npreInfo.NdotV=NdotV;\n\n#ifdef SPOTLIGHT{X}\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\npreInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\npreInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\npreInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\npreInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#endif\n#elif defined(POINTLIGHT{X})\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\n#endif\n#else\npreInfo.attenuation=1.0;\n#endif\n\n\n#ifdef HEMILIGHT{X}\npreInfo.roughness=roughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n\n#ifdef HEMILIGHT{X}\ninfo.diffuse=computeHemisphericDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb,light{X}.vLightGround);\n#elif defined(SS_TRANSLUCENCY)\ninfo.diffuse=computeDiffuseAndTransmittedLighting(preInfo,light{X}.vLightDiffuse.rgb,subSurfaceOut.transmittance);\n#else\ninfo.diffuse=computeDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb);\n#endif\n\n#ifdef SPECULARTERM\n#ifdef ANISOTROPIC\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#else\ninfo.specular=computeSpecularLighting(preInfo,normalW,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#endif\n#endif\n\n#ifdef SHEEN\n#ifdef SHEEN_LINKWITHALBEDO\n\npreInfo.roughness=sheenOut.sheenIntensity;\n#else\n#ifdef HEMILIGHT{X}\npreInfo.roughness=sheenOut.sheenRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n#endif\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#endif\n\n#ifdef CLEARCOAT\n\n#ifdef HEMILIGHT{X}\npreInfo.roughness=clearcoatOut.clearCoatRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\ninfo.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,light{X}.vLightDiffuse.rgb);\n#ifdef CLEARCOAT_TINT\n\nabsorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);\ninfo.diffuse*=absorption;\n#ifdef SPECULARTERM\ninfo.specular*=absorption;\n#endif\n#endif\n\ninfo.diffuse*=info.clearCoat.w;\n#ifdef SPECULARTERM\ninfo.specular*=info.clearCoat.w;\n#endif\n#ifdef SHEEN\ninfo.sheen*=info.clearCoat.w;\n#endif\n#endif\n#else\n#ifdef SPOTLIGHT{X}\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\n#elif defined(HEMILIGHT{X})\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness);\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\n#endif\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightSampler{X},textureProjectionMatrix{X});\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nfor (int i=0; i=0.) {\nindex{X}=i;\nbreak;\n}\n}\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nif (index{X}>=0)\n#endif\n{\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nshadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nshadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=vec3(shadow)*vCascadeColorsMultiplier{X}[index{X}];\n#endif\n#ifndef SHADOWCSMNOBLEND{X}\nfloat frustumLength=frustumLengths{X}[index{X}];\nfloat diffRatio=clamp(diff{X}/frustumLength,0.,1.)*cascadeBlendFactor{X};\nif (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.)\n{\nindex{X}+=1;\nfloat nextShadow=0.;\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nnextShadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nnextShadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nnextShadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\nshadow=mix(nextShadow,shadow,diffRatio);\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio);\n#endif\n}\n#endif\n}\n#elif defined(SHADOWCLOSEESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithCloseESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPOISSON{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithPoissonSamplingCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#else\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#endif\n#ifdef SHADOWONLY\n#ifndef SHADOWINUSE\n#define SHADOWINUSE\n#endif\nglobalShadow+=shadow;\nshadowLightCount+=1.0;\n#endif\n#else\nshadow=1.;\n#endif\n#ifndef SHADOWONLY\n#ifdef CUSTOMUSERLIGHTING\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\n#ifdef SPECULARTERM\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\n#endif\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\ndiffuseBase+=lightmapColor.rgb*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef CLEARCOAT\n#ifndef LIGHTMAPNOSPECULAR{X}\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef SHEEN\n#ifndef LIGHTMAPNOSPECULAR{X}\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#else\n#ifdef SHADOWCSMDEBUG{X}\ndiffuseBase+=info.diffuse*shadowDebug{X};\n#else\ndiffuseBase+=info.diffuse*shadow;\n#endif\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#ifdef CLEARCOAT\nclearCoatBase+=info.clearCoat.rgb*shadow;\n#endif\n#ifdef SHEEN\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},8806:(e,t,i)=>{"use strict";var n="lightFragmentDeclaration",r="#ifdef LIGHT{X}\nuniform vec4 vLightData{X};\nuniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec4 vLightSpecular{X};\n#else\nvec4 vLightSpecular{X}=vec4(0.);\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float cascadeBlendFactor{X};\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\nuniform highp sampler2DArray depthSampler{X};\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\n#else\nuniform highp sampler2DArray shadowSampler{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);\nvec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};\nuniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};\nuniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},8644:(e,t,i)=>{"use strict";var n="lightUboDeclaration",r="#ifdef LIGHT{X}\nuniform Light{X}\n{\nvec4 vLightData;\nvec4 vLightDiffuse;\nvec4 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;\nvec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;\nvec2 depthValues;\n} light{X};\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float cascadeBlendFactor{X};\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\nuniform highp sampler2DArray depthSampler{X};\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\n#else\nuniform highp sampler2DArray shadowSampler{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);\nvec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},8136:(e,t,i)=>{"use strict";var n="logDepthDeclaration",r="#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;\nvarying float vFragmentDepth;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},8516:(e,t,i)=>{"use strict";var n="logDepthFragment",r="#ifdef LOGARITHMICDEPTH\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},2753:(e,t,i)=>{"use strict";var n="logDepthVertex",r="#ifdef LOGARITHMICDEPTH\nvFragmentDepth=1.0+gl_Position.w;\ngl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\n#endif";i(7947).Q.IncludesShadersStore[n]=r},2389:(e,t,i)=>{"use strict";var n="morphTargetsVertex",r="#ifdef MORPHTARGETS\npositionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated+=(uv_{X}-uv)*morphTargetInfluences[{X}];\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},1892:(e,t,i)=>{"use strict";var n="morphTargetsVertexDeclaration",r="#ifdef MORPHTARGETS\nattribute vec3 position{X};\n#ifdef MORPHTARGETS_NORMAL\nattribute vec3 normal{X};\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute vec3 tangent{X};\n#endif\n#ifdef MORPHTARGETS_UV\nattribute vec2 uv_{X};\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},9781:(e,t,i)=>{"use strict";var n="morphTargetsVertexGlobalDeclaration",r="#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#endif";i(7947).Q.IncludesShadersStore[n]=r},2213:(e,t,i)=>{"use strict";var n="prePassDeclaration",r="#ifdef PREPASS\n#extension GL_EXT_draw_buffers : require\n#ifdef WEBGL2\nlayout(location=0) out highp vec4 glFragData[{X}];\nhighp vec4 gl_FragColor;\n#endif\n#ifdef PREPASS_DEPTHNORMAL\nvarying highp vec3 vViewPos;\n#endif\n#ifdef PREPASS_VELOCITY\nvarying highp vec4 vCurrentPosition;\nvarying highp vec4 vPreviousPosition;\n#endif\n#endif\n";i(7947).Q.IncludesShadersStore[n]=r},1889:(e,t,i)=>{"use strict";var n="prePassVertex",r="#ifdef PREPASS_DEPTHNORMAL\nvViewPos=(view*worldPos).rgb;\n#endif\n#if defined(PREPASS_VELOCITY) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*worldPos;\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;\npreviousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*previousWorld*previousInfluence*vec4(positionUpdated,1.0);\n#else\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},3235:(e,t,i)=>{"use strict";var n="prePassVertexDeclaration",r="#ifdef PREPASS\n#ifdef PREPASS_DEPTHNORMAL\nvarying vec3 vViewPos;\n#endif\n#ifdef PREPASS_VELOCITY\nuniform mat4 previousWorld;\nuniform mat4 previousViewProjection;\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\n#endif";i(7947).Q.IncludesShadersStore[n]=r},2678:(e,t,i)=>{"use strict";var n="reflectionFunction",r="vec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {\n\nvec3 invOrigVec=vec3(1.0,1.0,1.0)/origVec;\nvec3 halfSize=cubeSize*0.5;\nvec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;\nvec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;\n\nvec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);\n\nfloat distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);\n\nvec3 intersectPositionWS=vertexPos+origVec*distance;\n\nreturn intersectPositionWS-cubePos;\n}\nvec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\n{\nfloat lon=atan(direction.z,direction.x);\nfloat lat=acos(direction.y);\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\nfloat s=sphereCoords.x*0.5+0.5;\nfloat t=sphereCoords.y;\nreturn vec3(s,t,0);\n}\nvec3 computeMirroredFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\n{\nfloat lon=atan(direction.z,direction.x);\nfloat lat=acos(direction.y);\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\nfloat s=sphereCoords.x*0.5+0.5;\nfloat t=sphereCoords.y;\nreturn vec3(1.0-s,t,0);\n}\nvec3 computeEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{\nvec3 cameraToVertex=normalize(worldPos.xyz-eyePosition);\nvec3 r=normalize(reflect(cameraToVertex,worldNormal));\nr=vec3(reflectionMatrix*vec4(r,0));\nfloat lon=atan(r.z,r.x);\nfloat lat=acos(r.y);\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\nfloat s=sphereCoords.x*0.5+0.5;\nfloat t=sphereCoords.y;\nreturn vec3(s,t,0);\n}\nvec3 computeSphericalCoords(vec4 worldPos,vec3 worldNormal,mat4 view,mat4 reflectionMatrix)\n{\nvec3 viewDir=normalize(vec3(view*worldPos));\nvec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));\nvec3 r=reflect(viewDir,viewNormal);\nr=vec3(reflectionMatrix*vec4(r,0));\nr.z=r.z-1.0;\nfloat m=2.0*length(r);\nreturn vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);\n}\nvec3 computePlanarCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{\nvec3 viewDir=worldPos.xyz-eyePosition;\nvec3 coords=normalize(reflect(viewDir,worldNormal));\nreturn vec3(reflectionMatrix*vec4(coords,1));\n}\nvec3 computeCubicCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\n\nvec3 coords=reflect(viewDir,worldNormal);\ncoords=vec3(reflectionMatrix*vec4(coords,0));\n#ifdef INVERTCUBICMAP\ncoords.y*=-1.0;\n#endif\nreturn coords;\n}\nvec3 computeCubicLocalCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix,vec3 reflectionSize,vec3 reflectionPosition)\n{\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\n\nvec3 coords=reflect(viewDir,worldNormal);\ncoords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);\ncoords=vec3(reflectionMatrix*vec4(coords,0));\n#ifdef INVERTCUBICMAP\ncoords.y*=-1.0;\n#endif\nreturn coords;\n}\nvec3 computeProjectionCoords(vec4 worldPos,mat4 view,mat4 reflectionMatrix)\n{\nreturn vec3(reflectionMatrix*(view*worldPos));\n}\nvec3 computeSkyBoxCoords(vec3 positionW,mat4 reflectionMatrix)\n{\nreturn vec3(reflectionMatrix*vec4(positionW,1.));\n}\n#ifdef REFLECTION\nvec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)\n{\n#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\nvec3 direction=normalize(vDirectionW);\nreturn computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction);\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvec3 direction=normalize(vDirectionW);\nreturn computeFixedEquirectangularCoords(worldPos,worldNormal,direction);\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\nreturn computeEquirectangularCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_SPHERICAL\nreturn computeSphericalCoords(worldPos,worldNormal,view,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_PLANAR\nreturn computePlanarCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_CUBIC\n#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC\nreturn computeCubicLocalCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix,vReflectionSize,vReflectionPosition);\n#else\nreturn computeCubicCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#endif\n#ifdef REFLECTIONMAP_PROJECTION\nreturn computeProjectionCoords(worldPos,view,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nreturn computeSkyBoxCoords(vPositionUVW,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_EXPLICIT\nreturn vec3(0,0,0);\n#endif\n}\n#endif";i(7947).Q.IncludesShadersStore[n]=r},7867:(e,t,i)=>{"use strict";var n="shadowsFragmentFunctions",r="#ifdef SHADOWS\n#ifndef SHADOWFLOAT\n\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}\n#endif\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\n{\nfloat mask=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));\nreturn mix(value,1.0,mask);\n}\n#define inline\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\n#endif\nreturn depth>shadow ? darkness : 1.0;\n}\n#define inline\nfloat computeShadowWithPoissonSamplingCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\nfloat visibility=1.;\nvec3 poissonDisk[4];\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\n\n#ifndef SHADOWFLOAT\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;\n}\n#endif\n#define inline\nfloat computeShadow(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadow=texture2D(shadowSampler,uv).x;\n#endif\nreturn shadowPixelDepth>shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;\n}\n}\n#define inline\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\nfloat visibility=1.;\nvec2 poissonDisk[4];\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\npoissonDisk[3]=vec2(0.34495938,0.29387760);\n\n#ifndef SHADOWFLOAT\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n#define inline\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n#ifdef WEBGL2\n#define GREATEST_LESS_THAN_ONE 0.99999994\n\n#define inline\nfloat computeShadowWithCSMPCF1(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);\nfloat shadow=texture(shadowSampler,uvDepthLayer);\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n\n\n#define inline\nfloat computeShadowWithCSMPCF3(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\n\n\nvec2 uvw0=3.-2.*st;\nvec2 uvw1=1.+2.*st;\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));\nshadow=shadow/16.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n\n\n#define inline\nfloat computeShadowWithCSMPCF5(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\nvec2 uvw0=4.-3.*st;\nvec2 uvw1=vec2(7.);\nvec2 uvw2=1.+3.*st;\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[0]),layer,uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[1]),layer,uvDepth.z));\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[2]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[2]),layer,uvDepth.z));\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[2]),layer,uvDepth.z));\nshadow=shadow/144.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n#define inline\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nfloat shadow=texture2D(shadowSampler,uvDepth);\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n\n\n\n#define inline\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\n\n\nvec2 uvw0=3.-2.*st;\nvec2 uvw1=1.+2.*st;\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\nshadow=shadow/16.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n\n\n\n#define inline\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\nuv+=0.5;\nvec2 st=fract(uv);\nvec2 base_uv=floor(uv)-0.5;\nbase_uv*=shadowMapSizeAndInverse.y;\n\n\nvec2 uvw0=4.-3.*st;\nvec2 uvw1=vec2(7.);\nvec2 uvw2=1.+3.*st;\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z));\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z));\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z));\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z));\nshadow=shadow/144.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\nconst vec3 PoissonSamplers32[64]=vec3[64](\nvec3(0.06407013,0.05409927,0.),\nvec3(0.7366577,0.5789394,0.),\nvec3(-0.6270542,-0.5320278,0.),\nvec3(-0.4096107,0.8411095,0.),\nvec3(0.6849564,-0.4990818,0.),\nvec3(-0.874181,-0.04579735,0.),\nvec3(0.9989998,0.0009880066,0.),\nvec3(-0.004920578,-0.9151649,0.),\nvec3(0.1805763,0.9747483,0.),\nvec3(-0.2138451,0.2635818,0.),\nvec3(0.109845,0.3884785,0.),\nvec3(0.06876755,-0.3581074,0.),\nvec3(0.374073,-0.7661266,0.),\nvec3(0.3079132,-0.1216763,0.),\nvec3(-0.3794335,-0.8271583,0.),\nvec3(-0.203878,-0.07715034,0.),\nvec3(0.5912697,0.1469799,0.),\nvec3(-0.88069,0.3031784,0.),\nvec3(0.5040108,0.8283722,0.),\nvec3(-0.5844124,0.5494877,0.),\nvec3(0.6017799,-0.1726654,0.),\nvec3(-0.5554981,0.1559997,0.),\nvec3(-0.3016369,-0.3900928,0.),\nvec3(-0.5550632,-0.1723762,0.),\nvec3(0.925029,0.2995041,0.),\nvec3(-0.2473137,0.5538505,0.),\nvec3(0.9183037,-0.2862392,0.),\nvec3(0.2469421,0.6718712,0.),\nvec3(0.3916397,-0.4328209,0.),\nvec3(-0.03576927,-0.6220032,0.),\nvec3(-0.04661255,0.7995201,0.),\nvec3(0.4402924,0.3640312,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.)\n);\nconst vec3 PoissonSamplers64[64]=vec3[64](\nvec3(-0.613392,0.617481,0.),\nvec3(0.170019,-0.040254,0.),\nvec3(-0.299417,0.791925,0.),\nvec3(0.645680,0.493210,0.),\nvec3(-0.651784,0.717887,0.),\nvec3(0.421003,0.027070,0.),\nvec3(-0.817194,-0.271096,0.),\nvec3(-0.705374,-0.668203,0.),\nvec3(0.977050,-0.108615,0.),\nvec3(0.063326,0.142369,0.),\nvec3(0.203528,0.214331,0.),\nvec3(-0.667531,0.326090,0.),\nvec3(-0.098422,-0.295755,0.),\nvec3(-0.885922,0.215369,0.),\nvec3(0.566637,0.605213,0.),\nvec3(0.039766,-0.396100,0.),\nvec3(0.751946,0.453352,0.),\nvec3(0.078707,-0.715323,0.),\nvec3(-0.075838,-0.529344,0.),\nvec3(0.724479,-0.580798,0.),\nvec3(0.222999,-0.215125,0.),\nvec3(-0.467574,-0.405438,0.),\nvec3(-0.248268,-0.814753,0.),\nvec3(0.354411,-0.887570,0.),\nvec3(0.175817,0.382366,0.),\nvec3(0.487472,-0.063082,0.),\nvec3(-0.084078,0.898312,0.),\nvec3(0.488876,-0.783441,0.),\nvec3(0.470016,0.217933,0.),\nvec3(-0.696890,-0.549791,0.),\nvec3(-0.149693,0.605762,0.),\nvec3(0.034211,0.979980,0.),\nvec3(0.503098,-0.308878,0.),\nvec3(-0.016205,-0.872921,0.),\nvec3(0.385784,-0.393902,0.),\nvec3(-0.146886,-0.859249,0.),\nvec3(0.643361,0.164098,0.),\nvec3(0.634388,-0.049471,0.),\nvec3(-0.688894,0.007843,0.),\nvec3(0.464034,-0.188818,0.),\nvec3(-0.440840,0.137486,0.),\nvec3(0.364483,0.511704,0.),\nvec3(0.034028,0.325968,0.),\nvec3(0.099094,-0.308023,0.),\nvec3(0.693960,-0.366253,0.),\nvec3(0.678884,-0.204688,0.),\nvec3(0.001801,0.780328,0.),\nvec3(0.145177,-0.898984,0.),\nvec3(0.062655,-0.611866,0.),\nvec3(0.315226,-0.604297,0.),\nvec3(-0.780145,0.486251,0.),\nvec3(-0.371868,0.882138,0.),\nvec3(0.200476,0.494430,0.),\nvec3(-0.494552,-0.711051,0.),\nvec3(0.612476,0.705252,0.),\nvec3(-0.578845,-0.768792,0.),\nvec3(-0.772454,-0.090976,0.),\nvec3(0.504440,0.372295,0.),\nvec3(0.155736,0.065157,0.),\nvec3(0.391522,0.849605,0.),\nvec3(-0.620106,-0.328104,0.),\nvec3(0.789239,-0.419965,0.),\nvec3(-0.545396,0.538133,0.),\nvec3(-0.178564,-0.596057,0.)\n);\n\n\n\n\n\n#define inline\nfloat computeShadowWithCSMPCSS(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);\nfloat blockerDepth=0.0;\nfloat sumBlockerDepth=0.0;\nfloat numBlocker=0.0;\nfor (int i=0; i1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nfloat blockerDepth=0.0;\nfloat sumBlockerDepth=0.0;\nfloat numBlocker=0.0;\nfor (int i=0; i{"use strict";var n="shadowsVertex",r="#ifdef SHADOWS\n#if defined(SHADOWCSM{X})\nvPositionFromCamera{X}=view*worldPos;\nfor (int i=0; i{"use strict";i.d(t,{p:()=>n});var n=function(){function e(){this.rootNodes=new Array,this.cameras=new Array,this.lights=new Array,this.meshes=new Array,this.skeletons=new Array,this.particleSystems=new Array,this.animations=[],this.animationGroups=new Array,this.multiMaterials=new Array,this.materials=new Array,this.morphTargetManagers=new Array,this.geometries=new Array,this.transformNodes=new Array,this.actionManagers=new Array,this.textures=new Array,this._environmentTexture=null,this.postProcesses=new Array}return e.AddParser=function(e,t){this._BabylonFileParsers[e]=t},e.GetParser=function(e){return this._BabylonFileParsers[e]?this._BabylonFileParsers[e]:null},e.AddIndividualParser=function(e,t){this._IndividualBabylonFileParsers[e]=t},e.GetIndividualParser=function(e){return this._IndividualBabylonFileParsers[e]?this._IndividualBabylonFileParsers[e]:null},e.Parse=function(e,t,i,n){for(var r in this._BabylonFileParsers)this._BabylonFileParsers.hasOwnProperty(r)&&this._BabylonFileParsers[r](e,t,i,n)},Object.defineProperty(e.prototype,"environmentTexture",{get:function(){return this._environmentTexture},set:function(e){this._environmentTexture=e},enumerable:!1,configurable:!0}),e.prototype.getNodes=function(){var e=new Array;return e=(e=(e=(e=e.concat(this.meshes)).concat(this.lights)).concat(this.cameras)).concat(this.transformNodes),this.skeletons.forEach((function(t){return e=e.concat(t.bones)})),e},e._BabylonFileParsers={},e._IndividualBabylonFileParsers={},e}()},2686:(e,t,i)=>{"use strict";i.d(t,{N:()=>h});var n=i(655),r=i(2973),o=i(9023),s=i(475),a=i(2733),l=i(106),h=function(){function e(e,t){void 0===t&&(t=null),this.state="",this.metadata=null,this.reservedDataStore=null,this._doNotSerialize=!1,this._isDisposed=!1,this.animations=new Array,this._ranges={},this.onReady=null,this._isEnabled=!0,this._isParentEnabled=!0,this._isReady=!0,this._currentRenderId=-1,this._parentUpdateId=-1,this._childUpdateId=-1,this._waitingParentId=null,this._cache={},this._parentNode=null,this._children=null,this._worldMatrix=r.y3.Identity(),this._worldMatrixDeterminant=0,this._worldMatrixDeterminantIsDirty=!0,this._sceneRootNodesIndex=-1,this._animationPropertiesOverride=null,this._isNode=!0,this.onDisposeObservable=new s.y$,this._onDisposeObserver=null,this._behaviors=new Array,this.name=e,this.id=e,this._scene=t||a.l.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._initCache()}return e.AddNodeConstructor=function(e,t){this._NodeConstructors[e]=t},e.Construct=function(e,t,i,n){var r=this._NodeConstructors[e];return r?r(t,i,n):null},Object.defineProperty(e.prototype,"doNotSerialize",{get:function(){return!!this._doNotSerialize||!!this._parentNode&&this._parentNode.doNotSerialize},set:function(e){this._doNotSerialize=e},enumerable:!1,configurable:!0}),e.prototype.isDisposed=function(){return this._isDisposed},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parentNode},set:function(e){if(this._parentNode!==e){var t=this._parentNode;if(this._parentNode&&void 0!==this._parentNode._children&&null!==this._parentNode._children){var i=this._parentNode._children.indexOf(this);-1!==i&&this._parentNode._children.splice(i,1),e||this._isDisposed||this._addToSceneRootNodes()}this._parentNode=e,this._parentNode&&(void 0!==this._parentNode._children&&null!==this._parentNode._children||(this._parentNode._children=new Array),this._parentNode._children.push(this),t||this._removeFromSceneRootNodes()),this._syncParentEnabledState()}},enumerable:!1,configurable:!0}),e.prototype._addToSceneRootNodes=function(){-1===this._sceneRootNodesIndex&&(this._sceneRootNodesIndex=this._scene.rootNodes.length,this._scene.rootNodes.push(this))},e.prototype._removeFromSceneRootNodes=function(){if(-1!==this._sceneRootNodesIndex){var e=this._scene.rootNodes,t=e.length-1;e[this._sceneRootNodesIndex]=e[t],e[this._sceneRootNodesIndex]._sceneRootNodesIndex=this._sceneRootNodesIndex,this._scene.rootNodes.pop(),this._sceneRootNodesIndex=-1}},Object.defineProperty(e.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"Node"},Object.defineProperty(e.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype.getEngine=function(){return this._scene.getEngine()},e.prototype.addBehavior=function(e,t){var i=this;return void 0===t&&(t=!1),-1!==this._behaviors.indexOf(e)||(e.init(),this._scene.isLoading&&!t?this._scene.onDataLoadedObservable.addOnce((function(){e.attach(i)})):e.attach(this),this._behaviors.push(e)),this},e.prototype.removeBehavior=function(e){var t=this._behaviors.indexOf(e);return-1===t||(this._behaviors[t].detach(),this._behaviors.splice(t,1)),this},Object.defineProperty(e.prototype,"behaviors",{get:function(){return this._behaviors},enumerable:!1,configurable:!0}),e.prototype.getBehaviorByName=function(e){for(var t=0,i=this._behaviors;t{"use strict";i.r(t),i.d(t,{Scene:()=>B});var n=i(655),r=i(5540),o=i(5273),s=i(475),a=i(6936),l=function(){function e(){this._count=0,this._data={}}return e.prototype.copyFrom=function(e){var t=this;this.clear(),e.forEach((function(e,i){return t.add(e,i)}))},e.prototype.get=function(e){var t=this._data[e];if(void 0!==t)return t},e.prototype.getOrAddWithFactory=function(e,t){var i=this.get(e);return void 0!==i||(i=t(e))&&this.add(e,i),i},e.prototype.getOrAdd=function(e,t){var i=this.get(e);return void 0!==i?i:(this.add(e,t),t)},e.prototype.contains=function(e){return void 0!==this._data[e]},e.prototype.add=function(e,t){return void 0===this._data[e]&&(this._data[e]=t,++this._count,!0)},e.prototype.set=function(e,t){return void 0!==this._data[e]&&(this._data[e]=t,!0)},e.prototype.getAndRemove=function(e){var t=this.get(e);return void 0!==t?(delete this._data[e],--this._count,t):null},e.prototype.remove=function(e){return!!this.contains(e)&&(delete this._data[e],--this._count,!0)},e.prototype.clear=function(){this._data={},this._count=0},Object.defineProperty(e.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),e.prototype.forEach=function(e){for(var t in this._data){e(t,this._data[t])}},e.prototype.first=function(e){for(var t in this._data){var i=e(t,this._data[t]);if(i)return i}return null},e}(),h=i(4115),c=i(2973),u=i(5511),f=i(5385),d=i(7659),p=i(2611),_=i(2659),g=i(356),m=i(5697),v=i(9626),y=function(){function e(e,t,i,n,r,o){this.source=e,this.pointerX=t,this.pointerY=i,this.meshUnderPointer=n,this.sourceEvent=r,this.additionalData=o}return e.CreateNew=function(t,i,n){var r=t.getScene();return new e(t,r.pointerX,r.pointerY,r.meshUnderPointer||t,i,n)},e.CreateNewFromSprite=function(t,i,n,r){return new e(t,i.pointerX,i.pointerY,i.meshUnderPointer,n,r)},e.CreateNewFromScene=function(t,i){return new e(null,t.pointerX,t.pointerY,t.meshUnderPointer,i)},e.CreateNewFromPrimitive=function(t,i,n,r){return new e(t,i.x,i.y,null,n,r)},e}(),b=i(4761),T=i(7555),A=i(7383),E=i(6327),C=i(3734),x=i(2733),S=i(106),R=i(5441),M=function(){function e(){this.hoverCursor="",this.actions=new Array,this.isRecursive=!1}return Object.defineProperty(e,"HasTriggers",{get:function(){for(var t in e.Triggers)if(e.Triggers.hasOwnProperty(t))return!0;return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e,"HasPickTriggers",{get:function(){for(var t in e.Triggers)if(e.Triggers.hasOwnProperty(t)){var i=parseInt(t);if(i>=1&&i<=7)return!0}return!1},enumerable:!1,configurable:!0}),e.HasSpecificTrigger=function(t){for(var i in e.Triggers){if(e.Triggers.hasOwnProperty(i))if(parseInt(i)===t)return!0}return!1},e.Triggers={},e}(),P=i(3997),I=function(){function e(){this._singleClick=!1,this._doubleClick=!1,this._hasSwiped=!1,this._ignore=!1}return Object.defineProperty(e.prototype,"singleClick",{get:function(){return this._singleClick},set:function(e){this._singleClick=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"doubleClick",{get:function(){return this._doubleClick},set:function(e){this._doubleClick=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasSwiped",{get:function(){return this._hasSwiped},set:function(e){this._hasSwiped=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ignore",{get:function(){return this._ignore},set:function(e){this._ignore=e},enumerable:!1,configurable:!0}),e}(),O=function(){function e(e){this._alreadyAttached=!1,this._wheelEventName="",this._meshPickProceed=!1,this._currentPickResult=null,this._previousPickResult=null,this._totalPointersPressed=0,this._doubleClickOccured=!1,this._pointerX=0,this._pointerY=0,this._startingPointerPosition=new c.FM(0,0),this._previousStartingPointerPosition=new c.FM(0,0),this._startingPointerTime=0,this._previousStartingPointerTime=0,this._pointerCaptures={},this._meshUnderPointerId=[],this._keyboardIsAttached=!1,this._scene=e}return Object.defineProperty(e.prototype,"meshUnderPointer",{get:function(){return this._pointerOverMesh},enumerable:!1,configurable:!0}),e.prototype.getMeshUnderPointerByPointerId=function(e){return this._meshUnderPointerId[e]},Object.defineProperty(e.prototype,"unTranslatedPointer",{get:function(){return new c.FM(this._unTranslatedPointerX,this._unTranslatedPointerY)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pointerX",{get:function(){return this._pointerX},set:function(e){this._pointerX=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pointerY",{get:function(){return this._pointerY},set:function(e){this._pointerY=e},enumerable:!1,configurable:!0}),e.prototype._updatePointerPosition=function(e){var t=this._scene.getEngine().getInputElementClientRect();t&&(this._pointerX=e.clientX-t.left,this._pointerY=e.clientY-t.top,this._unTranslatedPointerX=this._pointerX,this._unTranslatedPointerY=this._pointerY)},e.prototype._processPointerMove=function(e,t){var i=this._scene,n=i.getEngine(),r=n.getInputElement();if(r){r.tabIndex=n.canvasTabIndex,i.doNotHandleCursors||(r.style.cursor=i.defaultCursor);var o=!!(e&&e.hit&&e.pickedMesh);o?(i.setPointerOverMesh(e.pickedMesh,t.pointerId),this._pointerOverMesh&&this._pointerOverMesh.actionManager&&this._pointerOverMesh.actionManager.hasPointerTriggers&&(i.doNotHandleCursors||(this._pointerOverMesh.actionManager.hoverCursor?r.style.cursor=this._pointerOverMesh.actionManager.hoverCursor:r.style.cursor=i.hoverCursor))):i.setPointerOverMesh(null,t.pointerId);for(var s=0,a=i._pointerMoveStage;se.LongPressDelay&&!n._isPointerSwiping()&&(n._startingPointerTime=0,o.processTrigger(8,y.CreateNew(t.pickedMesh,i)))}),e.LongPressDelay)}}else for(var s=0,a=r._pointerDownStage;se.DragMovementThreshold||Math.abs(this._startingPointerPosition.y-this._pointerY)>e.DragMovementThreshold},e.prototype.simulatePointerUp=function(e,t,i){var n=new PointerEvent("pointerup",t),r=new I;i?r.doubleClick=!0:r.singleClick=!0,this._checkPrePointerObservable(e,n,R.kD.POINTERUP)||this._processPointerUp(e,n,r)},e.prototype._processPointerUp=function(e,t,i){var n=this._scene;if(e&&e&&e.pickedMesh){if(this._pickedUpMesh=e.pickedMesh,this._pickedDownMesh===this._pickedUpMesh&&(n.onPointerPick&&n.onPointerPick(t,e),i.singleClick&&!i.ignore&&n.onPointerObservable.hasObservers())){var r=R.kD.POINTERPICK,o=new R.R5(r,t,e);this._setRayOnPointerInfo(o),n.onPointerObservable.notifyObservers(o,r)}var s=e.pickedMesh._getActionManagerForTrigger();if(s&&!i.ignore){s.processTrigger(7,y.CreateNew(e.pickedMesh,t)),!i.hasSwiped&&i.singleClick&&s.processTrigger(1,y.CreateNew(e.pickedMesh,t));var a=e.pickedMesh._getActionManagerForTrigger(6);i.doubleClick&&a&&a.processTrigger(6,y.CreateNew(e.pickedMesh,t))}}else if(!i.ignore)for(var l=0,h=n._pointerUpStage;le.DoubleClickDelay&&!s._doubleClickOccured||t!==s._previousButtonPressed)&&(s._doubleClickOccured=!1,i.singleClick=!0,i.ignore=!1,n(i,s._currentPickResult))},this._initClickEvent=function(t,i,n,r){var o=new I;s._currentPickResult=null;var a=null,l=t.hasSpecificMask(R.kD.POINTERPICK)||i.hasSpecificMask(R.kD.POINTERPICK)||t.hasSpecificMask(R.kD.POINTERTAP)||i.hasSpecificMask(R.kD.POINTERTAP)||t.hasSpecificMask(R.kD.POINTERDOUBLETAP)||i.hasSpecificMask(R.kD.POINTERDOUBLETAP);!l&&M&&(a=s._initActionManager(a,o))&&(l=a.hasPickTriggers);var h=!1;if(l){var c=n.button;if(o.hasSwiped=s._isPointerSwiping(),!o.hasSwiped){var u=!e.ExclusiveDoubleClickMode;u||(u=!t.hasSpecificMask(R.kD.POINTERDOUBLETAP)&&!i.hasSpecificMask(R.kD.POINTERDOUBLETAP))&&!M.HasSpecificTrigger(6)&&(a=s._initActionManager(a,o))&&(u=!a.hasSpecificTrigger(6)),u?(Date.now()-s._previousStartingPointerTime>e.DoubleClickDelay||c!==s._previousButtonPressed)&&(o.singleClick=!0,r(o,s._currentPickResult),h=!0):(s._previousDelayedSimpleClickTimeout=s._delayedSimpleClickTimeout,s._delayedSimpleClickTimeout=window.setTimeout(s._delayedSimpleClick.bind(s,c,o,r),e.DoubleClickDelay));var f=t.hasSpecificMask(R.kD.POINTERDOUBLETAP)||i.hasSpecificMask(R.kD.POINTERDOUBLETAP);!f&&M.HasSpecificTrigger(6)&&(a=s._initActionManager(a,o))&&(f=a.hasSpecificTrigger(6)),f&&(c===s._previousButtonPressed&&Date.now()-s._previousStartingPointerTime0){for(var e=0,t=this._transientComponents;e0)return!1;for(e=0;e0,r=0,o=this._isReadyForMeshStage;r0)for(var s=0,a=this.activeCameras;s0},enumerable:!1,configurable:!0}),t.prototype.executeWhenReady=function(e){var t=this;this.onReadyObservable.add(e),-1===this._executeWhenReadyTimeoutId&&(this._executeWhenReadyTimeoutId=setTimeout((function(){t._checkIsReady()}),150))},t.prototype.whenReadyAsync=function(){var e=this;return new Promise((function(t){e.executeWhenReady((function(){t()}))}))},t.prototype._checkIsReady=function(){var e=this;return this._registerTransientComponents(),this.isReady()?(this.onReadyObservable.notifyObservers(this),this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=-1)):this._isDisposed?(this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=-1)):void(this._executeWhenReadyTimeoutId=setTimeout((function(){e._checkIsReady()}),150))},Object.defineProperty(t.prototype,"animatables",{get:function(){return this._activeAnimatables},enumerable:!1,configurable:!0}),t.prototype.resetLastAnimationTimeFrame=function(){this._animationTimeLast=o.F.Now},t.prototype.getViewMatrix=function(){return this._viewMatrix},t.prototype.getProjectionMatrix=function(){return this._projectionMatrix},t.prototype.getTransformMatrix=function(){return this._transformMatrix},t.prototype.setTransformMatrix=function(e,t,i,n){this._viewUpdateFlag===e.updateFlag&&this._projectionUpdateFlag===t.updateFlag||(this._viewUpdateFlag=e.updateFlag,this._projectionUpdateFlag=t.updateFlag,this._viewMatrix=e,this._projectionMatrix=t,this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._frustumPlanes?w.i.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=w.i.GetPlanes(this._transformMatrix),this._multiviewSceneUbo&&this._multiviewSceneUbo.useUbo?this._updateMultiviewUbo(i,n):this._sceneUbo.useUbo&&(this._sceneUbo.updateMatrix("viewProjection",this._transformMatrix),this._sceneUbo.updateMatrix("view",this._viewMatrix),this._sceneUbo.update()))},t.prototype.getSceneUniformBuffer=function(){return this._multiviewSceneUbo?this._multiviewSceneUbo:this._sceneUbo},t.prototype.getUniqueId=function(){return N.UniqueId},t.prototype.addMesh=function(e,t){var i=this;void 0===t&&(t=!1),this._blockEntityCollection||(this.meshes.push(e),e._resyncLightSources(),e.parent||e._addToSceneRootNodes(),this.onNewMeshAddedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach((function(e){i.addMesh(e)})))},t.prototype.removeMesh=function(e,t){var i=this;void 0===t&&(t=!1);var n=this.meshes.indexOf(e);return-1!==n&&(this.meshes[n]=this.meshes[this.meshes.length-1],this.meshes.pop(),e.parent||e._removeFromSceneRootNodes()),this.onMeshRemovedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach((function(e){i.removeMesh(e)})),n},t.prototype.addTransformNode=function(e){this._blockEntityCollection||(e._indexInSceneTransformNodesArray=this.transformNodes.length,this.transformNodes.push(e),e.parent||e._addToSceneRootNodes(),this.onNewTransformNodeAddedObservable.notifyObservers(e))},t.prototype.removeTransformNode=function(e){var t=e._indexInSceneTransformNodesArray;if(-1!==t){if(t!==this.transformNodes.length-1){var i=this.transformNodes[this.transformNodes.length-1];this.transformNodes[t]=i,i._indexInSceneTransformNodesArray=t}e._indexInSceneTransformNodesArray=-1,this.transformNodes.pop(),e.parent||e._removeFromSceneRootNodes()}return this.onTransformNodeRemovedObservable.notifyObservers(e),t},t.prototype.removeSkeleton=function(e){var t=this.skeletons.indexOf(e);return-1!==t&&(this.skeletons.splice(t,1),this.onSkeletonRemovedObservable.notifyObservers(e)),t},t.prototype.removeMorphTargetManager=function(e){var t=this.morphTargetManagers.indexOf(e);return-1!==t&&this.morphTargetManagers.splice(t,1),t},t.prototype.removeLight=function(e){var t=this.lights.indexOf(e);if(-1!==t){for(var i=0,n=this.meshes;i0?this.activeCamera=this.cameras[0]:this.activeCamera=null),this.onCameraRemovedObservable.notifyObservers(e),t},t.prototype.removeParticleSystem=function(e){var t=this.particleSystems.indexOf(e);return-1!==t&&this.particleSystems.splice(t,1),t},t.prototype.removeAnimation=function(e){var t=this.animations.indexOf(e);return-1!==t&&this.animations.splice(t,1),t},t.prototype.stopAnimation=function(e,t,i){},t.prototype.removeAnimationGroup=function(e){var t=this.animationGroups.indexOf(e);return-1!==t&&this.animationGroups.splice(t,1),t},t.prototype.removeMultiMaterial=function(e){var t=this.multiMaterials.indexOf(e);return-1!==t&&this.multiMaterials.splice(t,1),this.onMultiMaterialRemovedObservable.notifyObservers(e),t},t.prototype.removeMaterial=function(e){var t=e._indexInSceneMaterialArray;if(-1!==t&&t=0;t--)if(this.materials[t].id===e)return this.materials[t];return null},t.prototype.getMaterialByName=function(e){for(var t=0;t=0;t--)if(this.meshes[t].id===e)return this.meshes[t];return null},t.prototype.getLastEntryByID=function(e){var t;for(t=this.meshes.length-1;t>=0;t--)if(this.meshes[t].id===e)return this.meshes[t];for(t=this.transformNodes.length-1;t>=0;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];for(t=this.cameras.length-1;t>=0;t--)if(this.cameras[t].id===e)return this.cameras[t];for(t=this.lights.length-1;t>=0;t--)if(this.lights[t].id===e)return this.lights[t];return null},t.prototype.getNodeByID=function(e){var t=this.getMeshByID(e);if(t)return t;var i=this.getTransformNodeByID(e);if(i)return i;var n=this.getLightByID(e);if(n)return n;var r=this.getCameraByID(e);if(r)return r;var o=this.getBoneByID(e);return o||null},t.prototype.getNodeByName=function(e){var t=this.getMeshByName(e);if(t)return t;var i=this.getTransformNodeByName(e);if(i)return i;var n=this.getLightByName(e);if(n)return n;var r=this.getCameraByName(e);if(r)return r;var o=this.getBoneByName(e);return o||null},t.prototype.getMeshByName=function(e){for(var t=0;t=0;t--)if(this.skeletons[t].id===e)return this.skeletons[t];return null},t.prototype.getSkeletonByUniqueId=function(e){for(var t=0;t0&&0!=(a.layerMask&this.activeCamera.layerMask)&&(this._skipFrustumClipping||a.alwaysSelectAsActiveMesh||a.isInFrustum(this._frustumPlanes)))){this._activeMeshes.push(a),this.activeCamera._activeMeshes.push(a),l!==a&&l._activate(this._renderId,!1);for(var h=0,c=this._preActiveMeshStage;h0)for(var i=this.getActiveSubMeshCandidates(t),n=i.length,r=0;r1)this.activeCamera.outputRenderTarget._bindFrameBuffer();else{var e=this.activeCamera.outputRenderTarget.getInternalTexture();e?this.getEngine().bindFramebuffer(e):C.Y.Error("Camera contains invalid customDefaultRenderTarget")}}else this.getEngine().restoreDefaultFramebuffer()},t.prototype._renderForCamera=function(e,t){if(!e||!e._skipRendering){var i=this._engine;if(this._activeCamera=e,!this.activeCamera)throw new Error("Active camera not set");i.setViewport(this.activeCamera.viewport),this.resetCachedMaterial(),this._renderId++,this.getEngine().getCaps().multiview&&e.outputRenderTarget&&e.outputRenderTarget.getViewCount()>1?this.setTransformMatrix(e._rigCameras[0].getViewMatrix(),e._rigCameras[0].getProjectionMatrix(),e._rigCameras[1].getViewMatrix(),e._rigCameras[1].getProjectionMatrix()):this.updateTransformMatrix(),this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera),this._evaluateActiveMeshes();for(var n=0;n0&&this._renderTargets.concatWithNoDuplicate(e.customRenderTargets),t&&t.customRenderTargets&&t.customRenderTargets.length>0&&this._renderTargets.concatWithNoDuplicate(t.customRenderTargets);for(var s=0,a=this._gatherActiveCameraRenderTargetsStage;s0){r.w1.StartPerformanceCounter("Render targets",this._renderTargets.length>0);for(var h=0;h0),this._renderId++}for(var f=0,d=this._cameraDrawRenderTargetStage;f1&&this.getEngine().getCaps().multiview)return this._renderForCamera(e),void this.onAfterRenderCameraObservable.notifyObservers(e);if(e._useMultiviewToSingleView)this._renderMultiviewToSingleView(e);else for(var t=0;t-1&&(13===n.trigger&&n._executeCurrent(y.CreateNew(t,void 0,o)),t.actionManager.hasSpecificTrigger(13,(function(e){var t=e instanceof f.x?e:e.mesh;return o===t}))&&13!==n.trigger||t._intersectionsInProgress.splice(a,1))}}}},t.prototype._advancePhysicsEngineStep=function(e){},t.prototype._animate=function(){},t.prototype.animate=function(){if(this._engine.isDeterministicLockStep()){var e=Math.max(t.MinDeltaTime,Math.min(this._engine.getDeltaTime(),t.MaxDeltaTime))+this._timeAccumulator,i=this._engine.getTimeStep(),n=1e3/i/1e3,r=0,o=this._engine.getLockstepMaxSteps(),s=Math.floor(e/i);for(s=Math.min(s,o);e>0&&r0)for(var o=0;o0),this._intermediateRendering=!0;for(var c=0;c0),this._intermediateRendering=!1,this._renderId++}this.activeCamera=h,this._activeCamera&&this._activeCamera.cameraRigMode!==d.V.RIG_MODE_CUSTOM&&!this.prePass&&this._bindFrameBuffer(),this.onAfterRenderTargetsRenderObservable.notifyObservers(this);for(var f=0,p=this._beforeClearStage;f0)for(o=0;o0&&this._engine.clear(null,!1,!0,!0),this._processSubCameras(this.activeCameras[o]);else{if(!this.activeCamera)throw new Error("No camera defined");this._processSubCameras(this.activeCamera)}this._checkIntersections();for(var m=0,v=this._afterRenderStage;m-1&&this._engine.scenes.splice(r,1),this._engine.wipeCaches(!0),this._isDisposed=!0},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!1,configurable:!0}),t.prototype.clearCachedVertexData=function(){for(var e=0;e{"use strict";i.d(t,{l:()=>r,H:()=>o});var n=i(655),r=function(){function e(){}return e.NAME_EFFECTLAYER="EffectLayer",e.NAME_LAYER="Layer",e.NAME_LENSFLARESYSTEM="LensFlareSystem",e.NAME_BOUNDINGBOXRENDERER="BoundingBoxRenderer",e.NAME_PARTICLESYSTEM="ParticleSystem",e.NAME_GAMEPAD="Gamepad",e.NAME_SIMPLIFICATIONQUEUE="SimplificationQueue",e.NAME_GEOMETRYBUFFERRENDERER="GeometryBufferRenderer",e.NAME_PREPASSRENDERER="PrePassRenderer",e.NAME_DEPTHRENDERER="DepthRenderer",e.NAME_POSTPROCESSRENDERPIPELINEMANAGER="PostProcessRenderPipelineManager",e.NAME_SPRITE="Sprite",e.NAME_SUBSURFACE="SubSurface",e.NAME_OUTLINERENDERER="Outline",e.NAME_PROCEDURALTEXTURE="ProceduralTexture",e.NAME_SHADOWGENERATOR="ShadowGenerator",e.NAME_OCTREE="Octree",e.NAME_PHYSICSENGINE="PhysicsEngine",e.NAME_AUDIO="Audio",e.STEP_ISREADYFORMESH_EFFECTLAYER=0,e.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER=0,e.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER=0,e.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER=0,e.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER=1,e.STEP_BEFORECAMERADRAW_EFFECTLAYER=0,e.STEP_BEFORECAMERADRAW_LAYER=1,e.STEP_BEFORECAMERADRAW_PREPASS=2,e.STEP_BEFORERENDERTARGETDRAW_LAYER=0,e.STEP_BEFORERENDERINGMESH_PREPASS=0,e.STEP_BEFORERENDERINGMESH_OUTLINE=1,e.STEP_AFTERRENDERINGMESH_PREPASS=0,e.STEP_AFTERRENDERINGMESH_OUTLINE=1,e.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW=0,e.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER=1,e.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE=0,e.STEP_BEFORECAMERAUPDATE_GAMEPAD=1,e.STEP_BEFORECLEAR_PROCEDURALTEXTURE=0,e.STEP_AFTERRENDERTARGETDRAW_LAYER=0,e.STEP_AFTERCAMERADRAW_EFFECTLAYER=0,e.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM=1,e.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW=2,e.STEP_AFTERCAMERADRAW_LAYER=3,e.STEP_AFTERCAMERADRAW_PREPASS=4,e.STEP_AFTERRENDER_AUDIO=0,e.STEP_GATHERRENDERTARGETS_DEPTHRENDERER=0,e.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER=1,e.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR=2,e.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER=3,e.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER=0,e.STEP_BEFORECLEARSTAGE_PREPASS=0,e.STEP_POINTERMOVE_SPRITE=0,e.STEP_POINTERDOWN_SPRITE=0,e.STEP_POINTERUP_SPRITE=0,e}(),o=function(e){function t(t){return e.apply(this,t)||this}return(0,n.ZT)(t,e),t.Create=function(){return Object.create(t.prototype)},t.prototype.registerStep=function(e,t,i){var n=0;for(Number.MAX_VALUE;n{"use strict";i.r(t),i.d(t,{AdvancedDynamicTexture:()=>P});var n=i(655),r=i(475),o=i(2973),s=i(5540),a=i(5441),l=i(96),h=i(3997),c=i(5328),u=i(4283),f=i(5016),d=i(8362),p=i(2733),_=i(6738),g=i(511),m=i(7383),v=function(){function e(e){this.name=m.l.NAME_LAYER,this.scene=e,this._engine=e.getEngine(),e.layers=new Array}return e.prototype.register=function(){this.scene._beforeCameraDrawStage.registerStep(m.l.STEP_BEFORECAMERADRAW_LAYER,this,this._drawCameraBackground),this.scene._afterCameraDrawStage.registerStep(m.l.STEP_AFTERCAMERADRAW_LAYER,this,this._drawCameraForeground),this.scene._beforeRenderTargetDrawStage.registerStep(m.l.STEP_BEFORERENDERTARGETDRAW_LAYER,this,this._drawRenderTargetBackground),this.scene._afterRenderTargetDrawStage.registerStep(m.l.STEP_AFTERRENDERTARGETDRAW_LAYER,this,this._drawRenderTargetForeground)},e.prototype.rebuild=function(){for(var e=0,t=this.scene.layers;e0&&e.isBackground===t&&e.renderTargetTextures.indexOf(n)>-1&&0!=(e.layerMask&i)},e.prototype._drawRenderTargetBackground=function(e){var t=this;this._draw((function(i){return t._drawRenderTargetPredicate(i,!0,t.scene.activeCamera.layerMask,e)}))},e.prototype._drawRenderTargetForeground=function(e){var t=this;this._draw((function(i){return t._drawRenderTargetPredicate(i,!1,t.scene.activeCamera.layerMask,e)}))},e.prototype.addFromContainer=function(e){var t=this;e.layers&&e.layers.forEach((function(e){t.scene.layers.push(e)}))},e.prototype.removeFromContainer=function(e,t){var i=this;void 0===t&&(t=!1),e.layers&&e.layers.forEach((function(e){var n=i.scene.layers.indexOf(e);-1!==n&&i.scene.layers.splice(n,1),t&&e.dispose()}))},e}(),y=i(7947),b=(i(8662),"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\n\n#include\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef LINEAR\nbaseColor.rgb=toGammaSpace(baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=baseColor*color;\n}");y.Q.ShadersStore.layerPixelShader=b;var T="\nattribute vec2 position;\n\nuniform vec2 scale;\nuniform vec2 offset;\nuniform mat4 textureMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvec2 shiftedPosition=position*scale+offset;\nvUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));\ngl_Position=vec4(shiftedPosition,0.0,1.0);\n}";y.Q.ShadersStore.layerVertexShader=T;var A=function(){function e(e,t,i,n,s){this.name=e,this.scale=new o.FM(1,1),this.offset=new o.FM(0,0),this.alphaBlendingMode=2,this.layerMask=268435455,this.renderTargetTextures=[],this.renderOnlyInRenderTargetTextures=!1,this._vertexBuffers={},this.onDisposeObservable=new r.y$,this.onBeforeRenderObservable=new r.y$,this.onAfterRenderObservable=new r.y$,this.texture=t?new u.x(t,i,!0):null,this.isBackground=void 0===n||n,this.color=void 0===s?new d.HE(1,1,1,1):s,this._scene=i||p.l.LastCreatedScene;var a=this._scene._getComponent(m.l.NAME_LAYER);a||(a=new v(this._scene),this._scene._addComponent(a)),this._scene.layers.push(this);var l=this._scene.getEngine(),h=[];h.push(1,1),h.push(-1,1),h.push(-1,-1),h.push(1,-1);var c=new _.o(l,h,_.o.PositionKind,!1,!1,2);this._vertexBuffers[_.o.PositionKind]=c,this._createIndexBuffer()}return Object.defineProperty(e.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!1,configurable:!0}),e.prototype._createIndexBuffer=function(){var e=this._scene.getEngine(),t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)},e.prototype._rebuild=function(){var e=this._vertexBuffers[_.o.PositionKind];e&&e._rebuild(),this._createIndexBuffer()},e.prototype.render=function(){var e=this._scene.getEngine(),t="";this.alphaTest&&(t="#define ALPHATEST"),this.texture&&!this.texture.gammaSpace&&(t+="\r\n#define LINEAR"),this._previousDefines!==t&&(this._previousDefines=t,this._effect=e.createEffect("layer",[_.o.PositionKind],["textureMatrix","color","scale","offset"],["textureSampler"],t));var i=this._effect;if(i&&i.isReady()&&this.texture&&this.texture.isReady()){e=this._scene.getEngine();this.onBeforeRenderObservable.notifyObservers(this),e.enableEffect(i),e.setState(!1),i.setTexture("textureSampler",this.texture),i.setMatrix("textureMatrix",this.texture.getTextureMatrix()),i.setFloat4("color",this.color.r,this.color.g,this.color.b,this.color.a),i.setVector2("offset",this.offset),i.setVector2("scale",this.scale),e.bindBuffers(this._vertexBuffers,this._indexBuffer,i),this.alphaTest?e.drawElementsType(g.F.TriangleFillMode,0,6):(e.setAlphaMode(this.alphaBlendingMode),e.drawElementsType(g.F.TriangleFillMode,0,6),e.setAlphaMode(0)),this.onAfterRenderObservable.notifyObservers(this)}},e.prototype.dispose=function(){var e=this._vertexBuffers[_.o.PositionKind];e&&(e.dispose(),this._vertexBuffers[_.o.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this.texture&&(this.texture.dispose(),this.texture=null),this.renderTargetTextures=[];var t=this._scene.layers.indexOf(this);this._scene.layers.splice(t,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderObservable.clear()},e}(),E=i(6397),C=i(4872),x=function(){function e(e){this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new C.s(18,C.s.UNITMODE_PIXEL,!1),this.onChangedObservable=new r.y$,this._host=e}return Object.defineProperty(e.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(e){this._fontSize.toString(this._host)!==e&&this._fontSize.fromString(e)&&this.onChangedObservable.notifyObservers(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(e){this._fontFamily!==e&&(this._fontFamily=e,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(e){this._fontStyle!==e&&(this._fontStyle=e,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(e){this._fontWeight!==e&&(this._fontWeight=e,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this.onChangedObservable.clear()},e}(),S=i(5958),R=i(3393),M=i(4272),P=function(e){function t(t,i,n,o,s,a,c){void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=!1),void 0===a&&(a=u.x.NEAREST_SAMPLINGMODE);var f=e.call(this,t,{width:i,height:n},o,s,a,R.g.TEXTUREFORMAT_RGBA,c)||this;return f._isDirty=!1,f._rootContainer=new E.W("root"),f._lastControlOver={},f._lastControlDown={},f._capturingControl={},f._linkedControls=new Array,f._isFullscreen=!1,f._fullscreenViewport=new M.l(0,0,1,1),f._idealWidth=0,f._idealHeight=0,f._useSmallestIdeal=!1,f._renderAtIdealSize=!1,f._blockNextFocusCheck=!1,f._renderScale=1,f._cursorChanged=!1,f._defaultMousePointerId=0,f._numLayoutCalls=0,f._numRenderCalls=0,f._clipboardData="",f.onClipboardObservable=new r.y$,f.onControlPickedObservable=new r.y$,f.onBeginLayoutObservable=new r.y$,f.onEndLayoutObservable=new r.y$,f.onBeginRenderObservable=new r.y$,f.onEndRenderObservable=new r.y$,f.premulAlpha=!1,f.applyYInversionOnUpdate=!0,f._useInvalidateRectOptimization=!0,f._invalidatedRectangle=null,f._clearMeasure=new S.U(0,0,0,0),f.onClipboardCopy=function(e){var t=e,i=new l.o(l.p.COPY,t);f.onClipboardObservable.notifyObservers(i),t.preventDefault()},f.onClipboardCut=function(e){var t=e,i=new l.o(l.p.CUT,t);f.onClipboardObservable.notifyObservers(i),t.preventDefault()},f.onClipboardPaste=function(e){var t=e,i=new l.o(l.p.PASTE,t);f.onClipboardObservable.notifyObservers(i),t.preventDefault()},(o=f.getScene())&&f._texture?(f._rootElement=o.getEngine().getInputElement(),f._renderObserver=o.onBeforeCameraRenderObservable.add((function(e){return f._checkUpdate(e)})),f._preKeyboardObserver=o.onPreKeyboardObservable.add((function(e){f._focusedControl&&(e.type===h.OG.KEYDOWN&&f._focusedControl.processKeyboard(e.event),e.skipOnPointerObservable=!0)})),f._rootContainer._link(f),f.hasAlpha=!0,i&&n||(f._resizeObserver=o.getEngine().onResizeObservable.add((function(){return f._onResize()})),f._onResize()),f._texture.isReady=!0,f):f}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"numLayoutCalls",{get:function(){return this._numLayoutCalls},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numRenderCalls",{get:function(){return this._numRenderCalls},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderScale",{get:function(){return this._renderScale},set:function(e){e!==this._renderScale&&(this._renderScale=e,this._onResize())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this.markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"idealWidth",{get:function(){return this._idealWidth},set:function(e){this._idealWidth!==e&&(this._idealWidth=e,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"idealHeight",{get:function(){return this._idealHeight},set:function(e){this._idealHeight!==e&&(this._idealHeight=e,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useSmallestIdeal",{get:function(){return this._useSmallestIdeal},set:function(e){this._useSmallestIdeal!==e&&(this._useSmallestIdeal=e,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderAtIdealSize",{get:function(){return this._renderAtIdealSize},set:function(e){this._renderAtIdealSize!==e&&(this._renderAtIdealSize=e,this._onResize())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"idealRatio",{get:function(){var e=0,t=0;return this._idealWidth&&(e=this.getSize().width/this._idealWidth),this._idealHeight&&(t=this.getSize().height/this._idealHeight),this._useSmallestIdeal&&this._idealWidth&&this._idealHeight?window.innerWidth1)return e.notRenderable=!0,"continue";e.notRenderable=!1,l.scaleInPlace(r.renderScale),e._moveToProjectedPosition(l)},r=this,a=0,l=this._linkedControls;a{"use strict";i.d(t,{W:()=>l});var n=i(655),r=i(3734),o=i(2040),s=i(5958),a=i(6132),l=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._children=new Array,i._measureForChildren=s.U.Empty(),i._background="",i._adaptWidthToChildren=!1,i._adaptHeightToChildren=!1,i.logLayoutCycleErrors=!1,i.maxLayoutCycle=3,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"adaptHeightToChildren",{get:function(){return this._adaptHeightToChildren},set:function(e){this._adaptHeightToChildren!==e&&(this._adaptHeightToChildren=e,e&&(this.height="100%"),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"adaptWidthToChildren",{get:function(){return this._adaptWidthToChildren},set:function(e){this._adaptWidthToChildren!==e&&(this._adaptWidthToChildren=e,e&&(this.width="100%"),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"Container"},t.prototype._flagDescendantsAsMatrixDirty=function(){for(var e=0,t=this.children;ee.zIndex){this._children.splice(i,0,e),t=!0;break}t||this._children.push(e),e.parent=this,this._markAsDirty()},t.prototype._offsetLeft=function(t){e.prototype._offsetLeft.call(this,t);for(var i=0,n=this._children;i=0&&(n+=this.paddingLeftInPixels+this.paddingRightInPixels,this.width!==n+"px"&&(this.width=n+"px",this._rebuildLayout=!0)),this.adaptHeightToChildren&&o>=0&&(o+=this.paddingTopInPixels+this.paddingBottomInPixels,this.height!==o+"px"&&(this.height=o+"px",this._rebuildLayout=!0)),this._postMeasure()}i++}while(this._rebuildLayout&&i=3&&this.logLayoutCycleErrors&&r.Y.Error("Layout cycle detected in GUI (Container name="+this.name+", uniqueId="+this.uniqueId+")"),t.restore(),this._isDirty&&(this.invalidateRect(),this._isDirty=!1),!0},t.prototype._postMeasure=function(){},t.prototype._draw=function(e,t){this._localDraw(e),this.clipChildren&&this._clipForChildren(e);for(var i=0,n=this._children;i=0;h--){var c=this._children[h];if(c._processPicking(t,i,n,r,o,s,a,l))return c.hoverCursor&&this._host._changeCursor(c.hoverCursor),!0}return!!this.isHitTestVisible&&this._processObservables(r,t,i,n,o,s,a,l)},t.prototype._additionalProcessing=function(t,i){e.prototype._additionalProcessing.call(this,t,i),this._measureForChildren.copyFrom(this._currentMeasure)},t.prototype.dispose=function(){e.prototype.dispose.call(this);for(var t=this.children.length-1;t>=0;t--)this.children[t].dispose()},t}(o.o);a.Q.RegisteredTypes["BABYLON.GUI.Container"]=l},2040:(e,t,i)=>{"use strict";i.d(t,{o:()=>_});var n=i(475),r=i(2973),o=i(5441),s=i(3734),a=i(5540),l=i(4872),h=i(5958),c=i(655),u=i(2782),f=function(e){function t(t,i){void 0===i&&(i=0);var n=e.call(this,t.x,t.y)||this;return n.buttonIndex=i,n}return(0,c.ZT)(t,e),t}(r.FM),d=function(){function e(e,t,i,n,r,o){this.m=new Float32Array(6),this.fromValues(e,t,i,n,r,o)}return e.prototype.fromValues=function(e,t,i,n,r,o){return this.m[0]=e,this.m[1]=t,this.m[2]=i,this.m[3]=n,this.m[4]=r,this.m[5]=o,this},e.prototype.determinant=function(){return this.m[0]*this.m[3]-this.m[1]*this.m[2]},e.prototype.invertToRef=function(e){var t=this.m[0],i=this.m[1],n=this.m[2],r=this.m[3],o=this.m[4],s=this.m[5],a=this.determinant();if(a1?this.notRenderable=!0:this.notRenderable=!1}else a.w1.Error("Cannot move a control to a vector3 if the control is not at root level")},e.prototype.getDescendantsToRef=function(e,t,i){void 0===t&&(t=!1)},e.prototype.getDescendants=function(e,t){var i=new Array;return this.getDescendantsToRef(i,e,t),i},e.prototype.linkWithMesh=function(t){if(!this._host||this.parent&&this.parent!==this._host._rootContainer)t&&a.w1.Error("Cannot link a control to a mesh if the control is not at root level");else{var i=this._host._linkedControls.indexOf(this);if(-1!==i)return this._linkedMesh=t,void(t||this._host._linkedControls.splice(i,1));t&&(this.horizontalAlignment=e.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=e.VERTICAL_ALIGNMENT_TOP,this._linkedMesh=t,this._host._linkedControls.push(this))}},e.prototype._moveToProjectedPosition=function(e){var t=this._left.getValue(this._host),i=this._top.getValue(this._host),n=e.x+this._linkOffsetX.getValue(this._host)-this._currentMeasure.width/2,r=e.y+this._linkOffsetY.getValue(this._host)-this._currentMeasure.height/2;this._left.ignoreAdaptiveScaling&&this._top.ignoreAdaptiveScaling&&(Math.abs(n-t)<.5&&(n=t),Math.abs(r-i)<.5&&(r=i)),this.left=n+"px",this.top=r+"px",this._left.ignoreAdaptiveScaling=!0,this._top.ignoreAdaptiveScaling=!0,this._markAsDirty()},e.prototype._offsetLeft=function(e){this._isDirty=!0,this._currentMeasure.left+=e},e.prototype._offsetTop=function(e){this._isDirty=!0,this._currentMeasure.top+=e},e.prototype._markMatrixAsDirty=function(){this._isMatrixDirty=!0,this._flagDescendantsAsMatrixDirty()},e.prototype._flagDescendantsAsMatrixDirty=function(){},e.prototype._intersectsRect=function(e){return this._currentMeasure.transformToRef(this._transformMatrix,this._tmpMeasureA),!(this._tmpMeasureA.left>=e.left+e.width)&&(!(this._tmpMeasureA.top>=e.top+e.height)&&(!(this._tmpMeasureA.left+this._tmpMeasureA.width<=e.left)&&!(this._tmpMeasureA.top+this._tmpMeasureA.height<=e.top)))},e.prototype.invalidateRect=function(){if(this._transform(),this.host&&this.host.useInvalidateRectOptimization)if(this._currentMeasure.transformToRef(this._transformMatrix,this._tmpMeasureA),h.U.CombineToRef(this._tmpMeasureA,this._prevCurrentMeasureTransformedIntoGlobalSpace,this._tmpMeasureA),this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY){var e=this.shadowOffsetX,t=this.shadowOffsetY,i=this.shadowBlur,n=Math.min(Math.min(e,0)-2*i,0),r=Math.max(Math.max(e,0)+2*i,0),o=Math.min(Math.min(t,0)-2*i,0),s=Math.max(Math.max(t,0)+2*i,0);this.host.invalidateRect(Math.floor(this._tmpMeasureA.left+n),Math.floor(this._tmpMeasureA.top+o),Math.ceil(this._tmpMeasureA.left+this._tmpMeasureA.width+r),Math.ceil(this._tmpMeasureA.top+this._tmpMeasureA.height+s))}else this.host.invalidateRect(Math.floor(this._tmpMeasureA.left),Math.floor(this._tmpMeasureA.top),Math.ceil(this._tmpMeasureA.left+this._tmpMeasureA.width),Math.ceil(this._tmpMeasureA.top+this._tmpMeasureA.height))},e.prototype._markAsDirty=function(e){void 0===e&&(e=!1),(this._isVisible||e)&&(this._isDirty=!0,this._host&&this._host.markAsDirty())},e.prototype._markAllAsDirty=function(){this._markAsDirty(),this._font&&this._prepareFont()},e.prototype._link=function(e){this._host=e,this._host&&(this.uniqueId=this._host.getScene().getUniqueId())},e.prototype._transform=function(e){if(this._isMatrixDirty||1!==this._scaleX||1!==this._scaleY||0!==this._rotation){var t=this._currentMeasure.width*this._transformCenterX+this._currentMeasure.left,i=this._currentMeasure.height*this._transformCenterY+this._currentMeasure.top;e&&(e.translate(t,i),e.rotate(this._rotation),e.scale(this._scaleX,this._scaleY),e.translate(-t,-i)),(this._isMatrixDirty||this._cachedOffsetX!==t||this._cachedOffsetY!==i)&&(this._cachedOffsetX=t,this._cachedOffsetY=i,this._isMatrixDirty=!1,this._flagDescendantsAsMatrixDirty(),d.ComposeToRef(-t,-i,this._rotation,this._scaleX,this._scaleY,this.parent?this.parent._transformMatrix:null,this._transformMatrix),this._transformMatrix.invertToRef(this._invertTransformMatrix))}},e.prototype._renderHighlight=function(e){this.isHighlighted&&(e.save(),e.strokeStyle="#4affff",e.lineWidth=2,this._renderHighlightSpecific(e),e.restore())},e.prototype._renderHighlightSpecific=function(e){e.strokeRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)},e.prototype._applyStates=function(t){this._isFontSizeInPercentage&&(this._fontSet=!0),this._fontSet&&(this._prepareFont(),this._fontSet=!1),this._font&&(t.font=this._font),this._color&&(t.fillStyle=this._color),e.AllowAlphaInheritance?t.globalAlpha*=this._alpha:this._alphaSet&&(t.globalAlpha=this.parent?this.parent.alpha*this._alpha:this._alpha)},e.prototype._layout=function(e,t){if(!this.isDirty&&(!this.isVisible||this.notRenderable))return!1;if(this._isDirty||!this._cachedParentMeasure.isEqualsTo(e)){this.host._numLayoutCalls++,this._currentMeasure.addAndTransformToRef(this._transformMatrix,0|-this.paddingLeftInPixels,0|-this.paddingTopInPixels,0|this.paddingRightInPixels,0|this.paddingBottomInPixels,this._prevCurrentMeasureTransformedIntoGlobalSpace),t.save(),this._applyStates(t);var i=0;do{this._rebuildLayout=!1,this._processMeasures(e,t),i++}while(this._rebuildLayout&&i<3);i>=3&&s.Y.Error("Layout cycle detected in GUI (Control name="+this.name+", uniqueId="+this.uniqueId+")"),t.restore(),this.invalidateRect(),this._evaluateClippingState(e)}return this._wasDirty=this._isDirty,this._isDirty=!1,!0},e.prototype._processMeasures=function(e,t){this._currentMeasure.copyFrom(e),this._preMeasure(e,t),this._measure(),this._computeAlignment(e,t),this._currentMeasure.left=0|this._currentMeasure.left,this._currentMeasure.top=0|this._currentMeasure.top,this._currentMeasure.width=0|this._currentMeasure.width,this._currentMeasure.height=0|this._currentMeasure.height,this._additionalProcessing(e,t),this._cachedParentMeasure.copyFrom(e),this.onDirtyObservable.hasObservers()&&this.onDirtyObservable.notifyObservers(this)},e.prototype._evaluateClippingState=function(e){if(this.parent&&this.parent.clipChildren){if(this._currentMeasure.left>e.left+e.width)return void(this._isClipped=!0);if(this._currentMeasure.left+this._currentMeasure.widthe.top+e.height)return void(this._isClipped=!0);if(this._currentMeasure.top+this._currentMeasure.heightthis._currentMeasure.left+this._currentMeasure.width)&&(!(tthis._currentMeasure.top+this._currentMeasure.height)&&(this.isPointerBlocker&&(this._host._shouldBlockPointer=!0),!0))))},e.prototype._processPicking=function(e,t,i,n,r,o,s,a){return!!this._isEnabled&&(!(!this.isHitTestVisible||!this.isVisible||this._doNotRender)&&(!!this.contains(e,t)&&(this._processObservables(n,e,t,i,r,o,s,a),!0)))},e.prototype._onPointerMove=function(e,t,i,n){this.onPointerMoveObservable.notifyObservers(t,-1,e,this,n)&&null!=this.parent&&this.parent._onPointerMove(e,t,i,n)},e.prototype._onPointerEnter=function(e,t){return!!this._isEnabled&&(!(this._enterCount>0)&&(-1===this._enterCount&&(this._enterCount=0),this._enterCount++,this.onPointerEnterObservable.notifyObservers(this,-1,e,this,t)&&null!=this.parent&&this.parent._onPointerEnter(e,t),!0))},e.prototype._onPointerOut=function(e,t,i){if(void 0===i&&(i=!1),i||this._isEnabled&&e!==this){this._enterCount=0;var n=!0;e.isAscendant(this)||(n=this.onPointerOutObservable.notifyObservers(this,-1,e,this,t)),n&&null!=this.parent&&this.parent._onPointerOut(e,t,i)}},e.prototype._onPointerDown=function(e,t,i,n,r){return this._onPointerEnter(this,r),0===this._downCount&&(this._downCount++,this._downPointerIds[i]=!0,this.onPointerDownObservable.notifyObservers(new f(t,n),-1,e,this,r)&&null!=this.parent&&this.parent._onPointerDown(e,t,i,n,r),!0)},e.prototype._onPointerUp=function(e,t,i,n,r,o){if(this._isEnabled){this._downCount=0,delete this._downPointerIds[i];var s=r;r&&(this._enterCount>0||-1===this._enterCount)&&(s=this.onPointerClickObservable.notifyObservers(new f(t,n),-1,e,this,o)),this.onPointerUpObservable.notifyObservers(new f(t,n),-1,e,this,o)&&null!=this.parent&&this.parent._onPointerUp(e,t,i,n,s,o)}},e.prototype._forcePointerUp=function(e){if(void 0===e&&(e=null),null!==e)this._onPointerUp(this,r.FM.Zero(),e,0,!0);else for(var t in this._downPointerIds)this._onPointerUp(this,r.FM.Zero(),+t,0,!0)},e.prototype._onWheelScroll=function(e,t){this._isEnabled&&(this.onWheelObservable.notifyObservers(new r.FM(e,t))&&null!=this.parent&&this.parent._onWheelScroll(e,t))},e.prototype._onCanvasBlur=function(){},e.prototype._processObservables=function(e,t,i,n,r,s,a,l){if(!this._isEnabled)return!1;if(this._dummyVector2.copyFromFloats(t,i),e===o.kD.POINTERMOVE){this._onPointerMove(this,this._dummyVector2,r,n);var h=this._host._lastControlOver[r];return h&&h!==this&&h._onPointerOut(this,n),h!==this&&this._onPointerEnter(this,n),this._host._lastControlOver[r]=this,!0}return e===o.kD.POINTERDOWN?(this._onPointerDown(this,this._dummyVector2,r,s,n),this._host._registerLastControlDown(this,r),this._host._lastPickedControl=this,!0):e===o.kD.POINTERUP?(this._host._lastControlDown[r]&&this._host._lastControlDown[r]._onPointerUp(this,this._dummyVector2,r,s,!0,n),delete this._host._lastControlDown[r],!0):!(e!==o.kD.POINTERWHEEL||!this._host._lastControlOver[r])&&(this._host._lastControlOver[r]._onWheelScroll(a,l),!0)},e.prototype._prepareFont=function(){(this._font||this._fontSet)&&(this._style?this._font=this._style.fontStyle+" "+this._style.fontWeight+" "+this.fontSizeInPixels+"px "+this._style.fontFamily:this._font=this._fontStyle+" "+this._fontWeight+" "+this.fontSizeInPixels+"px "+this._fontFamily,this._fontOffset=e._GetFontOffset(this._font))},e.prototype.dispose=function(){(this.onDirtyObservable.clear(),this.onBeforeDrawObservable.clear(),this.onAfterDrawObservable.clear(),this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this.onWheelObservable.clear(),this._styleObserver&&this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this.parent&&(this.parent.removeControl(this),this.parent=null),this._host)&&(this._host._linkedControls.indexOf(this)>-1&&this.linkWithMesh(null));this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},Object.defineProperty(e,"HORIZONTAL_ALIGNMENT_LEFT",{get:function(){return e._HORIZONTAL_ALIGNMENT_LEFT},enumerable:!1,configurable:!0}),Object.defineProperty(e,"HORIZONTAL_ALIGNMENT_RIGHT",{get:function(){return e._HORIZONTAL_ALIGNMENT_RIGHT},enumerable:!1,configurable:!0}),Object.defineProperty(e,"HORIZONTAL_ALIGNMENT_CENTER",{get:function(){return e._HORIZONTAL_ALIGNMENT_CENTER},enumerable:!1,configurable:!0}),Object.defineProperty(e,"VERTICAL_ALIGNMENT_TOP",{get:function(){return e._VERTICAL_ALIGNMENT_TOP},enumerable:!1,configurable:!0}),Object.defineProperty(e,"VERTICAL_ALIGNMENT_BOTTOM",{get:function(){return e._VERTICAL_ALIGNMENT_BOTTOM},enumerable:!1,configurable:!0}),Object.defineProperty(e,"VERTICAL_ALIGNMENT_CENTER",{get:function(){return e._VERTICAL_ALIGNMENT_CENTER},enumerable:!1,configurable:!0}),e._GetFontOffset=function(t){if(e._FontHeightSizes[t])return e._FontHeightSizes[t];var i=document.createElement("span");i.innerHTML="Hg",i.style.font=t;var n=document.createElement("div");n.style.display="inline-block",n.style.width="1px",n.style.height="0px",n.style.verticalAlign="bottom";var r=document.createElement("div");r.style.whiteSpace="nowrap",r.appendChild(i),r.appendChild(n),document.body.appendChild(r);var o=0,s=0;try{s=n.getBoundingClientRect().top-i.getBoundingClientRect().top,n.style.verticalAlign="baseline",o=n.getBoundingClientRect().top-i.getBoundingClientRect().top}finally{document.body.removeChild(r)}var a={ascent:o,height:s,descent:s-o};return e._FontHeightSizes[t]=a,a},e.drawEllipse=function(e,t,i,n,r){r.translate(e,t),r.scale(i,n),r.beginPath(),r.arc(0,0,1,0,2*Math.PI),r.closePath(),r.scale(1/i,1/n),r.translate(-e,-t)},e.AllowAlphaInheritance=!1,e._ClipMeasure=new h.U(0,0,0,0),e._HORIZONTAL_ALIGNMENT_LEFT=0,e._HORIZONTAL_ALIGNMENT_RIGHT=1,e._HORIZONTAL_ALIGNMENT_CENTER=2,e._VERTICAL_ALIGNMENT_TOP=0,e._VERTICAL_ALIGNMENT_BOTTOM=1,e._VERTICAL_ALIGNMENT_CENTER=2,e._FontHeightSizes={},e.AddHeader=function(){},e}();p.Q.RegisteredTypes["BABYLON.GUI.Control"]=_},8396:(e,t,i)=>{"use strict";i.r(t),i.d(t,{BaseSlider:()=>L,Button:()=>p,Checkbox:()=>g,CheckboxGroup:()=>F,ColorPicker:()=>E,Container:()=>r.W,Control:()=>l.o,DisplayGrid:()=>Y,Ellipse:()=>C,Grid:()=>T,Image:()=>d,ImageBasedSlider:()=>K,ImageScrollBar:()=>z,InputPassword:()=>x,InputText:()=>b,KeyPropertySet:()=>X,Line:()=>R,MultiLine:()=>O,RadioButton:()=>D,RadioGroup:()=>B,Rectangle:()=>s,ScrollBar:()=>H,ScrollViewer:()=>W,SelectionPanel:()=>k,SelectorGroup:()=>N,Slider:()=>w,SliderGroup:()=>U,StackPanel:()=>_,TextBlock:()=>u,TextWrapper:()=>y,TextWrapping:()=>a,VirtualKeyboard:()=>j,name:()=>q});var n=i(655),r=i(6397),o=i(6132),s=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._thickness=1,i._cornerRadius=0,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"thickness",{get:function(){return this._thickness},set:function(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cornerRadius",{get:function(){return this._cornerRadius},set:function(e){e<0&&(e=0),this._cornerRadius!==e&&(this._cornerRadius=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"Rectangle"},t.prototype._localDraw=function(e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._background&&(e.fillStyle=this._background,this._cornerRadius?(this._drawRoundedRect(e,this._thickness/2),e.fill()):e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._thickness&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,this._cornerRadius?(this._drawRoundedRect(e,this._thickness/2),e.stroke()):e.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),e.restore()},t.prototype._additionalProcessing=function(t,i){e.prototype._additionalProcessing.call(this,t,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},t.prototype._drawRoundedRect=function(e,t){void 0===t&&(t=0);var i=this._currentMeasure.left+t,n=this._currentMeasure.top+t,r=this._currentMeasure.width-2*t,o=this._currentMeasure.height-2*t,s=Math.min(o/2-2,Math.min(r/2-2,this._cornerRadius));e.beginPath(),e.moveTo(i+s,n),e.lineTo(i+r-s,n),e.quadraticCurveTo(i+r,n,i+r,n+s),e.lineTo(i+r,n+o-s),e.quadraticCurveTo(i+r,n+o,i+r-s,n+o),e.lineTo(i+s,n+o),e.quadraticCurveTo(i,n+o,i,n+o-s),e.lineTo(i,n+s),e.quadraticCurveTo(i,n,i+s,n),e.closePath()},t.prototype._clipForChildren=function(e){this._cornerRadius&&(this._drawRoundedRect(e,this._thickness),e.clip())},t}(r.W);o.Q.RegisteredTypes["BABYLON.GUI.Rectangle"]=s;var a,l=i(2040),h=i(475),c=i(4872);!function(e){e[e.Clip=0]="Clip",e[e.WordWrap=1]="WordWrap",e[e.Ellipsis=2]="Ellipsis"}(a||(a={}));var u=function(e){function t(t,i){void 0===i&&(i="");var n=e.call(this,t)||this;return n.name=t,n._text="",n._textWrapping=a.Clip,n._textHorizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_CENTER,n._textVerticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,n._resizeToFit=!1,n._lineSpacing=new c.s(0),n._outlineWidth=0,n._outlineColor="white",n._underline=!1,n._lineThrough=!1,n.onTextChangedObservable=new h.y$,n.onLinesReadyObservable=new h.y$,n.text=i,n}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"lines",{get:function(){return this._lines},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resizeToFit",{get:function(){return this._resizeToFit},set:function(e){this._resizeToFit!==e&&(this._resizeToFit=e,this._resizeToFit&&(this._width.ignoreAdaptiveScaling=!0,this._height.ignoreAdaptiveScaling=!0),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textWrapping",{get:function(){return this._textWrapping},set:function(e){this._textWrapping!==e&&(this._textWrapping=+e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(e){this._text!==e&&(this._text=e,this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textHorizontalAlignment",{get:function(){return this._textHorizontalAlignment},set:function(e){this._textHorizontalAlignment!==e&&(this._textHorizontalAlignment=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textVerticalAlignment",{get:function(){return this._textVerticalAlignment},set:function(e){this._textVerticalAlignment!==e&&(this._textVerticalAlignment=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineSpacing",{get:function(){return this._lineSpacing.toString(this._host)},set:function(e){this._lineSpacing.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"underline",{get:function(){return this._underline},set:function(e){this._underline!==e&&(this._underline=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineThrough",{get:function(){return this._lineThrough},set:function(e){this._lineThrough!==e&&(this._lineThrough=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(e){this._outlineColor!==e&&(this._outlineColor=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"TextBlock"},t.prototype._processMeasures=function(t,i){this._fontOffset||(this._fontOffset=l.o._GetFontOffset(i.font)),e.prototype._processMeasures.call(this,t,i),this._lines=this._breakLines(this._currentMeasure.width,i),this.onLinesReadyObservable.notifyObservers(this);for(var n=0,r=0;rn&&(n=o.width)}if(this._resizeToFit){if(this._textWrapping===a.Clip){var s=this.paddingLeftInPixels+this.paddingRightInPixels+n|0;s!==this._width.internalValue&&(this._width.updateInPlace(s,c.s.UNITMODE_PIXEL),this._rebuildLayout=!0)}var h=this.paddingTopInPixels+this.paddingBottomInPixels+this._fontOffset.height*this._lines.length|0;if(this._lines.length>0&&0!==this._lineSpacing.internalValue){var u=0;u=this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height),h+=(this._lines.length-1)*u}h!==this._height.internalValue&&(this._height.updateInPlace(h,c.s.UNITMODE_PIXEL),this._rebuildLayout=!0)}},t.prototype._drawText=function(e,t,i,n){var r=this._currentMeasure.width,o=0;switch(this._textHorizontalAlignment){case l.o.HORIZONTAL_ALIGNMENT_LEFT:o=0;break;case l.o.HORIZONTAL_ALIGNMENT_RIGHT:o=r-t;break;case l.o.HORIZONTAL_ALIGNMENT_CENTER:o=(r-t)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&n.strokeText(e,this._currentMeasure.left+o,i),n.fillText(e,this._currentMeasure.left+o,i),this._underline&&(n.beginPath(),n.lineWidth=Math.round(.05*this.fontSizeInPixels),n.moveTo(this._currentMeasure.left+o,i+3),n.lineTo(this._currentMeasure.left+o+t,i+3),n.stroke(),n.closePath()),this._lineThrough&&(n.beginPath(),n.lineWidth=Math.round(.05*this.fontSizeInPixels),n.moveTo(this._currentMeasure.left+o,i-this.fontSizeInPixels/3),n.lineTo(this._currentMeasure.left+o+t,i-this.fontSizeInPixels/3),n.stroke(),n.closePath())},t.prototype._draw=function(e,t){e.save(),this._applyStates(e),this._renderLines(e),e.restore()},t.prototype._applyStates=function(t){e.prototype._applyStates.call(this,t),this.outlineWidth&&(t.lineWidth=this.outlineWidth,t.strokeStyle=this.outlineColor,t.lineJoin="miter",t.miterLimit=2)},t.prototype._breakLines=function(e,t){var i=[],n=this.text.split("\n");if(this._textWrapping===a.Ellipsis)for(var r=0,o=n;rt&&(e+="…");var r=Array.from&&Array.from(e);if(r)for(;r.length&&n>t;)r.pop(),e=r.join("")+"...",n=i.measureText(e).width;else for(;e.length>2&&n>t;)e=e.slice(0,-2)+"…",n=i.measureText(e).width;return{text:e,width:n}},t.prototype._parseLineWordWrap=function(e,t,i){void 0===e&&(e="");for(var n=[],r=this.wordSplittingFunction?this.wordSplittingFunction(e):e.split(" "),o=0,s=0;s0?e+" "+r[s]:r[0],l=i.measureText(a).width;l>t&&s>0?(n.push({text:e,width:o}),e=r[s],o=i.measureText(e).width):(o=l,e=a)}return n.push({text:e,width:o}),n},t.prototype._renderLines=function(e){var t=this._currentMeasure.height,i=0;switch(this._textVerticalAlignment){case l.o.VERTICAL_ALIGNMENT_TOP:i=this._fontOffset.ascent;break;case l.o.VERTICAL_ALIGNMENT_BOTTOM:i=t-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case l.o.VERTICAL_ALIGNMENT_CENTER:i=this._fontOffset.ascent+(t-this._fontOffset.height*this._lines.length)/2}i+=this._currentMeasure.top;for(var n=0;n0&&0!==this._lineSpacing.internalValue){var n=0;n=this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height),i+=(t.length-1)*n}return i}}return 0},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onTextChangedObservable.clear()},t}(l.o);o.Q.RegisteredTypes["BABYLON.GUI.TextBlock"]=u;var f=i(5540),d=function(e){function t(i,n){void 0===n&&(n=null);var r=e.call(this,i)||this;return r.name=i,r._workingCanvas=null,r._loaded=!1,r._stretch=t.STRETCH_FILL,r._autoScale=!1,r._sourceLeft=0,r._sourceTop=0,r._sourceWidth=0,r._sourceHeight=0,r._svgAttributesComputationCompleted=!1,r._isSVG=!1,r._cellWidth=0,r._cellHeight=0,r._cellId=-1,r._populateNinePatchSlicesFromImage=!1,r._imageDataCache={data:null,key:""},r.onImageLoadedObservable=new h.y$,r.onSVGAttributesComputedObservable=new h.y$,r.source=n,r}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"isLoaded",{get:function(){return this._loaded},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"populateNinePatchSlicesFromImage",{get:function(){return this._populateNinePatchSlicesFromImage},set:function(e){this._populateNinePatchSlicesFromImage!==e&&(this._populateNinePatchSlicesFromImage=e,this._populateNinePatchSlicesFromImage&&this._loaded&&this._extractNinePatchSliceDataFromImage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"detectPointerOnOpaqueOnly",{get:function(){return this._detectPointerOnOpaqueOnly},set:function(e){this._detectPointerOnOpaqueOnly!==e&&(this._detectPointerOnOpaqueOnly=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sliceLeft",{get:function(){return this._sliceLeft},set:function(e){this._sliceLeft!==e&&(this._sliceLeft=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sliceRight",{get:function(){return this._sliceRight},set:function(e){this._sliceRight!==e&&(this._sliceRight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sliceTop",{get:function(){return this._sliceTop},set:function(e){this._sliceTop!==e&&(this._sliceTop=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sliceBottom",{get:function(){return this._sliceBottom},set:function(e){this._sliceBottom!==e&&(this._sliceBottom=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sourceLeft",{get:function(){return this._sourceLeft},set:function(e){this._sourceLeft!==e&&(this._sourceLeft=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sourceTop",{get:function(){return this._sourceTop},set:function(e){this._sourceTop!==e&&(this._sourceTop=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sourceWidth",{get:function(){return this._sourceWidth},set:function(e){this._sourceWidth!==e&&(this._sourceWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sourceHeight",{get:function(){return this._sourceHeight},set:function(e){this._sourceHeight!==e&&(this._sourceHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSVG",{get:function(){return this._isSVG},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"svgAttributesComputationCompleted",{get:function(){return this._svgAttributesComputationCompleted},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoScale",{get:function(){return this._autoScale},set:function(e){this._autoScale!==e&&(this._autoScale=e,e&&this._loaded&&this.synchronizeSizeWithContent())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stretch",{get:function(){return this._stretch},set:function(e){this._stretch!==e&&(this._stretch=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._rotate90=function(e,i){void 0===i&&(i=!1);var n=document.createElement("canvas"),r=n.getContext("2d"),o=this._domImage.width,s=this._domImage.height;n.width=s,n.height=o,r.translate(n.width/2,n.height/2),r.rotate(e*Math.PI/2),r.drawImage(this._domImage,0,0,o,s,-o/2,-s/2,o,s);var a=n.toDataURL("image/jpg"),l=new t(this.name+"rotated",a);return i&&(l._stretch=this._stretch,l._autoScale=this._autoScale,l._cellId=this._cellId,l._cellWidth=e%1?this._cellHeight:this._cellWidth,l._cellHeight=e%1?this._cellWidth:this._cellHeight),this._handleRotationForSVGImage(this,l,e),this._imageDataCache.data=null,l},t.prototype._handleRotationForSVGImage=function(e,t,i){var n=this;e._isSVG&&(e._svgAttributesComputationCompleted?(this._rotate90SourceProperties(e,t,i),this._markAsDirty()):e.onSVGAttributesComputedObservable.addOnce((function(){n._rotate90SourceProperties(e,t,i),n._markAsDirty()})))},t.prototype._rotate90SourceProperties=function(e,t,i){var n,r,o=e.sourceLeft,s=e.sourceTop,a=e.domImage.width,l=e.domImage.height,h=o,c=s,u=e.sourceWidth,f=e.sourceHeight;if(0!=i){var d=i<0?-1:1;i%=4;for(var p=0;p127&&-1===this._sliceLeft)this._sliceLeft=o;else if(a<127&&this._sliceLeft>-1){this._sliceRight=o;break}}this._sliceTop=-1,this._sliceBottom=-1;for(var s=0;s127&&-1===this._sliceTop)this._sliceTop=s;else if(a<127&&this._sliceTop>-1){this._sliceBottom=s;break}}},Object.defineProperty(t.prototype,"source",{set:function(e){var t=this;this._source!==e&&(this._loaded=!1,this._source=e,this._imageDataCache.data=null,e&&(e=this._svgCheck(e)),this._domImage=document.createElement("img"),this._domImage.onload=function(){t._onImageLoaded()},e&&(f.w1.SetCorsBehavior(e,this._domImage),this._domImage.src=e))},enumerable:!1,configurable:!0}),t.prototype._svgCheck=function(e){var t=this;if(window.SVGSVGElement&&-1!==e.search(/.svg#/gi)&&e.indexOf("#")===e.lastIndexOf("#")){this._isSVG=!0;var i=e.split("#")[0],n=e.split("#")[1],r=document.body.querySelector('object[data="'+i+'"]');if(r){var o=r.contentDocument;if(o&&o.documentElement){var s=o.documentElement.getAttribute("viewBox"),a=Number(o.documentElement.getAttribute("width")),l=Number(o.documentElement.getAttribute("height"));if(o.getElementById(n)&&s&&a&&l)return this._getSVGAttribs(r,n),e}r.addEventListener("load",(function(){t._getSVGAttribs(r,n)}))}else{var h=document.createElement("object");h.data=i,h.type="image/svg+xml",h.width="0%",h.height="0%",document.body.appendChild(h),h.onload=function(){var e=document.body.querySelector('object[data="'+i+'"]');e&&t._getSVGAttribs(e,n)}}return i}return e},t.prototype._getSVGAttribs=function(e,t){var i=e.contentDocument;if(i&&i.documentElement){var n=i.documentElement.getAttribute("viewBox"),r=Number(i.documentElement.getAttribute("width")),o=Number(i.documentElement.getAttribute("height")),s=i.getElementById(t);if(n&&r&&o&&s){var a=Number(n.split(" ")[2]),l=Number(n.split(" ")[3]),h=s.getBBox(),c=1,u=1,f=0,d=0;s.transform&&s.transform.baseVal.consolidate()&&(c=s.transform.baseVal.consolidate().matrix.a,u=s.transform.baseVal.consolidate().matrix.d,f=s.transform.baseVal.consolidate().matrix.e,d=s.transform.baseVal.consolidate().matrix.f),this.sourceLeft=(c*h.x+f)*r/a,this.sourceTop=(u*h.y+d)*o/l,this.sourceWidth=h.width*c*(r/a),this.sourceHeight=h.height*u*(o/l),this._svgAttributesComputationCompleted=!0,this.onSVGAttributesComputedObservable.notifyObservers(this)}}},Object.defineProperty(t.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(e){this._cellWidth!==e&&(this._cellWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(e){this._cellHeight!==e&&(this._cellHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cellId",{get:function(){return this._cellId},set:function(e){this._cellId!==e&&(this._cellId=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype.contains=function(t,i){if(!e.prototype.contains.call(this,t,i))return!1;if(!this._detectPointerOnOpaqueOnly||!this._workingCanvas)return!0;var n=0|this._currentMeasure.width,r=0|this._currentMeasure.height,o=n+"_"+r,s=this._imageDataCache.data;if(!s||this._imageDataCache.key!==o){var a=this._workingCanvas.getContext("2d");this._imageDataCache.data=s=a.getImageData(0,0,n,r).data,this._imageDataCache.key=o}return s[4*((t=t-this._currentMeasure.left|0)+(i=i-this._currentMeasure.top|0)*n)+3]>0},t.prototype._getTypeName=function(){return"Image"},t.prototype.synchronizeSizeWithContent=function(){this._loaded&&(this.width=this._domImage.width+"px",this.height=this._domImage.height+"px")},t.prototype._processMeasures=function(i,n){if(this._loaded)switch(this._stretch){case t.STRETCH_NONE:case t.STRETCH_FILL:case t.STRETCH_UNIFORM:case t.STRETCH_NINE_PATCH:break;case t.STRETCH_EXTEND:this._autoScale&&this.synchronizeSizeWithContent(),this.parent&&this.parent.parent&&(this.parent.adaptWidthToChildren=!0,this.parent.adaptHeightToChildren=!0)}e.prototype._processMeasures.call(this,i,n)},t.prototype._prepareWorkingCanvasForOpaqueDetection=function(){if(this._detectPointerOnOpaqueOnly){this._workingCanvas||(this._workingCanvas=document.createElement("canvas"));var e=this._workingCanvas,t=this._currentMeasure.width,i=this._currentMeasure.height,n=e.getContext("2d");e.width=t,e.height=i,n.clearRect(0,0,t,i)}},t.prototype._drawImage=function(e,t,i,n,r,o,s,a,l){(e.drawImage(this._domImage,t,i,n,r,o,s,a,l),this._detectPointerOnOpaqueOnly)&&(e=this._workingCanvas.getContext("2d")).drawImage(this._domImage,t,i,n,r,o-this._currentMeasure.left,s-this._currentMeasure.top,a,l)},t.prototype._draw=function(e){var i,n,r,o;if(e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),-1==this.cellId)i=this._sourceLeft,n=this._sourceTop,r=this._sourceWidth?this._sourceWidth:this._imageWidth,o=this._sourceHeight?this._sourceHeight:this._imageHeight;else{var s=this._domImage.naturalWidth/this.cellWidth,a=this.cellId/s>>0,l=this.cellId%s;i=this.cellWidth*l,n=this.cellHeight*a,r=this.cellWidth,o=this.cellHeight}if(this._prepareWorkingCanvasForOpaqueDetection(),this._applyStates(e),this._loaded)switch(this._stretch){case t.STRETCH_NONE:case t.STRETCH_FILL:this._drawImage(e,i,n,r,o,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case t.STRETCH_UNIFORM:var h=this._currentMeasure.width/r,c=this._currentMeasure.height/o,u=Math.min(h,c),f=(this._currentMeasure.width-r*u)/2,d=(this._currentMeasure.height-o*u)/2;this._drawImage(e,i,n,r,o,this._currentMeasure.left+f,this._currentMeasure.top+d,r*u,o*u);break;case t.STRETCH_EXTEND:this._drawImage(e,i,n,r,o,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case t.STRETCH_NINE_PATCH:this._renderNinePatch(e)}e.restore()},t.prototype._renderCornerPatch=function(e,t,i,n,r,o,s){this._drawImage(e,t,i,n,r,this._currentMeasure.left+o,this._currentMeasure.top+s,n,r)},t.prototype._renderNinePatch=function(e){var t=this._imageHeight,i=this._sliceLeft,n=this._sliceTop,r=this._imageHeight-this._sliceBottom,o=this._imageWidth-this._sliceRight,s=0,a=0;this._populateNinePatchSlicesFromImage&&(s=1,a=1,t-=2,i-=1,n-=1,r-=1,o-=1);var l=this._sliceRight-this._sliceLeft,h=this._currentMeasure.width-o-this.sliceLeft,c=this._currentMeasure.height-t+this._sliceBottom;this._renderCornerPatch(e,s,a,i,n,0,0),this._renderCornerPatch(e,s,this._sliceBottom,i,t-this._sliceBottom,0,c),this._renderCornerPatch(e,this._sliceRight,a,o,n,this._currentMeasure.width-o,0),this._renderCornerPatch(e,this._sliceRight,this._sliceBottom,o,t-this._sliceBottom,this._currentMeasure.width-o,c),this._drawImage(e,this._sliceLeft,this._sliceTop,l,this._sliceBottom-this._sliceTop,this._currentMeasure.left+i,this._currentMeasure.top+n,h,c-n),this._drawImage(e,s,this._sliceTop,i,this._sliceBottom-this._sliceTop,this._currentMeasure.left,this._currentMeasure.top+n,i,c-n),this._drawImage(e,this._sliceRight,this._sliceTop,i,this._sliceBottom-this._sliceTop,this._currentMeasure.left+this._currentMeasure.width-o,this._currentMeasure.top+n,i,c-n),this._drawImage(e,this._sliceLeft,a,l,n,this._currentMeasure.left+i,this._currentMeasure.top,h,n),this._drawImage(e,this._sliceLeft,this._sliceBottom,l,r,this._currentMeasure.left+i,this._currentMeasure.top+c,h,r)},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onImageLoadedObservable.clear(),this.onSVGAttributesComputedObservable.clear()},t.STRETCH_NONE=0,t.STRETCH_FILL=1,t.STRETCH_UNIFORM=2,t.STRETCH_EXTEND=3,t.STRETCH_NINE_PATCH=4,t}(l.o);o.Q.RegisteredTypes["BABYLON.GUI.Image"]=d;var p=function(e){function t(t){var i=e.call(this,t)||this;i.name=t,i.delegatePickingToChildren=!1,i.thickness=1,i.isPointerBlocker=!0;var n=null;return i.pointerEnterAnimation=function(){n=i.alpha,i.alpha-=.1},i.pointerOutAnimation=function(){null!==n&&(i.alpha=n)},i.pointerDownAnimation=function(){i.scaleX-=.05,i.scaleY-=.05},i.pointerUpAnimation=function(){i.scaleX+=.05,i.scaleY+=.05},i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"image",{get:function(){return this._image},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textBlock",{get:function(){return this._textBlock},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"Button"},t.prototype._processPicking=function(t,i,n,r,o,s,a,l){if(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this.notRenderable)return!1;if(!e.prototype.contains.call(this,t,i))return!1;if(this.delegatePickingToChildren){for(var h=!1,c=this._children.length-1;c>=0;c--){var u=this._children[c];if(u.isEnabled&&u.isHitTestVisible&&u.isVisible&&!u.notRenderable&&u.contains(t,i)){h=!0;break}}if(!h)return!1}return this._processObservables(r,t,i,n,o,s,a,l),!0},t.prototype._onPointerEnter=function(t,i){return!!e.prototype._onPointerEnter.call(this,t,i)&&(this.pointerEnterAnimation&&this.pointerEnterAnimation(),!0)},t.prototype._onPointerOut=function(t,i,n){void 0===n&&(n=!1),this.pointerOutAnimation&&this.pointerOutAnimation(),e.prototype._onPointerOut.call(this,t,i,n)},t.prototype._onPointerDown=function(t,i,n,r,o){return!!e.prototype._onPointerDown.call(this,t,i,n,r,o)&&(this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},t.prototype._onPointerUp=function(t,i,n,r,o,s){this.pointerUpAnimation&&this.pointerUpAnimation(),e.prototype._onPointerUp.call(this,t,i,n,r,o,s)},t.CreateImageButton=function(e,i,n){var r=new t(e),o=new u(e+"_button",i);o.textWrapping=!0,o.textHorizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_CENTER,o.paddingLeft="20%",r.addControl(o);var s=new d(e+"_icon",n);return s.width="20%",s.stretch=d.STRETCH_UNIFORM,s.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,r.addControl(s),r._image=s,r._textBlock=o,r},t.CreateImageOnlyButton=function(e,i){var n=new t(e),r=new d(e+"_icon",i);return r.stretch=d.STRETCH_FILL,r.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,n.addControl(r),n._image=r,n},t.CreateSimpleButton=function(e,i){var n=new t(e),r=new u(e+"_button",i);return r.textWrapping=!0,r.textHorizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_CENTER,n.addControl(r),n._textBlock=r,n},t.CreateImageWithCenterTextButton=function(e,i,n){var r=new t(e),o=new d(e+"_icon",n);o.stretch=d.STRETCH_FILL,r.addControl(o);var s=new u(e+"_button",i);return s.textWrapping=!0,s.textHorizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_CENTER,r.addControl(s),r._image=o,r._textBlock=s,r},t}(s);o.Q.RegisteredTypes["BABYLON.GUI.Button"]=p;var _=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._isVertical=!0,i._manualWidth=!1,i._manualHeight=!1,i._doNotTrackManualChanges=!1,i.ignoreLayoutWarnings=!1,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"isVertical",{get:function(){return this._isVertical},set:function(e){this._isVertical!==e&&(this._isVertical=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(e){this._doNotTrackManualChanges||(this._manualWidth=!0),this._width.toString(this._host)!==e&&this._width.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(e){this._doNotTrackManualChanges||(this._manualHeight=!0),this._height.toString(this._host)!==e&&this._height.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"StackPanel"},t.prototype._preMeasure=function(t,i){for(var n=0,r=this._children;n=0?Math.min(e,this._characters.length):this._characters.length+Math.max(e,-this._characters.length),void 0===t?t=this._characters.length-e:(isNaN(t)||t<0)&&(t=0);for(var i=[];--t>=0;)i[t]=this._characters[e+t];return i.join("")}return this._text.substr(e,t)},e.prototype.substring=function(e,t){if(this._characters){isNaN(e)?e=0:e>this._characters.length?e=this._characters.length:e<0&&(e=0),void 0===t?t=this._characters.length:isNaN(t)?t=0:t>this._characters.length?t=this._characters.length:t<0&&(t=0);for(var i=[],n=0;e0){if(this._isTextHighlightOn)return this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this._isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this._blinkIsEven=!1,void(i&&i.preventDefault());if(0===this._cursorOffset)this.text=this._textWrapper.substr(0,this._textWrapper.length-1);else(n=this._textWrapper.length-this._cursorOffset)>0&&(this._textWrapper.removePart(n-1,n),this._textHasChanged())}return void(i&&i.preventDefault());case 46:if(this._isTextHighlightOn)return this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this._isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,void(i&&i.preventDefault());if(this._textWrapper.text&&this._textWrapper.length>0&&this._cursorOffset>0){var n=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(n,n+1),this._textHasChanged(),this._cursorOffset--}return void(i&&i.preventDefault());case 13:return this._host.focusedControl=null,void(this._isTextHighlightOn=!1);case 35:return this._cursorOffset=0,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case 36:return this._cursorOffset=this._textWrapper.length,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case 37:if(this._cursorOffset++,this._cursorOffset>this._textWrapper.length&&(this._cursorOffset=this._textWrapper.length),i&&i.shiftKey){if(this._blinkIsEven=!1,i.ctrlKey||i.metaKey){if(!this._isTextHighlightOn){if(this._textWrapper.length===this._cursorOffset)return;this._endHighlightIndex=this._textWrapper.length-this._cursorOffset+1}return this._startHighlightIndex=0,this._cursorIndex=this._textWrapper.length-this._endHighlightIndex,this._cursorOffset=this._textWrapper.length,this._isTextHighlightOn=!0,void this._markAsDirty()}return this._isTextHighlightOn?-1===this._cursorIndex&&(this._cursorIndex=this._textWrapper.length-this._endHighlightIndex,this._cursorOffset=0===this._startHighlightIndex?this._textWrapper.length:this._textWrapper.length-this._startHighlightIndex+1):(this._isTextHighlightOn=!0,this._cursorIndex=this._cursorOffset>=this._textWrapper.length?this._textWrapper.length:this._cursorOffset-1),this._cursorIndexthis._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex):this._isTextHighlightOn=!1,void this._markAsDirty()}return this._isTextHighlightOn&&(this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this._isTextHighlightOn=!1),i&&(i.ctrlKey||i.metaKey)&&(this._cursorOffset=this._textWrapper.length,i.preventDefault()),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._cursorIndex=-1,void this._markAsDirty();case 39:if(this._cursorOffset--,this._cursorOffset<0&&(this._cursorOffset=0),i&&i.shiftKey){if(this._blinkIsEven=!1,i.ctrlKey||i.metaKey){if(!this._isTextHighlightOn){if(0===this._cursorOffset)return;this._startHighlightIndex=this._textWrapper.length-this._cursorOffset-1}return this._endHighlightIndex=this._textWrapper.length,this._isTextHighlightOn=!0,this._cursorIndex=this._textWrapper.length-this._startHighlightIndex,this._cursorOffset=0,void this._markAsDirty()}return this._isTextHighlightOn?-1===this._cursorIndex&&(this._cursorIndex=this._textWrapper.length-this._startHighlightIndex,this._cursorOffset=this._textWrapper.length===this._endHighlightIndex?0:this._textWrapper.length-this._endHighlightIndex-1):(this._isTextHighlightOn=!0,this._cursorIndex=this._cursorOffset<=0?0:this._cursorOffset+1),this._cursorIndexthis._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex):this._isTextHighlightOn=!1,void this._markAsDirty()}return this._isTextHighlightOn&&(this._cursorOffset=this._textWrapper.length-this._endHighlightIndex,this._isTextHighlightOn=!1),i&&(i.ctrlKey||i.metaKey)&&(this._cursorOffset=0,i.preventDefault()),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._cursorIndex=-1,void this._markAsDirty();case 222:i&&i.preventDefault(),this._cursorIndex=-1,this.deadKey=!0}if(t&&(-1===e||32===e||e>47&&e<64||e>64&&e<91||e>159&&e<193||e>218&&e<223||e>95&&e<112)&&(this._currentKey=t,this.onBeforeKeyAddObservable.notifyObservers(this),t=this._currentKey,this._addKey))if(this._isTextHighlightOn)this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex,t),this._textHasChanged(),this._cursorOffset=this._textWrapper.length-(this._startHighlightIndex+1),this._isTextHighlightOn=!1,this._blinkIsEven=!1,this._markAsDirty();else if(0===this._cursorOffset)this.text+=t;else{var r=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(r,r,t),this._textHasChanged()}}},t.prototype._updateValueFromCursorIndex=function(e){if(this._blinkIsEven=!1,-1===this._cursorIndex)this._cursorIndex=e;else if(this._cursorIndexthis._cursorOffset))return this._isTextHighlightOn=!1,void this._markAsDirty();this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex}this._isTextHighlightOn=!0,this._markAsDirty()},t.prototype._processDblClick=function(e){var t,i;this._startHighlightIndex=this._textWrapper.length-this._cursorOffset,this._endHighlightIndex=this._startHighlightIndex;do{i=this._endHighlightIndex0&&this._textWrapper.isWord(this._startHighlightIndex-1)?--this._startHighlightIndex:0}while(t||i);this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this.onTextHighlightObservable.notifyObservers(this),this._isTextHighlightOn=!0,this._clickedCoordinate=null,this._blinkIsEven=!0,this._cursorIndex=-1,this._markAsDirty()},t.prototype._selectAllText=function(){this._blinkIsEven=!0,this._isTextHighlightOn=!0,this._startHighlightIndex=0,this._endHighlightIndex=this._textWrapper.length,this._cursorOffset=this._textWrapper.length,this._cursorIndex=-1,this._markAsDirty()},t.prototype.processKeyboard=function(e){this.processKey(e.keyCode,e.key,e),this.onKeyboardEventProcessedObservable.notifyObservers(e)},t.prototype._onCopyText=function(e){this._isTextHighlightOn=!1;try{e.clipboardData&&e.clipboardData.setData("text/plain",this._highlightedText)}catch(e){}this._host.clipboardData=this._highlightedText},t.prototype._onCutText=function(e){if(this._highlightedText){this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this._isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex;try{e.clipboardData&&e.clipboardData.setData("text/plain",this._highlightedText)}catch(e){}this._host.clipboardData=this._highlightedText,this._highlightedText=""}},t.prototype._onPasteText=function(e){var t="";t=e.clipboardData&&-1!==e.clipboardData.types.indexOf("text/plain")?e.clipboardData.getData("text/plain"):this._host.clipboardData;var i=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(i,i,t),this._textHasChanged()},t.prototype._draw=function(e,t){var i=this;e.save(),this._applyStates(e),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._isFocused?this._focusedBackground&&(e.fillStyle=this._isEnabled?this._focusedBackground:this._disabledColor,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._fontOffset||(this._fontOffset=l.o._GetFontOffset(e.font));var n=this._currentMeasure.left+this._margin.getValueInPixel(this._host,this._tempParentMeasure.width);this.color&&(e.fillStyle=this.color);var r=this._beforeRenderText(this._textWrapper);this._isFocused||this._textWrapper.text||!this._placeholderText||((r=new y).text=this._placeholderText,this._placeholderColor&&(e.fillStyle=this._placeholderColor)),this._textWidth=e.measureText(r.text).width;var o=2*this._margin.getValueInPixel(this._host,this._tempParentMeasure.width);this._autoStretchWidth&&(this.width=Math.min(this._maxWidth.getValueInPixel(this._host,this._tempParentMeasure.width),this._textWidth+o)+"px");var s=this._fontOffset.ascent+(this._currentMeasure.height-this._fontOffset.height)/2,a=this._width.getValueInPixel(this._host,this._tempParentMeasure.width)-o;if(e.save(),e.beginPath(),e.rect(n,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,a+2,this._currentMeasure.height),e.clip(),this._isFocused&&this._textWidth>a){var h=n-this._textWidth+a;this._scrollLeft||(this._scrollLeft=h)}else this._scrollLeft=n;if(e.fillText(r.text,this._scrollLeft,this._currentMeasure.top+s),this._isFocused){if(this._clickedCoordinate){var c=this._scrollLeft+this._textWidth-this._clickedCoordinate,u=0;this._cursorOffset=0;var f=0;do{this._cursorOffset&&(f=Math.abs(c-u)),this._cursorOffset++,u=e.measureText(r.substr(r.length-this._cursorOffset,this._cursorOffset)).width}while(u=this._cursorOffset);Math.abs(c-u)>f&&this._cursorOffset--,this._blinkIsEven=!1,this._clickedCoordinate=null}if(!this._blinkIsEven){var d=r.substr(r.length-this._cursorOffset),p=e.measureText(d).width,_=this._scrollLeft+this._textWidth-p;_n+a&&(this._scrollLeft+=n+a-_,_=n+a,this._markAsDirty()),this._isTextHighlightOn||e.fillRect(_,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,2,this._fontOffset.height)}if(clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((function(){i._blinkIsEven=!i._blinkIsEven,i._markAsDirty()}),500),this._isTextHighlightOn){clearTimeout(this._blinkTimeout);var g=e.measureText(r.substring(this._startHighlightIndex)).width,m=this._scrollLeft+this._textWidth-g;this._highlightedText=r.substring(this._startHighlightIndex,this._endHighlightIndex);var v=e.measureText(r.substring(this._startHighlightIndex,this._endHighlightIndex)).width;m=this._rowDefinitions.length?null:this._rowDefinitions[e]},t.prototype.getColumnDefinition=function(e){return e<0||e>=this._columnDefinitions.length?null:this._columnDefinitions[e]},t.prototype.addRowDefinition=function(e,t){return void 0===t&&(t=!1),this._rowDefinitions.push(new c.s(e,t?c.s.UNITMODE_PIXEL:c.s.UNITMODE_PERCENTAGE)),this._markAsDirty(),this},t.prototype.addColumnDefinition=function(e,t){return void 0===t&&(t=!1),this._columnDefinitions.push(new c.s(e,t?c.s.UNITMODE_PIXEL:c.s.UNITMODE_PERCENTAGE)),this._markAsDirty(),this},t.prototype.setRowDefinition=function(e,t,i){if(void 0===i&&(i=!1),e<0||e>=this._rowDefinitions.length)return this;var n=this._rowDefinitions[e];return n&&n.isPixel===i&&n.internalValue===t||(this._rowDefinitions[e]=new c.s(t,i?c.s.UNITMODE_PIXEL:c.s.UNITMODE_PERCENTAGE),this._markAsDirty()),this},t.prototype.setColumnDefinition=function(e,t,i){if(void 0===i&&(i=!1),e<0||e>=this._columnDefinitions.length)return this;var n=this._columnDefinitions[e];return n&&n.isPixel===i&&n.internalValue===t||(this._columnDefinitions[e]=new c.s(t,i?c.s.UNITMODE_PIXEL:c.s.UNITMODE_PERCENTAGE),this._markAsDirty()),this},t.prototype.getChildrenAt=function(e,t){var i=this._cells[e+":"+t];return i?i.children:null},t.prototype.getChildCellInfo=function(e){return e._tag},t.prototype._removeCell=function(t,i){if(t){e.prototype.removeControl.call(this,t);for(var n=0,r=t.children;n=this._columnDefinitions.length)return this;for(var t=0;t=this._rowDefinitions.length)return this;for(var t=0;t=1-t._Epsilon&&(this._value.r=1),this._value.g>=1-t._Epsilon&&(this._value.g=1),this._value.b>=1-t._Epsilon&&(this._value.b=1),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(e){this._width.toString(this._host)!==e&&this._width.fromString(e)&&(this._height.fromString(e),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(e){this._height.toString(this._host)!==e&&this._height.fromString(e)&&(this._width.fromString(e),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.width},set:function(e){this.width=e},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"ColorPicker"},t.prototype._preMeasure=function(e,t){e.widtha||f150?.04:-.16*(e-50)/100+.2;var m=(d-l)/(e-l);o[_+3]=m1-g?255*(1-(m-(1-g))/g):255}}return n.putImageData(r,0,0),i},t.prototype._draw=function(e){e.save(),this._applyStates(e);var t=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),i=.2*t,n=this._currentMeasure.left,r=this._currentMeasure.top;this._colorWheelCanvas&&this._colorWheelCanvas.width==2*t||(this._colorWheelCanvas=this._createColorWheelCanvas(t,i)),this._updateSquareProps(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY,e.fillRect(this._squareLeft,this._squareTop,this._squareSize,this._squareSize)),e.drawImage(this._colorWheelCanvas,n,r),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._drawGradientSquare(this._h,this._squareLeft,this._squareTop,this._squareSize,this._squareSize,e);var o=this._squareLeft+this._squareSize*this._s,s=this._squareTop+this._squareSize*(1-this._v);this._drawCircle(o,s,.04*t,e);var a=t-.5*i;o=n+t+Math.cos((this._h-180)*Math.PI/180)*a,s=r+t+Math.sin((this._h-180)*Math.PI/180)*a,this._drawCircle(o,s,.35*i,e),e.restore()},t.prototype._updateValueFromPointer=function(e,i){if(this._pointerStartedOnWheel){var n=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),r=n+this._currentMeasure.left,o=n+this._currentMeasure.top;this._h=180*Math.atan2(i-o,e-r)/Math.PI+180}else this._pointerStartedOnSquare&&(this._updateSquareProps(),this._s=(e-this._squareLeft)/this._squareSize,this._v=1-(i-this._squareTop)/this._squareSize,this._s=Math.min(this._s,1),this._s=Math.max(this._s,t._Epsilon),this._v=Math.min(this._v,1),this._v=Math.max(this._v,t._Epsilon));A.Wo.HSVtoRGBToRef(this._h,this._s,this._v,this._tmpColor),this.value=this._tmpColor},t.prototype._isPointOnSquare=function(e,t){this._updateSquareProps();var i=this._squareLeft,n=this._squareTop,r=this._squareSize;return e>=i&&e<=i+r&&t>=n&&t<=n+r},t.prototype._isPointOnWheel=function(e,t){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),n=i-.2*i,r=e-(i+this._currentMeasure.left),o=t-(i+this._currentMeasure.top),s=r*r+o*o;return s<=i*i&&s>=n*n},t.prototype._onPointerDown=function(t,i,n,r,o){if(!e.prototype._onPointerDown.call(this,t,i,n,r,o))return!1;this._pointerIsDown=!0,this._pointerStartedOnSquare=!1,this._pointerStartedOnWheel=!1,this._invertTransformMatrix.transformCoordinates(i.x,i.y,this._transformedPosition);var s=this._transformedPosition.x,a=this._transformedPosition.y;return this._isPointOnSquare(s,a)?this._pointerStartedOnSquare=!0:this._isPointOnWheel(s,a)&&(this._pointerStartedOnWheel=!0),this._updateValueFromPointer(s,a),this._host._capturingControl[n]=this,this._lastPointerDownID=n,!0},t.prototype._onPointerMove=function(t,i,n,r){if(n==this._lastPointerDownID){this._invertTransformMatrix.transformCoordinates(i.x,i.y,this._transformedPosition);var o=this._transformedPosition.x,s=this._transformedPosition.y;this._pointerIsDown&&this._updateValueFromPointer(o,s),e.prototype._onPointerMove.call(this,t,i,n,r)}},t.prototype._onPointerUp=function(t,i,n,r,o,s){this._pointerIsDown=!1,delete this._host._capturingControl[n],e.prototype._onPointerUp.call(this,t,i,n,r,o,s)},t.prototype._onCanvasBlur=function(){this._forcePointerUp(),e.prototype._onCanvasBlur.call(this)},t.ShowPickerDialogAsync=function(e,i){return new Promise((function(n,r){i.pickerWidth=i.pickerWidth||"640px",i.pickerHeight=i.pickerHeight||"400px",i.headerHeight=i.headerHeight||"35px",i.lastColor=i.lastColor||"#000000",i.swatchLimit=i.swatchLimit||20,i.numSwatchesPerLine=i.numSwatchesPerLine||10;var o,a,h,c,f,d,_,g,m,v,y,E,C,x,S,R,M,P,I,O=i.swatchLimit/i.numSwatchesPerLine,D=parseFloat(i.pickerWidth)/i.numSwatchesPerLine,L=Math.floor(.25*D),w=L*(i.numSwatchesPerLine+1),N=Math.floor((parseFloat(i.pickerWidth)-w)/i.numSwatchesPerLine),F=N*O+L*(O+1),B=(parseInt(i.pickerHeight)+F+Math.floor(.25*N)).toString()+"px",U="#c0c0c0",k="#535353",V="#414141",G="515151",H=A.Wo.FromHexString("#dddddd"),z=H.r+H.g+H.b,W=["R","G","B"],X="#454545",j="#f0f0f0",Y=!1;function K(e,t){I=t;var i=e.toHexString();if(M.background=i,v.name!=I&&(v.text=Math.floor(255*e.r).toString()),y.name!=I&&(y.text=Math.floor(255*e.g).toString()),E.name!=I&&(E.text=Math.floor(255*e.b).toString()),C.name!=I&&(C.text=e.r.toString()),x.name!=I&&(x.text=e.g.toString()),S.name!=I&&(S.text=e.b.toString()),R.name!=I){var n=i.split("#");R.text=n[1]}m.name!=I&&(m.value=e)}function q(e,t){var i=e.text;if(/[^0-9]/g.test(i))e.text=P;else if(""!=i&&(Math.floor(parseInt(i))<0?i="0":Math.floor(parseInt(i))>255?i="255":isNaN(parseInt(i))&&(i="0")),I==e.name&&(P=i),""!=i){i=parseInt(i).toString(),e.text=i;var n=A.Wo.FromHexString(M.background);I==e.name&&K("r"==t?new A.Wo(parseInt(i)/255,n.g,n.b):"g"==t?new A.Wo(n.r,parseInt(i)/255,n.b):new A.Wo(n.r,n.g,parseInt(i)/255),e.name)}}function Z(e,t){var i=e.text;if(/[^0-9\.]/g.test(i))e.text=P;else{""!=i&&"."!=i&&0!=parseFloat(i)&&(parseFloat(i)<0?i="0.0":parseFloat(i)>1?i="1.0":isNaN(parseFloat(i))&&(i="0.0")),I==e.name&&(P=i),""!=i&&"."!=i&&0!=parseFloat(i)?(i=parseFloat(i).toString(),e.text=i):i="0.0";var n=A.Wo.FromHexString(M.background);I==e.name&&K("r"==t?new A.Wo(parseFloat(i),n.g,n.b):"g"==t?new A.Wo(n.r,parseFloat(i),n.b):new A.Wo(n.r,n.g,parseFloat(i)),e.name)}}function Q(){if(i.savedColors&&i.savedColors[_]){if(Y)var e="b";else e="";var t=p.CreateSimpleButton("Swatch_"+_,e);t.fontFamily="BabylonJSglyphs";var n=A.Wo.FromHexString(i.savedColors[_]),r=n.r+n.g+n.b;t.color=r>z?"#aaaaaa":"#ffffff",t.fontSize=Math.floor(.7*N),t.textBlock.verticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,t.height=t.width=N.toString()+"px",t.background=i.savedColors[_],t.thickness=2;var o=_;return t.pointerDownAnimation=function(){t.thickness=4},t.pointerUpAnimation=function(){t.thickness=3},t.pointerEnterAnimation=function(){t.thickness=3},t.pointerOutAnimation=function(){t.thickness=2},t.onPointerClickObservable.add((function(){var e;Y?(e=o,i.savedColors&&i.savedColors.splice(e,1),i.savedColors&&0==i.savedColors.length&&(ee(!1),Y=!1),$("",Ne)):i.savedColors&&K(A.Wo.FromHexString(i.savedColors[o]),t.name)})),t}return null}function J(e){if(void 0!==e&&(Y=e),Y){for(var t=0;tl*i.numSwatchesPerLine)var h=i.numSwatchesPerLine;else h=i.savedColors.length-(l-1)*i.numSwatchesPerLine;for(var c=Math.min(Math.max(h,0),i.numSwatchesPerLine),u=0,f=1;ui.numSwatchesPerLine)){var d=Q();null!=d&&(g.addControl(d,a,f),f+=2,_++)}}i.savedColors.length>=i.swatchLimit?te(t,!0):te(t,!1)}}function ee(e){e?((h=p.CreateSimpleButton("butEdit","Edit")).width=c,h.height=f,h.left=Math.floor(.1*parseInt(c)).toString()+"px",h.top=(-1*parseFloat(h.left)).toString()+"px",h.verticalAlignment=l.o.VERTICAL_ALIGNMENT_BOTTOM,h.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,h.thickness=2,h.color=U,h.fontSize=a,h.background=k,h.onPointerEnterObservable.add((function(){h.background=V})),h.onPointerOutObservable.add((function(){h.background=k})),h.pointerDownAnimation=function(){h.background=G},h.pointerUpAnimation=function(){h.background=V},h.onPointerClickObservable.add((function(){Y=!Y,J()})),ge.addControl(h,1,0)):ge.removeControl(h)}function te(e,t){t?(e.color="#555555",e.background="#454545"):(e.color=U,e.background=k)}function ie(t){i.savedColors&&i.savedColors.length>0?n({savedColors:i.savedColors,pickedColor:t}):n({pickedColor:t}),e.removeControl(ne)}var ne=new T;if(ne.name="Dialog Container",ne.width=i.pickerWidth,i.savedColors){ne.height=B;var re=parseInt(i.pickerHeight)/parseInt(B);ne.addRowDefinition(re,!1),ne.addRowDefinition(1-re,!1)}else ne.height=i.pickerHeight,ne.addRowDefinition(1,!1);if(e.addControl(ne),i.savedColors){(g=new T).name="Swatch Drawer",g.verticalAlignment=l.o.VERTICAL_ALIGNMENT_TOP,g.background=k,g.width=i.pickerWidth;var oe=i.savedColors.length/i.numSwatchesPerLine;if(0==oe)var se=0;else se=oe+1;g.height=(N*oe+se*L).toString()+"px",g.top=Math.floor(.25*N).toString()+"px";for(var ae=0;ae<2*Math.ceil(i.savedColors.length/i.numSwatchesPerLine)+1;ae++)ae%2!=0?g.addRowDefinition(N,!0):g.addRowDefinition(L,!0);for(ae=0;ae<2*i.numSwatchesPerLine+1;ae++)ae%2!=0?g.addColumnDefinition(N,!0):g.addColumnDefinition(L,!0);ne.addControl(g,1,0)}var le=new T;le.name="Picker Panel",le.height=i.pickerHeight;var he=parseInt(i.headerHeight)/parseInt(i.pickerHeight),ce=[he,1-he];le.addRowDefinition(ce[0],!1),le.addRowDefinition(ce[1],!1),ne.addControl(le,0,0);var ue=new s;ue.name="Dialogue Header Bar",ue.background="#cccccc",ue.thickness=0,le.addControl(ue,0,0);var fe=p.CreateSimpleButton("closeButton","a");fe.fontFamily="BabylonJSglyphs";var de=A.Wo.FromHexString(ue.background);o=new A.Wo(1-de.r,1-de.g,1-de.b),fe.color=o.toHexString(),fe.fontSize=Math.floor(.6*parseInt(i.headerHeight)),fe.textBlock.textVerticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,fe.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_RIGHT,fe.height=fe.width=i.headerHeight,fe.background=ue.background,fe.thickness=0,fe.pointerDownAnimation=function(){},fe.pointerUpAnimation=function(){fe.background=ue.background},fe.pointerEnterAnimation=function(){fe.color=ue.background,fe.background="red"},fe.pointerOutAnimation=function(){fe.color=o.toHexString(),fe.background=ue.background},fe.onPointerClickObservable.add((function(){ie(Me.background)})),le.addControl(fe,0,0);var pe=new T;pe.name="Dialogue Body",pe.background=k;var _e=[.4375,.5625];pe.addRowDefinition(1,!1),pe.addColumnDefinition(_e[0],!1),pe.addColumnDefinition(_e[1],!1),le.addControl(pe,1,0);var ge=new T;ge.name="Picker Grid",ge.addRowDefinition(.85,!1),ge.addRowDefinition(.15,!1),pe.addControl(ge,0,0),(m=new t).name="GUI Color Picker",i.pickerHeighti.pickerHeight)var Se=xe;else Se=Ce;var Re=new u;Re.text="new",Re.name="New Color Label",Re.color=U,Re.fontSize=Se,Te.addControl(Re,1,0),(M=new s).name="New Color Swatch",M.background=i.lastColor,M.thickness=0,Ee.addControl(M,0,0);var Me=p.CreateSimpleButton("currentSwatch","");Me.background=i.lastColor,Me.thickness=0,Me.onPointerClickObservable.add((function(){K(A.Wo.FromHexString(Me.background),Me.name),J(!1)})),Me.pointerDownAnimation=function(){},Me.pointerUpAnimation=function(){},Me.pointerEnterAnimation=function(){},Me.pointerOutAnimation=function(){},Ee.addControl(Me,1,0);var Pe=new s;Pe.name="Swatch Outline",Pe.width=.67,Pe.thickness=2,Pe.color="#404040",Pe.isHitTestVisible=!1,Te.addControl(Pe,2,0);var Ie=new u;Ie.name="Current Color Label",Ie.text="current",Ie.color=U,Ie.fontSize=Se,Te.addControl(Ie,3,0);var Oe=new T;Oe.name="Button Grid",Oe.height=.8;var De=1/3;Oe.addRowDefinition(De,!1),Oe.addRowDefinition(De,!1),Oe.addRowDefinition(De,!1),ye.addControl(Oe,0,1),c=Math.floor(parseInt(i.pickerWidth)*_e[1]*be[1]*.67).toString()+"px",f=Math.floor(parseInt(i.pickerHeight)*ce[1]*ve[0]*(parseFloat(Oe.height.toString())/100)*De*.7).toString()+"px",a=parseFloat(c)>parseFloat(f)?Math.floor(.45*parseFloat(f)):Math.floor(.11*parseFloat(c));var Le=p.CreateSimpleButton("butOK","OK");Le.width=c,Le.height=f,Le.verticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,Le.thickness=2,Le.color=U,Le.fontSize=a,Le.background=k,Le.onPointerEnterObservable.add((function(){Le.background=V})),Le.onPointerOutObservable.add((function(){Le.background=k})),Le.pointerDownAnimation=function(){Le.background=G},Le.pointerUpAnimation=function(){Le.background=V},Le.onPointerClickObservable.add((function(){J(!1),ie(M.background)})),Oe.addControl(Le,0,0);var we=p.CreateSimpleButton("butCancel","Cancel");if(we.width=c,we.height=f,we.verticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,we.thickness=2,we.color=U,we.fontSize=a,we.background=k,we.onPointerEnterObservable.add((function(){we.background=V})),we.onPointerOutObservable.add((function(){we.background=k})),we.pointerDownAnimation=function(){we.background=G},we.pointerUpAnimation=function(){we.background=V},we.onPointerClickObservable.add((function(){J(!1),ie(Me.background)})),Oe.addControl(we,1,0),i.savedColors){var Ne=p.CreateSimpleButton("butSave","Save");Ne.width=c,Ne.height=f,Ne.verticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,Ne.thickness=2,Ne.fontSize=a,i.savedColors.length0&&ee(!0),Oe.addControl(Ne,2,0)}var Fe=new T;Fe.name="Dialog Lower Right",Fe.addRowDefinition(.02,!1),Fe.addRowDefinition(.63,!1),Fe.addRowDefinition(.21,!1),Fe.addRowDefinition(.14,!1),me.addControl(Fe,1,0),d=A.Wo.FromHexString(i.lastColor);var Be=new T;Be.name="RGB Values",Be.width=.82,Be.verticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,Be.addRowDefinition(1/3,!1),Be.addRowDefinition(1/3,!1),Be.addRowDefinition(1/3,!1),Be.addColumnDefinition(.1,!1),Be.addColumnDefinition(.2,!1),Be.addColumnDefinition(.7,!1),Fe.addControl(Be,1,0);for(ae=0;ae6||t)&&I==R.name)R.text=P;else{if(R.text.length<6)for(var i=6-R.text.length,n=0;n0&&$("",Ne)}))},t._Epsilon=1e-6,t}(l.o);o.Q.RegisteredTypes["BABYLON.GUI.ColorPicker"]=E;var C=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._thickness=1,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"thickness",{get:function(){return this._thickness},set:function(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"Ellipse"},t.prototype._localDraw=function(e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),l.o.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._thickness/2,this._currentMeasure.height/2-this._thickness/2,e),this._background&&(e.fillStyle=this._background,e.fill()),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._thickness&&(this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,e.stroke()),e.restore()},t.prototype._additionalProcessing=function(t,i){e.prototype._additionalProcessing.call(this,t,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},t.prototype._clipForChildren=function(e){l.o.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2,this._currentMeasure.height/2,e),e.clip()},t}(r.W);o.Q.RegisteredTypes["BABYLON.GUI.Ellipse"]=C;var x=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,n.ZT)(t,e),t.prototype._beforeRenderText=function(e){for(var t=new y,i="",n=0;n1?this.notRenderable=!0:this.notRenderable=!1}else f.w1.Error("Cannot move a control to a vector3 if the control is not at root level")},t.prototype._moveToProjectedPosition=function(e,t){void 0===t&&(t=!1);var i=e.x+this._linkOffsetX.getValue(this._host)+"px",n=e.y+this._linkOffsetY.getValue(this._host)+"px";t?(this.x2=i,this.y2=n,this._x2.ignoreAdaptiveScaling=!0,this._y2.ignoreAdaptiveScaling=!0):(this.x1=i,this.y1=n,this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0)},t}(l.o);o.Q.RegisteredTypes["BABYLON.GUI.Line"]=R;var M=i(5385),P=i(2782),I=function(){function e(e){this._multiLine=e,this._x=new c.s(0),this._y=new c.s(0),this._point=new S.P(0,0,0)}return Object.defineProperty(e.prototype,"x",{get:function(){return this._x.toString(this._multiLine._host)},set:function(e){this._x.toString(this._multiLine._host)!==e&&this._x.fromString(e)&&this._multiLine._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this._y.toString(this._multiLine._host)},set:function(e){this._y.toString(this._multiLine._host)!==e&&this._y.fromString(e)&&this._multiLine._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"control",{get:function(){return this._control},set:function(e){this._control!==e&&(this._control&&this._controlObserver&&(this._control.onDirtyObservable.remove(this._controlObserver),this._controlObserver=null),this._control=e,this._control&&(this._controlObserver=this._control.onDirtyObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{get:function(){return this._mesh},set:function(e){this._mesh!==e&&(this._mesh&&this._meshObserver&&this._mesh.getScene().onAfterCameraRenderObservable.remove(this._meshObserver),this._mesh=e,this._mesh&&(this._meshObserver=this._mesh.getScene().onAfterCameraRenderObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!1,configurable:!0}),e.prototype.resetLinks=function(){this.control=null,this.mesh=null},e.prototype.translate=function(){return this._point=this._translatePoint(),this._point},e.prototype._translatePoint=function(){if(null!=this._mesh)return this._multiLine._host.getProjectedPositionWithZ(this._mesh.getBoundingInfo().boundingSphere.center,this._mesh.getWorldMatrix());if(null!=this._control)return new S.P(this._control.centerX,this._control.centerY,1-P.kn);var e=this._multiLine._host,t=this._x.getValueInPixel(e,Number(e._canvas.width)),i=this._y.getValueInPixel(e,Number(e._canvas.height));return new S.P(t,i,1-P.kn)},e.prototype.dispose=function(){this.resetLinks()},e}(),O=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._lineWidth=1,i.onPointUpdate=function(){i._markAsDirty()},i._automaticSize=!0,i.isHitTestVisible=!1,i._horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=l.o.VERTICAL_ALIGNMENT_TOP,i._dash=[],i._points=[],i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"dash",{get:function(){return this._dash},set:function(e){this._dash!==e&&(this._dash=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype.getAt=function(e){return this._points[e]||(this._points[e]=new I(this)),this._points[e]},t.prototype.add=function(){for(var e=this,t=[],i=0;i0;)this.remove(this._points.length-1)},t.prototype.resetLinks=function(){this._points.forEach((function(e){null!=e&&e.resetLinks()}))},Object.defineProperty(t.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(e){this._lineWidth!==e&&(this._lineWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalAlignment",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalAlignment",{set:function(e){},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"MultiLine"},t.prototype._draw=function(e,t){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._applyStates(e),e.strokeStyle=this.color,e.lineWidth=this._lineWidth,e.setLineDash(this._dash),e.beginPath();var i,n=!0;this._points.forEach((function(t){t&&(n?(e.moveTo(t._point.x,t._point.y),n=!1):t._point.z<1&&i.z<1?e.lineTo(t._point.x,t._point.y):e.moveTo(t._point.x,t._point.y),i=t._point)})),e.stroke(),e.restore()},t.prototype._additionalProcessing=function(e,t){var i=this;this._minX=null,this._minY=null,this._maxX=null,this._maxY=null,this._points.forEach((function(e,t){e&&(e.translate(),(null==i._minX||e._point.xi._maxX)&&(i._maxX=e._point.x),(null==i._maxY||e._point.y>i._maxY)&&(i._maxY=e._point.y))})),null==this._minX&&(this._minX=0),null==this._minY&&(this._minY=0),null==this._maxX&&(this._maxX=0),null==this._maxY&&(this._maxY=0)},t.prototype._measure=function(){null!=this._minX&&null!=this._maxX&&null!=this._minY&&null!=this._maxY&&(this._currentMeasure.width=Math.abs(this._maxX-this._minX)+this._lineWidth,this._currentMeasure.height=Math.abs(this._maxY-this._minY)+this._lineWidth)},t.prototype._computeAlignment=function(e,t){null!=this._minX&&null!=this._minY&&(this._currentMeasure.left=this._minX-this._lineWidth/2,this._currentMeasure.top=this._minY-this._lineWidth/2)},t.prototype.dispose=function(){this.reset(),e.prototype.dispose.call(this)},t}(l.o);o.Q.RegisteredTypes["BABYLON.GUI.MultiLine"]=O;var D=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._isChecked=!1,i._background="black",i._checkSizeRatio=.8,i._thickness=1,i.group="",i.onIsCheckedChangedObservable=new h.y$,i.isPointerBlocker=!0,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"thickness",{get:function(){return this._thickness},set:function(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"checkSizeRatio",{get:function(){return this._checkSizeRatio},set:function(e){e=Math.max(Math.min(1,e),0),this._checkSizeRatio!==e&&(this._checkSizeRatio=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isChecked",{get:function(){return this._isChecked},set:function(e){var t=this;this._isChecked!==e&&(this._isChecked=e,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(e),this._isChecked&&this._host&&this._host.executeOnAllControls((function(e){if(e!==t&&void 0!==e.group){var i=e;i.group===t.group&&(i.isChecked=!1)}})))},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"RadioButton"},t.prototype._draw=function(e){e.save(),this._applyStates(e);var t=this._currentMeasure.width-this._thickness,i=this._currentMeasure.height-this._thickness;if((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),l.o.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._thickness/2,this._currentMeasure.height/2-this._thickness/2,e),e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.strokeStyle=this.color,e.lineWidth=this._thickness,e.stroke(),this._isChecked){e.fillStyle=this._isEnabled?this.color:this._disabledColor;var n=t*this._checkSizeRatio,r=i*this._checkSizeRatio;l.o.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,n/2-this._thickness/2,r/2-this._thickness/2,e),e.fill()}e.restore()},t.prototype._onPointerDown=function(t,i,n,r,o){return!!e.prototype._onPointerDown.call(this,t,i,n,r,o)&&(this.isChecked||(this.isChecked=!0),!0)},t.AddRadioButtonWithHeader=function(e,i,n,r){var o=new _;o.isVertical=!1,o.height="30px";var s=new t;s.width="20px",s.height="20px",s.isChecked=n,s.color="green",s.group=i,s.onIsCheckedChangedObservable.add((function(e){return r(s,e)})),o.addControl(s);var a=new u;return a.text=e,a.width="180px",a.paddingLeft="5px",a.textHorizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,a.color="white",o.addControl(a),o},t}(l.o);o.Q.RegisteredTypes["BABYLON.GUI.RadioButton"]=D;var L=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._thumbWidth=new c.s(20,c.s.UNITMODE_PIXEL,!1),i._minimum=0,i._maximum=100,i._value=50,i._isVertical=!1,i._barOffset=new c.s(5,c.s.UNITMODE_PIXEL,!1),i._isThumbClamped=!1,i._displayThumb=!0,i._step=0,i._lastPointerDownID=-1,i._effectiveBarOffset=0,i.onValueChangedObservable=new h.y$,i._pointerIsDown=!1,i.isPointerBlocker=!0,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"displayThumb",{get:function(){return this._displayThumb},set:function(e){this._displayThumb!==e&&(this._displayThumb=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"step",{get:function(){return this._step},set:function(e){this._step!==e&&(this._step=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barOffset",{get:function(){return this._barOffset.toString(this._host)},set:function(e){this._barOffset.toString(this._host)!==e&&this._barOffset.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barOffsetInPixels",{get:function(){return this._barOffset.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbWidth",{get:function(){return this._thumbWidth.toString(this._host)},set:function(e){this._thumbWidth.toString(this._host)!==e&&this._thumbWidth.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbWidthInPixels",{get:function(){return this._thumbWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minimum",{get:function(){return this._minimum},set:function(e){this._minimum!==e&&(this._minimum=e,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maximum",{get:function(){return this._maximum},set:function(e){this._maximum!==e&&(this._maximum=e,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(e){e=Math.max(Math.min(e,this._maximum),this._minimum),this._value!==e&&(this._value=e,this._markAsDirty(),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isVertical",{get:function(){return this._isVertical},set:function(e){this._isVertical!==e&&(this._isVertical=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isThumbClamped",{get:function(){return this._isThumbClamped},set:function(e){this._isThumbClamped!==e&&(this._isThumbClamped=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"BaseSlider"},t.prototype._getThumbPosition=function(){return this.isVertical?(this.maximum-this.value)/(this.maximum-this.minimum)*this._backgroundBoxLength:(this.value-this.minimum)/(this.maximum-this.minimum)*this._backgroundBoxLength},t.prototype._getThumbThickness=function(e){var t=0;switch(e){case"circle":t=this._thumbWidth.isPixel?Math.max(this._thumbWidth.getValue(this._host),this._backgroundBoxThickness):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host);break;case"rectangle":t=this._thumbWidth.isPixel?Math.min(this._thumbWidth.getValue(this._host),this._backgroundBoxThickness):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)}return t},t.prototype._prepareRenderingData=function(e){this._effectiveBarOffset=0,this._renderLeft=this._currentMeasure.left,this._renderTop=this._currentMeasure.top,this._renderWidth=this._currentMeasure.width,this._renderHeight=this._currentMeasure.height,this._backgroundBoxLength=Math.max(this._currentMeasure.width,this._currentMeasure.height),this._backgroundBoxThickness=Math.min(this._currentMeasure.width,this._currentMeasure.height),this._effectiveThumbThickness=this._getThumbThickness(e),this.displayThumb&&(this._backgroundBoxLength-=this._effectiveThumbThickness),this.isVertical&&this._currentMeasure.height=this._selectors.length))return this._selectors[e]},e.prototype.removeSelector=function(e){e<0||e>=this._selectors.length||(this._groupPanel.removeControl(this._selectors[e]),this._selectors.splice(e,1))},e}(),F=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,n.ZT)(t,e),t.prototype.addCheckbox=function(e,t,i){void 0===t&&(t=function(e){}),void 0===i&&(i=!1);i=i||!1;var n=new g;n.width="20px",n.height="20px",n.color="#364249",n.background="#CCCCCC",n.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,n.onIsCheckedChangedObservable.add((function(e){t(e)}));var r=l.o.AddHeader(n,e,"200px",{isHorizontal:!0,controlFirst:!0});r.height="30px",r.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,r.left="4px",this.groupPanel.addControl(r),this.selectors.push(r),n.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(n.color=this.groupPanel.parent.parent.buttonColor,n.background=this.groupPanel.parent.parent.buttonBackground)},t.prototype._setSelectorLabel=function(e,t){this.selectors[e].children[1].text=t},t.prototype._setSelectorLabelColor=function(e,t){this.selectors[e].children[1].color=t},t.prototype._setSelectorButtonColor=function(e,t){this.selectors[e].children[0].color=t},t.prototype._setSelectorButtonBackground=function(e,t){this.selectors[e].children[0].background=t},t}(N),B=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._selectNb=0,t}return(0,n.ZT)(t,e),t.prototype.addRadio=function(e,t,i){void 0===t&&(t=function(e){}),void 0===i&&(i=!1);var n=this._selectNb++,r=new D;r.name=e,r.width="20px",r.height="20px",r.color="#364249",r.background="#CCCCCC",r.group=this.name,r.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,r.onIsCheckedChangedObservable.add((function(e){e&&t(n)}));var o=l.o.AddHeader(r,e,"200px",{isHorizontal:!0,controlFirst:!0});o.height="30px",o.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,o.left="4px",this.groupPanel.addControl(o),this.selectors.push(o),r.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(r.color=this.groupPanel.parent.parent.buttonColor,r.background=this.groupPanel.parent.parent.buttonBackground)},t.prototype._setSelectorLabel=function(e,t){this.selectors[e].children[1].text=t},t.prototype._setSelectorLabelColor=function(e,t){this.selectors[e].children[1].color=t},t.prototype._setSelectorButtonColor=function(e,t){this.selectors[e].children[0].color=t},t.prototype._setSelectorButtonBackground=function(e,t){this.selectors[e].children[0].background=t},t}(N),U=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,n.ZT)(t,e),t.prototype.addSlider=function(e,t,i,n,r,o,s){void 0===t&&(t=function(e){}),void 0===i&&(i="Units"),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s=function(e){return 0|e});var a=new w;a.name=i,a.value=o,a.minimum=n,a.maximum=r,a.width=.9,a.height="20px",a.color="#364249",a.background="#CCCCCC",a.borderColor="black",a.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,a.left="4px",a.paddingBottom="4px",a.onValueChangedObservable.add((function(e){a.parent.children[0].text=a.parent.children[0].name+": "+s(e)+" "+a.name,t(e)}));var h=l.o.AddHeader(a,e+": "+s(o)+" "+i,"30px",{isHorizontal:!1,controlFirst:!1});h.height="60px",h.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,h.left="4px",h.children[0].name=e,this.groupPanel.addControl(h),this.selectors.push(h),this.groupPanel.parent&&this.groupPanel.parent.parent&&(a.color=this.groupPanel.parent.parent.buttonColor,a.background=this.groupPanel.parent.parent.buttonBackground)},t.prototype._setSelectorLabel=function(e,t){this.selectors[e].children[0].name=t,this.selectors[e].children[0].text=t+": "+this.selectors[e].children[1].value+" "+this.selectors[e].children[1].name},t.prototype._setSelectorLabelColor=function(e,t){this.selectors[e].children[0].color=t},t.prototype._setSelectorButtonColor=function(e,t){this.selectors[e].children[1].color=t},t.prototype._setSelectorButtonBackground=function(e,t){this.selectors[e].children[1].background=t},t}(N),k=function(e){function t(t,i){void 0===i&&(i=[]);var n=e.call(this,t)||this;if(n.name=t,n.groups=i,n._buttonColor="#364249",n._buttonBackground="#CCCCCC",n._headerColor="black",n._barColor="white",n._barHeight="2px",n._spacerHeight="20px",n._bars=new Array,n._groups=i,n.thickness=2,n._panel=new _,n._panel.verticalAlignment=l.o.VERTICAL_ALIGNMENT_TOP,n._panel.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,n._panel.top=5,n._panel.left=5,n._panel.width=.95,i.length>0){for(var r=0;r0&&this._addSpacer(),this._panel.addControl(e.groupPanel),this._groups.push(e),e.groupPanel.children[0].color=this._headerColor;for(var t=0;t=this._groups.length)){var t=this._groups[e];this._panel.removeControl(t.groupPanel),this._groups.splice(e,1),e=this._groups.length||(this._groups[t].groupPanel.children[0].text=e)},t.prototype.relabel=function(e,t,i){if(!(t<0||t>=this._groups.length)){var n=this._groups[t];i<0||i>=n.selectors.length||n._setSelectorLabel(i,e)}},t.prototype.removeFromGroupSelector=function(e,t){if(!(e<0||e>=this._groups.length)){var i=this._groups[e];t<0||t>=i.selectors.length||i.removeSelector(t)}},t.prototype.addToGroupCheckbox=function(e,t,i,n){(void 0===i&&(i=function(){}),void 0===n&&(n=!1),e<0||e>=this._groups.length)||this._groups[e].addCheckbox(t,i,n)},t.prototype.addToGroupRadio=function(e,t,i,n){(void 0===i&&(i=function(){}),void 0===n&&(n=!1),e<0||e>=this._groups.length)||this._groups[e].addRadio(t,i,n)},t.prototype.addToGroupSlider=function(e,t,i,n,r,o,s,a){(void 0===i&&(i=function(){}),void 0===n&&(n="Units"),void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===a&&(a=function(e){return 0|e}),e<0||e>=this._groups.length)||this._groups[e].addSlider(t,i,n,r,o,s,a)},t}(s),V=i(5958),G=function(e){function t(t){var i=e.call(this,t)||this;return i._freezeControls=!1,i._bucketWidth=0,i._bucketHeight=0,i._buckets={},i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"freezeControls",{get:function(){return this._freezeControls},set:function(e){if(this._freezeControls!==e){e||this._restoreMeasures(),this._freezeControls=!1;var t=this.host.getSize(),i=t.width,n=t.height,r=this.host.getContext(),o=new V.U(0,0,i,n);this.host._numLayoutCalls=0,this.host._rootContainer._layout(o,r),e&&(this._updateMeasures(),this._useBuckets()&&this._makeBuckets()),this._freezeControls=e,this.host.markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bucketWidth",{get:function(){return this._bucketWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bucketHeight",{get:function(){return this._bucketHeight},enumerable:!1,configurable:!0}),t.prototype.setBucketSizes=function(e,t){this._bucketWidth=e,this._bucketHeight=t,this._useBuckets()?this._freezeControls&&this._makeBuckets():this._buckets={}},t.prototype._useBuckets=function(){return this._bucketWidth>0&&this._bucketHeight>0},t.prototype._makeBuckets=function(){this._buckets={},this._bucketLen=Math.ceil(this.widthInPixels/this._bucketWidth),this._dispatchInBuckets(this._children),this._oldLeft=null,this._oldTop=null},t.prototype._dispatchInBuckets=function(e){for(var t=0;t0&&this._dispatchInBuckets(i._children)}},t.prototype._updateMeasures=function(){var e=0|this.leftInPixels,t=0|this.topInPixels;this._measureForChildren.left-=e,this._measureForChildren.top-=t,this._currentMeasure.left-=e,this._currentMeasure.top-=t,this._customData.origLeftForChildren=this._measureForChildren.left,this._customData.origTopForChildren=this._measureForChildren.top,this._customData.origLeft=this._currentMeasure.left,this._customData.origTop=this._currentMeasure.top,this._updateChildrenMeasures(this._children,e,t)},t.prototype._updateChildrenMeasures=function(e,t,i){for(var n=0;n0&&this._updateChildrenMeasures(o._children,t,i)}},t.prototype._restoreMeasures=function(){var e=0|this.leftInPixels,t=0|this.topInPixels;this._measureForChildren.left=this._customData.origLeftForChildren+e,this._measureForChildren.top=this._customData.origTopForChildren+t,this._currentMeasure.left=this._customData.origLeft+e,this._currentMeasure.top=this._customData.origTop+t},t.prototype._getTypeName=function(){return"ScrollViewerWindow"},t.prototype._additionalProcessing=function(t,i){e.prototype._additionalProcessing.call(this,t,i),this._parentMeasure=t,this._measureForChildren.left=this._currentMeasure.left,this._measureForChildren.top=this._currentMeasure.top,this._measureForChildren.width=t.width,this._measureForChildren.height=t.height},t.prototype._layout=function(t,i){return this._freezeControls?(this.invalidateRect(),!1):e.prototype._layout.call(this,t,i)},t.prototype._scrollChildren=function(e,t,i){for(var n=0;n0&&this._scrollChildren(o._children,t,i)}},t.prototype._scrollChildrenWithBuckets=function(e,t,i,n){for(var r=Math.max(0,Math.floor(-e/this._bucketWidth)),o=Math.floor((-e+this._parentMeasure.width-1)/this._bucketWidth),s=Math.max(0,Math.floor(-t/this._bucketHeight)),a=Math.floor((-t+this._parentMeasure.height-1)/this._bucketHeight);s<=a;){for(var l=r;l<=o;++l){var h=s*this._bucketLen+l,c=this._buckets[h];if(c)for(var u=0;uthis._tempMeasure.left+this._tempMeasure.width||tthis._tempMeasure.top+this._tempMeasure.height)&&(this.isVertical?this.value=this.minimum+(1-(t-this._currentMeasure.top)/this._currentMeasure.height)*(this.maximum-this.minimum):this.value=this.minimum+(e-this._currentMeasure.left)/this._currentMeasure.width*(this.maximum-this.minimum)));var i=0;i=this.isVertical?-(t-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(e-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*(this.maximum-this.minimum),this._originX=e,this._originY=t},t.prototype._onPointerDown=function(t,i,n,r,o){return this._first=!0,e.prototype._onPointerDown.call(this,t,i,n,r,o)},t}(L),z=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._thumbLength=.5,i._thumbHeight=1,i._barImageHeight=1,i._tempMeasure=new V.U(0,0,0,0),i.num90RotationInVerticalMode=1,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"backgroundImage",{get:function(){return this._backgroundBaseImage},set:function(e){var t=this;this._backgroundBaseImage!==e&&(this._backgroundBaseImage=e,this.isVertical&&0!==this.num90RotationInVerticalMode?e.isLoaded?(this._backgroundImage=e._rotate90(this.num90RotationInVerticalMode,!0),this._markAsDirty()):e.onImageLoadedObservable.addOnce((function(){var i=e._rotate90(t.num90RotationInVerticalMode,!0);t._backgroundImage=i,i.isLoaded||i.onImageLoadedObservable.addOnce((function(){t._markAsDirty()})),t._markAsDirty()})):(this._backgroundImage=e,e&&!e.isLoaded&&e.onImageLoadedObservable.addOnce((function(){t._markAsDirty()})),this._markAsDirty()))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbImage",{get:function(){return this._thumbBaseImage},set:function(e){var t=this;this._thumbBaseImage!==e&&(this._thumbBaseImage=e,this.isVertical&&0!==this.num90RotationInVerticalMode?e.isLoaded?(this._thumbImage=e._rotate90(-this.num90RotationInVerticalMode,!0),this._markAsDirty()):e.onImageLoadedObservable.addOnce((function(){var i=e._rotate90(-t.num90RotationInVerticalMode,!0);t._thumbImage=i,i.isLoaded||i.onImageLoadedObservable.addOnce((function(){t._markAsDirty()})),t._markAsDirty()})):(this._thumbImage=e,e&&!e.isLoaded&&e.onImageLoadedObservable.addOnce((function(){t._markAsDirty()})),this._markAsDirty()))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbLength",{get:function(){return this._thumbLength},set:function(e){this._thumbLength!==e&&(this._thumbLength=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbHeight",{get:function(){return this._thumbHeight},set:function(e){this._thumbLength!==e&&(this._thumbHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barImageHeight",{get:function(){return this._barImageHeight},set:function(e){this._barImageHeight!==e&&(this._barImageHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),t.prototype._getTypeName=function(){return"ImageScrollBar"},t.prototype._getThumbThickness=function(){return this._thumbWidth.isPixel?this._thumbWidth.getValue(this._host):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)},t.prototype._draw=function(e){e.save(),this._applyStates(e),this._prepareRenderingData("rectangle");var t=this._getThumbPosition(),i=this._renderLeft,n=this._renderTop,r=this._renderWidth,o=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,n,r,o),this.isVertical?(this._tempMeasure.copyFromFloats(i+r*(1-this._barImageHeight)*.5,this._currentMeasure.top,r*this._barImageHeight,o),this._tempMeasure.height+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)):(this._tempMeasure.copyFromFloats(this._currentMeasure.left,n+o*(1-this._barImageHeight)*.5,r,o*this._barImageHeight),this._tempMeasure.width+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)),this._backgroundImage._draw(e)),this.isVertical?this._tempMeasure.copyFromFloats(i-this._effectiveBarOffset+this._currentMeasure.width*(1-this._thumbHeight)*.5,this._currentMeasure.top+t,this._currentMeasure.width*this._thumbHeight,this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(this._currentMeasure.left+t,this._currentMeasure.top+this._currentMeasure.height*(1-this._thumbHeight)*.5,this._effectiveThumbThickness,this._currentMeasure.height*this._thumbHeight),this._thumbImage&&(this._thumbImage._currentMeasure.copyFrom(this._tempMeasure),this._thumbImage._draw(e)),e.restore()},t.prototype._updateValueFromPointer=function(e,t){0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(e,t,this._transformedPosition),e=this._transformedPosition.x,t=this._transformedPosition.y),this._first&&(this._first=!1,this._originX=e,this._originY=t,(ethis._tempMeasure.left+this._tempMeasure.width||tthis._tempMeasure.top+this._tempMeasure.height)&&(this.isVertical?this.value=this.minimum+(1-(t-this._currentMeasure.top)/this._currentMeasure.height)*(this.maximum-this.minimum):this.value=this.minimum+(e-this._currentMeasure.left)/this._currentMeasure.width*(this.maximum-this.minimum)));var i=0;i=this.isVertical?-(t-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(e-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*(this.maximum-this.minimum),this._originX=e,this._originY=t},t.prototype._onPointerDown=function(t,i,n,r,o){return this._first=!0,e.prototype._onPointerDown.call(this,t,i,n,r,o)},t}(L),W=function(e){function t(t,i){var n=e.call(this,t)||this;return n._barSize=20,n._pointerIsOver=!1,n._wheelPrecision=.05,n._thumbLength=.5,n._thumbHeight=1,n._barImageHeight=1,n._horizontalBarImageHeight=1,n._verticalBarImageHeight=1,n._oldWindowContentsWidth=0,n._oldWindowContentsHeight=0,n._forceHorizontalBar=!1,n._forceVerticalBar=!1,n._useImageBar=i||!1,n.onDirtyObservable.add((function(){n._horizontalBarSpace.color=n.color,n._verticalBarSpace.color=n.color,n._dragSpace.color=n.color})),n.onPointerEnterObservable.add((function(){n._pointerIsOver=!0})),n.onPointerOutObservable.add((function(){n._pointerIsOver=!1})),n._grid=new T,n._useImageBar?(n._horizontalBar=new z,n._verticalBar=new z):(n._horizontalBar=new H,n._verticalBar=new H),n._window=new G("scrollViewer_window"),n._window.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,n._window.verticalAlignment=l.o.VERTICAL_ALIGNMENT_TOP,n._grid.addColumnDefinition(1),n._grid.addColumnDefinition(0,!0),n._grid.addRowDefinition(1),n._grid.addRowDefinition(0,!0),e.prototype.addControl.call(n,n._grid),n._grid.addControl(n._window,0,0),n._verticalBarSpace=new s,n._verticalBarSpace.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,n._verticalBarSpace.verticalAlignment=l.o.VERTICAL_ALIGNMENT_TOP,n._verticalBarSpace.thickness=1,n._grid.addControl(n._verticalBarSpace,0,1),n._addBar(n._verticalBar,n._verticalBarSpace,!0,Math.PI),n._horizontalBarSpace=new s,n._horizontalBarSpace.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_LEFT,n._horizontalBarSpace.verticalAlignment=l.o.VERTICAL_ALIGNMENT_TOP,n._horizontalBarSpace.thickness=1,n._grid.addControl(n._horizontalBarSpace,1,0),n._addBar(n._horizontalBar,n._horizontalBarSpace,!1,0),n._dragSpace=new s,n._dragSpace.thickness=1,n._grid.addControl(n._dragSpace,1,1),n._useImageBar||(n.barColor="grey",n.barBackground="transparent"),n}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"horizontalBar",{get:function(){return this._horizontalBar},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalBar",{get:function(){return this._verticalBar},enumerable:!1,configurable:!0}),t.prototype.addControl=function(e){return e?(this._window.addControl(e),this):this},t.prototype.removeControl=function(e){return this._window.removeControl(e),this},Object.defineProperty(t.prototype,"children",{get:function(){return this._window.children},enumerable:!1,configurable:!0}),t.prototype._flagDescendantsAsMatrixDirty=function(){for(var e=0,t=this._children;e1&&(e=1),this._wheelPrecision=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scrollBackground",{get:function(){return this._horizontalBarSpace.background},set:function(e){this._horizontalBarSpace.background!==e&&(this._horizontalBarSpace.background=e,this._verticalBarSpace.background=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barColor",{get:function(){return this._barColor},set:function(e){this._barColor!==e&&(this._barColor=e,this._horizontalBar.color=e,this._verticalBar.color=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbImage",{get:function(){return this._barImage},set:function(e){if(this._barImage!==e){this._barImage=e;var t=this._horizontalBar,i=this._verticalBar;t.thumbImage=e,i.thumbImage=e}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalThumbImage",{get:function(){return this._horizontalBarImage},set:function(e){this._horizontalBarImage!==e&&(this._horizontalBarImage=e,this._horizontalBar.thumbImage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalThumbImage",{get:function(){return this._verticalBarImage},set:function(e){this._verticalBarImage!==e&&(this._verticalBarImage=e,this._verticalBar.thumbImage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barSize",{get:function(){return this._barSize},set:function(e){this._barSize!==e&&(this._barSize=e,this._markAsDirty(),this._horizontalBar.isVisible&&this._grid.setRowDefinition(1,this._barSize,!0),this._verticalBar.isVisible&&this._grid.setColumnDefinition(1,this._barSize,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbLength",{get:function(){return this._thumbLength},set:function(e){if(this._thumbLength!==e){e<=0&&(e=.1),e>1&&(e=1),this._thumbLength=e;var t=this._horizontalBar,i=this._verticalBar;t.thumbLength=e,i.thumbLength=e,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"thumbHeight",{get:function(){return this._thumbHeight},set:function(e){if(this._thumbHeight!==e){e<=0&&(e=.1),e>1&&(e=1),this._thumbHeight=e;var t=this._horizontalBar,i=this._verticalBar;t.thumbHeight=e,i.thumbHeight=e,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barImageHeight",{get:function(){return this._barImageHeight},set:function(e){if(this._barImageHeight!==e){e<=0&&(e=.1),e>1&&(e=1),this._barImageHeight=e;var t=this._horizontalBar,i=this._verticalBar;t.barImageHeight=e,i.barImageHeight=e,this._markAsDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalBarImageHeight",{get:function(){return this._horizontalBarImageHeight},set:function(e){this._horizontalBarImageHeight!==e&&(e<=0&&(e=.1),e>1&&(e=1),this._horizontalBarImageHeight=e,this._horizontalBar.barImageHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalBarImageHeight",{get:function(){return this._verticalBarImageHeight},set:function(e){this._verticalBarImageHeight!==e&&(e<=0&&(e=.1),e>1&&(e=1),this._verticalBarImageHeight=e,this._verticalBar.barImageHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barBackground",{get:function(){return this._barBackground},set:function(e){if(this._barBackground!==e){this._barBackground=e;var t=this._horizontalBar,i=this._verticalBar;t.background=e,i.background=e,this._dragSpace.background=e}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"barImage",{get:function(){return this._barBackgroundImage},set:function(e){this._barBackgroundImage,this._barBackgroundImage=e;var t=this._horizontalBar,i=this._verticalBar;t.backgroundImage=e,i.backgroundImage=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalBarImage",{get:function(){return this._horizontalBarBackgroundImage},set:function(e){this._horizontalBarBackgroundImage,this._horizontalBarBackgroundImage=e,this._horizontalBar.backgroundImage=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalBarImage",{get:function(){return this._verticalBarBackgroundImage},set:function(e){this._verticalBarBackgroundImage,this._verticalBarBackgroundImage=e,this._verticalBar.backgroundImage=e},enumerable:!1,configurable:!0}),t.prototype._setWindowPosition=function(e){void 0===e&&(e=!0);var t=this.host.idealRatio,i=this._window._currentMeasure.width,n=this._window._currentMeasure.height;if(e||this._oldWindowContentsWidth!==i||this._oldWindowContentsHeight!==n){this._oldWindowContentsWidth=i,this._oldWindowContentsHeight=n;var r=this._clientWidth-i,o=this._clientHeight-n,s=this._horizontalBar.value/t*r+"px",a=this._verticalBar.value/t*o+"px";s!==this._window.left&&(this._window.left=s,this.freezeControls||(this._rebuildLayout=!0)),a!==this._window.top&&(this._window.top=a,this.freezeControls||(this._rebuildLayout=!0))}},t.prototype._updateScroller=function(){var e=this._window._currentMeasure.width,t=this._window._currentMeasure.height;this._horizontalBar.isVisible&&e<=this._clientWidth&&!this.forceHorizontalBar?(this._grid.setRowDefinition(1,0,!0),this._horizontalBar.isVisible=!1,this._horizontalBar.value=0,this._rebuildLayout=!0):!this._horizontalBar.isVisible&&(e>this._clientWidth||this.forceHorizontalBar)&&(this._grid.setRowDefinition(1,this._barSize,!0),this._horizontalBar.isVisible=!0,this._rebuildLayout=!0),this._verticalBar.isVisible&&t<=this._clientHeight&&!this.forceVerticalBar?(this._grid.setColumnDefinition(1,0,!0),this._verticalBar.isVisible=!1,this._verticalBar.value=0,this._rebuildLayout=!0):!this._verticalBar.isVisible&&(t>this._clientHeight||this.forceVerticalBar)&&(this._grid.setColumnDefinition(1,this._barSize,!0),this._verticalBar.isVisible=!0,this._rebuildLayout=!0),this._buildClientSizes();var i=this.host.idealRatio;this._horizontalBar.thumbWidth=.9*this._thumbLength*(this._clientWidth/i)+"px",this._verticalBar.thumbWidth=.9*this._thumbLength*(this._clientHeight/i)+"px"},t.prototype._link=function(t){e.prototype._link.call(this,t),this._attachWheel()},t.prototype._addBar=function(e,t,i,n){var r=this;e.paddingLeft=0,e.width="100%",e.height="100%",e.barOffset=0,e.value=0,e.maximum=1,e.horizontalAlignment=l.o.HORIZONTAL_ALIGNMENT_CENTER,e.verticalAlignment=l.o.VERTICAL_ALIGNMENT_CENTER,e.isVertical=i,e.rotation=n,e.isVisible=!1,t.addControl(e),e.onValueChangedObservable.add((function(e){r._setWindowPosition()}))},t.prototype._attachWheel=function(){var e=this;this._host&&!this._onWheelObserver&&(this._onWheelObserver=this.onWheelObservable.add((function(t){e._pointerIsOver&&(1==e._verticalBar.isVisible&&(t.y<0&&e._verticalBar.value>0?e._verticalBar.value-=e._wheelPrecision:t.y>0&&e._verticalBar.value0&&e._horizontalBar.value>0&&(e._horizontalBar.value-=e._wheelPrecision)))})))},t.prototype._renderHighlightSpecific=function(t){this.isHighlighted&&(e.prototype._renderHighlightSpecific.call(this,t),this._grid._renderHighlightSpecific(t),t.restore())},t.prototype.dispose=function(){this.onWheelObservable.remove(this._onWheelObserver),this._onWheelObserver=null,e.prototype.dispose.call(this)},t}(s);o.Q.RegisteredTypes["BABYLON.GUI.ScrollViewer"]=W;var X=function(){},j=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onKeyPressObservable=new h.y$,t.defaultButtonWidth="40px",t.defaultButtonHeight="40px",t.defaultButtonPaddingLeft="2px",t.defaultButtonPaddingRight="2px",t.defaultButtonPaddingTop="2px",t.defaultButtonPaddingBottom="2px",t.defaultButtonColor="#DDD",t.defaultButtonBackground="#070707",t.shiftButtonColor="#7799FF",t.selectedShiftThickness=1,t.shiftState=0,t._currentlyConnectedInputText=null,t._connectedInputTexts=[],t._onKeyPressObserver=null,t}return(0,n.ZT)(t,e),t.prototype._getTypeName=function(){return"VirtualKeyboard"},t.prototype._createKey=function(e,t){var i=this,n=p.CreateSimpleButton(e,e);return n.width=t&&t.width?t.width:this.defaultButtonWidth,n.height=t&&t.height?t.height:this.defaultButtonHeight,n.color=t&&t.color?t.color:this.defaultButtonColor,n.background=t&&t.background?t.background:this.defaultButtonBackground,n.paddingLeft=t&&t.paddingLeft?t.paddingLeft:this.defaultButtonPaddingLeft,n.paddingRight=t&&t.paddingRight?t.paddingRight:this.defaultButtonPaddingRight,n.paddingTop=t&&t.paddingTop?t.paddingTop:this.defaultButtonPaddingTop,n.paddingBottom=t&&t.paddingBottom?t.paddingBottom:this.defaultButtonPaddingBottom,n.thickness=0,n.isFocusInvisible=!0,n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY,n.onPointerUpObservable.add((function(){i.onKeyPressObservable.notifyObservers(e)})),n},t.prototype.addKeysRow=function(e,t){var i=new _;i.isVertical=!1,i.isFocusInvisible=!0;for(var n=null,r=0;rn.heightInPixels)&&(n=s),i.addControl(s)}i.height=n?n.height:this.defaultButtonHeight,this.addControl(i)},t.prototype.applyShiftState=function(e){if(this.children)for(var t=0;t1?this.selectedShiftThickness:0),s.text=e>0?s.text.toUpperCase():s.text.toLowerCase()}}}},Object.defineProperty(t.prototype,"connectedInputText",{get:function(){return this._currentlyConnectedInputText},enumerable:!1,configurable:!0}),t.prototype.connect=function(e){var t=this;if(!this._connectedInputTexts.some((function(t){return t.input===e}))){null===this._onKeyPressObserver&&(this._onKeyPressObserver=this.onKeyPressObservable.add((function(e){if(t._currentlyConnectedInputText){switch(t._currentlyConnectedInputText._host.focusedControl=t._currentlyConnectedInputText,e){case"⇧":return t.shiftState++,t.shiftState>2&&(t.shiftState=0),void t.applyShiftState(t.shiftState);case"←":return void t._currentlyConnectedInputText.processKey(8);case"↵":return void t._currentlyConnectedInputText.processKey(13)}t._currentlyConnectedInputText.processKey(-1,t.shiftState?e.toUpperCase():e),1===t.shiftState&&(t.shiftState=0,t.applyShiftState(t.shiftState))}}))),this.isVisible=!1,this._currentlyConnectedInputText=e,e._connectedVirtualKeyboard=this;var i=e.onFocusObservable.add((function(){t._currentlyConnectedInputText=e,e._connectedVirtualKeyboard=t,t.isVisible=!0})),n=e.onBlurObservable.add((function(){e._connectedVirtualKeyboard=null,t._currentlyConnectedInputText=null,t.isVisible=!1}));this._connectedInputTexts.push({input:e,onBlurObserver:n,onFocusObserver:i})}},t.prototype.disconnect=function(e){var t=this;if(e){var i=this._connectedInputTexts.filter((function(t){return t.input===e}));1===i.length&&(this._removeConnectedInputObservables(i[0]),this._connectedInputTexts=this._connectedInputTexts.filter((function(t){return t.input!==e})),this._currentlyConnectedInputText===e&&(this._currentlyConnectedInputText=null))}else this._connectedInputTexts.forEach((function(e){t._removeConnectedInputObservables(e)})),this._connectedInputTexts=[];0===this._connectedInputTexts.length&&(this._currentlyConnectedInputText=null,this.onKeyPressObservable.remove(this._onKeyPressObserver),this._onKeyPressObserver=null)},t.prototype._removeConnectedInputObservables=function(e){e.input._connectedVirtualKeyboard=null,e.input.onFocusObservable.remove(e.onFocusObserver),e.input.onBlurObservable.remove(e.onBlurObserver)},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.disconnect()},t.CreateDefaultLayout=function(e){var i=new t(e);return i.addKeysRow(["1","2","3","4","5","6","7","8","9","0","←"]),i.addKeysRow(["q","w","e","r","t","y","u","i","o","p"]),i.addKeysRow(["a","s","d","f","g","h","j","k","l",";","'","↵"]),i.addKeysRow(["⇧","z","x","c","v","b","n","m",",",".","/"]),i.addKeysRow([" "],[{width:"200px"}]),i},t}(_);o.Q.RegisteredTypes["BABYLON.GUI.VirtualKeyboard"]=j;var Y=function(e){function t(t){var i=e.call(this,t)||this;return i.name=t,i._cellWidth=20,i._cellHeight=20,i._minorLineTickness=1,i._minorLineColor="DarkGray",i._majorLineTickness=2,i._majorLineColor="White",i._majorLineFrequency=5,i._background="Black",i._displayMajorLines=!0,i._displayMinorLines=!0,i}return(0,n.ZT)(t,e),Object.defineProperty(t.prototype,"displayMinorLines",{get:function(){return this._displayMinorLines},set:function(e){this._displayMinorLines!==e&&(this._displayMinorLines=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"displayMajorLines",{get:function(){return this._displayMajorLines},set:function(e){this._displayMajorLines!==e&&(this._displayMajorLines=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(e){this._cellWidth=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(e){this._cellHeight=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorLineTickness",{get:function(){return this._minorLineTickness},set:function(e){this._minorLineTickness=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorLineColor",{get:function(){return this._minorLineColor},set:function(e){this._minorLineColor=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorLineTickness",{get:function(){return this._majorLineTickness},set:function(e){this._majorLineTickness=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorLineColor",{get:function(){return this._majorLineColor},set:function(e){this._majorLineColor=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorLineFrequency",{get:function(){return this._majorLineFrequency},set:function(e){this._majorLineFrequency=e,this._markAsDirty()},enumerable:!1,configurable:!0}),t.prototype._draw=function(e,t){if(e.save(),this._applyStates(e),this._isEnabled){this._background&&(e.fillStyle=this._background,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height));var i=this._currentMeasure.width/this._cellWidth,n=this._currentMeasure.height/this._cellHeight,r=this._currentMeasure.left+this._currentMeasure.width/2,o=this._currentMeasure.top+this._currentMeasure.height/2;if(this._displayMinorLines){e.strokeStyle=this._minorLineColor,e.lineWidth=this._minorLineTickness;for(var s=-i/2;s{"use strict";i.d(t,{U:()=>l});var n=i(2973),r=[new n.FM(0,0),new n.FM(0,0),new n.FM(0,0),new n.FM(0,0)],o=[new n.FM(0,0),new n.FM(0,0),new n.FM(0,0),new n.FM(0,0)],s=new n.FM(0,0),a=new n.FM(0,0),l=function(){function e(e,t,i,n){this.left=e,this.top=t,this.width=i,this.height=n}return e.prototype.copyFrom=function(e){this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height},e.prototype.copyFromFloats=function(e,t,i,n){this.left=e,this.top=t,this.width=i,this.height=n},e.CombineToRef=function(e,t,i){var n=Math.min(e.left,t.left),r=Math.min(e.top,t.top),o=Math.max(e.left+e.width,t.left+t.width),s=Math.max(e.top+e.height,t.top+t.height);i.left=n,i.top=r,i.width=o-n,i.height=s-r},e.prototype.addAndTransformToRef=function(e,t,i,n,l,h){var c=this.left+t,u=this.top+i,f=this.width+n,d=this.height+l;r[0].copyFromFloats(c,u),r[1].copyFromFloats(c+f,u),r[2].copyFromFloats(c+f,u+d),r[3].copyFromFloats(c,u+d),s.copyFromFloats(Number.MAX_VALUE,Number.MAX_VALUE),a.copyFromFloats(0,0);for(var p=0;p<4;p++)e.transformCoordinates(r[p].x,r[p].y,o[p]),s.x=Math.floor(Math.min(s.x,o[p].x)),s.y=Math.floor(Math.min(s.y,o[p].y)),a.x=Math.ceil(Math.max(a.x,o[p].x)),a.y=Math.ceil(Math.max(a.y,o[p].y));h.left=s.x,h.top=s.y,h.width=a.x-s.x,h.height=a.y-s.y},e.prototype.transformToRef=function(e,t){this.addAndTransformToRef(e,0,0,0,0,t)},e.prototype.isEqualsTo=function(e){return this.left===e.left&&(this.top===e.top&&(this.width===e.width&&this.height===e.height))},e.Empty=function(){return new e(0,0,0,0)},e}()},4872:(e,t,i)=>{"use strict";i.d(t,{s:()=>n});var n=function(){function e(t,i,n){void 0===i&&(i=e.UNITMODE_PIXEL),void 0===n&&(n=!0),this.unit=i,this.negativeValueAllowed=n,this._value=1,this.ignoreAdaptiveScaling=!1,this._value=t,this._originalUnit=i}return Object.defineProperty(e.prototype,"isPercentage",{get:function(){return this.unit===e.UNITMODE_PERCENTAGE},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPixel",{get:function(){return this.unit===e.UNITMODE_PIXEL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"internalValue",{get:function(){return this._value},enumerable:!1,configurable:!0}),e.prototype.getValueInPixel=function(e,t){return this.isPixel?this.getValue(e):this.getValue(e)*t},e.prototype.updateInPlace=function(t,i){return void 0===i&&(i=e.UNITMODE_PIXEL),this._value=t,this.unit=i,this},e.prototype.getValue=function(t){if(t&&!this.ignoreAdaptiveScaling&&this.unit!==e.UNITMODE_PERCENTAGE){var i=0,n=0;if(t.idealWidth&&(i=this._value*t.getSize().width/t.idealWidth),t.idealHeight&&(n=this._value*t.getSize().height/t.idealHeight),t.useSmallestIdeal&&t.idealWidth&&t.idealHeight)return window.innerWidth{"use strict";i.r(t),i.d(t,{GLTF1:()=>n,GLTF2:()=>r,GLTFFileLoader:()=>D,GLTFLoaderAnimationStartMode:()=>T,GLTFLoaderCoordinateSystemMode:()=>b,GLTFLoaderState:()=>A,GLTFValidation:()=>E});var n={};i.r(n),i.d(n,{EBlendingFunction:()=>O,EComponentType:()=>C,ECullingType:()=>I,EParameterType:()=>S,EShaderType:()=>x,ETextureFilterType:()=>M,ETextureFormat:()=>P,ETextureWrapMode:()=>R,GLTFBinaryExtension:()=>tt,GLTFLoader:()=>$e,GLTFLoaderBase:()=>Je,GLTFLoaderExtension:()=>et,GLTFMaterialsCommonExtension:()=>it,GLTFUtils:()=>Me});var r={};i.r(r),i.d(r,{ArrayItem:()=>Vi,EXT_lights_image_based:()=>Yi,EXT_mesh_gpu_instancing:()=>qi,EXT_texture_webp:()=>Qi,ExtrasAsMetadata:()=>Yn,GLTFLoader:()=>Gi,KHR_draco_mesh_compression:()=>on,KHR_lights:()=>an,KHR_materials_clearcoat:()=>dn,KHR_materials_ior:()=>yn,KHR_materials_pbrSpecularGlossiness:()=>hn,KHR_materials_sheen:()=>_n,KHR_materials_specular:()=>mn,KHR_materials_translucency:()=>Rn,KHR_materials_transmission:()=>xn,KHR_materials_unlit:()=>un,KHR_materials_variants:()=>Tn,KHR_mesh_quantization:()=>Pn,KHR_texture_basisu:()=>On,KHR_texture_transform:()=>Ln,MSFT_audio_emitter:()=>kn,MSFT_lod:()=>Gn,MSFT_minecraftMesh:()=>zn,MSFT_sRGBFactors:()=>Xn});var o=i(475),s=i(5540),a=i(7595),l=i(655),h=i(2611),c=i(6212),u=i(3734),f=i(2733),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,l.ZT)(t,e),t}(h.p),p=function(){this.rootNodes=[],this.skeletons=[],this.animationGroups=[]},_=function(e){function t(t){var i=e.call(this)||this;return i._wasAddedToScene=!1,i.scene=t,i.sounds=[],i.effectLayers=[],i.layers=[],i.lensFlareSystems=[],i.proceduralTextures=[],i.reflectionProbes=[],t.onDisposeObservable.add((function(){i._wasAddedToScene||i.dispose()})),i}return(0,l.ZT)(t,e),t.prototype.instantiateModelsToScene=function(e,t){var i=this;void 0===t&&(t=!1);var n={},r={},o=new p,s=[],a=[],l={doNotInstantiate:!0},h=function(t,i){if(n[t.uniqueId]=i.uniqueId,r[i.uniqueId]=i,e&&(i.name=e(t.name)),i instanceof c.Mesh){var o=i;if(o.morphTargetManager){var s=t.morphTargetManager;o.morphTargetManager=s.clone();for(var a=0;a-1&&t.animations.splice(o,1)}},r=0,o=e.animations;r-1&&s.materials.splice(t,1),(t=a.indexOf(e))>-1&&a.splice(t,1)}))}));var l=[];o.onTextureLoadedObservable.add((function(e){l.push(e),e.onDisposeObservable.addOnce((function(){var t=s.textures.indexOf(e);t>-1&&s.textures.splice(t,1),(t=l.indexOf(e))>-1&&l.splice(t,1)}))}));var h=[];return o.onCameraLoadedObservable.add((function(e){h.push(e)})),o._loader.importMeshAsync(null,e,!0,t,i,n,r).then((function(e){return Array.prototype.push.apply(s.geometries,e.geometries),Array.prototype.push.apply(s.meshes,e.meshes),Array.prototype.push.apply(s.particleSystems,e.particleSystems),Array.prototype.push.apply(s.skeletons,e.skeletons),Array.prototype.push.apply(s.animationGroups,e.animationGroups),Array.prototype.push.apply(s.materials,a),Array.prototype.push.apply(s.textures,l),Array.prototype.push.apply(s.lights,e.lights),Array.prototype.push.apply(s.transformNodes,e.transformNodes),Array.prototype.push.apply(s.cameras,h),s}))}))},e.prototype.canDirectLoad=function(t){return-1!==t.indexOf("asset")&&-1!==t.indexOf("version")||g.M.StartsWith(t,"data:base64,"+e.magicBase64Encoded)||g.M.StartsWith(t,"data:application/octet-stream;base64,"+e.magicBase64Encoded)||g.M.StartsWith(t,"data:model/gltf-binary;base64,"+e.magicBase64Encoded)},e.prototype.directLoad=function(t,i){if(g.M.StartsWith(i,"base64,"+e.magicBase64Encoded)||g.M.StartsWith(i,"application/octet-stream;base64,"+e.magicBase64Encoded)||g.M.StartsWith(i,"model/gltf-binary;base64,"+e.magicBase64Encoded)){var n=s.w1.DecodeBase64(i);return this._validate(t,n),this._unpackBinaryAsync(new m({readAsync:function(e,t){return Promise.resolve(new Uint8Array(n,e,t))},byteLength:n.byteLength}))}return this._validate(t,i),Promise.resolve({json:this._parseJson(i)})},e.prototype.createPlugin=function(){return new e},Object.defineProperty(e.prototype,"loaderState",{get:function(){return this._loader?this._loader.state:null},enumerable:!1,configurable:!0}),e.prototype.whenCompleteAsync=function(){var e=this;return new Promise((function(t,i){e.onCompleteObservable.addOnce((function(){t()})),e.onErrorObservable.addOnce((function(e){i(e)}))}))},e.prototype._loadFile=function(e,t,i,n,r){var o=this,s=t._loadFile(e,i,(function(e){o._onProgress(e,s)}),void 0,n,r);return s.onCompleteObservable.add((function(e){o._requests.splice(o._requests.indexOf(e),1)})),this._requests.push(s),s},e.prototype._requestFile=function(e,t,i,n,r,o){var s=this,a=t._requestFile(e,i,(function(e){s._onProgress(e,a)}),void 0,n,r,o);return a.onCompleteObservable.add((function(e){s._requests.splice(s._requests.indexOf(e),1)})),this._requests.push(a),a},e.prototype._onProgress=function(e,t){if(this._progressCallback){t._lengthComputable=e.lengthComputable,t._loaded=e.loaded,t._total=e.total;for(var i=!0,n=0,r=0,o=0,s=this._requests;o0)throw new Error("Incompatible minimum version: "+i.minVersion)}var o={1:e._CreateGLTF1Loader,2:e._CreateGLTF2Loader}[n.major];if(!o)throw new Error("Unsupported version: "+i.version);return o(this)},e.prototype._parseJson=function(e){this._startPerformanceCounter("Parse JSON"),this._log("JSON length: "+e.length);var t=JSON.parse(e);return this._endPerformanceCounter("Parse JSON"),t},e.prototype._unpackBinaryAsync=function(e){var t=this;return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then((function(){var i=e.readUint32();if(1179937895!==i)throw new Error("Unexpected magic: "+i);var n=e.readUint32();t.loggingEnabled&&t._log("Binary version: "+n);var r,o=e.readUint32();if(0!==e.buffer.byteLength&&o!==e.buffer.byteLength)throw new Error("Length in header does not match actual data length: "+o+" != "+e.buffer.byteLength);switch(n){case 1:r=t._unpackBinaryV1Async(e,o);break;case 2:r=t._unpackBinaryV2Async(e,o);break;default:throw new Error("Unsupported version: "+n)}return t._endPerformanceCounter("Unpack Binary"),r}))},e.prototype._unpackBinaryV1Async=function(e,t){var i=e.readUint32(),n=e.readUint32();if(0!==n)throw new Error("Unexpected content format: "+n);var r=t-e.byteOffset,o={json:this._parseJson(e.readString(i)),bin:null};if(0!==r){var s=e.byteOffset;o.bin={readAsync:function(t,i){return e.buffer.readAsync(s+t,i)},byteLength:r}}return Promise.resolve(o)},e.prototype._unpackBinaryV2Async=function(e,t){var i=this,n=1313821514,r=5130562,o=e.readUint32();if(e.readUint32()!==n)throw new Error("First chunk format is not JSON");return e.byteOffset+o===t?e.loadAsync(o).then((function(){return{json:i._parseJson(e.readString(o)),bin:null}})):e.loadAsync(o+8).then((function(){var s={json:i._parseJson(e.readString(o)),bin:null},a=function(){var i=e.readUint32();switch(e.readUint32()){case n:throw new Error("Unexpected JSON chunk");case r:var o=e.byteOffset;s.bin={readAsync:function(t,i){return e.buffer.readAsync(o+t,i)},byteLength:i},e.skipBytes(i);break;default:e.skipBytes(i)}return e.byteOffset!==t?e.loadAsync(8).then(a):Promise.resolve(s)};return a()}))},e._parseVersion=function(e){if("1.0"===e||"1.0.1"===e)return{major:1,minor:0};var t=(e+"").match(/^(\d+)\.(\d+)/);return t?{major:parseInt(t[1]),minor:parseInt(t[2])}:null},e._compareVersion=function(e,t){return e.major>t.major?1:e.majort.minor?1:e.minor=0&&t._keys.splice(n,1),e||r.preventDefault()))})))},e.prototype.detachControl=function(e){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys=[]},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t1)e.cameraRotation.x=-this._offsetY/this.touchAngularSensibility;else{var t=e._computeLocalCameraSpeed(),i=new L.P(0,0,t*this._offsetY/this.touchMoveSensibility);L.y3.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,e._cameraRotationMatrix),e.cameraDirection.addInPlace(L.P.TransformCoordinates(i,e._cameraRotationMatrix))}}},e.prototype.getClassName=function(){return"FreeCameraTouchInput"},e.prototype.getSimpleName=function(){return"touch"},(0,l.gn)([(0,F.qC)()],e.prototype,"touchAngularSensibility",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"touchMoveSensibility",void 0),e}();k.u.FreeCameraTouchInput=K;var q=function(e){function t(t){var i=e.call(this,t)||this;return i._mouseInput=null,i._mouseWheelInput=null,i}return(0,l.ZT)(t,e),t.prototype.addKeyboard=function(){return this.add(new G),this},t.prototype.addMouse=function(e){return void 0===e&&(e=!0),this._mouseInput||(this._mouseInput=new z(e),this.add(this._mouseInput)),this},t.prototype.removeMouse=function(){return this._mouseInput&&this.remove(this._mouseInput),this},t.prototype.addMouseWheel=function(){return this._mouseWheelInput||(this._mouseWheelInput=new Y,this.add(this._mouseWheelInput)),this},t.prototype.removeMouseWheel=function(){return this._mouseWheelInput&&this.remove(this._mouseWheelInput),this},t.prototype.addTouch=function(){return this.add(new K),this},t.prototype.clear=function(){e.prototype.clear.call(this),this._mouseInput=null},t}(k.p),Z=function(e){function t(t,i,n,r){void 0===r&&(r=!0);var o=e.call(this,t,i,n,r)||this;return o.ellipsoid=new L.P(.5,1,.5),o.ellipsoidOffset=new L.P(0,0,0),o.checkCollisions=!1,o.applyGravity=!1,o._needMoveForGravity=!1,o._oldPosition=L.P.Zero(),o._diffPosition=L.P.Zero(),o._newPosition=L.P.Zero(),o._collisionMask=-1,o._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null);var n;n=t,o._newPosition.copyFrom(n),o._newPosition.subtractToRef(o._oldPosition,o._diffPosition),o._diffPosition.length()>B.Engine.CollisionsEpsilon&&(o.position.addInPlace(o._diffPosition),o.onCollide&&i&&o.onCollide(i))},o.inputs=new q(o),o.inputs.addKeyboard().addMouse(),o}return(0,l.ZT)(t,e),Object.defineProperty(t.prototype,"angularSensibility",{get:function(){var e=this.inputs.attached.mouse;return e?e.angularSensibility:0},set:function(e){var t=this.inputs.attached.mouse;t&&(t.angularSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysUpward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUpward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUpward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysDownward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDownward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDownward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"keysRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!1,configurable:!0}),t.prototype.attachControl=function(e,t){t=s.w1.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t)},t.prototype.detachControl=function(e){this.inputs.detachElement(),this.cameraDirection=new L.P(0,0,0),this.cameraRotation=new L.FM(0,0)},Object.defineProperty(t.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),t.prototype._collideWithWorld=function(e){(this.parent?L.P.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);var t=this.getScene().collisionCoordinator;this._collider||(this._collider=t.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var i=e;this.applyGravity&&(i=e.add(this.getScene().gravity)),t.getNewPosition(this._oldPosition,i,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},t.prototype._checkInputs=function(){this._localDirection||(this._localDirection=L.P.Zero(),this._transformedDirection=L.P.Zero()),this.inputs.checkInputs(),e.prototype._checkInputs.call(this)},t.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):e.prototype._updatePosition.call(this)},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return"FreeCamera"},(0,l.gn)([(0,F.hd)()],t.prototype,"ellipsoid",void 0),(0,l.gn)([(0,F.hd)()],t.prototype,"ellipsoidOffset",void 0),(0,l.gn)([(0,F.qC)()],t.prototype,"checkCollisions",void 0),(0,l.gn)([(0,F.qC)()],t.prototype,"applyGravity",void 0),t}(U.C),Q=i(4635),J=i(8035),$=i(2686),ee=function(e){function t(t,i,n,r,o,s,a){void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===a&&(a=null);var l=e.call(this,t,i.getScene())||this;return l.name=t,l.children=new Array,l.animations=new Array,l._index=null,l._absoluteTransform=new L.y3,l._invertedAbsoluteTransform=new L.y3,l._scalingDeterminant=1,l._worldTransform=new L.y3,l._needToDecompose=!0,l._needToCompose=!1,l._linkedTransformNode=null,l._waitingTransformNodeId=null,l._skeleton=i,l._localMatrix=r?r.clone():L.y3.Identity(),l._restPose=o||l._localMatrix.clone(),l._bindPose=l._localMatrix.clone(),l._baseMatrix=s||l._localMatrix.clone(),l._index=a,i.bones.push(l),l.setParent(n,!1),(s||r)&&l._updateDifferenceMatrix(),l}return(0,l.ZT)(t,e),Object.defineProperty(t.prototype,"_matrix",{get:function(){return this._compose(),this._localMatrix},set:function(e){this._localMatrix.copyFrom(e),this._needToDecompose=!0},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"Bone"},t.prototype.getSkeleton=function(){return this._skeleton},t.prototype.getParent=function(){return this._parent},t.prototype.getChildren=function(){return this.children},t.prototype.getIndex=function(){return null===this._index?this.getSkeleton().bones.indexOf(this):this._index},t.prototype.setParent=function(e,t){if(void 0===t&&(t=!0),this._parent!==e){if(this._parent){var i=this._parent.children.indexOf(this);-1!==i&&this._parent.children.splice(i,1)}this._parent=e,this._parent&&this._parent.children.push(this),t&&this._updateDifferenceMatrix(),this.markAsDirty()}},t.prototype.getLocalMatrix=function(){return this._compose(),this._localMatrix},t.prototype.getBaseMatrix=function(){return this._baseMatrix},t.prototype.getRestPose=function(){return this._restPose},t.prototype.setRestPose=function(e){this._restPose.copyFrom(e)},t.prototype.getBindPose=function(){return this._bindPose},t.prototype.setBindPose=function(e){this._bindPose.copyFrom(e)},t.prototype.getWorldMatrix=function(){return this._worldTransform},t.prototype.returnToRest=function(){this._skeleton._numBonesWithLinkedTransformNode>0?this.updateMatrix(this._restPose,!1,!1):this.updateMatrix(this._restPose,!1,!0)},t.prototype.getInvertedAbsoluteTransform=function(){return this._invertedAbsoluteTransform},t.prototype.getAbsoluteTransform=function(){return this._absoluteTransform},t.prototype.linkTransformNode=function(e){this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode--,this._linkedTransformNode=e,this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode++},t.prototype.getTransformNode=function(){return this._linkedTransformNode},Object.defineProperty(t.prototype,"position",{get:function(){return this._decompose(),this._localPosition},set:function(e){this._decompose(),this._localPosition.copyFrom(e),this._markAsDirtyAndCompose()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this.getRotation()},set:function(e){this.setRotation(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotationQuaternion",{get:function(){return this._decompose(),this._localRotation},set:function(e){this.setRotationQuaternion(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this.getScale()},set:function(e){this.setScale(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"animationPropertiesOverride",{get:function(){return this._skeleton.animationPropertiesOverride},enumerable:!1,configurable:!0}),t.prototype._decompose=function(){this._needToDecompose&&(this._needToDecompose=!1,this._localScaling||(this._localScaling=L.P.Zero(),this._localRotation=L._f.Zero(),this._localPosition=L.P.Zero()),this._localMatrix.decompose(this._localScaling,this._localRotation,this._localPosition))},t.prototype._compose=function(){this._needToCompose&&(this._localScaling?(this._needToCompose=!1,L.y3.ComposeToRef(this._localScaling,this._localRotation,this._localPosition,this._localMatrix)):this._needToCompose=!1)},t.prototype.updateMatrix=function(e,t,i){void 0===t&&(t=!0),void 0===i&&(i=!0),this._baseMatrix.copyFrom(e),t&&this._updateDifferenceMatrix(),i?(this._needToCompose=!1,this._localMatrix.copyFrom(e),this._markAsDirtyAndDecompose()):this.markAsDirty()},t.prototype._updateDifferenceMatrix=function(e,t){if(void 0===t&&(t=!0),e||(e=this._baseMatrix),this._parent?e.multiplyToRef(this._parent._absoluteTransform,this._absoluteTransform):this._absoluteTransform.copyFrom(e),this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform),t)for(var i=0;i>v,b=0;b<6;b++){var T=m[v][b];g&&(T=re(T,y,y,r)),d.texImage2D(b,v,_,y,y,0,c,h,T)}f._bindTextureDirectly(d.TEXTURE_CUBE_MAP,null)}else f.updateRawCubeTexture(p,o,n,r,u);p.isReady=!0,null==t||t._removePendingData(p),l&&l()}}(e)}),void 0,null==t?void 0:t.offlineProvider,!0,(function(e,i){null==t||t._removePendingData(p),h&&e&&h(e.status+" "+e.statusText,i)})),p},ne.B.prototype.createRawTexture2DArray=oe(!1),ne.B.prototype.createRawTexture3D=oe(!0),ne.B.prototype.updateRawTexture2DArray=se(!1),ne.B.prototype.updateRawTexture3D=se(!0);var ae=function(e){function t(t,i,n,r,o,s,a,l,h){void 0===s&&(s=!0),void 0===a&&(a=!1),void 0===l&&(l=3),void 0===h&&(h=0);var c=e.call(this,null,o,!s,a)||this;return c.format=r,c._engine?(c._texture=c._engine.createRawTexture(t,i,n,r,s,a,l,null,h),c.wrapU=te.x.CLAMP_ADDRESSMODE,c.wrapV=te.x.CLAMP_ADDRESSMODE,c):c}return(0,l.ZT)(t,e),t.prototype.update=function(e){this._getEngine().updateRawTexture(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type)},t.CreateLuminanceTexture=function(e,i,n,r,o,s,a){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=3),new t(e,i,n,1,r,o,s,a)},t.CreateLuminanceAlphaTexture=function(e,i,n,r,o,s,a){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=3),new t(e,i,n,2,r,o,s,a)},t.CreateAlphaTexture=function(e,i,n,r,o,s,a){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=3),new t(e,i,n,0,r,o,s,a)},t.CreateRGBTexture=function(e,i,n,r,o,s,a,l){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=3),void 0===l&&(l=0),new t(e,i,n,4,r,o,s,a,l)},t.CreateRGBATexture=function(e,i,n,r,o,s,a,l){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=3),void 0===l&&(l=0),new t(e,i,n,5,r,o,s,a,l)},t.CreateRTexture=function(e,i,n,r,o,s,a,l){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=te.x.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=1),new t(e,i,n,6,r,o,s,a,l)},t}(te.x),le=i(2117),he=i(789),ce=function(){function e(e,t,i){this.name=e,this.id=t,this.bones=new Array,this.needInitialSkinMatrix=!1,this.overrideMesh=null,this._isDirty=!0,this._meshesWithPoseMatrix=new Array,this._identity=L.y3.Identity(),this._ranges={},this._lastAbsoluteTransformsUpdateId=-1,this._canUseTextureForBones=!1,this._uniqueId=0,this._numBonesWithLinkedTransformNode=0,this._hasWaitingData=null,this._waitingOverrideMeshId=null,this.doNotSerialize=!1,this._useTextureToStoreBoneMatrices=!0,this._animationPropertiesOverride=null,this.onBeforeComputeObservable=new o.y$,this.bones=[],this._scene=i||f.l.LastCreatedScene,this._uniqueId=this._scene.getUniqueId(),this._scene.addSkeleton(this),this._isDirty=!0;var n=this._scene.getEngine().getCaps();this._canUseTextureForBones=n.textureFloat&&n.maxVertexTextureImageUnits>0}return Object.defineProperty(e.prototype,"useTextureToStoreBoneMatrices",{get:function(){return this._useTextureToStoreBoneMatrices},set:function(e){this._useTextureToStoreBoneMatrices=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUsingTextureForMatrices",{get:function(){return this.useTextureToStoreBoneMatrices&&this._canUseTextureForBones},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return"Skeleton"},e.prototype.getChildren=function(){return this.bones.filter((function(e){return!e.getParent()}))},e.prototype.getTransformMatrices=function(e){return this.needInitialSkinMatrix&&e._bonesTransformMatrices?e._bonesTransformMatrices:(this._transformMatrices||this.prepare(),this._transformMatrices)},e.prototype.getTransformMatrixTexture=function(e){return this.needInitialSkinMatrix&&e._transformMatrixTexture?e._transformMatrixTexture:this._transformMatrixTexture},e.prototype.getScene=function(){return this._scene},e.prototype.toString=function(e){var t="Name: "+this.name+", nBones: "+this.bones.length;if(t+=", nAnimationRanges: "+(this._ranges?Object.keys(this._ranges).length:"none"),e){t+=", Ranges: {";var i=!0;for(var n in this._ranges)i&&(t+=", ",i=!1),t+=n;t+="}"}return t},e.prototype.getBoneIndexByName=function(e){for(var t=0,i=this.bones.length;t-1&&this._meshesWithPoseMatrix.splice(t,1)},e.prototype._computeTransformMatrices=function(e,t){this.onBeforeComputeObservable.notifyObservers(this);for(var i=0;i0)for(var e=0,t=this.bones;e0&&(s.animation=r.animations[0].serialize()),i.ranges=[],this._ranges){var l=this._ranges[a];if(l){var h={};h.name=a,h.from=l.from,h.to=l.to,i.ranges.push(h)}}}return i},e.Parse=function(t,i){var n,r=new e(t.name,t.id,i);for(t.dimensionsAtRest&&(r.dimensionsAtRest=L.P.FromArray(t.dimensionsAtRest)),r.needInitialSkinMatrix=t.needInitialSkinMatrix,t.overrideMeshId&&(r._hasWaitingData=!0,r._waitingOverrideMeshId=t.overrideMeshId),n=0;n-1&&(a=r.bones[o.parentBoneIndex]);var l=o.rest?L.y3.FromArray(o.rest):null,h=new ee(o.name,r,a,L.y3.FromArray(o.matrix),l,null,s);void 0!==o.id&&null!==o.id&&(h.id=o.id),o.length&&(h.length=o.length),o.metadata&&(h.metadata=o.metadata),o.animation&&h.animations.push(Q.f.Parse(o.animation)),void 0!==o.linkedTransformNodeId&&null!==o.linkedTransformNodeId&&(r._hasWaitingData=!0,h._waitingTransformNodeId=o.linkedTransformNodeId)}if(t.ranges)for(n=0;n0&&(e=this._meshesWithPoseMatrix[0].getPoseMatrix()),e},e.prototype.sortBones=function(){for(var e=new Array,t=new Array(this.bones.length),i=0;i0?this._setDefaultFixedFrustumShadowProjectionMatrix(e):this._setDefaultAutoExtendShadowProjectionMatrix(e,t,i)},t.prototype._setDefaultFixedFrustumShadowProjectionMatrix=function(e){var t=this.getScene().activeCamera;t&&L.y3.OrthoLHToRef(this.shadowFrustumSize,this.shadowFrustumSize,void 0!==this.shadowMinZ?this.shadowMinZ:t.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:t.maxZ,e)},t.prototype._setDefaultAutoExtendShadowProjectionMatrix=function(e,t,i){var n=this.getScene().activeCamera;if(n){if(this.autoUpdateExtends||this._orthoLeft===Number.MAX_VALUE){var r=L.P.Zero();this._orthoLeft=Number.MAX_VALUE,this._orthoRight=Number.MIN_VALUE,this._orthoTop=Number.MIN_VALUE,this._orthoBottom=Number.MAX_VALUE;for(var o=Number.MAX_VALUE,s=Number.MIN_VALUE,a=0;athis._orthoRight&&(this._orthoRight=r.x),r.y>this._orthoTop&&(this._orthoTop=r.y),this.autoCalcShadowZBounds&&(r.zs&&(s=r.z))}this.autoCalcShadowZBounds&&(this._shadowMinZ=o,this._shadowMaxZ=s)}var u=this._orthoRight-this._orthoLeft,f=this._orthoTop-this._orthoBottom;L.y3.OrthoOffCenterLHToRef(this._orthoLeft-u*this.shadowOrthoScale,this._orthoRight+u*this.shadowOrthoScale,this._orthoBottom-f*this.shadowOrthoScale,this._orthoTop+f*this.shadowOrthoScale,void 0!==this.shadowMinZ?this.shadowMinZ:n.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:n.maxZ,e)}},t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},t.prototype.transferToEffect=function(e,t){return this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z,1,t),this):(this._uniformBuffer.updateFloat4("vLightData",this.direction.x,this.direction.y,this.direction.z,1,t),this)},t.prototype.transferToNodeMaterialEffect=function(e,t){return this.computeTransformedInformation()?(e.setFloat3(t,this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z),this):(e.setFloat3(t,this.direction.x,this.direction.y,this.direction.z),this)},t.prototype.getDepthMinZ=function(e){return 1},t.prototype.getDepthMaxZ=function(e){return 1},t.prototype.prepareLightSpecificDefines=function(e,t){e["DIRLIGHT"+t]=!0},(0,l.gn)([(0,F.qC)()],t.prototype,"shadowFrustumSize",null),(0,l.gn)([(0,F.qC)()],t.prototype,"shadowOrthoScale",null),(0,l.gn)([(0,F.qC)()],t.prototype,"autoUpdateExtends",void 0),(0,l.gn)([(0,F.qC)()],t.prototype,"autoCalcShadowZBounds",void 0),t}(Ee);$.N.AddNodeConstructor("Light_Type_0",(function(e,t){return function(){return new xe(e,L.P.Zero(),t)}}));var xe=function(e){function t(t,i,n){var r=e.call(this,t,n)||this;return r._shadowAngle=Math.PI/2,r.position=i,r}return(0,l.ZT)(t,e),Object.defineProperty(t.prototype,"shadowAngle",{get:function(){return this._shadowAngle},set:function(e){this._shadowAngle=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"direction",{get:function(){return this._direction},set:function(e){var t=this.needCube();this._direction=e,this.needCube()!==t&&this._shadowGenerator&&this._shadowGenerator.recreateShadowMap()},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"PointLight"},t.prototype.getTypeID=function(){return Ae._.LIGHTTYPEID_POINTLIGHT},t.prototype.needCube=function(){return!this.direction},t.prototype.getShadowDirection=function(t){if(this.direction)return e.prototype.getShadowDirection.call(this,t);switch(t){case 0:return new L.P(1,0,0);case 1:return new L.P(-1,0,0);case 2:return new L.P(0,-1,0);case 3:return new L.P(0,1,0);case 4:return new L.P(0,0,1);case 5:return new L.P(0,0,-1)}return L.P.Zero()},t.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){var n=this.getScene().activeCamera;n&&L.y3.PerspectiveFovLHToRef(this.shadowAngle,1,this.getDepthMinZ(n),this.getDepthMaxZ(n),e)},t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},t.prototype.transferToEffect=function(e,t){return this.computeTransformedInformation()?this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z,0,t):this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,0,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,0,0,t),this},t.prototype.transferToNodeMaterialEffect=function(e,t){return this.computeTransformedInformation()?e.setFloat3(t,this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z):e.setFloat3(t,this.position.x,this.position.y,this.position.z),this},t.prototype.prepareLightSpecificDefines=function(e,t){e["POINTLIGHT"+t]=!0},(0,l.gn)([(0,F.qC)()],t.prototype,"shadowAngle",null),t}(Ee);$.N.AddNodeConstructor("Light_Type_2",(function(e,t){return function(){return new Re(e,L.P.Zero(),L.P.Zero(),0,0,t)}}));var Se,Re=function(e){function t(t,i,n,r,o,s){var a=e.call(this,t,s)||this;return a._innerAngle=0,a._projectionTextureMatrix=L.y3.Zero(),a._projectionTextureLightNear=1e-6,a._projectionTextureLightFar=1e3,a._projectionTextureUpDirection=L.P.Up(),a._projectionTextureViewLightDirty=!0,a._projectionTextureProjectionLightDirty=!0,a._projectionTextureDirty=!0,a._projectionTextureViewTargetVector=L.P.Zero(),a._projectionTextureViewLightMatrix=L.y3.Zero(),a._projectionTextureProjectionLightMatrix=L.y3.Zero(),a._projectionTextureScalingMatrix=L.y3.FromValues(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1),a.position=i,a.direction=n,a.angle=r,a.exponent=o,a}return(0,l.ZT)(t,e),Object.defineProperty(t.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this._cosHalfAngle=Math.cos(.5*e),this._projectionTextureProjectionLightDirty=!0,this.forceProjectionMatrixCompute(),this._computeAngleValues()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"innerAngle",{get:function(){return this._innerAngle},set:function(e){this._innerAngle=e,this._computeAngleValues()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shadowAngleScale",{get:function(){return this._shadowAngleScale},set:function(e){this._shadowAngleScale=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureMatrix",{get:function(){return this._projectionTextureMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureLightNear",{get:function(){return this._projectionTextureLightNear},set:function(e){this._projectionTextureLightNear=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureLightFar",{get:function(){return this._projectionTextureLightFar},set:function(e){this._projectionTextureLightFar=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureUpDirection",{get:function(){return this._projectionTextureUpDirection},set:function(e){this._projectionTextureUpDirection=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"projectionTexture",{get:function(){return this._projectionTexture},set:function(e){var i=this;this._projectionTexture!==e&&(this._projectionTexture=e,this._projectionTextureDirty=!0,this._projectionTexture&&!this._projectionTexture.isReady()&&(t._IsProceduralTexture(this._projectionTexture)?this._projectionTexture.getEffect().executeWhenCompiled((function(){i._markMeshesAsLightDirty()})):t._IsTexture(this._projectionTexture)&&this._projectionTexture.onLoadObservable.addOnce((function(){i._markMeshesAsLightDirty()}))))},enumerable:!1,configurable:!0}),t._IsProceduralTexture=function(e){return void 0!==e.onGeneratedObservable},t._IsTexture=function(e){return void 0!==e.onLoadObservable},t.prototype.getClassName=function(){return"SpotLight"},t.prototype.getTypeID=function(){return Ae._.LIGHTTYPEID_SPOTLIGHT},t.prototype._setDirection=function(t){e.prototype._setDirection.call(this,t),this._projectionTextureViewLightDirty=!0},t.prototype._setPosition=function(t){e.prototype._setPosition.call(this,t),this._projectionTextureViewLightDirty=!0},t.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){var n=this.getScene().activeCamera;if(n){this._shadowAngleScale=this._shadowAngleScale||1;var r=this._shadowAngleScale*this._angle;L.y3.PerspectiveFovLHToRef(r,1,this.getDepthMinZ(n),this.getDepthMaxZ(n),e)}},t.prototype._computeProjectionTextureViewLightMatrix=function(){this._projectionTextureViewLightDirty=!1,this._projectionTextureDirty=!0,this.position.addToRef(this.direction,this._projectionTextureViewTargetVector),L.y3.LookAtLHToRef(this.position,this._projectionTextureViewTargetVector,this._projectionTextureUpDirection,this._projectionTextureViewLightMatrix)},t.prototype._computeProjectionTextureProjectionLightMatrix=function(){this._projectionTextureProjectionLightDirty=!1,this._projectionTextureDirty=!0;var e=this.projectionTextureLightFar,t=this.projectionTextureLightNear,i=e/(e-t),n=-i*t,r=1/Math.tan(this._angle/2);L.y3.FromValuesToRef(r/1,0,0,0,0,r,0,0,0,0,i,1,0,0,n,0,this._projectionTextureProjectionLightMatrix)},t.prototype._computeProjectionTextureMatrix=function(){if(this._projectionTextureDirty=!1,this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix,this._projectionTextureMatrix),this._projectionTexture instanceof te.x){var e=this._projectionTexture.uScale/2,t=this._projectionTexture.vScale/2;L.y3.FromValuesToRef(e,0,0,0,0,t,0,0,0,0,.5,0,.5,.5,.5,1,this._projectionTextureScalingMatrix)}this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix,this._projectionTextureMatrix)},t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightDirection",3),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},t.prototype._computeAngleValues=function(){this._lightAngleScale=1/Math.max(.001,Math.cos(.5*this._innerAngle)-this._cosHalfAngle),this._lightAngleOffset=-this._cosHalfAngle*this._lightAngleScale},t.prototype.transferTexturesToEffect=function(e,t){return this.projectionTexture&&this.projectionTexture.isReady()&&(this._projectionTextureViewLightDirty&&this._computeProjectionTextureViewLightMatrix(),this._projectionTextureProjectionLightDirty&&this._computeProjectionTextureProjectionLightMatrix(),this._projectionTextureDirty&&this._computeProjectionTextureMatrix(),e.setMatrix("textureProjectionMatrix"+t,this._projectionTextureMatrix),e.setTexture("projectionLightSampler"+t,this.projectionTexture)),this},t.prototype.transferToEffect=function(e,t){var i;return this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z,this.exponent,t),i=L.P.Normalize(this.transformedDirection)):(this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,this.exponent,t),i=L.P.Normalize(this.direction)),this._uniformBuffer.updateFloat4("vLightDirection",i.x,i.y,i.z,this._cosHalfAngle,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,this._lightAngleScale,this._lightAngleOffset,t),this},t.prototype.transferToNodeMaterialEffect=function(e,t){var i;return i=this.computeTransformedInformation()?L.P.Normalize(this.transformedDirection):L.P.Normalize(this.direction),this.getScene().useRightHandedSystem?e.setFloat3(t,-i.x,-i.y,-i.z):e.setFloat3(t,i.x,i.y,i.z),this},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._projectionTexture&&this._projectionTexture.dispose()},t.prototype.prepareLightSpecificDefines=function(e,t){e["SPOTLIGHT"+t]=!0,e["PROJECTEDLIGHTTEXTURE"+t]=!(!this.projectionTexture||!this.projectionTexture.isReady())},(0,l.gn)([(0,F.qC)()],t.prototype,"angle",null),(0,l.gn)([(0,F.qC)()],t.prototype,"innerAngle",null),(0,l.gn)([(0,F.qC)()],t.prototype,"shadowAngleScale",null),(0,l.gn)([(0,F.qC)()],t.prototype,"exponent",void 0),(0,l.gn)([(0,F.qC)()],t.prototype,"projectionTextureLightNear",null),(0,l.gn)([(0,F.qC)()],t.prototype,"projectionTextureLightFar",null),(0,l.gn)([(0,F.qC)()],t.prototype,"projectionTextureUpDirection",null),(0,l.gn)([(0,F.oU)("projectedLightTexture")],t.prototype,"_projectionTexture",void 0),t}(Ee),Me=function(){function e(){}return e.SetMatrix=function(e,t,i,n,r){var o=null;if("MODEL"===i.semantic?o=t.getWorldMatrix():"PROJECTION"===i.semantic?o=e.getProjectionMatrix():"VIEW"===i.semantic?o=e.getViewMatrix():"MODELVIEWINVERSETRANSPOSE"===i.semantic?o=L.y3.Transpose(t.getWorldMatrix().multiply(e.getViewMatrix()).invert()):"MODELVIEW"===i.semantic?o=t.getWorldMatrix().multiply(e.getViewMatrix()):"MODELVIEWPROJECTION"===i.semantic?o=t.getWorldMatrix().multiply(e.getTransformMatrix()):"MODELINVERSE"===i.semantic?o=t.getWorldMatrix().invert():"VIEWINVERSE"===i.semantic?o=e.getViewMatrix().invert():"PROJECTIONINVERSE"===i.semantic?o=e.getProjectionMatrix().invert():"MODELVIEWINVERSE"===i.semantic?o=t.getWorldMatrix().multiply(e.getViewMatrix()).invert():"MODELVIEWPROJECTIONINVERSE"===i.semantic?o=t.getWorldMatrix().multiply(e.getTransformMatrix()).invert():"MODELINVERSETRANSPOSE"===i.semantic&&(o=L.y3.Transpose(t.getWorldMatrix().invert())),o)switch(i.type){case S.FLOAT_MAT2:r.setMatrix2x2(n,L.y3.GetAsMatrix2x2(o));break;case S.FLOAT_MAT3:r.setMatrix3x3(n,L.y3.GetAsMatrix3x3(o));break;case S.FLOAT_MAT4:r.setMatrix(n,o)}},e.SetUniform=function(e,t,i,n){switch(n){case S.FLOAT:return e.setFloat(t,i),!0;case S.FLOAT_VEC2:return e.setVector2(t,L.FM.FromArray(i)),!0;case S.FLOAT_VEC3:return e.setVector3(t,L.P.FromArray(i)),!0;case S.FLOAT_VEC4:return e.setVector4(t,L.Lt.FromArray(i)),!0;default:return!1}},e.GetWrapMode=function(e){switch(e){case R.CLAMP_TO_EDGE:return te.x.CLAMP_ADDRESSMODE;case R.MIRRORED_REPEAT:return te.x.MIRROR_ADDRESSMODE;case R.REPEAT:default:return te.x.WRAP_ADDRESSMODE}},e.GetByteStrideFromType=function(e){switch(e.type){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}},e.GetTextureFilterMode=function(e){switch(e){case M.LINEAR:case M.LINEAR_MIPMAP_NEAREST:case M.LINEAR_MIPMAP_LINEAR:return te.x.TRILINEAR_SAMPLINGMODE;case M.NEAREST:case M.NEAREST_MIPMAP_NEAREST:return te.x.NEAREST_SAMPLINGMODE;default:return te.x.BILINEAR_SAMPLINGMODE}},e.GetBufferFromBufferView=function(e,t,i,n,r){i=t.byteOffset+i;var o=e.loadedBufferViews[t.buffer];if(i+n>o.byteLength)throw new Error("Buffer access is out of range");var s=o.buffer;switch(i+=o.byteOffset,r){case C.BYTE:return new Int8Array(s,i,n);case C.UNSIGNED_BYTE:return new Uint8Array(s,i,n);case C.SHORT:return new Int16Array(s,i,n);case C.UNSIGNED_SHORT:return new Uint16Array(s,i,n);default:return new Float32Array(s,i,n)}},e.GetBufferFromAccessor=function(t,i){var n=t.bufferViews[i.bufferView],r=i.count*e.GetByteStrideFromType(i);return e.GetBufferFromBufferView(t,n,i.byteOffset,r,i.componentType)},e.DecodeBufferToText=function(e){for(var t="",i=e.byteLength,n=0;n=this._maxPos},e}(),Oe=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],De=["world","view","projection","worldView","worldViewProjection","mBones"],Le=["translation","rotation","scale"],we=["position","rotationQuaternion","scaling"],Ne=function(e,t,i){for(var n in e){var r=e[n];i[t][n]=r}},Fe=function(e){if(e)for(var t=0;t0&&(f=Ve(o,r))&&-1===a.indexOf(f)&&a.push(f),new ee(h.jointName||"",n,f,v).id=r}}else s.w1.Warn("Joint named "+t.jointNames[l]+" does not exist")}}var y=n.bones;n.bones=[];for(l=0;l1?(o=new de.G("multimat"+n,e.scene)).subMaterials=s:o=new pe.StandardMaterial("multimat"+n,e.scene),1===s.length&&(o=s[0]),r.material||(r.material=o),new ve.Z(n,e.scene,a,!1,r),r.computeWorldMatrix(!0),e.scene._blockEntityCollection=!1,r.subMeshes=[];var M=0;for(d=0;d0&&-1===e.importMeshesNames.indexOf(t.name||""))return null;if(t.skin){if(t.meshes){var o=e.skins[t.skin];(s=We(e,t,t.meshes,i,t.babylonNode)).skeleton=e.scene.getLastSkeletonByID(t.skin),null===s.skeleton&&(s.skeleton=ze(e,o,0,o.babylonSkeleton,t.skin),o.babylonSkeleton||(o.babylonSkeleton=s.skeleton)),r=s}}else if(t.meshes){var s;r=s=We(e,t,t.mesh?[t.mesh]:t.meshes,i,t.babylonNode)}else if(!t.light||t.babylonNode||e.importOnlyMeshes){if(t.camera&&!t.babylonNode&&!e.importOnlyMeshes){var a=e.cameras[t.camera];if(a){if(e.scene._blockEntityCollection=e.forAssetContainer,"orthographic"===a.type){var l=new Z(t.camera,L.P.Zero(),e.scene,!1);l.name=t.name||"",l.mode=N.V.ORTHOGRAPHIC_CAMERA,l.attachControl(),r=l}else if("perspective"===a.type){var h=a[a.type],u=new Z(t.camera,L.P.Zero(),e.scene,!1);u.name=t.name||"",u.attachControl(),h.aspectRatio||(h.aspectRatio=e.scene.getEngine().getRenderWidth()/e.scene.getEngine().getRenderHeight()),h.znear&&h.zfar&&(u.maxZ=h.zfar,u.minZ=h.znear),r=u}e.scene._blockEntityCollection=!1}}}else{var f=e.lights[t.light];if(f)if("ambient"===f.type){var d=f[f.type],p=new Te.HemisphericLight(t.light,L.P.Zero(),e.scene);p.name=t.name||"",d.color&&(p.diffuse=w.Wo.FromArray(d.color)),r=p}else if("directional"===f.type){var _=f[f.type],g=new Ce(t.light,L.P.Zero(),e.scene);g.name=t.name||"",_.color&&(g.diffuse=w.Wo.FromArray(_.color)),r=g}else if("point"===f.type){var m=f[f.type],v=new xe(t.light,L.P.Zero(),e.scene);v.name=t.name||"",m.color&&(v.diffuse=w.Wo.FromArray(m.color)),r=v}else if("spot"===f.type){var y=f[f.type],b=new Re(t.light,L.P.Zero(),L.P.Zero(),0,0,e.scene);b.name=t.name||"",y.color&&(b.diffuse=w.Wo.FromArray(y.color)),y.fallOfAngle&&(b.angle=y.fallOfAngle),y.fallOffExponent&&(b.exponent=y.fallOffExponent),r=b}}if(!t.jointName){if(t.babylonNode)return t.babylonNode;if(null===r){e.scene._blockEntityCollection=e.forAssetContainer;var T=new c.Mesh(t.name||"",e.scene);e.scene._blockEntityCollection=!1,t.babylonNode=T,r=T}}if(null!==r){if(t.matrix&&r instanceof c.Mesh)!function(e,t,i){if(t.matrix){var n=new L.P(0,0,0),r=new L._f,o=new L.P(0,0,0);L.y3.FromArray(t.matrix).decompose(o,r,n),Xe(e,n,r,o)}else t.translation&&t.rotation&&t.scale&&Xe(e,L.P.FromArray(t.translation),L._f.FromArray(t.rotation),L.P.FromArray(t.scale));e.computeWorldMatrix(!0)}(r,t);else{var A=t.translation||[0,0,0],E=t.rotation||[0,0,0,1],C=t.scale||[1,1,1];Xe(r,L.P.FromArray(A),L._f.FromArray(E),L.P.FromArray(C))}r.updateCache(!0),t.babylonNode=r}return r},Ye=function(e,t,i,n){void 0===n&&(n=!1);var r=e.nodes[t],o=null;if(n=!(e.importOnlyMeshes&&!n&&e.importMeshesNames)||(-1!==e.importMeshesNames.indexOf(r.name||"")||0===e.importMeshesNames.length),!r.jointName&&n&&null!==(o=je(e,r,t))&&(o.id=t,o.parent=i),r.children)for(var s=0;s0&&c.forEach((function(e){r._events.push(e._clone())})),this._enableBlending=e&&e.animationPropertiesOverride?e.animationPropertiesOverride.enableBlending:this._animation.enableBlending}return Object.defineProperty(e.prototype,"currentFrame",{get:function(){return this._currentFrame},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"weight",{get:function(){return this._weight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentValue",{get:function(){return this._currentValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"targetPath",{get:function(){return this._targetPath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._currentActiveTarget},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isAdditive",{get:function(){return this._host&&this._host.isAdditive},enumerable:!1,configurable:!0}),e.prototype._preparePath=function(e,t){void 0===t&&(t=0);var i=this._animation.targetPropertyPath;if(i.length>1){for(var n=e[i[0]],r=1;r-1&&this._animation.runtimeAnimations.splice(e,1)},e.prototype.setValue=function(e,t){if(this._targetIsArray)for(var i=0;it[t.length-1].frame&&(e=t[t.length-1].frame);var i=this._events;if(i.length)for(var n=0;nthis._maxFrame)&&(t=this._minFrame),(ithis._maxFrame)&&(i=this._maxFrame);var h,c,u=i-t,f=e*(s.framePerSecond*r)/1e3+this._ratioOffset,d=0;if(this._previousDelay=e,this._previousRatio=f,!n&&i>=t&&f>=u)l=!1,d=s._getKeyValue(this._maxValue);else if(!n&&t>=i&&f<=u)l=!1,d=s._getKeyValue(this._minValue);else if(this._animationState.loopMode!==Q.f.ANIMATIONLOOPMODE_CYCLE){var p=i.toString()+t.toString();if(!this._offsetsCache[p]){this._animationState.repeatCount=0,this._animationState.loopMode=Q.f.ANIMATIONLOOPMODE_CYCLE;var _=s._interpolate(t,this._animationState),g=s._interpolate(i,this._animationState);switch(this._animationState.loopMode=this._getCorrectLoopMode(),s.dataType){case Q.f.ANIMATIONTYPE_FLOAT:this._offsetsCache[p]=g-_;break;case Q.f.ANIMATIONTYPE_QUATERNION:this._offsetsCache[p]=g.subtract(_);break;case Q.f.ANIMATIONTYPE_VECTOR3:this._offsetsCache[p]=g.subtract(_);case Q.f.ANIMATIONTYPE_VECTOR2:this._offsetsCache[p]=g.subtract(_);case Q.f.ANIMATIONTYPE_SIZE:this._offsetsCache[p]=g.subtract(_);case Q.f.ANIMATIONTYPE_COLOR3:this._offsetsCache[p]=g.subtract(_)}this._highLimitsCache[p]=g}d=this._highLimitsCache[p],h=this._offsetsCache[p]}if(void 0===h)switch(s.dataType){case Q.f.ANIMATIONTYPE_FLOAT:h=0;break;case Q.f.ANIMATIONTYPE_QUATERNION:h=ot;break;case Q.f.ANIMATIONTYPE_VECTOR3:h=st;break;case Q.f.ANIMATIONTYPE_VECTOR2:h=at;break;case Q.f.ANIMATIONTYPE_SIZE:h=lt;break;case Q.f.ANIMATIONTYPE_COLOR3:h=ht}if(this._host&&this._host.syncRoot){var m=this._host.syncRoot;c=t+(i-t)*((m.masterFrame-m.fromFrame)/(m.toFrame-m.fromFrame))}else c=l&&0!==u?t+f%u:i;var v=this._events;if((u>0&&this.currentFrame>c||u<0&&this.currentFrame>0,this._animationState.highLimitValue=d,this._animationState.offsetValue=h;var b=s._interpolate(c,this._animationState);if(this.setValue(b,o),v.length)for(y=0;y0&&c>=v[y].frame&&v[y].frame>=t||u<0&&c<=v[y].frame&&v[y].frame<=t){var T=v[y];T.isDone||(T.onlyOnce&&(v.splice(y,1),y--),T.isDone=!0,T.action(c))}return l||(this._stopped=!0),l},e}(),ut=i(4391),ft=i(5273),dt=function(){function e(e,t,i,n,r,s,a,l,h,c){void 0===i&&(i=0),void 0===n&&(n=100),void 0===r&&(r=!1),void 0===s&&(s=1),void 0===c&&(c=!1),this.target=t,this.fromFrame=i,this.toFrame=n,this.loopAnimation=r,this.onAnimationEnd=a,this.onAnimationLoop=h,this.isAdditive=c,this._localDelayOffset=null,this._pausedDelay=null,this._runtimeAnimations=new Array,this._paused=!1,this._speedRatio=1,this._weight=-1,this._syncRoot=null,this.disposeOnEnd=!0,this.animationStarted=!1,this.onAnimationEndObservable=new o.y$,this.onAnimationLoopObservable=new o.y$,this._scene=e,l&&this.appendAnimations(t,l),this._speedRatio=s,e._activeAnimatables.push(this)}return Object.defineProperty(e.prototype,"syncRoot",{get:function(){return this._syncRoot},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"masterFrame",{get:function(){return 0===this._runtimeAnimations.length?0:this._runtimeAnimations[0].currentFrame},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"weight",{get:function(){return this._weight},set:function(e){this._weight=-1!==e?Math.min(Math.max(e,0),1):-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speedRatio",{get:function(){return this._speedRatio},set:function(e){for(var t=0;t-1&&(this._scene._activeAnimatables.splice(t,1),this._scene._activeAnimatables.push(this))}return this},e.prototype.getAnimations=function(){return this._runtimeAnimations},e.prototype.appendAnimations=function(e,t){for(var i=this,n=0;n-1){for(var n=(o=this._runtimeAnimations).length-1;n>=0;n--){var r=o[n];e&&r.animation.name!=e||(t&&!t(r.target)||(r.dispose(),o.splice(n,1)))}0==o.length&&(this._scene._activeAnimatables.splice(i,1),this._raiseOnAnimationEnd())}}else{if((n=this._scene._activeAnimatables.indexOf(this))>-1){this._scene._activeAnimatables.splice(n,1);var o=this._runtimeAnimations;for(n=0;n0)return;this._animationTimeLast=e}this.deltaTime=this.useConstantAnimationDeltaTime?16:(e-this._animationTimeLast)*this.animationTimeScale,this._animationTimeLast=e;var t=this._activeAnimatables;if(0!==t.length){this._animationTime+=this.deltaTime;for(var i=this._animationTime,n=0;ni&&r>0&&(r*=-1),a&&this.stopAnimation(e,void 0,l),s||(s=new dt(this,e,t,i,n,r,o,void 0,h,c));var u=!l||l(e);if(e.animations&&u&&s.appendAnimations(e,e.animations),e.getAnimatables)for(var f=e.getAnimatables(),d=0;dn&&o>0&&(o*=-1),new dt(this,e,i,n,r,o,s,t,a,l)},ut.Scene.prototype.beginDirectHierarchyAnimation=function(e,t,i,n,r,o,s,a,l,h){void 0===h&&(h=!1);var c=e.getDescendants(t),u=[];u.push(this.beginDirectAnimation(e,i,n,r,o,s,a,l,h));for(var f=0,d=c;f0)r.copyFrom(n);else if(1===e.animations.length){if(L._f.SlerpToRef(n,i.currentValue,Math.min(1,e.totalWeight),r),0===e.totalAdditiveWeight)return r}else if(e.animations.length>1){var o=1,s=void 0,a=void 0;if(e.totalWeight<1){var l=1-e.totalWeight;a=[],(s=[]).push(n),a.push(l)}else{if(2===e.animations.length&&(L._f.SlerpToRef(e.animations[0].currentValue,e.animations[1].currentValue,e.animations[1].weight/e.totalWeight,t),0===e.totalAdditiveWeight))return t;s=[],a=[],o=e.totalWeight}for(var h=0;h=h&&s.frame<=c&&(n?(l=s.value.clone(),_?(a=l.getTranslation(),l.setTranslation(a.scaleInPlace(g))):m&&r?(a=l.getTranslation(),l.setTranslation(a.multiplyInPlace(r))):l=s.value):l=s.value,v.push({frame:s.frame+i,value:l}));return this.animations[0].createRange(t,h+i,c+i),!0};var pt=function(){function e(){}return e.prototype.getClassName=function(){return"TargetedAnimation"},e.prototype.serialize=function(){var e={};return e.animation=this.animation.serialize(),e.targetId=this.target.id,e},e}(),_t=function(){function e(e,t){void 0===t&&(t=null),this.name=e,this._targetedAnimations=new Array,this._animatables=new Array,this._from=Number.MAX_VALUE,this._to=-Number.MAX_VALUE,this._speedRatio=1,this._loopAnimation=!1,this._isAdditive=!1,this.onAnimationEndObservable=new o.y$,this.onAnimationLoopObservable=new o.y$,this.onAnimationGroupLoopObservable=new o.y$,this.onAnimationGroupEndObservable=new o.y$,this.onAnimationGroupPauseObservable=new o.y$,this.onAnimationGroupPlayObservable=new o.y$,this._scene=t||f.l.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._scene.addAnimationGroup(this)}return Object.defineProperty(e.prototype,"from",{get:function(){return this._from},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"to",{get:function(){return this._to},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isStarted",{get:function(){return this._isStarted},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPlaying",{get:function(){return this._isStarted&&!this._isPaused},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speedRatio",{get:function(){return this._speedRatio},set:function(e){if(this._speedRatio!==e){this._speedRatio=e;for(var t=0;tn[0].frame&&(this._from=n[0].frame),this._toe){var s={frame:e,value:r.value,inTangent:r.inTangent,outTangent:r.outTangent,interpolation:r.interpolation};n.splice(0,0,s)}if(o.framen&&this._speedRatio>0&&(this._speedRatio=-t);return this._isStarted=!0,this._isPaused=!1,this.onAnimationGroupPlayObservable.notifyObservers(this),this},e.prototype.pause=function(){if(!this._isStarted)return this;this._isPaused=!0;for(var e=0;e-1&&this._scene.animationGroups.splice(e,1),this.onAnimationEndObservable.clear(),this.onAnimationGroupEndObservable.clear(),this.onAnimationGroupPauseObservable.clear(),this.onAnimationGroupPlayObservable.clear(),this.onAnimationLoopObservable.clear(),this.onAnimationGroupLoopObservable.clear()},e.prototype._checkAnimationGroupEnded=function(e){var t=this._animatables.indexOf(e);t>-1&&this._animatables.splice(t,1),0===this._animatables.length&&(this._isStarted=!1,this.onAnimationGroupEndObservable.notifyObservers(this))},e.prototype.clone=function(t,i){for(var n=new e(t||this.name,this._scene),r=0,o=this._targetedAnimations;r\nvoid main(void)\n{\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\n}");ue.Q.ShadersStore.rgbdDecodePixelShader=mt;i(6593);var vt=function(){function e(){}return e.ExpandRGBDTexture=function(e){var t=e._texture;if(t&&e.isRGBD){var i=t.getEngine(),n=i.getCaps(),r=!1;n.textureHalfFloatRender&&n.textureHalfFloatLinearFiltering?(r=!0,t.type=2):n.textureFloatRender&&n.textureFloatLinearFiltering&&(r=!0,t.type=1),r&&(t.isReady=!1,t._isRGBD=!1,t.invertY=!1),e.onLoadObservable.addOnce((function(){if(r){var n=new gt.D("rgbdDecode","rgbdDecode",null,null,1,null,3,i,!1,void 0,t.type,void 0,null,!1),o=i.createRenderTargetTexture(t.width,{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:t.samplingMode,type:t.type,format:5});n.getEffect().executeWhenCompiled((function(){n.onApply=function(e){e._bindTexture("textureSampler",t),e.setFloat2("scale",1,1)},e.getScene().postProcessManager.directRender([n],o,!0),i.restoreDefaultFramebuffer(),i._releaseTexture(t),i._releaseFramebufferObjects(o),n&&n.dispose(),o._swapAndDie(t),t.isReady=!0}))}}))}},e}(),yt=function(){function e(){}return e.GetEnvironmentBRDFTexture=function(e){if(!e.environmentBRDFTexture){var t=e.useDelayedTextureLoading;e.useDelayedTextureLoading=!1;var i=e._blockEntityCollection;e._blockEntityCollection=!1;var n=te.x.CreateFromBase64String(this._environmentBRDFBase64Texture,"EnvironmentBRDFTexture"+this._instanceNumber++,e,!0,!1,te.x.BILINEAR_SAMPLINGMODE);e._blockEntityCollection=i;var r=e.getEngine().getLoadedTexturesCache(),o=r.indexOf(n.getInternalTexture());-1!==o&&r.splice(o,1),n.isRGBD=!0,n.wrapU=te.x.CLAMP_ADDRESSMODE,n.wrapV=te.x.CLAMP_ADDRESSMODE,e.environmentBRDFTexture=n,e.useDelayedTextureLoading=t,vt.ExpandRGBDTexture(n)}return e.environmentBRDFTexture},e._instanceNumber=0,e._environmentBRDFBase64Texture="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR42u29yY5tWXIlZnbuiSaTbZFUkZRKrCKhElASQA0EoQABgn6hJvoXzfUP+gP9hWb6Bg00IgRoQJaKqUxmZmTEe8/v0uB2u7Fm2T7HIyIrnz88uPvt3f2a2WrMbOvf/u3PvvzP/sUf/N6//i8vf/lv/3v5H//d//Sb//Uq/5u8yf8hV/m/5Cp/L1f5hVzlG7nKJ7mKyJuIXN/hPwqXI/g++zq6rPI5u8z+WqfLre+zy7PrVv9L8brsMiGvk8XLmM/sdfHXal4e3ad6GXPdyu2ij8u/+uv/5cuf/OSLfdtEfvUr+dnf/d0X//t3H/7bf/hP//N/928h/0Yg/4VA/kogfyGQP5Wr/IF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wUwRsfyXpt1nEIRLrqcWeTuk7bigsbid1zD4iDRQtnIdQsyIXnFCn1I9D7ADgxEhOvR5AJosoUbu1FkJyYCi9OhQERoIx+4AX/YqUXQhtYEwKN4Cy1HntLMmtaAQpqfrT/UCoLSxeswjA5UWPPi0mjajUWxMTdVusNvt/ChMdmILK5IRMFu90BMEzFYHdg2GAgeYVHMMJIBTA7EFTx/5fpgTFXz9w/en0ZjD8kCDoKPNGwlB01BmoWQbh+AxR689mBponGJOr9OwmMu3dtJ/ylW1Tik4ElUPmR9RqII+pVhD9ychABMQ51gOIZg+/G+5mGIzLB1JJC5WhzYjhJ7IWmLDpA8jzsAafUPkB2WnFBF4iSxkq1ty7f25rv/+EQLOxs2oUdTSA9HIR9swdBlCcFe9owPC3XWDDC0ISVzsEVbSCF/sWdA5Fu4HJqankp2SeQCYYrImNalfmhpVxYrGkUS4LeSUjg8dD7+D7w/ybIfy7vlB9/HJ978zr7/45Qgajzj+4EjIK/ULHPRAOlKr/aG0AFcqCyu0GcW45Igh6JMJmhA49/U+cEssHNJhtXDC1MOya3j/sAiAGcrEtqtgjBD6wEzSDc7D8o6C8rIqAZyPk+NQoNLAZ1hR64Yl1FBY648smUYKnSg1Xwk/0DyRyArByMUobyByhCcPnOaPyoegREFS4jNfYAw+IHCjdC1J2WDZBke/OyN85J24WiXwDYPoJyYuCD238ulvuzwt6KgHf0shWKsqCFFGjB/w8HU8eeTED9wAAAAABJRU5ErkJggg==",e}(),bt=i(6936),Tt=i(5660),At=i(3552),Et=function(){function e(t){this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.roughness=0,this._indexOfRefraction=e._DefaultIndexOfRefraction,this.indexOfRefraction=e._DefaultIndexOfRefraction,this._texture=null,this.texture=null,this._useRoughnessFromMainTexture=!0,this.useRoughnessFromMainTexture=!0,this._textureRoughness=null,this.textureRoughness=null,this._remapF0OnInterfaceChange=!0,this.remapF0OnInterfaceChange=!0,this._bumpTexture=null,this.bumpTexture=null,this._isTintEnabled=!1,this.isTintEnabled=!1,this.tintColor=w.Wo.White(),this.tintColorAtDistance=1,this.tintThickness=1,this._tintTexture=null,this.tintTexture=null,this._internalMarkAllSubMeshesAsTexturesDirty=t}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t,i,n){if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&Tt.k.ClearCoatTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._textureRoughness&&Tt.k.ClearCoatTextureEnabled&&!this._textureRoughness.isReadyOrNotBlocking())return!1;if(i.getCaps().standardDerivatives&&this._bumpTexture&&Tt.k.ClearCoatBumpTextureEnabled&&!n&&!this._bumpTexture.isReady())return!1;if(this._isTintEnabled&&this._tintTexture&&Tt.k.ClearCoatTintTextureEnabled&&!this._tintTexture.isReadyOrNotBlocking())return!1}return!0},e.prototype.prepareDefines=function(t,i){var n;this._isEnabled?(t.CLEARCOAT=!0,t.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=this._useRoughnessFromMainTexture,t.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL=null!==this._texture&&this._texture._texture===(null===(n=this._textureRoughness)||void 0===n?void 0:n._texture)&&this._texture.checkTransformsAreIdentical(this._textureRoughness),t.CLEARCOAT_REMAP_F0=this._remapF0OnInterfaceChange,t._areTexturesDirty&&i.texturesEnabled&&(this._texture&&Tt.k.ClearCoatTextureEnabled?At.G.PrepareDefinesForMergedUV(this._texture,t,"CLEARCOAT_TEXTURE"):t.CLEARCOAT_TEXTURE=!1,this._textureRoughness&&Tt.k.ClearCoatTextureEnabled?At.G.PrepareDefinesForMergedUV(this._textureRoughness,t,"CLEARCOAT_TEXTURE_ROUGHNESS"):t.CLEARCOAT_TEXTURE_ROUGHNESS=!1,this._bumpTexture&&Tt.k.ClearCoatBumpTextureEnabled?At.G.PrepareDefinesForMergedUV(this._bumpTexture,t,"CLEARCOAT_BUMP"):t.CLEARCOAT_BUMP=!1,t.CLEARCOAT_DEFAULTIOR=this._indexOfRefraction===e._DefaultIndexOfRefraction,this._isTintEnabled?(t.CLEARCOAT_TINT=!0,this._tintTexture&&Tt.k.ClearCoatTintTextureEnabled?At.G.PrepareDefinesForMergedUV(this._tintTexture,t,"CLEARCOAT_TINT_TEXTURE"):t.CLEARCOAT_TINT_TEXTURE=!1):(t.CLEARCOAT_TINT=!1,t.CLEARCOAT_TINT_TEXTURE=!1))):(t.CLEARCOAT=!1,t.CLEARCOAT_TEXTURE=!1,t.CLEARCOAT_TEXTURE_ROUGHNESS=!1,t.CLEARCOAT_BUMP=!1,t.CLEARCOAT_TINT=!1,t.CLEARCOAT_TINT_TEXTURE=!1,t.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,t.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL=!1)},e.prototype.bindForSubMesh=function(e,t,i,n,r,o,s,a){var l,h,c,u,f,d,p,_,g=a._materialDefines,m=g.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL;if(!e.useUbo||!r||!e.isSync){m&&Tt.k.ClearCoatTextureEnabled?(e.updateFloat4("vClearCoatInfos",this._texture.coordinatesIndex,this._texture.level,-1,-1),At.G.BindTextureMatrix(this._texture,e,"clearCoat")):(this._texture||this._textureRoughness)&&Tt.k.ClearCoatTextureEnabled&&(e.updateFloat4("vClearCoatInfos",null!==(h=null===(l=this._texture)||void 0===l?void 0:l.coordinatesIndex)&&void 0!==h?h:0,null!==(u=null===(c=this._texture)||void 0===c?void 0:c.level)&&void 0!==u?u:0,null!==(d=null===(f=this._textureRoughness)||void 0===f?void 0:f.coordinatesIndex)&&void 0!==d?d:0,null!==(_=null===(p=this._textureRoughness)||void 0===p?void 0:p.level)&&void 0!==_?_:0),this._texture&&At.G.BindTextureMatrix(this._texture,e,"clearCoat"),!this._textureRoughness||m||g.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE||At.G.BindTextureMatrix(this._textureRoughness,e,"clearCoatRoughness")),this._bumpTexture&&i.getCaps().standardDerivatives&&Tt.k.ClearCoatTextureEnabled&&!n&&(e.updateFloat2("vClearCoatBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level),At.G.BindTextureMatrix(this._bumpTexture,e,"clearCoatBump"),t._mirroredCameraPosition?e.updateFloat2("vClearCoatTangentSpaceParams",o?1:-1,s?1:-1):e.updateFloat2("vClearCoatTangentSpaceParams",o?-1:1,s?-1:1)),this._tintTexture&&Tt.k.ClearCoatTintTextureEnabled&&(e.updateFloat2("vClearCoatTintInfos",this._tintTexture.coordinatesIndex,this._tintTexture.level),At.G.BindTextureMatrix(this._tintTexture,e,"clearCoatTint")),e.updateFloat2("vClearCoatParams",this.intensity,this.roughness);var v=1-this._indexOfRefraction,y=1+this._indexOfRefraction,b=Math.pow(-v/y,2),T=1/this._indexOfRefraction;e.updateFloat4("vClearCoatRefractionParams",b,T,v,y),this._isTintEnabled&&(e.updateFloat4("vClearCoatTintParams",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintThickness)),e.updateFloat("clearCoatColorAtDistance",Math.max(1e-5,this.tintColorAtDistance)))}t.texturesEnabled&&(this._texture&&Tt.k.ClearCoatTextureEnabled&&e.setTexture("clearCoatSampler",this._texture),this._textureRoughness&&!m&&!g.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE&&Tt.k.ClearCoatTextureEnabled&&e.setTexture("clearCoatRoughnessSampler",this._textureRoughness),this._bumpTexture&&i.getCaps().standardDerivatives&&Tt.k.ClearCoatBumpTextureEnabled&&!n&&e.setTexture("clearCoatBumpSampler",this._bumpTexture),this._isTintEnabled&&this._tintTexture&&Tt.k.ClearCoatTintTextureEnabled&&e.setTexture("clearCoatTintSampler",this._tintTexture))},e.prototype.hasTexture=function(e){return this._texture===e||(this._textureRoughness===e||(this._bumpTexture===e||this._tintTexture===e))},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._textureRoughness&&e.push(this._textureRoughness),this._bumpTexture&&e.push(this._bumpTexture),this._tintTexture&&e.push(this._tintTexture)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._textureRoughness&&this._textureRoughness.animations&&this._textureRoughness.animations.length>0&&e.push(this._textureRoughness),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._tintTexture&&this._tintTexture.animations&&this._tintTexture.animations.length>0&&e.push(this._tintTexture)},e.prototype.dispose=function(e){var t,i,n,r;e&&(null===(t=this._texture)||void 0===t||t.dispose(),null===(i=this._textureRoughness)||void 0===i||i.dispose(),null===(n=this._bumpTexture)||void 0===n||n.dispose(),null===(r=this._tintTexture)||void 0===r||r.dispose())},e.prototype.getClassName=function(){return"PBRClearCoatConfiguration"},e.AddFallbacks=function(e,t,i){return e.CLEARCOAT_BUMP&&t.addFallback(i++,"CLEARCOAT_BUMP"),e.CLEARCOAT_TINT&&t.addFallback(i++,"CLEARCOAT_TINT"),e.CLEARCOAT&&t.addFallback(i++,"CLEARCOAT"),i},e.AddUniforms=function(e){e.push("vClearCoatTangentSpaceParams","vClearCoatParams","vClearCoatRefractionParams","vClearCoatTintParams","clearCoatColorAtDistance","clearCoatMatrix","clearCoatRoughnessMatrix","clearCoatBumpMatrix","clearCoatTintMatrix","vClearCoatInfos","vClearCoatBumpInfos","vClearCoatTintInfos")},e.AddSamplers=function(e){e.push("clearCoatSampler","clearCoatRoughnessSampler","clearCoatBumpSampler","clearCoatTintSampler")},e.PrepareUniformBuffer=function(e){e.addUniform("vClearCoatParams",2),e.addUniform("vClearCoatRefractionParams",4),e.addUniform("vClearCoatInfos",4),e.addUniform("clearCoatMatrix",16),e.addUniform("clearCoatRoughnessMatrix",16),e.addUniform("vClearCoatBumpInfos",2),e.addUniform("vClearCoatTangentSpaceParams",2),e.addUniform("clearCoatBumpMatrix",16),e.addUniform("vClearCoatTintParams",4),e.addUniform("clearCoatColorAtDistance",1),e.addUniform("vClearCoatTintInfos",2),e.addUniform("clearCoatTintMatrix",16)},e.prototype.copyTo=function(e){F.p4.Clone((function(){return e}),this)},e.prototype.serialize=function(){return F.p4.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.p4.Parse((function(){return n}),e,t,i)},e._DefaultIndexOfRefraction=1.5,(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"intensity",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"roughness",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"indexOfRefraction",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"useRoughnessFromMainTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"textureRoughness",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"remapF0OnInterfaceChange",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"bumpTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isTintEnabled",void 0),(0,l.gn)([(0,F.n9)()],e.prototype,"tintColor",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"tintColorAtDistance",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"tintThickness",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"tintTexture",void 0),e}(),Ct=function(){function e(e){this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.direction=new L.FM(1,0),this._texture=null,this.texture=null,this._internalMarkAllSubMeshesAsTexturesDirty=e}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t){return!(e._areTexturesDirty&&t.texturesEnabled&&this._texture&&Tt.k.AnisotropicTextureEnabled&&!this._texture.isReadyOrNotBlocking())},e.prototype.prepareDefines=function(e,t,i){this._isEnabled?(e.ANISOTROPIC=this._isEnabled,this._isEnabled&&!t.isVerticesDataPresent(me.o.TangentKind)&&(e._needUVs=!0,e.MAINUV1=!0),e._areTexturesDirty&&i.texturesEnabled&&(this._texture&&Tt.k.AnisotropicTextureEnabled?At.G.PrepareDefinesForMergedUV(this._texture,e,"ANISOTROPIC_TEXTURE"):e.ANISOTROPIC_TEXTURE=!1)):(e.ANISOTROPIC=!1,e.ANISOTROPIC_TEXTURE=!1)},e.prototype.bindForSubMesh=function(e,t,i){e.useUbo&&i&&e.isSync||(this._texture&&Tt.k.AnisotropicTextureEnabled&&(e.updateFloat2("vAnisotropyInfos",this._texture.coordinatesIndex,this._texture.level),At.G.BindTextureMatrix(this._texture,e,"anisotropy")),e.updateFloat3("vAnisotropy",this.direction.x,this.direction.y,this.intensity)),t.texturesEnabled&&this._texture&&Tt.k.AnisotropicTextureEnabled&&e.setTexture("anisotropySampler",this._texture)},e.prototype.hasTexture=function(e){return this._texture===e},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)},e.prototype.dispose=function(e){e&&this._texture&&this._texture.dispose()},e.prototype.getClassName=function(){return"PBRAnisotropicConfiguration"},e.AddFallbacks=function(e,t,i){return e.ANISOTROPIC&&t.addFallback(i++,"ANISOTROPIC"),i},e.AddUniforms=function(e){e.push("vAnisotropy","vAnisotropyInfos","anisotropyMatrix")},e.PrepareUniformBuffer=function(e){e.addUniform("vAnisotropy",3),e.addUniform("vAnisotropyInfos",2),e.addUniform("anisotropyMatrix",16)},e.AddSamplers=function(e){e.push("anisotropySampler")},e.prototype.copyTo=function(e){F.p4.Clone((function(){return e}),this)},e.prototype.serialize=function(){return F.p4.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.p4.Parse((function(){return n}),e,t,i)},(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"intensity",void 0),(0,l.gn)([(0,F.QC)()],e.prototype,"direction",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),e}(),xt=function(){function e(t){this._useEnergyConservation=e.DEFAULT_USE_ENERGY_CONSERVATION,this.useEnergyConservation=e.DEFAULT_USE_ENERGY_CONSERVATION,this._useSmithVisibilityHeightCorrelated=e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,this.useSmithVisibilityHeightCorrelated=e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,this._useSphericalHarmonics=e.DEFAULT_USE_SPHERICAL_HARMONICS,this.useSphericalHarmonics=e.DEFAULT_USE_SPHERICAL_HARMONICS,this._useSpecularGlossinessInputEnergyConservation=e.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION,this.useSpecularGlossinessInputEnergyConservation=e.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION,this._internalMarkAllSubMeshesAsMiscDirty=t}return e.prototype._markAllSubMeshesAsMiscDirty=function(){this._internalMarkAllSubMeshesAsMiscDirty()},e.prototype.prepareDefines=function(e){e.BRDF_V_HEIGHT_CORRELATED=this._useSmithVisibilityHeightCorrelated,e.MS_BRDF_ENERGY_CONSERVATION=this._useEnergyConservation&&this._useSmithVisibilityHeightCorrelated,e.SPHERICAL_HARMONICS=this._useSphericalHarmonics,e.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION=this._useSpecularGlossinessInputEnergyConservation},e.prototype.getClassName=function(){return"PBRBRDFConfiguration"},e.prototype.copyTo=function(e){F.p4.Clone((function(){return e}),this)},e.prototype.serialize=function(){return F.p4.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.p4.Parse((function(){return n}),e,t,i)},e.DEFAULT_USE_ENERGY_CONSERVATION=!0,e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED=!0,e.DEFAULT_USE_SPHERICAL_HARMONICS=!0,e.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION=!0,(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useEnergyConservation",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useSmithVisibilityHeightCorrelated",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useSphericalHarmonics",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useSpecularGlossinessInputEnergyConservation",void 0),e}(),St=function(){function e(e){this._isEnabled=!1,this.isEnabled=!1,this._linkSheenWithAlbedo=!1,this.linkSheenWithAlbedo=!1,this.intensity=1,this.color=w.Wo.White(),this._texture=null,this.texture=null,this._useRoughnessFromMainTexture=!0,this.useRoughnessFromMainTexture=!0,this._roughness=null,this.roughness=null,this._textureRoughness=null,this.textureRoughness=null,this._albedoScaling=!1,this.albedoScaling=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t){if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&Tt.k.SheenTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._textureRoughness&&Tt.k.SheenTextureEnabled&&!this._textureRoughness.isReadyOrNotBlocking())return!1}return!0},e.prototype.prepareDefines=function(e,t){var i;this._isEnabled?(e.SHEEN=this._isEnabled,e.SHEEN_LINKWITHALBEDO=this._linkSheenWithAlbedo,e.SHEEN_ROUGHNESS=null!==this._roughness,e.SHEEN_ALBEDOSCALING=this._albedoScaling,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=this._useRoughnessFromMainTexture,e.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL=null!==this._texture&&this._texture._texture===(null===(i=this._textureRoughness)||void 0===i?void 0:i._texture)&&this._texture.checkTransformsAreIdentical(this._textureRoughness),e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&Tt.k.SheenTextureEnabled?At.G.PrepareDefinesForMergedUV(this._texture,e,"SHEEN_TEXTURE"):e.SHEEN_TEXTURE=!1,this._textureRoughness&&Tt.k.SheenTextureEnabled?At.G.PrepareDefinesForMergedUV(this._textureRoughness,e,"SHEEN_TEXTURE_ROUGHNESS"):e.SHEEN_TEXTURE_ROUGHNESS=!1)):(e.SHEEN=!1,e.SHEEN_TEXTURE=!1,e.SHEEN_TEXTURE_ROUGHNESS=!1,e.SHEEN_LINKWITHALBEDO=!1,e.SHEEN_ROUGHNESS=!1,e.SHEEN_ALBEDOSCALING=!1,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,e.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL=!1)},e.prototype.bindForSubMesh=function(e,t,i,n){var r,o,s,a,l,h,c,u,f=n._materialDefines,d=f.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL;e.useUbo&&i&&e.isSync||(d&&Tt.k.SheenTextureEnabled?(e.updateFloat4("vSheenInfos",this._texture.coordinatesIndex,this._texture.level,-1,-1),At.G.BindTextureMatrix(this._texture,e,"sheen")):(this._texture||this._textureRoughness)&&Tt.k.SheenTextureEnabled&&(e.updateFloat4("vSheenInfos",null!==(o=null===(r=this._texture)||void 0===r?void 0:r.coordinatesIndex)&&void 0!==o?o:0,null!==(a=null===(s=this._texture)||void 0===s?void 0:s.level)&&void 0!==a?a:0,null!==(h=null===(l=this._textureRoughness)||void 0===l?void 0:l.coordinatesIndex)&&void 0!==h?h:0,null!==(u=null===(c=this._textureRoughness)||void 0===c?void 0:c.level)&&void 0!==u?u:0),this._texture&&At.G.BindTextureMatrix(this._texture,e,"sheen"),!this._textureRoughness||d||f.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE||At.G.BindTextureMatrix(this._textureRoughness,e,"sheenRoughness")),e.updateFloat4("vSheenColor",this.color.r,this.color.g,this.color.b,this.intensity),null!==this._roughness&&e.updateFloat("vSheenRoughness",this._roughness)),t.texturesEnabled&&(this._texture&&Tt.k.SheenTextureEnabled&&e.setTexture("sheenSampler",this._texture),this._textureRoughness&&!d&&!f.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE&&Tt.k.SheenTextureEnabled&&e.setTexture("sheenRoughnessSampler",this._textureRoughness))},e.prototype.hasTexture=function(e){return this._texture===e||this._textureRoughness===e},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._textureRoughness&&e.push(this._textureRoughness)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._textureRoughness&&this._textureRoughness.animations&&this._textureRoughness.animations.length>0&&e.push(this._textureRoughness)},e.prototype.dispose=function(e){var t,i;e&&(null===(t=this._texture)||void 0===t||t.dispose(),null===(i=this._textureRoughness)||void 0===i||i.dispose())},e.prototype.getClassName=function(){return"PBRSheenConfiguration"},e.AddFallbacks=function(e,t,i){return e.SHEEN&&t.addFallback(i++,"SHEEN"),i},e.AddUniforms=function(e){e.push("vSheenColor","vSheenRoughness","vSheenInfos","sheenMatrix","sheenRoughnessMatrix")},e.PrepareUniformBuffer=function(e){e.addUniform("vSheenColor",4),e.addUniform("vSheenRoughness",1),e.addUniform("vSheenInfos",4),e.addUniform("sheenMatrix",16),e.addUniform("sheenRoughnessMatrix",16)},e.AddSamplers=function(e){e.push("sheenSampler"),e.push("sheenRoughnessSampler")},e.prototype.copyTo=function(e){F.p4.Clone((function(){return e}),this)},e.prototype.serialize=function(){return F.p4.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.p4.Parse((function(){return n}),e,t,i)},(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"linkSheenWithAlbedo",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"intensity",void 0),(0,l.gn)([(0,F.n9)()],e.prototype,"color",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"useRoughnessFromMainTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"roughness",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"textureRoughness",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"albedoScaling",void 0),e}(),Rt=i(9018),Mt=function(){function e(e,t,i){this._isRefractionEnabled=!1,this.isRefractionEnabled=!1,this._isTranslucencyEnabled=!1,this.isTranslucencyEnabled=!1,this._isScatteringEnabled=!1,this.isScatteringEnabled=!1,this._scatteringDiffusionProfileIndex=0,this.refractionIntensity=1,this.translucencyIntensity=1,this.useAlbedoToTintRefraction=!1,this._thicknessTexture=null,this.thicknessTexture=null,this._refractionTexture=null,this.refractionTexture=null,this._indexOfRefraction=1.5,this.indexOfRefraction=1.5,this._volumeIndexOfRefraction=-1,this._invertRefractionY=!1,this.invertRefractionY=!1,this._linkRefractionWithTransparency=!1,this.linkRefractionWithTransparency=!1,this.minimumThickness=0,this.maximumThickness=1,this.tintColor=w.Wo.White(),this.tintColorAtDistance=1,this.diffusionDistance=w.Wo.White(),this._useMaskFromThicknessTexture=!1,this.useMaskFromThicknessTexture=!1,this._useMaskFromThicknessTextureGltf=!1,this.useMaskFromThicknessTextureGltf=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e,this._internalMarkScenePrePassDirty=t,this._scene=i}return Object.defineProperty(e.prototype,"scatteringDiffusionProfile",{get:function(){return this._scene.subSurfaceConfiguration?this._scene.subSurfaceConfiguration.ssDiffusionProfileColors[this._scatteringDiffusionProfileIndex]:null},set:function(e){this._scene.enableSubSurfaceForPrePass()&&e&&(this._scatteringDiffusionProfileIndex=this._scene.subSurfaceConfiguration.addDiffusionProfile(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeIndexOfRefraction",{get:function(){return this._volumeIndexOfRefraction>=1?this._volumeIndexOfRefraction:this._indexOfRefraction},set:function(e){this._volumeIndexOfRefraction=e>=1?e:-1},enumerable:!1,configurable:!0}),e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype._markScenePrePassDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty(),this._internalMarkScenePrePassDirty()},e.prototype.isReadyForSubMesh=function(e,t){if(e._areTexturesDirty&&t.texturesEnabled){if(this._thicknessTexture&&Tt.k.ThicknessTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1;var i=this._getRefractionTexture(t);if(i&&Tt.k.RefractionTextureEnabled&&!i.isReadyOrNotBlocking())return!1}return!0},e.prototype.prepareDefines=function(e,t){if(e._areTexturesDirty&&(e.SUBSURFACE=!1,e.SS_TRANSLUCENCY=this._isTranslucencyEnabled,e.SS_SCATTERING=this._isScatteringEnabled,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_MASK_FROM_THICKNESS_TEXTURE=!1,e.SS_MASK_FROM_THICKNESS_TEXTURE_GLTF=!1,e.SS_REFRACTION=!1,e.SS_REFRACTIONMAP_3D=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,e.SS_ALBEDOFORREFRACTIONTINT=!1,(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled)&&(e.SUBSURFACE=!0,e._areTexturesDirty&&t.texturesEnabled&&this._thicknessTexture&&Tt.k.ThicknessTextureEnabled&&At.G.PrepareDefinesForMergedUV(this._thicknessTexture,e,"SS_THICKNESSANDMASK_TEXTURE"),e.SS_MASK_FROM_THICKNESS_TEXTURE=this._useMaskFromThicknessTexture,e.SS_MASK_FROM_THICKNESS_TEXTURE_GLTF=this._useMaskFromThicknessTextureGltf),this._isRefractionEnabled&&t.texturesEnabled)){var i=this._getRefractionTexture(t);i&&Tt.k.RefractionTextureEnabled&&(e.SS_REFRACTION=!0,e.SS_REFRACTIONMAP_3D=i.isCube,e.SS_GAMMAREFRACTION=i.gammaSpace,e.SS_RGBDREFRACTION=i.isRGBD,e.SS_LINEARSPECULARREFRACTION=i.linearSpecularLOD,e.SS_REFRACTIONMAP_OPPOSITEZ=i.invertZ,e.SS_LODINREFRACTIONALPHA=i.lodLevelInAlpha,e.SS_LINKREFRACTIONTOTRANSPARENCY=this._linkRefractionWithTransparency,e.SS_ALBEDOFORREFRACTIONTINT=this.useAlbedoToTintRefraction)}},e.prototype.bindForSubMesh=function(e,t,i,n,r,o){var s=this._getRefractionTexture(t);if(!e.useUbo||!n||!e.isSync){if(this._thicknessTexture&&Tt.k.ThicknessTextureEnabled&&(e.updateFloat2("vThicknessInfos",this._thicknessTexture.coordinatesIndex,this._thicknessTexture.level),At.G.BindTextureMatrix(this._thicknessTexture,e,"thickness")),e.updateFloat2("vThicknessParam",this.minimumThickness,this.maximumThickness-this.minimumThickness),s&&Tt.k.RefractionTextureEnabled){e.updateMatrix("refractionMatrix",s.getReflectionTextureMatrix());var a=1;s.isCube||s.depth&&(a=s.depth);var l=s.getSize().width,h=this.volumeIndexOfRefraction;e.updateFloat4("vRefractionInfos",s.level,1/h,a,this._invertRefractionY?-1:1),e.updateFloat3("vRefractionMicrosurfaceInfos",l,s.lodGenerationScale,s.lodGenerationOffset),o&&e.updateFloat2("vRefractionFilteringInfo",l,Rt.R.Log2(l))}this.isScatteringEnabled&&e.updateFloat("scatteringDiffusionProfile",this._scatteringDiffusionProfileIndex),e.updateColor3("vDiffusionDistance",this.diffusionDistance),e.updateFloat4("vTintColor",this.tintColor.r,this.tintColor.g,this.tintColor.b,this.tintColorAtDistance),e.updateFloat3("vSubSurfaceIntensity",this.refractionIntensity,this.translucencyIntensity,0)}t.texturesEnabled&&(this._thicknessTexture&&Tt.k.ThicknessTextureEnabled&&e.setTexture("thicknessSampler",this._thicknessTexture),s&&Tt.k.RefractionTextureEnabled&&(r?e.setTexture("refractionSampler",s):(e.setTexture("refractionSampler",s._lodTextureMid||s),e.setTexture("refractionSamplerLow",s._lodTextureLow||s),e.setTexture("refractionSamplerHigh",s._lodTextureHigh||s))))},e.prototype.unbind=function(e){return!(!this._refractionTexture||!this._refractionTexture.isRenderTarget)&&(e.setTexture("refractionSampler",null),!0)},e.prototype._getRefractionTexture=function(e){return this._refractionTexture?this._refractionTexture:this._isRefractionEnabled?e.environmentTexture:null},Object.defineProperty(e.prototype,"disableAlphaBlending",{get:function(){return this.isRefractionEnabled&&this._linkRefractionWithTransparency},enumerable:!1,configurable:!0}),e.prototype.fillRenderTargetTextures=function(e){Tt.k.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget&&e.push(this._refractionTexture)},e.prototype.hasTexture=function(e){return this._thicknessTexture===e||this._refractionTexture===e},e.prototype.hasRenderTargetTextures=function(){return!!(Tt.k.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)},e.prototype.getActiveTextures=function(e){this._thicknessTexture&&e.push(this._thicknessTexture),this._refractionTexture&&e.push(this._refractionTexture)},e.prototype.getAnimatables=function(e){this._thicknessTexture&&this._thicknessTexture.animations&&this._thicknessTexture.animations.length>0&&e.push(this._thicknessTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&e.push(this._refractionTexture)},e.prototype.dispose=function(e){e&&(this._thicknessTexture&&this._thicknessTexture.dispose(),this._refractionTexture&&this._refractionTexture.dispose())},e.prototype.getClassName=function(){return"PBRSubSurfaceConfiguration"},e.AddFallbacks=function(e,t,i){return e.SS_SCATTERING&&t.addFallback(i++,"SS_SCATTERING"),e.SS_TRANSLUCENCY&&t.addFallback(i++,"SS_TRANSLUCENCY"),i},e.AddUniforms=function(e){e.push("vDiffusionDistance","vTintColor","vSubSurfaceIntensity","vRefractionMicrosurfaceInfos","vRefractionFilteringInfo","vRefractionInfos","vThicknessInfos","vThicknessParam","refractionMatrix","thicknessMatrix","scatteringDiffusionProfile")},e.AddSamplers=function(e){e.push("thicknessSampler","refractionSampler","refractionSamplerLow","refractionSamplerHigh")},e.PrepareUniformBuffer=function(e){e.addUniform("vRefractionMicrosurfaceInfos",3),e.addUniform("vRefractionFilteringInfo",2),e.addUniform("vRefractionInfos",4),e.addUniform("refractionMatrix",16),e.addUniform("vThicknessInfos",2),e.addUniform("thicknessMatrix",16),e.addUniform("vThicknessParam",2),e.addUniform("vDiffusionDistance",3),e.addUniform("vTintColor",4),e.addUniform("vSubSurfaceIntensity",3),e.addUniform("scatteringDiffusionProfile",1)},e.prototype.copyTo=function(e){F.p4.Clone((function(){return e}),this)},e.prototype.serialize=function(){return F.p4.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.p4.Parse((function(){return n}),e,t,i)},(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isRefractionEnabled",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isTranslucencyEnabled",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markScenePrePassDirty")],e.prototype,"isScatteringEnabled",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"_scatteringDiffusionProfileIndex",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"refractionIntensity",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"translucencyIntensity",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"useAlbedoToTintRefraction",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"thicknessTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"refractionTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"indexOfRefraction",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"_volumeIndexOfRefraction",void 0),(0,l.gn)([(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"volumeIndexOfRefraction",null),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"invertRefractionY",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"linkRefractionWithTransparency",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"minimumThickness",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"maximumThickness",void 0),(0,l.gn)([(0,F.n9)()],e.prototype,"tintColor",void 0),(0,l.gn)([(0,F.qC)()],e.prototype,"tintColorAtDistance",void 0),(0,l.gn)([(0,F.n9)()],e.prototype,"diffusionDistance",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"useMaskFromThicknessTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"useMaskFromThicknessTextureGltf",void 0),e}(),Pt=i(9640),It=i(2659),Ot=i(1345),Dt=i(872),Lt=[Math.sqrt(1/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(3/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(15/(4*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(5/(16*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(15/(16*Math.PI))],wt=[function(e){return 1},function(e){return e.y},function(e){return e.z},function(e){return e.x},function(e){return e.x*e.y},function(e){return e.y*e.z},function(e){return 3*e.z*e.z-1},function(e){return e.x*e.z},function(e){return e.x*e.x-e.y*e.y}],Nt=function(e,t){return Lt[e]*wt[e](t)},Ft=[Math.PI,2*Math.PI/3,2*Math.PI/3,2*Math.PI/3,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4],Bt=function(){function e(){this.preScaled=!1,this.l00=L.P.Zero(),this.l1_1=L.P.Zero(),this.l10=L.P.Zero(),this.l11=L.P.Zero(),this.l2_2=L.P.Zero(),this.l2_1=L.P.Zero(),this.l20=L.P.Zero(),this.l21=L.P.Zero(),this.l22=L.P.Zero()}return e.prototype.addLight=function(e,t,i){var n=new L.P(t.r,t.g,t.b).scale(i);this.l00=this.l00.add(n.scale(Nt(0,e))),this.l1_1=this.l1_1.add(n.scale(Nt(1,e))),this.l10=this.l10.add(n.scale(Nt(2,e))),this.l11=this.l11.add(n.scale(Nt(3,e))),this.l2_2=this.l2_2.add(n.scale(Nt(4,e))),this.l2_1=this.l2_1.add(n.scale(Nt(5,e))),this.l20=this.l20.add(n.scale(Nt(6,e))),this.l21=this.l21.add(n.scale(Nt(7,e))),this.l22=this.l22.add(n.scale(Nt(8,e)))},e.prototype.scaleInPlace=function(e){this.l00.scaleInPlace(e),this.l1_1.scaleInPlace(e),this.l10.scaleInPlace(e),this.l11.scaleInPlace(e),this.l2_2.scaleInPlace(e),this.l2_1.scaleInPlace(e),this.l20.scaleInPlace(e),this.l21.scaleInPlace(e),this.l22.scaleInPlace(e)},e.prototype.convertIncidentRadianceToIrradiance=function(){this.l00.scaleInPlace(Ft[0]),this.l1_1.scaleInPlace(Ft[1]),this.l10.scaleInPlace(Ft[2]),this.l11.scaleInPlace(Ft[3]),this.l2_2.scaleInPlace(Ft[4]),this.l2_1.scaleInPlace(Ft[5]),this.l20.scaleInPlace(Ft[6]),this.l21.scaleInPlace(Ft[7]),this.l22.scaleInPlace(Ft[8])},e.prototype.convertIrradianceToLambertianRadiance=function(){this.scaleInPlace(1/Math.PI)},e.prototype.preScaleForRendering=function(){this.preScaled=!0,this.l00.scaleInPlace(Lt[0]),this.l1_1.scaleInPlace(Lt[1]),this.l10.scaleInPlace(Lt[2]),this.l11.scaleInPlace(Lt[3]),this.l2_2.scaleInPlace(Lt[4]),this.l2_1.scaleInPlace(Lt[5]),this.l20.scaleInPlace(Lt[6]),this.l21.scaleInPlace(Lt[7]),this.l22.scaleInPlace(Lt[8])},e.FromArray=function(t){var i=new e;return L.P.FromArrayToRef(t[0],0,i.l00),L.P.FromArrayToRef(t[1],0,i.l1_1),L.P.FromArrayToRef(t[2],0,i.l10),L.P.FromArrayToRef(t[3],0,i.l11),L.P.FromArrayToRef(t[4],0,i.l2_2),L.P.FromArrayToRef(t[5],0,i.l2_1),L.P.FromArrayToRef(t[6],0,i.l20),L.P.FromArrayToRef(t[7],0,i.l21),L.P.FromArrayToRef(t[8],0,i.l22),i},e.FromPolynomial=function(t){var i=new e;return i.l00=t.xx.scale(.376127).add(t.yy.scale(.376127)).add(t.zz.scale(.376126)),i.l1_1=t.y.scale(.977204),i.l10=t.z.scale(.977204),i.l11=t.x.scale(.977204),i.l2_2=t.xy.scale(1.16538),i.l2_1=t.yz.scale(1.16538),i.l20=t.zz.scale(1.34567).subtract(t.xx.scale(.672834)).subtract(t.yy.scale(.672834)),i.l21=t.zx.scale(1.16538),i.l22=t.xx.scale(1.16538).subtract(t.yy.scale(1.16538)),i.l1_1.scaleInPlace(-1),i.l11.scaleInPlace(-1),i.l2_1.scaleInPlace(-1),i.l21.scaleInPlace(-1),i.scaleInPlace(Math.PI),i},e}(),Ut=function(){function e(){this.x=L.P.Zero(),this.y=L.P.Zero(),this.z=L.P.Zero(),this.xx=L.P.Zero(),this.yy=L.P.Zero(),this.zz=L.P.Zero(),this.xy=L.P.Zero(),this.yz=L.P.Zero(),this.zx=L.P.Zero()}return Object.defineProperty(e.prototype,"preScaledHarmonics",{get:function(){return this._harmonics||(this._harmonics=Bt.FromPolynomial(this)),this._harmonics.preScaled||this._harmonics.preScaleForRendering(),this._harmonics},enumerable:!1,configurable:!0}),e.prototype.addAmbient=function(e){var t=new L.P(e.r,e.g,e.b);this.xx=this.xx.add(t),this.yy=this.yy.add(t),this.zz=this.zz.add(t)},e.prototype.scaleInPlace=function(e){this.x.scaleInPlace(e),this.y.scaleInPlace(e),this.z.scaleInPlace(e),this.xx.scaleInPlace(e),this.yy.scaleInPlace(e),this.zz.scaleInPlace(e),this.yz.scaleInPlace(e),this.zx.scaleInPlace(e),this.xy.scaleInPlace(e)},e.FromHarmonics=function(t){var i=new e;return i._harmonics=t,i.x=t.l11.scale(1.02333).scale(-1),i.y=t.l1_1.scale(1.02333).scale(-1),i.z=t.l10.scale(1.02333),i.xx=t.l00.scale(.886277).subtract(t.l20.scale(.247708)).add(t.l22.scale(.429043)),i.yy=t.l00.scale(.886277).subtract(t.l20.scale(.247708)).subtract(t.l22.scale(.429043)),i.zz=t.l00.scale(.886277).add(t.l20.scale(.495417)),i.yz=t.l2_1.scale(.858086).scale(-1),i.zx=t.l21.scale(.858086).scale(-1),i.xy=t.l2_2.scale(.858086),i.scaleInPlace(1/Math.PI),i},e.FromArray=function(t){var i=new e;return L.P.FromArrayToRef(t[0],0,i.x),L.P.FromArrayToRef(t[1],0,i.y),L.P.FromArrayToRef(t[2],0,i.z),L.P.FromArrayToRef(t[3],0,i.xx),L.P.FromArrayToRef(t[4],0,i.yy),L.P.FromArrayToRef(t[5],0,i.zz),L.P.FromArrayToRef(t[6],0,i.yz),L.P.FromArrayToRef(t[7],0,i.zx),L.P.FromArrayToRef(t[8],0,i.xy),i},e}(),kt=i(2782),Vt=function(e,t,i,n){this.name=e,this.worldAxisForNormal=t,this.worldAxisForFileX=i,this.worldAxisForFileY=n},Gt=function(){function e(){}return e.ConvertCubeMapTextureToSphericalPolynomial=function(e){if(!e.isCube)return null;var t,i,n=e.getSize().width,r=e.readPixels(0),o=e.readPixels(1);e.isRenderTarget?(t=e.readPixels(3),i=e.readPixels(2)):(t=e.readPixels(2),i=e.readPixels(3));var s=e.readPixels(4),a=e.readPixels(5),l=e.gammaSpace,h=0;1!=e.textureType&&2!=e.textureType||(h=1);var c={size:n,right:r,left:o,up:t,down:i,front:s,back:a,format:5,type:h,gammaSpace:l};return this.ConvertCubeMapToSphericalPolynomial(c)},e.ConvertCubeMapToSphericalPolynomial=function(e){for(var t=new Bt,i=0,n=2/e.size,r=n,o=.5*n-1,s=0;s<6;s++)for(var a=this.FileFaces[s],l=e[a.name],h=o,c=5===e.format?4:3,u=0;u0?(i.NUM_SAMPLES=""+this.realTimeFilteringQuality,a.webGLVersion>1&&(i.NUM_SAMPLES=i.NUM_SAMPLES+"u"),i.REALTIME_FILTERING=!0):i.REALTIME_FILTERING=!1,l.coordinatesMode===te.x.INVCUBIC_MODE&&(i.INVERTCUBICMAP=!0),i.REFLECTIONMAP_3D=l.isCube,i.REFLECTIONMAP_CUBIC=!1,i.REFLECTIONMAP_EXPLICIT=!1,i.REFLECTIONMAP_PLANAR=!1,i.REFLECTIONMAP_PROJECTION=!1,i.REFLECTIONMAP_SKYBOX=!1,i.REFLECTIONMAP_SPHERICAL=!1,i.REFLECTIONMAP_EQUIRECTANGULAR=!1,i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,l.coordinatesMode){case te.x.EXPLICIT_MODE:i.REFLECTIONMAP_EXPLICIT=!0;break;case te.x.PLANAR_MODE:i.REFLECTIONMAP_PLANAR=!0;break;case te.x.PROJECTION_MODE:i.REFLECTIONMAP_PROJECTION=!0;break;case te.x.SKYBOX_MODE:i.REFLECTIONMAP_SKYBOX=!0;break;case te.x.SPHERICAL_MODE:i.REFLECTIONMAP_SPHERICAL=!0;break;case te.x.EQUIRECTANGULAR_MODE:i.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case te.x.FIXED_EQUIRECTANGULAR_MODE:i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case te.x.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case te.x.CUBIC_MODE:case te.x.INVCUBIC_MODE:default:i.REFLECTIONMAP_CUBIC=!0,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!!l.boundingBoxSize}l.coordinatesMode!==te.x.SKYBOX_MODE&&(l.irradianceTexture?(i.USEIRRADIANCEMAP=!0,i.USESPHERICALFROMREFLECTIONMAP=!1):l.isCube&&(i.USESPHERICALFROMREFLECTIONMAP=!0,i.USEIRRADIANCEMAP=!1,this._forceIrradianceInFragment||this.realTimeFiltering||s.getEngine().getCaps().maxVaryingVectors<=8?i.USESPHERICALINVERTEX=!1:i.USESPHERICALINVERTEX=!0))}else i.REFLECTION=!1,i.REFLECTIONMAP_3D=!1,i.REFLECTIONMAP_SPHERICAL=!1,i.REFLECTIONMAP_PLANAR=!1,i.REFLECTIONMAP_CUBIC=!1,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,i.REFLECTIONMAP_PROJECTION=!1,i.REFLECTIONMAP_SKYBOX=!1,i.REFLECTIONMAP_EXPLICIT=!1,i.REFLECTIONMAP_EQUIRECTANGULAR=!1,i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,i.INVERTCUBICMAP=!1,i.USESPHERICALFROMREFLECTIONMAP=!1,i.USEIRRADIANCEMAP=!1,i.USESPHERICALINVERTEX=!1,i.REFLECTIONMAP_OPPOSITEZ=!1,i.LODINREFLECTIONALPHA=!1,i.GAMMAREFLECTION=!1,i.RGBDREFLECTION=!1,i.LINEARSPECULARREFLECTION=!1;this._lightmapTexture&&Tt.k.LightmapTextureEnabled?(At.G.PrepareDefinesForMergedUV(this._lightmapTexture,i,"LIGHTMAP"),i.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,i.GAMMALIGHTMAP=this._lightmapTexture.gammaSpace,i.RGBDLIGHTMAP=this._lightmapTexture.isRGBD):i.LIGHTMAP=!1,this._emissiveTexture&&Tt.k.EmissiveTextureEnabled?At.G.PrepareDefinesForMergedUV(this._emissiveTexture,i,"EMISSIVE"):i.EMISSIVE=!1,Tt.k.SpecularTextureEnabled?(this._metallicTexture?(At.G.PrepareDefinesForMergedUV(this._metallicTexture,i,"REFLECTIVITY"),i.ROUGHNESSSTOREINMETALMAPALPHA=this._useRoughnessFromMetallicTextureAlpha,i.ROUGHNESSSTOREINMETALMAPGREEN=!this._useRoughnessFromMetallicTextureAlpha&&this._useRoughnessFromMetallicTextureGreen,i.METALLNESSSTOREINMETALMAPBLUE=this._useMetallnessFromMetallicTextureBlue,i.AOSTOREINMETALMAPRED=this._useAmbientOcclusionFromMetallicTextureRed):this._reflectivityTexture?(At.G.PrepareDefinesForMergedUV(this._reflectivityTexture,i,"REFLECTIVITY"),i.MICROSURFACEFROMREFLECTIVITYMAP=this._useMicroSurfaceFromReflectivityMapAlpha,i.MICROSURFACEAUTOMATIC=this._useAutoMicroSurfaceFromReflectivityMap):i.REFLECTIVITY=!1,this._metallicReflectanceTexture?At.G.PrepareDefinesForMergedUV(this._metallicReflectanceTexture,i,"METALLIC_REFLECTANCE"):i.METALLIC_REFLECTANCE=!1,this._microSurfaceTexture?At.G.PrepareDefinesForMergedUV(this._microSurfaceTexture,i,"MICROSURFACEMAP"):i.MICROSURFACEMAP=!1):(i.REFLECTIVITY=!1,i.MICROSURFACEMAP=!1),s.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&Tt.k.BumpTextureEnabled&&!this._disableBumpMap?(At.G.PrepareDefinesForMergedUV(this._bumpTexture,i,"BUMP"),this._useParallax&&this._albedoTexture&&Tt.k.DiffuseTextureEnabled?(i.PARALLAX=!0,i.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):i.PARALLAX=!1,i.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):i.BUMP=!1,this._environmentBRDFTexture&&Tt.k.ReflectionTextureEnabled?(i.ENVIRONMENTBRDF=!0,i.ENVIRONMENTBRDF_RGBD=this._environmentBRDFTexture.isRGBD):(i.ENVIRONMENTBRDF=!1,i.ENVIRONMENTBRDF_RGBD=!1),this._shouldUseAlphaFromAlbedoTexture()?i.ALPHAFROMALBEDO=!0:i.ALPHAFROMALBEDO=!1}i.SPECULAROVERALPHA=this._useSpecularOverAlpha,this._lightFalloff===t.LIGHTFALLOFF_STANDARD?(i.USEPHYSICALLIGHTFALLOFF=!1,i.USEGLTFLIGHTFALLOFF=!1):this._lightFalloff===t.LIGHTFALLOFF_GLTF?(i.USEPHYSICALLIGHTFALLOFF=!1,i.USEGLTFLIGHTFALLOFF=!0):(i.USEPHYSICALLIGHTFALLOFF=!0,i.USEGLTFLIGHTFALLOFF=!1),i.RADIANCEOVERALPHA=this._useRadianceOverAlpha,!this.backFaceCulling&&this._twoSidedLighting?i.TWOSIDEDLIGHTING=!0:i.TWOSIDEDLIGHTING=!1,i.SPECULARAA=s.getEngine().getCaps().standardDerivatives&&this._enableSpecularAntiAliasing}(i._areTexturesDirty||i._areMiscDirty)&&(i.ALPHATESTVALUE=this._alphaCutOff+(this._alphaCutOff%1==0?".":""),i.PREMULTIPLYALPHA=7===this.alphaMode||8===this.alphaMode,i.ALPHABLEND=this.needAlphaBlendingForMesh(e),i.ALPHAFRESNEL=this._useAlphaFresnel||this._useLinearAlphaFresnel,i.LINEARALPHAFRESNEL=this._useLinearAlphaFresnel),i._areImageProcessingDirty&&this._imageProcessingConfiguration&&this._imageProcessingConfiguration.prepareDefines(i),i.FORCENORMALFORWARD=this._forceNormalForward,i.RADIANCEOCCLUSION=this._useRadianceOcclusion,i.HORIZONOCCLUSION=this._useHorizonOcclusion,i._areMiscDirty&&(At.G.PrepareDefinesForMisc(e,s,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,i),i.UNLIT=this._unlit||(this.pointsCloud||this.wireframe)&&!e.isVerticesDataPresent(me.o.NormalKind),i.DEBUGMODE=this._debugMode),this.detailMap.prepareDefines(i,s),this.subSurface.prepareDefines(i,s),this.clearCoat.prepareDefines(i,s),this.anisotropy.prepareDefines(i,e,s),this.brdf.prepareDefines(i),this.sheen.prepareDefines(i,s),At.G.PrepareDefinesForFrameBoundValues(s,a,i,!!n,r,o),At.G.PrepareDefinesForAttributes(e,i,!0,!0,!0,this._transparencyMode!==t.PBRMATERIAL_OPAQUE)},t.prototype.forceCompilation=function(e,t,i){var n=this,r=(0,l.pi)({clipPlane:!1,useInstances:!1},i),o=new Ii,s=this._prepareEffect(e,o,void 0,void 0,r.useInstances,r.clipPlane,e.hasThinInstances);this._onEffectCreatedObservable&&(Pi.effect=s,Pi.subMesh=null,this._onEffectCreatedObservable.notifyObservers(Pi)),s.isReady()?t&&t(this):s.onCompileObservable.add((function(){t&&t(n)}))},t.prototype.buildUniformLayout=function(){var e=this._uniformBuffer;e.addUniform("vAlbedoInfos",2),e.addUniform("vAmbientInfos",4),e.addUniform("vOpacityInfos",2),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vReflectivityInfos",3),e.addUniform("vMicroSurfaceSamplerInfos",2),e.addUniform("vReflectionInfos",2),e.addUniform("vReflectionFilteringInfo",2),e.addUniform("vReflectionPosition",3),e.addUniform("vReflectionSize",3),e.addUniform("vBumpInfos",3),e.addUniform("albedoMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("reflectivityMatrix",16),e.addUniform("microSurfaceSamplerMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("reflectionMatrix",16),e.addUniform("vReflectionColor",3),e.addUniform("vAlbedoColor",4),e.addUniform("vLightingIntensity",4),e.addUniform("vReflectionMicrosurfaceInfos",3),e.addUniform("pointSize",1),e.addUniform("vReflectivityColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("visibility",1),e.addUniform("vMetallicReflectanceFactors",4),e.addUniform("vMetallicReflectanceInfos",2),e.addUniform("metallicReflectanceMatrix",16),Et.PrepareUniformBuffer(e),Ct.PrepareUniformBuffer(e),St.PrepareUniformBuffer(e),Mt.PrepareUniformBuffer(e),Mi.p.PrepareUniformBuffer(e),e.create()},t.prototype.unbind=function(){if(this._activeEffect){var t=!1;this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&(this._activeEffect.setTexture("reflection2DSampler",null),t=!0),this.subSurface.unbind(this._activeEffect)&&(t=!0),t&&this._markAllSubMeshesAsTexturesDirty()}e.prototype.unbind.call(this)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i._materialDefines;if(r){var o=i.effect;if(o){this._activeEffect=o,r.INSTANCES&&!r.THIN_INSTANCES||this.bindOnlyWorldMatrix(e),this.prePassConfiguration.bindForSubMesh(this._activeEffect,n,t,e,this.isFrozen),r.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var s=this._mustRebind(n,o,t.visibility);At.G.BindBonesParameters(t,this._activeEffect,this.prePassConfiguration);var a=null,l=this._uniformBuffer;if(s){var h=n.getEngine();if(l.bindToEffect(o,"Material"),this.bindViewProjection(o),a=this._getReflectionTexture(),!l.useUbo||!this.isFrozen||!l.isSync){if(n.texturesEnabled){if(this._albedoTexture&&Tt.k.DiffuseTextureEnabled&&(l.updateFloat2("vAlbedoInfos",this._albedoTexture.coordinatesIndex,this._albedoTexture.level),At.G.BindTextureMatrix(this._albedoTexture,l,"albedo")),this._ambientTexture&&Tt.k.AmbientTextureEnabled&&(l.updateFloat4("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level,this._ambientTextureStrength,this._ambientTextureImpactOnAnalyticalLights),At.G.BindTextureMatrix(this._ambientTexture,l,"ambient")),this._opacityTexture&&Tt.k.OpacityTextureEnabled&&(l.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),At.G.BindTextureMatrix(this._opacityTexture,l,"opacity")),a&&Tt.k.ReflectionTextureEnabled){if(l.updateMatrix("reflectionMatrix",a.getReflectionTextureMatrix()),l.updateFloat2("vReflectionInfos",a.level,0),a.boundingBoxSize){var c=a;l.updateVector3("vReflectionPosition",c.boundingBoxPosition),l.updateVector3("vReflectionSize",c.boundingBoxSize)}if(this.realTimeFiltering){var u=a.getSize().width;l.updateFloat2("vReflectionFilteringInfo",u,Rt.R.Log2(u))}if(!r.USEIRRADIANCEMAP){var f=a.sphericalPolynomial;if(r.USESPHERICALFROMREFLECTIONMAP&&f)if(r.SPHERICAL_HARMONICS){var d=f.preScaledHarmonics;this._activeEffect.setVector3("vSphericalL00",d.l00),this._activeEffect.setVector3("vSphericalL1_1",d.l1_1),this._activeEffect.setVector3("vSphericalL10",d.l10),this._activeEffect.setVector3("vSphericalL11",d.l11),this._activeEffect.setVector3("vSphericalL2_2",d.l2_2),this._activeEffect.setVector3("vSphericalL2_1",d.l2_1),this._activeEffect.setVector3("vSphericalL20",d.l20),this._activeEffect.setVector3("vSphericalL21",d.l21),this._activeEffect.setVector3("vSphericalL22",d.l22)}else this._activeEffect.setFloat3("vSphericalX",f.x.x,f.x.y,f.x.z),this._activeEffect.setFloat3("vSphericalY",f.y.x,f.y.y,f.y.z),this._activeEffect.setFloat3("vSphericalZ",f.z.x,f.z.y,f.z.z),this._activeEffect.setFloat3("vSphericalXX_ZZ",f.xx.x-f.zz.x,f.xx.y-f.zz.y,f.xx.z-f.zz.z),this._activeEffect.setFloat3("vSphericalYY_ZZ",f.yy.x-f.zz.x,f.yy.y-f.zz.y,f.yy.z-f.zz.z),this._activeEffect.setFloat3("vSphericalZZ",f.zz.x,f.zz.y,f.zz.z),this._activeEffect.setFloat3("vSphericalXY",f.xy.x,f.xy.y,f.xy.z),this._activeEffect.setFloat3("vSphericalYZ",f.yz.x,f.yz.y,f.yz.z),this._activeEffect.setFloat3("vSphericalZX",f.zx.x,f.zx.y,f.zx.z)}l.updateFloat3("vReflectionMicrosurfaceInfos",a.getSize().width,a.lodGenerationScale,a.lodGenerationOffset)}this._emissiveTexture&&Tt.k.EmissiveTextureEnabled&&(l.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),At.G.BindTextureMatrix(this._emissiveTexture,l,"emissive")),this._lightmapTexture&&Tt.k.LightmapTextureEnabled&&(l.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),At.G.BindTextureMatrix(this._lightmapTexture,l,"lightmap")),Tt.k.SpecularTextureEnabled&&(this._metallicTexture?(l.updateFloat3("vReflectivityInfos",this._metallicTexture.coordinatesIndex,this._metallicTexture.level,this._ambientTextureStrength),At.G.BindTextureMatrix(this._metallicTexture,l,"reflectivity")):this._reflectivityTexture&&(l.updateFloat3("vReflectivityInfos",this._reflectivityTexture.coordinatesIndex,this._reflectivityTexture.level,1),At.G.BindTextureMatrix(this._reflectivityTexture,l,"reflectivity")),this._metallicReflectanceTexture&&(l.updateFloat2("vMetallicReflectanceInfos",this._metallicReflectanceTexture.coordinatesIndex,this._metallicReflectanceTexture.level),At.G.BindTextureMatrix(this._metallicReflectanceTexture,l,"metallicReflectance")),this._microSurfaceTexture&&(l.updateFloat2("vMicroSurfaceSamplerInfos",this._microSurfaceTexture.coordinatesIndex,this._microSurfaceTexture.level),At.G.BindTextureMatrix(this._microSurfaceTexture,l,"microSurfaceSampler"))),this._bumpTexture&&h.getCaps().standardDerivatives&&Tt.k.BumpTextureEnabled&&!this._disableBumpMap&&(l.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level,this._parallaxScaleBias),At.G.BindTextureMatrix(this._bumpTexture,l,"bump"),n._mirroredCameraPosition?l.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):l.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1))}if(this.pointsCloud&&l.updateFloat("pointSize",this.pointSize),r.METALLICWORKFLOW){w.zZ.Color3[0].r=void 0===this._metallic||null===this._metallic?1:this._metallic,w.zZ.Color3[0].g=void 0===this._roughness||null===this._roughness?1:this._roughness,l.updateColor4("vReflectivityColor",w.zZ.Color3[0],1);var p=this.subSurface.indexOfRefraction,_=Math.pow((p-1)/(p+1),2);this._metallicReflectanceColor.scaleToRef(_*this._metallicF0Factor,w.zZ.Color3[0]);var g=this._metallicF0Factor;l.updateColor4("vMetallicReflectanceFactors",w.zZ.Color3[0],g)}else l.updateColor4("vReflectivityColor",this._reflectivityColor,this._microSurface);l.updateColor3("vEmissiveColor",Tt.k.EmissiveTextureEnabled?this._emissiveColor:w.Wo.BlackReadOnly),l.updateColor3("vReflectionColor",this._reflectionColor),!r.SS_REFRACTION&&this.subSurface.linkRefractionWithTransparency?l.updateColor4("vAlbedoColor",this._albedoColor,1):l.updateColor4("vAlbedoColor",this._albedoColor,this.alpha),this._lightingInfos.x=this._directIntensity,this._lightingInfos.y=this._emissiveIntensity,this._lightingInfos.z=this._environmentIntensity*n.environmentIntensity,this._lightingInfos.w=this._specularIntensity,l.updateVector4("vLightingIntensity",this._lightingInfos)}l.updateFloat("visibility",t.visibility),n.texturesEnabled&&(this._albedoTexture&&Tt.k.DiffuseTextureEnabled&&l.setTexture("albedoSampler",this._albedoTexture),this._ambientTexture&&Tt.k.AmbientTextureEnabled&&l.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&Tt.k.OpacityTextureEnabled&&l.setTexture("opacitySampler",this._opacityTexture),a&&Tt.k.ReflectionTextureEnabled&&(r.LODBASEDMICROSFURACE?l.setTexture("reflectionSampler",a):(l.setTexture("reflectionSampler",a._lodTextureMid||a),l.setTexture("reflectionSamplerLow",a._lodTextureLow||a),l.setTexture("reflectionSamplerHigh",a._lodTextureHigh||a)),r.USEIRRADIANCEMAP&&l.setTexture("irradianceSampler",a.irradianceTexture)),r.ENVIRONMENTBRDF&&l.setTexture("environmentBrdfSampler",this._environmentBRDFTexture),this._emissiveTexture&&Tt.k.EmissiveTextureEnabled&&l.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&Tt.k.LightmapTextureEnabled&&l.setTexture("lightmapSampler",this._lightmapTexture),Tt.k.SpecularTextureEnabled&&(this._metallicTexture?l.setTexture("reflectivitySampler",this._metallicTexture):this._reflectivityTexture&&l.setTexture("reflectivitySampler",this._reflectivityTexture),this._metallicReflectanceTexture&&l.setTexture("metallicReflectanceSampler",this._metallicReflectanceTexture),this._microSurfaceTexture&&l.setTexture("microSurfaceSampler",this._microSurfaceTexture)),this._bumpTexture&&h.getCaps().standardDerivatives&&Tt.k.BumpTextureEnabled&&!this._disableBumpMap&&l.setTexture("bumpSampler",this._bumpTexture)),this.detailMap.bindForSubMesh(l,n,this.isFrozen),this.subSurface.bindForSubMesh(l,n,h,this.isFrozen,r.LODBASEDMICROSFURACE,this.realTimeFiltering),this.clearCoat.bindForSubMesh(l,n,h,this._disableBumpMap,this.isFrozen,this._invertNormalMapX,this._invertNormalMapY,i),this.anisotropy.bindForSubMesh(l,n,this.isFrozen),this.sheen.bindForSubMesh(l,n,this.isFrozen,i),At.G.BindClipPlane(this._activeEffect,n),n.ambientColor.multiplyToRef(this._ambientColor,this._globalAmbientColor);var m=n._forcedViewPosition?n._forcedViewPosition:n._mirroredCameraPosition?n._mirroredCameraPosition:n.activeCamera.globalPosition,v=n.useRightHandedSystem===(null!=n._mirroredCameraPosition);o.setFloat4("vEyePosition",m.x,m.y,m.z,v?-1:1),o.setColor3("vAmbientColor",this._globalAmbientColor),o.setFloat2("vDebugMode",this.debugLimit,this.debugFactor)}!s&&this.isFrozen||(n.lightsEnabled&&!this._disableLighting&&At.G.BindLights(n,t,this._activeEffect,r,this._maxSimultaneousLights,this._rebuildInParallel),(n.fogEnabled&&t.applyFog&&n.fogMode!==ut.Scene.FOGMODE_NONE||a)&&this.bindView(o),At.G.BindFogParameters(n,t,this._activeEffect,!0),r.NUM_MORPH_INFLUENCERS&&At.G.BindMorphTargetParameters(t,this._activeEffect),this._imageProcessingConfiguration.bind(this._activeEffect),At.G.BindLogDepth(r,this._activeEffect,n)),l.update(),this._afterBind(t,this._activeEffect)}}},t.prototype.getAnimatables=function(){var e=[];return this._albedoTexture&&this._albedoTexture.animations&&this._albedoTexture.animations.length>0&&e.push(this._albedoTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&e.push(this._emissiveTexture),this._metallicTexture&&this._metallicTexture.animations&&this._metallicTexture.animations.length>0?e.push(this._metallicTexture):this._reflectivityTexture&&this._reflectivityTexture.animations&&this._reflectivityTexture.animations.length>0&&e.push(this._reflectivityTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&e.push(this._lightmapTexture),this.detailMap.getAnimatables(e),this.subSurface.getAnimatables(e),this.clearCoat.getAnimatables(e),this.sheen.getAnimatables(e),this.anisotropy.getAnimatables(e),e},t.prototype._getReflectionTexture=function(){return this._reflectionTexture?this._reflectionTexture:this.getScene().environmentTexture},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._albedoTexture&&t.push(this._albedoTexture),this._ambientTexture&&t.push(this._ambientTexture),this._opacityTexture&&t.push(this._opacityTexture),this._reflectionTexture&&t.push(this._reflectionTexture),this._emissiveTexture&&t.push(this._emissiveTexture),this._reflectivityTexture&&t.push(this._reflectivityTexture),this._metallicTexture&&t.push(this._metallicTexture),this._metallicReflectanceTexture&&t.push(this._metallicReflectanceTexture),this._microSurfaceTexture&&t.push(this._microSurfaceTexture),this._bumpTexture&&t.push(this._bumpTexture),this._lightmapTexture&&t.push(this._lightmapTexture),this.detailMap.getActiveTextures(t),this.subSurface.getActiveTextures(t),this.clearCoat.getActiveTextures(t),this.sheen.getActiveTextures(t),this.anisotropy.getActiveTextures(t),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._albedoTexture===t||(this._ambientTexture===t||(this._opacityTexture===t||(this._reflectionTexture===t||(this._reflectivityTexture===t||(this._metallicTexture===t||(this._metallicReflectanceTexture===t||(this._microSurfaceTexture===t||(this._bumpTexture===t||(this._lightmapTexture===t||(this.detailMap.hasTexture(t)||this.subSurface.hasTexture(t)||this.clearCoat.hasTexture(t)||this.sheen.hasTexture(t)||this.anisotropy.hasTexture(t))))))))))))},t.prototype.setPrePassRenderer=function(e){if(this.subSurface.isScatteringEnabled){var t=this.getScene().enableSubSurfaceForPrePass();return t&&(t.enabled=!0),!0}return!1},t.prototype.dispose=function(t,i){var n,r,o,s,a,l,h,c,u,f,d;i&&(this._environmentBRDFTexture&&this.getScene().environmentBRDFTexture!==this._environmentBRDFTexture&&this._environmentBRDFTexture.dispose(),null===(n=this._albedoTexture)||void 0===n||n.dispose(),null===(r=this._ambientTexture)||void 0===r||r.dispose(),null===(o=this._opacityTexture)||void 0===o||o.dispose(),null===(s=this._reflectionTexture)||void 0===s||s.dispose(),null===(a=this._emissiveTexture)||void 0===a||a.dispose(),null===(l=this._metallicTexture)||void 0===l||l.dispose(),null===(h=this._reflectivityTexture)||void 0===h||h.dispose(),null===(c=this._bumpTexture)||void 0===c||c.dispose(),null===(u=this._lightmapTexture)||void 0===u||u.dispose(),null===(f=this._metallicReflectanceTexture)||void 0===f||f.dispose(),null===(d=this._microSurfaceTexture)||void 0===d||d.dispose()),this.detailMap.dispose(i),this.subSurface.dispose(i),this.clearCoat.dispose(i),this.sheen.dispose(i),this.anisotropy.dispose(i),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t,i)},t.PBRMATERIAL_OPAQUE=fe.F.MATERIAL_OPAQUE,t.PBRMATERIAL_ALPHATEST=fe.F.MATERIAL_ALPHATEST,t.PBRMATERIAL_ALPHABLEND=fe.F.MATERIAL_ALPHABLEND,t.PBRMATERIAL_ALPHATESTANDBLEND=fe.F.MATERIAL_ALPHATESTANDBLEND,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=0,t.LIGHTFALLOFF_PHYSICAL=0,t.LIGHTFALLOFF_GLTF=1,t.LIGHTFALLOFF_STANDARD=2,(0,l.gn)([(0,F.rX)()],t.prototype,"_imageProcessingConfiguration",void 0),(0,l.gn)([(0,F.wz)("_markAllSubMeshesAsMiscDirty")],t.prototype,"debugMode",void 0),(0,l.gn)([(0,F.qC)()],t.prototype,"useLogarithmicDepth",null),t}(Dt.a),Di=i(6132),Li=function(e){function t(i,n){var r=e.call(this,i,n)||this;return r.directIntensity=1,r.emissiveIntensity=1,r.environmentIntensity=1,r.specularIntensity=1,r.disableBumpMap=!1,r.ambientTextureStrength=1,r.ambientTextureImpactOnAnalyticalLights=t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,r.metallicF0Factor=1,r.metallicReflectanceColor=w.Wo.White(),r.ambientColor=new w.Wo(0,0,0),r.albedoColor=new w.Wo(1,1,1),r.reflectivityColor=new w.Wo(1,1,1),r.reflectionColor=new w.Wo(1,1,1),r.emissiveColor=new w.Wo(0,0,0),r.microSurface=1,r.useLightmapAsShadowmap=!1,r.useAlphaFromAlbedoTexture=!1,r.forceAlphaTest=!1,r.alphaCutOff=.4,r.useSpecularOverAlpha=!0,r.useMicroSurfaceFromReflectivityMapAlpha=!1,r.useRoughnessFromMetallicTextureAlpha=!0,r.useRoughnessFromMetallicTextureGreen=!1,r.useMetallnessFromMetallicTextureBlue=!1,r.useAmbientOcclusionFromMetallicTextureRed=!1,r.useAmbientInGrayScale=!1,r.useAutoMicroSurfaceFromReflectivityMap=!1,r.useRadianceOverAlpha=!0,r.useObjectSpaceNormalMap=!1,r.useParallax=!1,r.useParallaxOcclusion=!1,r.parallaxScaleBias=.05,r.disableLighting=!1,r.forceIrradianceInFragment=!1,r.maxSimultaneousLights=4,r.invertNormalMapX=!1,r.invertNormalMapY=!1,r.twoSidedLighting=!1,r.useAlphaFresnel=!1,r.useLinearAlphaFresnel=!1,r.environmentBRDFTexture=null,r.forceNormalForward=!1,r.enableSpecularAntiAliasing=!1,r.useHorizonOcclusion=!0,r.useRadianceOcclusion=!0,r.unlit=!1,r._environmentBRDFTexture=yt.GetEnvironmentBRDFTexture(n),r}return(0,l.ZT)(t,e),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this.subSurface.refractionTexture},set:function(e){this.subSurface.refractionTexture=e,e?this.subSurface.isRefractionEnabled=!0:this.subSurface.linkRefractionWithTransparency||(this.subSurface.isRefractionEnabled=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"indexOfRefraction",{get:function(){return this.subSurface.indexOfRefraction},set:function(e){this.subSurface.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"invertRefractionY",{get:function(){return this.subSurface.invertRefractionY},set:function(e){this.subSurface.invertRefractionY=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linkRefractionWithTransparency",{get:function(){return this.subSurface.linkRefractionWithTransparency},set:function(e){this.subSurface.linkRefractionWithTransparency=e,e&&(this.subSurface.isRefractionEnabled=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"usePhysicalLightFalloff",{get:function(){return this._lightFalloff===Oi.LIGHTFALLOFF_PHYSICAL},set:function(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?Oi.LIGHTFALLOFF_PHYSICAL:Oi.LIGHTFALLOFF_STANDARD)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useGLTFLightFalloff",{get:function(){return this._lightFalloff===Oi.LIGHTFALLOFF_GLTF},set:function(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?Oi.LIGHTFALLOFF_GLTF:Oi.LIGHTFALLOFF_STANDARD)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraToneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraExposure",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraContrast",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorGradingTexture",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this._imageProcessingConfiguration.colorGradingTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorCurves",{get:function(){return this._imageProcessingConfiguration.colorCurves},set:function(e){this._imageProcessingConfiguration.colorCurves=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return"PBRMaterial"},t.prototype.clone=function(e){var i=this,n=F.p4.Clone((function(){return new t(e,i.getScene())}),this);return n.id=e,n.name=e,this.clearCoat.copyTo(n.clearCoat),this.anisotropy.copyTo(n.anisotropy),this.brdf.copyTo(n.brdf),this.sheen.copyTo(n.sheen),this.subSurface.copyTo(n.subSurface),n},t.prototype.serialize=function(){var e=F.p4.Serialize(this);return e.customType="BABYLON.PBRMaterial",e.clearCoat=this.clearCoat.serialize(),e.anisotropy=this.anisotropy.serialize(),e.brdf=this.brdf.serialize(),e.sheen=this.sheen.serialize(),e.subSurface=this.subSurface.serialize(),e},t.Parse=function(e,i,n){var r=F.p4.Parse((function(){return new t(e.name,i)}),e,i,n);return e.clearCoat&&r.clearCoat.parse(e.clearCoat,i,n),e.anisotropy&&r.anisotropy.parse(e.anisotropy,i,n),e.brdf&&r.brdf.parse(e.brdf,i,n),e.sheen&&r.sheen.parse(e.sheen,i,n),e.subSurface&&r.subSurface.parse(e.subSurface,i,n),r},t.PBRMATERIAL_OPAQUE=Oi.PBRMATERIAL_OPAQUE,t.PBRMATERIAL_ALPHATEST=Oi.PBRMATERIAL_ALPHATEST,t.PBRMATERIAL_ALPHABLEND=Oi.PBRMATERIAL_ALPHABLEND,t.PBRMATERIAL_ALPHATESTANDBLEND=Oi.PBRMATERIAL_ALPHATESTANDBLEND,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=Oi.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"directIntensity",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveIntensity",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"environmentIntensity",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"specularIntensity",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"disableBumpMap",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"albedoTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTextureStrength",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTextureImpactOnAnalyticalLights",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"opacityTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectivityTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallic",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"roughness",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicF0Factor",void 0),(0,l.gn)([(0,F.n9)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicReflectanceColor",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicReflectanceTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"microSurfaceTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty",null)],t.prototype,"lightmapTexture",void 0),(0,l.gn)([(0,F.n9)("ambient"),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientColor",void 0),(0,l.gn)([(0,F.n9)("albedo"),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"albedoColor",void 0),(0,l.gn)([(0,F.n9)("reflectivity"),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectivityColor",void 0),(0,l.gn)([(0,F.n9)("reflection"),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionColor",void 0),(0,l.gn)([(0,F.n9)("emissive"),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveColor",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"microSurface",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLightmapAsShadowmap",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"useAlphaFromAlbedoTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"forceAlphaTest",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"alphaCutOff",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useSpecularOverAlpha",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useMicroSurfaceFromReflectivityMapAlpha",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRoughnessFromMetallicTextureAlpha",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRoughnessFromMetallicTextureGreen",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useMetallnessFromMetallicTextureBlue",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAmbientInGrayScale",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAutoMicroSurfaceFromReflectivityMap",void 0),(0,l.gn)([(0,F.qC)()],t.prototype,"usePhysicalLightFalloff",null),(0,l.gn)([(0,F.qC)()],t.prototype,"useGLTFLightFalloff",null),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRadianceOverAlpha",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useObjectSpaceNormalMap",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallax",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallaxOcclusion",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"parallaxScaleBias",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"forceIrradianceInFragment",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapX",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapY",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"twoSidedLighting",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAlphaFresnel",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLinearAlphaFresnel",void 0),(0,l.gn)([(0,F.oU)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"environmentBRDFTexture",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"forceNormalForward",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"enableSpecularAntiAliasing",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useHorizonOcclusion",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRadianceOcclusion",void 0),(0,l.gn)([(0,F.qC)(),(0,F.wz)("_markAllSubMeshesAsMiscDirty")],t.prototype,"unlit",void 0),t}(Oi);Di.Q.RegisteredTypes["BABYLON.PBRMaterial"]=Li;var wi=i(5511),Ni=function(){function e(e,t,i){void 0===t&&(t=0),void 0===i&&(i=null),this.name=e,this.animations=new Array,this._positions=null,this._normals=null,this._tangents=null,this._uvs=null,this._uniqueId=0,this.onInfluenceChanged=new o.y$,this._onDataLayoutChanged=new o.y$,this._animationPropertiesOverride=null,this._scene=i||f.l.LastCreatedScene,this.influence=t,this._scene&&(this._uniqueId=this._scene.getUniqueId())}return Object.defineProperty(e.prototype,"influence",{get:function(){return this._influence},set:function(e){if(this._influence!==e){var t=this._influence;this._influence=e,this.onInfluenceChanged.hasObservers()&&this.onInfluenceChanged.notifyObservers(0===t||0===e)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"animationPropertiesOverride",{get:function(){return!this._animationPropertiesOverride&&this._scene?this._scene.animationPropertiesOverride:this._animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasPositions",{get:function(){return!!this._positions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNormals",{get:function(){return!!this._normals},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasTangents",{get:function(){return!!this._tangents},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasUVs",{get:function(){return!!this._uvs},enumerable:!1,configurable:!0}),e.prototype.setPositions=function(e){var t=this.hasPositions;this._positions=e,t!==this.hasPositions&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getPositions=function(){return this._positions},e.prototype.setNormals=function(e){var t=this.hasNormals;this._normals=e,t!==this.hasNormals&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getNormals=function(){return this._normals},e.prototype.setTangents=function(e){var t=this.hasTangents;this._tangents=e,t!==this.hasTangents&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getTangents=function(){return this._tangents},e.prototype.setUVs=function(e){var t=this.hasUVs;this._uvs=e,t!==this.hasUVs&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getUVs=function(){return this._uvs},e.prototype.clone=function(){var t=this,i=F.p4.Clone((function(){return new e(t.name,t.influence,t._scene)}),this);return i._positions=this._positions,i._normals=this._normals,i._tangents=this._tangents,i._uvs=this._uvs,i},e.prototype.serialize=function(){var e={};return e.name=this.name,e.influence=this.influence,e.positions=Array.prototype.slice.call(this.getPositions()),null!=this.id&&(e.id=this.id),this.hasNormals&&(e.normals=Array.prototype.slice.call(this.getNormals())),this.hasTangents&&(e.tangents=Array.prototype.slice.call(this.getTangents())),this.hasUVs&&(e.uvs=Array.prototype.slice.call(this.getUVs())),F.p4.AppendSerializedAnimations(this,e),e},e.prototype.getClassName=function(){return"MorphTarget"},e.Parse=function(t){var i=new e(t.name,t.influence);if(i.setPositions(t.positions),null!=t.id&&(i.id=t.id),t.normals&&i.setNormals(t.normals),t.tangents&&i.setTangents(t.tangents),t.uvs&&i.setUVs(t.uvs),t.animations)for(var n=0;n=0&&(this._targets.splice(t,1),e.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(t,1)[0]),e._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(t,1)[0]),this._syncActiveTargets(!0))},e.prototype.clone=function(){for(var t=new e(this._scene),i=0,n=this._targets;i "+A[A.READY],r=A[A.LOADING]+" => "+A[A.COMPLETE];i._parent._startPerformanceCounter(n),i._parent._startPerformanceCounter(r),i._setState(A.LOADING),i._extensionsOnLoading();var o=new Array,a=i._babylonScene.blockMaterialDirtyMechanism;if(i._babylonScene.blockMaterialDirtyMechanism=!0,e)o.push(i.loadSceneAsync("/nodes",{nodes:e,index:-1}));else if(null!=i._gltf.scene||i._gltf.scenes&&i._gltf.scenes[0]){var l=Vi.Get("/scene",i._gltf.scenes,i._gltf.scene||0);o.push(i.loadSceneAsync("/scenes/"+l.index,l))}if(i.parent.loadAllMaterials&&i._gltf.materials)for(var h=0;he.bin.byteLength)&&u.Y.Warn("Binary buffer length ("+i.byteLength+") from JSON does not match chunk length ("+e.bin.byteLength+")"),this._bin=e.bin}else u.Y.Warn("Unexpected BIN chunk")}},e.prototype._setupData=function(){if(Vi.Assign(this._gltf.accessors),Vi.Assign(this._gltf.animations),Vi.Assign(this._gltf.buffers),Vi.Assign(this._gltf.bufferViews),Vi.Assign(this._gltf.cameras),Vi.Assign(this._gltf.images),Vi.Assign(this._gltf.materials),Vi.Assign(this._gltf.meshes),Vi.Assign(this._gltf.nodes),Vi.Assign(this._gltf.samplers),Vi.Assign(this._gltf.scenes),Vi.Assign(this._gltf.skins),Vi.Assign(this._gltf.textures),this._gltf.nodes){for(var e={},t=0,i=this._gltf.nodes;t=2)throw new Error(t+"/texCoord: Invalid value ("+i.texCoord+")");var s=Vi.Get(t+"/index",this._gltf.textures,i.index);s._textureInfo=i;var a=this._loadTextureAsync("/textures/"+i.index,s,(function(o){o.coordinatesIndex=i.texCoord||0,e.AddPointerMetadata(o,t),r._parent.onTextureLoadedObservable.notifyObservers(o),n(o)}));return this.logClose(),a},e.prototype._loadTextureAsync=function(t,i,n){void 0===n&&(n=function(){});var r=this._extensionsLoadTextureAsync(t,i,n);if(r)return r;this.logOpen(t+" "+(i.name||""));var o=null==i.sampler?e.DefaultSampler:Vi.Get(t+"/sampler",this._gltf.samplers,i.sampler),s=Vi.Get(t+"/source",this._gltf.images,i.source),a=this._createTextureAsync(t,o,s,n);return this.logClose(),a},e.prototype._createTextureAsync=function(e,t,i,n,r){var o=this;void 0===n&&(n=function(){});var s=this._loadSampler("/samplers/"+t.index,t),a=new Array,l=new nt;this._babylonScene._blockEntityCollection=this._forAssetContainer;var h=new te.x(null,this._babylonScene,s.noMipMaps,!1,s.samplingMode,(function(){o._disposed||l.resolve()}),(function(t,i){o._disposed||l.reject(new Error(e+": "+(i&&i.message?i.message:t||"Failed to load texture")))}),void 0,void 0,void 0,i.mimeType,r);return this._babylonScene._blockEntityCollection=!1,a.push(l.promise),a.push(this.loadImageAsync("/images/"+i.index,i).then((function(e){var t=i.uri||o._fileName+"#image"+i.index,n="data:"+o._uniqueRootUrl+t;h.updateURL(n,e)}))),h.wrapU=s.wrapU,h.wrapV=s.wrapV,n(h),Promise.all(a).then((function(){return h}))},e.prototype._loadSampler=function(t,i){return i._data||(i._data={noMipMaps:9728===i.minFilter||9729===i.minFilter,samplingMode:e._GetTextureSamplingMode(t,i),wrapU:e._GetTextureWrapMode(t+"/wrapS",i.wrapS),wrapV:e._GetTextureWrapMode(t+"/wrapT",i.wrapT)}),i._data},e.prototype.loadImageAsync=function(e,t){if(!t._data){if(this.logOpen(e+" "+(t.name||"")),t.uri)t._data=this.loadUriAsync(e+"/uri",t,t.uri);else{var i=Vi.Get(e+"/bufferView",this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync("/bufferViews/"+i.index,i)}this.logClose()}return t._data},e.prototype.loadUriAsync=function(t,i,n){var r=this,o=this._extensionsLoadUriAsync(t,i,n);if(o)return o;if(!e._ValidateUri(n))throw new Error(t+": '"+n+"' is invalid");if(s.w1.IsBase64(n)){var a=new Uint8Array(s.w1.DecodeBase64(n));return this.log("Decoded "+n.substr(0,64)+"... ("+a.length+" bytes)"),Promise.resolve(a)}return this.log("Loading "+n),this._parent.preprocessUrlAsync(this._rootUrl+n).then((function(e){return new Promise((function(i,o){r._parent._loadFile(e,r._babylonScene,(function(e){r._disposed||(r.log("Loaded "+n+" ("+e.byteLength+" bytes)"),i(new Uint8Array(e)))}),!0,(function(e){o(new Ui.eh(t+": Failed to load '"+n+"'"+(e?": "+e.status+" "+e.statusText:""),e))}))}))}))},e.AddPointerMetadata=function(e,t){var i=e.metadata=e.metadata||{},n=i.gltf=i.gltf||{};(n.pointers=n.pointers||[]).push(t)},e._GetTextureWrapMode=function(e,t){switch(t=null==t?10497:t){case 33071:return te.x.CLAMP_ADDRESSMODE;case 33648:return te.x.MIRROR_ADDRESSMODE;case 10497:return te.x.WRAP_ADDRESSMODE;default:return u.Y.Warn(e+": Invalid value ("+t+")"),te.x.WRAP_ADDRESSMODE}},e._GetTextureSamplingMode=function(e,t){var i=null==t.magFilter?9729:t.magFilter,n=null==t.minFilter?9987:t.minFilter;if(9729===i)switch(n){case 9728:return te.x.LINEAR_NEAREST;case 9729:return te.x.LINEAR_LINEAR;case 9984:return te.x.LINEAR_NEAREST_MIPNEAREST;case 9985:return te.x.LINEAR_LINEAR_MIPNEAREST;case 9986:return te.x.LINEAR_NEAREST_MIPLINEAR;case 9987:return te.x.LINEAR_LINEAR_MIPLINEAR;default:return u.Y.Warn(e+"/minFilter: Invalid value ("+n+")"),te.x.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==i&&u.Y.Warn(e+"/magFilter: Invalid value ("+i+")"),n){case 9728:return te.x.NEAREST_NEAREST;case 9729:return te.x.NEAREST_LINEAR;case 9984:return te.x.NEAREST_NEAREST_MIPNEAREST;case 9985:return te.x.NEAREST_LINEAR_MIPNEAREST;case 9986:return te.x.NEAREST_NEAREST_MIPLINEAR;case 9987:return te.x.NEAREST_LINEAR_MIPLINEAR;default:return u.Y.Warn(e+"/minFilter: Invalid value ("+n+")"),te.x.NEAREST_NEAREST_MIPNEAREST}},e._GetTypedArrayConstructor=function(e,t){switch(t){case 5120:return Int8Array;case 5121:return Uint8Array;case 5122:return Int16Array;case 5123:return Uint16Array;case 5125:return Uint32Array;case 5126:return Float32Array;default:throw new Error(e+": Invalid component type "+t)}},e._GetTypedArray=function(t,i,n,r,o){var s=n.buffer;r=n.byteOffset+(r||0);var a=e._GetTypedArrayConstructor(t+"/componentType",i);try{return new a(s,r,o)}catch(e){throw new Error(t+": "+e)}},e._GetNumComponents=function(e,t){switch(t){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}throw new Error(e+": Invalid type ("+t+")")},e._ValidateUri=function(e){return s.w1.IsBase64(e)||-1===e.indexOf("..")},e._GetDrawMode=function(e,t){switch(null==t&&(t=4),t){case 0:return fe.F.PointListDrawMode;case 1:return fe.F.LineListDrawMode;case 2:return fe.F.LineLoopDrawMode;case 3:return fe.F.LineStripDrawMode;case 4:return fe.F.TriangleFillMode;case 5:return fe.F.TriangleStripDrawMode;case 6:return fe.F.TriangleFanDrawMode}throw new Error(e+": Invalid mesh primitive mode ("+t+")")},e.prototype._compileMaterialsAsync=function(){var e=this;this._parent._startPerformanceCounter("Compile materials");var t=new Array;if(this._gltf.materials)for(var i=0,n=this._gltf.materials;i-1?e.substring(v).toLowerCase():""),b=null,T=0,A=ne.B._TextureLoaders;T-1?t.substring(y).toLowerCase():""),T=".dds"===b,A=".env"===b;if(A?(v.gammaSpace=!1,v._prefiltered=!1,v.anisotropicFilteringLevel=1):(v._prefiltered=u,u&&(v.gammaSpace=!1,v.anisotropicFilteringLevel=1)),v._texture=v._getFromCache(t,r),!a&&(A||T||n||(n=["_px.jpg","_py.jpg","_pz.jpg","_nx.jpg","_ny.jpg","_nz.jpg"]),a=[],n))for(var E=0;E=0&&a.renderTargetTextures.splice(r,1)}if(this._opaqueRenderTarget&&(t=this._scene.customRenderTargets.indexOf(this._opaqueRenderTarget),this._opaqueRenderTarget.dispose()),this._opaqueRenderTarget=new An._("opaqueSceneTexture",this._options.renderSize,this._scene,!0),this._opaqueRenderTarget.renderList=this._opaqueMeshesCache,this._opaqueRenderTarget.gammaSpace=!0,this._opaqueRenderTarget.lodGenerationScale=1,this._opaqueRenderTarget.lodGenerationOffset=-4,t>=0?this._scene.customRenderTargets.splice(t,0,this._opaqueRenderTarget):(t=this._scene.customRenderTargets.length,this._scene.customRenderTargets.push(this._opaqueRenderTarget)),this._scene.layers&&this._opaqueRenderTarget)for(var o=0,s=this._scene.layers;o0&&(g=!0,this._soundLoaded(i));break;case"String":_.push(i);case"Array":0===_.length&&(_=i);for(var m=0;m<_.length;m++){var v=_[m];if(g=a&&a.skipCodecCheck||-1!==v.indexOf(".mp3",v.length-4)&&B.Engine.audioEngine.isMP3supported||-1!==v.indexOf(".ogg",v.length-4)&&B.Engine.audioEngine.isOGGsupported||-1!==v.indexOf(".wav",v.length-4)||-1!==v.indexOf(".m4a",v.length-4)||-1!==v.indexOf("blob:")){this._streaming?(this._htmlAudioElement=new Audio(v),this._htmlAudioElement.controls=!1,this._htmlAudioElement.loop=this.loop,s.w1.SetCorsBehavior(v,this._htmlAudioElement),this._htmlAudioElement.preload="auto",this._htmlAudioElement.addEventListener("canplaythrough",(function(){d._isReadyToPlay=!0,d.autoplay&&d.play(0,d._offset,d._length),d._readyToPlayCallback&&d._readyToPlayCallback()})),document.body.appendChild(this._htmlAudioElement),this._htmlAudioElement.load()):this._scene._loadFile(v,(function(e){d._soundLoaded(e)}),void 0,!0,!0,(function(e){e&&u.Y.Error("XHR "+e.status+" error on: "+v+"."),u.Y.Error("Sound creation aborted."),d._scene.mainSoundTrack.removeSound(d)}));break}}break;default:p=!1}p?g||(this._isReadyToPlay=!0,this._readyToPlayCallback&&window.setTimeout((function(){d._readyToPlayCallback&&d._readyToPlayCallback()}),1e3)):u.Y.Error("Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.")}catch(e){u.Y.Error("Unexpected error. Sound creation aborted."),this._scene.mainSoundTrack.removeSound(this)}}else this._scene.mainSoundTrack.addSound(this),B.Engine.audioEngine.WarnedWebAudioUnsupported||(u.Y.Error("Web Audio is not supported by your browser."),B.Engine.audioEngine.WarnedWebAudioUnsupported=!0),this._readyToPlayCallback&&window.setTimeout((function(){d._readyToPlayCallback&&d._readyToPlayCallback()}),1e3)}return Object.defineProperty(e.prototype,"currentTime",{get:function(){if(this._htmlAudioElement)return this._htmlAudioElement.currentTime;var e=this._startOffset;return this.isPlaying&&B.Engine.audioEngine.audioContext&&(e+=B.Engine.audioEngine.audioContext.currentTime-this._startTime),e},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){B.Engine.audioEngine.canUseWebAudio&&(this.isPlaying&&this.stop(),this._isReadyToPlay=!1,-1===this.soundTrackId?this._scene.mainSoundTrack.removeSound(this):this._scene.soundTracks&&this._scene.soundTracks[this.soundTrackId].removeSound(this),this._soundGain&&(this._soundGain.disconnect(),this._soundGain=null),this._soundPanner&&(this._soundPanner.disconnect(),this._soundPanner=null),this._soundSource&&(this._soundSource.disconnect(),this._soundSource=null),this._audioBuffer=null,this._htmlAudioElement&&(this._htmlAudioElement.pause(),this._htmlAudioElement.src="",document.body.removeChild(this._htmlAudioElement)),this._streamingSource&&this._streamingSource.disconnect(),this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._connectedTransformNode=null))},e.prototype.isReady=function(){return this._isReadyToPlay},e.prototype._soundLoaded=function(e){var t=this;B.Engine.audioEngine.audioContext&&B.Engine.audioEngine.audioContext.decodeAudioData(e,(function(e){t._audioBuffer=e,t._isReadyToPlay=!0,t.autoplay&&t.play(0,t._offset,t._length),t._readyToPlayCallback&&t._readyToPlayCallback()}),(function(e){u.Y.Error("Error while decoding audio data for: "+t.name+" / Error: "+e)}))},e.prototype.setAudioBuffer=function(e){B.Engine.audioEngine.canUseWebAudio&&(this._audioBuffer=e,this._isReadyToPlay=!0)},e.prototype.updateOptions=function(e){var t,i,n,r,o,s,a,l,h;e&&(this.loop=null!==(t=e.loop)&&void 0!==t?t:this.loop,this.maxDistance=null!==(i=e.maxDistance)&&void 0!==i?i:this.maxDistance,this.useCustomAttenuation=null!==(n=e.useCustomAttenuation)&&void 0!==n?n:this.useCustomAttenuation,this.rolloffFactor=null!==(r=e.rolloffFactor)&&void 0!==r?r:this.rolloffFactor,this.refDistance=null!==(o=e.refDistance)&&void 0!==o?o:this.refDistance,this.distanceModel=null!==(s=e.distanceModel)&&void 0!==s?s:this.distanceModel,this._playbackRate=null!==(a=e.playbackRate)&&void 0!==a?a:this._playbackRate,this._length=null!==(l=e.length)&&void 0!==l?l:void 0,this._offset=null!==(h=e.offset)&&void 0!==h?h:void 0,this._updateSpatialParameters(),this.isPlaying&&(this._streaming&&this._htmlAudioElement?(this._htmlAudioElement.playbackRate=this._playbackRate,this._htmlAudioElement.loop!==this.loop&&(this._htmlAudioElement.loop=this.loop)):this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate,this._soundSource.loop!==this.loop&&(this._soundSource.loop=this.loop),void 0!==this._offset&&this._soundSource.loopStart!==this._offset&&(this._soundSource.loopStart=this._offset),void 0!==this._length&&this._length!==this._soundSource.loopEnd&&(this._soundSource.loopEnd=(0|this._offset)+this._length))))},e.prototype._createSpatialParameters=function(){B.Engine.audioEngine.canUseWebAudio&&B.Engine.audioEngine.audioContext&&(this._scene.headphone&&(this._panningModel="HRTF"),this._soundPanner=B.Engine.audioEngine.audioContext.createPanner(),this._soundPanner&&this._outputAudioNode&&(this._updateSpatialParameters(),this._soundPanner.connect(this._outputAudioNode),this._inputAudioNode=this._soundPanner))},e.prototype._updateSpatialParameters=function(){this.spatialSound&&this._soundPanner&&(this.useCustomAttenuation?(this._soundPanner.distanceModel="linear",this._soundPanner.maxDistance=Number.MAX_VALUE,this._soundPanner.refDistance=1,this._soundPanner.rolloffFactor=1,this._soundPanner.panningModel=this._panningModel):(this._soundPanner.distanceModel=this.distanceModel,this._soundPanner.maxDistance=this.maxDistance,this._soundPanner.refDistance=this.refDistance,this._soundPanner.rolloffFactor=this.rolloffFactor,this._soundPanner.panningModel=this._panningModel))},e.prototype.switchPanningModelToHRTF=function(){this._panningModel="HRTF",this._switchPanningModel()},e.prototype.switchPanningModelToEqualPower=function(){this._panningModel="equalpower",this._switchPanningModel()},e.prototype._switchPanningModel=function(){B.Engine.audioEngine.canUseWebAudio&&this.spatialSound&&this._soundPanner&&(this._soundPanner.panningModel=this._panningModel)},e.prototype.connectToSoundTrackAudioNode=function(e){B.Engine.audioEngine.canUseWebAudio&&this._outputAudioNode&&(this._isOutputConnected&&this._outputAudioNode.disconnect(),this._outputAudioNode.connect(e),this._isOutputConnected=!0)},e.prototype.setDirectionalCone=function(e,t,i){t0&&(this._htmlAudioElement.currentTime=0)):this._streamingSource.disconnect(),this.isPlaying=!1;else if(B.Engine.audioEngine.audioContext&&this._soundSource){var i=e?B.Engine.audioEngine.audioContext.currentTime+e:B.Engine.audioEngine.audioContext.currentTime;this._soundSource.stop(i),this._soundSource.onended=function(){t.isPlaying=!1},this.isPaused||(this._startOffset=0)}},e.prototype.pause=function(){this.isPlaying&&(this.isPaused=!0,this._streaming?this._htmlAudioElement?this._htmlAudioElement.pause():this._streamingSource.disconnect():B.Engine.audioEngine.audioContext&&(this.stop(0),this._startOffset+=B.Engine.audioEngine.audioContext.currentTime-this._startTime))},e.prototype.setVolume=function(e,t){B.Engine.audioEngine.canUseWebAudio&&this._soundGain&&(t&&B.Engine.audioEngine.audioContext?(this._soundGain.gain.cancelScheduledValues(B.Engine.audioEngine.audioContext.currentTime),this._soundGain.gain.setValueAtTime(this._soundGain.gain.value,B.Engine.audioEngine.audioContext.currentTime),this._soundGain.gain.linearRampToValueAtTime(e,B.Engine.audioEngine.audioContext.currentTime+t)):this._soundGain.gain.value=e),this._volume=e},e.prototype.setPlaybackRate=function(e){this._playbackRate=e,this.isPlaying&&(this._streaming&&this._htmlAudioElement?this._htmlAudioElement.playbackRate=this._playbackRate:this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate))},e.prototype.getVolume=function(){return this._volume},e.prototype.attachToMesh=function(e){var t=this;this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null),this._connectedTransformNode=e,this.spatialSound||(this.spatialSound=!0,this._createSpatialParameters(),this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._offset,this._length))),this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode),this._registerFunc=function(e){return t._onRegisterAfterWorldMatrixUpdate(e)},this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc)},e.prototype.detachFromMesh=function(){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null,this._connectedTransformNode=null)},e.prototype._onRegisterAfterWorldMatrixUpdate=function(e){if(this._positionInEmitterSpace)e.worldMatrixFromCache.invertToRef(L.jp.Matrix[0]),this.setPosition(L.jp.Matrix[0].getTranslation());else if(e.getBoundingInfo){var t=e.getBoundingInfo();this.setPosition(t.boundingSphere.centerWorld)}else this.setPosition(e.absolutePosition);B.Engine.audioEngine.canUseWebAudio&&this._isDirectional&&this.isPlaying&&this._updateDirection()},e.prototype.clone=function(){var t=this;if(this._streaming)return null;var i=function(){t._isReadyToPlay?(r._audioBuffer=t.getAudioBuffer(),r._isReadyToPlay=!0,r.autoplay&&r.play(0,t._offset,t._length)):window.setTimeout(i,300)},n={autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this.spatialSound,maxDistance:this.maxDistance,useCustomAttenuation:this.useCustomAttenuation,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel},r=new e(this.name+"_cloned",new ArrayBuffer(0),this._scene,null,n);return this.useCustomAttenuation&&r.setAttenuationFunction(this._customAttenuationFunction),r.setPosition(this._position),r.setPlaybackRate(this._playbackRate),i(),r},e.prototype.getAudioBuffer=function(){return this._audioBuffer},e.prototype.getSoundSource=function(){return this._soundSource},e.prototype.getSoundGain=function(){return this._soundGain},e.prototype.serialize=function(){var e={name:this.name,url:this.name,autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this.spatialSound,maxDistance:this.maxDistance,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel,playbackRate:this._playbackRate,panningModel:this._panningModel,soundTrackId:this.soundTrackId,metadata:this.metadata};return this.spatialSound&&(this._connectedTransformNode&&(e.connectedMeshId=this._connectedTransformNode.id),e.position=this._position.asArray(),e.refDistance=this.refDistance,e.distanceModel=this.distanceModel,e.isDirectional=this._isDirectional,e.localDirectionToMesh=this._localDirection.asArray(),e.coneInnerAngle=this._coneInnerAngle,e.coneOuterAngle=this._coneOuterAngle,e.coneOuterGain=this._coneOuterGain),e},e.Parse=function(t,i,n,r){var o,s=t.name;o=t.url?n+t.url:n+s;var a,l={autoplay:t.autoplay,loop:t.loop,volume:t.volume,spatialSound:t.spatialSound,maxDistance:t.maxDistance,rolloffFactor:t.rolloffFactor,refDistance:t.refDistance,distanceModel:t.distanceModel,playbackRate:t.playbackRate};if(r){var h=function(){r._isReadyToPlay?(a._audioBuffer=r.getAudioBuffer(),a._isReadyToPlay=!0,a.autoplay&&a.play(0,a._offset,a._length)):window.setTimeout(h,300)};a=new e(s,new ArrayBuffer(0),i,null,l),h()}else a=new e(s,o,i,(function(){i._removePendingData(a)}),l),i._addPendingData(a);if(t.position){var c=L.P.FromArray(t.position);a.setPosition(c)}if(t.isDirectional&&(a.setDirectionalCone(t.coneInnerAngle||360,t.coneOuterAngle||360,t.coneOuterGain||0),t.localDirectionToMesh)){var u=L.P.FromArray(t.localDirectionToMesh);a.setLocalDirectionToMesh(u)}if(t.connectedMeshId){var f=i.getMeshByID(t.connectedMeshId);f&&a.attachToMesh(f)}return t.metadata&&(a.metadata=t.metadata),a},e._SceneComponentInitialization=function(e){throw Nn.f.WarnImport("AudioSceneComponent")},e}(),Bn=function(){function e(e,t,i){var n=this;if(this.loop=!1,this._coneInnerAngle=360,this._coneOuterAngle=360,this._volume=1,this.isPlaying=!1,this.isPaused=!1,this._sounds=[],this._weights=[],t.length!==i.length)throw new Error("Sounds length does not equal weights length");this.loop=e,this._weights=i;for(var r=0,o=0,s=i;o0?1/r:0,l=0;l=0;o--)if(r.push(Vi.Get(e+"/ids/"+n[o],i,n[o])),r.length===this.maxLODsToLoad)return r;return r.push(t),r},e.prototype._disposeTransformNode=function(e){var t=this,i=new Array,n=e.material;n&&i.push(n);for(var r=0,o=e.getChildMeshes();r0){var i=e.metadata=e.metadata||{};(i.gltf=i.gltf||{}).extras=t.extras}},e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,t,i){var n=this;return this._loader.loadNodeAsync(e,t,(function(e){n._assignExtras(e,t),i(e)}))},e.prototype.loadCameraAsync=function(e,t,i){var n=this;return this._loader.loadCameraAsync(e,t,(function(e){n._assignExtras(e,t),i(e)}))},e.prototype.createMaterial=function(e,t,i){var n=this._loader.createMaterial(e,t,i);return this._assignExtras(n,t),n},e}();Gi.RegisterExtension(jn,(function(e){return new Yn(e)}))},9669:(e,t,i)=>{e.exports=i(1609)},5448:(e,t,i)=>{"use strict";var n=i(4867),r=i(6026),o=i(4372),s=i(5327),a=i(4097),l=i(4109),h=i(7985),c=i(5061);e.exports=function(e){return new Promise((function(t,i){var u=e.data,f=e.headers,d=e.responseType;n.isFormData(u)&&delete f["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var _=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";f.Authorization="Basic "+btoa(_+":"+g)}var m=a(e.baseURL,e.url);function v(){if(p){var n="getAllResponseHeaders"in p?l(p.getAllResponseHeaders()):null,o={data:d&&"text"!==d&&"json"!==d?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:n,config:e,request:p};r(t,i,o),p=null}}if(p.open(e.method.toUpperCase(),s(m,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,"onloadend"in p?p.onloadend=v:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(v)},p.onabort=function(){p&&(i(c("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){i(c("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),i(c(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},n.isStandardBrowserEnv()){var y=(e.withCredentials||h(m))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;y&&(f[e.xsrfHeaderName]=y)}"setRequestHeader"in p&&n.forEach(f,(function(e,t){void 0===u&&"content-type"===t.toLowerCase()?delete f[t]:p.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),d&&"json"!==d&&(p.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),i(e),p=null)})),u||(u=null),p.send(u)}))}},1609:(e,t,i)=>{"use strict";var n=i(4867),r=i(1849),o=i(321),s=i(7185);function a(e){var t=new o(e),i=r(o.prototype.request,t);return n.extend(i,o.prototype,t),n.extend(i,t),i}var l=a(i(5655));l.Axios=o,l.create=function(e){return a(s(l.defaults,e))},l.Cancel=i(5263),l.CancelToken=i(4972),l.isCancel=i(6502),l.all=function(e){return Promise.all(e)},l.spread=i(8713),l.isAxiosError=i(6268),e.exports=l,e.exports.default=l},5263:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},4972:(e,t,i)=>{"use strict";var n=i(5263);function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var i=this;e((function(e){i.reason||(i.reason=new n(e),t(i.reason))}))}r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e;return{token:new r((function(t){e=t})),cancel:e}},e.exports=r},6502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,i)=>{"use strict";var n=i(4867),r=i(5327),o=i(782),s=i(3572),a=i(7185),l=i(4875),h=l.validators;function c(e){this.defaults=e,this.interceptors={request:new o,response:new o}}c.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&l.assertOptions(t,{silentJSONParsing:h.transitional(h.boolean,"1.0.0"),forcedJSONParsing:h.transitional(h.boolean,"1.0.0"),clarifyTimeoutError:h.transitional(h.boolean,"1.0.0")},!1);var i=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,i.unshift(t.fulfilled,t.rejected))}));var r,o=[];if(this.interceptors.response.forEach((function(e){o.push(e.fulfilled,e.rejected)})),!n){var c=[s,void 0];for(Array.prototype.unshift.apply(c,i),c.concat(o),r=Promise.resolve(e);c.length;)r=r.then(c.shift(),c.shift());return r}for(var u=e;i.length;){var f=i.shift(),d=i.shift();try{u=f(u)}catch(e){d(e);break}}try{r=s(u)}catch(e){return Promise.reject(e)}for(;o.length;)r=r.then(o.shift(),o.shift());return r},c.prototype.getUri=function(e){return e=a(this.defaults,e),r(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,i){return this.request(a(i||{},{method:e,url:t,data:(i||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){c.prototype[e]=function(t,i,n){return this.request(a(n||{},{method:e,url:t,data:i}))}})),e.exports=c},782:(e,t,i)=>{"use strict";var n=i(4867);function r(){this.handlers=[]}r.prototype.use=function(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=r},4097:(e,t,i)=>{"use strict";var n=i(1793),r=i(7303);e.exports=function(e,t){return e&&!n(t)?r(e,t):t}},5061:(e,t,i)=>{"use strict";var n=i(481);e.exports=function(e,t,i,r,o){var s=new Error(e);return n(s,t,i,r,o)}},3572:(e,t,i)=>{"use strict";var n=i(4867),r=i(8527),o=i(6502),s=i(5655);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=r.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return a(e),t.data=r.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(a(e),t&&t.response&&(t.response.data=r.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:e=>{"use strict";e.exports=function(e,t,i,n,r){return e.config=t,i&&(e.code=i),e.request=n,e.response=r,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},7185:(e,t,i)=>{"use strict";var n=i(4867);e.exports=function(e,t){t=t||{};var i={},r=["url","method","data"],o=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function l(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function h(r){n.isUndefined(t[r])?n.isUndefined(e[r])||(i[r]=l(void 0,e[r])):i[r]=l(e[r],t[r])}n.forEach(r,(function(e){n.isUndefined(t[e])||(i[e]=l(void 0,t[e]))})),n.forEach(o,h),n.forEach(s,(function(r){n.isUndefined(t[r])?n.isUndefined(e[r])||(i[r]=l(void 0,e[r])):i[r]=l(void 0,t[r])})),n.forEach(a,(function(n){n in t?i[n]=l(e[n],t[n]):n in e&&(i[n]=l(void 0,e[n]))}));var c=r.concat(o).concat(s).concat(a),u=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===c.indexOf(e)}));return n.forEach(u,h),i}},6026:(e,t,i)=>{"use strict";var n=i(5061);e.exports=function(e,t,i){var r=i.config.validateStatus;i.status&&r&&!r(i.status)?t(n("Request failed with status code "+i.status,i.config,null,i.request,i)):e(i)}},8527:(e,t,i)=>{"use strict";var n=i(4867),r=i(5655);e.exports=function(e,t,i){var o=this||r;return n.forEach(i,(function(i){e=i.call(o,e,t)})),e}},5655:(e,t,i)=>{"use strict";var n=i(4867),r=i(6016),o=i(481),s={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var l,h={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(l=i(5448)),l),transformRequest:[function(e,t){return r(t,"Accept"),r(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),JSON.stringify(e)):e}],transformResponse:[function(e){var t=this.transitional,i=t&&t.silentJSONParsing,r=t&&t.forcedJSONParsing,s=!i&&"json"===this.responseType;if(s||r&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};h.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],(function(e){h.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){h.headers[e]=n.merge(s)})),e.exports=h},1849:e=>{"use strict";e.exports=function(e,t){return function(){for(var i=new Array(arguments.length),n=0;n{"use strict";var n=i(4867);function r(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,i){if(!t)return e;var o;if(i)o=i(t);else if(n.isURLSearchParams(t))o=t.toString();else{var s=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),s.push(r(t)+"="+r(e))})))})),o=s.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},7303:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},4372:(e,t,i)=>{"use strict";var n=i(4867);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,i,r,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(i)&&a.push("expires="+new Date(i).toGMTString()),n.isString(r)&&a.push("path="+r),n.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},1793:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},6268:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},7985:(e,t,i)=>{"use strict";var n=i(4867);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");function r(e){var n=e;return t&&(i.setAttribute("href",n),n=i.href),i.setAttribute("href",n),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}return e=r(window.location.href),function(t){var i=n.isString(t)?r(t):t;return i.protocol===e.protocol&&i.host===e.host}}():function(){return!0}},6016:(e,t,i)=>{"use strict";var n=i(4867);e.exports=function(e,t){n.forEach(e,(function(i,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=i,delete e[n])}))}},4109:(e,t,i)=>{"use strict";var n=i(4867),r=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,i,o,s={};return e?(n.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),i=n.trim(e.substr(o+1)),t){if(s[t]&&r.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([i]):s[t]?s[t]+", "+i:i}})),s):s}},8713:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},4875:(e,t,i)=>{"use strict";var n=i(696),r={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){r[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));var o={},s=n.version.split(".");function a(e,t){for(var i=t?t.split("."):s,n=e.split("."),r=0;r<3;r++){if(i[r]>n[r])return!0;if(i[r]0;){var o=n[r],s=t[o];if(s){var a=e[o],l=void 0===a||s(a,o,e);if(!0!==l)throw new TypeError("option "+o+" must be "+l)}else if(!0!==i)throw Error("Unknown option "+o)}},validators:r}},4867:(e,t,i)=>{"use strict";var n=i(1849),r=Object.prototype.toString;function o(e){return"[object Array]"===r.call(e)}function s(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function l(e){if("[object Object]"!==r.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function h(e){return"[object Function]"===r.call(e)}function c(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),o(e))for(var i=0,n=e.length;i{"use strict";e.exports=JSON.parse('{"_args":[["axios@0.21.2","C:\\\\Users\\\\nilst\\\\Documents\\\\repos\\\\babyplots_lib"]],"_from":"axios@0.21.2","_id":"axios@0.21.2","_inBundle":false,"_integrity":"sha512-87otirqUw3e8CzHTMO+/9kh/FSgXt/eVDvipijwDtEuwbkySWZ9SBm6VEubmJ/kLKEoLQV/POhxXFb66bfekfg==","_location":"/axios","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"axios@0.21.2","name":"axios","escapedName":"axios","rawSpec":"0.21.2","saveSpec":null,"fetchSpec":"0.21.2"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/axios/-/axios-0.21.2.tgz","_spec":"0.21.2","_where":"C:\\\\Users\\\\nilst\\\\Documents\\\\repos\\\\babyplots_lib","author":{"name":"Matt Zabriskie"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"bugs":{"url":"https://github.com/axios/axios/issues"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}],"dependencies":{"follow-redirects":"^1.14.0"},"description":"Promise based HTTP client for the browser and node.js","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"homepage":"https://axios-http.com","jsdelivr":"dist/axios.min.js","keywords":["xhr","http","ajax","promise","node"],"license":"MIT","main":"index.js","name":"axios","repository":{"type":"git","url":"git+https://github.com/axios/axios.git"},"scripts":{"build":"NODE_ENV=production grunt build","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","examples":"node ./examples/server.js","fix":"eslint --fix lib/**/*.js","postversion":"git push && git push --tags","preversion":"npm test","start":"node ./sandbox/server.js","test":"grunt test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"},"typings":"./index.d.ts","unpkg":"dist/axios.min.js","version":"0.21.2"}')},5792:function(e){e.exports=function(){"use strict";for(var e=function(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=1),ei?i:e},t=function(t){t._clipped=!1,t._unclipped=t.slice(0);for(var i=0;i<=3;i++)i<3?((t[i]<0||t[i]>255)&&(t._clipped=!0),t[i]=e(t[i],0,255)):3===i&&(t[i]=e(t[i],0,1));return t},i={},n=0,r=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];n=3?Array.prototype.slice.call(e):"object"==s(e[0])&&t?t.split("").filter((function(t){return void 0!==e[0][t]})).map((function(t){return e[0][t]})):e[0]},l=function(e){if(e.length<2)return null;var t=e.length-1;return"string"==s(e[t])?e[t].toLowerCase():null},h=Math.PI,c={clip_rgb:t,limit:e,type:s,unpack:a,last:l,PI:h,TWOPI:2*h,PITHIRD:h/3,DEG2RAD:h/180,RAD2DEG:180/h},u={format:{},autodetect:[]},f=c.last,d=c.clip_rgb,p=c.type,_=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=this;if("object"===p(e[0])&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];var n=f(e),r=!1;if(!n){r=!0,u.sorted||(u.autodetect=u.autodetect.sort((function(e,t){return t.p-e.p})),u.sorted=!0);for(var o=0,s=u.autodetect;o4?e[4]:1;return 1===o?[0,0,0,s]:[i>=1?0:255*(1-i)*(1-o),n>=1?0:255*(1-n)*(1-o),r>=1?0:255*(1-r)*(1-o),s]},C=c.unpack,x=c.type;g.prototype.cmyk=function(){return T(this._rgb)},v.cmyk=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["cmyk"])))},u.format.cmyk=E,u.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=C(e,"cmyk"),"array"===x(e)&&4===e.length)return"cmyk"}});var S=c.unpack,R=c.last,M=function(e){return Math.round(100*e)/100},P=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=S(e,"hsla"),n=R(e)||"lsa";return i[0]=M(i[0]||0),i[1]=M(100*i[1])+"%",i[2]=M(100*i[2])+"%","hsla"===n||i.length>3&&i[3]<1?(i[3]=i.length>3?i[3]:1,n="hsla"):i.length=3,n+"("+i.join(",")+")"},I=c.unpack,O=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=(e=I(e,"rgba"))[0],n=e[1],r=e[2];i/=255,n/=255,r/=255;var o,s,a=Math.min(i,n,r),l=Math.max(i,n,r),h=(l+a)/2;return l===a?(o=0,s=Number.NaN):o=h<.5?(l-a)/(l+a):(l-a)/(2-l-a),i==l?s=(n-r)/(l-a):n==l?s=2+(r-i)/(l-a):r==l&&(s=4+(i-n)/(l-a)),(s*=60)<0&&(s+=360),e.length>3&&void 0!==e[3]?[s,o,h,e[3]]:[s,o,h]},D=c.unpack,L=c.last,w=Math.round,N=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=D(e,"rgba"),n=L(e)||"rgb";return"hsl"==n.substr(0,3)?P(O(i),n):(i[0]=w(i[0]),i[1]=w(i[1]),i[2]=w(i[2]),("rgba"===n||i.length>3&&i[3]<1)&&(i[3]=i.length>3?i[3]:1,n="rgba"),n+"("+i.slice(0,"rgb"===n?3:4).join(",")+")")},F=c.unpack,B=Math.round,U=function(){for(var e,t=[],i=arguments.length;i--;)t[i]=arguments[i];var n,r,o,s=(t=F(t,"hsl"))[0],a=t[1],l=t[2];if(0===a)n=r=o=255*l;else{var h=[0,0,0],c=[0,0,0],u=l<.5?l*(1+a):l+a-l*a,f=2*l-u,d=s/360;h[0]=d+1/3,h[1]=d,h[2]=d-1/3;for(var p=0;p<3;p++)h[p]<0&&(h[p]+=1),h[p]>1&&(h[p]-=1),6*h[p]<1?c[p]=f+6*(u-f)*h[p]:2*h[p]<1?c[p]=u:3*h[p]<2?c[p]=f+(u-f)*(2/3-h[p])*6:c[p]=f;n=(e=[B(255*c[0]),B(255*c[1]),B(255*c[2])])[0],r=e[1],o=e[2]}return t.length>3?[n,r,o,t[3]]:[n,r,o,1]},k=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,V=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,G=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,H=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,z=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,W=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,X=Math.round,j=function(e){var t;if(e=e.toLowerCase().trim(),u.format.named)try{return u.format.named(e)}catch(e){}if(t=e.match(k)){for(var i=t.slice(1,4),n=0;n<3;n++)i[n]=+i[n];return i[3]=1,i}if(t=e.match(V)){for(var r=t.slice(1,5),o=0;o<4;o++)r[o]=+r[o];return r}if(t=e.match(G)){for(var s=t.slice(1,4),a=0;a<3;a++)s[a]=X(2.55*s[a]);return s[3]=1,s}if(t=e.match(H)){for(var l=t.slice(1,5),h=0;h<3;h++)l[h]=X(2.55*l[h]);return l[3]=+l[3],l}if(t=e.match(z)){var c=t.slice(1,4);c[1]*=.01,c[2]*=.01;var f=U(c);return f[3]=1,f}if(t=e.match(W)){var d=t.slice(1,4);d[1]*=.01,d[2]*=.01;var p=U(d);return p[3]=+t[4],p}};j.test=function(e){return k.test(e)||V.test(e)||G.test(e)||H.test(e)||z.test(e)||W.test(e)};var Y=j,K=c.type;g.prototype.css=function(e){return N(this._rgb,e)},v.css=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["css"])))},u.format.css=Y,u.autodetect.push({p:5,test:function(e){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];if(!t.length&&"string"===K(e)&&Y.test(e))return"css"}});var q=c.unpack;u.format.gl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=q(e,"rgba");return i[0]*=255,i[1]*=255,i[2]*=255,i},v.gl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["gl"])))},g.prototype.gl=function(){var e=this._rgb;return[e[0]/255,e[1]/255,e[2]/255,e[3]]};var Z=c.unpack,Q=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i,n=Z(e,"rgb"),r=n[0],o=n[1],s=n[2],a=Math.min(r,o,s),l=Math.max(r,o,s),h=l-a,c=100*h/255,u=a/(255-h)*100;return 0===h?i=Number.NaN:(r===l&&(i=(o-s)/h),o===l&&(i=2+(s-r)/h),s===l&&(i=4+(r-o)/h),(i*=60)<0&&(i+=360)),[i,c,u]},J=c.unpack,$=Math.floor,ee=function(){for(var e,t,i,n,r,o,s=[],a=arguments.length;a--;)s[a]=arguments[a];var l,h,c,u=(s=J(s,"hcg"))[0],f=s[1],d=s[2];d*=255;var p=255*f;if(0===f)l=h=c=d;else{360===u&&(u=0),u>360&&(u-=360),u<0&&(u+=360);var _=$(u/=60),g=u-_,m=d*(1-f),v=m+p*(1-g),y=m+p*g,b=m+p;switch(_){case 0:l=(e=[b,y,m])[0],h=e[1],c=e[2];break;case 1:l=(t=[v,b,m])[0],h=t[1],c=t[2];break;case 2:l=(i=[m,b,y])[0],h=i[1],c=i[2];break;case 3:l=(n=[m,v,b])[0],h=n[1],c=n[2];break;case 4:l=(r=[y,m,b])[0],h=r[1],c=r[2];break;case 5:l=(o=[b,m,v])[0],h=o[1],c=o[2]}}return[l,h,c,s.length>3?s[3]:1]},te=c.unpack,ie=c.type;g.prototype.hcg=function(){return Q(this._rgb)},v.hcg=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["hcg"])))},u.format.hcg=ee,u.autodetect.push({p:1,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=te(e,"hcg"),"array"===ie(e)&&3===e.length)return"hcg"}});var ne=c.unpack,re=c.last,oe=Math.round,se=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=ne(e,"rgba"),n=i[0],r=i[1],o=i[2],s=i[3],a=re(e)||"auto";void 0===s&&(s=1),"auto"===a&&(a=s<1?"rgba":"rgb");var l="000000"+((n=oe(n))<<16|(r=oe(r))<<8|(o=oe(o))).toString(16);l=l.substr(l.length-6);var h="0"+oe(255*s).toString(16);switch(h=h.substr(h.length-2),a.toLowerCase()){case"rgba":return"#"+l+h;case"argb":return"#"+h+l;default:return"#"+l}},ae=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,le=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,he=function(e){if(e.match(ae)){4!==e.length&&7!==e.length||(e=e.substr(1)),3===e.length&&(e=(e=e.split(""))[0]+e[0]+e[1]+e[1]+e[2]+e[2]);var t=parseInt(e,16);return[t>>16,t>>8&255,255&t,1]}if(e.match(le)){5!==e.length&&9!==e.length||(e=e.substr(1)),4===e.length&&(e=(e=e.split(""))[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);var i=parseInt(e,16);return[i>>24&255,i>>16&255,i>>8&255,Math.round((255&i)/255*100)/100]}throw new Error("unknown hex color: "+e)},ce=c.type;g.prototype.hex=function(e){return se(this._rgb,e)},v.hex=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["hex"])))},u.format.hex=he,u.autodetect.push({p:4,test:function(e){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];if(!t.length&&"string"===ce(e)&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return"hex"}});var ue=c.unpack,fe=c.TWOPI,de=Math.min,pe=Math.sqrt,_e=Math.acos,ge=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i,n=ue(e,"rgb"),r=n[0],o=n[1],s=n[2],a=de(r/=255,o/=255,s/=255),l=(r+o+s)/3,h=l>0?1-a/l:0;return 0===h?i=NaN:(i=(r-o+(r-s))/2,i/=pe((r-o)*(r-o)+(r-s)*(o-s)),i=_e(i),s>o&&(i=fe-i),i/=fe),[360*i,h,l]},me=c.unpack,ve=c.limit,ye=c.TWOPI,be=c.PITHIRD,Te=Math.cos,Ae=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i,n,r,o=(e=me(e,"hsi"))[0],s=e[1],a=e[2];return isNaN(o)&&(o=0),isNaN(s)&&(s=0),o>360&&(o-=360),o<0&&(o+=360),(o/=360)<1/3?n=1-((r=(1-s)/3)+(i=(1+s*Te(ye*o)/Te(be-ye*o))/3)):o<2/3?r=1-((i=(1-s)/3)+(n=(1+s*Te(ye*(o-=1/3))/Te(be-ye*o))/3)):i=1-((n=(1-s)/3)+(r=(1+s*Te(ye*(o-=2/3))/Te(be-ye*o))/3)),[255*(i=ve(a*i*3)),255*(n=ve(a*n*3)),255*(r=ve(a*r*3)),e.length>3?e[3]:1]},Ee=c.unpack,Ce=c.type;g.prototype.hsi=function(){return ge(this._rgb)},v.hsi=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["hsi"])))},u.format.hsi=Ae,u.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Ee(e,"hsi"),"array"===Ce(e)&&3===e.length)return"hsi"}});var xe=c.unpack,Se=c.type;g.prototype.hsl=function(){return O(this._rgb)},v.hsl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["hsl"])))},u.format.hsl=U,u.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=xe(e,"hsl"),"array"===Se(e)&&3===e.length)return"hsl"}});var Re=c.unpack,Me=Math.min,Pe=Math.max,Ie=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i,n,r,o=(e=Re(e,"rgb"))[0],s=e[1],a=e[2],l=Me(o,s,a),h=Pe(o,s,a),c=h-l;return r=h/255,0===h?(i=Number.NaN,n=0):(n=c/h,o===h&&(i=(s-a)/c),s===h&&(i=2+(a-o)/c),a===h&&(i=4+(o-s)/c),(i*=60)<0&&(i+=360)),[i,n,r]},Oe=c.unpack,De=Math.floor,Le=function(){for(var e,t,i,n,r,o,s=[],a=arguments.length;a--;)s[a]=arguments[a];var l,h,c,u=(s=Oe(s,"hsv"))[0],f=s[1],d=s[2];if(d*=255,0===f)l=h=c=d;else{360===u&&(u=0),u>360&&(u-=360),u<0&&(u+=360);var p=De(u/=60),_=u-p,g=d*(1-f),m=d*(1-f*_),v=d*(1-f*(1-_));switch(p){case 0:l=(e=[d,v,g])[0],h=e[1],c=e[2];break;case 1:l=(t=[m,d,g])[0],h=t[1],c=t[2];break;case 2:l=(i=[g,d,v])[0],h=i[1],c=i[2];break;case 3:l=(n=[g,m,d])[0],h=n[1],c=n[2];break;case 4:l=(r=[v,g,d])[0],h=r[1],c=r[2];break;case 5:l=(o=[d,g,m])[0],h=o[1],c=o[2]}}return[l,h,c,s.length>3?s[3]:1]},we=c.unpack,Ne=c.type;g.prototype.hsv=function(){return Ie(this._rgb)},v.hsv=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["hsv"])))},u.format.hsv=Le,u.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=we(e,"hsv"),"array"===Ne(e)&&3===e.length)return"hsv"}});var Fe={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},Be=c.unpack,Ue=Math.pow,ke=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=Be(e,"rgb"),n=i[0],r=i[1],o=i[2],s=He(n,r,o),a=s[0],l=s[1],h=116*l-16;return[h<0?0:h,500*(a-l),200*(l-s[2])]},Ve=function(e){return(e/=255)<=.04045?e/12.92:Ue((e+.055)/1.055,2.4)},Ge=function(e){return e>Fe.t3?Ue(e,1/3):e/Fe.t2+Fe.t0},He=function(e,t,i){return e=Ve(e),t=Ve(t),i=Ve(i),[Ge((.4124564*e+.3575761*t+.1804375*i)/Fe.Xn),Ge((.2126729*e+.7151522*t+.072175*i)/Fe.Yn),Ge((.0193339*e+.119192*t+.9503041*i)/Fe.Zn)]},ze=ke,We=c.unpack,Xe=Math.pow,je=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i,n,r,o=(e=We(e,"lab"))[0],s=e[1],a=e[2];return n=(o+16)/116,i=isNaN(s)?n:n+s/500,r=isNaN(a)?n:n-a/200,n=Fe.Yn*Ke(n),i=Fe.Xn*Ke(i),r=Fe.Zn*Ke(r),[Ye(3.2404542*i-1.5371385*n-.4985314*r),Ye(-.969266*i+1.8760108*n+.041556*r),Ye(.0556434*i-.2040259*n+1.0572252*r),e.length>3?e[3]:1]},Ye=function(e){return 255*(e<=.00304?12.92*e:1.055*Xe(e,1/2.4)-.055)},Ke=function(e){return e>Fe.t1?e*e*e:Fe.t2*(e-Fe.t0)},qe=je,Ze=c.unpack,Qe=c.type;g.prototype.lab=function(){return ze(this._rgb)},v.lab=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["lab"])))},u.format.lab=qe,u.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Ze(e,"lab"),"array"===Qe(e)&&3===e.length)return"lab"}});var Je=c.unpack,$e=c.RAD2DEG,et=Math.sqrt,tt=Math.atan2,it=Math.round,nt=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=Je(e,"lab"),n=i[0],r=i[1],o=i[2],s=et(r*r+o*o),a=(tt(o,r)*$e+360)%360;return 0===it(1e4*s)&&(a=Number.NaN),[n,s,a]},rt=c.unpack,ot=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=rt(e,"rgb"),n=i[0],r=i[1],o=i[2],s=ze(n,r,o),a=s[0],l=s[1],h=s[2];return nt(a,l,h)},st=c.unpack,at=c.DEG2RAD,lt=Math.sin,ht=Math.cos,ct=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=st(e,"lch"),n=i[0],r=i[1],o=i[2];return isNaN(o)&&(o=0),[n,ht(o*=at)*r,lt(o)*r]},ut=c.unpack,ft=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=(e=ut(e,"lch"))[0],n=e[1],r=e[2],o=ct(i,n,r),s=o[0],a=o[1],l=o[2],h=qe(s,a,l);return[h[0],h[1],h[2],e.length>3?e[3]:1]},dt=c.unpack,pt=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=dt(e,"hcl").reverse();return ft.apply(void 0,i)},_t=c.unpack,gt=c.type;g.prototype.lch=function(){return ot(this._rgb)},g.prototype.hcl=function(){return ot(this._rgb).reverse()},v.lch=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["lch"])))},v.hcl=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["hcl"])))},u.format.lch=ft,u.format.hcl=pt,["lch","hcl"].forEach((function(e){return u.autodetect.push({p:2,test:function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];if(t=_t(t,e),"array"===gt(t)&&3===t.length)return e}})}));var mt={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},vt=c.type;g.prototype.name=function(){for(var e=se(this._rgb,"rgb"),t=0,i=Object.keys(mt);t0;)t[i]=arguments[i+1];if(!t.length&&"string"===vt(e)&&mt[e.toLowerCase()])return"named"}});var yt=c.unpack,bt=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=yt(e,"rgb");return(i[0]<<16)+(i[1]<<8)+i[2]},Tt=c.type,At=function(e){if("number"==Tt(e)&&e>=0&&e<=16777215)return[e>>16,e>>8&255,255&e,1];throw new Error("unknown num color: "+e)},Et=c.type;g.prototype.num=function(){return bt(this._rgb)},v.num=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["num"])))},u.format.num=At,u.autodetect.push({p:5,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(1===e.length&&"number"===Et(e[0])&&e[0]>=0&&e[0]<=16777215)return"num"}});var Ct=c.unpack,xt=c.type,St=Math.round;g.prototype.rgb=function(e){return void 0===e&&(e=!0),!1===e?this._rgb.slice(0,3):this._rgb.slice(0,3).map(St)},g.prototype.rgba=function(e){return void 0===e&&(e=!0),this._rgb.slice(0,4).map((function(t,i){return i<3?!1===e?t:St(t):t}))},v.rgb=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["rgb"])))},u.format.rgb=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var i=Ct(e,"rgba");return void 0===i[3]&&(i[3]=1),i},u.autodetect.push({p:3,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Ct(e,"rgba"),"array"===xt(e)&&(3===e.length||4===e.length&&"number"==xt(e[3])&&e[3]>=0&&e[3]<=1))return"rgb"}});var Rt=Math.log,Mt=function(e){var t,i,n,r=e/100;return r<66?(t=255,i=-155.25485562709179-.44596950469579133*(i=r-2)+104.49216199393888*Rt(i),n=r<20?0:.8274096064007395*(n=r-10)-254.76935184120902+115.67994401066147*Rt(n)):(t=351.97690566805693+.114206453784165*(t=r-55)-40.25366309332127*Rt(t),i=325.4494125711974+.07943456536662342*(i=r-50)-28.0852963507957*Rt(i),n=255),[t,i,n,1]},Pt=c.unpack,It=Math.round,Ot=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var i,n=Pt(e,"rgb"),r=n[0],o=n[2],s=1e3,a=4e4,l=.4;a-s>l;){var h=Mt(i=.5*(a+s));h[2]/h[0]>=o/r?a=i:s=i}return It(i)};g.prototype.temp=g.prototype.kelvin=g.prototype.temperature=function(){return Ot(this._rgb)},v.temp=v.kelvin=v.temperature=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new(Function.prototype.bind.apply(g,[null].concat(e,["temp"])))},u.format.temp=u.format.kelvin=u.format.temperature=Mt;var Dt=c.type;g.prototype.alpha=function(e,t){return void 0===t&&(t=!1),void 0!==e&&"number"===Dt(e)?t?(this._rgb[3]=e,this):new g([this._rgb[0],this._rgb[1],this._rgb[2],e],"rgb"):this._rgb[3]},g.prototype.clipped=function(){return this._rgb._clipped||!1},g.prototype.darken=function(e){void 0===e&&(e=1);var t=this,i=t.lab();return i[0]-=Fe.Kn*e,new g(i,"lab").alpha(t.alpha(),!0)},g.prototype.brighten=function(e){return void 0===e&&(e=1),this.darken(-e)},g.prototype.darker=g.prototype.darken,g.prototype.brighter=g.prototype.brighten,g.prototype.get=function(e){var t=e.split("."),i=t[0],n=t[1],r=this[i]();if(n){var o=i.indexOf(n);if(o>-1)return r[o];throw new Error("unknown channel "+n+" in mode "+i)}return r};var Lt=c.type,wt=Math.pow,Nt=1e-7,Ft=20;g.prototype.luminance=function(e){if(void 0!==e&&"number"===Lt(e)){if(0===e)return new g([0,0,0,this._rgb[3]],"rgb");if(1===e)return new g([255,255,255,this._rgb[3]],"rgb");var t=this.luminance(),i="rgb",n=Ft,r=function(t,o){var s=t.interpolate(o,.5,i),a=s.luminance();return Math.abs(e-a)e?r(t,s):r(s,o)},o=(t>e?r(new g([0,0,0]),this):r(this,new g([255,255,255]))).rgb();return new g(o.concat([this._rgb[3]]))}return Bt.apply(void 0,this._rgb.slice(0,3))};var Bt=function(e,t,i){return.2126*(e=Ut(e))+.7152*(t=Ut(t))+.0722*(i=Ut(i))},Ut=function(e){return(e/=255)<=.03928?e/12.92:wt((e+.055)/1.055,2.4)},kt={},Vt=c.type,Gt=function(e,t,i){void 0===i&&(i=.5);for(var n=[],r=arguments.length-3;r-- >0;)n[r]=arguments[r+3];var o=n[0]||"lrgb";if(kt[o]||n.length||(o=Object.keys(kt)[0]),!kt[o])throw new Error("interpolation mode "+o+" is not defined");return"object"!==Vt(e)&&(e=new g(e)),"object"!==Vt(t)&&(t=new g(t)),kt[o](e,t,i).alpha(e.alpha()+i*(t.alpha()-e.alpha()))};g.prototype.mix=g.prototype.interpolate=function(e,t){void 0===t&&(t=.5);for(var i=[],n=arguments.length-2;n-- >0;)i[n]=arguments[n+2];return Gt.apply(void 0,[this,e,t].concat(i))},g.prototype.premultiply=function(e){void 0===e&&(e=!1);var t=this._rgb,i=t[3];return e?(this._rgb=[t[0]*i,t[1]*i,t[2]*i,i],this):new g([t[0]*i,t[1]*i,t[2]*i,i],"rgb")},g.prototype.saturate=function(e){void 0===e&&(e=1);var t=this,i=t.lch();return i[1]+=Fe.Kn*e,i[1]<0&&(i[1]=0),new g(i,"lch").alpha(t.alpha(),!0)},g.prototype.desaturate=function(e){return void 0===e&&(e=1),this.saturate(-e)};var Ht=c.type;g.prototype.set=function(e,t,i){void 0===i&&(i=!1);var n=e.split("."),r=n[0],o=n[1],s=this[r]();if(o){var a=r.indexOf(o);if(a>-1){if("string"==Ht(t))switch(t.charAt(0)){case"+":case"-":s[a]+=+t;break;case"*":s[a]*=+t.substr(1);break;case"/":s[a]/=+t.substr(1);break;default:s[a]=+t}else{if("number"!==Ht(t))throw new Error("unsupported value for Color.set");s[a]=t}var l=new g(s,r);return i?(this._rgb=l._rgb,this):l}throw new Error("unknown channel "+o+" in mode "+r)}return s};var zt=function(e,t,i){var n=e._rgb,r=t._rgb;return new g(n[0]+i*(r[0]-n[0]),n[1]+i*(r[1]-n[1]),n[2]+i*(r[2]-n[2]),"rgb")};kt.rgb=zt;var Wt=Math.sqrt,Xt=Math.pow,jt=function(e,t,i){var n=e._rgb,r=n[0],o=n[1],s=n[2],a=t._rgb,l=a[0],h=a[1],c=a[2];return new g(Wt(Xt(r,2)*(1-i)+Xt(l,2)*i),Wt(Xt(o,2)*(1-i)+Xt(h,2)*i),Wt(Xt(s,2)*(1-i)+Xt(c,2)*i),"rgb")};kt.lrgb=jt;var Yt=function(e,t,i){var n=e.lab(),r=t.lab();return new g(n[0]+i*(r[0]-n[0]),n[1]+i*(r[1]-n[1]),n[2]+i*(r[2]-n[2]),"lab")};kt.lab=Yt;var Kt=function(e,t,i,n){var r,o,s,a,l,h,c,u,f,d,p,_;return"hsl"===n?(s=e.hsl(),a=t.hsl()):"hsv"===n?(s=e.hsv(),a=t.hsv()):"hcg"===n?(s=e.hcg(),a=t.hcg()):"hsi"===n?(s=e.hsi(),a=t.hsi()):"lch"!==n&&"hcl"!==n||(n="hcl",s=e.hcl(),a=t.hcl()),"h"===n.substr(0,1)&&(l=(r=s)[0],c=r[1],f=r[2],h=(o=a)[0],u=o[1],d=o[2]),isNaN(l)||isNaN(h)?isNaN(l)?isNaN(h)?_=Number.NaN:(_=h,1!=f&&0!=f||"hsv"==n||(p=u)):(_=l,1!=d&&0!=d||"hsv"==n||(p=c)):_=l+i*(h>l&&h-l>180?h-(l+360):h180?h+360-l:h-l),void 0===p&&(p=c+i*(u-c)),new g([_,p,f+i*(d-f)],n)},qt=function(e,t,i){return Kt(e,t,i,"lch")};kt.lch=qt,kt.hcl=qt;var Zt=function(e,t,i){var n=e.num(),r=t.num();return new g(n+i*(r-n),"num")};kt.num=Zt;var Qt=function(e,t,i){return Kt(e,t,i,"hcg")};kt.hcg=Qt;var Jt=function(e,t,i){return Kt(e,t,i,"hsi")};kt.hsi=Jt;var $t=function(e,t,i){return Kt(e,t,i,"hsl")};kt.hsl=$t;var ei=function(e,t,i){return Kt(e,t,i,"hsv")};kt.hsv=ei;var ti=c.clip_rgb,ii=Math.pow,ni=Math.sqrt,ri=Math.PI,oi=Math.cos,si=Math.sin,ai=Math.atan2,li=function(e,t,i){void 0===t&&(t="lrgb"),void 0===i&&(i=null);var n=e.length;i||(i=Array.from(new Array(n)).map((function(){return 1})));var r=n/i.reduce((function(e,t){return e+t}));if(i.forEach((function(e,t){i[t]*=r})),e=e.map((function(e){return new g(e)})),"lrgb"===t)return hi(e,i);for(var o=e.shift(),s=o.get(t),a=[],l=0,h=0,c=0;c=360;)p-=360;s[d]=p}else s[d]=s[d]/a[d];return f/=n,new g(s,t).alpha(f>.99999?1:f,!0)},hi=function(e,t){for(var i=e.length,n=[0,0,0,0],r=0;r.9999999&&(n[3]=1),new g(ti(n))},ci=c.type,ui=Math.pow,fi=function(e){var t="rgb",i=v("#ccc"),n=0,r=[0,1],o=[],s=[0,0],a=!1,l=[],h=!1,c=0,u=1,f=!1,d={},p=!0,_=1,g=function(e){if((e=e||["#fff","#000"])&&"string"===ci(e)&&v.brewer&&v.brewer[e.toLowerCase()]&&(e=v.brewer[e.toLowerCase()]),"array"===ci(e)){1===e.length&&(e=[e[0],e[0]]),e=e.slice(0);for(var t=0;t=a[i];)i++;return i-1}return 0},y=function(e){return e},b=function(e){return e},T=function(e,n){var r,h;if(null==n&&(n=!1),isNaN(e)||null===e)return i;h=n?e:a&&a.length>2?m(e)/(a.length-2):u!==c?(e-c)/(u-c):1,h=b(h),n||(h=y(h)),1!==_&&(h=ui(h,_)),h=s[0]+h*(1-s[0]-s[1]),h=Math.min(1,Math.max(0,h));var f=Math.floor(1e4*h);if(p&&d[f])r=d[f];else{if("array"===ci(l))for(var g=0;g=T&&g===o.length-1){r=l[g];break}if(h>T&&h2){var h=e.map((function(t,i){return i/(e.length-1)})),f=e.map((function(e){return(e-c)/(u-c)}));f.every((function(e,t){return h[t]===e}))||(b=function(e){if(e<=0||e>=1)return e;for(var t=0;e>=f[t+1];)t++;var i=(e-f[t])/(f[t+1]-f[t]);return h[t]+i*(h[t+1]-h[t])})}}return r=[c,u],E},E.mode=function(e){return arguments.length?(t=e,A(),E):t},E.range=function(e,t){return g(e,t),E},E.out=function(e){return h=e,E},E.spread=function(e){return arguments.length?(n=e,E):n},E.correctLightness=function(e){return null==e&&(e=!0),f=e,A(),y=f?function(e){for(var t=T(0,!0).lab()[0],i=T(1,!0).lab()[0],n=t>i,r=T(e,!0).lab()[0],o=t+(i-t)*e,s=r-o,a=0,l=1,h=20;Math.abs(s)>.01&&h-- >0;)n&&(s*=-1),s<0?(a=e,e+=.5*(l-e)):(l=e,e+=.5*(a-e)),r=T(e,!0).lab()[0],s=r-o;return e}:function(e){return e},E},E.padding=function(e){return null!=e?("number"===ci(e)&&(e=[e,e]),s=e,E):s},E.colors=function(t,i){arguments.length<2&&(i="hex");var n=[];if(0===arguments.length)n=l.slice(0);else if(1===t)n=[E(.5)];else if(t>1){var o=r[0],s=r[1]-o;n=di(0,t,!1).map((function(e){return E(o+e/(t-1)*s)}))}else{e=[];var h=[];if(a&&a.length>2)for(var c=1,u=a.length,f=1<=u;f?cu;f?c++:c--)h.push(.5*(a[c-1]+a[c]));else h=r;n=h.map((function(e){return E(e)}))}return v[i]&&(n=n.map((function(e){return e[i]()}))),n},E.cache=function(e){return null!=e?(p=e,E):p},E.gamma=function(e){return null!=e?(_=e,E):_},E.nodata=function(e){return null!=e?(i=v(e),E):i},E};function di(e,t,i){for(var n=[],r=eo;r?s++:s--)n.push(s);return n}var pi=function(e){var t,i,n,r,o,s,a;if(2===(e=e.map((function(e){return new g(e)}))).length)t=e.map((function(e){return e.lab()})),o=t[0],s=t[1],r=function(e){var t=[0,1,2].map((function(t){return o[t]+e*(s[t]-o[t])}));return new g(t,"lab")};else if(3===e.length)i=e.map((function(e){return e.lab()})),o=i[0],s=i[1],a=i[2],r=function(e){var t=[0,1,2].map((function(t){return(1-e)*(1-e)*o[t]+2*(1-e)*e*s[t]+e*e*a[t]}));return new g(t,"lab")};else if(4===e.length){var l;n=e.map((function(e){return e.lab()})),o=n[0],s=n[1],a=n[2],l=n[3],r=function(e){var t=[0,1,2].map((function(t){return(1-e)*(1-e)*(1-e)*o[t]+3*(1-e)*(1-e)*e*s[t]+3*(1-e)*e*e*a[t]+e*e*e*l[t]}));return new g(t,"lab")}}else if(5===e.length){var h=pi(e.slice(0,3)),c=pi(e.slice(2,5));r=function(e){return e<.5?h(2*e):c(2*(e-.5))}}return r},_i=function(e){var t=pi(e);return t.scale=function(){return fi(t)},t},gi=function(e,t,i){if(!gi[i])throw new Error("unknown blend mode "+i);return gi[i](e,t)},mi=function(e){return function(t,i){var n=v(i).rgb(),r=v(t).rgb();return v.rgb(e(n,r))}},vi=function(e){return function(t,i){var n=[];return n[0]=e(t[0],i[0]),n[1]=e(t[1],i[1]),n[2]=e(t[2],i[2]),n}},yi=function(e){return e},bi=function(e,t){return e*t/255},Ti=function(e,t){return e>t?t:e},Ai=function(e,t){return e>t?e:t},Ei=function(e,t){return 255*(1-(1-e/255)*(1-t/255))},Ci=function(e,t){return t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255))},xi=function(e,t){return 255*(1-(1-t/255)/(e/255))},Si=function(e,t){return 255===e||(e=t/255*255/(1-e/255))>255?255:e};gi.normal=mi(vi(yi)),gi.multiply=mi(vi(bi)),gi.screen=mi(vi(Ei)),gi.overlay=mi(vi(Ci)),gi.darken=mi(vi(Ti)),gi.lighten=mi(vi(Ai)),gi.dodge=mi(vi(Si)),gi.burn=mi(vi(xi));for(var Ri=gi,Mi=c.type,Pi=c.clip_rgb,Ii=c.TWOPI,Oi=Math.pow,Di=Math.sin,Li=Math.cos,wi=function(e,t,i,n,r){void 0===e&&(e=300),void 0===t&&(t=-1.5),void 0===i&&(i=1),void 0===n&&(n=1),void 0===r&&(r=[0,1]);var o,s=0;"array"===Mi(r)?o=r[1]-r[0]:(o=0,r=[r,r]);var a=function(a){var l=Ii*((e+120)/360+t*a),h=Oi(r[0]+o*a,n),c=(0!==s?i[0]+a*s:i)*h*(1-h)/2,u=Li(l),f=Di(l);return v(Pi([255*(h+c*(-.14861*u+1.78277*f)),255*(h+c*(-.29227*u-.90649*f)),255*(h+c*(1.97294*u)),1]))};return a.start=function(t){return null==t?e:(e=t,a)},a.rotations=function(e){return null==e?t:(t=e,a)},a.gamma=function(e){return null==e?n:(n=e,a)},a.hue=function(e){return null==e?i:("array"===Mi(i=e)?0==(s=i[1]-i[0])&&(i=i[1]):s=0,a)},a.lightness=function(e){return null==e?r:("array"===Mi(e)?(r=e,o=e[1]-e[0]):(r=[e,e],o=0),a)},a.scale=function(){return v.scale(a)},a.hue(i),a},Ni="0123456789abcdef",Fi=Math.floor,Bi=Math.random,Ui=function(){for(var e="#",t=0;t<6;t++)e+=Ni.charAt(Fi(16*Bi()));return new g(e,"hex")},ki=Math.log,Vi=Math.pow,Gi=Math.floor,Hi=Math.abs,zi=function(e,t){void 0===t&&(t=null);var i={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===s(e)&&(e=Object.values(e)),e.forEach((function(e){t&&"object"===s(e)&&(e=e[t]),null==e||isNaN(e)||(i.values.push(e),i.sum+=e,ei.max&&(i.max=e),i.count+=1)})),i.domain=[i.min,i.max],i.limits=function(e,t){return Wi(i,e,t)},i},Wi=function(e,t,i){void 0===t&&(t="equal"),void 0===i&&(i=7),"array"==s(e)&&(e=zi(e));var n=e.min,r=e.max,o=e.values.sort((function(e,t){return e-t}));if(1===i)return[n,r];var a=[];if("c"===t.substr(0,1)&&(a.push(n),a.push(r)),"e"===t.substr(0,1)){a.push(n);for(var l=1;l 0");var h=Math.LOG10E*ki(n),c=Math.LOG10E*ki(r);a.push(n);for(var u=1;u200&&(b=!1)}for(var F={},B=0;Bn?(i+.05)/(n+.05):(n+.05)/(i+.05)},Yi=Math.sqrt,Ki=Math.atan2,qi=Math.abs,Zi=Math.cos,Qi=Math.PI,Ji=function(e,t,i,n){void 0===i&&(i=1),void 0===n&&(n=1),e=new g(e),t=new g(t);for(var r=Array.from(e.lab()),o=r[0],s=r[1],a=r[2],l=Array.from(t.lab()),h=l[0],c=l[1],u=l[2],f=Yi(s*s+a*a),d=Yi(c*c+u*u),p=o<16?.511:.040975*o/(1+.01765*o),_=.0638*f/(1+.0131*f)+.638,m=f<1e-6?0:180*Ki(a,s)/Qi;m<0;)m+=360;for(;m>=360;)m-=360;var v=m>=164&&m<=345?.56+qi(.2*Zi(Qi*(m+168)/180)):.36+qi(.4*Zi(Qi*(m+35)/180)),y=f*f*f*f,b=Yi(y/(y+1900)),T=_*(b*v+1-b),A=f-d,E=s-c,C=a-u,x=(o-h)/(i*p),S=A/(n*_);return Yi(x*x+S*S+(E*E+C*C-A*A)/(T*T))},$i=function(e,t,i){void 0===i&&(i="lab"),e=new g(e),t=new g(t);var n=e.get(i),r=t.get(i),o=0;for(var s in n){var a=(n[s]||0)-(r[s]||0);o+=a*a}return Math.sqrt(o)},en=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];try{return new(Function.prototype.bind.apply(g,[null].concat(e))),!0}catch(e){return!1}},tn={cool:function(){return fi([v.hsl(180,1,.9),v.hsl(250,.7,.4)])},hot:function(){return fi(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")}},nn={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},rn=0,on=Object.keys(nn);rn2096103.424&&d!==f))return navigator.msSaveBlob?navigator.msSaveBlob(y(h),p):b(h);l=(h=y(h)).type||a}else if(/([\x80-\xff])/.test(h)){for(var g=0,m=new Uint8Array(h.length),v=m.length;g65536){var e=this[0];return this.forEach((function(t,i,n){t65536){var e=this[0];return this.forEach((function(t,i,n){t>e&&(e=t)})),e}return Math.max.apply(null,this)},t.matrixMax=x,t.matrixMin=S,t.getUniqueVals=R;var M=i(4472),P=i(7398),I=i(3245),O=i(1761),D=i(2644),L=i(6668),w=i(7412),N=i(8233),F=i(788),B=i(9903);t.PLOTTYPES={pointCloud:["coordinates","colorBy","colorVar"],shapeCloud:["coordinates","colorBy","colorVar"],surface:["coordinates","colorBy","colorVar"],heatMap:["coordinates","colorBy","colorVar"],imageStack:["values","indices","attributes"],meshObject:["meshString"],Line:["coordinates","colorBy","colorVar"]},t.isValidPlot=function(e){for(var i=0;i0)if(Array.isArray(n[0]))this._annotationManager.addLabels(n);else for(var r=0;r0&&(this.shapeLegendTitle&&""!==this.shapeLegendTitle&&(o+=100),this._shapeLegendPosition=n?"right":r?"left":i<=t?"right":"left");var c={title:this.shapeLegendTitle,spacing:o,shapes:s},u=!1;for(a=0;a1)for(R=0;Rr?T.addRowDefinition(1/r):T.addRowDefinition(1/s);g.addControl(T,1,0);x=void 0;x="custom"===e.colorScale?_.default.scale(e.customColorScale).mode("lch").colors(s):_.default.scale(_.default.brewer[e.colorScale]).mode("lch").colors(s);for(R=0;R0){var h=r*this.yScale;(c=s.BoxBuilder.CreateBox("box_"+t+"-"+n,{height:h,width:this.xScale*this._size,depth:this.zScale*this._size},this._scene)).position=new o.Vector3(t*this.xScale+.5*this.xScale,h/2,n*this.zScale+.5*this.zScale),(u=new l.StandardMaterial("box_"+t+"-"+n+"_color",this._scene)).alpha=1,u.diffuseColor=o.Color3.FromHexString(this._coordColors[n+t*i.length].substring(0,7)),c.material=u,e.push(c)}else{var c,u;(c=a.PlaneBuilder.CreatePlane("box_"+t+"-"+n,{width:this.xScale*this._size,height:this.zScale*this._size},this._scene)).position=new o.Vector3(t*this.xScale+.5*this.xScale,0,n*this.zScale+.5*this.zScale),c.rotation.x=Math.PI/2,(u=new l.StandardMaterial("box_"+t+"-"+n+"_color",this._scene)).alpha=1,u.diffuseColor=o.Color3.FromHexString(this._coordColors[n+t*i.length].substring(0,7)),u.backFaceCulling=!1,c.material=u,e.push(c)}}this.meshes=e,Object.defineProperty(this,"alpha",{set:function(e){for(var t=0;t0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=0&&ethis.frameDelay&&(this._prevTime=e,0===this.frameIndex?this._containers[this._containers.length-1].removeAllFromScene():this._containers[this.frameIndex-1].removeAllFromScene(),this._containers[this.frameIndex].addAllToScene(),this.frameIndex===this._containers.length-1?this.frameIndex=0:this.frameIndex++)}return!0},t}(l.Plot);t.MeshStream=c},3245:function(e,t,i){"use strict";var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PointCloud=void 0;var s=i(6212),a=i(4701),l=i(128),h=i(5328),c=i(5420),u=o(i(5792)),f=function(e){function t(t,i,n,r,o,s,l,h,c,u,f,d,p,_,g){void 0===u&&(u=1),void 0===f&&(f=1),void 0===d&&(d=1),void 0===p&&(p="point cloud"),void 0===_&&(_=!1);var m=e.call(this,p,"point",t,i,n,r,o,u,f,d)||this;if(m._looping=!1,m._animDirection=1,m._animationVectors=[],m._animationCounter=0,m._animationFrames=200,m._animationVectorFract=[],m._animationDelay=100,m._hasAnimation=s,h&&(m._animationDelay=h),c&&(m._animationFrames=c),s)if(l){for(var v=0;v{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Axes=void 0;var n=i(6212),r=i(4627),o=i(4701),s=i(5016),a=i(5328),l=function(){function e(e,t,i){void 0===i&&(i=!1),this._axes=[],this._axisLabels=[],this._ticks=[],this._tickLabels=[],this._tickLines=[],this.axisData=e,this._scene=t,this._createAxes(i)}return e.prototype._roundTicks=function(e,t){if(void 0===t&&(t=2),(""+e).includes("e")){var i=(""+e).split("e"),n="";return+i[1]+t>0&&(n="+"),+(Math.round(parseFloat(+i[0].toString()+"e"+n.toString()+(+i[1].toString()+t.toString())))+"e-"+t)}return+(Math.round(parseFloat(e.toString()+"e+"+t.toString()))+"e-"+t)},e.prototype._createAxes=function(e){void 0===e&&(e=!1),e&&(this.axisData.tickBreaks[0]=1,this.axisData.tickBreaks[2]=1);var t=this.axisData.tickBreaks[0]*this.axisData.scale[0],i=this.axisData.tickBreaks[1]*this.axisData.scale[1],n=this.axisData.tickBreaks[2]*this.axisData.scale[2],s=Math.floor(this.axisData.range[0][0]/t)*t,a=Math.floor(this.axisData.range[1][0]/i)*i,l=Math.floor(this.axisData.range[2][0]/n)*n,h=Math.ceil(this.axisData.range[0][1]/t)*t,c=Math.ceil(this.axisData.range[1][1]/i)*i,u=Math.ceil(this.axisData.range[2][1]/n)*n;if(this.axisData.showAxes[0]){var f=r.LinesBuilder.CreateLines("axisX",{points:[new o.Vector3(s,a,l),new o.Vector3(h,a,l)]},this._scene);f.color=o.Color3.FromHexString(this.axisData.color[0]),f.isPickable=!1,this._axes.push(f);var d=this._makeTextPlane(this.axisData.axisLabels[0],1,this.axisData.color[0]);d.position=new o.Vector3(h/2,a-.5*c,l),d.isPickable=!1,this._axisLabels.push(d);for(var p=[],_=0;_<-Math.ceil(this.axisData.range[0][0]/t);_++)p.push(-(_+1)*t);for(_=0;_<=Math.ceil(this.axisData.range[0][1]/t);_++)p.push(_*t);var g=0;e&&(g=1);for(_=g;_t&&(t=n.length)}this._background.widthInPixels=12*t+6,this._background.heightInPixels=16*e.length+6,this._background.linkWithMesh(this.target),this._background.background=this._bgColor,this._background.alpha=.8,this._background.linkOffsetY=-10,this._textBlock=new l.TextBlock,this._textBlock.text=this._text,this._textBlock.fontSize=12,this._textBlock.color=this._txtColor,this._background.addControl(this._textBlock),this._closeBtn=l.Button.CreateSimpleButton("close","x"),this._background.addControl(this._closeBtn),this._closeBtn.topInPixels=-this._background.heightInPixels/2+10,this._closeBtn.leftInPixels=this._background.widthInPixels/2-10,this._closeBtn.widthInPixels=20,this._closeBtn.heightInPixels=20,this._closeBtn.fontSize=10,this._closeBtn.background=this._txtColor,this._closeBtn.color=this._bgColor,this._closeBtn.onPointerClickObservable.add(function(){this.dispose()}.bind(this))},e.prototype.dispose=function(){this._textBlock&&(this._textBlock.dispose(),this._textBlock=void 0),this._background&&(this._background.dispose(),this._background=void 0),this._closeBtn&&(this._closeBtn.dispose(),this._closeBtn=void 0),this.disposed=!0},e}(),p=function(){function e(e,t,i,n,r,s){void 0===s&&(s=!1),this.size=100,this.color="black",this.fixed=!1,void 0!==r&&(this.size=r);var h=o.PlaneBuilder.CreatePlane("label",{width:.05*this.size,height:.05*this.size},i);void 0!==n&&(this.color=n),this.plotCreated=s,h.position=t;var c=a.AdvancedDynamicTexture.CreateForMesh(h),u=new l.Rectangle;u.color="red",u.alpha=0,c.addControl(u),this._background=u;var f=new l.TextBlock;f.text=e,f.color=this.color,f.fontSize=this.size,c.addControl(f),this._text=f,this.fixed||g(h),this._label=h}return e.prototype.setText=function(e){this._text.text=e},e.prototype.update=function(e,t){var i=r.Vector3.Cross(e.position,r.Axis.Y),n=r.Vector3.Cross(i,e.position),o=r.Vector3.Cross(i,n);if(this._label.rotation=r.Vector3.RotationFromAxis(i,n,o),!this.fixed){var s=t.meshUnderPointer;this._label===s?this._background.alpha=1:this._background.alpha=0}},e.prototype.fix=function(){this._label.removeBehavior(this._label.getBehaviorByName("PointerDrag")),this.fixed=!0},e.prototype.unfix=function(){g(this._label),this.fixed=!1},e.prototype.dispose=function(){this._text.dispose(),this._background.dispose(),this._label.dispose()},e.prototype.export=function(){return[this._label.position.x,this._label.position.y,this._label.position.z,this._text.text,this.color,this.size]},e}(),_=function(){function e(e,t,i,n,r,o,s){this._editLabelForms=[],this._showLabels=!1,this._arrows=[],this._showArrows=!1,this.dpInfos=[],this.labels=[],this.fixedLabels=!1,this.fixedArrows=!1,this._canvas=e,this._scene=t,this._ymax=i,this._camera=n,this._bgColor=r,this._fgColor="white",this._fullScreenUI=o,this._uniqID=s,u.default(r).luminance()>.5&&(this._fgColor="black"),this._createLabelForms()}return e.prototype._createLabelForms=function(){var e=document.createElement("div");e.id="labelControl_"+this._uniqID,e.className="bbp label-control",e.style.display="none",e.style.top=this._canvas.clientTop+40+"px",e.style.left=this._canvas.clientTop+5+"px";var t=document.createElement("div");t.className="label-form";var i=document.createElement("label");i.innerText="Label Text:",i.htmlFor="addLabelInput";var n=document.createElement("input");n.name="addLabelInput",n.type="text",this._addLabelTextInput=n;var r=document.createElement("button");r.innerText="Add Label",r.onclick=this._addLabelBtnClick.bind(this),t.appendChild(i),t.appendChild(n),t.appendChild(r),e.appendChild(t);var o=document.createElement("div");o.className="edit-container",o.style.maxHeight=(this._canvas.height-100).toString()+"px",e.appendChild(o),this._editLabelContainer=o,this._labelControlBox=e,this._canvas.parentNode.appendChild(e)},e.prototype.update=function(){if(this._showArrows,this._showLabels)for(var e=0;e=0;e--){var t=this.dpInfos[e];t.disposed?this.dpInfos.splice(e,1):(t.dispose(),t.draw())}},e.prototype.displayInfo=function(e,t){for(var i=!1,n=0;nn){var i=parseInt(e.dataset.labelnum),r=(i-1).toString();e.dataset.labelnum=r,e.querySelector('input[data-labelnum="'+i+'"]').dataset.labelnum=r,e.querySelector('button[data-labelnum="'+i+'"]').dataset.labelnum=r}})),t.parentNode.removeChild(t)},e.prototype.exportLabels=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.legendSVGs=t.buttonSVGs=void 0,t.buttonSVGs={logo:'',toJson:'',labels:'',publish:'',replay:'',loop:'',record:'',play:'',pause:'',loading:'',turntable:''},t.legendSVGs={heatmap:'',point:'',surface:'',shape_box:'',shape_cone:'',shape_cylinder:'',shape_sphere:'',shape_torus:''}},8043:(e,t)=>{"use strict";function i(e){console.log("%c"+e,"color:orange;")}Object.defineProperty(t,"__esModule",{value:!0}),t.deprecationWarning=t.warn=void 0,t.warn=i,t.deprecationWarning=function(e,t){i(t?'The use of "'+e+'" is deprecated and might be removed in a future version. Please use "'+t+'" instead.':'The use of "'+e+'" is deprecated and might be removed in a future version.')}},788:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.styleText=void 0,t.styleText=[".bbp.button-bar { position: absolute; z-index: 2; overflow: hidden; padding: 0 10px 4px 0; }",".bbp.button-bar>.button.hidden { display: none; }",".bbp.button-bar>.anim-slider { display: block; float: right; width: 150px; height: 30px }",".bbp.button-bar>.anim-slider.hidden { display: none; }",".bbp.button-bar>.button { float: right; width: 75px; height: 30px; cursor: pointer; border-radius: 2px; background-color: #f0f0f0; margin: 0 4px 0 0; }",".bbp.button-bar>.button:hover { background-color: #ddd; }",".bbp.button-bar>.button>svg { width: 75px; height: 30px; }",".bbp.button-bar>.button.active { background-color: #afafaf; }",".bbp.button-bar>.button.active:hover { background-color: #9f9f9f; }",".bbp.button-bar>.button.streamctrl.loading { cursor: progress; }",".bbp.button-bar>.button.streamctrl.loading:hover { background-color: #f0f0f0; }",".bbp.button-bar>.button.streamctrl.loading>.btn-label.play,.bbp.button-bar>.button.streamctrl.loading>.btn-label.pause {display: none; }",".bbp.button-bar>.button.streamctrl.loading>.btn-label.loading {display: block; }",".bbp.button-bar>.button.streamctrl.play>.btn-label.pause,.bbp.button-bar>.button.streamctrl.play>.btn-label.loading {display: none; }",".bbp.button-bar>.button.streamctrl.play>.btn-label.play {display: block; }",".bbp.button-bar>.button.streamctrl.pause>.btn-label.play,.bbp.button-bar>.button.streamctrl.pause>.btn-label.loading {display: none; }",".bbp.button-bar>.button.streamctrl.pause>.btn-label.pause {display: block; }",".bbp.label-control { position: absolute; z-index: 3; font-family: sans-serif; width: 200px; background-color: #f0f0f0; padding: 5px; border-radius: 2px; }",".bbp.label-control>label { font-size: 11pt; }",".bbp.label-control>.edit-container { overflow: auto; }",".bbp.label-control>.edit-container>.label-form { margin-top: 5px; padding-top: 20px; border-top: solid thin #ccc; }",".bbp.label-control .label-form>input { width: 100%; box-sizing: border-box; }",".bbp.label-control .label-form>button { border: none; font-weight: bold; background-color: white; padding: 5px 10px; margin: 5px 0 2px 0; width: 100%; cursor: pointer; }",".bbp.label-control .label-form>button:hover { background-color: #ddd; }",".bbp.overlay { position: absolute; z-index: 3; overflow: hidden; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; background-color: #fff5; display: flex; justify-content: center; align-items: center;}",".bbp.overlay>h5.loading-message { color: #000; font-family: Verdana, sans-serif;}",".bbp.publish-form>label { display: block; text-align: left; font-family: Verdana, sans-serif; }",".bbp.publish-form>input { width: 100%; margin-bottom: 15px; box-sizing: border-box; }",".bbp.publish-form>.publish-btn { border: none; font-weight: bold; background-color: #e95420; color: white; padding: 5px 10px; margin: 5px 0 2px 0; width: 100%; cursor: pointer; }",".bbp.publish-form>.publish-btn:hover { background-color: #ca491a }",".bbp.publish-form>.close-btn, .bbp.publish-form>.cancel-btn { border: none; font-weight: bold; background-color: white; padding: 5px 10px; margin: 5px 0 2px 0; width: 100%; cursor: pointer; }",".bbp.publish-form>.close-btn:hover, .bbp.publish-form>.cancel-btn:hover { background-color: #ddd }",".bbp.publish-form>p.form-info { font-size: 8pt; font-family: Verdana, sans-serif; }",".bbp.publish-form>p.message { font-size: 10pt; font-family: Verdana, sans-serif; }",".bbp.publish-form>p.message.warning { color: red; margin-top: 0px; }",".bbp.publish-form>p.message.success { color: green; }"].join(" ")},655:(e,t,i)=>{"use strict";i.d(t,{ZT:()=>r,pi:()=>o,gn:()=>s,pr:()=>a});var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)};function r(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var o=function(){return(o=Object.assign||function(e){for(var t,i=1,n=arguments.length;i=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s}Object.create;function a(){for(var e=0,t=0,i=arguments.length;t{"use strict";i.r(t),i.d(t,{NIL:()=>I,parse:()=>g,stringify:()=>c,v1:()=>_,v3:()=>x,v4:()=>S,v5:()=>P,validate:()=>a,version:()=>O});var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),r=new Uint8Array(16);function o(){if(!n)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(r)}const s=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const a=function(e){return"string"==typeof e&&s.test(e)};for(var l=[],h=0;h<256;++h)l.push((h+256).toString(16).substr(1));const c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase();if(!a(i))throw TypeError("Stringified UUID is invalid");return i};var u,f,d=0,p=0;const _=function(e,t,i){var n=t&&i||0,r=t||new Array(16),s=(e=e||{}).node||u,a=void 0!==e.clockseq?e.clockseq:f;if(null==s||null==a){var l=e.random||(e.rng||o)();null==s&&(s=u=[1|l[0],l[1],l[2],l[3],l[4],l[5]]),null==a&&(a=f=16383&(l[6]<<8|l[7]))}var h=void 0!==e.msecs?e.msecs:Date.now(),_=void 0!==e.nsecs?e.nsecs:p+1,g=h-d+(_-p)/1e4;if(g<0&&void 0===e.clockseq&&(a=a+1&16383),(g<0||h>d)&&void 0===e.nsecs&&(_=0),_>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");d=h,p=_,f=a;var m=(1e4*(268435455&(h+=122192928e5))+_)%4294967296;r[n++]=m>>>24&255,r[n++]=m>>>16&255,r[n++]=m>>>8&255,r[n++]=255&m;var v=h/4294967296*1e4&268435455;r[n++]=v>>>8&255,r[n++]=255&v,r[n++]=v>>>24&15|16,r[n++]=v>>>16&255,r[n++]=a>>>8|128,r[n++]=255&a;for(var y=0;y<6;++y)r[n+y]=s[y];return t||c(r)};const g=function(e){if(!a(e))throw TypeError("Invalid UUID");var t,i=new Uint8Array(16);return i[0]=(t=parseInt(e.slice(0,8),16))>>>24,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i[4]=(t=parseInt(e.slice(9,13),16))>>>8,i[5]=255&t,i[6]=(t=parseInt(e.slice(14,18),16))>>>8,i[7]=255&t,i[8]=(t=parseInt(e.slice(19,23),16))>>>8,i[9]=255&t,i[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,i[11]=t/4294967296&255,i[12]=t>>>24&255,i[13]=t>>>16&255,i[14]=t>>>8&255,i[15]=255&t,i};function m(e,t,i){function n(e,n,r,o){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],i=0;i>>9<<4)+1}function y(e,t){var i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}function b(e,t,i,n,r,o){return y((s=y(y(t,e),y(n,o)))<<(a=r)|s>>>32-a,i);var s,a}function T(e,t,i,n,r,o,s){return b(t&i|~t&n,e,t,r,o,s)}function A(e,t,i,n,r,o,s){return b(t&n|i&~n,e,t,r,o,s)}function E(e,t,i,n,r,o,s){return b(t^i^n,e,t,r,o,s)}function C(e,t,i,n,r,o,s){return b(i^(t|~n),e,t,r,o,s)}const x=m("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var i=0;i>5]>>>r%32&255,s=parseInt(n.charAt(o>>>4&15)+n.charAt(15&o),16);t.push(s)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[n/8])<>>32-t}const P=m("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var r=0;r>>0;y=v,v=m,m=M(g,30)>>>0,g=_,_=A}i[0]=i[0]+_>>>0,i[1]=i[1]+g>>>0,i[2]=i[2]+m>>>0,i[3]=i[3]+v>>>0,i[4]=i[4]+y>>>0}return[i[0]>>24&255,i[0]>>16&255,i[0]>>8&255,255&i[0],i[1]>>24&255,i[1]>>16&255,i[1]>>8&255,255&i[1],i[2]>>24&255,i[2]>>16&255,i[2]>>8&255,255&i[2],i[3]>>24&255,i[3]>>16&255,i[3]>>8&255,255&i[3],i[4]>>24&255,i[4]>>16&255,i[4]>>8&255,255&i[4]]})),I="00000000-0000-0000-0000-000000000000";const O=function(e){if(!a(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=i(5420);Baby=n})(); //# sourceMappingURL=babyplots.js.map \ No newline at end of file diff --git a/dist/babyplots.js.map b/dist/babyplots.js.map index 42425be..4ba67c2 100644 --- a/dist/babyplots.js.map +++ b/dist/babyplots.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://Baby/./node_modules/@babylonjs/core/Animations/animation.js","webpack://Baby/./node_modules/@babylonjs/core/Animations/animationKey.js","webpack://Baby/./node_modules/@babylonjs/core/Animations/animationRange.js","webpack://Baby/./node_modules/@babylonjs/core/Culling/ray.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/pivotTools.js","webpack://Baby/./node_modules/@babylonjs/core/Behaviors/Meshes/pointerDragBehavior.js","webpack://Baby/./node_modules/@babylonjs/core/Behaviors/Cameras/autoRotationBehavior.js","webpack://Baby/./node_modules/@babylonjs/core/Animations/easing.js","webpack://Baby/./node_modules/@babylonjs/core/Behaviors/Cameras/bouncingBehavior.js","webpack://Baby/./node_modules/@babylonjs/core/Behaviors/Cameras/framingBehavior.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/arcRotateCameraPointersInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/BaseCameraPointersInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/arcRotateCameraMouseWheelInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/arcRotateCameraInputsManager.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/arcRotateCamera.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/camera.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/cameraInputsManager.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/targetCamera.js","webpack://Baby/./node_modules/@babylonjs/core/Collisions/intersectionInfo.js","webpack://Baby/./node_modules/@babylonjs/core/Collisions/pickingInfo.js","webpack://Baby/./node_modules/@babylonjs/core/Culling/boundingBox.js","webpack://Baby/./node_modules/@babylonjs/core/Culling/boundingSphere.js","webpack://Baby/./node_modules/@babylonjs/core/Culling/boundingInfo.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.readTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.renderTarget.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.renderTargetCube.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/shaderCodeNode.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/shaderCodeCursor.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/shaderCodeConditionNode.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/shaderCodeTestNode.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/Expressions/shaderDefineExpression.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineOrOperator.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineAndOperator.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/shaderProcessor.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/constants.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/performanceMonitor.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.alpha.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.dynamicBuffer.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/engine.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/engineStore.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/performanceConfigurator.js","webpack://Baby/./node_modules/@babylonjs/core/States/depthCullingState.js","webpack://Baby/./node_modules/@babylonjs/core/States/stencilState.js","webpack://Baby/./node_modules/@babylonjs/core/States/alphaCullingState.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/WebGL/webGLShaderProcessors.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/WebGL/webGL2ShaderProcessors.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/WebGL/webGLPipelineContext.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/thinEngine.js","webpack://Baby/./node_modules/@babylonjs/core/Events/clipboardEvents.js","webpack://Baby/./node_modules/@babylonjs/core/Events/keyboardEvents.js","webpack://Baby/./node_modules/@babylonjs/core/Events/pointerEvents.js","webpack://Baby/./node_modules/@babylonjs/core/Lights/hemisphericLight.js","webpack://Baby/./node_modules/@babylonjs/core/Lights/light.js","webpack://Baby/./node_modules/@babylonjs/core/Loading/sceneLoader.js","webpack://Baby/./node_modules/@babylonjs/core/Loading/sceneLoaderFlags.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/baseTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/thinTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.dynamicTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/dynamicTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/internalTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/renderTargetCreationOptions.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/renderTargetTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/copyTools.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/texture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/effect.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/effectFallbacks.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/colorCurves.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/imageProcessingConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/material.detailMapConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/material.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/materialDefines.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/materialFlags.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/thinMaterialHelper.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/materialHelper.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/multiMaterial.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/prePassConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/pushMaterial.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/shaderMaterial.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/defaultFragmentDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/defaultUboDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/lightsFragmentFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/fresnelFunction.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/default.fragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/defaultVertexDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pointCloudVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/default.vertex.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/standardMaterial.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.uniformBuffer.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/uniformBuffer.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.axis.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.color.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.constants.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.frustum.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.functions.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.vertexFormat.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.path.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.plane.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.scalar.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.size.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.vector.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.viewport.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/Builders/boxBuilder.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/Builders/cylinderBuilder.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/instancedMesh.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/color.fragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/color.vertex.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/linesMesh.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/Builders/linesBuilder.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/Builders/planeBuilder.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/Builders/sphereBuilder.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/Builders/torusBuilder.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/WebGL/webGLDataBuffer.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/dataBuffer.js","webpack://Baby/./node_modules/@babylonjs/core/Collisions/meshCollisionData.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/abstractMesh.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/buffer.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/geometry.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/meshLODLevel.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/mesh.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/mesh.vertexData.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/subMesh.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/thinInstanceMesh.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/transformNode.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/arrayTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/canvasGenerator.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/decorators.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/deepCopier.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/devTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/domManagement.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/retryStrategy.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/baseError.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/fileTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/filesInputStore.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/guid.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/instantiationTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/logger.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/observable.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/perfCounter.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/precisionDate.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/fxaa.fragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/fxaa.vertex.js","webpack://Baby/./node_modules/@babylonjs/core/PostProcesses/fxaaPostProcess.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/screenshotTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/smartArray.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/stringTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/andOrNotEvaluator.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/tags.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/timingTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/promise.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/tools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/typeStore.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/webRequest.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/postprocess.vertex.js","webpack://Baby/./node_modules/@babylonjs/core/PostProcesses/postProcess.js","webpack://Baby/./node_modules/@babylonjs/core/PostProcesses/postProcessManager.js","webpack://Baby/./node_modules/@babylonjs/core/Rendering/renderingGroup.js","webpack://Baby/./node_modules/@babylonjs/core/Rendering/renderingManager.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentMainFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertexDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/depthPrePass.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/helperFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/imageProcessingDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/imageProcessingFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassVertexDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/reflectionFunction.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/shadowsFragmentFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js","webpack://Baby/./node_modules/@babylonjs/core/abstractScene.js","webpack://Baby/./node_modules/@babylonjs/core/node.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/stringDictionary.js","webpack://Baby/./node_modules/@babylonjs/core/Actions/actionEvent.js","webpack://Baby/./node_modules/@babylonjs/core/Actions/abstractActionManager.js","webpack://Baby/./node_modules/@babylonjs/core/Inputs/scene.inputManager.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/uniqueIdGenerator.js","webpack://Baby/./node_modules/@babylonjs/core/scene.js","webpack://Baby/./node_modules/@babylonjs/core/sceneComponent.js","webpack://Baby/./node_modules/@babylonjs/core/Layers/layerSceneComponent.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/layer.fragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/layer.vertex.js","webpack://Baby/./node_modules/@babylonjs/core/Layers/layer.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/style.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/advancedDynamicTexture.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/container.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/math2D.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/control.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/rectangle.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/textBlock.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/image.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/button.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/stackPanel.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/checkbox.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/textWrapper.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/inputText.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/grid.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/colorpicker.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/ellipse.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/inputPassword.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/line.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/multiLinePoint.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/multiLine.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/radioButton.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/sliders/baseSlider.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/sliders/slider.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/selector.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/scrollViewers/scrollViewerWindow.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/sliders/scrollBar.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/sliders/imageScrollBar.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/scrollViewers/scrollViewer.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/virtualKeyboard.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/displayGrid.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/sliders/imageBasedSlider.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/statics.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/measure.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/valueAndUnit.js","webpack://Baby/./node_modules/@babylonjs/core/assetContainer.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/dataReader.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/glTFValidation.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/glTFFileLoader.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/1.0/glTFLoaderInterfaces.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/freeCameraKeyboardMoveInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/freeCameraMouseInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/BaseCameraMouseWheelInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/freeCameraMouseWheelInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/freeCameraTouchInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/freeCameraInputsManager.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/freeCamera.js","webpack://Baby/./node_modules/@babylonjs/core/Bones/bone.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.rawTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/rawTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Bones/skeleton.js","webpack://Baby/./node_modules/@babylonjs/core/Lights/shadowLight.js","webpack://Baby/./node_modules/@babylonjs/core/Lights/directionalLight.js","webpack://Baby/./node_modules/@babylonjs/core/Lights/pointLight.js","webpack://Baby/./node_modules/@babylonjs/core/Lights/spotLight.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/1.0/glTFLoader.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/1.0/glTFLoaderUtils.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/1.0/glTFBinaryExtension.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/1.0/glTFMaterialsCommonExtension.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/deferred.js","webpack://Baby/./node_modules/@babylonjs/core/Animations/runtimeAnimation.js","webpack://Baby/./node_modules/@babylonjs/core/Animations/animatable.js","webpack://Baby/./node_modules/@babylonjs/core/Animations/animationGroup.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/rgbdDecode.fragment.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/rgbdTextureTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/brdfTextureTools.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/PBR/pbrClearCoatConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/PBR/pbrAnisotropicConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/PBR/pbrBRDFConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/PBR/pbrSheenConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/PBR/pbrSubSurfaceConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/sphericalPolynomial.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/baseTexture.polynomial.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrFragmentDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrUboDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/subSurfaceScatteringFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/importanceSampling.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrHelperFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/harmonicsFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDirectLightingFalloffFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBRDFFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/hdrFilteringFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDirectLightingFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrIBLFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflectivity.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAmbientOcclusion.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAlphaFresnel.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAnisotropic.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflection.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockSheen.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockClearcoat.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockSubSurface.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockNormalGeometric.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockNormalFinal.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockLightmapInit.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockGeometryInfo.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflectance0.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflectance.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockDirectLighting.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockFinalUnlitComponents.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockFinalColorComposition.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockImageProcessing.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDebug.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/pbr.fragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrVertexDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/pbr.vertex.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/PBR/pbrBaseMaterial.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/PBR/pbrMaterial.js","webpack://Baby/./node_modules/@babylonjs/core/Morph/morphTarget.js","webpack://Baby/./node_modules/@babylonjs/core/Morph/morphTargetManager.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/glTFLoader.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/rgbdEncode.fragment.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/environmentTextureTools.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.cubeTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/cubeTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/rawCubeTexture.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/EXT_lights_image_based.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/EXT_texture_webp.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/workerPool.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/Compression/dracoCompression.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_draco_mesh_compression.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_lights_punctual.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_unlit.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_clearcoat.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_sheen.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_specular.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_ior.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_variants.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_transmission.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_translucency.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_mesh_quantization.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_texture_basisu.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_texture_transform.js","webpack://Baby/./node_modules/@babylonjs/core/Animations/animationEvent.js","webpack://Baby/./node_modules/@babylonjs/core/Audio/sound.js","webpack://Baby/./node_modules/@babylonjs/core/Audio/weightedsound.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_audio_emitter.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_lod.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_minecraftMesh.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_sRGBFactors.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/ExtrasAsMetadata.js","webpack://Baby/./node_modules/axios/index.js","webpack://Baby/./node_modules/axios/lib/adapters/xhr.js","webpack://Baby/./node_modules/axios/lib/axios.js","webpack://Baby/./node_modules/axios/lib/cancel/Cancel.js","webpack://Baby/./node_modules/axios/lib/cancel/CancelToken.js","webpack://Baby/./node_modules/axios/lib/cancel/isCancel.js","webpack://Baby/./node_modules/axios/lib/core/Axios.js","webpack://Baby/./node_modules/axios/lib/core/InterceptorManager.js","webpack://Baby/./node_modules/axios/lib/core/buildFullPath.js","webpack://Baby/./node_modules/axios/lib/core/createError.js","webpack://Baby/./node_modules/axios/lib/core/dispatchRequest.js","webpack://Baby/./node_modules/axios/lib/core/enhanceError.js","webpack://Baby/./node_modules/axios/lib/core/mergeConfig.js","webpack://Baby/./node_modules/axios/lib/core/settle.js","webpack://Baby/./node_modules/axios/lib/core/transformData.js","webpack://Baby/./node_modules/axios/lib/defaults.js","webpack://Baby/./node_modules/axios/lib/helpers/bind.js","webpack://Baby/./node_modules/axios/lib/helpers/buildURL.js","webpack://Baby/./node_modules/axios/lib/helpers/combineURLs.js","webpack://Baby/./node_modules/axios/lib/helpers/cookies.js","webpack://Baby/./node_modules/axios/lib/helpers/isAbsoluteURL.js","webpack://Baby/./node_modules/axios/lib/helpers/isAxiosError.js","webpack://Baby/./node_modules/axios/lib/helpers/isURLSameOrigin.js","webpack://Baby/./node_modules/axios/lib/helpers/normalizeHeaderName.js","webpack://Baby/./node_modules/axios/lib/helpers/parseHeaders.js","webpack://Baby/./node_modules/axios/lib/helpers/spread.js","webpack://Baby/./node_modules/axios/lib/helpers/validator.js","webpack://Baby/./node_modules/axios/lib/utils.js","webpack://Baby/./node_modules/chroma-js/chroma.js","webpack://Baby/./node_modules/downloadjs/download.js","webpack://Baby/./src/babyplots.ts","webpack://Baby/./src/plotTypes/HeatMap.ts","webpack://Baby/./src/plotTypes/ImgStack.ts","webpack://Baby/./src/plotTypes/Line.ts","webpack://Baby/./src/plotTypes/MeshObject.ts","webpack://Baby/./src/plotTypes/MeshStream.ts","webpack://Baby/./src/plotTypes/PointCloud.ts","webpack://Baby/./src/plotTypes/ShapeCloud.ts","webpack://Baby/./src/plotTypes/Surface.ts","webpack://Baby/./src/utils/Axes.ts","webpack://Baby/./src/utils/Label.ts","webpack://Baby/./src/utils/SVGs.ts","webpack://Baby/./src/utils/logging.ts","webpack://Baby/./src/utils/styleText.ts","webpack://Baby/./node_modules/tslib/tslib.es6.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/rng.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/regex.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/validate.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/stringify.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/v1.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/parse.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/v35.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/md5.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/v3.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/v4.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/sha1.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/v5.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/nil.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/version.js","webpack://Baby/webpack/bootstrap","webpack://Baby/webpack/runtime/define property getters","webpack://Baby/webpack/runtime/hasOwnProperty shorthand","webpack://Baby/webpack/runtime/make namespace object","webpack://Baby/webpack/startup"],"names":["Animation","name","targetProperty","framePerSecond","dataType","loopMode","enableBlending","this","_runtimeAnimations","Array","_events","blendingSpeed","_ranges","targetPropertyPath","split","undefined","ANIMATIONLOOPMODE_CYCLE","_PrepareAnimation","totalFrame","from","to","easingFunction","isNaN","parseFloat","isFinite","ANIMATIONTYPE_FLOAT","ANIMATIONTYPE_QUATERNION","ANIMATIONTYPE_VECTOR3","ANIMATIONTYPE_VECTOR2","ANIMATIONTYPE_COLOR3","ANIMATIONTYPE_COLOR4","ANIMATIONTYPE_SIZE","animation","keys","frame","value","setKeys","setEasingFunction","CreateAnimation","property","animationType","ANIMATIONLOOPMODE_CONSTANT","CreateAndStartAnimation","node","onAnimationEnd","getScene","beginDirectAnimation","CreateAndStartHierarchyAnimation","directDescendantsOnly","beginDirectHierarchyAnimation","CreateMergeAndStartAnimation","animations","push","beginAnimation","MakeAnimationAdditive","sourceAnimation","referenceFrame","range","cloneOriginal","clonedName","clone","_keys","length","startIndex","firstKey","endIndex","lastKey","valueStore","referenceValue","referencePosition","referenceQuaternion","referenceScaling","keyPosition","keyQuaternion","keyScaling","referenceFound","rangeValue","getRange","fromKeyFound","toKeyFound","_getKeyValue","index","currentKey","nextKey","animationState","key","repeatCount","_interpolate","splice","normalize","conjugateInPlace","ANIMATIONTYPE_MATRIX","decompose","subtractInPlace","divideInPlace","multiplyToRef","subtractToRef","width","height","TransitionTo","targetValue","host","scene","frameRate","transition","duration","endFrame","Object","defineProperty","prototype","get","enumerable","configurable","_i","_a","isStopped","toString","fullDetails","ret","first","addEvent","event","sort","a","b","removeEvents","getEvents","createRange","deleteRange","deleteFrames","getKeys","getHighestFrame","nKeys","getEasingFunction","_easingFunction","floatInterpolateFunction","startValue","endValue","gradient","floatInterpolateFunctionWithTangents","outTangent","inTangent","quaternionInterpolateFunction","quaternionInterpolateFunctionWithTangents","vector3InterpolateFunction","vector3InterpolateFunctionWithTangents","vector2InterpolateFunction","vector2InterpolateFunctionWithTangents","sizeInterpolateFunction","color3InterpolateFunction","color4InterpolateFunction","currentFrame","state","highLimitValue","startKeyIndex","endKey","startKey","interpolation","useTangent","frameDelta","ease","floatValue","ANIMATIONLOOPMODE_RELATIVE","offsetValue","quatValue","scale","addInPlace","vec3Value","add","vec2Value","AllowMatricesInterpolation","matrixInterpolateFunction","workValue","result","AllowMatrixDecomposeForInterpolation","join","values","slice","serialize","serializationObject","loopBehavior","animationKey","asArray","ranges","source","_UniversalLerp","left","right","amount","constructor","Lerp","Slerp","toFixed","Parse","parsedAnimation","data","_inTangent","equals","_outTangent","keyData","AppendSerializedAnimations","destination","ParseFromFileAsync","url","_this","Promise","resolve","reject","request","addEventListener","readyState","status","JSON","parse","responseText","output","serializationObject_1","serializedAnimation","open","send","CreateFromSnippetAsync","snippetId","snippet","jsonPayload","serializationObject_2","SnippetUrl","replace","N","AnimationKeyInterpolation","AnimationRange","Ray","origin","direction","Number","MAX_VALUE","intersectsBoxMinMax","minimum","maximum","intersectionTreshold","inv","min","max","temp","newMinimum","_TmpVector3","copyFromFloats","x","y","z","newMaximum","d","maxValue","Math","abs","Infinity","intersectsBox","box","intersectsSphere","sphere","center","pyth","radius","rr","dot","intersectsTriangle","vertex0","vertex1","vertex2","edge1","edge2","pvec","tvec","qvec","det","invdet","bv","bw","distance","intersectsPlane","plane","result1","normal","result2","intersectsAxis","axis","offset","t","intersectsMesh","mesh","fastCheck","tm","getWorldMatrix","invertToRef","_tmpRay","TransformToRef","Transform","intersects","intersectsMeshes","meshes","results","i","pickInfo","hit","_comparePickingInfo","pickingInfoA","pickingInfoB","intersectionSegment","sega","segb","threshold","o","u","rsegb","v","w","scaleToRef","rayl","addToRef","sc","sN","tc","tN","c","e","D","sD","tD","smallnum","qtc","qsc","dP","lengthSquared","update","viewportWidth","viewportHeight","world","view","projection","unprojectRayToRef","Zero","CreateNew","CreateNewFromTo","end","subtract","sqrt","ray","matrix","dir","len","num","sourceX","sourceY","invert","nearScreenSource","farScreenSource","nearVec3","farVec3","copyFrom","Scene","camera","cameraViewSpace","createPickingRayToRef","engine","getEngine","activeCamera","viewport","toGlobal","getRenderWidth","getRenderHeight","getHardwareScalingLevel","getViewMatrix","getProjectionMatrix","createPickingRayInCameraSpaceToRef","Error","identity","pickingInfo","rayFunction","onlyBoundingInfo","trianglePredicate","skipBoundingInfo","predicate","meshIndex","isEnabled","isVisible","isPickable","skeleton","overrideMesh","hasThinInstances","thinInstanceEnablePicking","_internalPickForMesh","tmpMatrix","thinMatrices","thinInstanceGetWorldMatrices","result_1","thinInstanceIndex","pickingInfos","result_2","_internalPick","_tempPickingRay","createPickingRay","_pickWithRayInverseMatrix","_cachedRayForTransform","_internalMultiPick","transform","getForwardRayToRef","refRay","position","_scene","useRightHandedSystem","PivotTools","_RemoveAndStorePivotPoint","_PivotCached","getPivotPointToRef","_OldPivotPoint","_PivotPostMultiplyPivotMatrix","_postMultiplyPivotMatrix","equalsToFloats","setPivotMatrix","getPivotPoint","_PivotTranslation","_PivotTmpVector","scaling","multiplyInPlace","_RestorePivotPoint","setPivotPoint","PointerDragBehavior","options","_useAlternatePickedPointAboveMaxDragAngleDragSpeed","maxDragAngle","_useAlternatePickedPointAboveMaxDragAngle","currentDraggingPointerID","dragging","dragDeltaRatio","updateDragPlane","_debugMode","_moving","onDragObservable","onDragStartObservable","onDragEndObservable","moveAttached","enabled","startAndReleaseDragOnPointerEvents","detachCameraControls","useObjectOrientationForDragging","validateDrag","targetPosition","_tmpVector","_alternatePickedPoint","_worldDragAxis","_targetPosition","_attachedToElement","_startDragRay","_lastPointerRay","_dragDelta","_pointA","_pointC","_localAxis","_lookAt","_options","optionCount","dragAxis","dragPlaneNormal","set","init","attach","ownerNode","attachedNode","_planeScene","virtual","detachControl","onDisposeObservable","addOnce","dispose","_dragPlane","Mesh","lastDragPosition","pickPredicate","m","isDescendantOf","_pointerObserver","onPointerObservable","pointerInfo","eventState","type","pickedMesh","pickedPoint","_startDrag","pointerId","releaseDrag","_AnyMouseID","evt","pointerType","hostInformation","isMobile","MouseEvent","_moveDrag","_beforeRenderObserver","onBeforeRenderObservable","absolutePosition","scaleInPlace","getAbsolutePosition","setAbsolutePosition","notifyObservers","dragPlanePoint","leftCamera","getClassName","arcRotateCamera","attachControl","inputs","noPreventDefault","_useCtrlForPanning","_panningMouseButton","startDrag","fromRay","startPickedPoint","lastRay","getTranslationToRef","_updateDragPlanePosition","_pickWithRayOnDragPlane","attachedToElement","dragLength","getRotationMatrix","dragDistance","delta","forward","angle","acos","PI","pickResult","pickWithRay","dragPlanePosition","lookAt","computeWorldMatrix","detach","remove","AutoRotationBehavior","_zoomStopsAnimation","_idleRotationSpeed","_idleRotationWaitTime","_idleRotationSpinupTime","_isPointerDown","_lastFrameTime","_lastInteractionTime","_cameraRotationSpeed","_lastFrameRadius","flag","speed","time","_attachedCamera","_onPrePointerObservableObserver","onPrePointerObservable","pointerInfoPre","_onAfterCheckInputsObserver","onAfterCheckInputsObservable","now","dt","_applyUserInteraction","timeToRotation","alpha","_userIsZooming","inertialRadiusOffset","_shouldAnimationStopForInteraction","zoomHasHitLimit","_userIsMoving","inertialAlphaOffset","inertialBetaOffset","inertialPanningX","inertialPanningY","EasingFunction","_easingMode","EASINGMODE_EASEIN","setEasingMode","easingMode","n","getEasingMode","easeInCore","EASINGMODE_EASEOUT","EASINGMODE_EASEINOUT","BackEase","_super","CircleEase","apply","arguments","amplitude","call","pow","sin","ExponentialEase","BounceEase","bounces","bounciness","num9","num5","num4","num15","num65","log","num3","floor","num13","num8","num7","num6","num2","CubicEase","ElasticEase","oscillations","springiness","exp","exponent","PowerEase","power","QuadraticEase","QuarticEase","QuinticEase","SineEase","BezierCurveEase","x1","y1","x2","y2","BouncingBehavior","transitionDuration","lowerRadiusTransitionRange","upperRadiusTransitionRange","_autoTransitionRange","_radiusIsAnimating","_radiusBounceTransition","_animatables","_onMeshTargetChangedObserver","onMeshTargetChangedObservable","diagonal","getBoundingInfo","diagonalLength","_isRadiusAtLimit","lowerRadiusLimit","_applyBoundRadiusAnimation","upperRadiusLimit","radiusLimit","radiusDelta","EasingMode","_cachedWheelPrecision","wheelPrecision","stopAllAnimations","animatable","_clearAnimationLocks","stop","shift","FramingBehavior","_mode","FitFrustumSidesMode","_radiusScale","_positionScale","_defaultElevation","_elevationReturnTime","_elevationReturnWaitTime","_framingTime","autoCorrectCameraLimitsAndSensibility","_betaIsAnimating","mode","elevation","zoomOnMesh","_maintainCameraAboveGround","focusOnOriginXZ","boundingBox","zoomOnBoundingInfo","minimumWorld","maximumWorld","zoomOnMeshHierarchy","getHierarchyBoundingVectors","zoomOnMeshesHierarchy","boundingInfo","zoomTarget","bottom","zoomTargetY","radiusWorld","centerWorld","_vectorTransition","_calculateLowerRadiusFromModelBoundingSphere","minZ","IgnoreBoundsSizeMode","extend","panningSensibility","_radiusTransition","useInputToRestoreState","storeState","boxVectorGlobalDiagonal","frustumSlope","_getFrustumSlope","distanceForHorizontalFrustum","distanceForVerticalFrustum","timeSinceInteraction","defaultBeta","limitBeta","beta","_betaTransition","animatabe","aspectRatio","getAspectRatio","frustumSlopeY","tan","fov","frustumSlopeX","isUserIsMoving","ArcRotateCameraPointersInput","buttons","angularSensibilityX","angularSensibilityY","pinchPrecision","pinchDeltaPercentage","useNaturalPinchZoom","multiTouchPanning","multiTouchPanAndZoom","pinchInwards","_isPanClick","_twoFingerActivityCount","_isPinching","onTouch","point","offsetX","offsetY","_ctrlKey","onDoubleTap","restoreState","onMultiTouch","pointA","pointB","previousPinchSquaredDistance","pinchSquaredDistance","previousMultiTouchPanPosition","multiTouchPanPosition","moveDeltaX","moveDeltaY","previousPinchDistance","pinchDistance","pinchToPanMaxDistance","onButtonDown","button","onButtonUp","onLostFocus","BaseCameraPointersInput","element","getInputElement","_altKey","_metaKey","_shiftKey","_buttonsPressed","_pointerInput","p","s","isTouch","isInVRExclusivePointerMode","indexOf","srcElement","target","altKey","ctrlKey","metaKey","shiftKey","isPointerLock","movementX","mozMovementX","webkitMovementX","msMovementX","movementY","mozMovementY","webkitMovementY","msMovementY","setPointerCapture","clientX","clientY","preventDefault","focus","releasePointerCapture","_badOS","ed","distX","distY","_observer","_onLostFocus","onContextMenu","bind","hostWindow","getHostWindow","handler","ignored","inputElement","removeEventListener","getSimpleName","ArcRotateCameraKeyboardMoveInput","keysUp","keysDown","keysLeft","keysRight","keysReset","zoomingSensibility","useAltToZoom","angularSpeed","_onCanvasBlurObserver","_engine","onCanvasBlurObservable","_onKeyboardObserver","onKeyboardObservable","info","_ctrlPressed","_altPressed","keyCode","checkInputs","ArcRotateCameraMouseWheelInput","wheelDeltaPercentage","computeDeltaFromMouseWheelLegacyEvent","mouseWheelDelta","wheelDelta","_wheel","mouseWheelLegacyEvent","deltaY","detail","estimatedTargetRadius","targetInertia","inertia","ArcRotateCameraInputsManager","addMouseWheel","addPointers","addKeyboard","ArcRotateCamera","setActiveOnSceneIfNoneActive","lowerAlphaLimit","upperAlphaLimit","lowerBetaLimit","upperBetaLimit","panningDistanceLimit","panningOriginTarget","panningInertia","zoomOnFactor","targetScreenOffset","allowUpsideDown","_viewMatrix","panningAxis","checkCollisions","collisionRadius","_previousPosition","_collisionVelocity","_newPosition","_computationVector","_onCollisionPositionChange","collisionId","newPosition","collidedMesh","setPosition","onCollide","_position","cosa","cos","sina","cosb","sinb","_getTargetPosition","up","upVector","negate","_computeViewMatrix","addAtIndex","_collisionTriggered","_target","setTarget","_upVector","vec","_upToYMatrix","_YToUpMatrix","setMatUp","pointers","attached","keyboard","mousewheel","_bouncingBehavior","useBouncingBehavior","addBehavior","removeBehavior","_framingBehavior","useFramingBehavior","_autoRotationBehavior","useAutoRotationBehavior","_initCache","_cache","_updateCache","ignoreParentClass","_targetHost","pos","_targetBoundingCenter","lockedTargetPosition","_getLockedTargetPosition","_storedAlpha","_storedBeta","_storedRadius","_storedTarget","_storedTargetScreenOffset","_restoreStateValues","_isSynchronizedViewMatrix","useCtrlForPanning","panningMouseButton","attachElement","_reset","detachElement","_checkInputs","parent","_getWorldMatrixDeterminant","_localDirection","_transformedDirection","_cameraTransformMatrix","_checkLimits","rebuildAnglesAndRadius","previousAlpha","alphaCorrectionTurns","round","toBoundingCenter","allowSamePosition","newTarget","currentTarget","_getViewMatrix","collisionsEnabled","coordinator","collisionCoordinator","_collider","createCollider","_radius","getNewPosition","uniqueId","_currentTarget","zoomOn","doNotUpdateMaxZ","minMaxVector","focusOn","meshesOrMinMaxVectorAndDistance","meshesOrMinMaxVector","maxZ","createRigCamera","cameraIndex","alphaShift","cameraRigMode","_cameraRigParams","stereoHalfAngle","rigCam","isRigCamera","rigParent","_updateRigCameras","camLeft","_rigCameras","camRight","clear","Camera","orthoLeft","orthoRight","orthoBottom","orthoTop","PERSPECTIVE_CAMERA","isIntermediate","layerMask","fovMode","FOVMODE_VERTICAL_FIXED","RIG_MODE_NONE","customRenderTargets","outputRenderTarget","onViewMatrixChangedObservable","onProjectionMatrixChangedObservable","onRestoreStateObservable","_webvrViewMatrix","_skipRendering","_projectionMatrix","_postProcesses","_activeMeshes","_globalPosition","_computedViewMatrix","_doNotComputeProjectionMatrix","_transformMatrix","_refreshFrustumPlanes","_isCamera","_isLeftCamera","_isRightCamera","addCamera","_stateStored","_storedFov","getActiveMeshes","isActiveMesh","isReady","completeCheck","pp","renderWidth","renderHeight","_isSynchronized","_isSynchronizedProjectionMatrix","isSynchronizedWithParent","check","_rigPostProcess","_getFirstPostProcess","ppIndex","_cascadePostProcessesToRigCams","firstPostProcess","markTextureDirty","cam","rigPostProcess","getEffectName","concat","attachPostProcess","postProcess","insertAt","isReusable","prePassRenderer","markAsDirty","detachPostProcess","idx","_worldMatrix","force","updateCache","_currentRenderId","getRenderId","_childUpdateId","vrPreViewMatrix","freezeProjectionMatrix","unfreezeProjectionMatrix","_b","_c","_d","_e","_f","_g","_h","reverseDepth","useReverseDepthBuffer","halfWidth","halfHeight","getTransformationMatrix","_updateFrustumPlanes","_frustumPlanes","isInFrustum","checkRigCameras","rigCameras","forEach","isCompletelyInFrustum","getForwardRay","doNotRecurse","disposeMaterialAndTextures","stopAnimation","removeCamera","pop","getLeftTarget","getTarget","getRightTarget","setCameraRigMode","rigParams","interaxialDistance","rightCamera","RIG_MODE_STEREOSCOPIC_ANAGLYPH","_setStereoscopicAnaglyphRigMode","RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL","RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED","RIG_MODE_STEREOSCOPIC_OVERUNDER","RIG_MODE_STEREOSCOPIC_INTERLACED","_setStereoscopicRigMode","RIG_MODE_VR","_setVRRigMode","RIG_MODE_WEBVR","_setWebVRRigMode","_getVRProjectionMatrix","vrMetrics","aspectRatioFov","vrWorkMatrix","vrHMatrix","_updateCameraRotationMatrix","_updateWebVRCameraRotationMatrix","_getWebVRProjectionMatrix","_getWebVRViewMatrix","setCameraRigParameter","_setupInputs","parentId","id","serializeAnimationRanges","GetConstructorFromName","isStereoscopicSideBySide","getDirection","localAxis","getDirectionToRef","interaxial_distance","constructorFunc","_createDefaultParsedCamera","parsedCamera","construct","_waitingParentId","animationIndex","internalClass","autoAnimate","autoAnimateFrom","autoAnimateTo","autoAnimateLoop","autoAnimateSpeed","ORTHOGRAPHIC_CAMERA","FOVMODE_HORIZONTAL_FIXED","RIG_MODE_CUSTOM","ForceAttachControlToAlwaysPreventDefault","CameraInputTypes","CameraInputsManager","input","_addCheckInputs","inputToRemove","rebuildInputCheck","removeByType","inputType","fn","current","attachInput","disconnect","serializedCamera","res","inputsmgr","parsedInputs","parsedinput","TargetCamera","_tmpUpVector","_tmpTargetVector","cameraDirection","cameraRotation","ignoreParentScaling","updateUpVectorFromRotation","_tmpQuaternion","rotation","noRotationConstraint","invertRotation","inverseRotationSpeed","lockedTarget","_initialFocalDistance","_camMatrix","_cameraRotationMatrix","_referencePoint","_transformedReferencePoint","_defaultUp","_cachedRotationZ","_cachedQuaternionRotationZ","getFrontPosition","globalPosition","_storedPosition","_storedRotation","rotationQuaternion","_storedRotationQuaternion","_computeLocalCameraSpeed","getDeltaTime","getFps","atan","vDir","_decideIfNeedsToMove","_updatePosition","directionMultiplier","needToMove","needToRotate","toEulerAnglesToRef","limit","toRotationMatrix","_rotateUpVectorWithCameraRotationMatrix","parentWorldMatrix","_markSyncedWithParent","rigCamera","leftSign","rightSign","_getRigCamPositionAndTarget","halfSpace","_TargetFocalPoint","newFocalTarget","_TargetTransformMatrix","_RigCamTransformMatrix","IntersectionInfo","bu","faceId","subMeshId","PickingInfo","_pickingUnavailable","subMeshFaceId","pickedSprite","originMesh","getNormal","useWorldCoordinates","useVerticesNormals","isVerticesDataPresent","indices","getIndices","normals","getVerticesData","normal0","normal1","normal2","positions","vertex3","p1p2","p3p2","wm","nonUniformScaling","setTranslationFromFloats","transposeToRef","getTextureCoordinates","uvs","uv0","uv1","uv2","BoundingBox","worldMatrix","vectors","extendSize","extendSizeWorld","directions","vectorsWorld","reConstruct","minX","minY","maxX","maxY","_update","factor","tmpVectors","TmpVector3","diff","normalizeFromLength","newRadius","minWorld","maxWorld","isIdentity","setAll","minimizeInPlace","maximizeInPlace","frustumPlanes","IsInFrustum","IsCompletelyInFrustum","intersectsPoint","pointX","pointY","pointZ","IntersectsSphere","intersectsMinMax","myMin","myMax","myMinX","myMinY","myMinZ","myMaxX","myMaxY","myMaxZ","Intersects","box0","box1","minPoint","maxPoint","sphereCenter","sphereRadius","vector","boundingVectors","frustumPlane","dotCoordinate","canReturnFalse","BoundingSphere","tempRadiusVector","tempVector","isCenterInFrustum","squareDistance","sphere0","sphere1","radiusSum","_result0","_result1","computeBoxExtents","r","axisOverlap","BoundingInfo","_isLocked","boundingSphere","centerOn","strategy","_checkCollision","collider","_canDoCollision","precise","texture","faceIndex","level","buffer","gl","_gl","_dummyFramebuffer","dummy","createFramebuffer","bindFramebuffer","FRAMEBUFFER","framebufferTexture2D","COLOR_ATTACHMENT0","TEXTURE_CUBE_MAP_POSITIVE_X","_webGLTexture","TEXTURE_2D","readType","_getWebGLTextureType","UNSIGNED_BYTE","Uint8Array","Float32Array","FLOAT","readPixels","RGBA","_currentFramebuffer","size","fullOptions","generateMipMaps","generateDepthBuffer","generateStencilBuffer","samplingMode","format","_caps","textureFloatLinearFiltering","textureHalfFloatLinearFiltering","textureFloat","layers","filters","_getSamplingParameters","TEXTURE_2D_ARRAY","sizedFormat","_getRGBABufferInternalSizedFormat","internalFormat","_getInternalFormat","_bindTextureDirectly","is2DArray","texImage3D","texImage2D","texParameteri","TEXTURE_MAG_FILTER","mag","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","generateMipmap","currentFrameBuffer","framebuffer","_bindUnboundFramebuffer","_depthStencilBuffer","_setupFramebufferDepthAttachments","_framebuffer","baseWidth","baseHeight","depth","samples","_generateDepthBuffer","_generateStencilBuffer","_internalTexturesCache","isCube","_createDepthStencilCubeTexture","_createDepthStencilTexture","internalTexture","depthTextureExtension","internalOptions","bilinearFiltering","comparisonFunction","generateStencil","_setupDepthStencilTexture","UNSIGNED_INT_24_8","UNSIGNED_INT","DEPTH_STENCIL","DEPTH_COMPONENT","webGLVersion","DEPTH24_STENCIL8","DEPTH_COMPONENT24","TEXTURE_CUBE_MAP","face","ShaderCodeNode","children","isValid","preprocessors","process","line","processor","lineProcessor","isFragment","attributeProcessor","varyingProcessor","uniformProcessor","uniformBufferProcessor","test","lookForClosingBracketForUniformBuffer","endOfUniformBufferProcessor","child","additionalDefineKey","additionalDefineValue","ShaderCodeCursor","_lines","lineIndex","value_1","subLine","trim","ShaderCodeConditionNode","ShaderCodeTestNode","testExpression","isTrue","ShaderDefineExpression","postfixToInfix","postfix","stack","postfix_1","_OperatorPriority","v1","v2","infixToPostfix","infix","stackIdx","pushOperand","operand","_Stack","peek","charAt","token","substr","ShaderDefineIsDefinedOperator","define","not","condition","ShaderDefineOrOperator","leftOperand","rightOperand","ShaderDefineAndOperator","ShaderDefineArithmeticOperator","testValue","parseInt","regexSE","regexSERevert","ShaderProcessor","Process","sourceCode","callback","_ProcessIncludes","codeWithIncludes","migratedCode","_ProcessShaderConversion","_ProcessPrecision","shouldUseHighPrecisionShader","_ExtractOperation","expression","match","exec","operator","indexOperator","operators_1","substring","_BuildSubExpression","_BuildExpression","start","command","_MoveCursorWithinIf","cursor","rootNode","ifNode","currentLine","_MoveCursor","first5","toLowerCase","elseNode","elifNode","canRead","matches","newRootNode","newNode","_EvaluatePreProcessors","lines","_PreparePreProcessors","defines_1","defines","version","platformName","preparedSourceCode","preProcessor","postProcessor","regex","returnValue","String","keepProcessing","includeFile","supportsUniformBuffers","includesShadersStore","includeShaderUrl","shadersRepository","_FileToolsLoadFile","fileContent","includeContent","splits","RegExp","dest","indexString","indexSplits","minIndex","maxIndex","sourceIncludeContent","indexParameters","str","p1","onSuccess","onProgress","offlineProvider","useArrayBuffer","onError","Constants","ALPHA_DISABLE","ALPHA_ADD","ALPHA_COMBINE","ALPHA_SUBTRACT","ALPHA_MULTIPLY","ALPHA_MAXIMIZED","ALPHA_ONEONE","ALPHA_PREMULTIPLIED","ALPHA_PREMULTIPLIED_PORTERDUFF","ALPHA_INTERPOLATE","ALPHA_SCREENMODE","ALPHA_ONEONE_ONEONE","ALPHA_ALPHATOCOLOR","ALPHA_REVERSEONEMINUS","ALPHA_SRC_DSTONEMINUSSRCALPHA","ALPHA_ONEONE_ONEZERO","ALPHA_EXCLUSION","ALPHA_EQUATION_ADD","ALPHA_EQUATION_SUBSTRACT","ALPHA_EQUATION_REVERSE_SUBTRACT","ALPHA_EQUATION_MAX","ALPHA_EQUATION_MIN","ALPHA_EQUATION_DARKEN","DELAYLOADSTATE_NONE","DELAYLOADSTATE_LOADED","DELAYLOADSTATE_LOADING","DELAYLOADSTATE_NOTLOADED","NEVER","ALWAYS","LESS","EQUAL","LEQUAL","GREATER","GEQUAL","NOTEQUAL","KEEP","REPLACE","INCR","DECR","INVERT","INCR_WRAP","DECR_WRAP","TEXTURE_CLAMP_ADDRESSMODE","TEXTURE_WRAP_ADDRESSMODE","TEXTURE_MIRROR_ADDRESSMODE","TEXTUREFORMAT_ALPHA","TEXTUREFORMAT_LUMINANCE","TEXTUREFORMAT_LUMINANCE_ALPHA","TEXTUREFORMAT_RGB","TEXTUREFORMAT_RGBA","TEXTUREFORMAT_RED","TEXTUREFORMAT_R","TEXTUREFORMAT_RG","TEXTUREFORMAT_RED_INTEGER","TEXTUREFORMAT_R_INTEGER","TEXTUREFORMAT_RG_INTEGER","TEXTUREFORMAT_RGB_INTEGER","TEXTUREFORMAT_RGBA_INTEGER","TEXTURETYPE_UNSIGNED_BYTE","TEXTURETYPE_UNSIGNED_INT","TEXTURETYPE_FLOAT","TEXTURETYPE_HALF_FLOAT","TEXTURETYPE_BYTE","TEXTURETYPE_SHORT","TEXTURETYPE_UNSIGNED_SHORT","TEXTURETYPE_INT","TEXTURETYPE_UNSIGNED_INTEGER","TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4","TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1","TEXTURETYPE_UNSIGNED_SHORT_5_6_5","TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV","TEXTURETYPE_UNSIGNED_INT_24_8","TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV","TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV","TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV","TEXTURE_NEAREST_SAMPLINGMODE","TEXTURE_NEAREST_NEAREST","TEXTURE_BILINEAR_SAMPLINGMODE","TEXTURE_LINEAR_LINEAR","TEXTURE_TRILINEAR_SAMPLINGMODE","TEXTURE_LINEAR_LINEAR_MIPLINEAR","TEXTURE_NEAREST_NEAREST_MIPNEAREST","TEXTURE_NEAREST_LINEAR_MIPNEAREST","TEXTURE_NEAREST_LINEAR_MIPLINEAR","TEXTURE_NEAREST_LINEAR","TEXTURE_NEAREST_NEAREST_MIPLINEAR","TEXTURE_LINEAR_NEAREST_MIPNEAREST","TEXTURE_LINEAR_NEAREST_MIPLINEAR","TEXTURE_LINEAR_LINEAR_MIPNEAREST","TEXTURE_LINEAR_NEAREST","TEXTURE_EXPLICIT_MODE","TEXTURE_SPHERICAL_MODE","TEXTURE_PLANAR_MODE","TEXTURE_CUBIC_MODE","TEXTURE_PROJECTION_MODE","TEXTURE_SKYBOX_MODE","TEXTURE_INVCUBIC_MODE","TEXTURE_EQUIRECTANGULAR_MODE","TEXTURE_FIXED_EQUIRECTANGULAR_MODE","TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE","TEXTURE_FILTERING_QUALITY_OFFLINE","TEXTURE_FILTERING_QUALITY_HIGH","TEXTURE_FILTERING_QUALITY_MEDIUM","TEXTURE_FILTERING_QUALITY_LOW","SCALEMODE_FLOOR","SCALEMODE_NEAREST","SCALEMODE_CEILING","MATERIAL_TextureDirtyFlag","MATERIAL_LightDirtyFlag","MATERIAL_FresnelDirtyFlag","MATERIAL_AttributesDirtyFlag","MATERIAL_MiscDirtyFlag","MATERIAL_PrePassDirtyFlag","MATERIAL_AllDirtyFlag","MATERIAL_TriangleFillMode","MATERIAL_WireFrameFillMode","MATERIAL_PointFillMode","MATERIAL_PointListDrawMode","MATERIAL_LineListDrawMode","MATERIAL_LineLoopDrawMode","MATERIAL_LineStripDrawMode","MATERIAL_TriangleStripDrawMode","MATERIAL_TriangleFanDrawMode","MATERIAL_ClockWiseSideOrientation","MATERIAL_CounterClockWiseSideOrientation","ACTION_NothingTrigger","ACTION_OnPickTrigger","ACTION_OnLeftPickTrigger","ACTION_OnRightPickTrigger","ACTION_OnCenterPickTrigger","ACTION_OnPickDownTrigger","ACTION_OnDoublePickTrigger","ACTION_OnPickUpTrigger","ACTION_OnPickOutTrigger","ACTION_OnLongPressTrigger","ACTION_OnPointerOverTrigger","ACTION_OnPointerOutTrigger","ACTION_OnEveryFrameTrigger","ACTION_OnIntersectionEnterTrigger","ACTION_OnIntersectionExitTrigger","ACTION_OnKeyDownTrigger","ACTION_OnKeyUpTrigger","PARTICLES_BILLBOARDMODE_Y","PARTICLES_BILLBOARDMODE_ALL","PARTICLES_BILLBOARDMODE_STRETCHED","MESHES_CULLINGSTRATEGY_STANDARD","MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY","MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION","MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY","SCENELOADER_NO_LOGGING","SCENELOADER_MINIMAL_LOGGING","SCENELOADER_SUMMARY_LOGGING","SCENELOADER_DETAILED_LOGGING","PREPASS_IRRADIANCE_TEXTURE_TYPE","PREPASS_POSITION_TEXTURE_TYPE","PREPASS_VELOCITY_TEXTURE_TYPE","PREPASS_REFLECTIVITY_TEXTURE_TYPE","PREPASS_COLOR_TEXTURE_TYPE","PREPASS_DEPTHNORMAL_TEXTURE_TYPE","PREPASS_ALBEDO_TEXTURE_TYPE","PerformanceMonitor","frameSampleSize","_enabled","_rollingFrameTime","RollingAverage","sampleFrame","timeMs","_lastFrameTimeMs","average","variance","history","isSaturated","enable","disable","reset","_samples","bottomValue","_pos","_sampleCount","_m2","i0","_wrapPosition","g","_alphaState","setAlphaBlendConstants","noDepthWriteChange","_alphaMode","alphaBlend","setAlphaBlendFunctionParameters","ONE","ONE_MINUS_SRC_ALPHA","SRC_ALPHA","ZERO","ONE_MINUS_SRC_COLOR","DST_COLOR","CONSTANT_COLOR","ONE_MINUS_CONSTANT_COLOR","CONSTANT_ALPHA","ONE_MINUS_CONSTANT_ALPHA","DST_ALPHA","ONE_MINUS_DST_COLOR","ONE_MINUS_DST_ALPHA","depthCullingState","depthMask","equation","_alphaEquation","setAlphaEquationParameters","FUNC_ADD","FUNC_SUBTRACT","FUNC_REVERSE_SUBTRACT","MAX","MIN","indexBuffer","arrayBuffer","_currentBoundBuffer","ELEMENT_ARRAY_BUFFER","bindIndexBuffer","Uint16Array","Uint32Array","is32Bits","bufferData","DYNAMIC_DRAW","_resetIndexBufferBinding","vertexBuffer","byteOffset","byteLength","bindArrayBuffer","dataLength","bufferSubData","ARRAY_BUFFER","subarray","ArrayBuffer","_resetVertexBufferBinding","Engine","canvasOrContext","antialias","adaptToDeviceRatio","enableOfflineSupport","disableManifestCheck","scenes","onNewSceneAddedObservable","postProcesses","onResizeObservable","onCanvasFocusObservable","onCanvasPointerOutObservable","onBeginFrameObservable","customAnimationFrameRequester","onEndFrameObservable","onBeforeShaderCompilationObservable","onAfterShaderCompilationObservable","_deterministicLockstep","_lockstepMaxSteps","_timeStep","_fps","_deltaTime","_drawCalls","canvasTabIndex","disablePerformanceMonitorInBackground","_performanceMonitor","Instances","_creationOptions","getContext","canvas_1","_onCanvasFocus","_onCanvasBlur","_onBlur","_windowIsBackground","_onFocus","_onCanvasPointerOut","ev","anyDoc_1","document","_onFullscreenChange","fullscreen","isFullscreen","mozFullScreen","webkitIsFullScreen","msIsFullScreen","_pointerLockRequested","_RequestPointerlock","_onPointerLockChange","mozPointerLockElement","webkitPointerLockElement","msPointerLockElement","pointerLockElement","audioEngine","AudioEngineFactory","getRenderingCanvas","_connectVREvents","OfflineProviderFactory","doNotHandleTouchAction","_disableTouchAction","deterministicLockstep","lockstepMaxSteps","timeStep","_prepareVRComponent","autoEnableWebVR","initWebVR","MarkAllMaterialsAsDirty","engineIndex","sceneIndex","markAllMaterialsAsDirty","DefaultLoadingScreenFactory","canvas","_RescalePostProcessFactory","_renderingCanvas","viewportOwner","useScreen","getScreenAspectRatio","getRenderingCanvasClientRect","getBoundingClientRect","getInputElementClientRect","isDeterministicLockStep","getLockstepMaxSteps","getTimeStep","generateMipMapsForCubemap","unbind","setState","culling","zOffset","reverseSide","_depthCullingState","cull","cullFace","cullBackFaces","BACK","FRONT","setZOffset","frontFace","CW","CCW","getZOffset","setDepthBuffer","depthTest","getDepthWrite","setDepthWrite","getStencilBuffer","_stencilState","stencilTest","setStencilBuffer","getStencilMask","stencilMask","setStencilMask","mask","getStencilFunction","stencilFunc","getStencilFunctionReference","stencilFuncRef","getStencilFunctionMask","stencilFuncMask","setStencilFunction","setStencilFunctionReference","reference","setStencilFunctionMask","getStencilOperationFail","stencilOpStencilFail","getStencilOperationDepthFail","stencilOpDepthFail","getStencilOperationPass","stencilOpStencilDepthPass","setStencilOperationFail","operation","setStencilOperationDepthFail","setStencilOperationPass","setDitheringState","DITHER","setRasterizerState","RASTERIZER_DISCARD","getDepthFunction","depthFunc","setDepthFunction","setDepthFunctionToGreater","setDepthFunctionToGreaterOrEqual","setDepthFunctionToLess","setDepthFunctionToLessOrEqual","cacheStencilState","_cachedStencilBuffer","_cachedStencilFunction","_cachedStencilMask","_cachedStencilOperationPass","_cachedStencilOperationFail","_cachedStencilOperationDepthFail","_cachedStencilReference","restoreStencilState","setDirectViewport","currentViewport","_cachedViewport","_viewport","scissorClear","clearColor","enableScissor","disableScissor","SCISSOR_TEST","scissor","_reportDrawCall","addCount","_submitVRFrame","disableVR","isVRPresenting","_requestVRFrame","_loadFileAsync","_loadFile","exception","getVertexShaderSource","program","shaders","getAttachedShaders","getShaderSource","getFragmentShaderSource","setDepthStencilTexture","channel","uniform","_boundUniforms","depthStencilTexture","_setTexture","setTextureFromPostProcess","_bindTexture","_textures","_currentRenderTextureInd","setTextureFromPostProcessOutput","_outputTexture","_rebuildBuffers","resetCachedMaterial","_rebuildGeometries","_rebuildTextures","_renderFrame","_activeRenderLoops","renderFunction","_renderLoop","_contextWasLost","shouldRender","renderEvenInBackground","beginFrame","_renderViews","requestID","_queueNewFrame","_boundRenderFunction","_frameHandler","_renderingQueueLaunched","switchFullscreen","requestPointerLock","exitFullscreen","enterFullscreen","_RequestFullscreen","_ExitFullscreen","enterPointerlock","exitPointerlock","_ExitPointerlock","_measureFps","resize","setSize","camIndex","cameras","hasObservers","_deletePipelineContext","pipelineContext","webGLPipelineContext","transformFeedback","deleteTransformFeedback","createShaderProgram","vertexCode","fragmentCode","context","transformFeedbackVaryings","_createShaderProgram","vertexShader","fragmentShader","shaderProgram","createProgram","attachShader","createTransformFeedback","bindTransformFeedback","setTranformFeedbackVaryings","linkProgram","isParallelCompiled","_finalizePipelineContext","_releaseTexture","_rescaleTexture","onComplete","LINEAR","rtt","createRenderTargetTexture","_rescalePostProcess","getEffect","executeWhenCompiled","onApply","effect","hostingScene","postProcessManager","directRender","copyTexImage2D","unBindFramebuffer","averageFPS","instantaneousFrameTime","_uploadImageToTexture","image","lod","textureType","bindTarget","_unpackFlipY","invertY","updateRenderTargetTextureSampleCount","getCaps","maxMSAASamples","deleteRenderbuffer","_MSAAFramebuffer","deleteFramebuffer","_MSAARenderBuffer","renderbufferStorageMultisample","colorRenderbuffer","createRenderbuffer","bindRenderbuffer","RENDERBUFFER","_getRGBAMultiSampleBufferFormat","framebufferRenderbuffer","updateTextureComparisonFunction","TEXTURE_COMPARE_FUNC","TEXTURE_COMPARE_MODE","NONE","COMPARE_REF_TO_TEXTURE","_comparisonFunction","createInstancesBuffer","capacity","createBuffer","deleteInstancesBuffer","deleteBuffer","_clientWaitAsync","sync","flags","interval_ms","clientWaitSync","WAIT_FAILED","TIMEOUT_EXPIRED","setTimeout","_readPixelsAsync","h","outputBuffer","_webGLVersion","buf","bindBuffer","PIXEL_PACK_BUFFER","STREAM_READ","fenceSync","SYNC_GPU_COMMANDS_COMPLETE","flush","then","deleteSync","getBufferSubData","hideLoadingUI","window","setAttribute","style","touchAction","msTouchAction","displayLoadingUI","loadingScreen","_loadingScreen","text","loadingUIText","color","loadingUIBackgroundColor","msRequestPointerLock","mozRequestPointerLock","webkitRequestPointerLock","anyDoc","exitPointerLock","msExitPointerLock","mozExitPointerLock","webkitExitPointerLock","requestFunction","requestFullscreen","msRequestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","mozCancelFullScreen","webkitCancelFullScreen","msCancelFullScreen","EngineStore","_LastCreatedScene","UseFallbackTexture","FallbackTexture","PerformanceConfigurator","SetMatrixPrecision","use64bits","MatrixTrackPrecisionChange","MatrixUse64Bits","MatrixTrackedMatrices","_m","MatrixCurrentType","DepthCullingState","_isDepthTestDirty","_isDepthMaskDirty","_isDepthFuncDirty","_isCullFaceDirty","_isCullDirty","_isZOffsetDirty","_isFrontFaceDirty","_zOffset","_cullFace","_cull","_depthFunc","_depthMask","_depthTest","_frontFace","isDirty","CULL_FACE","DEPTH_TEST","POLYGON_OFFSET_FILL","polygonOffset","StencilState","_isStencilTestDirty","_isStencilMaskDirty","_isStencilFuncDirty","_isStencilOpDirty","_stencilFunc","_stencilFuncRef","_stencilFuncMask","_stencilOpStencilFail","_stencilOpDepthFail","_stencilOpStencilDepthPass","_stencilMask","_stencilTest","STENCIL_TEST","stencilOp","AlphaState","_isAlphaBlendDirty","_isBlendFunctionParametersDirty","_isBlendEquationParametersDirty","_isBlendConstantsDirty","_alphaBlend","_blendFunctionParameters","_blendEquationParameters","_blendConstants","value0","value1","value2","value3","rgb","BLEND","blendFuncSeparate","blendEquationSeparate","blendColor","WebGLShaderProcessor","code","drawBuffersExtension","WebGL2ShaderProcessor","attribute","varying","hasDrawBuffersExtension","search","WebGLPipelineContext","vertexCompilationError","fragmentCompilationError","programLinkError","programValidationError","_isRenderingStateCompiled","_handlesSpectorRebuildCallback","onCompiled","_getVertexShaderCode","_getShaderSource","_getFragmentShaderCode","BufferPointer","ThinEngine","forcePOTTextures","preventCacheWipeBetweenFrames","validateShaderPrograms","disableUniformBuffers","_uniformBuffers","_highPrecisionShadersAllowed","_badDesktopOS","onContextLostObservable","onContextRestoredObservable","_doNotHandleContextLost","disableVertexArrayObjects","_colorWrite","_colorWriteChanged","_activeChannel","_currentTextureChannel","_boundTexturesCache","_compiledEffects","_vertexAttribArraysEnabled","_uintIndicesCurrentlySet","_currentBufferPointers","_currentInstanceLocations","_currentInstanceBuffers","_vaoRecordInProgress","_mustWipeVertexAttributes","_nextFreeTextureSlots","_maxSimultaneousTextures","_activeRequests","_transformTextureUrl","premultipliedAlpha","onBeforeTextureInitObservable","_viewportCached","_unpackFlipYCached","enableUnpackFlipYCached","_getDepthStencilBuffer","msInternalFormat","attachment","depthStencilBuffer","renderbufferStorage","useHighPrecisionMatrix","preserveDrawingBuffer","stencil","xrCompatible","doNotHandleContextLost","navigator","userAgent","ua","ExceptionList","targets","capture","captureConstraint","constraint","targets_1","_onContextLost","_onContextRestored","_initGLContext","_rebuildEffects","_rebuildInternalTextures","wipeCaches","powerPreference","disableWebGL2Support","deleteQuery","attributes","getContextAttributes","pixelStorei","UNPACK_COLORSPACE_CONVERSION_WEBGL","useHighPrecisionFloats","devicePixelRatio","limitDeviceRatio","_hardwareScalingLevel","_isStencilEnable","maxVertexAttribs","_shaderProcessor","console","Version","description","parallelShaderCompile","highPrecisionShaderSupported","dimensions","_framebufferDimensionsObject","_emptyTexture","createRawTexture","_emptyTexture3D","createRawTexture3D","_emptyTexture2DArray","createRawTexture2DArray","_emptyCubeTexture","faceData","cubeData","createRawCubeTexture","currentState_1","_rebuild","_prepareEffect","areAllEffectsReady","maxTexturesImageUnits","getParameter","MAX_TEXTURE_IMAGE_UNITS","maxCombinedTexturesImageUnits","MAX_COMBINED_TEXTURE_IMAGE_UNITS","maxVertexTextureImageUnits","MAX_VERTEX_TEXTURE_IMAGE_UNITS","maxTextureSize","MAX_TEXTURE_SIZE","maxSamples","MAX_SAMPLES","maxCubemapTextureSize","MAX_CUBE_MAP_TEXTURE_SIZE","maxRenderTextureSize","MAX_RENDERBUFFER_SIZE","MAX_VERTEX_ATTRIBS","maxVaryingVectors","MAX_VARYING_VECTORS","maxFragmentUniformVectors","MAX_FRAGMENT_UNIFORM_VECTORS","maxVertexUniformVectors","MAX_VERTEX_UNIFORM_VECTORS","getExtension","standardDerivatives","maxAnisotropy","astc","bptc","s3tc","pvrtc","etc1","etc2","textureAnisotropicFilterExtension","uintIndices","fragmentDepthSupported","timerQuery","canUseTimestampForTimerQuery","colorBufferFloat","textureHalfFloat","textureHalfFloatRender","textureFloatRender","vertexArrayObject","instancedArrays","textureLOD","blendMinMax","multiview","oculusMultiview","_glVersion","VERSION","rendererInfo","_glRenderer","UNMASKED_RENDERER_WEBGL","_glVendor","UNMASKED_VENDOR_WEBGL","HALF_FLOAT_OES","RGBA16F","RGBA32F","getQuery","getQueryEXT","TIMESTAMP_EXT","QUERY_COUNTER_BITS_EXT","MAX_TEXTURE_MAX_ANISOTROPY_EXT","_canRenderToFloatFramebuffer","_canRenderToHalfFloatFramebuffer","drawBuffers","drawBuffersWEBGL","DRAW_FRAMEBUFFER","UNSIGNED_INT_24_8_WEBGL","vertexArrayObjectExtension","createVertexArray","createVertexArrayOES","bindVertexArray","bindVertexArrayOES","deleteVertexArray","deleteVertexArrayOES","instanceExtension","drawArraysInstanced","drawArraysInstancedANGLE","drawElementsInstanced","drawElementsInstancedANGLE","vertexAttribDivisor","vertexAttribDivisorANGLE","getShaderPrecisionFormat","vertex_highp","VERTEX_SHADER","HIGH_FLOAT","fragment_highp","FRAGMENT_SHADER","precision","blendMinMaxExtension","MAX_EXT","MIN_EXT","slot","_prepareWorkingCanvas","_workingCanvas","_workingContext","resetTextureCache","hasOwnProperty","getGlInfo","vendor","renderer","setHardwareScalingLevel","getLoadedTexturesCache","stopRenderLoop","ownerDocument","defaultView","_currentRenderTarget","framebufferWidth","drawingBufferWidth","framebufferHeight","drawingBufferHeight","bindedRenderFunction","requester","QueueNewFrame","runRenderLoop","backBuffer","applyStates","COLOR_BUFFER_BIT","clearDepth","DEPTH_BUFFER_BIT","clearStencil","STENCIL_BUFFER_BIT","setViewport","requiredWidth","requiredHeight","flushFramebuffer","clientWidth","innerWidth","clientHeight","innerHeight","forceFullscreenViewport","lodLevel","layer","framebufferTextureLayer","_depthStencilTexture","DEPTH_STENCIL_ATTACHMENT","DEPTH_ATTACHMENT","disableGenerateMipMaps","onBeforeUnbind","_textureArray","unBindMultiColorAttachmentFramebuffer","READ_FRAMEBUFFER","blitFramebuffer","NEAREST","restoreDefaultFramebuffer","_cachedVertexBuffers","createVertexBuffer","_createVertexBuffer","STATIC_DRAW","usage","vbo","dataBuffer","references","createDynamicVertexBuffer","_cachedIndexBuffer","createIndexBuffer","updatable","_normalizeIndexData","BYTES_PER_ELEMENT","_unbindVertexArrayObject","bindUniformBlock","blockName","uniformLocation","getUniformBlockIndex","uniformBlockBinding","underlyingResource","updateArrayBuffer","_vertexAttribPointer","indx","normalized","stride","pointer","changed","active","vertexAttribPointer","_bindIndexBufferWithCache","_bindVertexBuffersAttributes","vertexBuffers","getAttributesNames","unbindAllAttributes","order","getAttributeLocation","enableVertexAttribArray","getBuffer","getSize","byteStride","getIsInstanced","getInstanceDivisor","recordVertexArrayObject","vao","bindVertexArrayObject","_cachedVertexArrayObject","bindBuffersDirectly","vertexDeclaration","vertexStrideSize","_cachedEffectForVertexBuffers","attributesCount","getAttributesCount","bindBuffers","unbindInstanceAttributes","boundBuffer","ul","instancesBuffer","offsetLocation","releaseVertexArrayObject","_releaseBuffer","_deleteBuffer","updateAndBindInstancesBuffer","offsetLocations","bindInstancesBuffer","attributesInfo","computeStride","ai","attributeSize","_currentEffect","getAttributeLocationByName","attributeName","attributeType","divisor","disableInstanceAttributeByName","attributeLocation","disableInstanceAttribute","shouldClean","disableAttributeByIndex","disableVertexAttribArray","draw","useTriangles","indexStart","indexCount","instancesCount","drawElementsType","drawPointClouds","verticesStart","verticesCount","drawArraysType","drawUnIndexed","fillMode","drawMode","_drawMode","indexFormat","UNSIGNED_SHORT","mult","drawElements","drawArrays","TRIANGLES","POINTS","LINES","LINE_LOOP","LINE_STRIP","TRIANGLE_STRIP","TRIANGLE_FAN","_releaseEffect","_key","getPipelineContext","__SPECTOR_rebuildProgram","deleteProgram","createEffect","baseName","attributesNamesOrOptions","uniformsNamesOrEngine","samplers","fallbacks","vertexElement","vertex","vertexToken","vertexSource","fragmentElement","fragment","fragmentToken","fragmentSource","compiledEffect","_ConcatenateShader","shaderVersion","_compileShader","_compileRawShader","shader","createShader","shaderSource","compileShader","createRawShaderProgram","createPipelineContext","getProgramParameter","LINK_STATUS","error","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","getProgramInfoLog","validateProgram","VALIDATE_STATUS","deleteShader","_preparePipelineContext","vertexSourceCode","fragmentSourceCode","createAsRaw","rebuildRebind","webGLRenderingState","COMPLETION_STATUS_KHR","_executeWhenRenderingStateIsCompiled","action","oldHandler","getUniforms","uniformsNames","getUniformLocation","getAttributes","attributesNames","getAttribLocation","enableEffect","bindSamplers","onBind","_onBindObservable","setInt","uniform1i","setIntArray","array","uniform1iv","setIntArray2","uniform2iv","setIntArray3","uniform3iv","setIntArray4","uniform4iv","setArray","uniform1fv","setArray2","uniform2fv","setArray3","uniform3fv","setArray4","uniform4fv","setMatrices","matrices","uniformMatrix4fv","setMatrix3x3","uniformMatrix3fv","setMatrix2x2","uniformMatrix2fv","setFloat","uniform1f","setFloat2","uniform2f","setFloat3","uniform3f","setFloat4","uniform4f","colorMask","setColorWrite","getColorWrite","clearInternalTexturesCache","bruteForce","_currentProgram","UNPACK_PREMULTIPLY_ALPHA_WEBGL","magFilter","minFilter","LINEAR_MIPMAP_NEAREST","LINEAR_MIPMAP_LINEAR","NEAREST_MIPMAP_LINEAR","NEAREST_MIPMAP_NEAREST","_createTexture","createTexture","noMipmap","onLoad","fallback","forcedExtension","mimeType","loaderOptions","fromData","fromBlob","isBase64","originalUrl","_originalUrl","lastDot","lastIndexOf","extension","loader","_TextureLoaders","availableLoader","canLoad","_addPendingData","_buffer","onLoadObserver","onLoadedObservable","onInternalError","message","_removePendingData","callback_1","loadData","loadMipmap","isCompressed","done","loadFailed","_prepareWebGLTexture","isView","responseURL","onload_1","img","potWidth","potHeight","continuationCallback","isPot","RGB","_supportsHardwareTextureRescaling","drawImage","source_1","decoding","close","_FileToolsLoadImage","Blob","compression","UNPACK_FLIP_Y_WEBGL","_getUnpackAlignement","UNPACK_ALIGNMENT","_getTextureTarget","is3D","TEXTURE_3D","isMultiview","updateTextureSamplingMode","_setTextureParameterInteger","updateTextureWrappingMode","wrapU","wrapV","wrapR","_getTextureWrapMode","_cachedWrapU","_cachedWrapV","TEXTURE_WRAP_R","_cachedWrapR","samplingParameters","_uploadCompressedDataToTextureDirectly","compressedTexImage2D","_uploadDataToTextureDirectly","imageData","babylonInternalFormat","useTextureWidthAndHeight","lodMaxWidth","LOG2E","lodMaxHeight","updateTextureData","xOffset","yOffset","texSubImage2D","_uploadArrayBufferViewToTexture","_prepareWebGLTextureContinuation","processFunction","needPOTTextures","GetExponentOfTwo","depthFormat","DEPTH_COMPONENT16","DEPTH_COMPONENT32F","STENCIL_INDEX8","STENCIL_ATTACHMENT","_releaseFramebufferObjects","_deleteTexture","unbindAllTextures","_lodTextureHigh","_lodTextureMid","_lodTextureLow","_irradianceTexture","deleteTexture","_setProgram","useProgram","getSamplers","getUniform","_activateCurrentTexture","activeTexture","TEXTURE0","forTextureDataUpdate","wasPreviouslyBound","isTextureForRendering","_associatedChannel","bindTexture","_colorTextureArray","_bindSamplerUniformToChannel","setTexture","sourceSlot","_currentState","REPEAT","MIRRORED_REPEAT","isPartOfTextureArray","video","delayLoadState","delayLoad","getInternalTexture","emptyCubeTexture","emptyTexture3D","emptyTexture2DArray","emptyTexture","needToBind","_cachedCoordinatesMode","coordinatesMode","textureWrapMode","_setAnisotropicLevel","anisotropicFilteringLevel","setTextureArray","textures","_textureUnits","Int32Array","anisotropicFilterExtension","_cachedAnisotropicFilteringLevel","_setTextureParameterFloat","TEXTURE_MAX_ANISOTROPY_EXT","parameter","texParameterf","releaseEffects","abort","attachContextLostEvent","attachContextRestoredEvent","getError","_canRenderToFramebuffer","NO_ERROR","successful","fb","checkFramebufferStatus","FRAMEBUFFER_COMPLETE","readFormat","UNSIGNED_SHORT_4_4_4_4","UNSIGNED_SHORT_5_5_5_1","UNSIGNED_SHORT_5_6_5","BYTE","SHORT","INT","HALF_FLOAT","UNSIGNED_INT_2_10_10_10_REV","UNSIGNED_INT_10F_11F_11F_REV","UNSIGNED_INT_5_9_9_9_REV","FLOAT_32_UNSIGNED_INT_24_8_REV","ALPHA","LUMINANCE","LUMINANCE_ALPHA","RED","RG","RED_INTEGER","RG_INTEGER","RGB_INTEGER","RGBA_INTEGER","R8_SNORM","RG8_SNORM","RGB8_SNORM","R8I","RG8I","RGB8I","RGBA8I","RGBA8_SNORM","R8","RG8","RGB8","RGBA8","R8UI","RG8UI","RGB8UI","RGBA8UI","R16I","RG16I","RGB16I","RGBA16I","R16UI","RG16UI","RGB16UI","RGBA16UI","R32I","RG32I","RGB32I","RGBA32I","R32UI","RG32UI","RGB32UI","RGBA32UI","R32F","RG32F","RGB32F","R16F","RG16F","RGB16F","RGB565","R11F_G11F_B10F","RGB9_E5","RGBA4","RGB5_A1","RGB10_A2","RGB10_A2UI","onCompleteObservable","hasAlpha","numChannels","isSupported","_HasMajorPerformanceCaveat","_IsSupported","tempcanvas","WebGLRenderingContext","failIfMajorPerformanceCaveat","CeilingPOT","FloorPOT","NearestPOT","f","pot","func","requestPostAnimationFrame","requestAnimationFrame","msRequestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","oRequestAnimationFrame","getHostDocument","CollisionsEpsilon","ClipboardEventTypes","COPY","CUT","PASTE","ClipboardInfo","GetTypeFromCharacter","KeyboardEventTypes","KEYDOWN","KEYUP","KeyboardInfo","KeyboardInfoPre","skipOnPointerObservable","PointerEventTypes","POINTERDOWN","POINTERUP","POINTERMOVE","POINTERWHEEL","POINTERPICK","POINTERTAP","POINTERDOUBLETAP","PointerInfoBase","PointerInfoPre","localX","localY","localPosition","PointerInfo","HemisphericLight","groundColor","_buildUniformLayout","_uniformBuffer","addUniform","create","setDirectionToTarget","getShadowGenerator","transferToEffect","lightIndex","normalizeDirection","updateFloat4","updateColor3","intensity","transferToNodeMaterialEffect","lightDataUniformName","getTypeID","prepareLightSpecificDefines","Light","diffuse","specular","falloffType","FALLOFF_DEFAULT","_range","_inverseSquaredRange","_photometricScale","_intensityMode","INTENSITYMODE_AUTOMATIC","renderPriority","_shadowEnabled","_excludeWithLayerMask","_includeOnlyWithLayerMask","_lightmapMode","_excludedMeshesIds","_includedOnlyMeshesIds","_isLight","addLight","includedOnlyMeshes","excludedMeshes","_resyncMeshes","_computePhotometricScale","_markMeshesAsLightDirty","_includedOnlyMeshes","_hookArrayForIncludedOnly","_excludedMeshes","_hookArrayForExcluded","transferTexturesToEffect","_bindLight","useSpecular","rebuildInParallel","iAsString","needUpdate","_alreadyBound","bindToEffect","_renderId","useUbo","scaledIntensity","getScaledIntensity","updateColor4","shadowsEnabled","shadowEnabled","shadowGenerator","bindShadowLight","_syncParentEnabledState","isDisposed","setEnabled","_shadowGenerator","canAffectMesh","includeOnlyWithLayerMask","excludeWithLayerMask","CompareLightsPriority","_removeLightSource","removeLight","newParent","clonedLight","excludedMeshesIds","includedOnlyMeshesIds","parsedLight","light","lightmapMode","oldPush","items","items_1","item","_resyncLightSource","oldSplice","deleteCount","deleted","deleted_1","array_1","lightSources","_markSubMeshesAsLightDirty","_getPhotometricScale","photometricScale","lightTypeID","photometricMode","intensityMode","LIGHTTYPEID_DIRECTIONALLIGHT","INTENSITYMODE_ILLUMINANCE","INTENSITYMODE_LUMINOUSINTENSITY","LIGHTTYPEID_POINTLIGHT","LIGHTTYPEID_SPOTLIGHT","INTENSITYMODE_LUMINOUSPOWER","INTENSITYMODE_LUMINANCE","apexAngleRadians","LIGHTTYPEID_HEMISPHERICLIGHT","_reorderLightsInScene","_renderPriority","requireLightSorting","sortLightsByPriority","FALLOFF_PHYSICAL","FALLOFF_GLTF","FALLOFF_STANDARD","LIGHTMAP_DEFAULT","LIGHTMAP_SPECULAR","LIGHTMAP_SHADOWSONLY","SceneLoaderAnimationGroupLoadingMode","SceneLoader","GetDefaultPlugin","_registeredPlugins","_GetPluginForExtension","registeredPlugin","_GetPluginForDirectLoad","plugin","canDirectLoad","_GetPluginForFilename","sceneFilename","queryStringPosition","dotPosition","_GetDirectLoad","_LoadData","fileInfo","onDispose","pluginExtension","directLoad","createPlugin","OnPluginActivatedObservable","catch","isBinary","dataCallback","pluginDisposed","manifestChecked","successCallback","errorCallback","requestFile","_requestFile","file","rootUrl","canUseOfflineSupport","exceptionFound","disableOfflineSupportExceptionRules","readFile","_readFile","_GetFileInfo","sceneFile","filename","GetPluginForExtension","IsPluginForExtensionAvailable","RegisterPlugin","extensions","ImportMesh","meshNames","loadingToken","disposeHandler","errorHandler","errorMessage","progressHandler","successHandler","particleSystems","skeletons","animationGroups","transformNodes","geometries","lights","importedMeshesFiles","rewriteRootURL","importMesh","syncedPlugin","loadingPluginName","importMeshAsync","ImportMeshAsync","Load","Append","LoadAsync","ShowLoadingScreen","_showingLoadingScreen","executeWhenReady","load","loadAsync","AppendAsync","LoadAssetContainer","assets","loadAssetContainer","assetContainer","loadAssetContainerAsync","LoadAssetContainerAsync","ImportAnimations","overwriteAnimations","animationGroupLoadingMode","targetConverter","Clean","animatables","animationGroup","getNodes","Stop","Sync","restart","NoSync","startingIndexForNewAnimatables","container","mergeAnimationsTo","onAnimationFileImportedObservable","ImportAnimationsAsync","NO_LOGGING","MINIMAL_LOGGING","SUMMARY_LOGGING","DETAILED_LOGGING","SceneLoaderFlags","_ForceFullSceneLoadingForIncremental","_ShowLoadingScreen","_loggingLevel","_CleanBoneMatrixWeights","BaseTexture","sceneOrEngine","metadata","reservedDataStore","_hasAlpha","getAlphaFromRGB","coordinatesIndex","_coordinatesMode","DEFAULT_ANISOTROPIC_FILTERING_LEVEL","_isCube","_gammaSpace","invertZ","lodLevelInAlpha","isRenderTarget","_prefiltered","_onDisposeObserver","_texture","_uid","_isScene","getUniqueId","addTexture","_wrapU","_wrapV","gamma","_markAllSubMeshesAsTexturesDirty","_isRGBD","_lodGenerationOffset","_lodGenerationScale","_linearSpecularLOD","_getEngine","checkTransformsAreIdentical","getTextureMatrix","getReflectionTextureMatrix","isReadyOrNotBlocking","isBlocking","ratio","_getFromCache","sampling","texturesCache","texturesCacheEntry","incrementReferences","_readTexturePixels","onTextureRemovedObservable","WhenAllReady","numRemaining","onLoadObservable","ThinTexture","_cachedSize","_cachedBaseSize","_size","getBaseSize","updateSamplingMode","releaseInternalTexture","premulAlpha","forceBindTexture","glformat","DynamicTexture","_generateMipMaps","_canvas","createDynamicTexture","textureSize","_context","_recreate","scaleTo","fillRect","updateDynamicTexture","_format","drawText","font","fillStyle","textSize","measureText","fontSize","fillText","newTexture","_IsCanvasElement","base64String","toDataURL","_invertY","InternalTextureSource","InternalTexture","delayAllocation","baseDepth","_invertVScale","_source","Unknown","_bufferView","_bufferViewArray","_bufferViewArrayArray","_extension","_files","_attachments","_isDisabled","_compression","_sphericalPolynomial","_depthStencilTextureArray","_references","updateSize","proxy","Temp","Url","_swapAndDie","Raw","Raw3D","Raw2DArray","Dynamic","RenderTarget","createRenderTargetCubeTexture","size_1","Depth","depthTextureOptions","createDepthStencilTexture","Cube","createCubeTexture","CubeRaw","CubeRawRGBD","_UpdateRGBDAsync","CubePrefiltered","createPrefilteredCubeTexture","cache","sphericalPolynomial","lodScale","lodOffset","RenderTargetCreationOptions","RenderTargetTexture","doNotChangeAspectRatio","isMulti","renderParticles","renderSprites","ignoreCameraViewport","onBeforeBindObservable","onAfterUnbindObservable","onAfterRenderObservable","onClearObservable","_currentRefreshId","_refreshRate","boundingBoxPosition","renderList","_initialSizeParameter","_processSizeParameter","_resizeObserver","_doNotChangeAspectRatio","_renderingManager","_useSceneAutoClearSetup","_renderTargetOptions","getRenderSize","_textureMatrix","_renderList","_hookArray","wasEmpty","_onAfterUnbindObserver","_onBeforeRenderObserver","_onAfterRenderObserver","_onClearObserver","_onRatioRescale","_sizeRatio","_boundingBoxSize","_bestReflectionRenderTargetDimension","resetRefreshCounter","addPostProcess","_postProcessManager","autoClear","clearPostProcesses","removePostProcess","_shouldRender","refreshRate","getRenderLayers","newSize","wasCube","render","useCameraPostProcess","dumpForDebug","useCameraPostProcesses","_waitingRenderList","mesh_1","getMeshByID","renderListPredicate","sceneMeshes","setTransformMatrix","_defaultRenderListPrepared","renderToTarget","incrementRenderId","renderDimension","curved","_prepareRenderingManager","currentRenderList","currentRenderListLength","checkLayerMask","sceneRenderId","isBlocked","customIsReadyFunction","_internalAbstractMeshDataInfo","_currentLODIsUpToDate","_currentLOD","customLODSelector","getLOD","meshToRender","_preActivateForIntermediateRendering","isMasked","subMeshes","_activate","isAnInstance","_actAsRegularMesh","_onlyForInstancesIntermediate","_isActiveIntermediate","subIndex","subMesh","dispatch","particleIndex","particleSystem","emitter","isStarted","dispatchParticles","_bindFrameBuffer","unbindFrameBuffer","_prepareFrame","defaultRenderList","defaultRenderListLength","getCustomRenderList","updateTransformMatrix","_beforeRenderTargetDrawStage","customRenderFunction","_afterRenderTargetDrawStage","_finalizeFrame","setRenderingOrder","renderingGroupId","opaqueSortCompareFn","alphaTestSortCompareFn","transparentSortCompareFn","setRenderingAutoClearDepthStencil","autoClearDepthStencil","renderTargetSize","disposeFramebufferObjects","objBuffer","REFRESHRATE_RENDER_ONCE","freeRenderingGroups","getViewCount","REFRESHRATE_RENDER_ONEVERYFRAME","REFRESHRATE_RENDER_ONEVERYTWOFRAMES","CopyTools","GenerateBase64StringFromTexture","pixels","npixels","val","createElement","ctx","createImageData","putImageData","canvas2","ctx2","translate","Texture","TRILINEAR_SAMPLINGMODE","uOffset","vOffset","uScale","vScale","uAng","vAng","wAng","uRotationCenter","vRotationCenter","wRotationCenter","homogeneousRotationInUVTransform","inspectableCustomProperties","_noMipmap","_rowGenerationMatrix","_cachedTextureMatrix","_projectionModeMatrix","_t0","_t1","_t2","_cachedUOffset","_cachedVOffset","_cachedUScale","_cachedVScale","_cachedUAng","_cachedVAng","_cachedWAng","_cachedProjectionMatrixId","_cachedURotationCenter","_cachedVRotationCenter","_cachedWRotationCenter","_cachedHomogeneousRotationInUVTransform","_initialSamplingMode","BILINEAR_SAMPLINGMODE","_delayedOnLoad","_delayedOnError","_isBlocking","_mimeType","_loaderOptions","useDelayedTextureLoading","updateURL","_prepareRowForTextureGeneration","uBase","setRowFromFloats","mat","hasTexture","PROJECTION_MODE","updateFlag","PLANAR_MODE","projectionMatrix","getActiveTextures","savedName","SerializeBuffers","ForceSerializeBuffers","parsedTexture","customType","parsedCustomTexture","_samplingMode","_CubeTextureParser","onLoaded","mirrorPlane","mirrorTexture","_CreateMirror","renderTargetTexture","reflectionProbes","probe","cubeTexture","_CreateRenderTargetTexture","CreateFromBase64String","UseSerializedUrlIfAny","LoadFromDataString","jsonTexture","NEAREST_SAMPLINGMODE","NEAREST_NEAREST_MIPLINEAR","LINEAR_LINEAR_MIPNEAREST","LINEAR_LINEAR_MIPLINEAR","NEAREST_NEAREST_MIPNEAREST","NEAREST_LINEAR_MIPNEAREST","NEAREST_LINEAR_MIPLINEAR","NEAREST_LINEAR","NEAREST_NEAREST","LINEAR_NEAREST_MIPNEAREST","LINEAR_NEAREST_MIPLINEAR","LINEAR_LINEAR","LINEAR_NEAREST","EXPLICIT_MODE","SPHERICAL_MODE","CUBIC_MODE","SKYBOX_MODE","INVCUBIC_MODE","EQUIRECTANGULAR_MODE","FIXED_EQUIRECTANGULAR_MODE","FIXED_EQUIRECTANGULAR_MIRRORED_MODE","CLAMP_ADDRESSMODE","WRAP_ADDRESSMODE","MIRROR_ADDRESSMODE","Effect","onCompileObservable","onErrorObservable","_wasPreviouslyReady","_bonesComputationForcedToCPU","_multiTarget","_uniformBuffersNames","_samplers","_isReady","_compilationError","_allFallbacksProcessed","_uniforms","_fallbacks","_vertexSourceCode","_fragmentSourceCode","_vertexSourceCodeOverride","_fragmentSourceCodeOverride","_transformFeedbackVaryings","_rawVertexSourceCode","_rawFragmentSourceCode","_pipelineContext","_valueCache","processFinalCode","_attributesNames","_uniformsNames","_samplerList","_indexParameters","multiTarget","uniformBuffersNames","_uniformBuffersNamesList","_attributeLocationByName","_uniqueIdSeed","hostDocument","getElementById","processorOptions","_shouldUseHighPrecisionShader","ShadersRepository","IncludesShadersStore","_loadShader","migratedVertexCode","migratedFragmentCode","_useFinalCode","spectorName","_isReadyInternal","_attributes","getUniformIndex","uniformName","getUniformNames","getUniformBuffersNames","getIndexParameters","getCompilationError","allFallbacksProcessed","isAsync","_checkIsReady","previousPipelineContext","_processCompilationErrors","optionalKey","shaderUrl","HTMLElement","ShadersStore","atob","_rebuildProgram","engine_1","name_1","unBindMesh","_getShaderCodeAndErrorLine","regexp","errorLine","lineNumber","map","LogShaderCodeOnCompilationError","lineErrorVertex","lineErrorFragment","hasMoreFallbacks","reduce","exName","initialPos","currentExName","channelIndex","_cacheMatrix","_cacheFloat2","_cacheFloat3","_cacheFloat4","bindUniformBuffer","bufferName","_baseCache","bindUniformBufferBase","setFloatArray","setFloatArray2","setFloatArray3","setFloatArray4","setMatrix","toArray","setBool","bool","setVector2","vector2","setVector3","vector3","setVector4","vector4","setColor3","color3","setColor4","setDirectColor4","color4","RegisterShader","pixelShader","ResetCache","EffectFallbacks","_defines","_currentRank","_maxRank","_mesh","addFallback","rank","addCPUSkinningFallback","currentDefines","computeBonesUsingShaders","numBoneInfluencers","otherMesh","material","currentFallbacks","ColorCurves","_dirty","_tempColor","_globalCurve","_highlightsCurve","_midtonesCurve","_shadowsCurve","_positiveCurve","_negativeCurve","_globalHue","_globalDensity","_globalSaturation","_globalExposure","_highlightsHue","_highlightsDensity","_highlightsSaturation","_highlightsExposure","_midtonesHue","_midtonesDensity","_midtonesSaturation","_midtonesExposure","_shadowsHue","_shadowsDensity","_shadowsSaturation","_shadowsExposure","Bind","colorCurves","positiveUniform","neutralUniform","negativeUniform","getColorGradingDataToRef","PrepareUniforms","uniformsList","hue","density","saturation","exposure","clamp","applyColorGradingSliderNonlinear","fromHSBToRef","brightness","q","ImageProcessingConfigurationDefines","IMAGEPROCESSING","VIGNETTE","VIGNETTEBLENDMODEMULTIPLY","VIGNETTEBLENDMODEOPAQUE","TONEMAPPING","TONEMAPPING_ACES","CONTRAST","COLORCURVES","COLORGRADING","COLORGRADING3D","SAMPLER3DGREENDEPTH","SAMPLER3DBGRMAP","IMAGEPROCESSINGPOSTPROCESS","EXPOSURE","rebuild","ImageProcessingConfiguration","_colorCurvesEnabled","_colorGradingEnabled","_colorGradingWithGreenDepth","_colorGradingBGR","_exposure","_toneMappingEnabled","_toneMappingType","TONEMAPPING_STANDARD","_contrast","vignetteStretch","vignetteCentreX","vignetteCentreY","vignetteWeight","vignetteColor","vignetteCameraFov","_vignetteBlendMode","VIGNETTEMODE_MULTIPLY","_vignetteEnabled","_applyByPostProcess","_isEnabled","onUpdateParameters","_updateParameters","_colorGradingTexture","uniforms","PrepareSamplers","samplersList","prepareDefines","forPostProcess","applyByPostProcess","vignetteEnabled","vignetteBlendMode","_VIGNETTEMODE_MULTIPLY","toneMappingEnabled","contrast","colorCurvesEnabled","colorGradingEnabled","colorGradingTexture","colorGradingWithGreenDepth","colorGradingBGR","overrideAspectRatio","inverseWidth","inverseHeight","vignetteScaleY","vignetteScaleX","vignetteScaleGeometricMean","vignettePower","_VIGNETTEMODE_OPAQUE","DetailMapConfiguration","markAllSubMeshesAsTexturesDirty","diffuseBlendLevel","roughnessBlendLevel","bumpLevel","_normalBlendMethod","_internalMarkAllSubMeshesAsTexturesDirty","isReadyForSubMesh","_areTexturesDirty","texturesEnabled","DETAIL_NORMALBLENDMETHOD","DETAIL","bindForSubMesh","uniformBuffer","isFrozen","isSync","activeTextures","getAnimatables","forceDisposeTextures","AddUniforms","AddSamplers","PrepareUniformBuffer","copyTo","detailMap","Material","doNotAdd","shadowDepthWrapper","allowShaderHotSwapping","checkReadyOnEveryCall","checkReadyOnlyOnce","_alpha","_backFaceCulling","getRenderTargetTextures","doNotSerialize","_storeEffectOnSubMeshes","_onUnBindObservable","_onBindObserver","_needDepthPrePass","disableDepthWrite","disableColorWrite","forceDepthWrite","depthFunction","separateCullingPass","_fogEnabled","pointSize","_effect","_useUBO","_fillMode","TriangleFillMode","_cachedDepthWriteState","_cachedColorWriteState","_cachedDepthFunctionState","_indexInSceneMaterialArray","meshMap","_forceAlphaTest","_transparencyMode","idSubscript","getMaterialByID","sideOrientation","ClockWiseSideOrientation","CounterClockWiseSideOrientation","addMaterial","useMaterialMeshMap","MiscDirtyFlag","TextureDirtyFlag","onBindObservable","_onEffectCreatedObservable","WireFrameFillMode","LineListDrawMode","LineLoopDrawMode","LineStripDrawMode","forceWireframe","PointFillMode","PointListDrawMode","forcePointsCloud","freeze","markDirty","unfreeze","useInstances","MATERIAL_ALPHATESTANDBLEND","_markAllSubMeshesAsTexturesAndMiscDirty","MATERIAL_OPAQUE","MATERIAL_ALPHATEST","needAlphaBlending","_disableAlphaBlending","needAlphaBlendingForMesh","visibility","hasVertexAlpha","needAlphaTesting","_shouldTurnAlphaTestOn","getAlphaTestTexture","meshes_1","getMaterial","_preBind","overrideOrientation","reverse","backFaceCulling","bindOnlyWorldMatrix","bindSceneUniformBuffer","sceneUbo","bindView","getSceneUniformBuffer","bindViewProjection","getTransformMatrix","_afterBind","_cachedMaterial","_cachedVisibility","getBindedMeshes","meshId","filter","forceCompilation","localOptions","clipPlane","currentHotSwapingState","checkReady","clipPlaneState","allDone","lastError","tempSubMesh","_materialDefines","forceCompilationAsync","reason","blockMaterialDirtyMechanism","_DirtyCallbackArray","_TextureDirtyCallBack","LightDirtyFlag","_LightsDirtyCallBack","FresnelDirtyFlag","_FresnelDirtyCallBack","AttributesDirtyFlag","_AttributeDirtyCallBack","_MiscDirtyCallBack","PrePassDirtyFlag","_PrePassDirtyCallBack","_markAllSubMeshesAsDirty","_RunDirtyCallBacks","meshes_2","_markScenePrePassDirty","enablePrePassRenderer","_markAllSubMeshesAsAllDirty","_AllDirtyCallBack","_markAllSubMeshesAsImageProcessingDirty","_ImageProcessingDirtyCallBack","_markAllSubMeshesAsFresnelDirty","_markAllSubMeshesAsFresnelAndMiscDirty","_FresnelAndMiscDirtyCallBack","_markAllSubMeshesAsLightsDirty","_markAllSubMeshesAsAttributesDirty","_markAllSubMeshesAsMiscDirty","_markAllSubMeshesAsPrePassDirty","_TextureAndMiscDirtyCallBack","setPrePassRenderer","forceDisposeEffect","notBoundToMesh","freeProcessedMaterials","removeMaterial","meshes_3","sourceMesh","geometry","_releaseVertexArrayObject","_materialEffect","parsedMaterial","overloadedAlbedo","BABYLON","LegacyPBRMaterial","TriangleStripDrawMode","TriangleFanDrawMode","AllDirtyFlag","MATERIAL_ALPHABLEND","MATERIAL_NORMALBLENDMETHOD_WHITEOUT","MATERIAL_NORMALBLENDMETHOD_RNM","markAllAsDirty","markAsImageProcessingDirty","markAsTexturesDirty","markAsFresnelDirty","markAsMiscDirty","markAsPrePassDirty","markAsLightDirty","markAsAttributesDirty","cb","MaterialDefines","_isDirty","_areLightsDirty","_areLightsDisposed","_areAttributesDirty","_areFresnelDirty","_areMiscDirty","_arePrePassDirty","_areImageProcessingDirty","_normals","_uvs","_needNormals","_needUVs","markAsProcessed","markAsUnprocessed","disposed","isEqual","other","prop","cloneTo","MaterialFlags","_DiffuseTextureEnabled","_DetailTextureEnabled","_AmbientTextureEnabled","_OpacityTextureEnabled","_ReflectionTextureEnabled","_EmissiveTextureEnabled","_SpecularTextureEnabled","_BumpTextureEnabled","_LightmapTextureEnabled","_RefractionTextureEnabled","_ColorGradingTextureEnabled","_FresnelEnabled","_ClearCoatTextureEnabled","_ClearCoatBumpTextureEnabled","_ClearCoatTintTextureEnabled","_SheenTextureEnabled","_AnisotropicTextureEnabled","_ThicknessTextureEnabled","ThinMaterialHelper","BindClipPlane","holder","clipPlane2","clipPlane3","clipPlane4","clipPlane5","clipPlane6","MaterialHelper","BindEyePosition","variableName","_forcedViewPosition","devicePosition","_mirroredCameraPosition","PrepareDefinesForMergedUV","isIdentityAs3x2","BindTextureMatrix","updateMatrix","GetFogState","fogEnabled","applyFog","fogMode","PrepareDefinesForMisc","useLogarithmicDepth","pointsCloud","alphaTest","PrepareDefinesForFrameBoundValues","useClipPlane","useThinInstances","useClipPlane1","useClipPlane2","useClipPlane3","useClipPlane4","useClipPlane5","useClipPlane6","PrepareDefinesForBones","useBones","materialSupportsBoneTexture","isUsingTextureForMatrices","bones","nonExcluded","excludedSkinnedMesh","PrepareDefinesForMorphTargets","manager","morphTargetManager","supportsUVs","supportsTangents","supportsNormals","numInfluencers","PrepareDefinesForAttributes","useVertexColor","useMorphTargets","useVertexAlpha","hasVertexColors","useVertexColors","PrepareDefinesForMultiview","previousMultiview","MULTIVIEW","PrepareDefinesForPrePass","canRenderToMRT","previousPrePass","PREPASS","texturesList","SCENE_MRT_COUNT","mrtCount","getIndex","PrepareDefinesForLight","specularSupported","needNormals","needRebuild","equalsFloats","specularEnabled","receiveShadows","shadowMap","getShadowMap","PrepareDefinesForLights","maxSimultaneousLights","disableLighting","lightsEnabled","caps","PrepareUniformsAndSamplersForLight","projectedLightTexture","uniformBuffersList","updateOnlyBuffersList","PrepareUniformsAndSamplersList","uniformsListOrOptions","HandleFallbacksForShadows","lightFallbackRank","PrepareAttributesForMorphTargetsInfluencers","attribs","influencers","_TmpMorphInfluencers","NUM_MORPH_INFLUENCERS","PrepareAttributesForMorphTargets","maxAttributesCount","tangent","uv","PrepareAttributesForBones","PrepareAttributesForInstances","PushAttributesForInstances","BindLightProperties","BindLight","BindLights","BindFogParameters","linearSpace","fogStart","fogEnd","fogDensity","fogColor","toLinearSpaceToRef","_tempFogColor","BindBonesParameters","prePassConfiguration","boneTexture","getTransformMatrixTexture","getTransformMatrices","previousBones","_CopyBonesTransformationMatrices","BindMorphTargetParameters","abstractMesh","influences","BindLogDepth","LN2","MultiMaterial","multiMaterials","subMaterials","_subMaterials","getChildren","getSubMaterial","defaultMaterial","subMaterial","cloneChildren","newMultiMaterial","tags","materials","matIndex","subMat","forceDisposeChildren","ParseMultiMaterial","parsedMultiMaterial","multiMaterial","subMatId","getLastMaterialByID","PrePassConfiguration","previousWorldMatrices","previousViewProjection","PushMaterial","_normalMatrix","_activeEffect","_isReadyForSubMesh","bindOnlyNormalMatrix","normalMatrix","_cachedEffect","_mustRebind","isCachedMaterialInvalid","onCreatedEffectParameters","ShaderMaterial","shaderPath","_textureArrays","_floats","_ints","_floatsArrays","_colors3","_colors3Arrays","_colors4","_colors4Arrays","_vectors2","_vectors3","_vectors4","_matrices","_matrixArrays","_matrices3x3","_matrices2x2","_vectors2Arrays","_vectors3Arrays","_vectors4Arrays","_cachedWorldViewMatrix","_cachedWorldViewProjectionMatrix","_multiview","_shaderPath","uniformBuffers","_checkUniform","setFloats","setColor3Array","arr","setColor4Array","float32Array","copyToArray","_checkCache","shaderName","customShaderNameResolve","previousEffect","_cachedDefines","maxSimultaneousMorphTargets","effectOverride","_effectOverride","getCachedMaterial","_transformMatrixR","seffect","propName","propValue","isArray","textureArrays","floats","FloatArrays","colors3","colors3Arrays","colors4","colors4Arrays","vectors2","vectors3","vectors4","matrixArray","matrices3x3","matrices2x2","vectors2Arrays","vectors3Arrays","vectors4Arrays","textureArray","floatsArrays","colors","shaderMaterial","StandardMaterialDefines","MAINUV1","MAINUV2","DIFFUSE","DIFFUSEDIRECTUV","DETAILDIRECTUV","AMBIENT","AMBIENTDIRECTUV","OPACITY","OPACITYDIRECTUV","OPACITYRGB","REFLECTION","EMISSIVE","EMISSIVEDIRECTUV","SPECULAR","SPECULARDIRECTUV","BUMP","BUMPDIRECTUV","PARALLAX","PARALLAXOCCLUSION","SPECULAROVERALPHA","CLIPPLANE","CLIPPLANE2","CLIPPLANE3","CLIPPLANE4","CLIPPLANE5","CLIPPLANE6","ALPHATEST","DEPTHPREPASS","ALPHAFROMDIFFUSE","POINTSIZE","FOG","SPECULARTERM","DIFFUSEFRESNEL","OPACITYFRESNEL","REFLECTIONFRESNEL","REFRACTIONFRESNEL","EMISSIVEFRESNEL","FRESNEL","NORMAL","UV1","UV2","VERTEXCOLOR","VERTEXALPHA","NUM_BONE_INFLUENCERS","BonesPerMesh","BONETEXTURE","BONES_VELOCITY_ENABLED","INSTANCES","THIN_INSTANCES","GLOSSINESS","ROUGHNESS","EMISSIVEASILLUMINATION","LINKEMISSIVEWITHDIFFUSE","REFLECTIONFRESNELFROMSPECULAR","LIGHTMAP","LIGHTMAPDIRECTUV","OBJECTSPACE_NORMALMAP","USELIGHTMAPASSHADOWMAP","REFLECTIONMAP_3D","REFLECTIONMAP_SPHERICAL","REFLECTIONMAP_PLANAR","REFLECTIONMAP_CUBIC","USE_LOCAL_REFLECTIONMAP_CUBIC","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_SKYBOX","REFLECTIONMAP_EXPLICIT","REFLECTIONMAP_EQUIRECTANGULAR","REFLECTIONMAP_EQUIRECTANGULAR_FIXED","REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED","INVERTCUBICMAP","LOGARITHMICDEPTH","REFRACTION","REFRACTIONMAP_3D","REFLECTIONOVERALPHA","TWOSIDEDLIGHTING","SHADOWFLOAT","MORPHTARGETS","MORPHTARGETS_NORMAL","MORPHTARGETS_TANGENT","MORPHTARGETS_UV","NONUNIFORMSCALING","PREMULTIPLYALPHA","ALPHATEST_AFTERALLALPHACOMPUTATIONS","ALPHABLEND","PREPASS_IRRADIANCE","PREPASS_IRRADIANCE_INDEX","PREPASS_ALBEDO","PREPASS_ALBEDO_INDEX","PREPASS_DEPTHNORMAL","PREPASS_DEPTHNORMAL_INDEX","PREPASS_POSITION","PREPASS_POSITION_INDEX","PREPASS_VELOCITY","PREPASS_VELOCITY_INDEX","PREPASS_REFLECTIVITY","PREPASS_REFLECTIVITY_INDEX","RGBDLIGHTMAP","RGBDREFLECTION","RGBDREFRACTION","IS_REFLECTION_LINEAR","IS_REFRACTION_LINEAR","setReflectionMode","modeToEnable","modes_1","StandardMaterial","_diffuseTexture","_ambientTexture","_opacityTexture","_reflectionTexture","_emissiveTexture","_specularTexture","_bumpTexture","_lightmapTexture","_refractionTexture","ambientColor","diffuseColor","specularColor","emissiveColor","specularPower","_useAlphaFromDiffuseTexture","_useEmissiveAsIllumination","_linkEmissiveWithDiffuse","_useSpecularOverAlpha","_useReflectionOverAlpha","_disableLighting","_useObjectSpaceNormalMap","_useParallax","_useParallaxOcclusion","parallaxScaleBias","_roughness","indexOfRefraction","invertRefractionY","alphaCutOff","_useLightmapAsShadowmap","_useReflectionFresnelFromSpecular","_useGlossinessFromSpecularMapAlpha","_maxSimultaneousLights","_invertNormalMapX","_invertNormalMapY","_twoSidedLighting","_renderTargets","_worldViewProjectionMatrix","_globalAmbientColor","_rebuildInParallel","_attachImageProcessingConfiguration","ReflectionTextureEnabled","RefractionTextureEnabled","_imageProcessingConfiguration","configuration","_imageProcessingObserver","imageProcessingConfiguration","_useLogarithmicDepth","_shouldUseAlphaFromDiffuseTexture","_opacityFresnelParameters","_hasAlphaChannel","DiffuseTextureEnabled","AmbientTextureEnabled","OpacityTextureEnabled","isRGBD","boundingBoxSize","EmissiveTextureEnabled","LightmapTextureEnabled","SpecularTextureEnabled","BumpTextureEnabled","alphaMode","transparencyMode","reflectionTexture","gammaSpace","refractionTexture","FresnelEnabled","_diffuseFresnelParameters","_emissiveFresnelParameters","_refractionFresnelParameters","_reflectionFresnelParameters","getRenderingMesh","lightDisposed","csnrOptions","setEffect","buildUniformLayout","ubo","needFlag","toNormalMatrix","mustRebind","diffuseFresnelParameters","leftColor","rightColor","bias","opacityFresnelParameters","toLuminance","reflectionFresnelParameters","refractionFresnelParameters","emissiveFresnelParameters","updateFloat2","roughness","updateVector3","updateFloat3","updateFloat","_j","elements","UNIFORM_BUFFER","count","location","bindBufferBase","UniformBuffer","dynamic","_noUBO","_dynamic","_data","_uniformLocations","_uniformSizes","_uniformLocationPointer","_needSync","updateMatrix3x3","_updateMatrix3x3ForEffect","updateMatrix2x2","_updateMatrix2x2ForEffect","_updateFloatForEffect","_updateFloat2ForEffect","_updateFloat3ForEffect","_updateFloat4ForEffect","_updateMatrixForEffect","_updateVector3ForEffect","updateVector4","_updateVector4ForEffect","_updateColor3ForEffect","_updateColor4ForEffect","_updateMatrix3x3ForUniform","_updateMatrix2x2ForUniform","_updateFloatForUniform","_updateFloat2ForUniform","_updateFloat3ForUniform","_updateFloat4ForUniform","_updateMatrixForUniform","_updateVector3ForUniform","_updateVector4ForUniform","_updateColor3ForUniform","_updateColor4ForUniform","isDynamic","getData","_bufferData","_fillAlignment","alignment","oldPointer","addMatrix","addFloat2","addFloat3","addColor3","addColor4","addVector3","addMatrix3x3","addMatrix2x2","createDynamicUniformBuffer","createUniformBuffer","updateUniformBuffer","updateUniform","_tempBuffer","suffix","updateUniformDirectly","_MAX_UNIFORM_SIZE","Space","Coordinate","Axis","X","Y","Z","Color3","getHashCode","hash","fromArray","FromArrayToRef","toColor4","Color4","multiply","otherColor","scaleAndAddToRef","clampToRef","toHexString","intR","intG","intB","toLinearSpace","convertedColor","toHSV","toHSVToRef","dm","toGammaSpace","toGammaSpaceToRef","HSVtoRGBToRef","chroma","FromHexString","hex","FromInts","FromArray","LerpToRef","Red","Green","Blue","Black","_BlackReadOnly","White","Purple","Magenta","Yellow","Gray","Teal","Random","random","returnAsColor3","intA","FromColor3","CheckColors4","newIndex","TmpColors","ToGammaSpace","ToLinearSpace","Epsilon","Frustum","GetPlanes","GetPlanesToRef","GetNearPlaneToRef","GetFarPlaneToRef","GetLeftPlaneToRef","GetRightPlaneToRef","GetTopPlaneToRef","GetBottomPlaneToRef","extractMinAndMaxIndexed","minimizeInPlaceFromFloats","maximizeInPlaceFromFloats","extractMinAndMax","PositionNormalVertex","PositionNormalTextureVertex","Orientation","BezierCurve","Interpolate","f0","f1","f2","refinedT","refinedT2","Angle","radians","_radians","degrees","BetweenTwoPoints","atan2","FromRadians","FromDegrees","Arc2","startPoint","midPoint","endPoint","startToMid","midToEnd","centerPoint","startAngle","a1","a2","a3","orientation","Path2","_points","_length","closed","addLineTo","newPoint","previousPoint","addArcTo","midX","midY","endX","endY","numberOfSegments","arc","increment","currentAngle","lastPoint","getPoints","getPointAtLengthPosition","normalizedLengthPosition","lengthPosition","previousOffset","j","bToA","nextOffset","localOffset","StartingAt","Path3D","path","firstNormal","raw","alignTangentsWithPath","_curve","_distances","_tangents","_binormals","_pointAtData","previousPointArrayIndex","subPosition","interpolateReady","interpolationMatrix","_raw","_alignTangentsWithPath","_compute","getCurve","getTangents","getNormals","getBinormals","getDistances","getPointAt","_updatePointAtData","getTangentAt","interpolated","getNormalAt","getBinormalAt","getDistanceAt","getPreviousPointIndexAt","getSubPositionAt","getClosestPositionTo","smallestDistance","closestPosition","subLength","_start","curvePoints","slicePoints","l","_getFirstNonNullVector","prev","cur","curTang","prevNor","prevBinor","tg0","pp0","_normalVector","_getLastNonNullVector","NaN","nNVector","nLVector","vt","va","tgl","interpolateTNB","_updateInterpolationMatrix","_setPointAtData","currentPoint","currentLength","targetLength","parentIndex","tangentFrom","normalFrom","binormalFrom","tangentTo","normalTo","binormalTo","quatFrom","quatTo","Curve3","points","_computeLength","CreateQuadraticBezier","v0","nbPoints","bez","val0","val1","val2","CreateCubicBezier","v3","val3","CreateHermiteSpline","t1","p2","t2","hermite","step","CreateCatmullRomSpline","catmullRom","pointsCount","totalPoints","continue","curve","continuedPoints","Plane","norm","magnitude","transformation","invertedMatrix","_TmpMatrix","copyFromPoints","point1","point2","point3","invPyth","z1","z2","yz","xz","xy","isFrontFacingTo","epsilon","signedDistanceTo","FromPoints","FromPositionAndNormal","SignedDistanceToPlaneFromPositionAndNormal","Scalar","WithinEpsilon","ToHex","toUpperCase","Sign","Clamp","Log2","Repeat","Normalize","Denormalize","DeltaAngle","PingPong","tx","SmoothStep","MoveTowards","maxDelta","MoveTowardsAngle","LerpAngle","InverseLerp","Hermite","tangent1","tangent2","squared","cubed","RandomRange","RangeToPercent","number","PercentToRange","percent","NormalizeRadians","TwoPi","Size","src","multiplyByFloats","otherSize","Vector2","otherVector","divide","divideToRef","negateInPlace","negateToRef","equalsWithEpsilon","fract","One","CatmullRom","value4","part1","part2","part3","part4","Dot","newVector","Minimize","Maximize","PointInTriangle","p0","sign","Distance","DistanceSquared","Center","DistanceOfPointFromSegment","segA","segB","l2","proj","Vector3","_x","_y","_z","toQuaternion","Quaternion","RotationYawPitchRoll","addInPlaceFromFloats","subtractFromFloatsToRef","subtractFromFloats","projectOnPlane","projectOnPlaneToRef","V","MathTmp","denom","scaledV","isNonUniformWithinEpsilon","absX","absY","absZ","reorderInPlace","rotateByQuaternionToRef","quaternion","Matrix","TransformCoordinatesToRef","rotateByQuaternionAroundPointToRef","cross","Cross","normalizeToNew","normalizeToRef","GetClipFactor","vector0","vector1","d0","GetAngleBetweenVectors","CrossToRef","FromFloatArray","FromFloatArrayToRef","FromFloatsToRef","Up","_UpReadOnly","_ZeroReadOnly","Down","Forward","rightHandedSystem","Backward","Right","Left","TransformCoordinates","TransformCoordinatesFromFloatsToRef","rx","ry","rz","rw","TransformNormal","TransformNormalToRef","TransformNormalFromFloatsToRef","ClampToRef","CheckExtends","NormalizeToRef","Project","ProjectToRef","cw","ch","cx","cy","viewportMatrix","FromValuesToRef","_UnprojectFromInvertedMatrixToRef","UnprojectFromTransform","Unproject","UnprojectToRef","UnprojectFloatsToRef","sourceZ","screenSource","RotationFromAxis","axis1","axis2","axis3","RotationFromAxisToRef","ref","quat","RotationQuaternionFromAxisToRef","Vector4","toVector3","FromVector3","_w","otherQuaternion","q1","conjugateToRef","conjugate","toEulerAngles","qz","qx","qy","qw","sqw","sqz","sqx","sqy","zAxisY","asin","FromQuaternionToRef","fromRotationMatrix","FromRotationMatrixToRef","FromRotationMatrix","m11","m12","m13","m21","m22","m23","m31","m32","m33","trace","AreClose","quat0","quat1","Inverse","InverseToRef","Identity","IsIdentity","RotationAxis","RotationAxisToRef","FromEulerAngles","RotationYawPitchRollToRef","FromEulerAnglesToRef","FromEulerVector","FromEulerVectorToRef","yaw","pitch","roll","halfRoll","halfPitch","halfYaw","sinRoll","cosRoll","sinPitch","cosPitch","sinYaw","cosYaw","RotationAlphaBetaGamma","RotationAlphaBetaGammaToRef","halfGammaPlusAlpha","halfGammaMinusAlpha","halfBeta","RotationQuaternionFromAxis","rotMat","FromXYZAxesToRef","SlerpToRef","_isIdentity","_isIdentityDirty","_isIdentity3x2","_isIdentity3x2Dirty","_updateIdentityStatus","_markAsUpdated","_updateFlagSeed","isIdentityDirty","isIdentity3x2","isIdentity3x2Dirty","determinant","m00","m01","m02","m03","m10","m20","m30","det_22_33","det_21_33","det_21_32","det_20_33","det_20_32","det_20_31","resultM","otherM","addToSelf","IdentityToRef","cofact_00","cofact_01","cofact_02","cofact_03","detInv","det_12_33","det_11_33","det_11_32","det_10_33","det_10_32","det_10_31","det_12_23","det_11_23","det_11_22","det_10_23","det_10_22","det_10_21","cofact_10","cofact_11","cofact_12","cofact_13","cofact_20","cofact_21","cofact_22","cofact_23","cofact_30","cofact_31","cofact_32","cofact_33","multiplyAtIndex","addTranslationFromFloats","setTranslation","getTranslation","removeRotationAndScaling","multiplyToArray","tm0","tm1","tm2","tm3","tm4","tm5","tm6","tm7","tm8","tm9","tm10","tm11","tm12","tm13","tm14","tm15","om0","om1","om2","om3","om4","om5","om6","om7","om8","om9","om10","om11","om12","om13","om14","om15","om","translation","sx","sy","sz","getRow","setRow","row","transpose","Transpose","TransposeToRef","tmp","getRotationMatrixToRef","toggleModelMatrixHandInPlace","toggleProjectionMatrixHandInPlace","FromFloat32ArrayToRefScaled","_identityReadOnly","initialM11","initialM12","initialM13","initialM14","initialM21","initialM22","initialM23","initialM24","initialM31","initialM32","initialM33","initialM34","initialM41","initialM42","initialM43","initialM44","FromValues","Compose","ComposeToRef","xx","yy","zz","wx","wy","wz","zero","RotationX","RotationXToRef","Invert","RotationY","RotationYToRef","RotationZ","RotationZToRef","c1","RotationAlignToRef","k","Scaling","ScalingToRef","Translation","TranslationToRef","startM","endM","DecomposeLerp","DecomposeLerpToRef","startScale","startRotation","startTranslation","endScale","endRotation","endTranslation","resultScale","resultRotation","resultTranslation","LookAtLH","eye","LookAtLHToRef","xAxis","yAxis","zAxis","xSquareLength","ex","ey","ez","LookAtRH","LookAtRHToRef","OrthoLH","znear","zfar","OrthoLHToRef","OrthoOffCenterLH","top","OrthoOffCenterLHToRef","i1","OrthoOffCenterRH","OrthoOffCenterRHToRef","PerspectiveLH","PerspectiveFovLH","aspect","PerspectiveFovLHToRef","isVerticalFovFixed","PerspectiveFovReverseLHToRef","PerspectiveFovRH","PerspectiveFovRHToRef","PerspectiveFovReverseRHToRef","PerspectiveFovWebVRToRef","rightHanded","rightHandedFactor","upTan","upDegrees","downTan","downDegrees","leftTan","leftDegrees","rightTan","rightDegrees","xScale","yScale","GetFinalMatrix","zmin","zmax","GetAsMatrix2x2","GetAsMatrix3x3","rm","mm","Reflection","ReflectionToRef","temp2","temp3","xaxis","yaxis","zaxis","zw","zx","yw","xw","TmpVectors","Viewport","toGlobalToRef","VertexData","wrap","topBaseAt","bottomBaseAt","topIndex","bottomIndex","basePositions","topFaceBase","bottomFaceBase","topFaceOrder","bottomFaceOrder","unshift","flat","scaleArray","accumulator","currentValue","currentIndex","faceUV","faceColors","frontUVs","backUVs","vertexData","totalColors","BoxBuilder","CreateBox","_originalBuilderSideOrientation","applyToMesh","diameterTop","diameter","diameterBottom","tessellation","subdivisions","hasRings","enclose","cap","surfaceNb","angle_step","ringVertex","ringNormal","ringFirstVertex","ringFirstNormal","quadNormal","ringIdx","cs","i2","i3","createCylinderCap","isTop","circleVector","vbase","textureScale","textureCoordinate","CylinderBuilder","CreateCylinder","cylinder","instance","InstancedMesh","instancedBuffers","_indexInSourceMeshInstanceArray","addInstance","_sourceMesh","_unIndexed","getAnimationRanges","createAnimationRange","infiniteDistance","getPivotMatrix","refreshBoundingInfo","_syncSubMeshes","_lightSources","_resyncLightSources","getTotalVertices","getTotalIndices","createInstance","kind","copyWhenShared","setVerticesData","updateVerticesData","updateExtends","makeItUnique","setIndices","totalVertices","_positions","applySkeleton","_boundingInfo","isLocked","boundingBias","_refreshBoundingInfo","_getPositionData","_preActivate","renderId","intermediateRendering","_registerInstanceForRenderId","_isActive","_onlyForInstances","_postActivate","edgesShareWithInstances","_edgesRenderer","_renderingGroup","_edgesRenderers","pushNoDuplicate","customInstances","billboardMode","TransformNode","_masterMesh","tempMaster","releaseSubMeshes","_generatePointsArray","_updateBoundingInfo","effectiveMesh","worldMatrixFromCache","_updateSubMeshesBoundingInfo","doNotCloneChildren","removeInstance","removeVerticesData","instances","_userInstancedBuffersStorage","strides","sizes","setVerticesBuffer","visibleInstances","renderSelf","instanceCount","expectedSize","instanceIndex","updateDirectly","_instanceDataStorage","LinesMesh","intersectionThreshold","_colorShader","_addClipPlaneDefine","label","_removeClipPlaneDefine","_bind","_geometry","colorEffect","indexToBind","isUnIndexed","getIndexBuffer","_draw","getVertexBuffers","InstancedLinesMesh","vertexColors","shft","dashshft","dashSize","gapSize","dashNb","curvect","lg","nb","curshft","LinesBuilder","CreateLines","CreateDashedLines","CreateLineSystem","vertexColor","lineColors","lineSystem","updateMeshPositions","nbSeg","_creationDataStorage","dashedLines","_CreationDataStorage","PlaneBuilder","CreatePlane","sourcePlane","setDirection","segments","diameterX","diameterY","diameterZ","dedupTopBottomIndices","totalZRotationSteps","totalYRotationSteps","zRotationStep","normalizedZ","angleZ","yRotationStep","normalizedY","angleY","rotationZ","rotationY","afterRotZ","complete","firstIndex","SphereBuilder","CreateSphere","thickness","outerAngle","innerAngle","dx","dy","nextI","nextJ","TorusBuilder","CreateTorus","torus","WebGLDataBuffer","resource","DataBuffer","_MeshCollisionData","_checkCollisions","_collisionMask","_collisionGroup","_surroundingMeshes","_oldPositionForCollisions","_diffPositionForCollisions","_collisionResponse","_FacetDataStorage","facetNb","partitioningSubdivisions","partitioningBBoxRatio","facetDataEnabled","facetParameters","bbSize","subDiv","facetDepthSort","facetDepthSortEnabled","_InternalAbstractMeshDataInfo","_hasVertexAlpha","_useVertexColors","_numBoneInfluencers","_applyFog","_receiveShadows","_facetData","_visibility","_skeleton","_layerMask","_computeBonesUsingShaders","AbstractMesh","cullingStrategy","CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY","onCollideObservable","onCollisionPositionChangeObservable","onMaterialChangedObservable","definedFacingForward","_occlusionQuery","alphaIndex","showSubMeshesBoundingBox","isBlocker","enablePointerMoveEvents","_renderingGroupId","_material","outlineColor","outlineWidth","overlayColor","overlayAlpha","useOctreeForRenderingSelection","useOctreeForPicking","useOctreeForCollisions","alwaysSelectAsActiveMesh","doNotSyncBoundingInfo","actionManager","_meshCollisionData","ellipsoid","ellipsoidOffset","edgesWidth","edgesColor","_intersectionsInProgress","_waitingData","lods","actions","freezeWorldMatrix","_bonesTransformMatrices","_transformMatrixTexture","onRebuildObservable","addMesh","facetDepthSortFrom","_updateNonUniformScalingState","_markSubMeshesAsMiscDirty","_onCollideObserver","_onCollisionPositionChangeObserver","_unBindEffect","_markSubMeshesAsAttributesDirty","response","needInitialSkinMatrix","_unregisterMeshWithPoseMatrix","_registerMeshWithPoseMatrix","_isWorldMatrixFrozen","_getEffectiveParent","_getActionManagerForTrigger","trigger","initialCall","isRecursive","hasSpecificTrigger","isIn","removed","_markSubMeshesAsDirty","_scaling","newScaling","normalizeToUnitCube","includeDescendants","ignoreRotation","setBoundingInfo","skeletonsEnabled","_freeze","_unFreeze","movePOV","amountRight","amountUp","amountForward","calcMovePOV","rotMatrix","translationDelta","defForwardMult","rotatePOV","flipBack","twirlClockwise","tiltRight","calcRotatePOV","matricesIndicesData","matricesWeightsData","needExtras","matricesIndicesExtraData","matricesWeightsExtraData","prepare","skeletonMatrices","finalMatrix","tempMatrix","matWeightIdx","inf","weight","_effectiveMesh","IsGlobal","updateBoundingInfo","_afterComputeWorldMatrix","getChildMeshes","collisionEnabled","moveWithCollisions","displacement","_collideForSubMesh","transformMatrix","_lastColliderWorldVertices","_lastColliderTransformMatrix","_trianglePlanes","_collide","_processCollisionsForSubMeshes","getCollidingSubMeshCandidates","collisionsScalingMatrix","collisionsTransformMatrix","worldToUse","intersectInfo","getIntersectingSubMeshCandidates","anySubmeshSupportIntersect","canIntersects","currentIntersectInfo","worldOrigin","freeActiveMeshes","generator","isOcclusionQueryInProgress","removeMesh","disableFacetData","onAfterWorldMatrixUpdateObservable","addChild","setParent","removeChild","_initFacetData","facetNormals","facetPositions","facetPartitioning","updateFacetData","bInfo","depthSortedIndices","needs32bits","facetDepthSortFunction","sqDistance","depthSortedFacets","depthSortedFacet","ind","facetDepthSortOrigin","bbSizeMax","getFacetLocalNormals","getFacetLocalPositions","getFacetLocalPartitioning","depthSort","distanceTo","sind","updateIndices","facetData","getFacetPosition","getFacetPositionToRef","localPos","getFacetNormal","getFacetNormalToRef","localNorm","getFacetsAtLocalCoordinates","ox","oy","oz","getClosestFacetAtCoordinates","projected","checkFace","facing","invMat","invVect","closest","getClosestFacetAtLocalCoordinates","tmpx","tmpy","tmpz","t0","projx","projy","projz","facetsInBlock","fib","shortest","tmpDistance","getFacetDataParameters","gpuMemoryOnly","createNormals","alignWithNormal","upDirection","axisX","axisZ","_checkOcclusionQuery","disableEdgesRendering","enableEdgesRendering","checkVerticesInsteadOfIndices","getConnectedParticleSystems","OCCLUSION_TYPE_NONE","OCCLUSION_TYPE_OPTIMISTIC","OCCLUSION_TYPE_STRICT","OCCLUSION_ALGORITHM_TYPE_ACCURATE","OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE","CULLINGSTRATEGY_STANDARD","CULLINGSTRATEGY_OPTIMISTIC_INCLUSION","CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY","Buffer","postponeInternalCreation","instanced","useBytes","_isAlreadyOwned","_updatable","_instanced","_divisor","VertexBuffer","isUpdatable","getStrideSize","updateDynamicVertexBuffer","vertexCount","_increaseReferences","takeBufferOwnership","_ownsBuffer","_kind","data_1","Int8Array","Int16Array","typeByteLength","GetTypeByteLength","DeduceStride","_instanceDivisor","getKind","getOffset","ForEach","UVKind","UV2Kind","UV3Kind","UV4Kind","UV5Kind","UV6Kind","NormalKind","PositionKind","ColorKind","MatricesIndicesKind","MatricesIndicesExtraKind","MatricesWeightsKind","MatricesWeightsExtraKind","TangentKind","componentCount","componentType","componentIndex","dataView","DataView","componentByteLength","componentByteOffset","_GetFloatValue","getInt8","getUint8","getInt16","getUint16","getInt32","getUint32","getFloat32","Geometry","_totalVertices","_isDisposed","_indexBufferIsUpdatable","_positionsCache","useBoundingInfoFromGeometry","_meshes","_vertexBuffers","_indices","setAllVerticesData","_vertexArrayObjects","_boundingBias","CreateGeometryForMesh","RandomId","_extend","_indexBuffer","applyToGeometry","notifyUpdate","_updateExtend","_resetPointsArrayCache","numOfMeshes","_createGlobalSubMesh","_disposeVertexArrayObjects","updateVerticesDataDirectly","getVertexBuffer","subMeshes_1","vbs","forceCopy","tightlyPackedByteStride","copy_1","remainder","isVertexBufferUpdatable","vb","_delayInfo","getVerticesDataKinds","needToUpdateSubMeshes","updateDynamicIndexBuffer","orig","copy","releaseForMesh","shouldDispose","previousGeometry","pushGeometry","_applyToMesh","_syncGeometryWithMorphTargetManager","synchronizeInstances","onGeometryUpdated","_queueLoad","delayLoadingFile","_delayLoadingFunction","toLeftHanded","tIndices","tTemp","tPositions","tNormals","arrayIdx","removeGeometry","stopChecking","toNumberArray","serializeVerticeData","tangets","uv2s","uv3s","uv4s","uv5s","uv6s","matricesIndices","_isExpanded","matricesWeights","ExtractFromMesh","_ImportGeometry","parsedGeometry","geometryId","getGeometryByID","binaryInfo","_binaryInfo","positionsAttrDesc","positionsData","normalsAttrDesc","normalsData","tangetsAttrDesc","tangentsData","uvsAttrDesc","uvsData","uvs2AttrDesc","uvs2Data","uvs3AttrDesc","uvs3Data","uvs4AttrDesc","uvs4Data","uvs5AttrDesc","uvs5Data","uvs6AttrDesc","uvs6Data","colorsAttrDesc","colorsData","matricesIndicesAttrDesc","floatIndices","matricesIndicesExtraAttrDesc","matricesWeightsAttrDesc","indicesAttrDesc","indicesData","subMeshesAttrDesc","subMeshesData","materialIndex","tangents","uvs2","uvs3","uvs4","uvs5","uvs6","matricesIndex","matricesIndicesExtra","_CleanMatricesWeights","matricesWeightsExtra","parsedSubMesh","_shouldGenerateFlatShading","convertToFlatShadedMesh","onMeshImportedObservable","noInfluenceBoneIndex","skeletonId","getLastSkeletonByID","numBoneInfluencer","firstZeroWeight","mweight","parsedVertexData","boundingBoxMinimum","boundingBoxMaximum","hasUVs","hasUVs2","hasUVs3","hasUVs4","hasUVs5","hasUVs6","hasColors","hasMatricesIndices","hasMatricesWeights","MeshLODLevel","_InstanceDataStorage","batchCache","_InstancesBatch","instancesBufferSize","mustReturn","hardwareInstancedRendering","_ThinInstanceDataStorage","matrixBuffer","matrixBufferSize","worldMatrices","_InternalMeshDataInfo","_areNormalsFrozen","_preActivateId","_LODLevels","_morphTargetManager","clonePhysicsImpostor","_internalMeshDataInfo","_thinInstanceDataStorage","_effectiveMaterial","DEFAULTSIDE","overrideMaterialSideOrientation","useClonedMeshMap","directDescendants","getDescendants","index_1","getPhysicsEngine","physicsEngine","impostor","getImpostorForPhysicsObject","physicsImpostor","system","_GetDefaultSideOrientation","FRONTSIDE","_sourcePositions","_sourceNormals","_onBeforeRenderObservable","_onBeforeBindObservable","_onAfterRenderObservable","_onBeforeDrawObservable","_onBeforeDrawObserver","onBeforeDrawObservable","instancesData","manualUpdate","instantiateHierarchy","onNewNodeCreated","doNotInstantiate","getChildTransformNodes","ib","getLODLevels","_sortLODLevels","addLODLevel","getLODLevelAtDistance","internalDataInfo","removeLODLevel","bSphere","distanceToCamera","onLODLevelSelection","_checkDelayState","forceInstanceSupport","effectiveMaterial","_k","_l","_o","freezeNormals","unfreezeNormals","overridenInstanceCount","intermediateDefaultRenderId","defaultRenderId","selfDefaultRenderId","previousRenderId","thinInstanceRefreshBoundingInfo","edgesRenderer","totalIndices","needToRecreate","submesh","subdivide","subdivisionSize","markVerticesDataAsUpdatable","makeGeometryUnique","positionFunction","computeNormals","oldGeometry","_getLinesIndexBuffer","_linesIndexCount","registerBeforeRender","unregisterBeforeRender","removeCallback","registerAfterRender","unregisterAfterRender","_getInstancesRenderList","isReplacementMode","previousBatch","isInIntermediateRendering","_isInIntermediateRendering","onlyForInstances","currentRenderId","_renderWithInstances","batch","_id","instanceStorage","currentInstancesBufferSize","bufferSize","needUpdateBuffer","_processInstancedBuffers","_activeIndices","_renderWithThinInstances","_processRendering","renderingMesh","onBeforeDraw","visibleInstancesForSubMesh","visibleInstanceCount","enableAlphaMode","effectiveMeshReplacement","instanceDataStorage","setAlphaMode","_beforeRenderingMeshStage","mainDeterminant","_onBeforeDraw","_afterRenderingMeshStage","isInstance","cleanMatrixWeights","normalizeSkinWeightsAndExtra","normalizeSkinFourWeights","numWeights","recip","validateSkinning","skinned","valid","report","numberNotSorted","missingWeights","maxUsedWeights","numberNotNormalized","numInfluences","usedWeightCounts","lastWeight","usedWeights","tolerance","numBones","numBadBoneIndices","getBinaryData","setMaterialByID","bakeTransformIntoVertices","submeshes","flipFaces","bakeCurrentTransformIntoVertices","bakeIndependenlyOfChildren","resetLocalMatrix","_disposeInstanceSpecificData","_disposeThinInstanceSpecificData","applyDisplacementMap","minHeight","maxHeight","uvOffset","uvScale","forceUpdate","heightMapWidth","heightMapHeight","getImageData","applyDisplacementMapFromBuffer","kindIndex","kinds","newdata","updatableNormals","previousSubmeshes","vertexIndex","p3","localIndex","submeshIndex","previousOne","convertToUnIndexedMesh","flipNormals","vertex_data","increaseVertices","numberPerEdge","currentIndices","tempIndices","deltaPosition","deltaNormal","deltaUV","side","positionPtr","uvPtr","forceSharedVertices","currentUVs","currentPositions","currentColors","ptr","facet","pstring","indexPtr","uniquePositions","_instancedMeshFactory","_PhysicsImpostorParser","physicObject","jsonObject","others_1","optimizeIndices","vectorPositions","dupes","iteration","realPos","testedPosition","againstPosition","originalSubMeshes","pivotMatrix","localMatrix","pickable","materialId","morphTargetManagerId","_getComponent","getPhysicsImpostor","physicsMass","getParam","physicsFriction","physicsRestitution","serializationInstance","matrixData","thinInstances","_userThinInstanceBuffersStorage","userThinInstance","renderOverlay","morphTarget","getActiveTarget","getPositions","getUVs","parsedMesh","_GroundMeshParser","setPreTransformMatrix","showBoundingBox","useFlatShading","getMorphTargetManagerById","lodMeshIds","ids","distances","lodDistances","coverages","lodCoverages","parsedInstance","thinInstanceSetBuffer","CreateRibbon","pathArray","closeArray","closePath","CreateDisc","CreateHemisphere","CreateTorusKnot","tube","radialSegments","tubularSegments","CreatePolygon","shape","holes","earcutInjection","earcut","ExtrudePolygon","ExtrudeShape","ExtrudeShapeCustom","scaleFunction","rotationFunction","ribbonCloseArray","ribbonClosePath","CreateLathe","CreateGround","CreateTiledGround","xmin","xmax","CreateGroundFromHeightMap","onReady","alphaFilter","CreateTube","radiusFunction","CreatePolyhedron","CreateIcoSphere","CreateDecal","CreateCapsule","setPositionsForCPUSkinning","setNormalsForCPUSkinning","_softwareSkinningFrameId","getFrameId","hasNormals","tempVector3","MinMax","minVector","maxVector","MergeMeshes","disposeSource","allow32BitsIndices","meshSubclass","subdivideWithSubMeshes","multiMultiMaterials","otherVertexData","materialArray","materialIndexArray","indiceArray","merge","last","BACKSIDE","DOUBLESIDE","NO_CAP","CAP_START","CAP_END","CAP_ALL","NO_FLIP","FLIP_TILE","ROTATE_TILE","FLIP_ROW","ROTATE_ROW","FLIP_N_ROTATE_TILE","FLIP_N_ROTATE_ROW","CENTER","LEFT","RIGHT","TOP","BOTTOM","_applyTo","updateMesh","updateGeometry","meshOrGeometry","flip","transformed","tangentTransformed","use32BitsIndices","_validate","decal","_mergeElement","isSrcTypedArray","isOthTypedArray","ret32","getElementCount","positionsElementCount","validateElementCount","elementCount","_ExtractFrom","ExtractFromGeometry","CreateTiledBox","CreateTiledPlane","polygon","fUV","fColors","capSubdivisions","ComputeNormals","p1p2x","p1p2y","p1p2z","p3p2x","p3p2y","p3p2z","faceNormalx","faceNormaly","faceNormalz","v1x","v1y","v1z","v2x","v2y","v2z","v3x","v3y","v3z","computeFacetNormals","computeFacetPositions","computeFacetPartitioning","computeDepthSort","faceNormalSign","xSubRatio","ySubRatio","zSubRatio","subSq","b1x","b1y","b1z","b2x","b2y","b2z","b3x","b3y","b3z","block_idx_o","block_idx_v1","block_idx_v2","block_idx_v3","nbFaces","dsf","_ComputeSides","li","ln","lp","lu","ImportVertexData","SubMesh","createBoundingBox","addToMesh","_linesIndexBuffer","_alphaIndex","_distanceToCamera","_currentMaterial","_renderingMesh","AddToMesh","getMesh","getReplacementMesh","getEffectiveMesh","replacementMesh","rootMaterial","_IsMultiMaterial","linesIndices","checkStopper","_intersectLines","_intersectUnIndexedLines","_intersectUnIndexedTriangles","_intersectTriangles","faceID","indexA","indexB","indexC","newMesh","newRenderingMesh","CreateFromIndices","minVertexIndex","maxVertexIndex","refresh","_thinInstanceUpdateBufferSize","thinInstanceSetMatrixAt","thinInstanceAdd","_thinInstanceInitializeUserStorage","thinInstanceBufferUpdated","staticBuffer","forceRefreshParentInfo","POSITIVE_INFINITY","NEGATIVE_INFINITY","numInstances","kindIsMatrix","currentSize","newData","isPure","_forward","_forwardInverted","_up","_right","_rightInverted","_rotation","_rotationQuaternion","_transformToBoneReferal","_isAbsoluteSynced","_billboardMode","BILLBOARDMODE_NONE","_preserveParentRotationForBillboard","scalingDeterminant","_infiniteDistance","ignoreNonUniformScaling","reIntegrateRotationIntoRotationQuaternion","_poseMatrix","_localMatrix","_usePivotMatrix","_absolutePosition","_absoluteScaling","_absoluteRotationQuaternion","_pivotMatrix","_indexInSceneTransformNodesArray","_nonUniformScaling","addTransformNode","newRotation","updatePoseMatrix","getPoseMatrix","pivotMatrixUpdated","localMatrixUpdated","_syncAbsoluteScalingAndRotation","postMultiplyPivotMatrix","_pivotMatrixInverse","newWorldMatrix","unfreezeWorldMatrix","absolutePositionX","absolutePositionY","absolutePositionZ","invertParentWorldMatrix","setPositionWithLocalVector","getPositionExpressedInLocalSpace","invLocalWorldMatrix","locallyTranslate","targetPoint","yawCor","pitchCor","rollCor","space","dv","_lookAtVectorCache","rotationMatrix","parentRotationMatrix","quaternionRotation","tmat","getAbsolutePivotPoint","getAbsolutePivotPointToRef","quatRotation","diffMatrix","invParentMatrix","attachToBone","bone","affectedTransformNode","getSkeleton","detachFromBone","rotate","_rotationAxisCache","rotateAround","tmpVector","finalScale","finalTranslation","finalRotation","translationMatrix","translationMatrixInv","displacementVector","tempV3","addRotation","accumulation","isSynchronized","useBillboardPosition","BILLBOARDMODE_USE_POSITION","useBillboardPath","preserveParentRotationForBillboard","BILLBOARDMODE_X","BILLBOARDMODE_Y","BILLBOARDMODE_Z","_TmpScaling","cameraWorldMatrix","cameraGlobalPosition","_TmpTranslation","_TmpRotation","scaleMatrix","translation_1","storedTranslation","BILLBOARDMODE_ALL","eulerAngles","_worldMatrixDeterminantIsDirty","independentOfChildren","bakedMatrix","tmpRotationQuaternion","registerAfterWorldMatrixUpdate","unregisterAfterWorldMatrixUpdate","getPositionInCameraSpace","getDistanceToCamera","currentSerializationObject","parsedTransformNode","transformNode","_getDescendants","removeTransformNode","transformNodes_1","storedRotation","storedRotationQuaternion","sizeVec","maxDimension","ArrayTools","BuildArray","itemBuilder","CanvasGenerator","CreateCanvas","OffscreenCanvas","__decoratorInitialStore","__mergedStore","_copySource","creationFunction","instanciate","classStore","getMergedStore","propertyDescriptor","sourceProperty","propertyType","classKey","store","initialStore","parent_1","getPrototypeOf","generateSerializableMember","sourceName","propertyKey","getDirectStore","expandToProperty","targetKey","setCallback","generateExpandMember","serializeAsTexture","serializeAsColor3","serializeAsFresnelParameters","serializeAsVector2","serializeAsVector3","serializeAsMeshReference","serializeAsColorCurves","serializeAsColor4","serializeAsImageProcessingConfiguration","serializeAsQuaternion","serializeAsMatrix","SerializationHelper","Serialize","entity","serializedProperties","targetPropertyName","_TextureParser","_FresnelParametersParser","getLastMeshByID","_ColorCurvesParser","_ImageProcessingConfigurationParser","getCameraByID","Clone","Instanciate","cloneValue","destinationObject","DeepCopier","DeepCopy","doNotCopyList","mustCopyList","proerties_1","obj","props","getOwnPropertyNames","getAllPropertyNames","sourceValue","typeOfSourceValue","clonedValue","_DevTools","WarnImport","DomManagement","IsWindowObjectExist","IsNavigatorAvailable","IsDocumentAvailable","GetDOMTextContent","firstChild","nodeType","textContent","RetryStrategy","ExponentialBackoff","maxRetries","baseInterval","retryIndex","BaseError","_setPrototypeOf","setPrototypeOf","proto","__proto__","LoadFileError","object","RequestFileError","ReadFileError","FileTools","_CleanUrl","SetCorsBehavior","CorsBehavior","crossOrigin","LoadImage","usingObjectURL","URL","createObjectURL","PreprocessUrl","Image","LoadFile","createImageBitmap","imgBmp","revokeObjectURL","loadHandler","err","inputText","noOfflineSupport","enableTexturesOffline","loadImage","textureName","decodeURIComponent","blobURL","ReadFile","reader","FileReader","onloadend","onerror","onload","onprogress","readAsArrayBuffer","readAsText","fileName","RequestFile","onOpened","loadUrl","BaseUrl","aborted","fileRequest","retryHandle","XMLHttpRequest","DONE","clearTimeout","retryLoop","responseType","onLoadEnd","onReadyStateChange","IsFileURL","retryStrategy","DefaultRetryStrategy","waitTime","statusText","enableSceneOffline","noOfflineSupport_1","loadFile","protocol","FilesInputStore","FilesToLoad","GUID","InstantiationTools","Instantiate","className","RegisteredExternalClasses","Logger","_AddLogEntry","entry","_LogCache","OnNewCacheEntry","_FormatMessage","padStr","date","Date","getHours","getMinutes","getSeconds","_LogDisabled","_LogEnabled","formattedMessage","_WarnDisabled","_WarnEnabled","warn","_ErrorDisabled","_ErrorEnabled","errorsCount","ClearLogCache","MessageLogLevel","Log","WarningLogLevel","Warn","ErrorLogLevel","NoneLogLevel","AllLogLevel","EventState","skipNextObservers","initalize","Observer","scope","_willBeUnregistered","unregisterOnNextCall","Observable","MultiObserver","_observers","_observables","Watch","observables","observables_1","observer","onObserverAdded","_eventState","_onObserverAdded","insertFirst","unregisterOnFirstCall","_deferUnregister","_remove","makeObserverTopPriority","makeObserverBottomPriority","eventData","userInfo","lastReturnValue","obs","notifyObserversWithPromise","lastReturnedValue","notifyObserver","hasSpecificMask","PerfCounter","_startMonitoringTime","_min","_max","_average","_lastSecAverage","_current","_totalValueCount","_totalAccumulated","_lastSecAccumulated","_lastSecTime","_lastSecValueCount","fetchNewFrame","newCount","fetchResult","Enabled","_fetchResult","beginMonitoring","endMonitoring","newFrame","currentTime","PrecisionDate","performance","FxaaPostProcess","reusable","_getDefines","updateEffect","onApplyObservable","texelSize","glInfo","_Parse","parsedPostProcess","targetCamera","renderTargetSamplingMode","ScreenshotTools","CreateScreenshot","_getScreenshotSize","renderContext","newWidth","newHeight","renderingCanvas","CreateScreenshotAsync","CreateScreenshotUsingRenderTarget","antialiasing","enableStencilBuffer","targetTextureSize","renderCanvas","originalSize","previousCamera","previousCameras","activeCameras","renderToTexture","fxaaPostProcess","CreateScreenshotUsingRenderTargetAsync","SmartArray","_GlobalId","compareFn","contains","SmartArrayNoDuplicate","_duplicateId","__smartArrayFlags","concatWithNoDuplicate","StringTools","EndsWith","StartsWith","Decode","TextDecoder","decode","fromCharCode","EncodeArrayBufferToBase64","chr1","chr2","chr3","enc1","enc2","enc3","enc4","keyStr","bytes","PadNumber","AndOrNotEvaluator","Eval","query","evaluateCallback","_HandleParenthesisContent","parenthesisContent","or","ori","_SimplifyNegation","and","andj","booleanString","Tags","EnableFor","_tags","hasTags","HasTags","addTags","tagsString","AddTagsTo","removeTags","RemoveTagsFrom","matchesTagsQuery","tagsQuery","MatchesQuery","DisableFor","GetTags","asString","tagsArray","tag","_AddTagTo","_RemoveTagFrom","TimingTools","SetImmediate","setImmediate","PromiseStates","FulFillmentAgregator","InternalPromise","resolver","_state","Pending","_children","_rejectWasConsumed","_resolve","_reject","_resultValue","_parent","_result","onRejected","onFulfilled","newPromise","_onFulfilled","_onRejected","Fulfilled","returnedValue","returnedPromise","_reason","_moveChildren","Rejected","onLocalThrow","_RegisterForFulfillment","promise","agregator","rootPromise","all","promises","race","promises_1","PromisePolyfill","Apply","Tools","classes","FetchToRef","Mix","Slice","SliceToArray","IsExponentOfTwo","FloatRound","fround","_tmpFloatArray","GetFilename","GetFolderPath","uri","returnUnchangedIfNoSlash","ToDegrees","ToRadians","MakeArray","allowsNullUndefined","GetPointerPrefix","eventPrefix","PointerEvent","pointerEnabled","CleanUrl","LoadFileAsync","LoadScript","scriptUrl","scriptId","head","getElementsByTagName","script","appendChild","LoadScriptAsync","ReadFileAsDataURL","fileToLoad","progressCallback","readAsDataURL","FileAsURL","content","fileBlob","webkitURL","Format","decimals","IsEmpty","RegisterTopRootEvents","windowElement","events","UnregisterTopRootEvents","DumpFramebuffer","numberOfChannelsByLine","currentCell","targetCell","_ScreenshotCanvas","EncodeScreenshotCanvasData","ToBlob","toBlob","quality","binStr","charCodeAt","blob","stringDate","getFullYear","getMonth","getDate","Download","newWindow","body","msSaveBlob","display","href","download","parentElement","click","BackCompatCameraNoPreventDefault","args","IsBase64","DecodeBase64","decodedString","bufferLength","bufferView","GetAbsoluteUrl","PerformanceUserMarkLogLevel","StartPerformanceCounter","_StartUserMark","EndPerformanceCounter","_EndUserMark","PerformanceConsoleLogLevel","_StartPerformanceConsole","_EndPerformanceConsole","_StartPerformanceCounterDisabled","_EndPerformanceCounterDisabled","counterName","_performance","mark","measure","timeEnd","GetClassName","isType","First","el","getFullClassName","moduleName","classObj","DelayAsync","delay","IsSafari","UseCustomRequestHeaders","CustomRequestHeaders","PerformanceNoneLogLevel","AsyncLoop","iterations","_done","_fn","_successCallback","executeNext","breakLoop","Run","loop","SyncAsyncForLoop","syncedIterations","breakFunction","timeout","ceil","_TypeStore","GetClass","fqdn","RegisteredTypes","WebRequest","_xhr","_native","_injectCustomRequestHeaders","setRequestHeader","listener","method","CustomRequestModifiers","getResponseHeader","PostProcess","fragmentUrl","parameters","vertexUrl","blockCompilation","textureFormat","nodeMaterialSource","enablePixelPerfectMode","scaleMode","alwaysForcePOT","adaptScaleToCurrentViewport","_reusable","_scaleRatio","_texelSize","onActivateObservable","onSizeChangedObservable","_camera","_textureType","_textureFormat","_fragmentUrl","_vertexUrl","_parameters","_onActivateObserver","_onSizeChangedObserver","_onApplyObserver","_forcedOutputTexture","restoreDefaultInputTexture","getCamera","_shareOutputWithPostProcess","shareOutputWith","_disposeTextures","useOwnOutput","activate","sourceTexture","forceDepthStencil","maxSize","webVRCamera","desiredWidth","desiredHeight","needMipMaps","textureOptions","isStencilEnable","inputTexture","_allowPostProcessClearColor","alphaConstants","setAlphaConstants","_prePassEffectConfiguration","addEffectConfiguration","cameraId","postProcessType","PostProcessManager","_prepareBuffers","vertices","_buildIndexBuffer","postProcessesEnabled","targetTexture","doNotBindFrambuffer","doNotPresent","RenderingGroup","_opaqueSubMeshes","_transparentSubMeshes","_alphaTestSubMeshes","_depthOnlySubMeshes","_particleSystems","_spriteManagers","_opaqueSortCompareFn","_renderOpaque","renderOpaqueSorted","renderUnsorted","_alphaTestSortCompareFn","_renderAlphaTest","renderAlphaTestSorted","_transparentSortCompareFn","defaultTransparentSortCompare","_renderTransparent","renderTransparentSorted","activeMeshes","stencilState","_renderSprites","_renderParticles","onBeforeTransparentRendering","edgesRendererIndex","renderSorted","sortCompareFn","transparent","cameraPosition","_zeroVector","sortedArray","needDepthPrePass","backToFrontSortCompare","frontToBackSortCompare","dispatchSprites","spriteManager","onBeforeParticlesRenderingObservable","_activeParticles","onAfterParticlesRenderingObservable","spritesEnabled","onBeforeSpritesRenderingObservable","onAfterSpritesRenderingObservable","RenderingGroupInfo","RenderingManager","_renderingGroups","_autoClearDepthStencil","_customOpaqueSortCompareFn","_customAlphaTestSortCompareFn","_customTransparentSortCompareFn","_renderingGroupInfo","MIN_RENDERINGGROUPS","MAX_RENDERINGGROUPS","_clearDepthStencilBuffer","_depthStencilBufferAlreadyCleaned","spriteManagers","renderingGroup","renderingGroupMask","onBeforeRenderingGroupObservable","AUTOCLEAR","getAutoClearDepthStencilSetup","_beforeRenderingGroupDrawStage","_afterRenderingGroupDrawStage","onAfterRenderingGroupObservable","_prepareRenderingGroup","group","AbstractScene","rootNodes","morphTargetManagers","actionManagers","_environmentTexture","AddParser","parser","_BabylonFileParsers","GetParser","AddIndividualParser","_IndividualBabylonFileParsers","GetIndividualParser","jsonData","parserName","nodes","Node","_doNotSerialize","_isParentEnabled","_parentUpdateId","_parentNode","_worldMatrixDeterminant","_sceneRootNodesIndex","_animationPropertiesOverride","_isNode","_behaviors","AddNodeConstructor","_NodeConstructors","Construct","previousParentNode","_addToSceneRootNodes","_removeFromSceneRootNodes","lastIdx","animationPropertiesOverride","behavior","attachImmediately","isLoading","onDataLoadedObservable","getBehaviorByName","checkAncestors","ancestor","_setReady","getAnimationByName","_AnimationRangeFactory","nAnimations","deleteAnimationRange","getAnimationRange","animationRanges","speedRatio","serializationRanges","localRange","nodes_1","ParseAnimationRanges","parsedNode","thisAbstractMesh","descendants_1","childMesh","minBox","maxBox","StringDictionary","_count","getOrAddWithFactory","factory","getOrAdd","curVal","getAndRemove","ActionEvent","pointerX","pointerY","meshUnderPointer","sourceEvent","additionalData","CreateNewFromSprite","CreateNewFromScene","CreateNewFromPrimitive","prim","pointerPos","AbstractActionManager","hoverCursor","Triggers","t_int","HasSpecificTrigger","_ClickInfo","_singleClick","_doubleClick","_hasSwiped","_ignore","InputManager","_alreadyAttached","_wheelEventName","_meshPickProceed","_currentPickResult","_previousPickResult","_totalPointersPressed","_doubleClickOccured","_pointerX","_pointerY","_startingPointerPosition","_previousStartingPointerPosition","_startingPointerTime","_previousStartingPointerTime","_pointerCaptures","_meshUnderPointerId","_keyboardIsAttached","_pointerOverMesh","getMeshUnderPointerByPointerId","_unTranslatedPointerX","_unTranslatedPointerY","_updatePointerPosition","canvasRect","_processPointerMove","tabIndex","doNotHandleCursors","defaultCursor","isMeshPicked","setPointerOverMesh","hasPointerTriggers","_pointerMoveStage","onPointerMove","pi","_setRayOnPointerInfo","_checkPrePointerObservable","simulatePointerMove","pointerEventInit","simulatePointerDown","_processPointerDown","_pickedDownMesh","hasPickTriggers","processTrigger","pick","cameraToUseForPointers","LongPressDelay","_isPointerSwiping","_pointerDownStage","onPointerDown","DragMovementThreshold","simulatePointerUp","doubleTap","clickInfo","doubleClick","singleClick","_processPointerUp","_pickedUpMesh","onPointerPick","ignore","type_1","hasSwiped","doubleClickActionManager","_pointerUpStage","pickedDownActionManager","onPointerUp","isPointerCaptured","attachUp","attachDown","attachMove","elementToAttachTo","_alreadyAttachedTo","_initActionManager","act","pointerDownPredicate","_delayedSimpleClick","btn","DoubleClickDelay","_previousButtonPressed","_initClickEvent","obs1","obs2","checkPicking","needToIgnoreNext","checkSingleClickImmediately","ExclusiveDoubleClickMode","_previousDelayedSimpleClickTimeout","_delayedSimpleClickTimeout","checkDoubleClick","_onPointerMove","pointerMovePredicate","constantlyUpdateMeshUnderPointer","_onPointerDown","preventDefaultOnPointerDown","_onPointerUp","preventDefaultOnPointerUp","pointerUpPredicate","HasTriggers","_onKeyDown","onPreKeyboardObservable","_onKeyUp","attachedFunction","_onCanvasFocusObserver","activeElement","onmousewheel","underPointerMesh","getPointerOverMesh","UniqueIdGenerator","_UniqueIdCounter","_inputManager","_blockEntityCollection","autoClearDepthAndStencil","_environmentIntensity","_forceWireframe","_skipFrustumClipping","_forcePointsCloud","animationsEnabled","useConstantAnimationDeltaTime","onAfterRenderCameraObservable","onBeforeAnimationsObservable","onAfterAnimationsObservable","onBeforeDrawPhaseObservable","onAfterDrawPhaseObservable","onReadyObservable","onBeforeCameraRenderObservable","_onBeforeCameraRenderObserver","onAfterCameraRenderObservable","_onAfterCameraRenderObserver","onBeforeActiveMeshesEvaluationObservable","onAfterActiveMeshesEvaluationObservable","onNewCameraAddedObservable","onCameraRemovedObservable","onNewLightAddedObservable","onLightRemovedObservable","onNewGeometryAddedObservable","onGeometryRemovedObservable","onNewTransformNodeAddedObservable","onTransformNodeRemovedObservable","onNewMeshAddedObservable","onMeshRemovedObservable","onNewSkeletonAddedObservable","onSkeletonRemovedObservable","onNewMaterialAddedObservable","onNewMultiMaterialAddedObservable","onMaterialRemovedObservable","onMultiMaterialRemovedObservable","onNewTextureAddedObservable","onBeforeRenderTargetsRenderObservable","onAfterRenderTargetsRenderObservable","onBeforeStepObservable","onAfterStepObservable","onActiveCameraChanged","_registeredForLateAnimationBindings","_useRightHandedSystem","_timeAccumulator","_currentStepId","_currentInternalStep","_fogMode","FOGMODE_NONE","prePass","_shadowsEnabled","_lightsEnabled","_texturesEnabled","physicsEnabled","particlesEnabled","_skeletonsEnabled","lensFlaresEnabled","gravity","renderTargetsEnabled","dumpNextRenderTargets","probesEnabled","_meshesForIntersections","proceduralTexturesEnabled","_activeBones","_animationTime","animationTimeScale","_frameId","_executeWhenReadyTimeoutId","_intermediateRendering","_viewUpdateFlag","_projectionUpdateFlag","_toBeDisposed","_pendingData","dispatchAllSubMeshesOfActiveMeshes","_processedMaterials","_activeParticleSystems","_activeSkeletons","_softwareSkinnedMeshes","_activeAnimatables","_components","_serializableComponents","_transientComponents","_beforeCameraUpdateStage","_beforeClearStage","_gatherRenderTargetsStage","_gatherActiveCameraRenderTargetsStage","_isReadyForMeshStage","_beforeEvaluateActiveMeshStage","_evaluateSubMeshStage","_preActiveMeshStage","_cameraDrawRenderTargetStage","_beforeCameraDrawStage","_afterCameraDrawStage","_afterRenderStage","geometriesByUniqueId","_defaultMeshCandidates","_defaultSubMeshCandidates","_preventFreeActiveMeshesAndRenderingGroups","_activeMeshesFrozen","_skipEvaluateActiveMeshesCompletely","getDeterministicFrameTime","_blockMaterialDirtyMechanism","useGeometryUniqueIdsMap","_createUbo","setDefaultCandidateProviders","DefaultMaterialFactory","CollisionCoordinatorFactory","unTranslatedPointer","setStepId","newStepId","getStepId","getInternalStep","_activeCamera","_defaultMaterial","_collisionCoordinator","_registerTransientComponents","register","_addComponent","component","serializableComponent","addFromContainer","_getDefaultMeshCandidates","_getDefaultSubMeshCandidates","getActiveMeshCandidates","getActiveSubMeshCandidates","getCachedEffect","getCachedVisibility","getActiveIndices","getActiveParticles","getActiveBones","getAnimationRatio","_animationRatio","_sceneUbo","_executeOnceBeforeRender","execFunc","executeOnceBeforeRender","wasLoading","getWaitingItemsCount","whenReadyAsync","resetLastAnimationTimeFrame","_animationTimeLast","viewL","projectionL","viewR","projectionR","_multiviewSceneUbo","_updateMultiviewUbo","UniqueId","recursive","toRemove","newTransformNode","lastNode","removeSkeleton","removeMorphTargetManager","index2","removeParticleSystem","removeAnimation","animationName","targetMask","removeAnimationGroup","removeMultiMaterial","lastMaterial","removeActionManager","removeTexture","newLight","newCamera","addSkeleton","newSkeleton","addParticleSystem","newParticleSystem","addAnimation","newAnimation","addAnimationGroup","newAnimationGroup","addMultiMaterial","newMaterial","addMorphTargetManager","newMorphTargetManager","addGeometry","newGeometry","addActionManager","newActionManager","switchActiveCamera","setActiveCameraByID","setActiveCameraByName","getCameraByName","getAnimationGroupByName","getMaterialByUniqueID","getMaterialByName","getTextureByUniqueID","getCameraByUniqueID","getBoneByID","skeletonIndex","boneIndex","getBoneByName","getLightByName","getLightByID","getLightByUniqueID","getParticleSystemByID","_getGeometryByUniqueID","lastGeometry","getGeometries","getMeshesByID","getTransformNodeByID","getTransformNodeByUniqueID","getTransformNodesByID","getMeshByUniqueID","getLastEntryByID","getNodeByID","getNodeByName","getMeshByName","getTransformNodeByName","getSkeletonByUniqueId","getSkeletonById","getSkeletonByName","getMorphTargetById","managerIndex","numTargets","getMorphTargetByName","getPostProcessByName","postProcessIndex","addExternalData","_externalData","getExternalData","getOrAddExternalDataWithFactory","removeExternalData","_evaluateSubMesh","initialMesh","hasInstances","hasRenderTargetTextures","blockfreeActiveMeshesAndRenderingGroups","freezeActiveMeshes","skipEvaluateActiveMeshes","_evaluateActiveMeshes","unfreezeActiveMeshes","len_1","psLength","animate","hasSpecificTriggers2","_activeMesh","_multiviewTexture","_renderForCamera","softwareSkinnedMeshIndex","needRebind","renderIndex","renderTarget","hasSpecialRenderTargetCamera","_processSubCameras","_useMultiviewToSingleView","_renderMultiviewToSingleView","_checkIntersections","actionIndex","getTriggerParameter","areIntersecting","usePreciseIntersection","currentIntersectionInProgress","_executeCurrent","parameterMesh","_advancePhysicsEngineStep","_animate","deltaTime","MinDeltaTime","MaxDeltaTime","defaultFrameTime","defaultFPS","stepsTaken","maxSubSteps","internalSteps","updateCameras","ignoreAnimations","currentActiveCamera","customIndex","afterRender","freezeMaterials","unfreezeMaterials","beforeRender","clearCachedVertexData","vbName","cleanCachedTextureBuffer","baseTexture","getWorldExtends","filterPredicate","createPickingRayInCameraSpace","pickWithBoundingInfo","multiPick","multiPickWithRay","_getByTags","list","listByTags","getMeshesByTags","getCamerasByTags","getLightsByTags","getMaterialByTags","getTransformNodesByTags","useOfflineSupport","_requestFileAsync","_readFileAsync","FOGMODE_EXP","FOGMODE_EXP2","FOGMODE_LINEAR","SceneComponentConstants","NAME_EFFECTLAYER","NAME_LAYER","NAME_LENSFLARESYSTEM","NAME_BOUNDINGBOXRENDERER","NAME_PARTICLESYSTEM","NAME_GAMEPAD","NAME_SIMPLIFICATIONQUEUE","NAME_GEOMETRYBUFFERRENDERER","NAME_PREPASSRENDERER","NAME_DEPTHRENDERER","NAME_POSTPROCESSRENDERPIPELINEMANAGER","NAME_SPRITE","NAME_SUBSURFACE","NAME_OUTLINERENDERER","NAME_PROCEDURALTEXTURE","NAME_SHADOWGENERATOR","NAME_OCTREE","NAME_PHYSICSENGINE","NAME_AUDIO","STEP_ISREADYFORMESH_EFFECTLAYER","STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER","STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER","STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER","STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER","STEP_BEFORECAMERADRAW_EFFECTLAYER","STEP_BEFORECAMERADRAW_LAYER","STEP_BEFORECAMERADRAW_PREPASS","STEP_BEFORERENDERTARGETDRAW_LAYER","STEP_BEFORERENDERINGMESH_PREPASS","STEP_BEFORERENDERINGMESH_OUTLINE","STEP_AFTERRENDERINGMESH_PREPASS","STEP_AFTERRENDERINGMESH_OUTLINE","STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW","STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER","STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE","STEP_BEFORECAMERAUPDATE_GAMEPAD","STEP_BEFORECLEAR_PROCEDURALTEXTURE","STEP_AFTERRENDERTARGETDRAW_LAYER","STEP_AFTERCAMERADRAW_EFFECTLAYER","STEP_AFTERCAMERADRAW_LENSFLARESYSTEM","STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW","STEP_AFTERCAMERADRAW_LAYER","STEP_AFTERCAMERADRAW_PREPASS","STEP_AFTERRENDER_AUDIO","STEP_GATHERRENDERTARGETS_DEPTHRENDERER","STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER","STEP_GATHERRENDERTARGETS_SHADOWGENERATOR","STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER","STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER","STEP_BEFORECLEARSTAGE_PREPASS","STEP_POINTERMOVE_SPRITE","STEP_POINTERDOWN_SPRITE","STEP_POINTERUP_SPRITE","Stage","Create","registerStep","LayerSceneComponent","_drawCameraBackground","_drawCameraForeground","_drawRenderTargetBackground","_drawRenderTargetForeground","layers_1","layers_2","_drawCameraPredicate","isBackground","cameraLayerMask","renderOnlyInRenderTargetTextures","_drawRenderTargetPredicate","renderTargetTextures","removeFromContainer","Layer","imgUrl","alphaBlendingMode","layerComponent","_createIndexBuffer","_previousDefines","currentEffect","Style","_fontFamily","_fontStyle","_fontWeight","_fontSize","onChangedObservable","_host","fromString","AdvancedDynamicTexture","_rootContainer","_lastControlOver","_lastControlDown","_capturingControl","_linkedControls","_isFullscreen","_fullscreenViewport","_idealWidth","_idealHeight","_useSmallestIdeal","_renderAtIdealSize","_blockNextFocusCheck","_renderScale","_cursorChanged","_defaultMousePointerId","_numLayoutCalls","_numRenderCalls","_clipboardData","onClipboardObservable","onControlPickedObservable","onBeginLayoutObservable","onEndLayoutObservable","onBeginRenderObservable","onEndRenderObservable","applyYInversionOnUpdate","_useInvalidateRectOptimization","_invalidatedRectangle","_clearMeasure","onClipboardCopy","rawEvt","onClipboardCut","onClipboardPaste","_rootElement","_renderObserver","_checkUpdate","_preKeyboardObserver","_focusedControl","processKeyboard","_link","_onResize","_background","_markAllAsDirty","rwidth","rheight","_layerToDispose","control","onBlur","onFocus","executeOnAllControls","invalidateRect","invalidMinX","invalidMinY","invalidMaxX","invalidMaxY","createStyle","addControl","removeControl","_pointerMoveObserver","_canvasPointerOutObserver","_canvasBlurObserver","_getGlobalViewport","getProjectedPosition","globalViewport","projectedPosition","renderScale","getProjectedPositionWithZ","_loop_1","_linkedMesh","linkWithMesh","notRenderable","this_1","_moveToProjectedPosition","_render","strokeStyle","_layout","clearRect","save","restore","_changeCursor","_registerLastControlDown","_doPicking","buttonIndex","deltaX","_processObservables","_processPicking","_onPointerOut","_manageFocus","_cleanControlAfterRemovalFromList","_cleanControlAfterRemoval","tempViewport","_shouldBlockPointer","_attachToOnPointerOut","_attachToOnBlur","registerClipboardEvents","self","unRegisterClipboardEvents","attachToMesh","supportPointerMove","_forcePointerUp","focusedControl","friendlyControls","keepsFocusWith","canMoveFocus","friendlyControls_1","otherHost","isAscendant","moveFocusToControl","_lastPickedControl","isFocusInvisible","pointerEvent","entries","CreateForMesh","onlyAlphaTesting","diffuseTexture","emissiveTexture","opacityTexture","CreateForMeshTexture","CreateFullscreenUI","foreground","Container","_measureForChildren","_adaptWidthToChildren","_adaptHeightToChildren","logLayoutCycleErrors","maxLayoutCycle","_markAsDirty","_getTypeName","_flagDescendantsAsMatrixDirty","_markMatrixAsDirty","getChildByName","getChildByType","typeName","containsControl","_reOrderControl","clearControls","children_1","wasAdded","zIndex","_offsetLeft","_offsetTop","_localDraw","shadowBlur","shadowOffsetX","shadowOffsetY","shadowColor","_currentMeasure","_beforeLayout","_processMeasures","parentMeasure","_cachedParentMeasure","isEqualsTo","_evaluateClippingState","transformToRef","_prevCurrentMeasureTransformedIntoGlobalSpace","rebuildCount","_applyStates","computedWidth","computedHeight","_rebuildLayout","_isClipped","_tempParentMeasure","adaptWidthToChildren","_width","isPixel","paddingLeftInPixels","paddingRightInPixels","adaptHeightToChildren","_height","paddingTopInPixels","paddingBottomInPixels","_postMeasure","invalidatedRectangle","clipChildren","_clipForChildren","_intersectsRect","getDescendantsToRef","isHitTestVisible","_additionalProcessing","Vector2WithInfo","Matrix2D","fromValues","l0","l1","l3","l4","l5","detDiv","det4","det5","r0","r1","r2","r3","r4","r5","transformCoordinates","RotationToRef","ty","scaleX","scaleY","parentMatrix","_TempPreTranslationMatrix","_TempScalingMatrix","_TempRotationMatrix","_TempPostTranslationMatrix","_TempCompose0","_TempCompose1","_TempCompose2","Control","_alphaSet","_zIndex","_color","_style","_horizontalAlignment","HORIZONTAL_ALIGNMENT_CENTER","_verticalAlignment","VERTICAL_ALIGNMENT_CENTER","_wasDirty","_paddingLeft","_paddingRight","_paddingTop","_paddingBottom","_left","_top","_scaleX","_scaleY","_transformCenterX","_transformCenterY","_invertTransformMatrix","_transformedPosition","_isMatrixDirty","_isVisible","_isHighlighted","_fontSet","_dummyVector2","_downCount","_enterCount","_doNotRender","_downPointerIds","_disabledColor","_disabledColorItem","_customData","_automaticSize","isPointerBlocker","clipContent","useBitmapCache","_shadowOffsetX","_shadowOffsetY","_shadowBlur","_shadowColor","_linkOffsetX","_linkOffsetY","onWheelObservable","onPointerMoveObservable","onPointerOutObservable","onPointerDownObservable","onPointerUpObservable","onPointerClickObservable","onPointerEnterObservable","onDirtyObservable","onAfterDrawObservable","fixedRatio","_fixedRatioMasterIsWidth","_tmpMeasureA","_fontOffset","getValueInPixel","_resetFontCache","_styleObserver","isPercentage","fontSizeToUse","getValue","paddingLeft","paddingRight","paddingTop","paddingBottom","linkOffsetX","linkOffsetY","getAscendantOfClass","getLocalCoordinates","globalCoordinates","getLocalCoordinatesToRef","getParentLocalCoordinates","moveToVector3","horizontalAlignment","HORIZONTAL_ALIGNMENT_LEFT","verticalAlignment","VERTICAL_ALIGNMENT_TOP","oldLeft","oldTop","newLeft","newTop","ignoreAdaptiveScaling","rect","_transform","useInvalidateRectOptimization","leftShadowOffset","rightShadowOffset","topShadowOffset","bottomShadowOffset","_font","_prepareFont","_cachedOffsetX","_cachedOffsetY","_renderHighlight","isHighlighted","lineWidth","_renderHighlightSpecific","strokeRect","_isFontSizeInPercentage","AllowAlphaInheritance","globalAlpha","addAndTransformToRef","_preMeasure","_measure","_computeAlignment","parentWidth","parentHeight","HORIZONTAL_ALIGNMENT_RIGHT","VERTICAL_ALIGNMENT_BOTTOM","_clip","beginPath","_ClipMeasure","intersection","clip","_cacheData","coordinates","_onPointerEnter","canNotify","notifyClick","canNotifyClick","_onWheelScroll","previousControlOver","fontStyle","fontWeight","fontSizeInPixels","fontFamily","_GetFontOffset","_HORIZONTAL_ALIGNMENT_LEFT","_HORIZONTAL_ALIGNMENT_RIGHT","_HORIZONTAL_ALIGNMENT_CENTER","_VERTICAL_ALIGNMENT_TOP","_VERTICAL_ALIGNMENT_BOTTOM","_VERTICAL_ALIGNMENT_CENTER","_FontHeightSizes","innerHTML","block","verticalAlign","div","whiteSpace","fontAscent","fontHeight","ascent","descent","drawEllipse","AddHeader","Rectangle","_thickness","_cornerRadius","_drawRoundedRect","fill","stroke","moveTo","lineTo","quadraticCurveTo","TextWrapping","TextBlock","_text","_textWrapping","Clip","_textHorizontalAlignment","_textVerticalAlignment","_resizeToFit","_lineSpacing","_outlineWidth","_outlineColor","_underline","_lineThrough","onTextChangedObservable","onLinesReadyObservable","_breakLines","maxLineWidth","internalValue","updateInPlace","lineSpacing","_drawText","textWidth","strokeText","_renderLines","lineJoin","miterLimit","refWidth","Ellipsis","_lines_1","_line","_parseLineEllipsis","WordWrap","_lines_2","_parseLineWordWrap","_lines_3","_parseLine","characters","words","wordSplittingFunction","testLine","testWidth","rootY","computeExpectedHeight","widthInPixels","context_1","_loaded","_stretch","STRETCH_FILL","_autoScale","_sourceLeft","_sourceTop","_sourceWidth","_sourceHeight","_svgAttributesComputationCompleted","_isSVG","_cellWidth","_cellHeight","_cellId","_populateNinePatchSlicesFromImage","_imageDataCache","onImageLoadedObservable","onSVGAttributesComputedObservable","_extractNinePatchSliceDataFromImage","_detectPointerOnOpaqueOnly","_sliceLeft","_sliceRight","_sliceTop","_sliceBottom","synchronizeSizeWithContent","_rotate90","preserveProperties","_domImage","dataUrl","rotatedImage","_handleRotationForSVGImage","srcImage","dstImage","_rotate90SourceProperties","srcLeft","sourceLeft","srcTop","sourceTop","srcWidth","domImage","srcHeight","dstLeft","dstTop","dstWidth","sourceWidth","dstHeight","sourceHeight","_onImageLoaded","_imageWidth","_imageHeight","_svgCheck","SVGSVGElement","svgsrc","elemid","svgExist","querySelector","svgDoc","contentDocument","documentElement","getAttribute","docwidth","docheight","_getSVGAttribs","svgImage","svgobj","elem","vb_width","vb_height","elem_bbox","getBBox","elem_matrix_a","elem_matrix_d","elem_matrix_e","elem_matrix_f","baseVal","consolidate","STRETCH_NONE","STRETCH_UNIFORM","STRETCH_NINE_PATCH","STRETCH_EXTEND","_prepareWorkingCanvasForOpaqueDetection","_drawImage","sw","sh","tw","th","cellId","rowCount","naturalWidth","cellWidth","column","cellHeight","hRatio","vRatio","centerX","centerY","_renderNinePatch","_renderCornerPatch","targetX","targetY","leftWidth","topHeight","bottomHeight","rightWidth","centerWidth","targetCenterWidth","sliceLeft","targetTopHeight","Button","delegatePickingToChildren","alphaStore","pointerEnterAnimation","pointerOutAnimation","pointerDownAnimation","pointerUpAnimation","_image","_textBlock","CreateImageButton","imageUrl","textBlock","textWrapping","textHorizontalAlignment","iconImage","stretch","CreateImageOnlyButton","CreateSimpleButton","CreateImageWithCenterTextButton","StackPanel","_isVertical","_manualWidth","_manualHeight","_doNotTrackManualChanges","ignoreLayoutWarnings","isVertical","stackWidth","stackHeight","panelWidthChanged","panelHeightChanged","previousHeight","previousWidth","Checkbox","_isChecked","_checkSizeRatio","onIsCheckedChangedObservable","actualWidth","actualHeight","offsetWidth","offseHeight","isChecked","AddCheckBoxWithHeader","title","onValueChanged","panel","checkbox","header","TextWrapper","_characters","txt","removePart","idxStart","idxEnd","insertTxt","newCharacters","isWord","rWord","InputText","_placeholderText","_focusedBackground","_focusedColor","_placeholderColor","_margin","_autoStretchWidth","_maxWidth","_isFocused","_blinkIsEven","_cursorOffset","_deadKey","_addKey","_currentKey","_isTextHighlightOn","_textHighlightColor","_highligherOpacity","_highlightedText","_startHighlightIndex","_endHighlightIndex","_cursorIndex","_onFocusSelectAll","promptMessage","disableMobilePrompt","onBeforeKeyAddObservable","onFocusObservable","onBlurObservable","onTextHighlightObservable","onTextCopyObservable","onTextCutObservable","onTextPasteObservable","onKeyboardEventProcessedObservable","_textWrapper","valueAsString","_textHasChanged","autoStretchWidth","_scrollLeft","_blinkTimeout","_onClipboardObserver","_onPointerDblTapObserver","prompt","clipboardInfo","_onCopyText","_onCutText","_onPasteText","_processDblClick","_selectAllText","_connectedVirtualKeyboard","processKey","deletePosition","deadKey","insertPosition","_updateValueFromCursorIndex","moveLeft","moveRight","_clickedCoordinate","clipboardData","setData","types","clipTextLeft","_beforeRenderText","_textWidth","marginWidth","availableWidth","textLeft","absoluteCursorPosition","previousDist","cursorOffsetText","cursorOffsetWidth","cursorLeft","highlightCursorOffsetWidth","highlightCursorLeft","focusedColor","textWrapper","Grid","_rowDefinitions","_columnDefinitions","_cells","_childControls","getRowDefinition","getColumnDefinition","addRowDefinition","addColumnDefinition","setRowDefinition","setColumnDefinition","getChildrenAt","cell","getChildCellInfo","_tag","_removeCell","childIndex","_offsetCell","previousKey","removeColumnDefinition","removeRowDefinition","goodContainer","_getGridDefinitions","definitionCallback","widths","heights","lefts","tops","globalWidthPercentage","availableHeight","globalHeightPercentage","top_1","ColorPicker","_value","_tmpColor","_pointerStartedOnSquare","_pointerStartedOnWheel","_squareLeft","_squareTop","_squareSize","_s","_v","_lastPointerDownID","onValueChangedObservable","_pointerIsDown","_Epsilon","_updateSquareProps","squareSize","_drawGradientSquare","hueValue","lgh","createLinearGradient","addColorStop","lgv","_drawCircle","_createColorWheelCanvas","maxDistSq","innerRadius","minDistSq","distSq","dist","ang","alphaAmount","alphaRatio","wheelThickness","_colorWheelCanvas","_updateValueFromPointer","_isPointOnSquare","_isPointOnWheel","ShowPickerDialogAsync","advancedTexture","pickerWidth","pickerHeight","headerHeight","lastColor","swatchLimit","numSwatchesPerLine","closeIconColor","buttonFontSize","butEdit","buttonWidth","buttonHeight","currentColor","swatchNumber","swatchDrawer","picker","rValInt","gValInt","bValInt","rValDec","gValDec","bValDec","hexVal","newSwatch","lastVal","activeField","drawerMaxRows","rawSwatchSize","gutterSize","colGutters","swatchSize","drawerMaxSize","containerSize","buttonColor","buttonBackgroundColor","buttonBackgroundHoverColor","buttonBackgroundClickColor","luminanceLimitColor","luminanceLimit","inputFieldLabels","inputTextBackgroundColor","inputTextColor","editSwatchMode","updateValues","inputField","pickedColor","background","minusPound","updateInt","field","newValue","newSwatchRGB","createSwatch","savedColors","icon","swatch","swatchColor","swatchLuminence","metadata_1","setEditButtonVisibility","updateSwatches","butSave","editSwatches","gutterCount","currentRows","thisRow","totalButtonsThisRow","buttonIterations","disableButton","enableButton","pickerGrid","disabled","closePicker","dialogContainer","topRow","initialRows","pickerPanel","panelHead","pickerPanelRows","closeButton","headerColor3","textVerticalAlignment","currentSwatch","dialogBody","dialogBodyCols","pickerBodyRight","pickerBodyRightRows","pickerSwatchesButtons","pickerButtonsCol","pickerSwatches","pickeSwatchesRows","activeSwatches","labelWidth","labelHeight","labelTextSize","newText","swatchOutline","currentText","buttonGrid","buttonGridRows","butOK","butCancel","pickerColorValues","rgbValuesQuadrant","labelText","hexValueQuadrant","newHexValue","checkHex","leadingZero","Ellipse","InputPassword","pwdTextWrapper","Line","_lineWidth","_x1","_y1","_x2","_y2","_dash","_connectedControl","_connectedControlDirtyObserver","setLineDash","_effectiveX2","_effectiveY2","MultiLinePoint","multiLine","_multiLine","_point","_control","_controlObserver","onPointUpdate","_meshObserver","resetLinks","_translatePoint","xValue","yValue","MultiLine","getAt","_minX","_minY","_maxX","_maxY","RadioButton","childRadio","AddRadioButtonWithHeader","radio","BaseSlider","_thumbWidth","_minimum","_maximum","_barOffset","_isThumbClamped","_displayThumb","_step","_effectiveBarOffset","_getThumbPosition","_backgroundBoxLength","_getThumbThickness","thumbThickness","_backgroundBoxThickness","_prepareRenderingData","_renderLeft","_renderTop","_renderWidth","_renderHeight","_effectiveThumbThickness","displayThumb","isThumbClamped","Slider","_borderColor","_thumbColor","_isThumbCircle","_displayValueBar","isThumbCircle","thumbPosition","SelectorGroup","_groupPanel","_selectors","_groupHeader","_addGroupHeader","groupHeading","_getSelector","selectorNb","removeSelector","CheckboxGroup","addCheckbox","checked","_selector","isHorizontal","controlFirst","groupPanel","selectors","buttonBackground","_setSelectorLabel","_setSelectorLabelColor","_setSelectorButtonColor","_setSelectorButtonBackground","RadioGroup","_selectNb","addRadio","SliderGroup","addSlider","unit","onValueChange","borderColor","SelectionPanel","groups","_buttonColor","_buttonBackground","_headerColor","_barColor","_barHeight","_spacerHeight","_bars","_groups","_panel","_addSpacer","_setHeaderColor","_setbuttonColor","_labelColor","_setLabelColor","_setButtonBackground","_setBarColor","_setBarHeight","_setSpacerHeight","separator","bar","addGroup","removeGroup","groupNb","setHeaderName","relabel","removeFromGroupSelector","addToGroupCheckbox","addToGroupRadio","addToGroupSlider","onVal","_ScrollViewerWindow","_freezeControls","_bucketWidth","_bucketHeight","_buckets","_restoreMeasures","_updateMeasures","_useBuckets","_makeBuckets","setBucketSizes","_bucketLen","_dispatchInBuckets","_oldLeft","_oldTop","bStartX","_origLeft","origLeft","bEndX","bStartY","_origTop","origTop","bEndY","bucket","lstc","leftInPixels","topInPixels","origLeftForChildren","origTopForChildren","_updateChildrenMeasures","_parentMeasure","_scrollChildren","_scrollChildrenWithBuckets","scrollLeft","scrollTop","maxWidth","parentClientWidth","parentClientHeight","ScrollBar","_tempMeasure","_first","_originX","_originY","ImageScrollBar","_thumbLength","_thumbHeight","_barImageHeight","num90RotationInVerticalMode","_backgroundBaseImage","isLoaded","_backgroundImage","rotatedValue","_thumbBaseImage","_thumbImage","ScrollViewer","isImageBased","_barSize","_pointerIsOver","_wheelPrecision","_horizontalBarImageHeight","_verticalBarImageHeight","_oldWindowContentsWidth","_oldWindowContentsHeight","_forceHorizontalBar","_forceVerticalBar","_useImageBar","_horizontalBarSpace","_verticalBarSpace","_dragSpace","_grid","_horizontalBar","_verticalBar","_window","_addBar","barColor","barBackground","freezeControls","bucketWidth","bucketHeight","resetWindow","_buildClientSizes","idealRatio","forceVerticalBar","forceHorizontalBar","_clientWidth","_clientHeight","_updateScroller","_setWindowPosition","_barImage","hb","thumbImage","_horizontalBarImage","_verticalBarImage","thumbLength","thumbHeight","barImageHeight","_barBackground","_barBackgroundImage","backgroundImage","_horizontalBarBackgroundImage","_verticalBarBackgroundImage","windowContentsWidth","windowContentsHeight","_endLeft","_endTop","thumbWidth","_attachWheel","barControl","barContainer","barOffset","_onWheelObserver","KeyPropertySet","VirtualKeyboard","onKeyPressObservable","defaultButtonWidth","defaultButtonHeight","defaultButtonPaddingLeft","defaultButtonPaddingRight","defaultButtonPaddingTop","defaultButtonPaddingBottom","defaultButtonColor","defaultButtonBackground","shiftButtonColor","selectedShiftThickness","shiftState","_currentlyConnectedInputText","_connectedInputTexts","_onKeyPressObserver","_createKey","propertySet","addKeysRow","propertySets","maxKey","properties","heightInPixels","applyShiftState","rowContainer","button_tblock","connect","some","onFocusObserver","onBlurObserver","filtered","_removeConnectedInputObservables","connectedInputText","CreateDefaultLayout","DisplayGrid","_minorLineTickness","_minorLineColor","_majorLineTickness","_majorLineColor","_majorLineFrequency","_displayMajorLines","_displayMinorLines","cellCountX","cellCountY","cellX","cellY","ImageBasedSlider","_valueBarImage","tmpRect","tmpRect2","tmpV1","tmpV2","Measure","CombineToRef","addX","addY","addWidth","addHeight","Empty","ValueAndUnit","negativeValueAllowed","UNITMODE_PIXEL","_originalUnit","UNITMODE_PERCENTAGE","refValue","idealWidth","idealHeight","useSmallestIdeal","percentage","_Regex","sourceUnit","_UNITMODE_PERCENTAGE","_UNITMODE_PIXEL","KeepAssets","InstantiatedEntries","AssetContainer","_wasAddedToScene","instantiateModelsToScene","nameFunction","cloneMaterials","convertionMap","storeMap","alreadySwappedSkeletons","alreadySwappedMaterials","onClone","clonedMesh","oldMorphTargetManager","oldTarget","newOne","sourceMaterial","swap","multi","_linkedTransformNode","addAllToScene","addReflectionProbe","environmentTexture","removeAllFromScene","removeReflectionProbe","_moveAssets","sourceAssets","targetAssets","keepAssets","sourceAssets_1","asset","move","keepAssets_1","moveAllFromScene","createRootMesh","rootMesh","_targetConverter","nodeInAC","nodeInScene","animationInAC","animationsWithSameProperty_1","animationInScene","animationWithSameProperty","newAnimationGroups","animationGroupInAC","fromFrame","toFrame","loopAnimation","onAnimationLoop","DataReader","readAsync","_dataView","_dataByteOffset","readUint32","readUint8Array","readString","skipBytes","validateAsync","getExternalResource","externalResourceFunction","GLTFValidator","validateBytes","validateString","workerFunc","pendingExternalResources","onmessage","importScripts","postMessage","GLTFLoaderCoordinateSystemMode","GLTFLoaderAnimationStartMode","GLTFLoaderState","GLTFValidation","ValidateAsync","Worker","workerContent","workerBlobUrl","worker","onMessage","Configuration","_LoadScriptPromise","EComponentType","EShaderType","EParameterType","ETextureWrapMode","ETextureFilterType","ETextureFormat","ECullingType","EBlendingFunction","GLTFFileLoader","onParsedObservable","coordinateSystemMode","AUTO","animationStartMode","FIRST","compileMaterials","compileShadowGenerators","transparencyAsCoverage","useRangeRequests","createInstances","alwaysComputeBoundingBox","loadAllMaterials","preprocessUrlAsync","onMeshLoadedObservable","onTextureLoadedObservable","onMaterialLoadedObservable","onCameraLoadedObservable","onExtensionLoadedObservable","validate","onValidatedObservable","_loader","_requests","_logIndentLevel","_loggingEnabled","_log","_logDisabled","_capturePerformanceCounters","_startPerformanceCounter","_startPerformanceCounterDisabled","_endPerformanceCounter","_endPerformanceCounterDisabled","_onParsedObserver","_onMeshLoadedObserver","_onTextureLoadedObserver","_onMaterialLoadedObserver","_onCameraLoadedObserver","_onCompleteObserver","_onErrorObserver","_onExtensionLoadedObserver","_logEnabled","_startPerformanceCounterEnabled","_endPerformanceCounterEnabled","_onValidatedObserver","_progressCallback","fileRequest_1","webRequest","_unpackBinaryAsync","loaderData","json","_parseJson","arrayBuffer_1","meshesNames","_getLoader","magicBase64Encoded","arrayBuffer_2","whenCompleteAsync","_onProgress","_lengthComputable","lengthComputable","loaded","_total","total","request_1","minVersion","_parseVersion","_compareVersion","major","minor","createLoader","1","_CreateGLTF1Loader","2","_CreateGLTF2Loader","parsed","dataReader","magic","loggingEnabled","unpacked","_unpackBinaryV1Async","_unpackBinaryV2Async","contentLength","contentFormat","bodyLength","bin","startByteOffset_1","ChunkFormat","chunkLength","startByteOffset_2","_logOpen","_logClose","spaces","_logSpaces","IncrementalLoading","HomogeneousCoordinates","FreeCameraKeyboardMoveInput","keysUpward","keysDownward","FreeCameraMouseInput","touchEnabled","angularSensibility","previousPosition","onPointerMovedObservable","_allowCameraRotation","_onMouseMove","_CameraProperty","BaseCameraMouseWheelInput","wheelPrecisionX","wheelPrecisionY","wheelPrecisionZ","_wheelDeltaX","_wheelDeltaY","_wheelDeltaZ","_ffMultiplier","_normalize","platformScale","deltaMode","WheelEvent","DOM_DELTA_LINE","deltaZ","wheelDeltaY","wheelDeltaX","wheelDeltaZ","FreeCameraMouseWheelInput","_moveRelative","_rotateRelative","_moveScene","_wheelXAction","MoveRelative","_wheelXActionCoordinate","_wheelYAction","_wheelYActionCoordinate","_wheelZAction","_wheelZActionCoordinate","RotateRelative","MoveScene","_updateCamera","cameraTransformMatrix","transformedDirection","moveRelative","rotateRelative","moveScene","updateCameraProperty","cameraProperty","coordinate","FreeCameraTouchInput","allowMouse","touchAngularSensibility","touchMoveSensibility","_offsetX","_offsetY","_pointerPressed","isMouseEvent","FreeCameraInputsManager","_mouseInput","_mouseWheelInput","addMouse","removeMouse","removeMouseWheel","addTouch","FreeCamera","applyGravity","_needMoveForGravity","_oldPosition","_diffPosition","newPos","mouse","_collideWithWorld","collisionMask","actualDisplacement","Bone","parentBone","restPose","baseMatrix","_index","_absoluteTransform","_invertedAbsoluteTransform","_scalingDeterminant","_worldTransform","_needToDecompose","_needToCompose","_waitingTransformNodeId","_restPose","_bindPose","_baseMatrix","_updateDifferenceMatrix","_compose","getParent","updateDifferenceMatrix","getLocalMatrix","getBaseMatrix","getRestPose","setRestPose","getBindPose","setBindPose","returnToRest","_numBonesWithLinkedTransformNode","getInvertedAbsoluteTransform","getAbsoluteTransform","linkTransformNode","getTransformNode","_decompose","_localPosition","_markAsDirtyAndCompose","getRotation","setRotation","_localRotation","setRotationQuaternion","getScale","setScale","_localScaling","updateLocalMatrix","_markAsDirtyAndDecompose","rootMatrix","updateChildren","lm","computeAbsoluteTransforms","_tmpMats","_tmpVecs","scaleChildren","locMat","scaleMat","cm","getScaleToRef","setYawPitchRoll","_tmpQuat","rotMatInv","_getNegativeRotationToRef","_rotateWithMatrix","rmat","setAxisAngle","setRotationMatrix","rotMat2","lmat","lx","ly","lz","parentScale","parentScaleInv","getPosition","getPositionToRef","getAbsolutePositionToRef","poseMatrix","getRotationToRef","getRotationQuaternionToRef","getRotationQuaternion","amat","getAbsolutePositionFromLocal","getAbsolutePositionFromLocalToRef","getLocalPositionFromAbsolute","getLocalPositionFromAbsoluteToRef","setCurrentPoseAsRest","_convertRGBtoRGBATextureData","rgbData","rgbaData","_makeCreateRawTextureFunction","updateRawTexture3D","updateRawTexture2DArray","_makeUpdateRawTextureFunction","internalType","internalSizedFomat","compressedTexImage3D","updateRawTexture","updateRawCubeTexture","needConversion","mipmapGenerator","faceDataArrays","mipData","mipSize","mipFaceData","internalCallback","RawTexture","CreateLuminanceTexture","CreateLuminanceAlphaTexture","CreateAlphaTexture","CreateRGBTexture","CreateRGBATexture","CreateRTexture","Skeleton","_meshesWithPoseMatrix","_identity","_lastAbsoluteTransformsUpdateId","_canUseTextureForBones","_uniqueId","_hasWaitingData","_waitingOverrideMeshId","_useTextureToStoreBoneMatrices","onBeforeComputeObservable","engineCaps","useTextureToStoreBoneMatrices","_transformMatrices","getBoneIndexByName","nBones","copyAnimationRange","rescaleAsRequired","frameOffset","_getHighestAnimationFrame","boneDict","sourceBones","skelDimensionsRatio","dimensionsAtRest","boneName","sourceBone","highest","sceneAnimatables","getAllAnimatablesByTarget","rangeAnimatable","sceneAnimatable","animIndex","isAdditive","_computeTransformMatrices","targetMatrix","initialSkinMatrix","mappedIndex","bone_1","_matrix","_synchronizedWithMesh","textureWidth","rangeName","overrideMeshId","parent_2","serializedBone","parentBoneIndex","rest","linkedTransformNodeId","parsedSkeleton","parsedBone","parsedBoneIndex","sortBones","visited","_sortBones","ShadowLight","_needProjectionMatrixCompute","_setPosition","_setDirection","_direction","_shadowMinZ","forceProjectionMatrixCompute","_shadowMaxZ","computeTransformedInformation","transformedPosition","getDepthScale","getShadowDirection","needCube","needProjectionMatrixCompute","getDepthMinZ","shadowMinZ","getDepthMaxZ","shadowMaxZ","setShadowProjectionMatrix","viewMatrix","customProjectionMatrixBuilder","_setDefaultShadowProjectionMatrix","DirectionalLight","_shadowFrustumSize","_shadowOrthoScale","autoUpdateExtends","autoCalcShadowZBounds","_orthoLeft","_orthoRight","MIN_VALUE","_orthoTop","_orthoBottom","shadowFrustumSize","_setDefaultFixedFrustumShadowProjectionMatrix","_setDefaultAutoExtendShadowProjectionMatrix","shadowOrthoScale","PointLight","_shadowAngle","previousNeedCube","recreateShadowMap","shadowAngle","SpotLight","ETokenType","_innerAngle","_projectionTextureMatrix","_projectionTextureLightNear","_projectionTextureLightFar","_projectionTextureUpDirection","_projectionTextureViewLightDirty","_projectionTextureProjectionLightDirty","_projectionTextureDirty","_projectionTextureViewTargetVector","_projectionTextureViewLightMatrix","_projectionTextureProjectionLightMatrix","_projectionTextureScalingMatrix","_angle","_cosHalfAngle","_computeAngleValues","_shadowAngleScale","_projectionTexture","_IsProceduralTexture","_IsTexture","onGeneratedObservable","_computeProjectionTextureViewLightMatrix","_computeProjectionTextureProjectionLightMatrix","light_far","projectionTextureLightFar","light_near","projectionTextureLightNear","P","Q","S","_computeProjectionTextureMatrix","_lightAngleScale","_lightAngleOffset","projectionTexture","GLTFUtils","SetMatrix","semantic","FLOAT_MAT2","FLOAT_MAT3","FLOAT_MAT4","SetUniform","FLOAT_VEC2","FLOAT_VEC3","FLOAT_VEC4","GetWrapMode","GetByteStrideFromType","accessor","GetTextureFilterMode","GetBufferFromBufferView","gltfRuntime","loadedBufferView","loadedBufferViews","GetBufferFromAccessor","bufferViews","DecodeBufferToText","GetDefaultMaterial","_DefaultMaterial","Tokenizer","toParse","currentToken","UNKNOWN","currentIdentifier","currentString","isLetterOrDigitPattern","_toParse","_maxPos","getNextToken","isEnd","END_OF_INPUT","read","IDENTIFIER","glTFTransforms","babylonTransforms","glTFAnimationPaths","babylonAnimationPaths","parseObject","parsedObjects","runtimeProperty","parsedObject","normalizeUVs","attributeParameter","configureBoneTransformation","getParentBone","skins","jointName","nde","getNodeToRoot","nodesToRoot","nodeToRoot","getJointNode","nodeIsInJoints","jointNames","importSkeleton","babylonSkeleton","nodesToRootToAdd","getNodesToRoot","jointNode","existingBone","foundBone","jointNode_1","joint","forAssetContainer","babylonNode","verticesStarts","verticesCounts","indexStarts","indexCounts","meshID","primitives","tempVertexData","primitive","accessors","uvKind","material_1","configureNode","importNode","importOnlyMeshes","skin","importMeshesNames","orthoCamera","perspectiveCamera","persCamera","ambienLight","hemiLight","directionalLight","dirLight","pointLight","ptLight","spotLight","spLight","fallOfAngle","fallOffExponent","configureNodeFromMatrix","traverseNodes","meshIncluded","postLoad","currentScene","thing","anim","channels","lastAnimation","sampler","inputData","outputData","bufferInput","bufferOutput","targetID","targetNode","isBone","targetPath","targetPathIndex","babylonAnimation","arrayOffset","modifyKey","loadAnimations","onShaderCompileSuccess","technique","unTreatedUniforms","_","materialValues","techniqueUniforms","unif","onLoadTexture","SAMPLER_2D","GLTFLoaderExtension","LoadTextureAsync","prepareShaderMaterialUniforms","babylonTexture","onBindShaderMaterial","parseShaderUniforms","tokenizer","uniformParameter","transformIndex","importMaterials","LoadMaterialAsync","GLTFLoaderBase","CreateRuntime","parsedData","buffers","images","programs","techniques","extensionsUsed","buffersCount","shaderscount","loadedBufferCount","loadedShaderCount","dummyNodes","parsedBuffers","parsedBuffer","parseBuffers","parsedShaders","sha","parsedShader","parseShaders","LoadBufferAsync","LoadTextureBufferAsync","CreateTextureAsync","createMipMaps","revokeBlobURL","wrapS","wrapT","LoadShaderStringAsync","shaderString","states","newVertexShader","newPixelShader","vertexTokenizer","pixelTokenizer","attr","foundAttribute","onShaderCompileError","functions","blendFunc","GLTFLoader","RegisterExtension","Extensions","_importMeshAsync","LoadRuntimeAsync","_createNodes","skl","_loadBuffersAsync","_loadShadersAsync","_loadAsync","LoadRuntimeExtensionsAsync","hasShaders","processShader","VERTEX","hasBuffers","processBuffer","_name","loadRuntimeAsync","loadRuntimeExtensionsAsync","loadBufferAsync","loadTextureBufferAsync","createTextureAsync","loadShaderStringAsync","loadMaterialAsync","ApplyExtensions","loaderExtension","defaultFunc","extensionName","GLTFBinaryExtension","_bin","sourceExt","binaryExtensionShader","shaderBytes","GLTFMaterialsCommonExtension","ambientLight","ambient","directional","spot","fallOffAngle","standardMaterial","doubleSided","transparency","shininess","_loadTexture","emission","propertyPath","Deferred","_staticOffsetValueQuaternion","_staticOffsetValueVector3","_staticOffsetValueVector2","_staticOffsetValueSize","_staticOffsetValueColor3","RuntimeAnimation","_currentFrame","_originalValue","_originalBlendValue","_offsetsCache","_highLimitsCache","_stopped","_blendingFactor","_currentValue","_currentActiveTarget","_directTarget","_targetPath","_weight","_ratioOffset","_previousDelay","_previousRatio","_targetIsArray","_animation","_activeTargets","_animationState","_getCorrectLoopMode","_minFrame","_maxFrame","_minValue","_maxValue","newKey","target_1","_preparePath","_getOriginalValues","_clone","_enableBlending","targetIndex","restoreOriginal","_setValue","isDone","runtimeAnimations","setValue","originalValue","_registerTargetForLateAnimationBinding","goToFrame","onlyOnce","_prepareForSpeedRatioChange","newSpeedRatio","newRatio","keyOffset","fromValue","toValue","syncRoot","masterFrame","_onLoop","Animatable","_localDelayOffset","_pausedDelay","_paused","_speedRatio","_syncRoot","disposeOnEnd","animationStarted","onAnimationEndObservable","onAnimationLoopObservable","appendAnimations","syncWith","root","getAnimations","newRuntimeAnimation","getAnimationByTargetProperty","getRuntimeAnimationByTargetProperty","disableBlending","fps","pause","_raiseOnAnimationEnd","runtimeAnimation","waitAsync","running","isRunning","animationTime","_processLateAnimationBindings","returnedAnimatable","stopCurrent","shouldRunTargetAnimations","children_2","animatables_1","_lateAnimationHolders","totalWeight","totalAdditiveWeight","additiveAnimations","normalizer","finalPosition","finalScaling","finalQuaternion","originalAnimation","skipOverride","currentPosition","currentScaling","currentQuaternion","animIndex_1","refQuaternion","cumulativeQuaternion","quaternions","weights","cumulativeAmount","animIndex_2","matrixDecomposeMode","finalValue","_processLateAnimationBindingsForMatrices","_processLateAnimationBindingsForQuaternions","scale_1","animIndex_3","sourceRange","origTranslation","sourceKeys","sourceBoneLength","sourceParent","parentScalingReqd","parentRatio","dimensionsScalingReqd","destKeys","TargetedAnimation","targetId","AnimationGroup","_targetedAnimations","_from","_to","_loopAnimation","_isAdditive","onAnimationGroupLoopObservable","onAnimationGroupEndObservable","onAnimationGroupPauseObservable","onAnimationGroupPlayObservable","_isStarted","_isPaused","addTargetedAnimation","targetedAnimation","_processLoop","_animationLoopFlags","_animationLoopCount","_checkAnimationGroupEnded","play","setWeightForAllAnimatables","syncAllAnimationsWith","newName","newGroup","targetAnimation","targetedAnimations","targetedAnimationIndex","parsedAnimationGroup","sourceAnimationGroup","RGBDTextureTools","ExpandRGBDTexture","expandTexture","rgbdPostProcess_1","expandedTexture_1","BRDFTextureTools","GetEnvironmentBRDFTexture","environmentBRDFTexture","previousState","_environmentBRDFBase64Texture","_instanceNumber","PBRClearCoatConfiguration","_indexOfRefraction","_DefaultIndexOfRefraction","_useRoughnessFromMainTexture","useRoughnessFromMainTexture","_textureRoughness","textureRoughness","_remapF0OnInterfaceChange","remapF0OnInterfaceChange","bumpTexture","_isTintEnabled","isTintEnabled","tintColor","tintColorAtDistance","tintThickness","_tintTexture","tintTexture","disableBumpMap","CLEARCOAT","CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE","CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL","CLEARCOAT_REMAP_F0","CLEARCOAT_TEXTURE","CLEARCOAT_TEXTURE_ROUGHNESS","CLEARCOAT_BUMP","CLEARCOAT_DEFAULTIOR","CLEARCOAT_TINT","CLEARCOAT_TINT_TEXTURE","invertNormalMapX","invertNormalMapY","identicalTextures","eta","AddFallbacks","currentRank","clearCoatConfiguration","PBRAnisotropicConfiguration","ANISOTROPIC","ANISOTROPIC_TEXTURE","anisotropicConfiguration","PBRBRDFConfiguration","markAllSubMeshesAsMiscDirty","_useEnergyConservation","DEFAULT_USE_ENERGY_CONSERVATION","useEnergyConservation","_useSmithVisibilityHeightCorrelated","DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED","useSmithVisibilityHeightCorrelated","_useSphericalHarmonics","DEFAULT_USE_SPHERICAL_HARMONICS","useSphericalHarmonics","_useSpecularGlossinessInputEnergyConservation","DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION","useSpecularGlossinessInputEnergyConservation","_internalMarkAllSubMeshesAsMiscDirty","BRDF_V_HEIGHT_CORRELATED","MS_BRDF_ENERGY_CONSERVATION","SPHERICAL_HARMONICS","SPECULAR_GLOSSINESS_ENERGY_CONSERVATION","brdfConfiguration","PBRSheenConfiguration","_linkSheenWithAlbedo","linkSheenWithAlbedo","_albedoScaling","albedoScaling","SHEEN","SHEEN_LINKWITHALBEDO","SHEEN_ROUGHNESS","SHEEN_ALBEDOSCALING","SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE","SHEEN_TEXTURE_ROUGHNESS_IDENTICAL","SHEEN_TEXTURE","SHEEN_TEXTURE_ROUGHNESS","sheenConfiguration","PBRSubSurfaceConfiguration","markScenePrePassDirty","_isRefractionEnabled","isRefractionEnabled","_isTranslucencyEnabled","isTranslucencyEnabled","_isScatteringEnabled","isScatteringEnabled","_scatteringDiffusionProfileIndex","refractionIntensity","translucencyIntensity","useAlbedoToTintRefraction","_thicknessTexture","thicknessTexture","_volumeIndexOfRefraction","_invertRefractionY","_linkRefractionWithTransparency","linkRefractionWithTransparency","minimumThickness","maximumThickness","diffusionDistance","_useMaskFromThicknessTexture","useMaskFromThicknessTexture","_useMaskFromThicknessTextureGltf","useMaskFromThicknessTextureGltf","_internalMarkScenePrePassDirty","subSurfaceConfiguration","ssDiffusionProfileColors","enableSubSurfaceForPrePass","addDiffusionProfile","_getRefractionTexture","SUBSURFACE","SS_TRANSLUCENCY","SS_SCATTERING","SS_THICKNESSANDMASK_TEXTURE","SS_MASK_FROM_THICKNESS_TEXTURE","SS_MASK_FROM_THICKNESS_TEXTURE_GLTF","SS_REFRACTION","SS_REFRACTIONMAP_3D","SS_GAMMAREFRACTION","SS_RGBDREFRACTION","SS_LINEARSPECULARREFRACTION","SS_REFRACTIONMAP_OPPOSITEZ","SS_LODINREFRACTIONALPHA","SS_LINKREFRACTIONTOTRANSPARENCY","SS_ALBEDOFORREFRACTIONTINT","linearSpecularLOD","lodBasedMicrosurface","realTimeFiltering","refractionIor","volumeIndexOfRefraction","lodGenerationScale","lodGenerationOffset","activeEffect","fillRenderTargetTextures","renderTargets","SH3ylmBasisConstants","SH3ylmBasisTrigonometricTerms","applySH3","SHCosKernelConvolution","SphericalHarmonics","preScaled","l00","l1_1","l10","l11","l2_2","l2_1","l20","l21","l22","deltaSolidAngle","convertIncidentRadianceToIrradiance","convertIrradianceToLambertianRadiance","preScaleForRendering","FromPolynomial","polynomial","SphericalPolynomial","_harmonics","addAmbient","colorVector","FromHarmonics","harmonics","sp","FileFaceOrientation","worldAxisForNormal","worldAxisForFileX","worldAxisForFileY","CubeMapToSphericalPolynomialTools","ConvertCubeMapTextureToSphericalPolynomial","down","front","back","cubeInfo","ConvertCubeMapToSphericalPolynomial","sphericalHarmonics","totalSolidAngle","du","minUV","fileFace","FileFaces","dataArray","worldDirection","correctionFactor","PBRMaterialDefines","PBR","NUM_SAMPLES","REALTIME_FILTERING","ALBEDO","GAMMAALBEDO","ALBEDODIRECTUV","AMBIENTINGRAYSCALE","ALPHAFROMALBEDO","ALPHATESTVALUE","RADIANCEOVERALPHA","ALPHAFRESNEL","LINEARALPHAFRESNEL","REFLECTIVITY","REFLECTIVITYDIRECTUV","MICROSURFACEFROMREFLECTIVITYMAP","MICROSURFACEAUTOMATIC","LODBASEDMICROSFURACE","MICROSURFACEMAP","MICROSURFACEMAPDIRECTUV","METALLICWORKFLOW","ROUGHNESSSTOREINMETALMAPALPHA","ROUGHNESSSTOREINMETALMAPGREEN","METALLNESSSTOREINMETALMAPBLUE","AOSTOREINMETALMAPRED","METALLIC_REFLECTANCE","METALLIC_REFLECTANCEDIRECTUV","ENVIRONMENTBRDF","ENVIRONMENTBRDF_RGBD","TANGENT","NORMALXYSCALE","GAMMALIGHTMAP","USESPHERICALFROMREFLECTIONMAP","USEIRRADIANCEMAP","USESPHERICALINVERTEX","REFLECTIONMAP_OPPOSITEZ","LODINREFLECTIONALPHA","GAMMAREFLECTION","LINEARSPECULARREFLECTION","RADIANCEOCCLUSION","HORIZONOCCLUSION","USEPHYSICALLIGHTFALLOFF","USEGLTFLIGHTFALLOFF","FORCENORMALFORWARD","SPECULARAA","CLEARCOAT_TEXTUREDIRECTUV","CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV","CLEARCOAT_BUMPDIRECTUV","CLEARCOAT_TINT_TEXTUREDIRECTUV","ANISOTROPIC_TEXTUREDIRECTUV","SHEEN_TEXTUREDIRECTUV","SHEEN_TEXTURE_ROUGHNESSDIRECTUV","SS_THICKNESSANDMASK_TEXTUREDIRECTUV","UNLIT","DEBUGMODE","PBRBaseMaterial","_directIntensity","_emissiveIntensity","_specularIntensity","_lightingInfos","_disableBumpMap","_albedoTexture","_ambientTextureStrength","_ambientTextureImpactOnAnalyticalLights","DEFAULT_AO_ON_ANALYTICAL_LIGHTS","_reflectivityTexture","_metallicTexture","_metallic","_metallicF0Factor","_metallicReflectanceColor","_metallicReflectanceTexture","_microSurfaceTexture","_ambientColor","_albedoColor","_reflectivityColor","_reflectionColor","_emissiveColor","_microSurface","_useHorizonOcclusion","_useRadianceOcclusion","_useAlphaFromAlbedoTexture","_useMicroSurfaceFromReflectivityMapAlpha","_useRoughnessFromMetallicTextureAlpha","_useRoughnessFromMetallicTextureGreen","_useMetallnessFromMetallicTextureBlue","_useAmbientOcclusionFromMetallicTextureRed","_useAmbientInGrayScale","_useAutoMicroSurfaceFromReflectivityMap","_lightFalloff","LIGHTFALLOFF_PHYSICAL","_useRadianceOverAlpha","_parallaxScaleBias","_alphaCutOff","_useAlphaFresnel","_useLinearAlphaFresnel","_environmentBRDFTexture","_forceIrradianceInFragment","_realTimeFiltering","_realTimeFilteringQuality","_forceNormalForward","_enableSpecularAntiAliasing","_unlit","debugMode","debugLimit","debugFactor","clearCoat","anisotropy","brdf","sheen","subSurface","disableAlphaBlending","PBRMATERIAL_OPAQUE","PBRMATERIAL_ALPHATEST","_shouldUseAlphaFromAlbedoTexture","_getReflectionTexture","irradianceTexture","isMetallicWorkflow","_prepareDefines","fallbackRank","realTimeFilteringQuality","LIGHTFALLOFF_STANDARD","LIGHTFALLOFF_GLTF","wireframe","polynomials","preScaledHarmonics","ior","metallicF90","environmentIntensity","eyePosition","invertNormal","PBRMATERIAL_ALPHABLEND","PBRMATERIAL_ALPHATESTANDBLEND","PBRMaterial","directIntensity","emissiveIntensity","specularIntensity","ambientTextureStrength","ambientTextureImpactOnAnalyticalLights","metallicF0Factor","metallicReflectanceColor","albedoColor","reflectivityColor","reflectionColor","microSurface","useLightmapAsShadowmap","useAlphaFromAlbedoTexture","forceAlphaTest","useSpecularOverAlpha","useMicroSurfaceFromReflectivityMapAlpha","useRoughnessFromMetallicTextureAlpha","useRoughnessFromMetallicTextureGreen","useMetallnessFromMetallicTextureBlue","useAmbientOcclusionFromMetallicTextureRed","useAmbientInGrayScale","useAutoMicroSurfaceFromReflectivityMap","useRadianceOverAlpha","useObjectSpaceNormalMap","useParallax","useParallaxOcclusion","forceIrradianceInFragment","twoSidedLighting","useAlphaFresnel","useLinearAlphaFresnel","forceNormalForward","enableSpecularAntiAliasing","useHorizonOcclusion","useRadianceOcclusion","unlit","usePhysicalLightFalloff","useGLTFLightFalloff","MorphTarget","influence","onInfluenceChanged","_onDataLayoutChanged","_influence","previous","setPositions","hadPositions","hasPositions","setNormals","hadNormals","setTangents","hadTangents","hasTangents","setUVs","hadUVs","FromMesh","MorphTargetManager","_targets","_targetInfluenceChangedObservers","_targetDataLayoutChangedObservers","_supportsNormals","_supportsTangents","_supportsUVs","_vertexCount","_tempInfluences","enableNormalMorphing","enableTangentMorphing","enableUVMorphing","_influences","addTarget","_syncActiveTargets","removeTarget","influenceCount","synchronize","targetData","ArrayItem","Get","Assign","_completePromises","_forAssetContainer","_babylonLights","_disableInstancedMesh","_disposed","_extensions","_defaultBabylonMaterialData","UnregisterExtension","_RegisteredExtensions","_gltf","_babylonScene","_rootBabylonMesh","_rootUrl","_fileName","_loadData","nodeMap_1","_getMeshes","_getSkeletons","_getAnimationGroups","_getTransformNodes","_getGeometries","resultFunc","_uniqueRootUrl","_loadExtensions","_checkExtensions","loadingToReadyCounterName","LOADING","READY","loadingToCompleteCounterName","COMPLETE","_setState","_extensionsOnLoading","oldBlockMaterialDirtyMechanism","loadSceneAsync","babylonDrawMode","_loadMaterialAsync","_compileMaterialsAsync","_compileShadowGeneratorsAsync","resultPromise","_extensionsOnReady","_startAnimations","_setupData","binaryBuffer","nodeParents","_createRootNode","name_2","extensionsRequired","name_3","_babylonTransformNode","_LoadTransform","FORCE_RIGHT_HANDED","extensionPromise","_extensionsLoadSceneAsync","logOpen","loadNodeAsync","babylonMesh","_babylonBones","_loadAnimationsAsync","logClose","_forEachPrimitive","_primitiveBabylonMeshes","nodes_2","nodes_3","skins_1","animations_1","_babylonAnimationGroup","babylonAnimationGroups","ALL","babylonAnimationGroups_1","assign","_extensionsLoadNodeAsync","loadNode","babylonTransformNode","AddPointerMetadata","loadCameraAsync","babylonCamera","childNode","childBabylonMesh","nodeName","_loadMeshAsync","_loadMeshPrimitiveAsync","primitives_1","_loadSkinAsync","_extensionsLoadMeshPrimitiveAsync","babylonAbstractMesh","shouldInstance","_instanceData","babylonSourceMesh","babylonMesh_1","_createMorphTargets","_loadVertexDataAsync","babylonGeometry","_loadMorphTargetsAsync","_GetDrawMode","babylonMaterial","_createDefaultMaterial","_extensionsLoadVertexDataAsync","_loadIndicesAccessorAsync","loadAttribute","_loadVertexAccessorAsync","babylonVertexBuffer","mmin","mmax","_numMorphTargets","targetNames","extras","name_4","babylonMorphTarget","_loadMorphTargetVertexDataAsync","_loadFloatAccessorAsync","dataIndex","_extensionsLoadSkinAsync","assignSkeleton","_loadBones","_loadSkinInverseBindMatricesDataAsync","inverseBindMatricesData","_updateBoneMatrices","babylonBones","joints","_loadBone","babylonBone","babylonParentBone","_getNodeMatrix","inverseBindMatrices","_extensionsLoadCameraAsync","perspective","yfov","orthographic","xmag","ymag","loadAnimationAsync","_extensionsLoadAnimationAsync","babylonAnimationGroup","_loadAnimationChannelAsync","animationContext","animationTargetOverride","_loadAnimationSamplerAsync","getNextOutputValue","getNextKey","outputBufferOffset","frameIndex","_loop_2","babylonAnimationClone","inputAccessor","outputAccessor","_loadBufferAsync","_extensionsLoadBufferAsync","loadUriAsync","loadBufferViewAsync","_extensionsLoadBufferViewAsync","_loadAccessorAsync","numComponents","_GetNumComponents","bufferView_1","typedArray_1","_GetTypedArray","sparse","sparse_1","typedArray","indicesBufferView","valuesBufferView","valuesData","sparseLength","sparseData","valuesIndex","indicesIndex","_GetTypedArrayConstructor","_loadVertexBufferViewAsync","_babylonBuffer","_babylonVertexBuffer","bufferView_2","babylonBuffer","_loadMaterialMetallicRoughnessPropertiesAsync","baseColorFactor","metallic","metallicFactor","roughnessFactor","baseColorTexture","loadTextureInfoAsync","albedoTexture","metallicRoughnessTexture","nonColorData","metallicTexture","_extensionsLoadMaterialAsync","babylonData","createMaterial","babylonMeshes","loadMaterialPropertiesAsync","_extensionsCreateMaterial","_extensionsLoadMaterialPropertiesAsync","loadMaterialBasePropertiesAsync","pbrMetallicRoughness","loadMaterialAlphaProperties","emissiveFactor","normalTexture","occlusionTexture","ambientTexture","strength","alphaCutoff","textureInfo","_extensionsLoadTextureInfoAsync","texCoord","_textureInfo","_loadTextureAsync","_extensionsLoadTextureAsync","DefaultSampler","_createTextureAsync","textureLoaderOptions","samplerData","_loadSampler","deferred","noMipMaps","loadImageAsync","_GetTextureSamplingMode","_GetTextureWrapMode","_extensionsLoadUriAsync","_ValidateUri","babylonObject","gltf","lights_1","_forEachExtensions","_applyExtensions","functionName","actionAsync","loaderProperty","_activeLoaderExtensionFunctions","activeLoaderExtensionFunctions","onLoading","_loadUriAsync","LoadExtensionAsync","LoadExtraAsync","extra","isExtensionUsed","startPerformanceCounter","endPerformanceCounter","EnvironmentTextureTools","GetEnvInfo","_MagicBytes","manifestString","charCode","manifest","specularDataPosition","CreateEnvTextureAsync","cubeWidth","specularTextures","mipmapsCount","faceWidth","tempTexture","rgbdPostProcess","currentW","currentH","fileReader","irradiance","_CreateEnvTextureIrradiance","mipmaps","infoString","stringify","infoBuffer","infoView","strLen","totalSize","finalBuffer","finalBufferView","setUint8","polynmials","CreateImageDataArrayBufferViews","specularInfo","imageInfo","UploadEnvLevelsAsync","UploadLevelsAsync","_OnImageReadyAsync","generateNonLODTextures","lodTextures","cubeRtt","tempTexture_1","lodTexture","maxLODIndex","lodIndex","mipmapIndex","glTextureFromLod","_loop_3","_loop_4","image_1","UploadEnvSpherical","irradianceInfo","loadedFiles","onfinish","onErrorCallBack","_internalCount","files","_partialLoadFile","loadedImages","_partialLoadImg","createPolynomials","originalRootUrl","onloaddata_1","loadCubeData","supportCascades","_cascadeLoadFiles","_cascadeLoadImgs","imgs","faces","TEXTURE_CUBE_MAP_POSITIVE_Y","TEXTURE_CUBE_MAP_POSITIVE_Z","TEXTURE_CUBE_MAP_NEGATIVE_X","TEXTURE_CUBE_MAP_NEGATIVE_Y","TEXTURE_CUBE_MAP_NEGATIVE_Z","_setCubeMapTextureParams","CubeTexture","prefiltered","_rotationY","_forcedExtension","_createPolynomials","isDDS","isEnv","onLoadProcessing","setReflectionTextureMatrix","CreateFromImages","rootUrlKey","CreateFromPrefilteredData","oldValue","newCubeTexture","RawCubeTexture","updateRGBDAsync","NAME","EXT_lights_image_based","_lights","extensionContext","_loadLightAsync","babylonScene","imageData_1","specularImages","mipmap","specularImageContext","specularImageSize","_babylonTexture","irradianceCoefficients","EXT_mesh_gpu_instancing","translationBuffer","rotationBuffer","scaleBuffer","EXT_texture_webp","WorkerPool","workers","_pendingActions","_workerInfos","terminate","workerInfo","_execute","nextAction","decodeMesh","decoderModule","onIndicesData","onAttributeData","DecoderBuffer","Init","decoder","Decoder","GetEncodedGeometryType","TRIANGULAR_MESH","DecodeBufferToMesh","POINT_CLOUD","PointCloud","DecodeBufferToPointCloud","ok","error_msg","numIndices","num_faces","_malloc","GetTrianglesUInt32Array","HEAPF32","_free","processAttribute","num_components","numPoints","num_points","numValues","GetAttributeDataArrayForAllPoints","DT_FLOAT32","GetAttributeByUniqueId","nativeAttributeTypes","GetAttributeId","GetAttribute","destroy","decoderPromise","DracoDecoderModule","wasmBinary","getAbsoluteUrl","DracoCompression","numWorkers","DefaultNumWorkers","decoderInfo","wasmUrl","wasmBinaryUrl","WebAssembly","wasmBinaryPromise","fallbackUrl","_workerPoolPromise","decoderWasmBinary","workerPromises","_decoderModulePromise","module","GetDefaultNumWorkers","hardwareConcurrency","_Default","workerPool","decodeMeshAsync","dataViewCopy","KHR_draco_mesh_compression","DecoderAvailable","dracoCompression","_dracoBabylonGeometry","Default","babylonVertexData","KHR_lights","babylonLight","babylonSpotLight","outerConeAngle","innerConeAngle","KHR_materials_pbrSpecularGlossiness","_loadSpecularGlossinessPropertiesAsync","diffuseFactor","specularFactor","glossinessFactor","specularGlossinessTexture","reflectivityTexture","KHR_materials_unlit","_loadUnlitPropertiesAsync","KHR_materials_clearcoat","_loadClearCoatPropertiesAsync","clearcoatFactor","clearcoatTexture","clearcoatRoughnessFactor","clearcoatRoughnessTexture","clearcoatNormalTexture","KHR_materials_sheen","_loadSheenPropertiesAsync","sheenColorFactor","sheenColorTexture","sheenRoughnessFactor","sheenRoughnessTexture","KHR_materials_specular","_loadSpecularPropertiesAsync","specularColorFactor","specularTexture","metallicReflectanceTexture","KHR_materials_ior","_loadIorPropertiesAsync","_DEFAULT_IOR","KHR_materials_variants","GetAvailableVariants","extensionMetadata","_GetExtensionMetadata","variants","getAvailableVariants","SelectVariant","variantName","select","entries_1","variantName_1","lastSelected","selectVariant","Reset","original","GetLastSelectedVariant","getLastSelectedVariant","_variants","rootBabylonMesh","variants_1","mappings","mapping","variantIndex","variant","TransmissionHelper","_opaqueRenderTarget","_opaqueMeshesCache","_transparentMeshesCache","_getDefaultOptions","_transmissionHelper","_parseScene","_setupRenderTargets","renderSize","updateOptions","newOptions","oldOptions","getOpaqueTarget","shouldRenderAsTransmission","_addMesh","onMeshMaterialChanged","_removeMesh","transparentIdx","opaqueIdx","opaqueRTIndex","KHR_materials_transmission","_loadTransparentPropertiesAsync","pbrMaterial","transmissionFactor","transmissionTexture","KHR_materials_translucency","_loadTranslucentPropertiesAsync","translucencyFactor","translucencyTexture","KHR_mesh_quantization","KHR_texture_basisu","useRGBAIfASTCBC7NotAvailableWhenUASTC","KHR_texture_transform","AnimationEvent","Sound","urlOrArrayBuffer","readyToPlayCallback","autoplay","useCustomAttenuation","isPlaying","isPaused","spatialSound","refDistance","rolloffFactor","maxDistance","distanceModel","onEndedObservable","_panningModel","_playbackRate","_streaming","_startTime","_startOffset","_positionInEmitterSpace","_volume","_isReadyToPlay","_isDirectional","_coneInnerAngle","_coneOuterAngle","_coneOuterGain","_isOutputConnected","_urlType","_SceneComponentInitialization","_readyToPlayCallback","_customAttenuationFunction","currentVolume","currentDistance","volume","playbackRate","streaming","_offset","_soundGain","gain","_inputAudioNode","_outputAudioNode","_createSpatialParameters","mainSoundTrack","addSound","validParameter","MediaStream","urls","codecSupportedFound","_streamingSource","_soundLoaded","skipCodecCheck","_htmlAudioElement","Audio","controls","preload","removeSound","soundTrackId","soundTracks","_soundPanner","_soundSource","_audioBuffer","_connectedTransformNode","_registerFunc","audioData","setAudioBuffer","audioBuffer","_updateSpatialParameters","loopStart","loopEnd","headphone","panningModel","switchPanningModelToHRTF","_switchPanningModel","switchPanningModelToEqualPower","connectToSoundTrackAudioNode","soundTrackAudioNode","setDirectionalCone","coneInnerAngle","coneOuterAngle","coneOuterGain","setLocalDirectionToMesh","newLocalDirection","_updateDirection","setOrientation","updateDistanceFromListener","setAttenuationFunction","audioEnabled","startTime","onended","_onended","tryToPlay","playPromise","oldSource_1","actualOffset","stopTime","setVolume","newVolume","cancelScheduledValues","setValueAtTime","linearRampToValueAtTime","setPlaybackRate","newPlaybackRate","getVolume","_onRegisterAfterWorldMatrixUpdate","detachFromMesh","setBufferAndRun","clonedSound","getAudioBuffer","currentOptions","getSoundSource","getSoundGain","connectedMeshId","isDirectional","localDirectionToMesh","parsedSound","sourceSound","soundUrl","soundName","newSound","soundPosition","connectedMesh","WeightedSound","sounds","_sounds","_weights","weightSum","weights_1","invWeightSum","directionalConeInnerAngle","directionalConeOuterAngle","_currentIndex","startOffset","randomValue","sound","MSFT_audio_emitter","_clips","_emitters","clips","emitters","emitterIndex","_loadEmitterAsync","_babylonSounds","event_1","_loadAnimationEventAsync","_loadClipAsync","_objectURL","_babylonData","clipPromises","options_1","clipContext","objectURL","weightedSound","_getEventAction","babylonAnimationEvent","MSFT_lod","maxLODsToLoad","onNodeLODsLoadedObservable","onMaterialLODsLoadedObservable","_bufferLODs","_nodeIndexLOD","_nodeSignalLODs","_nodePromiseLODs","_nodeBufferLODs","_materialIndexLOD","_materialSignalLODs","_materialPromiseLODs","_materialBufferLODs","indexLOD","_loadBufferLOD","this_2","firstPromise","nodeLODs","_getLODs","nodeLOD","previousNodeLOD","_disposeTransformNode","materialLODs","materialLOD","previousDataLOD","_disposeMaterials","previousIndexLOD","bufferLODs","bufferLOD","babylonMaterials","babylonMaterialsToDispose","every","babylonTextures","babylonMaterials_1","MSFT_minecraftMesh","extraContext","MSFT_sRGBFactors","ExtrasAsMetadata","_assignExtras","gltfProp","exports","utils","settle","cookies","buildURL","buildFullPath","parseHeaders","isURLSameOrigin","createError","config","requestData","requestHeaders","headers","isFormData","auth","username","password","unescape","encodeURIComponent","Authorization","btoa","fullPath","baseURL","responseHeaders","getAllResponseHeaders","params","paramsSerializer","onreadystatechange","onabort","ontimeout","timeoutErrorMessage","transitional","clarifyTimeoutError","isStandardBrowserEnv","xsrfValue","withCredentials","xsrfCookieName","xsrfHeaderName","isUndefined","onDownloadProgress","onUploadProgress","upload","cancelToken","cancel","Axios","mergeConfig","defaultConfig","axios","instanceConfig","defaults","Cancel","CancelToken","isCancel","spread","isAxiosError","default","__CANCEL__","executor","TypeError","resolvePromise","throwIfRequested","InterceptorManager","dispatchRequest","validator","validators","interceptors","assertOptions","silentJSONParsing","boolean","forcedJSONParsing","requestInterceptorChain","synchronousRequestInterceptors","interceptor","runWhen","synchronous","fulfilled","rejected","responseInterceptorChain","chain","newConfig","getUri","handlers","use","eject","isAbsoluteURL","combineURLs","requestedURL","enhanceError","transformData","throwIfCancellationRequested","transformRequest","common","adapter","transformResponse","toJSON","columnNumber","config1","config2","valueFromConfig2Keys","mergeDeepPropertiesKeys","defaultToConfig2Keys","directMergeKeys","getMergedValue","isPlainObject","mergeDeepProperties","axiosKeys","otherKeys","validateStatus","fns","normalizeHeaderName","DEFAULT_CONTENT_TYPE","setContentTypeIfUnset","isArrayBuffer","isBuffer","isStream","isFile","isBlob","isArrayBufferView","isURLSearchParams","isObject","strictJSONParsing","isString","maxContentLength","maxBodyLength","thisArg","encode","serializedParams","parts","isDate","toISOString","hashmarkIndex","relativeURL","write","expires","domain","secure","cookie","isNumber","toGMTString","payload","originURL","msie","urlParsingNode","resolveURL","hostname","port","pathname","requestURL","normalizedName","ignoreDuplicateOf","pkg","deprecatedWarnings","currentVerArr","isOlderVersion","thanVersion","pkgVersionArr","destVer","isDeprecated","formatMessage","opt","desc","opts","schema","allowUnknown","isFunction","FormData","pipe","URLSearchParams","product","assignValue","stripBOM","clip_rgb","_clipped","_unclipped","classToType","unpack","keyOrder","TWOPI","PITHIRD","DEG2RAD","RAD2DEG","autodetect","last$1","clip_rgb$1","type$1","Color","me","sorted","chk","_rgb","Color_1","Function","chroma_1","unpack$1","rgb2cmyk_1","unpack$2","cmyk2rgb_1","unpack$3","type$2","cmyk","unpack$4","last$2","rnd","hsl2css_1","hsla","unpack$5","rgb2hsl_1","unpack$6","last$3","rgb2css_1","rgba","unpack$7","round$1","hsl2rgb_1","t3","h_","RE_RGB","RE_RGBA","RE_RGB_PCT","RE_RGBA_PCT","RE_HSL","RE_HSLA","round$2","css2rgb","css","named","rgb$1","i$1","rgb$2","i$2","rgb$3","i$3","hsl","rgb$4","hsl$1","rgb$5","css2rgb_1","type$3","unpack$8","unpack$9","rgb2hcg_1","unpack$a","hcg2rgb_1","assign$1","assign$2","assign$3","assign$4","assign$5","unpack$b","type$4","hcg","unpack$c","last$4","round$3","rgb2hex_1","hxa","RE_HEX","RE_HEXA","hex2rgb_1","u$1","type$5","unpack$d","rgb2hsi_1","min_","unpack$e","limit$1","TWOPI$1","hsi2rgb_1","unpack$f","type$6","hsi","unpack$g","type$7","unpack$h","min$1","max$1","rgb2hsv","max_","unpack$i","floor$1","hsv2rgb_1","unpack$j","type$8","hsv","labConstants","Kn","Xn","Yn","Zn","unpack$k","rgb2lab","ref$1","rgb2xyz","rgb_xyz","xyz_lab","rgb2lab_1","unpack$l","pow$1","lab2rgb","lab_xyz","xyz_rgb","lab2rgb_1","unpack$m","type$9","lab","unpack$n","sqrt$1","round$4","lab2lch_1","unpack$o","rgb2lch_1","b_","unpack$p","cos$1","lch2lab_1","unpack$q","lch2rgb_1","L","unpack$r","hcl2rgb_1","hcl","unpack$s","type$a","lch","w3cx11_1","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflower","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","laserlemon","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrod","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","maroon2","maroon3","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","purple2","purple3","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","type$b","unpack$t","rgb2num_1","type$c","num2rgb_1","type$d","unpack$u","type$e","round$5","temperature2rgb_1","kelvin","unpack$v","round$6","rgb2temperature_1","minTemp","maxTemp","eps","temperature","type$f","mutate","clipped","darken","brighten","darker","brighter","mc","type$g","pow$2","EPS","MAX_ITER","luminance","lum","cur_lum","max_iter","low","high","mid","interpolate","rgb2luminance","luminance_x","interpolator","type$h","mix","col1","col2","premultiply","saturate","desaturate","type$i","out","xyz0","xyz1","sqrt$2","pow$3","lrgb","lab$1","_hsx","hue0","hue1","sat0","sat1","lbv0","lbv1","sat","lch$1","num$1","c2","hcg$1","hsi$1","hsv$1","clip_rgb$2","pow$4","sqrt$3","PI$1","cos$2","sin$1","atan2$1","_average_lrgb","xyz","cnt","A","ci","xyz2","A$1","col","type$j","pow$5","_nacol","_spread","_domain","_padding","_classes","_colors","_out","_correctLightness","_colorCache","_useCache","_gamma","setColors","brewer","c$1","resetCache","getClass","tMapLightness","tMapDomain","getColor","bypassMap","analyze","limits","tOut","tBreaks","correctLightness","L0","L1","pol","L_actual","L_ideal","L_diff","padding","numColors","dd","__range__","asc","nodata","inclusive","ascending","bezier","I","lab0","lab1","lab2","lab3","I0","I1","bezier_1","blend","blend_f","c0","each","darken$1","lighten","screen","overlay","burn","dodge","blend_1","type$k","clip_rgb$3","TWOPI$2","pow$6","sin$2","cos$3","cubehelix","rotations","lightness","dl","dh","amp","cos_a","sin_a","digits","floor$2","random_1","log$1","pow$7","floor$3","sum","min_log","LOG10E","max_log","pb","pr","cluster","assignments","clusterSizes","repeat","nb_iters","centroids","i$4","mindist","best","j$1","newCentroids","j$2","i$5","j$3","j$4","kClusters","j$5","i$6","tmpKMeansBreaks","j$6","i$7","analyze_1","sqrt$4","atan2$2","abs$1","cos$4","PI$2","deltaE","C","b1","L2","b2","sl","h1","c4","delC","delA","delB","sum_sq","scales","cool","hot","colorbrewer","OrRd","PuBu","BuPu","Oranges","BuGn","YlOrBr","YlGn","Reds","RdPu","Greens","YlGnBu","Purples","GnBu","Greys","YlOrRd","PuRd","Blues","PuBuGn","Viridis","Spectral","RdYlGn","RdBu","PiYG","PRGn","RdYlBu","BrBG","RdGy","PuOr","Set2","Accent","Set1","Set3","Dark2","Paired","Pastel2","Pastel1","list$1","colorbrewer_1","strFileName","strMimeType","defaultMime","anchor","myBlob","MozBlob","WebKitBlob","ajax","dataUrlToBlob","saver","tempUiArr","mx","strUrl","binData","uiArr","winMode","confirm","CustomLoadingScreen","legendData","zScale","allLoaded","resetAnimation","setLooping","looping","Plot","colorVar","_coords","_coordColors","getPick","matrixMax","matrixMin","getUniqueVals","seen","Set","has","CoordinatePlot","PLOTTYPES","plotData","plotIdx","plot","pltType","canvasElement","_showLegend","_hasAnim","_loopingAnim","_axes","_downloadObj","_recording","_turned","_wasTurning","_xScale","_yScale","_zScale","_fsUIDirty","_upAxis","plots","ymax","R","Python","shapeLegendTitle","animPaused","_uniqID","backgroundColor","turntable","rotationRate","upAxis","_backgroundColor","_updateCameraUpVector","_hl1","_hl2","uiLayer","_annotationManager","AnnotationManager","_prepRender","_afterRender","styleElem","createTextNode","styleText","buttonBar","clientTop","clientLeft","parentNode","_buttonBar","streamCtrlBtn","onclick","_streamControlBtn","pauseAnimation","playAnimation","streamCtrlLoading","buttonSVGs","loading","streamCtrlPlay","streamCtrlPause","animRange","onchange","setAnimationFrame","_animationSlider","_evt","dpInfo","displayInfo","fromJSON","addImgStack","colorScale","showLegend","fontColor","legendTitle","legendTitleFontSize","legendTitleFontColor","legendPosition","showAxes","axisLabels","axisColors","tickBreaks","showTickLines","tickLineColors","channelColors","channelOpacities","addMeshObject","meshScaling","meshRotation","meshOffset","addMeshStream","addPlot","customColorScale","colorScaleInverted","sortedCategories","legendShowShape","hasAnimation","animationTargets","animationDelay","animationDuration","animationLoop","folded","foldedEmbedding","foldAnimDelay","foldAnimDuration","foldAnimLoop","colnames","rownames","shading","addClusterLabels","fixedLabels","labelData","addLabels","addLabel","createButtons","whichBtns","turntableBtn","toggleTurntable","_turntableBtn","jsonBtn","_downloadJson","toJson","labelBtn","toggleLabelControl","labels","recordBtn","_startRecording","record","publishBtn","_createPublishForm","publish","_prepDownloadObj","exportLabels","dlElement","dlContent","_publishFormOverlay","formOverlay","formBox","margin","borderRadius","boxShadow","formInfo","innerText","usernameLabel","usernameInput","passwordLabel","passwordInput","titleLabel","titleInput","msg","_tryPublish","cancelBtn","_cancelPublish","closeBtn","_resizePublishOverlay","thumbnail","thumb_data","plotName","thumb","_resetAnimation","rangeX","rangeY","rangeZ","axisData","animPlot","_toggleLoopAnimation","_loopBtn","anyAnim","_updateLegend","redrawInfo","_capturer","CCapture","framerate","verbose","workersPath","loadingOverlay","loadingText","_cameraFitPlot","xRange","yRange","zRange","xSize","ySize","zSize","xCenter","yCenter","zCenter","halfMinFov","viewRadius","plotType","discrete","breaks","inverted","ImgStack","dim","colorBy","labelSize","labelColor","deprecationWarning","coordColors","replayBtn","replay","loopBtn","uniqueGroups","nColors","colorIndex","cl","showShape","Surface","ShapeCloud","HeatMap","static","tickLineColor","showPlanes","planeColor","Axes","meshString","MeshObject","filePrefix","fileSuffix","fileIteratorStart","fileIteratorEnd","frameDelay","clearCoatIntensity","MeshStream","frameTotal","_legend","spaceLeft","spaceRight","rightFree","leftFree","shapeSpace","shapes","_shapeLegendPosition","shapeLegendData","spacing","shapeLegendDrawn","lgndData","_createPlotLegend","_drawStandaloneShapeLegend","grid","legendWidth","legendColumn","shapeLegendGrid","_createShapeLegend","breakN","legendMinPixels","nCols","legendBodyHeight","totalReqPixels","shapeBodyHeight","legendBody","innerGrid","legendColor","legendText","nBreaks","labelSpace","scaleGrid","labelGrid","minText","maxText","shapeLegendBody","rowHeight","shapeDef","legendSVGs","shapeIcon","shapeText","doRender","pad","saveCallback","labelList","Plots","_createHeatMap","boxes","rowCoords","coord","newAlpha","colSize","rowSize","channelSize","sliceSize","coords","Intensities","sliceIndex","_channelCoords","_channelCoordIntensities","_channelColors","_channelOpacities","_createImgStack","channelIntensities","channelCoords","channelColor","channelColorRGB","minIntensity","alphaPositions","alphaColors","alphaIntensities","intens","testIntensity","intensIdx","customMesh","colormix","annotationManager","_looping","_animDirection","_animationFrames","_animationDelay","_hasAnimation","_addLabels","_createLine","lineCoords","pointColor","fixLabels","__","LOCAL","_filenames","_prevTime","_containers","_clearCoat","_clearCoatIntensity","iter","_createMeshStream","loadingContainers","_loadMesh","firstScene","fi","timeNow","_animationVectors","_animationCounter","_animationVectorFract","fv","_animationTargets","_createPointCloud","pointGroups","pointGroupColors","pointGroupNames","colorIdx","colorNameIdx","sumFun","curr","pointGroup","centroid","numberOfVertices","posVector","vectorFractDir","_tNodes","_shape","_shading","_createShapeCloud","origMesh","matricesData","colorData","pickCoords","tNode","_createSurface","surface","heatmap","_axisLabels","_ticks","_tickLabels","_tickLines","_createAxes","_roundTicks","includes","sig","xtickBreaks","ytickBreaks","ztickBreaks","ymin","xChar","_makeTextPlane","xTicks","startTick","tickPos","tick","tickLabel","tickChar","tickLine","axisY","yChar","yTicks","zChar","zTicks","dynamicTexture","updateAxisData","tip","_tip","_bgColor","_txtColor","_uiLayer","rows","maxRowLen","_closeBtn","fixed","makeDraggable","_label","setText","fix","unfix","export","fullScreenUI","uniqID","_editLabelForms","_showLabels","_arrows","_showArrows","dpInfos","fixedArrows","_ymax","_fgColor","_fullScreenUI","_createLabelForms","labelBox","addLabelForm","addLabelLabel","htmlFor","addLabelInput","_addLabelTextInput","addLabelBtn","_addLabelBtnClick","editLabelContainer","_editLabelContainer","_labelControlBox","unfixLabels","addArrow","Arrow","alreadyShown","clearInfo","labelIdx","newLabel","Label","editLabelForm","editLabelLabel","editLabelInput","dataset","labelnum","onkeyup","_editLabelText","rmvLabelBtn","_removeLabel","inputElem","thisForm","labelNum","eLabelForm","oldNum","newNum","labelDragBehavior","logo","shape_box","shape_cone","shape_cylinder","shape_sphere","shape_torus","deprecated","alternative","extendStatics","__extends","__assign","__decorate","decorators","getOwnPropertyDescriptor","Reflect","decorate","__spreadArrays","il","jl","getRandomValues","crypto","msCrypto","rnds8","rng","uuid","byteToHex","_nodeId","_clockseq","_lastMSecs","_lastNSecs","clockseq","seedBytes","msecs","nsecs","tl","tmh","hashfunc","generateUUID","namespace","stringToBytes","DNS","getOutputLength","inputLength8","safeAdd","lsw","md5cmn","md5ff","md5gg","md5hh","md5ii","v35","length32","hexTab","md5ToHexEncodedArray","olda","oldb","oldc","oldd","wordsToMd5","length8","bytesToWords","rnds","ROTL","K","H","M","_i2","W","_t","T","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","definition","Symbol","toStringTag","__webpack_exports__"],"mappings":";0KAsBIA,EAA2B,WAU3B,SAASA,EAETC,EAEAC,EAEAC,EAEAC,EAEAC,EAEAC,GACIC,KAAKN,KAAOA,EACZM,KAAKL,eAAiBA,EACtBK,KAAKJ,eAAiBA,EACtBI,KAAKH,SAAWA,EAChBG,KAAKF,SAAWA,EAChBE,KAAKD,eAAiBA,EAItBC,KAAKC,mBAAqB,IAAIC,MAI9BF,KAAKG,QAAU,IAAID,MAInBF,KAAKI,cAAgB,IAIrBJ,KAAKK,QAAU,GACfL,KAAKM,mBAAqBX,EAAeY,MAAM,KAC/CP,KAAKH,SAAWA,EAChBG,KAAKF,cAAwBU,IAAbV,EAAyBL,EAAUgB,wBAA0BX,EA4kCjF,OAvkCAL,EAAUiB,kBAAoB,SAAUhB,EAAMC,EAAgBC,EAAgBe,EAAYC,EAAMC,EAAIf,EAAUgB,GAC1G,IAAIjB,OAAWW,EAsBf,IArBKO,MAAMC,WAAWJ,KAAUK,SAASL,GACrCf,EAAWJ,EAAUyB,oBAEhBN,aAAgB,KACrBf,EAAWJ,EAAU0B,yBAEhBP,aAAgB,IACrBf,EAAWJ,EAAU2B,sBAEhBR,aAAgB,KACrBf,EAAWJ,EAAU4B,sBAEhBT,aAAgB,KACrBf,EAAWJ,EAAU6B,qBAEhBV,aAAgB,KACrBf,EAAWJ,EAAU8B,qBAEhBX,aAAgB,MACrBf,EAAWJ,EAAU+B,oBAEThB,MAAZX,EACA,OAAO,KAEX,IAAI4B,EAAY,IAAIhC,EAAUC,EAAMC,EAAgBC,EAAgBC,EAAUC,GAC1E4B,EAAO,CAAC,CAAEC,MAAO,EAAGC,M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AAoBF,GAAUx/V,KAAK28S,EAAO2S,QAAS3S,EAAQA,EAAO2S,QAASiwC,GAGpE5iD,EAAO2S,QCpBfiwC,EAAoBr0W,EAAI,CAACokU,EAASqwC,KACjC,IAAI,IAAI9+W,KAAO8+W,EACXJ,EAAoBzwW,EAAE6wW,EAAY9+W,KAAS0+W,EAAoBzwW,EAAEwgU,EAASzuU,IAC5EsB,OAAOC,eAAektU,EAASzuU,EAAK,CAAE0B,YAAY,EAAMD,IAAKq9W,EAAW9+W,MCJ3E0+W,EAAoBzwW,EAAI,CAAC22L,EAAKz3E,IAAU7rH,OAAOE,UAAUksE,eAAevuD,KAAKylL,EAAKz3E,GCClFuxP,EAAoB90U,EAAK6kS,IACH,oBAAXswC,QAA0BA,OAAOC,aAC1C19W,OAAOC,eAAektU,EAASswC,OAAOC,YAAa,CAAEliX,MAAO,WAE7DwE,OAAOC,eAAektU,EAAS,aAAc,CAAE3xU,OAAO,KCFvD,IAAImiX,EAAsBP,EAAoB,M","file":"babyplots.js","sourcesContent":["import { Vector3, Quaternion, Vector2, Matrix, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Color3, Color4 } from '../Maths/math.color';\r\nimport { Scalar } from \"../Maths/math.scalar\";\r\nimport { SerializationHelper } from \"../Misc/decorators\";\r\nimport { _TypeStore } from '../Misc/typeStore';\r\nimport { AnimationKeyInterpolation } from './animationKey';\r\nimport { AnimationRange } from './animationRange';\r\nimport { Node } from \"../node\";\r\nimport { Size } from '../Maths/math.size';\r\nimport { WebRequest } from '../Misc/webRequest';\r\n/**\r\n * @hidden\r\n */\r\nvar _IAnimationState = /** @class */ (function () {\r\n function _IAnimationState() {\r\n }\r\n return _IAnimationState;\r\n}());\r\nexport { _IAnimationState };\r\n/**\r\n * Class used to store any kind of animation\r\n */\r\nvar Animation = /** @class */ (function () {\r\n /**\r\n * Initializes the animation\r\n * @param name Name of the animation\r\n * @param targetProperty Property to animate\r\n * @param framePerSecond The frames per second of the animation\r\n * @param dataType The data type of the animation\r\n * @param loopMode The loop mode of the animation\r\n * @param enableBlending Specifies if blending should be enabled\r\n */\r\n function Animation(\r\n /**Name of the animation */\r\n name, \r\n /**Property to animate */\r\n targetProperty, \r\n /**The frames per second of the animation */\r\n framePerSecond, \r\n /**The data type of the animation */\r\n dataType, \r\n /**The loop mode of the animation */\r\n loopMode, \r\n /**Specifies if blending should be enabled */\r\n enableBlending) {\r\n this.name = name;\r\n this.targetProperty = targetProperty;\r\n this.framePerSecond = framePerSecond;\r\n this.dataType = dataType;\r\n this.loopMode = loopMode;\r\n this.enableBlending = enableBlending;\r\n /**\r\n * @hidden Internal use only\r\n */\r\n this._runtimeAnimations = new Array();\r\n /**\r\n * The set of event that will be linked to this animation\r\n */\r\n this._events = new Array();\r\n /**\r\n * Stores the blending speed of the animation\r\n */\r\n this.blendingSpeed = 0.01;\r\n /**\r\n * Stores the animation ranges for the animation\r\n */\r\n this._ranges = {};\r\n this.targetPropertyPath = targetProperty.split(\".\");\r\n this.dataType = dataType;\r\n this.loopMode = loopMode === undefined ? Animation.ANIMATIONLOOPMODE_CYCLE : loopMode;\r\n }\r\n /**\r\n * @hidden Internal use\r\n */\r\n Animation._PrepareAnimation = function (name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction) {\r\n var dataType = undefined;\r\n if (!isNaN(parseFloat(from)) && isFinite(from)) {\r\n dataType = Animation.ANIMATIONTYPE_FLOAT;\r\n }\r\n else if (from instanceof Quaternion) {\r\n dataType = Animation.ANIMATIONTYPE_QUATERNION;\r\n }\r\n else if (from instanceof Vector3) {\r\n dataType = Animation.ANIMATIONTYPE_VECTOR3;\r\n }\r\n else if (from instanceof Vector2) {\r\n dataType = Animation.ANIMATIONTYPE_VECTOR2;\r\n }\r\n else if (from instanceof Color3) {\r\n dataType = Animation.ANIMATIONTYPE_COLOR3;\r\n }\r\n else if (from instanceof Color4) {\r\n dataType = Animation.ANIMATIONTYPE_COLOR4;\r\n }\r\n else if (from instanceof Size) {\r\n dataType = Animation.ANIMATIONTYPE_SIZE;\r\n }\r\n if (dataType == undefined) {\r\n return null;\r\n }\r\n var animation = new Animation(name, targetProperty, framePerSecond, dataType, loopMode);\r\n var keys = [{ frame: 0, value: from }, { frame: totalFrame, value: to }];\r\n animation.setKeys(keys);\r\n if (easingFunction !== undefined) {\r\n animation.setEasingFunction(easingFunction);\r\n }\r\n return animation;\r\n };\r\n /**\r\n * Sets up an animation\r\n * @param property The property to animate\r\n * @param animationType The animation type to apply\r\n * @param framePerSecond The frames per second of the animation\r\n * @param easingFunction The easing function used in the animation\r\n * @returns The created animation\r\n */\r\n Animation.CreateAnimation = function (property, animationType, framePerSecond, easingFunction) {\r\n var animation = new Animation(property + \"Animation\", property, framePerSecond, animationType, Animation.ANIMATIONLOOPMODE_CONSTANT);\r\n animation.setEasingFunction(easingFunction);\r\n return animation;\r\n };\r\n /**\r\n * Create and start an animation on a node\r\n * @param name defines the name of the global animation that will be run on all nodes\r\n * @param node defines the root node where the animation will take place\r\n * @param targetProperty defines property to animate\r\n * @param framePerSecond defines the number of frame per second yo use\r\n * @param totalFrame defines the number of frames in total\r\n * @param from defines the initial value\r\n * @param to defines the final value\r\n * @param loopMode defines which loop mode you want to use (off by default)\r\n * @param easingFunction defines the easing function to use (linear by default)\r\n * @param onAnimationEnd defines the callback to call when animation end\r\n * @returns the animatable created for this animation\r\n */\r\n Animation.CreateAndStartAnimation = function (name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {\r\n var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\r\n if (!animation) {\r\n return null;\r\n }\r\n return node.getScene().beginDirectAnimation(node, [animation], 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);\r\n };\r\n /**\r\n * Create and start an animation on a node and its descendants\r\n * @param name defines the name of the global animation that will be run on all nodes\r\n * @param node defines the root node where the animation will take place\r\n * @param directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used\r\n * @param targetProperty defines property to animate\r\n * @param framePerSecond defines the number of frame per second to use\r\n * @param totalFrame defines the number of frames in total\r\n * @param from defines the initial value\r\n * @param to defines the final value\r\n * @param loopMode defines which loop mode you want to use (off by default)\r\n * @param easingFunction defines the easing function to use (linear by default)\r\n * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)\r\n * @returns the list of animatables created for all nodes\r\n * @example https://www.babylonjs-playground.com/#MH0VLI\r\n */\r\n Animation.CreateAndStartHierarchyAnimation = function (name, node, directDescendantsOnly, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {\r\n var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\r\n if (!animation) {\r\n return null;\r\n }\r\n var scene = node.getScene();\r\n return scene.beginDirectHierarchyAnimation(node, directDescendantsOnly, [animation], 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);\r\n };\r\n /**\r\n * Creates a new animation, merges it with the existing animations and starts it\r\n * @param name Name of the animation\r\n * @param node Node which contains the scene that begins the animations\r\n * @param targetProperty Specifies which property to animate\r\n * @param framePerSecond The frames per second of the animation\r\n * @param totalFrame The total number of frames\r\n * @param from The frame at the beginning of the animation\r\n * @param to The frame at the end of the animation\r\n * @param loopMode Specifies the loop mode of the animation\r\n * @param easingFunction (Optional) The easing function of the animation, which allow custom mathematical formulas for animations\r\n * @param onAnimationEnd Callback to run once the animation is complete\r\n * @returns Nullable animation\r\n */\r\n Animation.CreateMergeAndStartAnimation = function (name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {\r\n var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\r\n if (!animation) {\r\n return null;\r\n }\r\n node.animations.push(animation);\r\n return node.getScene().beginAnimation(node, 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);\r\n };\r\n /**\r\n * Convert the keyframes for all animations belonging to the group to be relative to a given reference frame.\r\n * @param sourceAnimation defines the Animation containing keyframes to convert\r\n * @param referenceFrame defines the frame that keyframes in the range will be relative to\r\n * @param range defines the name of the AnimationRange belonging to the Animation to convert\r\n * @param cloneOriginal defines whether or not to clone the animation and convert the clone or convert the original animation (default is false)\r\n * @param clonedName defines the name of the resulting cloned Animation if cloneOriginal is true\r\n * @returns a new Animation if cloneOriginal is true or the original Animation if cloneOriginal is false\r\n */\r\n Animation.MakeAnimationAdditive = function (sourceAnimation, referenceFrame, range, cloneOriginal, clonedName) {\r\n if (referenceFrame === void 0) { referenceFrame = 0; }\r\n if (cloneOriginal === void 0) { cloneOriginal = false; }\r\n var animation = sourceAnimation;\r\n if (cloneOriginal) {\r\n animation = sourceAnimation.clone();\r\n animation.name = clonedName || animation.name;\r\n }\r\n if (!animation._keys.length) {\r\n return animation;\r\n }\r\n referenceFrame = referenceFrame >= 0 ? referenceFrame : 0;\r\n var startIndex = 0;\r\n var firstKey = animation._keys[0];\r\n var endIndex = animation._keys.length - 1;\r\n var lastKey = animation._keys[endIndex];\r\n var valueStore = {\r\n referenceValue: firstKey.value,\r\n referencePosition: TmpVectors.Vector3[0],\r\n referenceQuaternion: TmpVectors.Quaternion[0],\r\n referenceScaling: TmpVectors.Vector3[1],\r\n keyPosition: TmpVectors.Vector3[2],\r\n keyQuaternion: TmpVectors.Quaternion[1],\r\n keyScaling: TmpVectors.Vector3[3]\r\n };\r\n var referenceFound = false;\r\n var from = firstKey.frame;\r\n var to = lastKey.frame;\r\n if (range) {\r\n var rangeValue = animation.getRange(range);\r\n if (rangeValue) {\r\n from = rangeValue.from;\r\n to = rangeValue.to;\r\n }\r\n }\r\n var fromKeyFound = firstKey.frame === from;\r\n var toKeyFound = lastKey.frame === to;\r\n // There's only one key, so use it\r\n if (animation._keys.length === 1) {\r\n var value = animation._getKeyValue(animation._keys[0]);\r\n valueStore.referenceValue = value.clone ? value.clone() : value;\r\n referenceFound = true;\r\n }\r\n // Reference frame is before the first frame, so just use the first frame\r\n else if (referenceFrame <= firstKey.frame) {\r\n var value = animation._getKeyValue(firstKey.value);\r\n valueStore.referenceValue = value.clone ? value.clone() : value;\r\n referenceFound = true;\r\n }\r\n // Reference frame is after the last frame, so just use the last frame\r\n else if (referenceFrame >= lastKey.frame) {\r\n var value = animation._getKeyValue(lastKey.value);\r\n valueStore.referenceValue = value.clone ? value.clone() : value;\r\n referenceFound = true;\r\n }\r\n // Find key bookends, create them if they don't exist\r\n var index = 0;\r\n while (!referenceFound || !fromKeyFound || !toKeyFound && index < animation._keys.length - 1) {\r\n var currentKey = animation._keys[index];\r\n var nextKey = animation._keys[index + 1];\r\n // If reference frame wasn't found yet, check if we can interpolate to it\r\n if (!referenceFound && referenceFrame >= currentKey.frame && referenceFrame <= nextKey.frame) {\r\n var value = void 0;\r\n if (referenceFrame === currentKey.frame) {\r\n value = animation._getKeyValue(currentKey.value);\r\n }\r\n else if (referenceFrame === nextKey.frame) {\r\n value = animation._getKeyValue(nextKey.value);\r\n }\r\n else {\r\n var animationState = {\r\n key: index,\r\n repeatCount: 0,\r\n loopMode: this.ANIMATIONLOOPMODE_CONSTANT\r\n };\r\n value = animation._interpolate(referenceFrame, animationState);\r\n }\r\n valueStore.referenceValue = value.clone ? value.clone() : value;\r\n referenceFound = true;\r\n }\r\n // If from key wasn't found yet, check if we can interpolate to it\r\n if (!fromKeyFound && from >= currentKey.frame && from <= nextKey.frame) {\r\n if (from === currentKey.frame) {\r\n startIndex = index;\r\n }\r\n else if (from === nextKey.frame) {\r\n startIndex = index + 1;\r\n }\r\n else {\r\n var animationState = {\r\n key: index,\r\n repeatCount: 0,\r\n loopMode: this.ANIMATIONLOOPMODE_CONSTANT\r\n };\r\n var value = animation._interpolate(from, animationState);\r\n var key = {\r\n frame: from,\r\n value: value.clone ? value.clone() : value\r\n };\r\n animation._keys.splice(index + 1, 0, key);\r\n startIndex = index + 1;\r\n }\r\n fromKeyFound = true;\r\n }\r\n // If to key wasn't found yet, check if we can interpolate to it\r\n if (!toKeyFound && to >= currentKey.frame && to <= nextKey.frame) {\r\n if (to === currentKey.frame) {\r\n endIndex = index;\r\n }\r\n else if (to === nextKey.frame) {\r\n endIndex = index + 1;\r\n }\r\n else {\r\n var animationState = {\r\n key: index,\r\n repeatCount: 0,\r\n loopMode: this.ANIMATIONLOOPMODE_CONSTANT\r\n };\r\n var value = animation._interpolate(to, animationState);\r\n var key = {\r\n frame: to,\r\n value: value.clone ? value.clone() : value\r\n };\r\n animation._keys.splice(index + 1, 0, key);\r\n endIndex = index + 1;\r\n }\r\n toKeyFound = true;\r\n }\r\n index++;\r\n }\r\n // Conjugate the quaternion\r\n if (animation.dataType === Animation.ANIMATIONTYPE_QUATERNION) {\r\n valueStore.referenceValue.normalize().conjugateInPlace();\r\n }\r\n // Decompose matrix and conjugate the quaternion\r\n else if (animation.dataType === Animation.ANIMATIONTYPE_MATRIX) {\r\n valueStore.referenceValue.decompose(valueStore.referenceScaling, valueStore.referenceQuaternion, valueStore.referencePosition);\r\n valueStore.referenceQuaternion.normalize().conjugateInPlace();\r\n }\r\n // Subtract the reference value from all of the key values\r\n for (var index = startIndex; index <= endIndex; index++) {\r\n var key = animation._keys[index];\r\n // If this key was duplicated to create a frame 0 key, skip it because its value has already been updated\r\n if (index && animation.dataType !== Animation.ANIMATIONTYPE_FLOAT && key.value === firstKey.value) {\r\n continue;\r\n }\r\n switch (animation.dataType) {\r\n case Animation.ANIMATIONTYPE_MATRIX:\r\n key.value.decompose(valueStore.keyScaling, valueStore.keyQuaternion, valueStore.keyPosition);\r\n valueStore.keyPosition.subtractInPlace(valueStore.referencePosition);\r\n valueStore.keyScaling.divideInPlace(valueStore.referenceScaling);\r\n valueStore.referenceQuaternion.multiplyToRef(valueStore.keyQuaternion, valueStore.keyQuaternion);\r\n Matrix.ComposeToRef(valueStore.keyScaling, valueStore.keyQuaternion, valueStore.keyPosition, key.value);\r\n break;\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n valueStore.referenceValue.multiplyToRef(key.value, key.value);\r\n break;\r\n case Animation.ANIMATIONTYPE_VECTOR2:\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n case Animation.ANIMATIONTYPE_COLOR4:\r\n key.value.subtractToRef(valueStore.referenceValue, key.value);\r\n break;\r\n case Animation.ANIMATIONTYPE_SIZE:\r\n key.value.width -= valueStore.referenceValue.width;\r\n key.value.height -= valueStore.referenceValue.height;\r\n break;\r\n default:\r\n key.value -= valueStore.referenceValue;\r\n }\r\n }\r\n return animation;\r\n };\r\n /**\r\n * Transition property of an host to the target Value\r\n * @param property The property to transition\r\n * @param targetValue The target Value of the property\r\n * @param host The object where the property to animate belongs\r\n * @param scene Scene used to run the animation\r\n * @param frameRate Framerate (in frame/s) to use\r\n * @param transition The transition type we want to use\r\n * @param duration The duration of the animation, in milliseconds\r\n * @param onAnimationEnd Callback trigger at the end of the animation\r\n * @returns Nullable animation\r\n */\r\n Animation.TransitionTo = function (property, targetValue, host, scene, frameRate, transition, duration, onAnimationEnd) {\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n if (duration <= 0) {\r\n host[property] = targetValue;\r\n if (onAnimationEnd) {\r\n onAnimationEnd();\r\n }\r\n return null;\r\n }\r\n var endFrame = frameRate * (duration / 1000);\r\n transition.setKeys([{\r\n frame: 0,\r\n value: host[property].clone ? host[property].clone() : host[property]\r\n },\r\n {\r\n frame: endFrame,\r\n value: targetValue\r\n }]);\r\n if (!host.animations) {\r\n host.animations = [];\r\n }\r\n host.animations.push(transition);\r\n var animation = scene.beginAnimation(host, 0, endFrame, false);\r\n animation.onAnimationEnd = onAnimationEnd;\r\n return animation;\r\n };\r\n Object.defineProperty(Animation.prototype, \"runtimeAnimations\", {\r\n /**\r\n * Return the array of runtime animations currently using this animation\r\n */\r\n get: function () {\r\n return this._runtimeAnimations;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation.prototype, \"hasRunningRuntimeAnimations\", {\r\n /**\r\n * Specifies if any of the runtime animations are currently running\r\n */\r\n get: function () {\r\n for (var _i = 0, _a = this._runtimeAnimations; _i < _a.length; _i++) {\r\n var runtimeAnimation = _a[_i];\r\n if (!runtimeAnimation.isStopped) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Converts the animation to a string\r\n * @param fullDetails support for multiple levels of logging within scene loading\r\n * @returns String form of the animation\r\n */\r\n Animation.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name + \", property: \" + this.targetProperty;\r\n ret += \", datatype: \" + ([\"Float\", \"Vector3\", \"Quaternion\", \"Matrix\", \"Color3\", \"Vector2\"])[this.dataType];\r\n ret += \", nKeys: \" + (this._keys ? this._keys.length : \"none\");\r\n ret += \", nRanges: \" + (this._ranges ? Object.keys(this._ranges).length : \"none\");\r\n if (fullDetails) {\r\n ret += \", Ranges: {\";\r\n var first = true;\r\n for (var name in this._ranges) {\r\n if (first) {\r\n ret += \", \";\r\n first = false;\r\n }\r\n ret += name;\r\n }\r\n ret += \"}\";\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Add an event to this animation\r\n * @param event Event to add\r\n */\r\n Animation.prototype.addEvent = function (event) {\r\n this._events.push(event);\r\n this._events.sort(function (a, b) { return a.frame - b.frame; });\r\n };\r\n /**\r\n * Remove all events found at the given frame\r\n * @param frame The frame to remove events from\r\n */\r\n Animation.prototype.removeEvents = function (frame) {\r\n for (var index = 0; index < this._events.length; index++) {\r\n if (this._events[index].frame === frame) {\r\n this._events.splice(index, 1);\r\n index--;\r\n }\r\n }\r\n };\r\n /**\r\n * Retrieves all the events from the animation\r\n * @returns Events from the animation\r\n */\r\n Animation.prototype.getEvents = function () {\r\n return this._events;\r\n };\r\n /**\r\n * Creates an animation range\r\n * @param name Name of the animation range\r\n * @param from Starting frame of the animation range\r\n * @param to Ending frame of the animation\r\n */\r\n Animation.prototype.createRange = function (name, from, to) {\r\n // check name not already in use; could happen for bones after serialized\r\n if (!this._ranges[name]) {\r\n this._ranges[name] = new AnimationRange(name, from, to);\r\n }\r\n };\r\n /**\r\n * Deletes an animation range by name\r\n * @param name Name of the animation range to delete\r\n * @param deleteFrames Specifies if the key frames for the range should also be deleted (true) or not (false)\r\n */\r\n Animation.prototype.deleteRange = function (name, deleteFrames) {\r\n if (deleteFrames === void 0) { deleteFrames = true; }\r\n var range = this._ranges[name];\r\n if (!range) {\r\n return;\r\n }\r\n if (deleteFrames) {\r\n var from = range.from;\r\n var to = range.to;\r\n // this loop MUST go high to low for multiple splices to work\r\n for (var key = this._keys.length - 1; key >= 0; key--) {\r\n if (this._keys[key].frame >= from && this._keys[key].frame <= to) {\r\n this._keys.splice(key, 1);\r\n }\r\n }\r\n }\r\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\r\n };\r\n /**\r\n * Gets the animation range by name, or null if not defined\r\n * @param name Name of the animation range\r\n * @returns Nullable animation range\r\n */\r\n Animation.prototype.getRange = function (name) {\r\n return this._ranges[name];\r\n };\r\n /**\r\n * Gets the key frames from the animation\r\n * @returns The key frames of the animation\r\n */\r\n Animation.prototype.getKeys = function () {\r\n return this._keys;\r\n };\r\n /**\r\n * Gets the highest frame rate of the animation\r\n * @returns Highest frame rate of the animation\r\n */\r\n Animation.prototype.getHighestFrame = function () {\r\n var ret = 0;\r\n for (var key = 0, nKeys = this._keys.length; key < nKeys; key++) {\r\n if (ret < this._keys[key].frame) {\r\n ret = this._keys[key].frame;\r\n }\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Gets the easing function of the animation\r\n * @returns Easing function of the animation\r\n */\r\n Animation.prototype.getEasingFunction = function () {\r\n return this._easingFunction;\r\n };\r\n /**\r\n * Sets the easing function of the animation\r\n * @param easingFunction A custom mathematical formula for animation\r\n */\r\n Animation.prototype.setEasingFunction = function (easingFunction) {\r\n this._easingFunction = easingFunction;\r\n };\r\n /**\r\n * Interpolates a scalar linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated scalar value\r\n */\r\n Animation.prototype.floatInterpolateFunction = function (startValue, endValue, gradient) {\r\n return Scalar.Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a scalar cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated scalar value\r\n */\r\n Animation.prototype.floatInterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return Scalar.Hermite(startValue, outTangent, endValue, inTangent, gradient);\r\n };\r\n /**\r\n * Interpolates a quaternion using a spherical linear interpolation\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated quaternion value\r\n */\r\n Animation.prototype.quaternionInterpolateFunction = function (startValue, endValue, gradient) {\r\n return Quaternion.Slerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a quaternion cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated quaternion value\r\n */\r\n Animation.prototype.quaternionInterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return Quaternion.Hermite(startValue, outTangent, endValue, inTangent, gradient).normalize();\r\n };\r\n /**\r\n * Interpolates a Vector3 linearl\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated scalar value\r\n */\r\n Animation.prototype.vector3InterpolateFunction = function (startValue, endValue, gradient) {\r\n return Vector3.Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a Vector3 cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns InterpolatedVector3 value\r\n */\r\n Animation.prototype.vector3InterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return Vector3.Hermite(startValue, outTangent, endValue, inTangent, gradient);\r\n };\r\n /**\r\n * Interpolates a Vector2 linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Vector2 value\r\n */\r\n Animation.prototype.vector2InterpolateFunction = function (startValue, endValue, gradient) {\r\n return Vector2.Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a Vector2 cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Vector2 value\r\n */\r\n Animation.prototype.vector2InterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return Vector2.Hermite(startValue, outTangent, endValue, inTangent, gradient);\r\n };\r\n /**\r\n * Interpolates a size linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Size value\r\n */\r\n Animation.prototype.sizeInterpolateFunction = function (startValue, endValue, gradient) {\r\n return Size.Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a Color3 linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Color3 value\r\n */\r\n Animation.prototype.color3InterpolateFunction = function (startValue, endValue, gradient) {\r\n return Color3.Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a Color4 linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Color3 value\r\n */\r\n Animation.prototype.color4InterpolateFunction = function (startValue, endValue, gradient) {\r\n return Color4.Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * @hidden Internal use only\r\n */\r\n Animation.prototype._getKeyValue = function (value) {\r\n if (typeof value === \"function\") {\r\n return value();\r\n }\r\n return value;\r\n };\r\n /**\r\n * @hidden Internal use only\r\n */\r\n Animation.prototype._interpolate = function (currentFrame, state) {\r\n if (state.loopMode === Animation.ANIMATIONLOOPMODE_CONSTANT && state.repeatCount > 0) {\r\n return state.highLimitValue.clone ? state.highLimitValue.clone() : state.highLimitValue;\r\n }\r\n var keys = this._keys;\r\n if (keys.length === 1) {\r\n return this._getKeyValue(keys[0].value);\r\n }\r\n var startKeyIndex = state.key;\r\n if (keys[startKeyIndex].frame >= currentFrame) {\r\n while (startKeyIndex - 1 >= 0 && keys[startKeyIndex].frame >= currentFrame) {\r\n startKeyIndex--;\r\n }\r\n }\r\n for (var key = startKeyIndex; key < keys.length; key++) {\r\n var endKey = keys[key + 1];\r\n if (endKey.frame >= currentFrame) {\r\n state.key = key;\r\n var startKey = keys[key];\r\n var startValue = this._getKeyValue(startKey.value);\r\n if (startKey.interpolation === AnimationKeyInterpolation.STEP) {\r\n return startValue;\r\n }\r\n var endValue = this._getKeyValue(endKey.value);\r\n var useTangent = startKey.outTangent !== undefined && endKey.inTangent !== undefined;\r\n var frameDelta = endKey.frame - startKey.frame;\r\n // gradient : percent of currentFrame between the frame inf and the frame sup\r\n var gradient = (currentFrame - startKey.frame) / frameDelta;\r\n // check for easingFunction and correction of gradient\r\n var easingFunction = this.getEasingFunction();\r\n if (easingFunction != null) {\r\n gradient = easingFunction.ease(gradient);\r\n }\r\n switch (this.dataType) {\r\n // Float\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n var floatValue = useTangent ? this.floatInterpolateFunctionWithTangents(startValue, startKey.outTangent * frameDelta, endValue, endKey.inTangent * frameDelta, gradient) : this.floatInterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return floatValue;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return state.offsetValue * state.repeatCount + floatValue;\r\n }\r\n break;\r\n // Quaternion\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n var quatValue = useTangent ? this.quaternionInterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.quaternionInterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return quatValue;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return quatValue.addInPlace(state.offsetValue.scale(state.repeatCount));\r\n }\r\n return quatValue;\r\n // Vector3\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n var vec3Value = useTangent ? this.vector3InterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.vector3InterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return vec3Value;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return vec3Value.add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Vector2\r\n case Animation.ANIMATIONTYPE_VECTOR2:\r\n var vec2Value = useTangent ? this.vector2InterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.vector2InterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return vec2Value;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return vec2Value.add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Size\r\n case Animation.ANIMATIONTYPE_SIZE:\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return this.sizeInterpolateFunction(startValue, endValue, gradient);\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return this.sizeInterpolateFunction(startValue, endValue, gradient).add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Color3\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return this.color3InterpolateFunction(startValue, endValue, gradient);\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return this.color3InterpolateFunction(startValue, endValue, gradient).add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Color4\r\n case Animation.ANIMATIONTYPE_COLOR4:\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return this.color4InterpolateFunction(startValue, endValue, gradient);\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return this.color4InterpolateFunction(startValue, endValue, gradient).add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Matrix\r\n case Animation.ANIMATIONTYPE_MATRIX:\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n if (Animation.AllowMatricesInterpolation) {\r\n return this.matrixInterpolateFunction(startValue, endValue, gradient, state.workValue);\r\n }\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return startValue;\r\n }\r\n default:\r\n break;\r\n }\r\n break;\r\n }\r\n }\r\n return this._getKeyValue(keys[keys.length - 1].value);\r\n };\r\n /**\r\n * Defines the function to use to interpolate matrices\r\n * @param startValue defines the start matrix\r\n * @param endValue defines the end matrix\r\n * @param gradient defines the gradient between both matrices\r\n * @param result defines an optional target matrix where to store the interpolation\r\n * @returns the interpolated matrix\r\n */\r\n Animation.prototype.matrixInterpolateFunction = function (startValue, endValue, gradient, result) {\r\n if (Animation.AllowMatrixDecomposeForInterpolation) {\r\n if (result) {\r\n Matrix.DecomposeLerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n }\r\n return Matrix.DecomposeLerp(startValue, endValue, gradient);\r\n }\r\n if (result) {\r\n Matrix.LerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n }\r\n return Matrix.Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Makes a copy of the animation\r\n * @returns Cloned animation\r\n */\r\n Animation.prototype.clone = function () {\r\n var clone = new Animation(this.name, this.targetPropertyPath.join(\".\"), this.framePerSecond, this.dataType, this.loopMode);\r\n clone.enableBlending = this.enableBlending;\r\n clone.blendingSpeed = this.blendingSpeed;\r\n if (this._keys) {\r\n clone.setKeys(this._keys);\r\n }\r\n if (this._ranges) {\r\n clone._ranges = {};\r\n for (var name in this._ranges) {\r\n var range = this._ranges[name];\r\n if (!range) {\r\n continue;\r\n }\r\n clone._ranges[name] = range.clone();\r\n }\r\n }\r\n return clone;\r\n };\r\n /**\r\n * Sets the key frames of the animation\r\n * @param values The animation key frames to set\r\n */\r\n Animation.prototype.setKeys = function (values) {\r\n this._keys = values.slice(0);\r\n };\r\n /**\r\n * Serializes the animation to an object\r\n * @returns Serialized object\r\n */\r\n Animation.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.property = this.targetProperty;\r\n serializationObject.framePerSecond = this.framePerSecond;\r\n serializationObject.dataType = this.dataType;\r\n serializationObject.loopBehavior = this.loopMode;\r\n serializationObject.enableBlending = this.enableBlending;\r\n serializationObject.blendingSpeed = this.blendingSpeed;\r\n var dataType = this.dataType;\r\n serializationObject.keys = [];\r\n var keys = this.getKeys();\r\n for (var index = 0; index < keys.length; index++) {\r\n var animationKey = keys[index];\r\n var key = {};\r\n key.frame = animationKey.frame;\r\n switch (dataType) {\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n key.values = [animationKey.value];\r\n if (animationKey.inTangent !== undefined) {\r\n key.values.push(animationKey.inTangent);\r\n }\r\n if (animationKey.outTangent !== undefined) {\r\n if (animationKey.inTangent === undefined) {\r\n key.values.push(undefined);\r\n }\r\n key.values.push(animationKey.outTangent);\r\n }\r\n break;\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n case Animation.ANIMATIONTYPE_MATRIX:\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n case Animation.ANIMATIONTYPE_COLOR4:\r\n key.values = animationKey.value.asArray();\r\n if (animationKey.inTangent != undefined) {\r\n key.values.push(animationKey.inTangent.asArray());\r\n }\r\n if (animationKey.outTangent != undefined) {\r\n if (animationKey.inTangent === undefined) {\r\n key.values.push(undefined);\r\n }\r\n key.values.push(animationKey.outTangent.asArray());\r\n }\r\n break;\r\n }\r\n serializationObject.keys.push(key);\r\n }\r\n serializationObject.ranges = [];\r\n for (var name in this._ranges) {\r\n var source = this._ranges[name];\r\n if (!source) {\r\n continue;\r\n }\r\n var range = {};\r\n range.name = name;\r\n range.from = source.from;\r\n range.to = source.to;\r\n serializationObject.ranges.push(range);\r\n }\r\n return serializationObject;\r\n };\r\n /** @hidden */\r\n Animation._UniversalLerp = function (left, right, amount) {\r\n var constructor = left.constructor;\r\n if (constructor.Lerp) { // Lerp supported\r\n return constructor.Lerp(left, right, amount);\r\n }\r\n else if (constructor.Slerp) { // Slerp supported\r\n return constructor.Slerp(left, right, amount);\r\n }\r\n else if (left.toFixed) { // Number\r\n return left * (1.0 - amount) + amount * right;\r\n }\r\n else { // Blending not supported\r\n return right;\r\n }\r\n };\r\n /**\r\n * Parses an animation object and creates an animation\r\n * @param parsedAnimation Parsed animation object\r\n * @returns Animation object\r\n */\r\n Animation.Parse = function (parsedAnimation) {\r\n var animation = new Animation(parsedAnimation.name, parsedAnimation.property, parsedAnimation.framePerSecond, parsedAnimation.dataType, parsedAnimation.loopBehavior);\r\n var dataType = parsedAnimation.dataType;\r\n var keys = [];\r\n var data;\r\n var index;\r\n if (parsedAnimation.enableBlending) {\r\n animation.enableBlending = parsedAnimation.enableBlending;\r\n }\r\n if (parsedAnimation.blendingSpeed) {\r\n animation.blendingSpeed = parsedAnimation.blendingSpeed;\r\n }\r\n for (index = 0; index < parsedAnimation.keys.length; index++) {\r\n var key = parsedAnimation.keys[index];\r\n var inTangent;\r\n var outTangent;\r\n switch (dataType) {\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n data = key.values[0];\r\n if (key.values.length >= 1) {\r\n inTangent = key.values[1];\r\n }\r\n if (key.values.length >= 2) {\r\n outTangent = key.values[2];\r\n }\r\n break;\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n data = Quaternion.FromArray(key.values);\r\n if (key.values.length >= 8) {\r\n var _inTangent = Quaternion.FromArray(key.values.slice(4, 8));\r\n if (!_inTangent.equals(Quaternion.Zero())) {\r\n inTangent = _inTangent;\r\n }\r\n }\r\n if (key.values.length >= 12) {\r\n var _outTangent = Quaternion.FromArray(key.values.slice(8, 12));\r\n if (!_outTangent.equals(Quaternion.Zero())) {\r\n outTangent = _outTangent;\r\n }\r\n }\r\n break;\r\n case Animation.ANIMATIONTYPE_MATRIX:\r\n data = Matrix.FromArray(key.values);\r\n break;\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n data = Color3.FromArray(key.values);\r\n break;\r\n case Animation.ANIMATIONTYPE_COLOR4:\r\n data = Color4.FromArray(key.values);\r\n break;\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n default:\r\n data = Vector3.FromArray(key.values);\r\n break;\r\n }\r\n var keyData = {};\r\n keyData.frame = key.frame;\r\n keyData.value = data;\r\n if (inTangent != undefined) {\r\n keyData.inTangent = inTangent;\r\n }\r\n if (outTangent != undefined) {\r\n keyData.outTangent = outTangent;\r\n }\r\n keys.push(keyData);\r\n }\r\n animation.setKeys(keys);\r\n if (parsedAnimation.ranges) {\r\n for (index = 0; index < parsedAnimation.ranges.length; index++) {\r\n data = parsedAnimation.ranges[index];\r\n animation.createRange(data.name, data.from, data.to);\r\n }\r\n }\r\n return animation;\r\n };\r\n /**\r\n * Appends the serialized animations from the source animations\r\n * @param source Source containing the animations\r\n * @param destination Target to store the animations\r\n */\r\n Animation.AppendSerializedAnimations = function (source, destination) {\r\n SerializationHelper.AppendSerializedAnimations(source, destination);\r\n };\r\n /**\r\n * Creates a new animation or an array of animations from a snippet saved in a remote file\r\n * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)\r\n * @param url defines the url to load from\r\n * @returns a promise that will resolve to the new animation or an array of animations\r\n */\r\n Animation.ParseFromFileAsync = function (name, url) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n var request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", function () {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n var serializationObject = JSON.parse(request.responseText);\r\n if (serializationObject.length) {\r\n var output = new Array();\r\n for (var _i = 0, serializationObject_1 = serializationObject; _i < serializationObject_1.length; _i++) {\r\n var serializedAnimation = serializationObject_1[_i];\r\n output.push(_this.Parse(serializedAnimation));\r\n }\r\n resolve(output);\r\n }\r\n else {\r\n var output = _this.Parse(serializationObject);\r\n if (name) {\r\n output.name = name;\r\n }\r\n resolve(output);\r\n }\r\n }\r\n else {\r\n reject(\"Unable to load the animation\");\r\n }\r\n }\r\n });\r\n request.open(\"GET\", url);\r\n request.send();\r\n });\r\n };\r\n /**\r\n * Creates an animation or an array of animations from a snippet saved by the Inspector\r\n * @param snippetId defines the snippet to load\r\n * @returns a promise that will resolve to the new animation or a new array of animations\r\n */\r\n Animation.CreateFromSnippetAsync = function (snippetId) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n var request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", function () {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n var snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n if (snippet.animations) {\r\n var serializationObject = JSON.parse(snippet.animations);\r\n var output = new Array();\r\n for (var _i = 0, serializationObject_2 = serializationObject; _i < serializationObject_2.length; _i++) {\r\n var serializedAnimation = serializationObject_2[_i];\r\n output.push(_this.Parse(serializedAnimation));\r\n }\r\n resolve(output);\r\n }\r\n else {\r\n var serializationObject = JSON.parse(snippet.animation);\r\n var output = _this.Parse(serializationObject);\r\n output.snippetId = snippetId;\r\n resolve(output);\r\n }\r\n }\r\n else {\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n request.open(\"GET\", _this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n };\r\n /**\r\n * Use matrix interpolation instead of using direct key value when animating matrices\r\n */\r\n Animation.AllowMatricesInterpolation = false;\r\n /**\r\n * When matrix interpolation is enabled, this boolean forces the system to use Matrix.DecomposeLerp instead of Matrix.Lerp. Interpolation is more precise but slower\r\n */\r\n Animation.AllowMatrixDecomposeForInterpolation = true;\r\n /** Define the Url to load snippets */\r\n Animation.SnippetUrl = \"https://snippet.babylonjs.com\";\r\n // Statics\r\n /**\r\n * Float animation type\r\n */\r\n Animation.ANIMATIONTYPE_FLOAT = 0;\r\n /**\r\n * Vector3 animation type\r\n */\r\n Animation.ANIMATIONTYPE_VECTOR3 = 1;\r\n /**\r\n * Quaternion animation type\r\n */\r\n Animation.ANIMATIONTYPE_QUATERNION = 2;\r\n /**\r\n * Matrix animation type\r\n */\r\n Animation.ANIMATIONTYPE_MATRIX = 3;\r\n /**\r\n * Color3 animation type\r\n */\r\n Animation.ANIMATIONTYPE_COLOR3 = 4;\r\n /**\r\n * Color3 animation type\r\n */\r\n Animation.ANIMATIONTYPE_COLOR4 = 7;\r\n /**\r\n * Vector2 animation type\r\n */\r\n Animation.ANIMATIONTYPE_VECTOR2 = 5;\r\n /**\r\n * Size animation type\r\n */\r\n Animation.ANIMATIONTYPE_SIZE = 6;\r\n /**\r\n * Relative Loop Mode\r\n */\r\n Animation.ANIMATIONLOOPMODE_RELATIVE = 0;\r\n /**\r\n * Cycle Loop Mode\r\n */\r\n Animation.ANIMATIONLOOPMODE_CYCLE = 1;\r\n /**\r\n * Constant Loop Mode\r\n */\r\n Animation.ANIMATIONLOOPMODE_CONSTANT = 2;\r\n return Animation;\r\n}());\r\nexport { Animation };\r\n_TypeStore.RegisteredTypes[\"BABYLON.Animation\"] = Animation;\r\nNode._AnimationRangeFactory = function (name, from, to) { return new AnimationRange(name, from, to); };\r\n//# sourceMappingURL=animation.js.map","/**\r\n * Enum for the animation key frame interpolation type\r\n */\r\nexport var AnimationKeyInterpolation;\r\n(function (AnimationKeyInterpolation) {\r\n /**\r\n * Do not interpolate between keys and use the start key value only. Tangents are ignored\r\n */\r\n AnimationKeyInterpolation[AnimationKeyInterpolation[\"STEP\"] = 1] = \"STEP\";\r\n})(AnimationKeyInterpolation || (AnimationKeyInterpolation = {}));\r\n//# sourceMappingURL=animationKey.js.map","/**\r\n * Represents the range of an animation\r\n */\r\nvar AnimationRange = /** @class */ (function () {\r\n /**\r\n * Initializes the range of an animation\r\n * @param name The name of the animation range\r\n * @param from The starting frame of the animation\r\n * @param to The ending frame of the animation\r\n */\r\n function AnimationRange(\r\n /**The name of the animation range**/\r\n name, \r\n /**The starting frame of the animation */\r\n from, \r\n /**The ending frame of the animation*/\r\n to) {\r\n this.name = name;\r\n this.from = from;\r\n this.to = to;\r\n }\r\n /**\r\n * Makes a copy of the animation range\r\n * @returns A copy of the animation range\r\n */\r\n AnimationRange.prototype.clone = function () {\r\n return new AnimationRange(this.name, this.from, this.to);\r\n };\r\n return AnimationRange;\r\n}());\r\nexport { AnimationRange };\r\n//# sourceMappingURL=animationRange.js.map","import { ArrayTools } from \"../Misc/arrayTools\";\r\nimport { Matrix, Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport { PickingInfo } from \"../Collisions/pickingInfo\";\r\nimport { IntersectionInfo } from \"../Collisions/intersectionInfo\";\r\nimport { Scene } from \"../scene\";\r\nimport { Camera } from \"../Cameras/camera\";\r\n/**\r\n * Class representing a ray with position and direction\r\n */\r\nvar Ray = /** @class */ (function () {\r\n /**\r\n * Creates a new ray\r\n * @param origin origin point\r\n * @param direction direction\r\n * @param length length of the ray\r\n */\r\n function Ray(\r\n /** origin point */\r\n origin, \r\n /** direction */\r\n direction, \r\n /** length of the ray */\r\n length) {\r\n if (length === void 0) { length = Number.MAX_VALUE; }\r\n this.origin = origin;\r\n this.direction = direction;\r\n this.length = length;\r\n }\r\n // Methods\r\n /**\r\n * Checks if the ray intersects a box\r\n * This does not account for the ray lenght by design to improve perfs.\r\n * @param minimum bound of the box\r\n * @param maximum bound of the box\r\n * @param intersectionTreshold extra extend to be added to the box in all direction\r\n * @returns if the box was hit\r\n */\r\n Ray.prototype.intersectsBoxMinMax = function (minimum, maximum, intersectionTreshold) {\r\n if (intersectionTreshold === void 0) { intersectionTreshold = 0; }\r\n var newMinimum = Ray._TmpVector3[0].copyFromFloats(minimum.x - intersectionTreshold, minimum.y - intersectionTreshold, minimum.z - intersectionTreshold);\r\n var newMaximum = Ray._TmpVector3[1].copyFromFloats(maximum.x + intersectionTreshold, maximum.y + intersectionTreshold, maximum.z + intersectionTreshold);\r\n var d = 0.0;\r\n var maxValue = Number.MAX_VALUE;\r\n var inv;\r\n var min;\r\n var max;\r\n var temp;\r\n if (Math.abs(this.direction.x) < 0.0000001) {\r\n if (this.origin.x < newMinimum.x || this.origin.x > newMaximum.x) {\r\n return false;\r\n }\r\n }\r\n else {\r\n inv = 1.0 / this.direction.x;\r\n min = (newMinimum.x - this.origin.x) * inv;\r\n max = (newMaximum.x - this.origin.x) * inv;\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n if (Math.abs(this.direction.y) < 0.0000001) {\r\n if (this.origin.y < newMinimum.y || this.origin.y > newMaximum.y) {\r\n return false;\r\n }\r\n }\r\n else {\r\n inv = 1.0 / this.direction.y;\r\n min = (newMinimum.y - this.origin.y) * inv;\r\n max = (newMaximum.y - this.origin.y) * inv;\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n if (Math.abs(this.direction.z) < 0.0000001) {\r\n if (this.origin.z < newMinimum.z || this.origin.z > newMaximum.z) {\r\n return false;\r\n }\r\n }\r\n else {\r\n inv = 1.0 / this.direction.z;\r\n min = (newMinimum.z - this.origin.z) * inv;\r\n max = (newMaximum.z - this.origin.z) * inv;\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks if the ray intersects a box\r\n * This does not account for the ray lenght by design to improve perfs.\r\n * @param box the bounding box to check\r\n * @param intersectionTreshold extra extend to be added to the BoundingBox in all direction\r\n * @returns if the box was hit\r\n */\r\n Ray.prototype.intersectsBox = function (box, intersectionTreshold) {\r\n if (intersectionTreshold === void 0) { intersectionTreshold = 0; }\r\n return this.intersectsBoxMinMax(box.minimum, box.maximum, intersectionTreshold);\r\n };\r\n /**\r\n * If the ray hits a sphere\r\n * @param sphere the bounding sphere to check\r\n * @param intersectionTreshold extra extend to be added to the BoundingSphere in all direction\r\n * @returns true if it hits the sphere\r\n */\r\n Ray.prototype.intersectsSphere = function (sphere, intersectionTreshold) {\r\n if (intersectionTreshold === void 0) { intersectionTreshold = 0; }\r\n var x = sphere.center.x - this.origin.x;\r\n var y = sphere.center.y - this.origin.y;\r\n var z = sphere.center.z - this.origin.z;\r\n var pyth = x * x + y * y + z * z;\r\n var radius = sphere.radius + intersectionTreshold;\r\n var rr = radius * radius;\r\n if (pyth <= rr) {\r\n return true;\r\n }\r\n var dot = x * this.direction.x + y * this.direction.y + z * this.direction.z;\r\n if (dot < 0.0) {\r\n return false;\r\n }\r\n var temp = pyth - dot * dot;\r\n return temp <= rr;\r\n };\r\n /**\r\n * If the ray hits a triange\r\n * @param vertex0 triangle vertex\r\n * @param vertex1 triangle vertex\r\n * @param vertex2 triangle vertex\r\n * @returns intersection information if hit\r\n */\r\n Ray.prototype.intersectsTriangle = function (vertex0, vertex1, vertex2) {\r\n var edge1 = Ray._TmpVector3[0];\r\n var edge2 = Ray._TmpVector3[1];\r\n var pvec = Ray._TmpVector3[2];\r\n var tvec = Ray._TmpVector3[3];\r\n var qvec = Ray._TmpVector3[4];\r\n vertex1.subtractToRef(vertex0, edge1);\r\n vertex2.subtractToRef(vertex0, edge2);\r\n Vector3.CrossToRef(this.direction, edge2, pvec);\r\n var det = Vector3.Dot(edge1, pvec);\r\n if (det === 0) {\r\n return null;\r\n }\r\n var invdet = 1 / det;\r\n this.origin.subtractToRef(vertex0, tvec);\r\n var bv = Vector3.Dot(tvec, pvec) * invdet;\r\n if (bv < 0 || bv > 1.0) {\r\n return null;\r\n }\r\n Vector3.CrossToRef(tvec, edge1, qvec);\r\n var bw = Vector3.Dot(this.direction, qvec) * invdet;\r\n if (bw < 0 || bv + bw > 1.0) {\r\n return null;\r\n }\r\n //check if the distance is longer than the predefined length.\r\n var distance = Vector3.Dot(edge2, qvec) * invdet;\r\n if (distance > this.length) {\r\n return null;\r\n }\r\n return new IntersectionInfo(1 - bv - bw, bv, distance);\r\n };\r\n /**\r\n * Checks if ray intersects a plane\r\n * @param plane the plane to check\r\n * @returns the distance away it was hit\r\n */\r\n Ray.prototype.intersectsPlane = function (plane) {\r\n var distance;\r\n var result1 = Vector3.Dot(plane.normal, this.direction);\r\n if (Math.abs(result1) < 9.99999997475243e-7) {\r\n return null;\r\n }\r\n else {\r\n var result2 = Vector3.Dot(plane.normal, this.origin);\r\n distance = (-plane.d - result2) / result1;\r\n if (distance < 0.0) {\r\n if (distance < -9.99999997475243e-7) {\r\n return null;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n return distance;\r\n }\r\n };\r\n /**\r\n * Calculate the intercept of a ray on a given axis\r\n * @param axis to check 'x' | 'y' | 'z'\r\n * @param offset from axis interception (i.e. an offset of 1y is intercepted above ground)\r\n * @returns a vector containing the coordinates where 'axis' is equal to zero (else offset), or null if there is no intercept.\r\n */\r\n Ray.prototype.intersectsAxis = function (axis, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n switch (axis) {\r\n case \"y\":\r\n var t = (this.origin.y - offset) / this.direction.y;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new Vector3(this.origin.x + this.direction.x * -t, offset, this.origin.z + this.direction.z * -t);\r\n case \"x\":\r\n var t = (this.origin.x - offset) / this.direction.x;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new Vector3(offset, this.origin.y + this.direction.y * -t, this.origin.z + this.direction.z * -t);\r\n case \"z\":\r\n var t = (this.origin.z - offset) / this.direction.z;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new Vector3(this.origin.x + this.direction.x * -t, this.origin.y + this.direction.y * -t, offset);\r\n default:\r\n return null;\r\n }\r\n };\r\n /**\r\n * Checks if ray intersects a mesh\r\n * @param mesh the mesh to check\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @returns picking info of the intersecton\r\n */\r\n Ray.prototype.intersectsMesh = function (mesh, fastCheck) {\r\n var tm = TmpVectors.Matrix[0];\r\n mesh.getWorldMatrix().invertToRef(tm);\r\n if (this._tmpRay) {\r\n Ray.TransformToRef(this, tm, this._tmpRay);\r\n }\r\n else {\r\n this._tmpRay = Ray.Transform(this, tm);\r\n }\r\n return mesh.intersects(this._tmpRay, fastCheck);\r\n };\r\n /**\r\n * Checks if ray intersects a mesh\r\n * @param meshes the meshes to check\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param results array to store result in\r\n * @returns Array of picking infos\r\n */\r\n Ray.prototype.intersectsMeshes = function (meshes, fastCheck, results) {\r\n if (results) {\r\n results.length = 0;\r\n }\r\n else {\r\n results = [];\r\n }\r\n for (var i = 0; i < meshes.length; i++) {\r\n var pickInfo = this.intersectsMesh(meshes[i], fastCheck);\r\n if (pickInfo.hit) {\r\n results.push(pickInfo);\r\n }\r\n }\r\n results.sort(this._comparePickingInfo);\r\n return results;\r\n };\r\n Ray.prototype._comparePickingInfo = function (pickingInfoA, pickingInfoB) {\r\n if (pickingInfoA.distance < pickingInfoB.distance) {\r\n return -1;\r\n }\r\n else if (pickingInfoA.distance > pickingInfoB.distance) {\r\n return 1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n };\r\n /**\r\n * Intersection test between the ray and a given segment whithin a given tolerance (threshold)\r\n * @param sega the first point of the segment to test the intersection against\r\n * @param segb the second point of the segment to test the intersection against\r\n * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful\r\n * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection\r\n */\r\n Ray.prototype.intersectionSegment = function (sega, segb, threshold) {\r\n var o = this.origin;\r\n var u = TmpVectors.Vector3[0];\r\n var rsegb = TmpVectors.Vector3[1];\r\n var v = TmpVectors.Vector3[2];\r\n var w = TmpVectors.Vector3[3];\r\n segb.subtractToRef(sega, u);\r\n this.direction.scaleToRef(Ray.rayl, v);\r\n o.addToRef(v, rsegb);\r\n sega.subtractToRef(o, w);\r\n var a = Vector3.Dot(u, u); // always >= 0\r\n var b = Vector3.Dot(u, v);\r\n var c = Vector3.Dot(v, v); // always >= 0\r\n var d = Vector3.Dot(u, w);\r\n var e = Vector3.Dot(v, w);\r\n var D = a * c - b * b; // always >= 0\r\n var sc, sN, sD = D; // sc = sN / sD, default sD = D >= 0\r\n var tc, tN, tD = D; // tc = tN / tD, default tD = D >= 0\r\n // compute the line parameters of the two closest points\r\n if (D < Ray.smallnum) {\r\n // the lines are almost parallel\r\n sN = 0.0; // force using point P0 on segment S1\r\n sD = 1.0; // to prevent possible division by 0.0 later\r\n tN = e;\r\n tD = c;\r\n }\r\n else {\r\n // get the closest points on the infinite lines\r\n sN = b * e - c * d;\r\n tN = a * e - b * d;\r\n if (sN < 0.0) {\r\n // sc < 0 => the s=0 edge is visible\r\n sN = 0.0;\r\n tN = e;\r\n tD = c;\r\n }\r\n else if (sN > sD) {\r\n // sc > 1 => the s=1 edge is visible\r\n sN = sD;\r\n tN = e + b;\r\n tD = c;\r\n }\r\n }\r\n if (tN < 0.0) {\r\n // tc < 0 => the t=0 edge is visible\r\n tN = 0.0;\r\n // recompute sc for this edge\r\n if (-d < 0.0) {\r\n sN = 0.0;\r\n }\r\n else if (-d > a) {\r\n sN = sD;\r\n }\r\n else {\r\n sN = -d;\r\n sD = a;\r\n }\r\n }\r\n else if (tN > tD) {\r\n // tc > 1 => the t=1 edge is visible\r\n tN = tD;\r\n // recompute sc for this edge\r\n if (-d + b < 0.0) {\r\n sN = 0;\r\n }\r\n else if (-d + b > a) {\r\n sN = sD;\r\n }\r\n else {\r\n sN = -d + b;\r\n sD = a;\r\n }\r\n }\r\n // finally do the division to get sc and tc\r\n sc = Math.abs(sN) < Ray.smallnum ? 0.0 : sN / sD;\r\n tc = Math.abs(tN) < Ray.smallnum ? 0.0 : tN / tD;\r\n // get the difference of the two closest points\r\n var qtc = TmpVectors.Vector3[4];\r\n v.scaleToRef(tc, qtc);\r\n var qsc = TmpVectors.Vector3[5];\r\n u.scaleToRef(sc, qsc);\r\n qsc.addInPlace(w);\r\n var dP = TmpVectors.Vector3[6];\r\n qsc.subtractToRef(qtc, dP); // = S1(sc) - S2(tc)\r\n var isIntersected = tc > 0 && tc <= this.length && dP.lengthSquared() < threshold * threshold; // return intersection result\r\n if (isIntersected) {\r\n return qsc.length();\r\n }\r\n return -1;\r\n };\r\n /**\r\n * Update the ray from viewport position\r\n * @param x position\r\n * @param y y position\r\n * @param viewportWidth viewport width\r\n * @param viewportHeight viewport height\r\n * @param world world matrix\r\n * @param view view matrix\r\n * @param projection projection matrix\r\n * @returns this ray updated\r\n */\r\n Ray.prototype.update = function (x, y, viewportWidth, viewportHeight, world, view, projection) {\r\n this.unprojectRayToRef(x, y, viewportWidth, viewportHeight, world, view, projection);\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Creates a ray with origin and direction of 0,0,0\r\n * @returns the new ray\r\n */\r\n Ray.Zero = function () {\r\n return new Ray(Vector3.Zero(), Vector3.Zero());\r\n };\r\n /**\r\n * Creates a new ray from screen space and viewport\r\n * @param x position\r\n * @param y y position\r\n * @param viewportWidth viewport width\r\n * @param viewportHeight viewport height\r\n * @param world world matrix\r\n * @param view view matrix\r\n * @param projection projection matrix\r\n * @returns new ray\r\n */\r\n Ray.CreateNew = function (x, y, viewportWidth, viewportHeight, world, view, projection) {\r\n var result = Ray.Zero();\r\n return result.update(x, y, viewportWidth, viewportHeight, world, view, projection);\r\n };\r\n /**\r\n * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be\r\n * transformed to the given world matrix.\r\n * @param origin The origin point\r\n * @param end The end point\r\n * @param world a matrix to transform the ray to. Default is the identity matrix.\r\n * @returns the new ray\r\n */\r\n Ray.CreateNewFromTo = function (origin, end, world) {\r\n if (world === void 0) { world = Matrix.IdentityReadOnly; }\r\n var direction = end.subtract(origin);\r\n var length = Math.sqrt(direction.x * direction.x + direction.y * direction.y + direction.z * direction.z);\r\n direction.normalize();\r\n return Ray.Transform(new Ray(origin, direction, length), world);\r\n };\r\n /**\r\n * Transforms a ray by a matrix\r\n * @param ray ray to transform\r\n * @param matrix matrix to apply\r\n * @returns the resulting new ray\r\n */\r\n Ray.Transform = function (ray, matrix) {\r\n var result = new Ray(new Vector3(0, 0, 0), new Vector3(0, 0, 0));\r\n Ray.TransformToRef(ray, matrix, result);\r\n return result;\r\n };\r\n /**\r\n * Transforms a ray by a matrix\r\n * @param ray ray to transform\r\n * @param matrix matrix to apply\r\n * @param result ray to store result in\r\n */\r\n Ray.TransformToRef = function (ray, matrix, result) {\r\n Vector3.TransformCoordinatesToRef(ray.origin, matrix, result.origin);\r\n Vector3.TransformNormalToRef(ray.direction, matrix, result.direction);\r\n result.length = ray.length;\r\n var dir = result.direction;\r\n var len = dir.length();\r\n if (!(len === 0 || len === 1)) {\r\n var num = 1.0 / len;\r\n dir.x *= num;\r\n dir.y *= num;\r\n dir.z *= num;\r\n result.length *= len;\r\n }\r\n };\r\n /**\r\n * Unproject a ray from screen space to object space\r\n * @param sourceX defines the screen space x coordinate to use\r\n * @param sourceY defines the screen space y coordinate to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n */\r\n Ray.prototype.unprojectRayToRef = function (sourceX, sourceY, viewportWidth, viewportHeight, world, view, projection) {\r\n var matrix = TmpVectors.Matrix[0];\r\n world.multiplyToRef(view, matrix);\r\n matrix.multiplyToRef(projection, matrix);\r\n matrix.invert();\r\n var nearScreenSource = TmpVectors.Vector3[0];\r\n nearScreenSource.x = (sourceX / viewportWidth) * 2 - 1;\r\n nearScreenSource.y = -((sourceY / viewportHeight) * 2 - 1);\r\n nearScreenSource.z = -1.0;\r\n var farScreenSource = TmpVectors.Vector3[1].copyFromFloats(nearScreenSource.x, nearScreenSource.y, 1.0);\r\n var nearVec3 = TmpVectors.Vector3[2];\r\n var farVec3 = TmpVectors.Vector3[3];\r\n Vector3._UnprojectFromInvertedMatrixToRef(nearScreenSource, matrix, nearVec3);\r\n Vector3._UnprojectFromInvertedMatrixToRef(farScreenSource, matrix, farVec3);\r\n this.origin.copyFrom(nearVec3);\r\n farVec3.subtractToRef(nearVec3, this.direction);\r\n this.direction.normalize();\r\n };\r\n Ray._TmpVector3 = ArrayTools.BuildArray(6, Vector3.Zero);\r\n Ray.smallnum = 0.00000001;\r\n Ray.rayl = 10e8;\r\n return Ray;\r\n}());\r\nexport { Ray };\r\nScene.prototype.createPickingRay = function (x, y, world, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n var result = Ray.Zero();\r\n this.createPickingRayToRef(x, y, world, result, camera, cameraViewSpace);\r\n return result;\r\n};\r\nScene.prototype.createPickingRayToRef = function (x, y, world, result, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n var engine = this.getEngine();\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n return this;\r\n }\r\n camera = this.activeCamera;\r\n }\r\n var cameraViewport = camera.viewport;\r\n var viewport = cameraViewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight());\r\n // Moving coordinates to local viewport world\r\n x = x / engine.getHardwareScalingLevel() - viewport.x;\r\n y = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - viewport.y - viewport.height);\r\n result.update(x, y, viewport.width, viewport.height, world ? world : Matrix.IdentityReadOnly, cameraViewSpace ? Matrix.IdentityReadOnly : camera.getViewMatrix(), camera.getProjectionMatrix());\r\n return this;\r\n};\r\nScene.prototype.createPickingRayInCameraSpace = function (x, y, camera) {\r\n var result = Ray.Zero();\r\n this.createPickingRayInCameraSpaceToRef(x, y, result, camera);\r\n return result;\r\n};\r\nScene.prototype.createPickingRayInCameraSpaceToRef = function (x, y, result, camera) {\r\n if (!PickingInfo) {\r\n return this;\r\n }\r\n var engine = this.getEngine();\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n camera = this.activeCamera;\r\n }\r\n var cameraViewport = camera.viewport;\r\n var viewport = cameraViewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight());\r\n var identity = Matrix.Identity();\r\n // Moving coordinates to local viewport world\r\n x = x / engine.getHardwareScalingLevel() - viewport.x;\r\n y = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - viewport.y - viewport.height);\r\n result.update(x, y, viewport.width, viewport.height, identity, identity, camera.getProjectionMatrix());\r\n return this;\r\n};\r\nScene.prototype._internalPickForMesh = function (pickingInfo, rayFunction, mesh, world, fastCheck, onlyBoundingInfo, trianglePredicate, skipBoundingInfo) {\r\n var ray = rayFunction(world);\r\n var result = mesh.intersects(ray, fastCheck, trianglePredicate, onlyBoundingInfo, world, skipBoundingInfo);\r\n if (!result || !result.hit) {\r\n return null;\r\n }\r\n if (!fastCheck && pickingInfo != null && result.distance >= pickingInfo.distance) {\r\n return null;\r\n }\r\n return result;\r\n};\r\nScene.prototype._internalPick = function (rayFunction, predicate, fastCheck, onlyBoundingInfo, trianglePredicate) {\r\n if (!PickingInfo) {\r\n return null;\r\n }\r\n var pickingInfo = null;\r\n for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\r\n var mesh = this.meshes[meshIndex];\r\n if (predicate) {\r\n if (!predicate(mesh)) {\r\n continue;\r\n }\r\n }\r\n else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {\r\n continue;\r\n }\r\n var world = mesh.skeleton && mesh.skeleton.overrideMesh ? mesh.skeleton.overrideMesh.getWorldMatrix() : mesh.getWorldMatrix();\r\n if (mesh.hasThinInstances && mesh.thinInstanceEnablePicking) {\r\n // first check if the ray intersects the whole bounding box/sphere of the mesh\r\n var result = this._internalPickForMesh(pickingInfo, rayFunction, mesh, world, true, true, trianglePredicate);\r\n if (result) {\r\n if (onlyBoundingInfo) {\r\n // the user only asked for a bounding info check so we can return\r\n return pickingInfo;\r\n }\r\n var tmpMatrix = TmpVectors.Matrix[1];\r\n var thinMatrices = mesh.thinInstanceGetWorldMatrices();\r\n for (var index = 0; index < thinMatrices.length; index++) {\r\n var thinMatrix = thinMatrices[index];\r\n thinMatrix.multiplyToRef(world, tmpMatrix);\r\n var result_1 = this._internalPickForMesh(pickingInfo, rayFunction, mesh, tmpMatrix, fastCheck, onlyBoundingInfo, trianglePredicate, true);\r\n if (result_1) {\r\n pickingInfo = result_1;\r\n pickingInfo.thinInstanceIndex = index;\r\n if (fastCheck) {\r\n return pickingInfo;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n var result = this._internalPickForMesh(pickingInfo, rayFunction, mesh, world, fastCheck, onlyBoundingInfo, trianglePredicate);\r\n if (result) {\r\n pickingInfo = result;\r\n if (fastCheck) {\r\n return pickingInfo;\r\n }\r\n }\r\n }\r\n }\r\n return pickingInfo || new PickingInfo();\r\n};\r\nScene.prototype._internalMultiPick = function (rayFunction, predicate, trianglePredicate) {\r\n if (!PickingInfo) {\r\n return null;\r\n }\r\n var pickingInfos = new Array();\r\n for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\r\n var mesh = this.meshes[meshIndex];\r\n if (predicate) {\r\n if (!predicate(mesh)) {\r\n continue;\r\n }\r\n }\r\n else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {\r\n continue;\r\n }\r\n var world = mesh.skeleton && mesh.skeleton.overrideMesh ? mesh.skeleton.overrideMesh.getWorldMatrix() : mesh.getWorldMatrix();\r\n if (mesh.hasThinInstances && mesh.thinInstanceEnablePicking) {\r\n var result = this._internalPickForMesh(null, rayFunction, mesh, world, true, true, trianglePredicate);\r\n if (result) {\r\n var tmpMatrix = TmpVectors.Matrix[1];\r\n var thinMatrices = mesh.thinInstanceGetWorldMatrices();\r\n for (var index = 0; index < thinMatrices.length; index++) {\r\n var thinMatrix = thinMatrices[index];\r\n thinMatrix.multiplyToRef(world, tmpMatrix);\r\n var result_2 = this._internalPickForMesh(null, rayFunction, mesh, tmpMatrix, false, false, trianglePredicate, true);\r\n if (result_2) {\r\n result_2.thinInstanceIndex = index;\r\n pickingInfos.push(result_2);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n var result = this._internalPickForMesh(null, rayFunction, mesh, world, false, false, trianglePredicate);\r\n if (result) {\r\n pickingInfos.push(result);\r\n }\r\n }\r\n }\r\n return pickingInfos;\r\n};\r\nScene.prototype.pickWithBoundingInfo = function (x, y, predicate, fastCheck, camera) {\r\n var _this = this;\r\n if (!PickingInfo) {\r\n return null;\r\n }\r\n var result = this._internalPick(function (world) {\r\n if (!_this._tempPickingRay) {\r\n _this._tempPickingRay = Ray.Zero();\r\n }\r\n _this.createPickingRayToRef(x, y, world, _this._tempPickingRay, camera || null);\r\n return _this._tempPickingRay;\r\n }, predicate, fastCheck, true);\r\n if (result) {\r\n result.ray = this.createPickingRay(x, y, Matrix.Identity(), camera || null);\r\n }\r\n return result;\r\n};\r\nScene.prototype.pick = function (x, y, predicate, fastCheck, camera, trianglePredicate) {\r\n var _this = this;\r\n if (!PickingInfo) {\r\n return null;\r\n }\r\n var result = this._internalPick(function (world) {\r\n if (!_this._tempPickingRay) {\r\n _this._tempPickingRay = Ray.Zero();\r\n }\r\n _this.createPickingRayToRef(x, y, world, _this._tempPickingRay, camera || null);\r\n return _this._tempPickingRay;\r\n }, predicate, fastCheck, false, trianglePredicate);\r\n if (result) {\r\n result.ray = this.createPickingRay(x, y, Matrix.Identity(), camera || null);\r\n }\r\n return result;\r\n};\r\nScene.prototype.pickWithRay = function (ray, predicate, fastCheck, trianglePredicate) {\r\n var _this = this;\r\n var result = this._internalPick(function (world) {\r\n if (!_this._pickWithRayInverseMatrix) {\r\n _this._pickWithRayInverseMatrix = Matrix.Identity();\r\n }\r\n world.invertToRef(_this._pickWithRayInverseMatrix);\r\n if (!_this._cachedRayForTransform) {\r\n _this._cachedRayForTransform = Ray.Zero();\r\n }\r\n Ray.TransformToRef(ray, _this._pickWithRayInverseMatrix, _this._cachedRayForTransform);\r\n return _this._cachedRayForTransform;\r\n }, predicate, fastCheck, false, trianglePredicate);\r\n if (result) {\r\n result.ray = ray;\r\n }\r\n return result;\r\n};\r\nScene.prototype.multiPick = function (x, y, predicate, camera, trianglePredicate) {\r\n var _this = this;\r\n return this._internalMultiPick(function (world) { return _this.createPickingRay(x, y, world, camera || null); }, predicate, trianglePredicate);\r\n};\r\nScene.prototype.multiPickWithRay = function (ray, predicate, trianglePredicate) {\r\n var _this = this;\r\n return this._internalMultiPick(function (world) {\r\n if (!_this._pickWithRayInverseMatrix) {\r\n _this._pickWithRayInverseMatrix = Matrix.Identity();\r\n }\r\n world.invertToRef(_this._pickWithRayInverseMatrix);\r\n if (!_this._cachedRayForTransform) {\r\n _this._cachedRayForTransform = Ray.Zero();\r\n }\r\n Ray.TransformToRef(ray, _this._pickWithRayInverseMatrix, _this._cachedRayForTransform);\r\n return _this._cachedRayForTransform;\r\n }, predicate, trianglePredicate);\r\n};\r\nCamera.prototype.getForwardRay = function (length, transform, origin) {\r\n if (length === void 0) { length = 100; }\r\n return this.getForwardRayToRef(new Ray(Vector3.Zero(), Vector3.Zero(), length), length, transform, origin);\r\n};\r\nCamera.prototype.getForwardRayToRef = function (refRay, length, transform, origin) {\r\n if (length === void 0) { length = 100; }\r\n if (!transform) {\r\n transform = this.getWorldMatrix();\r\n }\r\n refRay.length = length;\r\n if (!origin) {\r\n refRay.origin.copyFrom(this.position);\r\n }\r\n else {\r\n refRay.origin.copyFrom(origin);\r\n }\r\n TmpVectors.Vector3[2].set(0, 0, this._scene.useRightHandedSystem ? -1 : 1);\r\n Vector3.TransformNormalToRef(TmpVectors.Vector3[2], transform, TmpVectors.Vector3[3]);\r\n Vector3.NormalizeToRef(TmpVectors.Vector3[3], refRay.direction);\r\n return refRay;\r\n};\r\n//# sourceMappingURL=ray.js.map","import { Vector3, Matrix } from '../Maths/math.vector';\r\n/**\r\n * Class containing a set of static utilities functions for managing Pivots\r\n * @hidden\r\n */\r\nvar PivotTools = /** @class */ (function () {\r\n function PivotTools() {\r\n }\r\n /** @hidden */\r\n PivotTools._RemoveAndStorePivotPoint = function (mesh) {\r\n if (mesh && PivotTools._PivotCached === 0) {\r\n // Save old pivot and set pivot to 0,0,0\r\n mesh.getPivotPointToRef(PivotTools._OldPivotPoint);\r\n PivotTools._PivotPostMultiplyPivotMatrix = mesh._postMultiplyPivotMatrix;\r\n if (!PivotTools._OldPivotPoint.equalsToFloats(0, 0, 0)) {\r\n mesh.setPivotMatrix(Matrix.IdentityReadOnly);\r\n PivotTools._OldPivotPoint.subtractToRef(mesh.getPivotPoint(), PivotTools._PivotTranslation);\r\n PivotTools._PivotTmpVector.copyFromFloats(1, 1, 1);\r\n PivotTools._PivotTmpVector.subtractInPlace(mesh.scaling);\r\n PivotTools._PivotTmpVector.multiplyInPlace(PivotTools._PivotTranslation);\r\n mesh.position.addInPlace(PivotTools._PivotTmpVector);\r\n }\r\n }\r\n PivotTools._PivotCached++;\r\n };\r\n /** @hidden */\r\n PivotTools._RestorePivotPoint = function (mesh) {\r\n if (mesh && !PivotTools._OldPivotPoint.equalsToFloats(0, 0, 0) && PivotTools._PivotCached === 1) {\r\n mesh.setPivotPoint(PivotTools._OldPivotPoint);\r\n mesh._postMultiplyPivotMatrix = PivotTools._PivotPostMultiplyPivotMatrix;\r\n PivotTools._PivotTmpVector.copyFromFloats(1, 1, 1);\r\n PivotTools._PivotTmpVector.subtractInPlace(mesh.scaling);\r\n PivotTools._PivotTmpVector.multiplyInPlace(PivotTools._PivotTranslation);\r\n mesh.position.subtractInPlace(PivotTools._PivotTmpVector);\r\n }\r\n this._PivotCached--;\r\n };\r\n // Stores the state of the pivot cache (_oldPivotPoint, _pivotTranslation)\r\n // store/remove pivot point should only be applied during their outermost calls\r\n PivotTools._PivotCached = 0;\r\n PivotTools._OldPivotPoint = new Vector3();\r\n PivotTools._PivotTranslation = new Vector3();\r\n PivotTools._PivotTmpVector = new Vector3();\r\n PivotTools._PivotPostMultiplyPivotMatrix = false;\r\n return PivotTools;\r\n}());\r\nexport { PivotTools };\r\n//# sourceMappingURL=pivotTools.js.map","import { Mesh } from \"../../Meshes/mesh\";\r\nimport { Scene } from \"../../scene\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Ray } from \"../../Culling/ray\";\r\nimport { PivotTools } from '../../Misc/pivotTools';\r\nimport \"../../Meshes/Builders/planeBuilder\";\r\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to be dragged around the screen based on pointer events\r\n */\r\nvar PointerDragBehavior = /** @class */ (function () {\r\n /**\r\n * Creates a pointer drag behavior that can be attached to a mesh\r\n * @param options The drag axis or normal of the plane that will be dragged across. If no options are specified the drag plane will always face the ray's origin (eg. camera)\r\n */\r\n function PointerDragBehavior(options) {\r\n this._useAlternatePickedPointAboveMaxDragAngleDragSpeed = -1.1;\r\n /**\r\n * The maximum tolerated angle between the drag plane and dragging pointer rays to trigger pointer events. Set to 0 to allow any angle (default: 0)\r\n */\r\n this.maxDragAngle = 0;\r\n /**\r\n * @hidden\r\n */\r\n this._useAlternatePickedPointAboveMaxDragAngle = false;\r\n /**\r\n * The id of the pointer that is currently interacting with the behavior (-1 when no pointer is active)\r\n */\r\n this.currentDraggingPointerID = -1;\r\n /**\r\n * If the behavior is currently in a dragging state\r\n */\r\n this.dragging = false;\r\n /**\r\n * The distance towards the target drag position to move each frame. This can be useful to avoid jitter. Set this to 1 for no delay. (Default: 0.2)\r\n */\r\n this.dragDeltaRatio = 0.2;\r\n /**\r\n * If the drag plane orientation should be updated during the dragging (Default: true)\r\n */\r\n this.updateDragPlane = true;\r\n // Debug mode will display drag planes to help visualize behavior\r\n this._debugMode = false;\r\n this._moving = false;\r\n /**\r\n * Fires each time the attached mesh is dragged with the pointer\r\n * * delta between last drag position and current drag position in world space\r\n * * dragDistance along the drag axis\r\n * * dragPlaneNormal normal of the current drag plane used during the drag\r\n * * dragPlanePoint in world space where the drag intersects the drag plane\r\n */\r\n this.onDragObservable = new Observable();\r\n /**\r\n * Fires each time a drag begins (eg. mouse down on mesh)\r\n */\r\n this.onDragStartObservable = new Observable();\r\n /**\r\n * Fires each time a drag ends (eg. mouse release after drag)\r\n */\r\n this.onDragEndObservable = new Observable();\r\n /**\r\n * If the attached mesh should be moved when dragged\r\n */\r\n this.moveAttached = true;\r\n /**\r\n * If the drag behavior will react to drag events (Default: true)\r\n */\r\n this.enabled = true;\r\n /**\r\n * If pointer events should start and release the drag (Default: true)\r\n */\r\n this.startAndReleaseDragOnPointerEvents = true;\r\n /**\r\n * If camera controls should be detached during the drag\r\n */\r\n this.detachCameraControls = true;\r\n /**\r\n * If set, the drag plane/axis will be rotated based on the attached mesh's world rotation (Default: true)\r\n */\r\n this.useObjectOrientationForDragging = true;\r\n /**\r\n * Predicate to determine if it is valid to move the object to a new position when it is moved\r\n */\r\n this.validateDrag = function (targetPosition) { return true; };\r\n this._tmpVector = new Vector3(0, 0, 0);\r\n this._alternatePickedPoint = new Vector3(0, 0, 0);\r\n this._worldDragAxis = new Vector3(0, 0, 0);\r\n this._targetPosition = new Vector3(0, 0, 0);\r\n this._attachedToElement = false;\r\n this._startDragRay = new Ray(new Vector3(), new Vector3());\r\n this._lastPointerRay = {};\r\n this._dragDelta = new Vector3();\r\n // Variables to avoid instantiation in the below method\r\n this._pointA = new Vector3(0, 0, 0);\r\n this._pointC = new Vector3(0, 0, 0);\r\n this._localAxis = new Vector3(0, 0, 0);\r\n this._lookAt = new Vector3(0, 0, 0);\r\n this._options = options ? options : {};\r\n var optionCount = 0;\r\n if (this._options.dragAxis) {\r\n optionCount++;\r\n }\r\n if (this._options.dragPlaneNormal) {\r\n optionCount++;\r\n }\r\n if (optionCount > 1) {\r\n throw \"Multiple drag modes specified in dragBehavior options. Only one expected\";\r\n }\r\n }\r\n Object.defineProperty(PointerDragBehavior.prototype, \"options\", {\r\n /**\r\n * Gets the options used by the behavior\r\n */\r\n get: function () {\r\n return this._options;\r\n },\r\n /**\r\n * Sets the options used by the behavior\r\n */\r\n set: function (options) {\r\n this._options = options;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PointerDragBehavior.prototype, \"name\", {\r\n /**\r\n * The name of the behavior\r\n */\r\n get: function () {\r\n return \"PointerDrag\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior\r\n */\r\n PointerDragBehavior.prototype.init = function () { };\r\n /**\r\n * Attaches the drag behavior the passed in mesh\r\n * @param ownerNode The mesh that will be dragged around once attached\r\n * @param predicate Predicate to use for pick filtering\r\n */\r\n PointerDragBehavior.prototype.attach = function (ownerNode, predicate) {\r\n var _this = this;\r\n this._scene = ownerNode.getScene();\r\n this.attachedNode = ownerNode;\r\n // Initialize drag plane to not interfere with existing scene\r\n if (!PointerDragBehavior._planeScene) {\r\n if (this._debugMode) {\r\n PointerDragBehavior._planeScene = this._scene;\r\n }\r\n else {\r\n PointerDragBehavior._planeScene = new Scene(this._scene.getEngine(), { virtual: true });\r\n PointerDragBehavior._planeScene.detachControl();\r\n this._scene.onDisposeObservable.addOnce(function () {\r\n PointerDragBehavior._planeScene.dispose();\r\n PointerDragBehavior._planeScene = null;\r\n });\r\n }\r\n }\r\n this._dragPlane = Mesh.CreatePlane(\"pointerDragPlane\", this._debugMode ? 1 : 10000, PointerDragBehavior._planeScene, false, Mesh.DOUBLESIDE);\r\n // State of the drag\r\n this.lastDragPosition = new Vector3(0, 0, 0);\r\n var pickPredicate = !!predicate ? predicate : function (m) {\r\n return _this.attachedNode == m || m.isDescendantOf(_this.attachedNode);\r\n };\r\n this._pointerObserver = this._scene.onPointerObservable.add(function (pointerInfo, eventState) {\r\n if (!_this.enabled) {\r\n return;\r\n }\r\n if (pointerInfo.type == PointerEventTypes.POINTERDOWN) {\r\n if (_this.startAndReleaseDragOnPointerEvents && !_this.dragging && pointerInfo.pickInfo && pointerInfo.pickInfo.hit && pointerInfo.pickInfo.pickedMesh && pointerInfo.pickInfo.pickedPoint && pointerInfo.pickInfo.ray && pickPredicate(pointerInfo.pickInfo.pickedMesh)) {\r\n _this._startDrag(pointerInfo.event.pointerId, pointerInfo.pickInfo.ray, pointerInfo.pickInfo.pickedPoint);\r\n }\r\n }\r\n else if (pointerInfo.type == PointerEventTypes.POINTERUP) {\r\n if (_this.startAndReleaseDragOnPointerEvents && _this.currentDraggingPointerID == pointerInfo.event.pointerId) {\r\n _this.releaseDrag();\r\n }\r\n }\r\n else if (pointerInfo.type == PointerEventTypes.POINTERMOVE) {\r\n var pointerId = pointerInfo.event.pointerId;\r\n // If drag was started with anyMouseID specified, set pointerID to the next mouse that moved\r\n if (_this.currentDraggingPointerID === PointerDragBehavior._AnyMouseID && pointerId !== PointerDragBehavior._AnyMouseID) {\r\n var evt = pointerInfo.event;\r\n var isMouseEvent = evt.pointerType === \"mouse\" || (!_this._scene.getEngine().hostInformation.isMobile && evt instanceof MouseEvent);\r\n if (isMouseEvent) {\r\n if (_this._lastPointerRay[_this.currentDraggingPointerID]) {\r\n _this._lastPointerRay[pointerId] = _this._lastPointerRay[_this.currentDraggingPointerID];\r\n delete _this._lastPointerRay[_this.currentDraggingPointerID];\r\n }\r\n _this.currentDraggingPointerID = pointerId;\r\n }\r\n }\r\n // Keep track of last pointer ray, this is used simulating the start of a drag in startDrag()\r\n if (!_this._lastPointerRay[pointerId]) {\r\n _this._lastPointerRay[pointerId] = new Ray(new Vector3(), new Vector3());\r\n }\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.ray) {\r\n _this._lastPointerRay[pointerId].origin.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n _this._lastPointerRay[pointerId].direction.copyFrom(pointerInfo.pickInfo.ray.direction);\r\n if (_this.currentDraggingPointerID == pointerId && _this.dragging) {\r\n _this._moveDrag(pointerInfo.pickInfo.ray);\r\n }\r\n }\r\n }\r\n });\r\n this._beforeRenderObserver = this._scene.onBeforeRenderObservable.add(function () {\r\n if (_this._moving && _this.moveAttached) {\r\n PivotTools._RemoveAndStorePivotPoint(_this.attachedNode);\r\n // Slowly move mesh to avoid jitter\r\n _this._targetPosition.subtractToRef((_this.attachedNode).absolutePosition, _this._tmpVector);\r\n _this._tmpVector.scaleInPlace(_this.dragDeltaRatio);\r\n (_this.attachedNode).getAbsolutePosition().addToRef(_this._tmpVector, _this._tmpVector);\r\n if (_this.validateDrag(_this._tmpVector)) {\r\n (_this.attachedNode).setAbsolutePosition(_this._tmpVector);\r\n }\r\n PivotTools._RestorePivotPoint(_this.attachedNode);\r\n }\r\n });\r\n };\r\n /**\r\n * Force relase the drag action by code.\r\n */\r\n PointerDragBehavior.prototype.releaseDrag = function () {\r\n if (this.dragging) {\r\n this.dragging = false;\r\n this.onDragEndObservable.notifyObservers({ dragPlanePoint: this.lastDragPosition, pointerId: this.currentDraggingPointerID });\r\n }\r\n this.currentDraggingPointerID = -1;\r\n this._moving = false;\r\n // Reattach camera controls\r\n if (this.detachCameraControls && this._attachedToElement && this._scene.activeCamera && !this._scene.activeCamera.leftCamera) {\r\n if (this._scene.activeCamera.getClassName() === \"ArcRotateCamera\") {\r\n var arcRotateCamera = this._scene.activeCamera;\r\n arcRotateCamera.attachControl(arcRotateCamera.inputs ? arcRotateCamera.inputs.noPreventDefault : true, arcRotateCamera._useCtrlForPanning, arcRotateCamera._panningMouseButton);\r\n }\r\n else {\r\n this._scene.activeCamera.attachControl(this._scene.activeCamera.inputs ? this._scene.activeCamera.inputs.noPreventDefault : true);\r\n }\r\n this._attachedToElement = false;\r\n }\r\n };\r\n /**\r\n * Simulates the start of a pointer drag event on the behavior\r\n * @param pointerId pointerID of the pointer that should be simulated (Default: Any mouse pointer ID)\r\n * @param fromRay initial ray of the pointer to be simulated (Default: Ray from camera to attached mesh)\r\n * @param startPickedPoint picked point of the pointer to be simulated (Default: attached mesh position)\r\n */\r\n PointerDragBehavior.prototype.startDrag = function (pointerId, fromRay, startPickedPoint) {\r\n if (pointerId === void 0) { pointerId = PointerDragBehavior._AnyMouseID; }\r\n this._startDrag(pointerId, fromRay, startPickedPoint);\r\n var lastRay = this._lastPointerRay[pointerId];\r\n if (pointerId === PointerDragBehavior._AnyMouseID) {\r\n lastRay = this._lastPointerRay[Object.keys(this._lastPointerRay)[0]];\r\n }\r\n if (lastRay) {\r\n // if there was a last pointer ray drag the object there\r\n this._moveDrag(lastRay);\r\n }\r\n };\r\n PointerDragBehavior.prototype._startDrag = function (pointerId, fromRay, startPickedPoint) {\r\n if (!this._scene.activeCamera || this.dragging || !this.attachedNode) {\r\n return;\r\n }\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedNode);\r\n // Create start ray from the camera to the object\r\n if (fromRay) {\r\n this._startDragRay.direction.copyFrom(fromRay.direction);\r\n this._startDragRay.origin.copyFrom(fromRay.origin);\r\n }\r\n else {\r\n this._startDragRay.origin.copyFrom(this._scene.activeCamera.position);\r\n this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector);\r\n this._tmpVector.subtractToRef(this._scene.activeCamera.position, this._startDragRay.direction);\r\n }\r\n this._updateDragPlanePosition(this._startDragRay, startPickedPoint ? startPickedPoint : this._tmpVector);\r\n var pickedPoint = this._pickWithRayOnDragPlane(this._startDragRay);\r\n if (pickedPoint) {\r\n this.dragging = true;\r\n this.currentDraggingPointerID = pointerId;\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n this.onDragStartObservable.notifyObservers({ dragPlanePoint: pickedPoint, pointerId: this.currentDraggingPointerID });\r\n this._targetPosition.copyFrom((this.attachedNode).absolutePosition);\r\n // Detatch camera controls\r\n if (this.detachCameraControls && this._scene.activeCamera && this._scene.activeCamera.inputs && !this._scene.activeCamera.leftCamera) {\r\n if (this._scene.activeCamera.inputs.attachedToElement) {\r\n this._scene.activeCamera.detachControl();\r\n this._attachedToElement = true;\r\n }\r\n else {\r\n this._attachedToElement = false;\r\n }\r\n }\r\n }\r\n PivotTools._RestorePivotPoint(this.attachedNode);\r\n };\r\n PointerDragBehavior.prototype._moveDrag = function (ray) {\r\n this._moving = true;\r\n var pickedPoint = this._pickWithRayOnDragPlane(ray);\r\n if (pickedPoint) {\r\n if (this.updateDragPlane) {\r\n this._updateDragPlanePosition(ray, pickedPoint);\r\n }\r\n var dragLength = 0;\r\n // depending on the drag mode option drag accordingly\r\n if (this._options.dragAxis) {\r\n // Convert local drag axis to world if useObjectOrientationForDragging\r\n this.useObjectOrientationForDragging ? Vector3.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._worldDragAxis) : this._worldDragAxis.copyFrom(this._options.dragAxis);\r\n // Project delta drag from the drag plane onto the drag axis\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._tmpVector);\r\n dragLength = Vector3.Dot(this._tmpVector, this._worldDragAxis);\r\n this._worldDragAxis.scaleToRef(dragLength, this._dragDelta);\r\n }\r\n else {\r\n dragLength = this._dragDelta.length();\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._dragDelta);\r\n }\r\n this._targetPosition.addInPlace(this._dragDelta);\r\n this.onDragObservable.notifyObservers({ dragDistance: dragLength, delta: this._dragDelta, dragPlanePoint: pickedPoint, dragPlaneNormal: this._dragPlane.forward, pointerId: this.currentDraggingPointerID });\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n }\r\n };\r\n PointerDragBehavior.prototype._pickWithRayOnDragPlane = function (ray) {\r\n var _this = this;\r\n if (!ray) {\r\n return null;\r\n }\r\n // Calculate angle between plane normal and ray\r\n var angle = Math.acos(Vector3.Dot(this._dragPlane.forward, ray.direction));\r\n // Correct if ray is casted from oposite side\r\n if (angle > Math.PI / 2) {\r\n angle = Math.PI - angle;\r\n }\r\n // If the angle is too perpendicular to the plane pick another point on the plane where it is looking\r\n if (this.maxDragAngle > 0 && angle > this.maxDragAngle) {\r\n if (this._useAlternatePickedPointAboveMaxDragAngle) {\r\n // Invert ray direction along the towards object axis\r\n this._tmpVector.copyFrom(ray.direction);\r\n (this.attachedNode).absolutePosition.subtractToRef(ray.origin, this._alternatePickedPoint);\r\n this._alternatePickedPoint.normalize();\r\n this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed * Vector3.Dot(this._alternatePickedPoint, this._tmpVector));\r\n this._tmpVector.addInPlace(this._alternatePickedPoint);\r\n // Project resulting vector onto the drag plane and add it to the attached nodes absolute position to get a picked point\r\n var dot = Vector3.Dot(this._dragPlane.forward, this._tmpVector);\r\n this._dragPlane.forward.scaleToRef(-dot, this._alternatePickedPoint);\r\n this._alternatePickedPoint.addInPlace(this._tmpVector);\r\n this._alternatePickedPoint.addInPlace((this.attachedNode).absolutePosition);\r\n return this._alternatePickedPoint;\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n var pickResult = PointerDragBehavior._planeScene.pickWithRay(ray, function (m) { return m == _this._dragPlane; });\r\n if (pickResult && pickResult.hit && pickResult.pickedMesh && pickResult.pickedPoint) {\r\n return pickResult.pickedPoint;\r\n }\r\n else {\r\n return null;\r\n }\r\n };\r\n // Position the drag plane based on the attached mesh position, for single axis rotate the plane along the axis to face the camera\r\n PointerDragBehavior.prototype._updateDragPlanePosition = function (ray, dragPlanePosition) {\r\n this._pointA.copyFrom(dragPlanePosition);\r\n if (this._options.dragAxis) {\r\n this.useObjectOrientationForDragging ? Vector3.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragAxis);\r\n // Calculate plane normal that is the cross product of local axis and (eye-dragPlanePosition)\r\n ray.origin.subtractToRef(this._pointA, this._pointC);\r\n this._pointC.normalize();\r\n if (Math.abs(Vector3.Dot(this._localAxis, this._pointC)) > 0.999) {\r\n // the drag axis is colinear with the (eye to position) ray. The cross product will give jittered values.\r\n // A new axis vector need to be computed\r\n if (Math.abs(Vector3.Dot(Vector3.UpReadOnly, this._pointC)) > 0.999) {\r\n this._lookAt.copyFrom(Vector3.Right());\r\n }\r\n else {\r\n this._lookAt.copyFrom(Vector3.UpReadOnly);\r\n }\r\n }\r\n else {\r\n Vector3.CrossToRef(this._localAxis, this._pointC, this._lookAt);\r\n // Get perpendicular line from previous result and drag axis to adjust lineB to be perpendiculat to camera\r\n Vector3.CrossToRef(this._localAxis, this._lookAt, this._lookAt);\r\n this._lookAt.normalize();\r\n }\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._lookAt, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n }\r\n else if (this._options.dragPlaneNormal) {\r\n this.useObjectOrientationForDragging ? Vector3.TransformCoordinatesToRef(this._options.dragPlaneNormal, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragPlaneNormal);\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._localAxis, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n }\r\n else {\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._dragPlane.lookAt(ray.origin);\r\n }\r\n // Update the position of the drag plane so it doesn't get out of sync with the node (eg. when moving back and forth quickly)\r\n this._dragPlane.position.copyFrom(this.attachedNode.absolutePosition);\r\n this._dragPlane.computeWorldMatrix(true);\r\n };\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n PointerDragBehavior.prototype.detach = function () {\r\n if (this._pointerObserver) {\r\n this._scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n if (this._beforeRenderObserver) {\r\n this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n this.releaseDrag();\r\n };\r\n PointerDragBehavior._AnyMouseID = -2;\r\n return PointerDragBehavior;\r\n}());\r\nexport { PointerDragBehavior };\r\n//# sourceMappingURL=pointerDragBehavior.js.map","import { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\n/**\r\n * The autoRotation behavior (AutoRotationBehavior) is designed to create a smooth rotation of an ArcRotateCamera when there is no user interaction.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior\r\n */\r\nvar AutoRotationBehavior = /** @class */ (function () {\r\n function AutoRotationBehavior() {\r\n this._zoomStopsAnimation = false;\r\n this._idleRotationSpeed = 0.05;\r\n this._idleRotationWaitTime = 2000;\r\n this._idleRotationSpinupTime = 2000;\r\n this._isPointerDown = false;\r\n this._lastFrameTime = null;\r\n this._lastInteractionTime = -Infinity;\r\n this._cameraRotationSpeed = 0;\r\n this._lastFrameRadius = 0;\r\n }\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"name\", {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n get: function () {\r\n return \"AutoRotation\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"zoomStopsAnimation\", {\r\n /**\r\n * Gets the flag that indicates if user zooming should stop animation.\r\n */\r\n get: function () {\r\n return this._zoomStopsAnimation;\r\n },\r\n /**\r\n * Sets the flag that indicates if user zooming should stop animation.\r\n */\r\n set: function (flag) {\r\n this._zoomStopsAnimation = flag;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"idleRotationSpeed\", {\r\n /**\r\n * Gets the default speed at which the camera rotates around the model.\r\n */\r\n get: function () {\r\n return this._idleRotationSpeed;\r\n },\r\n /**\r\n * Sets the default speed at which the camera rotates around the model.\r\n */\r\n set: function (speed) {\r\n this._idleRotationSpeed = speed;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"idleRotationWaitTime\", {\r\n /**\r\n * Gets the time (milliseconds) to wait after user interaction before the camera starts rotating.\r\n */\r\n get: function () {\r\n return this._idleRotationWaitTime;\r\n },\r\n /**\r\n * Sets the time (in milliseconds) to wait after user interaction before the camera starts rotating.\r\n */\r\n set: function (time) {\r\n this._idleRotationWaitTime = time;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"idleRotationSpinupTime\", {\r\n /**\r\n * Gets the time (milliseconds) to take to spin up to the full idle rotation speed.\r\n */\r\n get: function () {\r\n return this._idleRotationSpinupTime;\r\n },\r\n /**\r\n * Sets the time (milliseconds) to take to spin up to the full idle rotation speed.\r\n */\r\n set: function (time) {\r\n this._idleRotationSpinupTime = time;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"rotationInProgress\", {\r\n /**\r\n * Gets a value indicating if the camera is currently rotating because of this behavior\r\n */\r\n get: function () {\r\n return Math.abs(this._cameraRotationSpeed) > 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior.\r\n */\r\n AutoRotationBehavior.prototype.init = function () {\r\n // Do notihng\r\n };\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n AutoRotationBehavior.prototype.attach = function (camera) {\r\n var _this = this;\r\n this._attachedCamera = camera;\r\n var scene = this._attachedCamera.getScene();\r\n this._onPrePointerObservableObserver = scene.onPrePointerObservable.add(function (pointerInfoPre) {\r\n if (pointerInfoPre.type === PointerEventTypes.POINTERDOWN) {\r\n _this._isPointerDown = true;\r\n return;\r\n }\r\n if (pointerInfoPre.type === PointerEventTypes.POINTERUP) {\r\n _this._isPointerDown = false;\r\n }\r\n });\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(function () {\r\n var now = PrecisionDate.Now;\r\n var dt = 0;\r\n if (_this._lastFrameTime != null) {\r\n dt = now - _this._lastFrameTime;\r\n }\r\n _this._lastFrameTime = now;\r\n // Stop the animation if there is user interaction and the animation should stop for this interaction\r\n _this._applyUserInteraction();\r\n var timeToRotation = now - _this._lastInteractionTime - _this._idleRotationWaitTime;\r\n var scale = Math.max(Math.min(timeToRotation / (_this._idleRotationSpinupTime), 1), 0);\r\n _this._cameraRotationSpeed = _this._idleRotationSpeed * scale;\r\n // Step camera rotation by rotation speed\r\n if (_this._attachedCamera) {\r\n _this._attachedCamera.alpha -= _this._cameraRotationSpeed * (dt / 1000);\r\n }\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n AutoRotationBehavior.prototype.detach = function () {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n var scene = this._attachedCamera.getScene();\r\n if (this._onPrePointerObservableObserver) {\r\n scene.onPrePointerObservable.remove(this._onPrePointerObservableObserver);\r\n }\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n this._attachedCamera = null;\r\n };\r\n /**\r\n * Returns true if user is scrolling.\r\n * @return true if user is scrolling.\r\n */\r\n AutoRotationBehavior.prototype._userIsZooming = function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n return this._attachedCamera.inertialRadiusOffset !== 0;\r\n };\r\n AutoRotationBehavior.prototype._shouldAnimationStopForInteraction = function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n var zoomHasHitLimit = false;\r\n if (this._lastFrameRadius === this._attachedCamera.radius && this._attachedCamera.inertialRadiusOffset !== 0) {\r\n zoomHasHitLimit = true;\r\n }\r\n // Update the record of previous radius - works as an approx. indicator of hitting radius limits\r\n this._lastFrameRadius = this._attachedCamera.radius;\r\n return this._zoomStopsAnimation ? zoomHasHitLimit : this._userIsZooming();\r\n };\r\n /**\r\n * Applies any current user interaction to the camera. Takes into account maximum alpha rotation.\r\n */\r\n AutoRotationBehavior.prototype._applyUserInteraction = function () {\r\n if (this._userIsMoving() && !this._shouldAnimationStopForInteraction()) {\r\n this._lastInteractionTime = PrecisionDate.Now;\r\n }\r\n };\r\n // Tools\r\n AutoRotationBehavior.prototype._userIsMoving = function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n return this._attachedCamera.inertialAlphaOffset !== 0 ||\r\n this._attachedCamera.inertialBetaOffset !== 0 ||\r\n this._attachedCamera.inertialRadiusOffset !== 0 ||\r\n this._attachedCamera.inertialPanningX !== 0 ||\r\n this._attachedCamera.inertialPanningY !== 0 ||\r\n this._isPointerDown;\r\n };\r\n return AutoRotationBehavior;\r\n}());\r\nexport { AutoRotationBehavior };\r\n//# sourceMappingURL=autoRotationBehavior.js.map","import { __extends } from \"tslib\";\r\nimport { BezierCurve } from \"../Maths/math.path\";\r\n/**\r\n * Base class used for every default easing function.\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar EasingFunction = /** @class */ (function () {\r\n function EasingFunction() {\r\n this._easingMode = EasingFunction.EASINGMODE_EASEIN;\r\n }\r\n /**\r\n * Sets the easing mode of the current function.\r\n * @param easingMode Defines the willing mode (EASINGMODE_EASEIN, EASINGMODE_EASEOUT or EASINGMODE_EASEINOUT)\r\n */\r\n EasingFunction.prototype.setEasingMode = function (easingMode) {\r\n var n = Math.min(Math.max(easingMode, 0), 2);\r\n this._easingMode = n;\r\n };\r\n /**\r\n * Gets the current easing mode.\r\n * @returns the easing mode\r\n */\r\n EasingFunction.prototype.getEasingMode = function () {\r\n return this._easingMode;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n EasingFunction.prototype.easeInCore = function (gradient) {\r\n throw new Error('You must implement this method');\r\n };\r\n /**\r\n * Given an input gradient between 0 and 1, this returns the corresponding value\r\n * of the easing function.\r\n * @param gradient Defines the value between 0 and 1 we want the easing value for\r\n * @returns the corresponding value on the curve defined by the easing function\r\n */\r\n EasingFunction.prototype.ease = function (gradient) {\r\n switch (this._easingMode) {\r\n case EasingFunction.EASINGMODE_EASEIN:\r\n return this.easeInCore(gradient);\r\n case EasingFunction.EASINGMODE_EASEOUT:\r\n return (1 - this.easeInCore(1 - gradient));\r\n }\r\n if (gradient >= 0.5) {\r\n return (((1 - this.easeInCore((1 - gradient) * 2)) * 0.5) + 0.5);\r\n }\r\n return (this.easeInCore(gradient * 2) * 0.5);\r\n };\r\n /**\r\n * Interpolation follows the mathematical formula associated with the easing function.\r\n */\r\n EasingFunction.EASINGMODE_EASEIN = 0;\r\n /**\r\n * Interpolation follows 100% interpolation minus the output of the formula associated with the easing function.\r\n */\r\n EasingFunction.EASINGMODE_EASEOUT = 1;\r\n /**\r\n * Interpolation uses EaseIn for the first half of the animation and EaseOut for the second half.\r\n */\r\n EasingFunction.EASINGMODE_EASEINOUT = 2;\r\n return EasingFunction;\r\n}());\r\nexport { EasingFunction };\r\n/**\r\n * Easing function with a circle shape (see link below).\r\n * @see https://easings.net/#easeInCirc\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar CircleEase = /** @class */ (function (_super) {\r\n __extends(CircleEase, _super);\r\n function CircleEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n CircleEase.prototype.easeInCore = function (gradient) {\r\n gradient = Math.max(0, Math.min(1, gradient));\r\n return (1.0 - Math.sqrt(1.0 - (gradient * gradient)));\r\n };\r\n return CircleEase;\r\n}(EasingFunction));\r\nexport { CircleEase };\r\n/**\r\n * Easing function with a ease back shape (see link below).\r\n * @see https://easings.net/#easeInBack\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar BackEase = /** @class */ (function (_super) {\r\n __extends(BackEase, _super);\r\n /**\r\n * Instantiates a back ease easing\r\n * @see https://easings.net/#easeInBack\r\n * @param amplitude Defines the amplitude of the function\r\n */\r\n function BackEase(\r\n /** Defines the amplitude of the function */\r\n amplitude) {\r\n if (amplitude === void 0) { amplitude = 1; }\r\n var _this = _super.call(this) || this;\r\n _this.amplitude = amplitude;\r\n return _this;\r\n }\r\n /** @hidden */\r\n BackEase.prototype.easeInCore = function (gradient) {\r\n var num = Math.max(0, this.amplitude);\r\n return (Math.pow(gradient, 3.0) - ((gradient * num) * Math.sin(3.1415926535897931 * gradient)));\r\n };\r\n return BackEase;\r\n}(EasingFunction));\r\nexport { BackEase };\r\n/**\r\n * Easing function with a bouncing shape (see link below).\r\n * @see https://easings.net/#easeInBounce\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar BounceEase = /** @class */ (function (_super) {\r\n __extends(BounceEase, _super);\r\n /**\r\n * Instantiates a bounce easing\r\n * @see https://easings.net/#easeInBounce\r\n * @param bounces Defines the number of bounces\r\n * @param bounciness Defines the amplitude of the bounce\r\n */\r\n function BounceEase(\r\n /** Defines the number of bounces */\r\n bounces, \r\n /** Defines the amplitude of the bounce */\r\n bounciness) {\r\n if (bounces === void 0) { bounces = 3; }\r\n if (bounciness === void 0) { bounciness = 2; }\r\n var _this = _super.call(this) || this;\r\n _this.bounces = bounces;\r\n _this.bounciness = bounciness;\r\n return _this;\r\n }\r\n /** @hidden */\r\n BounceEase.prototype.easeInCore = function (gradient) {\r\n var y = Math.max(0.0, this.bounces);\r\n var bounciness = this.bounciness;\r\n if (bounciness <= 1.0) {\r\n bounciness = 1.001;\r\n }\r\n var num9 = Math.pow(bounciness, y);\r\n var num5 = 1.0 - bounciness;\r\n var num4 = ((1.0 - num9) / num5) + (num9 * 0.5);\r\n var num15 = gradient * num4;\r\n var num65 = Math.log((-num15 * (1.0 - bounciness)) + 1.0) / Math.log(bounciness);\r\n var num3 = Math.floor(num65);\r\n var num13 = num3 + 1.0;\r\n var num8 = (1.0 - Math.pow(bounciness, num3)) / (num5 * num4);\r\n var num12 = (1.0 - Math.pow(bounciness, num13)) / (num5 * num4);\r\n var num7 = (num8 + num12) * 0.5;\r\n var num6 = gradient - num7;\r\n var num2 = num7 - num8;\r\n return (((-Math.pow(1.0 / bounciness, y - num3) / (num2 * num2)) * (num6 - num2)) * (num6 + num2));\r\n };\r\n return BounceEase;\r\n}(EasingFunction));\r\nexport { BounceEase };\r\n/**\r\n * Easing function with a power of 3 shape (see link below).\r\n * @see https://easings.net/#easeInCubic\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar CubicEase = /** @class */ (function (_super) {\r\n __extends(CubicEase, _super);\r\n function CubicEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n CubicEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient * gradient);\r\n };\r\n return CubicEase;\r\n}(EasingFunction));\r\nexport { CubicEase };\r\n/**\r\n * Easing function with an elastic shape (see link below).\r\n * @see https://easings.net/#easeInElastic\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar ElasticEase = /** @class */ (function (_super) {\r\n __extends(ElasticEase, _super);\r\n /**\r\n * Instantiates an elastic easing function\r\n * @see https://easings.net/#easeInElastic\r\n * @param oscillations Defines the number of oscillations\r\n * @param springiness Defines the amplitude of the oscillations\r\n */\r\n function ElasticEase(\r\n /** Defines the number of oscillations*/\r\n oscillations, \r\n /** Defines the amplitude of the oscillations*/\r\n springiness) {\r\n if (oscillations === void 0) { oscillations = 3; }\r\n if (springiness === void 0) { springiness = 3; }\r\n var _this = _super.call(this) || this;\r\n _this.oscillations = oscillations;\r\n _this.springiness = springiness;\r\n return _this;\r\n }\r\n /** @hidden */\r\n ElasticEase.prototype.easeInCore = function (gradient) {\r\n var num2;\r\n var num3 = Math.max(0.0, this.oscillations);\r\n var num = Math.max(0.0, this.springiness);\r\n if (num == 0) {\r\n num2 = gradient;\r\n }\r\n else {\r\n num2 = (Math.exp(num * gradient) - 1.0) / (Math.exp(num) - 1.0);\r\n }\r\n return (num2 * Math.sin(((6.2831853071795862 * num3) + 1.5707963267948966) * gradient));\r\n };\r\n return ElasticEase;\r\n}(EasingFunction));\r\nexport { ElasticEase };\r\n/**\r\n * Easing function with an exponential shape (see link below).\r\n * @see https://easings.net/#easeInExpo\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar ExponentialEase = /** @class */ (function (_super) {\r\n __extends(ExponentialEase, _super);\r\n /**\r\n * Instantiates an exponential easing function\r\n * @see https://easings.net/#easeInExpo\r\n * @param exponent Defines the exponent of the function\r\n */\r\n function ExponentialEase(\r\n /** Defines the exponent of the function */\r\n exponent) {\r\n if (exponent === void 0) { exponent = 2; }\r\n var _this = _super.call(this) || this;\r\n _this.exponent = exponent;\r\n return _this;\r\n }\r\n /** @hidden */\r\n ExponentialEase.prototype.easeInCore = function (gradient) {\r\n if (this.exponent <= 0) {\r\n return gradient;\r\n }\r\n return ((Math.exp(this.exponent * gradient) - 1.0) / (Math.exp(this.exponent) - 1.0));\r\n };\r\n return ExponentialEase;\r\n}(EasingFunction));\r\nexport { ExponentialEase };\r\n/**\r\n * Easing function with a power shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar PowerEase = /** @class */ (function (_super) {\r\n __extends(PowerEase, _super);\r\n /**\r\n * Instantiates an power base easing function\r\n * @see https://easings.net/#easeInQuad\r\n * @param power Defines the power of the function\r\n */\r\n function PowerEase(\r\n /** Defines the power of the function */\r\n power) {\r\n if (power === void 0) { power = 2; }\r\n var _this = _super.call(this) || this;\r\n _this.power = power;\r\n return _this;\r\n }\r\n /** @hidden */\r\n PowerEase.prototype.easeInCore = function (gradient) {\r\n var y = Math.max(0.0, this.power);\r\n return Math.pow(gradient, y);\r\n };\r\n return PowerEase;\r\n}(EasingFunction));\r\nexport { PowerEase };\r\n/**\r\n * Easing function with a power of 2 shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar QuadraticEase = /** @class */ (function (_super) {\r\n __extends(QuadraticEase, _super);\r\n function QuadraticEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n QuadraticEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient);\r\n };\r\n return QuadraticEase;\r\n}(EasingFunction));\r\nexport { QuadraticEase };\r\n/**\r\n * Easing function with a power of 4 shape (see link below).\r\n * @see https://easings.net/#easeInQuart\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar QuarticEase = /** @class */ (function (_super) {\r\n __extends(QuarticEase, _super);\r\n function QuarticEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n QuarticEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient * gradient * gradient);\r\n };\r\n return QuarticEase;\r\n}(EasingFunction));\r\nexport { QuarticEase };\r\n/**\r\n * Easing function with a power of 5 shape (see link below).\r\n * @see https://easings.net/#easeInQuint\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar QuinticEase = /** @class */ (function (_super) {\r\n __extends(QuinticEase, _super);\r\n function QuinticEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n QuinticEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient * gradient * gradient * gradient);\r\n };\r\n return QuinticEase;\r\n}(EasingFunction));\r\nexport { QuinticEase };\r\n/**\r\n * Easing function with a sin shape (see link below).\r\n * @see https://easings.net/#easeInSine\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar SineEase = /** @class */ (function (_super) {\r\n __extends(SineEase, _super);\r\n function SineEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n SineEase.prototype.easeInCore = function (gradient) {\r\n return (1.0 - Math.sin(1.5707963267948966 * (1.0 - gradient)));\r\n };\r\n return SineEase;\r\n}(EasingFunction));\r\nexport { SineEase };\r\n/**\r\n * Easing function with a bezier shape (see link below).\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar BezierCurveEase = /** @class */ (function (_super) {\r\n __extends(BezierCurveEase, _super);\r\n /**\r\n * Instantiates a bezier function\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @param x1 Defines the x component of the start tangent in the bezier curve\r\n * @param y1 Defines the y component of the start tangent in the bezier curve\r\n * @param x2 Defines the x component of the end tangent in the bezier curve\r\n * @param y2 Defines the y component of the end tangent in the bezier curve\r\n */\r\n function BezierCurveEase(\r\n /** Defines the x component of the start tangent in the bezier curve */\r\n x1, \r\n /** Defines the y component of the start tangent in the bezier curve */\r\n y1, \r\n /** Defines the x component of the end tangent in the bezier curve */\r\n x2, \r\n /** Defines the y component of the end tangent in the bezier curve */\r\n y2) {\r\n if (x1 === void 0) { x1 = 0; }\r\n if (y1 === void 0) { y1 = 0; }\r\n if (x2 === void 0) { x2 = 1; }\r\n if (y2 === void 0) { y2 = 1; }\r\n var _this = _super.call(this) || this;\r\n _this.x1 = x1;\r\n _this.y1 = y1;\r\n _this.x2 = x2;\r\n _this.y2 = y2;\r\n return _this;\r\n }\r\n /** @hidden */\r\n BezierCurveEase.prototype.easeInCore = function (gradient) {\r\n return BezierCurve.Interpolate(gradient, this.x1, this.y1, this.x2, this.y2);\r\n };\r\n return BezierCurveEase;\r\n}(EasingFunction));\r\nexport { BezierCurveEase };\r\n//# sourceMappingURL=easing.js.map","import { BackEase, EasingFunction } from \"../../Animations/easing\";\r\nimport { Animation } from \"../../Animations/animation\";\r\n/**\r\n * Add a bouncing effect to an ArcRotateCamera when reaching a specified minimum and maximum radius\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior\r\n */\r\nvar BouncingBehavior = /** @class */ (function () {\r\n function BouncingBehavior() {\r\n /**\r\n * The duration of the animation, in milliseconds\r\n */\r\n this.transitionDuration = 450;\r\n /**\r\n * Length of the distance animated by the transition when lower radius is reached\r\n */\r\n this.lowerRadiusTransitionRange = 2;\r\n /**\r\n * Length of the distance animated by the transition when upper radius is reached\r\n */\r\n this.upperRadiusTransitionRange = -2;\r\n this._autoTransitionRange = false;\r\n // Animations\r\n this._radiusIsAnimating = false;\r\n this._radiusBounceTransition = null;\r\n this._animatables = new Array();\r\n }\r\n Object.defineProperty(BouncingBehavior.prototype, \"name\", {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n get: function () {\r\n return \"Bouncing\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BouncingBehavior.prototype, \"autoTransitionRange\", {\r\n /**\r\n * Gets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically\r\n */\r\n get: function () {\r\n return this._autoTransitionRange;\r\n },\r\n /**\r\n * Sets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically\r\n * Transition ranges will be set to 5% of the bounding box diagonal in world space\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (this._autoTransitionRange === value) {\r\n return;\r\n }\r\n this._autoTransitionRange = value;\r\n var camera = this._attachedCamera;\r\n if (!camera) {\r\n return;\r\n }\r\n if (value) {\r\n this._onMeshTargetChangedObserver = camera.onMeshTargetChangedObservable.add(function (mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n mesh.computeWorldMatrix(true);\r\n var diagonal = mesh.getBoundingInfo().diagonalLength;\r\n _this.lowerRadiusTransitionRange = diagonal * 0.05;\r\n _this.upperRadiusTransitionRange = diagonal * 0.05;\r\n });\r\n }\r\n else if (this._onMeshTargetChangedObserver) {\r\n camera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior.\r\n */\r\n BouncingBehavior.prototype.init = function () {\r\n // Do notihng\r\n };\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n BouncingBehavior.prototype.attach = function (camera) {\r\n var _this = this;\r\n this._attachedCamera = camera;\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(function () {\r\n if (!_this._attachedCamera) {\r\n return;\r\n }\r\n // Add the bounce animation to the lower radius limit\r\n if (_this._isRadiusAtLimit(_this._attachedCamera.lowerRadiusLimit)) {\r\n _this._applyBoundRadiusAnimation(_this.lowerRadiusTransitionRange);\r\n }\r\n // Add the bounce animation to the upper radius limit\r\n if (_this._isRadiusAtLimit(_this._attachedCamera.upperRadiusLimit)) {\r\n _this._applyBoundRadiusAnimation(_this.upperRadiusTransitionRange);\r\n }\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n BouncingBehavior.prototype.detach = function () {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n if (this._onAfterCheckInputsObserver) {\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n }\r\n if (this._onMeshTargetChangedObserver) {\r\n this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n this._attachedCamera = null;\r\n };\r\n /**\r\n * Checks if the camera radius is at the specified limit. Takes into account animation locks.\r\n * @param radiusLimit The limit to check against.\r\n * @return Bool to indicate if at limit.\r\n */\r\n BouncingBehavior.prototype._isRadiusAtLimit = function (radiusLimit) {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n if (this._attachedCamera.radius === radiusLimit && !this._radiusIsAnimating) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Applies an animation to the radius of the camera, extending by the radiusDelta.\r\n * @param radiusDelta The delta by which to animate to. Can be negative.\r\n */\r\n BouncingBehavior.prototype._applyBoundRadiusAnimation = function (radiusDelta) {\r\n var _this = this;\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n if (!this._radiusBounceTransition) {\r\n BouncingBehavior.EasingFunction.setEasingMode(BouncingBehavior.EasingMode);\r\n this._radiusBounceTransition = Animation.CreateAnimation(\"radius\", Animation.ANIMATIONTYPE_FLOAT, 60, BouncingBehavior.EasingFunction);\r\n }\r\n // Prevent zoom until bounce has completed\r\n this._cachedWheelPrecision = this._attachedCamera.wheelPrecision;\r\n this._attachedCamera.wheelPrecision = Infinity;\r\n this._attachedCamera.inertialRadiusOffset = 0;\r\n // Animate to the radius limit\r\n this.stopAllAnimations();\r\n this._radiusIsAnimating = true;\r\n var animatable = Animation.TransitionTo(\"radius\", this._attachedCamera.radius + radiusDelta, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusBounceTransition, this.transitionDuration, function () { return _this._clearAnimationLocks(); });\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n };\r\n /**\r\n * Removes all animation locks. Allows new animations to be added to any of the camera properties.\r\n */\r\n BouncingBehavior.prototype._clearAnimationLocks = function () {\r\n this._radiusIsAnimating = false;\r\n if (this._attachedCamera) {\r\n this._attachedCamera.wheelPrecision = this._cachedWheelPrecision;\r\n }\r\n };\r\n /**\r\n * Stops and removes all animations that have been applied to the camera\r\n */\r\n BouncingBehavior.prototype.stopAllAnimations = function () {\r\n if (this._attachedCamera) {\r\n this._attachedCamera.animations = [];\r\n }\r\n while (this._animatables.length) {\r\n this._animatables[0].onAnimationEnd = null;\r\n this._animatables[0].stop();\r\n this._animatables.shift();\r\n }\r\n };\r\n /**\r\n * The easing function used by animations\r\n */\r\n BouncingBehavior.EasingFunction = new BackEase(0.3);\r\n /**\r\n * The easing mode used by animations\r\n */\r\n BouncingBehavior.EasingMode = EasingFunction.EASINGMODE_EASEOUT;\r\n return BouncingBehavior;\r\n}());\r\nexport { BouncingBehavior };\r\n//# sourceMappingURL=bouncingBehavior.js.map","import { ExponentialEase, EasingFunction } from \"../../Animations/easing\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\nimport { Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Animation } from \"../../Animations/animation\";\r\n/**\r\n * The framing behavior (FramingBehavior) is designed to automatically position an ArcRotateCamera when its target is set to a mesh. It is also useful if you want to prevent the camera to go under a virtual horizontal plane.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior\r\n */\r\nvar FramingBehavior = /** @class */ (function () {\r\n function FramingBehavior() {\r\n this._mode = FramingBehavior.FitFrustumSidesMode;\r\n this._radiusScale = 1.0;\r\n this._positionScale = 0.5;\r\n this._defaultElevation = 0.3;\r\n this._elevationReturnTime = 1500;\r\n this._elevationReturnWaitTime = 1000;\r\n this._zoomStopsAnimation = false;\r\n this._framingTime = 1500;\r\n /**\r\n * Define if the behavior should automatically change the configured\r\n * camera limits and sensibilities.\r\n */\r\n this.autoCorrectCameraLimitsAndSensibility = true;\r\n this._isPointerDown = false;\r\n this._lastInteractionTime = -Infinity;\r\n // Framing control\r\n this._animatables = new Array();\r\n this._betaIsAnimating = false;\r\n }\r\n Object.defineProperty(FramingBehavior.prototype, \"name\", {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n get: function () {\r\n return \"Framing\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"mode\", {\r\n /**\r\n * Gets current mode used by the behavior.\r\n */\r\n get: function () {\r\n return this._mode;\r\n },\r\n /**\r\n * Sets the current mode used by the behavior\r\n */\r\n set: function (mode) {\r\n this._mode = mode;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"radiusScale\", {\r\n /**\r\n * Gets the scale applied to the radius\r\n */\r\n get: function () {\r\n return this._radiusScale;\r\n },\r\n /**\r\n * Sets the scale applied to the radius (1 by default)\r\n */\r\n set: function (radius) {\r\n this._radiusScale = radius;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"positionScale\", {\r\n /**\r\n * Gets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.\r\n */\r\n get: function () {\r\n return this._positionScale;\r\n },\r\n /**\r\n * Sets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.\r\n */\r\n set: function (scale) {\r\n this._positionScale = scale;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"defaultElevation\", {\r\n /**\r\n * Gets the angle above/below the horizontal plane to return to when the return to default elevation idle\r\n * behaviour is triggered, in radians.\r\n */\r\n get: function () {\r\n return this._defaultElevation;\r\n },\r\n /**\r\n * Sets the angle above/below the horizontal plane to return to when the return to default elevation idle\r\n * behaviour is triggered, in radians.\r\n */\r\n set: function (elevation) {\r\n this._defaultElevation = elevation;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"elevationReturnTime\", {\r\n /**\r\n * Gets the time (in milliseconds) taken to return to the default beta position.\r\n * Negative value indicates camera should not return to default.\r\n */\r\n get: function () {\r\n return this._elevationReturnTime;\r\n },\r\n /**\r\n * Sets the time (in milliseconds) taken to return to the default beta position.\r\n * Negative value indicates camera should not return to default.\r\n */\r\n set: function (speed) {\r\n this._elevationReturnTime = speed;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"elevationReturnWaitTime\", {\r\n /**\r\n * Gets the delay (in milliseconds) taken before the camera returns to the default beta position.\r\n */\r\n get: function () {\r\n return this._elevationReturnWaitTime;\r\n },\r\n /**\r\n * Sets the delay (in milliseconds) taken before the camera returns to the default beta position.\r\n */\r\n set: function (time) {\r\n this._elevationReturnWaitTime = time;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"zoomStopsAnimation\", {\r\n /**\r\n * Gets the flag that indicates if user zooming should stop animation.\r\n */\r\n get: function () {\r\n return this._zoomStopsAnimation;\r\n },\r\n /**\r\n * Sets the flag that indicates if user zooming should stop animation.\r\n */\r\n set: function (flag) {\r\n this._zoomStopsAnimation = flag;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"framingTime\", {\r\n /**\r\n * Gets the transition time when framing the mesh, in milliseconds\r\n */\r\n get: function () {\r\n return this._framingTime;\r\n },\r\n /**\r\n * Sets the transition time when framing the mesh, in milliseconds\r\n */\r\n set: function (time) {\r\n this._framingTime = time;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior.\r\n */\r\n FramingBehavior.prototype.init = function () {\r\n // Do notihng\r\n };\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n FramingBehavior.prototype.attach = function (camera) {\r\n var _this = this;\r\n this._attachedCamera = camera;\r\n var scene = this._attachedCamera.getScene();\r\n FramingBehavior.EasingFunction.setEasingMode(FramingBehavior.EasingMode);\r\n this._onPrePointerObservableObserver = scene.onPrePointerObservable.add(function (pointerInfoPre) {\r\n if (pointerInfoPre.type === PointerEventTypes.POINTERDOWN) {\r\n _this._isPointerDown = true;\r\n return;\r\n }\r\n if (pointerInfoPre.type === PointerEventTypes.POINTERUP) {\r\n _this._isPointerDown = false;\r\n }\r\n });\r\n this._onMeshTargetChangedObserver = camera.onMeshTargetChangedObservable.add(function (mesh) {\r\n if (mesh) {\r\n _this.zoomOnMesh(mesh);\r\n }\r\n });\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(function () {\r\n // Stop the animation if there is user interaction and the animation should stop for this interaction\r\n _this._applyUserInteraction();\r\n // Maintain the camera above the ground. If the user pulls the camera beneath the ground plane, lift it\r\n // back to the default position after a given timeout\r\n _this._maintainCameraAboveGround();\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n FramingBehavior.prototype.detach = function () {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n var scene = this._attachedCamera.getScene();\r\n if (this._onPrePointerObservableObserver) {\r\n scene.onPrePointerObservable.remove(this._onPrePointerObservableObserver);\r\n }\r\n if (this._onAfterCheckInputsObserver) {\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n }\r\n if (this._onMeshTargetChangedObserver) {\r\n this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n this._attachedCamera = null;\r\n };\r\n /**\r\n * Targets the given mesh and updates zoom level accordingly.\r\n * @param mesh The mesh to target.\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnMesh = function (mesh, focusOnOriginXZ, onAnimationEnd) {\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n mesh.computeWorldMatrix(true);\r\n var boundingBox = mesh.getBoundingInfo().boundingBox;\r\n this.zoomOnBoundingInfo(boundingBox.minimumWorld, boundingBox.maximumWorld, focusOnOriginXZ, onAnimationEnd);\r\n };\r\n /**\r\n * Targets the given mesh with its children and updates zoom level accordingly.\r\n * @param mesh The mesh to target.\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnMeshHierarchy = function (mesh, focusOnOriginXZ, onAnimationEnd) {\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n mesh.computeWorldMatrix(true);\r\n var boundingBox = mesh.getHierarchyBoundingVectors(true);\r\n this.zoomOnBoundingInfo(boundingBox.min, boundingBox.max, focusOnOriginXZ, onAnimationEnd);\r\n };\r\n /**\r\n * Targets the given meshes with their children and updates zoom level accordingly.\r\n * @param meshes The mesh to target.\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnMeshesHierarchy = function (meshes, focusOnOriginXZ, onAnimationEnd) {\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n var min = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var max = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n for (var i = 0; i < meshes.length; i++) {\r\n var boundingInfo = meshes[i].getHierarchyBoundingVectors(true);\r\n Vector3.CheckExtends(boundingInfo.min, min, max);\r\n Vector3.CheckExtends(boundingInfo.max, min, max);\r\n }\r\n this.zoomOnBoundingInfo(min, max, focusOnOriginXZ, onAnimationEnd);\r\n };\r\n /**\r\n * Targets the bounding box info defined by its extends and updates zoom level accordingly.\r\n * @param minimumWorld Determines the smaller position of the bounding box extend\r\n * @param maximumWorld Determines the bigger position of the bounding box extend\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnBoundingInfo = function (minimumWorld, maximumWorld, focusOnOriginXZ, onAnimationEnd) {\r\n var _this = this;\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n var zoomTarget;\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n // Find target by interpolating from bottom of bounding box in world-space to top via framingPositionY\r\n var bottom = minimumWorld.y;\r\n var top = maximumWorld.y;\r\n var zoomTargetY = bottom + (top - bottom) * this._positionScale;\r\n var radiusWorld = maximumWorld.subtract(minimumWorld).scale(0.5);\r\n if (focusOnOriginXZ) {\r\n zoomTarget = new Vector3(0, zoomTargetY, 0);\r\n }\r\n else {\r\n var centerWorld = minimumWorld.add(radiusWorld);\r\n zoomTarget = new Vector3(centerWorld.x, zoomTargetY, centerWorld.z);\r\n }\r\n if (!this._vectorTransition) {\r\n this._vectorTransition = Animation.CreateAnimation(\"target\", Animation.ANIMATIONTYPE_VECTOR3, 60, FramingBehavior.EasingFunction);\r\n }\r\n this._betaIsAnimating = true;\r\n var animatable = Animation.TransitionTo(\"target\", zoomTarget, this._attachedCamera, this._attachedCamera.getScene(), 60, this._vectorTransition, this._framingTime);\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n // sets the radius and lower radius bounds\r\n // Small delta ensures camera is not always at lower zoom limit.\r\n var radius = 0;\r\n if (this._mode === FramingBehavior.FitFrustumSidesMode) {\r\n var position = this._calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld);\r\n if (this.autoCorrectCameraLimitsAndSensibility) {\r\n this._attachedCamera.lowerRadiusLimit = radiusWorld.length() + this._attachedCamera.minZ;\r\n }\r\n radius = position;\r\n }\r\n else if (this._mode === FramingBehavior.IgnoreBoundsSizeMode) {\r\n radius = this._calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld);\r\n if (this.autoCorrectCameraLimitsAndSensibility && this._attachedCamera.lowerRadiusLimit === null) {\r\n this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ;\r\n }\r\n }\r\n // Set sensibilities\r\n if (this.autoCorrectCameraLimitsAndSensibility) {\r\n var extend = maximumWorld.subtract(minimumWorld).length();\r\n this._attachedCamera.panningSensibility = 5000 / extend;\r\n this._attachedCamera.wheelPrecision = 100 / radius;\r\n }\r\n // transition to new radius\r\n if (!this._radiusTransition) {\r\n this._radiusTransition = Animation.CreateAnimation(\"radius\", Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);\r\n }\r\n animatable = Animation.TransitionTo(\"radius\", radius, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, function () {\r\n _this.stopAllAnimations();\r\n if (onAnimationEnd) {\r\n onAnimationEnd();\r\n }\r\n if (_this._attachedCamera && _this._attachedCamera.useInputToRestoreState) {\r\n _this._attachedCamera.storeState();\r\n }\r\n });\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n };\r\n /**\r\n * Calculates the lowest radius for the camera based on the bounding box of the mesh.\r\n * @param mesh The mesh on which to base the calculation. mesh boundingInfo used to estimate necessary\r\n *\t\t\t frustum width.\r\n * @return The minimum distance from the primary mesh's center point at which the camera must be kept in order\r\n *\t\t to fully enclose the mesh in the viewing frustum.\r\n */\r\n FramingBehavior.prototype._calculateLowerRadiusFromModelBoundingSphere = function (minimumWorld, maximumWorld) {\r\n var size = maximumWorld.subtract(minimumWorld);\r\n var boxVectorGlobalDiagonal = size.length();\r\n var frustumSlope = this._getFrustumSlope();\r\n // Formula for setting distance\r\n // (Good explanation: http://stackoverflow.com/questions/2866350/move-camera-to-fit-3d-scene)\r\n var radiusWithoutFraming = boxVectorGlobalDiagonal * 0.5;\r\n // Horizon distance\r\n var radius = radiusWithoutFraming * this._radiusScale;\r\n var distanceForHorizontalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlope.x * frustumSlope.x));\r\n var distanceForVerticalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlope.y * frustumSlope.y));\r\n var distance = Math.max(distanceForHorizontalFrustum, distanceForVerticalFrustum);\r\n var camera = this._attachedCamera;\r\n if (!camera) {\r\n return 0;\r\n }\r\n if (camera.lowerRadiusLimit && this._mode === FramingBehavior.IgnoreBoundsSizeMode) {\r\n // Don't exceed the requested limit\r\n distance = distance < camera.lowerRadiusLimit ? camera.lowerRadiusLimit : distance;\r\n }\r\n // Don't exceed the upper radius limit\r\n if (camera.upperRadiusLimit) {\r\n distance = distance > camera.upperRadiusLimit ? camera.upperRadiusLimit : distance;\r\n }\r\n return distance;\r\n };\r\n /**\r\n * Keeps the camera above the ground plane. If the user pulls the camera below the ground plane, the camera\r\n * is automatically returned to its default position (expected to be above ground plane).\r\n */\r\n FramingBehavior.prototype._maintainCameraAboveGround = function () {\r\n var _this = this;\r\n if (this._elevationReturnTime < 0) {\r\n return;\r\n }\r\n var timeSinceInteraction = PrecisionDate.Now - this._lastInteractionTime;\r\n var defaultBeta = Math.PI * 0.5 - this._defaultElevation;\r\n var limitBeta = Math.PI * 0.5;\r\n // Bring the camera back up if below the ground plane\r\n if (this._attachedCamera && !this._betaIsAnimating && this._attachedCamera.beta > limitBeta && timeSinceInteraction >= this._elevationReturnWaitTime) {\r\n this._betaIsAnimating = true;\r\n //Transition to new position\r\n this.stopAllAnimations();\r\n if (!this._betaTransition) {\r\n this._betaTransition = Animation.CreateAnimation(\"beta\", Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);\r\n }\r\n var animatabe = Animation.TransitionTo(\"beta\", defaultBeta, this._attachedCamera, this._attachedCamera.getScene(), 60, this._betaTransition, this._elevationReturnTime, function () {\r\n _this._clearAnimationLocks();\r\n _this.stopAllAnimations();\r\n });\r\n if (animatabe) {\r\n this._animatables.push(animatabe);\r\n }\r\n }\r\n };\r\n /**\r\n * Returns the frustum slope based on the canvas ratio and camera FOV\r\n * @returns The frustum slope represented as a Vector2 with X and Y slopes\r\n */\r\n FramingBehavior.prototype._getFrustumSlope = function () {\r\n // Calculate the viewport ratio\r\n // Aspect Ratio is Height/Width.\r\n var camera = this._attachedCamera;\r\n if (!camera) {\r\n return Vector2.Zero();\r\n }\r\n var engine = camera.getScene().getEngine();\r\n var aspectRatio = engine.getAspectRatio(camera);\r\n // Camera FOV is the vertical field of view (top-bottom) in radians.\r\n // Slope of the frustum top/bottom planes in view space, relative to the forward vector.\r\n var frustumSlopeY = Math.tan(camera.fov / 2);\r\n // Slope of the frustum left/right planes in view space, relative to the forward vector.\r\n // Provides the amount that one side (e.g. left) of the frustum gets wider for every unit\r\n // along the forward vector.\r\n var frustumSlopeX = frustumSlopeY * aspectRatio;\r\n return new Vector2(frustumSlopeX, frustumSlopeY);\r\n };\r\n /**\r\n * Removes all animation locks. Allows new animations to be added to any of the arcCamera properties.\r\n */\r\n FramingBehavior.prototype._clearAnimationLocks = function () {\r\n this._betaIsAnimating = false;\r\n };\r\n /**\r\n * Applies any current user interaction to the camera. Takes into account maximum alpha rotation.\r\n */\r\n FramingBehavior.prototype._applyUserInteraction = function () {\r\n if (this.isUserIsMoving) {\r\n this._lastInteractionTime = PrecisionDate.Now;\r\n this.stopAllAnimations();\r\n this._clearAnimationLocks();\r\n }\r\n };\r\n /**\r\n * Stops and removes all animations that have been applied to the camera\r\n */\r\n FramingBehavior.prototype.stopAllAnimations = function () {\r\n if (this._attachedCamera) {\r\n this._attachedCamera.animations = [];\r\n }\r\n while (this._animatables.length) {\r\n if (this._animatables[0]) {\r\n this._animatables[0].onAnimationEnd = null;\r\n this._animatables[0].stop();\r\n }\r\n this._animatables.shift();\r\n }\r\n };\r\n Object.defineProperty(FramingBehavior.prototype, \"isUserIsMoving\", {\r\n /**\r\n * Gets a value indicating if the user is moving the camera\r\n */\r\n get: function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n return this._attachedCamera.inertialAlphaOffset !== 0 ||\r\n this._attachedCamera.inertialBetaOffset !== 0 ||\r\n this._attachedCamera.inertialRadiusOffset !== 0 ||\r\n this._attachedCamera.inertialPanningX !== 0 ||\r\n this._attachedCamera.inertialPanningY !== 0 ||\r\n this._isPointerDown;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * The easing function used by animations\r\n */\r\n FramingBehavior.EasingFunction = new ExponentialEase();\r\n /**\r\n * The easing mode used by animations\r\n */\r\n FramingBehavior.EasingMode = EasingFunction.EASINGMODE_EASEINOUT;\r\n // Statics\r\n /**\r\n * The camera can move all the way towards the mesh.\r\n */\r\n FramingBehavior.IgnoreBoundsSizeMode = 0;\r\n /**\r\n * The camera is not allowed to zoom closer to the mesh than the point at which the adjusted bounding sphere touches the frustum sides\r\n */\r\n FramingBehavior.FitFrustumSidesMode = 1;\r\n return FramingBehavior;\r\n}());\r\nexport { FramingBehavior };\r\n//# sourceMappingURL=framingBehavior.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport { BaseCameraPointersInput } from \"../../Cameras/Inputs/BaseCameraPointersInput\";\r\n/**\r\n * Manage the pointers inputs to control an arc rotate camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraPointersInput = /** @class */ (function (_super) {\r\n __extends(ArcRotateCameraPointersInput, _super);\r\n function ArcRotateCameraPointersInput() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * Defines the buttons associated with the input to handle camera move.\r\n */\r\n _this.buttons = [0, 1, 2];\r\n /**\r\n * Defines the pointer angular sensibility along the X axis or how fast is\r\n * the camera rotating.\r\n */\r\n _this.angularSensibilityX = 1000.0;\r\n /**\r\n * Defines the pointer angular sensibility along the Y axis or how fast is\r\n * the camera rotating.\r\n */\r\n _this.angularSensibilityY = 1000.0;\r\n /**\r\n * Defines the pointer pinch precision or how fast is the camera zooming.\r\n */\r\n _this.pinchPrecision = 12.0;\r\n /**\r\n * pinchDeltaPercentage will be used instead of pinchPrecision if different\r\n * from 0.\r\n * It defines the percentage of current camera.radius to use as delta when\r\n * pinch zoom is used.\r\n */\r\n _this.pinchDeltaPercentage = 0;\r\n /**\r\n * When useNaturalPinchZoom is true, multi touch zoom will zoom in such\r\n * that any object in the plane at the camera's target point will scale\r\n * perfectly with finger motion.\r\n * Overrides pinchDeltaPercentage and pinchPrecision.\r\n */\r\n _this.useNaturalPinchZoom = false;\r\n /**\r\n * Defines the pointer panning sensibility or how fast is the camera moving.\r\n */\r\n _this.panningSensibility = 1000.0;\r\n /**\r\n * Defines whether panning (2 fingers swipe) is enabled through multitouch.\r\n */\r\n _this.multiTouchPanning = true;\r\n /**\r\n * Defines whether panning is enabled for both pan (2 fingers swipe) and\r\n * zoom (pinch) through multitouch.\r\n */\r\n _this.multiTouchPanAndZoom = true;\r\n /**\r\n * Revers pinch action direction.\r\n */\r\n _this.pinchInwards = true;\r\n _this._isPanClick = false;\r\n _this._twoFingerActivityCount = 0;\r\n _this._isPinching = false;\r\n return _this;\r\n }\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraPointersInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraPointersInput\";\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if only a single touch is active.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onTouch = function (point, offsetX, offsetY) {\r\n if (this.panningSensibility !== 0 &&\r\n ((this._ctrlKey && this.camera._useCtrlForPanning) || this._isPanClick)) {\r\n this.camera.inertialPanningX += -offsetX / this.panningSensibility;\r\n this.camera.inertialPanningY += offsetY / this.panningSensibility;\r\n }\r\n else {\r\n this.camera.inertialAlphaOffset -= offsetX / this.angularSensibilityX;\r\n this.camera.inertialBetaOffset -= offsetY / this.angularSensibilityY;\r\n }\r\n };\r\n /**\r\n * Called on pointer POINTERDOUBLETAP event.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onDoubleTap = function (type) {\r\n if (this.camera.useInputToRestoreState) {\r\n this.camera.restoreState();\r\n }\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if multiple touches are active.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onMultiTouch = function (pointA, pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition) {\r\n if (previousPinchSquaredDistance === 0 && previousMultiTouchPanPosition === null) {\r\n // First time this method is called for new pinch.\r\n // Next time this is called there will be a\r\n // previousPinchSquaredDistance and pinchSquaredDistance to compare.\r\n return;\r\n }\r\n if (pinchSquaredDistance === 0 && multiTouchPanPosition === null) {\r\n // Last time this method is called at the end of a pinch.\r\n return;\r\n }\r\n var direction = this.pinchInwards ? 1 : -1;\r\n if (this.multiTouchPanAndZoom) {\r\n if (this.useNaturalPinchZoom) {\r\n this.camera.radius = this.camera.radius *\r\n Math.sqrt(previousPinchSquaredDistance) / Math.sqrt(pinchSquaredDistance);\r\n }\r\n else if (this.pinchDeltaPercentage) {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) * 0.001 *\r\n this.camera.radius * this.pinchDeltaPercentage;\r\n }\r\n else {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) /\r\n (this.pinchPrecision * direction *\r\n (this.angularSensibilityX + this.angularSensibilityY) / 2);\r\n }\r\n if (this.panningSensibility !== 0 &&\r\n previousMultiTouchPanPosition && multiTouchPanPosition) {\r\n var moveDeltaX = multiTouchPanPosition.x - previousMultiTouchPanPosition.x;\r\n var moveDeltaY = multiTouchPanPosition.y - previousMultiTouchPanPosition.y;\r\n this.camera.inertialPanningX += -moveDeltaX / this.panningSensibility;\r\n this.camera.inertialPanningY += moveDeltaY / this.panningSensibility;\r\n }\r\n }\r\n else {\r\n this._twoFingerActivityCount++;\r\n var previousPinchDistance = Math.sqrt(previousPinchSquaredDistance);\r\n var pinchDistance = Math.sqrt(pinchSquaredDistance);\r\n if (this._isPinching ||\r\n (this._twoFingerActivityCount < 20 &&\r\n Math.abs(pinchDistance - previousPinchDistance) >\r\n this.camera.pinchToPanMaxDistance)) {\r\n // Since pinch has not been active long, assume we intend to zoom.\r\n if (this.pinchDeltaPercentage) {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) * 0.001 *\r\n this.camera.radius * this.pinchDeltaPercentage;\r\n }\r\n else {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) /\r\n (this.pinchPrecision * direction *\r\n (this.angularSensibilityX + this.angularSensibilityY) / 2);\r\n }\r\n // Since we are pinching, remain pinching on next iteration.\r\n this._isPinching = true;\r\n }\r\n else {\r\n // Pause between pinch starting and moving implies not a zoom event.\r\n // Pan instead.\r\n if (this.panningSensibility !== 0 && this.multiTouchPanning &&\r\n multiTouchPanPosition && previousMultiTouchPanPosition) {\r\n var moveDeltaX = multiTouchPanPosition.x - previousMultiTouchPanPosition.x;\r\n var moveDeltaY = multiTouchPanPosition.y - previousMultiTouchPanPosition.y;\r\n this.camera.inertialPanningX += -moveDeltaX / this.panningSensibility;\r\n this.camera.inertialPanningY += moveDeltaY / this.panningSensibility;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Called each time a new POINTERDOWN event occurs. Ie, for each button\r\n * press.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onButtonDown = function (evt) {\r\n this._isPanClick = evt.button === this.camera._panningMouseButton;\r\n };\r\n /**\r\n * Called each time a new POINTERUP event occurs. Ie, for each button\r\n * release.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onButtonUp = function (evt) {\r\n this._twoFingerActivityCount = 0;\r\n this._isPinching = false;\r\n };\r\n /**\r\n * Called when window becomes inactive.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onLostFocus = function () {\r\n this._isPanClick = false;\r\n this._twoFingerActivityCount = 0;\r\n this._isPinching = false;\r\n };\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"buttons\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"angularSensibilityX\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"angularSensibilityY\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"pinchPrecision\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"pinchDeltaPercentage\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"useNaturalPinchZoom\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"panningSensibility\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"multiTouchPanning\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"multiTouchPanAndZoom\", void 0);\r\n return ArcRotateCameraPointersInput;\r\n}(BaseCameraPointersInput));\r\nexport { ArcRotateCameraPointersInput };\r\nCameraInputTypes[\"ArcRotateCameraPointersInput\"] =\r\n ArcRotateCameraPointersInput;\r\n//# sourceMappingURL=arcRotateCameraPointersInput.js.map","import { __decorate } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\n/**\r\n * Base class for Camera Pointer Inputs.\r\n * See FollowCameraPointersInput in src/Cameras/Inputs/followCameraPointersInput.ts\r\n * for example usage.\r\n */\r\nvar BaseCameraPointersInput = /** @class */ (function () {\r\n function BaseCameraPointersInput() {\r\n /**\r\n * Defines the buttons associated with the input to handle camera move.\r\n */\r\n this.buttons = [0, 1, 2];\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n BaseCameraPointersInput.prototype.attachControl = function (noPreventDefault) {\r\n var _this = this;\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n var engine = this.camera.getEngine();\r\n var element = engine.getInputElement();\r\n var previousPinchSquaredDistance = 0;\r\n var previousMultiTouchPanPosition = null;\r\n this.pointA = null;\r\n this.pointB = null;\r\n this._altKey = false;\r\n this._ctrlKey = false;\r\n this._metaKey = false;\r\n this._shiftKey = false;\r\n this._buttonsPressed = 0;\r\n this._pointerInput = function (p, s) {\r\n var evt = p.event;\r\n var isTouch = evt.pointerType === \"touch\";\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n if (p.type !== PointerEventTypes.POINTERMOVE &&\r\n _this.buttons.indexOf(evt.button) === -1) {\r\n return;\r\n }\r\n var srcElement = (evt.srcElement || evt.target);\r\n _this._altKey = evt.altKey;\r\n _this._ctrlKey = evt.ctrlKey;\r\n _this._metaKey = evt.metaKey;\r\n _this._shiftKey = evt.shiftKey;\r\n _this._buttonsPressed = evt.buttons;\r\n if (engine.isPointerLock) {\r\n var offsetX = evt.movementX ||\r\n evt.mozMovementX ||\r\n evt.webkitMovementX ||\r\n evt.msMovementX ||\r\n 0;\r\n var offsetY = evt.movementY ||\r\n evt.mozMovementY ||\r\n evt.webkitMovementY ||\r\n evt.msMovementY ||\r\n 0;\r\n _this.onTouch(null, offsetX, offsetY);\r\n _this.pointA = null;\r\n _this.pointB = null;\r\n }\r\n else if (p.type === PointerEventTypes.POINTERDOWN && srcElement) {\r\n try {\r\n srcElement.setPointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error. Execution will continue.\r\n }\r\n if (_this.pointA === null) {\r\n _this.pointA = { x: evt.clientX,\r\n y: evt.clientY,\r\n pointerId: evt.pointerId,\r\n type: evt.pointerType };\r\n }\r\n else if (_this.pointB === null) {\r\n _this.pointB = { x: evt.clientX,\r\n y: evt.clientY,\r\n pointerId: evt.pointerId,\r\n type: evt.pointerType };\r\n }\r\n _this.onButtonDown(evt);\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n element && element.focus();\r\n }\r\n }\r\n else if (p.type === PointerEventTypes.POINTERDOUBLETAP) {\r\n _this.onDoubleTap(evt.pointerType);\r\n }\r\n else if (p.type === PointerEventTypes.POINTERUP && srcElement) {\r\n try {\r\n srcElement.releasePointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error.\r\n }\r\n if (!isTouch) {\r\n _this.pointB = null; // Mouse and pen are mono pointer\r\n }\r\n //would be better to use pointers.remove(evt.pointerId) for multitouch gestures,\r\n //but emptying completely pointers collection is required to fix a bug on iPhone :\r\n //when changing orientation while pinching camera,\r\n //one pointer stay pressed forever if we don't release all pointers\r\n //will be ok to put back pointers.remove(evt.pointerId); when iPhone bug corrected\r\n if (engine._badOS) {\r\n _this.pointA = _this.pointB = null;\r\n }\r\n else {\r\n //only remove the impacted pointer in case of multitouch allowing on most\r\n //platforms switching from rotate to zoom and pan seamlessly.\r\n if (_this.pointB && _this.pointA && _this.pointA.pointerId == evt.pointerId) {\r\n _this.pointA = _this.pointB;\r\n _this.pointB = null;\r\n }\r\n else if (_this.pointA && _this.pointB &&\r\n _this.pointB.pointerId == evt.pointerId) {\r\n _this.pointB = null;\r\n }\r\n else {\r\n _this.pointA = _this.pointB = null;\r\n }\r\n }\r\n if (previousPinchSquaredDistance !== 0 || previousMultiTouchPanPosition) {\r\n // Previous pinch data is populated but a button has been lifted\r\n // so pinch has ended.\r\n _this.onMultiTouch(_this.pointA, _this.pointB, previousPinchSquaredDistance, 0, // pinchSquaredDistance\r\n previousMultiTouchPanPosition, null // multiTouchPanPosition\r\n );\r\n previousPinchSquaredDistance = 0;\r\n previousMultiTouchPanPosition = null;\r\n }\r\n _this.onButtonUp(evt);\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n else if (p.type === PointerEventTypes.POINTERMOVE) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n // One button down\r\n if (_this.pointA && _this.pointB === null) {\r\n var offsetX = evt.clientX - _this.pointA.x;\r\n var offsetY = evt.clientY - _this.pointA.y;\r\n _this.onTouch(_this.pointA, offsetX, offsetY);\r\n _this.pointA.x = evt.clientX;\r\n _this.pointA.y = evt.clientY;\r\n }\r\n // Two buttons down: pinch\r\n else if (_this.pointA && _this.pointB) {\r\n var ed = (_this.pointA.pointerId === evt.pointerId) ?\r\n _this.pointA : _this.pointB;\r\n ed.x = evt.clientX;\r\n ed.y = evt.clientY;\r\n var distX = _this.pointA.x - _this.pointB.x;\r\n var distY = _this.pointA.y - _this.pointB.y;\r\n var pinchSquaredDistance = (distX * distX) + (distY * distY);\r\n var multiTouchPanPosition = { x: (_this.pointA.x + _this.pointB.x) / 2,\r\n y: (_this.pointA.y + _this.pointB.y) / 2,\r\n pointerId: evt.pointerId,\r\n type: p.type };\r\n _this.onMultiTouch(_this.pointA, _this.pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition);\r\n previousMultiTouchPanPosition = multiTouchPanPosition;\r\n previousPinchSquaredDistance = pinchSquaredDistance;\r\n }\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP |\r\n PointerEventTypes.POINTERMOVE);\r\n this._onLostFocus = function () {\r\n _this.pointA = _this.pointB = null;\r\n previousPinchSquaredDistance = 0;\r\n previousMultiTouchPanPosition = null;\r\n _this.onLostFocus();\r\n };\r\n element && element.addEventListener(\"contextmenu\", this.onContextMenu.bind(this), false);\r\n var hostWindow = this.camera.getScene().getEngine().getHostWindow();\r\n if (hostWindow) {\r\n Tools.RegisterTopRootEvents(hostWindow, [\r\n { name: \"blur\", handler: this._onLostFocus }\r\n ]);\r\n }\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n BaseCameraPointersInput.prototype.detachControl = function (ignored) {\r\n if (this._onLostFocus) {\r\n var hostWindow = this.camera.getScene().getEngine().getHostWindow();\r\n if (hostWindow) {\r\n Tools.UnregisterTopRootEvents(hostWindow, [\r\n { name: \"blur\", handler: this._onLostFocus }\r\n ]);\r\n }\r\n }\r\n if (this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n if (this.onContextMenu) {\r\n var inputElement = this.camera.getScene().getEngine().getInputElement();\r\n inputElement && inputElement.removeEventListener(\"contextmenu\", this.onContextMenu);\r\n }\r\n this._onLostFocus = null;\r\n }\r\n this._altKey = false;\r\n this._ctrlKey = false;\r\n this._metaKey = false;\r\n this._shiftKey = false;\r\n this._buttonsPressed = 0;\r\n };\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n BaseCameraPointersInput.prototype.getClassName = function () {\r\n return \"BaseCameraPointersInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n BaseCameraPointersInput.prototype.getSimpleName = function () {\r\n return \"pointers\";\r\n };\r\n /**\r\n * Called on pointer POINTERDOUBLETAP event.\r\n * Override this method to provide functionality on POINTERDOUBLETAP event.\r\n */\r\n BaseCameraPointersInput.prototype.onDoubleTap = function (type) {\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if only a single touch is active.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onTouch = function (point, offsetX, offsetY) {\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if multiple touches are active.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onMultiTouch = function (pointA, pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition) {\r\n };\r\n /**\r\n * Called on JS contextmenu event.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onContextMenu = function (evt) {\r\n evt.preventDefault();\r\n };\r\n /**\r\n * Called each time a new POINTERDOWN event occurs. Ie, for each button\r\n * press.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onButtonDown = function (evt) {\r\n };\r\n /**\r\n * Called each time a new POINTERUP event occurs. Ie, for each button\r\n * release.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onButtonUp = function (evt) {\r\n };\r\n /**\r\n * Called when window becomes inactive.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onLostFocus = function () {\r\n };\r\n __decorate([\r\n serialize()\r\n ], BaseCameraPointersInput.prototype, \"buttons\", void 0);\r\n return BaseCameraPointersInput;\r\n}());\r\nexport { BaseCameraPointersInput };\r\n//# sourceMappingURL=BaseCameraPointersInput.js.map","import { __decorate } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport { KeyboardEventTypes } from \"../../Events/keyboardEvents\";\r\nimport { Tools } from '../../Misc/tools';\r\n/**\r\n * Manage the keyboard inputs to control the movement of an arc rotate camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraKeyboardMoveInput = /** @class */ (function () {\r\n function ArcRotateCameraKeyboardMoveInput() {\r\n /**\r\n * Defines the list of key codes associated with the up action (increase alpha)\r\n */\r\n this.keysUp = [38];\r\n /**\r\n * Defines the list of key codes associated with the down action (decrease alpha)\r\n */\r\n this.keysDown = [40];\r\n /**\r\n * Defines the list of key codes associated with the left action (increase beta)\r\n */\r\n this.keysLeft = [37];\r\n /**\r\n * Defines the list of key codes associated with the right action (decrease beta)\r\n */\r\n this.keysRight = [39];\r\n /**\r\n * Defines the list of key codes associated with the reset action.\r\n * Those keys reset the camera to its last stored state (with the method camera.storeState())\r\n */\r\n this.keysReset = [220];\r\n /**\r\n * Defines the panning sensibility of the inputs.\r\n * (How fast is the camera panning)\r\n */\r\n this.panningSensibility = 50.0;\r\n /**\r\n * Defines the zooming sensibility of the inputs.\r\n * (How fast is the camera zooming)\r\n */\r\n this.zoomingSensibility = 25.0;\r\n /**\r\n * Defines whether maintaining the alt key down switch the movement mode from\r\n * orientation to zoom.\r\n */\r\n this.useAltToZoom = true;\r\n /**\r\n * Rotation speed of the camera\r\n */\r\n this.angularSpeed = 0.01;\r\n this._keys = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.attachControl = function (noPreventDefault) {\r\n var _this = this;\r\n // was there a second variable defined?\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n if (this._onCanvasBlurObserver) {\r\n return;\r\n }\r\n this._scene = this.camera.getScene();\r\n this._engine = this._scene.getEngine();\r\n this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function () {\r\n _this._keys = [];\r\n });\r\n this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function (info) {\r\n var evt = info.event;\r\n if (!evt.metaKey) {\r\n if (info.type === KeyboardEventTypes.KEYDOWN) {\r\n _this._ctrlPressed = evt.ctrlKey;\r\n _this._altPressed = evt.altKey;\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1 || _this.keysReset.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index === -1) {\r\n _this._keys.push(evt.keyCode);\r\n }\r\n if (evt.preventDefault) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1 || _this.keysReset.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index >= 0) {\r\n _this._keys.splice(index, 1);\r\n }\r\n if (evt.preventDefault) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.detachControl = function (ignored) {\r\n if (this._scene) {\r\n if (this._onKeyboardObserver) {\r\n this._scene.onKeyboardObservable.remove(this._onKeyboardObserver);\r\n }\r\n if (this._onCanvasBlurObserver) {\r\n this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n this._onKeyboardObserver = null;\r\n this._onCanvasBlurObserver = null;\r\n }\r\n this._keys = [];\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.checkInputs = function () {\r\n if (this._onKeyboardObserver) {\r\n var camera = this.camera;\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var keyCode = this._keys[index];\r\n if (this.keysLeft.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningX -= 1 / this.panningSensibility;\r\n }\r\n else {\r\n camera.inertialAlphaOffset -= this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysUp.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningY += 1 / this.panningSensibility;\r\n }\r\n else if (this._altPressed && this.useAltToZoom) {\r\n camera.inertialRadiusOffset += 1 / this.zoomingSensibility;\r\n }\r\n else {\r\n camera.inertialBetaOffset -= this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysRight.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningX += 1 / this.panningSensibility;\r\n }\r\n else {\r\n camera.inertialAlphaOffset += this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysDown.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningY -= 1 / this.panningSensibility;\r\n }\r\n else if (this._altPressed && this.useAltToZoom) {\r\n camera.inertialRadiusOffset -= 1 / this.zoomingSensibility;\r\n }\r\n else {\r\n camera.inertialBetaOffset += this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysReset.indexOf(keyCode) !== -1) {\r\n if (camera.useInputToRestoreState) {\r\n camera.restoreState();\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraKeyboardMoveInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.getSimpleName = function () {\r\n return \"keyboard\";\r\n };\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysUp\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysDown\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysLeft\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysRight\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysReset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"panningSensibility\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"zoomingSensibility\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"useAltToZoom\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"angularSpeed\", void 0);\r\n return ArcRotateCameraKeyboardMoveInput;\r\n}());\r\nexport { ArcRotateCameraKeyboardMoveInput };\r\nCameraInputTypes[\"ArcRotateCameraKeyboardMoveInput\"] = ArcRotateCameraKeyboardMoveInput;\r\n//# sourceMappingURL=arcRotateCameraKeyboardMoveInput.js.map","import { __decorate } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Scalar } from '../../Maths/math.scalar';\r\nimport { Tools } from '../../Misc/tools';\r\n/**\r\n * Manage the mouse wheel inputs to control an arc rotate camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraMouseWheelInput = /** @class */ (function () {\r\n function ArcRotateCameraMouseWheelInput() {\r\n /**\r\n * Gets or Set the mouse wheel precision or how fast is the camera zooming.\r\n */\r\n this.wheelPrecision = 3.0;\r\n /**\r\n * wheelDeltaPercentage will be used instead of wheelPrecision if different from 0.\r\n * It defines the percentage of current camera.radius to use as delta when wheel is used.\r\n */\r\n this.wheelDeltaPercentage = 0;\r\n }\r\n ArcRotateCameraMouseWheelInput.prototype.computeDeltaFromMouseWheelLegacyEvent = function (mouseWheelDelta, radius) {\r\n var delta = 0;\r\n var wheelDelta = (mouseWheelDelta * 0.01 * this.wheelDeltaPercentage) * radius;\r\n if (mouseWheelDelta > 0) {\r\n delta = wheelDelta / (1.0 + this.wheelDeltaPercentage);\r\n }\r\n else {\r\n delta = wheelDelta * (1.0 + this.wheelDeltaPercentage);\r\n }\r\n return delta;\r\n };\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.attachControl = function (noPreventDefault) {\r\n var _this = this;\r\n // was there a second variable defined?\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n this._wheel = function (p, s) {\r\n //sanity check - this should be a PointerWheel event.\r\n if (p.type !== PointerEventTypes.POINTERWHEEL) {\r\n return;\r\n }\r\n var event = p.event;\r\n var delta = 0;\r\n var mouseWheelLegacyEvent = event;\r\n var wheelDelta = 0;\r\n if (mouseWheelLegacyEvent.wheelDelta) {\r\n wheelDelta = mouseWheelLegacyEvent.wheelDelta;\r\n }\r\n else {\r\n wheelDelta = -(event.deltaY || event.detail) * 60;\r\n }\r\n if (_this.wheelDeltaPercentage) {\r\n delta = _this.computeDeltaFromMouseWheelLegacyEvent(wheelDelta, _this.camera.radius);\r\n // If zooming in, estimate the target radius and use that to compute the delta for inertia\r\n // this will stop multiple scroll events zooming in from adding too much inertia\r\n if (delta > 0) {\r\n var estimatedTargetRadius = _this.camera.radius;\r\n var targetInertia = _this.camera.inertialRadiusOffset + delta;\r\n for (var i = 0; i < 20 && Math.abs(targetInertia) > 0.001; i++) {\r\n estimatedTargetRadius -= targetInertia;\r\n targetInertia *= _this.camera.inertia;\r\n }\r\n estimatedTargetRadius = Scalar.Clamp(estimatedTargetRadius, 0, Number.MAX_VALUE);\r\n delta = _this.computeDeltaFromMouseWheelLegacyEvent(wheelDelta, estimatedTargetRadius);\r\n }\r\n }\r\n else {\r\n delta = wheelDelta / (_this.wheelPrecision * 40);\r\n }\r\n if (delta) {\r\n _this.camera.inertialRadiusOffset += delta;\r\n }\r\n if (event.preventDefault) {\r\n if (!noPreventDefault) {\r\n event.preventDefault();\r\n }\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, PointerEventTypes.POINTERWHEEL);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.detachControl = function (ignored) {\r\n if (this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n this._wheel = null;\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraMouseWheelInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.getSimpleName = function () {\r\n return \"mousewheel\";\r\n };\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraMouseWheelInput.prototype, \"wheelPrecision\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraMouseWheelInput.prototype, \"wheelDeltaPercentage\", void 0);\r\n return ArcRotateCameraMouseWheelInput;\r\n}());\r\nexport { ArcRotateCameraMouseWheelInput };\r\nCameraInputTypes[\"ArcRotateCameraMouseWheelInput\"] = ArcRotateCameraMouseWheelInput;\r\n//# sourceMappingURL=arcRotateCameraMouseWheelInput.js.map","import { __extends } from \"tslib\";\r\nimport { ArcRotateCameraPointersInput } from \"../Cameras/Inputs/arcRotateCameraPointersInput\";\r\nimport { ArcRotateCameraKeyboardMoveInput } from \"../Cameras/Inputs/arcRotateCameraKeyboardMoveInput\";\r\nimport { ArcRotateCameraMouseWheelInput } from \"../Cameras/Inputs/arcRotateCameraMouseWheelInput\";\r\nimport { CameraInputsManager } from \"../Cameras/cameraInputsManager\";\r\n/**\r\n * Default Inputs manager for the ArcRotateCamera.\r\n * It groups all the default supported inputs for ease of use.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraInputsManager = /** @class */ (function (_super) {\r\n __extends(ArcRotateCameraInputsManager, _super);\r\n /**\r\n * Instantiates a new ArcRotateCameraInputsManager.\r\n * @param camera Defines the camera the inputs belong to\r\n */\r\n function ArcRotateCameraInputsManager(camera) {\r\n return _super.call(this, camera) || this;\r\n }\r\n /**\r\n * Add mouse wheel input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n ArcRotateCameraInputsManager.prototype.addMouseWheel = function () {\r\n this.add(new ArcRotateCameraMouseWheelInput());\r\n return this;\r\n };\r\n /**\r\n * Add pointers input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n ArcRotateCameraInputsManager.prototype.addPointers = function () {\r\n this.add(new ArcRotateCameraPointersInput());\r\n return this;\r\n };\r\n /**\r\n * Add keyboard input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n ArcRotateCameraInputsManager.prototype.addKeyboard = function () {\r\n this.add(new ArcRotateCameraKeyboardMoveInput());\r\n return this;\r\n };\r\n return ArcRotateCameraInputsManager;\r\n}(CameraInputsManager));\r\nexport { ArcRotateCameraInputsManager };\r\n//# sourceMappingURL=arcRotateCameraInputsManager.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, serializeAsVector3 } from \"../Misc/decorators\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Matrix, Vector3, Vector2 } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { AutoRotationBehavior } from \"../Behaviors/Cameras/autoRotationBehavior\";\r\nimport { BouncingBehavior } from \"../Behaviors/Cameras/bouncingBehavior\";\r\nimport { FramingBehavior } from \"../Behaviors/Cameras/framingBehavior\";\r\nimport { Camera } from \"./camera\";\r\nimport { TargetCamera } from \"./targetCamera\";\r\nimport { ArcRotateCameraInputsManager } from \"../Cameras/arcRotateCameraInputsManager\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport { Tools } from \"../Misc/tools\";\r\nNode.AddNodeConstructor(\"ArcRotateCamera\", function (name, scene) {\r\n return function () { return new ArcRotateCamera(name, 0, 0, 1.0, Vector3.Zero(), scene); };\r\n});\r\n/**\r\n * This represents an orbital type of camera.\r\n *\r\n * This camera always points towards a given target position and can be rotated around that target with the target as the centre of rotation. It can be controlled with cursors and mouse, or with touch events.\r\n * Think of this camera as one orbiting its target position, or more imaginatively as a spy satellite orbiting the earth. Its position relative to the target (earth) can be set by three parameters, alpha (radians) the longitudinal rotation, beta (radians) the latitudinal rotation and radius the distance from the target position.\r\n * @see https://doc.babylonjs.com/babylon101/cameras#arc-rotate-camera\r\n */\r\nvar ArcRotateCamera = /** @class */ (function (_super) {\r\n __extends(ArcRotateCamera, _super);\r\n /**\r\n * Instantiates a new ArcRotateCamera in a given scene\r\n * @param name Defines the name of the camera\r\n * @param alpha Defines the camera rotation along the logitudinal axis\r\n * @param beta Defines the camera rotation along the latitudinal axis\r\n * @param radius Defines the camera distance from its target\r\n * @param target Defines the camera target\r\n * @param scene Defines the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active if not other active cameras have been defined\r\n */\r\n function ArcRotateCamera(name, alpha, beta, radius, target, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, Vector3.Zero(), scene, setActiveOnSceneIfNoneActive) || this;\r\n /**\r\n * Current inertia value on the longitudinal axis.\r\n * The bigger this number the longer it will take for the camera to stop.\r\n */\r\n _this.inertialAlphaOffset = 0;\r\n /**\r\n * Current inertia value on the latitudinal axis.\r\n * The bigger this number the longer it will take for the camera to stop.\r\n */\r\n _this.inertialBetaOffset = 0;\r\n /**\r\n * Current inertia value on the radius axis.\r\n * The bigger this number the longer it will take for the camera to stop.\r\n */\r\n _this.inertialRadiusOffset = 0;\r\n /**\r\n * Minimum allowed angle on the longitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerAlphaLimit = null;\r\n /**\r\n * Maximum allowed angle on the longitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperAlphaLimit = null;\r\n /**\r\n * Minimum allowed angle on the latitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerBetaLimit = 0.01;\r\n /**\r\n * Maximum allowed angle on the latitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperBetaLimit = Math.PI - 0.01;\r\n /**\r\n * Minimum allowed distance of the camera to the target (The camera can not get closer).\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerRadiusLimit = null;\r\n /**\r\n * Maximum allowed distance of the camera to the target (The camera can not get further).\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperRadiusLimit = null;\r\n /**\r\n * Defines the current inertia value used during panning of the camera along the X axis.\r\n */\r\n _this.inertialPanningX = 0;\r\n /**\r\n * Defines the current inertia value used during panning of the camera along the Y axis.\r\n */\r\n _this.inertialPanningY = 0;\r\n /**\r\n * Defines the distance used to consider the camera in pan mode vs pinch/zoom.\r\n * Basically if your fingers moves away from more than this distance you will be considered\r\n * in pinch mode.\r\n */\r\n _this.pinchToPanMaxDistance = 20;\r\n /**\r\n * Defines the maximum distance the camera can pan.\r\n * This could help keeping the cammera always in your scene.\r\n */\r\n _this.panningDistanceLimit = null;\r\n /**\r\n * Defines the target of the camera before paning.\r\n */\r\n _this.panningOriginTarget = Vector3.Zero();\r\n /**\r\n * Defines the value of the inertia used during panning.\r\n * 0 would mean stop inertia and one would mean no decelleration at all.\r\n */\r\n _this.panningInertia = 0.9;\r\n //-- end properties for backward compatibility for inputs\r\n /**\r\n * Defines how much the radius should be scaled while zomming on a particular mesh (through the zoomOn function)\r\n */\r\n _this.zoomOnFactor = 1;\r\n /**\r\n * Defines a screen offset for the camera position.\r\n */\r\n _this.targetScreenOffset = Vector2.Zero();\r\n /**\r\n * Allows the camera to be completely reversed.\r\n * If false the camera can not arrive upside down.\r\n */\r\n _this.allowUpsideDown = true;\r\n /**\r\n * Define if double tap/click is used to restore the previously saved state of the camera.\r\n */\r\n _this.useInputToRestoreState = true;\r\n /** @hidden */\r\n _this._viewMatrix = new Matrix();\r\n /**\r\n * Defines the allowed panning axis.\r\n */\r\n _this.panningAxis = new Vector3(1, 1, 0);\r\n /**\r\n * Observable triggered when the mesh target has been changed on the camera.\r\n */\r\n _this.onMeshTargetChangedObservable = new Observable();\r\n /**\r\n * Defines whether the camera should check collision with the objects oh the scene.\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#how-can-i-do-this\r\n */\r\n _this.checkCollisions = false;\r\n /**\r\n * Defines the collision radius of the camera.\r\n * This simulates a sphere around the camera.\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#arcrotatecamera\r\n */\r\n _this.collisionRadius = new Vector3(0.5, 0.5, 0.5);\r\n _this._previousPosition = Vector3.Zero();\r\n _this._collisionVelocity = Vector3.Zero();\r\n _this._newPosition = Vector3.Zero();\r\n _this._computationVector = Vector3.Zero();\r\n _this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {\r\n if (collidedMesh === void 0) { collidedMesh = null; }\r\n if (!collidedMesh) {\r\n _this._previousPosition.copyFrom(_this._position);\r\n }\r\n else {\r\n _this.setPosition(newPosition);\r\n if (_this.onCollide) {\r\n _this.onCollide(collidedMesh);\r\n }\r\n }\r\n // Recompute because of constraints\r\n var cosa = Math.cos(_this.alpha);\r\n var sina = Math.sin(_this.alpha);\r\n var cosb = Math.cos(_this.beta);\r\n var sinb = Math.sin(_this.beta);\r\n if (sinb === 0) {\r\n sinb = 0.0001;\r\n }\r\n var target = _this._getTargetPosition();\r\n _this._computationVector.copyFromFloats(_this.radius * cosa * sinb, _this.radius * cosb, _this.radius * sina * sinb);\r\n target.addToRef(_this._computationVector, _this._newPosition);\r\n _this._position.copyFrom(_this._newPosition);\r\n var up = _this.upVector;\r\n if (_this.allowUpsideDown && _this.beta < 0) {\r\n up = up.clone();\r\n up = up.negate();\r\n }\r\n _this._computeViewMatrix(_this._position, target, up);\r\n _this._viewMatrix.addAtIndex(12, _this.targetScreenOffset.x);\r\n _this._viewMatrix.addAtIndex(13, _this.targetScreenOffset.y);\r\n _this._collisionTriggered = false;\r\n };\r\n _this._target = Vector3.Zero();\r\n if (target) {\r\n _this.setTarget(target);\r\n }\r\n _this.alpha = alpha;\r\n _this.beta = beta;\r\n _this.radius = radius;\r\n _this.getViewMatrix();\r\n _this.inputs = new ArcRotateCameraInputsManager(_this);\r\n _this.inputs.addKeyboard().addMouseWheel().addPointers();\r\n return _this;\r\n }\r\n Object.defineProperty(ArcRotateCamera.prototype, \"target\", {\r\n /**\r\n * Defines the target point of the camera.\r\n * The camera looks towards it form the radius distance.\r\n * Please note that you can set the target to a mesh and thus the target will be copied from mesh.position\r\n */\r\n get: function () {\r\n return this._target;\r\n },\r\n set: function (value) {\r\n this.setTarget(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"position\", {\r\n /**\r\n * Define the current local position of the camera in the scene\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n set: function (newPosition) {\r\n this.setPosition(newPosition);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"upVector\", {\r\n get: function () {\r\n return this._upVector;\r\n },\r\n /**\r\n * The vector the camera should consider as up. (default is Vector3(0, 1, 0) as returned by Vector3.Up())\r\n * Setting this will copy the given vector to the camera's upVector, and set rotation matrices to and from Y up.\r\n * DO NOT set the up vector using copyFrom or copyFromFloats, as this bypasses setting the above matrices.\r\n */\r\n set: function (vec) {\r\n if (!this._upToYMatrix) {\r\n this._YToUpMatrix = new Matrix();\r\n this._upToYMatrix = new Matrix();\r\n this._upVector = Vector3.Zero();\r\n }\r\n vec.normalize();\r\n this._upVector.copyFrom(vec);\r\n this.setMatUp();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the Y-up to camera up-vector rotation matrix, and the up-vector to Y-up rotation matrix.\r\n */\r\n ArcRotateCamera.prototype.setMatUp = function () {\r\n // from y-up to custom-up (used in _getViewMatrix)\r\n Matrix.RotationAlignToRef(Vector3.UpReadOnly, this._upVector, this._YToUpMatrix);\r\n // from custom-up to y-up (used in rebuildAnglesAndRadius)\r\n Matrix.RotationAlignToRef(this._upVector, Vector3.UpReadOnly, this._upToYMatrix);\r\n };\r\n Object.defineProperty(ArcRotateCamera.prototype, \"angularSensibilityX\", {\r\n //-- begin properties for backward compatibility for inputs\r\n /**\r\n * Gets or Set the pointer angular sensibility along the X axis or how fast is the camera rotating.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.angularSensibilityX;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.angularSensibilityX = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"angularSensibilityY\", {\r\n /**\r\n * Gets or Set the pointer angular sensibility along the Y axis or how fast is the camera rotating.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.angularSensibilityY;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.angularSensibilityY = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"pinchPrecision\", {\r\n /**\r\n * Gets or Set the pointer pinch precision or how fast is the camera zooming.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.pinchPrecision;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.pinchPrecision = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"pinchDeltaPercentage\", {\r\n /**\r\n * Gets or Set the pointer pinch delta percentage or how fast is the camera zooming.\r\n * It will be used instead of pinchDeltaPrecision if different from 0.\r\n * It defines the percentage of current camera.radius to use as delta when pinch zoom is used.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.pinchDeltaPercentage;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.pinchDeltaPercentage = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"useNaturalPinchZoom\", {\r\n /**\r\n * Gets or Set the pointer use natural pinch zoom to override the pinch precision\r\n * and pinch delta percentage.\r\n * When useNaturalPinchZoom is true, multi touch zoom will zoom in such\r\n * that any object in the plane at the camera's target point will scale\r\n * perfectly with finger motion.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.useNaturalPinchZoom;\r\n }\r\n return false;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.useNaturalPinchZoom = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"panningSensibility\", {\r\n /**\r\n * Gets or Set the pointer panning sensibility or how fast is the camera moving.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.panningSensibility;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.panningSensibility = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysUp\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control beta angle in a positive direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUp;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUp = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysDown\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control beta angle in a negative direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDown;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDown = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysLeft\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control alpha angle in a negative direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysLeft;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysLeft = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysRight\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control alpha angle in a positive direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRight;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRight = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"wheelPrecision\", {\r\n /**\r\n * Gets or Set the mouse wheel precision or how fast is the camera zooming.\r\n */\r\n get: function () {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n return mousewheel.wheelPrecision;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n mousewheel.wheelPrecision = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"wheelDeltaPercentage\", {\r\n /**\r\n * Gets or Set the mouse wheel delta percentage or how fast is the camera zooming.\r\n * It will be used instead of pinchDeltaPrecision if different from 0.\r\n * It defines the percentage of current camera.radius to use as delta when pinch zoom is used.\r\n */\r\n get: function () {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n return mousewheel.wheelDeltaPercentage;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n mousewheel.wheelDeltaPercentage = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"bouncingBehavior\", {\r\n /**\r\n * Gets the bouncing behavior of the camera if it has been enabled.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior\r\n */\r\n get: function () {\r\n return this._bouncingBehavior;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"useBouncingBehavior\", {\r\n /**\r\n * Defines if the bouncing behavior of the camera is enabled on the camera.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior\r\n */\r\n get: function () {\r\n return this._bouncingBehavior != null;\r\n },\r\n set: function (value) {\r\n if (value === this.useBouncingBehavior) {\r\n return;\r\n }\r\n if (value) {\r\n this._bouncingBehavior = new BouncingBehavior();\r\n this.addBehavior(this._bouncingBehavior);\r\n }\r\n else if (this._bouncingBehavior) {\r\n this.removeBehavior(this._bouncingBehavior);\r\n this._bouncingBehavior = null;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"framingBehavior\", {\r\n /**\r\n * Gets the framing behavior of the camera if it has been enabled.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior\r\n */\r\n get: function () {\r\n return this._framingBehavior;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"useFramingBehavior\", {\r\n /**\r\n * Defines if the framing behavior of the camera is enabled on the camera.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior\r\n */\r\n get: function () {\r\n return this._framingBehavior != null;\r\n },\r\n set: function (value) {\r\n if (value === this.useFramingBehavior) {\r\n return;\r\n }\r\n if (value) {\r\n this._framingBehavior = new FramingBehavior();\r\n this.addBehavior(this._framingBehavior);\r\n }\r\n else if (this._framingBehavior) {\r\n this.removeBehavior(this._framingBehavior);\r\n this._framingBehavior = null;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"autoRotationBehavior\", {\r\n /**\r\n * Gets the auto rotation behavior of the camera if it has been enabled.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior\r\n */\r\n get: function () {\r\n return this._autoRotationBehavior;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"useAutoRotationBehavior\", {\r\n /**\r\n * Defines if the auto rotation behavior of the camera is enabled on the camera.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior\r\n */\r\n get: function () {\r\n return this._autoRotationBehavior != null;\r\n },\r\n set: function (value) {\r\n if (value === this.useAutoRotationBehavior) {\r\n return;\r\n }\r\n if (value) {\r\n this._autoRotationBehavior = new AutoRotationBehavior();\r\n this.addBehavior(this._autoRotationBehavior);\r\n }\r\n else if (this._autoRotationBehavior) {\r\n this.removeBehavior(this._autoRotationBehavior);\r\n this._autoRotationBehavior = null;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Cache\r\n /** @hidden */\r\n ArcRotateCamera.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache._target = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.alpha = undefined;\r\n this._cache.beta = undefined;\r\n this._cache.radius = undefined;\r\n this._cache.targetScreenOffset = Vector2.Zero();\r\n };\r\n /** @hidden */\r\n ArcRotateCamera.prototype._updateCache = function (ignoreParentClass) {\r\n if (!ignoreParentClass) {\r\n _super.prototype._updateCache.call(this);\r\n }\r\n this._cache._target.copyFrom(this._getTargetPosition());\r\n this._cache.alpha = this.alpha;\r\n this._cache.beta = this.beta;\r\n this._cache.radius = this.radius;\r\n this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset);\r\n };\r\n ArcRotateCamera.prototype._getTargetPosition = function () {\r\n if (this._targetHost && this._targetHost.getAbsolutePosition) {\r\n var pos = this._targetHost.absolutePosition;\r\n if (this._targetBoundingCenter) {\r\n pos.addToRef(this._targetBoundingCenter, this._target);\r\n }\r\n else {\r\n this._target.copyFrom(pos);\r\n }\r\n }\r\n var lockedTargetPosition = this._getLockedTargetPosition();\r\n if (lockedTargetPosition) {\r\n return lockedTargetPosition;\r\n }\r\n return this._target;\r\n };\r\n /**\r\n * Stores the current state of the camera (alpha, beta, radius and target)\r\n * @returns the camera itself\r\n */\r\n ArcRotateCamera.prototype.storeState = function () {\r\n this._storedAlpha = this.alpha;\r\n this._storedBeta = this.beta;\r\n this._storedRadius = this.radius;\r\n this._storedTarget = this._getTargetPosition().clone();\r\n this._storedTargetScreenOffset = this.targetScreenOffset.clone();\r\n return _super.prototype.storeState.call(this);\r\n };\r\n /**\r\n * @hidden\r\n * Restored camera state. You must call storeState() first\r\n */\r\n ArcRotateCamera.prototype._restoreStateValues = function () {\r\n if (!_super.prototype._restoreStateValues.call(this)) {\r\n return false;\r\n }\r\n this.setTarget(this._storedTarget.clone());\r\n this.alpha = this._storedAlpha;\r\n this.beta = this._storedBeta;\r\n this.radius = this._storedRadius;\r\n this.targetScreenOffset = this._storedTargetScreenOffset.clone();\r\n this.inertialAlphaOffset = 0;\r\n this.inertialBetaOffset = 0;\r\n this.inertialRadiusOffset = 0;\r\n this.inertialPanningX = 0;\r\n this.inertialPanningY = 0;\r\n return true;\r\n };\r\n // Synchronized\r\n /** @hidden */\r\n ArcRotateCamera.prototype._isSynchronizedViewMatrix = function () {\r\n if (!_super.prototype._isSynchronizedViewMatrix.call(this)) {\r\n return false;\r\n }\r\n return this._cache._target.equals(this._getTargetPosition()) && this._cache.alpha === this.alpha && this._cache.beta === this.beta && this._cache.radius === this.radius && this._cache.targetScreenOffset.equals(this.targetScreenOffset);\r\n };\r\n /**\r\n * Attached controls to the current camera.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n * @param useCtrlForPanning Defines whether ctrl is used for paning within the controls\r\n * @param panningMouseButton Defines whether panning is allowed through mouse click button\r\n */\r\n ArcRotateCamera.prototype.attachControl = function (ignored, noPreventDefault, useCtrlForPanning, panningMouseButton) {\r\n var _this = this;\r\n if (useCtrlForPanning === void 0) { useCtrlForPanning = true; }\r\n if (panningMouseButton === void 0) { panningMouseButton = 2; }\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n this._useCtrlForPanning = useCtrlForPanning;\r\n this._panningMouseButton = panningMouseButton;\r\n // backwards compatibility\r\n if (typeof arguments[0] === \"boolean\") {\r\n if (arguments.length > 1) {\r\n this._useCtrlForPanning = arguments[1];\r\n }\r\n if (arguments.length > 2) {\r\n this._panningMouseButton = arguments[2];\r\n }\r\n }\r\n this.inputs.attachElement(noPreventDefault);\r\n this._reset = function () {\r\n _this.inertialAlphaOffset = 0;\r\n _this.inertialBetaOffset = 0;\r\n _this.inertialRadiusOffset = 0;\r\n _this.inertialPanningX = 0;\r\n _this.inertialPanningY = 0;\r\n };\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n ArcRotateCamera.prototype.detachControl = function (ignored) {\r\n this.inputs.detachElement();\r\n if (this._reset) {\r\n this._reset();\r\n }\r\n };\r\n /** @hidden */\r\n ArcRotateCamera.prototype._checkInputs = function () {\r\n //if (async) collision inspection was triggered, don't update the camera's position - until the collision callback was called.\r\n if (this._collisionTriggered) {\r\n return;\r\n }\r\n this.inputs.checkInputs();\r\n // Inertia\r\n if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset !== 0) {\r\n var inertialAlphaOffset = this.inertialAlphaOffset;\r\n if (this.beta <= 0) {\r\n inertialAlphaOffset *= -1;\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n inertialAlphaOffset *= -1;\r\n }\r\n if (this.parent && this.parent._getWorldMatrixDeterminant() < 0) {\r\n inertialAlphaOffset *= -1;\r\n }\r\n this.alpha += inertialAlphaOffset;\r\n this.beta += this.inertialBetaOffset;\r\n this.radius -= this.inertialRadiusOffset;\r\n this.inertialAlphaOffset *= this.inertia;\r\n this.inertialBetaOffset *= this.inertia;\r\n this.inertialRadiusOffset *= this.inertia;\r\n if (Math.abs(this.inertialAlphaOffset) < Epsilon) {\r\n this.inertialAlphaOffset = 0;\r\n }\r\n if (Math.abs(this.inertialBetaOffset) < Epsilon) {\r\n this.inertialBetaOffset = 0;\r\n }\r\n if (Math.abs(this.inertialRadiusOffset) < this.speed * Epsilon) {\r\n this.inertialRadiusOffset = 0;\r\n }\r\n }\r\n // Panning inertia\r\n if (this.inertialPanningX !== 0 || this.inertialPanningY !== 0) {\r\n if (!this._localDirection) {\r\n this._localDirection = Vector3.Zero();\r\n this._transformedDirection = Vector3.Zero();\r\n }\r\n this._localDirection.copyFromFloats(this.inertialPanningX, this.inertialPanningY, this.inertialPanningY);\r\n this._localDirection.multiplyInPlace(this.panningAxis);\r\n this._viewMatrix.invertToRef(this._cameraTransformMatrix);\r\n Vector3.TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection);\r\n //Eliminate y if map panning is enabled (panningAxis == 1,0,1)\r\n if (!this.panningAxis.y) {\r\n this._transformedDirection.y = 0;\r\n }\r\n if (!this._targetHost) {\r\n if (this.panningDistanceLimit) {\r\n this._transformedDirection.addInPlace(this._target);\r\n var distanceSquared = Vector3.DistanceSquared(this._transformedDirection, this.panningOriginTarget);\r\n if (distanceSquared <= this.panningDistanceLimit * this.panningDistanceLimit) {\r\n this._target.copyFrom(this._transformedDirection);\r\n }\r\n }\r\n else {\r\n this._target.addInPlace(this._transformedDirection);\r\n }\r\n }\r\n this.inertialPanningX *= this.panningInertia;\r\n this.inertialPanningY *= this.panningInertia;\r\n if (Math.abs(this.inertialPanningX) < this.speed * Epsilon) {\r\n this.inertialPanningX = 0;\r\n }\r\n if (Math.abs(this.inertialPanningY) < this.speed * Epsilon) {\r\n this.inertialPanningY = 0;\r\n }\r\n }\r\n // Limits\r\n this._checkLimits();\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n ArcRotateCamera.prototype._checkLimits = function () {\r\n if (this.lowerBetaLimit === null || this.lowerBetaLimit === undefined) {\r\n if (this.allowUpsideDown && this.beta > Math.PI) {\r\n this.beta = this.beta - 2 * Math.PI;\r\n }\r\n }\r\n else {\r\n if (this.beta < this.lowerBetaLimit) {\r\n this.beta = this.lowerBetaLimit;\r\n }\r\n }\r\n if (this.upperBetaLimit === null || this.upperBetaLimit === undefined) {\r\n if (this.allowUpsideDown && this.beta < -Math.PI) {\r\n this.beta = this.beta + 2 * Math.PI;\r\n }\r\n }\r\n else {\r\n if (this.beta > this.upperBetaLimit) {\r\n this.beta = this.upperBetaLimit;\r\n }\r\n }\r\n if (this.lowerAlphaLimit !== null && this.alpha < this.lowerAlphaLimit) {\r\n this.alpha = this.lowerAlphaLimit;\r\n }\r\n if (this.upperAlphaLimit !== null && this.alpha > this.upperAlphaLimit) {\r\n this.alpha = this.upperAlphaLimit;\r\n }\r\n if (this.lowerRadiusLimit !== null && this.radius < this.lowerRadiusLimit) {\r\n this.radius = this.lowerRadiusLimit;\r\n this.inertialRadiusOffset = 0;\r\n }\r\n if (this.upperRadiusLimit !== null && this.radius > this.upperRadiusLimit) {\r\n this.radius = this.upperRadiusLimit;\r\n this.inertialRadiusOffset = 0;\r\n }\r\n };\r\n /**\r\n * Rebuilds angles (alpha, beta) and radius from the give position and target\r\n */\r\n ArcRotateCamera.prototype.rebuildAnglesAndRadius = function () {\r\n this._position.subtractToRef(this._getTargetPosition(), this._computationVector);\r\n // need to rotate to Y up equivalent if up vector not Axis.Y\r\n if (this._upVector.x !== 0 || this._upVector.y !== 1.0 || this._upVector.z !== 0) {\r\n Vector3.TransformCoordinatesToRef(this._computationVector, this._upToYMatrix, this._computationVector);\r\n }\r\n this.radius = this._computationVector.length();\r\n if (this.radius === 0) {\r\n this.radius = 0.0001; // Just to avoid division by zero\r\n }\r\n // Alpha\r\n var previousAlpha = this.alpha;\r\n if (this._computationVector.x === 0 && this._computationVector.z === 0) {\r\n this.alpha = Math.PI / 2; // avoid division by zero when looking along up axis, and set to acos(0)\r\n }\r\n else {\r\n this.alpha = Math.acos(this._computationVector.x / Math.sqrt(Math.pow(this._computationVector.x, 2) + Math.pow(this._computationVector.z, 2)));\r\n }\r\n if (this._computationVector.z < 0) {\r\n this.alpha = 2 * Math.PI - this.alpha;\r\n }\r\n // Calculate the number of revolutions between the new and old alpha values.\r\n var alphaCorrectionTurns = Math.round((previousAlpha - this.alpha) / (2.0 * Math.PI));\r\n // Adjust alpha so that its numerical representation is the closest one to the old value.\r\n this.alpha += alphaCorrectionTurns * 2.0 * Math.PI;\r\n // Beta\r\n this.beta = Math.acos(this._computationVector.y / this.radius);\r\n this._checkLimits();\r\n };\r\n /**\r\n * Use a position to define the current camera related information like alpha, beta and radius\r\n * @param position Defines the position to set the camera at\r\n */\r\n ArcRotateCamera.prototype.setPosition = function (position) {\r\n if (this._position.equals(position)) {\r\n return;\r\n }\r\n this._position.copyFrom(position);\r\n this.rebuildAnglesAndRadius();\r\n };\r\n /**\r\n * Defines the target the camera should look at.\r\n * This will automatically adapt alpha beta and radius to fit within the new target.\r\n * @param target Defines the new target as a Vector or a mesh\r\n * @param toBoundingCenter In case of a mesh target, defines whether to target the mesh position or its bounding information center\r\n * @param allowSamePosition If false, prevents reapplying the new computed position if it is identical to the current one (optim)\r\n */\r\n ArcRotateCamera.prototype.setTarget = function (target, toBoundingCenter, allowSamePosition) {\r\n if (toBoundingCenter === void 0) { toBoundingCenter = false; }\r\n if (allowSamePosition === void 0) { allowSamePosition = false; }\r\n if (target.getBoundingInfo) {\r\n if (toBoundingCenter) {\r\n this._targetBoundingCenter = target.getBoundingInfo().boundingBox.centerWorld.clone();\r\n }\r\n else {\r\n this._targetBoundingCenter = null;\r\n }\r\n target.computeWorldMatrix();\r\n this._targetHost = target;\r\n this._target = this._getTargetPosition();\r\n this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);\r\n }\r\n else {\r\n var newTarget = target;\r\n var currentTarget = this._getTargetPosition();\r\n if (currentTarget && !allowSamePosition && currentTarget.equals(newTarget)) {\r\n return;\r\n }\r\n this._targetHost = null;\r\n this._target = newTarget;\r\n this._targetBoundingCenter = null;\r\n this.onMeshTargetChangedObservable.notifyObservers(null);\r\n }\r\n this.rebuildAnglesAndRadius();\r\n };\r\n /** @hidden */\r\n ArcRotateCamera.prototype._getViewMatrix = function () {\r\n // Compute\r\n var cosa = Math.cos(this.alpha);\r\n var sina = Math.sin(this.alpha);\r\n var cosb = Math.cos(this.beta);\r\n var sinb = Math.sin(this.beta);\r\n if (sinb === 0) {\r\n sinb = 0.0001;\r\n }\r\n if (this.radius === 0) {\r\n this.radius = 0.0001; // Just to avoid division by zero\r\n }\r\n var target = this._getTargetPosition();\r\n this._computationVector.copyFromFloats(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb);\r\n // Rotate according to up vector\r\n if (this._upVector.x !== 0 || this._upVector.y !== 1.0 || this._upVector.z !== 0) {\r\n Vector3.TransformCoordinatesToRef(this._computationVector, this._YToUpMatrix, this._computationVector);\r\n }\r\n target.addToRef(this._computationVector, this._newPosition);\r\n if (this.getScene().collisionsEnabled && this.checkCollisions) {\r\n var coordinator = this.getScene().collisionCoordinator;\r\n if (!this._collider) {\r\n this._collider = coordinator.createCollider();\r\n }\r\n this._collider._radius = this.collisionRadius;\r\n this._newPosition.subtractToRef(this._position, this._collisionVelocity);\r\n this._collisionTriggered = true;\r\n coordinator.getNewPosition(this._position, this._collisionVelocity, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);\r\n }\r\n else {\r\n this._position.copyFrom(this._newPosition);\r\n var up = this.upVector;\r\n if (this.allowUpsideDown && sinb < 0) {\r\n up = up.negate();\r\n }\r\n this._computeViewMatrix(this._position, target, up);\r\n this._viewMatrix.addAtIndex(12, this.targetScreenOffset.x);\r\n this._viewMatrix.addAtIndex(13, this.targetScreenOffset.y);\r\n }\r\n this._currentTarget = target;\r\n return this._viewMatrix;\r\n };\r\n /**\r\n * Zooms on a mesh to be at the min distance where we could see it fully in the current viewport.\r\n * @param meshes Defines the mesh to zoom on\r\n * @param doNotUpdateMaxZ Defines whether or not maxZ should be updated whilst zooming on the mesh (this can happen if the mesh is big and the maxradius pretty small for instance)\r\n */\r\n ArcRotateCamera.prototype.zoomOn = function (meshes, doNotUpdateMaxZ) {\r\n if (doNotUpdateMaxZ === void 0) { doNotUpdateMaxZ = false; }\r\n meshes = meshes || this.getScene().meshes;\r\n var minMaxVector = Mesh.MinMax(meshes);\r\n var distance = Vector3.Distance(minMaxVector.min, minMaxVector.max);\r\n this.radius = distance * this.zoomOnFactor;\r\n this.focusOn({ min: minMaxVector.min, max: minMaxVector.max, distance: distance }, doNotUpdateMaxZ);\r\n };\r\n /**\r\n * Focus on a mesh or a bounding box. This adapts the target and maxRadius if necessary but does not update the current radius.\r\n * The target will be changed but the radius\r\n * @param meshesOrMinMaxVectorAndDistance Defines the mesh or bounding info to focus on\r\n * @param doNotUpdateMaxZ Defines whether or not maxZ should be updated whilst zooming on the mesh (this can happen if the mesh is big and the maxradius pretty small for instance)\r\n */\r\n ArcRotateCamera.prototype.focusOn = function (meshesOrMinMaxVectorAndDistance, doNotUpdateMaxZ) {\r\n if (doNotUpdateMaxZ === void 0) { doNotUpdateMaxZ = false; }\r\n var meshesOrMinMaxVector;\r\n var distance;\r\n if (meshesOrMinMaxVectorAndDistance.min === undefined) {\r\n // meshes\r\n var meshes = meshesOrMinMaxVectorAndDistance || this.getScene().meshes;\r\n meshesOrMinMaxVector = Mesh.MinMax(meshes);\r\n distance = Vector3.Distance(meshesOrMinMaxVector.min, meshesOrMinMaxVector.max);\r\n }\r\n else {\r\n //minMaxVector and distance\r\n var minMaxVectorAndDistance = meshesOrMinMaxVectorAndDistance;\r\n meshesOrMinMaxVector = minMaxVectorAndDistance;\r\n distance = minMaxVectorAndDistance.distance;\r\n }\r\n this._target = Mesh.Center(meshesOrMinMaxVector);\r\n if (!doNotUpdateMaxZ) {\r\n this.maxZ = distance * 2;\r\n }\r\n };\r\n /**\r\n * @override\r\n * Override Camera.createRigCamera\r\n */\r\n ArcRotateCamera.prototype.createRigCamera = function (name, cameraIndex) {\r\n var alphaShift = 0;\r\n switch (this.cameraRigMode) {\r\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED:\r\n case Camera.RIG_MODE_VR:\r\n alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? 1 : -1);\r\n break;\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? -1 : 1);\r\n break;\r\n }\r\n var rigCam = new ArcRotateCamera(name, this.alpha + alphaShift, this.beta, this.radius, this._target, this.getScene());\r\n rigCam._cameraRigParams = {};\r\n rigCam.isRigCamera = true;\r\n rigCam.rigParent = this;\r\n rigCam.upVector = this.upVector;\r\n return rigCam;\r\n };\r\n /**\r\n * @hidden\r\n * @override\r\n * Override Camera._updateRigCameras\r\n */\r\n ArcRotateCamera.prototype._updateRigCameras = function () {\r\n var camLeft = this._rigCameras[0];\r\n var camRight = this._rigCameras[1];\r\n camLeft.beta = camRight.beta = this.beta;\r\n switch (this.cameraRigMode) {\r\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED:\r\n case Camera.RIG_MODE_VR:\r\n camLeft.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;\r\n camRight.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;\r\n break;\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n camLeft.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;\r\n camRight.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;\r\n break;\r\n }\r\n _super.prototype._updateRigCameras.call(this);\r\n };\r\n /**\r\n * Destroy the camera and release the current resources hold by it.\r\n */\r\n ArcRotateCamera.prototype.dispose = function () {\r\n this.inputs.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n ArcRotateCamera.prototype.getClassName = function () {\r\n return \"ArcRotateCamera\";\r\n };\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"alpha\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"beta\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"radius\", void 0);\r\n __decorate([\r\n serializeAsVector3(\"target\")\r\n ], ArcRotateCamera.prototype, \"_target\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"inertialAlphaOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"inertialBetaOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"inertialRadiusOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"lowerAlphaLimit\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"upperAlphaLimit\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"lowerBetaLimit\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"upperBetaLimit\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"lowerRadiusLimit\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"upperRadiusLimit\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"inertialPanningX\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"inertialPanningY\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"pinchToPanMaxDistance\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"panningDistanceLimit\", void 0);\r\n __decorate([\r\n serializeAsVector3()\r\n ], ArcRotateCamera.prototype, \"panningOriginTarget\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"panningInertia\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"zoomOnFactor\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"targetScreenOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"allowUpsideDown\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"useInputToRestoreState\", void 0);\r\n return ArcRotateCamera;\r\n}(TargetCamera));\r\nexport { ArcRotateCamera };\r\n//# sourceMappingURL=arcRotateCamera.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, SerializationHelper, serializeAsVector3 } from \"../Misc/decorators\";\r\nimport { SmartArray } from \"../Misc/smartArray\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Matrix, Vector3, Quaternion } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { _TypeStore } from '../Misc/typeStore';\r\nimport { _DevTools } from '../Misc/devTools';\r\nimport { Viewport } from '../Maths/math.viewport';\r\nimport { Frustum } from '../Maths/math.frustum';\r\n/**\r\n * This is the base class of all the camera used in the application.\r\n * @see https://doc.babylonjs.com/features/cameras\r\n */\r\nvar Camera = /** @class */ (function (_super) {\r\n __extends(Camera, _super);\r\n /**\r\n * Instantiates a new camera object.\r\n * This should not be used directly but through the inherited cameras: ArcRotate, Free...\r\n * @see https://doc.babylonjs.com/features/cameras\r\n * @param name Defines the name of the camera in the scene\r\n * @param position Defines the position of the camera\r\n * @param scene Defines the scene the camera belongs too\r\n * @param setActiveOnSceneIfNoneActive Defines if the camera should be set as active after creation if no other camera have been defined in the scene\r\n */\r\n function Camera(name, position, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, scene) || this;\r\n /** @hidden */\r\n _this._position = Vector3.Zero();\r\n _this._upVector = Vector3.Up();\r\n /**\r\n * Define the current limit on the left side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoLeft = null;\r\n /**\r\n * Define the current limit on the right side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoRight = null;\r\n /**\r\n * Define the current limit on the bottom side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoBottom = null;\r\n /**\r\n * Define the current limit on the top side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoTop = null;\r\n /**\r\n * Field Of View is set in Radians. (default is 0.8)\r\n */\r\n _this.fov = 0.8;\r\n /**\r\n * Define the minimum distance the camera can see from.\r\n * This is important to note that the depth buffer are not infinite and the closer it starts\r\n * the more your scene might encounter depth fighting issue.\r\n */\r\n _this.minZ = 1;\r\n /**\r\n * Define the maximum distance the camera can see to.\r\n * This is important to note that the depth buffer are not infinite and the further it end\r\n * the more your scene might encounter depth fighting issue.\r\n */\r\n _this.maxZ = 10000.0;\r\n /**\r\n * Define the default inertia of the camera.\r\n * This helps giving a smooth feeling to the camera movement.\r\n */\r\n _this.inertia = 0.9;\r\n /**\r\n * Define the mode of the camera (Camera.PERSPECTIVE_CAMERA or Camera.ORTHOGRAPHIC_CAMERA)\r\n */\r\n _this.mode = Camera.PERSPECTIVE_CAMERA;\r\n /**\r\n * Define whether the camera is intermediate.\r\n * This is useful to not present the output directly to the screen in case of rig without post process for instance\r\n */\r\n _this.isIntermediate = false;\r\n /**\r\n * Define the viewport of the camera.\r\n * This correspond to the portion of the screen the camera will render to in normalized 0 to 1 unit.\r\n */\r\n _this.viewport = new Viewport(0, 0, 1.0, 1.0);\r\n /**\r\n * Restricts the camera to viewing objects with the same layerMask.\r\n * A camera with a layerMask of 1 will render mesh.layerMask & camera.layerMask!== 0\r\n */\r\n _this.layerMask = 0x0FFFFFFF;\r\n /**\r\n * fovMode sets the camera frustum bounds to the viewport bounds. (default is FOVMODE_VERTICAL_FIXED)\r\n */\r\n _this.fovMode = Camera.FOVMODE_VERTICAL_FIXED;\r\n /**\r\n * Rig mode of the camera.\r\n * This is useful to create the camera with two \"eyes\" instead of one to create VR or stereoscopic scenes.\r\n * This is normally controlled byt the camera themselves as internal use.\r\n */\r\n _this.cameraRigMode = Camera.RIG_MODE_NONE;\r\n /**\r\n * Defines the list of custom render target which are rendered to and then used as the input to this camera's render. Eg. display another camera view on a TV in the main scene\r\n * This is pretty helpfull if you wish to make a camera render to a texture you could reuse somewhere\r\n * else in the scene. (Eg. security camera)\r\n *\r\n * To change the final output target of the camera, camera.outputRenderTarget should be used instead (eg. webXR renders to a render target corrisponding to an HMD)\r\n */\r\n _this.customRenderTargets = new Array();\r\n /**\r\n * When set, the camera will render to this render target instead of the default canvas\r\n *\r\n * If the desire is to use the output of a camera as a texture in the scene consider using camera.customRenderTargets instead\r\n */\r\n _this.outputRenderTarget = null;\r\n /**\r\n * Observable triggered when the camera view matrix has changed.\r\n */\r\n _this.onViewMatrixChangedObservable = new Observable();\r\n /**\r\n * Observable triggered when the camera Projection matrix has changed.\r\n */\r\n _this.onProjectionMatrixChangedObservable = new Observable();\r\n /**\r\n * Observable triggered when the inputs have been processed.\r\n */\r\n _this.onAfterCheckInputsObservable = new Observable();\r\n /**\r\n * Observable triggered when reset has been called and applied to the camera.\r\n */\r\n _this.onRestoreStateObservable = new Observable();\r\n /**\r\n * Is this camera a part of a rig system?\r\n */\r\n _this.isRigCamera = false;\r\n /** @hidden */\r\n _this._rigCameras = new Array();\r\n _this._webvrViewMatrix = Matrix.Identity();\r\n /** @hidden */\r\n _this._skipRendering = false;\r\n /** @hidden */\r\n _this._projectionMatrix = new Matrix();\r\n /** @hidden */\r\n _this._postProcesses = new Array();\r\n /** @hidden */\r\n _this._activeMeshes = new SmartArray(256);\r\n _this._globalPosition = Vector3.Zero();\r\n /** @hidden */\r\n _this._computedViewMatrix = Matrix.Identity();\r\n _this._doNotComputeProjectionMatrix = false;\r\n _this._transformMatrix = Matrix.Zero();\r\n _this._refreshFrustumPlanes = true;\r\n /** @hidden */\r\n _this._isCamera = true;\r\n /** @hidden */\r\n _this._isLeftCamera = false;\r\n /** @hidden */\r\n _this._isRightCamera = false;\r\n _this.getScene().addCamera(_this);\r\n if (setActiveOnSceneIfNoneActive && !_this.getScene().activeCamera) {\r\n _this.getScene().activeCamera = _this;\r\n }\r\n _this.position = position;\r\n return _this;\r\n }\r\n Object.defineProperty(Camera.prototype, \"position\", {\r\n /**\r\n * Define the current local position of the camera in the scene\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n set: function (newPosition) {\r\n this._position = newPosition;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"upVector\", {\r\n get: function () {\r\n return this._upVector;\r\n },\r\n /**\r\n * The vector the camera should consider as up.\r\n * (default is Vector3(0, 1, 0) aka Vector3.Up())\r\n */\r\n set: function (vec) {\r\n this._upVector = vec;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Store current camera state (fov, position, etc..)\r\n * @returns the camera\r\n */\r\n Camera.prototype.storeState = function () {\r\n this._stateStored = true;\r\n this._storedFov = this.fov;\r\n return this;\r\n };\r\n /**\r\n * Restores the camera state values if it has been stored. You must call storeState() first\r\n */\r\n Camera.prototype._restoreStateValues = function () {\r\n if (!this._stateStored) {\r\n return false;\r\n }\r\n this.fov = this._storedFov;\r\n return true;\r\n };\r\n /**\r\n * Restored camera state. You must call storeState() first.\r\n * @returns true if restored and false otherwise\r\n */\r\n Camera.prototype.restoreState = function () {\r\n if (this._restoreStateValues()) {\r\n this.onRestoreStateObservable.notifyObservers(this);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets the class name of the camera.\r\n * @returns the class name\r\n */\r\n Camera.prototype.getClassName = function () {\r\n return \"Camera\";\r\n };\r\n /**\r\n * Gets a string representation of the camera useful for debug purpose.\r\n * @param fullDetails Defines that a more verboe level of logging is required\r\n * @returns the string representation\r\n */\r\n Camera.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n ret += \", type: \" + this.getClassName();\r\n if (this.animations) {\r\n for (var i = 0; i < this.animations.length; i++) {\r\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\r\n }\r\n }\r\n if (fullDetails) {\r\n }\r\n return ret;\r\n };\r\n Object.defineProperty(Camera.prototype, \"globalPosition\", {\r\n /**\r\n * Gets the current world space position of the camera.\r\n */\r\n get: function () {\r\n return this._globalPosition;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the list of active meshes this frame (meshes no culled or excluded by lod s in the frame)\r\n * @returns the active meshe list\r\n */\r\n Camera.prototype.getActiveMeshes = function () {\r\n return this._activeMeshes;\r\n };\r\n /**\r\n * Check whether a mesh is part of the current active mesh list of the camera\r\n * @param mesh Defines the mesh to check\r\n * @returns true if active, false otherwise\r\n */\r\n Camera.prototype.isActiveMesh = function (mesh) {\r\n return (this._activeMeshes.indexOf(mesh) !== -1);\r\n };\r\n /**\r\n * Is this camera ready to be used/rendered\r\n * @param completeCheck defines if a complete check (including post processes) has to be done (false by default)\r\n * @return true if the camera is ready\r\n */\r\n Camera.prototype.isReady = function (completeCheck) {\r\n if (completeCheck === void 0) { completeCheck = false; }\r\n if (completeCheck) {\r\n for (var _i = 0, _a = this._postProcesses; _i < _a.length; _i++) {\r\n var pp = _a[_i];\r\n if (pp && !pp.isReady()) {\r\n return false;\r\n }\r\n }\r\n }\r\n return _super.prototype.isReady.call(this, completeCheck);\r\n };\r\n /** @hidden */\r\n Camera.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache.position = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.upVector = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.mode = undefined;\r\n this._cache.minZ = undefined;\r\n this._cache.maxZ = undefined;\r\n this._cache.fov = undefined;\r\n this._cache.fovMode = undefined;\r\n this._cache.aspectRatio = undefined;\r\n this._cache.orthoLeft = undefined;\r\n this._cache.orthoRight = undefined;\r\n this._cache.orthoBottom = undefined;\r\n this._cache.orthoTop = undefined;\r\n this._cache.renderWidth = undefined;\r\n this._cache.renderHeight = undefined;\r\n };\r\n /** @hidden */\r\n Camera.prototype._updateCache = function (ignoreParentClass) {\r\n if (!ignoreParentClass) {\r\n _super.prototype._updateCache.call(this);\r\n }\r\n this._cache.position.copyFrom(this.position);\r\n this._cache.upVector.copyFrom(this.upVector);\r\n };\r\n /** @hidden */\r\n Camera.prototype._isSynchronized = function () {\r\n return this._isSynchronizedViewMatrix() && this._isSynchronizedProjectionMatrix();\r\n };\r\n /** @hidden */\r\n Camera.prototype._isSynchronizedViewMatrix = function () {\r\n if (!_super.prototype._isSynchronized.call(this)) {\r\n return false;\r\n }\r\n return this._cache.position.equals(this.position)\r\n && this._cache.upVector.equals(this.upVector)\r\n && this.isSynchronizedWithParent();\r\n };\r\n /** @hidden */\r\n Camera.prototype._isSynchronizedProjectionMatrix = function () {\r\n var check = this._cache.mode === this.mode\r\n && this._cache.minZ === this.minZ\r\n && this._cache.maxZ === this.maxZ;\r\n if (!check) {\r\n return false;\r\n }\r\n var engine = this.getEngine();\r\n if (this.mode === Camera.PERSPECTIVE_CAMERA) {\r\n check = this._cache.fov === this.fov\r\n && this._cache.fovMode === this.fovMode\r\n && this._cache.aspectRatio === engine.getAspectRatio(this);\r\n }\r\n else {\r\n check = this._cache.orthoLeft === this.orthoLeft\r\n && this._cache.orthoRight === this.orthoRight\r\n && this._cache.orthoBottom === this.orthoBottom\r\n && this._cache.orthoTop === this.orthoTop\r\n && this._cache.renderWidth === engine.getRenderWidth()\r\n && this._cache.renderHeight === engine.getRenderHeight();\r\n }\r\n return check;\r\n };\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n Camera.prototype.attachControl = function (ignored, noPreventDefault) {\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n Camera.prototype.detachControl = function (ignored) {\r\n };\r\n /**\r\n * Update the camera state according to the different inputs gathered during the frame.\r\n */\r\n Camera.prototype.update = function () {\r\n this._checkInputs();\r\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n this._updateRigCameras();\r\n }\r\n };\r\n /** @hidden */\r\n Camera.prototype._checkInputs = function () {\r\n this.onAfterCheckInputsObservable.notifyObservers(this);\r\n };\r\n Object.defineProperty(Camera.prototype, \"rigCameras\", {\r\n /** @hidden */\r\n get: function () {\r\n return this._rigCameras;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"rigPostProcess\", {\r\n /**\r\n * Gets the post process used by the rig cameras\r\n */\r\n get: function () {\r\n return this._rigPostProcess;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Internal, gets the first post proces.\r\n * @returns the first post process to be run on this camera.\r\n */\r\n Camera.prototype._getFirstPostProcess = function () {\r\n for (var ppIndex = 0; ppIndex < this._postProcesses.length; ppIndex++) {\r\n if (this._postProcesses[ppIndex] !== null) {\r\n return this._postProcesses[ppIndex];\r\n }\r\n }\r\n return null;\r\n };\r\n Camera.prototype._cascadePostProcessesToRigCams = function () {\r\n // invalidate framebuffer\r\n var firstPostProcess = this._getFirstPostProcess();\r\n if (firstPostProcess) {\r\n firstPostProcess.markTextureDirty();\r\n }\r\n // glue the rigPostProcess to the end of the user postprocesses & assign to each sub-camera\r\n for (var i = 0, len = this._rigCameras.length; i < len; i++) {\r\n var cam = this._rigCameras[i];\r\n var rigPostProcess = cam._rigPostProcess;\r\n // for VR rig, there does not have to be a post process\r\n if (rigPostProcess) {\r\n var isPass = rigPostProcess.getEffectName() === \"pass\";\r\n if (isPass) {\r\n // any rig which has a PassPostProcess for rig[0], cannot be isIntermediate when there are also user postProcesses\r\n cam.isIntermediate = this._postProcesses.length === 0;\r\n }\r\n cam._postProcesses = this._postProcesses.slice(0).concat(rigPostProcess);\r\n rigPostProcess.markTextureDirty();\r\n }\r\n else {\r\n cam._postProcesses = this._postProcesses.slice(0);\r\n }\r\n }\r\n };\r\n /**\r\n * Attach a post process to the camera.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses#attach-postprocess\r\n * @param postProcess The post process to attach to the camera\r\n * @param insertAt The position of the post process in case several of them are in use in the scene\r\n * @returns the position the post process has been inserted at\r\n */\r\n Camera.prototype.attachPostProcess = function (postProcess, insertAt) {\r\n if (insertAt === void 0) { insertAt = null; }\r\n if (!postProcess.isReusable() && this._postProcesses.indexOf(postProcess) > -1) {\r\n Logger.Error(\"You're trying to reuse a post process not defined as reusable.\");\r\n return 0;\r\n }\r\n if (insertAt == null || insertAt < 0) {\r\n this._postProcesses.push(postProcess);\r\n }\r\n else if (this._postProcesses[insertAt] === null) {\r\n this._postProcesses[insertAt] = postProcess;\r\n }\r\n else {\r\n this._postProcesses.splice(insertAt, 0, postProcess);\r\n }\r\n this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated\r\n // Update prePass\r\n if (this._scene.prePassRenderer) {\r\n this._scene.prePassRenderer.markAsDirty();\r\n }\r\n return this._postProcesses.indexOf(postProcess);\r\n };\r\n /**\r\n * Detach a post process to the camera.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses#attach-postprocess\r\n * @param postProcess The post process to detach from the camera\r\n */\r\n Camera.prototype.detachPostProcess = function (postProcess) {\r\n var idx = this._postProcesses.indexOf(postProcess);\r\n if (idx !== -1) {\r\n this._postProcesses[idx] = null;\r\n }\r\n // Update prePass\r\n if (this._scene.prePassRenderer) {\r\n this._scene.prePassRenderer.markAsDirty();\r\n }\r\n this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated\r\n };\r\n /**\r\n * Gets the current world matrix of the camera\r\n */\r\n Camera.prototype.getWorldMatrix = function () {\r\n if (this._isSynchronizedViewMatrix()) {\r\n return this._worldMatrix;\r\n }\r\n // Getting the the view matrix will also compute the world matrix.\r\n this.getViewMatrix();\r\n return this._worldMatrix;\r\n };\r\n /** @hidden */\r\n Camera.prototype._getViewMatrix = function () {\r\n return Matrix.Identity();\r\n };\r\n /**\r\n * Gets the current view matrix of the camera.\r\n * @param force forces the camera to recompute the matrix without looking at the cached state\r\n * @returns the view matrix\r\n */\r\n Camera.prototype.getViewMatrix = function (force) {\r\n if (!force && this._isSynchronizedViewMatrix()) {\r\n return this._computedViewMatrix;\r\n }\r\n this.updateCache();\r\n this._computedViewMatrix = this._getViewMatrix();\r\n this._currentRenderId = this.getScene().getRenderId();\r\n this._childUpdateId++;\r\n this._refreshFrustumPlanes = true;\r\n if (this._cameraRigParams && this._cameraRigParams.vrPreViewMatrix) {\r\n this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix, this._computedViewMatrix);\r\n }\r\n // Notify parent camera if rig camera is changed\r\n if (this.parent && this.parent.onViewMatrixChangedObservable) {\r\n this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent);\r\n }\r\n this.onViewMatrixChangedObservable.notifyObservers(this);\r\n this._computedViewMatrix.invertToRef(this._worldMatrix);\r\n return this._computedViewMatrix;\r\n };\r\n /**\r\n * Freeze the projection matrix.\r\n * It will prevent the cache check of the camera projection compute and can speed up perf\r\n * if no parameter of the camera are meant to change\r\n * @param projection Defines manually a projection if necessary\r\n */\r\n Camera.prototype.freezeProjectionMatrix = function (projection) {\r\n this._doNotComputeProjectionMatrix = true;\r\n if (projection !== undefined) {\r\n this._projectionMatrix = projection;\r\n }\r\n };\r\n /**\r\n * Unfreeze the projection matrix if it has previously been freezed by freezeProjectionMatrix.\r\n */\r\n Camera.prototype.unfreezeProjectionMatrix = function () {\r\n this._doNotComputeProjectionMatrix = false;\r\n };\r\n /**\r\n * Gets the current projection matrix of the camera.\r\n * @param force forces the camera to recompute the matrix without looking at the cached state\r\n * @returns the projection matrix\r\n */\r\n Camera.prototype.getProjectionMatrix = function (force) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h;\r\n if (this._doNotComputeProjectionMatrix || (!force && this._isSynchronizedProjectionMatrix())) {\r\n return this._projectionMatrix;\r\n }\r\n // Cache\r\n this._cache.mode = this.mode;\r\n this._cache.minZ = this.minZ;\r\n this._cache.maxZ = this.maxZ;\r\n // Matrix\r\n this._refreshFrustumPlanes = true;\r\n var engine = this.getEngine();\r\n var scene = this.getScene();\r\n if (this.mode === Camera.PERSPECTIVE_CAMERA) {\r\n this._cache.fov = this.fov;\r\n this._cache.fovMode = this.fovMode;\r\n this._cache.aspectRatio = engine.getAspectRatio(this);\r\n if (this.minZ <= 0) {\r\n this.minZ = 0.1;\r\n }\r\n var reverseDepth = engine.useReverseDepthBuffer;\r\n var getProjectionMatrix = void 0;\r\n if (scene.useRightHandedSystem) {\r\n getProjectionMatrix = reverseDepth ? Matrix.PerspectiveFovReverseRHToRef : Matrix.PerspectiveFovRHToRef;\r\n }\r\n else {\r\n getProjectionMatrix = reverseDepth ? Matrix.PerspectiveFovReverseLHToRef : Matrix.PerspectiveFovLHToRef;\r\n }\r\n getProjectionMatrix(this.fov, engine.getAspectRatio(this), this.minZ, this.maxZ, this._projectionMatrix, this.fovMode === Camera.FOVMODE_VERTICAL_FIXED);\r\n }\r\n else {\r\n var halfWidth = engine.getRenderWidth() / 2.0;\r\n var halfHeight = engine.getRenderHeight() / 2.0;\r\n if (scene.useRightHandedSystem) {\r\n Matrix.OrthoOffCenterRHToRef((_a = this.orthoLeft) !== null && _a !== void 0 ? _a : -halfWidth, (_b = this.orthoRight) !== null && _b !== void 0 ? _b : halfWidth, (_c = this.orthoBottom) !== null && _c !== void 0 ? _c : -halfHeight, (_d = this.orthoTop) !== null && _d !== void 0 ? _d : halfHeight, this.minZ, this.maxZ, this._projectionMatrix);\r\n }\r\n else {\r\n Matrix.OrthoOffCenterLHToRef((_e = this.orthoLeft) !== null && _e !== void 0 ? _e : -halfWidth, (_f = this.orthoRight) !== null && _f !== void 0 ? _f : halfWidth, (_g = this.orthoBottom) !== null && _g !== void 0 ? _g : -halfHeight, (_h = this.orthoTop) !== null && _h !== void 0 ? _h : halfHeight, this.minZ, this.maxZ, this._projectionMatrix);\r\n }\r\n this._cache.orthoLeft = this.orthoLeft;\r\n this._cache.orthoRight = this.orthoRight;\r\n this._cache.orthoBottom = this.orthoBottom;\r\n this._cache.orthoTop = this.orthoTop;\r\n this._cache.renderWidth = engine.getRenderWidth();\r\n this._cache.renderHeight = engine.getRenderHeight();\r\n }\r\n this.onProjectionMatrixChangedObservable.notifyObservers(this);\r\n return this._projectionMatrix;\r\n };\r\n /**\r\n * Gets the transformation matrix (ie. the multiplication of view by projection matrices)\r\n * @returns a Matrix\r\n */\r\n Camera.prototype.getTransformationMatrix = function () {\r\n this._computedViewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);\r\n return this._transformMatrix;\r\n };\r\n Camera.prototype._updateFrustumPlanes = function () {\r\n if (!this._refreshFrustumPlanes) {\r\n return;\r\n }\r\n this.getTransformationMatrix();\r\n if (!this._frustumPlanes) {\r\n this._frustumPlanes = Frustum.GetPlanes(this._transformMatrix);\r\n }\r\n else {\r\n Frustum.GetPlanesToRef(this._transformMatrix, this._frustumPlanes);\r\n }\r\n this._refreshFrustumPlanes = false;\r\n };\r\n /**\r\n * Checks if a cullable object (mesh...) is in the camera frustum\r\n * This checks the bounding box center. See isCompletelyInFrustum for a full bounding check\r\n * @param target The object to check\r\n * @param checkRigCameras If the rig cameras should be checked (eg. with webVR camera both eyes should be checked) (Default: false)\r\n * @returns true if the object is in frustum otherwise false\r\n */\r\n Camera.prototype.isInFrustum = function (target, checkRigCameras) {\r\n if (checkRigCameras === void 0) { checkRigCameras = false; }\r\n this._updateFrustumPlanes();\r\n if (checkRigCameras && this.rigCameras.length > 0) {\r\n var result = false;\r\n this.rigCameras.forEach(function (cam) {\r\n cam._updateFrustumPlanes();\r\n result = result || target.isInFrustum(cam._frustumPlanes);\r\n });\r\n return result;\r\n }\r\n else {\r\n return target.isInFrustum(this._frustumPlanes);\r\n }\r\n };\r\n /**\r\n * Checks if a cullable object (mesh...) is in the camera frustum\r\n * Unlike isInFrustum this cheks the full bounding box\r\n * @param target The object to check\r\n * @returns true if the object is in frustum otherwise false\r\n */\r\n Camera.prototype.isCompletelyInFrustum = function (target) {\r\n this._updateFrustumPlanes();\r\n return target.isCompletelyInFrustum(this._frustumPlanes);\r\n };\r\n /**\r\n * Gets a ray in the forward direction from the camera.\r\n * @param length Defines the length of the ray to create\r\n * @param transform Defines the transform to apply to the ray, by default the world matrx is used to create a workd space ray\r\n * @param origin Defines the start point of the ray which defaults to the camera position\r\n * @returns the forward ray\r\n */\r\n Camera.prototype.getForwardRay = function (length, transform, origin) {\r\n if (length === void 0) { length = 100; }\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Gets a ray in the forward direction from the camera.\r\n * @param refRay the ray to (re)use when setting the values\r\n * @param length Defines the length of the ray to create\r\n * @param transform Defines the transform to apply to the ray, by default the world matrx is used to create a workd space ray\r\n * @param origin Defines the start point of the ray which defaults to the camera position\r\n * @returns the forward ray\r\n */\r\n Camera.prototype.getForwardRayToRef = function (refRay, length, transform, origin) {\r\n if (length === void 0) { length = 100; }\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n Camera.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n // Observables\r\n this.onViewMatrixChangedObservable.clear();\r\n this.onProjectionMatrixChangedObservable.clear();\r\n this.onAfterCheckInputsObservable.clear();\r\n this.onRestoreStateObservable.clear();\r\n // Inputs\r\n if (this.inputs) {\r\n this.inputs.clear();\r\n }\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from scene\r\n this.getScene().removeCamera(this);\r\n while (this._rigCameras.length > 0) {\r\n var camera = this._rigCameras.pop();\r\n if (camera) {\r\n camera.dispose();\r\n }\r\n }\r\n // Postprocesses\r\n if (this._rigPostProcess) {\r\n this._rigPostProcess.dispose(this);\r\n this._rigPostProcess = null;\r\n this._postProcesses = [];\r\n }\r\n else if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n this._rigPostProcess = null;\r\n this._postProcesses = [];\r\n }\r\n else {\r\n var i = this._postProcesses.length;\r\n while (--i >= 0) {\r\n var postProcess = this._postProcesses[i];\r\n if (postProcess) {\r\n postProcess.dispose(this);\r\n }\r\n }\r\n }\r\n // Render targets\r\n var i = this.customRenderTargets.length;\r\n while (--i >= 0) {\r\n this.customRenderTargets[i].dispose();\r\n }\r\n this.customRenderTargets = [];\r\n // Active Meshes\r\n this._activeMeshes.dispose();\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n Object.defineProperty(Camera.prototype, \"isLeftCamera\", {\r\n /**\r\n * Gets the left camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n return this._isLeftCamera;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"isRightCamera\", {\r\n /**\r\n * Gets the right camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n return this._isRightCamera;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"leftCamera\", {\r\n /**\r\n * Gets the left camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n if (this._rigCameras.length < 1) {\r\n return null;\r\n }\r\n return this._rigCameras[0];\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"rightCamera\", {\r\n /**\r\n * Gets the right camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n if (this._rigCameras.length < 2) {\r\n return null;\r\n }\r\n return this._rigCameras[1];\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the left camera target of a rig setup in case of Rigged Camera\r\n * @returns the target position\r\n */\r\n Camera.prototype.getLeftTarget = function () {\r\n if (this._rigCameras.length < 1) {\r\n return null;\r\n }\r\n return this._rigCameras[0].getTarget();\r\n };\r\n /**\r\n * Gets the right camera target of a rig setup in case of Rigged Camera\r\n * @returns the target position\r\n */\r\n Camera.prototype.getRightTarget = function () {\r\n if (this._rigCameras.length < 2) {\r\n return null;\r\n }\r\n return this._rigCameras[1].getTarget();\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Camera.prototype.setCameraRigMode = function (mode, rigParams) {\r\n if (this.cameraRigMode === mode) {\r\n return;\r\n }\r\n while (this._rigCameras.length > 0) {\r\n var camera = this._rigCameras.pop();\r\n if (camera) {\r\n camera.dispose();\r\n }\r\n }\r\n this.cameraRigMode = mode;\r\n this._cameraRigParams = {};\r\n //we have to implement stereo camera calcultating left and right viewpoints from interaxialDistance and target,\r\n //not from a given angle as it is now, but until that complete code rewriting provisional stereoHalfAngle value is introduced\r\n this._cameraRigParams.interaxialDistance = rigParams.interaxialDistance || 0.0637;\r\n this._cameraRigParams.stereoHalfAngle = Tools.ToRadians(this._cameraRigParams.interaxialDistance / 0.0637);\r\n // create the rig cameras, unless none\r\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n var leftCamera = this.createRigCamera(this.name + \"_L\", 0);\r\n if (leftCamera) {\r\n leftCamera._isLeftCamera = true;\r\n }\r\n var rightCamera = this.createRigCamera(this.name + \"_R\", 1);\r\n if (rightCamera) {\r\n rightCamera._isRightCamera = true;\r\n }\r\n if (leftCamera && rightCamera) {\r\n this._rigCameras.push(leftCamera);\r\n this._rigCameras.push(rightCamera);\r\n }\r\n }\r\n switch (this.cameraRigMode) {\r\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n Camera._setStereoscopicAnaglyphRigMode(this);\r\n break;\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED:\r\n Camera._setStereoscopicRigMode(this);\r\n break;\r\n case Camera.RIG_MODE_VR:\r\n Camera._setVRRigMode(this, rigParams);\r\n break;\r\n case Camera.RIG_MODE_WEBVR:\r\n Camera._setWebVRRigMode(this, rigParams);\r\n break;\r\n }\r\n this._cascadePostProcessesToRigCams();\r\n this.update();\r\n };\r\n /** @hidden */\r\n Camera._setStereoscopicRigMode = function (camera) {\r\n throw \"Import Cameras/RigModes/stereoscopicRigMode before using stereoscopic rig mode\";\r\n };\r\n /** @hidden */\r\n Camera._setStereoscopicAnaglyphRigMode = function (camera) {\r\n throw \"Import Cameras/RigModes/stereoscopicAnaglyphRigMode before using stereoscopic anaglyph rig mode\";\r\n };\r\n /** @hidden */\r\n Camera._setVRRigMode = function (camera, rigParams) {\r\n throw \"Import Cameras/RigModes/vrRigMode before using VR rig mode\";\r\n };\r\n /** @hidden */\r\n Camera._setWebVRRigMode = function (camera, rigParams) {\r\n throw \"Import Cameras/RigModes/WebVRRigMode before using Web VR rig mode\";\r\n };\r\n /** @hidden */\r\n Camera.prototype._getVRProjectionMatrix = function () {\r\n Matrix.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov, this._cameraRigParams.vrMetrics.aspectRatio, this.minZ, this.maxZ, this._cameraRigParams.vrWorkMatrix);\r\n this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix, this._projectionMatrix);\r\n return this._projectionMatrix;\r\n };\r\n Camera.prototype._updateCameraRotationMatrix = function () {\r\n //Here for WebVR\r\n };\r\n Camera.prototype._updateWebVRCameraRotationMatrix = function () {\r\n //Here for WebVR\r\n };\r\n /**\r\n * This function MUST be overwritten by the different WebVR cameras available.\r\n * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.\r\n * @hidden\r\n */\r\n Camera.prototype._getWebVRProjectionMatrix = function () {\r\n return Matrix.Identity();\r\n };\r\n /**\r\n * This function MUST be overwritten by the different WebVR cameras available.\r\n * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.\r\n * @hidden\r\n */\r\n Camera.prototype._getWebVRViewMatrix = function () {\r\n return Matrix.Identity();\r\n };\r\n /** @hidden */\r\n Camera.prototype.setCameraRigParameter = function (name, value) {\r\n if (!this._cameraRigParams) {\r\n this._cameraRigParams = {};\r\n }\r\n this._cameraRigParams[name] = value;\r\n //provisionnally:\r\n if (name === \"interaxialDistance\") {\r\n this._cameraRigParams.stereoHalfAngle = Tools.ToRadians(value / 0.0637);\r\n }\r\n };\r\n /**\r\n * needs to be overridden by children so sub has required properties to be copied\r\n * @hidden\r\n */\r\n Camera.prototype.createRigCamera = function (name, cameraIndex) {\r\n return null;\r\n };\r\n /**\r\n * May need to be overridden by children\r\n * @hidden\r\n */\r\n Camera.prototype._updateRigCameras = function () {\r\n for (var i = 0; i < this._rigCameras.length; i++) {\r\n this._rigCameras[i].minZ = this.minZ;\r\n this._rigCameras[i].maxZ = this.maxZ;\r\n this._rigCameras[i].fov = this.fov;\r\n this._rigCameras[i].upVector.copyFrom(this.upVector);\r\n }\r\n // only update viewport when ANAGLYPH\r\n if (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH) {\r\n this._rigCameras[0].viewport = this._rigCameras[1].viewport = this.viewport;\r\n }\r\n };\r\n /** @hidden */\r\n Camera.prototype._setupInputs = function () {\r\n };\r\n /**\r\n * Serialiaze the camera setup to a json represention\r\n * @returns the JSON representation\r\n */\r\n Camera.prototype.serialize = function () {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n // Type\r\n serializationObject.type = this.getClassName();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n if (this.inputs) {\r\n this.inputs.serialize(serializationObject);\r\n }\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n serializationObject.ranges = this.serializeAnimationRanges();\r\n return serializationObject;\r\n };\r\n /**\r\n * Clones the current camera.\r\n * @param name The cloned camera name\r\n * @returns the cloned camera\r\n */\r\n Camera.prototype.clone = function (name) {\r\n return SerializationHelper.Clone(Camera.GetConstructorFromName(this.getClassName(), name, this.getScene(), this.interaxialDistance, this.isStereoscopicSideBySide), this);\r\n };\r\n /**\r\n * Gets the direction of the camera relative to a given local axis.\r\n * @param localAxis Defines the reference axis to provide a relative direction.\r\n * @return the direction\r\n */\r\n Camera.prototype.getDirection = function (localAxis) {\r\n var result = Vector3.Zero();\r\n this.getDirectionToRef(localAxis, result);\r\n return result;\r\n };\r\n Object.defineProperty(Camera.prototype, \"absoluteRotation\", {\r\n /**\r\n * Returns the current camera absolute rotation\r\n */\r\n get: function () {\r\n var result = Quaternion.Zero();\r\n this.getWorldMatrix().decompose(undefined, result);\r\n return result;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the direction of the camera relative to a given local axis into a passed vector.\r\n * @param localAxis Defines the reference axis to provide a relative direction.\r\n * @param result Defines the vector to store the result in\r\n */\r\n Camera.prototype.getDirectionToRef = function (localAxis, result) {\r\n Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);\r\n };\r\n /**\r\n * Gets a camera constructor for a given camera type\r\n * @param type The type of the camera to construct (should be equal to one of the camera class name)\r\n * @param name The name of the camera the result will be able to instantiate\r\n * @param scene The scene the result will construct the camera in\r\n * @param interaxial_distance In case of stereoscopic setup, the distance between both eyes\r\n * @param isStereoscopicSideBySide In case of stereoscopic setup, should the sereo be side b side\r\n * @returns a factory method to construc the camera\r\n */\r\n Camera.GetConstructorFromName = function (type, name, scene, interaxial_distance, isStereoscopicSideBySide) {\r\n if (interaxial_distance === void 0) { interaxial_distance = 0; }\r\n if (isStereoscopicSideBySide === void 0) { isStereoscopicSideBySide = true; }\r\n var constructorFunc = Node.Construct(type, name, scene, {\r\n interaxial_distance: interaxial_distance,\r\n isStereoscopicSideBySide: isStereoscopicSideBySide\r\n });\r\n if (constructorFunc) {\r\n return constructorFunc;\r\n }\r\n // Default to universal camera\r\n return function () { return Camera._createDefaultParsedCamera(name, scene); };\r\n };\r\n /**\r\n * Compute the world matrix of the camera.\r\n * @returns the camera world matrix\r\n */\r\n Camera.prototype.computeWorldMatrix = function () {\r\n return this.getWorldMatrix();\r\n };\r\n /**\r\n * Parse a JSON and creates the camera from the parsed information\r\n * @param parsedCamera The JSON to parse\r\n * @param scene The scene to instantiate the camera in\r\n * @returns the newly constructed camera\r\n */\r\n Camera.Parse = function (parsedCamera, scene) {\r\n var type = parsedCamera.type;\r\n var construct = Camera.GetConstructorFromName(type, parsedCamera.name, scene, parsedCamera.interaxial_distance, parsedCamera.isStereoscopicSideBySide);\r\n var camera = SerializationHelper.Parse(construct, parsedCamera, scene);\r\n // Parent\r\n if (parsedCamera.parentId) {\r\n camera._waitingParentId = parsedCamera.parentId;\r\n }\r\n //If camera has an input manager, let it parse inputs settings\r\n if (camera.inputs) {\r\n camera.inputs.parse(parsedCamera);\r\n camera._setupInputs();\r\n }\r\n if (parsedCamera.upVector) {\r\n camera.upVector = Vector3.FromArray(parsedCamera.upVector); // need to force the upVector\r\n }\r\n if (camera.setPosition) { // need to force position\r\n camera.position.copyFromFloats(0, 0, 0);\r\n camera.setPosition(Vector3.FromArray(parsedCamera.position));\r\n }\r\n // Target\r\n if (parsedCamera.target) {\r\n if (camera.setTarget) {\r\n camera.setTarget(Vector3.FromArray(parsedCamera.target));\r\n }\r\n }\r\n // Apply 3d rig, when found\r\n if (parsedCamera.cameraRigMode) {\r\n var rigParams = (parsedCamera.interaxial_distance) ? { interaxialDistance: parsedCamera.interaxial_distance } : {};\r\n camera.setCameraRigMode(parsedCamera.cameraRigMode, rigParams);\r\n }\r\n // Animations\r\n if (parsedCamera.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedCamera.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedCamera.animations[animationIndex];\r\n var internalClass = _TypeStore.GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n camera.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n Node.ParseAnimationRanges(camera, parsedCamera, scene);\r\n }\r\n if (parsedCamera.autoAnimate) {\r\n scene.beginAnimation(camera, parsedCamera.autoAnimateFrom, parsedCamera.autoAnimateTo, parsedCamera.autoAnimateLoop, parsedCamera.autoAnimateSpeed || 1.0);\r\n }\r\n return camera;\r\n };\r\n /** @hidden */\r\n Camera._createDefaultParsedCamera = function (name, scene) {\r\n throw _DevTools.WarnImport(\"UniversalCamera\");\r\n };\r\n /**\r\n * This is the default projection mode used by the cameras.\r\n * It helps recreating a feeling of perspective and better appreciate depth.\r\n * This is the best way to simulate real life cameras.\r\n */\r\n Camera.PERSPECTIVE_CAMERA = 0;\r\n /**\r\n * This helps creating camera with an orthographic mode.\r\n * Orthographic is commonly used in engineering as a means to produce object specifications that communicate dimensions unambiguously, each line of 1 unit length (cm, meter..whatever) will appear to have the same length everywhere on the drawing. This allows the drafter to dimension only a subset of lines and let the reader know that other lines of that length on the drawing are also that length in reality. Every parallel line in the drawing is also parallel in the object.\r\n */\r\n Camera.ORTHOGRAPHIC_CAMERA = 1;\r\n /**\r\n * This is the default FOV mode for perspective cameras.\r\n * This setting aligns the upper and lower bounds of the viewport to the upper and lower bounds of the camera frustum.\r\n */\r\n Camera.FOVMODE_VERTICAL_FIXED = 0;\r\n /**\r\n * This setting aligns the left and right bounds of the viewport to the left and right bounds of the camera frustum.\r\n */\r\n Camera.FOVMODE_HORIZONTAL_FIXED = 1;\r\n /**\r\n * This specifies ther is no need for a camera rig.\r\n * Basically only one eye is rendered corresponding to the camera.\r\n */\r\n Camera.RIG_MODE_NONE = 0;\r\n /**\r\n * Simulates a camera Rig with one blue eye and one red eye.\r\n * This can be use with 3d blue and red glasses.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH = 10;\r\n /**\r\n * Defines that both eyes of the camera will be rendered side by side with a parallel target.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL = 11;\r\n /**\r\n * Defines that both eyes of the camera will be rendered side by side with a none parallel target.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED = 12;\r\n /**\r\n * Defines that both eyes of the camera will be rendered over under each other.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER = 13;\r\n /**\r\n * Defines that both eyes of the camera will be rendered on successive lines interlaced for passive 3d monitors.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_INTERLACED = 14;\r\n /**\r\n * Defines that both eyes of the camera should be renderered in a VR mode (carbox).\r\n */\r\n Camera.RIG_MODE_VR = 20;\r\n /**\r\n * Defines that both eyes of the camera should be renderered in a VR mode (webVR).\r\n */\r\n Camera.RIG_MODE_WEBVR = 21;\r\n /**\r\n * Custom rig mode allowing rig cameras to be populated manually with any number of cameras\r\n */\r\n Camera.RIG_MODE_CUSTOM = 22;\r\n /**\r\n * Defines if by default attaching controls should prevent the default javascript event to continue.\r\n */\r\n Camera.ForceAttachControlToAlwaysPreventDefault = false;\r\n __decorate([\r\n serializeAsVector3(\"position\")\r\n ], Camera.prototype, \"_position\", void 0);\r\n __decorate([\r\n serializeAsVector3(\"upVector\")\r\n ], Camera.prototype, \"_upVector\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"orthoLeft\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"orthoRight\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"orthoBottom\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"orthoTop\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"fov\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"minZ\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"maxZ\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"inertia\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"mode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"layerMask\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"fovMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"cameraRigMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"interaxialDistance\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"isStereoscopicSideBySide\", void 0);\r\n return Camera;\r\n}(Node));\r\nexport { Camera };\r\n//# sourceMappingURL=camera.js.map","import { Logger } from \"../Misc/logger\";\r\nimport { SerializationHelper } from \"../Misc/decorators\";\r\nimport { Camera } from \"./camera\";\r\n/**\r\n * @ignore\r\n * This is a list of all the different input types that are available in the application.\r\n * Fo instance: ArcRotateCameraGamepadInput...\r\n */\r\nexport var CameraInputTypes = {};\r\n/**\r\n * This represents the input manager used within a camera.\r\n * It helps dealing with all the different kind of input attached to a camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar CameraInputsManager = /** @class */ (function () {\r\n /**\r\n * Instantiate a new Camera Input Manager.\r\n * @param camera Defines the camera the input manager blongs to\r\n */\r\n function CameraInputsManager(camera) {\r\n /**\r\n * Defines the dom element the camera is collecting inputs from.\r\n * This is null if the controls have not been attached.\r\n */\r\n this.attachedToElement = false;\r\n this.attached = {};\r\n this.camera = camera;\r\n this.checkInputs = function () { };\r\n }\r\n /**\r\n * Add an input method to a camera\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n * @param input camera input method\r\n */\r\n CameraInputsManager.prototype.add = function (input) {\r\n var type = input.getSimpleName();\r\n if (this.attached[type]) {\r\n Logger.Warn(\"camera input of type \" + type + \" already exists on camera\");\r\n return;\r\n }\r\n this.attached[type] = input;\r\n input.camera = this.camera;\r\n //for checkInputs, we are dynamically creating a function\r\n //the goal is to avoid the performance penalty of looping for inputs in the render loop\r\n if (input.checkInputs) {\r\n this.checkInputs = this._addCheckInputs(input.checkInputs.bind(input));\r\n }\r\n if (this.attachedToElement) {\r\n input.attachControl();\r\n }\r\n };\r\n /**\r\n * Remove a specific input method from a camera\r\n * example: camera.inputs.remove(camera.inputs.attached.mouse);\r\n * @param inputToRemove camera input method\r\n */\r\n CameraInputsManager.prototype.remove = function (inputToRemove) {\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n if (input === inputToRemove) {\r\n input.detachControl();\r\n input.camera = null;\r\n delete this.attached[cam];\r\n this.rebuildInputCheck();\r\n }\r\n }\r\n };\r\n /**\r\n * Remove a specific input type from a camera\r\n * example: camera.inputs.remove(\"ArcRotateCameraGamepadInput\");\r\n * @param inputType the type of the input to remove\r\n */\r\n CameraInputsManager.prototype.removeByType = function (inputType) {\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n if (input.getClassName() === inputType) {\r\n input.detachControl();\r\n input.camera = null;\r\n delete this.attached[cam];\r\n this.rebuildInputCheck();\r\n }\r\n }\r\n };\r\n CameraInputsManager.prototype._addCheckInputs = function (fn) {\r\n var current = this.checkInputs;\r\n return function () {\r\n current();\r\n fn();\r\n };\r\n };\r\n /**\r\n * Attach the input controls to the currently attached dom element to listen the events from.\r\n * @param input Defines the input to attach\r\n */\r\n CameraInputsManager.prototype.attachInput = function (input) {\r\n if (this.attachedToElement) {\r\n input.attachControl(this.noPreventDefault);\r\n }\r\n };\r\n /**\r\n * Attach the current manager inputs controls to a specific dom element to listen the events from.\r\n * @param element Defines the dom element to collect the events from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n CameraInputsManager.prototype.attachElement = function (noPreventDefault) {\r\n if (noPreventDefault === void 0) { noPreventDefault = false; }\r\n if (this.attachedToElement) {\r\n return;\r\n }\r\n noPreventDefault = Camera.ForceAttachControlToAlwaysPreventDefault ? false : noPreventDefault;\r\n this.attachedToElement = true;\r\n this.noPreventDefault = noPreventDefault;\r\n for (var cam in this.attached) {\r\n this.attached[cam].attachControl(noPreventDefault);\r\n }\r\n };\r\n /**\r\n * Detach the current manager inputs controls from a specific dom element.\r\n * @param element Defines the dom element to collect the events from\r\n * @param disconnect Defines whether the input should be removed from the current list of attached inputs\r\n */\r\n CameraInputsManager.prototype.detachElement = function (disconnect) {\r\n if (disconnect === void 0) { disconnect = false; }\r\n for (var cam in this.attached) {\r\n this.attached[cam].detachControl();\r\n if (disconnect) {\r\n this.attached[cam].camera = null;\r\n }\r\n }\r\n this.attachedToElement = false;\r\n };\r\n /**\r\n * Rebuild the dynamic inputCheck function from the current list of\r\n * defined inputs in the manager.\r\n */\r\n CameraInputsManager.prototype.rebuildInputCheck = function () {\r\n this.checkInputs = function () { };\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n if (input.checkInputs) {\r\n this.checkInputs = this._addCheckInputs(input.checkInputs.bind(input));\r\n }\r\n }\r\n };\r\n /**\r\n * Remove all attached input methods from a camera\r\n */\r\n CameraInputsManager.prototype.clear = function () {\r\n if (this.attachedToElement) {\r\n this.detachElement(true);\r\n }\r\n this.attached = {};\r\n this.attachedToElement = false;\r\n this.checkInputs = function () { };\r\n };\r\n /**\r\n * Serialize the current input manager attached to a camera.\r\n * This ensures than once parsed,\r\n * the input associated to the camera will be identical to the current ones\r\n * @param serializedCamera Defines the camera serialization JSON the input serialization should write to\r\n */\r\n CameraInputsManager.prototype.serialize = function (serializedCamera) {\r\n var inputs = {};\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n var res = SerializationHelper.Serialize(input);\r\n inputs[input.getClassName()] = res;\r\n }\r\n serializedCamera.inputsmgr = inputs;\r\n };\r\n /**\r\n * Parses an input manager serialized JSON to restore the previous list of inputs\r\n * and states associated to a camera.\r\n * @param parsedCamera Defines the JSON to parse\r\n */\r\n CameraInputsManager.prototype.parse = function (parsedCamera) {\r\n var parsedInputs = parsedCamera.inputsmgr;\r\n if (parsedInputs) {\r\n this.clear();\r\n for (var n in parsedInputs) {\r\n var construct = CameraInputTypes[n];\r\n if (construct) {\r\n var parsedinput = parsedInputs[n];\r\n var input = SerializationHelper.Parse(function () {\r\n return new construct();\r\n }, parsedinput, null);\r\n this.add(input);\r\n }\r\n }\r\n }\r\n else {\r\n //2016-03-08 this part is for managing backward compatibility\r\n for (var n in this.attached) {\r\n var construct = CameraInputTypes[this.attached[n].getClassName()];\r\n if (construct) {\r\n var input = SerializationHelper.Parse(function () {\r\n return new construct();\r\n }, parsedCamera, null);\r\n this.remove(this.attached[n]);\r\n this.add(input);\r\n }\r\n }\r\n }\r\n };\r\n return CameraInputsManager;\r\n}());\r\nexport { CameraInputsManager };\r\n//# sourceMappingURL=cameraInputsManager.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, serializeAsVector3, serializeAsMeshReference } from \"../Misc/decorators\";\r\nimport { Camera } from \"./camera\";\r\nimport { Quaternion, Matrix, Vector3, Vector2, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Epsilon } from '../Maths/math.constants';\r\nimport { Axis } from '../Maths/math.axis';\r\n/**\r\n * A target camera takes a mesh or position as a target and continues to look at it while it moves.\r\n * This is the base of the follow, arc rotate cameras and Free camera\r\n * @see https://doc.babylonjs.com/features/cameras\r\n */\r\nvar TargetCamera = /** @class */ (function (_super) {\r\n __extends(TargetCamera, _super);\r\n /**\r\n * Instantiates a target camera that takes a mesh or position as a target and continues to look at it while it moves.\r\n * This is the base of the follow, arc rotate cameras and Free camera\r\n * @see https://doc.babylonjs.com/features/cameras\r\n * @param name Defines the name of the camera in the scene\r\n * @param position Defines the start position of the camera in the scene\r\n * @param scene Defines the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active if not other active cameras have been defined\r\n */\r\n function TargetCamera(name, position, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, position, scene, setActiveOnSceneIfNoneActive) || this;\r\n _this._tmpUpVector = Vector3.Zero();\r\n _this._tmpTargetVector = Vector3.Zero();\r\n /**\r\n * Define the current direction the camera is moving to\r\n */\r\n _this.cameraDirection = new Vector3(0, 0, 0);\r\n /**\r\n * Define the current rotation the camera is rotating to\r\n */\r\n _this.cameraRotation = new Vector2(0, 0);\r\n /** Gets or sets a boolean indicating that the scaling of the parent hierarchy will not be taken in account by the camera */\r\n _this.ignoreParentScaling = false;\r\n /**\r\n * When set, the up vector of the camera will be updated by the rotation of the camera\r\n */\r\n _this.updateUpVectorFromRotation = false;\r\n _this._tmpQuaternion = new Quaternion();\r\n /**\r\n * Define the current rotation of the camera\r\n */\r\n _this.rotation = new Vector3(0, 0, 0);\r\n /**\r\n * Define the current speed of the camera\r\n */\r\n _this.speed = 2.0;\r\n /**\r\n * Add constraint to the camera to prevent it to move freely in all directions and\r\n * around all axis.\r\n */\r\n _this.noRotationConstraint = false;\r\n /**\r\n * Reverses mouselook direction to 'natural' panning as opposed to traditional direct\r\n * panning\r\n */\r\n _this.invertRotation = false;\r\n /**\r\n * Speed multiplier for inverse camera panning\r\n */\r\n _this.inverseRotationSpeed = 0.2;\r\n /**\r\n * Define the current target of the camera as an object or a position.\r\n */\r\n _this.lockedTarget = null;\r\n /** @hidden */\r\n _this._currentTarget = Vector3.Zero();\r\n /** @hidden */\r\n _this._initialFocalDistance = 1;\r\n /** @hidden */\r\n _this._viewMatrix = Matrix.Zero();\r\n /** @hidden */\r\n _this._camMatrix = Matrix.Zero();\r\n /** @hidden */\r\n _this._cameraTransformMatrix = Matrix.Zero();\r\n /** @hidden */\r\n _this._cameraRotationMatrix = Matrix.Zero();\r\n /** @hidden */\r\n _this._referencePoint = new Vector3(0, 0, 1);\r\n /** @hidden */\r\n _this._transformedReferencePoint = Vector3.Zero();\r\n _this._defaultUp = Vector3.Up();\r\n _this._cachedRotationZ = 0;\r\n _this._cachedQuaternionRotationZ = 0;\r\n return _this;\r\n }\r\n /**\r\n * Gets the position in front of the camera at a given distance.\r\n * @param distance The distance from the camera we want the position to be\r\n * @returns the position\r\n */\r\n TargetCamera.prototype.getFrontPosition = function (distance) {\r\n this.getWorldMatrix();\r\n var direction = this.getTarget().subtract(this.position);\r\n direction.normalize();\r\n direction.scaleInPlace(distance);\r\n return this.globalPosition.add(direction);\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._getLockedTargetPosition = function () {\r\n if (!this.lockedTarget) {\r\n return null;\r\n }\r\n if (this.lockedTarget.absolutePosition) {\r\n this.lockedTarget.computeWorldMatrix();\r\n }\r\n return this.lockedTarget.absolutePosition || this.lockedTarget;\r\n };\r\n /**\r\n * Store current camera state of the camera (fov, position, rotation, etc..)\r\n * @returns the camera\r\n */\r\n TargetCamera.prototype.storeState = function () {\r\n this._storedPosition = this.position.clone();\r\n this._storedRotation = this.rotation.clone();\r\n if (this.rotationQuaternion) {\r\n this._storedRotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n return _super.prototype.storeState.call(this);\r\n };\r\n /**\r\n * Restored camera state. You must call storeState() first\r\n * @returns whether it was successful or not\r\n * @hidden\r\n */\r\n TargetCamera.prototype._restoreStateValues = function () {\r\n if (!_super.prototype._restoreStateValues.call(this)) {\r\n return false;\r\n }\r\n this.position = this._storedPosition.clone();\r\n this.rotation = this._storedRotation.clone();\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion = this._storedRotationQuaternion.clone();\r\n }\r\n this.cameraDirection.copyFromFloats(0, 0, 0);\r\n this.cameraRotation.copyFromFloats(0, 0);\r\n return true;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache.lockedTarget = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.rotation = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.rotationQuaternion = new Quaternion(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._updateCache = function (ignoreParentClass) {\r\n if (!ignoreParentClass) {\r\n _super.prototype._updateCache.call(this);\r\n }\r\n var lockedTargetPosition = this._getLockedTargetPosition();\r\n if (!lockedTargetPosition) {\r\n this._cache.lockedTarget = null;\r\n }\r\n else {\r\n if (!this._cache.lockedTarget) {\r\n this._cache.lockedTarget = lockedTargetPosition.clone();\r\n }\r\n else {\r\n this._cache.lockedTarget.copyFrom(lockedTargetPosition);\r\n }\r\n }\r\n this._cache.rotation.copyFrom(this.rotation);\r\n if (this.rotationQuaternion) {\r\n this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n }\r\n };\r\n // Synchronized\r\n /** @hidden */\r\n TargetCamera.prototype._isSynchronizedViewMatrix = function () {\r\n if (!_super.prototype._isSynchronizedViewMatrix.call(this)) {\r\n return false;\r\n }\r\n var lockedTargetPosition = this._getLockedTargetPosition();\r\n return (this._cache.lockedTarget ? this._cache.lockedTarget.equals(lockedTargetPosition) : !lockedTargetPosition)\r\n && (this.rotationQuaternion ? this.rotationQuaternion.equals(this._cache.rotationQuaternion) : this._cache.rotation.equals(this.rotation));\r\n };\r\n // Methods\r\n /** @hidden */\r\n TargetCamera.prototype._computeLocalCameraSpeed = function () {\r\n var engine = this.getEngine();\r\n return this.speed * Math.sqrt((engine.getDeltaTime() / (engine.getFps() * 100.0)));\r\n };\r\n // Target\r\n /**\r\n * Defines the target the camera should look at.\r\n * @param target Defines the new target as a Vector or a mesh\r\n */\r\n TargetCamera.prototype.setTarget = function (target) {\r\n this.upVector.normalize();\r\n this._initialFocalDistance = target.subtract(this.position).length();\r\n if (this.position.z === target.z) {\r\n this.position.z += Epsilon;\r\n }\r\n this._referencePoint.normalize().scaleInPlace(this._initialFocalDistance);\r\n Matrix.LookAtLHToRef(this.position, target, this._defaultUp, this._camMatrix);\r\n this._camMatrix.invert();\r\n this.rotation.x = Math.atan(this._camMatrix.m[6] / this._camMatrix.m[10]);\r\n var vDir = target.subtract(this.position);\r\n if (vDir.x >= 0.0) {\r\n this.rotation.y = (-Math.atan(vDir.z / vDir.x) + Math.PI / 2.0);\r\n }\r\n else {\r\n this.rotation.y = (-Math.atan(vDir.z / vDir.x) - Math.PI / 2.0);\r\n }\r\n this.rotation.z = 0;\r\n if (isNaN(this.rotation.x)) {\r\n this.rotation.x = 0;\r\n }\r\n if (isNaN(this.rotation.y)) {\r\n this.rotation.y = 0;\r\n }\r\n if (isNaN(this.rotation.z)) {\r\n this.rotation.z = 0;\r\n }\r\n if (this.rotationQuaternion) {\r\n Quaternion.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion);\r\n }\r\n };\r\n Object.defineProperty(TargetCamera.prototype, \"target\", {\r\n /**\r\n * Defines the target point of the camera.\r\n * The camera looks towards it form the radius distance.\r\n */\r\n get: function () {\r\n return this.getTarget();\r\n },\r\n set: function (value) {\r\n this.setTarget(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Return the current target position of the camera. This value is expressed in local space.\r\n * @returns the target position\r\n */\r\n TargetCamera.prototype.getTarget = function () {\r\n return this._currentTarget;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._decideIfNeedsToMove = function () {\r\n return Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._updatePosition = function () {\r\n if (this.parent) {\r\n this.parent.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]);\r\n Vector3.TransformNormalToRef(this.cameraDirection, TmpVectors.Matrix[0], TmpVectors.Vector3[0]);\r\n this.position.addInPlace(TmpVectors.Vector3[0]);\r\n return;\r\n }\r\n this.position.addInPlace(this.cameraDirection);\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._checkInputs = function () {\r\n var directionMultiplier = this.invertRotation ? -this.inverseRotationSpeed : 1.0;\r\n var needToMove = this._decideIfNeedsToMove();\r\n var needToRotate = Math.abs(this.cameraRotation.x) > 0 || Math.abs(this.cameraRotation.y) > 0;\r\n // Move\r\n if (needToMove) {\r\n this._updatePosition();\r\n }\r\n // Rotate\r\n if (needToRotate) {\r\n //rotate, if quaternion is set and rotation was used\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion.toEulerAnglesToRef(this.rotation);\r\n }\r\n this.rotation.x += this.cameraRotation.x * directionMultiplier;\r\n this.rotation.y += this.cameraRotation.y * directionMultiplier;\r\n // Apply constraints\r\n if (!this.noRotationConstraint) {\r\n var limit = 1.570796;\r\n if (this.rotation.x > limit) {\r\n this.rotation.x = limit;\r\n }\r\n if (this.rotation.x < -limit) {\r\n this.rotation.x = -limit;\r\n }\r\n }\r\n //rotate, if quaternion is set and rotation was used\r\n if (this.rotationQuaternion) {\r\n var len = this.rotation.lengthSquared();\r\n if (len) {\r\n Quaternion.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion);\r\n }\r\n }\r\n }\r\n // Inertia\r\n if (needToMove) {\r\n if (Math.abs(this.cameraDirection.x) < this.speed * Epsilon) {\r\n this.cameraDirection.x = 0;\r\n }\r\n if (Math.abs(this.cameraDirection.y) < this.speed * Epsilon) {\r\n this.cameraDirection.y = 0;\r\n }\r\n if (Math.abs(this.cameraDirection.z) < this.speed * Epsilon) {\r\n this.cameraDirection.z = 0;\r\n }\r\n this.cameraDirection.scaleInPlace(this.inertia);\r\n }\r\n if (needToRotate) {\r\n if (Math.abs(this.cameraRotation.x) < this.speed * Epsilon) {\r\n this.cameraRotation.x = 0;\r\n }\r\n if (Math.abs(this.cameraRotation.y) < this.speed * Epsilon) {\r\n this.cameraRotation.y = 0;\r\n }\r\n this.cameraRotation.scaleInPlace(this.inertia);\r\n }\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n TargetCamera.prototype._updateCameraRotationMatrix = function () {\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix);\r\n }\r\n else {\r\n Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);\r\n }\r\n };\r\n /**\r\n * Update the up vector to apply the rotation of the camera (So if you changed the camera rotation.z this will let you update the up vector as well)\r\n * @returns the current camera\r\n */\r\n TargetCamera.prototype._rotateUpVectorWithCameraRotationMatrix = function () {\r\n Vector3.TransformNormalToRef(this._defaultUp, this._cameraRotationMatrix, this.upVector);\r\n return this;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._getViewMatrix = function () {\r\n if (this.lockedTarget) {\r\n this.setTarget(this._getLockedTargetPosition());\r\n }\r\n // Compute\r\n this._updateCameraRotationMatrix();\r\n // Apply the changed rotation to the upVector\r\n if (this.rotationQuaternion && this._cachedQuaternionRotationZ != this.rotationQuaternion.z) {\r\n this._rotateUpVectorWithCameraRotationMatrix();\r\n this._cachedQuaternionRotationZ = this.rotationQuaternion.z;\r\n }\r\n else if (this._cachedRotationZ != this.rotation.z) {\r\n this._rotateUpVectorWithCameraRotationMatrix();\r\n this._cachedRotationZ = this.rotation.z;\r\n }\r\n Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);\r\n // Computing target and final matrix\r\n this.position.addToRef(this._transformedReferencePoint, this._currentTarget);\r\n if (this.updateUpVectorFromRotation) {\r\n if (this.rotationQuaternion) {\r\n Axis.Y.rotateByQuaternionToRef(this.rotationQuaternion, this.upVector);\r\n }\r\n else {\r\n Quaternion.FromEulerVectorToRef(this.rotation, this._tmpQuaternion);\r\n Axis.Y.rotateByQuaternionToRef(this._tmpQuaternion, this.upVector);\r\n }\r\n }\r\n this._computeViewMatrix(this.position, this._currentTarget, this.upVector);\r\n return this._viewMatrix;\r\n };\r\n TargetCamera.prototype._computeViewMatrix = function (position, target, up) {\r\n if (this.ignoreParentScaling) {\r\n if (this.parent) {\r\n var parentWorldMatrix = this.parent.getWorldMatrix();\r\n Vector3.TransformCoordinatesToRef(position, parentWorldMatrix, this._globalPosition);\r\n Vector3.TransformCoordinatesToRef(target, parentWorldMatrix, this._tmpTargetVector);\r\n Vector3.TransformNormalToRef(up, parentWorldMatrix, this._tmpUpVector);\r\n this._markSyncedWithParent();\r\n }\r\n else {\r\n this._globalPosition.copyFrom(position);\r\n this._tmpTargetVector.copyFrom(target);\r\n this._tmpUpVector.copyFrom(up);\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n Matrix.LookAtRHToRef(this._globalPosition, this._tmpTargetVector, this._tmpUpVector, this._viewMatrix);\r\n }\r\n else {\r\n Matrix.LookAtLHToRef(this._globalPosition, this._tmpTargetVector, this._tmpUpVector, this._viewMatrix);\r\n }\r\n return;\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n Matrix.LookAtRHToRef(position, target, up, this._viewMatrix);\r\n }\r\n else {\r\n Matrix.LookAtLHToRef(position, target, up, this._viewMatrix);\r\n }\r\n if (this.parent) {\r\n var parentWorldMatrix = this.parent.getWorldMatrix();\r\n this._viewMatrix.invert();\r\n this._viewMatrix.multiplyToRef(parentWorldMatrix, this._viewMatrix);\r\n this._viewMatrix.getTranslationToRef(this._globalPosition);\r\n this._viewMatrix.invert();\r\n this._markSyncedWithParent();\r\n }\r\n else {\r\n this._globalPosition.copyFrom(position);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n */\r\n TargetCamera.prototype.createRigCamera = function (name, cameraIndex) {\r\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n var rigCamera = new TargetCamera(name, this.position.clone(), this.getScene());\r\n rigCamera.isRigCamera = true;\r\n rigCamera.rigParent = this;\r\n if (this.cameraRigMode === Camera.RIG_MODE_VR || this.cameraRigMode === Camera.RIG_MODE_WEBVR) {\r\n if (!this.rotationQuaternion) {\r\n this.rotationQuaternion = new Quaternion();\r\n }\r\n rigCamera._cameraRigParams = {};\r\n rigCamera.rotationQuaternion = new Quaternion();\r\n }\r\n return rigCamera;\r\n }\r\n return null;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n TargetCamera.prototype._updateRigCameras = function () {\r\n var camLeft = this._rigCameras[0];\r\n var camRight = this._rigCameras[1];\r\n this.computeWorldMatrix();\r\n switch (this.cameraRigMode) {\r\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED:\r\n //provisionnaly using _cameraRigParams.stereoHalfAngle instead of calculations based on _cameraRigParams.interaxialDistance:\r\n var leftSign = (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? 1 : -1;\r\n var rightSign = (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? -1 : 1;\r\n this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * leftSign, camLeft);\r\n this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * rightSign, camRight);\r\n break;\r\n case Camera.RIG_MODE_VR:\r\n if (camLeft.rotationQuaternion) {\r\n camLeft.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n camRight.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n }\r\n else {\r\n camLeft.rotation.copyFrom(this.rotation);\r\n camRight.rotation.copyFrom(this.rotation);\r\n }\r\n camLeft.position.copyFrom(this.position);\r\n camRight.position.copyFrom(this.position);\r\n break;\r\n }\r\n _super.prototype._updateRigCameras.call(this);\r\n };\r\n TargetCamera.prototype._getRigCamPositionAndTarget = function (halfSpace, rigCamera) {\r\n var target = this.getTarget();\r\n target.subtractToRef(this.position, TargetCamera._TargetFocalPoint);\r\n TargetCamera._TargetFocalPoint.normalize().scaleInPlace(this._initialFocalDistance);\r\n var newFocalTarget = TargetCamera._TargetFocalPoint.addInPlace(this.position);\r\n Matrix.TranslationToRef(-newFocalTarget.x, -newFocalTarget.y, -newFocalTarget.z, TargetCamera._TargetTransformMatrix);\r\n TargetCamera._TargetTransformMatrix.multiplyToRef(Matrix.RotationAxis(rigCamera.upVector, halfSpace), TargetCamera._RigCamTransformMatrix);\r\n Matrix.TranslationToRef(newFocalTarget.x, newFocalTarget.y, newFocalTarget.z, TargetCamera._TargetTransformMatrix);\r\n TargetCamera._RigCamTransformMatrix.multiplyToRef(TargetCamera._TargetTransformMatrix, TargetCamera._RigCamTransformMatrix);\r\n Vector3.TransformCoordinatesToRef(this.position, TargetCamera._RigCamTransformMatrix, rigCamera.position);\r\n rigCamera.setTarget(newFocalTarget);\r\n };\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n TargetCamera.prototype.getClassName = function () {\r\n return \"TargetCamera\";\r\n };\r\n TargetCamera._RigCamTransformMatrix = new Matrix();\r\n TargetCamera._TargetTransformMatrix = new Matrix();\r\n TargetCamera._TargetFocalPoint = new Vector3();\r\n __decorate([\r\n serializeAsVector3()\r\n ], TargetCamera.prototype, \"rotation\", void 0);\r\n __decorate([\r\n serialize()\r\n ], TargetCamera.prototype, \"speed\", void 0);\r\n __decorate([\r\n serializeAsMeshReference(\"lockedTargetId\")\r\n ], TargetCamera.prototype, \"lockedTarget\", void 0);\r\n return TargetCamera;\r\n}(Camera));\r\nexport { TargetCamera };\r\n//# sourceMappingURL=targetCamera.js.map","/**\r\n * @hidden\r\n */\r\nvar IntersectionInfo = /** @class */ (function () {\r\n function IntersectionInfo(bu, bv, distance) {\r\n this.bu = bu;\r\n this.bv = bv;\r\n this.distance = distance;\r\n this.faceId = 0;\r\n this.subMeshId = 0;\r\n }\r\n return IntersectionInfo;\r\n}());\r\nexport { IntersectionInfo };\r\n//# sourceMappingURL=intersectionInfo.js.map","import { Vector3, Vector2, TmpVectors } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\n/**\r\n * Information about the result of picking within a scene\r\n * @see https://doc.babylonjs.com/babylon101/picking_collisions\r\n */\r\nvar PickingInfo = /** @class */ (function () {\r\n function PickingInfo() {\r\n /** @hidden */\r\n this._pickingUnavailable = false;\r\n /**\r\n * If the pick collided with an object\r\n */\r\n this.hit = false;\r\n /**\r\n * Distance away where the pick collided\r\n */\r\n this.distance = 0;\r\n /**\r\n * The location of pick collision\r\n */\r\n this.pickedPoint = null;\r\n /**\r\n * The mesh corresponding the the pick collision\r\n */\r\n this.pickedMesh = null;\r\n /** (See getTextureCoordinates) The barycentric U coordinate that is used when calculating the texture coordinates of the collision.*/\r\n this.bu = 0;\r\n /** (See getTextureCoordinates) The barycentric V coordinate that is used when calculating the texture coordinates of the collision.*/\r\n this.bv = 0;\r\n /** The index of the face on the mesh that was picked, or the index of the Line if the picked Mesh is a LinesMesh */\r\n this.faceId = -1;\r\n /** The index of the face on the subMesh that was picked, or the index of the Line if the picked Mesh is a LinesMesh */\r\n this.subMeshFaceId = -1;\r\n /** Id of the the submesh that was picked */\r\n this.subMeshId = 0;\r\n /** If a sprite was picked, this will be the sprite the pick collided with */\r\n this.pickedSprite = null;\r\n /** If we are pikcing a mesh with thin instance, this will give you the picked thin instance */\r\n this.thinInstanceIndex = -1;\r\n /**\r\n * If a mesh was used to do the picking (eg. 6dof controller) this will be populated.\r\n */\r\n this.originMesh = null;\r\n /**\r\n * The ray that was used to perform the picking.\r\n */\r\n this.ray = null;\r\n }\r\n /**\r\n * Gets the normal correspodning to the face the pick collided with\r\n * @param useWorldCoordinates If the resulting normal should be relative to the world (default: false)\r\n * @param useVerticesNormals If the vertices normals should be used to calculate the normal instead of the normal map\r\n * @returns The normal correspodning to the face the pick collided with\r\n */\r\n PickingInfo.prototype.getNormal = function (useWorldCoordinates, useVerticesNormals) {\r\n if (useWorldCoordinates === void 0) { useWorldCoordinates = false; }\r\n if (useVerticesNormals === void 0) { useVerticesNormals = true; }\r\n if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n return null;\r\n }\r\n var indices = this.pickedMesh.getIndices();\r\n if (!indices) {\r\n return null;\r\n }\r\n var result;\r\n if (useVerticesNormals) {\r\n var normals = this.pickedMesh.getVerticesData(VertexBuffer.NormalKind);\r\n var normal0 = Vector3.FromArray(normals, indices[this.faceId * 3] * 3);\r\n var normal1 = Vector3.FromArray(normals, indices[this.faceId * 3 + 1] * 3);\r\n var normal2 = Vector3.FromArray(normals, indices[this.faceId * 3 + 2] * 3);\r\n normal0 = normal0.scale(this.bu);\r\n normal1 = normal1.scale(this.bv);\r\n normal2 = normal2.scale(1.0 - this.bu - this.bv);\r\n result = new Vector3(normal0.x + normal1.x + normal2.x, normal0.y + normal1.y + normal2.y, normal0.z + normal1.z + normal2.z);\r\n }\r\n else {\r\n var positions = this.pickedMesh.getVerticesData(VertexBuffer.PositionKind);\r\n var vertex1 = Vector3.FromArray(positions, indices[this.faceId * 3] * 3);\r\n var vertex2 = Vector3.FromArray(positions, indices[this.faceId * 3 + 1] * 3);\r\n var vertex3 = Vector3.FromArray(positions, indices[this.faceId * 3 + 2] * 3);\r\n var p1p2 = vertex1.subtract(vertex2);\r\n var p3p2 = vertex3.subtract(vertex2);\r\n result = Vector3.Cross(p1p2, p3p2);\r\n }\r\n if (useWorldCoordinates) {\r\n var wm = this.pickedMesh.getWorldMatrix();\r\n if (this.pickedMesh.nonUniformScaling) {\r\n TmpVectors.Matrix[0].copyFrom(wm);\r\n wm = TmpVectors.Matrix[0];\r\n wm.setTranslationFromFloats(0, 0, 0);\r\n wm.invert();\r\n wm.transposeToRef(TmpVectors.Matrix[1]);\r\n wm = TmpVectors.Matrix[1];\r\n }\r\n result = Vector3.TransformNormal(result, wm);\r\n }\r\n result.normalize();\r\n return result;\r\n };\r\n /**\r\n * Gets the texture coordinates of where the pick occured\r\n * @returns the vector containing the coordnates of the texture\r\n */\r\n PickingInfo.prototype.getTextureCoordinates = function () {\r\n if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n return null;\r\n }\r\n var indices = this.pickedMesh.getIndices();\r\n if (!indices) {\r\n return null;\r\n }\r\n var uvs = this.pickedMesh.getVerticesData(VertexBuffer.UVKind);\r\n if (!uvs) {\r\n return null;\r\n }\r\n var uv0 = Vector2.FromArray(uvs, indices[this.faceId * 3] * 2);\r\n var uv1 = Vector2.FromArray(uvs, indices[this.faceId * 3 + 1] * 2);\r\n var uv2 = Vector2.FromArray(uvs, indices[this.faceId * 3 + 2] * 2);\r\n uv0 = uv0.scale(this.bu);\r\n uv1 = uv1.scale(this.bv);\r\n uv2 = uv2.scale(1.0 - this.bu - this.bv);\r\n return new Vector2(uv0.x + uv1.x + uv2.x, uv0.y + uv1.y + uv2.y);\r\n };\r\n return PickingInfo;\r\n}());\r\nexport { PickingInfo };\r\n//# sourceMappingURL=pickingInfo.js.map","import { ArrayTools } from \"../Misc/arrayTools\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Epsilon } from '../Maths/math.constants';\r\n/**\r\n * Class used to store bounding box information\r\n */\r\nvar BoundingBox = /** @class */ (function () {\r\n /**\r\n * Creates a new bounding box\r\n * @param min defines the minimum vector (in local space)\r\n * @param max defines the maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n function BoundingBox(min, max, worldMatrix) {\r\n /**\r\n * Gets the 8 vectors representing the bounding box in local space\r\n */\r\n this.vectors = ArrayTools.BuildArray(8, Vector3.Zero);\r\n /**\r\n * Gets the center of the bounding box in local space\r\n */\r\n this.center = Vector3.Zero();\r\n /**\r\n * Gets the center of the bounding box in world space\r\n */\r\n this.centerWorld = Vector3.Zero();\r\n /**\r\n * Gets the extend size in local space\r\n */\r\n this.extendSize = Vector3.Zero();\r\n /**\r\n * Gets the extend size in world space\r\n */\r\n this.extendSizeWorld = Vector3.Zero();\r\n /**\r\n * Gets the OBB (object bounding box) directions\r\n */\r\n this.directions = ArrayTools.BuildArray(3, Vector3.Zero);\r\n /**\r\n * Gets the 8 vectors representing the bounding box in world space\r\n */\r\n this.vectorsWorld = ArrayTools.BuildArray(8, Vector3.Zero);\r\n /**\r\n * Gets the minimum vector in world space\r\n */\r\n this.minimumWorld = Vector3.Zero();\r\n /**\r\n * Gets the maximum vector in world space\r\n */\r\n this.maximumWorld = Vector3.Zero();\r\n /**\r\n * Gets the minimum vector in local space\r\n */\r\n this.minimum = Vector3.Zero();\r\n /**\r\n * Gets the maximum vector in local space\r\n */\r\n this.maximum = Vector3.Zero();\r\n this.reConstruct(min, max, worldMatrix);\r\n }\r\n // Methods\r\n /**\r\n * Recreates the entire bounding box from scratch as if we call the constructor in place\r\n * @param min defines the new minimum vector (in local space)\r\n * @param max defines the new maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n BoundingBox.prototype.reConstruct = function (min, max, worldMatrix) {\r\n var minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\r\n var vectors = this.vectors;\r\n this.minimum.copyFromFloats(minX, minY, minZ);\r\n this.maximum.copyFromFloats(maxX, maxY, maxZ);\r\n vectors[0].copyFromFloats(minX, minY, minZ);\r\n vectors[1].copyFromFloats(maxX, maxY, maxZ);\r\n vectors[2].copyFromFloats(maxX, minY, minZ);\r\n vectors[3].copyFromFloats(minX, maxY, minZ);\r\n vectors[4].copyFromFloats(minX, minY, maxZ);\r\n vectors[5].copyFromFloats(maxX, maxY, minZ);\r\n vectors[6].copyFromFloats(minX, maxY, maxZ);\r\n vectors[7].copyFromFloats(maxX, minY, maxZ);\r\n // OBB\r\n max.addToRef(min, this.center).scaleInPlace(0.5);\r\n max.subtractToRef(min, this.extendSize).scaleInPlace(0.5);\r\n this._worldMatrix = worldMatrix || Matrix.IdentityReadOnly;\r\n this._update(this._worldMatrix);\r\n };\r\n /**\r\n * Scale the current bounding box by applying a scale factor\r\n * @param factor defines the scale factor to apply\r\n * @returns the current bounding box\r\n */\r\n BoundingBox.prototype.scale = function (factor) {\r\n var tmpVectors = BoundingBox.TmpVector3;\r\n var diff = this.maximum.subtractToRef(this.minimum, tmpVectors[0]);\r\n var len = diff.length();\r\n diff.normalizeFromLength(len);\r\n var distance = len * factor;\r\n var newRadius = diff.scaleInPlace(distance * 0.5);\r\n var min = this.center.subtractToRef(newRadius, tmpVectors[1]);\r\n var max = this.center.addToRef(newRadius, tmpVectors[2]);\r\n this.reConstruct(min, max, this._worldMatrix);\r\n return this;\r\n };\r\n /**\r\n * Gets the world matrix of the bounding box\r\n * @returns a matrix\r\n */\r\n BoundingBox.prototype.getWorldMatrix = function () {\r\n return this._worldMatrix;\r\n };\r\n /** @hidden */\r\n BoundingBox.prototype._update = function (world) {\r\n var minWorld = this.minimumWorld;\r\n var maxWorld = this.maximumWorld;\r\n var directions = this.directions;\r\n var vectorsWorld = this.vectorsWorld;\r\n var vectors = this.vectors;\r\n if (!world.isIdentity()) {\r\n minWorld.setAll(Number.MAX_VALUE);\r\n maxWorld.setAll(-Number.MAX_VALUE);\r\n for (var index = 0; index < 8; ++index) {\r\n var v = vectorsWorld[index];\r\n Vector3.TransformCoordinatesToRef(vectors[index], world, v);\r\n minWorld.minimizeInPlace(v);\r\n maxWorld.maximizeInPlace(v);\r\n }\r\n // Extend\r\n maxWorld.subtractToRef(minWorld, this.extendSizeWorld).scaleInPlace(0.5);\r\n maxWorld.addToRef(minWorld, this.centerWorld).scaleInPlace(0.5);\r\n }\r\n else {\r\n minWorld.copyFrom(this.minimum);\r\n maxWorld.copyFrom(this.maximum);\r\n for (var index = 0; index < 8; ++index) {\r\n vectorsWorld[index].copyFrom(vectors[index]);\r\n }\r\n // Extend\r\n this.extendSizeWorld.copyFrom(this.extendSize);\r\n this.centerWorld.copyFrom(this.center);\r\n }\r\n Vector3.FromArrayToRef(world.m, 0, directions[0]);\r\n Vector3.FromArrayToRef(world.m, 4, directions[1]);\r\n Vector3.FromArrayToRef(world.m, 8, directions[2]);\r\n this._worldMatrix = world;\r\n };\r\n /**\r\n * Tests if the bounding box is intersecting the frustum planes\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.prototype.isInFrustum = function (frustumPlanes) {\r\n return BoundingBox.IsInFrustum(this.vectorsWorld, frustumPlanes);\r\n };\r\n /**\r\n * Tests if the bounding box is entirely inside the frustum planes\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if there is an inclusion\r\n */\r\n BoundingBox.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n return BoundingBox.IsCompletelyInFrustum(this.vectorsWorld, frustumPlanes);\r\n };\r\n /**\r\n * Tests if a point is inside the bounding box\r\n * @param point defines the point to test\r\n * @returns true if the point is inside the bounding box\r\n */\r\n BoundingBox.prototype.intersectsPoint = function (point) {\r\n var min = this.minimumWorld;\r\n var max = this.maximumWorld;\r\n var minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\r\n var pointX = point.x, pointY = point.y, pointZ = point.z;\r\n var delta = -Epsilon;\r\n if (maxX - pointX < delta || delta > pointX - minX) {\r\n return false;\r\n }\r\n if (maxY - pointY < delta || delta > pointY - minY) {\r\n return false;\r\n }\r\n if (maxZ - pointZ < delta || delta > pointZ - minZ) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if the bounding box intersects with a bounding sphere\r\n * @param sphere defines the sphere to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.prototype.intersectsSphere = function (sphere) {\r\n return BoundingBox.IntersectsSphere(this.minimumWorld, this.maximumWorld, sphere.centerWorld, sphere.radiusWorld);\r\n };\r\n /**\r\n * Tests if the bounding box intersects with a box defined by a min and max vectors\r\n * @param min defines the min vector to use\r\n * @param max defines the max vector to use\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.prototype.intersectsMinMax = function (min, max) {\r\n var myMin = this.minimumWorld;\r\n var myMax = this.maximumWorld;\r\n var myMinX = myMin.x, myMinY = myMin.y, myMinZ = myMin.z, myMaxX = myMax.x, myMaxY = myMax.y, myMaxZ = myMax.z;\r\n var minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\r\n if (myMaxX < minX || myMinX > maxX) {\r\n return false;\r\n }\r\n if (myMaxY < minY || myMinY > maxY) {\r\n return false;\r\n }\r\n if (myMaxZ < minZ || myMinZ > maxZ) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n // Statics\r\n /**\r\n * Tests if two bounding boxes are intersections\r\n * @param box0 defines the first box to test\r\n * @param box1 defines the second box to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.Intersects = function (box0, box1) {\r\n return box0.intersectsMinMax(box1.minimumWorld, box1.maximumWorld);\r\n };\r\n /**\r\n * Tests if a bounding box defines by a min/max vectors intersects a sphere\r\n * @param minPoint defines the minimum vector of the bounding box\r\n * @param maxPoint defines the maximum vector of the bounding box\r\n * @param sphereCenter defines the sphere center\r\n * @param sphereRadius defines the sphere radius\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.IntersectsSphere = function (minPoint, maxPoint, sphereCenter, sphereRadius) {\r\n var vector = BoundingBox.TmpVector3[0];\r\n Vector3.ClampToRef(sphereCenter, minPoint, maxPoint, vector);\r\n var num = Vector3.DistanceSquared(sphereCenter, vector);\r\n return (num <= (sphereRadius * sphereRadius));\r\n };\r\n /**\r\n * Tests if a bounding box defined with 8 vectors is entirely inside frustum planes\r\n * @param boundingVectors defines an array of 8 vectors representing a bounding box\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @return true if there is an inclusion\r\n */\r\n BoundingBox.IsCompletelyInFrustum = function (boundingVectors, frustumPlanes) {\r\n for (var p = 0; p < 6; ++p) {\r\n var frustumPlane = frustumPlanes[p];\r\n for (var i = 0; i < 8; ++i) {\r\n if (frustumPlane.dotCoordinate(boundingVectors[i]) < 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if a bounding box defined with 8 vectors intersects frustum planes\r\n * @param boundingVectors defines an array of 8 vectors representing a bounding box\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @return true if there is an intersection\r\n */\r\n BoundingBox.IsInFrustum = function (boundingVectors, frustumPlanes) {\r\n for (var p = 0; p < 6; ++p) {\r\n var canReturnFalse = true;\r\n var frustumPlane = frustumPlanes[p];\r\n for (var i = 0; i < 8; ++i) {\r\n if (frustumPlane.dotCoordinate(boundingVectors[i]) >= 0) {\r\n canReturnFalse = false;\r\n break;\r\n }\r\n }\r\n if (canReturnFalse) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n BoundingBox.TmpVector3 = ArrayTools.BuildArray(3, Vector3.Zero);\r\n return BoundingBox;\r\n}());\r\nexport { BoundingBox };\r\n//# sourceMappingURL=boundingBox.js.map","import { ArrayTools } from \"../Misc/arrayTools\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\n/**\r\n * Class used to store bounding sphere information\r\n */\r\nvar BoundingSphere = /** @class */ (function () {\r\n /**\r\n * Creates a new bounding sphere\r\n * @param min defines the minimum vector (in local space)\r\n * @param max defines the maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n function BoundingSphere(min, max, worldMatrix) {\r\n /**\r\n * Gets the center of the bounding sphere in local space\r\n */\r\n this.center = Vector3.Zero();\r\n /**\r\n * Gets the center of the bounding sphere in world space\r\n */\r\n this.centerWorld = Vector3.Zero();\r\n /**\r\n * Gets the minimum vector in local space\r\n */\r\n this.minimum = Vector3.Zero();\r\n /**\r\n * Gets the maximum vector in local space\r\n */\r\n this.maximum = Vector3.Zero();\r\n this.reConstruct(min, max, worldMatrix);\r\n }\r\n /**\r\n * Recreates the entire bounding sphere from scratch as if we call the constructor in place\r\n * @param min defines the new minimum vector (in local space)\r\n * @param max defines the new maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n BoundingSphere.prototype.reConstruct = function (min, max, worldMatrix) {\r\n this.minimum.copyFrom(min);\r\n this.maximum.copyFrom(max);\r\n var distance = Vector3.Distance(min, max);\r\n max.addToRef(min, this.center).scaleInPlace(0.5);\r\n this.radius = distance * 0.5;\r\n this._update(worldMatrix || Matrix.IdentityReadOnly);\r\n };\r\n /**\r\n * Scale the current bounding sphere by applying a scale factor\r\n * @param factor defines the scale factor to apply\r\n * @returns the current bounding box\r\n */\r\n BoundingSphere.prototype.scale = function (factor) {\r\n var newRadius = this.radius * factor;\r\n var tmpVectors = BoundingSphere.TmpVector3;\r\n var tempRadiusVector = tmpVectors[0].setAll(newRadius);\r\n var min = this.center.subtractToRef(tempRadiusVector, tmpVectors[1]);\r\n var max = this.center.addToRef(tempRadiusVector, tmpVectors[2]);\r\n this.reConstruct(min, max, this._worldMatrix);\r\n return this;\r\n };\r\n /**\r\n * Gets the world matrix of the bounding box\r\n * @returns a matrix\r\n */\r\n BoundingSphere.prototype.getWorldMatrix = function () {\r\n return this._worldMatrix;\r\n };\r\n // Methods\r\n /** @hidden */\r\n BoundingSphere.prototype._update = function (worldMatrix) {\r\n if (!worldMatrix.isIdentity()) {\r\n Vector3.TransformCoordinatesToRef(this.center, worldMatrix, this.centerWorld);\r\n var tempVector = BoundingSphere.TmpVector3[0];\r\n Vector3.TransformNormalFromFloatsToRef(1.0, 1.0, 1.0, worldMatrix, tempVector);\r\n this.radiusWorld = Math.max(Math.abs(tempVector.x), Math.abs(tempVector.y), Math.abs(tempVector.z)) * this.radius;\r\n }\r\n else {\r\n this.centerWorld.copyFrom(this.center);\r\n this.radiusWorld = this.radius;\r\n }\r\n };\r\n /**\r\n * Tests if the bounding sphere is intersecting the frustum planes\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingSphere.prototype.isInFrustum = function (frustumPlanes) {\r\n var center = this.centerWorld;\r\n var radius = this.radiusWorld;\r\n for (var i = 0; i < 6; i++) {\r\n if (frustumPlanes[i].dotCoordinate(center) <= -radius) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if the bounding sphere center is in between the frustum planes.\r\n * Used for optimistic fast inclusion.\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if the sphere center is in between the frustum planes\r\n */\r\n BoundingSphere.prototype.isCenterInFrustum = function (frustumPlanes) {\r\n var center = this.centerWorld;\r\n for (var i = 0; i < 6; i++) {\r\n if (frustumPlanes[i].dotCoordinate(center) < 0) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if a point is inside the bounding sphere\r\n * @param point defines the point to test\r\n * @returns true if the point is inside the bounding sphere\r\n */\r\n BoundingSphere.prototype.intersectsPoint = function (point) {\r\n var squareDistance = Vector3.DistanceSquared(this.centerWorld, point);\r\n if (this.radiusWorld * this.radiusWorld < squareDistance) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n // Statics\r\n /**\r\n * Checks if two sphere intersct\r\n * @param sphere0 sphere 0\r\n * @param sphere1 sphere 1\r\n * @returns true if the speres intersect\r\n */\r\n BoundingSphere.Intersects = function (sphere0, sphere1) {\r\n var squareDistance = Vector3.DistanceSquared(sphere0.centerWorld, sphere1.centerWorld);\r\n var radiusSum = sphere0.radiusWorld + sphere1.radiusWorld;\r\n if (radiusSum * radiusSum < squareDistance) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n BoundingSphere.TmpVector3 = ArrayTools.BuildArray(3, Vector3.Zero);\r\n return BoundingSphere;\r\n}());\r\nexport { BoundingSphere };\r\n//# sourceMappingURL=boundingSphere.js.map","import { ArrayTools } from \"../Misc/arrayTools\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { BoundingBox } from \"./boundingBox\";\r\nimport { BoundingSphere } from \"./boundingSphere\";\r\nvar _result0 = { min: 0, max: 0 };\r\nvar _result1 = { min: 0, max: 0 };\r\nvar computeBoxExtents = function (axis, box, result) {\r\n var p = Vector3.Dot(box.centerWorld, axis);\r\n var r0 = Math.abs(Vector3.Dot(box.directions[0], axis)) * box.extendSize.x;\r\n var r1 = Math.abs(Vector3.Dot(box.directions[1], axis)) * box.extendSize.y;\r\n var r2 = Math.abs(Vector3.Dot(box.directions[2], axis)) * box.extendSize.z;\r\n var r = r0 + r1 + r2;\r\n result.min = p - r;\r\n result.max = p + r;\r\n};\r\nvar axisOverlap = function (axis, box0, box1) {\r\n computeBoxExtents(axis, box0, _result0);\r\n computeBoxExtents(axis, box1, _result1);\r\n return !(_result0.min > _result1.max || _result1.min > _result0.max);\r\n};\r\n/**\r\n * Info for a bounding data of a mesh\r\n */\r\nvar BoundingInfo = /** @class */ (function () {\r\n /**\r\n * Constructs bounding info\r\n * @param minimum min vector of the bounding box/sphere\r\n * @param maximum max vector of the bounding box/sphere\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n function BoundingInfo(minimum, maximum, worldMatrix) {\r\n this._isLocked = false;\r\n this.boundingBox = new BoundingBox(minimum, maximum, worldMatrix);\r\n this.boundingSphere = new BoundingSphere(minimum, maximum, worldMatrix);\r\n }\r\n /**\r\n * Recreates the entire bounding info from scratch as if we call the constructor in place\r\n * @param min defines the new minimum vector (in local space)\r\n * @param max defines the new maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n BoundingInfo.prototype.reConstruct = function (min, max, worldMatrix) {\r\n this.boundingBox.reConstruct(min, max, worldMatrix);\r\n this.boundingSphere.reConstruct(min, max, worldMatrix);\r\n };\r\n Object.defineProperty(BoundingInfo.prototype, \"minimum\", {\r\n /**\r\n * min vector of the bounding box/sphere\r\n */\r\n get: function () {\r\n return this.boundingBox.minimum;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BoundingInfo.prototype, \"maximum\", {\r\n /**\r\n * max vector of the bounding box/sphere\r\n */\r\n get: function () {\r\n return this.boundingBox.maximum;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BoundingInfo.prototype, \"isLocked\", {\r\n /**\r\n * If the info is locked and won't be updated to avoid perf overhead\r\n */\r\n get: function () {\r\n return this._isLocked;\r\n },\r\n set: function (value) {\r\n this._isLocked = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Updates the bounding sphere and box\r\n * @param world world matrix to be used to update\r\n */\r\n BoundingInfo.prototype.update = function (world) {\r\n if (this._isLocked) {\r\n return;\r\n }\r\n this.boundingBox._update(world);\r\n this.boundingSphere._update(world);\r\n };\r\n /**\r\n * Recreate the bounding info to be centered around a specific point given a specific extend.\r\n * @param center New center of the bounding info\r\n * @param extend New extend of the bounding info\r\n * @returns the current bounding info\r\n */\r\n BoundingInfo.prototype.centerOn = function (center, extend) {\r\n var minimum = BoundingInfo.TmpVector3[0].copyFrom(center).subtractInPlace(extend);\r\n var maximum = BoundingInfo.TmpVector3[1].copyFrom(center).addInPlace(extend);\r\n this.boundingBox.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());\r\n this.boundingSphere.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());\r\n return this;\r\n };\r\n /**\r\n * Scale the current bounding info by applying a scale factor\r\n * @param factor defines the scale factor to apply\r\n * @returns the current bounding info\r\n */\r\n BoundingInfo.prototype.scale = function (factor) {\r\n this.boundingBox.scale(factor);\r\n this.boundingSphere.scale(factor);\r\n return this;\r\n };\r\n /**\r\n * Returns `true` if the bounding info is within the frustum defined by the passed array of planes.\r\n * @param frustumPlanes defines the frustum to test\r\n * @param strategy defines the strategy to use for the culling (default is BABYLON.AbstractMesh.CULLINGSTRATEGY_STANDARD)\r\n * @returns true if the bounding info is in the frustum planes\r\n */\r\n BoundingInfo.prototype.isInFrustum = function (frustumPlanes, strategy) {\r\n if (strategy === void 0) { strategy = 0; }\r\n var inclusionTest = (strategy === 2 || strategy === 3);\r\n if (inclusionTest) {\r\n if (this.boundingSphere.isCenterInFrustum(frustumPlanes)) {\r\n return true;\r\n }\r\n }\r\n if (!this.boundingSphere.isInFrustum(frustumPlanes)) {\r\n return false;\r\n }\r\n var bSphereOnlyTest = (strategy === 1 || strategy === 3);\r\n if (bSphereOnlyTest) {\r\n return true;\r\n }\r\n return this.boundingBox.isInFrustum(frustumPlanes);\r\n };\r\n Object.defineProperty(BoundingInfo.prototype, \"diagonalLength\", {\r\n /**\r\n * Gets the world distance between the min and max points of the bounding box\r\n */\r\n get: function () {\r\n var boundingBox = this.boundingBox;\r\n var diag = boundingBox.maximumWorld.subtractToRef(boundingBox.minimumWorld, BoundingInfo.TmpVector3[0]);\r\n return diag.length();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Checks if a cullable object (mesh...) is in the camera frustum\r\n * Unlike isInFrustum this cheks the full bounding box\r\n * @param frustumPlanes Camera near/planes\r\n * @returns true if the object is in frustum otherwise false\r\n */\r\n BoundingInfo.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n return this.boundingBox.isCompletelyInFrustum(frustumPlanes);\r\n };\r\n /** @hidden */\r\n BoundingInfo.prototype._checkCollision = function (collider) {\r\n return collider._canDoCollision(this.boundingSphere.centerWorld, this.boundingSphere.radiusWorld, this.boundingBox.minimumWorld, this.boundingBox.maximumWorld);\r\n };\r\n /**\r\n * Checks if a point is inside the bounding box and bounding sphere or the mesh\r\n * @see https://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh\r\n * @param point the point to check intersection with\r\n * @returns if the point intersects\r\n */\r\n BoundingInfo.prototype.intersectsPoint = function (point) {\r\n if (!this.boundingSphere.centerWorld) {\r\n return false;\r\n }\r\n if (!this.boundingSphere.intersectsPoint(point)) {\r\n return false;\r\n }\r\n if (!this.boundingBox.intersectsPoint(point)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks if another bounding info intersects the bounding box and bounding sphere or the mesh\r\n * @see https://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh\r\n * @param boundingInfo the bounding info to check intersection with\r\n * @param precise if the intersection should be done using OBB\r\n * @returns if the bounding info intersects\r\n */\r\n BoundingInfo.prototype.intersects = function (boundingInfo, precise) {\r\n if (!BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {\r\n return false;\r\n }\r\n if (!BoundingBox.Intersects(this.boundingBox, boundingInfo.boundingBox)) {\r\n return false;\r\n }\r\n if (!precise) {\r\n return true;\r\n }\r\n var box0 = this.boundingBox;\r\n var box1 = boundingInfo.boundingBox;\r\n if (!axisOverlap(box0.directions[0], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box0.directions[1], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box0.directions[2], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box1.directions[0], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box1.directions[1], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box1.directions[2], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[0]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[1]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[2]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[0]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[1]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[2]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[0]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[1]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[2]), box0, box1)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n BoundingInfo.TmpVector3 = ArrayTools.BuildArray(2, Vector3.Zero);\r\n return BoundingInfo;\r\n}());\r\nexport { BoundingInfo };\r\n//# sourceMappingURL=boundingInfo.js.map","import { ThinEngine } from \"../../Engines/thinEngine\";\r\nThinEngine.prototype._readTexturePixels = function (texture, width, height, faceIndex, level, buffer) {\r\n if (faceIndex === void 0) { faceIndex = -1; }\r\n if (level === void 0) { level = 0; }\r\n if (buffer === void 0) { buffer = null; }\r\n var gl = this._gl;\r\n if (!gl) {\r\n throw new Error(\"Engine does not have gl rendering context.\");\r\n }\r\n if (!this._dummyFramebuffer) {\r\n var dummy = gl.createFramebuffer();\r\n if (!dummy) {\r\n throw new Error(\"Unable to create dummy framebuffer\");\r\n }\r\n this._dummyFramebuffer = dummy;\r\n }\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, this._dummyFramebuffer);\r\n if (faceIndex > -1) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._webGLTexture, level);\r\n }\r\n else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, level);\r\n }\r\n var readType = (texture.type !== undefined) ? this._getWebGLTextureType(texture.type) : gl.UNSIGNED_BYTE;\r\n switch (readType) {\r\n case gl.UNSIGNED_BYTE:\r\n if (!buffer) {\r\n buffer = new Uint8Array(4 * width * height);\r\n }\r\n readType = gl.UNSIGNED_BYTE;\r\n break;\r\n default:\r\n if (!buffer) {\r\n buffer = new Float32Array(4 * width * height);\r\n }\r\n readType = gl.FLOAT;\r\n break;\r\n }\r\n gl.readPixels(0, 0, width, height, gl.RGBA, readType, buffer);\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, this._currentFramebuffer);\r\n return buffer;\r\n};\r\n//# sourceMappingURL=engine.readTexture.js.map","import { __assign } from \"tslib\";\r\nimport { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';\r\nimport { Logger } from '../../Misc/logger';\r\nimport { RenderTargetCreationOptions } from '../../Materials/Textures/renderTargetCreationOptions';\r\nimport { ThinEngine } from '../thinEngine';\r\nThinEngine.prototype.createRenderTargetTexture = function (size, options) {\r\n var fullOptions = new RenderTargetCreationOptions();\r\n if (options !== undefined && typeof options === \"object\") {\r\n fullOptions.generateMipMaps = options.generateMipMaps;\r\n fullOptions.generateDepthBuffer = !!options.generateDepthBuffer;\r\n fullOptions.generateStencilBuffer = !!options.generateStencilBuffer;\r\n fullOptions.type = options.type === undefined ? 0 : options.type;\r\n fullOptions.samplingMode = options.samplingMode === undefined ? 3 : options.samplingMode;\r\n fullOptions.format = options.format === undefined ? 5 : options.format;\r\n }\r\n else {\r\n fullOptions.generateMipMaps = options;\r\n fullOptions.generateDepthBuffer = true;\r\n fullOptions.generateStencilBuffer = false;\r\n fullOptions.type = 0;\r\n fullOptions.samplingMode = 3;\r\n fullOptions.format = 5;\r\n }\r\n if (fullOptions.type === 1 && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = 1;\r\n }\r\n else if (fullOptions.type === 2 && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = 1;\r\n }\r\n if (fullOptions.type === 1 && !this._caps.textureFloat) {\r\n fullOptions.type = 0;\r\n Logger.Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\r\n }\r\n var gl = this._gl;\r\n var texture = new InternalTexture(this, InternalTextureSource.RenderTarget);\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n var layers = size.layers || 0;\r\n var filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps ? true : false);\r\n var target = layers !== 0 ? gl.TEXTURE_2D_ARRAY : gl.TEXTURE_2D;\r\n var sizedFormat = this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format);\r\n var internalFormat = this._getInternalFormat(fullOptions.format);\r\n var type = this._getWebGLTextureType(fullOptions.type);\r\n // Bind\r\n this._bindTextureDirectly(target, texture);\r\n if (layers !== 0) {\r\n texture.is2DArray = true;\r\n gl.texImage3D(target, 0, sizedFormat, width, height, layers, 0, internalFormat, type, null);\r\n }\r\n else {\r\n gl.texImage2D(target, 0, sizedFormat, width, height, 0, internalFormat, type, null);\r\n }\r\n gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n // MipMaps\r\n if (fullOptions.generateMipMaps) {\r\n this._gl.generateMipmap(target);\r\n }\r\n this._bindTextureDirectly(target, null);\r\n var currentFrameBuffer = this._currentFramebuffer;\r\n // Create the framebuffer\r\n var framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer ? true : false, fullOptions.generateDepthBuffer, width, height);\r\n // No need to rebind on every frame\r\n if (!texture.is2DArray) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, 0);\r\n }\r\n this._bindUnboundFramebuffer(currentFrameBuffer);\r\n texture._framebuffer = framebuffer;\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.depth = layers;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = fullOptions.generateMipMaps ? true : false;\r\n texture.samplingMode = fullOptions.samplingMode;\r\n texture.type = fullOptions.type;\r\n texture.format = fullOptions.format;\r\n texture._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n texture._generateStencilBuffer = fullOptions.generateStencilBuffer ? true : false;\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\nThinEngine.prototype.createDepthStencilTexture = function (size, options) {\r\n if (options.isCube) {\r\n var width = size.width || size;\r\n return this._createDepthStencilCubeTexture(width, options);\r\n }\r\n else {\r\n return this._createDepthStencilTexture(size, options);\r\n }\r\n};\r\nThinEngine.prototype._createDepthStencilTexture = function (size, options) {\r\n var gl = this._gl;\r\n var layers = size.layers || 0;\r\n var target = layers !== 0 ? gl.TEXTURE_2D_ARRAY : gl.TEXTURE_2D;\r\n var internalTexture = new InternalTexture(this, InternalTextureSource.Depth);\r\n if (!this._caps.depthTextureExtension) {\r\n Logger.Error(\"Depth texture is not supported by your browser or hardware.\");\r\n return internalTexture;\r\n }\r\n var internalOptions = __assign({ bilinearFiltering: false, comparisonFunction: 0, generateStencil: false }, options);\r\n this._bindTextureDirectly(target, internalTexture, true);\r\n this._setupDepthStencilTexture(internalTexture, size, internalOptions.generateStencil, internalOptions.bilinearFiltering, internalOptions.comparisonFunction);\r\n var type = internalOptions.generateStencil ? gl.UNSIGNED_INT_24_8 : gl.UNSIGNED_INT;\r\n var internalFormat = internalOptions.generateStencil ? gl.DEPTH_STENCIL : gl.DEPTH_COMPONENT;\r\n var sizedFormat = internalFormat;\r\n if (this.webGLVersion > 1) {\r\n sizedFormat = internalOptions.generateStencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;\r\n }\r\n if (internalTexture.is2DArray) {\r\n gl.texImage3D(target, 0, sizedFormat, internalTexture.width, internalTexture.height, layers, 0, internalFormat, type, null);\r\n }\r\n else {\r\n gl.texImage2D(target, 0, sizedFormat, internalTexture.width, internalTexture.height, 0, internalFormat, type, null);\r\n }\r\n this._bindTextureDirectly(target, null);\r\n return internalTexture;\r\n};\r\n//# sourceMappingURL=engine.renderTarget.js.map","import { __assign } from \"tslib\";\r\nimport { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';\r\nimport { Logger } from '../../Misc/logger';\r\nimport { ThinEngine } from '../thinEngine';\r\nThinEngine.prototype.createRenderTargetCubeTexture = function (size, options) {\r\n var fullOptions = __assign({ generateMipMaps: true, generateDepthBuffer: true, generateStencilBuffer: false, type: 0, samplingMode: 3, format: 5 }, options);\r\n fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && fullOptions.generateStencilBuffer;\r\n if (fullOptions.type === 1 && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = 1;\r\n }\r\n else if (fullOptions.type === 2 && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = 1;\r\n }\r\n var gl = this._gl;\r\n var texture = new InternalTexture(this, InternalTextureSource.RenderTarget);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n var filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps);\r\n if (fullOptions.type === 1 && !this._caps.textureFloat) {\r\n fullOptions.type = 0;\r\n Logger.Warn(\"Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type\");\r\n }\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n for (var face = 0; face < 6; face++) {\r\n gl.texImage2D((gl.TEXTURE_CUBE_MAP_POSITIVE_X + face), 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), size, size, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);\r\n }\r\n // Create the framebuffer\r\n var framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer, fullOptions.generateDepthBuffer, size, size);\r\n // MipMaps\r\n if (fullOptions.generateMipMaps) {\r\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\r\n }\r\n // Unbind\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n this._bindUnboundFramebuffer(null);\r\n texture._framebuffer = framebuffer;\r\n texture.width = size;\r\n texture.height = size;\r\n texture.isReady = true;\r\n texture.isCube = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = fullOptions.generateMipMaps;\r\n texture.samplingMode = fullOptions.samplingMode;\r\n texture.type = fullOptions.type;\r\n texture.format = fullOptions.format;\r\n texture._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n texture._generateStencilBuffer = fullOptions.generateStencilBuffer;\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\n//# sourceMappingURL=engine.renderTargetCube.js.map","import { StringTools } from '../../Misc/stringTools';\r\n/** @hidden */\r\nvar ShaderCodeNode = /** @class */ (function () {\r\n function ShaderCodeNode() {\r\n this.children = [];\r\n }\r\n ShaderCodeNode.prototype.isValid = function (preprocessors) {\r\n return true;\r\n };\r\n ShaderCodeNode.prototype.process = function (preprocessors, options) {\r\n var result = \"\";\r\n if (this.line) {\r\n var value = this.line;\r\n var processor = options.processor;\r\n if (processor) {\r\n // This must be done before other replacements to avoid mistakenly changing something that was already changed.\r\n if (processor.lineProcessor) {\r\n value = processor.lineProcessor(value, options.isFragment);\r\n }\r\n if (processor.attributeProcessor && StringTools.StartsWith(this.line, \"attribute\")) {\r\n value = processor.attributeProcessor(this.line);\r\n }\r\n else if (processor.varyingProcessor && StringTools.StartsWith(this.line, \"varying\")) {\r\n value = processor.varyingProcessor(this.line, options.isFragment);\r\n }\r\n else if ((processor.uniformProcessor || processor.uniformBufferProcessor) && StringTools.StartsWith(this.line, \"uniform\")) {\r\n var regex = /uniform (.+) (.+)/;\r\n if (regex.test(this.line)) { // uniform\r\n if (processor.uniformProcessor) {\r\n value = processor.uniformProcessor(this.line, options.isFragment);\r\n }\r\n }\r\n else { // Uniform buffer\r\n if (processor.uniformBufferProcessor) {\r\n value = processor.uniformBufferProcessor(this.line, options.isFragment);\r\n options.lookForClosingBracketForUniformBuffer = true;\r\n }\r\n }\r\n }\r\n if (processor.endOfUniformBufferProcessor) {\r\n if (options.lookForClosingBracketForUniformBuffer && this.line.indexOf(\"}\") !== -1) {\r\n options.lookForClosingBracketForUniformBuffer = false;\r\n value = processor.endOfUniformBufferProcessor(this.line, options.isFragment);\r\n }\r\n }\r\n }\r\n result += value + \"\\r\\n\";\r\n }\r\n this.children.forEach(function (child) {\r\n result += child.process(preprocessors, options);\r\n });\r\n if (this.additionalDefineKey) {\r\n preprocessors[this.additionalDefineKey] = this.additionalDefineValue || \"true\";\r\n }\r\n return result;\r\n };\r\n return ShaderCodeNode;\r\n}());\r\nexport { ShaderCodeNode };\r\n//# sourceMappingURL=shaderCodeNode.js.map","/** @hidden */\r\nvar ShaderCodeCursor = /** @class */ (function () {\r\n function ShaderCodeCursor() {\r\n }\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"currentLine\", {\r\n get: function () {\r\n return this._lines[this.lineIndex];\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"canRead\", {\r\n get: function () {\r\n return this.lineIndex < this._lines.length - 1;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"lines\", {\r\n set: function (value) {\r\n this._lines = [];\r\n for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {\r\n var line = value_1[_i];\r\n // Prevent removing line break in macros.\r\n if (line[0] === \"#\") {\r\n this._lines.push(line);\r\n continue;\r\n }\r\n var split = line.split(\";\");\r\n for (var index = 0; index < split.length; index++) {\r\n var subLine = split[index];\r\n subLine = subLine.trim();\r\n if (!subLine) {\r\n continue;\r\n }\r\n this._lines.push(subLine + (index !== split.length - 1 ? \";\" : \"\"));\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return ShaderCodeCursor;\r\n}());\r\nexport { ShaderCodeCursor };\r\n//# sourceMappingURL=shaderCodeCursor.js.map","import { __extends } from \"tslib\";\r\nimport { ShaderCodeNode } from './shaderCodeNode';\r\n/** @hidden */\r\nvar ShaderCodeConditionNode = /** @class */ (function (_super) {\r\n __extends(ShaderCodeConditionNode, _super);\r\n function ShaderCodeConditionNode() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderCodeConditionNode.prototype.process = function (preprocessors, options) {\r\n for (var index = 0; index < this.children.length; index++) {\r\n var node = this.children[index];\r\n if (node.isValid(preprocessors)) {\r\n return node.process(preprocessors, options);\r\n }\r\n }\r\n return \"\";\r\n };\r\n return ShaderCodeConditionNode;\r\n}(ShaderCodeNode));\r\nexport { ShaderCodeConditionNode };\r\n//# sourceMappingURL=shaderCodeConditionNode.js.map","import { __extends } from \"tslib\";\r\nimport { ShaderCodeNode } from './shaderCodeNode';\r\n/** @hidden */\r\nvar ShaderCodeTestNode = /** @class */ (function (_super) {\r\n __extends(ShaderCodeTestNode, _super);\r\n function ShaderCodeTestNode() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderCodeTestNode.prototype.isValid = function (preprocessors) {\r\n return this.testExpression.isTrue(preprocessors);\r\n };\r\n return ShaderCodeTestNode;\r\n}(ShaderCodeNode));\r\nexport { ShaderCodeTestNode };\r\n//# sourceMappingURL=shaderCodeTestNode.js.map","/** @hidden */\r\nvar ShaderDefineExpression = /** @class */ (function () {\r\n function ShaderDefineExpression() {\r\n }\r\n ShaderDefineExpression.prototype.isTrue = function (preprocessors) {\r\n return true;\r\n };\r\n ShaderDefineExpression.postfixToInfix = function (postfix) {\r\n var stack = [];\r\n for (var _i = 0, postfix_1 = postfix; _i < postfix_1.length; _i++) {\r\n var c = postfix_1[_i];\r\n if (ShaderDefineExpression._OperatorPriority[c] === undefined) {\r\n stack.push(c);\r\n }\r\n else {\r\n var v1 = stack[stack.length - 1], v2 = stack[stack.length - 2];\r\n stack.length -= 2;\r\n stack.push(\"(\" + v2 + c + v1 + \")\");\r\n }\r\n }\r\n return stack[stack.length - 1];\r\n };\r\n ShaderDefineExpression.infixToPostfix = function (infix) {\r\n var result = [];\r\n var stackIdx = -1;\r\n var pushOperand = function () {\r\n operand = operand.trim();\r\n if (operand !== '') {\r\n result.push(operand);\r\n operand = '';\r\n }\r\n };\r\n var push = function (s) {\r\n if (stackIdx < ShaderDefineExpression._Stack.length - 1) {\r\n ShaderDefineExpression._Stack[++stackIdx] = s;\r\n }\r\n };\r\n var peek = function () { return ShaderDefineExpression._Stack[stackIdx]; };\r\n var pop = function () { return stackIdx === -1 ? '!!INVALID EXPRESSION!!' : ShaderDefineExpression._Stack[stackIdx--]; };\r\n var idx = 0, operand = '';\r\n while (idx < infix.length) {\r\n var c = infix.charAt(idx), token = idx < infix.length - 1 ? infix.substr(idx, 2) : '';\r\n if (c === '(') {\r\n operand = '';\r\n push(c);\r\n }\r\n else if (c === ')') {\r\n pushOperand();\r\n while (stackIdx !== -1 && peek() !== '(') {\r\n result.push(pop());\r\n }\r\n pop();\r\n }\r\n else if (ShaderDefineExpression._OperatorPriority[token] > 1) {\r\n pushOperand();\r\n while (stackIdx !== -1 && ShaderDefineExpression._OperatorPriority[peek()] >= ShaderDefineExpression._OperatorPriority[token]) {\r\n result.push(pop());\r\n }\r\n push(token);\r\n idx++;\r\n }\r\n else {\r\n operand += c;\r\n }\r\n idx++;\r\n }\r\n pushOperand();\r\n while (stackIdx !== -1) {\r\n if (peek() === '(') {\r\n pop();\r\n }\r\n else {\r\n result.push(pop());\r\n }\r\n }\r\n return result;\r\n };\r\n ShaderDefineExpression._OperatorPriority = {\r\n \")\": 0,\r\n \"(\": 1,\r\n \"||\": 2,\r\n \"&&\": 3,\r\n };\r\n ShaderDefineExpression._Stack = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''];\r\n return ShaderDefineExpression;\r\n}());\r\nexport { ShaderDefineExpression };\r\n//# sourceMappingURL=shaderDefineExpression.js.map","import { __extends } from \"tslib\";\r\nimport { ShaderDefineExpression } from \"../shaderDefineExpression\";\r\n/** @hidden */\r\nvar ShaderDefineIsDefinedOperator = /** @class */ (function (_super) {\r\n __extends(ShaderDefineIsDefinedOperator, _super);\r\n function ShaderDefineIsDefinedOperator(define, not) {\r\n if (not === void 0) { not = false; }\r\n var _this = _super.call(this) || this;\r\n _this.define = define;\r\n _this.not = not;\r\n return _this;\r\n }\r\n ShaderDefineIsDefinedOperator.prototype.isTrue = function (preprocessors) {\r\n var condition = preprocessors[this.define] !== undefined;\r\n if (this.not) {\r\n condition = !condition;\r\n }\r\n return condition;\r\n };\r\n return ShaderDefineIsDefinedOperator;\r\n}(ShaderDefineExpression));\r\nexport { ShaderDefineIsDefinedOperator };\r\n//# sourceMappingURL=shaderDefineIsDefinedOperator.js.map","import { __extends } from \"tslib\";\r\nimport { ShaderDefineExpression } from '../shaderDefineExpression';\r\n/** @hidden */\r\nvar ShaderDefineOrOperator = /** @class */ (function (_super) {\r\n __extends(ShaderDefineOrOperator, _super);\r\n function ShaderDefineOrOperator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderDefineOrOperator.prototype.isTrue = function (preprocessors) {\r\n return this.leftOperand.isTrue(preprocessors) || this.rightOperand.isTrue(preprocessors);\r\n };\r\n return ShaderDefineOrOperator;\r\n}(ShaderDefineExpression));\r\nexport { ShaderDefineOrOperator };\r\n//# sourceMappingURL=shaderDefineOrOperator.js.map","import { __extends } from \"tslib\";\r\nimport { ShaderDefineExpression } from '../shaderDefineExpression';\r\n/** @hidden */\r\nvar ShaderDefineAndOperator = /** @class */ (function (_super) {\r\n __extends(ShaderDefineAndOperator, _super);\r\n function ShaderDefineAndOperator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderDefineAndOperator.prototype.isTrue = function (preprocessors) {\r\n return this.leftOperand.isTrue(preprocessors) && this.rightOperand.isTrue(preprocessors);\r\n };\r\n return ShaderDefineAndOperator;\r\n}(ShaderDefineExpression));\r\nexport { ShaderDefineAndOperator };\r\n//# sourceMappingURL=shaderDefineAndOperator.js.map","import { __extends } from \"tslib\";\r\nimport { ShaderDefineExpression } from '../shaderDefineExpression';\r\n/** @hidden */\r\nvar ShaderDefineArithmeticOperator = /** @class */ (function (_super) {\r\n __extends(ShaderDefineArithmeticOperator, _super);\r\n function ShaderDefineArithmeticOperator(define, operand, testValue) {\r\n var _this = _super.call(this) || this;\r\n _this.define = define;\r\n _this.operand = operand;\r\n _this.testValue = testValue;\r\n return _this;\r\n }\r\n ShaderDefineArithmeticOperator.prototype.isTrue = function (preprocessors) {\r\n var value = preprocessors[this.define];\r\n if (value === undefined) {\r\n value = this.define;\r\n }\r\n var condition = false;\r\n var left = parseInt(value);\r\n var right = parseInt(this.testValue);\r\n switch (this.operand) {\r\n case \">\":\r\n condition = left > right;\r\n break;\r\n case \"<\":\r\n condition = left < right;\r\n break;\r\n case \"<=\":\r\n condition = left <= right;\r\n break;\r\n case \">=\":\r\n condition = left >= right;\r\n break;\r\n case \"==\":\r\n condition = left === right;\r\n break;\r\n }\r\n return condition;\r\n };\r\n return ShaderDefineArithmeticOperator;\r\n}(ShaderDefineExpression));\r\nexport { ShaderDefineArithmeticOperator };\r\n//# sourceMappingURL=shaderDefineArithmeticOperator.js.map","import { ShaderCodeNode } from './shaderCodeNode';\r\nimport { ShaderCodeCursor } from './shaderCodeCursor';\r\nimport { ShaderCodeConditionNode } from './shaderCodeConditionNode';\r\nimport { ShaderCodeTestNode } from './shaderCodeTestNode';\r\nimport { ShaderDefineIsDefinedOperator } from './Expressions/Operators/shaderDefineIsDefinedOperator';\r\nimport { ShaderDefineOrOperator } from './Expressions/Operators/shaderDefineOrOperator';\r\nimport { ShaderDefineAndOperator } from './Expressions/Operators/shaderDefineAndOperator';\r\nimport { ShaderDefineExpression } from './Expressions/shaderDefineExpression';\r\nimport { ShaderDefineArithmeticOperator } from './Expressions/Operators/shaderDefineArithmeticOperator';\r\nimport { _DevTools } from '../../Misc/devTools';\r\nvar regexSE = /defined\\s*?\\((.+?)\\)/g;\r\nvar regexSERevert = /defined\\s*?\\[(.+?)\\]/g;\r\n/** @hidden */\r\nvar ShaderProcessor = /** @class */ (function () {\r\n function ShaderProcessor() {\r\n }\r\n ShaderProcessor.Process = function (sourceCode, options, callback, engine) {\r\n var _this = this;\r\n this._ProcessIncludes(sourceCode, options, function (codeWithIncludes) {\r\n var migratedCode = _this._ProcessShaderConversion(codeWithIncludes, options, engine);\r\n callback(migratedCode);\r\n });\r\n };\r\n ShaderProcessor._ProcessPrecision = function (source, options) {\r\n var shouldUseHighPrecisionShader = options.shouldUseHighPrecisionShader;\r\n if (source.indexOf(\"precision highp float\") === -1) {\r\n if (!shouldUseHighPrecisionShader) {\r\n source = \"precision mediump float;\\n\" + source;\r\n }\r\n else {\r\n source = \"precision highp float;\\n\" + source;\r\n }\r\n }\r\n else {\r\n if (!shouldUseHighPrecisionShader) { // Moving highp to mediump\r\n source = source.replace(\"precision highp float\", \"precision mediump float\");\r\n }\r\n }\r\n return source;\r\n };\r\n ShaderProcessor._ExtractOperation = function (expression) {\r\n var regex = /defined\\((.+)\\)/;\r\n var match = regex.exec(expression);\r\n if (match && match.length) {\r\n return new ShaderDefineIsDefinedOperator(match[1].trim(), expression[0] === \"!\");\r\n }\r\n var operators = [\"==\", \">=\", \"<=\", \"<\", \">\"];\r\n var operator = \"\";\r\n var indexOperator = 0;\r\n for (var _i = 0, operators_1 = operators; _i < operators_1.length; _i++) {\r\n operator = operators_1[_i];\r\n indexOperator = expression.indexOf(operator);\r\n if (indexOperator > -1) {\r\n break;\r\n }\r\n }\r\n if (indexOperator === -1) {\r\n return new ShaderDefineIsDefinedOperator(expression);\r\n }\r\n var define = expression.substring(0, indexOperator).trim();\r\n var value = expression.substring(indexOperator + operator.length).trim();\r\n return new ShaderDefineArithmeticOperator(define, operator, value);\r\n };\r\n ShaderProcessor._BuildSubExpression = function (expression) {\r\n expression = expression.replace(regexSE, \"defined[$1]\");\r\n var postfix = ShaderDefineExpression.infixToPostfix(expression);\r\n var stack = [];\r\n for (var _i = 0, postfix_1 = postfix; _i < postfix_1.length; _i++) {\r\n var c = postfix_1[_i];\r\n if (c !== '||' && c !== '&&') {\r\n stack.push(c);\r\n }\r\n else if (stack.length >= 2) {\r\n var v1 = stack[stack.length - 1], v2 = stack[stack.length - 2];\r\n stack.length -= 2;\r\n var operator = c == '&&' ? new ShaderDefineAndOperator() : new ShaderDefineOrOperator();\r\n if (typeof (v1) === 'string') {\r\n v1 = v1.replace(regexSERevert, \"defined($1)\");\r\n }\r\n if (typeof (v2) === 'string') {\r\n v2 = v2.replace(regexSERevert, \"defined($1)\");\r\n }\r\n operator.leftOperand = typeof (v2) === 'string' ? this._ExtractOperation(v2) : v2;\r\n operator.rightOperand = typeof (v1) === 'string' ? this._ExtractOperation(v1) : v1;\r\n stack.push(operator);\r\n }\r\n }\r\n var result = stack[stack.length - 1];\r\n if (typeof (result) === 'string') {\r\n result = result.replace(regexSERevert, \"defined($1)\");\r\n }\r\n // note: stack.length !== 1 if there was an error in the parsing\r\n return typeof (result) === 'string' ? this._ExtractOperation(result) : result;\r\n };\r\n ShaderProcessor._BuildExpression = function (line, start) {\r\n var node = new ShaderCodeTestNode();\r\n var command = line.substring(0, start);\r\n var expression = line.substring(start);\r\n expression = expression.substring(0, ((expression.indexOf(\"//\") + 1) || (expression.length + 1)) - 1).trim();\r\n if (command === \"#ifdef\") {\r\n node.testExpression = new ShaderDefineIsDefinedOperator(expression);\r\n }\r\n else if (command === \"#ifndef\") {\r\n node.testExpression = new ShaderDefineIsDefinedOperator(expression, true);\r\n }\r\n else {\r\n node.testExpression = this._BuildSubExpression(expression);\r\n }\r\n return node;\r\n };\r\n ShaderProcessor._MoveCursorWithinIf = function (cursor, rootNode, ifNode) {\r\n var line = cursor.currentLine;\r\n while (this._MoveCursor(cursor, ifNode)) {\r\n line = cursor.currentLine;\r\n var first5 = line.substring(0, 5).toLowerCase();\r\n if (first5 === \"#else\") {\r\n var elseNode = new ShaderCodeNode();\r\n rootNode.children.push(elseNode);\r\n this._MoveCursor(cursor, elseNode);\r\n return;\r\n }\r\n else if (first5 === \"#elif\") {\r\n var elifNode = this._BuildExpression(line, 5);\r\n rootNode.children.push(elifNode);\r\n ifNode = elifNode;\r\n }\r\n }\r\n };\r\n ShaderProcessor._MoveCursor = function (cursor, rootNode) {\r\n while (cursor.canRead) {\r\n cursor.lineIndex++;\r\n var line = cursor.currentLine;\r\n var keywords = /(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/;\r\n var matches = keywords.exec(line);\r\n if (matches && matches.length) {\r\n var keyword = matches[0];\r\n switch (keyword) {\r\n case \"#ifdef\": {\r\n var newRootNode = new ShaderCodeConditionNode();\r\n rootNode.children.push(newRootNode);\r\n var ifNode = this._BuildExpression(line, 6);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n case \"#else\":\r\n case \"#elif\":\r\n return true;\r\n case \"#endif\":\r\n return false;\r\n case \"#ifndef\": {\r\n var newRootNode = new ShaderCodeConditionNode();\r\n rootNode.children.push(newRootNode);\r\n var ifNode = this._BuildExpression(line, 7);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n case \"#if\": {\r\n var newRootNode = new ShaderCodeConditionNode();\r\n var ifNode = this._BuildExpression(line, 3);\r\n rootNode.children.push(newRootNode);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n var newNode = new ShaderCodeNode();\r\n newNode.line = line;\r\n rootNode.children.push(newNode);\r\n // Detect additional defines\r\n if (line[0] === \"#\" && line[1] === \"d\") {\r\n var split = line.replace(\";\", \"\").split(\" \");\r\n newNode.additionalDefineKey = split[1];\r\n if (split.length === 3) {\r\n newNode.additionalDefineValue = split[2];\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n ShaderProcessor._EvaluatePreProcessors = function (sourceCode, preprocessors, options) {\r\n var rootNode = new ShaderCodeNode();\r\n var cursor = new ShaderCodeCursor();\r\n cursor.lineIndex = -1;\r\n cursor.lines = sourceCode.split(\"\\n\");\r\n // Decompose (We keep it in 2 steps so it is easier to maintain and perf hit is insignificant)\r\n this._MoveCursor(cursor, rootNode);\r\n // Recompose\r\n return rootNode.process(preprocessors, options);\r\n };\r\n ShaderProcessor._PreparePreProcessors = function (options) {\r\n var defines = options.defines;\r\n var preprocessors = {};\r\n for (var _i = 0, defines_1 = defines; _i < defines_1.length; _i++) {\r\n var define = defines_1[_i];\r\n var keyValue = define.replace(\"#define\", \"\").replace(\";\", \"\").trim();\r\n var split = keyValue.split(\" \");\r\n preprocessors[split[0]] = split.length > 1 ? split[1] : \"\";\r\n }\r\n preprocessors[\"GL_ES\"] = \"true\";\r\n preprocessors[\"__VERSION__\"] = options.version;\r\n preprocessors[options.platformName] = \"true\";\r\n return preprocessors;\r\n };\r\n ShaderProcessor._ProcessShaderConversion = function (sourceCode, options, engine) {\r\n var preparedSourceCode = this._ProcessPrecision(sourceCode, options);\r\n if (!options.processor) {\r\n return preparedSourceCode;\r\n }\r\n // Already converted\r\n if (preparedSourceCode.indexOf(\"#version 3\") !== -1) {\r\n return preparedSourceCode.replace(\"#version 300 es\", \"\");\r\n }\r\n var defines = options.defines;\r\n var preprocessors = this._PreparePreProcessors(options);\r\n // General pre processing\r\n if (options.processor.preProcessor) {\r\n preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, options.isFragment);\r\n }\r\n preparedSourceCode = this._EvaluatePreProcessors(preparedSourceCode, preprocessors, options);\r\n // Post processing\r\n if (options.processor.postProcessor) {\r\n preparedSourceCode = options.processor.postProcessor(preparedSourceCode, defines, options.isFragment, engine);\r\n }\r\n return preparedSourceCode;\r\n };\r\n ShaderProcessor._ProcessIncludes = function (sourceCode, options, callback) {\r\n var _this = this;\r\n var regex = /#include<(.+)>(\\((.*)\\))*(\\[(.*)\\])*/g;\r\n var match = regex.exec(sourceCode);\r\n var returnValue = new String(sourceCode);\r\n var keepProcessing = false;\r\n while (match != null) {\r\n var includeFile = match[1];\r\n // Uniform declaration\r\n if (includeFile.indexOf(\"__decl__\") !== -1) {\r\n includeFile = includeFile.replace(/__decl__/, \"\");\r\n if (options.supportsUniformBuffers) {\r\n includeFile = includeFile.replace(/Vertex/, \"Ubo\");\r\n includeFile = includeFile.replace(/Fragment/, \"Ubo\");\r\n }\r\n includeFile = includeFile + \"Declaration\";\r\n }\r\n if (options.includesShadersStore[includeFile]) {\r\n // Substitution\r\n var includeContent = options.includesShadersStore[includeFile];\r\n if (match[2]) {\r\n var splits = match[3].split(\",\");\r\n for (var index = 0; index < splits.length; index += 2) {\r\n var source = new RegExp(splits[index], \"g\");\r\n var dest = splits[index + 1];\r\n includeContent = includeContent.replace(source, dest);\r\n }\r\n }\r\n if (match[4]) {\r\n var indexString = match[5];\r\n if (indexString.indexOf(\"..\") !== -1) {\r\n var indexSplits = indexString.split(\"..\");\r\n var minIndex = parseInt(indexSplits[0]);\r\n var maxIndex = parseInt(indexSplits[1]);\r\n var sourceIncludeContent = includeContent.slice(0);\r\n includeContent = \"\";\r\n if (isNaN(maxIndex)) {\r\n maxIndex = options.indexParameters[indexSplits[1]];\r\n }\r\n for (var i = minIndex; i < maxIndex; i++) {\r\n if (!options.supportsUniformBuffers) {\r\n // Ubo replacement\r\n sourceIncludeContent = sourceIncludeContent.replace(/light\\{X\\}.(\\w*)/g, function (str, p1) {\r\n return p1 + \"{X}\";\r\n });\r\n }\r\n includeContent += sourceIncludeContent.replace(/\\{X\\}/g, i.toString()) + \"\\n\";\r\n }\r\n }\r\n else {\r\n if (!options.supportsUniformBuffers) {\r\n // Ubo replacement\r\n includeContent = includeContent.replace(/light\\{X\\}.(\\w*)/g, function (str, p1) {\r\n return p1 + \"{X}\";\r\n });\r\n }\r\n includeContent = includeContent.replace(/\\{X\\}/g, indexString);\r\n }\r\n }\r\n // Replace\r\n returnValue = returnValue.replace(match[0], includeContent);\r\n keepProcessing = keepProcessing || includeContent.indexOf(\"#include<\") >= 0;\r\n }\r\n else {\r\n var includeShaderUrl = options.shadersRepository + \"ShadersInclude/\" + includeFile + \".fx\";\r\n ShaderProcessor._FileToolsLoadFile(includeShaderUrl, function (fileContent) {\r\n options.includesShadersStore[includeFile] = fileContent;\r\n _this._ProcessIncludes(returnValue, options, callback);\r\n });\r\n return;\r\n }\r\n match = regex.exec(sourceCode);\r\n }\r\n if (keepProcessing) {\r\n this._ProcessIncludes(returnValue.toString(), options, callback);\r\n }\r\n else {\r\n callback(returnValue);\r\n }\r\n };\r\n /**\r\n * Loads a file from a url\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n * @hidden\r\n */\r\n ShaderProcessor._FileToolsLoadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n throw _DevTools.WarnImport(\"FileTools\");\r\n };\r\n return ShaderProcessor;\r\n}());\r\nexport { ShaderProcessor };\r\n//# sourceMappingURL=shaderProcessor.js.map","/** Defines the cross module used constants to avoid circular dependncies */\r\nvar Constants = /** @class */ (function () {\r\n function Constants() {\r\n }\r\n /** Defines that alpha blending is disabled */\r\n Constants.ALPHA_DISABLE = 0;\r\n /** Defines that alpha blending is SRC ALPHA * SRC + DEST */\r\n Constants.ALPHA_ADD = 1;\r\n /** Defines that alpha blending is SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */\r\n Constants.ALPHA_COMBINE = 2;\r\n /** Defines that alpha blending is DEST - SRC * DEST */\r\n Constants.ALPHA_SUBTRACT = 3;\r\n /** Defines that alpha blending is SRC * DEST */\r\n Constants.ALPHA_MULTIPLY = 4;\r\n /** Defines that alpha blending is SRC ALPHA * SRC + (1 - SRC) * DEST */\r\n Constants.ALPHA_MAXIMIZED = 5;\r\n /** Defines that alpha blending is SRC + DEST */\r\n Constants.ALPHA_ONEONE = 6;\r\n /** Defines that alpha blending is SRC + (1 - SRC ALPHA) * DEST */\r\n Constants.ALPHA_PREMULTIPLIED = 7;\r\n /**\r\n * Defines that alpha blending is SRC + (1 - SRC ALPHA) * DEST\r\n * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Constants.ALPHA_PREMULTIPLIED_PORTERDUFF = 8;\r\n /** Defines that alpha blending is CST * SRC + (1 - CST) * DEST */\r\n Constants.ALPHA_INTERPOLATE = 9;\r\n /**\r\n * Defines that alpha blending is SRC + (1 - SRC) * DEST\r\n * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Constants.ALPHA_SCREENMODE = 10;\r\n /**\r\n * Defines that alpha blending is SRC + DST\r\n * Alpha will be set to SRC ALPHA + DST ALPHA\r\n */\r\n Constants.ALPHA_ONEONE_ONEONE = 11;\r\n /**\r\n * Defines that alpha blending is SRC * DST ALPHA + DST\r\n * Alpha will be set to 0\r\n */\r\n Constants.ALPHA_ALPHATOCOLOR = 12;\r\n /**\r\n * Defines that alpha blending is SRC * (1 - DST) + DST * (1 - SRC)\r\n */\r\n Constants.ALPHA_REVERSEONEMINUS = 13;\r\n /**\r\n * Defines that alpha blending is SRC + DST * (1 - SRC ALPHA)\r\n * Alpha will be set to SRC ALPHA + DST ALPHA * (1 - SRC ALPHA)\r\n */\r\n Constants.ALPHA_SRC_DSTONEMINUSSRCALPHA = 14;\r\n /**\r\n * Defines that alpha blending is SRC + DST\r\n * Alpha will be set to SRC ALPHA\r\n */\r\n Constants.ALPHA_ONEONE_ONEZERO = 15;\r\n /**\r\n * Defines that alpha blending is SRC * (1 - DST) + DST * (1 - SRC)\r\n * Alpha will be set to DST ALPHA\r\n */\r\n Constants.ALPHA_EXCLUSION = 16;\r\n /** Defines that alpha blending equation a SUM */\r\n Constants.ALPHA_EQUATION_ADD = 0;\r\n /** Defines that alpha blending equation a SUBSTRACTION */\r\n Constants.ALPHA_EQUATION_SUBSTRACT = 1;\r\n /** Defines that alpha blending equation a REVERSE SUBSTRACTION */\r\n Constants.ALPHA_EQUATION_REVERSE_SUBTRACT = 2;\r\n /** Defines that alpha blending equation a MAX operation */\r\n Constants.ALPHA_EQUATION_MAX = 3;\r\n /** Defines that alpha blending equation a MIN operation */\r\n Constants.ALPHA_EQUATION_MIN = 4;\r\n /**\r\n * Defines that alpha blending equation a DARKEN operation:\r\n * It takes the min of the src and sums the alpha channels.\r\n */\r\n Constants.ALPHA_EQUATION_DARKEN = 5;\r\n /** Defines that the ressource is not delayed*/\r\n Constants.DELAYLOADSTATE_NONE = 0;\r\n /** Defines that the ressource was successfully delay loaded */\r\n Constants.DELAYLOADSTATE_LOADED = 1;\r\n /** Defines that the ressource is currently delay loading */\r\n Constants.DELAYLOADSTATE_LOADING = 2;\r\n /** Defines that the ressource is delayed and has not started loading */\r\n Constants.DELAYLOADSTATE_NOTLOADED = 4;\r\n // Depht or Stencil test Constants.\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */\r\n Constants.NEVER = 0x0200;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\r\n Constants.ALWAYS = 0x0207;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */\r\n Constants.LESS = 0x0201;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */\r\n Constants.EQUAL = 0x0202;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */\r\n Constants.LEQUAL = 0x0203;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */\r\n Constants.GREATER = 0x0204;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */\r\n Constants.GEQUAL = 0x0206;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */\r\n Constants.NOTEQUAL = 0x0205;\r\n // Stencil Actions Constants.\r\n /** Passed to stencilOperation to specify that stencil value must be kept */\r\n Constants.KEEP = 0x1E00;\r\n /** Passed to stencilOperation to specify that stencil value must be replaced */\r\n Constants.REPLACE = 0x1E01;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented */\r\n Constants.INCR = 0x1E02;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented */\r\n Constants.DECR = 0x1E03;\r\n /** Passed to stencilOperation to specify that stencil value must be inverted */\r\n Constants.INVERT = 0x150A;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */\r\n Constants.INCR_WRAP = 0x8507;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */\r\n Constants.DECR_WRAP = 0x8508;\r\n /** Texture is not repeating outside of 0..1 UVs */\r\n Constants.TEXTURE_CLAMP_ADDRESSMODE = 0;\r\n /** Texture is repeating outside of 0..1 UVs */\r\n Constants.TEXTURE_WRAP_ADDRESSMODE = 1;\r\n /** Texture is repeating and mirrored */\r\n Constants.TEXTURE_MIRROR_ADDRESSMODE = 2;\r\n /** ALPHA */\r\n Constants.TEXTUREFORMAT_ALPHA = 0;\r\n /** LUMINANCE */\r\n Constants.TEXTUREFORMAT_LUMINANCE = 1;\r\n /** LUMINANCE_ALPHA */\r\n Constants.TEXTUREFORMAT_LUMINANCE_ALPHA = 2;\r\n /** RGB */\r\n Constants.TEXTUREFORMAT_RGB = 4;\r\n /** RGBA */\r\n Constants.TEXTUREFORMAT_RGBA = 5;\r\n /** RED */\r\n Constants.TEXTUREFORMAT_RED = 6;\r\n /** RED (2nd reference) */\r\n Constants.TEXTUREFORMAT_R = 6;\r\n /** RG */\r\n Constants.TEXTUREFORMAT_RG = 7;\r\n /** RED_INTEGER */\r\n Constants.TEXTUREFORMAT_RED_INTEGER = 8;\r\n /** RED_INTEGER (2nd reference) */\r\n Constants.TEXTUREFORMAT_R_INTEGER = 8;\r\n /** RG_INTEGER */\r\n Constants.TEXTUREFORMAT_RG_INTEGER = 9;\r\n /** RGB_INTEGER */\r\n Constants.TEXTUREFORMAT_RGB_INTEGER = 10;\r\n /** RGBA_INTEGER */\r\n Constants.TEXTUREFORMAT_RGBA_INTEGER = 11;\r\n /** UNSIGNED_BYTE */\r\n Constants.TEXTURETYPE_UNSIGNED_BYTE = 0;\r\n /** UNSIGNED_BYTE (2nd reference) */\r\n Constants.TEXTURETYPE_UNSIGNED_INT = 0;\r\n /** FLOAT */\r\n Constants.TEXTURETYPE_FLOAT = 1;\r\n /** HALF_FLOAT */\r\n Constants.TEXTURETYPE_HALF_FLOAT = 2;\r\n /** BYTE */\r\n Constants.TEXTURETYPE_BYTE = 3;\r\n /** SHORT */\r\n Constants.TEXTURETYPE_SHORT = 4;\r\n /** UNSIGNED_SHORT */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT = 5;\r\n /** INT */\r\n Constants.TEXTURETYPE_INT = 6;\r\n /** UNSIGNED_INT */\r\n Constants.TEXTURETYPE_UNSIGNED_INTEGER = 7;\r\n /** UNSIGNED_SHORT_4_4_4_4 */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = 8;\r\n /** UNSIGNED_SHORT_5_5_5_1 */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = 9;\r\n /** UNSIGNED_SHORT_5_6_5 */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = 10;\r\n /** UNSIGNED_INT_2_10_10_10_REV */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = 11;\r\n /** UNSIGNED_INT_24_8 */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_24_8 = 12;\r\n /** UNSIGNED_INT_10F_11F_11F_REV */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = 13;\r\n /** UNSIGNED_INT_5_9_9_9_REV */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = 14;\r\n /** FLOAT_32_UNSIGNED_INT_24_8_REV */\r\n Constants.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = 15;\r\n /** nearest is mag = nearest and min = nearest and no mip */\r\n Constants.TEXTURE_NEAREST_SAMPLINGMODE = 1;\r\n /** mag = nearest and min = nearest and mip = none */\r\n Constants.TEXTURE_NEAREST_NEAREST = 1;\r\n /** Bilinear is mag = linear and min = linear and no mip */\r\n Constants.TEXTURE_BILINEAR_SAMPLINGMODE = 2;\r\n /** mag = linear and min = linear and mip = none */\r\n Constants.TEXTURE_LINEAR_LINEAR = 2;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Constants.TEXTURE_TRILINEAR_SAMPLINGMODE = 3;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR = 3;\r\n /** mag = nearest and min = nearest and mip = nearest */\r\n Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST = 4;\r\n /** mag = nearest and min = linear and mip = nearest */\r\n Constants.TEXTURE_NEAREST_LINEAR_MIPNEAREST = 5;\r\n /** mag = nearest and min = linear and mip = linear */\r\n Constants.TEXTURE_NEAREST_LINEAR_MIPLINEAR = 6;\r\n /** mag = nearest and min = linear and mip = none */\r\n Constants.TEXTURE_NEAREST_LINEAR = 7;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Constants.TEXTURE_NEAREST_NEAREST_MIPLINEAR = 8;\r\n /** mag = linear and min = nearest and mip = nearest */\r\n Constants.TEXTURE_LINEAR_NEAREST_MIPNEAREST = 9;\r\n /** mag = linear and min = nearest and mip = linear */\r\n Constants.TEXTURE_LINEAR_NEAREST_MIPLINEAR = 10;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST = 11;\r\n /** mag = linear and min = nearest and mip = none */\r\n Constants.TEXTURE_LINEAR_NEAREST = 12;\r\n /** Explicit coordinates mode */\r\n Constants.TEXTURE_EXPLICIT_MODE = 0;\r\n /** Spherical coordinates mode */\r\n Constants.TEXTURE_SPHERICAL_MODE = 1;\r\n /** Planar coordinates mode */\r\n Constants.TEXTURE_PLANAR_MODE = 2;\r\n /** Cubic coordinates mode */\r\n Constants.TEXTURE_CUBIC_MODE = 3;\r\n /** Projection coordinates mode */\r\n Constants.TEXTURE_PROJECTION_MODE = 4;\r\n /** Skybox coordinates mode */\r\n Constants.TEXTURE_SKYBOX_MODE = 5;\r\n /** Inverse Cubic coordinates mode */\r\n Constants.TEXTURE_INVCUBIC_MODE = 6;\r\n /** Equirectangular coordinates mode */\r\n Constants.TEXTURE_EQUIRECTANGULAR_MODE = 7;\r\n /** Equirectangular Fixed coordinates mode */\r\n Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = 8;\r\n /** Equirectangular Fixed Mirrored coordinates mode */\r\n Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9;\r\n /** Offline (baking) quality for texture filtering */\r\n Constants.TEXTURE_FILTERING_QUALITY_OFFLINE = 4096;\r\n /** High quality for texture filtering */\r\n Constants.TEXTURE_FILTERING_QUALITY_HIGH = 64;\r\n /** Medium quality for texture filtering */\r\n Constants.TEXTURE_FILTERING_QUALITY_MEDIUM = 16;\r\n /** Low quality for texture filtering */\r\n Constants.TEXTURE_FILTERING_QUALITY_LOW = 8;\r\n // Texture rescaling mode\r\n /** Defines that texture rescaling will use a floor to find the closer power of 2 size */\r\n Constants.SCALEMODE_FLOOR = 1;\r\n /** Defines that texture rescaling will look for the nearest power of 2 size */\r\n Constants.SCALEMODE_NEAREST = 2;\r\n /** Defines that texture rescaling will use a ceil to find the closer power of 2 size */\r\n Constants.SCALEMODE_CEILING = 3;\r\n /**\r\n * The dirty texture flag value\r\n */\r\n Constants.MATERIAL_TextureDirtyFlag = 1;\r\n /**\r\n * The dirty light flag value\r\n */\r\n Constants.MATERIAL_LightDirtyFlag = 2;\r\n /**\r\n * The dirty fresnel flag value\r\n */\r\n Constants.MATERIAL_FresnelDirtyFlag = 4;\r\n /**\r\n * The dirty attribute flag value\r\n */\r\n Constants.MATERIAL_AttributesDirtyFlag = 8;\r\n /**\r\n * The dirty misc flag value\r\n */\r\n Constants.MATERIAL_MiscDirtyFlag = 16;\r\n /**\r\n * The dirty prepass flag value\r\n */\r\n Constants.MATERIAL_PrePassDirtyFlag = 32;\r\n /**\r\n * The all dirty flag value\r\n */\r\n Constants.MATERIAL_AllDirtyFlag = 63;\r\n /**\r\n * Returns the triangle fill mode\r\n */\r\n Constants.MATERIAL_TriangleFillMode = 0;\r\n /**\r\n * Returns the wireframe mode\r\n */\r\n Constants.MATERIAL_WireFrameFillMode = 1;\r\n /**\r\n * Returns the point fill mode\r\n */\r\n Constants.MATERIAL_PointFillMode = 2;\r\n /**\r\n * Returns the point list draw mode\r\n */\r\n Constants.MATERIAL_PointListDrawMode = 3;\r\n /**\r\n * Returns the line list draw mode\r\n */\r\n Constants.MATERIAL_LineListDrawMode = 4;\r\n /**\r\n * Returns the line loop draw mode\r\n */\r\n Constants.MATERIAL_LineLoopDrawMode = 5;\r\n /**\r\n * Returns the line strip draw mode\r\n */\r\n Constants.MATERIAL_LineStripDrawMode = 6;\r\n /**\r\n * Returns the triangle strip draw mode\r\n */\r\n Constants.MATERIAL_TriangleStripDrawMode = 7;\r\n /**\r\n * Returns the triangle fan draw mode\r\n */\r\n Constants.MATERIAL_TriangleFanDrawMode = 8;\r\n /**\r\n * Stores the clock-wise side orientation\r\n */\r\n Constants.MATERIAL_ClockWiseSideOrientation = 0;\r\n /**\r\n * Stores the counter clock-wise side orientation\r\n */\r\n Constants.MATERIAL_CounterClockWiseSideOrientation = 1;\r\n /**\r\n * Nothing\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_NothingTrigger = 0;\r\n /**\r\n * On pick\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickTrigger = 1;\r\n /**\r\n * On left pick\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnLeftPickTrigger = 2;\r\n /**\r\n * On right pick\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnRightPickTrigger = 3;\r\n /**\r\n * On center pick\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnCenterPickTrigger = 4;\r\n /**\r\n * On pick down\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickDownTrigger = 5;\r\n /**\r\n * On double pick\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnDoublePickTrigger = 6;\r\n /**\r\n * On pick up\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickUpTrigger = 7;\r\n /**\r\n * On pick out.\r\n * This trigger will only be raised if you also declared a OnPickDown\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickOutTrigger = 16;\r\n /**\r\n * On long press\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnLongPressTrigger = 8;\r\n /**\r\n * On pointer over\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPointerOverTrigger = 9;\r\n /**\r\n * On pointer out\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPointerOutTrigger = 10;\r\n /**\r\n * On every frame\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnEveryFrameTrigger = 11;\r\n /**\r\n * On intersection enter\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnIntersectionEnterTrigger = 12;\r\n /**\r\n * On intersection exit\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnIntersectionExitTrigger = 13;\r\n /**\r\n * On key down\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnKeyDownTrigger = 14;\r\n /**\r\n * On key up\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnKeyUpTrigger = 15;\r\n /**\r\n * Billboard mode will only apply to Y axis\r\n */\r\n Constants.PARTICLES_BILLBOARDMODE_Y = 2;\r\n /**\r\n * Billboard mode will apply to all axes\r\n */\r\n Constants.PARTICLES_BILLBOARDMODE_ALL = 7;\r\n /**\r\n * Special billboard mode where the particle will be biilboard to the camera but rotated to align with direction\r\n */\r\n Constants.PARTICLES_BILLBOARDMODE_STRETCHED = 8;\r\n /** Default culling strategy : this is an exclusion test and it's the more accurate.\r\n * Test order :\r\n * Is the bounding sphere outside the frustum ?\r\n * If not, are the bounding box vertices outside the frustum ?\r\n * It not, then the cullable object is in the frustum.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_STANDARD = 0;\r\n /** Culling strategy : Bounding Sphere Only.\r\n * This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested.\r\n * It's also less accurate than the standard because some not visible objects can still be selected.\r\n * Test : is the bounding sphere outside the frustum ?\r\n * If not, then the cullable object is in the frustum.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = 1;\r\n /** Culling strategy : Optimistic Inclusion.\r\n * This in an inclusion test first, then the standard exclusion test.\r\n * This can be faster when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside.\r\n * Anyway, it's as accurate as the standard strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the default culling strategy.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = 2;\r\n /** Culling strategy : Optimistic Inclusion then Bounding Sphere Only.\r\n * This in an inclusion test first, then the bounding sphere only exclusion test.\r\n * This can be the fastest test when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it.\r\n * It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = 3;\r\n /**\r\n * No logging while loading\r\n */\r\n Constants.SCENELOADER_NO_LOGGING = 0;\r\n /**\r\n * Minimal logging while loading\r\n */\r\n Constants.SCENELOADER_MINIMAL_LOGGING = 1;\r\n /**\r\n * Summary logging while loading\r\n */\r\n Constants.SCENELOADER_SUMMARY_LOGGING = 2;\r\n /**\r\n * Detailled logging while loading\r\n */\r\n Constants.SCENELOADER_DETAILED_LOGGING = 3;\r\n /**\r\n * Constant used to retrieve the irradiance texture index in the textures array in the prepass\r\n * using getIndex(0)\r\n */\r\n Constants.PREPASS_IRRADIANCE_TEXTURE_TYPE = 0;\r\n /**\r\n * Constant used to retrieve the position texture index in the textures array in the prepass\r\n * using getIndex(undefined)\r\n */\r\n Constants.PREPASS_POSITION_TEXTURE_TYPE = 1;\r\n /**\r\n * Constant used to retrieve the velocity texture index in the textures array in the prepass\r\n * using getIndex(undefined)\r\n */\r\n Constants.PREPASS_VELOCITY_TEXTURE_TYPE = 2;\r\n /**\r\n * Constant used to retrieve the reflectivity texture index in the textures array in the prepass\r\n * using the getIndex(3)\r\n */\r\n Constants.PREPASS_REFLECTIVITY_TEXTURE_TYPE = 3;\r\n /**\r\n * Constant used to retrieve the lit color texture index in the textures array in the prepass\r\n * using the getIndex(4)\r\n */\r\n Constants.PREPASS_COLOR_TEXTURE_TYPE = 4;\r\n /**\r\n * Constant used to retrieve depth + normal index in the textures array in the prepass\r\n * using the getIndex(5)\r\n */\r\n Constants.PREPASS_DEPTHNORMAL_TEXTURE_TYPE = 5;\r\n /**\r\n * Constant used to retrieve albedo index in the textures array in the prepass\r\n * using the getIndex(6)\r\n */\r\n Constants.PREPASS_ALBEDO_TEXTURE_TYPE = 6;\r\n return Constants;\r\n}());\r\nexport { Constants };\r\n//# sourceMappingURL=constants.js.map","import { PrecisionDate } from \"./precisionDate\";\r\n/**\r\n * Performance monitor tracks rolling average frame-time and frame-time variance over a user defined sliding-window\r\n */\r\nvar PerformanceMonitor = /** @class */ (function () {\r\n /**\r\n * constructor\r\n * @param frameSampleSize The number of samples required to saturate the sliding window\r\n */\r\n function PerformanceMonitor(frameSampleSize) {\r\n if (frameSampleSize === void 0) { frameSampleSize = 30; }\r\n this._enabled = true;\r\n this._rollingFrameTime = new RollingAverage(frameSampleSize);\r\n }\r\n /**\r\n * Samples current frame\r\n * @param timeMs A timestamp in milliseconds of the current frame to compare with other frames\r\n */\r\n PerformanceMonitor.prototype.sampleFrame = function (timeMs) {\r\n if (timeMs === void 0) { timeMs = PrecisionDate.Now; }\r\n if (!this._enabled) {\r\n return;\r\n }\r\n if (this._lastFrameTimeMs != null) {\r\n var dt = timeMs - this._lastFrameTimeMs;\r\n this._rollingFrameTime.add(dt);\r\n }\r\n this._lastFrameTimeMs = timeMs;\r\n };\r\n Object.defineProperty(PerformanceMonitor.prototype, \"averageFrameTime\", {\r\n /**\r\n * Returns the average frame time in milliseconds over the sliding window (or the subset of frames sampled so far)\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.average;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"averageFrameTimeVariance\", {\r\n /**\r\n * Returns the variance frame time in milliseconds over the sliding window (or the subset of frames sampled so far)\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.variance;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"instantaneousFrameTime\", {\r\n /**\r\n * Returns the frame time of the most recent frame\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.history(0);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"averageFPS\", {\r\n /**\r\n * Returns the average framerate in frames per second over the sliding window (or the subset of frames sampled so far)\r\n */\r\n get: function () {\r\n return 1000.0 / this._rollingFrameTime.average;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"instantaneousFPS\", {\r\n /**\r\n * Returns the average framerate in frames per second using the most recent frame time\r\n */\r\n get: function () {\r\n var history = this._rollingFrameTime.history(0);\r\n if (history === 0) {\r\n return 0;\r\n }\r\n return 1000.0 / history;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"isSaturated\", {\r\n /**\r\n * Returns true if enough samples have been taken to completely fill the sliding window\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.isSaturated();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Enables contributions to the sliding window sample set\r\n */\r\n PerformanceMonitor.prototype.enable = function () {\r\n this._enabled = true;\r\n };\r\n /**\r\n * Disables contributions to the sliding window sample set\r\n * Samples will not be interpolated over the disabled period\r\n */\r\n PerformanceMonitor.prototype.disable = function () {\r\n this._enabled = false;\r\n //clear last sample to avoid interpolating over the disabled period when next enabled\r\n this._lastFrameTimeMs = null;\r\n };\r\n Object.defineProperty(PerformanceMonitor.prototype, \"isEnabled\", {\r\n /**\r\n * Returns true if sampling is enabled\r\n */\r\n get: function () {\r\n return this._enabled;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Resets performance monitor\r\n */\r\n PerformanceMonitor.prototype.reset = function () {\r\n //clear last sample to avoid interpolating over the disabled period when next enabled\r\n this._lastFrameTimeMs = null;\r\n //wipe record\r\n this._rollingFrameTime.reset();\r\n };\r\n return PerformanceMonitor;\r\n}());\r\nexport { PerformanceMonitor };\r\n/**\r\n * RollingAverage\r\n *\r\n * Utility to efficiently compute the rolling average and variance over a sliding window of samples\r\n */\r\nvar RollingAverage = /** @class */ (function () {\r\n /**\r\n * constructor\r\n * @param length The number of samples required to saturate the sliding window\r\n */\r\n function RollingAverage(length) {\r\n this._samples = new Array(length);\r\n this.reset();\r\n }\r\n /**\r\n * Adds a sample to the sample set\r\n * @param v The sample value\r\n */\r\n RollingAverage.prototype.add = function (v) {\r\n //http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance\r\n var delta;\r\n //we need to check if we've already wrapped round\r\n if (this.isSaturated()) {\r\n //remove bottom of stack from mean\r\n var bottomValue = this._samples[this._pos];\r\n delta = bottomValue - this.average;\r\n this.average -= delta / (this._sampleCount - 1);\r\n this._m2 -= delta * (bottomValue - this.average);\r\n }\r\n else {\r\n this._sampleCount++;\r\n }\r\n //add new value to mean\r\n delta = v - this.average;\r\n this.average += delta / (this._sampleCount);\r\n this._m2 += delta * (v - this.average);\r\n //set the new variance\r\n this.variance = this._m2 / (this._sampleCount - 1);\r\n this._samples[this._pos] = v;\r\n this._pos++;\r\n this._pos %= this._samples.length; //positive wrap around\r\n };\r\n /**\r\n * Returns previously added values or null if outside of history or outside the sliding window domain\r\n * @param i Index in history. For example, pass 0 for the most recent value and 1 for the value before that\r\n * @return Value previously recorded with add() or null if outside of range\r\n */\r\n RollingAverage.prototype.history = function (i) {\r\n if ((i >= this._sampleCount) || (i >= this._samples.length)) {\r\n return 0;\r\n }\r\n var i0 = this._wrapPosition(this._pos - 1.0);\r\n return this._samples[this._wrapPosition(i0 - i)];\r\n };\r\n /**\r\n * Returns true if enough samples have been taken to completely fill the sliding window\r\n * @return true if sample-set saturated\r\n */\r\n RollingAverage.prototype.isSaturated = function () {\r\n return this._sampleCount >= this._samples.length;\r\n };\r\n /**\r\n * Resets the rolling average (equivalent to 0 samples taken so far)\r\n */\r\n RollingAverage.prototype.reset = function () {\r\n this.average = 0;\r\n this.variance = 0;\r\n this._sampleCount = 0;\r\n this._pos = 0;\r\n this._m2 = 0;\r\n };\r\n /**\r\n * Wraps a value around the sample range boundaries\r\n * @param i Position in sample range, for example if the sample length is 5, and i is -3, then 2 will be returned.\r\n * @return Wrapped position in sample range\r\n */\r\n RollingAverage.prototype._wrapPosition = function (i) {\r\n var max = this._samples.length;\r\n return ((i % max) + max) % max;\r\n };\r\n return RollingAverage;\r\n}());\r\nexport { RollingAverage };\r\n//# sourceMappingURL=performanceMonitor.js.map","import { ThinEngine } from \"../../Engines/thinEngine\";\r\nThinEngine.prototype.setAlphaConstants = function (r, g, b, a) {\r\n this._alphaState.setAlphaBlendConstants(r, g, b, a);\r\n};\r\nThinEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange) {\r\n if (noDepthWriteChange === void 0) { noDepthWriteChange = false; }\r\n if (this._alphaMode === mode) {\r\n return;\r\n }\r\n switch (mode) {\r\n case 0:\r\n this._alphaState.alphaBlend = false;\r\n break;\r\n case 7:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 8:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 2:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 6:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 1:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 3:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 4:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 5:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 9:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR, this._gl.ONE_MINUS_CONSTANT_COLOR, this._gl.CONSTANT_ALPHA, this._gl.ONE_MINUS_CONSTANT_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 10:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 11:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 12:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ZERO);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 13:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE_MINUS_DST_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 14:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 15:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ZERO);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 16:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n }\r\n if (!noDepthWriteChange) {\r\n this.depthCullingState.depthMask = (mode === 0);\r\n }\r\n this._alphaMode = mode;\r\n};\r\nThinEngine.prototype.getAlphaMode = function () {\r\n return this._alphaMode;\r\n};\r\nThinEngine.prototype.setAlphaEquation = function (equation) {\r\n if (this._alphaEquation === equation) {\r\n return;\r\n }\r\n switch (equation) {\r\n case 0:\r\n this._alphaState.setAlphaEquationParameters(this._gl.FUNC_ADD, this._gl.FUNC_ADD);\r\n break;\r\n case 1:\r\n this._alphaState.setAlphaEquationParameters(this._gl.FUNC_SUBTRACT, this._gl.FUNC_SUBTRACT);\r\n break;\r\n case 2:\r\n this._alphaState.setAlphaEquationParameters(this._gl.FUNC_REVERSE_SUBTRACT, this._gl.FUNC_REVERSE_SUBTRACT);\r\n break;\r\n case 3:\r\n this._alphaState.setAlphaEquationParameters(this._gl.MAX, this._gl.MAX);\r\n break;\r\n case 4:\r\n this._alphaState.setAlphaEquationParameters(this._gl.MIN, this._gl.MIN);\r\n break;\r\n case 5:\r\n this._alphaState.setAlphaEquationParameters(this._gl.MIN, this._gl.FUNC_ADD);\r\n break;\r\n }\r\n this._alphaEquation = equation;\r\n};\r\nThinEngine.prototype.getAlphaEquation = function () {\r\n return this._alphaEquation;\r\n};\r\n//# sourceMappingURL=engine.alpha.js.map","import { ThinEngine } from \"../../Engines/thinEngine\";\r\nThinEngine.prototype.updateDynamicIndexBuffer = function (indexBuffer, indices, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n // Force cache update\r\n this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER] = null;\r\n this.bindIndexBuffer(indexBuffer);\r\n var arrayBuffer;\r\n if (indices instanceof Uint16Array || indices instanceof Uint32Array) {\r\n arrayBuffer = indices;\r\n }\r\n else {\r\n arrayBuffer = indexBuffer.is32Bits ? new Uint32Array(indices) : new Uint16Array(indices);\r\n }\r\n this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, arrayBuffer, this._gl.DYNAMIC_DRAW);\r\n this._resetIndexBufferBinding();\r\n};\r\nThinEngine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, data, byteOffset, byteLength) {\r\n this.bindArrayBuffer(vertexBuffer);\r\n if (byteOffset === undefined) {\r\n byteOffset = 0;\r\n }\r\n var dataLength = data.length || data.byteLength;\r\n if (byteLength === undefined || byteLength >= dataLength && byteOffset === 0) {\r\n if (data instanceof Array) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, new Float32Array(data));\r\n }\r\n else {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, data);\r\n }\r\n }\r\n else {\r\n if (data instanceof Array) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(data).subarray(byteOffset, byteOffset + byteLength));\r\n }\r\n else {\r\n if (data instanceof ArrayBuffer) {\r\n data = new Uint8Array(data, byteOffset, byteLength);\r\n }\r\n else {\r\n data = new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);\r\n }\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\r\n }\r\n }\r\n this._resetVertexBufferBinding();\r\n};\r\n//# sourceMappingURL=engine.dynamicBuffer.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { DomManagement } from \"../Misc/domManagement\";\r\nimport { EngineStore } from \"./engineStore\";\r\nimport { _DevTools } from '../Misc/devTools';\r\nimport { ThinEngine } from './thinEngine';\r\nimport { PerformanceMonitor } from '../Misc/performanceMonitor';\r\nimport { PerfCounter } from '../Misc/perfCounter';\r\nimport { WebGLDataBuffer } from '../Meshes/WebGL/webGLDataBuffer';\r\nimport { Logger } from '../Misc/logger';\r\nimport \"./Extensions/engine.alpha\";\r\nimport \"./Extensions/engine.readTexture\";\r\nimport \"./Extensions/engine.dynamicBuffer\";\r\n/**\r\n * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio\r\n */\r\nvar Engine = /** @class */ (function (_super) {\r\n __extends(Engine, _super);\r\n /**\r\n * Creates a new engine\r\n * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which alreay used the WebGL context\r\n * @param antialias defines enable antialiasing (default: false)\r\n * @param options defines further options to be sent to the getContext() function\r\n * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)\r\n */\r\n function Engine(canvasOrContext, antialias, options, adaptToDeviceRatio) {\r\n if (adaptToDeviceRatio === void 0) { adaptToDeviceRatio = false; }\r\n var _this = _super.call(this, canvasOrContext, antialias, options, adaptToDeviceRatio) || this;\r\n // Members\r\n /**\r\n * Gets or sets a boolean to enable/disable IndexedDB support and avoid XHR on .manifest\r\n **/\r\n _this.enableOfflineSupport = false;\r\n /**\r\n * Gets or sets a boolean to enable/disable checking manifest if IndexedDB support is enabled (js will always consider the database is up to date)\r\n **/\r\n _this.disableManifestCheck = false;\r\n /**\r\n * Gets the list of created scenes\r\n */\r\n _this.scenes = new Array();\r\n /**\r\n * Event raised when a new scene is created\r\n */\r\n _this.onNewSceneAddedObservable = new Observable();\r\n /**\r\n * Gets the list of created postprocesses\r\n */\r\n _this.postProcesses = new Array();\r\n /**\r\n * Gets a boolean indicating if the pointer is currently locked\r\n */\r\n _this.isPointerLock = false;\r\n // Observables\r\n /**\r\n * Observable event triggered each time the rendering canvas is resized\r\n */\r\n _this.onResizeObservable = new Observable();\r\n /**\r\n * Observable event triggered each time the canvas loses focus\r\n */\r\n _this.onCanvasBlurObservable = new Observable();\r\n /**\r\n * Observable event triggered each time the canvas gains focus\r\n */\r\n _this.onCanvasFocusObservable = new Observable();\r\n /**\r\n * Observable event triggered each time the canvas receives pointerout event\r\n */\r\n _this.onCanvasPointerOutObservable = new Observable();\r\n /**\r\n * Observable raised when the engine begins a new frame\r\n */\r\n _this.onBeginFrameObservable = new Observable();\r\n /**\r\n * If set, will be used to request the next animation frame for the render loop\r\n */\r\n _this.customAnimationFrameRequester = null;\r\n /**\r\n * Observable raised when the engine ends the current frame\r\n */\r\n _this.onEndFrameObservable = new Observable();\r\n /**\r\n * Observable raised when the engine is about to compile a shader\r\n */\r\n _this.onBeforeShaderCompilationObservable = new Observable();\r\n /**\r\n * Observable raised when the engine has jsut compiled a shader\r\n */\r\n _this.onAfterShaderCompilationObservable = new Observable();\r\n // Deterministic lockstepMaxSteps\r\n _this._deterministicLockstep = false;\r\n _this._lockstepMaxSteps = 4;\r\n _this._timeStep = 1 / 60;\r\n // FPS\r\n _this._fps = 60;\r\n _this._deltaTime = 0;\r\n /** @hidden */\r\n _this._drawCalls = new PerfCounter();\r\n /** Gets or sets the tab index to set to the rendering canvas. 1 is the minimum value to set to be able to capture keyboard events */\r\n _this.canvasTabIndex = 1;\r\n /**\r\n * Turn this value on if you want to pause FPS computation when in background\r\n */\r\n _this.disablePerformanceMonitorInBackground = false;\r\n _this._performanceMonitor = new PerformanceMonitor();\r\n Engine.Instances.push(_this);\r\n if (!canvasOrContext) {\r\n return _this;\r\n }\r\n options = _this._creationOptions;\r\n if (canvasOrContext.getContext) {\r\n var canvas_1 = canvasOrContext;\r\n _this._onCanvasFocus = function () {\r\n _this.onCanvasFocusObservable.notifyObservers(_this);\r\n };\r\n _this._onCanvasBlur = function () {\r\n _this.onCanvasBlurObservable.notifyObservers(_this);\r\n };\r\n canvas_1.addEventListener(\"focus\", _this._onCanvasFocus);\r\n canvas_1.addEventListener(\"blur\", _this._onCanvasBlur);\r\n _this._onBlur = function () {\r\n if (_this.disablePerformanceMonitorInBackground) {\r\n _this._performanceMonitor.disable();\r\n }\r\n _this._windowIsBackground = true;\r\n };\r\n _this._onFocus = function () {\r\n if (_this.disablePerformanceMonitorInBackground) {\r\n _this._performanceMonitor.enable();\r\n }\r\n _this._windowIsBackground = false;\r\n };\r\n _this._onCanvasPointerOut = function (ev) {\r\n _this.onCanvasPointerOutObservable.notifyObservers(ev);\r\n };\r\n canvas_1.addEventListener(\"pointerout\", _this._onCanvasPointerOut);\r\n if (DomManagement.IsWindowObjectExist()) {\r\n var hostWindow = _this.getHostWindow();\r\n hostWindow.addEventListener(\"blur\", _this._onBlur);\r\n hostWindow.addEventListener(\"focus\", _this._onFocus);\r\n var anyDoc_1 = document;\r\n // Fullscreen\r\n _this._onFullscreenChange = function () {\r\n if (anyDoc_1.fullscreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.fullscreen;\r\n }\r\n else if (anyDoc_1.mozFullScreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.mozFullScreen;\r\n }\r\n else if (anyDoc_1.webkitIsFullScreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.webkitIsFullScreen;\r\n }\r\n else if (anyDoc_1.msIsFullScreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.msIsFullScreen;\r\n }\r\n // Pointer lock\r\n if (_this.isFullscreen && _this._pointerLockRequested && canvas_1) {\r\n Engine._RequestPointerlock(canvas_1);\r\n }\r\n };\r\n document.addEventListener(\"fullscreenchange\", _this._onFullscreenChange, false);\r\n document.addEventListener(\"mozfullscreenchange\", _this._onFullscreenChange, false);\r\n document.addEventListener(\"webkitfullscreenchange\", _this._onFullscreenChange, false);\r\n document.addEventListener(\"msfullscreenchange\", _this._onFullscreenChange, false);\r\n // Pointer lock\r\n _this._onPointerLockChange = function () {\r\n _this.isPointerLock = (anyDoc_1.mozPointerLockElement === canvas_1 ||\r\n anyDoc_1.webkitPointerLockElement === canvas_1 ||\r\n anyDoc_1.msPointerLockElement === canvas_1 ||\r\n anyDoc_1.pointerLockElement === canvas_1);\r\n };\r\n document.addEventListener(\"pointerlockchange\", _this._onPointerLockChange, false);\r\n document.addEventListener(\"mspointerlockchange\", _this._onPointerLockChange, false);\r\n document.addEventListener(\"mozpointerlockchange\", _this._onPointerLockChange, false);\r\n document.addEventListener(\"webkitpointerlockchange\", _this._onPointerLockChange, false);\r\n // Create Audio Engine if needed.\r\n if (!Engine.audioEngine && options.audioEngine && Engine.AudioEngineFactory) {\r\n Engine.audioEngine = Engine.AudioEngineFactory(_this.getRenderingCanvas());\r\n }\r\n }\r\n _this._connectVREvents();\r\n _this.enableOfflineSupport = Engine.OfflineProviderFactory !== undefined;\r\n if (!options.doNotHandleTouchAction) {\r\n _this._disableTouchAction();\r\n }\r\n _this._deterministicLockstep = !!options.deterministicLockstep;\r\n _this._lockstepMaxSteps = options.lockstepMaxSteps || 0;\r\n _this._timeStep = options.timeStep || 1 / 60;\r\n }\r\n // Load WebVR Devices\r\n _this._prepareVRComponent();\r\n if (options.autoEnableWebVR) {\r\n _this.initWebVR();\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(Engine, \"NpmPackage\", {\r\n /**\r\n * Returns the current npm package of the sdk\r\n */\r\n // Not mixed with Version for tooling purpose.\r\n get: function () {\r\n return ThinEngine.NpmPackage;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"Version\", {\r\n /**\r\n * Returns the current version of the framework\r\n */\r\n get: function () {\r\n return ThinEngine.Version;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"Instances\", {\r\n /** Gets the list of created engines */\r\n get: function () {\r\n return EngineStore.Instances;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"LastCreatedEngine\", {\r\n /**\r\n * Gets the latest created engine\r\n */\r\n get: function () {\r\n return EngineStore.LastCreatedEngine;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"LastCreatedScene\", {\r\n /**\r\n * Gets the latest created scene\r\n */\r\n get: function () {\r\n return EngineStore.LastCreatedScene;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Will flag all materials in all scenes in all engines as dirty to trigger new shader compilation\r\n * @param flag defines which part of the materials must be marked as dirty\r\n * @param predicate defines a predicate used to filter which materials should be affected\r\n */\r\n Engine.MarkAllMaterialsAsDirty = function (flag, predicate) {\r\n for (var engineIndex = 0; engineIndex < Engine.Instances.length; engineIndex++) {\r\n var engine = Engine.Instances[engineIndex];\r\n for (var sceneIndex = 0; sceneIndex < engine.scenes.length; sceneIndex++) {\r\n engine.scenes[sceneIndex].markAllMaterialsAsDirty(flag, predicate);\r\n }\r\n }\r\n };\r\n /**\r\n * Method called to create the default loading screen.\r\n * This can be overriden in your own app.\r\n * @param canvas The rendering canvas element\r\n * @returns The loading screen\r\n */\r\n Engine.DefaultLoadingScreenFactory = function (canvas) {\r\n throw _DevTools.WarnImport(\"LoadingScreen\");\r\n };\r\n Object.defineProperty(Engine.prototype, \"_supportsHardwareTextureRescaling\", {\r\n get: function () {\r\n return !!Engine._RescalePostProcessFactory;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"performanceMonitor\", {\r\n /**\r\n * Gets the performance monitor attached to this engine\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#engineinstrumentation\r\n */\r\n get: function () {\r\n return this._performanceMonitor;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Events\r\n /**\r\n * Gets the HTML element used to attach event listeners\r\n * @returns a HTML element\r\n */\r\n Engine.prototype.getInputElement = function () {\r\n return this._renderingCanvas;\r\n };\r\n /**\r\n * Gets current aspect ratio\r\n * @param viewportOwner defines the camera to use to get the aspect ratio\r\n * @param useScreen defines if screen size must be used (or the current render target if any)\r\n * @returns a number defining the aspect ratio\r\n */\r\n Engine.prototype.getAspectRatio = function (viewportOwner, useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n var viewport = viewportOwner.viewport;\r\n return (this.getRenderWidth(useScreen) * viewport.width) / (this.getRenderHeight(useScreen) * viewport.height);\r\n };\r\n /**\r\n * Gets current screen aspect ratio\r\n * @returns a number defining the aspect ratio\r\n */\r\n Engine.prototype.getScreenAspectRatio = function () {\r\n return (this.getRenderWidth(true)) / (this.getRenderHeight(true));\r\n };\r\n /**\r\n * Gets the client rect of the HTML canvas attached with the current webGL context\r\n * @returns a client rectanglee\r\n */\r\n Engine.prototype.getRenderingCanvasClientRect = function () {\r\n if (!this._renderingCanvas) {\r\n return null;\r\n }\r\n return this._renderingCanvas.getBoundingClientRect();\r\n };\r\n /**\r\n * Gets the client rect of the HTML element used for events\r\n * @returns a client rectanglee\r\n */\r\n Engine.prototype.getInputElementClientRect = function () {\r\n if (!this._renderingCanvas) {\r\n return null;\r\n }\r\n return this.getInputElement().getBoundingClientRect();\r\n };\r\n /**\r\n * Gets a boolean indicating that the engine is running in deterministic lock step mode\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns true if engine is in deterministic lock step mode\r\n */\r\n Engine.prototype.isDeterministicLockStep = function () {\r\n return this._deterministicLockstep;\r\n };\r\n /**\r\n * Gets the max steps when engine is running in deterministic lock step\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns the max steps\r\n */\r\n Engine.prototype.getLockstepMaxSteps = function () {\r\n return this._lockstepMaxSteps;\r\n };\r\n /**\r\n * Returns the time in ms between steps when using deterministic lock step.\r\n * @returns time step in (ms)\r\n */\r\n Engine.prototype.getTimeStep = function () {\r\n return this._timeStep * 1000;\r\n };\r\n /**\r\n * Force the mipmap generation for the given render target texture\r\n * @param texture defines the render target texture to use\r\n * @param unbind defines whether or not to unbind the texture after generation. Defaults to true.\r\n */\r\n Engine.prototype.generateMipMapsForCubemap = function (texture, unbind) {\r\n if (unbind === void 0) { unbind = true; }\r\n if (texture.generateMipMaps) {\r\n var gl = this._gl;\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\r\n if (unbind) {\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n }\r\n };\r\n /** States */\r\n /**\r\n * Set various states to the webGL context\r\n * @param culling defines backface culling state\r\n * @param zOffset defines the value to apply to zOffset (0 by default)\r\n * @param force defines if states must be applied even if cache is up to date\r\n * @param reverseSide defines if culling must be reversed (CCW instead of CW and CW instead of CCW)\r\n */\r\n Engine.prototype.setState = function (culling, zOffset, force, reverseSide) {\r\n if (zOffset === void 0) { zOffset = 0; }\r\n if (reverseSide === void 0) { reverseSide = false; }\r\n // Culling\r\n if (this._depthCullingState.cull !== culling || force) {\r\n this._depthCullingState.cull = culling;\r\n }\r\n // Cull face\r\n var cullFace = this.cullBackFaces ? this._gl.BACK : this._gl.FRONT;\r\n if (this._depthCullingState.cullFace !== cullFace || force) {\r\n this._depthCullingState.cullFace = cullFace;\r\n }\r\n // Z offset\r\n this.setZOffset(zOffset);\r\n // Front face\r\n var frontFace = reverseSide ? this._gl.CW : this._gl.CCW;\r\n if (this._depthCullingState.frontFace !== frontFace || force) {\r\n this._depthCullingState.frontFace = frontFace;\r\n }\r\n };\r\n /**\r\n * Set the z offset to apply to current rendering\r\n * @param value defines the offset to apply\r\n */\r\n Engine.prototype.setZOffset = function (value) {\r\n this._depthCullingState.zOffset = value;\r\n };\r\n /**\r\n * Gets the current value of the zOffset\r\n * @returns the current zOffset state\r\n */\r\n Engine.prototype.getZOffset = function () {\r\n return this._depthCullingState.zOffset;\r\n };\r\n /**\r\n * Enable or disable depth buffering\r\n * @param enable defines the state to set\r\n */\r\n Engine.prototype.setDepthBuffer = function (enable) {\r\n this._depthCullingState.depthTest = enable;\r\n };\r\n /**\r\n * Gets a boolean indicating if depth writing is enabled\r\n * @returns the current depth writing state\r\n */\r\n Engine.prototype.getDepthWrite = function () {\r\n return this._depthCullingState.depthMask;\r\n };\r\n /**\r\n * Enable or disable depth writing\r\n * @param enable defines the state to set\r\n */\r\n Engine.prototype.setDepthWrite = function (enable) {\r\n this._depthCullingState.depthMask = enable;\r\n };\r\n /**\r\n * Gets a boolean indicating if stencil buffer is enabled\r\n * @returns the current stencil buffer state\r\n */\r\n Engine.prototype.getStencilBuffer = function () {\r\n return this._stencilState.stencilTest;\r\n };\r\n /**\r\n * Enable or disable the stencil buffer\r\n * @param enable defines if the stencil buffer must be enabled or disabled\r\n */\r\n Engine.prototype.setStencilBuffer = function (enable) {\r\n this._stencilState.stencilTest = enable;\r\n };\r\n /**\r\n * Gets the current stencil mask\r\n * @returns a number defining the new stencil mask to use\r\n */\r\n Engine.prototype.getStencilMask = function () {\r\n return this._stencilState.stencilMask;\r\n };\r\n /**\r\n * Sets the current stencil mask\r\n * @param mask defines the new stencil mask to use\r\n */\r\n Engine.prototype.setStencilMask = function (mask) {\r\n this._stencilState.stencilMask = mask;\r\n };\r\n /**\r\n * Gets the current stencil function\r\n * @returns a number defining the stencil function to use\r\n */\r\n Engine.prototype.getStencilFunction = function () {\r\n return this._stencilState.stencilFunc;\r\n };\r\n /**\r\n * Gets the current stencil reference value\r\n * @returns a number defining the stencil reference value to use\r\n */\r\n Engine.prototype.getStencilFunctionReference = function () {\r\n return this._stencilState.stencilFuncRef;\r\n };\r\n /**\r\n * Gets the current stencil mask\r\n * @returns a number defining the stencil mask to use\r\n */\r\n Engine.prototype.getStencilFunctionMask = function () {\r\n return this._stencilState.stencilFuncMask;\r\n };\r\n /**\r\n * Sets the current stencil function\r\n * @param stencilFunc defines the new stencil function to use\r\n */\r\n Engine.prototype.setStencilFunction = function (stencilFunc) {\r\n this._stencilState.stencilFunc = stencilFunc;\r\n };\r\n /**\r\n * Sets the current stencil reference\r\n * @param reference defines the new stencil reference to use\r\n */\r\n Engine.prototype.setStencilFunctionReference = function (reference) {\r\n this._stencilState.stencilFuncRef = reference;\r\n };\r\n /**\r\n * Sets the current stencil mask\r\n * @param mask defines the new stencil mask to use\r\n */\r\n Engine.prototype.setStencilFunctionMask = function (mask) {\r\n this._stencilState.stencilFuncMask = mask;\r\n };\r\n /**\r\n * Gets the current stencil operation when stencil fails\r\n * @returns a number defining stencil operation to use when stencil fails\r\n */\r\n Engine.prototype.getStencilOperationFail = function () {\r\n return this._stencilState.stencilOpStencilFail;\r\n };\r\n /**\r\n * Gets the current stencil operation when depth fails\r\n * @returns a number defining stencil operation to use when depth fails\r\n */\r\n Engine.prototype.getStencilOperationDepthFail = function () {\r\n return this._stencilState.stencilOpDepthFail;\r\n };\r\n /**\r\n * Gets the current stencil operation when stencil passes\r\n * @returns a number defining stencil operation to use when stencil passes\r\n */\r\n Engine.prototype.getStencilOperationPass = function () {\r\n return this._stencilState.stencilOpStencilDepthPass;\r\n };\r\n /**\r\n * Sets the stencil operation to use when stencil fails\r\n * @param operation defines the stencil operation to use when stencil fails\r\n */\r\n Engine.prototype.setStencilOperationFail = function (operation) {\r\n this._stencilState.stencilOpStencilFail = operation;\r\n };\r\n /**\r\n * Sets the stencil operation to use when depth fails\r\n * @param operation defines the stencil operation to use when depth fails\r\n */\r\n Engine.prototype.setStencilOperationDepthFail = function (operation) {\r\n this._stencilState.stencilOpDepthFail = operation;\r\n };\r\n /**\r\n * Sets the stencil operation to use when stencil passes\r\n * @param operation defines the stencil operation to use when stencil passes\r\n */\r\n Engine.prototype.setStencilOperationPass = function (operation) {\r\n this._stencilState.stencilOpStencilDepthPass = operation;\r\n };\r\n /**\r\n * Sets a boolean indicating if the dithering state is enabled or disabled\r\n * @param value defines the dithering state\r\n */\r\n Engine.prototype.setDitheringState = function (value) {\r\n if (value) {\r\n this._gl.enable(this._gl.DITHER);\r\n }\r\n else {\r\n this._gl.disable(this._gl.DITHER);\r\n }\r\n };\r\n /**\r\n * Sets a boolean indicating if the rasterizer state is enabled or disabled\r\n * @param value defines the rasterizer state\r\n */\r\n Engine.prototype.setRasterizerState = function (value) {\r\n if (value) {\r\n this._gl.disable(this._gl.RASTERIZER_DISCARD);\r\n }\r\n else {\r\n this._gl.enable(this._gl.RASTERIZER_DISCARD);\r\n }\r\n };\r\n /**\r\n * Gets the current depth function\r\n * @returns a number defining the depth function\r\n */\r\n Engine.prototype.getDepthFunction = function () {\r\n return this._depthCullingState.depthFunc;\r\n };\r\n /**\r\n * Sets the current depth function\r\n * @param depthFunc defines the function to use\r\n */\r\n Engine.prototype.setDepthFunction = function (depthFunc) {\r\n this._depthCullingState.depthFunc = depthFunc;\r\n };\r\n /**\r\n * Sets the current depth function to GREATER\r\n */\r\n Engine.prototype.setDepthFunctionToGreater = function () {\r\n this._depthCullingState.depthFunc = this._gl.GREATER;\r\n };\r\n /**\r\n * Sets the current depth function to GEQUAL\r\n */\r\n Engine.prototype.setDepthFunctionToGreaterOrEqual = function () {\r\n this._depthCullingState.depthFunc = this._gl.GEQUAL;\r\n };\r\n /**\r\n * Sets the current depth function to LESS\r\n */\r\n Engine.prototype.setDepthFunctionToLess = function () {\r\n this._depthCullingState.depthFunc = this._gl.LESS;\r\n };\r\n /**\r\n * Sets the current depth function to LEQUAL\r\n */\r\n Engine.prototype.setDepthFunctionToLessOrEqual = function () {\r\n this._depthCullingState.depthFunc = this._gl.LEQUAL;\r\n };\r\n /**\r\n * Caches the the state of the stencil buffer\r\n */\r\n Engine.prototype.cacheStencilState = function () {\r\n this._cachedStencilBuffer = this.getStencilBuffer();\r\n this._cachedStencilFunction = this.getStencilFunction();\r\n this._cachedStencilMask = this.getStencilMask();\r\n this._cachedStencilOperationPass = this.getStencilOperationPass();\r\n this._cachedStencilOperationFail = this.getStencilOperationFail();\r\n this._cachedStencilOperationDepthFail = this.getStencilOperationDepthFail();\r\n this._cachedStencilReference = this.getStencilFunctionReference();\r\n };\r\n /**\r\n * Restores the state of the stencil buffer\r\n */\r\n Engine.prototype.restoreStencilState = function () {\r\n this.setStencilFunction(this._cachedStencilFunction);\r\n this.setStencilMask(this._cachedStencilMask);\r\n this.setStencilBuffer(this._cachedStencilBuffer);\r\n this.setStencilOperationPass(this._cachedStencilOperationPass);\r\n this.setStencilOperationFail(this._cachedStencilOperationFail);\r\n this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail);\r\n this.setStencilFunctionReference(this._cachedStencilReference);\r\n };\r\n /**\r\n * Directly set the WebGL Viewport\r\n * @param x defines the x coordinate of the viewport (in screen space)\r\n * @param y defines the y coordinate of the viewport (in screen space)\r\n * @param width defines the width of the viewport (in screen space)\r\n * @param height defines the height of the viewport (in screen space)\r\n * @return the current viewport Object (if any) that is being replaced by this call. You can restore this viewport later on to go back to the original state\r\n */\r\n Engine.prototype.setDirectViewport = function (x, y, width, height) {\r\n var currentViewport = this._cachedViewport;\r\n this._cachedViewport = null;\r\n this._viewport(x, y, width, height);\r\n return currentViewport;\r\n };\r\n /**\r\n * Executes a scissor clear (ie. a clear on a specific portion of the screen)\r\n * @param x defines the x-coordinate of the top left corner of the clear rectangle\r\n * @param y defines the y-coordinate of the corner of the clear rectangle\r\n * @param width defines the width of the clear rectangle\r\n * @param height defines the height of the clear rectangle\r\n * @param clearColor defines the clear color\r\n */\r\n Engine.prototype.scissorClear = function (x, y, width, height, clearColor) {\r\n this.enableScissor(x, y, width, height);\r\n this.clear(clearColor, true, true, true);\r\n this.disableScissor();\r\n };\r\n /**\r\n * Enable scissor test on a specific rectangle (ie. render will only be executed on a specific portion of the screen)\r\n * @param x defines the x-coordinate of the top left corner of the clear rectangle\r\n * @param y defines the y-coordinate of the corner of the clear rectangle\r\n * @param width defines the width of the clear rectangle\r\n * @param height defines the height of the clear rectangle\r\n */\r\n Engine.prototype.enableScissor = function (x, y, width, height) {\r\n var gl = this._gl;\r\n // Change state\r\n gl.enable(gl.SCISSOR_TEST);\r\n gl.scissor(x, y, width, height);\r\n };\r\n /**\r\n * Disable previously set scissor test rectangle\r\n */\r\n Engine.prototype.disableScissor = function () {\r\n var gl = this._gl;\r\n gl.disable(gl.SCISSOR_TEST);\r\n };\r\n Engine.prototype._reportDrawCall = function () {\r\n this._drawCalls.addCount(1, false);\r\n };\r\n /**\r\n * Initializes a webVR display and starts listening to display change events\r\n * The onVRDisplayChangedObservable will be notified upon these changes\r\n * @returns The onVRDisplayChangedObservable\r\n */\r\n Engine.prototype.initWebVR = function () {\r\n throw _DevTools.WarnImport(\"WebVRCamera\");\r\n };\r\n /** @hidden */\r\n Engine.prototype._prepareVRComponent = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /** @hidden */\r\n Engine.prototype._connectVREvents = function (canvas, document) {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /** @hidden */\r\n Engine.prototype._submitVRFrame = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /**\r\n * Call this function to leave webVR mode\r\n * Will do nothing if webVR is not supported or if there is no webVR device\r\n * @see https://doc.babylonjs.com/how_to/webvr_camera\r\n */\r\n Engine.prototype.disableVR = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /**\r\n * Gets a boolean indicating that the system is in VR mode and is presenting\r\n * @returns true if VR mode is engaged\r\n */\r\n Engine.prototype.isVRPresenting = function () {\r\n return false;\r\n };\r\n /** @hidden */\r\n Engine.prototype._requestVRFrame = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /** @hidden */\r\n Engine.prototype._loadFileAsync = function (url, offlineProvider, useArrayBuffer) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._loadFile(url, function (data) {\r\n resolve(data);\r\n }, undefined, offlineProvider, useArrayBuffer, function (request, exception) {\r\n reject(exception);\r\n });\r\n });\r\n };\r\n /**\r\n * Gets the source code of the vertex shader associated with a specific webGL program\r\n * @param program defines the program to use\r\n * @returns a string containing the source code of the vertex shader associated with the program\r\n */\r\n Engine.prototype.getVertexShaderSource = function (program) {\r\n var shaders = this._gl.getAttachedShaders(program);\r\n if (!shaders) {\r\n return null;\r\n }\r\n return this._gl.getShaderSource(shaders[0]);\r\n };\r\n /**\r\n * Gets the source code of the fragment shader associated with a specific webGL program\r\n * @param program defines the program to use\r\n * @returns a string containing the source code of the fragment shader associated with the program\r\n */\r\n Engine.prototype.getFragmentShaderSource = function (program) {\r\n var shaders = this._gl.getAttachedShaders(program);\r\n if (!shaders) {\r\n return null;\r\n }\r\n return this._gl.getShaderSource(shaders[1]);\r\n };\r\n /**\r\n * Sets a depth stencil texture from a render target to the according uniform.\r\n * @param channel The texture channel\r\n * @param uniform The uniform to set\r\n * @param texture The render target texture containing the depth stencil texture to apply\r\n */\r\n Engine.prototype.setDepthStencilTexture = function (channel, uniform, texture) {\r\n if (channel === undefined) {\r\n return;\r\n }\r\n if (uniform) {\r\n this._boundUniforms[channel] = uniform;\r\n }\r\n if (!texture || !texture.depthStencilTexture) {\r\n this._setTexture(channel, null);\r\n }\r\n else {\r\n this._setTexture(channel, texture, false, true);\r\n }\r\n };\r\n /**\r\n * Sets a texture to the webGL context from a postprocess\r\n * @param channel defines the channel to use\r\n * @param postProcess defines the source postprocess\r\n */\r\n Engine.prototype.setTextureFromPostProcess = function (channel, postProcess) {\r\n this._bindTexture(channel, postProcess ? postProcess._textures.data[postProcess._currentRenderTextureInd] : null);\r\n };\r\n /**\r\n * Binds the output of the passed in post process to the texture channel specified\r\n * @param channel The channel the texture should be bound to\r\n * @param postProcess The post process which's output should be bound\r\n */\r\n Engine.prototype.setTextureFromPostProcessOutput = function (channel, postProcess) {\r\n this._bindTexture(channel, postProcess ? postProcess._outputTexture : null);\r\n };\r\n Engine.prototype._rebuildBuffers = function () {\r\n // Index / Vertex\r\n for (var _i = 0, _a = this.scenes; _i < _a.length; _i++) {\r\n var scene = _a[_i];\r\n scene.resetCachedMaterial();\r\n scene._rebuildGeometries();\r\n scene._rebuildTextures();\r\n }\r\n _super.prototype._rebuildBuffers.call(this);\r\n };\r\n /** @hidden */\r\n Engine.prototype._renderFrame = function () {\r\n for (var index = 0; index < this._activeRenderLoops.length; index++) {\r\n var renderFunction = this._activeRenderLoops[index];\r\n renderFunction();\r\n }\r\n };\r\n Engine.prototype._renderLoop = function () {\r\n if (!this._contextWasLost) {\r\n var shouldRender = true;\r\n if (!this.renderEvenInBackground && this._windowIsBackground) {\r\n shouldRender = false;\r\n }\r\n if (shouldRender) {\r\n // Start new frame\r\n this.beginFrame();\r\n // Child canvases\r\n if (!this._renderViews()) {\r\n // Main frame\r\n this._renderFrame();\r\n }\r\n // Present\r\n this.endFrame();\r\n }\r\n }\r\n if (this._activeRenderLoops.length > 0) {\r\n // Register new frame\r\n if (this.customAnimationFrameRequester) {\r\n this.customAnimationFrameRequester.requestID = this._queueNewFrame(this.customAnimationFrameRequester.renderFunction || this._boundRenderFunction, this.customAnimationFrameRequester);\r\n this._frameHandler = this.customAnimationFrameRequester.requestID;\r\n }\r\n else if (this.isVRPresenting()) {\r\n this._requestVRFrame();\r\n }\r\n else {\r\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\r\n }\r\n }\r\n else {\r\n this._renderingQueueLaunched = false;\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._renderViews = function () {\r\n return false;\r\n };\r\n /**\r\n * Toggle full screen mode\r\n * @param requestPointerLock defines if a pointer lock should be requested from the user\r\n */\r\n Engine.prototype.switchFullscreen = function (requestPointerLock) {\r\n if (this.isFullscreen) {\r\n this.exitFullscreen();\r\n }\r\n else {\r\n this.enterFullscreen(requestPointerLock);\r\n }\r\n };\r\n /**\r\n * Enters full screen mode\r\n * @param requestPointerLock defines if a pointer lock should be requested from the user\r\n */\r\n Engine.prototype.enterFullscreen = function (requestPointerLock) {\r\n if (!this.isFullscreen) {\r\n this._pointerLockRequested = requestPointerLock;\r\n if (this._renderingCanvas) {\r\n Engine._RequestFullscreen(this._renderingCanvas);\r\n }\r\n }\r\n };\r\n /**\r\n * Exits full screen mode\r\n */\r\n Engine.prototype.exitFullscreen = function () {\r\n if (this.isFullscreen) {\r\n Engine._ExitFullscreen();\r\n }\r\n };\r\n /**\r\n * Enters Pointerlock mode\r\n */\r\n Engine.prototype.enterPointerlock = function () {\r\n if (this._renderingCanvas) {\r\n Engine._RequestPointerlock(this._renderingCanvas);\r\n }\r\n };\r\n /**\r\n * Exits Pointerlock mode\r\n */\r\n Engine.prototype.exitPointerlock = function () {\r\n Engine._ExitPointerlock();\r\n };\r\n /**\r\n * Begin a new frame\r\n */\r\n Engine.prototype.beginFrame = function () {\r\n this._measureFps();\r\n this.onBeginFrameObservable.notifyObservers(this);\r\n _super.prototype.beginFrame.call(this);\r\n };\r\n /**\r\n * Enf the current frame\r\n */\r\n Engine.prototype.endFrame = function () {\r\n _super.prototype.endFrame.call(this);\r\n this._submitVRFrame();\r\n this.onEndFrameObservable.notifyObservers(this);\r\n };\r\n Engine.prototype.resize = function () {\r\n // We're not resizing the size of the canvas while in VR mode & presenting\r\n if (this.isVRPresenting()) {\r\n return;\r\n }\r\n _super.prototype.resize.call(this);\r\n };\r\n /**\r\n * Force a specific size of the canvas\r\n * @param width defines the new canvas' width\r\n * @param height defines the new canvas' height\r\n * @returns true if the size was changed\r\n */\r\n Engine.prototype.setSize = function (width, height) {\r\n if (!this._renderingCanvas) {\r\n return false;\r\n }\r\n if (!_super.prototype.setSize.call(this, width, height)) {\r\n return false;\r\n }\r\n if (this.scenes) {\r\n for (var index = 0; index < this.scenes.length; index++) {\r\n var scene = this.scenes[index];\r\n for (var camIndex = 0; camIndex < scene.cameras.length; camIndex++) {\r\n var cam = scene.cameras[camIndex];\r\n cam._currentRenderId = 0;\r\n }\r\n }\r\n if (this.onResizeObservable.hasObservers()) {\r\n this.onResizeObservable.notifyObservers(this);\r\n }\r\n }\r\n return true;\r\n };\r\n Engine.prototype._deletePipelineContext = function (pipelineContext) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (webGLPipelineContext && webGLPipelineContext.program) {\r\n if (webGLPipelineContext.transformFeedback) {\r\n this.deleteTransformFeedback(webGLPipelineContext.transformFeedback);\r\n webGLPipelineContext.transformFeedback = null;\r\n }\r\n }\r\n _super.prototype._deletePipelineContext.call(this, pipelineContext);\r\n };\r\n Engine.prototype.createShaderProgram = function (pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n context = context || this._gl;\r\n this.onBeforeShaderCompilationObservable.notifyObservers(this);\r\n var program = _super.prototype.createShaderProgram.call(this, pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings);\r\n this.onAfterShaderCompilationObservable.notifyObservers(this);\r\n return program;\r\n };\r\n Engine.prototype._createShaderProgram = function (pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n var shaderProgram = context.createProgram();\r\n pipelineContext.program = shaderProgram;\r\n if (!shaderProgram) {\r\n throw new Error(\"Unable to create program\");\r\n }\r\n context.attachShader(shaderProgram, vertexShader);\r\n context.attachShader(shaderProgram, fragmentShader);\r\n if (this.webGLVersion > 1 && transformFeedbackVaryings) {\r\n var transformFeedback = this.createTransformFeedback();\r\n this.bindTransformFeedback(transformFeedback);\r\n this.setTranformFeedbackVaryings(shaderProgram, transformFeedbackVaryings);\r\n pipelineContext.transformFeedback = transformFeedback;\r\n }\r\n context.linkProgram(shaderProgram);\r\n if (this.webGLVersion > 1 && transformFeedbackVaryings) {\r\n this.bindTransformFeedback(null);\r\n }\r\n pipelineContext.context = context;\r\n pipelineContext.vertexShader = vertexShader;\r\n pipelineContext.fragmentShader = fragmentShader;\r\n if (!pipelineContext.isParallelCompiled) {\r\n this._finalizePipelineContext(pipelineContext);\r\n }\r\n return shaderProgram;\r\n };\r\n Engine.prototype._releaseTexture = function (texture) {\r\n _super.prototype._releaseTexture.call(this, texture);\r\n // Set output texture of post process to null if the texture has been released/disposed\r\n this.scenes.forEach(function (scene) {\r\n scene.postProcesses.forEach(function (postProcess) {\r\n if (postProcess._outputTexture == texture) {\r\n postProcess._outputTexture = null;\r\n }\r\n });\r\n scene.cameras.forEach(function (camera) {\r\n camera._postProcesses.forEach(function (postProcess) {\r\n if (postProcess) {\r\n if (postProcess._outputTexture == texture) {\r\n postProcess._outputTexture = null;\r\n }\r\n }\r\n });\r\n });\r\n });\r\n };\r\n /**\r\n * @hidden\r\n * Rescales a texture\r\n * @param source input texutre\r\n * @param destination destination texture\r\n * @param scene scene to use to render the resize\r\n * @param internalFormat format to use when resizing\r\n * @param onComplete callback to be called when resize has completed\r\n */\r\n Engine.prototype._rescaleTexture = function (source, destination, scene, internalFormat, onComplete) {\r\n var _this = this;\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE);\r\n var rtt = this.createRenderTargetTexture({\r\n width: destination.width,\r\n height: destination.height,\r\n }, {\r\n generateMipMaps: false,\r\n type: 0,\r\n samplingMode: 2,\r\n generateDepthBuffer: false,\r\n generateStencilBuffer: false\r\n });\r\n if (!this._rescalePostProcess && Engine._RescalePostProcessFactory) {\r\n this._rescalePostProcess = Engine._RescalePostProcessFactory(this);\r\n }\r\n this._rescalePostProcess.getEffect().executeWhenCompiled(function () {\r\n _this._rescalePostProcess.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", source);\r\n };\r\n var hostingScene = scene;\r\n if (!hostingScene) {\r\n hostingScene = _this.scenes[_this.scenes.length - 1];\r\n }\r\n hostingScene.postProcessManager.directRender([_this._rescalePostProcess], rtt, true);\r\n _this._bindTextureDirectly(_this._gl.TEXTURE_2D, destination, true);\r\n _this._gl.copyTexImage2D(_this._gl.TEXTURE_2D, 0, internalFormat, 0, 0, destination.width, destination.height, 0);\r\n _this.unBindFramebuffer(rtt);\r\n _this._releaseTexture(rtt);\r\n if (onComplete) {\r\n onComplete();\r\n }\r\n });\r\n };\r\n // FPS\r\n /**\r\n * Gets the current framerate\r\n * @returns a number representing the framerate\r\n */\r\n Engine.prototype.getFps = function () {\r\n return this._fps;\r\n };\r\n /**\r\n * Gets the time spent between current and previous frame\r\n * @returns a number representing the delta time in ms\r\n */\r\n Engine.prototype.getDeltaTime = function () {\r\n return this._deltaTime;\r\n };\r\n Engine.prototype._measureFps = function () {\r\n this._performanceMonitor.sampleFrame();\r\n this._fps = this._performanceMonitor.averageFPS;\r\n this._deltaTime = this._performanceMonitor.instantaneousFrameTime || 0;\r\n };\r\n /** @hidden */\r\n Engine.prototype._uploadImageToTexture = function (texture, image, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(texture.type);\r\n var format = this._getInternalFormat(texture.format);\r\n var internalFormat = this._getRGBABufferInternalSizedFormat(texture.type, format);\r\n var bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\r\n this._bindTextureDirectly(bindTarget, texture, true);\r\n this._unpackFlipY(texture.invertY);\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n gl.texImage2D(target, lod, internalFormat, format, textureType, image);\r\n this._bindTextureDirectly(bindTarget, null, true);\r\n };\r\n /**\r\n * Updates the sample count of a render target texture\r\n * @see https://doc.babylonjs.com/features/webgl2#multisample-render-targets\r\n * @param texture defines the texture to update\r\n * @param samples defines the sample count to set\r\n * @returns the effective sample count (could be 0 if multisample render targets are not supported)\r\n */\r\n Engine.prototype.updateRenderTargetTextureSampleCount = function (texture, samples) {\r\n if (this.webGLVersion < 2 || !texture) {\r\n return 1;\r\n }\r\n if (texture.samples === samples) {\r\n return samples;\r\n }\r\n var gl = this._gl;\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n // Dispose previous render buffers\r\n if (texture._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(texture._depthStencilBuffer);\r\n texture._depthStencilBuffer = null;\r\n }\r\n if (texture._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(texture._MSAAFramebuffer);\r\n texture._MSAAFramebuffer = null;\r\n }\r\n if (texture._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(texture._MSAARenderBuffer);\r\n texture._MSAARenderBuffer = null;\r\n }\r\n if (samples > 1 && gl.renderbufferStorageMultisample) {\r\n var framebuffer = gl.createFramebuffer();\r\n if (!framebuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n texture._MSAAFramebuffer = framebuffer;\r\n this._bindUnboundFramebuffer(texture._MSAAFramebuffer);\r\n var colorRenderbuffer = gl.createRenderbuffer();\r\n if (!colorRenderbuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, colorRenderbuffer);\r\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, this._getRGBAMultiSampleBufferFormat(texture.type), texture.width, texture.height);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, colorRenderbuffer);\r\n texture._MSAARenderBuffer = colorRenderbuffer;\r\n }\r\n else {\r\n this._bindUnboundFramebuffer(texture._framebuffer);\r\n }\r\n texture.samples = samples;\r\n texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(texture._generateStencilBuffer, texture._generateDepthBuffer, texture.width, texture.height, samples);\r\n this._bindUnboundFramebuffer(null);\r\n return samples;\r\n };\r\n /**\r\n * Updates a depth texture Comparison Mode and Function.\r\n * If the comparison Function is equal to 0, the mode will be set to none.\r\n * Otherwise, this only works in webgl 2 and requires a shadow sampler in the shader.\r\n * @param texture The texture to set the comparison function for\r\n * @param comparisonFunction The comparison function to set, 0 if no comparison required\r\n */\r\n Engine.prototype.updateTextureComparisonFunction = function (texture, comparisonFunction) {\r\n if (this.webGLVersion === 1) {\r\n Logger.Error(\"WebGL 1 does not support texture comparison.\");\r\n return;\r\n }\r\n var gl = this._gl;\r\n if (texture.isCube) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);\r\n if (comparisonFunction === 0) {\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, 515);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.NONE);\r\n }\r\n else {\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n else {\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n if (comparisonFunction === 0) {\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, 515);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.NONE);\r\n }\r\n else {\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n }\r\n texture._comparisonFunction = comparisonFunction;\r\n };\r\n /**\r\n * Creates a webGL buffer to use with instanciation\r\n * @param capacity defines the size of the buffer\r\n * @returns the webGL buffer\r\n */\r\n Engine.prototype.createInstancesBuffer = function (capacity) {\r\n var buffer = this._gl.createBuffer();\r\n if (!buffer) {\r\n throw new Error(\"Unable to create instance buffer\");\r\n }\r\n var result = new WebGLDataBuffer(buffer);\r\n result.capacity = capacity;\r\n this.bindArrayBuffer(result);\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, capacity, this._gl.DYNAMIC_DRAW);\r\n return result;\r\n };\r\n /**\r\n * Delete a webGL buffer used with instanciation\r\n * @param buffer defines the webGL buffer to delete\r\n */\r\n Engine.prototype.deleteInstancesBuffer = function (buffer) {\r\n this._gl.deleteBuffer(buffer);\r\n };\r\n Engine.prototype._clientWaitAsync = function (sync, flags, interval_ms) {\r\n if (flags === void 0) { flags = 0; }\r\n if (interval_ms === void 0) { interval_ms = 10; }\r\n var gl = this._gl;\r\n return new Promise(function (resolve, reject) {\r\n var check = function () {\r\n var res = gl.clientWaitSync(sync, flags, 0);\r\n if (res == gl.WAIT_FAILED) {\r\n reject();\r\n return;\r\n }\r\n if (res == gl.TIMEOUT_EXPIRED) {\r\n setTimeout(check, interval_ms);\r\n return;\r\n }\r\n resolve();\r\n };\r\n check();\r\n });\r\n };\r\n /** @hidden */\r\n Engine.prototype._readPixelsAsync = function (x, y, w, h, format, type, outputBuffer) {\r\n if (this._webGLVersion < 2) {\r\n throw new Error(\"_readPixelsAsync only work on WebGL2+\");\r\n }\r\n var gl = this._gl;\r\n var buf = gl.createBuffer();\r\n gl.bindBuffer(gl.PIXEL_PACK_BUFFER, buf);\r\n gl.bufferData(gl.PIXEL_PACK_BUFFER, outputBuffer.byteLength, gl.STREAM_READ);\r\n gl.readPixels(x, y, w, h, format, type, 0);\r\n gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);\r\n var sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);\r\n if (!sync) {\r\n return null;\r\n }\r\n gl.flush();\r\n return this._clientWaitAsync(sync, 0, 10).then(function () {\r\n gl.deleteSync(sync);\r\n gl.bindBuffer(gl.PIXEL_PACK_BUFFER, buf);\r\n gl.getBufferSubData(gl.PIXEL_PACK_BUFFER, 0, outputBuffer);\r\n gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);\r\n gl.deleteBuffer(buf);\r\n return outputBuffer;\r\n });\r\n };\r\n Engine.prototype.dispose = function () {\r\n this.hideLoadingUI();\r\n this.onNewSceneAddedObservable.clear();\r\n // Release postProcesses\r\n while (this.postProcesses.length) {\r\n this.postProcesses[0].dispose();\r\n }\r\n // Rescale PP\r\n if (this._rescalePostProcess) {\r\n this._rescalePostProcess.dispose();\r\n }\r\n // Release scenes\r\n while (this.scenes.length) {\r\n this.scenes[0].dispose();\r\n }\r\n // Release audio engine\r\n if (Engine.Instances.length === 1 && Engine.audioEngine) {\r\n Engine.audioEngine.dispose();\r\n }\r\n //WebVR\r\n this.disableVR();\r\n // Events\r\n if (DomManagement.IsWindowObjectExist()) {\r\n window.removeEventListener(\"blur\", this._onBlur);\r\n window.removeEventListener(\"focus\", this._onFocus);\r\n if (this._renderingCanvas) {\r\n this._renderingCanvas.removeEventListener(\"focus\", this._onCanvasFocus);\r\n this._renderingCanvas.removeEventListener(\"blur\", this._onCanvasBlur);\r\n this._renderingCanvas.removeEventListener(\"pointerout\", this._onCanvasPointerOut);\r\n }\r\n if (DomManagement.IsDocumentAvailable()) {\r\n document.removeEventListener(\"fullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"mozfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"webkitfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"msfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"pointerlockchange\", this._onPointerLockChange);\r\n document.removeEventListener(\"mspointerlockchange\", this._onPointerLockChange);\r\n document.removeEventListener(\"mozpointerlockchange\", this._onPointerLockChange);\r\n document.removeEventListener(\"webkitpointerlockchange\", this._onPointerLockChange);\r\n }\r\n }\r\n _super.prototype.dispose.call(this);\r\n // Remove from Instances\r\n var index = Engine.Instances.indexOf(this);\r\n if (index >= 0) {\r\n Engine.Instances.splice(index, 1);\r\n }\r\n // Observables\r\n this.onResizeObservable.clear();\r\n this.onCanvasBlurObservable.clear();\r\n this.onCanvasFocusObservable.clear();\r\n this.onCanvasPointerOutObservable.clear();\r\n this.onBeginFrameObservable.clear();\r\n this.onEndFrameObservable.clear();\r\n };\r\n Engine.prototype._disableTouchAction = function () {\r\n if (!this._renderingCanvas || !this._renderingCanvas.setAttribute) {\r\n return;\r\n }\r\n this._renderingCanvas.setAttribute(\"touch-action\", \"none\");\r\n this._renderingCanvas.style.touchAction = \"none\";\r\n this._renderingCanvas.style.msTouchAction = \"none\";\r\n };\r\n // Loading screen\r\n /**\r\n * Display the loading screen\r\n * @see https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n Engine.prototype.displayLoadingUI = function () {\r\n if (!DomManagement.IsWindowObjectExist()) {\r\n return;\r\n }\r\n var loadingScreen = this.loadingScreen;\r\n if (loadingScreen) {\r\n loadingScreen.displayLoadingUI();\r\n }\r\n };\r\n /**\r\n * Hide the loading screen\r\n * @see https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n Engine.prototype.hideLoadingUI = function () {\r\n if (!DomManagement.IsWindowObjectExist()) {\r\n return;\r\n }\r\n var loadingScreen = this._loadingScreen;\r\n if (loadingScreen) {\r\n loadingScreen.hideLoadingUI();\r\n }\r\n };\r\n Object.defineProperty(Engine.prototype, \"loadingScreen\", {\r\n /**\r\n * Gets the current loading screen object\r\n * @see https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n get: function () {\r\n if (!this._loadingScreen && this._renderingCanvas) {\r\n this._loadingScreen = Engine.DefaultLoadingScreenFactory(this._renderingCanvas);\r\n }\r\n return this._loadingScreen;\r\n },\r\n /**\r\n * Sets the current loading screen object\r\n * @see https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n set: function (loadingScreen) {\r\n this._loadingScreen = loadingScreen;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"loadingUIText\", {\r\n /**\r\n * Sets the current loading screen text\r\n * @see https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n set: function (text) {\r\n this.loadingScreen.loadingUIText = text;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"loadingUIBackgroundColor\", {\r\n /**\r\n * Sets the current loading screen background color\r\n * @see https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n set: function (color) {\r\n this.loadingScreen.loadingUIBackgroundColor = color;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** Pointerlock and fullscreen */\r\n /**\r\n * Ask the browser to promote the current element to pointerlock mode\r\n * @param element defines the DOM element to promote\r\n */\r\n Engine._RequestPointerlock = function (element) {\r\n element.requestPointerLock = element.requestPointerLock || element.msRequestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock;\r\n if (element.requestPointerLock) {\r\n element.requestPointerLock();\r\n }\r\n };\r\n /**\r\n * Asks the browser to exit pointerlock mode\r\n */\r\n Engine._ExitPointerlock = function () {\r\n var anyDoc = document;\r\n document.exitPointerLock = document.exitPointerLock || anyDoc.msExitPointerLock || anyDoc.mozExitPointerLock || anyDoc.webkitExitPointerLock;\r\n if (document.exitPointerLock) {\r\n document.exitPointerLock();\r\n }\r\n };\r\n /**\r\n * Ask the browser to promote the current element to fullscreen rendering mode\r\n * @param element defines the DOM element to promote\r\n */\r\n Engine._RequestFullscreen = function (element) {\r\n var requestFunction = element.requestFullscreen || element.msRequestFullscreen || element.webkitRequestFullscreen || element.mozRequestFullScreen;\r\n if (!requestFunction) {\r\n return;\r\n }\r\n requestFunction.call(element);\r\n };\r\n /**\r\n * Asks the browser to exit fullscreen mode\r\n */\r\n Engine._ExitFullscreen = function () {\r\n var anyDoc = document;\r\n if (document.exitFullscreen) {\r\n document.exitFullscreen();\r\n }\r\n else if (anyDoc.mozCancelFullScreen) {\r\n anyDoc.mozCancelFullScreen();\r\n }\r\n else if (anyDoc.webkitCancelFullScreen) {\r\n anyDoc.webkitCancelFullScreen();\r\n }\r\n else if (anyDoc.msCancelFullScreen) {\r\n anyDoc.msCancelFullScreen();\r\n }\r\n };\r\n // Const statics\r\n /** Defines that alpha blending is disabled */\r\n Engine.ALPHA_DISABLE = 0;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + DEST */\r\n Engine.ALPHA_ADD = 1;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */\r\n Engine.ALPHA_COMBINE = 2;\r\n /** Defines that alpha blending to DEST - SRC * DEST */\r\n Engine.ALPHA_SUBTRACT = 3;\r\n /** Defines that alpha blending to SRC * DEST */\r\n Engine.ALPHA_MULTIPLY = 4;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST */\r\n Engine.ALPHA_MAXIMIZED = 5;\r\n /** Defines that alpha blending to SRC + DEST */\r\n Engine.ALPHA_ONEONE = 6;\r\n /** Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST */\r\n Engine.ALPHA_PREMULTIPLIED = 7;\r\n /**\r\n * Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST\r\n * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Engine.ALPHA_PREMULTIPLIED_PORTERDUFF = 8;\r\n /** Defines that alpha blending to CST * SRC + (1 - CST) * DEST */\r\n Engine.ALPHA_INTERPOLATE = 9;\r\n /**\r\n * Defines that alpha blending to SRC + (1 - SRC) * DEST\r\n * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Engine.ALPHA_SCREENMODE = 10;\r\n /** Defines that the ressource is not delayed*/\r\n Engine.DELAYLOADSTATE_NONE = 0;\r\n /** Defines that the ressource was successfully delay loaded */\r\n Engine.DELAYLOADSTATE_LOADED = 1;\r\n /** Defines that the ressource is currently delay loading */\r\n Engine.DELAYLOADSTATE_LOADING = 2;\r\n /** Defines that the ressource is delayed and has not started loading */\r\n Engine.DELAYLOADSTATE_NOTLOADED = 4;\r\n // Depht or Stencil test Constants.\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */\r\n Engine.NEVER = 512;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\r\n Engine.ALWAYS = 519;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */\r\n Engine.LESS = 513;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */\r\n Engine.EQUAL = 514;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */\r\n Engine.LEQUAL = 515;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */\r\n Engine.GREATER = 516;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */\r\n Engine.GEQUAL = 518;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */\r\n Engine.NOTEQUAL = 517;\r\n // Stencil Actions Constants.\r\n /** Passed to stencilOperation to specify that stencil value must be kept */\r\n Engine.KEEP = 7680;\r\n /** Passed to stencilOperation to specify that stencil value must be replaced */\r\n Engine.REPLACE = 7681;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented */\r\n Engine.INCR = 7682;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented */\r\n Engine.DECR = 7683;\r\n /** Passed to stencilOperation to specify that stencil value must be inverted */\r\n Engine.INVERT = 5386;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */\r\n Engine.INCR_WRAP = 34055;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */\r\n Engine.DECR_WRAP = 34056;\r\n /** Texture is not repeating outside of 0..1 UVs */\r\n Engine.TEXTURE_CLAMP_ADDRESSMODE = 0;\r\n /** Texture is repeating outside of 0..1 UVs */\r\n Engine.TEXTURE_WRAP_ADDRESSMODE = 1;\r\n /** Texture is repeating and mirrored */\r\n Engine.TEXTURE_MIRROR_ADDRESSMODE = 2;\r\n /** ALPHA */\r\n Engine.TEXTUREFORMAT_ALPHA = 0;\r\n /** LUMINANCE */\r\n Engine.TEXTUREFORMAT_LUMINANCE = 1;\r\n /** LUMINANCE_ALPHA */\r\n Engine.TEXTUREFORMAT_LUMINANCE_ALPHA = 2;\r\n /** RGB */\r\n Engine.TEXTUREFORMAT_RGB = 4;\r\n /** RGBA */\r\n Engine.TEXTUREFORMAT_RGBA = 5;\r\n /** RED */\r\n Engine.TEXTUREFORMAT_RED = 6;\r\n /** RED (2nd reference) */\r\n Engine.TEXTUREFORMAT_R = 6;\r\n /** RG */\r\n Engine.TEXTUREFORMAT_RG = 7;\r\n /** RED_INTEGER */\r\n Engine.TEXTUREFORMAT_RED_INTEGER = 8;\r\n /** RED_INTEGER (2nd reference) */\r\n Engine.TEXTUREFORMAT_R_INTEGER = 8;\r\n /** RG_INTEGER */\r\n Engine.TEXTUREFORMAT_RG_INTEGER = 9;\r\n /** RGB_INTEGER */\r\n Engine.TEXTUREFORMAT_RGB_INTEGER = 10;\r\n /** RGBA_INTEGER */\r\n Engine.TEXTUREFORMAT_RGBA_INTEGER = 11;\r\n /** UNSIGNED_BYTE */\r\n Engine.TEXTURETYPE_UNSIGNED_BYTE = 0;\r\n /** UNSIGNED_BYTE (2nd reference) */\r\n Engine.TEXTURETYPE_UNSIGNED_INT = 0;\r\n /** FLOAT */\r\n Engine.TEXTURETYPE_FLOAT = 1;\r\n /** HALF_FLOAT */\r\n Engine.TEXTURETYPE_HALF_FLOAT = 2;\r\n /** BYTE */\r\n Engine.TEXTURETYPE_BYTE = 3;\r\n /** SHORT */\r\n Engine.TEXTURETYPE_SHORT = 4;\r\n /** UNSIGNED_SHORT */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT = 5;\r\n /** INT */\r\n Engine.TEXTURETYPE_INT = 6;\r\n /** UNSIGNED_INT */\r\n Engine.TEXTURETYPE_UNSIGNED_INTEGER = 7;\r\n /** UNSIGNED_SHORT_4_4_4_4 */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = 8;\r\n /** UNSIGNED_SHORT_5_5_5_1 */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = 9;\r\n /** UNSIGNED_SHORT_5_6_5 */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = 10;\r\n /** UNSIGNED_INT_2_10_10_10_REV */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = 11;\r\n /** UNSIGNED_INT_24_8 */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_24_8 = 12;\r\n /** UNSIGNED_INT_10F_11F_11F_REV */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = 13;\r\n /** UNSIGNED_INT_5_9_9_9_REV */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = 14;\r\n /** FLOAT_32_UNSIGNED_INT_24_8_REV */\r\n Engine.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = 15;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Engine.TEXTURE_NEAREST_SAMPLINGMODE = 1;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Engine.TEXTURE_BILINEAR_SAMPLINGMODE = 2;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Engine.TEXTURE_TRILINEAR_SAMPLINGMODE = 3;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR = 8;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST = 11;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR = 3;\r\n /** mag = nearest and min = nearest and mip = nearest */\r\n Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST = 4;\r\n /** mag = nearest and min = linear and mip = nearest */\r\n Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST = 5;\r\n /** mag = nearest and min = linear and mip = linear */\r\n Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR = 6;\r\n /** mag = nearest and min = linear and mip = none */\r\n Engine.TEXTURE_NEAREST_LINEAR = 7;\r\n /** mag = nearest and min = nearest and mip = none */\r\n Engine.TEXTURE_NEAREST_NEAREST = 1;\r\n /** mag = linear and min = nearest and mip = nearest */\r\n Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST = 9;\r\n /** mag = linear and min = nearest and mip = linear */\r\n Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR = 10;\r\n /** mag = linear and min = linear and mip = none */\r\n Engine.TEXTURE_LINEAR_LINEAR = 2;\r\n /** mag = linear and min = nearest and mip = none */\r\n Engine.TEXTURE_LINEAR_NEAREST = 12;\r\n /** Explicit coordinates mode */\r\n Engine.TEXTURE_EXPLICIT_MODE = 0;\r\n /** Spherical coordinates mode */\r\n Engine.TEXTURE_SPHERICAL_MODE = 1;\r\n /** Planar coordinates mode */\r\n Engine.TEXTURE_PLANAR_MODE = 2;\r\n /** Cubic coordinates mode */\r\n Engine.TEXTURE_CUBIC_MODE = 3;\r\n /** Projection coordinates mode */\r\n Engine.TEXTURE_PROJECTION_MODE = 4;\r\n /** Skybox coordinates mode */\r\n Engine.TEXTURE_SKYBOX_MODE = 5;\r\n /** Inverse Cubic coordinates mode */\r\n Engine.TEXTURE_INVCUBIC_MODE = 6;\r\n /** Equirectangular coordinates mode */\r\n Engine.TEXTURE_EQUIRECTANGULAR_MODE = 7;\r\n /** Equirectangular Fixed coordinates mode */\r\n Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = 8;\r\n /** Equirectangular Fixed Mirrored coordinates mode */\r\n Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9;\r\n // Texture rescaling mode\r\n /** Defines that texture rescaling will use a floor to find the closer power of 2 size */\r\n Engine.SCALEMODE_FLOOR = 1;\r\n /** Defines that texture rescaling will look for the nearest power of 2 size */\r\n Engine.SCALEMODE_NEAREST = 2;\r\n /** Defines that texture rescaling will use a ceil to find the closer power of 2 size */\r\n Engine.SCALEMODE_CEILING = 3;\r\n /**\r\n * Method called to create the default rescale post process on each engine.\r\n */\r\n Engine._RescalePostProcessFactory = null;\r\n return Engine;\r\n}(ThinEngine));\r\nexport { Engine };\r\n//# sourceMappingURL=engine.js.map","/**\r\n * The engine store class is responsible to hold all the instances of Engine and Scene created\r\n * during the life time of the application.\r\n */\r\nvar EngineStore = /** @class */ (function () {\r\n function EngineStore() {\r\n }\r\n Object.defineProperty(EngineStore, \"LastCreatedEngine\", {\r\n /**\r\n * Gets the latest created engine\r\n */\r\n get: function () {\r\n if (this.Instances.length === 0) {\r\n return null;\r\n }\r\n return this.Instances[this.Instances.length - 1];\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(EngineStore, \"LastCreatedScene\", {\r\n /**\r\n * Gets the latest created scene\r\n */\r\n get: function () {\r\n return this._LastCreatedScene;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** Gets the list of created engines */\r\n EngineStore.Instances = new Array();\r\n /** @hidden */\r\n EngineStore._LastCreatedScene = null;\r\n /**\r\n * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded\r\n * @ignorenaming\r\n */\r\n EngineStore.UseFallbackTexture = true;\r\n /**\r\n * Texture content used if a texture cannot loaded\r\n * @ignorenaming\r\n */\r\n EngineStore.FallbackTexture = \"\";\r\n return EngineStore;\r\n}());\r\nexport { EngineStore };\r\n//# sourceMappingURL=engineStore.js.map","/** @hidden */\r\nvar PerformanceConfigurator = /** @class */ (function () {\r\n function PerformanceConfigurator() {\r\n }\r\n /** @hidden */\r\n PerformanceConfigurator.SetMatrixPrecision = function (use64bits) {\r\n PerformanceConfigurator.MatrixTrackPrecisionChange = false;\r\n if (use64bits && !PerformanceConfigurator.MatrixUse64Bits) {\r\n if (PerformanceConfigurator.MatrixTrackedMatrices) {\r\n for (var m = 0; m < PerformanceConfigurator.MatrixTrackedMatrices.length; ++m) {\r\n var matrix = PerformanceConfigurator.MatrixTrackedMatrices[m];\r\n var values = matrix._m;\r\n matrix._m = new Array(16);\r\n for (var i = 0; i < 16; ++i) {\r\n matrix._m[i] = values[i];\r\n }\r\n }\r\n }\r\n }\r\n PerformanceConfigurator.MatrixUse64Bits = use64bits;\r\n PerformanceConfigurator.MatrixCurrentType = PerformanceConfigurator.MatrixUse64Bits ? Array : Float32Array;\r\n PerformanceConfigurator.MatrixTrackedMatrices = null; // reclaim some memory, as we don't need _TrackedMatrices anymore\r\n };\r\n /** @hidden */\r\n PerformanceConfigurator.MatrixUse64Bits = false;\r\n /** @hidden */\r\n PerformanceConfigurator.MatrixTrackPrecisionChange = true;\r\n /** @hidden */\r\n PerformanceConfigurator.MatrixCurrentType = Float32Array;\r\n /** @hidden */\r\n PerformanceConfigurator.MatrixTrackedMatrices = [];\r\n return PerformanceConfigurator;\r\n}());\r\nexport { PerformanceConfigurator };\r\n//# sourceMappingURL=performanceConfigurator.js.map","/**\r\n * @hidden\r\n **/\r\nvar DepthCullingState = /** @class */ (function () {\r\n /**\r\n * Initializes the state.\r\n */\r\n function DepthCullingState() {\r\n this._isDepthTestDirty = false;\r\n this._isDepthMaskDirty = false;\r\n this._isDepthFuncDirty = false;\r\n this._isCullFaceDirty = false;\r\n this._isCullDirty = false;\r\n this._isZOffsetDirty = false;\r\n this._isFrontFaceDirty = false;\r\n this.reset();\r\n }\r\n Object.defineProperty(DepthCullingState.prototype, \"isDirty\", {\r\n get: function () {\r\n return this._isDepthFuncDirty || this._isDepthTestDirty || this._isDepthMaskDirty || this._isCullFaceDirty || this._isCullDirty || this._isZOffsetDirty || this._isFrontFaceDirty;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthCullingState.prototype, \"zOffset\", {\r\n get: function () {\r\n return this._zOffset;\r\n },\r\n set: function (value) {\r\n if (this._zOffset === value) {\r\n return;\r\n }\r\n this._zOffset = value;\r\n this._isZOffsetDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthCullingState.prototype, \"cullFace\", {\r\n get: function () {\r\n return this._cullFace;\r\n },\r\n set: function (value) {\r\n if (this._cullFace === value) {\r\n return;\r\n }\r\n this._cullFace = value;\r\n this._isCullFaceDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthCullingState.prototype, \"cull\", {\r\n get: function () {\r\n return this._cull;\r\n },\r\n set: function (value) {\r\n if (this._cull === value) {\r\n return;\r\n }\r\n this._cull = value;\r\n this._isCullDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthCullingState.prototype, \"depthFunc\", {\r\n get: function () {\r\n return this._depthFunc;\r\n },\r\n set: function (value) {\r\n if (this._depthFunc === value) {\r\n return;\r\n }\r\n this._depthFunc = value;\r\n this._isDepthFuncDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthCullingState.prototype, \"depthMask\", {\r\n get: function () {\r\n return this._depthMask;\r\n },\r\n set: function (value) {\r\n if (this._depthMask === value) {\r\n return;\r\n }\r\n this._depthMask = value;\r\n this._isDepthMaskDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthCullingState.prototype, \"depthTest\", {\r\n get: function () {\r\n return this._depthTest;\r\n },\r\n set: function (value) {\r\n if (this._depthTest === value) {\r\n return;\r\n }\r\n this._depthTest = value;\r\n this._isDepthTestDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthCullingState.prototype, \"frontFace\", {\r\n get: function () {\r\n return this._frontFace;\r\n },\r\n set: function (value) {\r\n if (this._frontFace === value) {\r\n return;\r\n }\r\n this._frontFace = value;\r\n this._isFrontFaceDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n DepthCullingState.prototype.reset = function () {\r\n this._depthMask = true;\r\n this._depthTest = true;\r\n this._depthFunc = null;\r\n this._cullFace = null;\r\n this._cull = null;\r\n this._zOffset = 0;\r\n this._frontFace = null;\r\n this._isDepthTestDirty = true;\r\n this._isDepthMaskDirty = true;\r\n this._isDepthFuncDirty = false;\r\n this._isCullFaceDirty = false;\r\n this._isCullDirty = false;\r\n this._isZOffsetDirty = false;\r\n this._isFrontFaceDirty = false;\r\n };\r\n DepthCullingState.prototype.apply = function (gl) {\r\n if (!this.isDirty) {\r\n return;\r\n }\r\n // Cull\r\n if (this._isCullDirty) {\r\n if (this.cull) {\r\n gl.enable(gl.CULL_FACE);\r\n }\r\n else {\r\n gl.disable(gl.CULL_FACE);\r\n }\r\n this._isCullDirty = false;\r\n }\r\n // Cull face\r\n if (this._isCullFaceDirty) {\r\n gl.cullFace(this.cullFace);\r\n this._isCullFaceDirty = false;\r\n }\r\n // Depth mask\r\n if (this._isDepthMaskDirty) {\r\n gl.depthMask(this.depthMask);\r\n this._isDepthMaskDirty = false;\r\n }\r\n // Depth test\r\n if (this._isDepthTestDirty) {\r\n if (this.depthTest) {\r\n gl.enable(gl.DEPTH_TEST);\r\n }\r\n else {\r\n gl.disable(gl.DEPTH_TEST);\r\n }\r\n this._isDepthTestDirty = false;\r\n }\r\n // Depth func\r\n if (this._isDepthFuncDirty) {\r\n gl.depthFunc(this.depthFunc);\r\n this._isDepthFuncDirty = false;\r\n }\r\n // zOffset\r\n if (this._isZOffsetDirty) {\r\n if (this.zOffset) {\r\n gl.enable(gl.POLYGON_OFFSET_FILL);\r\n gl.polygonOffset(this.zOffset, 0);\r\n }\r\n else {\r\n gl.disable(gl.POLYGON_OFFSET_FILL);\r\n }\r\n this._isZOffsetDirty = false;\r\n }\r\n // Front face\r\n if (this._isFrontFaceDirty) {\r\n gl.frontFace(this.frontFace);\r\n this._isFrontFaceDirty = false;\r\n }\r\n };\r\n return DepthCullingState;\r\n}());\r\nexport { DepthCullingState };\r\n//# sourceMappingURL=depthCullingState.js.map","/**\r\n * @hidden\r\n **/\r\nvar StencilState = /** @class */ (function () {\r\n function StencilState() {\r\n this._isStencilTestDirty = false;\r\n this._isStencilMaskDirty = false;\r\n this._isStencilFuncDirty = false;\r\n this._isStencilOpDirty = false;\r\n this.reset();\r\n }\r\n Object.defineProperty(StencilState.prototype, \"isDirty\", {\r\n get: function () {\r\n return this._isStencilTestDirty || this._isStencilMaskDirty || this._isStencilFuncDirty || this._isStencilOpDirty;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilFunc\", {\r\n get: function () {\r\n return this._stencilFunc;\r\n },\r\n set: function (value) {\r\n if (this._stencilFunc === value) {\r\n return;\r\n }\r\n this._stencilFunc = value;\r\n this._isStencilFuncDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilFuncRef\", {\r\n get: function () {\r\n return this._stencilFuncRef;\r\n },\r\n set: function (value) {\r\n if (this._stencilFuncRef === value) {\r\n return;\r\n }\r\n this._stencilFuncRef = value;\r\n this._isStencilFuncDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilFuncMask\", {\r\n get: function () {\r\n return this._stencilFuncMask;\r\n },\r\n set: function (value) {\r\n if (this._stencilFuncMask === value) {\r\n return;\r\n }\r\n this._stencilFuncMask = value;\r\n this._isStencilFuncDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilOpStencilFail\", {\r\n get: function () {\r\n return this._stencilOpStencilFail;\r\n },\r\n set: function (value) {\r\n if (this._stencilOpStencilFail === value) {\r\n return;\r\n }\r\n this._stencilOpStencilFail = value;\r\n this._isStencilOpDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilOpDepthFail\", {\r\n get: function () {\r\n return this._stencilOpDepthFail;\r\n },\r\n set: function (value) {\r\n if (this._stencilOpDepthFail === value) {\r\n return;\r\n }\r\n this._stencilOpDepthFail = value;\r\n this._isStencilOpDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilOpStencilDepthPass\", {\r\n get: function () {\r\n return this._stencilOpStencilDepthPass;\r\n },\r\n set: function (value) {\r\n if (this._stencilOpStencilDepthPass === value) {\r\n return;\r\n }\r\n this._stencilOpStencilDepthPass = value;\r\n this._isStencilOpDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilMask\", {\r\n get: function () {\r\n return this._stencilMask;\r\n },\r\n set: function (value) {\r\n if (this._stencilMask === value) {\r\n return;\r\n }\r\n this._stencilMask = value;\r\n this._isStencilMaskDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilTest\", {\r\n get: function () {\r\n return this._stencilTest;\r\n },\r\n set: function (value) {\r\n if (this._stencilTest === value) {\r\n return;\r\n }\r\n this._stencilTest = value;\r\n this._isStencilTestDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n StencilState.prototype.reset = function () {\r\n this._stencilTest = false;\r\n this._stencilMask = 0xFF;\r\n this._stencilFunc = StencilState.ALWAYS;\r\n this._stencilFuncRef = 1;\r\n this._stencilFuncMask = 0xFF;\r\n this._stencilOpStencilFail = StencilState.KEEP;\r\n this._stencilOpDepthFail = StencilState.KEEP;\r\n this._stencilOpStencilDepthPass = StencilState.REPLACE;\r\n this._isStencilTestDirty = true;\r\n this._isStencilMaskDirty = true;\r\n this._isStencilFuncDirty = true;\r\n this._isStencilOpDirty = true;\r\n };\r\n StencilState.prototype.apply = function (gl) {\r\n if (!this.isDirty) {\r\n return;\r\n }\r\n // Stencil test\r\n if (this._isStencilTestDirty) {\r\n if (this.stencilTest) {\r\n gl.enable(gl.STENCIL_TEST);\r\n }\r\n else {\r\n gl.disable(gl.STENCIL_TEST);\r\n }\r\n this._isStencilTestDirty = false;\r\n }\r\n // Stencil mask\r\n if (this._isStencilMaskDirty) {\r\n gl.stencilMask(this.stencilMask);\r\n this._isStencilMaskDirty = false;\r\n }\r\n // Stencil func\r\n if (this._isStencilFuncDirty) {\r\n gl.stencilFunc(this.stencilFunc, this.stencilFuncRef, this.stencilFuncMask);\r\n this._isStencilFuncDirty = false;\r\n }\r\n // Stencil op\r\n if (this._isStencilOpDirty) {\r\n gl.stencilOp(this.stencilOpStencilFail, this.stencilOpDepthFail, this.stencilOpStencilDepthPass);\r\n this._isStencilOpDirty = false;\r\n }\r\n };\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\r\n StencilState.ALWAYS = 519;\r\n /** Passed to stencilOperation to specify that stencil value must be kept */\r\n StencilState.KEEP = 7680;\r\n /** Passed to stencilOperation to specify that stencil value must be replaced */\r\n StencilState.REPLACE = 7681;\r\n return StencilState;\r\n}());\r\nexport { StencilState };\r\n//# sourceMappingURL=stencilState.js.map","/**\r\n * @hidden\r\n **/\r\nvar AlphaState = /** @class */ (function () {\r\n /**\r\n * Initializes the state.\r\n */\r\n function AlphaState() {\r\n this._isAlphaBlendDirty = false;\r\n this._isBlendFunctionParametersDirty = false;\r\n this._isBlendEquationParametersDirty = false;\r\n this._isBlendConstantsDirty = false;\r\n this._alphaBlend = false;\r\n this._blendFunctionParameters = new Array(4);\r\n this._blendEquationParameters = new Array(2);\r\n this._blendConstants = new Array(4);\r\n this.reset();\r\n }\r\n Object.defineProperty(AlphaState.prototype, \"isDirty\", {\r\n get: function () {\r\n return this._isAlphaBlendDirty || this._isBlendFunctionParametersDirty;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AlphaState.prototype, \"alphaBlend\", {\r\n get: function () {\r\n return this._alphaBlend;\r\n },\r\n set: function (value) {\r\n if (this._alphaBlend === value) {\r\n return;\r\n }\r\n this._alphaBlend = value;\r\n this._isAlphaBlendDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n AlphaState.prototype.setAlphaBlendConstants = function (r, g, b, a) {\r\n if (this._blendConstants[0] === r &&\r\n this._blendConstants[1] === g &&\r\n this._blendConstants[2] === b &&\r\n this._blendConstants[3] === a) {\r\n return;\r\n }\r\n this._blendConstants[0] = r;\r\n this._blendConstants[1] = g;\r\n this._blendConstants[2] = b;\r\n this._blendConstants[3] = a;\r\n this._isBlendConstantsDirty = true;\r\n };\r\n AlphaState.prototype.setAlphaBlendFunctionParameters = function (value0, value1, value2, value3) {\r\n if (this._blendFunctionParameters[0] === value0 &&\r\n this._blendFunctionParameters[1] === value1 &&\r\n this._blendFunctionParameters[2] === value2 &&\r\n this._blendFunctionParameters[3] === value3) {\r\n return;\r\n }\r\n this._blendFunctionParameters[0] = value0;\r\n this._blendFunctionParameters[1] = value1;\r\n this._blendFunctionParameters[2] = value2;\r\n this._blendFunctionParameters[3] = value3;\r\n this._isBlendFunctionParametersDirty = true;\r\n };\r\n AlphaState.prototype.setAlphaEquationParameters = function (rgb, alpha) {\r\n if (this._blendEquationParameters[0] === rgb &&\r\n this._blendEquationParameters[1] === alpha) {\r\n return;\r\n }\r\n this._blendEquationParameters[0] = rgb;\r\n this._blendEquationParameters[1] = alpha;\r\n this._isBlendEquationParametersDirty = true;\r\n };\r\n AlphaState.prototype.reset = function () {\r\n this._alphaBlend = false;\r\n this._blendFunctionParameters[0] = null;\r\n this._blendFunctionParameters[1] = null;\r\n this._blendFunctionParameters[2] = null;\r\n this._blendFunctionParameters[3] = null;\r\n this._blendEquationParameters[0] = null;\r\n this._blendEquationParameters[1] = null;\r\n this._blendConstants[0] = null;\r\n this._blendConstants[1] = null;\r\n this._blendConstants[2] = null;\r\n this._blendConstants[3] = null;\r\n this._isAlphaBlendDirty = true;\r\n this._isBlendFunctionParametersDirty = false;\r\n this._isBlendEquationParametersDirty = false;\r\n this._isBlendConstantsDirty = false;\r\n };\r\n AlphaState.prototype.apply = function (gl) {\r\n if (!this.isDirty) {\r\n return;\r\n }\r\n // Alpha blend\r\n if (this._isAlphaBlendDirty) {\r\n if (this._alphaBlend) {\r\n gl.enable(gl.BLEND);\r\n }\r\n else {\r\n gl.disable(gl.BLEND);\r\n }\r\n this._isAlphaBlendDirty = false;\r\n }\r\n // Alpha function\r\n if (this._isBlendFunctionParametersDirty) {\r\n gl.blendFuncSeparate(this._blendFunctionParameters[0], this._blendFunctionParameters[1], this._blendFunctionParameters[2], this._blendFunctionParameters[3]);\r\n this._isBlendFunctionParametersDirty = false;\r\n }\r\n // Alpha equation\r\n if (this._isBlendEquationParametersDirty) {\r\n gl.blendEquationSeparate(this._blendEquationParameters[0], this._blendEquationParameters[1]);\r\n this._isBlendEquationParametersDirty = false;\r\n }\r\n // Constants\r\n if (this._isBlendConstantsDirty) {\r\n gl.blendColor(this._blendConstants[0], this._blendConstants[1], this._blendConstants[2], this._blendConstants[3]);\r\n this._isBlendConstantsDirty = false;\r\n }\r\n };\r\n return AlphaState;\r\n}());\r\nexport { AlphaState };\r\n//# sourceMappingURL=alphaCullingState.js.map","/** @hidden */\r\nvar WebGLShaderProcessor = /** @class */ (function () {\r\n function WebGLShaderProcessor() {\r\n }\r\n WebGLShaderProcessor.prototype.postProcessor = function (code, defines, isFragment, engine) {\r\n // Remove extensions\r\n if (!engine.getCaps().drawBuffersExtension) {\r\n // even if enclosed in #if/#endif, IE11 does parse the #extension declaration, so we need to remove it altogether\r\n var regex = /#extension.+GL_EXT_draw_buffers.+(enable|require)/g;\r\n code = code.replace(regex, \"\");\r\n }\r\n return code;\r\n };\r\n return WebGLShaderProcessor;\r\n}());\r\nexport { WebGLShaderProcessor };\r\n//# sourceMappingURL=webGLShaderProcessors.js.map","/** @hidden */\r\nvar WebGL2ShaderProcessor = /** @class */ (function () {\r\n function WebGL2ShaderProcessor() {\r\n }\r\n WebGL2ShaderProcessor.prototype.attributeProcessor = function (attribute) {\r\n return attribute.replace(\"attribute\", \"in\");\r\n };\r\n WebGL2ShaderProcessor.prototype.varyingProcessor = function (varying, isFragment) {\r\n return varying.replace(\"varying\", isFragment ? \"in\" : \"out\");\r\n };\r\n WebGL2ShaderProcessor.prototype.postProcessor = function (code, defines, isFragment) {\r\n var hasDrawBuffersExtension = code.search(/#extension.+GL_EXT_draw_buffers.+require/) !== -1;\r\n // Remove extensions\r\n var regex = /#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g;\r\n code = code.replace(regex, \"\");\r\n // Replace instructions\r\n code = code.replace(/texture2D\\s*\\(/g, \"texture(\");\r\n if (isFragment) {\r\n code = code.replace(/texture2DLodEXT\\s*\\(/g, \"textureLod(\");\r\n code = code.replace(/textureCubeLodEXT\\s*\\(/g, \"textureLod(\");\r\n code = code.replace(/textureCube\\s*\\(/g, \"texture(\");\r\n code = code.replace(/gl_FragDepthEXT/g, \"gl_FragDepth\");\r\n code = code.replace(/gl_FragColor/g, \"glFragColor\");\r\n code = code.replace(/gl_FragData/g, \"glFragData\");\r\n code = code.replace(/void\\s+?main\\s*\\(/g, (hasDrawBuffersExtension ? \"\" : \"out vec4 glFragColor;\\n\") + \"void main(\");\r\n }\r\n else {\r\n var hasMultiviewExtension = defines.indexOf(\"#define MULTIVIEW\") !== -1;\r\n if (hasMultiviewExtension) {\r\n return \"#extension GL_OVR_multiview2 : require\\nlayout (num_views = 2) in;\\n\" + code;\r\n }\r\n }\r\n return code;\r\n };\r\n return WebGL2ShaderProcessor;\r\n}());\r\nexport { WebGL2ShaderProcessor };\r\n//# sourceMappingURL=webGL2ShaderProcessors.js.map","/** @hidden */\r\nvar WebGLPipelineContext = /** @class */ (function () {\r\n function WebGLPipelineContext() {\r\n this.vertexCompilationError = null;\r\n this.fragmentCompilationError = null;\r\n this.programLinkError = null;\r\n this.programValidationError = null;\r\n }\r\n Object.defineProperty(WebGLPipelineContext.prototype, \"isAsync\", {\r\n get: function () {\r\n return this.isParallelCompiled;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebGLPipelineContext.prototype, \"isReady\", {\r\n get: function () {\r\n if (this.program) {\r\n if (this.isParallelCompiled) {\r\n return this.engine._isRenderingStateCompiled(this);\r\n }\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n WebGLPipelineContext.prototype._handlesSpectorRebuildCallback = function (onCompiled) {\r\n if (onCompiled && this.program) {\r\n onCompiled(this.program);\r\n }\r\n };\r\n WebGLPipelineContext.prototype._getVertexShaderCode = function () {\r\n return this.vertexShader ? this.engine._getShaderSource(this.vertexShader) : null;\r\n };\r\n WebGLPipelineContext.prototype._getFragmentShaderCode = function () {\r\n return this.fragmentShader ? this.engine._getShaderSource(this.fragmentShader) : null;\r\n };\r\n return WebGLPipelineContext;\r\n}());\r\nexport { WebGLPipelineContext };\r\n//# sourceMappingURL=webGLPipelineContext.js.map","import { EngineStore } from './engineStore';\r\nimport { Effect } from '../Materials/effect';\r\nimport { _DevTools } from '../Misc/devTools';\r\nimport { Observable } from '../Misc/observable';\r\nimport { DepthCullingState } from '../States/depthCullingState';\r\nimport { StencilState } from '../States/stencilState';\r\nimport { AlphaState } from '../States/alphaCullingState';\r\nimport { InternalTexture, InternalTextureSource } from '../Materials/Textures/internalTexture';\r\nimport { Logger } from '../Misc/logger';\r\nimport { DomManagement } from '../Misc/domManagement';\r\nimport { WebGLShaderProcessor } from './WebGL/webGLShaderProcessors';\r\nimport { WebGL2ShaderProcessor } from './WebGL/webGL2ShaderProcessors';\r\nimport { WebGLDataBuffer } from '../Meshes/WebGL/webGLDataBuffer';\r\nimport { WebGLPipelineContext } from './WebGL/webGLPipelineContext';\r\nimport { CanvasGenerator } from '../Misc/canvasGenerator';\r\nimport { PerformanceConfigurator } from './performanceConfigurator';\r\n/**\r\n * Keeps track of all the buffer info used in engine.\r\n */\r\nvar BufferPointer = /** @class */ (function () {\r\n function BufferPointer() {\r\n }\r\n return BufferPointer;\r\n}());\r\n/**\r\n * The base engine class (root of all engines)\r\n */\r\nvar ThinEngine = /** @class */ (function () {\r\n /**\r\n * Creates a new engine\r\n * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which alreay used the WebGL context\r\n * @param antialias defines enable antialiasing (default: false)\r\n * @param options defines further options to be sent to the getContext() function\r\n * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)\r\n */\r\n function ThinEngine(canvasOrContext, antialias, options, adaptToDeviceRatio) {\r\n var _this = this;\r\n if (adaptToDeviceRatio === void 0) { adaptToDeviceRatio = false; }\r\n /**\r\n * Gets or sets a boolean that indicates if textures must be forced to power of 2 size even if not required\r\n */\r\n this.forcePOTTextures = false;\r\n /**\r\n * Gets a boolean indicating if the engine is currently rendering in fullscreen mode\r\n */\r\n this.isFullscreen = false;\r\n /**\r\n * Gets or sets a boolean indicating if back faces must be culled (true by default)\r\n */\r\n this.cullBackFaces = true;\r\n /**\r\n * Gets or sets a boolean indicating if the engine must keep rendering even if the window is not in foregroun\r\n */\r\n this.renderEvenInBackground = true;\r\n /**\r\n * Gets or sets a boolean indicating that cache can be kept between frames\r\n */\r\n this.preventCacheWipeBetweenFrames = false;\r\n /** Gets or sets a boolean indicating if the engine should validate programs after compilation */\r\n this.validateShaderPrograms = false;\r\n /**\r\n * Gets or sets a boolean indicating if depth buffer should be reverse, going from far to near.\r\n * This can provide greater z depth for distant objects.\r\n */\r\n this.useReverseDepthBuffer = false;\r\n // Uniform buffers list\r\n /**\r\n * Gets or sets a boolean indicating that uniform buffers must be disabled even if they are supported\r\n */\r\n this.disableUniformBuffers = false;\r\n /** @hidden */\r\n this._uniformBuffers = new Array();\r\n /** @hidden */\r\n this._webGLVersion = 1.0;\r\n this._windowIsBackground = false;\r\n this._highPrecisionShadersAllowed = true;\r\n /** @hidden */\r\n this._badOS = false;\r\n /** @hidden */\r\n this._badDesktopOS = false;\r\n this._renderingQueueLaunched = false;\r\n this._activeRenderLoops = new Array();\r\n // Lost context\r\n /**\r\n * Observable signaled when a context lost event is raised\r\n */\r\n this.onContextLostObservable = new Observable();\r\n /**\r\n * Observable signaled when a context restored event is raised\r\n */\r\n this.onContextRestoredObservable = new Observable();\r\n this._contextWasLost = false;\r\n /** @hidden */\r\n this._doNotHandleContextLost = false;\r\n /**\r\n * Gets or sets a boolean indicating that vertex array object must be disabled even if they are supported\r\n */\r\n this.disableVertexArrayObjects = false;\r\n // States\r\n /** @hidden */\r\n this._colorWrite = true;\r\n /** @hidden */\r\n this._colorWriteChanged = true;\r\n /** @hidden */\r\n this._depthCullingState = new DepthCullingState();\r\n /** @hidden */\r\n this._stencilState = new StencilState();\r\n /** @hidden */\r\n this._alphaState = new AlphaState();\r\n /** @hidden */\r\n this._alphaMode = 1;\r\n /** @hidden */\r\n this._alphaEquation = 0;\r\n // Cache\r\n /** @hidden */\r\n this._internalTexturesCache = new Array();\r\n /** @hidden */\r\n this._activeChannel = 0;\r\n this._currentTextureChannel = -1;\r\n /** @hidden */\r\n this._boundTexturesCache = {};\r\n this._compiledEffects = {};\r\n this._vertexAttribArraysEnabled = [];\r\n this._uintIndicesCurrentlySet = false;\r\n this._currentBoundBuffer = new Array();\r\n /** @hidden */\r\n this._currentFramebuffer = null;\r\n /** @hidden */\r\n this._dummyFramebuffer = null;\r\n this._currentBufferPointers = new Array();\r\n this._currentInstanceLocations = new Array();\r\n this._currentInstanceBuffers = new Array();\r\n this._vaoRecordInProgress = false;\r\n this._mustWipeVertexAttributes = false;\r\n this._nextFreeTextureSlots = new Array();\r\n this._maxSimultaneousTextures = 0;\r\n this._activeRequests = new Array();\r\n /** @hidden */\r\n this._transformTextureUrl = null;\r\n /**\r\n * Gets information about the current host\r\n */\r\n this.hostInformation = {\r\n isMobile: false\r\n };\r\n /**\r\n * Defines whether the engine has been created with the premultipliedAlpha option on or not.\r\n */\r\n this.premultipliedAlpha = true;\r\n /**\r\n * Observable event triggered before each texture is initialized\r\n */\r\n this.onBeforeTextureInitObservable = new Observable();\r\n this._viewportCached = { x: 0, y: 0, z: 0, w: 0 };\r\n this._unpackFlipYCached = null;\r\n /**\r\n * In case you are sharing the context with other applications, it might\r\n * be interested to not cache the unpack flip y state to ensure a consistent\r\n * value would be set.\r\n */\r\n this.enableUnpackFlipYCached = true;\r\n this._getDepthStencilBuffer = function (width, height, samples, internalFormat, msInternalFormat, attachment) {\r\n var gl = _this._gl;\r\n var depthStencilBuffer = gl.createRenderbuffer();\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);\r\n if (samples > 1 && gl.renderbufferStorageMultisample) {\r\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, msInternalFormat, width, height);\r\n }\r\n else {\r\n gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);\r\n }\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, depthStencilBuffer);\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\r\n return depthStencilBuffer;\r\n };\r\n this._boundUniforms = {};\r\n var canvas = null;\r\n if (!canvasOrContext) {\r\n return;\r\n }\r\n options = options || {};\r\n PerformanceConfigurator.SetMatrixPrecision(!!options.useHighPrecisionMatrix);\r\n if (canvasOrContext.getContext) {\r\n canvas = canvasOrContext;\r\n this._renderingCanvas = canvas;\r\n if (antialias != null) {\r\n options.antialias = antialias;\r\n }\r\n if (options.deterministicLockstep === undefined) {\r\n options.deterministicLockstep = false;\r\n }\r\n if (options.lockstepMaxSteps === undefined) {\r\n options.lockstepMaxSteps = 4;\r\n }\r\n if (options.timeStep === undefined) {\r\n options.timeStep = 1 / 60;\r\n }\r\n if (options.preserveDrawingBuffer === undefined) {\r\n options.preserveDrawingBuffer = false;\r\n }\r\n if (options.audioEngine === undefined) {\r\n options.audioEngine = true;\r\n }\r\n if (options.stencil === undefined) {\r\n options.stencil = true;\r\n }\r\n if (options.premultipliedAlpha === false) {\r\n this.premultipliedAlpha = false;\r\n }\r\n if (options.xrCompatible === undefined) {\r\n options.xrCompatible = true;\r\n }\r\n this._doNotHandleContextLost = options.doNotHandleContextLost ? true : false;\r\n // Exceptions\r\n if (navigator && navigator.userAgent) {\r\n var ua = navigator.userAgent;\r\n this.hostInformation.isMobile = ua.indexOf(\"Mobile\") !== -1;\r\n for (var _i = 0, _a = ThinEngine.ExceptionList; _i < _a.length; _i++) {\r\n var exception = _a[_i];\r\n var key = exception.key;\r\n var targets = exception.targets;\r\n var check = new RegExp(key);\r\n if (check.test(ua)) {\r\n if (exception.capture && exception.captureConstraint) {\r\n var capture = exception.capture;\r\n var constraint = exception.captureConstraint;\r\n var regex = new RegExp(capture);\r\n var matches = regex.exec(ua);\r\n if (matches && matches.length > 0) {\r\n var capturedValue = parseInt(matches[matches.length - 1]);\r\n if (capturedValue >= constraint) {\r\n continue;\r\n }\r\n }\r\n }\r\n for (var _b = 0, targets_1 = targets; _b < targets_1.length; _b++) {\r\n var target = targets_1[_b];\r\n switch (target) {\r\n case \"uniformBuffer\":\r\n this.disableUniformBuffers = true;\r\n break;\r\n case \"vao\":\r\n this.disableVertexArrayObjects = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Context lost\r\n if (!this._doNotHandleContextLost) {\r\n this._onContextLost = function (evt) {\r\n evt.preventDefault();\r\n _this._contextWasLost = true;\r\n Logger.Warn(\"WebGL context lost.\");\r\n _this.onContextLostObservable.notifyObservers(_this);\r\n };\r\n this._onContextRestored = function () {\r\n // Adding a timeout to avoid race condition at browser level\r\n setTimeout(function () {\r\n // Rebuild gl context\r\n _this._initGLContext();\r\n // Rebuild effects\r\n _this._rebuildEffects();\r\n // Rebuild textures\r\n _this._rebuildInternalTextures();\r\n // Rebuild buffers\r\n _this._rebuildBuffers();\r\n // Cache\r\n _this.wipeCaches(true);\r\n Logger.Warn(\"WebGL context successfully restored.\");\r\n _this.onContextRestoredObservable.notifyObservers(_this);\r\n _this._contextWasLost = false;\r\n }, 0);\r\n };\r\n canvas.addEventListener(\"webglcontextlost\", this._onContextLost, false);\r\n canvas.addEventListener(\"webglcontextrestored\", this._onContextRestored, false);\r\n options.powerPreference = \"high-performance\";\r\n }\r\n // GL\r\n if (!options.disableWebGL2Support) {\r\n try {\r\n this._gl = (canvas.getContext(\"webgl2\", options) || canvas.getContext(\"experimental-webgl2\", options));\r\n if (this._gl) {\r\n this._webGLVersion = 2.0;\r\n // Prevent weird browsers to lie (yeah that happens!)\r\n if (!this._gl.deleteQuery) {\r\n this._webGLVersion = 1.0;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Do nothing\r\n }\r\n }\r\n if (!this._gl) {\r\n if (!canvas) {\r\n throw new Error(\"The provided canvas is null or undefined.\");\r\n }\r\n try {\r\n this._gl = (canvas.getContext(\"webgl\", options) || canvas.getContext(\"experimental-webgl\", options));\r\n }\r\n catch (e) {\r\n throw new Error(\"WebGL not supported\");\r\n }\r\n }\r\n if (!this._gl) {\r\n throw new Error(\"WebGL not supported\");\r\n }\r\n }\r\n else {\r\n this._gl = canvasOrContext;\r\n this._renderingCanvas = this._gl.canvas;\r\n if (this._gl.renderbufferStorageMultisample) {\r\n this._webGLVersion = 2.0;\r\n }\r\n var attributes = this._gl.getContextAttributes();\r\n if (attributes) {\r\n options.stencil = attributes.stencil;\r\n }\r\n }\r\n // Ensures a consistent color space unpacking of textures cross browser.\r\n this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);\r\n if (options.useHighPrecisionFloats !== undefined) {\r\n this._highPrecisionShadersAllowed = options.useHighPrecisionFloats;\r\n }\r\n // Viewport\r\n var devicePixelRatio = DomManagement.IsWindowObjectExist() ? (window.devicePixelRatio || 1.0) : 1.0;\r\n var limitDeviceRatio = options.limitDeviceRatio || devicePixelRatio;\r\n this._hardwareScalingLevel = adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, devicePixelRatio) : 1.0;\r\n this.resize();\r\n this._isStencilEnable = options.stencil ? true : false;\r\n this._initGLContext();\r\n // Prepare buffer pointers\r\n for (var i = 0; i < this._caps.maxVertexAttribs; i++) {\r\n this._currentBufferPointers[i] = new BufferPointer();\r\n }\r\n // Shader processor\r\n if (this.webGLVersion > 1) {\r\n this._shaderProcessor = new WebGL2ShaderProcessor();\r\n }\r\n else {\r\n this._shaderProcessor = new WebGLShaderProcessor();\r\n }\r\n // Detect if we are running on a faulty buggy OS.\r\n this._badOS = /iPad/i.test(navigator.userAgent) || /iPhone/i.test(navigator.userAgent);\r\n // Starting with iOS 14, we can trust the browser\r\n // let matches = navigator.userAgent.match(/Version\\/(\\d+)/);\r\n // if (matches && matches.length === 2) {\r\n // if (parseInt(matches[1]) >= 14) {\r\n // this._badOS = false;\r\n // }\r\n // }\r\n // Detect if we are running on a faulty buggy desktop OS.\r\n this._badDesktopOS = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\r\n this._creationOptions = options;\r\n console.log(\"Babylon.js v\" + ThinEngine.Version + \" - \" + this.description);\r\n }\r\n Object.defineProperty(ThinEngine, \"NpmPackage\", {\r\n /**\r\n * Returns the current npm package of the sdk\r\n */\r\n // Not mixed with Version for tooling purpose.\r\n get: function () {\r\n return \"babylonjs@4.2.0\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine, \"Version\", {\r\n /**\r\n * Returns the current version of the framework\r\n */\r\n get: function () {\r\n return \"4.2.0\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"description\", {\r\n /**\r\n * Returns a string describing the current engine\r\n */\r\n get: function () {\r\n var description = \"WebGL\" + this.webGLVersion;\r\n if (this._caps.parallelShaderCompile) {\r\n description += \" - Parallel shader compilation\";\r\n }\r\n return description;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine, \"ShadersRepository\", {\r\n /**\r\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\r\n */\r\n get: function () {\r\n return Effect.ShadersRepository;\r\n },\r\n set: function (value) {\r\n Effect.ShadersRepository = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"supportsUniformBuffers\", {\r\n /**\r\n * Gets a boolean indicating that the engine supports uniform buffers\r\n * @see https://doc.babylonjs.com/features/webgl2#uniform-buffer-objets\r\n */\r\n get: function () {\r\n return this.webGLVersion > 1 && !this.disableUniformBuffers;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"_shouldUseHighPrecisionShader\", {\r\n /** @hidden */\r\n get: function () {\r\n return !!(this._caps.highPrecisionShaderSupported && this._highPrecisionShadersAllowed);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"needPOTTextures\", {\r\n /**\r\n * Gets a boolean indicating that only power of 2 textures are supported\r\n * Please note that you can still use non power of 2 textures but in this case the engine will forcefully convert them\r\n */\r\n get: function () {\r\n return this._webGLVersion < 2 || this.forcePOTTextures;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"doNotHandleContextLost\", {\r\n /**\r\n * Gets or sets a boolean indicating if resources should be retained to be able to handle context lost events\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#handling-webgl-context-lost\r\n */\r\n get: function () {\r\n return this._doNotHandleContextLost;\r\n },\r\n set: function (value) {\r\n this._doNotHandleContextLost = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"_supportsHardwareTextureRescaling\", {\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"framebufferDimensionsObject\", {\r\n /**\r\n * sets the object from which width and height will be taken from when getting render width and height\r\n * Will fallback to the gl object\r\n * @param dimensions the framebuffer width and height that will be used.\r\n */\r\n set: function (dimensions) {\r\n this._framebufferDimensionsObject = dimensions;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"currentViewport\", {\r\n /**\r\n * Gets the current viewport\r\n */\r\n get: function () {\r\n return this._cachedViewport;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"emptyTexture\", {\r\n /**\r\n * Gets the default empty texture\r\n */\r\n get: function () {\r\n if (!this._emptyTexture) {\r\n this._emptyTexture = this.createRawTexture(new Uint8Array(4), 1, 1, 5, false, false, 1);\r\n }\r\n return this._emptyTexture;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"emptyTexture3D\", {\r\n /**\r\n * Gets the default empty 3D texture\r\n */\r\n get: function () {\r\n if (!this._emptyTexture3D) {\r\n this._emptyTexture3D = this.createRawTexture3D(new Uint8Array(4), 1, 1, 1, 5, false, false, 1);\r\n }\r\n return this._emptyTexture3D;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"emptyTexture2DArray\", {\r\n /**\r\n * Gets the default empty 2D array texture\r\n */\r\n get: function () {\r\n if (!this._emptyTexture2DArray) {\r\n this._emptyTexture2DArray = this.createRawTexture2DArray(new Uint8Array(4), 1, 1, 1, 5, false, false, 1);\r\n }\r\n return this._emptyTexture2DArray;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"emptyCubeTexture\", {\r\n /**\r\n * Gets the default empty cube texture\r\n */\r\n get: function () {\r\n if (!this._emptyCubeTexture) {\r\n var faceData = new Uint8Array(4);\r\n var cubeData = [faceData, faceData, faceData, faceData, faceData, faceData];\r\n this._emptyCubeTexture = this.createRawCubeTexture(cubeData, 1, 5, 0, false, false, 1);\r\n }\r\n return this._emptyCubeTexture;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ThinEngine.prototype._rebuildInternalTextures = function () {\r\n var currentState = this._internalTexturesCache.slice(); // Do a copy because the rebuild will add proxies\r\n for (var _i = 0, currentState_1 = currentState; _i < currentState_1.length; _i++) {\r\n var internalTexture = currentState_1[_i];\r\n internalTexture._rebuild();\r\n }\r\n };\r\n ThinEngine.prototype._rebuildEffects = function () {\r\n for (var key in this._compiledEffects) {\r\n var effect = this._compiledEffects[key];\r\n effect._prepareEffect();\r\n }\r\n Effect.ResetCache();\r\n };\r\n /**\r\n * Gets a boolean indicating if all created effects are ready\r\n * @returns true if all effects are ready\r\n */\r\n ThinEngine.prototype.areAllEffectsReady = function () {\r\n for (var key in this._compiledEffects) {\r\n var effect = this._compiledEffects[key];\r\n if (!effect.isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n ThinEngine.prototype._rebuildBuffers = function () {\r\n // Uniforms\r\n for (var _i = 0, _a = this._uniformBuffers; _i < _a.length; _i++) {\r\n var uniformBuffer = _a[_i];\r\n uniformBuffer._rebuild();\r\n }\r\n };\r\n ThinEngine.prototype._initGLContext = function () {\r\n // Caps\r\n this._caps = {\r\n maxTexturesImageUnits: this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),\r\n maxCombinedTexturesImageUnits: this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),\r\n maxVertexTextureImageUnits: this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),\r\n maxTextureSize: this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),\r\n maxSamples: this._webGLVersion > 1 ? this._gl.getParameter(this._gl.MAX_SAMPLES) : 1,\r\n maxCubemapTextureSize: this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),\r\n maxRenderTextureSize: this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),\r\n maxVertexAttribs: this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),\r\n maxVaryingVectors: this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),\r\n maxFragmentUniformVectors: this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),\r\n maxVertexUniformVectors: this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),\r\n parallelShaderCompile: this._gl.getExtension('KHR_parallel_shader_compile'),\r\n standardDerivatives: this._webGLVersion > 1 || (this._gl.getExtension('OES_standard_derivatives') !== null),\r\n maxAnisotropy: 1,\r\n astc: this._gl.getExtension('WEBGL_compressed_texture_astc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_astc'),\r\n bptc: this._gl.getExtension('EXT_texture_compression_bptc') || this._gl.getExtension('WEBKIT_EXT_texture_compression_bptc'),\r\n s3tc: this._gl.getExtension('WEBGL_compressed_texture_s3tc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_s3tc'),\r\n pvrtc: this._gl.getExtension('WEBGL_compressed_texture_pvrtc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\r\n etc1: this._gl.getExtension('WEBGL_compressed_texture_etc1') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_etc1'),\r\n etc2: this._gl.getExtension('WEBGL_compressed_texture_etc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_etc') ||\r\n this._gl.getExtension('WEBGL_compressed_texture_es3_0'),\r\n textureAnisotropicFilterExtension: this._gl.getExtension('EXT_texture_filter_anisotropic') || this._gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic') || this._gl.getExtension('MOZ_EXT_texture_filter_anisotropic'),\r\n uintIndices: this._webGLVersion > 1 || this._gl.getExtension('OES_element_index_uint') !== null,\r\n fragmentDepthSupported: this._webGLVersion > 1 || this._gl.getExtension('EXT_frag_depth') !== null,\r\n highPrecisionShaderSupported: false,\r\n timerQuery: this._gl.getExtension('EXT_disjoint_timer_query_webgl2') || this._gl.getExtension(\"EXT_disjoint_timer_query\"),\r\n canUseTimestampForTimerQuery: false,\r\n drawBuffersExtension: false,\r\n maxMSAASamples: 1,\r\n colorBufferFloat: this._webGLVersion > 1 && this._gl.getExtension('EXT_color_buffer_float'),\r\n textureFloat: (this._webGLVersion > 1 || this._gl.getExtension('OES_texture_float')) ? true : false,\r\n textureHalfFloat: (this._webGLVersion > 1 || this._gl.getExtension('OES_texture_half_float')) ? true : false,\r\n textureHalfFloatRender: false,\r\n textureFloatLinearFiltering: false,\r\n textureFloatRender: false,\r\n textureHalfFloatLinearFiltering: false,\r\n vertexArrayObject: false,\r\n instancedArrays: false,\r\n textureLOD: (this._webGLVersion > 1 || this._gl.getExtension('EXT_shader_texture_lod')) ? true : false,\r\n blendMinMax: false,\r\n multiview: this._gl.getExtension('OVR_multiview2'),\r\n oculusMultiview: this._gl.getExtension('OCULUS_multiview'),\r\n depthTextureExtension: false\r\n };\r\n // Infos\r\n this._glVersion = this._gl.getParameter(this._gl.VERSION);\r\n var rendererInfo = this._gl.getExtension(\"WEBGL_debug_renderer_info\");\r\n if (rendererInfo != null) {\r\n this._glRenderer = this._gl.getParameter(rendererInfo.UNMASKED_RENDERER_WEBGL);\r\n this._glVendor = this._gl.getParameter(rendererInfo.UNMASKED_VENDOR_WEBGL);\r\n }\r\n if (!this._glVendor) {\r\n this._glVendor = \"Unknown vendor\";\r\n }\r\n if (!this._glRenderer) {\r\n this._glRenderer = \"Unknown renderer\";\r\n }\r\n // Constants\r\n if (this._gl.HALF_FLOAT_OES !== 0x8D61) {\r\n this._gl.HALF_FLOAT_OES = 0x8D61; // Half floating-point type (16-bit).\r\n }\r\n if (this._gl.RGBA16F !== 0x881A) {\r\n this._gl.RGBA16F = 0x881A; // RGBA 16-bit floating-point color-renderable internal sized format.\r\n }\r\n if (this._gl.RGBA32F !== 0x8814) {\r\n this._gl.RGBA32F = 0x8814; // RGBA 32-bit floating-point color-renderable internal sized format.\r\n }\r\n if (this._gl.DEPTH24_STENCIL8 !== 35056) {\r\n this._gl.DEPTH24_STENCIL8 = 35056;\r\n }\r\n // Extensions\r\n if (this._caps.timerQuery) {\r\n if (this._webGLVersion === 1) {\r\n this._gl.getQuery = this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery);\r\n }\r\n this._caps.canUseTimestampForTimerQuery = this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT, this._caps.timerQuery.QUERY_COUNTER_BITS_EXT) > 0;\r\n }\r\n this._caps.maxAnisotropy = this._caps.textureAnisotropicFilterExtension ? this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0;\r\n this._caps.textureFloatLinearFiltering = this._caps.textureFloat && this._gl.getExtension('OES_texture_float_linear') ? true : false;\r\n this._caps.textureFloatRender = this._caps.textureFloat && this._canRenderToFloatFramebuffer() ? true : false;\r\n this._caps.textureHalfFloatLinearFiltering = (this._webGLVersion > 1 || (this._caps.textureHalfFloat && this._gl.getExtension('OES_texture_half_float_linear'))) ? true : false;\r\n // Checks if some of the format renders first to allow the use of webgl inspector.\r\n if (this._webGLVersion > 1) {\r\n if (this._gl.HALF_FLOAT_OES !== 0x140B) {\r\n this._gl.HALF_FLOAT_OES = 0x140B;\r\n }\r\n }\r\n this._caps.textureHalfFloatRender = this._caps.textureHalfFloat && this._canRenderToHalfFloatFramebuffer();\r\n // Draw buffers\r\n if (this._webGLVersion > 1) {\r\n this._caps.drawBuffersExtension = true;\r\n this._caps.maxMSAASamples = this._gl.getParameter(this._gl.MAX_SAMPLES);\r\n }\r\n else {\r\n var drawBuffersExtension = this._gl.getExtension('WEBGL_draw_buffers');\r\n if (drawBuffersExtension !== null) {\r\n this._caps.drawBuffersExtension = true;\r\n this._gl.drawBuffers = drawBuffersExtension.drawBuffersWEBGL.bind(drawBuffersExtension);\r\n this._gl.DRAW_FRAMEBUFFER = this._gl.FRAMEBUFFER;\r\n for (var i = 0; i < 16; i++) {\r\n this._gl[\"COLOR_ATTACHMENT\" + i + \"_WEBGL\"] = drawBuffersExtension[\"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n }\r\n }\r\n }\r\n // Depth Texture\r\n if (this._webGLVersion > 1) {\r\n this._caps.depthTextureExtension = true;\r\n }\r\n else {\r\n var depthTextureExtension = this._gl.getExtension('WEBGL_depth_texture');\r\n if (depthTextureExtension != null) {\r\n this._caps.depthTextureExtension = true;\r\n this._gl.UNSIGNED_INT_24_8 = depthTextureExtension.UNSIGNED_INT_24_8_WEBGL;\r\n }\r\n }\r\n // Vertex array object\r\n if (this.disableVertexArrayObjects) {\r\n this._caps.vertexArrayObject = false;\r\n }\r\n else if (this._webGLVersion > 1) {\r\n this._caps.vertexArrayObject = true;\r\n }\r\n else {\r\n var vertexArrayObjectExtension = this._gl.getExtension('OES_vertex_array_object');\r\n if (vertexArrayObjectExtension != null) {\r\n this._caps.vertexArrayObject = true;\r\n this._gl.createVertexArray = vertexArrayObjectExtension.createVertexArrayOES.bind(vertexArrayObjectExtension);\r\n this._gl.bindVertexArray = vertexArrayObjectExtension.bindVertexArrayOES.bind(vertexArrayObjectExtension);\r\n this._gl.deleteVertexArray = vertexArrayObjectExtension.deleteVertexArrayOES.bind(vertexArrayObjectExtension);\r\n }\r\n }\r\n // Instances count\r\n if (this._webGLVersion > 1) {\r\n this._caps.instancedArrays = true;\r\n }\r\n else {\r\n var instanceExtension = this._gl.getExtension('ANGLE_instanced_arrays');\r\n if (instanceExtension != null) {\r\n this._caps.instancedArrays = true;\r\n this._gl.drawArraysInstanced = instanceExtension.drawArraysInstancedANGLE.bind(instanceExtension);\r\n this._gl.drawElementsInstanced = instanceExtension.drawElementsInstancedANGLE.bind(instanceExtension);\r\n this._gl.vertexAttribDivisor = instanceExtension.vertexAttribDivisorANGLE.bind(instanceExtension);\r\n }\r\n else {\r\n this._caps.instancedArrays = false;\r\n }\r\n }\r\n if (this._gl.getShaderPrecisionFormat) {\r\n var vertex_highp = this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER, this._gl.HIGH_FLOAT);\r\n var fragment_highp = this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER, this._gl.HIGH_FLOAT);\r\n if (vertex_highp && fragment_highp) {\r\n this._caps.highPrecisionShaderSupported = vertex_highp.precision !== 0 && fragment_highp.precision !== 0;\r\n }\r\n }\r\n if (this._webGLVersion > 1) {\r\n this._caps.blendMinMax = true;\r\n }\r\n else {\r\n var blendMinMaxExtension = this._gl.getExtension('EXT_blend_minmax');\r\n if (blendMinMaxExtension != null) {\r\n this._caps.blendMinMax = true;\r\n this._gl.MAX = blendMinMaxExtension.MAX_EXT;\r\n this._gl.MIN = blendMinMaxExtension.MIN_EXT;\r\n }\r\n }\r\n // Depth buffer\r\n this._depthCullingState.depthTest = true;\r\n this._depthCullingState.depthFunc = this._gl.LEQUAL;\r\n this._depthCullingState.depthMask = true;\r\n // Texture maps\r\n this._maxSimultaneousTextures = this._caps.maxCombinedTexturesImageUnits;\r\n for (var slot = 0; slot < this._maxSimultaneousTextures; slot++) {\r\n this._nextFreeTextureSlots.push(slot);\r\n }\r\n };\r\n Object.defineProperty(ThinEngine.prototype, \"webGLVersion\", {\r\n /**\r\n * Gets version of the current webGL context\r\n */\r\n get: function () {\r\n return this._webGLVersion;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"Engine\" string\r\n */\r\n ThinEngine.prototype.getClassName = function () {\r\n return \"ThinEngine\";\r\n };\r\n Object.defineProperty(ThinEngine.prototype, \"isStencilEnable\", {\r\n /**\r\n * Returns true if the stencil buffer has been enabled through the creation option of the context.\r\n */\r\n get: function () {\r\n return this._isStencilEnable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n ThinEngine.prototype._prepareWorkingCanvas = function () {\r\n if (this._workingCanvas) {\r\n return;\r\n }\r\n this._workingCanvas = CanvasGenerator.CreateCanvas(1, 1);\r\n var context = this._workingCanvas.getContext(\"2d\");\r\n if (context) {\r\n this._workingContext = context;\r\n }\r\n };\r\n /**\r\n * Reset the texture cache to empty state\r\n */\r\n ThinEngine.prototype.resetTextureCache = function () {\r\n for (var key in this._boundTexturesCache) {\r\n if (!this._boundTexturesCache.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n this._boundTexturesCache[key] = null;\r\n }\r\n this._currentTextureChannel = -1;\r\n };\r\n /**\r\n * Gets an object containing information about the current webGL context\r\n * @returns an object containing the vender, the renderer and the version of the current webGL context\r\n */\r\n ThinEngine.prototype.getGlInfo = function () {\r\n return {\r\n vendor: this._glVendor,\r\n renderer: this._glRenderer,\r\n version: this._glVersion\r\n };\r\n };\r\n /**\r\n * Defines the hardware scaling level.\r\n * By default the hardware scaling level is computed from the window device ratio.\r\n * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.\r\n * @param level defines the level to use\r\n */\r\n ThinEngine.prototype.setHardwareScalingLevel = function (level) {\r\n this._hardwareScalingLevel = level;\r\n this.resize();\r\n };\r\n /**\r\n * Gets the current hardware scaling level.\r\n * By default the hardware scaling level is computed from the window device ratio.\r\n * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.\r\n * @returns a number indicating the current hardware scaling level\r\n */\r\n ThinEngine.prototype.getHardwareScalingLevel = function () {\r\n return this._hardwareScalingLevel;\r\n };\r\n /**\r\n * Gets the list of loaded textures\r\n * @returns an array containing all loaded textures\r\n */\r\n ThinEngine.prototype.getLoadedTexturesCache = function () {\r\n return this._internalTexturesCache;\r\n };\r\n /**\r\n * Gets the object containing all engine capabilities\r\n * @returns the EngineCapabilities object\r\n */\r\n ThinEngine.prototype.getCaps = function () {\r\n return this._caps;\r\n };\r\n /**\r\n * stop executing a render loop function and remove it from the execution array\r\n * @param renderFunction defines the function to be removed. If not provided all functions will be removed.\r\n */\r\n ThinEngine.prototype.stopRenderLoop = function (renderFunction) {\r\n if (!renderFunction) {\r\n this._activeRenderLoops = [];\r\n return;\r\n }\r\n var index = this._activeRenderLoops.indexOf(renderFunction);\r\n if (index >= 0) {\r\n this._activeRenderLoops.splice(index, 1);\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._renderLoop = function () {\r\n if (!this._contextWasLost) {\r\n var shouldRender = true;\r\n if (!this.renderEvenInBackground && this._windowIsBackground) {\r\n shouldRender = false;\r\n }\r\n if (shouldRender) {\r\n // Start new frame\r\n this.beginFrame();\r\n for (var index = 0; index < this._activeRenderLoops.length; index++) {\r\n var renderFunction = this._activeRenderLoops[index];\r\n renderFunction();\r\n }\r\n // Present\r\n this.endFrame();\r\n }\r\n }\r\n if (this._activeRenderLoops.length > 0) {\r\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\r\n }\r\n else {\r\n this._renderingQueueLaunched = false;\r\n }\r\n };\r\n /**\r\n * Gets the HTML canvas attached with the current webGL context\r\n * @returns a HTML canvas\r\n */\r\n ThinEngine.prototype.getRenderingCanvas = function () {\r\n return this._renderingCanvas;\r\n };\r\n /**\r\n * Gets host window\r\n * @returns the host window object\r\n */\r\n ThinEngine.prototype.getHostWindow = function () {\r\n if (!DomManagement.IsWindowObjectExist()) {\r\n return null;\r\n }\r\n if (this._renderingCanvas && this._renderingCanvas.ownerDocument && this._renderingCanvas.ownerDocument.defaultView) {\r\n return this._renderingCanvas.ownerDocument.defaultView;\r\n }\r\n return window;\r\n };\r\n /**\r\n * Gets the current render width\r\n * @param useScreen defines if screen size must be used (or the current render target if any)\r\n * @returns a number defining the current render width\r\n */\r\n ThinEngine.prototype.getRenderWidth = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.width;\r\n }\r\n return this._framebufferDimensionsObject ? this._framebufferDimensionsObject.framebufferWidth : this._gl.drawingBufferWidth;\r\n };\r\n /**\r\n * Gets the current render height\r\n * @param useScreen defines if screen size must be used (or the current render target if any)\r\n * @returns a number defining the current render height\r\n */\r\n ThinEngine.prototype.getRenderHeight = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.height;\r\n }\r\n return this._framebufferDimensionsObject ? this._framebufferDimensionsObject.framebufferHeight : this._gl.drawingBufferHeight;\r\n };\r\n /**\r\n * Can be used to override the current requestAnimationFrame requester.\r\n * @hidden\r\n */\r\n ThinEngine.prototype._queueNewFrame = function (bindedRenderFunction, requester) {\r\n return ThinEngine.QueueNewFrame(bindedRenderFunction, requester);\r\n };\r\n /**\r\n * Register and execute a render loop. The engine can have more than one render function\r\n * @param renderFunction defines the function to continuously execute\r\n */\r\n ThinEngine.prototype.runRenderLoop = function (renderFunction) {\r\n if (this._activeRenderLoops.indexOf(renderFunction) !== -1) {\r\n return;\r\n }\r\n this._activeRenderLoops.push(renderFunction);\r\n if (!this._renderingQueueLaunched) {\r\n this._renderingQueueLaunched = true;\r\n this._boundRenderFunction = this._renderLoop.bind(this);\r\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\r\n }\r\n };\r\n /**\r\n * Clear the current render buffer or the current render target (if any is set up)\r\n * @param color defines the color to use\r\n * @param backBuffer defines if the back buffer must be cleared\r\n * @param depth defines if the depth buffer must be cleared\r\n * @param stencil defines if the stencil buffer must be cleared\r\n */\r\n ThinEngine.prototype.clear = function (color, backBuffer, depth, stencil) {\r\n if (stencil === void 0) { stencil = false; }\r\n this.applyStates();\r\n var mode = 0;\r\n if (backBuffer && color) {\r\n this._gl.clearColor(color.r, color.g, color.b, color.a !== undefined ? color.a : 1.0);\r\n mode |= this._gl.COLOR_BUFFER_BIT;\r\n }\r\n if (depth) {\r\n if (this.useReverseDepthBuffer) {\r\n this._depthCullingState.depthFunc = this._gl.GREATER;\r\n this._gl.clearDepth(0.0);\r\n }\r\n else {\r\n this._gl.clearDepth(1.0);\r\n }\r\n mode |= this._gl.DEPTH_BUFFER_BIT;\r\n }\r\n if (stencil) {\r\n this._gl.clearStencil(0);\r\n mode |= this._gl.STENCIL_BUFFER_BIT;\r\n }\r\n this._gl.clear(mode);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._viewport = function (x, y, width, height) {\r\n if (x !== this._viewportCached.x ||\r\n y !== this._viewportCached.y ||\r\n width !== this._viewportCached.z ||\r\n height !== this._viewportCached.w) {\r\n this._viewportCached.x = x;\r\n this._viewportCached.y = y;\r\n this._viewportCached.z = width;\r\n this._viewportCached.w = height;\r\n this._gl.viewport(x, y, width, height);\r\n }\r\n };\r\n /**\r\n * Set the WebGL's viewport\r\n * @param viewport defines the viewport element to be used\r\n * @param requiredWidth defines the width required for rendering. If not provided the rendering canvas' width is used\r\n * @param requiredHeight defines the height required for rendering. If not provided the rendering canvas' height is used\r\n */\r\n ThinEngine.prototype.setViewport = function (viewport, requiredWidth, requiredHeight) {\r\n var width = requiredWidth || this.getRenderWidth();\r\n var height = requiredHeight || this.getRenderHeight();\r\n var x = viewport.x || 0;\r\n var y = viewport.y || 0;\r\n this._cachedViewport = viewport;\r\n this._viewport(x * width, y * height, width * viewport.width, height * viewport.height);\r\n };\r\n /**\r\n * Begin a new frame\r\n */\r\n ThinEngine.prototype.beginFrame = function () {\r\n };\r\n /**\r\n * Enf the current frame\r\n */\r\n ThinEngine.prototype.endFrame = function () {\r\n // Force a flush in case we are using a bad OS.\r\n if (this._badOS) {\r\n this.flushFramebuffer();\r\n }\r\n };\r\n /**\r\n * Resize the view according to the canvas' size\r\n */\r\n ThinEngine.prototype.resize = function () {\r\n var width;\r\n var height;\r\n if (DomManagement.IsWindowObjectExist()) {\r\n width = this._renderingCanvas ? (this._renderingCanvas.clientWidth || this._renderingCanvas.width) : window.innerWidth;\r\n height = this._renderingCanvas ? (this._renderingCanvas.clientHeight || this._renderingCanvas.height) : window.innerHeight;\r\n }\r\n else {\r\n width = this._renderingCanvas ? this._renderingCanvas.width : 100;\r\n height = this._renderingCanvas ? this._renderingCanvas.height : 100;\r\n }\r\n this.setSize(width / this._hardwareScalingLevel, height / this._hardwareScalingLevel);\r\n };\r\n /**\r\n * Force a specific size of the canvas\r\n * @param width defines the new canvas' width\r\n * @param height defines the new canvas' height\r\n * @returns true if the size was changed\r\n */\r\n ThinEngine.prototype.setSize = function (width, height) {\r\n if (!this._renderingCanvas) {\r\n return false;\r\n }\r\n width = width | 0;\r\n height = height | 0;\r\n if (this._renderingCanvas.width === width && this._renderingCanvas.height === height) {\r\n return false;\r\n }\r\n this._renderingCanvas.width = width;\r\n this._renderingCanvas.height = height;\r\n return true;\r\n };\r\n /**\r\n * Binds the frame buffer to the specified texture.\r\n * @param texture The texture to render to or null for the default canvas\r\n * @param faceIndex The face of the texture to render to in case of cube texture\r\n * @param requiredWidth The width of the target to render to\r\n * @param requiredHeight The height of the target to render to\r\n * @param forceFullscreenViewport Forces the viewport to be the entire texture/screen if true\r\n * @param lodLevel defines the lod level to bind to the frame buffer\r\n * @param layer defines the 2d array index to bind to frame buffer to\r\n */\r\n ThinEngine.prototype.bindFramebuffer = function (texture, faceIndex, requiredWidth, requiredHeight, forceFullscreenViewport, lodLevel, layer) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lodLevel === void 0) { lodLevel = 0; }\r\n if (layer === void 0) { layer = 0; }\r\n if (this._currentRenderTarget) {\r\n this.unBindFramebuffer(this._currentRenderTarget);\r\n }\r\n this._currentRenderTarget = texture;\r\n this._bindUnboundFramebuffer(texture._MSAAFramebuffer ? texture._MSAAFramebuffer : texture._framebuffer);\r\n var gl = this._gl;\r\n if (texture.is2DArray) {\r\n gl.framebufferTextureLayer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, texture._webGLTexture, lodLevel, layer);\r\n }\r\n else if (texture.isCube) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._webGLTexture, lodLevel);\r\n }\r\n var depthStencilTexture = texture._depthStencilTexture;\r\n if (depthStencilTexture) {\r\n var attachment = (depthStencilTexture._generateStencilBuffer) ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;\r\n if (texture.is2DArray) {\r\n gl.framebufferTextureLayer(gl.FRAMEBUFFER, attachment, depthStencilTexture._webGLTexture, lodLevel, layer);\r\n }\r\n else if (texture.isCube) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, depthStencilTexture._webGLTexture, lodLevel);\r\n }\r\n else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, depthStencilTexture._webGLTexture, lodLevel);\r\n }\r\n }\r\n if (this._cachedViewport && !forceFullscreenViewport) {\r\n this.setViewport(this._cachedViewport, requiredWidth, requiredHeight);\r\n }\r\n else {\r\n if (!requiredWidth) {\r\n requiredWidth = texture.width;\r\n if (lodLevel) {\r\n requiredWidth = requiredWidth / Math.pow(2, lodLevel);\r\n }\r\n }\r\n if (!requiredHeight) {\r\n requiredHeight = texture.height;\r\n if (lodLevel) {\r\n requiredHeight = requiredHeight / Math.pow(2, lodLevel);\r\n }\r\n }\r\n this._viewport(0, 0, requiredWidth, requiredHeight);\r\n }\r\n this.wipeCaches();\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._bindUnboundFramebuffer = function (framebuffer) {\r\n if (this._currentFramebuffer !== framebuffer) {\r\n this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer);\r\n this._currentFramebuffer = framebuffer;\r\n }\r\n };\r\n /**\r\n * Unbind the current render target texture from the webGL context\r\n * @param texture defines the render target texture to unbind\r\n * @param disableGenerateMipMaps defines a boolean indicating that mipmaps must not be generated\r\n * @param onBeforeUnbind defines a function which will be called before the effective unbind\r\n */\r\n ThinEngine.prototype.unBindFramebuffer = function (texture, disableGenerateMipMaps, onBeforeUnbind) {\r\n if (disableGenerateMipMaps === void 0) { disableGenerateMipMaps = false; }\r\n this._currentRenderTarget = null;\r\n // If MSAA, we need to bitblt back to main texture\r\n var gl = this._gl;\r\n if (texture._MSAAFramebuffer) {\r\n if (texture._textureArray) {\r\n // This texture is part of a MRT texture, we need to treat all attachments\r\n this.unBindMultiColorAttachmentFramebuffer(texture._textureArray, disableGenerateMipMaps, onBeforeUnbind);\r\n return;\r\n }\r\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, texture._MSAAFramebuffer);\r\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, texture._framebuffer);\r\n gl.blitFramebuffer(0, 0, texture.width, texture.height, 0, 0, texture.width, texture.height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\r\n }\r\n if (texture.generateMipMaps && !disableGenerateMipMaps && !texture.isCube) {\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n }\r\n if (onBeforeUnbind) {\r\n if (texture._MSAAFramebuffer) {\r\n // Bind the correct framebuffer\r\n this._bindUnboundFramebuffer(texture._framebuffer);\r\n }\r\n onBeforeUnbind();\r\n }\r\n this._bindUnboundFramebuffer(null);\r\n };\r\n /**\r\n * Force a webGL flush (ie. a flush of all waiting webGL commands)\r\n */\r\n ThinEngine.prototype.flushFramebuffer = function () {\r\n this._gl.flush();\r\n };\r\n /**\r\n * Unbind the current render target and bind the default framebuffer\r\n */\r\n ThinEngine.prototype.restoreDefaultFramebuffer = function () {\r\n if (this._currentRenderTarget) {\r\n this.unBindFramebuffer(this._currentRenderTarget);\r\n }\r\n else {\r\n this._bindUnboundFramebuffer(null);\r\n }\r\n if (this._cachedViewport) {\r\n this.setViewport(this._cachedViewport);\r\n }\r\n this.wipeCaches();\r\n };\r\n // VBOs\r\n /** @hidden */\r\n ThinEngine.prototype._resetVertexBufferBinding = function () {\r\n this.bindArrayBuffer(null);\r\n this._cachedVertexBuffers = null;\r\n };\r\n /**\r\n * Creates a vertex buffer\r\n * @param data the data for the vertex buffer\r\n * @returns the new WebGL static buffer\r\n */\r\n ThinEngine.prototype.createVertexBuffer = function (data) {\r\n return this._createVertexBuffer(data, this._gl.STATIC_DRAW);\r\n };\r\n ThinEngine.prototype._createVertexBuffer = function (data, usage) {\r\n var vbo = this._gl.createBuffer();\r\n if (!vbo) {\r\n throw new Error(\"Unable to create vertex buffer\");\r\n }\r\n var dataBuffer = new WebGLDataBuffer(vbo);\r\n this.bindArrayBuffer(dataBuffer);\r\n if (data instanceof Array) {\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(data), this._gl.STATIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, data, this._gl.STATIC_DRAW);\r\n }\r\n this._resetVertexBufferBinding();\r\n dataBuffer.references = 1;\r\n return dataBuffer;\r\n };\r\n /**\r\n * Creates a dynamic vertex buffer\r\n * @param data the data for the dynamic vertex buffer\r\n * @returns the new WebGL dynamic buffer\r\n */\r\n ThinEngine.prototype.createDynamicVertexBuffer = function (data) {\r\n return this._createVertexBuffer(data, this._gl.DYNAMIC_DRAW);\r\n };\r\n ThinEngine.prototype._resetIndexBufferBinding = function () {\r\n this.bindIndexBuffer(null);\r\n this._cachedIndexBuffer = null;\r\n };\r\n /**\r\n * Creates a new index buffer\r\n * @param indices defines the content of the index buffer\r\n * @param updatable defines if the index buffer must be updatable\r\n * @returns a new webGL buffer\r\n */\r\n ThinEngine.prototype.createIndexBuffer = function (indices, updatable) {\r\n var vbo = this._gl.createBuffer();\r\n var dataBuffer = new WebGLDataBuffer(vbo);\r\n if (!vbo) {\r\n throw new Error(\"Unable to create index buffer\");\r\n }\r\n this.bindIndexBuffer(dataBuffer);\r\n var data = this._normalizeIndexData(indices);\r\n this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, data, updatable ? this._gl.DYNAMIC_DRAW : this._gl.STATIC_DRAW);\r\n this._resetIndexBufferBinding();\r\n dataBuffer.references = 1;\r\n dataBuffer.is32Bits = (data.BYTES_PER_ELEMENT === 4);\r\n return dataBuffer;\r\n };\r\n ThinEngine.prototype._normalizeIndexData = function (indices) {\r\n if (indices instanceof Uint16Array) {\r\n return indices;\r\n }\r\n // Check 32 bit support\r\n if (this._caps.uintIndices) {\r\n if (indices instanceof Uint32Array) {\r\n return indices;\r\n }\r\n else {\r\n // number[] or Int32Array, check if 32 bit is necessary\r\n for (var index = 0; index < indices.length; index++) {\r\n if (indices[index] >= 65535) {\r\n return new Uint32Array(indices);\r\n }\r\n }\r\n return new Uint16Array(indices);\r\n }\r\n }\r\n // No 32 bit support, force conversion to 16 bit (values greater 16 bit are lost)\r\n return new Uint16Array(indices);\r\n };\r\n /**\r\n * Bind a webGL buffer to the webGL context\r\n * @param buffer defines the buffer to bind\r\n */\r\n ThinEngine.prototype.bindArrayBuffer = function (buffer) {\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.bindBuffer(buffer, this._gl.ARRAY_BUFFER);\r\n };\r\n /**\r\n * Bind a specific block at a given index in a specific shader program\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param blockName defines the block name\r\n * @param index defines the index where to bind the block\r\n */\r\n ThinEngine.prototype.bindUniformBlock = function (pipelineContext, blockName, index) {\r\n var program = pipelineContext.program;\r\n var uniformLocation = this._gl.getUniformBlockIndex(program, blockName);\r\n this._gl.uniformBlockBinding(program, uniformLocation, index);\r\n };\r\n ThinEngine.prototype.bindIndexBuffer = function (buffer) {\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.bindBuffer(buffer, this._gl.ELEMENT_ARRAY_BUFFER);\r\n };\r\n ThinEngine.prototype.bindBuffer = function (buffer, target) {\r\n if (this._vaoRecordInProgress || this._currentBoundBuffer[target] !== buffer) {\r\n this._gl.bindBuffer(target, buffer ? buffer.underlyingResource : null);\r\n this._currentBoundBuffer[target] = buffer;\r\n }\r\n };\r\n /**\r\n * update the bound buffer with the given data\r\n * @param data defines the data to update\r\n */\r\n ThinEngine.prototype.updateArrayBuffer = function (data) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\r\n };\r\n ThinEngine.prototype._vertexAttribPointer = function (buffer, indx, size, type, normalized, stride, offset) {\r\n var pointer = this._currentBufferPointers[indx];\r\n if (!pointer) {\r\n return;\r\n }\r\n var changed = false;\r\n if (!pointer.active) {\r\n changed = true;\r\n pointer.active = true;\r\n pointer.index = indx;\r\n pointer.size = size;\r\n pointer.type = type;\r\n pointer.normalized = normalized;\r\n pointer.stride = stride;\r\n pointer.offset = offset;\r\n pointer.buffer = buffer;\r\n }\r\n else {\r\n if (pointer.buffer !== buffer) {\r\n pointer.buffer = buffer;\r\n changed = true;\r\n }\r\n if (pointer.size !== size) {\r\n pointer.size = size;\r\n changed = true;\r\n }\r\n if (pointer.type !== type) {\r\n pointer.type = type;\r\n changed = true;\r\n }\r\n if (pointer.normalized !== normalized) {\r\n pointer.normalized = normalized;\r\n changed = true;\r\n }\r\n if (pointer.stride !== stride) {\r\n pointer.stride = stride;\r\n changed = true;\r\n }\r\n if (pointer.offset !== offset) {\r\n pointer.offset = offset;\r\n changed = true;\r\n }\r\n }\r\n if (changed || this._vaoRecordInProgress) {\r\n this.bindArrayBuffer(buffer);\r\n this._gl.vertexAttribPointer(indx, size, type, normalized, stride, offset);\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._bindIndexBufferWithCache = function (indexBuffer) {\r\n if (indexBuffer == null) {\r\n return;\r\n }\r\n if (this._cachedIndexBuffer !== indexBuffer) {\r\n this._cachedIndexBuffer = indexBuffer;\r\n this.bindIndexBuffer(indexBuffer);\r\n this._uintIndicesCurrentlySet = indexBuffer.is32Bits;\r\n }\r\n };\r\n ThinEngine.prototype._bindVertexBuffersAttributes = function (vertexBuffers, effect) {\r\n var attributes = effect.getAttributesNames();\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.unbindAllAttributes();\r\n for (var index = 0; index < attributes.length; index++) {\r\n var order = effect.getAttributeLocation(index);\r\n if (order >= 0) {\r\n var vertexBuffer = vertexBuffers[attributes[index]];\r\n if (!vertexBuffer) {\r\n continue;\r\n }\r\n this._gl.enableVertexAttribArray(order);\r\n if (!this._vaoRecordInProgress) {\r\n this._vertexAttribArraysEnabled[order] = true;\r\n }\r\n var buffer = vertexBuffer.getBuffer();\r\n if (buffer) {\r\n this._vertexAttribPointer(buffer, order, vertexBuffer.getSize(), vertexBuffer.type, vertexBuffer.normalized, vertexBuffer.byteStride, vertexBuffer.byteOffset);\r\n if (vertexBuffer.getIsInstanced()) {\r\n this._gl.vertexAttribDivisor(order, vertexBuffer.getInstanceDivisor());\r\n if (!this._vaoRecordInProgress) {\r\n this._currentInstanceLocations.push(order);\r\n this._currentInstanceBuffers.push(buffer);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Records a vertex array object\r\n * @see https://doc.babylonjs.com/features/webgl2#vertex-array-objects\r\n * @param vertexBuffers defines the list of vertex buffers to store\r\n * @param indexBuffer defines the index buffer to store\r\n * @param effect defines the effect to store\r\n * @returns the new vertex array object\r\n */\r\n ThinEngine.prototype.recordVertexArrayObject = function (vertexBuffers, indexBuffer, effect) {\r\n var vao = this._gl.createVertexArray();\r\n this._vaoRecordInProgress = true;\r\n this._gl.bindVertexArray(vao);\r\n this._mustWipeVertexAttributes = true;\r\n this._bindVertexBuffersAttributes(vertexBuffers, effect);\r\n this.bindIndexBuffer(indexBuffer);\r\n this._vaoRecordInProgress = false;\r\n this._gl.bindVertexArray(null);\r\n return vao;\r\n };\r\n /**\r\n * Bind a specific vertex array object\r\n * @see https://doc.babylonjs.com/features/webgl2#vertex-array-objects\r\n * @param vertexArrayObject defines the vertex array object to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n */\r\n ThinEngine.prototype.bindVertexArrayObject = function (vertexArrayObject, indexBuffer) {\r\n if (this._cachedVertexArrayObject !== vertexArrayObject) {\r\n this._cachedVertexArrayObject = vertexArrayObject;\r\n this._gl.bindVertexArray(vertexArrayObject);\r\n this._cachedVertexBuffers = null;\r\n this._cachedIndexBuffer = null;\r\n this._uintIndicesCurrentlySet = indexBuffer != null && indexBuffer.is32Bits;\r\n this._mustWipeVertexAttributes = true;\r\n }\r\n };\r\n /**\r\n * Bind webGl buffers directly to the webGL context\r\n * @param vertexBuffer defines the vertex buffer to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n * @param vertexDeclaration defines the vertex declaration to use with the vertex buffer\r\n * @param vertexStrideSize defines the vertex stride of the vertex buffer\r\n * @param effect defines the effect associated with the vertex buffer\r\n */\r\n ThinEngine.prototype.bindBuffersDirectly = function (vertexBuffer, indexBuffer, vertexDeclaration, vertexStrideSize, effect) {\r\n if (this._cachedVertexBuffers !== vertexBuffer || this._cachedEffectForVertexBuffers !== effect) {\r\n this._cachedVertexBuffers = vertexBuffer;\r\n this._cachedEffectForVertexBuffers = effect;\r\n var attributesCount = effect.getAttributesCount();\r\n this._unbindVertexArrayObject();\r\n this.unbindAllAttributes();\r\n var offset = 0;\r\n for (var index = 0; index < attributesCount; index++) {\r\n if (index < vertexDeclaration.length) {\r\n var order = effect.getAttributeLocation(index);\r\n if (order >= 0) {\r\n this._gl.enableVertexAttribArray(order);\r\n this._vertexAttribArraysEnabled[order] = true;\r\n this._vertexAttribPointer(vertexBuffer, order, vertexDeclaration[index], this._gl.FLOAT, false, vertexStrideSize, offset);\r\n }\r\n offset += vertexDeclaration[index] * 4;\r\n }\r\n }\r\n }\r\n this._bindIndexBufferWithCache(indexBuffer);\r\n };\r\n ThinEngine.prototype._unbindVertexArrayObject = function () {\r\n if (!this._cachedVertexArrayObject) {\r\n return;\r\n }\r\n this._cachedVertexArrayObject = null;\r\n this._gl.bindVertexArray(null);\r\n };\r\n /**\r\n * Bind a list of vertex buffers to the webGL context\r\n * @param vertexBuffers defines the list of vertex buffers to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n * @param effect defines the effect associated with the vertex buffers\r\n */\r\n ThinEngine.prototype.bindBuffers = function (vertexBuffers, indexBuffer, effect) {\r\n if (this._cachedVertexBuffers !== vertexBuffers || this._cachedEffectForVertexBuffers !== effect) {\r\n this._cachedVertexBuffers = vertexBuffers;\r\n this._cachedEffectForVertexBuffers = effect;\r\n this._bindVertexBuffersAttributes(vertexBuffers, effect);\r\n }\r\n this._bindIndexBufferWithCache(indexBuffer);\r\n };\r\n /**\r\n * Unbind all instance attributes\r\n */\r\n ThinEngine.prototype.unbindInstanceAttributes = function () {\r\n var boundBuffer;\r\n for (var i = 0, ul = this._currentInstanceLocations.length; i < ul; i++) {\r\n var instancesBuffer = this._currentInstanceBuffers[i];\r\n if (boundBuffer != instancesBuffer && instancesBuffer.references) {\r\n boundBuffer = instancesBuffer;\r\n this.bindArrayBuffer(instancesBuffer);\r\n }\r\n var offsetLocation = this._currentInstanceLocations[i];\r\n this._gl.vertexAttribDivisor(offsetLocation, 0);\r\n }\r\n this._currentInstanceBuffers.length = 0;\r\n this._currentInstanceLocations.length = 0;\r\n };\r\n /**\r\n * Release and free the memory of a vertex array object\r\n * @param vao defines the vertex array object to delete\r\n */\r\n ThinEngine.prototype.releaseVertexArrayObject = function (vao) {\r\n this._gl.deleteVertexArray(vao);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._releaseBuffer = function (buffer) {\r\n buffer.references--;\r\n if (buffer.references === 0) {\r\n this._deleteBuffer(buffer);\r\n return true;\r\n }\r\n return false;\r\n };\r\n ThinEngine.prototype._deleteBuffer = function (buffer) {\r\n this._gl.deleteBuffer(buffer.underlyingResource);\r\n };\r\n /**\r\n * Update the content of a webGL buffer used with instanciation and bind it to the webGL context\r\n * @param instancesBuffer defines the webGL buffer to update and bind\r\n * @param data defines the data to store in the buffer\r\n * @param offsetLocations defines the offsets or attributes information used to determine where data must be stored in the buffer\r\n */\r\n ThinEngine.prototype.updateAndBindInstancesBuffer = function (instancesBuffer, data, offsetLocations) {\r\n this.bindArrayBuffer(instancesBuffer);\r\n if (data) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\r\n }\r\n if (offsetLocations[0].index !== undefined) {\r\n this.bindInstancesBuffer(instancesBuffer, offsetLocations, true);\r\n }\r\n else {\r\n for (var index = 0; index < 4; index++) {\r\n var offsetLocation = offsetLocations[index];\r\n if (!this._vertexAttribArraysEnabled[offsetLocation]) {\r\n this._gl.enableVertexAttribArray(offsetLocation);\r\n this._vertexAttribArraysEnabled[offsetLocation] = true;\r\n }\r\n this._vertexAttribPointer(instancesBuffer, offsetLocation, 4, this._gl.FLOAT, false, 64, index * 16);\r\n this._gl.vertexAttribDivisor(offsetLocation, 1);\r\n this._currentInstanceLocations.push(offsetLocation);\r\n this._currentInstanceBuffers.push(instancesBuffer);\r\n }\r\n }\r\n };\r\n /**\r\n * Bind the content of a webGL buffer used with instantiation\r\n * @param instancesBuffer defines the webGL buffer to bind\r\n * @param attributesInfo defines the offsets or attributes information used to determine where data must be stored in the buffer\r\n * @param computeStride defines Whether to compute the strides from the info or use the default 0\r\n */\r\n ThinEngine.prototype.bindInstancesBuffer = function (instancesBuffer, attributesInfo, computeStride) {\r\n if (computeStride === void 0) { computeStride = true; }\r\n this.bindArrayBuffer(instancesBuffer);\r\n var stride = 0;\r\n if (computeStride) {\r\n for (var i = 0; i < attributesInfo.length; i++) {\r\n var ai = attributesInfo[i];\r\n stride += ai.attributeSize * 4;\r\n }\r\n }\r\n for (var i = 0; i < attributesInfo.length; i++) {\r\n var ai = attributesInfo[i];\r\n if (ai.index === undefined) {\r\n ai.index = this._currentEffect.getAttributeLocationByName(ai.attributeName);\r\n }\r\n if (ai.index < 0) {\r\n continue;\r\n }\r\n if (!this._vertexAttribArraysEnabled[ai.index]) {\r\n this._gl.enableVertexAttribArray(ai.index);\r\n this._vertexAttribArraysEnabled[ai.index] = true;\r\n }\r\n this._vertexAttribPointer(instancesBuffer, ai.index, ai.attributeSize, ai.attributeType || this._gl.FLOAT, ai.normalized || false, stride, ai.offset);\r\n this._gl.vertexAttribDivisor(ai.index, ai.divisor === undefined ? 1 : ai.divisor);\r\n this._currentInstanceLocations.push(ai.index);\r\n this._currentInstanceBuffers.push(instancesBuffer);\r\n }\r\n };\r\n /**\r\n * Disable the instance attribute corresponding to the name in parameter\r\n * @param name defines the name of the attribute to disable\r\n */\r\n ThinEngine.prototype.disableInstanceAttributeByName = function (name) {\r\n if (!this._currentEffect) {\r\n return;\r\n }\r\n var attributeLocation = this._currentEffect.getAttributeLocationByName(name);\r\n this.disableInstanceAttribute(attributeLocation);\r\n };\r\n /**\r\n * Disable the instance attribute corresponding to the location in parameter\r\n * @param attributeLocation defines the attribute location of the attribute to disable\r\n */\r\n ThinEngine.prototype.disableInstanceAttribute = function (attributeLocation) {\r\n var shouldClean = false;\r\n var index;\r\n while ((index = this._currentInstanceLocations.indexOf(attributeLocation)) !== -1) {\r\n this._currentInstanceLocations.splice(index, 1);\r\n this._currentInstanceBuffers.splice(index, 1);\r\n shouldClean = true;\r\n index = this._currentInstanceLocations.indexOf(attributeLocation);\r\n }\r\n if (shouldClean) {\r\n this._gl.vertexAttribDivisor(attributeLocation, 0);\r\n this.disableAttributeByIndex(attributeLocation);\r\n }\r\n };\r\n /**\r\n * Disable the attribute corresponding to the location in parameter\r\n * @param attributeLocation defines the attribute location of the attribute to disable\r\n */\r\n ThinEngine.prototype.disableAttributeByIndex = function (attributeLocation) {\r\n this._gl.disableVertexAttribArray(attributeLocation);\r\n this._vertexAttribArraysEnabled[attributeLocation] = false;\r\n this._currentBufferPointers[attributeLocation].active = false;\r\n };\r\n /**\r\n * Send a draw order\r\n * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)\r\n * @param indexStart defines the starting index\r\n * @param indexCount defines the number of index to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.draw = function (useTriangles, indexStart, indexCount, instancesCount) {\r\n this.drawElementsType(useTriangles ? 0 : 1, indexStart, indexCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of points\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.drawPointClouds = function (verticesStart, verticesCount, instancesCount) {\r\n this.drawArraysType(2, verticesStart, verticesCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of unindexed primitives\r\n * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.drawUnIndexed = function (useTriangles, verticesStart, verticesCount, instancesCount) {\r\n this.drawArraysType(useTriangles ? 0 : 1, verticesStart, verticesCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of indexed primitives\r\n * @param fillMode defines the primitive to use\r\n * @param indexStart defines the starting index\r\n * @param indexCount defines the number of index to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.drawElementsType = function (fillMode, indexStart, indexCount, instancesCount) {\r\n // Apply states\r\n this.applyStates();\r\n this._reportDrawCall();\r\n // Render\r\n var drawMode = this._drawMode(fillMode);\r\n var indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;\r\n var mult = this._uintIndicesCurrentlySet ? 4 : 2;\r\n if (instancesCount) {\r\n this._gl.drawElementsInstanced(drawMode, indexCount, indexFormat, indexStart * mult, instancesCount);\r\n }\r\n else {\r\n this._gl.drawElements(drawMode, indexCount, indexFormat, indexStart * mult);\r\n }\r\n };\r\n /**\r\n * Draw a list of unindexed primitives\r\n * @param fillMode defines the primitive to use\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.drawArraysType = function (fillMode, verticesStart, verticesCount, instancesCount) {\r\n // Apply states\r\n this.applyStates();\r\n this._reportDrawCall();\r\n var drawMode = this._drawMode(fillMode);\r\n if (instancesCount) {\r\n this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);\r\n }\r\n else {\r\n this._gl.drawArrays(drawMode, verticesStart, verticesCount);\r\n }\r\n };\r\n ThinEngine.prototype._drawMode = function (fillMode) {\r\n switch (fillMode) {\r\n // Triangle views\r\n case 0:\r\n return this._gl.TRIANGLES;\r\n case 2:\r\n return this._gl.POINTS;\r\n case 1:\r\n return this._gl.LINES;\r\n // Draw modes\r\n case 3:\r\n return this._gl.POINTS;\r\n case 4:\r\n return this._gl.LINES;\r\n case 5:\r\n return this._gl.LINE_LOOP;\r\n case 6:\r\n return this._gl.LINE_STRIP;\r\n case 7:\r\n return this._gl.TRIANGLE_STRIP;\r\n case 8:\r\n return this._gl.TRIANGLE_FAN;\r\n default:\r\n return this._gl.TRIANGLES;\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._reportDrawCall = function () {\r\n // Will be implemented by children\r\n };\r\n // Shaders\r\n /** @hidden */\r\n ThinEngine.prototype._releaseEffect = function (effect) {\r\n if (this._compiledEffects[effect._key]) {\r\n delete this._compiledEffects[effect._key];\r\n this._deletePipelineContext(effect.getPipelineContext());\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._deletePipelineContext = function (pipelineContext) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (webGLPipelineContext && webGLPipelineContext.program) {\r\n webGLPipelineContext.program.__SPECTOR_rebuildProgram = null;\r\n this._gl.deleteProgram(webGLPipelineContext.program);\r\n }\r\n };\r\n /**\r\n * Create a new effect (used to store vertex/fragment shaders)\r\n * @param baseName defines the base name of the effect (The name of file without .fragment.fx or .vertex.fx)\r\n * @param attributesNamesOrOptions defines either a list of attribute names or an IEffectCreationOptions object\r\n * @param uniformsNamesOrEngine defines either a list of uniform names or the engine to use\r\n * @param samplers defines an array of string used to represent textures\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param fallbacks defines the list of potential fallbacks to use if shader conmpilation fails\r\n * @param onCompiled defines a function to call when the effect creation is successful\r\n * @param onError defines a function to call when the effect creation has failed\r\n * @param indexParameters defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)\r\n * @returns the new Effect\r\n */\r\n ThinEngine.prototype.createEffect = function (baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, defines, fallbacks, onCompiled, onError, indexParameters) {\r\n var vertex = baseName.vertexElement || baseName.vertex || baseName.vertexToken || baseName.vertexSource || baseName;\r\n var fragment = baseName.fragmentElement || baseName.fragment || baseName.fragmentToken || baseName.fragmentSource || baseName;\r\n var name = vertex + \"+\" + fragment + \"@\" + (defines ? defines : attributesNamesOrOptions.defines);\r\n if (this._compiledEffects[name]) {\r\n var compiledEffect = this._compiledEffects[name];\r\n if (onCompiled && compiledEffect.isReady()) {\r\n onCompiled(compiledEffect);\r\n }\r\n return compiledEffect;\r\n }\r\n var effect = new Effect(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, this, defines, fallbacks, onCompiled, onError, indexParameters);\r\n effect._key = name;\r\n this._compiledEffects[name] = effect;\r\n return effect;\r\n };\r\n ThinEngine._ConcatenateShader = function (source, defines, shaderVersion) {\r\n if (shaderVersion === void 0) { shaderVersion = \"\"; }\r\n return shaderVersion + (defines ? defines + \"\\n\" : \"\") + source;\r\n };\r\n ThinEngine.prototype._compileShader = function (source, type, defines, shaderVersion) {\r\n return this._compileRawShader(ThinEngine._ConcatenateShader(source, defines, shaderVersion), type);\r\n };\r\n ThinEngine.prototype._compileRawShader = function (source, type) {\r\n var gl = this._gl;\r\n var shader = gl.createShader(type === \"vertex\" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);\r\n if (!shader) {\r\n throw new Error(\"Something went wrong while compile the shader.\");\r\n }\r\n gl.shaderSource(shader, source);\r\n gl.compileShader(shader);\r\n return shader;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getShaderSource = function (shader) {\r\n return this._gl.getShaderSource(shader);\r\n };\r\n /**\r\n * Directly creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @returns the new webGL program\r\n */\r\n ThinEngine.prototype.createRawShaderProgram = function (pipelineContext, vertexCode, fragmentCode, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n context = context || this._gl;\r\n var vertexShader = this._compileRawShader(vertexCode, \"vertex\");\r\n var fragmentShader = this._compileRawShader(fragmentCode, \"fragment\");\r\n return this._createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings);\r\n };\r\n /**\r\n * Creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @returns the new webGL program\r\n */\r\n ThinEngine.prototype.createShaderProgram = function (pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n context = context || this._gl;\r\n var shaderVersion = (this._webGLVersion > 1) ? \"#version 300 es\\n#define WEBGL2 \\n\" : \"\";\r\n var vertexShader = this._compileShader(vertexCode, \"vertex\", defines, shaderVersion);\r\n var fragmentShader = this._compileShader(fragmentCode, \"fragment\", defines, shaderVersion);\r\n return this._createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings);\r\n };\r\n /**\r\n * Creates a new pipeline context\r\n * @returns the new pipeline\r\n */\r\n ThinEngine.prototype.createPipelineContext = function () {\r\n var pipelineContext = new WebGLPipelineContext();\r\n pipelineContext.engine = this;\r\n if (this._caps.parallelShaderCompile) {\r\n pipelineContext.isParallelCompiled = true;\r\n }\r\n return pipelineContext;\r\n };\r\n ThinEngine.prototype._createShaderProgram = function (pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n var shaderProgram = context.createProgram();\r\n pipelineContext.program = shaderProgram;\r\n if (!shaderProgram) {\r\n throw new Error(\"Unable to create program\");\r\n }\r\n context.attachShader(shaderProgram, vertexShader);\r\n context.attachShader(shaderProgram, fragmentShader);\r\n context.linkProgram(shaderProgram);\r\n pipelineContext.context = context;\r\n pipelineContext.vertexShader = vertexShader;\r\n pipelineContext.fragmentShader = fragmentShader;\r\n if (!pipelineContext.isParallelCompiled) {\r\n this._finalizePipelineContext(pipelineContext);\r\n }\r\n return shaderProgram;\r\n };\r\n ThinEngine.prototype._finalizePipelineContext = function (pipelineContext) {\r\n var context = pipelineContext.context;\r\n var vertexShader = pipelineContext.vertexShader;\r\n var fragmentShader = pipelineContext.fragmentShader;\r\n var program = pipelineContext.program;\r\n var linked = context.getProgramParameter(program, context.LINK_STATUS);\r\n if (!linked) { // Get more info\r\n // Vertex\r\n if (!this._gl.getShaderParameter(vertexShader, this._gl.COMPILE_STATUS)) {\r\n var log = this._gl.getShaderInfoLog(vertexShader);\r\n if (log) {\r\n pipelineContext.vertexCompilationError = log;\r\n throw new Error(\"VERTEX SHADER \" + log);\r\n }\r\n }\r\n // Fragment\r\n if (!this._gl.getShaderParameter(fragmentShader, this._gl.COMPILE_STATUS)) {\r\n var log = this._gl.getShaderInfoLog(fragmentShader);\r\n if (log) {\r\n pipelineContext.fragmentCompilationError = log;\r\n throw new Error(\"FRAGMENT SHADER \" + log);\r\n }\r\n }\r\n var error = context.getProgramInfoLog(program);\r\n if (error) {\r\n pipelineContext.programLinkError = error;\r\n throw new Error(error);\r\n }\r\n }\r\n if (this.validateShaderPrograms) {\r\n context.validateProgram(program);\r\n var validated = context.getProgramParameter(program, context.VALIDATE_STATUS);\r\n if (!validated) {\r\n var error = context.getProgramInfoLog(program);\r\n if (error) {\r\n pipelineContext.programValidationError = error;\r\n throw new Error(error);\r\n }\r\n }\r\n }\r\n context.deleteShader(vertexShader);\r\n context.deleteShader(fragmentShader);\r\n pipelineContext.vertexShader = undefined;\r\n pipelineContext.fragmentShader = undefined;\r\n if (pipelineContext.onCompiled) {\r\n pipelineContext.onCompiled();\r\n pipelineContext.onCompiled = undefined;\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._preparePipelineContext = function (pipelineContext, vertexSourceCode, fragmentSourceCode, createAsRaw, rebuildRebind, defines, transformFeedbackVaryings) {\r\n var webGLRenderingState = pipelineContext;\r\n if (createAsRaw) {\r\n webGLRenderingState.program = this.createRawShaderProgram(webGLRenderingState, vertexSourceCode, fragmentSourceCode, undefined, transformFeedbackVaryings);\r\n }\r\n else {\r\n webGLRenderingState.program = this.createShaderProgram(webGLRenderingState, vertexSourceCode, fragmentSourceCode, defines, undefined, transformFeedbackVaryings);\r\n }\r\n webGLRenderingState.program.__SPECTOR_rebuildProgram = rebuildRebind;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._isRenderingStateCompiled = function (pipelineContext) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (this._gl.getProgramParameter(webGLPipelineContext.program, this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)) {\r\n this._finalizePipelineContext(webGLPipelineContext);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._executeWhenRenderingStateIsCompiled = function (pipelineContext, action) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (!webGLPipelineContext.isParallelCompiled) {\r\n action();\r\n return;\r\n }\r\n var oldHandler = webGLPipelineContext.onCompiled;\r\n if (oldHandler) {\r\n webGLPipelineContext.onCompiled = function () {\r\n oldHandler();\r\n action();\r\n };\r\n }\r\n else {\r\n webGLPipelineContext.onCompiled = action;\r\n }\r\n };\r\n /**\r\n * Gets the list of webGL uniform locations associated with a specific program based on a list of uniform names\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param uniformsNames defines the list of uniform names\r\n * @returns an array of webGL uniform locations\r\n */\r\n ThinEngine.prototype.getUniforms = function (pipelineContext, uniformsNames) {\r\n var results = new Array();\r\n var webGLPipelineContext = pipelineContext;\r\n for (var index = 0; index < uniformsNames.length; index++) {\r\n results.push(this._gl.getUniformLocation(webGLPipelineContext.program, uniformsNames[index]));\r\n }\r\n return results;\r\n };\r\n /**\r\n * Gets the lsit of active attributes for a given webGL program\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param attributesNames defines the list of attribute names to get\r\n * @returns an array of indices indicating the offset of each attribute\r\n */\r\n ThinEngine.prototype.getAttributes = function (pipelineContext, attributesNames) {\r\n var results = [];\r\n var webGLPipelineContext = pipelineContext;\r\n for (var index = 0; index < attributesNames.length; index++) {\r\n try {\r\n results.push(this._gl.getAttribLocation(webGLPipelineContext.program, attributesNames[index]));\r\n }\r\n catch (e) {\r\n results.push(-1);\r\n }\r\n }\r\n return results;\r\n };\r\n /**\r\n * Activates an effect, mkaing it the current one (ie. the one used for rendering)\r\n * @param effect defines the effect to activate\r\n */\r\n ThinEngine.prototype.enableEffect = function (effect) {\r\n if (!effect || effect === this._currentEffect) {\r\n return;\r\n }\r\n // Use program\r\n this.bindSamplers(effect);\r\n this._currentEffect = effect;\r\n if (effect.onBind) {\r\n effect.onBind(effect);\r\n }\r\n if (effect._onBindObservable) {\r\n effect._onBindObservable.notifyObservers(effect);\r\n }\r\n };\r\n /**\r\n * Set the value of an uniform to a number (int)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param value defines the int number to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setInt = function (uniform, value) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniform1i(uniform, value);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setIntArray = function (uniform, array) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniform1iv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setIntArray2 = function (uniform, array) {\r\n if (!uniform || array.length % 2 !== 0) {\r\n return false;\r\n }\r\n this._gl.uniform2iv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setIntArray3 = function (uniform, array) {\r\n if (!uniform || array.length % 3 !== 0) {\r\n return false;\r\n }\r\n this._gl.uniform3iv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec4)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setIntArray4 = function (uniform, array) {\r\n if (!uniform || array.length % 4 !== 0) {\r\n return false;\r\n }\r\n this._gl.uniform4iv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setArray = function (uniform, array) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniform1fv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setArray2 = function (uniform, array) {\r\n if (!uniform || array.length % 2 !== 0) {\r\n return false;\r\n }\r\n this._gl.uniform2fv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setArray3 = function (uniform, array) {\r\n if (!uniform || array.length % 3 !== 0) {\r\n return false;\r\n }\r\n this._gl.uniform3fv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec4)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setArray4 = function (uniform, array) {\r\n if (!uniform || array.length % 4 !== 0) {\r\n return false;\r\n }\r\n this._gl.uniform4fv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of float32 (stored as matrices)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrices defines the array of float32 to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setMatrices = function (uniform, matrices) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniformMatrix4fv(uniform, false, matrices);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to a matrix (3x3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrix defines the Float32Array representing the 3x3 matrix to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setMatrix3x3 = function (uniform, matrix) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniformMatrix3fv(uniform, false, matrix);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to a matrix (2x2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrix defines the Float32Array representing the 2x2 matrix to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setMatrix2x2 = function (uniform, matrix) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniformMatrix2fv(uniform, false, matrix);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to a number (float)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param value defines the float number to store\r\n * @returns true if the value was transfered\r\n */\r\n ThinEngine.prototype.setFloat = function (uniform, value) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniform1f(uniform, value);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to a vec2\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setFloat2 = function (uniform, x, y) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniform2f(uniform, x, y);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to a vec3\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n * @param z defines the 3rd component of the value\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setFloat3 = function (uniform, x, y, z) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniform3f(uniform, x, y, z);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to a vec4\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n * @param z defines the 3rd component of the value\r\n * @param w defines the 4th component of the value\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setFloat4 = function (uniform, x, y, z, w) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniform4f(uniform, x, y, z, w);\r\n return true;\r\n };\r\n // States\r\n /**\r\n * Apply all cached states (depth, culling, stencil and alpha)\r\n */\r\n ThinEngine.prototype.applyStates = function () {\r\n this._depthCullingState.apply(this._gl);\r\n this._stencilState.apply(this._gl);\r\n this._alphaState.apply(this._gl);\r\n if (this._colorWriteChanged) {\r\n this._colorWriteChanged = false;\r\n var enable = this._colorWrite;\r\n this._gl.colorMask(enable, enable, enable, enable);\r\n }\r\n };\r\n /**\r\n * Enable or disable color writing\r\n * @param enable defines the state to set\r\n */\r\n ThinEngine.prototype.setColorWrite = function (enable) {\r\n if (enable !== this._colorWrite) {\r\n this._colorWriteChanged = true;\r\n this._colorWrite = enable;\r\n }\r\n };\r\n /**\r\n * Gets a boolean indicating if color writing is enabled\r\n * @returns the current color writing state\r\n */\r\n ThinEngine.prototype.getColorWrite = function () {\r\n return this._colorWrite;\r\n };\r\n Object.defineProperty(ThinEngine.prototype, \"depthCullingState\", {\r\n /**\r\n * Gets the depth culling state manager\r\n */\r\n get: function () {\r\n return this._depthCullingState;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"alphaState\", {\r\n /**\r\n * Gets the alpha state manager\r\n */\r\n get: function () {\r\n return this._alphaState;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"stencilState\", {\r\n /**\r\n * Gets the stencil state manager\r\n */\r\n get: function () {\r\n return this._stencilState;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Textures\r\n /**\r\n * Clears the list of texture accessible through engine.\r\n * This can help preventing texture load conflict due to name collision.\r\n */\r\n ThinEngine.prototype.clearInternalTexturesCache = function () {\r\n this._internalTexturesCache = [];\r\n };\r\n /**\r\n * Force the entire cache to be cleared\r\n * You should not have to use this function unless your engine needs to share the webGL context with another engine\r\n * @param bruteForce defines a boolean to force clearing ALL caches (including stencil, detoh and alpha states)\r\n */\r\n ThinEngine.prototype.wipeCaches = function (bruteForce) {\r\n if (this.preventCacheWipeBetweenFrames && !bruteForce) {\r\n return;\r\n }\r\n this._currentEffect = null;\r\n this._viewportCached.x = 0;\r\n this._viewportCached.y = 0;\r\n this._viewportCached.z = 0;\r\n this._viewportCached.w = 0;\r\n // Done before in case we clean the attributes\r\n this._unbindVertexArrayObject();\r\n if (bruteForce) {\r\n this._currentProgram = null;\r\n this.resetTextureCache();\r\n this._stencilState.reset();\r\n this._depthCullingState.reset();\r\n this._depthCullingState.depthFunc = this._gl.LEQUAL;\r\n this._alphaState.reset();\r\n this._alphaMode = 1;\r\n this._alphaEquation = 0;\r\n this._colorWrite = true;\r\n this._colorWriteChanged = true;\r\n this._unpackFlipYCached = null;\r\n this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);\r\n this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);\r\n this._mustWipeVertexAttributes = true;\r\n this.unbindAllAttributes();\r\n }\r\n this._resetVertexBufferBinding();\r\n this._cachedIndexBuffer = null;\r\n this._cachedEffectForVertexBuffers = null;\r\n this.bindIndexBuffer(null);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getSamplingParameters = function (samplingMode, generateMipMaps) {\r\n var gl = this._gl;\r\n var magFilter = gl.NEAREST;\r\n var minFilter = gl.NEAREST;\r\n switch (samplingMode) {\r\n case 11:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case 3:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case 8:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case 4:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case 5:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case 6:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case 7:\r\n magFilter = gl.NEAREST;\r\n minFilter = gl.LINEAR;\r\n break;\r\n case 1:\r\n magFilter = gl.NEAREST;\r\n minFilter = gl.NEAREST;\r\n break;\r\n case 9:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case 10:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case 2:\r\n magFilter = gl.LINEAR;\r\n minFilter = gl.LINEAR;\r\n break;\r\n case 12:\r\n magFilter = gl.LINEAR;\r\n minFilter = gl.NEAREST;\r\n break;\r\n }\r\n return {\r\n min: minFilter,\r\n mag: magFilter\r\n };\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._createTexture = function () {\r\n var texture = this._gl.createTexture();\r\n if (!texture) {\r\n throw new Error(\"Unable to create texture\");\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Usually called from Texture.ts.\r\n * Passed information to create a WebGLTexture\r\n * @param url defines a value which contains one of the following:\r\n * * A conventional http URL, e.g. 'http://...' or 'file://...'\r\n * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'\r\n * * An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated. Ignored for compressed textures. They must be in the file\r\n * @param invertY when true, image is flipped when loaded. You probably want true. Certain compressed textures may invert this if their default is inverted (eg. ktx)\r\n * @param scene needed for loading to the correct scene\r\n * @param samplingMode mode with should be used sample / access the texture (Default: Texture.TRILINEAR_SAMPLINGMODE)\r\n * @param onLoad optional callback to be called upon successful completion\r\n * @param onError optional callback to be called upon failure\r\n * @param buffer a source of a file previously fetched as either a base64 string, an ArrayBuffer (compressed or image format), HTMLImageElement (image format), or a Blob\r\n * @param fallback an internal argument in case the function must be called again, due to etc1 not having alpha capabilities\r\n * @param format internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param mimeType defines an optional mime type\r\n * @param loaderOptions options to be passed to the loader\r\n * @returns a InternalTexture for assignment back into BABYLON.Texture\r\n */\r\n ThinEngine.prototype.createTexture = function (url, noMipmap, invertY, scene, samplingMode, onLoad, onError, buffer, fallback, format, forcedExtension, mimeType, loaderOptions) {\r\n var _this = this;\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (fallback === void 0) { fallback = null; }\r\n if (format === void 0) { format = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n url = url || \"\";\r\n var fromData = url.substr(0, 5) === \"data:\";\r\n var fromBlob = url.substr(0, 5) === \"blob:\";\r\n var isBase64 = fromData && url.indexOf(\";base64,\") !== -1;\r\n var texture = fallback ? fallback : new InternalTexture(this, InternalTextureSource.Url);\r\n var originalUrl = url;\r\n if (this._transformTextureUrl && !isBase64 && !fallback && !buffer) {\r\n url = this._transformTextureUrl(url);\r\n }\r\n if (originalUrl !== url) {\r\n texture._originalUrl = originalUrl;\r\n }\r\n // establish the file extension, if possible\r\n var lastDot = url.lastIndexOf('.');\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\");\r\n var loader = null;\r\n // Remove query string\r\n var queryStringIndex = extension.indexOf(\"?\");\r\n if (queryStringIndex > -1) {\r\n extension = extension.split(\"?\")[0];\r\n }\r\n for (var _i = 0, _a = ThinEngine._TextureLoaders; _i < _a.length; _i++) {\r\n var availableLoader = _a[_i];\r\n if (availableLoader.canLoad(extension, mimeType)) {\r\n loader = availableLoader;\r\n break;\r\n }\r\n }\r\n if (scene) {\r\n scene._addPendingData(texture);\r\n }\r\n texture.url = url;\r\n texture.generateMipMaps = !noMipmap;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n if (!this._doNotHandleContextLost) {\r\n // Keep a link to the buffer only if we plan to handle context lost\r\n texture._buffer = buffer;\r\n }\r\n var onLoadObserver = null;\r\n if (onLoad && !fallback) {\r\n onLoadObserver = texture.onLoadedObservable.add(onLoad);\r\n }\r\n if (!fallback) {\r\n this._internalTexturesCache.push(texture);\r\n }\r\n var onInternalError = function (message, exception) {\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n if (url === originalUrl) {\r\n if (onLoadObserver) {\r\n texture.onLoadedObservable.remove(onLoadObserver);\r\n }\r\n if (EngineStore.UseFallbackTexture) {\r\n _this.createTexture(EngineStore.FallbackTexture, noMipmap, texture.invertY, scene, samplingMode, null, onError, buffer, texture);\r\n }\r\n if (onError) {\r\n onError((message || \"Unknown error\") + (EngineStore.UseFallbackTexture ? \" - Fallback texture was used\" : \"\"), exception);\r\n }\r\n }\r\n else {\r\n // fall back to the original url if the transformed url fails to load\r\n Logger.Warn(\"Failed to load \" + url + \", falling back to \" + originalUrl);\r\n _this.createTexture(originalUrl, noMipmap, texture.invertY, scene, samplingMode, onLoad, onError, buffer, texture, format, forcedExtension, mimeType, loaderOptions);\r\n }\r\n };\r\n // processing for non-image formats\r\n if (loader) {\r\n var callback_1 = function (data) {\r\n loader.loadData(data, texture, function (width, height, loadMipmap, isCompressed, done, loadFailed) {\r\n if (loadFailed) {\r\n onInternalError(\"TextureLoader failed to load data\");\r\n }\r\n else {\r\n _this._prepareWebGLTexture(texture, scene, width, height, texture.invertY, !loadMipmap, isCompressed, function () {\r\n done();\r\n return false;\r\n }, samplingMode);\r\n }\r\n }, loaderOptions);\r\n };\r\n if (!buffer) {\r\n this._loadFile(url, function (data) { return callback_1(new Uint8Array(data)); }, undefined, scene ? scene.offlineProvider : undefined, true, function (request, exception) {\r\n onInternalError(\"Unable to load \" + (request ? request.responseURL : url, exception));\r\n });\r\n }\r\n else {\r\n if (buffer instanceof ArrayBuffer) {\r\n callback_1(new Uint8Array(buffer));\r\n }\r\n else if (ArrayBuffer.isView(buffer)) {\r\n callback_1(buffer);\r\n }\r\n else {\r\n if (onError) {\r\n onError(\"Unable to load: only ArrayBuffer or ArrayBufferView is supported\", null);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n var onload_1 = function (img) {\r\n if (fromBlob && !_this._doNotHandleContextLost) {\r\n // We need to store the image if we need to rebuild the texture\r\n // in case of a webgl context lost\r\n texture._buffer = img;\r\n }\r\n _this._prepareWebGLTexture(texture, scene, img.width, img.height, texture.invertY, noMipmap, false, function (potWidth, potHeight, continuationCallback) {\r\n var gl = _this._gl;\r\n var isPot = (img.width === potWidth && img.height === potHeight);\r\n var internalFormat = format ? _this._getInternalFormat(format) : ((extension === \".jpg\") ? gl.RGB : gl.RGBA);\r\n if (isPot) {\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, img);\r\n return false;\r\n }\r\n var maxTextureSize = _this._caps.maxTextureSize;\r\n if (img.width > maxTextureSize || img.height > maxTextureSize || !_this._supportsHardwareTextureRescaling) {\r\n _this._prepareWorkingCanvas();\r\n if (!_this._workingCanvas || !_this._workingContext) {\r\n return false;\r\n }\r\n _this._workingCanvas.width = potWidth;\r\n _this._workingCanvas.height = potHeight;\r\n _this._workingContext.drawImage(img, 0, 0, img.width, img.height, 0, 0, potWidth, potHeight);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, _this._workingCanvas);\r\n texture.width = potWidth;\r\n texture.height = potHeight;\r\n return false;\r\n }\r\n else {\r\n // Using shaders when possible to rescale because canvas.drawImage is lossy\r\n var source_1 = new InternalTexture(_this, InternalTextureSource.Temp);\r\n _this._bindTextureDirectly(gl.TEXTURE_2D, source_1, true);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, img);\r\n _this._rescaleTexture(source_1, texture, scene, internalFormat, function () {\r\n _this._releaseTexture(source_1);\r\n _this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n continuationCallback();\r\n });\r\n }\r\n return true;\r\n }, samplingMode);\r\n };\r\n if (!fromData || isBase64) {\r\n if (buffer && (buffer.decoding || buffer.close)) {\r\n onload_1(buffer);\r\n }\r\n else {\r\n ThinEngine._FileToolsLoadImage(url, onload_1, onInternalError, scene ? scene.offlineProvider : null, mimeType);\r\n }\r\n }\r\n else if (typeof buffer === \"string\" || buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer) || buffer instanceof Blob) {\r\n ThinEngine._FileToolsLoadImage(buffer, onload_1, onInternalError, scene ? scene.offlineProvider : null, mimeType);\r\n }\r\n else if (buffer) {\r\n onload_1(buffer);\r\n }\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @param mimeType optional mime type\r\n * @returns the HTMLImageElement of the loaded image\r\n * @hidden\r\n */\r\n ThinEngine._FileToolsLoadImage = function (input, onLoad, onError, offlineProvider, mimeType) {\r\n throw _DevTools.WarnImport(\"FileTools\");\r\n };\r\n /**\r\n * @hidden\r\n */\r\n ThinEngine.prototype._rescaleTexture = function (source, destination, scene, internalFormat, onComplete) {\r\n };\r\n /**\r\n * Creates a raw texture\r\n * @param data defines the data to store in the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param format defines the format of the data\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @returns the raw texture inside an InternalTexture\r\n */\r\n ThinEngine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression, type) {\r\n if (compression === void 0) { compression = null; }\r\n if (type === void 0) { type = 0; }\r\n throw _DevTools.WarnImport(\"Engine.RawTexture\");\r\n };\r\n /**\r\n * Creates a new raw cube texture\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n ThinEngine.prototype.createRawCubeTexture = function (data, size, format, type, generateMipMaps, invertY, samplingMode, compression) {\r\n if (compression === void 0) { compression = null; }\r\n throw _DevTools.WarnImport(\"Engine.RawTexture\");\r\n };\r\n /**\r\n * Creates a new raw 3D texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the depth of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @returns a new raw 3D texture (stored in an InternalTexture)\r\n */\r\n ThinEngine.prototype.createRawTexture3D = function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = 0; }\r\n throw _DevTools.WarnImport(\"Engine.RawTexture\");\r\n };\r\n /**\r\n * Creates a new raw 2D array texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the number of layers of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @returns a new raw 2D array texture (stored in an InternalTexture)\r\n */\r\n ThinEngine.prototype.createRawTexture2DArray = function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = 0; }\r\n throw _DevTools.WarnImport(\"Engine.RawTexture\");\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._unpackFlipY = function (value) {\r\n if (this._unpackFlipYCached !== value) {\r\n this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, value ? 1 : 0);\r\n if (this.enableUnpackFlipYCached) {\r\n this._unpackFlipYCached = value;\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getUnpackAlignement = function () {\r\n return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT);\r\n };\r\n ThinEngine.prototype._getTextureTarget = function (texture) {\r\n if (texture.isCube) {\r\n return this._gl.TEXTURE_CUBE_MAP;\r\n }\r\n else if (texture.is3D) {\r\n return this._gl.TEXTURE_3D;\r\n }\r\n else if (texture.is2DArray || texture.isMultiview) {\r\n return this._gl.TEXTURE_2D_ARRAY;\r\n }\r\n return this._gl.TEXTURE_2D;\r\n };\r\n /**\r\n * Update the sampling mode of a given texture\r\n * @param samplingMode defines the required sampling mode\r\n * @param texture defines the texture to update\r\n * @param generateMipMaps defines whether to generate mipmaps for the texture\r\n */\r\n ThinEngine.prototype.updateTextureSamplingMode = function (samplingMode, texture, generateMipMaps) {\r\n if (generateMipMaps === void 0) { generateMipMaps = false; }\r\n var target = this._getTextureTarget(texture);\r\n var filters = this._getSamplingParameters(samplingMode, texture.generateMipMaps || generateMipMaps);\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_MAG_FILTER, filters.mag, texture);\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (generateMipMaps) {\r\n texture.generateMipMaps = true;\r\n this._gl.generateMipmap(target);\r\n }\r\n this._bindTextureDirectly(target, null);\r\n texture.samplingMode = samplingMode;\r\n };\r\n /**\r\n * Update the sampling mode of a given texture\r\n * @param texture defines the texture to update\r\n * @param wrapU defines the texture wrap mode of the u coordinates\r\n * @param wrapV defines the texture wrap mode of the v coordinates\r\n * @param wrapR defines the texture wrap mode of the r coordinates\r\n */\r\n ThinEngine.prototype.updateTextureWrappingMode = function (texture, wrapU, wrapV, wrapR) {\r\n if (wrapV === void 0) { wrapV = null; }\r\n if (wrapR === void 0) { wrapR = null; }\r\n var target = this._getTextureTarget(texture);\r\n if (wrapU !== null) {\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(wrapU), texture);\r\n texture._cachedWrapU = wrapU;\r\n }\r\n if (wrapV !== null) {\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(wrapV), texture);\r\n texture._cachedWrapV = wrapV;\r\n }\r\n if ((texture.is2DArray || texture.is3D) && (wrapR !== null)) {\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(wrapR), texture);\r\n texture._cachedWrapR = wrapR;\r\n }\r\n this._bindTextureDirectly(target, null);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._setupDepthStencilTexture = function (internalTexture, size, generateStencil, bilinearFiltering, comparisonFunction) {\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n var layers = size.layers || 0;\r\n internalTexture.baseWidth = width;\r\n internalTexture.baseHeight = height;\r\n internalTexture.width = width;\r\n internalTexture.height = height;\r\n internalTexture.is2DArray = layers > 0;\r\n internalTexture.depth = layers;\r\n internalTexture.isReady = true;\r\n internalTexture.samples = 1;\r\n internalTexture.generateMipMaps = false;\r\n internalTexture._generateDepthBuffer = true;\r\n internalTexture._generateStencilBuffer = generateStencil;\r\n internalTexture.samplingMode = bilinearFiltering ? 2 : 1;\r\n internalTexture.type = 0;\r\n internalTexture._comparisonFunction = comparisonFunction;\r\n var gl = this._gl;\r\n var target = this._getTextureTarget(internalTexture);\r\n var samplingParameters = this._getSamplingParameters(internalTexture.samplingMode, false);\r\n gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, samplingParameters.mag);\r\n gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, samplingParameters.min);\r\n gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n if (comparisonFunction === 0) {\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, 515);\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.NONE);\r\n }\r\n else {\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._uploadCompressedDataToTextureDirectly = function (texture, internalFormat, width, height, data, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n this._gl.compressedTexImage2D(target, lod, internalFormat, width, height, 0, data);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod, babylonInternalFormat, useTextureWidthAndHeight) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n if (useTextureWidthAndHeight === void 0) { useTextureWidthAndHeight = false; }\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(texture.type);\r\n var format = this._getInternalFormat(texture.format);\r\n var internalFormat = babylonInternalFormat === undefined ? this._getRGBABufferInternalSizedFormat(texture.type, texture.format) : this._getInternalFormat(babylonInternalFormat);\r\n this._unpackFlipY(texture.invertY);\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n var lodMaxWidth = Math.round(Math.log(texture.width) * Math.LOG2E);\r\n var lodMaxHeight = Math.round(Math.log(texture.height) * Math.LOG2E);\r\n var width = useTextureWidthAndHeight ? texture.width : Math.pow(2, Math.max(lodMaxWidth - lod, 0));\r\n var height = useTextureWidthAndHeight ? texture.height : Math.pow(2, Math.max(lodMaxHeight - lod, 0));\r\n gl.texImage2D(target, lod, internalFormat, width, height, 0, format, textureType, imageData);\r\n };\r\n /**\r\n * Update a portion of an internal texture\r\n * @param texture defines the texture to update\r\n * @param imageData defines the data to store into the texture\r\n * @param xOffset defines the x coordinates of the update rectangle\r\n * @param yOffset defines the y coordinates of the update rectangle\r\n * @param width defines the width of the update rectangle\r\n * @param height defines the height of the update rectangle\r\n * @param faceIndex defines the face index if texture is a cube (0 by default)\r\n * @param lod defines the lod level to update (0 by default)\r\n */\r\n ThinEngine.prototype.updateTextureData = function (texture, imageData, xOffset, yOffset, width, height, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(texture.type);\r\n var format = this._getInternalFormat(texture.format);\r\n this._unpackFlipY(texture.invertY);\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n gl.texSubImage2D(target, lod, xOffset, yOffset, width, height, format, textureType, imageData);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._uploadArrayBufferViewToTexture = function (texture, imageData, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\r\n this._bindTextureDirectly(bindTarget, texture, true);\r\n this._uploadDataToTextureDirectly(texture, imageData, faceIndex, lod);\r\n this._bindTextureDirectly(bindTarget, null, true);\r\n };\r\n ThinEngine.prototype._prepareWebGLTextureContinuation = function (texture, scene, noMipmap, isCompressed, samplingMode) {\r\n var gl = this._gl;\r\n if (!gl) {\r\n return;\r\n }\r\n var filters = this._getSamplingParameters(samplingMode, !noMipmap);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (!noMipmap && !isCompressed) {\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n // this.resetTextureCache();\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n };\r\n ThinEngine.prototype._prepareWebGLTexture = function (texture, scene, width, height, invertY, noMipmap, isCompressed, processFunction, samplingMode) {\r\n var _this = this;\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n var maxTextureSize = this.getCaps().maxTextureSize;\r\n var potWidth = Math.min(maxTextureSize, this.needPOTTextures ? ThinEngine.GetExponentOfTwo(width, maxTextureSize) : width);\r\n var potHeight = Math.min(maxTextureSize, this.needPOTTextures ? ThinEngine.GetExponentOfTwo(height, maxTextureSize) : height);\r\n var gl = this._gl;\r\n if (!gl) {\r\n return;\r\n }\r\n if (!texture._webGLTexture) {\r\n // this.resetTextureCache();\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n return;\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = potWidth;\r\n texture.height = potHeight;\r\n texture.isReady = true;\r\n if (processFunction(potWidth, potHeight, function () {\r\n _this._prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);\r\n })) {\r\n // Returning as texture needs extra async steps\r\n return;\r\n }\r\n this._prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._setupFramebufferDepthAttachments = function (generateStencilBuffer, generateDepthBuffer, width, height, samples) {\r\n if (samples === void 0) { samples = 1; }\r\n var gl = this._gl;\r\n // Create the depth/stencil buffer\r\n if (generateStencilBuffer && generateDepthBuffer) {\r\n return this._getDepthStencilBuffer(width, height, samples, gl.DEPTH_STENCIL, gl.DEPTH24_STENCIL8, gl.DEPTH_STENCIL_ATTACHMENT);\r\n }\r\n if (generateDepthBuffer) {\r\n var depthFormat = gl.DEPTH_COMPONENT16;\r\n if (this._webGLVersion > 1) {\r\n depthFormat = gl.DEPTH_COMPONENT32F;\r\n }\r\n return this._getDepthStencilBuffer(width, height, samples, depthFormat, depthFormat, gl.DEPTH_ATTACHMENT);\r\n }\r\n if (generateStencilBuffer) {\r\n return this._getDepthStencilBuffer(width, height, samples, gl.STENCIL_INDEX8, gl.STENCIL_INDEX8, gl.STENCIL_ATTACHMENT);\r\n }\r\n return null;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._releaseFramebufferObjects = function (texture) {\r\n var gl = this._gl;\r\n if (texture._framebuffer) {\r\n gl.deleteFramebuffer(texture._framebuffer);\r\n texture._framebuffer = null;\r\n }\r\n if (texture._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(texture._depthStencilBuffer);\r\n texture._depthStencilBuffer = null;\r\n }\r\n if (texture._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(texture._MSAAFramebuffer);\r\n texture._MSAAFramebuffer = null;\r\n }\r\n if (texture._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(texture._MSAARenderBuffer);\r\n texture._MSAARenderBuffer = null;\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._releaseTexture = function (texture) {\r\n this._releaseFramebufferObjects(texture);\r\n this._deleteTexture(texture._webGLTexture);\r\n // Unbind channels\r\n this.unbindAllTextures();\r\n var index = this._internalTexturesCache.indexOf(texture);\r\n if (index !== -1) {\r\n this._internalTexturesCache.splice(index, 1);\r\n }\r\n // Integrated fixed lod samplers.\r\n if (texture._lodTextureHigh) {\r\n texture._lodTextureHigh.dispose();\r\n }\r\n if (texture._lodTextureMid) {\r\n texture._lodTextureMid.dispose();\r\n }\r\n if (texture._lodTextureLow) {\r\n texture._lodTextureLow.dispose();\r\n }\r\n // Integrated irradiance map.\r\n if (texture._irradianceTexture) {\r\n texture._irradianceTexture.dispose();\r\n }\r\n };\r\n ThinEngine.prototype._deleteTexture = function (texture) {\r\n this._gl.deleteTexture(texture);\r\n };\r\n ThinEngine.prototype._setProgram = function (program) {\r\n if (this._currentProgram !== program) {\r\n this._gl.useProgram(program);\r\n this._currentProgram = program;\r\n }\r\n };\r\n /**\r\n * Binds an effect to the webGL context\r\n * @param effect defines the effect to bind\r\n */\r\n ThinEngine.prototype.bindSamplers = function (effect) {\r\n var webGLPipelineContext = effect.getPipelineContext();\r\n this._setProgram(webGLPipelineContext.program);\r\n var samplers = effect.getSamplers();\r\n for (var index = 0; index < samplers.length; index++) {\r\n var uniform = effect.getUniform(samplers[index]);\r\n if (uniform) {\r\n this._boundUniforms[index] = uniform;\r\n }\r\n }\r\n this._currentEffect = null;\r\n };\r\n ThinEngine.prototype._activateCurrentTexture = function () {\r\n if (this._currentTextureChannel !== this._activeChannel) {\r\n this._gl.activeTexture(this._gl.TEXTURE0 + this._activeChannel);\r\n this._currentTextureChannel = this._activeChannel;\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._bindTextureDirectly = function (target, texture, forTextureDataUpdate, force) {\r\n if (forTextureDataUpdate === void 0) { forTextureDataUpdate = false; }\r\n if (force === void 0) { force = false; }\r\n var wasPreviouslyBound = false;\r\n var isTextureForRendering = texture && texture._associatedChannel > -1;\r\n if (forTextureDataUpdate && isTextureForRendering) {\r\n this._activeChannel = texture._associatedChannel;\r\n }\r\n var currentTextureBound = this._boundTexturesCache[this._activeChannel];\r\n if (currentTextureBound !== texture || force) {\r\n this._activateCurrentTexture();\r\n if (texture && texture.isMultiview) {\r\n this._gl.bindTexture(target, texture ? texture._colorTextureArray : null);\r\n }\r\n else {\r\n this._gl.bindTexture(target, texture ? texture._webGLTexture : null);\r\n }\r\n this._boundTexturesCache[this._activeChannel] = texture;\r\n if (texture) {\r\n texture._associatedChannel = this._activeChannel;\r\n }\r\n }\r\n else if (forTextureDataUpdate) {\r\n wasPreviouslyBound = true;\r\n this._activateCurrentTexture();\r\n }\r\n if (isTextureForRendering && !forTextureDataUpdate) {\r\n this._bindSamplerUniformToChannel(texture._associatedChannel, this._activeChannel);\r\n }\r\n return wasPreviouslyBound;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._bindTexture = function (channel, texture) {\r\n if (channel === undefined) {\r\n return;\r\n }\r\n if (texture) {\r\n texture._associatedChannel = channel;\r\n }\r\n this._activeChannel = channel;\r\n var target = texture ? this._getTextureTarget(texture) : this._gl.TEXTURE_2D;\r\n this._bindTextureDirectly(target, texture);\r\n };\r\n /**\r\n * Unbind all textures from the webGL context\r\n */\r\n ThinEngine.prototype.unbindAllTextures = function () {\r\n for (var channel = 0; channel < this._maxSimultaneousTextures; channel++) {\r\n this._activeChannel = channel;\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n if (this.webGLVersion > 1) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, null);\r\n }\r\n }\r\n };\r\n /**\r\n * Sets a texture to the according uniform.\r\n * @param channel The texture channel\r\n * @param uniform The uniform to set\r\n * @param texture The texture to apply\r\n */\r\n ThinEngine.prototype.setTexture = function (channel, uniform, texture) {\r\n if (channel === undefined) {\r\n return;\r\n }\r\n if (uniform) {\r\n this._boundUniforms[channel] = uniform;\r\n }\r\n this._setTexture(channel, texture);\r\n };\r\n ThinEngine.prototype._bindSamplerUniformToChannel = function (sourceSlot, destination) {\r\n var uniform = this._boundUniforms[sourceSlot];\r\n if (!uniform || uniform._currentState === destination) {\r\n return;\r\n }\r\n this._gl.uniform1i(uniform, destination);\r\n uniform._currentState = destination;\r\n };\r\n ThinEngine.prototype._getTextureWrapMode = function (mode) {\r\n switch (mode) {\r\n case 1:\r\n return this._gl.REPEAT;\r\n case 0:\r\n return this._gl.CLAMP_TO_EDGE;\r\n case 2:\r\n return this._gl.MIRRORED_REPEAT;\r\n }\r\n return this._gl.REPEAT;\r\n };\r\n ThinEngine.prototype._setTexture = function (channel, texture, isPartOfTextureArray, depthStencilTexture) {\r\n if (isPartOfTextureArray === void 0) { isPartOfTextureArray = false; }\r\n if (depthStencilTexture === void 0) { depthStencilTexture = false; }\r\n // Not ready?\r\n if (!texture) {\r\n if (this._boundTexturesCache[channel] != null) {\r\n this._activeChannel = channel;\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n if (this.webGLVersion > 1) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, null);\r\n }\r\n }\r\n return false;\r\n }\r\n // Video\r\n if (texture.video) {\r\n this._activeChannel = channel;\r\n texture.update();\r\n }\r\n else if (texture.delayLoadState === 4) { // Delay loading\r\n texture.delayLoad();\r\n return false;\r\n }\r\n var internalTexture;\r\n if (depthStencilTexture) {\r\n internalTexture = texture.depthStencilTexture;\r\n }\r\n else if (texture.isReady()) {\r\n internalTexture = texture.getInternalTexture();\r\n }\r\n else if (texture.isCube) {\r\n internalTexture = this.emptyCubeTexture;\r\n }\r\n else if (texture.is3D) {\r\n internalTexture = this.emptyTexture3D;\r\n }\r\n else if (texture.is2DArray) {\r\n internalTexture = this.emptyTexture2DArray;\r\n }\r\n else {\r\n internalTexture = this.emptyTexture;\r\n }\r\n if (!isPartOfTextureArray && internalTexture) {\r\n internalTexture._associatedChannel = channel;\r\n }\r\n var needToBind = true;\r\n if (this._boundTexturesCache[channel] === internalTexture) {\r\n if (!isPartOfTextureArray) {\r\n this._bindSamplerUniformToChannel(internalTexture._associatedChannel, channel);\r\n }\r\n needToBind = false;\r\n }\r\n this._activeChannel = channel;\r\n var target = this._getTextureTarget(internalTexture);\r\n if (needToBind) {\r\n this._bindTextureDirectly(target, internalTexture, isPartOfTextureArray);\r\n }\r\n if (internalTexture && !internalTexture.isMultiview) {\r\n // CUBIC_MODE and SKYBOX_MODE both require CLAMP_TO_EDGE. All other modes use REPEAT.\r\n if (internalTexture.isCube && internalTexture._cachedCoordinatesMode !== texture.coordinatesMode) {\r\n internalTexture._cachedCoordinatesMode = texture.coordinatesMode;\r\n var textureWrapMode = (texture.coordinatesMode !== 3 && texture.coordinatesMode !== 5) ? 1 : 0;\r\n texture.wrapU = textureWrapMode;\r\n texture.wrapV = textureWrapMode;\r\n }\r\n if (internalTexture._cachedWrapU !== texture.wrapU) {\r\n internalTexture._cachedWrapU = texture.wrapU;\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(texture.wrapU), internalTexture);\r\n }\r\n if (internalTexture._cachedWrapV !== texture.wrapV) {\r\n internalTexture._cachedWrapV = texture.wrapV;\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(texture.wrapV), internalTexture);\r\n }\r\n if (internalTexture.is3D && internalTexture._cachedWrapR !== texture.wrapR) {\r\n internalTexture._cachedWrapR = texture.wrapR;\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(texture.wrapR), internalTexture);\r\n }\r\n this._setAnisotropicLevel(target, internalTexture, texture.anisotropicFilteringLevel);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Sets an array of texture to the webGL context\r\n * @param channel defines the channel where the texture array must be set\r\n * @param uniform defines the associated uniform location\r\n * @param textures defines the array of textures to bind\r\n */\r\n ThinEngine.prototype.setTextureArray = function (channel, uniform, textures) {\r\n if (channel === undefined || !uniform) {\r\n return;\r\n }\r\n if (!this._textureUnits || this._textureUnits.length !== textures.length) {\r\n this._textureUnits = new Int32Array(textures.length);\r\n }\r\n for (var i = 0; i < textures.length; i++) {\r\n var texture = textures[i].getInternalTexture();\r\n if (texture) {\r\n this._textureUnits[i] = channel + i;\r\n texture._associatedChannel = channel + i;\r\n }\r\n else {\r\n this._textureUnits[i] = -1;\r\n }\r\n }\r\n this._gl.uniform1iv(uniform, this._textureUnits);\r\n for (var index = 0; index < textures.length; index++) {\r\n this._setTexture(this._textureUnits[index], textures[index], true);\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._setAnisotropicLevel = function (target, internalTexture, anisotropicFilteringLevel) {\r\n var anisotropicFilterExtension = this._caps.textureAnisotropicFilterExtension;\r\n if (internalTexture.samplingMode !== 11\r\n && internalTexture.samplingMode !== 3\r\n && internalTexture.samplingMode !== 2) {\r\n anisotropicFilteringLevel = 1; // Forcing the anisotropic to 1 because else webgl will force filters to linear\r\n }\r\n if (anisotropicFilterExtension && internalTexture._cachedAnisotropicFilteringLevel !== anisotropicFilteringLevel) {\r\n this._setTextureParameterFloat(target, anisotropicFilterExtension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(anisotropicFilteringLevel, this._caps.maxAnisotropy), internalTexture);\r\n internalTexture._cachedAnisotropicFilteringLevel = anisotropicFilteringLevel;\r\n }\r\n };\r\n ThinEngine.prototype._setTextureParameterFloat = function (target, parameter, value, texture) {\r\n this._bindTextureDirectly(target, texture, true, true);\r\n this._gl.texParameterf(target, parameter, value);\r\n };\r\n ThinEngine.prototype._setTextureParameterInteger = function (target, parameter, value, texture) {\r\n if (texture) {\r\n this._bindTextureDirectly(target, texture, true, true);\r\n }\r\n this._gl.texParameteri(target, parameter, value);\r\n };\r\n /**\r\n * Unbind all vertex attributes from the webGL context\r\n */\r\n ThinEngine.prototype.unbindAllAttributes = function () {\r\n if (this._mustWipeVertexAttributes) {\r\n this._mustWipeVertexAttributes = false;\r\n for (var i = 0; i < this._caps.maxVertexAttribs; i++) {\r\n this.disableAttributeByIndex(i);\r\n }\r\n return;\r\n }\r\n for (var i = 0, ul = this._vertexAttribArraysEnabled.length; i < ul; i++) {\r\n if (i >= this._caps.maxVertexAttribs || !this._vertexAttribArraysEnabled[i]) {\r\n continue;\r\n }\r\n this.disableAttributeByIndex(i);\r\n }\r\n };\r\n /**\r\n * Force the engine to release all cached effects. This means that next effect compilation will have to be done completely even if a similar effect was already compiled\r\n */\r\n ThinEngine.prototype.releaseEffects = function () {\r\n for (var name in this._compiledEffects) {\r\n var webGLPipelineContext = this._compiledEffects[name].getPipelineContext();\r\n this._deletePipelineContext(webGLPipelineContext);\r\n }\r\n this._compiledEffects = {};\r\n };\r\n /**\r\n * Dispose and release all associated resources\r\n */\r\n ThinEngine.prototype.dispose = function () {\r\n this.stopRenderLoop();\r\n // Clear observables\r\n if (this.onBeforeTextureInitObservable) {\r\n this.onBeforeTextureInitObservable.clear();\r\n }\r\n // Empty texture\r\n if (this._emptyTexture) {\r\n this._releaseTexture(this._emptyTexture);\r\n this._emptyTexture = null;\r\n }\r\n if (this._emptyCubeTexture) {\r\n this._releaseTexture(this._emptyCubeTexture);\r\n this._emptyCubeTexture = null;\r\n }\r\n if (this._dummyFramebuffer) {\r\n this._gl.deleteFramebuffer(this._dummyFramebuffer);\r\n }\r\n // Release effects\r\n this.releaseEffects();\r\n // Unbind\r\n this.unbindAllAttributes();\r\n this._boundUniforms = [];\r\n // Events\r\n if (DomManagement.IsWindowObjectExist()) {\r\n if (this._renderingCanvas) {\r\n if (!this._doNotHandleContextLost) {\r\n this._renderingCanvas.removeEventListener(\"webglcontextlost\", this._onContextLost);\r\n this._renderingCanvas.removeEventListener(\"webglcontextrestored\", this._onContextRestored);\r\n }\r\n }\r\n }\r\n this._workingCanvas = null;\r\n this._workingContext = null;\r\n this._currentBufferPointers = [];\r\n this._renderingCanvas = null;\r\n this._currentProgram = null;\r\n this._boundRenderFunction = null;\r\n Effect.ResetCache();\r\n // Abort active requests\r\n for (var _i = 0, _a = this._activeRequests; _i < _a.length; _i++) {\r\n var request = _a[_i];\r\n request.abort();\r\n }\r\n };\r\n /**\r\n * Attach a new callback raised when context lost event is fired\r\n * @param callback defines the callback to call\r\n */\r\n ThinEngine.prototype.attachContextLostEvent = function (callback) {\r\n if (this._renderingCanvas) {\r\n this._renderingCanvas.addEventListener(\"webglcontextlost\", callback, false);\r\n }\r\n };\r\n /**\r\n * Attach a new callback raised when context restored event is fired\r\n * @param callback defines the callback to call\r\n */\r\n ThinEngine.prototype.attachContextRestoredEvent = function (callback) {\r\n if (this._renderingCanvas) {\r\n this._renderingCanvas.addEventListener(\"webglcontextrestored\", callback, false);\r\n }\r\n };\r\n /**\r\n * Get the current error code of the webGL context\r\n * @returns the error code\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getError\r\n */\r\n ThinEngine.prototype.getError = function () {\r\n return this._gl.getError();\r\n };\r\n ThinEngine.prototype._canRenderToFloatFramebuffer = function () {\r\n if (this._webGLVersion > 1) {\r\n return this._caps.colorBufferFloat;\r\n }\r\n return this._canRenderToFramebuffer(1);\r\n };\r\n ThinEngine.prototype._canRenderToHalfFloatFramebuffer = function () {\r\n if (this._webGLVersion > 1) {\r\n return this._caps.colorBufferFloat;\r\n }\r\n return this._canRenderToFramebuffer(2);\r\n };\r\n // Thank you : http://stackoverflow.com/questions/28827511/webgl-ios-render-to-floating-point-texture\r\n ThinEngine.prototype._canRenderToFramebuffer = function (type) {\r\n var gl = this._gl;\r\n //clear existing errors\r\n while (gl.getError() !== gl.NO_ERROR) { }\r\n var successful = true;\r\n var texture = gl.createTexture();\r\n gl.bindTexture(gl.TEXTURE_2D, texture);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(type), 1, 1, 0, gl.RGBA, this._getWebGLTextureType(type), null);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\r\n var fb = gl.createFramebuffer();\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\r\n var status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\r\n successful = successful && (status === gl.FRAMEBUFFER_COMPLETE);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n //try render by clearing frame buffer's color buffer\r\n if (successful) {\r\n gl.clear(gl.COLOR_BUFFER_BIT);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n }\r\n //try reading from frame to ensure render occurs (just creating the FBO is not sufficient to determine if rendering is supported)\r\n if (successful) {\r\n //in practice it's sufficient to just read from the backbuffer rather than handle potentially issues reading from the texture\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\r\n var readFormat = gl.RGBA;\r\n var readType = gl.UNSIGNED_BYTE;\r\n var buffer = new Uint8Array(4);\r\n gl.readPixels(0, 0, 1, 1, readFormat, readType, buffer);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n }\r\n //clean up\r\n gl.deleteTexture(texture);\r\n gl.deleteFramebuffer(fb);\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\r\n //clear accumulated errors\r\n while (!successful && (gl.getError() !== gl.NO_ERROR)) { }\r\n return successful;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getWebGLTextureType = function (type) {\r\n if (this._webGLVersion === 1) {\r\n switch (type) {\r\n case 1:\r\n return this._gl.FLOAT;\r\n case 2:\r\n return this._gl.HALF_FLOAT_OES;\r\n case 0:\r\n return this._gl.UNSIGNED_BYTE;\r\n case 8:\r\n return this._gl.UNSIGNED_SHORT_4_4_4_4;\r\n case 9:\r\n return this._gl.UNSIGNED_SHORT_5_5_5_1;\r\n case 10:\r\n return this._gl.UNSIGNED_SHORT_5_6_5;\r\n }\r\n return this._gl.UNSIGNED_BYTE;\r\n }\r\n switch (type) {\r\n case 3:\r\n return this._gl.BYTE;\r\n case 0:\r\n return this._gl.UNSIGNED_BYTE;\r\n case 4:\r\n return this._gl.SHORT;\r\n case 5:\r\n return this._gl.UNSIGNED_SHORT;\r\n case 6:\r\n return this._gl.INT;\r\n case 7: // Refers to UNSIGNED_INT\r\n return this._gl.UNSIGNED_INT;\r\n case 1:\r\n return this._gl.FLOAT;\r\n case 2:\r\n return this._gl.HALF_FLOAT;\r\n case 8:\r\n return this._gl.UNSIGNED_SHORT_4_4_4_4;\r\n case 9:\r\n return this._gl.UNSIGNED_SHORT_5_5_5_1;\r\n case 10:\r\n return this._gl.UNSIGNED_SHORT_5_6_5;\r\n case 11:\r\n return this._gl.UNSIGNED_INT_2_10_10_10_REV;\r\n case 12:\r\n return this._gl.UNSIGNED_INT_24_8;\r\n case 13:\r\n return this._gl.UNSIGNED_INT_10F_11F_11F_REV;\r\n case 14:\r\n return this._gl.UNSIGNED_INT_5_9_9_9_REV;\r\n case 15:\r\n return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV;\r\n }\r\n return this._gl.UNSIGNED_BYTE;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getInternalFormat = function (format) {\r\n var internalFormat = this._gl.RGBA;\r\n switch (format) {\r\n case 0:\r\n internalFormat = this._gl.ALPHA;\r\n break;\r\n case 1:\r\n internalFormat = this._gl.LUMINANCE;\r\n break;\r\n case 2:\r\n internalFormat = this._gl.LUMINANCE_ALPHA;\r\n break;\r\n case 6:\r\n internalFormat = this._gl.RED;\r\n break;\r\n case 7:\r\n internalFormat = this._gl.RG;\r\n break;\r\n case 4:\r\n internalFormat = this._gl.RGB;\r\n break;\r\n case 5:\r\n internalFormat = this._gl.RGBA;\r\n break;\r\n }\r\n if (this._webGLVersion > 1) {\r\n switch (format) {\r\n case 8:\r\n internalFormat = this._gl.RED_INTEGER;\r\n break;\r\n case 9:\r\n internalFormat = this._gl.RG_INTEGER;\r\n break;\r\n case 10:\r\n internalFormat = this._gl.RGB_INTEGER;\r\n break;\r\n case 11:\r\n internalFormat = this._gl.RGBA_INTEGER;\r\n break;\r\n }\r\n }\r\n return internalFormat;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getRGBABufferInternalSizedFormat = function (type, format) {\r\n if (this._webGLVersion === 1) {\r\n if (format !== undefined) {\r\n switch (format) {\r\n case 0:\r\n return this._gl.ALPHA;\r\n case 1:\r\n return this._gl.LUMINANCE;\r\n case 2:\r\n return this._gl.LUMINANCE_ALPHA;\r\n case 4:\r\n return this._gl.RGB;\r\n }\r\n }\r\n return this._gl.RGBA;\r\n }\r\n switch (type) {\r\n case 3:\r\n switch (format) {\r\n case 6:\r\n return this._gl.R8_SNORM;\r\n case 7:\r\n return this._gl.RG8_SNORM;\r\n case 4:\r\n return this._gl.RGB8_SNORM;\r\n case 8:\r\n return this._gl.R8I;\r\n case 9:\r\n return this._gl.RG8I;\r\n case 10:\r\n return this._gl.RGB8I;\r\n case 11:\r\n return this._gl.RGBA8I;\r\n default:\r\n return this._gl.RGBA8_SNORM;\r\n }\r\n case 0:\r\n switch (format) {\r\n case 6:\r\n return this._gl.R8;\r\n case 7:\r\n return this._gl.RG8;\r\n case 4:\r\n return this._gl.RGB8; // By default. Other possibilities are RGB565, SRGB8.\r\n case 5:\r\n return this._gl.RGBA8; // By default. Other possibilities are RGB5_A1, RGBA4, SRGB8_ALPHA8.\r\n case 8:\r\n return this._gl.R8UI;\r\n case 9:\r\n return this._gl.RG8UI;\r\n case 10:\r\n return this._gl.RGB8UI;\r\n case 11:\r\n return this._gl.RGBA8UI;\r\n case 0:\r\n return this._gl.ALPHA;\r\n case 1:\r\n return this._gl.LUMINANCE;\r\n case 2:\r\n return this._gl.LUMINANCE_ALPHA;\r\n default:\r\n return this._gl.RGBA8;\r\n }\r\n case 4:\r\n switch (format) {\r\n case 8:\r\n return this._gl.R16I;\r\n case 9:\r\n return this._gl.RG16I;\r\n case 10:\r\n return this._gl.RGB16I;\r\n case 11:\r\n return this._gl.RGBA16I;\r\n default:\r\n return this._gl.RGBA16I;\r\n }\r\n case 5:\r\n switch (format) {\r\n case 8:\r\n return this._gl.R16UI;\r\n case 9:\r\n return this._gl.RG16UI;\r\n case 10:\r\n return this._gl.RGB16UI;\r\n case 11:\r\n return this._gl.RGBA16UI;\r\n default:\r\n return this._gl.RGBA16UI;\r\n }\r\n case 6:\r\n switch (format) {\r\n case 8:\r\n return this._gl.R32I;\r\n case 9:\r\n return this._gl.RG32I;\r\n case 10:\r\n return this._gl.RGB32I;\r\n case 11:\r\n return this._gl.RGBA32I;\r\n default:\r\n return this._gl.RGBA32I;\r\n }\r\n case 7: // Refers to UNSIGNED_INT\r\n switch (format) {\r\n case 8:\r\n return this._gl.R32UI;\r\n case 9:\r\n return this._gl.RG32UI;\r\n case 10:\r\n return this._gl.RGB32UI;\r\n case 11:\r\n return this._gl.RGBA32UI;\r\n default:\r\n return this._gl.RGBA32UI;\r\n }\r\n case 1:\r\n switch (format) {\r\n case 6:\r\n return this._gl.R32F; // By default. Other possibility is R16F.\r\n case 7:\r\n return this._gl.RG32F; // By default. Other possibility is RG16F.\r\n case 4:\r\n return this._gl.RGB32F; // By default. Other possibilities are RGB16F, R11F_G11F_B10F, RGB9_E5.\r\n case 5:\r\n return this._gl.RGBA32F; // By default. Other possibility is RGBA16F.\r\n default:\r\n return this._gl.RGBA32F;\r\n }\r\n case 2:\r\n switch (format) {\r\n case 6:\r\n return this._gl.R16F;\r\n case 7:\r\n return this._gl.RG16F;\r\n case 4:\r\n return this._gl.RGB16F; // By default. Other possibilities are R11F_G11F_B10F, RGB9_E5.\r\n case 5:\r\n return this._gl.RGBA16F;\r\n default:\r\n return this._gl.RGBA16F;\r\n }\r\n case 10:\r\n return this._gl.RGB565;\r\n case 13:\r\n return this._gl.R11F_G11F_B10F;\r\n case 14:\r\n return this._gl.RGB9_E5;\r\n case 8:\r\n return this._gl.RGBA4;\r\n case 9:\r\n return this._gl.RGB5_A1;\r\n case 11:\r\n switch (format) {\r\n case 5:\r\n return this._gl.RGB10_A2; // By default. Other possibility is RGB5_A1.\r\n case 11:\r\n return this._gl.RGB10_A2UI;\r\n default:\r\n return this._gl.RGB10_A2;\r\n }\r\n }\r\n return this._gl.RGBA8;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getRGBAMultiSampleBufferFormat = function (type) {\r\n if (type === 1) {\r\n return this._gl.RGBA32F;\r\n }\r\n else if (type === 2) {\r\n return this._gl.RGBA16F;\r\n }\r\n return this._gl.RGBA8;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._loadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n var _this = this;\r\n var request = ThinEngine._FileToolsLoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\r\n this._activeRequests.push(request);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._activeRequests.splice(_this._activeRequests.indexOf(request), 1);\r\n });\r\n return request;\r\n };\r\n /**\r\n * Loads a file from a url\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n * @hidden\r\n */\r\n ThinEngine._FileToolsLoadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n throw _DevTools.WarnImport(\"FileTools\");\r\n };\r\n /**\r\n * Reads pixels from the current frame buffer. Please note that this function can be slow\r\n * @param x defines the x coordinate of the rectangle where pixels must be read\r\n * @param y defines the y coordinate of the rectangle where pixels must be read\r\n * @param width defines the width of the rectangle where pixels must be read\r\n * @param height defines the height of the rectangle where pixels must be read\r\n * @param hasAlpha defines whether the output should have alpha or not (defaults to true)\r\n * @returns a Uint8Array containing RGBA colors\r\n */\r\n ThinEngine.prototype.readPixels = function (x, y, width, height, hasAlpha) {\r\n if (hasAlpha === void 0) { hasAlpha = true; }\r\n var numChannels = hasAlpha ? 4 : 3;\r\n var format = hasAlpha ? this._gl.RGBA : this._gl.RGB;\r\n var data = new Uint8Array(height * width * numChannels);\r\n this._gl.readPixels(x, y, width, height, format, this._gl.UNSIGNED_BYTE, data);\r\n return data;\r\n };\r\n Object.defineProperty(ThinEngine, \"IsSupported\", {\r\n /**\r\n * Gets a boolean indicating if the engine can be instanciated (ie. if a webGL context can be found)\r\n */\r\n get: function () {\r\n return this.isSupported(); // Backward compat\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a boolean indicating if the engine can be instanciated (ie. if a webGL context can be found)\r\n * @returns true if the engine can be created\r\n * @ignorenaming\r\n */\r\n ThinEngine.isSupported = function () {\r\n if (this._HasMajorPerformanceCaveat !== null) {\r\n return !this._HasMajorPerformanceCaveat; // We know it is performant so WebGL is supported\r\n }\r\n if (this._IsSupported === null) {\r\n try {\r\n var tempcanvas = CanvasGenerator.CreateCanvas(1, 1);\r\n var gl = tempcanvas.getContext(\"webgl\") || tempcanvas.getContext(\"experimental-webgl\");\r\n this._IsSupported = gl != null && !!window.WebGLRenderingContext;\r\n }\r\n catch (e) {\r\n this._IsSupported = false;\r\n }\r\n }\r\n return this._IsSupported;\r\n };\r\n Object.defineProperty(ThinEngine, \"HasMajorPerformanceCaveat\", {\r\n /**\r\n * Gets a boolean indicating if the engine can be instanciated on a performant device (ie. if a webGL context can be found and it does not use a slow implementation)\r\n */\r\n get: function () {\r\n if (this._HasMajorPerformanceCaveat === null) {\r\n try {\r\n var tempcanvas = CanvasGenerator.CreateCanvas(1, 1);\r\n var gl = tempcanvas.getContext(\"webgl\", { failIfMajorPerformanceCaveat: true }) || tempcanvas.getContext(\"experimental-webgl\", { failIfMajorPerformanceCaveat: true });\r\n this._HasMajorPerformanceCaveat = !gl;\r\n }\r\n catch (e) {\r\n this._HasMajorPerformanceCaveat = false;\r\n }\r\n }\r\n return this._HasMajorPerformanceCaveat;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Find the next highest power of two.\r\n * @param x Number to start search from.\r\n * @return Next highest power of two.\r\n */\r\n ThinEngine.CeilingPOT = function (x) {\r\n x--;\r\n x |= x >> 1;\r\n x |= x >> 2;\r\n x |= x >> 4;\r\n x |= x >> 8;\r\n x |= x >> 16;\r\n x++;\r\n return x;\r\n };\r\n /**\r\n * Find the next lowest power of two.\r\n * @param x Number to start search from.\r\n * @return Next lowest power of two.\r\n */\r\n ThinEngine.FloorPOT = function (x) {\r\n x = x | (x >> 1);\r\n x = x | (x >> 2);\r\n x = x | (x >> 4);\r\n x = x | (x >> 8);\r\n x = x | (x >> 16);\r\n return x - (x >> 1);\r\n };\r\n /**\r\n * Find the nearest power of two.\r\n * @param x Number to start search from.\r\n * @return Next nearest power of two.\r\n */\r\n ThinEngine.NearestPOT = function (x) {\r\n var c = ThinEngine.CeilingPOT(x);\r\n var f = ThinEngine.FloorPOT(x);\r\n return (c - x) > (x - f) ? f : c;\r\n };\r\n /**\r\n * Get the closest exponent of two\r\n * @param value defines the value to approximate\r\n * @param max defines the maximum value to return\r\n * @param mode defines how to define the closest value\r\n * @returns closest exponent of two of the given value\r\n */\r\n ThinEngine.GetExponentOfTwo = function (value, max, mode) {\r\n if (mode === void 0) { mode = 2; }\r\n var pot;\r\n switch (mode) {\r\n case 1:\r\n pot = ThinEngine.FloorPOT(value);\r\n break;\r\n case 2:\r\n pot = ThinEngine.NearestPOT(value);\r\n break;\r\n case 3:\r\n default:\r\n pot = ThinEngine.CeilingPOT(value);\r\n break;\r\n }\r\n return Math.min(pot, max);\r\n };\r\n /**\r\n * Queue a new function into the requested animation frame pool (ie. this function will be executed byt the browser for the next frame)\r\n * @param func - the function to be called\r\n * @param requester - the object that will request the next frame. Falls back to window.\r\n * @returns frame number\r\n */\r\n ThinEngine.QueueNewFrame = function (func, requester) {\r\n if (!DomManagement.IsWindowObjectExist()) {\r\n if (typeof requestAnimationFrame !== \"undefined\") {\r\n return requestAnimationFrame(func);\r\n }\r\n return setTimeout(func, 16);\r\n }\r\n if (!requester) {\r\n requester = window;\r\n }\r\n if (requester.requestPostAnimationFrame) {\r\n return requester.requestPostAnimationFrame(func);\r\n }\r\n else if (requester.requestAnimationFrame) {\r\n return requester.requestAnimationFrame(func);\r\n }\r\n else if (requester.msRequestAnimationFrame) {\r\n return requester.msRequestAnimationFrame(func);\r\n }\r\n else if (requester.webkitRequestAnimationFrame) {\r\n return requester.webkitRequestAnimationFrame(func);\r\n }\r\n else if (requester.mozRequestAnimationFrame) {\r\n return requester.mozRequestAnimationFrame(func);\r\n }\r\n else if (requester.oRequestAnimationFrame) {\r\n return requester.oRequestAnimationFrame(func);\r\n }\r\n else {\r\n return window.setTimeout(func, 16);\r\n }\r\n };\r\n /**\r\n * Gets host document\r\n * @returns the host document object\r\n */\r\n ThinEngine.prototype.getHostDocument = function () {\r\n if (this._renderingCanvas && this._renderingCanvas.ownerDocument) {\r\n return this._renderingCanvas.ownerDocument;\r\n }\r\n return document;\r\n };\r\n /** Use this array to turn off some WebGL2 features on known buggy browsers version */\r\n ThinEngine.ExceptionList = [\r\n { key: \"Chrome\\/63\\.0\", capture: \"63\\\\.0\\\\.3239\\\\.(\\\\d+)\", captureConstraint: 108, targets: [\"uniformBuffer\"] },\r\n { key: \"Firefox\\/58\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\r\n { key: \"Firefox\\/59\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\r\n { key: \"Chrome\\/72.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Chrome\\/73.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Chrome\\/74.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Mac OS.+Chrome\\/71\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Mac OS.+Chrome\\/72\", capture: null, captureConstraint: null, targets: [\"vao\"] }\r\n ];\r\n /** @hidden */\r\n ThinEngine._TextureLoaders = [];\r\n // Updatable statics so stick with vars here\r\n /**\r\n * Gets or sets the epsilon value used by collision engine\r\n */\r\n ThinEngine.CollisionsEpsilon = 0.001;\r\n // Statics\r\n ThinEngine._IsSupported = null;\r\n ThinEngine._HasMajorPerformanceCaveat = null;\r\n return ThinEngine;\r\n}());\r\nexport { ThinEngine };\r\n//# sourceMappingURL=thinEngine.js.map","/**\r\n * Gather the list of clipboard event types as constants.\r\n */\r\nvar ClipboardEventTypes = /** @class */ (function () {\r\n function ClipboardEventTypes() {\r\n }\r\n /**\r\n * The clipboard event is fired when a copy command is active (pressed).\r\n */\r\n ClipboardEventTypes.COPY = 0x01; //\r\n /**\r\n * The clipboard event is fired when a cut command is active (pressed).\r\n */\r\n ClipboardEventTypes.CUT = 0x02;\r\n /**\r\n * The clipboard event is fired when a paste command is active (pressed).\r\n */\r\n ClipboardEventTypes.PASTE = 0x03;\r\n return ClipboardEventTypes;\r\n}());\r\nexport { ClipboardEventTypes };\r\n/**\r\n * This class is used to store clipboard related info for the onClipboardObservable event.\r\n */\r\nvar ClipboardInfo = /** @class */ (function () {\r\n /**\r\n *Creates an instance of ClipboardInfo.\r\n * @param type Defines the type of event (BABYLON.ClipboardEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function ClipboardInfo(\r\n /**\r\n * Defines the type of event (BABYLON.ClipboardEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n this.type = type;\r\n this.event = event;\r\n }\r\n /**\r\n * Get the clipboard event's type from the keycode.\r\n * @param keyCode Defines the keyCode for the current keyboard event.\r\n * @return {number}\r\n */\r\n ClipboardInfo.GetTypeFromCharacter = function (keyCode) {\r\n var charCode = keyCode;\r\n //TODO: add codes for extended ASCII\r\n switch (charCode) {\r\n case 67: return ClipboardEventTypes.COPY;\r\n case 86: return ClipboardEventTypes.PASTE;\r\n case 88: return ClipboardEventTypes.CUT;\r\n default: return -1;\r\n }\r\n };\r\n return ClipboardInfo;\r\n}());\r\nexport { ClipboardInfo };\r\n//# sourceMappingURL=clipboardEvents.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * Gather the list of keyboard event types as constants.\r\n */\r\nvar KeyboardEventTypes = /** @class */ (function () {\r\n function KeyboardEventTypes() {\r\n }\r\n /**\r\n * The keydown event is fired when a key becomes active (pressed).\r\n */\r\n KeyboardEventTypes.KEYDOWN = 0x01;\r\n /**\r\n * The keyup event is fired when a key has been released.\r\n */\r\n KeyboardEventTypes.KEYUP = 0x02;\r\n return KeyboardEventTypes;\r\n}());\r\nexport { KeyboardEventTypes };\r\n/**\r\n * This class is used to store keyboard related info for the onKeyboardObservable event.\r\n */\r\nvar KeyboardInfo = /** @class */ (function () {\r\n /**\r\n * Instantiates a new keyboard info.\r\n * This class is used to store keyboard related info for the onKeyboardObservable event.\r\n * @param type Defines the type of event (KeyboardEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function KeyboardInfo(\r\n /**\r\n * Defines the type of event (KeyboardEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n this.type = type;\r\n this.event = event;\r\n }\r\n return KeyboardInfo;\r\n}());\r\nexport { KeyboardInfo };\r\n/**\r\n * This class is used to store keyboard related info for the onPreKeyboardObservable event.\r\n * Set the skipOnKeyboardObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onKeyboardObservable\r\n */\r\nvar KeyboardInfoPre = /** @class */ (function (_super) {\r\n __extends(KeyboardInfoPre, _super);\r\n /**\r\n * Instantiates a new keyboard pre info.\r\n * This class is used to store keyboard related info for the onPreKeyboardObservable event.\r\n * @param type Defines the type of event (KeyboardEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function KeyboardInfoPre(\r\n /**\r\n * Defines the type of event (KeyboardEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n var _this = _super.call(this, type, event) || this;\r\n _this.type = type;\r\n _this.event = event;\r\n _this.skipOnPointerObservable = false;\r\n return _this;\r\n }\r\n return KeyboardInfoPre;\r\n}(KeyboardInfo));\r\nexport { KeyboardInfoPre };\r\n//# sourceMappingURL=keyboardEvents.js.map","import { __extends } from \"tslib\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\n/**\r\n * Gather the list of pointer event types as constants.\r\n */\r\nvar PointerEventTypes = /** @class */ (function () {\r\n function PointerEventTypes() {\r\n }\r\n /**\r\n * The pointerdown event is fired when a pointer becomes active. For mouse, it is fired when the device transitions from no buttons depressed to at least one button depressed. For touch, it is fired when physical contact is made with the digitizer. For pen, it is fired when the stylus makes physical contact with the digitizer.\r\n */\r\n PointerEventTypes.POINTERDOWN = 0x01;\r\n /**\r\n * The pointerup event is fired when a pointer is no longer active.\r\n */\r\n PointerEventTypes.POINTERUP = 0x02;\r\n /**\r\n * The pointermove event is fired when a pointer changes coordinates.\r\n */\r\n PointerEventTypes.POINTERMOVE = 0x04;\r\n /**\r\n * The pointerwheel event is fired when a mouse wheel has been rotated.\r\n */\r\n PointerEventTypes.POINTERWHEEL = 0x08;\r\n /**\r\n * The pointerpick event is fired when a mesh or sprite has been picked by the pointer.\r\n */\r\n PointerEventTypes.POINTERPICK = 0x10;\r\n /**\r\n * The pointertap event is fired when a the object has been touched and released without drag.\r\n */\r\n PointerEventTypes.POINTERTAP = 0x20;\r\n /**\r\n * The pointerdoubletap event is fired when a the object has been touched and released twice without drag.\r\n */\r\n PointerEventTypes.POINTERDOUBLETAP = 0x40;\r\n return PointerEventTypes;\r\n}());\r\nexport { PointerEventTypes };\r\n/**\r\n * Base class of pointer info types.\r\n */\r\nvar PointerInfoBase = /** @class */ (function () {\r\n /**\r\n * Instantiates the base class of pointers info.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function PointerInfoBase(\r\n /**\r\n * Defines the type of event (PointerEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n this.type = type;\r\n this.event = event;\r\n }\r\n return PointerInfoBase;\r\n}());\r\nexport { PointerInfoBase };\r\n/**\r\n * This class is used to store pointer related info for the onPrePointerObservable event.\r\n * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable\r\n */\r\nvar PointerInfoPre = /** @class */ (function (_super) {\r\n __extends(PointerInfoPre, _super);\r\n /**\r\n * Instantiates a PointerInfoPre to store pointer related info to the onPrePointerObservable event.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n * @param localX Defines the local x coordinates of the pointer when the event occured\r\n * @param localY Defines the local y coordinates of the pointer when the event occured\r\n */\r\n function PointerInfoPre(type, event, localX, localY) {\r\n var _this = _super.call(this, type, event) || this;\r\n /**\r\n * Ray from a pointer if availible (eg. 6dof controller)\r\n */\r\n _this.ray = null;\r\n _this.skipOnPointerObservable = false;\r\n _this.localPosition = new Vector2(localX, localY);\r\n return _this;\r\n }\r\n return PointerInfoPre;\r\n}(PointerInfoBase));\r\nexport { PointerInfoPre };\r\n/**\r\n * This type contains all the data related to a pointer event in Babylon.js.\r\n * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.\r\n */\r\nvar PointerInfo = /** @class */ (function (_super) {\r\n __extends(PointerInfo, _super);\r\n /**\r\n * Instantiates a PointerInfo to store pointer related info to the onPointerObservable event.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n * @param pickInfo Defines the picking info associated to the info (if any)\\\r\n */\r\n function PointerInfo(type, event, \r\n /**\r\n * Defines the picking info associated to the info (if any)\\\r\n */\r\n pickInfo) {\r\n var _this = _super.call(this, type, event) || this;\r\n _this.pickInfo = pickInfo;\r\n return _this;\r\n }\r\n return PointerInfo;\r\n}(PointerInfoBase));\r\nexport { PointerInfo };\r\n//# sourceMappingURL=pointerEvents.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serializeAsColor3, serializeAsVector3 } from \"../Misc/decorators\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport { Node } from \"../node\";\r\nimport { Light } from \"./light\";\r\nNode.AddNodeConstructor(\"Light_Type_3\", function (name, scene) {\r\n return function () { return new HemisphericLight(name, Vector3.Zero(), scene); };\r\n});\r\n/**\r\n * The HemisphericLight simulates the ambient environment light,\r\n * so the passed direction is the light reflection direction, not the incoming direction.\r\n */\r\nvar HemisphericLight = /** @class */ (function (_super) {\r\n __extends(HemisphericLight, _super);\r\n /**\r\n * Creates a HemisphericLight object in the scene according to the passed direction (Vector3).\r\n * The HemisphericLight simulates the ambient environment light, so the passed direction is the light reflection direction, not the incoming direction.\r\n * The HemisphericLight can't cast shadows.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The friendly name of the light\r\n * @param direction The direction of the light reflection\r\n * @param scene The scene the light belongs to\r\n */\r\n function HemisphericLight(name, direction, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * The groundColor is the light in the opposite direction to the one specified during creation.\r\n * You can think of the diffuse and specular light as coming from the centre of the object in the given direction and the groundColor light in the opposite direction.\r\n */\r\n _this.groundColor = new Color3(0.0, 0.0, 0.0);\r\n _this.direction = direction || Vector3.Up();\r\n return _this;\r\n }\r\n HemisphericLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"vLightGround\", 3);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n /**\r\n * Returns the string \"HemisphericLight\".\r\n * @return The class name\r\n */\r\n HemisphericLight.prototype.getClassName = function () {\r\n return \"HemisphericLight\";\r\n };\r\n /**\r\n * Sets the HemisphericLight direction towards the passed target (Vector3).\r\n * Returns the updated direction.\r\n * @param target The target the direction should point to\r\n * @return The computed direction\r\n */\r\n HemisphericLight.prototype.setDirectionToTarget = function (target) {\r\n this.direction = Vector3.Normalize(target.subtract(Vector3.Zero()));\r\n return this.direction;\r\n };\r\n /**\r\n * Returns the shadow generator associated to the light.\r\n * @returns Always null for hemispheric lights because it does not support shadows.\r\n */\r\n HemisphericLight.prototype.getShadowGenerator = function () {\r\n return null;\r\n };\r\n /**\r\n * Sets the passed Effect object with the HemisphericLight normalized direction and color and the passed name (string).\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The hemispheric light\r\n */\r\n HemisphericLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n var normalizeDirection = Vector3.Normalize(this.direction);\r\n this._uniformBuffer.updateFloat4(\"vLightData\", normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, 0.0, lightIndex);\r\n this._uniformBuffer.updateColor3(\"vLightGround\", this.groundColor.scale(this.intensity), lightIndex);\r\n return this;\r\n };\r\n HemisphericLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n var normalizeDirection = Vector3.Normalize(this.direction);\r\n effect.setFloat3(lightDataUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z);\r\n return this;\r\n };\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @param useWasUpdatedFlag defines a reserved property\r\n * @returns the world matrix\r\n */\r\n HemisphericLight.prototype.computeWorldMatrix = function () {\r\n if (!this._worldMatrix) {\r\n this._worldMatrix = Matrix.Identity();\r\n }\r\n return this._worldMatrix;\r\n };\r\n /**\r\n * Returns the integer 3.\r\n * @return The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n HemisphericLight.prototype.getTypeID = function () {\r\n return Light.LIGHTTYPEID_HEMISPHERICLIGHT;\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n HemisphericLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"HEMILIGHT\" + lightIndex] = true;\r\n };\r\n __decorate([\r\n serializeAsColor3()\r\n ], HemisphericLight.prototype, \"groundColor\", void 0);\r\n __decorate([\r\n serializeAsVector3()\r\n ], HemisphericLight.prototype, \"direction\", void 0);\r\n return HemisphericLight;\r\n}(Light));\r\nexport { HemisphericLight };\r\n//# sourceMappingURL=hemisphericLight.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, SerializationHelper, serializeAsColor3, expandToProperty } from \"../Misc/decorators\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color3, TmpColors } from \"../Maths/math.color\";\r\nimport { Node } from \"../node\";\r\nimport { UniformBuffer } from \"../Materials/uniformBuffer\";\r\nimport { _TypeStore } from '../Misc/typeStore';\r\n/**\r\n * Base class of all the lights in Babylon. It groups all the generic information about lights.\r\n * Lights are used, as you would expect, to affect how meshes are seen, in terms of both illumination and colour.\r\n * All meshes allow light to pass through them unless shadow generation is activated. The default number of lights allowed is four but this can be increased.\r\n */\r\nvar Light = /** @class */ (function (_super) {\r\n __extends(Light, _super);\r\n /**\r\n * Creates a Light object in the scene.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The firendly name of the light\r\n * @param scene The scene the light belongs too\r\n */\r\n function Light(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Diffuse gives the basic color to an object.\r\n */\r\n _this.diffuse = new Color3(1.0, 1.0, 1.0);\r\n /**\r\n * Specular produces a highlight color on an object.\r\n * Note: This is note affecting PBR materials.\r\n */\r\n _this.specular = new Color3(1.0, 1.0, 1.0);\r\n /**\r\n * Defines the falloff type for this light. This lets overrriding how punctual light are\r\n * falling off base on range or angle.\r\n * This can be set to any values in Light.FALLOFF_x.\r\n *\r\n * Note: This is only useful for PBR Materials at the moment. This could be extended if required to\r\n * other types of materials.\r\n */\r\n _this.falloffType = Light.FALLOFF_DEFAULT;\r\n /**\r\n * Strength of the light.\r\n * Note: By default it is define in the framework own unit.\r\n * Note: In PBR materials the intensityMode can be use to chose what unit the intensity is defined in.\r\n */\r\n _this.intensity = 1.0;\r\n _this._range = Number.MAX_VALUE;\r\n _this._inverseSquaredRange = 0;\r\n /**\r\n * Cached photometric scale default to 1.0 as the automatic intensity mode defaults to 1.0 for every type\r\n * of light.\r\n */\r\n _this._photometricScale = 1.0;\r\n _this._intensityMode = Light.INTENSITYMODE_AUTOMATIC;\r\n _this._radius = 0.00001;\r\n /**\r\n * Defines the rendering priority of the lights. It can help in case of fallback or number of lights\r\n * exceeding the number allowed of the materials.\r\n */\r\n _this.renderPriority = 0;\r\n _this._shadowEnabled = true;\r\n _this._excludeWithLayerMask = 0;\r\n _this._includeOnlyWithLayerMask = 0;\r\n _this._lightmapMode = 0;\r\n /**\r\n * @hidden Internal use only.\r\n */\r\n _this._excludedMeshesIds = new Array();\r\n /**\r\n * @hidden Internal use only.\r\n */\r\n _this._includedOnlyMeshesIds = new Array();\r\n /** @hidden */\r\n _this._isLight = true;\r\n _this.getScene().addLight(_this);\r\n _this._uniformBuffer = new UniformBuffer(_this.getScene().getEngine());\r\n _this._buildUniformLayout();\r\n _this.includedOnlyMeshes = new Array();\r\n _this.excludedMeshes = new Array();\r\n _this._resyncMeshes();\r\n return _this;\r\n }\r\n Object.defineProperty(Light.prototype, \"range\", {\r\n /**\r\n * Defines how far from the source the light is impacting in scene units.\r\n * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.\r\n */\r\n get: function () {\r\n return this._range;\r\n },\r\n /**\r\n * Defines how far from the source the light is impacting in scene units.\r\n * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.\r\n */\r\n set: function (value) {\r\n this._range = value;\r\n this._inverseSquaredRange = 1.0 / (this.range * this.range);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"intensityMode\", {\r\n /**\r\n * Gets the photometric scale used to interpret the intensity.\r\n * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.\r\n */\r\n get: function () {\r\n return this._intensityMode;\r\n },\r\n /**\r\n * Sets the photometric scale used to interpret the intensity.\r\n * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.\r\n */\r\n set: function (value) {\r\n this._intensityMode = value;\r\n this._computePhotometricScale();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"radius\", {\r\n /**\r\n * Gets the light radius used by PBR Materials to simulate soft area lights.\r\n */\r\n get: function () {\r\n return this._radius;\r\n },\r\n /**\r\n * sets the light radius used by PBR Materials to simulate soft area lights.\r\n */\r\n set: function (value) {\r\n this._radius = value;\r\n this._computePhotometricScale();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"shadowEnabled\", {\r\n /**\r\n * Gets wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching\r\n * the current shadow generator.\r\n */\r\n get: function () {\r\n return this._shadowEnabled;\r\n },\r\n /**\r\n * Sets wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching\r\n * the current shadow generator.\r\n */\r\n set: function (value) {\r\n if (this._shadowEnabled === value) {\r\n return;\r\n }\r\n this._shadowEnabled = value;\r\n this._markMeshesAsLightDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"includedOnlyMeshes\", {\r\n /**\r\n * Gets the only meshes impacted by this light.\r\n */\r\n get: function () {\r\n return this._includedOnlyMeshes;\r\n },\r\n /**\r\n * Sets the only meshes impacted by this light.\r\n */\r\n set: function (value) {\r\n this._includedOnlyMeshes = value;\r\n this._hookArrayForIncludedOnly(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"excludedMeshes\", {\r\n /**\r\n * Gets the meshes not impacted by this light.\r\n */\r\n get: function () {\r\n return this._excludedMeshes;\r\n },\r\n /**\r\n * Sets the meshes not impacted by this light.\r\n */\r\n set: function (value) {\r\n this._excludedMeshes = value;\r\n this._hookArrayForExcluded(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"excludeWithLayerMask\", {\r\n /**\r\n * Gets the layer id use to find what meshes are not impacted by the light.\r\n * Inactive if 0\r\n */\r\n get: function () {\r\n return this._excludeWithLayerMask;\r\n },\r\n /**\r\n * Sets the layer id use to find what meshes are not impacted by the light.\r\n * Inactive if 0\r\n */\r\n set: function (value) {\r\n this._excludeWithLayerMask = value;\r\n this._resyncMeshes();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"includeOnlyWithLayerMask\", {\r\n /**\r\n * Gets the layer id use to find what meshes are impacted by the light.\r\n * Inactive if 0\r\n */\r\n get: function () {\r\n return this._includeOnlyWithLayerMask;\r\n },\r\n /**\r\n * Sets the layer id use to find what meshes are impacted by the light.\r\n * Inactive if 0\r\n */\r\n set: function (value) {\r\n this._includeOnlyWithLayerMask = value;\r\n this._resyncMeshes();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"lightmapMode\", {\r\n /**\r\n * Gets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)\r\n */\r\n get: function () {\r\n return this._lightmapMode;\r\n },\r\n /**\r\n * Sets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)\r\n */\r\n set: function (value) {\r\n if (this._lightmapMode === value) {\r\n return;\r\n }\r\n this._lightmapMode = value;\r\n this._markMeshesAsLightDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the passed Effect \"effect\" with the Light textures.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The light\r\n */\r\n Light.prototype.transferTexturesToEffect = function (effect, lightIndex) {\r\n // Do nothing by default.\r\n return this;\r\n };\r\n /**\r\n * Binds the lights information from the scene to the effect for the given mesh.\r\n * @param lightIndex Light index\r\n * @param scene The scene where the light belongs to\r\n * @param effect The effect we are binding the data to\r\n * @param useSpecular Defines if specular is supported\r\n * @param rebuildInParallel Specifies whether the shader is rebuilding in parallel\r\n */\r\n Light.prototype._bindLight = function (lightIndex, scene, effect, useSpecular, rebuildInParallel) {\r\n if (rebuildInParallel === void 0) { rebuildInParallel = false; }\r\n var iAsString = lightIndex.toString();\r\n var needUpdate = false;\r\n if (rebuildInParallel && this._uniformBuffer._alreadyBound) {\r\n return;\r\n }\r\n this._uniformBuffer.bindToEffect(effect, \"Light\" + iAsString);\r\n if (this._renderId !== scene.getRenderId() || !this._uniformBuffer.useUbo) {\r\n this._renderId = scene.getRenderId();\r\n var scaledIntensity = this.getScaledIntensity();\r\n this.transferToEffect(effect, iAsString);\r\n this.diffuse.scaleToRef(scaledIntensity, TmpColors.Color3[0]);\r\n this._uniformBuffer.updateColor4(\"vLightDiffuse\", TmpColors.Color3[0], this.range, iAsString);\r\n if (useSpecular) {\r\n this.specular.scaleToRef(scaledIntensity, TmpColors.Color3[1]);\r\n this._uniformBuffer.updateColor4(\"vLightSpecular\", TmpColors.Color3[1], this.radius, iAsString);\r\n }\r\n needUpdate = true;\r\n }\r\n // Textures might still need to be rebound.\r\n this.transferTexturesToEffect(effect, iAsString);\r\n // Shadows\r\n if (scene.shadowsEnabled && this.shadowEnabled) {\r\n var shadowGenerator = this.getShadowGenerator();\r\n if (shadowGenerator) {\r\n shadowGenerator.bindShadowLight(iAsString, effect);\r\n needUpdate = true;\r\n }\r\n }\r\n if (needUpdate) {\r\n this._uniformBuffer.update();\r\n }\r\n };\r\n /**\r\n * Returns the string \"Light\".\r\n * @returns the class name\r\n */\r\n Light.prototype.getClassName = function () {\r\n return \"Light\";\r\n };\r\n /**\r\n * Converts the light information to a readable string for debug purpose.\r\n * @param fullDetails Supports for multiple levels of logging within scene loading\r\n * @returns the human readable light info\r\n */\r\n Light.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n ret += \", type: \" + ([\"Point\", \"Directional\", \"Spot\", \"Hemispheric\"])[this.getTypeID()];\r\n if (this.animations) {\r\n for (var i = 0; i < this.animations.length; i++) {\r\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\r\n }\r\n }\r\n if (fullDetails) {\r\n }\r\n return ret;\r\n };\r\n /** @hidden */\r\n Light.prototype._syncParentEnabledState = function () {\r\n _super.prototype._syncParentEnabledState.call(this);\r\n if (!this.isDisposed()) {\r\n this._resyncMeshes();\r\n }\r\n };\r\n /**\r\n * Set the enabled state of this node.\r\n * @param value - the new enabled state\r\n */\r\n Light.prototype.setEnabled = function (value) {\r\n _super.prototype.setEnabled.call(this, value);\r\n this._resyncMeshes();\r\n };\r\n /**\r\n * Returns the Light associated shadow generator if any.\r\n * @return the associated shadow generator.\r\n */\r\n Light.prototype.getShadowGenerator = function () {\r\n return this._shadowGenerator;\r\n };\r\n /**\r\n * Returns a Vector3, the absolute light position in the World.\r\n * @returns the world space position of the light\r\n */\r\n Light.prototype.getAbsolutePosition = function () {\r\n return Vector3.Zero();\r\n };\r\n /**\r\n * Specifies if the light will affect the passed mesh.\r\n * @param mesh The mesh to test against the light\r\n * @return true the mesh is affected otherwise, false.\r\n */\r\n Light.prototype.canAffectMesh = function (mesh) {\r\n if (!mesh) {\r\n return true;\r\n }\r\n if (this.includedOnlyMeshes && this.includedOnlyMeshes.length > 0 && this.includedOnlyMeshes.indexOf(mesh) === -1) {\r\n return false;\r\n }\r\n if (this.excludedMeshes && this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {\r\n return false;\r\n }\r\n if (this.includeOnlyWithLayerMask !== 0 && (this.includeOnlyWithLayerMask & mesh.layerMask) === 0) {\r\n return false;\r\n }\r\n if (this.excludeWithLayerMask !== 0 && this.excludeWithLayerMask & mesh.layerMask) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Sort function to order lights for rendering.\r\n * @param a First Light object to compare to second.\r\n * @param b Second Light object to compare first.\r\n * @return -1 to reduce's a's index relative to be, 0 for no change, 1 to increase a's index relative to b.\r\n */\r\n Light.CompareLightsPriority = function (a, b) {\r\n //shadow-casting lights have priority over non-shadow-casting lights\r\n //the renderPrioirty is a secondary sort criterion\r\n if (a.shadowEnabled !== b.shadowEnabled) {\r\n return (b.shadowEnabled ? 1 : 0) - (a.shadowEnabled ? 1 : 0);\r\n }\r\n return b.renderPriority - a.renderPriority;\r\n };\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n Light.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n if (this._shadowGenerator) {\r\n this._shadowGenerator.dispose();\r\n this._shadowGenerator = null;\r\n }\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from meshes\r\n for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._removeLightSource(this, true);\r\n }\r\n this._uniformBuffer.dispose();\r\n // Remove from scene\r\n this.getScene().removeLight(this);\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Returns the light type ID (integer).\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n Light.prototype.getTypeID = function () {\r\n return 0;\r\n };\r\n /**\r\n * Returns the intensity scaled by the Photometric Scale according to the light type and intensity mode.\r\n * @returns the scaled intensity in intensity mode unit\r\n */\r\n Light.prototype.getScaledIntensity = function () {\r\n return this._photometricScale * this.intensity;\r\n };\r\n /**\r\n * Returns a new Light object, named \"name\", from the current one.\r\n * @param name The name of the cloned light\r\n * @param newParent The parent of this light, if it has one\r\n * @returns the new created light\r\n */\r\n Light.prototype.clone = function (name, newParent) {\r\n if (newParent === void 0) { newParent = null; }\r\n var constructor = Light.GetConstructorFromName(this.getTypeID(), name, this.getScene());\r\n if (!constructor) {\r\n return null;\r\n }\r\n var clonedLight = SerializationHelper.Clone(constructor, this);\r\n if (newParent) {\r\n clonedLight.parent = newParent;\r\n }\r\n clonedLight.setEnabled(this.isEnabled());\r\n return clonedLight;\r\n };\r\n /**\r\n * Serializes the current light into a Serialization object.\r\n * @returns the serialized object.\r\n */\r\n Light.prototype.serialize = function () {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n // Type\r\n serializationObject.type = this.getTypeID();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n // Inclusion / exclusions\r\n if (this.excludedMeshes.length > 0) {\r\n serializationObject.excludedMeshesIds = [];\r\n this.excludedMeshes.forEach(function (mesh) {\r\n serializationObject.excludedMeshesIds.push(mesh.id);\r\n });\r\n }\r\n if (this.includedOnlyMeshes.length > 0) {\r\n serializationObject.includedOnlyMeshesIds = [];\r\n this.includedOnlyMeshes.forEach(function (mesh) {\r\n serializationObject.includedOnlyMeshesIds.push(mesh.id);\r\n });\r\n }\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n serializationObject.ranges = this.serializeAnimationRanges();\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a new typed light from the passed type (integer) : point light = 0, directional light = 1, spot light = 2, hemispheric light = 3.\r\n * This new light is named \"name\" and added to the passed scene.\r\n * @param type Type according to the types available in Light.LIGHTTYPEID_x\r\n * @param name The friendly name of the light\r\n * @param scene The scene the new light will belong to\r\n * @returns the constructor function\r\n */\r\n Light.GetConstructorFromName = function (type, name, scene) {\r\n var constructorFunc = Node.Construct(\"Light_Type_\" + type, name, scene);\r\n if (constructorFunc) {\r\n return constructorFunc;\r\n }\r\n // Default to no light for none present once.\r\n return null;\r\n };\r\n /**\r\n * Parses the passed \"parsedLight\" and returns a new instanced Light from this parsing.\r\n * @param parsedLight The JSON representation of the light\r\n * @param scene The scene to create the parsed light in\r\n * @returns the created light after parsing\r\n */\r\n Light.Parse = function (parsedLight, scene) {\r\n var constructor = Light.GetConstructorFromName(parsedLight.type, parsedLight.name, scene);\r\n if (!constructor) {\r\n return null;\r\n }\r\n var light = SerializationHelper.Parse(constructor, parsedLight, scene);\r\n // Inclusion / exclusions\r\n if (parsedLight.excludedMeshesIds) {\r\n light._excludedMeshesIds = parsedLight.excludedMeshesIds;\r\n }\r\n if (parsedLight.includedOnlyMeshesIds) {\r\n light._includedOnlyMeshesIds = parsedLight.includedOnlyMeshesIds;\r\n }\r\n // Parent\r\n if (parsedLight.parentId) {\r\n light._waitingParentId = parsedLight.parentId;\r\n }\r\n // Falloff\r\n if (parsedLight.falloffType !== undefined) {\r\n light.falloffType = parsedLight.falloffType;\r\n }\r\n // Lightmaps\r\n if (parsedLight.lightmapMode !== undefined) {\r\n light.lightmapMode = parsedLight.lightmapMode;\r\n }\r\n // Animations\r\n if (parsedLight.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedLight.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedLight.animations[animationIndex];\r\n var internalClass = _TypeStore.GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n light.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n Node.ParseAnimationRanges(light, parsedLight, scene);\r\n }\r\n if (parsedLight.autoAnimate) {\r\n scene.beginAnimation(light, parsedLight.autoAnimateFrom, parsedLight.autoAnimateTo, parsedLight.autoAnimateLoop, parsedLight.autoAnimateSpeed || 1.0);\r\n }\r\n return light;\r\n };\r\n Light.prototype._hookArrayForExcluded = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var result = oldPush.apply(array, items);\r\n for (var _a = 0, items_1 = items; _a < items_1.length; _a++) {\r\n var item = items_1[_a];\r\n item._resyncLightSource(_this);\r\n }\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n for (var _i = 0, deleted_1 = deleted; _i < deleted_1.length; _i++) {\r\n var item = deleted_1[_i];\r\n item._resyncLightSource(_this);\r\n }\r\n return deleted;\r\n };\r\n for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {\r\n var item = array_1[_i];\r\n item._resyncLightSource(this);\r\n }\r\n };\r\n Light.prototype._hookArrayForIncludedOnly = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var result = oldPush.apply(array, items);\r\n _this._resyncMeshes();\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n _this._resyncMeshes();\r\n return deleted;\r\n };\r\n this._resyncMeshes();\r\n };\r\n Light.prototype._resyncMeshes = function () {\r\n for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._resyncLightSource(this);\r\n }\r\n };\r\n /**\r\n * Forces the meshes to update their light related information in their rendering used effects\r\n * @hidden Internal Use Only\r\n */\r\n Light.prototype._markMeshesAsLightDirty = function () {\r\n for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n if (mesh.lightSources.indexOf(this) !== -1) {\r\n mesh._markSubMeshesAsLightDirty();\r\n }\r\n }\r\n };\r\n /**\r\n * Recomputes the cached photometric scale if needed.\r\n */\r\n Light.prototype._computePhotometricScale = function () {\r\n this._photometricScale = this._getPhotometricScale();\r\n this.getScene().resetCachedMaterial();\r\n };\r\n /**\r\n * Returns the Photometric Scale according to the light type and intensity mode.\r\n */\r\n Light.prototype._getPhotometricScale = function () {\r\n var photometricScale = 0.0;\r\n var lightTypeID = this.getTypeID();\r\n //get photometric mode\r\n var photometricMode = this.intensityMode;\r\n if (photometricMode === Light.INTENSITYMODE_AUTOMATIC) {\r\n if (lightTypeID === Light.LIGHTTYPEID_DIRECTIONALLIGHT) {\r\n photometricMode = Light.INTENSITYMODE_ILLUMINANCE;\r\n }\r\n else {\r\n photometricMode = Light.INTENSITYMODE_LUMINOUSINTENSITY;\r\n }\r\n }\r\n //compute photometric scale\r\n switch (lightTypeID) {\r\n case Light.LIGHTTYPEID_POINTLIGHT:\r\n case Light.LIGHTTYPEID_SPOTLIGHT:\r\n switch (photometricMode) {\r\n case Light.INTENSITYMODE_LUMINOUSPOWER:\r\n photometricScale = 1.0 / (4.0 * Math.PI);\r\n break;\r\n case Light.INTENSITYMODE_LUMINOUSINTENSITY:\r\n photometricScale = 1.0;\r\n break;\r\n case Light.INTENSITYMODE_LUMINANCE:\r\n photometricScale = this.radius * this.radius;\r\n break;\r\n }\r\n break;\r\n case Light.LIGHTTYPEID_DIRECTIONALLIGHT:\r\n switch (photometricMode) {\r\n case Light.INTENSITYMODE_ILLUMINANCE:\r\n photometricScale = 1.0;\r\n break;\r\n case Light.INTENSITYMODE_LUMINANCE:\r\n // When radius (and therefore solid angle) is non-zero a directional lights brightness can be specified via central (peak) luminance.\r\n // For a directional light the 'radius' defines the angular radius (in radians) rather than world-space radius (e.g. in metres).\r\n var apexAngleRadians = this.radius;\r\n // Impose a minimum light angular size to avoid the light becoming an infinitely small angular light source (i.e. a dirac delta function).\r\n apexAngleRadians = Math.max(apexAngleRadians, 0.001);\r\n var solidAngle = 2.0 * Math.PI * (1.0 - Math.cos(apexAngleRadians));\r\n photometricScale = solidAngle;\r\n break;\r\n }\r\n break;\r\n case Light.LIGHTTYPEID_HEMISPHERICLIGHT:\r\n // No fall off in hemisperic light.\r\n photometricScale = 1.0;\r\n break;\r\n }\r\n return photometricScale;\r\n };\r\n /**\r\n * Reorder the light in the scene according to their defined priority.\r\n * @hidden Internal Use Only\r\n */\r\n Light.prototype._reorderLightsInScene = function () {\r\n var scene = this.getScene();\r\n if (this._renderPriority != 0) {\r\n scene.requireLightSorting = true;\r\n }\r\n this.getScene().sortLightsByPriority();\r\n };\r\n /**\r\n * Falloff Default: light is falling off following the material specification:\r\n * standard material is using standard falloff whereas pbr material can request special falloff per materials.\r\n */\r\n Light.FALLOFF_DEFAULT = 0;\r\n /**\r\n * Falloff Physical: light is falling off following the inverse squared distance law.\r\n */\r\n Light.FALLOFF_PHYSICAL = 1;\r\n /**\r\n * Falloff gltf: light is falling off as described in the gltf moving to PBR document\r\n * to enhance interoperability with other engines.\r\n */\r\n Light.FALLOFF_GLTF = 2;\r\n /**\r\n * Falloff Standard: light is falling off like in the standard material\r\n * to enhance interoperability with other materials.\r\n */\r\n Light.FALLOFF_STANDARD = 3;\r\n //lightmapMode Consts\r\n /**\r\n * If every light affecting the material is in this lightmapMode,\r\n * material.lightmapTexture adds or multiplies\r\n * (depends on material.useLightmapAsShadowmap)\r\n * after every other light calculations.\r\n */\r\n Light.LIGHTMAP_DEFAULT = 0;\r\n /**\r\n * material.lightmapTexture as only diffuse lighting from this light\r\n * adds only specular lighting from this light\r\n * adds dynamic shadows\r\n */\r\n Light.LIGHTMAP_SPECULAR = 1;\r\n /**\r\n * material.lightmapTexture as only lighting\r\n * no light calculation from this light\r\n * only adds dynamic shadows from this light\r\n */\r\n Light.LIGHTMAP_SHADOWSONLY = 2;\r\n // Intensity Mode Consts\r\n /**\r\n * Each light type uses the default quantity according to its type:\r\n * point/spot lights use luminous intensity\r\n * directional lights use illuminance\r\n */\r\n Light.INTENSITYMODE_AUTOMATIC = 0;\r\n /**\r\n * lumen (lm)\r\n */\r\n Light.INTENSITYMODE_LUMINOUSPOWER = 1;\r\n /**\r\n * candela (lm/sr)\r\n */\r\n Light.INTENSITYMODE_LUMINOUSINTENSITY = 2;\r\n /**\r\n * lux (lm/m^2)\r\n */\r\n Light.INTENSITYMODE_ILLUMINANCE = 3;\r\n /**\r\n * nit (cd/m^2)\r\n */\r\n Light.INTENSITYMODE_LUMINANCE = 4;\r\n // Light types ids const.\r\n /**\r\n * Light type const id of the point light.\r\n */\r\n Light.LIGHTTYPEID_POINTLIGHT = 0;\r\n /**\r\n * Light type const id of the directional light.\r\n */\r\n Light.LIGHTTYPEID_DIRECTIONALLIGHT = 1;\r\n /**\r\n * Light type const id of the spot light.\r\n */\r\n Light.LIGHTTYPEID_SPOTLIGHT = 2;\r\n /**\r\n * Light type const id of the hemispheric light.\r\n */\r\n Light.LIGHTTYPEID_HEMISPHERICLIGHT = 3;\r\n __decorate([\r\n serializeAsColor3()\r\n ], Light.prototype, \"diffuse\", void 0);\r\n __decorate([\r\n serializeAsColor3()\r\n ], Light.prototype, \"specular\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Light.prototype, \"falloffType\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Light.prototype, \"intensity\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Light.prototype, \"range\", null);\r\n __decorate([\r\n serialize()\r\n ], Light.prototype, \"intensityMode\", null);\r\n __decorate([\r\n serialize()\r\n ], Light.prototype, \"radius\", null);\r\n __decorate([\r\n serialize()\r\n ], Light.prototype, \"_renderPriority\", void 0);\r\n __decorate([\r\n expandToProperty(\"_reorderLightsInScene\")\r\n ], Light.prototype, \"renderPriority\", void 0);\r\n __decorate([\r\n serialize(\"shadowEnabled\")\r\n ], Light.prototype, \"_shadowEnabled\", void 0);\r\n __decorate([\r\n serialize(\"excludeWithLayerMask\")\r\n ], Light.prototype, \"_excludeWithLayerMask\", void 0);\r\n __decorate([\r\n serialize(\"includeOnlyWithLayerMask\")\r\n ], Light.prototype, \"_includeOnlyWithLayerMask\", void 0);\r\n __decorate([\r\n serialize(\"lightmapMode\")\r\n ], Light.prototype, \"_lightmapMode\", void 0);\r\n return Light;\r\n}(Node));\r\nexport { Light };\r\n//# sourceMappingURL=light.js.map","import { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { FilesInputStore } from \"../Misc/filesInputStore\";\r\nimport { Scene } from \"../scene\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { SceneLoaderFlags } from \"./sceneLoaderFlags\";\r\n/**\r\n * Mode that determines how to handle old animation groups before loading new ones.\r\n */\r\nexport var SceneLoaderAnimationGroupLoadingMode;\r\n(function (SceneLoaderAnimationGroupLoadingMode) {\r\n /**\r\n * Reset all old animations to initial state then dispose them.\r\n */\r\n SceneLoaderAnimationGroupLoadingMode[SceneLoaderAnimationGroupLoadingMode[\"Clean\"] = 0] = \"Clean\";\r\n /**\r\n * Stop all old animations.\r\n */\r\n SceneLoaderAnimationGroupLoadingMode[SceneLoaderAnimationGroupLoadingMode[\"Stop\"] = 1] = \"Stop\";\r\n /**\r\n * Restart old animations from first frame.\r\n */\r\n SceneLoaderAnimationGroupLoadingMode[SceneLoaderAnimationGroupLoadingMode[\"Sync\"] = 2] = \"Sync\";\r\n /**\r\n * Old animations remains untouched.\r\n */\r\n SceneLoaderAnimationGroupLoadingMode[SceneLoaderAnimationGroupLoadingMode[\"NoSync\"] = 3] = \"NoSync\";\r\n})(SceneLoaderAnimationGroupLoadingMode || (SceneLoaderAnimationGroupLoadingMode = {}));\r\n/**\r\n * Class used to load scene from various file formats using registered plugins\r\n * @see https://doc.babylonjs.com/how_to/load_from_any_file_type\r\n */\r\nvar SceneLoader = /** @class */ (function () {\r\n function SceneLoader() {\r\n }\r\n Object.defineProperty(SceneLoader, \"ForceFullSceneLoadingForIncremental\", {\r\n /**\r\n * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data\r\n */\r\n get: function () {\r\n return SceneLoaderFlags.ForceFullSceneLoadingForIncremental;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags.ForceFullSceneLoadingForIncremental = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoader, \"ShowLoadingScreen\", {\r\n /**\r\n * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene\r\n */\r\n get: function () {\r\n return SceneLoaderFlags.ShowLoadingScreen;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags.ShowLoadingScreen = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoader, \"loggingLevel\", {\r\n /**\r\n * Defines the current logging level (while loading the scene)\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return SceneLoaderFlags.loggingLevel;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags.loggingLevel = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoader, \"CleanBoneMatrixWeights\", {\r\n /**\r\n * Gets or set a boolean indicating if matrix weights must be cleaned upon loading\r\n */\r\n get: function () {\r\n return SceneLoaderFlags.CleanBoneMatrixWeights;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags.CleanBoneMatrixWeights = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the default plugin (used to load Babylon files)\r\n * @returns the .babylon plugin\r\n */\r\n SceneLoader.GetDefaultPlugin = function () {\r\n return SceneLoader._registeredPlugins[\".babylon\"];\r\n };\r\n SceneLoader._GetPluginForExtension = function (extension) {\r\n var registeredPlugin = SceneLoader._registeredPlugins[extension];\r\n if (registeredPlugin) {\r\n return registeredPlugin;\r\n }\r\n Logger.Warn(\"Unable to find a plugin to load \" + extension + \" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/how_to/load_from_any_file_type\");\r\n return SceneLoader.GetDefaultPlugin();\r\n };\r\n SceneLoader._GetPluginForDirectLoad = function (data) {\r\n for (var extension in SceneLoader._registeredPlugins) {\r\n var plugin = SceneLoader._registeredPlugins[extension].plugin;\r\n if (plugin.canDirectLoad && plugin.canDirectLoad(data)) {\r\n return SceneLoader._registeredPlugins[extension];\r\n }\r\n }\r\n return SceneLoader.GetDefaultPlugin();\r\n };\r\n SceneLoader._GetPluginForFilename = function (sceneFilename) {\r\n var queryStringPosition = sceneFilename.indexOf(\"?\");\r\n if (queryStringPosition !== -1) {\r\n sceneFilename = sceneFilename.substring(0, queryStringPosition);\r\n }\r\n var dotPosition = sceneFilename.lastIndexOf(\".\");\r\n var extension = sceneFilename.substring(dotPosition, sceneFilename.length).toLowerCase();\r\n return SceneLoader._GetPluginForExtension(extension);\r\n };\r\n SceneLoader._GetDirectLoad = function (sceneFilename) {\r\n if (sceneFilename.substr(0, 5) === \"data:\") {\r\n return sceneFilename.substr(5);\r\n }\r\n return null;\r\n };\r\n SceneLoader._LoadData = function (fileInfo, scene, onSuccess, onProgress, onError, onDispose, pluginExtension) {\r\n var directLoad = SceneLoader._GetDirectLoad(fileInfo.name);\r\n var registeredPlugin = pluginExtension ? SceneLoader._GetPluginForExtension(pluginExtension) : (directLoad ? SceneLoader._GetPluginForDirectLoad(fileInfo.name) : SceneLoader._GetPluginForFilename(fileInfo.name));\r\n var plugin;\r\n if (registeredPlugin.plugin.createPlugin !== undefined) {\r\n plugin = registeredPlugin.plugin.createPlugin();\r\n }\r\n else {\r\n plugin = registeredPlugin.plugin;\r\n }\r\n if (!plugin) {\r\n throw \"The loader plugin corresponding to the file type you are trying to load has not been found. If using es6, please import the plugin you wish to use before.\";\r\n }\r\n SceneLoader.OnPluginActivatedObservable.notifyObservers(plugin);\r\n if (directLoad) {\r\n if (plugin.directLoad) {\r\n var result = plugin.directLoad(scene, directLoad);\r\n if (result.then) {\r\n result.then(function (data) {\r\n onSuccess(plugin, data);\r\n }).catch(function (error) {\r\n onError(\"Error in directLoad of _loadData: \" + error, error);\r\n });\r\n }\r\n else {\r\n onSuccess(plugin, result);\r\n }\r\n }\r\n else {\r\n onSuccess(plugin, directLoad);\r\n }\r\n return plugin;\r\n }\r\n var useArrayBuffer = registeredPlugin.isBinary;\r\n var dataCallback = function (data, responseURL) {\r\n if (scene.isDisposed) {\r\n onError(\"Scene has been disposed\");\r\n return;\r\n }\r\n onSuccess(plugin, data, responseURL);\r\n };\r\n var request = null;\r\n var pluginDisposed = false;\r\n var onDisposeObservable = plugin.onDisposeObservable;\r\n if (onDisposeObservable) {\r\n onDisposeObservable.add(function () {\r\n pluginDisposed = true;\r\n if (request) {\r\n request.abort();\r\n request = null;\r\n }\r\n onDispose();\r\n });\r\n }\r\n var manifestChecked = function () {\r\n if (pluginDisposed) {\r\n return;\r\n }\r\n var successCallback = function (data, request) {\r\n dataCallback(data, request ? request.responseURL : undefined);\r\n };\r\n var errorCallback = function (error) {\r\n onError(error.message, error);\r\n };\r\n request = plugin.requestFile\r\n ? plugin.requestFile(scene, fileInfo.url, successCallback, onProgress, useArrayBuffer, errorCallback)\r\n : scene._requestFile(fileInfo.url, successCallback, onProgress, true, useArrayBuffer, errorCallback);\r\n };\r\n var file = fileInfo.file || FilesInputStore.FilesToLoad[fileInfo.name.toLowerCase()];\r\n if (fileInfo.rootUrl.indexOf(\"file:\") === -1 || (fileInfo.rootUrl.indexOf(\"file:\") !== -1 && !file)) {\r\n var engine = scene.getEngine();\r\n var canUseOfflineSupport = engine.enableOfflineSupport;\r\n if (canUseOfflineSupport) {\r\n // Also check for exceptions\r\n var exceptionFound = false;\r\n for (var _i = 0, _a = scene.disableOfflineSupportExceptionRules; _i < _a.length; _i++) {\r\n var regex = _a[_i];\r\n if (regex.test(fileInfo.url)) {\r\n exceptionFound = true;\r\n break;\r\n }\r\n }\r\n canUseOfflineSupport = !exceptionFound;\r\n }\r\n if (canUseOfflineSupport && Engine.OfflineProviderFactory) {\r\n // Checking if a manifest file has been set for this scene and if offline mode has been requested\r\n scene.offlineProvider = Engine.OfflineProviderFactory(fileInfo.url, manifestChecked, engine.disableManifestCheck);\r\n }\r\n else {\r\n manifestChecked();\r\n }\r\n }\r\n // Loading file from disk via input file or drag'n'drop\r\n else {\r\n if (file) {\r\n var errorCallback = function (error) {\r\n onError(error.message, error);\r\n };\r\n request = plugin.readFile\r\n ? plugin.readFile(scene, file, dataCallback, onProgress, useArrayBuffer, errorCallback)\r\n : scene._readFile(file, dataCallback, onProgress, useArrayBuffer, errorCallback);\r\n }\r\n else {\r\n onError(\"Unable to find file named \" + fileInfo.name);\r\n }\r\n }\r\n return plugin;\r\n };\r\n SceneLoader._GetFileInfo = function (rootUrl, sceneFilename) {\r\n var url;\r\n var name;\r\n var file = null;\r\n if (!sceneFilename) {\r\n url = rootUrl;\r\n name = Tools.GetFilename(rootUrl);\r\n rootUrl = Tools.GetFolderPath(rootUrl);\r\n }\r\n else if (sceneFilename.name) {\r\n var sceneFile = sceneFilename;\r\n url = rootUrl + sceneFile.name;\r\n name = sceneFile.name;\r\n file = sceneFile;\r\n }\r\n else {\r\n var filename = sceneFilename;\r\n if (filename.substr(0, 1) === \"/\") {\r\n Tools.Error(\"Wrong sceneFilename parameter\");\r\n return null;\r\n }\r\n url = rootUrl + filename;\r\n name = filename;\r\n }\r\n return {\r\n url: url,\r\n rootUrl: rootUrl,\r\n name: name,\r\n file: file\r\n };\r\n };\r\n // Public functions\r\n /**\r\n * Gets a plugin that can load the given extension\r\n * @param extension defines the extension to load\r\n * @returns a plugin or null if none works\r\n */\r\n SceneLoader.GetPluginForExtension = function (extension) {\r\n return SceneLoader._GetPluginForExtension(extension).plugin;\r\n };\r\n /**\r\n * Gets a boolean indicating that the given extension can be loaded\r\n * @param extension defines the extension to load\r\n * @returns true if the extension is supported\r\n */\r\n SceneLoader.IsPluginForExtensionAvailable = function (extension) {\r\n return !!SceneLoader._registeredPlugins[extension];\r\n };\r\n /**\r\n * Adds a new plugin to the list of registered plugins\r\n * @param plugin defines the plugin to add\r\n */\r\n SceneLoader.RegisterPlugin = function (plugin) {\r\n if (typeof plugin.extensions === \"string\") {\r\n var extension = plugin.extensions;\r\n SceneLoader._registeredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: false\r\n };\r\n }\r\n else {\r\n var extensions = plugin.extensions;\r\n Object.keys(extensions).forEach(function (extension) {\r\n SceneLoader._registeredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: extensions[extension].isBinary\r\n };\r\n });\r\n }\r\n };\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with a list of imported meshes, particleSystems, skeletons, and animationGroups when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.ImportMesh = function (meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!scene) {\r\n Logger.Error(\"No scene available to import mesh to\");\r\n return null;\r\n }\r\n var fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n var loadingToken = {};\r\n scene._addPendingData(loadingToken);\r\n var disposeHandler = function () {\r\n scene._removePendingData(loadingToken);\r\n };\r\n var errorHandler = function (message, exception) {\r\n var errorMessage = \"Unable to import meshes from \" + fileInfo.url + \": \" + message;\r\n if (onError) {\r\n onError(scene, errorMessage, exception);\r\n }\r\n else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n disposeHandler();\r\n };\r\n var progressHandler = onProgress ? function (event) {\r\n try {\r\n onProgress(event);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onProgress callback: \" + e, e);\r\n }\r\n } : undefined;\r\n var successHandler = function (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights) {\r\n scene.importedMeshesFiles.push(fileInfo.url);\r\n if (onSuccess) {\r\n try {\r\n onSuccess(meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onSuccess callback: \" + e, e);\r\n }\r\n }\r\n scene._removePendingData(loadingToken);\r\n };\r\n return SceneLoader._LoadData(fileInfo, scene, function (plugin, data, responseURL) {\r\n if (plugin.rewriteRootURL) {\r\n fileInfo.rootUrl = plugin.rewriteRootURL(fileInfo.rootUrl, responseURL);\r\n }\r\n if (plugin.importMesh) {\r\n var syncedPlugin = plugin;\r\n var meshes = new Array();\r\n var particleSystems = new Array();\r\n var skeletons = new Array();\r\n if (!syncedPlugin.importMesh(meshNames, scene, data, fileInfo.rootUrl, meshes, particleSystems, skeletons, errorHandler)) {\r\n return;\r\n }\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(meshes, particleSystems, skeletons, [], [], [], []);\r\n }\r\n else {\r\n var asyncedPlugin = plugin;\r\n asyncedPlugin.importMeshAsync(meshNames, scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name).then(function (result) {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(result.meshes, result.particleSystems, result.skeletons, result.animationGroups, result.transformNodes, result.geometries, result.lights);\r\n }).catch(function (error) {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n }, progressHandler, errorHandler, disposeHandler, pluginExtension);\r\n };\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups\r\n */\r\n SceneLoader.ImportMeshAsync = function (meshNames, rootUrl, sceneFilename, scene, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.ImportMesh(meshNames, rootUrl, sceneFilename, scene, function (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights) {\r\n resolve({\r\n meshes: meshes,\r\n particleSystems: particleSystems,\r\n skeletons: skeletons,\r\n animationGroups: animationGroups,\r\n transformNodes: transformNodes,\r\n geometries: geometries,\r\n lights: lights\r\n });\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * Load a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.Load = function (rootUrl, sceneFilename, engine, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (engine === void 0) { engine = EngineStore.LastCreatedEngine; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!engine) {\r\n Tools.Error(\"No engine available\");\r\n return null;\r\n }\r\n return SceneLoader.Append(rootUrl, sceneFilename, new Scene(engine), onSuccess, onProgress, onError, pluginExtension);\r\n };\r\n /**\r\n * Load a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded scene\r\n */\r\n SceneLoader.LoadAsync = function (rootUrl, sceneFilename, engine, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (engine === void 0) { engine = EngineStore.LastCreatedEngine; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.Load(rootUrl, sceneFilename, engine, function (scene) {\r\n resolve(scene);\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * Append a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.Append = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {\r\n var _this = this;\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!scene) {\r\n Logger.Error(\"No scene available to append to\");\r\n return null;\r\n }\r\n var fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n if (SceneLoader.ShowLoadingScreen && !this._showingLoadingScreen) {\r\n this._showingLoadingScreen = true;\r\n scene.getEngine().displayLoadingUI();\r\n scene.executeWhenReady(function () {\r\n scene.getEngine().hideLoadingUI();\r\n _this._showingLoadingScreen = false;\r\n });\r\n }\r\n var loadingToken = {};\r\n scene._addPendingData(loadingToken);\r\n var disposeHandler = function () {\r\n scene._removePendingData(loadingToken);\r\n };\r\n var errorHandler = function (message, exception) {\r\n var errorMessage = \"Unable to load from \" + fileInfo.url + (message ? \": \" + message : \"\");\r\n if (onError) {\r\n onError(scene, errorMessage, exception);\r\n }\r\n else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n disposeHandler();\r\n };\r\n var progressHandler = onProgress ? function (event) {\r\n try {\r\n onProgress(event);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n } : undefined;\r\n var successHandler = function () {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(scene);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n scene._removePendingData(loadingToken);\r\n };\r\n return SceneLoader._LoadData(fileInfo, scene, function (plugin, data) {\r\n if (plugin.load) {\r\n var syncedPlugin = plugin;\r\n if (!syncedPlugin.load(scene, data, fileInfo.rootUrl, errorHandler)) {\r\n return;\r\n }\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n }\r\n else {\r\n var asyncedPlugin = plugin;\r\n asyncedPlugin.loadAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name).then(function () {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n }).catch(function (error) {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n }, progressHandler, errorHandler, disposeHandler, pluginExtension);\r\n };\r\n /**\r\n * Append a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The given scene\r\n */\r\n SceneLoader.AppendAsync = function (rootUrl, sceneFilename, scene, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.Append(rootUrl, sceneFilename, scene, function (scene) {\r\n resolve(scene);\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * Load a scene into an asset container\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.LoadAssetContainer = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!scene) {\r\n Logger.Error(\"No scene available to load asset container to\");\r\n return null;\r\n }\r\n var fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n var loadingToken = {};\r\n scene._addPendingData(loadingToken);\r\n var disposeHandler = function () {\r\n scene._removePendingData(loadingToken);\r\n };\r\n var errorHandler = function (message, exception) {\r\n var errorMessage = \"Unable to load assets from \" + fileInfo.url + (message ? \": \" + message : \"\");\r\n if (exception && exception.message) {\r\n errorMessage += \" (\" + exception.message + \")\";\r\n }\r\n if (onError) {\r\n onError(scene, errorMessage, exception);\r\n }\r\n else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n disposeHandler();\r\n };\r\n var progressHandler = onProgress ? function (event) {\r\n try {\r\n onProgress(event);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n } : undefined;\r\n var successHandler = function (assets) {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(assets);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n scene._removePendingData(loadingToken);\r\n };\r\n return SceneLoader._LoadData(fileInfo, scene, function (plugin, data) {\r\n if (plugin.loadAssetContainer) {\r\n var syncedPlugin = plugin;\r\n var assetContainer = syncedPlugin.loadAssetContainer(scene, data, fileInfo.rootUrl, errorHandler);\r\n if (!assetContainer) {\r\n return;\r\n }\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n }\r\n else if (plugin.loadAssetContainerAsync) {\r\n var asyncedPlugin = plugin;\r\n asyncedPlugin.loadAssetContainerAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name).then(function (assetContainer) {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n }).catch(function (error) {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n else {\r\n errorHandler(\"LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.\");\r\n }\r\n }, progressHandler, errorHandler, disposeHandler, pluginExtension);\r\n };\r\n /**\r\n * Load a scene into an asset container\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene (default: empty string)\r\n * @param scene is the instance of Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded asset container\r\n */\r\n SceneLoader.LoadAssetContainerAsync = function (rootUrl, sceneFilename, scene, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.LoadAssetContainer(rootUrl, sceneFilename, scene, function (assetContainer) {\r\n resolve(assetContainer);\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * Import animations from a file into a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param overwriteAnimations when true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n * @param animationGroupLoadingMode defines how to handle old animations groups before importing new ones\r\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n */\r\n SceneLoader.ImportAnimations = function (rootUrl, sceneFilename, scene, overwriteAnimations, animationGroupLoadingMode, targetConverter, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (overwriteAnimations === void 0) { overwriteAnimations = true; }\r\n if (animationGroupLoadingMode === void 0) { animationGroupLoadingMode = SceneLoaderAnimationGroupLoadingMode.Clean; }\r\n if (targetConverter === void 0) { targetConverter = null; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!scene) {\r\n Logger.Error(\"No scene available to load animations to\");\r\n return;\r\n }\r\n if (overwriteAnimations) {\r\n // Reset, stop and dispose all animations before loading new ones\r\n for (var _i = 0, _a = scene.animatables; _i < _a.length; _i++) {\r\n var animatable = _a[_i];\r\n animatable.reset();\r\n }\r\n scene.stopAllAnimations();\r\n scene.animationGroups.slice().forEach(function (animationGroup) {\r\n animationGroup.dispose();\r\n });\r\n var nodes = scene.getNodes();\r\n nodes.forEach(function (node) {\r\n if (node.animations) {\r\n node.animations = [];\r\n }\r\n });\r\n }\r\n else {\r\n switch (animationGroupLoadingMode) {\r\n case SceneLoaderAnimationGroupLoadingMode.Clean:\r\n scene.animationGroups.slice().forEach(function (animationGroup) {\r\n animationGroup.dispose();\r\n });\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.Stop:\r\n scene.animationGroups.forEach(function (animationGroup) {\r\n animationGroup.stop();\r\n });\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.Sync:\r\n scene.animationGroups.forEach(function (animationGroup) {\r\n animationGroup.reset();\r\n animationGroup.restart();\r\n });\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.NoSync:\r\n // nothing to do\r\n break;\r\n default:\r\n Logger.Error(\"Unknown animation group loading mode value '\" + animationGroupLoadingMode + \"'\");\r\n return;\r\n }\r\n }\r\n var startingIndexForNewAnimatables = scene.animatables.length;\r\n var onAssetContainerLoaded = function (container) {\r\n container.mergeAnimationsTo(scene, scene.animatables.slice(startingIndexForNewAnimatables), targetConverter);\r\n container.dispose();\r\n scene.onAnimationFileImportedObservable.notifyObservers(scene);\r\n if (onSuccess) {\r\n onSuccess(scene);\r\n }\r\n };\r\n this.LoadAssetContainer(rootUrl, sceneFilename, scene, onAssetContainerLoaded, onProgress, onError, pluginExtension);\r\n };\r\n /**\r\n * Import animations from a file into a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param overwriteAnimations when true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n * @param animationGroupLoadingMode defines how to handle old animations groups before importing new ones\r\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns the updated scene with imported animations\r\n */\r\n SceneLoader.ImportAnimationsAsync = function (rootUrl, sceneFilename, scene, overwriteAnimations, animationGroupLoadingMode, targetConverter, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (overwriteAnimations === void 0) { overwriteAnimations = true; }\r\n if (animationGroupLoadingMode === void 0) { animationGroupLoadingMode = SceneLoaderAnimationGroupLoadingMode.Clean; }\r\n if (targetConverter === void 0) { targetConverter = null; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.ImportAnimations(rootUrl, sceneFilename, scene, overwriteAnimations, animationGroupLoadingMode, targetConverter, function (_scene) {\r\n resolve(_scene);\r\n }, onProgress, function (_scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * No logging while loading\r\n */\r\n SceneLoader.NO_LOGGING = 0;\r\n /**\r\n * Minimal logging while loading\r\n */\r\n SceneLoader.MINIMAL_LOGGING = 1;\r\n /**\r\n * Summary logging while loading\r\n */\r\n SceneLoader.SUMMARY_LOGGING = 2;\r\n /**\r\n * Detailled logging while loading\r\n */\r\n SceneLoader.DETAILED_LOGGING = 3;\r\n // Members\r\n /**\r\n * Event raised when a plugin is used to load a scene\r\n */\r\n SceneLoader.OnPluginActivatedObservable = new Observable();\r\n SceneLoader._registeredPlugins = {};\r\n SceneLoader._showingLoadingScreen = false;\r\n return SceneLoader;\r\n}());\r\nexport { SceneLoader };\r\n//# sourceMappingURL=sceneLoader.js.map","/**\r\n * Class used to represent data loading progression\r\n */\r\nvar SceneLoaderFlags = /** @class */ (function () {\r\n function SceneLoaderFlags() {\r\n }\r\n Object.defineProperty(SceneLoaderFlags, \"ForceFullSceneLoadingForIncremental\", {\r\n /**\r\n * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._ForceFullSceneLoadingForIncremental;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._ForceFullSceneLoadingForIncremental = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoaderFlags, \"ShowLoadingScreen\", {\r\n /**\r\n * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._ShowLoadingScreen;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._ShowLoadingScreen = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoaderFlags, \"loggingLevel\", {\r\n /**\r\n * Defines the current logging level (while loading the scene)\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._loggingLevel;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._loggingLevel = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoaderFlags, \"CleanBoneMatrixWeights\", {\r\n /**\r\n * Gets or set a boolean indicating if matrix weights must be cleaned upon loading\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._CleanBoneMatrixWeights;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._CleanBoneMatrixWeights = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Flags\r\n SceneLoaderFlags._ForceFullSceneLoadingForIncremental = false;\r\n SceneLoaderFlags._ShowLoadingScreen = true;\r\n SceneLoaderFlags._CleanBoneMatrixWeights = false;\r\n SceneLoaderFlags._loggingLevel = 0;\r\n return SceneLoaderFlags;\r\n}());\r\nexport { SceneLoaderFlags };\r\n//# sourceMappingURL=sceneLoaderFlags.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, SerializationHelper, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Matrix } from \"../../Maths/math.vector\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport { GUID } from '../../Misc/guid';\r\nimport \"../../Misc/fileTools\";\r\nimport { ThinTexture } from './thinTexture';\r\n/**\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n */\r\nvar BaseTexture = /** @class */ (function (_super) {\r\n __extends(BaseTexture, _super);\r\n /**\r\n * Instantiates a new BaseTexture.\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n * @param sceneOrEngine Define the scene or engine the texture blongs to\r\n */\r\n function BaseTexture(sceneOrEngine) {\r\n var _this = _super.call(this, null) || this;\r\n /**\r\n * Gets or sets an object used to store user defined information.\r\n */\r\n _this.metadata = null;\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n _this.reservedDataStore = null;\r\n _this._hasAlpha = false;\r\n /**\r\n * Defines if the alpha value should be determined via the rgb values.\r\n * If true the luminance of the pixel might be used to find the corresponding alpha value.\r\n */\r\n _this.getAlphaFromRGB = false;\r\n /**\r\n * Intensity or strength of the texture.\r\n * It is commonly used by materials to fine tune the intensity of the texture\r\n */\r\n _this.level = 1;\r\n /**\r\n * Define the UV chanel to use starting from 0 and defaulting to 0.\r\n * This is part of the texture as textures usually maps to one uv set.\r\n */\r\n _this.coordinatesIndex = 0;\r\n _this._coordinatesMode = 0;\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n _this.wrapR = 1;\r\n /**\r\n * With compliant hardware and browser (supporting anisotropic filtering)\r\n * this defines the level of anisotropic filtering in the texture.\r\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\r\n */\r\n _this.anisotropicFilteringLevel = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;\r\n _this._isCube = false;\r\n _this._gammaSpace = true;\r\n /**\r\n * Is Z inverted in the texture (useful in a cube texture).\r\n */\r\n _this.invertZ = false;\r\n /**\r\n * @hidden\r\n */\r\n _this.lodLevelInAlpha = false;\r\n /**\r\n * Define if the texture is a render target.\r\n */\r\n _this.isRenderTarget = false;\r\n /** @hidden */\r\n _this._prefiltered = false;\r\n /**\r\n * Define the list of animation attached to the texture.\r\n */\r\n _this.animations = new Array();\r\n /**\r\n * An event triggered when the texture is disposed.\r\n */\r\n _this.onDisposeObservable = new Observable();\r\n _this._onDisposeObserver = null;\r\n _this._scene = null;\r\n /** @hidden */\r\n _this._texture = null;\r\n _this._uid = null;\r\n if (sceneOrEngine) {\r\n if (BaseTexture._isScene(sceneOrEngine)) {\r\n _this._scene = sceneOrEngine;\r\n }\r\n else {\r\n _this._engine = sceneOrEngine;\r\n }\r\n }\r\n else {\r\n _this._scene = EngineStore.LastCreatedScene;\r\n }\r\n if (_this._scene) {\r\n _this.uniqueId = _this._scene.getUniqueId();\r\n _this._scene.addTexture(_this);\r\n _this._engine = _this._scene.getEngine();\r\n }\r\n _this._uid = null;\r\n return _this;\r\n }\r\n Object.defineProperty(BaseTexture.prototype, \"hasAlpha\", {\r\n get: function () {\r\n return this._hasAlpha;\r\n },\r\n /**\r\n * Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).\r\n */\r\n set: function (value) {\r\n if (this._hasAlpha === value) {\r\n return;\r\n }\r\n this._hasAlpha = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(1 | 16);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"coordinatesMode\", {\r\n get: function () {\r\n return this._coordinatesMode;\r\n },\r\n /**\r\n * How a texture is mapped.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | EXPLICIT_MODE | |\r\n * | 1 | SPHERICAL_MODE | |\r\n * | 2 | PLANAR_MODE | |\r\n * | 3 | CUBIC_MODE | |\r\n * | 4 | PROJECTION_MODE | |\r\n * | 5 | SKYBOX_MODE | |\r\n * | 6 | INVCUBIC_MODE | |\r\n * | 7 | EQUIRECTANGULAR_MODE | |\r\n * | 8 | FIXED_EQUIRECTANGULAR_MODE | |\r\n * | 9 | FIXED_EQUIRECTANGULAR_MIRRORED_MODE | |\r\n */\r\n set: function (value) {\r\n if (this._coordinatesMode === value) {\r\n return;\r\n }\r\n this._coordinatesMode = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(1);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"wrapU\", {\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n get: function () {\r\n return this._wrapU;\r\n },\r\n set: function (value) {\r\n this._wrapU = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"wrapV\", {\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n get: function () {\r\n return this._wrapV;\r\n },\r\n set: function (value) {\r\n this._wrapV = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"isCube\", {\r\n /**\r\n * Define if the texture is a cube texture or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return this._isCube;\r\n }\r\n return this._texture.isCube;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n this._isCube = value;\r\n }\r\n else {\r\n this._texture.isCube = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"is3D\", {\r\n /**\r\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n return this._texture.is3D;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._texture.is3D = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"is2DArray\", {\r\n /**\r\n * Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n return this._texture.is2DArray;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._texture.is2DArray = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"gammaSpace\", {\r\n /**\r\n * Define if the texture contains data in gamma space (most of the png/jpg aside bump).\r\n * HDR texture are usually stored in linear space.\r\n * This only impacts the PBR and Background materials\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return this._gammaSpace;\r\n }\r\n else {\r\n if (this._texture._gammaSpace === null) {\r\n this._texture._gammaSpace = this._gammaSpace;\r\n }\r\n }\r\n return this._texture._gammaSpace;\r\n },\r\n set: function (gamma) {\r\n if (!this._texture) {\r\n if (this._gammaSpace === gamma) {\r\n return;\r\n }\r\n this._gammaSpace = gamma;\r\n }\r\n else {\r\n if (this._texture._gammaSpace === gamma) {\r\n return;\r\n }\r\n this._texture._gammaSpace = gamma;\r\n }\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"isRGBD\", {\r\n /**\r\n * Gets or sets whether or not the texture contains RGBD data.\r\n */\r\n get: function () {\r\n return this._texture != null && this._texture._isRGBD;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._isRGBD = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"noMipmap\", {\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"lodGenerationOffset\", {\r\n /**\r\n * With prefiltered texture, defined the offset used during the prefiltering steps.\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodGenerationOffset;\r\n }\r\n return 0.0;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._lodGenerationOffset = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"lodGenerationScale\", {\r\n /**\r\n * With prefiltered texture, defined the scale used during the prefiltering steps.\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodGenerationScale;\r\n }\r\n return 0.0;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._lodGenerationScale = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"linearSpecularLOD\", {\r\n /**\r\n * With prefiltered texture, defined if the specular generation is based on a linear ramp.\r\n * By default we are using a log2 of the linear roughness helping to keep a better resolution for\r\n * average roughness values.\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._linearSpecularLOD;\r\n }\r\n return false;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._linearSpecularLOD = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"irradianceTexture\", {\r\n /**\r\n * In case a better definition than spherical harmonics is required for the diffuse part of the environment.\r\n * You can set the irradiance texture to rely on a texture instead of the spherical approach.\r\n * This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._irradianceTexture;\r\n }\r\n return null;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._irradianceTexture = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"uid\", {\r\n /**\r\n * Define the unique id of the texture in the scene.\r\n */\r\n get: function () {\r\n if (!this._uid) {\r\n this._uid = GUID.RandomId();\r\n }\r\n return this._uid;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Return a string representation of the texture.\r\n * @returns the texture as a string\r\n */\r\n BaseTexture.prototype.toString = function () {\r\n return this.name;\r\n };\r\n /**\r\n * Get the class name of the texture.\r\n * @returns \"BaseTexture\"\r\n */\r\n BaseTexture.prototype.getClassName = function () {\r\n return \"BaseTexture\";\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"onDispose\", {\r\n /**\r\n * Callback triggered when the texture has been disposed.\r\n * Kept for back compatibility, you can use the onDisposeObservable instead.\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"isBlocking\", {\r\n /**\r\n * Define if the texture is preventinga material to render or not.\r\n * If not and the texture is not ready, the engine will use a default black texture instead.\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Get the scene the texture belongs to.\r\n * @returns the scene or null if undefined\r\n */\r\n BaseTexture.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /** @hidden */\r\n BaseTexture.prototype._getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * Checks if the texture has the same transform matrix than another texture\r\n * @param texture texture to check against\r\n * @returns true if the transforms are the same, else false\r\n */\r\n BaseTexture.prototype.checkTransformsAreIdentical = function (texture) {\r\n return texture !== null;\r\n };\r\n /**\r\n * Get the texture transform matrix used to offset tile the texture for istance.\r\n * @returns the transformation matrix\r\n */\r\n BaseTexture.prototype.getTextureMatrix = function () {\r\n return Matrix.IdentityReadOnly;\r\n };\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n BaseTexture.prototype.getReflectionTextureMatrix = function () {\r\n return Matrix.IdentityReadOnly;\r\n };\r\n /**\r\n * Get if the texture is ready to be consumed (either it is ready or it is not blocking)\r\n * @returns true if ready or not blocking\r\n */\r\n BaseTexture.prototype.isReadyOrNotBlocking = function () {\r\n return !this.isBlocking || this.isReady();\r\n };\r\n /**\r\n * Scales the texture if is `canRescale()`\r\n * @param ratio the resize factor we want to use to rescale\r\n */\r\n BaseTexture.prototype.scale = function (ratio) {\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"canRescale\", {\r\n /**\r\n * Get if the texture can rescale.\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n BaseTexture.prototype._getFromCache = function (url, noMipmap, sampling, invertY) {\r\n var engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n var texturesCache = engine.getLoadedTexturesCache();\r\n for (var index = 0; index < texturesCache.length; index++) {\r\n var texturesCacheEntry = texturesCache[index];\r\n if (invertY === undefined || invertY === texturesCacheEntry.invertY) {\r\n if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {\r\n if (!sampling || sampling === texturesCacheEntry.samplingMode) {\r\n texturesCacheEntry.incrementReferences();\r\n return texturesCacheEntry;\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /** @hidden */\r\n BaseTexture.prototype._rebuild = function () {\r\n };\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n BaseTexture.prototype.clone = function () {\r\n return null;\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"textureType\", {\r\n /**\r\n * Get the texture underlying type (INT, FLOAT...)\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return 0;\r\n }\r\n return (this._texture.type !== undefined) ? this._texture.type : 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"textureFormat\", {\r\n /**\r\n * Get the texture underlying format (RGB, RGBA...)\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return 5;\r\n }\r\n return (this._texture.format !== undefined) ? this._texture.format : 5;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Indicates that textures need to be re-calculated for all materials\r\n */\r\n BaseTexture.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n scene.markAllMaterialsAsDirty(1);\r\n };\r\n /**\r\n * Reads the pixels stored in the webgl texture and returns them as an ArrayBuffer.\r\n * This will returns an RGBA array buffer containing either in values (0-255) or\r\n * float values (0-1) depending of the underlying buffer type.\r\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\r\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\r\n * @param buffer defines a user defined buffer to fill with data (can be null)\r\n * @returns The Array buffer containing the pixels data.\r\n */\r\n BaseTexture.prototype.readPixels = function (faceIndex, level, buffer) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (level === void 0) { level = 0; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (!this._texture) {\r\n return null;\r\n }\r\n var size = this.getSize();\r\n var width = size.width;\r\n var height = size.height;\r\n var engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n if (level != 0) {\r\n width = width / Math.pow(2, level);\r\n height = height / Math.pow(2, level);\r\n width = Math.round(width);\r\n height = Math.round(height);\r\n }\r\n try {\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixels(this._texture, width, height, faceIndex, level, buffer);\r\n }\r\n return engine._readTexturePixels(this._texture, width, height, -1, level, buffer);\r\n }\r\n catch (e) {\r\n return null;\r\n }\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"_lodTextureHigh\", {\r\n /** @hidden */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodTextureHigh;\r\n }\r\n return null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"_lodTextureMid\", {\r\n /** @hidden */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodTextureMid;\r\n }\r\n return null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"_lodTextureLow\", {\r\n /** @hidden */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodTextureLow;\r\n }\r\n return null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n BaseTexture.prototype.dispose = function () {\r\n if (this._scene) {\r\n // Animations\r\n if (this._scene.stopAnimation) {\r\n this._scene.stopAnimation(this);\r\n }\r\n // Remove from scene\r\n this._scene._removePendingData(this);\r\n var index = this._scene.textures.indexOf(this);\r\n if (index >= 0) {\r\n this._scene.textures.splice(index, 1);\r\n }\r\n this._scene.onTextureRemovedObservable.notifyObservers(this);\r\n this._scene = null;\r\n }\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Serialize the texture into a JSON representation that can be parsed later on.\r\n * @returns the JSON representation of the texture\r\n */\r\n BaseTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n return serializationObject;\r\n };\r\n /**\r\n * Helper function to be called back once a list of texture contains only ready textures.\r\n * @param textures Define the list of textures to wait for\r\n * @param callback Define the callback triggered once the entire list will be ready\r\n */\r\n BaseTexture.WhenAllReady = function (textures, callback) {\r\n var numRemaining = textures.length;\r\n if (numRemaining === 0) {\r\n callback();\r\n return;\r\n }\r\n for (var i = 0; i < textures.length; i++) {\r\n var texture = textures[i];\r\n if (texture.isReady()) {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n }\r\n else {\r\n var onLoadObservable = texture.onLoadObservable;\r\n if (onLoadObservable) {\r\n onLoadObservable.addOnce(function () {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n });\r\n }\r\n }\r\n }\r\n };\r\n BaseTexture._isScene = function (sceneOrEngine) {\r\n return sceneOrEngine.getClassName() === \"Scene\";\r\n };\r\n /**\r\n * Default anisotropic filtering level for the application.\r\n * It is set to 4 as a good tradeoff between perf and quality.\r\n */\r\n BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"uniqueId\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"name\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"metadata\", void 0);\r\n __decorate([\r\n serialize(\"hasAlpha\")\r\n ], BaseTexture.prototype, \"_hasAlpha\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"getAlphaFromRGB\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"level\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"coordinatesIndex\", void 0);\r\n __decorate([\r\n serialize(\"coordinatesMode\")\r\n ], BaseTexture.prototype, \"_coordinatesMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"wrapU\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"wrapV\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"wrapR\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"anisotropicFilteringLevel\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"isCube\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"is3D\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"is2DArray\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"gammaSpace\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"invertZ\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"lodLevelInAlpha\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"lodGenerationOffset\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"lodGenerationScale\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"linearSpecularLOD\", null);\r\n __decorate([\r\n serializeAsTexture()\r\n ], BaseTexture.prototype, \"irradianceTexture\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"isRenderTarget\", void 0);\r\n return BaseTexture;\r\n}(ThinTexture));\r\nexport { BaseTexture };\r\n//# sourceMappingURL=baseTexture.js.map","import { Size } from '../../Maths/math.size';\r\n/**\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties required to work with Thin Engine.\r\n */\r\nvar ThinTexture = /** @class */ (function () {\r\n /**\r\n * Instantiates a new ThinTexture.\r\n * Base class of all the textures in babylon.\r\n * This can be used as an internal texture wrapper in ThinEngine to benefit from the cache\r\n * @param internalTexture Define the internalTexture to wrap\r\n */\r\n function ThinTexture(internalTexture) {\r\n this._wrapU = 1;\r\n this._wrapV = 1;\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n this.wrapR = 1;\r\n /**\r\n * With compliant hardware and browser (supporting anisotropic filtering)\r\n * this defines the level of anisotropic filtering in the texture.\r\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\r\n */\r\n this.anisotropicFilteringLevel = 4;\r\n /**\r\n * Define the current state of the loading sequence when in delayed load mode.\r\n */\r\n this.delayLoadState = 0;\r\n /** @hidden */\r\n this._texture = null;\r\n this._engine = null;\r\n this._cachedSize = Size.Zero();\r\n this._cachedBaseSize = Size.Zero();\r\n this._texture = internalTexture;\r\n if (this._texture) {\r\n this._engine = this._texture.getEngine();\r\n }\r\n }\r\n Object.defineProperty(ThinTexture.prototype, \"wrapU\", {\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n get: function () {\r\n return this._wrapU;\r\n },\r\n set: function (value) {\r\n this._wrapU = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinTexture.prototype, \"wrapV\", {\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n get: function () {\r\n return this._wrapV;\r\n },\r\n set: function (value) {\r\n this._wrapV = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinTexture.prototype, \"coordinatesMode\", {\r\n /**\r\n * How a texture is mapped.\r\n * Unused in thin texture mode.\r\n */\r\n get: function () {\r\n return 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinTexture.prototype, \"isCube\", {\r\n /**\r\n * Define if the texture is a cube texture or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n return this._texture.isCube;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._texture.isCube = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinTexture.prototype, \"is3D\", {\r\n /**\r\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n return this._texture.is3D;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._texture.is3D = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinTexture.prototype, \"is2DArray\", {\r\n /**\r\n * Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n return this._texture.is2DArray;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._texture.is2DArray = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Get the class name of the texture.\r\n * @returns \"ThinTexture\"\r\n */\r\n ThinTexture.prototype.getClassName = function () {\r\n return \"ThinTexture\";\r\n };\r\n /**\r\n * Get if the texture is ready to be used (downloaded, converted, mip mapped...).\r\n * @returns true if fully ready\r\n */\r\n ThinTexture.prototype.isReady = function () {\r\n if (this.delayLoadState === 4) {\r\n this.delayLoad();\r\n return false;\r\n }\r\n if (this._texture) {\r\n return this._texture.isReady;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Triggers the load sequence in delayed load mode.\r\n */\r\n ThinTexture.prototype.delayLoad = function () {\r\n };\r\n /**\r\n * Get the underlying lower level texture from Babylon.\r\n * @returns the insternal texture\r\n */\r\n ThinTexture.prototype.getInternalTexture = function () {\r\n return this._texture;\r\n };\r\n /**\r\n * Get the size of the texture.\r\n * @returns the texture size.\r\n */\r\n ThinTexture.prototype.getSize = function () {\r\n if (this._texture) {\r\n if (this._texture.width) {\r\n this._cachedSize.width = this._texture.width;\r\n this._cachedSize.height = this._texture.height;\r\n return this._cachedSize;\r\n }\r\n if (this._texture._size) {\r\n this._cachedSize.width = this._texture._size;\r\n this._cachedSize.height = this._texture._size;\r\n return this._cachedSize;\r\n }\r\n }\r\n return this._cachedSize;\r\n };\r\n /**\r\n * Get the base size of the texture.\r\n * It can be different from the size if the texture has been resized for POT for instance\r\n * @returns the base size\r\n */\r\n ThinTexture.prototype.getBaseSize = function () {\r\n if (!this.isReady() || !this._texture) {\r\n this._cachedBaseSize.width = 0;\r\n this._cachedBaseSize.height = 0;\r\n return this._cachedBaseSize;\r\n }\r\n if (this._texture._size) {\r\n this._cachedBaseSize.width = this._texture._size;\r\n this._cachedBaseSize.height = this._texture._size;\r\n return this._cachedBaseSize;\r\n }\r\n this._cachedBaseSize.width = this._texture.baseWidth;\r\n this._cachedBaseSize.height = this._texture.baseHeight;\r\n return this._cachedBaseSize;\r\n };\r\n /**\r\n * Update the sampling mode of the texture.\r\n * Default is Trilinear mode.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 1 | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR | Nearest is: mag = nearest, min = nearest, mip = linear |\r\n * | 2 | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |\r\n * | 3 | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |\r\n * | 4 | NEAREST_NEAREST_MIPNEAREST | |\r\n * | 5 | NEAREST_LINEAR_MIPNEAREST | |\r\n * | 6 | NEAREST_LINEAR_MIPLINEAR | |\r\n * | 7 | NEAREST_LINEAR | |\r\n * | 8 | NEAREST_NEAREST | |\r\n * | 9 | LINEAR_NEAREST_MIPNEAREST | |\r\n * | 10 | LINEAR_NEAREST_MIPLINEAR | |\r\n * | 11 | LINEAR_LINEAR | |\r\n * | 12 | LINEAR_NEAREST | |\r\n *\r\n * > _mag_: magnification filter (close to the viewer)\r\n * > _min_: minification filter (far from the viewer)\r\n * > _mip_: filter used between mip map levels\r\n *@param samplingMode Define the new sampling mode of the texture\r\n */\r\n ThinTexture.prototype.updateSamplingMode = function (samplingMode) {\r\n if (this._texture && this._engine) {\r\n this._engine.updateTextureSamplingMode(samplingMode, this._texture);\r\n }\r\n };\r\n /**\r\n * Release and destroy the underlying lower level texture aka internalTexture.\r\n */\r\n ThinTexture.prototype.releaseInternalTexture = function () {\r\n if (this._texture) {\r\n this._texture.dispose();\r\n this._texture = null;\r\n }\r\n };\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n ThinTexture.prototype.dispose = function () {\r\n if (this._texture) {\r\n this.releaseInternalTexture();\r\n this._engine = null;\r\n }\r\n };\r\n return ThinTexture;\r\n}());\r\nexport { ThinTexture };\r\n//# sourceMappingURL=thinTexture.js.map","import { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';\r\nThinEngine.prototype.createDynamicTexture = function (width, height, generateMipMaps, samplingMode) {\r\n var texture = new InternalTexture(this, InternalTextureSource.Dynamic);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n if (generateMipMaps) {\r\n width = this.needPOTTextures ? ThinEngine.GetExponentOfTwo(width, this._caps.maxTextureSize) : width;\r\n height = this.needPOTTextures ? ThinEngine.GetExponentOfTwo(height, this._caps.maxTextureSize) : height;\r\n }\r\n // this.resetTextureCache();\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = false;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n this.updateTextureSamplingMode(samplingMode, texture);\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\nThinEngine.prototype.updateDynamicTexture = function (texture, source, invertY, premulAlpha, format, forceBindTexture) {\r\n if (premulAlpha === void 0) { premulAlpha = false; }\r\n if (forceBindTexture === void 0) { forceBindTexture = false; }\r\n if (!texture) {\r\n return;\r\n }\r\n var gl = this._gl;\r\n var target = gl.TEXTURE_2D;\r\n var wasPreviouslyBound = this._bindTextureDirectly(target, texture, true, forceBindTexture);\r\n this._unpackFlipY(invertY === undefined ? texture.invertY : invertY);\r\n if (premulAlpha) {\r\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);\r\n }\r\n var textureType = this._getWebGLTextureType(texture.type);\r\n var glformat = this._getInternalFormat(format ? format : texture.format);\r\n var internalFormat = this._getRGBABufferInternalSizedFormat(texture.type, glformat);\r\n gl.texImage2D(target, 0, internalFormat, glformat, textureType, source);\r\n if (texture.generateMipMaps) {\r\n gl.generateMipmap(target);\r\n }\r\n if (!wasPreviouslyBound) {\r\n this._bindTextureDirectly(target, null);\r\n }\r\n if (premulAlpha) {\r\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);\r\n }\r\n texture.isReady = true;\r\n};\r\n//# sourceMappingURL=engine.dynamicTexture.js.map","import { __extends } from \"tslib\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport \"../../Engines/Extensions/engine.dynamicTexture\";\r\nimport { CanvasGenerator } from '../../Misc/canvasGenerator';\r\n/**\r\n * A class extending Texture allowing drawing on a texture\r\n * @see https://doc.babylonjs.com/how_to/dynamictexture\r\n */\r\nvar DynamicTexture = /** @class */ (function (_super) {\r\n __extends(DynamicTexture, _super);\r\n /**\r\n * Creates a DynamicTexture\r\n * @param name defines the name of the texture\r\n * @param options provides 3 alternatives for width and height of texture, a canvas, object with width and height properties, number for both width and height\r\n * @param scene defines the scene where you want the texture\r\n * @param generateMipMaps defines the use of MinMaps or not (default is false)\r\n * @param samplingMode defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n * @param format defines the texture format to use (default is Engine.TEXTUREFORMAT_RGBA)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading\r\n */\r\n function DynamicTexture(name, options, scene, generateMipMaps, samplingMode, format, invertY) {\r\n if (scene === void 0) { scene = null; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (format === void 0) { format = 5; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps, invertY, samplingMode, undefined, undefined, undefined, undefined, format) || this;\r\n _this.name = name;\r\n _this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n _this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n _this._generateMipMaps = generateMipMaps;\r\n var engine = _this._getEngine();\r\n if (!engine) {\r\n return _this;\r\n }\r\n if (options.getContext) {\r\n _this._canvas = options;\r\n _this._texture = engine.createDynamicTexture(options.width, options.height, generateMipMaps, samplingMode);\r\n }\r\n else {\r\n _this._canvas = CanvasGenerator.CreateCanvas(1, 1);\r\n if (options.width || options.width === 0) {\r\n _this._texture = engine.createDynamicTexture(options.width, options.height, generateMipMaps, samplingMode);\r\n }\r\n else {\r\n _this._texture = engine.createDynamicTexture(options, options, generateMipMaps, samplingMode);\r\n }\r\n }\r\n var textureSize = _this.getSize();\r\n _this._canvas.width = textureSize.width;\r\n _this._canvas.height = textureSize.height;\r\n _this._context = _this._canvas.getContext(\"2d\");\r\n return _this;\r\n }\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"DynamicTexture\"\r\n */\r\n DynamicTexture.prototype.getClassName = function () {\r\n return \"DynamicTexture\";\r\n };\r\n Object.defineProperty(DynamicTexture.prototype, \"canRescale\", {\r\n /**\r\n * Gets the current state of canRescale\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n DynamicTexture.prototype._recreate = function (textureSize) {\r\n this._canvas.width = textureSize.width;\r\n this._canvas.height = textureSize.height;\r\n this.releaseInternalTexture();\r\n this._texture = this._getEngine().createDynamicTexture(textureSize.width, textureSize.height, this._generateMipMaps, this.samplingMode);\r\n };\r\n /**\r\n * Scales the texture\r\n * @param ratio the scale factor to apply to both width and height\r\n */\r\n DynamicTexture.prototype.scale = function (ratio) {\r\n var textureSize = this.getSize();\r\n textureSize.width *= ratio;\r\n textureSize.height *= ratio;\r\n this._recreate(textureSize);\r\n };\r\n /**\r\n * Resizes the texture\r\n * @param width the new width\r\n * @param height the new height\r\n */\r\n DynamicTexture.prototype.scaleTo = function (width, height) {\r\n var textureSize = this.getSize();\r\n textureSize.width = width;\r\n textureSize.height = height;\r\n this._recreate(textureSize);\r\n };\r\n /**\r\n * Gets the context of the canvas used by the texture\r\n * @returns the canvas context of the dynamic texture\r\n */\r\n DynamicTexture.prototype.getContext = function () {\r\n return this._context;\r\n };\r\n /**\r\n * Clears the texture\r\n */\r\n DynamicTexture.prototype.clear = function () {\r\n var size = this.getSize();\r\n this._context.fillRect(0, 0, size.width, size.height);\r\n };\r\n /**\r\n * Updates the texture\r\n * @param invertY defines the direction for the Y axis (default is true - y increases downwards)\r\n * @param premulAlpha defines if alpha is stored as premultiplied (default is false)\r\n */\r\n DynamicTexture.prototype.update = function (invertY, premulAlpha) {\r\n if (premulAlpha === void 0) { premulAlpha = false; }\r\n this._getEngine().updateDynamicTexture(this._texture, this._canvas, invertY === undefined ? true : invertY, premulAlpha, this._format || undefined);\r\n };\r\n /**\r\n * Draws text onto the texture\r\n * @param text defines the text to be drawn\r\n * @param x defines the placement of the text from the left\r\n * @param y defines the placement of the text from the top when invertY is true and from the bottom when false\r\n * @param font defines the font to be used with font-style, font-size, font-name\r\n * @param color defines the color used for the text\r\n * @param clearColor defines the color for the canvas, use null to not overwrite canvas\r\n * @param invertY defines the direction for the Y axis (default is true - y increases downwards)\r\n * @param update defines whether texture is immediately update (default is true)\r\n */\r\n DynamicTexture.prototype.drawText = function (text, x, y, font, color, clearColor, invertY, update) {\r\n if (update === void 0) { update = true; }\r\n var size = this.getSize();\r\n if (clearColor) {\r\n this._context.fillStyle = clearColor;\r\n this._context.fillRect(0, 0, size.width, size.height);\r\n }\r\n this._context.font = font;\r\n if (x === null || x === undefined) {\r\n var textSize = this._context.measureText(text);\r\n x = (size.width - textSize.width) / 2;\r\n }\r\n if (y === null || y === undefined) {\r\n var fontSize = parseInt((font.replace(/\\D/g, '')));\r\n y = (size.height / 2) + (fontSize / 3.65);\r\n }\r\n this._context.fillStyle = color || \"\";\r\n this._context.fillText(text, x, y);\r\n if (update) {\r\n this.update(invertY);\r\n }\r\n };\r\n /**\r\n * Clones the texture\r\n * @returns the clone of the texture.\r\n */\r\n DynamicTexture.prototype.clone = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n var textureSize = this.getSize();\r\n var newTexture = new DynamicTexture(this.name, textureSize, scene, this._generateMipMaps);\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n // Dynamic Texture\r\n newTexture.wrapU = this.wrapU;\r\n newTexture.wrapV = this.wrapV;\r\n return newTexture;\r\n };\r\n /**\r\n * Serializes the dynamic texture. The scene should be ready before the dynamic texture is serialized\r\n * @returns a serialized dynamic texture object\r\n */\r\n DynamicTexture.prototype.serialize = function () {\r\n var scene = this.getScene();\r\n if (scene && !scene.isReady()) {\r\n Logger.Warn(\"The scene must be ready before serializing the dynamic texture\");\r\n }\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n if (this._IsCanvasElement(this._canvas)) {\r\n serializationObject.base64String = this._canvas.toDataURL();\r\n }\r\n serializationObject.invertY = this._invertY;\r\n serializationObject.samplingMode = this.samplingMode;\r\n return serializationObject;\r\n };\r\n DynamicTexture.prototype._IsCanvasElement = function (canvas) {\r\n return canvas.toDataURL !== undefined;\r\n };\r\n /** @hidden */\r\n DynamicTexture.prototype._rebuild = function () {\r\n this.update();\r\n };\r\n return DynamicTexture;\r\n}(Texture));\r\nexport { DynamicTexture };\r\n//# sourceMappingURL=dynamicTexture.js.map","import { Observable } from \"../../Misc/observable\";\r\nimport { RenderTargetCreationOptions } from \"../../Materials/Textures/renderTargetCreationOptions\";\r\nimport { _DevTools } from '../../Misc/devTools';\r\n/**\r\n * Defines the source of the internal texture\r\n */\r\nexport var InternalTextureSource;\r\n(function (InternalTextureSource) {\r\n /**\r\n * The source of the texture data is unknown\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Unknown\"] = 0] = \"Unknown\";\r\n /**\r\n * Texture data comes from an URL\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Url\"] = 1] = \"Url\";\r\n /**\r\n * Texture data is only used for temporary storage\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Temp\"] = 2] = \"Temp\";\r\n /**\r\n * Texture data comes from raw data (ArrayBuffer)\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Raw\"] = 3] = \"Raw\";\r\n /**\r\n * Texture content is dynamic (video or dynamic texture)\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Dynamic\"] = 4] = \"Dynamic\";\r\n /**\r\n * Texture content is generated by rendering to it\r\n */\r\n InternalTextureSource[InternalTextureSource[\"RenderTarget\"] = 5] = \"RenderTarget\";\r\n /**\r\n * Texture content is part of a multi render target process\r\n */\r\n InternalTextureSource[InternalTextureSource[\"MultiRenderTarget\"] = 6] = \"MultiRenderTarget\";\r\n /**\r\n * Texture data comes from a cube data file\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Cube\"] = 7] = \"Cube\";\r\n /**\r\n * Texture data comes from a raw cube data\r\n */\r\n InternalTextureSource[InternalTextureSource[\"CubeRaw\"] = 8] = \"CubeRaw\";\r\n /**\r\n * Texture data come from a prefiltered cube data file\r\n */\r\n InternalTextureSource[InternalTextureSource[\"CubePrefiltered\"] = 9] = \"CubePrefiltered\";\r\n /**\r\n * Texture content is raw 3D data\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Raw3D\"] = 10] = \"Raw3D\";\r\n /**\r\n * Texture content is raw 2D array data\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Raw2DArray\"] = 11] = \"Raw2DArray\";\r\n /**\r\n * Texture content is a depth texture\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Depth\"] = 12] = \"Depth\";\r\n /**\r\n * Texture data comes from a raw cube data encoded with RGBD\r\n */\r\n InternalTextureSource[InternalTextureSource[\"CubeRawRGBD\"] = 13] = \"CubeRawRGBD\";\r\n})(InternalTextureSource || (InternalTextureSource = {}));\r\n/**\r\n * Class used to store data associated with WebGL texture data for the engine\r\n * This class should not be used directly\r\n */\r\nvar InternalTexture = /** @class */ (function () {\r\n /**\r\n * Creates a new InternalTexture\r\n * @param engine defines the engine to use\r\n * @param source defines the type of data that will be used\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n function InternalTexture(engine, source, delayAllocation) {\r\n if (delayAllocation === void 0) { delayAllocation = false; }\r\n /**\r\n * Defines if the texture is ready\r\n */\r\n this.isReady = false;\r\n /**\r\n * Defines if the texture is a cube texture\r\n */\r\n this.isCube = false;\r\n /**\r\n * Defines if the texture contains 3D data\r\n */\r\n this.is3D = false;\r\n /**\r\n * Defines if the texture contains 2D array data\r\n */\r\n this.is2DArray = false;\r\n /**\r\n * Defines if the texture contains multiview data\r\n */\r\n this.isMultiview = false;\r\n /**\r\n * Gets the URL used to load this texture\r\n */\r\n this.url = \"\";\r\n /**\r\n * Gets the sampling mode of the texture\r\n */\r\n this.samplingMode = -1;\r\n /**\r\n * Gets a boolean indicating if the texture needs mipmaps generation\r\n */\r\n this.generateMipMaps = false;\r\n /**\r\n * Gets the number of samples used by the texture (WebGL2+ only)\r\n */\r\n this.samples = 0;\r\n /**\r\n * Gets the type of the texture (int, float...)\r\n */\r\n this.type = -1;\r\n /**\r\n * Gets the format of the texture (RGB, RGBA...)\r\n */\r\n this.format = -1;\r\n /**\r\n * Observable called when the texture is loaded\r\n */\r\n this.onLoadedObservable = new Observable();\r\n /**\r\n * Gets the width of the texture\r\n */\r\n this.width = 0;\r\n /**\r\n * Gets the height of the texture\r\n */\r\n this.height = 0;\r\n /**\r\n * Gets the depth of the texture\r\n */\r\n this.depth = 0;\r\n /**\r\n * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseWidth = 0;\r\n /**\r\n * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseHeight = 0;\r\n /**\r\n * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseDepth = 0;\r\n /**\r\n * Gets a boolean indicating if the texture is inverted on Y axis\r\n */\r\n this.invertY = false;\r\n // Private\r\n /** @hidden */\r\n this._invertVScale = false;\r\n /** @hidden */\r\n this._associatedChannel = -1;\r\n /** @hidden */\r\n this._source = InternalTextureSource.Unknown;\r\n /** @hidden */\r\n this._buffer = null;\r\n /** @hidden */\r\n this._bufferView = null;\r\n /** @hidden */\r\n this._bufferViewArray = null;\r\n /** @hidden */\r\n this._bufferViewArrayArray = null;\r\n /** @hidden */\r\n this._size = 0;\r\n /** @hidden */\r\n this._extension = \"\";\r\n /** @hidden */\r\n this._files = null;\r\n /** @hidden */\r\n this._workingCanvas = null;\r\n /** @hidden */\r\n this._workingContext = null;\r\n /** @hidden */\r\n this._framebuffer = null;\r\n /** @hidden */\r\n this._depthStencilBuffer = null;\r\n /** @hidden */\r\n this._MSAAFramebuffer = null;\r\n /** @hidden */\r\n this._MSAARenderBuffer = null;\r\n /** @hidden */\r\n this._attachments = null;\r\n /** @hidden */\r\n this._textureArray = null;\r\n /** @hidden */\r\n this._cachedCoordinatesMode = null;\r\n /** @hidden */\r\n this._cachedWrapU = null;\r\n /** @hidden */\r\n this._cachedWrapV = null;\r\n /** @hidden */\r\n this._cachedWrapR = null;\r\n /** @hidden */\r\n this._cachedAnisotropicFilteringLevel = null;\r\n /** @hidden */\r\n this._isDisabled = false;\r\n /** @hidden */\r\n this._compression = null;\r\n /** @hidden */\r\n this._generateStencilBuffer = false;\r\n /** @hidden */\r\n this._generateDepthBuffer = false;\r\n /** @hidden */\r\n this._comparisonFunction = 0;\r\n /** @hidden */\r\n this._sphericalPolynomial = null;\r\n /** @hidden */\r\n this._lodGenerationScale = 0;\r\n /** @hidden */\r\n this._lodGenerationOffset = 0;\r\n // Multiview\r\n /** @hidden */\r\n this._colorTextureArray = null;\r\n /** @hidden */\r\n this._depthStencilTextureArray = null;\r\n // The following three fields helps sharing generated fixed LODs for texture filtering\r\n // In environment not supporting the textureLOD extension like EDGE. They are for internal use only.\r\n // They are at the level of the gl texture to benefit from the cache.\r\n /** @hidden */\r\n this._lodTextureHigh = null;\r\n /** @hidden */\r\n this._lodTextureMid = null;\r\n /** @hidden */\r\n this._lodTextureLow = null;\r\n /** @hidden */\r\n this._isRGBD = false;\r\n /** @hidden */\r\n this._linearSpecularLOD = false;\r\n /** @hidden */\r\n this._irradianceTexture = null;\r\n /** @hidden */\r\n this._webGLTexture = null;\r\n /** @hidden */\r\n this._references = 1;\r\n /** @hidden */\r\n this._gammaSpace = null;\r\n this._engine = engine;\r\n this._source = source;\r\n if (!delayAllocation) {\r\n this._webGLTexture = engine._createTexture();\r\n }\r\n }\r\n /**\r\n * Gets the Engine the texture belongs to.\r\n * @returns The babylon engine\r\n */\r\n InternalTexture.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n Object.defineProperty(InternalTexture.prototype, \"source\", {\r\n /**\r\n * Gets the data source type of the texture\r\n */\r\n get: function () {\r\n return this._source;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Increments the number of references (ie. the number of Texture that point to it)\r\n */\r\n InternalTexture.prototype.incrementReferences = function () {\r\n this._references++;\r\n };\r\n /**\r\n * Change the size of the texture (not the size of the content)\r\n * @param width defines the new width\r\n * @param height defines the new height\r\n * @param depth defines the new depth (1 by default)\r\n */\r\n InternalTexture.prototype.updateSize = function (width, height, depth) {\r\n if (depth === void 0) { depth = 1; }\r\n this.width = width;\r\n this.height = height;\r\n this.depth = depth;\r\n this.baseWidth = width;\r\n this.baseHeight = height;\r\n this.baseDepth = depth;\r\n this._size = width * height * depth;\r\n };\r\n /** @hidden */\r\n InternalTexture.prototype._rebuild = function () {\r\n var _this = this;\r\n var _a;\r\n var proxy;\r\n this.isReady = false;\r\n this._cachedCoordinatesMode = null;\r\n this._cachedWrapU = null;\r\n this._cachedWrapV = null;\r\n this._cachedAnisotropicFilteringLevel = null;\r\n switch (this.source) {\r\n case InternalTextureSource.Temp:\r\n return;\r\n case InternalTextureSource.Url:\r\n proxy = this._engine.createTexture((_a = this._originalUrl) !== null && _a !== void 0 ? _a : this.url, !this.generateMipMaps, this.invertY, null, this.samplingMode, function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n }, null, this._buffer, undefined, this.format);\r\n return;\r\n case InternalTextureSource.Raw:\r\n proxy = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.Raw3D:\r\n proxy = this._engine.createRawTexture3D(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.Raw2DArray:\r\n proxy = this._engine.createRawTexture2DArray(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.Dynamic:\r\n proxy = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode);\r\n proxy._swapAndDie(this);\r\n this._engine.updateDynamicTexture(this, this._engine.getRenderingCanvas(), this.invertY, undefined, undefined, true);\r\n // The engine will make sure to update content so no need to flag it as isReady = true\r\n return;\r\n case InternalTextureSource.RenderTarget:\r\n var options = new RenderTargetCreationOptions();\r\n options.generateDepthBuffer = this._generateDepthBuffer;\r\n options.generateMipMaps = this.generateMipMaps;\r\n options.generateStencilBuffer = this._generateStencilBuffer;\r\n options.samplingMode = this.samplingMode;\r\n options.type = this.type;\r\n if (this.isCube) {\r\n proxy = this._engine.createRenderTargetCubeTexture(this.width, options);\r\n }\r\n else {\r\n var size_1 = {\r\n width: this.width,\r\n height: this.height,\r\n layers: this.is2DArray ? this.depth : undefined\r\n };\r\n proxy = this._engine.createRenderTargetTexture(size_1, options);\r\n }\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.Depth:\r\n var depthTextureOptions = {\r\n bilinearFiltering: this.samplingMode !== 2,\r\n comparisonFunction: this._comparisonFunction,\r\n generateStencil: this._generateStencilBuffer,\r\n isCube: this.isCube\r\n };\r\n var size = {\r\n width: this.width,\r\n height: this.height,\r\n layers: this.is2DArray ? this.depth : undefined\r\n };\r\n proxy = this._engine.createDepthStencilTexture(size, depthTextureOptions);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.Cube:\r\n proxy = this._engine.createCubeTexture(this.url, null, this._files, !this.generateMipMaps, function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n }, null, this.format, this._extension);\r\n return;\r\n case InternalTextureSource.CubeRaw:\r\n proxy = this._engine.createRawCubeTexture(this._bufferViewArray, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.CubeRawRGBD:\r\n proxy = this._engine.createRawCubeTexture(null, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n InternalTexture._UpdateRGBDAsync(proxy, this._bufferViewArrayArray, this._sphericalPolynomial, this._lodGenerationScale, this._lodGenerationOffset).then(function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n });\r\n return;\r\n case InternalTextureSource.CubePrefiltered:\r\n proxy = this._engine.createPrefilteredCubeTexture(this.url, null, this._lodGenerationScale, this._lodGenerationOffset, function (proxy) {\r\n if (proxy) {\r\n proxy._swapAndDie(_this);\r\n }\r\n _this.isReady = true;\r\n }, null, this.format, this._extension);\r\n proxy._sphericalPolynomial = this._sphericalPolynomial;\r\n return;\r\n }\r\n };\r\n /** @hidden */\r\n InternalTexture.prototype._swapAndDie = function (target) {\r\n target._webGLTexture = this._webGLTexture;\r\n target._isRGBD = this._isRGBD;\r\n if (this._framebuffer) {\r\n target._framebuffer = this._framebuffer;\r\n }\r\n if (this._depthStencilBuffer) {\r\n target._depthStencilBuffer = this._depthStencilBuffer;\r\n }\r\n target._depthStencilTexture = this._depthStencilTexture;\r\n if (this._lodTextureHigh) {\r\n if (target._lodTextureHigh) {\r\n target._lodTextureHigh.dispose();\r\n }\r\n target._lodTextureHigh = this._lodTextureHigh;\r\n }\r\n if (this._lodTextureMid) {\r\n if (target._lodTextureMid) {\r\n target._lodTextureMid.dispose();\r\n }\r\n target._lodTextureMid = this._lodTextureMid;\r\n }\r\n if (this._lodTextureLow) {\r\n if (target._lodTextureLow) {\r\n target._lodTextureLow.dispose();\r\n }\r\n target._lodTextureLow = this._lodTextureLow;\r\n }\r\n if (this._irradianceTexture) {\r\n if (target._irradianceTexture) {\r\n target._irradianceTexture.dispose();\r\n }\r\n target._irradianceTexture = this._irradianceTexture;\r\n }\r\n var cache = this._engine.getLoadedTexturesCache();\r\n var index = cache.indexOf(this);\r\n if (index !== -1) {\r\n cache.splice(index, 1);\r\n }\r\n var index = cache.indexOf(target);\r\n if (index === -1) {\r\n cache.push(target);\r\n }\r\n };\r\n /**\r\n * Dispose the current allocated resources\r\n */\r\n InternalTexture.prototype.dispose = function () {\r\n if (!this._webGLTexture) {\r\n return;\r\n }\r\n this._references--;\r\n if (this._references === 0) {\r\n this._engine._releaseTexture(this);\r\n this._webGLTexture = null;\r\n }\r\n };\r\n /** @hidden */\r\n InternalTexture._UpdateRGBDAsync = function (internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\r\n throw _DevTools.WarnImport(\"environmentTextureTools\");\r\n };\r\n return InternalTexture;\r\n}());\r\nexport { InternalTexture };\r\n//# sourceMappingURL=internalTexture.js.map","/**\r\n * Define options used to create a render target texture\r\n */\r\nvar RenderTargetCreationOptions = /** @class */ (function () {\r\n function RenderTargetCreationOptions() {\r\n }\r\n return RenderTargetCreationOptions;\r\n}());\r\nexport { RenderTargetCreationOptions };\r\n//# sourceMappingURL=renderTargetCreationOptions.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { Matrix, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { PostProcessManager } from \"../../PostProcesses/postProcessManager\";\r\nimport { RenderingManager } from \"../../Rendering/renderingManager\";\r\nimport \"../../Engines/Extensions/engine.renderTarget\";\r\nimport \"../../Engines/Extensions/engine.renderTargetCube\";\r\nimport { Engine } from '../../Engines/engine';\r\n/**\r\n * This Helps creating a texture that will be created from a camera in your scene.\r\n * It is basically a dynamic texture that could be used to create special effects for instance.\r\n * Actually, It is the base of lot of effects in the framework like post process, shadows, effect layers and rendering pipelines...\r\n */\r\nvar RenderTargetTexture = /** @class */ (function (_super) {\r\n __extends(RenderTargetTexture, _super);\r\n /**\r\n * Instantiate a render target texture. This is mainly used to render of screen the scene to for instance apply post processse\r\n * or used a shadow, depth texture...\r\n * @param name The friendly name of the texture\r\n * @param size The size of the RTT (number if square, or {width: number, height:number} or {ratio:} to define a ratio from the main scene)\r\n * @param scene The scene the RTT belongs to. The latest created scene will be used if not precised.\r\n * @param generateMipMaps True if mip maps need to be generated after render.\r\n * @param doNotChangeAspectRatio True to not change the aspect ratio of the scene in the RTT\r\n * @param type The type of the buffer in the RTT (int, half float, float...)\r\n * @param isCube True if a cube texture needs to be created\r\n * @param samplingMode The sampling mode to be usedwith the render target (Linear, Nearest...)\r\n * @param generateDepthBuffer True to generate a depth buffer\r\n * @param generateStencilBuffer True to generate a stencil buffer\r\n * @param isMulti True if multiple textures need to be created (Draw Buffers)\r\n * @param format The internal format of the buffer in the RTT (RED, RG, RGB, RGBA, ALPHA...)\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n function RenderTargetTexture(name, size, scene, generateMipMaps, doNotChangeAspectRatio, type, isCube, samplingMode, generateDepthBuffer, generateStencilBuffer, isMulti, format, delayAllocation) {\r\n if (doNotChangeAspectRatio === void 0) { doNotChangeAspectRatio = true; }\r\n if (type === void 0) { type = 0; }\r\n if (isCube === void 0) { isCube = false; }\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (generateDepthBuffer === void 0) { generateDepthBuffer = true; }\r\n if (generateStencilBuffer === void 0) { generateStencilBuffer = false; }\r\n if (isMulti === void 0) { isMulti = false; }\r\n if (format === void 0) { format = 5; }\r\n if (delayAllocation === void 0) { delayAllocation = false; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps) || this;\r\n /**\r\n * Define if particles should be rendered in your texture.\r\n */\r\n _this.renderParticles = true;\r\n /**\r\n * Define if sprites should be rendered in your texture.\r\n */\r\n _this.renderSprites = false;\r\n /**\r\n * Define if the camera viewport should be respected while rendering the texture or if the render should be done to the entire texture.\r\n */\r\n _this.ignoreCameraViewport = false;\r\n /**\r\n * An event triggered when the texture is unbind.\r\n */\r\n _this.onBeforeBindObservable = new Observable();\r\n /**\r\n * An event triggered when the texture is unbind.\r\n */\r\n _this.onAfterUnbindObservable = new Observable();\r\n /**\r\n * An event triggered before rendering the texture\r\n */\r\n _this.onBeforeRenderObservable = new Observable();\r\n /**\r\n * An event triggered after rendering the texture\r\n */\r\n _this.onAfterRenderObservable = new Observable();\r\n /**\r\n * An event triggered after the texture clear\r\n */\r\n _this.onClearObservable = new Observable();\r\n /**\r\n * An event triggered when the texture is resized.\r\n */\r\n _this.onResizeObservable = new Observable();\r\n _this._currentRefreshId = -1;\r\n _this._refreshRate = 1;\r\n _this._samples = 1;\r\n /**\r\n * Gets or sets the center of the bounding box associated with the texture (when in cube mode)\r\n * It must define where the camera used to render the texture is set\r\n */\r\n _this.boundingBoxPosition = Vector3.Zero();\r\n scene = _this.getScene();\r\n if (!scene) {\r\n return _this;\r\n }\r\n _this._coordinatesMode = Texture.PROJECTION_MODE;\r\n _this.renderList = new Array();\r\n _this.name = name;\r\n _this.isRenderTarget = true;\r\n _this._initialSizeParameter = size;\r\n _this._processSizeParameter(size);\r\n _this._resizeObserver = _this.getScene().getEngine().onResizeObservable.add(function () {\r\n });\r\n _this._generateMipMaps = generateMipMaps ? true : false;\r\n _this._doNotChangeAspectRatio = doNotChangeAspectRatio;\r\n // Rendering groups\r\n _this._renderingManager = new RenderingManager(scene);\r\n _this._renderingManager._useSceneAutoClearSetup = true;\r\n if (isMulti) {\r\n return _this;\r\n }\r\n _this._renderTargetOptions = {\r\n generateMipMaps: generateMipMaps,\r\n type: type,\r\n format: format,\r\n samplingMode: samplingMode,\r\n generateDepthBuffer: generateDepthBuffer,\r\n generateStencilBuffer: generateStencilBuffer\r\n };\r\n if (samplingMode === Texture.NEAREST_SAMPLINGMODE) {\r\n _this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n _this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n }\r\n if (!delayAllocation) {\r\n if (isCube) {\r\n _this._texture = scene.getEngine().createRenderTargetCubeTexture(_this.getRenderSize(), _this._renderTargetOptions);\r\n _this.coordinatesMode = Texture.INVCUBIC_MODE;\r\n _this._textureMatrix = Matrix.Identity();\r\n }\r\n else {\r\n _this._texture = scene.getEngine().createRenderTargetTexture(_this._size, _this._renderTargetOptions);\r\n }\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(RenderTargetTexture.prototype, \"renderList\", {\r\n /**\r\n * Use this list to define the list of mesh you want to render.\r\n */\r\n get: function () {\r\n return this._renderList;\r\n },\r\n set: function (value) {\r\n this._renderList = value;\r\n if (this._renderList) {\r\n this._hookArray(this._renderList);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n RenderTargetTexture.prototype._hookArray = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var wasEmpty = array.length === 0;\r\n var result = oldPush.apply(array, items);\r\n if (wasEmpty && _this.getScene()) {\r\n _this.getScene().meshes.forEach(function (mesh) {\r\n mesh._markSubMeshesAsLightDirty();\r\n });\r\n }\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n if (array.length === 0) {\r\n _this.getScene().meshes.forEach(function (mesh) {\r\n mesh._markSubMeshesAsLightDirty();\r\n });\r\n }\r\n return deleted;\r\n };\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onAfterUnbind\", {\r\n /**\r\n * Set a after unbind callback in the texture.\r\n * This has been kept for backward compatibility and use of onAfterUnbindObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onAfterUnbindObserver) {\r\n this.onAfterUnbindObservable.remove(this._onAfterUnbindObserver);\r\n }\r\n this._onAfterUnbindObserver = this.onAfterUnbindObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onBeforeRender\", {\r\n /**\r\n * Set a before render callback in the texture.\r\n * This has been kept for backward compatibility and use of onBeforeRenderObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onAfterRender\", {\r\n /**\r\n * Set a after render callback in the texture.\r\n * This has been kept for backward compatibility and use of onAfterRenderObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onClear\", {\r\n /**\r\n * Set a clear callback in the texture.\r\n * This has been kept for backward compatibility and use of onClearObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onClearObserver) {\r\n this.onClearObservable.remove(this._onClearObserver);\r\n }\r\n this._onClearObserver = this.onClearObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"renderTargetOptions\", {\r\n /**\r\n * Gets render target creation options that were used.\r\n */\r\n get: function () {\r\n return this._renderTargetOptions;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n RenderTargetTexture.prototype._onRatioRescale = function () {\r\n if (this._sizeRatio) {\r\n this.resize(this._initialSizeParameter);\r\n }\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"boundingBoxSize\", {\r\n get: function () {\r\n return this._boundingBoxSize;\r\n },\r\n /**\r\n * Gets or sets the size of the bounding box associated with the texture (when in cube mode)\r\n * When defined, the cubemap will switch to local mode\r\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\r\n * @example https://www.babylonjs-playground.com/#RNASML\r\n */\r\n set: function (value) {\r\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\r\n return;\r\n }\r\n this._boundingBoxSize = value;\r\n var scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(1);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"depthStencilTexture\", {\r\n /**\r\n * In case the RTT has been created with a depth texture, get the associated\r\n * depth texture.\r\n * Otherwise, return null.\r\n */\r\n get: function () {\r\n var _a;\r\n return ((_a = this.getInternalTexture()) === null || _a === void 0 ? void 0 : _a._depthStencilTexture) || null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a depth stencil texture.\r\n * This is only available in WebGL 2 or with the depth texture extension available.\r\n * @param comparisonFunction Specifies the comparison function to set on the texture. If 0 or undefined, the texture is not in comparison mode\r\n * @param bilinearFiltering Specifies whether or not bilinear filtering is enable on the texture\r\n * @param generateStencil Specifies whether or not a stencil should be allocated in the texture\r\n */\r\n RenderTargetTexture.prototype.createDepthStencilTexture = function (comparisonFunction, bilinearFiltering, generateStencil) {\r\n if (comparisonFunction === void 0) { comparisonFunction = 0; }\r\n if (bilinearFiltering === void 0) { bilinearFiltering = true; }\r\n if (generateStencil === void 0) { generateStencil = false; }\r\n var internalTexture = this.getInternalTexture();\r\n if (!this.getScene() || !internalTexture) {\r\n return;\r\n }\r\n var engine = this.getScene().getEngine();\r\n internalTexture._depthStencilTexture = engine.createDepthStencilTexture(this._size, {\r\n bilinearFiltering: bilinearFiltering,\r\n comparisonFunction: comparisonFunction,\r\n generateStencil: generateStencil,\r\n isCube: this.isCube\r\n });\r\n };\r\n RenderTargetTexture.prototype._processSizeParameter = function (size) {\r\n if (size.ratio) {\r\n this._sizeRatio = size.ratio;\r\n var engine = this._getEngine();\r\n this._size = {\r\n width: this._bestReflectionRenderTargetDimension(engine.getRenderWidth(), this._sizeRatio),\r\n height: this._bestReflectionRenderTargetDimension(engine.getRenderHeight(), this._sizeRatio)\r\n };\r\n }\r\n else {\r\n this._size = size;\r\n }\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"samples\", {\r\n /**\r\n * Define the number of samples to use in case of MSAA.\r\n * It defaults to one meaning no MSAA has been enabled.\r\n */\r\n get: function () {\r\n return this._samples;\r\n },\r\n set: function (value) {\r\n if (this._samples === value) {\r\n return;\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._samples = scene.getEngine().updateRenderTargetTextureSampleCount(this._texture, value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Resets the refresh counter of the texture and start bak from scratch.\r\n * Could be useful to regenerate the texture if it is setup to render only once.\r\n */\r\n RenderTargetTexture.prototype.resetRefreshCounter = function () {\r\n this._currentRefreshId = -1;\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"refreshRate\", {\r\n /**\r\n * Define the refresh rate of the texture or the rendering frequency.\r\n * Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...\r\n */\r\n get: function () {\r\n return this._refreshRate;\r\n },\r\n set: function (value) {\r\n this._refreshRate = value;\r\n this.resetRefreshCounter();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Adds a post process to the render target rendering passes.\r\n * @param postProcess define the post process to add\r\n */\r\n RenderTargetTexture.prototype.addPostProcess = function (postProcess) {\r\n if (!this._postProcessManager) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._postProcessManager = new PostProcessManager(scene);\r\n this._postProcesses = new Array();\r\n }\r\n this._postProcesses.push(postProcess);\r\n this._postProcesses[0].autoClear = false;\r\n };\r\n /**\r\n * Clear all the post processes attached to the render target\r\n * @param dispose define if the cleared post processesshould also be disposed (false by default)\r\n */\r\n RenderTargetTexture.prototype.clearPostProcesses = function (dispose) {\r\n if (dispose === void 0) { dispose = false; }\r\n if (!this._postProcesses) {\r\n return;\r\n }\r\n if (dispose) {\r\n for (var _i = 0, _a = this._postProcesses; _i < _a.length; _i++) {\r\n var postProcess = _a[_i];\r\n postProcess.dispose();\r\n }\r\n }\r\n this._postProcesses = [];\r\n };\r\n /**\r\n * Remove one of the post process from the list of attached post processes to the texture\r\n * @param postProcess define the post process to remove from the list\r\n */\r\n RenderTargetTexture.prototype.removePostProcess = function (postProcess) {\r\n if (!this._postProcesses) {\r\n return;\r\n }\r\n var index = this._postProcesses.indexOf(postProcess);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._postProcesses.splice(index, 1);\r\n if (this._postProcesses.length > 0) {\r\n this._postProcesses[0].autoClear = false;\r\n }\r\n };\r\n /** @hidden */\r\n RenderTargetTexture.prototype._shouldRender = function () {\r\n if (this._currentRefreshId === -1) { // At least render once\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n if (this.refreshRate === this._currentRefreshId) {\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n this._currentRefreshId++;\r\n return false;\r\n };\r\n /**\r\n * Gets the actual render size of the texture.\r\n * @returns the width of the render size\r\n */\r\n RenderTargetTexture.prototype.getRenderSize = function () {\r\n return this.getRenderWidth();\r\n };\r\n /**\r\n * Gets the actual render width of the texture.\r\n * @returns the width of the render size\r\n */\r\n RenderTargetTexture.prototype.getRenderWidth = function () {\r\n if (this._size.width) {\r\n return this._size.width;\r\n }\r\n return this._size;\r\n };\r\n /**\r\n * Gets the actual render height of the texture.\r\n * @returns the height of the render size\r\n */\r\n RenderTargetTexture.prototype.getRenderHeight = function () {\r\n if (this._size.width) {\r\n return this._size.height;\r\n }\r\n return this._size;\r\n };\r\n /**\r\n * Gets the actual number of layers of the texture.\r\n * @returns the number of layers\r\n */\r\n RenderTargetTexture.prototype.getRenderLayers = function () {\r\n var layers = this._size.layers;\r\n if (layers) {\r\n return layers;\r\n }\r\n return 0;\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"canRescale\", {\r\n /**\r\n * Get if the texture can be rescaled or not.\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Resize the texture using a ratio.\r\n * @param ratio the ratio to apply to the texture size in order to compute the new target size\r\n */\r\n RenderTargetTexture.prototype.scale = function (ratio) {\r\n var newSize = Math.max(1, this.getRenderSize() * ratio);\r\n this.resize(newSize);\r\n };\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n RenderTargetTexture.prototype.getReflectionTextureMatrix = function () {\r\n if (this.isCube) {\r\n return this._textureMatrix;\r\n }\r\n return _super.prototype.getReflectionTextureMatrix.call(this);\r\n };\r\n /**\r\n * Resize the texture to a new desired size.\r\n * Be carrefull as it will recreate all the data in the new texture.\r\n * @param size Define the new size. It can be:\r\n * - a number for squared texture,\r\n * - an object containing { width: number, height: number }\r\n * - or an object containing a ratio { ratio: number }\r\n */\r\n RenderTargetTexture.prototype.resize = function (size) {\r\n var wasCube = this.isCube;\r\n this.releaseInternalTexture();\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._processSizeParameter(size);\r\n if (wasCube) {\r\n this._texture = scene.getEngine().createRenderTargetCubeTexture(this.getRenderSize(), this._renderTargetOptions);\r\n }\r\n else {\r\n this._texture = scene.getEngine().createRenderTargetTexture(this._size, this._renderTargetOptions);\r\n }\r\n if (this.onResizeObservable.hasObservers()) {\r\n this.onResizeObservable.notifyObservers(this);\r\n }\r\n };\r\n /**\r\n * Renders all the objects from the render list into the texture.\r\n * @param useCameraPostProcess Define if camera post processes should be used during the rendering\r\n * @param dumpForDebug Define if the rendering result should be dumped (copied) for debugging purpose\r\n */\r\n RenderTargetTexture.prototype.render = function (useCameraPostProcess, dumpForDebug) {\r\n if (useCameraPostProcess === void 0) { useCameraPostProcess = false; }\r\n if (dumpForDebug === void 0) { dumpForDebug = false; }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n if (this.useCameraPostProcesses !== undefined) {\r\n useCameraPostProcess = this.useCameraPostProcesses;\r\n }\r\n if (this._waitingRenderList) {\r\n this.renderList = [];\r\n for (var index = 0; index < this._waitingRenderList.length; index++) {\r\n var id = this._waitingRenderList[index];\r\n var mesh_1 = scene.getMeshByID(id);\r\n if (mesh_1) {\r\n this.renderList.push(mesh_1);\r\n }\r\n }\r\n this._waitingRenderList = undefined;\r\n }\r\n // Is predicate defined?\r\n if (this.renderListPredicate) {\r\n if (this.renderList) {\r\n this.renderList.length = 0; // Clear previous renderList\r\n }\r\n else {\r\n this.renderList = [];\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var sceneMeshes = scene.meshes;\r\n for (var index = 0; index < sceneMeshes.length; index++) {\r\n var mesh = sceneMeshes[index];\r\n if (this.renderListPredicate(mesh)) {\r\n this.renderList.push(mesh);\r\n }\r\n }\r\n }\r\n this.onBeforeBindObservable.notifyObservers(this);\r\n // Set custom projection.\r\n // Needs to be before binding to prevent changing the aspect ratio.\r\n var camera;\r\n if (this.activeCamera) {\r\n camera = this.activeCamera;\r\n engine.setViewport(this.activeCamera.viewport, this.getRenderWidth(), this.getRenderHeight());\r\n if (this.activeCamera !== scene.activeCamera) {\r\n scene.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(true));\r\n }\r\n }\r\n else {\r\n camera = scene.activeCamera;\r\n if (camera) {\r\n engine.setViewport(camera.viewport, this.getRenderWidth(), this.getRenderHeight());\r\n }\r\n }\r\n this._defaultRenderListPrepared = false;\r\n if (this.is2DArray) {\r\n for (var layer = 0; layer < this.getRenderLayers(); layer++) {\r\n this.renderToTarget(0, useCameraPostProcess, dumpForDebug, layer, camera);\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n }\r\n }\r\n else if (this.isCube) {\r\n for (var face = 0; face < 6; face++) {\r\n this.renderToTarget(face, useCameraPostProcess, dumpForDebug, undefined, camera);\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n }\r\n }\r\n else {\r\n this.renderToTarget(0, useCameraPostProcess, dumpForDebug, undefined, camera);\r\n }\r\n this.onAfterUnbindObservable.notifyObservers(this);\r\n if (scene.activeCamera) {\r\n // Do not avoid setting uniforms when multiple scenes are active as another camera may have overwrite these\r\n if (scene.getEngine().scenes.length > 1 || (this.activeCamera && this.activeCamera !== scene.activeCamera)) {\r\n scene.setTransformMatrix(scene.activeCamera.getViewMatrix(), scene.activeCamera.getProjectionMatrix(true));\r\n }\r\n engine.setViewport(scene.activeCamera.viewport);\r\n }\r\n scene.resetCachedMaterial();\r\n };\r\n RenderTargetTexture.prototype._bestReflectionRenderTargetDimension = function (renderDimension, scale) {\r\n var minimum = 128;\r\n var x = renderDimension * scale;\r\n var curved = Engine.NearestPOT(x + (minimum * minimum / (minimum + x)));\r\n // Ensure we don't exceed the render dimension (while staying POT)\r\n return Math.min(Engine.FloorPOT(renderDimension), curved);\r\n };\r\n RenderTargetTexture.prototype._prepareRenderingManager = function (currentRenderList, currentRenderListLength, camera, checkLayerMask) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._renderingManager.reset();\r\n var sceneRenderId = scene.getRenderId();\r\n for (var meshIndex = 0; meshIndex < currentRenderListLength; meshIndex++) {\r\n var mesh = currentRenderList[meshIndex];\r\n if (mesh && !mesh.isBlocked) {\r\n if (this.customIsReadyFunction) {\r\n if (!this.customIsReadyFunction(mesh, this.refreshRate)) {\r\n this.resetRefreshCounter();\r\n continue;\r\n }\r\n }\r\n else if (!mesh.isReady(this.refreshRate === 0)) {\r\n this.resetRefreshCounter();\r\n continue;\r\n }\r\n if (!mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate && scene.activeCamera) {\r\n mesh._internalAbstractMeshDataInfo._currentLOD = scene.customLODSelector ? scene.customLODSelector(mesh, scene.activeCamera) : mesh.getLOD(scene.activeCamera);\r\n mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate = true;\r\n }\r\n if (!mesh._internalAbstractMeshDataInfo._currentLOD) {\r\n continue;\r\n }\r\n var meshToRender = mesh._internalAbstractMeshDataInfo._currentLOD;\r\n meshToRender._preActivateForIntermediateRendering(sceneRenderId);\r\n var isMasked = void 0;\r\n if (checkLayerMask && camera) {\r\n isMasked = ((mesh.layerMask & camera.layerMask) === 0);\r\n }\r\n else {\r\n isMasked = false;\r\n }\r\n if (mesh.isEnabled() && mesh.isVisible && mesh.subMeshes && !isMasked) {\r\n if (meshToRender !== mesh) {\r\n meshToRender._activate(sceneRenderId, true);\r\n }\r\n if (mesh._activate(sceneRenderId, true) && mesh.subMeshes.length) {\r\n if (!mesh.isAnInstance) {\r\n meshToRender._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = false;\r\n }\r\n else {\r\n if (mesh._internalAbstractMeshDataInfo._actAsRegularMesh) {\r\n meshToRender = mesh;\r\n }\r\n }\r\n meshToRender._internalAbstractMeshDataInfo._isActiveIntermediate = true;\r\n for (var subIndex = 0; subIndex < meshToRender.subMeshes.length; subIndex++) {\r\n var subMesh = meshToRender.subMeshes[subIndex];\r\n this._renderingManager.dispatch(subMesh, meshToRender);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n for (var particleIndex = 0; particleIndex < scene.particleSystems.length; particleIndex++) {\r\n var particleSystem = scene.particleSystems[particleIndex];\r\n var emitter = particleSystem.emitter;\r\n if (!particleSystem.isStarted() || !emitter || !emitter.position || !emitter.isEnabled()) {\r\n continue;\r\n }\r\n if (currentRenderList.indexOf(emitter) >= 0) {\r\n this._renderingManager.dispatchParticles(particleSystem);\r\n }\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * @param faceIndex face index to bind to if this is a cubetexture\r\n * @param layer defines the index of the texture to bind in the array\r\n */\r\n RenderTargetTexture.prototype._bindFrameBuffer = function (faceIndex, layer) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (layer === void 0) { layer = 0; }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n if (this._texture) {\r\n engine.bindFramebuffer(this._texture, this.isCube ? faceIndex : undefined, undefined, undefined, this.ignoreCameraViewport, 0, layer);\r\n }\r\n };\r\n RenderTargetTexture.prototype.unbindFrameBuffer = function (engine, faceIndex) {\r\n var _this = this;\r\n if (!this._texture) {\r\n return;\r\n }\r\n engine.unBindFramebuffer(this._texture, this.isCube, function () {\r\n _this.onAfterRenderObservable.notifyObservers(faceIndex);\r\n });\r\n };\r\n RenderTargetTexture.prototype.renderToTarget = function (faceIndex, useCameraPostProcess, dumpForDebug, layer, camera) {\r\n if (layer === void 0) { layer = 0; }\r\n if (camera === void 0) { camera = null; }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n if (!this._texture) {\r\n return;\r\n }\r\n // Bind\r\n if (this._postProcessManager) {\r\n this._postProcessManager._prepareFrame(this._texture, this._postProcesses);\r\n }\r\n else if (!useCameraPostProcess || !scene.postProcessManager._prepareFrame(this._texture)) {\r\n this._bindFrameBuffer(faceIndex, layer);\r\n }\r\n if (this.is2DArray) {\r\n this.onBeforeRenderObservable.notifyObservers(layer);\r\n }\r\n else {\r\n this.onBeforeRenderObservable.notifyObservers(faceIndex);\r\n }\r\n // Get the list of meshes to render\r\n var currentRenderList = null;\r\n var defaultRenderList = this.renderList ? this.renderList : scene.getActiveMeshes().data;\r\n var defaultRenderListLength = this.renderList ? this.renderList.length : scene.getActiveMeshes().length;\r\n if (this.getCustomRenderList) {\r\n currentRenderList = this.getCustomRenderList(this.is2DArray ? layer : faceIndex, defaultRenderList, defaultRenderListLength);\r\n }\r\n if (!currentRenderList) {\r\n // No custom render list provided, we prepare the rendering for the default list, but check\r\n // first if we did not already performed the preparation before so as to avoid re-doing it several times\r\n if (!this._defaultRenderListPrepared) {\r\n this._prepareRenderingManager(defaultRenderList, defaultRenderListLength, camera, !this.renderList);\r\n this._defaultRenderListPrepared = true;\r\n }\r\n currentRenderList = defaultRenderList;\r\n }\r\n else {\r\n // Prepare the rendering for the custom render list provided\r\n this._prepareRenderingManager(currentRenderList, currentRenderList.length, camera, false);\r\n }\r\n // Clear\r\n if (this.onClearObservable.hasObservers()) {\r\n this.onClearObservable.notifyObservers(engine);\r\n }\r\n else {\r\n engine.clear(this.clearColor || scene.clearColor, true, true, true);\r\n }\r\n if (!this._doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n // Before Camera Draw\r\n for (var _i = 0, _a = scene._beforeRenderTargetDrawStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(this);\r\n }\r\n // Render\r\n this._renderingManager.render(this.customRenderFunction, currentRenderList, this.renderParticles, this.renderSprites);\r\n // After Camera Draw\r\n for (var _b = 0, _c = scene._afterRenderTargetDrawStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action(this);\r\n }\r\n if (this._postProcessManager) {\r\n this._postProcessManager._finalizeFrame(false, this._texture, faceIndex, this._postProcesses, this.ignoreCameraViewport);\r\n }\r\n else if (useCameraPostProcess) {\r\n scene.postProcessManager._finalizeFrame(false, this._texture, faceIndex);\r\n }\r\n if (!this._doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n // Dump ?\r\n if (dumpForDebug) {\r\n Tools.DumpFramebuffer(this.getRenderWidth(), this.getRenderHeight(), engine);\r\n }\r\n // Unbind\r\n if (!this.isCube || faceIndex === 5) {\r\n if (this.isCube) {\r\n if (faceIndex === 5) {\r\n engine.generateMipMapsForCubemap(this._texture);\r\n }\r\n }\r\n this.unbindFrameBuffer(engine, faceIndex);\r\n }\r\n else {\r\n this.onAfterRenderObservable.notifyObservers(faceIndex);\r\n }\r\n };\r\n /**\r\n * Overrides the default sort function applied in the renderging group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversly depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n RenderTargetTexture.prototype.setRenderingOrder = function (renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);\r\n };\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n */\r\n RenderTargetTexture.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil) {\r\n this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil);\r\n this._renderingManager._useSceneAutoClearSetup = false;\r\n };\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n RenderTargetTexture.prototype.clone = function () {\r\n var textureSize = this.getSize();\r\n var newTexture = new RenderTargetTexture(this.name, textureSize, this.getScene(), this._renderTargetOptions.generateMipMaps, this._doNotChangeAspectRatio, this._renderTargetOptions.type, this.isCube, this._renderTargetOptions.samplingMode, this._renderTargetOptions.generateDepthBuffer, this._renderTargetOptions.generateStencilBuffer);\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n // RenderTarget Texture\r\n newTexture.coordinatesMode = this.coordinatesMode;\r\n if (this.renderList) {\r\n newTexture.renderList = this.renderList.slice(0);\r\n }\r\n return newTexture;\r\n };\r\n /**\r\n * Serialize the texture to a JSON representation we can easily use in the resepective Parse function.\r\n * @returns The JSON representation of the texture\r\n */\r\n RenderTargetTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.renderTargetSize = this.getRenderSize();\r\n serializationObject.renderList = [];\r\n if (this.renderList) {\r\n for (var index = 0; index < this.renderList.length; index++) {\r\n serializationObject.renderList.push(this.renderList[index].id);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * This will remove the attached framebuffer objects. The texture will not be able to be used as render target anymore\r\n */\r\n RenderTargetTexture.prototype.disposeFramebufferObjects = function () {\r\n var objBuffer = this.getInternalTexture();\r\n var scene = this.getScene();\r\n if (objBuffer && scene) {\r\n scene.getEngine()._releaseFramebufferObjects(objBuffer);\r\n }\r\n };\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n RenderTargetTexture.prototype.dispose = function () {\r\n this.onResizeObservable.clear();\r\n this.onClearObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onAfterUnbindObservable.clear();\r\n this.onBeforeBindObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n if (this._postProcessManager) {\r\n this._postProcessManager.dispose();\r\n this._postProcessManager = null;\r\n }\r\n this.clearPostProcesses(true);\r\n if (this._resizeObserver) {\r\n this.getScene().getEngine().onResizeObservable.remove(this._resizeObserver);\r\n this._resizeObserver = null;\r\n }\r\n this.renderList = null;\r\n // Remove from custom render targets\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var index = scene.customRenderTargets.indexOf(this);\r\n if (index >= 0) {\r\n scene.customRenderTargets.splice(index, 1);\r\n }\r\n for (var _i = 0, _a = scene.cameras; _i < _a.length; _i++) {\r\n var camera = _a[_i];\r\n index = camera.customRenderTargets.indexOf(this);\r\n if (index >= 0) {\r\n camera.customRenderTargets.splice(index, 1);\r\n }\r\n }\r\n if (this.depthStencilTexture) {\r\n this.getScene().getEngine()._releaseTexture(this.depthStencilTexture);\r\n }\r\n _super.prototype.dispose.call(this);\r\n };\r\n /** @hidden */\r\n RenderTargetTexture.prototype._rebuild = function () {\r\n if (this.refreshRate === RenderTargetTexture.REFRESHRATE_RENDER_ONCE) {\r\n this.refreshRate = RenderTargetTexture.REFRESHRATE_RENDER_ONCE;\r\n }\r\n if (this._postProcessManager) {\r\n this._postProcessManager._rebuild();\r\n }\r\n };\r\n /**\r\n * Clear the info related to rendering groups preventing retention point in material dispose.\r\n */\r\n RenderTargetTexture.prototype.freeRenderingGroups = function () {\r\n if (this._renderingManager) {\r\n this._renderingManager.freeRenderingGroups();\r\n }\r\n };\r\n /**\r\n * Gets the number of views the corresponding to the texture (eg. a MultiviewRenderTarget will have > 1)\r\n * @returns the view count\r\n */\r\n RenderTargetTexture.prototype.getViewCount = function () {\r\n return 1;\r\n };\r\n /**\r\n * The texture will only be rendered once which can be useful to improve performance if everything in your render is static for instance.\r\n */\r\n RenderTargetTexture.REFRESHRATE_RENDER_ONCE = 0;\r\n /**\r\n * The texture will only be rendered rendered every frame and is recomended for dynamic contents.\r\n */\r\n RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME = 1;\r\n /**\r\n * The texture will be rendered every 2 frames which could be enough if your dynamic objects are not\r\n * the central point of your effect and can save a lot of performances.\r\n */\r\n RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYTWOFRAMES = 2;\r\n return RenderTargetTexture;\r\n}(Texture));\r\nexport { RenderTargetTexture };\r\nTexture._CreateRenderTargetTexture = function (name, renderTargetSize, scene, generateMipMaps) {\r\n return new RenderTargetTexture(name, renderTargetSize, scene, generateMipMaps);\r\n};\r\n//# sourceMappingURL=renderTargetTexture.js.map","/**\r\n * Class used to host copy specific utilities\r\n */\r\nvar CopyTools = /** @class */ (function () {\r\n function CopyTools() {\r\n }\r\n /**\r\n * Reads the pixels stored in the webgl texture and returns them as a base64 string\r\n * @param texture defines the texture to read pixels from\r\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\r\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\r\n * @returns The base64 encoded string or null\r\n */\r\n CopyTools.GenerateBase64StringFromTexture = function (texture, faceIndex, level) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (level === void 0) { level = 0; }\r\n var internalTexture = texture.getInternalTexture();\r\n if (!internalTexture) {\r\n return null;\r\n }\r\n var pixels = texture.readPixels(faceIndex, level);\r\n if (!pixels) {\r\n return null;\r\n }\r\n var size = texture.getSize();\r\n var width = size.width;\r\n var height = size.height;\r\n if (pixels instanceof Float32Array) {\r\n var len = pixels.byteLength / pixels.BYTES_PER_ELEMENT;\r\n var npixels = new Uint8Array(len);\r\n while (--len >= 0) {\r\n var val = pixels[len];\r\n if (val < 0) {\r\n val = 0;\r\n }\r\n else if (val > 1) {\r\n val = 1;\r\n }\r\n npixels[len] = val * 255;\r\n }\r\n pixels = npixels;\r\n }\r\n var canvas = document.createElement('canvas');\r\n canvas.width = width;\r\n canvas.height = height;\r\n var ctx = canvas.getContext('2d');\r\n if (!ctx) {\r\n return null;\r\n }\r\n var imageData = ctx.createImageData(width, height);\r\n var castData = imageData.data;\r\n castData.set(pixels);\r\n ctx.putImageData(imageData, 0, 0);\r\n if (internalTexture.invertY) {\r\n var canvas2 = document.createElement('canvas');\r\n canvas2.width = width;\r\n canvas2.height = height;\r\n var ctx2 = canvas2.getContext('2d');\r\n if (!ctx2) {\r\n return null;\r\n }\r\n ctx2.translate(0, height);\r\n ctx2.scale(1, -1);\r\n ctx2.drawImage(canvas, 0, 0);\r\n return canvas2.toDataURL('image/png');\r\n }\r\n return canvas.toDataURL('image/png');\r\n };\r\n return CopyTools;\r\n}());\r\nexport { CopyTools };\r\n//# sourceMappingURL=copyTools.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, SerializationHelper } from \"../../Misc/decorators\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { _TypeStore } from '../../Misc/typeStore';\r\nimport { _DevTools } from '../../Misc/devTools';\r\nimport { TimingTools } from '../../Misc/timingTools';\r\nimport { InstantiationTools } from '../../Misc/instantiationTools';\r\nimport { Plane } from '../../Maths/math.plane';\r\nimport { StringTools } from '../../Misc/stringTools';\r\nimport { CopyTools } from '../../Misc/copyTools';\r\n/**\r\n * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.\r\n * @see https://doc.babylonjs.com/babylon101/materials#texture\r\n */\r\nvar Texture = /** @class */ (function (_super) {\r\n __extends(Texture, _super);\r\n /**\r\n * Instantiates a new texture.\r\n * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.\r\n * @see https://doc.babylonjs.com/babylon101/materials#texture\r\n * @param url defines the url of the picture to load as a texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param noMipmap defines if the texture will require mip maps or not\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode defines the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad defines a callback triggered when the texture has been loaded\r\n * @param onError defines a callback triggered when an error occurred during the loading session\r\n * @param buffer defines the buffer to load the texture from in case the texture is loaded from a buffer representation\r\n * @param deleteBuffer defines if the buffer we are loading the texture from should be deleted after load\r\n * @param format defines the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @param mimeType defines an optional mime type information\r\n * @param loaderOptions options to be passed to the loader\r\n */\r\n function Texture(url, sceneOrEngine, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer, format, mimeType, loaderOptions) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (invertY === void 0) { invertY = true; }\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (deleteBuffer === void 0) { deleteBuffer = false; }\r\n var _this = _super.call(this, sceneOrEngine) || this;\r\n /**\r\n * Define the url of the texture.\r\n */\r\n _this.url = null;\r\n /**\r\n * Define an offset on the texture to offset the u coordinates of the UVs\r\n * @see https://doc.babylonjs.com/how_to/more_materials#offsetting\r\n */\r\n _this.uOffset = 0;\r\n /**\r\n * Define an offset on the texture to offset the v coordinates of the UVs\r\n * @see https://doc.babylonjs.com/how_to/more_materials#offsetting\r\n */\r\n _this.vOffset = 0;\r\n /**\r\n * Define an offset on the texture to scale the u coordinates of the UVs\r\n * @see https://doc.babylonjs.com/how_to/more_materials#tiling\r\n */\r\n _this.uScale = 1.0;\r\n /**\r\n * Define an offset on the texture to scale the v coordinates of the UVs\r\n * @see https://doc.babylonjs.com/how_to/more_materials#tiling\r\n */\r\n _this.vScale = 1.0;\r\n /**\r\n * Define an offset on the texture to rotate around the u coordinates of the UVs\r\n * @see https://doc.babylonjs.com/how_to/more_materials\r\n */\r\n _this.uAng = 0;\r\n /**\r\n * Define an offset on the texture to rotate around the v coordinates of the UVs\r\n * @see https://doc.babylonjs.com/how_to/more_materials\r\n */\r\n _this.vAng = 0;\r\n /**\r\n * Define an offset on the texture to rotate around the w coordinates of the UVs (in case of 3d texture)\r\n * @see https://doc.babylonjs.com/how_to/more_materials\r\n */\r\n _this.wAng = 0;\r\n /**\r\n * Defines the center of rotation (U)\r\n */\r\n _this.uRotationCenter = 0.5;\r\n /**\r\n * Defines the center of rotation (V)\r\n */\r\n _this.vRotationCenter = 0.5;\r\n /**\r\n * Defines the center of rotation (W)\r\n */\r\n _this.wRotationCenter = 0.5;\r\n /**\r\n * Sets this property to true to avoid deformations when rotating the texture with non-uniform scaling\r\n */\r\n _this.homogeneousRotationInUVTransform = false;\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility\r\n */\r\n _this.inspectableCustomProperties = null;\r\n _this._noMipmap = false;\r\n /** @hidden */\r\n _this._invertY = false;\r\n _this._rowGenerationMatrix = null;\r\n _this._cachedTextureMatrix = null;\r\n _this._projectionModeMatrix = null;\r\n _this._t0 = null;\r\n _this._t1 = null;\r\n _this._t2 = null;\r\n _this._cachedUOffset = -1;\r\n _this._cachedVOffset = -1;\r\n _this._cachedUScale = 0;\r\n _this._cachedVScale = 0;\r\n _this._cachedUAng = -1;\r\n _this._cachedVAng = -1;\r\n _this._cachedWAng = -1;\r\n _this._cachedProjectionMatrixId = -1;\r\n _this._cachedURotationCenter = -1;\r\n _this._cachedVRotationCenter = -1;\r\n _this._cachedWRotationCenter = -1;\r\n _this._cachedHomogeneousRotationInUVTransform = false;\r\n _this._cachedCoordinatesMode = -1;\r\n /** @hidden */\r\n _this._initialSamplingMode = Texture.BILINEAR_SAMPLINGMODE;\r\n /** @hidden */\r\n _this._buffer = null;\r\n _this._deleteBuffer = false;\r\n _this._format = null;\r\n _this._delayedOnLoad = null;\r\n _this._delayedOnError = null;\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n _this.onLoadObservable = new Observable();\r\n _this._isBlocking = true;\r\n _this.name = url || \"\";\r\n _this.url = url;\r\n _this._noMipmap = noMipmap;\r\n _this._invertY = invertY;\r\n _this._initialSamplingMode = samplingMode;\r\n _this._buffer = buffer;\r\n _this._deleteBuffer = deleteBuffer;\r\n _this._mimeType = mimeType;\r\n _this._loaderOptions = loaderOptions;\r\n if (format) {\r\n _this._format = format;\r\n }\r\n var scene = _this.getScene();\r\n var engine = _this._getEngine();\r\n if (!engine) {\r\n return _this;\r\n }\r\n engine.onBeforeTextureInitObservable.notifyObservers(_this);\r\n var load = function () {\r\n if (_this._texture) {\r\n if (_this._texture._invertVScale) {\r\n _this.vScale *= -1;\r\n _this.vOffset += 1;\r\n }\r\n // Update texutre to match internal texture's wrapping\r\n if (_this._texture._cachedWrapU !== null) {\r\n _this.wrapU = _this._texture._cachedWrapU;\r\n _this._texture._cachedWrapU = null;\r\n }\r\n if (_this._texture._cachedWrapV !== null) {\r\n _this.wrapV = _this._texture._cachedWrapV;\r\n _this._texture._cachedWrapV = null;\r\n }\r\n if (_this._texture._cachedWrapR !== null) {\r\n _this.wrapR = _this._texture._cachedWrapR;\r\n _this._texture._cachedWrapR = null;\r\n }\r\n }\r\n if (_this.onLoadObservable.hasObservers()) {\r\n _this.onLoadObservable.notifyObservers(_this);\r\n }\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n if (!_this.isBlocking && scene) {\r\n scene.resetCachedMaterial();\r\n }\r\n };\r\n if (!_this.url) {\r\n _this._delayedOnLoad = load;\r\n _this._delayedOnError = onError;\r\n return _this;\r\n }\r\n _this._texture = _this._getFromCache(_this.url, noMipmap, samplingMode, invertY);\r\n if (!_this._texture) {\r\n if (!scene || !scene.useDelayedTextureLoading) {\r\n _this._texture = engine.createTexture(_this.url, noMipmap, invertY, scene, samplingMode, load, onError, _this._buffer, undefined, _this._format, null, mimeType, loaderOptions);\r\n if (deleteBuffer) {\r\n _this._buffer = null;\r\n }\r\n }\r\n else {\r\n _this.delayLoadState = 4;\r\n _this._delayedOnLoad = load;\r\n _this._delayedOnError = onError;\r\n }\r\n }\r\n else {\r\n if (_this._texture.isReady) {\r\n TimingTools.SetImmediate(function () { return load(); });\r\n }\r\n else {\r\n _this._texture.onLoadedObservable.add(load);\r\n }\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(Texture.prototype, \"noMipmap\", {\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n get: function () {\r\n return this._noMipmap;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Texture.prototype, \"mimeType\", {\r\n /** Returns the texture mime type if it was defined by a loader (undefined else) */\r\n get: function () {\r\n return this._mimeType;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Texture.prototype, \"isBlocking\", {\r\n get: function () {\r\n return this._isBlocking;\r\n },\r\n /**\r\n * Is the texture preventing material to render while loading.\r\n * If false, a default texture will be used instead of the loading one during the preparation step.\r\n */\r\n set: function (value) {\r\n this._isBlocking = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Texture.prototype, \"samplingMode\", {\r\n /**\r\n * Get the current sampling mode associated with the texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return this._initialSamplingMode;\r\n }\r\n return this._texture.samplingMode;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Texture.prototype, \"invertY\", {\r\n /**\r\n * Gets a boolean indicating if the texture needs to be inverted on the y axis during loading\r\n */\r\n get: function () {\r\n return this._invertY;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Update the url (and optional buffer) of this texture if url was null during construction.\r\n * @param url the url of the texture\r\n * @param buffer the buffer of the texture (defaults to null)\r\n * @param onLoad callback called when the texture is loaded (defaults to null)\r\n */\r\n Texture.prototype.updateURL = function (url, buffer, onLoad) {\r\n if (buffer === void 0) { buffer = null; }\r\n if (this.url) {\r\n this.releaseInternalTexture();\r\n this.getScene().markAllMaterialsAsDirty(1);\r\n }\r\n if (!this.name || StringTools.StartsWith(this.name, \"data:\")) {\r\n this.name = url;\r\n }\r\n this.url = url;\r\n this._buffer = buffer;\r\n this.delayLoadState = 4;\r\n if (onLoad) {\r\n this._delayedOnLoad = onLoad;\r\n }\r\n this.delayLoad();\r\n };\r\n /**\r\n * Finish the loading sequence of a texture flagged as delayed load.\r\n * @hidden\r\n */\r\n Texture.prototype.delayLoad = function () {\r\n if (this.delayLoadState !== 4) {\r\n return;\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this.delayLoadState = 1;\r\n this._texture = this._getFromCache(this.url, this._noMipmap, this.samplingMode, this._invertY);\r\n if (!this._texture) {\r\n this._texture = scene.getEngine().createTexture(this.url, this._noMipmap, this._invertY, scene, this.samplingMode, this._delayedOnLoad, this._delayedOnError, this._buffer, null, this._format, null, this._mimeType, this._loaderOptions);\r\n if (this._deleteBuffer) {\r\n this._buffer = null;\r\n }\r\n }\r\n else {\r\n if (this._delayedOnLoad) {\r\n if (this._texture.isReady) {\r\n TimingTools.SetImmediate(this._delayedOnLoad);\r\n }\r\n else {\r\n this._texture.onLoadedObservable.add(this._delayedOnLoad);\r\n }\r\n }\r\n }\r\n this._delayedOnLoad = null;\r\n this._delayedOnError = null;\r\n };\r\n Texture.prototype._prepareRowForTextureGeneration = function (x, y, z, t) {\r\n x *= this._cachedUScale;\r\n y *= this._cachedVScale;\r\n x -= this.uRotationCenter * this._cachedUScale;\r\n y -= this.vRotationCenter * this._cachedVScale;\r\n z -= this.wRotationCenter;\r\n Vector3.TransformCoordinatesFromFloatsToRef(x, y, z, this._rowGenerationMatrix, t);\r\n t.x += this.uRotationCenter * this._cachedUScale + this._cachedUOffset;\r\n t.y += this.vRotationCenter * this._cachedVScale + this._cachedVOffset;\r\n t.z += this.wRotationCenter;\r\n };\r\n /**\r\n * Checks if the texture has the same transform matrix than another texture\r\n * @param texture texture to check against\r\n * @returns true if the transforms are the same, else false\r\n */\r\n Texture.prototype.checkTransformsAreIdentical = function (texture) {\r\n return texture !== null &&\r\n this.uOffset === texture.uOffset &&\r\n this.vOffset === texture.vOffset &&\r\n this.uScale === texture.uScale &&\r\n this.vScale === texture.vScale &&\r\n this.uAng === texture.uAng &&\r\n this.vAng === texture.vAng &&\r\n this.wAng === texture.wAng;\r\n };\r\n /**\r\n * Get the current texture matrix which includes the requested offsetting, tiling and rotation components.\r\n * @returns the transform matrix of the texture.\r\n */\r\n Texture.prototype.getTextureMatrix = function (uBase) {\r\n var _this = this;\r\n if (uBase === void 0) { uBase = 1; }\r\n if (this.uOffset === this._cachedUOffset &&\r\n this.vOffset === this._cachedVOffset &&\r\n this.uScale * uBase === this._cachedUScale &&\r\n this.vScale === this._cachedVScale &&\r\n this.uAng === this._cachedUAng &&\r\n this.vAng === this._cachedVAng &&\r\n this.wAng === this._cachedWAng &&\r\n this.uRotationCenter === this._cachedURotationCenter &&\r\n this.vRotationCenter === this._cachedVRotationCenter &&\r\n this.wRotationCenter === this._cachedWRotationCenter &&\r\n this.homogeneousRotationInUVTransform === this._cachedHomogeneousRotationInUVTransform) {\r\n return this._cachedTextureMatrix;\r\n }\r\n this._cachedUOffset = this.uOffset;\r\n this._cachedVOffset = this.vOffset;\r\n this._cachedUScale = this.uScale * uBase;\r\n this._cachedVScale = this.vScale;\r\n this._cachedUAng = this.uAng;\r\n this._cachedVAng = this.vAng;\r\n this._cachedWAng = this.wAng;\r\n this._cachedURotationCenter = this.uRotationCenter;\r\n this._cachedVRotationCenter = this.vRotationCenter;\r\n this._cachedWRotationCenter = this.wRotationCenter;\r\n this._cachedHomogeneousRotationInUVTransform = this.homogeneousRotationInUVTransform;\r\n if (!this._cachedTextureMatrix || !this._rowGenerationMatrix) {\r\n this._cachedTextureMatrix = Matrix.Zero();\r\n this._rowGenerationMatrix = new Matrix();\r\n this._t0 = Vector3.Zero();\r\n this._t1 = Vector3.Zero();\r\n this._t2 = Vector3.Zero();\r\n }\r\n Matrix.RotationYawPitchRollToRef(this.vAng, this.uAng, this.wAng, this._rowGenerationMatrix);\r\n if (this.homogeneousRotationInUVTransform) {\r\n Matrix.TranslationToRef(-this._cachedURotationCenter, -this._cachedVRotationCenter, -this._cachedWRotationCenter, TmpVectors.Matrix[0]);\r\n Matrix.TranslationToRef(this._cachedURotationCenter, this._cachedVRotationCenter, this._cachedWRotationCenter, TmpVectors.Matrix[1]);\r\n Matrix.ScalingToRef(this._cachedUScale, this._cachedVScale, 0, TmpVectors.Matrix[2]);\r\n Matrix.TranslationToRef(this._cachedUOffset, this._cachedVOffset, 0, TmpVectors.Matrix[3]);\r\n TmpVectors.Matrix[0].multiplyToRef(this._rowGenerationMatrix, this._cachedTextureMatrix);\r\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[1], this._cachedTextureMatrix);\r\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[2], this._cachedTextureMatrix);\r\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[3], this._cachedTextureMatrix);\r\n // copy the translation row to the 3rd row of the matrix so that we don't need to update the shaders (which expects the translation to be on the 3rd row)\r\n this._cachedTextureMatrix.setRowFromFloats(2, this._cachedTextureMatrix.m[12], this._cachedTextureMatrix.m[13], this._cachedTextureMatrix.m[14], 1);\r\n }\r\n else {\r\n this._prepareRowForTextureGeneration(0, 0, 0, this._t0);\r\n this._prepareRowForTextureGeneration(1.0, 0, 0, this._t1);\r\n this._prepareRowForTextureGeneration(0, 1.0, 0, this._t2);\r\n this._t1.subtractInPlace(this._t0);\r\n this._t2.subtractInPlace(this._t0);\r\n Matrix.FromValuesToRef(this._t1.x, this._t1.y, this._t1.z, 0.0, this._t2.x, this._t2.y, this._t2.z, 0.0, this._t0.x, this._t0.y, this._t0.z, 0.0, 0.0, 0.0, 0.0, 1.0, this._cachedTextureMatrix);\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this._cachedTextureMatrix;\r\n }\r\n scene.markAllMaterialsAsDirty(1, function (mat) {\r\n return mat.hasTexture(_this);\r\n });\r\n return this._cachedTextureMatrix;\r\n };\r\n /**\r\n * Get the current matrix used to apply reflection. This is useful to rotate an environment texture for instance.\r\n * @returns The reflection texture transform\r\n */\r\n Texture.prototype.getReflectionTextureMatrix = function () {\r\n var _this = this;\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this._cachedTextureMatrix;\r\n }\r\n if (this.uOffset === this._cachedUOffset &&\r\n this.vOffset === this._cachedVOffset &&\r\n this.uScale === this._cachedUScale &&\r\n this.vScale === this._cachedVScale &&\r\n this.coordinatesMode === this._cachedCoordinatesMode) {\r\n if (this.coordinatesMode === Texture.PROJECTION_MODE) {\r\n if (this._cachedProjectionMatrixId === scene.getProjectionMatrix().updateFlag) {\r\n return this._cachedTextureMatrix;\r\n }\r\n }\r\n else {\r\n return this._cachedTextureMatrix;\r\n }\r\n }\r\n if (!this._cachedTextureMatrix) {\r\n this._cachedTextureMatrix = Matrix.Zero();\r\n }\r\n if (!this._projectionModeMatrix) {\r\n this._projectionModeMatrix = Matrix.Zero();\r\n }\r\n this._cachedUOffset = this.uOffset;\r\n this._cachedVOffset = this.vOffset;\r\n this._cachedUScale = this.uScale;\r\n this._cachedVScale = this.vScale;\r\n this._cachedCoordinatesMode = this.coordinatesMode;\r\n switch (this.coordinatesMode) {\r\n case Texture.PLANAR_MODE:\r\n Matrix.IdentityToRef(this._cachedTextureMatrix);\r\n this._cachedTextureMatrix[0] = this.uScale;\r\n this._cachedTextureMatrix[5] = this.vScale;\r\n this._cachedTextureMatrix[12] = this.uOffset;\r\n this._cachedTextureMatrix[13] = this.vOffset;\r\n break;\r\n case Texture.PROJECTION_MODE:\r\n Matrix.FromValuesToRef(0.5, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 1.0, 1.0, this._projectionModeMatrix);\r\n var projectionMatrix = scene.getProjectionMatrix();\r\n this._cachedProjectionMatrixId = projectionMatrix.updateFlag;\r\n projectionMatrix.multiplyToRef(this._projectionModeMatrix, this._cachedTextureMatrix);\r\n break;\r\n default:\r\n Matrix.IdentityToRef(this._cachedTextureMatrix);\r\n break;\r\n }\r\n scene.markAllMaterialsAsDirty(1, function (mat) {\r\n return (mat.getActiveTextures().indexOf(_this) !== -1);\r\n });\r\n return this._cachedTextureMatrix;\r\n };\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n Texture.prototype.clone = function () {\r\n var _this = this;\r\n return SerializationHelper.Clone(function () {\r\n return new Texture(_this._texture ? _this._texture.url : null, _this.getScene(), _this._noMipmap, _this._invertY, _this.samplingMode, undefined, undefined, _this._texture ? _this._texture._buffer : undefined);\r\n }, this);\r\n };\r\n /**\r\n * Serialize the texture to a JSON representation we can easily use in the resepective Parse function.\r\n * @returns The JSON representation of the texture\r\n */\r\n Texture.prototype.serialize = function () {\r\n var savedName = this.name;\r\n if (!Texture.SerializeBuffers) {\r\n if (StringTools.StartsWith(this.name, \"data:\")) {\r\n this.name = \"\";\r\n }\r\n }\r\n if (StringTools.StartsWith(this.name, \"data:\") && this.url === this.name) {\r\n this.url = \"\";\r\n }\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n if (!serializationObject) {\r\n return null;\r\n }\r\n if (Texture.SerializeBuffers || Texture.ForceSerializeBuffers) {\r\n if (typeof this._buffer === \"string\" && this._buffer.substr(0, 5) === \"data:\") {\r\n serializationObject.base64String = this._buffer;\r\n serializationObject.name = serializationObject.name.replace(\"data:\", \"\");\r\n }\r\n else if (this.url && StringTools.StartsWith(this.url, \"data:\") && this._buffer instanceof Uint8Array) {\r\n serializationObject.base64String = \"data:image/png;base64,\" + StringTools.EncodeArrayBufferToBase64(this._buffer);\r\n }\r\n else if (Texture.ForceSerializeBuffers) {\r\n serializationObject.base64String = CopyTools.GenerateBase64StringFromTexture(this);\r\n }\r\n }\r\n serializationObject.invertY = this._invertY;\r\n serializationObject.samplingMode = this.samplingMode;\r\n this.name = savedName;\r\n return serializationObject;\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"Texture\"\r\n */\r\n Texture.prototype.getClassName = function () {\r\n return \"Texture\";\r\n };\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n Texture.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onLoadObservable.clear();\r\n this._delayedOnLoad = null;\r\n this._delayedOnError = null;\r\n };\r\n /**\r\n * Parse the JSON representation of a texture in order to recreate the texture in the given scene.\r\n * @param parsedTexture Define the JSON representation of the texture\r\n * @param scene Define the scene the parsed texture should be instantiated in\r\n * @param rootUrl Define the root url of the parsing sequence in the case of relative dependencies\r\n * @returns The parsed texture if successful\r\n */\r\n Texture.Parse = function (parsedTexture, scene, rootUrl) {\r\n if (parsedTexture.customType) {\r\n var customTexture = InstantiationTools.Instantiate(parsedTexture.customType);\r\n // Update Sampling Mode\r\n var parsedCustomTexture = customTexture.Parse(parsedTexture, scene, rootUrl);\r\n if (parsedTexture.samplingMode && parsedCustomTexture.updateSamplingMode && parsedCustomTexture._samplingMode) {\r\n if (parsedCustomTexture._samplingMode !== parsedTexture.samplingMode) {\r\n parsedCustomTexture.updateSamplingMode(parsedTexture.samplingMode);\r\n }\r\n }\r\n return parsedCustomTexture;\r\n }\r\n if (parsedTexture.isCube && !parsedTexture.isRenderTarget) {\r\n return Texture._CubeTextureParser(parsedTexture, scene, rootUrl);\r\n }\r\n if (!parsedTexture.name && !parsedTexture.isRenderTarget) {\r\n return null;\r\n }\r\n var onLoaded = function () {\r\n // Clear cache\r\n if (texture && texture._texture) {\r\n texture._texture._cachedWrapU = null;\r\n texture._texture._cachedWrapV = null;\r\n texture._texture._cachedWrapR = null;\r\n }\r\n // Update Sampling Mode\r\n if (parsedTexture.samplingMode) {\r\n var sampling = parsedTexture.samplingMode;\r\n if (texture && texture.samplingMode !== sampling) {\r\n texture.updateSamplingMode(sampling);\r\n }\r\n }\r\n // Animations\r\n if (texture && parsedTexture.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedTexture.animations[animationIndex];\r\n var internalClass = _TypeStore.GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n texture.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n };\r\n var texture = SerializationHelper.Parse(function () {\r\n var generateMipMaps = true;\r\n if (parsedTexture.noMipmap) {\r\n generateMipMaps = false;\r\n }\r\n if (parsedTexture.mirrorPlane) {\r\n var mirrorTexture = Texture._CreateMirror(parsedTexture.name, parsedTexture.renderTargetSize, scene, generateMipMaps);\r\n mirrorTexture._waitingRenderList = parsedTexture.renderList;\r\n mirrorTexture.mirrorPlane = Plane.FromArray(parsedTexture.mirrorPlane);\r\n onLoaded();\r\n return mirrorTexture;\r\n }\r\n else if (parsedTexture.isRenderTarget) {\r\n var renderTargetTexture = null;\r\n if (parsedTexture.isCube) {\r\n // Search for an existing reflection probe (which contains a cube render target texture)\r\n if (scene.reflectionProbes) {\r\n for (var index = 0; index < scene.reflectionProbes.length; index++) {\r\n var probe = scene.reflectionProbes[index];\r\n if (probe.name === parsedTexture.name) {\r\n return probe.cubeTexture;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n renderTargetTexture = Texture._CreateRenderTargetTexture(parsedTexture.name, parsedTexture.renderTargetSize, scene, generateMipMaps);\r\n renderTargetTexture._waitingRenderList = parsedTexture.renderList;\r\n }\r\n onLoaded();\r\n return renderTargetTexture;\r\n }\r\n else {\r\n var texture;\r\n if (parsedTexture.base64String) {\r\n texture = Texture.CreateFromBase64String(parsedTexture.base64String, parsedTexture.name, scene, !generateMipMaps, parsedTexture.invertY, undefined, onLoaded);\r\n }\r\n else {\r\n var url = void 0;\r\n if (parsedTexture.name && parsedTexture.name.indexOf(\"://\") > 0) {\r\n url = parsedTexture.name;\r\n }\r\n else {\r\n url = rootUrl + parsedTexture.name;\r\n }\r\n if (StringTools.StartsWith(parsedTexture.url, \"data:\") || (Texture.UseSerializedUrlIfAny && parsedTexture.url)) {\r\n url = parsedTexture.url;\r\n }\r\n texture = new Texture(url, scene, !generateMipMaps, parsedTexture.invertY, undefined, onLoaded);\r\n }\r\n return texture;\r\n }\r\n }, parsedTexture, scene);\r\n return texture;\r\n };\r\n /**\r\n * Creates a texture from its base 64 representation.\r\n * @param data Define the base64 payload without the data: prefix\r\n * @param name Define the name of the texture in the scene useful fo caching purpose for instance\r\n * @param scene Define the scene the texture should belong to\r\n * @param noMipmap Forces the texture to not create mip map information if true\r\n * @param invertY define if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad define a callback triggered when the texture has been loaded\r\n * @param onError define a callback triggered when an error occurred during the loading session\r\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @returns the created texture\r\n */\r\n Texture.CreateFromBase64String = function (data, name, scene, noMipmap, invertY, samplingMode, onLoad, onError, format) {\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (format === void 0) { format = 5; }\r\n return new Texture(\"data:\" + name, scene, noMipmap, invertY, samplingMode, onLoad, onError, data, false, format);\r\n };\r\n /**\r\n * Creates a texture from its data: representation. (data: will be added in case only the payload has been passed in)\r\n * @param data Define the base64 payload without the data: prefix\r\n * @param name Define the name of the texture in the scene useful fo caching purpose for instance\r\n * @param buffer define the buffer to load the texture from in case the texture is loaded from a buffer representation\r\n * @param scene Define the scene the texture should belong to\r\n * @param deleteBuffer define if the buffer we are loading the texture from should be deleted after load\r\n * @param noMipmap Forces the texture to not create mip map information if true\r\n * @param invertY define if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad define a callback triggered when the texture has been loaded\r\n * @param onError define a callback triggered when an error occurred during the loading session\r\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @returns the created texture\r\n */\r\n Texture.LoadFromDataString = function (name, buffer, scene, deleteBuffer, noMipmap, invertY, samplingMode, onLoad, onError, format) {\r\n if (deleteBuffer === void 0) { deleteBuffer = false; }\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (invertY === void 0) { invertY = true; }\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (format === void 0) { format = 5; }\r\n if (name.substr(0, 5) !== \"data:\") {\r\n name = \"data:\" + name;\r\n }\r\n return new Texture(name, scene, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer, format);\r\n };\r\n /**\r\n * Gets or sets a general boolean used to indicate that textures containing direct data (buffers) must be saved as part of the serialization process\r\n */\r\n Texture.SerializeBuffers = true;\r\n /**\r\n * Gets or sets a general boolean used to indicate that texture buffers must be saved as part of the serialization process.\r\n * If no buffer exists, one will be created as base64 string from the internal webgl data.\r\n */\r\n Texture.ForceSerializeBuffers = false;\r\n /** @hidden */\r\n Texture._CubeTextureParser = function (jsonTexture, scene, rootUrl) {\r\n throw _DevTools.WarnImport(\"CubeTexture\");\r\n };\r\n /** @hidden */\r\n Texture._CreateMirror = function (name, renderTargetSize, scene, generateMipMaps) {\r\n throw _DevTools.WarnImport(\"MirrorTexture\");\r\n };\r\n /** @hidden */\r\n Texture._CreateRenderTargetTexture = function (name, renderTargetSize, scene, generateMipMaps) {\r\n throw _DevTools.WarnImport(\"RenderTargetTexture\");\r\n };\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Texture.NEAREST_SAMPLINGMODE = 1;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Texture.NEAREST_NEAREST_MIPLINEAR = 8; // nearest is mag = nearest and min = nearest and mip = linear\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Texture.BILINEAR_SAMPLINGMODE = 2;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Texture.LINEAR_LINEAR_MIPNEAREST = 11; // Bilinear is mag = linear and min = linear and mip = nearest\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Texture.TRILINEAR_SAMPLINGMODE = 3;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Texture.LINEAR_LINEAR_MIPLINEAR = 3; // Trilinear is mag = linear and min = linear and mip = linear\r\n /** mag = nearest and min = nearest and mip = nearest */\r\n Texture.NEAREST_NEAREST_MIPNEAREST = 4;\r\n /** mag = nearest and min = linear and mip = nearest */\r\n Texture.NEAREST_LINEAR_MIPNEAREST = 5;\r\n /** mag = nearest and min = linear and mip = linear */\r\n Texture.NEAREST_LINEAR_MIPLINEAR = 6;\r\n /** mag = nearest and min = linear and mip = none */\r\n Texture.NEAREST_LINEAR = 7;\r\n /** mag = nearest and min = nearest and mip = none */\r\n Texture.NEAREST_NEAREST = 1;\r\n /** mag = linear and min = nearest and mip = nearest */\r\n Texture.LINEAR_NEAREST_MIPNEAREST = 9;\r\n /** mag = linear and min = nearest and mip = linear */\r\n Texture.LINEAR_NEAREST_MIPLINEAR = 10;\r\n /** mag = linear and min = linear and mip = none */\r\n Texture.LINEAR_LINEAR = 2;\r\n /** mag = linear and min = nearest and mip = none */\r\n Texture.LINEAR_NEAREST = 12;\r\n /** Explicit coordinates mode */\r\n Texture.EXPLICIT_MODE = 0;\r\n /** Spherical coordinates mode */\r\n Texture.SPHERICAL_MODE = 1;\r\n /** Planar coordinates mode */\r\n Texture.PLANAR_MODE = 2;\r\n /** Cubic coordinates mode */\r\n Texture.CUBIC_MODE = 3;\r\n /** Projection coordinates mode */\r\n Texture.PROJECTION_MODE = 4;\r\n /** Inverse Cubic coordinates mode */\r\n Texture.SKYBOX_MODE = 5;\r\n /** Inverse Cubic coordinates mode */\r\n Texture.INVCUBIC_MODE = 6;\r\n /** Equirectangular coordinates mode */\r\n Texture.EQUIRECTANGULAR_MODE = 7;\r\n /** Equirectangular Fixed coordinates mode */\r\n Texture.FIXED_EQUIRECTANGULAR_MODE = 8;\r\n /** Equirectangular Fixed Mirrored coordinates mode */\r\n Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9;\r\n /** Texture is not repeating outside of 0..1 UVs */\r\n Texture.CLAMP_ADDRESSMODE = 0;\r\n /** Texture is repeating outside of 0..1 UVs */\r\n Texture.WRAP_ADDRESSMODE = 1;\r\n /** Texture is repeating and mirrored */\r\n Texture.MIRROR_ADDRESSMODE = 2;\r\n /**\r\n * Gets or sets a boolean which defines if the texture url must be build from the serialized URL instead of just using the name and loading them side by side with the scene file\r\n */\r\n Texture.UseSerializedUrlIfAny = false;\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"url\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"uOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"vOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"uScale\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"vScale\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"uAng\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"vAng\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"wAng\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"uRotationCenter\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"vRotationCenter\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"wRotationCenter\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"homogeneousRotationInUVTransform\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"isBlocking\", null);\r\n return Texture;\r\n}(BaseTexture));\r\nexport { Texture };\r\n// References the dependencies.\r\n_TypeStore.RegisteredTypes[\"BABYLON.Texture\"] = Texture;\r\nSerializationHelper._TextureParser = Texture.Parse;\r\n//# sourceMappingURL=texture.js.map","import { Observable } from \"../Misc/observable\";\r\nimport { DomManagement } from \"../Misc/domManagement\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { ShaderProcessor } from '../Engines/Processors/shaderProcessor';\r\n/**\r\n * Effect containing vertex and fragment shader that can be executed on an object.\r\n */\r\nvar Effect = /** @class */ (function () {\r\n /**\r\n * Instantiates an effect.\r\n * An effect can be used to create/manage/execute vertex and fragment shaders.\r\n * @param baseName Name of the effect.\r\n * @param attributesNamesOrOptions List of attribute names that will be passed to the shader or set of all options to create the effect.\r\n * @param uniformsNamesOrEngine List of uniform variable names that will be passed to the shader or the engine that will be used to render effect.\r\n * @param samplers List of sampler variables that will be passed to the shader.\r\n * @param engine Engine to be used to render the effect\r\n * @param defines Define statements to be added to the shader.\r\n * @param fallbacks Possible fallbacks for this effect to improve performance when needed.\r\n * @param onCompiled Callback that will be called when the shader is compiled.\r\n * @param onError Callback that will be called if an error occurs during shader compilation.\r\n * @param indexParameters Parameters to be used with Babylons include syntax to iterate over an array (eg. {lights: 10})\r\n */\r\n function Effect(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, engine, defines, fallbacks, onCompiled, onError, indexParameters) {\r\n var _this = this;\r\n if (samplers === void 0) { samplers = null; }\r\n if (defines === void 0) { defines = null; }\r\n if (fallbacks === void 0) { fallbacks = null; }\r\n if (onCompiled === void 0) { onCompiled = null; }\r\n if (onError === void 0) { onError = null; }\r\n var _a;\r\n /**\r\n * Name of the effect.\r\n */\r\n this.name = null;\r\n /**\r\n * String container all the define statements that should be set on the shader.\r\n */\r\n this.defines = \"\";\r\n /**\r\n * Callback that will be called when the shader is compiled.\r\n */\r\n this.onCompiled = null;\r\n /**\r\n * Callback that will be called if an error occurs during shader compilation.\r\n */\r\n this.onError = null;\r\n /**\r\n * Callback that will be called when effect is bound.\r\n */\r\n this.onBind = null;\r\n /**\r\n * Unique ID of the effect.\r\n */\r\n this.uniqueId = 0;\r\n /**\r\n * Observable that will be called when the shader is compiled.\r\n * It is recommended to use executeWhenCompile() or to make sure that scene.isReady() is called to get this observable raised.\r\n */\r\n this.onCompileObservable = new Observable();\r\n /**\r\n * Observable that will be called if an error occurs during shader compilation.\r\n */\r\n this.onErrorObservable = new Observable();\r\n /** @hidden */\r\n this._onBindObservable = null;\r\n /**\r\n * @hidden\r\n * Specifies if the effect was previously ready\r\n */\r\n this._wasPreviouslyReady = false;\r\n /** @hidden */\r\n this._bonesComputationForcedToCPU = false;\r\n /** @hidden */\r\n this._multiTarget = false;\r\n this._uniformBuffersNames = {};\r\n this._samplers = {};\r\n this._isReady = false;\r\n this._compilationError = \"\";\r\n this._allFallbacksProcessed = false;\r\n this._uniforms = {};\r\n /**\r\n * Key for the effect.\r\n * @hidden\r\n */\r\n this._key = \"\";\r\n this._fallbacks = null;\r\n this._vertexSourceCode = \"\";\r\n this._fragmentSourceCode = \"\";\r\n this._vertexSourceCodeOverride = \"\";\r\n this._fragmentSourceCodeOverride = \"\";\r\n this._transformFeedbackVaryings = null;\r\n this._rawVertexSourceCode = \"\";\r\n this._rawFragmentSourceCode = \"\";\r\n /**\r\n * Compiled shader to webGL program.\r\n * @hidden\r\n */\r\n this._pipelineContext = null;\r\n this._valueCache = {};\r\n this.name = baseName;\r\n var processFinalCode = null;\r\n if (attributesNamesOrOptions.attributes) {\r\n var options = attributesNamesOrOptions;\r\n this._engine = uniformsNamesOrEngine;\r\n this._attributesNames = options.attributes;\r\n this._uniformsNames = options.uniformsNames.concat(options.samplers);\r\n this._samplerList = options.samplers.slice();\r\n this.defines = options.defines;\r\n this.onError = options.onError;\r\n this.onCompiled = options.onCompiled;\r\n this._fallbacks = options.fallbacks;\r\n this._indexParameters = options.indexParameters;\r\n this._transformFeedbackVaryings = options.transformFeedbackVaryings || null;\r\n this._multiTarget = !!options.multiTarget;\r\n if (options.uniformBuffersNames) {\r\n this._uniformBuffersNamesList = options.uniformBuffersNames.slice();\r\n for (var i = 0; i < options.uniformBuffersNames.length; i++) {\r\n this._uniformBuffersNames[options.uniformBuffersNames[i]] = i;\r\n }\r\n }\r\n processFinalCode = (_a = options.processFinalCode) !== null && _a !== void 0 ? _a : null;\r\n }\r\n else {\r\n this._engine = engine;\r\n this.defines = (defines == null ? \"\" : defines);\r\n this._uniformsNames = uniformsNamesOrEngine.concat(samplers);\r\n this._samplerList = samplers ? samplers.slice() : [];\r\n this._attributesNames = attributesNamesOrOptions;\r\n this._uniformBuffersNamesList = [];\r\n this.onError = onError;\r\n this.onCompiled = onCompiled;\r\n this._indexParameters = indexParameters;\r\n this._fallbacks = fallbacks;\r\n }\r\n this._attributeLocationByName = {};\r\n this.uniqueId = Effect._uniqueIdSeed++;\r\n var vertexSource;\r\n var fragmentSource;\r\n var hostDocument = DomManagement.IsWindowObjectExist() ? this._engine.getHostDocument() : null;\r\n if (baseName.vertexSource) {\r\n vertexSource = \"source:\" + baseName.vertexSource;\r\n }\r\n else if (baseName.vertexElement) {\r\n vertexSource = hostDocument ? hostDocument.getElementById(baseName.vertexElement) : null;\r\n if (!vertexSource) {\r\n vertexSource = baseName.vertexElement;\r\n }\r\n }\r\n else {\r\n vertexSource = baseName.vertex || baseName;\r\n }\r\n if (baseName.fragmentSource) {\r\n fragmentSource = \"source:\" + baseName.fragmentSource;\r\n }\r\n else if (baseName.fragmentElement) {\r\n fragmentSource = hostDocument ? hostDocument.getElementById(baseName.fragmentElement) : null;\r\n if (!fragmentSource) {\r\n fragmentSource = baseName.fragmentElement;\r\n }\r\n }\r\n else {\r\n fragmentSource = baseName.fragment || baseName;\r\n }\r\n var processorOptions = {\r\n defines: this.defines.split(\"\\n\"),\r\n indexParameters: this._indexParameters,\r\n isFragment: false,\r\n shouldUseHighPrecisionShader: this._engine._shouldUseHighPrecisionShader,\r\n processor: this._engine._shaderProcessor,\r\n supportsUniformBuffers: this._engine.supportsUniformBuffers,\r\n shadersRepository: Effect.ShadersRepository,\r\n includesShadersStore: Effect.IncludesShadersStore,\r\n version: (this._engine.webGLVersion * 100).toString(),\r\n platformName: this._engine.webGLVersion >= 2 ? \"WEBGL2\" : \"WEBGL1\"\r\n };\r\n this._loadShader(vertexSource, \"Vertex\", \"\", function (vertexCode) {\r\n _this._rawVertexSourceCode = vertexCode;\r\n _this._loadShader(fragmentSource, \"Fragment\", \"Pixel\", function (fragmentCode) {\r\n _this._rawFragmentSourceCode = fragmentCode;\r\n ShaderProcessor.Process(vertexCode, processorOptions, function (migratedVertexCode) {\r\n if (processFinalCode) {\r\n migratedVertexCode = processFinalCode(\"vertex\", migratedVertexCode);\r\n }\r\n processorOptions.isFragment = true;\r\n ShaderProcessor.Process(fragmentCode, processorOptions, function (migratedFragmentCode) {\r\n if (processFinalCode) {\r\n migratedFragmentCode = processFinalCode(\"fragment\", migratedFragmentCode);\r\n }\r\n _this._useFinalCode(migratedVertexCode, migratedFragmentCode, baseName);\r\n }, _this._engine);\r\n }, _this._engine);\r\n });\r\n });\r\n }\r\n Object.defineProperty(Effect.prototype, \"onBindObservable\", {\r\n /**\r\n * Observable that will be called when effect is bound.\r\n */\r\n get: function () {\r\n if (!this._onBindObservable) {\r\n this._onBindObservable = new Observable();\r\n }\r\n return this._onBindObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Effect.prototype._useFinalCode = function (migratedVertexCode, migratedFragmentCode, baseName) {\r\n if (baseName) {\r\n var vertex = baseName.vertexElement || baseName.vertex || baseName.spectorName || baseName;\r\n var fragment = baseName.fragmentElement || baseName.fragment || baseName.spectorName || baseName;\r\n this._vertexSourceCode = \"#define SHADER_NAME vertex:\" + vertex + \"\\n\" + migratedVertexCode;\r\n this._fragmentSourceCode = \"#define SHADER_NAME fragment:\" + fragment + \"\\n\" + migratedFragmentCode;\r\n }\r\n else {\r\n this._vertexSourceCode = migratedVertexCode;\r\n this._fragmentSourceCode = migratedFragmentCode;\r\n }\r\n this._prepareEffect();\r\n };\r\n Object.defineProperty(Effect.prototype, \"key\", {\r\n /**\r\n * Unique key for this effect\r\n */\r\n get: function () {\r\n return this._key;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * If the effect has been compiled and prepared.\r\n * @returns if the effect is compiled and prepared.\r\n */\r\n Effect.prototype.isReady = function () {\r\n try {\r\n return this._isReadyInternal();\r\n }\r\n catch (_a) {\r\n return false;\r\n }\r\n };\r\n Effect.prototype._isReadyInternal = function () {\r\n if (this._isReady) {\r\n return true;\r\n }\r\n if (this._pipelineContext) {\r\n return this._pipelineContext.isReady;\r\n }\r\n return false;\r\n };\r\n /**\r\n * The engine the effect was initialized with.\r\n * @returns the engine.\r\n */\r\n Effect.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * The pipeline context for this effect\r\n * @returns the associated pipeline context\r\n */\r\n Effect.prototype.getPipelineContext = function () {\r\n return this._pipelineContext;\r\n };\r\n /**\r\n * The set of names of attribute variables for the shader.\r\n * @returns An array of attribute names.\r\n */\r\n Effect.prototype.getAttributesNames = function () {\r\n return this._attributesNames;\r\n };\r\n /**\r\n * Returns the attribute at the given index.\r\n * @param index The index of the attribute.\r\n * @returns The location of the attribute.\r\n */\r\n Effect.prototype.getAttributeLocation = function (index) {\r\n return this._attributes[index];\r\n };\r\n /**\r\n * Returns the attribute based on the name of the variable.\r\n * @param name of the attribute to look up.\r\n * @returns the attribute location.\r\n */\r\n Effect.prototype.getAttributeLocationByName = function (name) {\r\n return this._attributeLocationByName[name];\r\n };\r\n /**\r\n * The number of attributes.\r\n * @returns the numnber of attributes.\r\n */\r\n Effect.prototype.getAttributesCount = function () {\r\n return this._attributes.length;\r\n };\r\n /**\r\n * Gets the index of a uniform variable.\r\n * @param uniformName of the uniform to look up.\r\n * @returns the index.\r\n */\r\n Effect.prototype.getUniformIndex = function (uniformName) {\r\n return this._uniformsNames.indexOf(uniformName);\r\n };\r\n /**\r\n * Returns the attribute based on the name of the variable.\r\n * @param uniformName of the uniform to look up.\r\n * @returns the location of the uniform.\r\n */\r\n Effect.prototype.getUniform = function (uniformName) {\r\n return this._uniforms[uniformName];\r\n };\r\n /**\r\n * Returns an array of sampler variable names\r\n * @returns The array of sampler variable names.\r\n */\r\n Effect.prototype.getSamplers = function () {\r\n return this._samplerList;\r\n };\r\n /**\r\n * Returns an array of uniform variable names\r\n * @returns The array of uniform variable names.\r\n */\r\n Effect.prototype.getUniformNames = function () {\r\n return this._uniformsNames;\r\n };\r\n /**\r\n * Returns an array of uniform buffer variable names\r\n * @returns The array of uniform buffer variable names.\r\n */\r\n Effect.prototype.getUniformBuffersNames = function () {\r\n return this._uniformBuffersNamesList;\r\n };\r\n /**\r\n * Returns the index parameters used to create the effect\r\n * @returns The index parameters object\r\n */\r\n Effect.prototype.getIndexParameters = function () {\r\n return this._indexParameters;\r\n };\r\n /**\r\n * The error from the last compilation.\r\n * @returns the error string.\r\n */\r\n Effect.prototype.getCompilationError = function () {\r\n return this._compilationError;\r\n };\r\n /**\r\n * Gets a boolean indicating that all fallbacks were used during compilation\r\n * @returns true if all fallbacks were used\r\n */\r\n Effect.prototype.allFallbacksProcessed = function () {\r\n return this._allFallbacksProcessed;\r\n };\r\n /**\r\n * Adds a callback to the onCompiled observable and call the callback imediatly if already ready.\r\n * @param func The callback to be used.\r\n */\r\n Effect.prototype.executeWhenCompiled = function (func) {\r\n var _this = this;\r\n if (this.isReady()) {\r\n func(this);\r\n return;\r\n }\r\n this.onCompileObservable.add(function (effect) {\r\n func(effect);\r\n });\r\n if (!this._pipelineContext || this._pipelineContext.isAsync) {\r\n setTimeout(function () {\r\n _this._checkIsReady(null);\r\n }, 16);\r\n }\r\n };\r\n Effect.prototype._checkIsReady = function (previousPipelineContext) {\r\n var _this = this;\r\n try {\r\n if (this._isReadyInternal()) {\r\n return;\r\n }\r\n }\r\n catch (e) {\r\n this._processCompilationErrors(e, previousPipelineContext);\r\n return;\r\n }\r\n setTimeout(function () {\r\n _this._checkIsReady(previousPipelineContext);\r\n }, 16);\r\n };\r\n Effect.prototype._loadShader = function (shader, key, optionalKey, callback) {\r\n if (typeof (HTMLElement) !== \"undefined\") {\r\n // DOM element ?\r\n if (shader instanceof HTMLElement) {\r\n var shaderCode = DomManagement.GetDOMTextContent(shader);\r\n callback(shaderCode);\r\n return;\r\n }\r\n }\r\n // Direct source ?\r\n if (shader.substr(0, 7) === \"source:\") {\r\n callback(shader.substr(7));\r\n return;\r\n }\r\n // Base64 encoded ?\r\n if (shader.substr(0, 7) === \"base64:\") {\r\n var shaderBinary = window.atob(shader.substr(7));\r\n callback(shaderBinary);\r\n return;\r\n }\r\n // Is in local store ?\r\n if (Effect.ShadersStore[shader + key + \"Shader\"]) {\r\n callback(Effect.ShadersStore[shader + key + \"Shader\"]);\r\n return;\r\n }\r\n if (optionalKey && Effect.ShadersStore[shader + optionalKey + \"Shader\"]) {\r\n callback(Effect.ShadersStore[shader + optionalKey + \"Shader\"]);\r\n return;\r\n }\r\n var shaderUrl;\r\n if (shader[0] === \".\" || shader[0] === \"/\" || shader.indexOf(\"http\") > -1) {\r\n shaderUrl = shader;\r\n }\r\n else {\r\n shaderUrl = Effect.ShadersRepository + shader;\r\n }\r\n // Vertex shader\r\n this._engine._loadFile(shaderUrl + \".\" + key.toLowerCase() + \".fx\", callback);\r\n };\r\n Object.defineProperty(Effect.prototype, \"vertexSourceCode\", {\r\n /**\r\n * Gets the vertex shader source code of this effect\r\n */\r\n get: function () {\r\n return this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride ? this._vertexSourceCodeOverride : this._vertexSourceCode;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Effect.prototype, \"fragmentSourceCode\", {\r\n /**\r\n * Gets the fragment shader source code of this effect\r\n */\r\n get: function () {\r\n return this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride ? this._fragmentSourceCodeOverride : this._fragmentSourceCode;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Effect.prototype, \"rawVertexSourceCode\", {\r\n /**\r\n * Gets the vertex shader source code before it has been processed by the preprocessor\r\n */\r\n get: function () {\r\n return this._rawVertexSourceCode;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Effect.prototype, \"rawFragmentSourceCode\", {\r\n /**\r\n * Gets the fragment shader source code before it has been processed by the preprocessor\r\n */\r\n get: function () {\r\n return this._rawFragmentSourceCode;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Recompiles the webGL program\r\n * @param vertexSourceCode The source code for the vertex shader.\r\n * @param fragmentSourceCode The source code for the fragment shader.\r\n * @param onCompiled Callback called when completed.\r\n * @param onError Callback called on error.\r\n * @hidden\r\n */\r\n Effect.prototype._rebuildProgram = function (vertexSourceCode, fragmentSourceCode, onCompiled, onError) {\r\n var _this = this;\r\n this._isReady = false;\r\n this._vertexSourceCodeOverride = vertexSourceCode;\r\n this._fragmentSourceCodeOverride = fragmentSourceCode;\r\n this.onError = function (effect, error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n };\r\n this.onCompiled = function () {\r\n var scenes = _this.getEngine().scenes;\r\n if (scenes) {\r\n for (var i = 0; i < scenes.length; i++) {\r\n scenes[i].markAllMaterialsAsDirty(63);\r\n }\r\n }\r\n _this._pipelineContext._handlesSpectorRebuildCallback(onCompiled);\r\n };\r\n this._fallbacks = null;\r\n this._prepareEffect();\r\n };\r\n /**\r\n * Prepares the effect\r\n * @hidden\r\n */\r\n Effect.prototype._prepareEffect = function () {\r\n var _this = this;\r\n var attributesNames = this._attributesNames;\r\n var defines = this.defines;\r\n this._valueCache = {};\r\n var previousPipelineContext = this._pipelineContext;\r\n try {\r\n var engine_1 = this._engine;\r\n this._pipelineContext = engine_1.createPipelineContext();\r\n var rebuildRebind = this._rebuildProgram.bind(this);\r\n if (this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride) {\r\n engine_1._preparePipelineContext(this._pipelineContext, this._vertexSourceCodeOverride, this._fragmentSourceCodeOverride, true, rebuildRebind, null, this._transformFeedbackVaryings);\r\n }\r\n else {\r\n engine_1._preparePipelineContext(this._pipelineContext, this._vertexSourceCode, this._fragmentSourceCode, false, rebuildRebind, defines, this._transformFeedbackVaryings);\r\n }\r\n engine_1._executeWhenRenderingStateIsCompiled(this._pipelineContext, function () {\r\n if (engine_1.supportsUniformBuffers) {\r\n for (var name in _this._uniformBuffersNames) {\r\n _this.bindUniformBlock(name, _this._uniformBuffersNames[name]);\r\n }\r\n }\r\n var uniforms = engine_1.getUniforms(_this._pipelineContext, _this._uniformsNames);\r\n uniforms.forEach(function (uniform, index) {\r\n _this._uniforms[_this._uniformsNames[index]] = uniform;\r\n });\r\n _this._attributes = engine_1.getAttributes(_this._pipelineContext, attributesNames);\r\n if (attributesNames) {\r\n for (var i = 0; i < attributesNames.length; i++) {\r\n var name_1 = attributesNames[i];\r\n _this._attributeLocationByName[name_1] = _this._attributes[i];\r\n }\r\n }\r\n var index;\r\n for (index = 0; index < _this._samplerList.length; index++) {\r\n var sampler = _this.getUniform(_this._samplerList[index]);\r\n if (sampler == null) {\r\n _this._samplerList.splice(index, 1);\r\n index--;\r\n }\r\n }\r\n _this._samplerList.forEach(function (name, index) {\r\n _this._samplers[name] = index;\r\n });\r\n engine_1.bindSamplers(_this);\r\n _this._compilationError = \"\";\r\n _this._isReady = true;\r\n if (_this.onCompiled) {\r\n _this.onCompiled(_this);\r\n }\r\n _this.onCompileObservable.notifyObservers(_this);\r\n _this.onCompileObservable.clear();\r\n // Unbind mesh reference in fallbacks\r\n if (_this._fallbacks) {\r\n _this._fallbacks.unBindMesh();\r\n }\r\n if (previousPipelineContext) {\r\n _this.getEngine()._deletePipelineContext(previousPipelineContext);\r\n }\r\n });\r\n if (this._pipelineContext.isAsync) {\r\n this._checkIsReady(previousPipelineContext);\r\n }\r\n }\r\n catch (e) {\r\n this._processCompilationErrors(e, previousPipelineContext);\r\n }\r\n };\r\n Effect.prototype._getShaderCodeAndErrorLine = function (code, error, isFragment) {\r\n var regexp = isFragment ? /FRAGMENT SHADER ERROR: 0:(\\d+?):/ : /VERTEX SHADER ERROR: 0:(\\d+?):/;\r\n var errorLine = null;\r\n if (error && code) {\r\n var res = error.match(regexp);\r\n if (res && res.length === 2) {\r\n var lineNumber = parseInt(res[1]);\r\n var lines = code.split(\"\\n\", -1);\r\n if (lines.length >= lineNumber) {\r\n errorLine = \"Offending line [\" + lineNumber + \"] in \" + (isFragment ? \"fragment\" : \"vertex\") + \" code: \" + lines[lineNumber - 1];\r\n }\r\n }\r\n }\r\n return [code, errorLine];\r\n };\r\n Effect.prototype._processCompilationErrors = function (e, previousPipelineContext) {\r\n var _a, _b;\r\n var _c, _d, _e;\r\n if (previousPipelineContext === void 0) { previousPipelineContext = null; }\r\n this._compilationError = e.message;\r\n var attributesNames = this._attributesNames;\r\n var fallbacks = this._fallbacks;\r\n // Let's go through fallbacks then\r\n Logger.Error(\"Unable to compile effect:\");\r\n Logger.Error(\"Uniforms: \" + this._uniformsNames.map(function (uniform) {\r\n return \" \" + uniform;\r\n }));\r\n Logger.Error(\"Attributes: \" + attributesNames.map(function (attribute) {\r\n return \" \" + attribute;\r\n }));\r\n Logger.Error(\"Defines:\\r\\n\" + this.defines);\r\n if (Effect.LogShaderCodeOnCompilationError) {\r\n var lineErrorVertex = null, lineErrorFragment = null, code = null;\r\n if ((_c = this._pipelineContext) === null || _c === void 0 ? void 0 : _c._getVertexShaderCode()) {\r\n _a = this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(), this._compilationError, false), code = _a[0], lineErrorVertex = _a[1];\r\n if (code) {\r\n Logger.Error(\"Vertex code:\");\r\n Logger.Error(code);\r\n }\r\n }\r\n if ((_d = this._pipelineContext) === null || _d === void 0 ? void 0 : _d._getFragmentShaderCode()) {\r\n _b = this._getShaderCodeAndErrorLine((_e = this._pipelineContext) === null || _e === void 0 ? void 0 : _e._getFragmentShaderCode(), this._compilationError, true), code = _b[0], lineErrorFragment = _b[1];\r\n if (code) {\r\n Logger.Error(\"Fragment code:\");\r\n Logger.Error(code);\r\n }\r\n }\r\n if (lineErrorVertex) {\r\n Logger.Error(lineErrorVertex);\r\n }\r\n if (lineErrorFragment) {\r\n Logger.Error(lineErrorFragment);\r\n }\r\n }\r\n Logger.Error(\"Error: \" + this._compilationError);\r\n if (previousPipelineContext) {\r\n this._pipelineContext = previousPipelineContext;\r\n this._isReady = true;\r\n if (this.onError) {\r\n this.onError(this, this._compilationError);\r\n }\r\n this.onErrorObservable.notifyObservers(this);\r\n }\r\n if (fallbacks) {\r\n this._pipelineContext = null;\r\n if (fallbacks.hasMoreFallbacks) {\r\n this._allFallbacksProcessed = false;\r\n Logger.Error(\"Trying next fallback.\");\r\n this.defines = fallbacks.reduce(this.defines, this);\r\n this._prepareEffect();\r\n }\r\n else { // Sorry we did everything we can\r\n this._allFallbacksProcessed = true;\r\n if (this.onError) {\r\n this.onError(this, this._compilationError);\r\n }\r\n this.onErrorObservable.notifyObservers(this);\r\n this.onErrorObservable.clear();\r\n // Unbind mesh reference in fallbacks\r\n if (this._fallbacks) {\r\n this._fallbacks.unBindMesh();\r\n }\r\n }\r\n }\r\n else {\r\n this._allFallbacksProcessed = true;\r\n }\r\n };\r\n Object.defineProperty(Effect.prototype, \"isSupported\", {\r\n /**\r\n * Checks if the effect is supported. (Must be called after compilation)\r\n */\r\n get: function () {\r\n return this._compilationError === \"\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Binds a texture to the engine to be used as output of the shader.\r\n * @param channel Name of the output variable.\r\n * @param texture Texture to bind.\r\n * @hidden\r\n */\r\n Effect.prototype._bindTexture = function (channel, texture) {\r\n this._engine._bindTexture(this._samplers[channel], texture);\r\n };\r\n /**\r\n * Sets a texture on the engine to be used in the shader.\r\n * @param channel Name of the sampler variable.\r\n * @param texture Texture to set.\r\n */\r\n Effect.prototype.setTexture = function (channel, texture) {\r\n this._engine.setTexture(this._samplers[channel], this._uniforms[channel], texture);\r\n };\r\n /**\r\n * Sets a depth stencil texture from a render target on the engine to be used in the shader.\r\n * @param channel Name of the sampler variable.\r\n * @param texture Texture to set.\r\n */\r\n Effect.prototype.setDepthStencilTexture = function (channel, texture) {\r\n this._engine.setDepthStencilTexture(this._samplers[channel], this._uniforms[channel], texture);\r\n };\r\n /**\r\n * Sets an array of textures on the engine to be used in the shader.\r\n * @param channel Name of the variable.\r\n * @param textures Textures to set.\r\n */\r\n Effect.prototype.setTextureArray = function (channel, textures) {\r\n var exName = channel + \"Ex\";\r\n if (this._samplerList.indexOf(exName + \"0\") === -1) {\r\n var initialPos = this._samplerList.indexOf(channel);\r\n for (var index = 1; index < textures.length; index++) {\r\n var currentExName = exName + (index - 1).toString();\r\n this._samplerList.splice(initialPos + index, 0, currentExName);\r\n }\r\n // Reset every channels\r\n var channelIndex = 0;\r\n for (var _i = 0, _a = this._samplerList; _i < _a.length; _i++) {\r\n var key = _a[_i];\r\n this._samplers[key] = channelIndex;\r\n channelIndex += 1;\r\n }\r\n }\r\n this._engine.setTextureArray(this._samplers[channel], this._uniforms[channel], textures);\r\n };\r\n /**\r\n * Sets a texture to be the input of the specified post process. (To use the output, pass in the next post process in the pipeline)\r\n * @param channel Name of the sampler variable.\r\n * @param postProcess Post process to get the input texture from.\r\n */\r\n Effect.prototype.setTextureFromPostProcess = function (channel, postProcess) {\r\n this._engine.setTextureFromPostProcess(this._samplers[channel], postProcess);\r\n };\r\n /**\r\n * (Warning! setTextureFromPostProcessOutput may be desired instead)\r\n * Sets the input texture of the passed in post process to be input of this effect. (To use the output of the passed in post process use setTextureFromPostProcessOutput)\r\n * @param channel Name of the sampler variable.\r\n * @param postProcess Post process to get the output texture from.\r\n */\r\n Effect.prototype.setTextureFromPostProcessOutput = function (channel, postProcess) {\r\n this._engine.setTextureFromPostProcessOutput(this._samplers[channel], postProcess);\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheMatrix = function (uniformName, matrix) {\r\n var cache = this._valueCache[uniformName];\r\n var flag = matrix.updateFlag;\r\n if (cache !== undefined && cache === flag) {\r\n return false;\r\n }\r\n this._valueCache[uniformName] = flag;\r\n return true;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat2 = function (uniformName, x, y) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache || cache.length !== 2) {\r\n cache = [x, y];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat3 = function (uniformName, x, y, z) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache || cache.length !== 3) {\r\n cache = [x, y, z];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n if (cache[2] !== z) {\r\n cache[2] = z;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat4 = function (uniformName, x, y, z, w) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache || cache.length !== 4) {\r\n cache = [x, y, z, w];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n if (cache[2] !== z) {\r\n cache[2] = z;\r\n changed = true;\r\n }\r\n if (cache[3] !== w) {\r\n cache[3] = w;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /**\r\n * Binds a buffer to a uniform.\r\n * @param buffer Buffer to bind.\r\n * @param name Name of the uniform variable to bind to.\r\n */\r\n Effect.prototype.bindUniformBuffer = function (buffer, name) {\r\n var bufferName = this._uniformBuffersNames[name];\r\n if (bufferName === undefined || Effect._baseCache[bufferName] === buffer) {\r\n return;\r\n }\r\n Effect._baseCache[bufferName] = buffer;\r\n this._engine.bindUniformBufferBase(buffer, bufferName);\r\n };\r\n /**\r\n * Binds block to a uniform.\r\n * @param blockName Name of the block to bind.\r\n * @param index Index to bind.\r\n */\r\n Effect.prototype.bindUniformBlock = function (blockName, index) {\r\n this._engine.bindUniformBlock(this._pipelineContext, blockName, index);\r\n };\r\n /**\r\n * Sets an interger value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setInt = function (uniformName, value) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === value) {\r\n return this;\r\n }\r\n if (this._engine.setInt(this._uniforms[uniformName], value)) {\r\n this._valueCache[uniformName] = value;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets an int array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets matrices on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param matrices matrices to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrices = function (uniformName, matrices) {\r\n if (!matrices) {\r\n return this;\r\n }\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrices(this._uniforms[uniformName], matrices); // the cast is ok because it is gl.uniformMatrix4fv() which is called at the end, and this function accepts Float32Array and Array\r\n return this;\r\n };\r\n /**\r\n * Sets matrix on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix = function (uniformName, matrix) {\r\n if (this._cacheMatrix(uniformName, matrix)) {\r\n if (!this._engine.setMatrices(this._uniforms[uniformName], matrix.toArray())) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a 3x3 matrix on a uniform variable. (Speicified as [1,2,3,4,5,6,7,8,9] will result in [1,2,3][4,5,6][7,8,9] matrix)\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix3x3 = function (uniformName, matrix) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrix3x3(this._uniforms[uniformName], matrix); // the cast is ok because it is gl.uniformMatrix3fv() which is called at the end, and this function accepts Float32Array and Array\r\n return this;\r\n };\r\n /**\r\n * Sets a 2x2 matrix on a uniform variable. (Speicified as [1,2,3,4] will result in [1,2][3,4] matrix)\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix2x2 = function (uniformName, matrix) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrix2x2(this._uniforms[uniformName], matrix); // the cast is ok because it is gl.uniformMatrix2fv() which is called at the end, and this function accepts Float32Array and Array\r\n return this;\r\n };\r\n /**\r\n * Sets a float on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat = function (uniformName, value) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === value) {\r\n return this;\r\n }\r\n if (this._engine.setFloat(this._uniforms[uniformName], value)) {\r\n this._valueCache[uniformName] = value;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a boolean on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param bool value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setBool = function (uniformName, bool) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === bool) {\r\n return this;\r\n }\r\n if (this._engine.setInt(this._uniforms[uniformName], bool ? 1 : 0)) {\r\n this._valueCache[uniformName] = bool;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector2 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector2 vector2 to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector2 = function (uniformName, vector2) {\r\n if (this._cacheFloat2(uniformName, vector2.x, vector2.y)) {\r\n if (!this._engine.setFloat2(this._uniforms[uniformName], vector2.x, vector2.y)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float2 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float2.\r\n * @param y Second float in float2.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat2 = function (uniformName, x, y) {\r\n if (this._cacheFloat2(uniformName, x, y)) {\r\n if (!this._engine.setFloat2(this._uniforms[uniformName], x, y)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector3 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector3 = function (uniformName, vector3) {\r\n if (this._cacheFloat3(uniformName, vector3.x, vector3.y, vector3.z)) {\r\n if (!this._engine.setFloat3(this._uniforms[uniformName], vector3.x, vector3.y, vector3.z)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float3.\r\n * @param y Second float in float3.\r\n * @param z Third float in float3.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat3 = function (uniformName, x, y, z) {\r\n if (this._cacheFloat3(uniformName, x, y, z)) {\r\n if (!this._engine.setFloat3(this._uniforms[uniformName], x, y, z)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector4 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector4 = function (uniformName, vector4) {\r\n if (this._cacheFloat4(uniformName, vector4.x, vector4.y, vector4.z, vector4.w)) {\r\n if (!this._engine.setFloat4(this._uniforms[uniformName], vector4.x, vector4.y, vector4.z, vector4.w)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float4.\r\n * @param y Second float in float4.\r\n * @param z Third float in float4.\r\n * @param w Fourth float in float4.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat4 = function (uniformName, x, y, z, w) {\r\n if (this._cacheFloat4(uniformName, x, y, z, w)) {\r\n if (!this._engine.setFloat4(this._uniforms[uniformName], x, y, z, w)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param color3 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setColor3 = function (uniformName, color3) {\r\n if (this._cacheFloat3(uniformName, color3.r, color3.g, color3.b)) {\r\n if (!this._engine.setFloat3(this._uniforms[uniformName], color3.r, color3.g, color3.b)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param color3 Value to be set.\r\n * @param alpha Alpha value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setColor4 = function (uniformName, color3, alpha) {\r\n if (this._cacheFloat4(uniformName, color3.r, color3.g, color3.b, alpha)) {\r\n if (!this._engine.setFloat4(this._uniforms[uniformName], color3.r, color3.g, color3.b, alpha)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color4 on a uniform variable\r\n * @param uniformName defines the name of the variable\r\n * @param color4 defines the value to be set\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setDirectColor4 = function (uniformName, color4) {\r\n if (this._cacheFloat4(uniformName, color4.r, color4.g, color4.b, color4.a)) {\r\n if (!this._engine.setFloat4(this._uniforms[uniformName], color4.r, color4.g, color4.b, color4.a)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /** Release all associated resources */\r\n Effect.prototype.dispose = function () {\r\n this._engine._releaseEffect(this);\r\n };\r\n /**\r\n * This function will add a new shader to the shader store\r\n * @param name the name of the shader\r\n * @param pixelShader optional pixel shader content\r\n * @param vertexShader optional vertex shader content\r\n */\r\n Effect.RegisterShader = function (name, pixelShader, vertexShader) {\r\n if (pixelShader) {\r\n Effect.ShadersStore[name + \"PixelShader\"] = pixelShader;\r\n }\r\n if (vertexShader) {\r\n Effect.ShadersStore[name + \"VertexShader\"] = vertexShader;\r\n }\r\n };\r\n /**\r\n * Resets the cache of effects.\r\n */\r\n Effect.ResetCache = function () {\r\n Effect._baseCache = {};\r\n };\r\n /**\r\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\r\n */\r\n Effect.ShadersRepository = \"src/Shaders/\";\r\n /**\r\n * Enable logging of the shader code when a compilation error occurs\r\n */\r\n Effect.LogShaderCodeOnCompilationError = true;\r\n Effect._uniqueIdSeed = 0;\r\n Effect._baseCache = {};\r\n /**\r\n * Store of each shader (The can be looked up using effect.key)\r\n */\r\n Effect.ShadersStore = {};\r\n /**\r\n * Store of each included file for a shader (The can be looked up using effect.key)\r\n */\r\n Effect.IncludesShadersStore = {};\r\n return Effect;\r\n}());\r\nexport { Effect };\r\n//# sourceMappingURL=effect.js.map","/**\r\n * EffectFallbacks can be used to add fallbacks (properties to disable) to certain properties when desired to improve performance.\r\n * (Eg. Start at high quality with reflection and fog, if fps is low, remove reflection, if still low remove fog)\r\n */\r\nvar EffectFallbacks = /** @class */ (function () {\r\n function EffectFallbacks() {\r\n this._defines = {};\r\n this._currentRank = 32;\r\n this._maxRank = -1;\r\n this._mesh = null;\r\n }\r\n /**\r\n * Removes the fallback from the bound mesh.\r\n */\r\n EffectFallbacks.prototype.unBindMesh = function () {\r\n this._mesh = null;\r\n };\r\n /**\r\n * Adds a fallback on the specified property.\r\n * @param rank The rank of the fallback (Lower ranks will be fallbacked to first)\r\n * @param define The name of the define in the shader\r\n */\r\n EffectFallbacks.prototype.addFallback = function (rank, define) {\r\n if (!this._defines[rank]) {\r\n if (rank < this._currentRank) {\r\n this._currentRank = rank;\r\n }\r\n if (rank > this._maxRank) {\r\n this._maxRank = rank;\r\n }\r\n this._defines[rank] = new Array();\r\n }\r\n this._defines[rank].push(define);\r\n };\r\n /**\r\n * Sets the mesh to use CPU skinning when needing to fallback.\r\n * @param rank The rank of the fallback (Lower ranks will be fallbacked to first)\r\n * @param mesh The mesh to use the fallbacks.\r\n */\r\n EffectFallbacks.prototype.addCPUSkinningFallback = function (rank, mesh) {\r\n this._mesh = mesh;\r\n if (rank < this._currentRank) {\r\n this._currentRank = rank;\r\n }\r\n if (rank > this._maxRank) {\r\n this._maxRank = rank;\r\n }\r\n };\r\n Object.defineProperty(EffectFallbacks.prototype, \"hasMoreFallbacks\", {\r\n /**\r\n * Checks to see if more fallbacks are still availible.\r\n */\r\n get: function () {\r\n return this._currentRank <= this._maxRank;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Removes the defines that should be removed when falling back.\r\n * @param currentDefines defines the current define statements for the shader.\r\n * @param effect defines the current effect we try to compile\r\n * @returns The resulting defines with defines of the current rank removed.\r\n */\r\n EffectFallbacks.prototype.reduce = function (currentDefines, effect) {\r\n // First we try to switch to CPU skinning\r\n if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0) {\r\n this._mesh.computeBonesUsingShaders = false;\r\n currentDefines = currentDefines.replace(\"#define NUM_BONE_INFLUENCERS \" + this._mesh.numBoneInfluencers, \"#define NUM_BONE_INFLUENCERS 0\");\r\n effect._bonesComputationForcedToCPU = true;\r\n var scene = this._mesh.getScene();\r\n for (var index = 0; index < scene.meshes.length; index++) {\r\n var otherMesh = scene.meshes[index];\r\n if (!otherMesh.material) {\r\n if (!this._mesh.material && otherMesh.computeBonesUsingShaders && otherMesh.numBoneInfluencers > 0) {\r\n otherMesh.computeBonesUsingShaders = false;\r\n }\r\n continue;\r\n }\r\n if (!otherMesh.computeBonesUsingShaders || otherMesh.numBoneInfluencers === 0) {\r\n continue;\r\n }\r\n if (otherMesh.material.getEffect() === effect) {\r\n otherMesh.computeBonesUsingShaders = false;\r\n }\r\n else if (otherMesh.subMeshes) {\r\n for (var _i = 0, _a = otherMesh.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n var subMeshEffect = subMesh.effect;\r\n if (subMeshEffect === effect) {\r\n otherMesh.computeBonesUsingShaders = false;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n var currentFallbacks = this._defines[this._currentRank];\r\n if (currentFallbacks) {\r\n for (var index = 0; index < currentFallbacks.length; index++) {\r\n currentDefines = currentDefines.replace(\"#define \" + currentFallbacks[index], \"\");\r\n }\r\n }\r\n this._currentRank++;\r\n }\r\n return currentDefines;\r\n };\r\n return EffectFallbacks;\r\n}());\r\nexport { EffectFallbacks };\r\n//# sourceMappingURL=effectFallbacks.js.map","import { __decorate } from \"tslib\";\r\nimport { SerializationHelper, serialize } from \"../Misc/decorators\";\r\nimport { Color4 } from '../Maths/math.color';\r\n/**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\nvar ColorCurves = /** @class */ (function () {\r\n function ColorCurves() {\r\n this._dirty = true;\r\n this._tempColor = new Color4(0, 0, 0, 0);\r\n this._globalCurve = new Color4(0, 0, 0, 0);\r\n this._highlightsCurve = new Color4(0, 0, 0, 0);\r\n this._midtonesCurve = new Color4(0, 0, 0, 0);\r\n this._shadowsCurve = new Color4(0, 0, 0, 0);\r\n this._positiveCurve = new Color4(0, 0, 0, 0);\r\n this._negativeCurve = new Color4(0, 0, 0, 0);\r\n this._globalHue = 30;\r\n this._globalDensity = 0;\r\n this._globalSaturation = 0;\r\n this._globalExposure = 0;\r\n this._highlightsHue = 30;\r\n this._highlightsDensity = 0;\r\n this._highlightsSaturation = 0;\r\n this._highlightsExposure = 0;\r\n this._midtonesHue = 30;\r\n this._midtonesDensity = 0;\r\n this._midtonesSaturation = 0;\r\n this._midtonesExposure = 0;\r\n this._shadowsHue = 30;\r\n this._shadowsDensity = 0;\r\n this._shadowsSaturation = 0;\r\n this._shadowsExposure = 0;\r\n }\r\n Object.defineProperty(ColorCurves.prototype, \"globalHue\", {\r\n /**\r\n * Gets the global Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._globalHue;\r\n },\r\n /**\r\n * Sets the global Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._globalHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"globalDensity\", {\r\n /**\r\n * Gets the global Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._globalDensity;\r\n },\r\n /**\r\n * Sets the global Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._globalDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"globalSaturation\", {\r\n /**\r\n * Gets the global Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._globalSaturation;\r\n },\r\n /**\r\n * Sets the global Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._globalSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"globalExposure\", {\r\n /**\r\n * Gets the global Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._globalExposure;\r\n },\r\n /**\r\n * Sets the global Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._globalExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsHue\", {\r\n /**\r\n * Gets the highlights Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._highlightsHue;\r\n },\r\n /**\r\n * Sets the highlights Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._highlightsHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsDensity\", {\r\n /**\r\n * Gets the highlights Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._highlightsDensity;\r\n },\r\n /**\r\n * Sets the highlights Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._highlightsDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsSaturation\", {\r\n /**\r\n * Gets the highlights Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._highlightsSaturation;\r\n },\r\n /**\r\n * Sets the highlights Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._highlightsSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsExposure\", {\r\n /**\r\n * Gets the highlights Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._highlightsExposure;\r\n },\r\n /**\r\n * Sets the highlights Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._highlightsExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesHue\", {\r\n /**\r\n * Gets the midtones Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._midtonesHue;\r\n },\r\n /**\r\n * Sets the midtones Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._midtonesHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesDensity\", {\r\n /**\r\n * Gets the midtones Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._midtonesDensity;\r\n },\r\n /**\r\n * Sets the midtones Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._midtonesDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesSaturation\", {\r\n /**\r\n * Gets the midtones Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._midtonesSaturation;\r\n },\r\n /**\r\n * Sets the midtones Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._midtonesSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesExposure\", {\r\n /**\r\n * Gets the midtones Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._midtonesExposure;\r\n },\r\n /**\r\n * Sets the midtones Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._midtonesExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsHue\", {\r\n /**\r\n * Gets the shadows Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._shadowsHue;\r\n },\r\n /**\r\n * Sets the shadows Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._shadowsHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsDensity\", {\r\n /**\r\n * Gets the shadows Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._shadowsDensity;\r\n },\r\n /**\r\n * Sets the shadows Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._shadowsDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsSaturation\", {\r\n /**\r\n * Gets the shadows Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._shadowsSaturation;\r\n },\r\n /**\r\n * Sets the shadows Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._shadowsSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsExposure\", {\r\n /**\r\n * Gets the shadows Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._shadowsExposure;\r\n },\r\n /**\r\n * Sets the shadows Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._shadowsExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the class name\r\n * @returns The class name\r\n */\r\n ColorCurves.prototype.getClassName = function () {\r\n return \"ColorCurves\";\r\n };\r\n /**\r\n * Binds the color curves to the shader.\r\n * @param colorCurves The color curve to bind\r\n * @param effect The effect to bind to\r\n * @param positiveUniform The positive uniform shader parameter\r\n * @param neutralUniform The neutral uniform shader parameter\r\n * @param negativeUniform The negative uniform shader parameter\r\n */\r\n ColorCurves.Bind = function (colorCurves, effect, positiveUniform, neutralUniform, negativeUniform) {\r\n if (positiveUniform === void 0) { positiveUniform = \"vCameraColorCurvePositive\"; }\r\n if (neutralUniform === void 0) { neutralUniform = \"vCameraColorCurveNeutral\"; }\r\n if (negativeUniform === void 0) { negativeUniform = \"vCameraColorCurveNegative\"; }\r\n if (colorCurves._dirty) {\r\n colorCurves._dirty = false;\r\n // Fill in global info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._globalHue, colorCurves._globalDensity, colorCurves._globalSaturation, colorCurves._globalExposure, colorCurves._globalCurve);\r\n // Compute highlights info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._highlightsHue, colorCurves._highlightsDensity, colorCurves._highlightsSaturation, colorCurves._highlightsExposure, colorCurves._tempColor);\r\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._highlightsCurve);\r\n // Compute midtones info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._midtonesHue, colorCurves._midtonesDensity, colorCurves._midtonesSaturation, colorCurves._midtonesExposure, colorCurves._tempColor);\r\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._midtonesCurve);\r\n // Compute shadows info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._shadowsHue, colorCurves._shadowsDensity, colorCurves._shadowsSaturation, colorCurves._shadowsExposure, colorCurves._tempColor);\r\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._shadowsCurve);\r\n // Compute deltas (neutral is midtones).\r\n colorCurves._highlightsCurve.subtractToRef(colorCurves._midtonesCurve, colorCurves._positiveCurve);\r\n colorCurves._midtonesCurve.subtractToRef(colorCurves._shadowsCurve, colorCurves._negativeCurve);\r\n }\r\n if (effect) {\r\n effect.setFloat4(positiveUniform, colorCurves._positiveCurve.r, colorCurves._positiveCurve.g, colorCurves._positiveCurve.b, colorCurves._positiveCurve.a);\r\n effect.setFloat4(neutralUniform, colorCurves._midtonesCurve.r, colorCurves._midtonesCurve.g, colorCurves._midtonesCurve.b, colorCurves._midtonesCurve.a);\r\n effect.setFloat4(negativeUniform, colorCurves._negativeCurve.r, colorCurves._negativeCurve.g, colorCurves._negativeCurve.b, colorCurves._negativeCurve.a);\r\n }\r\n };\r\n /**\r\n * Prepare the list of uniforms associated with the ColorCurves effects.\r\n * @param uniformsList The list of uniforms used in the effect\r\n */\r\n ColorCurves.PrepareUniforms = function (uniformsList) {\r\n uniformsList.push(\"vCameraColorCurveNeutral\", \"vCameraColorCurvePositive\", \"vCameraColorCurveNegative\");\r\n };\r\n /**\r\n * Returns color grading data based on a hue, density, saturation and exposure value.\r\n * @param filterHue The hue of the color filter.\r\n * @param filterDensity The density of the color filter.\r\n * @param saturation The saturation.\r\n * @param exposure The exposure.\r\n * @param result The result data container.\r\n */\r\n ColorCurves.prototype.getColorGradingDataToRef = function (hue, density, saturation, exposure, result) {\r\n if (hue == null) {\r\n return;\r\n }\r\n hue = ColorCurves.clamp(hue, 0, 360);\r\n density = ColorCurves.clamp(density, -100, 100);\r\n saturation = ColorCurves.clamp(saturation, -100, 100);\r\n exposure = ColorCurves.clamp(exposure, -100, 100);\r\n // Remap the slider/config filter density with non-linear mapping and also scale by half\r\n // so that the maximum filter density is only 50% control. This provides fine control\r\n // for small values and reasonable range.\r\n density = ColorCurves.applyColorGradingSliderNonlinear(density);\r\n density *= 0.5;\r\n exposure = ColorCurves.applyColorGradingSliderNonlinear(exposure);\r\n if (density < 0) {\r\n density *= -1;\r\n hue = (hue + 180) % 360;\r\n }\r\n ColorCurves.fromHSBToRef(hue, density, 50 + 0.25 * exposure, result);\r\n result.scaleToRef(2, result);\r\n result.a = 1 + 0.01 * saturation;\r\n };\r\n /**\r\n * Takes an input slider value and returns an adjusted value that provides extra control near the centre.\r\n * @param value The input slider value in range [-100,100].\r\n * @returns Adjusted value.\r\n */\r\n ColorCurves.applyColorGradingSliderNonlinear = function (value) {\r\n value /= 100;\r\n var x = Math.abs(value);\r\n x = Math.pow(x, 2);\r\n if (value < 0) {\r\n x *= -1;\r\n }\r\n x *= 100;\r\n return x;\r\n };\r\n /**\r\n * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).\r\n * @param hue The hue (H) input.\r\n * @param saturation The saturation (S) input.\r\n * @param brightness The brightness (B) input.\r\n * @result An RGBA color represented as Vector4.\r\n */\r\n ColorCurves.fromHSBToRef = function (hue, saturation, brightness, result) {\r\n var h = ColorCurves.clamp(hue, 0, 360);\r\n var s = ColorCurves.clamp(saturation / 100, 0, 1);\r\n var v = ColorCurves.clamp(brightness / 100, 0, 1);\r\n if (s === 0) {\r\n result.r = v;\r\n result.g = v;\r\n result.b = v;\r\n }\r\n else {\r\n // sector 0 to 5\r\n h /= 60;\r\n var i = Math.floor(h);\r\n // fractional part of h\r\n var f = h - i;\r\n var p = v * (1 - s);\r\n var q = v * (1 - s * f);\r\n var t = v * (1 - s * (1 - f));\r\n switch (i) {\r\n case 0:\r\n result.r = v;\r\n result.g = t;\r\n result.b = p;\r\n break;\r\n case 1:\r\n result.r = q;\r\n result.g = v;\r\n result.b = p;\r\n break;\r\n case 2:\r\n result.r = p;\r\n result.g = v;\r\n result.b = t;\r\n break;\r\n case 3:\r\n result.r = p;\r\n result.g = q;\r\n result.b = v;\r\n break;\r\n case 4:\r\n result.r = t;\r\n result.g = p;\r\n result.b = v;\r\n break;\r\n default: // case 5:\r\n result.r = v;\r\n result.g = p;\r\n result.b = q;\r\n break;\r\n }\r\n }\r\n result.a = 1;\r\n };\r\n /**\r\n * Returns a value clamped between min and max\r\n * @param value The value to clamp\r\n * @param min The minimum of value\r\n * @param max The maximum of value\r\n * @returns The clamped value.\r\n */\r\n ColorCurves.clamp = function (value, min, max) {\r\n return Math.min(Math.max(value, min), max);\r\n };\r\n /**\r\n * Clones the current color curve instance.\r\n * @return The cloned curves\r\n */\r\n ColorCurves.prototype.clone = function () {\r\n return SerializationHelper.Clone(function () { return new ColorCurves(); }, this);\r\n };\r\n /**\r\n * Serializes the current color curve instance to a json representation.\r\n * @return a JSON representation\r\n */\r\n ColorCurves.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses the color curve from a json representation.\r\n * @param source the JSON source to parse\r\n * @return The parsed curves\r\n */\r\n ColorCurves.Parse = function (source) {\r\n return SerializationHelper.Parse(function () { return new ColorCurves(); }, source, null, null);\r\n };\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_globalHue\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_globalDensity\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_globalSaturation\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_globalExposure\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_highlightsHue\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_highlightsDensity\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_highlightsSaturation\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_highlightsExposure\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_midtonesHue\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_midtonesDensity\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_midtonesSaturation\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_midtonesExposure\", void 0);\r\n return ColorCurves;\r\n}());\r\nexport { ColorCurves };\r\n// References the dependencies.\r\nSerializationHelper._ColorCurvesParser = ColorCurves.Parse;\r\n//# sourceMappingURL=colorCurves.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, SerializationHelper, serializeAsTexture, serializeAsColorCurves, serializeAsColor4 } from \"../Misc/decorators\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport { MaterialDefines } from \"../Materials/materialDefines\";\r\nimport { ColorCurves } from \"../Materials/colorCurves\";\r\n/**\r\n * @hidden\r\n */\r\nvar ImageProcessingConfigurationDefines = /** @class */ (function (_super) {\r\n __extends(ImageProcessingConfigurationDefines, _super);\r\n function ImageProcessingConfigurationDefines() {\r\n var _this = _super.call(this) || this;\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n _this.EXPOSURE = false;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n return ImageProcessingConfigurationDefines;\r\n}(MaterialDefines));\r\nexport { ImageProcessingConfigurationDefines };\r\n/**\r\n * This groups together the common properties used for image processing either in direct forward pass\r\n * or through post processing effect depending on the use of the image processing pipeline in your scene\r\n * or not.\r\n */\r\nvar ImageProcessingConfiguration = /** @class */ (function () {\r\n function ImageProcessingConfiguration() {\r\n /**\r\n * Color curves setup used in the effect if colorCurvesEnabled is set to true\r\n */\r\n this.colorCurves = new ColorCurves();\r\n this._colorCurvesEnabled = false;\r\n this._colorGradingEnabled = false;\r\n this._colorGradingWithGreenDepth = true;\r\n this._colorGradingBGR = true;\r\n /** @hidden */\r\n this._exposure = 1.0;\r\n this._toneMappingEnabled = false;\r\n this._toneMappingType = ImageProcessingConfiguration.TONEMAPPING_STANDARD;\r\n this._contrast = 1.0;\r\n /**\r\n * Vignette stretch size.\r\n */\r\n this.vignetteStretch = 0;\r\n /**\r\n * Vignette centre X Offset.\r\n */\r\n this.vignetteCentreX = 0;\r\n /**\r\n * Vignette centre Y Offset.\r\n */\r\n this.vignetteCentreY = 0;\r\n /**\r\n * Vignette weight or intensity of the vignette effect.\r\n */\r\n this.vignetteWeight = 1.5;\r\n /**\r\n * Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)\r\n * if vignetteEnabled is set to true.\r\n */\r\n this.vignetteColor = new Color4(0, 0, 0, 0);\r\n /**\r\n * Camera field of view used by the Vignette effect.\r\n */\r\n this.vignetteCameraFov = 0.5;\r\n this._vignetteBlendMode = ImageProcessingConfiguration.VIGNETTEMODE_MULTIPLY;\r\n this._vignetteEnabled = false;\r\n this._applyByPostProcess = false;\r\n this._isEnabled = true;\r\n /**\r\n * An event triggered when the configuration changes and requires Shader to Update some parameters.\r\n */\r\n this.onUpdateParameters = new Observable();\r\n }\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this._colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._colorCurvesEnabled === value) {\r\n return;\r\n }\r\n this._colorCurvesEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingTexture\", {\r\n /**\r\n * Color grading LUT texture used in the effect if colorGradingEnabled is set to true\r\n */\r\n get: function () {\r\n return this._colorGradingTexture;\r\n },\r\n /**\r\n * Color grading LUT texture used in the effect if colorGradingEnabled is set to true\r\n */\r\n set: function (value) {\r\n if (this._colorGradingTexture === value) {\r\n return;\r\n }\r\n this._colorGradingTexture = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this._colorGradingEnabled;\r\n },\r\n /**\r\n * Sets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._colorGradingEnabled === value) {\r\n return;\r\n }\r\n this._colorGradingEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingWithGreenDepth\", {\r\n /**\r\n * Gets wether the color grading effect is using a green depth for the 3d Texture.\r\n */\r\n get: function () {\r\n return this._colorGradingWithGreenDepth;\r\n },\r\n /**\r\n * Sets wether the color grading effect is using a green depth for the 3d Texture.\r\n */\r\n set: function (value) {\r\n if (this._colorGradingWithGreenDepth === value) {\r\n return;\r\n }\r\n this._colorGradingWithGreenDepth = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingBGR\", {\r\n /**\r\n * Gets wether the color grading texture contains BGR values.\r\n */\r\n get: function () {\r\n return this._colorGradingBGR;\r\n },\r\n /**\r\n * Sets wether the color grading texture contains BGR values.\r\n */\r\n set: function (value) {\r\n if (this._colorGradingBGR === value) {\r\n return;\r\n }\r\n this._colorGradingBGR = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"exposure\", {\r\n /**\r\n * Gets the Exposure used in the effect.\r\n */\r\n get: function () {\r\n return this._exposure;\r\n },\r\n /**\r\n * Sets the Exposure used in the effect.\r\n */\r\n set: function (value) {\r\n if (this._exposure === value) {\r\n return;\r\n }\r\n this._exposure = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"toneMappingEnabled\", {\r\n /**\r\n * Gets wether the tone mapping effect is enabled.\r\n */\r\n get: function () {\r\n return this._toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether the tone mapping effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._toneMappingEnabled === value) {\r\n return;\r\n }\r\n this._toneMappingEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"toneMappingType\", {\r\n /**\r\n * Gets the type of tone mapping effect.\r\n */\r\n get: function () {\r\n return this._toneMappingType;\r\n },\r\n /**\r\n * Sets the type of tone mapping effect used in BabylonJS.\r\n */\r\n set: function (value) {\r\n if (this._toneMappingType === value) {\r\n return;\r\n }\r\n this._toneMappingType = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"contrast\", {\r\n /**\r\n * Gets the contrast used in the effect.\r\n */\r\n get: function () {\r\n return this._contrast;\r\n },\r\n /**\r\n * Sets the contrast used in the effect.\r\n */\r\n set: function (value) {\r\n if (this._contrast === value) {\r\n return;\r\n }\r\n this._contrast = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"vignetteBlendMode\", {\r\n /**\r\n * Gets the vignette blend mode allowing different kind of effect.\r\n */\r\n get: function () {\r\n return this._vignetteBlendMode;\r\n },\r\n /**\r\n * Sets the vignette blend mode allowing different kind of effect.\r\n */\r\n set: function (value) {\r\n if (this._vignetteBlendMode === value) {\r\n return;\r\n }\r\n this._vignetteBlendMode = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"vignetteEnabled\", {\r\n /**\r\n * Gets wether the vignette effect is enabled.\r\n */\r\n get: function () {\r\n return this._vignetteEnabled;\r\n },\r\n /**\r\n * Sets wether the vignette effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._vignetteEnabled === value) {\r\n return;\r\n }\r\n this._vignetteEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"applyByPostProcess\", {\r\n /**\r\n * Gets wether the image processing is applied through a post process or not.\r\n */\r\n get: function () {\r\n return this._applyByPostProcess;\r\n },\r\n /**\r\n * Sets wether the image processing is applied through a post process or not.\r\n */\r\n set: function (value) {\r\n if (this._applyByPostProcess === value) {\r\n return;\r\n }\r\n this._applyByPostProcess = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"isEnabled\", {\r\n /**\r\n * Gets wether the image processing is enabled or not.\r\n */\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n /**\r\n * Sets wether the image processing is enabled or not.\r\n */\r\n set: function (value) {\r\n if (this._isEnabled === value) {\r\n return;\r\n }\r\n this._isEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Method called each time the image processing information changes requires to recompile the effect.\r\n */\r\n ImageProcessingConfiguration.prototype._updateParameters = function () {\r\n this.onUpdateParameters.notifyObservers(this);\r\n };\r\n /**\r\n * Gets the current class name.\r\n * @return \"ImageProcessingConfiguration\"\r\n */\r\n ImageProcessingConfiguration.prototype.getClassName = function () {\r\n return \"ImageProcessingConfiguration\";\r\n };\r\n /**\r\n * Prepare the list of uniforms associated with the Image Processing effects.\r\n * @param uniforms The list of uniforms used in the effect\r\n * @param defines the list of defines currently in use\r\n */\r\n ImageProcessingConfiguration.PrepareUniforms = function (uniforms, defines) {\r\n if (defines.EXPOSURE) {\r\n uniforms.push(\"exposureLinear\");\r\n }\r\n if (defines.CONTRAST) {\r\n uniforms.push(\"contrast\");\r\n }\r\n if (defines.COLORGRADING) {\r\n uniforms.push(\"colorTransformSettings\");\r\n }\r\n if (defines.VIGNETTE) {\r\n uniforms.push(\"vInverseScreenSize\");\r\n uniforms.push(\"vignetteSettings1\");\r\n uniforms.push(\"vignetteSettings2\");\r\n }\r\n if (defines.COLORCURVES) {\r\n ColorCurves.PrepareUniforms(uniforms);\r\n }\r\n };\r\n /**\r\n * Prepare the list of samplers associated with the Image Processing effects.\r\n * @param samplersList The list of uniforms used in the effect\r\n * @param defines the list of defines currently in use\r\n */\r\n ImageProcessingConfiguration.PrepareSamplers = function (samplersList, defines) {\r\n if (defines.COLORGRADING) {\r\n samplersList.push(\"txColorTransform\");\r\n }\r\n };\r\n /**\r\n * Prepare the list of defines associated to the shader.\r\n * @param defines the list of defines to complete\r\n * @param forPostProcess Define if we are currently in post process mode or not\r\n */\r\n ImageProcessingConfiguration.prototype.prepareDefines = function (defines, forPostProcess) {\r\n if (forPostProcess === void 0) { forPostProcess = false; }\r\n if (forPostProcess !== this.applyByPostProcess || !this._isEnabled) {\r\n defines.VIGNETTE = false;\r\n defines.TONEMAPPING = false;\r\n defines.TONEMAPPING_ACES = false;\r\n defines.CONTRAST = false;\r\n defines.EXPOSURE = false;\r\n defines.COLORCURVES = false;\r\n defines.COLORGRADING = false;\r\n defines.COLORGRADING3D = false;\r\n defines.IMAGEPROCESSING = false;\r\n defines.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess && this._isEnabled;\r\n return;\r\n }\r\n defines.VIGNETTE = this.vignetteEnabled;\r\n defines.VIGNETTEBLENDMODEMULTIPLY = (this.vignetteBlendMode === ImageProcessingConfiguration._VIGNETTEMODE_MULTIPLY);\r\n defines.VIGNETTEBLENDMODEOPAQUE = !defines.VIGNETTEBLENDMODEMULTIPLY;\r\n defines.TONEMAPPING = this.toneMappingEnabled;\r\n switch (this._toneMappingType) {\r\n case ImageProcessingConfiguration.TONEMAPPING_ACES:\r\n defines.TONEMAPPING_ACES = true;\r\n break;\r\n default:\r\n defines.TONEMAPPING_ACES = false;\r\n break;\r\n }\r\n defines.CONTRAST = (this.contrast !== 1.0);\r\n defines.EXPOSURE = (this.exposure !== 1.0);\r\n defines.COLORCURVES = (this.colorCurvesEnabled && !!this.colorCurves);\r\n defines.COLORGRADING = (this.colorGradingEnabled && !!this.colorGradingTexture);\r\n if (defines.COLORGRADING) {\r\n defines.COLORGRADING3D = this.colorGradingTexture.is3D;\r\n }\r\n else {\r\n defines.COLORGRADING3D = false;\r\n }\r\n defines.SAMPLER3DGREENDEPTH = this.colorGradingWithGreenDepth;\r\n defines.SAMPLER3DBGRMAP = this.colorGradingBGR;\r\n defines.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess;\r\n defines.IMAGEPROCESSING = defines.VIGNETTE || defines.TONEMAPPING || defines.CONTRAST || defines.EXPOSURE || defines.COLORCURVES || defines.COLORGRADING;\r\n };\r\n /**\r\n * Returns true if all the image processing information are ready.\r\n * @returns True if ready, otherwise, false\r\n */\r\n ImageProcessingConfiguration.prototype.isReady = function () {\r\n // Color Grading texure can not be none blocking.\r\n return !this.colorGradingEnabled || !this.colorGradingTexture || this.colorGradingTexture.isReady();\r\n };\r\n /**\r\n * Binds the image processing to the shader.\r\n * @param effect The effect to bind to\r\n * @param overrideAspectRatio Override the aspect ratio of the effect\r\n */\r\n ImageProcessingConfiguration.prototype.bind = function (effect, overrideAspectRatio) {\r\n // Color Curves\r\n if (this._colorCurvesEnabled && this.colorCurves) {\r\n ColorCurves.Bind(this.colorCurves, effect);\r\n }\r\n // Vignette\r\n if (this._vignetteEnabled) {\r\n var inverseWidth = 1 / effect.getEngine().getRenderWidth();\r\n var inverseHeight = 1 / effect.getEngine().getRenderHeight();\r\n effect.setFloat2(\"vInverseScreenSize\", inverseWidth, inverseHeight);\r\n var aspectRatio = overrideAspectRatio != null ? overrideAspectRatio : (inverseHeight / inverseWidth);\r\n var vignetteScaleY = Math.tan(this.vignetteCameraFov * 0.5);\r\n var vignetteScaleX = vignetteScaleY * aspectRatio;\r\n var vignetteScaleGeometricMean = Math.sqrt(vignetteScaleX * vignetteScaleY);\r\n vignetteScaleX = Tools.Mix(vignetteScaleX, vignetteScaleGeometricMean, this.vignetteStretch);\r\n vignetteScaleY = Tools.Mix(vignetteScaleY, vignetteScaleGeometricMean, this.vignetteStretch);\r\n effect.setFloat4(\"vignetteSettings1\", vignetteScaleX, vignetteScaleY, -vignetteScaleX * this.vignetteCentreX, -vignetteScaleY * this.vignetteCentreY);\r\n var vignettePower = -2.0 * this.vignetteWeight;\r\n effect.setFloat4(\"vignetteSettings2\", this.vignetteColor.r, this.vignetteColor.g, this.vignetteColor.b, vignettePower);\r\n }\r\n // Exposure\r\n effect.setFloat(\"exposureLinear\", this.exposure);\r\n // Contrast\r\n effect.setFloat(\"contrast\", this.contrast);\r\n // Color transform settings\r\n if (this.colorGradingTexture) {\r\n effect.setTexture(\"txColorTransform\", this.colorGradingTexture);\r\n var textureSize = this.colorGradingTexture.getSize().height;\r\n effect.setFloat4(\"colorTransformSettings\", (textureSize - 1) / textureSize, // textureScale\r\n 0.5 / textureSize, // textureOffset\r\n textureSize, // textureSize\r\n this.colorGradingTexture.level // weight\r\n );\r\n }\r\n };\r\n /**\r\n * Clones the current image processing instance.\r\n * @return The cloned image processing\r\n */\r\n ImageProcessingConfiguration.prototype.clone = function () {\r\n return SerializationHelper.Clone(function () { return new ImageProcessingConfiguration(); }, this);\r\n };\r\n /**\r\n * Serializes the current image processing instance to a json representation.\r\n * @return a JSON representation\r\n */\r\n ImageProcessingConfiguration.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses the image processing from a json representation.\r\n * @param source the JSON source to parse\r\n * @return The parsed image processing\r\n */\r\n ImageProcessingConfiguration.Parse = function (source) {\r\n return SerializationHelper.Parse(function () { return new ImageProcessingConfiguration(); }, source, null, null);\r\n };\r\n Object.defineProperty(ImageProcessingConfiguration, \"VIGNETTEMODE_MULTIPLY\", {\r\n /**\r\n * Used to apply the vignette as a mix with the pixel color.\r\n */\r\n get: function () {\r\n return this._VIGNETTEMODE_MULTIPLY;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration, \"VIGNETTEMODE_OPAQUE\", {\r\n /**\r\n * Used to apply the vignette as a replacement of the pixel color.\r\n */\r\n get: function () {\r\n return this._VIGNETTEMODE_OPAQUE;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Default tone mapping applied in BabylonJS.\r\n */\r\n ImageProcessingConfiguration.TONEMAPPING_STANDARD = 0;\r\n /**\r\n * ACES Tone mapping (used by default in unreal and unity). This can help getting closer\r\n * to other engines rendering to increase portability.\r\n */\r\n ImageProcessingConfiguration.TONEMAPPING_ACES = 1;\r\n // Static constants associated to the image processing.\r\n ImageProcessingConfiguration._VIGNETTEMODE_MULTIPLY = 0;\r\n ImageProcessingConfiguration._VIGNETTEMODE_OPAQUE = 1;\r\n __decorate([\r\n serializeAsColorCurves()\r\n ], ImageProcessingConfiguration.prototype, \"colorCurves\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_colorCurvesEnabled\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"colorGradingTexture\")\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingTexture\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingEnabled\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingWithGreenDepth\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingBGR\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_exposure\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_toneMappingEnabled\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_toneMappingType\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_contrast\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteStretch\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteCentreX\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteCentreY\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteWeight\", void 0);\r\n __decorate([\r\n serializeAsColor4()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteColor\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteCameraFov\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_vignetteBlendMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_vignetteEnabled\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_applyByPostProcess\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_isEnabled\", void 0);\r\n return ImageProcessingConfiguration;\r\n}());\r\nexport { ImageProcessingConfiguration };\r\n// References the dependencies.\r\nSerializationHelper._ImageProcessingConfigurationParser = ImageProcessingConfiguration.Parse;\r\n//# sourceMappingURL=imageProcessingConfiguration.js.map","import { __decorate } from \"tslib\";\r\nimport { Material } from \"./material\";\r\nimport { serialize, expandToProperty, serializeAsTexture, SerializationHelper } from '../Misc/decorators';\r\nimport { MaterialFlags } from './materialFlags';\r\nimport { MaterialHelper } from './materialHelper';\r\n/**\r\n * Define the code related to the detail map parameters of a material\r\n *\r\n * Inspired from:\r\n * Unity: https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@9.0/manual/Mask-Map-and-Detail-Map.html and https://docs.unity3d.com/Manual/StandardShaderMaterialParameterDetail.html\r\n * Unreal: https://docs.unrealengine.com/en-US/Engine/Rendering/Materials/HowTo/DetailTexturing/index.html\r\n * Cryengine: https://docs.cryengine.com/display/SDKDOC2/Detail+Maps\r\n */\r\nvar DetailMapConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new detail map\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function DetailMapConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._texture = null;\r\n /**\r\n * Defines how strongly the detail diffuse/albedo channel is blended with the regular diffuse/albedo texture\r\n * Bigger values mean stronger blending\r\n */\r\n this.diffuseBlendLevel = 1;\r\n /**\r\n * Defines how strongly the detail roughness channel is blended with the regular roughness value\r\n * Bigger values mean stronger blending. Only used with PBR materials\r\n */\r\n this.roughnessBlendLevel = 1;\r\n /**\r\n * Defines how strong the bump effect from the detail map is\r\n * Bigger values mean stronger effect\r\n */\r\n this.bumpLevel = 1;\r\n this._normalBlendMethod = Material.MATERIAL_NORMALBLENDMETHOD_WHITEOUT;\r\n this._isEnabled = false;\r\n /**\r\n * Enable or disable the detail map on this material\r\n */\r\n this.isEnabled = false;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n DetailMapConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Gets whether the submesh is ready to be used or not.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n DetailMapConfiguration.prototype.isReadyForSubMesh = function (defines, scene) {\r\n var engine = scene.getEngine();\r\n if (defines._areTexturesDirty && scene.texturesEnabled) {\r\n if (engine.getCaps().standardDerivatives && this._texture && MaterialFlags.DetailTextureEnabled) {\r\n // Detail texture cannot be not blocking.\r\n if (!this._texture.isReady()) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Update the defines for detail map usage\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n */\r\n DetailMapConfiguration.prototype.prepareDefines = function (defines, scene) {\r\n if (this._isEnabled) {\r\n defines.DETAIL_NORMALBLENDMETHOD = this._normalBlendMethod;\r\n var engine = scene.getEngine();\r\n if (defines._areTexturesDirty) {\r\n if (engine.getCaps().standardDerivatives && this._texture && MaterialFlags.DetailTextureEnabled && this._isEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._texture, defines, \"DETAIL\");\r\n defines.DETAIL_NORMALBLENDMETHOD = this._normalBlendMethod;\r\n }\r\n else {\r\n defines.DETAIL = false;\r\n }\r\n }\r\n }\r\n else {\r\n defines.DETAIL = false;\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param isFrozen defines whether the material is frozen or not.\r\n */\r\n DetailMapConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, isFrozen) {\r\n if (!this._isEnabled) {\r\n return;\r\n }\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (this._texture && MaterialFlags.DetailTextureEnabled) {\r\n uniformBuffer.updateFloat4(\"vDetailInfos\", this._texture.coordinatesIndex, this.diffuseBlendLevel, this.bumpLevel, this.roughnessBlendLevel);\r\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"detail\");\r\n }\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.DetailTextureEnabled) {\r\n uniformBuffer.setTexture(\"detailSampler\", this._texture);\r\n }\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n DetailMapConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n DetailMapConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n DetailMapConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n DetailMapConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n var _a;\r\n if (forceDisposeTextures) {\r\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.dispose();\r\n }\r\n };\r\n /**\r\n * Get the current class name useful for serialization or dynamic coding.\r\n * @returns \"DetailMap\"\r\n */\r\n DetailMapConfiguration.prototype.getClassName = function () {\r\n return \"DetailMap\";\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n DetailMapConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vDetailInfos\");\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n DetailMapConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"detailSampler\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n DetailMapConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vDetailInfos\", 4);\r\n uniformBuffer.addUniform(\"detailMatrix\", 16);\r\n };\r\n /**\r\n * Makes a duplicate of the current instance into another one.\r\n * @param detailMap define the instance where to copy the info\r\n */\r\n DetailMapConfiguration.prototype.copyTo = function (detailMap) {\r\n SerializationHelper.Clone(function () { return detailMap; }, this);\r\n };\r\n /**\r\n * Serializes this detail map instance\r\n * @returns - An object with the serialized instance.\r\n */\r\n DetailMapConfiguration.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses a detail map setting from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n DetailMapConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n SerializationHelper.Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n __decorate([\r\n serializeAsTexture(\"detailTexture\"),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], DetailMapConfiguration.prototype, \"texture\", void 0);\r\n __decorate([\r\n serialize()\r\n ], DetailMapConfiguration.prototype, \"diffuseBlendLevel\", void 0);\r\n __decorate([\r\n serialize()\r\n ], DetailMapConfiguration.prototype, \"roughnessBlendLevel\", void 0);\r\n __decorate([\r\n serialize()\r\n ], DetailMapConfiguration.prototype, \"bumpLevel\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], DetailMapConfiguration.prototype, \"normalBlendMethod\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], DetailMapConfiguration.prototype, \"isEnabled\", void 0);\r\n return DetailMapConfiguration;\r\n}());\r\nexport { DetailMapConfiguration };\r\n//# sourceMappingURL=material.detailMapConfiguration.js.map","import { __assign, __decorate } from \"tslib\";\r\nimport { serialize, SerializationHelper } from \"../Misc/decorators\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { SubMesh } from \"../Meshes/subMesh\";\r\nimport { UniformBuffer } from \"./uniformBuffer\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Plane } from '../Maths/math.plane';\r\n/**\r\n * Base class for the main features of a material in Babylon.js\r\n */\r\nvar Material = /** @class */ (function () {\r\n /**\r\n * Creates a material instance\r\n * @param name defines the name of the material\r\n * @param scene defines the scene to reference\r\n * @param doNotAdd specifies if the material should be added to the scene\r\n */\r\n function Material(name, scene, doNotAdd) {\r\n /**\r\n * Custom shadow depth material to use for shadow rendering instead of the in-built one\r\n */\r\n this.shadowDepthWrapper = null;\r\n /**\r\n * Gets or sets a boolean indicating that the material is allowed (if supported) to do shader hot swapping.\r\n * This means that the material can keep using a previous shader while a new one is being compiled.\r\n * This is mostly used when shader parallel compilation is supported (true by default)\r\n */\r\n this.allowShaderHotSwapping = true;\r\n /**\r\n * Gets or sets user defined metadata\r\n */\r\n this.metadata = null;\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n this.reservedDataStore = null;\r\n /**\r\n * Specifies if the ready state should be checked on each call\r\n */\r\n this.checkReadyOnEveryCall = false;\r\n /**\r\n * Specifies if the ready state should be checked once\r\n */\r\n this.checkReadyOnlyOnce = false;\r\n /**\r\n * The state of the material\r\n */\r\n this.state = \"\";\r\n /**\r\n * The alpha value of the material\r\n */\r\n this._alpha = 1.0;\r\n /**\r\n * Specifies if back face culling is enabled\r\n */\r\n this._backFaceCulling = true;\r\n /**\r\n * Callback triggered when the material is compiled\r\n */\r\n this.onCompiled = null;\r\n /**\r\n * Callback triggered when an error occurs\r\n */\r\n this.onError = null;\r\n /**\r\n * Callback triggered to get the render target textures\r\n */\r\n this.getRenderTargetTextures = null;\r\n /**\r\n * Specifies if the material should be serialized\r\n */\r\n this.doNotSerialize = false;\r\n /**\r\n * @hidden\r\n */\r\n this._storeEffectOnSubMeshes = false;\r\n /**\r\n * Stores the animations for the material\r\n */\r\n this.animations = null;\r\n /**\r\n * An event triggered when the material is disposed\r\n */\r\n this.onDisposeObservable = new Observable();\r\n /**\r\n * An observer which watches for dispose events\r\n */\r\n this._onDisposeObserver = null;\r\n this._onUnBindObservable = null;\r\n /**\r\n * An observer which watches for bind events\r\n */\r\n this._onBindObserver = null;\r\n /**\r\n * Stores the value of the alpha mode\r\n */\r\n this._alphaMode = 2;\r\n /**\r\n * Stores the state of the need depth pre-pass value\r\n */\r\n this._needDepthPrePass = false;\r\n /**\r\n * Specifies if depth writing should be disabled\r\n */\r\n this.disableDepthWrite = false;\r\n /**\r\n * Specifies if color writing should be disabled\r\n */\r\n this.disableColorWrite = false;\r\n /**\r\n * Specifies if depth writing should be forced\r\n */\r\n this.forceDepthWrite = false;\r\n /**\r\n * Specifies the depth function that should be used. 0 means the default engine function\r\n */\r\n this.depthFunction = 0;\r\n /**\r\n * Specifies if there should be a separate pass for culling\r\n */\r\n this.separateCullingPass = false;\r\n /**\r\n * Stores the state specifing if fog should be enabled\r\n */\r\n this._fogEnabled = true;\r\n /**\r\n * Stores the size of points\r\n */\r\n this.pointSize = 1.0;\r\n /**\r\n * Stores the z offset value\r\n */\r\n this.zOffset = 0;\r\n /**\r\n * @hidden\r\n * Stores the effects for the material\r\n */\r\n this._effect = null;\r\n /**\r\n * Specifies if uniform buffers should be used\r\n */\r\n this._useUBO = false;\r\n /**\r\n * Stores the fill mode state\r\n */\r\n this._fillMode = Material.TriangleFillMode;\r\n /**\r\n * Specifies if the depth write state should be cached\r\n */\r\n this._cachedDepthWriteState = false;\r\n /**\r\n * Specifies if the color write state should be cached\r\n */\r\n this._cachedColorWriteState = false;\r\n /**\r\n * Specifies if the depth function state should be cached\r\n */\r\n this._cachedDepthFunctionState = 0;\r\n /** @hidden */\r\n this._indexInSceneMaterialArray = -1;\r\n /** @hidden */\r\n this.meshMap = null;\r\n /**\r\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\r\n */\r\n this._forceAlphaTest = false;\r\n /**\r\n * The transparency mode of the material.\r\n */\r\n this._transparencyMode = null;\r\n this.name = name;\r\n var idSubscript = 1;\r\n this._scene = scene || EngineStore.LastCreatedScene;\r\n this.id = name || Tools.RandomId();\r\n while (this._scene.getMaterialByID(this.id)) {\r\n this.id = name + \" \" + idSubscript++;\r\n }\r\n this.uniqueId = this._scene.getUniqueId();\r\n if (this._scene.useRightHandedSystem) {\r\n this.sideOrientation = Material.ClockWiseSideOrientation;\r\n }\r\n else {\r\n this.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n }\r\n this._uniformBuffer = new UniformBuffer(this._scene.getEngine());\r\n this._useUBO = this.getScene().getEngine().supportsUniformBuffers;\r\n if (!doNotAdd) {\r\n this._scene.addMaterial(this);\r\n }\r\n if (this._scene.useMaterialMeshMap) {\r\n this.meshMap = {};\r\n }\r\n }\r\n Object.defineProperty(Material.prototype, \"canRenderToMRT\", {\r\n /**\r\n * If the material can be rendered to several textures with MRT extension\r\n */\r\n get: function () {\r\n // By default, shaders are not compatible with MRTs\r\n // Base classes should override that if their shader supports MRT\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"alpha\", {\r\n /**\r\n * Gets the alpha value of the material\r\n */\r\n get: function () {\r\n return this._alpha;\r\n },\r\n /**\r\n * Sets the alpha value of the material\r\n */\r\n set: function (value) {\r\n if (this._alpha === value) {\r\n return;\r\n }\r\n this._alpha = value;\r\n this.markAsDirty(Material.MiscDirtyFlag);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"backFaceCulling\", {\r\n /**\r\n * Gets the back-face culling state\r\n */\r\n get: function () {\r\n return this._backFaceCulling;\r\n },\r\n /**\r\n * Sets the back-face culling state\r\n */\r\n set: function (value) {\r\n if (this._backFaceCulling === value) {\r\n return;\r\n }\r\n this._backFaceCulling = value;\r\n this.markAsDirty(Material.TextureDirtyFlag);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"hasRenderTargetTextures\", {\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onDispose\", {\r\n /**\r\n * Called during a dispose event\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onBindObservable\", {\r\n /**\r\n * An event triggered when the material is bound\r\n */\r\n get: function () {\r\n if (!this._onBindObservable) {\r\n this._onBindObservable = new Observable();\r\n }\r\n return this._onBindObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onBind\", {\r\n /**\r\n * Called during a bind event\r\n */\r\n set: function (callback) {\r\n if (this._onBindObserver) {\r\n this.onBindObservable.remove(this._onBindObserver);\r\n }\r\n this._onBindObserver = this.onBindObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onUnBindObservable\", {\r\n /**\r\n * An event triggered when the material is unbound\r\n */\r\n get: function () {\r\n if (!this._onUnBindObservable) {\r\n this._onUnBindObservable = new Observable();\r\n }\r\n return this._onUnBindObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onEffectCreatedObservable\", {\r\n /**\r\n * An event triggered when the effect is (re)created\r\n */\r\n get: function () {\r\n if (!this._onEffectCreatedObservable) {\r\n this._onEffectCreatedObservable = new Observable();\r\n }\r\n return this._onEffectCreatedObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"alphaMode\", {\r\n /**\r\n * Gets the value of the alpha mode\r\n */\r\n get: function () {\r\n return this._alphaMode;\r\n },\r\n /**\r\n * Sets the value of the alpha mode.\r\n *\r\n * | Value | Type | Description |\r\n * | --- | --- | --- |\r\n * | 0 | ALPHA_DISABLE | |\r\n * | 1 | ALPHA_ADD | |\r\n * | 2 | ALPHA_COMBINE | |\r\n * | 3 | ALPHA_SUBTRACT | |\r\n * | 4 | ALPHA_MULTIPLY | |\r\n * | 5 | ALPHA_MAXIMIZED | |\r\n * | 6 | ALPHA_ONEONE | |\r\n * | 7 | ALPHA_PREMULTIPLIED | |\r\n * | 8 | ALPHA_PREMULTIPLIED_PORTERDUFF | |\r\n * | 9 | ALPHA_INTERPOLATE | |\r\n * | 10 | ALPHA_SCREENMODE | |\r\n *\r\n */\r\n set: function (value) {\r\n if (this._alphaMode === value) {\r\n return;\r\n }\r\n this._alphaMode = value;\r\n this.markAsDirty(Material.TextureDirtyFlag);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"needDepthPrePass\", {\r\n /**\r\n * Gets the depth pre-pass value\r\n */\r\n get: function () {\r\n return this._needDepthPrePass;\r\n },\r\n /**\r\n * Sets the need depth pre-pass value\r\n */\r\n set: function (value) {\r\n if (this._needDepthPrePass === value) {\r\n return;\r\n }\r\n this._needDepthPrePass = value;\r\n if (this._needDepthPrePass) {\r\n this.checkReadyOnEveryCall = true;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"fogEnabled\", {\r\n /**\r\n * Gets the value of the fog enabled state\r\n */\r\n get: function () {\r\n return this._fogEnabled;\r\n },\r\n /**\r\n * Sets the state for enabling fog\r\n */\r\n set: function (value) {\r\n if (this._fogEnabled === value) {\r\n return;\r\n }\r\n this._fogEnabled = value;\r\n this.markAsDirty(Material.MiscDirtyFlag);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"wireframe\", {\r\n get: function () {\r\n switch (this._fillMode) {\r\n case Material.WireFrameFillMode:\r\n case Material.LineListDrawMode:\r\n case Material.LineLoopDrawMode:\r\n case Material.LineStripDrawMode:\r\n return true;\r\n }\r\n return this._scene.forceWireframe;\r\n },\r\n /**\r\n * Sets the state of wireframe mode\r\n */\r\n set: function (value) {\r\n this.fillMode = (value ? Material.WireFrameFillMode : Material.TriangleFillMode);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"pointsCloud\", {\r\n /**\r\n * Gets the value specifying if point clouds are enabled\r\n */\r\n get: function () {\r\n switch (this._fillMode) {\r\n case Material.PointFillMode:\r\n case Material.PointListDrawMode:\r\n return true;\r\n }\r\n return this._scene.forcePointsCloud;\r\n },\r\n /**\r\n * Sets the state of point cloud mode\r\n */\r\n set: function (value) {\r\n this.fillMode = (value ? Material.PointFillMode : Material.TriangleFillMode);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"fillMode\", {\r\n /**\r\n * Gets the material fill mode\r\n */\r\n get: function () {\r\n return this._fillMode;\r\n },\r\n /**\r\n * Sets the material fill mode\r\n */\r\n set: function (value) {\r\n if (this._fillMode === value) {\r\n return;\r\n }\r\n this._fillMode = value;\r\n this.markAsDirty(Material.MiscDirtyFlag);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a string representation of the current material\r\n * @param fullDetails defines a boolean indicating which levels of logging is desired\r\n * @returns a string with material information\r\n */\r\n Material.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n if (fullDetails) {\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Gets the class name of the material\r\n * @returns a string with the class name of the material\r\n */\r\n Material.prototype.getClassName = function () {\r\n return \"Material\";\r\n };\r\n Object.defineProperty(Material.prototype, \"isFrozen\", {\r\n /**\r\n * Specifies if updates for the material been locked\r\n */\r\n get: function () {\r\n return this.checkReadyOnlyOnce;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Locks updates for the material\r\n */\r\n Material.prototype.freeze = function () {\r\n this.markDirty();\r\n this.checkReadyOnlyOnce = true;\r\n };\r\n /**\r\n * Unlocks updates for the material\r\n */\r\n Material.prototype.unfreeze = function () {\r\n this.markDirty();\r\n this.checkReadyOnlyOnce = false;\r\n };\r\n /**\r\n * Specifies if the material is ready to be used\r\n * @param mesh defines the mesh to check\r\n * @param useInstances specifies if instances should be used\r\n * @returns a boolean indicating if the material is ready to be used\r\n */\r\n Material.prototype.isReady = function (mesh, useInstances) {\r\n return true;\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n Material.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n return false;\r\n };\r\n /**\r\n * Returns the material effect\r\n * @returns the effect associated with the material\r\n */\r\n Material.prototype.getEffect = function () {\r\n return this._effect;\r\n };\r\n /**\r\n * Returns the current scene\r\n * @returns a Scene\r\n */\r\n Material.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n Object.defineProperty(Material.prototype, \"transparencyMode\", {\r\n /**\r\n * Gets the current transparency mode.\r\n */\r\n get: function () {\r\n return this._transparencyMode;\r\n },\r\n /**\r\n * Sets the transparency mode of the material.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | OPAQUE | |\r\n * | 1 | ALPHATEST | |\r\n * | 2 | ALPHABLEND | |\r\n * | 3 | ALPHATESTANDBLEND | |\r\n *\r\n */\r\n set: function (value) {\r\n if (this._transparencyMode === value) {\r\n return;\r\n }\r\n this._transparencyMode = value;\r\n this._forceAlphaTest = (value === Material.MATERIAL_ALPHATESTANDBLEND);\r\n this._markAllSubMeshesAsTexturesAndMiscDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"_disableAlphaBlending\", {\r\n /**\r\n * Returns true if alpha blending should be disabled.\r\n */\r\n get: function () {\r\n return (this._transparencyMode === Material.MATERIAL_OPAQUE ||\r\n this._transparencyMode === Material.MATERIAL_ALPHATEST);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha blend mode.\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n Material.prototype.needAlphaBlending = function () {\r\n if (this._disableAlphaBlending) {\r\n return false;\r\n }\r\n return (this.alpha < 1.0);\r\n };\r\n /**\r\n * Specifies if the mesh will require alpha blending\r\n * @param mesh defines the mesh to check\r\n * @returns a boolean specifying if alpha blending is needed for the mesh\r\n */\r\n Material.prototype.needAlphaBlendingForMesh = function (mesh) {\r\n if (this._disableAlphaBlending && mesh.visibility >= 1.0) {\r\n return false;\r\n }\r\n return this.needAlphaBlending() || (mesh.visibility < 1.0) || mesh.hasVertexAlpha;\r\n };\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha test mode.\r\n * @returns a boolean specifying if an alpha test is needed.\r\n */\r\n Material.prototype.needAlphaTesting = function () {\r\n if (this._forceAlphaTest) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Specifies if material alpha testing should be turned on for the mesh\r\n * @param mesh defines the mesh to check\r\n */\r\n Material.prototype._shouldTurnAlphaTestOn = function (mesh) {\r\n return (!this.needAlphaBlendingForMesh(mesh) && this.needAlphaTesting());\r\n };\r\n /**\r\n * Gets the texture used for the alpha test\r\n * @returns the texture to use for alpha testing\r\n */\r\n Material.prototype.getAlphaTestTexture = function () {\r\n return null;\r\n };\r\n /**\r\n * Marks the material to indicate that it needs to be re-calculated\r\n */\r\n Material.prototype.markDirty = function () {\r\n var meshes = this.getScene().meshes;\r\n for (var _i = 0, meshes_1 = meshes; _i < meshes_1.length; _i++) {\r\n var mesh = meshes_1[_i];\r\n if (!mesh.subMeshes) {\r\n continue;\r\n }\r\n for (var _a = 0, _b = mesh.subMeshes; _a < _b.length; _a++) {\r\n var subMesh = _b[_a];\r\n if (subMesh.getMaterial() !== this) {\r\n continue;\r\n }\r\n if (!subMesh.effect) {\r\n continue;\r\n }\r\n subMesh.effect._wasPreviouslyReady = false;\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Material.prototype._preBind = function (effect, overrideOrientation) {\r\n if (overrideOrientation === void 0) { overrideOrientation = null; }\r\n var engine = this._scene.getEngine();\r\n var orientation = (overrideOrientation == null) ? this.sideOrientation : overrideOrientation;\r\n var reverse = orientation === Material.ClockWiseSideOrientation;\r\n engine.enableEffect(effect ? effect : this._effect);\r\n engine.setState(this.backFaceCulling, this.zOffset, false, reverse);\r\n return reverse;\r\n };\r\n /**\r\n * Binds the material to the mesh\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh to bind the material to\r\n */\r\n Material.prototype.bind = function (world, mesh) {\r\n };\r\n /**\r\n * Binds the submesh to the material\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n Material.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n };\r\n /**\r\n * Binds the world matrix to the material\r\n * @param world defines the world transformation matrix\r\n */\r\n Material.prototype.bindOnlyWorldMatrix = function (world) {\r\n };\r\n /**\r\n * Binds the scene's uniform buffer to the effect.\r\n * @param effect defines the effect to bind to the scene uniform buffer\r\n * @param sceneUbo defines the uniform buffer storing scene data\r\n */\r\n Material.prototype.bindSceneUniformBuffer = function (effect, sceneUbo) {\r\n sceneUbo.bindToEffect(effect, \"Scene\");\r\n };\r\n /**\r\n * Binds the view matrix to the effect\r\n * @param effect defines the effect to bind the view matrix to\r\n */\r\n Material.prototype.bindView = function (effect) {\r\n if (!this._useUBO) {\r\n effect.setMatrix(\"view\", this.getScene().getViewMatrix());\r\n }\r\n else {\r\n this.bindSceneUniformBuffer(effect, this.getScene().getSceneUniformBuffer());\r\n }\r\n };\r\n /**\r\n * Binds the view projection matrix to the effect\r\n * @param effect defines the effect to bind the view projection matrix to\r\n */\r\n Material.prototype.bindViewProjection = function (effect) {\r\n if (!this._useUBO) {\r\n effect.setMatrix(\"viewProjection\", this.getScene().getTransformMatrix());\r\n }\r\n else {\r\n this.bindSceneUniformBuffer(effect, this.getScene().getSceneUniformBuffer());\r\n }\r\n };\r\n /**\r\n * Processes to execute after binding the material to a mesh\r\n * @param mesh defines the rendered mesh\r\n */\r\n Material.prototype._afterBind = function (mesh) {\r\n this._scene._cachedMaterial = this;\r\n if (mesh) {\r\n this._scene._cachedVisibility = mesh.visibility;\r\n }\r\n else {\r\n this._scene._cachedVisibility = 1;\r\n }\r\n if (this._onBindObservable && mesh) {\r\n this._onBindObservable.notifyObservers(mesh);\r\n }\r\n if (this.disableDepthWrite) {\r\n var engine = this._scene.getEngine();\r\n this._cachedDepthWriteState = engine.getDepthWrite();\r\n engine.setDepthWrite(false);\r\n }\r\n if (this.disableColorWrite) {\r\n var engine = this._scene.getEngine();\r\n this._cachedColorWriteState = engine.getColorWrite();\r\n engine.setColorWrite(false);\r\n }\r\n if (this.depthFunction !== 0) {\r\n var engine = this._scene.getEngine();\r\n this._cachedDepthFunctionState = engine.getDepthFunction() || 0;\r\n engine.setDepthFunction(this.depthFunction);\r\n }\r\n };\r\n /**\r\n * Unbinds the material from the mesh\r\n */\r\n Material.prototype.unbind = function () {\r\n if (this._onUnBindObservable) {\r\n this._onUnBindObservable.notifyObservers(this);\r\n }\r\n if (this.depthFunction !== 0) {\r\n var engine = this._scene.getEngine();\r\n engine.setDepthFunction(this._cachedDepthFunctionState);\r\n }\r\n if (this.disableDepthWrite) {\r\n var engine = this._scene.getEngine();\r\n engine.setDepthWrite(this._cachedDepthWriteState);\r\n }\r\n if (this.disableColorWrite) {\r\n var engine = this._scene.getEngine();\r\n engine.setColorWrite(this._cachedColorWriteState);\r\n }\r\n };\r\n /**\r\n * Gets the active textures from the material\r\n * @returns an array of textures\r\n */\r\n Material.prototype.getActiveTextures = function () {\r\n return [];\r\n };\r\n /**\r\n * Specifies if the material uses a texture\r\n * @param texture defines the texture to check against the material\r\n * @returns a boolean specifying if the material uses the texture\r\n */\r\n Material.prototype.hasTexture = function (texture) {\r\n return false;\r\n };\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n Material.prototype.clone = function (name) {\r\n return null;\r\n };\r\n /**\r\n * Gets the meshes bound to the material\r\n * @returns an array of meshes bound to the material\r\n */\r\n Material.prototype.getBindedMeshes = function () {\r\n var _this = this;\r\n if (this.meshMap) {\r\n var result = new Array();\r\n for (var meshId in this.meshMap) {\r\n var mesh = this.meshMap[meshId];\r\n if (mesh) {\r\n result.push(mesh);\r\n }\r\n }\r\n return result;\r\n }\r\n else {\r\n var meshes = this._scene.meshes;\r\n return meshes.filter(function (mesh) { return mesh.material === _this; });\r\n }\r\n };\r\n /**\r\n * Force shader compilation\r\n * @param mesh defines the mesh associated with this material\r\n * @param onCompiled defines a function to execute once the material is compiled\r\n * @param options defines the options to configure the compilation\r\n * @param onError defines a function to execute if the material fails compiling\r\n */\r\n Material.prototype.forceCompilation = function (mesh, onCompiled, options, onError) {\r\n var _this = this;\r\n var localOptions = __assign({ clipPlane: false, useInstances: false }, options);\r\n var scene = this.getScene();\r\n var currentHotSwapingState = this.allowShaderHotSwapping;\r\n this.allowShaderHotSwapping = false; // Turned off to let us evaluate the real compilation state\r\n var checkReady = function () {\r\n if (!_this._scene || !_this._scene.getEngine()) {\r\n return;\r\n }\r\n var clipPlaneState = scene.clipPlane;\r\n if (localOptions.clipPlane) {\r\n scene.clipPlane = new Plane(0, 0, 0, 1);\r\n }\r\n if (_this._storeEffectOnSubMeshes) {\r\n var allDone = true, lastError = null;\r\n if (mesh.subMeshes) {\r\n var tempSubMesh = new SubMesh(0, 0, 0, 0, 0, mesh, undefined, false, false);\r\n if (tempSubMesh._materialDefines) {\r\n tempSubMesh._materialDefines._renderId = -1;\r\n }\r\n if (!_this.isReadyForSubMesh(mesh, tempSubMesh, localOptions.useInstances)) {\r\n if (tempSubMesh.effect && tempSubMesh.effect.getCompilationError() && tempSubMesh.effect.allFallbacksProcessed()) {\r\n lastError = tempSubMesh.effect.getCompilationError();\r\n }\r\n else {\r\n allDone = false;\r\n setTimeout(checkReady, 16);\r\n }\r\n }\r\n }\r\n if (allDone) {\r\n _this.allowShaderHotSwapping = currentHotSwapingState;\r\n if (lastError) {\r\n if (onError) {\r\n onError(lastError);\r\n }\r\n }\r\n if (onCompiled) {\r\n onCompiled(_this);\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.isReady()) {\r\n _this.allowShaderHotSwapping = currentHotSwapingState;\r\n if (onCompiled) {\r\n onCompiled(_this);\r\n }\r\n }\r\n else {\r\n setTimeout(checkReady, 16);\r\n }\r\n }\r\n if (localOptions.clipPlane) {\r\n scene.clipPlane = clipPlaneState;\r\n }\r\n };\r\n checkReady();\r\n };\r\n /**\r\n * Force shader compilation\r\n * @param mesh defines the mesh that will use this material\r\n * @param options defines additional options for compiling the shaders\r\n * @returns a promise that resolves when the compilation completes\r\n */\r\n Material.prototype.forceCompilationAsync = function (mesh, options) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this.forceCompilation(mesh, function () {\r\n resolve();\r\n }, options, function (reason) {\r\n reject(reason);\r\n });\r\n });\r\n };\r\n /**\r\n * Marks a define in the material to indicate that it needs to be re-computed\r\n * @param flag defines a flag used to determine which parts of the material have to be marked as dirty\r\n */\r\n Material.prototype.markAsDirty = function (flag) {\r\n if (this.getScene().blockMaterialDirtyMechanism) {\r\n return;\r\n }\r\n Material._DirtyCallbackArray.length = 0;\r\n if (flag & Material.TextureDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._TextureDirtyCallBack);\r\n }\r\n if (flag & Material.LightDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._LightsDirtyCallBack);\r\n }\r\n if (flag & Material.FresnelDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._FresnelDirtyCallBack);\r\n }\r\n if (flag & Material.AttributesDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._AttributeDirtyCallBack);\r\n }\r\n if (flag & Material.MiscDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._MiscDirtyCallBack);\r\n }\r\n if (flag & Material.PrePassDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._PrePassDirtyCallBack);\r\n }\r\n if (Material._DirtyCallbackArray.length) {\r\n this._markAllSubMeshesAsDirty(Material._RunDirtyCallBacks);\r\n }\r\n this.getScene().resetCachedMaterial();\r\n };\r\n /**\r\n * Marks all submeshes of a material to indicate that their material defines need to be re-calculated\r\n * @param func defines a function which checks material defines against the submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsDirty = function (func) {\r\n if (this.getScene().blockMaterialDirtyMechanism) {\r\n return;\r\n }\r\n var meshes = this.getScene().meshes;\r\n for (var _i = 0, meshes_2 = meshes; _i < meshes_2.length; _i++) {\r\n var mesh = meshes_2[_i];\r\n if (!mesh.subMeshes) {\r\n continue;\r\n }\r\n for (var _a = 0, _b = mesh.subMeshes; _a < _b.length; _a++) {\r\n var subMesh = _b[_a];\r\n if (subMesh.getMaterial() !== this) {\r\n continue;\r\n }\r\n if (!subMesh._materialDefines) {\r\n continue;\r\n }\r\n func(subMesh._materialDefines);\r\n }\r\n }\r\n };\r\n /**\r\n * Indicates that the scene should check if the rendering now needs a prepass\r\n */\r\n Material.prototype._markScenePrePassDirty = function () {\r\n if (this.getScene().blockMaterialDirtyMechanism) {\r\n return;\r\n }\r\n var prePassRenderer = this.getScene().enablePrePassRenderer();\r\n if (prePassRenderer) {\r\n prePassRenderer.markAsDirty();\r\n }\r\n };\r\n /**\r\n * Indicates that we need to re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsAllDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._AllDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that image processing needs to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsImageProcessingDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._ImageProcessingDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that textures need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._TextureDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that fresnel needs to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsFresnelDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._FresnelDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that fresnel and misc need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsFresnelAndMiscDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._FresnelAndMiscDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that lights need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsLightsDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._LightsDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that attributes need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsAttributesDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._AttributeDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that misc needs to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsMiscDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._MiscDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that prepass needs to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsPrePassDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._MiscDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that textures and misc need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsTexturesAndMiscDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._TextureAndMiscDirtyCallBack);\r\n };\r\n /**\r\n * Sets the required values to the prepass renderer.\r\n * @param prePassRenderer defines the prepass renderer to setup.\r\n * @returns true if the pre pass is needed.\r\n */\r\n Material.prototype.setPrePassRenderer = function (prePassRenderer) {\r\n // Do Nothing by default\r\n return false;\r\n };\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\r\n * @param notBoundToMesh specifies if the material that is being disposed is known to be not bound to any mesh\r\n */\r\n Material.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures, notBoundToMesh) {\r\n var scene = this.getScene();\r\n // Animations\r\n scene.stopAnimation(this);\r\n scene.freeProcessedMaterials();\r\n // Remove from scene\r\n scene.removeMaterial(this);\r\n if (notBoundToMesh !== true) {\r\n // Remove from meshes\r\n if (this.meshMap) {\r\n for (var meshId in this.meshMap) {\r\n var mesh = this.meshMap[meshId];\r\n if (mesh) {\r\n mesh.material = null; // will set the entry in the map to undefined\r\n this.releaseVertexArrayObject(mesh, forceDisposeEffect);\r\n }\r\n }\r\n }\r\n else {\r\n var meshes = scene.meshes;\r\n for (var _i = 0, meshes_3 = meshes; _i < meshes_3.length; _i++) {\r\n var mesh = meshes_3[_i];\r\n if (mesh.material === this && !mesh.sourceMesh) {\r\n mesh.material = null;\r\n this.releaseVertexArrayObject(mesh, forceDisposeEffect);\r\n }\r\n }\r\n }\r\n }\r\n this._uniformBuffer.dispose();\r\n // Shader are kept in cache for further use but we can get rid of this by using forceDisposeEffect\r\n if (forceDisposeEffect && this._effect) {\r\n if (!this._storeEffectOnSubMeshes) {\r\n this._effect.dispose();\r\n }\r\n this._effect = null;\r\n }\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n if (this._onBindObservable) {\r\n this._onBindObservable.clear();\r\n }\r\n if (this._onUnBindObservable) {\r\n this._onUnBindObservable.clear();\r\n }\r\n if (this._onEffectCreatedObservable) {\r\n this._onEffectCreatedObservable.clear();\r\n }\r\n };\r\n /** @hidden */\r\n Material.prototype.releaseVertexArrayObject = function (mesh, forceDisposeEffect) {\r\n if (mesh.geometry) {\r\n var geometry = (mesh.geometry);\r\n if (this._storeEffectOnSubMeshes) {\r\n for (var _i = 0, _a = mesh.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n geometry._releaseVertexArrayObject(subMesh._materialEffect);\r\n if (forceDisposeEffect && subMesh._materialEffect) {\r\n subMesh._materialEffect.dispose();\r\n }\r\n }\r\n }\r\n else {\r\n geometry._releaseVertexArrayObject(this._effect);\r\n }\r\n }\r\n };\r\n /**\r\n * Serializes this material\r\n * @returns the serialized material object\r\n */\r\n Material.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Creates a material from parsed material data\r\n * @param parsedMaterial defines parsed material data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures\r\n * @returns a new material\r\n */\r\n Material.Parse = function (parsedMaterial, scene, rootUrl) {\r\n if (!parsedMaterial.customType) {\r\n parsedMaterial.customType = \"BABYLON.StandardMaterial\";\r\n }\r\n else if (parsedMaterial.customType === \"BABYLON.PBRMaterial\" && parsedMaterial.overloadedAlbedo) {\r\n parsedMaterial.customType = \"BABYLON.LegacyPBRMaterial\";\r\n if (!BABYLON.LegacyPBRMaterial) {\r\n Logger.Error(\"Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library.\");\r\n return null;\r\n }\r\n }\r\n var materialType = Tools.Instantiate(parsedMaterial.customType);\r\n return materialType.Parse(parsedMaterial, scene, rootUrl);\r\n };\r\n /**\r\n * Returns the triangle fill mode\r\n */\r\n Material.TriangleFillMode = 0;\r\n /**\r\n * Returns the wireframe mode\r\n */\r\n Material.WireFrameFillMode = 1;\r\n /**\r\n * Returns the point fill mode\r\n */\r\n Material.PointFillMode = 2;\r\n /**\r\n * Returns the point list draw mode\r\n */\r\n Material.PointListDrawMode = 3;\r\n /**\r\n * Returns the line list draw mode\r\n */\r\n Material.LineListDrawMode = 4;\r\n /**\r\n * Returns the line loop draw mode\r\n */\r\n Material.LineLoopDrawMode = 5;\r\n /**\r\n * Returns the line strip draw mode\r\n */\r\n Material.LineStripDrawMode = 6;\r\n /**\r\n * Returns the triangle strip draw mode\r\n */\r\n Material.TriangleStripDrawMode = 7;\r\n /**\r\n * Returns the triangle fan draw mode\r\n */\r\n Material.TriangleFanDrawMode = 8;\r\n /**\r\n * Stores the clock-wise side orientation\r\n */\r\n Material.ClockWiseSideOrientation = 0;\r\n /**\r\n * Stores the counter clock-wise side orientation\r\n */\r\n Material.CounterClockWiseSideOrientation = 1;\r\n /**\r\n * The dirty texture flag value\r\n */\r\n Material.TextureDirtyFlag = 1;\r\n /**\r\n * The dirty light flag value\r\n */\r\n Material.LightDirtyFlag = 2;\r\n /**\r\n * The dirty fresnel flag value\r\n */\r\n Material.FresnelDirtyFlag = 4;\r\n /**\r\n * The dirty attribute flag value\r\n */\r\n Material.AttributesDirtyFlag = 8;\r\n /**\r\n * The dirty misc flag value\r\n */\r\n Material.MiscDirtyFlag = 16;\r\n /**\r\n * The dirty prepass flag value\r\n */\r\n Material.PrePassDirtyFlag = 32;\r\n /**\r\n * The all dirty flag value\r\n */\r\n Material.AllDirtyFlag = 63;\r\n /**\r\n * MaterialTransparencyMode: No transparency mode, Alpha channel is not use.\r\n */\r\n Material.MATERIAL_OPAQUE = 0;\r\n /**\r\n * MaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\r\n */\r\n Material.MATERIAL_ALPHATEST = 1;\r\n /**\r\n * MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n */\r\n Material.MATERIAL_ALPHABLEND = 2;\r\n /**\r\n * MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n * They are also discarded below the alpha cutoff threshold to improve performances.\r\n */\r\n Material.MATERIAL_ALPHATESTANDBLEND = 3;\r\n /**\r\n * The Whiteout method is used to blend normals.\r\n * Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/\r\n */\r\n Material.MATERIAL_NORMALBLENDMETHOD_WHITEOUT = 0;\r\n /**\r\n * The Reoriented Normal Mapping method is used to blend normals.\r\n * Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/\r\n */\r\n Material.MATERIAL_NORMALBLENDMETHOD_RNM = 1;\r\n Material._AllDirtyCallBack = function (defines) { return defines.markAllAsDirty(); };\r\n Material._ImageProcessingDirtyCallBack = function (defines) { return defines.markAsImageProcessingDirty(); };\r\n Material._TextureDirtyCallBack = function (defines) { return defines.markAsTexturesDirty(); };\r\n Material._FresnelDirtyCallBack = function (defines) { return defines.markAsFresnelDirty(); };\r\n Material._MiscDirtyCallBack = function (defines) { return defines.markAsMiscDirty(); };\r\n Material._PrePassDirtyCallBack = function (defines) { return defines.markAsPrePassDirty(); };\r\n Material._LightsDirtyCallBack = function (defines) { return defines.markAsLightDirty(); };\r\n Material._AttributeDirtyCallBack = function (defines) { return defines.markAsAttributesDirty(); };\r\n Material._FresnelAndMiscDirtyCallBack = function (defines) {\r\n Material._FresnelDirtyCallBack(defines);\r\n Material._MiscDirtyCallBack(defines);\r\n };\r\n Material._TextureAndMiscDirtyCallBack = function (defines) {\r\n Material._TextureDirtyCallBack(defines);\r\n Material._MiscDirtyCallBack(defines);\r\n };\r\n Material._DirtyCallbackArray = [];\r\n Material._RunDirtyCallBacks = function (defines) {\r\n for (var _i = 0, _a = Material._DirtyCallbackArray; _i < _a.length; _i++) {\r\n var cb = _a[_i];\r\n cb(defines);\r\n }\r\n };\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"id\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"uniqueId\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"name\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"checkReadyOnEveryCall\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"checkReadyOnlyOnce\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"state\", void 0);\r\n __decorate([\r\n serialize(\"alpha\")\r\n ], Material.prototype, \"_alpha\", void 0);\r\n __decorate([\r\n serialize(\"backFaceCulling\")\r\n ], Material.prototype, \"_backFaceCulling\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"sideOrientation\", void 0);\r\n __decorate([\r\n serialize(\"alphaMode\")\r\n ], Material.prototype, \"_alphaMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"_needDepthPrePass\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"disableDepthWrite\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"disableColorWrite\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"forceDepthWrite\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"depthFunction\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"separateCullingPass\", void 0);\r\n __decorate([\r\n serialize(\"fogEnabled\")\r\n ], Material.prototype, \"_fogEnabled\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"pointSize\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"zOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"pointsCloud\", null);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"fillMode\", null);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"transparencyMode\", null);\r\n return Material;\r\n}());\r\nexport { Material };\r\n//# sourceMappingURL=material.js.map","/**\r\n * Manages the defines for the Material\r\n */\r\nvar MaterialDefines = /** @class */ (function () {\r\n function MaterialDefines() {\r\n this._isDirty = true;\r\n /** @hidden */\r\n this._areLightsDirty = true;\r\n /** @hidden */\r\n this._areLightsDisposed = false;\r\n /** @hidden */\r\n this._areAttributesDirty = true;\r\n /** @hidden */\r\n this._areTexturesDirty = true;\r\n /** @hidden */\r\n this._areFresnelDirty = true;\r\n /** @hidden */\r\n this._areMiscDirty = true;\r\n /** @hidden */\r\n this._arePrePassDirty = true;\r\n /** @hidden */\r\n this._areImageProcessingDirty = true;\r\n /** @hidden */\r\n this._normals = false;\r\n /** @hidden */\r\n this._uvs = false;\r\n /** @hidden */\r\n this._needNormals = false;\r\n /** @hidden */\r\n this._needUVs = false;\r\n }\r\n Object.defineProperty(MaterialDefines.prototype, \"isDirty\", {\r\n /**\r\n * Specifies if the material needs to be re-calculated\r\n */\r\n get: function () {\r\n return this._isDirty;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Marks the material to indicate that it has been re-calculated\r\n */\r\n MaterialDefines.prototype.markAsProcessed = function () {\r\n this._isDirty = false;\r\n this._areAttributesDirty = false;\r\n this._areTexturesDirty = false;\r\n this._areFresnelDirty = false;\r\n this._areLightsDirty = false;\r\n this._areLightsDisposed = false;\r\n this._areMiscDirty = false;\r\n this._arePrePassDirty = false;\r\n this._areImageProcessingDirty = false;\r\n };\r\n /**\r\n * Marks the material to indicate that it needs to be re-calculated\r\n */\r\n MaterialDefines.prototype.markAsUnprocessed = function () {\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the material to indicate all of its defines need to be re-calculated\r\n */\r\n MaterialDefines.prototype.markAllAsDirty = function () {\r\n this._areTexturesDirty = true;\r\n this._areAttributesDirty = true;\r\n this._areLightsDirty = true;\r\n this._areFresnelDirty = true;\r\n this._areMiscDirty = true;\r\n this._areImageProcessingDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the material to indicate that image processing needs to be re-calculated\r\n */\r\n MaterialDefines.prototype.markAsImageProcessingDirty = function () {\r\n this._areImageProcessingDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the material to indicate the lights need to be re-calculated\r\n * @param disposed Defines whether the light is dirty due to dispose or not\r\n */\r\n MaterialDefines.prototype.markAsLightDirty = function (disposed) {\r\n if (disposed === void 0) { disposed = false; }\r\n this._areLightsDirty = true;\r\n this._areLightsDisposed = this._areLightsDisposed || disposed;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the attribute state as changed\r\n */\r\n MaterialDefines.prototype.markAsAttributesDirty = function () {\r\n this._areAttributesDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the texture state as changed\r\n */\r\n MaterialDefines.prototype.markAsTexturesDirty = function () {\r\n this._areTexturesDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the fresnel state as changed\r\n */\r\n MaterialDefines.prototype.markAsFresnelDirty = function () {\r\n this._areFresnelDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the misc state as changed\r\n */\r\n MaterialDefines.prototype.markAsMiscDirty = function () {\r\n this._areMiscDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the prepass state as changed\r\n */\r\n MaterialDefines.prototype.markAsPrePassDirty = function () {\r\n this._arePrePassDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Rebuilds the material defines\r\n */\r\n MaterialDefines.prototype.rebuild = function () {\r\n this._keys = [];\r\n for (var _i = 0, _a = Object.keys(this); _i < _a.length; _i++) {\r\n var key = _a[_i];\r\n if (key[0] === \"_\") {\r\n continue;\r\n }\r\n this._keys.push(key);\r\n }\r\n };\r\n /**\r\n * Specifies if two material defines are equal\r\n * @param other - A material define instance to compare to\r\n * @returns - Boolean indicating if the material defines are equal (true) or not (false)\r\n */\r\n MaterialDefines.prototype.isEqual = function (other) {\r\n if (this._keys.length !== other._keys.length) {\r\n return false;\r\n }\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n if (this[prop] !== other[prop]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Clones this instance's defines to another instance\r\n * @param other - material defines to clone values to\r\n */\r\n MaterialDefines.prototype.cloneTo = function (other) {\r\n if (this._keys.length !== other._keys.length) {\r\n other._keys = this._keys.slice(0);\r\n }\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n other[prop] = this[prop];\r\n }\r\n };\r\n /**\r\n * Resets the material define values\r\n */\r\n MaterialDefines.prototype.reset = function () {\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n var type = typeof this[prop];\r\n switch (type) {\r\n case \"number\":\r\n this[prop] = 0;\r\n break;\r\n case \"string\":\r\n this[prop] = \"\";\r\n break;\r\n default:\r\n this[prop] = false;\r\n break;\r\n }\r\n }\r\n };\r\n /**\r\n * Converts the material define values to a string\r\n * @returns - String of material define information\r\n */\r\n MaterialDefines.prototype.toString = function () {\r\n var result = \"\";\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n var value = this[prop];\r\n var type = typeof value;\r\n switch (type) {\r\n case \"number\":\r\n case \"string\":\r\n result += \"#define \" + prop + \" \" + value + \"\\n\";\r\n break;\r\n default:\r\n if (value) {\r\n result += \"#define \" + prop + \"\\n\";\r\n }\r\n break;\r\n }\r\n }\r\n return result;\r\n };\r\n return MaterialDefines;\r\n}());\r\nexport { MaterialDefines };\r\n//# sourceMappingURL=materialDefines.js.map","import { Engine } from \"../Engines/engine\";\r\n/**\r\n * This groups all the flags used to control the materials channel.\r\n */\r\nvar MaterialFlags = /** @class */ (function () {\r\n function MaterialFlags() {\r\n }\r\n Object.defineProperty(MaterialFlags, \"DiffuseTextureEnabled\", {\r\n /**\r\n * Are diffuse textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._DiffuseTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._DiffuseTextureEnabled === value) {\r\n return;\r\n }\r\n this._DiffuseTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"DetailTextureEnabled\", {\r\n /**\r\n * Are detail textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._DetailTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._DetailTextureEnabled === value) {\r\n return;\r\n }\r\n this._DetailTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"AmbientTextureEnabled\", {\r\n /**\r\n * Are ambient textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._AmbientTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._AmbientTextureEnabled === value) {\r\n return;\r\n }\r\n this._AmbientTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"OpacityTextureEnabled\", {\r\n /**\r\n * Are opacity textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._OpacityTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._OpacityTextureEnabled === value) {\r\n return;\r\n }\r\n this._OpacityTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ReflectionTextureEnabled\", {\r\n /**\r\n * Are reflection textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ReflectionTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ReflectionTextureEnabled === value) {\r\n return;\r\n }\r\n this._ReflectionTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"EmissiveTextureEnabled\", {\r\n /**\r\n * Are emissive textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._EmissiveTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._EmissiveTextureEnabled === value) {\r\n return;\r\n }\r\n this._EmissiveTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"SpecularTextureEnabled\", {\r\n /**\r\n * Are specular textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._SpecularTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._SpecularTextureEnabled === value) {\r\n return;\r\n }\r\n this._SpecularTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"BumpTextureEnabled\", {\r\n /**\r\n * Are bump textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._BumpTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._BumpTextureEnabled === value) {\r\n return;\r\n }\r\n this._BumpTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"LightmapTextureEnabled\", {\r\n /**\r\n * Are lightmap textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._LightmapTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._LightmapTextureEnabled === value) {\r\n return;\r\n }\r\n this._LightmapTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"RefractionTextureEnabled\", {\r\n /**\r\n * Are refraction textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._RefractionTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._RefractionTextureEnabled === value) {\r\n return;\r\n }\r\n this._RefractionTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ColorGradingTextureEnabled\", {\r\n /**\r\n * Are color grading textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ColorGradingTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ColorGradingTextureEnabled === value) {\r\n return;\r\n }\r\n this._ColorGradingTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"FresnelEnabled\", {\r\n /**\r\n * Are fresnels enabled in the application.\r\n */\r\n get: function () {\r\n return this._FresnelEnabled;\r\n },\r\n set: function (value) {\r\n if (this._FresnelEnabled === value) {\r\n return;\r\n }\r\n this._FresnelEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(4);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ClearCoatTextureEnabled\", {\r\n /**\r\n * Are clear coat textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ClearCoatTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ClearCoatTextureEnabled === value) {\r\n return;\r\n }\r\n this._ClearCoatTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ClearCoatBumpTextureEnabled\", {\r\n /**\r\n * Are clear coat bump textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ClearCoatBumpTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ClearCoatBumpTextureEnabled === value) {\r\n return;\r\n }\r\n this._ClearCoatBumpTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ClearCoatTintTextureEnabled\", {\r\n /**\r\n * Are clear coat tint textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ClearCoatTintTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ClearCoatTintTextureEnabled === value) {\r\n return;\r\n }\r\n this._ClearCoatTintTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"SheenTextureEnabled\", {\r\n /**\r\n * Are sheen textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._SheenTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._SheenTextureEnabled === value) {\r\n return;\r\n }\r\n this._SheenTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"AnisotropicTextureEnabled\", {\r\n /**\r\n * Are anisotropic textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._AnisotropicTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._AnisotropicTextureEnabled === value) {\r\n return;\r\n }\r\n this._AnisotropicTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ThicknessTextureEnabled\", {\r\n /**\r\n * Are thickness textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ThicknessTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ThicknessTextureEnabled === value) {\r\n return;\r\n }\r\n this._ThicknessTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Flags used to enable or disable a type of texture for all Standard Materials\r\n MaterialFlags._DiffuseTextureEnabled = true;\r\n MaterialFlags._DetailTextureEnabled = true;\r\n MaterialFlags._AmbientTextureEnabled = true;\r\n MaterialFlags._OpacityTextureEnabled = true;\r\n MaterialFlags._ReflectionTextureEnabled = true;\r\n MaterialFlags._EmissiveTextureEnabled = true;\r\n MaterialFlags._SpecularTextureEnabled = true;\r\n MaterialFlags._BumpTextureEnabled = true;\r\n MaterialFlags._LightmapTextureEnabled = true;\r\n MaterialFlags._RefractionTextureEnabled = true;\r\n MaterialFlags._ColorGradingTextureEnabled = true;\r\n MaterialFlags._FresnelEnabled = true;\r\n MaterialFlags._ClearCoatTextureEnabled = true;\r\n MaterialFlags._ClearCoatBumpTextureEnabled = true;\r\n MaterialFlags._ClearCoatTintTextureEnabled = true;\r\n MaterialFlags._SheenTextureEnabled = true;\r\n MaterialFlags._AnisotropicTextureEnabled = true;\r\n MaterialFlags._ThicknessTextureEnabled = true;\r\n return MaterialFlags;\r\n}());\r\nexport { MaterialFlags };\r\n//# sourceMappingURL=materialFlags.js.map","/**\r\n * \"Static Class\" containing a few commonly used helper while dealing with material for rendering purpose.\r\n *\r\n * It is complementary with MaterialHelper but provides completely independent functions (for tree shaking sake)\r\n *\r\n * This works by convention in BabylonJS but is meant to be use only with shader following the in place naming rules and conventions.\r\n */\r\nvar ThinMaterialHelper = /** @class */ (function () {\r\n function ThinMaterialHelper() {\r\n }\r\n /**\r\n * Binds the clip plane information from the holder to the effect.\r\n * @param effect The effect we are binding the data to\r\n * @param holder The entity containing the clip plane information\r\n */\r\n ThinMaterialHelper.BindClipPlane = function (effect, holder) {\r\n if (holder.clipPlane) {\r\n var clipPlane = holder.clipPlane;\r\n effect.setFloat4(\"vClipPlane\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (holder.clipPlane2) {\r\n var clipPlane = holder.clipPlane2;\r\n effect.setFloat4(\"vClipPlane2\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (holder.clipPlane3) {\r\n var clipPlane = holder.clipPlane3;\r\n effect.setFloat4(\"vClipPlane3\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (holder.clipPlane4) {\r\n var clipPlane = holder.clipPlane4;\r\n effect.setFloat4(\"vClipPlane4\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (holder.clipPlane5) {\r\n var clipPlane = holder.clipPlane5;\r\n effect.setFloat4(\"vClipPlane5\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (holder.clipPlane6) {\r\n var clipPlane = holder.clipPlane6;\r\n effect.setFloat4(\"vClipPlane6\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n };\r\n return ThinMaterialHelper;\r\n}());\r\nexport { ThinMaterialHelper };\r\n//# sourceMappingURL=thinMaterialHelper.js.map","import { Logger } from \"../Misc/logger\";\r\nimport { Scene } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { Light } from \"../Lights/light\";\r\nimport { Color3 } from '../Maths/math.color';\r\nimport { ThinMaterialHelper } from './thinMaterialHelper';\r\n/**\r\n * \"Static Class\" containing the most commonly used helper while dealing with material for rendering purpose.\r\n *\r\n * It contains the basic tools to help defining defines, binding uniform for the common part of the materials.\r\n *\r\n * This works by convention in BabylonJS but is meant to be use only with shader following the in place naming rules and conventions.\r\n */\r\nvar MaterialHelper = /** @class */ (function () {\r\n function MaterialHelper() {\r\n }\r\n /**\r\n * Bind the current view position to an effect.\r\n * @param effect The effect to be bound\r\n * @param scene The scene the eyes position is used from\r\n * @param variableName name of the shader variable that will hold the eye position\r\n */\r\n MaterialHelper.BindEyePosition = function (effect, scene, variableName) {\r\n if (variableName === void 0) { variableName = \"vEyePosition\"; }\r\n if (scene._forcedViewPosition) {\r\n effect.setVector3(variableName, scene._forcedViewPosition);\r\n return;\r\n }\r\n var globalPosition = scene.activeCamera.globalPosition;\r\n if (!globalPosition) {\r\n // Use WebVRFreecamera's device position as global position is not it's actual position in babylon space\r\n globalPosition = scene.activeCamera.devicePosition;\r\n }\r\n effect.setVector3(variableName, scene._mirroredCameraPosition ? scene._mirroredCameraPosition : globalPosition);\r\n };\r\n /**\r\n * Helps preparing the defines values about the UVs in used in the effect.\r\n * UVs are shared as much as we can accross channels in the shaders.\r\n * @param texture The texture we are preparing the UVs for\r\n * @param defines The defines to update\r\n * @param key The channel key \"diffuse\", \"specular\"... used in the shader\r\n */\r\n MaterialHelper.PrepareDefinesForMergedUV = function (texture, defines, key) {\r\n defines._needUVs = true;\r\n defines[key] = true;\r\n if (texture.getTextureMatrix().isIdentityAs3x2()) {\r\n defines[key + \"DIRECTUV\"] = texture.coordinatesIndex + 1;\r\n if (texture.coordinatesIndex === 0) {\r\n defines[\"MAINUV1\"] = true;\r\n }\r\n else {\r\n defines[\"MAINUV2\"] = true;\r\n }\r\n }\r\n else {\r\n defines[key + \"DIRECTUV\"] = 0;\r\n }\r\n };\r\n /**\r\n * Binds a texture matrix value to its corrsponding uniform\r\n * @param texture The texture to bind the matrix for\r\n * @param uniformBuffer The uniform buffer receivin the data\r\n * @param key The channel key \"diffuse\", \"specular\"... used in the shader\r\n */\r\n MaterialHelper.BindTextureMatrix = function (texture, uniformBuffer, key) {\r\n var matrix = texture.getTextureMatrix();\r\n uniformBuffer.updateMatrix(key + \"Matrix\", matrix);\r\n };\r\n /**\r\n * Gets the current status of the fog (should it be enabled?)\r\n * @param mesh defines the mesh to evaluate for fog support\r\n * @param scene defines the hosting scene\r\n * @returns true if fog must be enabled\r\n */\r\n MaterialHelper.GetFogState = function (mesh, scene) {\r\n return (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE);\r\n };\r\n /**\r\n * Helper used to prepare the list of defines associated with misc. values for shader compilation\r\n * @param mesh defines the current mesh\r\n * @param scene defines the current scene\r\n * @param useLogarithmicDepth defines if logarithmic depth has to be turned on\r\n * @param pointsCloud defines if point cloud rendering has to be turned on\r\n * @param fogEnabled defines if fog has to be turned on\r\n * @param alphaTest defines if alpha testing has to be turned on\r\n * @param defines defines the current list of defines\r\n */\r\n MaterialHelper.PrepareDefinesForMisc = function (mesh, scene, useLogarithmicDepth, pointsCloud, fogEnabled, alphaTest, defines) {\r\n if (defines._areMiscDirty) {\r\n defines[\"LOGARITHMICDEPTH\"] = useLogarithmicDepth;\r\n defines[\"POINTSIZE\"] = pointsCloud;\r\n defines[\"FOG\"] = fogEnabled && this.GetFogState(mesh, scene);\r\n defines[\"NONUNIFORMSCALING\"] = mesh.nonUniformScaling;\r\n defines[\"ALPHATEST\"] = alphaTest;\r\n }\r\n };\r\n /**\r\n * Helper used to prepare the list of defines associated with frame values for shader compilation\r\n * @param scene defines the current scene\r\n * @param engine defines the current engine\r\n * @param defines specifies the list of active defines\r\n * @param useInstances defines if instances have to be turned on\r\n * @param useClipPlane defines if clip plane have to be turned on\r\n * @param useInstances defines if instances have to be turned on\r\n * @param useThinInstances defines if thin instances have to be turned on\r\n */\r\n MaterialHelper.PrepareDefinesForFrameBoundValues = function (scene, engine, defines, useInstances, useClipPlane, useThinInstances) {\r\n if (useClipPlane === void 0) { useClipPlane = null; }\r\n if (useThinInstances === void 0) { useThinInstances = false; }\r\n var changed = false;\r\n var useClipPlane1 = false;\r\n var useClipPlane2 = false;\r\n var useClipPlane3 = false;\r\n var useClipPlane4 = false;\r\n var useClipPlane5 = false;\r\n var useClipPlane6 = false;\r\n useClipPlane1 = useClipPlane == null ? (scene.clipPlane !== undefined && scene.clipPlane !== null) : useClipPlane;\r\n useClipPlane2 = useClipPlane == null ? (scene.clipPlane2 !== undefined && scene.clipPlane2 !== null) : useClipPlane;\r\n useClipPlane3 = useClipPlane == null ? (scene.clipPlane3 !== undefined && scene.clipPlane3 !== null) : useClipPlane;\r\n useClipPlane4 = useClipPlane == null ? (scene.clipPlane4 !== undefined && scene.clipPlane4 !== null) : useClipPlane;\r\n useClipPlane5 = useClipPlane == null ? (scene.clipPlane5 !== undefined && scene.clipPlane5 !== null) : useClipPlane;\r\n useClipPlane6 = useClipPlane == null ? (scene.clipPlane6 !== undefined && scene.clipPlane6 !== null) : useClipPlane;\r\n if (defines[\"CLIPPLANE\"] !== useClipPlane1) {\r\n defines[\"CLIPPLANE\"] = useClipPlane1;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE2\"] !== useClipPlane2) {\r\n defines[\"CLIPPLANE2\"] = useClipPlane2;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE3\"] !== useClipPlane3) {\r\n defines[\"CLIPPLANE3\"] = useClipPlane3;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE4\"] !== useClipPlane4) {\r\n defines[\"CLIPPLANE4\"] = useClipPlane4;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE5\"] !== useClipPlane5) {\r\n defines[\"CLIPPLANE5\"] = useClipPlane5;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE6\"] !== useClipPlane6) {\r\n defines[\"CLIPPLANE6\"] = useClipPlane6;\r\n changed = true;\r\n }\r\n if (defines[\"DEPTHPREPASS\"] !== !engine.getColorWrite()) {\r\n defines[\"DEPTHPREPASS\"] = !defines[\"DEPTHPREPASS\"];\r\n changed = true;\r\n }\r\n if (defines[\"INSTANCES\"] !== useInstances) {\r\n defines[\"INSTANCES\"] = useInstances;\r\n changed = true;\r\n }\r\n if (defines[\"THIN_INSTANCES\"] !== useThinInstances) {\r\n defines[\"THIN_INSTANCES\"] = useThinInstances;\r\n changed = true;\r\n }\r\n if (changed) {\r\n defines.markAsUnprocessed();\r\n }\r\n };\r\n /**\r\n * Prepares the defines for bones\r\n * @param mesh The mesh containing the geometry data we will draw\r\n * @param defines The defines to update\r\n */\r\n MaterialHelper.PrepareDefinesForBones = function (mesh, defines) {\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n defines[\"NUM_BONE_INFLUENCERS\"] = mesh.numBoneInfluencers;\r\n var materialSupportsBoneTexture = defines[\"BONETEXTURE\"] !== undefined;\r\n if (mesh.skeleton.isUsingTextureForMatrices && materialSupportsBoneTexture) {\r\n defines[\"BONETEXTURE\"] = true;\r\n }\r\n else {\r\n defines[\"BonesPerMesh\"] = (mesh.skeleton.bones.length + 1);\r\n defines[\"BONETEXTURE\"] = materialSupportsBoneTexture ? false : undefined;\r\n var prePassRenderer = mesh.getScene().prePassRenderer;\r\n if (prePassRenderer && prePassRenderer.enabled) {\r\n var nonExcluded = prePassRenderer.excludedSkinnedMesh.indexOf(mesh) === -1;\r\n defines[\"BONES_VELOCITY_ENABLED\"] = nonExcluded;\r\n }\r\n }\r\n }\r\n else {\r\n defines[\"NUM_BONE_INFLUENCERS\"] = 0;\r\n defines[\"BonesPerMesh\"] = 0;\r\n }\r\n };\r\n /**\r\n * Prepares the defines for morph targets\r\n * @param mesh The mesh containing the geometry data we will draw\r\n * @param defines The defines to update\r\n */\r\n MaterialHelper.PrepareDefinesForMorphTargets = function (mesh, defines) {\r\n var manager = mesh.morphTargetManager;\r\n if (manager) {\r\n defines[\"MORPHTARGETS_UV\"] = manager.supportsUVs && defines[\"UV1\"];\r\n defines[\"MORPHTARGETS_TANGENT\"] = manager.supportsTangents && defines[\"TANGENT\"];\r\n defines[\"MORPHTARGETS_NORMAL\"] = manager.supportsNormals && defines[\"NORMAL\"];\r\n defines[\"MORPHTARGETS\"] = (manager.numInfluencers > 0);\r\n defines[\"NUM_MORPH_INFLUENCERS\"] = manager.numInfluencers;\r\n }\r\n else {\r\n defines[\"MORPHTARGETS_UV\"] = false;\r\n defines[\"MORPHTARGETS_TANGENT\"] = false;\r\n defines[\"MORPHTARGETS_NORMAL\"] = false;\r\n defines[\"MORPHTARGETS\"] = false;\r\n defines[\"NUM_MORPH_INFLUENCERS\"] = 0;\r\n }\r\n };\r\n /**\r\n * Prepares the defines used in the shader depending on the attributes data available in the mesh\r\n * @param mesh The mesh containing the geometry data we will draw\r\n * @param defines The defines to update\r\n * @param useVertexColor Precise whether vertex colors should be used or not (override mesh info)\r\n * @param useBones Precise whether bones should be used or not (override mesh info)\r\n * @param useMorphTargets Precise whether morph targets should be used or not (override mesh info)\r\n * @param useVertexAlpha Precise whether vertex alpha should be used or not (override mesh info)\r\n * @returns false if defines are considered not dirty and have not been checked\r\n */\r\n MaterialHelper.PrepareDefinesForAttributes = function (mesh, defines, useVertexColor, useBones, useMorphTargets, useVertexAlpha) {\r\n if (useMorphTargets === void 0) { useMorphTargets = false; }\r\n if (useVertexAlpha === void 0) { useVertexAlpha = true; }\r\n if (!defines._areAttributesDirty && defines._needNormals === defines._normals && defines._needUVs === defines._uvs) {\r\n return false;\r\n }\r\n defines._normals = defines._needNormals;\r\n defines._uvs = defines._needUVs;\r\n defines[\"NORMAL\"] = (defines._needNormals && mesh.isVerticesDataPresent(VertexBuffer.NormalKind));\r\n if (defines._needNormals && mesh.isVerticesDataPresent(VertexBuffer.TangentKind)) {\r\n defines[\"TANGENT\"] = true;\r\n }\r\n if (defines._needUVs) {\r\n defines[\"UV1\"] = mesh.isVerticesDataPresent(VertexBuffer.UVKind);\r\n defines[\"UV2\"] = mesh.isVerticesDataPresent(VertexBuffer.UV2Kind);\r\n }\r\n else {\r\n defines[\"UV1\"] = false;\r\n defines[\"UV2\"] = false;\r\n }\r\n if (useVertexColor) {\r\n var hasVertexColors = mesh.useVertexColors && mesh.isVerticesDataPresent(VertexBuffer.ColorKind);\r\n defines[\"VERTEXCOLOR\"] = hasVertexColors;\r\n defines[\"VERTEXALPHA\"] = mesh.hasVertexAlpha && hasVertexColors && useVertexAlpha;\r\n }\r\n if (useBones) {\r\n this.PrepareDefinesForBones(mesh, defines);\r\n }\r\n if (useMorphTargets) {\r\n this.PrepareDefinesForMorphTargets(mesh, defines);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Prepares the defines related to multiview\r\n * @param scene The scene we are intending to draw\r\n * @param defines The defines to update\r\n */\r\n MaterialHelper.PrepareDefinesForMultiview = function (scene, defines) {\r\n if (scene.activeCamera) {\r\n var previousMultiview = defines.MULTIVIEW;\r\n defines.MULTIVIEW = (scene.activeCamera.outputRenderTarget !== null && scene.activeCamera.outputRenderTarget.getViewCount() > 1);\r\n if (defines.MULTIVIEW != previousMultiview) {\r\n defines.markAsUnprocessed();\r\n }\r\n }\r\n };\r\n /**\r\n * Prepares the defines related to the prepass\r\n * @param scene The scene we are intending to draw\r\n * @param defines The defines to update\r\n * @param canRenderToMRT Indicates if this material renders to several textures in the prepass\r\n */\r\n MaterialHelper.PrepareDefinesForPrePass = function (scene, defines, canRenderToMRT) {\r\n var previousPrePass = defines.PREPASS;\r\n if (!defines._arePrePassDirty) {\r\n return;\r\n }\r\n var texturesList = [\r\n {\r\n type: 1,\r\n define: \"PREPASS_POSITION\",\r\n index: \"PREPASS_POSITION_INDEX\",\r\n },\r\n {\r\n type: 2,\r\n define: \"PREPASS_VELOCITY\",\r\n index: \"PREPASS_VELOCITY_INDEX\",\r\n },\r\n {\r\n type: 3,\r\n define: \"PREPASS_REFLECTIVITY\",\r\n index: \"PREPASS_REFLECTIVITY_INDEX\",\r\n },\r\n {\r\n type: 0,\r\n define: \"PREPASS_IRRADIANCE\",\r\n index: \"PREPASS_IRRADIANCE_INDEX\",\r\n },\r\n {\r\n type: 6,\r\n define: \"PREPASS_ALBEDO\",\r\n index: \"PREPASS_ALBEDO_INDEX\",\r\n },\r\n {\r\n type: 5,\r\n define: \"PREPASS_DEPTHNORMAL\",\r\n index: \"PREPASS_DEPTHNORMAL_INDEX\",\r\n }\r\n ];\r\n if (scene.prePassRenderer && scene.prePassRenderer.enabled && canRenderToMRT) {\r\n defines.PREPASS = true;\r\n defines.SCENE_MRT_COUNT = scene.prePassRenderer.mrtCount;\r\n for (var i = 0; i < texturesList.length; i++) {\r\n var index = scene.prePassRenderer.getIndex(texturesList[i].type);\r\n if (index !== -1) {\r\n defines[texturesList[i].define] = true;\r\n defines[texturesList[i].index] = index;\r\n }\r\n else {\r\n defines[texturesList[i].define] = false;\r\n }\r\n }\r\n }\r\n else {\r\n defines.PREPASS = false;\r\n for (var i = 0; i < texturesList.length; i++) {\r\n defines[texturesList[i].define] = false;\r\n }\r\n }\r\n if (defines.PREPASS != previousPrePass) {\r\n defines.markAsUnprocessed();\r\n defines.markAsImageProcessingDirty();\r\n }\r\n };\r\n /**\r\n * Prepares the defines related to the light information passed in parameter\r\n * @param scene The scene we are intending to draw\r\n * @param mesh The mesh the effect is compiling for\r\n * @param light The light the effect is compiling for\r\n * @param lightIndex The index of the light\r\n * @param defines The defines to update\r\n * @param specularSupported Specifies whether specular is supported or not (override lights data)\r\n * @param state Defines the current state regarding what is needed (normals, etc...)\r\n */\r\n MaterialHelper.PrepareDefinesForLight = function (scene, mesh, light, lightIndex, defines, specularSupported, state) {\r\n state.needNormals = true;\r\n if (defines[\"LIGHT\" + lightIndex] === undefined) {\r\n state.needRebuild = true;\r\n }\r\n defines[\"LIGHT\" + lightIndex] = true;\r\n defines[\"SPOTLIGHT\" + lightIndex] = false;\r\n defines[\"HEMILIGHT\" + lightIndex] = false;\r\n defines[\"POINTLIGHT\" + lightIndex] = false;\r\n defines[\"DIRLIGHT\" + lightIndex] = false;\r\n light.prepareLightSpecificDefines(defines, lightIndex);\r\n // FallOff.\r\n defines[\"LIGHT_FALLOFF_PHYSICAL\" + lightIndex] = false;\r\n defines[\"LIGHT_FALLOFF_GLTF\" + lightIndex] = false;\r\n defines[\"LIGHT_FALLOFF_STANDARD\" + lightIndex] = false;\r\n switch (light.falloffType) {\r\n case Light.FALLOFF_GLTF:\r\n defines[\"LIGHT_FALLOFF_GLTF\" + lightIndex] = true;\r\n break;\r\n case Light.FALLOFF_PHYSICAL:\r\n defines[\"LIGHT_FALLOFF_PHYSICAL\" + lightIndex] = true;\r\n break;\r\n case Light.FALLOFF_STANDARD:\r\n defines[\"LIGHT_FALLOFF_STANDARD\" + lightIndex] = true;\r\n break;\r\n }\r\n // Specular\r\n if (specularSupported && !light.specular.equalsFloats(0, 0, 0)) {\r\n state.specularEnabled = true;\r\n }\r\n // Shadows\r\n defines[\"SHADOW\" + lightIndex] = false;\r\n defines[\"SHADOWCSM\" + lightIndex] = false;\r\n defines[\"SHADOWCSMDEBUG\" + lightIndex] = false;\r\n defines[\"SHADOWCSMNUM_CASCADES\" + lightIndex] = false;\r\n defines[\"SHADOWCSMUSESHADOWMAXZ\" + lightIndex] = false;\r\n defines[\"SHADOWCSMNOBLEND\" + lightIndex] = false;\r\n defines[\"SHADOWCSM_RIGHTHANDED\" + lightIndex] = false;\r\n defines[\"SHADOWPCF\" + lightIndex] = false;\r\n defines[\"SHADOWPCSS\" + lightIndex] = false;\r\n defines[\"SHADOWPOISSON\" + lightIndex] = false;\r\n defines[\"SHADOWESM\" + lightIndex] = false;\r\n defines[\"SHADOWCLOSEESM\" + lightIndex] = false;\r\n defines[\"SHADOWCUBE\" + lightIndex] = false;\r\n defines[\"SHADOWLOWQUALITY\" + lightIndex] = false;\r\n defines[\"SHADOWMEDIUMQUALITY\" + lightIndex] = false;\r\n if (mesh && mesh.receiveShadows && scene.shadowsEnabled && light.shadowEnabled) {\r\n var shadowGenerator = light.getShadowGenerator();\r\n if (shadowGenerator) {\r\n var shadowMap = shadowGenerator.getShadowMap();\r\n if (shadowMap) {\r\n if (shadowMap.renderList && shadowMap.renderList.length > 0) {\r\n state.shadowEnabled = true;\r\n shadowGenerator.prepareDefines(defines, lightIndex);\r\n }\r\n }\r\n }\r\n }\r\n if (light.lightmapMode != Light.LIGHTMAP_DEFAULT) {\r\n state.lightmapMode = true;\r\n defines[\"LIGHTMAPEXCLUDED\" + lightIndex] = true;\r\n defines[\"LIGHTMAPNOSPECULAR\" + lightIndex] = (light.lightmapMode == Light.LIGHTMAP_SHADOWSONLY);\r\n }\r\n else {\r\n defines[\"LIGHTMAPEXCLUDED\" + lightIndex] = false;\r\n defines[\"LIGHTMAPNOSPECULAR\" + lightIndex] = false;\r\n }\r\n };\r\n /**\r\n * Prepares the defines related to the light information passed in parameter\r\n * @param scene The scene we are intending to draw\r\n * @param mesh The mesh the effect is compiling for\r\n * @param defines The defines to update\r\n * @param specularSupported Specifies whether specular is supported or not (override lights data)\r\n * @param maxSimultaneousLights Specfies how manuy lights can be added to the effect at max\r\n * @param disableLighting Specifies whether the lighting is disabled (override scene and light)\r\n * @returns true if normals will be required for the rest of the effect\r\n */\r\n MaterialHelper.PrepareDefinesForLights = function (scene, mesh, defines, specularSupported, maxSimultaneousLights, disableLighting) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n if (disableLighting === void 0) { disableLighting = false; }\r\n if (!defines._areLightsDirty) {\r\n return defines._needNormals;\r\n }\r\n var lightIndex = 0;\r\n var state = {\r\n needNormals: false,\r\n needRebuild: false,\r\n lightmapMode: false,\r\n shadowEnabled: false,\r\n specularEnabled: false\r\n };\r\n if (scene.lightsEnabled && !disableLighting) {\r\n for (var _i = 0, _a = mesh.lightSources; _i < _a.length; _i++) {\r\n var light = _a[_i];\r\n this.PrepareDefinesForLight(scene, mesh, light, lightIndex, defines, specularSupported, state);\r\n lightIndex++;\r\n if (lightIndex === maxSimultaneousLights) {\r\n break;\r\n }\r\n }\r\n }\r\n defines[\"SPECULARTERM\"] = state.specularEnabled;\r\n defines[\"SHADOWS\"] = state.shadowEnabled;\r\n // Resetting all other lights if any\r\n for (var index = lightIndex; index < maxSimultaneousLights; index++) {\r\n if (defines[\"LIGHT\" + index] !== undefined) {\r\n defines[\"LIGHT\" + index] = false;\r\n defines[\"HEMILIGHT\" + index] = false;\r\n defines[\"POINTLIGHT\" + index] = false;\r\n defines[\"DIRLIGHT\" + index] = false;\r\n defines[\"SPOTLIGHT\" + index] = false;\r\n defines[\"SHADOW\" + index] = false;\r\n defines[\"SHADOWCSM\" + index] = false;\r\n defines[\"SHADOWCSMDEBUG\" + index] = false;\r\n defines[\"SHADOWCSMNUM_CASCADES\" + index] = false;\r\n defines[\"SHADOWCSMUSESHADOWMAXZ\" + index] = false;\r\n defines[\"SHADOWCSMNOBLEND\" + index] = false;\r\n defines[\"SHADOWCSM_RIGHTHANDED\" + index] = false;\r\n defines[\"SHADOWPCF\" + index] = false;\r\n defines[\"SHADOWPCSS\" + index] = false;\r\n defines[\"SHADOWPOISSON\" + index] = false;\r\n defines[\"SHADOWESM\" + index] = false;\r\n defines[\"SHADOWCLOSEESM\" + index] = false;\r\n defines[\"SHADOWCUBE\" + index] = false;\r\n defines[\"SHADOWLOWQUALITY\" + index] = false;\r\n defines[\"SHADOWMEDIUMQUALITY\" + index] = false;\r\n }\r\n }\r\n var caps = scene.getEngine().getCaps();\r\n if (defines[\"SHADOWFLOAT\"] === undefined) {\r\n state.needRebuild = true;\r\n }\r\n defines[\"SHADOWFLOAT\"] = state.shadowEnabled &&\r\n ((caps.textureFloatRender && caps.textureFloatLinearFiltering) ||\r\n (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering));\r\n defines[\"LIGHTMAPEXCLUDED\"] = state.lightmapMode;\r\n if (state.needRebuild) {\r\n defines.rebuild();\r\n }\r\n return state.needNormals;\r\n };\r\n /**\r\n * Prepares the uniforms and samplers list to be used in the effect (for a specific light)\r\n * @param lightIndex defines the light index\r\n * @param uniformsList The uniform list\r\n * @param samplersList The sampler list\r\n * @param projectedLightTexture defines if projected texture must be used\r\n * @param uniformBuffersList defines an optional list of uniform buffers\r\n * @param updateOnlyBuffersList True to only update the uniformBuffersList array\r\n */\r\n MaterialHelper.PrepareUniformsAndSamplersForLight = function (lightIndex, uniformsList, samplersList, projectedLightTexture, uniformBuffersList, updateOnlyBuffersList) {\r\n if (uniformBuffersList === void 0) { uniformBuffersList = null; }\r\n if (updateOnlyBuffersList === void 0) { updateOnlyBuffersList = false; }\r\n if (uniformBuffersList) {\r\n uniformBuffersList.push(\"Light\" + lightIndex);\r\n }\r\n if (updateOnlyBuffersList) {\r\n return;\r\n }\r\n uniformsList.push(\"vLightData\" + lightIndex, \"vLightDiffuse\" + lightIndex, \"vLightSpecular\" + lightIndex, \"vLightDirection\" + lightIndex, \"vLightFalloff\" + lightIndex, \"vLightGround\" + lightIndex, \"lightMatrix\" + lightIndex, \"shadowsInfo\" + lightIndex, \"depthValues\" + lightIndex);\r\n samplersList.push(\"shadowSampler\" + lightIndex);\r\n samplersList.push(\"depthSampler\" + lightIndex);\r\n uniformsList.push(\"viewFrustumZ\" + lightIndex, \"cascadeBlendFactor\" + lightIndex, \"lightSizeUVCorrection\" + lightIndex, \"depthCorrection\" + lightIndex, \"penumbraDarkness\" + lightIndex, \"frustumLengths\" + lightIndex);\r\n if (projectedLightTexture) {\r\n samplersList.push(\"projectionLightSampler\" + lightIndex);\r\n uniformsList.push(\"textureProjectionMatrix\" + lightIndex);\r\n }\r\n };\r\n /**\r\n * Prepares the uniforms and samplers list to be used in the effect\r\n * @param uniformsListOrOptions The uniform names to prepare or an EffectCreationOptions containing the liist and extra information\r\n * @param samplersList The sampler list\r\n * @param defines The defines helping in the list generation\r\n * @param maxSimultaneousLights The maximum number of simultanous light allowed in the effect\r\n */\r\n MaterialHelper.PrepareUniformsAndSamplersList = function (uniformsListOrOptions, samplersList, defines, maxSimultaneousLights) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n var uniformsList;\r\n var uniformBuffersList = null;\r\n if (uniformsListOrOptions.uniformsNames) {\r\n var options = uniformsListOrOptions;\r\n uniformsList = options.uniformsNames;\r\n uniformBuffersList = options.uniformBuffersNames;\r\n samplersList = options.samplers;\r\n defines = options.defines;\r\n maxSimultaneousLights = options.maxSimultaneousLights || 0;\r\n }\r\n else {\r\n uniformsList = uniformsListOrOptions;\r\n if (!samplersList) {\r\n samplersList = [];\r\n }\r\n }\r\n for (var lightIndex = 0; lightIndex < maxSimultaneousLights; lightIndex++) {\r\n if (!defines[\"LIGHT\" + lightIndex]) {\r\n break;\r\n }\r\n this.PrepareUniformsAndSamplersForLight(lightIndex, uniformsList, samplersList, defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex], uniformBuffersList);\r\n }\r\n if (defines[\"NUM_MORPH_INFLUENCERS\"]) {\r\n uniformsList.push(\"morphTargetInfluences\");\r\n }\r\n };\r\n /**\r\n * This helps decreasing rank by rank the shadow quality (0 being the highest rank and quality)\r\n * @param defines The defines to update while falling back\r\n * @param fallbacks The authorized effect fallbacks\r\n * @param maxSimultaneousLights The maximum number of lights allowed\r\n * @param rank the current rank of the Effect\r\n * @returns The newly affected rank\r\n */\r\n MaterialHelper.HandleFallbacksForShadows = function (defines, fallbacks, maxSimultaneousLights, rank) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n if (rank === void 0) { rank = 0; }\r\n var lightFallbackRank = 0;\r\n for (var lightIndex = 0; lightIndex < maxSimultaneousLights; lightIndex++) {\r\n if (!defines[\"LIGHT\" + lightIndex]) {\r\n break;\r\n }\r\n if (lightIndex > 0) {\r\n lightFallbackRank = rank + lightIndex;\r\n fallbacks.addFallback(lightFallbackRank, \"LIGHT\" + lightIndex);\r\n }\r\n if (!defines[\"SHADOWS\"]) {\r\n if (defines[\"SHADOW\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOW\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWPCF\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWPCF\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWPCSS\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWPCSS\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWPOISSON\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWPOISSON\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWESM\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWESM\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWCLOSEESM\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWCLOSEESM\" + lightIndex);\r\n }\r\n }\r\n }\r\n return lightFallbackRank++;\r\n };\r\n /**\r\n * Prepares the list of attributes required for morph targets according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param mesh The mesh to prepare the morph targets attributes for\r\n * @param influencers The number of influencers\r\n */\r\n MaterialHelper.PrepareAttributesForMorphTargetsInfluencers = function (attribs, mesh, influencers) {\r\n this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS = influencers;\r\n this.PrepareAttributesForMorphTargets(attribs, mesh, this._TmpMorphInfluencers);\r\n };\r\n /**\r\n * Prepares the list of attributes required for morph targets according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param mesh The mesh to prepare the morph targets attributes for\r\n * @param defines The current Defines of the effect\r\n */\r\n MaterialHelper.PrepareAttributesForMorphTargets = function (attribs, mesh, defines) {\r\n var influencers = defines[\"NUM_MORPH_INFLUENCERS\"];\r\n if (influencers > 0 && EngineStore.LastCreatedEngine) {\r\n var maxAttributesCount = EngineStore.LastCreatedEngine.getCaps().maxVertexAttribs;\r\n var manager = mesh.morphTargetManager;\r\n var normal = manager && manager.supportsNormals && defines[\"NORMAL\"];\r\n var tangent = manager && manager.supportsTangents && defines[\"TANGENT\"];\r\n var uv = manager && manager.supportsUVs && defines[\"UV1\"];\r\n for (var index = 0; index < influencers; index++) {\r\n attribs.push(VertexBuffer.PositionKind + index);\r\n if (normal) {\r\n attribs.push(VertexBuffer.NormalKind + index);\r\n }\r\n if (tangent) {\r\n attribs.push(VertexBuffer.TangentKind + index);\r\n }\r\n if (uv) {\r\n attribs.push(VertexBuffer.UVKind + \"_\" + index);\r\n }\r\n if (attribs.length > maxAttributesCount) {\r\n Logger.Error(\"Cannot add more vertex attributes for mesh \" + mesh.name);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Prepares the list of attributes required for bones according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param mesh The mesh to prepare the bones attributes for\r\n * @param defines The current Defines of the effect\r\n * @param fallbacks The current efffect fallback strategy\r\n */\r\n MaterialHelper.PrepareAttributesForBones = function (attribs, mesh, defines, fallbacks) {\r\n if (defines[\"NUM_BONE_INFLUENCERS\"] > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n attribs.push(VertexBuffer.MatricesIndicesKind);\r\n attribs.push(VertexBuffer.MatricesWeightsKind);\r\n if (defines[\"NUM_BONE_INFLUENCERS\"] > 4) {\r\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\r\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\r\n }\r\n }\r\n };\r\n /**\r\n * Check and prepare the list of attributes required for instances according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param defines The current MaterialDefines of the effect\r\n */\r\n MaterialHelper.PrepareAttributesForInstances = function (attribs, defines) {\r\n if (defines[\"INSTANCES\"] || defines[\"THIN_INSTANCES\"]) {\r\n this.PushAttributesForInstances(attribs);\r\n }\r\n };\r\n /**\r\n * Add the list of attributes required for instances to the attribs array.\r\n * @param attribs The current list of supported attribs\r\n */\r\n MaterialHelper.PushAttributesForInstances = function (attribs) {\r\n attribs.push(\"world0\");\r\n attribs.push(\"world1\");\r\n attribs.push(\"world2\");\r\n attribs.push(\"world3\");\r\n };\r\n /**\r\n * Binds the light information to the effect.\r\n * @param light The light containing the generator\r\n * @param effect The effect we are binding the data to\r\n * @param lightIndex The light index in the effect used to render\r\n */\r\n MaterialHelper.BindLightProperties = function (light, effect, lightIndex) {\r\n light.transferToEffect(effect, lightIndex + \"\");\r\n };\r\n /**\r\n * Binds the lights information from the scene to the effect for the given mesh.\r\n * @param light Light to bind\r\n * @param lightIndex Light index\r\n * @param scene The scene where the light belongs to\r\n * @param effect The effect we are binding the data to\r\n * @param useSpecular Defines if specular is supported\r\n * @param rebuildInParallel Specifies whether the shader is rebuilding in parallel\r\n */\r\n MaterialHelper.BindLight = function (light, lightIndex, scene, effect, useSpecular, rebuildInParallel) {\r\n if (rebuildInParallel === void 0) { rebuildInParallel = false; }\r\n light._bindLight(lightIndex, scene, effect, useSpecular, rebuildInParallel);\r\n };\r\n /**\r\n * Binds the lights information from the scene to the effect for the given mesh.\r\n * @param scene The scene the lights belongs to\r\n * @param mesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n * @param defines The generated defines for the effect\r\n * @param maxSimultaneousLights The maximum number of light that can be bound to the effect\r\n * @param rebuildInParallel Specifies whether the shader is rebuilding in parallel\r\n */\r\n MaterialHelper.BindLights = function (scene, mesh, effect, defines, maxSimultaneousLights, rebuildInParallel) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n if (rebuildInParallel === void 0) { rebuildInParallel = false; }\r\n var len = Math.min(mesh.lightSources.length, maxSimultaneousLights);\r\n for (var i = 0; i < len; i++) {\r\n var light = mesh.lightSources[i];\r\n this.BindLight(light, i, scene, effect, typeof defines === \"boolean\" ? defines : defines[\"SPECULARTERM\"], rebuildInParallel);\r\n }\r\n };\r\n /**\r\n * Binds the fog information from the scene to the effect for the given mesh.\r\n * @param scene The scene the lights belongs to\r\n * @param mesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n * @param linearSpace Defines if the fog effect is applied in linear space\r\n */\r\n MaterialHelper.BindFogParameters = function (scene, mesh, effect, linearSpace) {\r\n if (linearSpace === void 0) { linearSpace = false; }\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n effect.setFloat4(\"vFogInfos\", scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);\r\n // Convert fog color to linear space if used in a linear space computed shader.\r\n if (linearSpace) {\r\n scene.fogColor.toLinearSpaceToRef(this._tempFogColor);\r\n effect.setColor3(\"vFogColor\", this._tempFogColor);\r\n }\r\n else {\r\n effect.setColor3(\"vFogColor\", scene.fogColor);\r\n }\r\n }\r\n };\r\n /**\r\n * Binds the bones information from the mesh to the effect.\r\n * @param mesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n * @param prePassConfiguration Configuration for the prepass, in case prepass is activated\r\n */\r\n MaterialHelper.BindBonesParameters = function (mesh, effect, prePassConfiguration) {\r\n if (!effect || !mesh) {\r\n return;\r\n }\r\n if (mesh.computeBonesUsingShaders && effect._bonesComputationForcedToCPU) {\r\n mesh.computeBonesUsingShaders = false;\r\n }\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n var skeleton = mesh.skeleton;\r\n if (skeleton.isUsingTextureForMatrices && effect.getUniformIndex(\"boneTextureWidth\") > -1) {\r\n var boneTexture = skeleton.getTransformMatrixTexture(mesh);\r\n effect.setTexture(\"boneSampler\", boneTexture);\r\n effect.setFloat(\"boneTextureWidth\", 4.0 * (skeleton.bones.length + 1));\r\n }\r\n else {\r\n var matrices = skeleton.getTransformMatrices(mesh);\r\n if (matrices) {\r\n effect.setMatrices(\"mBones\", matrices);\r\n if (prePassConfiguration && mesh.getScene().prePassRenderer && mesh.getScene().prePassRenderer.getIndex(2)) {\r\n if (prePassConfiguration.previousBones[mesh.uniqueId]) {\r\n effect.setMatrices(\"mPreviousBones\", prePassConfiguration.previousBones[mesh.uniqueId]);\r\n }\r\n MaterialHelper._CopyBonesTransformationMatrices(matrices, prePassConfiguration.previousBones[mesh.uniqueId]);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n // Copies the bones transformation matrices into the target array and returns the target's reference\r\n MaterialHelper._CopyBonesTransformationMatrices = function (source, target) {\r\n target.set(source);\r\n return target;\r\n };\r\n /**\r\n * Binds the morph targets information from the mesh to the effect.\r\n * @param abstractMesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n */\r\n MaterialHelper.BindMorphTargetParameters = function (abstractMesh, effect) {\r\n var manager = abstractMesh.morphTargetManager;\r\n if (!abstractMesh || !manager) {\r\n return;\r\n }\r\n effect.setFloatArray(\"morphTargetInfluences\", manager.influences);\r\n };\r\n /**\r\n * Binds the logarithmic depth information from the scene to the effect for the given defines.\r\n * @param defines The generated defines used in the effect\r\n * @param effect The effect we are binding the data to\r\n * @param scene The scene we are willing to render with logarithmic scale for\r\n */\r\n MaterialHelper.BindLogDepth = function (defines, effect, scene) {\r\n if (defines[\"LOGARITHMICDEPTH\"]) {\r\n effect.setFloat(\"logarithmicDepthConstant\", 2.0 / (Math.log(scene.activeCamera.maxZ + 1.0) / Math.LN2));\r\n }\r\n };\r\n /**\r\n * Binds the clip plane information from the scene to the effect.\r\n * @param scene The scene the clip plane information are extracted from\r\n * @param effect The effect we are binding the data to\r\n */\r\n MaterialHelper.BindClipPlane = function (effect, scene) {\r\n ThinMaterialHelper.BindClipPlane(effect, scene);\r\n };\r\n MaterialHelper._TmpMorphInfluencers = { \"NUM_MORPH_INFLUENCERS\": 0 };\r\n MaterialHelper._tempFogColor = Color3.Black();\r\n return MaterialHelper;\r\n}());\r\nexport { MaterialHelper };\r\n//# sourceMappingURL=materialHelper.js.map","import { __extends } from \"tslib\";\r\nimport { Material } from \"../Materials/material\";\r\nimport { Tags } from \"../Misc/tags\";\r\nimport { _TypeStore } from '../Misc/typeStore';\r\n/**\r\n * A multi-material is used to apply different materials to different parts of the same object without the need of\r\n * separate meshes. This can be use to improve performances.\r\n * @see https://doc.babylonjs.com/how_to/multi_materials\r\n */\r\nvar MultiMaterial = /** @class */ (function (_super) {\r\n __extends(MultiMaterial, _super);\r\n /**\r\n * Instantiates a new Multi Material\r\n * A multi-material is used to apply different materials to different parts of the same object without the need of\r\n * separate meshes. This can be use to improve performances.\r\n * @see https://doc.babylonjs.com/how_to/multi_materials\r\n * @param name Define the name in the scene\r\n * @param scene Define the scene the material belongs to\r\n */\r\n function MultiMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene, true) || this;\r\n scene.multiMaterials.push(_this);\r\n _this.subMaterials = new Array();\r\n _this._storeEffectOnSubMeshes = true; // multimaterial is considered like a push material\r\n return _this;\r\n }\r\n Object.defineProperty(MultiMaterial.prototype, \"subMaterials\", {\r\n /**\r\n * Gets or Sets the list of Materials used within the multi material.\r\n * They need to be ordered according to the submeshes order in the associated mesh\r\n */\r\n get: function () {\r\n return this._subMaterials;\r\n },\r\n set: function (value) {\r\n this._subMaterials = value;\r\n this._hookArray(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Function used to align with Node.getChildren()\r\n * @returns the list of Materials used within the multi material\r\n */\r\n MultiMaterial.prototype.getChildren = function () {\r\n return this.subMaterials;\r\n };\r\n MultiMaterial.prototype._hookArray = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var result = oldPush.apply(array, items);\r\n _this._markAllSubMeshesAsTexturesDirty();\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n _this._markAllSubMeshesAsTexturesDirty();\r\n return deleted;\r\n };\r\n };\r\n /**\r\n * Get one of the submaterial by its index in the submaterials array\r\n * @param index The index to look the sub material at\r\n * @returns The Material if the index has been defined\r\n */\r\n MultiMaterial.prototype.getSubMaterial = function (index) {\r\n if (index < 0 || index >= this.subMaterials.length) {\r\n return this.getScene().defaultMaterial;\r\n }\r\n return this.subMaterials[index];\r\n };\r\n /**\r\n * Get the list of active textures for the whole sub materials list.\r\n * @returns All the textures that will be used during the rendering\r\n */\r\n MultiMaterial.prototype.getActiveTextures = function () {\r\n var _a;\r\n return (_a = _super.prototype.getActiveTextures.call(this)).concat.apply(_a, this.subMaterials.map(function (subMaterial) {\r\n if (subMaterial) {\r\n return subMaterial.getActiveTextures();\r\n }\r\n else {\r\n return [];\r\n }\r\n }));\r\n };\r\n /**\r\n * Specifies if any sub-materials of this multi-material use a given texture.\r\n * @param texture Defines the texture to check against this multi-material's sub-materials.\r\n * @returns A boolean specifying if any sub-material of this multi-material uses the texture.\r\n */\r\n MultiMaterial.prototype.hasTexture = function (texture) {\r\n var _a;\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n for (var i = 0; i < this.subMaterials.length; i++) {\r\n if ((_a = this.subMaterials[i]) === null || _a === void 0 ? void 0 : _a.hasTexture(texture)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets the current class name of the material e.g. \"MultiMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n MultiMaterial.prototype.getClassName = function () {\r\n return \"MultiMaterial\";\r\n };\r\n /**\r\n * Checks if the material is ready to render the requested sub mesh\r\n * @param mesh Define the mesh the submesh belongs to\r\n * @param subMesh Define the sub mesh to look readyness for\r\n * @param useInstances Define whether or not the material is used with instances\r\n * @returns true if ready, otherwise false\r\n */\r\n MultiMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n for (var index = 0; index < this.subMaterials.length; index++) {\r\n var subMaterial = this.subMaterials[index];\r\n if (subMaterial) {\r\n if (subMaterial._storeEffectOnSubMeshes) {\r\n if (!subMaterial.isReadyForSubMesh(mesh, subMesh, useInstances)) {\r\n return false;\r\n }\r\n continue;\r\n }\r\n if (!subMaterial.isReady(mesh)) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Clones the current material and its related sub materials\r\n * @param name Define the name of the newly cloned material\r\n * @param cloneChildren Define if submaterial will be cloned or shared with the parent instance\r\n * @returns the cloned material\r\n */\r\n MultiMaterial.prototype.clone = function (name, cloneChildren) {\r\n var newMultiMaterial = new MultiMaterial(name, this.getScene());\r\n for (var index = 0; index < this.subMaterials.length; index++) {\r\n var subMaterial = null;\r\n var current = this.subMaterials[index];\r\n if (cloneChildren && current) {\r\n subMaterial = current.clone(name + \"-\" + current.name);\r\n }\r\n else {\r\n subMaterial = this.subMaterials[index];\r\n }\r\n newMultiMaterial.subMaterials.push(subMaterial);\r\n }\r\n return newMultiMaterial;\r\n };\r\n /**\r\n * Serializes the materials into a JSON representation.\r\n * @returns the JSON representation\r\n */\r\n MultiMaterial.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.id = this.id;\r\n if (Tags) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n serializationObject.materials = [];\r\n for (var matIndex = 0; matIndex < this.subMaterials.length; matIndex++) {\r\n var subMat = this.subMaterials[matIndex];\r\n if (subMat) {\r\n serializationObject.materials.push(subMat.id);\r\n }\r\n else {\r\n serializationObject.materials.push(null);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Dispose the material and release its associated resources\r\n * @param forceDisposeEffect Define if we want to force disposing the associated effect (if false the shader is not released and could be reuse later on)\r\n * @param forceDisposeTextures Define if we want to force disposing the associated textures (if false, they will not be disposed and can still be use elsewhere in the app)\r\n * @param forceDisposeChildren Define if we want to force disposing the associated submaterials (if false, they will not be disposed and can still be use elsewhere in the app)\r\n */\r\n MultiMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures, forceDisposeChildren) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n if (forceDisposeChildren) {\r\n for (var index = 0; index < this.subMaterials.length; index++) {\r\n var subMaterial = this.subMaterials[index];\r\n if (subMaterial) {\r\n subMaterial.dispose(forceDisposeEffect, forceDisposeTextures);\r\n }\r\n }\r\n }\r\n var index = scene.multiMaterials.indexOf(this);\r\n if (index >= 0) {\r\n scene.multiMaterials.splice(index, 1);\r\n }\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);\r\n };\r\n /**\r\n * Creates a MultiMaterial from parsed MultiMaterial data.\r\n * @param parsedMultiMaterial defines parsed MultiMaterial data.\r\n * @param scene defines the hosting scene\r\n * @returns a new MultiMaterial\r\n */\r\n MultiMaterial.ParseMultiMaterial = function (parsedMultiMaterial, scene) {\r\n var multiMaterial = new MultiMaterial(parsedMultiMaterial.name, scene);\r\n multiMaterial.id = parsedMultiMaterial.id;\r\n if (Tags) {\r\n Tags.AddTagsTo(multiMaterial, parsedMultiMaterial.tags);\r\n }\r\n for (var matIndex = 0; matIndex < parsedMultiMaterial.materials.length; matIndex++) {\r\n var subMatId = parsedMultiMaterial.materials[matIndex];\r\n if (subMatId) {\r\n // If the same multimaterial is loaded twice, the 2nd multimaterial needs to reference the latest material by that id which\r\n // is why this lookup should use getLastMaterialByID instead of getMaterialByID\r\n multiMaterial.subMaterials.push(scene.getLastMaterialByID(subMatId));\r\n }\r\n else {\r\n multiMaterial.subMaterials.push(null);\r\n }\r\n }\r\n return multiMaterial;\r\n };\r\n return MultiMaterial;\r\n}(Material));\r\nexport { MultiMaterial };\r\n_TypeStore.RegisteredTypes[\"BABYLON.MultiMaterial\"] = MultiMaterial;\r\n//# sourceMappingURL=multiMaterial.js.map","import { Matrix } from \"../Maths/math.vector\";\r\n/**\r\n * Configuration needed for prepass-capable materials\r\n */\r\nvar PrePassConfiguration = /** @class */ (function () {\r\n function PrePassConfiguration() {\r\n /**\r\n * Previous world matrices of meshes carrying this material\r\n * Used for computing velocity\r\n */\r\n this.previousWorldMatrices = {};\r\n /**\r\n * Previous bones of meshes carrying this material\r\n * Used for computing velocity\r\n */\r\n this.previousBones = {};\r\n }\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PrePassConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"previousWorld\", \"previousViewProjection\");\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PrePassConfiguration.AddSamplers = function (samplers) {\r\n // pass\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param effect defines the effect to update\r\n * @param scene defines the scene the material belongs to.\r\n * @param mesh The mesh\r\n * @param world World matrix of this mesh\r\n * @param isFrozen Is the material frozen\r\n */\r\n PrePassConfiguration.prototype.bindForSubMesh = function (effect, scene, mesh, world, isFrozen) {\r\n if (scene.prePassRenderer && scene.prePassRenderer.enabled) {\r\n if (scene.prePassRenderer.getIndex(2) !== -1) {\r\n if (!this.previousWorldMatrices[mesh.uniqueId]) {\r\n this.previousWorldMatrices[mesh.uniqueId] = Matrix.Identity();\r\n }\r\n if (!this.previousViewProjection) {\r\n this.previousViewProjection = scene.getTransformMatrix();\r\n }\r\n effect.setMatrix(\"previousWorld\", this.previousWorldMatrices[mesh.uniqueId]);\r\n effect.setMatrix(\"previousViewProjection\", this.previousViewProjection);\r\n this.previousWorldMatrices[mesh.uniqueId] = world.clone();\r\n this.previousViewProjection = scene.getTransformMatrix().clone();\r\n }\r\n }\r\n };\r\n return PrePassConfiguration;\r\n}());\r\nexport { PrePassConfiguration };\r\n//# sourceMappingURL=prePassConfiguration.js.map","import { __extends } from \"tslib\";\r\nimport { Matrix } from \"../Maths/math.vector\";\r\nimport { Material } from \"../Materials/material\";\r\n/**\r\n * Base class of materials working in push mode in babylon JS\r\n * @hidden\r\n */\r\nvar PushMaterial = /** @class */ (function (_super) {\r\n __extends(PushMaterial, _super);\r\n function PushMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._normalMatrix = new Matrix();\r\n _this._storeEffectOnSubMeshes = true;\r\n return _this;\r\n }\r\n PushMaterial.prototype.getEffect = function () {\r\n return this._activeEffect;\r\n };\r\n PushMaterial.prototype.isReady = function (mesh, useInstances) {\r\n if (!mesh) {\r\n return false;\r\n }\r\n if (!mesh.subMeshes || mesh.subMeshes.length === 0) {\r\n return true;\r\n }\r\n return this.isReadyForSubMesh(mesh, mesh.subMeshes[0], useInstances);\r\n };\r\n PushMaterial.prototype._isReadyForSubMesh = function (subMesh) {\r\n var defines = subMesh._materialDefines;\r\n if (!this.checkReadyOnEveryCall && subMesh.effect && defines) {\r\n if (defines._renderId === this.getScene().getRenderId()) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Binds the given world matrix to the active effect\r\n *\r\n * @param world the matrix to bind\r\n */\r\n PushMaterial.prototype.bindOnlyWorldMatrix = function (world) {\r\n this._activeEffect.setMatrix(\"world\", world);\r\n };\r\n /**\r\n * Binds the given normal matrix to the active effect\r\n *\r\n * @param normalMatrix the matrix to bind\r\n */\r\n PushMaterial.prototype.bindOnlyNormalMatrix = function (normalMatrix) {\r\n this._activeEffect.setMatrix(\"normalMatrix\", normalMatrix);\r\n };\r\n PushMaterial.prototype.bind = function (world, mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n this.bindForSubMesh(world, mesh, mesh.subMeshes[0]);\r\n };\r\n PushMaterial.prototype._afterBind = function (mesh, effect) {\r\n if (effect === void 0) { effect = null; }\r\n _super.prototype._afterBind.call(this, mesh);\r\n this.getScene()._cachedEffect = effect;\r\n };\r\n PushMaterial.prototype._mustRebind = function (scene, effect, visibility) {\r\n if (visibility === void 0) { visibility = 1; }\r\n return scene.isCachedMaterialInvalid(this, effect, visibility);\r\n };\r\n return PushMaterial;\r\n}(Material));\r\nexport { PushMaterial };\r\n//# sourceMappingURL=pushMaterial.js.map","import { __assign, __extends } from \"tslib\";\r\nimport { SerializationHelper } from \"../Misc/decorators\";\r\nimport { Matrix, Vector3, Vector2, Vector4 } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { MaterialHelper } from \"./materialHelper\";\r\nimport { Material } from \"./material\";\r\nimport { _TypeStore } from '../Misc/typeStore';\r\nimport { Color3, Color4 } from '../Maths/math.color';\r\nimport { EffectFallbacks } from './effectFallbacks';\r\nimport { WebRequest } from '../Misc/webRequest';\r\nimport { Engine } from '../Engines/engine';\r\nvar onCreatedEffectParameters = { effect: null, subMesh: null };\r\n/**\r\n * The ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh.\r\n *\r\n * This returned material effects how the mesh will look based on the code in the shaders.\r\n *\r\n * @see https://doc.babylonjs.com/how_to/shader_material\r\n */\r\nvar ShaderMaterial = /** @class */ (function (_super) {\r\n __extends(ShaderMaterial, _super);\r\n /**\r\n * Instantiate a new shader material.\r\n * The ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh.\r\n * This returned material effects how the mesh will look based on the code in the shaders.\r\n * @see https://doc.babylonjs.com/how_to/shader_material\r\n * @param name Define the name of the material in the scene\r\n * @param scene Define the scene the material belongs to\r\n * @param shaderPath Defines the route to the shader code in one of three ways:\r\n * * object: { vertex: \"custom\", fragment: \"custom\" }, used with Effect.ShadersStore[\"customVertexShader\"] and Effect.ShadersStore[\"customFragmentShader\"]\r\n * * object: { vertexElement: \"vertexShaderCode\", fragmentElement: \"fragmentShaderCode\" }, used with shader code in script tags\r\n * * object: { vertexSource: \"vertex shader code string\", fragmentSource: \"fragment shader code string\" } using with strings containing the shaders code\r\n * * string: \"./COMMON_NAME\", used with external files COMMON_NAME.vertex.fx and COMMON_NAME.fragment.fx in index.html folder.\r\n * @param options Define the options used to create the shader\r\n */\r\n function ShaderMaterial(name, scene, shaderPath, options) {\r\n if (options === void 0) { options = {}; }\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._textures = {};\r\n _this._textureArrays = {};\r\n _this._floats = {};\r\n _this._ints = {};\r\n _this._floatsArrays = {};\r\n _this._colors3 = {};\r\n _this._colors3Arrays = {};\r\n _this._colors4 = {};\r\n _this._colors4Arrays = {};\r\n _this._vectors2 = {};\r\n _this._vectors3 = {};\r\n _this._vectors4 = {};\r\n _this._matrices = {};\r\n _this._matrixArrays = {};\r\n _this._matrices3x3 = {};\r\n _this._matrices2x2 = {};\r\n _this._vectors2Arrays = {};\r\n _this._vectors3Arrays = {};\r\n _this._vectors4Arrays = {};\r\n _this._cachedWorldViewMatrix = new Matrix();\r\n _this._cachedWorldViewProjectionMatrix = new Matrix();\r\n _this._multiview = false;\r\n _this._shaderPath = shaderPath;\r\n _this._options = __assign({ needAlphaBlending: false, needAlphaTesting: false, attributes: [\"position\", \"normal\", \"uv\"], uniforms: [\"worldViewProjection\"], uniformBuffers: [], samplers: [], defines: [] }, options);\r\n return _this;\r\n }\r\n Object.defineProperty(ShaderMaterial.prototype, \"shaderPath\", {\r\n /**\r\n * Gets the shader path used to define the shader code\r\n * It can be modified to trigger a new compilation\r\n */\r\n get: function () {\r\n return this._shaderPath;\r\n },\r\n /**\r\n * Sets the shader path used to define the shader code\r\n * It can be modified to trigger a new compilation\r\n */\r\n set: function (shaderPath) {\r\n this._shaderPath = shaderPath;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShaderMaterial.prototype, \"options\", {\r\n /**\r\n * Gets the options used to compile the shader.\r\n * They can be modified to trigger a new compilation\r\n */\r\n get: function () {\r\n return this._options;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current class name of the material e.g. \"ShaderMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n ShaderMaterial.prototype.getClassName = function () {\r\n return \"ShaderMaterial\";\r\n };\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n ShaderMaterial.prototype.needAlphaBlending = function () {\r\n return (this.alpha < 1.0) || this._options.needAlphaBlending;\r\n };\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns a boolean specifying if an alpha test is needed.\r\n */\r\n ShaderMaterial.prototype.needAlphaTesting = function () {\r\n return this._options.needAlphaTesting;\r\n };\r\n ShaderMaterial.prototype._checkUniform = function (uniformName) {\r\n if (this._options.uniforms.indexOf(uniformName) === -1) {\r\n this._options.uniforms.push(uniformName);\r\n }\r\n };\r\n /**\r\n * Set a texture in the shader.\r\n * @param name Define the name of the uniform samplers as defined in the shader\r\n * @param texture Define the texture to bind to this sampler\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setTexture = function (name, texture) {\r\n if (this._options.samplers.indexOf(name) === -1) {\r\n this._options.samplers.push(name);\r\n }\r\n this._textures[name] = texture;\r\n return this;\r\n };\r\n /**\r\n * Set a texture array in the shader.\r\n * @param name Define the name of the uniform sampler array as defined in the shader\r\n * @param textures Define the list of textures to bind to this sampler\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setTextureArray = function (name, textures) {\r\n if (this._options.samplers.indexOf(name) === -1) {\r\n this._options.samplers.push(name);\r\n }\r\n this._checkUniform(name);\r\n this._textureArrays[name] = textures;\r\n return this;\r\n };\r\n /**\r\n * Set a float in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setFloat = function (name, value) {\r\n this._checkUniform(name);\r\n this._floats[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a int in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setInt = function (name, value) {\r\n this._checkUniform(name);\r\n this._ints[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set an array of floats in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setFloats = function (name, value) {\r\n this._checkUniform(name);\r\n this._floatsArrays[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 in the shader from a Color3.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 array in the shader from a Color3 array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor3Array = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors3Arrays[name] = value.reduce(function (arr, color) {\r\n color.toArray(arr, arr.length);\r\n return arr;\r\n }, []);\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 in the shader from a Color4.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor4 = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors4[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 array in the shader from a Color4 array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor4Array = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors4Arrays[name] = value.reduce(function (arr, color) {\r\n color.toArray(arr, arr.length);\r\n return arr;\r\n }, []);\r\n return this;\r\n };\r\n /**\r\n * Set a vec2 in the shader from a Vector2.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setVector2 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors2[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 in the shader from a Vector3.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setVector3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 in the shader from a Vector4.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setVector4 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors4[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a mat4 in the shader from a Matrix.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setMatrix = function (name, value) {\r\n this._checkUniform(name);\r\n this._matrices[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a float32Array in the shader from a matrix array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setMatrices = function (name, value) {\r\n this._checkUniform(name);\r\n var float32Array = new Float32Array(value.length * 16);\r\n for (var index = 0; index < value.length; index++) {\r\n var matrix = value[index];\r\n matrix.copyToArray(float32Array, index * 16);\r\n }\r\n this._matrixArrays[name] = float32Array;\r\n return this;\r\n };\r\n /**\r\n * Set a mat3 in the shader from a Float32Array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setMatrix3x3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._matrices3x3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a mat2 in the shader from a Float32Array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setMatrix2x2 = function (name, value) {\r\n this._checkUniform(name);\r\n this._matrices2x2[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec2 array in the shader from a number array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setArray2 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors2Arrays[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 array in the shader from a number array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setArray3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors3Arrays[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 array in the shader from a number array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setArray4 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors4Arrays[name] = value;\r\n return this;\r\n };\r\n ShaderMaterial.prototype._checkCache = function (mesh, useInstances) {\r\n if (!mesh) {\r\n return true;\r\n }\r\n if (this._effect && (this._effect.defines.indexOf(\"#define INSTANCES\") !== -1) !== useInstances) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n ShaderMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n return this.isReady(mesh, useInstances);\r\n };\r\n /**\r\n * Checks if the material is ready to render the requested mesh\r\n * @param mesh Define the mesh to render\r\n * @param useInstances Define whether or not the material is used with instances\r\n * @returns true if ready, otherwise false\r\n */\r\n ShaderMaterial.prototype.isReady = function (mesh, useInstances) {\r\n var _a, _b;\r\n if (this._effect && this.isFrozen) {\r\n if (this._effect._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (!this.checkReadyOnEveryCall) {\r\n if (this._renderId === scene.getRenderId()) {\r\n if (this._checkCache(mesh, useInstances)) {\r\n return true;\r\n }\r\n }\r\n }\r\n // Instances\r\n var defines = [];\r\n var attribs = [];\r\n var fallbacks = new EffectFallbacks();\r\n // global multiview\r\n if (engine.getCaps().multiview &&\r\n scene.activeCamera &&\r\n scene.activeCamera.outputRenderTarget &&\r\n scene.activeCamera.outputRenderTarget.getViewCount() > 1) {\r\n this._multiview = true;\r\n defines.push(\"#define MULTIVIEW\");\r\n if (this._options.uniforms.indexOf(\"viewProjection\") !== -1 &&\r\n this._options.uniforms.push(\"viewProjectionR\") === -1) {\r\n this._options.uniforms.push(\"viewProjectionR\");\r\n }\r\n }\r\n for (var index = 0; index < this._options.defines.length; index++) {\r\n defines.push(this._options.defines[index]);\r\n }\r\n for (var index = 0; index < this._options.attributes.length; index++) {\r\n attribs.push(this._options.attributes[index]);\r\n }\r\n if (mesh && mesh.isVerticesDataPresent(VertexBuffer.ColorKind)) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n defines.push(\"#define VERTEXCOLOR\");\r\n }\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n MaterialHelper.PushAttributesForInstances(attribs);\r\n if (mesh === null || mesh === void 0 ? void 0 : mesh.hasThinInstances) {\r\n defines.push(\"#define THIN_INSTANCES\");\r\n }\r\n }\r\n // Bones\r\n var numInfluencers = 0;\r\n if (mesh && mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n attribs.push(VertexBuffer.MatricesIndicesKind);\r\n attribs.push(VertexBuffer.MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\r\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\r\n }\r\n var skeleton = mesh.skeleton;\r\n numInfluencers = mesh.numBoneInfluencers;\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + numInfluencers);\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n if (skeleton.isUsingTextureForMatrices) {\r\n defines.push(\"#define BONETEXTURE\");\r\n if (this._options.uniforms.indexOf(\"boneTextureWidth\") === -1) {\r\n this._options.uniforms.push(\"boneTextureWidth\");\r\n }\r\n if (this._options.samplers.indexOf(\"boneSampler\") === -1) {\r\n this._options.samplers.push(\"boneSampler\");\r\n }\r\n }\r\n else {\r\n defines.push(\"#define BonesPerMesh \" + (skeleton.bones.length + 1));\r\n if (this._options.uniforms.indexOf(\"mBones\") === -1) {\r\n this._options.uniforms.push(\"mBones\");\r\n }\r\n }\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Textures\r\n for (var name in this._textures) {\r\n if (!this._textures[name].isReady()) {\r\n return false;\r\n }\r\n }\r\n // Alpha test\r\n if (mesh && this._shouldTurnAlphaTestOn(mesh)) {\r\n defines.push(\"#define ALPHATEST\");\r\n }\r\n var shaderName = this._shaderPath, uniforms = this._options.uniforms, uniformBuffers = this._options.uniformBuffers, samplers = this._options.samplers;\r\n if (this.customShaderNameResolve) {\r\n uniforms = uniforms.slice();\r\n uniformBuffers = uniformBuffers.slice();\r\n samplers = samplers.slice();\r\n shaderName = this.customShaderNameResolve(shaderName, uniforms, uniformBuffers, samplers, defines, attribs);\r\n }\r\n var previousEffect = this._effect;\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n this._effect = engine.createEffect(shaderName, {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousMorphTargets: numInfluencers }\r\n }, engine);\r\n if (this._onEffectCreatedObservable) {\r\n onCreatedEffectParameters.effect = this._effect;\r\n this._onEffectCreatedObservable.notifyObservers(onCreatedEffectParameters);\r\n }\r\n }\r\n if ((_b = !((_a = this._effect) === null || _a === void 0 ? void 0 : _a.isReady())) !== null && _b !== void 0 ? _b : true) {\r\n return false;\r\n }\r\n if (previousEffect !== this._effect) {\r\n scene.resetCachedMaterial();\r\n }\r\n this._renderId = scene.getRenderId();\r\n this._effect._wasPreviouslyReady = true;\r\n return true;\r\n };\r\n /**\r\n * Binds the world matrix to the material\r\n * @param world defines the world transformation matrix\r\n * @param effectOverride - If provided, use this effect instead of internal effect\r\n */\r\n ShaderMaterial.prototype.bindOnlyWorldMatrix = function (world, effectOverride) {\r\n var scene = this.getScene();\r\n var effect = effectOverride !== null && effectOverride !== void 0 ? effectOverride : this._effect;\r\n if (!effect) {\r\n return;\r\n }\r\n if (this._options.uniforms.indexOf(\"world\") !== -1) {\r\n effect.setMatrix(\"world\", world);\r\n }\r\n if (this._options.uniforms.indexOf(\"worldView\") !== -1) {\r\n world.multiplyToRef(scene.getViewMatrix(), this._cachedWorldViewMatrix);\r\n effect.setMatrix(\"worldView\", this._cachedWorldViewMatrix);\r\n }\r\n if (this._options.uniforms.indexOf(\"worldViewProjection\") !== -1) {\r\n world.multiplyToRef(scene.getTransformMatrix(), this._cachedWorldViewProjectionMatrix);\r\n effect.setMatrix(\"worldViewProjection\", this._cachedWorldViewProjectionMatrix);\r\n }\r\n };\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n ShaderMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n this.bind(world, mesh, subMesh._effectOverride);\r\n };\r\n /**\r\n * Binds the material to the mesh\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh to bind the material to\r\n * @param effectOverride - If provided, use this effect instead of internal effect\r\n */\r\n ShaderMaterial.prototype.bind = function (world, mesh, effectOverride) {\r\n // Std values\r\n this.bindOnlyWorldMatrix(world, effectOverride);\r\n var effect = effectOverride !== null && effectOverride !== void 0 ? effectOverride : this._effect;\r\n if (effect && this.getScene().getCachedMaterial() !== this) {\r\n if (this._options.uniforms.indexOf(\"view\") !== -1) {\r\n effect.setMatrix(\"view\", this.getScene().getViewMatrix());\r\n }\r\n if (this._options.uniforms.indexOf(\"projection\") !== -1) {\r\n effect.setMatrix(\"projection\", this.getScene().getProjectionMatrix());\r\n }\r\n if (this._options.uniforms.indexOf(\"viewProjection\") !== -1) {\r\n effect.setMatrix(\"viewProjection\", this.getScene().getTransformMatrix());\r\n if (this._multiview) {\r\n effect.setMatrix(\"viewProjectionR\", this.getScene()._transformMatrixR);\r\n }\r\n }\r\n if (this.getScene().activeCamera && this._options.uniforms.indexOf(\"cameraPosition\") !== -1) {\r\n effect.setVector3(\"cameraPosition\", this.getScene().activeCamera.globalPosition);\r\n }\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, effect);\r\n var name;\r\n // Texture\r\n for (name in this._textures) {\r\n effect.setTexture(name, this._textures[name]);\r\n }\r\n // Texture arrays\r\n for (name in this._textureArrays) {\r\n effect.setTextureArray(name, this._textureArrays[name]);\r\n }\r\n // Int\r\n for (name in this._ints) {\r\n effect.setInt(name, this._ints[name]);\r\n }\r\n // Float\r\n for (name in this._floats) {\r\n effect.setFloat(name, this._floats[name]);\r\n }\r\n // Floats\r\n for (name in this._floatsArrays) {\r\n effect.setArray(name, this._floatsArrays[name]);\r\n }\r\n // Color3\r\n for (name in this._colors3) {\r\n effect.setColor3(name, this._colors3[name]);\r\n }\r\n // Color3Array\r\n for (name in this._colors3Arrays) {\r\n effect.setArray3(name, this._colors3Arrays[name]);\r\n }\r\n // Color4\r\n for (name in this._colors4) {\r\n var color = this._colors4[name];\r\n effect.setFloat4(name, color.r, color.g, color.b, color.a);\r\n }\r\n // Color4Array\r\n for (name in this._colors4Arrays) {\r\n effect.setArray4(name, this._colors4Arrays[name]);\r\n }\r\n // Vector2\r\n for (name in this._vectors2) {\r\n effect.setVector2(name, this._vectors2[name]);\r\n }\r\n // Vector3\r\n for (name in this._vectors3) {\r\n effect.setVector3(name, this._vectors3[name]);\r\n }\r\n // Vector4\r\n for (name in this._vectors4) {\r\n effect.setVector4(name, this._vectors4[name]);\r\n }\r\n // Matrix\r\n for (name in this._matrices) {\r\n effect.setMatrix(name, this._matrices[name]);\r\n }\r\n // MatrixArray\r\n for (name in this._matrixArrays) {\r\n effect.setMatrices(name, this._matrixArrays[name]);\r\n }\r\n // Matrix 3x3\r\n for (name in this._matrices3x3) {\r\n effect.setMatrix3x3(name, this._matrices3x3[name]);\r\n }\r\n // Matrix 2x2\r\n for (name in this._matrices2x2) {\r\n effect.setMatrix2x2(name, this._matrices2x2[name]);\r\n }\r\n // Vector2Array\r\n for (name in this._vectors2Arrays) {\r\n effect.setArray2(name, this._vectors2Arrays[name]);\r\n }\r\n // Vector3Array\r\n for (name in this._vectors3Arrays) {\r\n effect.setArray3(name, this._vectors3Arrays[name]);\r\n }\r\n // Vector4Array\r\n for (name in this._vectors4Arrays) {\r\n effect.setArray4(name, this._vectors4Arrays[name]);\r\n }\r\n }\r\n var seffect = this._effect;\r\n this._effect = effect; // make sure the active effect is the right one if there are some observers for onBind that would need to get the current effect\r\n this._afterBind(mesh);\r\n this._effect = seffect;\r\n };\r\n ShaderMaterial.prototype._afterBind = function (mesh) {\r\n _super.prototype._afterBind.call(this, mesh);\r\n this.getScene()._cachedEffect = this._effect;\r\n };\r\n /**\r\n * Gets the active textures from the material\r\n * @returns an array of textures\r\n */\r\n ShaderMaterial.prototype.getActiveTextures = function () {\r\n var activeTextures = _super.prototype.getActiveTextures.call(this);\r\n for (var name in this._textures) {\r\n activeTextures.push(this._textures[name]);\r\n }\r\n for (var name in this._textureArrays) {\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n activeTextures.push(array[index]);\r\n }\r\n }\r\n return activeTextures;\r\n };\r\n /**\r\n * Specifies if the material uses a texture\r\n * @param texture defines the texture to check against the material\r\n * @returns a boolean specifying if the material uses the texture\r\n */\r\n ShaderMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n for (var name in this._textures) {\r\n if (this._textures[name] === texture) {\r\n return true;\r\n }\r\n }\r\n for (var name in this._textureArrays) {\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n if (array[index] === texture) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n ShaderMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n var result = SerializationHelper.Clone(function () { return new ShaderMaterial(name, _this.getScene(), _this._shaderPath, _this._options); }, this);\r\n result.name = name;\r\n result.id = name;\r\n // Shader code path\r\n if (typeof result._shaderPath === 'object') {\r\n result._shaderPath = __assign({}, result._shaderPath);\r\n }\r\n // Options\r\n this._options = __assign({}, this._options);\r\n Object.keys(this._options).forEach(function (propName) {\r\n var propValue = _this._options[propName];\r\n if (Array.isArray(propValue)) {\r\n _this._options[propName] = propValue.slice(0);\r\n }\r\n });\r\n // Texture\r\n for (var key in this._textures) {\r\n result.setTexture(key, this._textures[key]);\r\n }\r\n // Float\r\n for (var key in this._floats) {\r\n result.setFloat(key, this._floats[key]);\r\n }\r\n // Floats\r\n for (var key in this._floatsArrays) {\r\n result.setFloats(key, this._floatsArrays[key]);\r\n }\r\n // Color3\r\n for (var key in this._colors3) {\r\n result.setColor3(key, this._colors3[key]);\r\n }\r\n // Color4\r\n for (var key in this._colors4) {\r\n result.setColor4(key, this._colors4[key]);\r\n }\r\n // Vector2\r\n for (var key in this._vectors2) {\r\n result.setVector2(key, this._vectors2[key]);\r\n }\r\n // Vector3\r\n for (var key in this._vectors3) {\r\n result.setVector3(key, this._vectors3[key]);\r\n }\r\n // Vector4\r\n for (var key in this._vectors4) {\r\n result.setVector4(key, this._vectors4[key]);\r\n }\r\n // Matrix\r\n for (var key in this._matrices) {\r\n result.setMatrix(key, this._matrices[key]);\r\n }\r\n // Matrix 3x3\r\n for (var key in this._matrices3x3) {\r\n result.setMatrix3x3(key, this._matrices3x3[key]);\r\n }\r\n // Matrix 2x2\r\n for (var key in this._matrices2x2) {\r\n result.setMatrix2x2(key, this._matrices2x2[key]);\r\n }\r\n return result;\r\n };\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\r\n * @param notBoundToMesh specifies if the material that is being disposed is known to be not bound to any mesh\r\n */\r\n ShaderMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures, notBoundToMesh) {\r\n if (forceDisposeTextures) {\r\n var name;\r\n for (name in this._textures) {\r\n this._textures[name].dispose();\r\n }\r\n for (name in this._textureArrays) {\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n array[index].dispose();\r\n }\r\n }\r\n }\r\n this._textures = {};\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures, notBoundToMesh);\r\n };\r\n /**\r\n * Serializes this material in a JSON representation\r\n * @returns the serialized material object\r\n */\r\n ShaderMaterial.prototype.serialize = function () {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.ShaderMaterial\";\r\n serializationObject.options = this._options;\r\n serializationObject.shaderPath = this._shaderPath;\r\n var name;\r\n // Texture\r\n serializationObject.textures = {};\r\n for (name in this._textures) {\r\n serializationObject.textures[name] = this._textures[name].serialize();\r\n }\r\n // Texture arrays\r\n serializationObject.textureArrays = {};\r\n for (name in this._textureArrays) {\r\n serializationObject.textureArrays[name] = [];\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n serializationObject.textureArrays[name].push(array[index].serialize());\r\n }\r\n }\r\n // Float\r\n serializationObject.floats = {};\r\n for (name in this._floats) {\r\n serializationObject.floats[name] = this._floats[name];\r\n }\r\n // Floats\r\n serializationObject.FloatArrays = {};\r\n for (name in this._floatsArrays) {\r\n serializationObject.FloatArrays[name] = this._floatsArrays[name];\r\n }\r\n // Color3\r\n serializationObject.colors3 = {};\r\n for (name in this._colors3) {\r\n serializationObject.colors3[name] = this._colors3[name].asArray();\r\n }\r\n // Color3 array\r\n serializationObject.colors3Arrays = {};\r\n for (name in this._colors3Arrays) {\r\n serializationObject.colors3Arrays[name] = this._colors3Arrays[name];\r\n }\r\n // Color4\r\n serializationObject.colors4 = {};\r\n for (name in this._colors4) {\r\n serializationObject.colors4[name] = this._colors4[name].asArray();\r\n }\r\n // Color4 array\r\n serializationObject.colors4Arrays = {};\r\n for (name in this._colors4Arrays) {\r\n serializationObject.colors4Arrays[name] = this._colors4Arrays[name];\r\n }\r\n // Vector2\r\n serializationObject.vectors2 = {};\r\n for (name in this._vectors2) {\r\n serializationObject.vectors2[name] = this._vectors2[name].asArray();\r\n }\r\n // Vector3\r\n serializationObject.vectors3 = {};\r\n for (name in this._vectors3) {\r\n serializationObject.vectors3[name] = this._vectors3[name].asArray();\r\n }\r\n // Vector4\r\n serializationObject.vectors4 = {};\r\n for (name in this._vectors4) {\r\n serializationObject.vectors4[name] = this._vectors4[name].asArray();\r\n }\r\n // Matrix\r\n serializationObject.matrices = {};\r\n for (name in this._matrices) {\r\n serializationObject.matrices[name] = this._matrices[name].asArray();\r\n }\r\n // MatrixArray\r\n serializationObject.matrixArray = {};\r\n for (name in this._matrixArrays) {\r\n serializationObject.matrixArray[name] = this._matrixArrays[name];\r\n }\r\n // Matrix 3x3\r\n serializationObject.matrices3x3 = {};\r\n for (name in this._matrices3x3) {\r\n serializationObject.matrices3x3[name] = this._matrices3x3[name];\r\n }\r\n // Matrix 2x2\r\n serializationObject.matrices2x2 = {};\r\n for (name in this._matrices2x2) {\r\n serializationObject.matrices2x2[name] = this._matrices2x2[name];\r\n }\r\n // Vector2Array\r\n serializationObject.vectors2Arrays = {};\r\n for (name in this._vectors2Arrays) {\r\n serializationObject.vectors2Arrays[name] = this._vectors2Arrays[name];\r\n }\r\n // Vector3Array\r\n serializationObject.vectors3Arrays = {};\r\n for (name in this._vectors3Arrays) {\r\n serializationObject.vectors3Arrays[name] = this._vectors3Arrays[name];\r\n }\r\n // Vector4Array\r\n serializationObject.vectors4Arrays = {};\r\n for (name in this._vectors4Arrays) {\r\n serializationObject.vectors4Arrays[name] = this._vectors4Arrays[name];\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a shader material from parsed shader material data\r\n * @param source defines the JSON represnetation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new material\r\n */\r\n ShaderMaterial.Parse = function (source, scene, rootUrl) {\r\n var material = SerializationHelper.Parse(function () { return new ShaderMaterial(source.name, scene, source.shaderPath, source.options); }, source, scene, rootUrl);\r\n var name;\r\n // Texture\r\n for (name in source.textures) {\r\n material.setTexture(name, Texture.Parse(source.textures[name], scene, rootUrl));\r\n }\r\n // Texture arrays\r\n for (name in source.textureArrays) {\r\n var array = source.textureArrays[name];\r\n var textureArray = new Array();\r\n for (var index = 0; index < array.length; index++) {\r\n textureArray.push(Texture.Parse(array[index], scene, rootUrl));\r\n }\r\n material.setTextureArray(name, textureArray);\r\n }\r\n // Float\r\n for (name in source.floats) {\r\n material.setFloat(name, source.floats[name]);\r\n }\r\n // Float s\r\n for (name in source.floatsArrays) {\r\n material.setFloats(name, source.floatsArrays[name]);\r\n }\r\n // Color3\r\n for (name in source.colors3) {\r\n material.setColor3(name, Color3.FromArray(source.colors3[name]));\r\n }\r\n // Color3 arrays\r\n for (name in source.colors3Arrays) {\r\n var colors = source.colors3Arrays[name].reduce(function (arr, num, i) {\r\n if (i % 3 === 0) {\r\n arr.push([num]);\r\n }\r\n else {\r\n arr[arr.length - 1].push(num);\r\n }\r\n return arr;\r\n }, []).map(function (color) { return Color3.FromArray(color); });\r\n material.setColor3Array(name, colors);\r\n }\r\n // Color4\r\n for (name in source.colors4) {\r\n material.setColor4(name, Color4.FromArray(source.colors4[name]));\r\n }\r\n // Color4 arrays\r\n for (name in source.colors4Arrays) {\r\n var colors = source.colors4Arrays[name].reduce(function (arr, num, i) {\r\n if (i % 4 === 0) {\r\n arr.push([num]);\r\n }\r\n else {\r\n arr[arr.length - 1].push(num);\r\n }\r\n return arr;\r\n }, []).map(function (color) { return Color4.FromArray(color); });\r\n material.setColor4Array(name, colors);\r\n }\r\n // Vector2\r\n for (name in source.vectors2) {\r\n material.setVector2(name, Vector2.FromArray(source.vectors2[name]));\r\n }\r\n // Vector3\r\n for (name in source.vectors3) {\r\n material.setVector3(name, Vector3.FromArray(source.vectors3[name]));\r\n }\r\n // Vector4\r\n for (name in source.vectors4) {\r\n material.setVector4(name, Vector4.FromArray(source.vectors4[name]));\r\n }\r\n // Matrix\r\n for (name in source.matrices) {\r\n material.setMatrix(name, Matrix.FromArray(source.matrices[name]));\r\n }\r\n // MatrixArray\r\n for (name in source.matrixArray) {\r\n material._matrixArrays[name] = new Float32Array(source.matrixArray[name]);\r\n }\r\n // Matrix 3x3\r\n for (name in source.matrices3x3) {\r\n material.setMatrix3x3(name, source.matrices3x3[name]);\r\n }\r\n // Matrix 2x2\r\n for (name in source.matrices2x2) {\r\n material.setMatrix2x2(name, source.matrices2x2[name]);\r\n }\r\n // Vector2Array\r\n for (name in source.vectors2Arrays) {\r\n material.setArray2(name, source.vectors2Arrays[name]);\r\n }\r\n // Vector3Array\r\n for (name in source.vectors3Arrays) {\r\n material.setArray3(name, source.vectors3Arrays[name]);\r\n }\r\n // Vector4Array\r\n for (name in source.vectors4Arrays) {\r\n material.setArray4(name, source.vectors4Arrays[name]);\r\n }\r\n return material;\r\n };\r\n /**\r\n * Creates a new ShaderMaterial from a snippet saved in a remote file\r\n * @param name defines the name of the ShaderMaterial to create (can be null or empty to use the one from the json data)\r\n * @param url defines the url to load from\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a promise that will resolve to the new ShaderMaterial\r\n */\r\n ShaderMaterial.ParseFromFileAsync = function (name, url, scene, rootUrl) {\r\n var _this = this;\r\n if (rootUrl === void 0) { rootUrl = \"\"; }\r\n return new Promise(function (resolve, reject) {\r\n var request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", function () {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n var serializationObject = JSON.parse(request.responseText);\r\n var output = _this.Parse(serializationObject, scene || Engine.LastCreatedScene, rootUrl);\r\n if (name) {\r\n output.name = name;\r\n }\r\n resolve(output);\r\n }\r\n else {\r\n reject(\"Unable to load the ShaderMaterial\");\r\n }\r\n }\r\n });\r\n request.open(\"GET\", url);\r\n request.send();\r\n });\r\n };\r\n /**\r\n * Creates a ShaderMaterial from a snippet saved by the Inspector\r\n * @param snippetId defines the snippet to load\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a promise that will resolve to the new ShaderMaterial\r\n */\r\n ShaderMaterial.CreateFromSnippetAsync = function (snippetId, scene, rootUrl) {\r\n var _this = this;\r\n if (rootUrl === void 0) { rootUrl = \"\"; }\r\n return new Promise(function (resolve, reject) {\r\n var request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", function () {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n var snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n var serializationObject = JSON.parse(snippet.shaderMaterial);\r\n var output = _this.Parse(serializationObject, scene || Engine.LastCreatedScene, rootUrl);\r\n output.snippetId = snippetId;\r\n resolve(output);\r\n }\r\n else {\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n request.open(\"GET\", _this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n };\r\n /** Define the Url to load snippets */\r\n ShaderMaterial.SnippetUrl = \"https://snippet.babylonjs.com\";\r\n return ShaderMaterial;\r\n}(Material));\r\nexport { ShaderMaterial };\r\n_TypeStore.RegisteredTypes[\"BABYLON.ShaderMaterial\"] = ShaderMaterial;\r\n//# sourceMappingURL=shaderMaterial.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'defaultFragmentDeclaration';\r\nvar shader = \"uniform vec4 vDiffuseColor;\\n#ifdef SPECULARTERM\\nuniform vec4 vSpecularColor;\\n#endif\\nuniform vec3 vEmissiveColor;\\nuniform float visibility;\\n\\n#ifdef DIFFUSE\\nuniform vec2 vDiffuseInfos;\\n#endif\\n#ifdef AMBIENT\\nuniform vec2 vAmbientInfos;\\n#endif\\n#ifdef OPACITY\\nuniform vec2 vOpacityInfos;\\n#endif\\n#ifdef EMISSIVE\\nuniform vec2 vEmissiveInfos;\\n#endif\\n#ifdef LIGHTMAP\\nuniform vec2 vLightmapInfos;\\n#endif\\n#ifdef BUMP\\nuniform vec3 vBumpInfos;\\nuniform vec2 vTangentSpaceParams;\\n#endif\\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\\nuniform mat4 view;\\n#endif\\n#ifdef REFRACTION\\nuniform vec4 vRefractionInfos;\\n#ifndef REFRACTIONMAP_3D\\nuniform mat4 refractionMatrix;\\n#endif\\n#ifdef REFRACTIONFRESNEL\\nuniform vec4 refractionLeftColor;\\nuniform vec4 refractionRightColor;\\n#endif\\n#endif\\n#if defined(SPECULAR) && defined(SPECULARTERM)\\nuniform vec2 vSpecularInfos;\\n#endif\\n#ifdef DIFFUSEFRESNEL\\nuniform vec4 diffuseLeftColor;\\nuniform vec4 diffuseRightColor;\\n#endif\\n#ifdef OPACITYFRESNEL\\nuniform vec4 opacityParts;\\n#endif\\n#ifdef EMISSIVEFRESNEL\\nuniform vec4 emissiveLeftColor;\\nuniform vec4 emissiveRightColor;\\n#endif\\n\\n#ifdef REFLECTION\\nuniform vec2 vReflectionInfos;\\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)\\nuniform mat4 reflectionMatrix;\\n#endif\\n#ifndef REFLECTIONMAP_SKYBOX\\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\\nuniform vec3 vReflectionPosition;\\nuniform vec3 vReflectionSize;\\n#endif\\n#endif\\n#ifdef REFLECTIONFRESNEL\\nuniform vec4 reflectionLeftColor;\\nuniform vec4 reflectionRightColor;\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var defaultFragmentDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=defaultFragmentDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'defaultUboDeclaration';\r\nvar shader = \"layout(std140,column_major) uniform;\\nuniform Material\\n{\\nvec4 diffuseLeftColor;\\nvec4 diffuseRightColor;\\nvec4 opacityParts;\\nvec4 reflectionLeftColor;\\nvec4 reflectionRightColor;\\nvec4 refractionLeftColor;\\nvec4 refractionRightColor;\\nvec4 emissiveLeftColor;\\nvec4 emissiveRightColor;\\nvec2 vDiffuseInfos;\\nvec2 vAmbientInfos;\\nvec2 vOpacityInfos;\\nvec2 vReflectionInfos;\\nvec3 vReflectionPosition;\\nvec3 vReflectionSize;\\nvec2 vEmissiveInfos;\\nvec2 vLightmapInfos;\\nvec2 vSpecularInfos;\\nvec3 vBumpInfos;\\nmat4 diffuseMatrix;\\nmat4 ambientMatrix;\\nmat4 opacityMatrix;\\nmat4 reflectionMatrix;\\nmat4 emissiveMatrix;\\nmat4 lightmapMatrix;\\nmat4 specularMatrix;\\nmat4 bumpMatrix;\\nvec2 vTangentSpaceParams;\\nfloat pointSize;\\nmat4 refractionMatrix;\\nvec4 vRefractionInfos;\\nvec4 vSpecularColor;\\nvec3 vEmissiveColor;\\nfloat visibility;\\nvec4 vDiffuseColor;\\nvec4 vDetailInfos;\\nmat4 detailMatrix;\\n};\\nuniform Scene {\\nmat4 viewProjection;\\n#ifdef MULTIVIEW\\nmat4 viewProjectionR;\\n#endif\\nmat4 view;\\n};\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var defaultUboDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=defaultUboDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'lightsFragmentFunctions';\r\nvar shader = \"\\nstruct lightingInfo\\n{\\nvec3 diffuse;\\n#ifdef SPECULARTERM\\nvec3 specular;\\n#endif\\n#ifdef NDOTL\\nfloat ndl;\\n#endif\\n};\\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\\nlightingInfo result;\\nvec3 lightVectorW;\\nfloat attenuation=1.0;\\nif (lightData.w == 0.)\\n{\\nvec3 direction=lightData.xyz-vPositionW;\\nattenuation=max(0.,1.0-length(direction)/range);\\nlightVectorW=normalize(direction);\\n}\\nelse\\n{\\nlightVectorW=normalize(-lightData.xyz);\\n}\\n\\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=ndl*diffuseColor*attenuation;\\n#ifdef SPECULARTERM\\n\\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor*attenuation;\\n#endif\\nreturn result;\\n}\\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\\nlightingInfo result;\\nvec3 direction=lightData.xyz-vPositionW;\\nvec3 lightVectorW=normalize(direction);\\nfloat attenuation=max(0.,1.0-length(direction)/range);\\n\\nfloat cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));\\nif (cosAngle>=lightDirection.w)\\n{\\ncosAngle=max(0.,pow(cosAngle,lightData.w));\\nattenuation*=cosAngle;\\n\\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=ndl*diffuseColor*attenuation;\\n#ifdef SPECULARTERM\\n\\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor*attenuation;\\n#endif\\nreturn result;\\n}\\nresult.diffuse=vec3(0.);\\n#ifdef SPECULARTERM\\nresult.specular=vec3(0.);\\n#endif\\n#ifdef NDOTL\\nresult.ndl=0.;\\n#endif\\nreturn result;\\n}\\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\\nlightingInfo result;\\n\\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\\n#ifdef SPECULARTERM\\n\\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor;\\n#endif\\nreturn result;\\n}\\n#define inline\\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\\nstrq/=strq.w;\\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\\nreturn textureColor;\\n}\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var lightsFragmentFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=lightsFragmentFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'fresnelFunction';\r\nvar shader = \"#ifdef FRESNEL\\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\\n{\\nfloat fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);\\nreturn clamp(fresnelTerm,0.,1.);\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var fresnelFunction = { name: name, shader: shader };\r\n//# sourceMappingURL=fresnelFunction.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/defaultFragmentDeclaration\";\r\nimport \"./ShadersInclude/defaultUboDeclaration\";\r\nimport \"./ShadersInclude/prePassDeclaration\";\r\nimport \"./ShadersInclude/helperFunctions\";\r\nimport \"./ShadersInclude/lightFragmentDeclaration\";\r\nimport \"./ShadersInclude/lightUboDeclaration\";\r\nimport \"./ShadersInclude/lightsFragmentFunctions\";\r\nimport \"./ShadersInclude/shadowsFragmentFunctions\";\r\nimport \"./ShadersInclude/fresnelFunction\";\r\nimport \"./ShadersInclude/reflectionFunction\";\r\nimport \"./ShadersInclude/imageProcessingDeclaration\";\r\nimport \"./ShadersInclude/imageProcessingFunctions\";\r\nimport \"./ShadersInclude/bumpFragmentMainFunctions\";\r\nimport \"./ShadersInclude/bumpFragmentFunctions\";\r\nimport \"./ShadersInclude/clipPlaneFragmentDeclaration\";\r\nimport \"./ShadersInclude/logDepthDeclaration\";\r\nimport \"./ShadersInclude/fogFragmentDeclaration\";\r\nimport \"./ShadersInclude/clipPlaneFragment\";\r\nimport \"./ShadersInclude/bumpFragment\";\r\nimport \"./ShadersInclude/depthPrePass\";\r\nimport \"./ShadersInclude/lightFragment\";\r\nimport \"./ShadersInclude/logDepthFragment\";\r\nimport \"./ShadersInclude/fogFragment\";\r\nvar name = 'defaultPixelShader';\r\nvar shader = \"#include<__decl__defaultFragment>\\n#if defined(BUMP) || !defined(NORMAL)\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\n#include[SCENE_MRT_COUNT]\\n#define CUSTOM_FRAGMENT_BEGIN\\n#ifdef LOGARITHMICDEPTH\\n#extension GL_EXT_frag_depth : enable\\n#endif\\n\\n#define RECIPROCAL_PI2 0.15915494\\nuniform vec3 vEyePosition;\\nuniform vec3 vAmbientColor;\\n\\nvarying vec3 vPositionW;\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#endif\\n#ifdef VERTEXCOLOR\\nvarying vec4 vColor;\\n#endif\\n#ifdef MAINUV1\\nvarying vec2 vMainUV1;\\n#endif\\n#ifdef MAINUV2\\nvarying vec2 vMainUV2;\\n#endif\\n\\n#include\\n\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#include\\n#include\\n\\n#ifdef DIFFUSE\\n#if DIFFUSEDIRECTUV == 1\\n#define vDiffuseUV vMainUV1\\n#elif DIFFUSEDIRECTUV == 2\\n#define vDiffuseUV vMainUV2\\n#else\\nvarying vec2 vDiffuseUV;\\n#endif\\nuniform sampler2D diffuseSampler;\\n#endif\\n#ifdef AMBIENT\\n#if AMBIENTDIRECTUV == 1\\n#define vAmbientUV vMainUV1\\n#elif AMBIENTDIRECTUV == 2\\n#define vAmbientUV vMainUV2\\n#else\\nvarying vec2 vAmbientUV;\\n#endif\\nuniform sampler2D ambientSampler;\\n#endif\\n#ifdef OPACITY\\n#if OPACITYDIRECTUV == 1\\n#define vOpacityUV vMainUV1\\n#elif OPACITYDIRECTUV == 2\\n#define vOpacityUV vMainUV2\\n#else\\nvarying vec2 vOpacityUV;\\n#endif\\nuniform sampler2D opacitySampler;\\n#endif\\n#ifdef EMISSIVE\\n#if EMISSIVEDIRECTUV == 1\\n#define vEmissiveUV vMainUV1\\n#elif EMISSIVEDIRECTUV == 2\\n#define vEmissiveUV vMainUV2\\n#else\\nvarying vec2 vEmissiveUV;\\n#endif\\nuniform sampler2D emissiveSampler;\\n#endif\\n#ifdef LIGHTMAP\\n#if LIGHTMAPDIRECTUV == 1\\n#define vLightmapUV vMainUV1\\n#elif LIGHTMAPDIRECTUV == 2\\n#define vLightmapUV vMainUV2\\n#else\\nvarying vec2 vLightmapUV;\\n#endif\\nuniform sampler2D lightmapSampler;\\n#endif\\n#ifdef REFRACTION\\n#ifdef REFRACTIONMAP_3D\\nuniform samplerCube refractionCubeSampler;\\n#else\\nuniform sampler2D refraction2DSampler;\\n#endif\\n#endif\\n#if defined(SPECULAR) && defined(SPECULARTERM)\\n#if SPECULARDIRECTUV == 1\\n#define vSpecularUV vMainUV1\\n#elif SPECULARDIRECTUV == 2\\n#define vSpecularUV vMainUV2\\n#else\\nvarying vec2 vSpecularUV;\\n#endif\\nuniform sampler2D specularSampler;\\n#endif\\n#ifdef ALPHATEST\\nuniform float alphaCutOff;\\n#endif\\n\\n#include\\n\\n#ifdef REFLECTION\\n#ifdef REFLECTIONMAP_3D\\nuniform samplerCube reflectionCubeSampler;\\n#else\\nuniform sampler2D reflection2DSampler;\\n#endif\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#else\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\n#endif\\n#include\\n#endif\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\n#include\\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\\n\\nvec4 baseColor=vec4(1.,1.,1.,1.);\\nvec3 diffuseColor=vDiffuseColor.rgb;\\n\\nfloat alpha=vDiffuseColor.a;\\n\\n#ifdef NORMAL\\nvec3 normalW=normalize(vNormalW);\\n#else\\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\\n#endif\\n#include\\n#ifdef TWOSIDEDLIGHTING\\nnormalW=gl_FrontFacing ? normalW : -normalW;\\n#endif\\n#ifdef DIFFUSE\\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\\n#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)\\nif (baseColor.a\\n#ifdef VERTEXCOLOR\\nbaseColor.rgb*=vColor.rgb;\\n#endif\\n#ifdef DETAIL\\nbaseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\\n\\nvec3 baseAmbientColor=vec3(1.,1.,1.);\\n#ifdef AMBIENT\\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\\n#endif\\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\\n\\n#ifdef SPECULARTERM\\nfloat glossiness=vSpecularColor.a;\\nvec3 specularColor=vSpecularColor.rgb;\\n#ifdef SPECULAR\\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);\\nspecularColor=specularMapColor.rgb;\\n#ifdef GLOSSINESS\\nglossiness=glossiness*specularMapColor.a;\\n#endif\\n#endif\\n#else\\nfloat glossiness=0.;\\n#endif\\n\\nvec3 diffuseBase=vec3(0.,0.,0.);\\nlightingInfo info;\\n#ifdef SPECULARTERM\\nvec3 specularBase=vec3(0.,0.,0.);\\n#endif\\nfloat shadow=1.;\\n#ifdef LIGHTMAP\\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\\n#ifdef RGBDLIGHTMAP\\nlightmapColor.rgb=fromRGBD(lightmapColor);\\n#endif\\nlightmapColor.rgb*=vLightmapInfos.y;\\n#endif\\n#include[0..maxSimultaneousLights]\\n\\nvec4 refractionColor=vec4(0.,0.,0.,1.);\\n#ifdef REFRACTION\\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\\n#ifdef REFRACTIONMAP_3D\\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\\nif (dot(refractionVector,viewDirectionW)<1.0) {\\nrefractionColor=textureCube(refractionCubeSampler,refractionVector);\\n}\\n#else\\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\\nrefractionCoords.y=1.0-refractionCoords.y;\\nrefractionColor=texture2D(refraction2DSampler,refractionCoords);\\n#endif\\n#ifdef RGBDREFRACTION\\nrefractionColor.rgb=fromRGBD(refractionColor);\\n#endif\\n#ifdef IS_REFRACTION_LINEAR\\nrefractionColor.rgb=toGammaSpace(refractionColor.rgb);\\n#endif\\nrefractionColor.rgb*=vRefractionInfos.x;\\n#endif\\n\\nvec4 reflectionColor=vec4(0.,0.,0.,1.);\\n#ifdef REFLECTION\\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\\n#ifdef REFLECTIONMAP_3D\\n#ifdef ROUGHNESS\\nfloat bias=vReflectionInfos.y;\\n#ifdef SPECULARTERM\\n#ifdef SPECULAR\\n#ifdef GLOSSINESS\\nbias*=(1.0-specularMapColor.a);\\n#endif\\n#endif\\n#endif\\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);\\n#else\\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);\\n#endif\\n#else\\nvec2 coords=vReflectionUVW.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\ncoords/=vReflectionUVW.z;\\n#endif\\ncoords.y=1.0-coords.y;\\nreflectionColor=texture2D(reflection2DSampler,coords);\\n#endif\\n#ifdef RGBDREFLECTION\\nreflectionColor.rgb=fromRGBD(reflectionColor);\\n#endif\\n#ifdef IS_REFLECTION_LINEAR\\nreflectionColor.rgb=toGammaSpace(reflectionColor.rgb);\\n#endif\\nreflectionColor.rgb*=vReflectionInfos.x;\\n#ifdef REFLECTIONFRESNEL\\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\\n#ifdef REFLECTIONFRESNELFROMSPECULAR\\n#ifdef SPECULARTERM\\nreflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\\n#else\\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\\n#endif\\n#else\\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\\n#endif\\n#endif\\n#endif\\n#ifdef REFRACTIONFRESNEL\\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);\\nrefractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\\n#endif\\n#ifdef OPACITY\\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\\n#ifdef OPACITYRGB\\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\\n#else\\nalpha*=opacityMap.a*vOpacityInfos.y;\\n#endif\\n#endif\\n#ifdef VERTEXALPHA\\nalpha*=vColor.a;\\n#endif\\n#ifdef OPACITYFRESNEL\\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\\n#endif\\n#ifdef ALPHATEST\\n#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS\\nif (alpha\\n#include\\n\\n\\n#ifdef IMAGEPROCESSINGPOSTPROCESS\\ncolor.rgb=toLinearSpace(color.rgb);\\n#else\\n#ifdef IMAGEPROCESSING\\ncolor.rgb=toLinearSpace(color.rgb);\\ncolor=applyImageProcessing(color);\\n#endif\\n#endif\\ncolor.a*=visibility;\\n#ifdef PREMULTIPLYALPHA\\n\\ncolor.rgb*=color.a;\\n#endif\\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\\n#ifdef PREPASS\\ngl_FragData[0]=color;\\n#ifdef PREPASS_POSITION\\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,1.0);\\n#endif\\n#ifdef PREPASS_VELOCITY\\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\\nvec2 velocity=abs(a-b);\\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\\ngl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\\n#endif\\n#ifdef PREPASS_IRRADIANCE\\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,1.0);\\n#endif\\n#ifdef PREPASS_DEPTHNORMAL\\ngl_FragData[PREPASS_DEPTHNORMAL_INDEX]=vec4(vViewPos.z,(view*vec4(normalW,0.0)).rgb);\\n#endif\\n#ifdef PREPASS_ALBEDO\\ngl_FragData[PREPASS_ALBEDO_INDEX]=vec4(0.0,0.0,0.0,1.0);\\n#endif\\n#ifdef PREPASS_REFLECTIVITY\\n#if defined(SPECULAR)\\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=specularMapColor;\\n#else\\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(0.0,0.0,0.0,1.0);\\n#endif\\n#endif\\n#endif\\n#if !defined(PREPASS) || defined(WEBGL2)\\ngl_FragColor=color;\\n#endif\\n}\\n\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var defaultPixelShader = { name: name, shader: shader };\r\n//# sourceMappingURL=default.fragment.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'defaultVertexDeclaration';\r\nvar shader = \"\\nuniform mat4 viewProjection;\\nuniform mat4 view;\\n#ifdef DIFFUSE\\nuniform mat4 diffuseMatrix;\\nuniform vec2 vDiffuseInfos;\\n#endif\\n#ifdef AMBIENT\\nuniform mat4 ambientMatrix;\\nuniform vec2 vAmbientInfos;\\n#endif\\n#ifdef OPACITY\\nuniform mat4 opacityMatrix;\\nuniform vec2 vOpacityInfos;\\n#endif\\n#ifdef EMISSIVE\\nuniform vec2 vEmissiveInfos;\\nuniform mat4 emissiveMatrix;\\n#endif\\n#ifdef LIGHTMAP\\nuniform vec2 vLightmapInfos;\\nuniform mat4 lightmapMatrix;\\n#endif\\n#if defined(SPECULAR) && defined(SPECULARTERM)\\nuniform vec2 vSpecularInfos;\\nuniform mat4 specularMatrix;\\n#endif\\n#ifdef BUMP\\nuniform vec3 vBumpInfos;\\nuniform mat4 bumpMatrix;\\n#endif\\n#ifdef REFLECTION\\nuniform mat4 reflectionMatrix;\\n#endif\\n#ifdef POINTSIZE\\nuniform float pointSize;\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var defaultVertexDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=defaultVertexDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pointCloudVertex';\r\nvar shader = \"#ifdef POINTSIZE\\ngl_PointSize=pointSize;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pointCloudVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=pointCloudVertex.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/defaultVertexDeclaration\";\r\nimport \"./ShadersInclude/defaultUboDeclaration\";\r\nimport \"./ShadersInclude/helperFunctions\";\r\nimport \"./ShadersInclude/bonesDeclaration\";\r\nimport \"./ShadersInclude/instancesDeclaration\";\r\nimport \"./ShadersInclude/prePassVertexDeclaration\";\r\nimport \"./ShadersInclude/bumpVertexDeclaration\";\r\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\r\nimport \"./ShadersInclude/fogVertexDeclaration\";\r\nimport \"./ShadersInclude/lightFragmentDeclaration\";\r\nimport \"./ShadersInclude/lightUboDeclaration\";\r\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration\";\r\nimport \"./ShadersInclude/morphTargetsVertexDeclaration\";\r\nimport \"./ShadersInclude/logDepthDeclaration\";\r\nimport \"./ShadersInclude/morphTargetsVertex\";\r\nimport \"./ShadersInclude/instancesVertex\";\r\nimport \"./ShadersInclude/bonesVertex\";\r\nimport \"./ShadersInclude/prePassVertex\";\r\nimport \"./ShadersInclude/bumpVertex\";\r\nimport \"./ShadersInclude/clipPlaneVertex\";\r\nimport \"./ShadersInclude/fogVertex\";\r\nimport \"./ShadersInclude/shadowsVertex\";\r\nimport \"./ShadersInclude/pointCloudVertex\";\r\nimport \"./ShadersInclude/logDepthVertex\";\r\nvar name = 'defaultVertexShader';\r\nvar shader = \"#include<__decl__defaultVertex>\\n\\n#define CUSTOM_VERTEX_BEGIN\\nattribute vec3 position;\\n#ifdef NORMAL\\nattribute vec3 normal;\\n#endif\\n#ifdef TANGENT\\nattribute vec4 tangent;\\n#endif\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\n#ifdef VERTEXCOLOR\\nattribute vec4 color;\\n#endif\\n#include\\n#include\\n\\n#include\\n#include\\n#ifdef MAINUV1\\nvarying vec2 vMainUV1;\\n#endif\\n#ifdef MAINUV2\\nvarying vec2 vMainUV2;\\n#endif\\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\\nvarying vec2 vDiffuseUV;\\n#endif\\n#if defined(DETAIL) && DETAILDIRECTUV == 0\\nvarying vec2 vDetailUV;\\n#endif\\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\\nvarying vec2 vAmbientUV;\\n#endif\\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\\nvarying vec2 vOpacityUV;\\n#endif\\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\\nvarying vec2 vEmissiveUV;\\n#endif\\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\\nvarying vec2 vLightmapUV;\\n#endif\\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\\nvarying vec2 vSpecularUV;\\n#endif\\n#if defined(BUMP) && BUMPDIRECTUV == 0\\nvarying vec2 vBumpUV;\\n#endif\\n\\nvarying vec3 vPositionW;\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#endif\\n#ifdef VERTEXCOLOR\\nvarying vec4 vColor;\\n#endif\\n#include\\n#include\\n#include\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\n#include\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\nvec3 positionUpdated=position;\\n#ifdef NORMAL\\nvec3 normalUpdated=normal;\\n#endif\\n#ifdef TANGENT\\nvec4 tangentUpdated=tangent;\\n#endif\\n#ifdef UV1\\nvec2 uvUpdated=uv;\\n#endif\\n#include[0..maxSimultaneousMorphTargets]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvPositionUVW=positionUpdated;\\n#endif\\n#define CUSTOM_VERTEX_UPDATE_POSITION\\n#define CUSTOM_VERTEX_UPDATE_NORMAL\\n#include\\n#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\\n\\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\\n#endif\\n#include\\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\\n#ifdef NORMAL\\nmat3 normalWorld=mat3(finalWorld);\\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));\\nvNormalW=normalize(normalWorld*vNormalW);\\n#else\\n#ifdef NONUNIFORMSCALING\\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\\n#endif\\nvNormalW=normalize(normalWorld*normalUpdated);\\n#endif\\n#endif\\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR == 0u) {\\ngl_Position=viewProjection*worldPos;\\n} else {\\ngl_Position=viewProjectionR*worldPos;\\n}\\n#else\\ngl_Position=viewProjection*worldPos;\\n#endif\\nvPositionW=vec3(worldPos);\\n#include\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\\n#endif\\n\\n#ifndef UV1\\nvec2 uvUpdated=vec2(0.,0.);\\n#endif\\n#ifndef UV2\\nvec2 uv2=vec2(0.,0.);\\n#endif\\n#ifdef MAINUV1\\nvMainUV1=uvUpdated;\\n#endif\\n#ifdef MAINUV2\\nvMainUV2=uv2;\\n#endif\\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\\nif (vDiffuseInfos.x == 0.)\\n{\\nvDiffuseUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(DETAIL) && DETAILDIRECTUV == 0\\nif (vDetailInfos.x == 0.)\\n{\\nvDetailUV=vec2(detailMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvDetailUV=vec2(detailMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\\nif (vAmbientInfos.x == 0.)\\n{\\nvAmbientUV=vec2(ambientMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\\nif (vOpacityInfos.x == 0.)\\n{\\nvOpacityUV=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\\nif (vEmissiveInfos.x == 0.)\\n{\\nvEmissiveUV=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\\nif (vLightmapInfos.x == 0.)\\n{\\nvLightmapUV=vec2(lightmapMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\\nif (vSpecularInfos.x == 0.)\\n{\\nvSpecularUV=vec2(specularMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvSpecularUV=vec2(specularMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(BUMP) && BUMPDIRECTUV == 0\\nif (vBumpInfos.x == 0.)\\n{\\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#include\\n#include\\n#include\\n#include[0..maxSimultaneousLights]\\n#ifdef VERTEXCOLOR\\n\\nvColor=color;\\n#endif\\n#include\\n#include\\n#define CUSTOM_VERTEX_MAIN_END\\n}\\n\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var defaultVertexShader = { name: name, shader: shader };\r\n//# sourceMappingURL=default.vertex.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, SerializationHelper, serializeAsColor3, expandToProperty, serializeAsFresnelParameters, serializeAsTexture } from \"../Misc/decorators\";\r\nimport { SmartArray } from \"../Misc/smartArray\";\r\nimport { Scene } from \"../scene\";\r\nimport { Matrix } from \"../Maths/math.vector\";\r\nimport { Color3 } from '../Maths/math.color';\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { PrePassConfiguration } from \"./prePassConfiguration\";\r\nimport { ImageProcessingConfiguration } from \"./imageProcessingConfiguration\";\r\nimport { Material } from \"../Materials/material\";\r\nimport { MaterialDefines } from \"../Materials/materialDefines\";\r\nimport { PushMaterial } from \"./pushMaterial\";\r\nimport { MaterialHelper } from \"./materialHelper\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { _TypeStore } from \"../Misc/typeStore\";\r\nimport { MaterialFlags } from \"./materialFlags\";\r\nimport \"../Shaders/default.fragment\";\r\nimport \"../Shaders/default.vertex\";\r\nimport { EffectFallbacks } from './effectFallbacks';\r\nimport { DetailMapConfiguration } from './material.detailMapConfiguration';\r\nvar onCreatedEffectParameters = { effect: null, subMesh: null };\r\n/** @hidden */\r\nvar StandardMaterialDefines = /** @class */ (function (_super) {\r\n __extends(StandardMaterialDefines, _super);\r\n function StandardMaterialDefines() {\r\n var _this = _super.call(this) || this;\r\n _this.MAINUV1 = false;\r\n _this.MAINUV2 = false;\r\n _this.DIFFUSE = false;\r\n _this.DIFFUSEDIRECTUV = 0;\r\n _this.DETAIL = false;\r\n _this.DETAILDIRECTUV = 0;\r\n _this.DETAIL_NORMALBLENDMETHOD = 0;\r\n _this.AMBIENT = false;\r\n _this.AMBIENTDIRECTUV = 0;\r\n _this.OPACITY = false;\r\n _this.OPACITYDIRECTUV = 0;\r\n _this.OPACITYRGB = false;\r\n _this.REFLECTION = false;\r\n _this.EMISSIVE = false;\r\n _this.EMISSIVEDIRECTUV = 0;\r\n _this.SPECULAR = false;\r\n _this.SPECULARDIRECTUV = 0;\r\n _this.BUMP = false;\r\n _this.BUMPDIRECTUV = 0;\r\n _this.PARALLAX = false;\r\n _this.PARALLAXOCCLUSION = false;\r\n _this.SPECULAROVERALPHA = false;\r\n _this.CLIPPLANE = false;\r\n _this.CLIPPLANE2 = false;\r\n _this.CLIPPLANE3 = false;\r\n _this.CLIPPLANE4 = false;\r\n _this.CLIPPLANE5 = false;\r\n _this.CLIPPLANE6 = false;\r\n _this.ALPHATEST = false;\r\n _this.DEPTHPREPASS = false;\r\n _this.ALPHAFROMDIFFUSE = false;\r\n _this.POINTSIZE = false;\r\n _this.FOG = false;\r\n _this.SPECULARTERM = false;\r\n _this.DIFFUSEFRESNEL = false;\r\n _this.OPACITYFRESNEL = false;\r\n _this.REFLECTIONFRESNEL = false;\r\n _this.REFRACTIONFRESNEL = false;\r\n _this.EMISSIVEFRESNEL = false;\r\n _this.FRESNEL = false;\r\n _this.NORMAL = false;\r\n _this.UV1 = false;\r\n _this.UV2 = false;\r\n _this.VERTEXCOLOR = false;\r\n _this.VERTEXALPHA = false;\r\n _this.NUM_BONE_INFLUENCERS = 0;\r\n _this.BonesPerMesh = 0;\r\n _this.BONETEXTURE = false;\r\n _this.BONES_VELOCITY_ENABLED = false;\r\n _this.INSTANCES = false;\r\n _this.THIN_INSTANCES = false;\r\n _this.GLOSSINESS = false;\r\n _this.ROUGHNESS = false;\r\n _this.EMISSIVEASILLUMINATION = false;\r\n _this.LINKEMISSIVEWITHDIFFUSE = false;\r\n _this.REFLECTIONFRESNELFROMSPECULAR = false;\r\n _this.LIGHTMAP = false;\r\n _this.LIGHTMAPDIRECTUV = 0;\r\n _this.OBJECTSPACE_NORMALMAP = false;\r\n _this.USELIGHTMAPASSHADOWMAP = false;\r\n _this.REFLECTIONMAP_3D = false;\r\n _this.REFLECTIONMAP_SPHERICAL = false;\r\n _this.REFLECTIONMAP_PLANAR = false;\r\n _this.REFLECTIONMAP_CUBIC = false;\r\n _this.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\r\n _this.REFLECTIONMAP_PROJECTION = false;\r\n _this.REFLECTIONMAP_SKYBOX = false;\r\n _this.REFLECTIONMAP_EXPLICIT = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n _this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n _this.INVERTCUBICMAP = false;\r\n _this.LOGARITHMICDEPTH = false;\r\n _this.REFRACTION = false;\r\n _this.REFRACTIONMAP_3D = false;\r\n _this.REFLECTIONOVERALPHA = false;\r\n _this.TWOSIDEDLIGHTING = false;\r\n _this.SHADOWFLOAT = false;\r\n _this.MORPHTARGETS = false;\r\n _this.MORPHTARGETS_NORMAL = false;\r\n _this.MORPHTARGETS_TANGENT = false;\r\n _this.MORPHTARGETS_UV = false;\r\n _this.NUM_MORPH_INFLUENCERS = 0;\r\n _this.NONUNIFORMSCALING = false; // https://playground.babylonjs.com#V6DWIH\r\n _this.PREMULTIPLYALPHA = false; // https://playground.babylonjs.com#LNVJJ7\r\n _this.ALPHATEST_AFTERALLALPHACOMPUTATIONS = false;\r\n _this.ALPHABLEND = true;\r\n _this.PREPASS = false;\r\n _this.PREPASS_IRRADIANCE = false;\r\n _this.PREPASS_IRRADIANCE_INDEX = -1;\r\n _this.PREPASS_ALBEDO = false;\r\n _this.PREPASS_ALBEDO_INDEX = -1;\r\n _this.PREPASS_DEPTHNORMAL = false;\r\n _this.PREPASS_DEPTHNORMAL_INDEX = -1;\r\n _this.PREPASS_POSITION = false;\r\n _this.PREPASS_POSITION_INDEX = -1;\r\n _this.PREPASS_VELOCITY = false;\r\n _this.PREPASS_VELOCITY_INDEX = -1;\r\n _this.PREPASS_REFLECTIVITY = false;\r\n _this.PREPASS_REFLECTIVITY_INDEX = -1;\r\n _this.SCENE_MRT_COUNT = 0;\r\n _this.RGBDLIGHTMAP = false;\r\n _this.RGBDREFLECTION = false;\r\n _this.RGBDREFRACTION = false;\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n _this.MULTIVIEW = false;\r\n /**\r\n * If the reflection texture on this material is in linear color space\r\n * @hidden\r\n */\r\n _this.IS_REFLECTION_LINEAR = false;\r\n /**\r\n * If the refraction texture on this material is in linear color space\r\n * @hidden\r\n */\r\n _this.IS_REFRACTION_LINEAR = false;\r\n _this.EXPOSURE = false;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n StandardMaterialDefines.prototype.setReflectionMode = function (modeToEnable) {\r\n var modes = [\r\n \"REFLECTIONMAP_CUBIC\", \"REFLECTIONMAP_EXPLICIT\", \"REFLECTIONMAP_PLANAR\",\r\n \"REFLECTIONMAP_PROJECTION\", \"REFLECTIONMAP_PROJECTION\", \"REFLECTIONMAP_SKYBOX\",\r\n \"REFLECTIONMAP_SPHERICAL\", \"REFLECTIONMAP_EQUIRECTANGULAR\", \"REFLECTIONMAP_EQUIRECTANGULAR_FIXED\",\r\n \"REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\"\r\n ];\r\n for (var _i = 0, modes_1 = modes; _i < modes_1.length; _i++) {\r\n var mode = modes_1[_i];\r\n this[mode] = (mode === modeToEnable);\r\n }\r\n };\r\n return StandardMaterialDefines;\r\n}(MaterialDefines));\r\nexport { StandardMaterialDefines };\r\n/**\r\n * This is the default material used in Babylon. It is the best trade off between quality\r\n * and performances.\r\n * @see https://doc.babylonjs.com/babylon101/materials\r\n */\r\nvar StandardMaterial = /** @class */ (function (_super) {\r\n __extends(StandardMaterial, _super);\r\n /**\r\n * Instantiates a new standard material.\r\n * This is the default material used in Babylon. It is the best trade off between quality\r\n * and performances.\r\n * @see https://doc.babylonjs.com/babylon101/materials\r\n * @param name Define the name of the material in the scene\r\n * @param scene Define the scene the material belong to\r\n */\r\n function StandardMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._diffuseTexture = null;\r\n _this._ambientTexture = null;\r\n _this._opacityTexture = null;\r\n _this._reflectionTexture = null;\r\n _this._emissiveTexture = null;\r\n _this._specularTexture = null;\r\n _this._bumpTexture = null;\r\n _this._lightmapTexture = null;\r\n _this._refractionTexture = null;\r\n /**\r\n * The color of the material lit by the environmental background lighting.\r\n * @see https://doc.babylonjs.com/babylon101/materials#ambient-color-example\r\n */\r\n _this.ambientColor = new Color3(0, 0, 0);\r\n /**\r\n * The basic color of the material as viewed under a light.\r\n */\r\n _this.diffuseColor = new Color3(1, 1, 1);\r\n /**\r\n * Define how the color and intensity of the highlight given by the light in the material.\r\n */\r\n _this.specularColor = new Color3(1, 1, 1);\r\n /**\r\n * Define the color of the material as if self lit.\r\n * This will be mixed in the final result even in the absence of light.\r\n */\r\n _this.emissiveColor = new Color3(0, 0, 0);\r\n /**\r\n * Defines how sharp are the highlights in the material.\r\n * The bigger the value the sharper giving a more glossy feeling to the result.\r\n * Reversely, the smaller the value the blurrier giving a more rough feeling to the result.\r\n */\r\n _this.specularPower = 64;\r\n _this._useAlphaFromDiffuseTexture = false;\r\n _this._useEmissiveAsIllumination = false;\r\n _this._linkEmissiveWithDiffuse = false;\r\n _this._useSpecularOverAlpha = false;\r\n _this._useReflectionOverAlpha = false;\r\n _this._disableLighting = false;\r\n _this._useObjectSpaceNormalMap = false;\r\n _this._useParallax = false;\r\n _this._useParallaxOcclusion = false;\r\n /**\r\n * Apply a scaling factor that determine which \"depth\" the height map should reprensent. A value between 0.05 and 0.1 is reasonnable in Parallax, you can reach 0.2 using Parallax Occlusion.\r\n */\r\n _this.parallaxScaleBias = 0.05;\r\n _this._roughness = 0;\r\n /**\r\n * In case of refraction, define the value of the index of refraction.\r\n * @see https://doc.babylonjs.com/how_to/reflect#how-to-obtain-reflections-and-refractions\r\n */\r\n _this.indexOfRefraction = 0.98;\r\n /**\r\n * Invert the refraction texture alongside the y axis.\r\n * It can be useful with procedural textures or probe for instance.\r\n * @see https://doc.babylonjs.com/how_to/reflect#how-to-obtain-reflections-and-refractions\r\n */\r\n _this.invertRefractionY = true;\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n _this.alphaCutOff = 0.4;\r\n _this._useLightmapAsShadowmap = false;\r\n _this._useReflectionFresnelFromSpecular = false;\r\n _this._useGlossinessFromSpecularMapAlpha = false;\r\n _this._maxSimultaneousLights = 4;\r\n _this._invertNormalMapX = false;\r\n _this._invertNormalMapY = false;\r\n _this._twoSidedLighting = false;\r\n /**\r\n * Defines the detail map parameters for the material.\r\n */\r\n _this.detailMap = new DetailMapConfiguration(_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n _this._renderTargets = new SmartArray(16);\r\n _this._worldViewProjectionMatrix = Matrix.Zero();\r\n _this._globalAmbientColor = new Color3(0, 0, 0);\r\n _this._rebuildInParallel = false;\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n _this.prePassConfiguration = new PrePassConfiguration();\r\n _this.getRenderTargetTextures = function () {\r\n _this._renderTargets.reset();\r\n if (StandardMaterial.ReflectionTextureEnabled && _this._reflectionTexture && _this._reflectionTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._reflectionTexture);\r\n }\r\n if (StandardMaterial.RefractionTextureEnabled && _this._refractionTexture && _this._refractionTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._refractionTexture);\r\n }\r\n return _this._renderTargets;\r\n };\r\n return _this;\r\n }\r\n Object.defineProperty(StandardMaterial.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n this._attachImageProcessingConfiguration(value);\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches a new image processing configuration to the Standard Material.\r\n * @param configuration\r\n */\r\n StandardMaterial.prototype._attachImageProcessingConfiguration = function (configuration) {\r\n var _this = this;\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Detaches observer\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n // Pick the scene configuration if needed\r\n if (!configuration) {\r\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n // Attaches observer\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._markAllSubMeshesAsImageProcessingDirty();\r\n });\r\n }\r\n };\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n },\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraToneMappingEnabled\", {\r\n /**\r\n * Gets wether tonemapping is enabled or not.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether tonemapping is enabled or not\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraExposure\", {\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.exposure;\r\n },\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.exposure = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraContrast\", {\r\n /**\r\n * Gets The camera contrast used on this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.contrast;\r\n },\r\n /**\r\n * Sets The camera contrast used on this material.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.contrast = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorGradingTexture\", {\r\n /**\r\n * Gets the Color Grading 2D Lookup Texture.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorGradingTexture;\r\n },\r\n /**\r\n * Sets the Color Grading 2D Lookup Texture.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorGradingTexture = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorCurves\", {\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorCurves;\r\n },\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorCurves = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"canRenderToMRT\", {\r\n /**\r\n * Can this material render to several textures at once\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"hasRenderTargetTextures\", {\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n get: function () {\r\n if (StandardMaterial.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n if (StandardMaterial.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current class name of the material e.g. \"StandardMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n StandardMaterial.prototype.getClassName = function () {\r\n return \"StandardMaterial\";\r\n };\r\n Object.defineProperty(StandardMaterial.prototype, \"useLogarithmicDepth\", {\r\n /**\r\n * In case the depth buffer does not allow enough depth precision for your scene (might be the case in large scenes)\r\n * You can try switching to logarithmic depth.\r\n * @see https://doc.babylonjs.com/how_to/using_logarithmic_depth_buffer\r\n */\r\n get: function () {\r\n return this._useLogarithmicDepth;\r\n },\r\n set: function (value) {\r\n this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;\r\n this._markAllSubMeshesAsMiscDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n StandardMaterial.prototype.needAlphaBlending = function () {\r\n if (this._disableAlphaBlending) {\r\n return false;\r\n }\r\n return (this.alpha < 1.0) || (this._opacityTexture != null) || this._shouldUseAlphaFromDiffuseTexture() || this._opacityFresnelParameters && this._opacityFresnelParameters.isEnabled;\r\n };\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns a boolean specifying if an alpha test is needed.\r\n */\r\n StandardMaterial.prototype.needAlphaTesting = function () {\r\n if (this._forceAlphaTest) {\r\n return true;\r\n }\r\n return this._hasAlphaChannel() && (this._transparencyMode == null || this._transparencyMode === Material.MATERIAL_ALPHATEST);\r\n };\r\n /**\r\n * Specifies whether or not the alpha value of the diffuse texture should be used for alpha blending.\r\n */\r\n StandardMaterial.prototype._shouldUseAlphaFromDiffuseTexture = function () {\r\n return this._diffuseTexture != null && this._diffuseTexture.hasAlpha && this._useAlphaFromDiffuseTexture && this._transparencyMode !== Material.MATERIAL_OPAQUE;\r\n };\r\n /**\r\n * Specifies whether or not there is a usable alpha channel for transparency.\r\n */\r\n StandardMaterial.prototype._hasAlphaChannel = function () {\r\n return (this._diffuseTexture != null && this._diffuseTexture.hasAlpha) || this._opacityTexture != null;\r\n };\r\n /**\r\n * Get the texture used for alpha test purpose.\r\n * @returns the diffuse texture in case of the standard material.\r\n */\r\n StandardMaterial.prototype.getAlphaTestTexture = function () {\r\n return this._diffuseTexture;\r\n };\r\n /**\r\n * Get if the submesh is ready to be used and all its information available.\r\n * Child classes can use it to update shaders\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n StandardMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n if (useInstances === void 0) { useInstances = false; }\r\n if (subMesh.effect && this.isFrozen) {\r\n if (subMesh.effect._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new StandardMaterialDefines();\r\n }\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n var engine = scene.getEngine();\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);\r\n // Multiview\r\n MaterialHelper.PrepareDefinesForMultiview(scene, defines);\r\n // PrePass\r\n MaterialHelper.PrepareDefinesForPrePass(scene, defines, this.canRenderToMRT);\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n defines.MAINUV1 = false;\r\n defines.MAINUV2 = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._diffuseTexture, defines, \"DIFFUSE\");\r\n }\r\n }\r\n else {\r\n defines.DIFFUSE = false;\r\n }\r\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\r\n if (!this._ambientTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._ambientTexture, defines, \"AMBIENT\");\r\n }\r\n }\r\n else {\r\n defines.AMBIENT = false;\r\n }\r\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\r\n if (!this._opacityTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._opacityTexture, defines, \"OPACITY\");\r\n defines.OPACITYRGB = this._opacityTexture.getAlphaFromRGB;\r\n }\r\n }\r\n else {\r\n defines.OPACITY = false;\r\n }\r\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\r\n if (!this._reflectionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n defines._needNormals = true;\r\n defines.REFLECTION = true;\r\n defines.ROUGHNESS = (this._roughness > 0);\r\n defines.REFLECTIONOVERALPHA = this._useReflectionOverAlpha;\r\n defines.INVERTCUBICMAP = (this._reflectionTexture.coordinatesMode === Texture.INVCUBIC_MODE);\r\n defines.REFLECTIONMAP_3D = this._reflectionTexture.isCube;\r\n defines.RGBDREFLECTION = this._reflectionTexture.isRGBD;\r\n switch (this._reflectionTexture.coordinatesMode) {\r\n case Texture.EXPLICIT_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_EXPLICIT\");\r\n break;\r\n case Texture.PLANAR_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_PLANAR\");\r\n break;\r\n case Texture.PROJECTION_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_PROJECTION\");\r\n break;\r\n case Texture.SKYBOX_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_SKYBOX\");\r\n break;\r\n case Texture.SPHERICAL_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_SPHERICAL\");\r\n break;\r\n case Texture.EQUIRECTANGULAR_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_EQUIRECTANGULAR\");\r\n break;\r\n case Texture.FIXED_EQUIRECTANGULAR_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_EQUIRECTANGULAR_FIXED\");\r\n break;\r\n case Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\");\r\n break;\r\n case Texture.CUBIC_MODE:\r\n case Texture.INVCUBIC_MODE:\r\n default:\r\n defines.setReflectionMode(\"REFLECTIONMAP_CUBIC\");\r\n break;\r\n }\r\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = this._reflectionTexture.boundingBoxSize ? true : false;\r\n }\r\n }\r\n else {\r\n defines.REFLECTION = false;\r\n }\r\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\r\n if (!this._emissiveTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._emissiveTexture, defines, \"EMISSIVE\");\r\n }\r\n }\r\n else {\r\n defines.EMISSIVE = false;\r\n }\r\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\r\n if (!this._lightmapTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._lightmapTexture, defines, \"LIGHTMAP\");\r\n defines.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap;\r\n defines.RGBDLIGHTMAP = this._lightmapTexture.isRGBD;\r\n }\r\n }\r\n else {\r\n defines.LIGHTMAP = false;\r\n }\r\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\r\n if (!this._specularTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._specularTexture, defines, \"SPECULAR\");\r\n defines.GLOSSINESS = this._useGlossinessFromSpecularMapAlpha;\r\n }\r\n }\r\n else {\r\n defines.SPECULAR = false;\r\n }\r\n if (scene.getEngine().getCaps().standardDerivatives && this._bumpTexture && StandardMaterial.BumpTextureEnabled) {\r\n // Bump texure can not be not blocking.\r\n if (!this._bumpTexture.isReady()) {\r\n return false;\r\n }\r\n else {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._bumpTexture, defines, \"BUMP\");\r\n defines.PARALLAX = this._useParallax;\r\n defines.PARALLAXOCCLUSION = this._useParallaxOcclusion;\r\n }\r\n defines.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap;\r\n }\r\n else {\r\n defines.BUMP = false;\r\n }\r\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\r\n if (!this._refractionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n defines._needUVs = true;\r\n defines.REFRACTION = true;\r\n defines.REFRACTIONMAP_3D = this._refractionTexture.isCube;\r\n defines.RGBDREFRACTION = this._refractionTexture.isRGBD;\r\n }\r\n }\r\n else {\r\n defines.REFRACTION = false;\r\n }\r\n defines.TWOSIDEDLIGHTING = !this._backFaceCulling && this._twoSidedLighting;\r\n }\r\n else {\r\n defines.DIFFUSE = false;\r\n defines.AMBIENT = false;\r\n defines.OPACITY = false;\r\n defines.REFLECTION = false;\r\n defines.EMISSIVE = false;\r\n defines.LIGHTMAP = false;\r\n defines.BUMP = false;\r\n defines.REFRACTION = false;\r\n }\r\n defines.ALPHAFROMDIFFUSE = this._shouldUseAlphaFromDiffuseTexture();\r\n defines.EMISSIVEASILLUMINATION = this._useEmissiveAsIllumination;\r\n defines.LINKEMISSIVEWITHDIFFUSE = this._linkEmissiveWithDiffuse;\r\n defines.SPECULAROVERALPHA = this._useSpecularOverAlpha;\r\n defines.PREMULTIPLYALPHA = (this.alphaMode === 7 || this.alphaMode === 8);\r\n defines.ALPHATEST_AFTERALLALPHACOMPUTATIONS = this.transparencyMode !== null;\r\n defines.ALPHABLEND = this.transparencyMode === null || this.needAlphaBlendingForMesh(mesh); // check on null for backward compatibility\r\n }\r\n if (!this.detailMap.isReadyForSubMesh(defines, scene)) {\r\n return false;\r\n }\r\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\r\n if (!this._imageProcessingConfiguration.isReady()) {\r\n return false;\r\n }\r\n this._imageProcessingConfiguration.prepareDefines(defines);\r\n defines.IS_REFLECTION_LINEAR = (this.reflectionTexture != null && !this.reflectionTexture.gammaSpace);\r\n defines.IS_REFRACTION_LINEAR = (this.refractionTexture != null && !this.refractionTexture.gammaSpace);\r\n }\r\n if (defines._areFresnelDirty) {\r\n if (StandardMaterial.FresnelEnabled) {\r\n // Fresnel\r\n if (this._diffuseFresnelParameters || this._opacityFresnelParameters ||\r\n this._emissiveFresnelParameters || this._refractionFresnelParameters ||\r\n this._reflectionFresnelParameters) {\r\n defines.DIFFUSEFRESNEL = (this._diffuseFresnelParameters && this._diffuseFresnelParameters.isEnabled);\r\n defines.OPACITYFRESNEL = (this._opacityFresnelParameters && this._opacityFresnelParameters.isEnabled);\r\n defines.REFLECTIONFRESNEL = (this._reflectionFresnelParameters && this._reflectionFresnelParameters.isEnabled);\r\n defines.REFLECTIONFRESNELFROMSPECULAR = this._useReflectionFresnelFromSpecular;\r\n defines.REFRACTIONFRESNEL = (this._refractionFresnelParameters && this._refractionFresnelParameters.isEnabled);\r\n defines.EMISSIVEFRESNEL = (this._emissiveFresnelParameters && this._emissiveFresnelParameters.isEnabled);\r\n defines._needNormals = true;\r\n defines.FRESNEL = true;\r\n }\r\n }\r\n else {\r\n defines.FRESNEL = false;\r\n }\r\n }\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh) || this._forceAlphaTest, defines);\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true);\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances, null, subMesh.getRenderingMesh().hasThinInstances);\r\n // External config\r\n this.detailMap.prepareDefines(defines, scene);\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n var lightDisposed = defines._areLightsDisposed;\r\n defines.markAsProcessed();\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.REFLECTION) {\r\n fallbacks.addFallback(0, \"REFLECTION\");\r\n }\r\n if (defines.SPECULAR) {\r\n fallbacks.addFallback(0, \"SPECULAR\");\r\n }\r\n if (defines.BUMP) {\r\n fallbacks.addFallback(0, \"BUMP\");\r\n }\r\n if (defines.PARALLAX) {\r\n fallbacks.addFallback(1, \"PARALLAX\");\r\n }\r\n if (defines.PARALLAXOCCLUSION) {\r\n fallbacks.addFallback(0, \"PARALLAXOCCLUSION\");\r\n }\r\n if (defines.SPECULAROVERALPHA) {\r\n fallbacks.addFallback(0, \"SPECULAROVERALPHA\");\r\n }\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n if (defines.POINTSIZE) {\r\n fallbacks.addFallback(0, \"POINTSIZE\");\r\n }\r\n if (defines.LOGARITHMICDEPTH) {\r\n fallbacks.addFallback(0, \"LOGARITHMICDEPTH\");\r\n }\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this._maxSimultaneousLights);\r\n if (defines.SPECULARTERM) {\r\n fallbacks.addFallback(0, \"SPECULARTERM\");\r\n }\r\n if (defines.DIFFUSEFRESNEL) {\r\n fallbacks.addFallback(1, \"DIFFUSEFRESNEL\");\r\n }\r\n if (defines.OPACITYFRESNEL) {\r\n fallbacks.addFallback(2, \"OPACITYFRESNEL\");\r\n }\r\n if (defines.REFLECTIONFRESNEL) {\r\n fallbacks.addFallback(3, \"REFLECTIONFRESNEL\");\r\n }\r\n if (defines.EMISSIVEFRESNEL) {\r\n fallbacks.addFallback(4, \"EMISSIVEFRESNEL\");\r\n }\r\n if (defines.FRESNEL) {\r\n fallbacks.addFallback(4, \"FRESNEL\");\r\n }\r\n if (defines.MULTIVIEW) {\r\n fallbacks.addFallback(0, \"MULTIVIEW\");\r\n }\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n MaterialHelper.PrepareAttributesForMorphTargets(attribs, mesh, defines);\r\n var shaderName = \"default\";\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vAmbientColor\", \"vDiffuseColor\", \"vSpecularColor\", \"vEmissiveColor\", \"visibility\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vDiffuseInfos\", \"vAmbientInfos\", \"vOpacityInfos\", \"vReflectionInfos\", \"vEmissiveInfos\", \"vSpecularInfos\", \"vBumpInfos\", \"vLightmapInfos\", \"vRefractionInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"vClipPlane5\", \"vClipPlane6\", \"diffuseMatrix\", \"ambientMatrix\", \"opacityMatrix\", \"reflectionMatrix\", \"emissiveMatrix\", \"specularMatrix\", \"bumpMatrix\", \"normalMatrix\", \"lightmapMatrix\", \"refractionMatrix\",\r\n \"diffuseLeftColor\", \"diffuseRightColor\", \"opacityParts\", \"reflectionLeftColor\", \"reflectionRightColor\", \"emissiveLeftColor\", \"emissiveRightColor\", \"refractionLeftColor\", \"refractionRightColor\",\r\n \"vReflectionPosition\", \"vReflectionSize\",\r\n \"logarithmicDepthConstant\", \"vTangentSpaceParams\", \"alphaCutOff\", \"boneTextureWidth\"\r\n ];\r\n var samplers = [\"diffuseSampler\", \"ambientSampler\", \"opacitySampler\", \"reflectionCubeSampler\",\r\n \"reflection2DSampler\", \"emissiveSampler\", \"specularSampler\", \"bumpSampler\", \"lightmapSampler\",\r\n \"refractionCubeSampler\", \"refraction2DSampler\", \"boneSampler\"];\r\n var uniformBuffers = [\"Material\", \"Scene\"];\r\n DetailMapConfiguration.AddUniforms(uniforms);\r\n DetailMapConfiguration.AddSamplers(samplers);\r\n PrePassConfiguration.AddUniforms(uniforms);\r\n PrePassConfiguration.AddSamplers(uniforms);\r\n if (ImageProcessingConfiguration) {\r\n ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);\r\n ImageProcessingConfiguration.PrepareSamplers(samplers, defines);\r\n }\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this._maxSimultaneousLights\r\n });\r\n var csnrOptions = {};\r\n if (this.customShaderNameResolve) {\r\n shaderName = this.customShaderNameResolve(shaderName, uniforms, uniformBuffers, samplers, defines, attribs, csnrOptions);\r\n }\r\n var join = defines.toString();\r\n var previousEffect = subMesh.effect;\r\n var effect = scene.getEngine().createEffect(shaderName, {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: defines.NUM_MORPH_INFLUENCERS },\r\n processFinalCode: csnrOptions.processFinalCode,\r\n multiTarget: defines.PREPASS\r\n }, engine);\r\n if (effect) {\r\n if (this._onEffectCreatedObservable) {\r\n onCreatedEffectParameters.effect = effect;\r\n onCreatedEffectParameters.subMesh = subMesh;\r\n this._onEffectCreatedObservable.notifyObservers(onCreatedEffectParameters);\r\n }\r\n // Use previous effect while new one is compiling\r\n if (this.allowShaderHotSwapping && previousEffect && !effect.isReady()) {\r\n effect = previousEffect;\r\n this._rebuildInParallel = true;\r\n defines.markAsUnprocessed();\r\n if (lightDisposed) {\r\n // re register in case it takes more than one frame.\r\n defines._areLightsDisposed = true;\r\n return false;\r\n }\r\n }\r\n else {\r\n this._rebuildInParallel = false;\r\n scene.resetCachedMaterial();\r\n subMesh.setEffect(effect, defines);\r\n this.buildUniformLayout();\r\n }\r\n }\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n defines._renderId = scene.getRenderId();\r\n subMesh.effect._wasPreviouslyReady = true;\r\n return true;\r\n };\r\n /**\r\n * Builds the material UBO layouts.\r\n * Used internally during the effect preparation.\r\n */\r\n StandardMaterial.prototype.buildUniformLayout = function () {\r\n // Order is important !\r\n var ubo = this._uniformBuffer;\r\n ubo.addUniform(\"diffuseLeftColor\", 4);\r\n ubo.addUniform(\"diffuseRightColor\", 4);\r\n ubo.addUniform(\"opacityParts\", 4);\r\n ubo.addUniform(\"reflectionLeftColor\", 4);\r\n ubo.addUniform(\"reflectionRightColor\", 4);\r\n ubo.addUniform(\"refractionLeftColor\", 4);\r\n ubo.addUniform(\"refractionRightColor\", 4);\r\n ubo.addUniform(\"emissiveLeftColor\", 4);\r\n ubo.addUniform(\"emissiveRightColor\", 4);\r\n ubo.addUniform(\"vDiffuseInfos\", 2);\r\n ubo.addUniform(\"vAmbientInfos\", 2);\r\n ubo.addUniform(\"vOpacityInfos\", 2);\r\n ubo.addUniform(\"vReflectionInfos\", 2);\r\n ubo.addUniform(\"vReflectionPosition\", 3);\r\n ubo.addUniform(\"vReflectionSize\", 3);\r\n ubo.addUniform(\"vEmissiveInfos\", 2);\r\n ubo.addUniform(\"vLightmapInfos\", 2);\r\n ubo.addUniform(\"vSpecularInfos\", 2);\r\n ubo.addUniform(\"vBumpInfos\", 3);\r\n ubo.addUniform(\"diffuseMatrix\", 16);\r\n ubo.addUniform(\"ambientMatrix\", 16);\r\n ubo.addUniform(\"opacityMatrix\", 16);\r\n ubo.addUniform(\"reflectionMatrix\", 16);\r\n ubo.addUniform(\"emissiveMatrix\", 16);\r\n ubo.addUniform(\"lightmapMatrix\", 16);\r\n ubo.addUniform(\"specularMatrix\", 16);\r\n ubo.addUniform(\"bumpMatrix\", 16);\r\n ubo.addUniform(\"vTangentSpaceParams\", 2);\r\n ubo.addUniform(\"pointSize\", 1);\r\n ubo.addUniform(\"refractionMatrix\", 16);\r\n ubo.addUniform(\"vRefractionInfos\", 4);\r\n ubo.addUniform(\"vSpecularColor\", 4);\r\n ubo.addUniform(\"vEmissiveColor\", 3);\r\n ubo.addUniform(\"visibility\", 1);\r\n ubo.addUniform(\"vDiffuseColor\", 4);\r\n DetailMapConfiguration.PrepareUniformBuffer(ubo);\r\n ubo.create();\r\n };\r\n /**\r\n * Unbinds the material from the mesh\r\n */\r\n StandardMaterial.prototype.unbind = function () {\r\n if (this._activeEffect) {\r\n var needFlag = false;\r\n if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n this._activeEffect.setTexture(\"reflection2DSampler\", null);\r\n needFlag = true;\r\n }\r\n if (this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n this._activeEffect.setTexture(\"refraction2DSampler\", null);\r\n needFlag = true;\r\n }\r\n if (needFlag) {\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\r\n }\r\n _super.prototype.unbind.call(this);\r\n };\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n StandardMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n // Matrices\r\n if (!defines.INSTANCES || defines.THIN_INSTANCES) {\r\n this.bindOnlyWorldMatrix(world);\r\n }\r\n // PrePass\r\n this.prePassConfiguration.bindForSubMesh(this._activeEffect, scene, mesh, world, this.isFrozen);\r\n // Normal Matrix\r\n if (defines.OBJECTSPACE_NORMALMAP) {\r\n world.toNormalMatrix(this._normalMatrix);\r\n this.bindOnlyNormalMatrix(this._normalMatrix);\r\n }\r\n var mustRebind = this._mustRebind(scene, effect, mesh.visibility);\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, effect);\r\n var ubo = this._uniformBuffer;\r\n if (mustRebind) {\r\n ubo.bindToEffect(effect, \"Material\");\r\n this.bindViewProjection(effect);\r\n if (!ubo.useUbo || !this.isFrozen || !ubo.isSync) {\r\n if (StandardMaterial.FresnelEnabled && defines.FRESNEL) {\r\n // Fresnel\r\n if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"diffuseLeftColor\", this.diffuseFresnelParameters.leftColor, this.diffuseFresnelParameters.power);\r\n ubo.updateColor4(\"diffuseRightColor\", this.diffuseFresnelParameters.rightColor, this.diffuseFresnelParameters.bias);\r\n }\r\n if (this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"opacityParts\", new Color3(this.opacityFresnelParameters.leftColor.toLuminance(), this.opacityFresnelParameters.rightColor.toLuminance(), this.opacityFresnelParameters.bias), this.opacityFresnelParameters.power);\r\n }\r\n if (this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"reflectionLeftColor\", this.reflectionFresnelParameters.leftColor, this.reflectionFresnelParameters.power);\r\n ubo.updateColor4(\"reflectionRightColor\", this.reflectionFresnelParameters.rightColor, this.reflectionFresnelParameters.bias);\r\n }\r\n if (this.refractionFresnelParameters && this.refractionFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"refractionLeftColor\", this.refractionFresnelParameters.leftColor, this.refractionFresnelParameters.power);\r\n ubo.updateColor4(\"refractionRightColor\", this.refractionFresnelParameters.rightColor, this.refractionFresnelParameters.bias);\r\n }\r\n if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"emissiveLeftColor\", this.emissiveFresnelParameters.leftColor, this.emissiveFresnelParameters.power);\r\n ubo.updateColor4(\"emissiveRightColor\", this.emissiveFresnelParameters.rightColor, this.emissiveFresnelParameters.bias);\r\n }\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\r\n ubo.updateFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._diffuseTexture, ubo, \"diffuse\");\r\n }\r\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\r\n ubo.updateFloat2(\"vAmbientInfos\", this._ambientTexture.coordinatesIndex, this._ambientTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._ambientTexture, ubo, \"ambient\");\r\n }\r\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\r\n ubo.updateFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._opacityTexture, ubo, \"opacity\");\r\n }\r\n if (this._hasAlphaChannel()) {\r\n effect.setFloat(\"alphaCutOff\", this.alphaCutOff);\r\n }\r\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\r\n ubo.updateFloat2(\"vReflectionInfos\", this._reflectionTexture.level, this.roughness);\r\n ubo.updateMatrix(\"reflectionMatrix\", this._reflectionTexture.getReflectionTextureMatrix());\r\n if (this._reflectionTexture.boundingBoxSize) {\r\n var cubeTexture = this._reflectionTexture;\r\n ubo.updateVector3(\"vReflectionPosition\", cubeTexture.boundingBoxPosition);\r\n ubo.updateVector3(\"vReflectionSize\", cubeTexture.boundingBoxSize);\r\n }\r\n }\r\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\r\n ubo.updateFloat2(\"vEmissiveInfos\", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._emissiveTexture, ubo, \"emissive\");\r\n }\r\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\r\n ubo.updateFloat2(\"vLightmapInfos\", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._lightmapTexture, ubo, \"lightmap\");\r\n }\r\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\r\n ubo.updateFloat2(\"vSpecularInfos\", this._specularTexture.coordinatesIndex, this._specularTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._specularTexture, ubo, \"specular\");\r\n }\r\n if (this._bumpTexture && scene.getEngine().getCaps().standardDerivatives && StandardMaterial.BumpTextureEnabled) {\r\n ubo.updateFloat3(\"vBumpInfos\", this._bumpTexture.coordinatesIndex, 1.0 / this._bumpTexture.level, this.parallaxScaleBias);\r\n MaterialHelper.BindTextureMatrix(this._bumpTexture, ubo, \"bump\");\r\n if (scene._mirroredCameraPosition) {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? 1.0 : -1.0, this._invertNormalMapY ? 1.0 : -1.0);\r\n }\r\n else {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? -1.0 : 1.0, this._invertNormalMapY ? -1.0 : 1.0);\r\n }\r\n }\r\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\r\n var depth = 1.0;\r\n if (!this._refractionTexture.isCube) {\r\n ubo.updateMatrix(\"refractionMatrix\", this._refractionTexture.getReflectionTextureMatrix());\r\n if (this._refractionTexture.depth) {\r\n depth = this._refractionTexture.depth;\r\n }\r\n }\r\n ubo.updateFloat4(\"vRefractionInfos\", this._refractionTexture.level, this.indexOfRefraction, depth, this.invertRefractionY ? -1 : 1);\r\n }\r\n }\r\n // Point size\r\n if (this.pointsCloud) {\r\n ubo.updateFloat(\"pointSize\", this.pointSize);\r\n }\r\n if (defines.SPECULARTERM) {\r\n ubo.updateColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\r\n }\r\n ubo.updateColor3(\"vEmissiveColor\", StandardMaterial.EmissiveTextureEnabled ? this.emissiveColor : Color3.BlackReadOnly);\r\n // Diffuse\r\n ubo.updateColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha);\r\n }\r\n // Visibility\r\n ubo.updateFloat(\"visibility\", mesh.visibility);\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\r\n effect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n }\r\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\r\n effect.setTexture(\"ambientSampler\", this._ambientTexture);\r\n }\r\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\r\n effect.setTexture(\"opacitySampler\", this._opacityTexture);\r\n }\r\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\r\n if (this._reflectionTexture.isCube) {\r\n effect.setTexture(\"reflectionCubeSampler\", this._reflectionTexture);\r\n }\r\n else {\r\n effect.setTexture(\"reflection2DSampler\", this._reflectionTexture);\r\n }\r\n }\r\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\r\n effect.setTexture(\"emissiveSampler\", this._emissiveTexture);\r\n }\r\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\r\n effect.setTexture(\"lightmapSampler\", this._lightmapTexture);\r\n }\r\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\r\n effect.setTexture(\"specularSampler\", this._specularTexture);\r\n }\r\n if (this._bumpTexture && scene.getEngine().getCaps().standardDerivatives && StandardMaterial.BumpTextureEnabled) {\r\n effect.setTexture(\"bumpSampler\", this._bumpTexture);\r\n }\r\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\r\n var depth = 1.0;\r\n if (this._refractionTexture.isCube) {\r\n effect.setTexture(\"refractionCubeSampler\", this._refractionTexture);\r\n }\r\n else {\r\n effect.setTexture(\"refraction2DSampler\", this._refractionTexture);\r\n }\r\n }\r\n }\r\n this.detailMap.bindForSubMesh(ubo, scene, this.isFrozen);\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(effect, scene);\r\n // Colors\r\n scene.ambientColor.multiplyToRef(this.ambientColor, this._globalAmbientColor);\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n effect.setColor3(\"vAmbientColor\", this._globalAmbientColor);\r\n }\r\n if (mustRebind || !this.isFrozen) {\r\n // Lights\r\n if (scene.lightsEnabled && !this._disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, effect, defines, this._maxSimultaneousLights, this._rebuildInParallel);\r\n }\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE || this._reflectionTexture || this._refractionTexture) {\r\n this.bindView(effect);\r\n }\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, effect);\r\n // Morph targets\r\n if (defines.NUM_MORPH_INFLUENCERS) {\r\n MaterialHelper.BindMorphTargetParameters(mesh, effect);\r\n }\r\n // Log. depth\r\n if (this.useLogarithmicDepth) {\r\n MaterialHelper.BindLogDepth(defines, effect, scene);\r\n }\r\n // image processing\r\n if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {\r\n this._imageProcessingConfiguration.bind(this._activeEffect);\r\n }\r\n }\r\n ubo.update();\r\n this._afterBind(mesh, this._activeEffect);\r\n };\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n StandardMaterial.prototype.getAnimatables = function () {\r\n var results = [];\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n if (this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0) {\r\n results.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0) {\r\n results.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0) {\r\n results.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0) {\r\n results.push(this._emissiveTexture);\r\n }\r\n if (this._specularTexture && this._specularTexture.animations && this._specularTexture.animations.length > 0) {\r\n results.push(this._specularTexture);\r\n }\r\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\r\n results.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0) {\r\n results.push(this._lightmapTexture);\r\n }\r\n if (this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0) {\r\n results.push(this._refractionTexture);\r\n }\r\n this.detailMap.getAnimatables(results);\r\n return results;\r\n };\r\n /**\r\n * Gets the active textures from the material\r\n * @returns an array of textures\r\n */\r\n StandardMaterial.prototype.getActiveTextures = function () {\r\n var activeTextures = _super.prototype.getActiveTextures.call(this);\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n if (this._ambientTexture) {\r\n activeTextures.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture) {\r\n activeTextures.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture) {\r\n activeTextures.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture) {\r\n activeTextures.push(this._emissiveTexture);\r\n }\r\n if (this._specularTexture) {\r\n activeTextures.push(this._specularTexture);\r\n }\r\n if (this._bumpTexture) {\r\n activeTextures.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture) {\r\n activeTextures.push(this._lightmapTexture);\r\n }\r\n if (this._refractionTexture) {\r\n activeTextures.push(this._refractionTexture);\r\n }\r\n this.detailMap.getActiveTextures(activeTextures);\r\n return activeTextures;\r\n };\r\n /**\r\n * Specifies if the material uses a texture\r\n * @param texture defines the texture to check against the material\r\n * @returns a boolean specifying if the material uses the texture\r\n */\r\n StandardMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n if (this._diffuseTexture === texture) {\r\n return true;\r\n }\r\n if (this._ambientTexture === texture) {\r\n return true;\r\n }\r\n if (this._opacityTexture === texture) {\r\n return true;\r\n }\r\n if (this._reflectionTexture === texture) {\r\n return true;\r\n }\r\n if (this._emissiveTexture === texture) {\r\n return true;\r\n }\r\n if (this._specularTexture === texture) {\r\n return true;\r\n }\r\n if (this._bumpTexture === texture) {\r\n return true;\r\n }\r\n if (this._lightmapTexture === texture) {\r\n return true;\r\n }\r\n if (this._refractionTexture === texture) {\r\n return true;\r\n }\r\n return this.detailMap.hasTexture(texture);\r\n };\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\r\n */\r\n StandardMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n if (forceDisposeTextures) {\r\n (_a = this._diffuseTexture) === null || _a === void 0 ? void 0 : _a.dispose();\r\n (_b = this._ambientTexture) === null || _b === void 0 ? void 0 : _b.dispose();\r\n (_c = this._opacityTexture) === null || _c === void 0 ? void 0 : _c.dispose();\r\n (_d = this._reflectionTexture) === null || _d === void 0 ? void 0 : _d.dispose();\r\n (_e = this._emissiveTexture) === null || _e === void 0 ? void 0 : _e.dispose();\r\n (_f = this._specularTexture) === null || _f === void 0 ? void 0 : _f.dispose();\r\n (_g = this._bumpTexture) === null || _g === void 0 ? void 0 : _g.dispose();\r\n (_h = this._lightmapTexture) === null || _h === void 0 ? void 0 : _h.dispose();\r\n (_j = this._refractionTexture) === null || _j === void 0 ? void 0 : _j.dispose();\r\n }\r\n this.detailMap.dispose(forceDisposeTextures);\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);\r\n };\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n StandardMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n var result = SerializationHelper.Clone(function () { return new StandardMaterial(name, _this.getScene()); }, this);\r\n result.name = name;\r\n result.id = name;\r\n return result;\r\n };\r\n /**\r\n * Serializes this material in a JSON representation\r\n * @returns the serialized material object\r\n */\r\n StandardMaterial.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Creates a standard material from parsed material data\r\n * @param source defines the JSON representation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new standard material\r\n */\r\n StandardMaterial.Parse = function (source, scene, rootUrl) {\r\n return SerializationHelper.Parse(function () { return new StandardMaterial(source.name, scene); }, source, scene, rootUrl);\r\n };\r\n Object.defineProperty(StandardMaterial, \"DiffuseTextureEnabled\", {\r\n // Flags used to enable or disable a type of texture for all Standard Materials\r\n /**\r\n * Are diffuse textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.DiffuseTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.DiffuseTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"DetailTextureEnabled\", {\r\n /**\r\n * Are detail textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.DetailTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.DetailTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"AmbientTextureEnabled\", {\r\n /**\r\n * Are ambient textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.AmbientTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.AmbientTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"OpacityTextureEnabled\", {\r\n /**\r\n * Are opacity textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.OpacityTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.OpacityTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"ReflectionTextureEnabled\", {\r\n /**\r\n * Are reflection textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.ReflectionTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.ReflectionTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"EmissiveTextureEnabled\", {\r\n /**\r\n * Are emissive textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.EmissiveTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.EmissiveTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"SpecularTextureEnabled\", {\r\n /**\r\n * Are specular textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.SpecularTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.SpecularTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"BumpTextureEnabled\", {\r\n /**\r\n * Are bump textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.BumpTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.BumpTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"LightmapTextureEnabled\", {\r\n /**\r\n * Are lightmap textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.LightmapTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.LightmapTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"RefractionTextureEnabled\", {\r\n /**\r\n * Are refraction textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.RefractionTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.RefractionTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"ColorGradingTextureEnabled\", {\r\n /**\r\n * Are color grading textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.ColorGradingTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.ColorGradingTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"FresnelEnabled\", {\r\n /**\r\n * Are fresnels enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.FresnelEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.FresnelEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n __decorate([\r\n serializeAsTexture(\"diffuseTexture\")\r\n ], StandardMaterial.prototype, \"_diffuseTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], StandardMaterial.prototype, \"diffuseTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"ambientTexture\")\r\n ], StandardMaterial.prototype, \"_ambientTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"ambientTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"opacityTexture\")\r\n ], StandardMaterial.prototype, \"_opacityTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], StandardMaterial.prototype, \"opacityTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"reflectionTexture\")\r\n ], StandardMaterial.prototype, \"_reflectionTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"reflectionTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"emissiveTexture\")\r\n ], StandardMaterial.prototype, \"_emissiveTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"emissiveTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"specularTexture\")\r\n ], StandardMaterial.prototype, \"_specularTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"specularTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"bumpTexture\")\r\n ], StandardMaterial.prototype, \"_bumpTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"bumpTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"lightmapTexture\")\r\n ], StandardMaterial.prototype, \"_lightmapTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"lightmapTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"refractionTexture\")\r\n ], StandardMaterial.prototype, \"_refractionTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"refractionTexture\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"ambient\")\r\n ], StandardMaterial.prototype, \"ambientColor\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"diffuse\")\r\n ], StandardMaterial.prototype, \"diffuseColor\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"specular\")\r\n ], StandardMaterial.prototype, \"specularColor\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"emissive\")\r\n ], StandardMaterial.prototype, \"emissiveColor\", void 0);\r\n __decorate([\r\n serialize()\r\n ], StandardMaterial.prototype, \"specularPower\", void 0);\r\n __decorate([\r\n serialize(\"useAlphaFromDiffuseTexture\")\r\n ], StandardMaterial.prototype, \"_useAlphaFromDiffuseTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], StandardMaterial.prototype, \"useAlphaFromDiffuseTexture\", void 0);\r\n __decorate([\r\n serialize(\"useEmissiveAsIllumination\")\r\n ], StandardMaterial.prototype, \"_useEmissiveAsIllumination\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useEmissiveAsIllumination\", void 0);\r\n __decorate([\r\n serialize(\"linkEmissiveWithDiffuse\")\r\n ], StandardMaterial.prototype, \"_linkEmissiveWithDiffuse\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"linkEmissiveWithDiffuse\", void 0);\r\n __decorate([\r\n serialize(\"useSpecularOverAlpha\")\r\n ], StandardMaterial.prototype, \"_useSpecularOverAlpha\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useSpecularOverAlpha\", void 0);\r\n __decorate([\r\n serialize(\"useReflectionOverAlpha\")\r\n ], StandardMaterial.prototype, \"_useReflectionOverAlpha\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useReflectionOverAlpha\", void 0);\r\n __decorate([\r\n serialize(\"disableLighting\")\r\n ], StandardMaterial.prototype, \"_disableLighting\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n ], StandardMaterial.prototype, \"disableLighting\", void 0);\r\n __decorate([\r\n serialize(\"useObjectSpaceNormalMap\")\r\n ], StandardMaterial.prototype, \"_useObjectSpaceNormalMap\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useObjectSpaceNormalMap\", void 0);\r\n __decorate([\r\n serialize(\"useParallax\")\r\n ], StandardMaterial.prototype, \"_useParallax\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useParallax\", void 0);\r\n __decorate([\r\n serialize(\"useParallaxOcclusion\")\r\n ], StandardMaterial.prototype, \"_useParallaxOcclusion\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useParallaxOcclusion\", void 0);\r\n __decorate([\r\n serialize()\r\n ], StandardMaterial.prototype, \"parallaxScaleBias\", void 0);\r\n __decorate([\r\n serialize(\"roughness\")\r\n ], StandardMaterial.prototype, \"_roughness\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"roughness\", void 0);\r\n __decorate([\r\n serialize()\r\n ], StandardMaterial.prototype, \"indexOfRefraction\", void 0);\r\n __decorate([\r\n serialize()\r\n ], StandardMaterial.prototype, \"invertRefractionY\", void 0);\r\n __decorate([\r\n serialize()\r\n ], StandardMaterial.prototype, \"alphaCutOff\", void 0);\r\n __decorate([\r\n serialize(\"useLightmapAsShadowmap\")\r\n ], StandardMaterial.prototype, \"_useLightmapAsShadowmap\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useLightmapAsShadowmap\", void 0);\r\n __decorate([\r\n serializeAsFresnelParameters(\"diffuseFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_diffuseFresnelParameters\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"diffuseFresnelParameters\", void 0);\r\n __decorate([\r\n serializeAsFresnelParameters(\"opacityFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_opacityFresnelParameters\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsFresnelAndMiscDirty\")\r\n ], StandardMaterial.prototype, \"opacityFresnelParameters\", void 0);\r\n __decorate([\r\n serializeAsFresnelParameters(\"reflectionFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_reflectionFresnelParameters\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"reflectionFresnelParameters\", void 0);\r\n __decorate([\r\n serializeAsFresnelParameters(\"refractionFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_refractionFresnelParameters\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"refractionFresnelParameters\", void 0);\r\n __decorate([\r\n serializeAsFresnelParameters(\"emissiveFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_emissiveFresnelParameters\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"emissiveFresnelParameters\", void 0);\r\n __decorate([\r\n serialize(\"useReflectionFresnelFromSpecular\")\r\n ], StandardMaterial.prototype, \"_useReflectionFresnelFromSpecular\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"useReflectionFresnelFromSpecular\", void 0);\r\n __decorate([\r\n serialize(\"useGlossinessFromSpecularMapAlpha\")\r\n ], StandardMaterial.prototype, \"_useGlossinessFromSpecularMapAlpha\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useGlossinessFromSpecularMapAlpha\", void 0);\r\n __decorate([\r\n serialize(\"maxSimultaneousLights\")\r\n ], StandardMaterial.prototype, \"_maxSimultaneousLights\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n ], StandardMaterial.prototype, \"maxSimultaneousLights\", void 0);\r\n __decorate([\r\n serialize(\"invertNormalMapX\")\r\n ], StandardMaterial.prototype, \"_invertNormalMapX\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"invertNormalMapX\", void 0);\r\n __decorate([\r\n serialize(\"invertNormalMapY\")\r\n ], StandardMaterial.prototype, \"_invertNormalMapY\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"invertNormalMapY\", void 0);\r\n __decorate([\r\n serialize(\"twoSidedLighting\")\r\n ], StandardMaterial.prototype, \"_twoSidedLighting\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"twoSidedLighting\", void 0);\r\n __decorate([\r\n serialize()\r\n ], StandardMaterial.prototype, \"useLogarithmicDepth\", null);\r\n return StandardMaterial;\r\n}(PushMaterial));\r\nexport { StandardMaterial };\r\n_TypeStore.RegisteredTypes[\"BABYLON.StandardMaterial\"] = StandardMaterial;\r\nScene.DefaultMaterialFactory = function (scene) {\r\n return new StandardMaterial(\"default material\", scene);\r\n};\r\n//# sourceMappingURL=standardMaterial.js.map","import { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport { WebGLDataBuffer } from '../../Meshes/WebGL/webGLDataBuffer';\r\nThinEngine.prototype.createUniformBuffer = function (elements) {\r\n var ubo = this._gl.createBuffer();\r\n if (!ubo) {\r\n throw new Error(\"Unable to create uniform buffer\");\r\n }\r\n var result = new WebGLDataBuffer(ubo);\r\n this.bindUniformBuffer(result);\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.STATIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.STATIC_DRAW);\r\n }\r\n this.bindUniformBuffer(null);\r\n result.references = 1;\r\n return result;\r\n};\r\nThinEngine.prototype.createDynamicUniformBuffer = function (elements) {\r\n var ubo = this._gl.createBuffer();\r\n if (!ubo) {\r\n throw new Error(\"Unable to create dynamic uniform buffer\");\r\n }\r\n var result = new WebGLDataBuffer(ubo);\r\n this.bindUniformBuffer(result);\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.DYNAMIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.DYNAMIC_DRAW);\r\n }\r\n this.bindUniformBuffer(null);\r\n result.references = 1;\r\n return result;\r\n};\r\nThinEngine.prototype.updateUniformBuffer = function (uniformBuffer, elements, offset, count) {\r\n this.bindUniformBuffer(uniformBuffer);\r\n if (offset === undefined) {\r\n offset = 0;\r\n }\r\n if (count === undefined) {\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, elements);\r\n }\r\n else {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, new Float32Array(elements));\r\n }\r\n }\r\n else {\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, elements.subarray(offset, offset + count));\r\n }\r\n else {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, new Float32Array(elements).subarray(offset, offset + count));\r\n }\r\n }\r\n this.bindUniformBuffer(null);\r\n};\r\nThinEngine.prototype.bindUniformBuffer = function (buffer) {\r\n this._gl.bindBuffer(this._gl.UNIFORM_BUFFER, buffer ? buffer.underlyingResource : null);\r\n};\r\nThinEngine.prototype.bindUniformBufferBase = function (buffer, location) {\r\n this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER, location, buffer ? buffer.underlyingResource : null);\r\n};\r\nThinEngine.prototype.bindUniformBlock = function (pipelineContext, blockName, index) {\r\n var program = pipelineContext.program;\r\n var uniformLocation = this._gl.getUniformBlockIndex(program, blockName);\r\n this._gl.uniformBlockBinding(program, uniformLocation, index);\r\n};\r\n//# sourceMappingURL=engine.uniformBuffer.js.map","import { Logger } from \"../Misc/logger\";\r\nimport \"../Engines/Extensions/engine.uniformBuffer\";\r\n/**\r\n * Uniform buffer objects.\r\n *\r\n * Handles blocks of uniform on the GPU.\r\n *\r\n * If WebGL 2 is not available, this class falls back on traditionnal setUniformXXX calls.\r\n *\r\n * For more information, please refer to :\r\n * https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object\r\n */\r\nvar UniformBuffer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new Uniform buffer objects.\r\n *\r\n * Handles blocks of uniform on the GPU.\r\n *\r\n * If WebGL 2 is not available, this class falls back on traditionnal setUniformXXX calls.\r\n *\r\n * For more information, please refer to :\r\n * @see https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object\r\n * @param engine Define the engine the buffer is associated with\r\n * @param data Define the data contained in the buffer\r\n * @param dynamic Define if the buffer is updatable\r\n */\r\n function UniformBuffer(engine, data, dynamic) {\r\n /** @hidden */\r\n this._alreadyBound = false;\r\n // Matrix cache\r\n this._valueCache = {};\r\n this._engine = engine;\r\n this._noUBO = !engine.supportsUniformBuffers;\r\n this._dynamic = dynamic;\r\n this._data = data || [];\r\n this._uniformLocations = {};\r\n this._uniformSizes = {};\r\n this._uniformLocationPointer = 0;\r\n this._needSync = false;\r\n if (this._noUBO) {\r\n this.updateMatrix3x3 = this._updateMatrix3x3ForEffect;\r\n this.updateMatrix2x2 = this._updateMatrix2x2ForEffect;\r\n this.updateFloat = this._updateFloatForEffect;\r\n this.updateFloat2 = this._updateFloat2ForEffect;\r\n this.updateFloat3 = this._updateFloat3ForEffect;\r\n this.updateFloat4 = this._updateFloat4ForEffect;\r\n this.updateMatrix = this._updateMatrixForEffect;\r\n this.updateVector3 = this._updateVector3ForEffect;\r\n this.updateVector4 = this._updateVector4ForEffect;\r\n this.updateColor3 = this._updateColor3ForEffect;\r\n this.updateColor4 = this._updateColor4ForEffect;\r\n }\r\n else {\r\n this._engine._uniformBuffers.push(this);\r\n this.updateMatrix3x3 = this._updateMatrix3x3ForUniform;\r\n this.updateMatrix2x2 = this._updateMatrix2x2ForUniform;\r\n this.updateFloat = this._updateFloatForUniform;\r\n this.updateFloat2 = this._updateFloat2ForUniform;\r\n this.updateFloat3 = this._updateFloat3ForUniform;\r\n this.updateFloat4 = this._updateFloat4ForUniform;\r\n this.updateMatrix = this._updateMatrixForUniform;\r\n this.updateVector3 = this._updateVector3ForUniform;\r\n this.updateVector4 = this._updateVector4ForUniform;\r\n this.updateColor3 = this._updateColor3ForUniform;\r\n this.updateColor4 = this._updateColor4ForUniform;\r\n }\r\n }\r\n Object.defineProperty(UniformBuffer.prototype, \"useUbo\", {\r\n /**\r\n * Indicates if the buffer is using the WebGL2 UBO implementation,\r\n * or just falling back on setUniformXXX calls.\r\n */\r\n get: function () {\r\n return !this._noUBO;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(UniformBuffer.prototype, \"isSync\", {\r\n /**\r\n * Indicates if the WebGL underlying uniform buffer is in sync\r\n * with the javascript cache data.\r\n */\r\n get: function () {\r\n return !this._needSync;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Indicates if the WebGL underlying uniform buffer is dynamic.\r\n * Also, a dynamic UniformBuffer will disable cache verification and always\r\n * update the underlying WebGL uniform buffer to the GPU.\r\n * @returns if Dynamic, otherwise false\r\n */\r\n UniformBuffer.prototype.isDynamic = function () {\r\n return this._dynamic !== undefined;\r\n };\r\n /**\r\n * The data cache on JS side.\r\n * @returns the underlying data as a float array\r\n */\r\n UniformBuffer.prototype.getData = function () {\r\n return this._bufferData;\r\n };\r\n /**\r\n * The underlying WebGL Uniform buffer.\r\n * @returns the webgl buffer\r\n */\r\n UniformBuffer.prototype.getBuffer = function () {\r\n return this._buffer;\r\n };\r\n /**\r\n * std140 layout specifies how to align data within an UBO structure.\r\n * See https://khronos.org/registry/OpenGL/specs/gl/glspec45.core.pdf#page=159\r\n * for specs.\r\n */\r\n UniformBuffer.prototype._fillAlignment = function (size) {\r\n // This code has been simplified because we only use floats, vectors of 1, 2, 3, 4 components\r\n // and 4x4 matrices\r\n // TODO : change if other types are used\r\n var alignment;\r\n if (size <= 2) {\r\n alignment = size;\r\n }\r\n else {\r\n alignment = 4;\r\n }\r\n if ((this._uniformLocationPointer % alignment) !== 0) {\r\n var oldPointer = this._uniformLocationPointer;\r\n this._uniformLocationPointer += alignment - (this._uniformLocationPointer % alignment);\r\n var diff = this._uniformLocationPointer - oldPointer;\r\n for (var i = 0; i < diff; i++) {\r\n this._data.push(0);\r\n }\r\n }\r\n };\r\n /**\r\n * Adds an uniform in the buffer.\r\n * Warning : the subsequents calls of this function must be in the same order as declared in the shader\r\n * for the layout to be correct !\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param size Data size, or data directly.\r\n */\r\n UniformBuffer.prototype.addUniform = function (name, size) {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n if (this._uniformLocations[name] !== undefined) {\r\n // Already existing uniform\r\n return;\r\n }\r\n // This function must be called in the order of the shader layout !\r\n // size can be the size of the uniform, or data directly\r\n var data;\r\n if (size instanceof Array) {\r\n data = size;\r\n size = data.length;\r\n }\r\n else {\r\n size = size;\r\n data = [];\r\n // Fill with zeros\r\n for (var i = 0; i < size; i++) {\r\n data.push(0);\r\n }\r\n }\r\n this._fillAlignment(size);\r\n this._uniformSizes[name] = size;\r\n this._uniformLocations[name] = this._uniformLocationPointer;\r\n this._uniformLocationPointer += size;\r\n for (var i = 0; i < size; i++) {\r\n this._data.push(data[i]);\r\n }\r\n this._needSync = true;\r\n };\r\n /**\r\n * Adds a Matrix 4x4 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param mat A 4x4 matrix.\r\n */\r\n UniformBuffer.prototype.addMatrix = function (name, mat) {\r\n this.addUniform(name, Array.prototype.slice.call(mat.toArray()));\r\n };\r\n /**\r\n * Adds a vec2 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param x Define the x component value of the vec2\r\n * @param y Define the y component value of the vec2\r\n */\r\n UniformBuffer.prototype.addFloat2 = function (name, x, y) {\r\n var temp = [x, y];\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param x Define the x component value of the vec3\r\n * @param y Define the y component value of the vec3\r\n * @param z Define the z component value of the vec3\r\n */\r\n UniformBuffer.prototype.addFloat3 = function (name, x, y, z) {\r\n var temp = [x, y, z];\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param color Define the vec3 from a Color\r\n */\r\n UniformBuffer.prototype.addColor3 = function (name, color) {\r\n var temp = new Array();\r\n color.toArray(temp);\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec4 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param color Define the rgb components from a Color\r\n * @param alpha Define the a component of the vec4\r\n */\r\n UniformBuffer.prototype.addColor4 = function (name, color, alpha) {\r\n var temp = new Array();\r\n color.toArray(temp);\r\n temp.push(alpha);\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param vector Define the vec3 components from a Vector\r\n */\r\n UniformBuffer.prototype.addVector3 = function (name, vector) {\r\n var temp = new Array();\r\n vector.toArray(temp);\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a Matrix 3x3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n */\r\n UniformBuffer.prototype.addMatrix3x3 = function (name) {\r\n this.addUniform(name, 12);\r\n };\r\n /**\r\n * Adds a Matrix 2x2 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n */\r\n UniformBuffer.prototype.addMatrix2x2 = function (name) {\r\n this.addUniform(name, 8);\r\n };\r\n /**\r\n * Effectively creates the WebGL Uniform Buffer, once layout is completed with `addUniform`.\r\n */\r\n UniformBuffer.prototype.create = function () {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n if (this._buffer) {\r\n return; // nothing to do\r\n }\r\n // See spec, alignment must be filled as a vec4\r\n this._fillAlignment(4);\r\n this._bufferData = new Float32Array(this._data);\r\n this._rebuild();\r\n this._needSync = true;\r\n };\r\n /** @hidden */\r\n UniformBuffer.prototype._rebuild = function () {\r\n if (this._noUBO || !this._bufferData) {\r\n return;\r\n }\r\n if (this._dynamic) {\r\n this._buffer = this._engine.createDynamicUniformBuffer(this._bufferData);\r\n }\r\n else {\r\n this._buffer = this._engine.createUniformBuffer(this._bufferData);\r\n }\r\n };\r\n /**\r\n * Updates the WebGL Uniform Buffer on the GPU.\r\n * If the `dynamic` flag is set to true, no cache comparison is done.\r\n * Otherwise, the buffer will be updated only if the cache differs.\r\n */\r\n UniformBuffer.prototype.update = function () {\r\n if (!this._buffer) {\r\n this.create();\r\n return;\r\n }\r\n if (!this._dynamic && !this._needSync) {\r\n return;\r\n }\r\n this._engine.updateUniformBuffer(this._buffer, this._bufferData);\r\n this._needSync = false;\r\n };\r\n /**\r\n * Updates the value of an uniform. The `update` method must be called afterwards to make it effective in the GPU.\r\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\r\n * @param data Define the flattened data\r\n * @param size Define the size of the data.\r\n */\r\n UniformBuffer.prototype.updateUniform = function (uniformName, data, size) {\r\n var location = this._uniformLocations[uniformName];\r\n if (location === undefined) {\r\n if (this._buffer) {\r\n // Cannot add an uniform if the buffer is already created\r\n Logger.Error(\"Cannot add an uniform after UBO has been created.\");\r\n return;\r\n }\r\n this.addUniform(uniformName, size);\r\n location = this._uniformLocations[uniformName];\r\n }\r\n if (!this._buffer) {\r\n this.create();\r\n }\r\n if (!this._dynamic) {\r\n // Cache for static uniform buffers\r\n var changed = false;\r\n for (var i = 0; i < size; i++) {\r\n // We are checking the matrix cache before calling updateUniform so we do not need to check it here\r\n // Hence the test for size === 16 to simply commit the matrix values\r\n if (size === 16 || this._bufferData[location + i] !== data[i]) {\r\n changed = true;\r\n this._bufferData[location + i] = data[i];\r\n }\r\n }\r\n this._needSync = this._needSync || changed;\r\n }\r\n else {\r\n // No cache for dynamic\r\n for (var i = 0; i < size; i++) {\r\n this._bufferData[location + i] = data[i];\r\n }\r\n }\r\n };\r\n UniformBuffer.prototype._cacheMatrix = function (name, matrix) {\r\n var cache = this._valueCache[name];\r\n var flag = matrix.updateFlag;\r\n if (cache !== undefined && cache === flag) {\r\n return false;\r\n }\r\n this._valueCache[name] = flag;\r\n return true;\r\n };\r\n // Update methods\r\n UniformBuffer.prototype._updateMatrix3x3ForUniform = function (name, matrix) {\r\n // To match std140, matrix must be realigned\r\n for (var i = 0; i < 3; i++) {\r\n UniformBuffer._tempBuffer[i * 4] = matrix[i * 3];\r\n UniformBuffer._tempBuffer[i * 4 + 1] = matrix[i * 3 + 1];\r\n UniformBuffer._tempBuffer[i * 4 + 2] = matrix[i * 3 + 2];\r\n UniformBuffer._tempBuffer[i * 4 + 3] = 0.0;\r\n }\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 12);\r\n };\r\n UniformBuffer.prototype._updateMatrix3x3ForEffect = function (name, matrix) {\r\n this._currentEffect.setMatrix3x3(name, matrix);\r\n };\r\n UniformBuffer.prototype._updateMatrix2x2ForEffect = function (name, matrix) {\r\n this._currentEffect.setMatrix2x2(name, matrix);\r\n };\r\n UniformBuffer.prototype._updateMatrix2x2ForUniform = function (name, matrix) {\r\n // To match std140, matrix must be realigned\r\n for (var i = 0; i < 2; i++) {\r\n UniformBuffer._tempBuffer[i * 4] = matrix[i * 2];\r\n UniformBuffer._tempBuffer[i * 4 + 1] = matrix[i * 2 + 1];\r\n UniformBuffer._tempBuffer[i * 4 + 2] = 0.0;\r\n UniformBuffer._tempBuffer[i * 4 + 3] = 0.0;\r\n }\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 8);\r\n };\r\n UniformBuffer.prototype._updateFloatForEffect = function (name, x) {\r\n this._currentEffect.setFloat(name, x);\r\n };\r\n UniformBuffer.prototype._updateFloatForUniform = function (name, x) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 1);\r\n };\r\n UniformBuffer.prototype._updateFloat2ForEffect = function (name, x, y, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setFloat2(name + suffix, x, y);\r\n };\r\n UniformBuffer.prototype._updateFloat2ForUniform = function (name, x, y) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n UniformBuffer._tempBuffer[1] = y;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 2);\r\n };\r\n UniformBuffer.prototype._updateFloat3ForEffect = function (name, x, y, z, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setFloat3(name + suffix, x, y, z);\r\n };\r\n UniformBuffer.prototype._updateFloat3ForUniform = function (name, x, y, z) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n UniformBuffer._tempBuffer[1] = y;\r\n UniformBuffer._tempBuffer[2] = z;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 3);\r\n };\r\n UniformBuffer.prototype._updateFloat4ForEffect = function (name, x, y, z, w, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setFloat4(name + suffix, x, y, z, w);\r\n };\r\n UniformBuffer.prototype._updateFloat4ForUniform = function (name, x, y, z, w) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n UniformBuffer._tempBuffer[1] = y;\r\n UniformBuffer._tempBuffer[2] = z;\r\n UniformBuffer._tempBuffer[3] = w;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 4);\r\n };\r\n UniformBuffer.prototype._updateMatrixForEffect = function (name, mat) {\r\n this._currentEffect.setMatrix(name, mat);\r\n };\r\n UniformBuffer.prototype._updateMatrixForUniform = function (name, mat) {\r\n if (this._cacheMatrix(name, mat)) {\r\n this.updateUniform(name, mat.toArray(), 16);\r\n }\r\n };\r\n UniformBuffer.prototype._updateVector3ForEffect = function (name, vector) {\r\n this._currentEffect.setVector3(name, vector);\r\n };\r\n UniformBuffer.prototype._updateVector3ForUniform = function (name, vector) {\r\n vector.toArray(UniformBuffer._tempBuffer);\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 3);\r\n };\r\n UniformBuffer.prototype._updateVector4ForEffect = function (name, vector) {\r\n this._currentEffect.setVector4(name, vector);\r\n };\r\n UniformBuffer.prototype._updateVector4ForUniform = function (name, vector) {\r\n vector.toArray(UniformBuffer._tempBuffer);\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 4);\r\n };\r\n UniformBuffer.prototype._updateColor3ForEffect = function (name, color, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setColor3(name + suffix, color);\r\n };\r\n UniformBuffer.prototype._updateColor3ForUniform = function (name, color) {\r\n color.toArray(UniformBuffer._tempBuffer);\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 3);\r\n };\r\n UniformBuffer.prototype._updateColor4ForEffect = function (name, color, alpha, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setColor4(name + suffix, color, alpha);\r\n };\r\n UniformBuffer.prototype._updateColor4ForUniform = function (name, color, alpha) {\r\n color.toArray(UniformBuffer._tempBuffer);\r\n UniformBuffer._tempBuffer[3] = alpha;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 4);\r\n };\r\n /**\r\n * Sets a sampler uniform on the effect.\r\n * @param name Define the name of the sampler.\r\n * @param texture Define the texture to set in the sampler\r\n */\r\n UniformBuffer.prototype.setTexture = function (name, texture) {\r\n this._currentEffect.setTexture(name, texture);\r\n };\r\n /**\r\n * Directly updates the value of the uniform in the cache AND on the GPU.\r\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\r\n * @param data Define the flattened data\r\n */\r\n UniformBuffer.prototype.updateUniformDirectly = function (uniformName, data) {\r\n this.updateUniform(uniformName, data, data.length);\r\n this.update();\r\n };\r\n /**\r\n * Binds this uniform buffer to an effect.\r\n * @param effect Define the effect to bind the buffer to\r\n * @param name Name of the uniform block in the shader.\r\n */\r\n UniformBuffer.prototype.bindToEffect = function (effect, name) {\r\n this._currentEffect = effect;\r\n if (this._noUBO || !this._buffer) {\r\n return;\r\n }\r\n this._alreadyBound = true;\r\n effect.bindUniformBuffer(this._buffer, name);\r\n };\r\n /**\r\n * Disposes the uniform buffer.\r\n */\r\n UniformBuffer.prototype.dispose = function () {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n var uniformBuffers = this._engine._uniformBuffers;\r\n var index = uniformBuffers.indexOf(this);\r\n if (index !== -1) {\r\n uniformBuffers[index] = uniformBuffers[uniformBuffers.length - 1];\r\n uniformBuffers.pop();\r\n }\r\n if (!this._buffer) {\r\n return;\r\n }\r\n if (this._engine._releaseBuffer(this._buffer)) {\r\n this._buffer = null;\r\n }\r\n };\r\n // Pool for avoiding memory leaks\r\n UniformBuffer._MAX_UNIFORM_SIZE = 256;\r\n UniformBuffer._tempBuffer = new Float32Array(UniformBuffer._MAX_UNIFORM_SIZE);\r\n return UniformBuffer;\r\n}());\r\nexport { UniformBuffer };\r\n//# sourceMappingURL=uniformBuffer.js.map","import { Vector3 } from './math.vector';\r\n/** Defines supported spaces */\r\nexport var Space;\r\n(function (Space) {\r\n /** Local (object) space */\r\n Space[Space[\"LOCAL\"] = 0] = \"LOCAL\";\r\n /** World space */\r\n Space[Space[\"WORLD\"] = 1] = \"WORLD\";\r\n /** Bone space */\r\n Space[Space[\"BONE\"] = 2] = \"BONE\";\r\n})(Space || (Space = {}));\r\n/** Defines the 3 main axes */\r\nvar Axis = /** @class */ (function () {\r\n function Axis() {\r\n }\r\n /** X axis */\r\n Axis.X = new Vector3(1.0, 0.0, 0.0);\r\n /** Y axis */\r\n Axis.Y = new Vector3(0.0, 1.0, 0.0);\r\n /** Z axis */\r\n Axis.Z = new Vector3(0.0, 0.0, 1.0);\r\n return Axis;\r\n}());\r\nexport { Axis };\r\n/**\r\n * Defines cartesian components.\r\n */\r\nexport var Coordinate;\r\n(function (Coordinate) {\r\n /** X axis */\r\n Coordinate[Coordinate[\"X\"] = 0] = \"X\";\r\n /** Y axis */\r\n Coordinate[Coordinate[\"Y\"] = 1] = \"Y\";\r\n /** Z axis */\r\n Coordinate[Coordinate[\"Z\"] = 2] = \"Z\";\r\n})(Coordinate || (Coordinate = {}));\r\n//# sourceMappingURL=math.axis.js.map","import { Scalar } from './math.scalar';\r\nimport { ToLinearSpace, ToGammaSpace } from './math.constants';\r\nimport { ArrayTools } from '../Misc/arrayTools';\r\nimport { _TypeStore } from '../Misc/typeStore';\r\n/**\r\n * Class used to hold a RBG color\r\n */\r\nvar Color3 = /** @class */ (function () {\r\n /**\r\n * Creates a new Color3 object from red, green, blue values, all between 0 and 1\r\n * @param r defines the red component (between 0 and 1, default is 0)\r\n * @param g defines the green component (between 0 and 1, default is 0)\r\n * @param b defines the blue component (between 0 and 1, default is 0)\r\n */\r\n function Color3(\r\n /**\r\n * Defines the red component (between 0 and 1, default is 0)\r\n */\r\n r, \r\n /**\r\n * Defines the green component (between 0 and 1, default is 0)\r\n */\r\n g, \r\n /**\r\n * Defines the blue component (between 0 and 1, default is 0)\r\n */\r\n b) {\r\n if (r === void 0) { r = 0; }\r\n if (g === void 0) { g = 0; }\r\n if (b === void 0) { b = 0; }\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n }\r\n /**\r\n * Creates a string with the Color3 current values\r\n * @returns the string representation of the Color3 object\r\n */\r\n Color3.prototype.toString = function () {\r\n return \"{R: \" + this.r + \" G:\" + this.g + \" B:\" + this.b + \"}\";\r\n };\r\n /**\r\n * Returns the string \"Color3\"\r\n * @returns \"Color3\"\r\n */\r\n Color3.prototype.getClassName = function () {\r\n return \"Color3\";\r\n };\r\n /**\r\n * Compute the Color3 hash code\r\n * @returns an unique number that can be used to hash Color3 objects\r\n */\r\n Color3.prototype.getHashCode = function () {\r\n var hash = (this.r * 255) | 0;\r\n hash = (hash * 397) ^ ((this.g * 255) | 0);\r\n hash = (hash * 397) ^ ((this.b * 255) | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Stores in the given array from the given starting index the red, green, blue values as successive elements\r\n * @param array defines the array where to store the r,g,b components\r\n * @param index defines an optional index in the target array to define where to start storing values\r\n * @returns the current Color3 object\r\n */\r\n Color3.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this.r;\r\n array[index + 1] = this.g;\r\n array[index + 2] = this.b;\r\n return this;\r\n };\r\n /**\r\n * Update the current color with values stored in an array from the starting index of the given array\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @returns the current Color3 object\r\n */\r\n Color3.prototype.fromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n Color3.FromArrayToRef(array, offset, this);\r\n return this;\r\n };\r\n /**\r\n * Returns a new Color4 object from the current Color3 and the given alpha\r\n * @param alpha defines the alpha component on the new Color4 object (default is 1)\r\n * @returns a new Color4 object\r\n */\r\n Color3.prototype.toColor4 = function (alpha) {\r\n if (alpha === void 0) { alpha = 1; }\r\n return new Color4(this.r, this.g, this.b, alpha);\r\n };\r\n /**\r\n * Returns a new array populated with 3 numeric elements : red, green and blue values\r\n * @returns the new array\r\n */\r\n Color3.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Returns the luminance value\r\n * @returns a float value\r\n */\r\n Color3.prototype.toLuminance = function () {\r\n return this.r * 0.3 + this.g * 0.59 + this.b * 0.11;\r\n };\r\n /**\r\n * Multiply each Color3 rgb values by the given Color3 rgb values in a new Color3 object\r\n * @param otherColor defines the second operand\r\n * @returns the new Color3 object\r\n */\r\n Color3.prototype.multiply = function (otherColor) {\r\n return new Color3(this.r * otherColor.r, this.g * otherColor.g, this.b * otherColor.b);\r\n };\r\n /**\r\n * Multiply the rgb values of the Color3 and the given Color3 and stores the result in the object \"result\"\r\n * @param otherColor defines the second operand\r\n * @param result defines the Color3 object where to store the result\r\n * @returns the current Color3\r\n */\r\n Color3.prototype.multiplyToRef = function (otherColor, result) {\r\n result.r = this.r * otherColor.r;\r\n result.g = this.g * otherColor.g;\r\n result.b = this.b * otherColor.b;\r\n return this;\r\n };\r\n /**\r\n * Determines equality between Color3 objects\r\n * @param otherColor defines the second operand\r\n * @returns true if the rgb values are equal to the given ones\r\n */\r\n Color3.prototype.equals = function (otherColor) {\r\n return otherColor && this.r === otherColor.r && this.g === otherColor.g && this.b === otherColor.b;\r\n };\r\n /**\r\n * Determines equality between the current Color3 object and a set of r,b,g values\r\n * @param r defines the red component to check\r\n * @param g defines the green component to check\r\n * @param b defines the blue component to check\r\n * @returns true if the rgb values are equal to the given ones\r\n */\r\n Color3.prototype.equalsFloats = function (r, g, b) {\r\n return this.r === r && this.g === g && this.b === b;\r\n };\r\n /**\r\n * Multiplies in place each rgb value by scale\r\n * @param scale defines the scaling factor\r\n * @returns the updated Color3\r\n */\r\n Color3.prototype.scale = function (scale) {\r\n return new Color3(this.r * scale, this.g * scale, this.b * scale);\r\n };\r\n /**\r\n * Multiplies the rgb values by scale and stores the result into \"result\"\r\n * @param scale defines the scaling factor\r\n * @param result defines the Color3 object where to store the result\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.scaleToRef = function (scale, result) {\r\n result.r = this.r * scale;\r\n result.g = this.g * scale;\r\n result.b = this.b * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Color3 values by a factor and add the result to a given Color3\r\n * @param scale defines the scale factor\r\n * @param result defines color to store the result into\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.r += this.r * scale;\r\n result.g += this.g * scale;\r\n result.b += this.b * scale;\r\n return this;\r\n };\r\n /**\r\n * Clamps the rgb values by the min and max values and stores the result into \"result\"\r\n * @param min defines minimum clamping value (default is 0)\r\n * @param max defines maximum clamping value (default is 1)\r\n * @param result defines color to store the result into\r\n * @returns the original Color3\r\n */\r\n Color3.prototype.clampToRef = function (min, max, result) {\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 1; }\r\n result.r = Scalar.Clamp(this.r, min, max);\r\n result.g = Scalar.Clamp(this.g, min, max);\r\n result.b = Scalar.Clamp(this.b, min, max);\r\n return this;\r\n };\r\n /**\r\n * Creates a new Color3 set with the added values of the current Color3 and of the given one\r\n * @param otherColor defines the second operand\r\n * @returns the new Color3\r\n */\r\n Color3.prototype.add = function (otherColor) {\r\n return new Color3(this.r + otherColor.r, this.g + otherColor.g, this.b + otherColor.b);\r\n };\r\n /**\r\n * Stores the result of the addition of the current Color3 and given one rgb values into \"result\"\r\n * @param otherColor defines the second operand\r\n * @param result defines Color3 object to store the result into\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.addToRef = function (otherColor, result) {\r\n result.r = this.r + otherColor.r;\r\n result.g = this.g + otherColor.g;\r\n result.b = this.b + otherColor.b;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Color3 set with the subtracted values of the given one from the current Color3\r\n * @param otherColor defines the second operand\r\n * @returns the new Color3\r\n */\r\n Color3.prototype.subtract = function (otherColor) {\r\n return new Color3(this.r - otherColor.r, this.g - otherColor.g, this.b - otherColor.b);\r\n };\r\n /**\r\n * Stores the result of the subtraction of given one from the current Color3 rgb values into \"result\"\r\n * @param otherColor defines the second operand\r\n * @param result defines Color3 object to store the result into\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.subtractToRef = function (otherColor, result) {\r\n result.r = this.r - otherColor.r;\r\n result.g = this.g - otherColor.g;\r\n result.b = this.b - otherColor.b;\r\n return this;\r\n };\r\n /**\r\n * Copy the current object\r\n * @returns a new Color3 copied the current one\r\n */\r\n Color3.prototype.clone = function () {\r\n return new Color3(this.r, this.g, this.b);\r\n };\r\n /**\r\n * Copies the rgb values from the source in the current Color3\r\n * @param source defines the source Color3 object\r\n * @returns the updated Color3 object\r\n */\r\n Color3.prototype.copyFrom = function (source) {\r\n this.r = source.r;\r\n this.g = source.g;\r\n this.b = source.b;\r\n return this;\r\n };\r\n /**\r\n * Updates the Color3 rgb values from the given floats\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @returns the current Color3 object\r\n */\r\n Color3.prototype.copyFromFloats = function (r, g, b) {\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n return this;\r\n };\r\n /**\r\n * Updates the Color3 rgb values from the given floats\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @returns the current Color3 object\r\n */\r\n Color3.prototype.set = function (r, g, b) {\r\n return this.copyFromFloats(r, g, b);\r\n };\r\n /**\r\n * Compute the Color3 hexadecimal code as a string\r\n * @returns a string containing the hexadecimal representation of the Color3 object\r\n */\r\n Color3.prototype.toHexString = function () {\r\n var intR = (this.r * 255) | 0;\r\n var intG = (this.g * 255) | 0;\r\n var intB = (this.b * 255) | 0;\r\n return \"#\" + Scalar.ToHex(intR) + Scalar.ToHex(intG) + Scalar.ToHex(intB);\r\n };\r\n /**\r\n * Computes a new Color3 converted from the current one to linear space\r\n * @returns a new Color3 object\r\n */\r\n Color3.prototype.toLinearSpace = function () {\r\n var convertedColor = new Color3();\r\n this.toLinearSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts current color in rgb space to HSV values\r\n * @returns a new color3 representing the HSV values\r\n */\r\n Color3.prototype.toHSV = function () {\r\n var result = new Color3();\r\n this.toHSVToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Converts current color in rgb space to HSV values\r\n * @param result defines the Color3 where to store the HSV values\r\n */\r\n Color3.prototype.toHSVToRef = function (result) {\r\n var r = this.r;\r\n var g = this.g;\r\n var b = this.b;\r\n var max = Math.max(r, g, b);\r\n var min = Math.min(r, g, b);\r\n var h = 0;\r\n var s = 0;\r\n var v = max;\r\n var dm = max - min;\r\n if (max !== 0) {\r\n s = dm / max;\r\n }\r\n if (max != min) {\r\n if (max == r) {\r\n h = (g - b) / dm;\r\n if (g < b) {\r\n h += 6;\r\n }\r\n }\r\n else if (max == g) {\r\n h = (b - r) / dm + 2;\r\n }\r\n else if (max == b) {\r\n h = (r - g) / dm + 4;\r\n }\r\n h *= 60;\r\n }\r\n result.r = h;\r\n result.g = s;\r\n result.b = v;\r\n };\r\n /**\r\n * Converts the Color3 values to linear space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color3 object where to store the linear space version\r\n * @returns the unmodified Color3\r\n */\r\n Color3.prototype.toLinearSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, ToLinearSpace);\r\n convertedColor.g = Math.pow(this.g, ToLinearSpace);\r\n convertedColor.b = Math.pow(this.b, ToLinearSpace);\r\n return this;\r\n };\r\n /**\r\n * Computes a new Color3 converted from the current one to gamma space\r\n * @returns a new Color3 object\r\n */\r\n Color3.prototype.toGammaSpace = function () {\r\n var convertedColor = new Color3();\r\n this.toGammaSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts the Color3 values to gamma space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color3 object where to store the gamma space version\r\n * @returns the unmodified Color3\r\n */\r\n Color3.prototype.toGammaSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, ToGammaSpace);\r\n convertedColor.g = Math.pow(this.g, ToGammaSpace);\r\n convertedColor.b = Math.pow(this.b, ToGammaSpace);\r\n return this;\r\n };\r\n /**\r\n * Convert Hue, saturation and value to a Color3 (RGB)\r\n * @param hue defines the hue\r\n * @param saturation defines the saturation\r\n * @param value defines the value\r\n * @param result defines the Color3 where to store the RGB values\r\n */\r\n Color3.HSVtoRGBToRef = function (hue, saturation, value, result) {\r\n var chroma = value * saturation;\r\n var h = hue / 60;\r\n var x = chroma * (1 - Math.abs((h % 2) - 1));\r\n var r = 0;\r\n var g = 0;\r\n var b = 0;\r\n if (h >= 0 && h <= 1) {\r\n r = chroma;\r\n g = x;\r\n }\r\n else if (h >= 1 && h <= 2) {\r\n r = x;\r\n g = chroma;\r\n }\r\n else if (h >= 2 && h <= 3) {\r\n g = chroma;\r\n b = x;\r\n }\r\n else if (h >= 3 && h <= 4) {\r\n g = x;\r\n b = chroma;\r\n }\r\n else if (h >= 4 && h <= 5) {\r\n r = x;\r\n b = chroma;\r\n }\r\n else if (h >= 5 && h <= 6) {\r\n r = chroma;\r\n b = x;\r\n }\r\n var m = value - chroma;\r\n result.set((r + m), (g + m), (b + m));\r\n };\r\n /**\r\n * Creates a new Color3 from the string containing valid hexadecimal values\r\n * @param hex defines a string containing valid hexadecimal values\r\n * @returns a new Color3 object\r\n */\r\n Color3.FromHexString = function (hex) {\r\n if (hex.substring(0, 1) !== \"#\" || hex.length !== 7) {\r\n return new Color3(0, 0, 0);\r\n }\r\n var r = parseInt(hex.substring(1, 3), 16);\r\n var g = parseInt(hex.substring(3, 5), 16);\r\n var b = parseInt(hex.substring(5, 7), 16);\r\n return Color3.FromInts(r, g, b);\r\n };\r\n /**\r\n * Creates a new Color3 from the starting index of the given array\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @returns a new Color3 object\r\n */\r\n Color3.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Color3(array[offset], array[offset + 1], array[offset + 2]);\r\n };\r\n /**\r\n * Creates a new Color3 from the starting index element of the given array\r\n * @param array defines the source array to read from\r\n * @param offset defines the offset in the source array\r\n * @param result defines the target Color3 object\r\n */\r\n Color3.FromArrayToRef = function (array, offset, result) {\r\n if (offset === void 0) { offset = 0; }\r\n result.r = array[offset];\r\n result.g = array[offset + 1];\r\n result.b = array[offset + 2];\r\n };\r\n /**\r\n * Creates a new Color3 from integer values (< 256)\r\n * @param r defines the red component to read from (value between 0 and 255)\r\n * @param g defines the green component to read from (value between 0 and 255)\r\n * @param b defines the blue component to read from (value between 0 and 255)\r\n * @returns a new Color3 object\r\n */\r\n Color3.FromInts = function (r, g, b) {\r\n return new Color3(r / 255.0, g / 255.0, b / 255.0);\r\n };\r\n /**\r\n * Creates a new Color3 with values linearly interpolated of \"amount\" between the start Color3 and the end Color3\r\n * @param start defines the start Color3 value\r\n * @param end defines the end Color3 value\r\n * @param amount defines the gradient value between start and end\r\n * @returns a new Color3 object\r\n */\r\n Color3.Lerp = function (start, end, amount) {\r\n var result = new Color3(0.0, 0.0, 0.0);\r\n Color3.LerpToRef(start, end, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new Color3 with values linearly interpolated of \"amount\" between the start Color3 and the end Color3\r\n * @param left defines the start value\r\n * @param right defines the end value\r\n * @param amount defines the gradient factor\r\n * @param result defines the Color3 object where to store the result\r\n */\r\n Color3.LerpToRef = function (left, right, amount, result) {\r\n result.r = left.r + ((right.r - left.r) * amount);\r\n result.g = left.g + ((right.g - left.g) * amount);\r\n result.b = left.b + ((right.b - left.b) * amount);\r\n };\r\n /**\r\n * Returns a Color3 value containing a red color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Red = function () { return new Color3(1, 0, 0); };\r\n /**\r\n * Returns a Color3 value containing a green color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Green = function () { return new Color3(0, 1, 0); };\r\n /**\r\n * Returns a Color3 value containing a blue color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Blue = function () { return new Color3(0, 0, 1); };\r\n /**\r\n * Returns a Color3 value containing a black color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Black = function () { return new Color3(0, 0, 0); };\r\n Object.defineProperty(Color3, \"BlackReadOnly\", {\r\n /**\r\n * Gets a Color3 value containing a black color that must not be updated\r\n */\r\n get: function () {\r\n return Color3._BlackReadOnly;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a Color3 value containing a white color\r\n * @returns a new Color3 object\r\n */\r\n Color3.White = function () { return new Color3(1, 1, 1); };\r\n /**\r\n * Returns a Color3 value containing a purple color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Purple = function () { return new Color3(0.5, 0, 0.5); };\r\n /**\r\n * Returns a Color3 value containing a magenta color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Magenta = function () { return new Color3(1, 0, 1); };\r\n /**\r\n * Returns a Color3 value containing a yellow color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Yellow = function () { return new Color3(1, 1, 0); };\r\n /**\r\n * Returns a Color3 value containing a gray color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Gray = function () { return new Color3(0.5, 0.5, 0.5); };\r\n /**\r\n * Returns a Color3 value containing a teal color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Teal = function () { return new Color3(0, 1.0, 1.0); };\r\n /**\r\n * Returns a Color3 value containing a random color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Random = function () { return new Color3(Math.random(), Math.random(), Math.random()); };\r\n // Statics\r\n Color3._BlackReadOnly = Color3.Black();\r\n return Color3;\r\n}());\r\nexport { Color3 };\r\n/**\r\n * Class used to hold a RBGA color\r\n */\r\nvar Color4 = /** @class */ (function () {\r\n /**\r\n * Creates a new Color4 object from red, green, blue values, all between 0 and 1\r\n * @param r defines the red component (between 0 and 1, default is 0)\r\n * @param g defines the green component (between 0 and 1, default is 0)\r\n * @param b defines the blue component (between 0 and 1, default is 0)\r\n * @param a defines the alpha component (between 0 and 1, default is 1)\r\n */\r\n function Color4(\r\n /**\r\n * Defines the red component (between 0 and 1, default is 0)\r\n */\r\n r, \r\n /**\r\n * Defines the green component (between 0 and 1, default is 0)\r\n */\r\n g, \r\n /**\r\n * Defines the blue component (between 0 and 1, default is 0)\r\n */\r\n b, \r\n /**\r\n * Defines the alpha component (between 0 and 1, default is 1)\r\n */\r\n a) {\r\n if (r === void 0) { r = 0; }\r\n if (g === void 0) { g = 0; }\r\n if (b === void 0) { b = 0; }\r\n if (a === void 0) { a = 1; }\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n this.a = a;\r\n }\r\n // Operators\r\n /**\r\n * Adds in place the given Color4 values to the current Color4 object\r\n * @param right defines the second operand\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.addInPlace = function (right) {\r\n this.r += right.r;\r\n this.g += right.g;\r\n this.b += right.b;\r\n this.a += right.a;\r\n return this;\r\n };\r\n /**\r\n * Creates a new array populated with 4 numeric elements : red, green, blue, alpha values\r\n * @returns the new array\r\n */\r\n Color4.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Stores from the starting index in the given array the Color4 successive values\r\n * @param array defines the array where to store the r,g,b components\r\n * @param index defines an optional index in the target array to define where to start storing values\r\n * @returns the current Color4 object\r\n */\r\n Color4.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this.r;\r\n array[index + 1] = this.g;\r\n array[index + 2] = this.b;\r\n array[index + 3] = this.a;\r\n return this;\r\n };\r\n /**\r\n * Update the current color with values stored in an array from the starting index of the given array\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @returns the current Color4 object\r\n */\r\n Color4.prototype.fromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n Color4.FromArrayToRef(array, offset, this);\r\n return this;\r\n };\r\n /**\r\n * Determines equality between Color4 objects\r\n * @param otherColor defines the second operand\r\n * @returns true if the rgba values are equal to the given ones\r\n */\r\n Color4.prototype.equals = function (otherColor) {\r\n return otherColor && this.r === otherColor.r && this.g === otherColor.g && this.b === otherColor.b && this.a === otherColor.a;\r\n };\r\n /**\r\n * Creates a new Color4 set with the added values of the current Color4 and of the given one\r\n * @param right defines the second operand\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.add = function (right) {\r\n return new Color4(this.r + right.r, this.g + right.g, this.b + right.b, this.a + right.a);\r\n };\r\n /**\r\n * Creates a new Color4 set with the subtracted values of the given one from the current Color4\r\n * @param right defines the second operand\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.subtract = function (right) {\r\n return new Color4(this.r - right.r, this.g - right.g, this.b - right.b, this.a - right.a);\r\n };\r\n /**\r\n * Subtracts the given ones from the current Color4 values and stores the results in \"result\"\r\n * @param right defines the second operand\r\n * @param result defines the Color4 object where to store the result\r\n * @returns the current Color4 object\r\n */\r\n Color4.prototype.subtractToRef = function (right, result) {\r\n result.r = this.r - right.r;\r\n result.g = this.g - right.g;\r\n result.b = this.b - right.b;\r\n result.a = this.a - right.a;\r\n return this;\r\n };\r\n /**\r\n * Creates a new Color4 with the current Color4 values multiplied by scale\r\n * @param scale defines the scaling factor to apply\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.scale = function (scale) {\r\n return new Color4(this.r * scale, this.g * scale, this.b * scale, this.a * scale);\r\n };\r\n /**\r\n * Multiplies the current Color4 values by scale and stores the result in \"result\"\r\n * @param scale defines the scaling factor to apply\r\n * @param result defines the Color4 object where to store the result\r\n * @returns the current unmodified Color4\r\n */\r\n Color4.prototype.scaleToRef = function (scale, result) {\r\n result.r = this.r * scale;\r\n result.g = this.g * scale;\r\n result.b = this.b * scale;\r\n result.a = this.a * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Color4 values by a factor and add the result to a given Color4\r\n * @param scale defines the scale factor\r\n * @param result defines the Color4 object where to store the result\r\n * @returns the unmodified current Color4\r\n */\r\n Color4.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.r += this.r * scale;\r\n result.g += this.g * scale;\r\n result.b += this.b * scale;\r\n result.a += this.a * scale;\r\n return this;\r\n };\r\n /**\r\n * Clamps the rgb values by the min and max values and stores the result into \"result\"\r\n * @param min defines minimum clamping value (default is 0)\r\n * @param max defines maximum clamping value (default is 1)\r\n * @param result defines color to store the result into.\r\n * @returns the cuurent Color4\r\n */\r\n Color4.prototype.clampToRef = function (min, max, result) {\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 1; }\r\n result.r = Scalar.Clamp(this.r, min, max);\r\n result.g = Scalar.Clamp(this.g, min, max);\r\n result.b = Scalar.Clamp(this.b, min, max);\r\n result.a = Scalar.Clamp(this.a, min, max);\r\n return this;\r\n };\r\n /**\r\n * Multipy an Color4 value by another and return a new Color4 object\r\n * @param color defines the Color4 value to multiply by\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.multiply = function (color) {\r\n return new Color4(this.r * color.r, this.g * color.g, this.b * color.b, this.a * color.a);\r\n };\r\n /**\r\n * Multipy a Color4 value by another and push the result in a reference value\r\n * @param color defines the Color4 value to multiply by\r\n * @param result defines the Color4 to fill the result in\r\n * @returns the result Color4\r\n */\r\n Color4.prototype.multiplyToRef = function (color, result) {\r\n result.r = this.r * color.r;\r\n result.g = this.g * color.g;\r\n result.b = this.b * color.b;\r\n result.a = this.a * color.a;\r\n return result;\r\n };\r\n /**\r\n * Creates a string with the Color4 current values\r\n * @returns the string representation of the Color4 object\r\n */\r\n Color4.prototype.toString = function () {\r\n return \"{R: \" + this.r + \" G:\" + this.g + \" B:\" + this.b + \" A:\" + this.a + \"}\";\r\n };\r\n /**\r\n * Returns the string \"Color4\"\r\n * @returns \"Color4\"\r\n */\r\n Color4.prototype.getClassName = function () {\r\n return \"Color4\";\r\n };\r\n /**\r\n * Compute the Color4 hash code\r\n * @returns an unique number that can be used to hash Color4 objects\r\n */\r\n Color4.prototype.getHashCode = function () {\r\n var hash = (this.r * 255) | 0;\r\n hash = (hash * 397) ^ ((this.g * 255) | 0);\r\n hash = (hash * 397) ^ ((this.b * 255) | 0);\r\n hash = (hash * 397) ^ ((this.a * 255) | 0);\r\n return hash;\r\n };\r\n /**\r\n * Creates a new Color4 copied from the current one\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.clone = function () {\r\n return new Color4(this.r, this.g, this.b, this.a);\r\n };\r\n /**\r\n * Copies the given Color4 values into the current one\r\n * @param source defines the source Color4 object\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.copyFrom = function (source) {\r\n this.r = source.r;\r\n this.g = source.g;\r\n this.b = source.b;\r\n this.a = source.a;\r\n return this;\r\n };\r\n /**\r\n * Copies the given float values into the current one\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @param a defines the alpha component to read from\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.copyFromFloats = function (r, g, b, a) {\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n this.a = a;\r\n return this;\r\n };\r\n /**\r\n * Copies the given float values into the current one\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @param a defines the alpha component to read from\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.set = function (r, g, b, a) {\r\n return this.copyFromFloats(r, g, b, a);\r\n };\r\n /**\r\n * Compute the Color4 hexadecimal code as a string\r\n * @param returnAsColor3 defines if the string should only contains RGB values (off by default)\r\n * @returns a string containing the hexadecimal representation of the Color4 object\r\n */\r\n Color4.prototype.toHexString = function (returnAsColor3) {\r\n if (returnAsColor3 === void 0) { returnAsColor3 = false; }\r\n var intR = (this.r * 255) | 0;\r\n var intG = (this.g * 255) | 0;\r\n var intB = (this.b * 255) | 0;\r\n if (returnAsColor3) {\r\n return \"#\" + Scalar.ToHex(intR) + Scalar.ToHex(intG) + Scalar.ToHex(intB);\r\n }\r\n var intA = (this.a * 255) | 0;\r\n return \"#\" + Scalar.ToHex(intR) + Scalar.ToHex(intG) + Scalar.ToHex(intB) + Scalar.ToHex(intA);\r\n };\r\n /**\r\n * Computes a new Color4 converted from the current one to linear space\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.toLinearSpace = function () {\r\n var convertedColor = new Color4();\r\n this.toLinearSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts the Color4 values to linear space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color4 object where to store the linear space version\r\n * @returns the unmodified Color4\r\n */\r\n Color4.prototype.toLinearSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, ToLinearSpace);\r\n convertedColor.g = Math.pow(this.g, ToLinearSpace);\r\n convertedColor.b = Math.pow(this.b, ToLinearSpace);\r\n convertedColor.a = this.a;\r\n return this;\r\n };\r\n /**\r\n * Computes a new Color4 converted from the current one to gamma space\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.toGammaSpace = function () {\r\n var convertedColor = new Color4();\r\n this.toGammaSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts the Color4 values to gamma space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color4 object where to store the gamma space version\r\n * @returns the unmodified Color4\r\n */\r\n Color4.prototype.toGammaSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, ToGammaSpace);\r\n convertedColor.g = Math.pow(this.g, ToGammaSpace);\r\n convertedColor.b = Math.pow(this.b, ToGammaSpace);\r\n convertedColor.a = this.a;\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Creates a new Color4 from the string containing valid hexadecimal values\r\n * @param hex defines a string containing valid hexadecimal values\r\n * @returns a new Color4 object\r\n */\r\n Color4.FromHexString = function (hex) {\r\n if (hex.substring(0, 1) !== \"#\" || hex.length !== 9) {\r\n return new Color4(0.0, 0.0, 0.0, 0.0);\r\n }\r\n var r = parseInt(hex.substring(1, 3), 16);\r\n var g = parseInt(hex.substring(3, 5), 16);\r\n var b = parseInt(hex.substring(5, 7), 16);\r\n var a = parseInt(hex.substring(7, 9), 16);\r\n return Color4.FromInts(r, g, b, a);\r\n };\r\n /**\r\n * Creates a new Color4 object set with the linearly interpolated values of \"amount\" between the left Color4 object and the right Color4 object\r\n * @param left defines the start value\r\n * @param right defines the end value\r\n * @param amount defines the gradient factor\r\n * @returns a new Color4 object\r\n */\r\n Color4.Lerp = function (left, right, amount) {\r\n var result = new Color4(0.0, 0.0, 0.0, 0.0);\r\n Color4.LerpToRef(left, right, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Set the given \"result\" with the linearly interpolated values of \"amount\" between the left Color4 object and the right Color4 object\r\n * @param left defines the start value\r\n * @param right defines the end value\r\n * @param amount defines the gradient factor\r\n * @param result defines the Color4 object where to store data\r\n */\r\n Color4.LerpToRef = function (left, right, amount, result) {\r\n result.r = left.r + (right.r - left.r) * amount;\r\n result.g = left.g + (right.g - left.g) * amount;\r\n result.b = left.b + (right.b - left.b) * amount;\r\n result.a = left.a + (right.a - left.a) * amount;\r\n };\r\n /**\r\n * Creates a new Color4 from a Color3 and an alpha value\r\n * @param color3 defines the source Color3 to read from\r\n * @param alpha defines the alpha component (1.0 by default)\r\n * @returns a new Color4 object\r\n */\r\n Color4.FromColor3 = function (color3, alpha) {\r\n if (alpha === void 0) { alpha = 1.0; }\r\n return new Color4(color3.r, color3.g, color3.b, alpha);\r\n };\r\n /**\r\n * Creates a new Color4 from the starting index element of the given array\r\n * @param array defines the source array to read from\r\n * @param offset defines the offset in the source array\r\n * @returns a new Color4 object\r\n */\r\n Color4.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Color4(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\r\n };\r\n /**\r\n * Creates a new Color4 from the starting index element of the given array\r\n * @param array defines the source array to read from\r\n * @param offset defines the offset in the source array\r\n * @param result defines the target Color4 object\r\n */\r\n Color4.FromArrayToRef = function (array, offset, result) {\r\n if (offset === void 0) { offset = 0; }\r\n result.r = array[offset];\r\n result.g = array[offset + 1];\r\n result.b = array[offset + 2];\r\n result.a = array[offset + 3];\r\n };\r\n /**\r\n * Creates a new Color3 from integer values (< 256)\r\n * @param r defines the red component to read from (value between 0 and 255)\r\n * @param g defines the green component to read from (value between 0 and 255)\r\n * @param b defines the blue component to read from (value between 0 and 255)\r\n * @param a defines the alpha component to read from (value between 0 and 255)\r\n * @returns a new Color3 object\r\n */\r\n Color4.FromInts = function (r, g, b, a) {\r\n return new Color4(r / 255.0, g / 255.0, b / 255.0, a / 255.0);\r\n };\r\n /**\r\n * Check the content of a given array and convert it to an array containing RGBA data\r\n * If the original array was already containing count * 4 values then it is returned directly\r\n * @param colors defines the array to check\r\n * @param count defines the number of RGBA data to expect\r\n * @returns an array containing count * 4 values (RGBA)\r\n */\r\n Color4.CheckColors4 = function (colors, count) {\r\n // Check if color3 was used\r\n if (colors.length === count * 3) {\r\n var colors4 = [];\r\n for (var index = 0; index < colors.length; index += 3) {\r\n var newIndex = (index / 3) * 4;\r\n colors4[newIndex] = colors[index];\r\n colors4[newIndex + 1] = colors[index + 1];\r\n colors4[newIndex + 2] = colors[index + 2];\r\n colors4[newIndex + 3] = 1.0;\r\n }\r\n return colors4;\r\n }\r\n return colors;\r\n };\r\n return Color4;\r\n}());\r\nexport { Color4 };\r\n/**\r\n * @hidden\r\n */\r\nvar TmpColors = /** @class */ (function () {\r\n function TmpColors() {\r\n }\r\n TmpColors.Color3 = ArrayTools.BuildArray(3, Color3.Black);\r\n TmpColors.Color4 = ArrayTools.BuildArray(3, function () { return new Color4(0, 0, 0, 0); });\r\n return TmpColors;\r\n}());\r\nexport { TmpColors };\r\n_TypeStore.RegisteredTypes[\"BABYLON.Color3\"] = Color3;\r\n_TypeStore.RegisteredTypes[\"BABYLON.Color4\"] = Color4;\r\n//# sourceMappingURL=math.color.js.map","/**\r\n * Constant used to convert a value to gamma space\r\n * @ignorenaming\r\n */\r\nexport var ToGammaSpace = 1 / 2.2;\r\n/**\r\n * Constant used to convert a value to linear space\r\n * @ignorenaming\r\n */\r\nexport var ToLinearSpace = 2.2;\r\n/**\r\n * Constant used to define the minimal number value in Babylon.js\r\n * @ignorenaming\r\n */\r\nvar Epsilon = 0.001;\r\nexport { Epsilon };\r\n//# sourceMappingURL=math.constants.js.map","import { Plane } from './math.plane';\r\n/**\r\n * Represents a camera frustum\r\n */\r\nvar Frustum = /** @class */ (function () {\r\n function Frustum() {\r\n }\r\n /**\r\n * Gets the planes representing the frustum\r\n * @param transform matrix to be applied to the returned planes\r\n * @returns a new array of 6 Frustum planes computed by the given transformation matrix.\r\n */\r\n Frustum.GetPlanes = function (transform) {\r\n var frustumPlanes = [];\r\n for (var index = 0; index < 6; index++) {\r\n frustumPlanes.push(new Plane(0.0, 0.0, 0.0, 0.0));\r\n }\r\n Frustum.GetPlanesToRef(transform, frustumPlanes);\r\n return frustumPlanes;\r\n };\r\n /**\r\n * Gets the near frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetNearPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] + m[2];\r\n frustumPlane.normal.y = m[7] + m[6];\r\n frustumPlane.normal.z = m[11] + m[10];\r\n frustumPlane.d = m[15] + m[14];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the far frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetFarPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] - m[2];\r\n frustumPlane.normal.y = m[7] - m[6];\r\n frustumPlane.normal.z = m[11] - m[10];\r\n frustumPlane.d = m[15] - m[14];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the left frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetLeftPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] + m[0];\r\n frustumPlane.normal.y = m[7] + m[4];\r\n frustumPlane.normal.z = m[11] + m[8];\r\n frustumPlane.d = m[15] + m[12];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the right frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetRightPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] - m[0];\r\n frustumPlane.normal.y = m[7] - m[4];\r\n frustumPlane.normal.z = m[11] - m[8];\r\n frustumPlane.d = m[15] - m[12];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the top frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetTopPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] - m[1];\r\n frustumPlane.normal.y = m[7] - m[5];\r\n frustumPlane.normal.z = m[11] - m[9];\r\n frustumPlane.d = m[15] - m[13];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the bottom frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetBottomPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] + m[1];\r\n frustumPlane.normal.y = m[7] + m[5];\r\n frustumPlane.normal.z = m[11] + m[9];\r\n frustumPlane.d = m[15] + m[13];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Sets the given array \"frustumPlanes\" with the 6 Frustum planes computed by the given transformation matrix.\r\n * @param transform transformation matrix to be applied to the resulting frustum planes\r\n * @param frustumPlanes the resuling frustum planes\r\n */\r\n Frustum.GetPlanesToRef = function (transform, frustumPlanes) {\r\n // Near\r\n Frustum.GetNearPlaneToRef(transform, frustumPlanes[0]);\r\n // Far\r\n Frustum.GetFarPlaneToRef(transform, frustumPlanes[1]);\r\n // Left\r\n Frustum.GetLeftPlaneToRef(transform, frustumPlanes[2]);\r\n // Right\r\n Frustum.GetRightPlaneToRef(transform, frustumPlanes[3]);\r\n // Top\r\n Frustum.GetTopPlaneToRef(transform, frustumPlanes[4]);\r\n // Bottom\r\n Frustum.GetBottomPlaneToRef(transform, frustumPlanes[5]);\r\n };\r\n return Frustum;\r\n}());\r\nexport { Frustum };\r\n//# sourceMappingURL=math.frustum.js.map","import { Vector3 } from './math.vector';\r\n/**\r\n * Extracts minimum and maximum values from a list of indexed positions\r\n * @param positions defines the positions to use\r\n * @param indices defines the indices to the positions\r\n * @param indexStart defines the start index\r\n * @param indexCount defines the end index\r\n * @param bias defines bias value to add to the result\r\n * @return minimum and maximum values\r\n */\r\nexport function extractMinAndMaxIndexed(positions, indices, indexStart, indexCount, bias) {\r\n if (bias === void 0) { bias = null; }\r\n var minimum = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var maximum = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n for (var index = indexStart; index < indexStart + indexCount; index++) {\r\n var offset = indices[index] * 3;\r\n var x = positions[offset];\r\n var y = positions[offset + 1];\r\n var z = positions[offset + 2];\r\n minimum.minimizeInPlaceFromFloats(x, y, z);\r\n maximum.maximizeInPlaceFromFloats(x, y, z);\r\n }\r\n if (bias) {\r\n minimum.x -= minimum.x * bias.x + bias.y;\r\n minimum.y -= minimum.y * bias.x + bias.y;\r\n minimum.z -= minimum.z * bias.x + bias.y;\r\n maximum.x += maximum.x * bias.x + bias.y;\r\n maximum.y += maximum.y * bias.x + bias.y;\r\n maximum.z += maximum.z * bias.x + bias.y;\r\n }\r\n return {\r\n minimum: minimum,\r\n maximum: maximum\r\n };\r\n}\r\n/**\r\n * Extracts minimum and maximum values from a list of positions\r\n * @param positions defines the positions to use\r\n * @param start defines the start index in the positions array\r\n * @param count defines the number of positions to handle\r\n * @param bias defines bias value to add to the result\r\n * @param stride defines the stride size to use (distance between two positions in the positions array)\r\n * @return minimum and maximum values\r\n */\r\nexport function extractMinAndMax(positions, start, count, bias, stride) {\r\n if (bias === void 0) { bias = null; }\r\n var minimum = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var maximum = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n if (!stride) {\r\n stride = 3;\r\n }\r\n for (var index = start, offset = start * stride; index < start + count; index++, offset += stride) {\r\n var x = positions[offset];\r\n var y = positions[offset + 1];\r\n var z = positions[offset + 2];\r\n minimum.minimizeInPlaceFromFloats(x, y, z);\r\n maximum.maximizeInPlaceFromFloats(x, y, z);\r\n }\r\n if (bias) {\r\n minimum.x -= minimum.x * bias.x + bias.y;\r\n minimum.y -= minimum.y * bias.x + bias.y;\r\n minimum.z -= minimum.z * bias.x + bias.y;\r\n maximum.x += maximum.x * bias.x + bias.y;\r\n maximum.y += maximum.y * bias.x + bias.y;\r\n maximum.z += maximum.z * bias.x + bias.y;\r\n }\r\n return {\r\n minimum: minimum,\r\n maximum: maximum\r\n };\r\n}\r\n//# sourceMappingURL=math.functions.js.map","import { Vector3, Vector2 } from './math.vector';\r\n/**\r\n * Contains position and normal vectors for a vertex\r\n */\r\nvar PositionNormalVertex = /** @class */ (function () {\r\n /**\r\n * Creates a PositionNormalVertex\r\n * @param position the position of the vertex (defaut: 0,0,0)\r\n * @param normal the normal of the vertex (defaut: 0,1,0)\r\n */\r\n function PositionNormalVertex(\r\n /** the position of the vertex (defaut: 0,0,0) */\r\n position, \r\n /** the normal of the vertex (defaut: 0,1,0) */\r\n normal) {\r\n if (position === void 0) { position = Vector3.Zero(); }\r\n if (normal === void 0) { normal = Vector3.Up(); }\r\n this.position = position;\r\n this.normal = normal;\r\n }\r\n /**\r\n * Clones the PositionNormalVertex\r\n * @returns the cloned PositionNormalVertex\r\n */\r\n PositionNormalVertex.prototype.clone = function () {\r\n return new PositionNormalVertex(this.position.clone(), this.normal.clone());\r\n };\r\n return PositionNormalVertex;\r\n}());\r\nexport { PositionNormalVertex };\r\n/**\r\n * Contains position, normal and uv vectors for a vertex\r\n */\r\nvar PositionNormalTextureVertex = /** @class */ (function () {\r\n /**\r\n * Creates a PositionNormalTextureVertex\r\n * @param position the position of the vertex (defaut: 0,0,0)\r\n * @param normal the normal of the vertex (defaut: 0,1,0)\r\n * @param uv the uv of the vertex (default: 0,0)\r\n */\r\n function PositionNormalTextureVertex(\r\n /** the position of the vertex (defaut: 0,0,0) */\r\n position, \r\n /** the normal of the vertex (defaut: 0,1,0) */\r\n normal, \r\n /** the uv of the vertex (default: 0,0) */\r\n uv) {\r\n if (position === void 0) { position = Vector3.Zero(); }\r\n if (normal === void 0) { normal = Vector3.Up(); }\r\n if (uv === void 0) { uv = Vector2.Zero(); }\r\n this.position = position;\r\n this.normal = normal;\r\n this.uv = uv;\r\n }\r\n /**\r\n * Clones the PositionNormalTextureVertex\r\n * @returns the cloned PositionNormalTextureVertex\r\n */\r\n PositionNormalTextureVertex.prototype.clone = function () {\r\n return new PositionNormalTextureVertex(this.position.clone(), this.normal.clone(), this.uv.clone());\r\n };\r\n return PositionNormalTextureVertex;\r\n}());\r\nexport { PositionNormalTextureVertex };\r\n//# sourceMappingURL=math.vertexFormat.js.map","import { Scalar } from \"./math.scalar\";\r\nimport { Vector2, Vector3, Quaternion, Matrix } from \"./math.vector\";\r\nimport { Epsilon } from \"./math.constants\";\r\n/**\r\n * Defines potential orientation for back face culling\r\n */\r\nexport var Orientation;\r\n(function (Orientation) {\r\n /**\r\n * Clockwise\r\n */\r\n Orientation[Orientation[\"CW\"] = 0] = \"CW\";\r\n /** Counter clockwise */\r\n Orientation[Orientation[\"CCW\"] = 1] = \"CCW\";\r\n})(Orientation || (Orientation = {}));\r\n/** Class used to represent a Bezier curve */\r\nvar BezierCurve = /** @class */ (function () {\r\n function BezierCurve() {\r\n }\r\n /**\r\n * Returns the cubic Bezier interpolated value (float) at \"t\" (float) from the given x1, y1, x2, y2 floats\r\n * @param t defines the time\r\n * @param x1 defines the left coordinate on X axis\r\n * @param y1 defines the left coordinate on Y axis\r\n * @param x2 defines the right coordinate on X axis\r\n * @param y2 defines the right coordinate on Y axis\r\n * @returns the interpolated value\r\n */\r\n BezierCurve.Interpolate = function (t, x1, y1, x2, y2) {\r\n // Extract X (which is equal to time here)\r\n var f0 = 1 - 3 * x2 + 3 * x1;\r\n var f1 = 3 * x2 - 6 * x1;\r\n var f2 = 3 * x1;\r\n var refinedT = t;\r\n for (var i = 0; i < 5; i++) {\r\n var refinedT2 = refinedT * refinedT;\r\n var refinedT3 = refinedT2 * refinedT;\r\n var x = f0 * refinedT3 + f1 * refinedT2 + f2 * refinedT;\r\n var slope = 1.0 / (3.0 * f0 * refinedT2 + 2.0 * f1 * refinedT + f2);\r\n refinedT -= (x - t) * slope;\r\n refinedT = Math.min(1, Math.max(0, refinedT));\r\n }\r\n // Resolve cubic bezier for the given x\r\n return 3 * Math.pow(1 - refinedT, 2) * refinedT * y1 + 3 * (1 - refinedT) * Math.pow(refinedT, 2) * y2 + Math.pow(refinedT, 3);\r\n };\r\n return BezierCurve;\r\n}());\r\nexport { BezierCurve };\r\n/**\r\n * Defines angle representation\r\n */\r\nvar Angle = /** @class */ (function () {\r\n /**\r\n * Creates an Angle object of \"radians\" radians (float).\r\n * @param radians the angle in radians\r\n */\r\n function Angle(radians) {\r\n this._radians = radians;\r\n if (this._radians < 0.0) {\r\n this._radians += 2.0 * Math.PI;\r\n }\r\n }\r\n /**\r\n * Get value in degrees\r\n * @returns the Angle value in degrees (float)\r\n */\r\n Angle.prototype.degrees = function () {\r\n return (this._radians * 180.0) / Math.PI;\r\n };\r\n /**\r\n * Get value in radians\r\n * @returns the Angle value in radians (float)\r\n */\r\n Angle.prototype.radians = function () {\r\n return this._radians;\r\n };\r\n /**\r\n * Gets a new Angle object valued with the gradient angle, in radians, of the line joining two points\r\n * @param a defines first point as the origin\r\n * @param b defines point\r\n * @returns a new Angle\r\n */\r\n Angle.BetweenTwoPoints = function (a, b) {\r\n var delta = b.subtract(a);\r\n var theta = Math.atan2(delta.y, delta.x);\r\n return new Angle(theta);\r\n };\r\n /**\r\n * Gets a new Angle object from the given float in radians\r\n * @param radians defines the angle value in radians\r\n * @returns a new Angle\r\n */\r\n Angle.FromRadians = function (radians) {\r\n return new Angle(radians);\r\n };\r\n /**\r\n * Gets a new Angle object from the given float in degrees\r\n * @param degrees defines the angle value in degrees\r\n * @returns a new Angle\r\n */\r\n Angle.FromDegrees = function (degrees) {\r\n return new Angle((degrees * Math.PI) / 180.0);\r\n };\r\n return Angle;\r\n}());\r\nexport { Angle };\r\n/**\r\n * This represents an arc in a 2d space.\r\n */\r\nvar Arc2 = /** @class */ (function () {\r\n /**\r\n * Creates an Arc object from the three given points : start, middle and end.\r\n * @param startPoint Defines the start point of the arc\r\n * @param midPoint Defines the midlle point of the arc\r\n * @param endPoint Defines the end point of the arc\r\n */\r\n function Arc2(\r\n /** Defines the start point of the arc */\r\n startPoint, \r\n /** Defines the mid point of the arc */\r\n midPoint, \r\n /** Defines the end point of the arc */\r\n endPoint) {\r\n this.startPoint = startPoint;\r\n this.midPoint = midPoint;\r\n this.endPoint = endPoint;\r\n var temp = Math.pow(midPoint.x, 2) + Math.pow(midPoint.y, 2);\r\n var startToMid = (Math.pow(startPoint.x, 2) + Math.pow(startPoint.y, 2) - temp) / 2;\r\n var midToEnd = (temp - Math.pow(endPoint.x, 2) - Math.pow(endPoint.y, 2)) / 2;\r\n var det = (startPoint.x - midPoint.x) * (midPoint.y - endPoint.y) - (midPoint.x - endPoint.x) * (startPoint.y - midPoint.y);\r\n this.centerPoint = new Vector2((startToMid * (midPoint.y - endPoint.y) - midToEnd * (startPoint.y - midPoint.y)) / det, ((startPoint.x - midPoint.x) * midToEnd - (midPoint.x - endPoint.x) * startToMid) / det);\r\n this.radius = this.centerPoint.subtract(this.startPoint).length();\r\n this.startAngle = Angle.BetweenTwoPoints(this.centerPoint, this.startPoint);\r\n var a1 = this.startAngle.degrees();\r\n var a2 = Angle.BetweenTwoPoints(this.centerPoint, this.midPoint).degrees();\r\n var a3 = Angle.BetweenTwoPoints(this.centerPoint, this.endPoint).degrees();\r\n // angles correction\r\n if (a2 - a1 > +180.0) {\r\n a2 -= 360.0;\r\n }\r\n if (a2 - a1 < -180.0) {\r\n a2 += 360.0;\r\n }\r\n if (a3 - a2 > +180.0) {\r\n a3 -= 360.0;\r\n }\r\n if (a3 - a2 < -180.0) {\r\n a3 += 360.0;\r\n }\r\n this.orientation = a2 - a1 < 0 ? Orientation.CW : Orientation.CCW;\r\n this.angle = Angle.FromDegrees(this.orientation === Orientation.CW ? a1 - a3 : a3 - a1);\r\n }\r\n return Arc2;\r\n}());\r\nexport { Arc2 };\r\n/**\r\n * Represents a 2D path made up of multiple 2D points\r\n */\r\nvar Path2 = /** @class */ (function () {\r\n /**\r\n * Creates a Path2 object from the starting 2D coordinates x and y.\r\n * @param x the starting points x value\r\n * @param y the starting points y value\r\n */\r\n function Path2(x, y) {\r\n this._points = new Array();\r\n this._length = 0.0;\r\n /**\r\n * If the path start and end point are the same\r\n */\r\n this.closed = false;\r\n this._points.push(new Vector2(x, y));\r\n }\r\n /**\r\n * Adds a new segment until the given coordinates (x, y) to the current Path2.\r\n * @param x the added points x value\r\n * @param y the added points y value\r\n * @returns the updated Path2.\r\n */\r\n Path2.prototype.addLineTo = function (x, y) {\r\n if (this.closed) {\r\n return this;\r\n }\r\n var newPoint = new Vector2(x, y);\r\n var previousPoint = this._points[this._points.length - 1];\r\n this._points.push(newPoint);\r\n this._length += newPoint.subtract(previousPoint).length();\r\n return this;\r\n };\r\n /**\r\n * Adds _numberOfSegments_ segments according to the arc definition (middle point coordinates, end point coordinates, the arc start point being the current Path2 last point) to the current Path2.\r\n * @param midX middle point x value\r\n * @param midY middle point y value\r\n * @param endX end point x value\r\n * @param endY end point y value\r\n * @param numberOfSegments (default: 36)\r\n * @returns the updated Path2.\r\n */\r\n Path2.prototype.addArcTo = function (midX, midY, endX, endY, numberOfSegments) {\r\n if (numberOfSegments === void 0) { numberOfSegments = 36; }\r\n if (this.closed) {\r\n return this;\r\n }\r\n var startPoint = this._points[this._points.length - 1];\r\n var midPoint = new Vector2(midX, midY);\r\n var endPoint = new Vector2(endX, endY);\r\n var arc = new Arc2(startPoint, midPoint, endPoint);\r\n var increment = arc.angle.radians() / numberOfSegments;\r\n if (arc.orientation === Orientation.CW) {\r\n increment *= -1;\r\n }\r\n var currentAngle = arc.startAngle.radians() + increment;\r\n for (var i = 0; i < numberOfSegments; i++) {\r\n var x = Math.cos(currentAngle) * arc.radius + arc.centerPoint.x;\r\n var y = Math.sin(currentAngle) * arc.radius + arc.centerPoint.y;\r\n this.addLineTo(x, y);\r\n currentAngle += increment;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Closes the Path2.\r\n * @returns the Path2.\r\n */\r\n Path2.prototype.close = function () {\r\n this.closed = true;\r\n return this;\r\n };\r\n /**\r\n * Gets the sum of the distance between each sequential point in the path\r\n * @returns the Path2 total length (float).\r\n */\r\n Path2.prototype.length = function () {\r\n var result = this._length;\r\n if (this.closed) {\r\n var lastPoint = this._points[this._points.length - 1];\r\n var firstPoint = this._points[0];\r\n result += firstPoint.subtract(lastPoint).length();\r\n }\r\n return result;\r\n };\r\n /**\r\n * Gets the points which construct the path\r\n * @returns the Path2 internal array of points.\r\n */\r\n Path2.prototype.getPoints = function () {\r\n return this._points;\r\n };\r\n /**\r\n * Retreives the point at the distance aways from the starting point\r\n * @param normalizedLengthPosition the length along the path to retreive the point from\r\n * @returns a new Vector2 located at a percentage of the Path2 total length on this path.\r\n */\r\n Path2.prototype.getPointAtLengthPosition = function (normalizedLengthPosition) {\r\n if (normalizedLengthPosition < 0 || normalizedLengthPosition > 1) {\r\n return Vector2.Zero();\r\n }\r\n var lengthPosition = normalizedLengthPosition * this.length();\r\n var previousOffset = 0;\r\n for (var i = 0; i < this._points.length; i++) {\r\n var j = (i + 1) % this._points.length;\r\n var a = this._points[i];\r\n var b = this._points[j];\r\n var bToA = b.subtract(a);\r\n var nextOffset = bToA.length() + previousOffset;\r\n if (lengthPosition >= previousOffset && lengthPosition <= nextOffset) {\r\n var dir = bToA.normalize();\r\n var localOffset = lengthPosition - previousOffset;\r\n return new Vector2(a.x + dir.x * localOffset, a.y + dir.y * localOffset);\r\n }\r\n previousOffset = nextOffset;\r\n }\r\n return Vector2.Zero();\r\n };\r\n /**\r\n * Creates a new path starting from an x and y position\r\n * @param x starting x value\r\n * @param y starting y value\r\n * @returns a new Path2 starting at the coordinates (x, y).\r\n */\r\n Path2.StartingAt = function (x, y) {\r\n return new Path2(x, y);\r\n };\r\n return Path2;\r\n}());\r\nexport { Path2 };\r\n/**\r\n * Represents a 3D path made up of multiple 3D points\r\n */\r\nvar Path3D = /** @class */ (function () {\r\n /**\r\n * new Path3D(path, normal, raw)\r\n * Creates a Path3D. A Path3D is a logical math object, so not a mesh.\r\n * please read the description in the tutorial : https://doc.babylonjs.com/how_to/how_to_use_path3d\r\n * @param path an array of Vector3, the curve axis of the Path3D\r\n * @param firstNormal (options) Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.\r\n * @param raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.\r\n * @param alignTangentsWithPath (optional, default false) : boolean, if true the tangents will be aligned with the path.\r\n */\r\n function Path3D(\r\n /**\r\n * an array of Vector3, the curve axis of the Path3D\r\n */\r\n path, firstNormal, raw, alignTangentsWithPath) {\r\n if (firstNormal === void 0) { firstNormal = null; }\r\n if (alignTangentsWithPath === void 0) { alignTangentsWithPath = false; }\r\n this.path = path;\r\n this._curve = new Array();\r\n this._distances = new Array();\r\n this._tangents = new Array();\r\n this._normals = new Array();\r\n this._binormals = new Array();\r\n // holds interpolated point data\r\n this._pointAtData = {\r\n id: 0,\r\n point: Vector3.Zero(),\r\n previousPointArrayIndex: 0,\r\n position: 0,\r\n subPosition: 0,\r\n interpolateReady: false,\r\n interpolationMatrix: Matrix.Identity(),\r\n };\r\n for (var p = 0; p < path.length; p++) {\r\n this._curve[p] = path[p].clone(); // hard copy\r\n }\r\n this._raw = raw || false;\r\n this._alignTangentsWithPath = alignTangentsWithPath;\r\n this._compute(firstNormal, alignTangentsWithPath);\r\n }\r\n /**\r\n * Returns the Path3D array of successive Vector3 designing its curve.\r\n * @returns the Path3D array of successive Vector3 designing its curve.\r\n */\r\n Path3D.prototype.getCurve = function () {\r\n return this._curve;\r\n };\r\n /**\r\n * Returns the Path3D array of successive Vector3 designing its curve.\r\n * @returns the Path3D array of successive Vector3 designing its curve.\r\n */\r\n Path3D.prototype.getPoints = function () {\r\n return this._curve;\r\n };\r\n /**\r\n * @returns the computed length (float) of the path.\r\n */\r\n Path3D.prototype.length = function () {\r\n return this._distances[this._distances.length - 1];\r\n };\r\n /**\r\n * Returns an array populated with tangent vectors on each Path3D curve point.\r\n * @returns an array populated with tangent vectors on each Path3D curve point.\r\n */\r\n Path3D.prototype.getTangents = function () {\r\n return this._tangents;\r\n };\r\n /**\r\n * Returns an array populated with normal vectors on each Path3D curve point.\r\n * @returns an array populated with normal vectors on each Path3D curve point.\r\n */\r\n Path3D.prototype.getNormals = function () {\r\n return this._normals;\r\n };\r\n /**\r\n * Returns an array populated with binormal vectors on each Path3D curve point.\r\n * @returns an array populated with binormal vectors on each Path3D curve point.\r\n */\r\n Path3D.prototype.getBinormals = function () {\r\n return this._binormals;\r\n };\r\n /**\r\n * Returns an array populated with distances (float) of the i-th point from the first curve point.\r\n * @returns an array populated with distances (float) of the i-th point from the first curve point.\r\n */\r\n Path3D.prototype.getDistances = function () {\r\n return this._distances;\r\n };\r\n /**\r\n * Returns an interpolated point along this path\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @returns a new Vector3 as the point\r\n */\r\n Path3D.prototype.getPointAt = function (position) {\r\n return this._updatePointAtData(position).point;\r\n };\r\n /**\r\n * Returns the tangent vector of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated tangent instead of the tangent of the previous path point.\r\n * @returns a tangent vector corresponding to the interpolated Path3D curve point, if not interpolated, the tangent is taken from the precomputed tangents array.\r\n */\r\n Path3D.prototype.getTangentAt = function (position, interpolated) {\r\n if (interpolated === void 0) { interpolated = false; }\r\n this._updatePointAtData(position, interpolated);\r\n return interpolated ? Vector3.TransformCoordinates(Vector3.Forward(), this._pointAtData.interpolationMatrix) : this._tangents[this._pointAtData.previousPointArrayIndex];\r\n };\r\n /**\r\n * Returns the tangent vector of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated normal instead of the normal of the previous path point.\r\n * @returns a normal vector corresponding to the interpolated Path3D curve point, if not interpolated, the normal is taken from the precomputed normals array.\r\n */\r\n Path3D.prototype.getNormalAt = function (position, interpolated) {\r\n if (interpolated === void 0) { interpolated = false; }\r\n this._updatePointAtData(position, interpolated);\r\n return interpolated ? Vector3.TransformCoordinates(Vector3.Right(), this._pointAtData.interpolationMatrix) : this._normals[this._pointAtData.previousPointArrayIndex];\r\n };\r\n /**\r\n * Returns the binormal vector of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated binormal instead of the binormal of the previous path point.\r\n * @returns a binormal vector corresponding to the interpolated Path3D curve point, if not interpolated, the binormal is taken from the precomputed binormals array.\r\n */\r\n Path3D.prototype.getBinormalAt = function (position, interpolated) {\r\n if (interpolated === void 0) { interpolated = false; }\r\n this._updatePointAtData(position, interpolated);\r\n return interpolated ? Vector3.TransformCoordinates(Vector3.UpReadOnly, this._pointAtData.interpolationMatrix) : this._binormals[this._pointAtData.previousPointArrayIndex];\r\n };\r\n /**\r\n * Returns the distance (float) of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @returns the distance of the interpolated Path3D curve point at the specified position along this path.\r\n */\r\n Path3D.prototype.getDistanceAt = function (position) {\r\n return this.length() * position;\r\n };\r\n /**\r\n * Returns the array index of the previous point of an interpolated point along this path\r\n * @param position the position of the point to interpolate along this path, from 0.0 to 1.0\r\n * @returns the array index\r\n */\r\n Path3D.prototype.getPreviousPointIndexAt = function (position) {\r\n this._updatePointAtData(position);\r\n return this._pointAtData.previousPointArrayIndex;\r\n };\r\n /**\r\n * Returns the position of an interpolated point relative to the two path points it lies between, from 0.0 (point A) to 1.0 (point B)\r\n * @param position the position of the point to interpolate along this path, from 0.0 to 1.0\r\n * @returns the sub position\r\n */\r\n Path3D.prototype.getSubPositionAt = function (position) {\r\n this._updatePointAtData(position);\r\n return this._pointAtData.subPosition;\r\n };\r\n /**\r\n * Returns the position of the closest virtual point on this path to an arbitrary Vector3, from 0.0 to 1.0\r\n * @param target the vector of which to get the closest position to\r\n * @returns the position of the closest virtual point on this path to the target vector\r\n */\r\n Path3D.prototype.getClosestPositionTo = function (target) {\r\n var smallestDistance = Number.MAX_VALUE;\r\n var closestPosition = 0.0;\r\n for (var i = 0; i < this._curve.length - 1; i++) {\r\n var point = this._curve[i + 0];\r\n var tangent = this._curve[i + 1].subtract(point).normalize();\r\n var subLength = this._distances[i + 1] - this._distances[i + 0];\r\n var subPosition = Math.min((Math.max(Vector3.Dot(tangent, target.subtract(point).normalize()), 0.0) * Vector3.Distance(point, target)) / subLength, 1.0);\r\n var distance = Vector3.Distance(point.add(tangent.scale(subPosition * subLength)), target);\r\n if (distance < smallestDistance) {\r\n smallestDistance = distance;\r\n closestPosition = (this._distances[i + 0] + subLength * subPosition) / this.length();\r\n }\r\n }\r\n return closestPosition;\r\n };\r\n /**\r\n * Returns a sub path (slice) of this path\r\n * @param start the position of the fist path point, from 0.0 to 1.0, or a negative value, which will get wrapped around from the end of the path to 0.0 to 1.0 values\r\n * @param end the position of the last path point, from 0.0 to 1.0, or a negative value, which will get wrapped around from the end of the path to 0.0 to 1.0 values\r\n * @returns a sub path (slice) of this path\r\n */\r\n Path3D.prototype.slice = function (start, end) {\r\n if (start === void 0) { start = 0.0; }\r\n if (end === void 0) { end = 1.0; }\r\n if (start < 0.0) {\r\n start = 1 - ((start * -1.0) % 1.0);\r\n }\r\n if (end < 0.0) {\r\n end = 1 - ((end * -1.0) % 1.0);\r\n }\r\n if (start > end) {\r\n var _start = start;\r\n start = end;\r\n end = _start;\r\n }\r\n var curvePoints = this.getCurve();\r\n var startPoint = this.getPointAt(start);\r\n var startIndex = this.getPreviousPointIndexAt(start);\r\n var endPoint = this.getPointAt(end);\r\n var endIndex = this.getPreviousPointIndexAt(end) + 1;\r\n var slicePoints = [];\r\n if (start !== 0.0) {\r\n startIndex++;\r\n slicePoints.push(startPoint);\r\n }\r\n slicePoints.push.apply(slicePoints, curvePoints.slice(startIndex, endIndex));\r\n if (end !== 1.0 || start === 1.0) {\r\n slicePoints.push(endPoint);\r\n }\r\n return new Path3D(slicePoints, this.getNormalAt(start), this._raw, this._alignTangentsWithPath);\r\n };\r\n /**\r\n * Forces the Path3D tangent, normal, binormal and distance recomputation.\r\n * @param path path which all values are copied into the curves points\r\n * @param firstNormal which should be projected onto the curve\r\n * @param alignTangentsWithPath (optional, default false) : boolean, if true the tangents will be aligned with the path\r\n * @returns the same object updated.\r\n */\r\n Path3D.prototype.update = function (path, firstNormal, alignTangentsWithPath) {\r\n if (firstNormal === void 0) { firstNormal = null; }\r\n if (alignTangentsWithPath === void 0) { alignTangentsWithPath = false; }\r\n for (var p = 0; p < path.length; p++) {\r\n this._curve[p].x = path[p].x;\r\n this._curve[p].y = path[p].y;\r\n this._curve[p].z = path[p].z;\r\n }\r\n this._compute(firstNormal, alignTangentsWithPath);\r\n return this;\r\n };\r\n // private function compute() : computes tangents, normals and binormals\r\n Path3D.prototype._compute = function (firstNormal, alignTangentsWithPath) {\r\n if (alignTangentsWithPath === void 0) { alignTangentsWithPath = false; }\r\n var l = this._curve.length;\r\n if (l < 2) {\r\n return;\r\n }\r\n // first and last tangents\r\n this._tangents[0] = this._getFirstNonNullVector(0);\r\n if (!this._raw) {\r\n this._tangents[0].normalize();\r\n }\r\n this._tangents[l - 1] = this._curve[l - 1].subtract(this._curve[l - 2]);\r\n if (!this._raw) {\r\n this._tangents[l - 1].normalize();\r\n }\r\n // normals and binormals at first point : arbitrary vector with _normalVector()\r\n var tg0 = this._tangents[0];\r\n var pp0 = this._normalVector(tg0, firstNormal);\r\n this._normals[0] = pp0;\r\n if (!this._raw) {\r\n this._normals[0].normalize();\r\n }\r\n this._binormals[0] = Vector3.Cross(tg0, this._normals[0]);\r\n if (!this._raw) {\r\n this._binormals[0].normalize();\r\n }\r\n this._distances[0] = 0.0;\r\n // normals and binormals : next points\r\n var prev; // previous vector (segment)\r\n var cur; // current vector (segment)\r\n var curTang; // current tangent\r\n // previous normal\r\n var prevNor; // previous normal\r\n var prevBinor; // previous binormal\r\n for (var i = 1; i < l; i++) {\r\n // tangents\r\n prev = this._getLastNonNullVector(i);\r\n if (i < l - 1) {\r\n cur = this._getFirstNonNullVector(i);\r\n this._tangents[i] = alignTangentsWithPath ? cur : prev.add(cur);\r\n this._tangents[i].normalize();\r\n }\r\n this._distances[i] = this._distances[i - 1] + this._curve[i].subtract(this._curve[i - 1]).length();\r\n // normals and binormals\r\n // http://www.cs.cmu.edu/afs/andrew/scs/cs/15-462/web/old/asst2camera.html\r\n curTang = this._tangents[i];\r\n prevBinor = this._binormals[i - 1];\r\n this._normals[i] = Vector3.Cross(prevBinor, curTang);\r\n if (!this._raw) {\r\n if (this._normals[i].length() === 0) {\r\n prevNor = this._normals[i - 1];\r\n this._normals[i] = prevNor.clone();\r\n }\r\n else {\r\n this._normals[i].normalize();\r\n }\r\n }\r\n this._binormals[i] = Vector3.Cross(curTang, this._normals[i]);\r\n if (!this._raw) {\r\n this._binormals[i].normalize();\r\n }\r\n }\r\n this._pointAtData.id = NaN;\r\n };\r\n // private function getFirstNonNullVector(index)\r\n // returns the first non null vector from index : curve[index + N].subtract(curve[index])\r\n Path3D.prototype._getFirstNonNullVector = function (index) {\r\n var i = 1;\r\n var nNVector = this._curve[index + i].subtract(this._curve[index]);\r\n while (nNVector.length() === 0 && index + i + 1 < this._curve.length) {\r\n i++;\r\n nNVector = this._curve[index + i].subtract(this._curve[index]);\r\n }\r\n return nNVector;\r\n };\r\n // private function getLastNonNullVector(index)\r\n // returns the last non null vector from index : curve[index].subtract(curve[index - N])\r\n Path3D.prototype._getLastNonNullVector = function (index) {\r\n var i = 1;\r\n var nLVector = this._curve[index].subtract(this._curve[index - i]);\r\n while (nLVector.length() === 0 && index > i + 1) {\r\n i++;\r\n nLVector = this._curve[index].subtract(this._curve[index - i]);\r\n }\r\n return nLVector;\r\n };\r\n // private function normalVector(v0, vt, va) :\r\n // returns an arbitrary point in the plane defined by the point v0 and the vector vt orthogonal to this plane\r\n // if va is passed, it returns the va projection on the plane orthogonal to vt at the point v0\r\n Path3D.prototype._normalVector = function (vt, va) {\r\n var normal0;\r\n var tgl = vt.length();\r\n if (tgl === 0.0) {\r\n tgl = 1.0;\r\n }\r\n if (va === undefined || va === null) {\r\n var point;\r\n if (!Scalar.WithinEpsilon(Math.abs(vt.y) / tgl, 1.0, Epsilon)) {\r\n // search for a point in the plane\r\n point = new Vector3(0.0, -1.0, 0.0);\r\n }\r\n else if (!Scalar.WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, Epsilon)) {\r\n point = new Vector3(1.0, 0.0, 0.0);\r\n }\r\n else if (!Scalar.WithinEpsilon(Math.abs(vt.z) / tgl, 1.0, Epsilon)) {\r\n point = new Vector3(0.0, 0.0, 1.0);\r\n }\r\n else {\r\n point = Vector3.Zero();\r\n }\r\n normal0 = Vector3.Cross(vt, point);\r\n }\r\n else {\r\n normal0 = Vector3.Cross(vt, va);\r\n Vector3.CrossToRef(normal0, vt, normal0);\r\n }\r\n normal0.normalize();\r\n return normal0;\r\n };\r\n /**\r\n * Updates the point at data for an interpolated point along this curve\r\n * @param position the position of the point along this curve, from 0.0 to 1.0\r\n * @interpolateTNB wether to compute the interpolated tangent, normal and binormal\r\n * @returns the (updated) point at data\r\n */\r\n Path3D.prototype._updatePointAtData = function (position, interpolateTNB) {\r\n if (interpolateTNB === void 0) { interpolateTNB = false; }\r\n // set an id for caching the result\r\n if (this._pointAtData.id === position) {\r\n if (!this._pointAtData.interpolateReady) {\r\n this._updateInterpolationMatrix();\r\n }\r\n return this._pointAtData;\r\n }\r\n else {\r\n this._pointAtData.id = position;\r\n }\r\n var curvePoints = this.getPoints();\r\n // clamp position between 0.0 and 1.0\r\n if (position <= 0.0) {\r\n return this._setPointAtData(0.0, 0.0, curvePoints[0], 0, interpolateTNB);\r\n }\r\n else if (position >= 1.0) {\r\n return this._setPointAtData(1.0, 1.0, curvePoints[curvePoints.length - 1], curvePoints.length - 1, interpolateTNB);\r\n }\r\n var previousPoint = curvePoints[0];\r\n var currentPoint;\r\n var currentLength = 0.0;\r\n var targetLength = position * this.length();\r\n for (var i = 1; i < curvePoints.length; i++) {\r\n currentPoint = curvePoints[i];\r\n var distance = Vector3.Distance(previousPoint, currentPoint);\r\n currentLength += distance;\r\n if (currentLength === targetLength) {\r\n return this._setPointAtData(position, 1.0, currentPoint, i, interpolateTNB);\r\n }\r\n else if (currentLength > targetLength) {\r\n var toLength = currentLength - targetLength;\r\n var diff = toLength / distance;\r\n var dir = previousPoint.subtract(currentPoint);\r\n var point = currentPoint.add(dir.scaleInPlace(diff));\r\n return this._setPointAtData(position, 1 - diff, point, i - 1, interpolateTNB);\r\n }\r\n previousPoint = currentPoint;\r\n }\r\n return this._pointAtData;\r\n };\r\n /**\r\n * Updates the point at data from the specified parameters\r\n * @param position where along the path the interpolated point is, from 0.0 to 1.0\r\n * @param point the interpolated point\r\n * @param parentIndex the index of an existing curve point that is on, or else positionally the first behind, the interpolated point\r\n */\r\n Path3D.prototype._setPointAtData = function (position, subPosition, point, parentIndex, interpolateTNB) {\r\n this._pointAtData.point = point;\r\n this._pointAtData.position = position;\r\n this._pointAtData.subPosition = subPosition;\r\n this._pointAtData.previousPointArrayIndex = parentIndex;\r\n this._pointAtData.interpolateReady = interpolateTNB;\r\n if (interpolateTNB) {\r\n this._updateInterpolationMatrix();\r\n }\r\n return this._pointAtData;\r\n };\r\n /**\r\n * Updates the point at interpolation matrix for the tangents, normals and binormals\r\n */\r\n Path3D.prototype._updateInterpolationMatrix = function () {\r\n this._pointAtData.interpolationMatrix = Matrix.Identity();\r\n var parentIndex = this._pointAtData.previousPointArrayIndex;\r\n if (parentIndex !== this._tangents.length - 1) {\r\n var index = parentIndex + 1;\r\n var tangentFrom = this._tangents[parentIndex].clone();\r\n var normalFrom = this._normals[parentIndex].clone();\r\n var binormalFrom = this._binormals[parentIndex].clone();\r\n var tangentTo = this._tangents[index].clone();\r\n var normalTo = this._normals[index].clone();\r\n var binormalTo = this._binormals[index].clone();\r\n var quatFrom = Quaternion.RotationQuaternionFromAxis(normalFrom, binormalFrom, tangentFrom);\r\n var quatTo = Quaternion.RotationQuaternionFromAxis(normalTo, binormalTo, tangentTo);\r\n var quatAt = Quaternion.Slerp(quatFrom, quatTo, this._pointAtData.subPosition);\r\n quatAt.toRotationMatrix(this._pointAtData.interpolationMatrix);\r\n }\r\n };\r\n return Path3D;\r\n}());\r\nexport { Path3D };\r\n/**\r\n * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.\r\n * A Curve3 is designed from a series of successive Vector3.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_curve3\r\n */\r\nvar Curve3 = /** @class */ (function () {\r\n /**\r\n * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.\r\n * A Curve3 is designed from a series of successive Vector3.\r\n * Tuto : https://doc.babylonjs.com/how_to/how_to_use_curve3#curve3-object\r\n * @param points points which make up the curve\r\n */\r\n function Curve3(points) {\r\n this._length = 0.0;\r\n this._points = points;\r\n this._length = this._computeLength(points);\r\n }\r\n /**\r\n * Returns a Curve3 object along a Quadratic Bezier curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#quadratic-bezier-curve\r\n * @param v0 (Vector3) the origin point of the Quadratic Bezier\r\n * @param v1 (Vector3) the control point\r\n * @param v2 (Vector3) the end point of the Quadratic Bezier\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateQuadraticBezier = function (v0, v1, v2, nbPoints) {\r\n nbPoints = nbPoints > 2 ? nbPoints : 3;\r\n var bez = new Array();\r\n var equation = function (t, val0, val1, val2) {\r\n var res = (1.0 - t) * (1.0 - t) * val0 + 2.0 * t * (1.0 - t) * val1 + t * t * val2;\r\n return res;\r\n };\r\n for (var i = 0; i <= nbPoints; i++) {\r\n bez.push(new Vector3(equation(i / nbPoints, v0.x, v1.x, v2.x), equation(i / nbPoints, v0.y, v1.y, v2.y), equation(i / nbPoints, v0.z, v1.z, v2.z)));\r\n }\r\n return new Curve3(bez);\r\n };\r\n /**\r\n * Returns a Curve3 object along a Cubic Bezier curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#cubic-bezier-curve\r\n * @param v0 (Vector3) the origin point of the Cubic Bezier\r\n * @param v1 (Vector3) the first control point\r\n * @param v2 (Vector3) the second control point\r\n * @param v3 (Vector3) the end point of the Cubic Bezier\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateCubicBezier = function (v0, v1, v2, v3, nbPoints) {\r\n nbPoints = nbPoints > 3 ? nbPoints : 4;\r\n var bez = new Array();\r\n var equation = function (t, val0, val1, val2, val3) {\r\n var res = (1.0 - t) * (1.0 - t) * (1.0 - t) * val0 + 3.0 * t * (1.0 - t) * (1.0 - t) * val1 + 3.0 * t * t * (1.0 - t) * val2 + t * t * t * val3;\r\n return res;\r\n };\r\n for (var i = 0; i <= nbPoints; i++) {\r\n bez.push(new Vector3(equation(i / nbPoints, v0.x, v1.x, v2.x, v3.x), equation(i / nbPoints, v0.y, v1.y, v2.y, v3.y), equation(i / nbPoints, v0.z, v1.z, v2.z, v3.z)));\r\n }\r\n return new Curve3(bez);\r\n };\r\n /**\r\n * Returns a Curve3 object along a Hermite Spline curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#hermite-spline\r\n * @param p1 (Vector3) the origin point of the Hermite Spline\r\n * @param t1 (Vector3) the tangent vector at the origin point\r\n * @param p2 (Vector3) the end point of the Hermite Spline\r\n * @param t2 (Vector3) the tangent vector at the end point\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateHermiteSpline = function (p1, t1, p2, t2, nbPoints) {\r\n var hermite = new Array();\r\n var step = 1.0 / nbPoints;\r\n for (var i = 0; i <= nbPoints; i++) {\r\n hermite.push(Vector3.Hermite(p1, t1, p2, t2, i * step));\r\n }\r\n return new Curve3(hermite);\r\n };\r\n /**\r\n * Returns a Curve3 object along a CatmullRom Spline curve :\r\n * @param points (array of Vector3) the points the spline must pass through. At least, four points required\r\n * @param nbPoints (integer) the wanted number of points between each curve control points\r\n * @param closed (boolean) optional with default false, when true forms a closed loop from the points\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateCatmullRomSpline = function (points, nbPoints, closed) {\r\n var catmullRom = new Array();\r\n var step = 1.0 / nbPoints;\r\n var amount = 0.0;\r\n if (closed) {\r\n var pointsCount = points.length;\r\n for (var i = 0; i < pointsCount; i++) {\r\n amount = 0;\r\n for (var c = 0; c < nbPoints; c++) {\r\n catmullRom.push(Vector3.CatmullRom(points[i % pointsCount], points[(i + 1) % pointsCount], points[(i + 2) % pointsCount], points[(i + 3) % pointsCount], amount));\r\n amount += step;\r\n }\r\n }\r\n catmullRom.push(catmullRom[0]);\r\n }\r\n else {\r\n var totalPoints = new Array();\r\n totalPoints.push(points[0].clone());\r\n Array.prototype.push.apply(totalPoints, points);\r\n totalPoints.push(points[points.length - 1].clone());\r\n for (var i = 0; i < totalPoints.length - 3; i++) {\r\n amount = 0;\r\n for (var c = 0; c < nbPoints; c++) {\r\n catmullRom.push(Vector3.CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\r\n amount += step;\r\n }\r\n }\r\n i--;\r\n catmullRom.push(Vector3.CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\r\n }\r\n return new Curve3(catmullRom);\r\n };\r\n /**\r\n * @returns the Curve3 stored array of successive Vector3\r\n */\r\n Curve3.prototype.getPoints = function () {\r\n return this._points;\r\n };\r\n /**\r\n * @returns the computed length (float) of the curve.\r\n */\r\n Curve3.prototype.length = function () {\r\n return this._length;\r\n };\r\n /**\r\n * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);\r\n * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.\r\n * curveA and curveB keep unchanged.\r\n * @param curve the curve to continue from this curve\r\n * @returns the newly constructed curve\r\n */\r\n Curve3.prototype.continue = function (curve) {\r\n var lastPoint = this._points[this._points.length - 1];\r\n var continuedPoints = this._points.slice();\r\n var curvePoints = curve.getPoints();\r\n for (var i = 1; i < curvePoints.length; i++) {\r\n continuedPoints.push(curvePoints[i].subtract(curvePoints[0]).add(lastPoint));\r\n }\r\n var continuedCurve = new Curve3(continuedPoints);\r\n return continuedCurve;\r\n };\r\n Curve3.prototype._computeLength = function (path) {\r\n var l = 0;\r\n for (var i = 1; i < path.length; i++) {\r\n l += path[i].subtract(path[i - 1]).length();\r\n }\r\n return l;\r\n };\r\n return Curve3;\r\n}());\r\nexport { Curve3 };\r\n//# sourceMappingURL=math.path.js.map","import { Vector3, Matrix } from './math.vector';\r\n/**\r\n * Represents a plane by the equation ax + by + cz + d = 0\r\n */\r\nvar Plane = /** @class */ (function () {\r\n /**\r\n * Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0\r\n * @param a a component of the plane\r\n * @param b b component of the plane\r\n * @param c c component of the plane\r\n * @param d d component of the plane\r\n */\r\n function Plane(a, b, c, d) {\r\n this.normal = new Vector3(a, b, c);\r\n this.d = d;\r\n }\r\n /**\r\n * @returns the plane coordinates as a new array of 4 elements [a, b, c, d].\r\n */\r\n Plane.prototype.asArray = function () {\r\n return [this.normal.x, this.normal.y, this.normal.z, this.d];\r\n };\r\n // Methods\r\n /**\r\n * @returns a new plane copied from the current Plane.\r\n */\r\n Plane.prototype.clone = function () {\r\n return new Plane(this.normal.x, this.normal.y, this.normal.z, this.d);\r\n };\r\n /**\r\n * @returns the string \"Plane\".\r\n */\r\n Plane.prototype.getClassName = function () {\r\n return \"Plane\";\r\n };\r\n /**\r\n * @returns the Plane hash code.\r\n */\r\n Plane.prototype.getHashCode = function () {\r\n var hash = this.normal.getHashCode();\r\n hash = (hash * 397) ^ (this.d | 0);\r\n return hash;\r\n };\r\n /**\r\n * Normalize the current Plane in place.\r\n * @returns the updated Plane.\r\n */\r\n Plane.prototype.normalize = function () {\r\n var norm = (Math.sqrt((this.normal.x * this.normal.x) + (this.normal.y * this.normal.y) + (this.normal.z * this.normal.z)));\r\n var magnitude = 0.0;\r\n if (norm !== 0) {\r\n magnitude = 1.0 / norm;\r\n }\r\n this.normal.x *= magnitude;\r\n this.normal.y *= magnitude;\r\n this.normal.z *= magnitude;\r\n this.d *= magnitude;\r\n return this;\r\n };\r\n /**\r\n * Applies a transformation the plane and returns the result\r\n * @param transformation the transformation matrix to be applied to the plane\r\n * @returns a new Plane as the result of the transformation of the current Plane by the given matrix.\r\n */\r\n Plane.prototype.transform = function (transformation) {\r\n var invertedMatrix = Plane._TmpMatrix;\r\n transformation.invertToRef(invertedMatrix);\r\n var m = invertedMatrix.m;\r\n var x = this.normal.x;\r\n var y = this.normal.y;\r\n var z = this.normal.z;\r\n var d = this.d;\r\n var normalX = x * m[0] + y * m[1] + z * m[2] + d * m[3];\r\n var normalY = x * m[4] + y * m[5] + z * m[6] + d * m[7];\r\n var normalZ = x * m[8] + y * m[9] + z * m[10] + d * m[11];\r\n var finalD = x * m[12] + y * m[13] + z * m[14] + d * m[15];\r\n return new Plane(normalX, normalY, normalZ, finalD);\r\n };\r\n /**\r\n * Compute the dot product between the point and the plane normal\r\n * @param point point to calculate the dot product with\r\n * @returns the dot product (float) of the point coordinates and the plane normal.\r\n */\r\n Plane.prototype.dotCoordinate = function (point) {\r\n return ((((this.normal.x * point.x) + (this.normal.y * point.y)) + (this.normal.z * point.z)) + this.d);\r\n };\r\n /**\r\n * Updates the current Plane from the plane defined by the three given points.\r\n * @param point1 one of the points used to contruct the plane\r\n * @param point2 one of the points used to contruct the plane\r\n * @param point3 one of the points used to contruct the plane\r\n * @returns the updated Plane.\r\n */\r\n Plane.prototype.copyFromPoints = function (point1, point2, point3) {\r\n var x1 = point2.x - point1.x;\r\n var y1 = point2.y - point1.y;\r\n var z1 = point2.z - point1.z;\r\n var x2 = point3.x - point1.x;\r\n var y2 = point3.y - point1.y;\r\n var z2 = point3.z - point1.z;\r\n var yz = (y1 * z2) - (z1 * y2);\r\n var xz = (z1 * x2) - (x1 * z2);\r\n var xy = (x1 * y2) - (y1 * x2);\r\n var pyth = (Math.sqrt((yz * yz) + (xz * xz) + (xy * xy)));\r\n var invPyth;\r\n if (pyth !== 0) {\r\n invPyth = 1.0 / pyth;\r\n }\r\n else {\r\n invPyth = 0.0;\r\n }\r\n this.normal.x = yz * invPyth;\r\n this.normal.y = xz * invPyth;\r\n this.normal.z = xy * invPyth;\r\n this.d = -((this.normal.x * point1.x) + (this.normal.y * point1.y) + (this.normal.z * point1.z));\r\n return this;\r\n };\r\n /**\r\n * Checks if the plane is facing a given direction (meaning if the plane's normal is pointing in the opposite direction of the given vector).\r\n * Note that for this function to work as expected you should make sure that:\r\n * - direction and the plane normal are normalized\r\n * - epsilon is a number just bigger than -1, something like -0.99 for eg\r\n * @param direction the direction to check if the plane is facing\r\n * @param epsilon value the dot product is compared against (returns true if dot <= epsilon)\r\n * @returns True if the plane is facing the given direction\r\n */\r\n Plane.prototype.isFrontFacingTo = function (direction, epsilon) {\r\n var dot = Vector3.Dot(this.normal, direction);\r\n return (dot <= epsilon);\r\n };\r\n /**\r\n * Calculates the distance to a point\r\n * @param point point to calculate distance to\r\n * @returns the signed distance (float) from the given point to the Plane.\r\n */\r\n Plane.prototype.signedDistanceTo = function (point) {\r\n return Vector3.Dot(point, this.normal) + this.d;\r\n };\r\n // Statics\r\n /**\r\n * Creates a plane from an array\r\n * @param array the array to create a plane from\r\n * @returns a new Plane from the given array.\r\n */\r\n Plane.FromArray = function (array) {\r\n return new Plane(array[0], array[1], array[2], array[3]);\r\n };\r\n /**\r\n * Creates a plane from three points\r\n * @param point1 point used to create the plane\r\n * @param point2 point used to create the plane\r\n * @param point3 point used to create the plane\r\n * @returns a new Plane defined by the three given points.\r\n */\r\n Plane.FromPoints = function (point1, point2, point3) {\r\n var result = new Plane(0.0, 0.0, 0.0, 0.0);\r\n result.copyFromPoints(point1, point2, point3);\r\n return result;\r\n };\r\n /**\r\n * Creates a plane from an origin point and a normal\r\n * @param origin origin of the plane to be constructed\r\n * @param normal normal of the plane to be constructed\r\n * @returns a new Plane the normal vector to this plane at the given origin point.\r\n * Note : the vector \"normal\" is updated because normalized.\r\n */\r\n Plane.FromPositionAndNormal = function (origin, normal) {\r\n var result = new Plane(0.0, 0.0, 0.0, 0.0);\r\n normal.normalize();\r\n result.normal = normal;\r\n result.d = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);\r\n return result;\r\n };\r\n /**\r\n * Calculates the distance from a plane and a point\r\n * @param origin origin of the plane to be constructed\r\n * @param normal normal of the plane to be constructed\r\n * @param point point to calculate distance to\r\n * @returns the signed distance between the plane defined by the normal vector at the \"origin\"\" point and the given other point.\r\n */\r\n Plane.SignedDistanceToPlaneFromPositionAndNormal = function (origin, normal, point) {\r\n var d = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);\r\n return Vector3.Dot(point, normal) + d;\r\n };\r\n Plane._TmpMatrix = Matrix.Identity();\r\n return Plane;\r\n}());\r\nexport { Plane };\r\n//# sourceMappingURL=math.plane.js.map","/**\r\n * Scalar computation library\r\n */\r\nvar Scalar = /** @class */ (function () {\r\n function Scalar() {\r\n }\r\n /**\r\n * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)\r\n * @param a number\r\n * @param b number\r\n * @param epsilon (default = 1.401298E-45)\r\n * @returns true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)\r\n */\r\n Scalar.WithinEpsilon = function (a, b, epsilon) {\r\n if (epsilon === void 0) { epsilon = 1.401298E-45; }\r\n var num = a - b;\r\n return -epsilon <= num && num <= epsilon;\r\n };\r\n /**\r\n * Returns a string : the upper case translation of the number i to hexadecimal.\r\n * @param i number\r\n * @returns the upper case translation of the number i to hexadecimal.\r\n */\r\n Scalar.ToHex = function (i) {\r\n var str = i.toString(16);\r\n if (i <= 15) {\r\n return (\"0\" + str).toUpperCase();\r\n }\r\n return str.toUpperCase();\r\n };\r\n /**\r\n * Returns -1 if value is negative and +1 is value is positive.\r\n * @param value the value\r\n * @returns the value itself if it's equal to zero.\r\n */\r\n Scalar.Sign = function (value) {\r\n value = +value; // convert to a number\r\n if (value === 0 || isNaN(value)) {\r\n return value;\r\n }\r\n return value > 0 ? 1 : -1;\r\n };\r\n /**\r\n * Returns the value itself if it's between min and max.\r\n * Returns min if the value is lower than min.\r\n * Returns max if the value is greater than max.\r\n * @param value the value to clmap\r\n * @param min the min value to clamp to (default: 0)\r\n * @param max the max value to clamp to (default: 1)\r\n * @returns the clamped value\r\n */\r\n Scalar.Clamp = function (value, min, max) {\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 1; }\r\n return Math.min(max, Math.max(min, value));\r\n };\r\n /**\r\n * the log2 of value.\r\n * @param value the value to compute log2 of\r\n * @returns the log2 of value.\r\n */\r\n Scalar.Log2 = function (value) {\r\n return Math.log(value) * Math.LOG2E;\r\n };\r\n /**\r\n * Loops the value, so that it is never larger than length and never smaller than 0.\r\n *\r\n * This is similar to the modulo operator but it works with floating point numbers.\r\n * For example, using 3.0 for t and 2.5 for length, the result would be 0.5.\r\n * With t = 5 and length = 2.5, the result would be 0.0.\r\n * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator\r\n * @param value the value\r\n * @param length the length\r\n * @returns the looped value\r\n */\r\n Scalar.Repeat = function (value, length) {\r\n return value - Math.floor(value / length) * length;\r\n };\r\n /**\r\n * Normalize the value between 0.0 and 1.0 using min and max values\r\n * @param value value to normalize\r\n * @param min max to normalize between\r\n * @param max min to normalize between\r\n * @returns the normalized value\r\n */\r\n Scalar.Normalize = function (value, min, max) {\r\n return (value - min) / (max - min);\r\n };\r\n /**\r\n * Denormalize the value from 0.0 and 1.0 using min and max values\r\n * @param normalized value to denormalize\r\n * @param min max to denormalize between\r\n * @param max min to denormalize between\r\n * @returns the denormalized value\r\n */\r\n Scalar.Denormalize = function (normalized, min, max) {\r\n return (normalized * (max - min) + min);\r\n };\r\n /**\r\n * Calculates the shortest difference between two given angles given in degrees.\r\n * @param current current angle in degrees\r\n * @param target target angle in degrees\r\n * @returns the delta\r\n */\r\n Scalar.DeltaAngle = function (current, target) {\r\n var num = Scalar.Repeat(target - current, 360.0);\r\n if (num > 180.0) {\r\n num -= 360.0;\r\n }\r\n return num;\r\n };\r\n /**\r\n * PingPongs the value t, so that it is never larger than length and never smaller than 0.\r\n * @param tx value\r\n * @param length length\r\n * @returns The returned value will move back and forth between 0 and length\r\n */\r\n Scalar.PingPong = function (tx, length) {\r\n var t = Scalar.Repeat(tx, length * 2.0);\r\n return length - Math.abs(t - length);\r\n };\r\n /**\r\n * Interpolates between min and max with smoothing at the limits.\r\n *\r\n * This function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up\r\n * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.\r\n * @param from from\r\n * @param to to\r\n * @param tx value\r\n * @returns the smooth stepped value\r\n */\r\n Scalar.SmoothStep = function (from, to, tx) {\r\n var t = Scalar.Clamp(tx);\r\n t = -2.0 * t * t * t + 3.0 * t * t;\r\n return to * t + from * (1.0 - t);\r\n };\r\n /**\r\n * Moves a value current towards target.\r\n *\r\n * This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta.\r\n * Negative values of maxDelta pushes the value away from target.\r\n * @param current current value\r\n * @param target target value\r\n * @param maxDelta max distance to move\r\n * @returns resulting value\r\n */\r\n Scalar.MoveTowards = function (current, target, maxDelta) {\r\n var result = 0;\r\n if (Math.abs(target - current) <= maxDelta) {\r\n result = target;\r\n }\r\n else {\r\n result = current + Scalar.Sign(target - current) * maxDelta;\r\n }\r\n return result;\r\n };\r\n /**\r\n * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.\r\n *\r\n * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta\r\n * are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.\r\n * @param current current value\r\n * @param target target value\r\n * @param maxDelta max distance to move\r\n * @returns resulting angle\r\n */\r\n Scalar.MoveTowardsAngle = function (current, target, maxDelta) {\r\n var num = Scalar.DeltaAngle(current, target);\r\n var result = 0;\r\n if (-maxDelta < num && num < maxDelta) {\r\n result = target;\r\n }\r\n else {\r\n target = current + num;\r\n result = Scalar.MoveTowards(current, target, maxDelta);\r\n }\r\n return result;\r\n };\r\n /**\r\n * Creates a new scalar with values linearly interpolated of \"amount\" between the start scalar and the end scalar.\r\n * @param start start value\r\n * @param end target value\r\n * @param amount amount to lerp between\r\n * @returns the lerped value\r\n */\r\n Scalar.Lerp = function (start, end, amount) {\r\n return start + ((end - start) * amount);\r\n };\r\n /**\r\n * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.\r\n * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.\r\n * @param start start value\r\n * @param end target value\r\n * @param amount amount to lerp between\r\n * @returns the lerped value\r\n */\r\n Scalar.LerpAngle = function (start, end, amount) {\r\n var num = Scalar.Repeat(end - start, 360.0);\r\n if (num > 180.0) {\r\n num -= 360.0;\r\n }\r\n return start + num * Scalar.Clamp(amount);\r\n };\r\n /**\r\n * Calculates the linear parameter t that produces the interpolant value within the range [a, b].\r\n * @param a start value\r\n * @param b target value\r\n * @param value value between a and b\r\n * @returns the inverseLerp value\r\n */\r\n Scalar.InverseLerp = function (a, b, value) {\r\n var result = 0;\r\n if (a != b) {\r\n result = Scalar.Clamp((value - a) / (b - a));\r\n }\r\n else {\r\n result = 0.0;\r\n }\r\n return result;\r\n };\r\n /**\r\n * Returns a new scalar located for \"amount\" (float) on the Hermite spline defined by the scalars \"value1\", \"value3\", \"tangent1\", \"tangent2\".\r\n * @see http://mathworld.wolfram.com/HermitePolynomial.html\r\n * @param value1 spline value\r\n * @param tangent1 spline value\r\n * @param value2 spline value\r\n * @param tangent2 spline value\r\n * @param amount input value\r\n * @returns hermite result\r\n */\r\n Scalar.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n return (((value1 * part1) + (value2 * part2)) + (tangent1 * part3)) + (tangent2 * part4);\r\n };\r\n /**\r\n * Returns a random float number between and min and max values\r\n * @param min min value of random\r\n * @param max max value of random\r\n * @returns random value\r\n */\r\n Scalar.RandomRange = function (min, max) {\r\n if (min === max) {\r\n return min;\r\n }\r\n return ((Math.random() * (max - min)) + min);\r\n };\r\n /**\r\n * This function returns percentage of a number in a given range.\r\n *\r\n * RangeToPercent(40,20,60) will return 0.5 (50%)\r\n * RangeToPercent(34,0,100) will return 0.34 (34%)\r\n * @param number to convert to percentage\r\n * @param min min range\r\n * @param max max range\r\n * @returns the percentage\r\n */\r\n Scalar.RangeToPercent = function (number, min, max) {\r\n return ((number - min) / (max - min));\r\n };\r\n /**\r\n * This function returns number that corresponds to the percentage in a given range.\r\n *\r\n * PercentToRange(0.34,0,100) will return 34.\r\n * @param percent to convert to number\r\n * @param min min range\r\n * @param max max range\r\n * @returns the number\r\n */\r\n Scalar.PercentToRange = function (percent, min, max) {\r\n return ((max - min) * percent + min);\r\n };\r\n /**\r\n * Returns the angle converted to equivalent value between -Math.PI and Math.PI radians.\r\n * @param angle The angle to normalize in radian.\r\n * @return The converted angle.\r\n */\r\n Scalar.NormalizeRadians = function (angle) {\r\n // More precise but slower version kept for reference.\r\n // angle = angle % Tools.TwoPi;\r\n // angle = (angle + Tools.TwoPi) % Tools.TwoPi;\r\n //if (angle > Math.PI) {\r\n //\tangle -= Tools.TwoPi;\r\n //}\r\n angle -= (Scalar.TwoPi * Math.floor((angle + Math.PI) / Scalar.TwoPi));\r\n return angle;\r\n };\r\n /**\r\n * Two pi constants convenient for computation.\r\n */\r\n Scalar.TwoPi = Math.PI * 2;\r\n return Scalar;\r\n}());\r\nexport { Scalar };\r\n//# sourceMappingURL=math.scalar.js.map","/**\r\n * Size containing widht and height\r\n */\r\nvar Size = /** @class */ (function () {\r\n /**\r\n * Creates a Size object from the given width and height (floats).\r\n * @param width width of the new size\r\n * @param height height of the new size\r\n */\r\n function Size(width, height) {\r\n this.width = width;\r\n this.height = height;\r\n }\r\n /**\r\n * Returns a string with the Size width and height\r\n * @returns a string with the Size width and height\r\n */\r\n Size.prototype.toString = function () {\r\n return \"{W: \" + this.width + \", H: \" + this.height + \"}\";\r\n };\r\n /**\r\n * \"Size\"\r\n * @returns the string \"Size\"\r\n */\r\n Size.prototype.getClassName = function () {\r\n return \"Size\";\r\n };\r\n /**\r\n * Returns the Size hash code.\r\n * @returns a hash code for a unique width and height\r\n */\r\n Size.prototype.getHashCode = function () {\r\n var hash = this.width | 0;\r\n hash = (hash * 397) ^ (this.height | 0);\r\n return hash;\r\n };\r\n /**\r\n * Updates the current size from the given one.\r\n * @param src the given size\r\n */\r\n Size.prototype.copyFrom = function (src) {\r\n this.width = src.width;\r\n this.height = src.height;\r\n };\r\n /**\r\n * Updates in place the current Size from the given floats.\r\n * @param width width of the new size\r\n * @param height height of the new size\r\n * @returns the updated Size.\r\n */\r\n Size.prototype.copyFromFloats = function (width, height) {\r\n this.width = width;\r\n this.height = height;\r\n return this;\r\n };\r\n /**\r\n * Updates in place the current Size from the given floats.\r\n * @param width width to set\r\n * @param height height to set\r\n * @returns the updated Size.\r\n */\r\n Size.prototype.set = function (width, height) {\r\n return this.copyFromFloats(width, height);\r\n };\r\n /**\r\n * Multiplies the width and height by numbers\r\n * @param w factor to multiple the width by\r\n * @param h factor to multiple the height by\r\n * @returns a new Size set with the multiplication result of the current Size and the given floats.\r\n */\r\n Size.prototype.multiplyByFloats = function (w, h) {\r\n return new Size(this.width * w, this.height * h);\r\n };\r\n /**\r\n * Clones the size\r\n * @returns a new Size copied from the given one.\r\n */\r\n Size.prototype.clone = function () {\r\n return new Size(this.width, this.height);\r\n };\r\n /**\r\n * True if the current Size and the given one width and height are strictly equal.\r\n * @param other the other size to compare against\r\n * @returns True if the current Size and the given one width and height are strictly equal.\r\n */\r\n Size.prototype.equals = function (other) {\r\n if (!other) {\r\n return false;\r\n }\r\n return (this.width === other.width) && (this.height === other.height);\r\n };\r\n Object.defineProperty(Size.prototype, \"surface\", {\r\n /**\r\n * The surface of the Size : width * height (float).\r\n */\r\n get: function () {\r\n return this.width * this.height;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Create a new size of zero\r\n * @returns a new Size set to (0.0, 0.0)\r\n */\r\n Size.Zero = function () {\r\n return new Size(0.0, 0.0);\r\n };\r\n /**\r\n * Sums the width and height of two sizes\r\n * @param otherSize size to add to this size\r\n * @returns a new Size set as the addition result of the current Size and the given one.\r\n */\r\n Size.prototype.add = function (otherSize) {\r\n var r = new Size(this.width + otherSize.width, this.height + otherSize.height);\r\n return r;\r\n };\r\n /**\r\n * Subtracts the width and height of two\r\n * @param otherSize size to subtract to this size\r\n * @returns a new Size set as the subtraction result of the given one from the current Size.\r\n */\r\n Size.prototype.subtract = function (otherSize) {\r\n var r = new Size(this.width - otherSize.width, this.height - otherSize.height);\r\n return r;\r\n };\r\n /**\r\n * Creates a new Size set at the linear interpolation \"amount\" between \"start\" and \"end\"\r\n * @param start starting size to lerp between\r\n * @param end end size to lerp between\r\n * @param amount amount to lerp between the start and end values\r\n * @returns a new Size set at the linear interpolation \"amount\" between \"start\" and \"end\"\r\n */\r\n Size.Lerp = function (start, end, amount) {\r\n var w = start.width + ((end.width - start.width) * amount);\r\n var h = start.height + ((end.height - start.height) * amount);\r\n return new Size(w, h);\r\n };\r\n return Size;\r\n}());\r\nexport { Size };\r\n//# sourceMappingURL=math.size.js.map","import { Scalar } from \"./math.scalar\";\r\nimport { Epsilon } from './math.constants';\r\nimport { ArrayTools } from '../Misc/arrayTools';\r\nimport { _TypeStore } from '../Misc/typeStore';\r\nimport { PerformanceConfigurator } from '../Engines/performanceConfigurator';\r\n/**\r\n * Class representing a vector containing 2 coordinates\r\n */\r\nvar Vector2 = /** @class */ (function () {\r\n /**\r\n * Creates a new Vector2 from the given x and y coordinates\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n */\r\n function Vector2(\r\n /** defines the first coordinate */\r\n x, \r\n /** defines the second coordinate */\r\n y) {\r\n if (x === void 0) { x = 0; }\r\n if (y === void 0) { y = 0; }\r\n this.x = x;\r\n this.y = y;\r\n }\r\n /**\r\n * Gets a string with the Vector2 coordinates\r\n * @returns a string with the Vector2 coordinates\r\n */\r\n Vector2.prototype.toString = function () {\r\n return \"{X: \" + this.x + \" Y: \" + this.y + \"}\";\r\n };\r\n /**\r\n * Gets class name\r\n * @returns the string \"Vector2\"\r\n */\r\n Vector2.prototype.getClassName = function () {\r\n return \"Vector2\";\r\n };\r\n /**\r\n * Gets current vector hash code\r\n * @returns the Vector2 hash code as a number\r\n */\r\n Vector2.prototype.getHashCode = function () {\r\n var hash = this.x | 0;\r\n hash = (hash * 397) ^ (this.y | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Sets the Vector2 coordinates in the given array or Float32Array from the given index.\r\n * @param array defines the source array\r\n * @param index defines the offset in source array\r\n * @returns the current Vector2\r\n */\r\n Vector2.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this.x;\r\n array[index + 1] = this.y;\r\n return this;\r\n };\r\n /**\r\n * Update the current vector from an array\r\n * @param array defines the destination array\r\n * @param index defines the offset in the destination array\r\n * @returns the current Vector3\r\n */\r\n Vector2.prototype.fromArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n Vector2.FromArrayToRef(array, index, this);\r\n return this;\r\n };\r\n /**\r\n * Copy the current vector to an array\r\n * @returns a new array with 2 elements: the Vector2 coordinates.\r\n */\r\n Vector2.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Sets the Vector2 coordinates with the given Vector2 coordinates\r\n * @param source defines the source Vector2\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.copyFrom = function (source) {\r\n this.x = source.x;\r\n this.y = source.y;\r\n return this;\r\n };\r\n /**\r\n * Sets the Vector2 coordinates with the given floats\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.copyFromFloats = function (x, y) {\r\n this.x = x;\r\n this.y = y;\r\n return this;\r\n };\r\n /**\r\n * Sets the Vector2 coordinates with the given floats\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.set = function (x, y) {\r\n return this.copyFromFloats(x, y);\r\n };\r\n /**\r\n * Add another vector with the current one\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2 set with the addition of the current Vector2 and the given one coordinates\r\n */\r\n Vector2.prototype.add = function (otherVector) {\r\n return new Vector2(this.x + otherVector.x, this.y + otherVector.y);\r\n };\r\n /**\r\n * Sets the \"result\" coordinates with the addition of the current Vector2 and the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.addToRef = function (otherVector, result) {\r\n result.x = this.x + otherVector.x;\r\n result.y = this.y + otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Set the Vector2 coordinates by adding the given Vector2 coordinates\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.addInPlace = function (otherVector) {\r\n this.x += otherVector.x;\r\n this.y += otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector2 by adding the current Vector2 coordinates to the given Vector3 x, y coordinates\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.addVector3 = function (otherVector) {\r\n return new Vector2(this.x + otherVector.x, this.y + otherVector.y);\r\n };\r\n /**\r\n * Gets a new Vector2 set with the subtracted coordinates of the given one from the current Vector2\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.subtract = function (otherVector) {\r\n return new Vector2(this.x - otherVector.x, this.y - otherVector.y);\r\n };\r\n /**\r\n * Sets the \"result\" coordinates with the subtraction of the given one from the current Vector2 coordinates.\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.subtractToRef = function (otherVector, result) {\r\n result.x = this.x - otherVector.x;\r\n result.y = this.y - otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Sets the current Vector2 coordinates by subtracting from it the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.subtractInPlace = function (otherVector) {\r\n this.x -= otherVector.x;\r\n this.y -= otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Multiplies in place the current Vector2 coordinates by the given ones\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.multiplyInPlace = function (otherVector) {\r\n this.x *= otherVector.x;\r\n this.y *= otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector2 set with the multiplication of the current Vector2 and the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.multiply = function (otherVector) {\r\n return new Vector2(this.x * otherVector.x, this.y * otherVector.y);\r\n };\r\n /**\r\n * Sets \"result\" coordinates with the multiplication of the current Vector2 and the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.multiplyToRef = function (otherVector, result) {\r\n result.x = this.x * otherVector.x;\r\n result.y = this.y * otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector2 set with the Vector2 coordinates multiplied by the given floats\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.multiplyByFloats = function (x, y) {\r\n return new Vector2(this.x * x, this.y * y);\r\n };\r\n /**\r\n * Returns a new Vector2 set with the Vector2 coordinates divided by the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.divide = function (otherVector) {\r\n return new Vector2(this.x / otherVector.x, this.y / otherVector.y);\r\n };\r\n /**\r\n * Sets the \"result\" coordinates with the Vector2 divided by the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.divideToRef = function (otherVector, result) {\r\n result.x = this.x / otherVector.x;\r\n result.y = this.y / otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Divides the current Vector2 coordinates by the given ones\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.divideInPlace = function (otherVector) {\r\n return this.divideToRef(otherVector, this);\r\n };\r\n /**\r\n * Gets a new Vector2 with current Vector2 negated coordinates\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.negate = function () {\r\n return new Vector2(-this.x, -this.y);\r\n };\r\n /**\r\n * Negate this vector in place\r\n * @returns this\r\n */\r\n Vector2.prototype.negateInPlace = function () {\r\n this.x *= -1;\r\n this.y *= -1;\r\n return this;\r\n };\r\n /**\r\n * Negate the current Vector2 and stores the result in the given vector \"result\" coordinates\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector2\r\n */\r\n Vector2.prototype.negateToRef = function (result) {\r\n return result.copyFromFloats(this.x * -1, this.y * -1);\r\n };\r\n /**\r\n * Multiply the Vector2 coordinates by scale\r\n * @param scale defines the scaling factor\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.scaleInPlace = function (scale) {\r\n this.x *= scale;\r\n this.y *= scale;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector2 scaled by \"scale\" from the current Vector2\r\n * @param scale defines the scaling factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.scale = function (scale) {\r\n var result = new Vector2(0, 0);\r\n this.scaleToRef(scale, result);\r\n return result;\r\n };\r\n /**\r\n * Scale the current Vector2 values by a factor to a given Vector2\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector2 object where to store the result\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.scaleToRef = function (scale, result) {\r\n result.x = this.x * scale;\r\n result.y = this.y * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Vector2 values by a factor and add the result to a given Vector2\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector2 object where to store the result\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.x += this.x * scale;\r\n result.y += this.y * scale;\r\n return this;\r\n };\r\n /**\r\n * Gets a boolean if two vectors are equals\r\n * @param otherVector defines the other vector\r\n * @returns true if the given vector coordinates strictly equal the current Vector2 ones\r\n */\r\n Vector2.prototype.equals = function (otherVector) {\r\n return otherVector && this.x === otherVector.x && this.y === otherVector.y;\r\n };\r\n /**\r\n * Gets a boolean if two vectors are equals (using an epsilon value)\r\n * @param otherVector defines the other vector\r\n * @param epsilon defines the minimal distance to consider equality\r\n * @returns true if the given vector coordinates are close to the current ones by a distance of epsilon.\r\n */\r\n Vector2.prototype.equalsWithEpsilon = function (otherVector, epsilon) {\r\n if (epsilon === void 0) { epsilon = Epsilon; }\r\n return otherVector && Scalar.WithinEpsilon(this.x, otherVector.x, epsilon) && Scalar.WithinEpsilon(this.y, otherVector.y, epsilon);\r\n };\r\n /**\r\n * Gets a new Vector2 from current Vector2 floored values\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.floor = function () {\r\n return new Vector2(Math.floor(this.x), Math.floor(this.y));\r\n };\r\n /**\r\n * Gets a new Vector2 from current Vector2 floored values\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.fract = function () {\r\n return new Vector2(this.x - Math.floor(this.x), this.y - Math.floor(this.y));\r\n };\r\n // Properties\r\n /**\r\n * Gets the length of the vector\r\n * @returns the vector length (float)\r\n */\r\n Vector2.prototype.length = function () {\r\n return Math.sqrt(this.x * this.x + this.y * this.y);\r\n };\r\n /**\r\n * Gets the vector squared length\r\n * @returns the vector squared length (float)\r\n */\r\n Vector2.prototype.lengthSquared = function () {\r\n return (this.x * this.x + this.y * this.y);\r\n };\r\n // Methods\r\n /**\r\n * Normalize the vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.normalize = function () {\r\n var len = this.length();\r\n if (len === 0) {\r\n return this;\r\n }\r\n this.x /= len;\r\n this.y /= len;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector2 copied from the Vector2\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.clone = function () {\r\n return new Vector2(this.x, this.y);\r\n };\r\n // Statics\r\n /**\r\n * Gets a new Vector2(0, 0)\r\n * @returns a new Vector2\r\n */\r\n Vector2.Zero = function () {\r\n return new Vector2(0, 0);\r\n };\r\n /**\r\n * Gets a new Vector2(1, 1)\r\n * @returns a new Vector2\r\n */\r\n Vector2.One = function () {\r\n return new Vector2(1, 1);\r\n };\r\n /**\r\n * Gets a new Vector2 set from the given index element of the given array\r\n * @param array defines the data source\r\n * @param offset defines the offset in the data source\r\n * @returns a new Vector2\r\n */\r\n Vector2.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Vector2(array[offset], array[offset + 1]);\r\n };\r\n /**\r\n * Sets \"result\" from the given index element of the given array\r\n * @param array defines the data source\r\n * @param offset defines the offset in the data source\r\n * @param result defines the target vector\r\n */\r\n Vector2.FromArrayToRef = function (array, offset, result) {\r\n result.x = array[offset];\r\n result.y = array[offset + 1];\r\n };\r\n /**\r\n * Gets a new Vector2 located for \"amount\" (float) on the CatmullRom spline defined by the given four Vector2\r\n * @param value1 defines 1st point of control\r\n * @param value2 defines 2nd point of control\r\n * @param value3 defines 3rd point of control\r\n * @param value4 defines 4th point of control\r\n * @param amount defines the interpolation factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.CatmullRom = function (value1, value2, value3, value4, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var x = 0.5 * ((((2.0 * value2.x) + ((-value1.x + value3.x) * amount)) +\r\n (((((2.0 * value1.x) - (5.0 * value2.x)) + (4.0 * value3.x)) - value4.x) * squared)) +\r\n ((((-value1.x + (3.0 * value2.x)) - (3.0 * value3.x)) + value4.x) * cubed));\r\n var y = 0.5 * ((((2.0 * value2.y) + ((-value1.y + value3.y) * amount)) +\r\n (((((2.0 * value1.y) - (5.0 * value2.y)) + (4.0 * value3.y)) - value4.y) * squared)) +\r\n ((((-value1.y + (3.0 * value2.y)) - (3.0 * value3.y)) + value4.y) * cubed));\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Returns a new Vector2 set with same the coordinates than \"value\" ones if the vector \"value\" is in the square defined by \"min\" and \"max\".\r\n * If a coordinate of \"value\" is lower than \"min\" coordinates, the returned Vector2 is given this \"min\" coordinate.\r\n * If a coordinate of \"value\" is greater than \"max\" coordinates, the returned Vector2 is given this \"max\" coordinate\r\n * @param value defines the value to clamp\r\n * @param min defines the lower limit\r\n * @param max defines the upper limit\r\n * @returns a new Vector2\r\n */\r\n Vector2.Clamp = function (value, min, max) {\r\n var x = value.x;\r\n x = (x > max.x) ? max.x : x;\r\n x = (x < min.x) ? min.x : x;\r\n var y = value.y;\r\n y = (y > max.y) ? max.y : y;\r\n y = (y < min.y) ? min.y : y;\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Returns a new Vector2 located for \"amount\" (float) on the Hermite spline defined by the vectors \"value1\", \"value3\", \"tangent1\", \"tangent2\"\r\n * @param value1 defines the 1st control point\r\n * @param tangent1 defines the outgoing tangent\r\n * @param value2 defines the 2nd control point\r\n * @param tangent2 defines the incoming tangent\r\n * @param amount defines the interpolation factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n var x = (((value1.x * part1) + (value2.x * part2)) + (tangent1.x * part3)) + (tangent2.x * part4);\r\n var y = (((value1.y * part1) + (value2.y * part2)) + (tangent1.y * part3)) + (tangent2.y * part4);\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Returns a new Vector2 located for \"amount\" (float) on the linear interpolation between the vector \"start\" adn the vector \"end\".\r\n * @param start defines the start vector\r\n * @param end defines the end vector\r\n * @param amount defines the interpolation factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.Lerp = function (start, end, amount) {\r\n var x = start.x + ((end.x - start.x) * amount);\r\n var y = start.y + ((end.y - start.y) * amount);\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Gets the dot product of the vector \"left\" and the vector \"right\"\r\n * @param left defines first vector\r\n * @param right defines second vector\r\n * @returns the dot product (float)\r\n */\r\n Vector2.Dot = function (left, right) {\r\n return left.x * right.x + left.y * right.y;\r\n };\r\n /**\r\n * Returns a new Vector2 equal to the normalized given vector\r\n * @param vector defines the vector to normalize\r\n * @returns a new Vector2\r\n */\r\n Vector2.Normalize = function (vector) {\r\n var newVector = vector.clone();\r\n newVector.normalize();\r\n return newVector;\r\n };\r\n /**\r\n * Gets a new Vector2 set with the minimal coordinate values from the \"left\" and \"right\" vectors\r\n * @param left defines 1st vector\r\n * @param right defines 2nd vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.Minimize = function (left, right) {\r\n var x = (left.x < right.x) ? left.x : right.x;\r\n var y = (left.y < right.y) ? left.y : right.y;\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Gets a new Vecto2 set with the maximal coordinate values from the \"left\" and \"right\" vectors\r\n * @param left defines 1st vector\r\n * @param right defines 2nd vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.Maximize = function (left, right) {\r\n var x = (left.x > right.x) ? left.x : right.x;\r\n var y = (left.y > right.y) ? left.y : right.y;\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Gets a new Vector2 set with the transformed coordinates of the given vector by the given transformation matrix\r\n * @param vector defines the vector to transform\r\n * @param transformation defines the matrix to apply\r\n * @returns a new Vector2\r\n */\r\n Vector2.Transform = function (vector, transformation) {\r\n var r = Vector2.Zero();\r\n Vector2.TransformToRef(vector, transformation, r);\r\n return r;\r\n };\r\n /**\r\n * Transforms the given vector coordinates by the given transformation matrix and stores the result in the vector \"result\" coordinates\r\n * @param vector defines the vector to transform\r\n * @param transformation defines the matrix to apply\r\n * @param result defines the target vector\r\n */\r\n Vector2.TransformToRef = function (vector, transformation, result) {\r\n var m = transformation.m;\r\n var x = (vector.x * m[0]) + (vector.y * m[4]) + m[12];\r\n var y = (vector.x * m[1]) + (vector.y * m[5]) + m[13];\r\n result.x = x;\r\n result.y = y;\r\n };\r\n /**\r\n * Determines if a given vector is included in a triangle\r\n * @param p defines the vector to test\r\n * @param p0 defines 1st triangle point\r\n * @param p1 defines 2nd triangle point\r\n * @param p2 defines 3rd triangle point\r\n * @returns true if the point \"p\" is in the triangle defined by the vertors \"p0\", \"p1\", \"p2\"\r\n */\r\n Vector2.PointInTriangle = function (p, p0, p1, p2) {\r\n var a = 1 / 2 * (-p1.y * p2.x + p0.y * (-p1.x + p2.x) + p0.x * (p1.y - p2.y) + p1.x * p2.y);\r\n var sign = a < 0 ? -1 : 1;\r\n var s = (p0.y * p2.x - p0.x * p2.y + (p2.y - p0.y) * p.x + (p0.x - p2.x) * p.y) * sign;\r\n var t = (p0.x * p1.y - p0.y * p1.x + (p0.y - p1.y) * p.x + (p1.x - p0.x) * p.y) * sign;\r\n return s > 0 && t > 0 && (s + t) < 2 * a * sign;\r\n };\r\n /**\r\n * Gets the distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines first vector\r\n * @param value2 defines second vector\r\n * @returns the distance between vectors\r\n */\r\n Vector2.Distance = function (value1, value2) {\r\n return Math.sqrt(Vector2.DistanceSquared(value1, value2));\r\n };\r\n /**\r\n * Returns the squared distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines first vector\r\n * @param value2 defines second vector\r\n * @returns the squared distance between vectors\r\n */\r\n Vector2.DistanceSquared = function (value1, value2) {\r\n var x = value1.x - value2.x;\r\n var y = value1.y - value2.y;\r\n return (x * x) + (y * y);\r\n };\r\n /**\r\n * Gets a new Vector2 located at the center of the vectors \"value1\" and \"value2\"\r\n * @param value1 defines first vector\r\n * @param value2 defines second vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.Center = function (value1, value2) {\r\n var center = value1.add(value2);\r\n center.scaleInPlace(0.5);\r\n return center;\r\n };\r\n /**\r\n * Gets the shortest distance (float) between the point \"p\" and the segment defined by the two points \"segA\" and \"segB\".\r\n * @param p defines the middle point\r\n * @param segA defines one point of the segment\r\n * @param segB defines the other point of the segment\r\n * @returns the shortest distance\r\n */\r\n Vector2.DistanceOfPointFromSegment = function (p, segA, segB) {\r\n var l2 = Vector2.DistanceSquared(segA, segB);\r\n if (l2 === 0.0) {\r\n return Vector2.Distance(p, segA);\r\n }\r\n var v = segB.subtract(segA);\r\n var t = Math.max(0, Math.min(1, Vector2.Dot(p.subtract(segA), v) / l2));\r\n var proj = segA.add(v.multiplyByFloats(t, t));\r\n return Vector2.Distance(p, proj);\r\n };\r\n return Vector2;\r\n}());\r\nexport { Vector2 };\r\n/**\r\n * Class used to store (x,y,z) vector representation\r\n * A Vector3 is the main object used in 3D geometry\r\n * It can represent etiher the coordinates of a point the space, either a direction\r\n * Reminder: js uses a left handed forward facing system\r\n */\r\nvar Vector3 = /** @class */ (function () {\r\n /**\r\n * Creates a new Vector3 object from the given x, y, z (floats) coordinates.\r\n * @param x defines the first coordinates (on X axis)\r\n * @param y defines the second coordinates (on Y axis)\r\n * @param z defines the third coordinates (on Z axis)\r\n */\r\n function Vector3(x, y, z) {\r\n if (x === void 0) { x = 0; }\r\n if (y === void 0) { y = 0; }\r\n if (z === void 0) { z = 0; }\r\n /** @hidden */\r\n this._isDirty = true;\r\n this._x = x;\r\n this._y = y;\r\n this._z = z;\r\n }\r\n Object.defineProperty(Vector3.prototype, \"x\", {\r\n /** Gets or sets the x coordinate */\r\n get: function () {\r\n return this._x;\r\n },\r\n set: function (value) {\r\n this._x = value;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Vector3.prototype, \"y\", {\r\n /** Gets or sets the y coordinate */\r\n get: function () {\r\n return this._y;\r\n },\r\n set: function (value) {\r\n this._y = value;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Vector3.prototype, \"z\", {\r\n /** Gets or sets the z coordinate */\r\n get: function () {\r\n return this._z;\r\n },\r\n set: function (value) {\r\n this._z = value;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a string representation of the Vector3\r\n * @returns a string with the Vector3 coordinates.\r\n */\r\n Vector3.prototype.toString = function () {\r\n return \"{X: \" + this._x + \" Y:\" + this._y + \" Z:\" + this._z + \"}\";\r\n };\r\n /**\r\n * Gets the class name\r\n * @returns the string \"Vector3\"\r\n */\r\n Vector3.prototype.getClassName = function () {\r\n return \"Vector3\";\r\n };\r\n /**\r\n * Creates the Vector3 hash code\r\n * @returns a number which tends to be unique between Vector3 instances\r\n */\r\n Vector3.prototype.getHashCode = function () {\r\n var hash = this._x | 0;\r\n hash = (hash * 397) ^ (this._y | 0);\r\n hash = (hash * 397) ^ (this._z | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Creates an array containing three elements : the coordinates of the Vector3\r\n * @returns a new array of numbers\r\n */\r\n Vector3.prototype.asArray = function () {\r\n var result = [];\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Populates the given array or Float32Array from the given index with the successive coordinates of the Vector3\r\n * @param array defines the destination array\r\n * @param index defines the offset in the destination array\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this._x;\r\n array[index + 1] = this._y;\r\n array[index + 2] = this._z;\r\n return this;\r\n };\r\n /**\r\n * Update the current vector from an array\r\n * @param array defines the destination array\r\n * @param index defines the offset in the destination array\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.fromArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n Vector3.FromArrayToRef(array, index, this);\r\n return this;\r\n };\r\n /**\r\n * Converts the current Vector3 into a quaternion (considering that the Vector3 contains Euler angles representation of a rotation)\r\n * @returns a new Quaternion object, computed from the Vector3 coordinates\r\n */\r\n Vector3.prototype.toQuaternion = function () {\r\n return Quaternion.RotationYawPitchRoll(this._y, this._x, this._z);\r\n };\r\n /**\r\n * Adds the given vector to the current Vector3\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.addInPlace = function (otherVector) {\r\n return this.addInPlaceFromFloats(otherVector._x, otherVector._y, otherVector._z);\r\n };\r\n /**\r\n * Adds the given coordinates to the current Vector3\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.addInPlaceFromFloats = function (x, y, z) {\r\n this.x += x;\r\n this.y += y;\r\n this.z += z;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector3, result of the addition the current Vector3 and the given vector\r\n * @param otherVector defines the second operand\r\n * @returns the resulting Vector3\r\n */\r\n Vector3.prototype.add = function (otherVector) {\r\n return new Vector3(this._x + otherVector._x, this._y + otherVector._y, this._z + otherVector._z);\r\n };\r\n /**\r\n * Adds the current Vector3 to the given one and stores the result in the vector \"result\"\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.addToRef = function (otherVector, result) {\r\n return result.copyFromFloats(this._x + otherVector._x, this._y + otherVector._y, this._z + otherVector._z);\r\n };\r\n /**\r\n * Subtract the given vector from the current Vector3\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.subtractInPlace = function (otherVector) {\r\n this.x -= otherVector._x;\r\n this.y -= otherVector._y;\r\n this.z -= otherVector._z;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3, result of the subtraction of the given vector from the current Vector3\r\n * @param otherVector defines the second operand\r\n * @returns the resulting Vector3\r\n */\r\n Vector3.prototype.subtract = function (otherVector) {\r\n return new Vector3(this._x - otherVector._x, this._y - otherVector._y, this._z - otherVector._z);\r\n };\r\n /**\r\n * Subtracts the given vector from the current Vector3 and stores the result in the vector \"result\".\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.subtractToRef = function (otherVector, result) {\r\n return this.subtractFromFloatsToRef(otherVector._x, otherVector._y, otherVector._z, result);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the subtraction of the given floats from the current Vector3 coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the resulting Vector3\r\n */\r\n Vector3.prototype.subtractFromFloats = function (x, y, z) {\r\n return new Vector3(this._x - x, this._y - y, this._z - z);\r\n };\r\n /**\r\n * Subtracts the given floats from the current Vector3 coordinates and set the given vector \"result\" with this result\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.subtractFromFloatsToRef = function (x, y, z, result) {\r\n return result.copyFromFloats(this._x - x, this._y - y, this._z - z);\r\n };\r\n /**\r\n * Gets a new Vector3 set with the current Vector3 negated coordinates\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.negate = function () {\r\n return new Vector3(-this._x, -this._y, -this._z);\r\n };\r\n /**\r\n * Negate this vector in place\r\n * @returns this\r\n */\r\n Vector3.prototype.negateInPlace = function () {\r\n this.x *= -1;\r\n this.y *= -1;\r\n this.z *= -1;\r\n return this;\r\n };\r\n /**\r\n * Negate the current Vector3 and stores the result in the given vector \"result\" coordinates\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.negateToRef = function (result) {\r\n return result.copyFromFloats(this._x * -1, this._y * -1, this._z * -1);\r\n };\r\n /**\r\n * Multiplies the Vector3 coordinates by the float \"scale\"\r\n * @param scale defines the multiplier factor\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.scaleInPlace = function (scale) {\r\n this.x *= scale;\r\n this.y *= scale;\r\n this.z *= scale;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float \"scale\"\r\n * @param scale defines the multiplier factor\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.scale = function (scale) {\r\n return new Vector3(this._x * scale, this._y * scale, this._z * scale);\r\n };\r\n /**\r\n * Multiplies the current Vector3 coordinates by the float \"scale\" and stores the result in the given vector \"result\" coordinates\r\n * @param scale defines the multiplier factor\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.scaleToRef = function (scale, result) {\r\n return result.copyFromFloats(this._x * scale, this._y * scale, this._z * scale);\r\n };\r\n /**\r\n * Scale the current Vector3 values by a factor and add the result to a given Vector3\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the unmodified current Vector3\r\n */\r\n Vector3.prototype.scaleAndAddToRef = function (scale, result) {\r\n return result.addInPlaceFromFloats(this._x * scale, this._y * scale, this._z * scale);\r\n };\r\n /**\r\n * Projects the current vector3 to a plane along a ray starting from a specified origin and directed towards the point.\r\n * @param origin defines the origin of the projection ray\r\n * @param plane defines the plane to project to\r\n * @returns the projected vector3\r\n */\r\n Vector3.prototype.projectOnPlane = function (plane, origin) {\r\n var result = Vector3.Zero();\r\n this.projectOnPlaneToRef(plane, origin, result);\r\n return result;\r\n };\r\n /**\r\n * Projects the current vector3 to a plane along a ray starting from a specified origin and directed towards the point.\r\n * @param origin defines the origin of the projection ray\r\n * @param plane defines the plane to project to\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.prototype.projectOnPlaneToRef = function (plane, origin, result) {\r\n var n = plane.normal;\r\n var d = plane.d;\r\n var V = MathTmp.Vector3[0];\r\n // ray direction\r\n this.subtractToRef(origin, V);\r\n V.normalize();\r\n var denom = Vector3.Dot(V, n);\r\n var t = -(Vector3.Dot(origin, n) + d) / denom;\r\n // P = P0 + t*V\r\n var scaledV = V.scaleInPlace(t);\r\n origin.addToRef(scaledV, result);\r\n };\r\n /**\r\n * Returns true if the current Vector3 and the given vector coordinates are strictly equal\r\n * @param otherVector defines the second operand\r\n * @returns true if both vectors are equals\r\n */\r\n Vector3.prototype.equals = function (otherVector) {\r\n return otherVector && this._x === otherVector._x && this._y === otherVector._y && this._z === otherVector._z;\r\n };\r\n /**\r\n * Returns true if the current Vector3 and the given vector coordinates are distant less than epsilon\r\n * @param otherVector defines the second operand\r\n * @param epsilon defines the minimal distance to define values as equals\r\n * @returns true if both vectors are distant less than epsilon\r\n */\r\n Vector3.prototype.equalsWithEpsilon = function (otherVector, epsilon) {\r\n if (epsilon === void 0) { epsilon = Epsilon; }\r\n return otherVector && Scalar.WithinEpsilon(this._x, otherVector._x, epsilon) && Scalar.WithinEpsilon(this._y, otherVector._y, epsilon) && Scalar.WithinEpsilon(this._z, otherVector._z, epsilon);\r\n };\r\n /**\r\n * Returns true if the current Vector3 coordinates equals the given floats\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns true if both vectors are equals\r\n */\r\n Vector3.prototype.equalsToFloats = function (x, y, z) {\r\n return this._x === x && this._y === y && this._z === z;\r\n };\r\n /**\r\n * Multiplies the current Vector3 coordinates by the given ones\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.multiplyInPlace = function (otherVector) {\r\n this.x *= otherVector._x;\r\n this.y *= otherVector._y;\r\n this.z *= otherVector._z;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3, result of the multiplication of the current Vector3 by the given vector\r\n * @param otherVector defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.multiply = function (otherVector) {\r\n return this.multiplyByFloats(otherVector._x, otherVector._y, otherVector._z);\r\n };\r\n /**\r\n * Multiplies the current Vector3 by the given one and stores the result in the given vector \"result\"\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.multiplyToRef = function (otherVector, result) {\r\n return result.copyFromFloats(this._x * otherVector._x, this._y * otherVector._y, this._z * otherVector._z);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the mulliplication of the current Vector3 coordinates by the given floats\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.multiplyByFloats = function (x, y, z) {\r\n return new Vector3(this._x * x, this._y * y, this._z * z);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the division of the current Vector3 coordinates by the given ones\r\n * @param otherVector defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.divide = function (otherVector) {\r\n return new Vector3(this._x / otherVector._x, this._y / otherVector._y, this._z / otherVector._z);\r\n };\r\n /**\r\n * Divides the current Vector3 coordinates by the given ones and stores the result in the given vector \"result\"\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.divideToRef = function (otherVector, result) {\r\n return result.copyFromFloats(this._x / otherVector._x, this._y / otherVector._y, this._z / otherVector._z);\r\n };\r\n /**\r\n * Divides the current Vector3 coordinates by the given ones.\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.divideInPlace = function (otherVector) {\r\n return this.divideToRef(otherVector, this);\r\n };\r\n /**\r\n * Updates the current Vector3 with the minimal coordinate values between its and the given vector ones\r\n * @param other defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.minimizeInPlace = function (other) {\r\n return this.minimizeInPlaceFromFloats(other._x, other._y, other._z);\r\n };\r\n /**\r\n * Updates the current Vector3 with the maximal coordinate values between its and the given vector ones.\r\n * @param other defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.maximizeInPlace = function (other) {\r\n return this.maximizeInPlaceFromFloats(other._x, other._y, other._z);\r\n };\r\n /**\r\n * Updates the current Vector3 with the minimal coordinate values between its and the given coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.minimizeInPlaceFromFloats = function (x, y, z) {\r\n if (x < this._x) {\r\n this.x = x;\r\n }\r\n if (y < this._y) {\r\n this.y = y;\r\n }\r\n if (z < this._z) {\r\n this.z = z;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the current Vector3 with the maximal coordinate values between its and the given coordinates.\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.maximizeInPlaceFromFloats = function (x, y, z) {\r\n if (x > this._x) {\r\n this.x = x;\r\n }\r\n if (y > this._y) {\r\n this.y = y;\r\n }\r\n if (z > this._z) {\r\n this.z = z;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Due to float precision, scale of a mesh could be uniform but float values are off by a small fraction\r\n * Check if is non uniform within a certain amount of decimal places to account for this\r\n * @param epsilon the amount the values can differ\r\n * @returns if the the vector is non uniform to a certain number of decimal places\r\n */\r\n Vector3.prototype.isNonUniformWithinEpsilon = function (epsilon) {\r\n var absX = Math.abs(this._x);\r\n var absY = Math.abs(this._y);\r\n if (!Scalar.WithinEpsilon(absX, absY, epsilon)) {\r\n return true;\r\n }\r\n var absZ = Math.abs(this._z);\r\n if (!Scalar.WithinEpsilon(absX, absZ, epsilon)) {\r\n return true;\r\n }\r\n if (!Scalar.WithinEpsilon(absY, absZ, epsilon)) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n Object.defineProperty(Vector3.prototype, \"isNonUniform\", {\r\n /**\r\n * Gets a boolean indicating that the vector is non uniform meaning x, y or z are not all the same\r\n */\r\n get: function () {\r\n var absX = Math.abs(this._x);\r\n var absY = Math.abs(this._y);\r\n if (absX !== absY) {\r\n return true;\r\n }\r\n var absZ = Math.abs(this._z);\r\n if (absX !== absZ) {\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a new Vector3 from current Vector3 floored values\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.floor = function () {\r\n return new Vector3(Math.floor(this._x), Math.floor(this._y), Math.floor(this._z));\r\n };\r\n /**\r\n * Gets a new Vector3 from current Vector3 floored values\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.fract = function () {\r\n return new Vector3(this._x - Math.floor(this._x), this._y - Math.floor(this._y), this._z - Math.floor(this._z));\r\n };\r\n // Properties\r\n /**\r\n * Gets the length of the Vector3\r\n * @returns the length of the Vector3\r\n */\r\n Vector3.prototype.length = function () {\r\n return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z);\r\n };\r\n /**\r\n * Gets the squared length of the Vector3\r\n * @returns squared length of the Vector3\r\n */\r\n Vector3.prototype.lengthSquared = function () {\r\n return (this._x * this._x + this._y * this._y + this._z * this._z);\r\n };\r\n /**\r\n * Normalize the current Vector3.\r\n * Please note that this is an in place operation.\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.normalize = function () {\r\n return this.normalizeFromLength(this.length());\r\n };\r\n /**\r\n * Reorders the x y z properties of the vector in place\r\n * @param order new ordering of the properties (eg. for vector 1,2,3 with \"ZYX\" will produce 3,2,1)\r\n * @returns the current updated vector\r\n */\r\n Vector3.prototype.reorderInPlace = function (order) {\r\n var _this = this;\r\n order = order.toLowerCase();\r\n if (order === \"xyz\") {\r\n return this;\r\n }\r\n MathTmp.Vector3[0].copyFrom(this);\r\n [\"x\", \"y\", \"z\"].forEach(function (val, i) {\r\n _this[val] = MathTmp.Vector3[0][order[i]];\r\n });\r\n return this;\r\n };\r\n /**\r\n * Rotates the vector around 0,0,0 by a quaternion\r\n * @param quaternion the rotation quaternion\r\n * @param result vector to store the result\r\n * @returns the resulting vector\r\n */\r\n Vector3.prototype.rotateByQuaternionToRef = function (quaternion, result) {\r\n quaternion.toRotationMatrix(MathTmp.Matrix[0]);\r\n Vector3.TransformCoordinatesToRef(this, MathTmp.Matrix[0], result);\r\n return result;\r\n };\r\n /**\r\n * Rotates a vector around a given point\r\n * @param quaternion the rotation quaternion\r\n * @param point the point to rotate around\r\n * @param result vector to store the result\r\n * @returns the resulting vector\r\n */\r\n Vector3.prototype.rotateByQuaternionAroundPointToRef = function (quaternion, point, result) {\r\n this.subtractToRef(point, MathTmp.Vector3[0]);\r\n MathTmp.Vector3[0].rotateByQuaternionToRef(quaternion, MathTmp.Vector3[0]);\r\n point.addToRef(MathTmp.Vector3[0], result);\r\n return result;\r\n };\r\n /**\r\n * Returns a new Vector3 as the cross product of the current vector and the \"other\" one\r\n * The cross product is then orthogonal to both current and \"other\"\r\n * @param other defines the right operand\r\n * @returns the cross product\r\n */\r\n Vector3.prototype.cross = function (other) {\r\n return Vector3.Cross(this, other);\r\n };\r\n /**\r\n * Normalize the current Vector3 with the given input length.\r\n * Please note that this is an in place operation.\r\n * @param len the length of the vector\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.normalizeFromLength = function (len) {\r\n if (len === 0 || len === 1.0) {\r\n return this;\r\n }\r\n return this.scaleInPlace(1.0 / len);\r\n };\r\n /**\r\n * Normalize the current Vector3 to a new vector\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.normalizeToNew = function () {\r\n var normalized = new Vector3(0, 0, 0);\r\n this.normalizeToRef(normalized);\r\n return normalized;\r\n };\r\n /**\r\n * Normalize the current Vector3 to the reference\r\n * @param reference define the Vector3 to update\r\n * @returns the updated Vector3\r\n */\r\n Vector3.prototype.normalizeToRef = function (reference) {\r\n var len = this.length();\r\n if (len === 0 || len === 1.0) {\r\n return reference.copyFromFloats(this._x, this._y, this._z);\r\n }\r\n return this.scaleToRef(1.0 / len, reference);\r\n };\r\n /**\r\n * Creates a new Vector3 copied from the current Vector3\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.clone = function () {\r\n return new Vector3(this._x, this._y, this._z);\r\n };\r\n /**\r\n * Copies the given vector coordinates to the current Vector3 ones\r\n * @param source defines the source Vector3\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.copyFrom = function (source) {\r\n return this.copyFromFloats(source._x, source._y, source._z);\r\n };\r\n /**\r\n * Copies the given floats to the current Vector3 coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.copyFromFloats = function (x, y, z) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n return this;\r\n };\r\n /**\r\n * Copies the given floats to the current Vector3 coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.set = function (x, y, z) {\r\n return this.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Copies the given float to the current Vector3 coordinates\r\n * @param v defines the x, y and z coordinates of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.setAll = function (v) {\r\n this.x = this.y = this.z = v;\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Get the clip factor between two vectors\r\n * @param vector0 defines the first operand\r\n * @param vector1 defines the second operand\r\n * @param axis defines the axis to use\r\n * @param size defines the size along the axis\r\n * @returns the clip factor\r\n */\r\n Vector3.GetClipFactor = function (vector0, vector1, axis, size) {\r\n var d0 = Vector3.Dot(vector0, axis) - size;\r\n var d1 = Vector3.Dot(vector1, axis) - size;\r\n var s = d0 / (d0 - d1);\r\n return s;\r\n };\r\n /**\r\n * Get angle between two vectors\r\n * @param vector0 angle between vector0 and vector1\r\n * @param vector1 angle between vector0 and vector1\r\n * @param normal direction of the normal\r\n * @return the angle between vector0 and vector1\r\n */\r\n Vector3.GetAngleBetweenVectors = function (vector0, vector1, normal) {\r\n var v0 = vector0.normalizeToRef(MathTmp.Vector3[1]);\r\n var v1 = vector1.normalizeToRef(MathTmp.Vector3[2]);\r\n var dot = Vector3.Dot(v0, v1);\r\n var n = MathTmp.Vector3[3];\r\n Vector3.CrossToRef(v0, v1, n);\r\n if (Vector3.Dot(n, normal) > 0) {\r\n return Math.acos(dot);\r\n }\r\n return -Math.acos(dot);\r\n };\r\n /**\r\n * Returns a new Vector3 set from the index \"offset\" of the given array\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @returns the new Vector3\r\n */\r\n Vector3.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Vector3(array[offset], array[offset + 1], array[offset + 2]);\r\n };\r\n /**\r\n * Returns a new Vector3 set from the index \"offset\" of the given Float32Array\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @returns the new Vector3\r\n * @deprecated Please use FromArray instead.\r\n */\r\n Vector3.FromFloatArray = function (array, offset) {\r\n return Vector3.FromArray(array, offset);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the element values from the index \"offset\" of the given array\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.FromArrayToRef = function (array, offset, result) {\r\n result.x = array[offset];\r\n result.y = array[offset + 1];\r\n result.z = array[offset + 2];\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the element values from the index \"offset\" of the given Float32Array\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @param result defines the Vector3 where to store the result\r\n * @deprecated Please use FromArrayToRef instead.\r\n */\r\n Vector3.FromFloatArrayToRef = function (array, offset, result) {\r\n return Vector3.FromArrayToRef(array, offset, result);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the given floats.\r\n * @param x defines the x coordinate of the source\r\n * @param y defines the y coordinate of the source\r\n * @param z defines the z coordinate of the source\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.FromFloatsToRef = function (x, y, z, result) {\r\n result.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 0.0, 0.0)\r\n * @returns a new empty Vector3\r\n */\r\n Vector3.Zero = function () {\r\n return new Vector3(0.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (1.0, 1.0, 1.0)\r\n * @returns a new unit Vector3\r\n */\r\n Vector3.One = function () {\r\n return new Vector3(1.0, 1.0, 1.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 1.0, 0.0)\r\n * @returns a new up Vector3\r\n */\r\n Vector3.Up = function () {\r\n return new Vector3(0.0, 1.0, 0.0);\r\n };\r\n Object.defineProperty(Vector3, \"UpReadOnly\", {\r\n /**\r\n * Gets a up Vector3 that must not be updated\r\n */\r\n get: function () {\r\n return Vector3._UpReadOnly;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Vector3, \"ZeroReadOnly\", {\r\n /**\r\n * Gets a zero Vector3 that must not be updated\r\n */\r\n get: function () {\r\n return Vector3._ZeroReadOnly;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a new Vector3 set to (0.0, -1.0, 0.0)\r\n * @returns a new down Vector3\r\n */\r\n Vector3.Down = function () {\r\n return new Vector3(0.0, -1.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 0.0, 1.0)\r\n * @param rightHandedSystem is the scene right-handed (negative z)\r\n * @returns a new forward Vector3\r\n */\r\n Vector3.Forward = function (rightHandedSystem) {\r\n if (rightHandedSystem === void 0) { rightHandedSystem = false; }\r\n return new Vector3(0.0, 0.0, (rightHandedSystem ? -1.0 : 1.0));\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 0.0, -1.0)\r\n * @param rightHandedSystem is the scene right-handed (negative-z)\r\n * @returns a new forward Vector3\r\n */\r\n Vector3.Backward = function (rightHandedSystem) {\r\n if (rightHandedSystem === void 0) { rightHandedSystem = false; }\r\n return new Vector3(0.0, 0.0, (rightHandedSystem ? 1.0 : -1.0));\r\n };\r\n /**\r\n * Returns a new Vector3 set to (1.0, 0.0, 0.0)\r\n * @returns a new right Vector3\r\n */\r\n Vector3.Right = function () {\r\n return new Vector3(1.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (-1.0, 0.0, 0.0)\r\n * @returns a new left Vector3\r\n */\r\n Vector3.Left = function () {\r\n return new Vector3(-1.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the transformation by the given matrix of the given vector.\r\n * This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @returns the transformed Vector3\r\n */\r\n Vector3.TransformCoordinates = function (vector, transformation) {\r\n var result = Vector3.Zero();\r\n Vector3.TransformCoordinatesToRef(vector, transformation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" coordinates with the result of the transformation by the given matrix of the given vector\r\n * This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformCoordinatesToRef = function (vector, transformation, result) {\r\n Vector3.TransformCoordinatesFromFloatsToRef(vector._x, vector._y, vector._z, transformation, result);\r\n };\r\n /**\r\n * Sets the given vector \"result\" coordinates with the result of the transformation by the given matrix of the given floats (x, y, z)\r\n * This method computes tranformed coordinates only, not transformed direction vectors\r\n * @param x define the x coordinate of the source vector\r\n * @param y define the y coordinate of the source vector\r\n * @param z define the z coordinate of the source vector\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformCoordinatesFromFloatsToRef = function (x, y, z, transformation, result) {\r\n var m = transformation.m;\r\n var rx = x * m[0] + y * m[4] + z * m[8] + m[12];\r\n var ry = x * m[1] + y * m[5] + z * m[9] + m[13];\r\n var rz = x * m[2] + y * m[6] + z * m[10] + m[14];\r\n var rw = 1 / (x * m[3] + y * m[7] + z * m[11] + m[15]);\r\n result.x = rx * rw;\r\n result.y = ry * rw;\r\n result.z = rz * rw;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the normal transformation by the given matrix of the given vector\r\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @returns the new Vector3\r\n */\r\n Vector3.TransformNormal = function (vector, transformation) {\r\n var result = Vector3.Zero();\r\n Vector3.TransformNormalToRef(vector, transformation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given vector\r\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformNormalToRef = function (vector, transformation, result) {\r\n this.TransformNormalFromFloatsToRef(vector._x, vector._y, vector._z, transformation, result);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given floats (x, y, z)\r\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\r\n * @param x define the x coordinate of the source vector\r\n * @param y define the y coordinate of the source vector\r\n * @param z define the z coordinate of the source vector\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformNormalFromFloatsToRef = function (x, y, z, transformation, result) {\r\n var m = transformation.m;\r\n result.x = x * m[0] + y * m[4] + z * m[8];\r\n result.y = x * m[1] + y * m[5] + z * m[9];\r\n result.z = x * m[2] + y * m[6] + z * m[10];\r\n };\r\n /**\r\n * Returns a new Vector3 located for \"amount\" on the CatmullRom interpolation spline defined by the vectors \"value1\", \"value2\", \"value3\", \"value4\"\r\n * @param value1 defines the first control point\r\n * @param value2 defines the second control point\r\n * @param value3 defines the third control point\r\n * @param value4 defines the fourth control point\r\n * @param amount defines the amount on the spline to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.CatmullRom = function (value1, value2, value3, value4, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var x = 0.5 * ((((2.0 * value2._x) + ((-value1._x + value3._x) * amount)) +\r\n (((((2.0 * value1._x) - (5.0 * value2._x)) + (4.0 * value3._x)) - value4._x) * squared)) +\r\n ((((-value1._x + (3.0 * value2._x)) - (3.0 * value3._x)) + value4._x) * cubed));\r\n var y = 0.5 * ((((2.0 * value2._y) + ((-value1._y + value3._y) * amount)) +\r\n (((((2.0 * value1._y) - (5.0 * value2._y)) + (4.0 * value3._y)) - value4._y) * squared)) +\r\n ((((-value1._y + (3.0 * value2._y)) - (3.0 * value3._y)) + value4._y) * cubed));\r\n var z = 0.5 * ((((2.0 * value2._z) + ((-value1._z + value3._z) * amount)) +\r\n (((((2.0 * value1._z) - (5.0 * value2._z)) + (4.0 * value3._z)) - value4._z) * squared)) +\r\n ((((-value1._z + (3.0 * value2._z)) - (3.0 * value3._z)) + value4._z) * cubed));\r\n return new Vector3(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the coordinates of \"value\", if the vector \"value\" is in the cube defined by the vectors \"min\" and \"max\"\r\n * If a coordinate value of \"value\" is lower than one of the \"min\" coordinate, then this \"value\" coordinate is set with the \"min\" one\r\n * If a coordinate value of \"value\" is greater than one of the \"max\" coordinate, then this \"value\" coordinate is set with the \"max\" one\r\n * @param value defines the current value\r\n * @param min defines the lower range value\r\n * @param max defines the upper range value\r\n * @returns the new Vector3\r\n */\r\n Vector3.Clamp = function (value, min, max) {\r\n var v = new Vector3();\r\n Vector3.ClampToRef(value, min, max, v);\r\n return v;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the coordinates of \"value\", if the vector \"value\" is in the cube defined by the vectors \"min\" and \"max\"\r\n * If a coordinate value of \"value\" is lower than one of the \"min\" coordinate, then this \"value\" coordinate is set with the \"min\" one\r\n * If a coordinate value of \"value\" is greater than one of the \"max\" coordinate, then this \"value\" coordinate is set with the \"max\" one\r\n * @param value defines the current value\r\n * @param min defines the lower range value\r\n * @param max defines the upper range value\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.ClampToRef = function (value, min, max, result) {\r\n var x = value._x;\r\n x = (x > max._x) ? max._x : x;\r\n x = (x < min._x) ? min._x : x;\r\n var y = value._y;\r\n y = (y > max._y) ? max._y : y;\r\n y = (y < min._y) ? min._y : y;\r\n var z = value._z;\r\n z = (z > max._z) ? max._z : z;\r\n z = (z < min._z) ? min._z : z;\r\n result.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Checks if a given vector is inside a specific range\r\n * @param v defines the vector to test\r\n * @param min defines the minimum range\r\n * @param max defines the maximum range\r\n */\r\n Vector3.CheckExtends = function (v, min, max) {\r\n min.minimizeInPlace(v);\r\n max.maximizeInPlace(v);\r\n };\r\n /**\r\n * Returns a new Vector3 located for \"amount\" (float) on the Hermite interpolation spline defined by the vectors \"value1\", \"tangent1\", \"value2\", \"tangent2\"\r\n * @param value1 defines the first control point\r\n * @param tangent1 defines the first tangent vector\r\n * @param value2 defines the second control point\r\n * @param tangent2 defines the second tangent vector\r\n * @param amount defines the amount on the interpolation spline (between 0 and 1)\r\n * @returns the new Vector3\r\n */\r\n Vector3.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n var x = (((value1._x * part1) + (value2._x * part2)) + (tangent1._x * part3)) + (tangent2._x * part4);\r\n var y = (((value1._y * part1) + (value2._y * part2)) + (tangent1._y * part3)) + (tangent2._y * part4);\r\n var z = (((value1._z * part1) + (value2._z * part2)) + (tangent1._z * part3)) + (tangent2._z * part4);\r\n return new Vector3(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 located for \"amount\" (float) on the linear interpolation between the vectors \"start\" and \"end\"\r\n * @param start defines the start value\r\n * @param end defines the end value\r\n * @param amount max defines amount between both (between 0 and 1)\r\n * @returns the new Vector3\r\n */\r\n Vector3.Lerp = function (start, end, amount) {\r\n var result = new Vector3(0, 0, 0);\r\n Vector3.LerpToRef(start, end, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the linear interpolation from the vector \"start\" for \"amount\" to the vector \"end\"\r\n * @param start defines the start value\r\n * @param end defines the end value\r\n * @param amount max defines amount between both (between 0 and 1)\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.LerpToRef = function (start, end, amount, result) {\r\n result.x = start._x + ((end._x - start._x) * amount);\r\n result.y = start._y + ((end._y - start._y) * amount);\r\n result.z = start._z + ((end._z - start._z) * amount);\r\n };\r\n /**\r\n * Returns the dot product (float) between the vectors \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @returns the dot product\r\n */\r\n Vector3.Dot = function (left, right) {\r\n return (left._x * right._x + left._y * right._y + left._z * right._z);\r\n };\r\n /**\r\n * Returns a new Vector3 as the cross product of the vectors \"left\" and \"right\"\r\n * The cross product is then orthogonal to both \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @returns the cross product\r\n */\r\n Vector3.Cross = function (left, right) {\r\n var result = Vector3.Zero();\r\n Vector3.CrossToRef(left, right, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the cross product of \"left\" and \"right\"\r\n * The cross product is then orthogonal to both \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.CrossToRef = function (left, right, result) {\r\n var x = left._y * right._z - left._z * right._y;\r\n var y = left._z * right._x - left._x * right._z;\r\n var z = left._x * right._y - left._y * right._x;\r\n result.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 as the normalization of the given vector\r\n * @param vector defines the Vector3 to normalize\r\n * @returns the new Vector3\r\n */\r\n Vector3.Normalize = function (vector) {\r\n var result = Vector3.Zero();\r\n Vector3.NormalizeToRef(vector, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the normalization of the given first vector\r\n * @param vector defines the Vector3 to normalize\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.NormalizeToRef = function (vector, result) {\r\n vector.normalizeToRef(result);\r\n };\r\n /**\r\n * Project a Vector3 onto screen space\r\n * @param vector defines the Vector3 to project\r\n * @param world defines the world matrix to use\r\n * @param transform defines the transform (view x projection) matrix to use\r\n * @param viewport defines the screen viewport to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.Project = function (vector, world, transform, viewport) {\r\n var result = new Vector3();\r\n Vector3.ProjectToRef(vector, world, transform, viewport, result);\r\n return result;\r\n };\r\n /**\r\n * Project a Vector3 onto screen space to reference\r\n * @param vector defines the Vector3 to project\r\n * @param world defines the world matrix to use\r\n * @param transform defines the transform (view x projection) matrix to use\r\n * @param viewport defines the screen viewport to use\r\n * @param result the vector in which the screen space will be stored\r\n * @returns the new Vector3\r\n */\r\n Vector3.ProjectToRef = function (vector, world, transform, viewport, result) {\r\n var cw = viewport.width;\r\n var ch = viewport.height;\r\n var cx = viewport.x;\r\n var cy = viewport.y;\r\n var viewportMatrix = MathTmp.Matrix[1];\r\n Matrix.FromValuesToRef(cw / 2.0, 0, 0, 0, 0, -ch / 2.0, 0, 0, 0, 0, 0.5, 0, cx + cw / 2.0, ch / 2.0 + cy, 0.5, 1, viewportMatrix);\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(transform, matrix);\r\n matrix.multiplyToRef(viewportMatrix, matrix);\r\n Vector3.TransformCoordinatesToRef(vector, matrix, result);\r\n return result;\r\n };\r\n /** @hidden */\r\n Vector3._UnprojectFromInvertedMatrixToRef = function (source, matrix, result) {\r\n Vector3.TransformCoordinatesToRef(source, matrix, result);\r\n var m = matrix.m;\r\n var num = source._x * m[3] + source._y * m[7] + source._z * m[11] + m[15];\r\n if (Scalar.WithinEpsilon(num, 1.0)) {\r\n result.scaleInPlace(1.0 / num);\r\n }\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param source defines the screen space Vector3 to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param transform defines the transform (view x projection) matrix to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.UnprojectFromTransform = function (source, viewportWidth, viewportHeight, world, transform) {\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(transform, matrix);\r\n matrix.invert();\r\n source.x = source._x / viewportWidth * 2 - 1;\r\n source.y = -(source._y / viewportHeight * 2 - 1);\r\n var vector = new Vector3();\r\n Vector3._UnprojectFromInvertedMatrixToRef(source, matrix, vector);\r\n return vector;\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param source defines the screen space Vector3 to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.Unproject = function (source, viewportWidth, viewportHeight, world, view, projection) {\r\n var result = Vector3.Zero();\r\n Vector3.UnprojectToRef(source, viewportWidth, viewportHeight, world, view, projection, result);\r\n return result;\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param source defines the screen space Vector3 to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.UnprojectToRef = function (source, viewportWidth, viewportHeight, world, view, projection, result) {\r\n Vector3.UnprojectFloatsToRef(source._x, source._y, source._z, viewportWidth, viewportHeight, world, view, projection, result);\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param sourceX defines the screen space x coordinate to use\r\n * @param sourceY defines the screen space y coordinate to use\r\n * @param sourceZ defines the screen space z coordinate to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.UnprojectFloatsToRef = function (sourceX, sourceY, sourceZ, viewportWidth, viewportHeight, world, view, projection, result) {\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(view, matrix);\r\n matrix.multiplyToRef(projection, matrix);\r\n matrix.invert();\r\n var screenSource = MathTmp.Vector3[0];\r\n screenSource.x = sourceX / viewportWidth * 2 - 1;\r\n screenSource.y = -(sourceY / viewportHeight * 2 - 1);\r\n screenSource.z = 2 * sourceZ - 1.0;\r\n Vector3._UnprojectFromInvertedMatrixToRef(screenSource, matrix, result);\r\n };\r\n /**\r\n * Gets the minimal coordinate values between two Vector3\r\n * @param left defines the first operand\r\n * @param right defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.Minimize = function (left, right) {\r\n var min = left.clone();\r\n min.minimizeInPlace(right);\r\n return min;\r\n };\r\n /**\r\n * Gets the maximal coordinate values between two Vector3\r\n * @param left defines the first operand\r\n * @param right defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.Maximize = function (left, right) {\r\n var max = left.clone();\r\n max.maximizeInPlace(right);\r\n return max;\r\n };\r\n /**\r\n * Returns the distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines the first operand\r\n * @param value2 defines the second operand\r\n * @returns the distance\r\n */\r\n Vector3.Distance = function (value1, value2) {\r\n return Math.sqrt(Vector3.DistanceSquared(value1, value2));\r\n };\r\n /**\r\n * Returns the squared distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines the first operand\r\n * @param value2 defines the second operand\r\n * @returns the squared distance\r\n */\r\n Vector3.DistanceSquared = function (value1, value2) {\r\n var x = value1._x - value2._x;\r\n var y = value1._y - value2._y;\r\n var z = value1._z - value2._z;\r\n return (x * x) + (y * y) + (z * z);\r\n };\r\n /**\r\n * Returns a new Vector3 located at the center between \"value1\" and \"value2\"\r\n * @param value1 defines the first operand\r\n * @param value2 defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.Center = function (value1, value2) {\r\n var center = value1.add(value2);\r\n center.scaleInPlace(0.5);\r\n return center;\r\n };\r\n /**\r\n * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),\r\n * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply\r\n * to something in order to rotate it from its local system to the given target system\r\n * Note: axis1, axis2 and axis3 are normalized during this operation\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @returns a new Vector3\r\n */\r\n Vector3.RotationFromAxis = function (axis1, axis2, axis3) {\r\n var rotation = Vector3.Zero();\r\n Vector3.RotationFromAxisToRef(axis1, axis2, axis3, rotation);\r\n return rotation;\r\n };\r\n /**\r\n * The same than RotationFromAxis but updates the given ref Vector3 parameter instead of returning a new Vector3\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @param ref defines the Vector3 where to store the result\r\n */\r\n Vector3.RotationFromAxisToRef = function (axis1, axis2, axis3, ref) {\r\n var quat = MathTmp.Quaternion[0];\r\n Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, quat);\r\n quat.toEulerAnglesToRef(ref);\r\n };\r\n Vector3._UpReadOnly = Vector3.Up();\r\n Vector3._ZeroReadOnly = Vector3.Zero();\r\n return Vector3;\r\n}());\r\nexport { Vector3 };\r\n/**\r\n * Vector4 class created for EulerAngle class conversion to Quaternion\r\n */\r\nvar Vector4 = /** @class */ (function () {\r\n /**\r\n * Creates a Vector4 object from the given floats.\r\n * @param x x value of the vector\r\n * @param y y value of the vector\r\n * @param z z value of the vector\r\n * @param w w value of the vector\r\n */\r\n function Vector4(\r\n /** x value of the vector */\r\n x, \r\n /** y value of the vector */\r\n y, \r\n /** z value of the vector */\r\n z, \r\n /** w value of the vector */\r\n w) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n this.w = w;\r\n }\r\n /**\r\n * Returns the string with the Vector4 coordinates.\r\n * @returns a string containing all the vector values\r\n */\r\n Vector4.prototype.toString = function () {\r\n return \"{X: \" + this.x + \" Y:\" + this.y + \" Z:\" + this.z + \" W:\" + this.w + \"}\";\r\n };\r\n /**\r\n * Returns the string \"Vector4\".\r\n * @returns \"Vector4\"\r\n */\r\n Vector4.prototype.getClassName = function () {\r\n return \"Vector4\";\r\n };\r\n /**\r\n * Returns the Vector4 hash code.\r\n * @returns a unique hash code\r\n */\r\n Vector4.prototype.getHashCode = function () {\r\n var hash = this.x | 0;\r\n hash = (hash * 397) ^ (this.y | 0);\r\n hash = (hash * 397) ^ (this.z | 0);\r\n hash = (hash * 397) ^ (this.w | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Returns a new array populated with 4 elements : the Vector4 coordinates.\r\n * @returns the resulting array\r\n */\r\n Vector4.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Populates the given array from the given index with the Vector4 coordinates.\r\n * @param array array to populate\r\n * @param index index of the array to start at (default: 0)\r\n * @returns the Vector4.\r\n */\r\n Vector4.prototype.toArray = function (array, index) {\r\n if (index === undefined) {\r\n index = 0;\r\n }\r\n array[index] = this.x;\r\n array[index + 1] = this.y;\r\n array[index + 2] = this.z;\r\n array[index + 3] = this.w;\r\n return this;\r\n };\r\n /**\r\n * Update the current vector from an array\r\n * @param array defines the destination array\r\n * @param index defines the offset in the destination array\r\n * @returns the current Vector3\r\n */\r\n Vector4.prototype.fromArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n Vector4.FromArrayToRef(array, index, this);\r\n return this;\r\n };\r\n /**\r\n * Adds the given vector to the current Vector4.\r\n * @param otherVector the vector to add\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.addInPlace = function (otherVector) {\r\n this.x += otherVector.x;\r\n this.y += otherVector.y;\r\n this.z += otherVector.z;\r\n this.w += otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 as the result of the addition of the current Vector4 and the given one.\r\n * @param otherVector the vector to add\r\n * @returns the resulting vector\r\n */\r\n Vector4.prototype.add = function (otherVector) {\r\n return new Vector4(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z, this.w + otherVector.w);\r\n };\r\n /**\r\n * Updates the given vector \"result\" with the result of the addition of the current Vector4 and the given one.\r\n * @param otherVector the vector to add\r\n * @param result the vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.addToRef = function (otherVector, result) {\r\n result.x = this.x + otherVector.x;\r\n result.y = this.y + otherVector.y;\r\n result.z = this.z + otherVector.z;\r\n result.w = this.w + otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Subtract in place the given vector from the current Vector4.\r\n * @param otherVector the vector to subtract\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.subtractInPlace = function (otherVector) {\r\n this.x -= otherVector.x;\r\n this.y -= otherVector.y;\r\n this.z -= otherVector.z;\r\n this.w -= otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 with the result of the subtraction of the given vector from the current Vector4.\r\n * @param otherVector the vector to add\r\n * @returns the new vector with the result\r\n */\r\n Vector4.prototype.subtract = function (otherVector) {\r\n return new Vector4(this.x - otherVector.x, this.y - otherVector.y, this.z - otherVector.z, this.w - otherVector.w);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the subtraction of the given vector from the current Vector4.\r\n * @param otherVector the vector to subtract\r\n * @param result the vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.subtractToRef = function (otherVector, result) {\r\n result.x = this.x - otherVector.x;\r\n result.y = this.y - otherVector.y;\r\n result.z = this.z - otherVector.z;\r\n result.w = this.w - otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the result of the subtraction of the given floats from the current Vector4 coordinates.\r\n */\r\n /**\r\n * Returns a new Vector4 set with the result of the subtraction of the given floats from the current Vector4 coordinates.\r\n * @param x value to subtract\r\n * @param y value to subtract\r\n * @param z value to subtract\r\n * @param w value to subtract\r\n * @returns new vector containing the result\r\n */\r\n Vector4.prototype.subtractFromFloats = function (x, y, z, w) {\r\n return new Vector4(this.x - x, this.y - y, this.z - z, this.w - w);\r\n };\r\n /**\r\n * Sets the given vector \"result\" set with the result of the subtraction of the given floats from the current Vector4 coordinates.\r\n * @param x value to subtract\r\n * @param y value to subtract\r\n * @param z value to subtract\r\n * @param w value to subtract\r\n * @param result the vector to store the result in\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.subtractFromFloatsToRef = function (x, y, z, w, result) {\r\n result.x = this.x - x;\r\n result.y = this.y - y;\r\n result.z = this.z - z;\r\n result.w = this.w - w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the current Vector4 negated coordinates.\r\n * @returns a new vector with the negated values\r\n */\r\n Vector4.prototype.negate = function () {\r\n return new Vector4(-this.x, -this.y, -this.z, -this.w);\r\n };\r\n /**\r\n * Negate this vector in place\r\n * @returns this\r\n */\r\n Vector4.prototype.negateInPlace = function () {\r\n this.x *= -1;\r\n this.y *= -1;\r\n this.z *= -1;\r\n this.w *= -1;\r\n return this;\r\n };\r\n /**\r\n * Negate the current Vector4 and stores the result in the given vector \"result\" coordinates\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector4\r\n */\r\n Vector4.prototype.negateToRef = function (result) {\r\n return result.copyFromFloats(this.x * -1, this.y * -1, this.z * -1, this.w * -1);\r\n };\r\n /**\r\n * Multiplies the current Vector4 coordinates by scale (float).\r\n * @param scale the number to scale with\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.scaleInPlace = function (scale) {\r\n this.x *= scale;\r\n this.y *= scale;\r\n this.z *= scale;\r\n this.w *= scale;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the current Vector4 coordinates multiplied by scale (float).\r\n * @param scale the number to scale with\r\n * @returns a new vector with the result\r\n */\r\n Vector4.prototype.scale = function (scale) {\r\n return new Vector4(this.x * scale, this.y * scale, this.z * scale, this.w * scale);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the current Vector4 coordinates multiplied by scale (float).\r\n * @param scale the number to scale with\r\n * @param result a vector to store the result in\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.scaleToRef = function (scale, result) {\r\n result.x = this.x * scale;\r\n result.y = this.y * scale;\r\n result.z = this.z * scale;\r\n result.w = this.w * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Vector4 values by a factor and add the result to a given Vector4\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector4 object where to store the result\r\n * @returns the unmodified current Vector4\r\n */\r\n Vector4.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.x += this.x * scale;\r\n result.y += this.y * scale;\r\n result.z += this.z * scale;\r\n result.w += this.w * scale;\r\n return this;\r\n };\r\n /**\r\n * Boolean : True if the current Vector4 coordinates are stricly equal to the given ones.\r\n * @param otherVector the vector to compare against\r\n * @returns true if they are equal\r\n */\r\n Vector4.prototype.equals = function (otherVector) {\r\n return otherVector && this.x === otherVector.x && this.y === otherVector.y && this.z === otherVector.z && this.w === otherVector.w;\r\n };\r\n /**\r\n * Boolean : True if the current Vector4 coordinates are each beneath the distance \"epsilon\" from the given vector ones.\r\n * @param otherVector vector to compare against\r\n * @param epsilon (Default: very small number)\r\n * @returns true if they are equal\r\n */\r\n Vector4.prototype.equalsWithEpsilon = function (otherVector, epsilon) {\r\n if (epsilon === void 0) { epsilon = Epsilon; }\r\n return otherVector\r\n && Scalar.WithinEpsilon(this.x, otherVector.x, epsilon)\r\n && Scalar.WithinEpsilon(this.y, otherVector.y, epsilon)\r\n && Scalar.WithinEpsilon(this.z, otherVector.z, epsilon)\r\n && Scalar.WithinEpsilon(this.w, otherVector.w, epsilon);\r\n };\r\n /**\r\n * Boolean : True if the given floats are strictly equal to the current Vector4 coordinates.\r\n * @param x x value to compare against\r\n * @param y y value to compare against\r\n * @param z z value to compare against\r\n * @param w w value to compare against\r\n * @returns true if equal\r\n */\r\n Vector4.prototype.equalsToFloats = function (x, y, z, w) {\r\n return this.x === x && this.y === y && this.z === z && this.w === w;\r\n };\r\n /**\r\n * Multiplies in place the current Vector4 by the given one.\r\n * @param otherVector vector to multiple with\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.multiplyInPlace = function (otherVector) {\r\n this.x *= otherVector.x;\r\n this.y *= otherVector.y;\r\n this.z *= otherVector.z;\r\n this.w *= otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the multiplication result of the current Vector4 and the given one.\r\n * @param otherVector vector to multiple with\r\n * @returns resulting new vector\r\n */\r\n Vector4.prototype.multiply = function (otherVector) {\r\n return new Vector4(this.x * otherVector.x, this.y * otherVector.y, this.z * otherVector.z, this.w * otherVector.w);\r\n };\r\n /**\r\n * Updates the given vector \"result\" with the multiplication result of the current Vector4 and the given one.\r\n * @param otherVector vector to multiple with\r\n * @param result vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.multiplyToRef = function (otherVector, result) {\r\n result.x = this.x * otherVector.x;\r\n result.y = this.y * otherVector.y;\r\n result.z = this.z * otherVector.z;\r\n result.w = this.w * otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the multiplication result of the given floats and the current Vector4 coordinates.\r\n * @param x x value multiply with\r\n * @param y y value multiply with\r\n * @param z z value multiply with\r\n * @param w w value multiply with\r\n * @returns resulting new vector\r\n */\r\n Vector4.prototype.multiplyByFloats = function (x, y, z, w) {\r\n return new Vector4(this.x * x, this.y * y, this.z * z, this.w * w);\r\n };\r\n /**\r\n * Returns a new Vector4 set with the division result of the current Vector4 by the given one.\r\n * @param otherVector vector to devide with\r\n * @returns resulting new vector\r\n */\r\n Vector4.prototype.divide = function (otherVector) {\r\n return new Vector4(this.x / otherVector.x, this.y / otherVector.y, this.z / otherVector.z, this.w / otherVector.w);\r\n };\r\n /**\r\n * Updates the given vector \"result\" with the division result of the current Vector4 by the given one.\r\n * @param otherVector vector to devide with\r\n * @param result vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.divideToRef = function (otherVector, result) {\r\n result.x = this.x / otherVector.x;\r\n result.y = this.y / otherVector.y;\r\n result.z = this.z / otherVector.z;\r\n result.w = this.w / otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Divides the current Vector3 coordinates by the given ones.\r\n * @param otherVector vector to devide with\r\n * @returns the updated Vector3.\r\n */\r\n Vector4.prototype.divideInPlace = function (otherVector) {\r\n return this.divideToRef(otherVector, this);\r\n };\r\n /**\r\n * Updates the Vector4 coordinates with the minimum values between its own and the given vector ones\r\n * @param other defines the second operand\r\n * @returns the current updated Vector4\r\n */\r\n Vector4.prototype.minimizeInPlace = function (other) {\r\n if (other.x < this.x) {\r\n this.x = other.x;\r\n }\r\n if (other.y < this.y) {\r\n this.y = other.y;\r\n }\r\n if (other.z < this.z) {\r\n this.z = other.z;\r\n }\r\n if (other.w < this.w) {\r\n this.w = other.w;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the Vector4 coordinates with the maximum values between its own and the given vector ones\r\n * @param other defines the second operand\r\n * @returns the current updated Vector4\r\n */\r\n Vector4.prototype.maximizeInPlace = function (other) {\r\n if (other.x > this.x) {\r\n this.x = other.x;\r\n }\r\n if (other.y > this.y) {\r\n this.y = other.y;\r\n }\r\n if (other.z > this.z) {\r\n this.z = other.z;\r\n }\r\n if (other.w > this.w) {\r\n this.w = other.w;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector4 from current Vector4 floored values\r\n * @returns a new Vector4\r\n */\r\n Vector4.prototype.floor = function () {\r\n return new Vector4(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z), Math.floor(this.w));\r\n };\r\n /**\r\n * Gets a new Vector4 from current Vector3 floored values\r\n * @returns a new Vector4\r\n */\r\n Vector4.prototype.fract = function () {\r\n return new Vector4(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z), this.w - Math.floor(this.w));\r\n };\r\n // Properties\r\n /**\r\n * Returns the Vector4 length (float).\r\n * @returns the length\r\n */\r\n Vector4.prototype.length = function () {\r\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\r\n };\r\n /**\r\n * Returns the Vector4 squared length (float).\r\n * @returns the length squared\r\n */\r\n Vector4.prototype.lengthSquared = function () {\r\n return (this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\r\n };\r\n // Methods\r\n /**\r\n * Normalizes in place the Vector4.\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.normalize = function () {\r\n var len = this.length();\r\n if (len === 0) {\r\n return this;\r\n }\r\n return this.scaleInPlace(1.0 / len);\r\n };\r\n /**\r\n * Returns a new Vector3 from the Vector4 (x, y, z) coordinates.\r\n * @returns this converted to a new vector3\r\n */\r\n Vector4.prototype.toVector3 = function () {\r\n return new Vector3(this.x, this.y, this.z);\r\n };\r\n /**\r\n * Returns a new Vector4 copied from the current one.\r\n * @returns the new cloned vector\r\n */\r\n Vector4.prototype.clone = function () {\r\n return new Vector4(this.x, this.y, this.z, this.w);\r\n };\r\n /**\r\n * Updates the current Vector4 with the given one coordinates.\r\n * @param source the source vector to copy from\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.copyFrom = function (source) {\r\n this.x = source.x;\r\n this.y = source.y;\r\n this.z = source.z;\r\n this.w = source.w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current Vector4 coordinates with the given floats.\r\n * @param x float to copy from\r\n * @param y float to copy from\r\n * @param z float to copy from\r\n * @param w float to copy from\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.copyFromFloats = function (x, y, z, w) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n this.w = w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current Vector4 coordinates with the given floats.\r\n * @param x float to set from\r\n * @param y float to set from\r\n * @param z float to set from\r\n * @param w float to set from\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.set = function (x, y, z, w) {\r\n return this.copyFromFloats(x, y, z, w);\r\n };\r\n /**\r\n * Copies the given float to the current Vector3 coordinates\r\n * @param v defines the x, y, z and w coordinates of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector4.prototype.setAll = function (v) {\r\n this.x = this.y = this.z = this.w = v;\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Returns a new Vector4 set from the starting index of the given array.\r\n * @param array the array to pull values from\r\n * @param offset the offset into the array to start at\r\n * @returns the new vector\r\n */\r\n Vector4.FromArray = function (array, offset) {\r\n if (!offset) {\r\n offset = 0;\r\n }\r\n return new Vector4(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\r\n };\r\n /**\r\n * Updates the given vector \"result\" from the starting index of the given array.\r\n * @param array the array to pull values from\r\n * @param offset the offset into the array to start at\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.FromArrayToRef = function (array, offset, result) {\r\n result.x = array[offset];\r\n result.y = array[offset + 1];\r\n result.z = array[offset + 2];\r\n result.w = array[offset + 3];\r\n };\r\n /**\r\n * Updates the given vector \"result\" from the starting index of the given Float32Array.\r\n * @param array the array to pull values from\r\n * @param offset the offset into the array to start at\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.FromFloatArrayToRef = function (array, offset, result) {\r\n Vector4.FromArrayToRef(array, offset, result);\r\n };\r\n /**\r\n * Updates the given vector \"result\" coordinates from the given floats.\r\n * @param x float to set from\r\n * @param y float to set from\r\n * @param z float to set from\r\n * @param w float to set from\r\n * @param result the vector to the floats in\r\n */\r\n Vector4.FromFloatsToRef = function (x, y, z, w, result) {\r\n result.x = x;\r\n result.y = y;\r\n result.z = z;\r\n result.w = w;\r\n };\r\n /**\r\n * Returns a new Vector4 set to (0.0, 0.0, 0.0, 0.0)\r\n * @returns the new vector\r\n */\r\n Vector4.Zero = function () {\r\n return new Vector4(0.0, 0.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector4 set to (1.0, 1.0, 1.0, 1.0)\r\n * @returns the new vector\r\n */\r\n Vector4.One = function () {\r\n return new Vector4(1.0, 1.0, 1.0, 1.0);\r\n };\r\n /**\r\n * Returns a new normalized Vector4 from the given one.\r\n * @param vector the vector to normalize\r\n * @returns the vector\r\n */\r\n Vector4.Normalize = function (vector) {\r\n var result = Vector4.Zero();\r\n Vector4.NormalizeToRef(vector, result);\r\n return result;\r\n };\r\n /**\r\n * Updates the given vector \"result\" from the normalization of the given one.\r\n * @param vector the vector to normalize\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.NormalizeToRef = function (vector, result) {\r\n result.copyFrom(vector);\r\n result.normalize();\r\n };\r\n /**\r\n * Returns a vector with the minimum values from the left and right vectors\r\n * @param left left vector to minimize\r\n * @param right right vector to minimize\r\n * @returns a new vector with the minimum of the left and right vector values\r\n */\r\n Vector4.Minimize = function (left, right) {\r\n var min = left.clone();\r\n min.minimizeInPlace(right);\r\n return min;\r\n };\r\n /**\r\n * Returns a vector with the maximum values from the left and right vectors\r\n * @param left left vector to maximize\r\n * @param right right vector to maximize\r\n * @returns a new vector with the maximum of the left and right vector values\r\n */\r\n Vector4.Maximize = function (left, right) {\r\n var max = left.clone();\r\n max.maximizeInPlace(right);\r\n return max;\r\n };\r\n /**\r\n * Returns the distance (float) between the vectors \"value1\" and \"value2\".\r\n * @param value1 value to calulate the distance between\r\n * @param value2 value to calulate the distance between\r\n * @return the distance between the two vectors\r\n */\r\n Vector4.Distance = function (value1, value2) {\r\n return Math.sqrt(Vector4.DistanceSquared(value1, value2));\r\n };\r\n /**\r\n * Returns the squared distance (float) between the vectors \"value1\" and \"value2\".\r\n * @param value1 value to calulate the distance between\r\n * @param value2 value to calulate the distance between\r\n * @return the distance between the two vectors squared\r\n */\r\n Vector4.DistanceSquared = function (value1, value2) {\r\n var x = value1.x - value2.x;\r\n var y = value1.y - value2.y;\r\n var z = value1.z - value2.z;\r\n var w = value1.w - value2.w;\r\n return (x * x) + (y * y) + (z * z) + (w * w);\r\n };\r\n /**\r\n * Returns a new Vector4 located at the center between the vectors \"value1\" and \"value2\".\r\n * @param value1 value to calulate the center between\r\n * @param value2 value to calulate the center between\r\n * @return the center between the two vectors\r\n */\r\n Vector4.Center = function (value1, value2) {\r\n var center = value1.add(value2);\r\n center.scaleInPlace(0.5);\r\n return center;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the result of the normal transformation by the given matrix of the given vector.\r\n * This methods computes transformed normalized direction vectors only.\r\n * @param vector the vector to transform\r\n * @param transformation the transformation matrix to apply\r\n * @returns the new vector\r\n */\r\n Vector4.TransformNormal = function (vector, transformation) {\r\n var result = Vector4.Zero();\r\n Vector4.TransformNormalToRef(vector, transformation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given vector.\r\n * This methods computes transformed normalized direction vectors only.\r\n * @param vector the vector to transform\r\n * @param transformation the transformation matrix to apply\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.TransformNormalToRef = function (vector, transformation, result) {\r\n var m = transformation.m;\r\n var x = (vector.x * m[0]) + (vector.y * m[4]) + (vector.z * m[8]);\r\n var y = (vector.x * m[1]) + (vector.y * m[5]) + (vector.z * m[9]);\r\n var z = (vector.x * m[2]) + (vector.y * m[6]) + (vector.z * m[10]);\r\n result.x = x;\r\n result.y = y;\r\n result.z = z;\r\n result.w = vector.w;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given floats (x, y, z, w).\r\n * This methods computes transformed normalized direction vectors only.\r\n * @param x value to transform\r\n * @param y value to transform\r\n * @param z value to transform\r\n * @param w value to transform\r\n * @param transformation the transformation matrix to apply\r\n * @param result the vector to store the results in\r\n */\r\n Vector4.TransformNormalFromFloatsToRef = function (x, y, z, w, transformation, result) {\r\n var m = transformation.m;\r\n result.x = (x * m[0]) + (y * m[4]) + (z * m[8]);\r\n result.y = (x * m[1]) + (y * m[5]) + (z * m[9]);\r\n result.z = (x * m[2]) + (y * m[6]) + (z * m[10]);\r\n result.w = w;\r\n };\r\n /**\r\n * Creates a new Vector4 from a Vector3\r\n * @param source defines the source data\r\n * @param w defines the 4th component (default is 0)\r\n * @returns a new Vector4\r\n */\r\n Vector4.FromVector3 = function (source, w) {\r\n if (w === void 0) { w = 0; }\r\n return new Vector4(source._x, source._y, source._z, w);\r\n };\r\n return Vector4;\r\n}());\r\nexport { Vector4 };\r\n/**\r\n * Class used to store quaternion data\r\n * @see https://en.wikipedia.org/wiki/Quaternion\r\n * @see https://doc.babylonjs.com/features/position,_rotation,_scaling\r\n */\r\nvar Quaternion = /** @class */ (function () {\r\n /**\r\n * Creates a new Quaternion from the given floats\r\n * @param x defines the first component (0 by default)\r\n * @param y defines the second component (0 by default)\r\n * @param z defines the third component (0 by default)\r\n * @param w defines the fourth component (1.0 by default)\r\n */\r\n function Quaternion(x, y, z, w) {\r\n if (x === void 0) { x = 0.0; }\r\n if (y === void 0) { y = 0.0; }\r\n if (z === void 0) { z = 0.0; }\r\n if (w === void 0) { w = 1.0; }\r\n /** @hidden */\r\n this._isDirty = true;\r\n this._x = x;\r\n this._y = y;\r\n this._z = z;\r\n this._w = w;\r\n }\r\n Object.defineProperty(Quaternion.prototype, \"x\", {\r\n /** Gets or sets the x coordinate */\r\n get: function () {\r\n return this._x;\r\n },\r\n set: function (value) {\r\n this._x = value;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Quaternion.prototype, \"y\", {\r\n /** Gets or sets the y coordinate */\r\n get: function () {\r\n return this._y;\r\n },\r\n set: function (value) {\r\n this._y = value;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Quaternion.prototype, \"z\", {\r\n /** Gets or sets the z coordinate */\r\n get: function () {\r\n return this._z;\r\n },\r\n set: function (value) {\r\n this._z = value;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Quaternion.prototype, \"w\", {\r\n /** Gets or sets the w coordinate */\r\n get: function () {\r\n return this._w;\r\n },\r\n set: function (value) {\r\n this._w = value;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string representation for the current quaternion\r\n * @returns a string with the Quaternion coordinates\r\n */\r\n Quaternion.prototype.toString = function () {\r\n return \"{X: \" + this._x + \" Y:\" + this._y + \" Z:\" + this._z + \" W:\" + this._w + \"}\";\r\n };\r\n /**\r\n * Gets the class name of the quaternion\r\n * @returns the string \"Quaternion\"\r\n */\r\n Quaternion.prototype.getClassName = function () {\r\n return \"Quaternion\";\r\n };\r\n /**\r\n * Gets a hash code for this quaternion\r\n * @returns the quaternion hash code\r\n */\r\n Quaternion.prototype.getHashCode = function () {\r\n var hash = this._x | 0;\r\n hash = (hash * 397) ^ (this._y | 0);\r\n hash = (hash * 397) ^ (this._z | 0);\r\n hash = (hash * 397) ^ (this._w | 0);\r\n return hash;\r\n };\r\n /**\r\n * Copy the quaternion to an array\r\n * @returns a new array populated with 4 elements from the quaternion coordinates\r\n */\r\n Quaternion.prototype.asArray = function () {\r\n return [this._x, this._y, this._z, this._w];\r\n };\r\n /**\r\n * Check if two quaternions are equals\r\n * @param otherQuaternion defines the second operand\r\n * @return true if the current quaternion and the given one coordinates are strictly equals\r\n */\r\n Quaternion.prototype.equals = function (otherQuaternion) {\r\n return otherQuaternion && this._x === otherQuaternion._x && this._y === otherQuaternion._y && this._z === otherQuaternion._z && this._w === otherQuaternion._w;\r\n };\r\n /**\r\n * Gets a boolean if two quaternions are equals (using an epsilon value)\r\n * @param otherQuaternion defines the other quaternion\r\n * @param epsilon defines the minimal distance to consider equality\r\n * @returns true if the given quaternion coordinates are close to the current ones by a distance of epsilon.\r\n */\r\n Quaternion.prototype.equalsWithEpsilon = function (otherQuaternion, epsilon) {\r\n if (epsilon === void 0) { epsilon = Epsilon; }\r\n return otherQuaternion\r\n && Scalar.WithinEpsilon(this._x, otherQuaternion._x, epsilon)\r\n && Scalar.WithinEpsilon(this._y, otherQuaternion._y, epsilon)\r\n && Scalar.WithinEpsilon(this._z, otherQuaternion._z, epsilon)\r\n && Scalar.WithinEpsilon(this._w, otherQuaternion._w, epsilon);\r\n };\r\n /**\r\n * Clone the current quaternion\r\n * @returns a new quaternion copied from the current one\r\n */\r\n Quaternion.prototype.clone = function () {\r\n return new Quaternion(this._x, this._y, this._z, this._w);\r\n };\r\n /**\r\n * Copy a quaternion to the current one\r\n * @param other defines the other quaternion\r\n * @returns the updated current quaternion\r\n */\r\n Quaternion.prototype.copyFrom = function (other) {\r\n this.x = other._x;\r\n this.y = other._y;\r\n this.z = other._z;\r\n this.w = other._w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion with the given float coordinates\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n * @param z defines the z coordinate\r\n * @param w defines the w coordinate\r\n * @returns the updated current quaternion\r\n */\r\n Quaternion.prototype.copyFromFloats = function (x, y, z, w) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n this.w = w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion from the given float coordinates\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n * @param z defines the z coordinate\r\n * @param w defines the w coordinate\r\n * @returns the updated current quaternion\r\n */\r\n Quaternion.prototype.set = function (x, y, z, w) {\r\n return this.copyFromFloats(x, y, z, w);\r\n };\r\n /**\r\n * Adds two quaternions\r\n * @param other defines the second operand\r\n * @returns a new quaternion as the addition result of the given one and the current quaternion\r\n */\r\n Quaternion.prototype.add = function (other) {\r\n return new Quaternion(this._x + other._x, this._y + other._y, this._z + other._z, this._w + other._w);\r\n };\r\n /**\r\n * Add a quaternion to the current one\r\n * @param other defines the quaternion to add\r\n * @returns the current quaternion\r\n */\r\n Quaternion.prototype.addInPlace = function (other) {\r\n this._x += other._x;\r\n this._y += other._y;\r\n this._z += other._z;\r\n this._w += other._w;\r\n return this;\r\n };\r\n /**\r\n * Subtract two quaternions\r\n * @param other defines the second operand\r\n * @returns a new quaternion as the subtraction result of the given one from the current one\r\n */\r\n Quaternion.prototype.subtract = function (other) {\r\n return new Quaternion(this._x - other._x, this._y - other._y, this._z - other._z, this._w - other._w);\r\n };\r\n /**\r\n * Multiplies the current quaternion by a scale factor\r\n * @param value defines the scale factor\r\n * @returns a new quaternion set by multiplying the current quaternion coordinates by the float \"scale\"\r\n */\r\n Quaternion.prototype.scale = function (value) {\r\n return new Quaternion(this._x * value, this._y * value, this._z * value, this._w * value);\r\n };\r\n /**\r\n * Scale the current quaternion values by a factor and stores the result to a given quaternion\r\n * @param scale defines the scale factor\r\n * @param result defines the Quaternion object where to store the result\r\n * @returns the unmodified current quaternion\r\n */\r\n Quaternion.prototype.scaleToRef = function (scale, result) {\r\n result.x = this._x * scale;\r\n result.y = this._y * scale;\r\n result.z = this._z * scale;\r\n result.w = this._w * scale;\r\n return this;\r\n };\r\n /**\r\n * Multiplies in place the current quaternion by a scale factor\r\n * @param value defines the scale factor\r\n * @returns the current modified quaternion\r\n */\r\n Quaternion.prototype.scaleInPlace = function (value) {\r\n this.x *= value;\r\n this.y *= value;\r\n this.z *= value;\r\n this.w *= value;\r\n return this;\r\n };\r\n /**\r\n * Scale the current quaternion values by a factor and add the result to a given quaternion\r\n * @param scale defines the scale factor\r\n * @param result defines the Quaternion object where to store the result\r\n * @returns the unmodified current quaternion\r\n */\r\n Quaternion.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.x += this._x * scale;\r\n result.y += this._y * scale;\r\n result.z += this._z * scale;\r\n result.w += this._w * scale;\r\n return this;\r\n };\r\n /**\r\n * Multiplies two quaternions\r\n * @param q1 defines the second operand\r\n * @returns a new quaternion set as the multiplication result of the current one with the given one \"q1\"\r\n */\r\n Quaternion.prototype.multiply = function (q1) {\r\n var result = new Quaternion(0, 0, 0, 1.0);\r\n this.multiplyToRef(q1, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given \"result\" as the the multiplication result of the current one with the given one \"q1\"\r\n * @param q1 defines the second operand\r\n * @param result defines the target quaternion\r\n * @returns the current quaternion\r\n */\r\n Quaternion.prototype.multiplyToRef = function (q1, result) {\r\n var x = this._x * q1._w + this._y * q1._z - this._z * q1._y + this._w * q1._x;\r\n var y = -this._x * q1._z + this._y * q1._w + this._z * q1._x + this._w * q1._y;\r\n var z = this._x * q1._y - this._y * q1._x + this._z * q1._w + this._w * q1._z;\r\n var w = -this._x * q1._x - this._y * q1._y - this._z * q1._z + this._w * q1._w;\r\n result.copyFromFloats(x, y, z, w);\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion with the multiplication of itself with the given one \"q1\"\r\n * @param q1 defines the second operand\r\n * @returns the currentupdated quaternion\r\n */\r\n Quaternion.prototype.multiplyInPlace = function (q1) {\r\n this.multiplyToRef(q1, this);\r\n return this;\r\n };\r\n /**\r\n * Conjugates (1-q) the current quaternion and stores the result in the given quaternion\r\n * @param ref defines the target quaternion\r\n * @returns the current quaternion\r\n */\r\n Quaternion.prototype.conjugateToRef = function (ref) {\r\n ref.copyFromFloats(-this._x, -this._y, -this._z, this._w);\r\n return this;\r\n };\r\n /**\r\n * Conjugates in place (1-q) the current quaternion\r\n * @returns the current updated quaternion\r\n */\r\n Quaternion.prototype.conjugateInPlace = function () {\r\n this.x *= -1;\r\n this.y *= -1;\r\n this.z *= -1;\r\n return this;\r\n };\r\n /**\r\n * Conjugates in place (1-q) the current quaternion\r\n * @returns a new quaternion\r\n */\r\n Quaternion.prototype.conjugate = function () {\r\n var result = new Quaternion(-this._x, -this._y, -this._z, this._w);\r\n return result;\r\n };\r\n /**\r\n * Gets length of current quaternion\r\n * @returns the quaternion length (float)\r\n */\r\n Quaternion.prototype.length = function () {\r\n return Math.sqrt((this._x * this._x) + (this._y * this._y) + (this._z * this._z) + (this._w * this._w));\r\n };\r\n /**\r\n * Normalize in place the current quaternion\r\n * @returns the current updated quaternion\r\n */\r\n Quaternion.prototype.normalize = function () {\r\n var len = this.length();\r\n if (len === 0) {\r\n return this;\r\n }\r\n var inv = 1.0 / len;\r\n this.x *= inv;\r\n this.y *= inv;\r\n this.z *= inv;\r\n this.w *= inv;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the Euler angles translated from the current quaternion\r\n * @param order is a reserved parameter and is ignored for now\r\n * @returns a new Vector3 containing the Euler angles\r\n */\r\n Quaternion.prototype.toEulerAngles = function (order) {\r\n if (order === void 0) { order = \"YZX\"; }\r\n var result = Vector3.Zero();\r\n this.toEulerAnglesToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector3 \"result\" with the Euler angles translated from the current quaternion\r\n * @param result defines the vector which will be filled with the Euler angles\r\n * @returns the current unchanged quaternion\r\n */\r\n Quaternion.prototype.toEulerAnglesToRef = function (result) {\r\n var qz = this._z;\r\n var qx = this._x;\r\n var qy = this._y;\r\n var qw = this._w;\r\n var sqw = qw * qw;\r\n var sqz = qz * qz;\r\n var sqx = qx * qx;\r\n var sqy = qy * qy;\r\n var zAxisY = qy * qz - qx * qw;\r\n var limit = .4999999;\r\n if (zAxisY < -limit) {\r\n result.y = 2 * Math.atan2(qy, qw);\r\n result.x = Math.PI / 2;\r\n result.z = 0;\r\n }\r\n else if (zAxisY > limit) {\r\n result.y = 2 * Math.atan2(qy, qw);\r\n result.x = -Math.PI / 2;\r\n result.z = 0;\r\n }\r\n else {\r\n result.z = Math.atan2(2.0 * (qx * qy + qz * qw), (-sqz - sqx + sqy + sqw));\r\n result.x = Math.asin(-2.0 * (qz * qy - qx * qw));\r\n result.y = Math.atan2(2.0 * (qz * qx + qy * qw), (sqz - sqx - sqy + sqw));\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the given rotation matrix with the current quaternion values\r\n * @param result defines the target matrix\r\n * @returns the current unchanged quaternion\r\n */\r\n Quaternion.prototype.toRotationMatrix = function (result) {\r\n Matrix.FromQuaternionToRef(this, result);\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion from the given rotation matrix values\r\n * @param matrix defines the source matrix\r\n * @returns the current updated quaternion\r\n */\r\n Quaternion.prototype.fromRotationMatrix = function (matrix) {\r\n Quaternion.FromRotationMatrixToRef(matrix, this);\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Creates a new quaternion from a rotation matrix\r\n * @param matrix defines the source matrix\r\n * @returns a new quaternion created from the given rotation matrix values\r\n */\r\n Quaternion.FromRotationMatrix = function (matrix) {\r\n var result = new Quaternion();\r\n Quaternion.FromRotationMatrixToRef(matrix, result);\r\n return result;\r\n };\r\n /**\r\n * Updates the given quaternion with the given rotation matrix values\r\n * @param matrix defines the source matrix\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.FromRotationMatrixToRef = function (matrix, result) {\r\n var data = matrix.m;\r\n var m11 = data[0], m12 = data[4], m13 = data[8];\r\n var m21 = data[1], m22 = data[5], m23 = data[9];\r\n var m31 = data[2], m32 = data[6], m33 = data[10];\r\n var trace = m11 + m22 + m33;\r\n var s;\r\n if (trace > 0) {\r\n s = 0.5 / Math.sqrt(trace + 1.0);\r\n result.w = 0.25 / s;\r\n result.x = (m32 - m23) * s;\r\n result.y = (m13 - m31) * s;\r\n result.z = (m21 - m12) * s;\r\n }\r\n else if (m11 > m22 && m11 > m33) {\r\n s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33);\r\n result.w = (m32 - m23) / s;\r\n result.x = 0.25 * s;\r\n result.y = (m12 + m21) / s;\r\n result.z = (m13 + m31) / s;\r\n }\r\n else if (m22 > m33) {\r\n s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33);\r\n result.w = (m13 - m31) / s;\r\n result.x = (m12 + m21) / s;\r\n result.y = 0.25 * s;\r\n result.z = (m23 + m32) / s;\r\n }\r\n else {\r\n s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22);\r\n result.w = (m21 - m12) / s;\r\n result.x = (m13 + m31) / s;\r\n result.y = (m23 + m32) / s;\r\n result.z = 0.25 * s;\r\n }\r\n };\r\n /**\r\n * Returns the dot product (float) between the quaternions \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @returns the dot product\r\n */\r\n Quaternion.Dot = function (left, right) {\r\n return (left._x * right._x + left._y * right._y + left._z * right._z + left._w * right._w);\r\n };\r\n /**\r\n * Checks if the two quaternions are close to each other\r\n * @param quat0 defines the first quaternion to check\r\n * @param quat1 defines the second quaternion to check\r\n * @returns true if the two quaternions are close to each other\r\n */\r\n Quaternion.AreClose = function (quat0, quat1) {\r\n var dot = Quaternion.Dot(quat0, quat1);\r\n return dot >= 0;\r\n };\r\n /**\r\n * Creates an empty quaternion\r\n * @returns a new quaternion set to (0.0, 0.0, 0.0)\r\n */\r\n Quaternion.Zero = function () {\r\n return new Quaternion(0.0, 0.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Inverse a given quaternion\r\n * @param q defines the source quaternion\r\n * @returns a new quaternion as the inverted current quaternion\r\n */\r\n Quaternion.Inverse = function (q) {\r\n return new Quaternion(-q._x, -q._y, -q._z, q._w);\r\n };\r\n /**\r\n * Inverse a given quaternion\r\n * @param q defines the source quaternion\r\n * @param result the quaternion the result will be stored in\r\n * @returns the result quaternion\r\n */\r\n Quaternion.InverseToRef = function (q, result) {\r\n result.set(-q._x, -q._y, -q._z, q._w);\r\n return result;\r\n };\r\n /**\r\n * Creates an identity quaternion\r\n * @returns the identity quaternion\r\n */\r\n Quaternion.Identity = function () {\r\n return new Quaternion(0.0, 0.0, 0.0, 1.0);\r\n };\r\n /**\r\n * Gets a boolean indicating if the given quaternion is identity\r\n * @param quaternion defines the quaternion to check\r\n * @returns true if the quaternion is identity\r\n */\r\n Quaternion.IsIdentity = function (quaternion) {\r\n return quaternion && quaternion._x === 0 && quaternion._y === 0 && quaternion._z === 0 && quaternion._w === 1;\r\n };\r\n /**\r\n * Creates a quaternion from a rotation around an axis\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle to use\r\n * @returns a new quaternion created from the given axis (Vector3) and angle in radians (float)\r\n */\r\n Quaternion.RotationAxis = function (axis, angle) {\r\n return Quaternion.RotationAxisToRef(axis, angle, new Quaternion());\r\n };\r\n /**\r\n * Creates a rotation around an axis and stores it into the given quaternion\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle to use\r\n * @param result defines the target quaternion\r\n * @returns the target quaternion\r\n */\r\n Quaternion.RotationAxisToRef = function (axis, angle, result) {\r\n var sin = Math.sin(angle / 2);\r\n axis.normalize();\r\n result.w = Math.cos(angle / 2);\r\n result.x = axis._x * sin;\r\n result.y = axis._y * sin;\r\n result.z = axis._z * sin;\r\n return result;\r\n };\r\n /**\r\n * Creates a new quaternion from data stored into an array\r\n * @param array defines the data source\r\n * @param offset defines the offset in the source array where the data starts\r\n * @returns a new quaternion\r\n */\r\n Quaternion.FromArray = function (array, offset) {\r\n if (!offset) {\r\n offset = 0;\r\n }\r\n return new Quaternion(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\r\n };\r\n /**\r\n * Updates the given quaternion \"result\" from the starting index of the given array.\r\n * @param array the array to pull values from\r\n * @param offset the offset into the array to start at\r\n * @param result the quaternion to store the result in\r\n */\r\n Quaternion.FromArrayToRef = function (array, offset, result) {\r\n result.x = array[offset];\r\n result.y = array[offset + 1];\r\n result.z = array[offset + 2];\r\n result.w = array[offset + 3];\r\n };\r\n /**\r\n * Create a quaternion from Euler rotation angles\r\n * @param x Pitch\r\n * @param y Yaw\r\n * @param z Roll\r\n * @returns the new Quaternion\r\n */\r\n Quaternion.FromEulerAngles = function (x, y, z) {\r\n var q = new Quaternion();\r\n Quaternion.RotationYawPitchRollToRef(y, x, z, q);\r\n return q;\r\n };\r\n /**\r\n * Updates a quaternion from Euler rotation angles\r\n * @param x Pitch\r\n * @param y Yaw\r\n * @param z Roll\r\n * @param result the quaternion to store the result\r\n * @returns the updated quaternion\r\n */\r\n Quaternion.FromEulerAnglesToRef = function (x, y, z, result) {\r\n Quaternion.RotationYawPitchRollToRef(y, x, z, result);\r\n return result;\r\n };\r\n /**\r\n * Create a quaternion from Euler rotation vector\r\n * @param vec the Euler vector (x Pitch, y Yaw, z Roll)\r\n * @returns the new Quaternion\r\n */\r\n Quaternion.FromEulerVector = function (vec) {\r\n var q = new Quaternion();\r\n Quaternion.RotationYawPitchRollToRef(vec._y, vec._x, vec._z, q);\r\n return q;\r\n };\r\n /**\r\n * Updates a quaternion from Euler rotation vector\r\n * @param vec the Euler vector (x Pitch, y Yaw, z Roll)\r\n * @param result the quaternion to store the result\r\n * @returns the updated quaternion\r\n */\r\n Quaternion.FromEulerVectorToRef = function (vec, result) {\r\n Quaternion.RotationYawPitchRollToRef(vec._y, vec._x, vec._z, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new quaternion from the given Euler float angles (y, x, z)\r\n * @param yaw defines the rotation around Y axis\r\n * @param pitch defines the rotation around X axis\r\n * @param roll defines the rotation around Z axis\r\n * @returns the new quaternion\r\n */\r\n Quaternion.RotationYawPitchRoll = function (yaw, pitch, roll) {\r\n var q = new Quaternion();\r\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, q);\r\n return q;\r\n };\r\n /**\r\n * Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion\r\n * @param yaw defines the rotation around Y axis\r\n * @param pitch defines the rotation around X axis\r\n * @param roll defines the rotation around Z axis\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {\r\n // Produces a quaternion from Euler angles in the z-y-x orientation (Tait-Bryan angles)\r\n var halfRoll = roll * 0.5;\r\n var halfPitch = pitch * 0.5;\r\n var halfYaw = yaw * 0.5;\r\n var sinRoll = Math.sin(halfRoll);\r\n var cosRoll = Math.cos(halfRoll);\r\n var sinPitch = Math.sin(halfPitch);\r\n var cosPitch = Math.cos(halfPitch);\r\n var sinYaw = Math.sin(halfYaw);\r\n var cosYaw = Math.cos(halfYaw);\r\n result.x = (cosYaw * sinPitch * cosRoll) + (sinYaw * cosPitch * sinRoll);\r\n result.y = (sinYaw * cosPitch * cosRoll) - (cosYaw * sinPitch * sinRoll);\r\n result.z = (cosYaw * cosPitch * sinRoll) - (sinYaw * sinPitch * cosRoll);\r\n result.w = (cosYaw * cosPitch * cosRoll) + (sinYaw * sinPitch * sinRoll);\r\n };\r\n /**\r\n * Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation\r\n * @param alpha defines the rotation around first axis\r\n * @param beta defines the rotation around second axis\r\n * @param gamma defines the rotation around third axis\r\n * @returns the new quaternion\r\n */\r\n Quaternion.RotationAlphaBetaGamma = function (alpha, beta, gamma) {\r\n var result = new Quaternion();\r\n Quaternion.RotationAlphaBetaGammaToRef(alpha, beta, gamma, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation and stores it in the target quaternion\r\n * @param alpha defines the rotation around first axis\r\n * @param beta defines the rotation around second axis\r\n * @param gamma defines the rotation around third axis\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.RotationAlphaBetaGammaToRef = function (alpha, beta, gamma, result) {\r\n // Produces a quaternion from Euler angles in the z-x-z orientation\r\n var halfGammaPlusAlpha = (gamma + alpha) * 0.5;\r\n var halfGammaMinusAlpha = (gamma - alpha) * 0.5;\r\n var halfBeta = beta * 0.5;\r\n result.x = Math.cos(halfGammaMinusAlpha) * Math.sin(halfBeta);\r\n result.y = Math.sin(halfGammaMinusAlpha) * Math.sin(halfBeta);\r\n result.z = Math.sin(halfGammaPlusAlpha) * Math.cos(halfBeta);\r\n result.w = Math.cos(halfGammaPlusAlpha) * Math.cos(halfBeta);\r\n };\r\n /**\r\n * Creates a new quaternion containing the rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation)\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @returns the new quaternion\r\n */\r\n Quaternion.RotationQuaternionFromAxis = function (axis1, axis2, axis3) {\r\n var quat = new Quaternion(0.0, 0.0, 0.0, 0.0);\r\n Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, quat);\r\n return quat;\r\n };\r\n /**\r\n * Creates a rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation) and stores it in the target quaternion\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @param ref defines the target quaternion\r\n */\r\n Quaternion.RotationQuaternionFromAxisToRef = function (axis1, axis2, axis3, ref) {\r\n var rotMat = MathTmp.Matrix[0];\r\n Matrix.FromXYZAxesToRef(axis1.normalize(), axis2.normalize(), axis3.normalize(), rotMat);\r\n Quaternion.FromRotationMatrixToRef(rotMat, ref);\r\n };\r\n /**\r\n * Interpolates between two quaternions\r\n * @param left defines first quaternion\r\n * @param right defines second quaternion\r\n * @param amount defines the gradient to use\r\n * @returns the new interpolated quaternion\r\n */\r\n Quaternion.Slerp = function (left, right, amount) {\r\n var result = Quaternion.Identity();\r\n Quaternion.SlerpToRef(left, right, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Interpolates between two quaternions and stores it into a target quaternion\r\n * @param left defines first quaternion\r\n * @param right defines second quaternion\r\n * @param amount defines the gradient to use\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.SlerpToRef = function (left, right, amount, result) {\r\n var num2;\r\n var num3;\r\n var num4 = (((left._x * right._x) + (left._y * right._y)) + (left._z * right._z)) + (left._w * right._w);\r\n var flag = false;\r\n if (num4 < 0) {\r\n flag = true;\r\n num4 = -num4;\r\n }\r\n if (num4 > 0.999999) {\r\n num3 = 1 - amount;\r\n num2 = flag ? -amount : amount;\r\n }\r\n else {\r\n var num5 = Math.acos(num4);\r\n var num6 = (1.0 / Math.sin(num5));\r\n num3 = (Math.sin((1.0 - amount) * num5)) * num6;\r\n num2 = flag ? ((-Math.sin(amount * num5)) * num6) : ((Math.sin(amount * num5)) * num6);\r\n }\r\n result.x = (num3 * left._x) + (num2 * right._x);\r\n result.y = (num3 * left._y) + (num2 * right._y);\r\n result.z = (num3 * left._z) + (num2 * right._z);\r\n result.w = (num3 * left._w) + (num2 * right._w);\r\n };\r\n /**\r\n * Interpolate between two quaternions using Hermite interpolation\r\n * @param value1 defines first quaternion\r\n * @param tangent1 defines the incoming tangent\r\n * @param value2 defines second quaternion\r\n * @param tangent2 defines the outgoing tangent\r\n * @param amount defines the target quaternion\r\n * @returns the new interpolated quaternion\r\n */\r\n Quaternion.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n var x = (((value1._x * part1) + (value2._x * part2)) + (tangent1._x * part3)) + (tangent2._x * part4);\r\n var y = (((value1._y * part1) + (value2._y * part2)) + (tangent1._y * part3)) + (tangent2._y * part4);\r\n var z = (((value1._z * part1) + (value2._z * part2)) + (tangent1._z * part3)) + (tangent2._z * part4);\r\n var w = (((value1._w * part1) + (value2._w * part2)) + (tangent1._w * part3)) + (tangent2._w * part4);\r\n return new Quaternion(x, y, z, w);\r\n };\r\n return Quaternion;\r\n}());\r\nexport { Quaternion };\r\n/**\r\n * Class used to store matrix data (4x4)\r\n */\r\nvar Matrix = /** @class */ (function () {\r\n /**\r\n * Creates an empty matrix (filled with zeros)\r\n */\r\n function Matrix() {\r\n this._isIdentity = false;\r\n this._isIdentityDirty = true;\r\n this._isIdentity3x2 = true;\r\n this._isIdentity3x2Dirty = true;\r\n /**\r\n * Gets the update flag of the matrix which is an unique number for the matrix.\r\n * It will be incremented every time the matrix data change.\r\n * You can use it to speed the comparison between two versions of the same matrix.\r\n */\r\n this.updateFlag = -1;\r\n if (PerformanceConfigurator.MatrixTrackPrecisionChange) {\r\n PerformanceConfigurator.MatrixTrackedMatrices.push(this);\r\n }\r\n this._m = new PerformanceConfigurator.MatrixCurrentType(16);\r\n this._updateIdentityStatus(false);\r\n }\r\n Object.defineProperty(Matrix, \"Use64Bits\", {\r\n /**\r\n * Gets the precision of matrix computations\r\n */\r\n get: function () {\r\n return PerformanceConfigurator.MatrixUse64Bits;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Matrix.prototype, \"m\", {\r\n /**\r\n * Gets the internal data of the matrix\r\n */\r\n get: function () { return this._m; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Matrix.prototype._markAsUpdated = function () {\r\n this.updateFlag = Matrix._updateFlagSeed++;\r\n this._isIdentity = false;\r\n this._isIdentity3x2 = false;\r\n this._isIdentityDirty = true;\r\n this._isIdentity3x2Dirty = true;\r\n };\r\n /** @hidden */\r\n Matrix.prototype._updateIdentityStatus = function (isIdentity, isIdentityDirty, isIdentity3x2, isIdentity3x2Dirty) {\r\n if (isIdentityDirty === void 0) { isIdentityDirty = false; }\r\n if (isIdentity3x2 === void 0) { isIdentity3x2 = false; }\r\n if (isIdentity3x2Dirty === void 0) { isIdentity3x2Dirty = true; }\r\n this.updateFlag = Matrix._updateFlagSeed++;\r\n this._isIdentity = isIdentity;\r\n this._isIdentity3x2 = isIdentity || isIdentity3x2;\r\n this._isIdentityDirty = this._isIdentity ? false : isIdentityDirty;\r\n this._isIdentity3x2Dirty = this._isIdentity3x2 ? false : isIdentity3x2Dirty;\r\n };\r\n // Properties\r\n /**\r\n * Check if the current matrix is identity\r\n * @returns true is the matrix is the identity matrix\r\n */\r\n Matrix.prototype.isIdentity = function () {\r\n if (this._isIdentityDirty) {\r\n this._isIdentityDirty = false;\r\n var m = this._m;\r\n this._isIdentity = (m[0] === 1.0 && m[1] === 0.0 && m[2] === 0.0 && m[3] === 0.0 &&\r\n m[4] === 0.0 && m[5] === 1.0 && m[6] === 0.0 && m[7] === 0.0 &&\r\n m[8] === 0.0 && m[9] === 0.0 && m[10] === 1.0 && m[11] === 0.0 &&\r\n m[12] === 0.0 && m[13] === 0.0 && m[14] === 0.0 && m[15] === 1.0);\r\n }\r\n return this._isIdentity;\r\n };\r\n /**\r\n * Check if the current matrix is identity as a texture matrix (3x2 store in 4x4)\r\n * @returns true is the matrix is the identity matrix\r\n */\r\n Matrix.prototype.isIdentityAs3x2 = function () {\r\n if (this._isIdentity3x2Dirty) {\r\n this._isIdentity3x2Dirty = false;\r\n if (this._m[0] !== 1.0 || this._m[5] !== 1.0 || this._m[15] !== 1.0) {\r\n this._isIdentity3x2 = false;\r\n }\r\n else if (this._m[1] !== 0.0 || this._m[2] !== 0.0 || this._m[3] !== 0.0 ||\r\n this._m[4] !== 0.0 || this._m[6] !== 0.0 || this._m[7] !== 0.0 ||\r\n this._m[8] !== 0.0 || this._m[9] !== 0.0 || this._m[10] !== 0.0 || this._m[11] !== 0.0 ||\r\n this._m[12] !== 0.0 || this._m[13] !== 0.0 || this._m[14] !== 0.0) {\r\n this._isIdentity3x2 = false;\r\n }\r\n else {\r\n this._isIdentity3x2 = true;\r\n }\r\n }\r\n return this._isIdentity3x2;\r\n };\r\n /**\r\n * Gets the determinant of the matrix\r\n * @returns the matrix determinant\r\n */\r\n Matrix.prototype.determinant = function () {\r\n if (this._isIdentity === true) {\r\n return 1;\r\n }\r\n var m = this._m;\r\n var m00 = m[0], m01 = m[1], m02 = m[2], m03 = m[3];\r\n var m10 = m[4], m11 = m[5], m12 = m[6], m13 = m[7];\r\n var m20 = m[8], m21 = m[9], m22 = m[10], m23 = m[11];\r\n var m30 = m[12], m31 = m[13], m32 = m[14], m33 = m[15];\r\n // https://en.wikipedia.org/wiki/Laplace_expansion\r\n // to compute the deterrminant of a 4x4 Matrix we compute the cofactors of any row or column,\r\n // then we multiply each Cofactor by its corresponding matrix value and sum them all to get the determinant\r\n // Cofactor(i, j) = sign(i,j) * det(Minor(i, j))\r\n // where\r\n // - sign(i,j) = (i+j) % 2 === 0 ? 1 : -1\r\n // - Minor(i, j) is the 3x3 matrix we get by removing row i and column j from current Matrix\r\n //\r\n // Here we do that for the 1st row.\r\n var det_22_33 = m22 * m33 - m32 * m23;\r\n var det_21_33 = m21 * m33 - m31 * m23;\r\n var det_21_32 = m21 * m32 - m31 * m22;\r\n var det_20_33 = m20 * m33 - m30 * m23;\r\n var det_20_32 = m20 * m32 - m22 * m30;\r\n var det_20_31 = m20 * m31 - m30 * m21;\r\n var cofact_00 = +(m11 * det_22_33 - m12 * det_21_33 + m13 * det_21_32);\r\n var cofact_01 = -(m10 * det_22_33 - m12 * det_20_33 + m13 * det_20_32);\r\n var cofact_02 = +(m10 * det_21_33 - m11 * det_20_33 + m13 * det_20_31);\r\n var cofact_03 = -(m10 * det_21_32 - m11 * det_20_32 + m12 * det_20_31);\r\n return m00 * cofact_00 + m01 * cofact_01 + m02 * cofact_02 + m03 * cofact_03;\r\n };\r\n // Methods\r\n /**\r\n * Returns the matrix as a Float32Array or Array\r\n * @returns the matrix underlying array\r\n */\r\n Matrix.prototype.toArray = function () {\r\n return this._m;\r\n };\r\n /**\r\n * Returns the matrix as a Float32Array or Array\r\n * @returns the matrix underlying array.\r\n */\r\n Matrix.prototype.asArray = function () {\r\n return this._m;\r\n };\r\n /**\r\n * Inverts the current matrix in place\r\n * @returns the current inverted matrix\r\n */\r\n Matrix.prototype.invert = function () {\r\n this.invertToRef(this);\r\n return this;\r\n };\r\n /**\r\n * Sets all the matrix elements to zero\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.reset = function () {\r\n Matrix.FromValuesToRef(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, this);\r\n this._updateIdentityStatus(false);\r\n return this;\r\n };\r\n /**\r\n * Adds the current matrix with a second one\r\n * @param other defines the matrix to add\r\n * @returns a new matrix as the addition of the current matrix and the given one\r\n */\r\n Matrix.prototype.add = function (other) {\r\n var result = new Matrix();\r\n this.addToRef(other, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given matrix \"result\" to the addition of the current matrix and the given one\r\n * @param other defines the matrix to add\r\n * @param result defines the target matrix\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.addToRef = function (other, result) {\r\n var m = this._m;\r\n var resultM = result._m;\r\n var otherM = other.m;\r\n for (var index = 0; index < 16; index++) {\r\n resultM[index] = m[index] + otherM[index];\r\n }\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Adds in place the given matrix to the current matrix\r\n * @param other defines the second operand\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.addToSelf = function (other) {\r\n var m = this._m;\r\n var otherM = other.m;\r\n for (var index = 0; index < 16; index++) {\r\n m[index] += otherM[index];\r\n }\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Sets the given matrix to the current inverted Matrix\r\n * @param other defines the target matrix\r\n * @returns the unmodified current matrix\r\n */\r\n Matrix.prototype.invertToRef = function (other) {\r\n if (this._isIdentity === true) {\r\n Matrix.IdentityToRef(other);\r\n return this;\r\n }\r\n // the inverse of a Matrix is the transpose of cofactor matrix divided by the determinant\r\n var m = this._m;\r\n var m00 = m[0], m01 = m[1], m02 = m[2], m03 = m[3];\r\n var m10 = m[4], m11 = m[5], m12 = m[6], m13 = m[7];\r\n var m20 = m[8], m21 = m[9], m22 = m[10], m23 = m[11];\r\n var m30 = m[12], m31 = m[13], m32 = m[14], m33 = m[15];\r\n var det_22_33 = m22 * m33 - m32 * m23;\r\n var det_21_33 = m21 * m33 - m31 * m23;\r\n var det_21_32 = m21 * m32 - m31 * m22;\r\n var det_20_33 = m20 * m33 - m30 * m23;\r\n var det_20_32 = m20 * m32 - m22 * m30;\r\n var det_20_31 = m20 * m31 - m30 * m21;\r\n var cofact_00 = +(m11 * det_22_33 - m12 * det_21_33 + m13 * det_21_32);\r\n var cofact_01 = -(m10 * det_22_33 - m12 * det_20_33 + m13 * det_20_32);\r\n var cofact_02 = +(m10 * det_21_33 - m11 * det_20_33 + m13 * det_20_31);\r\n var cofact_03 = -(m10 * det_21_32 - m11 * det_20_32 + m12 * det_20_31);\r\n var det = m00 * cofact_00 + m01 * cofact_01 + m02 * cofact_02 + m03 * cofact_03;\r\n if (det === 0) {\r\n // not invertible\r\n other.copyFrom(this);\r\n return this;\r\n }\r\n var detInv = 1 / det;\r\n var det_12_33 = m12 * m33 - m32 * m13;\r\n var det_11_33 = m11 * m33 - m31 * m13;\r\n var det_11_32 = m11 * m32 - m31 * m12;\r\n var det_10_33 = m10 * m33 - m30 * m13;\r\n var det_10_32 = m10 * m32 - m30 * m12;\r\n var det_10_31 = m10 * m31 - m30 * m11;\r\n var det_12_23 = m12 * m23 - m22 * m13;\r\n var det_11_23 = m11 * m23 - m21 * m13;\r\n var det_11_22 = m11 * m22 - m21 * m12;\r\n var det_10_23 = m10 * m23 - m20 * m13;\r\n var det_10_22 = m10 * m22 - m20 * m12;\r\n var det_10_21 = m10 * m21 - m20 * m11;\r\n var cofact_10 = -(m01 * det_22_33 - m02 * det_21_33 + m03 * det_21_32);\r\n var cofact_11 = +(m00 * det_22_33 - m02 * det_20_33 + m03 * det_20_32);\r\n var cofact_12 = -(m00 * det_21_33 - m01 * det_20_33 + m03 * det_20_31);\r\n var cofact_13 = +(m00 * det_21_32 - m01 * det_20_32 + m02 * det_20_31);\r\n var cofact_20 = +(m01 * det_12_33 - m02 * det_11_33 + m03 * det_11_32);\r\n var cofact_21 = -(m00 * det_12_33 - m02 * det_10_33 + m03 * det_10_32);\r\n var cofact_22 = +(m00 * det_11_33 - m01 * det_10_33 + m03 * det_10_31);\r\n var cofact_23 = -(m00 * det_11_32 - m01 * det_10_32 + m02 * det_10_31);\r\n var cofact_30 = -(m01 * det_12_23 - m02 * det_11_23 + m03 * det_11_22);\r\n var cofact_31 = +(m00 * det_12_23 - m02 * det_10_23 + m03 * det_10_22);\r\n var cofact_32 = -(m00 * det_11_23 - m01 * det_10_23 + m03 * det_10_21);\r\n var cofact_33 = +(m00 * det_11_22 - m01 * det_10_22 + m02 * det_10_21);\r\n Matrix.FromValuesToRef(cofact_00 * detInv, cofact_10 * detInv, cofact_20 * detInv, cofact_30 * detInv, cofact_01 * detInv, cofact_11 * detInv, cofact_21 * detInv, cofact_31 * detInv, cofact_02 * detInv, cofact_12 * detInv, cofact_22 * detInv, cofact_32 * detInv, cofact_03 * detInv, cofact_13 * detInv, cofact_23 * detInv, cofact_33 * detInv, other);\r\n return this;\r\n };\r\n /**\r\n * add a value at the specified position in the current Matrix\r\n * @param index the index of the value within the matrix. between 0 and 15.\r\n * @param value the value to be added\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.addAtIndex = function (index, value) {\r\n this._m[index] += value;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * mutiply the specified position in the current Matrix by a value\r\n * @param index the index of the value within the matrix. between 0 and 15.\r\n * @param value the value to be added\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.multiplyAtIndex = function (index, value) {\r\n this._m[index] *= value;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Inserts the translation vector (using 3 floats) in the current matrix\r\n * @param x defines the 1st component of the translation\r\n * @param y defines the 2nd component of the translation\r\n * @param z defines the 3rd component of the translation\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.setTranslationFromFloats = function (x, y, z) {\r\n this._m[12] = x;\r\n this._m[13] = y;\r\n this._m[14] = z;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Adds the translation vector (using 3 floats) in the current matrix\r\n * @param x defines the 1st component of the translation\r\n * @param y defines the 2nd component of the translation\r\n * @param z defines the 3rd component of the translation\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.addTranslationFromFloats = function (x, y, z) {\r\n this._m[12] += x;\r\n this._m[13] += y;\r\n this._m[14] += z;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Inserts the translation vector in the current matrix\r\n * @param vector3 defines the translation to insert\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.setTranslation = function (vector3) {\r\n return this.setTranslationFromFloats(vector3._x, vector3._y, vector3._z);\r\n };\r\n /**\r\n * Gets the translation value of the current matrix\r\n * @returns a new Vector3 as the extracted translation from the matrix\r\n */\r\n Matrix.prototype.getTranslation = function () {\r\n return new Vector3(this._m[12], this._m[13], this._m[14]);\r\n };\r\n /**\r\n * Fill a Vector3 with the extracted translation from the matrix\r\n * @param result defines the Vector3 where to store the translation\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.getTranslationToRef = function (result) {\r\n result.x = this._m[12];\r\n result.y = this._m[13];\r\n result.z = this._m[14];\r\n return this;\r\n };\r\n /**\r\n * Remove rotation and scaling part from the matrix\r\n * @returns the updated matrix\r\n */\r\n Matrix.prototype.removeRotationAndScaling = function () {\r\n var m = this.m;\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, m[12], m[13], m[14], m[15], this);\r\n this._updateIdentityStatus(m[12] === 0 && m[13] === 0 && m[14] === 0 && m[15] === 1);\r\n return this;\r\n };\r\n /**\r\n * Multiply two matrices\r\n * @param other defines the second operand\r\n * @returns a new matrix set with the multiplication result of the current Matrix and the given one\r\n */\r\n Matrix.prototype.multiply = function (other) {\r\n var result = new Matrix();\r\n this.multiplyToRef(other, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the current matrix from the given one\r\n * @param other defines the source matrix\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.copyFrom = function (other) {\r\n other.copyToArray(this._m);\r\n var o = other;\r\n this._updateIdentityStatus(o._isIdentity, o._isIdentityDirty, o._isIdentity3x2, o._isIdentity3x2Dirty);\r\n return this;\r\n };\r\n /**\r\n * Populates the given array from the starting index with the current matrix values\r\n * @param array defines the target array\r\n * @param offset defines the offset in the target array where to start storing values\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.copyToArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n var source = this._m;\r\n array[offset] = source[0];\r\n array[offset + 1] = source[1];\r\n array[offset + 2] = source[2];\r\n array[offset + 3] = source[3];\r\n array[offset + 4] = source[4];\r\n array[offset + 5] = source[5];\r\n array[offset + 6] = source[6];\r\n array[offset + 7] = source[7];\r\n array[offset + 8] = source[8];\r\n array[offset + 9] = source[9];\r\n array[offset + 10] = source[10];\r\n array[offset + 11] = source[11];\r\n array[offset + 12] = source[12];\r\n array[offset + 13] = source[13];\r\n array[offset + 14] = source[14];\r\n array[offset + 15] = source[15];\r\n return this;\r\n };\r\n /**\r\n * Sets the given matrix \"result\" with the multiplication result of the current Matrix and the given one\r\n * @param other defines the second operand\r\n * @param result defines the matrix where to store the multiplication\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.multiplyToRef = function (other, result) {\r\n if (this._isIdentity) {\r\n result.copyFrom(other);\r\n return this;\r\n }\r\n if (other._isIdentity) {\r\n result.copyFrom(this);\r\n return this;\r\n }\r\n this.multiplyToArray(other, result._m, 0);\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Sets the Float32Array \"result\" from the given index \"offset\" with the multiplication of the current matrix and the given one\r\n * @param other defines the second operand\r\n * @param result defines the array where to store the multiplication\r\n * @param offset defines the offset in the target array where to start storing values\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.multiplyToArray = function (other, result, offset) {\r\n var m = this._m;\r\n var otherM = other.m;\r\n var tm0 = m[0], tm1 = m[1], tm2 = m[2], tm3 = m[3];\r\n var tm4 = m[4], tm5 = m[5], tm6 = m[6], tm7 = m[7];\r\n var tm8 = m[8], tm9 = m[9], tm10 = m[10], tm11 = m[11];\r\n var tm12 = m[12], tm13 = m[13], tm14 = m[14], tm15 = m[15];\r\n var om0 = otherM[0], om1 = otherM[1], om2 = otherM[2], om3 = otherM[3];\r\n var om4 = otherM[4], om5 = otherM[5], om6 = otherM[6], om7 = otherM[7];\r\n var om8 = otherM[8], om9 = otherM[9], om10 = otherM[10], om11 = otherM[11];\r\n var om12 = otherM[12], om13 = otherM[13], om14 = otherM[14], om15 = otherM[15];\r\n result[offset] = tm0 * om0 + tm1 * om4 + tm2 * om8 + tm3 * om12;\r\n result[offset + 1] = tm0 * om1 + tm1 * om5 + tm2 * om9 + tm3 * om13;\r\n result[offset + 2] = tm0 * om2 + tm1 * om6 + tm2 * om10 + tm3 * om14;\r\n result[offset + 3] = tm0 * om3 + tm1 * om7 + tm2 * om11 + tm3 * om15;\r\n result[offset + 4] = tm4 * om0 + tm5 * om4 + tm6 * om8 + tm7 * om12;\r\n result[offset + 5] = tm4 * om1 + tm5 * om5 + tm6 * om9 + tm7 * om13;\r\n result[offset + 6] = tm4 * om2 + tm5 * om6 + tm6 * om10 + tm7 * om14;\r\n result[offset + 7] = tm4 * om3 + tm5 * om7 + tm6 * om11 + tm7 * om15;\r\n result[offset + 8] = tm8 * om0 + tm9 * om4 + tm10 * om8 + tm11 * om12;\r\n result[offset + 9] = tm8 * om1 + tm9 * om5 + tm10 * om9 + tm11 * om13;\r\n result[offset + 10] = tm8 * om2 + tm9 * om6 + tm10 * om10 + tm11 * om14;\r\n result[offset + 11] = tm8 * om3 + tm9 * om7 + tm10 * om11 + tm11 * om15;\r\n result[offset + 12] = tm12 * om0 + tm13 * om4 + tm14 * om8 + tm15 * om12;\r\n result[offset + 13] = tm12 * om1 + tm13 * om5 + tm14 * om9 + tm15 * om13;\r\n result[offset + 14] = tm12 * om2 + tm13 * om6 + tm14 * om10 + tm15 * om14;\r\n result[offset + 15] = tm12 * om3 + tm13 * om7 + tm14 * om11 + tm15 * om15;\r\n return this;\r\n };\r\n /**\r\n * Check equality between this matrix and a second one\r\n * @param value defines the second matrix to compare\r\n * @returns true is the current matrix and the given one values are strictly equal\r\n */\r\n Matrix.prototype.equals = function (value) {\r\n var other = value;\r\n if (!other) {\r\n return false;\r\n }\r\n if (this._isIdentity || other._isIdentity) {\r\n if (!this._isIdentityDirty && !other._isIdentityDirty) {\r\n return this._isIdentity && other._isIdentity;\r\n }\r\n }\r\n var m = this.m;\r\n var om = other.m;\r\n return (m[0] === om[0] && m[1] === om[1] && m[2] === om[2] && m[3] === om[3] &&\r\n m[4] === om[4] && m[5] === om[5] && m[6] === om[6] && m[7] === om[7] &&\r\n m[8] === om[8] && m[9] === om[9] && m[10] === om[10] && m[11] === om[11] &&\r\n m[12] === om[12] && m[13] === om[13] && m[14] === om[14] && m[15] === om[15]);\r\n };\r\n /**\r\n * Clone the current matrix\r\n * @returns a new matrix from the current matrix\r\n */\r\n Matrix.prototype.clone = function () {\r\n var matrix = new Matrix();\r\n matrix.copyFrom(this);\r\n return matrix;\r\n };\r\n /**\r\n * Returns the name of the current matrix class\r\n * @returns the string \"Matrix\"\r\n */\r\n Matrix.prototype.getClassName = function () {\r\n return \"Matrix\";\r\n };\r\n /**\r\n * Gets the hash code of the current matrix\r\n * @returns the hash code\r\n */\r\n Matrix.prototype.getHashCode = function () {\r\n var hash = this._m[0] | 0;\r\n for (var i = 1; i < 16; i++) {\r\n hash = (hash * 397) ^ (this._m[i] | 0);\r\n }\r\n return hash;\r\n };\r\n /**\r\n * Decomposes the current Matrix into a translation, rotation and scaling components\r\n * @param scale defines the scale vector3 given as a reference to update\r\n * @param rotation defines the rotation quaternion given as a reference to update\r\n * @param translation defines the translation vector3 given as a reference to update\r\n * @returns true if operation was successful\r\n */\r\n Matrix.prototype.decompose = function (scale, rotation, translation) {\r\n if (this._isIdentity) {\r\n if (translation) {\r\n translation.setAll(0);\r\n }\r\n if (scale) {\r\n scale.setAll(1);\r\n }\r\n if (rotation) {\r\n rotation.copyFromFloats(0, 0, 0, 1);\r\n }\r\n return true;\r\n }\r\n var m = this._m;\r\n if (translation) {\r\n translation.copyFromFloats(m[12], m[13], m[14]);\r\n }\r\n scale = scale || MathTmp.Vector3[0];\r\n scale.x = Math.sqrt(m[0] * m[0] + m[1] * m[1] + m[2] * m[2]);\r\n scale.y = Math.sqrt(m[4] * m[4] + m[5] * m[5] + m[6] * m[6]);\r\n scale.z = Math.sqrt(m[8] * m[8] + m[9] * m[9] + m[10] * m[10]);\r\n if (this.determinant() <= 0) {\r\n scale.y *= -1;\r\n }\r\n if (scale._x === 0 || scale._y === 0 || scale._z === 0) {\r\n if (rotation) {\r\n rotation.copyFromFloats(0.0, 0.0, 0.0, 1.0);\r\n }\r\n return false;\r\n }\r\n if (rotation) {\r\n var sx = 1 / scale._x, sy = 1 / scale._y, sz = 1 / scale._z;\r\n Matrix.FromValuesToRef(m[0] * sx, m[1] * sx, m[2] * sx, 0.0, m[4] * sy, m[5] * sy, m[6] * sy, 0.0, m[8] * sz, m[9] * sz, m[10] * sz, 0.0, 0.0, 0.0, 0.0, 1.0, MathTmp.Matrix[0]);\r\n Quaternion.FromRotationMatrixToRef(MathTmp.Matrix[0], rotation);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Gets specific row of the matrix\r\n * @param index defines the number of the row to get\r\n * @returns the index-th row of the current matrix as a new Vector4\r\n */\r\n Matrix.prototype.getRow = function (index) {\r\n if (index < 0 || index > 3) {\r\n return null;\r\n }\r\n var i = index * 4;\r\n return new Vector4(this._m[i + 0], this._m[i + 1], this._m[i + 2], this._m[i + 3]);\r\n };\r\n /**\r\n * Sets the index-th row of the current matrix to the vector4 values\r\n * @param index defines the number of the row to set\r\n * @param row defines the target vector4\r\n * @returns the updated current matrix\r\n */\r\n Matrix.prototype.setRow = function (index, row) {\r\n return this.setRowFromFloats(index, row.x, row.y, row.z, row.w);\r\n };\r\n /**\r\n * Compute the transpose of the matrix\r\n * @returns the new transposed matrix\r\n */\r\n Matrix.prototype.transpose = function () {\r\n return Matrix.Transpose(this);\r\n };\r\n /**\r\n * Compute the transpose of the matrix and store it in a given matrix\r\n * @param result defines the target matrix\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.transposeToRef = function (result) {\r\n Matrix.TransposeToRef(this, result);\r\n return this;\r\n };\r\n /**\r\n * Sets the index-th row of the current matrix with the given 4 x float values\r\n * @param index defines the row index\r\n * @param x defines the x component to set\r\n * @param y defines the y component to set\r\n * @param z defines the z component to set\r\n * @param w defines the w component to set\r\n * @returns the updated current matrix\r\n */\r\n Matrix.prototype.setRowFromFloats = function (index, x, y, z, w) {\r\n if (index < 0 || index > 3) {\r\n return this;\r\n }\r\n var i = index * 4;\r\n this._m[i + 0] = x;\r\n this._m[i + 1] = y;\r\n this._m[i + 2] = z;\r\n this._m[i + 3] = w;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Compute a new matrix set with the current matrix values multiplied by scale (float)\r\n * @param scale defines the scale factor\r\n * @returns a new matrix\r\n */\r\n Matrix.prototype.scale = function (scale) {\r\n var result = new Matrix();\r\n this.scaleToRef(scale, result);\r\n return result;\r\n };\r\n /**\r\n * Scale the current matrix values by a factor to a given result matrix\r\n * @param scale defines the scale factor\r\n * @param result defines the matrix to store the result\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.scaleToRef = function (scale, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] = this._m[index] * scale;\r\n }\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Scale the current matrix values by a factor and add the result to a given matrix\r\n * @param scale defines the scale factor\r\n * @param result defines the Matrix to store the result\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.scaleAndAddToRef = function (scale, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] += this._m[index] * scale;\r\n }\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Writes to the given matrix a normal matrix, computed from this one (using values from identity matrix for fourth row and column).\r\n * @param ref matrix to store the result\r\n */\r\n Matrix.prototype.toNormalMatrix = function (ref) {\r\n var tmp = MathTmp.Matrix[0];\r\n this.invertToRef(tmp);\r\n tmp.transposeToRef(ref);\r\n var m = ref._m;\r\n Matrix.FromValuesToRef(m[0], m[1], m[2], 0.0, m[4], m[5], m[6], 0.0, m[8], m[9], m[10], 0.0, 0.0, 0.0, 0.0, 1.0, ref);\r\n };\r\n /**\r\n * Gets only rotation part of the current matrix\r\n * @returns a new matrix sets to the extracted rotation matrix from the current one\r\n */\r\n Matrix.prototype.getRotationMatrix = function () {\r\n var result = new Matrix();\r\n this.getRotationMatrixToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Extracts the rotation matrix from the current one and sets it as the given \"result\"\r\n * @param result defines the target matrix to store data to\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.getRotationMatrixToRef = function (result) {\r\n var scale = MathTmp.Vector3[0];\r\n if (!this.decompose(scale)) {\r\n Matrix.IdentityToRef(result);\r\n return this;\r\n }\r\n var m = this._m;\r\n var sx = 1 / scale._x, sy = 1 / scale._y, sz = 1 / scale._z;\r\n Matrix.FromValuesToRef(m[0] * sx, m[1] * sx, m[2] * sx, 0.0, m[4] * sy, m[5] * sy, m[6] * sy, 0.0, m[8] * sz, m[9] * sz, m[10] * sz, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n return this;\r\n };\r\n /**\r\n * Toggles model matrix from being right handed to left handed in place and vice versa\r\n */\r\n Matrix.prototype.toggleModelMatrixHandInPlace = function () {\r\n var m = this._m;\r\n m[2] *= -1;\r\n m[6] *= -1;\r\n m[8] *= -1;\r\n m[9] *= -1;\r\n m[14] *= -1;\r\n this._markAsUpdated();\r\n };\r\n /**\r\n * Toggles projection matrix from being right handed to left handed in place and vice versa\r\n */\r\n Matrix.prototype.toggleProjectionMatrixHandInPlace = function () {\r\n var m = this._m;\r\n m[8] *= -1;\r\n m[9] *= -1;\r\n m[10] *= -1;\r\n m[11] *= -1;\r\n this._markAsUpdated();\r\n };\r\n // Statics\r\n /**\r\n * Creates a matrix from an array\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @returns a new Matrix set from the starting index of the given array\r\n */\r\n Matrix.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n var result = new Matrix();\r\n Matrix.FromArrayToRef(array, offset, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the content of an array into a given matrix\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromArrayToRef = function (array, offset, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] = array[index + offset];\r\n }\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Stores an array into a matrix after having multiplied each component by a given factor\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @param scale defines the scaling factor\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromFloat32ArrayToRefScaled = function (array, offset, scale, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] = array[index + offset] * scale;\r\n }\r\n result._markAsUpdated();\r\n };\r\n Object.defineProperty(Matrix, \"IdentityReadOnly\", {\r\n /**\r\n * Gets an identity matrix that must not be updated\r\n */\r\n get: function () {\r\n return Matrix._identityReadOnly;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Stores a list of values (16) inside a given matrix\r\n * @param initialM11 defines 1st value of 1st row\r\n * @param initialM12 defines 2nd value of 1st row\r\n * @param initialM13 defines 3rd value of 1st row\r\n * @param initialM14 defines 4th value of 1st row\r\n * @param initialM21 defines 1st value of 2nd row\r\n * @param initialM22 defines 2nd value of 2nd row\r\n * @param initialM23 defines 3rd value of 2nd row\r\n * @param initialM24 defines 4th value of 2nd row\r\n * @param initialM31 defines 1st value of 3rd row\r\n * @param initialM32 defines 2nd value of 3rd row\r\n * @param initialM33 defines 3rd value of 3rd row\r\n * @param initialM34 defines 4th value of 3rd row\r\n * @param initialM41 defines 1st value of 4th row\r\n * @param initialM42 defines 2nd value of 4th row\r\n * @param initialM43 defines 3rd value of 4th row\r\n * @param initialM44 defines 4th value of 4th row\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromValuesToRef = function (initialM11, initialM12, initialM13, initialM14, initialM21, initialM22, initialM23, initialM24, initialM31, initialM32, initialM33, initialM34, initialM41, initialM42, initialM43, initialM44, result) {\r\n var m = result._m;\r\n m[0] = initialM11;\r\n m[1] = initialM12;\r\n m[2] = initialM13;\r\n m[3] = initialM14;\r\n m[4] = initialM21;\r\n m[5] = initialM22;\r\n m[6] = initialM23;\r\n m[7] = initialM24;\r\n m[8] = initialM31;\r\n m[9] = initialM32;\r\n m[10] = initialM33;\r\n m[11] = initialM34;\r\n m[12] = initialM41;\r\n m[13] = initialM42;\r\n m[14] = initialM43;\r\n m[15] = initialM44;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates new matrix from a list of values (16)\r\n * @param initialM11 defines 1st value of 1st row\r\n * @param initialM12 defines 2nd value of 1st row\r\n * @param initialM13 defines 3rd value of 1st row\r\n * @param initialM14 defines 4th value of 1st row\r\n * @param initialM21 defines 1st value of 2nd row\r\n * @param initialM22 defines 2nd value of 2nd row\r\n * @param initialM23 defines 3rd value of 2nd row\r\n * @param initialM24 defines 4th value of 2nd row\r\n * @param initialM31 defines 1st value of 3rd row\r\n * @param initialM32 defines 2nd value of 3rd row\r\n * @param initialM33 defines 3rd value of 3rd row\r\n * @param initialM34 defines 4th value of 3rd row\r\n * @param initialM41 defines 1st value of 4th row\r\n * @param initialM42 defines 2nd value of 4th row\r\n * @param initialM43 defines 3rd value of 4th row\r\n * @param initialM44 defines 4th value of 4th row\r\n * @returns the new matrix\r\n */\r\n Matrix.FromValues = function (initialM11, initialM12, initialM13, initialM14, initialM21, initialM22, initialM23, initialM24, initialM31, initialM32, initialM33, initialM34, initialM41, initialM42, initialM43, initialM44) {\r\n var result = new Matrix();\r\n var m = result._m;\r\n m[0] = initialM11;\r\n m[1] = initialM12;\r\n m[2] = initialM13;\r\n m[3] = initialM14;\r\n m[4] = initialM21;\r\n m[5] = initialM22;\r\n m[6] = initialM23;\r\n m[7] = initialM24;\r\n m[8] = initialM31;\r\n m[9] = initialM32;\r\n m[10] = initialM33;\r\n m[11] = initialM34;\r\n m[12] = initialM41;\r\n m[13] = initialM42;\r\n m[14] = initialM43;\r\n m[15] = initialM44;\r\n result._markAsUpdated();\r\n return result;\r\n };\r\n /**\r\n * Creates a new matrix composed by merging scale (vector3), rotation (quaternion) and translation (vector3)\r\n * @param scale defines the scale vector3\r\n * @param rotation defines the rotation quaternion\r\n * @param translation defines the translation vector3\r\n * @returns a new matrix\r\n */\r\n Matrix.Compose = function (scale, rotation, translation) {\r\n var result = new Matrix();\r\n Matrix.ComposeToRef(scale, rotation, translation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets a matrix to a value composed by merging scale (vector3), rotation (quaternion) and translation (vector3)\r\n * @param scale defines the scale vector3\r\n * @param rotation defines the rotation quaternion\r\n * @param translation defines the translation vector3\r\n * @param result defines the target matrix\r\n */\r\n Matrix.ComposeToRef = function (scale, rotation, translation, result) {\r\n var m = result._m;\r\n var x = rotation._x, y = rotation._y, z = rotation._z, w = rotation._w;\r\n var x2 = x + x, y2 = y + y, z2 = z + z;\r\n var xx = x * x2, xy = x * y2, xz = x * z2;\r\n var yy = y * y2, yz = y * z2, zz = z * z2;\r\n var wx = w * x2, wy = w * y2, wz = w * z2;\r\n var sx = scale._x, sy = scale._y, sz = scale._z;\r\n m[0] = (1 - (yy + zz)) * sx;\r\n m[1] = (xy + wz) * sx;\r\n m[2] = (xz - wy) * sx;\r\n m[3] = 0;\r\n m[4] = (xy - wz) * sy;\r\n m[5] = (1 - (xx + zz)) * sy;\r\n m[6] = (yz + wx) * sy;\r\n m[7] = 0;\r\n m[8] = (xz + wy) * sz;\r\n m[9] = (yz - wx) * sz;\r\n m[10] = (1 - (xx + yy)) * sz;\r\n m[11] = 0;\r\n m[12] = translation._x;\r\n m[13] = translation._y;\r\n m[14] = translation._z;\r\n m[15] = 1;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates a new identity matrix\r\n * @returns a new identity matrix\r\n */\r\n Matrix.Identity = function () {\r\n var identity = Matrix.FromValues(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);\r\n identity._updateIdentityStatus(true);\r\n return identity;\r\n };\r\n /**\r\n * Creates a new identity matrix and stores the result in a given matrix\r\n * @param result defines the target matrix\r\n */\r\n Matrix.IdentityToRef = function (result) {\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(true);\r\n };\r\n /**\r\n * Creates a new zero matrix\r\n * @returns a new zero matrix\r\n */\r\n Matrix.Zero = function () {\r\n var zero = Matrix.FromValues(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);\r\n zero._updateIdentityStatus(false);\r\n return zero;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the X axis\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationX = function (angle) {\r\n var result = new Matrix();\r\n Matrix.RotationXToRef(angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new matrix as the invert of a given matrix\r\n * @param source defines the source matrix\r\n * @returns the new matrix\r\n */\r\n Matrix.Invert = function (source) {\r\n var result = new Matrix();\r\n source.invertToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the X axis and stores it in a given matrix\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationXToRef = function (angle, result) {\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, c, s, 0.0, 0.0, -s, c, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(c === 1 && s === 0);\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Y axis\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationY = function (angle) {\r\n var result = new Matrix();\r\n Matrix.RotationYToRef(angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Y axis and stores it in a given matrix\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationYToRef = function (angle, result) {\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n Matrix.FromValuesToRef(c, 0.0, -s, 0.0, 0.0, 1.0, 0.0, 0.0, s, 0.0, c, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(c === 1 && s === 0);\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Z axis\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationZ = function (angle) {\r\n var result = new Matrix();\r\n Matrix.RotationZToRef(angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Z axis and stores it in a given matrix\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationZToRef = function (angle, result) {\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n Matrix.FromValuesToRef(c, s, 0.0, 0.0, -s, c, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(c === 1 && s === 0);\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the given axis\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationAxis = function (axis, angle) {\r\n var result = new Matrix();\r\n Matrix.RotationAxisToRef(axis, angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the given axis and stores it in a given matrix\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationAxisToRef = function (axis, angle, result) {\r\n var s = Math.sin(-angle);\r\n var c = Math.cos(-angle);\r\n var c1 = 1 - c;\r\n axis.normalize();\r\n var m = result._m;\r\n m[0] = (axis._x * axis._x) * c1 + c;\r\n m[1] = (axis._x * axis._y) * c1 - (axis._z * s);\r\n m[2] = (axis._x * axis._z) * c1 + (axis._y * s);\r\n m[3] = 0.0;\r\n m[4] = (axis._y * axis._x) * c1 + (axis._z * s);\r\n m[5] = (axis._y * axis._y) * c1 + c;\r\n m[6] = (axis._y * axis._z) * c1 - (axis._x * s);\r\n m[7] = 0.0;\r\n m[8] = (axis._z * axis._x) * c1 - (axis._y * s);\r\n m[9] = (axis._z * axis._y) * c1 + (axis._x * s);\r\n m[10] = (axis._z * axis._z) * c1 + c;\r\n m[11] = 0.0;\r\n m[12] = 0.0;\r\n m[13] = 0.0;\r\n m[14] = 0.0;\r\n m[15] = 1.0;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Takes normalised vectors and returns a rotation matrix to align \"from\" with \"to\".\r\n * Taken from http://www.iquilezles.org/www/articles/noacos/noacos.htm\r\n * @param from defines the vector to align\r\n * @param to defines the vector to align to\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationAlignToRef = function (from, to, result) {\r\n var v = Vector3.Cross(to, from);\r\n var c = Vector3.Dot(to, from);\r\n var k = 1 / (1 + c);\r\n var m = result._m;\r\n m[0] = v._x * v._x * k + c;\r\n m[1] = v._y * v._x * k - v._z;\r\n m[2] = v._z * v._x * k + v._y;\r\n m[3] = 0;\r\n m[4] = v._x * v._y * k + v._z;\r\n m[5] = v._y * v._y * k + c;\r\n m[6] = v._z * v._y * k - v._x;\r\n m[7] = 0;\r\n m[8] = v._x * v._z * k - v._y;\r\n m[9] = v._y * v._z * k + v._x;\r\n m[10] = v._z * v._z * k + c;\r\n m[11] = 0;\r\n m[12] = 0;\r\n m[13] = 0;\r\n m[14] = 0;\r\n m[15] = 1;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates a rotation matrix\r\n * @param yaw defines the yaw angle in radians (Y axis)\r\n * @param pitch defines the pitch angle in radians (X axis)\r\n * @param roll defines the roll angle in radians (Z axis)\r\n * @returns the new rotation matrix\r\n */\r\n Matrix.RotationYawPitchRoll = function (yaw, pitch, roll) {\r\n var result = new Matrix();\r\n Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a rotation matrix and stores it in a given matrix\r\n * @param yaw defines the yaw angle in radians (Y axis)\r\n * @param pitch defines the pitch angle in radians (X axis)\r\n * @param roll defines the roll angle in radians (Z axis)\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {\r\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, MathTmp.Quaternion[0]);\r\n MathTmp.Quaternion[0].toRotationMatrix(result);\r\n };\r\n /**\r\n * Creates a scaling matrix\r\n * @param x defines the scale factor on X axis\r\n * @param y defines the scale factor on Y axis\r\n * @param z defines the scale factor on Z axis\r\n * @returns the new matrix\r\n */\r\n Matrix.Scaling = function (x, y, z) {\r\n var result = new Matrix();\r\n Matrix.ScalingToRef(x, y, z, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a scaling matrix and stores it in a given matrix\r\n * @param x defines the scale factor on X axis\r\n * @param y defines the scale factor on Y axis\r\n * @param z defines the scale factor on Z axis\r\n * @param result defines the target matrix\r\n */\r\n Matrix.ScalingToRef = function (x, y, z, result) {\r\n Matrix.FromValuesToRef(x, 0.0, 0.0, 0.0, 0.0, y, 0.0, 0.0, 0.0, 0.0, z, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(x === 1 && y === 1 && z === 1);\r\n };\r\n /**\r\n * Creates a translation matrix\r\n * @param x defines the translation on X axis\r\n * @param y defines the translation on Y axis\r\n * @param z defines the translationon Z axis\r\n * @returns the new matrix\r\n */\r\n Matrix.Translation = function (x, y, z) {\r\n var result = new Matrix();\r\n Matrix.TranslationToRef(x, y, z, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a translation matrix and stores it in a given matrix\r\n * @param x defines the translation on X axis\r\n * @param y defines the translation on Y axis\r\n * @param z defines the translationon Z axis\r\n * @param result defines the target matrix\r\n */\r\n Matrix.TranslationToRef = function (x, y, z, result) {\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, x, y, z, 1.0, result);\r\n result._updateIdentityStatus(x === 0 && y === 0 && z === 0);\r\n };\r\n /**\r\n * Returns a new Matrix whose values are the interpolated values for \"gradient\" (float) between the ones of the matrices \"startValue\" and \"endValue\".\r\n * @param startValue defines the start value\r\n * @param endValue defines the end value\r\n * @param gradient defines the gradient factor\r\n * @returns the new matrix\r\n */\r\n Matrix.Lerp = function (startValue, endValue, gradient) {\r\n var result = new Matrix();\r\n Matrix.LerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n };\r\n /**\r\n * Set the given matrix \"result\" as the interpolated values for \"gradient\" (float) between the ones of the matrices \"startValue\" and \"endValue\".\r\n * @param startValue defines the start value\r\n * @param endValue defines the end value\r\n * @param gradient defines the gradient factor\r\n * @param result defines the Matrix object where to store data\r\n */\r\n Matrix.LerpToRef = function (startValue, endValue, gradient, result) {\r\n var resultM = result._m;\r\n var startM = startValue.m;\r\n var endM = endValue.m;\r\n for (var index = 0; index < 16; index++) {\r\n resultM[index] = startM[index] * (1.0 - gradient) + endM[index] * gradient;\r\n }\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Builds a new matrix whose values are computed by:\r\n * * decomposing the the \"startValue\" and \"endValue\" matrices into their respective scale, rotation and translation matrices\r\n * * interpolating for \"gradient\" (float) the values between each of these decomposed matrices between the start and the end\r\n * * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices\r\n * @param startValue defines the first matrix\r\n * @param endValue defines the second matrix\r\n * @param gradient defines the gradient between the two matrices\r\n * @returns the new matrix\r\n */\r\n Matrix.DecomposeLerp = function (startValue, endValue, gradient) {\r\n var result = new Matrix();\r\n Matrix.DecomposeLerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n };\r\n /**\r\n * Update a matrix to values which are computed by:\r\n * * decomposing the the \"startValue\" and \"endValue\" matrices into their respective scale, rotation and translation matrices\r\n * * interpolating for \"gradient\" (float) the values between each of these decomposed matrices between the start and the end\r\n * * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices\r\n * @param startValue defines the first matrix\r\n * @param endValue defines the second matrix\r\n * @param gradient defines the gradient between the two matrices\r\n * @param result defines the target matrix\r\n */\r\n Matrix.DecomposeLerpToRef = function (startValue, endValue, gradient, result) {\r\n var startScale = MathTmp.Vector3[0];\r\n var startRotation = MathTmp.Quaternion[0];\r\n var startTranslation = MathTmp.Vector3[1];\r\n startValue.decompose(startScale, startRotation, startTranslation);\r\n var endScale = MathTmp.Vector3[2];\r\n var endRotation = MathTmp.Quaternion[1];\r\n var endTranslation = MathTmp.Vector3[3];\r\n endValue.decompose(endScale, endRotation, endTranslation);\r\n var resultScale = MathTmp.Vector3[4];\r\n Vector3.LerpToRef(startScale, endScale, gradient, resultScale);\r\n var resultRotation = MathTmp.Quaternion[2];\r\n Quaternion.SlerpToRef(startRotation, endRotation, gradient, resultRotation);\r\n var resultTranslation = MathTmp.Vector3[5];\r\n Vector3.LerpToRef(startTranslation, endTranslation, gradient, resultTranslation);\r\n Matrix.ComposeToRef(resultScale, resultRotation, resultTranslation, result);\r\n };\r\n /**\r\n * Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\"\r\n * This function works in left handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @returns the new matrix\r\n */\r\n Matrix.LookAtLH = function (eye, target, up) {\r\n var result = new Matrix();\r\n Matrix.LookAtLHToRef(eye, target, up, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given \"result\" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\".\r\n * This function works in left handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @param result defines the target matrix\r\n */\r\n Matrix.LookAtLHToRef = function (eye, target, up, result) {\r\n var xAxis = MathTmp.Vector3[0];\r\n var yAxis = MathTmp.Vector3[1];\r\n var zAxis = MathTmp.Vector3[2];\r\n // Z axis\r\n target.subtractToRef(eye, zAxis);\r\n zAxis.normalize();\r\n // X axis\r\n Vector3.CrossToRef(up, zAxis, xAxis);\r\n var xSquareLength = xAxis.lengthSquared();\r\n if (xSquareLength === 0) {\r\n xAxis.x = 1.0;\r\n }\r\n else {\r\n xAxis.normalizeFromLength(Math.sqrt(xSquareLength));\r\n }\r\n // Y axis\r\n Vector3.CrossToRef(zAxis, xAxis, yAxis);\r\n yAxis.normalize();\r\n // Eye angles\r\n var ex = -Vector3.Dot(xAxis, eye);\r\n var ey = -Vector3.Dot(yAxis, eye);\r\n var ez = -Vector3.Dot(zAxis, eye);\r\n Matrix.FromValuesToRef(xAxis._x, yAxis._x, zAxis._x, 0.0, xAxis._y, yAxis._y, zAxis._y, 0.0, xAxis._z, yAxis._z, zAxis._z, 0.0, ex, ey, ez, 1.0, result);\r\n };\r\n /**\r\n * Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\"\r\n * This function works in right handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @returns the new matrix\r\n */\r\n Matrix.LookAtRH = function (eye, target, up) {\r\n var result = new Matrix();\r\n Matrix.LookAtRHToRef(eye, target, up, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given \"result\" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\".\r\n * This function works in right handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @param result defines the target matrix\r\n */\r\n Matrix.LookAtRHToRef = function (eye, target, up, result) {\r\n var xAxis = MathTmp.Vector3[0];\r\n var yAxis = MathTmp.Vector3[1];\r\n var zAxis = MathTmp.Vector3[2];\r\n // Z axis\r\n eye.subtractToRef(target, zAxis);\r\n zAxis.normalize();\r\n // X axis\r\n Vector3.CrossToRef(up, zAxis, xAxis);\r\n var xSquareLength = xAxis.lengthSquared();\r\n if (xSquareLength === 0) {\r\n xAxis.x = 1.0;\r\n }\r\n else {\r\n xAxis.normalizeFromLength(Math.sqrt(xSquareLength));\r\n }\r\n // Y axis\r\n Vector3.CrossToRef(zAxis, xAxis, yAxis);\r\n yAxis.normalize();\r\n // Eye angles\r\n var ex = -Vector3.Dot(xAxis, eye);\r\n var ey = -Vector3.Dot(yAxis, eye);\r\n var ez = -Vector3.Dot(zAxis, eye);\r\n Matrix.FromValuesToRef(xAxis._x, yAxis._x, zAxis._x, 0.0, xAxis._y, yAxis._y, zAxis._y, 0.0, xAxis._z, yAxis._z, zAxis._z, 0.0, ex, ey, ez, 1.0, result);\r\n };\r\n /**\r\n * Create a left-handed orthographic projection matrix\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed orthographic projection matrix\r\n */\r\n Matrix.OrthoLH = function (width, height, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.OrthoLHToRef(width, height, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Store a left-handed orthographic projection to a given matrix\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.OrthoLHToRef = function (width, height, znear, zfar, result) {\r\n var n = znear;\r\n var f = zfar;\r\n var a = 2.0 / width;\r\n var b = 2.0 / height;\r\n var c = 2.0 / (f - n);\r\n var d = -(f + n) / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 0.0, 0.0, 0.0, d, 1.0, result);\r\n result._updateIdentityStatus(a === 1 && b === 1 && c === 1 && d === 0);\r\n };\r\n /**\r\n * Create a left-handed orthographic projection matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed orthographic projection matrix\r\n */\r\n Matrix.OrthoOffCenterLH = function (left, right, bottom, top, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.OrthoOffCenterLHToRef(left, right, bottom, top, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a left-handed orthographic projection into a given matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.OrthoOffCenterLHToRef = function (left, right, bottom, top, znear, zfar, result) {\r\n var n = znear;\r\n var f = zfar;\r\n var a = 2.0 / (right - left);\r\n var b = 2.0 / (top - bottom);\r\n var c = 2.0 / (f - n);\r\n var d = -(f + n) / (f - n);\r\n var i0 = (left + right) / (left - right);\r\n var i1 = (top + bottom) / (bottom - top);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 0.0, i0, i1, d, 1.0, result);\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates a right-handed orthographic projection matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a right-handed orthographic projection matrix\r\n */\r\n Matrix.OrthoOffCenterRH = function (left, right, bottom, top, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.OrthoOffCenterRHToRef(left, right, bottom, top, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a right-handed orthographic projection into a given matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.OrthoOffCenterRHToRef = function (left, right, bottom, top, znear, zfar, result) {\r\n Matrix.OrthoOffCenterLHToRef(left, right, bottom, top, znear, zfar, result);\r\n result._m[10] *= -1; // No need to call _markAsUpdated as previous function already called it and let _isIdentityDirty to true\r\n };\r\n /**\r\n * Creates a left-handed perspective projection matrix\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed perspective projection matrix\r\n */\r\n Matrix.PerspectiveLH = function (width, height, znear, zfar) {\r\n var matrix = new Matrix();\r\n var n = znear;\r\n var f = zfar;\r\n var a = 2.0 * n / width;\r\n var b = 2.0 * n / height;\r\n var c = (f + n) / (f - n);\r\n var d = -2.0 * f * n / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 1.0, 0.0, 0.0, d, 0.0, matrix);\r\n matrix._updateIdentityStatus(false);\r\n return matrix;\r\n };\r\n /**\r\n * Creates a left-handed perspective projection matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed perspective projection matrix\r\n */\r\n Matrix.PerspectiveFovLH = function (fov, aspect, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.PerspectiveFovLHToRef(fov, aspect, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a left-handed perspective projection into a given matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\r\n */\r\n Matrix.PerspectiveFovLHToRef = function (fov, aspect, znear, zfar, result, isVerticalFovFixed) {\r\n if (isVerticalFovFixed === void 0) { isVerticalFovFixed = true; }\r\n var n = znear;\r\n var f = zfar;\r\n var t = 1.0 / (Math.tan(fov * 0.5));\r\n var a = isVerticalFovFixed ? (t / aspect) : t;\r\n var b = isVerticalFovFixed ? t : (t * aspect);\r\n var c = (f + n) / (f - n);\r\n var d = -2.0 * f * n / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 1.0, 0.0, 0.0, d, 0.0, result);\r\n result._updateIdentityStatus(false);\r\n };\r\n /**\r\n * Stores a left-handed perspective projection into a given matrix with depth reversed\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar not used as infinity is used as far clip\r\n * @param result defines the target matrix\r\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\r\n */\r\n Matrix.PerspectiveFovReverseLHToRef = function (fov, aspect, znear, zfar, result, isVerticalFovFixed) {\r\n if (isVerticalFovFixed === void 0) { isVerticalFovFixed = true; }\r\n var t = 1.0 / (Math.tan(fov * 0.5));\r\n var a = isVerticalFovFixed ? (t / aspect) : t;\r\n var b = isVerticalFovFixed ? t : (t * aspect);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, -znear, 1.0, 0.0, 0.0, 1.0, 0.0, result);\r\n result._updateIdentityStatus(false);\r\n };\r\n /**\r\n * Creates a right-handed perspective projection matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a right-handed perspective projection matrix\r\n */\r\n Matrix.PerspectiveFovRH = function (fov, aspect, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.PerspectiveFovRHToRef(fov, aspect, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a right-handed perspective projection into a given matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\r\n */\r\n Matrix.PerspectiveFovRHToRef = function (fov, aspect, znear, zfar, result, isVerticalFovFixed) {\r\n //alternatively this could be expressed as:\r\n // m = PerspectiveFovLHToRef\r\n // m[10] *= -1.0;\r\n // m[11] *= -1.0;\r\n if (isVerticalFovFixed === void 0) { isVerticalFovFixed = true; }\r\n var n = znear;\r\n var f = zfar;\r\n var t = 1.0 / (Math.tan(fov * 0.5));\r\n var a = isVerticalFovFixed ? (t / aspect) : t;\r\n var b = isVerticalFovFixed ? t : (t * aspect);\r\n var c = -(f + n) / (f - n);\r\n var d = -2 * f * n / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, -1.0, 0.0, 0.0, d, 0.0, result);\r\n result._updateIdentityStatus(false);\r\n };\r\n /**\r\n * Stores a right-handed perspective projection into a given matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar not used as infinity is used as far clip\r\n * @param result defines the target matrix\r\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\r\n */\r\n Matrix.PerspectiveFovReverseRHToRef = function (fov, aspect, znear, zfar, result, isVerticalFovFixed) {\r\n //alternatively this could be expressed as:\r\n // m = PerspectiveFovLHToRef\r\n // m[10] *= -1.0;\r\n // m[11] *= -1.0;\r\n if (isVerticalFovFixed === void 0) { isVerticalFovFixed = true; }\r\n var t = 1.0 / (Math.tan(fov * 0.5));\r\n var a = isVerticalFovFixed ? (t / aspect) : t;\r\n var b = isVerticalFovFixed ? t : (t * aspect);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, -znear, -1.0, 0.0, 0.0, -1.0, 0.0, result);\r\n result._updateIdentityStatus(false);\r\n };\r\n /**\r\n * Stores a perspective projection for WebVR info a given matrix\r\n * @param fov defines the field of view\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n * @param rightHanded defines if the matrix must be in right-handed mode (false by default)\r\n */\r\n Matrix.PerspectiveFovWebVRToRef = function (fov, znear, zfar, result, rightHanded) {\r\n if (rightHanded === void 0) { rightHanded = false; }\r\n var rightHandedFactor = rightHanded ? -1 : 1;\r\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\r\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\r\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\r\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\r\n var xScale = 2.0 / (leftTan + rightTan);\r\n var yScale = 2.0 / (upTan + downTan);\r\n var m = result._m;\r\n m[0] = xScale;\r\n m[1] = m[2] = m[3] = m[4] = 0.0;\r\n m[5] = yScale;\r\n m[6] = m[7] = 0.0;\r\n m[8] = ((leftTan - rightTan) * xScale * 0.5);\r\n m[9] = -((upTan - downTan) * yScale * 0.5);\r\n m[10] = -zfar / (znear - zfar);\r\n m[11] = 1.0 * rightHandedFactor;\r\n m[12] = m[13] = m[15] = 0.0;\r\n m[14] = -(2.0 * zfar * znear) / (zfar - znear);\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Computes a complete transformation matrix\r\n * @param viewport defines the viewport to use\r\n * @param world defines the world matrix\r\n * @param view defines the view matrix\r\n * @param projection defines the projection matrix\r\n * @param zmin defines the near clip plane\r\n * @param zmax defines the far clip plane\r\n * @returns the transformation matrix\r\n */\r\n Matrix.GetFinalMatrix = function (viewport, world, view, projection, zmin, zmax) {\r\n var cw = viewport.width;\r\n var ch = viewport.height;\r\n var cx = viewport.x;\r\n var cy = viewport.y;\r\n var viewportMatrix = Matrix.FromValues(cw / 2.0, 0.0, 0.0, 0.0, 0.0, -ch / 2.0, 0.0, 0.0, 0.0, 0.0, zmax - zmin, 0.0, cx + cw / 2.0, ch / 2.0 + cy, zmin, 1.0);\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(view, matrix);\r\n matrix.multiplyToRef(projection, matrix);\r\n return matrix.multiply(viewportMatrix);\r\n };\r\n /**\r\n * Extracts a 2x2 matrix from a given matrix and store the result in a Float32Array\r\n * @param matrix defines the matrix to use\r\n * @returns a new Float32Array array with 4 elements : the 2x2 matrix extracted from the given matrix\r\n */\r\n Matrix.GetAsMatrix2x2 = function (matrix) {\r\n var m = matrix.m;\r\n var arr = [m[0], m[1], m[4], m[5]];\r\n return PerformanceConfigurator.MatrixUse64Bits ? arr : new Float32Array(arr);\r\n };\r\n /**\r\n * Extracts a 3x3 matrix from a given matrix and store the result in a Float32Array\r\n * @param matrix defines the matrix to use\r\n * @returns a new Float32Array array with 9 elements : the 3x3 matrix extracted from the given matrix\r\n */\r\n Matrix.GetAsMatrix3x3 = function (matrix) {\r\n var m = matrix.m;\r\n var arr = [\r\n m[0], m[1], m[2],\r\n m[4], m[5], m[6],\r\n m[8], m[9], m[10]\r\n ];\r\n return PerformanceConfigurator.MatrixUse64Bits ? arr : new Float32Array(arr);\r\n };\r\n /**\r\n * Compute the transpose of a given matrix\r\n * @param matrix defines the matrix to transpose\r\n * @returns the new matrix\r\n */\r\n Matrix.Transpose = function (matrix) {\r\n var result = new Matrix();\r\n Matrix.TransposeToRef(matrix, result);\r\n return result;\r\n };\r\n /**\r\n * Compute the transpose of a matrix and store it in a target matrix\r\n * @param matrix defines the matrix to transpose\r\n * @param result defines the target matrix\r\n */\r\n Matrix.TransposeToRef = function (matrix, result) {\r\n var rm = result._m;\r\n var mm = matrix.m;\r\n rm[0] = mm[0];\r\n rm[1] = mm[4];\r\n rm[2] = mm[8];\r\n rm[3] = mm[12];\r\n rm[4] = mm[1];\r\n rm[5] = mm[5];\r\n rm[6] = mm[9];\r\n rm[7] = mm[13];\r\n rm[8] = mm[2];\r\n rm[9] = mm[6];\r\n rm[10] = mm[10];\r\n rm[11] = mm[14];\r\n rm[12] = mm[3];\r\n rm[13] = mm[7];\r\n rm[14] = mm[11];\r\n rm[15] = mm[15];\r\n // identity-ness does not change when transposing\r\n result._updateIdentityStatus(matrix._isIdentity, matrix._isIdentityDirty);\r\n };\r\n /**\r\n * Computes a reflection matrix from a plane\r\n * @param plane defines the reflection plane\r\n * @returns a new matrix\r\n */\r\n Matrix.Reflection = function (plane) {\r\n var matrix = new Matrix();\r\n Matrix.ReflectionToRef(plane, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Computes a reflection matrix from a plane\r\n * @param plane defines the reflection plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.ReflectionToRef = function (plane, result) {\r\n plane.normalize();\r\n var x = plane.normal.x;\r\n var y = plane.normal.y;\r\n var z = plane.normal.z;\r\n var temp = -2 * x;\r\n var temp2 = -2 * y;\r\n var temp3 = -2 * z;\r\n Matrix.FromValuesToRef(temp * x + 1, temp2 * x, temp3 * x, 0.0, temp * y, temp2 * y + 1, temp3 * y, 0.0, temp * z, temp2 * z, temp3 * z + 1, 0.0, temp * plane.d, temp2 * plane.d, temp3 * plane.d, 1.0, result);\r\n };\r\n /**\r\n * Sets the given matrix as a rotation matrix composed from the 3 left handed axes\r\n * @param xaxis defines the value of the 1st axis\r\n * @param yaxis defines the value of the 2nd axis\r\n * @param zaxis defines the value of the 3rd axis\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromXYZAxesToRef = function (xaxis, yaxis, zaxis, result) {\r\n Matrix.FromValuesToRef(xaxis._x, xaxis._y, xaxis._z, 0.0, yaxis._x, yaxis._y, yaxis._z, 0.0, zaxis._x, zaxis._y, zaxis._z, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n };\r\n /**\r\n * Creates a rotation matrix from a quaternion and stores it in a target matrix\r\n * @param quat defines the quaternion to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromQuaternionToRef = function (quat, result) {\r\n var xx = quat._x * quat._x;\r\n var yy = quat._y * quat._y;\r\n var zz = quat._z * quat._z;\r\n var xy = quat._x * quat._y;\r\n var zw = quat._z * quat._w;\r\n var zx = quat._z * quat._x;\r\n var yw = quat._y * quat._w;\r\n var yz = quat._y * quat._z;\r\n var xw = quat._x * quat._w;\r\n result._m[0] = 1.0 - (2.0 * (yy + zz));\r\n result._m[1] = 2.0 * (xy + zw);\r\n result._m[2] = 2.0 * (zx - yw);\r\n result._m[3] = 0.0;\r\n result._m[4] = 2.0 * (xy - zw);\r\n result._m[5] = 1.0 - (2.0 * (zz + xx));\r\n result._m[6] = 2.0 * (yz + xw);\r\n result._m[7] = 0.0;\r\n result._m[8] = 2.0 * (zx + yw);\r\n result._m[9] = 2.0 * (yz - xw);\r\n result._m[10] = 1.0 - (2.0 * (yy + xx));\r\n result._m[11] = 0.0;\r\n result._m[12] = 0.0;\r\n result._m[13] = 0.0;\r\n result._m[14] = 0.0;\r\n result._m[15] = 1.0;\r\n result._markAsUpdated();\r\n };\r\n Matrix._updateFlagSeed = 0;\r\n Matrix._identityReadOnly = Matrix.Identity();\r\n return Matrix;\r\n}());\r\nexport { Matrix };\r\n/**\r\n * @hidden\r\n * Same as Tmp but not exported to keep it only for math functions to avoid conflicts\r\n */\r\nvar MathTmp = /** @class */ (function () {\r\n function MathTmp() {\r\n }\r\n MathTmp.Vector3 = ArrayTools.BuildArray(6, Vector3.Zero);\r\n MathTmp.Matrix = ArrayTools.BuildArray(2, Matrix.Identity);\r\n MathTmp.Quaternion = ArrayTools.BuildArray(3, Quaternion.Zero);\r\n return MathTmp;\r\n}());\r\n/**\r\n * @hidden\r\n */\r\nvar TmpVectors = /** @class */ (function () {\r\n function TmpVectors() {\r\n }\r\n TmpVectors.Vector2 = ArrayTools.BuildArray(3, Vector2.Zero); // 3 temp Vector2 at once should be enough\r\n TmpVectors.Vector3 = ArrayTools.BuildArray(13, Vector3.Zero); // 13 temp Vector3 at once should be enough\r\n TmpVectors.Vector4 = ArrayTools.BuildArray(3, Vector4.Zero); // 3 temp Vector4 at once should be enough\r\n TmpVectors.Quaternion = ArrayTools.BuildArray(2, Quaternion.Zero); // 2 temp Quaternion at once should be enough\r\n TmpVectors.Matrix = ArrayTools.BuildArray(8, Matrix.Identity); // 8 temp Matrices at once should be enough\r\n return TmpVectors;\r\n}());\r\nexport { TmpVectors };\r\n_TypeStore.RegisteredTypes[\"BABYLON.Vector2\"] = Vector2;\r\n_TypeStore.RegisteredTypes[\"BABYLON.Vector3\"] = Vector3;\r\n_TypeStore.RegisteredTypes[\"BABYLON.Vector4\"] = Vector4;\r\n_TypeStore.RegisteredTypes[\"BABYLON.Matrix\"] = Matrix;\r\n//# sourceMappingURL=math.vector.js.map","/**\r\n * Class used to represent a viewport on screen\r\n */\r\nvar Viewport = /** @class */ (function () {\r\n /**\r\n * Creates a Viewport object located at (x, y) and sized (width, height)\r\n * @param x defines viewport left coordinate\r\n * @param y defines viewport top coordinate\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n */\r\n function Viewport(\r\n /** viewport left coordinate */\r\n x, \r\n /** viewport top coordinate */\r\n y, \r\n /**viewport width */\r\n width, \r\n /** viewport height */\r\n height) {\r\n this.x = x;\r\n this.y = y;\r\n this.width = width;\r\n this.height = height;\r\n }\r\n /**\r\n * Creates a new viewport using absolute sizing (from 0-> width, 0-> height instead of 0->1)\r\n * @param renderWidth defines the rendering width\r\n * @param renderHeight defines the rendering height\r\n * @returns a new Viewport\r\n */\r\n Viewport.prototype.toGlobal = function (renderWidth, renderHeight) {\r\n return new Viewport(this.x * renderWidth, this.y * renderHeight, this.width * renderWidth, this.height * renderHeight);\r\n };\r\n /**\r\n * Stores absolute viewport value into a target viewport (from 0-> width, 0-> height instead of 0->1)\r\n * @param renderWidth defines the rendering width\r\n * @param renderHeight defines the rendering height\r\n * @param ref defines the target viewport\r\n * @returns the current viewport\r\n */\r\n Viewport.prototype.toGlobalToRef = function (renderWidth, renderHeight, ref) {\r\n ref.x = this.x * renderWidth;\r\n ref.y = this.y * renderHeight;\r\n ref.width = this.width * renderWidth;\r\n ref.height = this.height * renderHeight;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Viewport copied from the current one\r\n * @returns a new Viewport\r\n */\r\n Viewport.prototype.clone = function () {\r\n return new Viewport(this.x, this.y, this.width, this.height);\r\n };\r\n return Viewport;\r\n}());\r\nexport { Viewport };\r\n//# sourceMappingURL=math.viewport.js.map","import { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nVertexData.CreateBox = function (options) {\r\n var nbFaces = 6;\r\n var indices = [0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23];\r\n var normals = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0];\r\n var uvs = [];\r\n var positions = [];\r\n var width = options.width || options.size || 1;\r\n var height = options.height || options.size || 1;\r\n var depth = options.depth || options.size || 1;\r\n var wrap = options.wrap || false;\r\n var topBaseAt = (options.topBaseAt === void 0) ? 1 : options.topBaseAt;\r\n var bottomBaseAt = (options.bottomBaseAt === void 0) ? 0 : options.bottomBaseAt;\r\n topBaseAt = (topBaseAt + 4) % 4; // places values as 0 to 3\r\n bottomBaseAt = (bottomBaseAt + 4) % 4; // places values as 0 to 3\r\n var topOrder = [2, 0, 3, 1];\r\n var bottomOrder = [2, 0, 1, 3];\r\n var topIndex = topOrder[topBaseAt];\r\n var bottomIndex = bottomOrder[bottomBaseAt];\r\n var basePositions = [1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1];\r\n if (wrap) {\r\n indices = [2, 3, 0, 2, 0, 1, 4, 5, 6, 4, 6, 7, 9, 10, 11, 9, 11, 8, 12, 14, 15, 12, 13, 14];\r\n basePositions = [-1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1];\r\n var topFaceBase = [[1, 1, 1], [-1, 1, 1], [-1, 1, -1], [1, 1, -1]];\r\n var bottomFaceBase = [[-1, -1, 1], [1, -1, 1], [1, -1, -1], [-1, -1, -1]];\r\n var topFaceOrder = [17, 18, 19, 16];\r\n var bottomFaceOrder = [22, 23, 20, 21];\r\n while (topIndex > 0) {\r\n topFaceBase.unshift(topFaceBase.pop());\r\n topFaceOrder.unshift(topFaceOrder.pop());\r\n topIndex--;\r\n }\r\n while (bottomIndex > 0) {\r\n bottomFaceBase.unshift(bottomFaceBase.pop());\r\n bottomFaceOrder.unshift(bottomFaceOrder.pop());\r\n bottomIndex--;\r\n }\r\n topFaceBase = topFaceBase.flat();\r\n bottomFaceBase = bottomFaceBase.flat();\r\n basePositions = basePositions.concat(topFaceBase).concat(bottomFaceBase);\r\n indices.push(topFaceOrder[0], topFaceOrder[2], topFaceOrder[3], topFaceOrder[0], topFaceOrder[1], topFaceOrder[2]);\r\n indices.push(bottomFaceOrder[0], bottomFaceOrder[2], bottomFaceOrder[3], bottomFaceOrder[0], bottomFaceOrder[1], bottomFaceOrder[2]);\r\n }\r\n var scaleArray = [width / 2, height / 2, depth / 2];\r\n positions = basePositions.reduce(function (accumulator, currentValue, currentIndex) { return accumulator.concat(currentValue * scaleArray[currentIndex % 3]); }, []);\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n var faceUV = options.faceUV || new Array(6);\r\n var faceColors = options.faceColors;\r\n var colors = [];\r\n // default face colors and UV if undefined\r\n for (var f = 0; f < 6; f++) {\r\n if (faceUV[f] === undefined) {\r\n faceUV[f] = new Vector4(0, 0, 1, 1);\r\n }\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new Color4(1, 1, 1, 1);\r\n }\r\n }\r\n // Create each face in turn.\r\n for (var index = 0; index < nbFaces; index++) {\r\n uvs.push(faceUV[index].z, faceUV[index].w);\r\n uvs.push(faceUV[index].x, faceUV[index].w);\r\n uvs.push(faceUV[index].x, faceUV[index].y);\r\n uvs.push(faceUV[index].z, faceUV[index].y);\r\n if (faceColors) {\r\n for (var c = 0; c < 4; c++) {\r\n colors.push(faceColors[index].r, faceColors[index].g, faceColors[index].b, faceColors[index].a);\r\n }\r\n }\r\n }\r\n // sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n var totalColors = (sideOrientation === VertexData.DOUBLESIDE) ? colors.concat(colors) : colors;\r\n vertexData.colors = totalColors;\r\n }\r\n return vertexData;\r\n};\r\nMesh.CreateBox = function (name, size, scene, updatable, sideOrientation) {\r\n if (scene === void 0) { scene = null; }\r\n var options = {\r\n size: size,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return BoxBuilder.CreateBox(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar BoxBuilder = /** @class */ (function () {\r\n function BoxBuilder() {\r\n }\r\n /**\r\n * Creates a box mesh\r\n * * The parameter `size` sets the size (float) of each box side (default 1)\r\n * * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value of `size`)\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements)\r\n * * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#box\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the box mesh\r\n */\r\n BoxBuilder.CreateBox = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var box = new Mesh(name, scene);\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n box._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = VertexData.CreateBox(options);\r\n vertexData.applyToMesh(box, options.updatable);\r\n return box;\r\n };\r\n return BoxBuilder;\r\n}());\r\nexport { BoxBuilder };\r\n//# sourceMappingURL=boxBuilder.js.map","import { Vector4, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Scene } from \"../../scene\";\r\nimport { Axis } from '../../Maths/math.axis';\r\nVertexData.CreateCylinder = function (options) {\r\n var height = options.height || 2;\r\n var diameterTop = (options.diameterTop === 0) ? 0 : options.diameterTop || options.diameter || 1;\r\n var diameterBottom = (options.diameterBottom === 0) ? 0 : options.diameterBottom || options.diameter || 1;\r\n diameterTop = diameterTop || 0.00001; // Prevent broken normals\r\n diameterBottom = diameterBottom || 0.00001; // Prevent broken normals\r\n var tessellation = options.tessellation || 24;\r\n var subdivisions = options.subdivisions || 1;\r\n var hasRings = options.hasRings ? true : false;\r\n var enclose = options.enclose ? true : false;\r\n var cap = (options.cap === 0) ? 0 : options.cap || Mesh.CAP_ALL;\r\n var arc = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n var faceUV = options.faceUV || new Array(3);\r\n var faceColors = options.faceColors;\r\n // default face colors and UV if undefined\r\n var quadNb = (arc !== 1 && enclose) ? 2 : 0;\r\n var ringNb = (hasRings) ? subdivisions : 1;\r\n var surfaceNb = 2 + (1 + quadNb) * ringNb;\r\n var f;\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new Color4(1, 1, 1, 1);\r\n }\r\n }\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceUV && faceUV[f] === undefined) {\r\n faceUV[f] = new Vector4(0, 0, 1, 1);\r\n }\r\n }\r\n var indices = new Array();\r\n var positions = new Array();\r\n var normals = new Array();\r\n var uvs = new Array();\r\n var colors = new Array();\r\n var angle_step = Math.PI * 2 * arc / tessellation;\r\n var angle;\r\n var h;\r\n var radius;\r\n var tan = (diameterBottom - diameterTop) / 2 / height;\r\n var ringVertex = Vector3.Zero();\r\n var ringNormal = Vector3.Zero();\r\n var ringFirstVertex = Vector3.Zero();\r\n var ringFirstNormal = Vector3.Zero();\r\n var quadNormal = Vector3.Zero();\r\n var Y = Axis.Y;\r\n // positions, normals, uvs\r\n var i;\r\n var j;\r\n var r;\r\n var ringIdx = 1;\r\n var s = 1; // surface index\r\n var cs = 0;\r\n var v = 0;\r\n for (i = 0; i <= subdivisions; i++) {\r\n h = i / subdivisions;\r\n radius = (h * (diameterTop - diameterBottom) + diameterBottom) / 2;\r\n ringIdx = (hasRings && i !== 0 && i !== subdivisions) ? 2 : 1;\r\n for (r = 0; r < ringIdx; r++) {\r\n if (hasRings) {\r\n s += r;\r\n }\r\n if (enclose) {\r\n s += 2 * r;\r\n }\r\n for (j = 0; j <= tessellation; j++) {\r\n angle = j * angle_step;\r\n // position\r\n ringVertex.x = Math.cos(-angle) * radius;\r\n ringVertex.y = -height / 2 + h * height;\r\n ringVertex.z = Math.sin(-angle) * radius;\r\n // normal\r\n if (diameterTop === 0 && i === subdivisions) {\r\n // if no top cap, reuse former normals\r\n ringNormal.x = normals[normals.length - (tessellation + 1) * 3];\r\n ringNormal.y = normals[normals.length - (tessellation + 1) * 3 + 1];\r\n ringNormal.z = normals[normals.length - (tessellation + 1) * 3 + 2];\r\n }\r\n else {\r\n ringNormal.x = ringVertex.x;\r\n ringNormal.z = ringVertex.z;\r\n ringNormal.y = Math.sqrt(ringNormal.x * ringNormal.x + ringNormal.z * ringNormal.z) * tan;\r\n ringNormal.normalize();\r\n }\r\n // keep first ring vertex values for enclose\r\n if (j === 0) {\r\n ringFirstVertex.copyFrom(ringVertex);\r\n ringFirstNormal.copyFrom(ringNormal);\r\n }\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n normals.push(ringNormal.x, ringNormal.y, ringNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s].y : faceUV[s].w;\r\n }\r\n else {\r\n v = faceUV[s].y + (faceUV[s].w - faceUV[s].y) * h;\r\n }\r\n uvs.push(faceUV[s].x + (faceUV[s].z - faceUV[s].x) * j / tessellation, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s].r, faceColors[s].g, faceColors[s].b, faceColors[s].a);\r\n }\r\n }\r\n // if enclose, add four vertices and their dedicated normals\r\n if (arc !== 1 && enclose) {\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(ringFirstVertex.x, ringFirstVertex.y, ringFirstVertex.z);\r\n Vector3.CrossToRef(Y, ringNormal, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n Vector3.CrossToRef(ringFirstNormal, Y, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 1].y : faceUV[s + 1].w;\r\n }\r\n else {\r\n v = faceUV[s + 1].y + (faceUV[s + 1].w - faceUV[s + 1].y) * h;\r\n }\r\n uvs.push(faceUV[s + 1].x, v);\r\n uvs.push(faceUV[s + 1].z, v);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 2].y : faceUV[s + 2].w;\r\n }\r\n else {\r\n v = faceUV[s + 2].y + (faceUV[s + 2].w - faceUV[s + 2].y) * h;\r\n }\r\n uvs.push(faceUV[s + 2].x, v);\r\n uvs.push(faceUV[s + 2].z, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n }\r\n }\r\n if (cs !== s) {\r\n cs = s;\r\n }\r\n }\r\n }\r\n // indices\r\n var e = (arc !== 1 && enclose) ? tessellation + 4 : tessellation; // correction of number of iteration if enclose\r\n var s;\r\n i = 0;\r\n for (s = 0; s < subdivisions; s++) {\r\n var i0 = 0;\r\n var i1 = 0;\r\n var i2 = 0;\r\n var i3 = 0;\r\n for (j = 0; j < tessellation; j++) {\r\n i0 = i * (e + 1) + j;\r\n i1 = (i + 1) * (e + 1) + j;\r\n i2 = i * (e + 1) + (j + 1);\r\n i3 = (i + 1) * (e + 1) + (j + 1);\r\n indices.push(i0, i1, i2);\r\n indices.push(i3, i2, i1);\r\n }\r\n if (arc !== 1 && enclose) { // if enclose, add two quads\r\n indices.push(i0 + 2, i1 + 2, i2 + 2);\r\n indices.push(i3 + 2, i2 + 2, i1 + 2);\r\n indices.push(i0 + 4, i1 + 4, i2 + 4);\r\n indices.push(i3 + 4, i2 + 4, i1 + 4);\r\n }\r\n i = (hasRings) ? (i + 2) : (i + 1);\r\n }\r\n // Caps\r\n var createCylinderCap = function (isTop) {\r\n var radius = isTop ? diameterTop / 2 : diameterBottom / 2;\r\n if (radius === 0) {\r\n return;\r\n }\r\n // Cap positions, normals & uvs\r\n var angle;\r\n var circleVector;\r\n var i;\r\n var u = (isTop) ? faceUV[surfaceNb - 1] : faceUV[0];\r\n var c = null;\r\n if (faceColors) {\r\n c = (isTop) ? faceColors[surfaceNb - 1] : faceColors[0];\r\n }\r\n // cap center\r\n var vbase = positions.length / 3;\r\n var offset = isTop ? height / 2 : -height / 2;\r\n var center = new Vector3(0, offset, 0);\r\n positions.push(center.x, center.y, center.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * 0.5, u.y + (u.w - u.y) * 0.5);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n var textureScale = new Vector2(0.5, 0.5);\r\n for (i = 0; i <= tessellation; i++) {\r\n angle = Math.PI * 2 * i * arc / tessellation;\r\n var cos = Math.cos(-angle);\r\n var sin = Math.sin(-angle);\r\n circleVector = new Vector3(cos * radius, offset, sin * radius);\r\n var textureCoordinate = new Vector2(cos * textureScale.x + 0.5, sin * textureScale.y + 0.5);\r\n positions.push(circleVector.x, circleVector.y, circleVector.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * textureCoordinate.x, u.y + (u.w - u.y) * textureCoordinate.y);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n }\r\n // Cap indices\r\n for (i = 0; i < tessellation; i++) {\r\n if (!isTop) {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 1));\r\n indices.push(vbase + (i + 2));\r\n }\r\n else {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 2));\r\n indices.push(vbase + (i + 1));\r\n }\r\n }\r\n };\r\n // add caps to geometry based on cap parameter\r\n if ((cap === Mesh.CAP_START)\r\n || (cap === Mesh.CAP_ALL)) {\r\n createCylinderCap(false);\r\n }\r\n if ((cap === Mesh.CAP_END)\r\n || (cap === Mesh.CAP_ALL)) {\r\n createCylinderCap(true);\r\n }\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n vertexData.colors = colors;\r\n }\r\n return vertexData;\r\n};\r\nMesh.CreateCylinder = function (name, height, diameterTop, diameterBottom, tessellation, subdivisions, scene, updatable, sideOrientation) {\r\n if (scene === undefined || !(scene instanceof Scene)) {\r\n if (scene !== undefined) {\r\n sideOrientation = updatable || Mesh.DEFAULTSIDE;\r\n updatable = scene;\r\n }\r\n scene = subdivisions;\r\n subdivisions = 1;\r\n }\r\n var options = {\r\n height: height,\r\n diameterTop: diameterTop,\r\n diameterBottom: diameterBottom,\r\n tessellation: tessellation,\r\n subdivisions: subdivisions,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return CylinderBuilder.CreateCylinder(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar CylinderBuilder = /** @class */ (function () {\r\n function CylinderBuilder() {\r\n }\r\n /**\r\n * Creates a cylinder or a cone mesh\r\n * * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).\r\n * * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).\r\n * * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter \"diameterBottom\" can't be zero.\r\n * * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.\r\n * * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).\r\n * * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.\r\n * * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.\r\n * * The parameter `cap` sets the way the cylinder is capped. Possible values : BABYLON.Mesh.NO_CAP, BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL (default).\r\n * * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).\r\n * * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3\r\n * * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7\r\n * * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17\r\n * * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.\r\n * * If `enclose` is false, a ring surface is one element.\r\n * * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.\r\n * * Example how to set colors and textures on a sliced cylinder : https://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the cylinder mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#cylinder-or-cone\r\n */\r\n CylinderBuilder.CreateCylinder = function (name, options, scene) {\r\n var cylinder = new Mesh(name, scene);\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n cylinder._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = VertexData.CreateCylinder(options);\r\n vertexData.applyToMesh(cylinder, options.updatable);\r\n return cylinder;\r\n };\r\n return CylinderBuilder;\r\n}());\r\nexport { CylinderBuilder };\r\n//# sourceMappingURL=cylinderBuilder.js.map","import { __extends } from \"tslib\";\r\nimport { TmpVectors } from \"../Maths/math.vector\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { DeepCopier } from \"../Misc/deepCopier\";\r\nimport { TransformNode } from './transformNode';\r\nimport { VertexBuffer } from './buffer';\r\nimport { BoundingInfo } from '../Culling/boundingInfo';\r\nimport { Tools } from '../Misc/tools';\r\nMesh._instancedMeshFactory = function (name, mesh) {\r\n var instance = new InstancedMesh(name, mesh);\r\n if (mesh.instancedBuffers) {\r\n instance.instancedBuffers = {};\r\n for (var key in mesh.instancedBuffers) {\r\n instance.instancedBuffers[key] = mesh.instancedBuffers[key];\r\n }\r\n }\r\n return instance;\r\n};\r\n/**\r\n * Creates an instance based on a source mesh.\r\n */\r\nvar InstancedMesh = /** @class */ (function (_super) {\r\n __extends(InstancedMesh, _super);\r\n function InstancedMesh(name, source) {\r\n var _this = _super.call(this, name, source.getScene()) || this;\r\n /** @hidden */\r\n _this._indexInSourceMeshInstanceArray = -1;\r\n source.addInstance(_this);\r\n _this._sourceMesh = source;\r\n _this._unIndexed = source._unIndexed;\r\n _this.position.copyFrom(source.position);\r\n _this.rotation.copyFrom(source.rotation);\r\n _this.scaling.copyFrom(source.scaling);\r\n if (source.rotationQuaternion) {\r\n _this.rotationQuaternion = source.rotationQuaternion.clone();\r\n }\r\n _this.animations = Tools.Slice(source.animations);\r\n for (var _i = 0, _a = source.getAnimationRanges(); _i < _a.length; _i++) {\r\n var range = _a[_i];\r\n if (range != null) {\r\n _this.createAnimationRange(range.name, range.from, range.to);\r\n }\r\n }\r\n _this.infiniteDistance = source.infiniteDistance;\r\n _this.setPivotMatrix(source.getPivotMatrix());\r\n _this.refreshBoundingInfo();\r\n _this._syncSubMeshes();\r\n return _this;\r\n }\r\n /**\r\n * Returns the string \"InstancedMesh\".\r\n */\r\n InstancedMesh.prototype.getClassName = function () {\r\n return \"InstancedMesh\";\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"lightSources\", {\r\n /** Gets the list of lights affecting that mesh */\r\n get: function () {\r\n return this._sourceMesh._lightSources;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n InstancedMesh.prototype._resyncLightSources = function () {\r\n // Do nothing as all the work will be done by source mesh\r\n };\r\n InstancedMesh.prototype._resyncLightSource = function (light) {\r\n // Do nothing as all the work will be done by source mesh\r\n };\r\n InstancedMesh.prototype._removeLightSource = function (light, dispose) {\r\n // Do nothing as all the work will be done by source mesh\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"receiveShadows\", {\r\n // Methods\r\n /**\r\n * If the source mesh receives shadows\r\n */\r\n get: function () {\r\n return this._sourceMesh.receiveShadows;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"material\", {\r\n /**\r\n * The material of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.material;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"visibility\", {\r\n /**\r\n * Visibility of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.visibility;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"skeleton\", {\r\n /**\r\n * Skeleton of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.skeleton;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"renderingGroupId\", {\r\n /**\r\n * Rendering ground id of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.renderingGroupId;\r\n },\r\n set: function (value) {\r\n if (!this._sourceMesh || value === this._sourceMesh.renderingGroupId) {\r\n return;\r\n }\r\n //no-op with warning\r\n Logger.Warn(\"Note - setting renderingGroupId of an instanced mesh has no effect on the scene\");\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the total number of vertices (integer).\r\n */\r\n InstancedMesh.prototype.getTotalVertices = function () {\r\n return this._sourceMesh ? this._sourceMesh.getTotalVertices() : 0;\r\n };\r\n /**\r\n * Returns a positive integer : the total number of indices in this mesh geometry.\r\n * @returns the numner of indices or zero if the mesh has no geometry.\r\n */\r\n InstancedMesh.prototype.getTotalIndices = function () {\r\n return this._sourceMesh.getTotalIndices();\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"sourceMesh\", {\r\n /**\r\n * The source mesh of the instance\r\n */\r\n get: function () {\r\n return this._sourceMesh;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a new InstancedMesh object from the mesh model.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_instances\r\n * @param name defines the name of the new instance\r\n * @returns a new InstancedMesh\r\n */\r\n InstancedMesh.prototype.createInstance = function (name) {\r\n return this._sourceMesh.createInstance(name);\r\n };\r\n /**\r\n * Is this node ready to be used/rendered\r\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\r\n * @return {boolean} is it ready\r\n */\r\n InstancedMesh.prototype.isReady = function (completeCheck) {\r\n if (completeCheck === void 0) { completeCheck = false; }\r\n return this._sourceMesh.isReady(completeCheck, true);\r\n };\r\n /**\r\n * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.\r\n * @param kind kind of verticies to retreive (eg. positons, normals, uvs, etc.)\r\n * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.\r\n * @returns a float array or a Float32Array of the requested kind of data : positons, normals, uvs, etc.\r\n */\r\n InstancedMesh.prototype.getVerticesData = function (kind, copyWhenShared) {\r\n return this._sourceMesh.getVerticesData(kind, copyWhenShared);\r\n };\r\n /**\r\n * Sets the vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.\r\n * The `data` are either a numeric array either a Float32Array.\r\n * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.\r\n * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc).\r\n * Note that a new underlying VertexBuffer object is created each call.\r\n * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\r\n *\r\n * Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n *\r\n * Returns the Mesh.\r\n */\r\n InstancedMesh.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n if (this.sourceMesh) {\r\n this.sourceMesh.setVerticesData(kind, data, updatable, stride);\r\n }\r\n return this.sourceMesh;\r\n };\r\n /**\r\n * Updates the existing vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, it is simply returned as it is.\r\n * The `data` are either a numeric array either a Float32Array.\r\n * No new underlying VertexBuffer object is created.\r\n * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\r\n * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.\r\n *\r\n * Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n *\r\n * Returns the Mesh.\r\n */\r\n InstancedMesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {\r\n if (this.sourceMesh) {\r\n this.sourceMesh.updateVerticesData(kind, data, updateExtends, makeItUnique);\r\n }\r\n return this.sourceMesh;\r\n };\r\n /**\r\n * Sets the mesh indices.\r\n * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).\r\n * If the mesh has no geometry, a new Geometry object is created and set to the mesh.\r\n * This method creates a new index buffer each call.\r\n * Returns the Mesh.\r\n */\r\n InstancedMesh.prototype.setIndices = function (indices, totalVertices) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n if (this.sourceMesh) {\r\n this.sourceMesh.setIndices(indices, totalVertices);\r\n }\r\n return this.sourceMesh;\r\n };\r\n /**\r\n * Boolean : True if the mesh owns the requested kind of data.\r\n */\r\n InstancedMesh.prototype.isVerticesDataPresent = function (kind) {\r\n return this._sourceMesh.isVerticesDataPresent(kind);\r\n };\r\n /**\r\n * Returns an array of indices (IndicesArray).\r\n */\r\n InstancedMesh.prototype.getIndices = function () {\r\n return this._sourceMesh.getIndices();\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"_positions\", {\r\n get: function () {\r\n return this._sourceMesh._positions;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\r\n * This means the mesh underlying bounding box and sphere are recomputed.\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @returns the current mesh\r\n */\r\n InstancedMesh.prototype.refreshBoundingInfo = function (applySkeleton) {\r\n if (applySkeleton === void 0) { applySkeleton = false; }\r\n if (this._boundingInfo && this._boundingInfo.isLocked) {\r\n return this;\r\n }\r\n var bias = this._sourceMesh.geometry ? this._sourceMesh.geometry.boundingBias : null;\r\n this._refreshBoundingInfo(this._sourceMesh._getPositionData(applySkeleton), bias);\r\n return this;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._preActivate = function () {\r\n if (this._currentLOD) {\r\n this._currentLOD._preActivate();\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._activate = function (renderId, intermediateRendering) {\r\n if (!this._sourceMesh.subMeshes) {\r\n Logger.Warn(\"Instances should only be created for meshes with geometry.\");\r\n }\r\n if (this._currentLOD) {\r\n var differentSign = (this._currentLOD._getWorldMatrixDeterminant() > 0) !== (this._getWorldMatrixDeterminant() > 0);\r\n if (differentSign) {\r\n this._internalAbstractMeshDataInfo._actAsRegularMesh = true;\r\n return true;\r\n }\r\n this._internalAbstractMeshDataInfo._actAsRegularMesh = false;\r\n this._currentLOD._registerInstanceForRenderId(this, renderId);\r\n if (intermediateRendering) {\r\n if (!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate) {\r\n this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = true;\r\n return true;\r\n }\r\n }\r\n else {\r\n if (!this._currentLOD._internalAbstractMeshDataInfo._isActive) {\r\n this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances = true;\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._postActivate = function () {\r\n if (this._sourceMesh.edgesShareWithInstances && this._sourceMesh._edgesRenderer && this._sourceMesh._edgesRenderer.isEnabled && this._sourceMesh._renderingGroup) {\r\n // we are using the edge renderer of the source mesh\r\n this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer);\r\n this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix());\r\n }\r\n else if (this._edgesRenderer && this._edgesRenderer.isEnabled && this._sourceMesh._renderingGroup) {\r\n // we are using the edge renderer defined for this instance\r\n this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer);\r\n }\r\n };\r\n InstancedMesh.prototype.getWorldMatrix = function () {\r\n if (this._currentLOD && this._currentLOD.billboardMode !== TransformNode.BILLBOARDMODE_NONE && this._currentLOD._masterMesh !== this) {\r\n var tempMaster = this._currentLOD._masterMesh;\r\n this._currentLOD._masterMesh = this;\r\n TmpVectors.Vector3[7].copyFrom(this._currentLOD.position);\r\n this._currentLOD.position.set(0, 0, 0);\r\n TmpVectors.Matrix[0].copyFrom(this._currentLOD.computeWorldMatrix(true));\r\n this._currentLOD.position.copyFrom(TmpVectors.Vector3[7]);\r\n this._currentLOD._masterMesh = tempMaster;\r\n return TmpVectors.Matrix[0];\r\n }\r\n return _super.prototype.getWorldMatrix.call(this);\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"isAnInstance\", {\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the current associated LOD AbstractMesh.\r\n */\r\n InstancedMesh.prototype.getLOD = function (camera) {\r\n if (!camera) {\r\n return this;\r\n }\r\n var boundingInfo = this.getBoundingInfo();\r\n this._currentLOD = this.sourceMesh.getLOD(camera, boundingInfo.boundingSphere);\r\n if (this._currentLOD === this.sourceMesh) {\r\n return this.sourceMesh;\r\n }\r\n return this._currentLOD;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._preActivateForIntermediateRendering = function (renderId) {\r\n return this.sourceMesh._preActivateForIntermediateRendering(renderId);\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._syncSubMeshes = function () {\r\n this.releaseSubMeshes();\r\n if (this._sourceMesh.subMeshes) {\r\n for (var index = 0; index < this._sourceMesh.subMeshes.length; index++) {\r\n this._sourceMesh.subMeshes[index].clone(this, this._sourceMesh);\r\n }\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._generatePointsArray = function () {\r\n return this._sourceMesh._generatePointsArray();\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._updateBoundingInfo = function () {\r\n var effectiveMesh = this;\r\n if (this._boundingInfo) {\r\n this._boundingInfo.update(effectiveMesh.worldMatrixFromCache);\r\n }\r\n else {\r\n this._boundingInfo = new BoundingInfo(this.absolutePosition, this.absolutePosition, effectiveMesh.worldMatrixFromCache);\r\n }\r\n this._updateSubMeshesBoundingInfo(effectiveMesh.worldMatrixFromCache);\r\n return this;\r\n };\r\n /**\r\n * Creates a new InstancedMesh from the current mesh.\r\n * - name (string) : the cloned mesh name\r\n * - newParent (optional Node) : the optional Node to parent the clone to.\r\n * - doNotCloneChildren (optional boolean, default `false`) : if `true` the model children aren't cloned.\r\n *\r\n * Returns the clone.\r\n */\r\n InstancedMesh.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n if (newParent === void 0) { newParent = null; }\r\n var result = this._sourceMesh.createInstance(name);\r\n // Deep copy\r\n DeepCopier.DeepCopy(this, result, [\r\n \"name\", \"subMeshes\", \"uniqueId\", \"parent\", \"lightSources\",\r\n \"receiveShadows\", \"material\", \"visibility\", \"skeleton\",\r\n \"sourceMesh\", \"isAnInstance\", \"facetNb\", \"isFacetDataEnabled\",\r\n \"isBlocked\", \"useBones\", \"hasInstances\", \"collider\", \"edgesRenderer\",\r\n \"forward\", \"up\", \"right\", \"absolutePosition\", \"absoluteScaling\", \"absoluteRotationQuaternion\",\r\n \"isWorldMatrixFrozen\", \"nonUniformScaling\", \"behaviors\", \"worldMatrixFromCache\", \"hasThinInstances\"\r\n ], []);\r\n // Bounding info\r\n this.refreshBoundingInfo();\r\n // Parent\r\n if (newParent) {\r\n result.parent = newParent;\r\n }\r\n if (!doNotCloneChildren) {\r\n // Children\r\n for (var index = 0; index < this.getScene().meshes.length; index++) {\r\n var mesh = this.getScene().meshes[index];\r\n if (mesh.parent === this) {\r\n mesh.clone(mesh.name, result);\r\n }\r\n }\r\n }\r\n result.computeWorldMatrix(true);\r\n return result;\r\n };\r\n /**\r\n * Disposes the InstancedMesh.\r\n * Returns nothing.\r\n */\r\n InstancedMesh.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n // Remove from mesh\r\n this._sourceMesh.removeInstance(this);\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n return InstancedMesh;\r\n}(AbstractMesh));\r\nexport { InstancedMesh };\r\nMesh.prototype.edgesShareWithInstances = false;\r\nMesh.prototype.registerInstancedBuffer = function (kind, stride) {\r\n // Remove existing one\r\n this.removeVerticesData(kind);\r\n // Creates the instancedBuffer field if not present\r\n if (!this.instancedBuffers) {\r\n this.instancedBuffers = {};\r\n for (var _i = 0, _a = this.instances; _i < _a.length; _i++) {\r\n var instance = _a[_i];\r\n instance.instancedBuffers = {};\r\n }\r\n this._userInstancedBuffersStorage = {\r\n data: {},\r\n vertexBuffers: {},\r\n strides: {},\r\n sizes: {}\r\n };\r\n }\r\n // Creates an empty property for this kind\r\n this.instancedBuffers[kind] = null;\r\n this._userInstancedBuffersStorage.strides[kind] = stride;\r\n this._userInstancedBuffersStorage.sizes[kind] = stride * 32; // Initial size\r\n this._userInstancedBuffersStorage.data[kind] = new Float32Array(this._userInstancedBuffersStorage.sizes[kind]);\r\n this._userInstancedBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), this._userInstancedBuffersStorage.data[kind], kind, true, false, stride, true);\r\n this.setVerticesBuffer(this._userInstancedBuffersStorage.vertexBuffers[kind]);\r\n for (var _b = 0, _c = this.instances; _b < _c.length; _b++) {\r\n var instance = _c[_b];\r\n instance.instancedBuffers[kind] = null;\r\n }\r\n};\r\nMesh.prototype._processInstancedBuffers = function (visibleInstances, renderSelf) {\r\n var instanceCount = visibleInstances.length;\r\n for (var kind in this.instancedBuffers) {\r\n var size = this._userInstancedBuffersStorage.sizes[kind];\r\n var stride = this._userInstancedBuffersStorage.strides[kind];\r\n // Resize if required\r\n var expectedSize = (instanceCount + 1) * stride;\r\n while (size < expectedSize) {\r\n size *= 2;\r\n }\r\n if (this._userInstancedBuffersStorage.data[kind].length != size) {\r\n this._userInstancedBuffersStorage.data[kind] = new Float32Array(size);\r\n this._userInstancedBuffersStorage.sizes[kind] = size;\r\n if (this._userInstancedBuffersStorage.vertexBuffers[kind]) {\r\n this._userInstancedBuffersStorage.vertexBuffers[kind].dispose();\r\n this._userInstancedBuffersStorage.vertexBuffers[kind] = null;\r\n }\r\n }\r\n var data = this._userInstancedBuffersStorage.data[kind];\r\n // Update data buffer\r\n var offset = 0;\r\n if (renderSelf) {\r\n var value = this.instancedBuffers[kind];\r\n if (value.toArray) {\r\n value.toArray(data, offset);\r\n }\r\n else {\r\n value.copyToArray(data, offset);\r\n }\r\n offset += stride;\r\n }\r\n for (var instanceIndex = 0; instanceIndex < instanceCount; instanceIndex++) {\r\n var instance = visibleInstances[instanceIndex];\r\n var value = instance.instancedBuffers[kind];\r\n if (value.toArray) {\r\n value.toArray(data, offset);\r\n }\r\n else {\r\n value.copyToArray(data, offset);\r\n }\r\n offset += stride;\r\n }\r\n // Update vertex buffer\r\n if (!this._userInstancedBuffersStorage.vertexBuffers[kind]) {\r\n this._userInstancedBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), this._userInstancedBuffersStorage.data[kind], kind, true, false, stride, true);\r\n this.setVerticesBuffer(this._userInstancedBuffersStorage.vertexBuffers[kind]);\r\n }\r\n else {\r\n this._userInstancedBuffersStorage.vertexBuffers[kind].updateDirectly(data, 0);\r\n }\r\n }\r\n};\r\nMesh.prototype._disposeInstanceSpecificData = function () {\r\n if (this._instanceDataStorage.instancesBuffer) {\r\n this._instanceDataStorage.instancesBuffer.dispose();\r\n this._instanceDataStorage.instancesBuffer = null;\r\n }\r\n while (this.instances.length) {\r\n this.instances[0].dispose();\r\n }\r\n for (var kind in this.instancedBuffers) {\r\n if (this._userInstancedBuffersStorage.vertexBuffers[kind]) {\r\n this._userInstancedBuffersStorage.vertexBuffers[kind].dispose();\r\n }\r\n }\r\n this.instancedBuffers = {};\r\n};\r\n//# sourceMappingURL=instancedMesh.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/clipPlaneFragmentDeclaration\";\r\nimport \"./ShadersInclude/clipPlaneFragment\";\r\nvar name = 'colorPixelShader';\r\nvar shader = \"#ifdef VERTEXCOLOR\\nvarying vec4 vColor;\\n#else\\nuniform vec4 color;\\n#endif\\n#include\\nvoid main(void) {\\n#include\\n#ifdef VERTEXCOLOR\\ngl_FragColor=vColor;\\n#else\\ngl_FragColor=color;\\n#endif\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var colorPixelShader = { name: name, shader: shader };\r\n//# sourceMappingURL=color.fragment.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/bonesDeclaration\";\r\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\r\nimport \"./ShadersInclude/instancesDeclaration\";\r\nimport \"./ShadersInclude/instancesVertex\";\r\nimport \"./ShadersInclude/bonesVertex\";\r\nimport \"./ShadersInclude/clipPlaneVertex\";\r\nvar name = 'colorVertexShader';\r\nvar shader = \"\\nattribute vec3 position;\\n#ifdef VERTEXCOLOR\\nattribute vec4 color;\\n#endif\\n#include\\n#include\\n\\n#include\\nuniform mat4 viewProjection;\\n#ifdef MULTIVIEW\\nuniform mat4 viewProjectionR;\\n#endif\\n\\n#ifdef VERTEXCOLOR\\nvarying vec4 vColor;\\n#endif\\nvoid main(void) {\\n#include\\n#include\\nvec4 worldPos=finalWorld*vec4(position,1.0);\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR == 0u) {\\ngl_Position=viewProjection*worldPos;\\n} else {\\ngl_Position=viewProjectionR*worldPos;\\n}\\n#else\\ngl_Position=viewProjection*worldPos;\\n#endif\\n#include\\n#ifdef VERTEXCOLOR\\n\\nvColor=color;\\n#endif\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var colorVertexShader = { name: name, shader: shader };\r\n//# sourceMappingURL=color.vertex.js.map","import { __extends } from \"tslib\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { InstancedMesh } from \"../Meshes/instancedMesh\";\r\nimport { Material } from \"../Materials/material\";\r\nimport { ShaderMaterial } from \"../Materials/shaderMaterial\";\r\nimport { MaterialHelper } from '../Materials/materialHelper';\r\nimport \"../Shaders/color.fragment\";\r\nimport \"../Shaders/color.vertex\";\r\n/**\r\n * Line mesh\r\n * @see https://doc.babylonjs.com/babylon101/parametric_shapes\r\n */\r\nvar LinesMesh = /** @class */ (function (_super) {\r\n __extends(LinesMesh, _super);\r\n /**\r\n * Creates a new LinesMesh\r\n * @param name defines the name\r\n * @param scene defines the hosting scene\r\n * @param parent defines the parent mesh if any\r\n * @param source defines the optional source LinesMesh used to clone data from\r\n * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.\r\n * When false, achieved by calling a clone(), also passing False.\r\n * This will make creation of children, recursive.\r\n * @param useVertexColor defines if this LinesMesh supports vertex color\r\n * @param useVertexAlpha defines if this LinesMesh supports vertex alpha\r\n */\r\n function LinesMesh(name, scene, parent, source, doNotCloneChildren, \r\n /**\r\n * If vertex color should be applied to the mesh\r\n */\r\n useVertexColor, \r\n /**\r\n * If vertex alpha should be applied to the mesh\r\n */\r\n useVertexAlpha) {\r\n if (scene === void 0) { scene = null; }\r\n if (parent === void 0) { parent = null; }\r\n if (source === void 0) { source = null; }\r\n var _this = _super.call(this, name, scene, parent, source, doNotCloneChildren) || this;\r\n _this.useVertexColor = useVertexColor;\r\n _this.useVertexAlpha = useVertexAlpha;\r\n /**\r\n * Color of the line (Default: White)\r\n */\r\n _this.color = new Color3(1, 1, 1);\r\n /**\r\n * Alpha of the line (Default: 1)\r\n */\r\n _this.alpha = 1;\r\n if (source) {\r\n _this.color = source.color.clone();\r\n _this.alpha = source.alpha;\r\n _this.useVertexColor = source.useVertexColor;\r\n _this.useVertexAlpha = source.useVertexAlpha;\r\n }\r\n _this.intersectionThreshold = 0.1;\r\n var defines = [];\r\n var options = {\r\n attributes: [VertexBuffer.PositionKind, \"world0\", \"world1\", \"world2\", \"world3\"],\r\n uniforms: [\"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"vClipPlane5\", \"vClipPlane6\", \"world\", \"viewProjection\"],\r\n needAlphaBlending: true,\r\n defines: defines\r\n };\r\n if (useVertexAlpha === false) {\r\n options.needAlphaBlending = false;\r\n }\r\n if (!useVertexColor) {\r\n options.uniforms.push(\"color\");\r\n _this.color4 = new Color4();\r\n }\r\n else {\r\n options.defines.push(\"#define VERTEXCOLOR\");\r\n options.attributes.push(VertexBuffer.ColorKind);\r\n }\r\n _this._colorShader = new ShaderMaterial(\"colorShader\", _this.getScene(), \"color\", options);\r\n return _this;\r\n }\r\n LinesMesh.prototype._addClipPlaneDefine = function (label) {\r\n var define = \"#define \" + label;\r\n var index = this._colorShader.options.defines.indexOf(define);\r\n if (index !== -1) {\r\n return;\r\n }\r\n this._colorShader.options.defines.push(define);\r\n };\r\n LinesMesh.prototype._removeClipPlaneDefine = function (label) {\r\n var define = \"#define \" + label;\r\n var index = this._colorShader.options.defines.indexOf(define);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._colorShader.options.defines.splice(index, 1);\r\n };\r\n LinesMesh.prototype.isReady = function () {\r\n var scene = this.getScene();\r\n // Clip planes\r\n scene.clipPlane ? this._addClipPlaneDefine(\"CLIPPLANE\") : this._removeClipPlaneDefine(\"CLIPPLANE\");\r\n scene.clipPlane2 ? this._addClipPlaneDefine(\"CLIPPLANE2\") : this._removeClipPlaneDefine(\"CLIPPLANE2\");\r\n scene.clipPlane3 ? this._addClipPlaneDefine(\"CLIPPLANE3\") : this._removeClipPlaneDefine(\"CLIPPLANE3\");\r\n scene.clipPlane4 ? this._addClipPlaneDefine(\"CLIPPLANE4\") : this._removeClipPlaneDefine(\"CLIPPLANE4\");\r\n scene.clipPlane5 ? this._addClipPlaneDefine(\"CLIPPLANE5\") : this._removeClipPlaneDefine(\"CLIPPLANE5\");\r\n scene.clipPlane6 ? this._addClipPlaneDefine(\"CLIPPLANE6\") : this._removeClipPlaneDefine(\"CLIPPLANE6\");\r\n if (!this._colorShader.isReady(this)) {\r\n return false;\r\n }\r\n return _super.prototype.isReady.call(this);\r\n };\r\n /**\r\n * Returns the string \"LineMesh\"\r\n */\r\n LinesMesh.prototype.getClassName = function () {\r\n return \"LinesMesh\";\r\n };\r\n Object.defineProperty(LinesMesh.prototype, \"material\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n return this._colorShader;\r\n },\r\n /**\r\n * @hidden\r\n */\r\n set: function (value) {\r\n // Do nothing\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(LinesMesh.prototype, \"checkCollisions\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n LinesMesh.prototype._bind = function (subMesh, effect, fillMode) {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n var colorEffect = this._colorShader.getEffect();\r\n // VBOs\r\n var indexToBind = this.isUnIndexed ? null : this._geometry.getIndexBuffer();\r\n this._geometry._bind(colorEffect, indexToBind);\r\n // Color\r\n if (!this.useVertexColor) {\r\n var _a = this.color, r = _a.r, g = _a.g, b = _a.b;\r\n this.color4.set(r, g, b, this.alpha);\r\n this._colorShader.setColor4(\"color\", this.color4);\r\n }\r\n // Clip planes\r\n MaterialHelper.BindClipPlane(colorEffect, this.getScene());\r\n return this;\r\n };\r\n /** @hidden */\r\n LinesMesh.prototype._draw = function (subMesh, fillMode, instancesCount) {\r\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\r\n return this;\r\n }\r\n var engine = this.getScene().getEngine();\r\n // Draw order\r\n if (this._unIndexed) {\r\n engine.drawArraysType(Material.LineListDrawMode, subMesh.verticesStart, subMesh.verticesCount, instancesCount);\r\n }\r\n else {\r\n engine.drawElementsType(Material.LineListDrawMode, subMesh.indexStart, subMesh.indexCount, instancesCount);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Disposes of the line mesh\r\n * @param doNotRecurse If children should be disposed\r\n */\r\n LinesMesh.prototype.dispose = function (doNotRecurse) {\r\n this._colorShader.dispose(false, false, true);\r\n _super.prototype.dispose.call(this, doNotRecurse);\r\n };\r\n /**\r\n * Returns a new LineMesh object cloned from the current one.\r\n */\r\n LinesMesh.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n if (newParent === void 0) { newParent = null; }\r\n return new LinesMesh(name, this.getScene(), newParent, this, doNotCloneChildren);\r\n };\r\n /**\r\n * Creates a new InstancedLinesMesh object from the mesh model.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_instances\r\n * @param name defines the name of the new instance\r\n * @returns a new InstancedLinesMesh\r\n */\r\n LinesMesh.prototype.createInstance = function (name) {\r\n return new InstancedLinesMesh(name, this);\r\n };\r\n return LinesMesh;\r\n}(Mesh));\r\nexport { LinesMesh };\r\n/**\r\n * Creates an instance based on a source LinesMesh\r\n */\r\nvar InstancedLinesMesh = /** @class */ (function (_super) {\r\n __extends(InstancedLinesMesh, _super);\r\n function InstancedLinesMesh(name, source) {\r\n var _this = _super.call(this, name, source) || this;\r\n _this.intersectionThreshold = source.intersectionThreshold;\r\n return _this;\r\n }\r\n /**\r\n * Returns the string \"InstancedLinesMesh\".\r\n */\r\n InstancedLinesMesh.prototype.getClassName = function () {\r\n return \"InstancedLinesMesh\";\r\n };\r\n return InstancedLinesMesh;\r\n}(InstancedMesh));\r\nexport { InstancedLinesMesh };\r\n//# sourceMappingURL=linesMesh.js.map","import { Vector3 } from \"../../Maths/math.vector\";\r\nimport { _CreationDataStorage, Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { LinesMesh } from \"../../Meshes/linesMesh\";\r\nimport { VertexBuffer } from \"../../Meshes/buffer\";\r\nVertexData.CreateLineSystem = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n var vertexColors = [];\r\n var idx = 0;\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var index = 0; index < points.length; index++) {\r\n positions.push(points[index].x, points[index].y, points[index].z);\r\n if (colors) {\r\n var color = colors[l];\r\n vertexColors.push(color[index].r, color[index].g, color[index].b, color[index].a);\r\n }\r\n if (index > 0) {\r\n indices.push(idx - 1);\r\n indices.push(idx);\r\n }\r\n idx++;\r\n }\r\n }\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n if (colors) {\r\n vertexData.colors = vertexColors;\r\n }\r\n return vertexData;\r\n};\r\nVertexData.CreateDashedLines = function (options) {\r\n var dashSize = options.dashSize || 3;\r\n var gapSize = options.gapSize || 1;\r\n var dashNb = options.dashNb || 200;\r\n var points = options.points;\r\n var positions = new Array();\r\n var indices = new Array();\r\n var curvect = Vector3.Zero();\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var idx = 0;\r\n var i = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / dashNb;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n for (var j = 0; j < nb; j++) {\r\n curshft = shft * j;\r\n positions.push(points[i].x + curshft * curvect.x, points[i].y + curshft * curvect.y, points[i].z + curshft * curvect.z);\r\n positions.push(points[i].x + (curshft + dashshft) * curvect.x, points[i].y + (curshft + dashshft) * curvect.y, points[i].z + (curshft + dashshft) * curvect.z);\r\n indices.push(idx, idx + 1);\r\n idx += 2;\r\n }\r\n }\r\n // Result\r\n var vertexData = new VertexData();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n return vertexData;\r\n};\r\nMesh.CreateLines = function (name, points, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (instance === void 0) { instance = null; }\r\n var options = {\r\n points: points,\r\n updatable: updatable,\r\n instance: instance\r\n };\r\n return LinesBuilder.CreateLines(name, options, scene);\r\n};\r\nMesh.CreateDashedLines = function (name, points, dashSize, gapSize, dashNb, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n var options = {\r\n points: points,\r\n dashSize: dashSize,\r\n gapSize: gapSize,\r\n dashNb: dashNb,\r\n updatable: updatable,\r\n instance: instance\r\n };\r\n return LinesBuilder.CreateDashedLines(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar LinesBuilder = /** @class */ (function () {\r\n function LinesBuilder() {\r\n }\r\n /**\r\n * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh\r\n * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function\r\n * * The parameter `lines` is an array of lines, each line being an array of successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter\r\n * * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * Updating a simple Line mesh, you just need to update every line in the `lines` array : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#line-system\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line system mesh\r\n */\r\n LinesBuilder.CreateLineSystem = function (name, options, scene) {\r\n var instance = options.instance;\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n if (instance) { // lines update\r\n var positions = instance.getVerticesData(VertexBuffer.PositionKind);\r\n var vertexColor;\r\n var lineColors;\r\n if (colors) {\r\n vertexColor = instance.getVerticesData(VertexBuffer.ColorKind);\r\n }\r\n var i = 0;\r\n var c = 0;\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var p = 0; p < points.length; p++) {\r\n positions[i] = points[p].x;\r\n positions[i + 1] = points[p].y;\r\n positions[i + 2] = points[p].z;\r\n if (colors && vertexColor) {\r\n lineColors = colors[l];\r\n vertexColor[c] = lineColors[p].r;\r\n vertexColor[c + 1] = lineColors[p].g;\r\n vertexColor[c + 2] = lineColors[p].b;\r\n vertexColor[c + 3] = lineColors[p].a;\r\n c += 4;\r\n }\r\n i += 3;\r\n }\r\n }\r\n instance.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\r\n if (colors && vertexColor) {\r\n instance.updateVerticesData(VertexBuffer.ColorKind, vertexColor, false, false);\r\n }\r\n return instance;\r\n }\r\n // line system creation\r\n var useVertexColor = (colors) ? true : false;\r\n var lineSystem = new LinesMesh(name, scene, null, undefined, undefined, useVertexColor, options.useVertexAlpha);\r\n var vertexData = VertexData.CreateLineSystem(options);\r\n vertexData.applyToMesh(lineSystem, options.updatable);\r\n return lineSystem;\r\n };\r\n /**\r\n * Creates a line mesh\r\n * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `colors` is an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need alpha blending (faster)\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#lines\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line mesh\r\n */\r\n LinesBuilder.CreateLines = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var colors = (options.colors) ? [options.colors] : null;\r\n var lines = LinesBuilder.CreateLineSystem(name, { lines: [options.points], updatable: options.updatable, instance: options.instance, colors: colors, useVertexAlpha: options.useVertexAlpha }, scene);\r\n return lines;\r\n };\r\n /**\r\n * Creates a dashed line mesh\r\n * * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200)\r\n * * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3)\r\n * * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the dashed line mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#dashed-lines\r\n */\r\n LinesBuilder.CreateDashedLines = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var points = options.points;\r\n var instance = options.instance;\r\n var gapSize = options.gapSize || 1;\r\n var dashSize = options.dashSize || 3;\r\n if (instance) { // dashed lines update\r\n var positionFunction = function (positions) {\r\n var curvect = Vector3.Zero();\r\n var nbSeg = positions.length / 6;\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var p = 0;\r\n var i = 0;\r\n var j = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / nbSeg;\r\n var dashSize = instance._creationDataStorage.dashSize;\r\n var gapSize = instance._creationDataStorage.gapSize;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n j = 0;\r\n while (j < nb && p < positions.length) {\r\n curshft = shft * j;\r\n positions[p] = points[i].x + curshft * curvect.x;\r\n positions[p + 1] = points[i].y + curshft * curvect.y;\r\n positions[p + 2] = points[i].z + curshft * curvect.z;\r\n positions[p + 3] = points[i].x + (curshft + dashshft) * curvect.x;\r\n positions[p + 4] = points[i].y + (curshft + dashshft) * curvect.y;\r\n positions[p + 5] = points[i].z + (curshft + dashshft) * curvect.z;\r\n p += 6;\r\n j++;\r\n }\r\n }\r\n while (p < positions.length) {\r\n positions[p] = points[i].x;\r\n positions[p + 1] = points[i].y;\r\n positions[p + 2] = points[i].z;\r\n p += 3;\r\n }\r\n };\r\n instance.updateMeshPositions(positionFunction, false);\r\n return instance;\r\n }\r\n // dashed lines creation\r\n var dashedLines = new LinesMesh(name, scene, null, undefined, undefined, undefined, options.useVertexAlpha);\r\n var vertexData = VertexData.CreateDashedLines(options);\r\n vertexData.applyToMesh(dashedLines, options.updatable);\r\n dashedLines._creationDataStorage = new _CreationDataStorage();\r\n dashedLines._creationDataStorage.dashSize = dashSize;\r\n dashedLines._creationDataStorage.gapSize = gapSize;\r\n return dashedLines;\r\n };\r\n return LinesBuilder;\r\n}());\r\nexport { LinesBuilder };\r\n//# sourceMappingURL=linesBuilder.js.map","import { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nVertexData.CreatePlane = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n var width = options.width || options.size || 1;\r\n var height = options.height || options.size || 1;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n // Vertices\r\n var halfWidth = width / 2.0;\r\n var halfHeight = height / 2.0;\r\n positions.push(-halfWidth, -halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(0.0, 0.0);\r\n positions.push(halfWidth, -halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(1.0, 0.0);\r\n positions.push(halfWidth, halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(1.0, 1.0);\r\n positions.push(-halfWidth, halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(0.0, 1.0);\r\n // Indices\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\nMesh.CreatePlane = function (name, size, scene, updatable, sideOrientation) {\r\n var options = {\r\n size: size,\r\n width: size,\r\n height: size,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return PlaneBuilder.CreatePlane(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar PlaneBuilder = /** @class */ (function () {\r\n function PlaneBuilder() {\r\n }\r\n /**\r\n * Creates a plane mesh\r\n * * The parameter `size` sets the size (float) of both sides of the plane at once (default 1)\r\n * * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value of `size`)\r\n * * The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the plane mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#plane\r\n */\r\n PlaneBuilder.CreatePlane = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var plane = new Mesh(name, scene);\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n plane._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = VertexData.CreatePlane(options);\r\n vertexData.applyToMesh(plane, options.updatable);\r\n if (options.sourcePlane) {\r\n plane.translate(options.sourcePlane.normal, -options.sourcePlane.d);\r\n plane.setDirection(options.sourcePlane.normal.scale(-1));\r\n }\r\n return plane;\r\n };\r\n return PlaneBuilder;\r\n}());\r\nexport { PlaneBuilder };\r\n//# sourceMappingURL=planeBuilder.js.map","import { Vector3, Matrix } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nVertexData.CreateSphere = function (options) {\r\n var segments = options.segments || 32;\r\n var diameterX = options.diameterX || options.diameter || 1;\r\n var diameterY = options.diameterY || options.diameter || 1;\r\n var diameterZ = options.diameterZ || options.diameter || 1;\r\n var arc = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n var slice = options.slice && (options.slice <= 0) ? 1.0 : options.slice || 1.0;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n var dedupTopBottomIndices = !!options.dedupTopBottomIndices;\r\n var radius = new Vector3(diameterX / 2, diameterY / 2, diameterZ / 2);\r\n var totalZRotationSteps = 2 + segments;\r\n var totalYRotationSteps = 2 * totalZRotationSteps;\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n for (var zRotationStep = 0; zRotationStep <= totalZRotationSteps; zRotationStep++) {\r\n var normalizedZ = zRotationStep / totalZRotationSteps;\r\n var angleZ = normalizedZ * Math.PI * slice;\r\n for (var yRotationStep = 0; yRotationStep <= totalYRotationSteps; yRotationStep++) {\r\n var normalizedY = yRotationStep / totalYRotationSteps;\r\n var angleY = normalizedY * Math.PI * 2 * arc;\r\n var rotationZ = Matrix.RotationZ(-angleZ);\r\n var rotationY = Matrix.RotationY(angleY);\r\n var afterRotZ = Vector3.TransformCoordinates(Vector3.Up(), rotationZ);\r\n var complete = Vector3.TransformCoordinates(afterRotZ, rotationY);\r\n var vertex = complete.multiply(radius);\r\n var normal = complete.divide(radius).normalize();\r\n positions.push(vertex.x, vertex.y, vertex.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(normalizedY, normalizedZ);\r\n }\r\n if (zRotationStep > 0) {\r\n var verticesCount = positions.length / 3;\r\n for (var firstIndex = verticesCount - 2 * (totalYRotationSteps + 1); (firstIndex + totalYRotationSteps + 2) < verticesCount; firstIndex++) {\r\n if (dedupTopBottomIndices) {\r\n if (zRotationStep > 1) {\r\n indices.push((firstIndex));\r\n indices.push((firstIndex + 1));\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n }\r\n if (zRotationStep < totalZRotationSteps || slice < 1.0) {\r\n indices.push((firstIndex + totalYRotationSteps + 1));\r\n indices.push((firstIndex + 1));\r\n indices.push((firstIndex + totalYRotationSteps + 2));\r\n }\r\n }\r\n else {\r\n indices.push(firstIndex);\r\n indices.push(firstIndex + 1);\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n indices.push(firstIndex + 1);\r\n indices.push(firstIndex + totalYRotationSteps + 2);\r\n }\r\n }\r\n }\r\n }\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\nMesh.CreateSphere = function (name, segments, diameter, scene, updatable, sideOrientation) {\r\n var options = {\r\n segments: segments,\r\n diameterX: diameter,\r\n diameterY: diameter,\r\n diameterZ: diameter,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return SphereBuilder.CreateSphere(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar SphereBuilder = /** @class */ (function () {\r\n function SphereBuilder() {\r\n }\r\n /**\r\n * Creates a sphere mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the sphere (default 1)\r\n * * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value of `diameter`)\r\n * * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio\r\n * * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the sphere mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#sphere\r\n */\r\n SphereBuilder.CreateSphere = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var sphere = new Mesh(name, scene);\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n sphere._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = VertexData.CreateSphere(options);\r\n vertexData.applyToMesh(sphere, options.updatable);\r\n return sphere;\r\n };\r\n return SphereBuilder;\r\n}());\r\nexport { SphereBuilder };\r\n//# sourceMappingURL=sphereBuilder.js.map","import { Matrix, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nVertexData.CreateTorus = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n var diameter = options.diameter || 1;\r\n var thickness = options.thickness || 0.5;\r\n var tessellation = options.tessellation || 16;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n var stride = tessellation + 1;\r\n for (var i = 0; i <= tessellation; i++) {\r\n var u = i / tessellation;\r\n var outerAngle = i * Math.PI * 2.0 / tessellation - Math.PI / 2.0;\r\n var transform = Matrix.Translation(diameter / 2.0, 0, 0).multiply(Matrix.RotationY(outerAngle));\r\n for (var j = 0; j <= tessellation; j++) {\r\n var v = 1 - j / tessellation;\r\n var innerAngle = j * Math.PI * 2.0 / tessellation + Math.PI;\r\n var dx = Math.cos(innerAngle);\r\n var dy = Math.sin(innerAngle);\r\n // Create a vertex.\r\n var normal = new Vector3(dx, dy, 0);\r\n var position = normal.scale(thickness / 2);\r\n var textureCoordinate = new Vector2(u, v);\r\n position = Vector3.TransformCoordinates(position, transform);\r\n normal = Vector3.TransformNormal(normal, transform);\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(textureCoordinate.x, textureCoordinate.y);\r\n // And create indices for two triangles.\r\n var nextI = (i + 1) % stride;\r\n var nextJ = (j + 1) % stride;\r\n indices.push(i * stride + j);\r\n indices.push(i * stride + nextJ);\r\n indices.push(nextI * stride + j);\r\n indices.push(i * stride + nextJ);\r\n indices.push(nextI * stride + nextJ);\r\n indices.push(nextI * stride + j);\r\n }\r\n }\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\nMesh.CreateTorus = function (name, diameter, thickness, tessellation, scene, updatable, sideOrientation) {\r\n var options = {\r\n diameter: diameter,\r\n thickness: thickness,\r\n tessellation: tessellation,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return TorusBuilder.CreateTorus(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar TorusBuilder = /** @class */ (function () {\r\n function TorusBuilder() {\r\n }\r\n /**\r\n * Creates a torus mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)\r\n * * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5)\r\n * * The parameter `tessellation` sets the number of torus sides (postive integer, default 16)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the torus mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#torus\r\n */\r\n TorusBuilder.CreateTorus = function (name, options, scene) {\r\n var torus = new Mesh(name, scene);\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n torus._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = VertexData.CreateTorus(options);\r\n vertexData.applyToMesh(torus, options.updatable);\r\n return torus;\r\n };\r\n return TorusBuilder;\r\n}());\r\nexport { TorusBuilder };\r\n//# sourceMappingURL=torusBuilder.js.map","import { __extends } from \"tslib\";\r\nimport { DataBuffer } from '../dataBuffer';\r\n/** @hidden */\r\nvar WebGLDataBuffer = /** @class */ (function (_super) {\r\n __extends(WebGLDataBuffer, _super);\r\n function WebGLDataBuffer(resource) {\r\n var _this = _super.call(this) || this;\r\n _this._buffer = resource;\r\n return _this;\r\n }\r\n Object.defineProperty(WebGLDataBuffer.prototype, \"underlyingResource\", {\r\n get: function () {\r\n return this._buffer;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return WebGLDataBuffer;\r\n}(DataBuffer));\r\nexport { WebGLDataBuffer };\r\n//# sourceMappingURL=webGLDataBuffer.js.map","/**\r\n * Class used to store gfx data (like WebGLBuffer)\r\n */\r\nvar DataBuffer = /** @class */ (function () {\r\n function DataBuffer() {\r\n /**\r\n * Gets or sets the number of objects referencing this buffer\r\n */\r\n this.references = 0;\r\n /** Gets or sets the size of the underlying buffer */\r\n this.capacity = 0;\r\n /**\r\n * Gets or sets a boolean indicating if the buffer contains 32bits indices\r\n */\r\n this.is32Bits = false;\r\n }\r\n Object.defineProperty(DataBuffer.prototype, \"underlyingResource\", {\r\n /**\r\n * Gets the underlying buffer\r\n */\r\n get: function () {\r\n return null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return DataBuffer;\r\n}());\r\nexport { DataBuffer };\r\n//# sourceMappingURL=dataBuffer.js.map","import { Vector3 } from '../Maths/math.vector';\r\n/**\r\n * @hidden\r\n */\r\nvar _MeshCollisionData = /** @class */ (function () {\r\n function _MeshCollisionData() {\r\n this._checkCollisions = false;\r\n this._collisionMask = -1;\r\n this._collisionGroup = -1;\r\n this._surroundingMeshes = null;\r\n this._collider = null;\r\n this._oldPositionForCollisions = new Vector3(0, 0, 0);\r\n this._diffPositionForCollisions = new Vector3(0, 0, 0);\r\n this._collisionResponse = true;\r\n }\r\n return _MeshCollisionData;\r\n}());\r\nexport { _MeshCollisionData };\r\n//# sourceMappingURL=meshCollisionData.js.map","import { __extends } from \"tslib\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Quaternion, Matrix, Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { VertexData } from \"../Meshes/mesh.vertexData\";\r\nimport { TransformNode } from \"../Meshes/transformNode\";\r\nimport { PickingInfo } from \"../Collisions/pickingInfo\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { _MeshCollisionData } from '../Collisions/meshCollisionData';\r\nimport { _DevTools } from '../Misc/devTools';\r\nimport { extractMinAndMax } from '../Maths/math.functions';\r\nimport { Color3, Color4 } from '../Maths/math.color';\r\nimport { Epsilon } from '../Maths/math.constants';\r\nimport { Axis } from '../Maths/math.axis';\r\nimport { _TypeStore } from '../Misc/typeStore';\r\n/** @hidden */\r\nvar _FacetDataStorage = /** @class */ (function () {\r\n function _FacetDataStorage() {\r\n this.facetNb = 0; // facet number\r\n this.partitioningSubdivisions = 10; // number of subdivisions per axis in the partioning space\r\n this.partitioningBBoxRatio = 1.01; // the partioning array space is by default 1% bigger than the bounding box\r\n this.facetDataEnabled = false; // is the facet data feature enabled on this mesh ?\r\n this.facetParameters = {}; // keep a reference to the object parameters to avoid memory re-allocation\r\n this.bbSize = Vector3.Zero(); // bbox size approximated for facet data\r\n this.subDiv = {\r\n max: 1,\r\n X: 1,\r\n Y: 1,\r\n Z: 1\r\n };\r\n this.facetDepthSort = false; // is the facet depth sort to be computed\r\n this.facetDepthSortEnabled = false; // is the facet depth sort initialized\r\n }\r\n return _FacetDataStorage;\r\n}());\r\n/**\r\n * @hidden\r\n **/\r\nvar _InternalAbstractMeshDataInfo = /** @class */ (function () {\r\n function _InternalAbstractMeshDataInfo() {\r\n this._hasVertexAlpha = false;\r\n this._useVertexColors = true;\r\n this._numBoneInfluencers = 4;\r\n this._applyFog = true;\r\n this._receiveShadows = false;\r\n this._facetData = new _FacetDataStorage();\r\n this._visibility = 1.0;\r\n this._skeleton = null;\r\n this._layerMask = 0x0FFFFFFF;\r\n this._computeBonesUsingShaders = true;\r\n this._isActive = false;\r\n this._onlyForInstances = false;\r\n this._isActiveIntermediate = false;\r\n this._onlyForInstancesIntermediate = false;\r\n this._actAsRegularMesh = false;\r\n this._currentLOD = null;\r\n this._currentLODIsUpToDate = false;\r\n }\r\n return _InternalAbstractMeshDataInfo;\r\n}());\r\n/**\r\n * Class used to store all common mesh properties\r\n */\r\nvar AbstractMesh = /** @class */ (function (_super) {\r\n __extends(AbstractMesh, _super);\r\n // Constructor\r\n /**\r\n * Creates a new AbstractMesh\r\n * @param name defines the name of the mesh\r\n * @param scene defines the hosting scene\r\n */\r\n function AbstractMesh(name, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var _this = _super.call(this, name, scene, false) || this;\r\n // Internal data\r\n /** @hidden */\r\n _this._internalAbstractMeshDataInfo = new _InternalAbstractMeshDataInfo();\r\n /**\r\n * The culling strategy to use to check whether the mesh must be rendered or not.\r\n * This value can be changed at any time and will be used on the next render mesh selection.\r\n * The possible values are :\r\n * - AbstractMesh.CULLINGSTRATEGY_STANDARD\r\n * - AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY\r\n * Please read each static variable documentation to get details about the culling process.\r\n * */\r\n _this.cullingStrategy = AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY;\r\n // Events\r\n /**\r\n * An event triggered when this mesh collides with another one\r\n */\r\n _this.onCollideObservable = new Observable();\r\n /**\r\n * An event triggered when the collision's position changes\r\n */\r\n _this.onCollisionPositionChangeObservable = new Observable();\r\n /**\r\n * An event triggered when material is changed\r\n */\r\n _this.onMaterialChangedObservable = new Observable();\r\n // Properties\r\n /**\r\n * Gets or sets the orientation for POV movement & rotation\r\n */\r\n _this.definedFacingForward = true;\r\n /** @hidden */\r\n _this._occlusionQuery = null;\r\n /** @hidden */\r\n _this._renderingGroup = null;\r\n /** Gets or sets the alpha index used to sort transparent meshes\r\n * @see https://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered#alpha-index\r\n */\r\n _this.alphaIndex = Number.MAX_VALUE;\r\n /**\r\n * Gets or sets a boolean indicating if the mesh is visible (renderable). Default is true\r\n */\r\n _this.isVisible = true;\r\n /**\r\n * Gets or sets a boolean indicating if the mesh can be picked (by scene.pick for instance or through actions). Default is true\r\n */\r\n _this.isPickable = true;\r\n /** Gets or sets a boolean indicating that bounding boxes of subMeshes must be rendered as well (false by default) */\r\n _this.showSubMeshesBoundingBox = false;\r\n /** Gets or sets a boolean indicating if the mesh must be considered as a ray blocker for lens flares (false by default)\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lens_flares\r\n */\r\n _this.isBlocker = false;\r\n /**\r\n * Gets or sets a boolean indicating that pointer move events must be supported on this mesh (false by default)\r\n */\r\n _this.enablePointerMoveEvents = false;\r\n _this._renderingGroupId = 0;\r\n _this._material = null;\r\n /** Defines color to use when rendering outline */\r\n _this.outlineColor = Color3.Red();\r\n /** Define width to use when rendering outline */\r\n _this.outlineWidth = 0.02;\r\n /** Defines color to use when rendering overlay */\r\n _this.overlayColor = Color3.Red();\r\n /** Defines alpha to use when rendering overlay */\r\n _this.overlayAlpha = 0.5;\r\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes selection (true by default) */\r\n _this.useOctreeForRenderingSelection = true;\r\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes picking (true by default) */\r\n _this.useOctreeForPicking = true;\r\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes collision (true by default) */\r\n _this.useOctreeForCollisions = true;\r\n /**\r\n * True if the mesh must be rendered in any case (this will shortcut the frustum clipping phase)\r\n */\r\n _this.alwaysSelectAsActiveMesh = false;\r\n /**\r\n * Gets or sets a boolean indicating that the bounding info does not need to be kept in sync (for performance reason)\r\n */\r\n _this.doNotSyncBoundingInfo = false;\r\n /**\r\n * Gets or sets the current action manager\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\n _this.actionManager = null;\r\n // Collisions\r\n _this._meshCollisionData = new _MeshCollisionData();\r\n /**\r\n * Gets or sets the ellipsoid used to impersonate this mesh when using collision engine (default is (0.5, 1, 0.5))\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.ellipsoid = new Vector3(0.5, 1, 0.5);\r\n /**\r\n * Gets or sets the ellipsoid offset used to impersonate this mesh when using collision engine (default is (0, 0, 0))\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.ellipsoidOffset = new Vector3(0, 0, 0);\r\n // Edges\r\n /**\r\n * Defines edge width used when edgesRenderer is enabled\r\n * @see https://www.babylonjs-playground.com/#10OJSG#13\r\n */\r\n _this.edgesWidth = 1;\r\n /**\r\n * Defines edge color used when edgesRenderer is enabled\r\n * @see https://www.babylonjs-playground.com/#10OJSG#13\r\n */\r\n _this.edgesColor = new Color4(1, 0, 0, 1);\r\n /** @hidden */\r\n _this._edgesRenderer = null;\r\n /** @hidden */\r\n _this._masterMesh = null;\r\n /** @hidden */\r\n _this._boundingInfo = null;\r\n /** @hidden */\r\n _this._renderId = 0;\r\n /** @hidden */\r\n _this._intersectionsInProgress = new Array();\r\n /** @hidden */\r\n _this._unIndexed = false;\r\n /** @hidden */\r\n _this._lightSources = new Array();\r\n // Loading properties\r\n /** @hidden */\r\n _this._waitingData = {\r\n lods: null,\r\n actions: null,\r\n freezeWorldMatrix: null\r\n };\r\n /** @hidden */\r\n _this._bonesTransformMatrices = null;\r\n /** @hidden */\r\n _this._transformMatrixTexture = null;\r\n /**\r\n * An event triggered when the mesh is rebuilt.\r\n */\r\n _this.onRebuildObservable = new Observable();\r\n _this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {\r\n if (collidedMesh === void 0) { collidedMesh = null; }\r\n newPosition.subtractToRef(_this._meshCollisionData._oldPositionForCollisions, _this._meshCollisionData._diffPositionForCollisions);\r\n if (_this._meshCollisionData._diffPositionForCollisions.length() > Engine.CollisionsEpsilon) {\r\n _this.position.addInPlace(_this._meshCollisionData._diffPositionForCollisions);\r\n }\r\n if (collidedMesh) {\r\n _this.onCollideObservable.notifyObservers(collidedMesh);\r\n }\r\n _this.onCollisionPositionChangeObservable.notifyObservers(_this.position);\r\n };\r\n _this.getScene().addMesh(_this);\r\n _this._resyncLightSources();\r\n return _this;\r\n }\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_NONE\", {\r\n /**\r\n * No billboard\r\n */\r\n get: function () {\r\n return TransformNode.BILLBOARDMODE_NONE;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_X\", {\r\n /** Billboard on X axis */\r\n get: function () {\r\n return TransformNode.BILLBOARDMODE_X;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_Y\", {\r\n /** Billboard on Y axis */\r\n get: function () {\r\n return TransformNode.BILLBOARDMODE_Y;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_Z\", {\r\n /** Billboard on Z axis */\r\n get: function () {\r\n return TransformNode.BILLBOARDMODE_Z;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_ALL\", {\r\n /** Billboard on all axes */\r\n get: function () {\r\n return TransformNode.BILLBOARDMODE_ALL;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_USE_POSITION\", {\r\n /** Billboard on using position instead of orientation */\r\n get: function () {\r\n return TransformNode.BILLBOARDMODE_USE_POSITION;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"facetNb\", {\r\n /**\r\n * Gets the number of facets in the mesh\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata#what-is-a-mesh-facet\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetNb;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"partitioningSubdivisions\", {\r\n /**\r\n * Gets or set the number (integer) of subdivisions per axis in the partioning space\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata#tweaking-the-partitioning\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions;\r\n },\r\n set: function (nb) {\r\n this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions = nb;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"partitioningBBoxRatio\", {\r\n /**\r\n * The ratio (float) to apply to the bouding box size to set to the partioning space.\r\n * Ex : 1.01 (default) the partioning space is 1% bigger than the bounding box\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata#tweaking-the-partitioning\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio;\r\n },\r\n set: function (ratio) {\r\n this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio = ratio;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"mustDepthSortFacets\", {\r\n /**\r\n * Gets or sets a boolean indicating that the facets must be depth sorted on next call to `updateFacetData()`.\r\n * Works only for updatable meshes.\r\n * Doesn't work with multi-materials\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata#facet-depth-sort\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetDepthSort;\r\n },\r\n set: function (sort) {\r\n this._internalAbstractMeshDataInfo._facetData.facetDepthSort = sort;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"facetDepthSortFrom\", {\r\n /**\r\n * The location (Vector3) where the facet depth sort must be computed from.\r\n * By default, the active camera position.\r\n * Used only when facet depth sort is enabled\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata#facet-depth-sort\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom;\r\n },\r\n set: function (location) {\r\n this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom = location;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"isFacetDataEnabled\", {\r\n /**\r\n * gets a boolean indicating if facetData is enabled\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata#what-is-a-mesh-facet\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n AbstractMesh.prototype._updateNonUniformScalingState = function (value) {\r\n if (!_super.prototype._updateNonUniformScalingState.call(this, value)) {\r\n return false;\r\n }\r\n this._markSubMeshesAsMiscDirty();\r\n return true;\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"onCollide\", {\r\n /** Set a function to call when this mesh collides with another one */\r\n set: function (callback) {\r\n if (this._meshCollisionData._onCollideObserver) {\r\n this.onCollideObservable.remove(this._meshCollisionData._onCollideObserver);\r\n }\r\n this._meshCollisionData._onCollideObserver = this.onCollideObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"onCollisionPositionChange\", {\r\n /** Set a function to call when the collision's position changes */\r\n set: function (callback) {\r\n if (this._meshCollisionData._onCollisionPositionChangeObserver) {\r\n this.onCollisionPositionChangeObservable.remove(this._meshCollisionData._onCollisionPositionChangeObserver);\r\n }\r\n this._meshCollisionData._onCollisionPositionChangeObserver = this.onCollisionPositionChangeObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"visibility\", {\r\n /**\r\n * Gets or sets mesh visibility between 0 and 1 (default is 1)\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._visibility;\r\n },\r\n /**\r\n * Gets or sets mesh visibility between 0 and 1 (default is 1)\r\n */\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._visibility === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._visibility = value;\r\n this._markSubMeshesAsMiscDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"renderingGroupId\", {\r\n /**\r\n * Specifies the rendering group id for this mesh (0 by default)\r\n * @see https://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered#rendering-groups\r\n */\r\n get: function () {\r\n return this._renderingGroupId;\r\n },\r\n set: function (value) {\r\n this._renderingGroupId = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"material\", {\r\n /** Gets or sets current material */\r\n get: function () {\r\n return this._material;\r\n },\r\n set: function (value) {\r\n if (this._material === value) {\r\n return;\r\n }\r\n // remove from material mesh map id needed\r\n if (this._material && this._material.meshMap) {\r\n this._material.meshMap[this.uniqueId] = undefined;\r\n }\r\n this._material = value;\r\n if (value && value.meshMap) {\r\n value.meshMap[this.uniqueId] = this;\r\n }\r\n if (this.onMaterialChangedObservable.hasObservers()) {\r\n this.onMaterialChangedObservable.notifyObservers(this);\r\n }\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n this._unBindEffect();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"receiveShadows\", {\r\n /**\r\n * Gets or sets a boolean indicating that this mesh can receive realtime shadows\r\n * @see https://doc.babylonjs.com/babylon101/shadows\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._receiveShadows;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._receiveShadows === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._receiveShadows = value;\r\n this._markSubMeshesAsLightDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"hasVertexAlpha\", {\r\n /** Gets or sets a boolean indicating that this mesh contains vertex color data with alpha values */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._hasVertexAlpha;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._hasVertexAlpha === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._hasVertexAlpha = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n this._markSubMeshesAsMiscDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"useVertexColors\", {\r\n /** Gets or sets a boolean indicating that this mesh needs to use vertex color data to render (if this kind of vertex data is available in the geometry) */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._useVertexColors;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._useVertexColors === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._useVertexColors = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"computeBonesUsingShaders\", {\r\n /**\r\n * Gets or sets a boolean indicating that bone animations must be computed by the CPU (false by default)\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._computeBonesUsingShaders;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._computeBonesUsingShaders === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._computeBonesUsingShaders = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"numBoneInfluencers\", {\r\n /** Gets or sets the number of allowed bone influences per vertex (4 by default) */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._numBoneInfluencers;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._numBoneInfluencers === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._numBoneInfluencers = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"applyFog\", {\r\n /** Gets or sets a boolean indicating that this mesh will allow fog to be rendered on it (true by default) */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._applyFog;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._applyFog === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._applyFog = value;\r\n this._markSubMeshesAsMiscDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"layerMask\", {\r\n /**\r\n * Gets or sets the current layer mask (default is 0x0FFFFFFF)\r\n * @see https://doc.babylonjs.com/how_to/layermasks_and_multi-cam_textures\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._layerMask;\r\n },\r\n set: function (value) {\r\n if (value === this._internalAbstractMeshDataInfo._layerMask) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._layerMask = value;\r\n this._resyncLightSources();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"collisionMask\", {\r\n /**\r\n * Gets or sets a collision mask used to mask collisions (default is -1).\r\n * A collision between A and B will happen if A.collisionGroup & b.collisionMask !== 0\r\n */\r\n get: function () {\r\n return this._meshCollisionData._collisionMask;\r\n },\r\n set: function (mask) {\r\n this._meshCollisionData._collisionMask = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"collisionResponse\", {\r\n /**\r\n * Gets or sets a collision response flag (default is true).\r\n * when collisionResponse is false, events are still triggered but colliding entity has no response\r\n * This helps creating trigger volume when user wants collision feedback events but not position/velocity\r\n * to respond to the collision.\r\n */\r\n get: function () {\r\n return this._meshCollisionData._collisionResponse;\r\n },\r\n set: function (response) {\r\n this._meshCollisionData._collisionResponse = response;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"collisionGroup\", {\r\n /**\r\n * Gets or sets the current collision group mask (-1 by default).\r\n * A collision between A and B will happen if A.collisionGroup & b.collisionMask !== 0\r\n */\r\n get: function () {\r\n return this._meshCollisionData._collisionGroup;\r\n },\r\n set: function (mask) {\r\n this._meshCollisionData._collisionGroup = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"surroundingMeshes\", {\r\n /**\r\n * Gets or sets current surrounding meshes (null by default).\r\n *\r\n * By default collision detection is tested against every mesh in the scene.\r\n * It is possible to set surroundingMeshes to a defined list of meshes and then only these specified\r\n * meshes will be tested for the collision.\r\n *\r\n * Note: if set to an empty array no collision will happen when this mesh is moved.\r\n */\r\n get: function () {\r\n return this._meshCollisionData._surroundingMeshes;\r\n },\r\n set: function (meshes) {\r\n this._meshCollisionData._surroundingMeshes = meshes;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"lightSources\", {\r\n /** Gets the list of lights affecting that mesh */\r\n get: function () {\r\n return this._lightSources;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"_positions\", {\r\n /** @hidden */\r\n get: function () {\r\n return null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"skeleton\", {\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._skeleton;\r\n },\r\n /**\r\n * Gets or sets a skeleton to apply skining transformations\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\n set: function (value) {\r\n var skeleton = this._internalAbstractMeshDataInfo._skeleton;\r\n if (skeleton && skeleton.needInitialSkinMatrix) {\r\n skeleton._unregisterMeshWithPoseMatrix(this);\r\n }\r\n if (value && value.needInitialSkinMatrix) {\r\n value._registerMeshWithPoseMatrix(this);\r\n }\r\n this._internalAbstractMeshDataInfo._skeleton = value;\r\n if (!this._internalAbstractMeshDataInfo._skeleton) {\r\n this._bonesTransformMatrices = null;\r\n }\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"AbstractMesh\"\r\n * @returns \"AbstractMesh\"\r\n */\r\n AbstractMesh.prototype.getClassName = function () {\r\n return \"AbstractMesh\";\r\n };\r\n /**\r\n * Gets a string representation of the current mesh\r\n * @param fullDetails defines a boolean indicating if full details must be included\r\n * @returns a string representation of the current mesh\r\n */\r\n AbstractMesh.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name + \", isInstance: \" + (this.getClassName() !== \"InstancedMesh\" ? \"YES\" : \"NO\");\r\n ret += \", # of submeshes: \" + (this.subMeshes ? this.subMeshes.length : 0);\r\n var skeleton = this._internalAbstractMeshDataInfo._skeleton;\r\n if (skeleton) {\r\n ret += \", skeleton: \" + skeleton.name;\r\n }\r\n if (fullDetails) {\r\n ret += \", billboard mode: \" + ([\"NONE\", \"X\", \"Y\", null, \"Z\", null, null, \"ALL\"])[this.billboardMode];\r\n ret += \", freeze wrld mat: \" + (this._isWorldMatrixFrozen || this._waitingData.freezeWorldMatrix ? \"YES\" : \"NO\");\r\n }\r\n return ret;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n AbstractMesh.prototype._getEffectiveParent = function () {\r\n if (this._masterMesh && this.billboardMode !== TransformNode.BILLBOARDMODE_NONE) {\r\n return this._masterMesh;\r\n }\r\n return _super.prototype._getEffectiveParent.call(this);\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._getActionManagerForTrigger = function (trigger, initialCall) {\r\n if (initialCall === void 0) { initialCall = true; }\r\n if (this.actionManager && (initialCall || this.actionManager.isRecursive)) {\r\n if (trigger) {\r\n if (this.actionManager.hasSpecificTrigger(trigger)) {\r\n return this.actionManager;\r\n }\r\n }\r\n else {\r\n return this.actionManager;\r\n }\r\n }\r\n if (!this.parent) {\r\n return null;\r\n }\r\n return this.parent._getActionManagerForTrigger(trigger, false);\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._rebuild = function () {\r\n this.onRebuildObservable.notifyObservers(this);\r\n if (this._occlusionQuery) {\r\n this._occlusionQuery = null;\r\n }\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n subMesh._rebuild();\r\n }\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._resyncLightSources = function () {\r\n this._lightSources.length = 0;\r\n for (var _i = 0, _a = this.getScene().lights; _i < _a.length; _i++) {\r\n var light = _a[_i];\r\n if (!light.isEnabled()) {\r\n continue;\r\n }\r\n if (light.canAffectMesh(this)) {\r\n this._lightSources.push(light);\r\n }\r\n }\r\n this._markSubMeshesAsLightDirty();\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._resyncLightSource = function (light) {\r\n var isIn = light.isEnabled() && light.canAffectMesh(this);\r\n var index = this._lightSources.indexOf(light);\r\n var removed = false;\r\n if (index === -1) {\r\n if (!isIn) {\r\n return;\r\n }\r\n this._lightSources.push(light);\r\n }\r\n else {\r\n if (isIn) {\r\n return;\r\n }\r\n removed = true;\r\n this._lightSources.splice(index, 1);\r\n }\r\n this._markSubMeshesAsLightDirty(removed);\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._unBindEffect = function () {\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n subMesh.setEffect(null);\r\n }\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._removeLightSource = function (light, dispose) {\r\n var index = this._lightSources.indexOf(light);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._lightSources.splice(index, 1);\r\n this._markSubMeshesAsLightDirty(dispose);\r\n };\r\n AbstractMesh.prototype._markSubMeshesAsDirty = function (func) {\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n if (subMesh._materialDefines) {\r\n func(subMesh._materialDefines);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._markSubMeshesAsLightDirty = function (dispose) {\r\n if (dispose === void 0) { dispose = false; }\r\n this._markSubMeshesAsDirty(function (defines) { return defines.markAsLightDirty(dispose); });\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._markSubMeshesAsAttributesDirty = function () {\r\n this._markSubMeshesAsDirty(function (defines) { return defines.markAsAttributesDirty(); });\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._markSubMeshesAsMiscDirty = function () {\r\n this._markSubMeshesAsDirty(function (defines) { return defines.markAsMiscDirty(); });\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"scaling\", {\r\n /**\r\n * Gets or sets a Vector3 depicting the mesh scaling along each local axis X, Y, Z. Default is (1.0, 1.0, 1.0)\r\n */\r\n get: function () {\r\n return this._scaling;\r\n },\r\n set: function (newScaling) {\r\n this._scaling = newScaling;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"isBlocked\", {\r\n // Methods\r\n /**\r\n * Returns true if the mesh is blocked. Implemented by child classes\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the mesh itself by default. Implemented by child classes\r\n * @param camera defines the camera to use to pick the right LOD level\r\n * @returns the currentAbstractMesh\r\n */\r\n AbstractMesh.prototype.getLOD = function (camera) {\r\n return this;\r\n };\r\n /**\r\n * Returns 0 by default. Implemented by child classes\r\n * @returns an integer\r\n */\r\n AbstractMesh.prototype.getTotalVertices = function () {\r\n return 0;\r\n };\r\n /**\r\n * Returns a positive integer : the total number of indices in this mesh geometry.\r\n * @returns the numner of indices or zero if the mesh has no geometry.\r\n */\r\n AbstractMesh.prototype.getTotalIndices = function () {\r\n return 0;\r\n };\r\n /**\r\n * Returns null by default. Implemented by child classes\r\n * @returns null\r\n */\r\n AbstractMesh.prototype.getIndices = function () {\r\n return null;\r\n };\r\n /**\r\n * Returns the array of the requested vertex data kind. Implemented by child classes\r\n * @param kind defines the vertex data kind to use\r\n * @returns null\r\n */\r\n AbstractMesh.prototype.getVerticesData = function (kind) {\r\n return null;\r\n };\r\n /**\r\n * Sets the vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.\r\n * Note that a new underlying VertexBuffer object is created each call.\r\n * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\r\n * @param kind defines vertex data kind:\r\n * * VertexBuffer.PositionKind\r\n * * VertexBuffer.UVKind\r\n * * VertexBuffer.UV2Kind\r\n * * VertexBuffer.UV3Kind\r\n * * VertexBuffer.UV4Kind\r\n * * VertexBuffer.UV5Kind\r\n * * VertexBuffer.UV6Kind\r\n * * VertexBuffer.ColorKind\r\n * * VertexBuffer.MatricesIndicesKind\r\n * * VertexBuffer.MatricesIndicesExtraKind\r\n * * VertexBuffer.MatricesWeightsKind\r\n * * VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updatable defines if the data must be flagged as updatable (or static)\r\n * @param stride defines the vertex stride (size of an entire vertex). Can be null and in this case will be deduced from vertex data kind\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n return this;\r\n };\r\n /**\r\n * Updates the existing vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, it is simply returned as it is.\r\n * @param kind defines vertex data kind:\r\n * * VertexBuffer.PositionKind\r\n * * VertexBuffer.UVKind\r\n * * VertexBuffer.UV2Kind\r\n * * VertexBuffer.UV3Kind\r\n * * VertexBuffer.UV4Kind\r\n * * VertexBuffer.UV5Kind\r\n * * VertexBuffer.UV6Kind\r\n * * VertexBuffer.ColorKind\r\n * * VertexBuffer.MatricesIndicesKind\r\n * * VertexBuffer.MatricesIndicesExtraKind\r\n * * VertexBuffer.MatricesWeightsKind\r\n * * VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updateExtends If `kind` is `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed\r\n * @param makeItUnique If true, a new global geometry is created from this data and is set to the mesh\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {\r\n return this;\r\n };\r\n /**\r\n * Sets the mesh indices,\r\n * If the mesh has no geometry, a new Geometry object is created and set to the mesh.\r\n * @param indices Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array)\r\n * @param totalVertices Defines the total number of vertices\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.setIndices = function (indices, totalVertices) {\r\n return this;\r\n };\r\n /**\r\n * Gets a boolean indicating if specific vertex data is present\r\n * @param kind defines the vertex data kind to use\r\n * @returns true is data kind is present\r\n */\r\n AbstractMesh.prototype.isVerticesDataPresent = function (kind) {\r\n return false;\r\n };\r\n /**\r\n * Returns the mesh BoundingInfo object or creates a new one and returns if it was undefined.\r\n * Note that it returns a shallow bounding of the mesh (i.e. it does not include children).\r\n * To get the full bounding of all children, call `getHierarchyBoundingVectors` instead.\r\n * @returns a BoundingInfo\r\n */\r\n AbstractMesh.prototype.getBoundingInfo = function () {\r\n if (this._masterMesh) {\r\n return this._masterMesh.getBoundingInfo();\r\n }\r\n if (!this._boundingInfo) {\r\n // this._boundingInfo is being created here\r\n this._updateBoundingInfo();\r\n }\r\n // cannot be null.\r\n return this._boundingInfo;\r\n };\r\n /**\r\n * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)\r\n * @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false\r\n * @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false\r\n * @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.normalizeToUnitCube = function (includeDescendants, ignoreRotation, predicate) {\r\n if (includeDescendants === void 0) { includeDescendants = true; }\r\n if (ignoreRotation === void 0) { ignoreRotation = false; }\r\n return _super.prototype.normalizeToUnitCube.call(this, includeDescendants, ignoreRotation, predicate);\r\n };\r\n /**\r\n * Overwrite the current bounding info\r\n * @param boundingInfo defines the new bounding info\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.setBoundingInfo = function (boundingInfo) {\r\n this._boundingInfo = boundingInfo;\r\n return this;\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"useBones\", {\r\n /** Gets a boolean indicating if this mesh has skinning data and an attached skeleton */\r\n get: function () {\r\n return (this.skeleton && this.getScene().skeletonsEnabled && this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind) && this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind));\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n AbstractMesh.prototype._preActivate = function () {\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._preActivateForIntermediateRendering = function (renderId) {\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._activate = function (renderId, intermediateRendering) {\r\n this._renderId = renderId;\r\n return true;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._postActivate = function () {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._freeze = function () {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._unFreeze = function () {\r\n // Do nothing\r\n };\r\n /**\r\n * Gets the current world matrix\r\n * @returns a Matrix\r\n */\r\n AbstractMesh.prototype.getWorldMatrix = function () {\r\n if (this._masterMesh && this.billboardMode === TransformNode.BILLBOARDMODE_NONE) {\r\n return this._masterMesh.getWorldMatrix();\r\n }\r\n return _super.prototype.getWorldMatrix.call(this);\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._getWorldMatrixDeterminant = function () {\r\n if (this._masterMesh) {\r\n return this._masterMesh._getWorldMatrixDeterminant();\r\n }\r\n return _super.prototype._getWorldMatrixDeterminant.call(this);\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"isAnInstance\", {\r\n /**\r\n * Gets a boolean indicating if this mesh is an instance or a regular mesh\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"hasInstances\", {\r\n /**\r\n * Gets a boolean indicating if this mesh has instances\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"hasThinInstances\", {\r\n /**\r\n * Gets a boolean indicating if this mesh has thin instances\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // ================================== Point of View Movement =================================\r\n /**\r\n * Perform relative position change from the point of view of behind the front of the mesh.\r\n * This is performed taking into account the meshes current rotation, so you do not have to care.\r\n * Supports definition of mesh facing forward or backward\r\n * @param amountRight defines the distance on the right axis\r\n * @param amountUp defines the distance on the up axis\r\n * @param amountForward defines the distance on the forward axis\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.movePOV = function (amountRight, amountUp, amountForward) {\r\n this.position.addInPlace(this.calcMovePOV(amountRight, amountUp, amountForward));\r\n return this;\r\n };\r\n /**\r\n * Calculate relative position change from the point of view of behind the front of the mesh.\r\n * This is performed taking into account the meshes current rotation, so you do not have to care.\r\n * Supports definition of mesh facing forward or backward\r\n * @param amountRight defines the distance on the right axis\r\n * @param amountUp defines the distance on the up axis\r\n * @param amountForward defines the distance on the forward axis\r\n * @returns the new displacement vector\r\n */\r\n AbstractMesh.prototype.calcMovePOV = function (amountRight, amountUp, amountForward) {\r\n var rotMatrix = new Matrix();\r\n var rotQuaternion = (this.rotationQuaternion) ? this.rotationQuaternion : Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);\r\n rotQuaternion.toRotationMatrix(rotMatrix);\r\n var translationDelta = Vector3.Zero();\r\n var defForwardMult = this.definedFacingForward ? -1 : 1;\r\n Vector3.TransformCoordinatesFromFloatsToRef(amountRight * defForwardMult, amountUp, amountForward * defForwardMult, rotMatrix, translationDelta);\r\n return translationDelta;\r\n };\r\n // ================================== Point of View Rotation =================================\r\n /**\r\n * Perform relative rotation change from the point of view of behind the front of the mesh.\r\n * Supports definition of mesh facing forward or backward\r\n * @param flipBack defines the flip\r\n * @param twirlClockwise defines the twirl\r\n * @param tiltRight defines the tilt\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.rotatePOV = function (flipBack, twirlClockwise, tiltRight) {\r\n this.rotation.addInPlace(this.calcRotatePOV(flipBack, twirlClockwise, tiltRight));\r\n return this;\r\n };\r\n /**\r\n * Calculate relative rotation change from the point of view of behind the front of the mesh.\r\n * Supports definition of mesh facing forward or backward.\r\n * @param flipBack defines the flip\r\n * @param twirlClockwise defines the twirl\r\n * @param tiltRight defines the tilt\r\n * @returns the new rotation vector\r\n */\r\n AbstractMesh.prototype.calcRotatePOV = function (flipBack, twirlClockwise, tiltRight) {\r\n var defForwardMult = this.definedFacingForward ? 1 : -1;\r\n return new Vector3(flipBack * defForwardMult, twirlClockwise, tiltRight * defForwardMult);\r\n };\r\n /**\r\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\r\n * This means the mesh underlying bounding box and sphere are recomputed.\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.refreshBoundingInfo = function (applySkeleton) {\r\n if (applySkeleton === void 0) { applySkeleton = false; }\r\n if (this._boundingInfo && this._boundingInfo.isLocked) {\r\n return this;\r\n }\r\n this._refreshBoundingInfo(this._getPositionData(applySkeleton), null);\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._refreshBoundingInfo = function (data, bias) {\r\n if (data) {\r\n var extend = extractMinAndMax(data, 0, this.getTotalVertices(), bias);\r\n if (this._boundingInfo) {\r\n this._boundingInfo.reConstruct(extend.minimum, extend.maximum);\r\n }\r\n else {\r\n this._boundingInfo = new BoundingInfo(extend.minimum, extend.maximum);\r\n }\r\n }\r\n if (this.subMeshes) {\r\n for (var index = 0; index < this.subMeshes.length; index++) {\r\n this.subMeshes[index].refreshBoundingInfo(data);\r\n }\r\n }\r\n this._updateBoundingInfo();\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._getPositionData = function (applySkeleton) {\r\n var data = this.getVerticesData(VertexBuffer.PositionKind);\r\n if (data && applySkeleton && this.skeleton) {\r\n data = Tools.Slice(data);\r\n this._generatePointsArray();\r\n var matricesIndicesData = this.getVerticesData(VertexBuffer.MatricesIndicesKind);\r\n var matricesWeightsData = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\r\n if (matricesWeightsData && matricesIndicesData) {\r\n var needExtras = this.numBoneInfluencers > 4;\r\n var matricesIndicesExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\r\n var matricesWeightsExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\r\n this.skeleton.prepare();\r\n var skeletonMatrices = this.skeleton.getTransformMatrices(this);\r\n var tempVector = TmpVectors.Vector3[0];\r\n var finalMatrix = TmpVectors.Matrix[0];\r\n var tempMatrix = TmpVectors.Matrix[1];\r\n var matWeightIdx = 0;\r\n for (var index = 0; index < data.length; index += 3, matWeightIdx += 4) {\r\n finalMatrix.reset();\r\n var inf;\r\n var weight;\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n if (needExtras) {\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsExtraData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesExtraData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n }\r\n Vector3.TransformCoordinatesFromFloatsToRef(data[index], data[index + 1], data[index + 2], finalMatrix, tempVector);\r\n tempVector.toArray(data, index);\r\n if (this._positions) {\r\n this._positions[index / 3].copyFrom(tempVector);\r\n }\r\n }\r\n }\r\n }\r\n return data;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._updateBoundingInfo = function () {\r\n var effectiveMesh = this._effectiveMesh;\r\n if (this._boundingInfo) {\r\n this._boundingInfo.update(effectiveMesh.worldMatrixFromCache);\r\n }\r\n else {\r\n this._boundingInfo = new BoundingInfo(this.absolutePosition, this.absolutePosition, effectiveMesh.worldMatrixFromCache);\r\n }\r\n this._updateSubMeshesBoundingInfo(effectiveMesh.worldMatrixFromCache);\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._updateSubMeshesBoundingInfo = function (matrix) {\r\n if (!this.subMeshes) {\r\n return this;\r\n }\r\n var count = this.subMeshes.length;\r\n for (var subIndex = 0; subIndex < count; subIndex++) {\r\n var subMesh = this.subMeshes[subIndex];\r\n if (count > 1 || !subMesh.IsGlobal) {\r\n subMesh.updateBoundingInfo(matrix);\r\n }\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._afterComputeWorldMatrix = function () {\r\n if (this.doNotSyncBoundingInfo) {\r\n return;\r\n }\r\n // Bounding info\r\n this._updateBoundingInfo();\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"_effectiveMesh\", {\r\n /** @hidden */\r\n get: function () {\r\n return (this.skeleton && this.skeleton.overrideMesh) || this;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns `true` if the mesh is within the frustum defined by the passed array of planes.\r\n * A mesh is in the frustum if its bounding box intersects the frustum\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the mesh is in the frustum planes\r\n */\r\n AbstractMesh.prototype.isInFrustum = function (frustumPlanes) {\r\n return this._boundingInfo !== null && this._boundingInfo.isInFrustum(frustumPlanes, this.cullingStrategy);\r\n };\r\n /**\r\n * Returns `true` if the mesh is completely in the frustum defined be the passed array of planes.\r\n * A mesh is completely in the frustum if its bounding box it completely inside the frustum.\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the mesh is completely in the frustum planes\r\n */\r\n AbstractMesh.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n return this._boundingInfo !== null && this._boundingInfo.isCompletelyInFrustum(frustumPlanes);\r\n };\r\n /**\r\n * True if the mesh intersects another mesh or a SolidParticle object\r\n * @param mesh defines a target mesh or SolidParticle to test\r\n * @param precise Unless the parameter `precise` is set to `true` the intersection is computed according to Axis Aligned Bounding Boxes (AABB), else according to OBB (Oriented BBoxes)\r\n * @param includeDescendants Can be set to true to test if the mesh defined in parameters intersects with the current mesh or any child meshes\r\n * @returns true if there is an intersection\r\n */\r\n AbstractMesh.prototype.intersectsMesh = function (mesh, precise, includeDescendants) {\r\n if (precise === void 0) { precise = false; }\r\n if (!this._boundingInfo || !mesh._boundingInfo) {\r\n return false;\r\n }\r\n if (this._boundingInfo.intersects(mesh._boundingInfo, precise)) {\r\n return true;\r\n }\r\n if (includeDescendants) {\r\n for (var _i = 0, _a = this.getChildMeshes(); _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (child.intersectsMesh(mesh, precise, true)) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns true if the passed point (Vector3) is inside the mesh bounding box\r\n * @param point defines the point to test\r\n * @returns true if there is an intersection\r\n */\r\n AbstractMesh.prototype.intersectsPoint = function (point) {\r\n if (!this._boundingInfo) {\r\n return false;\r\n }\r\n return this._boundingInfo.intersectsPoint(point);\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"checkCollisions\", {\r\n // Collisions\r\n /**\r\n * Gets or sets a boolean indicating that this mesh can be used in the collision engine\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n get: function () {\r\n return this._meshCollisionData._checkCollisions;\r\n },\r\n set: function (collisionEnabled) {\r\n this._meshCollisionData._checkCollisions = collisionEnabled;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"collider\", {\r\n /**\r\n * Gets Collider object used to compute collisions (not physics)\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n get: function () {\r\n return this._meshCollisionData._collider;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Move the mesh using collision engine\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n * @param displacement defines the requested displacement vector\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.moveWithCollisions = function (displacement) {\r\n var globalPosition = this.getAbsolutePosition();\r\n globalPosition.addToRef(this.ellipsoidOffset, this._meshCollisionData._oldPositionForCollisions);\r\n var coordinator = this.getScene().collisionCoordinator;\r\n if (!this._meshCollisionData._collider) {\r\n this._meshCollisionData._collider = coordinator.createCollider();\r\n }\r\n this._meshCollisionData._collider._radius = this.ellipsoid;\r\n coordinator.getNewPosition(this._meshCollisionData._oldPositionForCollisions, displacement, this._meshCollisionData._collider, 3, this, this._onCollisionPositionChange, this.uniqueId);\r\n return this;\r\n };\r\n // Collisions\r\n /** @hidden */\r\n AbstractMesh.prototype._collideForSubMesh = function (subMesh, transformMatrix, collider) {\r\n this._generatePointsArray();\r\n if (!this._positions) {\r\n return this;\r\n }\r\n // Transformation\r\n if (!subMesh._lastColliderWorldVertices || !subMesh._lastColliderTransformMatrix.equals(transformMatrix)) {\r\n subMesh._lastColliderTransformMatrix = transformMatrix.clone();\r\n subMesh._lastColliderWorldVertices = [];\r\n subMesh._trianglePlanes = [];\r\n var start = subMesh.verticesStart;\r\n var end = (subMesh.verticesStart + subMesh.verticesCount);\r\n for (var i = start; i < end; i++) {\r\n subMesh._lastColliderWorldVertices.push(Vector3.TransformCoordinates(this._positions[i], transformMatrix));\r\n }\r\n }\r\n // Collide\r\n collider._collide(subMesh._trianglePlanes, subMesh._lastColliderWorldVertices, this.getIndices(), subMesh.indexStart, subMesh.indexStart + subMesh.indexCount, subMesh.verticesStart, !!subMesh.getMaterial(), this);\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._processCollisionsForSubMeshes = function (collider, transformMatrix) {\r\n var subMeshes = this._scene.getCollidingSubMeshCandidates(this, collider);\r\n var len = subMeshes.length;\r\n for (var index = 0; index < len; index++) {\r\n var subMesh = subMeshes.data[index];\r\n // Bounding test\r\n if (len > 1 && !subMesh._checkCollision(collider)) {\r\n continue;\r\n }\r\n this._collideForSubMesh(subMesh, transformMatrix, collider);\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._checkCollision = function (collider) {\r\n // Bounding box test\r\n if (!this._boundingInfo || !this._boundingInfo._checkCollision(collider)) {\r\n return this;\r\n }\r\n // Transformation matrix\r\n var collisionsScalingMatrix = TmpVectors.Matrix[0];\r\n var collisionsTransformMatrix = TmpVectors.Matrix[1];\r\n Matrix.ScalingToRef(1.0 / collider._radius.x, 1.0 / collider._radius.y, 1.0 / collider._radius.z, collisionsScalingMatrix);\r\n this.worldMatrixFromCache.multiplyToRef(collisionsScalingMatrix, collisionsTransformMatrix);\r\n this._processCollisionsForSubMeshes(collider, collisionsTransformMatrix);\r\n return this;\r\n };\r\n // Picking\r\n /** @hidden */\r\n AbstractMesh.prototype._generatePointsArray = function () {\r\n return false;\r\n };\r\n /**\r\n * Checks if the passed Ray intersects with the mesh\r\n * @param ray defines the ray to use\r\n * @param fastCheck defines if fast mode (but less precise) must be used (false by default)\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)\r\n * @param worldToUse defines the world matrix to use to get the world coordinate of the intersection point\r\n * @param skipBoundingInfo a boolean indicating if we should skip the bounding info check\r\n * @returns the picking info\r\n * @see https://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh\r\n */\r\n AbstractMesh.prototype.intersects = function (ray, fastCheck, trianglePredicate, onlyBoundingInfo, worldToUse, skipBoundingInfo) {\r\n var _a;\r\n if (onlyBoundingInfo === void 0) { onlyBoundingInfo = false; }\r\n if (skipBoundingInfo === void 0) { skipBoundingInfo = false; }\r\n var pickingInfo = new PickingInfo();\r\n var intersectionThreshold = this.getClassName() === \"InstancedLinesMesh\" || this.getClassName() === \"LinesMesh\" ? this.intersectionThreshold : 0;\r\n var boundingInfo = this._boundingInfo;\r\n if (!this.subMeshes || !boundingInfo) {\r\n return pickingInfo;\r\n }\r\n if (!skipBoundingInfo && (!ray.intersectsSphere(boundingInfo.boundingSphere, intersectionThreshold) || !ray.intersectsBox(boundingInfo.boundingBox, intersectionThreshold))) {\r\n return pickingInfo;\r\n }\r\n if (onlyBoundingInfo) {\r\n pickingInfo.hit = skipBoundingInfo ? false : true;\r\n pickingInfo.pickedMesh = skipBoundingInfo ? null : this;\r\n pickingInfo.distance = skipBoundingInfo ? 0 : Vector3.Distance(ray.origin, boundingInfo.boundingSphere.center);\r\n pickingInfo.subMeshId = 0;\r\n return pickingInfo;\r\n }\r\n if (!this._generatePointsArray()) {\r\n return pickingInfo;\r\n }\r\n var intersectInfo = null;\r\n var subMeshes = this._scene.getIntersectingSubMeshCandidates(this, ray);\r\n var len = subMeshes.length;\r\n // Check if all submeshes are using a material that don't allow picking (point/lines rendering)\r\n // if no submesh can be picked that way, then fallback to BBox picking\r\n var anySubmeshSupportIntersect = false;\r\n for (var index = 0; index < len; index++) {\r\n var subMesh = subMeshes.data[index];\r\n var material = subMesh.getMaterial();\r\n if (!material) {\r\n continue;\r\n }\r\n if (((_a = this.getIndices()) === null || _a === void 0 ? void 0 : _a.length) && (material.fillMode == 7 ||\r\n material.fillMode == 0 ||\r\n material.fillMode == 1 ||\r\n material.fillMode == 2)) {\r\n anySubmeshSupportIntersect = true;\r\n break;\r\n }\r\n }\r\n // no sub mesh support intersection, fallback to BBox that has already be done\r\n if (!anySubmeshSupportIntersect) {\r\n pickingInfo.hit = true;\r\n pickingInfo.pickedMesh = this;\r\n pickingInfo.distance = Vector3.Distance(ray.origin, boundingInfo.boundingSphere.center);\r\n pickingInfo.subMeshId = -1;\r\n return pickingInfo;\r\n }\r\n // at least 1 submesh supports intersection, keep going\r\n for (var index = 0; index < len; index++) {\r\n var subMesh = subMeshes.data[index];\r\n // Bounding test\r\n if (len > 1 && !subMesh.canIntersects(ray)) {\r\n continue;\r\n }\r\n var currentIntersectInfo = subMesh.intersects(ray, this._positions, this.getIndices(), fastCheck, trianglePredicate);\r\n if (currentIntersectInfo) {\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.subMeshId = index;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n if (intersectInfo) {\r\n // Get picked point\r\n var world = worldToUse !== null && worldToUse !== void 0 ? worldToUse : (this.skeleton && this.skeleton.overrideMesh ? this.skeleton.overrideMesh.getWorldMatrix() : this.getWorldMatrix());\r\n var worldOrigin = TmpVectors.Vector3[0];\r\n var direction = TmpVectors.Vector3[1];\r\n Vector3.TransformCoordinatesToRef(ray.origin, world, worldOrigin);\r\n ray.direction.scaleToRef(intersectInfo.distance, direction);\r\n var worldDirection = Vector3.TransformNormal(direction, world);\r\n var pickedPoint = worldDirection.addInPlace(worldOrigin);\r\n // Return result\r\n pickingInfo.hit = true;\r\n pickingInfo.distance = Vector3.Distance(worldOrigin, pickedPoint);\r\n pickingInfo.pickedPoint = pickedPoint;\r\n pickingInfo.pickedMesh = this;\r\n pickingInfo.bu = intersectInfo.bu || 0;\r\n pickingInfo.bv = intersectInfo.bv || 0;\r\n pickingInfo.subMeshFaceId = intersectInfo.faceId;\r\n pickingInfo.faceId = intersectInfo.faceId + subMeshes.data[intersectInfo.subMeshId].indexStart / (this.getClassName().indexOf(\"LinesMesh\") !== -1 ? 2 : 3);\r\n pickingInfo.subMeshId = intersectInfo.subMeshId;\r\n return pickingInfo;\r\n }\r\n return pickingInfo;\r\n };\r\n /**\r\n * Clones the current mesh\r\n * @param name defines the mesh name\r\n * @param newParent defines the new mesh parent\r\n * @param doNotCloneChildren defines a boolean indicating that children must not be cloned (false by default)\r\n * @returns the new mesh\r\n */\r\n AbstractMesh.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n return null;\r\n };\r\n /**\r\n * Disposes all the submeshes of the current meshnp\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.releaseSubMeshes = function () {\r\n if (this.subMeshes) {\r\n while (this.subMeshes.length) {\r\n this.subMeshes[0].dispose();\r\n }\r\n }\r\n else {\r\n this.subMeshes = new Array();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Releases resources associated with this abstract mesh.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n AbstractMesh.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n var _this = this;\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n var index;\r\n // mesh map release.\r\n if (this._scene.useMaterialMeshMap) {\r\n // remove from material mesh map id needed\r\n if (this._material && this._material.meshMap) {\r\n this._material.meshMap[this.uniqueId] = undefined;\r\n }\r\n }\r\n // Smart Array Retainers.\r\n this.getScene().freeActiveMeshes();\r\n this.getScene().freeRenderingGroups();\r\n // Action manager\r\n if (this.actionManager !== undefined && this.actionManager !== null) {\r\n this.actionManager.dispose();\r\n this.actionManager = null;\r\n }\r\n // Skeleton\r\n this._internalAbstractMeshDataInfo._skeleton = null;\r\n if (this._transformMatrixTexture) {\r\n this._transformMatrixTexture.dispose();\r\n this._transformMatrixTexture = null;\r\n }\r\n // Intersections in progress\r\n for (index = 0; index < this._intersectionsInProgress.length; index++) {\r\n var other = this._intersectionsInProgress[index];\r\n var pos = other._intersectionsInProgress.indexOf(this);\r\n other._intersectionsInProgress.splice(pos, 1);\r\n }\r\n this._intersectionsInProgress = [];\r\n // Lights\r\n var lights = this.getScene().lights;\r\n lights.forEach(function (light) {\r\n var meshIndex = light.includedOnlyMeshes.indexOf(_this);\r\n if (meshIndex !== -1) {\r\n light.includedOnlyMeshes.splice(meshIndex, 1);\r\n }\r\n meshIndex = light.excludedMeshes.indexOf(_this);\r\n if (meshIndex !== -1) {\r\n light.excludedMeshes.splice(meshIndex, 1);\r\n }\r\n // Shadow generators\r\n var generator = light.getShadowGenerator();\r\n if (generator) {\r\n var shadowMap = generator.getShadowMap();\r\n if (shadowMap && shadowMap.renderList) {\r\n meshIndex = shadowMap.renderList.indexOf(_this);\r\n if (meshIndex !== -1) {\r\n shadowMap.renderList.splice(meshIndex, 1);\r\n }\r\n }\r\n }\r\n });\r\n // SubMeshes\r\n if (this.getClassName() !== \"InstancedMesh\" || this.getClassName() !== \"InstancedLinesMesh\") {\r\n this.releaseSubMeshes();\r\n }\r\n // Query\r\n var engine = this.getScene().getEngine();\r\n if (this._occlusionQuery) {\r\n this.isOcclusionQueryInProgress = false;\r\n engine.deleteQuery(this._occlusionQuery);\r\n this._occlusionQuery = null;\r\n }\r\n // Engine\r\n engine.wipeCaches();\r\n // Remove from scene\r\n this.getScene().removeMesh(this);\r\n if (disposeMaterialAndTextures) {\r\n if (this.material) {\r\n if (this.material.getClassName() === \"MultiMaterial\") {\r\n this.material.dispose(false, true, true);\r\n }\r\n else {\r\n this.material.dispose(false, true);\r\n }\r\n }\r\n }\r\n if (!doNotRecurse) {\r\n // Particles\r\n for (index = 0; index < this.getScene().particleSystems.length; index++) {\r\n if (this.getScene().particleSystems[index].emitter === this) {\r\n this.getScene().particleSystems[index].dispose();\r\n index--;\r\n }\r\n }\r\n }\r\n // facet data\r\n if (this._internalAbstractMeshDataInfo._facetData.facetDataEnabled) {\r\n this.disableFacetData();\r\n }\r\n this.onAfterWorldMatrixUpdateObservable.clear();\r\n this.onCollideObservable.clear();\r\n this.onCollisionPositionChangeObservable.clear();\r\n this.onRebuildObservable.clear();\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Adds the passed mesh as a child to the current mesh\r\n * @param mesh defines the child mesh\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.addChild = function (mesh) {\r\n mesh.setParent(this);\r\n return this;\r\n };\r\n /**\r\n * Removes the passed mesh from the current mesh children list\r\n * @param mesh defines the child mesh\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.removeChild = function (mesh) {\r\n mesh.setParent(null);\r\n return this;\r\n };\r\n // Facet data\r\n /** @hidden */\r\n AbstractMesh.prototype._initFacetData = function () {\r\n var data = this._internalAbstractMeshDataInfo._facetData;\r\n if (!data.facetNormals) {\r\n data.facetNormals = new Array();\r\n }\r\n if (!data.facetPositions) {\r\n data.facetPositions = new Array();\r\n }\r\n if (!data.facetPartitioning) {\r\n data.facetPartitioning = new Array();\r\n }\r\n data.facetNb = (this.getIndices().length / 3) | 0;\r\n data.partitioningSubdivisions = (data.partitioningSubdivisions) ? data.partitioningSubdivisions : 10; // default nb of partitioning subdivisions = 10\r\n data.partitioningBBoxRatio = (data.partitioningBBoxRatio) ? data.partitioningBBoxRatio : 1.01; // default ratio 1.01 = the partitioning is 1% bigger than the bounding box\r\n for (var f = 0; f < data.facetNb; f++) {\r\n data.facetNormals[f] = Vector3.Zero();\r\n data.facetPositions[f] = Vector3.Zero();\r\n }\r\n data.facetDataEnabled = true;\r\n return this;\r\n };\r\n /**\r\n * Updates the mesh facetData arrays and the internal partitioning when the mesh is morphed or updated.\r\n * This method can be called within the render loop.\r\n * You don't need to call this method by yourself in the render loop when you update/morph a mesh with the methods CreateXXX() as they automatically manage this computation\r\n * @returns the current mesh\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.updateFacetData = function () {\r\n var data = this._internalAbstractMeshDataInfo._facetData;\r\n if (!data.facetDataEnabled) {\r\n this._initFacetData();\r\n }\r\n var positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n var indices = this.getIndices();\r\n var normals = this.getVerticesData(VertexBuffer.NormalKind);\r\n var bInfo = this.getBoundingInfo();\r\n if (data.facetDepthSort && !data.facetDepthSortEnabled) {\r\n // init arrays, matrix and sort function on first call\r\n data.facetDepthSortEnabled = true;\r\n if (indices instanceof Uint16Array) {\r\n data.depthSortedIndices = new Uint16Array(indices);\r\n }\r\n else if (indices instanceof Uint32Array) {\r\n data.depthSortedIndices = new Uint32Array(indices);\r\n }\r\n else {\r\n var needs32bits = false;\r\n for (var i = 0; i < indices.length; i++) {\r\n if (indices[i] > 65535) {\r\n needs32bits = true;\r\n break;\r\n }\r\n }\r\n if (needs32bits) {\r\n data.depthSortedIndices = new Uint32Array(indices);\r\n }\r\n else {\r\n data.depthSortedIndices = new Uint16Array(indices);\r\n }\r\n }\r\n data.facetDepthSortFunction = function (f1, f2) {\r\n return (f2.sqDistance - f1.sqDistance);\r\n };\r\n if (!data.facetDepthSortFrom) {\r\n var camera = this.getScene().activeCamera;\r\n data.facetDepthSortFrom = (camera) ? camera.position : Vector3.Zero();\r\n }\r\n data.depthSortedFacets = [];\r\n for (var f = 0; f < data.facetNb; f++) {\r\n var depthSortedFacet = { ind: f * 3, sqDistance: 0.0 };\r\n data.depthSortedFacets.push(depthSortedFacet);\r\n }\r\n data.invertedMatrix = Matrix.Identity();\r\n data.facetDepthSortOrigin = Vector3.Zero();\r\n }\r\n data.bbSize.x = (bInfo.maximum.x - bInfo.minimum.x > Epsilon) ? bInfo.maximum.x - bInfo.minimum.x : Epsilon;\r\n data.bbSize.y = (bInfo.maximum.y - bInfo.minimum.y > Epsilon) ? bInfo.maximum.y - bInfo.minimum.y : Epsilon;\r\n data.bbSize.z = (bInfo.maximum.z - bInfo.minimum.z > Epsilon) ? bInfo.maximum.z - bInfo.minimum.z : Epsilon;\r\n var bbSizeMax = (data.bbSize.x > data.bbSize.y) ? data.bbSize.x : data.bbSize.y;\r\n bbSizeMax = (bbSizeMax > data.bbSize.z) ? bbSizeMax : data.bbSize.z;\r\n data.subDiv.max = data.partitioningSubdivisions;\r\n data.subDiv.X = Math.floor(data.subDiv.max * data.bbSize.x / bbSizeMax); // adjust the number of subdivisions per axis\r\n data.subDiv.Y = Math.floor(data.subDiv.max * data.bbSize.y / bbSizeMax); // according to each bbox size per axis\r\n data.subDiv.Z = Math.floor(data.subDiv.max * data.bbSize.z / bbSizeMax);\r\n data.subDiv.X = data.subDiv.X < 1 ? 1 : data.subDiv.X; // at least one subdivision\r\n data.subDiv.Y = data.subDiv.Y < 1 ? 1 : data.subDiv.Y;\r\n data.subDiv.Z = data.subDiv.Z < 1 ? 1 : data.subDiv.Z;\r\n // set the parameters for ComputeNormals()\r\n data.facetParameters.facetNormals = this.getFacetLocalNormals();\r\n data.facetParameters.facetPositions = this.getFacetLocalPositions();\r\n data.facetParameters.facetPartitioning = this.getFacetLocalPartitioning();\r\n data.facetParameters.bInfo = bInfo;\r\n data.facetParameters.bbSize = data.bbSize;\r\n data.facetParameters.subDiv = data.subDiv;\r\n data.facetParameters.ratio = this.partitioningBBoxRatio;\r\n data.facetParameters.depthSort = data.facetDepthSort;\r\n if (data.facetDepthSort && data.facetDepthSortEnabled) {\r\n this.computeWorldMatrix(true);\r\n this._worldMatrix.invertToRef(data.invertedMatrix);\r\n Vector3.TransformCoordinatesToRef(data.facetDepthSortFrom, data.invertedMatrix, data.facetDepthSortOrigin);\r\n data.facetParameters.distanceTo = data.facetDepthSortOrigin;\r\n }\r\n data.facetParameters.depthSortedFacets = data.depthSortedFacets;\r\n VertexData.ComputeNormals(positions, indices, normals, data.facetParameters);\r\n if (data.facetDepthSort && data.facetDepthSortEnabled) {\r\n data.depthSortedFacets.sort(data.facetDepthSortFunction);\r\n var l = (data.depthSortedIndices.length / 3) | 0;\r\n for (var f = 0; f < l; f++) {\r\n var sind = data.depthSortedFacets[f].ind;\r\n data.depthSortedIndices[f * 3] = indices[sind];\r\n data.depthSortedIndices[f * 3 + 1] = indices[sind + 1];\r\n data.depthSortedIndices[f * 3 + 2] = indices[sind + 2];\r\n }\r\n this.updateIndices(data.depthSortedIndices, undefined, true);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns the facetLocalNormals array.\r\n * The normals are expressed in the mesh local spac\r\n * @returns an array of Vector3\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetLocalNormals = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (!facetData.facetNormals) {\r\n this.updateFacetData();\r\n }\r\n return facetData.facetNormals;\r\n };\r\n /**\r\n * Returns the facetLocalPositions array.\r\n * The facet positions are expressed in the mesh local space\r\n * @returns an array of Vector3\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetLocalPositions = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (!facetData.facetPositions) {\r\n this.updateFacetData();\r\n }\r\n return facetData.facetPositions;\r\n };\r\n /**\r\n * Returns the facetLocalPartioning array\r\n * @returns an array of array of numbers\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetLocalPartitioning = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (!facetData.facetPartitioning) {\r\n this.updateFacetData();\r\n }\r\n return facetData.facetPartitioning;\r\n };\r\n /**\r\n * Returns the i-th facet position in the world system.\r\n * This method allocates a new Vector3 per call\r\n * @param i defines the facet index\r\n * @returns a new Vector3\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetPosition = function (i) {\r\n var pos = Vector3.Zero();\r\n this.getFacetPositionToRef(i, pos);\r\n return pos;\r\n };\r\n /**\r\n * Sets the reference Vector3 with the i-th facet position in the world system\r\n * @param i defines the facet index\r\n * @param ref defines the target vector\r\n * @returns the current mesh\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetPositionToRef = function (i, ref) {\r\n var localPos = (this.getFacetLocalPositions())[i];\r\n var world = this.getWorldMatrix();\r\n Vector3.TransformCoordinatesToRef(localPos, world, ref);\r\n return this;\r\n };\r\n /**\r\n * Returns the i-th facet normal in the world system.\r\n * This method allocates a new Vector3 per call\r\n * @param i defines the facet index\r\n * @returns a new Vector3\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetNormal = function (i) {\r\n var norm = Vector3.Zero();\r\n this.getFacetNormalToRef(i, norm);\r\n return norm;\r\n };\r\n /**\r\n * Sets the reference Vector3 with the i-th facet normal in the world system\r\n * @param i defines the facet index\r\n * @param ref defines the target vector\r\n * @returns the current mesh\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetNormalToRef = function (i, ref) {\r\n var localNorm = (this.getFacetLocalNormals())[i];\r\n Vector3.TransformNormalToRef(localNorm, this.getWorldMatrix(), ref);\r\n return this;\r\n };\r\n /**\r\n * Returns the facets (in an array) in the same partitioning block than the one the passed coordinates are located (expressed in the mesh local system)\r\n * @param x defines x coordinate\r\n * @param y defines y coordinate\r\n * @param z defines z coordinate\r\n * @returns the array of facet indexes\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetsAtLocalCoordinates = function (x, y, z) {\r\n var bInfo = this.getBoundingInfo();\r\n var data = this._internalAbstractMeshDataInfo._facetData;\r\n var ox = Math.floor((x - bInfo.minimum.x * data.partitioningBBoxRatio) * data.subDiv.X * data.partitioningBBoxRatio / data.bbSize.x);\r\n var oy = Math.floor((y - bInfo.minimum.y * data.partitioningBBoxRatio) * data.subDiv.Y * data.partitioningBBoxRatio / data.bbSize.y);\r\n var oz = Math.floor((z - bInfo.minimum.z * data.partitioningBBoxRatio) * data.subDiv.Z * data.partitioningBBoxRatio / data.bbSize.z);\r\n if (ox < 0 || ox > data.subDiv.max || oy < 0 || oy > data.subDiv.max || oz < 0 || oz > data.subDiv.max) {\r\n return null;\r\n }\r\n return data.facetPartitioning[ox + data.subDiv.max * oy + data.subDiv.max * data.subDiv.max * oz];\r\n };\r\n /**\r\n * Returns the closest mesh facet index at (x,y,z) World coordinates, null if not found\r\n * @param projected sets as the (x,y,z) world projection on the facet\r\n * @param checkFace if true (default false), only the facet \"facing\" to (x,y,z) or only the ones \"turning their backs\", according to the parameter \"facing\" are returned\r\n * @param facing if facing and checkFace are true, only the facet \"facing\" to (x, y, z) are returned : positive dot (x, y, z) * facet position. If facing si false and checkFace is true, only the facet \"turning their backs\" to (x, y, z) are returned : negative dot (x, y, z) * facet position\r\n * @param x defines x coordinate\r\n * @param y defines y coordinate\r\n * @param z defines z coordinate\r\n * @returns the face index if found (or null instead)\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getClosestFacetAtCoordinates = function (x, y, z, projected, checkFace, facing) {\r\n if (checkFace === void 0) { checkFace = false; }\r\n if (facing === void 0) { facing = true; }\r\n var world = this.getWorldMatrix();\r\n var invMat = TmpVectors.Matrix[5];\r\n world.invertToRef(invMat);\r\n var invVect = TmpVectors.Vector3[8];\r\n Vector3.TransformCoordinatesFromFloatsToRef(x, y, z, invMat, invVect); // transform (x,y,z) to coordinates in the mesh local space\r\n var closest = this.getClosestFacetAtLocalCoordinates(invVect.x, invVect.y, invVect.z, projected, checkFace, facing);\r\n if (projected) {\r\n // tranform the local computed projected vector to world coordinates\r\n Vector3.TransformCoordinatesFromFloatsToRef(projected.x, projected.y, projected.z, world, projected);\r\n }\r\n return closest;\r\n };\r\n /**\r\n * Returns the closest mesh facet index at (x,y,z) local coordinates, null if not found\r\n * @param projected sets as the (x,y,z) local projection on the facet\r\n * @param checkFace if true (default false), only the facet \"facing\" to (x,y,z) or only the ones \"turning their backs\", according to the parameter \"facing\" are returned\r\n * @param facing if facing and checkFace are true, only the facet \"facing\" to (x, y, z) are returned : positive dot (x, y, z) * facet position. If facing si false and checkFace is true, only the facet \"turning their backs\" to (x, y, z) are returned : negative dot (x, y, z) * facet position\r\n * @param x defines x coordinate\r\n * @param y defines y coordinate\r\n * @param z defines z coordinate\r\n * @returns the face index if found (or null instead)\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getClosestFacetAtLocalCoordinates = function (x, y, z, projected, checkFace, facing) {\r\n if (checkFace === void 0) { checkFace = false; }\r\n if (facing === void 0) { facing = true; }\r\n var closest = null;\r\n var tmpx = 0.0;\r\n var tmpy = 0.0;\r\n var tmpz = 0.0;\r\n var d = 0.0; // tmp dot facet normal * facet position\r\n var t0 = 0.0;\r\n var projx = 0.0;\r\n var projy = 0.0;\r\n var projz = 0.0;\r\n // Get all the facets in the same partitioning block than (x, y, z)\r\n var facetPositions = this.getFacetLocalPositions();\r\n var facetNormals = this.getFacetLocalNormals();\r\n var facetsInBlock = this.getFacetsAtLocalCoordinates(x, y, z);\r\n if (!facetsInBlock) {\r\n return null;\r\n }\r\n // Get the closest facet to (x, y, z)\r\n var shortest = Number.MAX_VALUE; // init distance vars\r\n var tmpDistance = shortest;\r\n var fib; // current facet in the block\r\n var norm; // current facet normal\r\n var p0; // current facet barycenter position\r\n // loop on all the facets in the current partitioning block\r\n for (var idx = 0; idx < facetsInBlock.length; idx++) {\r\n fib = facetsInBlock[idx];\r\n norm = facetNormals[fib];\r\n p0 = facetPositions[fib];\r\n d = (x - p0.x) * norm.x + (y - p0.y) * norm.y + (z - p0.z) * norm.z;\r\n if (!checkFace || (checkFace && facing && d >= 0.0) || (checkFace && !facing && d <= 0.0)) {\r\n // compute (x,y,z) projection on the facet = (projx, projy, projz)\r\n d = norm.x * p0.x + norm.y * p0.y + norm.z * p0.z;\r\n t0 = -(norm.x * x + norm.y * y + norm.z * z - d) / (norm.x * norm.x + norm.y * norm.y + norm.z * norm.z);\r\n projx = x + norm.x * t0;\r\n projy = y + norm.y * t0;\r\n projz = z + norm.z * t0;\r\n tmpx = projx - x;\r\n tmpy = projy - y;\r\n tmpz = projz - z;\r\n tmpDistance = tmpx * tmpx + tmpy * tmpy + tmpz * tmpz; // compute length between (x, y, z) and its projection on the facet\r\n if (tmpDistance < shortest) { // just keep the closest facet to (x, y, z)\r\n shortest = tmpDistance;\r\n closest = fib;\r\n if (projected) {\r\n projected.x = projx;\r\n projected.y = projy;\r\n projected.z = projz;\r\n }\r\n }\r\n }\r\n }\r\n return closest;\r\n };\r\n /**\r\n * Returns the object \"parameter\" set with all the expected parameters for facetData computation by ComputeNormals()\r\n * @returns the parameters\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetDataParameters = function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetParameters;\r\n };\r\n /**\r\n * Disables the feature FacetData and frees the related memory\r\n * @returns the current mesh\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.disableFacetData = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (facetData.facetDataEnabled) {\r\n facetData.facetDataEnabled = false;\r\n facetData.facetPositions = new Array();\r\n facetData.facetNormals = new Array();\r\n facetData.facetPartitioning = new Array();\r\n facetData.facetParameters = null;\r\n facetData.depthSortedIndices = new Uint32Array(0);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the AbstractMesh indices array\r\n * @param indices defines the data source\r\n * @param offset defines the offset in the index buffer where to store the new data (can be null)\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.updateIndices = function (indices, offset, gpuMemoryOnly) {\r\n if (gpuMemoryOnly === void 0) { gpuMemoryOnly = false; }\r\n return this;\r\n };\r\n /**\r\n * Creates new normals data for the mesh\r\n * @param updatable defines if the normal vertex buffer must be flagged as updatable\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.createNormals = function (updatable) {\r\n var positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n var indices = this.getIndices();\r\n var normals;\r\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n normals = this.getVerticesData(VertexBuffer.NormalKind);\r\n }\r\n else {\r\n normals = [];\r\n }\r\n VertexData.ComputeNormals(positions, indices, normals, { useRightHandedSystem: this.getScene().useRightHandedSystem });\r\n this.setVerticesData(VertexBuffer.NormalKind, normals, updatable);\r\n return this;\r\n };\r\n /**\r\n * Align the mesh with a normal\r\n * @param normal defines the normal to use\r\n * @param upDirection can be used to redefined the up vector to use (will use the (0, 1, 0) by default)\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.alignWithNormal = function (normal, upDirection) {\r\n if (!upDirection) {\r\n upDirection = Axis.Y;\r\n }\r\n var axisX = TmpVectors.Vector3[0];\r\n var axisZ = TmpVectors.Vector3[1];\r\n Vector3.CrossToRef(upDirection, normal, axisZ);\r\n Vector3.CrossToRef(normal, axisZ, axisX);\r\n if (this.rotationQuaternion) {\r\n Quaternion.RotationQuaternionFromAxisToRef(axisX, normal, axisZ, this.rotationQuaternion);\r\n }\r\n else {\r\n Vector3.RotationFromAxisToRef(axisX, normal, axisZ, this.rotation);\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._checkOcclusionQuery = function () {\r\n return false;\r\n };\r\n /**\r\n * Disables the mesh edge rendering mode\r\n * @returns the currentAbstractMesh\r\n */\r\n AbstractMesh.prototype.disableEdgesRendering = function () {\r\n throw _DevTools.WarnImport(\"EdgesRenderer\");\r\n };\r\n /**\r\n * Enables the edge rendering mode on the mesh.\r\n * This mode makes the mesh edges visible\r\n * @param epsilon defines the maximal distance between two angles to detect a face\r\n * @param checkVerticesInsteadOfIndices indicates that we should check vertex list directly instead of faces\r\n * @param options options to the edge renderer\r\n * @returns the currentAbstractMesh\r\n * @see https://www.babylonjs-playground.com/#19O9TU#0\r\n */\r\n AbstractMesh.prototype.enableEdgesRendering = function (epsilon, checkVerticesInsteadOfIndices, options) {\r\n throw _DevTools.WarnImport(\"EdgesRenderer\");\r\n };\r\n /**\r\n * This function returns all of the particle systems in the scene that use the mesh as an emitter.\r\n * @returns an array of particle systems in the scene that use the mesh as an emitter\r\n */\r\n AbstractMesh.prototype.getConnectedParticleSystems = function () {\r\n var _this = this;\r\n return this._scene.particleSystems.filter(function (particleSystem) { return particleSystem.emitter === _this; });\r\n };\r\n /** No occlusion */\r\n AbstractMesh.OCCLUSION_TYPE_NONE = 0;\r\n /** Occlusion set to optimisitic */\r\n AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC = 1;\r\n /** Occlusion set to strict */\r\n AbstractMesh.OCCLUSION_TYPE_STRICT = 2;\r\n /** Use an accurante occlusion algorithm */\r\n AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE = 0;\r\n /** Use a conservative occlusion algorithm */\r\n AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE = 1;\r\n /** Default culling strategy : this is an exclusion test and it's the more accurate.\r\n * Test order :\r\n * Is the bounding sphere outside the frustum ?\r\n * If not, are the bounding box vertices outside the frustum ?\r\n * It not, then the cullable object is in the frustum.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_STANDARD = 0;\r\n /** Culling strategy : Bounding Sphere Only.\r\n * This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested.\r\n * It's also less accurate than the standard because some not visible objects can still be selected.\r\n * Test : is the bounding sphere outside the frustum ?\r\n * If not, then the cullable object is in the frustum.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = 1;\r\n /** Culling strategy : Optimistic Inclusion.\r\n * This in an inclusion test first, then the standard exclusion test.\r\n * This can be faster when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside.\r\n * Anyway, it's as accurate as the standard strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the default culling strategy.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = 2;\r\n /** Culling strategy : Optimistic Inclusion then Bounding Sphere Only.\r\n * This in an inclusion test first, then the bounding sphere only exclusion test.\r\n * This can be the fastest test when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it.\r\n * It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = 3;\r\n return AbstractMesh;\r\n}(TransformNode));\r\nexport { AbstractMesh };\r\n_TypeStore.RegisteredTypes[\"BABYLON.AbstractMesh\"] = AbstractMesh;\r\n//# sourceMappingURL=abstractMesh.js.map","/**\r\n * Class used to store data that will be store in GPU memory\r\n */\r\nvar Buffer = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param engine the engine\r\n * @param data the data to use for this buffer\r\n * @param updatable whether the data is updatable\r\n * @param stride the stride (optional)\r\n * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional)\r\n * @param instanced whether the buffer is instanced (optional)\r\n * @param useBytes set to true if the stride in in bytes (optional)\r\n * @param divisor sets an optional divisor for instances (1 by default)\r\n */\r\n function Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced, useBytes, divisor) {\r\n if (stride === void 0) { stride = 0; }\r\n if (postponeInternalCreation === void 0) { postponeInternalCreation = false; }\r\n if (instanced === void 0) { instanced = false; }\r\n if (useBytes === void 0) { useBytes = false; }\r\n this._isAlreadyOwned = false;\r\n if (engine.getScene) { // old versions of VertexBuffer accepted 'mesh' instead of 'engine'\r\n this._engine = engine.getScene().getEngine();\r\n }\r\n else {\r\n this._engine = engine;\r\n }\r\n this._updatable = updatable;\r\n this._instanced = instanced;\r\n this._divisor = divisor || 1;\r\n this._data = data;\r\n this.byteStride = useBytes ? stride : stride * Float32Array.BYTES_PER_ELEMENT;\r\n if (!postponeInternalCreation) { // by default\r\n this.create();\r\n }\r\n }\r\n /**\r\n * Create a new VertexBuffer based on the current buffer\r\n * @param kind defines the vertex buffer kind (position, normal, etc.)\r\n * @param offset defines offset in the buffer (0 by default)\r\n * @param size defines the size in floats of attributes (position is 3 for instance)\r\n * @param stride defines the stride size in floats in the buffer (the offset to apply to reach next value when data is interleaved)\r\n * @param instanced defines if the vertex buffer contains indexed data\r\n * @param useBytes defines if the offset and stride are in bytes *\r\n * @param divisor sets an optional divisor for instances (1 by default)\r\n * @returns the new vertex buffer\r\n */\r\n Buffer.prototype.createVertexBuffer = function (kind, offset, size, stride, instanced, useBytes, divisor) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n var byteOffset = useBytes ? offset : offset * Float32Array.BYTES_PER_ELEMENT;\r\n var byteStride = stride ? (useBytes ? stride : stride * Float32Array.BYTES_PER_ELEMENT) : this.byteStride;\r\n // a lot of these parameters are ignored as they are overriden by the buffer\r\n return new VertexBuffer(this._engine, this, kind, this._updatable, true, byteStride, instanced === undefined ? this._instanced : instanced, byteOffset, size, undefined, undefined, true, this._divisor || divisor);\r\n };\r\n // Properties\r\n /**\r\n * Gets a boolean indicating if the Buffer is updatable?\r\n * @returns true if the buffer is updatable\r\n */\r\n Buffer.prototype.isUpdatable = function () {\r\n return this._updatable;\r\n };\r\n /**\r\n * Gets current buffer's data\r\n * @returns a DataArray or null\r\n */\r\n Buffer.prototype.getData = function () {\r\n return this._data;\r\n };\r\n /**\r\n * Gets underlying native buffer\r\n * @returns underlying native buffer\r\n */\r\n Buffer.prototype.getBuffer = function () {\r\n return this._buffer;\r\n };\r\n /**\r\n * Gets the stride in float32 units (i.e. byte stride / 4).\r\n * May not be an integer if the byte stride is not divisible by 4.\r\n * @returns the stride in float32 units\r\n * @deprecated Please use byteStride instead.\r\n */\r\n Buffer.prototype.getStrideSize = function () {\r\n return this.byteStride / Float32Array.BYTES_PER_ELEMENT;\r\n };\r\n // Methods\r\n /**\r\n * Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property\r\n * @param data defines the data to store\r\n */\r\n Buffer.prototype.create = function (data) {\r\n if (data === void 0) { data = null; }\r\n if (!data && this._buffer) {\r\n return; // nothing to do\r\n }\r\n data = data || this._data;\r\n if (!data) {\r\n return;\r\n }\r\n if (!this._buffer) { // create buffer\r\n if (this._updatable) {\r\n this._buffer = this._engine.createDynamicVertexBuffer(data);\r\n this._data = data;\r\n }\r\n else {\r\n this._buffer = this._engine.createVertexBuffer(data);\r\n }\r\n }\r\n else if (this._updatable) { // update buffer\r\n this._engine.updateDynamicVertexBuffer(this._buffer, data);\r\n this._data = data;\r\n }\r\n };\r\n /** @hidden */\r\n Buffer.prototype._rebuild = function () {\r\n this._buffer = null;\r\n this.create(this._data);\r\n };\r\n /**\r\n * Update current buffer data\r\n * @param data defines the data to store\r\n */\r\n Buffer.prototype.update = function (data) {\r\n this.create(data);\r\n };\r\n /**\r\n * Updates the data directly.\r\n * @param data the new data\r\n * @param offset the new offset\r\n * @param vertexCount the vertex count (optional)\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n Buffer.prototype.updateDirectly = function (data, offset, vertexCount, useBytes) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n if (!this._buffer) {\r\n return;\r\n }\r\n if (this._updatable) { // update buffer\r\n this._engine.updateDynamicVertexBuffer(this._buffer, data, useBytes ? offset : offset * Float32Array.BYTES_PER_ELEMENT, (vertexCount ? vertexCount * this.byteStride : undefined));\r\n this._data = null;\r\n }\r\n };\r\n /** @hidden */\r\n Buffer.prototype._increaseReferences = function () {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n if (!this._isAlreadyOwned) {\r\n this._isAlreadyOwned = true;\r\n return;\r\n }\r\n this._buffer.references++;\r\n };\r\n /**\r\n * Release all resources\r\n */\r\n Buffer.prototype.dispose = function () {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n if (this._engine._releaseBuffer(this._buffer)) {\r\n this._buffer = null;\r\n }\r\n };\r\n return Buffer;\r\n}());\r\nexport { Buffer };\r\n/**\r\n * Specialized buffer used to store vertex data\r\n */\r\nvar VertexBuffer = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param engine the engine\r\n * @param data the data to use for this vertex buffer\r\n * @param kind the vertex buffer kind\r\n * @param updatable whether the data is updatable\r\n * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional)\r\n * @param stride the stride (optional)\r\n * @param instanced whether the buffer is instanced (optional)\r\n * @param offset the offset of the data (optional)\r\n * @param size the number of components (optional)\r\n * @param type the type of the component (optional)\r\n * @param normalized whether the data contains normalized data (optional)\r\n * @param useBytes set to true if stride and offset are in bytes (optional)\r\n * @param divisor defines the instance divisor to use (1 by default)\r\n * @param takeBufferOwnership defines if the buffer should be released when the vertex buffer is disposed\r\n */\r\n function VertexBuffer(engine, data, kind, updatable, postponeInternalCreation, stride, instanced, offset, size, type, normalized, useBytes, divisor, takeBufferOwnership) {\r\n if (normalized === void 0) { normalized = false; }\r\n if (useBytes === void 0) { useBytes = false; }\r\n if (divisor === void 0) { divisor = 1; }\r\n if (takeBufferOwnership === void 0) { takeBufferOwnership = false; }\r\n if (data instanceof Buffer) {\r\n this._buffer = data;\r\n this._ownsBuffer = takeBufferOwnership;\r\n if (takeBufferOwnership) {\r\n this._buffer._increaseReferences();\r\n }\r\n }\r\n else {\r\n this._buffer = new Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced, useBytes);\r\n this._ownsBuffer = true;\r\n }\r\n this._kind = kind;\r\n if (type == undefined) {\r\n var data_1 = this.getData();\r\n this.type = VertexBuffer.FLOAT;\r\n if (data_1 instanceof Int8Array) {\r\n this.type = VertexBuffer.BYTE;\r\n }\r\n else if (data_1 instanceof Uint8Array) {\r\n this.type = VertexBuffer.UNSIGNED_BYTE;\r\n }\r\n else if (data_1 instanceof Int16Array) {\r\n this.type = VertexBuffer.SHORT;\r\n }\r\n else if (data_1 instanceof Uint16Array) {\r\n this.type = VertexBuffer.UNSIGNED_SHORT;\r\n }\r\n else if (data_1 instanceof Int32Array) {\r\n this.type = VertexBuffer.INT;\r\n }\r\n else if (data_1 instanceof Uint32Array) {\r\n this.type = VertexBuffer.UNSIGNED_INT;\r\n }\r\n }\r\n else {\r\n this.type = type;\r\n }\r\n var typeByteLength = VertexBuffer.GetTypeByteLength(this.type);\r\n if (useBytes) {\r\n this._size = size || (stride ? (stride / typeByteLength) : VertexBuffer.DeduceStride(kind));\r\n this.byteStride = stride || this._buffer.byteStride || (this._size * typeByteLength);\r\n this.byteOffset = offset || 0;\r\n }\r\n else {\r\n this._size = size || stride || VertexBuffer.DeduceStride(kind);\r\n this.byteStride = stride ? (stride * typeByteLength) : (this._buffer.byteStride || (this._size * typeByteLength));\r\n this.byteOffset = (offset || 0) * typeByteLength;\r\n }\r\n this.normalized = normalized;\r\n this._instanced = instanced !== undefined ? instanced : false;\r\n this._instanceDivisor = instanced ? divisor : 0;\r\n }\r\n Object.defineProperty(VertexBuffer.prototype, \"instanceDivisor\", {\r\n /**\r\n * Gets or sets the instance divisor when in instanced mode\r\n */\r\n get: function () {\r\n return this._instanceDivisor;\r\n },\r\n set: function (value) {\r\n this._instanceDivisor = value;\r\n if (value == 0) {\r\n this._instanced = false;\r\n }\r\n else {\r\n this._instanced = true;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n VertexBuffer.prototype._rebuild = function () {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n this._buffer._rebuild();\r\n };\r\n /**\r\n * Returns the kind of the VertexBuffer (string)\r\n * @returns a string\r\n */\r\n VertexBuffer.prototype.getKind = function () {\r\n return this._kind;\r\n };\r\n // Properties\r\n /**\r\n * Gets a boolean indicating if the VertexBuffer is updatable?\r\n * @returns true if the buffer is updatable\r\n */\r\n VertexBuffer.prototype.isUpdatable = function () {\r\n return this._buffer.isUpdatable();\r\n };\r\n /**\r\n * Gets current buffer's data\r\n * @returns a DataArray or null\r\n */\r\n VertexBuffer.prototype.getData = function () {\r\n return this._buffer.getData();\r\n };\r\n /**\r\n * Gets underlying native buffer\r\n * @returns underlying native buffer\r\n */\r\n VertexBuffer.prototype.getBuffer = function () {\r\n return this._buffer.getBuffer();\r\n };\r\n /**\r\n * Gets the stride in float32 units (i.e. byte stride / 4).\r\n * May not be an integer if the byte stride is not divisible by 4.\r\n * @returns the stride in float32 units\r\n * @deprecated Please use byteStride instead.\r\n */\r\n VertexBuffer.prototype.getStrideSize = function () {\r\n return this.byteStride / VertexBuffer.GetTypeByteLength(this.type);\r\n };\r\n /**\r\n * Returns the offset as a multiple of the type byte length.\r\n * @returns the offset in bytes\r\n * @deprecated Please use byteOffset instead.\r\n */\r\n VertexBuffer.prototype.getOffset = function () {\r\n return this.byteOffset / VertexBuffer.GetTypeByteLength(this.type);\r\n };\r\n /**\r\n * Returns the number of components per vertex attribute (integer)\r\n * @returns the size in float\r\n */\r\n VertexBuffer.prototype.getSize = function () {\r\n return this._size;\r\n };\r\n /**\r\n * Gets a boolean indicating is the internal buffer of the VertexBuffer is instanced\r\n * @returns true if this buffer is instanced\r\n */\r\n VertexBuffer.prototype.getIsInstanced = function () {\r\n return this._instanced;\r\n };\r\n /**\r\n * Returns the instancing divisor, zero for non-instanced (integer).\r\n * @returns a number\r\n */\r\n VertexBuffer.prototype.getInstanceDivisor = function () {\r\n return this._instanceDivisor;\r\n };\r\n // Methods\r\n /**\r\n * Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property\r\n * @param data defines the data to store\r\n */\r\n VertexBuffer.prototype.create = function (data) {\r\n this._buffer.create(data);\r\n };\r\n /**\r\n * Updates the underlying buffer according to the passed numeric array or Float32Array.\r\n * This function will create a new buffer if the current one is not updatable\r\n * @param data defines the data to store\r\n */\r\n VertexBuffer.prototype.update = function (data) {\r\n this._buffer.update(data);\r\n };\r\n /**\r\n * Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array.\r\n * Returns the directly updated WebGLBuffer.\r\n * @param data the new data\r\n * @param offset the new offset\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n VertexBuffer.prototype.updateDirectly = function (data, offset, useBytes) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n this._buffer.updateDirectly(data, offset, undefined, useBytes);\r\n };\r\n /**\r\n * Disposes the VertexBuffer and the underlying WebGLBuffer.\r\n */\r\n VertexBuffer.prototype.dispose = function () {\r\n if (this._ownsBuffer) {\r\n this._buffer.dispose();\r\n }\r\n };\r\n /**\r\n * Enumerates each value of this vertex buffer as numbers.\r\n * @param count the number of values to enumerate\r\n * @param callback the callback function called for each value\r\n */\r\n VertexBuffer.prototype.forEach = function (count, callback) {\r\n VertexBuffer.ForEach(this._buffer.getData(), this.byteOffset, this.byteStride, this._size, this.type, count, this.normalized, callback);\r\n };\r\n /**\r\n * Deduces the stride given a kind.\r\n * @param kind The kind string to deduce\r\n * @returns The deduced stride\r\n */\r\n VertexBuffer.DeduceStride = function (kind) {\r\n switch (kind) {\r\n case VertexBuffer.UVKind:\r\n case VertexBuffer.UV2Kind:\r\n case VertexBuffer.UV3Kind:\r\n case VertexBuffer.UV4Kind:\r\n case VertexBuffer.UV5Kind:\r\n case VertexBuffer.UV6Kind:\r\n return 2;\r\n case VertexBuffer.NormalKind:\r\n case VertexBuffer.PositionKind:\r\n return 3;\r\n case VertexBuffer.ColorKind:\r\n case VertexBuffer.MatricesIndicesKind:\r\n case VertexBuffer.MatricesIndicesExtraKind:\r\n case VertexBuffer.MatricesWeightsKind:\r\n case VertexBuffer.MatricesWeightsExtraKind:\r\n case VertexBuffer.TangentKind:\r\n return 4;\r\n default:\r\n throw new Error(\"Invalid kind '\" + kind + \"'\");\r\n }\r\n };\r\n /**\r\n * Gets the byte length of the given type.\r\n * @param type the type\r\n * @returns the number of bytes\r\n */\r\n VertexBuffer.GetTypeByteLength = function (type) {\r\n switch (type) {\r\n case VertexBuffer.BYTE:\r\n case VertexBuffer.UNSIGNED_BYTE:\r\n return 1;\r\n case VertexBuffer.SHORT:\r\n case VertexBuffer.UNSIGNED_SHORT:\r\n return 2;\r\n case VertexBuffer.INT:\r\n case VertexBuffer.UNSIGNED_INT:\r\n case VertexBuffer.FLOAT:\r\n return 4;\r\n default:\r\n throw new Error(\"Invalid type '\" + type + \"'\");\r\n }\r\n };\r\n /**\r\n * Enumerates each value of the given parameters as numbers.\r\n * @param data the data to enumerate\r\n * @param byteOffset the byte offset of the data\r\n * @param byteStride the byte stride of the data\r\n * @param componentCount the number of components per element\r\n * @param componentType the type of the component\r\n * @param count the number of values to enumerate\r\n * @param normalized whether the data is normalized\r\n * @param callback the callback function called for each value\r\n */\r\n VertexBuffer.ForEach = function (data, byteOffset, byteStride, componentCount, componentType, count, normalized, callback) {\r\n if (data instanceof Array) {\r\n var offset = byteOffset / 4;\r\n var stride = byteStride / 4;\r\n for (var index = 0; index < count; index += componentCount) {\r\n for (var componentIndex = 0; componentIndex < componentCount; componentIndex++) {\r\n callback(data[offset + componentIndex], index + componentIndex);\r\n }\r\n offset += stride;\r\n }\r\n }\r\n else {\r\n var dataView = data instanceof ArrayBuffer ? new DataView(data) : new DataView(data.buffer, data.byteOffset, data.byteLength);\r\n var componentByteLength = VertexBuffer.GetTypeByteLength(componentType);\r\n for (var index = 0; index < count; index += componentCount) {\r\n var componentByteOffset = byteOffset;\r\n for (var componentIndex = 0; componentIndex < componentCount; componentIndex++) {\r\n var value = VertexBuffer._GetFloatValue(dataView, componentType, componentByteOffset, normalized);\r\n callback(value, index + componentIndex);\r\n componentByteOffset += componentByteLength;\r\n }\r\n byteOffset += byteStride;\r\n }\r\n }\r\n };\r\n VertexBuffer._GetFloatValue = function (dataView, type, byteOffset, normalized) {\r\n switch (type) {\r\n case VertexBuffer.BYTE: {\r\n var value = dataView.getInt8(byteOffset);\r\n if (normalized) {\r\n value = Math.max(value / 127, -1);\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.UNSIGNED_BYTE: {\r\n var value = dataView.getUint8(byteOffset);\r\n if (normalized) {\r\n value = value / 255;\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.SHORT: {\r\n var value = dataView.getInt16(byteOffset, true);\r\n if (normalized) {\r\n value = Math.max(value / 32767, -1);\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.UNSIGNED_SHORT: {\r\n var value = dataView.getUint16(byteOffset, true);\r\n if (normalized) {\r\n value = value / 65535;\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.INT: {\r\n return dataView.getInt32(byteOffset, true);\r\n }\r\n case VertexBuffer.UNSIGNED_INT: {\r\n return dataView.getUint32(byteOffset, true);\r\n }\r\n case VertexBuffer.FLOAT: {\r\n return dataView.getFloat32(byteOffset, true);\r\n }\r\n default: {\r\n throw new Error(\"Invalid component type \" + type);\r\n }\r\n }\r\n };\r\n /**\r\n * The byte type.\r\n */\r\n VertexBuffer.BYTE = 5120;\r\n /**\r\n * The unsigned byte type.\r\n */\r\n VertexBuffer.UNSIGNED_BYTE = 5121;\r\n /**\r\n * The short type.\r\n */\r\n VertexBuffer.SHORT = 5122;\r\n /**\r\n * The unsigned short type.\r\n */\r\n VertexBuffer.UNSIGNED_SHORT = 5123;\r\n /**\r\n * The integer type.\r\n */\r\n VertexBuffer.INT = 5124;\r\n /**\r\n * The unsigned integer type.\r\n */\r\n VertexBuffer.UNSIGNED_INT = 5125;\r\n /**\r\n * The float type.\r\n */\r\n VertexBuffer.FLOAT = 5126;\r\n // Enums\r\n /**\r\n * Positions\r\n */\r\n VertexBuffer.PositionKind = \"position\";\r\n /**\r\n * Normals\r\n */\r\n VertexBuffer.NormalKind = \"normal\";\r\n /**\r\n * Tangents\r\n */\r\n VertexBuffer.TangentKind = \"tangent\";\r\n /**\r\n * Texture coordinates\r\n */\r\n VertexBuffer.UVKind = \"uv\";\r\n /**\r\n * Texture coordinates 2\r\n */\r\n VertexBuffer.UV2Kind = \"uv2\";\r\n /**\r\n * Texture coordinates 3\r\n */\r\n VertexBuffer.UV3Kind = \"uv3\";\r\n /**\r\n * Texture coordinates 4\r\n */\r\n VertexBuffer.UV4Kind = \"uv4\";\r\n /**\r\n * Texture coordinates 5\r\n */\r\n VertexBuffer.UV5Kind = \"uv5\";\r\n /**\r\n * Texture coordinates 6\r\n */\r\n VertexBuffer.UV6Kind = \"uv6\";\r\n /**\r\n * Colors\r\n */\r\n VertexBuffer.ColorKind = \"color\";\r\n /**\r\n * Matrix indices (for bones)\r\n */\r\n VertexBuffer.MatricesIndicesKind = \"matricesIndices\";\r\n /**\r\n * Matrix weights (for bones)\r\n */\r\n VertexBuffer.MatricesWeightsKind = \"matricesWeights\";\r\n /**\r\n * Additional matrix indices (for bones)\r\n */\r\n VertexBuffer.MatricesIndicesExtraKind = \"matricesIndicesExtra\";\r\n /**\r\n * Additional matrix weights (for bones)\r\n */\r\n VertexBuffer.MatricesWeightsExtraKind = \"matricesWeightsExtra\";\r\n return VertexBuffer;\r\n}());\r\nexport { VertexBuffer };\r\n//# sourceMappingURL=buffer.js.map","import { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport { VertexData } from \"../Meshes/mesh.vertexData\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { SubMesh } from \"../Meshes/subMesh\";\r\nimport { SceneLoaderFlags } from \"../Loading/sceneLoaderFlags\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Tags } from \"../Misc/tags\";\r\nimport { extractMinAndMax } from \"../Maths/math.functions\";\r\n/**\r\n * Class used to store geometry data (vertex buffers + index buffer)\r\n */\r\nvar Geometry = /** @class */ (function () {\r\n /**\r\n * Creates a new geometry\r\n * @param id defines the unique ID\r\n * @param scene defines the hosting scene\r\n * @param vertexData defines the VertexData used to get geometry data\r\n * @param updatable defines if geometry must be updatable (false by default)\r\n * @param mesh defines the mesh that will be associated with the geometry\r\n */\r\n function Geometry(id, scene, vertexData, updatable, mesh) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (mesh === void 0) { mesh = null; }\r\n /**\r\n * Gets the delay loading state of the geometry (none by default which means not delayed)\r\n */\r\n this.delayLoadState = 0;\r\n this._totalVertices = 0;\r\n this._isDisposed = false;\r\n this._indexBufferIsUpdatable = false;\r\n this._positionsCache = [];\r\n /**\r\n * If set to true (false by defaut), the bounding info applied to the meshes sharing this geometry will be the bounding info defined at the class level\r\n * and won't be computed based on the vertex positions (which is what we get when useBoundingInfoFromGeometry = false)\r\n */\r\n this.useBoundingInfoFromGeometry = false;\r\n this.id = id;\r\n this.uniqueId = scene.getUniqueId();\r\n this._engine = scene.getEngine();\r\n this._meshes = [];\r\n this._scene = scene;\r\n //Init vertex buffer cache\r\n this._vertexBuffers = {};\r\n this._indices = [];\r\n this._updatable = updatable;\r\n // vertexData\r\n if (vertexData) {\r\n this.setAllVerticesData(vertexData, updatable);\r\n }\r\n else {\r\n this._totalVertices = 0;\r\n this._indices = [];\r\n }\r\n if (this._engine.getCaps().vertexArrayObject) {\r\n this._vertexArrayObjects = {};\r\n }\r\n // applyToMesh\r\n if (mesh) {\r\n this.applyToMesh(mesh);\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n Object.defineProperty(Geometry.prototype, \"boundingBias\", {\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n get: function () {\r\n return this._boundingBias;\r\n },\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n set: function (value) {\r\n if (this._boundingBias) {\r\n this._boundingBias.copyFrom(value);\r\n }\r\n else {\r\n this._boundingBias = value.clone();\r\n }\r\n this._updateBoundingInfo(true, null);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Static function used to attach a new empty geometry to a mesh\r\n * @param mesh defines the mesh to attach the geometry to\r\n * @returns the new Geometry\r\n */\r\n Geometry.CreateGeometryForMesh = function (mesh) {\r\n var geometry = new Geometry(Geometry.RandomId(), mesh.getScene());\r\n geometry.applyToMesh(mesh);\r\n return geometry;\r\n };\r\n Object.defineProperty(Geometry.prototype, \"meshes\", {\r\n /** Get the list of meshes using this geometry */\r\n get: function () {\r\n return this._meshes;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Geometry.prototype, \"extend\", {\r\n /**\r\n * Gets the current extend of the geometry\r\n */\r\n get: function () {\r\n return this._extend;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the hosting scene\r\n * @returns the hosting Scene\r\n */\r\n Geometry.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /**\r\n * Gets the hosting engine\r\n * @returns the hosting Engine\r\n */\r\n Geometry.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * Defines if the geometry is ready to use\r\n * @returns true if the geometry is ready to be used\r\n */\r\n Geometry.prototype.isReady = function () {\r\n return this.delayLoadState === 1 || this.delayLoadState === 0;\r\n };\r\n Object.defineProperty(Geometry.prototype, \"doNotSerialize\", {\r\n /**\r\n * Gets a value indicating that the geometry should not be serialized\r\n */\r\n get: function () {\r\n for (var index = 0; index < this._meshes.length; index++) {\r\n if (!this._meshes[index].doNotSerialize) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Geometry.prototype._rebuild = function () {\r\n if (this._vertexArrayObjects) {\r\n this._vertexArrayObjects = {};\r\n }\r\n // Index buffer\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices);\r\n }\r\n // Vertex buffers\r\n for (var key in this._vertexBuffers) {\r\n var vertexBuffer = this._vertexBuffers[key];\r\n vertexBuffer._rebuild();\r\n }\r\n };\r\n /**\r\n * Affects all geometry data in one call\r\n * @param vertexData defines the geometry data\r\n * @param updatable defines if the geometry must be flagged as updatable (false as default)\r\n */\r\n Geometry.prototype.setAllVerticesData = function (vertexData, updatable) {\r\n vertexData.applyToGeometry(this, updatable);\r\n this.notifyUpdate();\r\n };\r\n /**\r\n * Set specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the vertex data to use\r\n * @param updatable defines if the vertex must be flagged as updatable (false as default)\r\n * @param stride defines the stride to use (0 by default). This value is deduced from the kind value if not specified\r\n */\r\n Geometry.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (updatable && Array.isArray(data)) {\r\n // to avoid converting to Float32Array at each draw call in engine.updateDynamicVertexBuffer, we make the conversion a single time here\r\n data = new Float32Array(data);\r\n }\r\n var buffer = new VertexBuffer(this._engine, data, kind, updatable, this._meshes.length === 0, stride);\r\n this.setVerticesBuffer(buffer);\r\n };\r\n /**\r\n * Removes a specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n */\r\n Geometry.prototype.removeVerticesData = function (kind) {\r\n if (this._vertexBuffers[kind]) {\r\n this._vertexBuffers[kind].dispose();\r\n delete this._vertexBuffers[kind];\r\n }\r\n };\r\n /**\r\n * Affect a vertex buffer to the geometry. the vertexBuffer.getKind() function is used to determine where to store the data\r\n * @param buffer defines the vertex buffer to use\r\n * @param totalVertices defines the total number of vertices for position kind (could be null)\r\n */\r\n Geometry.prototype.setVerticesBuffer = function (buffer, totalVertices) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n var kind = buffer.getKind();\r\n if (this._vertexBuffers[kind]) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n this._vertexBuffers[kind] = buffer;\r\n if (kind === VertexBuffer.PositionKind) {\r\n var data = buffer.getData();\r\n if (totalVertices != null) {\r\n this._totalVertices = totalVertices;\r\n }\r\n else {\r\n if (data != null) {\r\n this._totalVertices = data.length / (buffer.byteStride / 4);\r\n }\r\n }\r\n this._updateExtend(data);\r\n this._resetPointsArrayCache();\r\n var meshes = this._meshes;\r\n var numOfMeshes = meshes.length;\r\n for (var index = 0; index < numOfMeshes; index++) {\r\n var mesh = meshes[index];\r\n mesh._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);\r\n mesh._createGlobalSubMesh(false);\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n this.notifyUpdate(kind);\r\n if (this._vertexArrayObjects) {\r\n this._disposeVertexArrayObjects();\r\n this._vertexArrayObjects = {}; // Will trigger a rebuild of the VAO if supported\r\n }\r\n };\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will directly update the underlying DataBuffer according to the passed numeric array or Float32Array\r\n * It will do nothing if the buffer is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n Geometry.prototype.updateVerticesDataDirectly = function (kind, data, offset, useBytes) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n vertexBuffer.updateDirectly(data, offset, useBytes);\r\n this.notifyUpdate(kind);\r\n };\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will create a new buffer if the current one is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param updateExtends defines if the geometry extends must be recomputed (false by default)\r\n */\r\n Geometry.prototype.updateVerticesData = function (kind, data, updateExtends) {\r\n if (updateExtends === void 0) { updateExtends = false; }\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n vertexBuffer.update(data);\r\n if (kind === VertexBuffer.PositionKind) {\r\n this._updateBoundingInfo(updateExtends, data);\r\n }\r\n this.notifyUpdate(kind);\r\n };\r\n Geometry.prototype._updateBoundingInfo = function (updateExtends, data) {\r\n if (updateExtends) {\r\n this._updateExtend(data);\r\n }\r\n this._resetPointsArrayCache();\r\n if (updateExtends) {\r\n var meshes = this._meshes;\r\n for (var _i = 0, meshes_1 = meshes; _i < meshes_1.length; _i++) {\r\n var mesh = meshes_1[_i];\r\n if (mesh._boundingInfo) {\r\n mesh._boundingInfo.reConstruct(this._extend.minimum, this._extend.maximum);\r\n }\r\n else {\r\n mesh._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);\r\n }\r\n var subMeshes = mesh.subMeshes;\r\n for (var _a = 0, subMeshes_1 = subMeshes; _a < subMeshes_1.length; _a++) {\r\n var subMesh = subMeshes_1[_a];\r\n subMesh.refreshBoundingInfo();\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Geometry.prototype._bind = function (effect, indexToBind) {\r\n if (!effect) {\r\n return;\r\n }\r\n if (indexToBind === undefined) {\r\n indexToBind = this._indexBuffer;\r\n }\r\n var vbs = this.getVertexBuffers();\r\n if (!vbs) {\r\n return;\r\n }\r\n if (indexToBind != this._indexBuffer || !this._vertexArrayObjects) {\r\n this._engine.bindBuffers(vbs, indexToBind, effect);\r\n return;\r\n }\r\n // Using VAO\r\n if (!this._vertexArrayObjects[effect.key]) {\r\n this._vertexArrayObjects[effect.key] = this._engine.recordVertexArrayObject(vbs, indexToBind, effect);\r\n }\r\n this._engine.bindVertexArrayObject(this._vertexArrayObjects[effect.key], indexToBind);\r\n };\r\n /**\r\n * Gets total number of vertices\r\n * @returns the total number of vertices\r\n */\r\n Geometry.prototype.getTotalVertices = function () {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n return this._totalVertices;\r\n };\r\n /**\r\n * Gets a specific vertex data attached to this geometry. Float data is constructed if the vertex buffer data cannot be returned directly.\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns a float array containing vertex data\r\n */\r\n Geometry.prototype.getVerticesData = function (kind, copyWhenShared, forceCopy) {\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return null;\r\n }\r\n var data = vertexBuffer.getData();\r\n if (!data) {\r\n return null;\r\n }\r\n var tightlyPackedByteStride = vertexBuffer.getSize() * VertexBuffer.GetTypeByteLength(vertexBuffer.type);\r\n var count = this._totalVertices * vertexBuffer.getSize();\r\n if (vertexBuffer.type !== VertexBuffer.FLOAT || vertexBuffer.byteStride !== tightlyPackedByteStride) {\r\n var copy_1 = [];\r\n vertexBuffer.forEach(count, function (value) { return copy_1.push(value); });\r\n return copy_1;\r\n }\r\n if (!(data instanceof Array || data instanceof Float32Array) || vertexBuffer.byteOffset !== 0 || data.length !== count) {\r\n if (data instanceof Array) {\r\n var offset = vertexBuffer.byteOffset / 4;\r\n return Tools.Slice(data, offset, offset + count);\r\n }\r\n else if (data instanceof ArrayBuffer) {\r\n return new Float32Array(data, vertexBuffer.byteOffset, count);\r\n }\r\n else {\r\n var offset = data.byteOffset + vertexBuffer.byteOffset;\r\n if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {\r\n var result = new Float32Array(count);\r\n var source = new Float32Array(data.buffer, offset, count);\r\n result.set(source);\r\n return result;\r\n }\r\n // Portect against bad data\r\n var remainder = offset % 4;\r\n if (remainder) {\r\n offset = Math.max(0, offset - remainder);\r\n }\r\n return new Float32Array(data.buffer, offset, count);\r\n }\r\n }\r\n if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {\r\n return Tools.Slice(data);\r\n }\r\n return data;\r\n };\r\n /**\r\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if the vertex buffer with the specified kind is updatable\r\n */\r\n Geometry.prototype.isVertexBufferUpdatable = function (kind) {\r\n var vb = this._vertexBuffers[kind];\r\n if (!vb) {\r\n return false;\r\n }\r\n return vb.isUpdatable();\r\n };\r\n /**\r\n * Gets a specific vertex buffer\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns a VertexBuffer\r\n */\r\n Geometry.prototype.getVertexBuffer = function (kind) {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers[kind];\r\n };\r\n /**\r\n * Returns all vertex buffers\r\n * @return an object holding all vertex buffers indexed by kind\r\n */\r\n Geometry.prototype.getVertexBuffers = function () {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers;\r\n };\r\n /**\r\n * Gets a boolean indicating if specific vertex buffer is present\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if data is present\r\n */\r\n Geometry.prototype.isVerticesDataPresent = function (kind) {\r\n if (!this._vertexBuffers) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._vertexBuffers[kind] !== undefined;\r\n };\r\n /**\r\n * Gets a list of all attached data kinds (Position, normal, etc...)\r\n * @returns a list of string containing all kinds\r\n */\r\n Geometry.prototype.getVerticesDataKinds = function () {\r\n var result = [];\r\n var kind;\r\n if (!this._vertexBuffers && this._delayInfo) {\r\n for (kind in this._delayInfo) {\r\n result.push(kind);\r\n }\r\n }\r\n else {\r\n for (kind in this._vertexBuffers) {\r\n result.push(kind);\r\n }\r\n }\r\n return result;\r\n };\r\n /**\r\n * Update index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n */\r\n Geometry.prototype.updateIndices = function (indices, offset, gpuMemoryOnly) {\r\n if (gpuMemoryOnly === void 0) { gpuMemoryOnly = false; }\r\n if (!this._indexBuffer) {\r\n return;\r\n }\r\n if (!this._indexBufferIsUpdatable) {\r\n this.setIndices(indices, null, true);\r\n }\r\n else {\r\n var needToUpdateSubMeshes = indices.length !== this._indices.length;\r\n if (!gpuMemoryOnly) {\r\n this._indices = indices.slice();\r\n }\r\n this._engine.updateDynamicIndexBuffer(this._indexBuffer, indices, offset);\r\n if (needToUpdateSubMeshes) {\r\n for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._createGlobalSubMesh(true);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Creates a new index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param totalVertices defines the total number of vertices (could be null)\r\n * @param updatable defines if the index buffer must be flagged as updatable (false by default)\r\n */\r\n Geometry.prototype.setIndices = function (indices, totalVertices, updatable) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n this._disposeVertexArrayObjects();\r\n this._indices = indices;\r\n this._indexBufferIsUpdatable = updatable;\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, updatable);\r\n }\r\n if (totalVertices != undefined) {\r\n // including null and undefined\r\n this._totalVertices = totalVertices;\r\n }\r\n for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._createGlobalSubMesh(true);\r\n }\r\n this.notifyUpdate();\r\n };\r\n /**\r\n * Return the total number of indices\r\n * @returns the total number of indices\r\n */\r\n Geometry.prototype.getTotalIndices = function () {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n return this._indices.length;\r\n };\r\n /**\r\n * Gets the index buffer array\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns the index buffer array\r\n */\r\n Geometry.prototype.getIndices = function (copyWhenShared, forceCopy) {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n var orig = this._indices;\r\n if (!forceCopy && (!copyWhenShared || this._meshes.length === 1)) {\r\n return orig;\r\n }\r\n else {\r\n var len = orig.length;\r\n var copy = [];\r\n for (var i = 0; i < len; i++) {\r\n copy.push(orig[i]);\r\n }\r\n return copy;\r\n }\r\n };\r\n /**\r\n * Gets the index buffer\r\n * @return the index buffer\r\n */\r\n Geometry.prototype.getIndexBuffer = function () {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._indexBuffer;\r\n };\r\n /** @hidden */\r\n Geometry.prototype._releaseVertexArrayObject = function (effect) {\r\n if (effect === void 0) { effect = null; }\r\n if (!effect || !this._vertexArrayObjects) {\r\n return;\r\n }\r\n if (this._vertexArrayObjects[effect.key]) {\r\n this._engine.releaseVertexArrayObject(this._vertexArrayObjects[effect.key]);\r\n delete this._vertexArrayObjects[effect.key];\r\n }\r\n };\r\n /**\r\n * Release the associated resources for a specific mesh\r\n * @param mesh defines the source mesh\r\n * @param shouldDispose defines if the geometry must be disposed if there is no more mesh pointing to it\r\n */\r\n Geometry.prototype.releaseForMesh = function (mesh, shouldDispose) {\r\n var meshes = this._meshes;\r\n var index = meshes.indexOf(mesh);\r\n if (index === -1) {\r\n return;\r\n }\r\n meshes.splice(index, 1);\r\n mesh._geometry = null;\r\n if (meshes.length === 0 && shouldDispose) {\r\n this.dispose();\r\n }\r\n };\r\n /**\r\n * Apply current geometry to a given mesh\r\n * @param mesh defines the mesh to apply geometry to\r\n */\r\n Geometry.prototype.applyToMesh = function (mesh) {\r\n if (mesh._geometry === this) {\r\n return;\r\n }\r\n var previousGeometry = mesh._geometry;\r\n if (previousGeometry) {\r\n previousGeometry.releaseForMesh(mesh);\r\n }\r\n var meshes = this._meshes;\r\n // must be done before setting vertexBuffers because of mesh._createGlobalSubMesh()\r\n mesh._geometry = this;\r\n this._scene.pushGeometry(this);\r\n meshes.push(mesh);\r\n if (this.isReady()) {\r\n this._applyToMesh(mesh);\r\n }\r\n else {\r\n mesh._boundingInfo = this._boundingInfo;\r\n }\r\n };\r\n Geometry.prototype._updateExtend = function (data) {\r\n if (data === void 0) { data = null; }\r\n if (this.useBoundingInfoFromGeometry && this._boundingInfo) {\r\n this._extend = {\r\n minimum: this._boundingInfo.minimum.clone(),\r\n maximum: this._boundingInfo.maximum.clone(),\r\n };\r\n }\r\n else {\r\n if (!data) {\r\n data = this.getVerticesData(VertexBuffer.PositionKind);\r\n }\r\n this._extend = extractMinAndMax(data, 0, this._totalVertices, this.boundingBias, 3);\r\n }\r\n };\r\n Geometry.prototype._applyToMesh = function (mesh) {\r\n var numOfMeshes = this._meshes.length;\r\n // vertexBuffers\r\n for (var kind in this._vertexBuffers) {\r\n if (numOfMeshes === 1) {\r\n this._vertexBuffers[kind].create();\r\n }\r\n var buffer = this._vertexBuffers[kind].getBuffer();\r\n if (buffer) {\r\n buffer.references = numOfMeshes;\r\n }\r\n if (kind === VertexBuffer.PositionKind) {\r\n if (!this._extend) {\r\n this._updateExtend();\r\n }\r\n mesh._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);\r\n mesh._createGlobalSubMesh(false);\r\n //bounding info was just created again, world matrix should be applied again.\r\n mesh._updateBoundingInfo();\r\n }\r\n }\r\n // indexBuffer\r\n if (numOfMeshes === 1 && this._indices && this._indices.length > 0) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices);\r\n }\r\n if (this._indexBuffer) {\r\n this._indexBuffer.references = numOfMeshes;\r\n }\r\n // morphTargets\r\n mesh._syncGeometryWithMorphTargetManager();\r\n // instances\r\n mesh.synchronizeInstances();\r\n };\r\n Geometry.prototype.notifyUpdate = function (kind) {\r\n if (this.onGeometryUpdated) {\r\n this.onGeometryUpdated(this, kind);\r\n }\r\n for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._markSubMeshesAsAttributesDirty();\r\n }\r\n };\r\n /**\r\n * Load the geometry if it was flagged as delay loaded\r\n * @param scene defines the hosting scene\r\n * @param onLoaded defines a callback called when the geometry is loaded\r\n */\r\n Geometry.prototype.load = function (scene, onLoaded) {\r\n if (this.delayLoadState === 2) {\r\n return;\r\n }\r\n if (this.isReady()) {\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n return;\r\n }\r\n this.delayLoadState = 2;\r\n this._queueLoad(scene, onLoaded);\r\n };\r\n Geometry.prototype._queueLoad = function (scene, onLoaded) {\r\n var _this = this;\r\n if (!this.delayLoadingFile) {\r\n return;\r\n }\r\n scene._addPendingData(this);\r\n scene._loadFile(this.delayLoadingFile, function (data) {\r\n if (!_this._delayLoadingFunction) {\r\n return;\r\n }\r\n _this._delayLoadingFunction(JSON.parse(data), _this);\r\n _this.delayLoadState = 1;\r\n _this._delayInfo = [];\r\n scene._removePendingData(_this);\r\n var meshes = _this._meshes;\r\n var numOfMeshes = meshes.length;\r\n for (var index = 0; index < numOfMeshes; index++) {\r\n _this._applyToMesh(meshes[index]);\r\n }\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n }, undefined, true);\r\n };\r\n /**\r\n * Invert the geometry to move from a right handed system to a left handed one.\r\n */\r\n Geometry.prototype.toLeftHanded = function () {\r\n // Flip faces\r\n var tIndices = this.getIndices(false);\r\n if (tIndices != null && tIndices.length > 0) {\r\n for (var i = 0; i < tIndices.length; i += 3) {\r\n var tTemp = tIndices[i + 0];\r\n tIndices[i + 0] = tIndices[i + 2];\r\n tIndices[i + 2] = tTemp;\r\n }\r\n this.setIndices(tIndices);\r\n }\r\n // Negate position.z\r\n var tPositions = this.getVerticesData(VertexBuffer.PositionKind, false);\r\n if (tPositions != null && tPositions.length > 0) {\r\n for (var i = 0; i < tPositions.length; i += 3) {\r\n tPositions[i + 2] = -tPositions[i + 2];\r\n }\r\n this.setVerticesData(VertexBuffer.PositionKind, tPositions, false);\r\n }\r\n // Negate normal.z\r\n var tNormals = this.getVerticesData(VertexBuffer.NormalKind, false);\r\n if (tNormals != null && tNormals.length > 0) {\r\n for (var i = 0; i < tNormals.length; i += 3) {\r\n tNormals[i + 2] = -tNormals[i + 2];\r\n }\r\n this.setVerticesData(VertexBuffer.NormalKind, tNormals, false);\r\n }\r\n };\r\n // Cache\r\n /** @hidden */\r\n Geometry.prototype._resetPointsArrayCache = function () {\r\n this._positions = null;\r\n };\r\n /** @hidden */\r\n Geometry.prototype._generatePointsArray = function () {\r\n if (this._positions) {\r\n return true;\r\n }\r\n var data = this.getVerticesData(VertexBuffer.PositionKind);\r\n if (!data || data.length === 0) {\r\n return false;\r\n }\r\n for (var index = this._positionsCache.length * 3, arrayIdx = this._positionsCache.length; index < data.length; index += 3, ++arrayIdx) {\r\n this._positionsCache[arrayIdx] = Vector3.FromArray(data, index);\r\n }\r\n for (var index = 0, arrayIdx = 0; index < data.length; index += 3, ++arrayIdx) {\r\n this._positionsCache[arrayIdx].set(data[0 + index], data[1 + index], data[2 + index]);\r\n }\r\n // just in case the number of positions was reduced, splice the array\r\n this._positionsCache.length = data.length / 3;\r\n this._positions = this._positionsCache;\r\n return true;\r\n };\r\n /**\r\n * Gets a value indicating if the geometry is disposed\r\n * @returns true if the geometry was disposed\r\n */\r\n Geometry.prototype.isDisposed = function () {\r\n return this._isDisposed;\r\n };\r\n Geometry.prototype._disposeVertexArrayObjects = function () {\r\n if (this._vertexArrayObjects) {\r\n for (var kind in this._vertexArrayObjects) {\r\n this._engine.releaseVertexArrayObject(this._vertexArrayObjects[kind]);\r\n }\r\n this._vertexArrayObjects = {};\r\n }\r\n };\r\n /**\r\n * Free all associated resources\r\n */\r\n Geometry.prototype.dispose = function () {\r\n var meshes = this._meshes;\r\n var numOfMeshes = meshes.length;\r\n var index;\r\n for (index = 0; index < numOfMeshes; index++) {\r\n this.releaseForMesh(meshes[index]);\r\n }\r\n this._meshes = [];\r\n this._disposeVertexArrayObjects();\r\n for (var kind in this._vertexBuffers) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n this._vertexBuffers = {};\r\n this._totalVertices = 0;\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n this._indexBuffer = null;\r\n this._indices = [];\r\n this.delayLoadState = 0;\r\n this.delayLoadingFile = null;\r\n this._delayLoadingFunction = null;\r\n this._delayInfo = [];\r\n this._boundingInfo = null;\r\n this._scene.removeGeometry(this);\r\n this._isDisposed = true;\r\n };\r\n /**\r\n * Clone the current geometry into a new geometry\r\n * @param id defines the unique ID of the new geometry\r\n * @returns a new geometry object\r\n */\r\n Geometry.prototype.copy = function (id) {\r\n var vertexData = new VertexData();\r\n vertexData.indices = [];\r\n var indices = this.getIndices();\r\n if (indices) {\r\n for (var index = 0; index < indices.length; index++) {\r\n vertexData.indices.push(indices[index]);\r\n }\r\n }\r\n var updatable = false;\r\n var stopChecking = false;\r\n var kind;\r\n for (kind in this._vertexBuffers) {\r\n // using slice() to make a copy of the array and not just reference it\r\n var data = this.getVerticesData(kind);\r\n if (data) {\r\n if (data instanceof Float32Array) {\r\n vertexData.set(new Float32Array(data), kind);\r\n }\r\n else {\r\n vertexData.set(data.slice(0), kind);\r\n }\r\n if (!stopChecking) {\r\n var vb = this.getVertexBuffer(kind);\r\n if (vb) {\r\n updatable = vb.isUpdatable();\r\n stopChecking = !updatable;\r\n }\r\n }\r\n }\r\n }\r\n var geometry = new Geometry(id, this._scene, vertexData, updatable);\r\n geometry.delayLoadState = this.delayLoadState;\r\n geometry.delayLoadingFile = this.delayLoadingFile;\r\n geometry._delayLoadingFunction = this._delayLoadingFunction;\r\n for (kind in this._delayInfo) {\r\n geometry._delayInfo = geometry._delayInfo || [];\r\n geometry._delayInfo.push(kind);\r\n }\r\n // Bounding info\r\n geometry._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);\r\n return geometry;\r\n };\r\n /**\r\n * Serialize the current geometry info (and not the vertices data) into a JSON object\r\n * @return a JSON representation of the current geometry data (without the vertices data)\r\n */\r\n Geometry.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.id = this.id;\r\n serializationObject.updatable = this._updatable;\r\n if (Tags && Tags.HasTags(this)) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n return serializationObject;\r\n };\r\n Geometry.prototype.toNumberArray = function (origin) {\r\n if (Array.isArray(origin)) {\r\n return origin;\r\n }\r\n else {\r\n return Array.prototype.slice.call(origin);\r\n }\r\n };\r\n /**\r\n * Serialize all vertices data into a JSON oject\r\n * @returns a JSON representation of the current geometry data\r\n */\r\n Geometry.prototype.serializeVerticeData = function () {\r\n var serializationObject = this.serialize();\r\n if (this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\r\n serializationObject.positions = this.toNumberArray(this.getVerticesData(VertexBuffer.PositionKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.PositionKind)) {\r\n serializationObject.positions._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n serializationObject.normals = this.toNumberArray(this.getVerticesData(VertexBuffer.NormalKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.NormalKind)) {\r\n serializationObject.normals._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.TangentKind)) {\r\n serializationObject.tangets = this.toNumberArray(this.getVerticesData(VertexBuffer.TangentKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.TangentKind)) {\r\n serializationObject.tangets._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n serializationObject.uvs = this.toNumberArray(this.getVerticesData(VertexBuffer.UVKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UVKind)) {\r\n serializationObject.uvs._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\r\n serializationObject.uv2s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV2Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV2Kind)) {\r\n serializationObject.uv2s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.UV3Kind)) {\r\n serializationObject.uv3s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV3Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV3Kind)) {\r\n serializationObject.uv3s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.UV4Kind)) {\r\n serializationObject.uv4s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV4Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV4Kind)) {\r\n serializationObject.uv4s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.UV5Kind)) {\r\n serializationObject.uv5s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV5Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV5Kind)) {\r\n serializationObject.uv5s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.UV6Kind)) {\r\n serializationObject.uv6s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV6Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV6Kind)) {\r\n serializationObject.uv6s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.ColorKind)) {\r\n serializationObject.colors = this.toNumberArray(this.getVerticesData(VertexBuffer.ColorKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.ColorKind)) {\r\n serializationObject.colors._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\r\n serializationObject.matricesIndices = this.toNumberArray(this.getVerticesData(VertexBuffer.MatricesIndicesKind));\r\n serializationObject.matricesIndices._isExpanded = true;\r\n if (this.isVertexBufferUpdatable(VertexBuffer.MatricesIndicesKind)) {\r\n serializationObject.matricesIndices._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\r\n serializationObject.matricesWeights = this.toNumberArray(this.getVerticesData(VertexBuffer.MatricesWeightsKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.MatricesWeightsKind)) {\r\n serializationObject.matricesWeights._updatable = true;\r\n }\r\n }\r\n serializationObject.indices = this.toNumberArray(this.getIndices());\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Extracts a clone of a mesh geometry\r\n * @param mesh defines the source mesh\r\n * @param id defines the unique ID of the new geometry object\r\n * @returns the new geometry object\r\n */\r\n Geometry.ExtractFromMesh = function (mesh, id) {\r\n var geometry = mesh._geometry;\r\n if (!geometry) {\r\n return null;\r\n }\r\n return geometry.copy(id);\r\n };\r\n /**\r\n * You should now use Tools.RandomId(), this method is still here for legacy reasons.\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a string containing a new GUID\r\n */\r\n Geometry.RandomId = function () {\r\n return Tools.RandomId();\r\n };\r\n /** @hidden */\r\n Geometry._ImportGeometry = function (parsedGeometry, mesh) {\r\n var scene = mesh.getScene();\r\n // Geometry\r\n var geometryId = parsedGeometry.geometryId;\r\n if (geometryId) {\r\n var geometry = scene.getGeometryByID(geometryId);\r\n if (geometry) {\r\n geometry.applyToMesh(mesh);\r\n }\r\n }\r\n else if (parsedGeometry instanceof ArrayBuffer) {\r\n var binaryInfo = mesh._binaryInfo;\r\n if (binaryInfo.positionsAttrDesc && binaryInfo.positionsAttrDesc.count > 0) {\r\n var positionsData = new Float32Array(parsedGeometry, binaryInfo.positionsAttrDesc.offset, binaryInfo.positionsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.PositionKind, positionsData, false);\r\n }\r\n if (binaryInfo.normalsAttrDesc && binaryInfo.normalsAttrDesc.count > 0) {\r\n var normalsData = new Float32Array(parsedGeometry, binaryInfo.normalsAttrDesc.offset, binaryInfo.normalsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.NormalKind, normalsData, false);\r\n }\r\n if (binaryInfo.tangetsAttrDesc && binaryInfo.tangetsAttrDesc.count > 0) {\r\n var tangentsData = new Float32Array(parsedGeometry, binaryInfo.tangetsAttrDesc.offset, binaryInfo.tangetsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.TangentKind, tangentsData, false);\r\n }\r\n if (binaryInfo.uvsAttrDesc && binaryInfo.uvsAttrDesc.count > 0) {\r\n var uvsData = new Float32Array(parsedGeometry, binaryInfo.uvsAttrDesc.offset, binaryInfo.uvsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.UVKind, uvsData, false);\r\n }\r\n if (binaryInfo.uvs2AttrDesc && binaryInfo.uvs2AttrDesc.count > 0) {\r\n var uvs2Data = new Float32Array(parsedGeometry, binaryInfo.uvs2AttrDesc.offset, binaryInfo.uvs2AttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.UV2Kind, uvs2Data, false);\r\n }\r\n if (binaryInfo.uvs3AttrDesc && binaryInfo.uvs3AttrDesc.count > 0) {\r\n var uvs3Data = new Float32Array(parsedGeometry, binaryInfo.uvs3AttrDesc.offset, binaryInfo.uvs3AttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.UV3Kind, uvs3Data, false);\r\n }\r\n if (binaryInfo.uvs4AttrDesc && binaryInfo.uvs4AttrDesc.count > 0) {\r\n var uvs4Data = new Float32Array(parsedGeometry, binaryInfo.uvs4AttrDesc.offset, binaryInfo.uvs4AttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.UV4Kind, uvs4Data, false);\r\n }\r\n if (binaryInfo.uvs5AttrDesc && binaryInfo.uvs5AttrDesc.count > 0) {\r\n var uvs5Data = new Float32Array(parsedGeometry, binaryInfo.uvs5AttrDesc.offset, binaryInfo.uvs5AttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.UV5Kind, uvs5Data, false);\r\n }\r\n if (binaryInfo.uvs6AttrDesc && binaryInfo.uvs6AttrDesc.count > 0) {\r\n var uvs6Data = new Float32Array(parsedGeometry, binaryInfo.uvs6AttrDesc.offset, binaryInfo.uvs6AttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.UV6Kind, uvs6Data, false);\r\n }\r\n if (binaryInfo.colorsAttrDesc && binaryInfo.colorsAttrDesc.count > 0) {\r\n var colorsData = new Float32Array(parsedGeometry, binaryInfo.colorsAttrDesc.offset, binaryInfo.colorsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.ColorKind, colorsData, false, binaryInfo.colorsAttrDesc.stride);\r\n }\r\n if (binaryInfo.matricesIndicesAttrDesc && binaryInfo.matricesIndicesAttrDesc.count > 0) {\r\n var matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesAttrDesc.offset, binaryInfo.matricesIndicesAttrDesc.count);\r\n var floatIndices = [];\r\n for (var i = 0; i < matricesIndicesData.length; i++) {\r\n var index = matricesIndicesData[i];\r\n floatIndices.push(index & 0x000000ff);\r\n floatIndices.push((index & 0x0000ff00) >> 8);\r\n floatIndices.push((index & 0x00ff0000) >> 16);\r\n floatIndices.push((index >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, false);\r\n }\r\n if (binaryInfo.matricesIndicesExtraAttrDesc && binaryInfo.matricesIndicesExtraAttrDesc.count > 0) {\r\n var matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesExtraAttrDesc.offset, binaryInfo.matricesIndicesExtraAttrDesc.count);\r\n var floatIndices = [];\r\n for (var i = 0; i < matricesIndicesData.length; i++) {\r\n var index = matricesIndicesData[i];\r\n floatIndices.push(index & 0x000000ff);\r\n floatIndices.push((index & 0x0000ff00) >> 8);\r\n floatIndices.push((index & 0x00ff0000) >> 16);\r\n floatIndices.push((index >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, floatIndices, false);\r\n }\r\n if (binaryInfo.matricesWeightsAttrDesc && binaryInfo.matricesWeightsAttrDesc.count > 0) {\r\n var matricesWeightsData = new Float32Array(parsedGeometry, binaryInfo.matricesWeightsAttrDesc.offset, binaryInfo.matricesWeightsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeightsData, false);\r\n }\r\n if (binaryInfo.indicesAttrDesc && binaryInfo.indicesAttrDesc.count > 0) {\r\n var indicesData = new Int32Array(parsedGeometry, binaryInfo.indicesAttrDesc.offset, binaryInfo.indicesAttrDesc.count);\r\n mesh.setIndices(indicesData, null);\r\n }\r\n if (binaryInfo.subMeshesAttrDesc && binaryInfo.subMeshesAttrDesc.count > 0) {\r\n var subMeshesData = new Int32Array(parsedGeometry, binaryInfo.subMeshesAttrDesc.offset, binaryInfo.subMeshesAttrDesc.count * 5);\r\n mesh.subMeshes = [];\r\n for (var i = 0; i < binaryInfo.subMeshesAttrDesc.count; i++) {\r\n var materialIndex = subMeshesData[i * 5 + 0];\r\n var verticesStart = subMeshesData[i * 5 + 1];\r\n var verticesCount = subMeshesData[i * 5 + 2];\r\n var indexStart = subMeshesData[i * 5 + 3];\r\n var indexCount = subMeshesData[i * 5 + 4];\r\n SubMesh.AddToMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh);\r\n }\r\n }\r\n }\r\n else if (parsedGeometry.positions && parsedGeometry.normals && parsedGeometry.indices) {\r\n mesh.setVerticesData(VertexBuffer.PositionKind, parsedGeometry.positions, parsedGeometry.positions._updatable);\r\n mesh.setVerticesData(VertexBuffer.NormalKind, parsedGeometry.normals, parsedGeometry.normals._updatable);\r\n if (parsedGeometry.tangents) {\r\n mesh.setVerticesData(VertexBuffer.TangentKind, parsedGeometry.tangents, parsedGeometry.tangents._updatable);\r\n }\r\n if (parsedGeometry.uvs) {\r\n mesh.setVerticesData(VertexBuffer.UVKind, parsedGeometry.uvs, parsedGeometry.uvs._updatable);\r\n }\r\n if (parsedGeometry.uvs2) {\r\n mesh.setVerticesData(VertexBuffer.UV2Kind, parsedGeometry.uvs2, parsedGeometry.uvs2._updatable);\r\n }\r\n if (parsedGeometry.uvs3) {\r\n mesh.setVerticesData(VertexBuffer.UV3Kind, parsedGeometry.uvs3, parsedGeometry.uvs3._updatable);\r\n }\r\n if (parsedGeometry.uvs4) {\r\n mesh.setVerticesData(VertexBuffer.UV4Kind, parsedGeometry.uvs4, parsedGeometry.uvs4._updatable);\r\n }\r\n if (parsedGeometry.uvs5) {\r\n mesh.setVerticesData(VertexBuffer.UV5Kind, parsedGeometry.uvs5, parsedGeometry.uvs5._updatable);\r\n }\r\n if (parsedGeometry.uvs6) {\r\n mesh.setVerticesData(VertexBuffer.UV6Kind, parsedGeometry.uvs6, parsedGeometry.uvs6._updatable);\r\n }\r\n if (parsedGeometry.colors) {\r\n mesh.setVerticesData(VertexBuffer.ColorKind, Color4.CheckColors4(parsedGeometry.colors, parsedGeometry.positions.length / 3), parsedGeometry.colors._updatable);\r\n }\r\n if (parsedGeometry.matricesIndices) {\r\n if (!parsedGeometry.matricesIndices._isExpanded) {\r\n var floatIndices = [];\r\n for (var i = 0; i < parsedGeometry.matricesIndices.length; i++) {\r\n var matricesIndex = parsedGeometry.matricesIndices[i];\r\n floatIndices.push(matricesIndex & 0x000000ff);\r\n floatIndices.push((matricesIndex & 0x0000ff00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00ff0000) >> 16);\r\n floatIndices.push((matricesIndex >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, parsedGeometry.matricesIndices._updatable);\r\n }\r\n else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, parsedGeometry.matricesIndices, parsedGeometry.matricesIndices._updatable);\r\n }\r\n }\r\n if (parsedGeometry.matricesIndicesExtra) {\r\n if (!parsedGeometry.matricesIndicesExtra._isExpanded) {\r\n var floatIndices = [];\r\n for (var i = 0; i < parsedGeometry.matricesIndicesExtra.length; i++) {\r\n var matricesIndex = parsedGeometry.matricesIndicesExtra[i];\r\n floatIndices.push(matricesIndex & 0x000000ff);\r\n floatIndices.push((matricesIndex & 0x0000ff00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00ff0000) >> 16);\r\n floatIndices.push((matricesIndex >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, floatIndices, parsedGeometry.matricesIndicesExtra._updatable);\r\n }\r\n else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, parsedGeometry.matricesIndicesExtra, parsedGeometry.matricesIndicesExtra._updatable);\r\n }\r\n }\r\n if (parsedGeometry.matricesWeights) {\r\n Geometry._CleanMatricesWeights(parsedGeometry, mesh);\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, parsedGeometry.matricesWeights, parsedGeometry.matricesWeights._updatable);\r\n }\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsExtraKind, parsedGeometry.matricesWeightsExtra, parsedGeometry.matricesWeights._updatable);\r\n }\r\n mesh.setIndices(parsedGeometry.indices, null);\r\n }\r\n // SubMeshes\r\n if (parsedGeometry.subMeshes) {\r\n mesh.subMeshes = [];\r\n for (var subIndex = 0; subIndex < parsedGeometry.subMeshes.length; subIndex++) {\r\n var parsedSubMesh = parsedGeometry.subMeshes[subIndex];\r\n SubMesh.AddToMesh(parsedSubMesh.materialIndex, parsedSubMesh.verticesStart, parsedSubMesh.verticesCount, parsedSubMesh.indexStart, parsedSubMesh.indexCount, mesh);\r\n }\r\n }\r\n // Flat shading\r\n if (mesh._shouldGenerateFlatShading) {\r\n mesh.convertToFlatShadedMesh();\r\n mesh._shouldGenerateFlatShading = false;\r\n }\r\n // Update\r\n mesh.computeWorldMatrix(true);\r\n scene.onMeshImportedObservable.notifyObservers(mesh);\r\n };\r\n Geometry._CleanMatricesWeights = function (parsedGeometry, mesh) {\r\n var epsilon = 1e-3;\r\n if (!SceneLoaderFlags.CleanBoneMatrixWeights) {\r\n return;\r\n }\r\n var noInfluenceBoneIndex = 0.0;\r\n if (parsedGeometry.skeletonId > -1) {\r\n var skeleton = mesh.getScene().getLastSkeletonByID(parsedGeometry.skeletonId);\r\n if (!skeleton) {\r\n return;\r\n }\r\n noInfluenceBoneIndex = skeleton.bones.length;\r\n }\r\n else {\r\n return;\r\n }\r\n var matricesIndices = mesh.getVerticesData(VertexBuffer.MatricesIndicesKind);\r\n var matricesIndicesExtra = mesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind);\r\n var matricesWeights = parsedGeometry.matricesWeights;\r\n var matricesWeightsExtra = parsedGeometry.matricesWeightsExtra;\r\n var influencers = parsedGeometry.numBoneInfluencer;\r\n var size = matricesWeights.length;\r\n for (var i = 0; i < size; i += 4) {\r\n var weight = 0.0;\r\n var firstZeroWeight = -1;\r\n for (var j = 0; j < 4; j++) {\r\n var w = matricesWeights[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j;\r\n }\r\n }\r\n if (matricesWeightsExtra) {\r\n for (var j = 0; j < 4; j++) {\r\n var w = matricesWeightsExtra[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j + 4;\r\n }\r\n }\r\n }\r\n if (firstZeroWeight < 0 || firstZeroWeight > influencers - 1) {\r\n firstZeroWeight = influencers - 1;\r\n }\r\n if (weight > epsilon) {\r\n var mweight = 1.0 / weight;\r\n for (var j = 0; j < 4; j++) {\r\n matricesWeights[i + j] *= mweight;\r\n }\r\n if (matricesWeightsExtra) {\r\n for (var j = 0; j < 4; j++) {\r\n matricesWeightsExtra[i + j] *= mweight;\r\n }\r\n }\r\n }\r\n else {\r\n if (firstZeroWeight >= 4) {\r\n matricesWeightsExtra[i + firstZeroWeight - 4] = 1.0 - weight;\r\n matricesIndicesExtra[i + firstZeroWeight - 4] = noInfluenceBoneIndex;\r\n }\r\n else {\r\n matricesWeights[i + firstZeroWeight] = 1.0 - weight;\r\n matricesIndices[i + firstZeroWeight] = noInfluenceBoneIndex;\r\n }\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, matricesIndices);\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, matricesIndicesExtra);\r\n }\r\n };\r\n /**\r\n * Create a new geometry from persisted data (Using .babylon file format)\r\n * @param parsedVertexData defines the persisted data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url to use to load assets (like delayed data)\r\n * @returns the new geometry object\r\n */\r\n Geometry.Parse = function (parsedVertexData, scene, rootUrl) {\r\n if (scene.getGeometryByID(parsedVertexData.id)) {\r\n return null; // null since geometry could be something else than a box...\r\n }\r\n var geometry = new Geometry(parsedVertexData.id, scene, undefined, parsedVertexData.updatable);\r\n if (Tags) {\r\n Tags.AddTagsTo(geometry, parsedVertexData.tags);\r\n }\r\n if (parsedVertexData.delayLoadingFile) {\r\n geometry.delayLoadState = 4;\r\n geometry.delayLoadingFile = rootUrl + parsedVertexData.delayLoadingFile;\r\n geometry._boundingInfo = new BoundingInfo(Vector3.FromArray(parsedVertexData.boundingBoxMinimum), Vector3.FromArray(parsedVertexData.boundingBoxMaximum));\r\n geometry._delayInfo = [];\r\n if (parsedVertexData.hasUVs) {\r\n geometry._delayInfo.push(VertexBuffer.UVKind);\r\n }\r\n if (parsedVertexData.hasUVs2) {\r\n geometry._delayInfo.push(VertexBuffer.UV2Kind);\r\n }\r\n if (parsedVertexData.hasUVs3) {\r\n geometry._delayInfo.push(VertexBuffer.UV3Kind);\r\n }\r\n if (parsedVertexData.hasUVs4) {\r\n geometry._delayInfo.push(VertexBuffer.UV4Kind);\r\n }\r\n if (parsedVertexData.hasUVs5) {\r\n geometry._delayInfo.push(VertexBuffer.UV5Kind);\r\n }\r\n if (parsedVertexData.hasUVs6) {\r\n geometry._delayInfo.push(VertexBuffer.UV6Kind);\r\n }\r\n if (parsedVertexData.hasColors) {\r\n geometry._delayInfo.push(VertexBuffer.ColorKind);\r\n }\r\n if (parsedVertexData.hasMatricesIndices) {\r\n geometry._delayInfo.push(VertexBuffer.MatricesIndicesKind);\r\n }\r\n if (parsedVertexData.hasMatricesWeights) {\r\n geometry._delayInfo.push(VertexBuffer.MatricesWeightsKind);\r\n }\r\n geometry._delayLoadingFunction = VertexData.ImportVertexData;\r\n }\r\n else {\r\n VertexData.ImportVertexData(parsedVertexData, geometry);\r\n }\r\n scene.pushGeometry(geometry, true);\r\n return geometry;\r\n };\r\n return Geometry;\r\n}());\r\nexport { Geometry };\r\n//# sourceMappingURL=geometry.js.map","/**\r\n * Class used to represent a specific level of detail of a mesh\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n */\r\nvar MeshLODLevel = /** @class */ (function () {\r\n /**\r\n * Creates a new LOD level\r\n * @param distance defines the distance where this level should star being displayed\r\n * @param mesh defines the mesh to use to render this level\r\n */\r\n function MeshLODLevel(\r\n /** Defines the distance where this level should start being displayed */\r\n distance, \r\n /** Defines the mesh to use to render this level */\r\n mesh) {\r\n this.distance = distance;\r\n this.mesh = mesh;\r\n }\r\n return MeshLODLevel;\r\n}());\r\nexport { MeshLODLevel };\r\n//# sourceMappingURL=meshLODLevel.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Tools, AsyncLoop } from \"../Misc/tools\";\r\nimport { DeepCopier } from \"../Misc/deepCopier\";\r\nimport { Tags } from \"../Misc/tags\";\r\nimport { Quaternion, Matrix, Vector3, Vector2 } from \"../Maths/math.vector\";\r\nimport { Color3 } from '../Maths/math.color';\r\nimport { Node } from \"../node\";\r\nimport { VertexBuffer } from \"./buffer\";\r\nimport { VertexData } from \"./mesh.vertexData\";\r\nimport { Buffer } from \"./buffer\";\r\nimport { Geometry } from \"./geometry\";\r\nimport { AbstractMesh } from \"./abstractMesh\";\r\nimport { SubMesh } from \"./subMesh\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { Material } from \"../Materials/material\";\r\nimport { MultiMaterial } from \"../Materials/multiMaterial\";\r\nimport { SceneLoaderFlags } from \"../Loading/sceneLoaderFlags\";\r\nimport { SerializationHelper } from \"../Misc/decorators\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { _TypeStore } from '../Misc/typeStore';\r\nimport { _DevTools } from '../Misc/devTools';\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { MeshLODLevel } from './meshLODLevel';\r\nimport { CanvasGenerator } from '../Misc/canvasGenerator';\r\n/**\r\n * @hidden\r\n **/\r\nvar _CreationDataStorage = /** @class */ (function () {\r\n function _CreationDataStorage() {\r\n }\r\n return _CreationDataStorage;\r\n}());\r\nexport { _CreationDataStorage };\r\n/**\r\n * @hidden\r\n **/\r\nvar _InstanceDataStorage = /** @class */ (function () {\r\n function _InstanceDataStorage() {\r\n this.visibleInstances = {};\r\n this.batchCache = new _InstancesBatch();\r\n this.instancesBufferSize = 32 * 16 * 4; // let's start with a maximum of 32 instances\r\n }\r\n return _InstanceDataStorage;\r\n}());\r\n/**\r\n * @hidden\r\n **/\r\nvar _InstancesBatch = /** @class */ (function () {\r\n function _InstancesBatch() {\r\n this.mustReturn = false;\r\n this.visibleInstances = new Array();\r\n this.renderSelf = new Array();\r\n this.hardwareInstancedRendering = new Array();\r\n }\r\n return _InstancesBatch;\r\n}());\r\nexport { _InstancesBatch };\r\n/**\r\n * @hidden\r\n **/\r\nvar _ThinInstanceDataStorage = /** @class */ (function () {\r\n function _ThinInstanceDataStorage() {\r\n this.instancesCount = 0;\r\n this.matrixBuffer = null;\r\n this.matrixBufferSize = 32 * 16; // let's start with a maximum of 32 thin instances\r\n this.boundingVectors = [];\r\n this.worldMatrices = null;\r\n }\r\n return _ThinInstanceDataStorage;\r\n}());\r\n/**\r\n * @hidden\r\n **/\r\nvar _InternalMeshDataInfo = /** @class */ (function () {\r\n function _InternalMeshDataInfo() {\r\n this._areNormalsFrozen = false; // Will be used by ribbons mainly\r\n // Will be used to save a source mesh reference, If any\r\n this._source = null;\r\n // Will be used to for fast cloned mesh lookup\r\n this.meshMap = null;\r\n this._preActivateId = -1;\r\n this._LODLevels = new Array();\r\n // Morph\r\n this._morphTargetManager = null;\r\n }\r\n return _InternalMeshDataInfo;\r\n}());\r\n/**\r\n * Class used to represent renderable models\r\n */\r\nvar Mesh = /** @class */ (function (_super) {\r\n __extends(Mesh, _super);\r\n /**\r\n * @constructor\r\n * @param name The value used by scene.getMeshByName() to do a lookup.\r\n * @param scene The scene to add this mesh to.\r\n * @param parent The parent of this mesh, if it has one\r\n * @param source An optional Mesh from which geometry is shared, cloned.\r\n * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.\r\n * When false, achieved by calling a clone(), also passing False.\r\n * This will make creation of children, recursive.\r\n * @param clonePhysicsImpostor When cloning, include cloning mesh physics impostor, default True.\r\n */\r\n function Mesh(name, scene, parent, source, doNotCloneChildren, clonePhysicsImpostor) {\r\n if (scene === void 0) { scene = null; }\r\n if (parent === void 0) { parent = null; }\r\n if (source === void 0) { source = null; }\r\n if (clonePhysicsImpostor === void 0) { clonePhysicsImpostor = true; }\r\n var _this = _super.call(this, name, scene) || this;\r\n // Internal data\r\n _this._internalMeshDataInfo = new _InternalMeshDataInfo();\r\n // Members\r\n /**\r\n * Gets the delay loading state of the mesh (when delay loading is turned on)\r\n * @see https://doc.babylonjs.com/how_to/using_the_incremental_loading_system\r\n */\r\n _this.delayLoadState = 0;\r\n /**\r\n * Gets the list of instances created from this mesh\r\n * it is not supposed to be modified manually.\r\n * Note also that the order of the InstancedMesh wihin the array is not significant and might change.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_instances\r\n */\r\n _this.instances = new Array();\r\n // Private\r\n /** @hidden */\r\n _this._creationDataStorage = null;\r\n /** @hidden */\r\n _this._geometry = null;\r\n /** @hidden */\r\n _this._instanceDataStorage = new _InstanceDataStorage();\r\n /** @hidden */\r\n _this._thinInstanceDataStorage = new _ThinInstanceDataStorage();\r\n _this._effectiveMaterial = null;\r\n /** @hidden */\r\n _this._shouldGenerateFlatShading = false;\r\n // Use by builder only to know what orientation were the mesh build in.\r\n /** @hidden */\r\n _this._originalBuilderSideOrientation = Mesh.DEFAULTSIDE;\r\n /**\r\n * Use this property to change the original side orientation defined at construction time\r\n */\r\n _this.overrideMaterialSideOrientation = null;\r\n scene = _this.getScene();\r\n if (source) {\r\n // Geometry\r\n if (source._geometry) {\r\n source._geometry.applyToMesh(_this);\r\n }\r\n // Deep copy\r\n DeepCopier.DeepCopy(source, _this, [\r\n \"name\", \"material\", \"skeleton\", \"instances\", \"parent\", \"uniqueId\", \"source\", \"metadata\", \"morphTargetManager\",\r\n \"hasInstances\", \"source\", \"worldMatrixInstancedBuffer\", \"hasLODLevels\", \"geometry\", \"isBlocked\", \"areNormalsFrozen\",\r\n \"facetNb\", \"isFacetDataEnabled\", \"lightSources\", \"useBones\", \"isAnInstance\", \"collider\", \"edgesRenderer\", \"forward\",\r\n \"up\", \"right\", \"absolutePosition\", \"absoluteScaling\", \"absoluteRotationQuaternion\", \"isWorldMatrixFrozen\",\r\n \"nonUniformScaling\", \"behaviors\", \"worldMatrixFromCache\", \"hasThinInstances\", \"cloneMeshMap\"\r\n ], [\"_poseMatrix\"]);\r\n // Source mesh\r\n _this._internalMeshDataInfo._source = source;\r\n if (scene.useClonedMeshMap) {\r\n if (!source._internalMeshDataInfo.meshMap) {\r\n source._internalMeshDataInfo.meshMap = {};\r\n }\r\n source._internalMeshDataInfo.meshMap[_this.uniqueId] = _this;\r\n }\r\n // Construction Params\r\n // Clone parameters allowing mesh to be updated in case of parametric shapes.\r\n _this._originalBuilderSideOrientation = source._originalBuilderSideOrientation;\r\n _this._creationDataStorage = source._creationDataStorage;\r\n // Animation ranges\r\n if (source._ranges) {\r\n var ranges = source._ranges;\r\n for (var name in ranges) {\r\n if (!ranges.hasOwnProperty(name)) {\r\n continue;\r\n }\r\n if (!ranges[name]) {\r\n continue;\r\n }\r\n _this.createAnimationRange(name, ranges[name].from, ranges[name].to);\r\n }\r\n }\r\n // Metadata\r\n if (source.metadata && source.metadata.clone) {\r\n _this.metadata = source.metadata.clone();\r\n }\r\n else {\r\n _this.metadata = source.metadata;\r\n }\r\n // Tags\r\n if (Tags && Tags.HasTags(source)) {\r\n Tags.AddTagsTo(_this, Tags.GetTags(source, true));\r\n }\r\n // Enabled\r\n _this.setEnabled(source.isEnabled());\r\n // Parent\r\n _this.parent = source.parent;\r\n // Pivot\r\n _this.setPivotMatrix(source.getPivotMatrix());\r\n _this.id = name + \".\" + source.id;\r\n // Material\r\n _this.material = source.material;\r\n var index;\r\n if (!doNotCloneChildren) {\r\n // Children\r\n var directDescendants = source.getDescendants(true);\r\n for (var index_1 = 0; index_1 < directDescendants.length; index_1++) {\r\n var child = directDescendants[index_1];\r\n if (child.clone) {\r\n child.clone(name + \".\" + child.name, _this);\r\n }\r\n }\r\n }\r\n // Morphs\r\n if (source.morphTargetManager) {\r\n _this.morphTargetManager = source.morphTargetManager;\r\n }\r\n // Physics clone\r\n if (scene.getPhysicsEngine) {\r\n var physicsEngine = scene.getPhysicsEngine();\r\n if (clonePhysicsImpostor && physicsEngine) {\r\n var impostor = physicsEngine.getImpostorForPhysicsObject(source);\r\n if (impostor) {\r\n _this.physicsImpostor = impostor.clone(_this);\r\n }\r\n }\r\n }\r\n // Particles\r\n for (index = 0; index < scene.particleSystems.length; index++) {\r\n var system = scene.particleSystems[index];\r\n if (system.emitter === source) {\r\n system.clone(system.name, _this);\r\n }\r\n }\r\n _this.refreshBoundingInfo();\r\n _this.computeWorldMatrix(true);\r\n }\r\n // Parent\r\n if (parent !== null) {\r\n _this.parent = parent;\r\n }\r\n _this._instanceDataStorage.hardwareInstancedRendering = _this.getEngine().getCaps().instancedArrays;\r\n return _this;\r\n }\r\n /**\r\n * Gets the default side orientation.\r\n * @param orientation the orientation to value to attempt to get\r\n * @returns the default orientation\r\n * @hidden\r\n */\r\n Mesh._GetDefaultSideOrientation = function (orientation) {\r\n return orientation || Mesh.FRONTSIDE; // works as Mesh.FRONTSIDE is 0\r\n };\r\n Object.defineProperty(Mesh.prototype, \"computeBonesUsingShaders\", {\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._computeBonesUsingShaders;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._computeBonesUsingShaders === value) {\r\n return;\r\n }\r\n if (value && this._internalMeshDataInfo._sourcePositions) {\r\n // switch from software to GPU computation: we need to reset the vertex and normal buffers that have been updated by the software process\r\n this.setVerticesData(VertexBuffer.PositionKind, this._internalMeshDataInfo._sourcePositions.slice(), true);\r\n if (this._internalMeshDataInfo._sourceNormals) {\r\n this.setVerticesData(VertexBuffer.NormalKind, this._internalMeshDataInfo._sourceNormals.slice(), true);\r\n }\r\n }\r\n this._internalAbstractMeshDataInfo._computeBonesUsingShaders = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onBeforeRenderObservable\", {\r\n /**\r\n * An event triggered before rendering the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onBeforeRenderObservable) {\r\n this._internalMeshDataInfo._onBeforeRenderObservable = new Observable();\r\n }\r\n return this._internalMeshDataInfo._onBeforeRenderObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onBeforeBindObservable\", {\r\n /**\r\n * An event triggered before binding the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onBeforeBindObservable) {\r\n this._internalMeshDataInfo._onBeforeBindObservable = new Observable();\r\n }\r\n return this._internalMeshDataInfo._onBeforeBindObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onAfterRenderObservable\", {\r\n /**\r\n * An event triggered after rendering the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onAfterRenderObservable) {\r\n this._internalMeshDataInfo._onAfterRenderObservable = new Observable();\r\n }\r\n return this._internalMeshDataInfo._onAfterRenderObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onBeforeDrawObservable\", {\r\n /**\r\n * An event triggered before drawing the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onBeforeDrawObservable) {\r\n this._internalMeshDataInfo._onBeforeDrawObservable = new Observable();\r\n }\r\n return this._internalMeshDataInfo._onBeforeDrawObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onBeforeDraw\", {\r\n /**\r\n * Sets a callback to call before drawing the mesh. It is recommended to use onBeforeDrawObservable instead\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeDrawObserver) {\r\n this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver);\r\n }\r\n this._onBeforeDrawObserver = this.onBeforeDrawObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"hasInstances\", {\r\n get: function () {\r\n return this.instances.length > 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"hasThinInstances\", {\r\n get: function () {\r\n var _a;\r\n return ((_a = this._thinInstanceDataStorage.instancesCount) !== null && _a !== void 0 ? _a : 0) > 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"morphTargetManager\", {\r\n /**\r\n * Gets or sets the morph target manager\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_morphtargets\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._morphTargetManager;\r\n },\r\n set: function (value) {\r\n if (this._internalMeshDataInfo._morphTargetManager === value) {\r\n return;\r\n }\r\n this._internalMeshDataInfo._morphTargetManager = value;\r\n this._syncGeometryWithMorphTargetManager();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"source\", {\r\n /**\r\n * Gets the source mesh (the one used to clone this one from)\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._source;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"cloneMeshMap\", {\r\n /**\r\n * Gets the list of clones of this mesh\r\n * The scene must have been constructed with useClonedMeshMap=true for this to work!\r\n * Note that useClonedMeshMap=true is the default setting\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo.meshMap;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"isUnIndexed\", {\r\n /**\r\n * Gets or sets a boolean indicating that this mesh does not use index buffer\r\n */\r\n get: function () {\r\n return this._unIndexed;\r\n },\r\n set: function (value) {\r\n if (this._unIndexed !== value) {\r\n this._unIndexed = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"worldMatrixInstancedBuffer\", {\r\n /** Gets the array buffer used to store the instanced buffer used for instances' world matrices */\r\n get: function () {\r\n return this._instanceDataStorage.instancesData;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"manualUpdateOfWorldMatrixInstancedBuffer\", {\r\n /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices is manual */\r\n get: function () {\r\n return this._instanceDataStorage.manualUpdate;\r\n },\r\n set: function (value) {\r\n this._instanceDataStorage.manualUpdate = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Methods\r\n Mesh.prototype.instantiateHierarchy = function (newParent, options, onNewNodeCreated) {\r\n if (newParent === void 0) { newParent = null; }\r\n var instance = (this.getTotalVertices() > 0 && (!options || !options.doNotInstantiate)) ? this.createInstance(\"instance of \" + (this.name || this.id)) : this.clone(\"Clone of \" + (this.name || this.id), newParent || this.parent, true);\r\n if (instance) {\r\n instance.parent = newParent || this.parent;\r\n instance.position = this.position.clone();\r\n instance.scaling = this.scaling.clone();\r\n if (this.rotationQuaternion) {\r\n instance.rotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n else {\r\n instance.rotation = this.rotation.clone();\r\n }\r\n if (onNewNodeCreated) {\r\n onNewNodeCreated(this, instance);\r\n }\r\n }\r\n for (var _i = 0, _a = this.getChildTransformNodes(true); _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child.instantiateHierarchy(instance, options, onNewNodeCreated);\r\n }\r\n return instance;\r\n };\r\n /**\r\n * Gets the class name\r\n * @returns the string \"Mesh\".\r\n */\r\n Mesh.prototype.getClassName = function () {\r\n return \"Mesh\";\r\n };\r\n Object.defineProperty(Mesh.prototype, \"_isMesh\", {\r\n /** @hidden */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a description of this mesh\r\n * @param fullDetails define if full details about this mesh must be used\r\n * @returns a descriptive string representing this mesh\r\n */\r\n Mesh.prototype.toString = function (fullDetails) {\r\n var ret = _super.prototype.toString.call(this, fullDetails);\r\n ret += \", n vertices: \" + this.getTotalVertices();\r\n ret += \", parent: \" + (this._waitingParentId ? this._waitingParentId : (this.parent ? this.parent.name : \"NONE\"));\r\n if (this.animations) {\r\n for (var i = 0; i < this.animations.length; i++) {\r\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\r\n }\r\n }\r\n if (fullDetails) {\r\n if (this._geometry) {\r\n var ib = this.getIndices();\r\n var vb = this.getVerticesData(VertexBuffer.PositionKind);\r\n if (vb && ib) {\r\n ret += \", flat shading: \" + (vb.length / 3 === ib.length ? \"YES\" : \"NO\");\r\n }\r\n }\r\n else {\r\n ret += \", flat shading: UNKNOWN\";\r\n }\r\n }\r\n return ret;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._unBindEffect = function () {\r\n _super.prototype._unBindEffect.call(this);\r\n for (var _i = 0, _a = this.instances; _i < _a.length; _i++) {\r\n var instance = _a[_i];\r\n instance._unBindEffect();\r\n }\r\n };\r\n Object.defineProperty(Mesh.prototype, \"hasLODLevels\", {\r\n /**\r\n * Gets a boolean indicating if this mesh has LOD\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._LODLevels.length > 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the list of MeshLODLevel associated with the current mesh\r\n * @returns an array of MeshLODLevel\r\n */\r\n Mesh.prototype.getLODLevels = function () {\r\n return this._internalMeshDataInfo._LODLevels;\r\n };\r\n Mesh.prototype._sortLODLevels = function () {\r\n this._internalMeshDataInfo._LODLevels.sort(function (a, b) {\r\n if (a.distance < b.distance) {\r\n return 1;\r\n }\r\n if (a.distance > b.distance) {\r\n return -1;\r\n }\r\n return 0;\r\n });\r\n };\r\n /**\r\n * Add a mesh as LOD level triggered at the given distance.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param distance The distance from the center of the object to show this level\r\n * @param mesh The mesh to be added as LOD level (can be null)\r\n * @return This mesh (for chaining)\r\n */\r\n Mesh.prototype.addLODLevel = function (distance, mesh) {\r\n if (mesh && mesh._masterMesh) {\r\n Logger.Warn(\"You cannot use a mesh as LOD level twice\");\r\n return this;\r\n }\r\n var level = new MeshLODLevel(distance, mesh);\r\n this._internalMeshDataInfo._LODLevels.push(level);\r\n if (mesh) {\r\n mesh._masterMesh = this;\r\n }\r\n this._sortLODLevels();\r\n return this;\r\n };\r\n /**\r\n * Returns the LOD level mesh at the passed distance or null if not found.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param distance The distance from the center of the object to show this level\r\n * @returns a Mesh or `null`\r\n */\r\n Mesh.prototype.getLODLevelAtDistance = function (distance) {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n for (var index = 0; index < internalDataInfo._LODLevels.length; index++) {\r\n var level = internalDataInfo._LODLevels[index];\r\n if (level.distance === distance) {\r\n return level.mesh;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Remove a mesh from the LOD array\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param mesh defines the mesh to be removed\r\n * @return This mesh (for chaining)\r\n */\r\n Mesh.prototype.removeLODLevel = function (mesh) {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n for (var index = 0; index < internalDataInfo._LODLevels.length; index++) {\r\n if (internalDataInfo._LODLevels[index].mesh === mesh) {\r\n internalDataInfo._LODLevels.splice(index, 1);\r\n if (mesh) {\r\n mesh._masterMesh = null;\r\n }\r\n }\r\n }\r\n this._sortLODLevels();\r\n return this;\r\n };\r\n /**\r\n * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param camera defines the camera to use to compute distance\r\n * @param boundingSphere defines a custom bounding sphere to use instead of the one from this mesh\r\n * @return This mesh (for chaining)\r\n */\r\n Mesh.prototype.getLOD = function (camera, boundingSphere) {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._LODLevels || internalDataInfo._LODLevels.length === 0) {\r\n return this;\r\n }\r\n var bSphere;\r\n if (boundingSphere) {\r\n bSphere = boundingSphere;\r\n }\r\n else {\r\n var boundingInfo = this.getBoundingInfo();\r\n bSphere = boundingInfo.boundingSphere;\r\n }\r\n var distanceToCamera = bSphere.centerWorld.subtract(camera.globalPosition).length();\r\n if (internalDataInfo._LODLevels[internalDataInfo._LODLevels.length - 1].distance > distanceToCamera) {\r\n if (this.onLODLevelSelection) {\r\n this.onLODLevelSelection(distanceToCamera, this, this);\r\n }\r\n return this;\r\n }\r\n for (var index = 0; index < internalDataInfo._LODLevels.length; index++) {\r\n var level = internalDataInfo._LODLevels[index];\r\n if (level.distance < distanceToCamera) {\r\n if (level.mesh) {\r\n if (level.mesh.delayLoadState === 4) {\r\n level.mesh._checkDelayState();\r\n return this;\r\n }\r\n if (level.mesh.delayLoadState === 2) {\r\n return this;\r\n }\r\n level.mesh._preActivate();\r\n level.mesh._updateSubMeshesBoundingInfo(this.worldMatrixFromCache);\r\n }\r\n if (this.onLODLevelSelection) {\r\n this.onLODLevelSelection(distanceToCamera, this, level.mesh);\r\n }\r\n return level.mesh;\r\n }\r\n }\r\n if (this.onLODLevelSelection) {\r\n this.onLODLevelSelection(distanceToCamera, this, this);\r\n }\r\n return this;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"geometry\", {\r\n /**\r\n * Gets the mesh internal Geometry object\r\n */\r\n get: function () {\r\n return this._geometry;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the total number of vertices within the mesh geometry or zero if the mesh has no geometry.\r\n * @returns the total number of vertices\r\n */\r\n Mesh.prototype.getTotalVertices = function () {\r\n if (this._geometry === null || this._geometry === undefined) {\r\n return 0;\r\n }\r\n return this._geometry.getTotalVertices();\r\n };\r\n /**\r\n * Returns the content of an associated vertex buffer\r\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param copyWhenShared defines a boolean indicating that if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one\r\n * @param forceCopy defines a boolean forcing the copy of the buffer no matter what the value of copyWhenShared is\r\n * @returns a FloatArray or null if the mesh has no geometry or no vertex buffer for this kind.\r\n */\r\n Mesh.prototype.getVerticesData = function (kind, copyWhenShared, forceCopy) {\r\n if (!this._geometry) {\r\n return null;\r\n }\r\n return this._geometry.getVerticesData(kind, copyWhenShared, forceCopy);\r\n };\r\n /**\r\n * Returns the mesh VertexBuffer object from the requested `kind`\r\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.NormalKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns a FloatArray or null if the mesh has no vertex buffer for this kind.\r\n */\r\n Mesh.prototype.getVertexBuffer = function (kind) {\r\n if (!this._geometry) {\r\n return null;\r\n }\r\n return this._geometry.getVertexBuffer(kind);\r\n };\r\n /**\r\n * Tests if a specific vertex buffer is associated with this mesh\r\n * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.NormalKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns a boolean\r\n */\r\n Mesh.prototype.isVerticesDataPresent = function (kind) {\r\n if (!this._geometry) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._geometry.isVerticesDataPresent(kind);\r\n };\r\n /**\r\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable.\r\n * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns a boolean\r\n */\r\n Mesh.prototype.isVertexBufferUpdatable = function (kind) {\r\n if (!this._geometry) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._geometry.isVertexBufferUpdatable(kind);\r\n };\r\n /**\r\n * Returns a string which contains the list of existing `kinds` of Vertex Data associated with this mesh.\r\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.NormalKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns an array of strings\r\n */\r\n Mesh.prototype.getVerticesDataKinds = function () {\r\n if (!this._geometry) {\r\n var result = new Array();\r\n if (this._delayInfo) {\r\n this._delayInfo.forEach(function (kind) {\r\n result.push(kind);\r\n });\r\n }\r\n return result;\r\n }\r\n return this._geometry.getVerticesDataKinds();\r\n };\r\n /**\r\n * Returns a positive integer : the total number of indices in this mesh geometry.\r\n * @returns the numner of indices or zero if the mesh has no geometry.\r\n */\r\n Mesh.prototype.getTotalIndices = function () {\r\n if (!this._geometry) {\r\n return 0;\r\n }\r\n return this._geometry.getTotalIndices();\r\n };\r\n /**\r\n * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.\r\n * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns the indices array or an empty array if the mesh has no geometry\r\n */\r\n Mesh.prototype.getIndices = function (copyWhenShared, forceCopy) {\r\n if (!this._geometry) {\r\n return [];\r\n }\r\n return this._geometry.getIndices(copyWhenShared, forceCopy);\r\n };\r\n Object.defineProperty(Mesh.prototype, \"isBlocked\", {\r\n get: function () {\r\n return this._masterMesh !== null && this._masterMesh !== undefined;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Determine if the current mesh is ready to be rendered\r\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\r\n * @param forceInstanceSupport will check if the mesh will be ready when used with instances (false by default)\r\n * @returns true if all associated assets are ready (material, textures, shaders)\r\n */\r\n Mesh.prototype.isReady = function (completeCheck, forceInstanceSupport) {\r\n var _a, _b, _c, _d, _e, _f;\r\n if (completeCheck === void 0) { completeCheck = false; }\r\n if (forceInstanceSupport === void 0) { forceInstanceSupport = false; }\r\n if (this.delayLoadState === 2) {\r\n return false;\r\n }\r\n if (!_super.prototype.isReady.call(this, completeCheck)) {\r\n return false;\r\n }\r\n if (!this.subMeshes || this.subMeshes.length === 0) {\r\n return true;\r\n }\r\n if (!completeCheck) {\r\n return true;\r\n }\r\n var engine = this.getEngine();\r\n var scene = this.getScene();\r\n var hardwareInstancedRendering = forceInstanceSupport || engine.getCaps().instancedArrays && (this.instances.length > 0 || this.hasThinInstances);\r\n this.computeWorldMatrix();\r\n var mat = this.material || scene.defaultMaterial;\r\n if (mat) {\r\n if (mat._storeEffectOnSubMeshes) {\r\n for (var _i = 0, _g = this.subMeshes; _i < _g.length; _i++) {\r\n var subMesh = _g[_i];\r\n var effectiveMaterial = subMesh.getMaterial();\r\n if (effectiveMaterial) {\r\n if (effectiveMaterial._storeEffectOnSubMeshes) {\r\n if (!effectiveMaterial.isReadyForSubMesh(this, subMesh, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n else {\r\n if (!effectiveMaterial.isReady(this, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (!mat.isReady(this, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n // Shadows\r\n for (var _h = 0, _j = this.lightSources; _h < _j.length; _h++) {\r\n var light = _j[_h];\r\n var generator = light.getShadowGenerator();\r\n if (generator && (!((_a = generator.getShadowMap()) === null || _a === void 0 ? void 0 : _a.renderList) || ((_b = generator.getShadowMap()) === null || _b === void 0 ? void 0 : _b.renderList) && ((_d = (_c = generator.getShadowMap()) === null || _c === void 0 ? void 0 : _c.renderList) === null || _d === void 0 ? void 0 : _d.indexOf(this)) !== -1)) {\r\n for (var _k = 0, _l = this.subMeshes; _k < _l.length; _k++) {\r\n var subMesh = _l[_k];\r\n if (!generator.isReady(subMesh, hardwareInstancedRendering, (_f = (_e = subMesh.getMaterial()) === null || _e === void 0 ? void 0 : _e.needAlphaBlendingForMesh(this)) !== null && _f !== void 0 ? _f : false)) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n // LOD\r\n for (var _m = 0, _o = this._internalMeshDataInfo._LODLevels; _m < _o.length; _m++) {\r\n var lod = _o[_m];\r\n if (lod.mesh && !lod.mesh.isReady(hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"areNormalsFrozen\", {\r\n /**\r\n * Gets a boolean indicating if the normals aren't to be recomputed on next mesh `positions` array update. This property is pertinent only for updatable parametric shapes.\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._areNormalsFrozen;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It prevents the mesh normals from being recomputed on next `positions` array update.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.freezeNormals = function () {\r\n this._internalMeshDataInfo._areNormalsFrozen = true;\r\n return this;\r\n };\r\n /**\r\n * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It reactivates the mesh normals computation if it was previously frozen\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.unfreezeNormals = function () {\r\n this._internalMeshDataInfo._areNormalsFrozen = false;\r\n return this;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"overridenInstanceCount\", {\r\n /**\r\n * Sets a value overriding the instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs\r\n */\r\n set: function (count) {\r\n this._instanceDataStorage.overridenInstanceCount = count;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Methods\r\n /** @hidden */\r\n Mesh.prototype._preActivate = function () {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n var sceneRenderId = this.getScene().getRenderId();\r\n if (internalDataInfo._preActivateId === sceneRenderId) {\r\n return this;\r\n }\r\n internalDataInfo._preActivateId = sceneRenderId;\r\n this._instanceDataStorage.visibleInstances = null;\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._preActivateForIntermediateRendering = function (renderId) {\r\n if (this._instanceDataStorage.visibleInstances) {\r\n this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId = renderId;\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._registerInstanceForRenderId = function (instance, renderId) {\r\n if (!this._instanceDataStorage.visibleInstances) {\r\n this._instanceDataStorage.visibleInstances = {\r\n defaultRenderId: renderId,\r\n selfDefaultRenderId: this._renderId\r\n };\r\n }\r\n if (!this._instanceDataStorage.visibleInstances[renderId]) {\r\n if (this._instanceDataStorage.previousRenderId !== undefined && this._instanceDataStorage.isFrozen) {\r\n this._instanceDataStorage.visibleInstances[this._instanceDataStorage.previousRenderId] = null;\r\n }\r\n this._instanceDataStorage.previousRenderId = renderId;\r\n this._instanceDataStorage.visibleInstances[renderId] = new Array();\r\n }\r\n this._instanceDataStorage.visibleInstances[renderId].push(instance);\r\n return this;\r\n };\r\n Mesh.prototype._afterComputeWorldMatrix = function () {\r\n _super.prototype._afterComputeWorldMatrix.call(this);\r\n if (!this.hasThinInstances) {\r\n return;\r\n }\r\n if (!this.doNotSyncBoundingInfo) {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n }\r\n };\r\n /** @hidden */\r\n Mesh.prototype._postActivate = function () {\r\n if (this.edgesShareWithInstances && this.edgesRenderer && this.edgesRenderer.isEnabled && this._renderingGroup) {\r\n this._renderingGroup._edgesRenderers.pushNoDuplicate(this.edgesRenderer);\r\n this.edgesRenderer.customInstances.push(this.getWorldMatrix());\r\n }\r\n };\r\n /**\r\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\r\n * This means the mesh underlying bounding box and sphere are recomputed.\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.refreshBoundingInfo = function (applySkeleton) {\r\n if (applySkeleton === void 0) { applySkeleton = false; }\r\n if (this._boundingInfo && this._boundingInfo.isLocked) {\r\n return this;\r\n }\r\n var bias = this.geometry ? this.geometry.boundingBias : null;\r\n this._refreshBoundingInfo(this._getPositionData(applySkeleton), bias);\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._createGlobalSubMesh = function (force) {\r\n var totalVertices = this.getTotalVertices();\r\n if (!totalVertices || !this.getIndices()) {\r\n return null;\r\n }\r\n // Check if we need to recreate the submeshes\r\n if (this.subMeshes && this.subMeshes.length > 0) {\r\n var ib = this.getIndices();\r\n if (!ib) {\r\n return null;\r\n }\r\n var totalIndices = ib.length;\r\n var needToRecreate = false;\r\n if (force) {\r\n needToRecreate = true;\r\n }\r\n else {\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var submesh = _a[_i];\r\n if (submesh.indexStart + submesh.indexCount > totalIndices) {\r\n needToRecreate = true;\r\n break;\r\n }\r\n if (submesh.verticesStart + submesh.verticesCount > totalVertices) {\r\n needToRecreate = true;\r\n break;\r\n }\r\n }\r\n }\r\n if (!needToRecreate) {\r\n return this.subMeshes[0];\r\n }\r\n }\r\n this.releaseSubMeshes();\r\n return new SubMesh(0, 0, totalVertices, 0, this.getTotalIndices(), this);\r\n };\r\n /**\r\n * This function will subdivide the mesh into multiple submeshes\r\n * @param count defines the expected number of submeshes\r\n */\r\n Mesh.prototype.subdivide = function (count) {\r\n if (count < 1) {\r\n return;\r\n }\r\n var totalIndices = this.getTotalIndices();\r\n var subdivisionSize = (totalIndices / count) | 0;\r\n var offset = 0;\r\n // Ensure that subdivisionSize is a multiple of 3\r\n while (subdivisionSize % 3 !== 0) {\r\n subdivisionSize++;\r\n }\r\n this.releaseSubMeshes();\r\n for (var index = 0; index < count; index++) {\r\n if (offset >= totalIndices) {\r\n break;\r\n }\r\n SubMesh.CreateFromIndices(0, offset, index === count - 1 ? totalIndices - offset : subdivisionSize, this);\r\n offset += subdivisionSize;\r\n }\r\n this.synchronizeInstances();\r\n };\r\n /**\r\n * Copy a FloatArray into a specific associated vertex buffer\r\n * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updatable defines if the updated vertex buffer must be flagged as updatable\r\n * @param stride defines the data stride size (can be null)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (!this._geometry) {\r\n var vertexData = new VertexData();\r\n vertexData.set(data, kind);\r\n var scene = this.getScene();\r\n new Geometry(Geometry.RandomId(), scene, vertexData, updatable, this);\r\n }\r\n else {\r\n this._geometry.setVerticesData(kind, data, updatable, stride);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Delete a vertex buffer associated with this mesh\r\n * @param kind defines which buffer to delete (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n */\r\n Mesh.prototype.removeVerticesData = function (kind) {\r\n if (!this._geometry) {\r\n return;\r\n }\r\n this._geometry.removeVerticesData(kind);\r\n };\r\n /**\r\n * Flags an associated vertex buffer as updatable\r\n * @param kind defines which buffer to use (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param updatable defines if the updated vertex buffer must be flagged as updatable\r\n */\r\n Mesh.prototype.markVerticesDataAsUpdatable = function (kind, updatable) {\r\n if (updatable === void 0) { updatable = true; }\r\n var vb = this.getVertexBuffer(kind);\r\n if (!vb || vb.isUpdatable() === updatable) {\r\n return;\r\n }\r\n this.setVerticesData(kind, this.getVerticesData(kind), updatable);\r\n };\r\n /**\r\n * Sets the mesh global Vertex Buffer\r\n * @param buffer defines the buffer to use\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setVerticesBuffer = function (buffer) {\r\n if (!this._geometry) {\r\n this._geometry = Geometry.CreateGeometryForMesh(this);\r\n }\r\n this._geometry.setVerticesBuffer(buffer);\r\n return this;\r\n };\r\n /**\r\n * Update a specific associated vertex buffer\r\n * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updateExtends defines if extends info of the mesh must be updated (can be null). This is mostly useful for \"position\" kind\r\n * @param makeItUnique defines if the geometry associated with the mesh must be cloned to make the change only for this mesh (and not all meshes associated with the same geometry)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n if (!makeItUnique) {\r\n this._geometry.updateVerticesData(kind, data, updateExtends);\r\n }\r\n else {\r\n this.makeGeometryUnique();\r\n this.updateVerticesData(kind, data, updateExtends, false);\r\n }\r\n return this;\r\n };\r\n /**\r\n * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.\r\n * @see https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#other-shapes-updatemeshpositions\r\n * @param positionFunction is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything\r\n * @param computeNormals is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.updateMeshPositions = function (positionFunction, computeNormals) {\r\n if (computeNormals === void 0) { computeNormals = true; }\r\n var positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n if (!positions) {\r\n return this;\r\n }\r\n positionFunction(positions);\r\n this.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\r\n if (computeNormals) {\r\n var indices = this.getIndices();\r\n var normals = this.getVerticesData(VertexBuffer.NormalKind);\r\n if (!normals) {\r\n return this;\r\n }\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n this.updateVerticesData(VertexBuffer.NormalKind, normals, false, false);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Creates a un-shared specific occurence of the geometry for the mesh.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.makeGeometryUnique = function () {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n if (this._geometry.meshes.length === 1) {\r\n return this;\r\n }\r\n var oldGeometry = this._geometry;\r\n var geometry = this._geometry.copy(Geometry.RandomId());\r\n oldGeometry.releaseForMesh(this, true);\r\n geometry.applyToMesh(this);\r\n return this;\r\n };\r\n /**\r\n * Set the index buffer of this mesh\r\n * @param indices defines the source data\r\n * @param totalVertices defines the total number of vertices referenced by this index data (can be null)\r\n * @param updatable defines if the updated index buffer must be flagged as updatable (default is false)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setIndices = function (indices, totalVertices, updatable) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (!this._geometry) {\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n var scene = this.getScene();\r\n new Geometry(Geometry.RandomId(), scene, vertexData, updatable, this);\r\n }\r\n else {\r\n this._geometry.setIndices(indices, totalVertices, updatable);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Update the current index buffer\r\n * @param indices defines the source data\r\n * @param offset defines the offset in the index buffer where to store the new data (can be null)\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.updateIndices = function (indices, offset, gpuMemoryOnly) {\r\n if (gpuMemoryOnly === void 0) { gpuMemoryOnly = false; }\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n this._geometry.updateIndices(indices, offset, gpuMemoryOnly);\r\n return this;\r\n };\r\n /**\r\n * Invert the geometry to move from a right handed system to a left handed one.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.toLeftHanded = function () {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n this._geometry.toLeftHanded();\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._bind = function (subMesh, effect, fillMode) {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n var engine = this.getScene().getEngine();\r\n // Wireframe\r\n var indexToBind;\r\n if (this._unIndexed) {\r\n indexToBind = null;\r\n }\r\n else {\r\n switch (fillMode) {\r\n case Material.PointFillMode:\r\n indexToBind = null;\r\n break;\r\n case Material.WireFrameFillMode:\r\n indexToBind = subMesh._getLinesIndexBuffer(this.getIndices(), engine);\r\n break;\r\n default:\r\n case Material.TriangleFillMode:\r\n indexToBind = this._geometry.getIndexBuffer();\r\n break;\r\n }\r\n }\r\n // VBOs\r\n this._geometry._bind(effect, indexToBind);\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._draw = function (subMesh, fillMode, instancesCount) {\r\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\r\n return this;\r\n }\r\n if (this._internalMeshDataInfo._onBeforeDrawObservable) {\r\n this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);\r\n }\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (this._unIndexed || fillMode == Material.PointFillMode) {\r\n // or triangles as points\r\n engine.drawArraysType(fillMode, subMesh.verticesStart, subMesh.verticesCount, instancesCount);\r\n }\r\n else if (fillMode == Material.WireFrameFillMode) {\r\n // Triangles as wireframe\r\n engine.drawElementsType(fillMode, 0, subMesh._linesIndexCount, instancesCount);\r\n }\r\n else {\r\n engine.drawElementsType(fillMode, subMesh.indexStart, subMesh.indexCount, instancesCount);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Registers for this mesh a javascript function called just before the rendering process\r\n * @param func defines the function to call before rendering this mesh\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.registerBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.add(func);\r\n return this;\r\n };\r\n /**\r\n * Disposes a previously registered javascript function called before the rendering\r\n * @param func defines the function to remove\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.unregisterBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.removeCallback(func);\r\n return this;\r\n };\r\n /**\r\n * Registers for this mesh a javascript function called just after the rendering is complete\r\n * @param func defines the function to call after rendering this mesh\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.registerAfterRender = function (func) {\r\n this.onAfterRenderObservable.add(func);\r\n return this;\r\n };\r\n /**\r\n * Disposes a previously registered javascript function called after the rendering.\r\n * @param func defines the function to remove\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.unregisterAfterRender = function (func) {\r\n this.onAfterRenderObservable.removeCallback(func);\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._getInstancesRenderList = function (subMeshId, isReplacementMode) {\r\n if (isReplacementMode === void 0) { isReplacementMode = false; }\r\n if (this._instanceDataStorage.isFrozen && this._instanceDataStorage.previousBatch) {\r\n return this._instanceDataStorage.previousBatch;\r\n }\r\n var scene = this.getScene();\r\n var isInIntermediateRendering = scene._isInIntermediateRendering();\r\n var onlyForInstances = isInIntermediateRendering ? this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate : this._internalAbstractMeshDataInfo._onlyForInstances;\r\n var batchCache = this._instanceDataStorage.batchCache;\r\n batchCache.mustReturn = false;\r\n batchCache.renderSelf[subMeshId] = isReplacementMode || (!onlyForInstances && this.isEnabled() && this.isVisible);\r\n batchCache.visibleInstances[subMeshId] = null;\r\n if (this._instanceDataStorage.visibleInstances && !isReplacementMode) {\r\n var visibleInstances = this._instanceDataStorage.visibleInstances;\r\n var currentRenderId = scene.getRenderId();\r\n var defaultRenderId = (isInIntermediateRendering ? visibleInstances.intermediateDefaultRenderId : visibleInstances.defaultRenderId);\r\n batchCache.visibleInstances[subMeshId] = visibleInstances[currentRenderId];\r\n if (!batchCache.visibleInstances[subMeshId] && defaultRenderId) {\r\n batchCache.visibleInstances[subMeshId] = visibleInstances[defaultRenderId];\r\n }\r\n }\r\n batchCache.hardwareInstancedRendering[subMeshId] =\r\n !isReplacementMode &&\r\n this._instanceDataStorage.hardwareInstancedRendering\r\n && (batchCache.visibleInstances[subMeshId] !== null)\r\n && (batchCache.visibleInstances[subMeshId] !== undefined);\r\n this._instanceDataStorage.previousBatch = batchCache;\r\n return batchCache;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._renderWithInstances = function (subMesh, fillMode, batch, effect, engine) {\r\n var visibleInstances = batch.visibleInstances[subMesh._id];\r\n if (!visibleInstances) {\r\n return this;\r\n }\r\n var instanceStorage = this._instanceDataStorage;\r\n var currentInstancesBufferSize = instanceStorage.instancesBufferSize;\r\n var instancesBuffer = instanceStorage.instancesBuffer;\r\n var matricesCount = visibleInstances.length + 1;\r\n var bufferSize = matricesCount * 16 * 4;\r\n while (instanceStorage.instancesBufferSize < bufferSize) {\r\n instanceStorage.instancesBufferSize *= 2;\r\n }\r\n if (!instanceStorage.instancesData || currentInstancesBufferSize != instanceStorage.instancesBufferSize) {\r\n instanceStorage.instancesData = new Float32Array(instanceStorage.instancesBufferSize / 4);\r\n }\r\n var offset = 0;\r\n var instancesCount = 0;\r\n var renderSelf = batch.renderSelf[subMesh._id];\r\n var needUpdateBuffer = !instancesBuffer || currentInstancesBufferSize !== instanceStorage.instancesBufferSize;\r\n if (!this._instanceDataStorage.manualUpdate && (!instanceStorage.isFrozen || needUpdateBuffer)) {\r\n var world = this._effectiveMesh.getWorldMatrix();\r\n if (renderSelf) {\r\n world.copyToArray(instanceStorage.instancesData, offset);\r\n offset += 16;\r\n instancesCount++;\r\n }\r\n if (visibleInstances) {\r\n for (var instanceIndex = 0; instanceIndex < visibleInstances.length; instanceIndex++) {\r\n var instance = visibleInstances[instanceIndex];\r\n instance.getWorldMatrix().copyToArray(instanceStorage.instancesData, offset);\r\n offset += 16;\r\n instancesCount++;\r\n }\r\n }\r\n }\r\n else {\r\n instancesCount = (renderSelf ? 1 : 0) + visibleInstances.length;\r\n }\r\n if (needUpdateBuffer) {\r\n if (instancesBuffer) {\r\n instancesBuffer.dispose();\r\n }\r\n instancesBuffer = new Buffer(engine, instanceStorage.instancesData, true, 16, false, true);\r\n instanceStorage.instancesBuffer = instancesBuffer;\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world0\", 0, 4));\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world1\", 4, 4));\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world2\", 8, 4));\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world3\", 12, 4));\r\n }\r\n else {\r\n if (!this._instanceDataStorage.isFrozen) {\r\n instancesBuffer.updateDirectly(instanceStorage.instancesData, 0, instancesCount);\r\n }\r\n }\r\n this._processInstancedBuffers(visibleInstances, renderSelf);\r\n // Stats\r\n this.getScene()._activeIndices.addCount(subMesh.indexCount * instancesCount, false);\r\n // Draw\r\n this._bind(subMesh, effect, fillMode);\r\n this._draw(subMesh, fillMode, instancesCount);\r\n engine.unbindInstanceAttributes();\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._renderWithThinInstances = function (subMesh, fillMode, effect, engine) {\r\n var _a, _b;\r\n // Stats\r\n var instancesCount = (_b = (_a = this._thinInstanceDataStorage) === null || _a === void 0 ? void 0 : _a.instancesCount) !== null && _b !== void 0 ? _b : 0;\r\n this.getScene()._activeIndices.addCount(subMesh.indexCount * instancesCount, false);\r\n // Draw\r\n this._bind(subMesh, effect, fillMode);\r\n this._draw(subMesh, fillMode, instancesCount);\r\n engine.unbindInstanceAttributes();\r\n };\r\n /** @hidden */\r\n Mesh.prototype._processInstancedBuffers = function (visibleInstances, renderSelf) {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n Mesh.prototype._processRendering = function (renderingMesh, subMesh, effect, fillMode, batch, hardwareInstancedRendering, onBeforeDraw, effectiveMaterial) {\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (hardwareInstancedRendering && subMesh.getRenderingMesh().hasThinInstances) {\r\n this._renderWithThinInstances(subMesh, fillMode, effect, engine);\r\n return this;\r\n }\r\n if (hardwareInstancedRendering) {\r\n this._renderWithInstances(subMesh, fillMode, batch, effect, engine);\r\n }\r\n else {\r\n var instanceCount = 0;\r\n if (batch.renderSelf[subMesh._id]) {\r\n // Draw\r\n if (onBeforeDraw) {\r\n onBeforeDraw(false, renderingMesh._effectiveMesh.getWorldMatrix(), effectiveMaterial);\r\n }\r\n instanceCount++;\r\n this._draw(subMesh, fillMode, this._instanceDataStorage.overridenInstanceCount);\r\n }\r\n var visibleInstancesForSubMesh = batch.visibleInstances[subMesh._id];\r\n if (visibleInstancesForSubMesh) {\r\n var visibleInstanceCount = visibleInstancesForSubMesh.length;\r\n instanceCount += visibleInstanceCount;\r\n // Stats\r\n for (var instanceIndex = 0; instanceIndex < visibleInstanceCount; instanceIndex++) {\r\n var instance = visibleInstancesForSubMesh[instanceIndex];\r\n // World\r\n var world = instance.getWorldMatrix();\r\n if (onBeforeDraw) {\r\n onBeforeDraw(true, world, effectiveMaterial);\r\n }\r\n // Draw\r\n this._draw(subMesh, fillMode);\r\n }\r\n }\r\n // Stats\r\n scene._activeIndices.addCount(subMesh.indexCount * instanceCount, false);\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._rebuild = function () {\r\n if (this._instanceDataStorage.instancesBuffer) {\r\n // Dispose instance buffer to be recreated in _renderWithInstances when rendered\r\n this._instanceDataStorage.instancesBuffer.dispose();\r\n this._instanceDataStorage.instancesBuffer = null;\r\n }\r\n _super.prototype._rebuild.call(this);\r\n };\r\n /** @hidden */\r\n Mesh.prototype._freeze = function () {\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n // Prepare batches\r\n for (var index = 0; index < this.subMeshes.length; index++) {\r\n this._getInstancesRenderList(index);\r\n }\r\n this._effectiveMaterial = null;\r\n this._instanceDataStorage.isFrozen = true;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._unFreeze = function () {\r\n this._instanceDataStorage.isFrozen = false;\r\n this._instanceDataStorage.previousBatch = null;\r\n };\r\n /**\r\n * Triggers the draw call for the mesh. Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager\r\n * @param subMesh defines the subMesh to render\r\n * @param enableAlphaMode defines if alpha mode can be changed\r\n * @param effectiveMeshReplacement defines an optional mesh used to provide info for the rendering\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.render = function (subMesh, enableAlphaMode, effectiveMeshReplacement) {\r\n var scene = this.getScene();\r\n if (this._internalAbstractMeshDataInfo._isActiveIntermediate) {\r\n this._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n }\r\n else {\r\n this._internalAbstractMeshDataInfo._isActive = false;\r\n }\r\n if (this._checkOcclusionQuery()) {\r\n return this;\r\n }\r\n // Managing instances\r\n var batch = this._getInstancesRenderList(subMesh._id, !!effectiveMeshReplacement);\r\n if (batch.mustReturn) {\r\n return this;\r\n }\r\n // Checking geometry state\r\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\r\n return this;\r\n }\r\n if (this._internalMeshDataInfo._onBeforeRenderObservable) {\r\n this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers(this);\r\n }\r\n var engine = scene.getEngine();\r\n var hardwareInstancedRendering = batch.hardwareInstancedRendering[subMesh._id] || subMesh.getRenderingMesh().hasThinInstances;\r\n var instanceDataStorage = this._instanceDataStorage;\r\n var material = subMesh.getMaterial();\r\n if (!material) {\r\n return this;\r\n }\r\n // Material\r\n if (!instanceDataStorage.isFrozen || !this._effectiveMaterial || this._effectiveMaterial !== material) {\r\n if (material._storeEffectOnSubMeshes) {\r\n if (!material.isReadyForSubMesh(this, subMesh, hardwareInstancedRendering)) {\r\n return this;\r\n }\r\n }\r\n else if (!material.isReady(this, hardwareInstancedRendering)) {\r\n return this;\r\n }\r\n this._effectiveMaterial = material;\r\n }\r\n // Alpha mode\r\n if (enableAlphaMode) {\r\n engine.setAlphaMode(this._effectiveMaterial.alphaMode);\r\n }\r\n var effect;\r\n if (this._effectiveMaterial._storeEffectOnSubMeshes) {\r\n effect = subMesh.effect;\r\n }\r\n else {\r\n effect = this._effectiveMaterial.getEffect();\r\n }\r\n for (var _i = 0, _a = scene._beforeRenderingMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(this, subMesh, batch, effect);\r\n }\r\n if (!effect) {\r\n return this;\r\n }\r\n var effectiveMesh = effectiveMeshReplacement || this._effectiveMesh;\r\n var sideOrientation;\r\n if (!instanceDataStorage.isFrozen &&\r\n (this._effectiveMaterial.backFaceCulling || this.overrideMaterialSideOrientation !== null)) {\r\n var mainDeterminant = effectiveMesh._getWorldMatrixDeterminant();\r\n sideOrientation = this.overrideMaterialSideOrientation;\r\n if (sideOrientation == null) {\r\n sideOrientation = this._effectiveMaterial.sideOrientation;\r\n }\r\n if (mainDeterminant < 0) {\r\n sideOrientation = (sideOrientation === Material.ClockWiseSideOrientation ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation);\r\n }\r\n instanceDataStorage.sideOrientation = sideOrientation;\r\n }\r\n else {\r\n sideOrientation = instanceDataStorage.sideOrientation;\r\n }\r\n var reverse = this._effectiveMaterial._preBind(effect, sideOrientation);\r\n if (this._effectiveMaterial.forceDepthWrite) {\r\n engine.setDepthWrite(true);\r\n }\r\n // Bind\r\n var fillMode = scene.forcePointsCloud ? Material.PointFillMode : (scene.forceWireframe ? Material.WireFrameFillMode : this._effectiveMaterial.fillMode);\r\n if (this._internalMeshDataInfo._onBeforeBindObservable) {\r\n this._internalMeshDataInfo._onBeforeBindObservable.notifyObservers(this);\r\n }\r\n if (!hardwareInstancedRendering) { // Binding will be done later because we need to add more info to the VB\r\n this._bind(subMesh, effect, fillMode);\r\n }\r\n var world = effectiveMesh.getWorldMatrix();\r\n if (this._effectiveMaterial._storeEffectOnSubMeshes) {\r\n this._effectiveMaterial.bindForSubMesh(world, this, subMesh);\r\n }\r\n else {\r\n this._effectiveMaterial.bind(world, this);\r\n }\r\n if (!this._effectiveMaterial.backFaceCulling && this._effectiveMaterial.separateCullingPass) {\r\n engine.setState(true, this._effectiveMaterial.zOffset, false, !reverse);\r\n this._processRendering(this, subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._effectiveMaterial);\r\n engine.setState(true, this._effectiveMaterial.zOffset, false, reverse);\r\n }\r\n // Draw\r\n this._processRendering(this, subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._effectiveMaterial);\r\n // Unbind\r\n this._effectiveMaterial.unbind();\r\n for (var _b = 0, _c = scene._afterRenderingMeshStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action(this, subMesh, batch, effect);\r\n }\r\n if (this._internalMeshDataInfo._onAfterRenderObservable) {\r\n this._internalMeshDataInfo._onAfterRenderObservable.notifyObservers(this);\r\n }\r\n return this;\r\n };\r\n Mesh.prototype._onBeforeDraw = function (isInstance, world, effectiveMaterial) {\r\n if (isInstance && effectiveMaterial) {\r\n effectiveMaterial.bindOnlyWorldMatrix(world);\r\n }\r\n };\r\n /**\r\n * Renormalize the mesh and patch it up if there are no weights\r\n * Similar to normalization by adding the weights compute the reciprocal and multiply all elements, this wil ensure that everything adds to 1.\r\n * However in the case of zero weights then we set just a single influence to 1.\r\n * We check in the function for extra's present and if so we use the normalizeSkinWeightsWithExtras rather than the FourWeights version.\r\n */\r\n Mesh.prototype.cleanMatrixWeights = function () {\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsExtraKind)) {\r\n this.normalizeSkinWeightsAndExtra();\r\n }\r\n else {\r\n this.normalizeSkinFourWeights();\r\n }\r\n }\r\n };\r\n // faster 4 weight version.\r\n Mesh.prototype.normalizeSkinFourWeights = function () {\r\n var matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\r\n var numWeights = matricesWeights.length;\r\n for (var a = 0; a < numWeights; a += 4) {\r\n // accumulate weights\r\n var t = matricesWeights[a] + matricesWeights[a + 1] + matricesWeights[a + 2] + matricesWeights[a + 3];\r\n // check for invalid weight and just set it to 1.\r\n if (t === 0) {\r\n matricesWeights[a] = 1;\r\n }\r\n else {\r\n // renormalize so everything adds to 1 use reciprical\r\n var recip = 1 / t;\r\n matricesWeights[a] *= recip;\r\n matricesWeights[a + 1] *= recip;\r\n matricesWeights[a + 2] *= recip;\r\n matricesWeights[a + 3] *= recip;\r\n }\r\n }\r\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeights);\r\n };\r\n // handle special case of extra verts. (in theory gltf can handle 12 influences)\r\n Mesh.prototype.normalizeSkinWeightsAndExtra = function () {\r\n var matricesWeightsExtra = this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind);\r\n var matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\r\n var numWeights = matricesWeights.length;\r\n for (var a = 0; a < numWeights; a += 4) {\r\n // accumulate weights\r\n var t = matricesWeights[a] + matricesWeights[a + 1] + matricesWeights[a + 2] + matricesWeights[a + 3];\r\n t += matricesWeightsExtra[a] + matricesWeightsExtra[a + 1] + matricesWeightsExtra[a + 2] + matricesWeightsExtra[a + 3];\r\n // check for invalid weight and just set it to 1.\r\n if (t === 0) {\r\n matricesWeights[a] = 1;\r\n }\r\n else {\r\n // renormalize so everything adds to 1 use reciprical\r\n var recip = 1 / t;\r\n matricesWeights[a] *= recip;\r\n matricesWeights[a + 1] *= recip;\r\n matricesWeights[a + 2] *= recip;\r\n matricesWeights[a + 3] *= recip;\r\n // same goes for extras\r\n matricesWeightsExtra[a] *= recip;\r\n matricesWeightsExtra[a + 1] *= recip;\r\n matricesWeightsExtra[a + 2] *= recip;\r\n matricesWeightsExtra[a + 3] *= recip;\r\n }\r\n }\r\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeights);\r\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeightsExtra);\r\n };\r\n /**\r\n * ValidateSkinning is used to determine that a mesh has valid skinning data along with skin metrics, if missing weights,\r\n * or not normalized it is returned as invalid mesh the string can be used for console logs, or on screen messages to let\r\n * the user know there was an issue with importing the mesh\r\n * @returns a validation object with skinned, valid and report string\r\n */\r\n Mesh.prototype.validateSkinning = function () {\r\n var matricesWeightsExtra = this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind);\r\n var matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\r\n if (matricesWeights === null || this.skeleton == null) {\r\n return { skinned: false, valid: true, report: \"not skinned\" };\r\n }\r\n var numWeights = matricesWeights.length;\r\n var numberNotSorted = 0;\r\n var missingWeights = 0;\r\n var maxUsedWeights = 0;\r\n var numberNotNormalized = 0;\r\n var numInfluences = matricesWeightsExtra === null ? 4 : 8;\r\n var usedWeightCounts = new Array();\r\n for (var a = 0; a <= numInfluences; a++) {\r\n usedWeightCounts[a] = 0;\r\n }\r\n var toleranceEpsilon = 0.001;\r\n for (var a = 0; a < numWeights; a += 4) {\r\n var lastWeight = matricesWeights[a];\r\n var t = lastWeight;\r\n var usedWeights = t === 0 ? 0 : 1;\r\n for (var b = 1; b < numInfluences; b++) {\r\n var d = b < 4 ? matricesWeights[a + b] : matricesWeightsExtra[a + b - 4];\r\n if (d > lastWeight) {\r\n numberNotSorted++;\r\n }\r\n if (d !== 0) {\r\n usedWeights++;\r\n }\r\n t += d;\r\n lastWeight = d;\r\n }\r\n // count the buffer weights usage\r\n usedWeightCounts[usedWeights]++;\r\n // max influences\r\n if (usedWeights > maxUsedWeights) {\r\n maxUsedWeights = usedWeights;\r\n }\r\n // check for invalid weight and just set it to 1.\r\n if (t === 0) {\r\n missingWeights++;\r\n }\r\n else {\r\n // renormalize so everything adds to 1 use reciprical\r\n var recip = 1 / t;\r\n var tolerance = 0;\r\n for (b = 0; b < numInfluences; b++) {\r\n if (b < 4) {\r\n tolerance += Math.abs(matricesWeights[a + b] - (matricesWeights[a + b] * recip));\r\n }\r\n else {\r\n tolerance += Math.abs(matricesWeightsExtra[a + b - 4] - (matricesWeightsExtra[a + b - 4] * recip));\r\n }\r\n }\r\n // arbitary epsilon value for dicdating not normalized\r\n if (tolerance > toleranceEpsilon) {\r\n numberNotNormalized++;\r\n }\r\n }\r\n }\r\n // validate bone indices are in range of the skeleton\r\n var numBones = this.skeleton.bones.length;\r\n var matricesIndices = this.getVerticesData(VertexBuffer.MatricesIndicesKind);\r\n var matricesIndicesExtra = this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind);\r\n var numBadBoneIndices = 0;\r\n for (var a = 0; a < numWeights; a += 4) {\r\n for (var b = 0; b < numInfluences; b++) {\r\n var index = b < 4 ? matricesIndices[a + b] : matricesIndicesExtra[a + b - 4];\r\n if (index >= numBones || index < 0) {\r\n numBadBoneIndices++;\r\n }\r\n }\r\n }\r\n // log mesh stats\r\n var output = \"Number of Weights = \" + numWeights / 4 + \"\\nMaximum influences = \" + maxUsedWeights +\r\n \"\\nMissing Weights = \" + missingWeights + \"\\nNot Sorted = \" + numberNotSorted +\r\n \"\\nNot Normalized = \" + numberNotNormalized + \"\\nWeightCounts = [\" + usedWeightCounts + \"]\" +\r\n \"\\nNumber of bones = \" + numBones + \"\\nBad Bone Indices = \" + numBadBoneIndices;\r\n return { skinned: true, valid: missingWeights === 0 && numberNotNormalized === 0 && numBadBoneIndices === 0, report: output };\r\n };\r\n /** @hidden */\r\n Mesh.prototype._checkDelayState = function () {\r\n var scene = this.getScene();\r\n if (this._geometry) {\r\n this._geometry.load(scene);\r\n }\r\n else if (this.delayLoadState === 4) {\r\n this.delayLoadState = 2;\r\n this._queueLoad(scene);\r\n }\r\n return this;\r\n };\r\n Mesh.prototype._queueLoad = function (scene) {\r\n var _this = this;\r\n scene._addPendingData(this);\r\n var getBinaryData = (this.delayLoadingFile.indexOf(\".babylonbinarymeshdata\") !== -1);\r\n Tools.LoadFile(this.delayLoadingFile, function (data) {\r\n if (data instanceof ArrayBuffer) {\r\n _this._delayLoadingFunction(data, _this);\r\n }\r\n else {\r\n _this._delayLoadingFunction(JSON.parse(data), _this);\r\n }\r\n _this.instances.forEach(function (instance) {\r\n instance.refreshBoundingInfo();\r\n instance._syncSubMeshes();\r\n });\r\n _this.delayLoadState = 1;\r\n scene._removePendingData(_this);\r\n }, function () { }, scene.offlineProvider, getBinaryData);\r\n return this;\r\n };\r\n /**\r\n * Returns `true` if the mesh is within the frustum defined by the passed array of planes.\r\n * A mesh is in the frustum if its bounding box intersects the frustum\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the mesh is in the frustum planes\r\n */\r\n Mesh.prototype.isInFrustum = function (frustumPlanes) {\r\n if (this.delayLoadState === 2) {\r\n return false;\r\n }\r\n if (!_super.prototype.isInFrustum.call(this, frustumPlanes)) {\r\n return false;\r\n }\r\n this._checkDelayState();\r\n return true;\r\n };\r\n /**\r\n * Sets the mesh material by the material or multiMaterial `id` property\r\n * @param id is a string identifying the material or the multiMaterial\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setMaterialByID = function (id) {\r\n var materials = this.getScene().materials;\r\n var index;\r\n for (index = materials.length - 1; index > -1; index--) {\r\n if (materials[index].id === id) {\r\n this.material = materials[index];\r\n return this;\r\n }\r\n }\r\n // Multi\r\n var multiMaterials = this.getScene().multiMaterials;\r\n for (index = multiMaterials.length - 1; index > -1; index--) {\r\n if (multiMaterials[index].id === id) {\r\n this.material = multiMaterials[index];\r\n return this;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns as a new array populated with the mesh material and/or skeleton, if any.\r\n * @returns an array of IAnimatable\r\n */\r\n Mesh.prototype.getAnimatables = function () {\r\n var results = new Array();\r\n if (this.material) {\r\n results.push(this.material);\r\n }\r\n if (this.skeleton) {\r\n results.push(this.skeleton);\r\n }\r\n return results;\r\n };\r\n /**\r\n * Modifies the mesh geometry according to the passed transformation matrix.\r\n * This method returns nothing but it really modifies the mesh even if it's originally not set as updatable.\r\n * The mesh normals are modified using the same transformation.\r\n * Note that, under the hood, this method sets a new VertexBuffer each call.\r\n * @param transform defines the transform matrix to use\r\n * @see https://doc.babylonjs.com/resources/baking_transformations\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.bakeTransformIntoVertices = function (transform) {\r\n // Position\r\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\r\n return this;\r\n }\r\n var submeshes = this.subMeshes.splice(0);\r\n this._resetPointsArrayCache();\r\n var data = this.getVerticesData(VertexBuffer.PositionKind);\r\n var temp = new Array();\r\n var index;\r\n for (index = 0; index < data.length; index += 3) {\r\n Vector3.TransformCoordinates(Vector3.FromArray(data, index), transform).toArray(temp, index);\r\n }\r\n this.setVerticesData(VertexBuffer.PositionKind, temp, this.getVertexBuffer(VertexBuffer.PositionKind).isUpdatable());\r\n // Normals\r\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n data = this.getVerticesData(VertexBuffer.NormalKind);\r\n temp = [];\r\n for (index = 0; index < data.length; index += 3) {\r\n Vector3.TransformNormal(Vector3.FromArray(data, index), transform).normalize().toArray(temp, index);\r\n }\r\n this.setVerticesData(VertexBuffer.NormalKind, temp, this.getVertexBuffer(VertexBuffer.NormalKind).isUpdatable());\r\n }\r\n // flip faces?\r\n if (transform.m[0] * transform.m[5] * transform.m[10] < 0) {\r\n this.flipFaces();\r\n }\r\n // Restore submeshes\r\n this.releaseSubMeshes();\r\n this.subMeshes = submeshes;\r\n return this;\r\n };\r\n /**\r\n * Modifies the mesh geometry according to its own current World Matrix.\r\n * The mesh World Matrix is then reset.\r\n * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.\r\n * Note that, under the hood, this method sets a new VertexBuffer each call.\r\n * @see https://doc.babylonjs.com/resources/baking_transformations\r\n * @param bakeIndependenlyOfChildren indicates whether to preserve all child nodes' World Matrix during baking\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.bakeCurrentTransformIntoVertices = function (bakeIndependenlyOfChildren) {\r\n if (bakeIndependenlyOfChildren === void 0) { bakeIndependenlyOfChildren = true; }\r\n this.bakeTransformIntoVertices(this.computeWorldMatrix(true));\r\n this.resetLocalMatrix(bakeIndependenlyOfChildren);\r\n return this;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"_positions\", {\r\n // Cache\r\n /** @hidden */\r\n get: function () {\r\n if (this._geometry) {\r\n return this._geometry._positions;\r\n }\r\n return null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Mesh.prototype._resetPointsArrayCache = function () {\r\n if (this._geometry) {\r\n this._geometry._resetPointsArrayCache();\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._generatePointsArray = function () {\r\n if (this._geometry) {\r\n return this._geometry._generatePointsArray();\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns a new Mesh object generated from the current mesh properties.\r\n * This method must not get confused with createInstance()\r\n * @param name is a string, the name given to the new mesh\r\n * @param newParent can be any Node object (default `null`)\r\n * @param doNotCloneChildren allows/denies the recursive cloning of the original mesh children if any (default `false`)\r\n * @param clonePhysicsImpostor allows/denies the cloning in the same time of the original mesh `body` used by the physics engine, if any (default `true`)\r\n * @returns a new mesh\r\n */\r\n Mesh.prototype.clone = function (name, newParent, doNotCloneChildren, clonePhysicsImpostor) {\r\n if (name === void 0) { name = \"\"; }\r\n if (newParent === void 0) { newParent = null; }\r\n if (clonePhysicsImpostor === void 0) { clonePhysicsImpostor = true; }\r\n return new Mesh(name, this.getScene(), newParent, this, doNotCloneChildren, clonePhysicsImpostor);\r\n };\r\n /**\r\n * Releases resources associated with this mesh.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n Mesh.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n this.morphTargetManager = null;\r\n if (this._geometry) {\r\n this._geometry.releaseForMesh(this, true);\r\n }\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (internalDataInfo._onBeforeDrawObservable) {\r\n internalDataInfo._onBeforeDrawObservable.clear();\r\n }\r\n if (internalDataInfo._onBeforeBindObservable) {\r\n internalDataInfo._onBeforeBindObservable.clear();\r\n }\r\n if (internalDataInfo._onBeforeRenderObservable) {\r\n internalDataInfo._onBeforeRenderObservable.clear();\r\n }\r\n if (internalDataInfo._onAfterRenderObservable) {\r\n internalDataInfo._onAfterRenderObservable.clear();\r\n }\r\n // Sources\r\n if (this._scene.useClonedMeshMap) {\r\n if (internalDataInfo.meshMap) {\r\n for (var uniqueId in internalDataInfo.meshMap) {\r\n var mesh = internalDataInfo.meshMap[uniqueId];\r\n if (mesh) {\r\n mesh._internalMeshDataInfo._source = null;\r\n internalDataInfo.meshMap[uniqueId] = undefined;\r\n }\r\n }\r\n }\r\n if (internalDataInfo._source && internalDataInfo._source._internalMeshDataInfo.meshMap) {\r\n internalDataInfo._source._internalMeshDataInfo.meshMap[this.uniqueId] = undefined;\r\n }\r\n }\r\n else {\r\n var meshes = this.getScene().meshes;\r\n for (var _i = 0, meshes_1 = meshes; _i < meshes_1.length; _i++) {\r\n var abstractMesh = meshes_1[_i];\r\n var mesh = abstractMesh;\r\n if (mesh._internalMeshDataInfo && mesh._internalMeshDataInfo._source && mesh._internalMeshDataInfo._source === this) {\r\n mesh._internalMeshDataInfo._source = null;\r\n }\r\n }\r\n }\r\n internalDataInfo._source = null;\r\n // Instances\r\n this._disposeInstanceSpecificData();\r\n // Thin instances\r\n this._disposeThinInstanceSpecificData();\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /** @hidden */\r\n Mesh.prototype._disposeInstanceSpecificData = function () {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n Mesh.prototype._disposeThinInstanceSpecificData = function () {\r\n // Do nothing\r\n };\r\n /**\r\n * Modifies the mesh geometry according to a displacement map.\r\n * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.\r\n * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.\r\n * @param url is a string, the URL from the image file is to be downloaded.\r\n * @param minHeight is the lower limit of the displacement.\r\n * @param maxHeight is the upper limit of the displacement.\r\n * @param onSuccess is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.\r\n * @param uvOffset is an optional vector2 used to offset UV.\r\n * @param uvScale is an optional vector2 used to scale UV.\r\n * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.\r\n * @returns the Mesh.\r\n */\r\n Mesh.prototype.applyDisplacementMap = function (url, minHeight, maxHeight, onSuccess, uvOffset, uvScale, forceUpdate) {\r\n var _this = this;\r\n if (forceUpdate === void 0) { forceUpdate = false; }\r\n var scene = this.getScene();\r\n var onload = function (img) {\r\n // Getting height map data\r\n var heightMapWidth = img.width;\r\n var heightMapHeight = img.height;\r\n var canvas = CanvasGenerator.CreateCanvas(heightMapWidth, heightMapHeight);\r\n var context = canvas.getContext(\"2d\");\r\n context.drawImage(img, 0, 0);\r\n // Create VertexData from map data\r\n //Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949\r\n var buffer = context.getImageData(0, 0, heightMapWidth, heightMapHeight).data;\r\n _this.applyDisplacementMapFromBuffer(buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate);\r\n //execute success callback, if set\r\n if (onSuccess) {\r\n onSuccess(_this);\r\n }\r\n };\r\n Tools.LoadImage(url, onload, function () { }, scene.offlineProvider);\r\n return this;\r\n };\r\n /**\r\n * Modifies the mesh geometry according to a displacementMap buffer.\r\n * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.\r\n * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.\r\n * @param buffer is a `Uint8Array` buffer containing series of `Uint8` lower than 255, the red, green, blue and alpha values of each successive pixel.\r\n * @param heightMapWidth is the width of the buffer image.\r\n * @param heightMapHeight is the height of the buffer image.\r\n * @param minHeight is the lower limit of the displacement.\r\n * @param maxHeight is the upper limit of the displacement.\r\n * @param onSuccess is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.\r\n * @param uvOffset is an optional vector2 used to offset UV.\r\n * @param uvScale is an optional vector2 used to scale UV.\r\n * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.\r\n * @returns the Mesh.\r\n */\r\n Mesh.prototype.applyDisplacementMapFromBuffer = function (buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate) {\r\n if (forceUpdate === void 0) { forceUpdate = false; }\r\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind)\r\n || !this.isVerticesDataPresent(VertexBuffer.NormalKind)\r\n || !this.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n Logger.Warn(\"Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing\");\r\n return this;\r\n }\r\n var positions = this.getVerticesData(VertexBuffer.PositionKind, true, true);\r\n var normals = this.getVerticesData(VertexBuffer.NormalKind);\r\n var uvs = this.getVerticesData(VertexBuffer.UVKind);\r\n var position = Vector3.Zero();\r\n var normal = Vector3.Zero();\r\n var uv = Vector2.Zero();\r\n uvOffset = uvOffset || Vector2.Zero();\r\n uvScale = uvScale || new Vector2(1, 1);\r\n for (var index = 0; index < positions.length; index += 3) {\r\n Vector3.FromArrayToRef(positions, index, position);\r\n Vector3.FromArrayToRef(normals, index, normal);\r\n Vector2.FromArrayToRef(uvs, (index / 3) * 2, uv);\r\n // Compute height\r\n var u = ((Math.abs(uv.x * uvScale.x + uvOffset.x % 1) * (heightMapWidth - 1)) % heightMapWidth) | 0;\r\n var v = ((Math.abs(uv.y * uvScale.y + uvOffset.y % 1) * (heightMapHeight - 1)) % heightMapHeight) | 0;\r\n var pos = (u + v * heightMapWidth) * 4;\r\n var r = buffer[pos] / 255.0;\r\n var g = buffer[pos + 1] / 255.0;\r\n var b = buffer[pos + 2] / 255.0;\r\n var gradient = r * 0.3 + g * 0.59 + b * 0.11;\r\n normal.normalize();\r\n normal.scaleInPlace(minHeight + (maxHeight - minHeight) * gradient);\r\n position = position.add(normal);\r\n position.toArray(positions, index);\r\n }\r\n VertexData.ComputeNormals(positions, this.getIndices(), normals);\r\n if (forceUpdate) {\r\n this.setVerticesData(VertexBuffer.PositionKind, positions);\r\n this.setVerticesData(VertexBuffer.NormalKind, normals);\r\n }\r\n else {\r\n this.updateVerticesData(VertexBuffer.PositionKind, positions);\r\n this.updateVerticesData(VertexBuffer.NormalKind, normals);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Modify the mesh to get a flat shading rendering.\r\n * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.\r\n * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.\r\n * @returns current mesh\r\n */\r\n Mesh.prototype.convertToFlatShadedMesh = function () {\r\n var kinds = this.getVerticesDataKinds();\r\n var vbs = {};\r\n var data = {};\r\n var newdata = {};\r\n var updatableNormals = false;\r\n var kindIndex;\r\n var kind;\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (kind === VertexBuffer.NormalKind) {\r\n updatableNormals = vertexBuffer.isUpdatable();\r\n kinds.splice(kindIndex, 1);\r\n kindIndex--;\r\n continue;\r\n }\r\n vbs[kind] = vertexBuffer;\r\n data[kind] = vbs[kind].getData();\r\n newdata[kind] = [];\r\n }\r\n // Save previous submeshes\r\n var previousSubmeshes = this.subMeshes.slice(0);\r\n var indices = this.getIndices();\r\n var totalIndices = this.getTotalIndices();\r\n // Generating unique vertices per face\r\n var index;\r\n for (index = 0; index < totalIndices; index++) {\r\n var vertexIndex = indices[index];\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var stride = vbs[kind].getStrideSize();\r\n for (var offset = 0; offset < stride; offset++) {\r\n newdata[kind].push(data[kind][vertexIndex * stride + offset]);\r\n }\r\n }\r\n }\r\n // Updating faces & normal\r\n var normals = [];\r\n var positions = newdata[VertexBuffer.PositionKind];\r\n for (index = 0; index < totalIndices; index += 3) {\r\n indices[index] = index;\r\n indices[index + 1] = index + 1;\r\n indices[index + 2] = index + 2;\r\n var p1 = Vector3.FromArray(positions, index * 3);\r\n var p2 = Vector3.FromArray(positions, (index + 1) * 3);\r\n var p3 = Vector3.FromArray(positions, (index + 2) * 3);\r\n var p1p2 = p1.subtract(p2);\r\n var p3p2 = p3.subtract(p2);\r\n var normal = Vector3.Normalize(Vector3.Cross(p1p2, p3p2));\r\n // Store same normals for every vertex\r\n for (var localIndex = 0; localIndex < 3; localIndex++) {\r\n normals.push(normal.x);\r\n normals.push(normal.y);\r\n normals.push(normal.z);\r\n }\r\n }\r\n this.setIndices(indices);\r\n this.setVerticesData(VertexBuffer.NormalKind, normals, updatableNormals);\r\n // Updating vertex buffers\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n this.setVerticesData(kind, newdata[kind], vbs[kind].isUpdatable());\r\n }\r\n // Updating submeshes\r\n this.releaseSubMeshes();\r\n for (var submeshIndex = 0; submeshIndex < previousSubmeshes.length; submeshIndex++) {\r\n var previousOne = previousSubmeshes[submeshIndex];\r\n SubMesh.AddToMesh(previousOne.materialIndex, previousOne.indexStart, previousOne.indexCount, previousOne.indexStart, previousOne.indexCount, this);\r\n }\r\n this.synchronizeInstances();\r\n return this;\r\n };\r\n /**\r\n * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.\r\n * In other words, more vertices, no more indices and a single bigger VBO.\r\n * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.\r\n * @returns current mesh\r\n */\r\n Mesh.prototype.convertToUnIndexedMesh = function () {\r\n var kinds = this.getVerticesDataKinds();\r\n var vbs = {};\r\n var data = {};\r\n var newdata = {};\r\n var kindIndex;\r\n var kind;\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n vbs[kind] = vertexBuffer;\r\n data[kind] = vbs[kind].getData();\r\n newdata[kind] = [];\r\n }\r\n // Save previous submeshes\r\n var previousSubmeshes = this.subMeshes.slice(0);\r\n var indices = this.getIndices();\r\n var totalIndices = this.getTotalIndices();\r\n // Generating unique vertices per face\r\n var index;\r\n for (index = 0; index < totalIndices; index++) {\r\n var vertexIndex = indices[index];\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var stride = vbs[kind].getStrideSize();\r\n for (var offset = 0; offset < stride; offset++) {\r\n newdata[kind].push(data[kind][vertexIndex * stride + offset]);\r\n }\r\n }\r\n }\r\n // Updating indices\r\n for (index = 0; index < totalIndices; index += 3) {\r\n indices[index] = index;\r\n indices[index + 1] = index + 1;\r\n indices[index + 2] = index + 2;\r\n }\r\n this.setIndices(indices);\r\n // Updating vertex buffers\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n this.setVerticesData(kind, newdata[kind], vbs[kind].isUpdatable());\r\n }\r\n // Updating submeshes\r\n this.releaseSubMeshes();\r\n for (var submeshIndex = 0; submeshIndex < previousSubmeshes.length; submeshIndex++) {\r\n var previousOne = previousSubmeshes[submeshIndex];\r\n SubMesh.AddToMesh(previousOne.materialIndex, previousOne.indexStart, previousOne.indexCount, previousOne.indexStart, previousOne.indexCount, this);\r\n }\r\n this._unIndexed = true;\r\n this.synchronizeInstances();\r\n return this;\r\n };\r\n /**\r\n * Inverses facet orientations.\r\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\r\n * @param flipNormals will also inverts the normals\r\n * @returns current mesh\r\n */\r\n Mesh.prototype.flipFaces = function (flipNormals) {\r\n if (flipNormals === void 0) { flipNormals = false; }\r\n var vertex_data = VertexData.ExtractFromMesh(this);\r\n var i;\r\n if (flipNormals && this.isVerticesDataPresent(VertexBuffer.NormalKind) && vertex_data.normals) {\r\n for (i = 0; i < vertex_data.normals.length; i++) {\r\n vertex_data.normals[i] *= -1;\r\n }\r\n }\r\n if (vertex_data.indices) {\r\n var temp;\r\n for (i = 0; i < vertex_data.indices.length; i += 3) {\r\n // reassign indices\r\n temp = vertex_data.indices[i + 1];\r\n vertex_data.indices[i + 1] = vertex_data.indices[i + 2];\r\n vertex_data.indices[i + 2] = temp;\r\n }\r\n }\r\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(VertexBuffer.PositionKind));\r\n return this;\r\n };\r\n /**\r\n * Increase the number of facets and hence vertices in a mesh\r\n * Vertex normals are interpolated from existing vertex normals\r\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\r\n * @param numberPerEdge the number of new vertices to add to each edge of a facet, optional default 1\r\n */\r\n Mesh.prototype.increaseVertices = function (numberPerEdge) {\r\n var vertex_data = VertexData.ExtractFromMesh(this);\r\n var uvs = vertex_data.uvs;\r\n var currentIndices = vertex_data.indices;\r\n var positions = vertex_data.positions;\r\n var normals = vertex_data.normals;\r\n if (!currentIndices || !positions || !normals || !uvs) {\r\n Logger.Warn(\"VertexData contains null entries\");\r\n }\r\n else {\r\n var segments = numberPerEdge + 1; //segments per current facet edge, become sides of new facets\r\n var tempIndices = new Array();\r\n for (var i = 0; i < segments + 1; i++) {\r\n tempIndices[i] = new Array();\r\n }\r\n var a; //vertex index of one end of a side\r\n var b; //vertex index of other end of the side\r\n var deltaPosition = new Vector3(0, 0, 0);\r\n var deltaNormal = new Vector3(0, 0, 0);\r\n var deltaUV = new Vector2(0, 0);\r\n var indices = new Array();\r\n var vertexIndex = new Array();\r\n var side = new Array();\r\n var len;\r\n var positionPtr = positions.length;\r\n var uvPtr = uvs.length;\r\n for (var i = 0; i < currentIndices.length; i += 3) {\r\n vertexIndex[0] = currentIndices[i];\r\n vertexIndex[1] = currentIndices[i + 1];\r\n vertexIndex[2] = currentIndices[i + 2];\r\n for (var j = 0; j < 3; j++) {\r\n a = vertexIndex[j];\r\n b = vertexIndex[(j + 1) % 3];\r\n if (side[a] === undefined && side[b] === undefined) {\r\n side[a] = new Array();\r\n side[b] = new Array();\r\n }\r\n else {\r\n if (side[a] === undefined) {\r\n side[a] = new Array();\r\n }\r\n if (side[b] === undefined) {\r\n side[b] = new Array();\r\n }\r\n }\r\n if (side[a][b] === undefined && side[b][a] === undefined) {\r\n side[a][b] = [];\r\n deltaPosition.x = (positions[3 * b] - positions[3 * a]) / segments;\r\n deltaPosition.y = (positions[3 * b + 1] - positions[3 * a + 1]) / segments;\r\n deltaPosition.z = (positions[3 * b + 2] - positions[3 * a + 2]) / segments;\r\n deltaNormal.x = (normals[3 * b] - normals[3 * a]) / segments;\r\n deltaNormal.y = (normals[3 * b + 1] - normals[3 * a + 1]) / segments;\r\n deltaNormal.z = (normals[3 * b + 2] - normals[3 * a + 2]) / segments;\r\n deltaUV.x = (uvs[2 * b] - uvs[2 * a]) / segments;\r\n deltaUV.y = (uvs[2 * b + 1] - uvs[2 * a + 1]) / segments;\r\n side[a][b].push(a);\r\n for (var k = 1; k < segments; k++) {\r\n side[a][b].push(positions.length / 3);\r\n positions[positionPtr] = positions[3 * a] + k * deltaPosition.x;\r\n normals[positionPtr++] = normals[3 * a] + k * deltaNormal.x;\r\n positions[positionPtr] = positions[3 * a + 1] + k * deltaPosition.y;\r\n normals[positionPtr++] = normals[3 * a + 1] + k * deltaNormal.y;\r\n positions[positionPtr] = positions[3 * a + 2] + k * deltaPosition.z;\r\n normals[positionPtr++] = normals[3 * a + 2] + k * deltaNormal.z;\r\n uvs[uvPtr++] = uvs[2 * a] + k * deltaUV.x;\r\n uvs[uvPtr++] = uvs[2 * a + 1] + k * deltaUV.y;\r\n }\r\n side[a][b].push(b);\r\n side[b][a] = new Array();\r\n len = side[a][b].length;\r\n for (var idx = 0; idx < len; idx++) {\r\n side[b][a][idx] = side[a][b][len - 1 - idx];\r\n }\r\n }\r\n }\r\n //Calculate positions, normals and uvs of new internal vertices\r\n tempIndices[0][0] = currentIndices[i];\r\n tempIndices[1][0] = side[currentIndices[i]][currentIndices[i + 1]][1];\r\n tempIndices[1][1] = side[currentIndices[i]][currentIndices[i + 2]][1];\r\n for (var k = 2; k < segments; k++) {\r\n tempIndices[k][0] = side[currentIndices[i]][currentIndices[i + 1]][k];\r\n tempIndices[k][k] = side[currentIndices[i]][currentIndices[i + 2]][k];\r\n deltaPosition.x = (positions[3 * tempIndices[k][k]] - positions[3 * tempIndices[k][0]]) / k;\r\n deltaPosition.y = (positions[3 * tempIndices[k][k] + 1] - positions[3 * tempIndices[k][0] + 1]) / k;\r\n deltaPosition.z = (positions[3 * tempIndices[k][k] + 2] - positions[3 * tempIndices[k][0] + 2]) / k;\r\n deltaNormal.x = (normals[3 * tempIndices[k][k]] - normals[3 * tempIndices[k][0]]) / k;\r\n deltaNormal.y = (normals[3 * tempIndices[k][k] + 1] - normals[3 * tempIndices[k][0] + 1]) / k;\r\n deltaNormal.z = (normals[3 * tempIndices[k][k] + 2] - normals[3 * tempIndices[k][0] + 2]) / k;\r\n deltaUV.x = (uvs[2 * tempIndices[k][k]] - uvs[2 * tempIndices[k][0]]) / k;\r\n deltaUV.y = (uvs[2 * tempIndices[k][k] + 1] - uvs[2 * tempIndices[k][0] + 1]) / k;\r\n for (var j = 1; j < k; j++) {\r\n tempIndices[k][j] = positions.length / 3;\r\n positions[positionPtr] = positions[3 * tempIndices[k][0]] + j * deltaPosition.x;\r\n normals[positionPtr++] = normals[3 * tempIndices[k][0]] + j * deltaNormal.x;\r\n positions[positionPtr] = positions[3 * tempIndices[k][0] + 1] + j * deltaPosition.y;\r\n normals[positionPtr++] = normals[3 * tempIndices[k][0] + 1] + j * deltaNormal.y;\r\n positions[positionPtr] = positions[3 * tempIndices[k][0] + 2] + j * deltaPosition.z;\r\n normals[positionPtr++] = normals[3 * tempIndices[k][0] + 2] + j * deltaNormal.z;\r\n uvs[uvPtr++] = uvs[2 * tempIndices[k][0]] + j * deltaUV.x;\r\n uvs[uvPtr++] = uvs[2 * tempIndices[k][0] + 1] + j * deltaUV.y;\r\n }\r\n }\r\n tempIndices[segments] = side[currentIndices[i + 1]][currentIndices[i + 2]];\r\n // reform indices\r\n indices.push(tempIndices[0][0], tempIndices[1][0], tempIndices[1][1]);\r\n for (var k = 1; k < segments; k++) {\r\n for (var j = 0; j < k; j++) {\r\n indices.push(tempIndices[k][j], tempIndices[k + 1][j], tempIndices[k + 1][j + 1]);\r\n indices.push(tempIndices[k][j], tempIndices[k + 1][j + 1], tempIndices[k][j + 1]);\r\n }\r\n indices.push(tempIndices[k][j], tempIndices[k + 1][j], tempIndices[k + 1][j + 1]);\r\n }\r\n }\r\n vertex_data.indices = indices;\r\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(VertexBuffer.PositionKind));\r\n }\r\n };\r\n /**\r\n * Force adjacent facets to share vertices and remove any facets that have all vertices in a line\r\n * This will undo any application of covertToFlatShadedMesh\r\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\r\n */\r\n Mesh.prototype.forceSharedVertices = function () {\r\n var vertex_data = VertexData.ExtractFromMesh(this);\r\n var currentUVs = vertex_data.uvs;\r\n var currentIndices = vertex_data.indices;\r\n var currentPositions = vertex_data.positions;\r\n var currentColors = vertex_data.colors;\r\n if (currentIndices === void 0 || currentPositions === void 0 || currentIndices === null || currentPositions === null) {\r\n Logger.Warn(\"VertexData contains empty entries\");\r\n }\r\n else {\r\n var positions = new Array();\r\n var indices = new Array();\r\n var uvs = new Array();\r\n var colors = new Array();\r\n var pstring = new Array(); //lists facet vertex positions (a,b,c) as string \"a|b|c\"\r\n var indexPtr = 0; // pointer to next available index value\r\n var uniquePositions = {}; // unique vertex positions\r\n var ptr; // pointer to element in uniquePositions\r\n var facet;\r\n for (var i = 0; i < currentIndices.length; i += 3) {\r\n facet = [currentIndices[i], currentIndices[i + 1], currentIndices[i + 2]]; //facet vertex indices\r\n pstring = new Array();\r\n for (var j = 0; j < 3; j++) {\r\n pstring[j] = \"\";\r\n for (var k = 0; k < 3; k++) {\r\n //small values make 0\r\n if (Math.abs(currentPositions[3 * facet[j] + k]) < 0.00000001) {\r\n currentPositions[3 * facet[j] + k] = 0;\r\n }\r\n pstring[j] += currentPositions[3 * facet[j] + k] + \"|\";\r\n }\r\n }\r\n //check facet vertices to see that none are repeated\r\n // do not process any facet that has a repeated vertex, ie is a line\r\n if (!(pstring[0] == pstring[1] || pstring[0] == pstring[2] || pstring[1] == pstring[2])) {\r\n //for each facet position check if already listed in uniquePositions\r\n // if not listed add to uniquePositions and set index pointer\r\n // if listed use its index in uniquePositions and new index pointer\r\n for (var j = 0; j < 3; j++) {\r\n ptr = uniquePositions[pstring[j]];\r\n if (ptr === undefined) {\r\n uniquePositions[pstring[j]] = indexPtr;\r\n ptr = indexPtr++;\r\n //not listed so add individual x, y, z coordinates to positions\r\n for (var k = 0; k < 3; k++) {\r\n positions.push(currentPositions[3 * facet[j] + k]);\r\n }\r\n if (currentColors !== null && currentColors !== void 0) {\r\n for (var k = 0; k < 4; k++) {\r\n colors.push(currentColors[4 * facet[j] + k]);\r\n }\r\n }\r\n if (currentUVs !== null && currentUVs !== void 0) {\r\n for (var k = 0; k < 2; k++) {\r\n uvs.push(currentUVs[2 * facet[j] + k]);\r\n }\r\n }\r\n }\r\n // add new index pointer to indices array\r\n indices.push(ptr);\r\n }\r\n }\r\n }\r\n var normals = new Array();\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n //create new vertex data object and update\r\n vertex_data.positions = positions;\r\n vertex_data.indices = indices;\r\n vertex_data.normals = normals;\r\n if (currentUVs !== null && currentUVs !== void 0) {\r\n vertex_data.uvs = uvs;\r\n }\r\n if (currentColors !== null && currentColors !== void 0) {\r\n vertex_data.colors = colors;\r\n }\r\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(VertexBuffer.PositionKind));\r\n }\r\n };\r\n // Instances\r\n /** @hidden */\r\n Mesh._instancedMeshFactory = function (name, mesh) {\r\n throw _DevTools.WarnImport(\"InstancedMesh\");\r\n };\r\n /** @hidden */\r\n Mesh._PhysicsImpostorParser = function (scene, physicObject, jsonObject) {\r\n throw _DevTools.WarnImport(\"PhysicsImpostor\");\r\n };\r\n /**\r\n * Creates a new InstancedMesh object from the mesh model.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_instances\r\n * @param name defines the name of the new instance\r\n * @returns a new InstancedMesh\r\n */\r\n Mesh.prototype.createInstance = function (name) {\r\n var geometry = this.geometry;\r\n if (geometry && geometry.meshes.length > 1) {\r\n var others = geometry.meshes.slice(0);\r\n for (var _i = 0, others_1 = others; _i < others_1.length; _i++) {\r\n var other = others_1[_i];\r\n if (other === this) {\r\n continue;\r\n }\r\n other.makeGeometryUnique();\r\n }\r\n }\r\n return Mesh._instancedMeshFactory(name, this);\r\n };\r\n /**\r\n * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.\r\n * After this call, all the mesh instances have the same submeshes than the current mesh.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.synchronizeInstances = function () {\r\n if (this._geometry && this._geometry.meshes.length !== 1 && this.instances.length) {\r\n this.makeGeometryUnique();\r\n }\r\n for (var instanceIndex = 0; instanceIndex < this.instances.length; instanceIndex++) {\r\n var instance = this.instances[instanceIndex];\r\n instance._syncSubMeshes();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Optimization of the mesh's indices, in case a mesh has duplicated vertices.\r\n * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.\r\n * This should be used together with the simplification to avoid disappearing triangles.\r\n * @param successCallback an optional success callback to be called after the optimization finished.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.optimizeIndices = function (successCallback) {\r\n var _this = this;\r\n var indices = this.getIndices();\r\n var positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n if (!positions || !indices) {\r\n return this;\r\n }\r\n var vectorPositions = new Array();\r\n for (var pos = 0; pos < positions.length; pos = pos + 3) {\r\n vectorPositions.push(Vector3.FromArray(positions, pos));\r\n }\r\n var dupes = new Array();\r\n AsyncLoop.SyncAsyncForLoop(vectorPositions.length, 40, function (iteration) {\r\n var realPos = vectorPositions.length - 1 - iteration;\r\n var testedPosition = vectorPositions[realPos];\r\n for (var j = 0; j < realPos; ++j) {\r\n var againstPosition = vectorPositions[j];\r\n if (testedPosition.equals(againstPosition)) {\r\n dupes[realPos] = j;\r\n break;\r\n }\r\n }\r\n }, function () {\r\n for (var i = 0; i < indices.length; ++i) {\r\n indices[i] = dupes[indices[i]] || indices[i];\r\n }\r\n //indices are now reordered\r\n var originalSubMeshes = _this.subMeshes.slice(0);\r\n _this.setIndices(indices);\r\n _this.subMeshes = originalSubMeshes;\r\n if (successCallback) {\r\n successCallback(_this);\r\n }\r\n });\r\n return this;\r\n };\r\n /**\r\n * Serialize current mesh\r\n * @param serializationObject defines the object which will receive the serialization data\r\n */\r\n Mesh.prototype.serialize = function (serializationObject) {\r\n serializationObject.name = this.name;\r\n serializationObject.id = this.id;\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.type = this.getClassName();\r\n if (Tags && Tags.HasTags(this)) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n serializationObject.position = this.position.asArray();\r\n if (this.rotationQuaternion) {\r\n serializationObject.rotationQuaternion = this.rotationQuaternion.asArray();\r\n }\r\n else if (this.rotation) {\r\n serializationObject.rotation = this.rotation.asArray();\r\n }\r\n serializationObject.scaling = this.scaling.asArray();\r\n if (this._postMultiplyPivotMatrix) {\r\n serializationObject.pivotMatrix = this.getPivotMatrix().asArray();\r\n }\r\n else {\r\n serializationObject.localMatrix = this.getPivotMatrix().asArray();\r\n }\r\n serializationObject.isEnabled = this.isEnabled(false);\r\n serializationObject.isVisible = this.isVisible;\r\n serializationObject.infiniteDistance = this.infiniteDistance;\r\n serializationObject.pickable = this.isPickable;\r\n serializationObject.receiveShadows = this.receiveShadows;\r\n serializationObject.billboardMode = this.billboardMode;\r\n serializationObject.visibility = this.visibility;\r\n serializationObject.checkCollisions = this.checkCollisions;\r\n serializationObject.isBlocker = this.isBlocker;\r\n serializationObject.overrideMaterialSideOrientation = this.overrideMaterialSideOrientation;\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n // Geometry\r\n serializationObject.isUnIndexed = this.isUnIndexed;\r\n var geometry = this._geometry;\r\n if (geometry) {\r\n var geometryId = geometry.id;\r\n serializationObject.geometryId = geometryId;\r\n // SubMeshes\r\n serializationObject.subMeshes = [];\r\n for (var subIndex = 0; subIndex < this.subMeshes.length; subIndex++) {\r\n var subMesh = this.subMeshes[subIndex];\r\n serializationObject.subMeshes.push({\r\n materialIndex: subMesh.materialIndex,\r\n verticesStart: subMesh.verticesStart,\r\n verticesCount: subMesh.verticesCount,\r\n indexStart: subMesh.indexStart,\r\n indexCount: subMesh.indexCount\r\n });\r\n }\r\n }\r\n // Material\r\n if (this.material) {\r\n if (!this.material.doNotSerialize) {\r\n serializationObject.materialId = this.material.id;\r\n }\r\n }\r\n else {\r\n this.material = null;\r\n }\r\n // Morph targets\r\n if (this.morphTargetManager) {\r\n serializationObject.morphTargetManagerId = this.morphTargetManager.uniqueId;\r\n }\r\n // Skeleton\r\n if (this.skeleton) {\r\n serializationObject.skeletonId = this.skeleton.id;\r\n serializationObject.numBoneInfluencers = this.numBoneInfluencers;\r\n }\r\n // Physics\r\n //TODO implement correct serialization for physics impostors.\r\n if (this.getScene()._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE)) {\r\n var impostor = this.getPhysicsImpostor();\r\n if (impostor) {\r\n serializationObject.physicsMass = impostor.getParam(\"mass\");\r\n serializationObject.physicsFriction = impostor.getParam(\"friction\");\r\n serializationObject.physicsRestitution = impostor.getParam(\"mass\");\r\n serializationObject.physicsImpostor = impostor.type;\r\n }\r\n }\r\n // Metadata\r\n if (this.metadata) {\r\n serializationObject.metadata = this.metadata;\r\n }\r\n // Instances\r\n serializationObject.instances = [];\r\n for (var index = 0; index < this.instances.length; index++) {\r\n var instance = this.instances[index];\r\n if (instance.doNotSerialize) {\r\n continue;\r\n }\r\n var serializationInstance = {\r\n name: instance.name,\r\n id: instance.id,\r\n isEnabled: instance.isEnabled(false),\r\n isVisible: instance.isVisible,\r\n isPickable: instance.isPickable,\r\n checkCollisions: instance.checkCollisions,\r\n position: instance.position.asArray(),\r\n scaling: instance.scaling.asArray()\r\n };\r\n if (instance.parent) {\r\n serializationInstance.parentId = instance.parent.id;\r\n }\r\n if (instance.rotationQuaternion) {\r\n serializationInstance.rotationQuaternion = instance.rotationQuaternion.asArray();\r\n }\r\n else if (instance.rotation) {\r\n serializationInstance.rotation = instance.rotation.asArray();\r\n }\r\n // Physics\r\n //TODO implement correct serialization for physics impostors.\r\n if (this.getScene()._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE)) {\r\n var impostor = instance.getPhysicsImpostor();\r\n if (impostor) {\r\n serializationInstance.physicsMass = impostor.getParam(\"mass\");\r\n serializationInstance.physicsFriction = impostor.getParam(\"friction\");\r\n serializationInstance.physicsRestitution = impostor.getParam(\"mass\");\r\n serializationInstance.physicsImpostor = impostor.type;\r\n }\r\n }\r\n // Metadata\r\n if (instance.metadata) {\r\n serializationInstance.metadata = instance.metadata;\r\n }\r\n serializationObject.instances.push(serializationInstance);\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(instance, serializationInstance);\r\n serializationInstance.ranges = instance.serializeAnimationRanges();\r\n }\r\n // Thin instances\r\n if (this._thinInstanceDataStorage.instancesCount && this._thinInstanceDataStorage.matrixData) {\r\n serializationObject.thinInstances = {\r\n instancesCount: this._thinInstanceDataStorage.instancesCount,\r\n matrixData: Tools.SliceToArray(this._thinInstanceDataStorage.matrixData),\r\n matrixBufferSize: this._thinInstanceDataStorage.matrixBufferSize,\r\n };\r\n if (this._userThinInstanceBuffersStorage) {\r\n var userThinInstance = {\r\n data: {},\r\n sizes: {},\r\n strides: {},\r\n };\r\n for (var kind in this._userThinInstanceBuffersStorage.data) {\r\n userThinInstance.data[kind] = Tools.SliceToArray(this._userThinInstanceBuffersStorage.data[kind]);\r\n userThinInstance.sizes[kind] = this._userThinInstanceBuffersStorage.sizes[kind];\r\n userThinInstance.strides[kind] = this._userThinInstanceBuffersStorage.strides[kind];\r\n }\r\n serializationObject.thinInstances.userThinInstance = userThinInstance;\r\n }\r\n }\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n serializationObject.ranges = this.serializeAnimationRanges();\r\n // Layer mask\r\n serializationObject.layerMask = this.layerMask;\r\n // Alpha\r\n serializationObject.alphaIndex = this.alphaIndex;\r\n serializationObject.hasVertexAlpha = this.hasVertexAlpha;\r\n // Overlay\r\n serializationObject.overlayAlpha = this.overlayAlpha;\r\n serializationObject.overlayColor = this.overlayColor.asArray();\r\n serializationObject.renderOverlay = this.renderOverlay;\r\n // Fog\r\n serializationObject.applyFog = this.applyFog;\r\n // Action Manager\r\n if (this.actionManager) {\r\n serializationObject.actions = this.actionManager.serialize(this.name);\r\n }\r\n };\r\n /** @hidden */\r\n Mesh.prototype._syncGeometryWithMorphTargetManager = function () {\r\n if (!this.geometry) {\r\n return;\r\n }\r\n this._markSubMeshesAsAttributesDirty();\r\n var morphTargetManager = this._internalMeshDataInfo._morphTargetManager;\r\n if (morphTargetManager && morphTargetManager.vertexCount) {\r\n if (morphTargetManager.vertexCount !== this.getTotalVertices()) {\r\n Logger.Error(\"Mesh is incompatible with morph targets. Targets and mesh must all have the same vertices count.\");\r\n this.morphTargetManager = null;\r\n return;\r\n }\r\n for (var index = 0; index < morphTargetManager.numInfluencers; index++) {\r\n var morphTarget = morphTargetManager.getActiveTarget(index);\r\n var positions = morphTarget.getPositions();\r\n if (!positions) {\r\n Logger.Error(\"Invalid morph target. Target must have positions.\");\r\n return;\r\n }\r\n this.geometry.setVerticesData(VertexBuffer.PositionKind + index, positions, false, 3);\r\n var normals = morphTarget.getNormals();\r\n if (normals) {\r\n this.geometry.setVerticesData(VertexBuffer.NormalKind + index, normals, false, 3);\r\n }\r\n var tangents = morphTarget.getTangents();\r\n if (tangents) {\r\n this.geometry.setVerticesData(VertexBuffer.TangentKind + index, tangents, false, 3);\r\n }\r\n var uvs = morphTarget.getUVs();\r\n if (uvs) {\r\n this.geometry.setVerticesData(VertexBuffer.UVKind + \"_\" + index, uvs, false, 2);\r\n }\r\n }\r\n }\r\n else {\r\n var index = 0;\r\n // Positions\r\n while (this.geometry.isVerticesDataPresent(VertexBuffer.PositionKind + index)) {\r\n this.geometry.removeVerticesData(VertexBuffer.PositionKind + index);\r\n if (this.geometry.isVerticesDataPresent(VertexBuffer.NormalKind + index)) {\r\n this.geometry.removeVerticesData(VertexBuffer.NormalKind + index);\r\n }\r\n if (this.geometry.isVerticesDataPresent(VertexBuffer.TangentKind + index)) {\r\n this.geometry.removeVerticesData(VertexBuffer.TangentKind + index);\r\n }\r\n if (this.geometry.isVerticesDataPresent(VertexBuffer.UVKind + index)) {\r\n this.geometry.removeVerticesData(VertexBuffer.UVKind + \"_\" + index);\r\n }\r\n index++;\r\n }\r\n }\r\n };\r\n /**\r\n * Returns a new Mesh object parsed from the source provided.\r\n * @param parsedMesh is the source\r\n * @param scene defines the hosting scene\r\n * @param rootUrl is the root URL to prefix the `delayLoadingFile` property with\r\n * @returns a new Mesh\r\n */\r\n Mesh.Parse = function (parsedMesh, scene, rootUrl) {\r\n var mesh;\r\n if (parsedMesh.type && parsedMesh.type === \"GroundMesh\") {\r\n mesh = Mesh._GroundMeshParser(parsedMesh, scene);\r\n }\r\n else {\r\n mesh = new Mesh(parsedMesh.name, scene);\r\n }\r\n mesh.id = parsedMesh.id;\r\n if (Tags) {\r\n Tags.AddTagsTo(mesh, parsedMesh.tags);\r\n }\r\n mesh.position = Vector3.FromArray(parsedMesh.position);\r\n if (parsedMesh.metadata !== undefined) {\r\n mesh.metadata = parsedMesh.metadata;\r\n }\r\n if (parsedMesh.rotationQuaternion) {\r\n mesh.rotationQuaternion = Quaternion.FromArray(parsedMesh.rotationQuaternion);\r\n }\r\n else if (parsedMesh.rotation) {\r\n mesh.rotation = Vector3.FromArray(parsedMesh.rotation);\r\n }\r\n mesh.scaling = Vector3.FromArray(parsedMesh.scaling);\r\n if (parsedMesh.localMatrix) {\r\n mesh.setPreTransformMatrix(Matrix.FromArray(parsedMesh.localMatrix));\r\n }\r\n else if (parsedMesh.pivotMatrix) {\r\n mesh.setPivotMatrix(Matrix.FromArray(parsedMesh.pivotMatrix));\r\n }\r\n mesh.setEnabled(parsedMesh.isEnabled);\r\n mesh.isVisible = parsedMesh.isVisible;\r\n mesh.infiniteDistance = parsedMesh.infiniteDistance;\r\n mesh.showBoundingBox = parsedMesh.showBoundingBox;\r\n mesh.showSubMeshesBoundingBox = parsedMesh.showSubMeshesBoundingBox;\r\n if (parsedMesh.applyFog !== undefined) {\r\n mesh.applyFog = parsedMesh.applyFog;\r\n }\r\n if (parsedMesh.pickable !== undefined) {\r\n mesh.isPickable = parsedMesh.pickable;\r\n }\r\n if (parsedMesh.alphaIndex !== undefined) {\r\n mesh.alphaIndex = parsedMesh.alphaIndex;\r\n }\r\n mesh.receiveShadows = parsedMesh.receiveShadows;\r\n mesh.billboardMode = parsedMesh.billboardMode;\r\n if (parsedMesh.visibility !== undefined) {\r\n mesh.visibility = parsedMesh.visibility;\r\n }\r\n mesh.checkCollisions = parsedMesh.checkCollisions;\r\n mesh.overrideMaterialSideOrientation = parsedMesh.overrideMaterialSideOrientation;\r\n if (parsedMesh.isBlocker !== undefined) {\r\n mesh.isBlocker = parsedMesh.isBlocker;\r\n }\r\n mesh._shouldGenerateFlatShading = parsedMesh.useFlatShading;\r\n // freezeWorldMatrix\r\n if (parsedMesh.freezeWorldMatrix) {\r\n mesh._waitingData.freezeWorldMatrix = parsedMesh.freezeWorldMatrix;\r\n }\r\n // Parent\r\n if (parsedMesh.parentId) {\r\n mesh._waitingParentId = parsedMesh.parentId;\r\n }\r\n // Actions\r\n if (parsedMesh.actions !== undefined) {\r\n mesh._waitingData.actions = parsedMesh.actions;\r\n }\r\n // Overlay\r\n if (parsedMesh.overlayAlpha !== undefined) {\r\n mesh.overlayAlpha = parsedMesh.overlayAlpha;\r\n }\r\n if (parsedMesh.overlayColor !== undefined) {\r\n mesh.overlayColor = Color3.FromArray(parsedMesh.overlayColor);\r\n }\r\n if (parsedMesh.renderOverlay !== undefined) {\r\n mesh.renderOverlay = parsedMesh.renderOverlay;\r\n }\r\n // Geometry\r\n mesh.isUnIndexed = !!parsedMesh.isUnIndexed;\r\n mesh.hasVertexAlpha = parsedMesh.hasVertexAlpha;\r\n if (parsedMesh.delayLoadingFile) {\r\n mesh.delayLoadState = 4;\r\n mesh.delayLoadingFile = rootUrl + parsedMesh.delayLoadingFile;\r\n mesh._boundingInfo = new BoundingInfo(Vector3.FromArray(parsedMesh.boundingBoxMinimum), Vector3.FromArray(parsedMesh.boundingBoxMaximum));\r\n if (parsedMesh._binaryInfo) {\r\n mesh._binaryInfo = parsedMesh._binaryInfo;\r\n }\r\n mesh._delayInfo = [];\r\n if (parsedMesh.hasUVs) {\r\n mesh._delayInfo.push(VertexBuffer.UVKind);\r\n }\r\n if (parsedMesh.hasUVs2) {\r\n mesh._delayInfo.push(VertexBuffer.UV2Kind);\r\n }\r\n if (parsedMesh.hasUVs3) {\r\n mesh._delayInfo.push(VertexBuffer.UV3Kind);\r\n }\r\n if (parsedMesh.hasUVs4) {\r\n mesh._delayInfo.push(VertexBuffer.UV4Kind);\r\n }\r\n if (parsedMesh.hasUVs5) {\r\n mesh._delayInfo.push(VertexBuffer.UV5Kind);\r\n }\r\n if (parsedMesh.hasUVs6) {\r\n mesh._delayInfo.push(VertexBuffer.UV6Kind);\r\n }\r\n if (parsedMesh.hasColors) {\r\n mesh._delayInfo.push(VertexBuffer.ColorKind);\r\n }\r\n if (parsedMesh.hasMatricesIndices) {\r\n mesh._delayInfo.push(VertexBuffer.MatricesIndicesKind);\r\n }\r\n if (parsedMesh.hasMatricesWeights) {\r\n mesh._delayInfo.push(VertexBuffer.MatricesWeightsKind);\r\n }\r\n mesh._delayLoadingFunction = Geometry._ImportGeometry;\r\n if (SceneLoaderFlags.ForceFullSceneLoadingForIncremental) {\r\n mesh._checkDelayState();\r\n }\r\n }\r\n else {\r\n Geometry._ImportGeometry(parsedMesh, mesh);\r\n }\r\n // Material\r\n if (parsedMesh.materialId) {\r\n mesh.setMaterialByID(parsedMesh.materialId);\r\n }\r\n else {\r\n mesh.material = null;\r\n }\r\n // Morph targets\r\n if (parsedMesh.morphTargetManagerId > -1) {\r\n mesh.morphTargetManager = scene.getMorphTargetManagerById(parsedMesh.morphTargetManagerId);\r\n }\r\n // Skeleton\r\n if (parsedMesh.skeletonId !== undefined && parsedMesh.skeletonId !== null) {\r\n mesh.skeleton = scene.getLastSkeletonByID(parsedMesh.skeletonId);\r\n if (parsedMesh.numBoneInfluencers) {\r\n mesh.numBoneInfluencers = parsedMesh.numBoneInfluencers;\r\n }\r\n }\r\n // Animations\r\n if (parsedMesh.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedMesh.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedMesh.animations[animationIndex];\r\n var internalClass = _TypeStore.GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n mesh.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n Node.ParseAnimationRanges(mesh, parsedMesh, scene);\r\n }\r\n if (parsedMesh.autoAnimate) {\r\n scene.beginAnimation(mesh, parsedMesh.autoAnimateFrom, parsedMesh.autoAnimateTo, parsedMesh.autoAnimateLoop, parsedMesh.autoAnimateSpeed || 1.0);\r\n }\r\n // Layer Mask\r\n if (parsedMesh.layerMask && (!isNaN(parsedMesh.layerMask))) {\r\n mesh.layerMask = Math.abs(parseInt(parsedMesh.layerMask));\r\n }\r\n else {\r\n mesh.layerMask = 0x0FFFFFFF;\r\n }\r\n // Physics\r\n if (parsedMesh.physicsImpostor) {\r\n Mesh._PhysicsImpostorParser(scene, mesh, parsedMesh);\r\n }\r\n // Levels\r\n if (parsedMesh.lodMeshIds) {\r\n mesh._waitingData.lods = {\r\n ids: parsedMesh.lodMeshIds,\r\n distances: (parsedMesh.lodDistances) ? parsedMesh.lodDistances : null,\r\n coverages: (parsedMesh.lodCoverages) ? parsedMesh.lodCoverages : null\r\n };\r\n }\r\n // Instances\r\n if (parsedMesh.instances) {\r\n for (var index = 0; index < parsedMesh.instances.length; index++) {\r\n var parsedInstance = parsedMesh.instances[index];\r\n var instance = mesh.createInstance(parsedInstance.name);\r\n if (parsedInstance.id) {\r\n instance.id = parsedInstance.id;\r\n }\r\n if (Tags) {\r\n if (parsedInstance.tags) {\r\n Tags.AddTagsTo(instance, parsedInstance.tags);\r\n }\r\n else {\r\n Tags.AddTagsTo(instance, parsedMesh.tags);\r\n }\r\n }\r\n instance.position = Vector3.FromArray(parsedInstance.position);\r\n if (parsedInstance.metadata !== undefined) {\r\n instance.metadata = parsedInstance.metadata;\r\n }\r\n if (parsedInstance.parentId) {\r\n instance._waitingParentId = parsedInstance.parentId;\r\n }\r\n if (parsedInstance.isEnabled !== undefined && parsedInstance.isEnabled !== null) {\r\n instance.setEnabled(parsedInstance.isEnabled);\r\n }\r\n if (parsedInstance.isVisible !== undefined && parsedInstance.isVisible !== null) {\r\n instance.isVisible = parsedInstance.isVisible;\r\n }\r\n if (parsedInstance.isPickable !== undefined && parsedInstance.isPickable !== null) {\r\n instance.isPickable = parsedInstance.isPickable;\r\n }\r\n if (parsedInstance.rotationQuaternion) {\r\n instance.rotationQuaternion = Quaternion.FromArray(parsedInstance.rotationQuaternion);\r\n }\r\n else if (parsedInstance.rotation) {\r\n instance.rotation = Vector3.FromArray(parsedInstance.rotation);\r\n }\r\n instance.scaling = Vector3.FromArray(parsedInstance.scaling);\r\n if (parsedInstance.checkCollisions != undefined && parsedInstance.checkCollisions != null) {\r\n instance.checkCollisions = parsedInstance.checkCollisions;\r\n }\r\n if (parsedInstance.pickable != undefined && parsedInstance.pickable != null) {\r\n instance.isPickable = parsedInstance.pickable;\r\n }\r\n if (parsedInstance.showBoundingBox != undefined && parsedInstance.showBoundingBox != null) {\r\n instance.showBoundingBox = parsedInstance.showBoundingBox;\r\n }\r\n if (parsedInstance.showSubMeshesBoundingBox != undefined && parsedInstance.showSubMeshesBoundingBox != null) {\r\n instance.showSubMeshesBoundingBox = parsedInstance.showSubMeshesBoundingBox;\r\n }\r\n if (parsedInstance.alphaIndex != undefined && parsedInstance.showSubMeshesBoundingBox != null) {\r\n instance.alphaIndex = parsedInstance.alphaIndex;\r\n }\r\n // Physics\r\n if (parsedInstance.physicsImpostor) {\r\n Mesh._PhysicsImpostorParser(scene, instance, parsedInstance);\r\n }\r\n // Animation\r\n if (parsedInstance.animations) {\r\n for (animationIndex = 0; animationIndex < parsedInstance.animations.length; animationIndex++) {\r\n parsedAnimation = parsedInstance.animations[animationIndex];\r\n var internalClass = _TypeStore.GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n instance.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n Node.ParseAnimationRanges(instance, parsedInstance, scene);\r\n if (parsedInstance.autoAnimate) {\r\n scene.beginAnimation(instance, parsedInstance.autoAnimateFrom, parsedInstance.autoAnimateTo, parsedInstance.autoAnimateLoop, parsedInstance.autoAnimateSpeed || 1.0);\r\n }\r\n }\r\n }\r\n }\r\n // Thin instances\r\n if (parsedMesh.thinInstances) {\r\n var thinInstances = parsedMesh.thinInstances;\r\n if (thinInstances.matrixData) {\r\n mesh.thinInstanceSetBuffer(\"matrix\", new Float32Array(thinInstances.matrixData), 16, false);\r\n mesh._thinInstanceDataStorage.matrixBufferSize = thinInstances.matrixBufferSize;\r\n mesh._thinInstanceDataStorage.instancesCount = thinInstances.instancesCount;\r\n }\r\n else {\r\n mesh._thinInstanceDataStorage.matrixBufferSize = thinInstances.matrixBufferSize;\r\n }\r\n if (parsedMesh.thinInstances.userThinInstance) {\r\n var userThinInstance = parsedMesh.thinInstances.userThinInstance;\r\n for (var kind in userThinInstance.data) {\r\n mesh.thinInstanceSetBuffer(kind, new Float32Array(userThinInstance.data[kind]), userThinInstance.strides[kind], false);\r\n mesh._userThinInstanceBuffersStorage.sizes[kind] = userThinInstance.sizes[kind];\r\n }\r\n }\r\n }\r\n return mesh;\r\n };\r\n /**\r\n * Creates a ribbon mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @param name defines the name of the mesh to create\r\n * @param pathArray is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.\r\n * @param closeArray creates a seam between the first and the last paths of the path array (default is false)\r\n * @param closePath creates a seam between the first and the last points of each path of the path array\r\n * @param offset is taken in account only if the `pathArray` is containing a single path\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance defines an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#ribbon)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateRibbon = function (name, pathArray, closeArray, closePath, offset, scene, updatable, sideOrientation, instance) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a plane polygonal mesh. By default, this is a disc. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param radius sets the radius size (float) of the polygon (default 0.5)\r\n * @param tessellation sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateDisc = function (name, radius, tessellation, scene, updatable, sideOrientation) {\r\n if (scene === void 0) { scene = null; }\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a box mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param size sets the size (float) of each box side (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateBox = function (name, size, scene, updatable, sideOrientation) {\r\n if (scene === void 0) { scene = null; }\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a sphere mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * @param diameter sets the diameter size (float) of the sphere (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateSphere = function (name, segments, diameter, scene, updatable, sideOrientation) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a hemisphere mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * @param diameter sets the diameter size (float) of the sphere (default 1)\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateHemisphere = function (name, segments, diameter, scene) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a cylinder or a cone mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param height sets the height size (float) of the cylinder/cone (float, default 2)\r\n * @param diameterTop set the top cap diameter (floats, default 1)\r\n * @param diameterBottom set the bottom cap diameter (floats, default 1). This value can't be zero\r\n * @param tessellation sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance\r\n * @param subdivisions sets the number of rings along the cylinder height (positive integer, default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateCylinder = function (name, height, diameterTop, diameterBottom, tessellation, subdivisions, scene, updatable, sideOrientation) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n // Torus (Code from SharpDX.org)\r\n /**\r\n * Creates a torus mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param diameter sets the diameter size (float) of the torus (default 1)\r\n * @param thickness sets the diameter size of the tube of the torus (float, default 0.5)\r\n * @param tessellation sets the number of torus sides (postive integer, default 16)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTorus = function (name, diameter, thickness, tessellation, scene, updatable, sideOrientation) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a torus knot mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param radius sets the global radius size (float) of the torus knot (default 2)\r\n * @param tube sets the diameter size of the tube of the torus (float, default 0.5)\r\n * @param radialSegments sets the number of sides on each tube segments (positive integer, default 32)\r\n * @param tubularSegments sets the number of tubes to decompose the knot into (positive integer, default 32)\r\n * @param p the number of windings on X axis (positive integers, default 2)\r\n * @param q the number of windings on Y axis (positive integers, default 3)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTorusKnot = function (name, radius, tube, radialSegments, tubularSegments, p, q, scene, updatable, sideOrientation) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a line mesh. Please consider using the same method from the MeshBuilder class instead.\r\n * @param name defines the name of the mesh to create\r\n * @param points is an array successive Vector3\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines).\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateLines = function (name, points, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (instance === void 0) { instance = null; }\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a dashed line mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param points is an array successive Vector3\r\n * @param dashSize is the size of the dashes relatively the dash number (positive float, default 3)\r\n * @param gapSize is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * @param dashNb is the intended total number of dashes (positive integer, default 200)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateDashedLines = function (name, points, dashSize, gapSize, dashNb, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a polygon mesh.Please consider using the same method from the MeshBuilder class instead\r\n * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.\r\n * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors.\r\n * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * Remember you can only change the shape positions, not their number when updating a polygon.\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#non-regular-polygon\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * @param scene defines the hosting scene\r\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreatePolygon = function (name, shape, scene, holes, updatable, sideOrientation, earcutInjection) {\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates an extruded polygon mesh, with depth in the Y direction. Please consider using the same method from the MeshBuilder class instead.\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-non-regular-polygon\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * @param depth defines the height of extrusion\r\n * @param scene defines the hosting scene\r\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns a new Mesh\r\n */\r\n Mesh.ExtrudePolygon = function (name, shape, depth, scene, holes, updatable, sideOrientation, earcutInjection) {\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates an extruded shape mesh.\r\n * The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters. Please consider using the same method from the MeshBuilder class instead\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\r\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\r\n * @param scale is the value to scale the shape\r\n * @param rotation is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#extruded-shape)\r\n * @returns a new Mesh\r\n */\r\n Mesh.ExtrudeShape = function (name, shape, path, scale, rotation, cap, scene, updatable, sideOrientation, instance) {\r\n if (scene === void 0) { scene = null; }\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates an custom extruded shape mesh.\r\n * The custom extrusion is a parametric shape.\r\n * It has no predefined shape. Its final shape will depend on the input parameters.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\r\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\r\n * @param scaleFunction is a custom Javascript function called on each path point\r\n * @param rotationFunction is a custom Javascript function called on each path point\r\n * @param ribbonCloseArray forces the extrusion underlying ribbon to close all the paths in its `pathArray`\r\n * @param ribbonClosePath forces the extrusion underlying ribbon to close its `pathArray`\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape)\r\n * @returns a new Mesh\r\n */\r\n Mesh.ExtrudeShapeCustom = function (name, shape, path, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, scene, updatable, sideOrientation, instance) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates lathe mesh.\r\n * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\r\n * @param radius is the radius value of the lathe\r\n * @param tessellation is the side number of the lathe.\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateLathe = function (name, shape, radius, tessellation, scene, updatable, sideOrientation) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a plane mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param size sets the size (float) of both sides of the plane at once (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreatePlane = function (name, size, scene, updatable, sideOrientation) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a ground mesh.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param width set the width of the ground\r\n * @param height set the height of the ground\r\n * @param subdivisions sets the number of subdivisions per side\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateGround = function (name, width, height, subdivisions, scene, updatable) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a tiled ground mesh.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param xmin set the ground minimum X coordinate\r\n * @param zmin set the ground minimum Y coordinate\r\n * @param xmax set the ground maximum X coordinate\r\n * @param zmax set the ground maximum Z coordinate\r\n * @param subdivisions is an object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * @param precision is an object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTiledGround = function (name, xmin, zmin, xmax, zmax, subdivisions, precision, scene, updatable) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a ground mesh from a height map.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @see https://doc.babylonjs.com/babylon101/height_map\r\n * @param name defines the name of the mesh to create\r\n * @param url sets the URL of the height map image resource\r\n * @param width set the ground width size\r\n * @param height set the ground height size\r\n * @param subdivisions sets the number of subdivision per side\r\n * @param minHeight is the minimum altitude on the ground\r\n * @param maxHeight is the maximum altitude on the ground\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param onReady is a callback function that will be called once the mesh is built (the height map download can last some time)\r\n * @param alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateGroundFromHeightMap = function (name, url, width, height, subdivisions, minHeight, maxHeight, scene, updatable, onReady, alphaFilter) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a tube mesh.\r\n * The tube is a parametric shape.\r\n * It has no predefined shape. Its final shape will depend on the input parameters.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @param name defines the name of the mesh to create\r\n * @param path is a required array of successive Vector3. It is the curve used as the axis of the tube\r\n * @param radius sets the tube radius size\r\n * @param tessellation is the number of sides on the tubular surface\r\n * @param radiusFunction is a custom function. If it is not null, it overwrittes the parameter `radius`. This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing Tube object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#tube)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTube = function (name, path, radius, tessellation, radiusFunction, cap, scene, updatable, sideOrientation, instance) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a polyhedron mesh.\r\n * Please consider using the same method from the MeshBuilder class instead.\r\n * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type\r\n * * The parameter `size` (positive float, default 1) sets the polygon size\r\n * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)\r\n * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`\r\n * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron\r\n * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)\r\n * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored\r\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh to create\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreatePolyhedron = function (name, options, scene) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\r\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\r\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`)\r\n * * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\r\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\r\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n * @see https://doc.babylonjs.com/how_to/polyhedra_shapes#icosphere\r\n */\r\n Mesh.CreateIcoSphere = function (name, options, scene) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a decal mesh.\r\n * Please consider using the same method from the MeshBuilder class instead.\r\n * A decal is a mesh usually applied as a model onto the surface of another mesh\r\n * @param name defines the name of the mesh\r\n * @param sourceMesh defines the mesh receiving the decal\r\n * @param position sets the position of the decal in world coordinates\r\n * @param normal sets the normal of the mesh where the decal is applied onto in world coordinates\r\n * @param size sets the decal scaling\r\n * @param angle sets the angle to rotate the decal\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateDecal = function (name, sourceMesh, position, normal, size, angle) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /** Creates a Capsule Mesh\r\n * @param name defines the name of the mesh.\r\n * @param options the constructors options used to shape the mesh.\r\n * @param scene defines the scene the mesh is scoped to.\r\n * @returns the capsule mesh\r\n * @see https://doc.babylonjs.com/how_to/capsule_shape\r\n */\r\n Mesh.CreateCapsule = function (name, options, scene) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n // Skeletons\r\n /**\r\n * Prepare internal position array for software CPU skinning\r\n * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh\r\n */\r\n Mesh.prototype.setPositionsForCPUSkinning = function () {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._sourcePositions) {\r\n var source = this.getVerticesData(VertexBuffer.PositionKind);\r\n if (!source) {\r\n return internalDataInfo._sourcePositions;\r\n }\r\n internalDataInfo._sourcePositions = new Float32Array(source);\r\n if (!this.isVertexBufferUpdatable(VertexBuffer.PositionKind)) {\r\n this.setVerticesData(VertexBuffer.PositionKind, source, true);\r\n }\r\n }\r\n return internalDataInfo._sourcePositions;\r\n };\r\n /**\r\n * Prepare internal normal array for software CPU skinning\r\n * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.\r\n */\r\n Mesh.prototype.setNormalsForCPUSkinning = function () {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._sourceNormals) {\r\n var source = this.getVerticesData(VertexBuffer.NormalKind);\r\n if (!source) {\r\n return internalDataInfo._sourceNormals;\r\n }\r\n internalDataInfo._sourceNormals = new Float32Array(source);\r\n if (!this.isVertexBufferUpdatable(VertexBuffer.NormalKind)) {\r\n this.setVerticesData(VertexBuffer.NormalKind, source, true);\r\n }\r\n }\r\n return internalDataInfo._sourceNormals;\r\n };\r\n /**\r\n * Updates the vertex buffer by applying transformation from the bones\r\n * @param skeleton defines the skeleton to apply to current mesh\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.applySkeleton = function (skeleton) {\r\n if (!this.geometry) {\r\n return this;\r\n }\r\n if (this.geometry._softwareSkinningFrameId == this.getScene().getFrameId()) {\r\n return this;\r\n }\r\n this.geometry._softwareSkinningFrameId = this.getScene().getFrameId();\r\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\r\n return this;\r\n }\r\n if (!this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\r\n return this;\r\n }\r\n if (!this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\r\n return this;\r\n }\r\n var hasNormals = this.isVerticesDataPresent(VertexBuffer.NormalKind);\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._sourcePositions) {\r\n var submeshes = this.subMeshes.slice();\r\n this.setPositionsForCPUSkinning();\r\n this.subMeshes = submeshes;\r\n }\r\n if (hasNormals && !internalDataInfo._sourceNormals) {\r\n this.setNormalsForCPUSkinning();\r\n }\r\n // positionsData checks for not being Float32Array will only pass at most once\r\n var positionsData = this.getVerticesData(VertexBuffer.PositionKind);\r\n if (!positionsData) {\r\n return this;\r\n }\r\n if (!(positionsData instanceof Float32Array)) {\r\n positionsData = new Float32Array(positionsData);\r\n }\r\n // normalsData checks for not being Float32Array will only pass at most once\r\n var normalsData = this.getVerticesData(VertexBuffer.NormalKind);\r\n if (hasNormals) {\r\n if (!normalsData) {\r\n return this;\r\n }\r\n if (!(normalsData instanceof Float32Array)) {\r\n normalsData = new Float32Array(normalsData);\r\n }\r\n }\r\n var matricesIndicesData = this.getVerticesData(VertexBuffer.MatricesIndicesKind);\r\n var matricesWeightsData = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\r\n if (!matricesWeightsData || !matricesIndicesData) {\r\n return this;\r\n }\r\n var needExtras = this.numBoneInfluencers > 4;\r\n var matricesIndicesExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\r\n var matricesWeightsExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\r\n var skeletonMatrices = skeleton.getTransformMatrices(this);\r\n var tempVector3 = Vector3.Zero();\r\n var finalMatrix = new Matrix();\r\n var tempMatrix = new Matrix();\r\n var matWeightIdx = 0;\r\n var inf;\r\n for (var index = 0; index < positionsData.length; index += 3, matWeightIdx += 4) {\r\n var weight;\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n if (needExtras) {\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsExtraData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesExtraData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n }\r\n Vector3.TransformCoordinatesFromFloatsToRef(internalDataInfo._sourcePositions[index], internalDataInfo._sourcePositions[index + 1], internalDataInfo._sourcePositions[index + 2], finalMatrix, tempVector3);\r\n tempVector3.toArray(positionsData, index);\r\n if (hasNormals) {\r\n Vector3.TransformNormalFromFloatsToRef(internalDataInfo._sourceNormals[index], internalDataInfo._sourceNormals[index + 1], internalDataInfo._sourceNormals[index + 2], finalMatrix, tempVector3);\r\n tempVector3.toArray(normalsData, index);\r\n }\r\n finalMatrix.reset();\r\n }\r\n this.updateVerticesData(VertexBuffer.PositionKind, positionsData);\r\n if (hasNormals) {\r\n this.updateVerticesData(VertexBuffer.NormalKind, normalsData);\r\n }\r\n return this;\r\n };\r\n // Tools\r\n /**\r\n * Returns an object containing a min and max Vector3 which are the minimum and maximum vectors of each mesh bounding box from the passed array, in the world coordinates\r\n * @param meshes defines the list of meshes to scan\r\n * @returns an object `{min:` Vector3`, max:` Vector3`}`\r\n */\r\n Mesh.MinMax = function (meshes) {\r\n var minVector = null;\r\n var maxVector = null;\r\n meshes.forEach(function (mesh) {\r\n var boundingInfo = mesh.getBoundingInfo();\r\n var boundingBox = boundingInfo.boundingBox;\r\n if (!minVector || !maxVector) {\r\n minVector = boundingBox.minimumWorld;\r\n maxVector = boundingBox.maximumWorld;\r\n }\r\n else {\r\n minVector.minimizeInPlace(boundingBox.minimumWorld);\r\n maxVector.maximizeInPlace(boundingBox.maximumWorld);\r\n }\r\n });\r\n if (!minVector || !maxVector) {\r\n return {\r\n min: Vector3.Zero(),\r\n max: Vector3.Zero()\r\n };\r\n }\r\n return {\r\n min: minVector,\r\n max: maxVector\r\n };\r\n };\r\n /**\r\n * Returns the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array\r\n * @param meshesOrMinMaxVector could be an array of meshes or a `{min:` Vector3`, max:` Vector3`}` object\r\n * @returns a vector3\r\n */\r\n Mesh.Center = function (meshesOrMinMaxVector) {\r\n var minMaxVector = (meshesOrMinMaxVector instanceof Array) ? Mesh.MinMax(meshesOrMinMaxVector) : meshesOrMinMaxVector;\r\n return Vector3.Center(minMaxVector.min, minMaxVector.max);\r\n };\r\n /**\r\n * Merge the array of meshes into a single mesh for performance reasons.\r\n * @param meshes defines he vertices source. They should all be of the same material. Entries can empty\r\n * @param disposeSource when true (default), dispose of the vertices from the source meshes\r\n * @param allow32BitsIndices when the sum of the vertices > 64k, this must be set to true\r\n * @param meshSubclass when set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.\r\n * @param subdivideWithSubMeshes when true (false default), subdivide mesh to his subMesh array with meshes source.\r\n * @param multiMultiMaterials when true (false default), subdivide mesh and accept multiple multi materials, ignores subdivideWithSubMeshes.\r\n * @returns a new mesh\r\n */\r\n Mesh.MergeMeshes = function (meshes, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials) {\r\n if (disposeSource === void 0) { disposeSource = true; }\r\n var index;\r\n if (!allow32BitsIndices) {\r\n var totalVertices = 0;\r\n // Counting vertices\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n totalVertices += meshes[index].getTotalVertices();\r\n if (totalVertices >= 65536) {\r\n Logger.Warn(\"Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices\");\r\n return null;\r\n }\r\n }\r\n }\r\n }\r\n if (multiMultiMaterials) {\r\n var newMultiMaterial = null;\r\n var subIndex;\r\n var matIndex;\r\n subdivideWithSubMeshes = false;\r\n }\r\n var materialArray = new Array();\r\n var materialIndexArray = new Array();\r\n // Merge\r\n var vertexData = null;\r\n var otherVertexData;\r\n var indiceArray = new Array();\r\n var source = null;\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n var mesh = meshes[index];\r\n if (mesh.isAnInstance) {\r\n Logger.Warn(\"Cannot merge instance meshes.\");\r\n return null;\r\n }\r\n var wm = mesh.computeWorldMatrix(true);\r\n otherVertexData = VertexData.ExtractFromMesh(mesh, true, true);\r\n otherVertexData.transform(wm);\r\n if (vertexData) {\r\n vertexData.merge(otherVertexData, allow32BitsIndices);\r\n }\r\n else {\r\n vertexData = otherVertexData;\r\n source = mesh;\r\n }\r\n if (subdivideWithSubMeshes) {\r\n indiceArray.push(mesh.getTotalIndices());\r\n }\r\n if (multiMultiMaterials) {\r\n if (mesh.material) {\r\n var material = mesh.material;\r\n if (material instanceof MultiMaterial) {\r\n for (matIndex = 0; matIndex < material.subMaterials.length; matIndex++) {\r\n if (materialArray.indexOf(material.subMaterials[matIndex]) < 0) {\r\n materialArray.push(material.subMaterials[matIndex]);\r\n }\r\n }\r\n for (subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\r\n materialIndexArray.push(materialArray.indexOf(material.subMaterials[mesh.subMeshes[subIndex].materialIndex]));\r\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\r\n }\r\n }\r\n else {\r\n if (materialArray.indexOf(material) < 0) {\r\n materialArray.push(material);\r\n }\r\n for (subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\r\n materialIndexArray.push(materialArray.indexOf(material));\r\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\r\n }\r\n }\r\n }\r\n else {\r\n for (subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\r\n materialIndexArray.push(0);\r\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n source = source;\r\n if (!meshSubclass) {\r\n meshSubclass = new Mesh(source.name + \"_merged\", source.getScene());\r\n }\r\n vertexData.applyToMesh(meshSubclass);\r\n // Setting properties\r\n meshSubclass.checkCollisions = source.checkCollisions;\r\n meshSubclass.overrideMaterialSideOrientation = source.overrideMaterialSideOrientation;\r\n // Cleaning\r\n if (disposeSource) {\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n meshes[index].dispose();\r\n }\r\n }\r\n }\r\n // Subdivide\r\n if (subdivideWithSubMeshes || multiMultiMaterials) {\r\n //-- removal of global submesh\r\n meshSubclass.releaseSubMeshes();\r\n index = 0;\r\n var offset = 0;\r\n //-- apply subdivision according to index table\r\n while (index < indiceArray.length) {\r\n SubMesh.CreateFromIndices(0, offset, indiceArray[index], meshSubclass);\r\n offset += indiceArray[index];\r\n index++;\r\n }\r\n }\r\n if (multiMultiMaterials) {\r\n newMultiMaterial = new MultiMaterial(source.name + \"_merged\", source.getScene());\r\n newMultiMaterial.subMaterials = materialArray;\r\n for (subIndex = 0; subIndex < meshSubclass.subMeshes.length; subIndex++) {\r\n meshSubclass.subMeshes[subIndex].materialIndex = materialIndexArray[subIndex];\r\n }\r\n meshSubclass.material = newMultiMaterial;\r\n }\r\n else {\r\n meshSubclass.material = source.material;\r\n }\r\n return meshSubclass;\r\n };\r\n /** @hidden */\r\n Mesh.prototype.addInstance = function (instance) {\r\n instance._indexInSourceMeshInstanceArray = this.instances.length;\r\n this.instances.push(instance);\r\n };\r\n /** @hidden */\r\n Mesh.prototype.removeInstance = function (instance) {\r\n // Remove from mesh\r\n var index = instance._indexInSourceMeshInstanceArray;\r\n if (index != -1) {\r\n if (index !== this.instances.length - 1) {\r\n var last = this.instances[this.instances.length - 1];\r\n this.instances[index] = last;\r\n last._indexInSourceMeshInstanceArray = index;\r\n }\r\n instance._indexInSourceMeshInstanceArray = -1;\r\n this.instances.pop();\r\n }\r\n };\r\n // Consts\r\n /**\r\n * Mesh side orientation : usually the external or front surface\r\n */\r\n Mesh.FRONTSIDE = VertexData.FRONTSIDE;\r\n /**\r\n * Mesh side orientation : usually the internal or back surface\r\n */\r\n Mesh.BACKSIDE = VertexData.BACKSIDE;\r\n /**\r\n * Mesh side orientation : both internal and external or front and back surfaces\r\n */\r\n Mesh.DOUBLESIDE = VertexData.DOUBLESIDE;\r\n /**\r\n * Mesh side orientation : by default, `FRONTSIDE`\r\n */\r\n Mesh.DEFAULTSIDE = VertexData.DEFAULTSIDE;\r\n /**\r\n * Mesh cap setting : no cap\r\n */\r\n Mesh.NO_CAP = 0;\r\n /**\r\n * Mesh cap setting : one cap at the beginning of the mesh\r\n */\r\n Mesh.CAP_START = 1;\r\n /**\r\n * Mesh cap setting : one cap at the end of the mesh\r\n */\r\n Mesh.CAP_END = 2;\r\n /**\r\n * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh\r\n */\r\n Mesh.CAP_ALL = 3;\r\n /**\r\n * Mesh pattern setting : no flip or rotate\r\n */\r\n Mesh.NO_FLIP = 0;\r\n /**\r\n * Mesh pattern setting : flip (reflect in y axis) alternate tiles on each row or column\r\n */\r\n Mesh.FLIP_TILE = 1;\r\n /**\r\n * Mesh pattern setting : rotate (180degs) alternate tiles on each row or column\r\n */\r\n Mesh.ROTATE_TILE = 2;\r\n /**\r\n * Mesh pattern setting : flip (reflect in y axis) all tiles on alternate rows\r\n */\r\n Mesh.FLIP_ROW = 3;\r\n /**\r\n * Mesh pattern setting : rotate (180degs) all tiles on alternate rows\r\n */\r\n Mesh.ROTATE_ROW = 4;\r\n /**\r\n * Mesh pattern setting : flip and rotate alternate tiles on each row or column\r\n */\r\n Mesh.FLIP_N_ROTATE_TILE = 5;\r\n /**\r\n * Mesh pattern setting : rotate pattern and rotate\r\n */\r\n Mesh.FLIP_N_ROTATE_ROW = 6;\r\n /**\r\n * Mesh tile positioning : part tiles same on left/right or top/bottom\r\n */\r\n Mesh.CENTER = 0;\r\n /**\r\n * Mesh tile positioning : part tiles on left\r\n */\r\n Mesh.LEFT = 1;\r\n /**\r\n * Mesh tile positioning : part tiles on right\r\n */\r\n Mesh.RIGHT = 2;\r\n /**\r\n * Mesh tile positioning : part tiles on top\r\n */\r\n Mesh.TOP = 3;\r\n /**\r\n * Mesh tile positioning : part tiles on bottom\r\n */\r\n Mesh.BOTTOM = 4;\r\n // Statics\r\n /** @hidden */\r\n Mesh._GroundMeshParser = function (parsedMesh, scene) {\r\n throw _DevTools.WarnImport(\"GroundMesh\");\r\n };\r\n return Mesh;\r\n}(AbstractMesh));\r\nexport { Mesh };\r\n_TypeStore.RegisteredTypes[\"BABYLON.Mesh\"] = Mesh;\r\n//# sourceMappingURL=mesh.js.map","import { Vector3, Vector4 } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { _DevTools } from '../Misc/devTools';\r\nimport { Color4 } from '../Maths/math.color';\r\nimport { Logger } from '../Misc/logger';\r\n/**\r\n * This class contains the various kinds of data on every vertex of a mesh used in determining its shape and appearance\r\n */\r\nvar VertexData = /** @class */ (function () {\r\n function VertexData() {\r\n }\r\n /**\r\n * Uses the passed data array to set the set the values for the specified kind of data\r\n * @param data a linear array of floating numbers\r\n * @param kind the type of data that is being set, eg positions, colors etc\r\n */\r\n VertexData.prototype.set = function (data, kind) {\r\n if (!data.length) {\r\n Logger.Warn(\"Setting vertex data kind '\" + kind + \"' with an empty array\");\r\n }\r\n switch (kind) {\r\n case VertexBuffer.PositionKind:\r\n this.positions = data;\r\n break;\r\n case VertexBuffer.NormalKind:\r\n this.normals = data;\r\n break;\r\n case VertexBuffer.TangentKind:\r\n this.tangents = data;\r\n break;\r\n case VertexBuffer.UVKind:\r\n this.uvs = data;\r\n break;\r\n case VertexBuffer.UV2Kind:\r\n this.uvs2 = data;\r\n break;\r\n case VertexBuffer.UV3Kind:\r\n this.uvs3 = data;\r\n break;\r\n case VertexBuffer.UV4Kind:\r\n this.uvs4 = data;\r\n break;\r\n case VertexBuffer.UV5Kind:\r\n this.uvs5 = data;\r\n break;\r\n case VertexBuffer.UV6Kind:\r\n this.uvs6 = data;\r\n break;\r\n case VertexBuffer.ColorKind:\r\n this.colors = data;\r\n break;\r\n case VertexBuffer.MatricesIndicesKind:\r\n this.matricesIndices = data;\r\n break;\r\n case VertexBuffer.MatricesWeightsKind:\r\n this.matricesWeights = data;\r\n break;\r\n case VertexBuffer.MatricesIndicesExtraKind:\r\n this.matricesIndicesExtra = data;\r\n break;\r\n case VertexBuffer.MatricesWeightsExtraKind:\r\n this.matricesWeightsExtra = data;\r\n break;\r\n }\r\n };\r\n /**\r\n * Associates the vertexData to the passed Mesh.\r\n * Sets it as updatable or not (default `false`)\r\n * @param mesh the mesh the vertexData is applied to\r\n * @param updatable when used and having the value true allows new data to update the vertexData\r\n * @returns the VertexData\r\n */\r\n VertexData.prototype.applyToMesh = function (mesh, updatable) {\r\n this._applyTo(mesh, updatable);\r\n return this;\r\n };\r\n /**\r\n * Associates the vertexData to the passed Geometry.\r\n * Sets it as updatable or not (default `false`)\r\n * @param geometry the geometry the vertexData is applied to\r\n * @param updatable when used and having the value true allows new data to update the vertexData\r\n * @returns VertexData\r\n */\r\n VertexData.prototype.applyToGeometry = function (geometry, updatable) {\r\n this._applyTo(geometry, updatable);\r\n return this;\r\n };\r\n /**\r\n * Updates the associated mesh\r\n * @param mesh the mesh to be updated\r\n * @param updateExtends when true the mesh BoundingInfo will be renewed when and if position kind is updated, optional with default false\r\n * @param makeItUnique when true, and when and if position kind is updated, a new global geometry will be created from these positions and set to the mesh, optional with default false\r\n * @returns VertexData\r\n */\r\n VertexData.prototype.updateMesh = function (mesh) {\r\n this._update(mesh);\r\n return this;\r\n };\r\n /**\r\n * Updates the associated geometry\r\n * @param geometry the geometry to be updated\r\n * @param updateExtends when true BoundingInfo will be renewed when and if position kind is updated, optional with default false\r\n * @param makeItUnique when true, and when and if position kind is updated, a new global geometry will be created from these positions and set to the mesh, optional with default false\r\n * @returns VertexData.\r\n */\r\n VertexData.prototype.updateGeometry = function (geometry) {\r\n this._update(geometry);\r\n return this;\r\n };\r\n VertexData.prototype._applyTo = function (meshOrGeometry, updatable) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (this.positions) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.PositionKind, this.positions, updatable);\r\n }\r\n if (this.normals) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.NormalKind, this.normals, updatable);\r\n }\r\n if (this.tangents) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.TangentKind, this.tangents, updatable);\r\n }\r\n if (this.uvs) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.UVKind, this.uvs, updatable);\r\n }\r\n if (this.uvs2) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.UV2Kind, this.uvs2, updatable);\r\n }\r\n if (this.uvs3) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.UV3Kind, this.uvs3, updatable);\r\n }\r\n if (this.uvs4) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.UV4Kind, this.uvs4, updatable);\r\n }\r\n if (this.uvs5) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.UV5Kind, this.uvs5, updatable);\r\n }\r\n if (this.uvs6) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.UV6Kind, this.uvs6, updatable);\r\n }\r\n if (this.colors) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.ColorKind, this.colors, updatable);\r\n }\r\n if (this.matricesIndices) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.MatricesIndicesKind, this.matricesIndices, updatable);\r\n }\r\n if (this.matricesWeights) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.MatricesWeightsKind, this.matricesWeights, updatable);\r\n }\r\n if (this.matricesIndicesExtra) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, this.matricesIndicesExtra, updatable);\r\n }\r\n if (this.matricesWeightsExtra) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.MatricesWeightsExtraKind, this.matricesWeightsExtra, updatable);\r\n }\r\n if (this.indices) {\r\n meshOrGeometry.setIndices(this.indices, null, updatable);\r\n }\r\n else {\r\n meshOrGeometry.setIndices([], null);\r\n }\r\n return this;\r\n };\r\n VertexData.prototype._update = function (meshOrGeometry, updateExtends, makeItUnique) {\r\n if (this.positions) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.PositionKind, this.positions, updateExtends, makeItUnique);\r\n }\r\n if (this.normals) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.NormalKind, this.normals, updateExtends, makeItUnique);\r\n }\r\n if (this.tangents) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.TangentKind, this.tangents, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.UVKind, this.uvs, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs2) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.UV2Kind, this.uvs2, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs3) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.UV3Kind, this.uvs3, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs4) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.UV4Kind, this.uvs4, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs5) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.UV5Kind, this.uvs5, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs6) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.UV6Kind, this.uvs6, updateExtends, makeItUnique);\r\n }\r\n if (this.colors) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.ColorKind, this.colors, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesIndices) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.MatricesIndicesKind, this.matricesIndices, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesWeights) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.MatricesWeightsKind, this.matricesWeights, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesIndicesExtra) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.MatricesIndicesExtraKind, this.matricesIndicesExtra, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesWeightsExtra) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.MatricesWeightsExtraKind, this.matricesWeightsExtra, updateExtends, makeItUnique);\r\n }\r\n if (this.indices) {\r\n meshOrGeometry.setIndices(this.indices, null);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Transforms each position and each normal of the vertexData according to the passed Matrix\r\n * @param matrix the transforming matrix\r\n * @returns the VertexData\r\n */\r\n VertexData.prototype.transform = function (matrix) {\r\n var flip = matrix.determinant() < 0;\r\n var transformed = Vector3.Zero();\r\n var index;\r\n if (this.positions) {\r\n var position = Vector3.Zero();\r\n for (index = 0; index < this.positions.length; index += 3) {\r\n Vector3.FromArrayToRef(this.positions, index, position);\r\n Vector3.TransformCoordinatesToRef(position, matrix, transformed);\r\n this.positions[index] = transformed.x;\r\n this.positions[index + 1] = transformed.y;\r\n this.positions[index + 2] = transformed.z;\r\n }\r\n }\r\n if (this.normals) {\r\n var normal = Vector3.Zero();\r\n for (index = 0; index < this.normals.length; index += 3) {\r\n Vector3.FromArrayToRef(this.normals, index, normal);\r\n Vector3.TransformNormalToRef(normal, matrix, transformed);\r\n this.normals[index] = transformed.x;\r\n this.normals[index + 1] = transformed.y;\r\n this.normals[index + 2] = transformed.z;\r\n }\r\n }\r\n if (this.tangents) {\r\n var tangent = Vector4.Zero();\r\n var tangentTransformed = Vector4.Zero();\r\n for (index = 0; index < this.tangents.length; index += 4) {\r\n Vector4.FromArrayToRef(this.tangents, index, tangent);\r\n Vector4.TransformNormalToRef(tangent, matrix, tangentTransformed);\r\n this.tangents[index] = tangentTransformed.x;\r\n this.tangents[index + 1] = tangentTransformed.y;\r\n this.tangents[index + 2] = tangentTransformed.z;\r\n this.tangents[index + 3] = tangentTransformed.w;\r\n }\r\n }\r\n if (flip && this.indices) {\r\n for (index = 0; index < this.indices.length; index += 3) {\r\n var tmp = this.indices[index + 1];\r\n this.indices[index + 1] = this.indices[index + 2];\r\n this.indices[index + 2] = tmp;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Merges the passed VertexData into the current one\r\n * @param other the VertexData to be merged into the current one\r\n * @param use32BitsIndices defines a boolean indicating if indices must be store in a 32 bits array\r\n * @returns the modified VertexData\r\n */\r\n VertexData.prototype.merge = function (other, use32BitsIndices) {\r\n if (use32BitsIndices === void 0) { use32BitsIndices = false; }\r\n this._validate();\r\n other._validate();\r\n if (!this.normals !== !other.normals ||\r\n !this.tangents !== !other.tangents ||\r\n !this.uvs !== !other.uvs ||\r\n !this.uvs2 !== !other.uvs2 ||\r\n !this.uvs3 !== !other.uvs3 ||\r\n !this.uvs4 !== !other.uvs4 ||\r\n !this.uvs5 !== !other.uvs5 ||\r\n !this.uvs6 !== !other.uvs6 ||\r\n !this.colors !== !other.colors ||\r\n !this.matricesIndices !== !other.matricesIndices ||\r\n !this.matricesWeights !== !other.matricesWeights ||\r\n !this.matricesIndicesExtra !== !other.matricesIndicesExtra ||\r\n !this.matricesWeightsExtra !== !other.matricesWeightsExtra) {\r\n throw new Error(\"Cannot merge vertex data that do not have the same set of attributes\");\r\n }\r\n if (other.indices) {\r\n if (!this.indices) {\r\n this.indices = [];\r\n }\r\n var offset = this.positions ? this.positions.length / 3 : 0;\r\n var isSrcTypedArray = this.indices.BYTES_PER_ELEMENT !== undefined;\r\n if (isSrcTypedArray) {\r\n var len = this.indices.length + other.indices.length;\r\n var temp = use32BitsIndices || this.indices instanceof Uint32Array ? new Uint32Array(len) : new Uint16Array(len);\r\n temp.set(this.indices);\r\n var decal = this.indices.length;\r\n for (var index = 0; index < other.indices.length; index++) {\r\n temp[decal + index] = other.indices[index] + offset;\r\n }\r\n this.indices = temp;\r\n }\r\n else {\r\n for (var index = 0; index < other.indices.length; index++) {\r\n this.indices.push(other.indices[index] + offset);\r\n }\r\n }\r\n }\r\n this.positions = this._mergeElement(this.positions, other.positions);\r\n this.normals = this._mergeElement(this.normals, other.normals);\r\n this.tangents = this._mergeElement(this.tangents, other.tangents);\r\n this.uvs = this._mergeElement(this.uvs, other.uvs);\r\n this.uvs2 = this._mergeElement(this.uvs2, other.uvs2);\r\n this.uvs3 = this._mergeElement(this.uvs3, other.uvs3);\r\n this.uvs4 = this._mergeElement(this.uvs4, other.uvs4);\r\n this.uvs5 = this._mergeElement(this.uvs5, other.uvs5);\r\n this.uvs6 = this._mergeElement(this.uvs6, other.uvs6);\r\n this.colors = this._mergeElement(this.colors, other.colors);\r\n this.matricesIndices = this._mergeElement(this.matricesIndices, other.matricesIndices);\r\n this.matricesWeights = this._mergeElement(this.matricesWeights, other.matricesWeights);\r\n this.matricesIndicesExtra = this._mergeElement(this.matricesIndicesExtra, other.matricesIndicesExtra);\r\n this.matricesWeightsExtra = this._mergeElement(this.matricesWeightsExtra, other.matricesWeightsExtra);\r\n return this;\r\n };\r\n VertexData.prototype._mergeElement = function (source, other) {\r\n if (!source) {\r\n return other;\r\n }\r\n if (!other) {\r\n return source;\r\n }\r\n var len = other.length + source.length;\r\n var isSrcTypedArray = source instanceof Float32Array;\r\n var isOthTypedArray = other instanceof Float32Array;\r\n // use non-loop method when the source is Float32Array\r\n if (isSrcTypedArray) {\r\n var ret32 = new Float32Array(len);\r\n ret32.set(source);\r\n ret32.set(other, source.length);\r\n return ret32;\r\n // source is number[], when other is also use concat\r\n }\r\n else if (!isOthTypedArray) {\r\n return source.concat(other);\r\n // source is a number[], but other is a Float32Array, loop required\r\n }\r\n else {\r\n var ret = source.slice(0); // copy source to a separate array\r\n for (var i = 0, len = other.length; i < len; i++) {\r\n ret.push(other[i]);\r\n }\r\n return ret;\r\n }\r\n };\r\n VertexData.prototype._validate = function () {\r\n if (!this.positions) {\r\n throw new Error(\"Positions are required\");\r\n }\r\n var getElementCount = function (kind, values) {\r\n var stride = VertexBuffer.DeduceStride(kind);\r\n if ((values.length % stride) !== 0) {\r\n throw new Error(\"The \" + kind + \"s array count must be a multiple of \" + stride);\r\n }\r\n return values.length / stride;\r\n };\r\n var positionsElementCount = getElementCount(VertexBuffer.PositionKind, this.positions);\r\n var validateElementCount = function (kind, values) {\r\n var elementCount = getElementCount(kind, values);\r\n if (elementCount !== positionsElementCount) {\r\n throw new Error(\"The \" + kind + \"s element count (\" + elementCount + \") does not match the positions count (\" + positionsElementCount + \")\");\r\n }\r\n };\r\n if (this.normals) {\r\n validateElementCount(VertexBuffer.NormalKind, this.normals);\r\n }\r\n if (this.tangents) {\r\n validateElementCount(VertexBuffer.TangentKind, this.tangents);\r\n }\r\n if (this.uvs) {\r\n validateElementCount(VertexBuffer.UVKind, this.uvs);\r\n }\r\n if (this.uvs2) {\r\n validateElementCount(VertexBuffer.UV2Kind, this.uvs2);\r\n }\r\n if (this.uvs3) {\r\n validateElementCount(VertexBuffer.UV3Kind, this.uvs3);\r\n }\r\n if (this.uvs4) {\r\n validateElementCount(VertexBuffer.UV4Kind, this.uvs4);\r\n }\r\n if (this.uvs5) {\r\n validateElementCount(VertexBuffer.UV5Kind, this.uvs5);\r\n }\r\n if (this.uvs6) {\r\n validateElementCount(VertexBuffer.UV6Kind, this.uvs6);\r\n }\r\n if (this.colors) {\r\n validateElementCount(VertexBuffer.ColorKind, this.colors);\r\n }\r\n if (this.matricesIndices) {\r\n validateElementCount(VertexBuffer.MatricesIndicesKind, this.matricesIndices);\r\n }\r\n if (this.matricesWeights) {\r\n validateElementCount(VertexBuffer.MatricesWeightsKind, this.matricesWeights);\r\n }\r\n if (this.matricesIndicesExtra) {\r\n validateElementCount(VertexBuffer.MatricesIndicesExtraKind, this.matricesIndicesExtra);\r\n }\r\n if (this.matricesWeightsExtra) {\r\n validateElementCount(VertexBuffer.MatricesWeightsExtraKind, this.matricesWeightsExtra);\r\n }\r\n };\r\n /**\r\n * Serializes the VertexData\r\n * @returns a serialized object\r\n */\r\n VertexData.prototype.serialize = function () {\r\n var serializationObject = this.serialize();\r\n if (this.positions) {\r\n serializationObject.positions = this.positions;\r\n }\r\n if (this.normals) {\r\n serializationObject.normals = this.normals;\r\n }\r\n if (this.tangents) {\r\n serializationObject.tangents = this.tangents;\r\n }\r\n if (this.uvs) {\r\n serializationObject.uvs = this.uvs;\r\n }\r\n if (this.uvs2) {\r\n serializationObject.uvs2 = this.uvs2;\r\n }\r\n if (this.uvs3) {\r\n serializationObject.uvs3 = this.uvs3;\r\n }\r\n if (this.uvs4) {\r\n serializationObject.uvs4 = this.uvs4;\r\n }\r\n if (this.uvs5) {\r\n serializationObject.uvs5 = this.uvs5;\r\n }\r\n if (this.uvs6) {\r\n serializationObject.uvs6 = this.uvs6;\r\n }\r\n if (this.colors) {\r\n serializationObject.colors = this.colors;\r\n }\r\n if (this.matricesIndices) {\r\n serializationObject.matricesIndices = this.matricesIndices;\r\n serializationObject.matricesIndices._isExpanded = true;\r\n }\r\n if (this.matricesWeights) {\r\n serializationObject.matricesWeights = this.matricesWeights;\r\n }\r\n if (this.matricesIndicesExtra) {\r\n serializationObject.matricesIndicesExtra = this.matricesIndicesExtra;\r\n serializationObject.matricesIndicesExtra._isExpanded = true;\r\n }\r\n if (this.matricesWeightsExtra) {\r\n serializationObject.matricesWeightsExtra = this.matricesWeightsExtra;\r\n }\r\n serializationObject.indices = this.indices;\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Extracts the vertexData from a mesh\r\n * @param mesh the mesh from which to extract the VertexData\r\n * @param copyWhenShared defines if the VertexData must be cloned when shared between multiple meshes, optional, default false\r\n * @param forceCopy indicating that the VertexData must be cloned, optional, default false\r\n * @returns the object VertexData associated to the passed mesh\r\n */\r\n VertexData.ExtractFromMesh = function (mesh, copyWhenShared, forceCopy) {\r\n return VertexData._ExtractFrom(mesh, copyWhenShared, forceCopy);\r\n };\r\n /**\r\n * Extracts the vertexData from the geometry\r\n * @param geometry the geometry from which to extract the VertexData\r\n * @param copyWhenShared defines if the VertexData must be cloned when the geometrty is shared between multiple meshes, optional, default false\r\n * @param forceCopy indicating that the VertexData must be cloned, optional, default false\r\n * @returns the object VertexData associated to the passed mesh\r\n */\r\n VertexData.ExtractFromGeometry = function (geometry, copyWhenShared, forceCopy) {\r\n return VertexData._ExtractFrom(geometry, copyWhenShared, forceCopy);\r\n };\r\n VertexData._ExtractFrom = function (meshOrGeometry, copyWhenShared, forceCopy) {\r\n var result = new VertexData();\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.PositionKind)) {\r\n result.positions = meshOrGeometry.getVerticesData(VertexBuffer.PositionKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n result.normals = meshOrGeometry.getVerticesData(VertexBuffer.NormalKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.TangentKind)) {\r\n result.tangents = meshOrGeometry.getVerticesData(VertexBuffer.TangentKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n result.uvs = meshOrGeometry.getVerticesData(VertexBuffer.UVKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\r\n result.uvs2 = meshOrGeometry.getVerticesData(VertexBuffer.UV2Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV3Kind)) {\r\n result.uvs3 = meshOrGeometry.getVerticesData(VertexBuffer.UV3Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV4Kind)) {\r\n result.uvs4 = meshOrGeometry.getVerticesData(VertexBuffer.UV4Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV5Kind)) {\r\n result.uvs5 = meshOrGeometry.getVerticesData(VertexBuffer.UV5Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV6Kind)) {\r\n result.uvs6 = meshOrGeometry.getVerticesData(VertexBuffer.UV6Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.ColorKind)) {\r\n result.colors = meshOrGeometry.getVerticesData(VertexBuffer.ColorKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\r\n result.matricesIndices = meshOrGeometry.getVerticesData(VertexBuffer.MatricesIndicesKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\r\n result.matricesWeights = meshOrGeometry.getVerticesData(VertexBuffer.MatricesWeightsKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.MatricesIndicesExtraKind)) {\r\n result.matricesIndicesExtra = meshOrGeometry.getVerticesData(VertexBuffer.MatricesIndicesExtraKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.MatricesWeightsExtraKind)) {\r\n result.matricesWeightsExtra = meshOrGeometry.getVerticesData(VertexBuffer.MatricesWeightsExtraKind, copyWhenShared, forceCopy);\r\n }\r\n result.indices = meshOrGeometry.getIndices(copyWhenShared, forceCopy);\r\n return result;\r\n };\r\n /**\r\n * Creates the VertexData for a Ribbon\r\n * @param options an object used to set the following optional parameters for the ribbon, required but can be empty\r\n * * pathArray array of paths, each of which an array of successive Vector3\r\n * * closeArray creates a seam between the first and the last paths of the pathArray, optional, default false\r\n * * closePath creates a seam between the first and the last points of each path of the path array, optional, default false\r\n * * offset a positive integer, only used when pathArray contains a single path (offset = 10 means the point 1 is joined to the point 11), default rounded half size of the pathArray length\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * * invertUV swaps in the U and V coordinates when applying a texture, optional, default false\r\n * * uvs a linear array, of length 2 * number of vertices, of custom UV values, optional\r\n * * colors a linear array, of length 4 * number of vertices, of custom color values, optional\r\n * @returns the VertexData of the ribbon\r\n */\r\n VertexData.CreateRibbon = function (options) {\r\n throw _DevTools.WarnImport(\"ribbonBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a box\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * size sets the width, height and depth of the box to the value of size, optional default 1\r\n * * width sets the width (x direction) of the box, overwrites the width set by size, optional, default size\r\n * * height sets the height (y direction) of the box, overwrites the height set by size, optional, default size\r\n * * depth sets the depth (z direction) of the box, overwrites the depth set by size, optional, default size\r\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\r\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreateBox = function (options) {\r\n throw _DevTools.WarnImport(\"boxBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a tiled box\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * faceTiles sets the pattern, tile size and number of tiles for a face\r\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\r\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreateTiledBox = function (options) {\r\n throw _DevTools.WarnImport(\"tiledBoxBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a tiled plane\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * pattern a limited pattern arrangement depending on the number\r\n * * tileSize sets the width, height and depth of the tile to the value of size, optional default 1\r\n * * tileWidth sets the width (x direction) of the tile, overwrites the width set by size, optional, default size\r\n * * tileHeight sets the height (y direction) of the tile, overwrites the height set by size, optional, default size\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the tiled plane\r\n */\r\n VertexData.CreateTiledPlane = function (options) {\r\n throw _DevTools.WarnImport(\"tiledPlaneBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for an ellipsoid, defaults to a sphere\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * segments sets the number of horizontal strips optional, default 32\r\n * * diameter sets the axes dimensions, diameterX, diameterY and diameterZ to the value of diameter, optional default 1\r\n * * diameterX sets the diameterX (x direction) of the ellipsoid, overwrites the diameterX set by diameter, optional, default diameter\r\n * * diameterY sets the diameterY (y direction) of the ellipsoid, overwrites the diameterY set by diameter, optional, default diameter\r\n * * diameterZ sets the diameterZ (z direction) of the ellipsoid, overwrites the diameterZ set by diameter, optional, default diameter\r\n * * arc a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the circumference (latitude) given by the arc value, optional, default 1\r\n * * slice a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the height (latitude) given by the arc value, optional, default 1\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the ellipsoid\r\n */\r\n VertexData.CreateSphere = function (options) {\r\n throw _DevTools.WarnImport(\"sphereBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a cylinder, cone or prism\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * height sets the height (y direction) of the cylinder, optional, default 2\r\n * * diameterTop sets the diameter of the top of the cone, overwrites diameter, optional, default diameter\r\n * * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter\r\n * * diameter sets the diameter of the top and bottom of the cone, optional default 1\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\r\n * * subdivisions` the number of rings along the cylinder height, optional, default 1\r\n * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * hasRings when true makes each subdivision independantly treated as a face for faceUV and faceColors, optional, default false\r\n * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the cylinder, cone or prism\r\n */\r\n VertexData.CreateCylinder = function (options) {\r\n throw _DevTools.WarnImport(\"cylinderBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a torus\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * diameter the diameter of the torus, optional default 1\r\n * * thickness the diameter of the tube forming the torus, optional default 0.5\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the torus\r\n */\r\n VertexData.CreateTorus = function (options) {\r\n throw _DevTools.WarnImport(\"torusBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the LineSystem\r\n * @param options an object used to set the following optional parameters for the LineSystem, required but can be empty\r\n * - lines an array of lines, each line being an array of successive Vector3\r\n * - colors an array of line colors, each of the line colors being an array of successive Color4, one per line point\r\n * @returns the VertexData of the LineSystem\r\n */\r\n VertexData.CreateLineSystem = function (options) {\r\n throw _DevTools.WarnImport(\"linesBuilder\");\r\n };\r\n /**\r\n * Create the VertexData for a DashedLines\r\n * @param options an object used to set the following optional parameters for the DashedLines, required but can be empty\r\n * - points an array successive Vector3\r\n * - dashSize the size of the dashes relative to the dash number, optional, default 3\r\n * - gapSize the size of the gap between two successive dashes relative to the dash number, optional, default 1\r\n * - dashNb the intended total number of dashes, optional, default 200\r\n * @returns the VertexData for the DashedLines\r\n */\r\n VertexData.CreateDashedLines = function (options) {\r\n throw _DevTools.WarnImport(\"linesBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a Ground\r\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\r\n * - width the width (x direction) of the ground, optional, default 1\r\n * - height the height (z direction) of the ground, optional, default 1\r\n * - subdivisions the number of subdivisions per side, optional, default 1\r\n * @returns the VertexData of the Ground\r\n */\r\n VertexData.CreateGround = function (options) {\r\n throw _DevTools.WarnImport(\"groundBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a TiledGround by subdividing the ground into tiles\r\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\r\n * * xmin the ground minimum X coordinate, optional, default -1\r\n * * zmin the ground minimum Z coordinate, optional, default -1\r\n * * xmax the ground maximum X coordinate, optional, default 1\r\n * * zmax the ground maximum Z coordinate, optional, default 1\r\n * * subdivisions a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default {w: 6, h: 6}\r\n * * precision a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}\r\n * @returns the VertexData of the TiledGround\r\n */\r\n VertexData.CreateTiledGround = function (options) {\r\n throw _DevTools.WarnImport(\"groundBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the Ground designed from a heightmap\r\n * @param options an object used to set the following parameters for the Ground, required and provided by MeshBuilder.CreateGroundFromHeightMap\r\n * * width the width (x direction) of the ground\r\n * * height the height (z direction) of the ground\r\n * * subdivisions the number of subdivisions per side\r\n * * minHeight the minimum altitude on the ground, optional, default 0\r\n * * maxHeight the maximum altitude on the ground, optional default 1\r\n * * colorFilter the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)\r\n * * buffer the array holding the image color data\r\n * * bufferWidth the width of image\r\n * * bufferHeight the height of image\r\n * * alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @returns the VertexData of the Ground designed from a heightmap\r\n */\r\n VertexData.CreateGroundFromHeightMap = function (options) {\r\n throw _DevTools.WarnImport(\"groundBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a Plane\r\n * @param options an object used to set the following optional parameters for the plane, required but can be empty\r\n * * size sets the width and height of the plane to the value of size, optional default 1\r\n * * width sets the width (x direction) of the plane, overwrites the width set by size, optional, default size\r\n * * height sets the height (y direction) of the plane, overwrites the height set by size, optional, default size\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreatePlane = function (options) {\r\n throw _DevTools.WarnImport(\"planeBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the Disc or regular Polygon\r\n * @param options an object used to set the following optional parameters for the disc, required but can be empty\r\n * * radius the radius of the disc, optional default 0.5\r\n * * tessellation the number of polygon sides, optional, default 64\r\n * * arc a number from 0 to 1, to create an unclosed polygon based on the fraction of the circumference given by the arc value, optional, default 1\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreateDisc = function (options) {\r\n throw _DevTools.WarnImport(\"discBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for an irregular Polygon in the XoZ plane using a mesh built by polygonTriangulation.build()\r\n * All parameters are provided by MeshBuilder.CreatePolygon as needed\r\n * @param polygon a mesh built from polygonTriangulation.build()\r\n * @param sideOrientation takes the values Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * @param fUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * @param fColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * @param frontUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * @param backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @param wrap a boolean, default false, when true and fUVs used texture is wrapped around all sides, when false texture is applied side\r\n * @returns the VertexData of the Polygon\r\n */\r\n VertexData.CreatePolygon = function (polygon, sideOrientation, fUV, fColors, frontUVs, backUVs, wrap) {\r\n throw _DevTools.WarnImport(\"polygonBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the IcoSphere\r\n * @param options an object used to set the following optional parameters for the IcoSphere, required but can be empty\r\n * * radius the radius of the IcoSphere, optional default 1\r\n * * radiusX allows stretching in the x direction, optional, default radius\r\n * * radiusY allows stretching in the y direction, optional, default radius\r\n * * radiusZ allows stretching in the z direction, optional, default radius\r\n * * flat when true creates a flat shaded mesh, optional, default true\r\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the IcoSphere\r\n */\r\n VertexData.CreateIcoSphere = function (options) {\r\n throw _DevTools.WarnImport(\"icoSphereBuilder\");\r\n };\r\n // inspired from // http://stemkoski.github.io/Three.js/Polyhedra.html\r\n /**\r\n * Creates the VertexData for a Polyhedron\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * * type provided types are:\r\n * * 0 : Tetrahedron, 1 : Octahedron, 2 : Dodecahedron, 3 : Icosahedron, 4 : Rhombicuboctahedron, 5 : Triangular Prism, 6 : Pentagonal Prism, 7 : Hexagonal Prism, 8 : Square Pyramid (J1)\r\n * * 9 : Pentagonal Pyramid (J2), 10 : Triangular Dipyramid (J12), 11 : Pentagonal Dipyramid (J13), 12 : Elongated Square Dipyramid (J15), 13 : Elongated Pentagonal Dipyramid (J16), 14 : Elongated Pentagonal Cupola (J20)\r\n * * size the size of the IcoSphere, optional default 1\r\n * * sizeX allows stretching in the x direction, optional, default size\r\n * * sizeY allows stretching in the y direction, optional, default size\r\n * * sizeZ allows stretching in the z direction, optional, default size\r\n * * custom a number that overwrites the type to create from an extended set of polyhedron from https://www.babylonjs-playground.com/#21QRSK#15 with minimised editor\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * flat when true creates a flat shaded mesh, optional, default true\r\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the Polyhedron\r\n */\r\n VertexData.CreatePolyhedron = function (options) {\r\n throw _DevTools.WarnImport(\"polyhedronBuilder\");\r\n };\r\n //\r\n /**\r\n * Creates the VertexData for a Capsule, inspired from https://github.com/maximeq/three-js-capsule-geometry/blob/master/src/CapsuleBufferGeometry.js\r\n * @param options an object used to set the following optional parameters for the capsule, required but can be empty\r\n * @returns the VertexData of the Capsule\r\n */\r\n VertexData.CreateCapsule = function (options) {\r\n if (options === void 0) { options = {\r\n orientation: Vector3.Up(),\r\n subdivisions: 2,\r\n tessellation: 16,\r\n height: 1,\r\n radius: 0.25,\r\n capSubdivisions: 6\r\n }; }\r\n throw _DevTools.WarnImport(\"capsuleBuilder\");\r\n };\r\n // based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473\r\n /**\r\n * Creates the VertexData for a TorusKnot\r\n * @param options an object used to set the following optional parameters for the TorusKnot, required but can be empty\r\n * * radius the radius of the torus knot, optional, default 2\r\n * * tube the thickness of the tube, optional, default 0.5\r\n * * radialSegments the number of sides on each tube segments, optional, default 32\r\n * * tubularSegments the number of tubes to decompose the knot into, optional, default 32\r\n * * p the number of windings around the z axis, optional, default 2\r\n * * q the number of windings around the x axis, optional, default 3\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the Torus Knot\r\n */\r\n VertexData.CreateTorusKnot = function (options) {\r\n throw _DevTools.WarnImport(\"torusKnotBuilder\");\r\n };\r\n // Tools\r\n /**\r\n * Compute normals for given positions and indices\r\n * @param positions an array of vertex positions, [...., x, y, z, ......]\r\n * @param indices an array of indices in groups of three for each triangular facet, [...., i, j, k, ......]\r\n * @param normals an array of vertex normals, [...., x, y, z, ......]\r\n * @param options an object used to set the following optional parameters for the TorusKnot, optional\r\n * * facetNormals : optional array of facet normals (vector3)\r\n * * facetPositions : optional array of facet positions (vector3)\r\n * * facetPartitioning : optional partitioning array. facetPositions is required for facetPartitioning computation\r\n * * ratio : optional partitioning ratio / bounding box, required for facetPartitioning computation\r\n * * bInfo : optional bounding info, required for facetPartitioning computation\r\n * * bbSize : optional bounding box size data, required for facetPartitioning computation\r\n * * subDiv : optional partitioning data about subdivsions on each axis (int), required for facetPartitioning computation\r\n * * useRightHandedSystem: optional boolean to for right handed system computation\r\n * * depthSort : optional boolean to enable the facet depth sort computation\r\n * * distanceTo : optional Vector3 to compute the facet depth from this location\r\n * * depthSortedFacets : optional array of depthSortedFacets to store the facet distances from the reference location\r\n */\r\n VertexData.ComputeNormals = function (positions, indices, normals, options) {\r\n // temporary scalar variables\r\n var index = 0; // facet index\r\n var p1p2x = 0.0; // p1p2 vector x coordinate\r\n var p1p2y = 0.0; // p1p2 vector y coordinate\r\n var p1p2z = 0.0; // p1p2 vector z coordinate\r\n var p3p2x = 0.0; // p3p2 vector x coordinate\r\n var p3p2y = 0.0; // p3p2 vector y coordinate\r\n var p3p2z = 0.0; // p3p2 vector z coordinate\r\n var faceNormalx = 0.0; // facet normal x coordinate\r\n var faceNormaly = 0.0; // facet normal y coordinate\r\n var faceNormalz = 0.0; // facet normal z coordinate\r\n var length = 0.0; // facet normal length before normalization\r\n var v1x = 0; // vector1 x index in the positions array\r\n var v1y = 0; // vector1 y index in the positions array\r\n var v1z = 0; // vector1 z index in the positions array\r\n var v2x = 0; // vector2 x index in the positions array\r\n var v2y = 0; // vector2 y index in the positions array\r\n var v2z = 0; // vector2 z index in the positions array\r\n var v3x = 0; // vector3 x index in the positions array\r\n var v3y = 0; // vector3 y index in the positions array\r\n var v3z = 0; // vector3 z index in the positions array\r\n var computeFacetNormals = false;\r\n var computeFacetPositions = false;\r\n var computeFacetPartitioning = false;\r\n var computeDepthSort = false;\r\n var faceNormalSign = 1;\r\n var ratio = 0;\r\n var distanceTo = null;\r\n if (options) {\r\n computeFacetNormals = (options.facetNormals) ? true : false;\r\n computeFacetPositions = (options.facetPositions) ? true : false;\r\n computeFacetPartitioning = (options.facetPartitioning) ? true : false;\r\n faceNormalSign = (options.useRightHandedSystem === true) ? -1 : 1;\r\n ratio = options.ratio || 0;\r\n computeDepthSort = (options.depthSort) ? true : false;\r\n distanceTo = (options.distanceTo);\r\n if (computeDepthSort) {\r\n if (distanceTo === undefined) {\r\n distanceTo = Vector3.Zero();\r\n }\r\n var depthSortedFacets = options.depthSortedFacets;\r\n }\r\n }\r\n // facetPartitioning reinit if needed\r\n var xSubRatio = 0;\r\n var ySubRatio = 0;\r\n var zSubRatio = 0;\r\n var subSq = 0;\r\n if (computeFacetPartitioning && options && options.bbSize) {\r\n var ox = 0; // X partitioning index for facet position\r\n var oy = 0; // Y partinioning index for facet position\r\n var oz = 0; // Z partinioning index for facet position\r\n var b1x = 0; // X partitioning index for facet v1 vertex\r\n var b1y = 0; // Y partitioning index for facet v1 vertex\r\n var b1z = 0; // z partitioning index for facet v1 vertex\r\n var b2x = 0; // X partitioning index for facet v2 vertex\r\n var b2y = 0; // Y partitioning index for facet v2 vertex\r\n var b2z = 0; // Z partitioning index for facet v2 vertex\r\n var b3x = 0; // X partitioning index for facet v3 vertex\r\n var b3y = 0; // Y partitioning index for facet v3 vertex\r\n var b3z = 0; // Z partitioning index for facet v3 vertex\r\n var block_idx_o = 0; // facet barycenter block index\r\n var block_idx_v1 = 0; // v1 vertex block index\r\n var block_idx_v2 = 0; // v2 vertex block index\r\n var block_idx_v3 = 0; // v3 vertex block index\r\n var bbSizeMax = (options.bbSize.x > options.bbSize.y) ? options.bbSize.x : options.bbSize.y;\r\n bbSizeMax = (bbSizeMax > options.bbSize.z) ? bbSizeMax : options.bbSize.z;\r\n xSubRatio = options.subDiv.X * ratio / options.bbSize.x;\r\n ySubRatio = options.subDiv.Y * ratio / options.bbSize.y;\r\n zSubRatio = options.subDiv.Z * ratio / options.bbSize.z;\r\n subSq = options.subDiv.max * options.subDiv.max;\r\n options.facetPartitioning.length = 0;\r\n }\r\n // reset the normals\r\n for (index = 0; index < positions.length; index++) {\r\n normals[index] = 0.0;\r\n }\r\n // Loop : 1 indice triplet = 1 facet\r\n var nbFaces = (indices.length / 3) | 0;\r\n for (index = 0; index < nbFaces; index++) {\r\n // get the indexes of the coordinates of each vertex of the facet\r\n v1x = indices[index * 3] * 3;\r\n v1y = v1x + 1;\r\n v1z = v1x + 2;\r\n v2x = indices[index * 3 + 1] * 3;\r\n v2y = v2x + 1;\r\n v2z = v2x + 2;\r\n v3x = indices[index * 3 + 2] * 3;\r\n v3y = v3x + 1;\r\n v3z = v3x + 2;\r\n p1p2x = positions[v1x] - positions[v2x]; // compute two vectors per facet : p1p2 and p3p2\r\n p1p2y = positions[v1y] - positions[v2y];\r\n p1p2z = positions[v1z] - positions[v2z];\r\n p3p2x = positions[v3x] - positions[v2x];\r\n p3p2y = positions[v3y] - positions[v2y];\r\n p3p2z = positions[v3z] - positions[v2z];\r\n // compute the face normal with the cross product\r\n faceNormalx = faceNormalSign * (p1p2y * p3p2z - p1p2z * p3p2y);\r\n faceNormaly = faceNormalSign * (p1p2z * p3p2x - p1p2x * p3p2z);\r\n faceNormalz = faceNormalSign * (p1p2x * p3p2y - p1p2y * p3p2x);\r\n // normalize this normal and store it in the array facetData\r\n length = Math.sqrt(faceNormalx * faceNormalx + faceNormaly * faceNormaly + faceNormalz * faceNormalz);\r\n length = (length === 0) ? 1.0 : length;\r\n faceNormalx /= length;\r\n faceNormaly /= length;\r\n faceNormalz /= length;\r\n if (computeFacetNormals && options) {\r\n options.facetNormals[index].x = faceNormalx;\r\n options.facetNormals[index].y = faceNormaly;\r\n options.facetNormals[index].z = faceNormalz;\r\n }\r\n if (computeFacetPositions && options) {\r\n // compute and the facet barycenter coordinates in the array facetPositions\r\n options.facetPositions[index].x = (positions[v1x] + positions[v2x] + positions[v3x]) / 3.0;\r\n options.facetPositions[index].y = (positions[v1y] + positions[v2y] + positions[v3y]) / 3.0;\r\n options.facetPositions[index].z = (positions[v1z] + positions[v2z] + positions[v3z]) / 3.0;\r\n }\r\n if (computeFacetPartitioning && options) {\r\n // store the facet indexes in arrays in the main facetPartitioning array :\r\n // compute each facet vertex (+ facet barycenter) index in the partiniong array\r\n ox = Math.floor((options.facetPositions[index].x - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n oy = Math.floor((options.facetPositions[index].y - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n oz = Math.floor((options.facetPositions[index].z - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n b1x = Math.floor((positions[v1x] - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n b1y = Math.floor((positions[v1y] - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n b1z = Math.floor((positions[v1z] - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n b2x = Math.floor((positions[v2x] - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n b2y = Math.floor((positions[v2y] - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n b2z = Math.floor((positions[v2z] - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n b3x = Math.floor((positions[v3x] - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n b3y = Math.floor((positions[v3y] - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n b3z = Math.floor((positions[v3z] - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n block_idx_v1 = b1x + options.subDiv.max * b1y + subSq * b1z;\r\n block_idx_v2 = b2x + options.subDiv.max * b2y + subSq * b2z;\r\n block_idx_v3 = b3x + options.subDiv.max * b3y + subSq * b3z;\r\n block_idx_o = ox + options.subDiv.max * oy + subSq * oz;\r\n options.facetPartitioning[block_idx_o] = options.facetPartitioning[block_idx_o] ? options.facetPartitioning[block_idx_o] : new Array();\r\n options.facetPartitioning[block_idx_v1] = options.facetPartitioning[block_idx_v1] ? options.facetPartitioning[block_idx_v1] : new Array();\r\n options.facetPartitioning[block_idx_v2] = options.facetPartitioning[block_idx_v2] ? options.facetPartitioning[block_idx_v2] : new Array();\r\n options.facetPartitioning[block_idx_v3] = options.facetPartitioning[block_idx_v3] ? options.facetPartitioning[block_idx_v3] : new Array();\r\n // push each facet index in each block containing the vertex\r\n options.facetPartitioning[block_idx_v1].push(index);\r\n if (block_idx_v2 != block_idx_v1) {\r\n options.facetPartitioning[block_idx_v2].push(index);\r\n }\r\n if (!(block_idx_v3 == block_idx_v2 || block_idx_v3 == block_idx_v1)) {\r\n options.facetPartitioning[block_idx_v3].push(index);\r\n }\r\n if (!(block_idx_o == block_idx_v1 || block_idx_o == block_idx_v2 || block_idx_o == block_idx_v3)) {\r\n options.facetPartitioning[block_idx_o].push(index);\r\n }\r\n }\r\n if (computeDepthSort && options && options.facetPositions) {\r\n var dsf = depthSortedFacets[index];\r\n dsf.ind = index * 3;\r\n dsf.sqDistance = Vector3.DistanceSquared(options.facetPositions[index], distanceTo);\r\n }\r\n // compute the normals anyway\r\n normals[v1x] += faceNormalx; // accumulate all the normals per face\r\n normals[v1y] += faceNormaly;\r\n normals[v1z] += faceNormalz;\r\n normals[v2x] += faceNormalx;\r\n normals[v2y] += faceNormaly;\r\n normals[v2z] += faceNormalz;\r\n normals[v3x] += faceNormalx;\r\n normals[v3y] += faceNormaly;\r\n normals[v3z] += faceNormalz;\r\n }\r\n // last normalization of each normal\r\n for (index = 0; index < normals.length / 3; index++) {\r\n faceNormalx = normals[index * 3];\r\n faceNormaly = normals[index * 3 + 1];\r\n faceNormalz = normals[index * 3 + 2];\r\n length = Math.sqrt(faceNormalx * faceNormalx + faceNormaly * faceNormaly + faceNormalz * faceNormalz);\r\n length = (length === 0) ? 1.0 : length;\r\n faceNormalx /= length;\r\n faceNormaly /= length;\r\n faceNormalz /= length;\r\n normals[index * 3] = faceNormalx;\r\n normals[index * 3 + 1] = faceNormaly;\r\n normals[index * 3 + 2] = faceNormalz;\r\n }\r\n };\r\n /** @hidden */\r\n VertexData._ComputeSides = function (sideOrientation, positions, indices, normals, uvs, frontUVs, backUVs) {\r\n var li = indices.length;\r\n var ln = normals.length;\r\n var i;\r\n var n;\r\n sideOrientation = sideOrientation || VertexData.DEFAULTSIDE;\r\n switch (sideOrientation) {\r\n case VertexData.FRONTSIDE:\r\n // nothing changed\r\n break;\r\n case VertexData.BACKSIDE:\r\n var tmp;\r\n // indices\r\n for (i = 0; i < li; i += 3) {\r\n tmp = indices[i];\r\n indices[i] = indices[i + 2];\r\n indices[i + 2] = tmp;\r\n }\r\n // normals\r\n for (n = 0; n < ln; n++) {\r\n normals[n] = -normals[n];\r\n }\r\n break;\r\n case VertexData.DOUBLESIDE:\r\n // positions\r\n var lp = positions.length;\r\n var l = lp / 3;\r\n for (var p = 0; p < lp; p++) {\r\n positions[lp + p] = positions[p];\r\n }\r\n // indices\r\n for (i = 0; i < li; i += 3) {\r\n indices[i + li] = indices[i + 2] + l;\r\n indices[i + 1 + li] = indices[i + 1] + l;\r\n indices[i + 2 + li] = indices[i] + l;\r\n }\r\n // normals\r\n for (n = 0; n < ln; n++) {\r\n normals[ln + n] = -normals[n];\r\n }\r\n // uvs\r\n var lu = uvs.length;\r\n var u = 0;\r\n for (u = 0; u < lu; u++) {\r\n uvs[u + lu] = uvs[u];\r\n }\r\n frontUVs = frontUVs ? frontUVs : new Vector4(0.0, 0.0, 1.0, 1.0);\r\n backUVs = backUVs ? backUVs : new Vector4(0.0, 0.0, 1.0, 1.0);\r\n u = 0;\r\n for (i = 0; i < lu / 2; i++) {\r\n uvs[u] = frontUVs.x + (frontUVs.z - frontUVs.x) * uvs[u];\r\n uvs[u + 1] = frontUVs.y + (frontUVs.w - frontUVs.y) * uvs[u + 1];\r\n uvs[u + lu] = backUVs.x + (backUVs.z - backUVs.x) * uvs[u + lu];\r\n uvs[u + lu + 1] = backUVs.y + (backUVs.w - backUVs.y) * uvs[u + lu + 1];\r\n u += 2;\r\n }\r\n break;\r\n }\r\n };\r\n /**\r\n * Applies VertexData created from the imported parameters to the geometry\r\n * @param parsedVertexData the parsed data from an imported file\r\n * @param geometry the geometry to apply the VertexData to\r\n */\r\n VertexData.ImportVertexData = function (parsedVertexData, geometry) {\r\n var vertexData = new VertexData();\r\n // positions\r\n var positions = parsedVertexData.positions;\r\n if (positions) {\r\n vertexData.set(positions, VertexBuffer.PositionKind);\r\n }\r\n // normals\r\n var normals = parsedVertexData.normals;\r\n if (normals) {\r\n vertexData.set(normals, VertexBuffer.NormalKind);\r\n }\r\n // tangents\r\n var tangents = parsedVertexData.tangents;\r\n if (tangents) {\r\n vertexData.set(tangents, VertexBuffer.TangentKind);\r\n }\r\n // uvs\r\n var uvs = parsedVertexData.uvs;\r\n if (uvs) {\r\n vertexData.set(uvs, VertexBuffer.UVKind);\r\n }\r\n // uv2s\r\n var uv2s = parsedVertexData.uv2s;\r\n if (uv2s) {\r\n vertexData.set(uv2s, VertexBuffer.UV2Kind);\r\n }\r\n // uv3s\r\n var uv3s = parsedVertexData.uv3s;\r\n if (uv3s) {\r\n vertexData.set(uv3s, VertexBuffer.UV3Kind);\r\n }\r\n // uv4s\r\n var uv4s = parsedVertexData.uv4s;\r\n if (uv4s) {\r\n vertexData.set(uv4s, VertexBuffer.UV4Kind);\r\n }\r\n // uv5s\r\n var uv5s = parsedVertexData.uv5s;\r\n if (uv5s) {\r\n vertexData.set(uv5s, VertexBuffer.UV5Kind);\r\n }\r\n // uv6s\r\n var uv6s = parsedVertexData.uv6s;\r\n if (uv6s) {\r\n vertexData.set(uv6s, VertexBuffer.UV6Kind);\r\n }\r\n // colors\r\n var colors = parsedVertexData.colors;\r\n if (colors) {\r\n vertexData.set(Color4.CheckColors4(colors, positions.length / 3), VertexBuffer.ColorKind);\r\n }\r\n // matricesIndices\r\n var matricesIndices = parsedVertexData.matricesIndices;\r\n if (matricesIndices) {\r\n vertexData.set(matricesIndices, VertexBuffer.MatricesIndicesKind);\r\n }\r\n // matricesWeights\r\n var matricesWeights = parsedVertexData.matricesWeights;\r\n if (matricesWeights) {\r\n vertexData.set(matricesWeights, VertexBuffer.MatricesWeightsKind);\r\n }\r\n // indices\r\n var indices = parsedVertexData.indices;\r\n if (indices) {\r\n vertexData.indices = indices;\r\n }\r\n geometry.setAllVerticesData(vertexData, parsedVertexData.updatable);\r\n };\r\n /**\r\n * Mesh side orientation : usually the external or front surface\r\n */\r\n VertexData.FRONTSIDE = 0;\r\n /**\r\n * Mesh side orientation : usually the internal or back surface\r\n */\r\n VertexData.BACKSIDE = 1;\r\n /**\r\n * Mesh side orientation : both internal and external or front and back surfaces\r\n */\r\n VertexData.DOUBLESIDE = 2;\r\n /**\r\n * Mesh side orientation : by default, `FRONTSIDE`\r\n */\r\n VertexData.DEFAULTSIDE = 0;\r\n return VertexData;\r\n}());\r\nexport { VertexData };\r\n//# sourceMappingURL=mesh.vertexData.js.map","import { VertexBuffer } from \"./buffer\";\r\nimport { IntersectionInfo } from \"../Collisions/intersectionInfo\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { extractMinAndMaxIndexed } from '../Maths/math.functions';\r\n/**\r\n * Defines a subdivision inside a mesh\r\n */\r\nvar SubMesh = /** @class */ (function () {\r\n /**\r\n * Creates a new submesh\r\n * @param materialIndex defines the material index to use\r\n * @param verticesStart defines vertex index start\r\n * @param verticesCount defines vertices count\r\n * @param indexStart defines index start\r\n * @param indexCount defines indices count\r\n * @param mesh defines the parent mesh\r\n * @param renderingMesh defines an optional rendering mesh\r\n * @param createBoundingBox defines if bounding box should be created for this submesh\r\n * @param addToMesh defines a boolean indicating that the submesh must be added to the mesh.subMeshes array (true by default)\r\n */\r\n function SubMesh(\r\n /** the material index to use */\r\n materialIndex, \r\n /** vertex index start */\r\n verticesStart, \r\n /** vertices count */\r\n verticesCount, \r\n /** index start */\r\n indexStart, \r\n /** indices count */\r\n indexCount, mesh, renderingMesh, createBoundingBox, addToMesh) {\r\n if (createBoundingBox === void 0) { createBoundingBox = true; }\r\n if (addToMesh === void 0) { addToMesh = true; }\r\n this.materialIndex = materialIndex;\r\n this.verticesStart = verticesStart;\r\n this.verticesCount = verticesCount;\r\n this.indexStart = indexStart;\r\n this.indexCount = indexCount;\r\n /** @hidden */\r\n this._materialDefines = null;\r\n /** @hidden */\r\n this._materialEffect = null;\r\n /** @hidden */\r\n this._effectOverride = null;\r\n /** @hidden */\r\n this._linesIndexCount = 0;\r\n this._linesIndexBuffer = null;\r\n /** @hidden */\r\n this._lastColliderWorldVertices = null;\r\n /** @hidden */\r\n this._lastColliderTransformMatrix = null;\r\n /** @hidden */\r\n this._renderId = 0;\r\n /** @hidden */\r\n this._alphaIndex = 0;\r\n /** @hidden */\r\n this._distanceToCamera = 0;\r\n this._currentMaterial = null;\r\n this._mesh = mesh;\r\n this._renderingMesh = renderingMesh || mesh;\r\n if (addToMesh) {\r\n mesh.subMeshes.push(this);\r\n }\r\n this._trianglePlanes = [];\r\n this._id = mesh.subMeshes.length - 1;\r\n if (createBoundingBox) {\r\n this.refreshBoundingInfo();\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n Object.defineProperty(SubMesh.prototype, \"materialDefines\", {\r\n /**\r\n * Gets material defines used by the effect associated to the sub mesh\r\n */\r\n get: function () {\r\n return this._materialDefines;\r\n },\r\n /**\r\n * Sets material defines used by the effect associated to the sub mesh\r\n */\r\n set: function (defines) {\r\n this._materialDefines = defines;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SubMesh.prototype, \"effect\", {\r\n /**\r\n * Gets associated effect\r\n */\r\n get: function () {\r\n var _a;\r\n return (_a = this._effectOverride) !== null && _a !== void 0 ? _a : this._materialEffect;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Sets associated effect (effect used to render this submesh)\r\n * @param effect defines the effect to associate with\r\n * @param defines defines the set of defines used to compile this effect\r\n */\r\n SubMesh.prototype.setEffect = function (effect, defines) {\r\n if (defines === void 0) { defines = null; }\r\n if (this._materialEffect === effect) {\r\n if (!effect) {\r\n this._materialDefines = null;\r\n }\r\n return;\r\n }\r\n this._materialDefines = defines;\r\n this._materialEffect = effect;\r\n };\r\n /**\r\n * Add a new submesh to a mesh\r\n * @param materialIndex defines the material index to use\r\n * @param verticesStart defines vertex index start\r\n * @param verticesCount defines vertices count\r\n * @param indexStart defines index start\r\n * @param indexCount defines indices count\r\n * @param mesh defines the parent mesh\r\n * @param renderingMesh defines an optional rendering mesh\r\n * @param createBoundingBox defines if bounding box should be created for this submesh\r\n * @returns the new submesh\r\n */\r\n SubMesh.AddToMesh = function (materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox) {\r\n if (createBoundingBox === void 0) { createBoundingBox = true; }\r\n return new SubMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox);\r\n };\r\n Object.defineProperty(SubMesh.prototype, \"IsGlobal\", {\r\n /**\r\n * Returns true if this submesh covers the entire parent mesh\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return (this.verticesStart === 0 && this.verticesCount === this._mesh.getTotalVertices());\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the submesh BoudingInfo object\r\n * @returns current bounding info (or mesh's one if the submesh is global)\r\n */\r\n SubMesh.prototype.getBoundingInfo = function () {\r\n if (this.IsGlobal) {\r\n return this._mesh.getBoundingInfo();\r\n }\r\n return this._boundingInfo;\r\n };\r\n /**\r\n * Sets the submesh BoundingInfo\r\n * @param boundingInfo defines the new bounding info to use\r\n * @returns the SubMesh\r\n */\r\n SubMesh.prototype.setBoundingInfo = function (boundingInfo) {\r\n this._boundingInfo = boundingInfo;\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh of the current submesh\r\n * @return the parent mesh\r\n */\r\n SubMesh.prototype.getMesh = function () {\r\n return this._mesh;\r\n };\r\n /**\r\n * Returns the rendering mesh of the submesh\r\n * @returns the rendering mesh (could be different from parent mesh)\r\n */\r\n SubMesh.prototype.getRenderingMesh = function () {\r\n return this._renderingMesh;\r\n };\r\n /**\r\n * Returns the replacement mesh of the submesh\r\n * @returns the replacement mesh (could be different from parent mesh)\r\n */\r\n SubMesh.prototype.getReplacementMesh = function () {\r\n return this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : null;\r\n };\r\n /**\r\n * Returns the effective mesh of the submesh\r\n * @returns the effective mesh (could be different from parent mesh)\r\n */\r\n SubMesh.prototype.getEffectiveMesh = function () {\r\n var replacementMesh = this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : null;\r\n return replacementMesh ? replacementMesh : this._renderingMesh;\r\n };\r\n /**\r\n * Returns the submesh material\r\n * @returns null or the current material\r\n */\r\n SubMesh.prototype.getMaterial = function () {\r\n var rootMaterial = this._renderingMesh.material;\r\n if (rootMaterial === null || rootMaterial === undefined) {\r\n return this._mesh.getScene().defaultMaterial;\r\n }\r\n else if (this._IsMultiMaterial(rootMaterial)) {\r\n var effectiveMaterial = rootMaterial.getSubMaterial(this.materialIndex);\r\n if (this._currentMaterial !== effectiveMaterial) {\r\n this._currentMaterial = effectiveMaterial;\r\n this._materialDefines = null;\r\n }\r\n return effectiveMaterial;\r\n }\r\n return rootMaterial;\r\n };\r\n SubMesh.prototype._IsMultiMaterial = function (material) {\r\n return material.getSubMaterial !== undefined;\r\n };\r\n // Methods\r\n /**\r\n * Sets a new updated BoundingInfo object to the submesh\r\n * @param data defines an optional position array to use to determine the bounding info\r\n * @returns the SubMesh\r\n */\r\n SubMesh.prototype.refreshBoundingInfo = function (data) {\r\n if (data === void 0) { data = null; }\r\n this._lastColliderWorldVertices = null;\r\n if (this.IsGlobal || !this._renderingMesh || !this._renderingMesh.geometry) {\r\n return this;\r\n }\r\n if (!data) {\r\n data = this._renderingMesh.getVerticesData(VertexBuffer.PositionKind);\r\n }\r\n if (!data) {\r\n this._boundingInfo = this._mesh.getBoundingInfo();\r\n return this;\r\n }\r\n var indices = this._renderingMesh.getIndices();\r\n var extend;\r\n //is this the only submesh?\r\n if (this.indexStart === 0 && this.indexCount === indices.length) {\r\n var boundingInfo = this._renderingMesh.getBoundingInfo();\r\n //the rendering mesh's bounding info can be used, it is the standard submesh for all indices.\r\n extend = { minimum: boundingInfo.minimum.clone(), maximum: boundingInfo.maximum.clone() };\r\n }\r\n else {\r\n extend = extractMinAndMaxIndexed(data, indices, this.indexStart, this.indexCount, this._renderingMesh.geometry.boundingBias);\r\n }\r\n if (this._boundingInfo) {\r\n this._boundingInfo.reConstruct(extend.minimum, extend.maximum);\r\n }\r\n else {\r\n this._boundingInfo = new BoundingInfo(extend.minimum, extend.maximum);\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._checkCollision = function (collider) {\r\n var boundingInfo = this.getBoundingInfo();\r\n return boundingInfo._checkCollision(collider);\r\n };\r\n /**\r\n * Updates the submesh BoundingInfo\r\n * @param world defines the world matrix to use to update the bounding info\r\n * @returns the submesh\r\n */\r\n SubMesh.prototype.updateBoundingInfo = function (world) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n this.refreshBoundingInfo();\r\n boundingInfo = this.getBoundingInfo();\r\n }\r\n if (boundingInfo) {\r\n boundingInfo.update(world);\r\n }\r\n return this;\r\n };\r\n /**\r\n * True is the submesh bounding box intersects the frustum defined by the passed array of planes.\r\n * @param frustumPlanes defines the frustum planes\r\n * @returns true if the submesh is intersecting with the frustum\r\n */\r\n SubMesh.prototype.isInFrustum = function (frustumPlanes) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return boundingInfo.isInFrustum(frustumPlanes, this._mesh.cullingStrategy);\r\n };\r\n /**\r\n * True is the submesh bounding box is completely inside the frustum defined by the passed array of planes\r\n * @param frustumPlanes defines the frustum planes\r\n * @returns true if the submesh is inside the frustum\r\n */\r\n SubMesh.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return boundingInfo.isCompletelyInFrustum(frustumPlanes);\r\n };\r\n /**\r\n * Renders the submesh\r\n * @param enableAlphaMode defines if alpha needs to be used\r\n * @returns the submesh\r\n */\r\n SubMesh.prototype.render = function (enableAlphaMode) {\r\n this._renderingMesh.render(this, enableAlphaMode, this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : undefined);\r\n return this;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n SubMesh.prototype._getLinesIndexBuffer = function (indices, engine) {\r\n if (!this._linesIndexBuffer) {\r\n var linesIndices = [];\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 3) {\r\n linesIndices.push(indices[index], indices[index + 1], indices[index + 1], indices[index + 2], indices[index + 2], indices[index]);\r\n }\r\n this._linesIndexBuffer = engine.createIndexBuffer(linesIndices);\r\n this._linesIndexCount = linesIndices.length;\r\n }\r\n return this._linesIndexBuffer;\r\n };\r\n /**\r\n * Checks if the submesh intersects with a ray\r\n * @param ray defines the ray to test\r\n * @returns true is the passed ray intersects the submesh bounding box\r\n */\r\n SubMesh.prototype.canIntersects = function (ray) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return ray.intersectsBox(boundingInfo.boundingBox);\r\n };\r\n /**\r\n * Intersects current submesh with a ray\r\n * @param ray defines the ray to test\r\n * @param positions defines mesh's positions array\r\n * @param indices defines mesh's indices array\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns intersection info or null if no intersection\r\n */\r\n SubMesh.prototype.intersects = function (ray, positions, indices, fastCheck, trianglePredicate) {\r\n var material = this.getMaterial();\r\n if (!material) {\r\n return null;\r\n }\r\n var step = 3;\r\n var checkStopper = false;\r\n switch (material.fillMode) {\r\n case 3:\r\n case 4:\r\n case 5:\r\n case 6:\r\n case 8:\r\n return null;\r\n case 7:\r\n step = 1;\r\n checkStopper = true;\r\n break;\r\n default:\r\n break;\r\n }\r\n // LineMesh first as it's also a Mesh...\r\n if (this._mesh.getClassName() === \"InstancedLinesMesh\" || this._mesh.getClassName() === \"LinesMesh\") {\r\n // Check if mesh is unindexed\r\n if (!indices.length) {\r\n return this._intersectUnIndexedLines(ray, positions, indices, this._mesh.intersectionThreshold, fastCheck);\r\n }\r\n return this._intersectLines(ray, positions, indices, this._mesh.intersectionThreshold, fastCheck);\r\n }\r\n else {\r\n // Check if mesh is unindexed\r\n if (!indices.length && this._mesh._unIndexed) {\r\n return this._intersectUnIndexedTriangles(ray, positions, indices, fastCheck, trianglePredicate);\r\n }\r\n return this._intersectTriangles(ray, positions, indices, step, checkStopper, fastCheck, trianglePredicate);\r\n }\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectLines = function (ray, positions, indices, intersectionThreshold, fastCheck) {\r\n var intersectInfo = null;\r\n // Line test\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 2) {\r\n var p0 = positions[indices[index]];\r\n var p1 = positions[indices[index + 1]];\r\n var length = ray.intersectionSegment(p0, p1, intersectionThreshold);\r\n if (length < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || length < intersectInfo.distance) {\r\n intersectInfo = new IntersectionInfo(null, null, length);\r\n intersectInfo.faceId = index / 2;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectUnIndexedLines = function (ray, positions, indices, intersectionThreshold, fastCheck) {\r\n var intersectInfo = null;\r\n // Line test\r\n for (var index = this.verticesStart; index < this.verticesStart + this.verticesCount; index += 2) {\r\n var p0 = positions[index];\r\n var p1 = positions[index + 1];\r\n var length = ray.intersectionSegment(p0, p1, intersectionThreshold);\r\n if (length < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || length < intersectInfo.distance) {\r\n intersectInfo = new IntersectionInfo(null, null, length);\r\n intersectInfo.faceId = index / 2;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectTriangles = function (ray, positions, indices, step, checkStopper, fastCheck, trianglePredicate) {\r\n var intersectInfo = null;\r\n // Triangles test\r\n var faceID = -1;\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += step) {\r\n faceID++;\r\n var indexA = indices[index];\r\n var indexB = indices[index + 1];\r\n var indexC = indices[index + 2];\r\n if (checkStopper && indexC === 0xFFFFFFFF) {\r\n index += 2;\r\n continue;\r\n }\r\n var p0 = positions[indexA];\r\n var p1 = positions[indexB];\r\n var p2 = positions[indexC];\r\n if (trianglePredicate && !trianglePredicate(p0, p1, p2, ray)) {\r\n continue;\r\n }\r\n var currentIntersectInfo = ray.intersectsTriangle(p0, p1, p2);\r\n if (currentIntersectInfo) {\r\n if (currentIntersectInfo.distance < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.faceId = faceID;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectUnIndexedTriangles = function (ray, positions, indices, fastCheck, trianglePredicate) {\r\n var intersectInfo = null;\r\n // Triangles test\r\n for (var index = this.verticesStart; index < this.verticesStart + this.verticesCount; index += 3) {\r\n var p0 = positions[index];\r\n var p1 = positions[index + 1];\r\n var p2 = positions[index + 2];\r\n if (trianglePredicate && !trianglePredicate(p0, p1, p2, ray)) {\r\n continue;\r\n }\r\n var currentIntersectInfo = ray.intersectsTriangle(p0, p1, p2);\r\n if (currentIntersectInfo) {\r\n if (currentIntersectInfo.distance < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.faceId = index / 3;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._rebuild = function () {\r\n if (this._linesIndexBuffer) {\r\n this._linesIndexBuffer = null;\r\n }\r\n };\r\n // Clone\r\n /**\r\n * Creates a new submesh from the passed mesh\r\n * @param newMesh defines the new hosting mesh\r\n * @param newRenderingMesh defines an optional rendering mesh\r\n * @returns the new submesh\r\n */\r\n SubMesh.prototype.clone = function (newMesh, newRenderingMesh) {\r\n var result = new SubMesh(this.materialIndex, this.verticesStart, this.verticesCount, this.indexStart, this.indexCount, newMesh, newRenderingMesh, false);\r\n if (!this.IsGlobal) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return result;\r\n }\r\n result._boundingInfo = new BoundingInfo(boundingInfo.minimum, boundingInfo.maximum);\r\n }\r\n return result;\r\n };\r\n // Dispose\r\n /**\r\n * Release associated resources\r\n */\r\n SubMesh.prototype.dispose = function () {\r\n if (this._linesIndexBuffer) {\r\n this._mesh.getScene().getEngine()._releaseBuffer(this._linesIndexBuffer);\r\n this._linesIndexBuffer = null;\r\n }\r\n // Remove from mesh\r\n var index = this._mesh.subMeshes.indexOf(this);\r\n this._mesh.subMeshes.splice(index, 1);\r\n };\r\n /**\r\n * Gets the class name\r\n * @returns the string \"SubMesh\".\r\n */\r\n SubMesh.prototype.getClassName = function () {\r\n return \"SubMesh\";\r\n };\r\n // Statics\r\n /**\r\n * Creates a new submesh from indices data\r\n * @param materialIndex the index of the main mesh material\r\n * @param startIndex the index where to start the copy in the mesh indices array\r\n * @param indexCount the number of indices to copy then from the startIndex\r\n * @param mesh the main mesh to create the submesh from\r\n * @param renderingMesh the optional rendering mesh\r\n * @returns a new submesh\r\n */\r\n SubMesh.CreateFromIndices = function (materialIndex, startIndex, indexCount, mesh, renderingMesh) {\r\n var minVertexIndex = Number.MAX_VALUE;\r\n var maxVertexIndex = -Number.MAX_VALUE;\r\n var whatWillRender = (renderingMesh || mesh);\r\n var indices = whatWillRender.getIndices();\r\n for (var index = startIndex; index < startIndex + indexCount; index++) {\r\n var vertexIndex = indices[index];\r\n if (vertexIndex < minVertexIndex) {\r\n minVertexIndex = vertexIndex;\r\n }\r\n if (vertexIndex > maxVertexIndex) {\r\n maxVertexIndex = vertexIndex;\r\n }\r\n }\r\n return new SubMesh(materialIndex, minVertexIndex, maxVertexIndex - minVertexIndex + 1, startIndex, indexCount, mesh, renderingMesh);\r\n };\r\n return SubMesh;\r\n}());\r\nexport { SubMesh };\r\n//# sourceMappingURL=subMesh.js.map","import { Mesh } from \"../Meshes/mesh\";\r\nimport { VertexBuffer, Buffer } from './buffer';\r\nimport { Matrix, Vector3, TmpVectors } from '../Maths/math.vector';\r\nMesh.prototype.thinInstanceAdd = function (matrix, refresh) {\r\n if (refresh === void 0) { refresh = true; }\r\n this._thinInstanceUpdateBufferSize(\"matrix\", Array.isArray(matrix) ? matrix.length : 1);\r\n var index = this._thinInstanceDataStorage.instancesCount;\r\n if (Array.isArray(matrix)) {\r\n for (var i = 0; i < matrix.length; ++i) {\r\n this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, matrix[i], (i === matrix.length - 1) && refresh);\r\n }\r\n }\r\n else {\r\n this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, matrix, refresh);\r\n }\r\n return index;\r\n};\r\nMesh.prototype.thinInstanceAddSelf = function (refresh) {\r\n if (refresh === void 0) { refresh = true; }\r\n return this.thinInstanceAdd(Matrix.IdentityReadOnly, refresh);\r\n};\r\nMesh.prototype.thinInstanceRegisterAttribute = function (kind, stride) {\r\n this.removeVerticesData(kind);\r\n this._thinInstanceInitializeUserStorage();\r\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = stride * Math.max(32, this._thinInstanceDataStorage.instancesCount); // Initial size\r\n this._userThinInstanceBuffersStorage.data[kind] = new Float32Array(this._userThinInstanceBuffersStorage.sizes[kind]);\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), this._userThinInstanceBuffersStorage.data[kind], kind, true, false, stride, true);\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]);\r\n};\r\nMesh.prototype.thinInstanceSetMatrixAt = function (index, matrix, refresh) {\r\n if (refresh === void 0) { refresh = true; }\r\n if (!this._thinInstanceDataStorage.matrixData || index >= this._thinInstanceDataStorage.instancesCount) {\r\n return false;\r\n }\r\n var matrixData = this._thinInstanceDataStorage.matrixData;\r\n matrix.copyToArray(matrixData, index * 16);\r\n if (this._thinInstanceDataStorage.worldMatrices) {\r\n this._thinInstanceDataStorage.worldMatrices[index] = matrix;\r\n }\r\n if (refresh) {\r\n this.thinInstanceBufferUpdated(\"matrix\");\r\n if (!this.doNotSyncBoundingInfo) {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n }\r\n }\r\n return true;\r\n};\r\nMesh.prototype.thinInstanceSetAttributeAt = function (kind, index, value, refresh) {\r\n if (refresh === void 0) { refresh = true; }\r\n if (!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.data[kind] || index >= this._thinInstanceDataStorage.instancesCount) {\r\n return false;\r\n }\r\n this._thinInstanceUpdateBufferSize(kind, 0); // make sur the buffer for the kind attribute is big enough\r\n this._userThinInstanceBuffersStorage.data[kind].set(value, index * this._userThinInstanceBuffersStorage.strides[kind]);\r\n if (refresh) {\r\n this.thinInstanceBufferUpdated(kind);\r\n }\r\n return true;\r\n};\r\nObject.defineProperty(Mesh.prototype, \"thinInstanceCount\", {\r\n get: function () {\r\n return this._thinInstanceDataStorage.instancesCount;\r\n },\r\n set: function (value) {\r\n var _a, _b;\r\n var numMaxInstances = ((_b = (_a = this._thinInstanceDataStorage.matrixData) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) / 16;\r\n if (value <= numMaxInstances) {\r\n this._thinInstanceDataStorage.instancesCount = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\nMesh.prototype.thinInstanceSetBuffer = function (kind, buffer, stride, staticBuffer) {\r\n var _a, _b;\r\n if (stride === void 0) { stride = 0; }\r\n if (staticBuffer === void 0) { staticBuffer = false; }\r\n stride = stride || 16;\r\n if (kind === \"matrix\") {\r\n (_a = this._thinInstanceDataStorage.matrixBuffer) === null || _a === void 0 ? void 0 : _a.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = null;\r\n this._thinInstanceDataStorage.matrixBufferSize = buffer ? buffer.length : 32 * stride;\r\n this._thinInstanceDataStorage.matrixData = buffer;\r\n this._thinInstanceDataStorage.worldMatrices = null;\r\n if (buffer !== null) {\r\n this._thinInstanceDataStorage.instancesCount = buffer.length / stride;\r\n var matrixBuffer = new Buffer(this.getEngine(), buffer, !staticBuffer, stride, false, true);\r\n this._thinInstanceDataStorage.matrixBuffer = matrixBuffer;\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world0\", 0, 4));\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world1\", 4, 4));\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world2\", 8, 4));\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world3\", 12, 4));\r\n if (!this.doNotSyncBoundingInfo) {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n }\r\n }\r\n else {\r\n this._thinInstanceDataStorage.instancesCount = 0;\r\n if (!this.doNotSyncBoundingInfo) {\r\n // mesh has no more thin instances, so need to recompute the bounding box because it's the regular mesh that will now be displayed\r\n this.refreshBoundingInfo(true);\r\n }\r\n }\r\n }\r\n else {\r\n if (buffer === null) {\r\n if ((_b = this._userThinInstanceBuffersStorage) === null || _b === void 0 ? void 0 : _b.data[kind]) {\r\n this.removeVerticesData(kind);\r\n delete this._userThinInstanceBuffersStorage.data[kind];\r\n delete this._userThinInstanceBuffersStorage.strides[kind];\r\n delete this._userThinInstanceBuffersStorage.sizes[kind];\r\n delete this._userThinInstanceBuffersStorage.vertexBuffers[kind];\r\n }\r\n }\r\n else {\r\n this._thinInstanceInitializeUserStorage();\r\n this._userThinInstanceBuffersStorage.data[kind] = buffer;\r\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = buffer.length;\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), buffer, kind, !staticBuffer, false, stride, true);\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]);\r\n }\r\n }\r\n};\r\nMesh.prototype.thinInstanceBufferUpdated = function (kind) {\r\n var _a;\r\n if (kind === \"matrix\") {\r\n if (this._thinInstanceDataStorage.matrixBuffer) {\r\n this._thinInstanceDataStorage.matrixBuffer.updateDirectly(this._thinInstanceDataStorage.matrixData, 0, this._thinInstanceDataStorage.instancesCount);\r\n }\r\n }\r\n else if ((_a = this._userThinInstanceBuffersStorage) === null || _a === void 0 ? void 0 : _a.vertexBuffers[kind]) {\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind].updateDirectly(this._userThinInstanceBuffersStorage.data[kind], 0);\r\n }\r\n};\r\nMesh.prototype.thinInstancePartialBufferUpdate = function (kind, data, offset) {\r\n var _a;\r\n if (kind === \"matrix\") {\r\n if (this._thinInstanceDataStorage.matrixBuffer) {\r\n this._thinInstanceDataStorage.matrixBuffer.updateDirectly(data, offset);\r\n }\r\n }\r\n else if ((_a = this._userThinInstanceBuffersStorage) === null || _a === void 0 ? void 0 : _a.vertexBuffers[kind]) {\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind].updateDirectly(data, offset);\r\n }\r\n};\r\nMesh.prototype.thinInstanceGetWorldMatrices = function () {\r\n if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {\r\n return [];\r\n }\r\n var matrixData = this._thinInstanceDataStorage.matrixData;\r\n if (!this._thinInstanceDataStorage.worldMatrices) {\r\n this._thinInstanceDataStorage.worldMatrices = new Array();\r\n for (var i = 0; i < this._thinInstanceDataStorage.instancesCount; ++i) {\r\n this._thinInstanceDataStorage.worldMatrices[i] = Matrix.FromArray(matrixData, i * 16);\r\n }\r\n }\r\n return this._thinInstanceDataStorage.worldMatrices;\r\n};\r\nMesh.prototype.thinInstanceRefreshBoundingInfo = function (forceRefreshParentInfo) {\r\n if (forceRefreshParentInfo === void 0) { forceRefreshParentInfo = false; }\r\n if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {\r\n return;\r\n }\r\n var vectors = this._thinInstanceDataStorage.boundingVectors;\r\n if (forceRefreshParentInfo) {\r\n vectors.length = 0;\r\n this.refreshBoundingInfo(true);\r\n }\r\n var boundingInfo = this.getBoundingInfo();\r\n var matrixData = this._thinInstanceDataStorage.matrixData;\r\n if (vectors.length === 0) {\r\n for (var v = 0; v < boundingInfo.boundingBox.vectors.length; ++v) {\r\n vectors.push(boundingInfo.boundingBox.vectors[v].clone());\r\n }\r\n }\r\n TmpVectors.Vector3[0].setAll(Number.POSITIVE_INFINITY); // min\r\n TmpVectors.Vector3[1].setAll(Number.NEGATIVE_INFINITY); // max\r\n for (var i = 0; i < this._thinInstanceDataStorage.instancesCount; ++i) {\r\n Matrix.FromArrayToRef(matrixData, i * 16, TmpVectors.Matrix[0]);\r\n for (var v = 0; v < vectors.length; ++v) {\r\n Vector3.TransformCoordinatesToRef(vectors[v], TmpVectors.Matrix[0], TmpVectors.Vector3[2]);\r\n TmpVectors.Vector3[0].minimizeInPlace(TmpVectors.Vector3[2]);\r\n TmpVectors.Vector3[1].maximizeInPlace(TmpVectors.Vector3[2]);\r\n }\r\n }\r\n boundingInfo.reConstruct(TmpVectors.Vector3[0], TmpVectors.Vector3[1]);\r\n this._updateBoundingInfo();\r\n};\r\nMesh.prototype._thinInstanceUpdateBufferSize = function (kind, numInstances) {\r\n var _a, _b;\r\n if (numInstances === void 0) { numInstances = 1; }\r\n var kindIsMatrix = kind === \"matrix\";\r\n if (!kindIsMatrix && (!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.strides[kind])) {\r\n return;\r\n }\r\n var stride = kindIsMatrix ? 16 : this._userThinInstanceBuffersStorage.strides[kind];\r\n var currentSize = kindIsMatrix ? this._thinInstanceDataStorage.matrixBufferSize : this._userThinInstanceBuffersStorage.sizes[kind];\r\n var data = kindIsMatrix ? this._thinInstanceDataStorage.matrixData : this._userThinInstanceBuffersStorage.data[kind];\r\n var bufferSize = (this._thinInstanceDataStorage.instancesCount + numInstances) * stride;\r\n var newSize = currentSize;\r\n while (newSize < bufferSize) {\r\n newSize *= 2;\r\n }\r\n if (!data || currentSize != newSize) {\r\n if (!data) {\r\n data = new Float32Array(newSize);\r\n }\r\n else {\r\n var newData = new Float32Array(newSize);\r\n newData.set(data, 0);\r\n data = newData;\r\n }\r\n if (kindIsMatrix) {\r\n (_a = this._thinInstanceDataStorage.matrixBuffer) === null || _a === void 0 ? void 0 : _a.dispose();\r\n var matrixBuffer = new Buffer(this.getEngine(), data, true, stride, false, true);\r\n this._thinInstanceDataStorage.matrixBuffer = matrixBuffer;\r\n this._thinInstanceDataStorage.matrixData = data;\r\n this._thinInstanceDataStorage.matrixBufferSize = newSize;\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world0\", 0, 4));\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world1\", 4, 4));\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world2\", 8, 4));\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world3\", 12, 4));\r\n }\r\n else {\r\n (_b = this._userThinInstanceBuffersStorage.vertexBuffers[kind]) === null || _b === void 0 ? void 0 : _b.dispose();\r\n this._userThinInstanceBuffersStorage.data[kind] = data;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = newSize;\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), data, kind, true, false, stride, true);\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]);\r\n }\r\n }\r\n};\r\nMesh.prototype._thinInstanceInitializeUserStorage = function () {\r\n if (!this._userThinInstanceBuffersStorage) {\r\n this._userThinInstanceBuffersStorage = {\r\n data: {},\r\n sizes: {},\r\n vertexBuffers: {},\r\n strides: {},\r\n };\r\n }\r\n};\r\nMesh.prototype._disposeThinInstanceSpecificData = function () {\r\n var _a;\r\n if ((_a = this._thinInstanceDataStorage) === null || _a === void 0 ? void 0 : _a.matrixBuffer) {\r\n this._thinInstanceDataStorage.matrixBuffer.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = null;\r\n }\r\n};\r\n//# sourceMappingURL=thinInstanceMesh.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, serializeAsVector3, serializeAsQuaternion, SerializationHelper } from \"../Misc/decorators\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Quaternion, Matrix, Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport { Space } from '../Maths/math.axis';\r\n/**\r\n * A TransformNode is an object that is not rendered but can be used as a center of transformation. This can decrease memory usage and increase rendering speed compared to using an empty mesh as a parent and is less complicated than using a pivot matrix.\r\n * @see https://doc.babylonjs.com/how_to/transformnode\r\n */\r\nvar TransformNode = /** @class */ (function (_super) {\r\n __extends(TransformNode, _super);\r\n function TransformNode(name, scene, isPure) {\r\n if (scene === void 0) { scene = null; }\r\n if (isPure === void 0) { isPure = true; }\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._forward = new Vector3(0, 0, 1);\r\n _this._forwardInverted = new Vector3(0, 0, -1);\r\n _this._up = new Vector3(0, 1, 0);\r\n _this._right = new Vector3(1, 0, 0);\r\n _this._rightInverted = new Vector3(-1, 0, 0);\r\n // Properties\r\n _this._position = Vector3.Zero();\r\n _this._rotation = Vector3.Zero();\r\n _this._rotationQuaternion = null;\r\n _this._scaling = Vector3.One();\r\n _this._isDirty = false;\r\n _this._transformToBoneReferal = null;\r\n _this._isAbsoluteSynced = false;\r\n _this._billboardMode = TransformNode.BILLBOARDMODE_NONE;\r\n _this._preserveParentRotationForBillboard = false;\r\n /**\r\n * Multiplication factor on scale x/y/z when computing the world matrix. Eg. for a 1x1x1 cube setting this to 2 will make it a 2x2x2 cube\r\n */\r\n _this.scalingDeterminant = 1;\r\n _this._infiniteDistance = false;\r\n /**\r\n * Gets or sets a boolean indicating that non uniform scaling (when at least one component is different from others) should be ignored.\r\n * By default the system will update normals to compensate\r\n */\r\n _this.ignoreNonUniformScaling = false;\r\n /**\r\n * Gets or sets a boolean indicating that even if rotationQuaternion is defined, you can keep updating rotation property and Babylon.js will just mix both\r\n */\r\n _this.reIntegrateRotationIntoRotationQuaternion = false;\r\n // Cache\r\n /** @hidden */\r\n _this._poseMatrix = null;\r\n /** @hidden */\r\n _this._localMatrix = Matrix.Zero();\r\n _this._usePivotMatrix = false;\r\n _this._absolutePosition = Vector3.Zero();\r\n _this._absoluteScaling = Vector3.Zero();\r\n _this._absoluteRotationQuaternion = Quaternion.Identity();\r\n _this._pivotMatrix = Matrix.Identity();\r\n /** @hidden */\r\n _this._postMultiplyPivotMatrix = false;\r\n _this._isWorldMatrixFrozen = false;\r\n /** @hidden */\r\n _this._indexInSceneTransformNodesArray = -1;\r\n /**\r\n * An event triggered after the world matrix is updated\r\n */\r\n _this.onAfterWorldMatrixUpdateObservable = new Observable();\r\n _this._nonUniformScaling = false;\r\n if (isPure) {\r\n _this.getScene().addTransformNode(_this);\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(TransformNode.prototype, \"billboardMode\", {\r\n /**\r\n * Gets or sets the billboard mode. Default is 0.\r\n *\r\n * | Value | Type | Description |\r\n * | --- | --- | --- |\r\n * | 0 | BILLBOARDMODE_NONE | |\r\n * | 1 | BILLBOARDMODE_X | |\r\n * | 2 | BILLBOARDMODE_Y | |\r\n * | 4 | BILLBOARDMODE_Z | |\r\n * | 7 | BILLBOARDMODE_ALL | |\r\n *\r\n */\r\n get: function () {\r\n return this._billboardMode;\r\n },\r\n set: function (value) {\r\n if (this._billboardMode === value) {\r\n return;\r\n }\r\n this._billboardMode = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"preserveParentRotationForBillboard\", {\r\n /**\r\n * Gets or sets a boolean indicating that parent rotation should be preserved when using billboards.\r\n * This could be useful for glTF objects where parent rotation helps converting from right handed to left handed\r\n */\r\n get: function () {\r\n return this._preserveParentRotationForBillboard;\r\n },\r\n set: function (value) {\r\n if (value === this._preserveParentRotationForBillboard) {\r\n return;\r\n }\r\n this._preserveParentRotationForBillboard = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"infiniteDistance\", {\r\n /**\r\n * Gets or sets the distance of the object to max, often used by skybox\r\n */\r\n get: function () {\r\n return this._infiniteDistance;\r\n },\r\n set: function (value) {\r\n if (this._infiniteDistance === value) {\r\n return;\r\n }\r\n this._infiniteDistance = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"TransformNode\" string\r\n */\r\n TransformNode.prototype.getClassName = function () {\r\n return \"TransformNode\";\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"position\", {\r\n /**\r\n * Gets or set the node position (default is (0.0, 0.0, 0.0))\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n set: function (newPosition) {\r\n this._position = newPosition;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"rotation\", {\r\n /**\r\n * Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).\r\n * If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion\r\n */\r\n get: function () {\r\n return this._rotation;\r\n },\r\n set: function (newRotation) {\r\n this._rotation = newRotation;\r\n this._rotationQuaternion = null;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"scaling\", {\r\n /**\r\n * Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).\r\n */\r\n get: function () {\r\n return this._scaling;\r\n },\r\n set: function (newScaling) {\r\n this._scaling = newScaling;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"rotationQuaternion\", {\r\n /**\r\n * Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (undefined by default, but can be null).\r\n * If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)\r\n */\r\n get: function () {\r\n return this._rotationQuaternion;\r\n },\r\n set: function (quaternion) {\r\n this._rotationQuaternion = quaternion;\r\n //reset the rotation vector.\r\n if (quaternion) {\r\n this._rotation.setAll(0.0);\r\n }\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"forward\", {\r\n /**\r\n * The forward direction of that transform in world space.\r\n */\r\n get: function () {\r\n return Vector3.Normalize(Vector3.TransformNormal(this.getScene().useRightHandedSystem ? this._forwardInverted : this._forward, this.getWorldMatrix()));\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"up\", {\r\n /**\r\n * The up direction of that transform in world space.\r\n */\r\n get: function () {\r\n return Vector3.Normalize(Vector3.TransformNormal(this._up, this.getWorldMatrix()));\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"right\", {\r\n /**\r\n * The right direction of that transform in world space.\r\n */\r\n get: function () {\r\n return Vector3.Normalize(Vector3.TransformNormal(this.getScene().useRightHandedSystem ? this._rightInverted : this._right, this.getWorldMatrix()));\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Copies the parameter passed Matrix into the mesh Pose matrix.\r\n * @param matrix the matrix to copy the pose from\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.updatePoseMatrix = function (matrix) {\r\n if (!this._poseMatrix) {\r\n this._poseMatrix = matrix.clone();\r\n return this;\r\n }\r\n this._poseMatrix.copyFrom(matrix);\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh Pose matrix.\r\n * @returns the pose matrix\r\n */\r\n TransformNode.prototype.getPoseMatrix = function () {\r\n if (!this._poseMatrix) {\r\n this._poseMatrix = Matrix.Identity();\r\n }\r\n return this._poseMatrix;\r\n };\r\n /** @hidden */\r\n TransformNode.prototype._isSynchronized = function () {\r\n var cache = this._cache;\r\n if (this.billboardMode !== cache.billboardMode || this.billboardMode !== TransformNode.BILLBOARDMODE_NONE) {\r\n return false;\r\n }\r\n if (cache.pivotMatrixUpdated) {\r\n return false;\r\n }\r\n if (this.infiniteDistance) {\r\n return false;\r\n }\r\n if (this.position._isDirty) {\r\n return false;\r\n }\r\n if (this.scaling._isDirty) {\r\n return false;\r\n }\r\n if (this._rotationQuaternion && this._rotationQuaternion._isDirty || this.rotation._isDirty) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n TransformNode.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n var cache = this._cache;\r\n cache.localMatrixUpdated = false;\r\n cache.billboardMode = -1;\r\n cache.infiniteDistance = false;\r\n };\r\n /**\r\n * Flag the transform node as dirty (Forcing it to update everything)\r\n * @param property if set to \"rotation\" the objects rotationQuaternion will be set to null\r\n * @returns this transform node\r\n */\r\n TransformNode.prototype.markAsDirty = function (property) {\r\n this._currentRenderId = Number.MAX_VALUE;\r\n this._isDirty = true;\r\n return this;\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"absolutePosition\", {\r\n /**\r\n * Returns the current mesh absolute position.\r\n * Returns a Vector3.\r\n */\r\n get: function () {\r\n return this._absolutePosition;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"absoluteScaling\", {\r\n /**\r\n * Returns the current mesh absolute scaling.\r\n * Returns a Vector3.\r\n */\r\n get: function () {\r\n this._syncAbsoluteScalingAndRotation();\r\n return this._absoluteScaling;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"absoluteRotationQuaternion\", {\r\n /**\r\n * Returns the current mesh absolute rotation.\r\n * Returns a Quaternion.\r\n */\r\n get: function () {\r\n this._syncAbsoluteScalingAndRotation();\r\n return this._absoluteRotationQuaternion;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Sets a new matrix to apply before all other transformation\r\n * @param matrix defines the transform matrix\r\n * @returns the current TransformNode\r\n */\r\n TransformNode.prototype.setPreTransformMatrix = function (matrix) {\r\n return this.setPivotMatrix(matrix, false);\r\n };\r\n /**\r\n * Sets a new pivot matrix to the current node\r\n * @param matrix defines the new pivot matrix to use\r\n * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect\r\n * @returns the current TransformNode\r\n */\r\n TransformNode.prototype.setPivotMatrix = function (matrix, postMultiplyPivotMatrix) {\r\n if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = true; }\r\n this._pivotMatrix.copyFrom(matrix);\r\n this._usePivotMatrix = !this._pivotMatrix.isIdentity();\r\n this._cache.pivotMatrixUpdated = true;\r\n this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;\r\n if (this._postMultiplyPivotMatrix) {\r\n if (!this._pivotMatrixInverse) {\r\n this._pivotMatrixInverse = Matrix.Invert(this._pivotMatrix);\r\n }\r\n else {\r\n this._pivotMatrix.invertToRef(this._pivotMatrixInverse);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh pivot matrix.\r\n * Default : Identity.\r\n * @returns the matrix\r\n */\r\n TransformNode.prototype.getPivotMatrix = function () {\r\n return this._pivotMatrix;\r\n };\r\n /**\r\n * Instantiate (when possible) or clone that node with its hierarchy\r\n * @param newParent defines the new parent to use for the instance (or clone)\r\n * @param options defines options to configure how copy is done\r\n * @param onNewNodeCreated defines an option callback to call when a clone or an instance is created\r\n * @returns an instance (or a clone) of the current node with its hiearchy\r\n */\r\n TransformNode.prototype.instantiateHierarchy = function (newParent, options, onNewNodeCreated) {\r\n if (newParent === void 0) { newParent = null; }\r\n var clone = this.clone(\"Clone of \" + (this.name || this.id), newParent || this.parent, true);\r\n if (clone) {\r\n if (onNewNodeCreated) {\r\n onNewNodeCreated(this, clone);\r\n }\r\n }\r\n for (var _i = 0, _a = this.getChildTransformNodes(true); _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child.instantiateHierarchy(clone, options, onNewNodeCreated);\r\n }\r\n return clone;\r\n };\r\n /**\r\n * Prevents the World matrix to be computed any longer\r\n * @param newWorldMatrix defines an optional matrix to use as world matrix\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.freezeWorldMatrix = function (newWorldMatrix) {\r\n if (newWorldMatrix === void 0) { newWorldMatrix = null; }\r\n if (newWorldMatrix) {\r\n this._worldMatrix = newWorldMatrix;\r\n }\r\n else {\r\n this._isWorldMatrixFrozen = false; // no guarantee world is not already frozen, switch off temporarily\r\n this.computeWorldMatrix(true);\r\n }\r\n this._isDirty = false;\r\n this._isWorldMatrixFrozen = true;\r\n return this;\r\n };\r\n /**\r\n * Allows back the World matrix computation.\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.unfreezeWorldMatrix = function () {\r\n this._isWorldMatrixFrozen = false;\r\n this.computeWorldMatrix(true);\r\n return this;\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"isWorldMatrixFrozen\", {\r\n /**\r\n * True if the World matrix has been frozen.\r\n */\r\n get: function () {\r\n return this._isWorldMatrixFrozen;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Retuns the mesh absolute position in the World.\r\n * @returns a Vector3.\r\n */\r\n TransformNode.prototype.getAbsolutePosition = function () {\r\n this.computeWorldMatrix();\r\n return this._absolutePosition;\r\n };\r\n /**\r\n * Sets the mesh absolute position in the World from a Vector3 or an Array(3).\r\n * @param absolutePosition the absolute position to set\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.setAbsolutePosition = function (absolutePosition) {\r\n if (!absolutePosition) {\r\n return this;\r\n }\r\n var absolutePositionX;\r\n var absolutePositionY;\r\n var absolutePositionZ;\r\n if (absolutePosition.x === undefined) {\r\n if (arguments.length < 3) {\r\n return this;\r\n }\r\n absolutePositionX = arguments[0];\r\n absolutePositionY = arguments[1];\r\n absolutePositionZ = arguments[2];\r\n }\r\n else {\r\n absolutePositionX = absolutePosition.x;\r\n absolutePositionY = absolutePosition.y;\r\n absolutePositionZ = absolutePosition.z;\r\n }\r\n if (this.parent) {\r\n var invertParentWorldMatrix = TmpVectors.Matrix[0];\r\n this.parent.getWorldMatrix().invertToRef(invertParentWorldMatrix);\r\n Vector3.TransformCoordinatesFromFloatsToRef(absolutePositionX, absolutePositionY, absolutePositionZ, invertParentWorldMatrix, this.position);\r\n }\r\n else {\r\n this.position.x = absolutePositionX;\r\n this.position.y = absolutePositionY;\r\n this.position.z = absolutePositionZ;\r\n }\r\n this._absolutePosition.copyFrom(absolutePosition);\r\n return this;\r\n };\r\n /**\r\n * Sets the mesh position in its local space.\r\n * @param vector3 the position to set in localspace\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.setPositionWithLocalVector = function (vector3) {\r\n this.computeWorldMatrix();\r\n this.position = Vector3.TransformNormal(vector3, this._localMatrix);\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh position in the local space from the current World matrix values.\r\n * @returns a new Vector3.\r\n */\r\n TransformNode.prototype.getPositionExpressedInLocalSpace = function () {\r\n this.computeWorldMatrix();\r\n var invLocalWorldMatrix = TmpVectors.Matrix[0];\r\n this._localMatrix.invertToRef(invLocalWorldMatrix);\r\n return Vector3.TransformNormal(this.position, invLocalWorldMatrix);\r\n };\r\n /**\r\n * Translates the mesh along the passed Vector3 in its local space.\r\n * @param vector3 the distance to translate in localspace\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.locallyTranslate = function (vector3) {\r\n this.computeWorldMatrix(true);\r\n this.position = Vector3.TransformCoordinates(vector3, this._localMatrix);\r\n return this;\r\n };\r\n /**\r\n * Orients a mesh towards a target point. Mesh must be drawn facing user.\r\n * @param targetPoint the position (must be in same space as current mesh) to look at\r\n * @param yawCor optional yaw (y-axis) correction in radians\r\n * @param pitchCor optional pitch (x-axis) correction in radians\r\n * @param rollCor optional roll (z-axis) correction in radians\r\n * @param space the choosen space of the target\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.lookAt = function (targetPoint, yawCor, pitchCor, rollCor, space) {\r\n if (yawCor === void 0) { yawCor = 0; }\r\n if (pitchCor === void 0) { pitchCor = 0; }\r\n if (rollCor === void 0) { rollCor = 0; }\r\n if (space === void 0) { space = Space.LOCAL; }\r\n var dv = TransformNode._lookAtVectorCache;\r\n var pos = space === Space.LOCAL ? this.position : this.getAbsolutePosition();\r\n targetPoint.subtractToRef(pos, dv);\r\n this.setDirection(dv, yawCor, pitchCor, rollCor);\r\n // Correct for parent's rotation offset\r\n if (space === Space.WORLD && this.parent) {\r\n if (this.rotationQuaternion) {\r\n // Get local rotation matrix of the looking object\r\n var rotationMatrix = TmpVectors.Matrix[0];\r\n this.rotationQuaternion.toRotationMatrix(rotationMatrix);\r\n // Offset rotation by parent's inverted rotation matrix to correct in world space\r\n var parentRotationMatrix = TmpVectors.Matrix[1];\r\n this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);\r\n parentRotationMatrix.invert();\r\n rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);\r\n this.rotationQuaternion.fromRotationMatrix(rotationMatrix);\r\n }\r\n else {\r\n // Get local rotation matrix of the looking object\r\n var quaternionRotation = TmpVectors.Quaternion[0];\r\n Quaternion.FromEulerVectorToRef(this.rotation, quaternionRotation);\r\n var rotationMatrix = TmpVectors.Matrix[0];\r\n quaternionRotation.toRotationMatrix(rotationMatrix);\r\n // Offset rotation by parent's inverted rotation matrix to correct in world space\r\n var parentRotationMatrix = TmpVectors.Matrix[1];\r\n this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);\r\n parentRotationMatrix.invert();\r\n rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);\r\n quaternionRotation.fromRotationMatrix(rotationMatrix);\r\n quaternionRotation.toEulerAnglesToRef(this.rotation);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.\r\n * This Vector3 is expressed in the World space.\r\n * @param localAxis axis to rotate\r\n * @returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.\r\n */\r\n TransformNode.prototype.getDirection = function (localAxis) {\r\n var result = Vector3.Zero();\r\n this.getDirectionToRef(localAxis, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the Vector3 \"result\" as the rotated Vector3 \"localAxis\" in the same rotation than the mesh.\r\n * localAxis is expressed in the mesh local space.\r\n * result is computed in the Wordl space from the mesh World matrix.\r\n * @param localAxis axis to rotate\r\n * @param result the resulting transformnode\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.getDirectionToRef = function (localAxis, result) {\r\n Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);\r\n return this;\r\n };\r\n /**\r\n * Sets this transform node rotation to the given local axis.\r\n * @param localAxis the axis in local space\r\n * @param yawCor optional yaw (y-axis) correction in radians\r\n * @param pitchCor optional pitch (x-axis) correction in radians\r\n * @param rollCor optional roll (z-axis) correction in radians\r\n * @returns this TransformNode\r\n */\r\n TransformNode.prototype.setDirection = function (localAxis, yawCor, pitchCor, rollCor) {\r\n if (yawCor === void 0) { yawCor = 0; }\r\n if (pitchCor === void 0) { pitchCor = 0; }\r\n if (rollCor === void 0) { rollCor = 0; }\r\n var yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;\r\n var len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);\r\n var pitch = -Math.atan2(localAxis.y, len);\r\n if (this.rotationQuaternion) {\r\n Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);\r\n }\r\n else {\r\n this.rotation.x = pitch + pitchCor;\r\n this.rotation.y = yaw + yawCor;\r\n this.rotation.z = rollCor;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a new pivot point to the current node\r\n * @param point defines the new pivot point to use\r\n * @param space defines if the point is in world or local space (local by default)\r\n * @returns the current TransformNode\r\n */\r\n TransformNode.prototype.setPivotPoint = function (point, space) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (this.getScene().getRenderId() == 0) {\r\n this.computeWorldMatrix(true);\r\n }\r\n var wm = this.getWorldMatrix();\r\n if (space == Space.WORLD) {\r\n var tmat = TmpVectors.Matrix[0];\r\n wm.invertToRef(tmat);\r\n point = Vector3.TransformCoordinates(point, tmat);\r\n }\r\n return this.setPivotMatrix(Matrix.Translation(-point.x, -point.y, -point.z), true);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the mesh pivot point coordinates in the local space.\r\n * @returns the pivot point\r\n */\r\n TransformNode.prototype.getPivotPoint = function () {\r\n var point = Vector3.Zero();\r\n this.getPivotPointToRef(point);\r\n return point;\r\n };\r\n /**\r\n * Sets the passed Vector3 \"result\" with the coordinates of the mesh pivot point in the local space.\r\n * @param result the vector3 to store the result\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.getPivotPointToRef = function (result) {\r\n result.x = -this._pivotMatrix.m[12];\r\n result.y = -this._pivotMatrix.m[13];\r\n result.z = -this._pivotMatrix.m[14];\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the mesh pivot point World coordinates.\r\n * @returns a new Vector3 set with the mesh pivot point World coordinates.\r\n */\r\n TransformNode.prototype.getAbsolutePivotPoint = function () {\r\n var point = Vector3.Zero();\r\n this.getAbsolutePivotPointToRef(point);\r\n return point;\r\n };\r\n /**\r\n * Sets the Vector3 \"result\" coordinates with the mesh pivot point World coordinates.\r\n * @param result vector3 to store the result\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.getAbsolutePivotPointToRef = function (result) {\r\n this.getPivotPointToRef(result);\r\n Vector3.TransformCoordinatesToRef(result, this.getWorldMatrix(), result);\r\n return this;\r\n };\r\n /**\r\n * Defines the passed node as the parent of the current node.\r\n * The node will remain exactly where it is and its position / rotation will be updated accordingly\r\n * @see https://doc.babylonjs.com/how_to/parenting\r\n * @param node the node ot set as the parent\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.setParent = function (node) {\r\n if (!node && !this.parent) {\r\n return this;\r\n }\r\n var quatRotation = TmpVectors.Quaternion[0];\r\n var position = TmpVectors.Vector3[0];\r\n var scale = TmpVectors.Vector3[1];\r\n if (!node) {\r\n this.computeWorldMatrix(true);\r\n this.getWorldMatrix().decompose(scale, quatRotation, position);\r\n }\r\n else {\r\n var diffMatrix = TmpVectors.Matrix[0];\r\n var invParentMatrix = TmpVectors.Matrix[1];\r\n this.computeWorldMatrix(true);\r\n node.computeWorldMatrix(true);\r\n node.getWorldMatrix().invertToRef(invParentMatrix);\r\n this.getWorldMatrix().multiplyToRef(invParentMatrix, diffMatrix);\r\n diffMatrix.decompose(scale, quatRotation, position);\r\n }\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion.copyFrom(quatRotation);\r\n }\r\n else {\r\n quatRotation.toEulerAnglesToRef(this.rotation);\r\n }\r\n this.scaling.copyFrom(scale);\r\n this.position.copyFrom(position);\r\n this.parent = node;\r\n return this;\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"nonUniformScaling\", {\r\n /**\r\n * True if the scaling property of this object is non uniform eg. (1,2,1)\r\n */\r\n get: function () {\r\n return this._nonUniformScaling;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n TransformNode.prototype._updateNonUniformScalingState = function (value) {\r\n if (this._nonUniformScaling === value) {\r\n return false;\r\n }\r\n this._nonUniformScaling = value;\r\n return true;\r\n };\r\n /**\r\n * Attach the current TransformNode to another TransformNode associated with a bone\r\n * @param bone Bone affecting the TransformNode\r\n * @param affectedTransformNode TransformNode associated with the bone\r\n * @returns this object\r\n */\r\n TransformNode.prototype.attachToBone = function (bone, affectedTransformNode) {\r\n this._transformToBoneReferal = affectedTransformNode;\r\n this.parent = bone;\r\n bone.getSkeleton().prepare();\r\n if (bone.getWorldMatrix().determinant() < 0) {\r\n this.scalingDeterminant *= -1;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Detach the transform node if its associated with a bone\r\n * @returns this object\r\n */\r\n TransformNode.prototype.detachFromBone = function () {\r\n if (!this.parent) {\r\n return this;\r\n }\r\n if (this.parent.getWorldMatrix().determinant() < 0) {\r\n this.scalingDeterminant *= -1;\r\n }\r\n this._transformToBoneReferal = null;\r\n this.parent = null;\r\n return this;\r\n };\r\n /**\r\n * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space.\r\n * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.\r\n * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.\r\n * The passed axis is also normalized.\r\n * @param axis the axis to rotate around\r\n * @param amount the amount to rotate in radians\r\n * @param space Space to rotate in (Default: local)\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.rotate = function (axis, amount, space) {\r\n axis.normalize();\r\n if (!this.rotationQuaternion) {\r\n this.rotationQuaternion = this.rotation.toQuaternion();\r\n this.rotation.setAll(0);\r\n }\r\n var rotationQuaternion;\r\n if (!space || space === Space.LOCAL) {\r\n rotationQuaternion = Quaternion.RotationAxisToRef(axis, amount, TransformNode._rotationAxisCache);\r\n this.rotationQuaternion.multiplyToRef(rotationQuaternion, this.rotationQuaternion);\r\n }\r\n else {\r\n if (this.parent) {\r\n var invertParentWorldMatrix = TmpVectors.Matrix[0];\r\n this.parent.getWorldMatrix().invertToRef(invertParentWorldMatrix);\r\n axis = Vector3.TransformNormal(axis, invertParentWorldMatrix);\r\n }\r\n rotationQuaternion = Quaternion.RotationAxisToRef(axis, amount, TransformNode._rotationAxisCache);\r\n rotationQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space.\r\n * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.\r\n * The passed axis is also normalized. .\r\n * Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm\r\n * @param point the point to rotate around\r\n * @param axis the axis to rotate around\r\n * @param amount the amount to rotate in radians\r\n * @returns the TransformNode\r\n */\r\n TransformNode.prototype.rotateAround = function (point, axis, amount) {\r\n axis.normalize();\r\n if (!this.rotationQuaternion) {\r\n this.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);\r\n this.rotation.setAll(0);\r\n }\r\n var tmpVector = TmpVectors.Vector3[0];\r\n var finalScale = TmpVectors.Vector3[1];\r\n var finalTranslation = TmpVectors.Vector3[2];\r\n var finalRotation = TmpVectors.Quaternion[0];\r\n var translationMatrix = TmpVectors.Matrix[0]; // T\r\n var translationMatrixInv = TmpVectors.Matrix[1]; // T'\r\n var rotationMatrix = TmpVectors.Matrix[2]; // R\r\n var finalMatrix = TmpVectors.Matrix[3]; // T' x R x T\r\n point.subtractToRef(this.position, tmpVector);\r\n Matrix.TranslationToRef(tmpVector.x, tmpVector.y, tmpVector.z, translationMatrix); // T\r\n Matrix.TranslationToRef(-tmpVector.x, -tmpVector.y, -tmpVector.z, translationMatrixInv); // T'\r\n Matrix.RotationAxisToRef(axis, amount, rotationMatrix); // R\r\n translationMatrixInv.multiplyToRef(rotationMatrix, finalMatrix); // T' x R\r\n finalMatrix.multiplyToRef(translationMatrix, finalMatrix); // T' x R x T\r\n finalMatrix.decompose(finalScale, finalRotation, finalTranslation);\r\n this.position.addInPlace(finalTranslation);\r\n finalRotation.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\r\n return this;\r\n };\r\n /**\r\n * Translates the mesh along the axis vector for the passed distance in the given space.\r\n * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.\r\n * @param axis the axis to translate in\r\n * @param distance the distance to translate\r\n * @param space Space to rotate in (Default: local)\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.translate = function (axis, distance, space) {\r\n var displacementVector = axis.scale(distance);\r\n if (!space || space === Space.LOCAL) {\r\n var tempV3 = this.getPositionExpressedInLocalSpace().add(displacementVector);\r\n this.setPositionWithLocalVector(tempV3);\r\n }\r\n else {\r\n this.setAbsolutePosition(this.getAbsolutePosition().add(displacementVector));\r\n }\r\n return this;\r\n };\r\n /**\r\n * Adds a rotation step to the mesh current rotation.\r\n * x, y, z are Euler angles expressed in radians.\r\n * This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set.\r\n * This means this rotation is made in the mesh local space only.\r\n * It's useful to set a custom rotation order different from the BJS standard one YXZ.\r\n * Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.\r\n * ```javascript\r\n * mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);\r\n * ```\r\n * Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.\r\n * Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.\r\n * @param x Rotation to add\r\n * @param y Rotation to add\r\n * @param z Rotation to add\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.addRotation = function (x, y, z) {\r\n var rotationQuaternion;\r\n if (this.rotationQuaternion) {\r\n rotationQuaternion = this.rotationQuaternion;\r\n }\r\n else {\r\n rotationQuaternion = TmpVectors.Quaternion[1];\r\n Quaternion.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, rotationQuaternion);\r\n }\r\n var accumulation = TmpVectors.Quaternion[0];\r\n Quaternion.RotationYawPitchRollToRef(y, x, z, accumulation);\r\n rotationQuaternion.multiplyInPlace(accumulation);\r\n if (!this.rotationQuaternion) {\r\n rotationQuaternion.toEulerAnglesToRef(this.rotation);\r\n }\r\n return this;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n TransformNode.prototype._getEffectiveParent = function () {\r\n return this.parent;\r\n };\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @returns the world matrix\r\n */\r\n TransformNode.prototype.computeWorldMatrix = function (force) {\r\n if (this._isWorldMatrixFrozen && !this._isDirty) {\r\n return this._worldMatrix;\r\n }\r\n var currentRenderId = this.getScene().getRenderId();\r\n if (!this._isDirty && !force && this.isSynchronized()) {\r\n this._currentRenderId = currentRenderId;\r\n return this._worldMatrix;\r\n }\r\n var camera = this.getScene().activeCamera;\r\n var useBillboardPosition = (this._billboardMode & TransformNode.BILLBOARDMODE_USE_POSITION) !== 0;\r\n var useBillboardPath = this._billboardMode !== TransformNode.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard;\r\n // Billboarding based on camera position\r\n if (useBillboardPath && camera && useBillboardPosition) {\r\n this.lookAt(camera.position);\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {\r\n this.rotation.x = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {\r\n this.rotation.y = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {\r\n this.rotation.z = 0;\r\n }\r\n }\r\n this._updateCache();\r\n var cache = this._cache;\r\n cache.pivotMatrixUpdated = false;\r\n cache.billboardMode = this.billboardMode;\r\n cache.infiniteDistance = this.infiniteDistance;\r\n this._currentRenderId = currentRenderId;\r\n this._childUpdateId++;\r\n this._isDirty = false;\r\n this._position._isDirty = false;\r\n this._rotation._isDirty = false;\r\n this._scaling._isDirty = false;\r\n var parent = this._getEffectiveParent();\r\n // Scaling\r\n var scaling = TransformNode._TmpScaling;\r\n var translation = this._position;\r\n // Translation\r\n if (this._infiniteDistance) {\r\n if (!this.parent && camera) {\r\n var cameraWorldMatrix = camera.getWorldMatrix();\r\n var cameraGlobalPosition = new Vector3(cameraWorldMatrix.m[12], cameraWorldMatrix.m[13], cameraWorldMatrix.m[14]);\r\n translation = TransformNode._TmpTranslation;\r\n translation.copyFromFloats(this._position.x + cameraGlobalPosition.x, this._position.y + cameraGlobalPosition.y, this._position.z + cameraGlobalPosition.z);\r\n }\r\n }\r\n // Scaling\r\n scaling.copyFromFloats(this._scaling.x * this.scalingDeterminant, this._scaling.y * this.scalingDeterminant, this._scaling.z * this.scalingDeterminant);\r\n // Rotation\r\n var rotation;\r\n if (this._rotationQuaternion) {\r\n this._rotationQuaternion._isDirty = false;\r\n rotation = this._rotationQuaternion;\r\n if (this.reIntegrateRotationIntoRotationQuaternion) {\r\n var len = this.rotation.lengthSquared();\r\n if (len) {\r\n this._rotationQuaternion.multiplyInPlace(Quaternion.RotationYawPitchRoll(this._rotation.y, this._rotation.x, this._rotation.z));\r\n this._rotation.copyFromFloats(0, 0, 0);\r\n }\r\n }\r\n }\r\n else {\r\n rotation = TransformNode._TmpRotation;\r\n Quaternion.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, rotation);\r\n }\r\n // Compose\r\n if (this._usePivotMatrix) {\r\n var scaleMatrix = TmpVectors.Matrix[1];\r\n Matrix.ScalingToRef(scaling.x, scaling.y, scaling.z, scaleMatrix);\r\n // Rotation\r\n var rotationMatrix = TmpVectors.Matrix[0];\r\n rotation.toRotationMatrix(rotationMatrix);\r\n // Composing transformations\r\n this._pivotMatrix.multiplyToRef(scaleMatrix, TmpVectors.Matrix[4]);\r\n TmpVectors.Matrix[4].multiplyToRef(rotationMatrix, this._localMatrix);\r\n // Post multiply inverse of pivotMatrix\r\n if (this._postMultiplyPivotMatrix) {\r\n this._localMatrix.multiplyToRef(this._pivotMatrixInverse, this._localMatrix);\r\n }\r\n this._localMatrix.addTranslationFromFloats(translation.x, translation.y, translation.z);\r\n }\r\n else {\r\n Matrix.ComposeToRef(scaling, rotation, translation, this._localMatrix);\r\n }\r\n // Parent\r\n if (parent && parent.getWorldMatrix) {\r\n if (force) {\r\n parent.computeWorldMatrix();\r\n }\r\n if (useBillboardPath) {\r\n if (this._transformToBoneReferal) {\r\n parent.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), TmpVectors.Matrix[7]);\r\n }\r\n else {\r\n TmpVectors.Matrix[7].copyFrom(parent.getWorldMatrix());\r\n }\r\n // Extract scaling and translation from parent\r\n var translation_1 = TmpVectors.Vector3[5];\r\n var scale = TmpVectors.Vector3[6];\r\n TmpVectors.Matrix[7].decompose(scale, undefined, translation_1);\r\n Matrix.ScalingToRef(scale.x, scale.y, scale.z, TmpVectors.Matrix[7]);\r\n TmpVectors.Matrix[7].setTranslation(translation_1);\r\n this._localMatrix.multiplyToRef(TmpVectors.Matrix[7], this._worldMatrix);\r\n }\r\n else {\r\n if (this._transformToBoneReferal) {\r\n this._localMatrix.multiplyToRef(parent.getWorldMatrix(), TmpVectors.Matrix[6]);\r\n TmpVectors.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), this._worldMatrix);\r\n }\r\n else {\r\n this._localMatrix.multiplyToRef(parent.getWorldMatrix(), this._worldMatrix);\r\n }\r\n }\r\n this._markSyncedWithParent();\r\n }\r\n else {\r\n this._worldMatrix.copyFrom(this._localMatrix);\r\n }\r\n // Billboarding based on camera orientation (testing PG:http://www.babylonjs-playground.com/#UJEIL#13)\r\n if (useBillboardPath && camera && this.billboardMode && !useBillboardPosition) {\r\n var storedTranslation = TmpVectors.Vector3[0];\r\n this._worldMatrix.getTranslationToRef(storedTranslation); // Save translation\r\n // Cancel camera rotation\r\n TmpVectors.Matrix[1].copyFrom(camera.getViewMatrix());\r\n TmpVectors.Matrix[1].setTranslationFromFloats(0, 0, 0);\r\n TmpVectors.Matrix[1].invertToRef(TmpVectors.Matrix[0]);\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_ALL) !== TransformNode.BILLBOARDMODE_ALL) {\r\n TmpVectors.Matrix[0].decompose(undefined, TmpVectors.Quaternion[0], undefined);\r\n var eulerAngles = TmpVectors.Vector3[1];\r\n TmpVectors.Quaternion[0].toEulerAnglesToRef(eulerAngles);\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {\r\n eulerAngles.x = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {\r\n eulerAngles.y = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {\r\n eulerAngles.z = 0;\r\n }\r\n Matrix.RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, TmpVectors.Matrix[0]);\r\n }\r\n this._worldMatrix.setTranslationFromFloats(0, 0, 0);\r\n this._worldMatrix.multiplyToRef(TmpVectors.Matrix[0], this._worldMatrix);\r\n // Restore translation\r\n this._worldMatrix.setTranslation(TmpVectors.Vector3[0]);\r\n }\r\n // Normal matrix\r\n if (!this.ignoreNonUniformScaling) {\r\n if (this._scaling.isNonUniformWithinEpsilon(0.000001)) {\r\n this._updateNonUniformScalingState(true);\r\n }\r\n else if (parent && parent._nonUniformScaling) {\r\n this._updateNonUniformScalingState(parent._nonUniformScaling);\r\n }\r\n else {\r\n this._updateNonUniformScalingState(false);\r\n }\r\n }\r\n else {\r\n this._updateNonUniformScalingState(false);\r\n }\r\n this._afterComputeWorldMatrix();\r\n // Absolute position\r\n this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);\r\n this._isAbsoluteSynced = false;\r\n // Callbacks\r\n this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);\r\n if (!this._poseMatrix) {\r\n this._poseMatrix = Matrix.Invert(this._worldMatrix);\r\n }\r\n // Cache the determinant\r\n this._worldMatrixDeterminantIsDirty = true;\r\n return this._worldMatrix;\r\n };\r\n /**\r\n * Resets this nodeTransform's local matrix to Matrix.Identity().\r\n * @param independentOfChildren indicates if all child nodeTransform's world-space transform should be preserved.\r\n */\r\n TransformNode.prototype.resetLocalMatrix = function (independentOfChildren) {\r\n if (independentOfChildren === void 0) { independentOfChildren = true; }\r\n this.computeWorldMatrix();\r\n if (independentOfChildren) {\r\n var children = this.getChildren();\r\n for (var i = 0; i < children.length; ++i) {\r\n var child = children[i];\r\n if (child) {\r\n child.computeWorldMatrix();\r\n var bakedMatrix = TmpVectors.Matrix[0];\r\n child._localMatrix.multiplyToRef(this._localMatrix, bakedMatrix);\r\n var tmpRotationQuaternion = TmpVectors.Quaternion[0];\r\n bakedMatrix.decompose(child.scaling, tmpRotationQuaternion, child.position);\r\n if (child.rotationQuaternion) {\r\n child.rotationQuaternion = tmpRotationQuaternion;\r\n }\r\n else {\r\n tmpRotationQuaternion.toEulerAnglesToRef(child.rotation);\r\n }\r\n }\r\n }\r\n }\r\n this.scaling.copyFromFloats(1, 1, 1);\r\n this.position.copyFromFloats(0, 0, 0);\r\n this.rotation.copyFromFloats(0, 0, 0);\r\n //only if quaternion is already set\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion = Quaternion.Identity();\r\n }\r\n this._worldMatrix = Matrix.Identity();\r\n };\r\n TransformNode.prototype._afterComputeWorldMatrix = function () {\r\n };\r\n /**\r\n * If you'd like to be called back after the mesh position, rotation or scaling has been updated.\r\n * @param func callback function to add\r\n *\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.registerAfterWorldMatrixUpdate = function (func) {\r\n this.onAfterWorldMatrixUpdateObservable.add(func);\r\n return this;\r\n };\r\n /**\r\n * Removes a registered callback function.\r\n * @param func callback function to remove\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.unregisterAfterWorldMatrixUpdate = function (func) {\r\n this.onAfterWorldMatrixUpdateObservable.removeCallback(func);\r\n return this;\r\n };\r\n /**\r\n * Gets the position of the current mesh in camera space\r\n * @param camera defines the camera to use\r\n * @returns a position\r\n */\r\n TransformNode.prototype.getPositionInCameraSpace = function (camera) {\r\n if (camera === void 0) { camera = null; }\r\n if (!camera) {\r\n camera = this.getScene().activeCamera;\r\n }\r\n return Vector3.TransformCoordinates(this.getAbsolutePosition(), camera.getViewMatrix());\r\n };\r\n /**\r\n * Returns the distance from the mesh to the active camera\r\n * @param camera defines the camera to use\r\n * @returns the distance\r\n */\r\n TransformNode.prototype.getDistanceToCamera = function (camera) {\r\n if (camera === void 0) { camera = null; }\r\n if (!camera) {\r\n camera = this.getScene().activeCamera;\r\n }\r\n return this.getAbsolutePosition().subtract(camera.globalPosition).length();\r\n };\r\n /**\r\n * Clone the current transform node\r\n * @param name Name of the new clone\r\n * @param newParent New parent for the clone\r\n * @param doNotCloneChildren Do not clone children hierarchy\r\n * @returns the new transform node\r\n */\r\n TransformNode.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n var _this = this;\r\n var result = SerializationHelper.Clone(function () { return new TransformNode(name, _this.getScene()); }, this);\r\n result.name = name;\r\n result.id = name;\r\n if (newParent) {\r\n result.parent = newParent;\r\n }\r\n if (!doNotCloneChildren) {\r\n // Children\r\n var directDescendants = this.getDescendants(true);\r\n for (var index = 0; index < directDescendants.length; index++) {\r\n var child = directDescendants[index];\r\n if (child.clone) {\r\n child.clone(name + \".\" + child.name, result);\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n /**\r\n * Serializes the objects information.\r\n * @param currentSerializationObject defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n TransformNode.prototype.serialize = function (currentSerializationObject) {\r\n var serializationObject = SerializationHelper.Serialize(this, currentSerializationObject);\r\n serializationObject.type = this.getClassName();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n serializationObject.localMatrix = this.getPivotMatrix().asArray();\r\n serializationObject.isEnabled = this.isEnabled();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Returns a new TransformNode object parsed from the source provided.\r\n * @param parsedTransformNode is the source.\r\n * @param scene the scne the object belongs to\r\n * @param rootUrl is a string, it's the root URL to prefix the `delayLoadingFile` property with\r\n * @returns a new TransformNode object parsed from the source provided.\r\n */\r\n TransformNode.Parse = function (parsedTransformNode, scene, rootUrl) {\r\n var transformNode = SerializationHelper.Parse(function () { return new TransformNode(parsedTransformNode.name, scene); }, parsedTransformNode, scene, rootUrl);\r\n if (parsedTransformNode.localMatrix) {\r\n transformNode.setPreTransformMatrix(Matrix.FromArray(parsedTransformNode.localMatrix));\r\n }\r\n else if (parsedTransformNode.pivotMatrix) {\r\n transformNode.setPivotMatrix(Matrix.FromArray(parsedTransformNode.pivotMatrix));\r\n }\r\n transformNode.setEnabled(parsedTransformNode.isEnabled);\r\n // Parent\r\n if (parsedTransformNode.parentId) {\r\n transformNode._waitingParentId = parsedTransformNode.parentId;\r\n }\r\n return transformNode;\r\n };\r\n /**\r\n * Get all child-transformNodes of this node\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @returns an array of TransformNode\r\n */\r\n TransformNode.prototype.getChildTransformNodes = function (directDescendantsOnly, predicate) {\r\n var results = [];\r\n this._getDescendants(results, directDescendantsOnly, function (node) {\r\n return ((!predicate || predicate(node)) && (node instanceof TransformNode));\r\n });\r\n return results;\r\n };\r\n /**\r\n * Releases resources associated with this transform node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n TransformNode.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from scene\r\n this.getScene().removeTransformNode(this);\r\n this.onAfterWorldMatrixUpdateObservable.clear();\r\n if (doNotRecurse) {\r\n var transformNodes = this.getChildTransformNodes(true);\r\n for (var _i = 0, transformNodes_1 = transformNodes; _i < transformNodes_1.length; _i++) {\r\n var transformNode = transformNodes_1[_i];\r\n transformNode.parent = null;\r\n transformNode.computeWorldMatrix(true);\r\n }\r\n }\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)\r\n * @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false\r\n * @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false\r\n * @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling\r\n * @returns the current mesh\r\n */\r\n TransformNode.prototype.normalizeToUnitCube = function (includeDescendants, ignoreRotation, predicate) {\r\n if (includeDescendants === void 0) { includeDescendants = true; }\r\n if (ignoreRotation === void 0) { ignoreRotation = false; }\r\n var storedRotation = null;\r\n var storedRotationQuaternion = null;\r\n if (ignoreRotation) {\r\n if (this.rotationQuaternion) {\r\n storedRotationQuaternion = this.rotationQuaternion.clone();\r\n this.rotationQuaternion.copyFromFloats(0, 0, 0, 1);\r\n }\r\n else if (this.rotation) {\r\n storedRotation = this.rotation.clone();\r\n this.rotation.copyFromFloats(0, 0, 0);\r\n }\r\n }\r\n var boundingVectors = this.getHierarchyBoundingVectors(includeDescendants, predicate);\r\n var sizeVec = boundingVectors.max.subtract(boundingVectors.min);\r\n var maxDimension = Math.max(sizeVec.x, sizeVec.y, sizeVec.z);\r\n if (maxDimension === 0) {\r\n return this;\r\n }\r\n var scale = 1 / maxDimension;\r\n this.scaling.scaleInPlace(scale);\r\n if (ignoreRotation) {\r\n if (this.rotationQuaternion && storedRotationQuaternion) {\r\n this.rotationQuaternion.copyFrom(storedRotationQuaternion);\r\n }\r\n else if (this.rotation && storedRotation) {\r\n this.rotation.copyFrom(storedRotation);\r\n }\r\n }\r\n return this;\r\n };\r\n TransformNode.prototype._syncAbsoluteScalingAndRotation = function () {\r\n if (!this._isAbsoluteSynced) {\r\n this._worldMatrix.decompose(this._absoluteScaling, this._absoluteRotationQuaternion);\r\n this._isAbsoluteSynced = true;\r\n }\r\n };\r\n // Statics\r\n /**\r\n * Object will not rotate to face the camera\r\n */\r\n TransformNode.BILLBOARDMODE_NONE = 0;\r\n /**\r\n * Object will rotate to face the camera but only on the x axis\r\n */\r\n TransformNode.BILLBOARDMODE_X = 1;\r\n /**\r\n * Object will rotate to face the camera but only on the y axis\r\n */\r\n TransformNode.BILLBOARDMODE_Y = 2;\r\n /**\r\n * Object will rotate to face the camera but only on the z axis\r\n */\r\n TransformNode.BILLBOARDMODE_Z = 4;\r\n /**\r\n * Object will rotate to face the camera\r\n */\r\n TransformNode.BILLBOARDMODE_ALL = 7;\r\n /**\r\n * Object will rotate to face the camera's position instead of orientation\r\n */\r\n TransformNode.BILLBOARDMODE_USE_POSITION = 128;\r\n TransformNode._TmpRotation = Quaternion.Zero();\r\n TransformNode._TmpScaling = Vector3.Zero();\r\n TransformNode._TmpTranslation = Vector3.Zero();\r\n TransformNode._lookAtVectorCache = new Vector3(0, 0, 0);\r\n TransformNode._rotationAxisCache = new Quaternion();\r\n __decorate([\r\n serializeAsVector3(\"position\")\r\n ], TransformNode.prototype, \"_position\", void 0);\r\n __decorate([\r\n serializeAsVector3(\"rotation\")\r\n ], TransformNode.prototype, \"_rotation\", void 0);\r\n __decorate([\r\n serializeAsQuaternion(\"rotationQuaternion\")\r\n ], TransformNode.prototype, \"_rotationQuaternion\", void 0);\r\n __decorate([\r\n serializeAsVector3(\"scaling\")\r\n ], TransformNode.prototype, \"_scaling\", void 0);\r\n __decorate([\r\n serialize(\"billboardMode\")\r\n ], TransformNode.prototype, \"_billboardMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], TransformNode.prototype, \"scalingDeterminant\", void 0);\r\n __decorate([\r\n serialize(\"infiniteDistance\")\r\n ], TransformNode.prototype, \"_infiniteDistance\", void 0);\r\n __decorate([\r\n serialize()\r\n ], TransformNode.prototype, \"ignoreNonUniformScaling\", void 0);\r\n __decorate([\r\n serialize()\r\n ], TransformNode.prototype, \"reIntegrateRotationIntoRotationQuaternion\", void 0);\r\n return TransformNode;\r\n}(Node));\r\nexport { TransformNode };\r\n//# sourceMappingURL=transformNode.js.map","/**\r\n * Class containing a set of static utilities functions for arrays.\r\n */\r\nvar ArrayTools = /** @class */ (function () {\r\n function ArrayTools() {\r\n }\r\n /**\r\n * Returns an array of the given size filled with element built from the given constructor and the paramters\r\n * @param size the number of element to construct and put in the array\r\n * @param itemBuilder a callback responsible for creating new instance of item. Called once per array entry.\r\n * @returns a new array filled with new objects\r\n */\r\n ArrayTools.BuildArray = function (size, itemBuilder) {\r\n var a = [];\r\n for (var i = 0; i < size; ++i) {\r\n a.push(itemBuilder());\r\n }\r\n return a;\r\n };\r\n return ArrayTools;\r\n}());\r\nexport { ArrayTools };\r\n//# sourceMappingURL=arrayTools.js.map","/**\r\n * Helper class used to generate a canvas to manipulate images\r\n */\r\nvar CanvasGenerator = /** @class */ (function () {\r\n function CanvasGenerator() {\r\n }\r\n /**\r\n * Create a new canvas (or offscreen canvas depending on the context)\r\n * @param width defines the expected width\r\n * @param height defines the expected height\r\n * @return a new canvas or offscreen canvas\r\n */\r\n CanvasGenerator.CreateCanvas = function (width, height) {\r\n if (typeof document === \"undefined\") {\r\n return new OffscreenCanvas(width, height);\r\n }\r\n var canvas = document.createElement(\"canvas\");\r\n canvas.width = width;\r\n canvas.height = height;\r\n return canvas;\r\n };\r\n return CanvasGenerator;\r\n}());\r\nexport { CanvasGenerator };\r\n//# sourceMappingURL=canvasGenerator.js.map","import { Tags } from \"../Misc/tags\";\r\nimport { Quaternion, Vector2, Vector3, Matrix } from \"../Maths/math.vector\";\r\nimport { _DevTools } from './devTools';\r\nimport { Color4, Color3 } from '../Maths/math.color';\r\nvar __decoratorInitialStore = {};\r\nvar __mergedStore = {};\r\nvar _copySource = function (creationFunction, source, instanciate) {\r\n var destination = creationFunction();\r\n // Tags\r\n if (Tags) {\r\n Tags.AddTagsTo(destination, source.tags);\r\n }\r\n var classStore = getMergedStore(destination);\r\n // Properties\r\n for (var property in classStore) {\r\n var propertyDescriptor = classStore[property];\r\n var sourceProperty = source[property];\r\n var propertyType = propertyDescriptor.type;\r\n if (sourceProperty !== undefined && sourceProperty !== null && property !== \"uniqueId\") {\r\n switch (propertyType) {\r\n case 0: // Value\r\n case 6: // Mesh reference\r\n case 11: // Camera reference\r\n destination[property] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n destination[property] = (instanciate || sourceProperty.isRenderTarget) ? sourceProperty : sourceProperty.clone();\r\n break;\r\n case 2: // Color3\r\n case 3: // FresnelParameters\r\n case 4: // Vector2\r\n case 5: // Vector3\r\n case 7: // Color Curves\r\n case 10: // Quaternion\r\n case 12: // Matrix\r\n destination[property] = instanciate ? sourceProperty : sourceProperty.clone();\r\n break;\r\n }\r\n }\r\n }\r\n return destination;\r\n};\r\nfunction getDirectStore(target) {\r\n var classKey = target.getClassName();\r\n if (!__decoratorInitialStore[classKey]) {\r\n __decoratorInitialStore[classKey] = {};\r\n }\r\n return __decoratorInitialStore[classKey];\r\n}\r\n/**\r\n * Return the list of properties flagged as serializable\r\n * @param target: host object\r\n */\r\nfunction getMergedStore(target) {\r\n var classKey = target.getClassName();\r\n if (__mergedStore[classKey]) {\r\n return __mergedStore[classKey];\r\n }\r\n __mergedStore[classKey] = {};\r\n var store = __mergedStore[classKey];\r\n var currentTarget = target;\r\n var currentKey = classKey;\r\n while (currentKey) {\r\n var initialStore = __decoratorInitialStore[currentKey];\r\n for (var property in initialStore) {\r\n store[property] = initialStore[property];\r\n }\r\n var parent_1 = void 0;\r\n var done = false;\r\n do {\r\n parent_1 = Object.getPrototypeOf(currentTarget);\r\n if (!parent_1.getClassName) {\r\n done = true;\r\n break;\r\n }\r\n if (parent_1.getClassName() !== currentKey) {\r\n break;\r\n }\r\n currentTarget = parent_1;\r\n } while (parent_1);\r\n if (done) {\r\n break;\r\n }\r\n currentKey = parent_1.getClassName();\r\n currentTarget = parent_1;\r\n }\r\n return store;\r\n}\r\nfunction generateSerializableMember(type, sourceName) {\r\n return function (target, propertyKey) {\r\n var classStore = getDirectStore(target);\r\n if (!classStore[propertyKey]) {\r\n classStore[propertyKey] = { type: type, sourceName: sourceName };\r\n }\r\n };\r\n}\r\nfunction generateExpandMember(setCallback, targetKey) {\r\n if (targetKey === void 0) { targetKey = null; }\r\n return function (target, propertyKey) {\r\n var key = targetKey || (\"_\" + propertyKey);\r\n Object.defineProperty(target, propertyKey, {\r\n get: function () {\r\n return this[key];\r\n },\r\n set: function (value) {\r\n if (this[key] === value) {\r\n return;\r\n }\r\n this[key] = value;\r\n target[setCallback].apply(this);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n };\r\n}\r\nexport function expandToProperty(callback, targetKey) {\r\n if (targetKey === void 0) { targetKey = null; }\r\n return generateExpandMember(callback, targetKey);\r\n}\r\nexport function serialize(sourceName) {\r\n return generateSerializableMember(0, sourceName); // value member\r\n}\r\nexport function serializeAsTexture(sourceName) {\r\n return generateSerializableMember(1, sourceName); // texture member\r\n}\r\nexport function serializeAsColor3(sourceName) {\r\n return generateSerializableMember(2, sourceName); // color3 member\r\n}\r\nexport function serializeAsFresnelParameters(sourceName) {\r\n return generateSerializableMember(3, sourceName); // fresnel parameters member\r\n}\r\nexport function serializeAsVector2(sourceName) {\r\n return generateSerializableMember(4, sourceName); // vector2 member\r\n}\r\nexport function serializeAsVector3(sourceName) {\r\n return generateSerializableMember(5, sourceName); // vector3 member\r\n}\r\nexport function serializeAsMeshReference(sourceName) {\r\n return generateSerializableMember(6, sourceName); // mesh reference member\r\n}\r\nexport function serializeAsColorCurves(sourceName) {\r\n return generateSerializableMember(7, sourceName); // color curves\r\n}\r\nexport function serializeAsColor4(sourceName) {\r\n return generateSerializableMember(8, sourceName); // color 4\r\n}\r\nexport function serializeAsImageProcessingConfiguration(sourceName) {\r\n return generateSerializableMember(9, sourceName); // image processing\r\n}\r\nexport function serializeAsQuaternion(sourceName) {\r\n return generateSerializableMember(10, sourceName); // quaternion member\r\n}\r\nexport function serializeAsMatrix(sourceName) {\r\n return generateSerializableMember(12, sourceName); // matrix member\r\n}\r\n/**\r\n * Decorator used to define property that can be serialized as reference to a camera\r\n * @param sourceName defines the name of the property to decorate\r\n */\r\nexport function serializeAsCameraReference(sourceName) {\r\n return generateSerializableMember(11, sourceName); // camera reference member\r\n}\r\n/**\r\n * Class used to help serialization objects\r\n */\r\nvar SerializationHelper = /** @class */ (function () {\r\n function SerializationHelper() {\r\n }\r\n /**\r\n * Appends the serialized animations from the source animations\r\n * @param source Source containing the animations\r\n * @param destination Target to store the animations\r\n */\r\n SerializationHelper.AppendSerializedAnimations = function (source, destination) {\r\n if (source.animations) {\r\n destination.animations = [];\r\n for (var animationIndex = 0; animationIndex < source.animations.length; animationIndex++) {\r\n var animation = source.animations[animationIndex];\r\n destination.animations.push(animation.serialize());\r\n }\r\n }\r\n };\r\n /**\r\n * Static function used to serialized a specific entity\r\n * @param entity defines the entity to serialize\r\n * @param serializationObject defines the optional target obecjt where serialization data will be stored\r\n * @returns a JSON compatible object representing the serialization of the entity\r\n */\r\n SerializationHelper.Serialize = function (entity, serializationObject) {\r\n if (!serializationObject) {\r\n serializationObject = {};\r\n }\r\n // Tags\r\n if (Tags) {\r\n serializationObject.tags = Tags.GetTags(entity);\r\n }\r\n var serializedProperties = getMergedStore(entity);\r\n // Properties\r\n for (var property in serializedProperties) {\r\n var propertyDescriptor = serializedProperties[property];\r\n var targetPropertyName = propertyDescriptor.sourceName || property;\r\n var propertyType = propertyDescriptor.type;\r\n var sourceProperty = entity[property];\r\n if (sourceProperty !== undefined && sourceProperty !== null && property !== \"uniqueId\") {\r\n switch (propertyType) {\r\n case 0: // Value\r\n serializationObject[targetPropertyName] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 2: // Color3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 3: // FresnelParameters\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 4: // Vector2\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 5: // Vector3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 6: // Mesh reference\r\n serializationObject[targetPropertyName] = sourceProperty.id;\r\n break;\r\n case 7: // Color Curves\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 8: // Color 4\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 9: // Image Processing\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 10: // Quaternion\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 11: // Camera reference\r\n serializationObject[targetPropertyName] = sourceProperty.id;\r\n case 12: // Matrix\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n }\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a new entity from a serialization data object\r\n * @param creationFunction defines a function used to instanciated the new entity\r\n * @param source defines the source serialization data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url for resources\r\n * @returns a new entity\r\n */\r\n SerializationHelper.Parse = function (creationFunction, source, scene, rootUrl) {\r\n if (rootUrl === void 0) { rootUrl = null; }\r\n var destination = creationFunction();\r\n if (!rootUrl) {\r\n rootUrl = \"\";\r\n }\r\n // Tags\r\n if (Tags) {\r\n Tags.AddTagsTo(destination, source.tags);\r\n }\r\n var classStore = getMergedStore(destination);\r\n // Properties\r\n for (var property in classStore) {\r\n var propertyDescriptor = classStore[property];\r\n var sourceProperty = source[propertyDescriptor.sourceName || property];\r\n var propertyType = propertyDescriptor.type;\r\n if (sourceProperty !== undefined && sourceProperty !== null && property !== \"uniqueId\") {\r\n var dest = destination;\r\n switch (propertyType) {\r\n case 0: // Value\r\n dest[property] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n if (scene) {\r\n dest[property] = SerializationHelper._TextureParser(sourceProperty, scene, rootUrl);\r\n }\r\n break;\r\n case 2: // Color3\r\n dest[property] = Color3.FromArray(sourceProperty);\r\n break;\r\n case 3: // FresnelParameters\r\n dest[property] = SerializationHelper._FresnelParametersParser(sourceProperty);\r\n break;\r\n case 4: // Vector2\r\n dest[property] = Vector2.FromArray(sourceProperty);\r\n break;\r\n case 5: // Vector3\r\n dest[property] = Vector3.FromArray(sourceProperty);\r\n break;\r\n case 6: // Mesh reference\r\n if (scene) {\r\n dest[property] = scene.getLastMeshByID(sourceProperty);\r\n }\r\n break;\r\n case 7: // Color Curves\r\n dest[property] = SerializationHelper._ColorCurvesParser(sourceProperty);\r\n break;\r\n case 8: // Color 4\r\n dest[property] = Color4.FromArray(sourceProperty);\r\n break;\r\n case 9: // Image Processing\r\n dest[property] = SerializationHelper._ImageProcessingConfigurationParser(sourceProperty);\r\n break;\r\n case 10: // Quaternion\r\n dest[property] = Quaternion.FromArray(sourceProperty);\r\n break;\r\n case 11: // Camera reference\r\n if (scene) {\r\n dest[property] = scene.getCameraByID(sourceProperty);\r\n }\r\n case 12: // Matrix\r\n dest[property] = Matrix.FromArray(sourceProperty);\r\n break;\r\n }\r\n }\r\n }\r\n return destination;\r\n };\r\n /**\r\n * Clones an object\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @returns the cloned object\r\n */\r\n SerializationHelper.Clone = function (creationFunction, source) {\r\n return _copySource(creationFunction, source, false);\r\n };\r\n /**\r\n * Instanciates a new object based on a source one (some data will be shared between both object)\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @returns the new object\r\n */\r\n SerializationHelper.Instanciate = function (creationFunction, source) {\r\n return _copySource(creationFunction, source, true);\r\n };\r\n /** @hidden */\r\n SerializationHelper._ImageProcessingConfigurationParser = function (sourceProperty) {\r\n throw _DevTools.WarnImport(\"ImageProcessingConfiguration\");\r\n };\r\n /** @hidden */\r\n SerializationHelper._FresnelParametersParser = function (sourceProperty) {\r\n throw _DevTools.WarnImport(\"FresnelParameters\");\r\n };\r\n /** @hidden */\r\n SerializationHelper._ColorCurvesParser = function (sourceProperty) {\r\n throw _DevTools.WarnImport(\"ColorCurves\");\r\n };\r\n /** @hidden */\r\n SerializationHelper._TextureParser = function (sourceProperty, scene, rootUrl) {\r\n throw _DevTools.WarnImport(\"Texture\");\r\n };\r\n return SerializationHelper;\r\n}());\r\nexport { SerializationHelper };\r\n//# sourceMappingURL=decorators.js.map","import { StringTools } from './stringTools';\r\nimport { Logger } from './logger';\r\nvar cloneValue = function (source, destinationObject) {\r\n if (!source) {\r\n return null;\r\n }\r\n if (source.getClassName && source.getClassName() === \"Mesh\") {\r\n return null;\r\n }\r\n if (source.getClassName && source.getClassName() === \"SubMesh\") {\r\n return source.clone(destinationObject);\r\n }\r\n else if (source.clone) {\r\n return source.clone();\r\n }\r\n return null;\r\n};\r\nfunction getAllPropertyNames(obj) {\r\n var props = [];\r\n do {\r\n Object.getOwnPropertyNames(obj).forEach(function (prop) {\r\n if (props.indexOf(prop) === -1) {\r\n props.push(prop);\r\n }\r\n });\r\n } while (obj = Object.getPrototypeOf(obj));\r\n return props;\r\n}\r\n/**\r\n * Class containing a set of static utilities functions for deep copy.\r\n */\r\nvar DeepCopier = /** @class */ (function () {\r\n function DeepCopier() {\r\n }\r\n /**\r\n * Tries to copy an object by duplicating every property\r\n * @param source defines the source object\r\n * @param destination defines the target object\r\n * @param doNotCopyList defines a list of properties to avoid\r\n * @param mustCopyList defines a list of properties to copy (even if they start with _)\r\n */\r\n DeepCopier.DeepCopy = function (source, destination, doNotCopyList, mustCopyList) {\r\n var proerties = getAllPropertyNames(source);\r\n for (var _i = 0, proerties_1 = proerties; _i < proerties_1.length; _i++) {\r\n var prop = proerties_1[_i];\r\n if (prop[0] === \"_\" && (!mustCopyList || mustCopyList.indexOf(prop) === -1)) {\r\n continue;\r\n }\r\n if (StringTools.EndsWith(prop, \"Observable\")) {\r\n continue;\r\n }\r\n if (doNotCopyList && doNotCopyList.indexOf(prop) !== -1) {\r\n continue;\r\n }\r\n var sourceValue = source[prop];\r\n var typeOfSourceValue = typeof sourceValue;\r\n if (typeOfSourceValue === \"function\") {\r\n continue;\r\n }\r\n try {\r\n if (typeOfSourceValue === \"object\") {\r\n if (sourceValue instanceof Array) {\r\n destination[prop] = [];\r\n if (sourceValue.length > 0) {\r\n if (typeof sourceValue[0] == \"object\") {\r\n for (var index = 0; index < sourceValue.length; index++) {\r\n var clonedValue = cloneValue(sourceValue[index], destination);\r\n if (destination[prop].indexOf(clonedValue) === -1) { // Test if auto inject was not done\r\n destination[prop].push(clonedValue);\r\n }\r\n }\r\n }\r\n else {\r\n destination[prop] = sourceValue.slice(0);\r\n }\r\n }\r\n }\r\n else {\r\n destination[prop] = cloneValue(sourceValue, destination);\r\n }\r\n }\r\n else {\r\n destination[prop] = sourceValue;\r\n }\r\n }\r\n catch (e) {\r\n // Log a warning (it could be because of a read-only property)\r\n Logger.Warn(e.message);\r\n }\r\n }\r\n };\r\n return DeepCopier;\r\n}());\r\nexport { DeepCopier };\r\n//# sourceMappingURL=deepCopier.js.map","/** @hidden */\r\nvar _DevTools = /** @class */ (function () {\r\n function _DevTools() {\r\n }\r\n _DevTools.WarnImport = function (name) {\r\n return name + \" needs to be imported before as it contains a side-effect required by your code.\";\r\n };\r\n return _DevTools;\r\n}());\r\nexport { _DevTools };\r\n//# sourceMappingURL=devTools.js.map","/**\r\n * Sets of helpers dealing with the DOM and some of the recurrent functions needed in\r\n * Babylon.js\r\n */\r\nvar DomManagement = /** @class */ (function () {\r\n function DomManagement() {\r\n }\r\n /**\r\n * Checks if the window object exists\r\n * @returns true if the window object exists\r\n */\r\n DomManagement.IsWindowObjectExist = function () {\r\n return (typeof window) !== \"undefined\";\r\n };\r\n /**\r\n * Checks if the navigator object exists\r\n * @returns true if the navigator object exists\r\n */\r\n DomManagement.IsNavigatorAvailable = function () {\r\n return (typeof navigator) !== \"undefined\";\r\n };\r\n /**\r\n * Check if the document object exists\r\n * @returns true if the document object exists\r\n */\r\n DomManagement.IsDocumentAvailable = function () {\r\n return (typeof document) !== \"undefined\";\r\n };\r\n /**\r\n * Extracts text content from a DOM element hierarchy\r\n * @param element defines the root element\r\n * @returns a string\r\n */\r\n DomManagement.GetDOMTextContent = function (element) {\r\n var result = \"\";\r\n var child = element.firstChild;\r\n while (child) {\r\n if (child.nodeType === 3) {\r\n result += child.textContent;\r\n }\r\n child = (child.nextSibling);\r\n }\r\n return result;\r\n };\r\n return DomManagement;\r\n}());\r\nexport { DomManagement };\r\n//# sourceMappingURL=domManagement.js.map","/**\r\n * Class used to define a retry strategy when error happens while loading assets\r\n */\r\nvar RetryStrategy = /** @class */ (function () {\r\n function RetryStrategy() {\r\n }\r\n /**\r\n * Function used to defines an exponential back off strategy\r\n * @param maxRetries defines the maximum number of retries (3 by default)\r\n * @param baseInterval defines the interval between retries\r\n * @returns the strategy function to use\r\n */\r\n RetryStrategy.ExponentialBackoff = function (maxRetries, baseInterval) {\r\n if (maxRetries === void 0) { maxRetries = 3; }\r\n if (baseInterval === void 0) { baseInterval = 500; }\r\n return function (url, request, retryIndex) {\r\n if (request.status !== 0 || retryIndex >= maxRetries || url.indexOf(\"file:\") !== -1) {\r\n return -1;\r\n }\r\n return Math.pow(2, retryIndex) * baseInterval;\r\n };\r\n };\r\n return RetryStrategy;\r\n}());\r\nexport { RetryStrategy };\r\n//# sourceMappingURL=retryStrategy.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * @ignore\r\n * Application error to support additional information when loading a file\r\n */\r\nvar BaseError = /** @class */ (function (_super) {\r\n __extends(BaseError, _super);\r\n function BaseError() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n // See https://stackoverflow.com/questions/12915412/how-do-i-extend-a-host-object-e-g-error-in-typescript\r\n // and https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work\r\n // Polyfill for Object.setPrototypeOf if necessary.\r\n BaseError._setPrototypeOf = Object.setPrototypeOf || (function (o, proto) { o.__proto__ = proto; return o; });\r\n return BaseError;\r\n}(Error));\r\nexport { BaseError };\r\n//# sourceMappingURL=baseError.js.map","import { __extends } from \"tslib\";\r\nimport { WebRequest } from './webRequest';\r\nimport { DomManagement } from './domManagement';\r\nimport { Observable } from './observable';\r\nimport { FilesInputStore } from './filesInputStore';\r\nimport { RetryStrategy } from './retryStrategy';\r\nimport { BaseError } from './baseError';\r\nimport { StringTools } from './stringTools';\r\nimport { ThinEngine } from '../Engines/thinEngine';\r\nimport { ShaderProcessor } from '../Engines/Processors/shaderProcessor';\r\n/** @ignore */\r\nvar LoadFileError = /** @class */ (function (_super) {\r\n __extends(LoadFileError, _super);\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param request defines the optional web request\r\n * @param file defines the optional file\r\n */\r\n function LoadFileError(message, object) {\r\n var _this = _super.call(this, message) || this;\r\n _this.name = \"LoadFileError\";\r\n BaseError._setPrototypeOf(_this, LoadFileError.prototype);\r\n if (object instanceof WebRequest) {\r\n _this.request = object;\r\n }\r\n else {\r\n _this.file = object;\r\n }\r\n return _this;\r\n }\r\n return LoadFileError;\r\n}(BaseError));\r\nexport { LoadFileError };\r\n/** @ignore */\r\nvar RequestFileError = /** @class */ (function (_super) {\r\n __extends(RequestFileError, _super);\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param request defines the optional web request\r\n */\r\n function RequestFileError(message, request) {\r\n var _this = _super.call(this, message) || this;\r\n _this.request = request;\r\n _this.name = \"RequestFileError\";\r\n BaseError._setPrototypeOf(_this, RequestFileError.prototype);\r\n return _this;\r\n }\r\n return RequestFileError;\r\n}(BaseError));\r\nexport { RequestFileError };\r\n/** @ignore */\r\nvar ReadFileError = /** @class */ (function (_super) {\r\n __extends(ReadFileError, _super);\r\n /**\r\n * Creates a new ReadFileError\r\n * @param message defines the message of the error\r\n * @param file defines the optional file\r\n */\r\n function ReadFileError(message, file) {\r\n var _this = _super.call(this, message) || this;\r\n _this.file = file;\r\n _this.name = \"ReadFileError\";\r\n BaseError._setPrototypeOf(_this, ReadFileError.prototype);\r\n return _this;\r\n }\r\n return ReadFileError;\r\n}(BaseError));\r\nexport { ReadFileError };\r\n/**\r\n * @hidden\r\n */\r\nvar FileTools = /** @class */ (function () {\r\n function FileTools() {\r\n }\r\n /**\r\n * Removes unwanted characters from an url\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\n FileTools._CleanUrl = function (url) {\r\n url = url.replace(/#/mg, \"%23\");\r\n return url;\r\n };\r\n /**\r\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\r\n * @param url define the url we are trying\r\n * @param element define the dom element where to configure the cors policy\r\n */\r\n FileTools.SetCorsBehavior = function (url, element) {\r\n if (url && url.indexOf(\"data:\") === 0) {\r\n return;\r\n }\r\n if (FileTools.CorsBehavior) {\r\n if (typeof (FileTools.CorsBehavior) === 'string' || this.CorsBehavior instanceof String) {\r\n element.crossOrigin = FileTools.CorsBehavior;\r\n }\r\n else {\r\n var result = FileTools.CorsBehavior(url);\r\n if (result) {\r\n element.crossOrigin = result;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @param mimeType optional mime type\r\n * @returns the HTMLImageElement of the loaded image\r\n */\r\n FileTools.LoadImage = function (input, onLoad, onError, offlineProvider, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"\"; }\r\n var url;\r\n var usingObjectURL = false;\r\n if (input instanceof ArrayBuffer || ArrayBuffer.isView(input)) {\r\n if (typeof Blob !== 'undefined') {\r\n url = URL.createObjectURL(new Blob([input], { type: mimeType }));\r\n usingObjectURL = true;\r\n }\r\n else {\r\n url = \"data:\" + mimeType + \";base64,\" + StringTools.EncodeArrayBufferToBase64(input);\r\n }\r\n }\r\n else if (input instanceof Blob) {\r\n url = URL.createObjectURL(input);\r\n usingObjectURL = true;\r\n }\r\n else {\r\n url = FileTools._CleanUrl(input);\r\n url = FileTools.PreprocessUrl(input);\r\n }\r\n if (typeof Image === \"undefined\") {\r\n FileTools.LoadFile(url, function (data) {\r\n createImageBitmap(new Blob([data], { type: mimeType })).then(function (imgBmp) {\r\n onLoad(imgBmp);\r\n if (usingObjectURL) {\r\n URL.revokeObjectURL(url);\r\n }\r\n }).catch(function (reason) {\r\n if (onError) {\r\n onError(\"Error while trying to load image: \" + input, reason);\r\n }\r\n });\r\n }, undefined, offlineProvider || undefined, true, function (request, exception) {\r\n if (onError) {\r\n onError(\"Error while trying to load image: \" + input, exception);\r\n }\r\n });\r\n return null;\r\n }\r\n var img = new Image();\r\n FileTools.SetCorsBehavior(url, img);\r\n var loadHandler = function () {\r\n img.removeEventListener(\"load\", loadHandler);\r\n img.removeEventListener(\"error\", errorHandler);\r\n onLoad(img);\r\n // Must revoke the URL after calling onLoad to avoid security exceptions in\r\n // certain scenarios (e.g. when hosted in vscode).\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n var errorHandler = function (err) {\r\n img.removeEventListener(\"load\", loadHandler);\r\n img.removeEventListener(\"error\", errorHandler);\r\n if (onError) {\r\n var inputText = input.toString();\r\n onError(\"Error while trying to load image: \" + (inputText.length < 32 ? inputText : inputText.slice(0, 32) + \"...\"), err);\r\n }\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n img.addEventListener(\"load\", loadHandler);\r\n img.addEventListener(\"error\", errorHandler);\r\n var noOfflineSupport = function () {\r\n img.src = url;\r\n };\r\n var loadFromOfflineSupport = function () {\r\n if (offlineProvider) {\r\n offlineProvider.loadImage(url, img);\r\n }\r\n };\r\n if (url.substr(0, 5) !== \"data:\" && offlineProvider && offlineProvider.enableTexturesOffline) {\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\r\n }\r\n else {\r\n if (url.indexOf(\"file:\") !== -1) {\r\n var textureName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (FilesInputStore.FilesToLoad[textureName]) {\r\n try {\r\n var blobURL;\r\n try {\r\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\r\n }\r\n catch (ex) {\r\n // Chrome doesn't support oneTimeOnly parameter\r\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\r\n }\r\n img.src = blobURL;\r\n usingObjectURL = true;\r\n }\r\n catch (e) {\r\n img.src = \"\";\r\n }\r\n return img;\r\n }\r\n }\r\n noOfflineSupport();\r\n }\r\n return img;\r\n };\r\n /**\r\n * Reads a file from a File object\r\n * @param file defines the file to load\r\n * @param onSuccess defines the callback to call when data is loaded\r\n * @param onProgress defines the callback to call during loading process\r\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\r\n * @param onError defines the callback to call when an error occurs\r\n * @returns a file request object\r\n */\r\n FileTools.ReadFile = function (file, onSuccess, onProgress, useArrayBuffer, onError) {\r\n var reader = new FileReader();\r\n var request = {\r\n onCompleteObservable: new Observable(),\r\n abort: function () { return reader.abort(); },\r\n };\r\n reader.onloadend = function (e) { return request.onCompleteObservable.notifyObservers(request); };\r\n if (onError) {\r\n reader.onerror = function (e) {\r\n onError(new ReadFileError(\"Unable to read \" + file.name, file));\r\n };\r\n }\r\n reader.onload = function (e) {\r\n //target doesn't have result from ts 1.3\r\n onSuccess(e.target['result']);\r\n };\r\n if (onProgress) {\r\n reader.onprogress = onProgress;\r\n }\r\n if (!useArrayBuffer) {\r\n // Asynchronous read\r\n reader.readAsText(file);\r\n }\r\n else {\r\n reader.readAsArrayBuffer(file);\r\n }\r\n return request;\r\n };\r\n /**\r\n * Loads a file from a url\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n */\r\n FileTools.LoadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n // If file and file input are set\r\n if (url.indexOf(\"file:\") !== -1) {\r\n var fileName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (fileName.indexOf('./') === 0) {\r\n fileName = fileName.substring(2);\r\n }\r\n var file = FilesInputStore.FilesToLoad[fileName];\r\n if (file) {\r\n return FileTools.ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError ? function (error) { return onError(undefined, new LoadFileError(error.message, error.file)); } : undefined);\r\n }\r\n }\r\n return FileTools.RequestFile(url, function (data, request) {\r\n onSuccess(data, request ? request.responseURL : undefined);\r\n }, onProgress, offlineProvider, useArrayBuffer, onError ? function (error) {\r\n onError(error.request, new LoadFileError(error.message, error.request));\r\n } : undefined);\r\n };\r\n /**\r\n * Loads a file\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param onOpened callback called when the web request is opened\r\n * @returns a file request object\r\n */\r\n FileTools.RequestFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError, onOpened) {\r\n url = FileTools._CleanUrl(url);\r\n url = FileTools.PreprocessUrl(url);\r\n var loadUrl = FileTools.BaseUrl + url;\r\n var aborted = false;\r\n var fileRequest = {\r\n onCompleteObservable: new Observable(),\r\n abort: function () { return aborted = true; },\r\n };\r\n var requestFile = function () {\r\n var request = new WebRequest();\r\n var retryHandle = null;\r\n fileRequest.abort = function () {\r\n aborted = true;\r\n if (request.readyState !== (XMLHttpRequest.DONE || 4)) {\r\n request.abort();\r\n }\r\n if (retryHandle !== null) {\r\n clearTimeout(retryHandle);\r\n retryHandle = null;\r\n }\r\n };\r\n var retryLoop = function (retryIndex) {\r\n request.open('GET', loadUrl);\r\n if (onOpened) {\r\n onOpened(request);\r\n }\r\n if (useArrayBuffer) {\r\n request.responseType = \"arraybuffer\";\r\n }\r\n if (onProgress) {\r\n request.addEventListener(\"progress\", onProgress);\r\n }\r\n var onLoadEnd = function () {\r\n request.removeEventListener(\"loadend\", onLoadEnd);\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n fileRequest.onCompleteObservable.clear();\r\n };\r\n request.addEventListener(\"loadend\", onLoadEnd);\r\n var onReadyStateChange = function () {\r\n if (aborted) {\r\n return;\r\n }\r\n // In case of undefined state in some browsers.\r\n if (request.readyState === (XMLHttpRequest.DONE || 4)) {\r\n // Some browsers have issues where onreadystatechange can be called multiple times with the same value.\r\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\r\n if ((request.status >= 200 && request.status < 300) || (request.status === 0 && (!DomManagement.IsWindowObjectExist() || FileTools.IsFileURL()))) {\r\n onSuccess(useArrayBuffer ? request.response : request.responseText, request);\r\n return;\r\n }\r\n var retryStrategy = FileTools.DefaultRetryStrategy;\r\n if (retryStrategy) {\r\n var waitTime = retryStrategy(loadUrl, request, retryIndex);\r\n if (waitTime !== -1) {\r\n // Prevent the request from completing for retry.\r\n request.removeEventListener(\"loadend\", onLoadEnd);\r\n request = new WebRequest();\r\n retryHandle = setTimeout(function () { return retryLoop(retryIndex + 1); }, waitTime);\r\n return;\r\n }\r\n }\r\n var error = new RequestFileError(\"Error status: \" + request.status + \" \" + request.statusText + \" - Unable to load \" + loadUrl, request);\r\n if (onError) {\r\n onError(error);\r\n }\r\n }\r\n };\r\n request.addEventListener(\"readystatechange\", onReadyStateChange);\r\n request.send();\r\n };\r\n retryLoop(0);\r\n };\r\n // Caching all files\r\n if (offlineProvider && offlineProvider.enableSceneOffline) {\r\n var noOfflineSupport_1 = function (request) {\r\n if (request && request.status > 400) {\r\n if (onError) {\r\n onError(request);\r\n }\r\n }\r\n else {\r\n requestFile();\r\n }\r\n };\r\n var loadFromOfflineSupport = function () {\r\n // TODO: database needs to support aborting and should return a IFileRequest\r\n if (offlineProvider) {\r\n offlineProvider.loadFile(FileTools.BaseUrl + url, function (data) {\r\n if (!aborted) {\r\n onSuccess(data);\r\n }\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n }, onProgress ? function (event) {\r\n if (!aborted) {\r\n onProgress(event);\r\n }\r\n } : undefined, noOfflineSupport_1, useArrayBuffer);\r\n }\r\n };\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport_1);\r\n }\r\n else {\r\n requestFile();\r\n }\r\n return fileRequest;\r\n };\r\n /**\r\n * Checks if the loaded document was accessed via `file:`-Protocol.\r\n * @returns boolean\r\n */\r\n FileTools.IsFileURL = function () {\r\n return typeof location !== \"undefined\" && location.protocol === \"file:\";\r\n };\r\n /**\r\n * Gets or sets the retry strategy to apply when an error happens while loading an asset\r\n */\r\n FileTools.DefaultRetryStrategy = RetryStrategy.ExponentialBackoff();\r\n /**\r\n * Gets or sets the base URL to use to load assets\r\n */\r\n FileTools.BaseUrl = \"\";\r\n /**\r\n * Default behaviour for cors in the application.\r\n * It can be a string if the expected behavior is identical in the entire app.\r\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\r\n */\r\n FileTools.CorsBehavior = \"anonymous\";\r\n /**\r\n * Gets or sets a function used to pre-process url before using them to load assets\r\n */\r\n FileTools.PreprocessUrl = function (url) {\r\n return url;\r\n };\r\n return FileTools;\r\n}());\r\nexport { FileTools };\r\nThinEngine._FileToolsLoadImage = FileTools.LoadImage.bind(FileTools);\r\nThinEngine._FileToolsLoadFile = FileTools.LoadFile.bind(FileTools);\r\nShaderProcessor._FileToolsLoadFile = FileTools.LoadFile.bind(FileTools);\r\n//# sourceMappingURL=fileTools.js.map","/**\r\n * Class used to help managing file picking and drag'n'drop\r\n * File Storage\r\n */\r\nvar FilesInputStore = /** @class */ (function () {\r\n function FilesInputStore() {\r\n }\r\n /**\r\n * List of files ready to be loaded\r\n */\r\n FilesInputStore.FilesToLoad = {};\r\n return FilesInputStore;\r\n}());\r\nexport { FilesInputStore };\r\n//# sourceMappingURL=filesInputStore.js.map","/**\r\n * Class used to manipulate GUIDs\r\n */\r\nvar GUID = /** @class */ (function () {\r\n function GUID() {\r\n }\r\n /**\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a pseudo random id\r\n */\r\n GUID.RandomId = function () {\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\r\n var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n };\r\n return GUID;\r\n}());\r\nexport { GUID };\r\n//# sourceMappingURL=guid.js.map","import { Logger } from './logger';\r\nimport { _TypeStore } from './typeStore';\r\n/**\r\n * Class used to enable instatition of objects by class name\r\n */\r\nvar InstantiationTools = /** @class */ (function () {\r\n function InstantiationTools() {\r\n }\r\n /**\r\n * Tries to instantiate a new object from a given class name\r\n * @param className defines the class name to instantiate\r\n * @returns the new object or null if the system was not able to do the instantiation\r\n */\r\n InstantiationTools.Instantiate = function (className) {\r\n if (this.RegisteredExternalClasses && this.RegisteredExternalClasses[className]) {\r\n return this.RegisteredExternalClasses[className];\r\n }\r\n var internalClass = _TypeStore.GetClass(className);\r\n if (internalClass) {\r\n return internalClass;\r\n }\r\n Logger.Warn(className + \" not found, you may have missed an import.\");\r\n var arr = className.split(\".\");\r\n var fn = (window || this);\r\n for (var i = 0, len = arr.length; i < len; i++) {\r\n fn = fn[arr[i]];\r\n }\r\n if (typeof fn !== \"function\") {\r\n return null;\r\n }\r\n return fn;\r\n };\r\n /**\r\n * Use this object to register external classes like custom textures or material\r\n * to allow the laoders to instantiate them\r\n */\r\n InstantiationTools.RegisteredExternalClasses = {};\r\n return InstantiationTools;\r\n}());\r\nexport { InstantiationTools };\r\n//# sourceMappingURL=instantiationTools.js.map","/**\r\n * Logger used througouht the application to allow configuration of\r\n * the log level required for the messages.\r\n */\r\nvar Logger = /** @class */ (function () {\r\n function Logger() {\r\n }\r\n Logger._AddLogEntry = function (entry) {\r\n Logger._LogCache = entry + Logger._LogCache;\r\n if (Logger.OnNewCacheEntry) {\r\n Logger.OnNewCacheEntry(entry);\r\n }\r\n };\r\n Logger._FormatMessage = function (message) {\r\n var padStr = function (i) { return (i < 10) ? \"0\" + i : \"\" + i; };\r\n var date = new Date();\r\n return \"[\" + padStr(date.getHours()) + \":\" + padStr(date.getMinutes()) + \":\" + padStr(date.getSeconds()) + \"]: \" + message;\r\n };\r\n Logger._LogDisabled = function (message) {\r\n // nothing to do\r\n };\r\n Logger._LogEnabled = function (message) {\r\n var formattedMessage = Logger._FormatMessage(message);\r\n console.log(\"BJS - \" + formattedMessage);\r\n var entry = \"
\" + formattedMessage + \"

\";\r\n Logger._AddLogEntry(entry);\r\n };\r\n Logger._WarnDisabled = function (message) {\r\n // nothing to do\r\n };\r\n Logger._WarnEnabled = function (message) {\r\n var formattedMessage = Logger._FormatMessage(message);\r\n console.warn(\"BJS - \" + formattedMessage);\r\n var entry = \"
\" + formattedMessage + \"

\";\r\n Logger._AddLogEntry(entry);\r\n };\r\n Logger._ErrorDisabled = function (message) {\r\n // nothing to do\r\n };\r\n Logger._ErrorEnabled = function (message) {\r\n Logger.errorsCount++;\r\n var formattedMessage = Logger._FormatMessage(message);\r\n console.error(\"BJS - \" + formattedMessage);\r\n var entry = \"
\" + formattedMessage + \"

\";\r\n Logger._AddLogEntry(entry);\r\n };\r\n Object.defineProperty(Logger, \"LogCache\", {\r\n /**\r\n * Gets current log cache (list of logs)\r\n */\r\n get: function () {\r\n return Logger._LogCache;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Clears the log cache\r\n */\r\n Logger.ClearLogCache = function () {\r\n Logger._LogCache = \"\";\r\n Logger.errorsCount = 0;\r\n };\r\n Object.defineProperty(Logger, \"LogLevels\", {\r\n /**\r\n * Sets the current log level (MessageLogLevel / WarningLogLevel / ErrorLogLevel)\r\n */\r\n set: function (level) {\r\n if ((level & Logger.MessageLogLevel) === Logger.MessageLogLevel) {\r\n Logger.Log = Logger._LogEnabled;\r\n }\r\n else {\r\n Logger.Log = Logger._LogDisabled;\r\n }\r\n if ((level & Logger.WarningLogLevel) === Logger.WarningLogLevel) {\r\n Logger.Warn = Logger._WarnEnabled;\r\n }\r\n else {\r\n Logger.Warn = Logger._WarnDisabled;\r\n }\r\n if ((level & Logger.ErrorLogLevel) === Logger.ErrorLogLevel) {\r\n Logger.Error = Logger._ErrorEnabled;\r\n }\r\n else {\r\n Logger.Error = Logger._ErrorDisabled;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * No log\r\n */\r\n Logger.NoneLogLevel = 0;\r\n /**\r\n * Only message logs\r\n */\r\n Logger.MessageLogLevel = 1;\r\n /**\r\n * Only warning logs\r\n */\r\n Logger.WarningLogLevel = 2;\r\n /**\r\n * Only error logs\r\n */\r\n Logger.ErrorLogLevel = 4;\r\n /**\r\n * All logs\r\n */\r\n Logger.AllLogLevel = 7;\r\n Logger._LogCache = \"\";\r\n /**\r\n * Gets a value indicating the number of loading errors\r\n * @ignorenaming\r\n */\r\n Logger.errorsCount = 0;\r\n /**\r\n * Log a message to the console\r\n */\r\n Logger.Log = Logger._LogEnabled;\r\n /**\r\n * Write a warning message to the console\r\n */\r\n Logger.Warn = Logger._WarnEnabled;\r\n /**\r\n * Write an error message to the console\r\n */\r\n Logger.Error = Logger._ErrorEnabled;\r\n return Logger;\r\n}());\r\nexport { Logger };\r\n//# sourceMappingURL=logger.js.map","/**\r\n * A class serves as a medium between the observable and its observers\r\n */\r\nvar EventState = /** @class */ (function () {\r\n /**\r\n * Create a new EventState\r\n * @param mask defines the mask associated with this state\r\n * @param skipNextObservers defines a flag which will instruct the observable to skip following observers when set to true\r\n * @param target defines the original target of the state\r\n * @param currentTarget defines the current target of the state\r\n */\r\n function EventState(mask, skipNextObservers, target, currentTarget) {\r\n if (skipNextObservers === void 0) { skipNextObservers = false; }\r\n this.initalize(mask, skipNextObservers, target, currentTarget);\r\n }\r\n /**\r\n * Initialize the current event state\r\n * @param mask defines the mask associated with this state\r\n * @param skipNextObservers defines a flag which will instruct the observable to skip following observers when set to true\r\n * @param target defines the original target of the state\r\n * @param currentTarget defines the current target of the state\r\n * @returns the current event state\r\n */\r\n EventState.prototype.initalize = function (mask, skipNextObservers, target, currentTarget) {\r\n if (skipNextObservers === void 0) { skipNextObservers = false; }\r\n this.mask = mask;\r\n this.skipNextObservers = skipNextObservers;\r\n this.target = target;\r\n this.currentTarget = currentTarget;\r\n return this;\r\n };\r\n return EventState;\r\n}());\r\nexport { EventState };\r\n/**\r\n * Represent an Observer registered to a given Observable object.\r\n */\r\nvar Observer = /** @class */ (function () {\r\n /**\r\n * Creates a new observer\r\n * @param callback defines the callback to call when the observer is notified\r\n * @param mask defines the mask of the observer (used to filter notifications)\r\n * @param scope defines the current scope used to restore the JS context\r\n */\r\n function Observer(\r\n /**\r\n * Defines the callback to call when the observer is notified\r\n */\r\n callback, \r\n /**\r\n * Defines the mask of the observer (used to filter notifications)\r\n */\r\n mask, \r\n /**\r\n * Defines the current scope used to restore the JS context\r\n */\r\n scope) {\r\n if (scope === void 0) { scope = null; }\r\n this.callback = callback;\r\n this.mask = mask;\r\n this.scope = scope;\r\n /** @hidden */\r\n this._willBeUnregistered = false;\r\n /**\r\n * Gets or sets a property defining that the observer as to be unregistered after the next notification\r\n */\r\n this.unregisterOnNextCall = false;\r\n }\r\n return Observer;\r\n}());\r\nexport { Observer };\r\n/**\r\n * Represent a list of observers registered to multiple Observables object.\r\n */\r\nvar MultiObserver = /** @class */ (function () {\r\n function MultiObserver() {\r\n }\r\n /**\r\n * Release associated resources\r\n */\r\n MultiObserver.prototype.dispose = function () {\r\n if (this._observers && this._observables) {\r\n for (var index = 0; index < this._observers.length; index++) {\r\n this._observables[index].remove(this._observers[index]);\r\n }\r\n }\r\n this._observers = null;\r\n this._observables = null;\r\n };\r\n /**\r\n * Raise a callback when one of the observable will notify\r\n * @param observables defines a list of observables to watch\r\n * @param callback defines the callback to call on notification\r\n * @param mask defines the mask used to filter notifications\r\n * @param scope defines the current scope used to restore the JS context\r\n * @returns the new MultiObserver\r\n */\r\n MultiObserver.Watch = function (observables, callback, mask, scope) {\r\n if (mask === void 0) { mask = -1; }\r\n if (scope === void 0) { scope = null; }\r\n var result = new MultiObserver();\r\n result._observers = new Array();\r\n result._observables = observables;\r\n for (var _i = 0, observables_1 = observables; _i < observables_1.length; _i++) {\r\n var observable = observables_1[_i];\r\n var observer = observable.add(callback, mask, false, scope);\r\n if (observer) {\r\n result._observers.push(observer);\r\n }\r\n }\r\n return result;\r\n };\r\n return MultiObserver;\r\n}());\r\nexport { MultiObserver };\r\n/**\r\n * The Observable class is a simple implementation of the Observable pattern.\r\n *\r\n * There's one slight particularity though: a given Observable can notify its observer using a particular mask value, only the Observers registered with this mask value will be notified.\r\n * This enable a more fine grained execution without having to rely on multiple different Observable objects.\r\n * For instance you may have a given Observable that have four different types of notifications: Move (mask = 0x01), Stop (mask = 0x02), Turn Right (mask = 0X04), Turn Left (mask = 0X08).\r\n * A given observer can register itself with only Move and Stop (mask = 0x03), then it will only be notified when one of these two occurs and will never be for Turn Left/Right.\r\n */\r\nvar Observable = /** @class */ (function () {\r\n /**\r\n * Creates a new observable\r\n * @param onObserverAdded defines a callback to call when a new observer is added\r\n */\r\n function Observable(onObserverAdded) {\r\n this._observers = new Array();\r\n this._eventState = new EventState(0);\r\n if (onObserverAdded) {\r\n this._onObserverAdded = onObserverAdded;\r\n }\r\n }\r\n Object.defineProperty(Observable.prototype, \"observers\", {\r\n /**\r\n * Gets the list of observers\r\n */\r\n get: function () {\r\n return this._observers;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Create a new Observer with the specified callback\r\n * @param callback the callback that will be executed for that Observer\r\n * @param mask the mask used to filter observers\r\n * @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.\r\n * @param scope optional scope for the callback to be called from\r\n * @param unregisterOnFirstCall defines if the observer as to be unregistered after the next notification\r\n * @returns the new observer created for the callback\r\n */\r\n Observable.prototype.add = function (callback, mask, insertFirst, scope, unregisterOnFirstCall) {\r\n if (mask === void 0) { mask = -1; }\r\n if (insertFirst === void 0) { insertFirst = false; }\r\n if (scope === void 0) { scope = null; }\r\n if (unregisterOnFirstCall === void 0) { unregisterOnFirstCall = false; }\r\n if (!callback) {\r\n return null;\r\n }\r\n var observer = new Observer(callback, mask, scope);\r\n observer.unregisterOnNextCall = unregisterOnFirstCall;\r\n if (insertFirst) {\r\n this._observers.unshift(observer);\r\n }\r\n else {\r\n this._observers.push(observer);\r\n }\r\n if (this._onObserverAdded) {\r\n this._onObserverAdded(observer);\r\n }\r\n return observer;\r\n };\r\n /**\r\n * Create a new Observer with the specified callback and unregisters after the next notification\r\n * @param callback the callback that will be executed for that Observer\r\n * @returns the new observer created for the callback\r\n */\r\n Observable.prototype.addOnce = function (callback) {\r\n return this.add(callback, undefined, undefined, undefined, true);\r\n };\r\n /**\r\n * Remove an Observer from the Observable object\r\n * @param observer the instance of the Observer to remove\r\n * @returns false if it doesn't belong to this Observable\r\n */\r\n Observable.prototype.remove = function (observer) {\r\n if (!observer) {\r\n return false;\r\n }\r\n var index = this._observers.indexOf(observer);\r\n if (index !== -1) {\r\n this._deferUnregister(observer);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Remove a callback from the Observable object\r\n * @param callback the callback to remove\r\n * @param scope optional scope. If used only the callbacks with this scope will be removed\r\n * @returns false if it doesn't belong to this Observable\r\n */\r\n Observable.prototype.removeCallback = function (callback, scope) {\r\n for (var index = 0; index < this._observers.length; index++) {\r\n var observer = this._observers[index];\r\n if (observer._willBeUnregistered) {\r\n continue;\r\n }\r\n if (observer.callback === callback && (!scope || scope === observer.scope)) {\r\n this._deferUnregister(observer);\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n Observable.prototype._deferUnregister = function (observer) {\r\n var _this = this;\r\n observer.unregisterOnNextCall = false;\r\n observer._willBeUnregistered = true;\r\n setTimeout(function () {\r\n _this._remove(observer);\r\n }, 0);\r\n };\r\n // This should only be called when not iterating over _observers to avoid callback skipping.\r\n // Removes an observer from the _observer Array.\r\n Observable.prototype._remove = function (observer) {\r\n if (!observer) {\r\n return false;\r\n }\r\n var index = this._observers.indexOf(observer);\r\n if (index !== -1) {\r\n this._observers.splice(index, 1);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Moves the observable to the top of the observer list making it get called first when notified\r\n * @param observer the observer to move\r\n */\r\n Observable.prototype.makeObserverTopPriority = function (observer) {\r\n this._remove(observer);\r\n this._observers.unshift(observer);\r\n };\r\n /**\r\n * Moves the observable to the bottom of the observer list making it get called last when notified\r\n * @param observer the observer to move\r\n */\r\n Observable.prototype.makeObserverBottomPriority = function (observer) {\r\n this._remove(observer);\r\n this._observers.push(observer);\r\n };\r\n /**\r\n * Notify all Observers by calling their respective callback with the given data\r\n * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute\r\n * @param eventData defines the data to send to all observers\r\n * @param mask defines the mask of the current notification (observers with incompatible mask (ie mask & observer.mask === 0) will not be notified)\r\n * @param target defines the original target of the state\r\n * @param currentTarget defines the current target of the state\r\n * @param userInfo defines any user info to send to observers\r\n * @returns false if the complete observer chain was not processed (because one observer set the skipNextObservers to true)\r\n */\r\n Observable.prototype.notifyObservers = function (eventData, mask, target, currentTarget, userInfo) {\r\n if (mask === void 0) { mask = -1; }\r\n if (!this._observers.length) {\r\n return true;\r\n }\r\n var state = this._eventState;\r\n state.mask = mask;\r\n state.target = target;\r\n state.currentTarget = currentTarget;\r\n state.skipNextObservers = false;\r\n state.lastReturnValue = eventData;\r\n state.userInfo = userInfo;\r\n for (var _i = 0, _a = this._observers; _i < _a.length; _i++) {\r\n var obs = _a[_i];\r\n if (obs._willBeUnregistered) {\r\n continue;\r\n }\r\n if (obs.mask & mask) {\r\n if (obs.scope) {\r\n state.lastReturnValue = obs.callback.apply(obs.scope, [eventData, state]);\r\n }\r\n else {\r\n state.lastReturnValue = obs.callback(eventData, state);\r\n }\r\n if (obs.unregisterOnNextCall) {\r\n this._deferUnregister(obs);\r\n }\r\n }\r\n if (state.skipNextObservers) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Calling this will execute each callback, expecting it to be a promise or return a value.\r\n * If at any point in the chain one function fails, the promise will fail and the execution will not continue.\r\n * This is useful when a chain of events (sometimes async events) is needed to initialize a certain object\r\n * and it is crucial that all callbacks will be executed.\r\n * The order of the callbacks is kept, callbacks are not executed parallel.\r\n *\r\n * @param eventData The data to be sent to each callback\r\n * @param mask is used to filter observers defaults to -1\r\n * @param target defines the callback target (see EventState)\r\n * @param currentTarget defines he current object in the bubbling phase\r\n * @param userInfo defines any user info to send to observers\r\n * @returns {Promise} will return a Promise than resolves when all callbacks executed successfully.\r\n */\r\n Observable.prototype.notifyObserversWithPromise = function (eventData, mask, target, currentTarget, userInfo) {\r\n var _this = this;\r\n if (mask === void 0) { mask = -1; }\r\n // create an empty promise\r\n var p = Promise.resolve(eventData);\r\n // no observers? return this promise.\r\n if (!this._observers.length) {\r\n return p;\r\n }\r\n var state = this._eventState;\r\n state.mask = mask;\r\n state.target = target;\r\n state.currentTarget = currentTarget;\r\n state.skipNextObservers = false;\r\n state.userInfo = userInfo;\r\n // execute one callback after another (not using Promise.all, the order is important)\r\n this._observers.forEach(function (obs) {\r\n if (state.skipNextObservers) {\r\n return;\r\n }\r\n if (obs._willBeUnregistered) {\r\n return;\r\n }\r\n if (obs.mask & mask) {\r\n if (obs.scope) {\r\n p = p.then(function (lastReturnedValue) {\r\n state.lastReturnValue = lastReturnedValue;\r\n return obs.callback.apply(obs.scope, [eventData, state]);\r\n });\r\n }\r\n else {\r\n p = p.then(function (lastReturnedValue) {\r\n state.lastReturnValue = lastReturnedValue;\r\n return obs.callback(eventData, state);\r\n });\r\n }\r\n if (obs.unregisterOnNextCall) {\r\n _this._deferUnregister(obs);\r\n }\r\n }\r\n });\r\n // return the eventData\r\n return p.then(function () { return eventData; });\r\n };\r\n /**\r\n * Notify a specific observer\r\n * @param observer defines the observer to notify\r\n * @param eventData defines the data to be sent to each callback\r\n * @param mask is used to filter observers defaults to -1\r\n */\r\n Observable.prototype.notifyObserver = function (observer, eventData, mask) {\r\n if (mask === void 0) { mask = -1; }\r\n var state = this._eventState;\r\n state.mask = mask;\r\n state.skipNextObservers = false;\r\n observer.callback(eventData, state);\r\n };\r\n /**\r\n * Gets a boolean indicating if the observable has at least one observer\r\n * @returns true is the Observable has at least one Observer registered\r\n */\r\n Observable.prototype.hasObservers = function () {\r\n return this._observers.length > 0;\r\n };\r\n /**\r\n * Clear the list of observers\r\n */\r\n Observable.prototype.clear = function () {\r\n this._observers = new Array();\r\n this._onObserverAdded = null;\r\n };\r\n /**\r\n * Clone the current observable\r\n * @returns a new observable\r\n */\r\n Observable.prototype.clone = function () {\r\n var result = new Observable();\r\n result._observers = this._observers.slice(0);\r\n return result;\r\n };\r\n /**\r\n * Does this observable handles observer registered with a given mask\r\n * @param mask defines the mask to be tested\r\n * @return whether or not one observer registered with the given mask is handeled\r\n **/\r\n Observable.prototype.hasSpecificMask = function (mask) {\r\n if (mask === void 0) { mask = -1; }\r\n for (var _i = 0, _a = this._observers; _i < _a.length; _i++) {\r\n var obs = _a[_i];\r\n if (obs.mask & mask || obs.mask === mask) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n return Observable;\r\n}());\r\nexport { Observable };\r\n//# sourceMappingURL=observable.js.map","import { PrecisionDate } from './precisionDate';\r\n/**\r\n * This class is used to track a performance counter which is number based.\r\n * The user has access to many properties which give statistics of different nature.\r\n *\r\n * The implementer can track two kinds of Performance Counter: time and count.\r\n * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.\r\n * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.\r\n */\r\nvar PerfCounter = /** @class */ (function () {\r\n /**\r\n * Creates a new counter\r\n */\r\n function PerfCounter() {\r\n this._startMonitoringTime = 0;\r\n this._min = 0;\r\n this._max = 0;\r\n this._average = 0;\r\n this._lastSecAverage = 0;\r\n this._current = 0;\r\n this._totalValueCount = 0;\r\n this._totalAccumulated = 0;\r\n this._lastSecAccumulated = 0;\r\n this._lastSecTime = 0;\r\n this._lastSecValueCount = 0;\r\n }\r\n Object.defineProperty(PerfCounter.prototype, \"min\", {\r\n /**\r\n * Returns the smallest value ever\r\n */\r\n get: function () {\r\n return this._min;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"max\", {\r\n /**\r\n * Returns the biggest value ever\r\n */\r\n get: function () {\r\n return this._max;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"average\", {\r\n /**\r\n * Returns the average value since the performance counter is running\r\n */\r\n get: function () {\r\n return this._average;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"lastSecAverage\", {\r\n /**\r\n * Returns the average value of the last second the counter was monitored\r\n */\r\n get: function () {\r\n return this._lastSecAverage;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"current\", {\r\n /**\r\n * Returns the current value\r\n */\r\n get: function () {\r\n return this._current;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"total\", {\r\n /**\r\n * Gets the accumulated total\r\n */\r\n get: function () {\r\n return this._totalAccumulated;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"count\", {\r\n /**\r\n * Gets the total value count\r\n */\r\n get: function () {\r\n return this._totalValueCount;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Call this method to start monitoring a new frame.\r\n * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.\r\n */\r\n PerfCounter.prototype.fetchNewFrame = function () {\r\n this._totalValueCount++;\r\n this._current = 0;\r\n this._lastSecValueCount++;\r\n };\r\n /**\r\n * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)\r\n * @param newCount the count value to add to the monitored count\r\n * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.\r\n */\r\n PerfCounter.prototype.addCount = function (newCount, fetchResult) {\r\n if (!PerfCounter.Enabled) {\r\n return;\r\n }\r\n this._current += newCount;\r\n if (fetchResult) {\r\n this._fetchResult();\r\n }\r\n };\r\n /**\r\n * Start monitoring this performance counter\r\n */\r\n PerfCounter.prototype.beginMonitoring = function () {\r\n if (!PerfCounter.Enabled) {\r\n return;\r\n }\r\n this._startMonitoringTime = PrecisionDate.Now;\r\n };\r\n /**\r\n * Compute the time lapsed since the previous beginMonitoring() call.\r\n * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter\r\n */\r\n PerfCounter.prototype.endMonitoring = function (newFrame) {\r\n if (newFrame === void 0) { newFrame = true; }\r\n if (!PerfCounter.Enabled) {\r\n return;\r\n }\r\n if (newFrame) {\r\n this.fetchNewFrame();\r\n }\r\n var currentTime = PrecisionDate.Now;\r\n this._current = currentTime - this._startMonitoringTime;\r\n if (newFrame) {\r\n this._fetchResult();\r\n }\r\n };\r\n PerfCounter.prototype._fetchResult = function () {\r\n this._totalAccumulated += this._current;\r\n this._lastSecAccumulated += this._current;\r\n // Min/Max update\r\n this._min = Math.min(this._min, this._current);\r\n this._max = Math.max(this._max, this._current);\r\n this._average = this._totalAccumulated / this._totalValueCount;\r\n // Reset last sec?\r\n var now = PrecisionDate.Now;\r\n if ((now - this._lastSecTime) > 1000) {\r\n this._lastSecAverage = this._lastSecAccumulated / this._lastSecValueCount;\r\n this._lastSecTime = now;\r\n this._lastSecAccumulated = 0;\r\n this._lastSecValueCount = 0;\r\n }\r\n };\r\n /**\r\n * Gets or sets a global boolean to turn on and off all the counters\r\n */\r\n PerfCounter.Enabled = true;\r\n return PerfCounter;\r\n}());\r\nexport { PerfCounter };\r\n//# sourceMappingURL=perfCounter.js.map","import { DomManagement } from './domManagement';\r\n/**\r\n * Class containing a set of static utilities functions for precision date\r\n */\r\nvar PrecisionDate = /** @class */ (function () {\r\n function PrecisionDate() {\r\n }\r\n Object.defineProperty(PrecisionDate, \"Now\", {\r\n /**\r\n * Gets either window.performance.now() if supported or Date.now() else\r\n */\r\n get: function () {\r\n if (DomManagement.IsWindowObjectExist() && window.performance && window.performance.now) {\r\n return window.performance.now();\r\n }\r\n return Date.now();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return PrecisionDate;\r\n}());\r\nexport { PrecisionDate };\r\n//# sourceMappingURL=precisionDate.js.map","import { Effect } from \"../Materials/effect\";\r\nvar name = 'fxaaPixelShader';\r\nvar shader = \"uniform sampler2D textureSampler;\\nuniform vec2 texelSize;\\nvarying vec2 vUV;\\nvarying vec2 sampleCoordS;\\nvarying vec2 sampleCoordE;\\nvarying vec2 sampleCoordN;\\nvarying vec2 sampleCoordW;\\nvarying vec2 sampleCoordNW;\\nvarying vec2 sampleCoordSE;\\nvarying vec2 sampleCoordNE;\\nvarying vec2 sampleCoordSW;\\nconst float fxaaQualitySubpix=1.0;\\nconst float fxaaQualityEdgeThreshold=0.166;\\nconst float fxaaQualityEdgeThresholdMin=0.0833;\\nconst vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);\\n#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)\\nvoid main(){\\nvec2 posM;\\nposM.x=vUV.x;\\nposM.y=vUV.y;\\nvec4 rgbyM=texture2D(textureSampler,vUV,0.0);\\nfloat lumaM=FxaaLuma(rgbyM);\\nfloat lumaS=FxaaLuma(texture2D(textureSampler,sampleCoordS,0.0));\\nfloat lumaE=FxaaLuma(texture2D(textureSampler,sampleCoordE,0.0));\\nfloat lumaN=FxaaLuma(texture2D(textureSampler,sampleCoordN,0.0));\\nfloat lumaW=FxaaLuma(texture2D(textureSampler,sampleCoordW,0.0));\\nfloat maxSM=max(lumaS,lumaM);\\nfloat minSM=min(lumaS,lumaM);\\nfloat maxESM=max(lumaE,maxSM);\\nfloat minESM=min(lumaE,minSM);\\nfloat maxWN=max(lumaN,lumaW);\\nfloat minWN=min(lumaN,lumaW);\\nfloat rangeMax=max(maxWN,maxESM);\\nfloat rangeMin=min(minWN,minESM);\\nfloat rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;\\nfloat range=rangeMax-rangeMin;\\nfloat rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\\n#ifndef MALI\\nif(range=edgeVert;\\nfloat subpixA=subpixNSWE*2.0+subpixNWSWNESE;\\nif (!horzSpan)\\n{\\nlumaN=lumaW;\\n}\\nif (!horzSpan)\\n{\\nlumaS=lumaE;\\n}\\nif (horzSpan)\\n{\\nlengthSign=texelSize.y;\\n}\\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;\\nfloat gradientN=lumaN-lumaM;\\nfloat gradientS=lumaS-lumaM;\\nfloat lumaNN=lumaN+lumaM;\\nfloat lumaSS=lumaS+lumaM;\\nbool pairN=abs(gradientN)>=abs(gradientS);\\nfloat gradient=max(abs(gradientN),abs(gradientS));\\nif (pairN)\\n{\\nlengthSign=-lengthSign;\\n}\\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);\\nvec2 posB;\\nposB.x=posM.x;\\nposB.y=posM.y;\\nvec2 offNP;\\noffNP.x=(!horzSpan) ? 0.0 : texelSize.x;\\noffNP.y=(horzSpan) ? 0.0 : texelSize.y;\\nif (!horzSpan)\\n{\\nposB.x+=lengthSign*0.5;\\n}\\nif (horzSpan)\\n{\\nposB.y+=lengthSign*0.5;\\n}\\nvec2 posN;\\nposN.x=posB.x-offNP.x*1.5;\\nposN.y=posB.y-offNP.y*1.5;\\nvec2 posP;\\nposP.x=posB.x+offNP.x*1.5;\\nposP.y=posB.y+offNP.y*1.5;\\nfloat subpixD=((-2.0)*subpixC)+3.0;\\nfloat lumaEndN=FxaaLuma(texture2D(textureSampler,posN,0.0));\\nfloat subpixE=subpixC*subpixC;\\nfloat lumaEndP=FxaaLuma(texture2D(textureSampler,posP,0.0));\\nif (!pairN)\\n{\\nlumaNN=lumaSS;\\n}\\nfloat gradientScaled=gradient*1.0/4.0;\\nfloat lumaMM=lumaM-lumaNN*0.5;\\nfloat subpixF=subpixD*subpixE;\\nbool lumaMLTZero=lumaMM<0.0;\\nlumaEndN-=lumaNN*0.5;\\nlumaEndP-=lumaNN*0.5;\\nbool doneN=abs(lumaEndN)>=gradientScaled;\\nbool doneP=abs(lumaEndP)>=gradientScaled;\\nif (!doneN)\\n{\\nposN.x-=offNP.x*3.0;\\n}\\nif (!doneN)\\n{\\nposN.y-=offNP.y*3.0;\\n}\\nbool doneNP=(!doneN) || (!doneP);\\nif (!doneP)\\n{\\nposP.x+=offNP.x*3.0;\\n}\\nif (!doneP)\\n{\\nposP.y+=offNP.y*3.0;\\n}\\nif (doneNP)\\n{\\nif (!doneN) lumaEndN=FxaaLuma(texture2D(textureSampler,posN.xy,0.0));\\nif (!doneP) lumaEndP=FxaaLuma(texture2D(textureSampler,posP.xy,0.0));\\nif (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;\\nif (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;\\ndoneN=abs(lumaEndN)>=gradientScaled;\\ndoneP=abs(lumaEndP)>=gradientScaled;\\nif (!doneN) posN.x-=offNP.x*12.0;\\nif (!doneN) posN.y-=offNP.y*12.0;\\ndoneNP=(!doneN) || (!doneP);\\nif (!doneP) posP.x+=offNP.x*12.0;\\nif (!doneP) posP.y+=offNP.y*12.0;\\n}\\nfloat dstN=posM.x-posN.x;\\nfloat dstP=posP.x-posM.x;\\nif (!horzSpan)\\n{\\ndstN=posM.y-posN.y;\\n}\\nif (!horzSpan)\\n{\\ndstP=posP.y-posM.y;\\n}\\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;\\nfloat spanLength=(dstP+dstN);\\nbool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;\\nfloat spanLengthRcp=1.0/spanLength;\\nbool directionN=dstN -1) {\r\n return \"#define MALI 1\\n\";\r\n }\r\n return null;\r\n };\r\n /** @hidden */\r\n FxaaPostProcess._Parse = function (parsedPostProcess, targetCamera, scene, rootUrl) {\r\n return SerializationHelper.Parse(function () {\r\n return new FxaaPostProcess(parsedPostProcess.name, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.reusable);\r\n }, parsedPostProcess, scene, rootUrl);\r\n };\r\n return FxaaPostProcess;\r\n}(PostProcess));\r\nexport { FxaaPostProcess };\r\n_TypeStore.RegisteredTypes[\"BABYLON.FxaaPostProcess\"] = FxaaPostProcess;\r\n//# sourceMappingURL=fxaaPostProcess.js.map","import { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport { FxaaPostProcess } from \"../PostProcesses/fxaaPostProcess\";\r\nimport { Logger } from \"./logger\";\r\nimport { Tools } from \"./tools\";\r\n/**\r\n * Class containing a set of static utilities functions for screenshots\r\n */\r\nvar ScreenshotTools = /** @class */ (function () {\r\n function ScreenshotTools() {\r\n }\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n */\r\n ScreenshotTools.CreateScreenshot = function (engine, camera, size, successCallback, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n var _a = ScreenshotTools._getScreenshotSize(engine, camera, size), height = _a.height, width = _a.width;\r\n if (!(height && width)) {\r\n Logger.Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n if (!Tools._ScreenshotCanvas) {\r\n Tools._ScreenshotCanvas = document.createElement('canvas');\r\n }\r\n Tools._ScreenshotCanvas.width = width;\r\n Tools._ScreenshotCanvas.height = height;\r\n var renderContext = Tools._ScreenshotCanvas.getContext(\"2d\");\r\n var ratio = engine.getRenderWidth() / engine.getRenderHeight();\r\n var newWidth = width;\r\n var newHeight = newWidth / ratio;\r\n if (newHeight > height) {\r\n newHeight = height;\r\n newWidth = newHeight * ratio;\r\n }\r\n var offsetX = Math.max(0, width - newWidth) / 2;\r\n var offsetY = Math.max(0, height - newHeight) / 2;\r\n var renderingCanvas = engine.getRenderingCanvas();\r\n if (renderContext && renderingCanvas) {\r\n renderContext.drawImage(renderingCanvas, offsetX, offsetY, newWidth, newHeight);\r\n }\r\n Tools.EncodeScreenshotCanvasData(successCallback, mimeType);\r\n };\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n ScreenshotTools.CreateScreenshotAsync = function (engine, camera, size, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n return new Promise(function (resolve, reject) {\r\n ScreenshotTools.CreateScreenshot(engine, camera, size, function (data) {\r\n if (typeof (data) !== \"undefined\") {\r\n resolve(data);\r\n }\r\n else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n }, mimeType);\r\n });\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)\r\n */\r\n ScreenshotTools.CreateScreenshotUsingRenderTarget = function (engine, camera, size, successCallback, mimeType, samples, antialiasing, fileName, renderSprites, enableStencilBuffer) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n if (renderSprites === void 0) { renderSprites = false; }\r\n if (enableStencilBuffer === void 0) { enableStencilBuffer = false; }\r\n var _a = ScreenshotTools._getScreenshotSize(engine, camera, size), height = _a.height, width = _a.width;\r\n var targetTextureSize = { width: width, height: height };\r\n if (!(height && width)) {\r\n Logger.Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n var renderCanvas = engine.getRenderingCanvas();\r\n if (!renderCanvas) {\r\n Logger.Error(\"No rendering canvas found !\");\r\n return;\r\n }\r\n var originalSize = { width: renderCanvas.width, height: renderCanvas.height };\r\n engine.setSize(width, height);\r\n var scene = camera.getScene();\r\n var previousCamera = null;\r\n var previousCameras = scene.activeCameras;\r\n if (scene.activeCamera !== camera || scene.activeCameras && scene.activeCameras.length) {\r\n previousCamera = scene.activeCamera;\r\n scene.activeCamera = camera;\r\n }\r\n scene.render();\r\n // At this point size can be a number, or an object (according to engine.prototype.createRenderTargetTexture method)\r\n var texture = new RenderTargetTexture(\"screenShot\", targetTextureSize, scene, false, false, 0, false, Texture.NEAREST_SAMPLINGMODE, undefined, enableStencilBuffer);\r\n texture.renderList = null;\r\n texture.samples = samples;\r\n texture.renderSprites = renderSprites;\r\n texture.onAfterRenderObservable.add(function () {\r\n Tools.DumpFramebuffer(width, height, engine, successCallback, mimeType, fileName);\r\n });\r\n var renderToTexture = function () {\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n texture.render(true);\r\n texture.dispose();\r\n if (previousCamera) {\r\n scene.activeCamera = previousCamera;\r\n }\r\n scene.activeCameras = previousCameras;\r\n engine.setSize(originalSize.width, originalSize.height);\r\n camera.getProjectionMatrix(true); // Force cache refresh;\r\n };\r\n if (antialiasing) {\r\n var fxaaPostProcess = new FxaaPostProcess('antialiasing', 1.0, scene.activeCamera);\r\n texture.addPostProcess(fxaaPostProcess);\r\n // Async Shader Compilation can lead to none ready effects in synchronous code\r\n if (!fxaaPostProcess.getEffect().isReady()) {\r\n fxaaPostProcess.getEffect().onCompiled = function () {\r\n renderToTexture();\r\n };\r\n }\r\n // The effect is ready we can render\r\n else {\r\n renderToTexture();\r\n }\r\n }\r\n else {\r\n // No need to wait for extra resources to be ready\r\n renderToTexture();\r\n }\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n ScreenshotTools.CreateScreenshotUsingRenderTargetAsync = function (engine, camera, size, mimeType, samples, antialiasing, fileName, renderSprites) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n if (renderSprites === void 0) { renderSprites = false; }\r\n return new Promise(function (resolve, reject) {\r\n ScreenshotTools.CreateScreenshotUsingRenderTarget(engine, camera, size, function (data) {\r\n if (typeof (data) !== \"undefined\") {\r\n resolve(data);\r\n }\r\n else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n }, mimeType, samples, antialiasing, fileName, renderSprites);\r\n });\r\n };\r\n /**\r\n * Gets height and width for screenshot size\r\n * @private\r\n */\r\n ScreenshotTools._getScreenshotSize = function (engine, camera, size) {\r\n var height = 0;\r\n var width = 0;\r\n //If a size value defined as object\r\n if (typeof (size) === 'object') {\r\n var precision = size.precision\r\n ? Math.abs(size.precision) // prevent GL_INVALID_VALUE : glViewport: negative width/height\r\n : 1;\r\n //If a width and height values is specified\r\n if (size.width && size.height) {\r\n height = size.height * precision;\r\n width = size.width * precision;\r\n }\r\n //If passing only width, computing height to keep display canvas ratio.\r\n else if (size.width && !size.height) {\r\n width = size.width * precision;\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n //If passing only height, computing width to keep display canvas ratio.\r\n else if (size.height && !size.width) {\r\n height = size.height * precision;\r\n width = Math.round(height * engine.getAspectRatio(camera));\r\n }\r\n else {\r\n width = Math.round(engine.getRenderWidth() * precision);\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n }\r\n //Assuming here that \"size\" parameter is a number\r\n else if (!isNaN(size)) {\r\n height = size;\r\n width = size;\r\n }\r\n // When creating the image data from the CanvasRenderingContext2D, the width and height is clamped to the size of the _gl context\r\n // On certain GPUs, it seems as if the _gl context truncates to an integer automatically. Therefore, if a user tries to pass the width of their canvas element\r\n // and it happens to be a float (1000.5 x 600.5 px), the engine.readPixels will return a different size array than context.createImageData\r\n // to resolve this, we truncate the floats here to ensure the same size\r\n if (width) {\r\n width = Math.floor(width);\r\n }\r\n if (height) {\r\n height = Math.floor(height);\r\n }\r\n return { height: height | 0, width: width | 0 };\r\n };\r\n return ScreenshotTools;\r\n}());\r\nexport { ScreenshotTools };\r\nTools.CreateScreenshot = ScreenshotTools.CreateScreenshot;\r\nTools.CreateScreenshotAsync = ScreenshotTools.CreateScreenshotAsync;\r\nTools.CreateScreenshotUsingRenderTarget = ScreenshotTools.CreateScreenshotUsingRenderTarget;\r\nTools.CreateScreenshotUsingRenderTargetAsync = ScreenshotTools.CreateScreenshotUsingRenderTargetAsync;\r\n//# sourceMappingURL=screenshotTools.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\r\n */\r\nvar SmartArray = /** @class */ (function () {\r\n /**\r\n * Instantiates a Smart Array.\r\n * @param capacity defines the default capacity of the array.\r\n */\r\n function SmartArray(capacity) {\r\n /**\r\n * The active length of the array.\r\n */\r\n this.length = 0;\r\n this.data = new Array(capacity);\r\n this._id = SmartArray._GlobalId++;\r\n }\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * @param value defines the object to push in the array.\r\n */\r\n SmartArray.prototype.push = function (value) {\r\n this.data[this.length++] = value;\r\n if (this.length > this.data.length) {\r\n this.data.length *= 2;\r\n }\r\n };\r\n /**\r\n * Iterates over the active data and apply the lambda to them.\r\n * @param func defines the action to apply on each value.\r\n */\r\n SmartArray.prototype.forEach = function (func) {\r\n for (var index = 0; index < this.length; index++) {\r\n func(this.data[index]);\r\n }\r\n };\r\n /**\r\n * Sorts the full sets of data.\r\n * @param compareFn defines the comparison function to apply.\r\n */\r\n SmartArray.prototype.sort = function (compareFn) {\r\n this.data.sort(compareFn);\r\n };\r\n /**\r\n * Resets the active data to an empty array.\r\n */\r\n SmartArray.prototype.reset = function () {\r\n this.length = 0;\r\n };\r\n /**\r\n * Releases all the data from the array as well as the array.\r\n */\r\n SmartArray.prototype.dispose = function () {\r\n this.reset();\r\n if (this.data) {\r\n this.data.length = 0;\r\n this.data = [];\r\n }\r\n };\r\n /**\r\n * Concats the active data with a given array.\r\n * @param array defines the data to concatenate with.\r\n */\r\n SmartArray.prototype.concat = function (array) {\r\n if (array.length === 0) {\r\n return;\r\n }\r\n if (this.length + array.length > this.data.length) {\r\n this.data.length = (this.length + array.length) * 2;\r\n }\r\n for (var index = 0; index < array.length; index++) {\r\n this.data[this.length++] = (array.data || array)[index];\r\n }\r\n };\r\n /**\r\n * Returns the position of a value in the active data.\r\n * @param value defines the value to find the index for\r\n * @returns the index if found in the active data otherwise -1\r\n */\r\n SmartArray.prototype.indexOf = function (value) {\r\n var position = this.data.indexOf(value);\r\n if (position >= this.length) {\r\n return -1;\r\n }\r\n return position;\r\n };\r\n /**\r\n * Returns whether an element is part of the active data.\r\n * @param value defines the value to look for\r\n * @returns true if found in the active data otherwise false\r\n */\r\n SmartArray.prototype.contains = function (value) {\r\n return this.indexOf(value) !== -1;\r\n };\r\n // Statics\r\n SmartArray._GlobalId = 0;\r\n return SmartArray;\r\n}());\r\nexport { SmartArray };\r\n/**\r\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\r\n * The data in this array can only be present once\r\n */\r\nvar SmartArrayNoDuplicate = /** @class */ (function (_super) {\r\n __extends(SmartArrayNoDuplicate, _super);\r\n function SmartArrayNoDuplicate() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._duplicateId = 0;\r\n return _this;\r\n }\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * THIS DOES NOT PREVENT DUPPLICATE DATA\r\n * @param value defines the object to push in the array.\r\n */\r\n SmartArrayNoDuplicate.prototype.push = function (value) {\r\n _super.prototype.push.call(this, value);\r\n if (!value.__smartArrayFlags) {\r\n value.__smartArrayFlags = {};\r\n }\r\n value.__smartArrayFlags[this._id] = this._duplicateId;\r\n };\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * If the data is already present, it won t be added again\r\n * @param value defines the object to push in the array.\r\n * @returns true if added false if it was already present\r\n */\r\n SmartArrayNoDuplicate.prototype.pushNoDuplicate = function (value) {\r\n if (value.__smartArrayFlags && value.__smartArrayFlags[this._id] === this._duplicateId) {\r\n return false;\r\n }\r\n this.push(value);\r\n return true;\r\n };\r\n /**\r\n * Resets the active data to an empty array.\r\n */\r\n SmartArrayNoDuplicate.prototype.reset = function () {\r\n _super.prototype.reset.call(this);\r\n this._duplicateId++;\r\n };\r\n /**\r\n * Concats the active data with a given array.\r\n * This ensures no dupplicate will be present in the result.\r\n * @param array defines the data to concatenate with.\r\n */\r\n SmartArrayNoDuplicate.prototype.concatWithNoDuplicate = function (array) {\r\n if (array.length === 0) {\r\n return;\r\n }\r\n if (this.length + array.length > this.data.length) {\r\n this.data.length = (this.length + array.length) * 2;\r\n }\r\n for (var index = 0; index < array.length; index++) {\r\n var item = (array.data || array)[index];\r\n this.pushNoDuplicate(item);\r\n }\r\n };\r\n return SmartArrayNoDuplicate;\r\n}(SmartArray));\r\nexport { SmartArrayNoDuplicate };\r\n//# sourceMappingURL=smartArray.js.map","/**\r\n * Helper to manipulate strings\r\n */\r\nvar StringTools = /** @class */ (function () {\r\n function StringTools() {\r\n }\r\n /**\r\n * Checks for a matching suffix at the end of a string (for ES5 and lower)\r\n * @param str Source string\r\n * @param suffix Suffix to search for in the source string\r\n * @returns Boolean indicating whether the suffix was found (true) or not (false)\r\n */\r\n StringTools.EndsWith = function (str, suffix) {\r\n return str.indexOf(suffix, str.length - suffix.length) !== -1;\r\n };\r\n /**\r\n * Checks for a matching suffix at the beginning of a string (for ES5 and lower)\r\n * @param str Source string\r\n * @param suffix Suffix to search for in the source string\r\n * @returns Boolean indicating whether the suffix was found (true) or not (false)\r\n */\r\n StringTools.StartsWith = function (str, suffix) {\r\n if (!str) {\r\n return false;\r\n }\r\n return str.indexOf(suffix) === 0;\r\n };\r\n /**\r\n * Decodes a buffer into a string\r\n * @param buffer The buffer to decode\r\n * @returns The decoded string\r\n */\r\n StringTools.Decode = function (buffer) {\r\n if (typeof TextDecoder !== \"undefined\") {\r\n return new TextDecoder().decode(buffer);\r\n }\r\n var result = \"\";\r\n for (var i = 0; i < buffer.byteLength; i++) {\r\n result += String.fromCharCode(buffer[i]);\r\n }\r\n return result;\r\n };\r\n /**\r\n * Encode a buffer to a base64 string\r\n * @param buffer defines the buffer to encode\r\n * @returns the encoded string\r\n */\r\n StringTools.EncodeArrayBufferToBase64 = function (buffer) {\r\n var keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n var output = \"\";\r\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\r\n var i = 0;\r\n var bytes = ArrayBuffer.isView(buffer) ? new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength) : new Uint8Array(buffer);\r\n while (i < bytes.length) {\r\n chr1 = bytes[i++];\r\n chr2 = i < bytes.length ? bytes[i++] : Number.NaN;\r\n chr3 = i < bytes.length ? bytes[i++] : Number.NaN;\r\n enc1 = chr1 >> 2;\r\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\r\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\r\n enc4 = chr3 & 63;\r\n if (isNaN(chr2)) {\r\n enc3 = enc4 = 64;\r\n }\r\n else if (isNaN(chr3)) {\r\n enc4 = 64;\r\n }\r\n output += keyStr.charAt(enc1) + keyStr.charAt(enc2) +\r\n keyStr.charAt(enc3) + keyStr.charAt(enc4);\r\n }\r\n return output;\r\n };\r\n /**\r\n * Converts a number to string and pads with preceeding zeroes until it is of specified length.\r\n * @param num the number to convert and pad\r\n * @param length the expected length of the string\r\n * @returns the padded string\r\n */\r\n StringTools.PadNumber = function (num, length) {\r\n var str = String(num);\r\n while (str.length < length) {\r\n str = \"0\" + str;\r\n }\r\n return str;\r\n };\r\n return StringTools;\r\n}());\r\nexport { StringTools };\r\n//# sourceMappingURL=stringTools.js.map","/**\r\n * Class used to evalaute queries containing `and` and `or` operators\r\n */\r\nvar AndOrNotEvaluator = /** @class */ (function () {\r\n function AndOrNotEvaluator() {\r\n }\r\n /**\r\n * Evaluate a query\r\n * @param query defines the query to evaluate\r\n * @param evaluateCallback defines the callback used to filter result\r\n * @returns true if the query matches\r\n */\r\n AndOrNotEvaluator.Eval = function (query, evaluateCallback) {\r\n if (!query.match(/\\([^\\(\\)]*\\)/g)) {\r\n query = AndOrNotEvaluator._HandleParenthesisContent(query, evaluateCallback);\r\n }\r\n else {\r\n query = query.replace(/\\([^\\(\\)]*\\)/g, function (r) {\r\n // remove parenthesis\r\n r = r.slice(1, r.length - 1);\r\n return AndOrNotEvaluator._HandleParenthesisContent(r, evaluateCallback);\r\n });\r\n }\r\n if (query === \"true\") {\r\n return true;\r\n }\r\n if (query === \"false\") {\r\n return false;\r\n }\r\n return AndOrNotEvaluator.Eval(query, evaluateCallback);\r\n };\r\n AndOrNotEvaluator._HandleParenthesisContent = function (parenthesisContent, evaluateCallback) {\r\n evaluateCallback = evaluateCallback || (function (r) {\r\n return r === \"true\" ? true : false;\r\n });\r\n var result;\r\n var or = parenthesisContent.split(\"||\");\r\n for (var i in or) {\r\n if (or.hasOwnProperty(i)) {\r\n var ori = AndOrNotEvaluator._SimplifyNegation(or[i].trim());\r\n var and = ori.split(\"&&\");\r\n if (and.length > 1) {\r\n for (var j = 0; j < and.length; ++j) {\r\n var andj = AndOrNotEvaluator._SimplifyNegation(and[j].trim());\r\n if (andj !== \"true\" && andj !== \"false\") {\r\n if (andj[0] === \"!\") {\r\n result = !evaluateCallback(andj.substring(1));\r\n }\r\n else {\r\n result = evaluateCallback(andj);\r\n }\r\n }\r\n else {\r\n result = andj === \"true\" ? true : false;\r\n }\r\n if (!result) { // no need to continue since 'false && ... && ...' will always return false\r\n ori = \"false\";\r\n break;\r\n }\r\n }\r\n }\r\n if (result || ori === \"true\") { // no need to continue since 'true || ... || ...' will always return true\r\n result = true;\r\n break;\r\n }\r\n // result equals false (or undefined)\r\n if (ori !== \"true\" && ori !== \"false\") {\r\n if (ori[0] === \"!\") {\r\n result = !evaluateCallback(ori.substring(1));\r\n }\r\n else {\r\n result = evaluateCallback(ori);\r\n }\r\n }\r\n else {\r\n result = ori === \"true\" ? true : false;\r\n }\r\n }\r\n }\r\n // the whole parenthesis scope is replaced by 'true' or 'false'\r\n return result ? \"true\" : \"false\";\r\n };\r\n AndOrNotEvaluator._SimplifyNegation = function (booleanString) {\r\n booleanString = booleanString.replace(/^[\\s!]+/, function (r) {\r\n // remove whitespaces\r\n r = r.replace(/[\\s]/g, function () { return \"\"; });\r\n return r.length % 2 ? \"!\" : \"\";\r\n });\r\n booleanString = booleanString.trim();\r\n if (booleanString === \"!true\") {\r\n booleanString = \"false\";\r\n }\r\n else if (booleanString === \"!false\") {\r\n booleanString = \"true\";\r\n }\r\n return booleanString;\r\n };\r\n return AndOrNotEvaluator;\r\n}());\r\nexport { AndOrNotEvaluator };\r\n//# sourceMappingURL=andOrNotEvaluator.js.map","import { AndOrNotEvaluator } from \"./andOrNotEvaluator\";\r\n/**\r\n * Class used to store custom tags\r\n */\r\nvar Tags = /** @class */ (function () {\r\n function Tags() {\r\n }\r\n /**\r\n * Adds support for tags on the given object\r\n * @param obj defines the object to use\r\n */\r\n Tags.EnableFor = function (obj) {\r\n obj._tags = obj._tags || {};\r\n obj.hasTags = function () {\r\n return Tags.HasTags(obj);\r\n };\r\n obj.addTags = function (tagsString) {\r\n return Tags.AddTagsTo(obj, tagsString);\r\n };\r\n obj.removeTags = function (tagsString) {\r\n return Tags.RemoveTagsFrom(obj, tagsString);\r\n };\r\n obj.matchesTagsQuery = function (tagsQuery) {\r\n return Tags.MatchesQuery(obj, tagsQuery);\r\n };\r\n };\r\n /**\r\n * Removes tags support\r\n * @param obj defines the object to use\r\n */\r\n Tags.DisableFor = function (obj) {\r\n delete obj._tags;\r\n delete obj.hasTags;\r\n delete obj.addTags;\r\n delete obj.removeTags;\r\n delete obj.matchesTagsQuery;\r\n };\r\n /**\r\n * Gets a boolean indicating if the given object has tags\r\n * @param obj defines the object to use\r\n * @returns a boolean\r\n */\r\n Tags.HasTags = function (obj) {\r\n if (!obj._tags) {\r\n return false;\r\n }\r\n var tags = obj._tags;\r\n for (var i in tags) {\r\n if (tags.hasOwnProperty(i)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets the tags available on a given object\r\n * @param obj defines the object to use\r\n * @param asString defines if the tags must be returned as a string instead of an array of strings\r\n * @returns the tags\r\n */\r\n Tags.GetTags = function (obj, asString) {\r\n if (asString === void 0) { asString = true; }\r\n if (!obj._tags) {\r\n return null;\r\n }\r\n if (asString) {\r\n var tagsArray = [];\r\n for (var tag in obj._tags) {\r\n if (obj._tags.hasOwnProperty(tag) && obj._tags[tag] === true) {\r\n tagsArray.push(tag);\r\n }\r\n }\r\n return tagsArray.join(\" \");\r\n }\r\n else {\r\n return obj._tags;\r\n }\r\n };\r\n /**\r\n * Adds tags to an object\r\n * @param obj defines the object to use\r\n * @param tagsString defines the tag string. The tags 'true' and 'false' are reserved and cannot be used as tags.\r\n * A tag cannot start with '||', '&&', and '!'. It cannot contain whitespaces\r\n */\r\n Tags.AddTagsTo = function (obj, tagsString) {\r\n if (!tagsString) {\r\n return;\r\n }\r\n if (typeof tagsString !== \"string\") {\r\n return;\r\n }\r\n var tags = tagsString.split(\" \");\r\n tags.forEach(function (tag, index, array) {\r\n Tags._AddTagTo(obj, tag);\r\n });\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Tags._AddTagTo = function (obj, tag) {\r\n tag = tag.trim();\r\n if (tag === \"\" || tag === \"true\" || tag === \"false\") {\r\n return;\r\n }\r\n if (tag.match(/[\\s]/) || tag.match(/^([!]|([|]|[&]){2})/)) {\r\n return;\r\n }\r\n Tags.EnableFor(obj);\r\n obj._tags[tag] = true;\r\n };\r\n /**\r\n * Removes specific tags from a specific object\r\n * @param obj defines the object to use\r\n * @param tagsString defines the tags to remove\r\n */\r\n Tags.RemoveTagsFrom = function (obj, tagsString) {\r\n if (!Tags.HasTags(obj)) {\r\n return;\r\n }\r\n var tags = tagsString.split(\" \");\r\n for (var t in tags) {\r\n Tags._RemoveTagFrom(obj, tags[t]);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Tags._RemoveTagFrom = function (obj, tag) {\r\n delete obj._tags[tag];\r\n };\r\n /**\r\n * Defines if tags hosted on an object match a given query\r\n * @param obj defines the object to use\r\n * @param tagsQuery defines the tag query\r\n * @returns a boolean\r\n */\r\n Tags.MatchesQuery = function (obj, tagsQuery) {\r\n if (tagsQuery === undefined) {\r\n return true;\r\n }\r\n if (tagsQuery === \"\") {\r\n return Tags.HasTags(obj);\r\n }\r\n return AndOrNotEvaluator.Eval(tagsQuery, function (r) { return Tags.HasTags(obj) && obj._tags[r]; });\r\n };\r\n return Tags;\r\n}());\r\nexport { Tags };\r\n//# sourceMappingURL=tags.js.map","import { DomManagement } from './domManagement';\r\n/**\r\n * Class used to provide helper for timing\r\n */\r\nvar TimingTools = /** @class */ (function () {\r\n function TimingTools() {\r\n }\r\n /**\r\n * Polyfill for setImmediate\r\n * @param action defines the action to execute after the current execution block\r\n */\r\n TimingTools.SetImmediate = function (action) {\r\n if (DomManagement.IsWindowObjectExist() && window.setImmediate) {\r\n window.setImmediate(action);\r\n }\r\n else {\r\n setTimeout(action, 1);\r\n }\r\n };\r\n return TimingTools;\r\n}());\r\nexport { TimingTools };\r\n//# sourceMappingURL=timingTools.js.map","var PromiseStates;\r\n(function (PromiseStates) {\r\n PromiseStates[PromiseStates[\"Pending\"] = 0] = \"Pending\";\r\n PromiseStates[PromiseStates[\"Fulfilled\"] = 1] = \"Fulfilled\";\r\n PromiseStates[PromiseStates[\"Rejected\"] = 2] = \"Rejected\";\r\n})(PromiseStates || (PromiseStates = {}));\r\nvar FulFillmentAgregator = /** @class */ (function () {\r\n function FulFillmentAgregator() {\r\n this.count = 0;\r\n this.target = 0;\r\n this.results = [];\r\n }\r\n return FulFillmentAgregator;\r\n}());\r\nvar InternalPromise = /** @class */ (function () {\r\n function InternalPromise(resolver) {\r\n var _this = this;\r\n this._state = PromiseStates.Pending;\r\n this._children = new Array();\r\n this._rejectWasConsumed = false;\r\n if (!resolver) {\r\n return;\r\n }\r\n try {\r\n resolver(function (value) {\r\n _this._resolve(value);\r\n }, function (reason) {\r\n _this._reject(reason);\r\n });\r\n }\r\n catch (e) {\r\n this._reject(e);\r\n }\r\n }\r\n Object.defineProperty(InternalPromise.prototype, \"_result\", {\r\n get: function () {\r\n return this._resultValue;\r\n },\r\n set: function (value) {\r\n this._resultValue = value;\r\n if (this._parent && this._parent._result === undefined) {\r\n this._parent._result = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n InternalPromise.prototype.catch = function (onRejected) {\r\n return this.then(undefined, onRejected);\r\n };\r\n InternalPromise.prototype.then = function (onFulfilled, onRejected) {\r\n var _this = this;\r\n var newPromise = new InternalPromise();\r\n newPromise._onFulfilled = onFulfilled;\r\n newPromise._onRejected = onRejected;\r\n // Composition\r\n this._children.push(newPromise);\r\n newPromise._parent = this;\r\n if (this._state !== PromiseStates.Pending) {\r\n setTimeout(function () {\r\n if (_this._state === PromiseStates.Fulfilled || _this._rejectWasConsumed) {\r\n var returnedValue = newPromise._resolve(_this._result);\r\n if (returnedValue !== undefined && returnedValue !== null) {\r\n if (returnedValue._state !== undefined) {\r\n var returnedPromise = returnedValue;\r\n newPromise._children.push(returnedPromise);\r\n returnedPromise._parent = newPromise;\r\n newPromise = returnedPromise;\r\n }\r\n else {\r\n newPromise._result = returnedValue;\r\n }\r\n }\r\n }\r\n else {\r\n newPromise._reject(_this._reason);\r\n }\r\n });\r\n }\r\n return newPromise;\r\n };\r\n InternalPromise.prototype._moveChildren = function (children) {\r\n var _a;\r\n var _this = this;\r\n (_a = this._children).push.apply(_a, children.splice(0, children.length));\r\n this._children.forEach(function (child) {\r\n child._parent = _this;\r\n });\r\n if (this._state === PromiseStates.Fulfilled) {\r\n for (var _i = 0, _b = this._children; _i < _b.length; _i++) {\r\n var child = _b[_i];\r\n child._resolve(this._result);\r\n }\r\n }\r\n else if (this._state === PromiseStates.Rejected) {\r\n for (var _c = 0, _d = this._children; _c < _d.length; _c++) {\r\n var child = _d[_c];\r\n child._reject(this._reason);\r\n }\r\n }\r\n };\r\n InternalPromise.prototype._resolve = function (value) {\r\n try {\r\n this._state = PromiseStates.Fulfilled;\r\n var returnedValue = null;\r\n if (this._onFulfilled) {\r\n returnedValue = this._onFulfilled(value);\r\n }\r\n if (returnedValue !== undefined && returnedValue !== null) {\r\n if (returnedValue._state !== undefined) {\r\n // Transmit children\r\n var returnedPromise = returnedValue;\r\n returnedPromise._parent = this;\r\n returnedPromise._moveChildren(this._children);\r\n value = returnedPromise._result;\r\n }\r\n else {\r\n value = returnedValue;\r\n }\r\n }\r\n this._result = value;\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._resolve(value);\r\n }\r\n this._children.length = 0;\r\n delete this._onFulfilled;\r\n delete this._onRejected;\r\n }\r\n catch (e) {\r\n this._reject(e, true);\r\n }\r\n };\r\n InternalPromise.prototype._reject = function (reason, onLocalThrow) {\r\n if (onLocalThrow === void 0) { onLocalThrow = false; }\r\n this._state = PromiseStates.Rejected;\r\n this._reason = reason;\r\n if (this._onRejected && !onLocalThrow) {\r\n try {\r\n this._onRejected(reason);\r\n this._rejectWasConsumed = true;\r\n }\r\n catch (e) {\r\n reason = e;\r\n }\r\n }\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (this._rejectWasConsumed) {\r\n child._resolve(null);\r\n }\r\n else {\r\n child._reject(reason);\r\n }\r\n }\r\n this._children.length = 0;\r\n delete this._onFulfilled;\r\n delete this._onRejected;\r\n };\r\n InternalPromise.resolve = function (value) {\r\n var newPromise = new InternalPromise();\r\n newPromise._resolve(value);\r\n return newPromise;\r\n };\r\n InternalPromise._RegisterForFulfillment = function (promise, agregator, index) {\r\n promise.then(function (value) {\r\n agregator.results[index] = value;\r\n agregator.count++;\r\n if (agregator.count === agregator.target) {\r\n agregator.rootPromise._resolve(agregator.results);\r\n }\r\n return null;\r\n }, function (reason) {\r\n if (agregator.rootPromise._state !== PromiseStates.Rejected) {\r\n agregator.rootPromise._reject(reason);\r\n }\r\n });\r\n };\r\n InternalPromise.all = function (promises) {\r\n var newPromise = new InternalPromise();\r\n var agregator = new FulFillmentAgregator();\r\n agregator.target = promises.length;\r\n agregator.rootPromise = newPromise;\r\n if (promises.length) {\r\n for (var index = 0; index < promises.length; index++) {\r\n InternalPromise._RegisterForFulfillment(promises[index], agregator, index);\r\n }\r\n }\r\n else {\r\n newPromise._resolve([]);\r\n }\r\n return newPromise;\r\n };\r\n InternalPromise.race = function (promises) {\r\n var newPromise = new InternalPromise();\r\n if (promises.length) {\r\n for (var _i = 0, promises_1 = promises; _i < promises_1.length; _i++) {\r\n var promise = promises_1[_i];\r\n promise.then(function (value) {\r\n if (newPromise) {\r\n newPromise._resolve(value);\r\n newPromise = null;\r\n }\r\n return null;\r\n }, function (reason) {\r\n if (newPromise) {\r\n newPromise._reject(reason);\r\n newPromise = null;\r\n }\r\n });\r\n }\r\n }\r\n return newPromise;\r\n };\r\n return InternalPromise;\r\n}());\r\n/**\r\n * Helper class that provides a small promise polyfill\r\n */\r\nvar PromisePolyfill = /** @class */ (function () {\r\n function PromisePolyfill() {\r\n }\r\n /**\r\n * Static function used to check if the polyfill is required\r\n * If this is the case then the function will inject the polyfill to window.Promise\r\n * @param force defines a boolean used to force the injection (mostly for testing purposes)\r\n */\r\n PromisePolyfill.Apply = function (force) {\r\n if (force === void 0) { force = false; }\r\n if (force || typeof Promise === 'undefined') {\r\n var root = window;\r\n root.Promise = InternalPromise;\r\n }\r\n };\r\n return PromisePolyfill;\r\n}());\r\nexport { PromisePolyfill };\r\n//# sourceMappingURL=promise.js.map","import { Observable } from \"./observable\";\r\nimport { DomManagement } from \"./domManagement\";\r\nimport { Logger } from \"./logger\";\r\nimport { DeepCopier } from \"./deepCopier\";\r\nimport { PrecisionDate } from \"./precisionDate\";\r\nimport { _DevTools } from \"./devTools\";\r\nimport { WebRequest } from \"./webRequest\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { FileTools } from \"./fileTools\";\r\nimport { PromisePolyfill } from \"./promise\";\r\nimport { TimingTools } from \"./timingTools\";\r\nimport { InstantiationTools } from \"./instantiationTools\";\r\nimport { GUID } from \"./guid\";\r\n/**\r\n * Class containing a set of static utilities functions\r\n */\r\nvar Tools = /** @class */ (function () {\r\n function Tools() {\r\n }\r\n Object.defineProperty(Tools, \"BaseUrl\", {\r\n /**\r\n * Gets or sets the base URL to use to load assets\r\n */\r\n get: function () {\r\n return FileTools.BaseUrl;\r\n },\r\n set: function (value) {\r\n FileTools.BaseUrl = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"DefaultRetryStrategy\", {\r\n /**\r\n * Gets or sets the retry strategy to apply when an error happens while loading an asset\r\n */\r\n get: function () {\r\n return FileTools.DefaultRetryStrategy;\r\n },\r\n set: function (strategy) {\r\n FileTools.DefaultRetryStrategy = strategy;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"CorsBehavior\", {\r\n /**\r\n * Default behaviour for cors in the application.\r\n * It can be a string if the expected behavior is identical in the entire app.\r\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\r\n */\r\n get: function () {\r\n return FileTools.CorsBehavior;\r\n },\r\n set: function (value) {\r\n FileTools.CorsBehavior = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"UseFallbackTexture\", {\r\n /**\r\n * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return EngineStore.UseFallbackTexture;\r\n },\r\n set: function (value) {\r\n EngineStore.UseFallbackTexture = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"RegisteredExternalClasses\", {\r\n /**\r\n * Use this object to register external classes like custom textures or material\r\n * to allow the laoders to instantiate them\r\n */\r\n get: function () {\r\n return InstantiationTools.RegisteredExternalClasses;\r\n },\r\n set: function (classes) {\r\n InstantiationTools.RegisteredExternalClasses = classes;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"fallbackTexture\", {\r\n /**\r\n * Texture content used if a texture cannot loaded\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return EngineStore.FallbackTexture;\r\n },\r\n set: function (value) {\r\n EngineStore.FallbackTexture = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Read the content of a byte array at a specified coordinates (taking in account wrapping)\r\n * @param u defines the coordinate on X axis\r\n * @param v defines the coordinate on Y axis\r\n * @param width defines the width of the source data\r\n * @param height defines the height of the source data\r\n * @param pixels defines the source byte array\r\n * @param color defines the output color\r\n */\r\n Tools.FetchToRef = function (u, v, width, height, pixels, color) {\r\n var wrappedU = (Math.abs(u) * width) % width | 0;\r\n var wrappedV = (Math.abs(v) * height) % height | 0;\r\n var position = (wrappedU + wrappedV * width) * 4;\r\n color.r = pixels[position] / 255;\r\n color.g = pixels[position + 1] / 255;\r\n color.b = pixels[position + 2] / 255;\r\n color.a = pixels[position + 3] / 255;\r\n };\r\n /**\r\n * Interpolates between a and b via alpha\r\n * @param a The lower value (returned when alpha = 0)\r\n * @param b The upper value (returned when alpha = 1)\r\n * @param alpha The interpolation-factor\r\n * @return The mixed value\r\n */\r\n Tools.Mix = function (a, b, alpha) {\r\n return a * (1 - alpha) + b * alpha;\r\n };\r\n /**\r\n * Tries to instantiate a new object from a given class name\r\n * @param className defines the class name to instantiate\r\n * @returns the new object or null if the system was not able to do the instantiation\r\n */\r\n Tools.Instantiate = function (className) {\r\n return InstantiationTools.Instantiate(className);\r\n };\r\n /**\r\n * Provides a slice function that will work even on IE\r\n * @param data defines the array to slice\r\n * @param start defines the start of the data (optional)\r\n * @param end defines the end of the data (optional)\r\n * @returns the new sliced array\r\n */\r\n Tools.Slice = function (data, start, end) {\r\n if (data.slice) {\r\n return data.slice(start, end);\r\n }\r\n return Array.prototype.slice.call(data, start, end);\r\n };\r\n /**\r\n * Provides a slice function that will work even on IE\r\n * The difference between this and Slice is that this will force-convert to array\r\n * @param data defines the array to slice\r\n * @param start defines the start of the data (optional)\r\n * @param end defines the end of the data (optional)\r\n * @returns the new sliced array\r\n */\r\n Tools.SliceToArray = function (data, start, end) {\r\n if (Array.isArray(data)) {\r\n return data.slice(start, end);\r\n }\r\n return Array.prototype.slice.call(data, start, end);\r\n };\r\n /**\r\n * Polyfill for setImmediate\r\n * @param action defines the action to execute after the current execution block\r\n */\r\n Tools.SetImmediate = function (action) {\r\n TimingTools.SetImmediate(action);\r\n };\r\n /**\r\n * Function indicating if a number is an exponent of 2\r\n * @param value defines the value to test\r\n * @returns true if the value is an exponent of 2\r\n */\r\n Tools.IsExponentOfTwo = function (value) {\r\n var count = 1;\r\n do {\r\n count *= 2;\r\n } while (count < value);\r\n return count === value;\r\n };\r\n /**\r\n * Returns the nearest 32-bit single precision float representation of a Number\r\n * @param value A Number. If the parameter is of a different type, it will get converted\r\n * to a number or to NaN if it cannot be converted\r\n * @returns number\r\n */\r\n Tools.FloatRound = function (value) {\r\n if (Math.fround) {\r\n return Math.fround(value);\r\n }\r\n return (Tools._tmpFloatArray[0] = value);\r\n };\r\n /**\r\n * Extracts the filename from a path\r\n * @param path defines the path to use\r\n * @returns the filename\r\n */\r\n Tools.GetFilename = function (path) {\r\n var index = path.lastIndexOf(\"/\");\r\n if (index < 0) {\r\n return path;\r\n }\r\n return path.substring(index + 1);\r\n };\r\n /**\r\n * Extracts the \"folder\" part of a path (everything before the filename).\r\n * @param uri The URI to extract the info from\r\n * @param returnUnchangedIfNoSlash Do not touch the URI if no slashes are present\r\n * @returns The \"folder\" part of the path\r\n */\r\n Tools.GetFolderPath = function (uri, returnUnchangedIfNoSlash) {\r\n if (returnUnchangedIfNoSlash === void 0) { returnUnchangedIfNoSlash = false; }\r\n var index = uri.lastIndexOf(\"/\");\r\n if (index < 0) {\r\n if (returnUnchangedIfNoSlash) {\r\n return uri;\r\n }\r\n return \"\";\r\n }\r\n return uri.substring(0, index + 1);\r\n };\r\n /**\r\n * Convert an angle in radians to degrees\r\n * @param angle defines the angle to convert\r\n * @returns the angle in degrees\r\n */\r\n Tools.ToDegrees = function (angle) {\r\n return (angle * 180) / Math.PI;\r\n };\r\n /**\r\n * Convert an angle in degrees to radians\r\n * @param angle defines the angle to convert\r\n * @returns the angle in radians\r\n */\r\n Tools.ToRadians = function (angle) {\r\n return (angle * Math.PI) / 180;\r\n };\r\n /**\r\n * Returns an array if obj is not an array\r\n * @param obj defines the object to evaluate as an array\r\n * @param allowsNullUndefined defines a boolean indicating if obj is allowed to be null or undefined\r\n * @returns either obj directly if obj is an array or a new array containing obj\r\n */\r\n Tools.MakeArray = function (obj, allowsNullUndefined) {\r\n if (allowsNullUndefined !== true && (obj === undefined || obj == null)) {\r\n return null;\r\n }\r\n return Array.isArray(obj) ? obj : [obj];\r\n };\r\n /**\r\n * Gets the pointer prefix to use\r\n * @param engine defines the engine we are finding the prefix for\r\n * @returns \"pointer\" if touch is enabled. Else returns \"mouse\"\r\n */\r\n Tools.GetPointerPrefix = function (engine) {\r\n var eventPrefix = \"pointer\";\r\n // Check if pointer events are supported\r\n if (DomManagement.IsWindowObjectExist() && !window.PointerEvent && DomManagement.IsNavigatorAvailable() && !navigator.pointerEnabled) {\r\n eventPrefix = \"mouse\";\r\n }\r\n // Special Fallback MacOS Safari...\r\n if (engine._badDesktopOS &&\r\n !engine._badOS &&\r\n // And not ipad pros who claim to be macs...\r\n !(document && \"ontouchend\" in document)) {\r\n eventPrefix = \"mouse\";\r\n }\r\n return eventPrefix;\r\n };\r\n /**\r\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\r\n * @param url define the url we are trying\r\n * @param element define the dom element where to configure the cors policy\r\n */\r\n Tools.SetCorsBehavior = function (url, element) {\r\n FileTools.SetCorsBehavior(url, element);\r\n };\r\n // External files\r\n /**\r\n * Removes unwanted characters from an url\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\n Tools.CleanUrl = function (url) {\r\n url = url.replace(/#/gm, \"%23\");\r\n return url;\r\n };\r\n Object.defineProperty(Tools, \"PreprocessUrl\", {\r\n /**\r\n * Gets or sets a function used to pre-process url before using them to load assets\r\n */\r\n get: function () {\r\n return FileTools.PreprocessUrl;\r\n },\r\n set: function (processor) {\r\n FileTools.PreprocessUrl = processor;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @param mimeType optional mime type\r\n * @returns the HTMLImageElement of the loaded image\r\n */\r\n Tools.LoadImage = function (input, onLoad, onError, offlineProvider, mimeType) {\r\n return FileTools.LoadImage(input, onLoad, onError, offlineProvider, mimeType);\r\n };\r\n /**\r\n * Loads a file from a url\r\n * @param url url string, ArrayBuffer, or Blob to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n */\r\n Tools.LoadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n return FileTools.LoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\r\n };\r\n /**\r\n * Loads a file from a url\r\n * @param url the file url to load\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @returns a promise containing an ArrayBuffer corresponding to the loaded file\r\n */\r\n Tools.LoadFileAsync = function (url, useArrayBuffer) {\r\n if (useArrayBuffer === void 0) { useArrayBuffer = true; }\r\n return new Promise(function (resolve, reject) {\r\n FileTools.LoadFile(url, function (data) {\r\n resolve(data);\r\n }, undefined, undefined, useArrayBuffer, function (request, exception) {\r\n reject(exception);\r\n });\r\n });\r\n };\r\n /**\r\n * Load a script (identified by an url). When the url returns, the\r\n * content of this file is added into a new script element, attached to the DOM (body element)\r\n * @param scriptUrl defines the url of the script to laod\r\n * @param onSuccess defines the callback called when the script is loaded\r\n * @param onError defines the callback to call if an error occurs\r\n * @param scriptId defines the id of the script element\r\n */\r\n Tools.LoadScript = function (scriptUrl, onSuccess, onError, scriptId) {\r\n if (!DomManagement.IsWindowObjectExist()) {\r\n return;\r\n }\r\n var head = document.getElementsByTagName(\"head\")[0];\r\n var script = document.createElement(\"script\");\r\n script.setAttribute(\"type\", \"text/javascript\");\r\n script.setAttribute(\"src\", scriptUrl);\r\n if (scriptId) {\r\n script.id = scriptId;\r\n }\r\n script.onload = function () {\r\n if (onSuccess) {\r\n onSuccess();\r\n }\r\n };\r\n script.onerror = function (e) {\r\n if (onError) {\r\n onError(\"Unable to load script '\" + scriptUrl + \"'\", e);\r\n }\r\n };\r\n head.appendChild(script);\r\n };\r\n /**\r\n * Load an asynchronous script (identified by an url). When the url returns, the\r\n * content of this file is added into a new script element, attached to the DOM (body element)\r\n * @param scriptUrl defines the url of the script to laod\r\n * @param scriptId defines the id of the script element\r\n * @returns a promise request object\r\n */\r\n Tools.LoadScriptAsync = function (scriptUrl, scriptId) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this.LoadScript(scriptUrl, function () {\r\n resolve();\r\n }, function (message, exception) {\r\n reject(exception);\r\n });\r\n });\r\n };\r\n /**\r\n * Loads a file from a blob\r\n * @param fileToLoad defines the blob to use\r\n * @param callback defines the callback to call when data is loaded\r\n * @param progressCallback defines the callback to call during loading process\r\n * @returns a file request object\r\n */\r\n Tools.ReadFileAsDataURL = function (fileToLoad, callback, progressCallback) {\r\n var reader = new FileReader();\r\n var request = {\r\n onCompleteObservable: new Observable(),\r\n abort: function () { return reader.abort(); },\r\n };\r\n reader.onloadend = function (e) {\r\n request.onCompleteObservable.notifyObservers(request);\r\n };\r\n reader.onload = function (e) {\r\n //target doesn't have result from ts 1.3\r\n callback(e.target[\"result\"]);\r\n };\r\n reader.onprogress = progressCallback;\r\n reader.readAsDataURL(fileToLoad);\r\n return request;\r\n };\r\n /**\r\n * Reads a file from a File object\r\n * @param file defines the file to load\r\n * @param onSuccess defines the callback to call when data is loaded\r\n * @param onProgress defines the callback to call during loading process\r\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\r\n * @param onError defines the callback to call when an error occurs\r\n * @returns a file request object\r\n */\r\n Tools.ReadFile = function (file, onSuccess, onProgress, useArrayBuffer, onError) {\r\n return FileTools.ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError);\r\n };\r\n /**\r\n * Creates a data url from a given string content\r\n * @param content defines the content to convert\r\n * @returns the new data url link\r\n */\r\n Tools.FileAsURL = function (content) {\r\n var fileBlob = new Blob([content]);\r\n var url = window.URL || window.webkitURL;\r\n var link = url.createObjectURL(fileBlob);\r\n return link;\r\n };\r\n /**\r\n * Format the given number to a specific decimal format\r\n * @param value defines the number to format\r\n * @param decimals defines the number of decimals to use\r\n * @returns the formatted string\r\n */\r\n Tools.Format = function (value, decimals) {\r\n if (decimals === void 0) { decimals = 2; }\r\n return value.toFixed(decimals);\r\n };\r\n /**\r\n * Tries to copy an object by duplicating every property\r\n * @param source defines the source object\r\n * @param destination defines the target object\r\n * @param doNotCopyList defines a list of properties to avoid\r\n * @param mustCopyList defines a list of properties to copy (even if they start with _)\r\n */\r\n Tools.DeepCopy = function (source, destination, doNotCopyList, mustCopyList) {\r\n DeepCopier.DeepCopy(source, destination, doNotCopyList, mustCopyList);\r\n };\r\n /**\r\n * Gets a boolean indicating if the given object has no own property\r\n * @param obj defines the object to test\r\n * @returns true if object has no own property\r\n */\r\n Tools.IsEmpty = function (obj) {\r\n for (var i in obj) {\r\n if (obj.hasOwnProperty(i)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Function used to register events at window level\r\n * @param windowElement defines the Window object to use\r\n * @param events defines the events to register\r\n */\r\n Tools.RegisterTopRootEvents = function (windowElement, events) {\r\n for (var index = 0; index < events.length; index++) {\r\n var event = events[index];\r\n windowElement.addEventListener(event.name, event.handler, false);\r\n try {\r\n if (window.parent) {\r\n window.parent.addEventListener(event.name, event.handler, false);\r\n }\r\n }\r\n catch (e) {\r\n // Silently fails...\r\n }\r\n }\r\n };\r\n /**\r\n * Function used to unregister events from window level\r\n * @param windowElement defines the Window object to use\r\n * @param events defines the events to unregister\r\n */\r\n Tools.UnregisterTopRootEvents = function (windowElement, events) {\r\n for (var index = 0; index < events.length; index++) {\r\n var event = events[index];\r\n windowElement.removeEventListener(event.name, event.handler);\r\n try {\r\n if (windowElement.parent) {\r\n windowElement.parent.removeEventListener(event.name, event.handler);\r\n }\r\n }\r\n catch (e) {\r\n // Silently fails...\r\n }\r\n }\r\n };\r\n /**\r\n * Dumps the current bound framebuffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param engine defines the hosting engine\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\r\n */\r\n Tools.DumpFramebuffer = function (width, height, engine, successCallback, mimeType, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n // Read the contents of the framebuffer\r\n var numberOfChannelsByLine = width * 4;\r\n var halfHeight = height / 2;\r\n //Reading datas from WebGL\r\n var data = engine.readPixels(0, 0, width, height);\r\n //To flip image on Y axis.\r\n for (var i = 0; i < halfHeight; i++) {\r\n for (var j = 0; j < numberOfChannelsByLine; j++) {\r\n var currentCell = j + i * numberOfChannelsByLine;\r\n var targetLine = height - i - 1;\r\n var targetCell = j + targetLine * numberOfChannelsByLine;\r\n var temp = data[currentCell];\r\n data[currentCell] = data[targetCell];\r\n data[targetCell] = temp;\r\n }\r\n }\r\n // Create a 2D canvas to store the result\r\n if (!Tools._ScreenshotCanvas) {\r\n Tools._ScreenshotCanvas = document.createElement(\"canvas\");\r\n }\r\n Tools._ScreenshotCanvas.width = width;\r\n Tools._ScreenshotCanvas.height = height;\r\n var context = Tools._ScreenshotCanvas.getContext(\"2d\");\r\n if (context) {\r\n // Copy the pixels to a 2D canvas\r\n var imageData = context.createImageData(width, height);\r\n var castData = imageData.data;\r\n castData.set(data);\r\n context.putImageData(imageData, 0, 0);\r\n Tools.EncodeScreenshotCanvasData(successCallback, mimeType, fileName);\r\n }\r\n };\r\n /**\r\n * Converts the canvas data to blob.\r\n * This acts as a polyfill for browsers not supporting the to blob function.\r\n * @param canvas Defines the canvas to extract the data from\r\n * @param successCallback Defines the callback triggered once the data are available\r\n * @param mimeType Defines the mime type of the result\r\n */\r\n Tools.ToBlob = function (canvas, successCallback, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n // We need HTMLCanvasElement.toBlob for HD screenshots\r\n if (!canvas.toBlob) {\r\n // low performance polyfill based on toDataURL (https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob)\r\n canvas.toBlob = function (callback, type, quality) {\r\n var _this = this;\r\n setTimeout(function () {\r\n var binStr = atob(_this.toDataURL(type, quality).split(\",\")[1]), len = binStr.length, arr = new Uint8Array(len);\r\n for (var i = 0; i < len; i++) {\r\n arr[i] = binStr.charCodeAt(i);\r\n }\r\n callback(new Blob([arr]));\r\n });\r\n };\r\n }\r\n canvas.toBlob(function (blob) {\r\n successCallback(blob);\r\n }, mimeType);\r\n };\r\n /**\r\n * Encodes the canvas data to base 64 or automatically download the result if filename is defined\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines he filename to download. If present, the result will automatically be downloaded\r\n */\r\n Tools.EncodeScreenshotCanvasData = function (successCallback, mimeType, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (successCallback) {\r\n var base64Image = Tools._ScreenshotCanvas.toDataURL(mimeType);\r\n successCallback(base64Image);\r\n }\r\n else {\r\n this.ToBlob(Tools._ScreenshotCanvas, function (blob) {\r\n //Creating a link if the browser have the download attribute on the a tag, to automatically start download generated image.\r\n if (\"download\" in document.createElement(\"a\")) {\r\n if (!fileName) {\r\n var date = new Date();\r\n var stringDate = (date.getFullYear() + \"-\" + (date.getMonth() + 1)).slice(2) + \"-\" + date.getDate() + \"_\" + date.getHours() + \"-\" + (\"0\" + date.getMinutes()).slice(-2);\r\n fileName = \"screenshot_\" + stringDate + \".png\";\r\n }\r\n Tools.Download(blob, fileName);\r\n }\r\n else {\r\n var url = URL.createObjectURL(blob);\r\n var newWindow = window.open(\"\");\r\n if (!newWindow) {\r\n return;\r\n }\r\n var img = newWindow.document.createElement(\"img\");\r\n img.onload = function () {\r\n // no longer need to read the blob so it's revoked\r\n URL.revokeObjectURL(url);\r\n };\r\n img.src = url;\r\n newWindow.document.body.appendChild(img);\r\n }\r\n }, mimeType);\r\n }\r\n };\r\n /**\r\n * Downloads a blob in the browser\r\n * @param blob defines the blob to download\r\n * @param fileName defines the name of the downloaded file\r\n */\r\n Tools.Download = function (blob, fileName) {\r\n if (navigator && navigator.msSaveBlob) {\r\n navigator.msSaveBlob(blob, fileName);\r\n return;\r\n }\r\n var url = window.URL.createObjectURL(blob);\r\n var a = document.createElement(\"a\");\r\n document.body.appendChild(a);\r\n a.style.display = \"none\";\r\n a.href = url;\r\n a.download = fileName;\r\n a.addEventListener(\"click\", function () {\r\n if (a.parentElement) {\r\n a.parentElement.removeChild(a);\r\n }\r\n });\r\n a.click();\r\n window.URL.revokeObjectURL(url);\r\n };\r\n /**\r\n * Will return the right value of the noPreventDefault variable\r\n * Needed to keep backwards compatibility to the old API.\r\n *\r\n * @param args arguments passed to the attachControl function\r\n * @returns the correct value for noPreventDefault\r\n */\r\n Tools.BackCompatCameraNoPreventDefault = function (args) {\r\n // is it used correctly?\r\n if (typeof args[0] === \"boolean\") {\r\n return args[0];\r\n }\r\n else if (typeof args[1] === \"boolean\") {\r\n return args[1];\r\n }\r\n return false;\r\n };\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n */\r\n Tools.CreateScreenshot = function (engine, camera, size, successCallback, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n throw _DevTools.WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n Tools.CreateScreenshotAsync = function (engine, camera, size, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n throw _DevTools.WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n */\r\n Tools.CreateScreenshotUsingRenderTarget = function (engine, camera, size, successCallback, mimeType, samples, antialiasing, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n throw _DevTools.WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n Tools.CreateScreenshotUsingRenderTargetAsync = function (engine, camera, size, mimeType, samples, antialiasing, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n throw _DevTools.WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a pseudo random id\r\n */\r\n Tools.RandomId = function () {\r\n return GUID.RandomId();\r\n };\r\n /**\r\n * Test if the given uri is a base64 string\r\n * @param uri The uri to test\r\n * @return True if the uri is a base64 string or false otherwise\r\n */\r\n Tools.IsBase64 = function (uri) {\r\n return uri.length < 5 ? false : uri.substr(0, 5) === \"data:\";\r\n };\r\n /**\r\n * Decode the given base64 uri.\r\n * @param uri The uri to decode\r\n * @return The decoded base64 data.\r\n */\r\n Tools.DecodeBase64 = function (uri) {\r\n var decodedString = atob(uri.split(\",\")[1]);\r\n var bufferLength = decodedString.length;\r\n var bufferView = new Uint8Array(new ArrayBuffer(bufferLength));\r\n for (var i = 0; i < bufferLength; i++) {\r\n bufferView[i] = decodedString.charCodeAt(i);\r\n }\r\n return bufferView.buffer;\r\n };\r\n /**\r\n * Gets the absolute url.\r\n * @param url the input url\r\n * @return the absolute url\r\n */\r\n Tools.GetAbsoluteUrl = function (url) {\r\n var a = document.createElement(\"a\");\r\n a.href = url;\r\n return a.href;\r\n };\r\n Object.defineProperty(Tools, \"errorsCount\", {\r\n /**\r\n * Gets a value indicating the number of loading errors\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return Logger.errorsCount;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Log a message to the console\r\n * @param message defines the message to log\r\n */\r\n Tools.Log = function (message) {\r\n Logger.Log(message);\r\n };\r\n /**\r\n * Write a warning message to the console\r\n * @param message defines the message to log\r\n */\r\n Tools.Warn = function (message) {\r\n Logger.Warn(message);\r\n };\r\n /**\r\n * Write an error message to the console\r\n * @param message defines the message to log\r\n */\r\n Tools.Error = function (message) {\r\n Logger.Error(message);\r\n };\r\n Object.defineProperty(Tools, \"LogCache\", {\r\n /**\r\n * Gets current log cache (list of logs)\r\n */\r\n get: function () {\r\n return Logger.LogCache;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Clears the log cache\r\n */\r\n Tools.ClearLogCache = function () {\r\n Logger.ClearLogCache();\r\n };\r\n Object.defineProperty(Tools, \"LogLevels\", {\r\n /**\r\n * Sets the current log level (MessageLogLevel / WarningLogLevel / ErrorLogLevel)\r\n */\r\n set: function (level) {\r\n Logger.LogLevels = level;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"PerformanceLogLevel\", {\r\n /**\r\n * Sets the current performance log level\r\n */\r\n set: function (level) {\r\n if ((level & Tools.PerformanceUserMarkLogLevel) === Tools.PerformanceUserMarkLogLevel) {\r\n Tools.StartPerformanceCounter = Tools._StartUserMark;\r\n Tools.EndPerformanceCounter = Tools._EndUserMark;\r\n return;\r\n }\r\n if ((level & Tools.PerformanceConsoleLogLevel) === Tools.PerformanceConsoleLogLevel) {\r\n Tools.StartPerformanceCounter = Tools._StartPerformanceConsole;\r\n Tools.EndPerformanceCounter = Tools._EndPerformanceConsole;\r\n return;\r\n }\r\n Tools.StartPerformanceCounter = Tools._StartPerformanceCounterDisabled;\r\n Tools.EndPerformanceCounter = Tools._EndPerformanceCounterDisabled;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Tools._StartPerformanceCounterDisabled = function (counterName, condition) { };\r\n Tools._EndPerformanceCounterDisabled = function (counterName, condition) { };\r\n Tools._StartUserMark = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!Tools._performance) {\r\n if (!DomManagement.IsWindowObjectExist()) {\r\n return;\r\n }\r\n Tools._performance = window.performance;\r\n }\r\n if (!condition || !Tools._performance.mark) {\r\n return;\r\n }\r\n Tools._performance.mark(counterName + \"-Begin\");\r\n };\r\n Tools._EndUserMark = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!condition || !Tools._performance.mark) {\r\n return;\r\n }\r\n Tools._performance.mark(counterName + \"-End\");\r\n Tools._performance.measure(counterName, counterName + \"-Begin\", counterName + \"-End\");\r\n };\r\n Tools._StartPerformanceConsole = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!condition) {\r\n return;\r\n }\r\n Tools._StartUserMark(counterName, condition);\r\n if (console.time) {\r\n console.time(counterName);\r\n }\r\n };\r\n Tools._EndPerformanceConsole = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!condition) {\r\n return;\r\n }\r\n Tools._EndUserMark(counterName, condition);\r\n console.timeEnd(counterName);\r\n };\r\n Object.defineProperty(Tools, \"Now\", {\r\n /**\r\n * Gets either window.performance.now() if supported or Date.now() else\r\n */\r\n get: function () {\r\n return PrecisionDate.Now;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * This method will return the name of the class used to create the instance of the given object.\r\n * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.\r\n * @param object the object to get the class name from\r\n * @param isType defines if the object is actually a type\r\n * @returns the name of the class, will be \"object\" for a custom data type not using the @className decorator\r\n */\r\n Tools.GetClassName = function (object, isType) {\r\n if (isType === void 0) { isType = false; }\r\n var name = null;\r\n if (!isType && object.getClassName) {\r\n name = object.getClassName();\r\n }\r\n else {\r\n if (object instanceof Object) {\r\n var classObj = isType ? object : Object.getPrototypeOf(object);\r\n name = classObj.constructor[\"__bjsclassName__\"];\r\n }\r\n if (!name) {\r\n name = typeof object;\r\n }\r\n }\r\n return name;\r\n };\r\n /**\r\n * Gets the first element of an array satisfying a given predicate\r\n * @param array defines the array to browse\r\n * @param predicate defines the predicate to use\r\n * @returns null if not found or the element\r\n */\r\n Tools.First = function (array, predicate) {\r\n for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {\r\n var el = array_1[_i];\r\n if (predicate(el)) {\r\n return el;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * This method will return the name of the full name of the class, including its owning module (if any).\r\n * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator or implementing a method getClassName():string (in which case the module won't be specified).\r\n * @param object the object to get the class name from\r\n * @param isType defines if the object is actually a type\r\n * @return a string that can have two forms: \"moduleName.className\" if module was specified when the class' Name was registered or \"className\" if there was not module specified.\r\n * @ignorenaming\r\n */\r\n Tools.getFullClassName = function (object, isType) {\r\n if (isType === void 0) { isType = false; }\r\n var className = null;\r\n var moduleName = null;\r\n if (!isType && object.getClassName) {\r\n className = object.getClassName();\r\n }\r\n else {\r\n if (object instanceof Object) {\r\n var classObj = isType ? object : Object.getPrototypeOf(object);\r\n className = classObj.constructor[\"__bjsclassName__\"];\r\n moduleName = classObj.constructor[\"__bjsmoduleName__\"];\r\n }\r\n if (!className) {\r\n className = typeof object;\r\n }\r\n }\r\n if (!className) {\r\n return null;\r\n }\r\n return (moduleName != null ? moduleName + \".\" : \"\") + className;\r\n };\r\n /**\r\n * Returns a promise that resolves after the given amount of time.\r\n * @param delay Number of milliseconds to delay\r\n * @returns Promise that resolves after the given amount of time\r\n */\r\n Tools.DelayAsync = function (delay) {\r\n return new Promise(function (resolve) {\r\n setTimeout(function () {\r\n resolve();\r\n }, delay);\r\n });\r\n };\r\n /**\r\n * Utility function to detect if the current user agent is Safari\r\n * @returns whether or not the current user agent is safari\r\n */\r\n Tools.IsSafari = function () {\r\n return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\r\n };\r\n /**\r\n * Enable/Disable Custom HTTP Request Headers globally.\r\n * default = false\r\n * @see CustomRequestHeaders\r\n */\r\n Tools.UseCustomRequestHeaders = false;\r\n /**\r\n * Custom HTTP Request Headers to be sent with XMLHttpRequests\r\n * i.e. when loading files, where the server/service expects an Authorization header\r\n */\r\n Tools.CustomRequestHeaders = WebRequest.CustomRequestHeaders;\r\n Tools._tmpFloatArray = new Float32Array(1);\r\n /**\r\n * Extracts text content from a DOM element hierarchy\r\n * Back Compat only, please use DomManagement.GetDOMTextContent instead.\r\n */\r\n Tools.GetDOMTextContent = DomManagement.GetDOMTextContent;\r\n // Logs\r\n /**\r\n * No log\r\n */\r\n Tools.NoneLogLevel = Logger.NoneLogLevel;\r\n /**\r\n * Only message logs\r\n */\r\n Tools.MessageLogLevel = Logger.MessageLogLevel;\r\n /**\r\n * Only warning logs\r\n */\r\n Tools.WarningLogLevel = Logger.WarningLogLevel;\r\n /**\r\n * Only error logs\r\n */\r\n Tools.ErrorLogLevel = Logger.ErrorLogLevel;\r\n /**\r\n * All logs\r\n */\r\n Tools.AllLogLevel = Logger.AllLogLevel;\r\n /**\r\n * Checks if the window object exists\r\n * Back Compat only, please use DomManagement.IsWindowObjectExist instead.\r\n */\r\n Tools.IsWindowObjectExist = DomManagement.IsWindowObjectExist;\r\n // Performances\r\n /**\r\n * No performance log\r\n */\r\n Tools.PerformanceNoneLogLevel = 0;\r\n /**\r\n * Use user marks to log performance\r\n */\r\n Tools.PerformanceUserMarkLogLevel = 1;\r\n /**\r\n * Log performance to the console\r\n */\r\n Tools.PerformanceConsoleLogLevel = 2;\r\n /**\r\n * Starts a performance counter\r\n */\r\n Tools.StartPerformanceCounter = Tools._StartPerformanceCounterDisabled;\r\n /**\r\n * Ends a specific performance coutner\r\n */\r\n Tools.EndPerformanceCounter = Tools._EndPerformanceCounterDisabled;\r\n return Tools;\r\n}());\r\nexport { Tools };\r\n/**\r\n * Use this className as a decorator on a given class definition to add it a name and optionally its module.\r\n * You can then use the Tools.getClassName(obj) on an instance to retrieve its class name.\r\n * This method is the only way to get it done in all cases, even if the .js file declaring the class is minified\r\n * @param name The name of the class, case should be preserved\r\n * @param module The name of the Module hosting the class, optional, but strongly recommended to specify if possible. Case should be preserved.\r\n */\r\nexport function className(name, module) {\r\n return function (target) {\r\n target[\"__bjsclassName__\"] = name;\r\n target[\"__bjsmoduleName__\"] = module != null ? module : null;\r\n };\r\n}\r\n/**\r\n * An implementation of a loop for asynchronous functions.\r\n */\r\nvar AsyncLoop = /** @class */ (function () {\r\n /**\r\n * Constructor.\r\n * @param iterations the number of iterations.\r\n * @param func the function to run each iteration\r\n * @param successCallback the callback that will be called upon succesful execution\r\n * @param offset starting offset.\r\n */\r\n function AsyncLoop(\r\n /**\r\n * Defines the number of iterations for the loop\r\n */\r\n iterations, func, successCallback, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n this.iterations = iterations;\r\n this.index = offset - 1;\r\n this._done = false;\r\n this._fn = func;\r\n this._successCallback = successCallback;\r\n }\r\n /**\r\n * Execute the next iteration. Must be called after the last iteration was finished.\r\n */\r\n AsyncLoop.prototype.executeNext = function () {\r\n if (!this._done) {\r\n if (this.index + 1 < this.iterations) {\r\n ++this.index;\r\n this._fn(this);\r\n }\r\n else {\r\n this.breakLoop();\r\n }\r\n }\r\n };\r\n /**\r\n * Break the loop and run the success callback.\r\n */\r\n AsyncLoop.prototype.breakLoop = function () {\r\n this._done = true;\r\n this._successCallback();\r\n };\r\n /**\r\n * Create and run an async loop.\r\n * @param iterations the number of iterations.\r\n * @param fn the function to run each iteration\r\n * @param successCallback the callback that will be called upon succesful execution\r\n * @param offset starting offset.\r\n * @returns the created async loop object\r\n */\r\n AsyncLoop.Run = function (iterations, fn, successCallback, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n var loop = new AsyncLoop(iterations, fn, successCallback, offset);\r\n loop.executeNext();\r\n return loop;\r\n };\r\n /**\r\n * A for-loop that will run a given number of iterations synchronous and the rest async.\r\n * @param iterations total number of iterations\r\n * @param syncedIterations number of synchronous iterations in each async iteration.\r\n * @param fn the function to call each iteration.\r\n * @param callback a success call back that will be called when iterating stops.\r\n * @param breakFunction a break condition (optional)\r\n * @param timeout timeout settings for the setTimeout function. default - 0.\r\n * @returns the created async loop object\r\n */\r\n AsyncLoop.SyncAsyncForLoop = function (iterations, syncedIterations, fn, callback, breakFunction, timeout) {\r\n if (timeout === void 0) { timeout = 0; }\r\n return AsyncLoop.Run(Math.ceil(iterations / syncedIterations), function (loop) {\r\n if (breakFunction && breakFunction()) {\r\n loop.breakLoop();\r\n }\r\n else {\r\n setTimeout(function () {\r\n for (var i = 0; i < syncedIterations; ++i) {\r\n var iteration = loop.index * syncedIterations + i;\r\n if (iteration >= iterations) {\r\n break;\r\n }\r\n fn(iteration);\r\n if (breakFunction && breakFunction()) {\r\n loop.breakLoop();\r\n break;\r\n }\r\n }\r\n loop.executeNext();\r\n }, timeout);\r\n }\r\n }, callback);\r\n };\r\n return AsyncLoop;\r\n}());\r\nexport { AsyncLoop };\r\n// Will only be define if Tools is imported freeing up some space when only engine is required\r\nEngineStore.FallbackTexture =\r\n \"data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z\";\r\n// Register promise fallback for IE\r\nPromisePolyfill.Apply();\r\n//# sourceMappingURL=tools.js.map","/** @hidden */\r\nvar _TypeStore = /** @class */ (function () {\r\n function _TypeStore() {\r\n }\r\n /** @hidden */\r\n _TypeStore.GetClass = function (fqdn) {\r\n if (this.RegisteredTypes && this.RegisteredTypes[fqdn]) {\r\n return this.RegisteredTypes[fqdn];\r\n }\r\n return null;\r\n };\r\n /** @hidden */\r\n _TypeStore.RegisteredTypes = {};\r\n return _TypeStore;\r\n}());\r\nexport { _TypeStore };\r\n//# sourceMappingURL=typeStore.js.map","/** @hidden */\r\nfunction createXMLHttpRequest() {\r\n // If running in Babylon Native, then defer to the native XMLHttpRequest, which has the same public contract\r\n if (typeof _native !== 'undefined' && _native.XMLHttpRequest) {\r\n return new _native.XMLHttpRequest();\r\n }\r\n else {\r\n return new XMLHttpRequest();\r\n }\r\n}\r\n/**\r\n * Extended version of XMLHttpRequest with support for customizations (headers, ...)\r\n */\r\nvar WebRequest = /** @class */ (function () {\r\n function WebRequest() {\r\n this._xhr = createXMLHttpRequest();\r\n }\r\n WebRequest.prototype._injectCustomRequestHeaders = function () {\r\n for (var key in WebRequest.CustomRequestHeaders) {\r\n var val = WebRequest.CustomRequestHeaders[key];\r\n if (val) {\r\n this._xhr.setRequestHeader(key, val);\r\n }\r\n }\r\n };\r\n Object.defineProperty(WebRequest.prototype, \"onprogress\", {\r\n /**\r\n * Gets or sets a function to be called when loading progress changes\r\n */\r\n get: function () {\r\n return this._xhr.onprogress;\r\n },\r\n set: function (value) {\r\n this._xhr.onprogress = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"readyState\", {\r\n /**\r\n * Returns client's state\r\n */\r\n get: function () {\r\n return this._xhr.readyState;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"status\", {\r\n /**\r\n * Returns client's status\r\n */\r\n get: function () {\r\n return this._xhr.status;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"statusText\", {\r\n /**\r\n * Returns client's status as a text\r\n */\r\n get: function () {\r\n return this._xhr.statusText;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"response\", {\r\n /**\r\n * Returns client's response\r\n */\r\n get: function () {\r\n return this._xhr.response;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"responseURL\", {\r\n /**\r\n * Returns client's response url\r\n */\r\n get: function () {\r\n return this._xhr.responseURL;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"responseText\", {\r\n /**\r\n * Returns client's response as text\r\n */\r\n get: function () {\r\n return this._xhr.responseText;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"responseType\", {\r\n /**\r\n * Gets or sets the expected response type\r\n */\r\n get: function () {\r\n return this._xhr.responseType;\r\n },\r\n set: function (value) {\r\n this._xhr.responseType = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n WebRequest.prototype.addEventListener = function (type, listener, options) {\r\n this._xhr.addEventListener(type, listener, options);\r\n };\r\n WebRequest.prototype.removeEventListener = function (type, listener, options) {\r\n this._xhr.removeEventListener(type, listener, options);\r\n };\r\n /**\r\n * Cancels any network activity\r\n */\r\n WebRequest.prototype.abort = function () {\r\n this._xhr.abort();\r\n };\r\n /**\r\n * Initiates the request. The optional argument provides the request body. The argument is ignored if request method is GET or HEAD\r\n * @param body defines an optional request body\r\n */\r\n WebRequest.prototype.send = function (body) {\r\n if (WebRequest.CustomRequestHeaders) {\r\n this._injectCustomRequestHeaders();\r\n }\r\n this._xhr.send(body);\r\n };\r\n /**\r\n * Sets the request method, request URL\r\n * @param method defines the method to use (GET, POST, etc..)\r\n * @param url defines the url to connect with\r\n */\r\n WebRequest.prototype.open = function (method, url) {\r\n for (var _i = 0, _a = WebRequest.CustomRequestModifiers; _i < _a.length; _i++) {\r\n var update = _a[_i];\r\n update(this._xhr, url);\r\n }\r\n // Clean url\r\n url = url.replace(\"file:http:\", \"http:\");\r\n url = url.replace(\"file:https:\", \"https:\");\r\n return this._xhr.open(method, url, true);\r\n };\r\n /**\r\n * Sets the value of a request header.\r\n * @param name The name of the header whose value is to be set\r\n * @param value The value to set as the body of the header\r\n */\r\n WebRequest.prototype.setRequestHeader = function (name, value) {\r\n this._xhr.setRequestHeader(name, value);\r\n };\r\n /**\r\n * Get the string containing the text of a particular header's value.\r\n * @param name The name of the header\r\n * @returns The string containing the text of the given header name\r\n */\r\n WebRequest.prototype.getResponseHeader = function (name) {\r\n return this._xhr.getResponseHeader(name);\r\n };\r\n /**\r\n * Custom HTTP Request Headers to be sent with XMLHttpRequests\r\n * i.e. when loading files, where the server/service expects an Authorization header\r\n */\r\n WebRequest.CustomRequestHeaders = {};\r\n /**\r\n * Add callback functions in this array to update all the requests before they get sent to the network\r\n */\r\n WebRequest.CustomRequestModifiers = new Array();\r\n return WebRequest;\r\n}());\r\nexport { WebRequest };\r\n//# sourceMappingURL=webRequest.js.map","import { Effect } from \"../Materials/effect\";\r\nvar name = 'postprocessVertexShader';\r\nvar shader = \"\\nattribute vec2 position;\\nuniform vec2 scale;\\n\\nvarying vec2 vUV;\\nconst vec2 madd=vec2(0.5,0.5);\\nvoid main(void) {\\nvUV=(position*madd+madd)*scale;\\ngl_Position=vec4(position,0.0,1.0);\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var postprocessVertexShader = { name: name, shader: shader };\r\n//# sourceMappingURL=postprocess.vertex.js.map","import { __decorate } from \"tslib\";\r\nimport { SmartArray } from \"../Misc/smartArray\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\nimport \"../Shaders/postprocess.vertex\";\r\nimport { Engine } from '../Engines/engine';\r\nimport \"../Engines/Extensions/engine.renderTarget\";\r\nimport { serialize, serializeAsColor4, SerializationHelper } from '../Misc/decorators';\r\nimport { _TypeStore } from '../Misc/typeStore';\r\n/**\r\n * PostProcess can be used to apply a shader to a texture after it has been rendered\r\n * See https://doc.babylonjs.com/how_to/how_to_use_postprocesses\r\n */\r\nvar PostProcess = /** @class */ (function () {\r\n /**\r\n * Creates a new instance PostProcess\r\n * @param name The name of the PostProcess.\r\n * @param fragmentUrl The url of the fragment shader to be used.\r\n * @param parameters Array of the names of uniform non-sampler2D variables that will be passed to the shader.\r\n * @param samplers Array of the names of uniform sampler2D variables that will be passed to the shader.\r\n * @param options The required width/height ratio to downsize to before computing the render pass. (Use 1.0 for full size)\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param defines String of defines that will be set when running the fragment shader. (default: null)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param vertexUrl The url of the vertex shader to be used. (default: \"postprocess\")\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param blockCompilation If the shader should not be compiled immediatly. (default: false)\r\n * @param textureFormat Format of textures used when performing the post process. (default: TEXTUREFORMAT_RGBA)\r\n */\r\n function PostProcess(name, fragmentUrl, parameters, samplers, options, camera, samplingMode, engine, reusable, defines, textureType, vertexUrl, indexParameters, blockCompilation, textureFormat) {\r\n if (samplingMode === void 0) { samplingMode = 1; }\r\n if (defines === void 0) { defines = null; }\r\n if (textureType === void 0) { textureType = 0; }\r\n if (vertexUrl === void 0) { vertexUrl = \"postprocess\"; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n if (textureFormat === void 0) { textureFormat = 5; }\r\n /**\r\n * Width of the texture to apply the post process on\r\n */\r\n this.width = -1;\r\n /**\r\n * Height of the texture to apply the post process on\r\n */\r\n this.height = -1;\r\n /**\r\n * Gets the node material used to create this postprocess (null if the postprocess was manually created)\r\n */\r\n this.nodeMaterialSource = null;\r\n /**\r\n * Internal, reference to the location where this postprocess was output to. (Typically the texture on the next postprocess in the chain)\r\n * @hidden\r\n */\r\n this._outputTexture = null;\r\n /**\r\n * If the buffer needs to be cleared before applying the post process. (default: true)\r\n * Should be set to false if shader will overwrite all previous pixels.\r\n */\r\n this.autoClear = true;\r\n /**\r\n * Type of alpha mode to use when performing the post process (default: Engine.ALPHA_DISABLE)\r\n */\r\n this.alphaMode = 0;\r\n /**\r\n * Animations to be used for the post processing\r\n */\r\n this.animations = new Array();\r\n /**\r\n * Enable Pixel Perfect mode where texture is not scaled to be power of 2.\r\n * Can only be used on a single postprocess or on the last one of a chain. (default: false)\r\n */\r\n this.enablePixelPerfectMode = false;\r\n /**\r\n * Force the postprocess to be applied without taking in account viewport\r\n */\r\n this.forceFullscreenViewport = true;\r\n /**\r\n * Scale mode for the post process (default: Engine.SCALEMODE_FLOOR)\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 1 | SCALEMODE_FLOOR | [engine.scalemode_floor](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_floor) |\r\n * | 2 | SCALEMODE_NEAREST | [engine.scalemode_nearest](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_nearest) |\r\n * | 3 | SCALEMODE_CEILING | [engine.scalemode_ceiling](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_ceiling) |\r\n *\r\n */\r\n this.scaleMode = 1;\r\n /**\r\n * Force textures to be a power of two (default: false)\r\n */\r\n this.alwaysForcePOT = false;\r\n this._samples = 1;\r\n /**\r\n * Modify the scale of the post process to be the same as the viewport (default: false)\r\n */\r\n this.adaptScaleToCurrentViewport = false;\r\n this._reusable = false;\r\n /**\r\n * Smart array of input and output textures for the post process.\r\n * @hidden\r\n */\r\n this._textures = new SmartArray(2);\r\n /**\r\n * The index in _textures that corresponds to the output texture.\r\n * @hidden\r\n */\r\n this._currentRenderTextureInd = 0;\r\n this._scaleRatio = new Vector2(1, 1);\r\n this._texelSize = Vector2.Zero();\r\n // Events\r\n /**\r\n * An event triggered when the postprocess is activated.\r\n */\r\n this.onActivateObservable = new Observable();\r\n /**\r\n * An event triggered when the postprocess changes its size.\r\n */\r\n this.onSizeChangedObservable = new Observable();\r\n /**\r\n * An event triggered when the postprocess applies its effect.\r\n */\r\n this.onApplyObservable = new Observable();\r\n /**\r\n * An event triggered before rendering the postprocess\r\n */\r\n this.onBeforeRenderObservable = new Observable();\r\n /**\r\n * An event triggered after rendering the postprocess\r\n */\r\n this.onAfterRenderObservable = new Observable();\r\n this.name = name;\r\n if (camera != null) {\r\n this._camera = camera;\r\n this._scene = camera.getScene();\r\n camera.attachPostProcess(this);\r\n this._engine = this._scene.getEngine();\r\n this._scene.postProcesses.push(this);\r\n this.uniqueId = this._scene.getUniqueId();\r\n }\r\n else if (engine) {\r\n this._engine = engine;\r\n this._engine.postProcesses.push(this);\r\n }\r\n this._options = options;\r\n this.renderTargetSamplingMode = samplingMode ? samplingMode : 1;\r\n this._reusable = reusable || false;\r\n this._textureType = textureType;\r\n this._textureFormat = textureFormat;\r\n this._samplers = samplers || [];\r\n this._samplers.push(\"textureSampler\");\r\n this._fragmentUrl = fragmentUrl;\r\n this._vertexUrl = vertexUrl;\r\n this._parameters = parameters || [];\r\n this._parameters.push(\"scale\");\r\n this._indexParameters = indexParameters;\r\n if (!blockCompilation) {\r\n this.updateEffect(defines);\r\n }\r\n }\r\n Object.defineProperty(PostProcess.prototype, \"samples\", {\r\n /**\r\n * Number of sample textures (default: 1)\r\n */\r\n get: function () {\r\n return this._samples;\r\n },\r\n set: function (n) {\r\n var _this = this;\r\n this._samples = Math.min(n, this._engine.getCaps().maxMSAASamples);\r\n this._textures.forEach(function (texture) {\r\n if (texture.samples !== _this._samples) {\r\n _this._engine.updateRenderTargetTextureSampleCount(texture, _this._samples);\r\n }\r\n });\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the fragment url or shader name used in the post process.\r\n * @returns the fragment url or name in the shader store.\r\n */\r\n PostProcess.prototype.getEffectName = function () {\r\n return this._fragmentUrl;\r\n };\r\n Object.defineProperty(PostProcess.prototype, \"onActivate\", {\r\n /**\r\n * A function that is added to the onActivateObservable\r\n */\r\n set: function (callback) {\r\n if (this._onActivateObserver) {\r\n this.onActivateObservable.remove(this._onActivateObserver);\r\n }\r\n if (callback) {\r\n this._onActivateObserver = this.onActivateObservable.add(callback);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onSizeChanged\", {\r\n /**\r\n * A function that is added to the onSizeChangedObservable\r\n */\r\n set: function (callback) {\r\n if (this._onSizeChangedObserver) {\r\n this.onSizeChangedObservable.remove(this._onSizeChangedObserver);\r\n }\r\n this._onSizeChangedObserver = this.onSizeChangedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onApply\", {\r\n /**\r\n * A function that is added to the onApplyObservable\r\n */\r\n set: function (callback) {\r\n if (this._onApplyObserver) {\r\n this.onApplyObservable.remove(this._onApplyObserver);\r\n }\r\n this._onApplyObserver = this.onApplyObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onBeforeRender\", {\r\n /**\r\n * A function that is added to the onBeforeRenderObservable\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onAfterRender\", {\r\n /**\r\n * A function that is added to the onAfterRenderObservable\r\n */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"inputTexture\", {\r\n /**\r\n * The input texture for this post process and the output texture of the previous post process. When added to a pipeline the previous post process will\r\n * render it's output into this texture and this texture will be used as textureSampler in the fragment shader of this post process.\r\n */\r\n get: function () {\r\n return this._textures.data[this._currentRenderTextureInd];\r\n },\r\n set: function (value) {\r\n this._forcedOutputTexture = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Since inputTexture should always be defined, if we previously manually set `inputTexture`,\r\n * the only way to unset it is to use this function to restore its internal state\r\n */\r\n PostProcess.prototype.restoreDefaultInputTexture = function () {\r\n this._forcedOutputTexture = null;\r\n };\r\n /**\r\n * Gets the camera which post process is applied to.\r\n * @returns The camera the post process is applied to.\r\n */\r\n PostProcess.prototype.getCamera = function () {\r\n return this._camera;\r\n };\r\n Object.defineProperty(PostProcess.prototype, \"texelSize\", {\r\n /**\r\n * Gets the texel size of the postprocess.\r\n * See https://en.wikipedia.org/wiki/Texel_(graphics)\r\n */\r\n get: function () {\r\n if (this._shareOutputWithPostProcess) {\r\n return this._shareOutputWithPostProcess.texelSize;\r\n }\r\n if (this._forcedOutputTexture) {\r\n this._texelSize.copyFromFloats(1.0 / this._forcedOutputTexture.width, 1.0 / this._forcedOutputTexture.height);\r\n }\r\n return this._texelSize;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"PostProcess\" string\r\n */\r\n PostProcess.prototype.getClassName = function () {\r\n return \"PostProcess\";\r\n };\r\n /**\r\n * Gets the engine which this post process belongs to.\r\n * @returns The engine the post process was enabled with.\r\n */\r\n PostProcess.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * The effect that is created when initializing the post process.\r\n * @returns The created effect corresponding the the postprocess.\r\n */\r\n PostProcess.prototype.getEffect = function () {\r\n return this._effect;\r\n };\r\n /**\r\n * To avoid multiple redundant textures for multiple post process, the output the output texture for this post process can be shared with another.\r\n * @param postProcess The post process to share the output with.\r\n * @returns This post process.\r\n */\r\n PostProcess.prototype.shareOutputWith = function (postProcess) {\r\n this._disposeTextures();\r\n this._shareOutputWithPostProcess = postProcess;\r\n return this;\r\n };\r\n /**\r\n * Reverses the effect of calling shareOutputWith and returns the post process back to its original state.\r\n * This should be called if the post process that shares output with this post process is disabled/disposed.\r\n */\r\n PostProcess.prototype.useOwnOutput = function () {\r\n if (this._textures.length == 0) {\r\n this._textures = new SmartArray(2);\r\n }\r\n this._shareOutputWithPostProcess = null;\r\n };\r\n /**\r\n * Updates the effect with the current post process compile time values and recompiles the shader.\r\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\r\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\r\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param onCompiled Called when the shader has been compiled.\r\n * @param onError Called if there is an error when compiling a shader.\r\n * @param vertexUrl The url of the vertex shader to be used (default: the one given at construction time)\r\n * @param fragmentUrl The url of the fragment shader to be used (default: the one given at construction time)\r\n */\r\n PostProcess.prototype.updateEffect = function (defines, uniforms, samplers, indexParameters, onCompiled, onError, vertexUrl, fragmentUrl) {\r\n if (defines === void 0) { defines = null; }\r\n if (uniforms === void 0) { uniforms = null; }\r\n if (samplers === void 0) { samplers = null; }\r\n this._effect = this._engine.createEffect({ vertex: vertexUrl !== null && vertexUrl !== void 0 ? vertexUrl : this._vertexUrl, fragment: fragmentUrl !== null && fragmentUrl !== void 0 ? fragmentUrl : this._fragmentUrl }, [\"position\"], uniforms || this._parameters, samplers || this._samplers, defines !== null ? defines : \"\", undefined, onCompiled, onError, indexParameters || this._indexParameters);\r\n };\r\n /**\r\n * The post process is reusable if it can be used multiple times within one frame.\r\n * @returns If the post process is reusable\r\n */\r\n PostProcess.prototype.isReusable = function () {\r\n return this._reusable;\r\n };\r\n /** invalidate frameBuffer to hint the postprocess to create a depth buffer */\r\n PostProcess.prototype.markTextureDirty = function () {\r\n this.width = -1;\r\n };\r\n /**\r\n * Activates the post process by intializing the textures to be used when executed. Notifies onActivateObservable.\r\n * When this post process is used in a pipeline, this is call will bind the input texture of this post process to the output of the previous.\r\n * @param camera The camera that will be used in the post process. This camera will be used when calling onActivateObservable.\r\n * @param sourceTexture The source texture to be inspected to get the width and height if not specified in the post process constructor. (default: null)\r\n * @param forceDepthStencil If true, a depth and stencil buffer will be generated. (default: false)\r\n * @returns The target texture that was bound to be written to.\r\n */\r\n PostProcess.prototype.activate = function (camera, sourceTexture, forceDepthStencil) {\r\n var _this = this;\r\n if (sourceTexture === void 0) { sourceTexture = null; }\r\n camera = camera || this._camera;\r\n var scene = camera.getScene();\r\n var engine = scene.getEngine();\r\n var maxSize = engine.getCaps().maxTextureSize;\r\n var requiredWidth = ((sourceTexture ? sourceTexture.width : this._engine.getRenderWidth(true)) * this._options) | 0;\r\n var requiredHeight = ((sourceTexture ? sourceTexture.height : this._engine.getRenderHeight(true)) * this._options) | 0;\r\n // If rendering to a webvr camera's left or right eye only half the width should be used to avoid resize when rendered to screen\r\n var webVRCamera = camera.parent;\r\n if (webVRCamera && (webVRCamera.leftCamera == camera || webVRCamera.rightCamera == camera)) {\r\n requiredWidth /= 2;\r\n }\r\n var desiredWidth = (this._options.width || requiredWidth);\r\n var desiredHeight = this._options.height || requiredHeight;\r\n var needMipMaps = this.renderTargetSamplingMode !== 7 &&\r\n this.renderTargetSamplingMode !== 1 &&\r\n this.renderTargetSamplingMode !== 2;\r\n if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {\r\n if (this.adaptScaleToCurrentViewport) {\r\n var currentViewport = engine.currentViewport;\r\n if (currentViewport) {\r\n desiredWidth *= currentViewport.width;\r\n desiredHeight *= currentViewport.height;\r\n }\r\n }\r\n if (needMipMaps || this.alwaysForcePOT) {\r\n if (!this._options.width) {\r\n desiredWidth = engine.needPOTTextures ? Engine.GetExponentOfTwo(desiredWidth, maxSize, this.scaleMode) : desiredWidth;\r\n }\r\n if (!this._options.height) {\r\n desiredHeight = engine.needPOTTextures ? Engine.GetExponentOfTwo(desiredHeight, maxSize, this.scaleMode) : desiredHeight;\r\n }\r\n }\r\n if (this.width !== desiredWidth || this.height !== desiredHeight) {\r\n if (this._textures.length > 0) {\r\n for (var i = 0; i < this._textures.length; i++) {\r\n this._engine._releaseTexture(this._textures.data[i]);\r\n }\r\n this._textures.reset();\r\n }\r\n this.width = desiredWidth;\r\n this.height = desiredHeight;\r\n var textureSize = { width: this.width, height: this.height };\r\n var textureOptions = {\r\n generateMipMaps: needMipMaps,\r\n generateDepthBuffer: forceDepthStencil || camera._postProcesses.indexOf(this) === 0,\r\n generateStencilBuffer: (forceDepthStencil || camera._postProcesses.indexOf(this) === 0) && this._engine.isStencilEnable,\r\n samplingMode: this.renderTargetSamplingMode,\r\n type: this._textureType,\r\n format: this._textureFormat\r\n };\r\n this._textures.push(this._engine.createRenderTargetTexture(textureSize, textureOptions));\r\n if (this._reusable) {\r\n this._textures.push(this._engine.createRenderTargetTexture(textureSize, textureOptions));\r\n }\r\n this._texelSize.copyFromFloats(1.0 / this.width, 1.0 / this.height);\r\n this.onSizeChangedObservable.notifyObservers(this);\r\n }\r\n this._textures.forEach(function (texture) {\r\n if (texture.samples !== _this.samples) {\r\n _this._engine.updateRenderTargetTextureSampleCount(texture, _this.samples);\r\n }\r\n });\r\n }\r\n var target;\r\n if (this._shareOutputWithPostProcess) {\r\n target = this._shareOutputWithPostProcess.inputTexture;\r\n }\r\n else if (this._forcedOutputTexture) {\r\n target = this._forcedOutputTexture;\r\n this.width = this._forcedOutputTexture.width;\r\n this.height = this._forcedOutputTexture.height;\r\n }\r\n else {\r\n target = this.inputTexture;\r\n }\r\n // Bind the input of this post process to be used as the output of the previous post process.\r\n if (this.enablePixelPerfectMode) {\r\n this._scaleRatio.copyFromFloats(requiredWidth / desiredWidth, requiredHeight / desiredHeight);\r\n this._engine.bindFramebuffer(target, 0, requiredWidth, requiredHeight, this.forceFullscreenViewport);\r\n }\r\n else {\r\n this._scaleRatio.copyFromFloats(1, 1);\r\n this._engine.bindFramebuffer(target, 0, undefined, undefined, this.forceFullscreenViewport);\r\n }\r\n this.onActivateObservable.notifyObservers(camera);\r\n // Clear\r\n if (this.autoClear && this.alphaMode === 0) {\r\n this._engine.clear(this.clearColor ? this.clearColor : scene.clearColor, scene._allowPostProcessClearColor, true, true);\r\n }\r\n if (this._reusable) {\r\n this._currentRenderTextureInd = (this._currentRenderTextureInd + 1) % 2;\r\n }\r\n return target;\r\n };\r\n Object.defineProperty(PostProcess.prototype, \"isSupported\", {\r\n /**\r\n * If the post process is supported.\r\n */\r\n get: function () {\r\n return this._effect.isSupported;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"aspectRatio\", {\r\n /**\r\n * The aspect ratio of the output texture.\r\n */\r\n get: function () {\r\n if (this._shareOutputWithPostProcess) {\r\n return this._shareOutputWithPostProcess.aspectRatio;\r\n }\r\n if (this._forcedOutputTexture) {\r\n return this._forcedOutputTexture.width / this._forcedOutputTexture.height;\r\n }\r\n return this.width / this.height;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Get a value indicating if the post-process is ready to be used\r\n * @returns true if the post-process is ready (shader is compiled)\r\n */\r\n PostProcess.prototype.isReady = function () {\r\n return this._effect && this._effect.isReady();\r\n };\r\n /**\r\n * Binds all textures and uniforms to the shader, this will be run on every pass.\r\n * @returns the effect corresponding to this post process. Null if not compiled or not ready.\r\n */\r\n PostProcess.prototype.apply = function () {\r\n // Check\r\n if (!this._effect || !this._effect.isReady()) {\r\n return null;\r\n }\r\n // States\r\n this._engine.enableEffect(this._effect);\r\n this._engine.setState(false);\r\n this._engine.setDepthBuffer(false);\r\n this._engine.setDepthWrite(false);\r\n // Alpha\r\n this._engine.setAlphaMode(this.alphaMode);\r\n if (this.alphaConstants) {\r\n this.getEngine().setAlphaConstants(this.alphaConstants.r, this.alphaConstants.g, this.alphaConstants.b, this.alphaConstants.a);\r\n }\r\n // Bind the output texture of the preivous post process as the input to this post process.\r\n var source;\r\n if (this._shareOutputWithPostProcess) {\r\n source = this._shareOutputWithPostProcess.inputTexture;\r\n }\r\n else if (this._forcedOutputTexture) {\r\n source = this._forcedOutputTexture;\r\n }\r\n else {\r\n source = this.inputTexture;\r\n }\r\n this._effect._bindTexture(\"textureSampler\", source);\r\n // Parameters\r\n this._effect.setVector2(\"scale\", this._scaleRatio);\r\n this.onApplyObservable.notifyObservers(this._effect);\r\n return this._effect;\r\n };\r\n PostProcess.prototype._disposeTextures = function () {\r\n if (this._shareOutputWithPostProcess || this._forcedOutputTexture) {\r\n return;\r\n }\r\n if (this._textures.length > 0) {\r\n for (var i = 0; i < this._textures.length; i++) {\r\n this._engine._releaseTexture(this._textures.data[i]);\r\n }\r\n }\r\n this._textures.dispose();\r\n };\r\n /**\r\n * Sets the required values to the prepass renderer.\r\n * @param prePassRenderer defines the prepass renderer to setup.\r\n * @returns true if the pre pass is needed.\r\n */\r\n PostProcess.prototype.setPrePassRenderer = function (prePassRenderer) {\r\n if (this._prePassEffectConfiguration) {\r\n this._prePassEffectConfiguration = prePassRenderer.addEffectConfiguration(this._prePassEffectConfiguration);\r\n this._prePassEffectConfiguration.enabled = true;\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Disposes the post process.\r\n * @param camera The camera to dispose the post process on.\r\n */\r\n PostProcess.prototype.dispose = function (camera) {\r\n camera = camera || this._camera;\r\n this._disposeTextures();\r\n var index;\r\n if (this._scene) {\r\n index = this._scene.postProcesses.indexOf(this);\r\n if (index !== -1) {\r\n this._scene.postProcesses.splice(index, 1);\r\n }\r\n }\r\n index = this._engine.postProcesses.indexOf(this);\r\n if (index !== -1) {\r\n this._engine.postProcesses.splice(index, 1);\r\n }\r\n if (!camera) {\r\n return;\r\n }\r\n camera.detachPostProcess(this);\r\n index = camera._postProcesses.indexOf(this);\r\n if (index === 0 && camera._postProcesses.length > 0) {\r\n var firstPostProcess = this._camera._getFirstPostProcess();\r\n if (firstPostProcess) {\r\n firstPostProcess.markTextureDirty();\r\n }\r\n }\r\n this.onActivateObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onApplyObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n this.onSizeChangedObservable.clear();\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object\r\n * @returns the JSON object\r\n */\r\n PostProcess.prototype.serialize = function () {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.\" + this.getClassName();\r\n serializationObject.cameraId = this.getCamera().id;\r\n serializationObject.reusable = this._reusable;\r\n serializationObject.options = this._options;\r\n serializationObject.textureType = this._textureType;\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a material from parsed material data\r\n * @param parsedPostProcess defines parsed post process data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures\r\n * @returns a new post process\r\n */\r\n PostProcess.Parse = function (parsedPostProcess, scene, rootUrl) {\r\n var postProcessType = _TypeStore.GetClass(parsedPostProcess.customType);\r\n if (!postProcessType || !postProcessType._Parse) {\r\n return null;\r\n }\r\n var camera = scene.getCameraByID(parsedPostProcess.cameraId);\r\n if (!camera) {\r\n return null;\r\n }\r\n return postProcessType._Parse(parsedPostProcess, camera, scene, rootUrl);\r\n };\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"uniqueId\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"name\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"width\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"height\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"renderTargetSamplingMode\", void 0);\r\n __decorate([\r\n serializeAsColor4()\r\n ], PostProcess.prototype, \"clearColor\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"autoClear\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"alphaMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"alphaConstants\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"enablePixelPerfectMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"forceFullscreenViewport\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"scaleMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"alwaysForcePOT\", void 0);\r\n __decorate([\r\n serialize(\"samples\")\r\n ], PostProcess.prototype, \"_samples\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"adaptScaleToCurrentViewport\", void 0);\r\n return PostProcess;\r\n}());\r\nexport { PostProcess };\r\n_TypeStore.RegisteredTypes[\"BABYLON.PostProcess\"] = PostProcess;\r\n//# sourceMappingURL=postProcess.js.map","import { Material } from \"../Materials/material\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\n/**\r\n * PostProcessManager is used to manage one or more post processes or post process pipelines\r\n * See https://doc.babylonjs.com/how_to/how_to_use_postprocesses\r\n */\r\nvar PostProcessManager = /** @class */ (function () {\r\n /**\r\n * Creates a new instance PostProcess\r\n * @param scene The scene that the post process is associated with.\r\n */\r\n function PostProcessManager(scene) {\r\n this._vertexBuffers = {};\r\n this._scene = scene;\r\n }\r\n PostProcessManager.prototype._prepareBuffers = function () {\r\n if (this._vertexBuffers[VertexBuffer.PositionKind]) {\r\n return;\r\n }\r\n // VBO\r\n var vertices = [];\r\n vertices.push(1, 1);\r\n vertices.push(-1, 1);\r\n vertices.push(-1, -1);\r\n vertices.push(1, -1);\r\n this._vertexBuffers[VertexBuffer.PositionKind] = new VertexBuffer(this._scene.getEngine(), vertices, VertexBuffer.PositionKind, false, false, 2);\r\n this._buildIndexBuffer();\r\n };\r\n PostProcessManager.prototype._buildIndexBuffer = function () {\r\n // Indices\r\n var indices = [];\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n this._indexBuffer = this._scene.getEngine().createIndexBuffer(indices);\r\n };\r\n /**\r\n * Rebuilds the vertex buffers of the manager.\r\n * @hidden\r\n */\r\n PostProcessManager.prototype._rebuild = function () {\r\n var vb = this._vertexBuffers[VertexBuffer.PositionKind];\r\n if (!vb) {\r\n return;\r\n }\r\n vb._rebuild();\r\n this._buildIndexBuffer();\r\n };\r\n // Methods\r\n /**\r\n * Prepares a frame to be run through a post process.\r\n * @param sourceTexture The input texture to the post procesess. (default: null)\r\n * @param postProcesses An array of post processes to be run. (default: null)\r\n * @returns True if the post processes were able to be run.\r\n * @hidden\r\n */\r\n PostProcessManager.prototype._prepareFrame = function (sourceTexture, postProcesses) {\r\n if (sourceTexture === void 0) { sourceTexture = null; }\r\n if (postProcesses === void 0) { postProcesses = null; }\r\n var camera = this._scene.activeCamera;\r\n if (!camera) {\r\n return false;\r\n }\r\n postProcesses = postProcesses || camera._postProcesses.filter(function (pp) { return pp != null; });\r\n if (!postProcesses || postProcesses.length === 0 || !this._scene.postProcessesEnabled) {\r\n return false;\r\n }\r\n postProcesses[0].activate(camera, sourceTexture, postProcesses !== null && postProcesses !== undefined);\r\n return true;\r\n };\r\n /**\r\n * Manually render a set of post processes to a texture.\r\n * Please note, the frame buffer won't be unbound after the call in case you have more render to do.\r\n * @param postProcesses An array of post processes to be run.\r\n * @param targetTexture The target texture to render to.\r\n * @param forceFullscreenViewport force gl.viewport to be full screen eg. 0,0,textureWidth,textureHeight\r\n * @param faceIndex defines the face to render to if a cubemap is defined as the target\r\n * @param lodLevel defines which lod of the texture to render to\r\n * @param doNotBindFrambuffer If set to true, assumes that the framebuffer has been bound previously\r\n */\r\n PostProcessManager.prototype.directRender = function (postProcesses, targetTexture, forceFullscreenViewport, faceIndex, lodLevel, doNotBindFrambuffer) {\r\n if (targetTexture === void 0) { targetTexture = null; }\r\n if (forceFullscreenViewport === void 0) { forceFullscreenViewport = false; }\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lodLevel === void 0) { lodLevel = 0; }\r\n if (doNotBindFrambuffer === void 0) { doNotBindFrambuffer = false; }\r\n var engine = this._scene.getEngine();\r\n for (var index = 0; index < postProcesses.length; index++) {\r\n if (index < postProcesses.length - 1) {\r\n postProcesses[index + 1].activate(this._scene.activeCamera, targetTexture);\r\n }\r\n else {\r\n if (targetTexture) {\r\n engine.bindFramebuffer(targetTexture, faceIndex, undefined, undefined, forceFullscreenViewport, lodLevel);\r\n }\r\n else if (!doNotBindFrambuffer) {\r\n engine.restoreDefaultFramebuffer();\r\n }\r\n }\r\n var pp = postProcesses[index];\r\n var effect = pp.apply();\r\n if (effect) {\r\n pp.onBeforeRenderObservable.notifyObservers(effect);\r\n // VBOs\r\n this._prepareBuffers();\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n // Draw order\r\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\r\n pp.onAfterRenderObservable.notifyObservers(effect);\r\n }\r\n }\r\n // Restore depth buffer\r\n engine.setDepthBuffer(true);\r\n engine.setDepthWrite(true);\r\n };\r\n /**\r\n * Finalize the result of the output of the postprocesses.\r\n * @param doNotPresent If true the result will not be displayed to the screen.\r\n * @param targetTexture The target texture to render to.\r\n * @param faceIndex The index of the face to bind the target texture to.\r\n * @param postProcesses The array of post processes to render.\r\n * @param forceFullscreenViewport force gl.viewport to be full screen eg. 0,0,textureWidth,textureHeight (default: false)\r\n * @hidden\r\n */\r\n PostProcessManager.prototype._finalizeFrame = function (doNotPresent, targetTexture, faceIndex, postProcesses, forceFullscreenViewport) {\r\n if (forceFullscreenViewport === void 0) { forceFullscreenViewport = false; }\r\n var camera = this._scene.activeCamera;\r\n if (!camera) {\r\n return;\r\n }\r\n postProcesses = postProcesses || camera._postProcesses.filter(function (pp) { return pp != null; });\r\n if (postProcesses.length === 0 || !this._scene.postProcessesEnabled) {\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n for (var index = 0, len = postProcesses.length; index < len; index++) {\r\n var pp = postProcesses[index];\r\n if (index < len - 1) {\r\n pp._outputTexture = postProcesses[index + 1].activate(camera, targetTexture);\r\n }\r\n else {\r\n if (targetTexture) {\r\n engine.bindFramebuffer(targetTexture, faceIndex, undefined, undefined, forceFullscreenViewport);\r\n pp._outputTexture = targetTexture;\r\n }\r\n else {\r\n engine.restoreDefaultFramebuffer();\r\n pp._outputTexture = null;\r\n }\r\n }\r\n if (doNotPresent) {\r\n break;\r\n }\r\n var effect = pp.apply();\r\n if (effect) {\r\n pp.onBeforeRenderObservable.notifyObservers(effect);\r\n // VBOs\r\n this._prepareBuffers();\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n // Draw order\r\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\r\n pp.onAfterRenderObservable.notifyObservers(effect);\r\n }\r\n }\r\n // Restore states\r\n engine.setDepthBuffer(true);\r\n engine.setDepthWrite(true);\r\n engine.setAlphaMode(0);\r\n };\r\n /**\r\n * Disposes of the post process manager.\r\n */\r\n PostProcessManager.prototype.dispose = function () {\r\n var buffer = this._vertexBuffers[VertexBuffer.PositionKind];\r\n if (buffer) {\r\n buffer.dispose();\r\n this._vertexBuffers[VertexBuffer.PositionKind] = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n };\r\n return PostProcessManager;\r\n}());\r\nexport { PostProcessManager };\r\n//# sourceMappingURL=postProcessManager.js.map","import { SmartArray, SmartArrayNoDuplicate } from \"../Misc/smartArray\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\n/**\r\n * This represents the object necessary to create a rendering group.\r\n * This is exclusively used and created by the rendering manager.\r\n * To modify the behavior, you use the available helpers in your scene or meshes.\r\n * @hidden\r\n */\r\nvar RenderingGroup = /** @class */ (function () {\r\n /**\r\n * Creates a new rendering group.\r\n * @param index The rendering group index\r\n * @param opaqueSortCompareFn The opaque sort comparison function. If null no order is applied\r\n * @param alphaTestSortCompareFn The alpha test sort comparison function. If null no order is applied\r\n * @param transparentSortCompareFn The transparent sort comparison function. If null back to front + alpha index sort is applied\r\n */\r\n function RenderingGroup(index, scene, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this.index = index;\r\n this._opaqueSubMeshes = new SmartArray(256);\r\n this._transparentSubMeshes = new SmartArray(256);\r\n this._alphaTestSubMeshes = new SmartArray(256);\r\n this._depthOnlySubMeshes = new SmartArray(256);\r\n this._particleSystems = new SmartArray(256);\r\n this._spriteManagers = new SmartArray(256);\r\n /** @hidden */\r\n this._edgesRenderers = new SmartArrayNoDuplicate(16);\r\n this._scene = scene;\r\n this.opaqueSortCompareFn = opaqueSortCompareFn;\r\n this.alphaTestSortCompareFn = alphaTestSortCompareFn;\r\n this.transparentSortCompareFn = transparentSortCompareFn;\r\n }\r\n Object.defineProperty(RenderingGroup.prototype, \"opaqueSortCompareFn\", {\r\n /**\r\n * Set the opaque sort comparison function.\r\n * If null the sub meshes will be render in the order they were created\r\n */\r\n set: function (value) {\r\n this._opaqueSortCompareFn = value;\r\n if (value) {\r\n this._renderOpaque = this.renderOpaqueSorted;\r\n }\r\n else {\r\n this._renderOpaque = RenderingGroup.renderUnsorted;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderingGroup.prototype, \"alphaTestSortCompareFn\", {\r\n /**\r\n * Set the alpha test sort comparison function.\r\n * If null the sub meshes will be render in the order they were created\r\n */\r\n set: function (value) {\r\n this._alphaTestSortCompareFn = value;\r\n if (value) {\r\n this._renderAlphaTest = this.renderAlphaTestSorted;\r\n }\r\n else {\r\n this._renderAlphaTest = RenderingGroup.renderUnsorted;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderingGroup.prototype, \"transparentSortCompareFn\", {\r\n /**\r\n * Set the transparent sort comparison function.\r\n * If null the sub meshes will be render in the order they were created\r\n */\r\n set: function (value) {\r\n if (value) {\r\n this._transparentSortCompareFn = value;\r\n }\r\n else {\r\n this._transparentSortCompareFn = RenderingGroup.defaultTransparentSortCompare;\r\n }\r\n this._renderTransparent = this.renderTransparentSorted;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Render all the sub meshes contained in the group.\r\n * @param customRenderFunction Used to override the default render behaviour of the group.\r\n * @returns true if rendered some submeshes.\r\n */\r\n RenderingGroup.prototype.render = function (customRenderFunction, renderSprites, renderParticles, activeMeshes) {\r\n if (customRenderFunction) {\r\n customRenderFunction(this._opaqueSubMeshes, this._alphaTestSubMeshes, this._transparentSubMeshes, this._depthOnlySubMeshes);\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n // Depth only\r\n if (this._depthOnlySubMeshes.length !== 0) {\r\n engine.setColorWrite(false);\r\n this._renderAlphaTest(this._depthOnlySubMeshes);\r\n engine.setColorWrite(true);\r\n }\r\n // Opaque\r\n if (this._opaqueSubMeshes.length !== 0) {\r\n this._renderOpaque(this._opaqueSubMeshes);\r\n }\r\n // Alpha test\r\n if (this._alphaTestSubMeshes.length !== 0) {\r\n this._renderAlphaTest(this._alphaTestSubMeshes);\r\n }\r\n var stencilState = engine.getStencilBuffer();\r\n engine.setStencilBuffer(false);\r\n // Sprites\r\n if (renderSprites) {\r\n this._renderSprites();\r\n }\r\n // Particles\r\n if (renderParticles) {\r\n this._renderParticles(activeMeshes);\r\n }\r\n if (this.onBeforeTransparentRendering) {\r\n this.onBeforeTransparentRendering();\r\n }\r\n // Transparent\r\n if (this._transparentSubMeshes.length !== 0) {\r\n engine.setStencilBuffer(stencilState);\r\n this._renderTransparent(this._transparentSubMeshes);\r\n engine.setAlphaMode(0);\r\n }\r\n // Set back stencil to false in case it changes before the edge renderer.\r\n engine.setStencilBuffer(false);\r\n // Edges\r\n if (this._edgesRenderers.length) {\r\n for (var edgesRendererIndex = 0; edgesRendererIndex < this._edgesRenderers.length; edgesRendererIndex++) {\r\n this._edgesRenderers.data[edgesRendererIndex].render();\r\n }\r\n engine.setAlphaMode(0);\r\n }\r\n // Restore Stencil state.\r\n engine.setStencilBuffer(stencilState);\r\n };\r\n /**\r\n * Renders the opaque submeshes in the order from the opaqueSortCompareFn.\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.prototype.renderOpaqueSorted = function (subMeshes) {\r\n return RenderingGroup.renderSorted(subMeshes, this._opaqueSortCompareFn, this._scene.activeCamera, false);\r\n };\r\n /**\r\n * Renders the opaque submeshes in the order from the alphatestSortCompareFn.\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.prototype.renderAlphaTestSorted = function (subMeshes) {\r\n return RenderingGroup.renderSorted(subMeshes, this._alphaTestSortCompareFn, this._scene.activeCamera, false);\r\n };\r\n /**\r\n * Renders the opaque submeshes in the order from the transparentSortCompareFn.\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.prototype.renderTransparentSorted = function (subMeshes) {\r\n return RenderingGroup.renderSorted(subMeshes, this._transparentSortCompareFn, this._scene.activeCamera, true);\r\n };\r\n /**\r\n * Renders the submeshes in a specified order.\r\n * @param subMeshes The submeshes to sort before render\r\n * @param sortCompareFn The comparison function use to sort\r\n * @param cameraPosition The camera position use to preprocess the submeshes to help sorting\r\n * @param transparent Specifies to activate blending if true\r\n */\r\n RenderingGroup.renderSorted = function (subMeshes, sortCompareFn, camera, transparent) {\r\n var subIndex = 0;\r\n var subMesh;\r\n var cameraPosition = camera ? camera.globalPosition : RenderingGroup._zeroVector;\r\n for (; subIndex < subMeshes.length; subIndex++) {\r\n subMesh = subMeshes.data[subIndex];\r\n subMesh._alphaIndex = subMesh.getMesh().alphaIndex;\r\n subMesh._distanceToCamera = Vector3.Distance(subMesh.getBoundingInfo().boundingSphere.centerWorld, cameraPosition);\r\n }\r\n var sortedArray = subMeshes.data.slice(0, subMeshes.length);\r\n if (sortCompareFn) {\r\n sortedArray.sort(sortCompareFn);\r\n }\r\n for (subIndex = 0; subIndex < sortedArray.length; subIndex++) {\r\n subMesh = sortedArray[subIndex];\r\n if (transparent) {\r\n var material = subMesh.getMaterial();\r\n if (material && material.needDepthPrePass) {\r\n var engine = material.getScene().getEngine();\r\n engine.setColorWrite(false);\r\n engine.setAlphaMode(0);\r\n subMesh.render(false);\r\n engine.setColorWrite(true);\r\n }\r\n }\r\n subMesh.render(transparent);\r\n }\r\n };\r\n /**\r\n * Renders the submeshes in the order they were dispatched (no sort applied).\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.renderUnsorted = function (subMeshes) {\r\n for (var subIndex = 0; subIndex < subMeshes.length; subIndex++) {\r\n var submesh = subMeshes.data[subIndex];\r\n submesh.render(false);\r\n }\r\n };\r\n /**\r\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\r\n * are rendered back to front if in the same alpha index.\r\n *\r\n * @param a The first submesh\r\n * @param b The second submesh\r\n * @returns The result of the comparison\r\n */\r\n RenderingGroup.defaultTransparentSortCompare = function (a, b) {\r\n // Alpha index first\r\n if (a._alphaIndex > b._alphaIndex) {\r\n return 1;\r\n }\r\n if (a._alphaIndex < b._alphaIndex) {\r\n return -1;\r\n }\r\n // Then distance to camera\r\n return RenderingGroup.backToFrontSortCompare(a, b);\r\n };\r\n /**\r\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\r\n * are rendered back to front.\r\n *\r\n * @param a The first submesh\r\n * @param b The second submesh\r\n * @returns The result of the comparison\r\n */\r\n RenderingGroup.backToFrontSortCompare = function (a, b) {\r\n // Then distance to camera\r\n if (a._distanceToCamera < b._distanceToCamera) {\r\n return 1;\r\n }\r\n if (a._distanceToCamera > b._distanceToCamera) {\r\n return -1;\r\n }\r\n return 0;\r\n };\r\n /**\r\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\r\n * are rendered front to back (prevent overdraw).\r\n *\r\n * @param a The first submesh\r\n * @param b The second submesh\r\n * @returns The result of the comparison\r\n */\r\n RenderingGroup.frontToBackSortCompare = function (a, b) {\r\n // Then distance to camera\r\n if (a._distanceToCamera < b._distanceToCamera) {\r\n return -1;\r\n }\r\n if (a._distanceToCamera > b._distanceToCamera) {\r\n return 1;\r\n }\r\n return 0;\r\n };\r\n /**\r\n * Resets the different lists of submeshes to prepare a new frame.\r\n */\r\n RenderingGroup.prototype.prepare = function () {\r\n this._opaqueSubMeshes.reset();\r\n this._transparentSubMeshes.reset();\r\n this._alphaTestSubMeshes.reset();\r\n this._depthOnlySubMeshes.reset();\r\n this._particleSystems.reset();\r\n this._spriteManagers.reset();\r\n this._edgesRenderers.reset();\r\n };\r\n RenderingGroup.prototype.dispose = function () {\r\n this._opaqueSubMeshes.dispose();\r\n this._transparentSubMeshes.dispose();\r\n this._alphaTestSubMeshes.dispose();\r\n this._depthOnlySubMeshes.dispose();\r\n this._particleSystems.dispose();\r\n this._spriteManagers.dispose();\r\n this._edgesRenderers.dispose();\r\n };\r\n /**\r\n * Inserts the submesh in its correct queue depending on its material.\r\n * @param subMesh The submesh to dispatch\r\n * @param [mesh] Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.\r\n * @param [material] Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.\r\n */\r\n RenderingGroup.prototype.dispatch = function (subMesh, mesh, material) {\r\n // Get mesh and materials if not provided\r\n if (mesh === undefined) {\r\n mesh = subMesh.getMesh();\r\n }\r\n if (material === undefined) {\r\n material = subMesh.getMaterial();\r\n }\r\n if (material === null || material === undefined) {\r\n return;\r\n }\r\n if (material.needAlphaBlendingForMesh(mesh)) { // Transparent\r\n this._transparentSubMeshes.push(subMesh);\r\n }\r\n else if (material.needAlphaTesting()) { // Alpha test\r\n if (material.needDepthPrePass) {\r\n this._depthOnlySubMeshes.push(subMesh);\r\n }\r\n this._alphaTestSubMeshes.push(subMesh);\r\n }\r\n else {\r\n if (material.needDepthPrePass) {\r\n this._depthOnlySubMeshes.push(subMesh);\r\n }\r\n this._opaqueSubMeshes.push(subMesh); // Opaque\r\n }\r\n mesh._renderingGroup = this;\r\n if (mesh._edgesRenderer && mesh._edgesRenderer.isEnabled) {\r\n this._edgesRenderers.pushNoDuplicate(mesh._edgesRenderer);\r\n }\r\n };\r\n RenderingGroup.prototype.dispatchSprites = function (spriteManager) {\r\n this._spriteManagers.push(spriteManager);\r\n };\r\n RenderingGroup.prototype.dispatchParticles = function (particleSystem) {\r\n this._particleSystems.push(particleSystem);\r\n };\r\n RenderingGroup.prototype._renderParticles = function (activeMeshes) {\r\n if (this._particleSystems.length === 0) {\r\n return;\r\n }\r\n // Particles\r\n var activeCamera = this._scene.activeCamera;\r\n this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);\r\n for (var particleIndex = 0; particleIndex < this._particleSystems.length; particleIndex++) {\r\n var particleSystem = this._particleSystems.data[particleIndex];\r\n if ((activeCamera && activeCamera.layerMask & particleSystem.layerMask) === 0) {\r\n continue;\r\n }\r\n var emitter = particleSystem.emitter;\r\n if (!emitter.position || !activeMeshes || activeMeshes.indexOf(emitter) !== -1) {\r\n this._scene._activeParticles.addCount(particleSystem.render(), false);\r\n }\r\n }\r\n this._scene.onAfterParticlesRenderingObservable.notifyObservers(this._scene);\r\n };\r\n RenderingGroup.prototype._renderSprites = function () {\r\n if (!this._scene.spritesEnabled || this._spriteManagers.length === 0) {\r\n return;\r\n }\r\n // Sprites\r\n var activeCamera = this._scene.activeCamera;\r\n this._scene.onBeforeSpritesRenderingObservable.notifyObservers(this._scene);\r\n for (var id = 0; id < this._spriteManagers.length; id++) {\r\n var spriteManager = this._spriteManagers.data[id];\r\n if (((activeCamera && activeCamera.layerMask & spriteManager.layerMask) !== 0)) {\r\n spriteManager.render();\r\n }\r\n }\r\n this._scene.onAfterSpritesRenderingObservable.notifyObservers(this._scene);\r\n };\r\n RenderingGroup._zeroVector = Vector3.Zero();\r\n return RenderingGroup;\r\n}());\r\nexport { RenderingGroup };\r\n//# sourceMappingURL=renderingGroup.js.map","import { RenderingGroup } from \"./renderingGroup\";\r\n/**\r\n * This class is used by the onRenderingGroupObservable\r\n */\r\nvar RenderingGroupInfo = /** @class */ (function () {\r\n function RenderingGroupInfo() {\r\n }\r\n return RenderingGroupInfo;\r\n}());\r\nexport { RenderingGroupInfo };\r\n/**\r\n * This is the manager responsible of all the rendering for meshes sprites and particles.\r\n * It is enable to manage the different groups as well as the different necessary sort functions.\r\n * This should not be used directly aside of the few static configurations\r\n */\r\nvar RenderingManager = /** @class */ (function () {\r\n /**\r\n * Instantiates a new rendering group for a particular scene\r\n * @param scene Defines the scene the groups belongs to\r\n */\r\n function RenderingManager(scene) {\r\n /**\r\n * @hidden\r\n */\r\n this._useSceneAutoClearSetup = false;\r\n this._renderingGroups = new Array();\r\n this._autoClearDepthStencil = {};\r\n this._customOpaqueSortCompareFn = {};\r\n this._customAlphaTestSortCompareFn = {};\r\n this._customTransparentSortCompareFn = {};\r\n this._renderingGroupInfo = new RenderingGroupInfo();\r\n this._scene = scene;\r\n for (var i = RenderingManager.MIN_RENDERINGGROUPS; i < RenderingManager.MAX_RENDERINGGROUPS; i++) {\r\n this._autoClearDepthStencil[i] = { autoClear: true, depth: true, stencil: true };\r\n }\r\n }\r\n RenderingManager.prototype._clearDepthStencilBuffer = function (depth, stencil) {\r\n if (depth === void 0) { depth = true; }\r\n if (stencil === void 0) { stencil = true; }\r\n if (this._depthStencilBufferAlreadyCleaned) {\r\n return;\r\n }\r\n this._scene.getEngine().clear(null, false, depth, stencil);\r\n this._depthStencilBufferAlreadyCleaned = true;\r\n };\r\n /**\r\n * Renders the entire managed groups. This is used by the scene or the different rennder targets.\r\n * @hidden\r\n */\r\n RenderingManager.prototype.render = function (customRenderFunction, activeMeshes, renderParticles, renderSprites) {\r\n // Update the observable context (not null as it only goes away on dispose)\r\n var info = this._renderingGroupInfo;\r\n info.scene = this._scene;\r\n info.camera = this._scene.activeCamera;\r\n // Dispatch sprites\r\n if (this._scene.spriteManagers && renderSprites) {\r\n for (var index = 0; index < this._scene.spriteManagers.length; index++) {\r\n var manager = this._scene.spriteManagers[index];\r\n this.dispatchSprites(manager);\r\n }\r\n }\r\n // Render\r\n for (var index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n this._depthStencilBufferAlreadyCleaned = index === RenderingManager.MIN_RENDERINGGROUPS;\r\n var renderingGroup = this._renderingGroups[index];\r\n if (!renderingGroup) {\r\n continue;\r\n }\r\n var renderingGroupMask = Math.pow(2, index);\r\n info.renderingGroupId = index;\r\n // Before Observable\r\n this._scene.onBeforeRenderingGroupObservable.notifyObservers(info, renderingGroupMask);\r\n // Clear depth/stencil if needed\r\n if (RenderingManager.AUTOCLEAR) {\r\n var autoClear = this._useSceneAutoClearSetup ?\r\n this._scene.getAutoClearDepthStencilSetup(index) :\r\n this._autoClearDepthStencil[index];\r\n if (autoClear && autoClear.autoClear) {\r\n this._clearDepthStencilBuffer(autoClear.depth, autoClear.stencil);\r\n }\r\n }\r\n // Render\r\n for (var _i = 0, _a = this._scene._beforeRenderingGroupDrawStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(index);\r\n }\r\n renderingGroup.render(customRenderFunction, renderSprites, renderParticles, activeMeshes);\r\n for (var _b = 0, _c = this._scene._afterRenderingGroupDrawStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action(index);\r\n }\r\n // After Observable\r\n this._scene.onAfterRenderingGroupObservable.notifyObservers(info, renderingGroupMask);\r\n }\r\n };\r\n /**\r\n * Resets the different information of the group to prepare a new frame\r\n * @hidden\r\n */\r\n RenderingManager.prototype.reset = function () {\r\n for (var index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n var renderingGroup = this._renderingGroups[index];\r\n if (renderingGroup) {\r\n renderingGroup.prepare();\r\n }\r\n }\r\n };\r\n /**\r\n * Dispose and release the group and its associated resources.\r\n * @hidden\r\n */\r\n RenderingManager.prototype.dispose = function () {\r\n this.freeRenderingGroups();\r\n this._renderingGroups.length = 0;\r\n this._renderingGroupInfo = null;\r\n };\r\n /**\r\n * Clear the info related to rendering groups preventing retention points during dispose.\r\n */\r\n RenderingManager.prototype.freeRenderingGroups = function () {\r\n for (var index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n var renderingGroup = this._renderingGroups[index];\r\n if (renderingGroup) {\r\n renderingGroup.dispose();\r\n }\r\n }\r\n };\r\n RenderingManager.prototype._prepareRenderingGroup = function (renderingGroupId) {\r\n if (this._renderingGroups[renderingGroupId] === undefined) {\r\n this._renderingGroups[renderingGroupId] = new RenderingGroup(renderingGroupId, this._scene, this._customOpaqueSortCompareFn[renderingGroupId], this._customAlphaTestSortCompareFn[renderingGroupId], this._customTransparentSortCompareFn[renderingGroupId]);\r\n }\r\n };\r\n /**\r\n * Add a sprite manager to the rendering manager in order to render it this frame.\r\n * @param spriteManager Define the sprite manager to render\r\n */\r\n RenderingManager.prototype.dispatchSprites = function (spriteManager) {\r\n var renderingGroupId = spriteManager.renderingGroupId || 0;\r\n this._prepareRenderingGroup(renderingGroupId);\r\n this._renderingGroups[renderingGroupId].dispatchSprites(spriteManager);\r\n };\r\n /**\r\n * Add a particle system to the rendering manager in order to render it this frame.\r\n * @param particleSystem Define the particle system to render\r\n */\r\n RenderingManager.prototype.dispatchParticles = function (particleSystem) {\r\n var renderingGroupId = particleSystem.renderingGroupId || 0;\r\n this._prepareRenderingGroup(renderingGroupId);\r\n this._renderingGroups[renderingGroupId].dispatchParticles(particleSystem);\r\n };\r\n /**\r\n * Add a submesh to the manager in order to render it this frame\r\n * @param subMesh The submesh to dispatch\r\n * @param mesh Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.\r\n * @param material Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.\r\n */\r\n RenderingManager.prototype.dispatch = function (subMesh, mesh, material) {\r\n if (mesh === undefined) {\r\n mesh = subMesh.getMesh();\r\n }\r\n var renderingGroupId = mesh.renderingGroupId || 0;\r\n this._prepareRenderingGroup(renderingGroupId);\r\n this._renderingGroups[renderingGroupId].dispatch(subMesh, mesh, material);\r\n };\r\n /**\r\n * Overrides the default sort function applied in the renderging group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversly depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n RenderingManager.prototype.setRenderingOrder = function (renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this._customOpaqueSortCompareFn[renderingGroupId] = opaqueSortCompareFn;\r\n this._customAlphaTestSortCompareFn[renderingGroupId] = alphaTestSortCompareFn;\r\n this._customTransparentSortCompareFn[renderingGroupId] = transparentSortCompareFn;\r\n if (this._renderingGroups[renderingGroupId]) {\r\n var group = this._renderingGroups[renderingGroupId];\r\n group.opaqueSortCompareFn = this._customOpaqueSortCompareFn[renderingGroupId];\r\n group.alphaTestSortCompareFn = this._customAlphaTestSortCompareFn[renderingGroupId];\r\n group.transparentSortCompareFn = this._customTransparentSortCompareFn[renderingGroupId];\r\n }\r\n };\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n * @param depth Automatically clears depth between groups if true and autoClear is true.\r\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\r\n */\r\n RenderingManager.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil, depth, stencil) {\r\n if (depth === void 0) { depth = true; }\r\n if (stencil === void 0) { stencil = true; }\r\n this._autoClearDepthStencil[renderingGroupId] = {\r\n autoClear: autoClearDepthStencil,\r\n depth: depth,\r\n stencil: stencil\r\n };\r\n };\r\n /**\r\n * Gets the current auto clear configuration for one rendering group of the rendering\r\n * manager.\r\n * @param index the rendering group index to get the information for\r\n * @returns The auto clear setup for the requested rendering group\r\n */\r\n RenderingManager.prototype.getAutoClearDepthStencilSetup = function (index) {\r\n return this._autoClearDepthStencil[index];\r\n };\r\n /**\r\n * The max id used for rendering groups (not included)\r\n */\r\n RenderingManager.MAX_RENDERINGGROUPS = 4;\r\n /**\r\n * The min id used for rendering groups (included)\r\n */\r\n RenderingManager.MIN_RENDERINGGROUPS = 0;\r\n /**\r\n * Used to globally prevent autoclearing scenes.\r\n */\r\n RenderingManager.AUTOCLEAR = true;\r\n return RenderingManager;\r\n}());\r\nexport { RenderingManager };\r\n//# sourceMappingURL=renderingManager.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'bonesDeclaration';\r\nvar shader = \"#if NUM_BONE_INFLUENCERS>0\\n#ifdef BONETEXTURE\\nuniform sampler2D boneSampler;\\nuniform float boneTextureWidth;\\n#else\\nuniform mat4 mBones[BonesPerMesh];\\n#ifdef BONES_VELOCITY_ENABLED\\nuniform mat4 mPreviousBones[BonesPerMesh];\\n#endif\\n#endif\\nattribute vec4 matricesIndices;\\nattribute vec4 matricesWeights;\\n#if NUM_BONE_INFLUENCERS>4\\nattribute vec4 matricesIndicesExtra;\\nattribute vec4 matricesWeightsExtra;\\n#endif\\n#ifdef BONETEXTURE\\n#define inline\\nmat4 readMatrixFromRawSampler(sampler2D smp,float index)\\n{\\nfloat offset=index*4.0;\\nfloat dx=1.0/boneTextureWidth;\\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));\\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));\\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));\\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));\\nreturn mat4(m0,m1,m2,m3);\\n}\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var bonesDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=bonesDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'bonesVertex';\r\nvar shader = \"#if NUM_BONE_INFLUENCERS>0\\nmat4 influence;\\n#ifdef BONETEXTURE\\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\\n#endif\\n#else\\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\\n#endif\\n#endif\\nfinalWorld=finalWorld*influence;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var bonesVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=bonesVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'bumpFragment';\r\nvar shader = \"vec2 uvOffset=vec2(0.0,0.0);\\n#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)\\n#ifdef NORMALXYSCALE\\nfloat normalScale=1.0;\\n#elif defined(BUMP)\\nfloat normalScale=vBumpInfos.y;\\n#else\\nfloat normalScale=1.0;\\n#endif\\n#if defined(TANGENT) && defined(NORMAL)\\nmat3 TBN=vTBN;\\n#elif defined(BUMP)\\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vBumpUV);\\n#else\\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vDetailUV,vec2(1.,1.));\\n#endif\\n#elif defined(ANISOTROPIC)\\n#if defined(TANGENT) && defined(NORMAL)\\nmat3 TBN=vTBN;\\n#else\\nmat3 TBN=cotangent_frame(normalW,vPositionW,vMainUV1,vec2(1.,1.));\\n#endif\\n#endif\\n#ifdef PARALLAX\\nmat3 invTBN=transposeMat3(TBN);\\n#ifdef PARALLAXOCCLUSION\\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\\n#else\\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\\n#endif\\n#endif\\n#ifdef DETAIL\\nvec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);\\nvec2 detailNormalRG=detailColor.wy*2.0-1.0;\\nfloat detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));\\nvec3 detailNormal=vec3(detailNormalRG,detailNormalB);\\n#endif\\n#ifdef BUMP\\n#ifdef OBJECTSPACE_NORMALMAP\\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz*2.0-1.0);\\nnormalW=normalize(mat3(normalMatrix)*normalW);\\n#elif !defined(DETAIL)\\nnormalW=perturbNormal(TBN,vBumpUV+uvOffset);\\n#else\\nvec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0;\\n\\n#if DETAIL_NORMALBLENDMETHOD == 0\\ndetailNormal.xy*=vDetailInfos.z;\\nvec3 blendedNormal=normalize(vec3(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z));\\n#elif DETAIL_NORMALBLENDMETHOD == 1\\ndetailNormal.xy*=vDetailInfos.z;\\nbumpNormal+=vec3(0.0,0.0,1.0);\\ndetailNormal*=vec3(-1.0,-1.0,1.0);\\nvec3 blendedNormal=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal;\\n#endif\\nnormalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y);\\n#endif\\n#elif defined(DETAIL)\\ndetailNormal.xy*=vDetailInfos.z;\\nnormalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var bumpFragment = { name: name, shader: shader };\r\n//# sourceMappingURL=bumpFragment.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'bumpFragmentFunctions';\r\nvar shader = \"#if defined(BUMP)\\n#if BUMPDIRECTUV == 1\\n#define vBumpUV vMainUV1\\n#elif BUMPDIRECTUV == 2\\n#define vBumpUV vMainUV2\\n#else\\nvarying vec2 vBumpUV;\\n#endif\\nuniform sampler2D bumpSampler;\\nvec3 perturbNormal(mat3 cotangentFrame,vec2 uv)\\n{\\nreturn perturbNormal(cotangentFrame,texture2D(bumpSampler,uv).xyz,vBumpInfos.y);\\n}\\n#endif\\n#if defined(DETAIL)\\n#if DETAILDIRECTUV == 1\\n#define vDetailUV vMainUV1\\n#elif DETAILDIRECTUV == 2\\n#define vDetailUV vMainUV2\\n#else\\nvarying vec2 vDetailUV;\\n#endif\\nuniform sampler2D detailSampler;\\n#endif\\n#if defined(BUMP)\\nvec3 perturbNormal(mat3 cotangentFrame,vec3 color)\\n{\\nreturn perturbNormal(cotangentFrame,color,vBumpInfos.y);\\n}\\n\\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\\n{\\nreturn cotangent_frame(normal,p,uv,vTangentSpaceParams);\\n}\\n#endif\\n#if defined(BUMP) && defined(PARALLAX)\\nconst float minSamples=4.;\\nconst float maxSamples=15.;\\nconst int iMaxSamples=15;\\n\\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\\nparallaxLimit*=parallaxScale;\\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\\nfloat stepSize=1.0/numSamples;\\n\\nfloat currRayHeight=1.0;\\nvec2 vCurrOffset=vec2(0,0);\\nvec2 vLastOffset=vec2(0,0);\\nfloat lastSampledHeight=1.0;\\nfloat currSampledHeight=1.0;\\nfor (int i=0; icurrRayHeight)\\n{\\nfloat delta1=currSampledHeight-currRayHeight;\\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\\nfloat ratio=delta1/(delta1+delta2);\\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\\n\\nbreak;\\n}\\nelse\\n{\\ncurrRayHeight-=stepSize;\\nvLastOffset=vCurrOffset;\\nvCurrOffset+=stepSize*vMaxOffset;\\nlastSampledHeight=currSampledHeight;\\n}\\n}\\nreturn vCurrOffset;\\n}\\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\\n{\\n\\nfloat height=texture2D(bumpSampler,vBumpUV).w;\\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\\nreturn -texCoordOffset;\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var bumpFragmentFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=bumpFragmentFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'bumpFragmentMainFunctions';\r\nvar shader = \"#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL)\\n#if defined(TANGENT) && defined(NORMAL)\\nvarying mat3 vTBN;\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\nuniform mat4 normalMatrix;\\n#endif\\nvec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)\\n{\\n#ifdef NORMALXYSCALE\\nnormal=normalize(normal*vec3(scale,scale,1.0));\\n#endif\\nreturn normalize(cotangentFrame*normal);\\n}\\nvec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)\\n{\\nreturn perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);\\n}\\n\\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\\n{\\n\\nuv=gl_FrontFacing ? uv : -uv;\\n\\nvec3 dp1=dFdx(p);\\nvec3 dp2=dFdy(p);\\nvec2 duv1=dFdx(uv);\\nvec2 duv2=dFdy(uv);\\n\\nvec3 dp2perp=cross(dp2,normal);\\nvec3 dp1perp=cross(normal,dp1);\\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\\nvec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;\\n\\ntangent*=tangentSpaceParams.x;\\nbitangent*=tangentSpaceParams.y;\\n\\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(bitangent,bitangent)));\\nreturn mat3(tangent*invmax,bitangent*invmax,normal);\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var bumpFragmentMainFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=bumpFragmentMainFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'bumpVertex';\r\nvar shader = \"#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\\n#if defined(TANGENT) && defined(NORMAL)\\nvec3 tbnNormal=normalize(normalUpdated);\\nvec3 tbnTangent=normalize(tangentUpdated.xyz);\\nvec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;\\nvTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var bumpVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=bumpVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'bumpVertexDeclaration';\r\nvar shader = \"#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\\n#if defined(TANGENT) && defined(NORMAL)\\nvarying mat3 vTBN;\\n#endif\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var bumpVertexDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=bumpVertexDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'clipPlaneFragment';\r\nvar shader = \"#ifdef CLIPPLANE\\nif (fClipDistance>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE2\\nif (fClipDistance2>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE3\\nif (fClipDistance3>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE4\\nif (fClipDistance4>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE5\\nif (fClipDistance5>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE6\\nif (fClipDistance6>0.0)\\n{\\ndiscard;\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var clipPlaneFragment = { name: name, shader: shader };\r\n//# sourceMappingURL=clipPlaneFragment.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'clipPlaneFragmentDeclaration';\r\nvar shader = \"#ifdef CLIPPLANE\\nvarying float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nvarying float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nvarying float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nvarying float fClipDistance4;\\n#endif\\n#ifdef CLIPPLANE5\\nvarying float fClipDistance5;\\n#endif\\n#ifdef CLIPPLANE6\\nvarying float fClipDistance6;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var clipPlaneFragmentDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=clipPlaneFragmentDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'clipPlaneVertex';\r\nvar shader = \"#ifdef CLIPPLANE\\nfClipDistance=dot(worldPos,vClipPlane);\\n#endif\\n#ifdef CLIPPLANE2\\nfClipDistance2=dot(worldPos,vClipPlane2);\\n#endif\\n#ifdef CLIPPLANE3\\nfClipDistance3=dot(worldPos,vClipPlane3);\\n#endif\\n#ifdef CLIPPLANE4\\nfClipDistance4=dot(worldPos,vClipPlane4);\\n#endif\\n#ifdef CLIPPLANE5\\nfClipDistance5=dot(worldPos,vClipPlane5);\\n#endif\\n#ifdef CLIPPLANE6\\nfClipDistance6=dot(worldPos,vClipPlane6);\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var clipPlaneVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=clipPlaneVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'clipPlaneVertexDeclaration';\r\nvar shader = \"#ifdef CLIPPLANE\\nuniform vec4 vClipPlane;\\nvarying float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nuniform vec4 vClipPlane2;\\nvarying float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nuniform vec4 vClipPlane3;\\nvarying float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nuniform vec4 vClipPlane4;\\nvarying float fClipDistance4;\\n#endif\\n#ifdef CLIPPLANE5\\nuniform vec4 vClipPlane5;\\nvarying float fClipDistance5;\\n#endif\\n#ifdef CLIPPLANE6\\nuniform vec4 vClipPlane6;\\nvarying float fClipDistance6;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var clipPlaneVertexDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=clipPlaneVertexDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'depthPrePass';\r\nvar shader = \"#ifdef DEPTHPREPASS\\ngl_FragColor=vec4(0.,0.,0.,1.0);\\nreturn;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var depthPrePass = { name: name, shader: shader };\r\n//# sourceMappingURL=depthPrePass.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'fogFragment';\r\nvar shader = \"#ifdef FOG\\nfloat fog=CalcFogFactor();\\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var fogFragment = { name: name, shader: shader };\r\n//# sourceMappingURL=fogFragment.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'fogFragmentDeclaration';\r\nvar shader = \"#ifdef FOG\\n#define FOGMODE_NONE 0.\\n#define FOGMODE_EXP 1.\\n#define FOGMODE_EXP2 2.\\n#define FOGMODE_LINEAR 3.\\n#define E 2.71828\\nuniform vec4 vFogInfos;\\nuniform vec3 vFogColor;\\nvarying vec3 vFogDistance;\\nfloat CalcFogFactor()\\n{\\nfloat fogCoeff=1.0;\\nfloat fogStart=vFogInfos.y;\\nfloat fogEnd=vFogInfos.z;\\nfloat fogDensity=vFogInfos.w;\\nfloat fogDistance=length(vFogDistance);\\nif (FOGMODE_LINEAR == vFogInfos.x)\\n{\\nfogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);\\n}\\nelse if (FOGMODE_EXP == vFogInfos.x)\\n{\\nfogCoeff=1.0/pow(E,fogDistance*fogDensity);\\n}\\nelse if (FOGMODE_EXP2 == vFogInfos.x)\\n{\\nfogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);\\n}\\nreturn clamp(fogCoeff,0.0,1.0);\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var fogFragmentDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=fogFragmentDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'fogVertex';\r\nvar shader = \"#ifdef FOG\\nvFogDistance=(view*worldPos).xyz;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var fogVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=fogVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'fogVertexDeclaration';\r\nvar shader = \"#ifdef FOG\\nvarying vec3 vFogDistance;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var fogVertexDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=fogVertexDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'helperFunctions';\r\nvar shader = \"const float PI=3.1415926535897932384626433832795;\\nconst float HALF_MIN=5.96046448e-08;\\nconst float LinearEncodePowerApprox=2.2;\\nconst float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;\\nconst vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);\\nconst float Epsilon=0.0000001;\\n#define saturate(x) clamp(x,0.0,1.0)\\n#define absEps(x) abs(x)+Epsilon\\n#define maxEps(x) max(x,Epsilon)\\n#define saturateEps(x) clamp(x,Epsilon,1.0)\\nmat3 transposeMat3(mat3 inMatrix) {\\nvec3 i0=inMatrix[0];\\nvec3 i1=inMatrix[1];\\nvec3 i2=inMatrix[2];\\nmat3 outMatrix=mat3(\\nvec3(i0.x,i1.x,i2.x),\\nvec3(i0.y,i1.y,i2.y),\\nvec3(i0.z,i1.z,i2.z)\\n);\\nreturn outMatrix;\\n}\\n\\nmat3 inverseMat3(mat3 inMatrix) {\\nfloat a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];\\nfloat a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];\\nfloat a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];\\nfloat b01=a22*a11-a12*a21;\\nfloat b11=-a22*a10+a12*a20;\\nfloat b21=a21*a10-a11*a20;\\nfloat det=a00*b01+a01*b11+a02*b21;\\nreturn mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;\\n}\\nfloat toLinearSpace(float color)\\n{\\nreturn pow(color,LinearEncodePowerApprox);\\n}\\nvec3 toLinearSpace(vec3 color)\\n{\\nreturn pow(color,vec3(LinearEncodePowerApprox));\\n}\\nvec4 toLinearSpace(vec4 color)\\n{\\nreturn vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);\\n}\\nvec3 toGammaSpace(vec3 color)\\n{\\nreturn pow(color,vec3(GammaEncodePowerApprox));\\n}\\nvec4 toGammaSpace(vec4 color)\\n{\\nreturn vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);\\n}\\nfloat toGammaSpace(float color)\\n{\\nreturn pow(color,GammaEncodePowerApprox);\\n}\\nfloat square(float value)\\n{\\nreturn value*value;\\n}\\nfloat pow5(float value) {\\nfloat sq=value*value;\\nreturn sq*sq*value;\\n}\\nfloat getLuminance(vec3 color)\\n{\\nreturn clamp(dot(color,LuminanceEncodeApprox),0.,1.);\\n}\\n\\nfloat getRand(vec2 seed) {\\nreturn fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);\\n}\\nfloat dither(vec2 seed,float varianceAmount) {\\nfloat rand=getRand(seed);\\nfloat dither=mix(-varianceAmount/255.0,varianceAmount/255.0,rand);\\nreturn dither;\\n}\\n\\nconst float rgbdMaxRange=255.0;\\nvec4 toRGBD(vec3 color) {\\nfloat maxRGB=maxEps(max(color.r,max(color.g,color.b)));\\nfloat D=max(rgbdMaxRange/maxRGB,1.);\\nD=clamp(floor(D)/255.0,0.,1.);\\n\\nvec3 rgb=color.rgb*D;\\n\\nrgb=toGammaSpace(rgb);\\nreturn vec4(rgb,D);\\n}\\nvec3 fromRGBD(vec4 rgbd) {\\n\\nrgbd.rgb=toLinearSpace(rgbd.rgb);\\n\\nreturn rgbd.rgb/rgbd.a;\\n}\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var helperFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=helperFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'imageProcessingDeclaration';\r\nvar shader = \"#ifdef EXPOSURE\\nuniform float exposureLinear;\\n#endif\\n#ifdef CONTRAST\\nuniform float contrast;\\n#endif\\n#ifdef VIGNETTE\\nuniform vec2 vInverseScreenSize;\\nuniform vec4 vignetteSettings1;\\nuniform vec4 vignetteSettings2;\\n#endif\\n#ifdef COLORCURVES\\nuniform vec4 vCameraColorCurveNegative;\\nuniform vec4 vCameraColorCurveNeutral;\\nuniform vec4 vCameraColorCurvePositive;\\n#endif\\n#ifdef COLORGRADING\\n#ifdef COLORGRADING3D\\nuniform highp sampler3D txColorTransform;\\n#else\\nuniform sampler2D txColorTransform;\\n#endif\\nuniform vec4 colorTransformSettings;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var imageProcessingDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=imageProcessingDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'imageProcessingFunctions';\r\nvar shader = \"#if defined(COLORGRADING) && !defined(COLORGRADING3D)\\n\\n#define inline\\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\\n{\\nfloat sliceSize=2.0*sampler3dSetting.x;\\n#ifdef SAMPLER3DGREENDEPTH\\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\\n#else\\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\\n#endif\\nfloat sliceInteger=floor(sliceContinuous);\\n\\n\\nfloat sliceFraction=sliceContinuous-sliceInteger;\\n#ifdef SAMPLER3DGREENDEPTH\\nvec2 sliceUV=color.rb;\\n#else\\nvec2 sliceUV=color.rg;\\n#endif\\nsliceUV.x*=sliceSize;\\nsliceUV.x+=sliceInteger*sliceSize;\\nsliceUV=saturate(sliceUV);\\nvec4 slice0Color=texture2D(colorTransform,sliceUV);\\nsliceUV.x+=sliceSize;\\nsliceUV=saturate(sliceUV);\\nvec4 slice1Color=texture2D(colorTransform,sliceUV);\\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\\n#ifdef SAMPLER3DBGRMAP\\ncolor.rgb=result.rgb;\\n#else\\ncolor.rgb=result.bgr;\\n#endif\\nreturn color;\\n}\\n#endif\\n#ifdef TONEMAPPING_ACES\\n\\n\\n\\n\\n\\nconst mat3 ACESInputMat=mat3(\\nvec3(0.59719,0.07600,0.02840),\\nvec3(0.35458,0.90834,0.13383),\\nvec3(0.04823,0.01566,0.83777)\\n);\\n\\nconst mat3 ACESOutputMat=mat3(\\nvec3( 1.60475,-0.10208,-0.00327),\\nvec3(-0.53108,1.10813,-0.07276),\\nvec3(-0.07367,-0.00605,1.07602)\\n);\\nvec3 RRTAndODTFit(vec3 v)\\n{\\nvec3 a=v*(v+0.0245786)-0.000090537;\\nvec3 b=v*(0.983729*v+0.4329510)+0.238081;\\nreturn a/b;\\n}\\nvec3 ACESFitted(vec3 color)\\n{\\ncolor=ACESInputMat*color;\\n\\ncolor=RRTAndODTFit(color);\\ncolor=ACESOutputMat*color;\\n\\ncolor=saturate(color);\\nreturn color;\\n}\\n#endif\\nvec4 applyImageProcessing(vec4 result) {\\n#ifdef EXPOSURE\\nresult.rgb*=exposureLinear;\\n#endif\\n#ifdef VIGNETTE\\n\\nvec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;\\nviewportXY=viewportXY*2.0-1.0;\\nvec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);\\nfloat vignetteTerm=dot(vignetteXY1,vignetteXY1);\\nfloat vignette=pow(vignetteTerm,vignetteSettings2.w);\\n\\nvec3 vignetteColor=vignetteSettings2.rgb;\\n#ifdef VIGNETTEBLENDMODEMULTIPLY\\nvec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);\\nresult.rgb*=vignetteColorMultiplier;\\n#endif\\n#ifdef VIGNETTEBLENDMODEOPAQUE\\nresult.rgb=mix(vignetteColor,result.rgb,vignette);\\n#endif\\n#endif\\n#ifdef TONEMAPPING\\n#ifdef TONEMAPPING_ACES\\nresult.rgb=ACESFitted(result.rgb);\\n#else\\nconst float tonemappingCalibration=1.590579;\\nresult.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\\n#endif\\n#endif\\n\\nresult.rgb=toGammaSpace(result.rgb);\\nresult.rgb=saturate(result.rgb);\\n#ifdef CONTRAST\\n\\nvec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);\\nif (contrast<1.0) {\\n\\nresult.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);\\n} else {\\n\\nresult.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);\\n}\\n#endif\\n\\n#ifdef COLORGRADING\\nvec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;\\n#ifdef COLORGRADING3D\\nvec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;\\n#else\\nvec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;\\n#endif\\nresult.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);\\n#endif\\n#ifdef COLORCURVES\\n\\nfloat luma=getLuminance(result.rgb);\\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));\\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\\nresult.rgb*=colorCurve.rgb;\\nresult.rgb=mix(vec3(luma),result.rgb,colorCurve.a);\\n#endif\\nreturn result;\\n}\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var imageProcessingFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=imageProcessingFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'instancesDeclaration';\r\nvar shader = \"#ifdef INSTANCES\\nattribute vec4 world0;\\nattribute vec4 world1;\\nattribute vec4 world2;\\nattribute vec4 world3;\\n#ifdef THIN_INSTANCES\\nuniform mat4 world;\\n#endif\\n#else\\nuniform mat4 world;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var instancesDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=instancesDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'instancesVertex';\r\nvar shader = \"#ifdef INSTANCES\\nmat4 finalWorld=mat4(world0,world1,world2,world3);\\n#ifdef THIN_INSTANCES\\nfinalWorld=world*finalWorld;\\n#endif\\n#else\\nmat4 finalWorld=world;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var instancesVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=instancesVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'lightFragment';\r\nvar shader = \"#ifdef LIGHT{X}\\n#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\\n\\n#else\\n#ifdef PBR\\n\\n#ifdef SPOTLIGHT{X}\\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(POINTLIGHT{X})\\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(HEMILIGHT{X})\\npreInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(DIRLIGHT{X})\\npreInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#endif\\npreInfo.NdotV=NdotV;\\n\\n#ifdef SPOTLIGHT{X}\\n#ifdef LIGHT_FALLOFF_GLTF{X}\\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\\npreInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\\npreInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);\\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\\npreInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);\\n#else\\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\\npreInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\\n#endif\\n#elif defined(POINTLIGHT{X})\\n#ifdef LIGHT_FALLOFF_GLTF{X}\\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\\n#else\\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\\n#endif\\n#else\\npreInfo.attenuation=1.0;\\n#endif\\n\\n\\n#ifdef HEMILIGHT{X}\\npreInfo.roughness=roughness;\\n#else\\npreInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\\n#endif\\n\\n#ifdef HEMILIGHT{X}\\ninfo.diffuse=computeHemisphericDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb,light{X}.vLightGround);\\n#elif defined(SS_TRANSLUCENCY)\\ninfo.diffuse=computeDiffuseAndTransmittedLighting(preInfo,light{X}.vLightDiffuse.rgb,subSurfaceOut.transmittance);\\n#else\\ninfo.diffuse=computeDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb);\\n#endif\\n\\n#ifdef SPECULARTERM\\n#ifdef ANISOTROPIC\\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#else\\ninfo.specular=computeSpecularLighting(preInfo,normalW,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#endif\\n#endif\\n\\n#ifdef SHEEN\\n#ifdef SHEEN_LINKWITHALBEDO\\n\\npreInfo.roughness=sheenOut.sheenIntensity;\\n#else\\n#ifdef HEMILIGHT{X}\\npreInfo.roughness=sheenOut.sheenRoughness;\\n#else\\npreInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\\n#endif\\n#endif\\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#endif\\n\\n#ifdef CLEARCOAT\\n\\n#ifdef HEMILIGHT{X}\\npreInfo.roughness=clearcoatOut.clearCoatRoughness;\\n#else\\npreInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\\n#endif\\ninfo.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,light{X}.vLightDiffuse.rgb);\\n#ifdef CLEARCOAT_TINT\\n\\nabsorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);\\ninfo.diffuse*=absorption;\\n#ifdef SPECULARTERM\\ninfo.specular*=absorption;\\n#endif\\n#endif\\n\\ninfo.diffuse*=info.clearCoat.w;\\n#ifdef SPECULARTERM\\ninfo.specular*=info.clearCoat.w;\\n#endif\\n#ifdef SHEEN\\ninfo.sheen*=info.clearCoat.w;\\n#endif\\n#endif\\n#else\\n#ifdef SPOTLIGHT{X}\\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\\n#elif defined(HEMILIGHT{X})\\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness);\\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\\n#endif\\n#endif\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightSampler{X},textureProjectionMatrix{X});\\n#endif\\n#endif\\n#ifdef SHADOW{X}\\n#ifdef SHADOWCSM{X}\\nfor (int i=0; i=0.) {\\nindex{X}=i;\\nbreak;\\n}\\n}\\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\\nif (index{X}>=0)\\n#endif\\n{\\n#if defined(SHADOWPCF{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nshadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCSS{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#else\\nshadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#endif\\n#else\\nshadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#ifdef SHADOWCSMDEBUG{X}\\nshadowDebug{X}=vec3(shadow)*vCascadeColorsMultiplier{X}[index{X}];\\n#endif\\n#ifndef SHADOWCSMNOBLEND{X}\\nfloat frustumLength=frustumLengths{X}[index{X}];\\nfloat diffRatio=clamp(diff{X}/frustumLength,0.,1.)*cascadeBlendFactor{X};\\nif (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.)\\n{\\nindex{X}+=1;\\nfloat nextShadow=0.;\\n#if defined(SHADOWPCF{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nnextShadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nnextShadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nnextShadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCSS{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nnextShadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nnextShadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#else\\nnextShadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#endif\\n#else\\nnextShadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\nshadow=mix(nextShadow,shadow,diffRatio);\\n#ifdef SHADOWCSMDEBUG{X}\\nshadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio);\\n#endif\\n}\\n#endif\\n}\\n#elif defined(SHADOWCLOSEESM{X})\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithCloseESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWESM{X})\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPOISSON{X})\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithPoissonSamplingCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCF{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCSS{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#else\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.depthValues);\\n#else\\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#endif\\n#ifdef SHADOWONLY\\n#ifndef SHADOWINUSE\\n#define SHADOWINUSE\\n#endif\\nglobalShadow+=shadow;\\nshadowLightCount+=1.0;\\n#endif\\n#else\\nshadow=1.;\\n#endif\\n#ifndef SHADOWONLY\\n#ifdef CUSTOMUSERLIGHTING\\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\\n#ifdef SPECULARTERM\\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\\n#endif\\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\\ndiffuseBase+=lightmapColor.rgb*shadow;\\n#ifdef SPECULARTERM\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\\n#endif\\n#endif\\n#ifdef CLEARCOAT\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\\n#endif\\n#endif\\n#ifdef SHEEN\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nsheenBase+=info.sheen.rgb*shadow;\\n#endif\\n#endif\\n#else\\n#ifdef SHADOWCSMDEBUG{X}\\ndiffuseBase+=info.diffuse*shadowDebug{X};\\n#else\\ndiffuseBase+=info.diffuse*shadow;\\n#endif\\n#ifdef SPECULARTERM\\nspecularBase+=info.specular*shadow;\\n#endif\\n#ifdef CLEARCOAT\\nclearCoatBase+=info.clearCoat.rgb*shadow;\\n#endif\\n#ifdef SHEEN\\nsheenBase+=info.sheen.rgb*shadow;\\n#endif\\n#endif\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var lightFragment = { name: name, shader: shader };\r\n//# sourceMappingURL=lightFragment.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'lightFragmentDeclaration';\r\nvar shader = \"#ifdef LIGHT{X}\\nuniform vec4 vLightData{X};\\nuniform vec4 vLightDiffuse{X};\\n#ifdef SPECULARTERM\\nuniform vec4 vLightSpecular{X};\\n#else\\nvec4 vLightSpecular{X}=vec4(0.);\\n#endif\\n#ifdef SHADOW{X}\\n#ifdef SHADOWCSM{X}\\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float cascadeBlendFactor{X};\\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying vec4 vPositionFromCamera{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DArrayShadow shadowSampler{X};\\nuniform highp sampler2DArray depthSampler{X};\\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float penumbraDarkness{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DArrayShadow shadowSampler{X};\\n#else\\nuniform highp sampler2DArray shadowSampler{X};\\n#endif\\n#ifdef SHADOWCSMDEBUG{X}\\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\\n(\\nvec3 ( 1.5,0.0,0.0 ),\\nvec3 ( 0.0,1.5,0.0 ),\\nvec3 ( 0.0,0.0,5.5 ),\\nvec3 ( 1.5,0.0,5.5 ),\\nvec3 ( 1.5,1.5,0.0 ),\\nvec3 ( 1.0,1.0,1.0 ),\\nvec3 ( 0.0,1.0,5.5 ),\\nvec3 ( 0.5,3.5,0.75 )\\n);\\nvec3 shadowDebug{X};\\n#endif\\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\\nint index{X}=-1;\\n#else\\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\\n#endif\\nfloat diff{X}=0.;\\n#elif defined(SHADOWCUBE{X})\\nuniform samplerCube shadowSampler{X};\\n#else\\nvarying vec4 vPositionFromLight{X};\\nvarying float vDepthMetric{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\nuniform highp sampler2D depthSampler{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\n#else\\nuniform sampler2D shadowSampler{X};\\n#endif\\nuniform mat4 lightMatrix{X};\\n#endif\\nuniform vec4 shadowsInfo{X};\\nuniform vec2 depthValues{X};\\n#endif\\n#ifdef SPOTLIGHT{X}\\nuniform vec4 vLightDirection{X};\\nuniform vec4 vLightFalloff{X};\\n#elif defined(POINTLIGHT{X})\\nuniform vec4 vLightFalloff{X};\\n#elif defined(HEMILIGHT{X})\\nuniform vec3 vLightGround{X};\\n#endif\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\nuniform mat4 textureProjectionMatrix{X};\\nuniform sampler2D projectionLightSampler{X};\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var lightFragmentDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=lightFragmentDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'lightUboDeclaration';\r\nvar shader = \"#ifdef LIGHT{X}\\nuniform Light{X}\\n{\\nvec4 vLightData;\\nvec4 vLightDiffuse;\\nvec4 vLightSpecular;\\n#ifdef SPOTLIGHT{X}\\nvec4 vLightDirection;\\nvec4 vLightFalloff;\\n#elif defined(POINTLIGHT{X})\\nvec4 vLightFalloff;\\n#elif defined(HEMILIGHT{X})\\nvec3 vLightGround;\\n#endif\\nvec4 shadowsInfo;\\nvec2 depthValues;\\n} light{X};\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\nuniform mat4 textureProjectionMatrix{X};\\nuniform sampler2D projectionLightSampler{X};\\n#endif\\n#ifdef SHADOW{X}\\n#ifdef SHADOWCSM{X}\\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float cascadeBlendFactor{X};\\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying vec4 vPositionFromCamera{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DArrayShadow shadowSampler{X};\\nuniform highp sampler2DArray depthSampler{X};\\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float penumbraDarkness{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DArrayShadow shadowSampler{X};\\n#else\\nuniform highp sampler2DArray shadowSampler{X};\\n#endif\\n#ifdef SHADOWCSMDEBUG{X}\\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\\n(\\nvec3 ( 1.5,0.0,0.0 ),\\nvec3 ( 0.0,1.5,0.0 ),\\nvec3 ( 0.0,0.0,5.5 ),\\nvec3 ( 1.5,0.0,5.5 ),\\nvec3 ( 1.5,1.5,0.0 ),\\nvec3 ( 1.0,1.0,1.0 ),\\nvec3 ( 0.0,1.0,5.5 ),\\nvec3 ( 0.5,3.5,0.75 )\\n);\\nvec3 shadowDebug{X};\\n#endif\\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\\nint index{X}=-1;\\n#else\\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\\n#endif\\nfloat diff{X}=0.;\\n#elif defined(SHADOWCUBE{X})\\nuniform samplerCube shadowSampler{X};\\n#else\\nvarying vec4 vPositionFromLight{X};\\nvarying float vDepthMetric{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\nuniform highp sampler2D depthSampler{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\n#else\\nuniform sampler2D shadowSampler{X};\\n#endif\\nuniform mat4 lightMatrix{X};\\n#endif\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var lightUboDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=lightUboDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'logDepthDeclaration';\r\nvar shader = \"#ifdef LOGARITHMICDEPTH\\nuniform float logarithmicDepthConstant;\\nvarying float vFragmentDepth;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var logDepthDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=logDepthDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'logDepthFragment';\r\nvar shader = \"#ifdef LOGARITHMICDEPTH\\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var logDepthFragment = { name: name, shader: shader };\r\n//# sourceMappingURL=logDepthFragment.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'logDepthVertex';\r\nvar shader = \"#ifdef LOGARITHMICDEPTH\\nvFragmentDepth=1.0+gl_Position.w;\\ngl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var logDepthVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=logDepthVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'morphTargetsVertex';\r\nvar shader = \"#ifdef MORPHTARGETS\\npositionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];\\n#ifdef MORPHTARGETS_NORMAL\\nnormalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];\\n#endif\\n#ifdef MORPHTARGETS_TANGENT\\ntangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];\\n#endif\\n#ifdef MORPHTARGETS_UV\\nuvUpdated+=(uv_{X}-uv)*morphTargetInfluences[{X}];\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var morphTargetsVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=morphTargetsVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'morphTargetsVertexDeclaration';\r\nvar shader = \"#ifdef MORPHTARGETS\\nattribute vec3 position{X};\\n#ifdef MORPHTARGETS_NORMAL\\nattribute vec3 normal{X};\\n#endif\\n#ifdef MORPHTARGETS_TANGENT\\nattribute vec3 tangent{X};\\n#endif\\n#ifdef MORPHTARGETS_UV\\nattribute vec2 uv_{X};\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var morphTargetsVertexDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=morphTargetsVertexDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'morphTargetsVertexGlobalDeclaration';\r\nvar shader = \"#ifdef MORPHTARGETS\\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var morphTargetsVertexGlobalDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=morphTargetsVertexGlobalDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'prePassDeclaration';\r\nvar shader = \"#ifdef PREPASS\\n#extension GL_EXT_draw_buffers : require\\n#ifdef WEBGL2\\nlayout(location=0) out highp vec4 glFragData[{X}];\\nhighp vec4 gl_FragColor;\\n#endif\\n#ifdef PREPASS_DEPTHNORMAL\\nvarying highp vec3 vViewPos;\\n#endif\\n#ifdef PREPASS_VELOCITY\\nvarying highp vec4 vCurrentPosition;\\nvarying highp vec4 vPreviousPosition;\\n#endif\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var prePassDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=prePassDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'prePassVertex';\r\nvar shader = \"#ifdef PREPASS_DEPTHNORMAL\\nvViewPos=(view*worldPos).rgb;\\n#endif\\n#if defined(PREPASS_VELOCITY) && defined(BONES_VELOCITY_ENABLED)\\nvCurrentPosition=viewProjection*worldPos;\\n#if NUM_BONE_INFLUENCERS>0\\nmat4 previousInfluence;\\npreviousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\\n#endif\\nvPreviousPosition=previousViewProjection*previousWorld*previousInfluence*vec4(positionUpdated,1.0);\\n#else\\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var prePassVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=prePassVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'prePassVertexDeclaration';\r\nvar shader = \"#ifdef PREPASS\\n#ifdef PREPASS_DEPTHNORMAL\\nvarying vec3 vViewPos;\\n#endif\\n#ifdef PREPASS_VELOCITY\\nuniform mat4 previousWorld;\\nuniform mat4 previousViewProjection;\\nvarying vec4 vCurrentPosition;\\nvarying vec4 vPreviousPosition;\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var prePassVertexDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=prePassVertexDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'reflectionFunction';\r\nvar shader = \"vec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {\\n\\nvec3 invOrigVec=vec3(1.0,1.0,1.0)/origVec;\\nvec3 halfSize=cubeSize*0.5;\\nvec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;\\nvec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;\\n\\nvec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);\\n\\nfloat distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);\\n\\nvec3 intersectPositionWS=vertexPos+origVec*distance;\\n\\nreturn intersectPositionWS-cubePos;\\n}\\nvec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\\n{\\nfloat lon=atan(direction.z,direction.x);\\nfloat lat=acos(direction.y);\\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\\nfloat s=sphereCoords.x*0.5+0.5;\\nfloat t=sphereCoords.y;\\nreturn vec3(s,t,0);\\n}\\nvec3 computeMirroredFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\\n{\\nfloat lon=atan(direction.z,direction.x);\\nfloat lat=acos(direction.y);\\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\\nfloat s=sphereCoords.x*0.5+0.5;\\nfloat t=sphereCoords.y;\\nreturn vec3(1.0-s,t,0);\\n}\\nvec3 computeEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\\n{\\nvec3 cameraToVertex=normalize(worldPos.xyz-eyePosition);\\nvec3 r=normalize(reflect(cameraToVertex,worldNormal));\\nr=vec3(reflectionMatrix*vec4(r,0));\\nfloat lon=atan(r.z,r.x);\\nfloat lat=acos(r.y);\\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\\nfloat s=sphereCoords.x*0.5+0.5;\\nfloat t=sphereCoords.y;\\nreturn vec3(s,t,0);\\n}\\nvec3 computeSphericalCoords(vec4 worldPos,vec3 worldNormal,mat4 view,mat4 reflectionMatrix)\\n{\\nvec3 viewDir=normalize(vec3(view*worldPos));\\nvec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));\\nvec3 r=reflect(viewDir,viewNormal);\\nr=vec3(reflectionMatrix*vec4(r,0));\\nr.z=r.z-1.0;\\nfloat m=2.0*length(r);\\nreturn vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);\\n}\\nvec3 computePlanarCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\\n{\\nvec3 viewDir=worldPos.xyz-eyePosition;\\nvec3 coords=normalize(reflect(viewDir,worldNormal));\\nreturn vec3(reflectionMatrix*vec4(coords,1));\\n}\\nvec3 computeCubicCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\\n{\\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\\n\\nvec3 coords=reflect(viewDir,worldNormal);\\ncoords=vec3(reflectionMatrix*vec4(coords,0));\\n#ifdef INVERTCUBICMAP\\ncoords.y*=-1.0;\\n#endif\\nreturn coords;\\n}\\nvec3 computeCubicLocalCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix,vec3 reflectionSize,vec3 reflectionPosition)\\n{\\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\\n\\nvec3 coords=reflect(viewDir,worldNormal);\\ncoords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);\\ncoords=vec3(reflectionMatrix*vec4(coords,0));\\n#ifdef INVERTCUBICMAP\\ncoords.y*=-1.0;\\n#endif\\nreturn coords;\\n}\\nvec3 computeProjectionCoords(vec4 worldPos,mat4 view,mat4 reflectionMatrix)\\n{\\nreturn vec3(reflectionMatrix*(view*worldPos));\\n}\\nvec3 computeSkyBoxCoords(vec3 positionW,mat4 reflectionMatrix)\\n{\\nreturn vec3(reflectionMatrix*vec4(positionW,1.));\\n}\\n#ifdef REFLECTION\\nvec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)\\n{\\n#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\\nvec3 direction=normalize(vDirectionW);\\nreturn computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction);\\n#endif\\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\\nvec3 direction=normalize(vDirectionW);\\nreturn computeFixedEquirectangularCoords(worldPos,worldNormal,direction);\\n#endif\\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\\nreturn computeEquirectangularCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_SPHERICAL\\nreturn computeSphericalCoords(worldPos,worldNormal,view,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_PLANAR\\nreturn computePlanarCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_CUBIC\\n#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC\\nreturn computeCubicLocalCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix,vReflectionSize,vReflectionPosition);\\n#else\\nreturn computeCubicCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\\n#endif\\n#endif\\n#ifdef REFLECTIONMAP_PROJECTION\\nreturn computeProjectionCoords(worldPos,view,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_SKYBOX\\nreturn computeSkyBoxCoords(vPositionUVW,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_EXPLICIT\\nreturn vec3(0,0,0);\\n#endif\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var reflectionFunction = { name: name, shader: shader };\r\n//# sourceMappingURL=reflectionFunction.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'shadowsFragmentFunctions';\r\nvar shader = \"#ifdef SHADOWS\\n#ifndef SHADOWFLOAT\\n\\nfloat unpack(vec4 color)\\n{\\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\\nreturn dot(color,bit_shift);\\n}\\n#endif\\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\\n{\\nfloat mask=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));\\nreturn mix(value,1.0,mask);\\n}\\n#define inline\\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\\n{\\nvec3 directionToLight=vPositionW-lightPosition;\\nfloat depth=length(directionToLight);\\ndepth=(depth+depthValues.x)/(depthValues.y);\\ndepth=clamp(depth,0.,1.0);\\ndirectionToLight=normalize(directionToLight);\\ndirectionToLight.y=-directionToLight.y;\\n#ifndef SHADOWFLOAT\\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\\n#else\\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\\n#endif\\nreturn depth>shadow ? darkness : 1.0;\\n}\\n#define inline\\nfloat computeShadowWithPoissonSamplingCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\\n{\\nvec3 directionToLight=vPositionW-lightPosition;\\nfloat depth=length(directionToLight);\\ndepth=(depth+depthValues.x)/(depthValues.y);\\ndepth=clamp(depth,0.,1.0);\\ndirectionToLight=normalize(directionToLight);\\ndirectionToLight.y=-directionToLight.y;\\nfloat visibility=1.;\\nvec3 poissonDisk[4];\\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\\n\\n#ifndef SHADOWFLOAT\\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;\\n}\\n#endif\\n#define inline\\nfloat computeShadow(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nelse\\n{\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\n#ifndef SHADOWFLOAT\\nfloat shadow=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadow=texture2D(shadowSampler,uv).x;\\n#endif\\nreturn shadowPixelDepth>shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;\\n}\\n}\\n#define inline\\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nelse\\n{\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\nfloat visibility=1.;\\nvec2 poissonDisk[4];\\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\\npoissonDisk[3]=vec2(0.34495938,0.29387760);\\n\\n#ifndef SHADOWFLOAT\\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nelse\\n{\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\n#ifndef SHADOWFLOAT\\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\\n#endif\\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);\\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\n#define inline\\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nelse\\n{\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\n#ifndef SHADOWFLOAT\\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\\n#endif\\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\n#ifdef WEBGL2\\n#define GREATEST_LESS_THAN_ONE 0.99999994\\n\\n#define inline\\nfloat computeShadowWithCSMPCF1(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);\\nfloat shadow=texture(shadowSampler,uvDepthLayer);\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n\\n\\n\\n#define inline\\nfloat computeShadowWithCSMPCF3(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\\nuv+=0.5;\\nvec2 st=fract(uv);\\nvec2 base_uv=floor(uv)-0.5;\\nbase_uv*=shadowMapSizeAndInverse.y;\\n\\n\\n\\n\\nvec2 uvw0=3.-2.*st;\\nvec2 uvw1=1.+2.*st;\\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));\\nshadow=shadow/16.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n\\n\\n\\n#define inline\\nfloat computeShadowWithCSMPCF5(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\\nuv+=0.5;\\nvec2 st=fract(uv);\\nvec2 base_uv=floor(uv)-0.5;\\nbase_uv*=shadowMapSizeAndInverse.y;\\n\\n\\nvec2 uvw0=4.-3.*st;\\nvec2 uvw1=vec2(7.);\\nvec2 uvw2=1.+3.*st;\\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));\\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[0]),layer,uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));\\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[1]),layer,uvDepth.z));\\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[2]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[2]),layer,uvDepth.z));\\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[2]),layer,uvDepth.z));\\nshadow=shadow/144.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n\\n#define inline\\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nelse\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nfloat shadow=texture2D(shadowSampler,uvDepth);\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\n\\n\\n\\n#define inline\\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nelse\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\\nuv+=0.5;\\nvec2 st=fract(uv);\\nvec2 base_uv=floor(uv)-0.5;\\nbase_uv*=shadowMapSizeAndInverse.y;\\n\\n\\n\\n\\nvec2 uvw0=3.-2.*st;\\nvec2 uvw1=1.+2.*st;\\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\\nshadow=shadow/16.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\n\\n\\n\\n#define inline\\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nelse\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\\nuv+=0.5;\\nvec2 st=fract(uv);\\nvec2 base_uv=floor(uv)-0.5;\\nbase_uv*=shadowMapSizeAndInverse.y;\\n\\n\\nvec2 uvw0=4.-3.*st;\\nvec2 uvw1=vec2(7.);\\nvec2 uvw2=1.+3.*st;\\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z));\\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z));\\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z));\\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z));\\nshadow=shadow/144.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\nconst vec3 PoissonSamplers32[64]=vec3[64](\\nvec3(0.06407013,0.05409927,0.),\\nvec3(0.7366577,0.5789394,0.),\\nvec3(-0.6270542,-0.5320278,0.),\\nvec3(-0.4096107,0.8411095,0.),\\nvec3(0.6849564,-0.4990818,0.),\\nvec3(-0.874181,-0.04579735,0.),\\nvec3(0.9989998,0.0009880066,0.),\\nvec3(-0.004920578,-0.9151649,0.),\\nvec3(0.1805763,0.9747483,0.),\\nvec3(-0.2138451,0.2635818,0.),\\nvec3(0.109845,0.3884785,0.),\\nvec3(0.06876755,-0.3581074,0.),\\nvec3(0.374073,-0.7661266,0.),\\nvec3(0.3079132,-0.1216763,0.),\\nvec3(-0.3794335,-0.8271583,0.),\\nvec3(-0.203878,-0.07715034,0.),\\nvec3(0.5912697,0.1469799,0.),\\nvec3(-0.88069,0.3031784,0.),\\nvec3(0.5040108,0.8283722,0.),\\nvec3(-0.5844124,0.5494877,0.),\\nvec3(0.6017799,-0.1726654,0.),\\nvec3(-0.5554981,0.1559997,0.),\\nvec3(-0.3016369,-0.3900928,0.),\\nvec3(-0.5550632,-0.1723762,0.),\\nvec3(0.925029,0.2995041,0.),\\nvec3(-0.2473137,0.5538505,0.),\\nvec3(0.9183037,-0.2862392,0.),\\nvec3(0.2469421,0.6718712,0.),\\nvec3(0.3916397,-0.4328209,0.),\\nvec3(-0.03576927,-0.6220032,0.),\\nvec3(-0.04661255,0.7995201,0.),\\nvec3(0.4402924,0.3640312,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.)\\n);\\nconst vec3 PoissonSamplers64[64]=vec3[64](\\nvec3(-0.613392,0.617481,0.),\\nvec3(0.170019,-0.040254,0.),\\nvec3(-0.299417,0.791925,0.),\\nvec3(0.645680,0.493210,0.),\\nvec3(-0.651784,0.717887,0.),\\nvec3(0.421003,0.027070,0.),\\nvec3(-0.817194,-0.271096,0.),\\nvec3(-0.705374,-0.668203,0.),\\nvec3(0.977050,-0.108615,0.),\\nvec3(0.063326,0.142369,0.),\\nvec3(0.203528,0.214331,0.),\\nvec3(-0.667531,0.326090,0.),\\nvec3(-0.098422,-0.295755,0.),\\nvec3(-0.885922,0.215369,0.),\\nvec3(0.566637,0.605213,0.),\\nvec3(0.039766,-0.396100,0.),\\nvec3(0.751946,0.453352,0.),\\nvec3(0.078707,-0.715323,0.),\\nvec3(-0.075838,-0.529344,0.),\\nvec3(0.724479,-0.580798,0.),\\nvec3(0.222999,-0.215125,0.),\\nvec3(-0.467574,-0.405438,0.),\\nvec3(-0.248268,-0.814753,0.),\\nvec3(0.354411,-0.887570,0.),\\nvec3(0.175817,0.382366,0.),\\nvec3(0.487472,-0.063082,0.),\\nvec3(-0.084078,0.898312,0.),\\nvec3(0.488876,-0.783441,0.),\\nvec3(0.470016,0.217933,0.),\\nvec3(-0.696890,-0.549791,0.),\\nvec3(-0.149693,0.605762,0.),\\nvec3(0.034211,0.979980,0.),\\nvec3(0.503098,-0.308878,0.),\\nvec3(-0.016205,-0.872921,0.),\\nvec3(0.385784,-0.393902,0.),\\nvec3(-0.146886,-0.859249,0.),\\nvec3(0.643361,0.164098,0.),\\nvec3(0.634388,-0.049471,0.),\\nvec3(-0.688894,0.007843,0.),\\nvec3(0.464034,-0.188818,0.),\\nvec3(-0.440840,0.137486,0.),\\nvec3(0.364483,0.511704,0.),\\nvec3(0.034028,0.325968,0.),\\nvec3(0.099094,-0.308023,0.),\\nvec3(0.693960,-0.366253,0.),\\nvec3(0.678884,-0.204688,0.),\\nvec3(0.001801,0.780328,0.),\\nvec3(0.145177,-0.898984,0.),\\nvec3(0.062655,-0.611866,0.),\\nvec3(0.315226,-0.604297,0.),\\nvec3(-0.780145,0.486251,0.),\\nvec3(-0.371868,0.882138,0.),\\nvec3(0.200476,0.494430,0.),\\nvec3(-0.494552,-0.711051,0.),\\nvec3(0.612476,0.705252,0.),\\nvec3(-0.578845,-0.768792,0.),\\nvec3(-0.772454,-0.090976,0.),\\nvec3(0.504440,0.372295,0.),\\nvec3(0.155736,0.065157,0.),\\nvec3(0.391522,0.849605,0.),\\nvec3(-0.620106,-0.328104,0.),\\nvec3(0.789239,-0.419965,0.),\\nvec3(-0.545396,0.538133,0.),\\nvec3(-0.178564,-0.596057,0.)\\n);\\n\\n\\n\\n\\n\\n#define inline\\nfloat computeShadowWithCSMPCSS(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);\\nfloat blockerDepth=0.0;\\nfloat sumBlockerDepth=0.0;\\nfloat numBlocker=0.0;\\nfor (int i=0; i1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nelse\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nfloat blockerDepth=0.0;\\nfloat sumBlockerDepth=0.0;\\nfloat numBlocker=0.0;\\nfor (int i=0; i= 1 && t_int <= 7) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Does exist one action manager that handles actions of a given trigger\r\n * @param trigger defines the trigger to be tested\r\n * @return a boolean indicating whether the trigger is handeled by at least one action manager\r\n **/\r\n AbstractActionManager.HasSpecificTrigger = function (trigger) {\r\n for (var t in AbstractActionManager.Triggers) {\r\n if (AbstractActionManager.Triggers.hasOwnProperty(t)) {\r\n var t_int = parseInt(t);\r\n if (t_int === trigger) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /** Gets the list of active triggers */\r\n AbstractActionManager.Triggers = {};\r\n return AbstractActionManager;\r\n}());\r\nexport { AbstractActionManager };\r\n//# sourceMappingURL=abstractActionManager.js.map","import { PointerInfoPre, PointerInfo, PointerEventTypes } from \"../Events/pointerEvents\";\r\nimport { AbstractActionManager } from \"../Actions/abstractActionManager\";\r\nimport { Vector2, Matrix } from \"../Maths/math.vector\";\r\nimport { ActionEvent } from \"../Actions/actionEvent\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { KeyboardEventTypes, KeyboardInfoPre, KeyboardInfo } from \"../Events/keyboardEvents\";\r\n/** @hidden */\r\nvar _ClickInfo = /** @class */ (function () {\r\n function _ClickInfo() {\r\n this._singleClick = false;\r\n this._doubleClick = false;\r\n this._hasSwiped = false;\r\n this._ignore = false;\r\n }\r\n Object.defineProperty(_ClickInfo.prototype, \"singleClick\", {\r\n get: function () {\r\n return this._singleClick;\r\n },\r\n set: function (b) {\r\n this._singleClick = b;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ClickInfo.prototype, \"doubleClick\", {\r\n get: function () {\r\n return this._doubleClick;\r\n },\r\n set: function (b) {\r\n this._doubleClick = b;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ClickInfo.prototype, \"hasSwiped\", {\r\n get: function () {\r\n return this._hasSwiped;\r\n },\r\n set: function (b) {\r\n this._hasSwiped = b;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ClickInfo.prototype, \"ignore\", {\r\n get: function () {\r\n return this._ignore;\r\n },\r\n set: function (b) {\r\n this._ignore = b;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return _ClickInfo;\r\n}());\r\n/**\r\n * Class used to manage all inputs for the scene.\r\n */\r\nvar InputManager = /** @class */ (function () {\r\n /**\r\n * Creates a new InputManager\r\n * @param scene defines the hosting scene\r\n */\r\n function InputManager(scene) {\r\n /** This is a defensive check to not allow control attachment prior to an already active one. If already attached, previous control is unattached before attaching the new one. */\r\n this._alreadyAttached = false;\r\n // Pointers\r\n this._wheelEventName = \"\";\r\n this._meshPickProceed = false;\r\n this._currentPickResult = null;\r\n this._previousPickResult = null;\r\n this._totalPointersPressed = 0;\r\n this._doubleClickOccured = false;\r\n this._pointerX = 0;\r\n this._pointerY = 0;\r\n this._startingPointerPosition = new Vector2(0, 0);\r\n this._previousStartingPointerPosition = new Vector2(0, 0);\r\n this._startingPointerTime = 0;\r\n this._previousStartingPointerTime = 0;\r\n this._pointerCaptures = {};\r\n this._meshUnderPointerId = [];\r\n this._keyboardIsAttached = false;\r\n this._scene = scene;\r\n }\r\n Object.defineProperty(InputManager.prototype, \"meshUnderPointer\", {\r\n /**\r\n * Gets the mesh that is currently under the pointer\r\n */\r\n get: function () {\r\n return this._pointerOverMesh;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * When using more than one pointer (for example in XR) you can get the mesh under the specific pointer\r\n * @param pointerId the pointer id to use\r\n * @returns The mesh under this pointer id or null if not found\r\n */\r\n InputManager.prototype.getMeshUnderPointerByPointerId = function (pointerId) {\r\n return this._meshUnderPointerId[pointerId];\r\n };\r\n Object.defineProperty(InputManager.prototype, \"unTranslatedPointer\", {\r\n /**\r\n * Gets the pointer coordinates in 2D without any translation (ie. straight out of the pointer event)\r\n */\r\n get: function () {\r\n return new Vector2(this._unTranslatedPointerX, this._unTranslatedPointerY);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputManager.prototype, \"pointerX\", {\r\n /**\r\n * Gets or sets the current on-screen X position of the pointer\r\n */\r\n get: function () {\r\n return this._pointerX;\r\n },\r\n set: function (value) {\r\n this._pointerX = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputManager.prototype, \"pointerY\", {\r\n /**\r\n * Gets or sets the current on-screen Y position of the pointer\r\n */\r\n get: function () {\r\n return this._pointerY;\r\n },\r\n set: function (value) {\r\n this._pointerY = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n InputManager.prototype._updatePointerPosition = function (evt) {\r\n var canvasRect = this._scene.getEngine().getInputElementClientRect();\r\n if (!canvasRect) {\r\n return;\r\n }\r\n this._pointerX = evt.clientX - canvasRect.left;\r\n this._pointerY = evt.clientY - canvasRect.top;\r\n this._unTranslatedPointerX = this._pointerX;\r\n this._unTranslatedPointerY = this._pointerY;\r\n };\r\n InputManager.prototype._processPointerMove = function (pickResult, evt) {\r\n var scene = this._scene;\r\n var engine = scene.getEngine();\r\n var canvas = engine.getInputElement();\r\n if (!canvas) {\r\n return;\r\n }\r\n canvas.tabIndex = engine.canvasTabIndex;\r\n // Restore pointer\r\n if (!scene.doNotHandleCursors) {\r\n canvas.style.cursor = scene.defaultCursor;\r\n }\r\n var isMeshPicked = pickResult && pickResult.hit && pickResult.pickedMesh ? true : false;\r\n if (isMeshPicked) {\r\n scene.setPointerOverMesh(pickResult.pickedMesh, evt.pointerId);\r\n if (this._pointerOverMesh && this._pointerOverMesh.actionManager && this._pointerOverMesh.actionManager.hasPointerTriggers) {\r\n if (!scene.doNotHandleCursors) {\r\n if (this._pointerOverMesh.actionManager.hoverCursor) {\r\n canvas.style.cursor = this._pointerOverMesh.actionManager.hoverCursor;\r\n }\r\n else {\r\n canvas.style.cursor = scene.hoverCursor;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n scene.setPointerOverMesh(null, evt.pointerId);\r\n }\r\n for (var _i = 0, _a = scene._pointerMoveStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, isMeshPicked, canvas);\r\n }\r\n if (pickResult) {\r\n var type = evt.type === this._wheelEventName ? PointerEventTypes.POINTERWHEEL : PointerEventTypes.POINTERMOVE;\r\n if (scene.onPointerMove) {\r\n scene.onPointerMove(evt, pickResult, type);\r\n }\r\n if (scene.onPointerObservable.hasObservers()) {\r\n var pi = new PointerInfo(type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n };\r\n // Pointers handling\r\n InputManager.prototype._setRayOnPointerInfo = function (pointerInfo) {\r\n var scene = this._scene;\r\n if (pointerInfo.pickInfo && !pointerInfo.pickInfo._pickingUnavailable) {\r\n if (!pointerInfo.pickInfo.ray) {\r\n pointerInfo.pickInfo.ray = scene.createPickingRay(pointerInfo.event.offsetX, pointerInfo.event.offsetY, Matrix.Identity(), scene.activeCamera);\r\n }\r\n }\r\n };\r\n InputManager.prototype._checkPrePointerObservable = function (pickResult, evt, type) {\r\n var scene = this._scene;\r\n var pi = new PointerInfoPre(type, evt, this._unTranslatedPointerX, this._unTranslatedPointerY);\r\n if (pickResult) {\r\n pi.ray = pickResult.ray;\r\n }\r\n scene.onPrePointerObservable.notifyObservers(pi, type);\r\n if (pi.skipOnPointerObservable) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Use this method to simulate a pointer move on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n */\r\n InputManager.prototype.simulatePointerMove = function (pickResult, pointerEventInit) {\r\n var evt = new PointerEvent(\"pointermove\", pointerEventInit);\r\n if (this._checkPrePointerObservable(pickResult, evt, PointerEventTypes.POINTERMOVE)) {\r\n return;\r\n }\r\n this._processPointerMove(pickResult, evt);\r\n };\r\n /**\r\n * Use this method to simulate a pointer down on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n */\r\n InputManager.prototype.simulatePointerDown = function (pickResult, pointerEventInit) {\r\n var evt = new PointerEvent(\"pointerdown\", pointerEventInit);\r\n if (this._checkPrePointerObservable(pickResult, evt, PointerEventTypes.POINTERDOWN)) {\r\n return;\r\n }\r\n this._processPointerDown(pickResult, evt);\r\n };\r\n InputManager.prototype._processPointerDown = function (pickResult, evt) {\r\n var _this = this;\r\n var scene = this._scene;\r\n if (pickResult && pickResult.hit && pickResult.pickedMesh) {\r\n this._pickedDownMesh = pickResult.pickedMesh;\r\n var actionManager = pickResult.pickedMesh._getActionManagerForTrigger();\r\n if (actionManager) {\r\n if (actionManager.hasPickTriggers) {\r\n actionManager.processTrigger(5, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n switch (evt.button) {\r\n case 0:\r\n actionManager.processTrigger(2, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n break;\r\n case 1:\r\n actionManager.processTrigger(4, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n break;\r\n case 2:\r\n actionManager.processTrigger(3, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n break;\r\n }\r\n }\r\n if (actionManager.hasSpecificTrigger(8)) {\r\n window.setTimeout(function () {\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, function (mesh) { return (mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.actionManager && mesh.actionManager.hasSpecificTrigger(8) && mesh == _this._pickedDownMesh); }, false, scene.cameraToUseForPointers);\r\n if (pickResult && pickResult.hit && pickResult.pickedMesh && actionManager) {\r\n if (_this._totalPointersPressed !== 0 && Date.now() - _this._startingPointerTime > InputManager.LongPressDelay && !_this._isPointerSwiping()) {\r\n _this._startingPointerTime = 0;\r\n actionManager.processTrigger(8, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n }\r\n }\r\n }, InputManager.LongPressDelay);\r\n }\r\n }\r\n }\r\n else {\r\n for (var _i = 0, _a = scene._pointerDownStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, evt);\r\n }\r\n }\r\n if (pickResult) {\r\n var type = PointerEventTypes.POINTERDOWN;\r\n if (scene.onPointerDown) {\r\n scene.onPointerDown(evt, pickResult, type);\r\n }\r\n if (scene.onPointerObservable.hasObservers()) {\r\n var pi = new PointerInfo(type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n InputManager.prototype._isPointerSwiping = function () {\r\n return Math.abs(this._startingPointerPosition.x - this._pointerX) > InputManager.DragMovementThreshold || Math.abs(this._startingPointerPosition.y - this._pointerY) > InputManager.DragMovementThreshold;\r\n };\r\n /**\r\n * Use this method to simulate a pointer up on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @param doubleTap indicates that the pointer up event should be considered as part of a double click (false by default)\r\n */\r\n InputManager.prototype.simulatePointerUp = function (pickResult, pointerEventInit, doubleTap) {\r\n var evt = new PointerEvent(\"pointerup\", pointerEventInit);\r\n var clickInfo = new _ClickInfo();\r\n if (doubleTap) {\r\n clickInfo.doubleClick = true;\r\n }\r\n else {\r\n clickInfo.singleClick = true;\r\n }\r\n if (this._checkPrePointerObservable(pickResult, evt, PointerEventTypes.POINTERUP)) {\r\n return;\r\n }\r\n this._processPointerUp(pickResult, evt, clickInfo);\r\n };\r\n InputManager.prototype._processPointerUp = function (pickResult, evt, clickInfo) {\r\n var scene = this._scene;\r\n if (pickResult && pickResult && pickResult.pickedMesh) {\r\n this._pickedUpMesh = pickResult.pickedMesh;\r\n if (this._pickedDownMesh === this._pickedUpMesh) {\r\n if (scene.onPointerPick) {\r\n scene.onPointerPick(evt, pickResult);\r\n }\r\n if (clickInfo.singleClick && !clickInfo.ignore && scene.onPointerObservable.hasObservers()) {\r\n var type_1 = PointerEventTypes.POINTERPICK;\r\n var pi = new PointerInfo(type_1, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type_1);\r\n }\r\n }\r\n var actionManager = pickResult.pickedMesh._getActionManagerForTrigger();\r\n if (actionManager && !clickInfo.ignore) {\r\n actionManager.processTrigger(7, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n if (!clickInfo.hasSwiped && clickInfo.singleClick) {\r\n actionManager.processTrigger(1, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n }\r\n var doubleClickActionManager = pickResult.pickedMesh._getActionManagerForTrigger(6);\r\n if (clickInfo.doubleClick && doubleClickActionManager) {\r\n doubleClickActionManager.processTrigger(6, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n }\r\n }\r\n }\r\n else {\r\n if (!clickInfo.ignore) {\r\n for (var _i = 0, _a = scene._pointerUpStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, evt);\r\n }\r\n }\r\n }\r\n if (this._pickedDownMesh && this._pickedDownMesh !== this._pickedUpMesh) {\r\n var pickedDownActionManager = this._pickedDownMesh._getActionManagerForTrigger(16);\r\n if (pickedDownActionManager) {\r\n pickedDownActionManager.processTrigger(16, ActionEvent.CreateNew(this._pickedDownMesh, evt));\r\n }\r\n }\r\n var type = 0;\r\n if (scene.onPointerObservable.hasObservers()) {\r\n if (!clickInfo.ignore && !clickInfo.hasSwiped) {\r\n if (clickInfo.singleClick && scene.onPointerObservable.hasSpecificMask(PointerEventTypes.POINTERTAP)) {\r\n type = PointerEventTypes.POINTERTAP;\r\n }\r\n else if (clickInfo.doubleClick && scene.onPointerObservable.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP)) {\r\n type = PointerEventTypes.POINTERDOUBLETAP;\r\n }\r\n if (type) {\r\n var pi = new PointerInfo(type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n if (!clickInfo.ignore) {\r\n type = PointerEventTypes.POINTERUP;\r\n var pi = new PointerInfo(type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n if (scene.onPointerUp && !clickInfo.ignore) {\r\n scene.onPointerUp(evt, pickResult, type);\r\n }\r\n };\r\n /**\r\n * Gets a boolean indicating if the current pointer event is captured (meaning that the scene has already handled the pointer down)\r\n * @param pointerId defines the pointer id to use in a multi-touch scenario (0 by default)\r\n * @returns true if the pointer was captured\r\n */\r\n InputManager.prototype.isPointerCaptured = function (pointerId) {\r\n if (pointerId === void 0) { pointerId = 0; }\r\n return this._pointerCaptures[pointerId];\r\n };\r\n /**\r\n * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp\r\n * @param attachUp defines if you want to attach events to pointerup\r\n * @param attachDown defines if you want to attach events to pointerdown\r\n * @param attachMove defines if you want to attach events to pointermove\r\n * @param elementToAttachTo defines the target DOM element to attach to (will use the canvas by default)\r\n */\r\n InputManager.prototype.attachControl = function (attachUp, attachDown, attachMove, elementToAttachTo) {\r\n var _this = this;\r\n if (attachUp === void 0) { attachUp = true; }\r\n if (attachDown === void 0) { attachDown = true; }\r\n if (attachMove === void 0) { attachMove = true; }\r\n if (elementToAttachTo === void 0) { elementToAttachTo = null; }\r\n var scene = this._scene;\r\n if (!elementToAttachTo) {\r\n elementToAttachTo = scene.getEngine().getInputElement();\r\n }\r\n if (!elementToAttachTo) {\r\n return;\r\n }\r\n if (this._alreadyAttached) {\r\n this.detachControl();\r\n }\r\n this._alreadyAttachedTo = elementToAttachTo;\r\n var engine = scene.getEngine();\r\n this._initActionManager = function (act, clickInfo) {\r\n if (!_this._meshPickProceed) {\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, scene.pointerDownPredicate, false, scene.cameraToUseForPointers);\r\n _this._currentPickResult = pickResult;\r\n if (pickResult) {\r\n act = pickResult.hit && pickResult.pickedMesh ? pickResult.pickedMesh._getActionManagerForTrigger() : null;\r\n }\r\n _this._meshPickProceed = true;\r\n }\r\n return act;\r\n };\r\n this._delayedSimpleClick = function (btn, clickInfo, cb) {\r\n // double click delay is over and that no double click has been raised since, or the 2 consecutive keys pressed are different\r\n if ((Date.now() - _this._previousStartingPointerTime > InputManager.DoubleClickDelay && !_this._doubleClickOccured) || btn !== _this._previousButtonPressed) {\r\n _this._doubleClickOccured = false;\r\n clickInfo.singleClick = true;\r\n clickInfo.ignore = false;\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n };\r\n this._initClickEvent = function (obs1, obs2, evt, cb) {\r\n var clickInfo = new _ClickInfo();\r\n _this._currentPickResult = null;\r\n var act = null;\r\n var checkPicking = obs1.hasSpecificMask(PointerEventTypes.POINTERPICK) ||\r\n obs2.hasSpecificMask(PointerEventTypes.POINTERPICK) ||\r\n obs1.hasSpecificMask(PointerEventTypes.POINTERTAP) ||\r\n obs2.hasSpecificMask(PointerEventTypes.POINTERTAP) ||\r\n obs1.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP) ||\r\n obs2.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP);\r\n if (!checkPicking && AbstractActionManager) {\r\n act = _this._initActionManager(act, clickInfo);\r\n if (act) {\r\n checkPicking = act.hasPickTriggers;\r\n }\r\n }\r\n var needToIgnoreNext = false;\r\n if (checkPicking) {\r\n var btn = evt.button;\r\n clickInfo.hasSwiped = _this._isPointerSwiping();\r\n if (!clickInfo.hasSwiped) {\r\n var checkSingleClickImmediately = !InputManager.ExclusiveDoubleClickMode;\r\n if (!checkSingleClickImmediately) {\r\n checkSingleClickImmediately = !obs1.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP) && !obs2.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP);\r\n if (checkSingleClickImmediately && !AbstractActionManager.HasSpecificTrigger(6)) {\r\n act = _this._initActionManager(act, clickInfo);\r\n if (act) {\r\n checkSingleClickImmediately = !act.hasSpecificTrigger(6);\r\n }\r\n }\r\n }\r\n if (checkSingleClickImmediately) {\r\n // single click detected if double click delay is over or two different successive keys pressed without exclusive double click or no double click required\r\n if (Date.now() - _this._previousStartingPointerTime > InputManager.DoubleClickDelay || btn !== _this._previousButtonPressed) {\r\n clickInfo.singleClick = true;\r\n cb(clickInfo, _this._currentPickResult);\r\n needToIgnoreNext = true;\r\n }\r\n }\r\n // at least one double click is required to be check and exclusive double click is enabled\r\n else {\r\n // wait that no double click has been raised during the double click delay\r\n _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;\r\n _this._delayedSimpleClickTimeout = window.setTimeout(_this._delayedSimpleClick.bind(_this, btn, clickInfo, cb), InputManager.DoubleClickDelay);\r\n }\r\n var checkDoubleClick = obs1.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP) || obs2.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP);\r\n if (!checkDoubleClick && AbstractActionManager.HasSpecificTrigger(6)) {\r\n act = _this._initActionManager(act, clickInfo);\r\n if (act) {\r\n checkDoubleClick = act.hasSpecificTrigger(6);\r\n }\r\n }\r\n if (checkDoubleClick) {\r\n // two successive keys pressed are equal, double click delay is not over and double click has not just occurred\r\n if (btn === _this._previousButtonPressed && Date.now() - _this._previousStartingPointerTime < InputManager.DoubleClickDelay && !_this._doubleClickOccured) {\r\n // pointer has not moved for 2 clicks, it's a double click\r\n if (!clickInfo.hasSwiped && !_this._isPointerSwiping()) {\r\n _this._previousStartingPointerTime = 0;\r\n _this._doubleClickOccured = true;\r\n clickInfo.doubleClick = true;\r\n clickInfo.ignore = false;\r\n if (InputManager.ExclusiveDoubleClickMode && _this._previousDelayedSimpleClickTimeout) {\r\n clearTimeout(_this._previousDelayedSimpleClickTimeout);\r\n }\r\n _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n // if the two successive clicks are too far, it's just two simple clicks\r\n else {\r\n _this._doubleClickOccured = false;\r\n _this._previousStartingPointerTime = _this._startingPointerTime;\r\n _this._previousStartingPointerPosition.x = _this._startingPointerPosition.x;\r\n _this._previousStartingPointerPosition.y = _this._startingPointerPosition.y;\r\n _this._previousButtonPressed = btn;\r\n if (InputManager.ExclusiveDoubleClickMode) {\r\n if (_this._previousDelayedSimpleClickTimeout) {\r\n clearTimeout(_this._previousDelayedSimpleClickTimeout);\r\n }\r\n _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;\r\n cb(clickInfo, _this._previousPickResult);\r\n }\r\n else {\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n }\r\n needToIgnoreNext = true;\r\n }\r\n // just the first click of the double has been raised\r\n else {\r\n _this._doubleClickOccured = false;\r\n _this._previousStartingPointerTime = _this._startingPointerTime;\r\n _this._previousStartingPointerPosition.x = _this._startingPointerPosition.x;\r\n _this._previousStartingPointerPosition.y = _this._startingPointerPosition.y;\r\n _this._previousButtonPressed = btn;\r\n }\r\n }\r\n }\r\n }\r\n if (!needToIgnoreNext) {\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n };\r\n this._onPointerMove = function (evt) {\r\n // preserve compatibility with Safari when pointerId is not present\r\n if (evt.pointerId === undefined) {\r\n evt.pointerId = 0;\r\n }\r\n _this._updatePointerPosition(evt);\r\n // PreObservable support\r\n if (_this._checkPrePointerObservable(null, evt, evt.type === _this._wheelEventName ? PointerEventTypes.POINTERWHEEL : PointerEventTypes.POINTERMOVE)) {\r\n return;\r\n }\r\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\r\n return;\r\n }\r\n if (!scene.pointerMovePredicate) {\r\n scene.pointerMovePredicate = function (mesh) {\r\n return mesh.isPickable &&\r\n mesh.isVisible &&\r\n mesh.isReady() &&\r\n mesh.isEnabled() &&\r\n (mesh.enablePointerMoveEvents || scene.constantlyUpdateMeshUnderPointer || mesh._getActionManagerForTrigger() != null) &&\r\n (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0);\r\n };\r\n }\r\n // Meshes\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, scene.pointerMovePredicate, false, scene.cameraToUseForPointers);\r\n _this._processPointerMove(pickResult, evt);\r\n };\r\n this._onPointerDown = function (evt) {\r\n _this._totalPointersPressed++;\r\n _this._pickedDownMesh = null;\r\n _this._meshPickProceed = false;\r\n // preserve compatibility with Safari when pointerId is not present\r\n if (evt.pointerId === undefined) {\r\n evt.pointerId = 0;\r\n }\r\n _this._updatePointerPosition(evt);\r\n if (scene.preventDefaultOnPointerDown && elementToAttachTo) {\r\n evt.preventDefault();\r\n elementToAttachTo.focus();\r\n }\r\n _this._startingPointerPosition.x = _this._pointerX;\r\n _this._startingPointerPosition.y = _this._pointerY;\r\n _this._startingPointerTime = Date.now();\r\n // PreObservable support\r\n if (_this._checkPrePointerObservable(null, evt, PointerEventTypes.POINTERDOWN)) {\r\n return;\r\n }\r\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\r\n return;\r\n }\r\n _this._pointerCaptures[evt.pointerId] = true;\r\n if (!scene.pointerDownPredicate) {\r\n scene.pointerDownPredicate = function (mesh) {\r\n return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled() && (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0);\r\n };\r\n }\r\n // Meshes\r\n _this._pickedDownMesh = null;\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, scene.pointerDownPredicate, false, scene.cameraToUseForPointers);\r\n _this._processPointerDown(pickResult, evt);\r\n };\r\n this._onPointerUp = function (evt) {\r\n if (_this._totalPointersPressed === 0) {\r\n // We are attaching the pointer up to windows because of a bug in FF\r\n return; // So we need to test it the pointer down was pressed before.\r\n }\r\n _this._totalPointersPressed--;\r\n _this._pickedUpMesh = null;\r\n _this._meshPickProceed = false;\r\n // preserve compatibility with Safari when pointerId is not present\r\n if (evt.pointerId === undefined) {\r\n evt.pointerId = 0;\r\n }\r\n _this._updatePointerPosition(evt);\r\n if (scene.preventDefaultOnPointerUp && elementToAttachTo) {\r\n evt.preventDefault();\r\n elementToAttachTo.focus();\r\n }\r\n _this._initClickEvent(scene.onPrePointerObservable, scene.onPointerObservable, evt, function (clickInfo, pickResult) {\r\n // PreObservable support\r\n if (scene.onPrePointerObservable.hasObservers()) {\r\n if (!clickInfo.ignore) {\r\n if (!clickInfo.hasSwiped) {\r\n if (clickInfo.singleClick && scene.onPrePointerObservable.hasSpecificMask(PointerEventTypes.POINTERTAP)) {\r\n if (_this._checkPrePointerObservable(null, evt, PointerEventTypes.POINTERTAP)) {\r\n return;\r\n }\r\n }\r\n if (clickInfo.doubleClick && scene.onPrePointerObservable.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP)) {\r\n if (_this._checkPrePointerObservable(null, evt, PointerEventTypes.POINTERDOUBLETAP)) {\r\n return;\r\n }\r\n }\r\n }\r\n if (_this._checkPrePointerObservable(null, evt, PointerEventTypes.POINTERUP)) {\r\n return;\r\n }\r\n }\r\n }\r\n if (!_this._pointerCaptures[evt.pointerId]) {\r\n return;\r\n }\r\n _this._pointerCaptures[evt.pointerId] = false;\r\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\r\n return;\r\n }\r\n if (!scene.pointerUpPredicate) {\r\n scene.pointerUpPredicate = function (mesh) {\r\n return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled() && (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0);\r\n };\r\n }\r\n // Meshes\r\n if (!_this._meshPickProceed && ((AbstractActionManager && AbstractActionManager.HasTriggers) || scene.onPointerObservable.hasObservers())) {\r\n _this._initActionManager(null, clickInfo);\r\n }\r\n if (!pickResult) {\r\n pickResult = _this._currentPickResult;\r\n }\r\n _this._processPointerUp(pickResult, evt, clickInfo);\r\n _this._previousPickResult = _this._currentPickResult;\r\n });\r\n };\r\n this._onKeyDown = function (evt) {\r\n var type = KeyboardEventTypes.KEYDOWN;\r\n if (scene.onPreKeyboardObservable.hasObservers()) {\r\n var pi = new KeyboardInfoPre(type, evt);\r\n scene.onPreKeyboardObservable.notifyObservers(pi, type);\r\n if (pi.skipOnPointerObservable) {\r\n return;\r\n }\r\n }\r\n if (scene.onKeyboardObservable.hasObservers()) {\r\n var pi = new KeyboardInfo(type, evt);\r\n scene.onKeyboardObservable.notifyObservers(pi, type);\r\n }\r\n if (scene.actionManager) {\r\n scene.actionManager.processTrigger(14, ActionEvent.CreateNewFromScene(scene, evt));\r\n }\r\n };\r\n this._onKeyUp = function (evt) {\r\n var type = KeyboardEventTypes.KEYUP;\r\n if (scene.onPreKeyboardObservable.hasObservers()) {\r\n var pi = new KeyboardInfoPre(type, evt);\r\n scene.onPreKeyboardObservable.notifyObservers(pi, type);\r\n if (pi.skipOnPointerObservable) {\r\n return;\r\n }\r\n }\r\n if (scene.onKeyboardObservable.hasObservers()) {\r\n var pi = new KeyboardInfo(type, evt);\r\n scene.onKeyboardObservable.notifyObservers(pi, type);\r\n }\r\n if (scene.actionManager) {\r\n scene.actionManager.processTrigger(15, ActionEvent.CreateNewFromScene(scene, evt));\r\n }\r\n };\r\n var attachedFunction = function () {\r\n if (!elementToAttachTo || _this._keyboardIsAttached) {\r\n return;\r\n }\r\n elementToAttachTo.addEventListener(\"keydown\", _this._onKeyDown, false);\r\n elementToAttachTo.addEventListener(\"keyup\", _this._onKeyUp, false);\r\n _this._keyboardIsAttached = true;\r\n };\r\n // Keyboard events\r\n this._onCanvasFocusObserver = engine.onCanvasFocusObservable.add((function () {\r\n if (document.activeElement === elementToAttachTo) {\r\n attachedFunction();\r\n }\r\n return attachedFunction;\r\n })());\r\n this._onCanvasBlurObserver = engine.onCanvasBlurObservable.add(function () {\r\n if (!elementToAttachTo) {\r\n return;\r\n }\r\n elementToAttachTo.removeEventListener(\"keydown\", _this._onKeyDown);\r\n elementToAttachTo.removeEventListener(\"keyup\", _this._onKeyUp);\r\n _this._keyboardIsAttached = false;\r\n });\r\n attachedFunction();\r\n // Pointer events\r\n var eventPrefix = Tools.GetPointerPrefix(engine);\r\n if (attachMove) {\r\n elementToAttachTo.addEventListener(eventPrefix + \"move\", this._onPointerMove, false);\r\n // Wheel\r\n this._wheelEventName =\r\n \"onwheel\" in document.createElement(\"div\")\r\n ? \"wheel\" // Modern browsers support \"wheel\"\r\n : document.onmousewheel !== undefined\r\n ? \"mousewheel\" // Webkit and IE support at least \"mousewheel\"\r\n : \"DOMMouseScroll\"; // let's assume that remaining browsers are older Firefox\r\n elementToAttachTo.addEventListener(this._wheelEventName, this._onPointerMove, false);\r\n }\r\n if (attachDown) {\r\n elementToAttachTo.addEventListener(eventPrefix + \"down\", this._onPointerDown, false);\r\n }\r\n if (attachUp) {\r\n var hostWindow = scene.getEngine().getHostWindow();\r\n if (hostWindow) {\r\n hostWindow.addEventListener(eventPrefix + \"up\", this._onPointerUp, false);\r\n }\r\n }\r\n this._alreadyAttached = true;\r\n };\r\n /**\r\n * Detaches all event handlers\r\n */\r\n InputManager.prototype.detachControl = function () {\r\n var engine = this._scene.getEngine();\r\n var eventPrefix = Tools.GetPointerPrefix(engine);\r\n if (!this._alreadyAttachedTo) {\r\n return;\r\n }\r\n if (!this._alreadyAttached) {\r\n return;\r\n }\r\n // Pointer\r\n this._alreadyAttachedTo.removeEventListener(eventPrefix + \"move\", this._onPointerMove);\r\n this._alreadyAttachedTo.removeEventListener(this._wheelEventName, this._onPointerMove);\r\n this._alreadyAttachedTo.removeEventListener(eventPrefix + \"down\", this._onPointerDown);\r\n window.removeEventListener(eventPrefix + \"up\", this._onPointerUp);\r\n // Blur / Focus\r\n if (this._onCanvasBlurObserver) {\r\n engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n if (this._onCanvasFocusObserver) {\r\n engine.onCanvasFocusObservable.remove(this._onCanvasFocusObserver);\r\n }\r\n // Keyboard\r\n this._alreadyAttachedTo.removeEventListener(\"keydown\", this._onKeyDown);\r\n this._alreadyAttachedTo.removeEventListener(\"keyup\", this._onKeyUp);\r\n // Cursor\r\n if (!this._scene.doNotHandleCursors) {\r\n this._alreadyAttachedTo.style.cursor = this._scene.defaultCursor;\r\n }\r\n this._alreadyAttached = false;\r\n };\r\n /**\r\n * Force the value of meshUnderPointer\r\n * @param mesh defines the mesh to use\r\n * @param pointerId optional pointer id when using more than one pointer. Defaults to 0\r\n */\r\n InputManager.prototype.setPointerOverMesh = function (mesh, pointerId) {\r\n if (pointerId === void 0) { pointerId = 0; }\r\n // Sanity check\r\n if (pointerId < 0) {\r\n pointerId = 0;\r\n }\r\n if (this._meshUnderPointerId[pointerId] === mesh) {\r\n return;\r\n }\r\n var underPointerMesh = this._meshUnderPointerId[pointerId];\r\n var actionManager;\r\n if (underPointerMesh) {\r\n actionManager = underPointerMesh._getActionManagerForTrigger(10);\r\n if (actionManager) {\r\n actionManager.processTrigger(10, ActionEvent.CreateNew(underPointerMesh, undefined, { pointerId: pointerId }));\r\n }\r\n }\r\n this._meshUnderPointerId[pointerId] = mesh;\r\n this._pointerOverMesh = mesh;\r\n underPointerMesh = this._meshUnderPointerId[pointerId];\r\n if (underPointerMesh) {\r\n actionManager = underPointerMesh._getActionManagerForTrigger(9);\r\n if (actionManager) {\r\n actionManager.processTrigger(9, ActionEvent.CreateNew(underPointerMesh, undefined, { pointerId: pointerId }));\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the mesh under the pointer\r\n * @returns a Mesh or null if no mesh is under the pointer\r\n */\r\n InputManager.prototype.getPointerOverMesh = function () {\r\n return this._pointerOverMesh;\r\n };\r\n /** The distance in pixel that you have to move to prevent some events */\r\n InputManager.DragMovementThreshold = 10; // in pixels\r\n /** Time in milliseconds to wait to raise long press events if button is still pressed */\r\n InputManager.LongPressDelay = 500; // in milliseconds\r\n /** Time in milliseconds with two consecutive clicks will be considered as a double click */\r\n InputManager.DoubleClickDelay = 300; // in milliseconds\r\n /** If you need to check double click without raising a single click at first click, enable this flag */\r\n InputManager.ExclusiveDoubleClickMode = false;\r\n return InputManager;\r\n}());\r\nexport { InputManager };\r\n//# sourceMappingURL=scene.inputManager.js.map","/**\r\n * Helper class used to generate session unique ID\r\n */\r\nvar UniqueIdGenerator = /** @class */ (function () {\r\n function UniqueIdGenerator() {\r\n }\r\n Object.defineProperty(UniqueIdGenerator, \"UniqueId\", {\r\n /**\r\n * Gets an unique (relatively to the current scene) Id\r\n */\r\n get: function () {\r\n var result = this._UniqueIdCounter;\r\n this._UniqueIdCounter++;\r\n return result;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Statics\r\n UniqueIdGenerator._UniqueIdCounter = 0;\r\n return UniqueIdGenerator;\r\n}());\r\nexport { UniqueIdGenerator };\r\n//# sourceMappingURL=uniqueIdGenerator.js.map","import { __assign, __extends } from \"tslib\";\r\nimport { Tools } from \"./Misc/tools\";\r\nimport { PrecisionDate } from \"./Misc/precisionDate\";\r\nimport { Observable } from \"./Misc/observable\";\r\nimport { SmartArrayNoDuplicate, SmartArray } from \"./Misc/smartArray\";\r\nimport { StringDictionary } from \"./Misc/stringDictionary\";\r\nimport { Tags } from \"./Misc/tags\";\r\nimport { Vector3, Matrix } from \"./Maths/math.vector\";\r\nimport { TransformNode } from \"./Meshes/transformNode\";\r\nimport { AbstractMesh } from \"./Meshes/abstractMesh\";\r\nimport { Camera } from \"./Cameras/camera\";\r\nimport { AbstractScene } from \"./abstractScene\";\r\nimport { ImageProcessingConfiguration } from \"./Materials/imageProcessingConfiguration\";\r\nimport { UniformBuffer } from \"./Materials/uniformBuffer\";\r\nimport { Light } from \"./Lights/light\";\r\nimport { PickingInfo } from \"./Collisions/pickingInfo\";\r\nimport { ActionEvent } from \"./Actions/actionEvent\";\r\nimport { PostProcessManager } from \"./PostProcesses/postProcessManager\";\r\nimport { RenderingManager } from \"./Rendering/renderingManager\";\r\nimport { Stage } from \"./sceneComponent\";\r\nimport { DomManagement } from \"./Misc/domManagement\";\r\nimport { Logger } from \"./Misc/logger\";\r\nimport { EngineStore } from \"./Engines/engineStore\";\r\nimport { _DevTools } from './Misc/devTools';\r\nimport { InputManager } from './Inputs/scene.inputManager';\r\nimport { PerfCounter } from './Misc/perfCounter';\r\nimport { Color4, Color3 } from './Maths/math.color';\r\nimport { Frustum } from './Maths/math.frustum';\r\nimport { UniqueIdGenerator } from './Misc/uniqueIdGenerator';\r\nimport { FileTools } from './Misc/fileTools';\r\n/**\r\n * Represents a scene to be rendered by the engine.\r\n * @see https://doc.babylonjs.com/features/scene\r\n */\r\nvar Scene = /** @class */ (function (_super) {\r\n __extends(Scene, _super);\r\n /**\r\n * Creates a new Scene\r\n * @param engine defines the engine to use to render this scene\r\n * @param options defines the scene options\r\n */\r\n function Scene(engine, options) {\r\n var _this = _super.call(this) || this;\r\n // Members\r\n /** @hidden */\r\n _this._inputManager = new InputManager(_this);\r\n /** Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position */\r\n _this.cameraToUseForPointers = null;\r\n /** @hidden */\r\n _this._isScene = true;\r\n /** @hidden */\r\n _this._blockEntityCollection = false;\r\n /**\r\n * Gets or sets a boolean that indicates if the scene must clear the render buffer before rendering a frame\r\n */\r\n _this.autoClear = true;\r\n /**\r\n * Gets or sets a boolean that indicates if the scene must clear the depth and stencil buffers before rendering a frame\r\n */\r\n _this.autoClearDepthAndStencil = true;\r\n /**\r\n * Defines the color used to clear the render buffer (Default is (0.2, 0.2, 0.3, 1.0))\r\n */\r\n _this.clearColor = new Color4(0.2, 0.2, 0.3, 1.0);\r\n /**\r\n * Defines the color used to simulate the ambient color (Default is (0, 0, 0))\r\n */\r\n _this.ambientColor = new Color3(0, 0, 0);\r\n /** @hidden */\r\n _this._environmentIntensity = 1;\r\n _this._forceWireframe = false;\r\n _this._skipFrustumClipping = false;\r\n _this._forcePointsCloud = false;\r\n /**\r\n * Gets or sets a boolean indicating if animations are enabled\r\n */\r\n _this.animationsEnabled = true;\r\n _this._animationPropertiesOverride = null;\r\n /**\r\n * Gets or sets a boolean indicating if a constant deltatime has to be used\r\n * This is mostly useful for testing purposes when you do not want the animations to scale with the framerate\r\n */\r\n _this.useConstantAnimationDeltaTime = false;\r\n /**\r\n * Gets or sets a boolean indicating if the scene must keep the meshUnderPointer property updated\r\n * Please note that it requires to run a ray cast through the scene on every frame\r\n */\r\n _this.constantlyUpdateMeshUnderPointer = false;\r\n /**\r\n * Defines the HTML cursor to use when hovering over interactive elements\r\n */\r\n _this.hoverCursor = \"pointer\";\r\n /**\r\n * Defines the HTML default cursor to use (empty by default)\r\n */\r\n _this.defaultCursor = \"\";\r\n /**\r\n * Defines whether cursors are handled by the scene.\r\n */\r\n _this.doNotHandleCursors = false;\r\n /**\r\n * This is used to call preventDefault() on pointer down\r\n * in order to block unwanted artifacts like system double clicks\r\n */\r\n _this.preventDefaultOnPointerDown = true;\r\n /**\r\n * This is used to call preventDefault() on pointer up\r\n * in order to block unwanted artifacts like system double clicks\r\n */\r\n _this.preventDefaultOnPointerUp = true;\r\n // Metadata\r\n /**\r\n * Gets or sets user defined metadata\r\n */\r\n _this.metadata = null;\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n _this.reservedDataStore = null;\r\n /**\r\n * Use this array to add regular expressions used to disable offline support for specific urls\r\n */\r\n _this.disableOfflineSupportExceptionRules = new Array();\r\n /**\r\n * An event triggered when the scene is disposed.\r\n */\r\n _this.onDisposeObservable = new Observable();\r\n _this._onDisposeObserver = null;\r\n /**\r\n * An event triggered before rendering the scene (right after animations and physics)\r\n */\r\n _this.onBeforeRenderObservable = new Observable();\r\n _this._onBeforeRenderObserver = null;\r\n /**\r\n * An event triggered after rendering the scene\r\n */\r\n _this.onAfterRenderObservable = new Observable();\r\n /**\r\n * An event triggered after rendering the scene for an active camera (When scene.render is called this will be called after each camera)\r\n */\r\n _this.onAfterRenderCameraObservable = new Observable();\r\n _this._onAfterRenderObserver = null;\r\n /**\r\n * An event triggered before animating the scene\r\n */\r\n _this.onBeforeAnimationsObservable = new Observable();\r\n /**\r\n * An event triggered after animations processing\r\n */\r\n _this.onAfterAnimationsObservable = new Observable();\r\n /**\r\n * An event triggered before draw calls are ready to be sent\r\n */\r\n _this.onBeforeDrawPhaseObservable = new Observable();\r\n /**\r\n * An event triggered after draw calls have been sent\r\n */\r\n _this.onAfterDrawPhaseObservable = new Observable();\r\n /**\r\n * An event triggered when the scene is ready\r\n */\r\n _this.onReadyObservable = new Observable();\r\n /**\r\n * An event triggered before rendering a camera\r\n */\r\n _this.onBeforeCameraRenderObservable = new Observable();\r\n _this._onBeforeCameraRenderObserver = null;\r\n /**\r\n * An event triggered after rendering a camera\r\n */\r\n _this.onAfterCameraRenderObservable = new Observable();\r\n _this._onAfterCameraRenderObserver = null;\r\n /**\r\n * An event triggered when active meshes evaluation is about to start\r\n */\r\n _this.onBeforeActiveMeshesEvaluationObservable = new Observable();\r\n /**\r\n * An event triggered when active meshes evaluation is done\r\n */\r\n _this.onAfterActiveMeshesEvaluationObservable = new Observable();\r\n /**\r\n * An event triggered when particles rendering is about to start\r\n * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)\r\n */\r\n _this.onBeforeParticlesRenderingObservable = new Observable();\r\n /**\r\n * An event triggered when particles rendering is done\r\n * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)\r\n */\r\n _this.onAfterParticlesRenderingObservable = new Observable();\r\n /**\r\n * An event triggered when SceneLoader.Append or SceneLoader.Load or SceneLoader.ImportMesh were successfully executed\r\n */\r\n _this.onDataLoadedObservable = new Observable();\r\n /**\r\n * An event triggered when a camera is created\r\n */\r\n _this.onNewCameraAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a camera is removed\r\n */\r\n _this.onCameraRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a light is created\r\n */\r\n _this.onNewLightAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a light is removed\r\n */\r\n _this.onLightRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a geometry is created\r\n */\r\n _this.onNewGeometryAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a geometry is removed\r\n */\r\n _this.onGeometryRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a transform node is created\r\n */\r\n _this.onNewTransformNodeAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a transform node is removed\r\n */\r\n _this.onTransformNodeRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a mesh is created\r\n */\r\n _this.onNewMeshAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a mesh is removed\r\n */\r\n _this.onMeshRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a skeleton is created\r\n */\r\n _this.onNewSkeletonAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a skeleton is removed\r\n */\r\n _this.onSkeletonRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a material is created\r\n */\r\n _this.onNewMaterialAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a multi material is created\r\n */\r\n _this.onNewMultiMaterialAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a material is removed\r\n */\r\n _this.onMaterialRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a multi material is removed\r\n */\r\n _this.onMultiMaterialRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a texture is created\r\n */\r\n _this.onNewTextureAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a texture is removed\r\n */\r\n _this.onTextureRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when render targets are about to be rendered\r\n * Can happen multiple times per frame.\r\n */\r\n _this.onBeforeRenderTargetsRenderObservable = new Observable();\r\n /**\r\n * An event triggered when render targets were rendered.\r\n * Can happen multiple times per frame.\r\n */\r\n _this.onAfterRenderTargetsRenderObservable = new Observable();\r\n /**\r\n * An event triggered before calculating deterministic simulation step\r\n */\r\n _this.onBeforeStepObservable = new Observable();\r\n /**\r\n * An event triggered after calculating deterministic simulation step\r\n */\r\n _this.onAfterStepObservable = new Observable();\r\n /**\r\n * An event triggered when the activeCamera property is updated\r\n */\r\n _this.onActiveCameraChanged = new Observable();\r\n /**\r\n * This Observable will be triggered before rendering each renderingGroup of each rendered camera.\r\n * The RenderinGroupInfo class contains all the information about the context in which the observable is called\r\n * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)\r\n */\r\n _this.onBeforeRenderingGroupObservable = new Observable();\r\n /**\r\n * This Observable will be triggered after rendering each renderingGroup of each rendered camera.\r\n * The RenderinGroupInfo class contains all the information about the context in which the observable is called\r\n * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)\r\n */\r\n _this.onAfterRenderingGroupObservable = new Observable();\r\n /**\r\n * This Observable will when a mesh has been imported into the scene.\r\n */\r\n _this.onMeshImportedObservable = new Observable();\r\n /**\r\n * This Observable will when an animation file has been imported into the scene.\r\n */\r\n _this.onAnimationFileImportedObservable = new Observable();\r\n // Animations\r\n /** @hidden */\r\n _this._registeredForLateAnimationBindings = new SmartArrayNoDuplicate(256);\r\n /**\r\n * This observable event is triggered when any ponter event is triggered. It is registered during Scene.attachControl() and it is called BEFORE the 3D engine process anything (mesh/sprite picking for instance).\r\n * You have the possibility to skip the process and the call to onPointerObservable by setting PointerInfoPre.skipOnPointerObservable to true\r\n */\r\n _this.onPrePointerObservable = new Observable();\r\n /**\r\n * Observable event triggered each time an input event is received from the rendering canvas\r\n */\r\n _this.onPointerObservable = new Observable();\r\n // Keyboard\r\n /**\r\n * This observable event is triggered when any keyboard event si raised and registered during Scene.attachControl()\r\n * You have the possibility to skip the process and the call to onKeyboardObservable by setting KeyboardInfoPre.skipOnPointerObservable to true\r\n */\r\n _this.onPreKeyboardObservable = new Observable();\r\n /**\r\n * Observable event triggered each time an keyboard event is received from the hosting window\r\n */\r\n _this.onKeyboardObservable = new Observable();\r\n // Coordinates system\r\n _this._useRightHandedSystem = false;\r\n // Deterministic lockstep\r\n _this._timeAccumulator = 0;\r\n _this._currentStepId = 0;\r\n _this._currentInternalStep = 0;\r\n // Fog\r\n _this._fogEnabled = true;\r\n _this._fogMode = Scene.FOGMODE_NONE;\r\n /**\r\n * Gets or sets the fog color to use\r\n * @see https://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is Color3(0.2, 0.2, 0.3))\r\n */\r\n _this.fogColor = new Color3(0.2, 0.2, 0.3);\r\n /**\r\n * Gets or sets the fog density to use\r\n * @see https://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is 0.1)\r\n */\r\n _this.fogDensity = 0.1;\r\n /**\r\n * Gets or sets the fog start distance to use\r\n * @see https://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is 0)\r\n */\r\n _this.fogStart = 0;\r\n /**\r\n * Gets or sets the fog end distance to use\r\n * @see https://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is 1000)\r\n */\r\n _this.fogEnd = 1000.0;\r\n /**\r\n * Flag indicating that the frame buffer binding is handled by another component\r\n */\r\n _this.prePass = false;\r\n // Lights\r\n _this._shadowsEnabled = true;\r\n _this._lightsEnabled = true;\r\n /** All of the active cameras added to this scene. */\r\n _this.activeCameras = new Array();\r\n // Textures\r\n _this._texturesEnabled = true;\r\n // Physics\r\n /**\r\n * Gets or sets a boolean indicating if physic engines are enabled on this scene\r\n */\r\n _this.physicsEnabled = true;\r\n // Particles\r\n /**\r\n * Gets or sets a boolean indicating if particles are enabled on this scene\r\n */\r\n _this.particlesEnabled = true;\r\n // Sprites\r\n /**\r\n * Gets or sets a boolean indicating if sprites are enabled on this scene\r\n */\r\n _this.spritesEnabled = true;\r\n // Skeletons\r\n _this._skeletonsEnabled = true;\r\n // Lens flares\r\n /**\r\n * Gets or sets a boolean indicating if lens flares are enabled on this scene\r\n */\r\n _this.lensFlaresEnabled = true;\r\n // Collisions\r\n /**\r\n * Gets or sets a boolean indicating if collisions are enabled on this scene\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.collisionsEnabled = true;\r\n /**\r\n * Defines the gravity applied to this scene (used only for collisions)\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.gravity = new Vector3(0, -9.807, 0);\r\n // Postprocesses\r\n /**\r\n * Gets or sets a boolean indicating if postprocesses are enabled on this scene\r\n */\r\n _this.postProcessesEnabled = true;\r\n // Customs render targets\r\n /**\r\n * Gets or sets a boolean indicating if render targets are enabled on this scene\r\n */\r\n _this.renderTargetsEnabled = true;\r\n /**\r\n * Gets or sets a boolean indicating if next render targets must be dumped as image for debugging purposes\r\n * We recommend not using it and instead rely on Spector.js: http://spector.babylonjs.com\r\n */\r\n _this.dumpNextRenderTargets = false;\r\n /**\r\n * The list of user defined render targets added to the scene\r\n */\r\n _this.customRenderTargets = new Array();\r\n /**\r\n * Gets the list of meshes imported to the scene through SceneLoader\r\n */\r\n _this.importedMeshesFiles = new Array();\r\n // Probes\r\n /**\r\n * Gets or sets a boolean indicating if probes are enabled on this scene\r\n */\r\n _this.probesEnabled = true;\r\n _this._meshesForIntersections = new SmartArrayNoDuplicate(256);\r\n // Procedural textures\r\n /**\r\n * Gets or sets a boolean indicating if procedural textures are enabled on this scene\r\n */\r\n _this.proceduralTexturesEnabled = true;\r\n // Performance counters\r\n _this._totalVertices = new PerfCounter();\r\n /** @hidden */\r\n _this._activeIndices = new PerfCounter();\r\n /** @hidden */\r\n _this._activeParticles = new PerfCounter();\r\n /** @hidden */\r\n _this._activeBones = new PerfCounter();\r\n /** @hidden */\r\n _this._animationTime = 0;\r\n /**\r\n * Gets or sets a general scale for animation speed\r\n * @see https://www.babylonjs-playground.com/#IBU2W7#3\r\n */\r\n _this.animationTimeScale = 1;\r\n _this._renderId = 0;\r\n _this._frameId = 0;\r\n _this._executeWhenReadyTimeoutId = -1;\r\n _this._intermediateRendering = false;\r\n _this._viewUpdateFlag = -1;\r\n _this._projectionUpdateFlag = -1;\r\n /** @hidden */\r\n _this._toBeDisposed = new Array(256);\r\n _this._activeRequests = new Array();\r\n /** @hidden */\r\n _this._pendingData = new Array();\r\n _this._isDisposed = false;\r\n /**\r\n * Gets or sets a boolean indicating that all submeshes of active meshes must be rendered\r\n * Use this boolean to avoid computing frustum clipping on submeshes (This could help when you are CPU bound)\r\n */\r\n _this.dispatchAllSubMeshesOfActiveMeshes = false;\r\n _this._activeMeshes = new SmartArray(256);\r\n _this._processedMaterials = new SmartArray(256);\r\n _this._renderTargets = new SmartArrayNoDuplicate(256);\r\n /** @hidden */\r\n _this._activeParticleSystems = new SmartArray(256);\r\n _this._activeSkeletons = new SmartArrayNoDuplicate(32);\r\n _this._softwareSkinnedMeshes = new SmartArrayNoDuplicate(32);\r\n /** @hidden */\r\n _this._activeAnimatables = new Array();\r\n _this._transformMatrix = Matrix.Zero();\r\n /**\r\n * Gets or sets a boolean indicating if lights must be sorted by priority (off by default)\r\n * This is useful if there are more lights that the maximum simulteanous authorized\r\n */\r\n _this.requireLightSorting = false;\r\n /**\r\n * @hidden\r\n * Backing store of defined scene components.\r\n */\r\n _this._components = [];\r\n /**\r\n * @hidden\r\n * Backing store of defined scene components.\r\n */\r\n _this._serializableComponents = [];\r\n /**\r\n * List of components to register on the next registration step.\r\n */\r\n _this._transientComponents = [];\r\n /**\r\n * @hidden\r\n * Defines the actions happening before camera updates.\r\n */\r\n _this._beforeCameraUpdateStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening before clear the canvas.\r\n */\r\n _this._beforeClearStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions when collecting render targets for the frame.\r\n */\r\n _this._gatherRenderTargetsStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening for one camera in the frame.\r\n */\r\n _this._gatherActiveCameraRenderTargetsStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the per mesh ready checks.\r\n */\r\n _this._isReadyForMeshStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening before evaluate active mesh checks.\r\n */\r\n _this._beforeEvaluateActiveMeshStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the evaluate sub mesh checks.\r\n */\r\n _this._evaluateSubMeshStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the active mesh stage.\r\n */\r\n _this._preActiveMeshStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the per camera render target step.\r\n */\r\n _this._cameraDrawRenderTargetStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before the active camera is drawing.\r\n */\r\n _this._beforeCameraDrawStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before a render target is drawing.\r\n */\r\n _this._beforeRenderTargetDrawStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before a rendering group is drawing.\r\n */\r\n _this._beforeRenderingGroupDrawStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before a mesh is drawing.\r\n */\r\n _this._beforeRenderingMeshStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after a mesh has been drawn.\r\n */\r\n _this._afterRenderingMeshStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after a rendering group has been drawn.\r\n */\r\n _this._afterRenderingGroupDrawStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after the active camera has been drawn.\r\n */\r\n _this._afterCameraDrawStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after a render target has been drawn.\r\n */\r\n _this._afterRenderTargetDrawStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after rendering all cameras and computing intersections.\r\n */\r\n _this._afterRenderStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening when a pointer move event happens.\r\n */\r\n _this._pointerMoveStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening when a pointer down event happens.\r\n */\r\n _this._pointerDownStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening when a pointer up event happens.\r\n */\r\n _this._pointerUpStage = Stage.Create();\r\n /**\r\n * an optional map from Geometry Id to Geometry index in the 'geometries' array\r\n */\r\n _this.geometriesByUniqueId = null;\r\n _this._defaultMeshCandidates = {\r\n data: [],\r\n length: 0\r\n };\r\n _this._defaultSubMeshCandidates = {\r\n data: [],\r\n length: 0\r\n };\r\n _this._preventFreeActiveMeshesAndRenderingGroups = false;\r\n /** @hidden */\r\n _this._activeMeshesFrozen = false;\r\n _this._skipEvaluateActiveMeshesCompletely = false;\r\n /** @hidden */\r\n _this._allowPostProcessClearColor = true;\r\n /**\r\n * User updatable function that will return a deterministic frame time when engine is in deterministic lock step mode\r\n */\r\n _this.getDeterministicFrameTime = function () {\r\n return _this._engine.getTimeStep();\r\n };\r\n _this._blockMaterialDirtyMechanism = false;\r\n var fullOptions = __assign({ useGeometryUniqueIdsMap: true, useMaterialMeshMap: true, useClonedMeshMap: true, virtual: false }, options);\r\n _this._engine = engine || EngineStore.LastCreatedEngine;\r\n if (!fullOptions.virtual) {\r\n EngineStore._LastCreatedScene = _this;\r\n _this._engine.scenes.push(_this);\r\n }\r\n _this._uid = null;\r\n _this._renderingManager = new RenderingManager(_this);\r\n if (PostProcessManager) {\r\n _this.postProcessManager = new PostProcessManager(_this);\r\n }\r\n if (DomManagement.IsWindowObjectExist()) {\r\n _this.attachControl();\r\n }\r\n // Uniform Buffer\r\n _this._createUbo();\r\n // Default Image processing definition\r\n if (ImageProcessingConfiguration) {\r\n _this._imageProcessingConfiguration = new ImageProcessingConfiguration();\r\n }\r\n _this.setDefaultCandidateProviders();\r\n if (fullOptions.useGeometryUniqueIdsMap) {\r\n _this.geometriesByUniqueId = {};\r\n }\r\n _this.useMaterialMeshMap = fullOptions.useMaterialMeshMap;\r\n _this.useClonedMeshMap = fullOptions.useClonedMeshMap;\r\n if (!options || !options.virtual) {\r\n _this._engine.onNewSceneAddedObservable.notifyObservers(_this);\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Factory used to create the default material.\r\n * @param name The name of the material to create\r\n * @param scene The scene to create the material for\r\n * @returns The default material\r\n */\r\n Scene.DefaultMaterialFactory = function (scene) {\r\n throw _DevTools.WarnImport(\"StandardMaterial\");\r\n };\r\n /**\r\n * Factory used to create the a collision coordinator.\r\n * @returns The collision coordinator\r\n */\r\n Scene.CollisionCoordinatorFactory = function () {\r\n throw _DevTools.WarnImport(\"DefaultCollisionCoordinator\");\r\n };\r\n Object.defineProperty(Scene.prototype, \"environmentTexture\", {\r\n /**\r\n * Texture used in all pbr material as the reflection texture.\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to reference from here than from all the materials.\r\n */\r\n get: function () {\r\n return this._environmentTexture;\r\n },\r\n /**\r\n * Texture used in all pbr material as the reflection texture.\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to set here than in all the materials.\r\n */\r\n set: function (value) {\r\n if (this._environmentTexture === value) {\r\n return;\r\n }\r\n this._environmentTexture = value;\r\n this.markAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"environmentIntensity\", {\r\n /**\r\n * Intensity of the environment in all pbr material.\r\n * This dims or reinforces the IBL lighting overall (reflection and diffuse).\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to reference from here than from all the materials.\r\n */\r\n get: function () {\r\n return this._environmentIntensity;\r\n },\r\n /**\r\n * Intensity of the environment in all pbr material.\r\n * This dims or reinforces the IBL lighting overall (reflection and diffuse).\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to set here than in all the materials.\r\n */\r\n set: function (value) {\r\n if (this._environmentIntensity === value) {\r\n return;\r\n }\r\n this._environmentIntensity = value;\r\n this.markAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Default image processing configuration used either in the rendering\r\n * Forward main pass or through the imageProcessingPostProcess if present.\r\n * As in the majority of the scene they are the same (exception for multi camera),\r\n * this is easier to reference from here than from all the materials and post process.\r\n *\r\n * No setter as we it is a shared configuration, you can set the values instead.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"forceWireframe\", {\r\n get: function () {\r\n return this._forceWireframe;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if all rendering must be done in wireframe\r\n */\r\n set: function (value) {\r\n if (this._forceWireframe === value) {\r\n return;\r\n }\r\n this._forceWireframe = value;\r\n this.markAllMaterialsAsDirty(16);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"skipFrustumClipping\", {\r\n get: function () {\r\n return this._skipFrustumClipping;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if we should skip the frustum clipping part of the active meshes selection\r\n */\r\n set: function (value) {\r\n if (this._skipFrustumClipping === value) {\r\n return;\r\n }\r\n this._skipFrustumClipping = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"forcePointsCloud\", {\r\n get: function () {\r\n return this._forcePointsCloud;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if all rendering must be done in point cloud\r\n */\r\n set: function (value) {\r\n if (this._forcePointsCloud === value) {\r\n return;\r\n }\r\n this._forcePointsCloud = value;\r\n this.markAllMaterialsAsDirty(16);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n get: function () {\r\n return this._animationPropertiesOverride;\r\n },\r\n set: function (value) {\r\n this._animationPropertiesOverride = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"onDispose\", {\r\n /** Sets a function to be executed when this scene is disposed. */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"beforeRender\", {\r\n /** Sets a function to be executed before rendering this scene */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n if (callback) {\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"afterRender\", {\r\n /** Sets a function to be executed after rendering this scene */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n if (callback) {\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"beforeCameraRender\", {\r\n /** Sets a function to be executed before rendering a camera*/\r\n set: function (callback) {\r\n if (this._onBeforeCameraRenderObserver) {\r\n this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n }\r\n this._onBeforeCameraRenderObserver = this.onBeforeCameraRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"afterCameraRender\", {\r\n /** Sets a function to be executed after rendering a camera*/\r\n set: function (callback) {\r\n if (this._onAfterCameraRenderObserver) {\r\n this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver);\r\n }\r\n this._onAfterCameraRenderObserver = this.onAfterCameraRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"unTranslatedPointer\", {\r\n /**\r\n * Gets the pointer coordinates without any translation (ie. straight out of the pointer event)\r\n */\r\n get: function () {\r\n return this._inputManager.unTranslatedPointer;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"DragMovementThreshold\", {\r\n /**\r\n * Gets or sets the distance in pixel that you have to move to prevent some events. Default is 10 pixels\r\n */\r\n get: function () {\r\n return InputManager.DragMovementThreshold;\r\n },\r\n set: function (value) {\r\n InputManager.DragMovementThreshold = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"LongPressDelay\", {\r\n /**\r\n * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 500 ms\r\n */\r\n get: function () {\r\n return InputManager.LongPressDelay;\r\n },\r\n set: function (value) {\r\n InputManager.LongPressDelay = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"DoubleClickDelay\", {\r\n /**\r\n * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 300 ms\r\n */\r\n get: function () {\r\n return InputManager.DoubleClickDelay;\r\n },\r\n set: function (value) {\r\n InputManager.DoubleClickDelay = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"ExclusiveDoubleClickMode\", {\r\n /** If you need to check double click without raising a single click at first click, enable this flag */\r\n get: function () {\r\n return InputManager.ExclusiveDoubleClickMode;\r\n },\r\n set: function (value) {\r\n InputManager.ExclusiveDoubleClickMode = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"useRightHandedSystem\", {\r\n get: function () {\r\n return this._useRightHandedSystem;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if the scene must use right-handed coordinates system\r\n */\r\n set: function (value) {\r\n if (this._useRightHandedSystem === value) {\r\n return;\r\n }\r\n this._useRightHandedSystem = value;\r\n this.markAllMaterialsAsDirty(16);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the step Id used by deterministic lock step\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @param newStepId defines the step Id\r\n */\r\n Scene.prototype.setStepId = function (newStepId) {\r\n this._currentStepId = newStepId;\r\n };\r\n /**\r\n * Gets the step Id used by deterministic lock step\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns the step Id\r\n */\r\n Scene.prototype.getStepId = function () {\r\n return this._currentStepId;\r\n };\r\n /**\r\n * Gets the internal step used by deterministic lock step\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns the internal step\r\n */\r\n Scene.prototype.getInternalStep = function () {\r\n return this._currentInternalStep;\r\n };\r\n Object.defineProperty(Scene.prototype, \"fogEnabled\", {\r\n get: function () {\r\n return this._fogEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if fog is enabled on this scene\r\n * @see https://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is true)\r\n */\r\n set: function (value) {\r\n if (this._fogEnabled === value) {\r\n return;\r\n }\r\n this._fogEnabled = value;\r\n this.markAllMaterialsAsDirty(16);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"fogMode\", {\r\n get: function () {\r\n return this._fogMode;\r\n },\r\n /**\r\n * Gets or sets the fog mode to use\r\n * @see https://doc.babylonjs.com/babylon101/environment#fog\r\n * | mode | value |\r\n * | --- | --- |\r\n * | FOGMODE_NONE | 0 |\r\n * | FOGMODE_EXP | 1 |\r\n * | FOGMODE_EXP2 | 2 |\r\n * | FOGMODE_LINEAR | 3 |\r\n */\r\n set: function (value) {\r\n if (this._fogMode === value) {\r\n return;\r\n }\r\n this._fogMode = value;\r\n this.markAllMaterialsAsDirty(16);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"shadowsEnabled\", {\r\n get: function () {\r\n return this._shadowsEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if shadows are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._shadowsEnabled === value) {\r\n return;\r\n }\r\n this._shadowsEnabled = value;\r\n this.markAllMaterialsAsDirty(2);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"lightsEnabled\", {\r\n get: function () {\r\n return this._lightsEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if lights are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._lightsEnabled === value) {\r\n return;\r\n }\r\n this._lightsEnabled = value;\r\n this.markAllMaterialsAsDirty(2);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"activeCamera\", {\r\n /** Gets or sets the current active camera */\r\n get: function () {\r\n return this._activeCamera;\r\n },\r\n set: function (value) {\r\n if (value === this._activeCamera) {\r\n return;\r\n }\r\n this._activeCamera = value;\r\n this.onActiveCameraChanged.notifyObservers(this);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"defaultMaterial\", {\r\n /** The default material used on meshes when no material is affected */\r\n get: function () {\r\n if (!this._defaultMaterial) {\r\n this._defaultMaterial = Scene.DefaultMaterialFactory(this);\r\n }\r\n return this._defaultMaterial;\r\n },\r\n /** The default material used on meshes when no material is affected */\r\n set: function (value) {\r\n this._defaultMaterial = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"texturesEnabled\", {\r\n get: function () {\r\n return this._texturesEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if textures are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._texturesEnabled === value) {\r\n return;\r\n }\r\n this._texturesEnabled = value;\r\n this.markAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"skeletonsEnabled\", {\r\n get: function () {\r\n return this._skeletonsEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if skeletons are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._skeletonsEnabled === value) {\r\n return;\r\n }\r\n this._skeletonsEnabled = value;\r\n this.markAllMaterialsAsDirty(8);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"collisionCoordinator\", {\r\n /** @hidden */\r\n get: function () {\r\n if (!this._collisionCoordinator) {\r\n this._collisionCoordinator = Scene.CollisionCoordinatorFactory();\r\n this._collisionCoordinator.init(this);\r\n }\r\n return this._collisionCoordinator;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"frustumPlanes\", {\r\n /**\r\n * Gets the list of frustum planes (built from the active camera)\r\n */\r\n get: function () {\r\n return this._frustumPlanes;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Registers the transient components if needed.\r\n */\r\n Scene.prototype._registerTransientComponents = function () {\r\n // Register components that have been associated lately to the scene.\r\n if (this._transientComponents.length > 0) {\r\n for (var _i = 0, _a = this._transientComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.register();\r\n }\r\n this._transientComponents = [];\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * Add a component to the scene.\r\n * Note that the ccomponent could be registered on th next frame if this is called after\r\n * the register component stage.\r\n * @param component Defines the component to add to the scene\r\n */\r\n Scene.prototype._addComponent = function (component) {\r\n this._components.push(component);\r\n this._transientComponents.push(component);\r\n var serializableComponent = component;\r\n if (serializableComponent.addFromContainer && serializableComponent.serialize) {\r\n this._serializableComponents.push(serializableComponent);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * Gets a component from the scene.\r\n * @param name defines the name of the component to retrieve\r\n * @returns the component or null if not present\r\n */\r\n Scene.prototype._getComponent = function (name) {\r\n for (var _i = 0, _a = this._components; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n if (component.name === name) {\r\n return component;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"Scene\" string\r\n */\r\n Scene.prototype.getClassName = function () {\r\n return \"Scene\";\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Scene.prototype._getDefaultMeshCandidates = function () {\r\n this._defaultMeshCandidates.data = this.meshes;\r\n this._defaultMeshCandidates.length = this.meshes.length;\r\n return this._defaultMeshCandidates;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Scene.prototype._getDefaultSubMeshCandidates = function (mesh) {\r\n this._defaultSubMeshCandidates.data = mesh.subMeshes;\r\n this._defaultSubMeshCandidates.length = mesh.subMeshes.length;\r\n return this._defaultSubMeshCandidates;\r\n };\r\n /**\r\n * Sets the default candidate providers for the scene.\r\n * This sets the getActiveMeshCandidates, getActiveSubMeshCandidates, getIntersectingSubMeshCandidates\r\n * and getCollidingSubMeshCandidates to their default function\r\n */\r\n Scene.prototype.setDefaultCandidateProviders = function () {\r\n this.getActiveMeshCandidates = this._getDefaultMeshCandidates.bind(this);\r\n this.getActiveSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\r\n this.getIntersectingSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\r\n this.getCollidingSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\r\n };\r\n Object.defineProperty(Scene.prototype, \"meshUnderPointer\", {\r\n /**\r\n * Gets the mesh that is currently under the pointer\r\n */\r\n get: function () {\r\n return this._inputManager.meshUnderPointer;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"pointerX\", {\r\n /**\r\n * Gets or sets the current on-screen X position of the pointer\r\n */\r\n get: function () {\r\n return this._inputManager.pointerX;\r\n },\r\n set: function (value) {\r\n this._inputManager.pointerX = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"pointerY\", {\r\n /**\r\n * Gets or sets the current on-screen Y position of the pointer\r\n */\r\n get: function () {\r\n return this._inputManager.pointerY;\r\n },\r\n set: function (value) {\r\n this._inputManager.pointerY = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the cached material (ie. the latest rendered one)\r\n * @returns the cached material\r\n */\r\n Scene.prototype.getCachedMaterial = function () {\r\n return this._cachedMaterial;\r\n };\r\n /**\r\n * Gets the cached effect (ie. the latest rendered one)\r\n * @returns the cached effect\r\n */\r\n Scene.prototype.getCachedEffect = function () {\r\n return this._cachedEffect;\r\n };\r\n /**\r\n * Gets the cached visibility state (ie. the latest rendered one)\r\n * @returns the cached visibility state\r\n */\r\n Scene.prototype.getCachedVisibility = function () {\r\n return this._cachedVisibility;\r\n };\r\n /**\r\n * Gets a boolean indicating if the current material / effect / visibility must be bind again\r\n * @param material defines the current material\r\n * @param effect defines the current effect\r\n * @param visibility defines the current visibility state\r\n * @returns true if one parameter is not cached\r\n */\r\n Scene.prototype.isCachedMaterialInvalid = function (material, effect, visibility) {\r\n if (visibility === void 0) { visibility = 1; }\r\n return this._cachedEffect !== effect || this._cachedMaterial !== material || this._cachedVisibility !== visibility;\r\n };\r\n /**\r\n * Gets the engine associated with the scene\r\n * @returns an Engine\r\n */\r\n Scene.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * Gets the total number of vertices rendered per frame\r\n * @returns the total number of vertices rendered per frame\r\n */\r\n Scene.prototype.getTotalVertices = function () {\r\n return this._totalVertices.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"totalVerticesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for total vertices\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._totalVertices;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the total number of active indices rendered per frame (You can deduce the number of rendered triangles by dividing this number by 3)\r\n * @returns the total number of active indices rendered per frame\r\n */\r\n Scene.prototype.getActiveIndices = function () {\r\n return this._activeIndices.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"totalActiveIndicesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for active indices\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._activeIndices;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the total number of active particles rendered per frame\r\n * @returns the total number of active particles rendered per frame\r\n */\r\n Scene.prototype.getActiveParticles = function () {\r\n return this._activeParticles.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"activeParticlesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for active particles\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._activeParticles;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the total number of active bones rendered per frame\r\n * @returns the total number of active bones rendered per frame\r\n */\r\n Scene.prototype.getActiveBones = function () {\r\n return this._activeBones.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"activeBonesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for active bones\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._activeBones;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the array of active meshes\r\n * @returns an array of AbstractMesh\r\n */\r\n Scene.prototype.getActiveMeshes = function () {\r\n return this._activeMeshes;\r\n };\r\n /**\r\n * Gets the animation ratio (which is 1.0 is the scene renders at 60fps and 2 if the scene renders at 30fps, etc.)\r\n * @returns a number\r\n */\r\n Scene.prototype.getAnimationRatio = function () {\r\n return this._animationRatio !== undefined ? this._animationRatio : 1;\r\n };\r\n /**\r\n * Gets an unique Id for the current render phase\r\n * @returns a number\r\n */\r\n Scene.prototype.getRenderId = function () {\r\n return this._renderId;\r\n };\r\n /**\r\n * Gets an unique Id for the current frame\r\n * @returns a number\r\n */\r\n Scene.prototype.getFrameId = function () {\r\n return this._frameId;\r\n };\r\n /** Call this function if you want to manually increment the render Id*/\r\n Scene.prototype.incrementRenderId = function () {\r\n this._renderId++;\r\n };\r\n Scene.prototype._createUbo = function () {\r\n this._sceneUbo = new UniformBuffer(this._engine, undefined, true);\r\n this._sceneUbo.addUniform(\"viewProjection\", 16);\r\n this._sceneUbo.addUniform(\"view\", 16);\r\n };\r\n /**\r\n * Use this method to simulate a pointer move on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.simulatePointerMove = function (pickResult, pointerEventInit) {\r\n this._inputManager.simulatePointerMove(pickResult, pointerEventInit);\r\n return this;\r\n };\r\n /**\r\n * Use this method to simulate a pointer down on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.simulatePointerDown = function (pickResult, pointerEventInit) {\r\n this._inputManager.simulatePointerDown(pickResult, pointerEventInit);\r\n return this;\r\n };\r\n /**\r\n * Use this method to simulate a pointer up on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @param doubleTap indicates that the pointer up event should be considered as part of a double click (false by default)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.simulatePointerUp = function (pickResult, pointerEventInit, doubleTap) {\r\n this._inputManager.simulatePointerUp(pickResult, pointerEventInit, doubleTap);\r\n return this;\r\n };\r\n /**\r\n * Gets a boolean indicating if the current pointer event is captured (meaning that the scene has already handled the pointer down)\r\n * @param pointerId defines the pointer id to use in a multi-touch scenario (0 by default)\r\n * @returns true if the pointer was captured\r\n */\r\n Scene.prototype.isPointerCaptured = function (pointerId) {\r\n if (pointerId === void 0) { pointerId = 0; }\r\n return this._inputManager.isPointerCaptured(pointerId);\r\n };\r\n /**\r\n * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp\r\n * @param attachUp defines if you want to attach events to pointerup\r\n * @param attachDown defines if you want to attach events to pointerdown\r\n * @param attachMove defines if you want to attach events to pointermove\r\n */\r\n Scene.prototype.attachControl = function (attachUp, attachDown, attachMove) {\r\n if (attachUp === void 0) { attachUp = true; }\r\n if (attachDown === void 0) { attachDown = true; }\r\n if (attachMove === void 0) { attachMove = true; }\r\n this._inputManager.attachControl(attachUp, attachDown, attachMove);\r\n };\r\n /** Detaches all event handlers*/\r\n Scene.prototype.detachControl = function () {\r\n this._inputManager.detachControl();\r\n };\r\n /**\r\n * This function will check if the scene can be rendered (textures are loaded, shaders are compiled)\r\n * Delay loaded resources are not taking in account\r\n * @return true if all required resources are ready\r\n */\r\n Scene.prototype.isReady = function () {\r\n if (this._isDisposed) {\r\n return false;\r\n }\r\n var index;\r\n var engine = this.getEngine();\r\n // Effects\r\n if (!engine.areAllEffectsReady()) {\r\n return false;\r\n }\r\n // Pending data\r\n if (this._pendingData.length > 0) {\r\n return false;\r\n }\r\n // Meshes\r\n for (index = 0; index < this.meshes.length; index++) {\r\n var mesh = this.meshes[index];\r\n if (!mesh.isEnabled()) {\r\n continue;\r\n }\r\n if (!mesh.subMeshes || mesh.subMeshes.length === 0) {\r\n continue;\r\n }\r\n if (!mesh.isReady(true)) {\r\n return false;\r\n }\r\n var hardwareInstancedRendering = mesh.hasThinInstances || mesh.getClassName() === \"InstancedMesh\" || mesh.getClassName() === \"InstancedLinesMesh\" || engine.getCaps().instancedArrays && mesh.instances.length > 0;\r\n // Is Ready For Mesh\r\n for (var _i = 0, _a = this._isReadyForMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n if (!step.action(mesh, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n // Geometries\r\n for (index = 0; index < this.geometries.length; index++) {\r\n var geometry = this.geometries[index];\r\n if (geometry.delayLoadState === 2) {\r\n return false;\r\n }\r\n }\r\n // Post-processes\r\n if (this.activeCameras && this.activeCameras.length > 0) {\r\n for (var _b = 0, _c = this.activeCameras; _b < _c.length; _b++) {\r\n var camera = _c[_b];\r\n if (!camera.isReady(true)) {\r\n return false;\r\n }\r\n }\r\n }\r\n else if (this.activeCamera) {\r\n if (!this.activeCamera.isReady(true)) {\r\n return false;\r\n }\r\n }\r\n // Particles\r\n for (var _d = 0, _e = this.particleSystems; _d < _e.length; _d++) {\r\n var particleSystem = _e[_d];\r\n if (!particleSystem.isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /** Resets all cached information relative to material (including effect and visibility) */\r\n Scene.prototype.resetCachedMaterial = function () {\r\n this._cachedMaterial = null;\r\n this._cachedEffect = null;\r\n this._cachedVisibility = null;\r\n };\r\n /**\r\n * Registers a function to be called before every frame render\r\n * @param func defines the function to register\r\n */\r\n Scene.prototype.registerBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.add(func);\r\n };\r\n /**\r\n * Unregisters a function called before every frame render\r\n * @param func defines the function to unregister\r\n */\r\n Scene.prototype.unregisterBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.removeCallback(func);\r\n };\r\n /**\r\n * Registers a function to be called after every frame render\r\n * @param func defines the function to register\r\n */\r\n Scene.prototype.registerAfterRender = function (func) {\r\n this.onAfterRenderObservable.add(func);\r\n };\r\n /**\r\n * Unregisters a function called after every frame render\r\n * @param func defines the function to unregister\r\n */\r\n Scene.prototype.unregisterAfterRender = function (func) {\r\n this.onAfterRenderObservable.removeCallback(func);\r\n };\r\n Scene.prototype._executeOnceBeforeRender = function (func) {\r\n var _this = this;\r\n var execFunc = function () {\r\n func();\r\n setTimeout(function () {\r\n _this.unregisterBeforeRender(execFunc);\r\n });\r\n };\r\n this.registerBeforeRender(execFunc);\r\n };\r\n /**\r\n * The provided function will run before render once and will be disposed afterwards.\r\n * A timeout delay can be provided so that the function will be executed in N ms.\r\n * The timeout is using the browser's native setTimeout so time percision cannot be guaranteed.\r\n * @param func The function to be executed.\r\n * @param timeout optional delay in ms\r\n */\r\n Scene.prototype.executeOnceBeforeRender = function (func, timeout) {\r\n var _this = this;\r\n if (timeout !== undefined) {\r\n setTimeout(function () {\r\n _this._executeOnceBeforeRender(func);\r\n }, timeout);\r\n }\r\n else {\r\n this._executeOnceBeforeRender(func);\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._addPendingData = function (data) {\r\n this._pendingData.push(data);\r\n };\r\n /** @hidden */\r\n Scene.prototype._removePendingData = function (data) {\r\n var wasLoading = this.isLoading;\r\n var index = this._pendingData.indexOf(data);\r\n if (index !== -1) {\r\n this._pendingData.splice(index, 1);\r\n }\r\n if (wasLoading && !this.isLoading) {\r\n this.onDataLoadedObservable.notifyObservers(this);\r\n }\r\n };\r\n /**\r\n * Returns the number of items waiting to be loaded\r\n * @returns the number of items waiting to be loaded\r\n */\r\n Scene.prototype.getWaitingItemsCount = function () {\r\n return this._pendingData.length;\r\n };\r\n Object.defineProperty(Scene.prototype, \"isLoading\", {\r\n /**\r\n * Returns a boolean indicating if the scene is still loading data\r\n */\r\n get: function () {\r\n return this._pendingData.length > 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Registers a function to be executed when the scene is ready\r\n * @param {Function} func - the function to be executed\r\n */\r\n Scene.prototype.executeWhenReady = function (func) {\r\n var _this = this;\r\n this.onReadyObservable.add(func);\r\n if (this._executeWhenReadyTimeoutId !== -1) {\r\n return;\r\n }\r\n this._executeWhenReadyTimeoutId = setTimeout(function () {\r\n _this._checkIsReady();\r\n }, 150);\r\n };\r\n /**\r\n * Returns a promise that resolves when the scene is ready\r\n * @returns A promise that resolves when the scene is ready\r\n */\r\n Scene.prototype.whenReadyAsync = function () {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _this.executeWhenReady(function () {\r\n resolve();\r\n });\r\n });\r\n };\r\n /** @hidden */\r\n Scene.prototype._checkIsReady = function () {\r\n var _this = this;\r\n this._registerTransientComponents();\r\n if (this.isReady()) {\r\n this.onReadyObservable.notifyObservers(this);\r\n this.onReadyObservable.clear();\r\n this._executeWhenReadyTimeoutId = -1;\r\n return;\r\n }\r\n if (this._isDisposed) {\r\n this.onReadyObservable.clear();\r\n this._executeWhenReadyTimeoutId = -1;\r\n return;\r\n }\r\n this._executeWhenReadyTimeoutId = setTimeout(function () {\r\n _this._checkIsReady();\r\n }, 150);\r\n };\r\n Object.defineProperty(Scene.prototype, \"animatables\", {\r\n /**\r\n * Gets all animatable attached to the scene\r\n */\r\n get: function () {\r\n return this._activeAnimatables;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Resets the last animation time frame.\r\n * Useful to override when animations start running when loading a scene for the first time.\r\n */\r\n Scene.prototype.resetLastAnimationTimeFrame = function () {\r\n this._animationTimeLast = PrecisionDate.Now;\r\n };\r\n // Matrix\r\n /**\r\n * Gets the current view matrix\r\n * @returns a Matrix\r\n */\r\n Scene.prototype.getViewMatrix = function () {\r\n return this._viewMatrix;\r\n };\r\n /**\r\n * Gets the current projection matrix\r\n * @returns a Matrix\r\n */\r\n Scene.prototype.getProjectionMatrix = function () {\r\n return this._projectionMatrix;\r\n };\r\n /**\r\n * Gets the current transform matrix\r\n * @returns a Matrix made of View * Projection\r\n */\r\n Scene.prototype.getTransformMatrix = function () {\r\n return this._transformMatrix;\r\n };\r\n /**\r\n * Sets the current transform matrix\r\n * @param viewL defines the View matrix to use\r\n * @param projectionL defines the Projection matrix to use\r\n * @param viewR defines the right View matrix to use (if provided)\r\n * @param projectionR defines the right Projection matrix to use (if provided)\r\n */\r\n Scene.prototype.setTransformMatrix = function (viewL, projectionL, viewR, projectionR) {\r\n if (this._viewUpdateFlag === viewL.updateFlag && this._projectionUpdateFlag === projectionL.updateFlag) {\r\n return;\r\n }\r\n this._viewUpdateFlag = viewL.updateFlag;\r\n this._projectionUpdateFlag = projectionL.updateFlag;\r\n this._viewMatrix = viewL;\r\n this._projectionMatrix = projectionL;\r\n this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);\r\n // Update frustum\r\n if (!this._frustumPlanes) {\r\n this._frustumPlanes = Frustum.GetPlanes(this._transformMatrix);\r\n }\r\n else {\r\n Frustum.GetPlanesToRef(this._transformMatrix, this._frustumPlanes);\r\n }\r\n if (this._multiviewSceneUbo && this._multiviewSceneUbo.useUbo) {\r\n this._updateMultiviewUbo(viewR, projectionR);\r\n }\r\n else if (this._sceneUbo.useUbo) {\r\n this._sceneUbo.updateMatrix(\"viewProjection\", this._transformMatrix);\r\n this._sceneUbo.updateMatrix(\"view\", this._viewMatrix);\r\n this._sceneUbo.update();\r\n }\r\n };\r\n /**\r\n * Gets the uniform buffer used to store scene data\r\n * @returns a UniformBuffer\r\n */\r\n Scene.prototype.getSceneUniformBuffer = function () {\r\n return this._multiviewSceneUbo ? this._multiviewSceneUbo : this._sceneUbo;\r\n };\r\n /**\r\n * Gets an unique (relatively to the current scene) Id\r\n * @returns an unique number for the scene\r\n */\r\n Scene.prototype.getUniqueId = function () {\r\n return UniqueIdGenerator.UniqueId;\r\n };\r\n /**\r\n * Add a mesh to the list of scene's meshes\r\n * @param newMesh defines the mesh to add\r\n * @param recursive if all child meshes should also be added to the scene\r\n */\r\n Scene.prototype.addMesh = function (newMesh, recursive) {\r\n var _this = this;\r\n if (recursive === void 0) { recursive = false; }\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.meshes.push(newMesh);\r\n newMesh._resyncLightSources();\r\n if (!newMesh.parent) {\r\n newMesh._addToSceneRootNodes();\r\n }\r\n this.onNewMeshAddedObservable.notifyObservers(newMesh);\r\n if (recursive) {\r\n newMesh.getChildMeshes().forEach(function (m) {\r\n _this.addMesh(m);\r\n });\r\n }\r\n };\r\n /**\r\n * Remove a mesh for the list of scene's meshes\r\n * @param toRemove defines the mesh to remove\r\n * @param recursive if all child meshes should also be removed from the scene\r\n * @returns the index where the mesh was in the mesh list\r\n */\r\n Scene.prototype.removeMesh = function (toRemove, recursive) {\r\n var _this = this;\r\n if (recursive === void 0) { recursive = false; }\r\n var index = this.meshes.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if mesh found\r\n this.meshes[index] = this.meshes[this.meshes.length - 1];\r\n this.meshes.pop();\r\n if (!toRemove.parent) {\r\n toRemove._removeFromSceneRootNodes();\r\n }\r\n }\r\n this.onMeshRemovedObservable.notifyObservers(toRemove);\r\n if (recursive) {\r\n toRemove.getChildMeshes().forEach(function (m) {\r\n _this.removeMesh(m);\r\n });\r\n }\r\n return index;\r\n };\r\n /**\r\n * Add a transform node to the list of scene's transform nodes\r\n * @param newTransformNode defines the transform node to add\r\n */\r\n Scene.prototype.addTransformNode = function (newTransformNode) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n newTransformNode._indexInSceneTransformNodesArray = this.transformNodes.length;\r\n this.transformNodes.push(newTransformNode);\r\n if (!newTransformNode.parent) {\r\n newTransformNode._addToSceneRootNodes();\r\n }\r\n this.onNewTransformNodeAddedObservable.notifyObservers(newTransformNode);\r\n };\r\n /**\r\n * Remove a transform node for the list of scene's transform nodes\r\n * @param toRemove defines the transform node to remove\r\n * @returns the index where the transform node was in the transform node list\r\n */\r\n Scene.prototype.removeTransformNode = function (toRemove) {\r\n var index = toRemove._indexInSceneTransformNodesArray;\r\n if (index !== -1) {\r\n if (index !== this.transformNodes.length - 1) {\r\n var lastNode = this.transformNodes[this.transformNodes.length - 1];\r\n this.transformNodes[index] = lastNode;\r\n lastNode._indexInSceneTransformNodesArray = index;\r\n }\r\n toRemove._indexInSceneTransformNodesArray = -1;\r\n this.transformNodes.pop();\r\n if (!toRemove.parent) {\r\n toRemove._removeFromSceneRootNodes();\r\n }\r\n }\r\n this.onTransformNodeRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Remove a skeleton for the list of scene's skeletons\r\n * @param toRemove defines the skeleton to remove\r\n * @returns the index where the skeleton was in the skeleton list\r\n */\r\n Scene.prototype.removeSkeleton = function (toRemove) {\r\n var index = this.skeletons.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if found\r\n this.skeletons.splice(index, 1);\r\n this.onSkeletonRemovedObservable.notifyObservers(toRemove);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Remove a morph target for the list of scene's morph targets\r\n * @param toRemove defines the morph target to remove\r\n * @returns the index where the morph target was in the morph target list\r\n */\r\n Scene.prototype.removeMorphTargetManager = function (toRemove) {\r\n var index = this.morphTargetManagers.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if found\r\n this.morphTargetManagers.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Remove a light for the list of scene's lights\r\n * @param toRemove defines the light to remove\r\n * @returns the index where the light was in the light list\r\n */\r\n Scene.prototype.removeLight = function (toRemove) {\r\n var index = this.lights.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from meshes\r\n for (var _i = 0, _a = this.meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._removeLightSource(toRemove, false);\r\n }\r\n // Remove from the scene if mesh found\r\n this.lights.splice(index, 1);\r\n this.sortLightsByPriority();\r\n if (!toRemove.parent) {\r\n toRemove._removeFromSceneRootNodes();\r\n }\r\n }\r\n this.onLightRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Remove a camera for the list of scene's cameras\r\n * @param toRemove defines the camera to remove\r\n * @returns the index where the camera was in the camera list\r\n */\r\n Scene.prototype.removeCamera = function (toRemove) {\r\n var index = this.cameras.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if mesh found\r\n this.cameras.splice(index, 1);\r\n if (!toRemove.parent) {\r\n toRemove._removeFromSceneRootNodes();\r\n }\r\n }\r\n // Remove from activeCameras\r\n if (this.activeCameras) {\r\n var index2 = this.activeCameras.indexOf(toRemove);\r\n if (index2 !== -1) {\r\n // Remove from the scene if mesh found\r\n this.activeCameras.splice(index2, 1);\r\n }\r\n }\r\n // Reset the activeCamera\r\n if (this.activeCamera === toRemove) {\r\n if (this.cameras.length > 0) {\r\n this.activeCamera = this.cameras[0];\r\n }\r\n else {\r\n this.activeCamera = null;\r\n }\r\n }\r\n this.onCameraRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Remove a particle system for the list of scene's particle systems\r\n * @param toRemove defines the particle system to remove\r\n * @returns the index where the particle system was in the particle system list\r\n */\r\n Scene.prototype.removeParticleSystem = function (toRemove) {\r\n var index = this.particleSystems.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.particleSystems.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Remove a animation for the list of scene's animations\r\n * @param toRemove defines the animation to remove\r\n * @returns the index where the animation was in the animation list\r\n */\r\n Scene.prototype.removeAnimation = function (toRemove) {\r\n var index = this.animations.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.animations.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Will stop the animation of the given target\r\n * @param target - the target\r\n * @param animationName - the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)\r\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n */\r\n Scene.prototype.stopAnimation = function (target, animationName, targetMask) {\r\n // Do nothing as code will be provided by animation component\r\n };\r\n /**\r\n * Removes the given animation group from this scene.\r\n * @param toRemove The animation group to remove\r\n * @returns The index of the removed animation group\r\n */\r\n Scene.prototype.removeAnimationGroup = function (toRemove) {\r\n var index = this.animationGroups.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.animationGroups.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Removes the given multi-material from this scene.\r\n * @param toRemove The multi-material to remove\r\n * @returns The index of the removed multi-material\r\n */\r\n Scene.prototype.removeMultiMaterial = function (toRemove) {\r\n var index = this.multiMaterials.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.multiMaterials.splice(index, 1);\r\n }\r\n this.onMultiMaterialRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Removes the given material from this scene.\r\n * @param toRemove The material to remove\r\n * @returns The index of the removed material\r\n */\r\n Scene.prototype.removeMaterial = function (toRemove) {\r\n var index = toRemove._indexInSceneMaterialArray;\r\n if (index !== -1 && index < this.materials.length) {\r\n if (index !== this.materials.length - 1) {\r\n var lastMaterial = this.materials[this.materials.length - 1];\r\n this.materials[index] = lastMaterial;\r\n lastMaterial._indexInSceneMaterialArray = index;\r\n }\r\n toRemove._indexInSceneMaterialArray = -1;\r\n this.materials.pop();\r\n }\r\n this.onMaterialRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Removes the given action manager from this scene.\r\n * @param toRemove The action manager to remove\r\n * @returns The index of the removed action manager\r\n */\r\n Scene.prototype.removeActionManager = function (toRemove) {\r\n var index = this.actionManagers.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.actionManagers.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Removes the given texture from this scene.\r\n * @param toRemove The texture to remove\r\n * @returns The index of the removed texture\r\n */\r\n Scene.prototype.removeTexture = function (toRemove) {\r\n var index = this.textures.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.textures.splice(index, 1);\r\n }\r\n this.onTextureRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Adds the given light to this scene\r\n * @param newLight The light to add\r\n */\r\n Scene.prototype.addLight = function (newLight) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.lights.push(newLight);\r\n this.sortLightsByPriority();\r\n if (!newLight.parent) {\r\n newLight._addToSceneRootNodes();\r\n }\r\n // Add light to all meshes (To support if the light is removed and then re-added)\r\n for (var _i = 0, _a = this.meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n if (mesh.lightSources.indexOf(newLight) === -1) {\r\n mesh.lightSources.push(newLight);\r\n mesh._resyncLightSources();\r\n }\r\n }\r\n this.onNewLightAddedObservable.notifyObservers(newLight);\r\n };\r\n /**\r\n * Sorts the list list based on light priorities\r\n */\r\n Scene.prototype.sortLightsByPriority = function () {\r\n if (this.requireLightSorting) {\r\n this.lights.sort(Light.CompareLightsPriority);\r\n }\r\n };\r\n /**\r\n * Adds the given camera to this scene\r\n * @param newCamera The camera to add\r\n */\r\n Scene.prototype.addCamera = function (newCamera) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.cameras.push(newCamera);\r\n this.onNewCameraAddedObservable.notifyObservers(newCamera);\r\n if (!newCamera.parent) {\r\n newCamera._addToSceneRootNodes();\r\n }\r\n };\r\n /**\r\n * Adds the given skeleton to this scene\r\n * @param newSkeleton The skeleton to add\r\n */\r\n Scene.prototype.addSkeleton = function (newSkeleton) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.skeletons.push(newSkeleton);\r\n this.onNewSkeletonAddedObservable.notifyObservers(newSkeleton);\r\n };\r\n /**\r\n * Adds the given particle system to this scene\r\n * @param newParticleSystem The particle system to add\r\n */\r\n Scene.prototype.addParticleSystem = function (newParticleSystem) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.particleSystems.push(newParticleSystem);\r\n };\r\n /**\r\n * Adds the given animation to this scene\r\n * @param newAnimation The animation to add\r\n */\r\n Scene.prototype.addAnimation = function (newAnimation) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.animations.push(newAnimation);\r\n };\r\n /**\r\n * Adds the given animation group to this scene.\r\n * @param newAnimationGroup The animation group to add\r\n */\r\n Scene.prototype.addAnimationGroup = function (newAnimationGroup) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.animationGroups.push(newAnimationGroup);\r\n };\r\n /**\r\n * Adds the given multi-material to this scene\r\n * @param newMultiMaterial The multi-material to add\r\n */\r\n Scene.prototype.addMultiMaterial = function (newMultiMaterial) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.multiMaterials.push(newMultiMaterial);\r\n this.onNewMultiMaterialAddedObservable.notifyObservers(newMultiMaterial);\r\n };\r\n /**\r\n * Adds the given material to this scene\r\n * @param newMaterial The material to add\r\n */\r\n Scene.prototype.addMaterial = function (newMaterial) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n newMaterial._indexInSceneMaterialArray = this.materials.length;\r\n this.materials.push(newMaterial);\r\n this.onNewMaterialAddedObservable.notifyObservers(newMaterial);\r\n };\r\n /**\r\n * Adds the given morph target to this scene\r\n * @param newMorphTargetManager The morph target to add\r\n */\r\n Scene.prototype.addMorphTargetManager = function (newMorphTargetManager) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.morphTargetManagers.push(newMorphTargetManager);\r\n };\r\n /**\r\n * Adds the given geometry to this scene\r\n * @param newGeometry The geometry to add\r\n */\r\n Scene.prototype.addGeometry = function (newGeometry) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n if (this.geometriesByUniqueId) {\r\n this.geometriesByUniqueId[newGeometry.uniqueId] = this.geometries.length;\r\n }\r\n this.geometries.push(newGeometry);\r\n };\r\n /**\r\n * Adds the given action manager to this scene\r\n * @param newActionManager The action manager to add\r\n */\r\n Scene.prototype.addActionManager = function (newActionManager) {\r\n this.actionManagers.push(newActionManager);\r\n };\r\n /**\r\n * Adds the given texture to this scene.\r\n * @param newTexture The texture to add\r\n */\r\n Scene.prototype.addTexture = function (newTexture) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.textures.push(newTexture);\r\n this.onNewTextureAddedObservable.notifyObservers(newTexture);\r\n };\r\n /**\r\n * Switch active camera\r\n * @param newCamera defines the new active camera\r\n * @param attachControl defines if attachControl must be called for the new active camera (default: true)\r\n */\r\n Scene.prototype.switchActiveCamera = function (newCamera, attachControl) {\r\n if (attachControl === void 0) { attachControl = true; }\r\n var canvas = this._engine.getInputElement();\r\n if (!canvas) {\r\n return;\r\n }\r\n if (this.activeCamera) {\r\n this.activeCamera.detachControl();\r\n }\r\n this.activeCamera = newCamera;\r\n if (attachControl) {\r\n newCamera.attachControl();\r\n }\r\n };\r\n /**\r\n * sets the active camera of the scene using its ID\r\n * @param id defines the camera's ID\r\n * @return the new active camera or null if none found.\r\n */\r\n Scene.prototype.setActiveCameraByID = function (id) {\r\n var camera = this.getCameraByID(id);\r\n if (camera) {\r\n this.activeCamera = camera;\r\n return camera;\r\n }\r\n return null;\r\n };\r\n /**\r\n * sets the active camera of the scene using its name\r\n * @param name defines the camera's name\r\n * @returns the new active camera or null if none found.\r\n */\r\n Scene.prototype.setActiveCameraByName = function (name) {\r\n var camera = this.getCameraByName(name);\r\n if (camera) {\r\n this.activeCamera = camera;\r\n return camera;\r\n }\r\n return null;\r\n };\r\n /**\r\n * get an animation group using its name\r\n * @param name defines the material's name\r\n * @return the animation group or null if none found.\r\n */\r\n Scene.prototype.getAnimationGroupByName = function (name) {\r\n for (var index = 0; index < this.animationGroups.length; index++) {\r\n if (this.animationGroups[index].name === name) {\r\n return this.animationGroups[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Get a material using its unique id\r\n * @param uniqueId defines the material's unique id\r\n * @return the material or null if none found.\r\n */\r\n Scene.prototype.getMaterialByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.materials.length; index++) {\r\n if (this.materials[index].uniqueId === uniqueId) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * get a material using its id\r\n * @param id defines the material's ID\r\n * @return the material or null if none found.\r\n */\r\n Scene.prototype.getMaterialByID = function (id) {\r\n for (var index = 0; index < this.materials.length; index++) {\r\n if (this.materials[index].id === id) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a the last added material using a given id\r\n * @param id defines the material's ID\r\n * @return the last material with the given id or null if none found.\r\n */\r\n Scene.prototype.getLastMaterialByID = function (id) {\r\n for (var index = this.materials.length - 1; index >= 0; index--) {\r\n if (this.materials[index].id === id) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a material using its name\r\n * @param name defines the material's name\r\n * @return the material or null if none found.\r\n */\r\n Scene.prototype.getMaterialByName = function (name) {\r\n for (var index = 0; index < this.materials.length; index++) {\r\n if (this.materials[index].name === name) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Get a texture using its unique id\r\n * @param uniqueId defines the texture's unique id\r\n * @return the texture or null if none found.\r\n */\r\n Scene.prototype.getTextureByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.textures.length; index++) {\r\n if (this.textures[index].uniqueId === uniqueId) {\r\n return this.textures[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a camera using its id\r\n * @param id defines the id to look for\r\n * @returns the camera or null if not found\r\n */\r\n Scene.prototype.getCameraByID = function (id) {\r\n for (var index = 0; index < this.cameras.length; index++) {\r\n if (this.cameras[index].id === id) {\r\n return this.cameras[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a camera using its unique id\r\n * @param uniqueId defines the unique id to look for\r\n * @returns the camera or null if not found\r\n */\r\n Scene.prototype.getCameraByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.cameras.length; index++) {\r\n if (this.cameras[index].uniqueId === uniqueId) {\r\n return this.cameras[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a camera using its name\r\n * @param name defines the camera's name\r\n * @return the camera or null if none found.\r\n */\r\n Scene.prototype.getCameraByName = function (name) {\r\n for (var index = 0; index < this.cameras.length; index++) {\r\n if (this.cameras[index].name === name) {\r\n return this.cameras[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a bone using its id\r\n * @param id defines the bone's id\r\n * @return the bone or null if not found\r\n */\r\n Scene.prototype.getBoneByID = function (id) {\r\n for (var skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {\r\n var skeleton = this.skeletons[skeletonIndex];\r\n for (var boneIndex = 0; boneIndex < skeleton.bones.length; boneIndex++) {\r\n if (skeleton.bones[boneIndex].id === id) {\r\n return skeleton.bones[boneIndex];\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a bone using its id\r\n * @param name defines the bone's name\r\n * @return the bone or null if not found\r\n */\r\n Scene.prototype.getBoneByName = function (name) {\r\n for (var skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {\r\n var skeleton = this.skeletons[skeletonIndex];\r\n for (var boneIndex = 0; boneIndex < skeleton.bones.length; boneIndex++) {\r\n if (skeleton.bones[boneIndex].name === name) {\r\n return skeleton.bones[boneIndex];\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a light node using its name\r\n * @param name defines the the light's name\r\n * @return the light or null if none found.\r\n */\r\n Scene.prototype.getLightByName = function (name) {\r\n for (var index = 0; index < this.lights.length; index++) {\r\n if (this.lights[index].name === name) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a light node using its id\r\n * @param id defines the light's id\r\n * @return the light or null if none found.\r\n */\r\n Scene.prototype.getLightByID = function (id) {\r\n for (var index = 0; index < this.lights.length; index++) {\r\n if (this.lights[index].id === id) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a light node using its scene-generated unique ID\r\n * @param uniqueId defines the light's unique id\r\n * @return the light or null if none found.\r\n */\r\n Scene.prototype.getLightByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.lights.length; index++) {\r\n if (this.lights[index].uniqueId === uniqueId) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a particle system by id\r\n * @param id defines the particle system id\r\n * @return the corresponding system or null if none found\r\n */\r\n Scene.prototype.getParticleSystemByID = function (id) {\r\n for (var index = 0; index < this.particleSystems.length; index++) {\r\n if (this.particleSystems[index].id === id) {\r\n return this.particleSystems[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a geometry using its ID\r\n * @param id defines the geometry's id\r\n * @return the geometry or null if none found.\r\n */\r\n Scene.prototype.getGeometryByID = function (id) {\r\n for (var index = 0; index < this.geometries.length; index++) {\r\n if (this.geometries[index].id === id) {\r\n return this.geometries[index];\r\n }\r\n }\r\n return null;\r\n };\r\n Scene.prototype._getGeometryByUniqueID = function (uniqueId) {\r\n if (this.geometriesByUniqueId) {\r\n var index_1 = this.geometriesByUniqueId[uniqueId];\r\n if (index_1 !== undefined) {\r\n return this.geometries[index_1];\r\n }\r\n }\r\n else {\r\n for (var index = 0; index < this.geometries.length; index++) {\r\n if (this.geometries[index].uniqueId === uniqueId) {\r\n return this.geometries[index];\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Add a new geometry to this scene\r\n * @param geometry defines the geometry to be added to the scene.\r\n * @param force defines if the geometry must be pushed even if a geometry with this id already exists\r\n * @return a boolean defining if the geometry was added or not\r\n */\r\n Scene.prototype.pushGeometry = function (geometry, force) {\r\n if (!force && this._getGeometryByUniqueID(geometry.uniqueId)) {\r\n return false;\r\n }\r\n this.addGeometry(geometry);\r\n this.onNewGeometryAddedObservable.notifyObservers(geometry);\r\n return true;\r\n };\r\n /**\r\n * Removes an existing geometry\r\n * @param geometry defines the geometry to be removed from the scene\r\n * @return a boolean defining if the geometry was removed or not\r\n */\r\n Scene.prototype.removeGeometry = function (geometry) {\r\n var index;\r\n if (this.geometriesByUniqueId) {\r\n index = this.geometriesByUniqueId[geometry.uniqueId];\r\n if (index === undefined) {\r\n return false;\r\n }\r\n }\r\n else {\r\n index = this.geometries.indexOf(geometry);\r\n if (index < 0) {\r\n return false;\r\n }\r\n }\r\n if (index !== this.geometries.length - 1) {\r\n var lastGeometry = this.geometries[this.geometries.length - 1];\r\n if (lastGeometry) {\r\n this.geometries[index] = lastGeometry;\r\n if (this.geometriesByUniqueId) {\r\n this.geometriesByUniqueId[lastGeometry.uniqueId] = index;\r\n this.geometriesByUniqueId[geometry.uniqueId] = undefined;\r\n }\r\n }\r\n }\r\n this.geometries.pop();\r\n this.onGeometryRemovedObservable.notifyObservers(geometry);\r\n return true;\r\n };\r\n /**\r\n * Gets the list of geometries attached to the scene\r\n * @returns an array of Geometry\r\n */\r\n Scene.prototype.getGeometries = function () {\r\n return this.geometries;\r\n };\r\n /**\r\n * Gets the first added mesh found of a given ID\r\n * @param id defines the id to search for\r\n * @return the mesh found or null if not found at all\r\n */\r\n Scene.prototype.getMeshByID = function (id) {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n if (this.meshes[index].id === id) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a list of meshes using their id\r\n * @param id defines the id to search for\r\n * @returns a list of meshes\r\n */\r\n Scene.prototype.getMeshesByID = function (id) {\r\n return this.meshes.filter(function (m) {\r\n return m.id === id;\r\n });\r\n };\r\n /**\r\n * Gets the first added transform node found of a given ID\r\n * @param id defines the id to search for\r\n * @return the found transform node or null if not found at all.\r\n */\r\n Scene.prototype.getTransformNodeByID = function (id) {\r\n for (var index = 0; index < this.transformNodes.length; index++) {\r\n if (this.transformNodes[index].id === id) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a transform node with its auto-generated unique id\r\n * @param uniqueId efines the unique id to search for\r\n * @return the found transform node or null if not found at all.\r\n */\r\n Scene.prototype.getTransformNodeByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.transformNodes.length; index++) {\r\n if (this.transformNodes[index].uniqueId === uniqueId) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a list of transform nodes using their id\r\n * @param id defines the id to search for\r\n * @returns a list of transform nodes\r\n */\r\n Scene.prototype.getTransformNodesByID = function (id) {\r\n return this.transformNodes.filter(function (m) {\r\n return m.id === id;\r\n });\r\n };\r\n /**\r\n * Gets a mesh with its auto-generated unique id\r\n * @param uniqueId defines the unique id to search for\r\n * @return the found mesh or null if not found at all.\r\n */\r\n Scene.prototype.getMeshByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n if (this.meshes[index].uniqueId === uniqueId) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a the last added mesh using a given id\r\n * @param id defines the id to search for\r\n * @return the found mesh or null if not found at all.\r\n */\r\n Scene.prototype.getLastMeshByID = function (id) {\r\n for (var index = this.meshes.length - 1; index >= 0; index--) {\r\n if (this.meshes[index].id === id) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a the last added node (Mesh, Camera, Light) using a given id\r\n * @param id defines the id to search for\r\n * @return the found node or null if not found at all\r\n */\r\n Scene.prototype.getLastEntryByID = function (id) {\r\n var index;\r\n for (index = this.meshes.length - 1; index >= 0; index--) {\r\n if (this.meshes[index].id === id) {\r\n return this.meshes[index];\r\n }\r\n }\r\n for (index = this.transformNodes.length - 1; index >= 0; index--) {\r\n if (this.transformNodes[index].id === id) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n for (index = this.cameras.length - 1; index >= 0; index--) {\r\n if (this.cameras[index].id === id) {\r\n return this.cameras[index];\r\n }\r\n }\r\n for (index = this.lights.length - 1; index >= 0; index--) {\r\n if (this.lights[index].id === id) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a node (Mesh, Camera, Light) using a given id\r\n * @param id defines the id to search for\r\n * @return the found node or null if not found at all\r\n */\r\n Scene.prototype.getNodeByID = function (id) {\r\n var mesh = this.getMeshByID(id);\r\n if (mesh) {\r\n return mesh;\r\n }\r\n var transformNode = this.getTransformNodeByID(id);\r\n if (transformNode) {\r\n return transformNode;\r\n }\r\n var light = this.getLightByID(id);\r\n if (light) {\r\n return light;\r\n }\r\n var camera = this.getCameraByID(id);\r\n if (camera) {\r\n return camera;\r\n }\r\n var bone = this.getBoneByID(id);\r\n if (bone) {\r\n return bone;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a node (Mesh, Camera, Light) using a given name\r\n * @param name defines the name to search for\r\n * @return the found node or null if not found at all.\r\n */\r\n Scene.prototype.getNodeByName = function (name) {\r\n var mesh = this.getMeshByName(name);\r\n if (mesh) {\r\n return mesh;\r\n }\r\n var transformNode = this.getTransformNodeByName(name);\r\n if (transformNode) {\r\n return transformNode;\r\n }\r\n var light = this.getLightByName(name);\r\n if (light) {\r\n return light;\r\n }\r\n var camera = this.getCameraByName(name);\r\n if (camera) {\r\n return camera;\r\n }\r\n var bone = this.getBoneByName(name);\r\n if (bone) {\r\n return bone;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a mesh using a given name\r\n * @param name defines the name to search for\r\n * @return the found mesh or null if not found at all.\r\n */\r\n Scene.prototype.getMeshByName = function (name) {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n if (this.meshes[index].name === name) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a transform node using a given name\r\n * @param name defines the name to search for\r\n * @return the found transform node or null if not found at all.\r\n */\r\n Scene.prototype.getTransformNodeByName = function (name) {\r\n for (var index = 0; index < this.transformNodes.length; index++) {\r\n if (this.transformNodes[index].name === name) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given id (if many are found, this function will pick the last one)\r\n * @param id defines the id to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getLastSkeletonByID = function (id) {\r\n for (var index = this.skeletons.length - 1; index >= 0; index--) {\r\n if (this.skeletons[index].id === id) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given auto generated unique id\r\n * @param uniqueId defines the unique id to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getSkeletonByUniqueId = function (uniqueId) {\r\n for (var index = 0; index < this.skeletons.length; index++) {\r\n if (this.skeletons[index].uniqueId === uniqueId) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given id (if many are found, this function will pick the first one)\r\n * @param id defines the id to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getSkeletonById = function (id) {\r\n for (var index = 0; index < this.skeletons.length; index++) {\r\n if (this.skeletons[index].id === id) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given name\r\n * @param name defines the name to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getSkeletonByName = function (name) {\r\n for (var index = 0; index < this.skeletons.length; index++) {\r\n if (this.skeletons[index].name === name) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a morph target manager using a given id (if many are found, this function will pick the last one)\r\n * @param id defines the id to search for\r\n * @return the found morph target manager or null if not found at all.\r\n */\r\n Scene.prototype.getMorphTargetManagerById = function (id) {\r\n for (var index = 0; index < this.morphTargetManagers.length; index++) {\r\n if (this.morphTargetManagers[index].uniqueId === id) {\r\n return this.morphTargetManagers[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a morph target using a given id (if many are found, this function will pick the first one)\r\n * @param id defines the id to search for\r\n * @return the found morph target or null if not found at all.\r\n */\r\n Scene.prototype.getMorphTargetById = function (id) {\r\n for (var managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {\r\n var morphTargetManager = this.morphTargetManagers[managerIndex];\r\n for (var index = 0; index < morphTargetManager.numTargets; ++index) {\r\n var target = morphTargetManager.getTarget(index);\r\n if (target.id === id) {\r\n return target;\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a morph target using a given name (if many are found, this function will pick the first one)\r\n * @param name defines the name to search for\r\n * @return the found morph target or null if not found at all.\r\n */\r\n Scene.prototype.getMorphTargetByName = function (name) {\r\n for (var managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {\r\n var morphTargetManager = this.morphTargetManagers[managerIndex];\r\n for (var index = 0; index < morphTargetManager.numTargets; ++index) {\r\n var target = morphTargetManager.getTarget(index);\r\n if (target.name === name) {\r\n return target;\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a post process using a given name (if many are found, this function will pick the first one)\r\n * @param name defines the name to search for\r\n * @return the found post process or null if not found at all.\r\n */\r\n Scene.prototype.getPostProcessByName = function (name) {\r\n for (var postProcessIndex = 0; postProcessIndex < this.postProcesses.length; ++postProcessIndex) {\r\n var postProcess = this.postProcesses[postProcessIndex];\r\n if (postProcess.name === name) {\r\n return postProcess;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a boolean indicating if the given mesh is active\r\n * @param mesh defines the mesh to look for\r\n * @returns true if the mesh is in the active list\r\n */\r\n Scene.prototype.isActiveMesh = function (mesh) {\r\n return (this._activeMeshes.indexOf(mesh) !== -1);\r\n };\r\n Object.defineProperty(Scene.prototype, \"uid\", {\r\n /**\r\n * Return a unique id as a string which can serve as an identifier for the scene\r\n */\r\n get: function () {\r\n if (!this._uid) {\r\n this._uid = Tools.RandomId();\r\n }\r\n return this._uid;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Add an externaly attached data from its key.\r\n * This method call will fail and return false, if such key already exists.\r\n * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.\r\n * @param key the unique key that identifies the data\r\n * @param data the data object to associate to the key for this Engine instance\r\n * @return true if no such key were already present and the data was added successfully, false otherwise\r\n */\r\n Scene.prototype.addExternalData = function (key, data) {\r\n if (!this._externalData) {\r\n this._externalData = new StringDictionary();\r\n }\r\n return this._externalData.add(key, data);\r\n };\r\n /**\r\n * Get an externaly attached data from its key\r\n * @param key the unique key that identifies the data\r\n * @return the associated data, if present (can be null), or undefined if not present\r\n */\r\n Scene.prototype.getExternalData = function (key) {\r\n if (!this._externalData) {\r\n return null;\r\n }\r\n return this._externalData.get(key);\r\n };\r\n /**\r\n * Get an externaly attached data from its key, create it using a factory if it's not already present\r\n * @param key the unique key that identifies the data\r\n * @param factory the factory that will be called to create the instance if and only if it doesn't exists\r\n * @return the associated data, can be null if the factory returned null.\r\n */\r\n Scene.prototype.getOrAddExternalDataWithFactory = function (key, factory) {\r\n if (!this._externalData) {\r\n this._externalData = new StringDictionary();\r\n }\r\n return this._externalData.getOrAddWithFactory(key, factory);\r\n };\r\n /**\r\n * Remove an externaly attached data from the Engine instance\r\n * @param key the unique key that identifies the data\r\n * @return true if the data was successfully removed, false if it doesn't exist\r\n */\r\n Scene.prototype.removeExternalData = function (key) {\r\n return this._externalData.remove(key);\r\n };\r\n Scene.prototype._evaluateSubMesh = function (subMesh, mesh, initialMesh) {\r\n if (initialMesh.hasInstances || initialMesh.isAnInstance || this.dispatchAllSubMeshesOfActiveMeshes || this._skipFrustumClipping || mesh.alwaysSelectAsActiveMesh || mesh.subMeshes.length === 1 || subMesh.isInFrustum(this._frustumPlanes)) {\r\n for (var _i = 0, _a = this._evaluateSubMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(mesh, subMesh);\r\n }\r\n var material = subMesh.getMaterial();\r\n if (material !== null && material !== undefined) {\r\n // Render targets\r\n if (material.hasRenderTargetTextures && material.getRenderTargetTextures != null) {\r\n if (this._processedMaterials.indexOf(material) === -1) {\r\n this._processedMaterials.push(material);\r\n this._renderTargets.concatWithNoDuplicate(material.getRenderTargetTextures());\r\n }\r\n }\r\n // Dispatch\r\n this._renderingManager.dispatch(subMesh, mesh, material);\r\n }\r\n }\r\n };\r\n /**\r\n * Clear the processed materials smart array preventing retention point in material dispose.\r\n */\r\n Scene.prototype.freeProcessedMaterials = function () {\r\n this._processedMaterials.dispose();\r\n };\r\n Object.defineProperty(Scene.prototype, \"blockfreeActiveMeshesAndRenderingGroups\", {\r\n /** Gets or sets a boolean blocking all the calls to freeActiveMeshes and freeRenderingGroups\r\n * It can be used in order to prevent going through methods freeRenderingGroups and freeActiveMeshes several times to improve performance\r\n * when disposing several meshes in a row or a hierarchy of meshes.\r\n * When used, it is the responsability of the user to blockfreeActiveMeshesAndRenderingGroups back to false.\r\n */\r\n get: function () {\r\n return this._preventFreeActiveMeshesAndRenderingGroups;\r\n },\r\n set: function (value) {\r\n if (this._preventFreeActiveMeshesAndRenderingGroups === value) {\r\n return;\r\n }\r\n if (value) {\r\n this.freeActiveMeshes();\r\n this.freeRenderingGroups();\r\n }\r\n this._preventFreeActiveMeshesAndRenderingGroups = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Clear the active meshes smart array preventing retention point in mesh dispose.\r\n */\r\n Scene.prototype.freeActiveMeshes = function () {\r\n if (this.blockfreeActiveMeshesAndRenderingGroups) {\r\n return;\r\n }\r\n this._activeMeshes.dispose();\r\n if (this.activeCamera && this.activeCamera._activeMeshes) {\r\n this.activeCamera._activeMeshes.dispose();\r\n }\r\n if (this.activeCameras) {\r\n for (var i = 0; i < this.activeCameras.length; i++) {\r\n var activeCamera = this.activeCameras[i];\r\n if (activeCamera && activeCamera._activeMeshes) {\r\n activeCamera._activeMeshes.dispose();\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Clear the info related to rendering groups preventing retention points during dispose.\r\n */\r\n Scene.prototype.freeRenderingGroups = function () {\r\n if (this.blockfreeActiveMeshesAndRenderingGroups) {\r\n return;\r\n }\r\n if (this._renderingManager) {\r\n this._renderingManager.freeRenderingGroups();\r\n }\r\n if (this.textures) {\r\n for (var i = 0; i < this.textures.length; i++) {\r\n var texture = this.textures[i];\r\n if (texture && texture.renderList) {\r\n texture.freeRenderingGroups();\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._isInIntermediateRendering = function () {\r\n return this._intermediateRendering;\r\n };\r\n /**\r\n * Use this function to stop evaluating active meshes. The current list will be keep alive between frames\r\n * @param skipEvaluateActiveMeshes defines an optional boolean indicating that the evaluate active meshes step must be completely skipped\r\n * @param onSuccess optional success callback\r\n * @param onError optional error callback\r\n * @returns the current scene\r\n */\r\n Scene.prototype.freezeActiveMeshes = function (skipEvaluateActiveMeshes, onSuccess, onError) {\r\n var _this = this;\r\n if (skipEvaluateActiveMeshes === void 0) { skipEvaluateActiveMeshes = false; }\r\n this.executeWhenReady(function () {\r\n if (!_this.activeCamera) {\r\n onError && onError('No active camera found');\r\n return;\r\n }\r\n if (!_this._frustumPlanes) {\r\n _this.setTransformMatrix(_this.activeCamera.getViewMatrix(), _this.activeCamera.getProjectionMatrix());\r\n }\r\n _this._evaluateActiveMeshes();\r\n _this._activeMeshesFrozen = true;\r\n _this._skipEvaluateActiveMeshesCompletely = skipEvaluateActiveMeshes;\r\n for (var index = 0; index < _this._activeMeshes.length; index++) {\r\n _this._activeMeshes.data[index]._freeze();\r\n }\r\n onSuccess && onSuccess();\r\n });\r\n return this;\r\n };\r\n /**\r\n * Use this function to restart evaluating active meshes on every frame\r\n * @returns the current scene\r\n */\r\n Scene.prototype.unfreezeActiveMeshes = function () {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n var mesh = this.meshes[index];\r\n if (mesh._internalAbstractMeshDataInfo) {\r\n mesh._internalAbstractMeshDataInfo._isActive = false;\r\n }\r\n }\r\n for (var index = 0; index < this._activeMeshes.length; index++) {\r\n this._activeMeshes.data[index]._unFreeze();\r\n }\r\n this._activeMeshesFrozen = false;\r\n return this;\r\n };\r\n Scene.prototype._evaluateActiveMeshes = function () {\r\n if (this._activeMeshesFrozen && this._activeMeshes.length) {\r\n if (!this._skipEvaluateActiveMeshesCompletely) {\r\n var len_1 = this._activeMeshes.length;\r\n for (var i = 0; i < len_1; i++) {\r\n var mesh = this._activeMeshes.data[i];\r\n mesh.computeWorldMatrix();\r\n }\r\n }\r\n if (this._activeParticleSystems) {\r\n var psLength = this._activeParticleSystems.length;\r\n for (var i = 0; i < psLength; i++) {\r\n this._activeParticleSystems.data[i].animate();\r\n }\r\n }\r\n return;\r\n }\r\n if (!this.activeCamera) {\r\n return;\r\n }\r\n this.onBeforeActiveMeshesEvaluationObservable.notifyObservers(this);\r\n this.activeCamera._activeMeshes.reset();\r\n this._activeMeshes.reset();\r\n this._renderingManager.reset();\r\n this._processedMaterials.reset();\r\n this._activeParticleSystems.reset();\r\n this._activeSkeletons.reset();\r\n this._softwareSkinnedMeshes.reset();\r\n for (var _i = 0, _a = this._beforeEvaluateActiveMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action();\r\n }\r\n // Determine mesh candidates\r\n var meshes = this.getActiveMeshCandidates();\r\n // Check each mesh\r\n var len = meshes.length;\r\n for (var i = 0; i < len; i++) {\r\n var mesh = meshes.data[i];\r\n mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate = false;\r\n if (mesh.isBlocked) {\r\n continue;\r\n }\r\n this._totalVertices.addCount(mesh.getTotalVertices(), false);\r\n if (!mesh.isReady() || !mesh.isEnabled() || mesh.scaling.lengthSquared() === 0) {\r\n continue;\r\n }\r\n mesh.computeWorldMatrix();\r\n // Intersections\r\n if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(12, 13)) {\r\n this._meshesForIntersections.pushNoDuplicate(mesh);\r\n }\r\n // Switch to current LOD\r\n var meshToRender = this.customLODSelector ? this.customLODSelector(mesh, this.activeCamera) : mesh.getLOD(this.activeCamera);\r\n mesh._internalAbstractMeshDataInfo._currentLOD = meshToRender;\r\n mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate = true;\r\n if (meshToRender === undefined || meshToRender === null) {\r\n continue;\r\n }\r\n // Compute world matrix if LOD is billboard\r\n if (meshToRender !== mesh && meshToRender.billboardMode !== TransformNode.BILLBOARDMODE_NONE) {\r\n meshToRender.computeWorldMatrix();\r\n }\r\n mesh._preActivate();\r\n if (mesh.isVisible && mesh.visibility > 0 && ((mesh.layerMask & this.activeCamera.layerMask) !== 0) && (this._skipFrustumClipping || mesh.alwaysSelectAsActiveMesh || mesh.isInFrustum(this._frustumPlanes))) {\r\n this._activeMeshes.push(mesh);\r\n this.activeCamera._activeMeshes.push(mesh);\r\n if (meshToRender !== mesh) {\r\n meshToRender._activate(this._renderId, false);\r\n }\r\n for (var _b = 0, _c = this._preActiveMeshStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action(mesh);\r\n }\r\n if (mesh._activate(this._renderId, false)) {\r\n if (!mesh.isAnInstance) {\r\n meshToRender._internalAbstractMeshDataInfo._onlyForInstances = false;\r\n }\r\n else {\r\n if (mesh._internalAbstractMeshDataInfo._actAsRegularMesh) {\r\n meshToRender = mesh;\r\n }\r\n }\r\n meshToRender._internalAbstractMeshDataInfo._isActive = true;\r\n this._activeMesh(mesh, meshToRender);\r\n }\r\n mesh._postActivate();\r\n }\r\n }\r\n this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this);\r\n // Particle systems\r\n if (this.particlesEnabled) {\r\n this.onBeforeParticlesRenderingObservable.notifyObservers(this);\r\n for (var particleIndex = 0; particleIndex < this.particleSystems.length; particleIndex++) {\r\n var particleSystem = this.particleSystems[particleIndex];\r\n if (!particleSystem.isStarted() || !particleSystem.emitter) {\r\n continue;\r\n }\r\n var emitter = particleSystem.emitter;\r\n if (!emitter.position || emitter.isEnabled()) {\r\n this._activeParticleSystems.push(particleSystem);\r\n particleSystem.animate();\r\n this._renderingManager.dispatchParticles(particleSystem);\r\n }\r\n }\r\n this.onAfterParticlesRenderingObservable.notifyObservers(this);\r\n }\r\n };\r\n Scene.prototype._activeMesh = function (sourceMesh, mesh) {\r\n if (this._skeletonsEnabled && mesh.skeleton !== null && mesh.skeleton !== undefined) {\r\n if (this._activeSkeletons.pushNoDuplicate(mesh.skeleton)) {\r\n mesh.skeleton.prepare();\r\n }\r\n if (!mesh.computeBonesUsingShaders) {\r\n this._softwareSkinnedMeshes.pushNoDuplicate(mesh);\r\n }\r\n }\r\n if (mesh !== undefined && mesh !== null\r\n && mesh.subMeshes !== undefined && mesh.subMeshes !== null && mesh.subMeshes.length > 0) {\r\n var subMeshes = this.getActiveSubMeshCandidates(mesh);\r\n var len = subMeshes.length;\r\n for (var i = 0; i < len; i++) {\r\n var subMesh = subMeshes.data[i];\r\n this._evaluateSubMesh(subMesh, mesh, sourceMesh);\r\n }\r\n }\r\n };\r\n /**\r\n * Update the transform matrix to update from the current active camera\r\n * @param force defines a boolean used to force the update even if cache is up to date\r\n */\r\n Scene.prototype.updateTransformMatrix = function (force) {\r\n if (!this.activeCamera) {\r\n return;\r\n }\r\n this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(force));\r\n };\r\n Scene.prototype._bindFrameBuffer = function () {\r\n if (this.activeCamera && this.activeCamera._multiviewTexture) {\r\n this.activeCamera._multiviewTexture._bindFrameBuffer();\r\n }\r\n else if (this.activeCamera && this.activeCamera.outputRenderTarget) {\r\n var useMultiview = this.getEngine().getCaps().multiview && this.activeCamera.outputRenderTarget && this.activeCamera.outputRenderTarget.getViewCount() > 1;\r\n if (useMultiview) {\r\n this.activeCamera.outputRenderTarget._bindFrameBuffer();\r\n }\r\n else {\r\n var internalTexture = this.activeCamera.outputRenderTarget.getInternalTexture();\r\n if (internalTexture) {\r\n this.getEngine().bindFramebuffer(internalTexture);\r\n }\r\n else {\r\n Logger.Error(\"Camera contains invalid customDefaultRenderTarget\");\r\n }\r\n }\r\n }\r\n else {\r\n this.getEngine().restoreDefaultFramebuffer(); // Restore back buffer if needed\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._renderForCamera = function (camera, rigParent) {\r\n if (camera && camera._skipRendering) {\r\n return;\r\n }\r\n var engine = this._engine;\r\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged\r\n this._activeCamera = camera;\r\n if (!this.activeCamera) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n // Viewport\r\n engine.setViewport(this.activeCamera.viewport);\r\n // Camera\r\n this.resetCachedMaterial();\r\n this._renderId++;\r\n var useMultiview = this.getEngine().getCaps().multiview && camera.outputRenderTarget && camera.outputRenderTarget.getViewCount() > 1;\r\n if (useMultiview) {\r\n this.setTransformMatrix(camera._rigCameras[0].getViewMatrix(), camera._rigCameras[0].getProjectionMatrix(), camera._rigCameras[1].getViewMatrix(), camera._rigCameras[1].getProjectionMatrix());\r\n }\r\n else {\r\n this.updateTransformMatrix();\r\n }\r\n this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera);\r\n // Meshes\r\n this._evaluateActiveMeshes();\r\n // Software skinning\r\n for (var softwareSkinnedMeshIndex = 0; softwareSkinnedMeshIndex < this._softwareSkinnedMeshes.length; softwareSkinnedMeshIndex++) {\r\n var mesh = this._softwareSkinnedMeshes.data[softwareSkinnedMeshIndex];\r\n mesh.applySkeleton(mesh.skeleton);\r\n }\r\n // Render targets\r\n this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);\r\n if (camera.customRenderTargets && camera.customRenderTargets.length > 0) {\r\n this._renderTargets.concatWithNoDuplicate(camera.customRenderTargets);\r\n }\r\n if (rigParent && rigParent.customRenderTargets && rigParent.customRenderTargets.length > 0) {\r\n this._renderTargets.concatWithNoDuplicate(rigParent.customRenderTargets);\r\n }\r\n // Collects render targets from external components.\r\n for (var _i = 0, _a = this._gatherActiveCameraRenderTargetsStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(this._renderTargets);\r\n }\r\n var needRebind = false;\r\n if (this.renderTargetsEnabled) {\r\n this._intermediateRendering = true;\r\n if (this._renderTargets.length > 0) {\r\n Tools.StartPerformanceCounter(\"Render targets\", this._renderTargets.length > 0);\r\n for (var renderIndex = 0; renderIndex < this._renderTargets.length; renderIndex++) {\r\n var renderTarget = this._renderTargets.data[renderIndex];\r\n if (renderTarget._shouldRender()) {\r\n this._renderId++;\r\n var hasSpecialRenderTargetCamera = renderTarget.activeCamera && renderTarget.activeCamera !== this.activeCamera;\r\n renderTarget.render(hasSpecialRenderTargetCamera, this.dumpNextRenderTargets);\r\n needRebind = true;\r\n }\r\n }\r\n Tools.EndPerformanceCounter(\"Render targets\", this._renderTargets.length > 0);\r\n this._renderId++;\r\n }\r\n for (var _b = 0, _c = this._cameraDrawRenderTargetStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n needRebind = step.action(this.activeCamera) || needRebind;\r\n }\r\n this._intermediateRendering = false;\r\n // Need to bind if sub-camera has an outputRenderTarget eg. for webXR\r\n if (this.activeCamera && this.activeCamera.outputRenderTarget) {\r\n needRebind = true;\r\n }\r\n }\r\n // Restore framebuffer after rendering to targets\r\n if (needRebind && !this.prePass) {\r\n this._bindFrameBuffer();\r\n }\r\n this.onAfterRenderTargetsRenderObservable.notifyObservers(this);\r\n // Prepare Frame\r\n if (this.postProcessManager && !camera._multiviewTexture && !this.prePass) {\r\n this.postProcessManager._prepareFrame();\r\n }\r\n // Before Camera Draw\r\n for (var _d = 0, _e = this._beforeCameraDrawStage; _d < _e.length; _d++) {\r\n var step = _e[_d];\r\n step.action(this.activeCamera);\r\n }\r\n // Render\r\n this.onBeforeDrawPhaseObservable.notifyObservers(this);\r\n this._renderingManager.render(null, null, true, true);\r\n this.onAfterDrawPhaseObservable.notifyObservers(this);\r\n // After Camera Draw\r\n for (var _f = 0, _g = this._afterCameraDrawStage; _f < _g.length; _f++) {\r\n var step = _g[_f];\r\n step.action(this.activeCamera);\r\n }\r\n // Finalize frame\r\n if (this.postProcessManager && !camera._multiviewTexture) {\r\n // if the camera has an output render target, render the post process to the render target\r\n var texture = camera.outputRenderTarget ? camera.outputRenderTarget.getInternalTexture() : undefined;\r\n this.postProcessManager._finalizeFrame(camera.isIntermediate, texture);\r\n }\r\n // Reset some special arrays\r\n this._renderTargets.reset();\r\n this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera);\r\n };\r\n Scene.prototype._processSubCameras = function (camera) {\r\n if (camera.cameraRigMode === Camera.RIG_MODE_NONE || (camera.outputRenderTarget && camera.outputRenderTarget.getViewCount() > 1 && this.getEngine().getCaps().multiview)) {\r\n this._renderForCamera(camera);\r\n this.onAfterRenderCameraObservable.notifyObservers(camera);\r\n return;\r\n }\r\n if (camera._useMultiviewToSingleView) {\r\n this._renderMultiviewToSingleView(camera);\r\n }\r\n else {\r\n // rig cameras\r\n for (var index = 0; index < camera._rigCameras.length; index++) {\r\n this._renderForCamera(camera._rigCameras[index], camera);\r\n }\r\n }\r\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged\r\n this._activeCamera = camera;\r\n this.setTransformMatrix(this._activeCamera.getViewMatrix(), this._activeCamera.getProjectionMatrix());\r\n this.onAfterRenderCameraObservable.notifyObservers(camera);\r\n };\r\n Scene.prototype._checkIntersections = function () {\r\n for (var index = 0; index < this._meshesForIntersections.length; index++) {\r\n var sourceMesh = this._meshesForIntersections.data[index];\r\n if (!sourceMesh.actionManager) {\r\n continue;\r\n }\r\n for (var actionIndex = 0; sourceMesh.actionManager && actionIndex < sourceMesh.actionManager.actions.length; actionIndex++) {\r\n var action = sourceMesh.actionManager.actions[actionIndex];\r\n if (action.trigger === 12 || action.trigger === 13) {\r\n var parameters = action.getTriggerParameter();\r\n var otherMesh = parameters instanceof AbstractMesh ? parameters : parameters.mesh;\r\n var areIntersecting = otherMesh.intersectsMesh(sourceMesh, parameters.usePreciseIntersection);\r\n var currentIntersectionInProgress = sourceMesh._intersectionsInProgress.indexOf(otherMesh);\r\n if (areIntersecting && currentIntersectionInProgress === -1) {\r\n if (action.trigger === 12) {\r\n action._executeCurrent(ActionEvent.CreateNew(sourceMesh, undefined, otherMesh));\r\n sourceMesh._intersectionsInProgress.push(otherMesh);\r\n }\r\n else if (action.trigger === 13) {\r\n sourceMesh._intersectionsInProgress.push(otherMesh);\r\n }\r\n }\r\n else if (!areIntersecting && currentIntersectionInProgress > -1) {\r\n //They intersected, and now they don't.\r\n //is this trigger an exit trigger? execute an event.\r\n if (action.trigger === 13) {\r\n action._executeCurrent(ActionEvent.CreateNew(sourceMesh, undefined, otherMesh));\r\n }\r\n //if this is an exit trigger, or no exit trigger exists, remove the id from the intersection in progress array.\r\n if (!sourceMesh.actionManager.hasSpecificTrigger(13, function (parameter) {\r\n var parameterMesh = parameter instanceof AbstractMesh ? parameter : parameter.mesh;\r\n return otherMesh === parameterMesh;\r\n }) || action.trigger === 13) {\r\n sourceMesh._intersectionsInProgress.splice(currentIntersectionInProgress, 1);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._advancePhysicsEngineStep = function (step) {\r\n // Do nothing. Code will be replaced if physics engine component is referenced\r\n };\r\n /** @hidden */\r\n Scene.prototype._animate = function () {\r\n // Nothing to do as long as Animatable have not been imported.\r\n };\r\n /** Execute all animations (for a frame) */\r\n Scene.prototype.animate = function () {\r\n if (this._engine.isDeterministicLockStep()) {\r\n var deltaTime = Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime)) + this._timeAccumulator;\r\n var defaultFrameTime = this._engine.getTimeStep();\r\n var defaultFPS = (1000.0 / defaultFrameTime) / 1000.0;\r\n var stepsTaken = 0;\r\n var maxSubSteps = this._engine.getLockstepMaxSteps();\r\n var internalSteps = Math.floor(deltaTime / defaultFrameTime);\r\n internalSteps = Math.min(internalSteps, maxSubSteps);\r\n while (deltaTime > 0 && stepsTaken < internalSteps) {\r\n this.onBeforeStepObservable.notifyObservers(this);\r\n // Animations\r\n this._animationRatio = defaultFrameTime * defaultFPS;\r\n this._animate();\r\n this.onAfterAnimationsObservable.notifyObservers(this);\r\n // Physics\r\n if (this.physicsEnabled) {\r\n this._advancePhysicsEngineStep(defaultFrameTime);\r\n }\r\n this.onAfterStepObservable.notifyObservers(this);\r\n this._currentStepId++;\r\n stepsTaken++;\r\n deltaTime -= defaultFrameTime;\r\n }\r\n this._timeAccumulator = deltaTime < 0 ? 0 : deltaTime;\r\n }\r\n else {\r\n // Animations\r\n var deltaTime = this.useConstantAnimationDeltaTime ? 16 : Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime));\r\n this._animationRatio = deltaTime * (60.0 / 1000.0);\r\n this._animate();\r\n this.onAfterAnimationsObservable.notifyObservers(this);\r\n // Physics\r\n if (this.physicsEnabled) {\r\n this._advancePhysicsEngineStep(deltaTime);\r\n }\r\n }\r\n };\r\n /**\r\n * Render the scene\r\n * @param updateCameras defines a boolean indicating if cameras must update according to their inputs (true by default)\r\n * @param ignoreAnimations defines a boolean indicating if animations should not be executed (false by default)\r\n */\r\n Scene.prototype.render = function (updateCameras, ignoreAnimations) {\r\n if (updateCameras === void 0) { updateCameras = true; }\r\n if (ignoreAnimations === void 0) { ignoreAnimations = false; }\r\n if (this.isDisposed) {\r\n return;\r\n }\r\n if (this.onReadyObservable.hasObservers() && this._executeWhenReadyTimeoutId === -1) {\r\n this._checkIsReady();\r\n }\r\n this._frameId++;\r\n // Register components that have been associated lately to the scene.\r\n this._registerTransientComponents();\r\n this._activeParticles.fetchNewFrame();\r\n this._totalVertices.fetchNewFrame();\r\n this._activeIndices.fetchNewFrame();\r\n this._activeBones.fetchNewFrame();\r\n this._meshesForIntersections.reset();\r\n this.resetCachedMaterial();\r\n this.onBeforeAnimationsObservable.notifyObservers(this);\r\n // Actions\r\n if (this.actionManager) {\r\n this.actionManager.processTrigger(11);\r\n }\r\n // Animations\r\n if (!ignoreAnimations) {\r\n this.animate();\r\n }\r\n // Before camera update steps\r\n for (var _i = 0, _a = this._beforeCameraUpdateStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action();\r\n }\r\n // Update Cameras\r\n if (updateCameras) {\r\n if (this.activeCameras && this.activeCameras.length > 0) {\r\n for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {\r\n var camera = this.activeCameras[cameraIndex];\r\n camera.update();\r\n if (camera.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n // rig cameras\r\n for (var index = 0; index < camera._rigCameras.length; index++) {\r\n camera._rigCameras[index].update();\r\n }\r\n }\r\n }\r\n }\r\n else if (this.activeCamera) {\r\n this.activeCamera.update();\r\n if (this.activeCamera.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n // rig cameras\r\n for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {\r\n this.activeCamera._rigCameras[index].update();\r\n }\r\n }\r\n }\r\n }\r\n // Before render\r\n this.onBeforeRenderObservable.notifyObservers(this);\r\n // Customs render targets\r\n this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);\r\n var engine = this.getEngine();\r\n var currentActiveCamera = this.activeCamera;\r\n if (this.renderTargetsEnabled) {\r\n Tools.StartPerformanceCounter(\"Custom render targets\", this.customRenderTargets.length > 0);\r\n this._intermediateRendering = true;\r\n for (var customIndex = 0; customIndex < this.customRenderTargets.length; customIndex++) {\r\n var renderTarget = this.customRenderTargets[customIndex];\r\n if (renderTarget._shouldRender()) {\r\n this._renderId++;\r\n this.activeCamera = renderTarget.activeCamera || this.activeCamera;\r\n if (!this.activeCamera) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n // Viewport\r\n engine.setViewport(this.activeCamera.viewport);\r\n // Camera\r\n this.updateTransformMatrix();\r\n renderTarget.render(currentActiveCamera !== this.activeCamera, this.dumpNextRenderTargets);\r\n }\r\n }\r\n Tools.EndPerformanceCounter(\"Custom render targets\", this.customRenderTargets.length > 0);\r\n this._intermediateRendering = false;\r\n this._renderId++;\r\n }\r\n // Restore back buffer\r\n this.activeCamera = currentActiveCamera;\r\n if (this._activeCamera && this._activeCamera.cameraRigMode !== Camera.RIG_MODE_CUSTOM && !this.prePass) {\r\n this._bindFrameBuffer();\r\n }\r\n this.onAfterRenderTargetsRenderObservable.notifyObservers(this);\r\n for (var _b = 0, _c = this._beforeClearStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action();\r\n }\r\n // Clear\r\n if ((this.autoClearDepthAndStencil || this.autoClear) && !this.prePass) {\r\n this._engine.clear(this.clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil);\r\n }\r\n // Collects render targets from external components.\r\n for (var _d = 0, _e = this._gatherRenderTargetsStage; _d < _e.length; _d++) {\r\n var step = _e[_d];\r\n step.action(this._renderTargets);\r\n }\r\n // Multi-cameras?\r\n if (this.activeCameras && this.activeCameras.length > 0) {\r\n for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {\r\n if (cameraIndex > 0) {\r\n this._engine.clear(null, false, true, true);\r\n }\r\n this._processSubCameras(this.activeCameras[cameraIndex]);\r\n }\r\n }\r\n else {\r\n if (!this.activeCamera) {\r\n throw new Error(\"No camera defined\");\r\n }\r\n this._processSubCameras(this.activeCamera);\r\n }\r\n // Intersection checks\r\n this._checkIntersections();\r\n // Executes the after render stage actions.\r\n for (var _f = 0, _g = this._afterRenderStage; _f < _g.length; _f++) {\r\n var step = _g[_f];\r\n step.action();\r\n }\r\n // After render\r\n if (this.afterRender) {\r\n this.afterRender();\r\n }\r\n this.onAfterRenderObservable.notifyObservers(this);\r\n // Cleaning\r\n if (this._toBeDisposed.length) {\r\n for (var index = 0; index < this._toBeDisposed.length; index++) {\r\n var data = this._toBeDisposed[index];\r\n if (data) {\r\n data.dispose();\r\n }\r\n }\r\n this._toBeDisposed = [];\r\n }\r\n if (this.dumpNextRenderTargets) {\r\n this.dumpNextRenderTargets = false;\r\n }\r\n this._activeBones.addCount(0, true);\r\n this._activeIndices.addCount(0, true);\r\n this._activeParticles.addCount(0, true);\r\n };\r\n /**\r\n * Freeze all materials\r\n * A frozen material will not be updatable but should be faster to render\r\n */\r\n Scene.prototype.freezeMaterials = function () {\r\n for (var i = 0; i < this.materials.length; i++) {\r\n this.materials[i].freeze();\r\n }\r\n };\r\n /**\r\n * Unfreeze all materials\r\n * A frozen material will not be updatable but should be faster to render\r\n */\r\n Scene.prototype.unfreezeMaterials = function () {\r\n for (var i = 0; i < this.materials.length; i++) {\r\n this.materials[i].unfreeze();\r\n }\r\n };\r\n /**\r\n * Releases all held ressources\r\n */\r\n Scene.prototype.dispose = function () {\r\n this.beforeRender = null;\r\n this.afterRender = null;\r\n if (EngineStore._LastCreatedScene === this) {\r\n EngineStore._LastCreatedScene = null;\r\n }\r\n this.skeletons = [];\r\n this.morphTargetManagers = [];\r\n this._transientComponents = [];\r\n this._isReadyForMeshStage.clear();\r\n this._beforeEvaluateActiveMeshStage.clear();\r\n this._evaluateSubMeshStage.clear();\r\n this._preActiveMeshStage.clear();\r\n this._cameraDrawRenderTargetStage.clear();\r\n this._beforeCameraDrawStage.clear();\r\n this._beforeRenderTargetDrawStage.clear();\r\n this._beforeRenderingGroupDrawStage.clear();\r\n this._beforeRenderingMeshStage.clear();\r\n this._afterRenderingMeshStage.clear();\r\n this._afterRenderingGroupDrawStage.clear();\r\n this._afterCameraDrawStage.clear();\r\n this._afterRenderTargetDrawStage.clear();\r\n this._afterRenderStage.clear();\r\n this._beforeCameraUpdateStage.clear();\r\n this._beforeClearStage.clear();\r\n this._gatherRenderTargetsStage.clear();\r\n this._gatherActiveCameraRenderTargetsStage.clear();\r\n this._pointerMoveStage.clear();\r\n this._pointerDownStage.clear();\r\n this._pointerUpStage.clear();\r\n for (var _i = 0, _a = this._components; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.dispose();\r\n }\r\n this.importedMeshesFiles = new Array();\r\n if (this.stopAllAnimations) {\r\n this.stopAllAnimations();\r\n }\r\n this.resetCachedMaterial();\r\n // Smart arrays\r\n if (this.activeCamera) {\r\n this.activeCamera._activeMeshes.dispose();\r\n this.activeCamera = null;\r\n }\r\n this._activeMeshes.dispose();\r\n this._renderingManager.dispose();\r\n this._processedMaterials.dispose();\r\n this._activeParticleSystems.dispose();\r\n this._activeSkeletons.dispose();\r\n this._softwareSkinnedMeshes.dispose();\r\n this._renderTargets.dispose();\r\n this._registeredForLateAnimationBindings.dispose();\r\n this._meshesForIntersections.dispose();\r\n this._toBeDisposed = [];\r\n // Abort active requests\r\n for (var _b = 0, _c = this._activeRequests; _b < _c.length; _b++) {\r\n var request = _c[_b];\r\n request.abort();\r\n }\r\n // Events\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onBeforeRenderTargetsRenderObservable.clear();\r\n this.onAfterRenderTargetsRenderObservable.clear();\r\n this.onAfterStepObservable.clear();\r\n this.onBeforeStepObservable.clear();\r\n this.onBeforeActiveMeshesEvaluationObservable.clear();\r\n this.onAfterActiveMeshesEvaluationObservable.clear();\r\n this.onBeforeParticlesRenderingObservable.clear();\r\n this.onAfterParticlesRenderingObservable.clear();\r\n this.onBeforeDrawPhaseObservable.clear();\r\n this.onAfterDrawPhaseObservable.clear();\r\n this.onBeforeAnimationsObservable.clear();\r\n this.onAfterAnimationsObservable.clear();\r\n this.onDataLoadedObservable.clear();\r\n this.onBeforeRenderingGroupObservable.clear();\r\n this.onAfterRenderingGroupObservable.clear();\r\n this.onMeshImportedObservable.clear();\r\n this.onBeforeCameraRenderObservable.clear();\r\n this.onAfterCameraRenderObservable.clear();\r\n this.onReadyObservable.clear();\r\n this.onNewCameraAddedObservable.clear();\r\n this.onCameraRemovedObservable.clear();\r\n this.onNewLightAddedObservable.clear();\r\n this.onLightRemovedObservable.clear();\r\n this.onNewGeometryAddedObservable.clear();\r\n this.onGeometryRemovedObservable.clear();\r\n this.onNewTransformNodeAddedObservable.clear();\r\n this.onTransformNodeRemovedObservable.clear();\r\n this.onNewMeshAddedObservable.clear();\r\n this.onMeshRemovedObservable.clear();\r\n this.onNewSkeletonAddedObservable.clear();\r\n this.onSkeletonRemovedObservable.clear();\r\n this.onNewMaterialAddedObservable.clear();\r\n this.onNewMultiMaterialAddedObservable.clear();\r\n this.onMaterialRemovedObservable.clear();\r\n this.onMultiMaterialRemovedObservable.clear();\r\n this.onNewTextureAddedObservable.clear();\r\n this.onTextureRemovedObservable.clear();\r\n this.onPrePointerObservable.clear();\r\n this.onPointerObservable.clear();\r\n this.onPreKeyboardObservable.clear();\r\n this.onKeyboardObservable.clear();\r\n this.onActiveCameraChanged.clear();\r\n this.detachControl();\r\n // Detach cameras\r\n var canvas = this._engine.getInputElement();\r\n if (canvas) {\r\n var index;\r\n for (index = 0; index < this.cameras.length; index++) {\r\n this.cameras[index].detachControl();\r\n }\r\n }\r\n // Release animation groups\r\n while (this.animationGroups.length) {\r\n this.animationGroups[0].dispose();\r\n }\r\n // Release lights\r\n while (this.lights.length) {\r\n this.lights[0].dispose();\r\n }\r\n // Release meshes\r\n while (this.meshes.length) {\r\n this.meshes[0].dispose(true);\r\n }\r\n while (this.transformNodes.length) {\r\n this.transformNodes[0].dispose(true);\r\n }\r\n // Release cameras\r\n while (this.cameras.length) {\r\n this.cameras[0].dispose();\r\n }\r\n // Release materials\r\n if (this._defaultMaterial) {\r\n this._defaultMaterial.dispose();\r\n }\r\n while (this.multiMaterials.length) {\r\n this.multiMaterials[0].dispose();\r\n }\r\n while (this.materials.length) {\r\n this.materials[0].dispose();\r\n }\r\n // Release particles\r\n while (this.particleSystems.length) {\r\n this.particleSystems[0].dispose();\r\n }\r\n // Release postProcesses\r\n while (this.postProcesses.length) {\r\n this.postProcesses[0].dispose();\r\n }\r\n // Release textures\r\n while (this.textures.length) {\r\n this.textures[0].dispose();\r\n }\r\n // Release UBO\r\n this._sceneUbo.dispose();\r\n if (this._multiviewSceneUbo) {\r\n this._multiviewSceneUbo.dispose();\r\n }\r\n // Post-processes\r\n this.postProcessManager.dispose();\r\n // Remove from engine\r\n index = this._engine.scenes.indexOf(this);\r\n if (index > -1) {\r\n this._engine.scenes.splice(index, 1);\r\n }\r\n this._engine.wipeCaches(true);\r\n this._isDisposed = true;\r\n };\r\n Object.defineProperty(Scene.prototype, \"isDisposed\", {\r\n /**\r\n * Gets if the scene is already disposed\r\n */\r\n get: function () {\r\n return this._isDisposed;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Call this function to reduce memory footprint of the scene.\r\n * Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)\r\n */\r\n Scene.prototype.clearCachedVertexData = function () {\r\n for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\r\n var mesh = this.meshes[meshIndex];\r\n var geometry = mesh.geometry;\r\n if (geometry) {\r\n geometry._indices = [];\r\n for (var vbName in geometry._vertexBuffers) {\r\n if (!geometry._vertexBuffers.hasOwnProperty(vbName)) {\r\n continue;\r\n }\r\n geometry._vertexBuffers[vbName]._buffer._data = null;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * This function will remove the local cached buffer data from texture.\r\n * It will save memory but will prevent the texture from being rebuilt\r\n */\r\n Scene.prototype.cleanCachedTextureBuffer = function () {\r\n for (var _i = 0, _a = this.textures; _i < _a.length; _i++) {\r\n var baseTexture = _a[_i];\r\n var buffer = baseTexture._buffer;\r\n if (buffer) {\r\n baseTexture._buffer = null;\r\n }\r\n }\r\n };\r\n /**\r\n * Get the world extend vectors with an optional filter\r\n *\r\n * @param filterPredicate the predicate - which meshes should be included when calculating the world size\r\n * @returns {{ min: Vector3; max: Vector3 }} min and max vectors\r\n */\r\n Scene.prototype.getWorldExtends = function (filterPredicate) {\r\n var min = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var max = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n filterPredicate = filterPredicate || (function () { return true; });\r\n this.meshes.filter(filterPredicate).forEach(function (mesh) {\r\n mesh.computeWorldMatrix(true);\r\n if (!mesh.subMeshes || mesh.subMeshes.length === 0 || mesh.infiniteDistance) {\r\n return;\r\n }\r\n var boundingInfo = mesh.getBoundingInfo();\r\n var minBox = boundingInfo.boundingBox.minimumWorld;\r\n var maxBox = boundingInfo.boundingBox.maximumWorld;\r\n Vector3.CheckExtends(minBox, min, max);\r\n Vector3.CheckExtends(maxBox, min, max);\r\n });\r\n return {\r\n min: min,\r\n max: max\r\n };\r\n };\r\n // Picking\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\r\n * @param camera defines the camera to use for the picking\r\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\r\n * @returns a Ray\r\n */\r\n Scene.prototype.createPickingRay = function (x, y, world, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\r\n * @param result defines the ray where to store the picking ray\r\n * @param camera defines the camera to use for the picking\r\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.createPickingRayToRef = function (x, y, world, result, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param camera defines the camera to use for the picking\r\n * @returns a Ray\r\n */\r\n Scene.prototype.createPickingRayInCameraSpace = function (x, y, camera) {\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param result defines the ray where to store the picking ray\r\n * @param camera defines the camera to use for the picking\r\n * @returns the current scene\r\n */\r\n Scene.prototype.createPickingRayInCameraSpaceToRef = function (x, y, result, camera) {\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /** Launch a ray to try to pick a mesh in the scene\r\n * @param x position on screen\r\n * @param y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns a PickingInfo\r\n */\r\n Scene.prototype.pick = function (x, y, predicate, fastCheck, camera, trianglePredicate) {\r\n // Dummy info if picking as not been imported\r\n var pi = new PickingInfo();\r\n pi._pickingUnavailable = true;\r\n return pi;\r\n };\r\n /** Launch a ray to try to pick a mesh in the scene using only bounding information of the main mesh (not using submeshes)\r\n * @param x position on screen\r\n * @param y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @returns a PickingInfo (Please note that some info will not be set like distance, bv, bu and everything that cannot be capture by only using bounding infos)\r\n */\r\n Scene.prototype.pickWithBoundingInfo = function (x, y, predicate, fastCheck, camera) {\r\n // Dummy info if picking as not been imported\r\n var pi = new PickingInfo();\r\n pi._pickingUnavailable = true;\r\n return pi;\r\n };\r\n /** Use the given ray to pick a mesh in the scene\r\n * @param ray The ray to use to pick meshes\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must have isPickable set to true\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns a PickingInfo\r\n */\r\n Scene.prototype.pickWithRay = function (ray, predicate, fastCheck, trianglePredicate) {\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Launch a ray to try to pick a mesh in the scene\r\n * @param x X position on screen\r\n * @param y Y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\r\n * @param camera camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns an array of PickingInfo\r\n */\r\n Scene.prototype.multiPick = function (x, y, predicate, camera, trianglePredicate) {\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Launch a ray to try to pick a mesh in the scene\r\n * @param ray Ray to use\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns an array of PickingInfo\r\n */\r\n Scene.prototype.multiPickWithRay = function (ray, predicate, trianglePredicate) {\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Force the value of meshUnderPointer\r\n * @param mesh defines the mesh to use\r\n * @param pointerId optional pointer id when using more than one pointer\r\n */\r\n Scene.prototype.setPointerOverMesh = function (mesh, pointerId) {\r\n this._inputManager.setPointerOverMesh(mesh, pointerId);\r\n };\r\n /**\r\n * Gets the mesh under the pointer\r\n * @returns a Mesh or null if no mesh is under the pointer\r\n */\r\n Scene.prototype.getPointerOverMesh = function () {\r\n return this._inputManager.getPointerOverMesh();\r\n };\r\n // Misc.\r\n /** @hidden */\r\n Scene.prototype._rebuildGeometries = function () {\r\n for (var _i = 0, _a = this.geometries; _i < _a.length; _i++) {\r\n var geometry = _a[_i];\r\n geometry._rebuild();\r\n }\r\n for (var _b = 0, _c = this.meshes; _b < _c.length; _b++) {\r\n var mesh = _c[_b];\r\n mesh._rebuild();\r\n }\r\n if (this.postProcessManager) {\r\n this.postProcessManager._rebuild();\r\n }\r\n for (var _d = 0, _e = this._components; _d < _e.length; _d++) {\r\n var component = _e[_d];\r\n component.rebuild();\r\n }\r\n for (var _f = 0, _g = this.particleSystems; _f < _g.length; _f++) {\r\n var system = _g[_f];\r\n system.rebuild();\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._rebuildTextures = function () {\r\n for (var _i = 0, _a = this.textures; _i < _a.length; _i++) {\r\n var texture = _a[_i];\r\n texture._rebuild();\r\n }\r\n this.markAllMaterialsAsDirty(1);\r\n };\r\n // Tags\r\n Scene.prototype._getByTags = function (list, tagsQuery, forEach) {\r\n if (tagsQuery === undefined) {\r\n // returns the complete list (could be done with Tags.MatchesQuery but no need to have a for-loop here)\r\n return list;\r\n }\r\n var listByTags = [];\r\n forEach = forEach || (function (item) { return; });\r\n for (var i in list) {\r\n var item = list[i];\r\n if (Tags && Tags.MatchesQuery(item, tagsQuery)) {\r\n listByTags.push(item);\r\n forEach(item);\r\n }\r\n }\r\n return listByTags;\r\n };\r\n /**\r\n * Get a list of meshes by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Mesh\r\n */\r\n Scene.prototype.getMeshesByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.meshes, tagsQuery, forEach);\r\n };\r\n /**\r\n * Get a list of cameras by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Camera\r\n */\r\n Scene.prototype.getCamerasByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.cameras, tagsQuery, forEach);\r\n };\r\n /**\r\n * Get a list of lights by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Light\r\n */\r\n Scene.prototype.getLightsByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.lights, tagsQuery, forEach);\r\n };\r\n /**\r\n * Get a list of materials by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Material\r\n */\r\n Scene.prototype.getMaterialByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.materials, tagsQuery, forEach).concat(this._getByTags(this.multiMaterials, tagsQuery, forEach));\r\n };\r\n /**\r\n * Get a list of transform nodes by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of TransformNode\r\n */\r\n Scene.prototype.getTransformNodesByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.transformNodes, tagsQuery, forEach);\r\n };\r\n /**\r\n * Overrides the default sort function applied in the renderging group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversly depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n Scene.prototype.setRenderingOrder = function (renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);\r\n };\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n * @param depth Automatically clears depth between groups if true and autoClear is true.\r\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\r\n */\r\n Scene.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil, depth, stencil) {\r\n if (depth === void 0) { depth = true; }\r\n if (stencil === void 0) { stencil = true; }\r\n this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil, depth, stencil);\r\n };\r\n /**\r\n * Gets the current auto clear configuration for one rendering group of the rendering\r\n * manager.\r\n * @param index the rendering group index to get the information for\r\n * @returns The auto clear setup for the requested rendering group\r\n */\r\n Scene.prototype.getAutoClearDepthStencilSetup = function (index) {\r\n return this._renderingManager.getAutoClearDepthStencilSetup(index);\r\n };\r\n Object.defineProperty(Scene.prototype, \"blockMaterialDirtyMechanism\", {\r\n /** Gets or sets a boolean blocking all the calls to markAllMaterialsAsDirty (ie. the materials won't be updated if they are out of sync) */\r\n get: function () {\r\n return this._blockMaterialDirtyMechanism;\r\n },\r\n set: function (value) {\r\n if (this._blockMaterialDirtyMechanism === value) {\r\n return;\r\n }\r\n this._blockMaterialDirtyMechanism = value;\r\n if (!value) { // Do a complete update\r\n this.markAllMaterialsAsDirty(63);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Will flag all materials as dirty to trigger new shader compilation\r\n * @param flag defines the flag used to specify which material part must be marked as dirty\r\n * @param predicate If not null, it will be used to specifiy if a material has to be marked as dirty\r\n */\r\n Scene.prototype.markAllMaterialsAsDirty = function (flag, predicate) {\r\n if (this._blockMaterialDirtyMechanism) {\r\n return;\r\n }\r\n for (var _i = 0, _a = this.materials; _i < _a.length; _i++) {\r\n var material = _a[_i];\r\n if (predicate && !predicate(material)) {\r\n continue;\r\n }\r\n material.markAsDirty(flag);\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._loadFile = function (url, onSuccess, onProgress, useOfflineSupport, useArrayBuffer, onError) {\r\n var _this = this;\r\n var request = FileTools.LoadFile(url, onSuccess, onProgress, useOfflineSupport ? this.offlineProvider : undefined, useArrayBuffer, onError);\r\n this._activeRequests.push(request);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._activeRequests.splice(_this._activeRequests.indexOf(request), 1);\r\n });\r\n return request;\r\n };\r\n /** @hidden */\r\n Scene.prototype._loadFileAsync = function (url, onProgress, useOfflineSupport, useArrayBuffer) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._loadFile(url, function (data) {\r\n resolve(data);\r\n }, onProgress, useOfflineSupport, useArrayBuffer, function (request, exception) {\r\n reject(exception);\r\n });\r\n });\r\n };\r\n /** @hidden */\r\n Scene.prototype._requestFile = function (url, onSuccess, onProgress, useOfflineSupport, useArrayBuffer, onError, onOpened) {\r\n var _this = this;\r\n var request = FileTools.RequestFile(url, onSuccess, onProgress, useOfflineSupport ? this.offlineProvider : undefined, useArrayBuffer, onError, onOpened);\r\n this._activeRequests.push(request);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._activeRequests.splice(_this._activeRequests.indexOf(request), 1);\r\n });\r\n return request;\r\n };\r\n /** @hidden */\r\n Scene.prototype._requestFileAsync = function (url, onProgress, useOfflineSupport, useArrayBuffer, onOpened) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._requestFile(url, function (data) {\r\n resolve(data);\r\n }, onProgress, useOfflineSupport, useArrayBuffer, function (error) {\r\n reject(error);\r\n }, onOpened);\r\n });\r\n };\r\n /** @hidden */\r\n Scene.prototype._readFile = function (file, onSuccess, onProgress, useArrayBuffer, onError) {\r\n var _this = this;\r\n var request = FileTools.ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError);\r\n this._activeRequests.push(request);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._activeRequests.splice(_this._activeRequests.indexOf(request), 1);\r\n });\r\n return request;\r\n };\r\n /** @hidden */\r\n Scene.prototype._readFileAsync = function (file, onProgress, useArrayBuffer) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._readFile(file, function (data) {\r\n resolve(data);\r\n }, onProgress, useArrayBuffer, function (error) {\r\n reject(error);\r\n });\r\n });\r\n };\r\n /** The fog is deactivated */\r\n Scene.FOGMODE_NONE = 0;\r\n /** The fog density is following an exponential function */\r\n Scene.FOGMODE_EXP = 1;\r\n /** The fog density is following an exponential function faster than FOGMODE_EXP */\r\n Scene.FOGMODE_EXP2 = 2;\r\n /** The fog density is following a linear function. */\r\n Scene.FOGMODE_LINEAR = 3;\r\n /**\r\n * Gets or sets the minimum deltatime when deterministic lock step is enabled\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n */\r\n Scene.MinDeltaTime = 1.0;\r\n /**\r\n * Gets or sets the maximum deltatime when deterministic lock step is enabled\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n */\r\n Scene.MaxDeltaTime = 1000.0;\r\n return Scene;\r\n}(AbstractScene));\r\nexport { Scene };\r\n//# sourceMappingURL=scene.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * Groups all the scene component constants in one place to ease maintenance.\r\n * @hidden\r\n */\r\nvar SceneComponentConstants = /** @class */ (function () {\r\n function SceneComponentConstants() {\r\n }\r\n SceneComponentConstants.NAME_EFFECTLAYER = \"EffectLayer\";\r\n SceneComponentConstants.NAME_LAYER = \"Layer\";\r\n SceneComponentConstants.NAME_LENSFLARESYSTEM = \"LensFlareSystem\";\r\n SceneComponentConstants.NAME_BOUNDINGBOXRENDERER = \"BoundingBoxRenderer\";\r\n SceneComponentConstants.NAME_PARTICLESYSTEM = \"ParticleSystem\";\r\n SceneComponentConstants.NAME_GAMEPAD = \"Gamepad\";\r\n SceneComponentConstants.NAME_SIMPLIFICATIONQUEUE = \"SimplificationQueue\";\r\n SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER = \"GeometryBufferRenderer\";\r\n SceneComponentConstants.NAME_PREPASSRENDERER = \"PrePassRenderer\";\r\n SceneComponentConstants.NAME_DEPTHRENDERER = \"DepthRenderer\";\r\n SceneComponentConstants.NAME_POSTPROCESSRENDERPIPELINEMANAGER = \"PostProcessRenderPipelineManager\";\r\n SceneComponentConstants.NAME_SPRITE = \"Sprite\";\r\n SceneComponentConstants.NAME_SUBSURFACE = \"SubSurface\";\r\n SceneComponentConstants.NAME_OUTLINERENDERER = \"Outline\";\r\n SceneComponentConstants.NAME_PROCEDURALTEXTURE = \"ProceduralTexture\";\r\n SceneComponentConstants.NAME_SHADOWGENERATOR = \"ShadowGenerator\";\r\n SceneComponentConstants.NAME_OCTREE = \"Octree\";\r\n SceneComponentConstants.NAME_PHYSICSENGINE = \"PhysicsEngine\";\r\n SceneComponentConstants.NAME_AUDIO = \"Audio\";\r\n SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER = 0;\r\n SceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0;\r\n SceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0;\r\n SceneComponentConstants.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER = 0;\r\n SceneComponentConstants.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER = 1;\r\n SceneComponentConstants.STEP_BEFORECAMERADRAW_EFFECTLAYER = 0;\r\n SceneComponentConstants.STEP_BEFORECAMERADRAW_LAYER = 1;\r\n SceneComponentConstants.STEP_BEFORECAMERADRAW_PREPASS = 2;\r\n SceneComponentConstants.STEP_BEFORERENDERTARGETDRAW_LAYER = 0;\r\n SceneComponentConstants.STEP_BEFORERENDERINGMESH_PREPASS = 0;\r\n SceneComponentConstants.STEP_BEFORERENDERINGMESH_OUTLINE = 1;\r\n SceneComponentConstants.STEP_AFTERRENDERINGMESH_PREPASS = 0;\r\n SceneComponentConstants.STEP_AFTERRENDERINGMESH_OUTLINE = 1;\r\n SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW = 0;\r\n SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER = 1;\r\n SceneComponentConstants.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE = 0;\r\n SceneComponentConstants.STEP_BEFORECAMERAUPDATE_GAMEPAD = 1;\r\n SceneComponentConstants.STEP_BEFORECLEAR_PROCEDURALTEXTURE = 0;\r\n SceneComponentConstants.STEP_AFTERRENDERTARGETDRAW_LAYER = 0;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER = 0;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM = 1;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 2;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_LAYER = 3;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_PREPASS = 4;\r\n SceneComponentConstants.STEP_AFTERRENDER_AUDIO = 0;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 0;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 1;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR = 2;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 3;\r\n SceneComponentConstants.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER = 0;\r\n SceneComponentConstants.STEP_BEFORECLEARSTAGE_PREPASS = 0;\r\n SceneComponentConstants.STEP_POINTERMOVE_SPRITE = 0;\r\n SceneComponentConstants.STEP_POINTERDOWN_SPRITE = 0;\r\n SceneComponentConstants.STEP_POINTERUP_SPRITE = 0;\r\n return SceneComponentConstants;\r\n}());\r\nexport { SceneComponentConstants };\r\n/**\r\n * Representation of a stage in the scene (Basically a list of ordered steps)\r\n * @hidden\r\n */\r\nvar Stage = /** @class */ (function (_super) {\r\n __extends(Stage, _super);\r\n /**\r\n * Hide ctor from the rest of the world.\r\n * @param items The items to add.\r\n */\r\n function Stage(items) {\r\n return _super.apply(this, items) || this;\r\n }\r\n /**\r\n * Creates a new Stage.\r\n * @returns A new instance of a Stage\r\n */\r\n Stage.Create = function () {\r\n return Object.create(Stage.prototype);\r\n };\r\n /**\r\n * Registers a step in an ordered way in the targeted stage.\r\n * @param index Defines the position to register the step in\r\n * @param component Defines the component attached to the step\r\n * @param action Defines the action to launch during the step\r\n */\r\n Stage.prototype.registerStep = function (index, component, action) {\r\n var i = 0;\r\n var maxIndex = Number.MAX_VALUE;\r\n for (; i < this.length; i++) {\r\n var step = this[i];\r\n maxIndex = step.index;\r\n if (index < maxIndex) {\r\n break;\r\n }\r\n }\r\n this.splice(i, 0, { index: index, component: component, action: action.bind(component) });\r\n };\r\n /**\r\n * Clears all the steps from the stage.\r\n */\r\n Stage.prototype.clear = function () {\r\n this.length = 0;\r\n };\r\n return Stage;\r\n}(Array));\r\nexport { Stage };\r\n//# sourceMappingURL=sceneComponent.js.map","import { SceneComponentConstants } from \"../sceneComponent\";\r\n/**\r\n * Defines the layer scene component responsible to manage any layers\r\n * in a given scene.\r\n */\r\nvar LayerSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function LayerSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = SceneComponentConstants.NAME_LAYER;\r\n this.scene = scene;\r\n this._engine = scene.getEngine();\r\n scene.layers = new Array();\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n LayerSceneComponent.prototype.register = function () {\r\n this.scene._beforeCameraDrawStage.registerStep(SceneComponentConstants.STEP_BEFORECAMERADRAW_LAYER, this, this._drawCameraBackground);\r\n this.scene._afterCameraDrawStage.registerStep(SceneComponentConstants.STEP_AFTERCAMERADRAW_LAYER, this, this._drawCameraForeground);\r\n this.scene._beforeRenderTargetDrawStage.registerStep(SceneComponentConstants.STEP_BEFORERENDERTARGETDRAW_LAYER, this, this._drawRenderTargetBackground);\r\n this.scene._afterRenderTargetDrawStage.registerStep(SceneComponentConstants.STEP_AFTERRENDERTARGETDRAW_LAYER, this, this._drawRenderTargetForeground);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n LayerSceneComponent.prototype.rebuild = function () {\r\n var layers = this.scene.layers;\r\n for (var _i = 0, layers_1 = layers; _i < layers_1.length; _i++) {\r\n var layer = layers_1[_i];\r\n layer._rebuild();\r\n }\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n LayerSceneComponent.prototype.dispose = function () {\r\n var layers = this.scene.layers;\r\n while (layers.length) {\r\n layers[0].dispose();\r\n }\r\n };\r\n LayerSceneComponent.prototype._draw = function (predicate) {\r\n var layers = this.scene.layers;\r\n if (layers.length) {\r\n this._engine.setDepthBuffer(false);\r\n for (var _i = 0, layers_2 = layers; _i < layers_2.length; _i++) {\r\n var layer = layers_2[_i];\r\n if (predicate(layer)) {\r\n layer.render();\r\n }\r\n }\r\n this._engine.setDepthBuffer(true);\r\n }\r\n };\r\n LayerSceneComponent.prototype._drawCameraPredicate = function (layer, isBackground, cameraLayerMask) {\r\n return !layer.renderOnlyInRenderTargetTextures &&\r\n layer.isBackground === isBackground &&\r\n ((layer.layerMask & cameraLayerMask) !== 0);\r\n };\r\n LayerSceneComponent.prototype._drawCameraBackground = function (camera) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawCameraPredicate(layer, true, camera.layerMask);\r\n });\r\n };\r\n LayerSceneComponent.prototype._drawCameraForeground = function (camera) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawCameraPredicate(layer, false, camera.layerMask);\r\n });\r\n };\r\n LayerSceneComponent.prototype._drawRenderTargetPredicate = function (layer, isBackground, cameraLayerMask, renderTargetTexture) {\r\n return (layer.renderTargetTextures.length > 0) &&\r\n layer.isBackground === isBackground &&\r\n (layer.renderTargetTextures.indexOf(renderTargetTexture) > -1) &&\r\n ((layer.layerMask & cameraLayerMask) !== 0);\r\n };\r\n LayerSceneComponent.prototype._drawRenderTargetBackground = function (renderTarget) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawRenderTargetPredicate(layer, true, _this.scene.activeCamera.layerMask, renderTarget);\r\n });\r\n };\r\n LayerSceneComponent.prototype._drawRenderTargetForeground = function (renderTarget) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawRenderTargetPredicate(layer, false, _this.scene.activeCamera.layerMask, renderTarget);\r\n });\r\n };\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n LayerSceneComponent.prototype.addFromContainer = function (container) {\r\n var _this = this;\r\n if (!container.layers) {\r\n return;\r\n }\r\n container.layers.forEach(function (layer) {\r\n _this.scene.layers.push(layer);\r\n });\r\n };\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n LayerSceneComponent.prototype.removeFromContainer = function (container, dispose) {\r\n var _this = this;\r\n if (dispose === void 0) { dispose = false; }\r\n if (!container.layers) {\r\n return;\r\n }\r\n container.layers.forEach(function (layer) {\r\n var index = _this.scene.layers.indexOf(layer);\r\n if (index !== -1) {\r\n _this.scene.layers.splice(index, 1);\r\n }\r\n if (dispose) {\r\n layer.dispose();\r\n }\r\n });\r\n };\r\n return LayerSceneComponent;\r\n}());\r\nexport { LayerSceneComponent };\r\n//# sourceMappingURL=layerSceneComponent.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/helperFunctions\";\r\nvar name = 'layerPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n\\nuniform vec4 color;\\n\\n#include\\nvoid main(void) {\\nvec4 baseColor=texture2D(textureSampler,vUV);\\n#ifdef LINEAR\\nbaseColor.rgb=toGammaSpace(baseColor.rgb);\\n#endif\\n#ifdef ALPHATEST\\nif (baseColor.a<0.4)\\ndiscard;\\n#endif\\ngl_FragColor=baseColor*color;\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var layerPixelShader = { name: name, shader: shader };\r\n//# sourceMappingURL=layer.fragment.js.map","import { Effect } from \"../Materials/effect\";\r\nvar name = 'layerVertexShader';\r\nvar shader = \"\\nattribute vec2 position;\\n\\nuniform vec2 scale;\\nuniform vec2 offset;\\nuniform mat4 textureMatrix;\\n\\nvarying vec2 vUV;\\nconst vec2 madd=vec2(0.5,0.5);\\nvoid main(void) {\\nvec2 shiftedPosition=position*scale+offset;\\nvUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));\\ngl_Position=vec4(shiftedPosition,0.0,1.0);\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var layerVertexShader = { name: name, shader: shader };\r\n//# sourceMappingURL=layer.vertex.js.map","import { Observable } from \"../Misc/observable\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\nimport { Color4 } from '../Maths/math.color';\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { Material } from \"../Materials/material\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { LayerSceneComponent } from \"./layerSceneComponent\";\r\nimport \"../Shaders/layer.fragment\";\r\nimport \"../Shaders/layer.vertex\";\r\n/**\r\n * This represents a full screen 2d layer.\r\n * This can be useful to display a picture in the background of your scene for instance.\r\n * @see https://www.babylonjs-playground.com/#08A2BS#1\r\n */\r\nvar Layer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new layer.\r\n * This represents a full screen 2d layer.\r\n * This can be useful to display a picture in the background of your scene for instance.\r\n * @see https://www.babylonjs-playground.com/#08A2BS#1\r\n * @param name Define the name of the layer in the scene\r\n * @param imgUrl Define the url of the texture to display in the layer\r\n * @param scene Define the scene the layer belongs to\r\n * @param isBackground Defines whether the layer is displayed in front or behind the scene\r\n * @param color Defines a color for the layer\r\n */\r\n function Layer(\r\n /**\r\n * Define the name of the layer.\r\n */\r\n name, imgUrl, scene, isBackground, color) {\r\n this.name = name;\r\n /**\r\n * Define the scale of the layer in order to zoom in out of the texture.\r\n */\r\n this.scale = new Vector2(1, 1);\r\n /**\r\n * Define an offset for the layer in order to shift the texture.\r\n */\r\n this.offset = new Vector2(0, 0);\r\n /**\r\n * Define the alpha blending mode used in the layer in case the texture or color has an alpha.\r\n */\r\n this.alphaBlendingMode = 2;\r\n /**\r\n * Define a mask to restrict the layer to only some of the scene cameras.\r\n */\r\n this.layerMask = 0x0FFFFFFF;\r\n /**\r\n * Define the list of render target the layer is visible into.\r\n */\r\n this.renderTargetTextures = [];\r\n /**\r\n * Define if the layer is only used in renderTarget or if it also\r\n * renders in the main frame buffer of the canvas.\r\n */\r\n this.renderOnlyInRenderTargetTextures = false;\r\n this._vertexBuffers = {};\r\n /**\r\n * An event triggered when the layer is disposed.\r\n */\r\n this.onDisposeObservable = new Observable();\r\n /**\r\n * An event triggered before rendering the scene\r\n */\r\n this.onBeforeRenderObservable = new Observable();\r\n /**\r\n * An event triggered after rendering the scene\r\n */\r\n this.onAfterRenderObservable = new Observable();\r\n this.texture = imgUrl ? new Texture(imgUrl, scene, true) : null;\r\n this.isBackground = isBackground === undefined ? true : isBackground;\r\n this.color = color === undefined ? new Color4(1, 1, 1, 1) : color;\r\n this._scene = (scene || EngineStore.LastCreatedScene);\r\n var layerComponent = this._scene._getComponent(SceneComponentConstants.NAME_LAYER);\r\n if (!layerComponent) {\r\n layerComponent = new LayerSceneComponent(this._scene);\r\n this._scene._addComponent(layerComponent);\r\n }\r\n this._scene.layers.push(this);\r\n var engine = this._scene.getEngine();\r\n // VBO\r\n var vertices = [];\r\n vertices.push(1, 1);\r\n vertices.push(-1, 1);\r\n vertices.push(-1, -1);\r\n vertices.push(1, -1);\r\n var vertexBuffer = new VertexBuffer(engine, vertices, VertexBuffer.PositionKind, false, false, 2);\r\n this._vertexBuffers[VertexBuffer.PositionKind] = vertexBuffer;\r\n this._createIndexBuffer();\r\n }\r\n Object.defineProperty(Layer.prototype, \"onDispose\", {\r\n /**\r\n * Back compatibility with callback before the onDisposeObservable existed.\r\n * The set callback will be triggered when the layer has been disposed.\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Layer.prototype, \"onBeforeRender\", {\r\n /**\r\n * Back compatibility with callback before the onBeforeRenderObservable existed.\r\n * The set callback will be triggered just before rendering the layer.\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Layer.prototype, \"onAfterRender\", {\r\n /**\r\n * Back compatibility with callback before the onAfterRenderObservable existed.\r\n * The set callback will be triggered just after rendering the layer.\r\n */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Layer.prototype._createIndexBuffer = function () {\r\n var engine = this._scene.getEngine();\r\n // Indices\r\n var indices = [];\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n this._indexBuffer = engine.createIndexBuffer(indices);\r\n };\r\n /** @hidden */\r\n Layer.prototype._rebuild = function () {\r\n var vb = this._vertexBuffers[VertexBuffer.PositionKind];\r\n if (vb) {\r\n vb._rebuild();\r\n }\r\n this._createIndexBuffer();\r\n };\r\n /**\r\n * Renders the layer in the scene.\r\n */\r\n Layer.prototype.render = function () {\r\n var engine = this._scene.getEngine();\r\n var defines = \"\";\r\n if (this.alphaTest) {\r\n defines = \"#define ALPHATEST\";\r\n }\r\n if (this.texture && !this.texture.gammaSpace) {\r\n defines += \"\\r\\n#define LINEAR\";\r\n }\r\n if (this._previousDefines !== defines) {\r\n this._previousDefines = defines;\r\n this._effect = engine.createEffect(\"layer\", [VertexBuffer.PositionKind], [\"textureMatrix\", \"color\", \"scale\", \"offset\"], [\"textureSampler\"], defines);\r\n }\r\n var currentEffect = this._effect;\r\n // Check\r\n if (!currentEffect || !currentEffect.isReady() || !this.texture || !this.texture.isReady()) {\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n this.onBeforeRenderObservable.notifyObservers(this);\r\n // Render\r\n engine.enableEffect(currentEffect);\r\n engine.setState(false);\r\n // Texture\r\n currentEffect.setTexture(\"textureSampler\", this.texture);\r\n currentEffect.setMatrix(\"textureMatrix\", this.texture.getTextureMatrix());\r\n // Color\r\n currentEffect.setFloat4(\"color\", this.color.r, this.color.g, this.color.b, this.color.a);\r\n // Scale / offset\r\n currentEffect.setVector2(\"offset\", this.offset);\r\n currentEffect.setVector2(\"scale\", this.scale);\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, currentEffect);\r\n // Draw order\r\n if (!this.alphaTest) {\r\n engine.setAlphaMode(this.alphaBlendingMode);\r\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\r\n engine.setAlphaMode(0);\r\n }\r\n else {\r\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\r\n }\r\n this.onAfterRenderObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Disposes and releases the associated ressources.\r\n */\r\n Layer.prototype.dispose = function () {\r\n var vertexBuffer = this._vertexBuffers[VertexBuffer.PositionKind];\r\n if (vertexBuffer) {\r\n vertexBuffer.dispose();\r\n this._vertexBuffers[VertexBuffer.PositionKind] = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n if (this.texture) {\r\n this.texture.dispose();\r\n this.texture = null;\r\n }\r\n // Clean RTT list\r\n this.renderTargetTextures = [];\r\n // Remove from scene\r\n var index = this._scene.layers.indexOf(this);\r\n this._scene.layers.splice(index, 1);\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n };\r\n return Layer;\r\n}());\r\nexport { Layer };\r\n//# sourceMappingURL=layer.js.map","import { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { ValueAndUnit } from \"./valueAndUnit\";\r\n/**\r\n * Define a style used by control to automatically setup properties based on a template.\r\n * Only support font related properties so far\r\n */\r\nvar Style = /** @class */ (function () {\r\n /**\r\n * Creates a new style object\r\n * @param host defines the AdvancedDynamicTexture which hosts this style\r\n */\r\n function Style(host) {\r\n this._fontFamily = \"Arial\";\r\n this._fontStyle = \"\";\r\n this._fontWeight = \"\";\r\n /** @hidden */\r\n this._fontSize = new ValueAndUnit(18, ValueAndUnit.UNITMODE_PIXEL, false);\r\n /**\r\n * Observable raised when the style values are changed\r\n */\r\n this.onChangedObservable = new Observable();\r\n this._host = host;\r\n }\r\n Object.defineProperty(Style.prototype, \"fontSize\", {\r\n /**\r\n * Gets or sets the font size\r\n */\r\n get: function () {\r\n return this._fontSize.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._fontSize.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._fontSize.fromString(value)) {\r\n this.onChangedObservable.notifyObservers(this);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Style.prototype, \"fontFamily\", {\r\n /**\r\n * Gets or sets the font family\r\n */\r\n get: function () {\r\n return this._fontFamily;\r\n },\r\n set: function (value) {\r\n if (this._fontFamily === value) {\r\n return;\r\n }\r\n this._fontFamily = value;\r\n this.onChangedObservable.notifyObservers(this);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Style.prototype, \"fontStyle\", {\r\n /**\r\n * Gets or sets the font style\r\n */\r\n get: function () {\r\n return this._fontStyle;\r\n },\r\n set: function (value) {\r\n if (this._fontStyle === value) {\r\n return;\r\n }\r\n this._fontStyle = value;\r\n this.onChangedObservable.notifyObservers(this);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Style.prototype, \"fontWeight\", {\r\n /** Gets or sets font weight */\r\n get: function () {\r\n return this._fontWeight;\r\n },\r\n set: function (value) {\r\n if (this._fontWeight === value) {\r\n return;\r\n }\r\n this._fontWeight = value;\r\n this.onChangedObservable.notifyObservers(this);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** Dispose all associated resources */\r\n Style.prototype.dispose = function () {\r\n this.onChangedObservable.clear();\r\n };\r\n return Style;\r\n}());\r\nexport { Style };\r\n//# sourceMappingURL=style.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Vector2, Vector3 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { PointerEventTypes } from '@babylonjs/core/Events/pointerEvents';\r\nimport { ClipboardEventTypes, ClipboardInfo } from \"@babylonjs/core/Events/clipboardEvents\";\r\nimport { KeyboardEventTypes } from \"@babylonjs/core/Events/keyboardEvents\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\r\nimport { DynamicTexture } from \"@babylonjs/core/Materials/Textures/dynamicTexture\";\r\nimport { Layer } from \"@babylonjs/core/Layers/layer\";\r\nimport { Container } from \"./controls/container\";\r\nimport { Style } from \"./style\";\r\nimport { Measure } from \"./measure\";\r\nimport { Constants } from '@babylonjs/core/Engines/constants';\r\nimport { Viewport } from '@babylonjs/core/Maths/math.viewport';\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\n/**\r\n* Class used to create texture to support 2D GUI elements\r\n* @see https://doc.babylonjs.com/how_to/gui\r\n*/\r\nvar AdvancedDynamicTexture = /** @class */ (function (_super) {\r\n __extends(AdvancedDynamicTexture, _super);\r\n /**\r\n * Creates a new AdvancedDynamicTexture\r\n * @param name defines the name of the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param scene defines the hosting scene\r\n * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)\r\n * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\r\n */\r\n function AdvancedDynamicTexture(name, width, height, scene, generateMipMaps, samplingMode, invertY) {\r\n if (width === void 0) { width = 0; }\r\n if (height === void 0) { height = 0; }\r\n if (generateMipMaps === void 0) { generateMipMaps = false; }\r\n if (samplingMode === void 0) { samplingMode = Texture.NEAREST_SAMPLINGMODE; }\r\n var _this = _super.call(this, name, { width: width, height: height }, scene, generateMipMaps, samplingMode, Constants.TEXTUREFORMAT_RGBA, invertY) || this;\r\n _this._isDirty = false;\r\n /** @hidden */\r\n _this._rootContainer = new Container(\"root\");\r\n /** @hidden */\r\n _this._lastControlOver = {};\r\n /** @hidden */\r\n _this._lastControlDown = {};\r\n /** @hidden */\r\n _this._capturingControl = {};\r\n /** @hidden */\r\n _this._linkedControls = new Array();\r\n _this._isFullscreen = false;\r\n _this._fullscreenViewport = new Viewport(0, 0, 1, 1);\r\n _this._idealWidth = 0;\r\n _this._idealHeight = 0;\r\n _this._useSmallestIdeal = false;\r\n _this._renderAtIdealSize = false;\r\n _this._blockNextFocusCheck = false;\r\n _this._renderScale = 1;\r\n _this._cursorChanged = false;\r\n _this._defaultMousePointerId = 0;\r\n /** @hidden */\r\n _this._numLayoutCalls = 0;\r\n /** @hidden */\r\n _this._numRenderCalls = 0;\r\n /**\r\n * Define type to string to ensure compatibility across browsers\r\n * Safari doesn't support DataTransfer constructor\r\n */\r\n _this._clipboardData = \"\";\r\n /**\r\n * Observable event triggered each time an clipboard event is received from the rendering canvas\r\n */\r\n _this.onClipboardObservable = new Observable();\r\n /**\r\n * Observable event triggered each time a pointer down is intercepted by a control\r\n */\r\n _this.onControlPickedObservable = new Observable();\r\n /**\r\n * Observable event triggered before layout is evaluated\r\n */\r\n _this.onBeginLayoutObservable = new Observable();\r\n /**\r\n * Observable event triggered after the layout was evaluated\r\n */\r\n _this.onEndLayoutObservable = new Observable();\r\n /**\r\n * Observable event triggered before the texture is rendered\r\n */\r\n _this.onBeginRenderObservable = new Observable();\r\n /**\r\n * Observable event triggered after the texture was rendered\r\n */\r\n _this.onEndRenderObservable = new Observable();\r\n /**\r\n * Gets or sets a boolean defining if alpha is stored as premultiplied\r\n */\r\n _this.premulAlpha = false;\r\n /**\r\n * Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture\r\n */\r\n _this.applyYInversionOnUpdate = true;\r\n _this._useInvalidateRectOptimization = true;\r\n // Invalidated rectangle which is the combination of all invalidated controls after they have been rotated into absolute position\r\n _this._invalidatedRectangle = null;\r\n _this._clearMeasure = new Measure(0, 0, 0, 0);\r\n /** @hidden */\r\n _this.onClipboardCopy = function (rawEvt) {\r\n var evt = rawEvt;\r\n var ev = new ClipboardInfo(ClipboardEventTypes.COPY, evt);\r\n _this.onClipboardObservable.notifyObservers(ev);\r\n evt.preventDefault();\r\n };\r\n /** @hidden */\r\n _this.onClipboardCut = function (rawEvt) {\r\n var evt = rawEvt;\r\n var ev = new ClipboardInfo(ClipboardEventTypes.CUT, evt);\r\n _this.onClipboardObservable.notifyObservers(ev);\r\n evt.preventDefault();\r\n };\r\n /** @hidden */\r\n _this.onClipboardPaste = function (rawEvt) {\r\n var evt = rawEvt;\r\n var ev = new ClipboardInfo(ClipboardEventTypes.PASTE, evt);\r\n _this.onClipboardObservable.notifyObservers(ev);\r\n evt.preventDefault();\r\n };\r\n scene = _this.getScene();\r\n if (!scene || !_this._texture) {\r\n return _this;\r\n }\r\n _this._rootElement = scene.getEngine().getInputElement();\r\n _this._renderObserver = scene.onBeforeCameraRenderObservable.add(function (camera) { return _this._checkUpdate(camera); });\r\n _this._preKeyboardObserver = scene.onPreKeyboardObservable.add(function (info) {\r\n if (!_this._focusedControl) {\r\n return;\r\n }\r\n if (info.type === KeyboardEventTypes.KEYDOWN) {\r\n _this._focusedControl.processKeyboard(info.event);\r\n }\r\n info.skipOnPointerObservable = true;\r\n });\r\n _this._rootContainer._link(_this);\r\n _this.hasAlpha = true;\r\n if (!width || !height) {\r\n _this._resizeObserver = scene.getEngine().onResizeObservable.add(function () { return _this._onResize(); });\r\n _this._onResize();\r\n }\r\n _this._texture.isReady = true;\r\n return _this;\r\n }\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"numLayoutCalls\", {\r\n /** Gets the number of layout calls made the last time the ADT has been rendered */\r\n get: function () {\r\n return this._numLayoutCalls;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"numRenderCalls\", {\r\n /** Gets the number of render calls made the last time the ADT has been rendered */\r\n get: function () {\r\n return this._numRenderCalls;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"renderScale\", {\r\n /**\r\n * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).\r\n * Useful when you want more antialiasing\r\n */\r\n get: function () {\r\n return this._renderScale;\r\n },\r\n set: function (value) {\r\n if (value === this._renderScale) {\r\n return;\r\n }\r\n this._renderScale = value;\r\n this._onResize();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"background\", {\r\n /** Gets or sets the background color */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this.markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"idealWidth\", {\r\n /**\r\n * Gets or sets the ideal width used to design controls.\r\n * The GUI will then rescale everything accordingly\r\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\r\n */\r\n get: function () {\r\n return this._idealWidth;\r\n },\r\n set: function (value) {\r\n if (this._idealWidth === value) {\r\n return;\r\n }\r\n this._idealWidth = value;\r\n this.markAsDirty();\r\n this._rootContainer._markAllAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"idealHeight\", {\r\n /**\r\n * Gets or sets the ideal height used to design controls.\r\n * The GUI will then rescale everything accordingly\r\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\r\n */\r\n get: function () {\r\n return this._idealHeight;\r\n },\r\n set: function (value) {\r\n if (this._idealHeight === value) {\r\n return;\r\n }\r\n this._idealHeight = value;\r\n this.markAsDirty();\r\n this._rootContainer._markAllAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"useSmallestIdeal\", {\r\n /**\r\n * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set\r\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\r\n */\r\n get: function () {\r\n return this._useSmallestIdeal;\r\n },\r\n set: function (value) {\r\n if (this._useSmallestIdeal === value) {\r\n return;\r\n }\r\n this._useSmallestIdeal = value;\r\n this.markAsDirty();\r\n this._rootContainer._markAllAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"renderAtIdealSize\", {\r\n /**\r\n * Gets or sets a boolean indicating if adaptive scaling must be used\r\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\r\n */\r\n get: function () {\r\n return this._renderAtIdealSize;\r\n },\r\n set: function (value) {\r\n if (this._renderAtIdealSize === value) {\r\n return;\r\n }\r\n this._renderAtIdealSize = value;\r\n this._onResize();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"idealRatio\", {\r\n /**\r\n * Gets the ratio used when in \"ideal mode\"\r\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\r\n * */\r\n get: function () {\r\n var rwidth = 0;\r\n var rheight = 0;\r\n if (this._idealWidth) {\r\n rwidth = (this.getSize().width) / this._idealWidth;\r\n }\r\n if (this._idealHeight) {\r\n rheight = (this.getSize().height) / this._idealHeight;\r\n }\r\n if (this._useSmallestIdeal && this._idealWidth && this._idealHeight) {\r\n return window.innerWidth < window.innerHeight ? rwidth : rheight;\r\n }\r\n if (this._idealWidth) { // horizontal\r\n return rwidth;\r\n }\r\n if (this._idealHeight) { // vertical\r\n return rheight;\r\n }\r\n return 1;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"layer\", {\r\n /**\r\n * Gets the underlying layer used to render the texture when in fullscreen mode\r\n */\r\n get: function () {\r\n return this._layerToDispose;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"rootContainer\", {\r\n /**\r\n * Gets the root container control\r\n */\r\n get: function () {\r\n return this._rootContainer;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns an array containing the root container.\r\n * This is mostly used to let the Inspector introspects the ADT\r\n * @returns an array containing the rootContainer\r\n */\r\n AdvancedDynamicTexture.prototype.getChildren = function () {\r\n return [this._rootContainer];\r\n };\r\n /**\r\n * Will return all controls that are inside this texture\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @return all child controls\r\n */\r\n AdvancedDynamicTexture.prototype.getDescendants = function (directDescendantsOnly, predicate) {\r\n return this._rootContainer.getDescendants(directDescendantsOnly, predicate);\r\n };\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"focusedControl\", {\r\n /**\r\n * Gets or sets the current focused control\r\n */\r\n get: function () {\r\n return this._focusedControl;\r\n },\r\n set: function (control) {\r\n if (this._focusedControl == control) {\r\n return;\r\n }\r\n if (this._focusedControl) {\r\n this._focusedControl.onBlur();\r\n }\r\n if (control) {\r\n control.onFocus();\r\n }\r\n this._focusedControl = control;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"isForeground\", {\r\n /**\r\n * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode\r\n */\r\n get: function () {\r\n if (!this.layer) {\r\n return true;\r\n }\r\n return (!this.layer.isBackground);\r\n },\r\n set: function (value) {\r\n if (!this.layer) {\r\n return;\r\n }\r\n if (this.layer.isBackground === !value) {\r\n return;\r\n }\r\n this.layer.isBackground = !value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"clipboardData\", {\r\n /**\r\n * Gets or set information about clipboardData\r\n */\r\n get: function () {\r\n return this._clipboardData;\r\n },\r\n set: function (value) {\r\n this._clipboardData = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"AdvancedDynamicTexture\"\r\n */\r\n AdvancedDynamicTexture.prototype.getClassName = function () {\r\n return \"AdvancedDynamicTexture\";\r\n };\r\n /**\r\n * Function used to execute a function on all controls\r\n * @param func defines the function to execute\r\n * @param container defines the container where controls belong. If null the root container will be used\r\n */\r\n AdvancedDynamicTexture.prototype.executeOnAllControls = function (func, container) {\r\n if (!container) {\r\n container = this._rootContainer;\r\n }\r\n func(container);\r\n for (var _i = 0, _a = container.children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (child.children) {\r\n this.executeOnAllControls(func, child);\r\n continue;\r\n }\r\n func(child);\r\n }\r\n };\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"useInvalidateRectOptimization\", {\r\n /**\r\n * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on\r\n */\r\n get: function () {\r\n return this._useInvalidateRectOptimization;\r\n },\r\n set: function (value) {\r\n this._useInvalidateRectOptimization = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Invalidates a rectangle area on the gui texture\r\n * @param invalidMinX left most position of the rectangle to invalidate in the texture\r\n * @param invalidMinY top most position of the rectangle to invalidate in the texture\r\n * @param invalidMaxX right most position of the rectangle to invalidate in the texture\r\n * @param invalidMaxY bottom most position of the rectangle to invalidate in the texture\r\n */\r\n AdvancedDynamicTexture.prototype.invalidateRect = function (invalidMinX, invalidMinY, invalidMaxX, invalidMaxY) {\r\n if (!this._useInvalidateRectOptimization) {\r\n return;\r\n }\r\n if (!this._invalidatedRectangle) {\r\n this._invalidatedRectangle = new Measure(invalidMinX, invalidMinY, invalidMaxX - invalidMinX + 1, invalidMaxY - invalidMinY + 1);\r\n }\r\n else {\r\n // Compute intersection\r\n var maxX = Math.ceil(Math.max(this._invalidatedRectangle.left + this._invalidatedRectangle.width - 1, invalidMaxX));\r\n var maxY = Math.ceil(Math.max(this._invalidatedRectangle.top + this._invalidatedRectangle.height - 1, invalidMaxY));\r\n this._invalidatedRectangle.left = Math.floor(Math.min(this._invalidatedRectangle.left, invalidMinX));\r\n this._invalidatedRectangle.top = Math.floor(Math.min(this._invalidatedRectangle.top, invalidMinY));\r\n this._invalidatedRectangle.width = maxX - this._invalidatedRectangle.left + 1;\r\n this._invalidatedRectangle.height = maxY - this._invalidatedRectangle.top + 1;\r\n }\r\n };\r\n /**\r\n * Marks the texture as dirty forcing a complete update\r\n */\r\n AdvancedDynamicTexture.prototype.markAsDirty = function () {\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Helper function used to create a new style\r\n * @returns a new style\r\n * @see https://doc.babylonjs.com/how_to/gui#styles\r\n */\r\n AdvancedDynamicTexture.prototype.createStyle = function () {\r\n return new Style(this);\r\n };\r\n /**\r\n * Adds a new control to the root container\r\n * @param control defines the control to add\r\n * @returns the current texture\r\n */\r\n AdvancedDynamicTexture.prototype.addControl = function (control) {\r\n this._rootContainer.addControl(control);\r\n return this;\r\n };\r\n /**\r\n * Removes a control from the root container\r\n * @param control defines the control to remove\r\n * @returns the current texture\r\n */\r\n AdvancedDynamicTexture.prototype.removeControl = function (control) {\r\n this._rootContainer.removeControl(control);\r\n return this;\r\n };\r\n /**\r\n * Release all resources\r\n */\r\n AdvancedDynamicTexture.prototype.dispose = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._rootElement = null;\r\n scene.onBeforeCameraRenderObservable.remove(this._renderObserver);\r\n if (this._resizeObserver) {\r\n scene.getEngine().onResizeObservable.remove(this._resizeObserver);\r\n }\r\n if (this._pointerMoveObserver) {\r\n scene.onPrePointerObservable.remove(this._pointerMoveObserver);\r\n }\r\n if (this._pointerObserver) {\r\n scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n if (this._preKeyboardObserver) {\r\n scene.onPreKeyboardObservable.remove(this._preKeyboardObserver);\r\n }\r\n if (this._canvasPointerOutObserver) {\r\n scene.getEngine().onCanvasPointerOutObservable.remove(this._canvasPointerOutObserver);\r\n }\r\n if (this._canvasBlurObserver) {\r\n scene.getEngine().onCanvasBlurObservable.remove(this._canvasBlurObserver);\r\n }\r\n if (this._layerToDispose) {\r\n this._layerToDispose.texture = null;\r\n this._layerToDispose.dispose();\r\n this._layerToDispose = null;\r\n }\r\n this._rootContainer.dispose();\r\n this.onClipboardObservable.clear();\r\n this.onControlPickedObservable.clear();\r\n this.onBeginRenderObservable.clear();\r\n this.onEndRenderObservable.clear();\r\n this.onBeginLayoutObservable.clear();\r\n this.onEndLayoutObservable.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n AdvancedDynamicTexture.prototype._onResize = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n // Check size\r\n var engine = scene.getEngine();\r\n var textureSize = this.getSize();\r\n var renderWidth = engine.getRenderWidth() * this._renderScale;\r\n var renderHeight = engine.getRenderHeight() * this._renderScale;\r\n if (this._renderAtIdealSize) {\r\n if (this._idealWidth) {\r\n renderHeight = (renderHeight * this._idealWidth) / renderWidth;\r\n renderWidth = this._idealWidth;\r\n }\r\n else if (this._idealHeight) {\r\n renderWidth = (renderWidth * this._idealHeight) / renderHeight;\r\n renderHeight = this._idealHeight;\r\n }\r\n }\r\n if (textureSize.width !== renderWidth || textureSize.height !== renderHeight) {\r\n this.scaleTo(renderWidth, renderHeight);\r\n this.markAsDirty();\r\n if (this._idealWidth || this._idealHeight) {\r\n this._rootContainer._markAllAsDirty();\r\n }\r\n }\r\n this.invalidateRect(0, 0, textureSize.width - 1, textureSize.height - 1);\r\n };\r\n /** @hidden */\r\n AdvancedDynamicTexture.prototype._getGlobalViewport = function (scene) {\r\n var engine = scene.getEngine();\r\n return this._fullscreenViewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight());\r\n };\r\n /**\r\n * Get screen coordinates for a vector3\r\n * @param position defines the position to project\r\n * @param worldMatrix defines the world matrix to use\r\n * @returns the projected position\r\n */\r\n AdvancedDynamicTexture.prototype.getProjectedPosition = function (position, worldMatrix) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return Vector2.Zero();\r\n }\r\n var globalViewport = this._getGlobalViewport(scene);\r\n var projectedPosition = Vector3.Project(position, worldMatrix, scene.getTransformMatrix(), globalViewport);\r\n projectedPosition.scaleInPlace(this.renderScale);\r\n return new Vector2(projectedPosition.x, projectedPosition.y);\r\n };\r\n /**\r\n * Get screen coordinates for a vector3\r\n * @param position defines the position to project\r\n * @param worldMatrix defines the world matrix to use\r\n * @returns the projected position with Z\r\n */\r\n AdvancedDynamicTexture.prototype.getProjectedPositionWithZ = function (position, worldMatrix) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return Vector3.Zero();\r\n }\r\n var globalViewport = this._getGlobalViewport(scene);\r\n var projectedPosition = Vector3.Project(position, worldMatrix, scene.getTransformMatrix(), globalViewport);\r\n projectedPosition.scaleInPlace(this.renderScale);\r\n return new Vector3(projectedPosition.x, projectedPosition.y, projectedPosition.z);\r\n };\r\n AdvancedDynamicTexture.prototype._checkUpdate = function (camera) {\r\n if (this._layerToDispose) {\r\n if ((camera.layerMask & this._layerToDispose.layerMask) === 0) {\r\n return;\r\n }\r\n }\r\n if (this._isFullscreen && this._linkedControls.length) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var globalViewport = this._getGlobalViewport(scene);\r\n var _loop_1 = function (control) {\r\n if (!control.isVisible) {\r\n return \"continue\";\r\n }\r\n var mesh = control._linkedMesh;\r\n if (!mesh || mesh.isDisposed()) {\r\n Tools.SetImmediate(function () {\r\n control.linkWithMesh(null);\r\n });\r\n return \"continue\";\r\n }\r\n var position = mesh.getBoundingInfo ? mesh.getBoundingInfo().boundingSphere.center : Vector3.ZeroReadOnly;\r\n var projectedPosition = Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);\r\n if (projectedPosition.z < 0 || projectedPosition.z > 1) {\r\n control.notRenderable = true;\r\n return \"continue\";\r\n }\r\n control.notRenderable = false;\r\n // Account for RenderScale.\r\n projectedPosition.scaleInPlace(this_1.renderScale);\r\n control._moveToProjectedPosition(projectedPosition);\r\n };\r\n var this_1 = this;\r\n for (var _i = 0, _a = this._linkedControls; _i < _a.length; _i++) {\r\n var control = _a[_i];\r\n _loop_1(control);\r\n }\r\n }\r\n if (!this._isDirty && !this._rootContainer.isDirty) {\r\n return;\r\n }\r\n this._isDirty = false;\r\n this._render();\r\n this.update(this.applyYInversionOnUpdate, this.premulAlpha);\r\n };\r\n AdvancedDynamicTexture.prototype._render = function () {\r\n var textureSize = this.getSize();\r\n var renderWidth = textureSize.width;\r\n var renderHeight = textureSize.height;\r\n var context = this.getContext();\r\n context.font = \"18px Arial\";\r\n context.strokeStyle = \"white\";\r\n // Layout\r\n this.onBeginLayoutObservable.notifyObservers(this);\r\n var measure = new Measure(0, 0, renderWidth, renderHeight);\r\n this._numLayoutCalls = 0;\r\n this._rootContainer._layout(measure, context);\r\n this.onEndLayoutObservable.notifyObservers(this);\r\n this._isDirty = false; // Restoring the dirty state that could have been set by controls during layout processing\r\n // Clear\r\n if (this._invalidatedRectangle) {\r\n this._clearMeasure.copyFrom(this._invalidatedRectangle);\r\n }\r\n else {\r\n this._clearMeasure.copyFromFloats(0, 0, renderWidth, renderHeight);\r\n }\r\n context.clearRect(this._clearMeasure.left, this._clearMeasure.top, this._clearMeasure.width, this._clearMeasure.height);\r\n if (this._background) {\r\n context.save();\r\n context.fillStyle = this._background;\r\n context.fillRect(this._clearMeasure.left, this._clearMeasure.top, this._clearMeasure.width, this._clearMeasure.height);\r\n context.restore();\r\n }\r\n // Render\r\n this.onBeginRenderObservable.notifyObservers(this);\r\n this._numRenderCalls = 0;\r\n this._rootContainer._render(context, this._invalidatedRectangle);\r\n this.onEndRenderObservable.notifyObservers(this);\r\n this._invalidatedRectangle = null;\r\n };\r\n /** @hidden */\r\n AdvancedDynamicTexture.prototype._changeCursor = function (cursor) {\r\n if (this._rootElement) {\r\n this._rootElement.style.cursor = cursor;\r\n this._cursorChanged = true;\r\n }\r\n };\r\n /** @hidden */\r\n AdvancedDynamicTexture.prototype._registerLastControlDown = function (control, pointerId) {\r\n this._lastControlDown[pointerId] = control;\r\n this.onControlPickedObservable.notifyObservers(control);\r\n };\r\n AdvancedDynamicTexture.prototype._doPicking = function (x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n var textureSize = this.getSize();\r\n if (this._isFullscreen) {\r\n var camera = scene.cameraToUseForPointers || scene.activeCamera;\r\n var viewport = camera.viewport;\r\n x = x * (textureSize.width / (engine.getRenderWidth() * viewport.width));\r\n y = y * (textureSize.height / (engine.getRenderHeight() * viewport.height));\r\n }\r\n if (this._capturingControl[pointerId]) {\r\n this._capturingControl[pointerId]._processObservables(type, x, y, pi, pointerId, buttonIndex);\r\n return;\r\n }\r\n this._cursorChanged = false;\r\n if (!this._rootContainer._processPicking(x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY)) {\r\n this._changeCursor(\"\");\r\n if (type === PointerEventTypes.POINTERMOVE) {\r\n if (this._lastControlOver[pointerId]) {\r\n this._lastControlOver[pointerId]._onPointerOut(this._lastControlOver[pointerId], pi);\r\n delete this._lastControlOver[pointerId];\r\n }\r\n }\r\n }\r\n if (!this._cursorChanged) {\r\n this._changeCursor(\"\");\r\n }\r\n this._manageFocus();\r\n };\r\n /** @hidden */\r\n AdvancedDynamicTexture.prototype._cleanControlAfterRemovalFromList = function (list, control) {\r\n for (var pointerId in list) {\r\n if (!list.hasOwnProperty(pointerId)) {\r\n continue;\r\n }\r\n var lastControlOver = list[pointerId];\r\n if (lastControlOver === control) {\r\n delete list[pointerId];\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n AdvancedDynamicTexture.prototype._cleanControlAfterRemoval = function (control) {\r\n this._cleanControlAfterRemovalFromList(this._lastControlDown, control);\r\n this._cleanControlAfterRemovalFromList(this._lastControlOver, control);\r\n };\r\n /** Attach to all scene events required to support pointer events */\r\n AdvancedDynamicTexture.prototype.attach = function () {\r\n var _this = this;\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var tempViewport = new Viewport(0, 0, 0, 0);\r\n this._pointerMoveObserver = scene.onPrePointerObservable.add(function (pi, state) {\r\n if (scene.isPointerCaptured((pi.event).pointerId)) {\r\n return;\r\n }\r\n if (pi.type !== PointerEventTypes.POINTERMOVE\r\n && pi.type !== PointerEventTypes.POINTERUP\r\n && pi.type !== PointerEventTypes.POINTERDOWN\r\n && pi.type !== PointerEventTypes.POINTERWHEEL) {\r\n return;\r\n }\r\n if (!scene) {\r\n return;\r\n }\r\n if (pi.type === PointerEventTypes.POINTERMOVE && pi.event.pointerId) {\r\n _this._defaultMousePointerId = pi.event.pointerId; // This is required to make sure we have the correct pointer ID for wheel\r\n }\r\n var camera = scene.cameraToUseForPointers || scene.activeCamera;\r\n var engine = scene.getEngine();\r\n if (!camera) {\r\n tempViewport.x = 0;\r\n tempViewport.y = 0;\r\n tempViewport.width = engine.getRenderWidth();\r\n tempViewport.height = engine.getRenderHeight();\r\n }\r\n else {\r\n camera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), tempViewport);\r\n }\r\n var x = scene.pointerX / engine.getHardwareScalingLevel() - tempViewport.x;\r\n var y = scene.pointerY / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - tempViewport.y - tempViewport.height);\r\n _this._shouldBlockPointer = false;\r\n // Do picking modifies _shouldBlockPointer\r\n var pointerId = pi.event.pointerId || _this._defaultMousePointerId;\r\n _this._doPicking(x, y, pi, pi.type, pointerId, pi.event.button, pi.event.deltaX, pi.event.deltaY);\r\n // Avoid overwriting a true skipOnPointerObservable to false\r\n if (_this._shouldBlockPointer) {\r\n pi.skipOnPointerObservable = _this._shouldBlockPointer;\r\n }\r\n });\r\n this._attachToOnPointerOut(scene);\r\n this._attachToOnBlur(scene);\r\n };\r\n /**\r\n * Register the clipboard Events onto the canvas\r\n */\r\n AdvancedDynamicTexture.prototype.registerClipboardEvents = function () {\r\n self.addEventListener(\"copy\", this.onClipboardCopy, false);\r\n self.addEventListener(\"cut\", this.onClipboardCut, false);\r\n self.addEventListener(\"paste\", this.onClipboardPaste, false);\r\n };\r\n /**\r\n * Unregister the clipboard Events from the canvas\r\n */\r\n AdvancedDynamicTexture.prototype.unRegisterClipboardEvents = function () {\r\n self.removeEventListener(\"copy\", this.onClipboardCopy);\r\n self.removeEventListener(\"cut\", this.onClipboardCut);\r\n self.removeEventListener(\"paste\", this.onClipboardPaste);\r\n };\r\n /**\r\n * Connect the texture to a hosting mesh to enable interactions\r\n * @param mesh defines the mesh to attach to\r\n * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well\r\n */\r\n AdvancedDynamicTexture.prototype.attachToMesh = function (mesh, supportPointerMove) {\r\n var _this = this;\r\n if (supportPointerMove === void 0) { supportPointerMove = true; }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._pointerObserver = scene.onPointerObservable.add(function (pi, state) {\r\n if (pi.type !== PointerEventTypes.POINTERMOVE\r\n && pi.type !== PointerEventTypes.POINTERUP\r\n && pi.type !== PointerEventTypes.POINTERDOWN) {\r\n return;\r\n }\r\n var pointerId = pi.event.pointerId || _this._defaultMousePointerId;\r\n if (pi.pickInfo && pi.pickInfo.hit && pi.pickInfo.pickedMesh === mesh) {\r\n var uv = pi.pickInfo.getTextureCoordinates();\r\n if (uv) {\r\n var size = _this.getSize();\r\n _this._doPicking(uv.x * size.width, (_this.applyYInversionOnUpdate ? (1.0 - uv.y) : uv.y) * size.height, pi, pi.type, pointerId, pi.event.button);\r\n }\r\n }\r\n else if (pi.type === PointerEventTypes.POINTERUP) {\r\n if (_this._lastControlDown[pointerId]) {\r\n _this._lastControlDown[pointerId]._forcePointerUp(pointerId);\r\n }\r\n delete _this._lastControlDown[pointerId];\r\n if (_this.focusedControl) {\r\n var friendlyControls = _this.focusedControl.keepsFocusWith();\r\n var canMoveFocus = true;\r\n if (friendlyControls) {\r\n for (var _i = 0, friendlyControls_1 = friendlyControls; _i < friendlyControls_1.length; _i++) {\r\n var control = friendlyControls_1[_i];\r\n // Same host, no need to keep the focus\r\n if (_this === control._host) {\r\n continue;\r\n }\r\n // Different hosts\r\n var otherHost = control._host;\r\n if (otherHost._lastControlOver[pointerId] && otherHost._lastControlOver[pointerId].isAscendant(control)) {\r\n canMoveFocus = false;\r\n break;\r\n }\r\n }\r\n }\r\n if (canMoveFocus) {\r\n _this.focusedControl = null;\r\n }\r\n }\r\n }\r\n else if (pi.type === PointerEventTypes.POINTERMOVE) {\r\n if (_this._lastControlOver[pointerId]) {\r\n _this._lastControlOver[pointerId]._onPointerOut(_this._lastControlOver[pointerId], pi, true);\r\n }\r\n delete _this._lastControlOver[pointerId];\r\n }\r\n });\r\n mesh.enablePointerMoveEvents = supportPointerMove;\r\n this._attachToOnPointerOut(scene);\r\n this._attachToOnBlur(scene);\r\n };\r\n /**\r\n * Move the focus to a specific control\r\n * @param control defines the control which will receive the focus\r\n */\r\n AdvancedDynamicTexture.prototype.moveFocusToControl = function (control) {\r\n this.focusedControl = control;\r\n this._lastPickedControl = control;\r\n this._blockNextFocusCheck = true;\r\n };\r\n AdvancedDynamicTexture.prototype._manageFocus = function () {\r\n if (this._blockNextFocusCheck) {\r\n this._blockNextFocusCheck = false;\r\n this._lastPickedControl = this._focusedControl;\r\n return;\r\n }\r\n // Focus management\r\n if (this._focusedControl) {\r\n if (this._focusedControl !== this._lastPickedControl) {\r\n if (this._lastPickedControl.isFocusInvisible) {\r\n return;\r\n }\r\n this.focusedControl = null;\r\n }\r\n }\r\n };\r\n AdvancedDynamicTexture.prototype._attachToOnPointerOut = function (scene) {\r\n var _this = this;\r\n this._canvasPointerOutObserver = scene.getEngine().onCanvasPointerOutObservable.add(function (pointerEvent) {\r\n if (_this._lastControlOver[pointerEvent.pointerId]) {\r\n _this._lastControlOver[pointerEvent.pointerId]._onPointerOut(_this._lastControlOver[pointerEvent.pointerId], null);\r\n }\r\n delete _this._lastControlOver[pointerEvent.pointerId];\r\n if (_this._lastControlDown[pointerEvent.pointerId] && _this._lastControlDown[pointerEvent.pointerId] !== _this._capturingControl[pointerEvent.pointerId]) {\r\n _this._lastControlDown[pointerEvent.pointerId]._forcePointerUp();\r\n delete _this._lastControlDown[pointerEvent.pointerId];\r\n }\r\n });\r\n };\r\n AdvancedDynamicTexture.prototype._attachToOnBlur = function (scene) {\r\n var _this = this;\r\n this._canvasBlurObserver = scene.getEngine().onCanvasBlurObservable.add(function (pointerEvent) {\r\n Object.entries(_this._lastControlDown).forEach(function (_a) {\r\n var key = _a[0], value = _a[1];\r\n value._onCanvasBlur();\r\n });\r\n _this._lastControlDown = {};\r\n });\r\n };\r\n // Statics\r\n /**\r\n * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)\r\n * @param mesh defines the mesh which will receive the texture\r\n * @param width defines the texture width (1024 by default)\r\n * @param height defines the texture height (1024 by default)\r\n * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)\r\n * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\r\n * @returns a new AdvancedDynamicTexture\r\n */\r\n AdvancedDynamicTexture.CreateForMesh = function (mesh, width, height, supportPointerMove, onlyAlphaTesting, invertY) {\r\n if (width === void 0) { width = 1024; }\r\n if (height === void 0) { height = 1024; }\r\n if (supportPointerMove === void 0) { supportPointerMove = true; }\r\n if (onlyAlphaTesting === void 0) { onlyAlphaTesting = false; }\r\n var result = new AdvancedDynamicTexture(mesh.name + \" AdvancedDynamicTexture\", width, height, mesh.getScene(), true, Texture.TRILINEAR_SAMPLINGMODE, invertY);\r\n var material = new StandardMaterial(\"AdvancedDynamicTextureMaterial\", mesh.getScene());\r\n material.backFaceCulling = false;\r\n material.diffuseColor = Color3.Black();\r\n material.specularColor = Color3.Black();\r\n if (onlyAlphaTesting) {\r\n material.diffuseTexture = result;\r\n material.emissiveTexture = result;\r\n result.hasAlpha = true;\r\n }\r\n else {\r\n material.emissiveTexture = result;\r\n material.opacityTexture = result;\r\n }\r\n mesh.material = material;\r\n result.attachToMesh(mesh, supportPointerMove);\r\n return result;\r\n };\r\n /**\r\n * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh) BUT do not create a new material for the mesh. You will be responsible for connecting the texture\r\n * @param mesh defines the mesh which will receive the texture\r\n * @param width defines the texture width (1024 by default)\r\n * @param height defines the texture height (1024 by default)\r\n * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\r\n * @returns a new AdvancedDynamicTexture\r\n */\r\n AdvancedDynamicTexture.CreateForMeshTexture = function (mesh, width, height, supportPointerMove, invertY) {\r\n if (width === void 0) { width = 1024; }\r\n if (height === void 0) { height = 1024; }\r\n if (supportPointerMove === void 0) { supportPointerMove = true; }\r\n var result = new AdvancedDynamicTexture(mesh.name + \" AdvancedDynamicTexture\", width, height, mesh.getScene(), true, Texture.TRILINEAR_SAMPLINGMODE, invertY);\r\n result.attachToMesh(mesh, supportPointerMove);\r\n return result;\r\n };\r\n /**\r\n * Creates a new AdvancedDynamicTexture in fullscreen mode.\r\n * In this mode the texture will rely on a layer for its rendering.\r\n * This allows it to be treated like any other layer.\r\n * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.\r\n * LayerMask is set through advancedTexture.layer.layerMask\r\n * @param name defines name for the texture\r\n * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)\r\n * @param scene defines the hsoting scene\r\n * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)\r\n * @returns a new AdvancedDynamicTexture\r\n */\r\n AdvancedDynamicTexture.CreateFullscreenUI = function (name, foreground, scene, sampling) {\r\n if (foreground === void 0) { foreground = true; }\r\n if (scene === void 0) { scene = null; }\r\n if (sampling === void 0) { sampling = Texture.BILINEAR_SAMPLINGMODE; }\r\n var result = new AdvancedDynamicTexture(name, 0, 0, scene, false, sampling);\r\n // Display\r\n var layer = new Layer(name + \"_layer\", null, scene, !foreground);\r\n layer.texture = result;\r\n result._layerToDispose = layer;\r\n result._isFullscreen = true;\r\n // Attach\r\n result.attach();\r\n return result;\r\n };\r\n return AdvancedDynamicTexture;\r\n}(DynamicTexture));\r\nexport { AdvancedDynamicTexture };\r\n//# sourceMappingURL=advancedDynamicTexture.js.map","import { __extends } from \"tslib\";\r\nimport { Logger } from \"@babylonjs/core/Misc/logger\";\r\nimport { Control } from \"./control\";\r\nimport { Measure } from \"../measure\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Root class for 2D containers\r\n * @see https://doc.babylonjs.com/how_to/gui#containers\r\n */\r\nvar Container = /** @class */ (function (_super) {\r\n __extends(Container, _super);\r\n /**\r\n * Creates a new Container\r\n * @param name defines the name of the container\r\n */\r\n function Container(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n /** @hidden */\r\n _this._children = new Array();\r\n /** @hidden */\r\n _this._measureForChildren = Measure.Empty();\r\n /** @hidden */\r\n _this._background = \"\";\r\n /** @hidden */\r\n _this._adaptWidthToChildren = false;\r\n /** @hidden */\r\n _this._adaptHeightToChildren = false;\r\n /**\r\n * Gets or sets a boolean indicating that layout cycle errors should be displayed on the console\r\n */\r\n _this.logLayoutCycleErrors = false;\r\n /**\r\n * Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed\r\n */\r\n _this.maxLayoutCycle = 3;\r\n return _this;\r\n }\r\n Object.defineProperty(Container.prototype, \"adaptHeightToChildren\", {\r\n /** Gets or sets a boolean indicating if the container should try to adapt to its children height */\r\n get: function () {\r\n return this._adaptHeightToChildren;\r\n },\r\n set: function (value) {\r\n if (this._adaptHeightToChildren === value) {\r\n return;\r\n }\r\n this._adaptHeightToChildren = value;\r\n if (value) {\r\n this.height = \"100%\";\r\n }\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Container.prototype, \"adaptWidthToChildren\", {\r\n /** Gets or sets a boolean indicating if the container should try to adapt to its children width */\r\n get: function () {\r\n return this._adaptWidthToChildren;\r\n },\r\n set: function (value) {\r\n if (this._adaptWidthToChildren === value) {\r\n return;\r\n }\r\n this._adaptWidthToChildren = value;\r\n if (value) {\r\n this.width = \"100%\";\r\n }\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Container.prototype, \"background\", {\r\n /** Gets or sets background color */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Container.prototype, \"children\", {\r\n /** Gets the list of children */\r\n get: function () {\r\n return this._children;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Container.prototype._getTypeName = function () {\r\n return \"Container\";\r\n };\r\n Container.prototype._flagDescendantsAsMatrixDirty = function () {\r\n for (var _i = 0, _a = this.children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._markMatrixAsDirty();\r\n }\r\n };\r\n /**\r\n * Gets a child using its name\r\n * @param name defines the child name to look for\r\n * @returns the child control if found\r\n */\r\n Container.prototype.getChildByName = function (name) {\r\n for (var _i = 0, _a = this.children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (child.name === name) {\r\n return child;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a child using its type and its name\r\n * @param name defines the child name to look for\r\n * @param type defines the child type to look for\r\n * @returns the child control if found\r\n */\r\n Container.prototype.getChildByType = function (name, type) {\r\n for (var _i = 0, _a = this.children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (child.typeName === type) {\r\n return child;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Search for a specific control in children\r\n * @param control defines the control to look for\r\n * @returns true if the control is in child list\r\n */\r\n Container.prototype.containsControl = function (control) {\r\n return this.children.indexOf(control) !== -1;\r\n };\r\n /**\r\n * Adds a new control to the current container\r\n * @param control defines the control to add\r\n * @returns the current container\r\n */\r\n Container.prototype.addControl = function (control) {\r\n if (!control) {\r\n return this;\r\n }\r\n var index = this._children.indexOf(control);\r\n if (index !== -1) {\r\n return this;\r\n }\r\n control._link(this._host);\r\n control._markAllAsDirty();\r\n this._reOrderControl(control);\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Removes all controls from the current container\r\n * @returns the current container\r\n */\r\n Container.prototype.clearControls = function () {\r\n var children = this.children.slice();\r\n for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\r\n var child = children_1[_i];\r\n this.removeControl(child);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Removes a control from the current container\r\n * @param control defines the control to remove\r\n * @returns the current container\r\n */\r\n Container.prototype.removeControl = function (control) {\r\n var index = this._children.indexOf(control);\r\n if (index !== -1) {\r\n this._children.splice(index, 1);\r\n control.parent = null;\r\n }\r\n control.linkWithMesh(null);\r\n if (this._host) {\r\n this._host._cleanControlAfterRemoval(control);\r\n }\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /** @hidden */\r\n Container.prototype._reOrderControl = function (control) {\r\n this.removeControl(control);\r\n var wasAdded = false;\r\n for (var index = 0; index < this._children.length; index++) {\r\n if (this._children[index].zIndex > control.zIndex) {\r\n this._children.splice(index, 0, control);\r\n wasAdded = true;\r\n break;\r\n }\r\n }\r\n if (!wasAdded) {\r\n this._children.push(control);\r\n }\r\n control.parent = this;\r\n this._markAsDirty();\r\n };\r\n /** @hidden */\r\n Container.prototype._offsetLeft = function (offset) {\r\n _super.prototype._offsetLeft.call(this, offset);\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._offsetLeft(offset);\r\n }\r\n };\r\n /** @hidden */\r\n Container.prototype._offsetTop = function (offset) {\r\n _super.prototype._offsetTop.call(this, offset);\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._offsetTop(offset);\r\n }\r\n };\r\n /** @hidden */\r\n Container.prototype._markAllAsDirty = function () {\r\n _super.prototype._markAllAsDirty.call(this);\r\n for (var index = 0; index < this._children.length; index++) {\r\n this._children[index]._markAllAsDirty();\r\n }\r\n };\r\n /** @hidden */\r\n Container.prototype._localDraw = function (context) {\r\n if (this._background) {\r\n context.save();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n context.fillStyle = this._background;\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n context.restore();\r\n }\r\n };\r\n /** @hidden */\r\n Container.prototype._link = function (host) {\r\n _super.prototype._link.call(this, host);\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._link(host);\r\n }\r\n };\r\n /** @hidden */\r\n Container.prototype._beforeLayout = function () {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n Container.prototype._processMeasures = function (parentMeasure, context) {\r\n if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {\r\n _super.prototype._processMeasures.call(this, parentMeasure, context);\r\n this._evaluateClippingState(parentMeasure);\r\n }\r\n };\r\n /** @hidden */\r\n Container.prototype._layout = function (parentMeasure, context) {\r\n if (!this.isDirty && (!this.isVisible || this.notRenderable)) {\r\n return false;\r\n }\r\n this.host._numLayoutCalls++;\r\n if (this._isDirty) {\r\n this._currentMeasure.transformToRef(this._transformMatrix, this._prevCurrentMeasureTransformedIntoGlobalSpace);\r\n }\r\n var rebuildCount = 0;\r\n context.save();\r\n this._applyStates(context);\r\n this._beforeLayout();\r\n do {\r\n var computedWidth = -1;\r\n var computedHeight = -1;\r\n this._rebuildLayout = false;\r\n this._processMeasures(parentMeasure, context);\r\n if (!this._isClipped) {\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._tempParentMeasure.copyFrom(this._measureForChildren);\r\n if (child._layout(this._measureForChildren, context)) {\r\n if (this.adaptWidthToChildren && child._width.isPixel) {\r\n computedWidth = Math.max(computedWidth, child._currentMeasure.width + child.paddingLeftInPixels + child.paddingRightInPixels);\r\n }\r\n if (this.adaptHeightToChildren && child._height.isPixel) {\r\n computedHeight = Math.max(computedHeight, child._currentMeasure.height + child.paddingTopInPixels + child.paddingBottomInPixels);\r\n }\r\n }\r\n }\r\n if (this.adaptWidthToChildren && computedWidth >= 0) {\r\n computedWidth += this.paddingLeftInPixels + this.paddingRightInPixels;\r\n if (this.width !== computedWidth + \"px\") {\r\n this.width = computedWidth + \"px\";\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n if (this.adaptHeightToChildren && computedHeight >= 0) {\r\n computedHeight += this.paddingTopInPixels + this.paddingBottomInPixels;\r\n if (this.height !== computedHeight + \"px\") {\r\n this.height = computedHeight + \"px\";\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n this._postMeasure();\r\n }\r\n rebuildCount++;\r\n } while (this._rebuildLayout && rebuildCount < this.maxLayoutCycle);\r\n if (rebuildCount >= 3 && this.logLayoutCycleErrors) {\r\n Logger.Error(\"Layout cycle detected in GUI (Container name=\" + this.name + \", uniqueId=\" + this.uniqueId + \")\");\r\n }\r\n context.restore();\r\n if (this._isDirty) {\r\n this.invalidateRect();\r\n this._isDirty = false;\r\n }\r\n return true;\r\n };\r\n Container.prototype._postMeasure = function () {\r\n // Do nothing by default\r\n };\r\n /** @hidden */\r\n Container.prototype._draw = function (context, invalidatedRectangle) {\r\n this._localDraw(context);\r\n if (this.clipChildren) {\r\n this._clipForChildren(context);\r\n }\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n // Only redraw parts of the screen that are invalidated\r\n if (invalidatedRectangle) {\r\n if (!child._intersectsRect(invalidatedRectangle)) {\r\n continue;\r\n }\r\n }\r\n child._render(context, invalidatedRectangle);\r\n }\r\n };\r\n Container.prototype.getDescendantsToRef = function (results, directDescendantsOnly, predicate) {\r\n if (directDescendantsOnly === void 0) { directDescendantsOnly = false; }\r\n if (!this.children) {\r\n return;\r\n }\r\n for (var index = 0; index < this.children.length; index++) {\r\n var item = this.children[index];\r\n if (!predicate || predicate(item)) {\r\n results.push(item);\r\n }\r\n if (!directDescendantsOnly) {\r\n item.getDescendantsToRef(results, false, predicate);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Container.prototype._processPicking = function (x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY) {\r\n if (!this._isEnabled || !this.isVisible || this.notRenderable) {\r\n return false;\r\n }\r\n if (!_super.prototype.contains.call(this, x, y)) {\r\n return false;\r\n }\r\n // Checking backwards to pick closest first\r\n for (var index = this._children.length - 1; index >= 0; index--) {\r\n var child = this._children[index];\r\n if (child._processPicking(x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY)) {\r\n if (child.hoverCursor) {\r\n this._host._changeCursor(child.hoverCursor);\r\n }\r\n return true;\r\n }\r\n }\r\n if (!this.isHitTestVisible) {\r\n return false;\r\n }\r\n return this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);\r\n };\r\n /** @hidden */\r\n Container.prototype._additionalProcessing = function (parentMeasure, context) {\r\n _super.prototype._additionalProcessing.call(this, parentMeasure, context);\r\n this._measureForChildren.copyFrom(this._currentMeasure);\r\n };\r\n /** Releases associated resources */\r\n Container.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n for (var index = this.children.length - 1; index >= 0; index--) {\r\n this.children[index].dispose();\r\n }\r\n };\r\n return Container;\r\n}(Control));\r\nexport { Container };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Container\"] = Container;\r\n//# sourceMappingURL=container.js.map","import { __extends } from \"tslib\";\r\nimport { Vector2 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Epsilon } from '@babylonjs/core/Maths/math.constants';\r\n/**\r\n * Class used to transport Vector2 information for pointer events\r\n */\r\nvar Vector2WithInfo = /** @class */ (function (_super) {\r\n __extends(Vector2WithInfo, _super);\r\n /**\r\n * Creates a new Vector2WithInfo\r\n * @param source defines the vector2 data to transport\r\n * @param buttonIndex defines the current mouse button index\r\n */\r\n function Vector2WithInfo(source, \r\n /** defines the current mouse button index */\r\n buttonIndex) {\r\n if (buttonIndex === void 0) { buttonIndex = 0; }\r\n var _this = _super.call(this, source.x, source.y) || this;\r\n _this.buttonIndex = buttonIndex;\r\n return _this;\r\n }\r\n return Vector2WithInfo;\r\n}(Vector2));\r\nexport { Vector2WithInfo };\r\n/** Class used to provide 2D matrix features */\r\nvar Matrix2D = /** @class */ (function () {\r\n /**\r\n * Creates a new matrix\r\n * @param m00 defines value for (0, 0)\r\n * @param m01 defines value for (0, 1)\r\n * @param m10 defines value for (1, 0)\r\n * @param m11 defines value for (1, 1)\r\n * @param m20 defines value for (2, 0)\r\n * @param m21 defines value for (2, 1)\r\n */\r\n function Matrix2D(m00, m01, m10, m11, m20, m21) {\r\n /** Gets the internal array of 6 floats used to store matrix data */\r\n this.m = new Float32Array(6);\r\n this.fromValues(m00, m01, m10, m11, m20, m21);\r\n }\r\n /**\r\n * Fills the matrix from direct values\r\n * @param m00 defines value for (0, 0)\r\n * @param m01 defines value for (0, 1)\r\n * @param m10 defines value for (1, 0)\r\n * @param m11 defines value for (1, 1)\r\n * @param m20 defines value for (2, 0)\r\n * @param m21 defines value for (2, 1)\r\n * @returns the current modified matrix\r\n */\r\n Matrix2D.prototype.fromValues = function (m00, m01, m10, m11, m20, m21) {\r\n this.m[0] = m00;\r\n this.m[1] = m01;\r\n this.m[2] = m10;\r\n this.m[3] = m11;\r\n this.m[4] = m20;\r\n this.m[5] = m21;\r\n return this;\r\n };\r\n /**\r\n * Gets matrix determinant\r\n * @returns the determinant\r\n */\r\n Matrix2D.prototype.determinant = function () {\r\n return this.m[0] * this.m[3] - this.m[1] * this.m[2];\r\n };\r\n /**\r\n * Inverses the matrix and stores it in a target matrix\r\n * @param result defines the target matrix\r\n * @returns the current matrix\r\n */\r\n Matrix2D.prototype.invertToRef = function (result) {\r\n var l0 = this.m[0];\r\n var l1 = this.m[1];\r\n var l2 = this.m[2];\r\n var l3 = this.m[3];\r\n var l4 = this.m[4];\r\n var l5 = this.m[5];\r\n var det = this.determinant();\r\n if (det < (Epsilon * Epsilon)) {\r\n result.m[0] = 0;\r\n result.m[1] = 0;\r\n result.m[2] = 0;\r\n result.m[3] = 0;\r\n result.m[4] = 0;\r\n result.m[5] = 0;\r\n return this;\r\n }\r\n var detDiv = 1 / det;\r\n var det4 = l2 * l5 - l3 * l4;\r\n var det5 = l1 * l4 - l0 * l5;\r\n result.m[0] = l3 * detDiv;\r\n result.m[1] = -l1 * detDiv;\r\n result.m[2] = -l2 * detDiv;\r\n result.m[3] = l0 * detDiv;\r\n result.m[4] = det4 * detDiv;\r\n result.m[5] = det5 * detDiv;\r\n return this;\r\n };\r\n /**\r\n * Multiplies the current matrix with another one\r\n * @param other defines the second operand\r\n * @param result defines the target matrix\r\n * @returns the current matrix\r\n */\r\n Matrix2D.prototype.multiplyToRef = function (other, result) {\r\n var l0 = this.m[0];\r\n var l1 = this.m[1];\r\n var l2 = this.m[2];\r\n var l3 = this.m[3];\r\n var l4 = this.m[4];\r\n var l5 = this.m[5];\r\n var r0 = other.m[0];\r\n var r1 = other.m[1];\r\n var r2 = other.m[2];\r\n var r3 = other.m[3];\r\n var r4 = other.m[4];\r\n var r5 = other.m[5];\r\n result.m[0] = l0 * r0 + l1 * r2;\r\n result.m[1] = l0 * r1 + l1 * r3;\r\n result.m[2] = l2 * r0 + l3 * r2;\r\n result.m[3] = l2 * r1 + l3 * r3;\r\n result.m[4] = l4 * r0 + l5 * r2 + r4;\r\n result.m[5] = l4 * r1 + l5 * r3 + r5;\r\n return this;\r\n };\r\n /**\r\n * Applies the current matrix to a set of 2 floats and stores the result in a vector2\r\n * @param x defines the x coordinate to transform\r\n * @param y defines the x coordinate to transform\r\n * @param result defines the target vector2\r\n * @returns the current matrix\r\n */\r\n Matrix2D.prototype.transformCoordinates = function (x, y, result) {\r\n result.x = x * this.m[0] + y * this.m[2] + this.m[4];\r\n result.y = x * this.m[1] + y * this.m[3] + this.m[5];\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Creates an identity matrix\r\n * @returns a new matrix\r\n */\r\n Matrix2D.Identity = function () {\r\n return new Matrix2D(1, 0, 0, 1, 0, 0);\r\n };\r\n /**\r\n * Creates a translation matrix and stores it in a target matrix\r\n * @param x defines the x coordinate of the translation\r\n * @param y defines the y coordinate of the translation\r\n * @param result defines the target matrix\r\n */\r\n Matrix2D.TranslationToRef = function (x, y, result) {\r\n result.fromValues(1, 0, 0, 1, x, y);\r\n };\r\n /**\r\n * Creates a scaling matrix and stores it in a target matrix\r\n * @param x defines the x coordinate of the scaling\r\n * @param y defines the y coordinate of the scaling\r\n * @param result defines the target matrix\r\n */\r\n Matrix2D.ScalingToRef = function (x, y, result) {\r\n result.fromValues(x, 0, 0, y, 0, 0);\r\n };\r\n /**\r\n * Creates a rotation matrix and stores it in a target matrix\r\n * @param angle defines the rotation angle\r\n * @param result defines the target matrix\r\n */\r\n Matrix2D.RotationToRef = function (angle, result) {\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n result.fromValues(c, s, -s, c, 0, 0);\r\n };\r\n /**\r\n * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix\r\n * @param tx defines the x coordinate of the translation\r\n * @param ty defines the y coordinate of the translation\r\n * @param angle defines the rotation angle\r\n * @param scaleX defines the x coordinate of the scaling\r\n * @param scaleY defines the y coordinate of the scaling\r\n * @param parentMatrix defines the parent matrix to multiply by (can be null)\r\n * @param result defines the target matrix\r\n */\r\n Matrix2D.ComposeToRef = function (tx, ty, angle, scaleX, scaleY, parentMatrix, result) {\r\n Matrix2D.TranslationToRef(tx, ty, Matrix2D._TempPreTranslationMatrix);\r\n Matrix2D.ScalingToRef(scaleX, scaleY, Matrix2D._TempScalingMatrix);\r\n Matrix2D.RotationToRef(angle, Matrix2D._TempRotationMatrix);\r\n Matrix2D.TranslationToRef(-tx, -ty, Matrix2D._TempPostTranslationMatrix);\r\n Matrix2D._TempPreTranslationMatrix.multiplyToRef(Matrix2D._TempScalingMatrix, Matrix2D._TempCompose0);\r\n Matrix2D._TempCompose0.multiplyToRef(Matrix2D._TempRotationMatrix, Matrix2D._TempCompose1);\r\n if (parentMatrix) {\r\n Matrix2D._TempCompose1.multiplyToRef(Matrix2D._TempPostTranslationMatrix, Matrix2D._TempCompose2);\r\n Matrix2D._TempCompose2.multiplyToRef(parentMatrix, result);\r\n }\r\n else {\r\n Matrix2D._TempCompose1.multiplyToRef(Matrix2D._TempPostTranslationMatrix, result);\r\n }\r\n };\r\n Matrix2D._TempPreTranslationMatrix = Matrix2D.Identity();\r\n Matrix2D._TempPostTranslationMatrix = Matrix2D.Identity();\r\n Matrix2D._TempRotationMatrix = Matrix2D.Identity();\r\n Matrix2D._TempScalingMatrix = Matrix2D.Identity();\r\n Matrix2D._TempCompose0 = Matrix2D.Identity();\r\n Matrix2D._TempCompose1 = Matrix2D.Identity();\r\n Matrix2D._TempCompose2 = Matrix2D.Identity();\r\n return Matrix2D;\r\n}());\r\nexport { Matrix2D };\r\n//# sourceMappingURL=math2D.js.map","import { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Vector2, Vector3, Matrix } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { PointerEventTypes } from '@babylonjs/core/Events/pointerEvents';\r\nimport { Logger } from \"@babylonjs/core/Misc/logger\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { Measure } from \"../measure\";\r\nimport { Matrix2D, Vector2WithInfo } from \"../math2D\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Root class used for all 2D controls\r\n * @see https://doc.babylonjs.com/how_to/gui#controls\r\n */\r\nvar Control = /** @class */ (function () {\r\n // Functions\r\n /**\r\n * Creates a new control\r\n * @param name defines the name of the control\r\n */\r\n function Control(\r\n /** defines the name of the control */\r\n name) {\r\n this.name = name;\r\n this._alpha = 1;\r\n this._alphaSet = false;\r\n this._zIndex = 0;\r\n /** @hidden */\r\n this._currentMeasure = Measure.Empty();\r\n this._fontFamily = \"Arial\";\r\n this._fontStyle = \"\";\r\n this._fontWeight = \"\";\r\n this._fontSize = new ValueAndUnit(18, ValueAndUnit.UNITMODE_PIXEL, false);\r\n /** @hidden */\r\n this._width = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);\r\n /** @hidden */\r\n this._height = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);\r\n this._color = \"\";\r\n this._style = null;\r\n /** @hidden */\r\n this._horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n /** @hidden */\r\n this._verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n /** @hidden */\r\n this._isDirty = true;\r\n /** @hidden */\r\n this._wasDirty = false;\r\n /** @hidden */\r\n this._tempParentMeasure = Measure.Empty();\r\n /** @hidden */\r\n this._prevCurrentMeasureTransformedIntoGlobalSpace = Measure.Empty();\r\n /** @hidden */\r\n this._cachedParentMeasure = Measure.Empty();\r\n this._paddingLeft = new ValueAndUnit(0);\r\n this._paddingRight = new ValueAndUnit(0);\r\n this._paddingTop = new ValueAndUnit(0);\r\n this._paddingBottom = new ValueAndUnit(0);\r\n /** @hidden */\r\n this._left = new ValueAndUnit(0);\r\n /** @hidden */\r\n this._top = new ValueAndUnit(0);\r\n this._scaleX = 1.0;\r\n this._scaleY = 1.0;\r\n this._rotation = 0;\r\n this._transformCenterX = 0.5;\r\n this._transformCenterY = 0.5;\r\n /** @hidden */\r\n this._transformMatrix = Matrix2D.Identity();\r\n /** @hidden */\r\n this._invertTransformMatrix = Matrix2D.Identity();\r\n /** @hidden */\r\n this._transformedPosition = Vector2.Zero();\r\n this._isMatrixDirty = true;\r\n this._isVisible = true;\r\n this._isHighlighted = false;\r\n this._fontSet = false;\r\n this._dummyVector2 = Vector2.Zero();\r\n this._downCount = 0;\r\n this._enterCount = -1;\r\n this._doNotRender = false;\r\n this._downPointerIds = {};\r\n this._isEnabled = true;\r\n this._disabledColor = \"#9a9a9a\";\r\n this._disabledColorItem = \"#6a6a6a\";\r\n /** @hidden */\r\n this._rebuildLayout = false;\r\n /** @hidden */\r\n this._customData = {};\r\n /** @hidden */\r\n this._isClipped = false;\r\n /** @hidden */\r\n this._automaticSize = false;\r\n /**\r\n * Gets or sets an object used to store user defined information for the node\r\n */\r\n this.metadata = null;\r\n /** Gets or sets a boolean indicating if the control can be hit with pointer events */\r\n this.isHitTestVisible = true;\r\n /** Gets or sets a boolean indicating if the control can block pointer events */\r\n this.isPointerBlocker = false;\r\n /** Gets or sets a boolean indicating if the control can be focusable */\r\n this.isFocusInvisible = false;\r\n /**\r\n * Gets or sets a boolean indicating if the children are clipped to the current control bounds.\r\n * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children\r\n */\r\n this.clipChildren = true;\r\n /**\r\n * Gets or sets a boolean indicating that control content must be clipped\r\n * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children\r\n */\r\n this.clipContent = true;\r\n /**\r\n * Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)\r\n */\r\n this.useBitmapCache = false;\r\n this._shadowOffsetX = 0;\r\n this._shadowOffsetY = 0;\r\n this._shadowBlur = 0;\r\n this._shadowColor = 'black';\r\n /** Gets or sets the cursor to use when the control is hovered */\r\n this.hoverCursor = \"\";\r\n /** @hidden */\r\n this._linkOffsetX = new ValueAndUnit(0);\r\n /** @hidden */\r\n this._linkOffsetY = new ValueAndUnit(0);\r\n /**\r\n * An event triggered when pointer wheel is scrolled\r\n */\r\n this.onWheelObservable = new Observable();\r\n /**\r\n * An event triggered when the pointer move over the control.\r\n */\r\n this.onPointerMoveObservable = new Observable();\r\n /**\r\n * An event triggered when the pointer move out of the control.\r\n */\r\n this.onPointerOutObservable = new Observable();\r\n /**\r\n * An event triggered when the pointer taps the control\r\n */\r\n this.onPointerDownObservable = new Observable();\r\n /**\r\n * An event triggered when pointer up\r\n */\r\n this.onPointerUpObservable = new Observable();\r\n /**\r\n * An event triggered when a control is clicked on\r\n */\r\n this.onPointerClickObservable = new Observable();\r\n /**\r\n * An event triggered when pointer enters the control\r\n */\r\n this.onPointerEnterObservable = new Observable();\r\n /**\r\n * An event triggered when the control is marked as dirty\r\n */\r\n this.onDirtyObservable = new Observable();\r\n /**\r\n * An event triggered before drawing the control\r\n */\r\n this.onBeforeDrawObservable = new Observable();\r\n /**\r\n * An event triggered after the control was drawn\r\n */\r\n this.onAfterDrawObservable = new Observable();\r\n /**\r\n * An event triggered when the control has been disposed\r\n */\r\n this.onDisposeObservable = new Observable();\r\n /**\r\n * Gets or sets a fixed ratio for this control.\r\n * When different from 0, the ratio is used to compute the \"second\" dimension.\r\n * The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the\r\n * second dimension is computed as first dimension * fixedRatio\r\n */\r\n this.fixedRatio = 0;\r\n this._fixedRatioMasterIsWidth = true;\r\n this._tmpMeasureA = new Measure(0, 0, 0, 0);\r\n }\r\n Object.defineProperty(Control.prototype, \"shadowOffsetX\", {\r\n /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */\r\n get: function () {\r\n return this._shadowOffsetX;\r\n },\r\n set: function (value) {\r\n if (this._shadowOffsetX === value) {\r\n return;\r\n }\r\n this._shadowOffsetX = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"shadowOffsetY\", {\r\n /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */\r\n get: function () {\r\n return this._shadowOffsetY;\r\n },\r\n set: function (value) {\r\n if (this._shadowOffsetY === value) {\r\n return;\r\n }\r\n this._shadowOffsetY = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"shadowBlur\", {\r\n /** Gets or sets a value indicating the amount of blur to use to render the shadow */\r\n get: function () {\r\n return this._shadowBlur;\r\n },\r\n set: function (value) {\r\n if (this._shadowBlur === value) {\r\n return;\r\n }\r\n this._shadowBlur = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"shadowColor\", {\r\n /** Gets or sets a value indicating the color of the shadow (black by default ie. \"#000\") */\r\n get: function () {\r\n return this._shadowColor;\r\n },\r\n set: function (value) {\r\n if (this._shadowColor === value) {\r\n return;\r\n }\r\n this._shadowColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"typeName\", {\r\n // Properties\r\n /** Gets the control type name */\r\n get: function () {\r\n return this._getTypeName();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Get the current class name of the control.\r\n * @returns current class name\r\n */\r\n Control.prototype.getClassName = function () {\r\n return this._getTypeName();\r\n };\r\n Object.defineProperty(Control.prototype, \"host\", {\r\n /**\r\n * Get the hosting AdvancedDynamicTexture\r\n */\r\n get: function () {\r\n return this._host;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"fontOffset\", {\r\n /** Gets or set information about font offsets (used to render and align text) */\r\n get: function () {\r\n return this._fontOffset;\r\n },\r\n set: function (offset) {\r\n this._fontOffset = offset;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"alpha\", {\r\n /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */\r\n get: function () {\r\n return this._alpha;\r\n },\r\n set: function (value) {\r\n if (this._alpha === value) {\r\n return;\r\n }\r\n this._alphaSet = true;\r\n this._alpha = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"isHighlighted\", {\r\n /**\r\n * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)\r\n */\r\n get: function () {\r\n return this._isHighlighted;\r\n },\r\n set: function (value) {\r\n if (this._isHighlighted === value) {\r\n return;\r\n }\r\n this._isHighlighted = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"scaleX\", {\r\n /** Gets or sets a value indicating the scale factor on X axis (1 by default)\r\n * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling\r\n */\r\n get: function () {\r\n return this._scaleX;\r\n },\r\n set: function (value) {\r\n if (this._scaleX === value) {\r\n return;\r\n }\r\n this._scaleX = value;\r\n this._markAsDirty();\r\n this._markMatrixAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"scaleY\", {\r\n /** Gets or sets a value indicating the scale factor on Y axis (1 by default)\r\n * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling\r\n */\r\n get: function () {\r\n return this._scaleY;\r\n },\r\n set: function (value) {\r\n if (this._scaleY === value) {\r\n return;\r\n }\r\n this._scaleY = value;\r\n this._markAsDirty();\r\n this._markMatrixAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"rotation\", {\r\n /** Gets or sets the rotation angle (0 by default)\r\n * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling\r\n */\r\n get: function () {\r\n return this._rotation;\r\n },\r\n set: function (value) {\r\n if (this._rotation === value) {\r\n return;\r\n }\r\n this._rotation = value;\r\n this._markAsDirty();\r\n this._markMatrixAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"transformCenterY\", {\r\n /** Gets or sets the transformation center on Y axis (0 by default)\r\n * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling\r\n */\r\n get: function () {\r\n return this._transformCenterY;\r\n },\r\n set: function (value) {\r\n if (this._transformCenterY === value) {\r\n return;\r\n }\r\n this._transformCenterY = value;\r\n this._markAsDirty();\r\n this._markMatrixAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"transformCenterX\", {\r\n /** Gets or sets the transformation center on X axis (0 by default)\r\n * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling\r\n */\r\n get: function () {\r\n return this._transformCenterX;\r\n },\r\n set: function (value) {\r\n if (this._transformCenterX === value) {\r\n return;\r\n }\r\n this._transformCenterX = value;\r\n this._markAsDirty();\r\n this._markMatrixAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"horizontalAlignment\", {\r\n /**\r\n * Gets or sets the horizontal alignment\r\n * @see https://doc.babylonjs.com/how_to/gui#alignments\r\n */\r\n get: function () {\r\n return this._horizontalAlignment;\r\n },\r\n set: function (value) {\r\n if (this._horizontalAlignment === value) {\r\n return;\r\n }\r\n this._horizontalAlignment = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"verticalAlignment\", {\r\n /**\r\n * Gets or sets the vertical alignment\r\n * @see https://doc.babylonjs.com/how_to/gui#alignments\r\n */\r\n get: function () {\r\n return this._verticalAlignment;\r\n },\r\n set: function (value) {\r\n if (this._verticalAlignment === value) {\r\n return;\r\n }\r\n this._verticalAlignment = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"width\", {\r\n /**\r\n * Gets or sets control width\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._width.toString(this._host);\r\n },\r\n set: function (value) {\r\n this._fixedRatioMasterIsWidth = true;\r\n if (this._width.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._width.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"widthInPixels\", {\r\n /**\r\n * Gets or sets the control width in pixel\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._width.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this._fixedRatioMasterIsWidth = true;\r\n this.width = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"height\", {\r\n /**\r\n * Gets or sets control height\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._height.toString(this._host);\r\n },\r\n set: function (value) {\r\n this._fixedRatioMasterIsWidth = false;\r\n if (this._height.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._height.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"heightInPixels\", {\r\n /**\r\n * Gets or sets control height in pixel\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this._fixedRatioMasterIsWidth = false;\r\n this.height = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"fontFamily\", {\r\n /** Gets or set font family */\r\n get: function () {\r\n if (!this._fontSet) {\r\n return \"\";\r\n }\r\n return this._fontFamily;\r\n },\r\n set: function (value) {\r\n if (this._fontFamily === value) {\r\n return;\r\n }\r\n this._fontFamily = value;\r\n this._resetFontCache();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"fontStyle\", {\r\n /** Gets or sets font style */\r\n get: function () {\r\n return this._fontStyle;\r\n },\r\n set: function (value) {\r\n if (this._fontStyle === value) {\r\n return;\r\n }\r\n this._fontStyle = value;\r\n this._resetFontCache();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"fontWeight\", {\r\n /** Gets or sets font weight */\r\n get: function () {\r\n return this._fontWeight;\r\n },\r\n set: function (value) {\r\n if (this._fontWeight === value) {\r\n return;\r\n }\r\n this._fontWeight = value;\r\n this._resetFontCache();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"style\", {\r\n /**\r\n * Gets or sets style\r\n * @see https://doc.babylonjs.com/how_to/gui#styles\r\n */\r\n get: function () {\r\n return this._style;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._style) {\r\n this._style.onChangedObservable.remove(this._styleObserver);\r\n this._styleObserver = null;\r\n }\r\n this._style = value;\r\n if (this._style) {\r\n this._styleObserver = this._style.onChangedObservable.add(function () {\r\n _this._markAsDirty();\r\n _this._resetFontCache();\r\n });\r\n }\r\n this._markAsDirty();\r\n this._resetFontCache();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"_isFontSizeInPercentage\", {\r\n /** @hidden */\r\n get: function () {\r\n return this._fontSize.isPercentage;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"fontSizeInPixels\", {\r\n /** Gets or sets font size in pixels */\r\n get: function () {\r\n var fontSizeToUse = this._style ? this._style._fontSize : this._fontSize;\r\n if (fontSizeToUse.isPixel) {\r\n return fontSizeToUse.getValue(this._host);\r\n }\r\n return fontSizeToUse.getValueInPixel(this._host, this._tempParentMeasure.height || this._cachedParentMeasure.height);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.fontSize = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"fontSize\", {\r\n /** Gets or sets font size */\r\n get: function () {\r\n return this._fontSize.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._fontSize.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._fontSize.fromString(value)) {\r\n this._markAsDirty();\r\n this._resetFontCache();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"color\", {\r\n /** Gets or sets foreground color */\r\n get: function () {\r\n return this._color;\r\n },\r\n set: function (value) {\r\n if (this._color === value) {\r\n return;\r\n }\r\n this._color = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"zIndex\", {\r\n /** Gets or sets z index which is used to reorder controls on the z axis */\r\n get: function () {\r\n return this._zIndex;\r\n },\r\n set: function (value) {\r\n if (this.zIndex === value) {\r\n return;\r\n }\r\n this._zIndex = value;\r\n if (this.parent) {\r\n this.parent._reOrderControl(this);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"notRenderable\", {\r\n /** Gets or sets a boolean indicating if the control can be rendered */\r\n get: function () {\r\n return this._doNotRender;\r\n },\r\n set: function (value) {\r\n if (this._doNotRender === value) {\r\n return;\r\n }\r\n this._doNotRender = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"isVisible\", {\r\n /** Gets or sets a boolean indicating if the control is visible */\r\n get: function () {\r\n return this._isVisible;\r\n },\r\n set: function (value) {\r\n if (this._isVisible === value) {\r\n return;\r\n }\r\n this._isVisible = value;\r\n this._markAsDirty(true);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"isDirty\", {\r\n /** Gets a boolean indicating that the control needs to update its rendering */\r\n get: function () {\r\n return this._isDirty;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"linkedMesh\", {\r\n /**\r\n * Gets the current linked mesh (or null if none)\r\n */\r\n get: function () {\r\n return this._linkedMesh;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingLeft\", {\r\n /**\r\n * Gets or sets a value indicating the padding to use on the left of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingLeft.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._paddingLeft.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingLeftInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the padding in pixels to use on the left of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingLeft.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.paddingLeft = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingRight\", {\r\n /**\r\n * Gets or sets a value indicating the padding to use on the right of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingRight.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._paddingRight.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingRightInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the padding in pixels to use on the right of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingRight.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.paddingRight = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingTop\", {\r\n /**\r\n * Gets or sets a value indicating the padding to use on the top of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingTop.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._paddingTop.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingTopInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the padding in pixels to use on the top of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingTop.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.paddingTop = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingBottom\", {\r\n /**\r\n * Gets or sets a value indicating the padding to use on the bottom of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingBottom.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._paddingBottom.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingBottomInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the padding in pixels to use on the bottom of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingBottom.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.paddingBottom = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"left\", {\r\n /**\r\n * Gets or sets a value indicating the left coordinate of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._left.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._left.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"leftInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the left coordinate in pixels of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._left.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.left = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"top\", {\r\n /**\r\n * Gets or sets a value indicating the top coordinate of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._top.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._top.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"topInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the top coordinate in pixels of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._top.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.top = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"linkOffsetX\", {\r\n /**\r\n * Gets or sets a value indicating the offset on X axis to the linked mesh\r\n * @see https://doc.babylonjs.com/how_to/gui#tracking-positions\r\n */\r\n get: function () {\r\n return this._linkOffsetX.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._linkOffsetX.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"linkOffsetXInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the offset in pixels on X axis to the linked mesh\r\n * @see https://doc.babylonjs.com/how_to/gui#tracking-positions\r\n */\r\n get: function () {\r\n return this._linkOffsetX.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.linkOffsetX = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"linkOffsetY\", {\r\n /**\r\n * Gets or sets a value indicating the offset on Y axis to the linked mesh\r\n * @see https://doc.babylonjs.com/how_to/gui#tracking-positions\r\n */\r\n get: function () {\r\n return this._linkOffsetY.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._linkOffsetY.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"linkOffsetYInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh\r\n * @see https://doc.babylonjs.com/how_to/gui#tracking-positions\r\n */\r\n get: function () {\r\n return this._linkOffsetY.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.linkOffsetY = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"centerX\", {\r\n /** Gets the center coordinate on X axis */\r\n get: function () {\r\n return this._currentMeasure.left + this._currentMeasure.width / 2;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"centerY\", {\r\n /** Gets the center coordinate on Y axis */\r\n get: function () {\r\n return this._currentMeasure.top + this._currentMeasure.height / 2;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"isEnabled\", {\r\n /** Gets or sets if control is Enabled*/\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n set: function (value) {\r\n if (this._isEnabled === value) {\r\n return;\r\n }\r\n this._isEnabled = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"disabledColor\", {\r\n /** Gets or sets background color of control if it's disabled*/\r\n get: function () {\r\n return this._disabledColor;\r\n },\r\n set: function (value) {\r\n if (this._disabledColor === value) {\r\n return;\r\n }\r\n this._disabledColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"disabledColorItem\", {\r\n /** Gets or sets front color of control if it's disabled*/\r\n get: function () {\r\n return this._disabledColorItem;\r\n },\r\n set: function (value) {\r\n if (this._disabledColorItem === value) {\r\n return;\r\n }\r\n this._disabledColorItem = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Control.prototype._getTypeName = function () {\r\n return \"Control\";\r\n };\r\n /**\r\n * Gets the first ascendant in the hierarchy of the given type\r\n * @param className defines the required type\r\n * @returns the ascendant or null if not found\r\n */\r\n Control.prototype.getAscendantOfClass = function (className) {\r\n if (!this.parent) {\r\n return null;\r\n }\r\n if (this.parent.getClassName() === className) {\r\n return this.parent;\r\n }\r\n return this.parent.getAscendantOfClass(className);\r\n };\r\n /** @hidden */\r\n Control.prototype._resetFontCache = function () {\r\n this._fontSet = true;\r\n this._markAsDirty();\r\n };\r\n /**\r\n * Determines if a container is an ascendant of the current control\r\n * @param container defines the container to look for\r\n * @returns true if the container is one of the ascendant of the control\r\n */\r\n Control.prototype.isAscendant = function (container) {\r\n if (!this.parent) {\r\n return false;\r\n }\r\n if (this.parent === container) {\r\n return true;\r\n }\r\n return this.parent.isAscendant(container);\r\n };\r\n /**\r\n * Gets coordinates in local control space\r\n * @param globalCoordinates defines the coordinates to transform\r\n * @returns the new coordinates in local space\r\n */\r\n Control.prototype.getLocalCoordinates = function (globalCoordinates) {\r\n var result = Vector2.Zero();\r\n this.getLocalCoordinatesToRef(globalCoordinates, result);\r\n return result;\r\n };\r\n /**\r\n * Gets coordinates in local control space\r\n * @param globalCoordinates defines the coordinates to transform\r\n * @param result defines the target vector2 where to store the result\r\n * @returns the current control\r\n */\r\n Control.prototype.getLocalCoordinatesToRef = function (globalCoordinates, result) {\r\n result.x = globalCoordinates.x - this._currentMeasure.left;\r\n result.y = globalCoordinates.y - this._currentMeasure.top;\r\n return this;\r\n };\r\n /**\r\n * Gets coordinates in parent local control space\r\n * @param globalCoordinates defines the coordinates to transform\r\n * @returns the new coordinates in parent local space\r\n */\r\n Control.prototype.getParentLocalCoordinates = function (globalCoordinates) {\r\n var result = Vector2.Zero();\r\n result.x = globalCoordinates.x - this._cachedParentMeasure.left;\r\n result.y = globalCoordinates.y - this._cachedParentMeasure.top;\r\n return result;\r\n };\r\n /**\r\n * Move the current control to a vector3 position projected onto the screen.\r\n * @param position defines the target position\r\n * @param scene defines the hosting scene\r\n */\r\n Control.prototype.moveToVector3 = function (position, scene) {\r\n if (!this._host || this.parent !== this._host._rootContainer) {\r\n Tools.Error(\"Cannot move a control to a vector3 if the control is not at root level\");\r\n return;\r\n }\r\n this.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n var globalViewport = this._host._getGlobalViewport(scene);\r\n var projectedPosition = Vector3.Project(position, Matrix.Identity(), scene.getTransformMatrix(), globalViewport);\r\n this._moveToProjectedPosition(projectedPosition);\r\n if (projectedPosition.z < 0 || projectedPosition.z > 1) {\r\n this.notRenderable = true;\r\n return;\r\n }\r\n this.notRenderable = false;\r\n };\r\n /**\r\n * Will store all controls that have this control as ascendant in a given array\r\n * @param results defines the array where to store the descendants\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n */\r\n Control.prototype.getDescendantsToRef = function (results, directDescendantsOnly, predicate) {\r\n if (directDescendantsOnly === void 0) { directDescendantsOnly = false; }\r\n // Do nothing by default\r\n };\r\n /**\r\n * Will return all controls that have this control as ascendant\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @return all child controls\r\n */\r\n Control.prototype.getDescendants = function (directDescendantsOnly, predicate) {\r\n var results = new Array();\r\n this.getDescendantsToRef(results, directDescendantsOnly, predicate);\r\n return results;\r\n };\r\n /**\r\n * Link current control with a target mesh\r\n * @param mesh defines the mesh to link with\r\n * @see https://doc.babylonjs.com/how_to/gui#tracking-positions\r\n */\r\n Control.prototype.linkWithMesh = function (mesh) {\r\n if (!this._host || this.parent && this.parent !== this._host._rootContainer) {\r\n if (mesh) {\r\n Tools.Error(\"Cannot link a control to a mesh if the control is not at root level\");\r\n }\r\n return;\r\n }\r\n var index = this._host._linkedControls.indexOf(this);\r\n if (index !== -1) {\r\n this._linkedMesh = mesh;\r\n if (!mesh) {\r\n this._host._linkedControls.splice(index, 1);\r\n }\r\n return;\r\n }\r\n else if (!mesh) {\r\n return;\r\n }\r\n this.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n this._linkedMesh = mesh;\r\n this._host._linkedControls.push(this);\r\n };\r\n /** @hidden */\r\n Control.prototype._moveToProjectedPosition = function (projectedPosition) {\r\n var oldLeft = this._left.getValue(this._host);\r\n var oldTop = this._top.getValue(this._host);\r\n var newLeft = ((projectedPosition.x + this._linkOffsetX.getValue(this._host)) - this._currentMeasure.width / 2);\r\n var newTop = ((projectedPosition.y + this._linkOffsetY.getValue(this._host)) - this._currentMeasure.height / 2);\r\n if (this._left.ignoreAdaptiveScaling && this._top.ignoreAdaptiveScaling) {\r\n if (Math.abs(newLeft - oldLeft) < 0.5) {\r\n newLeft = oldLeft;\r\n }\r\n if (Math.abs(newTop - oldTop) < 0.5) {\r\n newTop = oldTop;\r\n }\r\n }\r\n this.left = newLeft + \"px\";\r\n this.top = newTop + \"px\";\r\n this._left.ignoreAdaptiveScaling = true;\r\n this._top.ignoreAdaptiveScaling = true;\r\n this._markAsDirty();\r\n };\r\n /** @hidden */\r\n Control.prototype._offsetLeft = function (offset) {\r\n this._isDirty = true;\r\n this._currentMeasure.left += offset;\r\n };\r\n /** @hidden */\r\n Control.prototype._offsetTop = function (offset) {\r\n this._isDirty = true;\r\n this._currentMeasure.top += offset;\r\n };\r\n /** @hidden */\r\n Control.prototype._markMatrixAsDirty = function () {\r\n this._isMatrixDirty = true;\r\n this._flagDescendantsAsMatrixDirty();\r\n };\r\n /** @hidden */\r\n Control.prototype._flagDescendantsAsMatrixDirty = function () {\r\n // No child\r\n };\r\n /** @hidden */\r\n Control.prototype._intersectsRect = function (rect) {\r\n // Rotate the control's current measure into local space and check if it intersects the passed in rectangle\r\n this._currentMeasure.transformToRef(this._transformMatrix, this._tmpMeasureA);\r\n if (this._tmpMeasureA.left >= rect.left + rect.width) {\r\n return false;\r\n }\r\n if (this._tmpMeasureA.top >= rect.top + rect.height) {\r\n return false;\r\n }\r\n if (this._tmpMeasureA.left + this._tmpMeasureA.width <= rect.left) {\r\n return false;\r\n }\r\n if (this._tmpMeasureA.top + this._tmpMeasureA.height <= rect.top) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n Control.prototype.invalidateRect = function () {\r\n this._transform();\r\n if (this.host && this.host.useInvalidateRectOptimization) {\r\n // Rotate by transform to get the measure transformed to global space\r\n this._currentMeasure.transformToRef(this._transformMatrix, this._tmpMeasureA);\r\n // get the boudning box of the current measure and last frames measure in global space and invalidate it\r\n // the previous measure is used to properly clear a control that is scaled down\r\n Measure.CombineToRef(this._tmpMeasureA, this._prevCurrentMeasureTransformedIntoGlobalSpace, this._tmpMeasureA);\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n // Expand rect based on shadows\r\n var shadowOffsetX = this.shadowOffsetX;\r\n var shadowOffsetY = this.shadowOffsetY;\r\n var shadowBlur = this.shadowBlur;\r\n var leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);\r\n var rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);\r\n var topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);\r\n var bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);\r\n this.host.invalidateRect(Math.floor(this._tmpMeasureA.left + leftShadowOffset), Math.floor(this._tmpMeasureA.top + topShadowOffset), Math.ceil(this._tmpMeasureA.left + this._tmpMeasureA.width + rightShadowOffset), Math.ceil(this._tmpMeasureA.top + this._tmpMeasureA.height + bottomShadowOffset));\r\n }\r\n else {\r\n this.host.invalidateRect(Math.floor(this._tmpMeasureA.left), Math.floor(this._tmpMeasureA.top), Math.ceil(this._tmpMeasureA.left + this._tmpMeasureA.width), Math.ceil(this._tmpMeasureA.top + this._tmpMeasureA.height));\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._markAsDirty = function (force) {\r\n if (force === void 0) { force = false; }\r\n if (!this._isVisible && !force) {\r\n return;\r\n }\r\n this._isDirty = true;\r\n // Redraw only this rectangle\r\n if (this._host) {\r\n this._host.markAsDirty();\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._markAllAsDirty = function () {\r\n this._markAsDirty();\r\n if (this._font) {\r\n this._prepareFont();\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._link = function (host) {\r\n this._host = host;\r\n if (this._host) {\r\n this.uniqueId = this._host.getScene().getUniqueId();\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._transform = function (context) {\r\n if (!this._isMatrixDirty && this._scaleX === 1 && this._scaleY === 1 && this._rotation === 0) {\r\n return;\r\n }\r\n // postTranslate\r\n var offsetX = this._currentMeasure.width * this._transformCenterX + this._currentMeasure.left;\r\n var offsetY = this._currentMeasure.height * this._transformCenterY + this._currentMeasure.top;\r\n if (context) {\r\n context.translate(offsetX, offsetY);\r\n // rotate\r\n context.rotate(this._rotation);\r\n // scale\r\n context.scale(this._scaleX, this._scaleY);\r\n // preTranslate\r\n context.translate(-offsetX, -offsetY);\r\n }\r\n // Need to update matrices?\r\n if (this._isMatrixDirty || this._cachedOffsetX !== offsetX || this._cachedOffsetY !== offsetY) {\r\n this._cachedOffsetX = offsetX;\r\n this._cachedOffsetY = offsetY;\r\n this._isMatrixDirty = false;\r\n this._flagDescendantsAsMatrixDirty();\r\n Matrix2D.ComposeToRef(-offsetX, -offsetY, this._rotation, this._scaleX, this._scaleY, this.parent ? this.parent._transformMatrix : null, this._transformMatrix);\r\n this._transformMatrix.invertToRef(this._invertTransformMatrix);\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._renderHighlight = function (context) {\r\n if (!this.isHighlighted) {\r\n return;\r\n }\r\n context.save();\r\n context.strokeStyle = \"#4affff\";\r\n context.lineWidth = 2;\r\n this._renderHighlightSpecific(context);\r\n context.restore();\r\n };\r\n /** @hidden */\r\n Control.prototype._renderHighlightSpecific = function (context) {\r\n context.strokeRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n };\r\n /** @hidden */\r\n Control.prototype._applyStates = function (context) {\r\n if (this._isFontSizeInPercentage) {\r\n this._fontSet = true;\r\n }\r\n if (this._fontSet) {\r\n this._prepareFont();\r\n this._fontSet = false;\r\n }\r\n if (this._font) {\r\n context.font = this._font;\r\n }\r\n if (this._color) {\r\n context.fillStyle = this._color;\r\n }\r\n if (Control.AllowAlphaInheritance) {\r\n context.globalAlpha *= this._alpha;\r\n }\r\n else if (this._alphaSet) {\r\n context.globalAlpha = this.parent ? this.parent.alpha * this._alpha : this._alpha;\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._layout = function (parentMeasure, context) {\r\n if (!this.isDirty && (!this.isVisible || this.notRenderable)) {\r\n return false;\r\n }\r\n if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {\r\n this.host._numLayoutCalls++;\r\n this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this.paddingLeftInPixels | 0, -this.paddingTopInPixels | 0, this.paddingRightInPixels | 0, this.paddingBottomInPixels | 0, this._prevCurrentMeasureTransformedIntoGlobalSpace);\r\n context.save();\r\n this._applyStates(context);\r\n var rebuildCount = 0;\r\n do {\r\n this._rebuildLayout = false;\r\n this._processMeasures(parentMeasure, context);\r\n rebuildCount++;\r\n } while (this._rebuildLayout && rebuildCount < 3);\r\n if (rebuildCount >= 3) {\r\n Logger.Error(\"Layout cycle detected in GUI (Control name=\" + this.name + \", uniqueId=\" + this.uniqueId + \")\");\r\n }\r\n context.restore();\r\n this.invalidateRect();\r\n this._evaluateClippingState(parentMeasure);\r\n }\r\n this._wasDirty = this._isDirty;\r\n this._isDirty = false;\r\n return true;\r\n };\r\n /** @hidden */\r\n Control.prototype._processMeasures = function (parentMeasure, context) {\r\n this._currentMeasure.copyFrom(parentMeasure);\r\n // Let children take some pre-measurement actions\r\n this._preMeasure(parentMeasure, context);\r\n this._measure();\r\n this._computeAlignment(parentMeasure, context);\r\n // Convert to int values\r\n this._currentMeasure.left = this._currentMeasure.left | 0;\r\n this._currentMeasure.top = this._currentMeasure.top | 0;\r\n this._currentMeasure.width = this._currentMeasure.width | 0;\r\n this._currentMeasure.height = this._currentMeasure.height | 0;\r\n // Let children add more features\r\n this._additionalProcessing(parentMeasure, context);\r\n this._cachedParentMeasure.copyFrom(parentMeasure);\r\n if (this.onDirtyObservable.hasObservers()) {\r\n this.onDirtyObservable.notifyObservers(this);\r\n }\r\n };\r\n Control.prototype._evaluateClippingState = function (parentMeasure) {\r\n if (this.parent && this.parent.clipChildren) {\r\n // Early clip\r\n if (this._currentMeasure.left > parentMeasure.left + parentMeasure.width) {\r\n this._isClipped = true;\r\n return;\r\n }\r\n if (this._currentMeasure.left + this._currentMeasure.width < parentMeasure.left) {\r\n this._isClipped = true;\r\n return;\r\n }\r\n if (this._currentMeasure.top > parentMeasure.top + parentMeasure.height) {\r\n this._isClipped = true;\r\n return;\r\n }\r\n if (this._currentMeasure.top + this._currentMeasure.height < parentMeasure.top) {\r\n this._isClipped = true;\r\n return;\r\n }\r\n }\r\n this._isClipped = false;\r\n };\r\n /** @hidden */\r\n Control.prototype._measure = function () {\r\n // Width / Height\r\n if (this._width.isPixel) {\r\n this._currentMeasure.width = this._width.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.width *= this._width.getValue(this._host);\r\n }\r\n if (this._height.isPixel) {\r\n this._currentMeasure.height = this._height.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.height *= this._height.getValue(this._host);\r\n }\r\n if (this.fixedRatio !== 0) {\r\n if (this._fixedRatioMasterIsWidth) {\r\n this._currentMeasure.height = this._currentMeasure.width * this.fixedRatio;\r\n }\r\n else {\r\n this._currentMeasure.width = this._currentMeasure.height * this.fixedRatio;\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._computeAlignment = function (parentMeasure, context) {\r\n var width = this._currentMeasure.width;\r\n var height = this._currentMeasure.height;\r\n var parentWidth = parentMeasure.width;\r\n var parentHeight = parentMeasure.height;\r\n // Left / top\r\n var x = 0;\r\n var y = 0;\r\n switch (this.horizontalAlignment) {\r\n case Control.HORIZONTAL_ALIGNMENT_LEFT:\r\n x = 0;\r\n break;\r\n case Control.HORIZONTAL_ALIGNMENT_RIGHT:\r\n x = parentWidth - width;\r\n break;\r\n case Control.HORIZONTAL_ALIGNMENT_CENTER:\r\n x = (parentWidth - width) / 2;\r\n break;\r\n }\r\n switch (this.verticalAlignment) {\r\n case Control.VERTICAL_ALIGNMENT_TOP:\r\n y = 0;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_BOTTOM:\r\n y = parentHeight - height;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_CENTER:\r\n y = (parentHeight - height) / 2;\r\n break;\r\n }\r\n if (this._paddingLeft.isPixel) {\r\n this._currentMeasure.left += this._paddingLeft.getValue(this._host);\r\n this._currentMeasure.width -= this._paddingLeft.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.left += parentWidth * this._paddingLeft.getValue(this._host);\r\n this._currentMeasure.width -= parentWidth * this._paddingLeft.getValue(this._host);\r\n }\r\n if (this._paddingRight.isPixel) {\r\n this._currentMeasure.width -= this._paddingRight.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.width -= parentWidth * this._paddingRight.getValue(this._host);\r\n }\r\n if (this._paddingTop.isPixel) {\r\n this._currentMeasure.top += this._paddingTop.getValue(this._host);\r\n this._currentMeasure.height -= this._paddingTop.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.top += parentHeight * this._paddingTop.getValue(this._host);\r\n this._currentMeasure.height -= parentHeight * this._paddingTop.getValue(this._host);\r\n }\r\n if (this._paddingBottom.isPixel) {\r\n this._currentMeasure.height -= this._paddingBottom.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.height -= parentHeight * this._paddingBottom.getValue(this._host);\r\n }\r\n if (this._left.isPixel) {\r\n this._currentMeasure.left += this._left.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.left += parentWidth * this._left.getValue(this._host);\r\n }\r\n if (this._top.isPixel) {\r\n this._currentMeasure.top += this._top.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.top += parentHeight * this._top.getValue(this._host);\r\n }\r\n this._currentMeasure.left += x;\r\n this._currentMeasure.top += y;\r\n };\r\n /** @hidden */\r\n Control.prototype._preMeasure = function (parentMeasure, context) {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n Control.prototype._additionalProcessing = function (parentMeasure, context) {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n Control.prototype._clipForChildren = function (context) {\r\n // DO nothing\r\n };\r\n Control.prototype._clip = function (context, invalidatedRectangle) {\r\n context.beginPath();\r\n Control._ClipMeasure.copyFrom(this._currentMeasure);\r\n if (invalidatedRectangle) {\r\n // Rotate the invalidated rect into the control's space\r\n invalidatedRectangle.transformToRef(this._invertTransformMatrix, this._tmpMeasureA);\r\n // Get the intersection of the rect in context space and the current context\r\n var intersection = new Measure(0, 0, 0, 0);\r\n intersection.left = Math.max(this._tmpMeasureA.left, this._currentMeasure.left);\r\n intersection.top = Math.max(this._tmpMeasureA.top, this._currentMeasure.top);\r\n intersection.width = Math.min(this._tmpMeasureA.left + this._tmpMeasureA.width, this._currentMeasure.left + this._currentMeasure.width) - intersection.left;\r\n intersection.height = Math.min(this._tmpMeasureA.top + this._tmpMeasureA.height, this._currentMeasure.top + this._currentMeasure.height) - intersection.top;\r\n Control._ClipMeasure.copyFrom(intersection);\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n var shadowOffsetX = this.shadowOffsetX;\r\n var shadowOffsetY = this.shadowOffsetY;\r\n var shadowBlur = this.shadowBlur;\r\n var leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);\r\n var rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);\r\n var topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);\r\n var bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);\r\n context.rect(Control._ClipMeasure.left + leftShadowOffset, Control._ClipMeasure.top + topShadowOffset, Control._ClipMeasure.width + rightShadowOffset - leftShadowOffset, Control._ClipMeasure.height + bottomShadowOffset - topShadowOffset);\r\n }\r\n else {\r\n context.rect(Control._ClipMeasure.left, Control._ClipMeasure.top, Control._ClipMeasure.width, Control._ClipMeasure.height);\r\n }\r\n context.clip();\r\n };\r\n /** @hidden */\r\n Control.prototype._render = function (context, invalidatedRectangle) {\r\n if (!this.isVisible || this.notRenderable || this._isClipped) {\r\n this._isDirty = false;\r\n return false;\r\n }\r\n this.host._numRenderCalls++;\r\n context.save();\r\n this._applyStates(context);\r\n // Transform\r\n this._transform(context);\r\n // Clip\r\n if (this.clipContent) {\r\n this._clip(context, invalidatedRectangle);\r\n }\r\n if (this.onBeforeDrawObservable.hasObservers()) {\r\n this.onBeforeDrawObservable.notifyObservers(this);\r\n }\r\n if (this.useBitmapCache && !this._wasDirty && this._cacheData) {\r\n context.putImageData(this._cacheData, this._currentMeasure.left, this._currentMeasure.top);\r\n }\r\n else {\r\n this._draw(context, invalidatedRectangle);\r\n }\r\n if (this.useBitmapCache && this._wasDirty) {\r\n this._cacheData = context.getImageData(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n this._renderHighlight(context);\r\n if (this.onAfterDrawObservable.hasObservers()) {\r\n this.onAfterDrawObservable.notifyObservers(this);\r\n }\r\n context.restore();\r\n return true;\r\n };\r\n /** @hidden */\r\n Control.prototype._draw = function (context, invalidatedRectangle) {\r\n // Do nothing\r\n };\r\n /**\r\n * Tests if a given coordinates belong to the current control\r\n * @param x defines x coordinate to test\r\n * @param y defines y coordinate to test\r\n * @returns true if the coordinates are inside the control\r\n */\r\n Control.prototype.contains = function (x, y) {\r\n // Invert transform\r\n this._invertTransformMatrix.transformCoordinates(x, y, this._transformedPosition);\r\n x = this._transformedPosition.x;\r\n y = this._transformedPosition.y;\r\n // Check\r\n if (x < this._currentMeasure.left) {\r\n return false;\r\n }\r\n if (x > this._currentMeasure.left + this._currentMeasure.width) {\r\n return false;\r\n }\r\n if (y < this._currentMeasure.top) {\r\n return false;\r\n }\r\n if (y > this._currentMeasure.top + this._currentMeasure.height) {\r\n return false;\r\n }\r\n if (this.isPointerBlocker) {\r\n this._host._shouldBlockPointer = true;\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n Control.prototype._processPicking = function (x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY) {\r\n if (!this._isEnabled) {\r\n return false;\r\n }\r\n if (!this.isHitTestVisible || !this.isVisible || this._doNotRender) {\r\n return false;\r\n }\r\n if (!this.contains(x, y)) {\r\n return false;\r\n }\r\n this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);\r\n return true;\r\n };\r\n /** @hidden */\r\n Control.prototype._onPointerMove = function (target, coordinates, pointerId, pi) {\r\n var canNotify = this.onPointerMoveObservable.notifyObservers(coordinates, -1, target, this, pi);\r\n if (canNotify && this.parent != null) {\r\n this.parent._onPointerMove(target, coordinates, pointerId, pi);\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._onPointerEnter = function (target, pi) {\r\n if (!this._isEnabled) {\r\n return false;\r\n }\r\n if (this._enterCount > 0) {\r\n return false;\r\n }\r\n if (this._enterCount === -1) { // -1 is for touch input, we are now sure we are with a mouse or pencil\r\n this._enterCount = 0;\r\n }\r\n this._enterCount++;\r\n var canNotify = this.onPointerEnterObservable.notifyObservers(this, -1, target, this, pi);\r\n if (canNotify && this.parent != null) {\r\n this.parent._onPointerEnter(target, pi);\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n Control.prototype._onPointerOut = function (target, pi, force) {\r\n if (force === void 0) { force = false; }\r\n if (!force && (!this._isEnabled || target === this)) {\r\n return;\r\n }\r\n this._enterCount = 0;\r\n var canNotify = true;\r\n if (!target.isAscendant(this)) {\r\n canNotify = this.onPointerOutObservable.notifyObservers(this, -1, target, this, pi);\r\n }\r\n if (canNotify && this.parent != null) {\r\n this.parent._onPointerOut(target, pi, force);\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n // Prevent pointerout to lose control context.\r\n // Event redundancy is checked inside the function.\r\n this._onPointerEnter(this, pi);\r\n if (this._downCount !== 0) {\r\n return false;\r\n }\r\n this._downCount++;\r\n this._downPointerIds[pointerId] = true;\r\n var canNotify = this.onPointerDownObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);\r\n if (canNotify && this.parent != null) {\r\n this.parent._onPointerDown(target, coordinates, pointerId, buttonIndex, pi);\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n Control.prototype._onPointerUp = function (target, coordinates, pointerId, buttonIndex, notifyClick, pi) {\r\n if (!this._isEnabled) {\r\n return;\r\n }\r\n this._downCount = 0;\r\n delete this._downPointerIds[pointerId];\r\n var canNotifyClick = notifyClick;\r\n if (notifyClick && (this._enterCount > 0 || this._enterCount === -1)) {\r\n canNotifyClick = this.onPointerClickObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);\r\n }\r\n var canNotify = this.onPointerUpObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);\r\n if (canNotify && this.parent != null) {\r\n this.parent._onPointerUp(target, coordinates, pointerId, buttonIndex, canNotifyClick, pi);\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._forcePointerUp = function (pointerId) {\r\n if (pointerId === void 0) { pointerId = null; }\r\n if (pointerId !== null) {\r\n this._onPointerUp(this, Vector2.Zero(), pointerId, 0, true);\r\n }\r\n else {\r\n for (var key in this._downPointerIds) {\r\n this._onPointerUp(this, Vector2.Zero(), +key, 0, true);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._onWheelScroll = function (deltaX, deltaY) {\r\n if (!this._isEnabled) {\r\n return;\r\n }\r\n var canNotify = this.onWheelObservable.notifyObservers(new Vector2(deltaX, deltaY));\r\n if (canNotify && this.parent != null) {\r\n this.parent._onWheelScroll(deltaX, deltaY);\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._onCanvasBlur = function () { };\r\n /** @hidden */\r\n Control.prototype._processObservables = function (type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY) {\r\n if (!this._isEnabled) {\r\n return false;\r\n }\r\n this._dummyVector2.copyFromFloats(x, y);\r\n if (type === PointerEventTypes.POINTERMOVE) {\r\n this._onPointerMove(this, this._dummyVector2, pointerId, pi);\r\n var previousControlOver = this._host._lastControlOver[pointerId];\r\n if (previousControlOver && previousControlOver !== this) {\r\n previousControlOver._onPointerOut(this, pi);\r\n }\r\n if (previousControlOver !== this) {\r\n this._onPointerEnter(this, pi);\r\n }\r\n this._host._lastControlOver[pointerId] = this;\r\n return true;\r\n }\r\n if (type === PointerEventTypes.POINTERDOWN) {\r\n this._onPointerDown(this, this._dummyVector2, pointerId, buttonIndex, pi);\r\n this._host._registerLastControlDown(this, pointerId);\r\n this._host._lastPickedControl = this;\r\n return true;\r\n }\r\n if (type === PointerEventTypes.POINTERUP) {\r\n if (this._host._lastControlDown[pointerId]) {\r\n this._host._lastControlDown[pointerId]._onPointerUp(this, this._dummyVector2, pointerId, buttonIndex, true, pi);\r\n }\r\n delete this._host._lastControlDown[pointerId];\r\n return true;\r\n }\r\n if (type === PointerEventTypes.POINTERWHEEL) {\r\n if (this._host._lastControlOver[pointerId]) {\r\n this._host._lastControlOver[pointerId]._onWheelScroll(deltaX, deltaY);\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n Control.prototype._prepareFont = function () {\r\n if (!this._font && !this._fontSet) {\r\n return;\r\n }\r\n if (this._style) {\r\n this._font = this._style.fontStyle + \" \" + this._style.fontWeight + \" \" + this.fontSizeInPixels + \"px \" + this._style.fontFamily;\r\n }\r\n else {\r\n this._font = this._fontStyle + \" \" + this._fontWeight + \" \" + this.fontSizeInPixels + \"px \" + this._fontFamily;\r\n }\r\n this._fontOffset = Control._GetFontOffset(this._font);\r\n };\r\n /** Releases associated resources */\r\n Control.prototype.dispose = function () {\r\n this.onDirtyObservable.clear();\r\n this.onBeforeDrawObservable.clear();\r\n this.onAfterDrawObservable.clear();\r\n this.onPointerDownObservable.clear();\r\n this.onPointerEnterObservable.clear();\r\n this.onPointerMoveObservable.clear();\r\n this.onPointerOutObservable.clear();\r\n this.onPointerUpObservable.clear();\r\n this.onPointerClickObservable.clear();\r\n this.onWheelObservable.clear();\r\n if (this._styleObserver && this._style) {\r\n this._style.onChangedObservable.remove(this._styleObserver);\r\n this._styleObserver = null;\r\n }\r\n if (this.parent) {\r\n this.parent.removeControl(this);\r\n this.parent = null;\r\n }\r\n if (this._host) {\r\n var index = this._host._linkedControls.indexOf(this);\r\n if (index > -1) {\r\n this.linkWithMesh(null);\r\n }\r\n }\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n };\r\n Object.defineProperty(Control, \"HORIZONTAL_ALIGNMENT_LEFT\", {\r\n /** HORIZONTAL_ALIGNMENT_LEFT */\r\n get: function () {\r\n return Control._HORIZONTAL_ALIGNMENT_LEFT;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control, \"HORIZONTAL_ALIGNMENT_RIGHT\", {\r\n /** HORIZONTAL_ALIGNMENT_RIGHT */\r\n get: function () {\r\n return Control._HORIZONTAL_ALIGNMENT_RIGHT;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control, \"HORIZONTAL_ALIGNMENT_CENTER\", {\r\n /** HORIZONTAL_ALIGNMENT_CENTER */\r\n get: function () {\r\n return Control._HORIZONTAL_ALIGNMENT_CENTER;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control, \"VERTICAL_ALIGNMENT_TOP\", {\r\n /** VERTICAL_ALIGNMENT_TOP */\r\n get: function () {\r\n return Control._VERTICAL_ALIGNMENT_TOP;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control, \"VERTICAL_ALIGNMENT_BOTTOM\", {\r\n /** VERTICAL_ALIGNMENT_BOTTOM */\r\n get: function () {\r\n return Control._VERTICAL_ALIGNMENT_BOTTOM;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control, \"VERTICAL_ALIGNMENT_CENTER\", {\r\n /** VERTICAL_ALIGNMENT_CENTER */\r\n get: function () {\r\n return Control._VERTICAL_ALIGNMENT_CENTER;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Control._GetFontOffset = function (font) {\r\n if (Control._FontHeightSizes[font]) {\r\n return Control._FontHeightSizes[font];\r\n }\r\n var text = document.createElement(\"span\");\r\n text.innerHTML = \"Hg\";\r\n text.style.font = font;\r\n var block = document.createElement(\"div\");\r\n block.style.display = \"inline-block\";\r\n block.style.width = \"1px\";\r\n block.style.height = \"0px\";\r\n block.style.verticalAlign = \"bottom\";\r\n var div = document.createElement(\"div\");\r\n div.style.whiteSpace = \"nowrap\";\r\n div.appendChild(text);\r\n div.appendChild(block);\r\n document.body.appendChild(div);\r\n var fontAscent = 0;\r\n var fontHeight = 0;\r\n try {\r\n fontHeight = block.getBoundingClientRect().top - text.getBoundingClientRect().top;\r\n block.style.verticalAlign = \"baseline\";\r\n fontAscent = block.getBoundingClientRect().top - text.getBoundingClientRect().top;\r\n }\r\n finally {\r\n document.body.removeChild(div);\r\n }\r\n var result = { ascent: fontAscent, height: fontHeight, descent: fontHeight - fontAscent };\r\n Control._FontHeightSizes[font] = result;\r\n return result;\r\n };\r\n /** @hidden */\r\n Control.drawEllipse = function (x, y, width, height, context) {\r\n context.translate(x, y);\r\n context.scale(width, height);\r\n context.beginPath();\r\n context.arc(0, 0, 1, 0, 2 * Math.PI);\r\n context.closePath();\r\n context.scale(1 / width, 1 / height);\r\n context.translate(-x, -y);\r\n };\r\n /**\r\n * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)\r\n */\r\n Control.AllowAlphaInheritance = false;\r\n Control._ClipMeasure = new Measure(0, 0, 0, 0);\r\n // Statics\r\n Control._HORIZONTAL_ALIGNMENT_LEFT = 0;\r\n Control._HORIZONTAL_ALIGNMENT_RIGHT = 1;\r\n Control._HORIZONTAL_ALIGNMENT_CENTER = 2;\r\n Control._VERTICAL_ALIGNMENT_TOP = 0;\r\n Control._VERTICAL_ALIGNMENT_BOTTOM = 1;\r\n Control._VERTICAL_ALIGNMENT_CENTER = 2;\r\n Control._FontHeightSizes = {};\r\n /**\r\n * Creates a stack panel that can be used to render headers\r\n * @param control defines the control to associate with the header\r\n * @param text defines the text of the header\r\n * @param size defines the size of the header\r\n * @param options defines options used to configure the header\r\n * @returns a new StackPanel\r\n * @ignore\r\n * @hidden\r\n */\r\n Control.AddHeader = function () { };\r\n return Control;\r\n}());\r\nexport { Control };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Control\"] = Control;\r\n//# sourceMappingURL=control.js.map","import { __extends } from \"tslib\";\r\nimport { Container } from \"./container\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/** Class used to create rectangle container */\r\nvar Rectangle = /** @class */ (function (_super) {\r\n __extends(Rectangle, _super);\r\n /**\r\n * Creates a new Rectangle\r\n * @param name defines the control name\r\n */\r\n function Rectangle(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._thickness = 1;\r\n _this._cornerRadius = 0;\r\n return _this;\r\n }\r\n Object.defineProperty(Rectangle.prototype, \"thickness\", {\r\n /** Gets or sets border thickness */\r\n get: function () {\r\n return this._thickness;\r\n },\r\n set: function (value) {\r\n if (this._thickness === value) {\r\n return;\r\n }\r\n this._thickness = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Rectangle.prototype, \"cornerRadius\", {\r\n /** Gets or sets the corner radius angle */\r\n get: function () {\r\n return this._cornerRadius;\r\n },\r\n set: function (value) {\r\n if (value < 0) {\r\n value = 0;\r\n }\r\n if (this._cornerRadius === value) {\r\n return;\r\n }\r\n this._cornerRadius = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Rectangle.prototype._getTypeName = function () {\r\n return \"Rectangle\";\r\n };\r\n Rectangle.prototype._localDraw = function (context) {\r\n context.save();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n if (this._background) {\r\n context.fillStyle = this._background;\r\n if (this._cornerRadius) {\r\n this._drawRoundedRect(context, this._thickness / 2);\r\n context.fill();\r\n }\r\n else {\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n }\r\n if (this._thickness) {\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n if (this.color) {\r\n context.strokeStyle = this.color;\r\n }\r\n context.lineWidth = this._thickness;\r\n if (this._cornerRadius) {\r\n this._drawRoundedRect(context, this._thickness / 2);\r\n context.stroke();\r\n }\r\n else {\r\n context.strokeRect(this._currentMeasure.left + this._thickness / 2, this._currentMeasure.top + this._thickness / 2, this._currentMeasure.width - this._thickness, this._currentMeasure.height - this._thickness);\r\n }\r\n }\r\n context.restore();\r\n };\r\n Rectangle.prototype._additionalProcessing = function (parentMeasure, context) {\r\n _super.prototype._additionalProcessing.call(this, parentMeasure, context);\r\n this._measureForChildren.width -= 2 * this._thickness;\r\n this._measureForChildren.height -= 2 * this._thickness;\r\n this._measureForChildren.left += this._thickness;\r\n this._measureForChildren.top += this._thickness;\r\n };\r\n Rectangle.prototype._drawRoundedRect = function (context, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n var x = this._currentMeasure.left + offset;\r\n var y = this._currentMeasure.top + offset;\r\n var width = this._currentMeasure.width - offset * 2;\r\n var height = this._currentMeasure.height - offset * 2;\r\n var radius = Math.min(height / 2 - 2, Math.min(width / 2 - 2, this._cornerRadius));\r\n context.beginPath();\r\n context.moveTo(x + radius, y);\r\n context.lineTo(x + width - radius, y);\r\n context.quadraticCurveTo(x + width, y, x + width, y + radius);\r\n context.lineTo(x + width, y + height - radius);\r\n context.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);\r\n context.lineTo(x + radius, y + height);\r\n context.quadraticCurveTo(x, y + height, x, y + height - radius);\r\n context.lineTo(x, y + radius);\r\n context.quadraticCurveTo(x, y, x + radius, y);\r\n context.closePath();\r\n };\r\n Rectangle.prototype._clipForChildren = function (context) {\r\n if (this._cornerRadius) {\r\n this._drawRoundedRect(context, this._thickness);\r\n context.clip();\r\n }\r\n };\r\n return Rectangle;\r\n}(Container));\r\nexport { Rectangle };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Rectangle\"] = Rectangle;\r\n//# sourceMappingURL=rectangle.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { Control } from \"./control\";\r\nimport { _TypeStore } from \"@babylonjs/core/Misc/typeStore\";\r\n/**\r\n * Enum that determines the text-wrapping mode to use.\r\n */\r\nexport var TextWrapping;\r\n(function (TextWrapping) {\r\n /**\r\n * Clip the text when it's larger than Control.width; this is the default mode.\r\n */\r\n TextWrapping[TextWrapping[\"Clip\"] = 0] = \"Clip\";\r\n /**\r\n * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.\r\n */\r\n TextWrapping[TextWrapping[\"WordWrap\"] = 1] = \"WordWrap\";\r\n /**\r\n * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.\r\n */\r\n TextWrapping[TextWrapping[\"Ellipsis\"] = 2] = \"Ellipsis\";\r\n})(TextWrapping || (TextWrapping = {}));\r\n/**\r\n * Class used to create text block control\r\n */\r\nvar TextBlock = /** @class */ (function (_super) {\r\n __extends(TextBlock, _super);\r\n /**\r\n * Creates a new TextBlock object\r\n * @param name defines the name of the control\r\n * @param text defines the text to display (emptry string by default)\r\n */\r\n function TextBlock(\r\n /**\r\n * Defines the name of the control\r\n */\r\n name, text) {\r\n if (text === void 0) { text = \"\"; }\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._text = \"\";\r\n _this._textWrapping = TextWrapping.Clip;\r\n _this._textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n _this._textVerticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n _this._resizeToFit = false;\r\n _this._lineSpacing = new ValueAndUnit(0);\r\n _this._outlineWidth = 0;\r\n _this._outlineColor = \"white\";\r\n _this._underline = false;\r\n _this._lineThrough = false;\r\n /**\r\n * An event triggered after the text is changed\r\n */\r\n _this.onTextChangedObservable = new Observable();\r\n /**\r\n * An event triggered after the text was broken up into lines\r\n */\r\n _this.onLinesReadyObservable = new Observable();\r\n _this.text = text;\r\n return _this;\r\n }\r\n Object.defineProperty(TextBlock.prototype, \"lines\", {\r\n /**\r\n * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)\r\n */\r\n get: function () {\r\n return this._lines;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"resizeToFit\", {\r\n /**\r\n * Gets or sets an boolean indicating that the TextBlock will be resized to fit container\r\n */\r\n get: function () {\r\n return this._resizeToFit;\r\n },\r\n /**\r\n * Gets or sets an boolean indicating that the TextBlock will be resized to fit container\r\n */\r\n set: function (value) {\r\n if (this._resizeToFit === value) {\r\n return;\r\n }\r\n this._resizeToFit = value;\r\n if (this._resizeToFit) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"textWrapping\", {\r\n /**\r\n * Gets or sets a boolean indicating if text must be wrapped\r\n */\r\n get: function () {\r\n return this._textWrapping;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if text must be wrapped\r\n */\r\n set: function (value) {\r\n if (this._textWrapping === value) {\r\n return;\r\n }\r\n this._textWrapping = +value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"text\", {\r\n /**\r\n * Gets or sets text to display\r\n */\r\n get: function () {\r\n return this._text;\r\n },\r\n /**\r\n * Gets or sets text to display\r\n */\r\n set: function (value) {\r\n if (this._text === value) {\r\n return;\r\n }\r\n this._text = value;\r\n this._markAsDirty();\r\n this.onTextChangedObservable.notifyObservers(this);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"textHorizontalAlignment\", {\r\n /**\r\n * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)\r\n */\r\n get: function () {\r\n return this._textHorizontalAlignment;\r\n },\r\n /**\r\n * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)\r\n */\r\n set: function (value) {\r\n if (this._textHorizontalAlignment === value) {\r\n return;\r\n }\r\n this._textHorizontalAlignment = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"textVerticalAlignment\", {\r\n /**\r\n * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)\r\n */\r\n get: function () {\r\n return this._textVerticalAlignment;\r\n },\r\n /**\r\n * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)\r\n */\r\n set: function (value) {\r\n if (this._textVerticalAlignment === value) {\r\n return;\r\n }\r\n this._textVerticalAlignment = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"lineSpacing\", {\r\n /**\r\n * Gets or sets line spacing value\r\n */\r\n get: function () {\r\n return this._lineSpacing.toString(this._host);\r\n },\r\n /**\r\n * Gets or sets line spacing value\r\n */\r\n set: function (value) {\r\n if (this._lineSpacing.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"outlineWidth\", {\r\n /**\r\n * Gets or sets outlineWidth of the text to display\r\n */\r\n get: function () {\r\n return this._outlineWidth;\r\n },\r\n /**\r\n * Gets or sets outlineWidth of the text to display\r\n */\r\n set: function (value) {\r\n if (this._outlineWidth === value) {\r\n return;\r\n }\r\n this._outlineWidth = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"underline\", {\r\n /**\r\n * Gets or sets a boolean indicating that text must have underline\r\n */\r\n get: function () {\r\n return this._underline;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating that text must have underline\r\n */\r\n set: function (value) {\r\n if (this._underline === value) {\r\n return;\r\n }\r\n this._underline = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"lineThrough\", {\r\n /**\r\n * Gets or sets an boolean indicating that text must be crossed out\r\n */\r\n get: function () {\r\n return this._lineThrough;\r\n },\r\n /**\r\n * Gets or sets an boolean indicating that text must be crossed out\r\n */\r\n set: function (value) {\r\n if (this._lineThrough === value) {\r\n return;\r\n }\r\n this._lineThrough = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"outlineColor\", {\r\n /**\r\n * Gets or sets outlineColor of the text to display\r\n */\r\n get: function () {\r\n return this._outlineColor;\r\n },\r\n /**\r\n * Gets or sets outlineColor of the text to display\r\n */\r\n set: function (value) {\r\n if (this._outlineColor === value) {\r\n return;\r\n }\r\n this._outlineColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n TextBlock.prototype._getTypeName = function () {\r\n return \"TextBlock\";\r\n };\r\n TextBlock.prototype._processMeasures = function (parentMeasure, context) {\r\n if (!this._fontOffset) {\r\n this._fontOffset = Control._GetFontOffset(context.font);\r\n }\r\n _super.prototype._processMeasures.call(this, parentMeasure, context);\r\n // Prepare lines\r\n this._lines = this._breakLines(this._currentMeasure.width, context);\r\n this.onLinesReadyObservable.notifyObservers(this);\r\n var maxLineWidth = 0;\r\n for (var i = 0; i < this._lines.length; i++) {\r\n var line = this._lines[i];\r\n if (line.width > maxLineWidth) {\r\n maxLineWidth = line.width;\r\n }\r\n }\r\n if (this._resizeToFit) {\r\n if (this._textWrapping === TextWrapping.Clip) {\r\n var newWidth = (this.paddingLeftInPixels + this.paddingRightInPixels + maxLineWidth) | 0;\r\n if (newWidth !== this._width.internalValue) {\r\n this._width.updateInPlace(newWidth, ValueAndUnit.UNITMODE_PIXEL);\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n var newHeight = (this.paddingTopInPixels + this.paddingBottomInPixels + this._fontOffset.height * this._lines.length) | 0;\r\n if (this._lines.length > 0 && this._lineSpacing.internalValue !== 0) {\r\n var lineSpacing = 0;\r\n if (this._lineSpacing.isPixel) {\r\n lineSpacing = this._lineSpacing.getValue(this._host);\r\n }\r\n else {\r\n lineSpacing = this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n newHeight += (this._lines.length - 1) * lineSpacing;\r\n }\r\n if (newHeight !== this._height.internalValue) {\r\n this._height.updateInPlace(newHeight, ValueAndUnit.UNITMODE_PIXEL);\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n };\r\n TextBlock.prototype._drawText = function (text, textWidth, y, context) {\r\n var width = this._currentMeasure.width;\r\n var x = 0;\r\n switch (this._textHorizontalAlignment) {\r\n case Control.HORIZONTAL_ALIGNMENT_LEFT:\r\n x = 0;\r\n break;\r\n case Control.HORIZONTAL_ALIGNMENT_RIGHT:\r\n x = width - textWidth;\r\n break;\r\n case Control.HORIZONTAL_ALIGNMENT_CENTER:\r\n x = (width - textWidth) / 2;\r\n break;\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n if (this.outlineWidth) {\r\n context.strokeText(text, this._currentMeasure.left + x, y);\r\n }\r\n context.fillText(text, this._currentMeasure.left + x, y);\r\n if (this._underline) {\r\n context.beginPath();\r\n context.lineWidth = Math.round(this.fontSizeInPixels * 0.05);\r\n context.moveTo(this._currentMeasure.left + x, y + 3);\r\n context.lineTo(this._currentMeasure.left + x + textWidth, y + 3);\r\n context.stroke();\r\n context.closePath();\r\n }\r\n if (this._lineThrough) {\r\n context.beginPath();\r\n context.lineWidth = Math.round(this.fontSizeInPixels * 0.05);\r\n context.moveTo(this._currentMeasure.left + x, y - this.fontSizeInPixels / 3);\r\n context.lineTo(this._currentMeasure.left + x + textWidth, y - this.fontSizeInPixels / 3);\r\n context.stroke();\r\n context.closePath();\r\n }\r\n };\r\n /** @hidden */\r\n TextBlock.prototype._draw = function (context, invalidatedRectangle) {\r\n context.save();\r\n this._applyStates(context);\r\n // Render lines\r\n this._renderLines(context);\r\n context.restore();\r\n };\r\n TextBlock.prototype._applyStates = function (context) {\r\n _super.prototype._applyStates.call(this, context);\r\n if (this.outlineWidth) {\r\n context.lineWidth = this.outlineWidth;\r\n context.strokeStyle = this.outlineColor;\r\n context.lineJoin = 'miter';\r\n context.miterLimit = 2;\r\n }\r\n };\r\n TextBlock.prototype._breakLines = function (refWidth, context) {\r\n var lines = [];\r\n var _lines = this.text.split(\"\\n\");\r\n if (this._textWrapping === TextWrapping.Ellipsis) {\r\n for (var _i = 0, _lines_1 = _lines; _i < _lines_1.length; _i++) {\r\n var _line = _lines_1[_i];\r\n lines.push(this._parseLineEllipsis(_line, refWidth, context));\r\n }\r\n }\r\n else if (this._textWrapping === TextWrapping.WordWrap) {\r\n for (var _a = 0, _lines_2 = _lines; _a < _lines_2.length; _a++) {\r\n var _line = _lines_2[_a];\r\n lines.push.apply(lines, this._parseLineWordWrap(_line, refWidth, context));\r\n }\r\n }\r\n else {\r\n for (var _b = 0, _lines_3 = _lines; _b < _lines_3.length; _b++) {\r\n var _line = _lines_3[_b];\r\n lines.push(this._parseLine(_line, context));\r\n }\r\n }\r\n return lines;\r\n };\r\n TextBlock.prototype._parseLine = function (line, context) {\r\n if (line === void 0) { line = \"\"; }\r\n return { text: line, width: context.measureText(line).width };\r\n };\r\n TextBlock.prototype._parseLineEllipsis = function (line, width, context) {\r\n if (line === void 0) { line = \"\"; }\r\n var lineWidth = context.measureText(line).width;\r\n if (lineWidth > width) {\r\n line += \"…\";\r\n }\r\n // unicode support. split('') does not work with unicode!\r\n // make sure Array.from is available\r\n var characters = Array.from && Array.from(line);\r\n if (!characters) {\r\n // no array.from, use the old method\r\n while (line.length > 2 && lineWidth > width) {\r\n line = line.slice(0, -2) + \"…\";\r\n lineWidth = context.measureText(line).width;\r\n }\r\n }\r\n else {\r\n while (characters.length && lineWidth > width) {\r\n characters.pop();\r\n line = characters.join(\"\") + \"...\";\r\n lineWidth = context.measureText(line).width;\r\n }\r\n }\r\n return { text: line, width: lineWidth };\r\n };\r\n TextBlock.prototype._parseLineWordWrap = function (line, width, context) {\r\n if (line === void 0) { line = \"\"; }\r\n var lines = [];\r\n var words = this.wordSplittingFunction ? this.wordSplittingFunction(line) : line.split(\" \");\r\n var lineWidth = 0;\r\n for (var n = 0; n < words.length; n++) {\r\n var testLine = n > 0 ? line + \" \" + words[n] : words[0];\r\n var metrics = context.measureText(testLine);\r\n var testWidth = metrics.width;\r\n if (testWidth > width && n > 0) {\r\n lines.push({ text: line, width: lineWidth });\r\n line = words[n];\r\n lineWidth = context.measureText(line).width;\r\n }\r\n else {\r\n lineWidth = testWidth;\r\n line = testLine;\r\n }\r\n }\r\n lines.push({ text: line, width: lineWidth });\r\n return lines;\r\n };\r\n TextBlock.prototype._renderLines = function (context) {\r\n var height = this._currentMeasure.height;\r\n var rootY = 0;\r\n switch (this._textVerticalAlignment) {\r\n case Control.VERTICAL_ALIGNMENT_TOP:\r\n rootY = this._fontOffset.ascent;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_BOTTOM:\r\n rootY = height - this._fontOffset.height * (this._lines.length - 1) - this._fontOffset.descent;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_CENTER:\r\n rootY = this._fontOffset.ascent + (height - this._fontOffset.height * this._lines.length) / 2;\r\n break;\r\n }\r\n rootY += this._currentMeasure.top;\r\n for (var i = 0; i < this._lines.length; i++) {\r\n var line = this._lines[i];\r\n if (i !== 0 && this._lineSpacing.internalValue !== 0) {\r\n if (this._lineSpacing.isPixel) {\r\n rootY += this._lineSpacing.getValue(this._host);\r\n }\r\n else {\r\n rootY = rootY + this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n }\r\n this._drawText(line.text, line.width, rootY, context);\r\n rootY += this._fontOffset.height;\r\n }\r\n };\r\n /**\r\n * Given a width constraint applied on the text block, find the expected height\r\n * @returns expected height\r\n */\r\n TextBlock.prototype.computeExpectedHeight = function () {\r\n if (this.text && this.widthInPixels) {\r\n var context_1 = document.createElement(\"canvas\").getContext(\"2d\");\r\n if (context_1) {\r\n this._applyStates(context_1);\r\n if (!this._fontOffset) {\r\n this._fontOffset = Control._GetFontOffset(context_1.font);\r\n }\r\n var lines = this._lines ? this._lines : this._breakLines(this.widthInPixels - this.paddingLeftInPixels - this.paddingRightInPixels, context_1);\r\n var newHeight = this.paddingTopInPixels + this.paddingBottomInPixels + this._fontOffset.height * lines.length;\r\n if (lines.length > 0 && this._lineSpacing.internalValue !== 0) {\r\n var lineSpacing = 0;\r\n if (this._lineSpacing.isPixel) {\r\n lineSpacing = this._lineSpacing.getValue(this._host);\r\n }\r\n else {\r\n lineSpacing = this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n newHeight += (lines.length - 1) * lineSpacing;\r\n }\r\n return newHeight;\r\n }\r\n }\r\n return 0;\r\n };\r\n TextBlock.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onTextChangedObservable.clear();\r\n };\r\n return TextBlock;\r\n}(Control));\r\nexport { TextBlock };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.TextBlock\"] = TextBlock;\r\n//# sourceMappingURL=textBlock.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Control } from \"./control\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create 2D images\r\n */\r\nvar Image = /** @class */ (function (_super) {\r\n __extends(Image, _super);\r\n /**\r\n * Creates a new Image\r\n * @param name defines the control name\r\n * @param url defines the image url\r\n */\r\n function Image(name, url) {\r\n if (url === void 0) { url = null; }\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._workingCanvas = null;\r\n _this._loaded = false;\r\n _this._stretch = Image.STRETCH_FILL;\r\n _this._autoScale = false;\r\n _this._sourceLeft = 0;\r\n _this._sourceTop = 0;\r\n _this._sourceWidth = 0;\r\n _this._sourceHeight = 0;\r\n _this._svgAttributesComputationCompleted = false;\r\n _this._isSVG = false;\r\n _this._cellWidth = 0;\r\n _this._cellHeight = 0;\r\n _this._cellId = -1;\r\n _this._populateNinePatchSlicesFromImage = false;\r\n _this._imageDataCache = { data: null, key: \"\" };\r\n /**\r\n * Observable notified when the content is loaded\r\n */\r\n _this.onImageLoadedObservable = new Observable();\r\n /**\r\n * Observable notified when _sourceLeft, _sourceTop, _sourceWidth and _sourceHeight are computed\r\n */\r\n _this.onSVGAttributesComputedObservable = new Observable();\r\n _this.source = url;\r\n return _this;\r\n }\r\n Object.defineProperty(Image.prototype, \"isLoaded\", {\r\n /**\r\n * Gets a boolean indicating that the content is loaded\r\n */\r\n get: function () {\r\n return this._loaded;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"populateNinePatchSlicesFromImage\", {\r\n /**\r\n * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data\r\n */\r\n get: function () {\r\n return this._populateNinePatchSlicesFromImage;\r\n },\r\n set: function (value) {\r\n if (this._populateNinePatchSlicesFromImage === value) {\r\n return;\r\n }\r\n this._populateNinePatchSlicesFromImage = value;\r\n if (this._populateNinePatchSlicesFromImage && this._loaded) {\r\n this._extractNinePatchSliceDataFromImage();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"detectPointerOnOpaqueOnly\", {\r\n /**\r\n * Gets or sets a boolean indicating if pointers should only be validated on pixels with alpha > 0.\r\n * Beware using this as this will comsume more memory as the image has to be stored twice\r\n */\r\n get: function () {\r\n return this._detectPointerOnOpaqueOnly;\r\n },\r\n set: function (value) {\r\n if (this._detectPointerOnOpaqueOnly === value) {\r\n return;\r\n }\r\n this._detectPointerOnOpaqueOnly = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sliceLeft\", {\r\n /**\r\n * Gets or sets the left value for slicing (9-patch)\r\n */\r\n get: function () {\r\n return this._sliceLeft;\r\n },\r\n set: function (value) {\r\n if (this._sliceLeft === value) {\r\n return;\r\n }\r\n this._sliceLeft = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sliceRight\", {\r\n /**\r\n * Gets or sets the right value for slicing (9-patch)\r\n */\r\n get: function () {\r\n return this._sliceRight;\r\n },\r\n set: function (value) {\r\n if (this._sliceRight === value) {\r\n return;\r\n }\r\n this._sliceRight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sliceTop\", {\r\n /**\r\n * Gets or sets the top value for slicing (9-patch)\r\n */\r\n get: function () {\r\n return this._sliceTop;\r\n },\r\n set: function (value) {\r\n if (this._sliceTop === value) {\r\n return;\r\n }\r\n this._sliceTop = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sliceBottom\", {\r\n /**\r\n * Gets or sets the bottom value for slicing (9-patch)\r\n */\r\n get: function () {\r\n return this._sliceBottom;\r\n },\r\n set: function (value) {\r\n if (this._sliceBottom === value) {\r\n return;\r\n }\r\n this._sliceBottom = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sourceLeft\", {\r\n /**\r\n * Gets or sets the left coordinate in the source image\r\n */\r\n get: function () {\r\n return this._sourceLeft;\r\n },\r\n set: function (value) {\r\n if (this._sourceLeft === value) {\r\n return;\r\n }\r\n this._sourceLeft = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sourceTop\", {\r\n /**\r\n * Gets or sets the top coordinate in the source image\r\n */\r\n get: function () {\r\n return this._sourceTop;\r\n },\r\n set: function (value) {\r\n if (this._sourceTop === value) {\r\n return;\r\n }\r\n this._sourceTop = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sourceWidth\", {\r\n /**\r\n * Gets or sets the width to capture in the source image\r\n */\r\n get: function () {\r\n return this._sourceWidth;\r\n },\r\n set: function (value) {\r\n if (this._sourceWidth === value) {\r\n return;\r\n }\r\n this._sourceWidth = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sourceHeight\", {\r\n /**\r\n * Gets or sets the height to capture in the source image\r\n */\r\n get: function () {\r\n return this._sourceHeight;\r\n },\r\n set: function (value) {\r\n if (this._sourceHeight === value) {\r\n return;\r\n }\r\n this._sourceHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"isSVG\", {\r\n /** Indicates if the format of the image is SVG */\r\n get: function () {\r\n return this._isSVG;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"svgAttributesComputationCompleted\", {\r\n /** Gets the status of the SVG attributes computation (sourceLeft, sourceTop, sourceWidth, sourceHeight) */\r\n get: function () {\r\n return this._svgAttributesComputationCompleted;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"autoScale\", {\r\n /**\r\n * Gets or sets a boolean indicating if the image can force its container to adapt its size\r\n * @see https://doc.babylonjs.com/how_to/gui#image\r\n */\r\n get: function () {\r\n return this._autoScale;\r\n },\r\n set: function (value) {\r\n if (this._autoScale === value) {\r\n return;\r\n }\r\n this._autoScale = value;\r\n if (value && this._loaded) {\r\n this.synchronizeSizeWithContent();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"stretch\", {\r\n /** Gets or sets the streching mode used by the image */\r\n get: function () {\r\n return this._stretch;\r\n },\r\n set: function (value) {\r\n if (this._stretch === value) {\r\n return;\r\n }\r\n this._stretch = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Image.prototype._rotate90 = function (n, preserveProperties) {\r\n if (preserveProperties === void 0) { preserveProperties = false; }\r\n var canvas = document.createElement('canvas');\r\n var context = canvas.getContext('2d');\r\n var width = this._domImage.width;\r\n var height = this._domImage.height;\r\n canvas.width = height;\r\n canvas.height = width;\r\n context.translate(canvas.width / 2, canvas.height / 2);\r\n context.rotate(n * Math.PI / 2);\r\n context.drawImage(this._domImage, 0, 0, width, height, -width / 2, -height / 2, width, height);\r\n var dataUrl = canvas.toDataURL(\"image/jpg\");\r\n var rotatedImage = new Image(this.name + \"rotated\", dataUrl);\r\n if (preserveProperties) {\r\n rotatedImage._stretch = this._stretch;\r\n rotatedImage._autoScale = this._autoScale;\r\n rotatedImage._cellId = this._cellId;\r\n rotatedImage._cellWidth = n % 1 ? this._cellHeight : this._cellWidth;\r\n rotatedImage._cellHeight = n % 1 ? this._cellWidth : this._cellHeight;\r\n }\r\n this._handleRotationForSVGImage(this, rotatedImage, n);\r\n this._imageDataCache.data = null;\r\n return rotatedImage;\r\n };\r\n Image.prototype._handleRotationForSVGImage = function (srcImage, dstImage, n) {\r\n var _this = this;\r\n if (!srcImage._isSVG) {\r\n return;\r\n }\r\n if (srcImage._svgAttributesComputationCompleted) {\r\n this._rotate90SourceProperties(srcImage, dstImage, n);\r\n this._markAsDirty();\r\n }\r\n else {\r\n srcImage.onSVGAttributesComputedObservable.addOnce(function () {\r\n _this._rotate90SourceProperties(srcImage, dstImage, n);\r\n _this._markAsDirty();\r\n });\r\n }\r\n };\r\n Image.prototype._rotate90SourceProperties = function (srcImage, dstImage, n) {\r\n var _a, _b;\r\n var srcLeft = srcImage.sourceLeft, srcTop = srcImage.sourceTop, srcWidth = srcImage.domImage.width, srcHeight = srcImage.domImage.height;\r\n var dstLeft = srcLeft, dstTop = srcTop, dstWidth = srcImage.sourceWidth, dstHeight = srcImage.sourceHeight;\r\n if (n != 0) {\r\n var mult = n < 0 ? -1 : 1;\r\n n = n % 4;\r\n for (var i = 0; i < Math.abs(n); ++i) {\r\n dstLeft = -(srcTop - srcHeight / 2) * mult + srcHeight / 2;\r\n dstTop = (srcLeft - srcWidth / 2) * mult + srcWidth / 2;\r\n _a = [dstHeight, dstWidth], dstWidth = _a[0], dstHeight = _a[1];\r\n if (n < 0) {\r\n dstTop -= dstHeight;\r\n }\r\n else {\r\n dstLeft -= dstWidth;\r\n }\r\n srcLeft = dstLeft;\r\n srcTop = dstTop;\r\n _b = [srcHeight, srcWidth], srcWidth = _b[0], srcHeight = _b[1];\r\n }\r\n }\r\n dstImage.sourceLeft = dstLeft;\r\n dstImage.sourceTop = dstTop;\r\n dstImage.sourceWidth = dstWidth;\r\n dstImage.sourceHeight = dstHeight;\r\n };\r\n Object.defineProperty(Image.prototype, \"domImage\", {\r\n get: function () {\r\n return this._domImage;\r\n },\r\n /**\r\n * Gets or sets the internal DOM image used to render the control\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n this._domImage = value;\r\n this._loaded = false;\r\n this._imageDataCache.data = null;\r\n if (this._domImage.width) {\r\n this._onImageLoaded();\r\n }\r\n else {\r\n this._domImage.onload = function () {\r\n _this._onImageLoaded();\r\n };\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Image.prototype._onImageLoaded = function () {\r\n this._imageDataCache.data = null;\r\n this._imageWidth = this._domImage.width;\r\n this._imageHeight = this._domImage.height;\r\n this._loaded = true;\r\n if (this._populateNinePatchSlicesFromImage) {\r\n this._extractNinePatchSliceDataFromImage();\r\n }\r\n if (this._autoScale) {\r\n this.synchronizeSizeWithContent();\r\n }\r\n this.onImageLoadedObservable.notifyObservers(this);\r\n this._markAsDirty();\r\n };\r\n Image.prototype._extractNinePatchSliceDataFromImage = function () {\r\n if (!this._workingCanvas) {\r\n this._workingCanvas = document.createElement('canvas');\r\n }\r\n var canvas = this._workingCanvas;\r\n var context = canvas.getContext('2d');\r\n var width = this._domImage.width;\r\n var height = this._domImage.height;\r\n canvas.width = width;\r\n canvas.height = height;\r\n context.drawImage(this._domImage, 0, 0, width, height);\r\n var imageData = context.getImageData(0, 0, width, height);\r\n // Left and right\r\n this._sliceLeft = -1;\r\n this._sliceRight = -1;\r\n for (var x = 0; x < width; x++) {\r\n var alpha = imageData.data[x * 4 + 3];\r\n if (alpha > 127 && this._sliceLeft === -1) {\r\n this._sliceLeft = x;\r\n continue;\r\n }\r\n if (alpha < 127 && this._sliceLeft > -1) {\r\n this._sliceRight = x;\r\n break;\r\n }\r\n }\r\n // top and bottom\r\n this._sliceTop = -1;\r\n this._sliceBottom = -1;\r\n for (var y = 0; y < height; y++) {\r\n var alpha = imageData.data[y * width * 4 + 3];\r\n if (alpha > 127 && this._sliceTop === -1) {\r\n this._sliceTop = y;\r\n continue;\r\n }\r\n if (alpha < 127 && this._sliceTop > -1) {\r\n this._sliceBottom = y;\r\n break;\r\n }\r\n }\r\n };\r\n Object.defineProperty(Image.prototype, \"source\", {\r\n /**\r\n * Gets or sets image source url\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (this._source === value) {\r\n return;\r\n }\r\n this._loaded = false;\r\n this._source = value;\r\n this._imageDataCache.data = null;\r\n if (value) {\r\n value = this._svgCheck(value);\r\n }\r\n this._domImage = document.createElement(\"img\");\r\n this._domImage.onload = function () {\r\n _this._onImageLoaded();\r\n };\r\n if (value) {\r\n Tools.SetCorsBehavior(value, this._domImage);\r\n this._domImage.src = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Checks for svg document with icon id present\r\n */\r\n Image.prototype._svgCheck = function (value) {\r\n var _this = this;\r\n if (window.SVGSVGElement && (value.search(/.svg#/gi) !== -1) && (value.indexOf(\"#\") === value.lastIndexOf(\"#\"))) {\r\n this._isSVG = true;\r\n var svgsrc = value.split('#')[0];\r\n var elemid = value.split('#')[1];\r\n // check if object alr exist in document\r\n var svgExist = document.body.querySelector('object[data=\"' + svgsrc + '\"]');\r\n if (svgExist) {\r\n var svgDoc = svgExist.contentDocument;\r\n // get viewbox width and height, get svg document width and height in px\r\n if (svgDoc && svgDoc.documentElement) {\r\n var vb = svgDoc.documentElement.getAttribute(\"viewBox\");\r\n var docwidth = Number(svgDoc.documentElement.getAttribute(\"width\"));\r\n var docheight = Number(svgDoc.documentElement.getAttribute(\"height\"));\r\n var elem = svgDoc.getElementById(elemid);\r\n if (elem && vb && docwidth && docheight) {\r\n this._getSVGAttribs(svgExist, elemid);\r\n return value;\r\n }\r\n }\r\n // wait for object to load\r\n svgExist.addEventListener(\"load\", function () {\r\n _this._getSVGAttribs(svgExist, elemid);\r\n });\r\n }\r\n else {\r\n // create document object\r\n var svgImage = document.createElement(\"object\");\r\n svgImage.data = svgsrc;\r\n svgImage.type = \"image/svg+xml\";\r\n svgImage.width = \"0%\";\r\n svgImage.height = \"0%\";\r\n document.body.appendChild(svgImage);\r\n // when the object has loaded, get the element attribs\r\n svgImage.onload = function () {\r\n var svgobj = document.body.querySelector('object[data=\"' + svgsrc + '\"]');\r\n if (svgobj) {\r\n _this._getSVGAttribs(svgobj, elemid);\r\n }\r\n };\r\n }\r\n return svgsrc;\r\n }\r\n else {\r\n return value;\r\n }\r\n };\r\n /**\r\n * Sets sourceLeft, sourceTop, sourceWidth, sourceHeight automatically\r\n * given external svg file and icon id\r\n */\r\n Image.prototype._getSVGAttribs = function (svgsrc, elemid) {\r\n var svgDoc = svgsrc.contentDocument;\r\n // get viewbox width and height, get svg document width and height in px\r\n if (svgDoc && svgDoc.documentElement) {\r\n var vb = svgDoc.documentElement.getAttribute(\"viewBox\");\r\n var docwidth = Number(svgDoc.documentElement.getAttribute(\"width\"));\r\n var docheight = Number(svgDoc.documentElement.getAttribute(\"height\"));\r\n // get element bbox and matrix transform\r\n var elem = svgDoc.getElementById(elemid);\r\n if (vb && docwidth && docheight && elem) {\r\n var vb_width = Number(vb.split(\" \")[2]);\r\n var vb_height = Number(vb.split(\" \")[3]);\r\n var elem_bbox = elem.getBBox();\r\n var elem_matrix_a = 1;\r\n var elem_matrix_d = 1;\r\n var elem_matrix_e = 0;\r\n var elem_matrix_f = 0;\r\n if (elem.transform && elem.transform.baseVal.consolidate()) {\r\n elem_matrix_a = elem.transform.baseVal.consolidate().matrix.a;\r\n elem_matrix_d = elem.transform.baseVal.consolidate().matrix.d;\r\n elem_matrix_e = elem.transform.baseVal.consolidate().matrix.e;\r\n elem_matrix_f = elem.transform.baseVal.consolidate().matrix.f;\r\n }\r\n // compute source coordinates and dimensions\r\n this.sourceLeft = ((elem_matrix_a * elem_bbox.x + elem_matrix_e) * docwidth) / vb_width;\r\n this.sourceTop = ((elem_matrix_d * elem_bbox.y + elem_matrix_f) * docheight) / vb_height;\r\n this.sourceWidth = (elem_bbox.width * elem_matrix_a) * (docwidth / vb_width);\r\n this.sourceHeight = (elem_bbox.height * elem_matrix_d) * (docheight / vb_height);\r\n this._svgAttributesComputationCompleted = true;\r\n this.onSVGAttributesComputedObservable.notifyObservers(this);\r\n }\r\n }\r\n };\r\n Object.defineProperty(Image.prototype, \"cellWidth\", {\r\n /**\r\n * Gets or sets the cell width to use when animation sheet is enabled\r\n * @see https://doc.babylonjs.com/how_to/gui#image\r\n */\r\n get: function () {\r\n return this._cellWidth;\r\n },\r\n set: function (value) {\r\n if (this._cellWidth === value) {\r\n return;\r\n }\r\n this._cellWidth = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"cellHeight\", {\r\n /**\r\n * Gets or sets the cell height to use when animation sheet is enabled\r\n * @see https://doc.babylonjs.com/how_to/gui#image\r\n */\r\n get: function () {\r\n return this._cellHeight;\r\n },\r\n set: function (value) {\r\n if (this._cellHeight === value) {\r\n return;\r\n }\r\n this._cellHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"cellId\", {\r\n /**\r\n * Gets or sets the cell id to use (this will turn on the animation sheet mode)\r\n * @see https://doc.babylonjs.com/how_to/gui#image\r\n */\r\n get: function () {\r\n return this._cellId;\r\n },\r\n set: function (value) {\r\n if (this._cellId === value) {\r\n return;\r\n }\r\n this._cellId = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Tests if a given coordinates belong to the current control\r\n * @param x defines x coordinate to test\r\n * @param y defines y coordinate to test\r\n * @returns true if the coordinates are inside the control\r\n */\r\n Image.prototype.contains = function (x, y) {\r\n if (!_super.prototype.contains.call(this, x, y)) {\r\n return false;\r\n }\r\n if (!this._detectPointerOnOpaqueOnly || !this._workingCanvas) {\r\n return true;\r\n }\r\n var width = this._currentMeasure.width | 0;\r\n var height = this._currentMeasure.height | 0;\r\n var key = width + \"_\" + height;\r\n var imageData = this._imageDataCache.data;\r\n if (!imageData || this._imageDataCache.key !== key) {\r\n var canvas = this._workingCanvas;\r\n var context_1 = canvas.getContext(\"2d\");\r\n this._imageDataCache.data = imageData = context_1.getImageData(0, 0, width, height).data;\r\n this._imageDataCache.key = key;\r\n }\r\n x = (x - this._currentMeasure.left) | 0;\r\n y = (y - this._currentMeasure.top) | 0;\r\n var pickedPixel = imageData[(x + y * width) * 4 + 3];\r\n return pickedPixel > 0;\r\n };\r\n Image.prototype._getTypeName = function () {\r\n return \"Image\";\r\n };\r\n /** Force the control to synchronize with its content */\r\n Image.prototype.synchronizeSizeWithContent = function () {\r\n if (!this._loaded) {\r\n return;\r\n }\r\n this.width = this._domImage.width + \"px\";\r\n this.height = this._domImage.height + \"px\";\r\n };\r\n Image.prototype._processMeasures = function (parentMeasure, context) {\r\n if (this._loaded) {\r\n switch (this._stretch) {\r\n case Image.STRETCH_NONE:\r\n break;\r\n case Image.STRETCH_FILL:\r\n break;\r\n case Image.STRETCH_UNIFORM:\r\n break;\r\n case Image.STRETCH_NINE_PATCH:\r\n break;\r\n case Image.STRETCH_EXTEND:\r\n if (this._autoScale) {\r\n this.synchronizeSizeWithContent();\r\n }\r\n if (this.parent && this.parent.parent) { // Will update root size if root is not the top root\r\n this.parent.adaptWidthToChildren = true;\r\n this.parent.adaptHeightToChildren = true;\r\n }\r\n break;\r\n }\r\n }\r\n _super.prototype._processMeasures.call(this, parentMeasure, context);\r\n };\r\n Image.prototype._prepareWorkingCanvasForOpaqueDetection = function () {\r\n if (!this._detectPointerOnOpaqueOnly) {\r\n return;\r\n }\r\n if (!this._workingCanvas) {\r\n this._workingCanvas = document.createElement('canvas');\r\n }\r\n var canvas = this._workingCanvas;\r\n var width = this._currentMeasure.width;\r\n var height = this._currentMeasure.height;\r\n var context = canvas.getContext(\"2d\");\r\n canvas.width = width;\r\n canvas.height = height;\r\n context.clearRect(0, 0, width, height);\r\n };\r\n Image.prototype._drawImage = function (context, sx, sy, sw, sh, tx, ty, tw, th) {\r\n context.drawImage(this._domImage, sx, sy, sw, sh, tx, ty, tw, th);\r\n if (!this._detectPointerOnOpaqueOnly) {\r\n return;\r\n }\r\n var canvas = this._workingCanvas;\r\n context = canvas.getContext(\"2d\");\r\n context.drawImage(this._domImage, sx, sy, sw, sh, tx - this._currentMeasure.left, ty - this._currentMeasure.top, tw, th);\r\n };\r\n Image.prototype._draw = function (context) {\r\n context.save();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n var x, y, width, height;\r\n if (this.cellId == -1) {\r\n x = this._sourceLeft;\r\n y = this._sourceTop;\r\n width = this._sourceWidth ? this._sourceWidth : this._imageWidth;\r\n height = this._sourceHeight ? this._sourceHeight : this._imageHeight;\r\n }\r\n else {\r\n var rowCount = this._domImage.naturalWidth / this.cellWidth;\r\n var column = (this.cellId / rowCount) >> 0;\r\n var row = this.cellId % rowCount;\r\n x = this.cellWidth * row;\r\n y = this.cellHeight * column;\r\n width = this.cellWidth;\r\n height = this.cellHeight;\r\n }\r\n this._prepareWorkingCanvasForOpaqueDetection();\r\n this._applyStates(context);\r\n if (this._loaded) {\r\n switch (this._stretch) {\r\n case Image.STRETCH_NONE:\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n break;\r\n case Image.STRETCH_FILL:\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n break;\r\n case Image.STRETCH_UNIFORM:\r\n var hRatio = this._currentMeasure.width / width;\r\n var vRatio = this._currentMeasure.height / height;\r\n var ratio = Math.min(hRatio, vRatio);\r\n var centerX = (this._currentMeasure.width - width * ratio) / 2;\r\n var centerY = (this._currentMeasure.height - height * ratio) / 2;\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left + centerX, this._currentMeasure.top + centerY, width * ratio, height * ratio);\r\n break;\r\n case Image.STRETCH_EXTEND:\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n break;\r\n case Image.STRETCH_NINE_PATCH:\r\n this._renderNinePatch(context);\r\n break;\r\n }\r\n }\r\n context.restore();\r\n };\r\n Image.prototype._renderCornerPatch = function (context, x, y, width, height, targetX, targetY) {\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left + targetX, this._currentMeasure.top + targetY, width, height);\r\n };\r\n Image.prototype._renderNinePatch = function (context) {\r\n var height = this._imageHeight;\r\n var leftWidth = this._sliceLeft;\r\n var topHeight = this._sliceTop;\r\n var bottomHeight = this._imageHeight - this._sliceBottom;\r\n var rightWidth = this._imageWidth - this._sliceRight;\r\n var left = 0;\r\n var top = 0;\r\n if (this._populateNinePatchSlicesFromImage) {\r\n left = 1;\r\n top = 1;\r\n height -= 2;\r\n leftWidth -= 1;\r\n topHeight -= 1;\r\n bottomHeight -= 1;\r\n rightWidth -= 1;\r\n }\r\n var centerWidth = this._sliceRight - this._sliceLeft;\r\n var targetCenterWidth = this._currentMeasure.width - rightWidth - this.sliceLeft;\r\n var targetTopHeight = this._currentMeasure.height - height + this._sliceBottom;\r\n // Corners\r\n this._renderCornerPatch(context, left, top, leftWidth, topHeight, 0, 0);\r\n this._renderCornerPatch(context, left, this._sliceBottom, leftWidth, height - this._sliceBottom, 0, targetTopHeight);\r\n this._renderCornerPatch(context, this._sliceRight, top, rightWidth, topHeight, this._currentMeasure.width - rightWidth, 0);\r\n this._renderCornerPatch(context, this._sliceRight, this._sliceBottom, rightWidth, height - this._sliceBottom, this._currentMeasure.width - rightWidth, targetTopHeight);\r\n // Center\r\n this._drawImage(context, this._sliceLeft, this._sliceTop, centerWidth, this._sliceBottom - this._sliceTop, this._currentMeasure.left + leftWidth, this._currentMeasure.top + topHeight, targetCenterWidth, targetTopHeight - topHeight);\r\n // Borders\r\n this._drawImage(context, left, this._sliceTop, leftWidth, this._sliceBottom - this._sliceTop, this._currentMeasure.left, this._currentMeasure.top + topHeight, leftWidth, targetTopHeight - topHeight);\r\n this._drawImage(context, this._sliceRight, this._sliceTop, leftWidth, this._sliceBottom - this._sliceTop, this._currentMeasure.left + this._currentMeasure.width - rightWidth, this._currentMeasure.top + topHeight, leftWidth, targetTopHeight - topHeight);\r\n this._drawImage(context, this._sliceLeft, top, centerWidth, topHeight, this._currentMeasure.left + leftWidth, this._currentMeasure.top, targetCenterWidth, topHeight);\r\n this._drawImage(context, this._sliceLeft, this._sliceBottom, centerWidth, bottomHeight, this._currentMeasure.left + leftWidth, this._currentMeasure.top + targetTopHeight, targetCenterWidth, bottomHeight);\r\n };\r\n Image.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onImageLoadedObservable.clear();\r\n this.onSVGAttributesComputedObservable.clear();\r\n };\r\n // Static\r\n /** STRETCH_NONE */\r\n Image.STRETCH_NONE = 0;\r\n /** STRETCH_FILL */\r\n Image.STRETCH_FILL = 1;\r\n /** STRETCH_UNIFORM */\r\n Image.STRETCH_UNIFORM = 2;\r\n /** STRETCH_EXTEND */\r\n Image.STRETCH_EXTEND = 3;\r\n /** NINE_PATCH */\r\n Image.STRETCH_NINE_PATCH = 4;\r\n return Image;\r\n}(Control));\r\nexport { Image };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Image\"] = Image;\r\n//# sourceMappingURL=image.js.map","import { __extends } from \"tslib\";\r\nimport { Rectangle } from \"./rectangle\";\r\nimport { Control } from \"./control\";\r\nimport { TextBlock } from \"./textBlock\";\r\nimport { Image } from \"./image\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create 2D buttons\r\n */\r\nvar Button = /** @class */ (function (_super) {\r\n __extends(Button, _super);\r\n /**\r\n * Creates a new Button\r\n * @param name defines the name of the button\r\n */\r\n function Button(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n /**\r\n * Gets or sets a boolean indicating that the button will let internal controls handle picking instead of doing it directly using its bounding info\r\n */\r\n _this.delegatePickingToChildren = false;\r\n _this.thickness = 1;\r\n _this.isPointerBlocker = true;\r\n var alphaStore = null;\r\n _this.pointerEnterAnimation = function () {\r\n alphaStore = _this.alpha;\r\n _this.alpha -= 0.1;\r\n };\r\n _this.pointerOutAnimation = function () {\r\n if (alphaStore !== null) {\r\n _this.alpha = alphaStore;\r\n }\r\n };\r\n _this.pointerDownAnimation = function () {\r\n _this.scaleX -= 0.05;\r\n _this.scaleY -= 0.05;\r\n };\r\n _this.pointerUpAnimation = function () {\r\n _this.scaleX += 0.05;\r\n _this.scaleY += 0.05;\r\n };\r\n return _this;\r\n }\r\n Object.defineProperty(Button.prototype, \"image\", {\r\n /**\r\n * Returns the image part of the button (if any)\r\n */\r\n get: function () {\r\n return this._image;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Button.prototype, \"textBlock\", {\r\n /**\r\n * Returns the image part of the button (if any)\r\n */\r\n get: function () {\r\n return this._textBlock;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Button.prototype._getTypeName = function () {\r\n return \"Button\";\r\n };\r\n // While being a container, the button behaves like a control.\r\n /** @hidden */\r\n Button.prototype._processPicking = function (x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY) {\r\n if (!this._isEnabled || !this.isHitTestVisible || !this.isVisible || this.notRenderable) {\r\n return false;\r\n }\r\n if (!_super.prototype.contains.call(this, x, y)) {\r\n return false;\r\n }\r\n if (this.delegatePickingToChildren) {\r\n var contains = false;\r\n for (var index = this._children.length - 1; index >= 0; index--) {\r\n var child = this._children[index];\r\n if (child.isEnabled && child.isHitTestVisible && child.isVisible && !child.notRenderable && child.contains(x, y)) {\r\n contains = true;\r\n break;\r\n }\r\n }\r\n if (!contains) {\r\n return false;\r\n }\r\n }\r\n this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);\r\n return true;\r\n };\r\n /** @hidden */\r\n Button.prototype._onPointerEnter = function (target, pi) {\r\n if (!_super.prototype._onPointerEnter.call(this, target, pi)) {\r\n return false;\r\n }\r\n if (this.pointerEnterAnimation) {\r\n this.pointerEnterAnimation();\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n Button.prototype._onPointerOut = function (target, pi, force) {\r\n if (force === void 0) { force = false; }\r\n if (this.pointerOutAnimation) {\r\n this.pointerOutAnimation();\r\n }\r\n _super.prototype._onPointerOut.call(this, target, pi, force);\r\n };\r\n /** @hidden */\r\n Button.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n if (!_super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n if (this.pointerDownAnimation) {\r\n this.pointerDownAnimation();\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n Button.prototype._onPointerUp = function (target, coordinates, pointerId, buttonIndex, notifyClick, pi) {\r\n if (this.pointerUpAnimation) {\r\n this.pointerUpAnimation();\r\n }\r\n _super.prototype._onPointerUp.call(this, target, coordinates, pointerId, buttonIndex, notifyClick, pi);\r\n };\r\n // Statics\r\n /**\r\n * Creates a new button made with an image and a text\r\n * @param name defines the name of the button\r\n * @param text defines the text of the button\r\n * @param imageUrl defines the url of the image\r\n * @returns a new Button\r\n */\r\n Button.CreateImageButton = function (name, text, imageUrl) {\r\n var result = new Button(name);\r\n // Adding text\r\n var textBlock = new TextBlock(name + \"_button\", text);\r\n textBlock.textWrapping = true;\r\n textBlock.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n textBlock.paddingLeft = \"20%\";\r\n result.addControl(textBlock);\r\n // Adding image\r\n var iconImage = new Image(name + \"_icon\", imageUrl);\r\n iconImage.width = \"20%\";\r\n iconImage.stretch = Image.STRETCH_UNIFORM;\r\n iconImage.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n result.addControl(iconImage);\r\n // Store\r\n result._image = iconImage;\r\n result._textBlock = textBlock;\r\n return result;\r\n };\r\n /**\r\n * Creates a new button made with an image\r\n * @param name defines the name of the button\r\n * @param imageUrl defines the url of the image\r\n * @returns a new Button\r\n */\r\n Button.CreateImageOnlyButton = function (name, imageUrl) {\r\n var result = new Button(name);\r\n // Adding image\r\n var iconImage = new Image(name + \"_icon\", imageUrl);\r\n iconImage.stretch = Image.STRETCH_FILL;\r\n iconImage.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n result.addControl(iconImage);\r\n // Store\r\n result._image = iconImage;\r\n return result;\r\n };\r\n /**\r\n * Creates a new button made with a text\r\n * @param name defines the name of the button\r\n * @param text defines the text of the button\r\n * @returns a new Button\r\n */\r\n Button.CreateSimpleButton = function (name, text) {\r\n var result = new Button(name);\r\n // Adding text\r\n var textBlock = new TextBlock(name + \"_button\", text);\r\n textBlock.textWrapping = true;\r\n textBlock.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n result.addControl(textBlock);\r\n // Store\r\n result._textBlock = textBlock;\r\n return result;\r\n };\r\n /**\r\n * Creates a new button made with an image and a centered text\r\n * @param name defines the name of the button\r\n * @param text defines the text of the button\r\n * @param imageUrl defines the url of the image\r\n * @returns a new Button\r\n */\r\n Button.CreateImageWithCenterTextButton = function (name, text, imageUrl) {\r\n var result = new Button(name);\r\n // Adding image\r\n var iconImage = new Image(name + \"_icon\", imageUrl);\r\n iconImage.stretch = Image.STRETCH_FILL;\r\n result.addControl(iconImage);\r\n // Adding text\r\n var textBlock = new TextBlock(name + \"_button\", text);\r\n textBlock.textWrapping = true;\r\n textBlock.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n result.addControl(textBlock);\r\n // Store\r\n result._image = iconImage;\r\n result._textBlock = textBlock;\r\n return result;\r\n };\r\n return Button;\r\n}(Rectangle));\r\nexport { Button };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Button\"] = Button;\r\n//# sourceMappingURL=button.js.map","import { __extends } from \"tslib\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Container } from \"./container\";\r\nimport { Control } from \"./control\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create a 2D stack panel container\r\n */\r\nvar StackPanel = /** @class */ (function (_super) {\r\n __extends(StackPanel, _super);\r\n /**\r\n * Creates a new StackPanel\r\n * @param name defines control name\r\n */\r\n function StackPanel(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._isVertical = true;\r\n _this._manualWidth = false;\r\n _this._manualHeight = false;\r\n _this._doNotTrackManualChanges = false;\r\n /**\r\n * Gets or sets a boolean indicating that layou warnings should be ignored\r\n */\r\n _this.ignoreLayoutWarnings = false;\r\n return _this;\r\n }\r\n Object.defineProperty(StackPanel.prototype, \"isVertical\", {\r\n /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/\r\n get: function () {\r\n return this._isVertical;\r\n },\r\n set: function (value) {\r\n if (this._isVertical === value) {\r\n return;\r\n }\r\n this._isVertical = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StackPanel.prototype, \"width\", {\r\n get: function () {\r\n return this._width.toString(this._host);\r\n },\r\n /**\r\n * Gets or sets panel width.\r\n * This value should not be set when in horizontal mode as it will be computed automatically\r\n */\r\n set: function (value) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualWidth = true;\r\n }\r\n if (this._width.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._width.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StackPanel.prototype, \"height\", {\r\n get: function () {\r\n return this._height.toString(this._host);\r\n },\r\n /**\r\n * Gets or sets panel height.\r\n * This value should not be set when in vertical mode as it will be computed automatically\r\n */\r\n set: function (value) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualHeight = true;\r\n }\r\n if (this._height.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._height.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n StackPanel.prototype._getTypeName = function () {\r\n return \"StackPanel\";\r\n };\r\n /** @hidden */\r\n StackPanel.prototype._preMeasure = function (parentMeasure, context) {\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (this._isVertical) {\r\n child.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n }\r\n else {\r\n child.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n }\r\n }\r\n _super.prototype._preMeasure.call(this, parentMeasure, context);\r\n };\r\n StackPanel.prototype._additionalProcessing = function (parentMeasure, context) {\r\n _super.prototype._additionalProcessing.call(this, parentMeasure, context);\r\n this._measureForChildren.copyFrom(parentMeasure);\r\n this._measureForChildren.left = this._currentMeasure.left;\r\n this._measureForChildren.top = this._currentMeasure.top;\r\n if (!this.isVertical || this._manualWidth) {\r\n this._measureForChildren.width = this._currentMeasure.width;\r\n }\r\n if (this.isVertical || this._manualHeight) {\r\n this._measureForChildren.height = this._currentMeasure.height;\r\n }\r\n };\r\n StackPanel.prototype._postMeasure = function () {\r\n var stackWidth = 0;\r\n var stackHeight = 0;\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (!child.isVisible || child.notRenderable) {\r\n continue;\r\n }\r\n if (this._isVertical) {\r\n if (child.top !== stackHeight + \"px\") {\r\n child.top = stackHeight + \"px\";\r\n this._rebuildLayout = true;\r\n child._top.ignoreAdaptiveScaling = true;\r\n }\r\n if (child._height.isPercentage && !child._automaticSize) {\r\n if (!this.ignoreLayoutWarnings) {\r\n Tools.Warn(\"Control (Name:\" + child.name + \", UniqueId:\" + child.uniqueId + \") is using height in percentage mode inside a vertical StackPanel\");\r\n }\r\n }\r\n else {\r\n stackHeight += child._currentMeasure.height + child.paddingTopInPixels + child.paddingBottomInPixels;\r\n }\r\n }\r\n else {\r\n if (child.left !== stackWidth + \"px\") {\r\n child.left = stackWidth + \"px\";\r\n this._rebuildLayout = true;\r\n child._left.ignoreAdaptiveScaling = true;\r\n }\r\n if (child._width.isPercentage && !child._automaticSize) {\r\n if (!this.ignoreLayoutWarnings) {\r\n Tools.Warn(\"Control (Name:\" + child.name + \", UniqueId:\" + child.uniqueId + \") is using width in percentage mode inside a horizontal StackPanel\");\r\n }\r\n }\r\n else {\r\n stackWidth += child._currentMeasure.width + child.paddingLeftInPixels + child.paddingRightInPixels;\r\n }\r\n }\r\n }\r\n stackWidth += this.paddingLeftInPixels + this.paddingRightInPixels;\r\n stackHeight += this.paddingTopInPixels + this.paddingBottomInPixels;\r\n this._doNotTrackManualChanges = true;\r\n // Let stack panel width or height default to stackHeight and stackWidth if dimensions are not specified.\r\n // User can now define their own height and width for stack panel.\r\n var panelWidthChanged = false;\r\n var panelHeightChanged = false;\r\n if (!this._manualHeight && this._isVertical) { // do not specify height if strictly defined by user\r\n var previousHeight = this.height;\r\n this.height = stackHeight + \"px\";\r\n panelHeightChanged = previousHeight !== this.height || !this._height.ignoreAdaptiveScaling;\r\n }\r\n if (!this._manualWidth && !this._isVertical) { // do not specify width if strictly defined by user\r\n var previousWidth = this.width;\r\n this.width = stackWidth + \"px\";\r\n panelWidthChanged = previousWidth !== this.width || !this._width.ignoreAdaptiveScaling;\r\n }\r\n if (panelHeightChanged) {\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n if (panelWidthChanged) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n }\r\n this._doNotTrackManualChanges = false;\r\n if (panelWidthChanged || panelHeightChanged) {\r\n this._rebuildLayout = true;\r\n }\r\n _super.prototype._postMeasure.call(this);\r\n };\r\n return StackPanel;\r\n}(Container));\r\nexport { StackPanel };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.StackPanel\"] = StackPanel;\r\n//# sourceMappingURL=stackPanel.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Control } from \"./control\";\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { TextBlock } from \"./textBlock\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to represent a 2D checkbox\r\n */\r\nvar Checkbox = /** @class */ (function (_super) {\r\n __extends(Checkbox, _super);\r\n /**\r\n * Creates a new CheckBox\r\n * @param name defines the control name\r\n */\r\n function Checkbox(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._isChecked = false;\r\n _this._background = \"black\";\r\n _this._checkSizeRatio = 0.8;\r\n _this._thickness = 1;\r\n /**\r\n * Observable raised when isChecked property changes\r\n */\r\n _this.onIsCheckedChangedObservable = new Observable();\r\n _this.isPointerBlocker = true;\r\n return _this;\r\n }\r\n Object.defineProperty(Checkbox.prototype, \"thickness\", {\r\n /** Gets or sets border thickness */\r\n get: function () {\r\n return this._thickness;\r\n },\r\n set: function (value) {\r\n if (this._thickness === value) {\r\n return;\r\n }\r\n this._thickness = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Checkbox.prototype, \"checkSizeRatio\", {\r\n /** Gets or sets a value indicating the ratio between overall size and check size */\r\n get: function () {\r\n return this._checkSizeRatio;\r\n },\r\n set: function (value) {\r\n value = Math.max(Math.min(1, value), 0);\r\n if (this._checkSizeRatio === value) {\r\n return;\r\n }\r\n this._checkSizeRatio = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Checkbox.prototype, \"background\", {\r\n /** Gets or sets background color */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Checkbox.prototype, \"isChecked\", {\r\n /** Gets or sets a boolean indicating if the checkbox is checked or not */\r\n get: function () {\r\n return this._isChecked;\r\n },\r\n set: function (value) {\r\n if (this._isChecked === value) {\r\n return;\r\n }\r\n this._isChecked = value;\r\n this._markAsDirty();\r\n this.onIsCheckedChangedObservable.notifyObservers(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Checkbox.prototype._getTypeName = function () {\r\n return \"Checkbox\";\r\n };\r\n /** @hidden */\r\n Checkbox.prototype._draw = function (context, invalidatedRectangle) {\r\n context.save();\r\n this._applyStates(context);\r\n var actualWidth = this._currentMeasure.width - this._thickness;\r\n var actualHeight = this._currentMeasure.height - this._thickness;\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n context.fillStyle = this._isEnabled ? this._background : this._disabledColor;\r\n context.fillRect(this._currentMeasure.left + this._thickness / 2, this._currentMeasure.top + this._thickness / 2, actualWidth, actualHeight);\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n if (this._isChecked) {\r\n context.fillStyle = this._isEnabled ? this.color : this._disabledColorItem;\r\n var offsetWidth = actualWidth * this._checkSizeRatio;\r\n var offseHeight = actualHeight * this._checkSizeRatio;\r\n context.fillRect(this._currentMeasure.left + this._thickness / 2 + (actualWidth - offsetWidth) / 2, this._currentMeasure.top + this._thickness / 2 + (actualHeight - offseHeight) / 2, offsetWidth, offseHeight);\r\n }\r\n context.strokeStyle = this.color;\r\n context.lineWidth = this._thickness;\r\n context.strokeRect(this._currentMeasure.left + this._thickness / 2, this._currentMeasure.top + this._thickness / 2, actualWidth, actualHeight);\r\n context.restore();\r\n };\r\n // Events\r\n /** @hidden */\r\n Checkbox.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n if (!_super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n this.isChecked = !this.isChecked;\r\n return true;\r\n };\r\n /**\r\n * Utility function to easily create a checkbox with a header\r\n * @param title defines the label to use for the header\r\n * @param onValueChanged defines the callback to call when value changes\r\n * @returns a StackPanel containing the checkbox and a textBlock\r\n */\r\n Checkbox.AddCheckBoxWithHeader = function (title, onValueChanged) {\r\n var panel = new StackPanel();\r\n panel.isVertical = false;\r\n panel.height = \"30px\";\r\n var checkbox = new Checkbox();\r\n checkbox.width = \"20px\";\r\n checkbox.height = \"20px\";\r\n checkbox.isChecked = true;\r\n checkbox.color = \"green\";\r\n checkbox.onIsCheckedChangedObservable.add(onValueChanged);\r\n panel.addControl(checkbox);\r\n var header = new TextBlock();\r\n header.text = title;\r\n header.width = \"180px\";\r\n header.paddingLeft = \"5px\";\r\n header.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n header.color = \"white\";\r\n panel.addControl(header);\r\n return panel;\r\n };\r\n return Checkbox;\r\n}(Control));\r\nexport { Checkbox };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Checkbox\"] = Checkbox;\r\n//# sourceMappingURL=checkbox.js.map","import { __spreadArrays } from \"tslib\";\r\n/** @hidden */\r\nvar TextWrapper = /** @class */ (function () {\r\n function TextWrapper() {\r\n }\r\n Object.defineProperty(TextWrapper.prototype, \"text\", {\r\n get: function () {\r\n return this._characters ? this._characters.join(\"\") : this._text;\r\n },\r\n set: function (txt) {\r\n this._text = txt;\r\n this._characters = Array.from && Array.from(txt);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextWrapper.prototype, \"length\", {\r\n get: function () {\r\n return this._characters ? this._characters.length : this._text.length;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n TextWrapper.prototype.removePart = function (idxStart, idxEnd, insertTxt) {\r\n var _a;\r\n this._text = this._text.slice(0, idxStart) + (insertTxt ? insertTxt : \"\") + this._text.slice(idxEnd);\r\n if (this._characters) {\r\n var newCharacters = insertTxt ? Array.from(insertTxt) : [];\r\n (_a = this._characters).splice.apply(_a, __spreadArrays([idxStart, idxEnd - idxStart], newCharacters));\r\n }\r\n };\r\n TextWrapper.prototype.charAt = function (idx) {\r\n return this._characters ? this._characters[idx] : this._text.charAt(idx);\r\n };\r\n TextWrapper.prototype.substr = function (from, length) {\r\n if (this._characters) {\r\n if (isNaN(from)) {\r\n from = 0;\r\n }\r\n else if (from >= 0) {\r\n from = Math.min(from, this._characters.length);\r\n }\r\n else {\r\n from = this._characters.length + Math.max(from, -this._characters.length);\r\n }\r\n if (length === undefined) {\r\n length = this._characters.length - from;\r\n }\r\n else if (isNaN(length)) {\r\n length = 0;\r\n }\r\n else if (length < 0) {\r\n length = 0;\r\n }\r\n var temp = [];\r\n while (--length >= 0) {\r\n temp[length] = this._characters[from + length];\r\n }\r\n return temp.join(\"\");\r\n }\r\n return this._text.substr(from, length);\r\n };\r\n TextWrapper.prototype.substring = function (from, to) {\r\n if (this._characters) {\r\n if (isNaN(from)) {\r\n from = 0;\r\n }\r\n else if (from > this._characters.length) {\r\n from = this._characters.length;\r\n }\r\n else if (from < 0) {\r\n from = 0;\r\n }\r\n if (to === undefined) {\r\n to = this._characters.length;\r\n }\r\n else if (isNaN(to)) {\r\n to = 0;\r\n }\r\n else if (to > this._characters.length) {\r\n to = this._characters.length;\r\n }\r\n else if (to < 0) {\r\n to = 0;\r\n }\r\n var temp = [];\r\n var idx = 0;\r\n while (from < to) {\r\n temp[idx++] = this._characters[from++];\r\n }\r\n return temp.join(\"\");\r\n }\r\n return this._text.substring(from, to);\r\n };\r\n TextWrapper.prototype.isWord = function (index) {\r\n var rWord = /\\w/g;\r\n return this._characters ? this._characters[index].search(rWord) !== -1 : this._text.search(rWord) !== -1;\r\n };\r\n return TextWrapper;\r\n}());\r\nexport { TextWrapper };\r\n//# sourceMappingURL=textWrapper.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { ClipboardEventTypes } from \"@babylonjs/core/Events/clipboardEvents\";\r\nimport { PointerEventTypes } from '@babylonjs/core/Events/pointerEvents';\r\nimport { Control } from \"./control\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\nimport { TextWrapper } from './textWrapper';\r\n/**\r\n * Class used to create input text control\r\n */\r\nvar InputText = /** @class */ (function (_super) {\r\n __extends(InputText, _super);\r\n /**\r\n * Creates a new InputText\r\n * @param name defines the control name\r\n * @param text defines the text of the control\r\n */\r\n function InputText(name, text) {\r\n if (text === void 0) { text = \"\"; }\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._placeholderText = \"\";\r\n _this._background = \"#222222\";\r\n _this._focusedBackground = \"#000000\";\r\n _this._focusedColor = \"white\";\r\n _this._placeholderColor = \"gray\";\r\n _this._thickness = 1;\r\n _this._margin = new ValueAndUnit(10, ValueAndUnit.UNITMODE_PIXEL);\r\n _this._autoStretchWidth = true;\r\n _this._maxWidth = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);\r\n _this._isFocused = false;\r\n _this._blinkIsEven = false;\r\n _this._cursorOffset = 0;\r\n _this._deadKey = false;\r\n _this._addKey = true;\r\n _this._currentKey = \"\";\r\n _this._isTextHighlightOn = false;\r\n _this._textHighlightColor = \"#d5e0ff\";\r\n _this._highligherOpacity = 0.4;\r\n _this._highlightedText = \"\";\r\n _this._startHighlightIndex = 0;\r\n _this._endHighlightIndex = 0;\r\n _this._cursorIndex = -1;\r\n _this._onFocusSelectAll = false;\r\n _this._isPointerDown = false;\r\n /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */\r\n _this.promptMessage = \"Please enter text:\";\r\n /** Force disable prompt on mobile device */\r\n _this.disableMobilePrompt = false;\r\n /** Observable raised when the text changes */\r\n _this.onTextChangedObservable = new Observable();\r\n /** Observable raised just before an entered character is to be added */\r\n _this.onBeforeKeyAddObservable = new Observable();\r\n /** Observable raised when the control gets the focus */\r\n _this.onFocusObservable = new Observable();\r\n /** Observable raised when the control loses the focus */\r\n _this.onBlurObservable = new Observable();\r\n /**Observable raised when the text is highlighted */\r\n _this.onTextHighlightObservable = new Observable();\r\n /**Observable raised when copy event is triggered */\r\n _this.onTextCopyObservable = new Observable();\r\n /** Observable raised when cut event is triggered */\r\n _this.onTextCutObservable = new Observable();\r\n /** Observable raised when paste event is triggered */\r\n _this.onTextPasteObservable = new Observable();\r\n /** Observable raised when a key event was processed */\r\n _this.onKeyboardEventProcessedObservable = new Observable();\r\n _this.text = text;\r\n _this.isPointerBlocker = true;\r\n return _this;\r\n }\r\n Object.defineProperty(InputText.prototype, \"maxWidth\", {\r\n /** Gets or sets the maximum width allowed by the control */\r\n get: function () {\r\n return this._maxWidth.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._maxWidth.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._maxWidth.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"maxWidthInPixels\", {\r\n /** Gets the maximum width allowed by the control in pixels */\r\n get: function () {\r\n return this._maxWidth.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"highligherOpacity\", {\r\n /** Gets or sets the text highlighter transparency; default: 0.4 */\r\n get: function () {\r\n return this._highligherOpacity;\r\n },\r\n set: function (value) {\r\n if (this._highligherOpacity === value) {\r\n return;\r\n }\r\n this._highligherOpacity = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"onFocusSelectAll\", {\r\n /** Gets or sets a boolean indicating whether to select complete text by default on input focus */\r\n get: function () {\r\n return this._onFocusSelectAll;\r\n },\r\n set: function (value) {\r\n if (this._onFocusSelectAll === value) {\r\n return;\r\n }\r\n this._onFocusSelectAll = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"textHighlightColor\", {\r\n /** Gets or sets the text hightlight color */\r\n get: function () {\r\n return this._textHighlightColor;\r\n },\r\n set: function (value) {\r\n if (this._textHighlightColor === value) {\r\n return;\r\n }\r\n this._textHighlightColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"margin\", {\r\n /** Gets or sets control margin */\r\n get: function () {\r\n return this._margin.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._margin.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._margin.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"marginInPixels\", {\r\n /** Gets control margin in pixels */\r\n get: function () {\r\n return this._margin.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"autoStretchWidth\", {\r\n /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */\r\n get: function () {\r\n return this._autoStretchWidth;\r\n },\r\n set: function (value) {\r\n if (this._autoStretchWidth === value) {\r\n return;\r\n }\r\n this._autoStretchWidth = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"thickness\", {\r\n /** Gets or sets border thickness */\r\n get: function () {\r\n return this._thickness;\r\n },\r\n set: function (value) {\r\n if (this._thickness === value) {\r\n return;\r\n }\r\n this._thickness = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"focusedBackground\", {\r\n /** Gets or sets the background color when focused */\r\n get: function () {\r\n return this._focusedBackground;\r\n },\r\n set: function (value) {\r\n if (this._focusedBackground === value) {\r\n return;\r\n }\r\n this._focusedBackground = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"focusedColor\", {\r\n /** Gets or sets the background color when focused */\r\n get: function () {\r\n return this._focusedColor;\r\n },\r\n set: function (value) {\r\n if (this._focusedColor === value) {\r\n return;\r\n }\r\n this._focusedColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"background\", {\r\n /** Gets or sets the background color */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"placeholderColor\", {\r\n /** Gets or sets the placeholder color */\r\n get: function () {\r\n return this._placeholderColor;\r\n },\r\n set: function (value) {\r\n if (this._placeholderColor === value) {\r\n return;\r\n }\r\n this._placeholderColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"placeholderText\", {\r\n /** Gets or sets the text displayed when the control is empty */\r\n get: function () {\r\n return this._placeholderText;\r\n },\r\n set: function (value) {\r\n if (this._placeholderText === value) {\r\n return;\r\n }\r\n this._placeholderText = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"deadKey\", {\r\n /** Gets or sets the dead key flag */\r\n get: function () {\r\n return this._deadKey;\r\n },\r\n set: function (flag) {\r\n this._deadKey = flag;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"highlightedText\", {\r\n /** Gets or sets the highlight text */\r\n get: function () {\r\n return this._highlightedText;\r\n },\r\n set: function (text) {\r\n if (this._highlightedText === text) {\r\n return;\r\n }\r\n this._highlightedText = text;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"addKey\", {\r\n /** Gets or sets if the current key should be added */\r\n get: function () {\r\n return this._addKey;\r\n },\r\n set: function (flag) {\r\n this._addKey = flag;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"currentKey\", {\r\n /** Gets or sets the value of the current key being entered */\r\n get: function () {\r\n return this._currentKey;\r\n },\r\n set: function (key) {\r\n this._currentKey = key;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"text\", {\r\n /** Gets or sets the text displayed in the control */\r\n get: function () {\r\n return this._textWrapper.text;\r\n },\r\n set: function (value) {\r\n var valueAsString = value.toString(); // Forcing convertion\r\n if (!this._textWrapper) {\r\n this._textWrapper = new TextWrapper();\r\n }\r\n if (this._textWrapper.text === valueAsString) {\r\n return;\r\n }\r\n this._textWrapper.text = valueAsString;\r\n this._textHasChanged();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n InputText.prototype._textHasChanged = function () {\r\n this._markAsDirty();\r\n this.onTextChangedObservable.notifyObservers(this);\r\n };\r\n Object.defineProperty(InputText.prototype, \"width\", {\r\n /** Gets or sets control width */\r\n get: function () {\r\n return this._width.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._width.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._width.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n this.autoStretchWidth = false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n InputText.prototype.onBlur = function () {\r\n this._isFocused = false;\r\n this._scrollLeft = null;\r\n this._cursorOffset = 0;\r\n clearTimeout(this._blinkTimeout);\r\n this._markAsDirty();\r\n this.onBlurObservable.notifyObservers(this);\r\n this._host.unRegisterClipboardEvents();\r\n if (this._onClipboardObserver) {\r\n this._host.onClipboardObservable.remove(this._onClipboardObserver);\r\n }\r\n var scene = this._host.getScene();\r\n if (this._onPointerDblTapObserver && scene) {\r\n scene.onPointerObservable.remove(this._onPointerDblTapObserver);\r\n }\r\n };\r\n /** @hidden */\r\n InputText.prototype.onFocus = function () {\r\n var _this = this;\r\n if (!this._isEnabled) {\r\n return;\r\n }\r\n this._scrollLeft = null;\r\n this._isFocused = true;\r\n this._blinkIsEven = false;\r\n this._cursorOffset = 0;\r\n this._markAsDirty();\r\n this.onFocusObservable.notifyObservers(this);\r\n if (navigator.userAgent.indexOf(\"Mobile\") !== -1 && !this.disableMobilePrompt) {\r\n var value = prompt(this.promptMessage);\r\n if (value !== null) {\r\n this.text = value;\r\n }\r\n this._host.focusedControl = null;\r\n return;\r\n }\r\n this._host.registerClipboardEvents();\r\n this._onClipboardObserver = this._host.onClipboardObservable.add(function (clipboardInfo) {\r\n // process clipboard event, can be configured.\r\n switch (clipboardInfo.type) {\r\n case ClipboardEventTypes.COPY:\r\n _this._onCopyText(clipboardInfo.event);\r\n _this.onTextCopyObservable.notifyObservers(_this);\r\n break;\r\n case ClipboardEventTypes.CUT:\r\n _this._onCutText(clipboardInfo.event);\r\n _this.onTextCutObservable.notifyObservers(_this);\r\n break;\r\n case ClipboardEventTypes.PASTE:\r\n _this._onPasteText(clipboardInfo.event);\r\n _this.onTextPasteObservable.notifyObservers(_this);\r\n break;\r\n default: return;\r\n }\r\n });\r\n var scene = this._host.getScene();\r\n if (scene) {\r\n //register the pointer double tap event\r\n this._onPointerDblTapObserver = scene.onPointerObservable.add(function (pointerInfo) {\r\n if (!_this._isFocused) {\r\n return;\r\n }\r\n if (pointerInfo.type === PointerEventTypes.POINTERDOUBLETAP) {\r\n _this._processDblClick(pointerInfo);\r\n }\r\n });\r\n }\r\n if (this._onFocusSelectAll) {\r\n this._selectAllText();\r\n }\r\n };\r\n InputText.prototype._getTypeName = function () {\r\n return \"InputText\";\r\n };\r\n /**\r\n * Function called to get the list of controls that should not steal the focus from this control\r\n * @returns an array of controls\r\n */\r\n InputText.prototype.keepsFocusWith = function () {\r\n if (!this._connectedVirtualKeyboard) {\r\n return null;\r\n }\r\n return [this._connectedVirtualKeyboard];\r\n };\r\n /** @hidden */\r\n InputText.prototype.processKey = function (keyCode, key, evt) {\r\n //return if clipboard event keys (i.e -ctr/cmd + c,v,x)\r\n if (evt && (evt.ctrlKey || evt.metaKey) && (keyCode === 67 || keyCode === 86 || keyCode === 88)) {\r\n return;\r\n }\r\n //select all\r\n if (evt && (evt.ctrlKey || evt.metaKey) && keyCode === 65) {\r\n this._selectAllText();\r\n evt.preventDefault();\r\n return;\r\n }\r\n // Specific cases\r\n switch (keyCode) {\r\n case 32: //SPACE\r\n key = \" \"; //ie11 key for space is \"Spacebar\"\r\n break;\r\n case 191: //SLASH\r\n if (evt) {\r\n evt.preventDefault();\r\n }\r\n break;\r\n case 8: // BACKSPACE\r\n if (this._textWrapper.text && this._textWrapper.length > 0) {\r\n //delete the highlighted text\r\n if (this._isTextHighlightOn) {\r\n this._textWrapper.removePart(this._startHighlightIndex, this._endHighlightIndex);\r\n this._textHasChanged();\r\n this._isTextHighlightOn = false;\r\n this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;\r\n this._blinkIsEven = false;\r\n if (evt) {\r\n evt.preventDefault();\r\n }\r\n return;\r\n }\r\n //delete single character\r\n if (this._cursorOffset === 0) {\r\n this.text = this._textWrapper.substr(0, this._textWrapper.length - 1);\r\n }\r\n else {\r\n var deletePosition = this._textWrapper.length - this._cursorOffset;\r\n if (deletePosition > 0) {\r\n this._textWrapper.removePart(deletePosition - 1, deletePosition);\r\n this._textHasChanged();\r\n }\r\n }\r\n }\r\n if (evt) {\r\n evt.preventDefault();\r\n }\r\n return;\r\n case 46: // DELETE\r\n if (this._isTextHighlightOn) {\r\n this._textWrapper.removePart(this._startHighlightIndex, this._endHighlightIndex);\r\n this._textHasChanged();\r\n this._isTextHighlightOn = false;\r\n this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;\r\n if (evt) {\r\n evt.preventDefault();\r\n }\r\n return;\r\n }\r\n if (this._textWrapper.text && this._textWrapper.length > 0 && this._cursorOffset > 0) {\r\n var deletePosition = this._textWrapper.length - this._cursorOffset;\r\n this._textWrapper.removePart(deletePosition, deletePosition + 1);\r\n this._textHasChanged();\r\n this._cursorOffset--;\r\n }\r\n if (evt) {\r\n evt.preventDefault();\r\n }\r\n return;\r\n case 13: // RETURN\r\n this._host.focusedControl = null;\r\n this._isTextHighlightOn = false;\r\n return;\r\n case 35: // END\r\n this._cursorOffset = 0;\r\n this._blinkIsEven = false;\r\n this._isTextHighlightOn = false;\r\n this._markAsDirty();\r\n return;\r\n case 36: // HOME\r\n this._cursorOffset = this._textWrapper.length;\r\n this._blinkIsEven = false;\r\n this._isTextHighlightOn = false;\r\n this._markAsDirty();\r\n return;\r\n case 37: // LEFT\r\n this._cursorOffset++;\r\n if (this._cursorOffset > this._textWrapper.length) {\r\n this._cursorOffset = this._textWrapper.length;\r\n }\r\n if (evt && evt.shiftKey) {\r\n // update the cursor\r\n this._blinkIsEven = false;\r\n // shift + ctrl/cmd + <-\r\n if (evt.ctrlKey || evt.metaKey) {\r\n if (!this._isTextHighlightOn) {\r\n if (this._textWrapper.length === this._cursorOffset) {\r\n return;\r\n }\r\n else {\r\n this._endHighlightIndex = this._textWrapper.length - this._cursorOffset + 1;\r\n }\r\n }\r\n this._startHighlightIndex = 0;\r\n this._cursorIndex = this._textWrapper.length - this._endHighlightIndex;\r\n this._cursorOffset = this._textWrapper.length;\r\n this._isTextHighlightOn = true;\r\n this._markAsDirty();\r\n return;\r\n }\r\n //store the starting point\r\n if (!this._isTextHighlightOn) {\r\n this._isTextHighlightOn = true;\r\n this._cursorIndex = (this._cursorOffset >= this._textWrapper.length) ? this._textWrapper.length : this._cursorOffset - 1;\r\n }\r\n //if text is already highlighted\r\n else if (this._cursorIndex === -1) {\r\n this._cursorIndex = this._textWrapper.length - this._endHighlightIndex;\r\n this._cursorOffset = (this._startHighlightIndex === 0) ? this._textWrapper.length : this._textWrapper.length - this._startHighlightIndex + 1;\r\n }\r\n //set the highlight indexes\r\n if (this._cursorIndex < this._cursorOffset) {\r\n this._endHighlightIndex = this._textWrapper.length - this._cursorIndex;\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorOffset;\r\n }\r\n else if (this._cursorIndex > this._cursorOffset) {\r\n this._endHighlightIndex = this._textWrapper.length - this._cursorOffset;\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorIndex;\r\n }\r\n else {\r\n this._isTextHighlightOn = false;\r\n }\r\n this._markAsDirty();\r\n return;\r\n }\r\n if (this._isTextHighlightOn) {\r\n this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;\r\n this._isTextHighlightOn = false;\r\n }\r\n if (evt && (evt.ctrlKey || evt.metaKey)) {\r\n this._cursorOffset = this._textWrapper.length;\r\n evt.preventDefault();\r\n }\r\n this._blinkIsEven = false;\r\n this._isTextHighlightOn = false;\r\n this._cursorIndex = -1;\r\n this._markAsDirty();\r\n return;\r\n case 39: // RIGHT\r\n this._cursorOffset--;\r\n if (this._cursorOffset < 0) {\r\n this._cursorOffset = 0;\r\n }\r\n if (evt && evt.shiftKey) {\r\n //update the cursor\r\n this._blinkIsEven = false;\r\n //shift + ctrl/cmd + ->\r\n if (evt.ctrlKey || evt.metaKey) {\r\n if (!this._isTextHighlightOn) {\r\n if (this._cursorOffset === 0) {\r\n return;\r\n }\r\n else {\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorOffset - 1;\r\n }\r\n }\r\n this._endHighlightIndex = this._textWrapper.length;\r\n this._isTextHighlightOn = true;\r\n this._cursorIndex = this._textWrapper.length - this._startHighlightIndex;\r\n this._cursorOffset = 0;\r\n this._markAsDirty();\r\n return;\r\n }\r\n if (!this._isTextHighlightOn) {\r\n this._isTextHighlightOn = true;\r\n this._cursorIndex = (this._cursorOffset <= 0) ? 0 : this._cursorOffset + 1;\r\n }\r\n //if text is already highlighted\r\n else if (this._cursorIndex === -1) {\r\n this._cursorIndex = this._textWrapper.length - this._startHighlightIndex;\r\n this._cursorOffset = (this._textWrapper.length === this._endHighlightIndex) ? 0 : this._textWrapper.length - this._endHighlightIndex - 1;\r\n }\r\n //set the highlight indexes\r\n if (this._cursorIndex < this._cursorOffset) {\r\n this._endHighlightIndex = this._textWrapper.length - this._cursorIndex;\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorOffset;\r\n }\r\n else if (this._cursorIndex > this._cursorOffset) {\r\n this._endHighlightIndex = this._textWrapper.length - this._cursorOffset;\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorIndex;\r\n }\r\n else {\r\n this._isTextHighlightOn = false;\r\n }\r\n this._markAsDirty();\r\n return;\r\n }\r\n if (this._isTextHighlightOn) {\r\n this._cursorOffset = this._textWrapper.length - this._endHighlightIndex;\r\n this._isTextHighlightOn = false;\r\n }\r\n //ctr + ->\r\n if (evt && (evt.ctrlKey || evt.metaKey)) {\r\n this._cursorOffset = 0;\r\n evt.preventDefault();\r\n }\r\n this._blinkIsEven = false;\r\n this._isTextHighlightOn = false;\r\n this._cursorIndex = -1;\r\n this._markAsDirty();\r\n return;\r\n case 222: // Dead\r\n if (evt) {\r\n evt.preventDefault();\r\n }\r\n this._cursorIndex = -1;\r\n this.deadKey = true;\r\n break;\r\n }\r\n // Printable characters\r\n if (key &&\r\n ((keyCode === -1) || // Direct access\r\n (keyCode === 32) || // Space\r\n (keyCode > 47 && keyCode < 64) || // Numbers\r\n (keyCode > 64 && keyCode < 91) || // Letters\r\n (keyCode > 159 && keyCode < 193) || // Special characters\r\n (keyCode > 218 && keyCode < 223) || // Special characters\r\n (keyCode > 95 && keyCode < 112))) { // Numpad\r\n this._currentKey = key;\r\n this.onBeforeKeyAddObservable.notifyObservers(this);\r\n key = this._currentKey;\r\n if (this._addKey) {\r\n if (this._isTextHighlightOn) {\r\n this._textWrapper.removePart(this._startHighlightIndex, this._endHighlightIndex, key);\r\n this._textHasChanged();\r\n this._cursorOffset = this._textWrapper.length - (this._startHighlightIndex + 1);\r\n this._isTextHighlightOn = false;\r\n this._blinkIsEven = false;\r\n this._markAsDirty();\r\n }\r\n else if (this._cursorOffset === 0) {\r\n this.text += key;\r\n }\r\n else {\r\n var insertPosition = this._textWrapper.length - this._cursorOffset;\r\n this._textWrapper.removePart(insertPosition, insertPosition, key);\r\n this._textHasChanged();\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n InputText.prototype._updateValueFromCursorIndex = function (offset) {\r\n //update the cursor\r\n this._blinkIsEven = false;\r\n if (this._cursorIndex === -1) {\r\n this._cursorIndex = offset;\r\n }\r\n else {\r\n if (this._cursorIndex < this._cursorOffset) {\r\n this._endHighlightIndex = this._textWrapper.length - this._cursorIndex;\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorOffset;\r\n }\r\n else if (this._cursorIndex > this._cursorOffset) {\r\n this._endHighlightIndex = this._textWrapper.length - this._cursorOffset;\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorIndex;\r\n }\r\n else {\r\n this._isTextHighlightOn = false;\r\n this._markAsDirty();\r\n return;\r\n }\r\n }\r\n this._isTextHighlightOn = true;\r\n this._markAsDirty();\r\n };\r\n /** @hidden */\r\n InputText.prototype._processDblClick = function (evt) {\r\n //pre-find the start and end index of the word under cursor, speeds up the rendering\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorOffset;\r\n this._endHighlightIndex = this._startHighlightIndex;\r\n var moveLeft, moveRight;\r\n do {\r\n moveRight = this._endHighlightIndex < this._textWrapper.length && this._textWrapper.isWord(this._endHighlightIndex) ? ++this._endHighlightIndex : 0;\r\n moveLeft = this._startHighlightIndex > 0 && this._textWrapper.isWord(this._startHighlightIndex - 1) ? --this._startHighlightIndex : 0;\r\n } while (moveLeft || moveRight);\r\n this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;\r\n this.onTextHighlightObservable.notifyObservers(this);\r\n this._isTextHighlightOn = true;\r\n this._clickedCoordinate = null;\r\n this._blinkIsEven = true;\r\n this._cursorIndex = -1;\r\n this._markAsDirty();\r\n };\r\n /** @hidden */\r\n InputText.prototype._selectAllText = function () {\r\n this._blinkIsEven = true;\r\n this._isTextHighlightOn = true;\r\n this._startHighlightIndex = 0;\r\n this._endHighlightIndex = this._textWrapper.length;\r\n this._cursorOffset = this._textWrapper.length;\r\n this._cursorIndex = -1;\r\n this._markAsDirty();\r\n };\r\n /**\r\n * Handles the keyboard event\r\n * @param evt Defines the KeyboardEvent\r\n */\r\n InputText.prototype.processKeyboard = function (evt) {\r\n // process pressed key\r\n this.processKey(evt.keyCode, evt.key, evt);\r\n this.onKeyboardEventProcessedObservable.notifyObservers(evt);\r\n };\r\n /** @hidden */\r\n InputText.prototype._onCopyText = function (ev) {\r\n this._isTextHighlightOn = false;\r\n //when write permission to clipbaord data is denied\r\n try {\r\n ev.clipboardData && ev.clipboardData.setData(\"text/plain\", this._highlightedText);\r\n }\r\n catch (_a) { } //pass\r\n this._host.clipboardData = this._highlightedText;\r\n };\r\n /** @hidden */\r\n InputText.prototype._onCutText = function (ev) {\r\n if (!this._highlightedText) {\r\n return;\r\n }\r\n this._textWrapper.removePart(this._startHighlightIndex, this._endHighlightIndex);\r\n this._textHasChanged();\r\n this._isTextHighlightOn = false;\r\n this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;\r\n //when write permission to clipbaord data is denied\r\n try {\r\n ev.clipboardData && ev.clipboardData.setData(\"text/plain\", this._highlightedText);\r\n }\r\n catch (_a) { } //pass\r\n this._host.clipboardData = this._highlightedText;\r\n this._highlightedText = \"\";\r\n };\r\n /** @hidden */\r\n InputText.prototype._onPasteText = function (ev) {\r\n var data = \"\";\r\n if (ev.clipboardData && ev.clipboardData.types.indexOf(\"text/plain\") !== -1) {\r\n data = ev.clipboardData.getData(\"text/plain\");\r\n }\r\n else {\r\n //get the cached data; returns blank string by default\r\n data = this._host.clipboardData;\r\n }\r\n var insertPosition = this._textWrapper.length - this._cursorOffset;\r\n this._textWrapper.removePart(insertPosition, insertPosition, data);\r\n this._textHasChanged();\r\n };\r\n InputText.prototype._draw = function (context, invalidatedRectangle) {\r\n var _this = this;\r\n context.save();\r\n this._applyStates(context);\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n // Background\r\n if (this._isFocused) {\r\n if (this._focusedBackground) {\r\n context.fillStyle = this._isEnabled ? this._focusedBackground : this._disabledColor;\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n }\r\n else if (this._background) {\r\n context.fillStyle = this._isEnabled ? this._background : this._disabledColor;\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n if (!this._fontOffset) {\r\n this._fontOffset = Control._GetFontOffset(context.font);\r\n }\r\n // Text\r\n var clipTextLeft = this._currentMeasure.left + this._margin.getValueInPixel(this._host, this._tempParentMeasure.width);\r\n if (this.color) {\r\n context.fillStyle = this.color;\r\n }\r\n var text = this._beforeRenderText(this._textWrapper);\r\n if (!this._isFocused && !this._textWrapper.text && this._placeholderText) {\r\n text = new TextWrapper();\r\n text.text = this._placeholderText;\r\n if (this._placeholderColor) {\r\n context.fillStyle = this._placeholderColor;\r\n }\r\n }\r\n this._textWidth = context.measureText(text.text).width;\r\n var marginWidth = this._margin.getValueInPixel(this._host, this._tempParentMeasure.width) * 2;\r\n if (this._autoStretchWidth) {\r\n this.width = Math.min(this._maxWidth.getValueInPixel(this._host, this._tempParentMeasure.width), this._textWidth + marginWidth) + \"px\";\r\n }\r\n var rootY = this._fontOffset.ascent + (this._currentMeasure.height - this._fontOffset.height) / 2;\r\n var availableWidth = this._width.getValueInPixel(this._host, this._tempParentMeasure.width) - marginWidth;\r\n context.save();\r\n context.beginPath();\r\n context.rect(clipTextLeft, this._currentMeasure.top + (this._currentMeasure.height - this._fontOffset.height) / 2, availableWidth + 2, this._currentMeasure.height);\r\n context.clip();\r\n if (this._isFocused && this._textWidth > availableWidth) {\r\n var textLeft = clipTextLeft - this._textWidth + availableWidth;\r\n if (!this._scrollLeft) {\r\n this._scrollLeft = textLeft;\r\n }\r\n }\r\n else {\r\n this._scrollLeft = clipTextLeft;\r\n }\r\n context.fillText(text.text, this._scrollLeft, this._currentMeasure.top + rootY);\r\n // Cursor\r\n if (this._isFocused) {\r\n // Need to move cursor\r\n if (this._clickedCoordinate) {\r\n var rightPosition = this._scrollLeft + this._textWidth;\r\n var absoluteCursorPosition = rightPosition - this._clickedCoordinate;\r\n var currentSize = 0;\r\n this._cursorOffset = 0;\r\n var previousDist = 0;\r\n do {\r\n if (this._cursorOffset) {\r\n previousDist = Math.abs(absoluteCursorPosition - currentSize);\r\n }\r\n this._cursorOffset++;\r\n currentSize = context.measureText(text.substr(text.length - this._cursorOffset, this._cursorOffset)).width;\r\n } while (currentSize < absoluteCursorPosition && (text.length >= this._cursorOffset));\r\n // Find closest move\r\n if (Math.abs(absoluteCursorPosition - currentSize) > previousDist) {\r\n this._cursorOffset--;\r\n }\r\n this._blinkIsEven = false;\r\n this._clickedCoordinate = null;\r\n }\r\n // Render cursor\r\n if (!this._blinkIsEven) {\r\n var cursorOffsetText = text.substr(text.length - this._cursorOffset);\r\n var cursorOffsetWidth = context.measureText(cursorOffsetText).width;\r\n var cursorLeft = this._scrollLeft + this._textWidth - cursorOffsetWidth;\r\n if (cursorLeft < clipTextLeft) {\r\n this._scrollLeft += (clipTextLeft - cursorLeft);\r\n cursorLeft = clipTextLeft;\r\n this._markAsDirty();\r\n }\r\n else if (cursorLeft > clipTextLeft + availableWidth) {\r\n this._scrollLeft += (clipTextLeft + availableWidth - cursorLeft);\r\n cursorLeft = clipTextLeft + availableWidth;\r\n this._markAsDirty();\r\n }\r\n if (!this._isTextHighlightOn) {\r\n context.fillRect(cursorLeft, this._currentMeasure.top + (this._currentMeasure.height - this._fontOffset.height) / 2, 2, this._fontOffset.height);\r\n }\r\n }\r\n clearTimeout(this._blinkTimeout);\r\n this._blinkTimeout = setTimeout(function () {\r\n _this._blinkIsEven = !_this._blinkIsEven;\r\n _this._markAsDirty();\r\n }, 500);\r\n //show the highlighted text\r\n if (this._isTextHighlightOn) {\r\n clearTimeout(this._blinkTimeout);\r\n var highlightCursorOffsetWidth = context.measureText(text.substring(this._startHighlightIndex)).width;\r\n var highlightCursorLeft = this._scrollLeft + this._textWidth - highlightCursorOffsetWidth;\r\n this._highlightedText = text.substring(this._startHighlightIndex, this._endHighlightIndex);\r\n var width = context.measureText(text.substring(this._startHighlightIndex, this._endHighlightIndex)).width;\r\n if (highlightCursorLeft < clipTextLeft) {\r\n width = width - (clipTextLeft - highlightCursorLeft);\r\n if (!width) {\r\n // when using left arrow on text.length > availableWidth;\r\n // assigns the width of the first letter after clipTextLeft\r\n width = context.measureText(text.charAt(text.length - this._cursorOffset)).width;\r\n }\r\n highlightCursorLeft = clipTextLeft;\r\n }\r\n //for transparancy\r\n context.globalAlpha = this._highligherOpacity;\r\n context.fillStyle = this._textHighlightColor;\r\n context.fillRect(highlightCursorLeft, this._currentMeasure.top + (this._currentMeasure.height - this._fontOffset.height) / 2, width, this._fontOffset.height);\r\n context.globalAlpha = 1.0;\r\n }\r\n }\r\n context.restore();\r\n // Border\r\n if (this._thickness) {\r\n if (this._isFocused) {\r\n if (this.focusedColor) {\r\n context.strokeStyle = this.focusedColor;\r\n }\r\n }\r\n else {\r\n if (this.color) {\r\n context.strokeStyle = this.color;\r\n }\r\n }\r\n context.lineWidth = this._thickness;\r\n context.strokeRect(this._currentMeasure.left + this._thickness / 2, this._currentMeasure.top + this._thickness / 2, this._currentMeasure.width - this._thickness, this._currentMeasure.height - this._thickness);\r\n }\r\n context.restore();\r\n };\r\n InputText.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n if (!_super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n this._clickedCoordinate = coordinates.x;\r\n this._isTextHighlightOn = false;\r\n this._highlightedText = \"\";\r\n this._cursorIndex = -1;\r\n this._isPointerDown = true;\r\n this._host._capturingControl[pointerId] = this;\r\n if (this._host.focusedControl === this) {\r\n // Move cursor\r\n clearTimeout(this._blinkTimeout);\r\n this._markAsDirty();\r\n return true;\r\n }\r\n if (!this._isEnabled) {\r\n return false;\r\n }\r\n this._host.focusedControl = this;\r\n return true;\r\n };\r\n InputText.prototype._onPointerMove = function (target, coordinates, pointerId, pi) {\r\n if (this._host.focusedControl === this && this._isPointerDown) {\r\n this._clickedCoordinate = coordinates.x;\r\n this._markAsDirty();\r\n this._updateValueFromCursorIndex(this._cursorOffset);\r\n }\r\n _super.prototype._onPointerMove.call(this, target, coordinates, pointerId, pi);\r\n };\r\n InputText.prototype._onPointerUp = function (target, coordinates, pointerId, buttonIndex, notifyClick) {\r\n this._isPointerDown = false;\r\n delete this._host._capturingControl[pointerId];\r\n _super.prototype._onPointerUp.call(this, target, coordinates, pointerId, buttonIndex, notifyClick);\r\n };\r\n InputText.prototype._beforeRenderText = function (textWrapper) {\r\n return textWrapper;\r\n };\r\n InputText.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onBlurObservable.clear();\r\n this.onFocusObservable.clear();\r\n this.onTextChangedObservable.clear();\r\n this.onTextCopyObservable.clear();\r\n this.onTextCutObservable.clear();\r\n this.onTextPasteObservable.clear();\r\n this.onTextHighlightObservable.clear();\r\n this.onKeyboardEventProcessedObservable.clear();\r\n };\r\n return InputText;\r\n}(Control));\r\nexport { InputText };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.InputText\"] = InputText;\r\n//# sourceMappingURL=inputText.js.map","import { __extends } from \"tslib\";\r\nimport { Container } from \"./container\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { Control } from \"./control\";\r\nimport { Tools } from '@babylonjs/core/Misc/tools';\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create a 2D grid container\r\n */\r\nvar Grid = /** @class */ (function (_super) {\r\n __extends(Grid, _super);\r\n /**\r\n * Creates a new Grid\r\n * @param name defines control name\r\n */\r\n function Grid(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._rowDefinitions = new Array();\r\n _this._columnDefinitions = new Array();\r\n _this._cells = {};\r\n _this._childControls = new Array();\r\n return _this;\r\n }\r\n Object.defineProperty(Grid.prototype, \"columnCount\", {\r\n /**\r\n * Gets the number of columns\r\n */\r\n get: function () {\r\n return this._columnDefinitions.length;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Grid.prototype, \"rowCount\", {\r\n /**\r\n * Gets the number of rows\r\n */\r\n get: function () {\r\n return this._rowDefinitions.length;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Grid.prototype, \"children\", {\r\n /** Gets the list of children */\r\n get: function () {\r\n return this._childControls;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Grid.prototype, \"cells\", {\r\n /** Gets the list of cells (e.g. the containers) */\r\n get: function () {\r\n return this._cells;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the definition of a specific row\r\n * @param index defines the index of the row\r\n * @returns the row definition\r\n */\r\n Grid.prototype.getRowDefinition = function (index) {\r\n if (index < 0 || index >= this._rowDefinitions.length) {\r\n return null;\r\n }\r\n return this._rowDefinitions[index];\r\n };\r\n /**\r\n * Gets the definition of a specific column\r\n * @param index defines the index of the column\r\n * @returns the column definition\r\n */\r\n Grid.prototype.getColumnDefinition = function (index) {\r\n if (index < 0 || index >= this._columnDefinitions.length) {\r\n return null;\r\n }\r\n return this._columnDefinitions[index];\r\n };\r\n /**\r\n * Adds a new row to the grid\r\n * @param height defines the height of the row (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the height is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n Grid.prototype.addRowDefinition = function (height, isPixel) {\r\n if (isPixel === void 0) { isPixel = false; }\r\n this._rowDefinitions.push(new ValueAndUnit(height, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE));\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Adds a new column to the grid\r\n * @param width defines the width of the column (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the width is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n Grid.prototype.addColumnDefinition = function (width, isPixel) {\r\n if (isPixel === void 0) { isPixel = false; }\r\n this._columnDefinitions.push(new ValueAndUnit(width, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE));\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Update a row definition\r\n * @param index defines the index of the row to update\r\n * @param height defines the height of the row (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the weight is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n Grid.prototype.setRowDefinition = function (index, height, isPixel) {\r\n if (isPixel === void 0) { isPixel = false; }\r\n if (index < 0 || index >= this._rowDefinitions.length) {\r\n return this;\r\n }\r\n var current = this._rowDefinitions[index];\r\n if (current && current.isPixel === isPixel && current.internalValue === height) {\r\n return this;\r\n }\r\n this._rowDefinitions[index] = new ValueAndUnit(height, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE);\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Update a column definition\r\n * @param index defines the index of the column to update\r\n * @param width defines the width of the column (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the width is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n Grid.prototype.setColumnDefinition = function (index, width, isPixel) {\r\n if (isPixel === void 0) { isPixel = false; }\r\n if (index < 0 || index >= this._columnDefinitions.length) {\r\n return this;\r\n }\r\n var current = this._columnDefinitions[index];\r\n if (current && current.isPixel === isPixel && current.internalValue === width) {\r\n return this;\r\n }\r\n this._columnDefinitions[index] = new ValueAndUnit(width, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE);\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Gets the list of children stored in a specific cell\r\n * @param row defines the row to check\r\n * @param column defines the column to check\r\n * @returns the list of controls\r\n */\r\n Grid.prototype.getChildrenAt = function (row, column) {\r\n var cell = this._cells[row + \":\" + column];\r\n if (!cell) {\r\n return null;\r\n }\r\n return cell.children;\r\n };\r\n /**\r\n * Gets a string representing the child cell info (row x column)\r\n * @param child defines the control to get info from\r\n * @returns a string containing the child cell info (row x column)\r\n */\r\n Grid.prototype.getChildCellInfo = function (child) {\r\n return child._tag;\r\n };\r\n Grid.prototype._removeCell = function (cell, key) {\r\n if (!cell) {\r\n return;\r\n }\r\n _super.prototype.removeControl.call(this, cell);\r\n for (var _i = 0, _a = cell.children; _i < _a.length; _i++) {\r\n var control = _a[_i];\r\n var childIndex = this._childControls.indexOf(control);\r\n if (childIndex !== -1) {\r\n this._childControls.splice(childIndex, 1);\r\n }\r\n }\r\n delete this._cells[key];\r\n };\r\n Grid.prototype._offsetCell = function (previousKey, key) {\r\n if (!this._cells[key]) {\r\n return;\r\n }\r\n this._cells[previousKey] = this._cells[key];\r\n for (var _i = 0, _a = this._cells[previousKey].children; _i < _a.length; _i++) {\r\n var control = _a[_i];\r\n control._tag = previousKey;\r\n }\r\n delete this._cells[key];\r\n };\r\n /**\r\n * Remove a column definition at specified index\r\n * @param index defines the index of the column to remove\r\n * @returns the current grid\r\n */\r\n Grid.prototype.removeColumnDefinition = function (index) {\r\n if (index < 0 || index >= this._columnDefinitions.length) {\r\n return this;\r\n }\r\n for (var x = 0; x < this._rowDefinitions.length; x++) {\r\n var key = x + \":\" + index;\r\n var cell = this._cells[key];\r\n this._removeCell(cell, key);\r\n }\r\n for (var x = 0; x < this._rowDefinitions.length; x++) {\r\n for (var y = index + 1; y < this._columnDefinitions.length; y++) {\r\n var previousKey = x + \":\" + (y - 1);\r\n var key = x + \":\" + y;\r\n this._offsetCell(previousKey, key);\r\n }\r\n }\r\n this._columnDefinitions.splice(index, 1);\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Remove a row definition at specified index\r\n * @param index defines the index of the row to remove\r\n * @returns the current grid\r\n */\r\n Grid.prototype.removeRowDefinition = function (index) {\r\n if (index < 0 || index >= this._rowDefinitions.length) {\r\n return this;\r\n }\r\n for (var y = 0; y < this._columnDefinitions.length; y++) {\r\n var key = index + \":\" + y;\r\n var cell = this._cells[key];\r\n this._removeCell(cell, key);\r\n }\r\n for (var y = 0; y < this._columnDefinitions.length; y++) {\r\n for (var x = index + 1; x < this._rowDefinitions.length; x++) {\r\n var previousKey = x - 1 + \":\" + y;\r\n var key = x + \":\" + y;\r\n this._offsetCell(previousKey, key);\r\n }\r\n }\r\n this._rowDefinitions.splice(index, 1);\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Adds a new control to the current grid\r\n * @param control defines the control to add\r\n * @param row defines the row where to add the control (0 by default)\r\n * @param column defines the column where to add the control (0 by default)\r\n * @returns the current grid\r\n */\r\n Grid.prototype.addControl = function (control, row, column) {\r\n if (row === void 0) { row = 0; }\r\n if (column === void 0) { column = 0; }\r\n if (this._rowDefinitions.length === 0) {\r\n // Add default row definition\r\n this.addRowDefinition(1, false);\r\n }\r\n if (this._columnDefinitions.length === 0) {\r\n // Add default column definition\r\n this.addColumnDefinition(1, false);\r\n }\r\n if (this._childControls.indexOf(control) !== -1) {\r\n Tools.Warn(\"Control (Name:\" + control.name + \", UniqueId:\" + control.uniqueId + \") is already associated with this grid. You must remove it before reattaching it\");\r\n return this;\r\n }\r\n var x = Math.min(row, this._rowDefinitions.length - 1);\r\n var y = Math.min(column, this._columnDefinitions.length - 1);\r\n var key = x + \":\" + y;\r\n var goodContainer = this._cells[key];\r\n if (!goodContainer) {\r\n goodContainer = new Container(key);\r\n this._cells[key] = goodContainer;\r\n goodContainer.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n goodContainer.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n _super.prototype.addControl.call(this, goodContainer);\r\n }\r\n goodContainer.addControl(control);\r\n this._childControls.push(control);\r\n control._tag = key;\r\n control.parent = this;\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Removes a control from the current container\r\n * @param control defines the control to remove\r\n * @returns the current container\r\n */\r\n Grid.prototype.removeControl = function (control) {\r\n var index = this._childControls.indexOf(control);\r\n if (index !== -1) {\r\n this._childControls.splice(index, 1);\r\n }\r\n var cell = this._cells[control._tag];\r\n if (cell) {\r\n cell.removeControl(control);\r\n control._tag = null;\r\n }\r\n this._markAsDirty();\r\n return this;\r\n };\r\n Grid.prototype._getTypeName = function () {\r\n return \"Grid\";\r\n };\r\n Grid.prototype._getGridDefinitions = function (definitionCallback) {\r\n var widths = [];\r\n var heights = [];\r\n var lefts = [];\r\n var tops = [];\r\n var availableWidth = this._currentMeasure.width;\r\n var globalWidthPercentage = 0;\r\n var availableHeight = this._currentMeasure.height;\r\n var globalHeightPercentage = 0;\r\n // Heights\r\n var index = 0;\r\n for (var _i = 0, _a = this._rowDefinitions; _i < _a.length; _i++) {\r\n var value = _a[_i];\r\n if (value.isPixel) {\r\n var height = value.getValue(this._host);\r\n availableHeight -= height;\r\n heights[index] = height;\r\n }\r\n else {\r\n globalHeightPercentage += value.internalValue;\r\n }\r\n index++;\r\n }\r\n var top = 0;\r\n index = 0;\r\n for (var _b = 0, _c = this._rowDefinitions; _b < _c.length; _b++) {\r\n var value = _c[_b];\r\n tops.push(top);\r\n if (!value.isPixel) {\r\n var height = (value.internalValue / globalHeightPercentage) * availableHeight;\r\n top += height;\r\n heights[index] = height;\r\n }\r\n else {\r\n top += value.getValue(this._host);\r\n }\r\n index++;\r\n }\r\n // Widths\r\n index = 0;\r\n for (var _d = 0, _e = this._columnDefinitions; _d < _e.length; _d++) {\r\n var value = _e[_d];\r\n if (value.isPixel) {\r\n var width = value.getValue(this._host);\r\n availableWidth -= width;\r\n widths[index] = width;\r\n }\r\n else {\r\n globalWidthPercentage += value.internalValue;\r\n }\r\n index++;\r\n }\r\n var left = 0;\r\n index = 0;\r\n for (var _f = 0, _g = this._columnDefinitions; _f < _g.length; _f++) {\r\n var value = _g[_f];\r\n lefts.push(left);\r\n if (!value.isPixel) {\r\n var width = (value.internalValue / globalWidthPercentage) * availableWidth;\r\n left += width;\r\n widths[index] = width;\r\n }\r\n else {\r\n left += value.getValue(this._host);\r\n }\r\n index++;\r\n }\r\n definitionCallback(lefts, tops, widths, heights);\r\n };\r\n Grid.prototype._additionalProcessing = function (parentMeasure, context) {\r\n var _this = this;\r\n this._getGridDefinitions(function (lefts, tops, widths, heights) {\r\n // Setting child sizes\r\n for (var key in _this._cells) {\r\n if (!_this._cells.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n var split = key.split(\":\");\r\n var x = parseInt(split[0]);\r\n var y = parseInt(split[1]);\r\n var cell = _this._cells[key];\r\n cell.left = lefts[y] + \"px\";\r\n cell.top = tops[x] + \"px\";\r\n cell.width = widths[y] + \"px\";\r\n cell.height = heights[x] + \"px\";\r\n cell._left.ignoreAdaptiveScaling = true;\r\n cell._top.ignoreAdaptiveScaling = true;\r\n cell._width.ignoreAdaptiveScaling = true;\r\n cell._height.ignoreAdaptiveScaling = true;\r\n }\r\n });\r\n _super.prototype._additionalProcessing.call(this, parentMeasure, context);\r\n };\r\n Grid.prototype._flagDescendantsAsMatrixDirty = function () {\r\n for (var key in this._cells) {\r\n if (!this._cells.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n var child = this._cells[key];\r\n child._markMatrixAsDirty();\r\n }\r\n };\r\n Grid.prototype._renderHighlightSpecific = function (context) {\r\n var _this = this;\r\n _super.prototype._renderHighlightSpecific.call(this, context);\r\n this._getGridDefinitions(function (lefts, tops, widths, heights) {\r\n // Columns\r\n for (var index = 0; index < lefts.length; index++) {\r\n var left = _this._currentMeasure.left + lefts[index] + widths[index];\r\n context.beginPath();\r\n context.moveTo(left, _this._currentMeasure.top);\r\n context.lineTo(left, _this._currentMeasure.top + _this._currentMeasure.height);\r\n context.stroke();\r\n }\r\n // Rows\r\n for (var index = 0; index < tops.length; index++) {\r\n var top_1 = _this._currentMeasure.top + tops[index] + heights[index];\r\n context.beginPath();\r\n context.moveTo(_this._currentMeasure.left, top_1);\r\n context.lineTo(_this._currentMeasure.left + _this._currentMeasure.width, top_1);\r\n context.stroke();\r\n }\r\n });\r\n context.restore();\r\n };\r\n /** Releases associated resources */\r\n Grid.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n for (var _i = 0, _a = this._childControls; _i < _a.length; _i++) {\r\n var control = _a[_i];\r\n control.dispose();\r\n }\r\n this._childControls = [];\r\n };\r\n return Grid;\r\n}(Container));\r\nexport { Grid };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Grid\"] = Grid;\r\n//# sourceMappingURL=grid.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Control } from \"./control\";\r\nimport { InputText } from \"./inputText\";\r\nimport { Rectangle } from \"./rectangle\";\r\nimport { Button } from \"./button\";\r\nimport { Grid } from \"./grid\";\r\nimport { TextBlock } from \"../controls/textBlock\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\n/** Class used to create color pickers */\r\nvar ColorPicker = /** @class */ (function (_super) {\r\n __extends(ColorPicker, _super);\r\n /**\r\n * Creates a new ColorPicker\r\n * @param name defines the control name\r\n */\r\n function ColorPicker(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._value = Color3.Red();\r\n _this._tmpColor = new Color3();\r\n _this._pointerStartedOnSquare = false;\r\n _this._pointerStartedOnWheel = false;\r\n _this._squareLeft = 0;\r\n _this._squareTop = 0;\r\n _this._squareSize = 0;\r\n _this._h = 360;\r\n _this._s = 1;\r\n _this._v = 1;\r\n _this._lastPointerDownID = -1;\r\n /**\r\n * Observable raised when the value changes\r\n */\r\n _this.onValueChangedObservable = new Observable();\r\n // Events\r\n _this._pointerIsDown = false;\r\n _this.value = new Color3(.88, .1, .1);\r\n _this.size = \"200px\";\r\n _this.isPointerBlocker = true;\r\n return _this;\r\n }\r\n Object.defineProperty(ColorPicker.prototype, \"value\", {\r\n /** Gets or sets the color of the color picker */\r\n get: function () {\r\n return this._value;\r\n },\r\n set: function (value) {\r\n if (this._value.equals(value)) {\r\n return;\r\n }\r\n this._value.copyFrom(value);\r\n this._value.toHSVToRef(this._tmpColor);\r\n this._h = this._tmpColor.r;\r\n this._s = Math.max(this._tmpColor.g, 0.00001);\r\n this._v = Math.max(this._tmpColor.b, 0.00001);\r\n this._markAsDirty();\r\n if (this._value.r <= ColorPicker._Epsilon) {\r\n this._value.r = 0;\r\n }\r\n if (this._value.g <= ColorPicker._Epsilon) {\r\n this._value.g = 0;\r\n }\r\n if (this._value.b <= ColorPicker._Epsilon) {\r\n this._value.b = 0;\r\n }\r\n if (this._value.r >= 1.0 - ColorPicker._Epsilon) {\r\n this._value.r = 1.0;\r\n }\r\n if (this._value.g >= 1.0 - ColorPicker._Epsilon) {\r\n this._value.g = 1.0;\r\n }\r\n if (this._value.b >= 1.0 - ColorPicker._Epsilon) {\r\n this._value.b = 1.0;\r\n }\r\n this.onValueChangedObservable.notifyObservers(this._value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorPicker.prototype, \"width\", {\r\n /**\r\n * Gets or sets control width\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._width.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._width.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._width.fromString(value)) {\r\n this._height.fromString(value);\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorPicker.prototype, \"height\", {\r\n /**\r\n * Gets or sets control height\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._height.toString(this._host);\r\n },\r\n /** Gets or sets control height */\r\n set: function (value) {\r\n if (this._height.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._height.fromString(value)) {\r\n this._width.fromString(value);\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorPicker.prototype, \"size\", {\r\n /** Gets or sets control size */\r\n get: function () {\r\n return this.width;\r\n },\r\n set: function (value) {\r\n this.width = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ColorPicker.prototype._getTypeName = function () {\r\n return \"ColorPicker\";\r\n };\r\n /** @hidden */\r\n ColorPicker.prototype._preMeasure = function (parentMeasure, context) {\r\n if (parentMeasure.width < parentMeasure.height) {\r\n this._currentMeasure.height = parentMeasure.width;\r\n }\r\n else {\r\n this._currentMeasure.width = parentMeasure.height;\r\n }\r\n };\r\n ColorPicker.prototype._updateSquareProps = function () {\r\n var radius = Math.min(this._currentMeasure.width, this._currentMeasure.height) * .5;\r\n var wheelThickness = radius * .2;\r\n var innerDiameter = (radius - wheelThickness) * 2;\r\n var squareSize = innerDiameter / (Math.sqrt(2));\r\n var offset = radius - squareSize * .5;\r\n this._squareLeft = this._currentMeasure.left + offset;\r\n this._squareTop = this._currentMeasure.top + offset;\r\n this._squareSize = squareSize;\r\n };\r\n ColorPicker.prototype._drawGradientSquare = function (hueValue, left, top, width, height, context) {\r\n var lgh = context.createLinearGradient(left, top, width + left, top);\r\n lgh.addColorStop(0, '#fff');\r\n lgh.addColorStop(1, 'hsl(' + hueValue + ', 100%, 50%)');\r\n context.fillStyle = lgh;\r\n context.fillRect(left, top, width, height);\r\n var lgv = context.createLinearGradient(left, top, left, height + top);\r\n lgv.addColorStop(0, 'rgba(0,0,0,0)');\r\n lgv.addColorStop(1, '#000');\r\n context.fillStyle = lgv;\r\n context.fillRect(left, top, width, height);\r\n };\r\n ColorPicker.prototype._drawCircle = function (centerX, centerY, radius, context) {\r\n context.beginPath();\r\n context.arc(centerX, centerY, radius + 1, 0, 2 * Math.PI, false);\r\n context.lineWidth = 3;\r\n context.strokeStyle = '#333333';\r\n context.stroke();\r\n context.beginPath();\r\n context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);\r\n context.lineWidth = 3;\r\n context.strokeStyle = '#ffffff';\r\n context.stroke();\r\n };\r\n ColorPicker.prototype._createColorWheelCanvas = function (radius, thickness) {\r\n var canvas = document.createElement(\"canvas\");\r\n canvas.width = radius * 2;\r\n canvas.height = radius * 2;\r\n var context = canvas.getContext(\"2d\");\r\n var image = context.getImageData(0, 0, radius * 2, radius * 2);\r\n var data = image.data;\r\n var color = this._tmpColor;\r\n var maxDistSq = radius * radius;\r\n var innerRadius = radius - thickness;\r\n var minDistSq = innerRadius * innerRadius;\r\n for (var x = -radius; x < radius; x++) {\r\n for (var y = -radius; y < radius; y++) {\r\n var distSq = x * x + y * y;\r\n if (distSq > maxDistSq || distSq < minDistSq) {\r\n continue;\r\n }\r\n var dist = Math.sqrt(distSq);\r\n var ang = Math.atan2(y, x);\r\n Color3.HSVtoRGBToRef(ang * 180 / Math.PI + 180, dist / radius, 1, color);\r\n var index = ((x + radius) + ((y + radius) * 2 * radius)) * 4;\r\n data[index] = color.r * 255;\r\n data[index + 1] = color.g * 255;\r\n data[index + 2] = color.b * 255;\r\n var alphaRatio = (dist - innerRadius) / (radius - innerRadius);\r\n //apply less alpha to bigger color pickers\r\n var alphaAmount = .2;\r\n var maxAlpha = .2;\r\n var minAlpha = .04;\r\n var lowerRadius = 50;\r\n var upperRadius = 150;\r\n if (radius < lowerRadius) {\r\n alphaAmount = maxAlpha;\r\n }\r\n else if (radius > upperRadius) {\r\n alphaAmount = minAlpha;\r\n }\r\n else {\r\n alphaAmount = (minAlpha - maxAlpha) * (radius - lowerRadius) / (upperRadius - lowerRadius) + maxAlpha;\r\n }\r\n var alphaRatio = (dist - innerRadius) / (radius - innerRadius);\r\n if (alphaRatio < alphaAmount) {\r\n data[index + 3] = 255 * (alphaRatio / alphaAmount);\r\n }\r\n else if (alphaRatio > 1 - alphaAmount) {\r\n data[index + 3] = 255 * (1.0 - ((alphaRatio - (1 - alphaAmount)) / alphaAmount));\r\n }\r\n else {\r\n data[index + 3] = 255;\r\n }\r\n }\r\n }\r\n context.putImageData(image, 0, 0);\r\n return canvas;\r\n };\r\n /** @hidden */\r\n ColorPicker.prototype._draw = function (context) {\r\n context.save();\r\n this._applyStates(context);\r\n var radius = Math.min(this._currentMeasure.width, this._currentMeasure.height) * .5;\r\n var wheelThickness = radius * .2;\r\n var left = this._currentMeasure.left;\r\n var top = this._currentMeasure.top;\r\n if (!this._colorWheelCanvas || this._colorWheelCanvas.width != radius * 2) {\r\n this._colorWheelCanvas = this._createColorWheelCanvas(radius, wheelThickness);\r\n }\r\n this._updateSquareProps();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n context.fillRect(this._squareLeft, this._squareTop, this._squareSize, this._squareSize);\r\n }\r\n context.drawImage(this._colorWheelCanvas, left, top);\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n this._drawGradientSquare(this._h, this._squareLeft, this._squareTop, this._squareSize, this._squareSize, context);\r\n var cx = this._squareLeft + this._squareSize * this._s;\r\n var cy = this._squareTop + this._squareSize * (1 - this._v);\r\n this._drawCircle(cx, cy, radius * .04, context);\r\n var dist = radius - wheelThickness * .5;\r\n cx = left + radius + Math.cos((this._h - 180) * Math.PI / 180) * dist;\r\n cy = top + radius + Math.sin((this._h - 180) * Math.PI / 180) * dist;\r\n this._drawCircle(cx, cy, wheelThickness * .35, context);\r\n context.restore();\r\n };\r\n ColorPicker.prototype._updateValueFromPointer = function (x, y) {\r\n if (this._pointerStartedOnWheel) {\r\n var radius = Math.min(this._currentMeasure.width, this._currentMeasure.height) * .5;\r\n var centerX = radius + this._currentMeasure.left;\r\n var centerY = radius + this._currentMeasure.top;\r\n this._h = Math.atan2(y - centerY, x - centerX) * 180 / Math.PI + 180;\r\n }\r\n else if (this._pointerStartedOnSquare) {\r\n this._updateSquareProps();\r\n this._s = (x - this._squareLeft) / this._squareSize;\r\n this._v = 1 - (y - this._squareTop) / this._squareSize;\r\n this._s = Math.min(this._s, 1);\r\n this._s = Math.max(this._s, ColorPicker._Epsilon);\r\n this._v = Math.min(this._v, 1);\r\n this._v = Math.max(this._v, ColorPicker._Epsilon);\r\n }\r\n Color3.HSVtoRGBToRef(this._h, this._s, this._v, this._tmpColor);\r\n this.value = this._tmpColor;\r\n };\r\n ColorPicker.prototype._isPointOnSquare = function (x, y) {\r\n this._updateSquareProps();\r\n var left = this._squareLeft;\r\n var top = this._squareTop;\r\n var size = this._squareSize;\r\n if (x >= left && x <= left + size &&\r\n y >= top && y <= top + size) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n ColorPicker.prototype._isPointOnWheel = function (x, y) {\r\n var radius = Math.min(this._currentMeasure.width, this._currentMeasure.height) * .5;\r\n var centerX = radius + this._currentMeasure.left;\r\n var centerY = radius + this._currentMeasure.top;\r\n var wheelThickness = radius * .2;\r\n var innerRadius = radius - wheelThickness;\r\n var radiusSq = radius * radius;\r\n var innerRadiusSq = innerRadius * innerRadius;\r\n var dx = x - centerX;\r\n var dy = y - centerY;\r\n var distSq = dx * dx + dy * dy;\r\n if (distSq <= radiusSq && distSq >= innerRadiusSq) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n ColorPicker.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n if (!_super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n this._pointerIsDown = true;\r\n this._pointerStartedOnSquare = false;\r\n this._pointerStartedOnWheel = false;\r\n // Invert transform\r\n this._invertTransformMatrix.transformCoordinates(coordinates.x, coordinates.y, this._transformedPosition);\r\n var x = this._transformedPosition.x;\r\n var y = this._transformedPosition.y;\r\n if (this._isPointOnSquare(x, y)) {\r\n this._pointerStartedOnSquare = true;\r\n }\r\n else if (this._isPointOnWheel(x, y)) {\r\n this._pointerStartedOnWheel = true;\r\n }\r\n this._updateValueFromPointer(x, y);\r\n this._host._capturingControl[pointerId] = this;\r\n this._lastPointerDownID = pointerId;\r\n return true;\r\n };\r\n ColorPicker.prototype._onPointerMove = function (target, coordinates, pointerId, pi) {\r\n // Only listen to pointer move events coming from the last pointer to click on the element (To support dual vr controller interaction)\r\n if (pointerId != this._lastPointerDownID) {\r\n return;\r\n }\r\n // Invert transform\r\n this._invertTransformMatrix.transformCoordinates(coordinates.x, coordinates.y, this._transformedPosition);\r\n var x = this._transformedPosition.x;\r\n var y = this._transformedPosition.y;\r\n if (this._pointerIsDown) {\r\n this._updateValueFromPointer(x, y);\r\n }\r\n _super.prototype._onPointerMove.call(this, target, coordinates, pointerId, pi);\r\n };\r\n ColorPicker.prototype._onPointerUp = function (target, coordinates, pointerId, buttonIndex, notifyClick, pi) {\r\n this._pointerIsDown = false;\r\n delete this._host._capturingControl[pointerId];\r\n _super.prototype._onPointerUp.call(this, target, coordinates, pointerId, buttonIndex, notifyClick, pi);\r\n };\r\n ColorPicker.prototype._onCanvasBlur = function () {\r\n this._forcePointerUp();\r\n _super.prototype._onCanvasBlur.call(this);\r\n };\r\n /**\r\n * This function expands the color picker by creating a color picker dialog with manual\r\n * color value input and the ability to save colors into an array to be used later in\r\n * subsequent launches of the dialogue.\r\n * @param advancedTexture defines the AdvancedDynamicTexture the dialog is assigned to\r\n * @param options defines size for dialog and options for saved colors. Also accepts last color picked as hex string and saved colors array as hex strings.\r\n * @returns picked color as a hex string and the saved colors array as hex strings.\r\n */\r\n ColorPicker.ShowPickerDialogAsync = function (advancedTexture, options) {\r\n return new Promise(function (resolve, reject) {\r\n // Default options\r\n options.pickerWidth = options.pickerWidth || \"640px\";\r\n options.pickerHeight = options.pickerHeight || \"400px\";\r\n options.headerHeight = options.headerHeight || \"35px\";\r\n options.lastColor = options.lastColor || \"#000000\";\r\n options.swatchLimit = options.swatchLimit || 20;\r\n options.numSwatchesPerLine = options.numSwatchesPerLine || 10;\r\n // Window size settings\r\n var drawerMaxRows = options.swatchLimit / options.numSwatchesPerLine;\r\n var rawSwatchSize = parseFloat(options.pickerWidth) / options.numSwatchesPerLine;\r\n var gutterSize = Math.floor(rawSwatchSize * 0.25);\r\n var colGutters = gutterSize * (options.numSwatchesPerLine + 1);\r\n var swatchSize = Math.floor((parseFloat(options.pickerWidth) - colGutters) / options.numSwatchesPerLine);\r\n var drawerMaxSize = (swatchSize * drawerMaxRows) + (gutterSize * (drawerMaxRows + 1));\r\n var containerSize = (parseInt(options.pickerHeight) + drawerMaxSize + Math.floor(swatchSize * 0.25)).toString() + \"px\";\r\n // Button Colors\r\n var buttonColor = \"#c0c0c0\";\r\n var buttonBackgroundColor = \"#535353\";\r\n var buttonBackgroundHoverColor = \"#414141\";\r\n var buttonBackgroundClickColor = \"515151\";\r\n var buttonDisabledColor = \"#555555\";\r\n var buttonDisabledBackgroundColor = \"#454545\";\r\n var currentSwatchesOutlineColor = \"#404040\";\r\n var luminanceLimitColor = Color3.FromHexString(\"#dddddd\");\r\n var luminanceLimit = luminanceLimitColor.r + luminanceLimitColor.g + luminanceLimitColor.b;\r\n var iconColorDark = \"#aaaaaa\";\r\n var iconColorLight = \"#ffffff\";\r\n var closeIconColor;\r\n // Button settings\r\n var buttonFontSize;\r\n var butEdit;\r\n var buttonWidth;\r\n var buttonHeight;\r\n // Input Text Colors\r\n var inputFieldLabels = [\"R\", \"G\", \"B\"];\r\n var inputTextBackgroundColor = \"#454545\";\r\n var inputTextColor = \"#f0f0f0\";\r\n // This is the current color as set by either the picker or by entering a value\r\n var currentColor;\r\n // This int is used for naming swatches and serves as the index for calling them from the list\r\n var swatchNumber;\r\n // Menu Panel options. We need to know if the swatchDrawer exists so we can create it if needed.\r\n var swatchDrawer;\r\n var editSwatchMode = false;\r\n // Color InputText fields that will be updated upon value change\r\n var picker;\r\n var rValInt;\r\n var gValInt;\r\n var bValInt;\r\n var rValDec;\r\n var gValDec;\r\n var bValDec;\r\n var hexVal;\r\n var newSwatch;\r\n var lastVal;\r\n var activeField;\r\n /**\r\n * Will update all values for InputText and ColorPicker controls based on the BABYLON.Color3 passed to this function.\r\n * Each InputText control and the ColorPicker control will be tested to see if they are the activeField and if they\r\n * are will receive no update. This is to prevent the input from the user being overwritten.\r\n */\r\n function updateValues(value, inputField) {\r\n activeField = inputField;\r\n var pickedColor = value.toHexString();\r\n newSwatch.background = pickedColor;\r\n if (rValInt.name != activeField) {\r\n rValInt.text = Math.floor(value.r * 255).toString();\r\n }\r\n if (gValInt.name != activeField) {\r\n gValInt.text = Math.floor(value.g * 255).toString();\r\n }\r\n if (bValInt.name != activeField) {\r\n bValInt.text = Math.floor(value.b * 255).toString();\r\n }\r\n if (rValDec.name != activeField) {\r\n rValDec.text = value.r.toString();\r\n }\r\n if (gValDec.name != activeField) {\r\n gValDec.text = value.g.toString();\r\n }\r\n if (bValDec.name != activeField) {\r\n bValDec.text = value.b.toString();\r\n }\r\n if (hexVal.name != activeField) {\r\n var minusPound = pickedColor.split(\"#\");\r\n hexVal.text = minusPound[1];\r\n }\r\n if (picker.name != activeField) {\r\n picker.value = value;\r\n }\r\n }\r\n // When the user enters an integer for R, G, or B we check to make sure it is a valid number and replace if not.\r\n function updateInt(field, channel) {\r\n var newValue = field.text;\r\n var checkVal = /[^0-9]/g.test(newValue);\r\n if (checkVal) {\r\n field.text = lastVal;\r\n return;\r\n }\r\n else {\r\n if (newValue != \"\") {\r\n if (Math.floor(parseInt(newValue)) < 0) {\r\n newValue = \"0\";\r\n }\r\n else if (Math.floor(parseInt(newValue)) > 255) {\r\n newValue = \"255\";\r\n }\r\n else if (isNaN(parseInt(newValue))) {\r\n newValue = \"0\";\r\n }\r\n }\r\n if (activeField == field.name) {\r\n lastVal = newValue;\r\n }\r\n }\r\n if (newValue != \"\") {\r\n newValue = parseInt(newValue).toString();\r\n field.text = newValue;\r\n var newSwatchRGB = Color3.FromHexString(newSwatch.background);\r\n if (activeField == field.name) {\r\n if (channel == \"r\") {\r\n updateValues(new Color3((parseInt(newValue)) / 255, newSwatchRGB.g, newSwatchRGB.b), field.name);\r\n }\r\n else if (channel == \"g\") {\r\n updateValues(new Color3(newSwatchRGB.r, (parseInt(newValue)) / 255, newSwatchRGB.b), field.name);\r\n }\r\n else {\r\n updateValues(new Color3(newSwatchRGB.r, newSwatchRGB.g, (parseInt(newValue)) / 255), field.name);\r\n }\r\n }\r\n }\r\n }\r\n // When the user enters a float for R, G, or B we check to make sure it is a valid number and replace if not.\r\n function updateFloat(field, channel) {\r\n var newValue = field.text;\r\n var checkVal = /[^0-9\\.]/g.test(newValue);\r\n if (checkVal) {\r\n field.text = lastVal;\r\n return;\r\n }\r\n else {\r\n if (newValue != \"\" && newValue != \".\" && parseFloat(newValue) != 0) {\r\n if (parseFloat(newValue) < 0.0) {\r\n newValue = \"0.0\";\r\n }\r\n else if (parseFloat(newValue) > 1.0) {\r\n newValue = \"1.0\";\r\n }\r\n else if (isNaN(parseFloat(newValue))) {\r\n newValue = \"0.0\";\r\n }\r\n }\r\n if (activeField == field.name) {\r\n lastVal = newValue;\r\n }\r\n }\r\n if (newValue != \"\" && newValue != \".\" && parseFloat(newValue) != 0) {\r\n newValue = parseFloat(newValue).toString();\r\n field.text = newValue;\r\n }\r\n else {\r\n newValue = \"0.0\";\r\n }\r\n var newSwatchRGB = Color3.FromHexString(newSwatch.background);\r\n if (activeField == field.name) {\r\n if (channel == \"r\") {\r\n updateValues(new Color3(parseFloat(newValue), newSwatchRGB.g, newSwatchRGB.b), field.name);\r\n }\r\n else if (channel == \"g\") {\r\n updateValues(new Color3(newSwatchRGB.r, parseFloat(newValue), newSwatchRGB.b), field.name);\r\n }\r\n else {\r\n updateValues(new Color3(newSwatchRGB.r, newSwatchRGB.g, parseFloat(newValue)), field.name);\r\n }\r\n }\r\n }\r\n // Removes the current index from the savedColors array. Drawer can then be regenerated.\r\n function deleteSwatch(index) {\r\n if (options.savedColors) {\r\n options.savedColors.splice(index, 1);\r\n }\r\n if (options.savedColors && options.savedColors.length == 0) {\r\n setEditButtonVisibility(false);\r\n editSwatchMode = false;\r\n }\r\n }\r\n // Creates and styles an individual swatch when updateSwatches is called.\r\n function createSwatch() {\r\n if (options.savedColors && options.savedColors[swatchNumber]) {\r\n if (editSwatchMode) {\r\n var icon = \"b\";\r\n }\r\n else {\r\n var icon = \"\";\r\n }\r\n var swatch = Button.CreateSimpleButton(\"Swatch_\" + swatchNumber, icon);\r\n swatch.fontFamily = \"BabylonJSglyphs\";\r\n var swatchColor = Color3.FromHexString(options.savedColors[swatchNumber]);\r\n var swatchLuminence = swatchColor.r + swatchColor.g + swatchColor.b;\r\n // Set color of outline and textBlock based on luminance of the color swatch so feedback always visible\r\n if (swatchLuminence > luminanceLimit) {\r\n swatch.color = iconColorDark;\r\n }\r\n else {\r\n swatch.color = iconColorLight;\r\n }\r\n swatch.fontSize = Math.floor(swatchSize * 0.7);\r\n swatch.textBlock.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n swatch.height = swatch.width = (swatchSize).toString() + \"px\";\r\n swatch.background = options.savedColors[swatchNumber];\r\n swatch.thickness = 2;\r\n var metadata_1 = swatchNumber;\r\n swatch.pointerDownAnimation = function () {\r\n swatch.thickness = 4;\r\n };\r\n swatch.pointerUpAnimation = function () {\r\n swatch.thickness = 3;\r\n };\r\n swatch.pointerEnterAnimation = function () {\r\n swatch.thickness = 3;\r\n };\r\n swatch.pointerOutAnimation = function () {\r\n swatch.thickness = 2;\r\n };\r\n swatch.onPointerClickObservable.add(function () {\r\n if (!editSwatchMode) {\r\n if (options.savedColors) {\r\n updateValues(Color3.FromHexString(options.savedColors[metadata_1]), swatch.name);\r\n }\r\n }\r\n else {\r\n deleteSwatch(metadata_1);\r\n updateSwatches(\"\", butSave);\r\n }\r\n });\r\n return swatch;\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n // Mode switch to render button text and close symbols on swatch controls\r\n function editSwatches(mode) {\r\n if (mode !== undefined) {\r\n editSwatchMode = mode;\r\n }\r\n if (editSwatchMode) {\r\n for (var i = 0; i < swatchDrawer.children.length; i++) {\r\n var thisButton = swatchDrawer.children[i];\r\n thisButton.textBlock.text = \"b\";\r\n }\r\n if (butEdit !== undefined) {\r\n butEdit.textBlock.text = \"Done\";\r\n }\r\n }\r\n else {\r\n for (var i = 0; i < swatchDrawer.children.length; i++) {\r\n var thisButton = swatchDrawer.children[i];\r\n thisButton.textBlock.text = \"\";\r\n }\r\n if (butEdit !== undefined) {\r\n butEdit.textBlock.text = \"Edit\";\r\n }\r\n }\r\n }\r\n /**\r\n * When Save Color button is pressed this function will first create a swatch drawer if one is not already\r\n * made. Then all controls are removed from the drawer and we step through the savedColors array and\r\n * creates one swatch per color. It will also set the height of the drawer control based on how many\r\n * saved colors there are and how many can be stored per row.\r\n */\r\n function updateSwatches(color, button) {\r\n if (options.savedColors) {\r\n if (color != \"\") {\r\n options.savedColors.push(color);\r\n }\r\n swatchNumber = 0;\r\n swatchDrawer.clearControls();\r\n var rowCount = Math.ceil(options.savedColors.length / options.numSwatchesPerLine);\r\n if (rowCount == 0) {\r\n var gutterCount = 0;\r\n }\r\n else {\r\n var gutterCount = rowCount + 1;\r\n }\r\n if (swatchDrawer.rowCount != rowCount + gutterCount) {\r\n var currentRows = swatchDrawer.rowCount;\r\n for (var i = 0; i < currentRows; i++) {\r\n swatchDrawer.removeRowDefinition(0);\r\n }\r\n for (var i = 0; i < rowCount + gutterCount; i++) {\r\n if (i % 2) {\r\n swatchDrawer.addRowDefinition(swatchSize, true);\r\n }\r\n else {\r\n swatchDrawer.addRowDefinition(gutterSize, true);\r\n }\r\n }\r\n }\r\n swatchDrawer.height = ((swatchSize * rowCount) + (gutterCount * gutterSize)).toString() + \"px\";\r\n for (var y = 1, thisRow = 1; y < rowCount + gutterCount; y += 2, thisRow++) {\r\n // Determine number of buttons to create per row based on the button limit per row and number of saved colors\r\n if (options.savedColors.length > thisRow * options.numSwatchesPerLine) {\r\n var totalButtonsThisRow = options.numSwatchesPerLine;\r\n }\r\n else {\r\n var totalButtonsThisRow = options.savedColors.length - ((thisRow - 1) * options.numSwatchesPerLine);\r\n }\r\n var buttonIterations = (Math.min(Math.max(totalButtonsThisRow, 0), options.numSwatchesPerLine));\r\n for (var x = 0, w = 1; x < buttonIterations; x++) {\r\n if (x > options.numSwatchesPerLine) {\r\n continue;\r\n }\r\n var swatch = createSwatch();\r\n if (swatch != null) {\r\n swatchDrawer.addControl(swatch, y, w);\r\n w += 2;\r\n swatchNumber++;\r\n }\r\n else {\r\n continue;\r\n }\r\n }\r\n }\r\n if (options.savedColors.length >= options.swatchLimit) {\r\n disableButton(button, true);\r\n }\r\n else {\r\n disableButton(button, false);\r\n }\r\n }\r\n }\r\n // Shows or hides edit swatches button depending on if there are saved swatches\r\n function setEditButtonVisibility(enableButton) {\r\n if (enableButton) {\r\n butEdit = Button.CreateSimpleButton(\"butEdit\", \"Edit\");\r\n butEdit.width = buttonWidth;\r\n butEdit.height = buttonHeight;\r\n butEdit.left = (Math.floor(parseInt(buttonWidth) * 0.1)).toString() + \"px\";\r\n butEdit.top = (parseFloat(butEdit.left) * -1).toString() + \"px\";\r\n butEdit.verticalAlignment = Control.VERTICAL_ALIGNMENT_BOTTOM;\r\n butEdit.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n butEdit.thickness = 2;\r\n butEdit.color = buttonColor;\r\n butEdit.fontSize = buttonFontSize;\r\n butEdit.background = buttonBackgroundColor;\r\n butEdit.onPointerEnterObservable.add(function () {\r\n butEdit.background = buttonBackgroundHoverColor;\r\n });\r\n butEdit.onPointerOutObservable.add(function () {\r\n butEdit.background = buttonBackgroundColor;\r\n });\r\n butEdit.pointerDownAnimation = function () {\r\n butEdit.background = buttonBackgroundClickColor;\r\n };\r\n butEdit.pointerUpAnimation = function () {\r\n butEdit.background = buttonBackgroundHoverColor;\r\n };\r\n butEdit.onPointerClickObservable.add(function () {\r\n if (editSwatchMode) {\r\n editSwatchMode = false;\r\n }\r\n else {\r\n editSwatchMode = true;\r\n }\r\n editSwatches();\r\n });\r\n pickerGrid.addControl(butEdit, 1, 0);\r\n }\r\n else {\r\n pickerGrid.removeControl(butEdit);\r\n }\r\n }\r\n // Called when the user hits the limit of saved colors in the drawer.\r\n function disableButton(button, disabled) {\r\n if (disabled) {\r\n button.color = buttonDisabledColor;\r\n button.background = buttonDisabledBackgroundColor;\r\n }\r\n else {\r\n button.color = buttonColor;\r\n button.background = buttonBackgroundColor;\r\n }\r\n }\r\n // Passes last chosen color back to scene and kills dialog by removing from AdvancedDynamicTexture\r\n function closePicker(color) {\r\n if (options.savedColors && options.savedColors.length > 0) {\r\n resolve({\r\n savedColors: options.savedColors,\r\n pickedColor: color\r\n });\r\n }\r\n else {\r\n resolve({\r\n pickedColor: color\r\n });\r\n }\r\n advancedTexture.removeControl(dialogContainer);\r\n }\r\n // Dialogue menu container which will contain both the main dialogue window and the swatch drawer which opens once a color is saved.\r\n var dialogContainer = new Grid();\r\n dialogContainer.name = \"Dialog Container\";\r\n dialogContainer.width = options.pickerWidth;\r\n if (options.savedColors) {\r\n dialogContainer.height = containerSize;\r\n var topRow = parseInt(options.pickerHeight) / parseInt(containerSize);\r\n dialogContainer.addRowDefinition(topRow, false);\r\n dialogContainer.addRowDefinition(1.0 - topRow, false);\r\n }\r\n else {\r\n dialogContainer.height = options.pickerHeight;\r\n dialogContainer.addRowDefinition(1.0, false);\r\n }\r\n advancedTexture.addControl(dialogContainer);\r\n // Swatch drawer which contains all saved color buttons\r\n if (options.savedColors) {\r\n swatchDrawer = new Grid();\r\n swatchDrawer.name = \"Swatch Drawer\";\r\n swatchDrawer.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n swatchDrawer.background = buttonBackgroundColor;\r\n swatchDrawer.width = options.pickerWidth;\r\n var initialRows = options.savedColors.length / options.numSwatchesPerLine;\r\n if (initialRows == 0) {\r\n var gutterCount = 0;\r\n }\r\n else {\r\n var gutterCount = initialRows + 1;\r\n }\r\n swatchDrawer.height = ((swatchSize * initialRows) + (gutterCount * gutterSize)).toString() + \"px\";\r\n swatchDrawer.top = Math.floor(swatchSize * 0.25).toString() + \"px\";\r\n for (var i = 0; i < (Math.ceil(options.savedColors.length / options.numSwatchesPerLine) * 2) + 1; i++) {\r\n if (i % 2 != 0) {\r\n swatchDrawer.addRowDefinition(swatchSize, true);\r\n }\r\n else {\r\n swatchDrawer.addRowDefinition(gutterSize, true);\r\n }\r\n }\r\n for (var i = 0; i < options.numSwatchesPerLine * 2 + 1; i++) {\r\n if (i % 2 != 0) {\r\n swatchDrawer.addColumnDefinition(swatchSize, true);\r\n }\r\n else {\r\n swatchDrawer.addColumnDefinition(gutterSize, true);\r\n }\r\n }\r\n dialogContainer.addControl(swatchDrawer, 1, 0);\r\n }\r\n // Picker container\r\n var pickerPanel = new Grid();\r\n pickerPanel.name = \"Picker Panel\";\r\n pickerPanel.height = options.pickerHeight;\r\n var panelHead = parseInt(options.headerHeight) / parseInt(options.pickerHeight);\r\n var pickerPanelRows = [panelHead, 1.0 - panelHead];\r\n pickerPanel.addRowDefinition(pickerPanelRows[0], false);\r\n pickerPanel.addRowDefinition(pickerPanelRows[1], false);\r\n dialogContainer.addControl(pickerPanel, 0, 0);\r\n // Picker container header\r\n var header = new Rectangle();\r\n header.name = \"Dialogue Header Bar\";\r\n header.background = \"#cccccc\";\r\n header.thickness = 0;\r\n pickerPanel.addControl(header, 0, 0);\r\n // Header close button\r\n var closeButton = Button.CreateSimpleButton(\"closeButton\", \"a\");\r\n closeButton.fontFamily = \"BabylonJSglyphs\";\r\n var headerColor3 = Color3.FromHexString(header.background);\r\n closeIconColor = new Color3(1.0 - headerColor3.r, 1.0 - headerColor3.g, 1.0 - headerColor3.b);\r\n closeButton.color = closeIconColor.toHexString();\r\n closeButton.fontSize = Math.floor(parseInt(options.headerHeight) * 0.6);\r\n closeButton.textBlock.textVerticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n closeButton.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_RIGHT;\r\n closeButton.height = closeButton.width = options.headerHeight;\r\n closeButton.background = header.background;\r\n closeButton.thickness = 0;\r\n closeButton.pointerDownAnimation = function () {\r\n };\r\n closeButton.pointerUpAnimation = function () {\r\n closeButton.background = header.background;\r\n };\r\n closeButton.pointerEnterAnimation = function () {\r\n closeButton.color = header.background;\r\n closeButton.background = \"red\";\r\n };\r\n closeButton.pointerOutAnimation = function () {\r\n closeButton.color = closeIconColor.toHexString();\r\n closeButton.background = header.background;\r\n };\r\n closeButton.onPointerClickObservable.add(function () {\r\n closePicker(currentSwatch.background);\r\n });\r\n pickerPanel.addControl(closeButton, 0, 0);\r\n // Dialog container body\r\n var dialogBody = new Grid();\r\n dialogBody.name = \"Dialogue Body\";\r\n dialogBody.background = buttonBackgroundColor;\r\n var dialogBodyCols = [0.4375, 0.5625];\r\n dialogBody.addRowDefinition(1.0, false);\r\n dialogBody.addColumnDefinition(dialogBodyCols[0], false);\r\n dialogBody.addColumnDefinition(dialogBodyCols[1], false);\r\n pickerPanel.addControl(dialogBody, 1, 0);\r\n // Picker grid\r\n var pickerGrid = new Grid();\r\n pickerGrid.name = \"Picker Grid\";\r\n pickerGrid.addRowDefinition(0.85, false);\r\n pickerGrid.addRowDefinition(0.15, false);\r\n dialogBody.addControl(pickerGrid, 0, 0);\r\n // Picker control\r\n picker = new ColorPicker();\r\n picker.name = \"GUI Color Picker\";\r\n if (options.pickerHeight < options.pickerWidth) {\r\n picker.width = 0.89;\r\n }\r\n else {\r\n picker.height = 0.89;\r\n }\r\n picker.value = Color3.FromHexString(options.lastColor);\r\n picker.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n picker.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n picker.onPointerDownObservable.add(function () {\r\n activeField = picker.name;\r\n lastVal = \"\";\r\n editSwatches(false);\r\n });\r\n picker.onValueChangedObservable.add(function (value) {\r\n if (activeField == picker.name) {\r\n updateValues(value, picker.name);\r\n }\r\n });\r\n pickerGrid.addControl(picker, 0, 0);\r\n // Picker body right quarant\r\n var pickerBodyRight = new Grid();\r\n pickerBodyRight.name = \"Dialogue Right Half\";\r\n pickerBodyRight.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n var pickerBodyRightRows = [0.514, 0.486];\r\n pickerBodyRight.addRowDefinition(pickerBodyRightRows[0], false);\r\n pickerBodyRight.addRowDefinition(pickerBodyRightRows[1], false);\r\n dialogBody.addControl(pickerBodyRight, 1, 1);\r\n // Picker container swatches and buttons\r\n var pickerSwatchesButtons = new Grid();\r\n pickerSwatchesButtons.name = \"Swatches and Buttons\";\r\n var pickerButtonsCol = [0.417, 0.583];\r\n pickerSwatchesButtons.addRowDefinition(1.0, false);\r\n pickerSwatchesButtons.addColumnDefinition(pickerButtonsCol[0], false);\r\n pickerSwatchesButtons.addColumnDefinition(pickerButtonsCol[1], false);\r\n pickerBodyRight.addControl(pickerSwatchesButtons, 0, 0);\r\n // Picker Swatches quadrant\r\n var pickerSwatches = new Grid();\r\n pickerSwatches.name = \"New and Current Swatches\";\r\n var pickeSwatchesRows = [0.04, 0.16, 0.64, 0.16];\r\n pickerSwatches.addRowDefinition(pickeSwatchesRows[0], false);\r\n pickerSwatches.addRowDefinition(pickeSwatchesRows[1], false);\r\n pickerSwatches.addRowDefinition(pickeSwatchesRows[2], false);\r\n pickerSwatches.addRowDefinition(pickeSwatchesRows[3], false);\r\n pickerSwatchesButtons.addControl(pickerSwatches, 0, 0);\r\n // Active swatches\r\n var activeSwatches = new Grid();\r\n activeSwatches.name = \"Active Swatches\";\r\n activeSwatches.width = 0.67;\r\n activeSwatches.addRowDefinition(0.5, false);\r\n activeSwatches.addRowDefinition(0.5, false);\r\n pickerSwatches.addControl(activeSwatches, 2, 0);\r\n var labelWidth = (Math.floor(parseInt(options.pickerWidth) * dialogBodyCols[1] * pickerButtonsCol[0] * 0.11));\r\n var labelHeight = (Math.floor(parseInt(options.pickerHeight) * pickerPanelRows[1] * pickerBodyRightRows[0] * pickeSwatchesRows[1] * 0.5));\r\n if (options.pickerWidth > options.pickerHeight) {\r\n var labelTextSize = labelHeight;\r\n }\r\n else {\r\n var labelTextSize = labelWidth;\r\n }\r\n // New color swatch and previous color button\r\n var newText = new TextBlock();\r\n newText.text = \"new\";\r\n newText.name = \"New Color Label\";\r\n newText.color = buttonColor;\r\n newText.fontSize = labelTextSize;\r\n pickerSwatches.addControl(newText, 1, 0);\r\n newSwatch = new Rectangle();\r\n newSwatch.name = \"New Color Swatch\";\r\n newSwatch.background = options.lastColor;\r\n newSwatch.thickness = 0;\r\n activeSwatches.addControl(newSwatch, 0, 0);\r\n var currentSwatch = Button.CreateSimpleButton(\"currentSwatch\", \"\");\r\n currentSwatch.background = options.lastColor;\r\n currentSwatch.thickness = 0;\r\n currentSwatch.onPointerClickObservable.add(function () {\r\n var revertColor = Color3.FromHexString(currentSwatch.background);\r\n updateValues(revertColor, currentSwatch.name);\r\n editSwatches(false);\r\n });\r\n currentSwatch.pointerDownAnimation = function () { };\r\n currentSwatch.pointerUpAnimation = function () { };\r\n currentSwatch.pointerEnterAnimation = function () { };\r\n currentSwatch.pointerOutAnimation = function () { };\r\n activeSwatches.addControl(currentSwatch, 1, 0);\r\n var swatchOutline = new Rectangle();\r\n swatchOutline.name = \"Swatch Outline\";\r\n swatchOutline.width = 0.67;\r\n swatchOutline.thickness = 2;\r\n swatchOutline.color = currentSwatchesOutlineColor;\r\n swatchOutline.isHitTestVisible = false;\r\n pickerSwatches.addControl(swatchOutline, 2, 0);\r\n var currentText = new TextBlock();\r\n currentText.name = \"Current Color Label\";\r\n currentText.text = \"current\";\r\n currentText.color = buttonColor;\r\n currentText.fontSize = labelTextSize;\r\n pickerSwatches.addControl(currentText, 3, 0);\r\n // Buttons grid\r\n var buttonGrid = new Grid();\r\n buttonGrid.name = \"Button Grid\";\r\n buttonGrid.height = 0.8;\r\n var buttonGridRows = 1 / 3;\r\n buttonGrid.addRowDefinition(buttonGridRows, false);\r\n buttonGrid.addRowDefinition(buttonGridRows, false);\r\n buttonGrid.addRowDefinition(buttonGridRows, false);\r\n pickerSwatchesButtons.addControl(buttonGrid, 0, 1);\r\n // Determine pixel width and height for all buttons from overall panel dimensions\r\n buttonWidth = (Math.floor(parseInt(options.pickerWidth) * dialogBodyCols[1] * pickerButtonsCol[1] * 0.67)).toString() + \"px\";\r\n buttonHeight = (Math.floor(parseInt(options.pickerHeight) * pickerPanelRows[1] * pickerBodyRightRows[0] * (parseFloat(buttonGrid.height.toString()) / 100) * buttonGridRows * 0.7)).toString() + \"px\";\r\n // Determine button type size\r\n if (parseFloat(buttonWidth) > parseFloat(buttonHeight)) {\r\n buttonFontSize = Math.floor(parseFloat(buttonHeight) * 0.45);\r\n }\r\n else {\r\n buttonFontSize = Math.floor(parseFloat(buttonWidth) * 0.11);\r\n }\r\n // Panel Buttons\r\n var butOK = Button.CreateSimpleButton(\"butOK\", \"OK\");\r\n butOK.width = buttonWidth;\r\n butOK.height = buttonHeight;\r\n butOK.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n butOK.thickness = 2;\r\n butOK.color = buttonColor;\r\n butOK.fontSize = buttonFontSize;\r\n butOK.background = buttonBackgroundColor;\r\n butOK.onPointerEnterObservable.add(function () { butOK.background = buttonBackgroundHoverColor; });\r\n butOK.onPointerOutObservable.add(function () { butOK.background = buttonBackgroundColor; });\r\n butOK.pointerDownAnimation = function () {\r\n butOK.background = buttonBackgroundClickColor;\r\n };\r\n butOK.pointerUpAnimation = function () {\r\n butOK.background = buttonBackgroundHoverColor;\r\n };\r\n butOK.onPointerClickObservable.add(function () {\r\n editSwatches(false);\r\n closePicker(newSwatch.background);\r\n });\r\n buttonGrid.addControl(butOK, 0, 0);\r\n var butCancel = Button.CreateSimpleButton(\"butCancel\", \"Cancel\");\r\n butCancel.width = buttonWidth;\r\n butCancel.height = buttonHeight;\r\n butCancel.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n butCancel.thickness = 2;\r\n butCancel.color = buttonColor;\r\n butCancel.fontSize = buttonFontSize;\r\n butCancel.background = buttonBackgroundColor;\r\n butCancel.onPointerEnterObservable.add(function () { butCancel.background = buttonBackgroundHoverColor; });\r\n butCancel.onPointerOutObservable.add(function () { butCancel.background = buttonBackgroundColor; });\r\n butCancel.pointerDownAnimation = function () {\r\n butCancel.background = buttonBackgroundClickColor;\r\n };\r\n butCancel.pointerUpAnimation = function () {\r\n butCancel.background = buttonBackgroundHoverColor;\r\n };\r\n butCancel.onPointerClickObservable.add(function () {\r\n editSwatches(false);\r\n closePicker(currentSwatch.background);\r\n });\r\n buttonGrid.addControl(butCancel, 1, 0);\r\n if (options.savedColors) {\r\n var butSave = Button.CreateSimpleButton(\"butSave\", \"Save\");\r\n butSave.width = buttonWidth;\r\n butSave.height = buttonHeight;\r\n butSave.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n butSave.thickness = 2;\r\n butSave.fontSize = buttonFontSize;\r\n if (options.savedColors.length < options.swatchLimit) {\r\n butSave.color = buttonColor;\r\n butSave.background = buttonBackgroundColor;\r\n }\r\n else {\r\n disableButton(butSave, true);\r\n }\r\n butSave.onPointerEnterObservable.add(function () {\r\n if (options.savedColors) {\r\n if (options.savedColors.length < options.swatchLimit) {\r\n butSave.background = buttonBackgroundHoverColor;\r\n }\r\n }\r\n });\r\n butSave.onPointerOutObservable.add(function () {\r\n if (options.savedColors) {\r\n if (options.savedColors.length < options.swatchLimit) {\r\n butSave.background = buttonBackgroundColor;\r\n }\r\n }\r\n });\r\n butSave.pointerDownAnimation = function () {\r\n if (options.savedColors) {\r\n if (options.savedColors.length < options.swatchLimit) {\r\n butSave.background = buttonBackgroundClickColor;\r\n }\r\n }\r\n };\r\n butSave.pointerUpAnimation = function () {\r\n if (options.savedColors) {\r\n if (options.savedColors.length < options.swatchLimit) {\r\n butSave.background = buttonBackgroundHoverColor;\r\n }\r\n }\r\n };\r\n butSave.onPointerClickObservable.add(function () {\r\n if (options.savedColors) {\r\n if (options.savedColors.length == 0) {\r\n setEditButtonVisibility(true);\r\n }\r\n if (options.savedColors.length < options.swatchLimit) {\r\n updateSwatches(newSwatch.background, butSave);\r\n }\r\n editSwatches(false);\r\n }\r\n });\r\n if (options.savedColors.length > 0) {\r\n setEditButtonVisibility(true);\r\n }\r\n buttonGrid.addControl(butSave, 2, 0);\r\n }\r\n // Picker color values input\r\n var pickerColorValues = new Grid();\r\n pickerColorValues.name = \"Dialog Lower Right\";\r\n pickerColorValues.addRowDefinition(0.02, false);\r\n pickerColorValues.addRowDefinition(0.63, false);\r\n pickerColorValues.addRowDefinition(0.21, false);\r\n pickerColorValues.addRowDefinition(0.14, false);\r\n pickerBodyRight.addControl(pickerColorValues, 1, 0);\r\n // RGB values text boxes\r\n currentColor = Color3.FromHexString(options.lastColor);\r\n var rgbValuesQuadrant = new Grid();\r\n rgbValuesQuadrant.name = \"RGB Values\";\r\n rgbValuesQuadrant.width = 0.82;\r\n rgbValuesQuadrant.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n rgbValuesQuadrant.addRowDefinition(1 / 3, false);\r\n rgbValuesQuadrant.addRowDefinition(1 / 3, false);\r\n rgbValuesQuadrant.addRowDefinition(1 / 3, false);\r\n rgbValuesQuadrant.addColumnDefinition(0.1, false);\r\n rgbValuesQuadrant.addColumnDefinition(0.2, false);\r\n rgbValuesQuadrant.addColumnDefinition(0.7, false);\r\n pickerColorValues.addControl(rgbValuesQuadrant, 1, 0);\r\n for (var i = 0; i < inputFieldLabels.length; i++) {\r\n var labelText = new TextBlock();\r\n labelText.text = inputFieldLabels[i];\r\n labelText.color = buttonColor;\r\n labelText.fontSize = buttonFontSize;\r\n rgbValuesQuadrant.addControl(labelText, i, 0);\r\n }\r\n // Input fields for RGB values\r\n rValInt = new InputText();\r\n rValInt.width = 0.83;\r\n rValInt.height = 0.72;\r\n rValInt.name = \"rIntField\";\r\n rValInt.fontSize = buttonFontSize;\r\n rValInt.text = (currentColor.r * 255).toString();\r\n rValInt.color = inputTextColor;\r\n rValInt.background = inputTextBackgroundColor;\r\n rValInt.onFocusObservable.add(function () {\r\n activeField = rValInt.name;\r\n lastVal = rValInt.text;\r\n editSwatches(false);\r\n });\r\n rValInt.onBlurObservable.add(function () {\r\n if (rValInt.text == \"\") {\r\n rValInt.text = \"0\";\r\n }\r\n updateInt(rValInt, \"r\");\r\n if (activeField == rValInt.name) {\r\n activeField = \"\";\r\n }\r\n });\r\n rValInt.onTextChangedObservable.add(function () {\r\n if (activeField == rValInt.name) {\r\n updateInt(rValInt, \"r\");\r\n }\r\n });\r\n rgbValuesQuadrant.addControl(rValInt, 0, 1);\r\n gValInt = new InputText();\r\n gValInt.width = 0.83;\r\n gValInt.height = 0.72;\r\n gValInt.name = \"gIntField\";\r\n gValInt.fontSize = buttonFontSize;\r\n gValInt.text = (currentColor.g * 255).toString();\r\n gValInt.color = inputTextColor;\r\n gValInt.background = inputTextBackgroundColor;\r\n gValInt.onFocusObservable.add(function () {\r\n activeField = gValInt.name;\r\n lastVal = gValInt.text;\r\n editSwatches(false);\r\n });\r\n gValInt.onBlurObservable.add(function () {\r\n if (gValInt.text == \"\") {\r\n gValInt.text = \"0\";\r\n }\r\n updateInt(gValInt, \"g\");\r\n if (activeField == gValInt.name) {\r\n activeField = \"\";\r\n }\r\n });\r\n gValInt.onTextChangedObservable.add(function () {\r\n if (activeField == gValInt.name) {\r\n updateInt(gValInt, \"g\");\r\n }\r\n });\r\n rgbValuesQuadrant.addControl(gValInt, 1, 1);\r\n bValInt = new InputText();\r\n bValInt.width = 0.83;\r\n bValInt.height = 0.72;\r\n bValInt.name = \"bIntField\";\r\n bValInt.fontSize = buttonFontSize;\r\n bValInt.text = (currentColor.b * 255).toString();\r\n bValInt.color = inputTextColor;\r\n bValInt.background = inputTextBackgroundColor;\r\n bValInt.onFocusObservable.add(function () {\r\n activeField = bValInt.name;\r\n lastVal = bValInt.text;\r\n editSwatches(false);\r\n });\r\n bValInt.onBlurObservable.add(function () {\r\n if (bValInt.text == \"\") {\r\n bValInt.text = \"0\";\r\n }\r\n updateInt(bValInt, \"b\");\r\n if (activeField == bValInt.name) {\r\n activeField = \"\";\r\n }\r\n });\r\n bValInt.onTextChangedObservable.add(function () {\r\n if (activeField == bValInt.name) {\r\n updateInt(bValInt, \"b\");\r\n }\r\n });\r\n rgbValuesQuadrant.addControl(bValInt, 2, 1);\r\n rValDec = new InputText();\r\n rValDec.width = 0.95;\r\n rValDec.height = 0.72;\r\n rValDec.name = \"rDecField\";\r\n rValDec.fontSize = buttonFontSize;\r\n rValDec.text = currentColor.r.toString();\r\n rValDec.color = inputTextColor;\r\n rValDec.background = inputTextBackgroundColor;\r\n rValDec.onFocusObservable.add(function () {\r\n activeField = rValDec.name;\r\n lastVal = rValDec.text;\r\n editSwatches(false);\r\n });\r\n rValDec.onBlurObservable.add(function () {\r\n if (parseFloat(rValDec.text) == 0 || rValDec.text == \"\") {\r\n rValDec.text = \"0\";\r\n updateFloat(rValDec, \"r\");\r\n }\r\n if (activeField == rValDec.name) {\r\n activeField = \"\";\r\n }\r\n });\r\n rValDec.onTextChangedObservable.add(function () {\r\n if (activeField == rValDec.name) {\r\n updateFloat(rValDec, \"r\");\r\n }\r\n });\r\n rgbValuesQuadrant.addControl(rValDec, 0, 2);\r\n gValDec = new InputText();\r\n gValDec.width = 0.95;\r\n gValDec.height = 0.72;\r\n gValDec.name = \"gDecField\";\r\n gValDec.fontSize = buttonFontSize;\r\n gValDec.text = currentColor.g.toString();\r\n gValDec.color = inputTextColor;\r\n gValDec.background = inputTextBackgroundColor;\r\n gValDec.onFocusObservable.add(function () {\r\n activeField = gValDec.name;\r\n lastVal = gValDec.text;\r\n editSwatches(false);\r\n });\r\n gValDec.onBlurObservable.add(function () {\r\n if (parseFloat(gValDec.text) == 0 || gValDec.text == \"\") {\r\n gValDec.text = \"0\";\r\n updateFloat(gValDec, \"g\");\r\n }\r\n if (activeField == gValDec.name) {\r\n activeField = \"\";\r\n }\r\n });\r\n gValDec.onTextChangedObservable.add(function () {\r\n if (activeField == gValDec.name) {\r\n updateFloat(gValDec, \"g\");\r\n }\r\n });\r\n rgbValuesQuadrant.addControl(gValDec, 1, 2);\r\n bValDec = new InputText();\r\n bValDec.width = 0.95;\r\n bValDec.height = 0.72;\r\n bValDec.name = \"bDecField\";\r\n bValDec.fontSize = buttonFontSize;\r\n bValDec.text = currentColor.b.toString();\r\n bValDec.color = inputTextColor;\r\n bValDec.background = inputTextBackgroundColor;\r\n bValDec.onFocusObservable.add(function () {\r\n activeField = bValDec.name;\r\n lastVal = bValDec.text;\r\n editSwatches(false);\r\n });\r\n bValDec.onBlurObservable.add(function () {\r\n if (parseFloat(bValDec.text) == 0 || bValDec.text == \"\") {\r\n bValDec.text = \"0\";\r\n updateFloat(bValDec, \"b\");\r\n }\r\n if (activeField == bValDec.name) {\r\n activeField = \"\";\r\n }\r\n });\r\n bValDec.onTextChangedObservable.add(function () {\r\n if (activeField == bValDec.name) {\r\n updateFloat(bValDec, \"b\");\r\n }\r\n });\r\n rgbValuesQuadrant.addControl(bValDec, 2, 2);\r\n // Hex value input\r\n var hexValueQuadrant = new Grid();\r\n hexValueQuadrant.name = \"Hex Value\";\r\n hexValueQuadrant.width = 0.82;\r\n hexValueQuadrant.addRowDefinition(1.0, false);\r\n hexValueQuadrant.addColumnDefinition(0.1, false);\r\n hexValueQuadrant.addColumnDefinition(0.9, false);\r\n pickerColorValues.addControl(hexValueQuadrant, 2, 0);\r\n var labelText = new TextBlock();\r\n labelText.text = \"#\";\r\n labelText.color = buttonColor;\r\n labelText.fontSize = buttonFontSize;\r\n hexValueQuadrant.addControl(labelText, 0, 0);\r\n hexVal = new InputText();\r\n hexVal.width = 0.96;\r\n hexVal.height = 0.72;\r\n hexVal.name = \"hexField\";\r\n hexVal.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n hexVal.fontSize = buttonFontSize;\r\n var minusPound = options.lastColor.split(\"#\");\r\n hexVal.text = minusPound[1];\r\n hexVal.color = inputTextColor;\r\n hexVal.background = inputTextBackgroundColor;\r\n hexVal.onFocusObservable.add(function () {\r\n activeField = hexVal.name;\r\n lastVal = hexVal.text;\r\n editSwatches(false);\r\n });\r\n hexVal.onBlurObservable.add(function () {\r\n if (hexVal.text.length == 3) {\r\n var val = hexVal.text.split(\"\");\r\n hexVal.text = val[0] + val[0] + val[1] + val[1] + val[2] + val[2];\r\n }\r\n if (hexVal.text == \"\") {\r\n hexVal.text = \"000000\";\r\n updateValues(Color3.FromHexString(hexVal.text), \"b\");\r\n }\r\n if (activeField == hexVal.name) {\r\n activeField = \"\";\r\n }\r\n });\r\n hexVal.onTextChangedObservable.add(function () {\r\n var newHexValue = hexVal.text;\r\n var checkHex = /[^0-9A-F]/i.test(newHexValue);\r\n if ((hexVal.text.length > 6 || checkHex) && activeField == hexVal.name) {\r\n hexVal.text = lastVal;\r\n }\r\n else {\r\n if (hexVal.text.length < 6) {\r\n var leadingZero = 6 - hexVal.text.length;\r\n for (var i = 0; i < leadingZero; i++) {\r\n newHexValue = \"0\" + newHexValue;\r\n }\r\n }\r\n if (hexVal.text.length == 3) {\r\n var val = hexVal.text.split(\"\");\r\n newHexValue = val[0] + val[0] + val[1] + val[1] + val[2] + val[2];\r\n }\r\n newHexValue = \"#\" + newHexValue;\r\n if (activeField == hexVal.name) {\r\n lastVal = hexVal.text;\r\n updateValues(Color3.FromHexString(newHexValue), hexVal.name);\r\n }\r\n }\r\n });\r\n hexValueQuadrant.addControl(hexVal, 0, 1);\r\n if (options.savedColors && options.savedColors.length > 0) {\r\n updateSwatches(\"\", butSave);\r\n }\r\n });\r\n };\r\n ColorPicker._Epsilon = 0.000001;\r\n return ColorPicker;\r\n}(Control));\r\nexport { ColorPicker };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.ColorPicker\"] = ColorPicker;\r\n//# sourceMappingURL=colorpicker.js.map","import { __extends } from \"tslib\";\r\nimport { Container } from \"./container\";\r\nimport { Control } from \"./control\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/** Class used to create 2D ellipse containers */\r\nvar Ellipse = /** @class */ (function (_super) {\r\n __extends(Ellipse, _super);\r\n /**\r\n * Creates a new Ellipse\r\n * @param name defines the control name\r\n */\r\n function Ellipse(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._thickness = 1;\r\n return _this;\r\n }\r\n Object.defineProperty(Ellipse.prototype, \"thickness\", {\r\n /** Gets or sets border thickness */\r\n get: function () {\r\n return this._thickness;\r\n },\r\n set: function (value) {\r\n if (this._thickness === value) {\r\n return;\r\n }\r\n this._thickness = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Ellipse.prototype._getTypeName = function () {\r\n return \"Ellipse\";\r\n };\r\n Ellipse.prototype._localDraw = function (context) {\r\n context.save();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n Control.drawEllipse(this._currentMeasure.left + this._currentMeasure.width / 2, this._currentMeasure.top + this._currentMeasure.height / 2, this._currentMeasure.width / 2 - this._thickness / 2, this._currentMeasure.height / 2 - this._thickness / 2, context);\r\n if (this._background) {\r\n context.fillStyle = this._background;\r\n context.fill();\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n if (this._thickness) {\r\n if (this.color) {\r\n context.strokeStyle = this.color;\r\n }\r\n context.lineWidth = this._thickness;\r\n context.stroke();\r\n }\r\n context.restore();\r\n };\r\n Ellipse.prototype._additionalProcessing = function (parentMeasure, context) {\r\n _super.prototype._additionalProcessing.call(this, parentMeasure, context);\r\n this._measureForChildren.width -= 2 * this._thickness;\r\n this._measureForChildren.height -= 2 * this._thickness;\r\n this._measureForChildren.left += this._thickness;\r\n this._measureForChildren.top += this._thickness;\r\n };\r\n Ellipse.prototype._clipForChildren = function (context) {\r\n Control.drawEllipse(this._currentMeasure.left + this._currentMeasure.width / 2, this._currentMeasure.top + this._currentMeasure.height / 2, this._currentMeasure.width / 2, this._currentMeasure.height / 2, context);\r\n context.clip();\r\n };\r\n return Ellipse;\r\n}(Container));\r\nexport { Ellipse };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Ellipse\"] = Ellipse;\r\n//# sourceMappingURL=ellipse.js.map","import { __extends } from \"tslib\";\r\nimport { InputText } from \"./inputText\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\nimport { TextWrapper } from './textWrapper';\r\n/**\r\n * Class used to create a password control\r\n */\r\nvar InputPassword = /** @class */ (function (_super) {\r\n __extends(InputPassword, _super);\r\n function InputPassword() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n InputPassword.prototype._beforeRenderText = function (textWrapper) {\r\n var pwdTextWrapper = new TextWrapper();\r\n var txt = \"\";\r\n for (var i = 0; i < textWrapper.length; i++) {\r\n txt += \"\\u2022\";\r\n }\r\n pwdTextWrapper.text = txt;\r\n return pwdTextWrapper;\r\n };\r\n return InputPassword;\r\n}(InputText));\r\nexport { InputPassword };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.InputPassword\"] = InputPassword;\r\n//# sourceMappingURL=inputPassword.js.map","import { __extends } from \"tslib\";\r\nimport { Vector3, Matrix } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Control } from \"./control\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/** Class used to render 2D lines */\r\nvar Line = /** @class */ (function (_super) {\r\n __extends(Line, _super);\r\n /**\r\n * Creates a new Line\r\n * @param name defines the control name\r\n */\r\n function Line(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._lineWidth = 1;\r\n _this._x1 = new ValueAndUnit(0);\r\n _this._y1 = new ValueAndUnit(0);\r\n _this._x2 = new ValueAndUnit(0);\r\n _this._y2 = new ValueAndUnit(0);\r\n _this._dash = new Array();\r\n _this._automaticSize = true;\r\n _this.isHitTestVisible = false;\r\n _this._horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _this._verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n return _this;\r\n }\r\n Object.defineProperty(Line.prototype, \"dash\", {\r\n /** Gets or sets the dash pattern */\r\n get: function () {\r\n return this._dash;\r\n },\r\n set: function (value) {\r\n if (this._dash === value) {\r\n return;\r\n }\r\n this._dash = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"connectedControl\", {\r\n /** Gets or sets the control connected with the line end */\r\n get: function () {\r\n return this._connectedControl;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._connectedControl === value) {\r\n return;\r\n }\r\n if (this._connectedControlDirtyObserver && this._connectedControl) {\r\n this._connectedControl.onDirtyObservable.remove(this._connectedControlDirtyObserver);\r\n this._connectedControlDirtyObserver = null;\r\n }\r\n if (value) {\r\n this._connectedControlDirtyObserver = value.onDirtyObservable.add(function () { return _this._markAsDirty(); });\r\n }\r\n this._connectedControl = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"x1\", {\r\n /** Gets or sets start coordinates on X axis */\r\n get: function () {\r\n return this._x1.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._x1.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._x1.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"y1\", {\r\n /** Gets or sets start coordinates on Y axis */\r\n get: function () {\r\n return this._y1.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._y1.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._y1.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"x2\", {\r\n /** Gets or sets end coordinates on X axis */\r\n get: function () {\r\n return this._x2.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._x2.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._x2.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"y2\", {\r\n /** Gets or sets end coordinates on Y axis */\r\n get: function () {\r\n return this._y2.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._y2.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._y2.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"lineWidth\", {\r\n /** Gets or sets line width */\r\n get: function () {\r\n return this._lineWidth;\r\n },\r\n set: function (value) {\r\n if (this._lineWidth === value) {\r\n return;\r\n }\r\n this._lineWidth = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"horizontalAlignment\", {\r\n /** Gets or sets horizontal alignment */\r\n set: function (value) {\r\n return;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"verticalAlignment\", {\r\n /** Gets or sets vertical alignment */\r\n set: function (value) {\r\n return;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"_effectiveX2\", {\r\n get: function () {\r\n return (this._connectedControl ? this._connectedControl.centerX : 0) + this._x2.getValue(this._host);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"_effectiveY2\", {\r\n get: function () {\r\n return (this._connectedControl ? this._connectedControl.centerY : 0) + this._y2.getValue(this._host);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Line.prototype._getTypeName = function () {\r\n return \"Line\";\r\n };\r\n Line.prototype._draw = function (context) {\r\n context.save();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n this._applyStates(context);\r\n context.strokeStyle = this.color;\r\n context.lineWidth = this._lineWidth;\r\n context.setLineDash(this._dash);\r\n context.beginPath();\r\n context.moveTo(this._cachedParentMeasure.left + this._x1.getValue(this._host), this._cachedParentMeasure.top + this._y1.getValue(this._host));\r\n context.lineTo(this._cachedParentMeasure.left + this._effectiveX2, this._cachedParentMeasure.top + this._effectiveY2);\r\n context.stroke();\r\n context.restore();\r\n };\r\n Line.prototype._measure = function () {\r\n // Width / Height\r\n this._currentMeasure.width = Math.abs(this._x1.getValue(this._host) - this._effectiveX2) + this._lineWidth;\r\n this._currentMeasure.height = Math.abs(this._y1.getValue(this._host) - this._effectiveY2) + this._lineWidth;\r\n };\r\n Line.prototype._computeAlignment = function (parentMeasure, context) {\r\n this._currentMeasure.left = parentMeasure.left + Math.min(this._x1.getValue(this._host), this._effectiveX2) - this._lineWidth / 2;\r\n this._currentMeasure.top = parentMeasure.top + Math.min(this._y1.getValue(this._host), this._effectiveY2) - this._lineWidth / 2;\r\n };\r\n /**\r\n * Move one end of the line given 3D cartesian coordinates.\r\n * @param position Targeted world position\r\n * @param scene Scene\r\n * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.\r\n */\r\n Line.prototype.moveToVector3 = function (position, scene, end) {\r\n if (end === void 0) { end = false; }\r\n if (!this._host || this.parent !== this._host._rootContainer) {\r\n Tools.Error(\"Cannot move a control to a vector3 if the control is not at root level\");\r\n return;\r\n }\r\n var globalViewport = this._host._getGlobalViewport(scene);\r\n var projectedPosition = Vector3.Project(position, Matrix.Identity(), scene.getTransformMatrix(), globalViewport);\r\n this._moveToProjectedPosition(projectedPosition, end);\r\n if (projectedPosition.z < 0 || projectedPosition.z > 1) {\r\n this.notRenderable = true;\r\n return;\r\n }\r\n this.notRenderable = false;\r\n };\r\n /**\r\n * Move one end of the line to a position in screen absolute space.\r\n * @param projectedPosition Position in screen absolute space (X, Y)\r\n * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.\r\n */\r\n Line.prototype._moveToProjectedPosition = function (projectedPosition, end) {\r\n if (end === void 0) { end = false; }\r\n var x = (projectedPosition.x + this._linkOffsetX.getValue(this._host)) + \"px\";\r\n var y = (projectedPosition.y + this._linkOffsetY.getValue(this._host)) + \"px\";\r\n if (end) {\r\n this.x2 = x;\r\n this.y2 = y;\r\n this._x2.ignoreAdaptiveScaling = true;\r\n this._y2.ignoreAdaptiveScaling = true;\r\n }\r\n else {\r\n this.x1 = x;\r\n this.y1 = y;\r\n this._x1.ignoreAdaptiveScaling = true;\r\n this._y1.ignoreAdaptiveScaling = true;\r\n }\r\n };\r\n return Line;\r\n}(Control));\r\nexport { Line };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Line\"] = Line;\r\n//# sourceMappingURL=line.js.map","import { Vector3 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Epsilon } from '@babylonjs/core/Maths/math.constants';\r\nimport { ValueAndUnit } from \"./valueAndUnit\";\r\n/**\r\n * Class used to store a point for a MultiLine object.\r\n * The point can be pure 2D coordinates, a mesh or a control\r\n */\r\nvar MultiLinePoint = /** @class */ (function () {\r\n /**\r\n * Creates a new MultiLinePoint\r\n * @param multiLine defines the source MultiLine object\r\n */\r\n function MultiLinePoint(multiLine) {\r\n this._multiLine = multiLine;\r\n this._x = new ValueAndUnit(0);\r\n this._y = new ValueAndUnit(0);\r\n this._point = new Vector3(0, 0, 0);\r\n }\r\n Object.defineProperty(MultiLinePoint.prototype, \"x\", {\r\n /** Gets or sets x coordinate */\r\n get: function () {\r\n return this._x.toString(this._multiLine._host);\r\n },\r\n set: function (value) {\r\n if (this._x.toString(this._multiLine._host) === value) {\r\n return;\r\n }\r\n if (this._x.fromString(value)) {\r\n this._multiLine._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiLinePoint.prototype, \"y\", {\r\n /** Gets or sets y coordinate */\r\n get: function () {\r\n return this._y.toString(this._multiLine._host);\r\n },\r\n set: function (value) {\r\n if (this._y.toString(this._multiLine._host) === value) {\r\n return;\r\n }\r\n if (this._y.fromString(value)) {\r\n this._multiLine._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiLinePoint.prototype, \"control\", {\r\n /** Gets or sets the control associated with this point */\r\n get: function () {\r\n return this._control;\r\n },\r\n set: function (value) {\r\n if (this._control === value) {\r\n return;\r\n }\r\n if (this._control && this._controlObserver) {\r\n this._control.onDirtyObservable.remove(this._controlObserver);\r\n this._controlObserver = null;\r\n }\r\n this._control = value;\r\n if (this._control) {\r\n this._controlObserver = this._control.onDirtyObservable.add(this._multiLine.onPointUpdate);\r\n }\r\n this._multiLine._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiLinePoint.prototype, \"mesh\", {\r\n /** Gets or sets the mesh associated with this point */\r\n get: function () {\r\n return this._mesh;\r\n },\r\n set: function (value) {\r\n if (this._mesh === value) {\r\n return;\r\n }\r\n if (this._mesh && this._meshObserver) {\r\n this._mesh.getScene().onAfterCameraRenderObservable.remove(this._meshObserver);\r\n }\r\n this._mesh = value;\r\n if (this._mesh) {\r\n this._meshObserver = this._mesh.getScene().onAfterCameraRenderObservable.add(this._multiLine.onPointUpdate);\r\n }\r\n this._multiLine._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** Resets links */\r\n MultiLinePoint.prototype.resetLinks = function () {\r\n this.control = null;\r\n this.mesh = null;\r\n };\r\n /**\r\n * Gets a translation vector with Z component\r\n * @returns the translation vector\r\n */\r\n MultiLinePoint.prototype.translate = function () {\r\n this._point = this._translatePoint();\r\n return this._point;\r\n };\r\n MultiLinePoint.prototype._translatePoint = function () {\r\n if (this._mesh != null) {\r\n return this._multiLine._host.getProjectedPositionWithZ(this._mesh.getBoundingInfo().boundingSphere.center, this._mesh.getWorldMatrix());\r\n }\r\n else if (this._control != null) {\r\n return new Vector3(this._control.centerX, this._control.centerY, 1. - Epsilon);\r\n }\r\n else {\r\n var host = this._multiLine._host;\r\n var xValue = this._x.getValueInPixel(host, Number(host._canvas.width));\r\n var yValue = this._y.getValueInPixel(host, Number(host._canvas.height));\r\n return new Vector3(xValue, yValue, 1. - Epsilon);\r\n }\r\n };\r\n /** Release associated resources */\r\n MultiLinePoint.prototype.dispose = function () {\r\n this.resetLinks();\r\n };\r\n return MultiLinePoint;\r\n}());\r\nexport { MultiLinePoint };\r\n//# sourceMappingURL=multiLinePoint.js.map","import { __extends } from \"tslib\";\r\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\r\nimport { Control } from \"./control\";\r\nimport { MultiLinePoint } from \"../multiLinePoint\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create multi line control\r\n */\r\nvar MultiLine = /** @class */ (function (_super) {\r\n __extends(MultiLine, _super);\r\n /**\r\n * Creates a new MultiLine\r\n * @param name defines the control name\r\n */\r\n function MultiLine(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._lineWidth = 1;\r\n /** Function called when a point is updated */\r\n _this.onPointUpdate = function () {\r\n _this._markAsDirty();\r\n };\r\n _this._automaticSize = true;\r\n _this.isHitTestVisible = false;\r\n _this._horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _this._verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n _this._dash = [];\r\n _this._points = [];\r\n return _this;\r\n }\r\n Object.defineProperty(MultiLine.prototype, \"dash\", {\r\n /** Gets or sets dash pattern */\r\n get: function () {\r\n return this._dash;\r\n },\r\n set: function (value) {\r\n if (this._dash === value) {\r\n return;\r\n }\r\n this._dash = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets point stored at specified index\r\n * @param index defines the index to look for\r\n * @returns the requested point if found\r\n */\r\n MultiLine.prototype.getAt = function (index) {\r\n if (!this._points[index]) {\r\n this._points[index] = new MultiLinePoint(this);\r\n }\r\n return this._points[index];\r\n };\r\n /**\r\n * Adds new points to the point collection\r\n * @param items defines the list of items (mesh, control or 2d coordiantes) to add\r\n * @returns the list of created MultiLinePoint\r\n */\r\n MultiLine.prototype.add = function () {\r\n var _this = this;\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n return items.map(function (item) { return _this.push(item); });\r\n };\r\n /**\r\n * Adds a new point to the point collection\r\n * @param item defines the item (mesh, control or 2d coordiantes) to add\r\n * @returns the created MultiLinePoint\r\n */\r\n MultiLine.prototype.push = function (item) {\r\n var point = this.getAt(this._points.length);\r\n if (item == null) {\r\n return point;\r\n }\r\n if (item instanceof AbstractMesh) {\r\n point.mesh = item;\r\n }\r\n else if (item instanceof Control) {\r\n point.control = item;\r\n }\r\n else if (item.x != null && item.y != null) {\r\n point.x = item.x;\r\n point.y = item.y;\r\n }\r\n return point;\r\n };\r\n /**\r\n * Remove a specific value or point from the active point collection\r\n * @param value defines the value or point to remove\r\n */\r\n MultiLine.prototype.remove = function (value) {\r\n var index;\r\n if (value instanceof MultiLinePoint) {\r\n index = this._points.indexOf(value);\r\n if (index === -1) {\r\n return;\r\n }\r\n }\r\n else {\r\n index = value;\r\n }\r\n var point = this._points[index];\r\n if (!point) {\r\n return;\r\n }\r\n point.dispose();\r\n this._points.splice(index, 1);\r\n };\r\n /**\r\n * Resets this object to initial state (no point)\r\n */\r\n MultiLine.prototype.reset = function () {\r\n while (this._points.length > 0) {\r\n this.remove(this._points.length - 1);\r\n }\r\n };\r\n /**\r\n * Resets all links\r\n */\r\n MultiLine.prototype.resetLinks = function () {\r\n this._points.forEach(function (point) {\r\n if (point != null) {\r\n point.resetLinks();\r\n }\r\n });\r\n };\r\n Object.defineProperty(MultiLine.prototype, \"lineWidth\", {\r\n /** Gets or sets line width */\r\n get: function () {\r\n return this._lineWidth;\r\n },\r\n set: function (value) {\r\n if (this._lineWidth === value) {\r\n return;\r\n }\r\n this._lineWidth = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiLine.prototype, \"horizontalAlignment\", {\r\n set: function (value) {\r\n return;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiLine.prototype, \"verticalAlignment\", {\r\n set: function (value) {\r\n return;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n MultiLine.prototype._getTypeName = function () {\r\n return \"MultiLine\";\r\n };\r\n MultiLine.prototype._draw = function (context, invalidatedRectangle) {\r\n context.save();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n this._applyStates(context);\r\n context.strokeStyle = this.color;\r\n context.lineWidth = this._lineWidth;\r\n context.setLineDash(this._dash);\r\n context.beginPath();\r\n var first = true; //first index is not necessarily 0\r\n var previousPoint;\r\n this._points.forEach(function (point) {\r\n if (!point) {\r\n return;\r\n }\r\n if (first) {\r\n context.moveTo(point._point.x, point._point.y);\r\n first = false;\r\n }\r\n else {\r\n if (point._point.z < 1 && previousPoint.z < 1) {\r\n context.lineTo(point._point.x, point._point.y);\r\n }\r\n else {\r\n context.moveTo(point._point.x, point._point.y);\r\n }\r\n }\r\n previousPoint = point._point;\r\n });\r\n context.stroke();\r\n context.restore();\r\n };\r\n MultiLine.prototype._additionalProcessing = function (parentMeasure, context) {\r\n var _this = this;\r\n this._minX = null;\r\n this._minY = null;\r\n this._maxX = null;\r\n this._maxY = null;\r\n this._points.forEach(function (point, index) {\r\n if (!point) {\r\n return;\r\n }\r\n point.translate();\r\n if (_this._minX == null || point._point.x < _this._minX) {\r\n _this._minX = point._point.x;\r\n }\r\n if (_this._minY == null || point._point.y < _this._minY) {\r\n _this._minY = point._point.y;\r\n }\r\n if (_this._maxX == null || point._point.x > _this._maxX) {\r\n _this._maxX = point._point.x;\r\n }\r\n if (_this._maxY == null || point._point.y > _this._maxY) {\r\n _this._maxY = point._point.y;\r\n }\r\n });\r\n if (this._minX == null) {\r\n this._minX = 0;\r\n }\r\n if (this._minY == null) {\r\n this._minY = 0;\r\n }\r\n if (this._maxX == null) {\r\n this._maxX = 0;\r\n }\r\n if (this._maxY == null) {\r\n this._maxY = 0;\r\n }\r\n };\r\n MultiLine.prototype._measure = function () {\r\n if (this._minX == null || this._maxX == null || this._minY == null || this._maxY == null) {\r\n return;\r\n }\r\n this._currentMeasure.width = Math.abs(this._maxX - this._minX) + this._lineWidth;\r\n this._currentMeasure.height = Math.abs(this._maxY - this._minY) + this._lineWidth;\r\n };\r\n MultiLine.prototype._computeAlignment = function (parentMeasure, context) {\r\n if (this._minX == null || this._minY == null) {\r\n return;\r\n }\r\n this._currentMeasure.left = this._minX - this._lineWidth / 2;\r\n this._currentMeasure.top = this._minY - this._lineWidth / 2;\r\n };\r\n MultiLine.prototype.dispose = function () {\r\n this.reset();\r\n _super.prototype.dispose.call(this);\r\n };\r\n return MultiLine;\r\n}(Control));\r\nexport { MultiLine };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.MultiLine\"] = MultiLine;\r\n//# sourceMappingURL=multiLine.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Control } from \"./control\";\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { TextBlock } from \"./textBlock\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create radio button controls\r\n */\r\nvar RadioButton = /** @class */ (function (_super) {\r\n __extends(RadioButton, _super);\r\n /**\r\n * Creates a new RadioButton\r\n * @param name defines the control name\r\n */\r\n function RadioButton(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._isChecked = false;\r\n _this._background = \"black\";\r\n _this._checkSizeRatio = 0.8;\r\n _this._thickness = 1;\r\n /** Gets or sets group name */\r\n _this.group = \"\";\r\n /** Observable raised when isChecked is changed */\r\n _this.onIsCheckedChangedObservable = new Observable();\r\n _this.isPointerBlocker = true;\r\n return _this;\r\n }\r\n Object.defineProperty(RadioButton.prototype, \"thickness\", {\r\n /** Gets or sets border thickness */\r\n get: function () {\r\n return this._thickness;\r\n },\r\n set: function (value) {\r\n if (this._thickness === value) {\r\n return;\r\n }\r\n this._thickness = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadioButton.prototype, \"checkSizeRatio\", {\r\n /** Gets or sets a value indicating the ratio between overall size and check size */\r\n get: function () {\r\n return this._checkSizeRatio;\r\n },\r\n set: function (value) {\r\n value = Math.max(Math.min(1, value), 0);\r\n if (this._checkSizeRatio === value) {\r\n return;\r\n }\r\n this._checkSizeRatio = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadioButton.prototype, \"background\", {\r\n /** Gets or sets background color */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadioButton.prototype, \"isChecked\", {\r\n /** Gets or sets a boolean indicating if the checkbox is checked or not */\r\n get: function () {\r\n return this._isChecked;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._isChecked === value) {\r\n return;\r\n }\r\n this._isChecked = value;\r\n this._markAsDirty();\r\n this.onIsCheckedChangedObservable.notifyObservers(value);\r\n if (this._isChecked && this._host) {\r\n // Update all controls from same group\r\n this._host.executeOnAllControls(function (control) {\r\n if (control === _this) {\r\n return;\r\n }\r\n if (control.group === undefined) {\r\n return;\r\n }\r\n var childRadio = control;\r\n if (childRadio.group === _this.group) {\r\n childRadio.isChecked = false;\r\n }\r\n });\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n RadioButton.prototype._getTypeName = function () {\r\n return \"RadioButton\";\r\n };\r\n RadioButton.prototype._draw = function (context) {\r\n context.save();\r\n this._applyStates(context);\r\n var actualWidth = this._currentMeasure.width - this._thickness;\r\n var actualHeight = this._currentMeasure.height - this._thickness;\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n // Outer\r\n Control.drawEllipse(this._currentMeasure.left + this._currentMeasure.width / 2, this._currentMeasure.top + this._currentMeasure.height / 2, this._currentMeasure.width / 2 - this._thickness / 2, this._currentMeasure.height / 2 - this._thickness / 2, context);\r\n context.fillStyle = this._isEnabled ? this._background : this._disabledColor;\r\n context.fill();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n context.strokeStyle = this.color;\r\n context.lineWidth = this._thickness;\r\n context.stroke();\r\n // Inner\r\n if (this._isChecked) {\r\n context.fillStyle = this._isEnabled ? this.color : this._disabledColor;\r\n var offsetWidth = actualWidth * this._checkSizeRatio;\r\n var offseHeight = actualHeight * this._checkSizeRatio;\r\n Control.drawEllipse(this._currentMeasure.left + this._currentMeasure.width / 2, this._currentMeasure.top + this._currentMeasure.height / 2, offsetWidth / 2 - this._thickness / 2, offseHeight / 2 - this._thickness / 2, context);\r\n context.fill();\r\n }\r\n context.restore();\r\n };\r\n // Events\r\n RadioButton.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n if (!_super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n if (!this.isChecked) {\r\n this.isChecked = true;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Utility function to easily create a radio button with a header\r\n * @param title defines the label to use for the header\r\n * @param group defines the group to use for the radio button\r\n * @param isChecked defines the initial state of the radio button\r\n * @param onValueChanged defines the callback to call when value changes\r\n * @returns a StackPanel containing the radio button and a textBlock\r\n */\r\n RadioButton.AddRadioButtonWithHeader = function (title, group, isChecked, onValueChanged) {\r\n var panel = new StackPanel();\r\n panel.isVertical = false;\r\n panel.height = \"30px\";\r\n var radio = new RadioButton();\r\n radio.width = \"20px\";\r\n radio.height = \"20px\";\r\n radio.isChecked = isChecked;\r\n radio.color = \"green\";\r\n radio.group = group;\r\n radio.onIsCheckedChangedObservable.add(function (value) { return onValueChanged(radio, value); });\r\n panel.addControl(radio);\r\n var header = new TextBlock();\r\n header.text = title;\r\n header.width = \"180px\";\r\n header.paddingLeft = \"5px\";\r\n header.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n header.color = \"white\";\r\n panel.addControl(header);\r\n return panel;\r\n };\r\n return RadioButton;\r\n}(Control));\r\nexport { RadioButton };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.RadioButton\"] = RadioButton;\r\n//# sourceMappingURL=radioButton.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Control } from \"../control\";\r\nimport { ValueAndUnit } from \"../../valueAndUnit\";\r\n/**\r\n * Class used to create slider controls\r\n */\r\nvar BaseSlider = /** @class */ (function (_super) {\r\n __extends(BaseSlider, _super);\r\n /**\r\n * Creates a new BaseSlider\r\n * @param name defines the control name\r\n */\r\n function BaseSlider(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._thumbWidth = new ValueAndUnit(20, ValueAndUnit.UNITMODE_PIXEL, false);\r\n _this._minimum = 0;\r\n _this._maximum = 100;\r\n _this._value = 50;\r\n _this._isVertical = false;\r\n _this._barOffset = new ValueAndUnit(5, ValueAndUnit.UNITMODE_PIXEL, false);\r\n _this._isThumbClamped = false;\r\n _this._displayThumb = true;\r\n _this._step = 0;\r\n _this._lastPointerDownID = -1;\r\n // Shared rendering info\r\n _this._effectiveBarOffset = 0;\r\n /** Observable raised when the sldier value changes */\r\n _this.onValueChangedObservable = new Observable();\r\n // Events\r\n _this._pointerIsDown = false;\r\n _this.isPointerBlocker = true;\r\n return _this;\r\n }\r\n Object.defineProperty(BaseSlider.prototype, \"displayThumb\", {\r\n /** Gets or sets a boolean indicating if the thumb must be rendered */\r\n get: function () {\r\n return this._displayThumb;\r\n },\r\n set: function (value) {\r\n if (this._displayThumb === value) {\r\n return;\r\n }\r\n this._displayThumb = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"step\", {\r\n /** Gets or sets a step to apply to values (0 by default) */\r\n get: function () {\r\n return this._step;\r\n },\r\n set: function (value) {\r\n if (this._step === value) {\r\n return;\r\n }\r\n this._step = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"barOffset\", {\r\n /** Gets or sets main bar offset (ie. the margin applied to the value bar) */\r\n get: function () {\r\n return this._barOffset.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._barOffset.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._barOffset.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"barOffsetInPixels\", {\r\n /** Gets main bar offset in pixels*/\r\n get: function () {\r\n return this._barOffset.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"thumbWidth\", {\r\n /** Gets or sets thumb width */\r\n get: function () {\r\n return this._thumbWidth.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._thumbWidth.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._thumbWidth.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"thumbWidthInPixels\", {\r\n /** Gets thumb width in pixels */\r\n get: function () {\r\n return this._thumbWidth.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"minimum\", {\r\n /** Gets or sets minimum value */\r\n get: function () {\r\n return this._minimum;\r\n },\r\n set: function (value) {\r\n if (this._minimum === value) {\r\n return;\r\n }\r\n this._minimum = value;\r\n this._markAsDirty();\r\n this.value = Math.max(Math.min(this.value, this._maximum), this._minimum);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"maximum\", {\r\n /** Gets or sets maximum value */\r\n get: function () {\r\n return this._maximum;\r\n },\r\n set: function (value) {\r\n if (this._maximum === value) {\r\n return;\r\n }\r\n this._maximum = value;\r\n this._markAsDirty();\r\n this.value = Math.max(Math.min(this.value, this._maximum), this._minimum);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"value\", {\r\n /** Gets or sets current value */\r\n get: function () {\r\n return this._value;\r\n },\r\n set: function (value) {\r\n value = Math.max(Math.min(value, this._maximum), this._minimum);\r\n if (this._value === value) {\r\n return;\r\n }\r\n this._value = value;\r\n this._markAsDirty();\r\n this.onValueChangedObservable.notifyObservers(this._value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"isVertical\", {\r\n /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */\r\n get: function () {\r\n return this._isVertical;\r\n },\r\n set: function (value) {\r\n if (this._isVertical === value) {\r\n return;\r\n }\r\n this._isVertical = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"isThumbClamped\", {\r\n /** Gets or sets a value indicating if the thumb can go over main bar extends */\r\n get: function () {\r\n return this._isThumbClamped;\r\n },\r\n set: function (value) {\r\n if (this._isThumbClamped === value) {\r\n return;\r\n }\r\n this._isThumbClamped = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n BaseSlider.prototype._getTypeName = function () {\r\n return \"BaseSlider\";\r\n };\r\n BaseSlider.prototype._getThumbPosition = function () {\r\n if (this.isVertical) {\r\n return ((this.maximum - this.value) / (this.maximum - this.minimum)) * this._backgroundBoxLength;\r\n }\r\n return ((this.value - this.minimum) / (this.maximum - this.minimum)) * this._backgroundBoxLength;\r\n };\r\n BaseSlider.prototype._getThumbThickness = function (type) {\r\n var thumbThickness = 0;\r\n switch (type) {\r\n case \"circle\":\r\n if (this._thumbWidth.isPixel) {\r\n thumbThickness = Math.max(this._thumbWidth.getValue(this._host), this._backgroundBoxThickness);\r\n }\r\n else {\r\n thumbThickness = this._backgroundBoxThickness * this._thumbWidth.getValue(this._host);\r\n }\r\n break;\r\n case \"rectangle\":\r\n if (this._thumbWidth.isPixel) {\r\n thumbThickness = Math.min(this._thumbWidth.getValue(this._host), this._backgroundBoxThickness);\r\n }\r\n else {\r\n thumbThickness = this._backgroundBoxThickness * this._thumbWidth.getValue(this._host);\r\n }\r\n }\r\n return thumbThickness;\r\n };\r\n BaseSlider.prototype._prepareRenderingData = function (type) {\r\n // Main bar\r\n this._effectiveBarOffset = 0;\r\n this._renderLeft = this._currentMeasure.left;\r\n this._renderTop = this._currentMeasure.top;\r\n this._renderWidth = this._currentMeasure.width;\r\n this._renderHeight = this._currentMeasure.height;\r\n this._backgroundBoxLength = Math.max(this._currentMeasure.width, this._currentMeasure.height);\r\n this._backgroundBoxThickness = Math.min(this._currentMeasure.width, this._currentMeasure.height);\r\n this._effectiveThumbThickness = this._getThumbThickness(type);\r\n if (this.displayThumb) {\r\n this._backgroundBoxLength -= this._effectiveThumbThickness;\r\n }\r\n //throw error when height is less than width for vertical slider\r\n if ((this.isVertical && this._currentMeasure.height < this._currentMeasure.width)) {\r\n console.error(\"Height should be greater than width\");\r\n return;\r\n }\r\n if (this._barOffset.isPixel) {\r\n this._effectiveBarOffset = Math.min(this._barOffset.getValue(this._host), this._backgroundBoxThickness);\r\n }\r\n else {\r\n this._effectiveBarOffset = this._backgroundBoxThickness * this._barOffset.getValue(this._host);\r\n }\r\n this._backgroundBoxThickness -= (this._effectiveBarOffset * 2);\r\n if (this.isVertical) {\r\n this._renderLeft += this._effectiveBarOffset;\r\n if (!this.isThumbClamped && this.displayThumb) {\r\n this._renderTop += (this._effectiveThumbThickness / 2);\r\n }\r\n this._renderHeight = this._backgroundBoxLength;\r\n this._renderWidth = this._backgroundBoxThickness;\r\n }\r\n else {\r\n this._renderTop += this._effectiveBarOffset;\r\n if (!this.isThumbClamped && this.displayThumb) {\r\n this._renderLeft += (this._effectiveThumbThickness / 2);\r\n }\r\n this._renderHeight = this._backgroundBoxThickness;\r\n this._renderWidth = this._backgroundBoxLength;\r\n }\r\n };\r\n /** @hidden */\r\n BaseSlider.prototype._updateValueFromPointer = function (x, y) {\r\n if (this.rotation != 0) {\r\n this._invertTransformMatrix.transformCoordinates(x, y, this._transformedPosition);\r\n x = this._transformedPosition.x;\r\n y = this._transformedPosition.y;\r\n }\r\n var value;\r\n if (this._isVertical) {\r\n value = this._minimum + (1 - ((y - this._currentMeasure.top) / this._currentMeasure.height)) * (this._maximum - this._minimum);\r\n }\r\n else {\r\n value = this._minimum + ((x - this._currentMeasure.left) / this._currentMeasure.width) * (this._maximum - this._minimum);\r\n }\r\n var mult = (1 / this._step) | 0;\r\n this.value = this._step ? ((value * mult) | 0) / mult : value;\r\n };\r\n BaseSlider.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n if (!_super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n this._pointerIsDown = true;\r\n this._updateValueFromPointer(coordinates.x, coordinates.y);\r\n this._host._capturingControl[pointerId] = this;\r\n this._lastPointerDownID = pointerId;\r\n return true;\r\n };\r\n BaseSlider.prototype._onPointerMove = function (target, coordinates, pointerId, pi) {\r\n // Only listen to pointer move events coming from the last pointer to click on the element (To support dual vr controller interaction)\r\n if (pointerId != this._lastPointerDownID) {\r\n return;\r\n }\r\n if (this._pointerIsDown) {\r\n this._updateValueFromPointer(coordinates.x, coordinates.y);\r\n }\r\n _super.prototype._onPointerMove.call(this, target, coordinates, pointerId, pi);\r\n };\r\n BaseSlider.prototype._onPointerUp = function (target, coordinates, pointerId, buttonIndex, notifyClick) {\r\n this._pointerIsDown = false;\r\n delete this._host._capturingControl[pointerId];\r\n _super.prototype._onPointerUp.call(this, target, coordinates, pointerId, buttonIndex, notifyClick);\r\n };\r\n BaseSlider.prototype._onCanvasBlur = function () {\r\n this._forcePointerUp();\r\n _super.prototype._onCanvasBlur.call(this);\r\n };\r\n return BaseSlider;\r\n}(Control));\r\nexport { BaseSlider };\r\n//# sourceMappingURL=baseSlider.js.map","import { __extends } from \"tslib\";\r\nimport { BaseSlider } from \"./baseSlider\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create slider controls\r\n */\r\nvar Slider = /** @class */ (function (_super) {\r\n __extends(Slider, _super);\r\n /**\r\n * Creates a new Slider\r\n * @param name defines the control name\r\n */\r\n function Slider(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._background = \"black\";\r\n _this._borderColor = \"white\";\r\n _this._thumbColor = \"\";\r\n _this._isThumbCircle = false;\r\n _this._displayValueBar = true;\r\n return _this;\r\n }\r\n Object.defineProperty(Slider.prototype, \"displayValueBar\", {\r\n /** Gets or sets a boolean indicating if the value bar must be rendered */\r\n get: function () {\r\n return this._displayValueBar;\r\n },\r\n set: function (value) {\r\n if (this._displayValueBar === value) {\r\n return;\r\n }\r\n this._displayValueBar = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slider.prototype, \"borderColor\", {\r\n /** Gets or sets border color */\r\n get: function () {\r\n return this._borderColor;\r\n },\r\n set: function (value) {\r\n if (this._borderColor === value) {\r\n return;\r\n }\r\n this._borderColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slider.prototype, \"background\", {\r\n /** Gets or sets background color */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slider.prototype, \"thumbColor\", {\r\n /** Gets or sets thumb's color */\r\n get: function () {\r\n return this._thumbColor;\r\n },\r\n set: function (value) {\r\n if (this._thumbColor === value) {\r\n return;\r\n }\r\n this._thumbColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slider.prototype, \"isThumbCircle\", {\r\n /** Gets or sets a boolean indicating if the thumb should be round or square */\r\n get: function () {\r\n return this._isThumbCircle;\r\n },\r\n set: function (value) {\r\n if (this._isThumbCircle === value) {\r\n return;\r\n }\r\n this._isThumbCircle = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Slider.prototype._getTypeName = function () {\r\n return \"Slider\";\r\n };\r\n Slider.prototype._draw = function (context, invalidatedRectangle) {\r\n context.save();\r\n this._applyStates(context);\r\n this._prepareRenderingData(this.isThumbCircle ? \"circle\" : \"rectangle\");\r\n var left = this._renderLeft;\r\n var top = this._renderTop;\r\n var width = this._renderWidth;\r\n var height = this._renderHeight;\r\n var radius = 0;\r\n if (this.isThumbClamped && this.isThumbCircle) {\r\n if (this.isVertical) {\r\n top += (this._effectiveThumbThickness / 2);\r\n }\r\n else {\r\n left += (this._effectiveThumbThickness / 2);\r\n }\r\n radius = this._backgroundBoxThickness / 2;\r\n }\r\n else {\r\n radius = (this._effectiveThumbThickness - this._effectiveBarOffset) / 2;\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n var thumbPosition = this._getThumbPosition();\r\n context.fillStyle = this._background;\r\n if (this.isVertical) {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left + this._backgroundBoxThickness / 2, top, radius, Math.PI, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top, width, height);\r\n }\r\n else {\r\n context.fillRect(left, top, width, height + this._effectiveThumbThickness);\r\n }\r\n }\r\n else {\r\n context.fillRect(left, top, width, height);\r\n }\r\n }\r\n else {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left + this._backgroundBoxLength, top + (this._backgroundBoxThickness / 2), radius, 0, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top, width, height);\r\n }\r\n else {\r\n context.fillRect(left, top, width + this._effectiveThumbThickness, height);\r\n }\r\n }\r\n else {\r\n context.fillRect(left, top, width, height);\r\n }\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n // Value bar\r\n context.fillStyle = this.color;\r\n if (this._displayValueBar) {\r\n if (this.isVertical) {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left + this._backgroundBoxThickness / 2, top + this._backgroundBoxLength, radius, 0, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top + thumbPosition, width, height - thumbPosition);\r\n }\r\n else {\r\n context.fillRect(left, top + thumbPosition, width, height - thumbPosition + this._effectiveThumbThickness);\r\n }\r\n }\r\n else {\r\n context.fillRect(left, top + thumbPosition, width, height - thumbPosition);\r\n }\r\n }\r\n else {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left, top + this._backgroundBoxThickness / 2, radius, 0, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top, thumbPosition, height);\r\n }\r\n else {\r\n context.fillRect(left, top, thumbPosition, height);\r\n }\r\n }\r\n else {\r\n context.fillRect(left, top, thumbPosition, height);\r\n }\r\n }\r\n }\r\n // Thumb\r\n context.fillStyle = this._thumbColor || this.color;\r\n if (this.displayThumb) {\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n if (this._isThumbCircle) {\r\n context.beginPath();\r\n if (this.isVertical) {\r\n context.arc(left + this._backgroundBoxThickness / 2, top + thumbPosition, radius, 0, 2 * Math.PI);\r\n }\r\n else {\r\n context.arc(left + thumbPosition, top + (this._backgroundBoxThickness / 2), radius, 0, 2 * Math.PI);\r\n }\r\n context.fill();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n context.strokeStyle = this._borderColor;\r\n context.stroke();\r\n }\r\n else {\r\n if (this.isVertical) {\r\n context.fillRect(left - this._effectiveBarOffset, this._currentMeasure.top + thumbPosition, this._currentMeasure.width, this._effectiveThumbThickness);\r\n }\r\n else {\r\n context.fillRect(this._currentMeasure.left + thumbPosition, this._currentMeasure.top, this._effectiveThumbThickness, this._currentMeasure.height);\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n context.strokeStyle = this._borderColor;\r\n if (this.isVertical) {\r\n context.strokeRect(left - this._effectiveBarOffset, this._currentMeasure.top + thumbPosition, this._currentMeasure.width, this._effectiveThumbThickness);\r\n }\r\n else {\r\n context.strokeRect(this._currentMeasure.left + thumbPosition, this._currentMeasure.top, this._effectiveThumbThickness, this._currentMeasure.height);\r\n }\r\n }\r\n }\r\n context.restore();\r\n };\r\n return Slider;\r\n}(BaseSlider));\r\nexport { Slider };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Slider\"] = Slider;\r\n//# sourceMappingURL=slider.js.map","import { __extends } from \"tslib\";\r\nimport { Rectangle } from \"./rectangle\";\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { Control } from \"./control\";\r\nimport { TextBlock } from \"./textBlock\";\r\nimport { Checkbox } from \"./checkbox\";\r\nimport { RadioButton } from \"./radioButton\";\r\nimport { Slider } from \"./sliders/slider\";\r\nimport { Container } from \"./container\";\r\n/** Class used to create a RadioGroup\r\n * which contains groups of radio buttons\r\n*/\r\nvar SelectorGroup = /** @class */ (function () {\r\n /**\r\n * Creates a new SelectorGroup\r\n * @param name of group, used as a group heading\r\n */\r\n function SelectorGroup(\r\n /** name of SelectorGroup */\r\n name) {\r\n this.name = name;\r\n this._groupPanel = new StackPanel();\r\n this._selectors = new Array();\r\n this._groupPanel.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n this._groupPanel.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._groupHeader = this._addGroupHeader(name);\r\n }\r\n Object.defineProperty(SelectorGroup.prototype, \"groupPanel\", {\r\n /** Gets the groupPanel of the SelectorGroup */\r\n get: function () {\r\n return this._groupPanel;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SelectorGroup.prototype, \"selectors\", {\r\n /** Gets the selectors array */\r\n get: function () {\r\n return this._selectors;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SelectorGroup.prototype, \"header\", {\r\n /** Gets and sets the group header */\r\n get: function () {\r\n return this._groupHeader.text;\r\n },\r\n set: function (label) {\r\n if (this._groupHeader.text === \"label\") {\r\n return;\r\n }\r\n this._groupHeader.text = label;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n SelectorGroup.prototype._addGroupHeader = function (text) {\r\n var groupHeading = new TextBlock(\"groupHead\", text);\r\n groupHeading.width = 0.9;\r\n groupHeading.height = \"30px\";\r\n groupHeading.textWrapping = true;\r\n groupHeading.color = \"black\";\r\n groupHeading.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n groupHeading.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n groupHeading.left = \"2px\";\r\n this._groupPanel.addControl(groupHeading);\r\n return groupHeading;\r\n };\r\n /** @hidden*/\r\n SelectorGroup.prototype._getSelector = function (selectorNb) {\r\n if (selectorNb < 0 || selectorNb >= this._selectors.length) {\r\n return;\r\n }\r\n return this._selectors[selectorNb];\r\n };\r\n /** Removes the selector at the given position\r\n * @param selectorNb the position of the selector within the group\r\n */\r\n SelectorGroup.prototype.removeSelector = function (selectorNb) {\r\n if (selectorNb < 0 || selectorNb >= this._selectors.length) {\r\n return;\r\n }\r\n this._groupPanel.removeControl(this._selectors[selectorNb]);\r\n this._selectors.splice(selectorNb, 1);\r\n };\r\n return SelectorGroup;\r\n}());\r\nexport { SelectorGroup };\r\n/** Class used to create a CheckboxGroup\r\n * which contains groups of checkbox buttons\r\n*/\r\nvar CheckboxGroup = /** @class */ (function (_super) {\r\n __extends(CheckboxGroup, _super);\r\n function CheckboxGroup() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** Adds a checkbox as a control\r\n * @param text is the label for the selector\r\n * @param func is the function called when the Selector is checked\r\n * @param checked is true when Selector is checked\r\n */\r\n CheckboxGroup.prototype.addCheckbox = function (text, func, checked) {\r\n if (func === void 0) { func = function (s) { }; }\r\n if (checked === void 0) { checked = false; }\r\n var checked = checked || false;\r\n var button = new Checkbox();\r\n button.width = \"20px\";\r\n button.height = \"20px\";\r\n button.color = \"#364249\";\r\n button.background = \"#CCCCCC\";\r\n button.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n button.onIsCheckedChangedObservable.add(function (state) {\r\n func(state);\r\n });\r\n var _selector = Control.AddHeader(button, text, \"200px\", { isHorizontal: true, controlFirst: true });\r\n _selector.height = \"30px\";\r\n _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _selector.left = \"4px\";\r\n this.groupPanel.addControl(_selector);\r\n this.selectors.push(_selector);\r\n button.isChecked = checked;\r\n if (this.groupPanel.parent && this.groupPanel.parent.parent) {\r\n button.color = this.groupPanel.parent.parent.buttonColor;\r\n button.background = this.groupPanel.parent.parent.buttonBackground;\r\n }\r\n };\r\n /** @hidden */\r\n CheckboxGroup.prototype._setSelectorLabel = function (selectorNb, label) {\r\n this.selectors[selectorNb].children[1].text = label;\r\n };\r\n /** @hidden */\r\n CheckboxGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[1].color = color;\r\n };\r\n /** @hidden */\r\n CheckboxGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[0].color = color;\r\n };\r\n /** @hidden */\r\n CheckboxGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[0].background = color;\r\n };\r\n return CheckboxGroup;\r\n}(SelectorGroup));\r\nexport { CheckboxGroup };\r\n/** Class used to create a RadioGroup\r\n * which contains groups of radio buttons\r\n*/\r\nvar RadioGroup = /** @class */ (function (_super) {\r\n __extends(RadioGroup, _super);\r\n function RadioGroup() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._selectNb = 0;\r\n return _this;\r\n }\r\n /** Adds a radio button as a control\r\n * @param label is the label for the selector\r\n * @param func is the function called when the Selector is checked\r\n * @param checked is true when Selector is checked\r\n */\r\n RadioGroup.prototype.addRadio = function (label, func, checked) {\r\n if (func === void 0) { func = function (n) { }; }\r\n if (checked === void 0) { checked = false; }\r\n var nb = this._selectNb++;\r\n var button = new RadioButton();\r\n button.name = label;\r\n button.width = \"20px\";\r\n button.height = \"20px\";\r\n button.color = \"#364249\";\r\n button.background = \"#CCCCCC\";\r\n button.group = this.name;\r\n button.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n button.onIsCheckedChangedObservable.add(function (state) {\r\n if (state) {\r\n func(nb);\r\n }\r\n });\r\n var _selector = Control.AddHeader(button, label, \"200px\", { isHorizontal: true, controlFirst: true });\r\n _selector.height = \"30px\";\r\n _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _selector.left = \"4px\";\r\n this.groupPanel.addControl(_selector);\r\n this.selectors.push(_selector);\r\n button.isChecked = checked;\r\n if (this.groupPanel.parent && this.groupPanel.parent.parent) {\r\n button.color = this.groupPanel.parent.parent.buttonColor;\r\n button.background = this.groupPanel.parent.parent.buttonBackground;\r\n }\r\n };\r\n /** @hidden */\r\n RadioGroup.prototype._setSelectorLabel = function (selectorNb, label) {\r\n this.selectors[selectorNb].children[1].text = label;\r\n };\r\n /** @hidden */\r\n RadioGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[1].color = color;\r\n };\r\n /** @hidden */\r\n RadioGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[0].color = color;\r\n };\r\n /** @hidden */\r\n RadioGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[0].background = color;\r\n };\r\n return RadioGroup;\r\n}(SelectorGroup));\r\nexport { RadioGroup };\r\n/** Class used to create a SliderGroup\r\n * which contains groups of slider buttons\r\n*/\r\nvar SliderGroup = /** @class */ (function (_super) {\r\n __extends(SliderGroup, _super);\r\n function SliderGroup() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Adds a slider to the SelectorGroup\r\n * @param label is the label for the SliderBar\r\n * @param func is the function called when the Slider moves\r\n * @param unit is a string describing the units used, eg degrees or metres\r\n * @param min is the minimum value for the Slider\r\n * @param max is the maximum value for the Slider\r\n * @param value is the start value for the Slider between min and max\r\n * @param onValueChange is the function used to format the value displayed, eg radians to degrees\r\n */\r\n SliderGroup.prototype.addSlider = function (label, func, unit, min, max, value, onValueChange) {\r\n if (func === void 0) { func = function (v) { }; }\r\n if (unit === void 0) { unit = \"Units\"; }\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 0; }\r\n if (value === void 0) { value = 0; }\r\n if (onValueChange === void 0) { onValueChange = function (v) { return v | 0; }; }\r\n var button = new Slider();\r\n button.name = unit;\r\n button.value = value;\r\n button.minimum = min;\r\n button.maximum = max;\r\n button.width = 0.9;\r\n button.height = \"20px\";\r\n button.color = \"#364249\";\r\n button.background = \"#CCCCCC\";\r\n button.borderColor = \"black\";\r\n button.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n button.left = \"4px\";\r\n button.paddingBottom = \"4px\";\r\n button.onValueChangedObservable.add(function (value) {\r\n button.parent.children[0].text = button.parent.children[0].name + \": \" + onValueChange(value) + \" \" + button.name;\r\n func(value);\r\n });\r\n var _selector = Control.AddHeader(button, label + \": \" + onValueChange(value) + \" \" + unit, \"30px\", { isHorizontal: false, controlFirst: false });\r\n _selector.height = \"60px\";\r\n _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _selector.left = \"4px\";\r\n _selector.children[0].name = label;\r\n this.groupPanel.addControl(_selector);\r\n this.selectors.push(_selector);\r\n if (this.groupPanel.parent && this.groupPanel.parent.parent) {\r\n button.color = this.groupPanel.parent.parent.buttonColor;\r\n button.background = this.groupPanel.parent.parent.buttonBackground;\r\n }\r\n };\r\n /** @hidden */\r\n SliderGroup.prototype._setSelectorLabel = function (selectorNb, label) {\r\n this.selectors[selectorNb].children[0].name = label;\r\n this.selectors[selectorNb].children[0].text = label + \": \" + this.selectors[selectorNb].children[1].value + \" \" + this.selectors[selectorNb].children[1].name;\r\n };\r\n /** @hidden */\r\n SliderGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[0].color = color;\r\n };\r\n /** @hidden */\r\n SliderGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[1].color = color;\r\n };\r\n /** @hidden */\r\n SliderGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[1].background = color;\r\n };\r\n return SliderGroup;\r\n}(SelectorGroup));\r\nexport { SliderGroup };\r\n/** Class used to hold the controls for the checkboxes, radio buttons and sliders\r\n * @see https://doc.babylonjs.com/how_to/selector\r\n*/\r\nvar SelectionPanel = /** @class */ (function (_super) {\r\n __extends(SelectionPanel, _super);\r\n /**\r\n * Creates a new SelectionPanel\r\n * @param name of SelectionPanel\r\n * @param groups is an array of SelectionGroups\r\n */\r\n function SelectionPanel(\r\n /** name of SelectionPanel */\r\n name, \r\n /** an array of SelectionGroups */\r\n groups) {\r\n if (groups === void 0) { groups = []; }\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.groups = groups;\r\n _this._buttonColor = \"#364249\";\r\n _this._buttonBackground = \"#CCCCCC\";\r\n _this._headerColor = \"black\";\r\n _this._barColor = \"white\";\r\n _this._barHeight = \"2px\";\r\n _this._spacerHeight = \"20px\";\r\n _this._bars = new Array();\r\n _this._groups = groups;\r\n _this.thickness = 2;\r\n _this._panel = new StackPanel();\r\n _this._panel.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n _this._panel.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _this._panel.top = 5;\r\n _this._panel.left = 5;\r\n _this._panel.width = 0.95;\r\n if (groups.length > 0) {\r\n for (var i = 0; i < groups.length - 1; i++) {\r\n _this._panel.addControl(groups[i].groupPanel);\r\n _this._addSpacer();\r\n }\r\n _this._panel.addControl(groups[groups.length - 1].groupPanel);\r\n }\r\n _this.addControl(_this._panel);\r\n return _this;\r\n }\r\n SelectionPanel.prototype._getTypeName = function () {\r\n return \"SelectionPanel\";\r\n };\r\n Object.defineProperty(SelectionPanel.prototype, \"panel\", {\r\n /** Gets the (stack) panel of the SelectionPanel */\r\n get: function () {\r\n return this._panel;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SelectionPanel.prototype, \"headerColor\", {\r\n /** Gets or sets the headerColor */\r\n get: function () {\r\n return this._headerColor;\r\n },\r\n set: function (color) {\r\n if (this._headerColor === color) {\r\n return;\r\n }\r\n this._headerColor = color;\r\n this._setHeaderColor();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SelectionPanel.prototype._setHeaderColor = function () {\r\n for (var i = 0; i < this._groups.length; i++) {\r\n this._groups[i].groupPanel.children[0].color = this._headerColor;\r\n }\r\n };\r\n Object.defineProperty(SelectionPanel.prototype, \"buttonColor\", {\r\n /** Gets or sets the button color */\r\n get: function () {\r\n return this._buttonColor;\r\n },\r\n set: function (color) {\r\n if (this._buttonColor === color) {\r\n return;\r\n }\r\n this._buttonColor = color;\r\n this._setbuttonColor();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SelectionPanel.prototype._setbuttonColor = function () {\r\n for (var i = 0; i < this._groups.length; i++) {\r\n for (var j = 0; j < this._groups[i].selectors.length; j++) {\r\n this._groups[i]._setSelectorButtonColor(j, this._buttonColor);\r\n }\r\n }\r\n };\r\n Object.defineProperty(SelectionPanel.prototype, \"labelColor\", {\r\n /** Gets or sets the label color */\r\n get: function () {\r\n return this._labelColor;\r\n },\r\n set: function (color) {\r\n if (this._labelColor === color) {\r\n return;\r\n }\r\n this._labelColor = color;\r\n this._setLabelColor();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SelectionPanel.prototype._setLabelColor = function () {\r\n for (var i = 0; i < this._groups.length; i++) {\r\n for (var j = 0; j < this._groups[i].selectors.length; j++) {\r\n this._groups[i]._setSelectorLabelColor(j, this._labelColor);\r\n }\r\n }\r\n };\r\n Object.defineProperty(SelectionPanel.prototype, \"buttonBackground\", {\r\n /** Gets or sets the button background */\r\n get: function () {\r\n return this._buttonBackground;\r\n },\r\n set: function (color) {\r\n if (this._buttonBackground === color) {\r\n return;\r\n }\r\n this._buttonBackground = color;\r\n this._setButtonBackground();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SelectionPanel.prototype._setButtonBackground = function () {\r\n for (var i = 0; i < this._groups.length; i++) {\r\n for (var j = 0; j < this._groups[i].selectors.length; j++) {\r\n this._groups[i]._setSelectorButtonBackground(j, this._buttonBackground);\r\n }\r\n }\r\n };\r\n Object.defineProperty(SelectionPanel.prototype, \"barColor\", {\r\n /** Gets or sets the color of separator bar */\r\n get: function () {\r\n return this._barColor;\r\n },\r\n set: function (color) {\r\n if (this._barColor === color) {\r\n return;\r\n }\r\n this._barColor = color;\r\n this._setBarColor();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SelectionPanel.prototype._setBarColor = function () {\r\n for (var i = 0; i < this._bars.length; i++) {\r\n this._bars[i].children[0].background = this._barColor;\r\n }\r\n };\r\n Object.defineProperty(SelectionPanel.prototype, \"barHeight\", {\r\n /** Gets or sets the height of separator bar */\r\n get: function () {\r\n return this._barHeight;\r\n },\r\n set: function (value) {\r\n if (this._barHeight === value) {\r\n return;\r\n }\r\n this._barHeight = value;\r\n this._setBarHeight();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SelectionPanel.prototype._setBarHeight = function () {\r\n for (var i = 0; i < this._bars.length; i++) {\r\n this._bars[i].children[0].height = this._barHeight;\r\n }\r\n };\r\n Object.defineProperty(SelectionPanel.prototype, \"spacerHeight\", {\r\n /** Gets or sets the height of spacers*/\r\n get: function () {\r\n return this._spacerHeight;\r\n },\r\n set: function (value) {\r\n if (this._spacerHeight === value) {\r\n return;\r\n }\r\n this._spacerHeight = value;\r\n this._setSpacerHeight();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SelectionPanel.prototype._setSpacerHeight = function () {\r\n for (var i = 0; i < this._bars.length; i++) {\r\n this._bars[i].height = this._spacerHeight;\r\n }\r\n };\r\n /** Adds a bar between groups */\r\n SelectionPanel.prototype._addSpacer = function () {\r\n var separator = new Container();\r\n separator.width = 1;\r\n separator.height = this._spacerHeight;\r\n separator.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n var bar = new Rectangle();\r\n bar.width = 1;\r\n bar.height = this._barHeight;\r\n bar.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n bar.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n bar.background = this._barColor;\r\n bar.color = \"transparent\";\r\n separator.addControl(bar);\r\n this._panel.addControl(separator);\r\n this._bars.push(separator);\r\n };\r\n /** Add a group to the selection panel\r\n * @param group is the selector group to add\r\n */\r\n SelectionPanel.prototype.addGroup = function (group) {\r\n if (this._groups.length > 0) {\r\n this._addSpacer();\r\n }\r\n this._panel.addControl(group.groupPanel);\r\n this._groups.push(group);\r\n group.groupPanel.children[0].color = this._headerColor;\r\n for (var j = 0; j < group.selectors.length; j++) {\r\n group._setSelectorButtonColor(j, this._buttonColor);\r\n group._setSelectorButtonBackground(j, this._buttonBackground);\r\n }\r\n };\r\n /** Remove the group from the given position\r\n * @param groupNb is the position of the group in the list\r\n */\r\n SelectionPanel.prototype.removeGroup = function (groupNb) {\r\n if (groupNb < 0 || groupNb >= this._groups.length) {\r\n return;\r\n }\r\n var group = this._groups[groupNb];\r\n this._panel.removeControl(group.groupPanel);\r\n this._groups.splice(groupNb, 1);\r\n if (groupNb < this._bars.length) {\r\n this._panel.removeControl(this._bars[groupNb]);\r\n this._bars.splice(groupNb, 1);\r\n }\r\n };\r\n /** Change a group header label\r\n * @param label is the new group header label\r\n * @param groupNb is the number of the group to relabel\r\n * */\r\n SelectionPanel.prototype.setHeaderName = function (label, groupNb) {\r\n if (groupNb < 0 || groupNb >= this._groups.length) {\r\n return;\r\n }\r\n var group = this._groups[groupNb];\r\n group.groupPanel.children[0].text = label;\r\n };\r\n /** Change selector label to the one given\r\n * @param label is the new selector label\r\n * @param groupNb is the number of the groupcontaining the selector\r\n * @param selectorNb is the number of the selector within a group to relabel\r\n * */\r\n SelectionPanel.prototype.relabel = function (label, groupNb, selectorNb) {\r\n if (groupNb < 0 || groupNb >= this._groups.length) {\r\n return;\r\n }\r\n var group = this._groups[groupNb];\r\n if (selectorNb < 0 || selectorNb >= group.selectors.length) {\r\n return;\r\n }\r\n group._setSelectorLabel(selectorNb, label);\r\n };\r\n /** For a given group position remove the selector at the given position\r\n * @param groupNb is the number of the group to remove the selector from\r\n * @param selectorNb is the number of the selector within the group\r\n */\r\n SelectionPanel.prototype.removeFromGroupSelector = function (groupNb, selectorNb) {\r\n if (groupNb < 0 || groupNb >= this._groups.length) {\r\n return;\r\n }\r\n var group = this._groups[groupNb];\r\n if (selectorNb < 0 || selectorNb >= group.selectors.length) {\r\n return;\r\n }\r\n group.removeSelector(selectorNb);\r\n };\r\n /** For a given group position of correct type add a checkbox button\r\n * @param groupNb is the number of the group to remove the selector from\r\n * @param label is the label for the selector\r\n * @param func is the function called when the Selector is checked\r\n * @param checked is true when Selector is checked\r\n */\r\n SelectionPanel.prototype.addToGroupCheckbox = function (groupNb, label, func, checked) {\r\n if (func === void 0) { func = function () { }; }\r\n if (checked === void 0) { checked = false; }\r\n if (groupNb < 0 || groupNb >= this._groups.length) {\r\n return;\r\n }\r\n var group = this._groups[groupNb];\r\n group.addCheckbox(label, func, checked);\r\n };\r\n /** For a given group position of correct type add a radio button\r\n * @param groupNb is the number of the group to remove the selector from\r\n * @param label is the label for the selector\r\n * @param func is the function called when the Selector is checked\r\n * @param checked is true when Selector is checked\r\n */\r\n SelectionPanel.prototype.addToGroupRadio = function (groupNb, label, func, checked) {\r\n if (func === void 0) { func = function () { }; }\r\n if (checked === void 0) { checked = false; }\r\n if (groupNb < 0 || groupNb >= this._groups.length) {\r\n return;\r\n }\r\n var group = this._groups[groupNb];\r\n group.addRadio(label, func, checked);\r\n };\r\n /**\r\n * For a given slider group add a slider\r\n * @param groupNb is the number of the group to add the slider to\r\n * @param label is the label for the Slider\r\n * @param func is the function called when the Slider moves\r\n * @param unit is a string describing the units used, eg degrees or metres\r\n * @param min is the minimum value for the Slider\r\n * @param max is the maximum value for the Slider\r\n * @param value is the start value for the Slider between min and max\r\n * @param onVal is the function used to format the value displayed, eg radians to degrees\r\n */\r\n SelectionPanel.prototype.addToGroupSlider = function (groupNb, label, func, unit, min, max, value, onVal) {\r\n if (func === void 0) { func = function () { }; }\r\n if (unit === void 0) { unit = \"Units\"; }\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 0; }\r\n if (value === void 0) { value = 0; }\r\n if (onVal === void 0) { onVal = function (v) { return v | 0; }; }\r\n if (groupNb < 0 || groupNb >= this._groups.length) {\r\n return;\r\n }\r\n var group = this._groups[groupNb];\r\n group.addSlider(label, func, unit, min, max, value, onVal);\r\n };\r\n return SelectionPanel;\r\n}(Rectangle));\r\nexport { SelectionPanel };\r\n//# sourceMappingURL=selector.js.map","import { __extends } from \"tslib\";\r\nimport { Measure } from \"../../measure\";\r\nimport { Container } from \"../container\";\r\nimport { ValueAndUnit } from \"../../valueAndUnit\";\r\nimport { Control } from \"../control\";\r\n/**\r\n * Class used to hold a the container for ScrollViewer\r\n * @hidden\r\n*/\r\nvar _ScrollViewerWindow = /** @class */ (function (_super) {\r\n __extends(_ScrollViewerWindow, _super);\r\n /**\r\n * Creates a new ScrollViewerWindow\r\n * @param name of ScrollViewerWindow\r\n */\r\n function _ScrollViewerWindow(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this._freezeControls = false;\r\n _this._bucketWidth = 0;\r\n _this._bucketHeight = 0;\r\n _this._buckets = {};\r\n return _this;\r\n }\r\n Object.defineProperty(_ScrollViewerWindow.prototype, \"freezeControls\", {\r\n get: function () {\r\n return this._freezeControls;\r\n },\r\n set: function (value) {\r\n if (this._freezeControls === value) {\r\n return;\r\n }\r\n if (!value) {\r\n this._restoreMeasures();\r\n }\r\n // trigger a full normal layout calculation to be sure all children have their measures up to date\r\n this._freezeControls = false;\r\n var textureSize = this.host.getSize();\r\n var renderWidth = textureSize.width;\r\n var renderHeight = textureSize.height;\r\n var context = this.host.getContext();\r\n var measure = new Measure(0, 0, renderWidth, renderHeight);\r\n this.host._numLayoutCalls = 0;\r\n this.host._rootContainer._layout(measure, context);\r\n // in freeze mode, prepare children measures accordingly\r\n if (value) {\r\n this._updateMeasures();\r\n if (this._useBuckets()) {\r\n this._makeBuckets();\r\n }\r\n }\r\n this._freezeControls = value;\r\n this.host.markAsDirty(); // redraw with the (new) current settings\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ScrollViewerWindow.prototype, \"bucketWidth\", {\r\n get: function () {\r\n return this._bucketWidth;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ScrollViewerWindow.prototype, \"bucketHeight\", {\r\n get: function () {\r\n return this._bucketHeight;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n _ScrollViewerWindow.prototype.setBucketSizes = function (width, height) {\r\n this._bucketWidth = width;\r\n this._bucketHeight = height;\r\n if (this._useBuckets()) {\r\n if (this._freezeControls) {\r\n this._makeBuckets();\r\n }\r\n }\r\n else {\r\n this._buckets = {};\r\n }\r\n };\r\n _ScrollViewerWindow.prototype._useBuckets = function () {\r\n return this._bucketWidth > 0 && this._bucketHeight > 0;\r\n };\r\n _ScrollViewerWindow.prototype._makeBuckets = function () {\r\n this._buckets = {};\r\n this._bucketLen = Math.ceil(this.widthInPixels / this._bucketWidth);\r\n this._dispatchInBuckets(this._children);\r\n this._oldLeft = null;\r\n this._oldTop = null;\r\n };\r\n _ScrollViewerWindow.prototype._dispatchInBuckets = function (children) {\r\n for (var i = 0; i < children.length; ++i) {\r\n var child = children[i];\r\n var bStartX = Math.max(0, Math.floor((child._customData._origLeft - this._customData.origLeft) / this._bucketWidth)), bEndX = Math.floor((child._customData._origLeft - this._customData.origLeft + child._currentMeasure.width - 1) / this._bucketWidth), bStartY = Math.max(0, Math.floor((child._customData._origTop - this._customData.origTop) / this._bucketHeight)), bEndY = Math.floor((child._customData._origTop - this._customData.origTop + child._currentMeasure.height - 1) / this._bucketHeight);\r\n while (bStartY <= bEndY) {\r\n for (var x = bStartX; x <= bEndX; ++x) {\r\n var bucket = bStartY * this._bucketLen + x, lstc = this._buckets[bucket];\r\n if (!lstc) {\r\n lstc = [];\r\n this._buckets[bucket] = lstc;\r\n }\r\n lstc.push(child);\r\n }\r\n bStartY++;\r\n }\r\n if (child instanceof Container && child._children.length > 0) {\r\n this._dispatchInBuckets(child._children);\r\n }\r\n }\r\n };\r\n // reset left and top measures for the window and all its children\r\n _ScrollViewerWindow.prototype._updateMeasures = function () {\r\n var left = this.leftInPixels | 0, top = this.topInPixels | 0;\r\n this._measureForChildren.left -= left;\r\n this._measureForChildren.top -= top;\r\n this._currentMeasure.left -= left;\r\n this._currentMeasure.top -= top;\r\n this._customData.origLeftForChildren = this._measureForChildren.left;\r\n this._customData.origTopForChildren = this._measureForChildren.top;\r\n this._customData.origLeft = this._currentMeasure.left;\r\n this._customData.origTop = this._currentMeasure.top;\r\n this._updateChildrenMeasures(this._children, left, top);\r\n };\r\n _ScrollViewerWindow.prototype._updateChildrenMeasures = function (children, left, top) {\r\n for (var i = 0; i < children.length; ++i) {\r\n var child = children[i];\r\n child._currentMeasure.left -= left;\r\n child._currentMeasure.top -= top;\r\n child._customData._origLeft = child._currentMeasure.left; // save the original left and top values for each child\r\n child._customData._origTop = child._currentMeasure.top;\r\n if (child instanceof Container && child._children.length > 0) {\r\n this._updateChildrenMeasures(child._children, left, top);\r\n }\r\n }\r\n };\r\n _ScrollViewerWindow.prototype._restoreMeasures = function () {\r\n var left = this.leftInPixels | 0, top = this.topInPixels | 0;\r\n this._measureForChildren.left = this._customData.origLeftForChildren + left;\r\n this._measureForChildren.top = this._customData.origTopForChildren + top;\r\n this._currentMeasure.left = this._customData.origLeft + left;\r\n this._currentMeasure.top = this._customData.origTop + top;\r\n };\r\n _ScrollViewerWindow.prototype._getTypeName = function () {\r\n return \"ScrollViewerWindow\";\r\n };\r\n /** @hidden */\r\n _ScrollViewerWindow.prototype._additionalProcessing = function (parentMeasure, context) {\r\n _super.prototype._additionalProcessing.call(this, parentMeasure, context);\r\n this._parentMeasure = parentMeasure;\r\n this._measureForChildren.left = this._currentMeasure.left;\r\n this._measureForChildren.top = this._currentMeasure.top;\r\n this._measureForChildren.width = parentMeasure.width;\r\n this._measureForChildren.height = parentMeasure.height;\r\n };\r\n /** @hidden */\r\n _ScrollViewerWindow.prototype._layout = function (parentMeasure, context) {\r\n if (this._freezeControls) {\r\n this.invalidateRect(); // will trigger a redraw of the window\r\n return false;\r\n }\r\n return _super.prototype._layout.call(this, parentMeasure, context);\r\n };\r\n _ScrollViewerWindow.prototype._scrollChildren = function (children, left, top) {\r\n for (var i = 0; i < children.length; ++i) {\r\n var child = children[i];\r\n child._currentMeasure.left = child._customData._origLeft + left;\r\n child._currentMeasure.top = child._customData._origTop + top;\r\n child._isClipped = false; // clipping will be handled by _draw and the call to _intersectsRect()\r\n if (child instanceof Container && child._children.length > 0) {\r\n this._scrollChildren(child._children, left, top);\r\n }\r\n }\r\n };\r\n _ScrollViewerWindow.prototype._scrollChildrenWithBuckets = function (left, top, scrollLeft, scrollTop) {\r\n var bStartX = Math.max(0, Math.floor(-left / this._bucketWidth)), bEndX = Math.floor((-left + this._parentMeasure.width - 1) / this._bucketWidth), bStartY = Math.max(0, Math.floor(-top / this._bucketHeight)), bEndY = Math.floor((-top + this._parentMeasure.height - 1) / this._bucketHeight);\r\n while (bStartY <= bEndY) {\r\n for (var x = bStartX; x <= bEndX; ++x) {\r\n var bucket = bStartY * this._bucketLen + x, lstc = this._buckets[bucket];\r\n if (lstc) {\r\n for (var i = 0; i < lstc.length; ++i) {\r\n var child = lstc[i];\r\n child._currentMeasure.left = child._customData._origLeft + scrollLeft;\r\n child._currentMeasure.top = child._customData._origTop + scrollTop;\r\n child._isClipped = false; // clipping will be handled by _draw and the call to _intersectsRect()\r\n }\r\n }\r\n }\r\n bStartY++;\r\n }\r\n };\r\n /** @hidden */\r\n _ScrollViewerWindow.prototype._draw = function (context, invalidatedRectangle) {\r\n if (!this._freezeControls) {\r\n _super.prototype._draw.call(this, context, invalidatedRectangle);\r\n return;\r\n }\r\n this._localDraw(context);\r\n if (this.clipChildren) {\r\n this._clipForChildren(context);\r\n }\r\n var left = this.leftInPixels | 0, top = this.topInPixels | 0;\r\n if (this._useBuckets()) {\r\n if (this._oldLeft !== null && this._oldTop !== null) {\r\n this._scrollChildrenWithBuckets(this._oldLeft, this._oldTop, left, top);\r\n this._scrollChildrenWithBuckets(left, top, left, top);\r\n }\r\n else {\r\n this._scrollChildren(this._children, left, top);\r\n }\r\n }\r\n else {\r\n this._scrollChildren(this._children, left, top);\r\n }\r\n this._oldLeft = left;\r\n this._oldTop = top;\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (!child._intersectsRect(this._parentMeasure)) {\r\n continue;\r\n }\r\n child._render(context, this._parentMeasure);\r\n }\r\n };\r\n _ScrollViewerWindow.prototype._postMeasure = function () {\r\n if (this._freezeControls) {\r\n _super.prototype._postMeasure.call(this);\r\n return;\r\n }\r\n var maxWidth = this.parentClientWidth;\r\n var maxHeight = this.parentClientHeight;\r\n for (var _i = 0, _a = this.children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (!child.isVisible || child.notRenderable) {\r\n continue;\r\n }\r\n if (child.horizontalAlignment === Control.HORIZONTAL_ALIGNMENT_CENTER) {\r\n child._offsetLeft(this._currentMeasure.left - child._currentMeasure.left);\r\n }\r\n if (child.verticalAlignment === Control.VERTICAL_ALIGNMENT_CENTER) {\r\n child._offsetTop(this._currentMeasure.top - child._currentMeasure.top);\r\n }\r\n maxWidth = Math.max(maxWidth, child._currentMeasure.left - this._currentMeasure.left + child._currentMeasure.width + child.paddingRightInPixels);\r\n maxHeight = Math.max(maxHeight, child._currentMeasure.top - this._currentMeasure.top + child._currentMeasure.height + child.paddingBottomInPixels);\r\n }\r\n if (this._currentMeasure.width !== maxWidth) {\r\n this._width.updateInPlace(maxWidth, ValueAndUnit.UNITMODE_PIXEL);\r\n this._currentMeasure.width = maxWidth;\r\n this._rebuildLayout = true;\r\n this._isDirty = true;\r\n }\r\n if (this._currentMeasure.height !== maxHeight) {\r\n this._height.updateInPlace(maxHeight, ValueAndUnit.UNITMODE_PIXEL);\r\n this._currentMeasure.height = maxHeight;\r\n this._rebuildLayout = true;\r\n this._isDirty = true;\r\n }\r\n _super.prototype._postMeasure.call(this);\r\n };\r\n return _ScrollViewerWindow;\r\n}(Container));\r\nexport { _ScrollViewerWindow };\r\n//# sourceMappingURL=scrollViewerWindow.js.map","import { __extends } from \"tslib\";\r\nimport { BaseSlider } from \"./baseSlider\";\r\nimport { Measure } from \"../../measure\";\r\n/**\r\n * Class used to create slider controls\r\n */\r\nvar ScrollBar = /** @class */ (function (_super) {\r\n __extends(ScrollBar, _super);\r\n /**\r\n * Creates a new Slider\r\n * @param name defines the control name\r\n */\r\n function ScrollBar(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._background = \"black\";\r\n _this._borderColor = \"white\";\r\n _this._tempMeasure = new Measure(0, 0, 0, 0);\r\n return _this;\r\n }\r\n Object.defineProperty(ScrollBar.prototype, \"borderColor\", {\r\n /** Gets or sets border color */\r\n get: function () {\r\n return this._borderColor;\r\n },\r\n set: function (value) {\r\n if (this._borderColor === value) {\r\n return;\r\n }\r\n this._borderColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollBar.prototype, \"background\", {\r\n /** Gets or sets background color */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ScrollBar.prototype._getTypeName = function () {\r\n return \"Scrollbar\";\r\n };\r\n ScrollBar.prototype._getThumbThickness = function () {\r\n var thumbThickness = 0;\r\n if (this._thumbWidth.isPixel) {\r\n thumbThickness = this._thumbWidth.getValue(this._host);\r\n }\r\n else {\r\n thumbThickness = this._backgroundBoxThickness * this._thumbWidth.getValue(this._host);\r\n }\r\n return thumbThickness;\r\n };\r\n ScrollBar.prototype._draw = function (context) {\r\n context.save();\r\n this._applyStates(context);\r\n this._prepareRenderingData(\"rectangle\");\r\n var left = this._renderLeft;\r\n var thumbPosition = this._getThumbPosition();\r\n context.fillStyle = this._background;\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n // Value bar\r\n context.fillStyle = this.color;\r\n // Thumb\r\n if (this.isVertical) {\r\n this._tempMeasure.left = left - this._effectiveBarOffset;\r\n this._tempMeasure.top = this._currentMeasure.top + thumbPosition;\r\n this._tempMeasure.width = this._currentMeasure.width;\r\n this._tempMeasure.height = this._effectiveThumbThickness;\r\n }\r\n else {\r\n this._tempMeasure.left = this._currentMeasure.left + thumbPosition;\r\n this._tempMeasure.top = this._currentMeasure.top;\r\n this._tempMeasure.width = this._effectiveThumbThickness;\r\n this._tempMeasure.height = this._currentMeasure.height;\r\n }\r\n context.fillRect(this._tempMeasure.left, this._tempMeasure.top, this._tempMeasure.width, this._tempMeasure.height);\r\n context.restore();\r\n };\r\n /** @hidden */\r\n ScrollBar.prototype._updateValueFromPointer = function (x, y) {\r\n if (this.rotation != 0) {\r\n this._invertTransformMatrix.transformCoordinates(x, y, this._transformedPosition);\r\n x = this._transformedPosition.x;\r\n y = this._transformedPosition.y;\r\n }\r\n if (this._first) {\r\n this._first = false;\r\n this._originX = x;\r\n this._originY = y;\r\n // Check if move is required\r\n if (x < this._tempMeasure.left || x > this._tempMeasure.left + this._tempMeasure.width || y < this._tempMeasure.top || y > this._tempMeasure.top + this._tempMeasure.height) {\r\n if (this.isVertical) {\r\n this.value = this.minimum + (1 - ((y - this._currentMeasure.top) / this._currentMeasure.height)) * (this.maximum - this.minimum);\r\n }\r\n else {\r\n this.value = this.minimum + ((x - this._currentMeasure.left) / this._currentMeasure.width) * (this.maximum - this.minimum);\r\n }\r\n }\r\n }\r\n // Delta mode\r\n var delta = 0;\r\n if (this.isVertical) {\r\n delta = -((y - this._originY) / (this._currentMeasure.height - this._effectiveThumbThickness));\r\n }\r\n else {\r\n delta = (x - this._originX) / (this._currentMeasure.width - this._effectiveThumbThickness);\r\n }\r\n this.value += delta * (this.maximum - this.minimum);\r\n this._originX = x;\r\n this._originY = y;\r\n };\r\n ScrollBar.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n this._first = true;\r\n return _super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi);\r\n };\r\n return ScrollBar;\r\n}(BaseSlider));\r\nexport { ScrollBar };\r\n//# sourceMappingURL=scrollBar.js.map","import { __extends } from \"tslib\";\r\nimport { BaseSlider } from \"./baseSlider\";\r\nimport { Measure } from \"../../measure\";\r\n/**\r\n * Class used to create slider controls\r\n */\r\nvar ImageScrollBar = /** @class */ (function (_super) {\r\n __extends(ImageScrollBar, _super);\r\n /**\r\n * Creates a new ImageScrollBar\r\n * @param name defines the control name\r\n */\r\n function ImageScrollBar(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._thumbLength = 0.5;\r\n _this._thumbHeight = 1;\r\n _this._barImageHeight = 1;\r\n _this._tempMeasure = new Measure(0, 0, 0, 0);\r\n /** Number of 90° rotation to apply on the images when in vertical mode */\r\n _this.num90RotationInVerticalMode = 1;\r\n return _this;\r\n }\r\n Object.defineProperty(ImageScrollBar.prototype, \"backgroundImage\", {\r\n /**\r\n * Gets or sets the image used to render the background for horizontal bar\r\n */\r\n get: function () {\r\n return this._backgroundBaseImage;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._backgroundBaseImage === value) {\r\n return;\r\n }\r\n this._backgroundBaseImage = value;\r\n if (this.isVertical && this.num90RotationInVerticalMode !== 0) {\r\n if (!value.isLoaded) {\r\n value.onImageLoadedObservable.addOnce(function () {\r\n var rotatedValue = value._rotate90(_this.num90RotationInVerticalMode, true);\r\n _this._backgroundImage = rotatedValue;\r\n if (!rotatedValue.isLoaded) {\r\n rotatedValue.onImageLoadedObservable.addOnce(function () {\r\n _this._markAsDirty();\r\n });\r\n }\r\n _this._markAsDirty();\r\n });\r\n }\r\n else {\r\n this._backgroundImage = value._rotate90(this.num90RotationInVerticalMode, true);\r\n this._markAsDirty();\r\n }\r\n }\r\n else {\r\n this._backgroundImage = value;\r\n if (value && !value.isLoaded) {\r\n value.onImageLoadedObservable.addOnce(function () {\r\n _this._markAsDirty();\r\n });\r\n }\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageScrollBar.prototype, \"thumbImage\", {\r\n /**\r\n * Gets or sets the image used to render the thumb\r\n */\r\n get: function () {\r\n return this._thumbBaseImage;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._thumbBaseImage === value) {\r\n return;\r\n }\r\n this._thumbBaseImage = value;\r\n if (this.isVertical && this.num90RotationInVerticalMode !== 0) {\r\n if (!value.isLoaded) {\r\n value.onImageLoadedObservable.addOnce(function () {\r\n var rotatedValue = value._rotate90(-_this.num90RotationInVerticalMode, true);\r\n _this._thumbImage = rotatedValue;\r\n if (!rotatedValue.isLoaded) {\r\n rotatedValue.onImageLoadedObservable.addOnce(function () {\r\n _this._markAsDirty();\r\n });\r\n }\r\n _this._markAsDirty();\r\n });\r\n }\r\n else {\r\n this._thumbImage = value._rotate90(-this.num90RotationInVerticalMode, true);\r\n this._markAsDirty();\r\n }\r\n }\r\n else {\r\n this._thumbImage = value;\r\n if (value && !value.isLoaded) {\r\n value.onImageLoadedObservable.addOnce(function () {\r\n _this._markAsDirty();\r\n });\r\n }\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageScrollBar.prototype, \"thumbLength\", {\r\n /**\r\n * Gets or sets the length of the thumb\r\n */\r\n get: function () {\r\n return this._thumbLength;\r\n },\r\n set: function (value) {\r\n if (this._thumbLength === value) {\r\n return;\r\n }\r\n this._thumbLength = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageScrollBar.prototype, \"thumbHeight\", {\r\n /**\r\n * Gets or sets the height of the thumb\r\n */\r\n get: function () {\r\n return this._thumbHeight;\r\n },\r\n set: function (value) {\r\n if (this._thumbLength === value) {\r\n return;\r\n }\r\n this._thumbHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageScrollBar.prototype, \"barImageHeight\", {\r\n /**\r\n * Gets or sets the height of the bar image\r\n */\r\n get: function () {\r\n return this._barImageHeight;\r\n },\r\n set: function (value) {\r\n if (this._barImageHeight === value) {\r\n return;\r\n }\r\n this._barImageHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ImageScrollBar.prototype._getTypeName = function () {\r\n return \"ImageScrollBar\";\r\n };\r\n ImageScrollBar.prototype._getThumbThickness = function () {\r\n var thumbThickness = 0;\r\n if (this._thumbWidth.isPixel) {\r\n thumbThickness = this._thumbWidth.getValue(this._host);\r\n }\r\n else {\r\n thumbThickness = this._backgroundBoxThickness * this._thumbWidth.getValue(this._host);\r\n }\r\n return thumbThickness;\r\n };\r\n ImageScrollBar.prototype._draw = function (context) {\r\n context.save();\r\n this._applyStates(context);\r\n this._prepareRenderingData(\"rectangle\");\r\n var thumbPosition = this._getThumbPosition();\r\n var left = this._renderLeft;\r\n var top = this._renderTop;\r\n var width = this._renderWidth;\r\n var height = this._renderHeight;\r\n // Background\r\n if (this._backgroundImage) {\r\n this._tempMeasure.copyFromFloats(left, top, width, height);\r\n if (this.isVertical) {\r\n this._tempMeasure.copyFromFloats(left + width * (1 - this._barImageHeight) * 0.5, this._currentMeasure.top, width * this._barImageHeight, height);\r\n this._tempMeasure.height += this._effectiveThumbThickness;\r\n this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure);\r\n }\r\n else {\r\n this._tempMeasure.copyFromFloats(this._currentMeasure.left, top + height * (1 - this._barImageHeight) * 0.5, width, height * this._barImageHeight);\r\n this._tempMeasure.width += this._effectiveThumbThickness;\r\n this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure);\r\n }\r\n this._backgroundImage._draw(context);\r\n }\r\n // Thumb\r\n if (this.isVertical) {\r\n this._tempMeasure.copyFromFloats(left - this._effectiveBarOffset + this._currentMeasure.width * (1 - this._thumbHeight) * 0.5, this._currentMeasure.top + thumbPosition, this._currentMeasure.width * this._thumbHeight, this._effectiveThumbThickness);\r\n }\r\n else {\r\n this._tempMeasure.copyFromFloats(this._currentMeasure.left + thumbPosition, this._currentMeasure.top + this._currentMeasure.height * (1 - this._thumbHeight) * 0.5, this._effectiveThumbThickness, this._currentMeasure.height * this._thumbHeight);\r\n }\r\n if (this._thumbImage) {\r\n this._thumbImage._currentMeasure.copyFrom(this._tempMeasure);\r\n this._thumbImage._draw(context);\r\n }\r\n context.restore();\r\n };\r\n /** @hidden */\r\n ImageScrollBar.prototype._updateValueFromPointer = function (x, y) {\r\n if (this.rotation != 0) {\r\n this._invertTransformMatrix.transformCoordinates(x, y, this._transformedPosition);\r\n x = this._transformedPosition.x;\r\n y = this._transformedPosition.y;\r\n }\r\n if (this._first) {\r\n this._first = false;\r\n this._originX = x;\r\n this._originY = y;\r\n // Check if move is required\r\n if (x < this._tempMeasure.left || x > this._tempMeasure.left + this._tempMeasure.width || y < this._tempMeasure.top || y > this._tempMeasure.top + this._tempMeasure.height) {\r\n if (this.isVertical) {\r\n this.value = this.minimum + (1 - ((y - this._currentMeasure.top) / this._currentMeasure.height)) * (this.maximum - this.minimum);\r\n }\r\n else {\r\n this.value = this.minimum + ((x - this._currentMeasure.left) / this._currentMeasure.width) * (this.maximum - this.minimum);\r\n }\r\n }\r\n }\r\n // Delta mode\r\n var delta = 0;\r\n if (this.isVertical) {\r\n delta = -((y - this._originY) / (this._currentMeasure.height - this._effectiveThumbThickness));\r\n }\r\n else {\r\n delta = (x - this._originX) / (this._currentMeasure.width - this._effectiveThumbThickness);\r\n }\r\n this.value += delta * (this.maximum - this.minimum);\r\n this._originX = x;\r\n this._originY = y;\r\n };\r\n ImageScrollBar.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n this._first = true;\r\n return _super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi);\r\n };\r\n return ImageScrollBar;\r\n}(BaseSlider));\r\nexport { ImageScrollBar };\r\n//# sourceMappingURL=imageScrollBar.js.map","import { __extends } from \"tslib\";\r\nimport { Rectangle } from \"../rectangle\";\r\nimport { Grid } from \"../grid\";\r\nimport { Control } from \"../control\";\r\nimport { _ScrollViewerWindow } from \"./scrollViewerWindow\";\r\nimport { ScrollBar } from \"../sliders/scrollBar\";\r\nimport { ImageScrollBar } from \"../sliders/imageScrollBar\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to hold a viewer window and sliders in a grid\r\n*/\r\nvar ScrollViewer = /** @class */ (function (_super) {\r\n __extends(ScrollViewer, _super);\r\n /**\r\n * Creates a new ScrollViewer\r\n * @param name of ScrollViewer\r\n */\r\n function ScrollViewer(name, isImageBased) {\r\n var _this = _super.call(this, name) || this;\r\n _this._barSize = 20;\r\n _this._pointerIsOver = false;\r\n _this._wheelPrecision = 0.05;\r\n _this._thumbLength = 0.5;\r\n _this._thumbHeight = 1;\r\n _this._barImageHeight = 1;\r\n _this._horizontalBarImageHeight = 1;\r\n _this._verticalBarImageHeight = 1;\r\n _this._oldWindowContentsWidth = 0;\r\n _this._oldWindowContentsHeight = 0;\r\n _this._forceHorizontalBar = false;\r\n _this._forceVerticalBar = false;\r\n _this._useImageBar = isImageBased ? isImageBased : false;\r\n _this.onDirtyObservable.add(function () {\r\n _this._horizontalBarSpace.color = _this.color;\r\n _this._verticalBarSpace.color = _this.color;\r\n _this._dragSpace.color = _this.color;\r\n });\r\n _this.onPointerEnterObservable.add(function () {\r\n _this._pointerIsOver = true;\r\n });\r\n _this.onPointerOutObservable.add(function () {\r\n _this._pointerIsOver = false;\r\n });\r\n _this._grid = new Grid();\r\n if (_this._useImageBar) {\r\n _this._horizontalBar = new ImageScrollBar();\r\n _this._verticalBar = new ImageScrollBar();\r\n }\r\n else {\r\n _this._horizontalBar = new ScrollBar();\r\n _this._verticalBar = new ScrollBar();\r\n }\r\n _this._window = new _ScrollViewerWindow(\"scrollViewer_window\");\r\n _this._window.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _this._window.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n _this._grid.addColumnDefinition(1);\r\n _this._grid.addColumnDefinition(0, true);\r\n _this._grid.addRowDefinition(1);\r\n _this._grid.addRowDefinition(0, true);\r\n _super.prototype.addControl.call(_this, _this._grid);\r\n _this._grid.addControl(_this._window, 0, 0);\r\n _this._verticalBarSpace = new Rectangle();\r\n _this._verticalBarSpace.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _this._verticalBarSpace.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n _this._verticalBarSpace.thickness = 1;\r\n _this._grid.addControl(_this._verticalBarSpace, 0, 1);\r\n _this._addBar(_this._verticalBar, _this._verticalBarSpace, true, Math.PI);\r\n _this._horizontalBarSpace = new Rectangle();\r\n _this._horizontalBarSpace.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _this._horizontalBarSpace.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n _this._horizontalBarSpace.thickness = 1;\r\n _this._grid.addControl(_this._horizontalBarSpace, 1, 0);\r\n _this._addBar(_this._horizontalBar, _this._horizontalBarSpace, false, 0);\r\n _this._dragSpace = new Rectangle();\r\n _this._dragSpace.thickness = 1;\r\n _this._grid.addControl(_this._dragSpace, 1, 1);\r\n // Colors\r\n if (!_this._useImageBar) {\r\n _this.barColor = \"grey\";\r\n _this.barBackground = \"transparent\";\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(ScrollViewer.prototype, \"horizontalBar\", {\r\n /**\r\n * Gets the horizontal scrollbar\r\n */\r\n get: function () {\r\n return this._horizontalBar;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"verticalBar\", {\r\n /**\r\n * Gets the vertical scrollbar\r\n */\r\n get: function () {\r\n return this._verticalBar;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Adds a new control to the current container\r\n * @param control defines the control to add\r\n * @returns the current container\r\n */\r\n ScrollViewer.prototype.addControl = function (control) {\r\n if (!control) {\r\n return this;\r\n }\r\n this._window.addControl(control);\r\n return this;\r\n };\r\n /**\r\n * Removes a control from the current container\r\n * @param control defines the control to remove\r\n * @returns the current container\r\n */\r\n ScrollViewer.prototype.removeControl = function (control) {\r\n this._window.removeControl(control);\r\n return this;\r\n };\r\n Object.defineProperty(ScrollViewer.prototype, \"children\", {\r\n /** Gets the list of children */\r\n get: function () {\r\n return this._window.children;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ScrollViewer.prototype._flagDescendantsAsMatrixDirty = function () {\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._markMatrixAsDirty();\r\n }\r\n };\r\n Object.defineProperty(ScrollViewer.prototype, \"freezeControls\", {\r\n /**\r\n * Freezes or unfreezes the controls in the window.\r\n * When controls are frozen, the scroll viewer can render a lot more quickly but updates to positions/sizes of controls\r\n * are not taken into account. If you want to change positions/sizes, unfreeze, perform the changes then freeze again\r\n */\r\n get: function () {\r\n return this._window.freezeControls;\r\n },\r\n set: function (value) {\r\n this._window.freezeControls = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"bucketWidth\", {\r\n /** Gets the bucket width */\r\n get: function () {\r\n return this._window.bucketWidth;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"bucketHeight\", {\r\n /** Gets the bucket height */\r\n get: function () {\r\n return this._window.bucketHeight;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the bucket sizes.\r\n * When freezeControls is true, setting a non-zero bucket size will improve performances by updating only\r\n * controls that are visible. The bucket sizes is used to subdivide (internally) the window area to smaller areas into which\r\n * controls are dispatched. So, the size should be roughly equals to the mean size of all the controls of\r\n * the window. To disable the usage of buckets, sets either width or height (or both) to 0.\r\n * Please note that using this option will raise the memory usage (the higher the bucket sizes, the less memory\r\n * used), that's why it is not enabled by default.\r\n * @param width width of the bucket\r\n * @param height height of the bucket\r\n */\r\n ScrollViewer.prototype.setBucketSizes = function (width, height) {\r\n this._window.setBucketSizes(width, height);\r\n };\r\n Object.defineProperty(ScrollViewer.prototype, \"forceHorizontalBar\", {\r\n /**\r\n * Forces the horizontal scroll bar to be displayed\r\n */\r\n get: function () {\r\n return this._forceHorizontalBar;\r\n },\r\n set: function (value) {\r\n this._grid.setRowDefinition(1, value ? this._barSize : 0, true);\r\n this._horizontalBar.isVisible = value;\r\n this._forceHorizontalBar = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"forceVerticalBar\", {\r\n /**\r\n * Forces the vertical scroll bar to be displayed\r\n */\r\n get: function () {\r\n return this._forceVerticalBar;\r\n },\r\n set: function (value) {\r\n this._grid.setColumnDefinition(1, value ? this._barSize : 0, true);\r\n this._verticalBar.isVisible = value;\r\n this._forceVerticalBar = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** Reset the scroll viewer window to initial size */\r\n ScrollViewer.prototype.resetWindow = function () {\r\n this._window.width = \"100%\";\r\n this._window.height = \"100%\";\r\n };\r\n ScrollViewer.prototype._getTypeName = function () {\r\n return \"ScrollViewer\";\r\n };\r\n ScrollViewer.prototype._buildClientSizes = function () {\r\n var ratio = this.host.idealRatio;\r\n this._window.parentClientWidth = this._currentMeasure.width - (this._verticalBar.isVisible || this.forceVerticalBar ? this._barSize * ratio : 0) - 2 * this.thickness;\r\n this._window.parentClientHeight = this._currentMeasure.height - (this._horizontalBar.isVisible || this.forceHorizontalBar ? this._barSize * ratio : 0) - 2 * this.thickness;\r\n this._clientWidth = this._window.parentClientWidth;\r\n this._clientHeight = this._window.parentClientHeight;\r\n };\r\n ScrollViewer.prototype._additionalProcessing = function (parentMeasure, context) {\r\n _super.prototype._additionalProcessing.call(this, parentMeasure, context);\r\n this._buildClientSizes();\r\n };\r\n ScrollViewer.prototype._postMeasure = function () {\r\n _super.prototype._postMeasure.call(this);\r\n this._updateScroller();\r\n this._setWindowPosition(false);\r\n };\r\n Object.defineProperty(ScrollViewer.prototype, \"wheelPrecision\", {\r\n /**\r\n * Gets or sets the mouse wheel precision\r\n * from 0 to 1 with a default value of 0.05\r\n * */\r\n get: function () {\r\n return this._wheelPrecision;\r\n },\r\n set: function (value) {\r\n if (this._wheelPrecision === value) {\r\n return;\r\n }\r\n if (value < 0) {\r\n value = 0;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._wheelPrecision = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"scrollBackground\", {\r\n /** Gets or sets the scroll bar container background color */\r\n get: function () {\r\n return this._horizontalBarSpace.background;\r\n },\r\n set: function (color) {\r\n if (this._horizontalBarSpace.background === color) {\r\n return;\r\n }\r\n this._horizontalBarSpace.background = color;\r\n this._verticalBarSpace.background = color;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"barColor\", {\r\n /** Gets or sets the bar color */\r\n get: function () {\r\n return this._barColor;\r\n },\r\n set: function (color) {\r\n if (this._barColor === color) {\r\n return;\r\n }\r\n this._barColor = color;\r\n this._horizontalBar.color = color;\r\n this._verticalBar.color = color;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"thumbImage\", {\r\n /** Gets or sets the bar image */\r\n get: function () {\r\n return this._barImage;\r\n },\r\n set: function (value) {\r\n if (this._barImage === value) {\r\n return;\r\n }\r\n this._barImage = value;\r\n var hb = this._horizontalBar;\r\n var vb = this._verticalBar;\r\n hb.thumbImage = value;\r\n vb.thumbImage = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"horizontalThumbImage\", {\r\n /** Gets or sets the horizontal bar image */\r\n get: function () {\r\n return this._horizontalBarImage;\r\n },\r\n set: function (value) {\r\n if (this._horizontalBarImage === value) {\r\n return;\r\n }\r\n this._horizontalBarImage = value;\r\n var hb = this._horizontalBar;\r\n hb.thumbImage = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"verticalThumbImage\", {\r\n /** Gets or sets the vertical bar image */\r\n get: function () {\r\n return this._verticalBarImage;\r\n },\r\n set: function (value) {\r\n if (this._verticalBarImage === value) {\r\n return;\r\n }\r\n this._verticalBarImage = value;\r\n var vb = this._verticalBar;\r\n vb.thumbImage = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"barSize\", {\r\n /** Gets or sets the size of the bar */\r\n get: function () {\r\n return this._barSize;\r\n },\r\n set: function (value) {\r\n if (this._barSize === value) {\r\n return;\r\n }\r\n this._barSize = value;\r\n this._markAsDirty();\r\n if (this._horizontalBar.isVisible) {\r\n this._grid.setRowDefinition(1, this._barSize, true);\r\n }\r\n if (this._verticalBar.isVisible) {\r\n this._grid.setColumnDefinition(1, this._barSize, true);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"thumbLength\", {\r\n /** Gets or sets the length of the thumb */\r\n get: function () {\r\n return this._thumbLength;\r\n },\r\n set: function (value) {\r\n if (this._thumbLength === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._thumbLength = value;\r\n var hb = this._horizontalBar;\r\n var vb = this._verticalBar;\r\n hb.thumbLength = value;\r\n vb.thumbLength = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"thumbHeight\", {\r\n /** Gets or sets the height of the thumb */\r\n get: function () {\r\n return this._thumbHeight;\r\n },\r\n set: function (value) {\r\n if (this._thumbHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._thumbHeight = value;\r\n var hb = this._horizontalBar;\r\n var vb = this._verticalBar;\r\n hb.thumbHeight = value;\r\n vb.thumbHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"barImageHeight\", {\r\n /** Gets or sets the height of the bar image */\r\n get: function () {\r\n return this._barImageHeight;\r\n },\r\n set: function (value) {\r\n if (this._barImageHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._barImageHeight = value;\r\n var hb = this._horizontalBar;\r\n var vb = this._verticalBar;\r\n hb.barImageHeight = value;\r\n vb.barImageHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"horizontalBarImageHeight\", {\r\n /** Gets or sets the height of the horizontal bar image */\r\n get: function () {\r\n return this._horizontalBarImageHeight;\r\n },\r\n set: function (value) {\r\n if (this._horizontalBarImageHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._horizontalBarImageHeight = value;\r\n var hb = this._horizontalBar;\r\n hb.barImageHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"verticalBarImageHeight\", {\r\n /** Gets or sets the height of the vertical bar image */\r\n get: function () {\r\n return this._verticalBarImageHeight;\r\n },\r\n set: function (value) {\r\n if (this._verticalBarImageHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._verticalBarImageHeight = value;\r\n var vb = this._verticalBar;\r\n vb.barImageHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"barBackground\", {\r\n /** Gets or sets the bar background */\r\n get: function () {\r\n return this._barBackground;\r\n },\r\n set: function (color) {\r\n if (this._barBackground === color) {\r\n return;\r\n }\r\n this._barBackground = color;\r\n var hb = this._horizontalBar;\r\n var vb = this._verticalBar;\r\n hb.background = color;\r\n vb.background = color;\r\n this._dragSpace.background = color;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"barImage\", {\r\n /** Gets or sets the bar background image */\r\n get: function () {\r\n return this._barBackgroundImage;\r\n },\r\n set: function (value) {\r\n if (this._barBackgroundImage === value) {\r\n }\r\n this._barBackgroundImage = value;\r\n var hb = this._horizontalBar;\r\n var vb = this._verticalBar;\r\n hb.backgroundImage = value;\r\n vb.backgroundImage = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"horizontalBarImage\", {\r\n /** Gets or sets the horizontal bar background image */\r\n get: function () {\r\n return this._horizontalBarBackgroundImage;\r\n },\r\n set: function (value) {\r\n if (this._horizontalBarBackgroundImage === value) {\r\n }\r\n this._horizontalBarBackgroundImage = value;\r\n var hb = this._horizontalBar;\r\n hb.backgroundImage = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"verticalBarImage\", {\r\n /** Gets or sets the vertical bar background image */\r\n get: function () {\r\n return this._verticalBarBackgroundImage;\r\n },\r\n set: function (value) {\r\n if (this._verticalBarBackgroundImage === value) {\r\n }\r\n this._verticalBarBackgroundImage = value;\r\n var vb = this._verticalBar;\r\n vb.backgroundImage = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ScrollViewer.prototype._setWindowPosition = function (force) {\r\n if (force === void 0) { force = true; }\r\n var ratio = this.host.idealRatio;\r\n var windowContentsWidth = this._window._currentMeasure.width;\r\n var windowContentsHeight = this._window._currentMeasure.height;\r\n if (!force && this._oldWindowContentsWidth === windowContentsWidth && this._oldWindowContentsHeight === windowContentsHeight) {\r\n return;\r\n }\r\n this._oldWindowContentsWidth = windowContentsWidth;\r\n this._oldWindowContentsHeight = windowContentsHeight;\r\n var _endLeft = this._clientWidth - windowContentsWidth;\r\n var _endTop = this._clientHeight - windowContentsHeight;\r\n var newLeft = (this._horizontalBar.value / ratio) * _endLeft + \"px\";\r\n var newTop = (this._verticalBar.value / ratio) * _endTop + \"px\";\r\n if (newLeft !== this._window.left) {\r\n this._window.left = newLeft;\r\n if (!this.freezeControls) {\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n if (newTop !== this._window.top) {\r\n this._window.top = newTop;\r\n if (!this.freezeControls) {\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n ScrollViewer.prototype._updateScroller = function () {\r\n var windowContentsWidth = this._window._currentMeasure.width;\r\n var windowContentsHeight = this._window._currentMeasure.height;\r\n if (this._horizontalBar.isVisible && windowContentsWidth <= this._clientWidth && !this.forceHorizontalBar) {\r\n this._grid.setRowDefinition(1, 0, true);\r\n this._horizontalBar.isVisible = false;\r\n this._horizontalBar.value = 0;\r\n this._rebuildLayout = true;\r\n }\r\n else if (!this._horizontalBar.isVisible && (windowContentsWidth > this._clientWidth || this.forceHorizontalBar)) {\r\n this._grid.setRowDefinition(1, this._barSize, true);\r\n this._horizontalBar.isVisible = true;\r\n this._rebuildLayout = true;\r\n }\r\n if (this._verticalBar.isVisible && windowContentsHeight <= this._clientHeight && !this.forceVerticalBar) {\r\n this._grid.setColumnDefinition(1, 0, true);\r\n this._verticalBar.isVisible = false;\r\n this._verticalBar.value = 0;\r\n this._rebuildLayout = true;\r\n }\r\n else if (!this._verticalBar.isVisible && (windowContentsHeight > this._clientHeight || this.forceVerticalBar)) {\r\n this._grid.setColumnDefinition(1, this._barSize, true);\r\n this._verticalBar.isVisible = true;\r\n this._rebuildLayout = true;\r\n }\r\n this._buildClientSizes();\r\n var ratio = this.host.idealRatio;\r\n this._horizontalBar.thumbWidth = this._thumbLength * 0.9 * (this._clientWidth / ratio) + \"px\";\r\n this._verticalBar.thumbWidth = this._thumbLength * 0.9 * (this._clientHeight / ratio) + \"px\";\r\n };\r\n ScrollViewer.prototype._link = function (host) {\r\n _super.prototype._link.call(this, host);\r\n this._attachWheel();\r\n };\r\n /** @hidden */\r\n ScrollViewer.prototype._addBar = function (barControl, barContainer, isVertical, rotation) {\r\n var _this = this;\r\n barControl.paddingLeft = 0;\r\n barControl.width = \"100%\";\r\n barControl.height = \"100%\";\r\n barControl.barOffset = 0;\r\n barControl.value = 0;\r\n barControl.maximum = 1;\r\n barControl.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n barControl.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n barControl.isVertical = isVertical;\r\n barControl.rotation = rotation;\r\n barControl.isVisible = false;\r\n barContainer.addControl(barControl);\r\n barControl.onValueChangedObservable.add(function (value) {\r\n _this._setWindowPosition();\r\n });\r\n };\r\n /** @hidden */\r\n ScrollViewer.prototype._attachWheel = function () {\r\n var _this = this;\r\n if (!this._host || this._onWheelObserver) {\r\n return;\r\n }\r\n this._onWheelObserver = this.onWheelObservable.add(function (pi) {\r\n if (!_this._pointerIsOver) {\r\n return;\r\n }\r\n if (_this._verticalBar.isVisible == true) {\r\n if (pi.y < 0 && _this._verticalBar.value > 0) {\r\n _this._verticalBar.value -= _this._wheelPrecision;\r\n }\r\n else if (pi.y > 0 && _this._verticalBar.value < _this._verticalBar.maximum) {\r\n _this._verticalBar.value += _this._wheelPrecision;\r\n }\r\n }\r\n if (_this._horizontalBar.isVisible == true) {\r\n if (pi.x < 0 && _this._horizontalBar.value < _this._horizontalBar.maximum) {\r\n _this._horizontalBar.value += _this._wheelPrecision;\r\n }\r\n else if (pi.x > 0 && _this._horizontalBar.value > 0) {\r\n _this._horizontalBar.value -= _this._wheelPrecision;\r\n }\r\n }\r\n });\r\n };\r\n ScrollViewer.prototype._renderHighlightSpecific = function (context) {\r\n if (!this.isHighlighted) {\r\n return;\r\n }\r\n _super.prototype._renderHighlightSpecific.call(this, context);\r\n this._grid._renderHighlightSpecific(context);\r\n context.restore();\r\n };\r\n /** Releases associated resources */\r\n ScrollViewer.prototype.dispose = function () {\r\n this.onWheelObservable.remove(this._onWheelObserver);\r\n this._onWheelObserver = null;\r\n _super.prototype.dispose.call(this);\r\n };\r\n return ScrollViewer;\r\n}(Rectangle));\r\nexport { ScrollViewer };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.ScrollViewer\"] = ScrollViewer;\r\n//# sourceMappingURL=scrollViewer.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { Button } from \"./button\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to store key control properties\r\n */\r\nvar KeyPropertySet = /** @class */ (function () {\r\n function KeyPropertySet() {\r\n }\r\n return KeyPropertySet;\r\n}());\r\nexport { KeyPropertySet };\r\n/**\r\n * Class used to create virtual keyboard\r\n */\r\nvar VirtualKeyboard = /** @class */ (function (_super) {\r\n __extends(VirtualKeyboard, _super);\r\n function VirtualKeyboard() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /** Observable raised when a key is pressed */\r\n _this.onKeyPressObservable = new Observable();\r\n /** Gets or sets default key button width */\r\n _this.defaultButtonWidth = \"40px\";\r\n /** Gets or sets default key button height */\r\n _this.defaultButtonHeight = \"40px\";\r\n /** Gets or sets default key button left padding */\r\n _this.defaultButtonPaddingLeft = \"2px\";\r\n /** Gets or sets default key button right padding */\r\n _this.defaultButtonPaddingRight = \"2px\";\r\n /** Gets or sets default key button top padding */\r\n _this.defaultButtonPaddingTop = \"2px\";\r\n /** Gets or sets default key button bottom padding */\r\n _this.defaultButtonPaddingBottom = \"2px\";\r\n /** Gets or sets default key button foreground color */\r\n _this.defaultButtonColor = \"#DDD\";\r\n /** Gets or sets default key button background color */\r\n _this.defaultButtonBackground = \"#070707\";\r\n /** Gets or sets shift button foreground color */\r\n _this.shiftButtonColor = \"#7799FF\";\r\n /** Gets or sets shift button thickness*/\r\n _this.selectedShiftThickness = 1;\r\n /** Gets shift key state */\r\n _this.shiftState = 0;\r\n _this._currentlyConnectedInputText = null;\r\n _this._connectedInputTexts = [];\r\n _this._onKeyPressObserver = null;\r\n return _this;\r\n }\r\n VirtualKeyboard.prototype._getTypeName = function () {\r\n return \"VirtualKeyboard\";\r\n };\r\n VirtualKeyboard.prototype._createKey = function (key, propertySet) {\r\n var _this = this;\r\n var button = Button.CreateSimpleButton(key, key);\r\n button.width = propertySet && propertySet.width ? propertySet.width : this.defaultButtonWidth;\r\n button.height = propertySet && propertySet.height ? propertySet.height : this.defaultButtonHeight;\r\n button.color = propertySet && propertySet.color ? propertySet.color : this.defaultButtonColor;\r\n button.background = propertySet && propertySet.background ? propertySet.background : this.defaultButtonBackground;\r\n button.paddingLeft = propertySet && propertySet.paddingLeft ? propertySet.paddingLeft : this.defaultButtonPaddingLeft;\r\n button.paddingRight = propertySet && propertySet.paddingRight ? propertySet.paddingRight : this.defaultButtonPaddingRight;\r\n button.paddingTop = propertySet && propertySet.paddingTop ? propertySet.paddingTop : this.defaultButtonPaddingTop;\r\n button.paddingBottom = propertySet && propertySet.paddingBottom ? propertySet.paddingBottom : this.defaultButtonPaddingBottom;\r\n button.thickness = 0;\r\n button.isFocusInvisible = true;\r\n button.shadowColor = this.shadowColor;\r\n button.shadowBlur = this.shadowBlur;\r\n button.shadowOffsetX = this.shadowOffsetX;\r\n button.shadowOffsetY = this.shadowOffsetY;\r\n button.onPointerUpObservable.add(function () {\r\n _this.onKeyPressObservable.notifyObservers(key);\r\n });\r\n return button;\r\n };\r\n /**\r\n * Adds a new row of keys\r\n * @param keys defines the list of keys to add\r\n * @param propertySets defines the associated property sets\r\n */\r\n VirtualKeyboard.prototype.addKeysRow = function (keys, propertySets) {\r\n var panel = new StackPanel();\r\n panel.isVertical = false;\r\n panel.isFocusInvisible = true;\r\n var maxKey = null;\r\n for (var i = 0; i < keys.length; i++) {\r\n var properties = null;\r\n if (propertySets && propertySets.length === keys.length) {\r\n properties = propertySets[i];\r\n }\r\n var key = this._createKey(keys[i], properties);\r\n if (!maxKey || key.heightInPixels > maxKey.heightInPixels) {\r\n maxKey = key;\r\n }\r\n panel.addControl(key);\r\n }\r\n panel.height = maxKey ? maxKey.height : this.defaultButtonHeight;\r\n this.addControl(panel);\r\n };\r\n /**\r\n * Set the shift key to a specific state\r\n * @param shiftState defines the new shift state\r\n */\r\n VirtualKeyboard.prototype.applyShiftState = function (shiftState) {\r\n if (!this.children) {\r\n return;\r\n }\r\n for (var i = 0; i < this.children.length; i++) {\r\n var row = this.children[i];\r\n if (!row || !row.children) {\r\n continue;\r\n }\r\n var rowContainer = row;\r\n for (var j = 0; j < rowContainer.children.length; j++) {\r\n var button = rowContainer.children[j];\r\n if (!button || !button.children[0]) {\r\n continue;\r\n }\r\n var button_tblock = button.children[0];\r\n if (button_tblock.text === \"\\u21E7\") {\r\n button.color = (shiftState ? this.shiftButtonColor : this.defaultButtonColor);\r\n button.thickness = (shiftState > 1 ? this.selectedShiftThickness : 0);\r\n }\r\n button_tblock.text = (shiftState > 0 ? button_tblock.text.toUpperCase() : button_tblock.text.toLowerCase());\r\n }\r\n }\r\n };\r\n Object.defineProperty(VirtualKeyboard.prototype, \"connectedInputText\", {\r\n /** Gets the input text control currently attached to the keyboard */\r\n get: function () {\r\n return this._currentlyConnectedInputText;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Connects the keyboard with an input text control\r\n *\r\n * @param input defines the target control\r\n */\r\n VirtualKeyboard.prototype.connect = function (input) {\r\n var _this = this;\r\n var inputTextAlreadyConnected = this._connectedInputTexts.some(function (a) { return a.input === input; });\r\n if (inputTextAlreadyConnected) {\r\n return;\r\n }\r\n if (this._onKeyPressObserver === null) {\r\n this._onKeyPressObserver = this.onKeyPressObservable.add(function (key) {\r\n if (!_this._currentlyConnectedInputText) {\r\n return;\r\n }\r\n _this._currentlyConnectedInputText._host.focusedControl = _this._currentlyConnectedInputText;\r\n switch (key) {\r\n case \"\\u21E7\":\r\n _this.shiftState++;\r\n if (_this.shiftState > 2) {\r\n _this.shiftState = 0;\r\n }\r\n _this.applyShiftState(_this.shiftState);\r\n return;\r\n case \"\\u2190\":\r\n _this._currentlyConnectedInputText.processKey(8);\r\n return;\r\n case \"\\u21B5\":\r\n _this._currentlyConnectedInputText.processKey(13);\r\n return;\r\n }\r\n _this._currentlyConnectedInputText.processKey(-1, (_this.shiftState ? key.toUpperCase() : key));\r\n if (_this.shiftState === 1) {\r\n _this.shiftState = 0;\r\n _this.applyShiftState(_this.shiftState);\r\n }\r\n });\r\n }\r\n this.isVisible = false;\r\n this._currentlyConnectedInputText = input;\r\n input._connectedVirtualKeyboard = this;\r\n // Events hooking\r\n var onFocusObserver = input.onFocusObservable.add(function () {\r\n _this._currentlyConnectedInputText = input;\r\n input._connectedVirtualKeyboard = _this;\r\n _this.isVisible = true;\r\n });\r\n var onBlurObserver = input.onBlurObservable.add(function () {\r\n input._connectedVirtualKeyboard = null;\r\n _this._currentlyConnectedInputText = null;\r\n _this.isVisible = false;\r\n });\r\n this._connectedInputTexts.push({\r\n input: input,\r\n onBlurObserver: onBlurObserver,\r\n onFocusObserver: onFocusObserver\r\n });\r\n };\r\n /**\r\n * Disconnects the keyboard from connected InputText controls\r\n *\r\n * @param input optionally defines a target control, otherwise all are disconnected\r\n */\r\n VirtualKeyboard.prototype.disconnect = function (input) {\r\n var _this = this;\r\n if (input) {\r\n // .find not available on IE\r\n var filtered = this._connectedInputTexts.filter(function (a) { return a.input === input; });\r\n if (filtered.length === 1) {\r\n this._removeConnectedInputObservables(filtered[0]);\r\n this._connectedInputTexts = this._connectedInputTexts.filter(function (a) { return a.input !== input; });\r\n if (this._currentlyConnectedInputText === input) {\r\n this._currentlyConnectedInputText = null;\r\n }\r\n }\r\n }\r\n else {\r\n this._connectedInputTexts.forEach(function (connectedInputText) {\r\n _this._removeConnectedInputObservables(connectedInputText);\r\n });\r\n this._connectedInputTexts = [];\r\n }\r\n if (this._connectedInputTexts.length === 0) {\r\n this._currentlyConnectedInputText = null;\r\n this.onKeyPressObservable.remove(this._onKeyPressObserver);\r\n this._onKeyPressObserver = null;\r\n }\r\n };\r\n VirtualKeyboard.prototype._removeConnectedInputObservables = function (connectedInputText) {\r\n connectedInputText.input._connectedVirtualKeyboard = null;\r\n connectedInputText.input.onFocusObservable.remove(connectedInputText.onFocusObserver);\r\n connectedInputText.input.onBlurObservable.remove(connectedInputText.onBlurObserver);\r\n };\r\n /**\r\n * Release all resources\r\n */\r\n VirtualKeyboard.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.disconnect();\r\n };\r\n // Statics\r\n /**\r\n * Creates a new keyboard using a default layout\r\n *\r\n * @param name defines control name\r\n * @returns a new VirtualKeyboard\r\n */\r\n VirtualKeyboard.CreateDefaultLayout = function (name) {\r\n var returnValue = new VirtualKeyboard(name);\r\n returnValue.addKeysRow([\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\", \"\\u2190\"]);\r\n returnValue.addKeysRow([\"q\", \"w\", \"e\", \"r\", \"t\", \"y\", \"u\", \"i\", \"o\", \"p\"]);\r\n returnValue.addKeysRow([\"a\", \"s\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \";\", \"'\", \"\\u21B5\"]);\r\n returnValue.addKeysRow([\"\\u21E7\", \"z\", \"x\", \"c\", \"v\", \"b\", \"n\", \"m\", \",\", \".\", \"/\"]);\r\n returnValue.addKeysRow([\" \"], [{ width: \"200px\" }]);\r\n return returnValue;\r\n };\r\n return VirtualKeyboard;\r\n}(StackPanel));\r\nexport { VirtualKeyboard };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.VirtualKeyboard\"] = VirtualKeyboard;\r\n//# sourceMappingURL=virtualKeyboard.js.map","import { __extends } from \"tslib\";\r\nimport { Control } from \"./control\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/** Class used to render a grid */\r\nvar DisplayGrid = /** @class */ (function (_super) {\r\n __extends(DisplayGrid, _super);\r\n /**\r\n * Creates a new GridDisplayRectangle\r\n * @param name defines the control name\r\n */\r\n function DisplayGrid(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._cellWidth = 20;\r\n _this._cellHeight = 20;\r\n _this._minorLineTickness = 1;\r\n _this._minorLineColor = \"DarkGray\";\r\n _this._majorLineTickness = 2;\r\n _this._majorLineColor = \"White\";\r\n _this._majorLineFrequency = 5;\r\n _this._background = \"Black\";\r\n _this._displayMajorLines = true;\r\n _this._displayMinorLines = true;\r\n return _this;\r\n }\r\n Object.defineProperty(DisplayGrid.prototype, \"displayMinorLines\", {\r\n /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */\r\n get: function () {\r\n return this._displayMinorLines;\r\n },\r\n set: function (value) {\r\n if (this._displayMinorLines === value) {\r\n return;\r\n }\r\n this._displayMinorLines = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"displayMajorLines\", {\r\n /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */\r\n get: function () {\r\n return this._displayMajorLines;\r\n },\r\n set: function (value) {\r\n if (this._displayMajorLines === value) {\r\n return;\r\n }\r\n this._displayMajorLines = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"background\", {\r\n /** Gets or sets background color (Black by default) */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"cellWidth\", {\r\n /** Gets or sets the width of each cell (20 by default) */\r\n get: function () {\r\n return this._cellWidth;\r\n },\r\n set: function (value) {\r\n this._cellWidth = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"cellHeight\", {\r\n /** Gets or sets the height of each cell (20 by default) */\r\n get: function () {\r\n return this._cellHeight;\r\n },\r\n set: function (value) {\r\n this._cellHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"minorLineTickness\", {\r\n /** Gets or sets the tickness of minor lines (1 by default) */\r\n get: function () {\r\n return this._minorLineTickness;\r\n },\r\n set: function (value) {\r\n this._minorLineTickness = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"minorLineColor\", {\r\n /** Gets or sets the color of minor lines (DarkGray by default) */\r\n get: function () {\r\n return this._minorLineColor;\r\n },\r\n set: function (value) {\r\n this._minorLineColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"majorLineTickness\", {\r\n /** Gets or sets the tickness of major lines (2 by default) */\r\n get: function () {\r\n return this._majorLineTickness;\r\n },\r\n set: function (value) {\r\n this._majorLineTickness = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"majorLineColor\", {\r\n /** Gets or sets the color of major lines (White by default) */\r\n get: function () {\r\n return this._majorLineColor;\r\n },\r\n set: function (value) {\r\n this._majorLineColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"majorLineFrequency\", {\r\n /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/\r\n get: function () {\r\n return this._majorLineFrequency;\r\n },\r\n set: function (value) {\r\n this._majorLineFrequency = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n DisplayGrid.prototype._draw = function (context, invalidatedRectangle) {\r\n context.save();\r\n this._applyStates(context);\r\n if (this._isEnabled) {\r\n if (this._background) {\r\n context.fillStyle = this._background;\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n var cellCountX = this._currentMeasure.width / this._cellWidth;\r\n var cellCountY = this._currentMeasure.height / this._cellHeight;\r\n // Minor lines\r\n var left = this._currentMeasure.left + this._currentMeasure.width / 2;\r\n var top_1 = this._currentMeasure.top + this._currentMeasure.height / 2;\r\n if (this._displayMinorLines) {\r\n context.strokeStyle = this._minorLineColor;\r\n context.lineWidth = this._minorLineTickness;\r\n for (var x = -cellCountX / 2; x < cellCountX / 2; x++) {\r\n var cellX = left + x * this.cellWidth;\r\n context.beginPath();\r\n context.moveTo(cellX, this._currentMeasure.top);\r\n context.lineTo(cellX, this._currentMeasure.top + this._currentMeasure.height);\r\n context.stroke();\r\n }\r\n for (var y = -cellCountY / 2; y < cellCountY / 2; y++) {\r\n var cellY = top_1 + y * this.cellHeight;\r\n context.beginPath();\r\n context.moveTo(this._currentMeasure.left, cellY);\r\n context.lineTo(this._currentMeasure.left + this._currentMeasure.width, cellY);\r\n context.stroke();\r\n }\r\n }\r\n // Major lines\r\n if (this._displayMajorLines) {\r\n context.strokeStyle = this._majorLineColor;\r\n context.lineWidth = this._majorLineTickness;\r\n for (var x = -cellCountX / 2 + this._majorLineFrequency; x < cellCountX / 2; x += this._majorLineFrequency) {\r\n var cellX = left + x * this.cellWidth;\r\n context.beginPath();\r\n context.moveTo(cellX, this._currentMeasure.top);\r\n context.lineTo(cellX, this._currentMeasure.top + this._currentMeasure.height);\r\n context.stroke();\r\n }\r\n for (var y = -cellCountY / 2 + this._majorLineFrequency; y < cellCountY / 2; y += this._majorLineFrequency) {\r\n var cellY = top_1 + y * this.cellHeight;\r\n context.moveTo(this._currentMeasure.left, cellY);\r\n context.lineTo(this._currentMeasure.left + this._currentMeasure.width, cellY);\r\n context.closePath();\r\n context.stroke();\r\n }\r\n }\r\n }\r\n context.restore();\r\n };\r\n DisplayGrid.prototype._getTypeName = function () {\r\n return \"DisplayGrid\";\r\n };\r\n return DisplayGrid;\r\n}(Control));\r\nexport { DisplayGrid };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.DisplayGrid\"] = DisplayGrid;\r\n//# sourceMappingURL=displayGrid.js.map","import { __extends } from \"tslib\";\r\nimport { BaseSlider } from \"./baseSlider\";\r\nimport { Measure } from \"../../measure\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create slider controls based on images\r\n */\r\nvar ImageBasedSlider = /** @class */ (function (_super) {\r\n __extends(ImageBasedSlider, _super);\r\n /**\r\n * Creates a new ImageBasedSlider\r\n * @param name defines the control name\r\n */\r\n function ImageBasedSlider(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._tempMeasure = new Measure(0, 0, 0, 0);\r\n return _this;\r\n }\r\n Object.defineProperty(ImageBasedSlider.prototype, \"displayThumb\", {\r\n get: function () {\r\n return this._displayThumb && this.thumbImage != null;\r\n },\r\n set: function (value) {\r\n if (this._displayThumb === value) {\r\n return;\r\n }\r\n this._displayThumb = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageBasedSlider.prototype, \"backgroundImage\", {\r\n /**\r\n * Gets or sets the image used to render the background\r\n */\r\n get: function () {\r\n return this._backgroundImage;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._backgroundImage === value) {\r\n return;\r\n }\r\n this._backgroundImage = value;\r\n if (value && !value.isLoaded) {\r\n value.onImageLoadedObservable.addOnce(function () { return _this._markAsDirty(); });\r\n }\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageBasedSlider.prototype, \"valueBarImage\", {\r\n /**\r\n * Gets or sets the image used to render the value bar\r\n */\r\n get: function () {\r\n return this._valueBarImage;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._valueBarImage === value) {\r\n return;\r\n }\r\n this._valueBarImage = value;\r\n if (value && !value.isLoaded) {\r\n value.onImageLoadedObservable.addOnce(function () { return _this._markAsDirty(); });\r\n }\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageBasedSlider.prototype, \"thumbImage\", {\r\n /**\r\n * Gets or sets the image used to render the thumb\r\n */\r\n get: function () {\r\n return this._thumbImage;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._thumbImage === value) {\r\n return;\r\n }\r\n this._thumbImage = value;\r\n if (value && !value.isLoaded) {\r\n value.onImageLoadedObservable.addOnce(function () { return _this._markAsDirty(); });\r\n }\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ImageBasedSlider.prototype._getTypeName = function () {\r\n return \"ImageBasedSlider\";\r\n };\r\n ImageBasedSlider.prototype._draw = function (context, invalidatedRectangle) {\r\n context.save();\r\n this._applyStates(context);\r\n this._prepareRenderingData(\"rectangle\");\r\n var thumbPosition = this._getThumbPosition();\r\n var left = this._renderLeft;\r\n var top = this._renderTop;\r\n var width = this._renderWidth;\r\n var height = this._renderHeight;\r\n // Background\r\n if (this._backgroundImage) {\r\n this._tempMeasure.copyFromFloats(left, top, width, height);\r\n if (this.isThumbClamped && this.displayThumb) {\r\n if (this.isVertical) {\r\n this._tempMeasure.height += this._effectiveThumbThickness;\r\n }\r\n else {\r\n this._tempMeasure.width += this._effectiveThumbThickness;\r\n }\r\n }\r\n this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure);\r\n this._backgroundImage._draw(context);\r\n }\r\n // Bar\r\n if (this._valueBarImage) {\r\n if (this.isVertical) {\r\n if (this.isThumbClamped && this.displayThumb) {\r\n this._tempMeasure.copyFromFloats(left, top + thumbPosition, width, height - thumbPosition + this._effectiveThumbThickness);\r\n }\r\n else {\r\n this._tempMeasure.copyFromFloats(left, top + thumbPosition, width, height - thumbPosition);\r\n }\r\n }\r\n else {\r\n if (this.isThumbClamped && this.displayThumb) {\r\n this._tempMeasure.copyFromFloats(left, top, thumbPosition + this._effectiveThumbThickness / 2, height);\r\n }\r\n else {\r\n this._tempMeasure.copyFromFloats(left, top, thumbPosition, height);\r\n }\r\n }\r\n this._valueBarImage._currentMeasure.copyFrom(this._tempMeasure);\r\n this._valueBarImage._draw(context);\r\n }\r\n // Thumb\r\n if (this.displayThumb) {\r\n if (this.isVertical) {\r\n this._tempMeasure.copyFromFloats(left - this._effectiveBarOffset, this._currentMeasure.top + thumbPosition, this._currentMeasure.width, this._effectiveThumbThickness);\r\n }\r\n else {\r\n this._tempMeasure.copyFromFloats(this._currentMeasure.left + thumbPosition, this._currentMeasure.top, this._effectiveThumbThickness, this._currentMeasure.height);\r\n }\r\n this._thumbImage._currentMeasure.copyFrom(this._tempMeasure);\r\n this._thumbImage._draw(context);\r\n }\r\n context.restore();\r\n };\r\n return ImageBasedSlider;\r\n}(BaseSlider));\r\nexport { ImageBasedSlider };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.ImageBasedSlider\"] = ImageBasedSlider;\r\n//# sourceMappingURL=imageBasedSlider.js.map","import { Control } from \"./control\";\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { TextBlock } from \"./textBlock\";\r\n/**\r\n * Forcing an export so that this code will execute\r\n * @hidden\r\n */\r\nvar name = \"Statics\";\r\nexport { name };\r\n/**\r\n * Creates a stack panel that can be used to render headers\r\n * @param control defines the control to associate with the header\r\n * @param text defines the text of the header\r\n * @param size defines the size of the header\r\n * @param options defines options used to configure the header\r\n * @returns a new StackPanel\r\n */\r\nControl.AddHeader = function (control, text, size, options) {\r\n var panel = new StackPanel(\"panel\");\r\n var isHorizontal = options ? options.isHorizontal : true;\r\n var controlFirst = options ? options.controlFirst : true;\r\n panel.isVertical = !isHorizontal;\r\n var header = new TextBlock(\"header\");\r\n header.text = text;\r\n header.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n if (isHorizontal) {\r\n header.width = size;\r\n }\r\n else {\r\n header.height = size;\r\n }\r\n if (controlFirst) {\r\n panel.addControl(control);\r\n panel.addControl(header);\r\n header.paddingLeft = \"5px\";\r\n }\r\n else {\r\n panel.addControl(header);\r\n panel.addControl(control);\r\n header.paddingRight = \"5px\";\r\n }\r\n header.shadowBlur = control.shadowBlur;\r\n header.shadowColor = control.shadowColor;\r\n header.shadowOffsetX = control.shadowOffsetX;\r\n header.shadowOffsetY = control.shadowOffsetY;\r\n return panel;\r\n};\r\n//# sourceMappingURL=statics.js.map","import { Vector2 } from \"@babylonjs/core/Maths/math.vector\";\r\nvar tmpRect = [\r\n new Vector2(0, 0),\r\n new Vector2(0, 0),\r\n new Vector2(0, 0),\r\n new Vector2(0, 0),\r\n];\r\nvar tmpRect2 = [\r\n new Vector2(0, 0),\r\n new Vector2(0, 0),\r\n new Vector2(0, 0),\r\n new Vector2(0, 0),\r\n];\r\nvar tmpV1 = new Vector2(0, 0);\r\nvar tmpV2 = new Vector2(0, 0);\r\n/**\r\n * Class used to store 2D control sizes\r\n */\r\nvar Measure = /** @class */ (function () {\r\n /**\r\n * Creates a new measure\r\n * @param left defines left coordinate\r\n * @param top defines top coordinate\r\n * @param width defines width dimension\r\n * @param height defines height dimension\r\n */\r\n function Measure(\r\n /** defines left coordinate */\r\n left, \r\n /** defines top coordinate */\r\n top, \r\n /** defines width dimension */\r\n width, \r\n /** defines height dimension */\r\n height) {\r\n this.left = left;\r\n this.top = top;\r\n this.width = width;\r\n this.height = height;\r\n }\r\n /**\r\n * Copy from another measure\r\n * @param other defines the other measure to copy from\r\n */\r\n Measure.prototype.copyFrom = function (other) {\r\n this.left = other.left;\r\n this.top = other.top;\r\n this.width = other.width;\r\n this.height = other.height;\r\n };\r\n /**\r\n * Copy from a group of 4 floats\r\n * @param left defines left coordinate\r\n * @param top defines top coordinate\r\n * @param width defines width dimension\r\n * @param height defines height dimension\r\n */\r\n Measure.prototype.copyFromFloats = function (left, top, width, height) {\r\n this.left = left;\r\n this.top = top;\r\n this.width = width;\r\n this.height = height;\r\n };\r\n /**\r\n * Computes the axis aligned bounding box measure for two given measures\r\n * @param a Input measure\r\n * @param b Input measure\r\n * @param result the resulting bounding measure\r\n */\r\n Measure.CombineToRef = function (a, b, result) {\r\n var left = Math.min(a.left, b.left);\r\n var top = Math.min(a.top, b.top);\r\n var right = Math.max(a.left + a.width, b.left + b.width);\r\n var bottom = Math.max(a.top + a.height, b.top + b.height);\r\n result.left = left;\r\n result.top = top;\r\n result.width = right - left;\r\n result.height = bottom - top;\r\n };\r\n /**\r\n * Computes the axis aligned bounding box of the measure after it is modified by a given transform\r\n * @param transform the matrix to transform the measure before computing the AABB\r\n * @param addX number to add to left\r\n * @param addY number to add to top\r\n * @param addWidth number to add to width\r\n * @param addHeight number to add to height\r\n * @param result the resulting AABB\r\n */\r\n Measure.prototype.addAndTransformToRef = function (transform, addX, addY, addWidth, addHeight, result) {\r\n var left = this.left + addX;\r\n var top = this.top + addY;\r\n var width = this.width + addWidth;\r\n var height = this.height + addHeight;\r\n tmpRect[0].copyFromFloats(left, top);\r\n tmpRect[1].copyFromFloats(left + width, top);\r\n tmpRect[2].copyFromFloats(left + width, top + height);\r\n tmpRect[3].copyFromFloats(left, top + height);\r\n tmpV1.copyFromFloats(Number.MAX_VALUE, Number.MAX_VALUE);\r\n tmpV2.copyFromFloats(0, 0);\r\n for (var i = 0; i < 4; i++) {\r\n transform.transformCoordinates(tmpRect[i].x, tmpRect[i].y, tmpRect2[i]);\r\n tmpV1.x = Math.floor(Math.min(tmpV1.x, tmpRect2[i].x));\r\n tmpV1.y = Math.floor(Math.min(tmpV1.y, tmpRect2[i].y));\r\n tmpV2.x = Math.ceil(Math.max(tmpV2.x, tmpRect2[i].x));\r\n tmpV2.y = Math.ceil(Math.max(tmpV2.y, tmpRect2[i].y));\r\n }\r\n result.left = tmpV1.x;\r\n result.top = tmpV1.y;\r\n result.width = tmpV2.x - tmpV1.x;\r\n result.height = tmpV2.y - tmpV1.y;\r\n };\r\n /**\r\n * Computes the axis aligned bounding box of the measure after it is modified by a given transform\r\n * @param transform the matrix to transform the measure before computing the AABB\r\n * @param result the resulting AABB\r\n */\r\n Measure.prototype.transformToRef = function (transform, result) {\r\n this.addAndTransformToRef(transform, 0, 0, 0, 0, result);\r\n };\r\n /**\r\n * Check equality between this measure and another one\r\n * @param other defines the other measures\r\n * @returns true if both measures are equals\r\n */\r\n Measure.prototype.isEqualsTo = function (other) {\r\n if (this.left !== other.left) {\r\n return false;\r\n }\r\n if (this.top !== other.top) {\r\n return false;\r\n }\r\n if (this.width !== other.width) {\r\n return false;\r\n }\r\n if (this.height !== other.height) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Creates an empty measure\r\n * @returns a new measure\r\n */\r\n Measure.Empty = function () {\r\n return new Measure(0, 0, 0, 0);\r\n };\r\n return Measure;\r\n}());\r\nexport { Measure };\r\n//# sourceMappingURL=measure.js.map","/**\r\n * Class used to specific a value and its associated unit\r\n */\r\nvar ValueAndUnit = /** @class */ (function () {\r\n /**\r\n * Creates a new ValueAndUnit\r\n * @param value defines the value to store\r\n * @param unit defines the unit to store\r\n * @param negativeValueAllowed defines a boolean indicating if the value can be negative\r\n */\r\n function ValueAndUnit(value, \r\n /** defines the unit to store */\r\n unit, \r\n /** defines a boolean indicating if the value can be negative */\r\n negativeValueAllowed) {\r\n if (unit === void 0) { unit = ValueAndUnit.UNITMODE_PIXEL; }\r\n if (negativeValueAllowed === void 0) { negativeValueAllowed = true; }\r\n this.unit = unit;\r\n this.negativeValueAllowed = negativeValueAllowed;\r\n this._value = 1;\r\n /**\r\n * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property\r\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\r\n */\r\n this.ignoreAdaptiveScaling = false;\r\n this._value = value;\r\n this._originalUnit = unit;\r\n }\r\n Object.defineProperty(ValueAndUnit.prototype, \"isPercentage\", {\r\n /** Gets a boolean indicating if the value is a percentage */\r\n get: function () {\r\n return this.unit === ValueAndUnit.UNITMODE_PERCENTAGE;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAndUnit.prototype, \"isPixel\", {\r\n /** Gets a boolean indicating if the value is store as pixel */\r\n get: function () {\r\n return this.unit === ValueAndUnit.UNITMODE_PIXEL;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAndUnit.prototype, \"internalValue\", {\r\n /** Gets direct internal value */\r\n get: function () {\r\n return this._value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets value as pixel\r\n * @param host defines the root host\r\n * @param refValue defines the reference value for percentages\r\n * @returns the value as pixel\r\n */\r\n ValueAndUnit.prototype.getValueInPixel = function (host, refValue) {\r\n if (this.isPixel) {\r\n return this.getValue(host);\r\n }\r\n return this.getValue(host) * refValue;\r\n };\r\n /**\r\n * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.\r\n * @param value defines the value to store\r\n * @param unit defines the unit to store\r\n * @returns the current ValueAndUnit\r\n */\r\n ValueAndUnit.prototype.updateInPlace = function (value, unit) {\r\n if (unit === void 0) { unit = ValueAndUnit.UNITMODE_PIXEL; }\r\n this._value = value;\r\n this.unit = unit;\r\n return this;\r\n };\r\n /**\r\n * Gets the value accordingly to its unit\r\n * @param host defines the root host\r\n * @returns the value\r\n */\r\n ValueAndUnit.prototype.getValue = function (host) {\r\n if (host && !this.ignoreAdaptiveScaling && this.unit !== ValueAndUnit.UNITMODE_PERCENTAGE) {\r\n var width = 0;\r\n var height = 0;\r\n if (host.idealWidth) {\r\n width = (this._value * host.getSize().width) / host.idealWidth;\r\n }\r\n if (host.idealHeight) {\r\n height = (this._value * host.getSize().height) / host.idealHeight;\r\n }\r\n if (host.useSmallestIdeal && host.idealWidth && host.idealHeight) {\r\n return window.innerWidth < window.innerHeight ? width : height;\r\n }\r\n if (host.idealWidth) { // horizontal\r\n return width;\r\n }\r\n if (host.idealHeight) { // vertical\r\n return height;\r\n }\r\n }\r\n return this._value;\r\n };\r\n /**\r\n * Gets a string representation of the value\r\n * @param host defines the root host\r\n * @param decimals defines an optional number of decimals to display\r\n * @returns a string\r\n */\r\n ValueAndUnit.prototype.toString = function (host, decimals) {\r\n switch (this.unit) {\r\n case ValueAndUnit.UNITMODE_PERCENTAGE:\r\n var percentage = this.getValue(host) * 100;\r\n return (decimals ? percentage.toFixed(decimals) : percentage) + \"%\";\r\n case ValueAndUnit.UNITMODE_PIXEL:\r\n var pixels = this.getValue(host);\r\n return (decimals ? pixels.toFixed(decimals) : pixels) + \"px\";\r\n }\r\n return this.unit.toString();\r\n };\r\n /**\r\n * Store a value parsed from a string\r\n * @param source defines the source string\r\n * @returns true if the value was successfully parsed\r\n */\r\n ValueAndUnit.prototype.fromString = function (source) {\r\n var match = ValueAndUnit._Regex.exec(source.toString());\r\n if (!match || match.length === 0) {\r\n return false;\r\n }\r\n var sourceValue = parseFloat(match[1]);\r\n var sourceUnit = this._originalUnit;\r\n if (!this.negativeValueAllowed) {\r\n if (sourceValue < 0) {\r\n sourceValue = 0;\r\n }\r\n }\r\n if (match.length === 4) {\r\n switch (match[3]) {\r\n case \"px\":\r\n sourceUnit = ValueAndUnit.UNITMODE_PIXEL;\r\n break;\r\n case \"%\":\r\n sourceUnit = ValueAndUnit.UNITMODE_PERCENTAGE;\r\n sourceValue /= 100.0;\r\n break;\r\n }\r\n }\r\n if (sourceValue === this._value && sourceUnit === this.unit) {\r\n return false;\r\n }\r\n this._value = sourceValue;\r\n this.unit = sourceUnit;\r\n return true;\r\n };\r\n Object.defineProperty(ValueAndUnit, \"UNITMODE_PERCENTAGE\", {\r\n /** UNITMODE_PERCENTAGE */\r\n get: function () {\r\n return ValueAndUnit._UNITMODE_PERCENTAGE;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAndUnit, \"UNITMODE_PIXEL\", {\r\n /** UNITMODE_PIXEL */\r\n get: function () {\r\n return ValueAndUnit._UNITMODE_PIXEL;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Static\r\n ValueAndUnit._Regex = /(^-?\\d*(\\.\\d+)?)(%|px)?/;\r\n ValueAndUnit._UNITMODE_PERCENTAGE = 0;\r\n ValueAndUnit._UNITMODE_PIXEL = 1;\r\n return ValueAndUnit;\r\n}());\r\nexport { ValueAndUnit };\r\n//# sourceMappingURL=valueAndUnit.js.map","import { __extends } from \"tslib\";\r\nimport { AbstractScene } from \"./abstractScene\";\r\nimport { Mesh } from \"./Meshes/mesh\";\r\nimport { Logger } from './Misc/logger';\r\nimport { EngineStore } from './Engines/engineStore';\r\n/**\r\n * Set of assets to keep when moving a scene into an asset container.\r\n */\r\nvar KeepAssets = /** @class */ (function (_super) {\r\n __extends(KeepAssets, _super);\r\n function KeepAssets() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n return KeepAssets;\r\n}(AbstractScene));\r\nexport { KeepAssets };\r\n/**\r\n * Class used to store the output of the AssetContainer.instantiateAllMeshesToScene function\r\n */\r\nvar InstantiatedEntries = /** @class */ (function () {\r\n function InstantiatedEntries() {\r\n /**\r\n * List of new root nodes (eg. nodes with no parent)\r\n */\r\n this.rootNodes = [];\r\n /**\r\n * List of new skeletons\r\n */\r\n this.skeletons = [];\r\n /**\r\n * List of new animation groups\r\n */\r\n this.animationGroups = [];\r\n }\r\n return InstantiatedEntries;\r\n}());\r\nexport { InstantiatedEntries };\r\n/**\r\n * Container with a set of assets that can be added or removed from a scene.\r\n */\r\nvar AssetContainer = /** @class */ (function (_super) {\r\n __extends(AssetContainer, _super);\r\n /**\r\n * Instantiates an AssetContainer.\r\n * @param scene The scene the AssetContainer belongs to.\r\n */\r\n function AssetContainer(scene) {\r\n var _this = _super.call(this) || this;\r\n _this._wasAddedToScene = false;\r\n _this.scene = scene;\r\n _this[\"sounds\"] = [];\r\n _this[\"effectLayers\"] = [];\r\n _this[\"layers\"] = [];\r\n _this[\"lensFlareSystems\"] = [];\r\n _this[\"proceduralTextures\"] = [];\r\n _this[\"reflectionProbes\"] = [];\r\n scene.onDisposeObservable.add(function () {\r\n if (!_this._wasAddedToScene) {\r\n _this.dispose();\r\n }\r\n });\r\n return _this;\r\n }\r\n /**\r\n * Instantiate or clone all meshes and add the new ones to the scene.\r\n * Skeletons and animation groups will all be cloned\r\n * @param nameFunction defines an optional function used to get new names for clones\r\n * @param cloneMaterials defines an optional boolean that defines if materials must be cloned as well (false by default)\r\n * @returns a list of rootNodes, skeletons and aniamtion groups that were duplicated\r\n */\r\n AssetContainer.prototype.instantiateModelsToScene = function (nameFunction, cloneMaterials) {\r\n var _this = this;\r\n if (cloneMaterials === void 0) { cloneMaterials = false; }\r\n var convertionMap = {};\r\n var storeMap = {};\r\n var result = new InstantiatedEntries();\r\n var alreadySwappedSkeletons = [];\r\n var alreadySwappedMaterials = [];\r\n var options = {\r\n doNotInstantiate: true\r\n };\r\n var onClone = function (source, clone) {\r\n convertionMap[source.uniqueId] = clone.uniqueId;\r\n storeMap[clone.uniqueId] = clone;\r\n if (nameFunction) {\r\n clone.name = nameFunction(source.name);\r\n }\r\n if (clone instanceof Mesh) {\r\n var clonedMesh = clone;\r\n if (clonedMesh.morphTargetManager) {\r\n var oldMorphTargetManager = source.morphTargetManager;\r\n clonedMesh.morphTargetManager = oldMorphTargetManager.clone();\r\n for (var index = 0; index < oldMorphTargetManager.numTargets; index++) {\r\n var oldTarget = oldMorphTargetManager.getTarget(index);\r\n var newTarget = clonedMesh.morphTargetManager.getTarget(index);\r\n convertionMap[oldTarget.uniqueId] = newTarget.uniqueId;\r\n storeMap[newTarget.uniqueId] = newTarget;\r\n }\r\n }\r\n }\r\n };\r\n this.transformNodes.forEach(function (o) {\r\n if (!o.parent) {\r\n var newOne = o.instantiateHierarchy(null, options, function (source, clone) {\r\n onClone(source, clone);\r\n });\r\n if (newOne) {\r\n result.rootNodes.push(newOne);\r\n }\r\n }\r\n });\r\n this.meshes.forEach(function (o) {\r\n if (!o.parent) {\r\n var newOne = o.instantiateHierarchy(null, options, function (source, clone) {\r\n onClone(source, clone);\r\n if (clone.material) {\r\n var mesh = clone;\r\n if (mesh.material) {\r\n if (cloneMaterials) {\r\n var sourceMaterial = source.material;\r\n if (alreadySwappedMaterials.indexOf(sourceMaterial) === -1) {\r\n var swap = sourceMaterial.clone(nameFunction ? nameFunction(sourceMaterial.name) : \"Clone of \" + sourceMaterial.name);\r\n alreadySwappedMaterials.push(sourceMaterial);\r\n convertionMap[sourceMaterial.uniqueId] = swap.uniqueId;\r\n storeMap[swap.uniqueId] = swap;\r\n if (sourceMaterial.getClassName() === \"MultiMaterial\") {\r\n var multi = sourceMaterial;\r\n for (var _i = 0, _a = multi.subMaterials; _i < _a.length; _i++) {\r\n var material = _a[_i];\r\n if (!material) {\r\n continue;\r\n }\r\n swap = material.clone(nameFunction ? nameFunction(material.name) : \"Clone of \" + material.name);\r\n alreadySwappedMaterials.push(material);\r\n convertionMap[material.uniqueId] = swap.uniqueId;\r\n storeMap[swap.uniqueId] = swap;\r\n }\r\n multi.subMaterials = multi.subMaterials.map(function (m) { return m && storeMap[convertionMap[m.uniqueId]]; });\r\n }\r\n }\r\n mesh.material = storeMap[convertionMap[sourceMaterial.uniqueId]];\r\n }\r\n else {\r\n if (mesh.material.getClassName() === \"MultiMaterial\") {\r\n if (_this.scene.multiMaterials.indexOf(mesh.material) === -1) {\r\n _this.scene.addMultiMaterial(mesh.material);\r\n }\r\n }\r\n else {\r\n if (_this.scene.materials.indexOf(mesh.material) === -1) {\r\n _this.scene.addMaterial(mesh.material);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n });\r\n if (newOne) {\r\n result.rootNodes.push(newOne);\r\n }\r\n }\r\n });\r\n this.skeletons.forEach(function (s) {\r\n var clone = s.clone(nameFunction ? nameFunction(s.name) : \"Clone of \" + s.name);\r\n if (s.overrideMesh) {\r\n clone.overrideMesh = storeMap[convertionMap[s.overrideMesh.uniqueId]];\r\n }\r\n for (var _i = 0, _a = _this.meshes; _i < _a.length; _i++) {\r\n var m = _a[_i];\r\n if (m.skeleton === s && !m.isAnInstance) {\r\n var copy = storeMap[convertionMap[m.uniqueId]];\r\n copy.skeleton = clone;\r\n if (alreadySwappedSkeletons.indexOf(clone) !== -1) {\r\n continue;\r\n }\r\n alreadySwappedSkeletons.push(clone);\r\n // Check if bones are mesh linked\r\n for (var _b = 0, _c = clone.bones; _b < _c.length; _b++) {\r\n var bone = _c[_b];\r\n if (bone._linkedTransformNode) {\r\n bone._linkedTransformNode = storeMap[convertionMap[bone._linkedTransformNode.uniqueId]];\r\n }\r\n }\r\n }\r\n }\r\n result.skeletons.push(clone);\r\n });\r\n this.animationGroups.forEach(function (o) {\r\n var clone = o.clone(o.name, function (oldTarget) {\r\n var newTarget = storeMap[convertionMap[oldTarget.uniqueId]];\r\n return newTarget || oldTarget;\r\n });\r\n result.animationGroups.push(clone);\r\n });\r\n return result;\r\n };\r\n /**\r\n * Adds all the assets from the container to the scene.\r\n */\r\n AssetContainer.prototype.addAllToScene = function () {\r\n var _this = this;\r\n this._wasAddedToScene = true;\r\n this.cameras.forEach(function (o) {\r\n _this.scene.addCamera(o);\r\n });\r\n this.lights.forEach(function (o) {\r\n _this.scene.addLight(o);\r\n });\r\n this.meshes.forEach(function (o) {\r\n _this.scene.addMesh(o);\r\n });\r\n this.skeletons.forEach(function (o) {\r\n _this.scene.addSkeleton(o);\r\n });\r\n this.animations.forEach(function (o) {\r\n _this.scene.addAnimation(o);\r\n });\r\n this.animationGroups.forEach(function (o) {\r\n _this.scene.addAnimationGroup(o);\r\n });\r\n this.multiMaterials.forEach(function (o) {\r\n _this.scene.addMultiMaterial(o);\r\n });\r\n this.materials.forEach(function (o) {\r\n _this.scene.addMaterial(o);\r\n });\r\n this.morphTargetManagers.forEach(function (o) {\r\n _this.scene.addMorphTargetManager(o);\r\n });\r\n this.geometries.forEach(function (o) {\r\n _this.scene.addGeometry(o);\r\n });\r\n this.transformNodes.forEach(function (o) {\r\n _this.scene.addTransformNode(o);\r\n });\r\n this.actionManagers.forEach(function (o) {\r\n _this.scene.addActionManager(o);\r\n });\r\n this.textures.forEach(function (o) {\r\n _this.scene.addTexture(o);\r\n });\r\n this.reflectionProbes.forEach(function (o) {\r\n _this.scene.addReflectionProbe(o);\r\n });\r\n if (this.environmentTexture) {\r\n this.scene.environmentTexture = this.environmentTexture;\r\n }\r\n for (var _i = 0, _a = this.scene._serializableComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.addFromContainer(this);\r\n }\r\n };\r\n /**\r\n * Removes all the assets in the container from the scene\r\n */\r\n AssetContainer.prototype.removeAllFromScene = function () {\r\n var _this = this;\r\n this._wasAddedToScene = false;\r\n this.cameras.forEach(function (o) {\r\n _this.scene.removeCamera(o);\r\n });\r\n this.lights.forEach(function (o) {\r\n _this.scene.removeLight(o);\r\n });\r\n this.meshes.forEach(function (o) {\r\n _this.scene.removeMesh(o);\r\n });\r\n this.skeletons.forEach(function (o) {\r\n _this.scene.removeSkeleton(o);\r\n });\r\n this.animations.forEach(function (o) {\r\n _this.scene.removeAnimation(o);\r\n });\r\n this.animationGroups.forEach(function (o) {\r\n _this.scene.removeAnimationGroup(o);\r\n });\r\n this.multiMaterials.forEach(function (o) {\r\n _this.scene.removeMultiMaterial(o);\r\n });\r\n this.materials.forEach(function (o) {\r\n _this.scene.removeMaterial(o);\r\n });\r\n this.morphTargetManagers.forEach(function (o) {\r\n _this.scene.removeMorphTargetManager(o);\r\n });\r\n this.geometries.forEach(function (o) {\r\n _this.scene.removeGeometry(o);\r\n });\r\n this.transformNodes.forEach(function (o) {\r\n _this.scene.removeTransformNode(o);\r\n });\r\n this.actionManagers.forEach(function (o) {\r\n _this.scene.removeActionManager(o);\r\n });\r\n this.textures.forEach(function (o) {\r\n _this.scene.removeTexture(o);\r\n });\r\n this.reflectionProbes.forEach(function (o) {\r\n _this.scene.removeReflectionProbe(o);\r\n });\r\n if (this.environmentTexture === this.scene.environmentTexture) {\r\n this.scene.environmentTexture = null;\r\n }\r\n for (var _i = 0, _a = this.scene._serializableComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.removeFromContainer(this);\r\n }\r\n };\r\n /**\r\n * Disposes all the assets in the container\r\n */\r\n AssetContainer.prototype.dispose = function () {\r\n this.cameras.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.cameras = [];\r\n this.lights.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.lights = [];\r\n this.meshes.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.meshes = [];\r\n this.skeletons.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.skeletons = [];\r\n this.animationGroups.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.animationGroups = [];\r\n this.multiMaterials.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.multiMaterials = [];\r\n this.materials.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.materials = [];\r\n this.geometries.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.geometries = [];\r\n this.transformNodes.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.transformNodes = [];\r\n this.actionManagers.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.actionManagers = [];\r\n this.textures.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.textures = [];\r\n this.reflectionProbes.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.reflectionProbes = [];\r\n if (this.environmentTexture) {\r\n this.environmentTexture.dispose();\r\n this.environmentTexture = null;\r\n }\r\n for (var _i = 0, _a = this.scene._serializableComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.removeFromContainer(this, true);\r\n }\r\n };\r\n AssetContainer.prototype._moveAssets = function (sourceAssets, targetAssets, keepAssets) {\r\n if (!sourceAssets) {\r\n return;\r\n }\r\n for (var _i = 0, sourceAssets_1 = sourceAssets; _i < sourceAssets_1.length; _i++) {\r\n var asset = sourceAssets_1[_i];\r\n var move = true;\r\n if (keepAssets) {\r\n for (var _a = 0, keepAssets_1 = keepAssets; _a < keepAssets_1.length; _a++) {\r\n var keepAsset = keepAssets_1[_a];\r\n if (asset === keepAsset) {\r\n move = false;\r\n break;\r\n }\r\n }\r\n }\r\n if (move) {\r\n targetAssets.push(asset);\r\n }\r\n }\r\n };\r\n /**\r\n * Removes all the assets contained in the scene and adds them to the container.\r\n * @param keepAssets Set of assets to keep in the scene. (default: empty)\r\n */\r\n AssetContainer.prototype.moveAllFromScene = function (keepAssets) {\r\n this._wasAddedToScene = false;\r\n if (keepAssets === undefined) {\r\n keepAssets = new KeepAssets();\r\n }\r\n for (var key in this) {\r\n if (this.hasOwnProperty(key)) {\r\n this[key] = this[key] || (key === \"environmentTexture\" ? null : []);\r\n this._moveAssets(this.scene[key], this[key], keepAssets[key]);\r\n }\r\n }\r\n this.environmentTexture = this.scene.environmentTexture;\r\n this.removeAllFromScene();\r\n };\r\n /**\r\n * Adds all meshes in the asset container to a root mesh that can be used to position all the contained meshes. The root mesh is then added to the front of the meshes in the assetContainer.\r\n * @returns the root mesh\r\n */\r\n AssetContainer.prototype.createRootMesh = function () {\r\n var rootMesh = new Mesh(\"assetContainerRootMesh\", this.scene);\r\n this.meshes.forEach(function (m) {\r\n if (!m.parent) {\r\n rootMesh.addChild(m);\r\n }\r\n });\r\n this.meshes.unshift(rootMesh);\r\n return rootMesh;\r\n };\r\n /**\r\n * Merge animations (direct and animation groups) from this asset container into a scene\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param animatables set of animatables to retarget to a node from the scene\r\n * @param targetConverter defines a function used to convert animation targets from the asset container to the scene (default: search node by name)\r\n * @returns an array of the new AnimationGroup added to the scene (empty array if none)\r\n */\r\n AssetContainer.prototype.mergeAnimationsTo = function (scene, animatables, targetConverter) {\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (targetConverter === void 0) { targetConverter = null; }\r\n if (!scene) {\r\n Logger.Error(\"No scene available to merge animations to\");\r\n return [];\r\n }\r\n var _targetConverter = targetConverter ? targetConverter : function (target) {\r\n var node = null;\r\n var targetProperty = target.animations.length ? target.animations[0].targetProperty : \"\";\r\n /*\r\n BabylonJS adds special naming to targets that are children of nodes.\r\n This name attempts to remove that special naming to get the parent nodes name in case the target\r\n can't be found in the node tree\r\n\r\n Ex: Torso_primitive0 likely points to a Mesh primitive. We take away primitive0 and are left with \"Torso\" which is the name\r\n of the primitive's parent.\r\n */\r\n var name = target.name.split(\".\").join(\"\").split(\"_primitive\")[0];\r\n switch (targetProperty) {\r\n case \"position\":\r\n case \"rotationQuaternion\":\r\n node = scene.getTransformNodeByName(target.name) || scene.getTransformNodeByName(name);\r\n break;\r\n case \"influence\":\r\n node = scene.getMorphTargetByName(target.name) || scene.getMorphTargetByName(name);\r\n break;\r\n default:\r\n node = scene.getNodeByName(target.name) || scene.getNodeByName(name);\r\n }\r\n return node;\r\n };\r\n // Copy new node animations\r\n var nodesInAC = this.getNodes();\r\n nodesInAC.forEach(function (nodeInAC) {\r\n var nodeInScene = _targetConverter(nodeInAC);\r\n if (nodeInScene !== null) {\r\n var _loop_1 = function (animationInAC) {\r\n // Doing treatment on an array for safety measure\r\n var animationsWithSameProperty = nodeInScene.animations.filter(function (animationInScene) {\r\n return animationInScene.targetProperty === animationInAC.targetProperty;\r\n });\r\n for (var _i = 0, animationsWithSameProperty_1 = animationsWithSameProperty; _i < animationsWithSameProperty_1.length; _i++) {\r\n var animationWithSameProperty = animationsWithSameProperty_1[_i];\r\n var index = nodeInScene.animations.indexOf(animationWithSameProperty, 0);\r\n if (index > -1) {\r\n nodeInScene.animations.splice(index, 1);\r\n }\r\n }\r\n };\r\n // Remove old animations with same target property as a new one\r\n for (var _i = 0, _a = nodeInAC.animations; _i < _a.length; _i++) {\r\n var animationInAC = _a[_i];\r\n _loop_1(animationInAC);\r\n }\r\n // Append new animations\r\n nodeInScene.animations = nodeInScene.animations.concat(nodeInAC.animations);\r\n }\r\n });\r\n var newAnimationGroups = new Array();\r\n // Copy new animation groups\r\n this.animationGroups.slice().forEach(function (animationGroupInAC) {\r\n // Clone the animation group and all its animatables\r\n newAnimationGroups.push(animationGroupInAC.clone(animationGroupInAC.name, _targetConverter));\r\n // Remove animatables related to the asset container\r\n animationGroupInAC.animatables.forEach(function (animatable) {\r\n animatable.stop();\r\n });\r\n });\r\n // Retarget animatables\r\n animatables.forEach(function (animatable) {\r\n var target = _targetConverter(animatable.target);\r\n if (target) {\r\n // Clone the animatable and retarget it\r\n scene.beginAnimation(target, animatable.fromFrame, animatable.toFrame, animatable.loopAnimation, animatable.speedRatio, animatable.onAnimationEnd ? animatable.onAnimationEnd : undefined, undefined, true, undefined, animatable.onAnimationLoop ? animatable.onAnimationLoop : undefined);\r\n // Stop animation for the target in the asset container\r\n scene.stopAnimation(animatable.target);\r\n }\r\n });\r\n return newAnimationGroups;\r\n };\r\n return AssetContainer;\r\n}(AbstractScene));\r\nexport { AssetContainer };\r\n//# sourceMappingURL=assetContainer.js.map","import { StringTools } from './stringTools';\r\n/**\r\n * Utility class for reading from a data buffer\r\n */\r\nvar DataReader = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param buffer The buffer to read\r\n */\r\n function DataReader(buffer) {\r\n /**\r\n * The current byte offset from the beginning of the data buffer.\r\n */\r\n this.byteOffset = 0;\r\n this.buffer = buffer;\r\n }\r\n /**\r\n * Loads the given byte length.\r\n * @param byteLength The byte length to load\r\n * @returns A promise that resolves when the load is complete\r\n */\r\n DataReader.prototype.loadAsync = function (byteLength) {\r\n var _this = this;\r\n return this.buffer.readAsync(this.byteOffset, byteLength).then(function (data) {\r\n _this._dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);\r\n _this._dataByteOffset = 0;\r\n });\r\n };\r\n /**\r\n * Read a unsigned 32-bit integer from the currently loaded data range.\r\n * @returns The 32-bit integer read\r\n */\r\n DataReader.prototype.readUint32 = function () {\r\n var value = this._dataView.getUint32(this._dataByteOffset, true);\r\n this._dataByteOffset += 4;\r\n this.byteOffset += 4;\r\n return value;\r\n };\r\n /**\r\n * Read a byte array from the currently loaded data range.\r\n * @param byteLength The byte length to read\r\n * @returns The byte array read\r\n */\r\n DataReader.prototype.readUint8Array = function (byteLength) {\r\n var value = new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + this._dataByteOffset, byteLength);\r\n this._dataByteOffset += byteLength;\r\n this.byteOffset += byteLength;\r\n return value;\r\n };\r\n /**\r\n * Read a string from the currently loaded data range.\r\n * @param byteLength The byte length to read\r\n * @returns The string read\r\n */\r\n DataReader.prototype.readString = function (byteLength) {\r\n return StringTools.Decode(this.readUint8Array(byteLength));\r\n };\r\n /**\r\n * Skips the given byte length the currently loaded data range.\r\n * @param byteLength The byte length to skip\r\n */\r\n DataReader.prototype.skipBytes = function (byteLength) {\r\n this._dataByteOffset += byteLength;\r\n this.byteOffset += byteLength;\r\n };\r\n return DataReader;\r\n}());\r\nexport { DataReader };\r\n//# sourceMappingURL=dataReader.js.map","import { Tools } from '@babylonjs/core/Misc/tools';\r\nfunction validateAsync(data, rootUrl, fileName, getExternalResource) {\r\n var options = {\r\n externalResourceFunction: function (uri) { return getExternalResource(uri).then(function (value) { return new Uint8Array(value); }); }\r\n };\r\n if (fileName) {\r\n options.uri = (rootUrl === \"file:\" ? fileName : rootUrl + fileName);\r\n }\r\n return (data instanceof ArrayBuffer)\r\n ? GLTFValidator.validateBytes(new Uint8Array(data), options)\r\n : GLTFValidator.validateString(data, options);\r\n}\r\n/**\r\n * The worker function that gets converted to a blob url to pass into a worker.\r\n */\r\nfunction workerFunc() {\r\n var pendingExternalResources = [];\r\n onmessage = function (message) {\r\n var data = message.data;\r\n switch (data.id) {\r\n case \"init\": {\r\n importScripts(data.url);\r\n break;\r\n }\r\n case \"validate\": {\r\n validateAsync(data.data, data.rootUrl, data.fileName, function (uri) { return new Promise(function (resolve, reject) {\r\n var index = pendingExternalResources.length;\r\n pendingExternalResources.push({ resolve: resolve, reject: reject });\r\n postMessage({ id: \"getExternalResource\", index: index, uri: uri });\r\n }); }).then(function (value) {\r\n postMessage({ id: \"validate.resolve\", value: value });\r\n }, function (reason) {\r\n postMessage({ id: \"validate.reject\", reason: reason });\r\n });\r\n break;\r\n }\r\n case \"getExternalResource.resolve\": {\r\n pendingExternalResources[data.index].resolve(data.value);\r\n break;\r\n }\r\n case \"getExternalResource.reject\": {\r\n pendingExternalResources[data.index].reject(data.reason);\r\n break;\r\n }\r\n }\r\n };\r\n}\r\n/**\r\n * glTF validation\r\n */\r\nvar GLTFValidation = /** @class */ (function () {\r\n function GLTFValidation() {\r\n }\r\n /**\r\n * Validate a glTF asset using the glTF-Validator.\r\n * @param data The JSON of a glTF or the array buffer of a binary glTF\r\n * @param rootUrl The root url for the glTF\r\n * @param fileName The file name for the glTF\r\n * @param getExternalResource The callback to get external resources for the glTF validator\r\n * @returns A promise that resolves with the glTF validation results once complete\r\n */\r\n GLTFValidation.ValidateAsync = function (data, rootUrl, fileName, getExternalResource) {\r\n var _this = this;\r\n if (typeof Worker === \"function\") {\r\n return new Promise(function (resolve, reject) {\r\n var workerContent = validateAsync + \"(\" + workerFunc + \")()\";\r\n var workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: \"application/javascript\" }));\r\n var worker = new Worker(workerBlobUrl);\r\n var onError = function (error) {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n };\r\n var onMessage = function (message) {\r\n var data = message.data;\r\n switch (data.id) {\r\n case \"getExternalResource\": {\r\n getExternalResource(data.uri).then(function (value) {\r\n worker.postMessage({ id: \"getExternalResource.resolve\", index: data.index, value: value }, [value]);\r\n }, function (reason) {\r\n worker.postMessage({ id: \"getExternalResource.reject\", index: data.index, reason: reason });\r\n });\r\n break;\r\n }\r\n case \"validate.resolve\": {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(data.value);\r\n break;\r\n }\r\n case \"validate.reject\": {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(data.reason);\r\n }\r\n }\r\n };\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n worker.postMessage({ id: \"init\", url: Tools.GetAbsoluteUrl(_this.Configuration.url) });\r\n worker.postMessage({ id: \"validate\", data: data, rootUrl: rootUrl, fileName: fileName });\r\n });\r\n }\r\n else {\r\n if (!this._LoadScriptPromise) {\r\n this._LoadScriptPromise = Tools.LoadScriptAsync(this.Configuration.url);\r\n }\r\n return this._LoadScriptPromise.then(function () {\r\n return validateAsync(data, rootUrl, fileName, getExternalResource);\r\n });\r\n }\r\n };\r\n /**\r\n * The configuration. Defaults to `{ url: \"https://preview.babylonjs.com/gltf_validator.js\" }`.\r\n */\r\n GLTFValidation.Configuration = {\r\n url: \"https://preview.babylonjs.com/gltf_validator.js\"\r\n };\r\n return GLTFValidation;\r\n}());\r\nexport { GLTFValidation };\r\n//# sourceMappingURL=glTFValidation.js.map","import { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { SceneLoader } from \"@babylonjs/core/Loading/sceneLoader\";\r\nimport { AssetContainer } from \"@babylonjs/core/assetContainer\";\r\nimport { Logger } from '@babylonjs/core/Misc/logger';\r\nimport { DataReader } from '@babylonjs/core/Misc/dataReader';\r\nimport { GLTFValidation } from './glTFValidation';\r\nimport { StringTools } from '@babylonjs/core/Misc/stringTools';\r\n/**\r\n * Mode that determines the coordinate system to use.\r\n */\r\nexport var GLTFLoaderCoordinateSystemMode;\r\n(function (GLTFLoaderCoordinateSystemMode) {\r\n /**\r\n * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.\r\n */\r\n GLTFLoaderCoordinateSystemMode[GLTFLoaderCoordinateSystemMode[\"AUTO\"] = 0] = \"AUTO\";\r\n /**\r\n * Sets the useRightHandedSystem flag on the scene.\r\n */\r\n GLTFLoaderCoordinateSystemMode[GLTFLoaderCoordinateSystemMode[\"FORCE_RIGHT_HANDED\"] = 1] = \"FORCE_RIGHT_HANDED\";\r\n})(GLTFLoaderCoordinateSystemMode || (GLTFLoaderCoordinateSystemMode = {}));\r\n/**\r\n * Mode that determines what animations will start.\r\n */\r\nexport var GLTFLoaderAnimationStartMode;\r\n(function (GLTFLoaderAnimationStartMode) {\r\n /**\r\n * No animation will start.\r\n */\r\n GLTFLoaderAnimationStartMode[GLTFLoaderAnimationStartMode[\"NONE\"] = 0] = \"NONE\";\r\n /**\r\n * The first animation will start.\r\n */\r\n GLTFLoaderAnimationStartMode[GLTFLoaderAnimationStartMode[\"FIRST\"] = 1] = \"FIRST\";\r\n /**\r\n * All animations will start.\r\n */\r\n GLTFLoaderAnimationStartMode[GLTFLoaderAnimationStartMode[\"ALL\"] = 2] = \"ALL\";\r\n})(GLTFLoaderAnimationStartMode || (GLTFLoaderAnimationStartMode = {}));\r\n/**\r\n * Loader state.\r\n */\r\nexport var GLTFLoaderState;\r\n(function (GLTFLoaderState) {\r\n /**\r\n * The asset is loading.\r\n */\r\n GLTFLoaderState[GLTFLoaderState[\"LOADING\"] = 0] = \"LOADING\";\r\n /**\r\n * The asset is ready for rendering.\r\n */\r\n GLTFLoaderState[GLTFLoaderState[\"READY\"] = 1] = \"READY\";\r\n /**\r\n * The asset is completely loaded.\r\n */\r\n GLTFLoaderState[GLTFLoaderState[\"COMPLETE\"] = 2] = \"COMPLETE\";\r\n})(GLTFLoaderState || (GLTFLoaderState = {}));\r\n/**\r\n * File loader for loading glTF files into a scene.\r\n */\r\nvar GLTFFileLoader = /** @class */ (function () {\r\n function GLTFFileLoader() {\r\n // --------------\r\n // Common options\r\n // --------------\r\n /**\r\n * Raised when the asset has been parsed\r\n */\r\n this.onParsedObservable = new Observable();\r\n // ----------\r\n // V2 options\r\n // ----------\r\n /**\r\n * The coordinate system mode. Defaults to AUTO.\r\n */\r\n this.coordinateSystemMode = GLTFLoaderCoordinateSystemMode.AUTO;\r\n /**\r\n * The animation start mode. Defaults to FIRST.\r\n */\r\n this.animationStartMode = GLTFLoaderAnimationStartMode.FIRST;\r\n /**\r\n * Defines if the loader should compile materials before raising the success callback. Defaults to false.\r\n */\r\n this.compileMaterials = false;\r\n /**\r\n * Defines if the loader should also compile materials with clip planes. Defaults to false.\r\n */\r\n this.useClipPlane = false;\r\n /**\r\n * Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.\r\n */\r\n this.compileShadowGenerators = false;\r\n /**\r\n * Defines if the Alpha blended materials are only applied as coverage.\r\n * If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials.\r\n * If true, no extra effects are applied to transparent pixels.\r\n */\r\n this.transparencyAsCoverage = false;\r\n /**\r\n * Defines if the loader should use range requests when load binary glTF files from HTTP.\r\n * Enabling will disable offline support and glTF validator.\r\n * Defaults to false.\r\n */\r\n this.useRangeRequests = false;\r\n /**\r\n * Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.\r\n */\r\n this.createInstances = true;\r\n /**\r\n * Defines if the loader should always compute the bounding boxes of meshes and not use the min/max values from the position accessor. Defaults to false.\r\n */\r\n this.alwaysComputeBoundingBox = false;\r\n /**\r\n * If true, load all materials defined in the file, even if not used by any mesh. Defaults to false.\r\n */\r\n this.loadAllMaterials = false;\r\n /**\r\n * Function called before loading a url referenced by the asset.\r\n */\r\n this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };\r\n /**\r\n * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.\r\n * Note that the observable is raised as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)\r\n */\r\n this.onMeshLoadedObservable = new Observable();\r\n /**\r\n * Observable raised when the loader creates a texture after parsing the glTF properties of the texture.\r\n */\r\n this.onTextureLoadedObservable = new Observable();\r\n /**\r\n * Observable raised when the loader creates a material after parsing the glTF properties of the material.\r\n */\r\n this.onMaterialLoadedObservable = new Observable();\r\n /**\r\n * Observable raised when the loader creates a camera after parsing the glTF properties of the camera.\r\n */\r\n this.onCameraLoadedObservable = new Observable();\r\n /**\r\n * Observable raised when the asset is completely loaded, immediately before the loader is disposed.\r\n * For assets with LODs, raised when all of the LODs are complete.\r\n * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.\r\n */\r\n this.onCompleteObservable = new Observable();\r\n /**\r\n * Observable raised when an error occurs.\r\n */\r\n this.onErrorObservable = new Observable();\r\n /**\r\n * Observable raised after the loader is disposed.\r\n */\r\n this.onDisposeObservable = new Observable();\r\n /**\r\n * Observable raised after a loader extension is created.\r\n * Set additional options for a loader extension in this event.\r\n */\r\n this.onExtensionLoadedObservable = new Observable();\r\n /**\r\n * Defines if the loader should validate the asset.\r\n */\r\n this.validate = false;\r\n /**\r\n * Observable raised after validation when validate is set to true. The event data is the result of the validation.\r\n */\r\n this.onValidatedObservable = new Observable();\r\n this._loader = null;\r\n this._requests = new Array();\r\n /**\r\n * Name of the loader (\"gltf\")\r\n */\r\n this.name = \"gltf\";\r\n /** @hidden */\r\n this.extensions = {\r\n \".gltf\": { isBinary: false },\r\n \".glb\": { isBinary: true }\r\n };\r\n this._logIndentLevel = 0;\r\n this._loggingEnabled = false;\r\n /** @hidden */\r\n this._log = this._logDisabled;\r\n this._capturePerformanceCounters = false;\r\n /** @hidden */\r\n this._startPerformanceCounter = this._startPerformanceCounterDisabled;\r\n /** @hidden */\r\n this._endPerformanceCounter = this._endPerformanceCounterDisabled;\r\n }\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onParsed\", {\r\n /**\r\n * Raised when the asset has been parsed\r\n */\r\n set: function (callback) {\r\n if (this._onParsedObserver) {\r\n this.onParsedObservable.remove(this._onParsedObserver);\r\n }\r\n this._onParsedObserver = this.onParsedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onMeshLoaded\", {\r\n /**\r\n * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.\r\n * Note that the callback is called as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)\r\n */\r\n set: function (callback) {\r\n if (this._onMeshLoadedObserver) {\r\n this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver);\r\n }\r\n this._onMeshLoadedObserver = this.onMeshLoadedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onTextureLoaded\", {\r\n /**\r\n * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.\r\n */\r\n set: function (callback) {\r\n if (this._onTextureLoadedObserver) {\r\n this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver);\r\n }\r\n this._onTextureLoadedObserver = this.onTextureLoadedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onMaterialLoaded\", {\r\n /**\r\n * Callback raised when the loader creates a material after parsing the glTF properties of the material.\r\n */\r\n set: function (callback) {\r\n if (this._onMaterialLoadedObserver) {\r\n this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver);\r\n }\r\n this._onMaterialLoadedObserver = this.onMaterialLoadedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onCameraLoaded\", {\r\n /**\r\n * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.\r\n */\r\n set: function (callback) {\r\n if (this._onCameraLoadedObserver) {\r\n this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver);\r\n }\r\n this._onCameraLoadedObserver = this.onCameraLoadedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onComplete\", {\r\n /**\r\n * Callback raised when the asset is completely loaded, immediately before the loader is disposed.\r\n * For assets with LODs, raised when all of the LODs are complete.\r\n * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.\r\n */\r\n set: function (callback) {\r\n if (this._onCompleteObserver) {\r\n this.onCompleteObservable.remove(this._onCompleteObserver);\r\n }\r\n this._onCompleteObserver = this.onCompleteObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onError\", {\r\n /**\r\n * Callback raised when an error occurs.\r\n */\r\n set: function (callback) {\r\n if (this._onErrorObserver) {\r\n this.onErrorObservable.remove(this._onErrorObserver);\r\n }\r\n this._onErrorObserver = this.onErrorObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onDispose\", {\r\n /**\r\n * Callback raised after the loader is disposed.\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onExtensionLoaded\", {\r\n /**\r\n * Callback raised after a loader extension is created.\r\n */\r\n set: function (callback) {\r\n if (this._onExtensionLoadedObserver) {\r\n this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver);\r\n }\r\n this._onExtensionLoadedObserver = this.onExtensionLoadedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"loggingEnabled\", {\r\n /**\r\n * Defines if the loader logging is enabled.\r\n */\r\n get: function () {\r\n return this._loggingEnabled;\r\n },\r\n set: function (value) {\r\n if (this._loggingEnabled === value) {\r\n return;\r\n }\r\n this._loggingEnabled = value;\r\n if (this._loggingEnabled) {\r\n this._log = this._logEnabled;\r\n }\r\n else {\r\n this._log = this._logDisabled;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"capturePerformanceCounters\", {\r\n /**\r\n * Defines if the loader should capture performance counters.\r\n */\r\n get: function () {\r\n return this._capturePerformanceCounters;\r\n },\r\n set: function (value) {\r\n if (this._capturePerformanceCounters === value) {\r\n return;\r\n }\r\n this._capturePerformanceCounters = value;\r\n if (this._capturePerformanceCounters) {\r\n this._startPerformanceCounter = this._startPerformanceCounterEnabled;\r\n this._endPerformanceCounter = this._endPerformanceCounterEnabled;\r\n }\r\n else {\r\n this._startPerformanceCounter = this._startPerformanceCounterDisabled;\r\n this._endPerformanceCounter = this._endPerformanceCounterDisabled;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onValidated\", {\r\n /**\r\n * Callback raised after a loader extension is created.\r\n */\r\n set: function (callback) {\r\n if (this._onValidatedObserver) {\r\n this.onValidatedObservable.remove(this._onValidatedObserver);\r\n }\r\n this._onValidatedObserver = this.onValidatedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes the loader, releases resources during load, and cancels any outstanding requests.\r\n */\r\n GLTFFileLoader.prototype.dispose = function () {\r\n if (this._loader) {\r\n this._loader.dispose();\r\n this._loader = null;\r\n }\r\n for (var _i = 0, _a = this._requests; _i < _a.length; _i++) {\r\n var request = _a[_i];\r\n request.abort();\r\n }\r\n this._requests.length = 0;\r\n delete this._progressCallback;\r\n this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };\r\n this.onMeshLoadedObservable.clear();\r\n this.onTextureLoadedObservable.clear();\r\n this.onMaterialLoadedObservable.clear();\r\n this.onCameraLoadedObservable.clear();\r\n this.onCompleteObservable.clear();\r\n this.onExtensionLoadedObservable.clear();\r\n this.onDisposeObservable.notifyObservers(undefined);\r\n this.onDisposeObservable.clear();\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.requestFile = function (scene, url, onSuccess, onProgress, useArrayBuffer, onError) {\r\n var _this = this;\r\n this._progressCallback = onProgress;\r\n if (useArrayBuffer) {\r\n if (this.useRangeRequests) {\r\n if (this.validate) {\r\n Logger.Warn(\"glTF validation is not supported when range requests are enabled\");\r\n }\r\n var fileRequest_1 = {\r\n abort: function () { },\r\n onCompleteObservable: new Observable()\r\n };\r\n var dataBuffer = {\r\n readAsync: function (byteOffset, byteLength) {\r\n return new Promise(function (resolve, reject) {\r\n _this._requestFile(url, scene, function (data) {\r\n resolve(new Uint8Array(data));\r\n }, true, function (error) {\r\n reject(error);\r\n }, function (webRequest) {\r\n webRequest.setRequestHeader(\"Range\", \"bytes=\" + byteOffset + \"-\" + (byteOffset + byteLength - 1));\r\n });\r\n });\r\n },\r\n byteLength: 0\r\n };\r\n this._unpackBinaryAsync(new DataReader(dataBuffer)).then(function (loaderData) {\r\n fileRequest_1.onCompleteObservable.notifyObservers(fileRequest_1);\r\n onSuccess(loaderData);\r\n }, onError);\r\n return fileRequest_1;\r\n }\r\n return this._requestFile(url, scene, function (data, request) {\r\n var arrayBuffer = data;\r\n _this._unpackBinaryAsync(new DataReader({\r\n readAsync: function (byteOffset, byteLength) { return Promise.resolve(new Uint8Array(arrayBuffer, byteOffset, byteLength)); },\r\n byteLength: arrayBuffer.byteLength\r\n })).then(function (loaderData) {\r\n onSuccess(loaderData, request);\r\n }, onError);\r\n }, true, onError);\r\n }\r\n return this._requestFile(url, scene, function (data, request) {\r\n _this._validate(scene, data, Tools.GetFolderPath(url), Tools.GetFilename(url));\r\n onSuccess({ json: _this._parseJson(data) }, request);\r\n }, useArrayBuffer, onError);\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.readFile = function (scene, file, onSuccess, onProgress, useArrayBuffer, onError) {\r\n var _this = this;\r\n return scene._readFile(file, function (data) {\r\n _this._validate(scene, data, \"file:\", file.name);\r\n if (useArrayBuffer) {\r\n var arrayBuffer_1 = data;\r\n _this._unpackBinaryAsync(new DataReader({\r\n readAsync: function (byteOffset, byteLength) { return Promise.resolve(new Uint8Array(arrayBuffer_1, byteOffset, byteLength)); },\r\n byteLength: arrayBuffer_1.byteLength\r\n })).then(onSuccess, onError);\r\n }\r\n else {\r\n onSuccess({ json: _this._parseJson(data) });\r\n }\r\n }, onProgress, useArrayBuffer, onError);\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.importMeshAsync = function (meshesNames, scene, data, rootUrl, onProgress, fileName) {\r\n var _this = this;\r\n return Promise.resolve().then(function () {\r\n _this.onParsedObservable.notifyObservers(data);\r\n _this.onParsedObservable.clear();\r\n _this._log(\"Loading \" + (fileName || \"\"));\r\n _this._loader = _this._getLoader(data);\r\n return _this._loader.importMeshAsync(meshesNames, scene, false, data, rootUrl, onProgress, fileName);\r\n });\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress, fileName) {\r\n var _this = this;\r\n return Promise.resolve().then(function () {\r\n _this.onParsedObservable.notifyObservers(data);\r\n _this.onParsedObservable.clear();\r\n _this._log(\"Loading \" + (fileName || \"\"));\r\n _this._loader = _this._getLoader(data);\r\n return _this._loader.loadAsync(scene, data, rootUrl, onProgress, fileName);\r\n });\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.loadAssetContainerAsync = function (scene, data, rootUrl, onProgress, fileName) {\r\n var _this = this;\r\n return Promise.resolve().then(function () {\r\n _this.onParsedObservable.notifyObservers(data);\r\n _this.onParsedObservable.clear();\r\n _this._log(\"Loading \" + (fileName || \"\"));\r\n _this._loader = _this._getLoader(data);\r\n // Prepare the asset container.\r\n var container = new AssetContainer(scene);\r\n // Get materials/textures when loading to add to container\r\n var materials = [];\r\n _this.onMaterialLoadedObservable.add(function (material) {\r\n materials.push(material);\r\n material.onDisposeObservable.addOnce(function () {\r\n var index = container.materials.indexOf(material);\r\n if (index > -1) {\r\n container.materials.splice(index, 1);\r\n }\r\n index = materials.indexOf(material);\r\n if (index > -1) {\r\n materials.splice(index, 1);\r\n }\r\n });\r\n });\r\n var textures = [];\r\n _this.onTextureLoadedObservable.add(function (texture) {\r\n textures.push(texture);\r\n texture.onDisposeObservable.addOnce(function () {\r\n var index = container.textures.indexOf(texture);\r\n if (index > -1) {\r\n container.textures.splice(index, 1);\r\n }\r\n index = textures.indexOf(texture);\r\n if (index > -1) {\r\n textures.splice(index, 1);\r\n }\r\n });\r\n });\r\n var cameras = [];\r\n _this.onCameraLoadedObservable.add(function (camera) {\r\n cameras.push(camera);\r\n });\r\n return _this._loader.importMeshAsync(null, scene, true, data, rootUrl, onProgress, fileName).then(function (result) {\r\n Array.prototype.push.apply(container.geometries, result.geometries);\r\n Array.prototype.push.apply(container.meshes, result.meshes);\r\n Array.prototype.push.apply(container.particleSystems, result.particleSystems);\r\n Array.prototype.push.apply(container.skeletons, result.skeletons);\r\n Array.prototype.push.apply(container.animationGroups, result.animationGroups);\r\n Array.prototype.push.apply(container.materials, materials);\r\n Array.prototype.push.apply(container.textures, textures);\r\n Array.prototype.push.apply(container.lights, result.lights);\r\n Array.prototype.push.apply(container.transformNodes, result.transformNodes);\r\n Array.prototype.push.apply(container.cameras, cameras);\r\n return container;\r\n });\r\n });\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.canDirectLoad = function (data) {\r\n return (data.indexOf(\"asset\") !== -1 && data.indexOf(\"version\") !== -1)\r\n || StringTools.StartsWith(data, \"data:base64,\" + GLTFFileLoader.magicBase64Encoded)\r\n || StringTools.StartsWith(data, \"data:application/octet-stream;base64,\" + GLTFFileLoader.magicBase64Encoded)\r\n || StringTools.StartsWith(data, \"data:model/gltf-binary;base64,\" + GLTFFileLoader.magicBase64Encoded);\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.directLoad = function (scene, data) {\r\n if (StringTools.StartsWith(data, \"base64,\" + GLTFFileLoader.magicBase64Encoded) ||\r\n StringTools.StartsWith(data, \"application/octet-stream;base64,\" + GLTFFileLoader.magicBase64Encoded) ||\r\n StringTools.StartsWith(data, \"model/gltf-binary;base64,\" + GLTFFileLoader.magicBase64Encoded)) {\r\n var arrayBuffer_2 = Tools.DecodeBase64(data);\r\n this._validate(scene, arrayBuffer_2);\r\n return this._unpackBinaryAsync(new DataReader({\r\n readAsync: function (byteOffset, byteLength) { return Promise.resolve(new Uint8Array(arrayBuffer_2, byteOffset, byteLength)); },\r\n byteLength: arrayBuffer_2.byteLength\r\n }));\r\n }\r\n this._validate(scene, data);\r\n return Promise.resolve({ json: this._parseJson(data) });\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.createPlugin = function () {\r\n return new GLTFFileLoader();\r\n };\r\n Object.defineProperty(GLTFFileLoader.prototype, \"loaderState\", {\r\n /**\r\n * The loader state or null if the loader is not active.\r\n */\r\n get: function () {\r\n return this._loader ? this._loader.state : null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a promise that resolves when the asset is completely loaded.\r\n * @returns a promise that resolves when the asset is completely loaded.\r\n */\r\n GLTFFileLoader.prototype.whenCompleteAsync = function () {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this.onCompleteObservable.addOnce(function () {\r\n resolve();\r\n });\r\n _this.onErrorObservable.addOnce(function (reason) {\r\n reject(reason);\r\n });\r\n });\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype._loadFile = function (url, scene, onSuccess, useArrayBuffer, onError) {\r\n var _this = this;\r\n var request = scene._loadFile(url, onSuccess, function (event) {\r\n _this._onProgress(event, request);\r\n }, undefined, useArrayBuffer, onError);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._requests.splice(_this._requests.indexOf(request), 1);\r\n });\r\n this._requests.push(request);\r\n return request;\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype._requestFile = function (url, scene, onSuccess, useArrayBuffer, onError, onOpened) {\r\n var _this = this;\r\n var request = scene._requestFile(url, onSuccess, function (event) {\r\n _this._onProgress(event, request);\r\n }, undefined, useArrayBuffer, onError, onOpened);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._requests.splice(_this._requests.indexOf(request), 1);\r\n });\r\n this._requests.push(request);\r\n return request;\r\n };\r\n GLTFFileLoader.prototype._onProgress = function (event, request) {\r\n if (!this._progressCallback) {\r\n return;\r\n }\r\n request._lengthComputable = event.lengthComputable;\r\n request._loaded = event.loaded;\r\n request._total = event.total;\r\n var lengthComputable = true;\r\n var loaded = 0;\r\n var total = 0;\r\n for (var _i = 0, _a = this._requests; _i < _a.length; _i++) {\r\n var request_1 = _a[_i];\r\n if (request_1._lengthComputable === undefined || request_1._loaded === undefined || request_1._total === undefined) {\r\n return;\r\n }\r\n lengthComputable = lengthComputable && request_1._lengthComputable;\r\n loaded += request_1._loaded;\r\n total += request_1._total;\r\n }\r\n this._progressCallback({\r\n lengthComputable: lengthComputable,\r\n loaded: loaded,\r\n total: lengthComputable ? total : 0\r\n });\r\n };\r\n GLTFFileLoader.prototype._validate = function (scene, data, rootUrl, fileName) {\r\n var _this = this;\r\n if (rootUrl === void 0) { rootUrl = \"\"; }\r\n if (fileName === void 0) { fileName = \"\"; }\r\n if (!this.validate) {\r\n return;\r\n }\r\n this._startPerformanceCounter(\"Validate JSON\");\r\n GLTFValidation.ValidateAsync(data, rootUrl, fileName, function (uri) {\r\n return _this.preprocessUrlAsync(rootUrl + uri).then(function (url) { return scene._loadFileAsync(url, undefined, true, true); });\r\n }).then(function (result) {\r\n _this._endPerformanceCounter(\"Validate JSON\");\r\n _this.onValidatedObservable.notifyObservers(result);\r\n _this.onValidatedObservable.clear();\r\n }, function (reason) {\r\n _this._endPerformanceCounter(\"Validate JSON\");\r\n Tools.Warn(\"Failed to validate: \" + reason.message);\r\n _this.onValidatedObservable.clear();\r\n });\r\n };\r\n GLTFFileLoader.prototype._getLoader = function (loaderData) {\r\n var asset = loaderData.json.asset || {};\r\n this._log(\"Asset version: \" + asset.version);\r\n asset.minVersion && this._log(\"Asset minimum version: \" + asset.minVersion);\r\n asset.generator && this._log(\"Asset generator: \" + asset.generator);\r\n var version = GLTFFileLoader._parseVersion(asset.version);\r\n if (!version) {\r\n throw new Error(\"Invalid version: \" + asset.version);\r\n }\r\n if (asset.minVersion !== undefined) {\r\n var minVersion = GLTFFileLoader._parseVersion(asset.minVersion);\r\n if (!minVersion) {\r\n throw new Error(\"Invalid minimum version: \" + asset.minVersion);\r\n }\r\n if (GLTFFileLoader._compareVersion(minVersion, { major: 2, minor: 0 }) > 0) {\r\n throw new Error(\"Incompatible minimum version: \" + asset.minVersion);\r\n }\r\n }\r\n var createLoaders = {\r\n 1: GLTFFileLoader._CreateGLTF1Loader,\r\n 2: GLTFFileLoader._CreateGLTF2Loader\r\n };\r\n var createLoader = createLoaders[version.major];\r\n if (!createLoader) {\r\n throw new Error(\"Unsupported version: \" + asset.version);\r\n }\r\n return createLoader(this);\r\n };\r\n GLTFFileLoader.prototype._parseJson = function (json) {\r\n this._startPerformanceCounter(\"Parse JSON\");\r\n this._log(\"JSON length: \" + json.length);\r\n var parsed = JSON.parse(json);\r\n this._endPerformanceCounter(\"Parse JSON\");\r\n return parsed;\r\n };\r\n GLTFFileLoader.prototype._unpackBinaryAsync = function (dataReader) {\r\n var _this = this;\r\n this._startPerformanceCounter(\"Unpack Binary\");\r\n // Read magic + version + length + json length + json format\r\n return dataReader.loadAsync(20).then(function () {\r\n var Binary = {\r\n Magic: 0x46546C67\r\n };\r\n var magic = dataReader.readUint32();\r\n if (magic !== Binary.Magic) {\r\n throw new Error(\"Unexpected magic: \" + magic);\r\n }\r\n var version = dataReader.readUint32();\r\n if (_this.loggingEnabled) {\r\n _this._log(\"Binary version: \" + version);\r\n }\r\n var length = dataReader.readUint32();\r\n if (dataReader.buffer.byteLength !== 0 && length !== dataReader.buffer.byteLength) {\r\n throw new Error(\"Length in header does not match actual data length: \" + length + \" != \" + dataReader.buffer.byteLength);\r\n }\r\n var unpacked;\r\n switch (version) {\r\n case 1: {\r\n unpacked = _this._unpackBinaryV1Async(dataReader, length);\r\n break;\r\n }\r\n case 2: {\r\n unpacked = _this._unpackBinaryV2Async(dataReader, length);\r\n break;\r\n }\r\n default: {\r\n throw new Error(\"Unsupported version: \" + version);\r\n }\r\n }\r\n _this._endPerformanceCounter(\"Unpack Binary\");\r\n return unpacked;\r\n });\r\n };\r\n GLTFFileLoader.prototype._unpackBinaryV1Async = function (dataReader, length) {\r\n var ContentFormat = {\r\n JSON: 0\r\n };\r\n var contentLength = dataReader.readUint32();\r\n var contentFormat = dataReader.readUint32();\r\n if (contentFormat !== ContentFormat.JSON) {\r\n throw new Error(\"Unexpected content format: \" + contentFormat);\r\n }\r\n var bodyLength = length - dataReader.byteOffset;\r\n var data = { json: this._parseJson(dataReader.readString(contentLength)), bin: null };\r\n if (bodyLength !== 0) {\r\n var startByteOffset_1 = dataReader.byteOffset;\r\n data.bin = {\r\n readAsync: function (byteOffset, byteLength) { return dataReader.buffer.readAsync(startByteOffset_1 + byteOffset, byteLength); },\r\n byteLength: bodyLength\r\n };\r\n }\r\n return Promise.resolve(data);\r\n };\r\n GLTFFileLoader.prototype._unpackBinaryV2Async = function (dataReader, length) {\r\n var _this = this;\r\n var ChunkFormat = {\r\n JSON: 0x4E4F534A,\r\n BIN: 0x004E4942\r\n };\r\n // Read the JSON chunk header.\r\n var chunkLength = dataReader.readUint32();\r\n var chunkFormat = dataReader.readUint32();\r\n if (chunkFormat !== ChunkFormat.JSON) {\r\n throw new Error(\"First chunk format is not JSON\");\r\n }\r\n // Bail if there are no other chunks.\r\n if (dataReader.byteOffset + chunkLength === length) {\r\n return dataReader.loadAsync(chunkLength).then(function () {\r\n return { json: _this._parseJson(dataReader.readString(chunkLength)), bin: null };\r\n });\r\n }\r\n // Read the JSON chunk and the length and type of the next chunk.\r\n return dataReader.loadAsync(chunkLength + 8).then(function () {\r\n var data = { json: _this._parseJson(dataReader.readString(chunkLength)), bin: null };\r\n var readAsync = function () {\r\n var chunkLength = dataReader.readUint32();\r\n var chunkFormat = dataReader.readUint32();\r\n switch (chunkFormat) {\r\n case ChunkFormat.JSON: {\r\n throw new Error(\"Unexpected JSON chunk\");\r\n }\r\n case ChunkFormat.BIN: {\r\n var startByteOffset_2 = dataReader.byteOffset;\r\n data.bin = {\r\n readAsync: function (byteOffset, byteLength) { return dataReader.buffer.readAsync(startByteOffset_2 + byteOffset, byteLength); },\r\n byteLength: chunkLength\r\n };\r\n dataReader.skipBytes(chunkLength);\r\n break;\r\n }\r\n default: {\r\n // ignore unrecognized chunkFormat\r\n dataReader.skipBytes(chunkLength);\r\n break;\r\n }\r\n }\r\n if (dataReader.byteOffset !== length) {\r\n return dataReader.loadAsync(8).then(readAsync);\r\n }\r\n return Promise.resolve(data);\r\n };\r\n return readAsync();\r\n });\r\n };\r\n GLTFFileLoader._parseVersion = function (version) {\r\n if (version === \"1.0\" || version === \"1.0.1\") {\r\n return {\r\n major: 1,\r\n minor: 0\r\n };\r\n }\r\n var match = (version + \"\").match(/^(\\d+)\\.(\\d+)/);\r\n if (!match) {\r\n return null;\r\n }\r\n return {\r\n major: parseInt(match[1]),\r\n minor: parseInt(match[2])\r\n };\r\n };\r\n GLTFFileLoader._compareVersion = function (a, b) {\r\n if (a.major > b.major) {\r\n return 1;\r\n }\r\n if (a.major < b.major) {\r\n return -1;\r\n }\r\n if (a.minor > b.minor) {\r\n return 1;\r\n }\r\n if (a.minor < b.minor) {\r\n return -1;\r\n }\r\n return 0;\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype._logOpen = function (message) {\r\n this._log(message);\r\n this._logIndentLevel++;\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype._logClose = function () {\r\n --this._logIndentLevel;\r\n };\r\n GLTFFileLoader.prototype._logEnabled = function (message) {\r\n var spaces = GLTFFileLoader._logSpaces.substr(0, this._logIndentLevel * 2);\r\n Logger.Log(\"\" + spaces + message);\r\n };\r\n GLTFFileLoader.prototype._logDisabled = function (message) {\r\n };\r\n GLTFFileLoader.prototype._startPerformanceCounterEnabled = function (counterName) {\r\n Tools.StartPerformanceCounter(counterName);\r\n };\r\n GLTFFileLoader.prototype._startPerformanceCounterDisabled = function (counterName) {\r\n };\r\n GLTFFileLoader.prototype._endPerformanceCounterEnabled = function (counterName) {\r\n Tools.EndPerformanceCounter(counterName);\r\n };\r\n GLTFFileLoader.prototype._endPerformanceCounterDisabled = function (counterName) {\r\n };\r\n // ----------\r\n // V1 options\r\n // ----------\r\n /**\r\n * Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders.\r\n * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.\r\n * Defaults to true.\r\n * @hidden\r\n */\r\n GLTFFileLoader.IncrementalLoading = true;\r\n /**\r\n * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.\r\n * Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.\r\n * @hidden\r\n */\r\n GLTFFileLoader.HomogeneousCoordinates = false;\r\n GLTFFileLoader.magicBase64Encoded = \"Z2xURg\"; // \"glTF\" base64 encoded (without the quotes!)\r\n GLTFFileLoader._logSpaces = \" \";\r\n return GLTFFileLoader;\r\n}());\r\nexport { GLTFFileLoader };\r\nif (SceneLoader) {\r\n SceneLoader.RegisterPlugin(new GLTFFileLoader());\r\n}\r\n//# sourceMappingURL=glTFFileLoader.js.map","/**\r\n* Enums\r\n* @hidden\r\n*/\r\nexport var EComponentType;\r\n(function (EComponentType) {\r\n EComponentType[EComponentType[\"BYTE\"] = 5120] = \"BYTE\";\r\n EComponentType[EComponentType[\"UNSIGNED_BYTE\"] = 5121] = \"UNSIGNED_BYTE\";\r\n EComponentType[EComponentType[\"SHORT\"] = 5122] = \"SHORT\";\r\n EComponentType[EComponentType[\"UNSIGNED_SHORT\"] = 5123] = \"UNSIGNED_SHORT\";\r\n EComponentType[EComponentType[\"FLOAT\"] = 5126] = \"FLOAT\";\r\n})(EComponentType || (EComponentType = {}));\r\n/** @hidden */\r\nexport var EShaderType;\r\n(function (EShaderType) {\r\n EShaderType[EShaderType[\"FRAGMENT\"] = 35632] = \"FRAGMENT\";\r\n EShaderType[EShaderType[\"VERTEX\"] = 35633] = \"VERTEX\";\r\n})(EShaderType || (EShaderType = {}));\r\n/** @hidden */\r\nexport var EParameterType;\r\n(function (EParameterType) {\r\n EParameterType[EParameterType[\"BYTE\"] = 5120] = \"BYTE\";\r\n EParameterType[EParameterType[\"UNSIGNED_BYTE\"] = 5121] = \"UNSIGNED_BYTE\";\r\n EParameterType[EParameterType[\"SHORT\"] = 5122] = \"SHORT\";\r\n EParameterType[EParameterType[\"UNSIGNED_SHORT\"] = 5123] = \"UNSIGNED_SHORT\";\r\n EParameterType[EParameterType[\"INT\"] = 5124] = \"INT\";\r\n EParameterType[EParameterType[\"UNSIGNED_INT\"] = 5125] = \"UNSIGNED_INT\";\r\n EParameterType[EParameterType[\"FLOAT\"] = 5126] = \"FLOAT\";\r\n EParameterType[EParameterType[\"FLOAT_VEC2\"] = 35664] = \"FLOAT_VEC2\";\r\n EParameterType[EParameterType[\"FLOAT_VEC3\"] = 35665] = \"FLOAT_VEC3\";\r\n EParameterType[EParameterType[\"FLOAT_VEC4\"] = 35666] = \"FLOAT_VEC4\";\r\n EParameterType[EParameterType[\"INT_VEC2\"] = 35667] = \"INT_VEC2\";\r\n EParameterType[EParameterType[\"INT_VEC3\"] = 35668] = \"INT_VEC3\";\r\n EParameterType[EParameterType[\"INT_VEC4\"] = 35669] = \"INT_VEC4\";\r\n EParameterType[EParameterType[\"BOOL\"] = 35670] = \"BOOL\";\r\n EParameterType[EParameterType[\"BOOL_VEC2\"] = 35671] = \"BOOL_VEC2\";\r\n EParameterType[EParameterType[\"BOOL_VEC3\"] = 35672] = \"BOOL_VEC3\";\r\n EParameterType[EParameterType[\"BOOL_VEC4\"] = 35673] = \"BOOL_VEC4\";\r\n EParameterType[EParameterType[\"FLOAT_MAT2\"] = 35674] = \"FLOAT_MAT2\";\r\n EParameterType[EParameterType[\"FLOAT_MAT3\"] = 35675] = \"FLOAT_MAT3\";\r\n EParameterType[EParameterType[\"FLOAT_MAT4\"] = 35676] = \"FLOAT_MAT4\";\r\n EParameterType[EParameterType[\"SAMPLER_2D\"] = 35678] = \"SAMPLER_2D\";\r\n})(EParameterType || (EParameterType = {}));\r\n/** @hidden */\r\nexport var ETextureWrapMode;\r\n(function (ETextureWrapMode) {\r\n ETextureWrapMode[ETextureWrapMode[\"CLAMP_TO_EDGE\"] = 33071] = \"CLAMP_TO_EDGE\";\r\n ETextureWrapMode[ETextureWrapMode[\"MIRRORED_REPEAT\"] = 33648] = \"MIRRORED_REPEAT\";\r\n ETextureWrapMode[ETextureWrapMode[\"REPEAT\"] = 10497] = \"REPEAT\";\r\n})(ETextureWrapMode || (ETextureWrapMode = {}));\r\n/** @hidden */\r\nexport var ETextureFilterType;\r\n(function (ETextureFilterType) {\r\n ETextureFilterType[ETextureFilterType[\"NEAREST\"] = 9728] = \"NEAREST\";\r\n ETextureFilterType[ETextureFilterType[\"LINEAR\"] = 9728] = \"LINEAR\";\r\n ETextureFilterType[ETextureFilterType[\"NEAREST_MIPMAP_NEAREST\"] = 9984] = \"NEAREST_MIPMAP_NEAREST\";\r\n ETextureFilterType[ETextureFilterType[\"LINEAR_MIPMAP_NEAREST\"] = 9985] = \"LINEAR_MIPMAP_NEAREST\";\r\n ETextureFilterType[ETextureFilterType[\"NEAREST_MIPMAP_LINEAR\"] = 9986] = \"NEAREST_MIPMAP_LINEAR\";\r\n ETextureFilterType[ETextureFilterType[\"LINEAR_MIPMAP_LINEAR\"] = 9987] = \"LINEAR_MIPMAP_LINEAR\";\r\n})(ETextureFilterType || (ETextureFilterType = {}));\r\n/** @hidden */\r\nexport var ETextureFormat;\r\n(function (ETextureFormat) {\r\n ETextureFormat[ETextureFormat[\"ALPHA\"] = 6406] = \"ALPHA\";\r\n ETextureFormat[ETextureFormat[\"RGB\"] = 6407] = \"RGB\";\r\n ETextureFormat[ETextureFormat[\"RGBA\"] = 6408] = \"RGBA\";\r\n ETextureFormat[ETextureFormat[\"LUMINANCE\"] = 6409] = \"LUMINANCE\";\r\n ETextureFormat[ETextureFormat[\"LUMINANCE_ALPHA\"] = 6410] = \"LUMINANCE_ALPHA\";\r\n})(ETextureFormat || (ETextureFormat = {}));\r\n/** @hidden */\r\nexport var ECullingType;\r\n(function (ECullingType) {\r\n ECullingType[ECullingType[\"FRONT\"] = 1028] = \"FRONT\";\r\n ECullingType[ECullingType[\"BACK\"] = 1029] = \"BACK\";\r\n ECullingType[ECullingType[\"FRONT_AND_BACK\"] = 1032] = \"FRONT_AND_BACK\";\r\n})(ECullingType || (ECullingType = {}));\r\n/** @hidden */\r\nexport var EBlendingFunction;\r\n(function (EBlendingFunction) {\r\n EBlendingFunction[EBlendingFunction[\"ZERO\"] = 0] = \"ZERO\";\r\n EBlendingFunction[EBlendingFunction[\"ONE\"] = 1] = \"ONE\";\r\n EBlendingFunction[EBlendingFunction[\"SRC_COLOR\"] = 768] = \"SRC_COLOR\";\r\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_SRC_COLOR\"] = 769] = \"ONE_MINUS_SRC_COLOR\";\r\n EBlendingFunction[EBlendingFunction[\"DST_COLOR\"] = 774] = \"DST_COLOR\";\r\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_DST_COLOR\"] = 775] = \"ONE_MINUS_DST_COLOR\";\r\n EBlendingFunction[EBlendingFunction[\"SRC_ALPHA\"] = 770] = \"SRC_ALPHA\";\r\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_SRC_ALPHA\"] = 771] = \"ONE_MINUS_SRC_ALPHA\";\r\n EBlendingFunction[EBlendingFunction[\"DST_ALPHA\"] = 772] = \"DST_ALPHA\";\r\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_DST_ALPHA\"] = 773] = \"ONE_MINUS_DST_ALPHA\";\r\n EBlendingFunction[EBlendingFunction[\"CONSTANT_COLOR\"] = 32769] = \"CONSTANT_COLOR\";\r\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_CONSTANT_COLOR\"] = 32770] = \"ONE_MINUS_CONSTANT_COLOR\";\r\n EBlendingFunction[EBlendingFunction[\"CONSTANT_ALPHA\"] = 32771] = \"CONSTANT_ALPHA\";\r\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_CONSTANT_ALPHA\"] = 32772] = \"ONE_MINUS_CONSTANT_ALPHA\";\r\n EBlendingFunction[EBlendingFunction[\"SRC_ALPHA_SATURATE\"] = 776] = \"SRC_ALPHA_SATURATE\";\r\n})(EBlendingFunction || (EBlendingFunction = {}));\r\n//# sourceMappingURL=glTFLoaderInterfaces.js.map","import { __decorate } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport { KeyboardEventTypes } from \"../../Events/keyboardEvents\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Tools } from \"../../Misc/tools\";\r\n/**\r\n * Manage the keyboard inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraKeyboardMoveInput = /** @class */ (function () {\r\n function FreeCameraKeyboardMoveInput() {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the forward move of the camera.\r\n */\r\n this.keysUp = [38];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the upward move of the camera.\r\n */\r\n this.keysUpward = [33];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the backward move of the camera.\r\n */\r\n this.keysDown = [40];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the downward move of the camera.\r\n */\r\n this.keysDownward = [34];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the left strafe move of the camera.\r\n */\r\n this.keysLeft = [37];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the right strafe move of the camera.\r\n */\r\n this.keysRight = [39];\r\n this._keys = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.attachControl = function (noPreventDefault) {\r\n var _this = this;\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n if (this._onCanvasBlurObserver) {\r\n return;\r\n }\r\n this._scene = this.camera.getScene();\r\n this._engine = this._scene.getEngine();\r\n this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function () {\r\n _this._keys = [];\r\n });\r\n this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function (info) {\r\n var evt = info.event;\r\n if (!evt.metaKey) {\r\n if (info.type === KeyboardEventTypes.KEYDOWN) {\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1 || _this.keysUpward.indexOf(evt.keyCode) !== -1 || _this.keysDownward.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index === -1) {\r\n _this._keys.push(evt.keyCode);\r\n }\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1 || _this.keysUpward.indexOf(evt.keyCode) !== -1 || _this.keysDownward.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index >= 0) {\r\n _this._keys.splice(index, 1);\r\n }\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.detachControl = function (ignored) {\r\n if (this._scene) {\r\n if (this._onKeyboardObserver) {\r\n this._scene.onKeyboardObservable.remove(this._onKeyboardObserver);\r\n }\r\n if (this._onCanvasBlurObserver) {\r\n this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n this._onKeyboardObserver = null;\r\n this._onCanvasBlurObserver = null;\r\n }\r\n this._keys = [];\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.checkInputs = function () {\r\n if (this._onKeyboardObserver) {\r\n var camera = this.camera;\r\n // Keyboard\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var keyCode = this._keys[index];\r\n var speed = camera._computeLocalCameraSpeed();\r\n if (this.keysLeft.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(-speed, 0, 0);\r\n }\r\n else if (this.keysUp.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, 0, speed);\r\n }\r\n else if (this.keysRight.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(speed, 0, 0);\r\n }\r\n else if (this.keysDown.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, 0, -speed);\r\n }\r\n else if (this.keysUpward.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, speed, 0);\r\n }\r\n else if (this.keysDownward.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, -speed, 0);\r\n }\r\n if (camera.getScene().useRightHandedSystem) {\r\n camera._localDirection.z *= -1;\r\n }\r\n camera.getViewMatrix().invertToRef(camera._cameraTransformMatrix);\r\n Vector3.TransformNormalToRef(camera._localDirection, camera._cameraTransformMatrix, camera._transformedDirection);\r\n camera.cameraDirection.addInPlace(camera._transformedDirection);\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.getClassName = function () {\r\n return \"FreeCameraKeyboardMoveInput\";\r\n };\r\n /** @hidden */\r\n FreeCameraKeyboardMoveInput.prototype._onLostFocus = function () {\r\n this._keys = [];\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.getSimpleName = function () {\r\n return \"keyboard\";\r\n };\r\n __decorate([\r\n serialize()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysUp\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysUpward\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysDown\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysDownward\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysLeft\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysRight\", void 0);\r\n return FreeCameraKeyboardMoveInput;\r\n}());\r\nexport { FreeCameraKeyboardMoveInput };\r\nCameraInputTypes[\"FreeCameraKeyboardMoveInput\"] = FreeCameraKeyboardMoveInput;\r\n//# sourceMappingURL=freeCameraKeyboardMoveInput.js.map","import { __decorate } from \"tslib\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Tools } from \"../../Misc/tools\";\r\n/**\r\n * Manage the mouse inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraMouseInput = /** @class */ (function () {\r\n /**\r\n * Manage the mouse inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n * @param touchEnabled Defines if touch is enabled or not\r\n */\r\n function FreeCameraMouseInput(\r\n /**\r\n * Define if touch is enabled in the mouse input\r\n */\r\n touchEnabled) {\r\n if (touchEnabled === void 0) { touchEnabled = true; }\r\n this.touchEnabled = touchEnabled;\r\n /**\r\n * Defines the buttons associated with the input to handle camera move.\r\n */\r\n this.buttons = [0, 1, 2];\r\n /**\r\n * Defines the pointer angular sensibility along the X and Y axis or how fast is the camera rotating.\r\n */\r\n this.angularSensibility = 2000.0;\r\n this.previousPosition = null;\r\n /**\r\n * Observable for when a pointer move event occurs containing the move offset\r\n */\r\n this.onPointerMovedObservable = new Observable();\r\n /**\r\n * @hidden\r\n * If the camera should be rotated automatically based on pointer movement\r\n */\r\n this._allowCameraRotation = true;\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraMouseInput.prototype.attachControl = function (noPreventDefault) {\r\n var _this = this;\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n var engine = this.camera.getEngine();\r\n var element = engine.getInputElement();\r\n if (!this._pointerInput) {\r\n this._pointerInput = function (p) {\r\n var evt = p.event;\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n if (!_this.touchEnabled && evt.pointerType === \"touch\") {\r\n return;\r\n }\r\n if (p.type !== PointerEventTypes.POINTERMOVE && _this.buttons.indexOf(evt.button) === -1) {\r\n return;\r\n }\r\n var srcElement = (evt.srcElement || evt.target);\r\n if (p.type === PointerEventTypes.POINTERDOWN && srcElement) {\r\n try {\r\n srcElement.setPointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error. Execution will continue.\r\n }\r\n _this.previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY,\r\n };\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n element && element.focus();\r\n }\r\n // This is required to move while pointer button is down\r\n if (engine.isPointerLock && _this._onMouseMove) {\r\n _this._onMouseMove(p.event);\r\n }\r\n }\r\n else if (p.type === PointerEventTypes.POINTERUP && srcElement) {\r\n try {\r\n srcElement.releasePointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error.\r\n }\r\n _this.previousPosition = null;\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n else if (p.type === PointerEventTypes.POINTERMOVE) {\r\n if (!_this.previousPosition) {\r\n if (engine.isPointerLock && _this._onMouseMove) {\r\n _this._onMouseMove(p.event);\r\n }\r\n return;\r\n }\r\n var offsetX = evt.clientX - _this.previousPosition.x;\r\n var offsetY = evt.clientY - _this.previousPosition.y;\r\n if (_this.camera.getScene().useRightHandedSystem) {\r\n offsetX *= -1;\r\n }\r\n if (_this.camera.parent && _this.camera.parent._getWorldMatrixDeterminant() < 0) {\r\n offsetX *= -1;\r\n }\r\n if (_this._allowCameraRotation) {\r\n _this.camera.cameraRotation.y += offsetX / _this.angularSensibility;\r\n _this.camera.cameraRotation.x += offsetY / _this.angularSensibility;\r\n }\r\n _this.onPointerMovedObservable.notifyObservers({ offsetX: offsetX, offsetY: offsetY });\r\n _this.previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY,\r\n };\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n };\r\n }\r\n this._onMouseMove = function (evt) {\r\n if (!engine.isPointerLock) {\r\n return;\r\n }\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n var offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;\r\n if (_this.camera.getScene().useRightHandedSystem) {\r\n offsetX *= -1;\r\n }\r\n if (_this.camera.parent && _this.camera.parent._getWorldMatrixDeterminant() < 0) {\r\n offsetX *= -1;\r\n }\r\n _this.camera.cameraRotation.y += offsetX / _this.angularSensibility;\r\n var offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;\r\n _this.camera.cameraRotation.x += offsetY / _this.angularSensibility;\r\n _this.previousPosition = null;\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE);\r\n element && element.addEventListener(\"contextmenu\", this.onContextMenu.bind(this), false);\r\n };\r\n /**\r\n * Called on JS contextmenu event.\r\n * Override this method to provide functionality.\r\n */\r\n FreeCameraMouseInput.prototype.onContextMenu = function (evt) {\r\n evt.preventDefault();\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n FreeCameraMouseInput.prototype.detachControl = function (ignored) {\r\n if (this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n if (this.onContextMenu) {\r\n var engine = this.camera.getEngine();\r\n var element = engine.getInputElement();\r\n element && element.removeEventListener(\"contextmenu\", this.onContextMenu);\r\n }\r\n if (this.onPointerMovedObservable) {\r\n this.onPointerMovedObservable.clear();\r\n }\r\n this._observer = null;\r\n this._onMouseMove = null;\r\n this.previousPosition = null;\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraMouseInput.prototype.getClassName = function () {\r\n return \"FreeCameraMouseInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraMouseInput.prototype.getSimpleName = function () {\r\n return \"mouse\";\r\n };\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseInput.prototype, \"buttons\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseInput.prototype, \"angularSensibility\", void 0);\r\n return FreeCameraMouseInput;\r\n}());\r\nexport { FreeCameraMouseInput };\r\nCameraInputTypes[\"FreeCameraMouseInput\"] = FreeCameraMouseInput;\r\n//# sourceMappingURL=freeCameraMouseInput.js.map","import { __decorate } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Tools } from \"../../Misc/tools\";\r\n/**\r\n * Base class for mouse wheel input..\r\n * See FollowCameraMouseWheelInput in src/Cameras/Inputs/freeCameraMouseWheelInput.ts\r\n * for example usage.\r\n */\r\nvar BaseCameraMouseWheelInput = /** @class */ (function () {\r\n function BaseCameraMouseWheelInput() {\r\n /**\r\n * How fast is the camera moves in relation to X axis mouseWheel events.\r\n * Use negative value to reverse direction.\r\n */\r\n this.wheelPrecisionX = 3.0;\r\n /**\r\n * How fast is the camera moves in relation to Y axis mouseWheel events.\r\n * Use negative value to reverse direction.\r\n */\r\n this.wheelPrecisionY = 3.0;\r\n /**\r\n * How fast is the camera moves in relation to Z axis mouseWheel events.\r\n * Use negative value to reverse direction.\r\n */\r\n this.wheelPrecisionZ = 3.0;\r\n /**\r\n * Observable for when a mouse wheel move event occurs.\r\n */\r\n this.onChangedObservable = new Observable();\r\n /**\r\n * Incremental value of multiple mouse wheel movements of the X axis.\r\n * Should be zero-ed when read.\r\n */\r\n this._wheelDeltaX = 0;\r\n /**\r\n * Incremental value of multiple mouse wheel movements of the Y axis.\r\n * Should be zero-ed when read.\r\n */\r\n this._wheelDeltaY = 0;\r\n /**\r\n * Incremental value of multiple mouse wheel movements of the Z axis.\r\n * Should be zero-ed when read.\r\n */\r\n this._wheelDeltaZ = 0;\r\n /**\r\n * Firefox uses a different scheme to report scroll distances to other\r\n * browsers. Rather than use complicated methods to calculate the exact\r\n * multiple we need to apply, let's just cheat and use a constant.\r\n * https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaMode\r\n * https://stackoverflow.com/questions/20110224/what-is-the-height-of-a-line-in-a-wheel-event-deltamode-dom-delta-line\r\n */\r\n this._ffMultiplier = 12;\r\n /**\r\n * Different event attributes for wheel data fall into a few set ranges.\r\n * Some relevant but dated date here:\r\n * https://stackoverflow.com/questions/5527601/normalizing-mousewheel-speed-across-browsers\r\n */\r\n this._normalize = 120;\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls\r\n * should call preventdefault().\r\n * (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n BaseCameraMouseWheelInput.prototype.attachControl = function (noPreventDefault) {\r\n var _this = this;\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n this._wheel = function (pointer) {\r\n // sanity check - this should be a PointerWheel event.\r\n if (pointer.type !== PointerEventTypes.POINTERWHEEL) {\r\n return;\r\n }\r\n var event = pointer.event;\r\n var platformScale = event.deltaMode === WheelEvent.DOM_DELTA_LINE ? _this._ffMultiplier : 1;\r\n if (event.deltaY !== undefined) {\r\n // Most recent browsers versions have delta properties.\r\n // Firefox >= v17 (Has WebGL >= v4)\r\n // Chrome >= v31 (Has WebGL >= v8)\r\n // Edge >= v12 (Has WebGl >= v12)\r\n // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\r\n _this._wheelDeltaX += (_this.wheelPrecisionX * platformScale * event.deltaX) / _this._normalize;\r\n _this._wheelDeltaY -= (_this.wheelPrecisionY * platformScale * event.deltaY) / _this._normalize;\r\n _this._wheelDeltaZ += (_this.wheelPrecisionZ * platformScale * event.deltaZ) / _this._normalize;\r\n }\r\n else if (event.wheelDeltaY !== undefined) {\r\n // Unsure whether these catch anything more. Documentation\r\n // online is contradictory.\r\n _this._wheelDeltaX += (_this.wheelPrecisionX * platformScale * event.wheelDeltaX) / _this._normalize;\r\n _this._wheelDeltaY -= (_this.wheelPrecisionY * platformScale * event.wheelDeltaY) / _this._normalize;\r\n _this._wheelDeltaZ += (_this.wheelPrecisionZ * platformScale * event.wheelDeltaZ) / _this._normalize;\r\n }\r\n else if (event.wheelDelta) {\r\n // IE >= v9 (Has WebGL >= v11)\r\n // Maybe others?\r\n _this._wheelDeltaY -= (_this.wheelPrecisionY * event.wheelDelta) / _this._normalize;\r\n }\r\n if (event.preventDefault) {\r\n if (!noPreventDefault) {\r\n event.preventDefault();\r\n }\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, PointerEventTypes.POINTERWHEEL);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n BaseCameraMouseWheelInput.prototype.detachControl = function (ignored) {\r\n if (this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n this._wheel = null;\r\n }\r\n if (this.onChangedObservable) {\r\n this.onChangedObservable.clear();\r\n }\r\n };\r\n /**\r\n * Called for each rendered frame.\r\n */\r\n BaseCameraMouseWheelInput.prototype.checkInputs = function () {\r\n this.onChangedObservable.notifyObservers({\r\n wheelDeltaX: this._wheelDeltaX,\r\n wheelDeltaY: this._wheelDeltaY,\r\n wheelDeltaZ: this._wheelDeltaZ,\r\n });\r\n // Clear deltas.\r\n this._wheelDeltaX = 0;\r\n this._wheelDeltaY = 0;\r\n this._wheelDeltaZ = 0;\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n BaseCameraMouseWheelInput.prototype.getClassName = function () {\r\n return \"BaseCameraMouseWheelInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n BaseCameraMouseWheelInput.prototype.getSimpleName = function () {\r\n return \"mousewheel\";\r\n };\r\n __decorate([\r\n serialize()\r\n ], BaseCameraMouseWheelInput.prototype, \"wheelPrecisionX\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseCameraMouseWheelInput.prototype, \"wheelPrecisionY\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseCameraMouseWheelInput.prototype, \"wheelPrecisionZ\", void 0);\r\n return BaseCameraMouseWheelInput;\r\n}());\r\nexport { BaseCameraMouseWheelInput };\r\n//# sourceMappingURL=BaseCameraMouseWheelInput.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport { BaseCameraMouseWheelInput } from \"../../Cameras/Inputs/BaseCameraMouseWheelInput\";\r\nimport { Matrix, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Coordinate } from \"../../Maths/math.axis\";\r\nvar _CameraProperty;\r\n(function (_CameraProperty) {\r\n _CameraProperty[_CameraProperty[\"MoveRelative\"] = 0] = \"MoveRelative\";\r\n _CameraProperty[_CameraProperty[\"RotateRelative\"] = 1] = \"RotateRelative\";\r\n _CameraProperty[_CameraProperty[\"MoveScene\"] = 2] = \"MoveScene\";\r\n})(_CameraProperty || (_CameraProperty = {}));\r\n/**\r\n * Manage the mouse wheel inputs to control a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraMouseWheelInput = /** @class */ (function (_super) {\r\n __extends(FreeCameraMouseWheelInput, _super);\r\n function FreeCameraMouseWheelInput() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._moveRelative = Vector3.Zero();\r\n _this._rotateRelative = Vector3.Zero();\r\n _this._moveScene = Vector3.Zero();\r\n /**\r\n * These are set to the desired default behaviour.\r\n */\r\n _this._wheelXAction = _CameraProperty.MoveRelative;\r\n _this._wheelXActionCoordinate = Coordinate.X;\r\n _this._wheelYAction = _CameraProperty.MoveRelative;\r\n _this._wheelYActionCoordinate = Coordinate.Z;\r\n _this._wheelZAction = null;\r\n _this._wheelZActionCoordinate = null;\r\n return _this;\r\n }\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n FreeCameraMouseWheelInput.prototype.getClassName = function () {\r\n return \"FreeCameraMouseWheelInput\";\r\n };\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelXMoveRelative\", {\r\n /**\r\n * Get the configured movement axis (relative to camera's orientation) the\r\n * mouse wheel's X axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelXAction !== _CameraProperty.MoveRelative) {\r\n return null;\r\n }\r\n return this._wheelXActionCoordinate;\r\n },\r\n /**\r\n * Set which movement axis (relative to camera's orientation) the mouse\r\n * wheel's X axis controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelXAction !== _CameraProperty.MoveRelative) {\r\n // Attempting to clear different _wheelXAction.\r\n return;\r\n }\r\n this._wheelXAction = _CameraProperty.MoveRelative;\r\n this._wheelXActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelYMoveRelative\", {\r\n /**\r\n * Get the configured movement axis (relative to camera's orientation) the\r\n * mouse wheel's Y axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelYAction !== _CameraProperty.MoveRelative) {\r\n return null;\r\n }\r\n return this._wheelYActionCoordinate;\r\n },\r\n /**\r\n * Set which movement axis (relative to camera's orientation) the mouse\r\n * wheel's Y axis controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelYAction !== _CameraProperty.MoveRelative) {\r\n // Attempting to clear different _wheelYAction.\r\n return;\r\n }\r\n this._wheelYAction = _CameraProperty.MoveRelative;\r\n this._wheelYActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelZMoveRelative\", {\r\n /**\r\n * Get the configured movement axis (relative to camera's orientation) the\r\n * mouse wheel's Z axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelZAction !== _CameraProperty.MoveRelative) {\r\n return null;\r\n }\r\n return this._wheelZActionCoordinate;\r\n },\r\n /**\r\n * Set which movement axis (relative to camera's orientation) the mouse\r\n * wheel's Z axis controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelZAction !== _CameraProperty.MoveRelative) {\r\n // Attempting to clear different _wheelZAction.\r\n return;\r\n }\r\n this._wheelZAction = _CameraProperty.MoveRelative;\r\n this._wheelZActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelXRotateRelative\", {\r\n /**\r\n * Get the configured rotation axis (relative to camera's orientation) the\r\n * mouse wheel's X axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelXAction !== _CameraProperty.RotateRelative) {\r\n return null;\r\n }\r\n return this._wheelXActionCoordinate;\r\n },\r\n /**\r\n * Set which rotation axis (relative to camera's orientation) the mouse\r\n * wheel's X axis controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelXAction !== _CameraProperty.RotateRelative) {\r\n // Attempting to clear different _wheelXAction.\r\n return;\r\n }\r\n this._wheelXAction = _CameraProperty.RotateRelative;\r\n this._wheelXActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelYRotateRelative\", {\r\n /**\r\n * Get the configured rotation axis (relative to camera's orientation) the\r\n * mouse wheel's Y axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelYAction !== _CameraProperty.RotateRelative) {\r\n return null;\r\n }\r\n return this._wheelYActionCoordinate;\r\n },\r\n /**\r\n * Set which rotation axis (relative to camera's orientation) the mouse\r\n * wheel's Y axis controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelYAction !== _CameraProperty.RotateRelative) {\r\n // Attempting to clear different _wheelYAction.\r\n return;\r\n }\r\n this._wheelYAction = _CameraProperty.RotateRelative;\r\n this._wheelYActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelZRotateRelative\", {\r\n /**\r\n * Get the configured rotation axis (relative to camera's orientation) the\r\n * mouse wheel's Z axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelZAction !== _CameraProperty.RotateRelative) {\r\n return null;\r\n }\r\n return this._wheelZActionCoordinate;\r\n },\r\n /**\r\n * Set which rotation axis (relative to camera's orientation) the mouse\r\n * wheel's Z axis controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelZAction !== _CameraProperty.RotateRelative) {\r\n // Attempting to clear different _wheelZAction.\r\n return;\r\n }\r\n this._wheelZAction = _CameraProperty.RotateRelative;\r\n this._wheelZActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelXMoveScene\", {\r\n /**\r\n * Get the configured movement axis (relative to the scene) the mouse wheel's\r\n * X axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelXAction !== _CameraProperty.MoveScene) {\r\n return null;\r\n }\r\n return this._wheelXActionCoordinate;\r\n },\r\n /**\r\n * Set which movement axis (relative to the scene) the mouse wheel's X axis\r\n * controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelXAction !== _CameraProperty.MoveScene) {\r\n // Attempting to clear different _wheelXAction.\r\n return;\r\n }\r\n this._wheelXAction = _CameraProperty.MoveScene;\r\n this._wheelXActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelYMoveScene\", {\r\n /**\r\n * Get the configured movement axis (relative to the scene) the mouse wheel's\r\n * Y axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelYAction !== _CameraProperty.MoveScene) {\r\n return null;\r\n }\r\n return this._wheelYActionCoordinate;\r\n },\r\n /**\r\n * Set which movement axis (relative to the scene) the mouse wheel's Y axis\r\n * controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelYAction !== _CameraProperty.MoveScene) {\r\n // Attempting to clear different _wheelYAction.\r\n return;\r\n }\r\n this._wheelYAction = _CameraProperty.MoveScene;\r\n this._wheelYActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelZMoveScene\", {\r\n /**\r\n * Get the configured movement axis (relative to the scene) the mouse wheel's\r\n * Z axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelZAction !== _CameraProperty.MoveScene) {\r\n return null;\r\n }\r\n return this._wheelZActionCoordinate;\r\n },\r\n /**\r\n * Set which movement axis (relative to the scene) the mouse wheel's Z axis\r\n * controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelZAction !== _CameraProperty.MoveScene) {\r\n // Attempting to clear different _wheelZAction.\r\n return;\r\n }\r\n this._wheelZAction = _CameraProperty.MoveScene;\r\n this._wheelZActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Called for each rendered frame.\r\n */\r\n FreeCameraMouseWheelInput.prototype.checkInputs = function () {\r\n if (this._wheelDeltaX === 0 &&\r\n this._wheelDeltaY === 0 &&\r\n this._wheelDeltaZ == 0) {\r\n return;\r\n }\r\n // Clear the camera properties that we might be updating.\r\n this._moveRelative.setAll(0);\r\n this._rotateRelative.setAll(0);\r\n this._moveScene.setAll(0);\r\n // Set the camera properties that are to be updated.\r\n this._updateCamera();\r\n if (this.camera.getScene().useRightHandedSystem) {\r\n // TODO: Does this need done for worldUpdate too?\r\n this._moveRelative.z *= -1;\r\n }\r\n // Convert updates relative to camera to world position update.\r\n var cameraTransformMatrix = Matrix.Zero();\r\n this.camera.getViewMatrix().invertToRef(cameraTransformMatrix);\r\n var transformedDirection = Vector3.Zero();\r\n Vector3.TransformNormalToRef(this._moveRelative, cameraTransformMatrix, transformedDirection);\r\n // Apply updates to camera position.\r\n this.camera.cameraRotation.x += this._rotateRelative.x / 200;\r\n this.camera.cameraRotation.y += this._rotateRelative.y / 200;\r\n this.camera.cameraDirection.addInPlace(transformedDirection);\r\n this.camera.cameraDirection.addInPlace(this._moveScene);\r\n // Call the base class implementation to handle observers and do cleanup.\r\n _super.prototype.checkInputs.call(this);\r\n };\r\n /**\r\n * Update the camera according to any configured properties for the 3\r\n * mouse-wheel axis.\r\n */\r\n FreeCameraMouseWheelInput.prototype._updateCamera = function () {\r\n var moveRelative = this._moveRelative;\r\n var rotateRelative = this._rotateRelative;\r\n var moveScene = this._moveScene;\r\n var updateCameraProperty = function (/* Mouse-wheel delta. */ value, \r\n /* Camera property to be changed. */\r\n cameraProperty, \r\n /* Axis of Camera property to be changed. */\r\n coordinate) {\r\n if (value === 0) {\r\n // Mouse wheel has not moved.\r\n return;\r\n }\r\n if (cameraProperty === null || coordinate === null) {\r\n // Mouse wheel axis not configured.\r\n return;\r\n }\r\n var action = null;\r\n switch (cameraProperty) {\r\n case _CameraProperty.MoveRelative:\r\n action = moveRelative;\r\n break;\r\n case _CameraProperty.RotateRelative:\r\n action = rotateRelative;\r\n break;\r\n case _CameraProperty.MoveScene:\r\n action = moveScene;\r\n break;\r\n }\r\n switch (coordinate) {\r\n case Coordinate.X:\r\n action.set(value, 0, 0);\r\n break;\r\n case Coordinate.Y:\r\n action.set(0, value, 0);\r\n break;\r\n case Coordinate.Z:\r\n action.set(0, 0, value);\r\n break;\r\n }\r\n };\r\n // Do the camera updates for each of the 3 touch-wheel axis.\r\n updateCameraProperty(this._wheelDeltaX, this._wheelXAction, this._wheelXActionCoordinate);\r\n updateCameraProperty(this._wheelDeltaY, this._wheelYAction, this._wheelYActionCoordinate);\r\n updateCameraProperty(this._wheelDeltaZ, this._wheelZAction, this._wheelZActionCoordinate);\r\n };\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelXMoveRelative\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelYMoveRelative\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelZMoveRelative\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelXRotateRelative\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelYRotateRelative\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelZRotateRelative\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelXMoveScene\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelYMoveScene\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelZMoveScene\", null);\r\n return FreeCameraMouseWheelInput;\r\n}(BaseCameraMouseWheelInput));\r\nexport { FreeCameraMouseWheelInput };\r\nCameraInputTypes[\"FreeCameraMouseWheelInput\"] = FreeCameraMouseWheelInput;\r\n//# sourceMappingURL=freeCameraMouseWheelInput.js.map","import { __decorate } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Matrix, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Tools } from \"../../Misc/tools\";\r\n/**\r\n * Manage the touch inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraTouchInput = /** @class */ (function () {\r\n /**\r\n * Manage the touch inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n * @param allowMouse Defines if mouse events can be treated as touch events\r\n */\r\n function FreeCameraTouchInput(\r\n /**\r\n * Define if mouse events can be treated as touch events\r\n */\r\n allowMouse) {\r\n if (allowMouse === void 0) { allowMouse = false; }\r\n this.allowMouse = allowMouse;\r\n /**\r\n * Defines the touch sensibility for rotation.\r\n * The higher the faster.\r\n */\r\n this.touchAngularSensibility = 200000.0;\r\n /**\r\n * Defines the touch sensibility for move.\r\n * The higher the faster.\r\n */\r\n this.touchMoveSensibility = 250.0;\r\n this._offsetX = null;\r\n this._offsetY = null;\r\n this._pointerPressed = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraTouchInput.prototype.attachControl = function (noPreventDefault) {\r\n var _this = this;\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n var previousPosition = null;\r\n if (this._pointerInput === undefined) {\r\n this._onLostFocus = function () {\r\n _this._offsetX = null;\r\n _this._offsetY = null;\r\n };\r\n this._pointerInput = function (p) {\r\n var evt = p.event;\r\n var isMouseEvent = !_this.camera.getEngine().hostInformation.isMobile && evt instanceof MouseEvent;\r\n if (!_this.allowMouse && (evt.pointerType === \"mouse\" || isMouseEvent)) {\r\n return;\r\n }\r\n if (p.type === PointerEventTypes.POINTERDOWN) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n _this._pointerPressed.push(evt.pointerId);\r\n if (_this._pointerPressed.length !== 1) {\r\n return;\r\n }\r\n previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY,\r\n };\r\n }\r\n else if (p.type === PointerEventTypes.POINTERUP) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n var index = _this._pointerPressed.indexOf(evt.pointerId);\r\n if (index === -1) {\r\n return;\r\n }\r\n _this._pointerPressed.splice(index, 1);\r\n if (index != 0) {\r\n return;\r\n }\r\n previousPosition = null;\r\n _this._offsetX = null;\r\n _this._offsetY = null;\r\n }\r\n else if (p.type === PointerEventTypes.POINTERMOVE) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n if (!previousPosition) {\r\n return;\r\n }\r\n var index = _this._pointerPressed.indexOf(evt.pointerId);\r\n if (index != 0) {\r\n return;\r\n }\r\n _this._offsetX = evt.clientX - previousPosition.x;\r\n _this._offsetY = -(evt.clientY - previousPosition.y);\r\n }\r\n };\r\n }\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE);\r\n if (this._onLostFocus) {\r\n var engine = this.camera.getEngine();\r\n var element = engine.getInputElement();\r\n element && element.addEventListener(\"blur\", this._onLostFocus);\r\n }\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n FreeCameraTouchInput.prototype.detachControl = function (ignored) {\r\n if (this._pointerInput) {\r\n if (this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n }\r\n if (this._onLostFocus) {\r\n var engine = this.camera.getEngine();\r\n var element = engine.getInputElement();\r\n element && element.removeEventListener(\"blur\", this._onLostFocus);\r\n this._onLostFocus = null;\r\n }\r\n this._pointerPressed = [];\r\n this._offsetX = null;\r\n this._offsetY = null;\r\n }\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FreeCameraTouchInput.prototype.checkInputs = function () {\r\n if (this._offsetX === null || this._offsetY === null) {\r\n return;\r\n }\r\n if (this._offsetX === 0 && this._offsetY === 0) {\r\n return;\r\n }\r\n var camera = this.camera;\r\n camera.cameraRotation.y = this._offsetX / this.touchAngularSensibility;\r\n if (this._pointerPressed.length > 1) {\r\n camera.cameraRotation.x = -this._offsetY / this.touchAngularSensibility;\r\n }\r\n else {\r\n var speed = camera._computeLocalCameraSpeed();\r\n var direction = new Vector3(0, 0, (speed * this._offsetY) / this.touchMoveSensibility);\r\n Matrix.RotationYawPitchRollToRef(camera.rotation.y, camera.rotation.x, 0, camera._cameraRotationMatrix);\r\n camera.cameraDirection.addInPlace(Vector3.TransformCoordinates(direction, camera._cameraRotationMatrix));\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraTouchInput.prototype.getClassName = function () {\r\n return \"FreeCameraTouchInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraTouchInput.prototype.getSimpleName = function () {\r\n return \"touch\";\r\n };\r\n __decorate([\r\n serialize()\r\n ], FreeCameraTouchInput.prototype, \"touchAngularSensibility\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraTouchInput.prototype, \"touchMoveSensibility\", void 0);\r\n return FreeCameraTouchInput;\r\n}());\r\nexport { FreeCameraTouchInput };\r\nCameraInputTypes[\"FreeCameraTouchInput\"] = FreeCameraTouchInput;\r\n//# sourceMappingURL=freeCameraTouchInput.js.map","import { __extends } from \"tslib\";\r\nimport { CameraInputsManager } from \"./cameraInputsManager\";\r\nimport { FreeCameraKeyboardMoveInput } from \"../Cameras/Inputs/freeCameraKeyboardMoveInput\";\r\nimport { FreeCameraMouseInput } from \"../Cameras/Inputs/freeCameraMouseInput\";\r\nimport { FreeCameraMouseWheelInput } from \"../Cameras/Inputs/freeCameraMouseWheelInput\";\r\nimport { FreeCameraTouchInput } from \"../Cameras/Inputs/freeCameraTouchInput\";\r\n/**\r\n * Default Inputs manager for the FreeCamera.\r\n * It groups all the default supported inputs for ease of use.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraInputsManager = /** @class */ (function (_super) {\r\n __extends(FreeCameraInputsManager, _super);\r\n /**\r\n * Instantiates a new FreeCameraInputsManager.\r\n * @param camera Defines the camera the inputs belong to\r\n */\r\n function FreeCameraInputsManager(camera) {\r\n var _this = _super.call(this, camera) || this;\r\n /**\r\n * @hidden\r\n */\r\n _this._mouseInput = null;\r\n /**\r\n * @hidden\r\n */\r\n _this._mouseWheelInput = null;\r\n return _this;\r\n }\r\n /**\r\n * Add keyboard input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.addKeyboard = function () {\r\n this.add(new FreeCameraKeyboardMoveInput());\r\n return this;\r\n };\r\n /**\r\n * Add mouse input support to the input manager.\r\n * @param touchEnabled if the FreeCameraMouseInput should support touch (default: true)\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.addMouse = function (touchEnabled) {\r\n if (touchEnabled === void 0) { touchEnabled = true; }\r\n if (!this._mouseInput) {\r\n this._mouseInput = new FreeCameraMouseInput(touchEnabled);\r\n this.add(this._mouseInput);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Removes the mouse input support from the manager\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.removeMouse = function () {\r\n if (this._mouseInput) {\r\n this.remove(this._mouseInput);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Add mouse wheel input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.addMouseWheel = function () {\r\n if (!this._mouseWheelInput) {\r\n this._mouseWheelInput = new FreeCameraMouseWheelInput();\r\n this.add(this._mouseWheelInput);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Removes the mouse wheel input support from the manager\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.removeMouseWheel = function () {\r\n if (this._mouseWheelInput) {\r\n this.remove(this._mouseWheelInput);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Add touch input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.addTouch = function () {\r\n this.add(new FreeCameraTouchInput());\r\n return this;\r\n };\r\n /**\r\n * Remove all attached input methods from a camera\r\n */\r\n FreeCameraInputsManager.prototype.clear = function () {\r\n _super.prototype.clear.call(this);\r\n this._mouseInput = null;\r\n };\r\n return FreeCameraInputsManager;\r\n}(CameraInputsManager));\r\nexport { FreeCameraInputsManager };\r\n//# sourceMappingURL=freeCameraInputsManager.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serializeAsVector3, serialize } from \"../Misc/decorators\";\r\nimport { Vector3, Vector2 } from \"../Maths/math.vector\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { TargetCamera } from \"./targetCamera\";\r\nimport { FreeCameraInputsManager } from \"./freeCameraInputsManager\";\r\nimport { Tools } from '../Misc/tools';\r\n/**\r\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\r\n * Please consider using the new UniversalCamera instead as it adds more functionality like the gamepad.\r\n * @see https://doc.babylonjs.com/features/cameras#universal-camera\r\n */\r\nvar FreeCamera = /** @class */ (function (_super) {\r\n __extends(FreeCamera, _super);\r\n /**\r\n * Instantiates a Free Camera.\r\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\r\n * Please consider using the new UniversalCamera instead as it adds more functionality like touch to this camera.\r\n * @see https://doc.babylonjs.com/features/cameras#universal-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the start position of the camera in the scene\r\n * @param scene Define the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active if not other active cameras have been defined\r\n */\r\n function FreeCamera(name, position, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, position, scene, setActiveOnSceneIfNoneActive) || this;\r\n /**\r\n * Define the collision ellipsoid of the camera.\r\n * This is helpful to simulate a camera body like the player body around the camera\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#arcrotatecamera\r\n */\r\n _this.ellipsoid = new Vector3(0.5, 1, 0.5);\r\n /**\r\n * Define an offset for the position of the ellipsoid around the camera.\r\n * This can be helpful to determine the center of the body near the gravity center of the body\r\n * instead of its head.\r\n */\r\n _this.ellipsoidOffset = new Vector3(0, 0, 0);\r\n /**\r\n * Enable or disable collisions of the camera with the rest of the scene objects.\r\n */\r\n _this.checkCollisions = false;\r\n /**\r\n * Enable or disable gravity on the camera.\r\n */\r\n _this.applyGravity = false;\r\n _this._needMoveForGravity = false;\r\n _this._oldPosition = Vector3.Zero();\r\n _this._diffPosition = Vector3.Zero();\r\n _this._newPosition = Vector3.Zero();\r\n // Collisions\r\n _this._collisionMask = -1;\r\n _this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {\r\n if (collidedMesh === void 0) { collidedMesh = null; }\r\n var updatePosition = function (newPos) {\r\n _this._newPosition.copyFrom(newPos);\r\n _this._newPosition.subtractToRef(_this._oldPosition, _this._diffPosition);\r\n if (_this._diffPosition.length() > Engine.CollisionsEpsilon) {\r\n _this.position.addInPlace(_this._diffPosition);\r\n if (_this.onCollide && collidedMesh) {\r\n _this.onCollide(collidedMesh);\r\n }\r\n }\r\n };\r\n updatePosition(newPosition);\r\n };\r\n _this.inputs = new FreeCameraInputsManager(_this);\r\n _this.inputs.addKeyboard().addMouse();\r\n return _this;\r\n }\r\n Object.defineProperty(FreeCamera.prototype, \"angularSensibility\", {\r\n /**\r\n * Gets the input sensibility for a mouse input. (default is 2000.0)\r\n * Higher values reduce sensitivity.\r\n */\r\n get: function () {\r\n var mouse = this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n return mouse.angularSensibility;\r\n }\r\n return 0;\r\n },\r\n /**\r\n * Sets the input sensibility for a mouse input. (default is 2000.0)\r\n * Higher values reduce sensitivity.\r\n */\r\n set: function (value) {\r\n var mouse = this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n mouse.angularSensibility = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysUp\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the forward move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUp;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUp = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysUpward\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the upward move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUpward;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUpward = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysDown\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the backward move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDown;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDown = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysDownward\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the downward move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDownward;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDownward = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysLeft\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the left strafe move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysLeft;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysLeft = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysRight\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the right strafe move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRight;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRight = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Attached controls to the current camera.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCamera.prototype.attachControl = function (ignored, noPreventDefault) {\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n this.inputs.attachElement(noPreventDefault);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n FreeCamera.prototype.detachControl = function (ignored) {\r\n this.inputs.detachElement();\r\n this.cameraDirection = new Vector3(0, 0, 0);\r\n this.cameraRotation = new Vector2(0, 0);\r\n };\r\n Object.defineProperty(FreeCamera.prototype, \"collisionMask\", {\r\n /**\r\n * Define a collision mask to limit the list of object the camera can collide with\r\n */\r\n get: function () {\r\n return this._collisionMask;\r\n },\r\n set: function (mask) {\r\n this._collisionMask = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n FreeCamera.prototype._collideWithWorld = function (displacement) {\r\n var globalPosition;\r\n if (this.parent) {\r\n globalPosition = Vector3.TransformCoordinates(this.position, this.parent.getWorldMatrix());\r\n }\r\n else {\r\n globalPosition = this.position;\r\n }\r\n globalPosition.subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition);\r\n this._oldPosition.addInPlace(this.ellipsoidOffset);\r\n var coordinator = this.getScene().collisionCoordinator;\r\n if (!this._collider) {\r\n this._collider = coordinator.createCollider();\r\n }\r\n this._collider._radius = this.ellipsoid;\r\n this._collider.collisionMask = this._collisionMask;\r\n //no need for clone, as long as gravity is not on.\r\n var actualDisplacement = displacement;\r\n //add gravity to the direction to prevent the dual-collision checking\r\n if (this.applyGravity) {\r\n //this prevents mending with cameraDirection, a global variable of the free camera class.\r\n actualDisplacement = displacement.add(this.getScene().gravity);\r\n }\r\n coordinator.getNewPosition(this._oldPosition, actualDisplacement, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);\r\n };\r\n /** @hidden */\r\n FreeCamera.prototype._checkInputs = function () {\r\n if (!this._localDirection) {\r\n this._localDirection = Vector3.Zero();\r\n this._transformedDirection = Vector3.Zero();\r\n }\r\n this.inputs.checkInputs();\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n /** @hidden */\r\n FreeCamera.prototype._decideIfNeedsToMove = function () {\r\n return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\r\n };\r\n /** @hidden */\r\n FreeCamera.prototype._updatePosition = function () {\r\n if (this.checkCollisions && this.getScene().collisionsEnabled) {\r\n this._collideWithWorld(this.cameraDirection);\r\n }\r\n else {\r\n _super.prototype._updatePosition.call(this);\r\n }\r\n };\r\n /**\r\n * Destroy the camera and release the current resources hold by it.\r\n */\r\n FreeCamera.prototype.dispose = function () {\r\n this.inputs.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n FreeCamera.prototype.getClassName = function () {\r\n return \"FreeCamera\";\r\n };\r\n __decorate([\r\n serializeAsVector3()\r\n ], FreeCamera.prototype, \"ellipsoid\", void 0);\r\n __decorate([\r\n serializeAsVector3()\r\n ], FreeCamera.prototype, \"ellipsoidOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCamera.prototype, \"checkCollisions\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCamera.prototype, \"applyGravity\", void 0);\r\n return FreeCamera;\r\n}(TargetCamera));\r\nexport { FreeCamera };\r\n//# sourceMappingURL=freeCamera.js.map","import { __extends } from \"tslib\";\r\nimport { Vector3, Quaternion, Matrix } from \"../Maths/math.vector\";\r\nimport { ArrayTools } from \"../Misc/arrayTools\";\r\nimport { Node } from \"../node\";\r\nimport { Space } from '../Maths/math.axis';\r\n/**\r\n * Class used to store bone information\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\nvar Bone = /** @class */ (function (_super) {\r\n __extends(Bone, _super);\r\n /**\r\n * Create a new bone\r\n * @param name defines the bone name\r\n * @param skeleton defines the parent skeleton\r\n * @param parentBone defines the parent (can be null if the bone is the root)\r\n * @param localMatrix defines the local matrix\r\n * @param restPose defines the rest pose matrix\r\n * @param baseMatrix defines the base matrix\r\n * @param index defines index of the bone in the hiearchy\r\n */\r\n function Bone(\r\n /**\r\n * defines the bone name\r\n */\r\n name, skeleton, parentBone, localMatrix, restPose, baseMatrix, index) {\r\n if (parentBone === void 0) { parentBone = null; }\r\n if (localMatrix === void 0) { localMatrix = null; }\r\n if (restPose === void 0) { restPose = null; }\r\n if (baseMatrix === void 0) { baseMatrix = null; }\r\n if (index === void 0) { index = null; }\r\n var _this = _super.call(this, name, skeleton.getScene()) || this;\r\n _this.name = name;\r\n /**\r\n * Gets the list of child bones\r\n */\r\n _this.children = new Array();\r\n /** Gets the animations associated with this bone */\r\n _this.animations = new Array();\r\n /**\r\n * @hidden Internal only\r\n * Set this value to map this bone to a different index in the transform matrices\r\n * Set this value to -1 to exclude the bone from the transform matrices\r\n */\r\n _this._index = null;\r\n _this._absoluteTransform = new Matrix();\r\n _this._invertedAbsoluteTransform = new Matrix();\r\n _this._scalingDeterminant = 1;\r\n _this._worldTransform = new Matrix();\r\n _this._needToDecompose = true;\r\n _this._needToCompose = false;\r\n /** @hidden */\r\n _this._linkedTransformNode = null;\r\n /** @hidden */\r\n _this._waitingTransformNodeId = null;\r\n _this._skeleton = skeleton;\r\n _this._localMatrix = localMatrix ? localMatrix.clone() : Matrix.Identity();\r\n _this._restPose = restPose ? restPose : _this._localMatrix.clone();\r\n _this._bindPose = _this._localMatrix.clone();\r\n _this._baseMatrix = baseMatrix ? baseMatrix : _this._localMatrix.clone();\r\n _this._index = index;\r\n skeleton.bones.push(_this);\r\n _this.setParent(parentBone, false);\r\n if (baseMatrix || localMatrix) {\r\n _this._updateDifferenceMatrix();\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(Bone.prototype, \"_matrix\", {\r\n /** @hidden */\r\n get: function () {\r\n this._compose();\r\n return this._localMatrix;\r\n },\r\n /** @hidden */\r\n set: function (value) {\r\n this._localMatrix.copyFrom(value);\r\n this._needToDecompose = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n Bone.prototype.getClassName = function () {\r\n return \"Bone\";\r\n };\r\n // Members\r\n /**\r\n * Gets the parent skeleton\r\n * @returns a skeleton\r\n */\r\n Bone.prototype.getSkeleton = function () {\r\n return this._skeleton;\r\n };\r\n /**\r\n * Gets parent bone\r\n * @returns a bone or null if the bone is the root of the bone hierarchy\r\n */\r\n Bone.prototype.getParent = function () {\r\n return this._parent;\r\n };\r\n /**\r\n * Returns an array containing the root bones\r\n * @returns an array containing the root bones\r\n */\r\n Bone.prototype.getChildren = function () {\r\n return this.children;\r\n };\r\n /**\r\n * Gets the node index in matrix array generated for rendering\r\n * @returns the node index\r\n */\r\n Bone.prototype.getIndex = function () {\r\n return this._index === null ? this.getSkeleton().bones.indexOf(this) : this._index;\r\n };\r\n /**\r\n * Sets the parent bone\r\n * @param parent defines the parent (can be null if the bone is the root)\r\n * @param updateDifferenceMatrix defines if the difference matrix must be updated\r\n */\r\n Bone.prototype.setParent = function (parent, updateDifferenceMatrix) {\r\n if (updateDifferenceMatrix === void 0) { updateDifferenceMatrix = true; }\r\n if (this._parent === parent) {\r\n return;\r\n }\r\n if (this._parent) {\r\n var index = this._parent.children.indexOf(this);\r\n if (index !== -1) {\r\n this._parent.children.splice(index, 1);\r\n }\r\n }\r\n this._parent = parent;\r\n if (this._parent) {\r\n this._parent.children.push(this);\r\n }\r\n if (updateDifferenceMatrix) {\r\n this._updateDifferenceMatrix();\r\n }\r\n this.markAsDirty();\r\n };\r\n /**\r\n * Gets the local matrix\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getLocalMatrix = function () {\r\n this._compose();\r\n return this._localMatrix;\r\n };\r\n /**\r\n * Gets the base matrix (initial matrix which remains unchanged)\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getBaseMatrix = function () {\r\n return this._baseMatrix;\r\n };\r\n /**\r\n * Gets the rest pose matrix\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getRestPose = function () {\r\n return this._restPose;\r\n };\r\n /**\r\n * Sets the rest pose matrix\r\n * @param matrix the local-space rest pose to set for this bone\r\n */\r\n Bone.prototype.setRestPose = function (matrix) {\r\n this._restPose.copyFrom(matrix);\r\n };\r\n /**\r\n * Gets the bind pose matrix\r\n * @returns the bind pose matrix\r\n */\r\n Bone.prototype.getBindPose = function () {\r\n return this._bindPose;\r\n };\r\n /**\r\n * Sets the bind pose matrix\r\n * @param matrix the local-space bind pose to set for this bone\r\n */\r\n Bone.prototype.setBindPose = function (matrix) {\r\n this._bindPose.copyFrom(matrix);\r\n };\r\n /**\r\n * Gets a matrix used to store world matrix (ie. the matrix sent to shaders)\r\n */\r\n Bone.prototype.getWorldMatrix = function () {\r\n return this._worldTransform;\r\n };\r\n /**\r\n * Sets the local matrix to rest pose matrix\r\n */\r\n Bone.prototype.returnToRest = function () {\r\n if (this._skeleton._numBonesWithLinkedTransformNode > 0) {\r\n this.updateMatrix(this._restPose, false, false);\r\n }\r\n else {\r\n this.updateMatrix(this._restPose, false, true);\r\n }\r\n };\r\n /**\r\n * Gets the inverse of the absolute transform matrix.\r\n * This matrix will be multiplied by local matrix to get the difference matrix (ie. the difference between original state and current state)\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getInvertedAbsoluteTransform = function () {\r\n return this._invertedAbsoluteTransform;\r\n };\r\n /**\r\n * Gets the absolute transform matrix (ie base matrix * parent world matrix)\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getAbsoluteTransform = function () {\r\n return this._absoluteTransform;\r\n };\r\n /**\r\n * Links with the given transform node.\r\n * The local matrix of this bone is copied from the transform node every frame.\r\n * @param transformNode defines the transform node to link to\r\n */\r\n Bone.prototype.linkTransformNode = function (transformNode) {\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode--;\r\n }\r\n this._linkedTransformNode = transformNode;\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode++;\r\n }\r\n };\r\n // Properties (matches AbstractMesh properties)\r\n /**\r\n * Gets the node used to drive the bone's transformation\r\n * @returns a transform node or null\r\n */\r\n Bone.prototype.getTransformNode = function () {\r\n return this._linkedTransformNode;\r\n };\r\n Object.defineProperty(Bone.prototype, \"position\", {\r\n /** Gets or sets current position (in local space) */\r\n get: function () {\r\n this._decompose();\r\n return this._localPosition;\r\n },\r\n set: function (newPosition) {\r\n this._decompose();\r\n this._localPosition.copyFrom(newPosition);\r\n this._markAsDirtyAndCompose();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"rotation\", {\r\n /** Gets or sets current rotation (in local space) */\r\n get: function () {\r\n return this.getRotation();\r\n },\r\n set: function (newRotation) {\r\n this.setRotation(newRotation);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"rotationQuaternion\", {\r\n /** Gets or sets current rotation quaternion (in local space) */\r\n get: function () {\r\n this._decompose();\r\n return this._localRotation;\r\n },\r\n set: function (newRotation) {\r\n this.setRotationQuaternion(newRotation);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"scaling\", {\r\n /** Gets or sets current scaling (in local space) */\r\n get: function () {\r\n return this.getScale();\r\n },\r\n set: function (newScaling) {\r\n this.setScale(newScaling);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets the animation properties override\r\n */\r\n get: function () {\r\n return this._skeleton.animationPropertiesOverride;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Methods\r\n Bone.prototype._decompose = function () {\r\n if (!this._needToDecompose) {\r\n return;\r\n }\r\n this._needToDecompose = false;\r\n if (!this._localScaling) {\r\n this._localScaling = Vector3.Zero();\r\n this._localRotation = Quaternion.Zero();\r\n this._localPosition = Vector3.Zero();\r\n }\r\n this._localMatrix.decompose(this._localScaling, this._localRotation, this._localPosition);\r\n };\r\n Bone.prototype._compose = function () {\r\n if (!this._needToCompose) {\r\n return;\r\n }\r\n if (!this._localScaling) {\r\n this._needToCompose = false;\r\n return;\r\n }\r\n this._needToCompose = false;\r\n Matrix.ComposeToRef(this._localScaling, this._localRotation, this._localPosition, this._localMatrix);\r\n };\r\n /**\r\n * Update the base and local matrices\r\n * @param matrix defines the new base or local matrix\r\n * @param updateDifferenceMatrix defines if the difference matrix must be updated\r\n * @param updateLocalMatrix defines if the local matrix should be updated\r\n */\r\n Bone.prototype.updateMatrix = function (matrix, updateDifferenceMatrix, updateLocalMatrix) {\r\n if (updateDifferenceMatrix === void 0) { updateDifferenceMatrix = true; }\r\n if (updateLocalMatrix === void 0) { updateLocalMatrix = true; }\r\n this._baseMatrix.copyFrom(matrix);\r\n if (updateDifferenceMatrix) {\r\n this._updateDifferenceMatrix();\r\n }\r\n if (updateLocalMatrix) {\r\n this._needToCompose = false; // in case there was a pending compose\r\n this._localMatrix.copyFrom(matrix);\r\n this._markAsDirtyAndDecompose();\r\n }\r\n else {\r\n this.markAsDirty();\r\n }\r\n };\r\n /** @hidden */\r\n Bone.prototype._updateDifferenceMatrix = function (rootMatrix, updateChildren) {\r\n if (updateChildren === void 0) { updateChildren = true; }\r\n if (!rootMatrix) {\r\n rootMatrix = this._baseMatrix;\r\n }\r\n if (this._parent) {\r\n rootMatrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform);\r\n }\r\n else {\r\n this._absoluteTransform.copyFrom(rootMatrix);\r\n }\r\n this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform);\r\n if (updateChildren) {\r\n for (var index = 0; index < this.children.length; index++) {\r\n this.children[index]._updateDifferenceMatrix();\r\n }\r\n }\r\n this._scalingDeterminant = (this._absoluteTransform.determinant() < 0 ? -1 : 1);\r\n };\r\n /**\r\n * Flag the bone as dirty (Forcing it to update everything)\r\n */\r\n Bone.prototype.markAsDirty = function () {\r\n this._currentRenderId++;\r\n this._childUpdateId++;\r\n this._skeleton._markAsDirty();\r\n };\r\n /** @hidden */\r\n Bone.prototype._markAsDirtyAndCompose = function () {\r\n this.markAsDirty();\r\n this._needToCompose = true;\r\n };\r\n Bone.prototype._markAsDirtyAndDecompose = function () {\r\n this.markAsDirty();\r\n this._needToDecompose = true;\r\n };\r\n /**\r\n * Translate the bone in local or world space\r\n * @param vec The amount to translate the bone\r\n * @param space The space that the translation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.translate = function (vec, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n var lm = this.getLocalMatrix();\r\n if (space == Space.LOCAL) {\r\n lm.addAtIndex(12, vec.x);\r\n lm.addAtIndex(13, vec.y);\r\n lm.addAtIndex(14, vec.z);\r\n }\r\n else {\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n var tvec = Bone._tmpVecs[0];\r\n if (this._parent) {\r\n if (mesh && wm) {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n }\r\n }\r\n else {\r\n Matrix.IdentityToRef(tmat);\r\n }\r\n tmat.setTranslationFromFloats(0, 0, 0);\r\n tmat.invert();\r\n Vector3.TransformCoordinatesToRef(vec, tmat, tvec);\r\n lm.addAtIndex(12, tvec.x);\r\n lm.addAtIndex(13, tvec.y);\r\n lm.addAtIndex(14, tvec.z);\r\n }\r\n this._markAsDirtyAndDecompose();\r\n };\r\n /**\r\n * Set the postion of the bone in local or world space\r\n * @param position The position to set the bone\r\n * @param space The space that the position is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setPosition = function (position, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n var lm = this.getLocalMatrix();\r\n if (space == Space.LOCAL) {\r\n lm.setTranslationFromFloats(position.x, position.y, position.z);\r\n }\r\n else {\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n var vec = Bone._tmpVecs[0];\r\n if (this._parent) {\r\n if (mesh && wm) {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n }\r\n tmat.invert();\r\n }\r\n else {\r\n Matrix.IdentityToRef(tmat);\r\n }\r\n Vector3.TransformCoordinatesToRef(position, tmat, vec);\r\n lm.setTranslationFromFloats(vec.x, vec.y, vec.z);\r\n }\r\n this._markAsDirtyAndDecompose();\r\n };\r\n /**\r\n * Set the absolute position of the bone (world space)\r\n * @param position The position to set the bone\r\n * @param mesh The mesh that this bone is attached to\r\n */\r\n Bone.prototype.setAbsolutePosition = function (position, mesh) {\r\n this.setPosition(position, Space.WORLD, mesh);\r\n };\r\n /**\r\n * Scale the bone on the x, y and z axes (in local space)\r\n * @param x The amount to scale the bone on the x axis\r\n * @param y The amount to scale the bone on the y axis\r\n * @param z The amount to scale the bone on the z axis\r\n * @param scaleChildren sets this to true if children of the bone should be scaled as well (false by default)\r\n */\r\n Bone.prototype.scale = function (x, y, z, scaleChildren) {\r\n if (scaleChildren === void 0) { scaleChildren = false; }\r\n var locMat = this.getLocalMatrix();\r\n // Apply new scaling on top of current local matrix\r\n var scaleMat = Bone._tmpMats[0];\r\n Matrix.ScalingToRef(x, y, z, scaleMat);\r\n scaleMat.multiplyToRef(locMat, locMat);\r\n // Invert scaling matrix and apply the inverse to all children\r\n scaleMat.invert();\r\n for (var _i = 0, _a = this.children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n var cm = child.getLocalMatrix();\r\n cm.multiplyToRef(scaleMat, cm);\r\n cm.multiplyAtIndex(12, x);\r\n cm.multiplyAtIndex(13, y);\r\n cm.multiplyAtIndex(14, z);\r\n child._markAsDirtyAndDecompose();\r\n }\r\n this._markAsDirtyAndDecompose();\r\n if (scaleChildren) {\r\n for (var _b = 0, _c = this.children; _b < _c.length; _b++) {\r\n var child = _c[_b];\r\n child.scale(x, y, z, scaleChildren);\r\n }\r\n }\r\n };\r\n /**\r\n * Set the bone scaling in local space\r\n * @param scale defines the scaling vector\r\n */\r\n Bone.prototype.setScale = function (scale) {\r\n this._decompose();\r\n this._localScaling.copyFrom(scale);\r\n this._markAsDirtyAndCompose();\r\n };\r\n /**\r\n * Gets the current scaling in local space\r\n * @returns the current scaling vector\r\n */\r\n Bone.prototype.getScale = function () {\r\n this._decompose();\r\n return this._localScaling;\r\n };\r\n /**\r\n * Gets the current scaling in local space and stores it in a target vector\r\n * @param result defines the target vector\r\n */\r\n Bone.prototype.getScaleToRef = function (result) {\r\n this._decompose();\r\n result.copyFrom(this._localScaling);\r\n };\r\n /**\r\n * Set the yaw, pitch, and roll of the bone in local or world space\r\n * @param yaw The rotation of the bone on the y axis\r\n * @param pitch The rotation of the bone on the x axis\r\n * @param roll The rotation of the bone on the z axis\r\n * @param space The space that the axes of rotation are in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setYawPitchRoll = function (yaw, pitch, roll, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (space === Space.LOCAL) {\r\n var quat = Bone._tmpQuat;\r\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, quat);\r\n this.setRotationQuaternion(quat, space, mesh);\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat = Bone._tmpMats[1];\r\n Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, mesh);\r\n };\r\n /**\r\n * Add a rotation to the bone on an axis in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param amount The amount to rotate the bone\r\n * @param space The space that the axis is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.rotate = function (axis, amount, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n var rmat = Bone._tmpMats[0];\r\n rmat.setTranslationFromFloats(0, 0, 0);\r\n Matrix.RotationAxisToRef(axis, amount, rmat);\r\n this._rotateWithMatrix(rmat, space, mesh);\r\n };\r\n /**\r\n * Set the rotation of the bone to a particular axis angle in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param angle The angle that the bone should be rotated to\r\n * @param space The space that the axis is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setAxisAngle = function (axis, angle, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (space === Space.LOCAL) {\r\n var quat = Bone._tmpQuat;\r\n Quaternion.RotationAxisToRef(axis, angle, quat);\r\n this.setRotationQuaternion(quat, space, mesh);\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat = Bone._tmpMats[1];\r\n Matrix.RotationAxisToRef(axis, angle, rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, mesh);\r\n };\r\n /**\r\n * Set the euler rotation of the bone in local or world space\r\n * @param rotation The euler rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setRotation = function (rotation, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n this.setYawPitchRoll(rotation.y, rotation.x, rotation.z, space, mesh);\r\n };\r\n /**\r\n * Set the quaternion rotation of the bone in local or world space\r\n * @param quat The quaternion rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setRotationQuaternion = function (quat, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (space === Space.LOCAL) {\r\n this._decompose();\r\n this._localRotation.copyFrom(quat);\r\n this._markAsDirtyAndCompose();\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat = Bone._tmpMats[1];\r\n Matrix.FromQuaternionToRef(quat, rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, mesh);\r\n };\r\n /**\r\n * Set the rotation matrix of the bone in local or world space\r\n * @param rotMat The rotation matrix that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setRotationMatrix = function (rotMat, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (space === Space.LOCAL) {\r\n var quat = Bone._tmpQuat;\r\n Quaternion.FromRotationMatrixToRef(rotMat, quat);\r\n this.setRotationQuaternion(quat, space, mesh);\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat2 = Bone._tmpMats[1];\r\n rotMat2.copyFrom(rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat2);\r\n this._rotateWithMatrix(rotMat2, space, mesh);\r\n };\r\n Bone.prototype._rotateWithMatrix = function (rmat, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n var lmat = this.getLocalMatrix();\r\n var lx = lmat.m[12];\r\n var ly = lmat.m[13];\r\n var lz = lmat.m[14];\r\n var parent = this.getParent();\r\n var parentScale = Bone._tmpMats[3];\r\n var parentScaleInv = Bone._tmpMats[4];\r\n if (parent && space == Space.WORLD) {\r\n if (mesh) {\r\n parentScale.copyFrom(mesh.getWorldMatrix());\r\n parent.getAbsoluteTransform().multiplyToRef(parentScale, parentScale);\r\n }\r\n else {\r\n parentScale.copyFrom(parent.getAbsoluteTransform());\r\n }\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n }\r\n else {\r\n if (space == Space.WORLD && mesh) {\r\n parentScale.copyFrom(mesh.getWorldMatrix());\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n }\r\n else {\r\n lmat.multiplyToRef(rmat, lmat);\r\n }\r\n }\r\n lmat.setTranslationFromFloats(lx, ly, lz);\r\n this.computeAbsoluteTransforms();\r\n this._markAsDirtyAndDecompose();\r\n };\r\n Bone.prototype._getNegativeRotationToRef = function (rotMatInv, mesh) {\r\n var scaleMatrix = Bone._tmpMats[2];\r\n rotMatInv.copyFrom(this.getAbsoluteTransform());\r\n if (mesh) {\r\n rotMatInv.multiplyToRef(mesh.getWorldMatrix(), rotMatInv);\r\n Matrix.ScalingToRef(mesh.scaling.x, mesh.scaling.y, mesh.scaling.z, scaleMatrix);\r\n }\r\n rotMatInv.invert();\r\n if (isNaN(rotMatInv.m[0])) {\r\n // Matrix failed to invert.\r\n // This can happen if scale is zero for example.\r\n return false;\r\n }\r\n scaleMatrix.multiplyAtIndex(0, this._scalingDeterminant);\r\n rotMatInv.multiplyToRef(scaleMatrix, rotMatInv);\r\n return true;\r\n };\r\n /**\r\n * Get the position of the bone in local or world space\r\n * @param space The space that the returned position is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The position of the bone\r\n */\r\n Bone.prototype.getPosition = function (space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var pos = Vector3.Zero();\r\n this.getPositionToRef(space, mesh, pos);\r\n return pos;\r\n };\r\n /**\r\n * Copy the position of the bone to a vector3 in local or world space\r\n * @param space The space that the returned position is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The vector3 to copy the position to\r\n */\r\n Bone.prototype.getPositionToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (space == Space.LOCAL) {\r\n var lm = this.getLocalMatrix();\r\n result.x = lm.m[12];\r\n result.y = lm.m[13];\r\n result.z = lm.m[14];\r\n }\r\n else {\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n if (mesh && wm) {\r\n tmat.copyFrom(this.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat = this.getAbsoluteTransform();\r\n }\r\n result.x = tmat.m[12];\r\n result.y = tmat.m[13];\r\n result.z = tmat.m[14];\r\n }\r\n };\r\n /**\r\n * Get the absolute position of the bone (world space)\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The absolute position of the bone\r\n */\r\n Bone.prototype.getAbsolutePosition = function (mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var pos = Vector3.Zero();\r\n this.getPositionToRef(Space.WORLD, mesh, pos);\r\n return pos;\r\n };\r\n /**\r\n * Copy the absolute position of the bone (world space) to the result param\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 to copy the absolute position to\r\n */\r\n Bone.prototype.getAbsolutePositionToRef = function (mesh, result) {\r\n this.getPositionToRef(Space.WORLD, mesh, result);\r\n };\r\n /**\r\n * Compute the absolute transforms of this bone and its children\r\n */\r\n Bone.prototype.computeAbsoluteTransforms = function () {\r\n this._compose();\r\n if (this._parent) {\r\n this._localMatrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform);\r\n }\r\n else {\r\n this._absoluteTransform.copyFrom(this._localMatrix);\r\n var poseMatrix = this._skeleton.getPoseMatrix();\r\n if (poseMatrix) {\r\n this._absoluteTransform.multiplyToRef(poseMatrix, this._absoluteTransform);\r\n }\r\n }\r\n var children = this.children;\r\n var len = children.length;\r\n for (var i = 0; i < len; i++) {\r\n children[i].computeAbsoluteTransforms();\r\n }\r\n };\r\n /**\r\n * Get the world direction from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The world direction\r\n */\r\n Bone.prototype.getDirection = function (localAxis, mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var result = Vector3.Zero();\r\n this.getDirectionToRef(localAxis, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the world direction to a vector3 from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 that the world direction will be copied to\r\n */\r\n Bone.prototype.getDirectionToRef = function (localAxis, mesh, result) {\r\n if (mesh === void 0) { mesh = null; }\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var mat = Bone._tmpMats[0];\r\n mat.copyFrom(this.getAbsoluteTransform());\r\n if (mesh && wm) {\r\n mat.multiplyToRef(wm, mat);\r\n }\r\n Vector3.TransformNormalToRef(localAxis, mat, result);\r\n result.normalize();\r\n };\r\n /**\r\n * Get the euler rotation of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The euler rotation\r\n */\r\n Bone.prototype.getRotation = function (space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var result = Vector3.Zero();\r\n this.getRotationToRef(space, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the euler rotation of the bone to a vector3. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The vector3 that the rotation should be copied to\r\n */\r\n Bone.prototype.getRotationToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var quat = Bone._tmpQuat;\r\n this.getRotationQuaternionToRef(space, mesh, quat);\r\n quat.toEulerAnglesToRef(result);\r\n };\r\n /**\r\n * Get the quaternion rotation of the bone in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The quaternion rotation\r\n */\r\n Bone.prototype.getRotationQuaternion = function (space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var result = Quaternion.Identity();\r\n this.getRotationQuaternionToRef(space, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the quaternion rotation of the bone to a quaternion. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n Bone.prototype.getRotationQuaternionToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n if (space == Space.LOCAL) {\r\n this._decompose();\r\n result.copyFrom(this._localRotation);\r\n }\r\n else {\r\n var mat = Bone._tmpMats[0];\r\n var amat = this.getAbsoluteTransform();\r\n if (mesh) {\r\n amat.multiplyToRef(mesh.getWorldMatrix(), mat);\r\n }\r\n else {\r\n mat.copyFrom(amat);\r\n }\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n mat.decompose(undefined, result, undefined);\r\n }\r\n };\r\n /**\r\n * Get the rotation matrix of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The rotation matrix\r\n */\r\n Bone.prototype.getRotationMatrix = function (space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n var result = Matrix.Identity();\r\n this.getRotationMatrixToRef(space, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n Bone.prototype.getRotationMatrixToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (space == Space.LOCAL) {\r\n this.getLocalMatrix().getRotationMatrixToRef(result);\r\n }\r\n else {\r\n var mat = Bone._tmpMats[0];\r\n var amat = this.getAbsoluteTransform();\r\n if (mesh) {\r\n amat.multiplyToRef(mesh.getWorldMatrix(), mat);\r\n }\r\n else {\r\n mat.copyFrom(amat);\r\n }\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n mat.getRotationMatrixToRef(result);\r\n }\r\n };\r\n /**\r\n * Get the world position of a point that is in the local space of the bone\r\n * @param position The local position\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The world position\r\n */\r\n Bone.prototype.getAbsolutePositionFromLocal = function (position, mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var result = Vector3.Zero();\r\n this.getAbsolutePositionFromLocalToRef(position, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Get the world position of a point that is in the local space of the bone and copy it to the result param\r\n * @param position The local position\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 that the world position should be copied to\r\n */\r\n Bone.prototype.getAbsolutePositionFromLocalToRef = function (position, mesh, result) {\r\n if (mesh === void 0) { mesh = null; }\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n if (mesh && wm) {\r\n tmat.copyFrom(this.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat = this.getAbsoluteTransform();\r\n }\r\n Vector3.TransformCoordinatesToRef(position, tmat, result);\r\n };\r\n /**\r\n * Get the local position of a point that is in world space\r\n * @param position The world position\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The local position\r\n */\r\n Bone.prototype.getLocalPositionFromAbsolute = function (position, mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var result = Vector3.Zero();\r\n this.getLocalPositionFromAbsoluteToRef(position, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Get the local position of a point that is in world space and copy it to the result param\r\n * @param position The world position\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 that the local position should be copied to\r\n */\r\n Bone.prototype.getLocalPositionFromAbsoluteToRef = function (position, mesh, result) {\r\n if (mesh === void 0) { mesh = null; }\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n tmat.copyFrom(this.getAbsoluteTransform());\r\n if (mesh && wm) {\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n tmat.invert();\r\n Vector3.TransformCoordinatesToRef(position, tmat, result);\r\n };\r\n /**\r\n * Set the current local matrix as the restPose for this bone.\r\n */\r\n Bone.prototype.setCurrentPoseAsRest = function () {\r\n this.setRestPose(this.getLocalMatrix());\r\n };\r\n Bone._tmpVecs = ArrayTools.BuildArray(2, Vector3.Zero);\r\n Bone._tmpQuat = Quaternion.Identity();\r\n Bone._tmpMats = ArrayTools.BuildArray(5, Matrix.Identity);\r\n return Bone;\r\n}(Node));\r\nexport { Bone };\r\n//# sourceMappingURL=bone.js.map","import { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';\r\nimport { Logger } from '../../Misc/logger';\r\nimport { Tools } from '../../Misc/tools';\r\nimport { ThinEngine } from '../thinEngine';\r\nThinEngine.prototype.updateRawTexture = function (texture, data, format, invertY, compression, type) {\r\n if (compression === void 0) { compression = null; }\r\n if (type === void 0) { type = 0; }\r\n if (!texture) {\r\n return;\r\n }\r\n // Babylon's internalSizedFomat but gl's texImage2D internalFormat\r\n var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type, format);\r\n // Babylon's internalFormat but gl's texImage2D format\r\n var internalFormat = this._getInternalFormat(format);\r\n var textureType = this._getWebGLTextureType(type);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n if (compression && data) {\r\n this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, this.getCaps().s3tc[compression], texture.width, texture.height, 0, data);\r\n }\r\n else {\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, data);\r\n }\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\nThinEngine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression, type) {\r\n if (compression === void 0) { compression = null; }\r\n if (type === void 0) { type = 0; }\r\n var texture = new InternalTexture(this, InternalTextureSource.Raw);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.format = format;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n texture.type = type;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n this.updateRawTexture(texture, data, format, invertY, compression, type);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n // Filters\r\n var filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\nThinEngine.prototype.createRawCubeTexture = function (data, size, format, type, generateMipMaps, invertY, samplingMode, compression) {\r\n if (compression === void 0) { compression = null; }\r\n var gl = this._gl;\r\n var texture = new InternalTexture(this, InternalTextureSource.CubeRaw);\r\n texture.isCube = true;\r\n texture.format = format;\r\n texture.type = type;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferViewArray = data;\r\n }\r\n var textureType = this._getWebGLTextureType(type);\r\n var internalFormat = this._getInternalFormat(format);\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n }\r\n // Mipmap generation needs a sized internal format that is both color-renderable and texture-filterable\r\n if (textureType === gl.FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = 1;\r\n Logger.Warn(\"Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n }\r\n else if (textureType === this._gl.HALF_FLOAT_OES && !this._caps.textureHalfFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = 1;\r\n Logger.Warn(\"Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n }\r\n else if (textureType === gl.FLOAT && !this._caps.textureFloatRender) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to float textures is not supported. Mipmap generation forced to false.\");\r\n }\r\n else if (textureType === gl.HALF_FLOAT && !this._caps.colorBufferFloat) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to half float textures is not supported. Mipmap generation forced to false.\");\r\n }\r\n var width = size;\r\n var height = width;\r\n texture.width = width;\r\n texture.height = height;\r\n // Double check on POT to generate Mips.\r\n var isPot = !this.needPOTTextures || (Tools.IsExponentOfTwo(texture.width) && Tools.IsExponentOfTwo(texture.height));\r\n if (!isPot) {\r\n generateMipMaps = false;\r\n }\r\n // Upload data if needed. The texture won't be ready until then.\r\n if (data) {\r\n this.updateRawCubeTexture(texture, data, format, type, invertY, compression);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);\r\n // Filters\r\n if (data && generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n var filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n texture.generateMipMaps = generateMipMaps;\r\n return texture;\r\n};\r\nThinEngine.prototype.updateRawCubeTexture = function (texture, data, format, type, invertY, compression, level) {\r\n if (compression === void 0) { compression = null; }\r\n if (level === void 0) { level = 0; }\r\n texture._bufferViewArray = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(type);\r\n var internalFormat = this._getInternalFormat(format);\r\n var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\r\n var needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n if (texture.width % 4 !== 0) {\r\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n // Data are known to be in +X +Y +Z -X -Y -Z\r\n for (var faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n var faceData = data[faceIndex];\r\n if (compression) {\r\n gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, (this.getCaps().s3tc)[compression], texture.width, texture.height, 0, faceData);\r\n }\r\n else {\r\n if (needConversion) {\r\n faceData = _convertRGBtoRGBATextureData(faceData, texture.width, texture.height, type);\r\n }\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, faceData);\r\n }\r\n }\r\n var isPot = !this.needPOTTextures || (Tools.IsExponentOfTwo(texture.width) && Tools.IsExponentOfTwo(texture.height));\r\n if (isPot && texture.generateMipMaps && level === 0) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\nThinEngine.prototype.createRawCubeTextureFromUrl = function (url, scene, size, format, type, noMipmap, callback, mipmapGenerator, onLoad, onError, samplingMode, invertY) {\r\n var _this = this;\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (invertY === void 0) { invertY = false; }\r\n var gl = this._gl;\r\n var texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode, null);\r\n scene === null || scene === void 0 ? void 0 : scene._addPendingData(texture);\r\n texture.url = url;\r\n this._internalTexturesCache.push(texture);\r\n var onerror = function (request, exception) {\r\n scene === null || scene === void 0 ? void 0 : scene._removePendingData(texture);\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n var internalCallback = function (data) {\r\n var width = texture.width;\r\n var faceDataArrays = callback(data);\r\n if (!faceDataArrays) {\r\n return;\r\n }\r\n if (mipmapGenerator) {\r\n var textureType = _this._getWebGLTextureType(type);\r\n var internalFormat = _this._getInternalFormat(format);\r\n var internalSizedFomat = _this._getRGBABufferInternalSizedFormat(type);\r\n var needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n _this._unpackFlipY(false);\r\n var mipData = mipmapGenerator(faceDataArrays);\r\n for (var level = 0; level < mipData.length; level++) {\r\n var mipSize = width >> level;\r\n for (var faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n var mipFaceData = mipData[level][faceIndex];\r\n if (needConversion) {\r\n mipFaceData = _convertRGBtoRGBATextureData(mipFaceData, mipSize, mipSize, type);\r\n }\r\n gl.texImage2D(faceIndex, level, internalSizedFomat, mipSize, mipSize, 0, internalFormat, textureType, mipFaceData);\r\n }\r\n }\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n else {\r\n _this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);\r\n }\r\n texture.isReady = true;\r\n // this.resetTextureCache();\r\n scene === null || scene === void 0 ? void 0 : scene._removePendingData(texture);\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n this._loadFile(url, function (data) {\r\n internalCallback(data);\r\n }, undefined, scene === null || scene === void 0 ? void 0 : scene.offlineProvider, true, onerror);\r\n return texture;\r\n};\r\n/** @hidden */\r\nfunction _convertRGBtoRGBATextureData(rgbData, width, height, textureType) {\r\n // Create new RGBA data container.\r\n var rgbaData;\r\n if (textureType === 1) {\r\n rgbaData = new Float32Array(width * height * 4);\r\n }\r\n else {\r\n rgbaData = new Uint32Array(width * height * 4);\r\n }\r\n // Convert each pixel.\r\n for (var x = 0; x < width; x++) {\r\n for (var y = 0; y < height; y++) {\r\n var index = (y * width + x) * 3;\r\n var newIndex = (y * width + x) * 4;\r\n // Map Old Value to new value.\r\n rgbaData[newIndex + 0] = rgbData[index + 0];\r\n rgbaData[newIndex + 1] = rgbData[index + 1];\r\n rgbaData[newIndex + 2] = rgbData[index + 2];\r\n // Add fully opaque alpha channel.\r\n rgbaData[newIndex + 3] = 1;\r\n }\r\n }\r\n return rgbaData;\r\n}\r\n/**\r\n * Create a function for createRawTexture3D/createRawTexture2DArray\r\n * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY\r\n * @hidden\r\n */\r\nfunction _makeCreateRawTextureFunction(is3D) {\r\n return function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = 0; }\r\n var target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;\r\n var source = is3D ? InternalTextureSource.Raw3D : InternalTextureSource.Raw2DArray;\r\n var texture = new InternalTexture(this, source);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.baseDepth = depth;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.depth = depth;\r\n texture.format = format;\r\n texture.type = textureType;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n if (is3D) {\r\n texture.is3D = true;\r\n }\r\n else {\r\n texture.is2DArray = true;\r\n }\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n if (is3D) {\r\n this.updateRawTexture3D(texture, data, format, invertY, compression, textureType);\r\n }\r\n else {\r\n this.updateRawTexture2DArray(texture, data, format, invertY, compression, textureType);\r\n }\r\n this._bindTextureDirectly(target, texture, true);\r\n // Filters\r\n var filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n this._gl.texParameteri(target, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(target, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(target);\r\n }\r\n this._bindTextureDirectly(target, null);\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n };\r\n}\r\nThinEngine.prototype.createRawTexture2DArray = _makeCreateRawTextureFunction(false);\r\nThinEngine.prototype.createRawTexture3D = _makeCreateRawTextureFunction(true);\r\n/**\r\n * Create a function for updateRawTexture3D/updateRawTexture2DArray\r\n * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY\r\n * @hidden\r\n */\r\nfunction _makeUpdateRawTextureFunction(is3D) {\r\n return function (texture, data, format, invertY, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = 0; }\r\n var target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;\r\n var internalType = this._getWebGLTextureType(textureType);\r\n var internalFormat = this._getInternalFormat(format);\r\n var internalSizedFomat = this._getRGBABufferInternalSizedFormat(textureType, format);\r\n this._bindTextureDirectly(target, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n if (compression && data) {\r\n this._gl.compressedTexImage3D(target, 0, this.getCaps().s3tc[compression], texture.width, texture.height, texture.depth, 0, data);\r\n }\r\n else {\r\n this._gl.texImage3D(target, 0, internalSizedFomat, texture.width, texture.height, texture.depth, 0, internalFormat, internalType, data);\r\n }\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(target);\r\n }\r\n this._bindTextureDirectly(target, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n };\r\n}\r\nThinEngine.prototype.updateRawTexture2DArray = _makeUpdateRawTextureFunction(false);\r\nThinEngine.prototype.updateRawTexture3D = _makeUpdateRawTextureFunction(true);\r\n//# sourceMappingURL=engine.rawTexture.js.map","import { __extends } from \"tslib\";\r\nimport { Texture } from \"./texture\";\r\nimport \"../../Engines/Extensions/engine.rawTexture\";\r\n/**\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n */\r\nvar RawTexture = /** @class */ (function (_super) {\r\n __extends(RawTexture, _super);\r\n /**\r\n * Instantiates a new RawTexture.\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n * @param data define the array of data to use to create the texture\r\n * @param width define the width of the texture\r\n * @param height define the height of the texture\r\n * @param format define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps define whether mip maps should be generated or not\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n */\r\n function RawTexture(data, width, height, \r\n /**\r\n * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n */\r\n format, sceneOrEngine, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (type === void 0) { type = 0; }\r\n var _this = _super.call(this, null, sceneOrEngine, !generateMipMaps, invertY) || this;\r\n _this.format = format;\r\n if (!_this._engine) {\r\n return _this;\r\n }\r\n _this._texture = _this._engine.createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type);\r\n _this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n _this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n return _this;\r\n }\r\n /**\r\n * Updates the texture underlying data.\r\n * @param data Define the new data of the texture\r\n */\r\n RawTexture.prototype.update = function (data) {\r\n this._getEngine().updateRawTexture(this._texture, data, this._texture.format, this._texture.invertY, null, this._texture.type);\r\n };\r\n /**\r\n * Creates a luminance texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance texture\r\n */\r\n RawTexture.CreateLuminanceTexture = function (data, width, height, sceneOrEngine, generateMipMaps, invertY, samplingMode) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n return new RawTexture(data, width, height, 1, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n };\r\n /**\r\n * Creates a luminance alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance alpha texture\r\n */\r\n RawTexture.CreateLuminanceAlphaTexture = function (data, width, height, sceneOrEngine, generateMipMaps, invertY, samplingMode) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n return new RawTexture(data, width, height, 2, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n };\r\n /**\r\n * Creates an alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the alpha texture\r\n */\r\n RawTexture.CreateAlphaTexture = function (data, width, height, sceneOrEngine, generateMipMaps, invertY, samplingMode) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n return new RawTexture(data, width, height, 0, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n };\r\n /**\r\n * Creates a RGB texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the RGB alpha texture\r\n */\r\n RawTexture.CreateRGBTexture = function (data, width, height, sceneOrEngine, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (type === void 0) { type = 0; }\r\n return new RawTexture(data, width, height, 4, sceneOrEngine, generateMipMaps, invertY, samplingMode, type);\r\n };\r\n /**\r\n * Creates a RGBA texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the RGBA texture\r\n */\r\n RawTexture.CreateRGBATexture = function (data, width, height, sceneOrEngine, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (type === void 0) { type = 0; }\r\n return new RawTexture(data, width, height, 5, sceneOrEngine, generateMipMaps, invertY, samplingMode, type);\r\n };\r\n /**\r\n * Creates a R texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the R texture\r\n */\r\n RawTexture.CreateRTexture = function (data, width, height, sceneOrEngine, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (type === void 0) { type = 1; }\r\n return new RawTexture(data, width, height, 6, sceneOrEngine, generateMipMaps, invertY, samplingMode, type);\r\n };\r\n return RawTexture;\r\n}(Texture));\r\nexport { RawTexture };\r\n//# sourceMappingURL=rawTexture.js.map","import { Bone } from \"./bone\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Vector3, Matrix, TmpVectors } from \"../Maths/math.vector\";\r\nimport { RawTexture } from \"../Materials/Textures/rawTexture\";\r\nimport { Animation } from \"../Animations/animation\";\r\nimport { AnimationRange } from \"../Animations/animationRange\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { DeepCopier } from \"../Misc/deepCopier\";\r\n/**\r\n * Class used to handle skinning animations\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\nvar Skeleton = /** @class */ (function () {\r\n /**\r\n * Creates a new skeleton\r\n * @param name defines the skeleton name\r\n * @param id defines the skeleton Id\r\n * @param scene defines the hosting scene\r\n */\r\n function Skeleton(\r\n /** defines the skeleton name */\r\n name, \r\n /** defines the skeleton Id */\r\n id, scene) {\r\n this.name = name;\r\n this.id = id;\r\n /**\r\n * Defines the list of child bones\r\n */\r\n this.bones = new Array();\r\n /**\r\n * Defines a boolean indicating if the root matrix is provided by meshes or by the current skeleton (this is the default value)\r\n */\r\n this.needInitialSkinMatrix = false;\r\n /**\r\n * Defines a mesh that override the matrix used to get the world matrix (null by default).\r\n */\r\n this.overrideMesh = null;\r\n this._isDirty = true;\r\n this._meshesWithPoseMatrix = new Array();\r\n this._identity = Matrix.Identity();\r\n this._ranges = {};\r\n this._lastAbsoluteTransformsUpdateId = -1;\r\n this._canUseTextureForBones = false;\r\n this._uniqueId = 0;\r\n /** @hidden */\r\n this._numBonesWithLinkedTransformNode = 0;\r\n /** @hidden */\r\n this._hasWaitingData = null;\r\n /** @hidden */\r\n this._waitingOverrideMeshId = null;\r\n /**\r\n * Specifies if the skeleton should be serialized\r\n */\r\n this.doNotSerialize = false;\r\n this._useTextureToStoreBoneMatrices = true;\r\n this._animationPropertiesOverride = null;\r\n // Events\r\n /**\r\n * An observable triggered before computing the skeleton's matrices\r\n */\r\n this.onBeforeComputeObservable = new Observable();\r\n this.bones = [];\r\n this._scene = scene || EngineStore.LastCreatedScene;\r\n this._uniqueId = this._scene.getUniqueId();\r\n this._scene.addSkeleton(this);\r\n //make sure it will recalculate the matrix next time prepare is called.\r\n this._isDirty = true;\r\n var engineCaps = this._scene.getEngine().getCaps();\r\n this._canUseTextureForBones = engineCaps.textureFloat && engineCaps.maxVertexTextureImageUnits > 0;\r\n }\r\n Object.defineProperty(Skeleton.prototype, \"useTextureToStoreBoneMatrices\", {\r\n /**\r\n * Gets or sets a boolean indicating that bone matrices should be stored as a texture instead of using shader uniforms (default is true).\r\n * Please note that this option is not available if the hardware does not support it\r\n */\r\n get: function () {\r\n return this._useTextureToStoreBoneMatrices;\r\n },\r\n set: function (value) {\r\n this._useTextureToStoreBoneMatrices = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Skeleton.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n get: function () {\r\n if (!this._animationPropertiesOverride) {\r\n return this._scene.animationPropertiesOverride;\r\n }\r\n return this._animationPropertiesOverride;\r\n },\r\n set: function (value) {\r\n this._animationPropertiesOverride = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Skeleton.prototype, \"isUsingTextureForMatrices\", {\r\n /**\r\n * Gets a boolean indicating that the skeleton effectively stores matrices into a texture\r\n */\r\n get: function () {\r\n return this.useTextureToStoreBoneMatrices && this._canUseTextureForBones;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Skeleton.prototype, \"uniqueId\", {\r\n /**\r\n * Gets the unique ID of this skeleton\r\n */\r\n get: function () {\r\n return this._uniqueId;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n Skeleton.prototype.getClassName = function () {\r\n return \"Skeleton\";\r\n };\r\n /**\r\n * Returns an array containing the root bones\r\n * @returns an array containing the root bones\r\n */\r\n Skeleton.prototype.getChildren = function () {\r\n return this.bones.filter(function (b) { return !b.getParent(); });\r\n };\r\n // Members\r\n /**\r\n * Gets the list of transform matrices to send to shaders (one matrix per bone)\r\n * @param mesh defines the mesh to use to get the root matrix (if needInitialSkinMatrix === true)\r\n * @returns a Float32Array containing matrices data\r\n */\r\n Skeleton.prototype.getTransformMatrices = function (mesh) {\r\n if (this.needInitialSkinMatrix && mesh._bonesTransformMatrices) {\r\n return mesh._bonesTransformMatrices;\r\n }\r\n if (!this._transformMatrices) {\r\n this.prepare();\r\n }\r\n return this._transformMatrices;\r\n };\r\n /**\r\n * Gets the list of transform matrices to send to shaders inside a texture (one matrix per bone)\r\n * @param mesh defines the mesh to use to get the root matrix (if needInitialSkinMatrix === true)\r\n * @returns a raw texture containing the data\r\n */\r\n Skeleton.prototype.getTransformMatrixTexture = function (mesh) {\r\n if (this.needInitialSkinMatrix && mesh._transformMatrixTexture) {\r\n return mesh._transformMatrixTexture;\r\n }\r\n return this._transformMatrixTexture;\r\n };\r\n /**\r\n * Gets the current hosting scene\r\n * @returns a scene object\r\n */\r\n Skeleton.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n // Methods\r\n /**\r\n * Gets a string representing the current skeleton data\r\n * @param fullDetails defines a boolean indicating if we want a verbose version\r\n * @returns a string representing the current skeleton data\r\n */\r\n Skeleton.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name + \", nBones: \" + this.bones.length;\r\n ret += \", nAnimationRanges: \" + (this._ranges ? Object.keys(this._ranges).length : \"none\");\r\n if (fullDetails) {\r\n ret += \", Ranges: {\";\r\n var first = true;\r\n for (var name_1 in this._ranges) {\r\n if (first) {\r\n ret += \", \";\r\n first = false;\r\n }\r\n ret += name_1;\r\n }\r\n ret += \"}\";\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Get bone's index searching by name\r\n * @param name defines bone's name to search for\r\n * @return the indice of the bone. Returns -1 if not found\r\n */\r\n Skeleton.prototype.getBoneIndexByName = function (name) {\r\n for (var boneIndex = 0, cache = this.bones.length; boneIndex < cache; boneIndex++) {\r\n if (this.bones[boneIndex].name === name) {\r\n return boneIndex;\r\n }\r\n }\r\n return -1;\r\n };\r\n /**\r\n * Creater a new animation range\r\n * @param name defines the name of the range\r\n * @param from defines the start key\r\n * @param to defines the end key\r\n */\r\n Skeleton.prototype.createAnimationRange = function (name, from, to) {\r\n // check name not already in use\r\n if (!this._ranges[name]) {\r\n this._ranges[name] = new AnimationRange(name, from, to);\r\n for (var i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n if (this.bones[i].animations[0]) {\r\n this.bones[i].animations[0].createRange(name, from, to);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Delete a specific animation range\r\n * @param name defines the name of the range\r\n * @param deleteFrames defines if frames must be removed as well\r\n */\r\n Skeleton.prototype.deleteAnimationRange = function (name, deleteFrames) {\r\n if (deleteFrames === void 0) { deleteFrames = true; }\r\n for (var i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n if (this.bones[i].animations[0]) {\r\n this.bones[i].animations[0].deleteRange(name, deleteFrames);\r\n }\r\n }\r\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\r\n };\r\n /**\r\n * Gets a specific animation range\r\n * @param name defines the name of the range to look for\r\n * @returns the requested animation range or null if not found\r\n */\r\n Skeleton.prototype.getAnimationRange = function (name) {\r\n return this._ranges[name] || null;\r\n };\r\n /**\r\n * Gets the list of all animation ranges defined on this skeleton\r\n * @returns an array\r\n */\r\n Skeleton.prototype.getAnimationRanges = function () {\r\n var animationRanges = [];\r\n var name;\r\n for (name in this._ranges) {\r\n animationRanges.push(this._ranges[name]);\r\n }\r\n return animationRanges;\r\n };\r\n /**\r\n * Copy animation range from a source skeleton.\r\n * This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences\r\n * @param source defines the source skeleton\r\n * @param name defines the name of the range to copy\r\n * @param rescaleAsRequired defines if rescaling must be applied if required\r\n * @returns true if operation was successful\r\n */\r\n Skeleton.prototype.copyAnimationRange = function (source, name, rescaleAsRequired) {\r\n if (rescaleAsRequired === void 0) { rescaleAsRequired = false; }\r\n if (this._ranges[name] || !source.getAnimationRange(name)) {\r\n return false;\r\n }\r\n var ret = true;\r\n var frameOffset = this._getHighestAnimationFrame() + 1;\r\n // make a dictionary of source skeleton's bones, so exact same order or doublely nested loop is not required\r\n var boneDict = {};\r\n var sourceBones = source.bones;\r\n var nBones;\r\n var i;\r\n for (i = 0, nBones = sourceBones.length; i < nBones; i++) {\r\n boneDict[sourceBones[i].name] = sourceBones[i];\r\n }\r\n if (this.bones.length !== sourceBones.length) {\r\n Logger.Warn(\"copyAnimationRange: this rig has \" + this.bones.length + \" bones, while source as \" + sourceBones.length);\r\n ret = false;\r\n }\r\n var skelDimensionsRatio = (rescaleAsRequired && this.dimensionsAtRest && source.dimensionsAtRest) ? this.dimensionsAtRest.divide(source.dimensionsAtRest) : null;\r\n for (i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n var boneName = this.bones[i].name;\r\n var sourceBone = boneDict[boneName];\r\n if (sourceBone) {\r\n ret = ret && this.bones[i].copyAnimationRange(sourceBone, name, frameOffset, rescaleAsRequired, skelDimensionsRatio);\r\n }\r\n else {\r\n Logger.Warn(\"copyAnimationRange: not same rig, missing source bone \" + boneName);\r\n ret = false;\r\n }\r\n }\r\n // do not call createAnimationRange(), since it also is done to bones, which was already done\r\n var range = source.getAnimationRange(name);\r\n if (range) {\r\n this._ranges[name] = new AnimationRange(name, range.from + frameOffset, range.to + frameOffset);\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Forces the skeleton to go to rest pose\r\n */\r\n Skeleton.prototype.returnToRest = function () {\r\n var _localScaling = TmpVectors.Vector3[0];\r\n var _localRotation = TmpVectors.Quaternion[0];\r\n var _localPosition = TmpVectors.Vector3[1];\r\n for (var index = 0; index < this.bones.length; index++) {\r\n var bone = this.bones[index];\r\n if (bone._index !== -1) {\r\n bone.returnToRest();\r\n if (bone._linkedTransformNode) {\r\n bone.getRestPose().decompose(_localScaling, _localRotation, _localPosition);\r\n bone._linkedTransformNode.position = _localPosition.clone();\r\n bone._linkedTransformNode.rotationQuaternion = _localRotation.clone();\r\n bone._linkedTransformNode.scaling = _localScaling.clone();\r\n }\r\n }\r\n }\r\n };\r\n Skeleton.prototype._getHighestAnimationFrame = function () {\r\n var ret = 0;\r\n for (var i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n if (this.bones[i].animations[0]) {\r\n var highest = this.bones[i].animations[0].getHighestFrame();\r\n if (ret < highest) {\r\n ret = highest;\r\n }\r\n }\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Begin a specific animation range\r\n * @param name defines the name of the range to start\r\n * @param loop defines if looping must be turned on (false by default)\r\n * @param speedRatio defines the speed ratio to apply (1 by default)\r\n * @param onAnimationEnd defines a callback which will be called when animation will end\r\n * @returns a new animatable\r\n */\r\n Skeleton.prototype.beginAnimation = function (name, loop, speedRatio, onAnimationEnd) {\r\n var range = this.getAnimationRange(name);\r\n if (!range) {\r\n return null;\r\n }\r\n return this._scene.beginAnimation(this, range.from, range.to, loop, speedRatio, onAnimationEnd);\r\n };\r\n /**\r\n * Convert the keyframes for a range of animation on a skeleton to be relative to a given reference frame.\r\n * @param skeleton defines the Skeleton containing the animation range to convert\r\n * @param referenceFrame defines the frame that keyframes in the range will be relative to\r\n * @param range defines the name of the AnimationRange belonging to the Skeleton to convert\r\n * @returns the original skeleton\r\n */\r\n Skeleton.MakeAnimationAdditive = function (skeleton, referenceFrame, range) {\r\n if (referenceFrame === void 0) { referenceFrame = 0; }\r\n var rangeValue = skeleton.getAnimationRange(range);\r\n // We can't make a range additive if it doesn't exist\r\n if (!rangeValue) {\r\n return null;\r\n }\r\n // Find any current scene-level animatable belonging to the target that matches the range\r\n var sceneAnimatables = skeleton._scene.getAllAnimatablesByTarget(skeleton);\r\n var rangeAnimatable = null;\r\n for (var index = 0; index < sceneAnimatables.length; index++) {\r\n var sceneAnimatable = sceneAnimatables[index];\r\n if (sceneAnimatable.fromFrame === (rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.from) && sceneAnimatable.toFrame === (rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.to)) {\r\n rangeAnimatable = sceneAnimatable;\r\n break;\r\n }\r\n }\r\n // Convert the animations belonging to the skeleton to additive keyframes\r\n var animatables = skeleton.getAnimatables();\r\n for (var index = 0; index < animatables.length; index++) {\r\n var animatable = animatables[index];\r\n var animations = animatable.animations;\r\n if (!animations) {\r\n continue;\r\n }\r\n for (var animIndex = 0; animIndex < animations.length; animIndex++) {\r\n Animation.MakeAnimationAdditive(animations[animIndex], referenceFrame, range);\r\n }\r\n }\r\n // Mark the scene-level animatable as additive\r\n if (rangeAnimatable) {\r\n rangeAnimatable.isAdditive = true;\r\n }\r\n return skeleton;\r\n };\r\n /** @hidden */\r\n Skeleton.prototype._markAsDirty = function () {\r\n this._isDirty = true;\r\n };\r\n /** @hidden */\r\n Skeleton.prototype._registerMeshWithPoseMatrix = function (mesh) {\r\n this._meshesWithPoseMatrix.push(mesh);\r\n };\r\n /** @hidden */\r\n Skeleton.prototype._unregisterMeshWithPoseMatrix = function (mesh) {\r\n var index = this._meshesWithPoseMatrix.indexOf(mesh);\r\n if (index > -1) {\r\n this._meshesWithPoseMatrix.splice(index, 1);\r\n }\r\n };\r\n Skeleton.prototype._computeTransformMatrices = function (targetMatrix, initialSkinMatrix) {\r\n this.onBeforeComputeObservable.notifyObservers(this);\r\n for (var index = 0; index < this.bones.length; index++) {\r\n var bone = this.bones[index];\r\n bone._childUpdateId++;\r\n var parentBone = bone.getParent();\r\n if (parentBone) {\r\n bone.getLocalMatrix().multiplyToRef(parentBone.getWorldMatrix(), bone.getWorldMatrix());\r\n }\r\n else {\r\n if (initialSkinMatrix) {\r\n bone.getLocalMatrix().multiplyToRef(initialSkinMatrix, bone.getWorldMatrix());\r\n }\r\n else {\r\n bone.getWorldMatrix().copyFrom(bone.getLocalMatrix());\r\n }\r\n }\r\n if (bone._index !== -1) {\r\n var mappedIndex = bone._index === null ? index : bone._index;\r\n bone.getInvertedAbsoluteTransform().multiplyToArray(bone.getWorldMatrix(), targetMatrix, mappedIndex * 16);\r\n }\r\n }\r\n this._identity.copyToArray(targetMatrix, this.bones.length * 16);\r\n };\r\n /**\r\n * Build all resources required to render a skeleton\r\n */\r\n Skeleton.prototype.prepare = function () {\r\n // Update the local matrix of bones with linked transform nodes.\r\n if (this._numBonesWithLinkedTransformNode > 0) {\r\n for (var _i = 0, _a = this.bones; _i < _a.length; _i++) {\r\n var bone_1 = _a[_i];\r\n if (bone_1._linkedTransformNode) {\r\n // Computing the world matrix also computes the local matrix.\r\n bone_1._linkedTransformNode.computeWorldMatrix();\r\n bone_1._matrix = bone_1._linkedTransformNode._localMatrix;\r\n bone_1.markAsDirty();\r\n }\r\n }\r\n }\r\n if (!this._isDirty) {\r\n return;\r\n }\r\n if (this.needInitialSkinMatrix) {\r\n for (var index = 0; index < this._meshesWithPoseMatrix.length; index++) {\r\n var mesh = this._meshesWithPoseMatrix[index];\r\n var poseMatrix = mesh.getPoseMatrix();\r\n if (!mesh._bonesTransformMatrices || mesh._bonesTransformMatrices.length !== 16 * (this.bones.length + 1)) {\r\n mesh._bonesTransformMatrices = new Float32Array(16 * (this.bones.length + 1));\r\n }\r\n if (this._synchronizedWithMesh !== mesh) {\r\n this._synchronizedWithMesh = mesh;\r\n // Prepare bones\r\n for (var boneIndex = 0; boneIndex < this.bones.length; boneIndex++) {\r\n var bone = this.bones[boneIndex];\r\n if (!bone.getParent()) {\r\n var matrix = bone.getBaseMatrix();\r\n matrix.multiplyToRef(poseMatrix, TmpVectors.Matrix[1]);\r\n bone._updateDifferenceMatrix(TmpVectors.Matrix[1]);\r\n }\r\n }\r\n if (this.isUsingTextureForMatrices) {\r\n var textureWidth = (this.bones.length + 1) * 4;\r\n if (!mesh._transformMatrixTexture || mesh._transformMatrixTexture.getSize().width !== textureWidth) {\r\n if (mesh._transformMatrixTexture) {\r\n mesh._transformMatrixTexture.dispose();\r\n }\r\n mesh._transformMatrixTexture = RawTexture.CreateRGBATexture(mesh._bonesTransformMatrices, (this.bones.length + 1) * 4, 1, this._scene, false, false, 1, 1);\r\n }\r\n }\r\n }\r\n this._computeTransformMatrices(mesh._bonesTransformMatrices, poseMatrix);\r\n if (this.isUsingTextureForMatrices && mesh._transformMatrixTexture) {\r\n mesh._transformMatrixTexture.update(mesh._bonesTransformMatrices);\r\n }\r\n }\r\n }\r\n else {\r\n if (!this._transformMatrices || this._transformMatrices.length !== 16 * (this.bones.length + 1)) {\r\n this._transformMatrices = new Float32Array(16 * (this.bones.length + 1));\r\n if (this.isUsingTextureForMatrices) {\r\n if (this._transformMatrixTexture) {\r\n this._transformMatrixTexture.dispose();\r\n }\r\n this._transformMatrixTexture = RawTexture.CreateRGBATexture(this._transformMatrices, (this.bones.length + 1) * 4, 1, this._scene, false, false, 1, 1);\r\n }\r\n }\r\n this._computeTransformMatrices(this._transformMatrices, null);\r\n if (this.isUsingTextureForMatrices && this._transformMatrixTexture) {\r\n this._transformMatrixTexture.update(this._transformMatrices);\r\n }\r\n }\r\n this._isDirty = false;\r\n this._scene._activeBones.addCount(this.bones.length, false);\r\n };\r\n /**\r\n * Gets the list of animatables currently running for this skeleton\r\n * @returns an array of animatables\r\n */\r\n Skeleton.prototype.getAnimatables = function () {\r\n if (!this._animatables || this._animatables.length !== this.bones.length) {\r\n this._animatables = [];\r\n for (var index = 0; index < this.bones.length; index++) {\r\n this._animatables.push(this.bones[index]);\r\n }\r\n }\r\n return this._animatables;\r\n };\r\n /**\r\n * Clone the current skeleton\r\n * @param name defines the name of the new skeleton\r\n * @param id defines the id of the new skeleton\r\n * @returns the new skeleton\r\n */\r\n Skeleton.prototype.clone = function (name, id) {\r\n var result = new Skeleton(name, id || name, this._scene);\r\n result.needInitialSkinMatrix = this.needInitialSkinMatrix;\r\n result.overrideMesh = this.overrideMesh;\r\n for (var index = 0; index < this.bones.length; index++) {\r\n var source = this.bones[index];\r\n var parentBone = null;\r\n var parent_1 = source.getParent();\r\n if (parent_1) {\r\n var parentIndex = this.bones.indexOf(parent_1);\r\n parentBone = result.bones[parentIndex];\r\n }\r\n var bone = new Bone(source.name, result, parentBone, source.getBaseMatrix().clone(), source.getRestPose().clone());\r\n bone._index = source._index;\r\n if (source._linkedTransformNode) {\r\n bone.linkTransformNode(source._linkedTransformNode);\r\n }\r\n DeepCopier.DeepCopy(source.animations, bone.animations);\r\n }\r\n if (this._ranges) {\r\n result._ranges = {};\r\n for (var rangeName in this._ranges) {\r\n var range = this._ranges[rangeName];\r\n if (range) {\r\n result._ranges[rangeName] = range.clone();\r\n }\r\n }\r\n }\r\n this._isDirty = true;\r\n return result;\r\n };\r\n /**\r\n * Enable animation blending for this skeleton\r\n * @param blendingSpeed defines the blending speed to apply\r\n * @see https://doc.babylonjs.com/babylon101/animations#animation-blending\r\n */\r\n Skeleton.prototype.enableBlending = function (blendingSpeed) {\r\n if (blendingSpeed === void 0) { blendingSpeed = 0.01; }\r\n this.bones.forEach(function (bone) {\r\n bone.animations.forEach(function (animation) {\r\n animation.enableBlending = true;\r\n animation.blendingSpeed = blendingSpeed;\r\n });\r\n });\r\n };\r\n /**\r\n * Releases all resources associated with the current skeleton\r\n */\r\n Skeleton.prototype.dispose = function () {\r\n this._meshesWithPoseMatrix = [];\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from scene\r\n this.getScene().removeSkeleton(this);\r\n if (this._transformMatrixTexture) {\r\n this._transformMatrixTexture.dispose();\r\n this._transformMatrixTexture = null;\r\n }\r\n };\r\n /**\r\n * Serialize the skeleton in a JSON object\r\n * @returns a JSON object\r\n */\r\n Skeleton.prototype.serialize = function () {\r\n var _a, _b;\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.id = this.id;\r\n if (this.dimensionsAtRest) {\r\n serializationObject.dimensionsAtRest = this.dimensionsAtRest.asArray();\r\n }\r\n serializationObject.bones = [];\r\n serializationObject.needInitialSkinMatrix = this.needInitialSkinMatrix;\r\n serializationObject.overrideMeshId = (_a = this.overrideMesh) === null || _a === void 0 ? void 0 : _a.id;\r\n for (var index = 0; index < this.bones.length; index++) {\r\n var bone = this.bones[index];\r\n var parent_2 = bone.getParent();\r\n var serializedBone = {\r\n parentBoneIndex: parent_2 ? this.bones.indexOf(parent_2) : -1,\r\n index: bone.getIndex(),\r\n name: bone.name,\r\n matrix: bone.getBaseMatrix().toArray(),\r\n rest: bone.getRestPose().toArray(),\r\n linkedTransformNodeId: (_b = bone.getTransformNode()) === null || _b === void 0 ? void 0 : _b.id\r\n };\r\n serializationObject.bones.push(serializedBone);\r\n if (bone.length) {\r\n serializedBone.length = bone.length;\r\n }\r\n if (bone.metadata) {\r\n serializedBone.metadata = bone.metadata;\r\n }\r\n if (bone.animations && bone.animations.length > 0) {\r\n serializedBone.animation = bone.animations[0].serialize();\r\n }\r\n serializationObject.ranges = [];\r\n for (var name in this._ranges) {\r\n var source = this._ranges[name];\r\n if (!source) {\r\n continue;\r\n }\r\n var range = {};\r\n range.name = name;\r\n range.from = source.from;\r\n range.to = source.to;\r\n serializationObject.ranges.push(range);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a new skeleton from serialized data\r\n * @param parsedSkeleton defines the serialized data\r\n * @param scene defines the hosting scene\r\n * @returns a new skeleton\r\n */\r\n Skeleton.Parse = function (parsedSkeleton, scene) {\r\n var skeleton = new Skeleton(parsedSkeleton.name, parsedSkeleton.id, scene);\r\n if (parsedSkeleton.dimensionsAtRest) {\r\n skeleton.dimensionsAtRest = Vector3.FromArray(parsedSkeleton.dimensionsAtRest);\r\n }\r\n skeleton.needInitialSkinMatrix = parsedSkeleton.needInitialSkinMatrix;\r\n if (parsedSkeleton.overrideMeshId) {\r\n skeleton._hasWaitingData = true;\r\n skeleton._waitingOverrideMeshId = parsedSkeleton.overrideMeshId;\r\n }\r\n var index;\r\n for (index = 0; index < parsedSkeleton.bones.length; index++) {\r\n var parsedBone = parsedSkeleton.bones[index];\r\n var parsedBoneIndex = parsedSkeleton.bones[index].index;\r\n var parentBone = null;\r\n if (parsedBone.parentBoneIndex > -1) {\r\n parentBone = skeleton.bones[parsedBone.parentBoneIndex];\r\n }\r\n var rest = parsedBone.rest ? Matrix.FromArray(parsedBone.rest) : null;\r\n var bone = new Bone(parsedBone.name, skeleton, parentBone, Matrix.FromArray(parsedBone.matrix), rest, null, parsedBoneIndex);\r\n if (parsedBone.id !== undefined && parsedBone.id !== null) {\r\n bone.id = parsedBone.id;\r\n }\r\n if (parsedBone.length) {\r\n bone.length = parsedBone.length;\r\n }\r\n if (parsedBone.metadata) {\r\n bone.metadata = parsedBone.metadata;\r\n }\r\n if (parsedBone.animation) {\r\n bone.animations.push(Animation.Parse(parsedBone.animation));\r\n }\r\n if (parsedBone.linkedTransformNodeId !== undefined && parsedBone.linkedTransformNodeId !== null) {\r\n skeleton._hasWaitingData = true;\r\n bone._waitingTransformNodeId = parsedBone.linkedTransformNodeId;\r\n }\r\n }\r\n // placed after bones, so createAnimationRange can cascade down\r\n if (parsedSkeleton.ranges) {\r\n for (index = 0; index < parsedSkeleton.ranges.length; index++) {\r\n var data = parsedSkeleton.ranges[index];\r\n skeleton.createAnimationRange(data.name, data.from, data.to);\r\n }\r\n }\r\n return skeleton;\r\n };\r\n /**\r\n * Compute all node absolute transforms\r\n * @param forceUpdate defines if computation must be done even if cache is up to date\r\n */\r\n Skeleton.prototype.computeAbsoluteTransforms = function (forceUpdate) {\r\n if (forceUpdate === void 0) { forceUpdate = false; }\r\n var renderId = this._scene.getRenderId();\r\n if (this._lastAbsoluteTransformsUpdateId != renderId || forceUpdate) {\r\n this.bones[0].computeAbsoluteTransforms();\r\n this._lastAbsoluteTransformsUpdateId = renderId;\r\n }\r\n };\r\n /**\r\n * Gets the root pose matrix\r\n * @returns a matrix\r\n */\r\n Skeleton.prototype.getPoseMatrix = function () {\r\n var poseMatrix = null;\r\n if (this._meshesWithPoseMatrix.length > 0) {\r\n poseMatrix = this._meshesWithPoseMatrix[0].getPoseMatrix();\r\n }\r\n return poseMatrix;\r\n };\r\n /**\r\n * Sorts bones per internal index\r\n */\r\n Skeleton.prototype.sortBones = function () {\r\n var bones = new Array();\r\n var visited = new Array(this.bones.length);\r\n for (var index = 0; index < this.bones.length; index++) {\r\n this._sortBones(index, bones, visited);\r\n }\r\n this.bones = bones;\r\n };\r\n Skeleton.prototype._sortBones = function (index, bones, visited) {\r\n if (visited[index]) {\r\n return;\r\n }\r\n visited[index] = true;\r\n var bone = this.bones[index];\r\n if (bone._index === undefined) {\r\n bone._index = index;\r\n }\r\n var parentBone = bone.getParent();\r\n if (parentBone) {\r\n this._sortBones(this.bones.indexOf(parentBone), bones, visited);\r\n }\r\n bones.push(bone);\r\n };\r\n /**\r\n * Set the current local matrix as the restPose for all bones in the skeleton.\r\n */\r\n Skeleton.prototype.setCurrentPoseAsRest = function () {\r\n this.bones.forEach(function (b) {\r\n b.setCurrentPoseAsRest();\r\n });\r\n };\r\n return Skeleton;\r\n}());\r\nexport { Skeleton };\r\n//# sourceMappingURL=skeleton.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, serializeAsVector3 } from \"../Misc/decorators\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Light } from \"./light\";\r\nimport { Axis } from '../Maths/math.axis';\r\n/**\r\n * Base implementation IShadowLight\r\n * It groups all the common behaviour in order to reduce dupplication and better follow the DRY pattern.\r\n */\r\nvar ShadowLight = /** @class */ (function (_super) {\r\n __extends(ShadowLight, _super);\r\n function ShadowLight() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._needProjectionMatrixCompute = true;\r\n return _this;\r\n }\r\n ShadowLight.prototype._setPosition = function (value) {\r\n this._position = value;\r\n };\r\n Object.defineProperty(ShadowLight.prototype, \"position\", {\r\n /**\r\n * Sets the position the shadow will be casted from. Also use as the light position for both\r\n * point and spot lights.\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n /**\r\n * Sets the position the shadow will be casted from. Also use as the light position for both\r\n * point and spot lights.\r\n */\r\n set: function (value) {\r\n this._setPosition(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ShadowLight.prototype._setDirection = function (value) {\r\n this._direction = value;\r\n };\r\n Object.defineProperty(ShadowLight.prototype, \"direction\", {\r\n /**\r\n * In 2d mode (needCube being false), gets the direction used to cast the shadow.\r\n * Also use as the light direction on spot and directional lights.\r\n */\r\n get: function () {\r\n return this._direction;\r\n },\r\n /**\r\n * In 2d mode (needCube being false), sets the direction used to cast the shadow.\r\n * Also use as the light direction on spot and directional lights.\r\n */\r\n set: function (value) {\r\n this._setDirection(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowLight.prototype, \"shadowMinZ\", {\r\n /**\r\n * Gets the shadow projection clipping minimum z value.\r\n */\r\n get: function () {\r\n return this._shadowMinZ;\r\n },\r\n /**\r\n * Sets the shadow projection clipping minimum z value.\r\n */\r\n set: function (value) {\r\n this._shadowMinZ = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowLight.prototype, \"shadowMaxZ\", {\r\n /**\r\n * Sets the shadow projection clipping maximum z value.\r\n */\r\n get: function () {\r\n return this._shadowMaxZ;\r\n },\r\n /**\r\n * Gets the shadow projection clipping maximum z value.\r\n */\r\n set: function (value) {\r\n this._shadowMaxZ = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Computes the transformed information (transformedPosition and transformedDirection in World space) of the current light\r\n * @returns true if the information has been computed, false if it does not need to (no parenting)\r\n */\r\n ShadowLight.prototype.computeTransformedInformation = function () {\r\n if (this.parent && this.parent.getWorldMatrix) {\r\n if (!this.transformedPosition) {\r\n this.transformedPosition = Vector3.Zero();\r\n }\r\n Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition);\r\n // In case the direction is present.\r\n if (this.direction) {\r\n if (!this.transformedDirection) {\r\n this.transformedDirection = Vector3.Zero();\r\n }\r\n Vector3.TransformNormalToRef(this.direction, this.parent.getWorldMatrix(), this.transformedDirection);\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Return the depth scale used for the shadow map.\r\n * @returns the depth scale.\r\n */\r\n ShadowLight.prototype.getDepthScale = function () {\r\n return 50.0;\r\n };\r\n /**\r\n * Get the direction to use to render the shadow map. In case of cube texture, the face index can be passed.\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n ShadowLight.prototype.getShadowDirection = function (faceIndex) {\r\n return this.transformedDirection ? this.transformedDirection : this.direction;\r\n };\r\n /**\r\n * Returns the ShadowLight absolute position in the World.\r\n * @returns the position vector in world space\r\n */\r\n ShadowLight.prototype.getAbsolutePosition = function () {\r\n return this.transformedPosition ? this.transformedPosition : this.position;\r\n };\r\n /**\r\n * Sets the ShadowLight direction toward the passed target.\r\n * @param target The point to target in local space\r\n * @returns the updated ShadowLight direction\r\n */\r\n ShadowLight.prototype.setDirectionToTarget = function (target) {\r\n this.direction = Vector3.Normalize(target.subtract(this.position));\r\n return this.direction;\r\n };\r\n /**\r\n * Returns the light rotation in euler definition.\r\n * @returns the x y z rotation in local space.\r\n */\r\n ShadowLight.prototype.getRotation = function () {\r\n this.direction.normalize();\r\n var xaxis = Vector3.Cross(this.direction, Axis.Y);\r\n var yaxis = Vector3.Cross(xaxis, this.direction);\r\n return Vector3.RotationFromAxis(xaxis, yaxis, this.direction);\r\n };\r\n /**\r\n * Returns whether or not the shadow generation require a cube texture or a 2d texture.\r\n * @returns true if a cube texture needs to be use\r\n */\r\n ShadowLight.prototype.needCube = function () {\r\n return false;\r\n };\r\n /**\r\n * Detects if the projection matrix requires to be recomputed this frame.\r\n * @returns true if it requires to be recomputed otherwise, false.\r\n */\r\n ShadowLight.prototype.needProjectionMatrixCompute = function () {\r\n return this._needProjectionMatrixCompute;\r\n };\r\n /**\r\n * Forces the shadow generator to recompute the projection matrix even if position and direction did not changed.\r\n */\r\n ShadowLight.prototype.forceProjectionMatrixCompute = function () {\r\n this._needProjectionMatrixCompute = true;\r\n };\r\n /** @hidden */\r\n ShadowLight.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache.position = Vector3.Zero();\r\n };\r\n /** @hidden */\r\n ShadowLight.prototype._isSynchronized = function () {\r\n if (!this._cache.position.equals(this.position)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @returns the world matrix\r\n */\r\n ShadowLight.prototype.computeWorldMatrix = function (force) {\r\n if (!force && this.isSynchronized()) {\r\n this._currentRenderId = this.getScene().getRenderId();\r\n return this._worldMatrix;\r\n }\r\n this._updateCache();\r\n this._cache.position.copyFrom(this.position);\r\n if (!this._worldMatrix) {\r\n this._worldMatrix = Matrix.Identity();\r\n }\r\n Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);\r\n if (this.parent && this.parent.getWorldMatrix) {\r\n this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);\r\n this._markSyncedWithParent();\r\n }\r\n // Cache the determinant\r\n this._worldMatrixDeterminantIsDirty = true;\r\n return this._worldMatrix;\r\n };\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n ShadowLight.prototype.getDepthMinZ = function (activeCamera) {\r\n return this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\r\n };\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n ShadowLight.prototype.getDepthMaxZ = function (activeCamera) {\r\n return this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\r\n };\r\n /**\r\n * Sets the shadow projection matrix in parameter to the generated projection matrix.\r\n * @param matrix The materix to updated with the projection information\r\n * @param viewMatrix The transform matrix of the light\r\n * @param renderList The list of mesh to render in the map\r\n * @returns The current light\r\n */\r\n ShadowLight.prototype.setShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n if (this.customProjectionMatrixBuilder) {\r\n this.customProjectionMatrixBuilder(viewMatrix, renderList, matrix);\r\n }\r\n else {\r\n this._setDefaultShadowProjectionMatrix(matrix, viewMatrix, renderList);\r\n }\r\n return this;\r\n };\r\n __decorate([\r\n serializeAsVector3()\r\n ], ShadowLight.prototype, \"position\", null);\r\n __decorate([\r\n serializeAsVector3()\r\n ], ShadowLight.prototype, \"direction\", null);\r\n __decorate([\r\n serialize()\r\n ], ShadowLight.prototype, \"shadowMinZ\", null);\r\n __decorate([\r\n serialize()\r\n ], ShadowLight.prototype, \"shadowMaxZ\", null);\r\n return ShadowLight;\r\n}(Light));\r\nexport { ShadowLight };\r\n//# sourceMappingURL=shadowLight.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nNode.AddNodeConstructor(\"Light_Type_1\", function (name, scene) {\r\n return function () { return new DirectionalLight(name, Vector3.Zero(), scene); };\r\n});\r\n/**\r\n * A directional light is defined by a direction (what a surprise!).\r\n * The light is emitted from everywhere in the specified direction, and has an infinite range.\r\n * An example of a directional light is when a distance planet is lit by the apparently parallel lines of light from its sun. Light in a downward direction will light the top of an object.\r\n * Documentation: https://doc.babylonjs.com/babylon101/lights\r\n */\r\nvar DirectionalLight = /** @class */ (function (_super) {\r\n __extends(DirectionalLight, _super);\r\n /**\r\n * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).\r\n * The directional light is emitted from everywhere in the given direction.\r\n * It can cast shadows.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The friendly name of the light\r\n * @param direction The direction of the light\r\n * @param scene The scene the light belongs to\r\n */\r\n function DirectionalLight(name, direction, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._shadowFrustumSize = 0;\r\n _this._shadowOrthoScale = 0.1;\r\n /**\r\n * Automatically compute the projection matrix to best fit (including all the casters)\r\n * on each frame.\r\n */\r\n _this.autoUpdateExtends = true;\r\n /**\r\n * Automatically compute the shadowMinZ and shadowMaxZ for the projection matrix to best fit (including all the casters)\r\n * on each frame. autoUpdateExtends must be set to true for this to work\r\n */\r\n _this.autoCalcShadowZBounds = false;\r\n // Cache\r\n _this._orthoLeft = Number.MAX_VALUE;\r\n _this._orthoRight = Number.MIN_VALUE;\r\n _this._orthoTop = Number.MIN_VALUE;\r\n _this._orthoBottom = Number.MAX_VALUE;\r\n _this.position = direction.scale(-1.0);\r\n _this.direction = direction;\r\n return _this;\r\n }\r\n Object.defineProperty(DirectionalLight.prototype, \"shadowFrustumSize\", {\r\n /**\r\n * Fix frustum size for the shadow generation. This is disabled if the value is 0.\r\n */\r\n get: function () {\r\n return this._shadowFrustumSize;\r\n },\r\n /**\r\n * Specifies a fix frustum size for the shadow generation.\r\n */\r\n set: function (value) {\r\n this._shadowFrustumSize = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DirectionalLight.prototype, \"shadowOrthoScale\", {\r\n /**\r\n * Gets the shadow projection scale against the optimal computed one.\r\n * 0.1 by default which means that the projection window is increase by 10% from the optimal size.\r\n * This does not impact in fixed frustum size (shadowFrustumSize being set)\r\n */\r\n get: function () {\r\n return this._shadowOrthoScale;\r\n },\r\n /**\r\n * Sets the shadow projection scale against the optimal computed one.\r\n * 0.1 by default which means that the projection window is increase by 10% from the optimal size.\r\n * This does not impact in fixed frustum size (shadowFrustumSize being set)\r\n */\r\n set: function (value) {\r\n this._shadowOrthoScale = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"DirectionalLight\".\r\n * @return The class name\r\n */\r\n DirectionalLight.prototype.getClassName = function () {\r\n return \"DirectionalLight\";\r\n };\r\n /**\r\n * Returns the integer 1.\r\n * @return The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n DirectionalLight.prototype.getTypeID = function () {\r\n return Light.LIGHTTYPEID_DIRECTIONALLIGHT;\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n */\r\n DirectionalLight.prototype._setDefaultShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n if (this.shadowFrustumSize > 0) {\r\n this._setDefaultFixedFrustumShadowProjectionMatrix(matrix);\r\n }\r\n else {\r\n this._setDefaultAutoExtendShadowProjectionMatrix(matrix, viewMatrix, renderList);\r\n }\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as fixed frustum projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n */\r\n DirectionalLight.prototype._setDefaultFixedFrustumShadowProjectionMatrix = function (matrix) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n Matrix.OrthoLHToRef(this.shadowFrustumSize, this.shadowFrustumSize, this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ, matrix);\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n */\r\n DirectionalLight.prototype._setDefaultAutoExtendShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n // Check extends\r\n if (this.autoUpdateExtends || this._orthoLeft === Number.MAX_VALUE) {\r\n var tempVector3 = Vector3.Zero();\r\n this._orthoLeft = Number.MAX_VALUE;\r\n this._orthoRight = Number.MIN_VALUE;\r\n this._orthoTop = Number.MIN_VALUE;\r\n this._orthoBottom = Number.MAX_VALUE;\r\n var shadowMinZ = Number.MAX_VALUE;\r\n var shadowMaxZ = Number.MIN_VALUE;\r\n for (var meshIndex = 0; meshIndex < renderList.length; meshIndex++) {\r\n var mesh = renderList[meshIndex];\r\n if (!mesh) {\r\n continue;\r\n }\r\n var boundingInfo = mesh.getBoundingInfo();\r\n var boundingBox = boundingInfo.boundingBox;\r\n for (var index = 0; index < boundingBox.vectorsWorld.length; index++) {\r\n Vector3.TransformCoordinatesToRef(boundingBox.vectorsWorld[index], viewMatrix, tempVector3);\r\n if (tempVector3.x < this._orthoLeft) {\r\n this._orthoLeft = tempVector3.x;\r\n }\r\n if (tempVector3.y < this._orthoBottom) {\r\n this._orthoBottom = tempVector3.y;\r\n }\r\n if (tempVector3.x > this._orthoRight) {\r\n this._orthoRight = tempVector3.x;\r\n }\r\n if (tempVector3.y > this._orthoTop) {\r\n this._orthoTop = tempVector3.y;\r\n }\r\n if (this.autoCalcShadowZBounds) {\r\n if (tempVector3.z < shadowMinZ) {\r\n shadowMinZ = tempVector3.z;\r\n }\r\n if (tempVector3.z > shadowMaxZ) {\r\n shadowMaxZ = tempVector3.z;\r\n }\r\n }\r\n }\r\n }\r\n if (this.autoCalcShadowZBounds) {\r\n this._shadowMinZ = shadowMinZ;\r\n this._shadowMaxZ = shadowMaxZ;\r\n }\r\n }\r\n var xOffset = this._orthoRight - this._orthoLeft;\r\n var yOffset = this._orthoTop - this._orthoBottom;\r\n Matrix.OrthoOffCenterLHToRef(this._orthoLeft - xOffset * this.shadowOrthoScale, this._orthoRight + xOffset * this.shadowOrthoScale, this._orthoBottom - yOffset * this.shadowOrthoScale, this._orthoTop + yOffset * this.shadowOrthoScale, this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ, matrix);\r\n };\r\n DirectionalLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n /**\r\n * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The directional light\r\n */\r\n DirectionalLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z, 1, lightIndex);\r\n return this;\r\n }\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.direction.x, this.direction.y, this.direction.z, 1, lightIndex);\r\n return this;\r\n };\r\n DirectionalLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n if (this.computeTransformedInformation()) {\r\n effect.setFloat3(lightDataUniformName, this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z);\r\n return this;\r\n }\r\n effect.setFloat3(lightDataUniformName, this.direction.x, this.direction.y, this.direction.z);\r\n return this;\r\n };\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n *\r\n * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being\r\n * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n DirectionalLight.prototype.getDepthMinZ = function (activeCamera) {\r\n return 1;\r\n };\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n *\r\n * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being\r\n * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n DirectionalLight.prototype.getDepthMaxZ = function (activeCamera) {\r\n return 1;\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n DirectionalLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"DIRLIGHT\" + lightIndex] = true;\r\n };\r\n __decorate([\r\n serialize()\r\n ], DirectionalLight.prototype, \"shadowFrustumSize\", null);\r\n __decorate([\r\n serialize()\r\n ], DirectionalLight.prototype, \"shadowOrthoScale\", null);\r\n __decorate([\r\n serialize()\r\n ], DirectionalLight.prototype, \"autoUpdateExtends\", void 0);\r\n __decorate([\r\n serialize()\r\n ], DirectionalLight.prototype, \"autoCalcShadowZBounds\", void 0);\r\n return DirectionalLight;\r\n}(ShadowLight));\r\nexport { DirectionalLight };\r\n//# sourceMappingURL=directionalLight.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nNode.AddNodeConstructor(\"Light_Type_0\", function (name, scene) {\r\n return function () { return new PointLight(name, Vector3.Zero(), scene); };\r\n});\r\n/**\r\n * A point light is a light defined by an unique point in world space.\r\n * The light is emitted in every direction from this point.\r\n * A good example of a point light is a standard light bulb.\r\n * Documentation: https://doc.babylonjs.com/babylon101/lights\r\n */\r\nvar PointLight = /** @class */ (function (_super) {\r\n __extends(PointLight, _super);\r\n /**\r\n * Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.\r\n * A PointLight emits the light in every direction.\r\n * It can cast shadows.\r\n * If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :\r\n * ```javascript\r\n * var pointLight = new PointLight(\"pl\", camera.position, scene);\r\n * ```\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The light friendly name\r\n * @param position The position of the point light in the scene\r\n * @param scene The scene the lights belongs to\r\n */\r\n function PointLight(name, position, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._shadowAngle = Math.PI / 2;\r\n _this.position = position;\r\n return _this;\r\n }\r\n Object.defineProperty(PointLight.prototype, \"shadowAngle\", {\r\n /**\r\n * Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n get: function () {\r\n return this._shadowAngle;\r\n },\r\n /**\r\n * Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n set: function (value) {\r\n this._shadowAngle = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PointLight.prototype, \"direction\", {\r\n /**\r\n * Gets the direction if it has been set.\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n get: function () {\r\n return this._direction;\r\n },\r\n /**\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n set: function (value) {\r\n var previousNeedCube = this.needCube();\r\n this._direction = value;\r\n if (this.needCube() !== previousNeedCube && this._shadowGenerator) {\r\n this._shadowGenerator.recreateShadowMap();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"PointLight\"\r\n * @returns the class name\r\n */\r\n PointLight.prototype.getClassName = function () {\r\n return \"PointLight\";\r\n };\r\n /**\r\n * Returns the integer 0.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n PointLight.prototype.getTypeID = function () {\r\n return Light.LIGHTTYPEID_POINTLIGHT;\r\n };\r\n /**\r\n * Specifies wether or not the shadowmap should be a cube texture.\r\n * @returns true if the shadowmap needs to be a cube texture.\r\n */\r\n PointLight.prototype.needCube = function () {\r\n return !this.direction;\r\n };\r\n /**\r\n * Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n PointLight.prototype.getShadowDirection = function (faceIndex) {\r\n if (this.direction) {\r\n return _super.prototype.getShadowDirection.call(this, faceIndex);\r\n }\r\n else {\r\n switch (faceIndex) {\r\n case 0:\r\n return new Vector3(1.0, 0.0, 0.0);\r\n case 1:\r\n return new Vector3(-1.0, 0.0, 0.0);\r\n case 2:\r\n return new Vector3(0.0, -1.0, 0.0);\r\n case 3:\r\n return new Vector3(0.0, 1.0, 0.0);\r\n case 4:\r\n return new Vector3(0.0, 0.0, 1.0);\r\n case 5:\r\n return new Vector3(0.0, 0.0, -1.0);\r\n }\r\n }\r\n return Vector3.Zero();\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as a left-handed perspective projection matrix with the following settings :\r\n * - fov = PI / 2\r\n * - aspect ratio : 1.0\r\n * - z-near and far equal to the active camera minZ and maxZ.\r\n * Returns the PointLight.\r\n */\r\n PointLight.prototype._setDefaultShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n Matrix.PerspectiveFovLHToRef(this.shadowAngle, 1.0, this.getDepthMinZ(activeCamera), this.getDepthMaxZ(activeCamera), matrix);\r\n };\r\n PointLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n /**\r\n * Sets the passed Effect \"effect\" with the PointLight transformed position (or position, if none) and passed name (string).\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The point light\r\n */\r\n PointLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0.0, lightIndex);\r\n }\r\n else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, 0, lightIndex);\r\n }\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, 0, 0, lightIndex);\r\n return this;\r\n };\r\n PointLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n if (this.computeTransformedInformation()) {\r\n effect.setFloat3(lightDataUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z);\r\n }\r\n else {\r\n effect.setFloat3(lightDataUniformName, this.position.x, this.position.y, this.position.z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n PointLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"POINTLIGHT\" + lightIndex] = true;\r\n };\r\n __decorate([\r\n serialize()\r\n ], PointLight.prototype, \"shadowAngle\", null);\r\n return PointLight;\r\n}(ShadowLight));\r\nexport { PointLight };\r\n//# sourceMappingURL=pointLight.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, serializeAsTexture } from \"../Misc/decorators\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nimport { Texture } from '../Materials/Textures/texture';\r\nNode.AddNodeConstructor(\"Light_Type_2\", function (name, scene) {\r\n return function () { return new SpotLight(name, Vector3.Zero(), Vector3.Zero(), 0, 0, scene); };\r\n});\r\n/**\r\n * A spot light is defined by a position, a direction, an angle, and an exponent.\r\n * These values define a cone of light starting from the position, emitting toward the direction.\r\n * The angle, in radians, defines the size (field of illumination) of the spotlight's conical beam,\r\n * and the exponent defines the speed of the decay of the light with distance (reach).\r\n * Documentation: https://doc.babylonjs.com/babylon101/lights\r\n */\r\nvar SpotLight = /** @class */ (function (_super) {\r\n __extends(SpotLight, _super);\r\n /**\r\n * Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.\r\n * It can cast shadows.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The light friendly name\r\n * @param position The position of the spot light in the scene\r\n * @param direction The direction of the light in the scene\r\n * @param angle The cone angle of the light in Radians\r\n * @param exponent The light decay speed with the distance from the emission spot\r\n * @param scene The scene the lights belongs to\r\n */\r\n function SpotLight(name, position, direction, angle, exponent, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._innerAngle = 0;\r\n _this._projectionTextureMatrix = Matrix.Zero();\r\n _this._projectionTextureLightNear = 1e-6;\r\n _this._projectionTextureLightFar = 1000.0;\r\n _this._projectionTextureUpDirection = Vector3.Up();\r\n _this._projectionTextureViewLightDirty = true;\r\n _this._projectionTextureProjectionLightDirty = true;\r\n _this._projectionTextureDirty = true;\r\n _this._projectionTextureViewTargetVector = Vector3.Zero();\r\n _this._projectionTextureViewLightMatrix = Matrix.Zero();\r\n _this._projectionTextureProjectionLightMatrix = Matrix.Zero();\r\n _this._projectionTextureScalingMatrix = Matrix.FromValues(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);\r\n _this.position = position;\r\n _this.direction = direction;\r\n _this.angle = angle;\r\n _this.exponent = exponent;\r\n return _this;\r\n }\r\n Object.defineProperty(SpotLight.prototype, \"angle\", {\r\n /**\r\n * Gets the cone angle of the spot light in Radians.\r\n */\r\n get: function () {\r\n return this._angle;\r\n },\r\n /**\r\n * Sets the cone angle of the spot light in Radians.\r\n */\r\n set: function (value) {\r\n this._angle = value;\r\n this._cosHalfAngle = Math.cos(value * 0.5);\r\n this._projectionTextureProjectionLightDirty = true;\r\n this.forceProjectionMatrixCompute();\r\n this._computeAngleValues();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"innerAngle\", {\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n get: function () {\r\n return this._innerAngle;\r\n },\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n set: function (value) {\r\n this._innerAngle = value;\r\n this._computeAngleValues();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"shadowAngleScale\", {\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n get: function () {\r\n return this._shadowAngleScale;\r\n },\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n set: function (value) {\r\n this._shadowAngleScale = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureMatrix\", {\r\n /**\r\n * Allows reading the projecton texture\r\n */\r\n get: function () {\r\n return this._projectionTextureMatrix;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureLightNear\", {\r\n /**\r\n * Gets the near clip of the Spotlight for texture projection.\r\n */\r\n get: function () {\r\n return this._projectionTextureLightNear;\r\n },\r\n /**\r\n * Sets the near clip of the Spotlight for texture projection.\r\n */\r\n set: function (value) {\r\n this._projectionTextureLightNear = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureLightFar\", {\r\n /**\r\n * Gets the far clip of the Spotlight for texture projection.\r\n */\r\n get: function () {\r\n return this._projectionTextureLightFar;\r\n },\r\n /**\r\n * Sets the far clip of the Spotlight for texture projection.\r\n */\r\n set: function (value) {\r\n this._projectionTextureLightFar = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureUpDirection\", {\r\n /**\r\n * Gets the Up vector of the Spotlight for texture projection.\r\n */\r\n get: function () {\r\n return this._projectionTextureUpDirection;\r\n },\r\n /**\r\n * Sets the Up vector of the Spotlight for texture projection.\r\n */\r\n set: function (value) {\r\n this._projectionTextureUpDirection = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTexture\", {\r\n /**\r\n * Gets the projection texture of the light.\r\n */\r\n get: function () {\r\n return this._projectionTexture;\r\n },\r\n /**\r\n * Sets the projection texture of the light.\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (this._projectionTexture === value) {\r\n return;\r\n }\r\n this._projectionTexture = value;\r\n this._projectionTextureDirty = true;\r\n if (this._projectionTexture && !this._projectionTexture.isReady()) {\r\n if (SpotLight._IsProceduralTexture(this._projectionTexture)) {\r\n this._projectionTexture.getEffect().executeWhenCompiled(function () {\r\n _this._markMeshesAsLightDirty();\r\n });\r\n }\r\n else if (SpotLight._IsTexture(this._projectionTexture)) {\r\n this._projectionTexture.onLoadObservable.addOnce(function () {\r\n _this._markMeshesAsLightDirty();\r\n });\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SpotLight._IsProceduralTexture = function (texture) {\r\n return texture.onGeneratedObservable !== undefined;\r\n };\r\n SpotLight._IsTexture = function (texture) {\r\n return texture.onLoadObservable !== undefined;\r\n };\r\n /**\r\n * Returns the string \"SpotLight\".\r\n * @returns the class name\r\n */\r\n SpotLight.prototype.getClassName = function () {\r\n return \"SpotLight\";\r\n };\r\n /**\r\n * Returns the integer 2.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n SpotLight.prototype.getTypeID = function () {\r\n return Light.LIGHTTYPEID_SPOTLIGHT;\r\n };\r\n /**\r\n * Overrides the direction setter to recompute the projection texture view light Matrix.\r\n */\r\n SpotLight.prototype._setDirection = function (value) {\r\n _super.prototype._setDirection.call(this, value);\r\n this._projectionTextureViewLightDirty = true;\r\n };\r\n /**\r\n * Overrides the position setter to recompute the projection texture view light Matrix.\r\n */\r\n SpotLight.prototype._setPosition = function (value) {\r\n _super.prototype._setPosition.call(this, value);\r\n this._projectionTextureViewLightDirty = true;\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.\r\n * Returns the SpotLight.\r\n */\r\n SpotLight.prototype._setDefaultShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n this._shadowAngleScale = this._shadowAngleScale || 1;\r\n var angle = this._shadowAngleScale * this._angle;\r\n Matrix.PerspectiveFovLHToRef(angle, 1.0, this.getDepthMinZ(activeCamera), this.getDepthMaxZ(activeCamera), matrix);\r\n };\r\n SpotLight.prototype._computeProjectionTextureViewLightMatrix = function () {\r\n this._projectionTextureViewLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n this.position.addToRef(this.direction, this._projectionTextureViewTargetVector);\r\n Matrix.LookAtLHToRef(this.position, this._projectionTextureViewTargetVector, this._projectionTextureUpDirection, this._projectionTextureViewLightMatrix);\r\n };\r\n SpotLight.prototype._computeProjectionTextureProjectionLightMatrix = function () {\r\n this._projectionTextureProjectionLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n var light_far = this.projectionTextureLightFar;\r\n var light_near = this.projectionTextureLightNear;\r\n var P = light_far / (light_far - light_near);\r\n var Q = -P * light_near;\r\n var S = 1.0 / Math.tan(this._angle / 2.0);\r\n var A = 1.0;\r\n Matrix.FromValuesToRef(S / A, 0.0, 0.0, 0.0, 0.0, S, 0.0, 0.0, 0.0, 0.0, P, 1.0, 0.0, 0.0, Q, 0.0, this._projectionTextureProjectionLightMatrix);\r\n };\r\n /**\r\n * Main function for light texture projection matrix computing.\r\n */\r\n SpotLight.prototype._computeProjectionTextureMatrix = function () {\r\n this._projectionTextureDirty = false;\r\n this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix, this._projectionTextureMatrix);\r\n if (this._projectionTexture instanceof Texture) {\r\n var u = this._projectionTexture.uScale / 2.0;\r\n var v = this._projectionTexture.vScale / 2.0;\r\n Matrix.FromValuesToRef(u, 0.0, 0.0, 0.0, 0.0, v, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0, this._projectionTextureScalingMatrix);\r\n }\r\n this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix, this._projectionTextureMatrix);\r\n };\r\n SpotLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDirection\", 3);\r\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n SpotLight.prototype._computeAngleValues = function () {\r\n this._lightAngleScale = 1.0 / Math.max(0.001, (Math.cos(this._innerAngle * 0.5) - this._cosHalfAngle));\r\n this._lightAngleOffset = -this._cosHalfAngle * this._lightAngleScale;\r\n };\r\n /**\r\n * Sets the passed Effect \"effect\" with the Light textures.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The light\r\n */\r\n SpotLight.prototype.transferTexturesToEffect = function (effect, lightIndex) {\r\n if (this.projectionTexture && this.projectionTexture.isReady()) {\r\n if (this._projectionTextureViewLightDirty) {\r\n this._computeProjectionTextureViewLightMatrix();\r\n }\r\n if (this._projectionTextureProjectionLightDirty) {\r\n this._computeProjectionTextureProjectionLightMatrix();\r\n }\r\n if (this._projectionTextureDirty) {\r\n this._computeProjectionTextureMatrix();\r\n }\r\n effect.setMatrix(\"textureProjectionMatrix\" + lightIndex, this._projectionTextureMatrix);\r\n effect.setTexture(\"projectionLightSampler\" + lightIndex, this.projectionTexture);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets the passed Effect object with the SpotLight transfomed position (or position if not parented) and normalized direction.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The spot light\r\n */\r\n SpotLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n var normalizeDirection;\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, this.exponent, lightIndex);\r\n normalizeDirection = Vector3.Normalize(this.transformedDirection);\r\n }\r\n else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, this.exponent, lightIndex);\r\n normalizeDirection = Vector3.Normalize(this.direction);\r\n }\r\n this._uniformBuffer.updateFloat4(\"vLightDirection\", normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, this._cosHalfAngle, lightIndex);\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, this._lightAngleScale, this._lightAngleOffset, lightIndex);\r\n return this;\r\n };\r\n SpotLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n var normalizeDirection;\r\n if (this.computeTransformedInformation()) {\r\n normalizeDirection = Vector3.Normalize(this.transformedDirection);\r\n }\r\n else {\r\n normalizeDirection = Vector3.Normalize(this.direction);\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n effect.setFloat3(lightDataUniformName, -normalizeDirection.x, -normalizeDirection.y, -normalizeDirection.z);\r\n }\r\n else {\r\n effect.setFloat3(lightDataUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Disposes the light and the associated resources.\r\n */\r\n SpotLight.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n if (this._projectionTexture) {\r\n this._projectionTexture.dispose();\r\n }\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n SpotLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"SPOTLIGHT\" + lightIndex] = true;\r\n defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex] = this.projectionTexture && this.projectionTexture.isReady() ? true : false;\r\n };\r\n __decorate([\r\n serialize()\r\n ], SpotLight.prototype, \"angle\", null);\r\n __decorate([\r\n serialize()\r\n ], SpotLight.prototype, \"innerAngle\", null);\r\n __decorate([\r\n serialize()\r\n ], SpotLight.prototype, \"shadowAngleScale\", null);\r\n __decorate([\r\n serialize()\r\n ], SpotLight.prototype, \"exponent\", void 0);\r\n __decorate([\r\n serialize()\r\n ], SpotLight.prototype, \"projectionTextureLightNear\", null);\r\n __decorate([\r\n serialize()\r\n ], SpotLight.prototype, \"projectionTextureLightFar\", null);\r\n __decorate([\r\n serialize()\r\n ], SpotLight.prototype, \"projectionTextureUpDirection\", null);\r\n __decorate([\r\n serializeAsTexture(\"projectedLightTexture\")\r\n ], SpotLight.prototype, \"_projectionTexture\", void 0);\r\n return SpotLight;\r\n}(ShadowLight));\r\nexport { SpotLight };\r\n//# sourceMappingURL=spotLight.js.map","import { EParameterType, ETextureFilterType, ECullingType, EBlendingFunction, EShaderType } from \"./glTFLoaderInterfaces\";\r\nimport { Quaternion, Vector3, Matrix } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Camera } from \"@babylonjs/core/Cameras/camera\";\r\nimport { FreeCamera } from \"@babylonjs/core/Cameras/freeCamera\";\r\nimport { Animation } from \"@babylonjs/core/Animations/animation\";\r\nimport { Bone } from \"@babylonjs/core/Bones/bone\";\r\nimport { Skeleton } from \"@babylonjs/core/Bones/skeleton\";\r\nimport { Effect } from \"@babylonjs/core/Materials/effect\";\r\nimport { Material } from \"@babylonjs/core/Materials/material\";\r\nimport { MultiMaterial } from \"@babylonjs/core/Materials/multiMaterial\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { ShaderMaterial } from \"@babylonjs/core/Materials/shaderMaterial\";\r\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\r\nimport { VertexData } from \"@babylonjs/core/Meshes/mesh.vertexData\";\r\nimport { VertexBuffer } from \"@babylonjs/core/Meshes/buffer\";\r\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry\";\r\nimport { SubMesh } from \"@babylonjs/core/Meshes/subMesh\";\r\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { HemisphericLight } from \"@babylonjs/core/Lights/hemisphericLight\";\r\nimport { DirectionalLight } from \"@babylonjs/core/Lights/directionalLight\";\r\nimport { PointLight } from \"@babylonjs/core/Lights/pointLight\";\r\nimport { SpotLight } from \"@babylonjs/core/Lights/spotLight\";\r\nimport { GLTFUtils } from \"./glTFLoaderUtils\";\r\nimport { GLTFFileLoader } from \"../glTFFileLoader\";\r\nimport { Constants } from '@babylonjs/core/Engines/constants';\r\n/**\r\n* Tokenizer. Used for shaders compatibility\r\n* Automatically map world, view, projection, worldViewProjection, attributes and so on\r\n*/\r\nvar ETokenType;\r\n(function (ETokenType) {\r\n ETokenType[ETokenType[\"IDENTIFIER\"] = 1] = \"IDENTIFIER\";\r\n ETokenType[ETokenType[\"UNKNOWN\"] = 2] = \"UNKNOWN\";\r\n ETokenType[ETokenType[\"END_OF_INPUT\"] = 3] = \"END_OF_INPUT\";\r\n})(ETokenType || (ETokenType = {}));\r\nvar Tokenizer = /** @class */ (function () {\r\n function Tokenizer(toParse) {\r\n this._pos = 0;\r\n this.currentToken = ETokenType.UNKNOWN;\r\n this.currentIdentifier = \"\";\r\n this.currentString = \"\";\r\n this.isLetterOrDigitPattern = /^[a-zA-Z0-9]+$/;\r\n this._toParse = toParse;\r\n this._maxPos = toParse.length;\r\n }\r\n Tokenizer.prototype.getNextToken = function () {\r\n if (this.isEnd()) {\r\n return ETokenType.END_OF_INPUT;\r\n }\r\n this.currentString = this.read();\r\n this.currentToken = ETokenType.UNKNOWN;\r\n if (this.currentString === \"_\" || this.isLetterOrDigitPattern.test(this.currentString)) {\r\n this.currentToken = ETokenType.IDENTIFIER;\r\n this.currentIdentifier = this.currentString;\r\n while (!this.isEnd() && (this.isLetterOrDigitPattern.test(this.currentString = this.peek()) || this.currentString === \"_\")) {\r\n this.currentIdentifier += this.currentString;\r\n this.forward();\r\n }\r\n }\r\n return this.currentToken;\r\n };\r\n Tokenizer.prototype.peek = function () {\r\n return this._toParse[this._pos];\r\n };\r\n Tokenizer.prototype.read = function () {\r\n return this._toParse[this._pos++];\r\n };\r\n Tokenizer.prototype.forward = function () {\r\n this._pos++;\r\n };\r\n Tokenizer.prototype.isEnd = function () {\r\n return this._pos >= this._maxPos;\r\n };\r\n return Tokenizer;\r\n}());\r\n/**\r\n* Values\r\n*/\r\nvar glTFTransforms = [\"MODEL\", \"VIEW\", \"PROJECTION\", \"MODELVIEW\", \"MODELVIEWPROJECTION\", \"JOINTMATRIX\"];\r\nvar babylonTransforms = [\"world\", \"view\", \"projection\", \"worldView\", \"worldViewProjection\", \"mBones\"];\r\nvar glTFAnimationPaths = [\"translation\", \"rotation\", \"scale\"];\r\nvar babylonAnimationPaths = [\"position\", \"rotationQuaternion\", \"scaling\"];\r\n/**\r\n* Parse\r\n*/\r\nvar parseBuffers = function (parsedBuffers, gltfRuntime) {\r\n for (var buf in parsedBuffers) {\r\n var parsedBuffer = parsedBuffers[buf];\r\n gltfRuntime.buffers[buf] = parsedBuffer;\r\n gltfRuntime.buffersCount++;\r\n }\r\n};\r\nvar parseShaders = function (parsedShaders, gltfRuntime) {\r\n for (var sha in parsedShaders) {\r\n var parsedShader = parsedShaders[sha];\r\n gltfRuntime.shaders[sha] = parsedShader;\r\n gltfRuntime.shaderscount++;\r\n }\r\n};\r\nvar parseObject = function (parsedObjects, runtimeProperty, gltfRuntime) {\r\n for (var object in parsedObjects) {\r\n var parsedObject = parsedObjects[object];\r\n gltfRuntime[runtimeProperty][object] = parsedObject;\r\n }\r\n};\r\n/**\r\n* Utils\r\n*/\r\nvar normalizeUVs = function (buffer) {\r\n if (!buffer) {\r\n return;\r\n }\r\n for (var i = 0; i < buffer.length / 2; i++) {\r\n buffer[i * 2 + 1] = 1.0 - buffer[i * 2 + 1];\r\n }\r\n};\r\nvar getAttribute = function (attributeParameter) {\r\n if (attributeParameter.semantic === \"NORMAL\") {\r\n return \"normal\";\r\n }\r\n else if (attributeParameter.semantic === \"POSITION\") {\r\n return \"position\";\r\n }\r\n else if (attributeParameter.semantic === \"JOINT\") {\r\n return \"matricesIndices\";\r\n }\r\n else if (attributeParameter.semantic === \"WEIGHT\") {\r\n return \"matricesWeights\";\r\n }\r\n else if (attributeParameter.semantic === \"COLOR\") {\r\n return \"color\";\r\n }\r\n else if (attributeParameter.semantic && attributeParameter.semantic.indexOf(\"TEXCOORD_\") !== -1) {\r\n var channel = Number(attributeParameter.semantic.split(\"_\")[1]);\r\n return \"uv\" + (channel === 0 ? \"\" : channel + 1);\r\n }\r\n return null;\r\n};\r\n/**\r\n* Loads and creates animations\r\n*/\r\nvar loadAnimations = function (gltfRuntime) {\r\n for (var anim in gltfRuntime.animations) {\r\n var animation = gltfRuntime.animations[anim];\r\n if (!animation.channels || !animation.samplers) {\r\n continue;\r\n }\r\n var lastAnimation = null;\r\n for (var i = 0; i < animation.channels.length; i++) {\r\n // Get parameters and load buffers\r\n var channel = animation.channels[i];\r\n var sampler = animation.samplers[channel.sampler];\r\n if (!sampler) {\r\n continue;\r\n }\r\n var inputData = null;\r\n var outputData = null;\r\n if (animation.parameters) {\r\n inputData = animation.parameters[sampler.input];\r\n outputData = animation.parameters[sampler.output];\r\n }\r\n else {\r\n inputData = sampler.input;\r\n outputData = sampler.output;\r\n }\r\n var bufferInput = GLTFUtils.GetBufferFromAccessor(gltfRuntime, gltfRuntime.accessors[inputData]);\r\n var bufferOutput = GLTFUtils.GetBufferFromAccessor(gltfRuntime, gltfRuntime.accessors[outputData]);\r\n var targetID = channel.target.id;\r\n var targetNode = gltfRuntime.scene.getNodeByID(targetID);\r\n if (targetNode === null) {\r\n targetNode = gltfRuntime.scene.getNodeByName(targetID);\r\n }\r\n if (targetNode === null) {\r\n Tools.Warn(\"Creating animation named \" + anim + \". But cannot find node named \" + targetID + \" to attach to\");\r\n continue;\r\n }\r\n var isBone = targetNode instanceof Bone;\r\n // Get target path (position, rotation or scaling)\r\n var targetPath = channel.target.path;\r\n var targetPathIndex = glTFAnimationPaths.indexOf(targetPath);\r\n if (targetPathIndex !== -1) {\r\n targetPath = babylonAnimationPaths[targetPathIndex];\r\n }\r\n // Determine animation type\r\n var animationType = Animation.ANIMATIONTYPE_MATRIX;\r\n if (!isBone) {\r\n if (targetPath === \"rotationQuaternion\") {\r\n animationType = Animation.ANIMATIONTYPE_QUATERNION;\r\n targetNode.rotationQuaternion = new Quaternion();\r\n }\r\n else {\r\n animationType = Animation.ANIMATIONTYPE_VECTOR3;\r\n }\r\n }\r\n // Create animation and key frames\r\n var babylonAnimation = null;\r\n var keys = [];\r\n var arrayOffset = 0;\r\n var modifyKey = false;\r\n if (isBone && lastAnimation && lastAnimation.getKeys().length === bufferInput.length) {\r\n babylonAnimation = lastAnimation;\r\n modifyKey = true;\r\n }\r\n if (!modifyKey) {\r\n gltfRuntime.scene._blockEntityCollection = gltfRuntime.forAssetContainer;\r\n babylonAnimation = new Animation(anim, isBone ? \"_matrix\" : targetPath, 1, animationType, Animation.ANIMATIONLOOPMODE_CYCLE);\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n }\r\n // For each frame\r\n for (var j = 0; j < bufferInput.length; j++) {\r\n var value = null;\r\n if (targetPath === \"rotationQuaternion\") { // VEC4\r\n value = Quaternion.FromArray([bufferOutput[arrayOffset], bufferOutput[arrayOffset + 1], bufferOutput[arrayOffset + 2], bufferOutput[arrayOffset + 3]]);\r\n arrayOffset += 4;\r\n }\r\n else { // Position and scaling are VEC3\r\n value = Vector3.FromArray([bufferOutput[arrayOffset], bufferOutput[arrayOffset + 1], bufferOutput[arrayOffset + 2]]);\r\n arrayOffset += 3;\r\n }\r\n if (isBone) {\r\n var bone = targetNode;\r\n var translation = Vector3.Zero();\r\n var rotationQuaternion = new Quaternion();\r\n var scaling = Vector3.Zero();\r\n // Warning on decompose\r\n var mat = bone.getBaseMatrix();\r\n if (modifyKey && lastAnimation) {\r\n mat = lastAnimation.getKeys()[j].value;\r\n }\r\n mat.decompose(scaling, rotationQuaternion, translation);\r\n if (targetPath === \"position\") {\r\n translation = value;\r\n }\r\n else if (targetPath === \"rotationQuaternion\") {\r\n rotationQuaternion = value;\r\n }\r\n else {\r\n scaling = value;\r\n }\r\n value = Matrix.Compose(scaling, rotationQuaternion, translation);\r\n }\r\n if (!modifyKey) {\r\n keys.push({\r\n frame: bufferInput[j],\r\n value: value\r\n });\r\n }\r\n else if (lastAnimation) {\r\n lastAnimation.getKeys()[j].value = value;\r\n }\r\n }\r\n // Finish\r\n if (!modifyKey && babylonAnimation) {\r\n babylonAnimation.setKeys(keys);\r\n targetNode.animations.push(babylonAnimation);\r\n }\r\n lastAnimation = babylonAnimation;\r\n gltfRuntime.scene.stopAnimation(targetNode);\r\n gltfRuntime.scene.beginAnimation(targetNode, 0, bufferInput[bufferInput.length - 1], true, 1.0);\r\n }\r\n }\r\n};\r\n/**\r\n* Returns the bones transformation matrix\r\n*/\r\nvar configureBoneTransformation = function (node) {\r\n var mat = null;\r\n if (node.translation || node.rotation || node.scale) {\r\n var scale = Vector3.FromArray(node.scale || [1, 1, 1]);\r\n var rotation = Quaternion.FromArray(node.rotation || [0, 0, 0, 1]);\r\n var position = Vector3.FromArray(node.translation || [0, 0, 0]);\r\n mat = Matrix.Compose(scale, rotation, position);\r\n }\r\n else {\r\n mat = Matrix.FromArray(node.matrix);\r\n }\r\n return mat;\r\n};\r\n/**\r\n* Returns the parent bone\r\n*/\r\nvar getParentBone = function (gltfRuntime, skins, jointName, newSkeleton) {\r\n // Try to find\r\n for (var i = 0; i < newSkeleton.bones.length; i++) {\r\n if (newSkeleton.bones[i].name === jointName) {\r\n return newSkeleton.bones[i];\r\n }\r\n }\r\n // Not found, search in gltf nodes\r\n var nodes = gltfRuntime.nodes;\r\n for (var nde in nodes) {\r\n var node = nodes[nde];\r\n if (!node.jointName) {\r\n continue;\r\n }\r\n var children = node.children;\r\n for (var i = 0; i < children.length; i++) {\r\n var child = gltfRuntime.nodes[children[i]];\r\n if (!child.jointName) {\r\n continue;\r\n }\r\n if (child.jointName === jointName) {\r\n var mat = configureBoneTransformation(node);\r\n var bone = new Bone(node.name || \"\", newSkeleton, getParentBone(gltfRuntime, skins, node.jointName, newSkeleton), mat);\r\n bone.id = nde;\r\n return bone;\r\n }\r\n }\r\n }\r\n return null;\r\n};\r\n/**\r\n* Returns the appropriate root node\r\n*/\r\nvar getNodeToRoot = function (nodesToRoot, id) {\r\n for (var i = 0; i < nodesToRoot.length; i++) {\r\n var nodeToRoot = nodesToRoot[i];\r\n for (var j = 0; j < nodeToRoot.node.children.length; j++) {\r\n var child = nodeToRoot.node.children[j];\r\n if (child === id) {\r\n return nodeToRoot.bone;\r\n }\r\n }\r\n }\r\n return null;\r\n};\r\n/**\r\n* Returns the node with the joint name\r\n*/\r\nvar getJointNode = function (gltfRuntime, jointName) {\r\n var nodes = gltfRuntime.nodes;\r\n var node = nodes[jointName];\r\n if (node) {\r\n return {\r\n node: node,\r\n id: jointName\r\n };\r\n }\r\n for (var nde in nodes) {\r\n node = nodes[nde];\r\n if (node.jointName === jointName) {\r\n return {\r\n node: node,\r\n id: nde\r\n };\r\n }\r\n }\r\n return null;\r\n};\r\n/**\r\n* Checks if a nodes is in joints\r\n*/\r\nvar nodeIsInJoints = function (skins, id) {\r\n for (var i = 0; i < skins.jointNames.length; i++) {\r\n if (skins.jointNames[i] === id) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n/**\r\n* Fills the nodes to root for bones and builds hierarchy\r\n*/\r\nvar getNodesToRoot = function (gltfRuntime, newSkeleton, skins, nodesToRoot) {\r\n // Creates nodes for root\r\n for (var nde in gltfRuntime.nodes) {\r\n var node = gltfRuntime.nodes[nde];\r\n var id = nde;\r\n if (!node.jointName || nodeIsInJoints(skins, node.jointName)) {\r\n continue;\r\n }\r\n // Create node to root bone\r\n var mat = configureBoneTransformation(node);\r\n var bone = new Bone(node.name || \"\", newSkeleton, null, mat);\r\n bone.id = id;\r\n nodesToRoot.push({ bone: bone, node: node, id: id });\r\n }\r\n // Parenting\r\n for (var i = 0; i < nodesToRoot.length; i++) {\r\n var nodeToRoot = nodesToRoot[i];\r\n var children = nodeToRoot.node.children;\r\n for (var j = 0; j < children.length; j++) {\r\n var child = null;\r\n for (var k = 0; k < nodesToRoot.length; k++) {\r\n if (nodesToRoot[k].id === children[j]) {\r\n child = nodesToRoot[k];\r\n break;\r\n }\r\n }\r\n if (child) {\r\n child.bone._parent = nodeToRoot.bone;\r\n nodeToRoot.bone.children.push(child.bone);\r\n }\r\n }\r\n }\r\n};\r\n/**\r\n* Imports a skeleton\r\n*/\r\nvar importSkeleton = function (gltfRuntime, skins, mesh, newSkeleton, id) {\r\n if (!newSkeleton) {\r\n newSkeleton = new Skeleton(skins.name || \"\", \"\", gltfRuntime.scene);\r\n }\r\n if (!skins.babylonSkeleton) {\r\n return newSkeleton;\r\n }\r\n // Find the root bones\r\n var nodesToRoot = [];\r\n var nodesToRootToAdd = [];\r\n getNodesToRoot(gltfRuntime, newSkeleton, skins, nodesToRoot);\r\n newSkeleton.bones = [];\r\n // Joints\r\n for (var i = 0; i < skins.jointNames.length; i++) {\r\n var jointNode = getJointNode(gltfRuntime, skins.jointNames[i]);\r\n if (!jointNode) {\r\n continue;\r\n }\r\n var node = jointNode.node;\r\n if (!node) {\r\n Tools.Warn(\"Joint named \" + skins.jointNames[i] + \" does not exist\");\r\n continue;\r\n }\r\n var id = jointNode.id;\r\n // Optimize, if the bone already exists...\r\n var existingBone = gltfRuntime.scene.getBoneByID(id);\r\n if (existingBone) {\r\n newSkeleton.bones.push(existingBone);\r\n continue;\r\n }\r\n // Search for parent bone\r\n var foundBone = false;\r\n var parentBone = null;\r\n for (var j = 0; j < i; j++) {\r\n var jointNode_1 = getJointNode(gltfRuntime, skins.jointNames[j]);\r\n if (!jointNode_1) {\r\n continue;\r\n }\r\n var joint = jointNode_1.node;\r\n if (!joint) {\r\n Tools.Warn(\"Joint named \" + skins.jointNames[j] + \" does not exist when looking for parent\");\r\n continue;\r\n }\r\n var children = joint.children;\r\n if (!children) {\r\n continue;\r\n }\r\n foundBone = false;\r\n for (var k = 0; k < children.length; k++) {\r\n if (children[k] === id) {\r\n parentBone = getParentBone(gltfRuntime, skins, skins.jointNames[j], newSkeleton);\r\n foundBone = true;\r\n break;\r\n }\r\n }\r\n if (foundBone) {\r\n break;\r\n }\r\n }\r\n // Create bone\r\n var mat = configureBoneTransformation(node);\r\n if (!parentBone && nodesToRoot.length > 0) {\r\n parentBone = getNodeToRoot(nodesToRoot, id);\r\n if (parentBone) {\r\n if (nodesToRootToAdd.indexOf(parentBone) === -1) {\r\n nodesToRootToAdd.push(parentBone);\r\n }\r\n }\r\n }\r\n var bone = new Bone(node.jointName || \"\", newSkeleton, parentBone, mat);\r\n bone.id = id;\r\n }\r\n // Polish\r\n var bones = newSkeleton.bones;\r\n newSkeleton.bones = [];\r\n for (var i = 0; i < skins.jointNames.length; i++) {\r\n var jointNode = getJointNode(gltfRuntime, skins.jointNames[i]);\r\n if (!jointNode) {\r\n continue;\r\n }\r\n for (var j = 0; j < bones.length; j++) {\r\n if (bones[j].id === jointNode.id) {\r\n newSkeleton.bones.push(bones[j]);\r\n break;\r\n }\r\n }\r\n }\r\n newSkeleton.prepare();\r\n // Finish\r\n for (var i = 0; i < nodesToRootToAdd.length; i++) {\r\n newSkeleton.bones.push(nodesToRootToAdd[i]);\r\n }\r\n return newSkeleton;\r\n};\r\n/**\r\n* Imports a mesh and its geometries\r\n*/\r\nvar importMesh = function (gltfRuntime, node, meshes, id, newMesh) {\r\n if (!newMesh) {\r\n gltfRuntime.scene._blockEntityCollection = gltfRuntime.forAssetContainer;\r\n newMesh = new Mesh(node.name || \"\", gltfRuntime.scene);\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n newMesh.id = id;\r\n }\r\n if (!node.babylonNode) {\r\n return newMesh;\r\n }\r\n var subMaterials = [];\r\n var vertexData = null;\r\n var verticesStarts = new Array();\r\n var verticesCounts = new Array();\r\n var indexStarts = new Array();\r\n var indexCounts = new Array();\r\n for (var meshIndex = 0; meshIndex < meshes.length; meshIndex++) {\r\n var meshID = meshes[meshIndex];\r\n var mesh = gltfRuntime.meshes[meshID];\r\n if (!mesh) {\r\n continue;\r\n }\r\n // Positions, normals and UVs\r\n for (var i = 0; i < mesh.primitives.length; i++) {\r\n // Temporary vertex data\r\n var tempVertexData = new VertexData();\r\n var primitive = mesh.primitives[i];\r\n if (primitive.mode !== 4) {\r\n // continue;\r\n }\r\n var attributes = primitive.attributes;\r\n var accessor = null;\r\n var buffer = null;\r\n // Set positions, normal and uvs\r\n for (var semantic in attributes) {\r\n // Link accessor and buffer view\r\n accessor = gltfRuntime.accessors[attributes[semantic]];\r\n buffer = GLTFUtils.GetBufferFromAccessor(gltfRuntime, accessor);\r\n if (semantic === \"NORMAL\") {\r\n tempVertexData.normals = new Float32Array(buffer.length);\r\n tempVertexData.normals.set(buffer);\r\n }\r\n else if (semantic === \"POSITION\") {\r\n if (GLTFFileLoader.HomogeneousCoordinates) {\r\n tempVertexData.positions = new Float32Array(buffer.length - buffer.length / 4);\r\n for (var j = 0; j < buffer.length; j += 4) {\r\n tempVertexData.positions[j] = buffer[j];\r\n tempVertexData.positions[j + 1] = buffer[j + 1];\r\n tempVertexData.positions[j + 2] = buffer[j + 2];\r\n }\r\n }\r\n else {\r\n tempVertexData.positions = new Float32Array(buffer.length);\r\n tempVertexData.positions.set(buffer);\r\n }\r\n verticesCounts.push(tempVertexData.positions.length);\r\n }\r\n else if (semantic.indexOf(\"TEXCOORD_\") !== -1) {\r\n var channel = Number(semantic.split(\"_\")[1]);\r\n var uvKind = VertexBuffer.UVKind + (channel === 0 ? \"\" : (channel + 1));\r\n var uvs = new Float32Array(buffer.length);\r\n uvs.set(buffer);\r\n normalizeUVs(uvs);\r\n tempVertexData.set(uvs, uvKind);\r\n }\r\n else if (semantic === \"JOINT\") {\r\n tempVertexData.matricesIndices = new Float32Array(buffer.length);\r\n tempVertexData.matricesIndices.set(buffer);\r\n }\r\n else if (semantic === \"WEIGHT\") {\r\n tempVertexData.matricesWeights = new Float32Array(buffer.length);\r\n tempVertexData.matricesWeights.set(buffer);\r\n }\r\n else if (semantic === \"COLOR\") {\r\n tempVertexData.colors = new Float32Array(buffer.length);\r\n tempVertexData.colors.set(buffer);\r\n }\r\n }\r\n // Indices\r\n accessor = gltfRuntime.accessors[primitive.indices];\r\n if (accessor) {\r\n buffer = GLTFUtils.GetBufferFromAccessor(gltfRuntime, accessor);\r\n tempVertexData.indices = new Int32Array(buffer.length);\r\n tempVertexData.indices.set(buffer);\r\n indexCounts.push(tempVertexData.indices.length);\r\n }\r\n else {\r\n // Set indices on the fly\r\n var indices = [];\r\n for (var j = 0; j < tempVertexData.positions.length / 3; j++) {\r\n indices.push(j);\r\n }\r\n tempVertexData.indices = new Int32Array(indices);\r\n indexCounts.push(tempVertexData.indices.length);\r\n }\r\n if (!vertexData) {\r\n vertexData = tempVertexData;\r\n }\r\n else {\r\n vertexData.merge(tempVertexData);\r\n }\r\n // Sub material\r\n var material_1 = gltfRuntime.scene.getMaterialByID(primitive.material);\r\n subMaterials.push(material_1 === null ? GLTFUtils.GetDefaultMaterial(gltfRuntime.scene) : material_1);\r\n // Update vertices start and index start\r\n verticesStarts.push(verticesStarts.length === 0 ? 0 : verticesStarts[verticesStarts.length - 1] + verticesCounts[verticesCounts.length - 2]);\r\n indexStarts.push(indexStarts.length === 0 ? 0 : indexStarts[indexStarts.length - 1] + indexCounts[indexCounts.length - 2]);\r\n }\r\n }\r\n var material;\r\n gltfRuntime.scene._blockEntityCollection = gltfRuntime.forAssetContainer;\r\n if (subMaterials.length > 1) {\r\n material = new MultiMaterial(\"multimat\" + id, gltfRuntime.scene);\r\n material.subMaterials = subMaterials;\r\n }\r\n else {\r\n material = new StandardMaterial(\"multimat\" + id, gltfRuntime.scene);\r\n }\r\n if (subMaterials.length === 1) {\r\n material = subMaterials[0];\r\n }\r\n if (!newMesh.material) {\r\n newMesh.material = material;\r\n }\r\n // Apply geometry\r\n new Geometry(id, gltfRuntime.scene, vertexData, false, newMesh);\r\n newMesh.computeWorldMatrix(true);\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n // Apply submeshes\r\n newMesh.subMeshes = [];\r\n var index = 0;\r\n for (var meshIndex = 0; meshIndex < meshes.length; meshIndex++) {\r\n var meshID = meshes[meshIndex];\r\n var mesh = gltfRuntime.meshes[meshID];\r\n if (!mesh) {\r\n continue;\r\n }\r\n for (var i = 0; i < mesh.primitives.length; i++) {\r\n if (mesh.primitives[i].mode !== 4) {\r\n //continue;\r\n }\r\n SubMesh.AddToMesh(index, verticesStarts[index], verticesCounts[index], indexStarts[index], indexCounts[index], newMesh, newMesh, true);\r\n index++;\r\n }\r\n }\r\n // Finish\r\n return newMesh;\r\n};\r\n/**\r\n* Configure node transformation from position, rotation and scaling\r\n*/\r\nvar configureNode = function (newNode, position, rotation, scaling) {\r\n if (newNode.position) {\r\n newNode.position = position;\r\n }\r\n if (newNode.rotationQuaternion || newNode.rotation) {\r\n newNode.rotationQuaternion = rotation;\r\n }\r\n if (newNode.scaling) {\r\n newNode.scaling = scaling;\r\n }\r\n};\r\n/**\r\n* Configures node from transformation matrix\r\n*/\r\nvar configureNodeFromMatrix = function (newNode, node, parent) {\r\n if (node.matrix) {\r\n var position = new Vector3(0, 0, 0);\r\n var rotation = new Quaternion();\r\n var scaling = new Vector3(0, 0, 0);\r\n var mat = Matrix.FromArray(node.matrix);\r\n mat.decompose(scaling, rotation, position);\r\n configureNode(newNode, position, rotation, scaling);\r\n }\r\n else if (node.translation && node.rotation && node.scale) {\r\n configureNode(newNode, Vector3.FromArray(node.translation), Quaternion.FromArray(node.rotation), Vector3.FromArray(node.scale));\r\n }\r\n newNode.computeWorldMatrix(true);\r\n};\r\n/**\r\n* Imports a node\r\n*/\r\nvar importNode = function (gltfRuntime, node, id, parent) {\r\n var lastNode = null;\r\n if (gltfRuntime.importOnlyMeshes && (node.skin || node.meshes)) {\r\n if (gltfRuntime.importMeshesNames && gltfRuntime.importMeshesNames.length > 0 && gltfRuntime.importMeshesNames.indexOf(node.name || \"\") === -1) {\r\n return null;\r\n }\r\n }\r\n // Meshes\r\n if (node.skin) {\r\n if (node.meshes) {\r\n var skin = gltfRuntime.skins[node.skin];\r\n var newMesh = importMesh(gltfRuntime, node, node.meshes, id, node.babylonNode);\r\n newMesh.skeleton = gltfRuntime.scene.getLastSkeletonByID(node.skin);\r\n if (newMesh.skeleton === null) {\r\n newMesh.skeleton = importSkeleton(gltfRuntime, skin, newMesh, skin.babylonSkeleton, node.skin);\r\n if (!skin.babylonSkeleton) {\r\n skin.babylonSkeleton = newMesh.skeleton;\r\n }\r\n }\r\n lastNode = newMesh;\r\n }\r\n }\r\n else if (node.meshes) {\r\n /**\r\n * Improve meshes property\r\n */\r\n var newMesh = importMesh(gltfRuntime, node, node.mesh ? [node.mesh] : node.meshes, id, node.babylonNode);\r\n lastNode = newMesh;\r\n }\r\n // Lights\r\n else if (node.light && !node.babylonNode && !gltfRuntime.importOnlyMeshes) {\r\n var light = gltfRuntime.lights[node.light];\r\n if (light) {\r\n if (light.type === \"ambient\") {\r\n var ambienLight = light[light.type];\r\n var hemiLight = new HemisphericLight(node.light, Vector3.Zero(), gltfRuntime.scene);\r\n hemiLight.name = node.name || \"\";\r\n if (ambienLight.color) {\r\n hemiLight.diffuse = Color3.FromArray(ambienLight.color);\r\n }\r\n lastNode = hemiLight;\r\n }\r\n else if (light.type === \"directional\") {\r\n var directionalLight = light[light.type];\r\n var dirLight = new DirectionalLight(node.light, Vector3.Zero(), gltfRuntime.scene);\r\n dirLight.name = node.name || \"\";\r\n if (directionalLight.color) {\r\n dirLight.diffuse = Color3.FromArray(directionalLight.color);\r\n }\r\n lastNode = dirLight;\r\n }\r\n else if (light.type === \"point\") {\r\n var pointLight = light[light.type];\r\n var ptLight = new PointLight(node.light, Vector3.Zero(), gltfRuntime.scene);\r\n ptLight.name = node.name || \"\";\r\n if (pointLight.color) {\r\n ptLight.diffuse = Color3.FromArray(pointLight.color);\r\n }\r\n lastNode = ptLight;\r\n }\r\n else if (light.type === \"spot\") {\r\n var spotLight = light[light.type];\r\n var spLight = new SpotLight(node.light, Vector3.Zero(), Vector3.Zero(), 0, 0, gltfRuntime.scene);\r\n spLight.name = node.name || \"\";\r\n if (spotLight.color) {\r\n spLight.diffuse = Color3.FromArray(spotLight.color);\r\n }\r\n if (spotLight.fallOfAngle) {\r\n spLight.angle = spotLight.fallOfAngle;\r\n }\r\n if (spotLight.fallOffExponent) {\r\n spLight.exponent = spotLight.fallOffExponent;\r\n }\r\n lastNode = spLight;\r\n }\r\n }\r\n }\r\n // Cameras\r\n else if (node.camera && !node.babylonNode && !gltfRuntime.importOnlyMeshes) {\r\n var camera = gltfRuntime.cameras[node.camera];\r\n if (camera) {\r\n gltfRuntime.scene._blockEntityCollection = gltfRuntime.forAssetContainer;\r\n if (camera.type === \"orthographic\") {\r\n var orthoCamera = new FreeCamera(node.camera, Vector3.Zero(), gltfRuntime.scene, false);\r\n orthoCamera.name = node.name || \"\";\r\n orthoCamera.mode = Camera.ORTHOGRAPHIC_CAMERA;\r\n orthoCamera.attachControl();\r\n lastNode = orthoCamera;\r\n }\r\n else if (camera.type === \"perspective\") {\r\n var perspectiveCamera = camera[camera.type];\r\n var persCamera = new FreeCamera(node.camera, Vector3.Zero(), gltfRuntime.scene, false);\r\n persCamera.name = node.name || \"\";\r\n persCamera.attachControl();\r\n if (!perspectiveCamera.aspectRatio) {\r\n perspectiveCamera.aspectRatio = gltfRuntime.scene.getEngine().getRenderWidth() / gltfRuntime.scene.getEngine().getRenderHeight();\r\n }\r\n if (perspectiveCamera.znear && perspectiveCamera.zfar) {\r\n persCamera.maxZ = perspectiveCamera.zfar;\r\n persCamera.minZ = perspectiveCamera.znear;\r\n }\r\n lastNode = persCamera;\r\n }\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n }\r\n }\r\n // Empty node\r\n if (!node.jointName) {\r\n if (node.babylonNode) {\r\n return node.babylonNode;\r\n }\r\n else if (lastNode === null) {\r\n gltfRuntime.scene._blockEntityCollection = gltfRuntime.forAssetContainer;\r\n var dummy = new Mesh(node.name || \"\", gltfRuntime.scene);\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n node.babylonNode = dummy;\r\n lastNode = dummy;\r\n }\r\n }\r\n if (lastNode !== null) {\r\n if (node.matrix && lastNode instanceof Mesh) {\r\n configureNodeFromMatrix(lastNode, node, parent);\r\n }\r\n else {\r\n var translation = node.translation || [0, 0, 0];\r\n var rotation = node.rotation || [0, 0, 0, 1];\r\n var scale = node.scale || [1, 1, 1];\r\n configureNode(lastNode, Vector3.FromArray(translation), Quaternion.FromArray(rotation), Vector3.FromArray(scale));\r\n }\r\n lastNode.updateCache(true);\r\n node.babylonNode = lastNode;\r\n }\r\n return lastNode;\r\n};\r\n/**\r\n* Traverses nodes and creates them\r\n*/\r\nvar traverseNodes = function (gltfRuntime, id, parent, meshIncluded) {\r\n if (meshIncluded === void 0) { meshIncluded = false; }\r\n var node = gltfRuntime.nodes[id];\r\n var newNode = null;\r\n if (gltfRuntime.importOnlyMeshes && !meshIncluded && gltfRuntime.importMeshesNames) {\r\n if (gltfRuntime.importMeshesNames.indexOf(node.name || \"\") !== -1 || gltfRuntime.importMeshesNames.length === 0) {\r\n meshIncluded = true;\r\n }\r\n else {\r\n meshIncluded = false;\r\n }\r\n }\r\n else {\r\n meshIncluded = true;\r\n }\r\n if (!node.jointName && meshIncluded) {\r\n newNode = importNode(gltfRuntime, node, id, parent);\r\n if (newNode !== null) {\r\n newNode.id = id;\r\n newNode.parent = parent;\r\n }\r\n }\r\n if (node.children) {\r\n for (var i = 0; i < node.children.length; i++) {\r\n traverseNodes(gltfRuntime, node.children[i], newNode, meshIncluded);\r\n }\r\n }\r\n};\r\n/**\r\n* do stuff after buffers, shaders are loaded (e.g. hook up materials, load animations, etc.)\r\n*/\r\nvar postLoad = function (gltfRuntime) {\r\n // Nodes\r\n var currentScene = gltfRuntime.currentScene;\r\n if (currentScene) {\r\n for (var i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n }\r\n else {\r\n for (var thing in gltfRuntime.scenes) {\r\n currentScene = gltfRuntime.scenes[thing];\r\n for (var i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n }\r\n }\r\n // Set animations\r\n loadAnimations(gltfRuntime);\r\n for (var i = 0; i < gltfRuntime.scene.skeletons.length; i++) {\r\n var skeleton = gltfRuntime.scene.skeletons[i];\r\n gltfRuntime.scene.beginAnimation(skeleton, 0, Number.MAX_VALUE, true, 1.0);\r\n }\r\n};\r\n/**\r\n* onBind shaderrs callback to set uniforms and matrices\r\n*/\r\nvar onBindShaderMaterial = function (mesh, gltfRuntime, unTreatedUniforms, shaderMaterial, technique, material, onSuccess) {\r\n var materialValues = material.values || technique.parameters;\r\n for (var unif in unTreatedUniforms) {\r\n var uniform = unTreatedUniforms[unif];\r\n var type = uniform.type;\r\n if (type === EParameterType.FLOAT_MAT2 || type === EParameterType.FLOAT_MAT3 || type === EParameterType.FLOAT_MAT4) {\r\n if (uniform.semantic && !uniform.source && !uniform.node) {\r\n GLTFUtils.SetMatrix(gltfRuntime.scene, mesh, uniform, unif, shaderMaterial.getEffect());\r\n }\r\n else if (uniform.semantic && (uniform.source || uniform.node)) {\r\n var source = gltfRuntime.scene.getNodeByName(uniform.source || uniform.node || \"\");\r\n if (source === null) {\r\n source = gltfRuntime.scene.getNodeByID(uniform.source || uniform.node || \"\");\r\n }\r\n if (source === null) {\r\n continue;\r\n }\r\n GLTFUtils.SetMatrix(gltfRuntime.scene, source, uniform, unif, shaderMaterial.getEffect());\r\n }\r\n }\r\n else {\r\n var value = materialValues[technique.uniforms[unif]];\r\n if (!value) {\r\n continue;\r\n }\r\n if (type === EParameterType.SAMPLER_2D) {\r\n var texture = gltfRuntime.textures[material.values ? value : uniform.value].babylonTexture;\r\n if (texture === null || texture === undefined) {\r\n continue;\r\n }\r\n shaderMaterial.getEffect().setTexture(unif, texture);\r\n }\r\n else {\r\n GLTFUtils.SetUniform((shaderMaterial.getEffect()), unif, value, type);\r\n }\r\n }\r\n }\r\n onSuccess(shaderMaterial);\r\n};\r\n/**\r\n* Prepare uniforms to send the only one time\r\n* Loads the appropriate textures\r\n*/\r\nvar prepareShaderMaterialUniforms = function (gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms) {\r\n var materialValues = material.values || technique.parameters;\r\n var techniqueUniforms = technique.uniforms;\r\n /**\r\n * Prepare values here (not matrices)\r\n */\r\n for (var unif in unTreatedUniforms) {\r\n var uniform = unTreatedUniforms[unif];\r\n var type = uniform.type;\r\n var value = materialValues[techniqueUniforms[unif]];\r\n if (value === undefined) {\r\n // In case the value is the same for all materials\r\n value = uniform.value;\r\n }\r\n if (!value) {\r\n continue;\r\n }\r\n var onLoadTexture = function (uniformName) {\r\n return function (texture) {\r\n if (uniform.value && uniformName) {\r\n // Static uniform\r\n shaderMaterial.setTexture(uniformName, texture);\r\n delete unTreatedUniforms[uniformName];\r\n }\r\n };\r\n };\r\n // Texture (sampler2D)\r\n if (type === EParameterType.SAMPLER_2D) {\r\n GLTFLoaderExtension.LoadTextureAsync(gltfRuntime, material.values ? value : uniform.value, onLoadTexture(unif), function () { return onLoadTexture(null); });\r\n }\r\n // Others\r\n else {\r\n if (uniform.value && GLTFUtils.SetUniform(shaderMaterial, unif, material.values ? value : uniform.value, type)) {\r\n // Static uniform\r\n delete unTreatedUniforms[unif];\r\n }\r\n }\r\n }\r\n};\r\n/**\r\n* Shader compilation failed\r\n*/\r\nvar onShaderCompileError = function (program, shaderMaterial, onError) {\r\n return function (effect, error) {\r\n shaderMaterial.dispose(true);\r\n onError(\"Cannot compile program named \" + program.name + \". Error: \" + error + \". Default material will be applied\");\r\n };\r\n};\r\n/**\r\n* Shader compilation success\r\n*/\r\nvar onShaderCompileSuccess = function (gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms, onSuccess) {\r\n return function (_) {\r\n prepareShaderMaterialUniforms(gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms);\r\n shaderMaterial.onBind = function (mesh) {\r\n onBindShaderMaterial(mesh, gltfRuntime, unTreatedUniforms, shaderMaterial, technique, material, onSuccess);\r\n };\r\n };\r\n};\r\n/**\r\n* Returns the appropriate uniform if already handled by babylon\r\n*/\r\nvar parseShaderUniforms = function (tokenizer, technique, unTreatedUniforms) {\r\n for (var unif in technique.uniforms) {\r\n var uniform = technique.uniforms[unif];\r\n var uniformParameter = technique.parameters[uniform];\r\n if (tokenizer.currentIdentifier === unif) {\r\n if (uniformParameter.semantic && !uniformParameter.source && !uniformParameter.node) {\r\n var transformIndex = glTFTransforms.indexOf(uniformParameter.semantic);\r\n if (transformIndex !== -1) {\r\n delete unTreatedUniforms[unif];\r\n return babylonTransforms[transformIndex];\r\n }\r\n }\r\n }\r\n }\r\n return tokenizer.currentIdentifier;\r\n};\r\n/**\r\n* All shaders loaded. Create materials one by one\r\n*/\r\nvar importMaterials = function (gltfRuntime) {\r\n // Create materials\r\n for (var mat in gltfRuntime.materials) {\r\n GLTFLoaderExtension.LoadMaterialAsync(gltfRuntime, mat, function (material) { }, function () { });\r\n }\r\n};\r\n/**\r\n* Implementation of the base glTF spec\r\n* @hidden\r\n*/\r\nvar GLTFLoaderBase = /** @class */ (function () {\r\n function GLTFLoaderBase() {\r\n }\r\n GLTFLoaderBase.CreateRuntime = function (parsedData, scene, rootUrl) {\r\n var gltfRuntime = {\r\n extensions: {},\r\n accessors: {},\r\n buffers: {},\r\n bufferViews: {},\r\n meshes: {},\r\n lights: {},\r\n cameras: {},\r\n nodes: {},\r\n images: {},\r\n textures: {},\r\n shaders: {},\r\n programs: {},\r\n samplers: {},\r\n techniques: {},\r\n materials: {},\r\n animations: {},\r\n skins: {},\r\n extensionsUsed: [],\r\n scenes: {},\r\n buffersCount: 0,\r\n shaderscount: 0,\r\n scene: scene,\r\n rootUrl: rootUrl,\r\n loadedBufferCount: 0,\r\n loadedBufferViews: {},\r\n loadedShaderCount: 0,\r\n importOnlyMeshes: false,\r\n dummyNodes: [],\r\n forAssetContainer: false\r\n };\r\n // Parse\r\n if (parsedData.extensions) {\r\n parseObject(parsedData.extensions, \"extensions\", gltfRuntime);\r\n }\r\n if (parsedData.extensionsUsed) {\r\n parseObject(parsedData.extensionsUsed, \"extensionsUsed\", gltfRuntime);\r\n }\r\n if (parsedData.buffers) {\r\n parseBuffers(parsedData.buffers, gltfRuntime);\r\n }\r\n if (parsedData.bufferViews) {\r\n parseObject(parsedData.bufferViews, \"bufferViews\", gltfRuntime);\r\n }\r\n if (parsedData.accessors) {\r\n parseObject(parsedData.accessors, \"accessors\", gltfRuntime);\r\n }\r\n if (parsedData.meshes) {\r\n parseObject(parsedData.meshes, \"meshes\", gltfRuntime);\r\n }\r\n if (parsedData.lights) {\r\n parseObject(parsedData.lights, \"lights\", gltfRuntime);\r\n }\r\n if (parsedData.cameras) {\r\n parseObject(parsedData.cameras, \"cameras\", gltfRuntime);\r\n }\r\n if (parsedData.nodes) {\r\n parseObject(parsedData.nodes, \"nodes\", gltfRuntime);\r\n }\r\n if (parsedData.images) {\r\n parseObject(parsedData.images, \"images\", gltfRuntime);\r\n }\r\n if (parsedData.textures) {\r\n parseObject(parsedData.textures, \"textures\", gltfRuntime);\r\n }\r\n if (parsedData.shaders) {\r\n parseShaders(parsedData.shaders, gltfRuntime);\r\n }\r\n if (parsedData.programs) {\r\n parseObject(parsedData.programs, \"programs\", gltfRuntime);\r\n }\r\n if (parsedData.samplers) {\r\n parseObject(parsedData.samplers, \"samplers\", gltfRuntime);\r\n }\r\n if (parsedData.techniques) {\r\n parseObject(parsedData.techniques, \"techniques\", gltfRuntime);\r\n }\r\n if (parsedData.materials) {\r\n parseObject(parsedData.materials, \"materials\", gltfRuntime);\r\n }\r\n if (parsedData.animations) {\r\n parseObject(parsedData.animations, \"animations\", gltfRuntime);\r\n }\r\n if (parsedData.skins) {\r\n parseObject(parsedData.skins, \"skins\", gltfRuntime);\r\n }\r\n if (parsedData.scenes) {\r\n gltfRuntime.scenes = parsedData.scenes;\r\n }\r\n if (parsedData.scene && parsedData.scenes) {\r\n gltfRuntime.currentScene = parsedData.scenes[parsedData.scene];\r\n }\r\n return gltfRuntime;\r\n };\r\n GLTFLoaderBase.LoadBufferAsync = function (gltfRuntime, id, onSuccess, onError, onProgress) {\r\n var buffer = gltfRuntime.buffers[id];\r\n if (Tools.IsBase64(buffer.uri)) {\r\n setTimeout(function () { return onSuccess(new Uint8Array(Tools.DecodeBase64(buffer.uri))); });\r\n }\r\n else {\r\n Tools.LoadFile(gltfRuntime.rootUrl + buffer.uri, function (data) { return onSuccess(new Uint8Array(data)); }, onProgress, undefined, true, function (request) {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText);\r\n }\r\n });\r\n }\r\n };\r\n GLTFLoaderBase.LoadTextureBufferAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n var texture = gltfRuntime.textures[id];\r\n if (!texture || !texture.source) {\r\n onError(\"\");\r\n return;\r\n }\r\n if (texture.babylonTexture) {\r\n onSuccess(null);\r\n return;\r\n }\r\n var source = gltfRuntime.images[texture.source];\r\n if (Tools.IsBase64(source.uri)) {\r\n setTimeout(function () { return onSuccess(new Uint8Array(Tools.DecodeBase64(source.uri))); });\r\n }\r\n else {\r\n Tools.LoadFile(gltfRuntime.rootUrl + source.uri, function (data) { return onSuccess(new Uint8Array(data)); }, undefined, undefined, true, function (request) {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText);\r\n }\r\n });\r\n }\r\n };\r\n GLTFLoaderBase.CreateTextureAsync = function (gltfRuntime, id, buffer, onSuccess, onError) {\r\n var texture = gltfRuntime.textures[id];\r\n if (texture.babylonTexture) {\r\n onSuccess(texture.babylonTexture);\r\n return;\r\n }\r\n var sampler = gltfRuntime.samplers[texture.sampler];\r\n var createMipMaps = (sampler.minFilter === ETextureFilterType.NEAREST_MIPMAP_NEAREST) ||\r\n (sampler.minFilter === ETextureFilterType.NEAREST_MIPMAP_LINEAR) ||\r\n (sampler.minFilter === ETextureFilterType.LINEAR_MIPMAP_NEAREST) ||\r\n (sampler.minFilter === ETextureFilterType.LINEAR_MIPMAP_LINEAR);\r\n var samplingMode = Texture.BILINEAR_SAMPLINGMODE;\r\n var blob = buffer == null ? new Blob() : new Blob([buffer]);\r\n var blobURL = URL.createObjectURL(blob);\r\n var revokeBlobURL = function () { return URL.revokeObjectURL(blobURL); };\r\n var newTexture = new Texture(blobURL, gltfRuntime.scene, !createMipMaps, true, samplingMode, revokeBlobURL, revokeBlobURL);\r\n if (sampler.wrapS !== undefined) {\r\n newTexture.wrapU = GLTFUtils.GetWrapMode(sampler.wrapS);\r\n }\r\n if (sampler.wrapT !== undefined) {\r\n newTexture.wrapV = GLTFUtils.GetWrapMode(sampler.wrapT);\r\n }\r\n newTexture.name = id;\r\n texture.babylonTexture = newTexture;\r\n onSuccess(newTexture);\r\n };\r\n GLTFLoaderBase.LoadShaderStringAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n var shader = gltfRuntime.shaders[id];\r\n if (Tools.IsBase64(shader.uri)) {\r\n var shaderString = atob(shader.uri.split(\",\")[1]);\r\n if (onSuccess) {\r\n onSuccess(shaderString);\r\n }\r\n }\r\n else {\r\n Tools.LoadFile(gltfRuntime.rootUrl + shader.uri, onSuccess, undefined, undefined, false, function (request) {\r\n if (request && onError) {\r\n onError(request.status + \" \" + request.statusText);\r\n }\r\n });\r\n }\r\n };\r\n GLTFLoaderBase.LoadMaterialAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n var material = gltfRuntime.materials[id];\r\n if (!material.technique) {\r\n if (onError) {\r\n onError(\"No technique found.\");\r\n }\r\n return;\r\n }\r\n var technique = gltfRuntime.techniques[material.technique];\r\n if (!technique) {\r\n gltfRuntime.scene._blockEntityCollection = gltfRuntime.forAssetContainer;\r\n var defaultMaterial = new StandardMaterial(id, gltfRuntime.scene);\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n defaultMaterial.diffuseColor = new Color3(0.5, 0.5, 0.5);\r\n defaultMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n onSuccess(defaultMaterial);\r\n return;\r\n }\r\n var program = gltfRuntime.programs[technique.program];\r\n var states = technique.states;\r\n var vertexShader = Effect.ShadersStore[program.vertexShader + \"VertexShader\"];\r\n var pixelShader = Effect.ShadersStore[program.fragmentShader + \"PixelShader\"];\r\n var newVertexShader = \"\";\r\n var newPixelShader = \"\";\r\n var vertexTokenizer = new Tokenizer(vertexShader);\r\n var pixelTokenizer = new Tokenizer(pixelShader);\r\n var unTreatedUniforms = {};\r\n var uniforms = [];\r\n var attributes = [];\r\n var samplers = [];\r\n // Fill uniform, sampler2D and attributes\r\n for (var unif in technique.uniforms) {\r\n var uniform = technique.uniforms[unif];\r\n var uniformParameter = technique.parameters[uniform];\r\n unTreatedUniforms[unif] = uniformParameter;\r\n if (uniformParameter.semantic && !uniformParameter.node && !uniformParameter.source) {\r\n var transformIndex = glTFTransforms.indexOf(uniformParameter.semantic);\r\n if (transformIndex !== -1) {\r\n uniforms.push(babylonTransforms[transformIndex]);\r\n delete unTreatedUniforms[unif];\r\n }\r\n else {\r\n uniforms.push(unif);\r\n }\r\n }\r\n else if (uniformParameter.type === EParameterType.SAMPLER_2D) {\r\n samplers.push(unif);\r\n }\r\n else {\r\n uniforms.push(unif);\r\n }\r\n }\r\n for (var attr in technique.attributes) {\r\n var attribute = technique.attributes[attr];\r\n var attributeParameter = technique.parameters[attribute];\r\n if (attributeParameter.semantic) {\r\n var name_1 = getAttribute(attributeParameter);\r\n if (name_1) {\r\n attributes.push(name_1);\r\n }\r\n }\r\n }\r\n // Configure vertex shader\r\n while (!vertexTokenizer.isEnd() && vertexTokenizer.getNextToken()) {\r\n var tokenType = vertexTokenizer.currentToken;\r\n if (tokenType !== ETokenType.IDENTIFIER) {\r\n newVertexShader += vertexTokenizer.currentString;\r\n continue;\r\n }\r\n var foundAttribute = false;\r\n for (var attr in technique.attributes) {\r\n var attribute = technique.attributes[attr];\r\n var attributeParameter = technique.parameters[attribute];\r\n if (vertexTokenizer.currentIdentifier === attr && attributeParameter.semantic) {\r\n newVertexShader += getAttribute(attributeParameter);\r\n foundAttribute = true;\r\n break;\r\n }\r\n }\r\n if (foundAttribute) {\r\n continue;\r\n }\r\n newVertexShader += parseShaderUniforms(vertexTokenizer, technique, unTreatedUniforms);\r\n }\r\n // Configure pixel shader\r\n while (!pixelTokenizer.isEnd() && pixelTokenizer.getNextToken()) {\r\n var tokenType = pixelTokenizer.currentToken;\r\n if (tokenType !== ETokenType.IDENTIFIER) {\r\n newPixelShader += pixelTokenizer.currentString;\r\n continue;\r\n }\r\n newPixelShader += parseShaderUniforms(pixelTokenizer, technique, unTreatedUniforms);\r\n }\r\n // Create shader material\r\n var shaderPath = {\r\n vertex: program.vertexShader + id,\r\n fragment: program.fragmentShader + id\r\n };\r\n var options = {\r\n attributes: attributes,\r\n uniforms: uniforms,\r\n samplers: samplers,\r\n needAlphaBlending: states && states.enable && states.enable.indexOf(3042) !== -1\r\n };\r\n Effect.ShadersStore[program.vertexShader + id + \"VertexShader\"] = newVertexShader;\r\n Effect.ShadersStore[program.fragmentShader + id + \"PixelShader\"] = newPixelShader;\r\n var shaderMaterial = new ShaderMaterial(id, gltfRuntime.scene, shaderPath, options);\r\n shaderMaterial.onError = onShaderCompileError(program, shaderMaterial, onError);\r\n shaderMaterial.onCompiled = onShaderCompileSuccess(gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms, onSuccess);\r\n shaderMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n if (states && states.functions) {\r\n var functions = states.functions;\r\n if (functions.cullFace && functions.cullFace[0] !== ECullingType.BACK) {\r\n shaderMaterial.backFaceCulling = false;\r\n }\r\n var blendFunc = functions.blendFuncSeparate;\r\n if (blendFunc) {\r\n if (blendFunc[0] === EBlendingFunction.SRC_ALPHA && blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_ALPHA && blendFunc[2] === EBlendingFunction.ONE && blendFunc[3] === EBlendingFunction.ONE) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_COMBINE;\r\n }\r\n else if (blendFunc[0] === EBlendingFunction.ONE && blendFunc[1] === EBlendingFunction.ONE && blendFunc[2] === EBlendingFunction.ZERO && blendFunc[3] === EBlendingFunction.ONE) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_ONEONE;\r\n }\r\n else if (blendFunc[0] === EBlendingFunction.SRC_ALPHA && blendFunc[1] === EBlendingFunction.ONE && blendFunc[2] === EBlendingFunction.ZERO && blendFunc[3] === EBlendingFunction.ONE) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_ADD;\r\n }\r\n else if (blendFunc[0] === EBlendingFunction.ZERO && blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_COLOR && blendFunc[2] === EBlendingFunction.ONE && blendFunc[3] === EBlendingFunction.ONE) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_SUBTRACT;\r\n }\r\n else if (blendFunc[0] === EBlendingFunction.DST_COLOR && blendFunc[1] === EBlendingFunction.ZERO && blendFunc[2] === EBlendingFunction.ONE && blendFunc[3] === EBlendingFunction.ONE) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_MULTIPLY;\r\n }\r\n else if (blendFunc[0] === EBlendingFunction.SRC_ALPHA && blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_COLOR && blendFunc[2] === EBlendingFunction.ONE && blendFunc[3] === EBlendingFunction.ONE) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_MAXIMIZED;\r\n }\r\n }\r\n }\r\n };\r\n return GLTFLoaderBase;\r\n}());\r\nexport { GLTFLoaderBase };\r\n/**\r\n* glTF V1 Loader\r\n* @hidden\r\n*/\r\nvar GLTFLoader = /** @class */ (function () {\r\n function GLTFLoader() {\r\n this.state = null;\r\n }\r\n GLTFLoader.RegisterExtension = function (extension) {\r\n if (GLTFLoader.Extensions[extension.name]) {\r\n Tools.Error(\"Tool with the same name \\\"\" + extension.name + \"\\\" already exists\");\r\n return;\r\n }\r\n GLTFLoader.Extensions[extension.name] = extension;\r\n };\r\n GLTFLoader.prototype.dispose = function () {\r\n // do nothing\r\n };\r\n GLTFLoader.prototype._importMeshAsync = function (meshesNames, scene, data, rootUrl, forAssetContainer, onSuccess, onProgress, onError) {\r\n var _this = this;\r\n scene.useRightHandedSystem = true;\r\n GLTFLoaderExtension.LoadRuntimeAsync(scene, data, rootUrl, function (gltfRuntime) {\r\n gltfRuntime.forAssetContainer = forAssetContainer;\r\n gltfRuntime.importOnlyMeshes = true;\r\n if (meshesNames === \"\") {\r\n gltfRuntime.importMeshesNames = [];\r\n }\r\n else if (typeof meshesNames === \"string\") {\r\n gltfRuntime.importMeshesNames = [meshesNames];\r\n }\r\n else if (meshesNames && !(meshesNames instanceof Array)) {\r\n gltfRuntime.importMeshesNames = [meshesNames];\r\n }\r\n else {\r\n gltfRuntime.importMeshesNames = [];\r\n Tools.Warn(\"Argument meshesNames must be of type string or string[]\");\r\n }\r\n // Create nodes\r\n _this._createNodes(gltfRuntime);\r\n var meshes = new Array();\r\n var skeletons = new Array();\r\n // Fill arrays of meshes and skeletons\r\n for (var nde in gltfRuntime.nodes) {\r\n var node = gltfRuntime.nodes[nde];\r\n if (node.babylonNode instanceof AbstractMesh) {\r\n meshes.push(node.babylonNode);\r\n }\r\n }\r\n for (var skl in gltfRuntime.skins) {\r\n var skin = gltfRuntime.skins[skl];\r\n if (skin.babylonSkeleton instanceof Skeleton) {\r\n skeletons.push(skin.babylonSkeleton);\r\n }\r\n }\r\n // Load buffers, shaders, materials, etc.\r\n _this._loadBuffersAsync(gltfRuntime, function () {\r\n _this._loadShadersAsync(gltfRuntime, function () {\r\n importMaterials(gltfRuntime);\r\n postLoad(gltfRuntime);\r\n if (!GLTFFileLoader.IncrementalLoading && onSuccess) {\r\n onSuccess(meshes, skeletons);\r\n }\r\n });\r\n }, onProgress);\r\n if (GLTFFileLoader.IncrementalLoading && onSuccess) {\r\n onSuccess(meshes, skeletons);\r\n }\r\n }, onError);\r\n return true;\r\n };\r\n /**\r\n * Imports one or more meshes from a loaded gltf file and adds them to the scene\r\n * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file\r\n * @param scene the scene the meshes should be added to\r\n * @param forAssetContainer defines if the entities must be stored in the scene\r\n * @param data gltf data containing information of the meshes in a loaded file\r\n * @param rootUrl root url to load from\r\n * @param onProgress event that fires when loading progress has occured\r\n * @returns a promise containg the loaded meshes, particles, skeletons and animations\r\n */\r\n GLTFLoader.prototype.importMeshAsync = function (meshesNames, scene, forAssetContainer, data, rootUrl, onProgress) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._importMeshAsync(meshesNames, scene, data, rootUrl, forAssetContainer, function (meshes, skeletons) {\r\n resolve({\r\n meshes: meshes,\r\n particleSystems: [],\r\n skeletons: skeletons,\r\n animationGroups: [],\r\n lights: [],\r\n transformNodes: [],\r\n geometries: []\r\n });\r\n }, onProgress, function (message) {\r\n reject(new Error(message));\r\n });\r\n });\r\n };\r\n GLTFLoader.prototype._loadAsync = function (scene, data, rootUrl, forAssetContainer, onSuccess, onProgress, onError) {\r\n var _this = this;\r\n scene.useRightHandedSystem = true;\r\n GLTFLoaderExtension.LoadRuntimeAsync(scene, data, rootUrl, function (gltfRuntime) {\r\n // Load runtime extensios\r\n GLTFLoaderExtension.LoadRuntimeExtensionsAsync(gltfRuntime, function () {\r\n // Create nodes\r\n _this._createNodes(gltfRuntime);\r\n // Load buffers, shaders, materials, etc.\r\n _this._loadBuffersAsync(gltfRuntime, function () {\r\n _this._loadShadersAsync(gltfRuntime, function () {\r\n importMaterials(gltfRuntime);\r\n postLoad(gltfRuntime);\r\n if (!GLTFFileLoader.IncrementalLoading) {\r\n onSuccess();\r\n }\r\n });\r\n });\r\n if (GLTFFileLoader.IncrementalLoading) {\r\n onSuccess();\r\n }\r\n }, onError);\r\n }, onError);\r\n };\r\n /**\r\n * Imports all objects from a loaded gltf file and adds them to the scene\r\n * @param scene the scene the objects should be added to\r\n * @param data gltf data containing information of the meshes in a loaded file\r\n * @param rootUrl root url to load from\r\n * @param onProgress event that fires when loading progress has occured\r\n * @returns a promise which completes when objects have been loaded to the scene\r\n */\r\n GLTFLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._loadAsync(scene, data, rootUrl, false, function () {\r\n resolve();\r\n }, onProgress, function (message) {\r\n reject(new Error(message));\r\n });\r\n });\r\n };\r\n GLTFLoader.prototype._loadShadersAsync = function (gltfRuntime, onload) {\r\n var hasShaders = false;\r\n var processShader = function (sha, shader) {\r\n GLTFLoaderExtension.LoadShaderStringAsync(gltfRuntime, sha, function (shaderString) {\r\n if (shaderString instanceof ArrayBuffer) {\r\n return;\r\n }\r\n gltfRuntime.loadedShaderCount++;\r\n if (shaderString) {\r\n Effect.ShadersStore[sha + (shader.type === EShaderType.VERTEX ? \"VertexShader\" : \"PixelShader\")] = shaderString;\r\n }\r\n if (gltfRuntime.loadedShaderCount === gltfRuntime.shaderscount) {\r\n onload();\r\n }\r\n }, function () {\r\n Tools.Error(\"Error when loading shader program named \" + sha + \" located at \" + shader.uri);\r\n });\r\n };\r\n for (var sha in gltfRuntime.shaders) {\r\n hasShaders = true;\r\n var shader = gltfRuntime.shaders[sha];\r\n if (shader) {\r\n processShader.bind(this, sha, shader)();\r\n }\r\n else {\r\n Tools.Error(\"No shader named: \" + sha);\r\n }\r\n }\r\n if (!hasShaders) {\r\n onload();\r\n }\r\n };\r\n GLTFLoader.prototype._loadBuffersAsync = function (gltfRuntime, onLoad, onProgress) {\r\n var hasBuffers = false;\r\n var processBuffer = function (buf, buffer) {\r\n GLTFLoaderExtension.LoadBufferAsync(gltfRuntime, buf, function (bufferView) {\r\n gltfRuntime.loadedBufferCount++;\r\n if (bufferView) {\r\n if (bufferView.byteLength != gltfRuntime.buffers[buf].byteLength) {\r\n Tools.Error(\"Buffer named \" + buf + \" is length \" + bufferView.byteLength + \". Expected: \" + buffer.byteLength); // Improve error message\r\n }\r\n gltfRuntime.loadedBufferViews[buf] = bufferView;\r\n }\r\n if (gltfRuntime.loadedBufferCount === gltfRuntime.buffersCount) {\r\n onLoad();\r\n }\r\n }, function () {\r\n Tools.Error(\"Error when loading buffer named \" + buf + \" located at \" + buffer.uri);\r\n });\r\n };\r\n for (var buf in gltfRuntime.buffers) {\r\n hasBuffers = true;\r\n var buffer = gltfRuntime.buffers[buf];\r\n if (buffer) {\r\n processBuffer.bind(this, buf, buffer)();\r\n }\r\n else {\r\n Tools.Error(\"No buffer named: \" + buf);\r\n }\r\n }\r\n if (!hasBuffers) {\r\n onLoad();\r\n }\r\n };\r\n GLTFLoader.prototype._createNodes = function (gltfRuntime) {\r\n var currentScene = gltfRuntime.currentScene;\r\n if (currentScene) {\r\n // Only one scene even if multiple scenes are defined\r\n for (var i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n }\r\n else {\r\n // Load all scenes\r\n for (var thing in gltfRuntime.scenes) {\r\n currentScene = gltfRuntime.scenes[thing];\r\n for (var i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n }\r\n }\r\n };\r\n GLTFLoader.Extensions = {};\r\n return GLTFLoader;\r\n}());\r\nexport { GLTFLoader };\r\n/** @hidden */\r\nvar GLTFLoaderExtension = /** @class */ (function () {\r\n function GLTFLoaderExtension(name) {\r\n this._name = name;\r\n }\r\n Object.defineProperty(GLTFLoaderExtension.prototype, \"name\", {\r\n get: function () {\r\n return this._name;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Defines an override for loading the runtime\r\n * Return true to stop further extensions from loading the runtime\r\n */\r\n GLTFLoaderExtension.prototype.loadRuntimeAsync = function (scene, data, rootUrl, onSuccess, onError) {\r\n return false;\r\n };\r\n /**\r\n * Defines an onverride for creating gltf runtime\r\n * Return true to stop further extensions from creating the runtime\r\n */\r\n GLTFLoaderExtension.prototype.loadRuntimeExtensionsAsync = function (gltfRuntime, onSuccess, onError) {\r\n return false;\r\n };\r\n /**\r\n * Defines an override for loading buffers\r\n * Return true to stop further extensions from loading this buffer\r\n */\r\n GLTFLoaderExtension.prototype.loadBufferAsync = function (gltfRuntime, id, onSuccess, onError, onProgress) {\r\n return false;\r\n };\r\n /**\r\n * Defines an override for loading texture buffers\r\n * Return true to stop further extensions from loading this texture data\r\n */\r\n GLTFLoaderExtension.prototype.loadTextureBufferAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n return false;\r\n };\r\n /**\r\n * Defines an override for creating textures\r\n * Return true to stop further extensions from loading this texture\r\n */\r\n GLTFLoaderExtension.prototype.createTextureAsync = function (gltfRuntime, id, buffer, onSuccess, onError) {\r\n return false;\r\n };\r\n /**\r\n * Defines an override for loading shader strings\r\n * Return true to stop further extensions from loading this shader data\r\n */\r\n GLTFLoaderExtension.prototype.loadShaderStringAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n return false;\r\n };\r\n /**\r\n * Defines an override for loading materials\r\n * Return true to stop further extensions from loading this material\r\n */\r\n GLTFLoaderExtension.prototype.loadMaterialAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n return false;\r\n };\r\n // ---------\r\n // Utilities\r\n // ---------\r\n GLTFLoaderExtension.LoadRuntimeAsync = function (scene, data, rootUrl, onSuccess, onError) {\r\n GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {\r\n return loaderExtension.loadRuntimeAsync(scene, data, rootUrl, onSuccess, onError);\r\n }, function () {\r\n setTimeout(function () {\r\n if (!onSuccess) {\r\n return;\r\n }\r\n onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));\r\n });\r\n });\r\n };\r\n GLTFLoaderExtension.LoadRuntimeExtensionsAsync = function (gltfRuntime, onSuccess, onError) {\r\n GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {\r\n return loaderExtension.loadRuntimeExtensionsAsync(gltfRuntime, onSuccess, onError);\r\n }, function () {\r\n setTimeout(function () {\r\n onSuccess();\r\n });\r\n });\r\n };\r\n GLTFLoaderExtension.LoadBufferAsync = function (gltfRuntime, id, onSuccess, onError, onProgress) {\r\n GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {\r\n return loaderExtension.loadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress);\r\n }, function () {\r\n GLTFLoaderBase.LoadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress);\r\n });\r\n };\r\n GLTFLoaderExtension.LoadTextureAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n GLTFLoaderExtension.LoadTextureBufferAsync(gltfRuntime, id, function (buffer) {\r\n if (buffer) {\r\n GLTFLoaderExtension.CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);\r\n }\r\n }, onError);\r\n };\r\n GLTFLoaderExtension.LoadShaderStringAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {\r\n return loaderExtension.loadShaderStringAsync(gltfRuntime, id, onSuccess, onError);\r\n }, function () {\r\n GLTFLoaderBase.LoadShaderStringAsync(gltfRuntime, id, onSuccess, onError);\r\n });\r\n };\r\n GLTFLoaderExtension.LoadMaterialAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {\r\n return loaderExtension.loadMaterialAsync(gltfRuntime, id, onSuccess, onError);\r\n }, function () {\r\n GLTFLoaderBase.LoadMaterialAsync(gltfRuntime, id, onSuccess, onError);\r\n });\r\n };\r\n GLTFLoaderExtension.LoadTextureBufferAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {\r\n return loaderExtension.loadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);\r\n }, function () {\r\n GLTFLoaderBase.LoadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);\r\n });\r\n };\r\n GLTFLoaderExtension.CreateTextureAsync = function (gltfRuntime, id, buffer, onSuccess, onError) {\r\n GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {\r\n return loaderExtension.createTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);\r\n }, function () {\r\n GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);\r\n });\r\n };\r\n GLTFLoaderExtension.ApplyExtensions = function (func, defaultFunc) {\r\n for (var extensionName in GLTFLoader.Extensions) {\r\n var loaderExtension = GLTFLoader.Extensions[extensionName];\r\n if (func(loaderExtension)) {\r\n return;\r\n }\r\n }\r\n defaultFunc();\r\n };\r\n return GLTFLoaderExtension;\r\n}());\r\nexport { GLTFLoaderExtension };\r\nGLTFFileLoader._CreateGLTF1Loader = function () { return new GLTFLoader(); };\r\n//# sourceMappingURL=glTFLoader.js.map","import { EParameterType, ETextureWrapMode, ETextureFilterType, EComponentType } from \"./glTFLoaderInterfaces\";\r\nimport { Vector2, Vector3, Vector4, Matrix } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Color4 } from '@babylonjs/core/Maths/math.color';\r\nimport { Effect } from \"@babylonjs/core/Materials/effect\";\r\nimport { ShaderMaterial } from \"@babylonjs/core/Materials/shaderMaterial\";\r\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\r\n/**\r\n* Utils functions for GLTF\r\n* @hidden\r\n*/\r\nvar GLTFUtils = /** @class */ (function () {\r\n function GLTFUtils() {\r\n }\r\n /**\r\n * Sets the given \"parameter\" matrix\r\n * @param scene: the Scene object\r\n * @param source: the source node where to pick the matrix\r\n * @param parameter: the GLTF technique parameter\r\n * @param uniformName: the name of the shader's uniform\r\n * @param shaderMaterial: the shader material\r\n */\r\n GLTFUtils.SetMatrix = function (scene, source, parameter, uniformName, shaderMaterial) {\r\n var mat = null;\r\n if (parameter.semantic === \"MODEL\") {\r\n mat = source.getWorldMatrix();\r\n }\r\n else if (parameter.semantic === \"PROJECTION\") {\r\n mat = scene.getProjectionMatrix();\r\n }\r\n else if (parameter.semantic === \"VIEW\") {\r\n mat = scene.getViewMatrix();\r\n }\r\n else if (parameter.semantic === \"MODELVIEWINVERSETRANSPOSE\") {\r\n mat = Matrix.Transpose(source.getWorldMatrix().multiply(scene.getViewMatrix()).invert());\r\n }\r\n else if (parameter.semantic === \"MODELVIEW\") {\r\n mat = source.getWorldMatrix().multiply(scene.getViewMatrix());\r\n }\r\n else if (parameter.semantic === \"MODELVIEWPROJECTION\") {\r\n mat = source.getWorldMatrix().multiply(scene.getTransformMatrix());\r\n }\r\n else if (parameter.semantic === \"MODELINVERSE\") {\r\n mat = source.getWorldMatrix().invert();\r\n }\r\n else if (parameter.semantic === \"VIEWINVERSE\") {\r\n mat = scene.getViewMatrix().invert();\r\n }\r\n else if (parameter.semantic === \"PROJECTIONINVERSE\") {\r\n mat = scene.getProjectionMatrix().invert();\r\n }\r\n else if (parameter.semantic === \"MODELVIEWINVERSE\") {\r\n mat = source.getWorldMatrix().multiply(scene.getViewMatrix()).invert();\r\n }\r\n else if (parameter.semantic === \"MODELVIEWPROJECTIONINVERSE\") {\r\n mat = source.getWorldMatrix().multiply(scene.getTransformMatrix()).invert();\r\n }\r\n else if (parameter.semantic === \"MODELINVERSETRANSPOSE\") {\r\n mat = Matrix.Transpose(source.getWorldMatrix().invert());\r\n }\r\n else {\r\n debugger;\r\n }\r\n if (mat) {\r\n switch (parameter.type) {\r\n case EParameterType.FLOAT_MAT2:\r\n shaderMaterial.setMatrix2x2(uniformName, Matrix.GetAsMatrix2x2(mat));\r\n break;\r\n case EParameterType.FLOAT_MAT3:\r\n shaderMaterial.setMatrix3x3(uniformName, Matrix.GetAsMatrix3x3(mat));\r\n break;\r\n case EParameterType.FLOAT_MAT4:\r\n shaderMaterial.setMatrix(uniformName, mat);\r\n break;\r\n default: break;\r\n }\r\n }\r\n };\r\n /**\r\n * Sets the given \"parameter\" matrix\r\n * @param shaderMaterial: the shader material\r\n * @param uniform: the name of the shader's uniform\r\n * @param value: the value of the uniform\r\n * @param type: the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)\r\n */\r\n GLTFUtils.SetUniform = function (shaderMaterial, uniform, value, type) {\r\n switch (type) {\r\n case EParameterType.FLOAT:\r\n shaderMaterial.setFloat(uniform, value);\r\n return true;\r\n case EParameterType.FLOAT_VEC2:\r\n shaderMaterial.setVector2(uniform, Vector2.FromArray(value));\r\n return true;\r\n case EParameterType.FLOAT_VEC3:\r\n shaderMaterial.setVector3(uniform, Vector3.FromArray(value));\r\n return true;\r\n case EParameterType.FLOAT_VEC4:\r\n shaderMaterial.setVector4(uniform, Vector4.FromArray(value));\r\n return true;\r\n default: return false;\r\n }\r\n };\r\n /**\r\n * Returns the wrap mode of the texture\r\n * @param mode: the mode value\r\n */\r\n GLTFUtils.GetWrapMode = function (mode) {\r\n switch (mode) {\r\n case ETextureWrapMode.CLAMP_TO_EDGE: return Texture.CLAMP_ADDRESSMODE;\r\n case ETextureWrapMode.MIRRORED_REPEAT: return Texture.MIRROR_ADDRESSMODE;\r\n case ETextureWrapMode.REPEAT: return Texture.WRAP_ADDRESSMODE;\r\n default: return Texture.WRAP_ADDRESSMODE;\r\n }\r\n };\r\n /**\r\n * Returns the byte stride giving an accessor\r\n * @param accessor: the GLTF accessor objet\r\n */\r\n GLTFUtils.GetByteStrideFromType = function (accessor) {\r\n // Needs this function since \"byteStride\" isn't requiered in glTF format\r\n var type = accessor.type;\r\n switch (type) {\r\n case \"VEC2\": return 2;\r\n case \"VEC3\": return 3;\r\n case \"VEC4\": return 4;\r\n case \"MAT2\": return 4;\r\n case \"MAT3\": return 9;\r\n case \"MAT4\": return 16;\r\n default: return 1;\r\n }\r\n };\r\n /**\r\n * Returns the texture filter mode giving a mode value\r\n * @param mode: the filter mode value\r\n */\r\n GLTFUtils.GetTextureFilterMode = function (mode) {\r\n switch (mode) {\r\n case ETextureFilterType.LINEAR:\r\n case ETextureFilterType.LINEAR_MIPMAP_NEAREST:\r\n case ETextureFilterType.LINEAR_MIPMAP_LINEAR: return Texture.TRILINEAR_SAMPLINGMODE;\r\n case ETextureFilterType.NEAREST:\r\n case ETextureFilterType.NEAREST_MIPMAP_NEAREST: return Texture.NEAREST_SAMPLINGMODE;\r\n default: return Texture.BILINEAR_SAMPLINGMODE;\r\n }\r\n };\r\n GLTFUtils.GetBufferFromBufferView = function (gltfRuntime, bufferView, byteOffset, byteLength, componentType) {\r\n var byteOffset = bufferView.byteOffset + byteOffset;\r\n var loadedBufferView = gltfRuntime.loadedBufferViews[bufferView.buffer];\r\n if (byteOffset + byteLength > loadedBufferView.byteLength) {\r\n throw new Error(\"Buffer access is out of range\");\r\n }\r\n var buffer = loadedBufferView.buffer;\r\n byteOffset += loadedBufferView.byteOffset;\r\n switch (componentType) {\r\n case EComponentType.BYTE: return new Int8Array(buffer, byteOffset, byteLength);\r\n case EComponentType.UNSIGNED_BYTE: return new Uint8Array(buffer, byteOffset, byteLength);\r\n case EComponentType.SHORT: return new Int16Array(buffer, byteOffset, byteLength);\r\n case EComponentType.UNSIGNED_SHORT: return new Uint16Array(buffer, byteOffset, byteLength);\r\n default: return new Float32Array(buffer, byteOffset, byteLength);\r\n }\r\n };\r\n /**\r\n * Returns a buffer from its accessor\r\n * @param gltfRuntime: the GLTF runtime\r\n * @param accessor: the GLTF accessor\r\n */\r\n GLTFUtils.GetBufferFromAccessor = function (gltfRuntime, accessor) {\r\n var bufferView = gltfRuntime.bufferViews[accessor.bufferView];\r\n var byteLength = accessor.count * GLTFUtils.GetByteStrideFromType(accessor);\r\n return GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, accessor.byteOffset, byteLength, accessor.componentType);\r\n };\r\n /**\r\n * Decodes a buffer view into a string\r\n * @param view: the buffer view\r\n */\r\n GLTFUtils.DecodeBufferToText = function (view) {\r\n var result = \"\";\r\n var length = view.byteLength;\r\n for (var i = 0; i < length; ++i) {\r\n result += String.fromCharCode(view[i]);\r\n }\r\n return result;\r\n };\r\n /**\r\n * Returns the default material of gltf. Related to\r\n * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material\r\n * @param scene: the Babylon.js scene\r\n */\r\n GLTFUtils.GetDefaultMaterial = function (scene) {\r\n if (!GLTFUtils._DefaultMaterial) {\r\n Effect.ShadersStore[\"GLTFDefaultMaterialVertexShader\"] = [\r\n \"precision highp float;\",\r\n \"\",\r\n \"uniform mat4 worldView;\",\r\n \"uniform mat4 projection;\",\r\n \"\",\r\n \"attribute vec3 position;\",\r\n \"\",\r\n \"void main(void)\",\r\n \"{\",\r\n \" gl_Position = projection * worldView * vec4(position, 1.0);\",\r\n \"}\"\r\n ].join(\"\\n\");\r\n Effect.ShadersStore[\"GLTFDefaultMaterialPixelShader\"] = [\r\n \"precision highp float;\",\r\n \"\",\r\n \"uniform vec4 u_emission;\",\r\n \"\",\r\n \"void main(void)\",\r\n \"{\",\r\n \" gl_FragColor = u_emission;\",\r\n \"}\"\r\n ].join(\"\\n\");\r\n var shaderPath = {\r\n vertex: \"GLTFDefaultMaterial\",\r\n fragment: \"GLTFDefaultMaterial\"\r\n };\r\n var options = {\r\n attributes: [\"position\"],\r\n uniforms: [\"worldView\", \"projection\", \"u_emission\"],\r\n samplers: new Array(),\r\n needAlphaBlending: false\r\n };\r\n GLTFUtils._DefaultMaterial = new ShaderMaterial(\"GLTFDefaultMaterial\", scene, shaderPath, options);\r\n GLTFUtils._DefaultMaterial.setColor4(\"u_emission\", new Color4(0.5, 0.5, 0.5, 1.0));\r\n }\r\n return GLTFUtils._DefaultMaterial;\r\n };\r\n // The GLTF default material\r\n GLTFUtils._DefaultMaterial = null;\r\n return GLTFUtils;\r\n}());\r\nexport { GLTFUtils };\r\n//# sourceMappingURL=glTFLoaderUtils.js.map","import { __extends } from \"tslib\";\r\nimport { GLTFLoaderExtension } from \"./glTFLoader\";\r\nimport { GLTFUtils } from \"./glTFLoaderUtils\";\r\nimport { EComponentType } from \"./glTFLoaderInterfaces\";\r\nimport { GLTFLoader, GLTFLoaderBase } from \"./glTFLoader\";\r\nvar BinaryExtensionBufferName = \"binary_glTF\";\r\n/** @hidden */\r\nvar GLTFBinaryExtension = /** @class */ (function (_super) {\r\n __extends(GLTFBinaryExtension, _super);\r\n function GLTFBinaryExtension() {\r\n return _super.call(this, \"KHR_binary_glTF\") || this;\r\n }\r\n GLTFBinaryExtension.prototype.loadRuntimeAsync = function (scene, data, rootUrl, onSuccess, onError) {\r\n var extensionsUsed = data.json.extensionsUsed;\r\n if (!extensionsUsed || extensionsUsed.indexOf(this.name) === -1 || !data.bin) {\r\n return false;\r\n }\r\n this._bin = data.bin;\r\n onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));\r\n return true;\r\n };\r\n GLTFBinaryExtension.prototype.loadBufferAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n if (gltfRuntime.extensionsUsed.indexOf(this.name) === -1) {\r\n return false;\r\n }\r\n if (id !== BinaryExtensionBufferName) {\r\n return false;\r\n }\r\n this._bin.readAsync(0, this._bin.byteLength).then(onSuccess, function (error) { return onError(error.message); });\r\n return true;\r\n };\r\n GLTFBinaryExtension.prototype.loadTextureBufferAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n var texture = gltfRuntime.textures[id];\r\n var source = gltfRuntime.images[texture.source];\r\n if (!source.extensions || !(this.name in source.extensions)) {\r\n return false;\r\n }\r\n var sourceExt = source.extensions[this.name];\r\n var bufferView = gltfRuntime.bufferViews[sourceExt.bufferView];\r\n var buffer = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);\r\n onSuccess(buffer);\r\n return true;\r\n };\r\n GLTFBinaryExtension.prototype.loadShaderStringAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n var shader = gltfRuntime.shaders[id];\r\n if (!shader.extensions || !(this.name in shader.extensions)) {\r\n return false;\r\n }\r\n var binaryExtensionShader = shader.extensions[this.name];\r\n var bufferView = gltfRuntime.bufferViews[binaryExtensionShader.bufferView];\r\n var shaderBytes = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);\r\n setTimeout(function () {\r\n var shaderString = GLTFUtils.DecodeBufferToText(shaderBytes);\r\n onSuccess(shaderString);\r\n });\r\n return true;\r\n };\r\n return GLTFBinaryExtension;\r\n}(GLTFLoaderExtension));\r\nexport { GLTFBinaryExtension };\r\nGLTFLoader.RegisterExtension(new GLTFBinaryExtension());\r\n//# sourceMappingURL=glTFBinaryExtension.js.map","import { __extends } from \"tslib\";\r\nimport { GLTFLoaderExtension } from \"./glTFLoader\";\r\nimport { GLTFLoaderBase } from \"./glTFLoader\";\r\nimport { Vector3 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Material } from \"@babylonjs/core/Materials/material\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { HemisphericLight } from \"@babylonjs/core/Lights/hemisphericLight\";\r\nimport { DirectionalLight } from \"@babylonjs/core/Lights/directionalLight\";\r\nimport { PointLight } from \"@babylonjs/core/Lights/pointLight\";\r\nimport { SpotLight } from \"@babylonjs/core/Lights/spotLight\";\r\nimport { GLTFLoader } from \"./glTFLoader\";\r\n/** @hidden */\r\nvar GLTFMaterialsCommonExtension = /** @class */ (function (_super) {\r\n __extends(GLTFMaterialsCommonExtension, _super);\r\n function GLTFMaterialsCommonExtension() {\r\n return _super.call(this, \"KHR_materials_common\") || this;\r\n }\r\n GLTFMaterialsCommonExtension.prototype.loadRuntimeExtensionsAsync = function (gltfRuntime, onSuccess, onError) {\r\n if (!gltfRuntime.extensions) {\r\n return false;\r\n }\r\n var extension = gltfRuntime.extensions[this.name];\r\n if (!extension) {\r\n return false;\r\n }\r\n // Create lights\r\n var lights = extension.lights;\r\n if (lights) {\r\n for (var thing in lights) {\r\n var light = lights[thing];\r\n switch (light.type) {\r\n case \"ambient\":\r\n var ambientLight = new HemisphericLight(light.name, new Vector3(0, 1, 0), gltfRuntime.scene);\r\n var ambient = light.ambient;\r\n if (ambient) {\r\n ambientLight.diffuse = Color3.FromArray(ambient.color || [1, 1, 1]);\r\n }\r\n break;\r\n case \"point\":\r\n var pointLight = new PointLight(light.name, new Vector3(10, 10, 10), gltfRuntime.scene);\r\n var point = light.point;\r\n if (point) {\r\n pointLight.diffuse = Color3.FromArray(point.color || [1, 1, 1]);\r\n }\r\n break;\r\n case \"directional\":\r\n var dirLight = new DirectionalLight(light.name, new Vector3(0, -1, 0), gltfRuntime.scene);\r\n var directional = light.directional;\r\n if (directional) {\r\n dirLight.diffuse = Color3.FromArray(directional.color || [1, 1, 1]);\r\n }\r\n break;\r\n case \"spot\":\r\n var spot = light.spot;\r\n if (spot) {\r\n var spotLight = new SpotLight(light.name, new Vector3(0, 10, 0), new Vector3(0, -1, 0), spot.fallOffAngle || Math.PI, spot.fallOffExponent || 0.0, gltfRuntime.scene);\r\n spotLight.diffuse = Color3.FromArray(spot.color || [1, 1, 1]);\r\n }\r\n break;\r\n default:\r\n Tools.Warn(\"GLTF Material Common extension: light type \\\"\" + light.type + \"\\” not supported\");\r\n break;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n GLTFMaterialsCommonExtension.prototype.loadMaterialAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n var material = gltfRuntime.materials[id];\r\n if (!material || !material.extensions) {\r\n return false;\r\n }\r\n var extension = material.extensions[this.name];\r\n if (!extension) {\r\n return false;\r\n }\r\n var standardMaterial = new StandardMaterial(id, gltfRuntime.scene);\r\n standardMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n if (extension.technique === \"CONSTANT\") {\r\n standardMaterial.disableLighting = true;\r\n }\r\n standardMaterial.backFaceCulling = extension.doubleSided === undefined ? false : !extension.doubleSided;\r\n standardMaterial.alpha = extension.values.transparency === undefined ? 1.0 : extension.values.transparency;\r\n standardMaterial.specularPower = extension.values.shininess === undefined ? 0.0 : extension.values.shininess;\r\n // Ambient\r\n if (typeof extension.values.ambient === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.ambient, standardMaterial, \"ambientTexture\", onError);\r\n }\r\n else {\r\n standardMaterial.ambientColor = Color3.FromArray(extension.values.ambient || [0, 0, 0]);\r\n }\r\n // Diffuse\r\n if (typeof extension.values.diffuse === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.diffuse, standardMaterial, \"diffuseTexture\", onError);\r\n }\r\n else {\r\n standardMaterial.diffuseColor = Color3.FromArray(extension.values.diffuse || [0, 0, 0]);\r\n }\r\n // Emission\r\n if (typeof extension.values.emission === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.emission, standardMaterial, \"emissiveTexture\", onError);\r\n }\r\n else {\r\n standardMaterial.emissiveColor = Color3.FromArray(extension.values.emission || [0, 0, 0]);\r\n }\r\n // Specular\r\n if (typeof extension.values.specular === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.specular, standardMaterial, \"specularTexture\", onError);\r\n }\r\n else {\r\n standardMaterial.specularColor = Color3.FromArray(extension.values.specular || [0, 0, 0]);\r\n }\r\n return true;\r\n };\r\n GLTFMaterialsCommonExtension.prototype._loadTexture = function (gltfRuntime, id, material, propertyPath, onError) {\r\n // Create buffer from texture url\r\n GLTFLoaderBase.LoadTextureBufferAsync(gltfRuntime, id, function (buffer) {\r\n // Create texture from buffer\r\n GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, function (texture) { return material[propertyPath] = texture; }, onError);\r\n }, onError);\r\n };\r\n return GLTFMaterialsCommonExtension;\r\n}(GLTFLoaderExtension));\r\nexport { GLTFMaterialsCommonExtension };\r\nGLTFLoader.RegisterExtension(new GLTFMaterialsCommonExtension());\r\n//# sourceMappingURL=glTFMaterialsCommonExtension.js.map","/**\r\n * Wrapper class for promise with external resolve and reject.\r\n */\r\nvar Deferred = /** @class */ (function () {\r\n /**\r\n * Constructor for this deferred object.\r\n */\r\n function Deferred() {\r\n var _this = this;\r\n this.promise = new Promise(function (resolve, reject) {\r\n _this._resolve = resolve;\r\n _this._reject = reject;\r\n });\r\n }\r\n Object.defineProperty(Deferred.prototype, \"resolve\", {\r\n /**\r\n * The resolve method of the promise associated with this deferred object.\r\n */\r\n get: function () {\r\n return this._resolve;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Deferred.prototype, \"reject\", {\r\n /**\r\n * The reject method of the promise associated with this deferred object.\r\n */\r\n get: function () {\r\n return this._reject;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return Deferred;\r\n}());\r\nexport { Deferred };\r\n//# sourceMappingURL=deferred.js.map","import { Quaternion, Vector3, Vector2, Matrix } from \"../Maths/math.vector\";\r\nimport { Color3 } from '../Maths/math.color';\r\nimport { Animation } from \"./animation\";\r\nimport { Size } from '../Maths/math.size';\r\n// Static values to help the garbage collector\r\n// Quaternion\r\nvar _staticOffsetValueQuaternion = Object.freeze(new Quaternion(0, 0, 0, 0));\r\n// Vector3\r\nvar _staticOffsetValueVector3 = Object.freeze(Vector3.Zero());\r\n// Vector2\r\nvar _staticOffsetValueVector2 = Object.freeze(Vector2.Zero());\r\n// Size\r\nvar _staticOffsetValueSize = Object.freeze(Size.Zero());\r\n// Color3\r\nvar _staticOffsetValueColor3 = Object.freeze(Color3.Black());\r\n/**\r\n * Defines a runtime animation\r\n */\r\nvar RuntimeAnimation = /** @class */ (function () {\r\n /**\r\n * Create a new RuntimeAnimation object\r\n * @param target defines the target of the animation\r\n * @param animation defines the source animation object\r\n * @param scene defines the hosting scene\r\n * @param host defines the initiating Animatable\r\n */\r\n function RuntimeAnimation(target, animation, scene, host) {\r\n var _this = this;\r\n this._events = new Array();\r\n /**\r\n * The current frame of the runtime animation\r\n */\r\n this._currentFrame = 0;\r\n /**\r\n * The original value of the runtime animation\r\n */\r\n this._originalValue = new Array();\r\n /**\r\n * The original blend value of the runtime animation\r\n */\r\n this._originalBlendValue = null;\r\n /**\r\n * The offsets cache of the runtime animation\r\n */\r\n this._offsetsCache = {};\r\n /**\r\n * The high limits cache of the runtime animation\r\n */\r\n this._highLimitsCache = {};\r\n /**\r\n * Specifies if the runtime animation has been stopped\r\n */\r\n this._stopped = false;\r\n /**\r\n * The blending factor of the runtime animation\r\n */\r\n this._blendingFactor = 0;\r\n /**\r\n * The current value of the runtime animation\r\n */\r\n this._currentValue = null;\r\n this._currentActiveTarget = null;\r\n this._directTarget = null;\r\n /**\r\n * The target path of the runtime animation\r\n */\r\n this._targetPath = \"\";\r\n /**\r\n * The weight of the runtime animation\r\n */\r\n this._weight = 1.0;\r\n /**\r\n * The ratio offset of the runtime animation\r\n */\r\n this._ratioOffset = 0;\r\n /**\r\n * The previous delay of the runtime animation\r\n */\r\n this._previousDelay = 0;\r\n /**\r\n * The previous ratio of the runtime animation\r\n */\r\n this._previousRatio = 0;\r\n this._targetIsArray = false;\r\n this._animation = animation;\r\n this._target = target;\r\n this._scene = scene;\r\n this._host = host;\r\n this._activeTargets = [];\r\n animation._runtimeAnimations.push(this);\r\n // State\r\n this._animationState = {\r\n key: 0,\r\n repeatCount: 0,\r\n loopMode: this._getCorrectLoopMode()\r\n };\r\n if (this._animation.dataType === Animation.ANIMATIONTYPE_MATRIX) {\r\n this._animationState.workValue = Matrix.Zero();\r\n }\r\n // Limits\r\n this._keys = this._animation.getKeys();\r\n this._minFrame = this._keys[0].frame;\r\n this._maxFrame = this._keys[this._keys.length - 1].frame;\r\n this._minValue = this._keys[0].value;\r\n this._maxValue = this._keys[this._keys.length - 1].value;\r\n // Add a start key at frame 0 if missing\r\n if (this._minFrame !== 0) {\r\n var newKey = { frame: 0, value: this._minValue };\r\n this._keys.splice(0, 0, newKey);\r\n }\r\n // Check data\r\n if (this._target instanceof Array) {\r\n var index = 0;\r\n for (var _i = 0, _a = this._target; _i < _a.length; _i++) {\r\n var target_1 = _a[_i];\r\n this._preparePath(target_1, index);\r\n this._getOriginalValues(index);\r\n index++;\r\n }\r\n this._targetIsArray = true;\r\n }\r\n else {\r\n this._preparePath(this._target);\r\n this._getOriginalValues();\r\n this._targetIsArray = false;\r\n this._directTarget = this._activeTargets[0];\r\n }\r\n // Cloning events locally\r\n var events = animation.getEvents();\r\n if (events && events.length > 0) {\r\n events.forEach(function (e) {\r\n _this._events.push(e._clone());\r\n });\r\n }\r\n this._enableBlending = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;\r\n }\r\n Object.defineProperty(RuntimeAnimation.prototype, \"currentFrame\", {\r\n /**\r\n * Gets the current frame of the runtime animation\r\n */\r\n get: function () {\r\n return this._currentFrame;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"weight\", {\r\n /**\r\n * Gets the weight of the runtime animation\r\n */\r\n get: function () {\r\n return this._weight;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"currentValue\", {\r\n /**\r\n * Gets the current value of the runtime animation\r\n */\r\n get: function () {\r\n return this._currentValue;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"targetPath\", {\r\n /**\r\n * Gets the target path of the runtime animation\r\n */\r\n get: function () {\r\n return this._targetPath;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"target\", {\r\n /**\r\n * Gets the actual target of the runtime animation\r\n */\r\n get: function () {\r\n return this._currentActiveTarget;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"isAdditive\", {\r\n /**\r\n * Gets the additive state of the runtime animation\r\n */\r\n get: function () {\r\n return this._host && this._host.isAdditive;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n RuntimeAnimation.prototype._preparePath = function (target, targetIndex) {\r\n if (targetIndex === void 0) { targetIndex = 0; }\r\n var targetPropertyPath = this._animation.targetPropertyPath;\r\n if (targetPropertyPath.length > 1) {\r\n var property = target[targetPropertyPath[0]];\r\n for (var index = 1; index < targetPropertyPath.length - 1; index++) {\r\n property = property[targetPropertyPath[index]];\r\n }\r\n this._targetPath = targetPropertyPath[targetPropertyPath.length - 1];\r\n this._activeTargets[targetIndex] = property;\r\n }\r\n else {\r\n this._targetPath = targetPropertyPath[0];\r\n this._activeTargets[targetIndex] = target;\r\n }\r\n };\r\n Object.defineProperty(RuntimeAnimation.prototype, \"animation\", {\r\n /**\r\n * Gets the animation from the runtime animation\r\n */\r\n get: function () {\r\n return this._animation;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Resets the runtime animation to the beginning\r\n * @param restoreOriginal defines whether to restore the target property to the original value\r\n */\r\n RuntimeAnimation.prototype.reset = function (restoreOriginal) {\r\n if (restoreOriginal === void 0) { restoreOriginal = false; }\r\n if (restoreOriginal) {\r\n if (this._target instanceof Array) {\r\n var index = 0;\r\n for (var _i = 0, _a = this._target; _i < _a.length; _i++) {\r\n var target = _a[_i];\r\n if (this._originalValue[index] !== undefined) {\r\n this._setValue(target, this._activeTargets[index], this._originalValue[index], -1, index);\r\n }\r\n index++;\r\n }\r\n }\r\n else {\r\n if (this._originalValue[0] !== undefined) {\r\n this._setValue(this._target, this._directTarget, this._originalValue[0], -1, 0);\r\n }\r\n }\r\n }\r\n this._offsetsCache = {};\r\n this._highLimitsCache = {};\r\n this._currentFrame = 0;\r\n this._blendingFactor = 0;\r\n // Events\r\n for (var index = 0; index < this._events.length; index++) {\r\n this._events[index].isDone = false;\r\n }\r\n };\r\n /**\r\n * Specifies if the runtime animation is stopped\r\n * @returns Boolean specifying if the runtime animation is stopped\r\n */\r\n RuntimeAnimation.prototype.isStopped = function () {\r\n return this._stopped;\r\n };\r\n /**\r\n * Disposes of the runtime animation\r\n */\r\n RuntimeAnimation.prototype.dispose = function () {\r\n var index = this._animation.runtimeAnimations.indexOf(this);\r\n if (index > -1) {\r\n this._animation.runtimeAnimations.splice(index, 1);\r\n }\r\n };\r\n /**\r\n * Apply the interpolated value to the target\r\n * @param currentValue defines the value computed by the animation\r\n * @param weight defines the weight to apply to this value (Defaults to 1.0)\r\n */\r\n RuntimeAnimation.prototype.setValue = function (currentValue, weight) {\r\n if (this._targetIsArray) {\r\n for (var index = 0; index < this._target.length; index++) {\r\n var target = this._target[index];\r\n this._setValue(target, this._activeTargets[index], currentValue, weight, index);\r\n }\r\n return;\r\n }\r\n this._setValue(this._target, this._directTarget, currentValue, weight, 0);\r\n };\r\n RuntimeAnimation.prototype._getOriginalValues = function (targetIndex) {\r\n if (targetIndex === void 0) { targetIndex = 0; }\r\n var originalValue;\r\n var target = this._activeTargets[targetIndex];\r\n if (target.getRestPose && this._targetPath === \"_matrix\") { // For bones\r\n originalValue = target.getRestPose();\r\n }\r\n else {\r\n originalValue = target[this._targetPath];\r\n }\r\n if (originalValue && originalValue.clone) {\r\n this._originalValue[targetIndex] = originalValue.clone();\r\n }\r\n else {\r\n this._originalValue[targetIndex] = originalValue;\r\n }\r\n };\r\n RuntimeAnimation.prototype._setValue = function (target, destination, currentValue, weight, targetIndex) {\r\n // Set value\r\n this._currentActiveTarget = destination;\r\n this._weight = weight;\r\n if (this._enableBlending && this._blendingFactor <= 1.0) {\r\n if (!this._originalBlendValue) {\r\n var originalValue = destination[this._targetPath];\r\n if (originalValue.clone) {\r\n this._originalBlendValue = originalValue.clone();\r\n }\r\n else {\r\n this._originalBlendValue = originalValue;\r\n }\r\n }\r\n if (this._originalBlendValue.m) { // Matrix\r\n if (Animation.AllowMatrixDecomposeForInterpolation) {\r\n if (this._currentValue) {\r\n Matrix.DecomposeLerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);\r\n }\r\n else {\r\n this._currentValue = Matrix.DecomposeLerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n }\r\n else {\r\n if (this._currentValue) {\r\n Matrix.LerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);\r\n }\r\n else {\r\n this._currentValue = Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n }\r\n }\r\n else {\r\n this._currentValue = Animation._UniversalLerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n var blendingSpeed = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;\r\n this._blendingFactor += blendingSpeed;\r\n }\r\n else {\r\n this._currentValue = currentValue;\r\n }\r\n if (weight !== -1.0) {\r\n this._scene._registerTargetForLateAnimationBinding(this, this._originalValue[targetIndex]);\r\n }\r\n else {\r\n destination[this._targetPath] = this._currentValue;\r\n }\r\n if (target.markAsDirty) {\r\n target.markAsDirty(this._animation.targetProperty);\r\n }\r\n };\r\n /**\r\n * Gets the loop pmode of the runtime animation\r\n * @returns Loop Mode\r\n */\r\n RuntimeAnimation.prototype._getCorrectLoopMode = function () {\r\n if (this._target && this._target.animationPropertiesOverride) {\r\n return this._target.animationPropertiesOverride.loopMode;\r\n }\r\n return this._animation.loopMode;\r\n };\r\n /**\r\n * Move the current animation to a given frame\r\n * @param frame defines the frame to move to\r\n */\r\n RuntimeAnimation.prototype.goToFrame = function (frame) {\r\n var keys = this._animation.getKeys();\r\n if (frame < keys[0].frame) {\r\n frame = keys[0].frame;\r\n }\r\n else if (frame > keys[keys.length - 1].frame) {\r\n frame = keys[keys.length - 1].frame;\r\n }\r\n // Need to reset animation events\r\n var events = this._events;\r\n if (events.length) {\r\n for (var index = 0; index < events.length; index++) {\r\n if (!events[index].onlyOnce) {\r\n // reset events in the future\r\n events[index].isDone = events[index].frame < frame;\r\n }\r\n }\r\n }\r\n this._currentFrame = frame;\r\n var currentValue = this._animation._interpolate(frame, this._animationState);\r\n this.setValue(currentValue, -1);\r\n };\r\n /**\r\n * @hidden Internal use only\r\n */\r\n RuntimeAnimation.prototype._prepareForSpeedRatioChange = function (newSpeedRatio) {\r\n var newRatio = this._previousDelay * (this._animation.framePerSecond * newSpeedRatio) / 1000.0;\r\n this._ratioOffset = this._previousRatio - newRatio;\r\n };\r\n /**\r\n * Execute the current animation\r\n * @param delay defines the delay to add to the current frame\r\n * @param from defines the lower bound of the animation range\r\n * @param to defines the upper bound of the animation range\r\n * @param loop defines if the current animation must loop\r\n * @param speedRatio defines the current speed ratio\r\n * @param weight defines the weight of the animation (default is -1 so no weight)\r\n * @param onLoop optional callback called when animation loops\r\n * @returns a boolean indicating if the animation is running\r\n */\r\n RuntimeAnimation.prototype.animate = function (delay, from, to, loop, speedRatio, weight) {\r\n if (weight === void 0) { weight = -1.0; }\r\n var animation = this._animation;\r\n var targetPropertyPath = animation.targetPropertyPath;\r\n if (!targetPropertyPath || targetPropertyPath.length < 1) {\r\n this._stopped = true;\r\n return false;\r\n }\r\n var returnValue = true;\r\n // Check limits\r\n if (from < this._minFrame || from > this._maxFrame) {\r\n from = this._minFrame;\r\n }\r\n if (to < this._minFrame || to > this._maxFrame) {\r\n to = this._maxFrame;\r\n }\r\n var range = to - from;\r\n var offsetValue;\r\n // Compute ratio which represents the frame delta between from and to\r\n var ratio = (delay * (animation.framePerSecond * speedRatio) / 1000.0) + this._ratioOffset;\r\n var highLimitValue = 0;\r\n this._previousDelay = delay;\r\n this._previousRatio = ratio;\r\n if (!loop && (to >= from && ratio >= range)) { // If we are out of range and not looping get back to caller\r\n returnValue = false;\r\n highLimitValue = animation._getKeyValue(this._maxValue);\r\n }\r\n else if (!loop && (from >= to && ratio <= range)) {\r\n returnValue = false;\r\n highLimitValue = animation._getKeyValue(this._minValue);\r\n }\r\n else if (this._animationState.loopMode !== Animation.ANIMATIONLOOPMODE_CYCLE) {\r\n var keyOffset = to.toString() + from.toString();\r\n if (!this._offsetsCache[keyOffset]) {\r\n this._animationState.repeatCount = 0;\r\n this._animationState.loopMode = Animation.ANIMATIONLOOPMODE_CYCLE;\r\n var fromValue = animation._interpolate(from, this._animationState);\r\n var toValue = animation._interpolate(to, this._animationState);\r\n this._animationState.loopMode = this._getCorrectLoopMode();\r\n switch (animation.dataType) {\r\n // Float\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n this._offsetsCache[keyOffset] = toValue - fromValue;\r\n break;\r\n // Quaternion\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n break;\r\n // Vector3\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n // Vector2\r\n case Animation.ANIMATIONTYPE_VECTOR2:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n // Size\r\n case Animation.ANIMATIONTYPE_SIZE:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n // Color3\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n default:\r\n break;\r\n }\r\n this._highLimitsCache[keyOffset] = toValue;\r\n }\r\n highLimitValue = this._highLimitsCache[keyOffset];\r\n offsetValue = this._offsetsCache[keyOffset];\r\n }\r\n if (offsetValue === undefined) {\r\n switch (animation.dataType) {\r\n // Float\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n offsetValue = 0;\r\n break;\r\n // Quaternion\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n offsetValue = _staticOffsetValueQuaternion;\r\n break;\r\n // Vector3\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n offsetValue = _staticOffsetValueVector3;\r\n break;\r\n // Vector2\r\n case Animation.ANIMATIONTYPE_VECTOR2:\r\n offsetValue = _staticOffsetValueVector2;\r\n break;\r\n // Size\r\n case Animation.ANIMATIONTYPE_SIZE:\r\n offsetValue = _staticOffsetValueSize;\r\n break;\r\n // Color3\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n offsetValue = _staticOffsetValueColor3;\r\n }\r\n }\r\n // Compute value\r\n var currentFrame;\r\n if (this._host && this._host.syncRoot) {\r\n var syncRoot = this._host.syncRoot;\r\n var hostNormalizedFrame = (syncRoot.masterFrame - syncRoot.fromFrame) / (syncRoot.toFrame - syncRoot.fromFrame);\r\n currentFrame = from + (to - from) * hostNormalizedFrame;\r\n }\r\n else {\r\n currentFrame = (returnValue && range !== 0) ? from + ratio % range : to;\r\n }\r\n // Reset events if looping\r\n var events = this._events;\r\n if (range > 0 && this.currentFrame > currentFrame ||\r\n range < 0 && this.currentFrame < currentFrame) {\r\n this._onLoop();\r\n // Need to reset animation events\r\n if (events.length) {\r\n for (var index = 0; index < events.length; index++) {\r\n if (!events[index].onlyOnce) {\r\n // reset event, the animation is looping\r\n events[index].isDone = false;\r\n }\r\n }\r\n }\r\n }\r\n this._currentFrame = currentFrame;\r\n this._animationState.repeatCount = range === 0 ? 0 : (ratio / range) >> 0;\r\n this._animationState.highLimitValue = highLimitValue;\r\n this._animationState.offsetValue = offsetValue;\r\n var currentValue = animation._interpolate(currentFrame, this._animationState);\r\n // Set value\r\n this.setValue(currentValue, weight);\r\n // Check events\r\n if (events.length) {\r\n for (var index = 0; index < events.length; index++) {\r\n // Make sure current frame has passed event frame and that event frame is within the current range\r\n // Also, handle both forward and reverse animations\r\n if ((range > 0 && currentFrame >= events[index].frame && events[index].frame >= from) ||\r\n (range < 0 && currentFrame <= events[index].frame && events[index].frame <= from)) {\r\n var event = events[index];\r\n if (!event.isDone) {\r\n // If event should be done only once, remove it.\r\n if (event.onlyOnce) {\r\n events.splice(index, 1);\r\n index--;\r\n }\r\n event.isDone = true;\r\n event.action(currentFrame);\r\n } // Don't do anything if the event has already be done.\r\n }\r\n }\r\n }\r\n if (!returnValue) {\r\n this._stopped = true;\r\n }\r\n return returnValue;\r\n };\r\n return RuntimeAnimation;\r\n}());\r\nexport { RuntimeAnimation };\r\n//# sourceMappingURL=runtimeAnimation.js.map","import { Animation } from \"./animation\";\r\nimport { RuntimeAnimation } from \"./runtimeAnimation\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Scene } from \"../scene\";\r\nimport { Matrix, Quaternion, Vector3, TmpVectors } from '../Maths/math.vector';\r\nimport { PrecisionDate } from '../Misc/precisionDate';\r\nimport { Bone } from '../Bones/bone';\r\n/**\r\n * Class used to store an actual running animation\r\n */\r\nvar Animatable = /** @class */ (function () {\r\n /**\r\n * Creates a new Animatable\r\n * @param scene defines the hosting scene\r\n * @param target defines the target object\r\n * @param fromFrame defines the starting frame number (default is 0)\r\n * @param toFrame defines the ending frame number (default is 100)\r\n * @param loopAnimation defines if the animation must loop (default is false)\r\n * @param speedRatio defines the factor to apply to animation speed (default is 1)\r\n * @param onAnimationEnd defines a callback to call when animation ends if it is not looping\r\n * @param animations defines a group of animation to add to the new Animatable\r\n * @param onAnimationLoop defines a callback to call when animation loops\r\n * @param isAdditive defines whether the animation should be evaluated additively\r\n */\r\n function Animatable(scene, \r\n /** defines the target object */\r\n target, \r\n /** defines the starting frame number (default is 0) */\r\n fromFrame, \r\n /** defines the ending frame number (default is 100) */\r\n toFrame, \r\n /** defines if the animation must loop (default is false) */\r\n loopAnimation, speedRatio, \r\n /** defines a callback to call when animation ends if it is not looping */\r\n onAnimationEnd, animations, \r\n /** defines a callback to call when animation loops */\r\n onAnimationLoop, \r\n /** defines whether the animation should be evaluated additively */\r\n isAdditive) {\r\n if (fromFrame === void 0) { fromFrame = 0; }\r\n if (toFrame === void 0) { toFrame = 100; }\r\n if (loopAnimation === void 0) { loopAnimation = false; }\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n if (isAdditive === void 0) { isAdditive = false; }\r\n this.target = target;\r\n this.fromFrame = fromFrame;\r\n this.toFrame = toFrame;\r\n this.loopAnimation = loopAnimation;\r\n this.onAnimationEnd = onAnimationEnd;\r\n this.onAnimationLoop = onAnimationLoop;\r\n this.isAdditive = isAdditive;\r\n this._localDelayOffset = null;\r\n this._pausedDelay = null;\r\n this._runtimeAnimations = new Array();\r\n this._paused = false;\r\n this._speedRatio = 1;\r\n this._weight = -1.0;\r\n this._syncRoot = null;\r\n /**\r\n * Gets or sets a boolean indicating if the animatable must be disposed and removed at the end of the animation.\r\n * This will only apply for non looping animation (default is true)\r\n */\r\n this.disposeOnEnd = true;\r\n /**\r\n * Gets a boolean indicating if the animation has started\r\n */\r\n this.animationStarted = false;\r\n /**\r\n * Observer raised when the animation ends\r\n */\r\n this.onAnimationEndObservable = new Observable();\r\n /**\r\n * Observer raised when the animation loops\r\n */\r\n this.onAnimationLoopObservable = new Observable();\r\n this._scene = scene;\r\n if (animations) {\r\n this.appendAnimations(target, animations);\r\n }\r\n this._speedRatio = speedRatio;\r\n scene._activeAnimatables.push(this);\r\n }\r\n Object.defineProperty(Animatable.prototype, \"syncRoot\", {\r\n /**\r\n * Gets the root Animatable used to synchronize and normalize animations\r\n */\r\n get: function () {\r\n return this._syncRoot;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animatable.prototype, \"masterFrame\", {\r\n /**\r\n * Gets the current frame of the first RuntimeAnimation\r\n * Used to synchronize Animatables\r\n */\r\n get: function () {\r\n if (this._runtimeAnimations.length === 0) {\r\n return 0;\r\n }\r\n return this._runtimeAnimations[0].currentFrame;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animatable.prototype, \"weight\", {\r\n /**\r\n * Gets or sets the animatable weight (-1.0 by default meaning not weighted)\r\n */\r\n get: function () {\r\n return this._weight;\r\n },\r\n set: function (value) {\r\n if (value === -1) { // -1 is ok and means no weight\r\n this._weight = -1;\r\n return;\r\n }\r\n // Else weight must be in [0, 1] range\r\n this._weight = Math.min(Math.max(value, 0), 1.0);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animatable.prototype, \"speedRatio\", {\r\n /**\r\n * Gets or sets the speed ratio to apply to the animatable (1.0 by default)\r\n */\r\n get: function () {\r\n return this._speedRatio;\r\n },\r\n set: function (value) {\r\n for (var index = 0; index < this._runtimeAnimations.length; index++) {\r\n var animation = this._runtimeAnimations[index];\r\n animation._prepareForSpeedRatioChange(value);\r\n }\r\n this._speedRatio = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Synchronize and normalize current Animatable with a source Animatable\r\n * This is useful when using animation weights and when animations are not of the same length\r\n * @param root defines the root Animatable to synchronize with\r\n * @returns the current Animatable\r\n */\r\n Animatable.prototype.syncWith = function (root) {\r\n this._syncRoot = root;\r\n if (root) {\r\n // Make sure this animatable will animate after the root\r\n var index = this._scene._activeAnimatables.indexOf(this);\r\n if (index > -1) {\r\n this._scene._activeAnimatables.splice(index, 1);\r\n this._scene._activeAnimatables.push(this);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Gets the list of runtime animations\r\n * @returns an array of RuntimeAnimation\r\n */\r\n Animatable.prototype.getAnimations = function () {\r\n return this._runtimeAnimations;\r\n };\r\n /**\r\n * Adds more animations to the current animatable\r\n * @param target defines the target of the animations\r\n * @param animations defines the new animations to add\r\n */\r\n Animatable.prototype.appendAnimations = function (target, animations) {\r\n var _this = this;\r\n for (var index = 0; index < animations.length; index++) {\r\n var animation = animations[index];\r\n var newRuntimeAnimation = new RuntimeAnimation(target, animation, this._scene, this);\r\n newRuntimeAnimation._onLoop = function () {\r\n _this.onAnimationLoopObservable.notifyObservers(_this);\r\n if (_this.onAnimationLoop) {\r\n _this.onAnimationLoop();\r\n }\r\n };\r\n this._runtimeAnimations.push(newRuntimeAnimation);\r\n }\r\n };\r\n /**\r\n * Gets the source animation for a specific property\r\n * @param property defines the propertyu to look for\r\n * @returns null or the source animation for the given property\r\n */\r\n Animatable.prototype.getAnimationByTargetProperty = function (property) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n if (runtimeAnimations[index].animation.targetProperty === property) {\r\n return runtimeAnimations[index].animation;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets the runtime animation for a specific property\r\n * @param property defines the propertyu to look for\r\n * @returns null or the runtime animation for the given property\r\n */\r\n Animatable.prototype.getRuntimeAnimationByTargetProperty = function (property) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n if (runtimeAnimations[index].animation.targetProperty === property) {\r\n return runtimeAnimations[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Resets the animatable to its original state\r\n */\r\n Animatable.prototype.reset = function () {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].reset(true);\r\n }\r\n this._localDelayOffset = null;\r\n this._pausedDelay = null;\r\n };\r\n /**\r\n * Allows the animatable to blend with current running animations\r\n * @see https://doc.babylonjs.com/babylon101/animations#animation-blending\r\n * @param blendingSpeed defines the blending speed to use\r\n */\r\n Animatable.prototype.enableBlending = function (blendingSpeed) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].animation.enableBlending = true;\r\n runtimeAnimations[index].animation.blendingSpeed = blendingSpeed;\r\n }\r\n };\r\n /**\r\n * Disable animation blending\r\n * @see https://doc.babylonjs.com/babylon101/animations#animation-blending\r\n */\r\n Animatable.prototype.disableBlending = function () {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].animation.enableBlending = false;\r\n }\r\n };\r\n /**\r\n * Jump directly to a given frame\r\n * @param frame defines the frame to jump to\r\n */\r\n Animatable.prototype.goToFrame = function (frame) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n if (runtimeAnimations[0]) {\r\n var fps = runtimeAnimations[0].animation.framePerSecond;\r\n var currentFrame = runtimeAnimations[0].currentFrame;\r\n var delay = this.speedRatio === 0 ? 0 : ((frame - currentFrame) / fps * 1000) / this.speedRatio;\r\n if (this._localDelayOffset === null) {\r\n this._localDelayOffset = 0;\r\n }\r\n this._localDelayOffset -= delay;\r\n }\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].goToFrame(frame);\r\n }\r\n };\r\n /**\r\n * Pause the animation\r\n */\r\n Animatable.prototype.pause = function () {\r\n if (this._paused) {\r\n return;\r\n }\r\n this._paused = true;\r\n };\r\n /**\r\n * Restart the animation\r\n */\r\n Animatable.prototype.restart = function () {\r\n this._paused = false;\r\n };\r\n Animatable.prototype._raiseOnAnimationEnd = function () {\r\n if (this.onAnimationEnd) {\r\n this.onAnimationEnd();\r\n }\r\n this.onAnimationEndObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Stop and delete the current animation\r\n * @param animationName defines a string used to only stop some of the runtime animations instead of all\r\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n */\r\n Animatable.prototype.stop = function (animationName, targetMask) {\r\n if (animationName || targetMask) {\r\n var idx = this._scene._activeAnimatables.indexOf(this);\r\n if (idx > -1) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = runtimeAnimations.length - 1; index >= 0; index--) {\r\n var runtimeAnimation = runtimeAnimations[index];\r\n if (animationName && runtimeAnimation.animation.name != animationName) {\r\n continue;\r\n }\r\n if (targetMask && !targetMask(runtimeAnimation.target)) {\r\n continue;\r\n }\r\n runtimeAnimation.dispose();\r\n runtimeAnimations.splice(index, 1);\r\n }\r\n if (runtimeAnimations.length == 0) {\r\n this._scene._activeAnimatables.splice(idx, 1);\r\n this._raiseOnAnimationEnd();\r\n }\r\n }\r\n }\r\n else {\r\n var index = this._scene._activeAnimatables.indexOf(this);\r\n if (index > -1) {\r\n this._scene._activeAnimatables.splice(index, 1);\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].dispose();\r\n }\r\n this._raiseOnAnimationEnd();\r\n }\r\n }\r\n };\r\n /**\r\n * Wait asynchronously for the animation to end\r\n * @returns a promise which will be fullfilled when the animation ends\r\n */\r\n Animatable.prototype.waitAsync = function () {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this.onAnimationEndObservable.add(function () {\r\n resolve(_this);\r\n }, undefined, undefined, _this, true);\r\n });\r\n };\r\n /** @hidden */\r\n Animatable.prototype._animate = function (delay) {\r\n if (this._paused) {\r\n this.animationStarted = false;\r\n if (this._pausedDelay === null) {\r\n this._pausedDelay = delay;\r\n }\r\n return true;\r\n }\r\n if (this._localDelayOffset === null) {\r\n this._localDelayOffset = delay;\r\n this._pausedDelay = null;\r\n }\r\n else if (this._pausedDelay !== null) {\r\n this._localDelayOffset += delay - this._pausedDelay;\r\n this._pausedDelay = null;\r\n }\r\n if (this._weight === 0) { // We consider that an animation with a weight === 0 is \"actively\" paused\r\n return true;\r\n }\r\n // Animating\r\n var running = false;\r\n var runtimeAnimations = this._runtimeAnimations;\r\n var index;\r\n for (index = 0; index < runtimeAnimations.length; index++) {\r\n var animation = runtimeAnimations[index];\r\n var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio, this._weight);\r\n running = running || isRunning;\r\n }\r\n this.animationStarted = running;\r\n if (!running) {\r\n if (this.disposeOnEnd) {\r\n // Remove from active animatables\r\n index = this._scene._activeAnimatables.indexOf(this);\r\n this._scene._activeAnimatables.splice(index, 1);\r\n // Dispose all runtime animations\r\n for (index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].dispose();\r\n }\r\n }\r\n this._raiseOnAnimationEnd();\r\n if (this.disposeOnEnd) {\r\n this.onAnimationEnd = null;\r\n this.onAnimationLoop = null;\r\n this.onAnimationLoopObservable.clear();\r\n this.onAnimationEndObservable.clear();\r\n }\r\n }\r\n return running;\r\n };\r\n return Animatable;\r\n}());\r\nexport { Animatable };\r\nScene.prototype._animate = function () {\r\n if (!this.animationsEnabled) {\r\n return;\r\n }\r\n // Getting time\r\n var now = PrecisionDate.Now;\r\n if (!this._animationTimeLast) {\r\n if (this._pendingData.length > 0) {\r\n return;\r\n }\r\n this._animationTimeLast = now;\r\n }\r\n this.deltaTime = this.useConstantAnimationDeltaTime ? 16.0 : (now - this._animationTimeLast) * this.animationTimeScale;\r\n this._animationTimeLast = now;\r\n var animatables = this._activeAnimatables;\r\n if (animatables.length === 0) {\r\n return;\r\n }\r\n this._animationTime += this.deltaTime;\r\n var animationTime = this._animationTime;\r\n for (var index = 0; index < animatables.length; index++) {\r\n var animatable = animatables[index];\r\n if (!animatable._animate(animationTime) && animatable.disposeOnEnd) {\r\n index--; // Array was updated\r\n }\r\n }\r\n // Late animation bindings\r\n this._processLateAnimationBindings();\r\n};\r\nScene.prototype.beginWeightedAnimation = function (target, from, to, weight, loop, speedRatio, onAnimationEnd, animatable, targetMask, onAnimationLoop, isAdditive) {\r\n if (weight === void 0) { weight = 1.0; }\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n if (isAdditive === void 0) { isAdditive = false; }\r\n var returnedAnimatable = this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, false, targetMask, onAnimationLoop, isAdditive);\r\n returnedAnimatable.weight = weight;\r\n return returnedAnimatable;\r\n};\r\nScene.prototype.beginAnimation = function (target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop, isAdditive) {\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n if (stopCurrent === void 0) { stopCurrent = true; }\r\n if (isAdditive === void 0) { isAdditive = false; }\r\n if (from > to && speedRatio > 0) {\r\n speedRatio *= -1;\r\n }\r\n if (stopCurrent) {\r\n this.stopAnimation(target, undefined, targetMask);\r\n }\r\n if (!animatable) {\r\n animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, undefined, onAnimationLoop, isAdditive);\r\n }\r\n var shouldRunTargetAnimations = targetMask ? targetMask(target) : true;\r\n // Local animations\r\n if (target.animations && shouldRunTargetAnimations) {\r\n animatable.appendAnimations(target, target.animations);\r\n }\r\n // Children animations\r\n if (target.getAnimatables) {\r\n var animatables = target.getAnimatables();\r\n for (var index = 0; index < animatables.length; index++) {\r\n this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop);\r\n }\r\n }\r\n animatable.reset();\r\n return animatable;\r\n};\r\nScene.prototype.beginHierarchyAnimation = function (target, directDescendantsOnly, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop, isAdditive) {\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n if (stopCurrent === void 0) { stopCurrent = true; }\r\n if (isAdditive === void 0) { isAdditive = false; }\r\n var children = target.getDescendants(directDescendantsOnly);\r\n var result = [];\r\n result.push(this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, undefined, isAdditive));\r\n for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\r\n var child = children_1[_i];\r\n result.push(this.beginAnimation(child, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, undefined, isAdditive));\r\n }\r\n return result;\r\n};\r\nScene.prototype.beginDirectAnimation = function (target, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive) {\r\n if (isAdditive === void 0) { isAdditive = false; }\r\n if (speedRatio === undefined) {\r\n speedRatio = 1.0;\r\n }\r\n if (from > to && speedRatio > 0) {\r\n speedRatio *= -1;\r\n }\r\n var animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, animations, onAnimationLoop, isAdditive);\r\n return animatable;\r\n};\r\nScene.prototype.beginDirectHierarchyAnimation = function (target, directDescendantsOnly, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive) {\r\n if (isAdditive === void 0) { isAdditive = false; }\r\n var children = target.getDescendants(directDescendantsOnly);\r\n var result = [];\r\n result.push(this.beginDirectAnimation(target, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive));\r\n for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {\r\n var child = children_2[_i];\r\n result.push(this.beginDirectAnimation(child, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive));\r\n }\r\n return result;\r\n};\r\nScene.prototype.getAnimatableByTarget = function (target) {\r\n for (var index = 0; index < this._activeAnimatables.length; index++) {\r\n if (this._activeAnimatables[index].target === target) {\r\n return this._activeAnimatables[index];\r\n }\r\n }\r\n return null;\r\n};\r\nScene.prototype.getAllAnimatablesByTarget = function (target) {\r\n var result = [];\r\n for (var index = 0; index < this._activeAnimatables.length; index++) {\r\n if (this._activeAnimatables[index].target === target) {\r\n result.push(this._activeAnimatables[index]);\r\n }\r\n }\r\n return result;\r\n};\r\n/**\r\n * Will stop the animation of the given target\r\n * @param target - the target\r\n * @param animationName - the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)\r\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n */\r\nScene.prototype.stopAnimation = function (target, animationName, targetMask) {\r\n var animatables = this.getAllAnimatablesByTarget(target);\r\n for (var _i = 0, animatables_1 = animatables; _i < animatables_1.length; _i++) {\r\n var animatable = animatables_1[_i];\r\n animatable.stop(animationName, targetMask);\r\n }\r\n};\r\n/**\r\n * Stops and removes all animations that have been applied to the scene\r\n */\r\nScene.prototype.stopAllAnimations = function () {\r\n if (this._activeAnimatables) {\r\n for (var i = 0; i < this._activeAnimatables.length; i++) {\r\n this._activeAnimatables[i].stop();\r\n }\r\n this._activeAnimatables = [];\r\n }\r\n for (var _i = 0, _a = this.animationGroups; _i < _a.length; _i++) {\r\n var group = _a[_i];\r\n group.stop();\r\n }\r\n};\r\nScene.prototype._registerTargetForLateAnimationBinding = function (runtimeAnimation, originalValue) {\r\n var target = runtimeAnimation.target;\r\n this._registeredForLateAnimationBindings.pushNoDuplicate(target);\r\n if (!target._lateAnimationHolders) {\r\n target._lateAnimationHolders = {};\r\n }\r\n if (!target._lateAnimationHolders[runtimeAnimation.targetPath]) {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath] = {\r\n totalWeight: 0,\r\n totalAdditiveWeight: 0,\r\n animations: [],\r\n additiveAnimations: [],\r\n originalValue: originalValue\r\n };\r\n }\r\n if (runtimeAnimation.isAdditive) {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].additiveAnimations.push(runtimeAnimation);\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalAdditiveWeight += runtimeAnimation.weight;\r\n }\r\n else {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].animations.push(runtimeAnimation);\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;\r\n }\r\n};\r\nScene.prototype._processLateAnimationBindingsForMatrices = function (holder) {\r\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight === 0) {\r\n return holder.originalValue;\r\n }\r\n var normalizer = 1.0;\r\n var finalPosition = TmpVectors.Vector3[0];\r\n var finalScaling = TmpVectors.Vector3[1];\r\n var finalQuaternion = TmpVectors.Quaternion[0];\r\n var startIndex = 0;\r\n var originalAnimation = holder.animations[0];\r\n var originalValue = holder.originalValue;\r\n var scale = 1;\r\n var skipOverride = false;\r\n if (holder.totalWeight < 1.0) {\r\n // We need to mix the original value in\r\n scale = 1.0 - holder.totalWeight;\r\n originalValue.decompose(finalScaling, finalQuaternion, finalPosition);\r\n }\r\n else {\r\n startIndex = 1;\r\n // We need to normalize the weights\r\n normalizer = holder.totalWeight;\r\n scale = originalAnimation.weight / normalizer;\r\n if (scale == 1) {\r\n if (holder.totalAdditiveWeight) {\r\n skipOverride = true;\r\n }\r\n else {\r\n return originalAnimation.currentValue;\r\n }\r\n }\r\n originalAnimation.currentValue.decompose(finalScaling, finalQuaternion, finalPosition);\r\n }\r\n // Add up the override animations\r\n if (!skipOverride) {\r\n finalScaling.scaleInPlace(scale);\r\n finalPosition.scaleInPlace(scale);\r\n finalQuaternion.scaleInPlace(scale);\r\n for (var animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {\r\n var runtimeAnimation = holder.animations[animIndex];\r\n if (runtimeAnimation.weight === 0) {\r\n continue;\r\n }\r\n var scale = runtimeAnimation.weight / normalizer;\r\n var currentPosition = TmpVectors.Vector3[2];\r\n var currentScaling = TmpVectors.Vector3[3];\r\n var currentQuaternion = TmpVectors.Quaternion[1];\r\n runtimeAnimation.currentValue.decompose(currentScaling, currentQuaternion, currentPosition);\r\n currentScaling.scaleAndAddToRef(scale, finalScaling);\r\n currentQuaternion.scaleAndAddToRef(scale, finalQuaternion);\r\n currentPosition.scaleAndAddToRef(scale, finalPosition);\r\n }\r\n }\r\n // Add up the additive animations\r\n for (var animIndex_1 = 0; animIndex_1 < holder.additiveAnimations.length; animIndex_1++) {\r\n var runtimeAnimation = holder.additiveAnimations[animIndex_1];\r\n if (runtimeAnimation.weight === 0) {\r\n continue;\r\n }\r\n var currentPosition = TmpVectors.Vector3[2];\r\n var currentScaling = TmpVectors.Vector3[3];\r\n var currentQuaternion = TmpVectors.Quaternion[1];\r\n runtimeAnimation.currentValue.decompose(currentScaling, currentQuaternion, currentPosition);\r\n currentScaling.multiplyToRef(finalScaling, currentScaling);\r\n Vector3.LerpToRef(finalScaling, currentScaling, runtimeAnimation.weight, finalScaling);\r\n finalQuaternion.multiplyToRef(currentQuaternion, currentQuaternion);\r\n Quaternion.SlerpToRef(finalQuaternion, currentQuaternion, runtimeAnimation.weight, finalQuaternion);\r\n currentPosition.scaleAndAddToRef(runtimeAnimation.weight, finalPosition);\r\n }\r\n var workValue = originalAnimation ? originalAnimation._animationState.workValue : TmpVectors.Matrix[0].clone();\r\n Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, workValue);\r\n return workValue;\r\n};\r\nScene.prototype._processLateAnimationBindingsForQuaternions = function (holder, refQuaternion) {\r\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight === 0) {\r\n return refQuaternion;\r\n }\r\n var originalAnimation = holder.animations[0];\r\n var originalValue = holder.originalValue;\r\n var cumulativeQuaternion = refQuaternion;\r\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight > 0) {\r\n cumulativeQuaternion.copyFrom(originalValue);\r\n }\r\n else if (holder.animations.length === 1) {\r\n Quaternion.SlerpToRef(originalValue, originalAnimation.currentValue, Math.min(1.0, holder.totalWeight), cumulativeQuaternion);\r\n if (holder.totalAdditiveWeight === 0) {\r\n return cumulativeQuaternion;\r\n }\r\n }\r\n else if (holder.animations.length > 1) {\r\n // Add up the override animations\r\n var normalizer = 1.0;\r\n var quaternions = void 0;\r\n var weights = void 0;\r\n if (holder.totalWeight < 1.0) {\r\n var scale = 1.0 - holder.totalWeight;\r\n quaternions = [];\r\n weights = [];\r\n quaternions.push(originalValue);\r\n weights.push(scale);\r\n }\r\n else {\r\n if (holder.animations.length === 2) { // Slerp as soon as we can\r\n Quaternion.SlerpToRef(holder.animations[0].currentValue, holder.animations[1].currentValue, holder.animations[1].weight / holder.totalWeight, refQuaternion);\r\n if (holder.totalAdditiveWeight === 0) {\r\n return refQuaternion;\r\n }\r\n }\r\n quaternions = [];\r\n weights = [];\r\n normalizer = holder.totalWeight;\r\n }\r\n for (var animIndex = 0; animIndex < holder.animations.length; animIndex++) {\r\n var runtimeAnimation = holder.animations[animIndex];\r\n quaternions.push(runtimeAnimation.currentValue);\r\n weights.push(runtimeAnimation.weight / normalizer);\r\n }\r\n // https://gamedev.stackexchange.com/questions/62354/method-for-interpolation-between-3-quaternions\r\n var cumulativeAmount = 0;\r\n for (var index = 0; index < quaternions.length;) {\r\n if (!index) {\r\n Quaternion.SlerpToRef(quaternions[index], quaternions[index + 1], weights[index + 1] / (weights[index] + weights[index + 1]), refQuaternion);\r\n cumulativeQuaternion = refQuaternion;\r\n cumulativeAmount = weights[index] + weights[index + 1];\r\n index += 2;\r\n continue;\r\n }\r\n cumulativeAmount += weights[index];\r\n Quaternion.SlerpToRef(cumulativeQuaternion, quaternions[index], weights[index] / cumulativeAmount, cumulativeQuaternion);\r\n index++;\r\n }\r\n }\r\n // Add up the additive animations\r\n for (var animIndex_2 = 0; animIndex_2 < holder.additiveAnimations.length; animIndex_2++) {\r\n var runtimeAnimation = holder.additiveAnimations[animIndex_2];\r\n if (runtimeAnimation.weight === 0) {\r\n continue;\r\n }\r\n cumulativeQuaternion.multiplyToRef(runtimeAnimation.currentValue, TmpVectors.Quaternion[0]);\r\n Quaternion.SlerpToRef(cumulativeQuaternion, TmpVectors.Quaternion[0], runtimeAnimation.weight, cumulativeQuaternion);\r\n }\r\n return cumulativeQuaternion;\r\n};\r\nScene.prototype._processLateAnimationBindings = function () {\r\n if (!this._registeredForLateAnimationBindings.length) {\r\n return;\r\n }\r\n for (var index = 0; index < this._registeredForLateAnimationBindings.length; index++) {\r\n var target = this._registeredForLateAnimationBindings.data[index];\r\n for (var path in target._lateAnimationHolders) {\r\n var holder = target._lateAnimationHolders[path];\r\n var originalAnimation = holder.animations[0];\r\n var originalValue = holder.originalValue;\r\n var matrixDecomposeMode = Animation.AllowMatrixDecomposeForInterpolation && originalValue.m; // ie. data is matrix\r\n var finalValue = target[path];\r\n if (matrixDecomposeMode) {\r\n finalValue = this._processLateAnimationBindingsForMatrices(holder);\r\n }\r\n else {\r\n var quaternionMode = originalValue.w !== undefined;\r\n if (quaternionMode) {\r\n finalValue = this._processLateAnimationBindingsForQuaternions(holder, finalValue || Quaternion.Identity());\r\n }\r\n else {\r\n var startIndex = 0;\r\n var normalizer = 1.0;\r\n if (holder.totalWeight < 1.0) {\r\n // We need to mix the original value in\r\n if (originalAnimation && originalValue.scale) {\r\n finalValue = originalValue.scale(1.0 - holder.totalWeight);\r\n }\r\n else if (originalAnimation) {\r\n finalValue = originalValue * (1.0 - holder.totalWeight);\r\n }\r\n else if (originalValue.clone) {\r\n finalValue = originalValue.clone();\r\n }\r\n else {\r\n finalValue = originalValue;\r\n }\r\n }\r\n else if (originalAnimation) {\r\n // We need to normalize the weights\r\n normalizer = holder.totalWeight;\r\n var scale_1 = originalAnimation.weight / normalizer;\r\n if (scale_1 !== 1) {\r\n if (originalAnimation.currentValue.scale) {\r\n finalValue = originalAnimation.currentValue.scale(scale_1);\r\n }\r\n else {\r\n finalValue = originalAnimation.currentValue * scale_1;\r\n }\r\n }\r\n else {\r\n finalValue = originalAnimation.currentValue;\r\n }\r\n startIndex = 1;\r\n }\r\n // Add up the override animations\r\n for (var animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {\r\n var runtimeAnimation = holder.animations[animIndex];\r\n var scale = runtimeAnimation.weight / normalizer;\r\n if (!scale) {\r\n continue;\r\n }\r\n else if (runtimeAnimation.currentValue.scaleAndAddToRef) {\r\n runtimeAnimation.currentValue.scaleAndAddToRef(scale, finalValue);\r\n }\r\n else {\r\n finalValue += runtimeAnimation.currentValue * scale;\r\n }\r\n }\r\n // Add up the additive animations\r\n for (var animIndex_3 = 0; animIndex_3 < holder.additiveAnimations.length; animIndex_3++) {\r\n var runtimeAnimation = holder.additiveAnimations[animIndex_3];\r\n var scale = runtimeAnimation.weight;\r\n if (!scale) {\r\n continue;\r\n }\r\n else if (runtimeAnimation.currentValue.scaleAndAddToRef) {\r\n runtimeAnimation.currentValue.scaleAndAddToRef(scale, finalValue);\r\n }\r\n else {\r\n finalValue += runtimeAnimation.currentValue * scale;\r\n }\r\n }\r\n }\r\n }\r\n target[path] = finalValue;\r\n }\r\n target._lateAnimationHolders = {};\r\n }\r\n this._registeredForLateAnimationBindings.reset();\r\n};\r\nBone.prototype.copyAnimationRange = function (source, rangeName, frameOffset, rescaleAsRequired, skelDimensionsRatio) {\r\n if (rescaleAsRequired === void 0) { rescaleAsRequired = false; }\r\n if (skelDimensionsRatio === void 0) { skelDimensionsRatio = null; }\r\n // all animation may be coming from a library skeleton, so may need to create animation\r\n if (this.animations.length === 0) {\r\n this.animations.push(new Animation(this.name, \"_matrix\", source.animations[0].framePerSecond, Animation.ANIMATIONTYPE_MATRIX, 0));\r\n this.animations[0].setKeys([]);\r\n }\r\n // get animation info / verify there is such a range from the source bone\r\n var sourceRange = source.animations[0].getRange(rangeName);\r\n if (!sourceRange) {\r\n return false;\r\n }\r\n var from = sourceRange.from;\r\n var to = sourceRange.to;\r\n var sourceKeys = source.animations[0].getKeys();\r\n // rescaling prep\r\n var sourceBoneLength = source.length;\r\n var sourceParent = source.getParent();\r\n var parent = this.getParent();\r\n var parentScalingReqd = rescaleAsRequired && sourceParent && sourceBoneLength && this.length && sourceBoneLength !== this.length;\r\n var parentRatio = parentScalingReqd && parent && sourceParent ? parent.length / sourceParent.length : 1;\r\n var dimensionsScalingReqd = rescaleAsRequired && !parent && skelDimensionsRatio && (skelDimensionsRatio.x !== 1 || skelDimensionsRatio.y !== 1 || skelDimensionsRatio.z !== 1);\r\n var destKeys = this.animations[0].getKeys();\r\n // loop vars declaration\r\n var orig;\r\n var origTranslation;\r\n var mat;\r\n for (var key = 0, nKeys = sourceKeys.length; key < nKeys; key++) {\r\n orig = sourceKeys[key];\r\n if (orig.frame >= from && orig.frame <= to) {\r\n if (rescaleAsRequired) {\r\n mat = orig.value.clone();\r\n // scale based on parent ratio, when bone has parent\r\n if (parentScalingReqd) {\r\n origTranslation = mat.getTranslation();\r\n mat.setTranslation(origTranslation.scaleInPlace(parentRatio));\r\n // scale based on skeleton dimension ratio when root bone, and value is passed\r\n }\r\n else if (dimensionsScalingReqd && skelDimensionsRatio) {\r\n origTranslation = mat.getTranslation();\r\n mat.setTranslation(origTranslation.multiplyInPlace(skelDimensionsRatio));\r\n // use original when root bone, and no data for skelDimensionsRatio\r\n }\r\n else {\r\n mat = orig.value;\r\n }\r\n }\r\n else {\r\n mat = orig.value;\r\n }\r\n destKeys.push({ frame: orig.frame + frameOffset, value: mat });\r\n }\r\n }\r\n this.animations[0].createRange(rangeName, from + frameOffset, to + frameOffset);\r\n return true;\r\n};\r\n//# sourceMappingURL=animatable.js.map","import { Animation } from \"./animation\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport \"./animatable\";\r\n/**\r\n * This class defines the direct association between an animation and a target\r\n */\r\nvar TargetedAnimation = /** @class */ (function () {\r\n function TargetedAnimation() {\r\n }\r\n /**\r\n * Returns the string \"TargetedAnimation\"\r\n * @returns \"TargetedAnimation\"\r\n */\r\n TargetedAnimation.prototype.getClassName = function () {\r\n return \"TargetedAnimation\";\r\n };\r\n /**\r\n * Serialize the object\r\n * @returns the JSON object representing the current entity\r\n */\r\n TargetedAnimation.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.animation = this.animation.serialize();\r\n serializationObject.targetId = this.target.id;\r\n return serializationObject;\r\n };\r\n return TargetedAnimation;\r\n}());\r\nexport { TargetedAnimation };\r\n/**\r\n * Use this class to create coordinated animations on multiple targets\r\n */\r\nvar AnimationGroup = /** @class */ (function () {\r\n /**\r\n * Instantiates a new Animation Group.\r\n * This helps managing several animations at once.\r\n * @see https://doc.babylonjs.com/how_to/group\r\n * @param name Defines the name of the group\r\n * @param scene Defines the scene the group belongs to\r\n */\r\n function AnimationGroup(\r\n /** The name of the animation group */\r\n name, scene) {\r\n if (scene === void 0) { scene = null; }\r\n this.name = name;\r\n this._targetedAnimations = new Array();\r\n this._animatables = new Array();\r\n this._from = Number.MAX_VALUE;\r\n this._to = -Number.MAX_VALUE;\r\n this._speedRatio = 1;\r\n this._loopAnimation = false;\r\n this._isAdditive = false;\r\n /**\r\n * This observable will notify when one animation have ended\r\n */\r\n this.onAnimationEndObservable = new Observable();\r\n /**\r\n * Observer raised when one animation loops\r\n */\r\n this.onAnimationLoopObservable = new Observable();\r\n /**\r\n * Observer raised when all animations have looped\r\n */\r\n this.onAnimationGroupLoopObservable = new Observable();\r\n /**\r\n * This observable will notify when all animations have ended.\r\n */\r\n this.onAnimationGroupEndObservable = new Observable();\r\n /**\r\n * This observable will notify when all animations have paused.\r\n */\r\n this.onAnimationGroupPauseObservable = new Observable();\r\n /**\r\n * This observable will notify when all animations are playing.\r\n */\r\n this.onAnimationGroupPlayObservable = new Observable();\r\n this._scene = scene || EngineStore.LastCreatedScene;\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._scene.addAnimationGroup(this);\r\n }\r\n Object.defineProperty(AnimationGroup.prototype, \"from\", {\r\n /**\r\n * Gets the first frame\r\n */\r\n get: function () {\r\n return this._from;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"to\", {\r\n /**\r\n * Gets the last frame\r\n */\r\n get: function () {\r\n return this._to;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"isStarted\", {\r\n /**\r\n * Define if the animations are started\r\n */\r\n get: function () {\r\n return this._isStarted;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"isPlaying\", {\r\n /**\r\n * Gets a value indicating that the current group is playing\r\n */\r\n get: function () {\r\n return this._isStarted && !this._isPaused;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"speedRatio\", {\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n get: function () {\r\n return this._speedRatio;\r\n },\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n set: function (value) {\r\n if (this._speedRatio === value) {\r\n return;\r\n }\r\n this._speedRatio = value;\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.speedRatio = this._speedRatio;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"loopAnimation\", {\r\n /**\r\n * Gets or sets if all animations should loop or not\r\n */\r\n get: function () {\r\n return this._loopAnimation;\r\n },\r\n set: function (value) {\r\n if (this._loopAnimation === value) {\r\n return;\r\n }\r\n this._loopAnimation = value;\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.loopAnimation = this._loopAnimation;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"isAdditive\", {\r\n /**\r\n * Gets or sets if all animations should be evaluated additively\r\n */\r\n get: function () {\r\n return this._isAdditive;\r\n },\r\n set: function (value) {\r\n if (this._isAdditive === value) {\r\n return;\r\n }\r\n this._isAdditive = value;\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.isAdditive = this._isAdditive;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"targetedAnimations\", {\r\n /**\r\n * Gets the targeted animations for this animation group\r\n */\r\n get: function () {\r\n return this._targetedAnimations;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"animatables\", {\r\n /**\r\n * returning the list of animatables controlled by this animation group.\r\n */\r\n get: function () {\r\n return this._animatables;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"children\", {\r\n /**\r\n * Gets the list of target animations\r\n */\r\n get: function () {\r\n return this._targetedAnimations;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Add an animation (with its target) in the group\r\n * @param animation defines the animation we want to add\r\n * @param target defines the target of the animation\r\n * @returns the TargetedAnimation object\r\n */\r\n AnimationGroup.prototype.addTargetedAnimation = function (animation, target) {\r\n var targetedAnimation = new TargetedAnimation();\r\n targetedAnimation.animation = animation;\r\n targetedAnimation.target = target;\r\n var keys = animation.getKeys();\r\n if (this._from > keys[0].frame) {\r\n this._from = keys[0].frame;\r\n }\r\n if (this._to < keys[keys.length - 1].frame) {\r\n this._to = keys[keys.length - 1].frame;\r\n }\r\n this._targetedAnimations.push(targetedAnimation);\r\n return targetedAnimation;\r\n };\r\n /**\r\n * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame\r\n * It can add constant keys at begin or end\r\n * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)\r\n * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.normalize = function (beginFrame, endFrame) {\r\n if (beginFrame === void 0) { beginFrame = null; }\r\n if (endFrame === void 0) { endFrame = null; }\r\n if (beginFrame == null) {\r\n beginFrame = this._from;\r\n }\r\n if (endFrame == null) {\r\n endFrame = this._to;\r\n }\r\n for (var index = 0; index < this._targetedAnimations.length; index++) {\r\n var targetedAnimation = this._targetedAnimations[index];\r\n var keys = targetedAnimation.animation.getKeys();\r\n var startKey = keys[0];\r\n var endKey = keys[keys.length - 1];\r\n if (startKey.frame > beginFrame) {\r\n var newKey = {\r\n frame: beginFrame,\r\n value: startKey.value,\r\n inTangent: startKey.inTangent,\r\n outTangent: startKey.outTangent,\r\n interpolation: startKey.interpolation\r\n };\r\n keys.splice(0, 0, newKey);\r\n }\r\n if (endKey.frame < endFrame) {\r\n var newKey = {\r\n frame: endFrame,\r\n value: endKey.value,\r\n inTangent: endKey.inTangent,\r\n outTangent: endKey.outTangent,\r\n interpolation: endKey.interpolation\r\n };\r\n keys.push(newKey);\r\n }\r\n }\r\n this._from = beginFrame;\r\n this._to = endFrame;\r\n return this;\r\n };\r\n AnimationGroup.prototype._processLoop = function (animatable, targetedAnimation, index) {\r\n var _this = this;\r\n animatable.onAnimationLoop = function () {\r\n _this.onAnimationLoopObservable.notifyObservers(targetedAnimation);\r\n if (_this._animationLoopFlags[index]) {\r\n return;\r\n }\r\n _this._animationLoopFlags[index] = true;\r\n _this._animationLoopCount++;\r\n if (_this._animationLoopCount === _this._targetedAnimations.length) {\r\n _this.onAnimationGroupLoopObservable.notifyObservers(_this);\r\n _this._animationLoopCount = 0;\r\n _this._animationLoopFlags = [];\r\n }\r\n };\r\n };\r\n /**\r\n * Start all animations on given targets\r\n * @param loop defines if animations must loop\r\n * @param speedRatio defines the ratio to apply to animation speed (1 by default)\r\n * @param from defines the from key (optional)\r\n * @param to defines the to key (optional)\r\n * @param isAdditive defines the additive state for the resulting animatables (optional)\r\n * @returns the current animation group\r\n */\r\n AnimationGroup.prototype.start = function (loop, speedRatio, from, to, isAdditive) {\r\n var _this = this;\r\n if (loop === void 0) { loop = false; }\r\n if (speedRatio === void 0) { speedRatio = 1; }\r\n if (this._isStarted || this._targetedAnimations.length === 0) {\r\n return this;\r\n }\r\n this._loopAnimation = loop;\r\n this._animationLoopCount = 0;\r\n this._animationLoopFlags = [];\r\n var _loop_1 = function () {\r\n var targetedAnimation = this_1._targetedAnimations[index];\r\n var animatable = this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this_1._from, to !== undefined ? to : this_1._to, loop, speedRatio, undefined, undefined, isAdditive !== undefined ? isAdditive : this_1._isAdditive);\r\n animatable.onAnimationEnd = function () {\r\n _this.onAnimationEndObservable.notifyObservers(targetedAnimation);\r\n _this._checkAnimationGroupEnded(animatable);\r\n };\r\n this_1._processLoop(animatable, targetedAnimation, index);\r\n this_1._animatables.push(animatable);\r\n };\r\n var this_1 = this;\r\n for (var index = 0; index < this._targetedAnimations.length; index++) {\r\n _loop_1();\r\n }\r\n this._speedRatio = speedRatio;\r\n if (from !== undefined && to !== undefined) {\r\n if (from < to && this._speedRatio < 0) {\r\n var temp = to;\r\n to = from;\r\n from = temp;\r\n }\r\n else if (from > to && this._speedRatio > 0) {\r\n this._speedRatio = -speedRatio;\r\n }\r\n }\r\n this._isStarted = true;\r\n this._isPaused = false;\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n return this;\r\n };\r\n /**\r\n * Pause all animations\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.pause = function () {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n this._isPaused = true;\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.pause();\r\n }\r\n this.onAnimationGroupPauseObservable.notifyObservers(this);\r\n return this;\r\n };\r\n /**\r\n * Play all animations to initial state\r\n * This function will start() the animations if they were not started or will restart() them if they were paused\r\n * @param loop defines if animations must loop\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.play = function (loop) {\r\n // only if all animatables are ready and exist\r\n if (this.isStarted && this._animatables.length === this._targetedAnimations.length) {\r\n if (loop !== undefined) {\r\n this.loopAnimation = loop;\r\n }\r\n this.restart();\r\n }\r\n else {\r\n this.stop();\r\n this.start(loop, this._speedRatio);\r\n }\r\n this._isPaused = false;\r\n return this;\r\n };\r\n /**\r\n * Reset all animations to initial state\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.reset = function () {\r\n if (!this._isStarted) {\r\n this.play();\r\n this.goToFrame(0);\r\n this.stop();\r\n return this;\r\n }\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.reset();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Restart animations from key 0\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.restart = function () {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.restart();\r\n }\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n return this;\r\n };\r\n /**\r\n * Stop all animations\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.stop = function () {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n var list = this._animatables.slice();\r\n for (var index = 0; index < list.length; index++) {\r\n list[index].stop();\r\n }\r\n this._isStarted = false;\r\n return this;\r\n };\r\n /**\r\n * Set animation weight for all animatables\r\n * @param weight defines the weight to use\r\n * @return the animationGroup\r\n * @see https://doc.babylonjs.com/babylon101/animations#animation-weights\r\n */\r\n AnimationGroup.prototype.setWeightForAllAnimatables = function (weight) {\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.weight = weight;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Synchronize and normalize all animatables with a source animatable\r\n * @param root defines the root animatable to synchronize with\r\n * @return the animationGroup\r\n * @see https://doc.babylonjs.com/babylon101/animations#animation-weights\r\n */\r\n AnimationGroup.prototype.syncAllAnimationsWith = function (root) {\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.syncWith(root);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Goes to a specific frame in this animation group\r\n * @param frame the frame number to go to\r\n * @return the animationGroup\r\n */\r\n AnimationGroup.prototype.goToFrame = function (frame) {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.goToFrame(frame);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Dispose all associated resources\r\n */\r\n AnimationGroup.prototype.dispose = function () {\r\n this._targetedAnimations = [];\r\n this._animatables = [];\r\n var index = this._scene.animationGroups.indexOf(this);\r\n if (index > -1) {\r\n this._scene.animationGroups.splice(index, 1);\r\n }\r\n this.onAnimationEndObservable.clear();\r\n this.onAnimationGroupEndObservable.clear();\r\n this.onAnimationGroupPauseObservable.clear();\r\n this.onAnimationGroupPlayObservable.clear();\r\n this.onAnimationLoopObservable.clear();\r\n this.onAnimationGroupLoopObservable.clear();\r\n };\r\n AnimationGroup.prototype._checkAnimationGroupEnded = function (animatable) {\r\n // animatable should be taken out of the array\r\n var idx = this._animatables.indexOf(animatable);\r\n if (idx > -1) {\r\n this._animatables.splice(idx, 1);\r\n }\r\n // all animatables were removed? animation group ended!\r\n if (this._animatables.length === 0) {\r\n this._isStarted = false;\r\n this.onAnimationGroupEndObservable.notifyObservers(this);\r\n }\r\n };\r\n /**\r\n * Clone the current animation group and returns a copy\r\n * @param newName defines the name of the new group\r\n * @param targetConverter defines an optional function used to convert current animation targets to new ones\r\n * @returns the new aniamtion group\r\n */\r\n AnimationGroup.prototype.clone = function (newName, targetConverter) {\r\n var newGroup = new AnimationGroup(newName || this.name, this._scene);\r\n for (var _i = 0, _a = this._targetedAnimations; _i < _a.length; _i++) {\r\n var targetAnimation = _a[_i];\r\n newGroup.addTargetedAnimation(targetAnimation.animation.clone(), targetConverter ? targetConverter(targetAnimation.target) : targetAnimation.target);\r\n }\r\n return newGroup;\r\n };\r\n /**\r\n * Serializes the animationGroup to an object\r\n * @returns Serialized object\r\n */\r\n AnimationGroup.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.from = this.from;\r\n serializationObject.to = this.to;\r\n serializationObject.targetedAnimations = [];\r\n for (var targetedAnimationIndex = 0; targetedAnimationIndex < this.targetedAnimations.length; targetedAnimationIndex++) {\r\n var targetedAnimation = this.targetedAnimations[targetedAnimationIndex];\r\n serializationObject.targetedAnimations[targetedAnimationIndex] = targetedAnimation.serialize();\r\n }\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Returns a new AnimationGroup object parsed from the source provided.\r\n * @param parsedAnimationGroup defines the source\r\n * @param scene defines the scene that will receive the animationGroup\r\n * @returns a new AnimationGroup\r\n */\r\n AnimationGroup.Parse = function (parsedAnimationGroup, scene) {\r\n var animationGroup = new AnimationGroup(parsedAnimationGroup.name, scene);\r\n for (var i = 0; i < parsedAnimationGroup.targetedAnimations.length; i++) {\r\n var targetedAnimation = parsedAnimationGroup.targetedAnimations[i];\r\n var animation = Animation.Parse(targetedAnimation.animation);\r\n var id = targetedAnimation.targetId;\r\n if (targetedAnimation.animation.property === \"influence\") { // morph target animation\r\n var morphTarget = scene.getMorphTargetById(id);\r\n if (morphTarget) {\r\n animationGroup.addTargetedAnimation(animation, morphTarget);\r\n }\r\n }\r\n else {\r\n var targetNode = scene.getNodeByID(id);\r\n if (targetNode != null) {\r\n animationGroup.addTargetedAnimation(animation, targetNode);\r\n }\r\n }\r\n }\r\n if (parsedAnimationGroup.from !== null && parsedAnimationGroup.to !== null) {\r\n animationGroup.normalize(parsedAnimationGroup.from, parsedAnimationGroup.to);\r\n }\r\n return animationGroup;\r\n };\r\n /**\r\n * Convert the keyframes for all animations belonging to the group to be relative to a given reference frame.\r\n * @param sourceAnimationGroup defines the AnimationGroup containing animations to convert\r\n * @param referenceFrame defines the frame that keyframes in the range will be relative to\r\n * @param range defines the name of the AnimationRange belonging to the animations in the group to convert\r\n * @param cloneOriginal defines whether or not to clone the group and convert the clone or convert the original group (default is false)\r\n * @param clonedName defines the name of the resulting cloned AnimationGroup if cloneOriginal is true\r\n * @returns a new AnimationGroup if cloneOriginal is true or the original AnimationGroup if cloneOriginal is false\r\n */\r\n AnimationGroup.MakeAnimationAdditive = function (sourceAnimationGroup, referenceFrame, range, cloneOriginal, clonedName) {\r\n if (referenceFrame === void 0) { referenceFrame = 0; }\r\n if (cloneOriginal === void 0) { cloneOriginal = false; }\r\n var animationGroup = sourceAnimationGroup;\r\n if (cloneOriginal) {\r\n animationGroup = sourceAnimationGroup.clone(clonedName || animationGroup.name);\r\n }\r\n var targetedAnimations = animationGroup.targetedAnimations;\r\n for (var index = 0; index < targetedAnimations.length; index++) {\r\n var targetedAnimation = targetedAnimations[index];\r\n Animation.MakeAnimationAdditive(targetedAnimation.animation, referenceFrame, range);\r\n }\r\n animationGroup.isAdditive = true;\r\n return animationGroup;\r\n };\r\n /**\r\n * Returns the string \"AnimationGroup\"\r\n * @returns \"AnimationGroup\"\r\n */\r\n AnimationGroup.prototype.getClassName = function () {\r\n return \"AnimationGroup\";\r\n };\r\n /**\r\n * Creates a detailled string about the object\r\n * @param fullDetails defines if the output string will support multiple levels of logging within scene loading\r\n * @returns a string representing the object\r\n */\r\n AnimationGroup.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n ret += \", type: \" + this.getClassName();\r\n if (fullDetails) {\r\n ret += \", from: \" + this._from;\r\n ret += \", to: \" + this._to;\r\n ret += \", isStarted: \" + this._isStarted;\r\n ret += \", speedRatio: \" + this._speedRatio;\r\n ret += \", targetedAnimations length: \" + this._targetedAnimations.length;\r\n ret += \", animatables length: \" + this._animatables;\r\n }\r\n return ret;\r\n };\r\n return AnimationGroup;\r\n}());\r\nexport { AnimationGroup };\r\n//# sourceMappingURL=animationGroup.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/helperFunctions\";\r\nvar name = 'rgbdDecodePixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n#include\\nvoid main(void)\\n{\\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var rgbdDecodePixelShader = { name: name, shader: shader };\r\n//# sourceMappingURL=rgbdDecode.fragment.js.map","import { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport \"../Shaders/rgbdDecode.fragment\";\r\nimport \"../Engines/Extensions/engine.renderTarget\";\r\n/**\r\n * Class used to host RGBD texture specific utilities\r\n */\r\nvar RGBDTextureTools = /** @class */ (function () {\r\n function RGBDTextureTools() {\r\n }\r\n /**\r\n * Expand the RGBD Texture from RGBD to Half Float if possible.\r\n * @param texture the texture to expand.\r\n */\r\n RGBDTextureTools.ExpandRGBDTexture = function (texture) {\r\n var internalTexture = texture._texture;\r\n if (!internalTexture || !texture.isRGBD) {\r\n return;\r\n }\r\n // Gets everything ready.\r\n var engine = internalTexture.getEngine();\r\n var caps = engine.getCaps();\r\n var expandTexture = false;\r\n // If half float available we can uncompress the texture\r\n if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\r\n expandTexture = true;\r\n internalTexture.type = 2;\r\n }\r\n // If full float available we can uncompress the texture\r\n else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\r\n expandTexture = true;\r\n internalTexture.type = 1;\r\n }\r\n if (expandTexture) {\r\n // Do not use during decode.\r\n internalTexture.isReady = false;\r\n internalTexture._isRGBD = false;\r\n internalTexture.invertY = false;\r\n }\r\n texture.onLoadObservable.addOnce(function () {\r\n // Expand the texture if possible\r\n if (expandTexture) {\r\n // Simply run through the decode PP.\r\n var rgbdPostProcess_1 = new PostProcess(\"rgbdDecode\", \"rgbdDecode\", null, null, 1, null, 3, engine, false, undefined, internalTexture.type, undefined, null, false);\r\n // Hold the output of the decoding.\r\n var expandedTexture_1 = engine.createRenderTargetTexture(internalTexture.width, {\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n generateStencilBuffer: false,\r\n samplingMode: internalTexture.samplingMode,\r\n type: internalTexture.type,\r\n format: 5\r\n });\r\n rgbdPostProcess_1.getEffect().executeWhenCompiled(function () {\r\n // PP Render Pass\r\n rgbdPostProcess_1.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", internalTexture);\r\n effect.setFloat2(\"scale\", 1, 1);\r\n };\r\n texture.getScene().postProcessManager.directRender([rgbdPostProcess_1], expandedTexture_1, true);\r\n // Cleanup\r\n engine.restoreDefaultFramebuffer();\r\n engine._releaseTexture(internalTexture);\r\n engine._releaseFramebufferObjects(expandedTexture_1);\r\n if (rgbdPostProcess_1) {\r\n rgbdPostProcess_1.dispose();\r\n }\r\n // Internal Swap\r\n expandedTexture_1._swapAndDie(internalTexture);\r\n // Ready to get rolling again.\r\n internalTexture.isReady = true;\r\n });\r\n }\r\n });\r\n };\r\n return RGBDTextureTools;\r\n}());\r\nexport { RGBDTextureTools };\r\n//# sourceMappingURL=rgbdTextureTools.js.map","import { Texture } from \"../Materials/Textures/texture\";\r\nimport { RGBDTextureTools } from \"./rgbdTextureTools\";\r\n/**\r\n * Class used to host texture specific utilities\r\n */\r\nvar BRDFTextureTools = /** @class */ (function () {\r\n function BRDFTextureTools() {\r\n }\r\n /**\r\n * Gets a default environment BRDF for MS-BRDF Height Correlated BRDF\r\n * @param scene defines the hosting scene\r\n * @returns the environment BRDF texture\r\n */\r\n BRDFTextureTools.GetEnvironmentBRDFTexture = function (scene) {\r\n if (!scene.environmentBRDFTexture) {\r\n // Forces Delayed Texture Loading to prevent undefined error whilst setting RGBD values.\r\n var useDelayedTextureLoading = scene.useDelayedTextureLoading;\r\n scene.useDelayedTextureLoading = false;\r\n var previousState = scene._blockEntityCollection;\r\n scene._blockEntityCollection = false;\r\n var texture = Texture.CreateFromBase64String(this._environmentBRDFBase64Texture, \"EnvironmentBRDFTexture\" + this._instanceNumber++, scene, true, false, Texture.BILINEAR_SAMPLINGMODE);\r\n scene._blockEntityCollection = previousState;\r\n // BRDF Texture should not be cached here due to pre processing and redundant scene caches.\r\n var texturesCache = scene.getEngine().getLoadedTexturesCache();\r\n var index = texturesCache.indexOf(texture.getInternalTexture());\r\n if (index !== -1) {\r\n texturesCache.splice(index, 1);\r\n }\r\n texture.isRGBD = true;\r\n texture.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n texture.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n scene.environmentBRDFTexture = texture;\r\n scene.useDelayedTextureLoading = useDelayedTextureLoading;\r\n RGBDTextureTools.ExpandRGBDTexture(texture);\r\n }\r\n return scene.environmentBRDFTexture;\r\n };\r\n /**\r\n * Prevents texture cache collision\r\n */\r\n BRDFTextureTools._instanceNumber = 0;\r\n BRDFTextureTools._environmentBRDFBase64Texture = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR42u29yY5tWXIlZnbuiSaTbZFUkZRKrCKhElASQA0EoQABgn6hJvoXzfUP+gP9hWb6Bg00IgRoQJaKqUxmZmTEe8/v0uB2u7Fm2T7HIyIrnz88uPvt3f2a2WrMbOvf/u3PvvzP/sUf/N6//i8vf/lv/3v5H//d//Sb//Uq/5u8yf8hV/m/5Cp/L1f5hVzlG7nKJ7mKyJuIXN/hPwqXI/g++zq6rPI5u8z+WqfLre+zy7PrVv9L8brsMiGvk8XLmM/sdfHXal4e3ad6GXPdyu2ij8u/+uv/5cuf/OSLfdtEfvUr+dnf/d0X//t3H/7bf/hP//N/928h/0Yg/4VA/kogfyGQP5Wr/IFAvhbIlwK5CGQTPP+9z5uPeePJSW+yo2+s/GtN30Rnv1E+f5zxof9R/lSXv/nr//mrr3+i+5dfyX7ZZQP07Tffys//8R/l/9TtX7790T/7r/8G8pdy+/8XAvnnAvkzgfwzgfyxQP5AIL8vkJ8K5KsmMVzu1U7p5PA5AXxOAJ8TwPf7sX/51ZeXfcemqnp9w/W77/S7X/6T/vzf/7383RWCX3/z05/9i3/13/0PX//eX/2FyP8tIv+PiPy9iPy/IvIzEfm5iPxCRH4lIt/c/393//9BRD6KyKf7f488fP74/PH544dJAF9cLl98IZfLBZtuqterXr/7Dt9982v95S9+Lv+gF/3i7Spv/8lf/vnf/vGf/dF/JfKnIvLnIvLvReQ/NEngn0TklyLy6/v/34jIt00iGJOBlxAsdvv54/PH5493SQCXy9t2ueh2ueimKorrFbjq9eNH+fDtb+TXv/ol/vHy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pVxYrGkUS4LeSUjg8dD7+D7w/ybIfy7vlB9/HJ978zr7/45Qgajzj+4EjIK/ULHPRAOlKr/aG0AFcqCyu0GcW45Igh6JMJmhA49/U+cEssHNJhtXDC1MOya3j/sAiAGcrEtqtgjBD6wEzSDc7D8o6C8rIqAZyPk+NQoNLAZ1hR64Yl1FBY648smUYKnSg1Xwk/0DyRyArByMUobyByhCcPnOaPyoegREFS4jNfYAw+IHCjdC1J2WDZBke/OyN85J24WiXwDYPoJyYuCD238ulvuzwt6KgHf0shWKsqCFFGjB/w8HU8eeTED9wAAAAABJRU5ErkJggg==\";\r\n return BRDFTextureTools;\r\n}());\r\nexport { BRDFTextureTools };\r\n//# sourceMappingURL=brdfTextureTools.js.map","import { __decorate } from \"tslib\";\r\nimport { SerializationHelper, serialize, serializeAsTexture, expandToProperty, serializeAsColor3 } from \"../../Misc/decorators\";\r\nimport { Color3 } from '../../Maths/math.color';\r\nimport { MaterialFlags } from \"../materialFlags\";\r\nimport { MaterialHelper } from \"../../Materials/materialHelper\";\r\n/**\r\n * Define the code related to the clear coat parameters of the pbr material.\r\n */\r\nvar PBRClearCoatConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of clear coat configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function PBRClearCoatConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._isEnabled = false;\r\n /**\r\n * Defines if the clear coat is enabled in the material.\r\n */\r\n this.isEnabled = false;\r\n /**\r\n * Defines the clear coat layer strength (between 0 and 1) it defaults to 1.\r\n */\r\n this.intensity = 1;\r\n /**\r\n * Defines the clear coat layer roughness.\r\n */\r\n this.roughness = 0;\r\n this._indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n /**\r\n * Defines the index of refraction of the clear coat.\r\n * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence\r\n * The default fits with a polyurethane material.\r\n * Changing the default value is more performance intensive.\r\n */\r\n this.indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n this._texture = null;\r\n /**\r\n * Stores the clear coat values in a texture (red channel is intensity and green channel is roughness)\r\n * If useRoughnessFromMainTexture is false, the green channel of texture is not used and the green channel of textureRoughness is used instead\r\n * if textureRoughness is not empty, else no texture roughness is used\r\n */\r\n this.texture = null;\r\n this._useRoughnessFromMainTexture = true;\r\n /**\r\n * Indicates that the green channel of the texture property will be used for roughness (default: true)\r\n * If false, the green channel from textureRoughness is used for roughness\r\n */\r\n this.useRoughnessFromMainTexture = true;\r\n this._textureRoughness = null;\r\n /**\r\n * Stores the clear coat roughness in a texture (green channel)\r\n * Not used if useRoughnessFromMainTexture is true\r\n */\r\n this.textureRoughness = null;\r\n this._remapF0OnInterfaceChange = true;\r\n /**\r\n * Defines if the F0 value should be remapped to account for the interface change in the material.\r\n */\r\n this.remapF0OnInterfaceChange = true;\r\n this._bumpTexture = null;\r\n /**\r\n * Define the clear coat specific bump texture.\r\n */\r\n this.bumpTexture = null;\r\n this._isTintEnabled = false;\r\n /**\r\n * Defines if the clear coat tint is enabled in the material.\r\n */\r\n this.isTintEnabled = false;\r\n /**\r\n * Defines the clear coat tint of the material.\r\n * This is only use if tint is enabled\r\n */\r\n this.tintColor = Color3.White();\r\n /**\r\n * Defines the distance at which the tint color should be found in the\r\n * clear coat media.\r\n * This is only use if tint is enabled\r\n */\r\n this.tintColorAtDistance = 1;\r\n /**\r\n * Defines the clear coat layer thickness.\r\n * This is only use if tint is enabled\r\n */\r\n this.tintThickness = 1;\r\n this._tintTexture = null;\r\n /**\r\n * Stores the clear tint values in a texture.\r\n * rgb is tint\r\n * a is a thickness factor\r\n */\r\n this.tintTexture = null;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n PBRClearCoatConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Gets wehter the submesh is ready to be used or not.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @param engine defines the engine the material belongs to.\r\n * @param disableBumpMap defines wether the material disables bump or not.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRClearCoatConfiguration.prototype.isReadyForSubMesh = function (defines, scene, engine, disableBumpMap) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._textureRoughness && MaterialFlags.ClearCoatTextureEnabled) {\r\n if (!this._textureRoughness.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (engine.getCaps().standardDerivatives && this._bumpTexture && MaterialFlags.ClearCoatBumpTextureEnabled && !disableBumpMap) {\r\n // Bump texture cannot be not blocking.\r\n if (!this._bumpTexture.isReady()) {\r\n return false;\r\n }\r\n }\r\n if (this._isTintEnabled && this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n if (!this._tintTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene to the material belongs to.\r\n */\r\n PBRClearCoatConfiguration.prototype.prepareDefines = function (defines, scene) {\r\n var _a;\r\n if (this._isEnabled) {\r\n defines.CLEARCOAT = true;\r\n defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = this._useRoughnessFromMainTexture;\r\n defines.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL = this._texture !== null && this._texture._texture === ((_a = this._textureRoughness) === null || _a === void 0 ? void 0 : _a._texture) && this._texture.checkTransformsAreIdentical(this._textureRoughness);\r\n defines.CLEARCOAT_REMAP_F0 = this._remapF0OnInterfaceChange;\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._texture, defines, \"CLEARCOAT_TEXTURE\");\r\n }\r\n else {\r\n defines.CLEARCOAT_TEXTURE = false;\r\n }\r\n if (this._textureRoughness && MaterialFlags.ClearCoatTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._textureRoughness, defines, \"CLEARCOAT_TEXTURE_ROUGHNESS\");\r\n }\r\n else {\r\n defines.CLEARCOAT_TEXTURE_ROUGHNESS = false;\r\n }\r\n if (this._bumpTexture && MaterialFlags.ClearCoatBumpTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._bumpTexture, defines, \"CLEARCOAT_BUMP\");\r\n }\r\n else {\r\n defines.CLEARCOAT_BUMP = false;\r\n }\r\n defines.CLEARCOAT_DEFAULTIOR = this._indexOfRefraction === PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n if (this._isTintEnabled) {\r\n defines.CLEARCOAT_TINT = true;\r\n if (this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._tintTexture, defines, \"CLEARCOAT_TINT_TEXTURE\");\r\n }\r\n else {\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n }\r\n }\r\n else {\r\n defines.CLEARCOAT_TINT = false;\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n defines.CLEARCOAT = false;\r\n defines.CLEARCOAT_TEXTURE = false;\r\n defines.CLEARCOAT_TEXTURE_ROUGHNESS = false;\r\n defines.CLEARCOAT_BUMP = false;\r\n defines.CLEARCOAT_TINT = false;\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\r\n defines.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL = false;\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param engine defines the engine the material belongs to.\r\n * @param disableBumpMap defines wether the material disables bump or not.\r\n * @param isFrozen defines wether the material is frozen or not.\r\n * @param invertNormalMapX If sets to true, x component of normal map value will be inverted (x = 1.0 - x).\r\n * @param invertNormalMapY If sets to true, y component of normal map value will be inverted (y = 1.0 - y).\r\n * @param subMesh the submesh to bind data for\r\n */\r\n PBRClearCoatConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, engine, disableBumpMap, isFrozen, invertNormalMapX, invertNormalMapY, subMesh) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h;\r\n var defines = subMesh._materialDefines;\r\n var identicalTextures = defines.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL;\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (identicalTextures && MaterialFlags.ClearCoatTextureEnabled) {\r\n uniformBuffer.updateFloat4(\"vClearCoatInfos\", this._texture.coordinatesIndex, this._texture.level, -1, -1);\r\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"clearCoat\");\r\n }\r\n else if ((this._texture || this._textureRoughness) && MaterialFlags.ClearCoatTextureEnabled) {\r\n uniformBuffer.updateFloat4(\"vClearCoatInfos\", (_b = (_a = this._texture) === null || _a === void 0 ? void 0 : _a.coordinatesIndex) !== null && _b !== void 0 ? _b : 0, (_d = (_c = this._texture) === null || _c === void 0 ? void 0 : _c.level) !== null && _d !== void 0 ? _d : 0, (_f = (_e = this._textureRoughness) === null || _e === void 0 ? void 0 : _e.coordinatesIndex) !== null && _f !== void 0 ? _f : 0, (_h = (_g = this._textureRoughness) === null || _g === void 0 ? void 0 : _g.level) !== null && _h !== void 0 ? _h : 0);\r\n if (this._texture) {\r\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"clearCoat\");\r\n }\r\n if (this._textureRoughness && !identicalTextures && !defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE) {\r\n MaterialHelper.BindTextureMatrix(this._textureRoughness, uniformBuffer, \"clearCoatRoughness\");\r\n }\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.ClearCoatTextureEnabled && !disableBumpMap) {\r\n uniformBuffer.updateFloat2(\"vClearCoatBumpInfos\", this._bumpTexture.coordinatesIndex, this._bumpTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._bumpTexture, uniformBuffer, \"clearCoatBump\");\r\n if (scene._mirroredCameraPosition) {\r\n uniformBuffer.updateFloat2(\"vClearCoatTangentSpaceParams\", invertNormalMapX ? 1.0 : -1.0, invertNormalMapY ? 1.0 : -1.0);\r\n }\r\n else {\r\n uniformBuffer.updateFloat2(\"vClearCoatTangentSpaceParams\", invertNormalMapX ? -1.0 : 1.0, invertNormalMapY ? -1.0 : 1.0);\r\n }\r\n }\r\n if (this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vClearCoatTintInfos\", this._tintTexture.coordinatesIndex, this._tintTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._tintTexture, uniformBuffer, \"clearCoatTint\");\r\n }\r\n // Clear Coat General params\r\n uniformBuffer.updateFloat2(\"vClearCoatParams\", this.intensity, this.roughness);\r\n // Clear Coat Refraction params\r\n var a = 1 - this._indexOfRefraction;\r\n var b = 1 + this._indexOfRefraction;\r\n var f0 = Math.pow((-a / b), 2); // Schlicks approx: (ior1 - ior2) / (ior1 + ior2) where ior2 for air is close to vacuum = 1.\r\n var eta = 1 / this._indexOfRefraction;\r\n uniformBuffer.updateFloat4(\"vClearCoatRefractionParams\", f0, eta, a, b);\r\n if (this._isTintEnabled) {\r\n uniformBuffer.updateFloat4(\"vClearCoatTintParams\", this.tintColor.r, this.tintColor.g, this.tintColor.b, Math.max(0.00001, this.tintThickness));\r\n uniformBuffer.updateFloat(\"clearCoatColorAtDistance\", Math.max(0.00001, this.tintColorAtDistance));\r\n }\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatSampler\", this._texture);\r\n }\r\n if (this._textureRoughness && !identicalTextures && !defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE && MaterialFlags.ClearCoatTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatRoughnessSampler\", this._textureRoughness);\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.ClearCoatBumpTextureEnabled && !disableBumpMap) {\r\n uniformBuffer.setTexture(\"clearCoatBumpSampler\", this._bumpTexture);\r\n }\r\n if (this._isTintEnabled && this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatTintSampler\", this._tintTexture);\r\n }\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRClearCoatConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n if (this._textureRoughness === texture) {\r\n return true;\r\n }\r\n if (this._bumpTexture === texture) {\r\n return true;\r\n }\r\n if (this._tintTexture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRClearCoatConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n if (this._textureRoughness) {\r\n activeTextures.push(this._textureRoughness);\r\n }\r\n if (this._bumpTexture) {\r\n activeTextures.push(this._bumpTexture);\r\n }\r\n if (this._tintTexture) {\r\n activeTextures.push(this._tintTexture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRClearCoatConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n if (this._textureRoughness && this._textureRoughness.animations && this._textureRoughness.animations.length > 0) {\r\n animatables.push(this._textureRoughness);\r\n }\r\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\r\n animatables.push(this._bumpTexture);\r\n }\r\n if (this._tintTexture && this._tintTexture.animations && this._tintTexture.animations.length > 0) {\r\n animatables.push(this._tintTexture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRClearCoatConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n var _a, _b, _c, _d;\r\n if (forceDisposeTextures) {\r\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.dispose();\r\n (_b = this._textureRoughness) === null || _b === void 0 ? void 0 : _b.dispose();\r\n (_c = this._bumpTexture) === null || _c === void 0 ? void 0 : _c.dispose();\r\n (_d = this._tintTexture) === null || _d === void 0 ? void 0 : _d.dispose();\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRClearCoatConfiguration\"\r\n */\r\n PBRClearCoatConfiguration.prototype.getClassName = function () {\r\n return \"PBRClearCoatConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRClearCoatConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.CLEARCOAT_BUMP) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT_BUMP\");\r\n }\r\n if (defines.CLEARCOAT_TINT) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT_TINT\");\r\n }\r\n if (defines.CLEARCOAT) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRClearCoatConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vClearCoatTangentSpaceParams\", \"vClearCoatParams\", \"vClearCoatRefractionParams\", \"vClearCoatTintParams\", \"clearCoatColorAtDistance\", \"clearCoatMatrix\", \"clearCoatRoughnessMatrix\", \"clearCoatBumpMatrix\", \"clearCoatTintMatrix\", \"vClearCoatInfos\", \"vClearCoatBumpInfos\", \"vClearCoatTintInfos\");\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRClearCoatConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"clearCoatSampler\", \"clearCoatRoughnessSampler\", \"clearCoatBumpSampler\", \"clearCoatTintSampler\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRClearCoatConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vClearCoatParams\", 2);\r\n uniformBuffer.addUniform(\"vClearCoatRefractionParams\", 4);\r\n uniformBuffer.addUniform(\"vClearCoatInfos\", 4);\r\n uniformBuffer.addUniform(\"clearCoatMatrix\", 16);\r\n uniformBuffer.addUniform(\"clearCoatRoughnessMatrix\", 16);\r\n uniformBuffer.addUniform(\"vClearCoatBumpInfos\", 2);\r\n uniformBuffer.addUniform(\"vClearCoatTangentSpaceParams\", 2);\r\n uniformBuffer.addUniform(\"clearCoatBumpMatrix\", 16);\r\n uniformBuffer.addUniform(\"vClearCoatTintParams\", 4);\r\n uniformBuffer.addUniform(\"clearCoatColorAtDistance\", 1);\r\n uniformBuffer.addUniform(\"vClearCoatTintInfos\", 2);\r\n uniformBuffer.addUniform(\"clearCoatTintMatrix\", 16);\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param clearCoatConfiguration define the config where to copy the info\r\n */\r\n PBRClearCoatConfiguration.prototype.copyTo = function (clearCoatConfiguration) {\r\n SerializationHelper.Clone(function () { return clearCoatConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this clear coat configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRClearCoatConfiguration.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRClearCoatConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n SerializationHelper.Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n /**\r\n * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence\r\n * The default fits with a polyurethane material.\r\n * @hidden\r\n */\r\n PBRClearCoatConfiguration._DefaultIndexOfRefraction = 1.5;\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"isEnabled\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRClearCoatConfiguration.prototype, \"intensity\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRClearCoatConfiguration.prototype, \"roughness\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"indexOfRefraction\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"texture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"useRoughnessFromMainTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"textureRoughness\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"remapF0OnInterfaceChange\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"bumpTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"isTintEnabled\", void 0);\r\n __decorate([\r\n serializeAsColor3()\r\n ], PBRClearCoatConfiguration.prototype, \"tintColor\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRClearCoatConfiguration.prototype, \"tintColorAtDistance\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRClearCoatConfiguration.prototype, \"tintThickness\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"tintTexture\", void 0);\r\n return PBRClearCoatConfiguration;\r\n}());\r\nexport { PBRClearCoatConfiguration };\r\n//# sourceMappingURL=pbrClearCoatConfiguration.js.map","import { __decorate } from \"tslib\";\r\nimport { SerializationHelper, serialize, expandToProperty, serializeAsVector2, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { VertexBuffer } from \"../../Meshes/buffer\";\r\nimport { Vector2 } from \"../../Maths/math.vector\";\r\nimport { MaterialFlags } from \"../../Materials/materialFlags\";\r\nimport { MaterialHelper } from \"../../Materials/materialHelper\";\r\n/**\r\n * Define the code related to the anisotropic parameters of the pbr material.\r\n */\r\nvar PBRAnisotropicConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of anisotropy configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function PBRAnisotropicConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._isEnabled = false;\r\n /**\r\n * Defines if the anisotropy is enabled in the material.\r\n */\r\n this.isEnabled = false;\r\n /**\r\n * Defines the anisotropy strength (between 0 and 1) it defaults to 1.\r\n */\r\n this.intensity = 1;\r\n /**\r\n * Defines if the effect is along the tangents, bitangents or in between.\r\n * By default, the effect is \"strectching\" the highlights along the tangents.\r\n */\r\n this.direction = new Vector2(1, 0);\r\n this._texture = null;\r\n /**\r\n * Stores the anisotropy values in a texture.\r\n * rg is direction (like normal from -1 to 1)\r\n * b is a intensity\r\n */\r\n this.texture = null;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n PBRAnisotropicConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRAnisotropicConfiguration.prototype.isReadyForSubMesh = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.AnisotropicTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param mesh the mesh we are preparing the defines for.\r\n * @param scene defines the scene the material belongs to.\r\n */\r\n PBRAnisotropicConfiguration.prototype.prepareDefines = function (defines, mesh, scene) {\r\n if (this._isEnabled) {\r\n defines.ANISOTROPIC = this._isEnabled;\r\n if (this._isEnabled && !mesh.isVerticesDataPresent(VertexBuffer.TangentKind)) {\r\n defines._needUVs = true;\r\n defines.MAINUV1 = true;\r\n }\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.AnisotropicTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._texture, defines, \"ANISOTROPIC_TEXTURE\");\r\n }\r\n else {\r\n defines.ANISOTROPIC_TEXTURE = false;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n defines.ANISOTROPIC = false;\r\n defines.ANISOTROPIC_TEXTURE = false;\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param isFrozen defines wether the material is frozen or not.\r\n */\r\n PBRAnisotropicConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, isFrozen) {\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (this._texture && MaterialFlags.AnisotropicTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vAnisotropyInfos\", this._texture.coordinatesIndex, this._texture.level);\r\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"anisotropy\");\r\n }\r\n // Anisotropy\r\n uniformBuffer.updateFloat3(\"vAnisotropy\", this.direction.x, this.direction.y, this.intensity);\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.AnisotropicTextureEnabled) {\r\n uniformBuffer.setTexture(\"anisotropySampler\", this._texture);\r\n }\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRAnisotropicConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRAnisotropicConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRAnisotropicConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRAnisotropicConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._texture) {\r\n this._texture.dispose();\r\n }\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRAnisotropicConfiguration\"\r\n */\r\n PBRAnisotropicConfiguration.prototype.getClassName = function () {\r\n return \"PBRAnisotropicConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRAnisotropicConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.ANISOTROPIC) {\r\n fallbacks.addFallback(currentRank++, \"ANISOTROPIC\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRAnisotropicConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vAnisotropy\", \"vAnisotropyInfos\", \"anisotropyMatrix\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRAnisotropicConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vAnisotropy\", 3);\r\n uniformBuffer.addUniform(\"vAnisotropyInfos\", 2);\r\n uniformBuffer.addUniform(\"anisotropyMatrix\", 16);\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRAnisotropicConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"anisotropySampler\");\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param anisotropicConfiguration define the config where to copy the info\r\n */\r\n PBRAnisotropicConfiguration.prototype.copyTo = function (anisotropicConfiguration) {\r\n SerializationHelper.Clone(function () { return anisotropicConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this anisotropy configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRAnisotropicConfiguration.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRAnisotropicConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n SerializationHelper.Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRAnisotropicConfiguration.prototype, \"isEnabled\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRAnisotropicConfiguration.prototype, \"intensity\", void 0);\r\n __decorate([\r\n serializeAsVector2()\r\n ], PBRAnisotropicConfiguration.prototype, \"direction\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRAnisotropicConfiguration.prototype, \"texture\", void 0);\r\n return PBRAnisotropicConfiguration;\r\n}());\r\nexport { PBRAnisotropicConfiguration };\r\n//# sourceMappingURL=pbrAnisotropicConfiguration.js.map","import { __decorate } from \"tslib\";\r\nimport { SerializationHelper, serialize, expandToProperty } from \"../../Misc/decorators\";\r\n/**\r\n * Define the code related to the BRDF parameters of the pbr material.\r\n */\r\nvar PBRBRDFConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of clear coat configuration.\r\n * @param markAllSubMeshesAsMiscDirty Callback to flag the material to dirty\r\n */\r\n function PBRBRDFConfiguration(markAllSubMeshesAsMiscDirty) {\r\n this._useEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION;\r\n /**\r\n * Defines if the material uses energy conservation.\r\n */\r\n this.useEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION;\r\n this._useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED;\r\n /**\r\n * LEGACY Mode set to false\r\n * Defines if the material uses height smith correlated visibility term.\r\n * If you intent to not use our default BRDF, you need to load a separate BRDF Texture for the PBR\r\n * You can either load https://assets.babylonjs.com/environments/uncorrelatedBRDF.png\r\n * or https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds to have more precision\r\n * Not relying on height correlated will also disable energy conservation.\r\n */\r\n this.useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED;\r\n this._useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS;\r\n /**\r\n * LEGACY Mode set to false\r\n * Defines if the material uses spherical harmonics vs spherical polynomials for the\r\n * diffuse part of the IBL.\r\n * The harmonics despite a tiny bigger cost has been proven to provide closer results\r\n * to the ground truth.\r\n */\r\n this.useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS;\r\n this._useSpecularGlossinessInputEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION;\r\n /**\r\n * Defines if the material uses energy conservation, when the specular workflow is active.\r\n * If activated, the albedo color is multiplied with (1. - maxChannel(specular color)).\r\n * If deactivated, a material is only physically plausible, when (albedo color + specular color) < 1.\r\n * In the deactivated case, the material author has to ensure energy conservation, for a physically plausible rendering.\r\n */\r\n this.useSpecularGlossinessInputEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION;\r\n this._internalMarkAllSubMeshesAsMiscDirty = markAllSubMeshesAsMiscDirty;\r\n }\r\n /** @hidden */\r\n PBRBRDFConfiguration.prototype._markAllSubMeshesAsMiscDirty = function () {\r\n this._internalMarkAllSubMeshesAsMiscDirty();\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n */\r\n PBRBRDFConfiguration.prototype.prepareDefines = function (defines) {\r\n defines.BRDF_V_HEIGHT_CORRELATED = this._useSmithVisibilityHeightCorrelated;\r\n defines.MS_BRDF_ENERGY_CONSERVATION = this._useEnergyConservation && this._useSmithVisibilityHeightCorrelated;\r\n defines.SPHERICAL_HARMONICS = this._useSphericalHarmonics;\r\n defines.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION = this._useSpecularGlossinessInputEnergyConservation;\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRClearCoatConfiguration\"\r\n */\r\n PBRBRDFConfiguration.prototype.getClassName = function () {\r\n return \"PBRBRDFConfiguration\";\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param brdfConfiguration define the config where to copy the info\r\n */\r\n PBRBRDFConfiguration.prototype.copyTo = function (brdfConfiguration) {\r\n SerializationHelper.Clone(function () { return brdfConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this BRDF configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRBRDFConfiguration.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRBRDFConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n SerializationHelper.Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n /**\r\n * Default value used for the energy conservation.\r\n * This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.\r\n */\r\n PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION = true;\r\n /**\r\n * Default value used for the Smith Visibility Height Correlated mode.\r\n * This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.\r\n */\r\n PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED = true;\r\n /**\r\n * Default value used for the IBL diffuse part.\r\n * This can help switching back to the polynomials mode globally which is a tiny bit\r\n * less GPU intensive at the drawback of a lower quality.\r\n */\r\n PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS = true;\r\n /**\r\n * Default value used for activating energy conservation for the specular workflow.\r\n * If activated, the albedo color is multiplied with (1. - maxChannel(specular color)).\r\n * If deactivated, a material is only physically plausible, when (albedo color + specular color) < 1.\r\n */\r\n PBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION = true;\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBRDFConfiguration.prototype, \"useEnergyConservation\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBRDFConfiguration.prototype, \"useSmithVisibilityHeightCorrelated\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBRDFConfiguration.prototype, \"useSphericalHarmonics\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBRDFConfiguration.prototype, \"useSpecularGlossinessInputEnergyConservation\", void 0);\r\n return PBRBRDFConfiguration;\r\n}());\r\nexport { PBRBRDFConfiguration };\r\n//# sourceMappingURL=pbrBRDFConfiguration.js.map","import { __decorate } from \"tslib\";\r\nimport { SerializationHelper, serialize, expandToProperty, serializeAsColor3, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { Color3 } from '../../Maths/math.color';\r\nimport { MaterialFlags } from \"../../Materials/materialFlags\";\r\nimport { MaterialHelper } from \"../../Materials/materialHelper\";\r\n/**\r\n * Define the code related to the Sheen parameters of the pbr material.\r\n */\r\nvar PBRSheenConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of clear coat configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function PBRSheenConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._isEnabled = false;\r\n /**\r\n * Defines if the material uses sheen.\r\n */\r\n this.isEnabled = false;\r\n this._linkSheenWithAlbedo = false;\r\n /**\r\n * Defines if the sheen is linked to the sheen color.\r\n */\r\n this.linkSheenWithAlbedo = false;\r\n /**\r\n * Defines the sheen intensity.\r\n */\r\n this.intensity = 1;\r\n /**\r\n * Defines the sheen color.\r\n */\r\n this.color = Color3.White();\r\n this._texture = null;\r\n /**\r\n * Stores the sheen tint values in a texture.\r\n * rgb is tint\r\n * a is a intensity or roughness if the roughness property has been defined and useRoughnessFromTexture is true (in that case, textureRoughness won't be used)\r\n * If the roughness property has been defined and useRoughnessFromTexture is false then the alpha channel is not used to modulate roughness\r\n */\r\n this.texture = null;\r\n this._useRoughnessFromMainTexture = true;\r\n /**\r\n * Indicates that the alpha channel of the texture property will be used for roughness.\r\n * Has no effect if the roughness (and texture!) property is not defined\r\n */\r\n this.useRoughnessFromMainTexture = true;\r\n this._roughness = null;\r\n /**\r\n * Defines the sheen roughness.\r\n * It is not taken into account if linkSheenWithAlbedo is true.\r\n * To stay backward compatible, material roughness is used instead if sheen roughness = null\r\n */\r\n this.roughness = null;\r\n this._textureRoughness = null;\r\n /**\r\n * Stores the sheen roughness in a texture.\r\n * alpha channel is the roughness. This texture won't be used if the texture property is not empty and useRoughnessFromTexture is true\r\n */\r\n this.textureRoughness = null;\r\n this._albedoScaling = false;\r\n /**\r\n * If true, the sheen effect is layered above the base BRDF with the albedo-scaling technique.\r\n * It allows the strength of the sheen effect to not depend on the base color of the material,\r\n * making it easier to setup and tweak the effect\r\n */\r\n this.albedoScaling = false;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n PBRSheenConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRSheenConfiguration.prototype.isReadyForSubMesh = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.SheenTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._textureRoughness && MaterialFlags.SheenTextureEnabled) {\r\n if (!this._textureRoughness.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n */\r\n PBRSheenConfiguration.prototype.prepareDefines = function (defines, scene) {\r\n var _a;\r\n if (this._isEnabled) {\r\n defines.SHEEN = this._isEnabled;\r\n defines.SHEEN_LINKWITHALBEDO = this._linkSheenWithAlbedo;\r\n defines.SHEEN_ROUGHNESS = this._roughness !== null;\r\n defines.SHEEN_ALBEDOSCALING = this._albedoScaling;\r\n defines.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = this._useRoughnessFromMainTexture;\r\n defines.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL = this._texture !== null && this._texture._texture === ((_a = this._textureRoughness) === null || _a === void 0 ? void 0 : _a._texture) && this._texture.checkTransformsAreIdentical(this._textureRoughness);\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.SheenTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._texture, defines, \"SHEEN_TEXTURE\");\r\n }\r\n else {\r\n defines.SHEEN_TEXTURE = false;\r\n }\r\n if (this._textureRoughness && MaterialFlags.SheenTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._textureRoughness, defines, \"SHEEN_TEXTURE_ROUGHNESS\");\r\n }\r\n else {\r\n defines.SHEEN_TEXTURE_ROUGHNESS = false;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n defines.SHEEN = false;\r\n defines.SHEEN_TEXTURE = false;\r\n defines.SHEEN_TEXTURE_ROUGHNESS = false;\r\n defines.SHEEN_LINKWITHALBEDO = false;\r\n defines.SHEEN_ROUGHNESS = false;\r\n defines.SHEEN_ALBEDOSCALING = false;\r\n defines.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\r\n defines.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL = false;\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param isFrozen defines wether the material is frozen or not.\r\n * @param subMesh the submesh to bind data for\r\n */\r\n PBRSheenConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, isFrozen, subMesh) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h;\r\n var defines = subMesh._materialDefines;\r\n var identicalTextures = defines.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL;\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (identicalTextures && MaterialFlags.SheenTextureEnabled) {\r\n uniformBuffer.updateFloat4(\"vSheenInfos\", this._texture.coordinatesIndex, this._texture.level, -1, -1);\r\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"sheen\");\r\n }\r\n else if ((this._texture || this._textureRoughness) && MaterialFlags.SheenTextureEnabled) {\r\n uniformBuffer.updateFloat4(\"vSheenInfos\", (_b = (_a = this._texture) === null || _a === void 0 ? void 0 : _a.coordinatesIndex) !== null && _b !== void 0 ? _b : 0, (_d = (_c = this._texture) === null || _c === void 0 ? void 0 : _c.level) !== null && _d !== void 0 ? _d : 0, (_f = (_e = this._textureRoughness) === null || _e === void 0 ? void 0 : _e.coordinatesIndex) !== null && _f !== void 0 ? _f : 0, (_h = (_g = this._textureRoughness) === null || _g === void 0 ? void 0 : _g.level) !== null && _h !== void 0 ? _h : 0);\r\n if (this._texture) {\r\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"sheen\");\r\n }\r\n if (this._textureRoughness && !identicalTextures && !defines.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE) {\r\n MaterialHelper.BindTextureMatrix(this._textureRoughness, uniformBuffer, \"sheenRoughness\");\r\n }\r\n }\r\n // Sheen\r\n uniformBuffer.updateFloat4(\"vSheenColor\", this.color.r, this.color.g, this.color.b, this.intensity);\r\n if (this._roughness !== null) {\r\n uniformBuffer.updateFloat(\"vSheenRoughness\", this._roughness);\r\n }\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.SheenTextureEnabled) {\r\n uniformBuffer.setTexture(\"sheenSampler\", this._texture);\r\n }\r\n if (this._textureRoughness && !identicalTextures && !defines.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE && MaterialFlags.SheenTextureEnabled) {\r\n uniformBuffer.setTexture(\"sheenRoughnessSampler\", this._textureRoughness);\r\n }\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRSheenConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n if (this._textureRoughness === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRSheenConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n if (this._textureRoughness) {\r\n activeTextures.push(this._textureRoughness);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRSheenConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n if (this._textureRoughness && this._textureRoughness.animations && this._textureRoughness.animations.length > 0) {\r\n animatables.push(this._textureRoughness);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRSheenConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n var _a, _b;\r\n if (forceDisposeTextures) {\r\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.dispose();\r\n (_b = this._textureRoughness) === null || _b === void 0 ? void 0 : _b.dispose();\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRSheenConfiguration\"\r\n */\r\n PBRSheenConfiguration.prototype.getClassName = function () {\r\n return \"PBRSheenConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRSheenConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.SHEEN) {\r\n fallbacks.addFallback(currentRank++, \"SHEEN\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRSheenConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vSheenColor\", \"vSheenRoughness\", \"vSheenInfos\", \"sheenMatrix\", \"sheenRoughnessMatrix\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRSheenConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vSheenColor\", 4);\r\n uniformBuffer.addUniform(\"vSheenRoughness\", 1);\r\n uniformBuffer.addUniform(\"vSheenInfos\", 4);\r\n uniformBuffer.addUniform(\"sheenMatrix\", 16);\r\n uniformBuffer.addUniform(\"sheenRoughnessMatrix\", 16);\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRSheenConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"sheenSampler\");\r\n samplers.push(\"sheenRoughnessSampler\");\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param sheenConfiguration define the config where to copy the info\r\n */\r\n PBRSheenConfiguration.prototype.copyTo = function (sheenConfiguration) {\r\n SerializationHelper.Clone(function () { return sheenConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this BRDF configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRSheenConfiguration.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRSheenConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n SerializationHelper.Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"isEnabled\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"linkSheenWithAlbedo\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSheenConfiguration.prototype, \"intensity\", void 0);\r\n __decorate([\r\n serializeAsColor3()\r\n ], PBRSheenConfiguration.prototype, \"color\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"texture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"useRoughnessFromMainTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"roughness\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"textureRoughness\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"albedoScaling\", void 0);\r\n return PBRSheenConfiguration;\r\n}());\r\nexport { PBRSheenConfiguration };\r\n//# sourceMappingURL=pbrSheenConfiguration.js.map","import { __decorate } from \"tslib\";\r\nimport { SerializationHelper, serialize, serializeAsTexture, expandToProperty, serializeAsColor3 } from \"../../Misc/decorators\";\r\nimport { Color3 } from '../../Maths/math.color';\r\nimport { MaterialFlags } from \"../materialFlags\";\r\nimport { MaterialHelper } from \"../../Materials/materialHelper\";\r\nimport { Scalar } from \"../../Maths/math.scalar\";\r\n/**\r\n * Define the code related to the sub surface parameters of the pbr material.\r\n */\r\nvar PBRSubSurfaceConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of sub surface configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n * @param markScenePrePassDirty Callback to flag the scene as prepass dirty\r\n * @param scene The scene\r\n */\r\n function PBRSubSurfaceConfiguration(markAllSubMeshesAsTexturesDirty, markScenePrePassDirty, scene) {\r\n this._isRefractionEnabled = false;\r\n /**\r\n * Defines if the refraction is enabled in the material.\r\n */\r\n this.isRefractionEnabled = false;\r\n this._isTranslucencyEnabled = false;\r\n /**\r\n * Defines if the translucency is enabled in the material.\r\n */\r\n this.isTranslucencyEnabled = false;\r\n this._isScatteringEnabled = false;\r\n /**\r\n * Defines if the sub surface scattering is enabled in the material.\r\n */\r\n this.isScatteringEnabled = false;\r\n this._scatteringDiffusionProfileIndex = 0;\r\n /**\r\n * Defines the refraction intensity of the material.\r\n * The refraction when enabled replaces the Diffuse part of the material.\r\n * The intensity helps transitionning between diffuse and refraction.\r\n */\r\n this.refractionIntensity = 1;\r\n /**\r\n * Defines the translucency intensity of the material.\r\n * When translucency has been enabled, this defines how much of the \"translucency\"\r\n * is addded to the diffuse part of the material.\r\n */\r\n this.translucencyIntensity = 1;\r\n /**\r\n * When enabled, transparent surfaces will be tinted with the albedo colour (independent of thickness)\r\n */\r\n this.useAlbedoToTintRefraction = false;\r\n this._thicknessTexture = null;\r\n /**\r\n * Stores the average thickness of a mesh in a texture (The texture is holding the values linearly).\r\n * The red channel of the texture should contain the thickness remapped between 0 and 1.\r\n * 0 would mean minimumThickness\r\n * 1 would mean maximumThickness\r\n * The other channels might be use as a mask to vary the different effects intensity.\r\n */\r\n this.thicknessTexture = null;\r\n this._refractionTexture = null;\r\n /**\r\n * Defines the texture to use for refraction.\r\n */\r\n this.refractionTexture = null;\r\n this._indexOfRefraction = 1.5;\r\n /**\r\n * Index of refraction of the material base layer.\r\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\r\n *\r\n * This does not only impact refraction but also the Base F0 of Dielectric Materials.\r\n *\r\n * From dielectric fresnel rules: F0 = square((iorT - iorI) / (iorT + iorI))\r\n */\r\n this.indexOfRefraction = 1.5;\r\n this._volumeIndexOfRefraction = -1.0;\r\n this._invertRefractionY = false;\r\n /**\r\n * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.\r\n */\r\n this.invertRefractionY = false;\r\n this._linkRefractionWithTransparency = false;\r\n /**\r\n * This parameters will make the material used its opacity to control how much it is refracting aginst not.\r\n * Materials half opaque for instance using refraction could benefit from this control.\r\n */\r\n this.linkRefractionWithTransparency = false;\r\n /**\r\n * Defines the minimum thickness stored in the thickness map.\r\n * If no thickness map is defined, this value will be used to simulate thickness.\r\n */\r\n this.minimumThickness = 0;\r\n /**\r\n * Defines the maximum thickness stored in the thickness map.\r\n */\r\n this.maximumThickness = 1;\r\n /**\r\n * Defines the volume tint of the material.\r\n * This is used for both translucency and scattering.\r\n */\r\n this.tintColor = Color3.White();\r\n /**\r\n * Defines the distance at which the tint color should be found in the media.\r\n * This is used for refraction only.\r\n */\r\n this.tintColorAtDistance = 1;\r\n /**\r\n * Defines how far each channel transmit through the media.\r\n * It is defined as a color to simplify it selection.\r\n */\r\n this.diffusionDistance = Color3.White();\r\n this._useMaskFromThicknessTexture = false;\r\n /**\r\n * Stores the intensity of the different subsurface effects in the thickness texture.\r\n * * the green channel is the translucency intensity.\r\n * * the blue channel is the scattering intensity.\r\n * * the alpha channel is the refraction intensity.\r\n */\r\n this.useMaskFromThicknessTexture = false;\r\n this._useMaskFromThicknessTextureGltf = false;\r\n /**\r\n * Stores the intensity of the different subsurface effects in the thickness texture. This variation\r\n * matches the channel-packing that is used by glTF.\r\n * * the red channel is the transmission/translucency intensity.\r\n * * the green channel is the thickness.\r\n */\r\n this.useMaskFromThicknessTextureGltf = false;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n this._internalMarkScenePrePassDirty = markScenePrePassDirty;\r\n this._scene = scene;\r\n }\r\n Object.defineProperty(PBRSubSurfaceConfiguration.prototype, \"scatteringDiffusionProfile\", {\r\n /**\r\n * Diffusion profile for subsurface scattering.\r\n * Useful for better scattering in the skins or foliages.\r\n */\r\n get: function () {\r\n if (!this._scene.subSurfaceConfiguration) {\r\n return null;\r\n }\r\n return this._scene.subSurfaceConfiguration.ssDiffusionProfileColors[this._scatteringDiffusionProfileIndex];\r\n },\r\n set: function (c) {\r\n if (!this._scene.enableSubSurfaceForPrePass()) {\r\n // Not supported\r\n return;\r\n }\r\n // addDiffusionProfile automatically checks for doubles\r\n if (c) {\r\n this._scatteringDiffusionProfileIndex = this._scene.subSurfaceConfiguration.addDiffusionProfile(c);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRSubSurfaceConfiguration.prototype, \"volumeIndexOfRefraction\", {\r\n /**\r\n * Index of refraction of the material's volume.\r\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\r\n *\r\n * This ONLY impacts refraction. If not provided or given a non-valid value,\r\n * the volume will use the same IOR as the surface.\r\n */\r\n get: function () {\r\n if (this._volumeIndexOfRefraction >= 1.0) {\r\n return this._volumeIndexOfRefraction;\r\n }\r\n return this._indexOfRefraction;\r\n },\r\n set: function (value) {\r\n if (value >= 1.0) {\r\n this._volumeIndexOfRefraction = value;\r\n }\r\n else {\r\n this._volumeIndexOfRefraction = -1.0;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n PBRSubSurfaceConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /** @hidden */\r\n PBRSubSurfaceConfiguration.prototype._markScenePrePassDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n this._internalMarkScenePrePassDirty();\r\n };\r\n /**\r\n * Gets wehter the submesh is ready to be used or not.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.isReadyForSubMesh = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._thicknessTexture && MaterialFlags.ThicknessTextureEnabled) {\r\n if (!this._thicknessTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n var refractionTexture = this._getRefractionTexture(scene);\r\n if (refractionTexture && MaterialFlags.RefractionTextureEnabled) {\r\n if (!refractionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene to the material belongs to.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.prepareDefines = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n defines.SUBSURFACE = false;\r\n defines.SS_TRANSLUCENCY = this._isTranslucencyEnabled;\r\n defines.SS_SCATTERING = this._isScatteringEnabled;\r\n defines.SS_THICKNESSANDMASK_TEXTURE = false;\r\n defines.SS_MASK_FROM_THICKNESS_TEXTURE = false;\r\n defines.SS_MASK_FROM_THICKNESS_TEXTURE_GLTF = false;\r\n defines.SS_REFRACTION = false;\r\n defines.SS_REFRACTIONMAP_3D = false;\r\n defines.SS_GAMMAREFRACTION = false;\r\n defines.SS_RGBDREFRACTION = false;\r\n defines.SS_LINEARSPECULARREFRACTION = false;\r\n defines.SS_REFRACTIONMAP_OPPOSITEZ = false;\r\n defines.SS_LODINREFRACTIONALPHA = false;\r\n defines.SS_LINKREFRACTIONTOTRANSPARENCY = false;\r\n defines.SS_ALBEDOFORREFRACTIONTINT = false;\r\n if (this._isRefractionEnabled || this._isTranslucencyEnabled || this._isScatteringEnabled) {\r\n defines.SUBSURFACE = true;\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._thicknessTexture && MaterialFlags.ThicknessTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._thicknessTexture, defines, \"SS_THICKNESSANDMASK_TEXTURE\");\r\n }\r\n }\r\n }\r\n defines.SS_MASK_FROM_THICKNESS_TEXTURE = this._useMaskFromThicknessTexture;\r\n defines.SS_MASK_FROM_THICKNESS_TEXTURE_GLTF = this._useMaskFromThicknessTextureGltf;\r\n }\r\n if (this._isRefractionEnabled) {\r\n if (scene.texturesEnabled) {\r\n var refractionTexture = this._getRefractionTexture(scene);\r\n if (refractionTexture && MaterialFlags.RefractionTextureEnabled) {\r\n defines.SS_REFRACTION = true;\r\n defines.SS_REFRACTIONMAP_3D = refractionTexture.isCube;\r\n defines.SS_GAMMAREFRACTION = refractionTexture.gammaSpace;\r\n defines.SS_RGBDREFRACTION = refractionTexture.isRGBD;\r\n defines.SS_LINEARSPECULARREFRACTION = refractionTexture.linearSpecularLOD;\r\n defines.SS_REFRACTIONMAP_OPPOSITEZ = refractionTexture.invertZ;\r\n defines.SS_LODINREFRACTIONALPHA = refractionTexture.lodLevelInAlpha;\r\n defines.SS_LINKREFRACTIONTOTRANSPARENCY = this._linkRefractionWithTransparency;\r\n defines.SS_ALBEDOFORREFRACTIONTINT = this.useAlbedoToTintRefraction;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param engine defines the engine the material belongs to.\r\n * @param isFrozen defines whether the material is frozen or not.\r\n * @param lodBasedMicrosurface defines whether the material relies on lod based microsurface or not.\r\n * @param realTimeFiltering defines whether the textures should be filtered on the fly.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, engine, isFrozen, lodBasedMicrosurface, realTimeFiltering) {\r\n var refractionTexture = this._getRefractionTexture(scene);\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (this._thicknessTexture && MaterialFlags.ThicknessTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vThicknessInfos\", this._thicknessTexture.coordinatesIndex, this._thicknessTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._thicknessTexture, uniformBuffer, \"thickness\");\r\n }\r\n uniformBuffer.updateFloat2(\"vThicknessParam\", this.minimumThickness, this.maximumThickness - this.minimumThickness);\r\n if (refractionTexture && MaterialFlags.RefractionTextureEnabled) {\r\n uniformBuffer.updateMatrix(\"refractionMatrix\", refractionTexture.getReflectionTextureMatrix());\r\n var depth = 1.0;\r\n if (!refractionTexture.isCube) {\r\n if (refractionTexture.depth) {\r\n depth = refractionTexture.depth;\r\n }\r\n }\r\n var width = refractionTexture.getSize().width;\r\n var refractionIor = this.volumeIndexOfRefraction;\r\n uniformBuffer.updateFloat4(\"vRefractionInfos\", refractionTexture.level, 1 / refractionIor, depth, this._invertRefractionY ? -1 : 1);\r\n uniformBuffer.updateFloat3(\"vRefractionMicrosurfaceInfos\", width, refractionTexture.lodGenerationScale, refractionTexture.lodGenerationOffset);\r\n if (realTimeFiltering) {\r\n uniformBuffer.updateFloat2(\"vRefractionFilteringInfo\", width, Scalar.Log2(width));\r\n }\r\n }\r\n if (this.isScatteringEnabled) {\r\n uniformBuffer.updateFloat(\"scatteringDiffusionProfile\", this._scatteringDiffusionProfileIndex);\r\n }\r\n uniformBuffer.updateColor3(\"vDiffusionDistance\", this.diffusionDistance);\r\n uniformBuffer.updateFloat4(\"vTintColor\", this.tintColor.r, this.tintColor.g, this.tintColor.b, this.tintColorAtDistance);\r\n uniformBuffer.updateFloat3(\"vSubSurfaceIntensity\", this.refractionIntensity, this.translucencyIntensity, 0);\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._thicknessTexture && MaterialFlags.ThicknessTextureEnabled) {\r\n uniformBuffer.setTexture(\"thicknessSampler\", this._thicknessTexture);\r\n }\r\n if (refractionTexture && MaterialFlags.RefractionTextureEnabled) {\r\n if (lodBasedMicrosurface) {\r\n uniformBuffer.setTexture(\"refractionSampler\", refractionTexture);\r\n }\r\n else {\r\n uniformBuffer.setTexture(\"refractionSampler\", refractionTexture._lodTextureMid || refractionTexture);\r\n uniformBuffer.setTexture(\"refractionSamplerLow\", refractionTexture._lodTextureLow || refractionTexture);\r\n uniformBuffer.setTexture(\"refractionSamplerHigh\", refractionTexture._lodTextureHigh || refractionTexture);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Unbinds the material from the mesh.\r\n * @param activeEffect defines the effect that should be unbound from.\r\n * @returns true if unbound, otherwise false\r\n */\r\n PBRSubSurfaceConfiguration.prototype.unbind = function (activeEffect) {\r\n if (this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n activeEffect.setTexture(\"refractionSampler\", null);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns the texture used for refraction or null if none is used.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - Refraction texture if present. If no refraction texture and refraction\r\n * is linked with transparency, returns environment texture. Otherwise, returns null.\r\n */\r\n PBRSubSurfaceConfiguration.prototype._getRefractionTexture = function (scene) {\r\n if (this._refractionTexture) {\r\n return this._refractionTexture;\r\n }\r\n if (this._isRefractionEnabled) {\r\n return scene.environmentTexture;\r\n }\r\n return null;\r\n };\r\n Object.defineProperty(PBRSubSurfaceConfiguration.prototype, \"disableAlphaBlending\", {\r\n /**\r\n * Returns true if alpha blending should be disabled.\r\n */\r\n get: function () {\r\n return this.isRefractionEnabled && this._linkRefractionWithTransparency;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Fills the list of render target textures.\r\n * @param renderTargets the list of render targets to update\r\n */\r\n PBRSubSurfaceConfiguration.prototype.fillRenderTargetTextures = function (renderTargets) {\r\n if (MaterialFlags.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n renderTargets.push(this._refractionTexture);\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._thicknessTexture === texture) {\r\n return true;\r\n }\r\n if (this._refractionTexture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n * @returns true if this uses a render target otherwise false.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.hasRenderTargetTextures = function () {\r\n if (MaterialFlags.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRSubSurfaceConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._thicknessTexture) {\r\n activeTextures.push(this._thicknessTexture);\r\n }\r\n if (this._refractionTexture) {\r\n activeTextures.push(this._refractionTexture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._thicknessTexture && this._thicknessTexture.animations && this._thicknessTexture.animations.length > 0) {\r\n animatables.push(this._thicknessTexture);\r\n }\r\n if (this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0) {\r\n animatables.push(this._refractionTexture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._thicknessTexture) {\r\n this._thicknessTexture.dispose();\r\n }\r\n if (this._refractionTexture) {\r\n this._refractionTexture.dispose();\r\n }\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRSubSurfaceConfiguration\"\r\n */\r\n PBRSubSurfaceConfiguration.prototype.getClassName = function () {\r\n return \"PBRSubSurfaceConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRSubSurfaceConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.SS_SCATTERING) {\r\n fallbacks.addFallback(currentRank++, \"SS_SCATTERING\");\r\n }\r\n if (defines.SS_TRANSLUCENCY) {\r\n fallbacks.addFallback(currentRank++, \"SS_TRANSLUCENCY\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRSubSurfaceConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vDiffusionDistance\", \"vTintColor\", \"vSubSurfaceIntensity\", \"vRefractionMicrosurfaceInfos\", \"vRefractionFilteringInfo\", \"vRefractionInfos\", \"vThicknessInfos\", \"vThicknessParam\", \"refractionMatrix\", \"thicknessMatrix\", \"scatteringDiffusionProfile\");\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRSubSurfaceConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"thicknessSampler\", \"refractionSampler\", \"refractionSamplerLow\", \"refractionSamplerHigh\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRSubSurfaceConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vRefractionMicrosurfaceInfos\", 3);\r\n uniformBuffer.addUniform(\"vRefractionFilteringInfo\", 2);\r\n uniformBuffer.addUniform(\"vRefractionInfos\", 4);\r\n uniformBuffer.addUniform(\"refractionMatrix\", 16);\r\n uniformBuffer.addUniform(\"vThicknessInfos\", 2);\r\n uniformBuffer.addUniform(\"thicknessMatrix\", 16);\r\n uniformBuffer.addUniform(\"vThicknessParam\", 2);\r\n uniformBuffer.addUniform(\"vDiffusionDistance\", 3);\r\n uniformBuffer.addUniform(\"vTintColor\", 4);\r\n uniformBuffer.addUniform(\"vSubSurfaceIntensity\", 3);\r\n uniformBuffer.addUniform(\"scatteringDiffusionProfile\", 1);\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param configuration define the config where to copy the info\r\n */\r\n PBRSubSurfaceConfiguration.prototype.copyTo = function (configuration) {\r\n SerializationHelper.Clone(function () { return configuration; }, this);\r\n };\r\n /**\r\n * Serializes this Sub Surface configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRSubSurfaceConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n SerializationHelper.Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"isRefractionEnabled\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"isTranslucencyEnabled\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markScenePrePassDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"isScatteringEnabled\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"_scatteringDiffusionProfileIndex\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"refractionIntensity\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"translucencyIntensity\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"useAlbedoToTintRefraction\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"thicknessTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"refractionTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"indexOfRefraction\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"_volumeIndexOfRefraction\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"volumeIndexOfRefraction\", null);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"invertRefractionY\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"linkRefractionWithTransparency\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"minimumThickness\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"maximumThickness\", void 0);\r\n __decorate([\r\n serializeAsColor3()\r\n ], PBRSubSurfaceConfiguration.prototype, \"tintColor\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"tintColorAtDistance\", void 0);\r\n __decorate([\r\n serializeAsColor3()\r\n ], PBRSubSurfaceConfiguration.prototype, \"diffusionDistance\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"useMaskFromThicknessTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"useMaskFromThicknessTextureGltf\", void 0);\r\n return PBRSubSurfaceConfiguration;\r\n}());\r\nexport { PBRSubSurfaceConfiguration };\r\n//# sourceMappingURL=pbrSubSurfaceConfiguration.js.map","import { Vector3 } from \"../Maths/math.vector\";\r\n// https://dickyjim.wordpress.com/2013/09/04/spherical-harmonics-for-beginners/\r\n// http://silviojemma.com/public/papers/lighting/spherical-harmonic-lighting.pdf\r\n// https://www.ppsloan.org/publications/StupidSH36.pdf\r\n// http://cseweb.ucsd.edu/~ravir/papers/envmap/envmap.pdf\r\n// https://www.ppsloan.org/publications/SHJCGT.pdf\r\n// https://www.ppsloan.org/publications/shdering.pdf\r\n// https://google.github.io/filament/Filament.md.html#annex/sphericalharmonics\r\n// https://patapom.com/blog/SHPortal/\r\n// https://imdoingitwrong.wordpress.com/2011/04/14/spherical-harmonics-wtf/\r\n// Using real SH basis:\r\n// m>0 m m\r\n// y = sqrt(2) * K * P * cos(m*phi) * cos(theta)\r\n// l l l\r\n//\r\n// m<0 m |m|\r\n// y = sqrt(2) * K * P * sin(m*phi) * cos(theta)\r\n// l l l\r\n//\r\n// m=0 0 0\r\n// y = K * P * trigono terms\r\n// l l l\r\n//\r\n// m (2l + 1)(l - |m|)!\r\n// K = sqrt(------------------)\r\n// l 4pi(l + |m|)!\r\n//\r\n// and P by recursion:\r\n//\r\n// P00(x) = 1\r\n// P01(x) = x\r\n// Pll(x) = (-1^l)(2l - 1)!!(1-x*x)^(1/2)\r\n// ((2l - 1)x[Pl-1/m]-(l + m - 1)[Pl-2/m])\r\n// Plm(x) = ---------------------------------------\r\n// l - m\r\n// Leaving the trigonometric terms aside we can precompute the constants to :\r\nvar SH3ylmBasisConstants = [\r\n Math.sqrt(1 / (4 * Math.PI)),\r\n -Math.sqrt(3 / (4 * Math.PI)),\r\n Math.sqrt(3 / (4 * Math.PI)),\r\n -Math.sqrt(3 / (4 * Math.PI)),\r\n Math.sqrt(15 / (4 * Math.PI)),\r\n -Math.sqrt(15 / (4 * Math.PI)),\r\n Math.sqrt(5 / (16 * Math.PI)),\r\n -Math.sqrt(15 / (4 * Math.PI)),\r\n Math.sqrt(15 / (16 * Math.PI)),\r\n];\r\n// cm = cos(m * phi)\r\n// sm = sin(m * phi)\r\n// {x,y,z} = {cos(phi)sin(theta), sin(phi)sin(theta), cos(theta)}\r\n// By recursion on using trigo identities:\r\nvar SH3ylmBasisTrigonometricTerms = [\r\n function (direction) { return 1; },\r\n function (direction) { return direction.y; },\r\n function (direction) { return direction.z; },\r\n function (direction) { return direction.x; },\r\n function (direction) { return direction.x * direction.y; },\r\n function (direction) { return direction.y * direction.z; },\r\n function (direction) { return 3 * direction.z * direction.z - 1; },\r\n function (direction) { return direction.x * direction.z; },\r\n function (direction) { return direction.x * direction.x - direction.y * direction.y; },\r\n];\r\n// Wrap the full compute\r\nvar applySH3 = function (lm, direction) {\r\n return SH3ylmBasisConstants[lm] * SH3ylmBasisTrigonometricTerms[lm](direction);\r\n};\r\n// Derived from the integration of the a kernel convolution to SH.\r\n// Great explanation here: https://patapom.com/blog/SHPortal/#about-distant-radiance-and-irradiance-environments\r\nvar SHCosKernelConvolution = [\r\n Math.PI,\r\n 2 * Math.PI / 3,\r\n 2 * Math.PI / 3,\r\n 2 * Math.PI / 3,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n];\r\n/**\r\n * Class representing spherical harmonics coefficients to the 3rd degree\r\n */\r\nvar SphericalHarmonics = /** @class */ (function () {\r\n function SphericalHarmonics() {\r\n /**\r\n * Defines whether or not the harmonics have been prescaled for rendering.\r\n */\r\n this.preScaled = false;\r\n /**\r\n * The l0,0 coefficients of the spherical harmonics\r\n */\r\n this.l00 = Vector3.Zero();\r\n /**\r\n * The l1,-1 coefficients of the spherical harmonics\r\n */\r\n this.l1_1 = Vector3.Zero();\r\n /**\r\n * The l1,0 coefficients of the spherical harmonics\r\n */\r\n this.l10 = Vector3.Zero();\r\n /**\r\n * The l1,1 coefficients of the spherical harmonics\r\n */\r\n this.l11 = Vector3.Zero();\r\n /**\r\n * The l2,-2 coefficients of the spherical harmonics\r\n */\r\n this.l2_2 = Vector3.Zero();\r\n /**\r\n * The l2,-1 coefficients of the spherical harmonics\r\n */\r\n this.l2_1 = Vector3.Zero();\r\n /**\r\n * The l2,0 coefficients of the spherical harmonics\r\n */\r\n this.l20 = Vector3.Zero();\r\n /**\r\n * The l2,1 coefficients of the spherical harmonics\r\n */\r\n this.l21 = Vector3.Zero();\r\n /**\r\n * The l2,2 coefficients of the spherical harmonics\r\n */\r\n this.l22 = Vector3.Zero();\r\n }\r\n /**\r\n * Adds a light to the spherical harmonics\r\n * @param direction the direction of the light\r\n * @param color the color of the light\r\n * @param deltaSolidAngle the delta solid angle of the light\r\n */\r\n SphericalHarmonics.prototype.addLight = function (direction, color, deltaSolidAngle) {\r\n var colorVector = new Vector3(color.r, color.g, color.b);\r\n var c = colorVector.scale(deltaSolidAngle);\r\n this.l00 = this.l00.add(c.scale(applySH3(0, direction)));\r\n this.l1_1 = this.l1_1.add(c.scale(applySH3(1, direction)));\r\n this.l10 = this.l10.add(c.scale(applySH3(2, direction)));\r\n this.l11 = this.l11.add(c.scale(applySH3(3, direction)));\r\n this.l2_2 = this.l2_2.add(c.scale(applySH3(4, direction)));\r\n this.l2_1 = this.l2_1.add(c.scale(applySH3(5, direction)));\r\n this.l20 = this.l20.add(c.scale(applySH3(6, direction)));\r\n this.l21 = this.l21.add(c.scale(applySH3(7, direction)));\r\n this.l22 = this.l22.add(c.scale(applySH3(8, direction)));\r\n };\r\n /**\r\n * Scales the spherical harmonics by the given amount\r\n * @param scale the amount to scale\r\n */\r\n SphericalHarmonics.prototype.scaleInPlace = function (scale) {\r\n this.l00.scaleInPlace(scale);\r\n this.l1_1.scaleInPlace(scale);\r\n this.l10.scaleInPlace(scale);\r\n this.l11.scaleInPlace(scale);\r\n this.l2_2.scaleInPlace(scale);\r\n this.l2_1.scaleInPlace(scale);\r\n this.l20.scaleInPlace(scale);\r\n this.l21.scaleInPlace(scale);\r\n this.l22.scaleInPlace(scale);\r\n };\r\n /**\r\n * Convert from incident radiance (Li) to irradiance (E) by applying convolution with the cosine-weighted hemisphere.\r\n *\r\n * ```\r\n * E_lm = A_l * L_lm\r\n * ```\r\n *\r\n * In spherical harmonics this convolution amounts to scaling factors for each frequency band.\r\n * This corresponds to equation 5 in \"An Efficient Representation for Irradiance Environment Maps\", where\r\n * the scaling factors are given in equation 9.\r\n */\r\n SphericalHarmonics.prototype.convertIncidentRadianceToIrradiance = function () {\r\n // Constant (Band 0)\r\n this.l00.scaleInPlace(SHCosKernelConvolution[0]);\r\n // Linear (Band 1)\r\n this.l1_1.scaleInPlace(SHCosKernelConvolution[1]);\r\n this.l10.scaleInPlace(SHCosKernelConvolution[2]);\r\n this.l11.scaleInPlace(SHCosKernelConvolution[3]);\r\n // Quadratic (Band 2)\r\n this.l2_2.scaleInPlace(SHCosKernelConvolution[4]);\r\n this.l2_1.scaleInPlace(SHCosKernelConvolution[5]);\r\n this.l20.scaleInPlace(SHCosKernelConvolution[6]);\r\n this.l21.scaleInPlace(SHCosKernelConvolution[7]);\r\n this.l22.scaleInPlace(SHCosKernelConvolution[8]);\r\n };\r\n /**\r\n * Convert from irradiance to outgoing radiance for Lambertian BDRF, suitable for efficient shader evaluation.\r\n *\r\n * ```\r\n * L = (1/pi) * E * rho\r\n * ```\r\n *\r\n * This is done by an additional scale by 1/pi, so is a fairly trivial operation but important conceptually.\r\n */\r\n SphericalHarmonics.prototype.convertIrradianceToLambertianRadiance = function () {\r\n this.scaleInPlace(1.0 / Math.PI);\r\n // The resultant SH now represents outgoing radiance, so includes the Lambert 1/pi normalisation factor but without albedo (rho) applied\r\n // (The pixel shader must apply albedo after texture fetches, etc).\r\n };\r\n /**\r\n * Integrates the reconstruction coefficients directly in to the SH preventing further\r\n * required operations at run time.\r\n *\r\n * This is simply done by scaling back the SH with Ylm constants parameter.\r\n * The trigonometric part being applied by the shader at run time.\r\n */\r\n SphericalHarmonics.prototype.preScaleForRendering = function () {\r\n this.preScaled = true;\r\n this.l00.scaleInPlace(SH3ylmBasisConstants[0]);\r\n this.l1_1.scaleInPlace(SH3ylmBasisConstants[1]);\r\n this.l10.scaleInPlace(SH3ylmBasisConstants[2]);\r\n this.l11.scaleInPlace(SH3ylmBasisConstants[3]);\r\n this.l2_2.scaleInPlace(SH3ylmBasisConstants[4]);\r\n this.l2_1.scaleInPlace(SH3ylmBasisConstants[5]);\r\n this.l20.scaleInPlace(SH3ylmBasisConstants[6]);\r\n this.l21.scaleInPlace(SH3ylmBasisConstants[7]);\r\n this.l22.scaleInPlace(SH3ylmBasisConstants[8]);\r\n };\r\n /**\r\n * Constructs a spherical harmonics from an array.\r\n * @param data defines the 9x3 coefficients (l00, l1-1, l10, l11, l2-2, l2-1, l20, l21, l22)\r\n * @returns the spherical harmonics\r\n */\r\n SphericalHarmonics.FromArray = function (data) {\r\n var sh = new SphericalHarmonics();\r\n Vector3.FromArrayToRef(data[0], 0, sh.l00);\r\n Vector3.FromArrayToRef(data[1], 0, sh.l1_1);\r\n Vector3.FromArrayToRef(data[2], 0, sh.l10);\r\n Vector3.FromArrayToRef(data[3], 0, sh.l11);\r\n Vector3.FromArrayToRef(data[4], 0, sh.l2_2);\r\n Vector3.FromArrayToRef(data[5], 0, sh.l2_1);\r\n Vector3.FromArrayToRef(data[6], 0, sh.l20);\r\n Vector3.FromArrayToRef(data[7], 0, sh.l21);\r\n Vector3.FromArrayToRef(data[8], 0, sh.l22);\r\n return sh;\r\n };\r\n // Keep for references.\r\n /**\r\n * Gets the spherical harmonics from polynomial\r\n * @param polynomial the spherical polynomial\r\n * @returns the spherical harmonics\r\n */\r\n SphericalHarmonics.FromPolynomial = function (polynomial) {\r\n var result = new SphericalHarmonics();\r\n result.l00 = polynomial.xx.scale(0.376127).add(polynomial.yy.scale(0.376127)).add(polynomial.zz.scale(0.376126));\r\n result.l1_1 = polynomial.y.scale(0.977204);\r\n result.l10 = polynomial.z.scale(0.977204);\r\n result.l11 = polynomial.x.scale(0.977204);\r\n result.l2_2 = polynomial.xy.scale(1.16538);\r\n result.l2_1 = polynomial.yz.scale(1.16538);\r\n result.l20 = polynomial.zz.scale(1.34567).subtract(polynomial.xx.scale(0.672834)).subtract(polynomial.yy.scale(0.672834));\r\n result.l21 = polynomial.zx.scale(1.16538);\r\n result.l22 = polynomial.xx.scale(1.16538).subtract(polynomial.yy.scale(1.16538));\r\n result.l1_1.scaleInPlace(-1);\r\n result.l11.scaleInPlace(-1);\r\n result.l2_1.scaleInPlace(-1);\r\n result.l21.scaleInPlace(-1);\r\n result.scaleInPlace(Math.PI);\r\n return result;\r\n };\r\n return SphericalHarmonics;\r\n}());\r\nexport { SphericalHarmonics };\r\n/**\r\n * Class representing spherical polynomial coefficients to the 3rd degree\r\n */\r\nvar SphericalPolynomial = /** @class */ (function () {\r\n function SphericalPolynomial() {\r\n /**\r\n * The x coefficients of the spherical polynomial\r\n */\r\n this.x = Vector3.Zero();\r\n /**\r\n * The y coefficients of the spherical polynomial\r\n */\r\n this.y = Vector3.Zero();\r\n /**\r\n * The z coefficients of the spherical polynomial\r\n */\r\n this.z = Vector3.Zero();\r\n /**\r\n * The xx coefficients of the spherical polynomial\r\n */\r\n this.xx = Vector3.Zero();\r\n /**\r\n * The yy coefficients of the spherical polynomial\r\n */\r\n this.yy = Vector3.Zero();\r\n /**\r\n * The zz coefficients of the spherical polynomial\r\n */\r\n this.zz = Vector3.Zero();\r\n /**\r\n * The xy coefficients of the spherical polynomial\r\n */\r\n this.xy = Vector3.Zero();\r\n /**\r\n * The yz coefficients of the spherical polynomial\r\n */\r\n this.yz = Vector3.Zero();\r\n /**\r\n * The zx coefficients of the spherical polynomial\r\n */\r\n this.zx = Vector3.Zero();\r\n }\r\n Object.defineProperty(SphericalPolynomial.prototype, \"preScaledHarmonics\", {\r\n /**\r\n * The spherical harmonics used to create the polynomials.\r\n */\r\n get: function () {\r\n if (!this._harmonics) {\r\n this._harmonics = SphericalHarmonics.FromPolynomial(this);\r\n }\r\n if (!this._harmonics.preScaled) {\r\n this._harmonics.preScaleForRendering();\r\n }\r\n return this._harmonics;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Adds an ambient color to the spherical polynomial\r\n * @param color the color to add\r\n */\r\n SphericalPolynomial.prototype.addAmbient = function (color) {\r\n var colorVector = new Vector3(color.r, color.g, color.b);\r\n this.xx = this.xx.add(colorVector);\r\n this.yy = this.yy.add(colorVector);\r\n this.zz = this.zz.add(colorVector);\r\n };\r\n /**\r\n * Scales the spherical polynomial by the given amount\r\n * @param scale the amount to scale\r\n */\r\n SphericalPolynomial.prototype.scaleInPlace = function (scale) {\r\n this.x.scaleInPlace(scale);\r\n this.y.scaleInPlace(scale);\r\n this.z.scaleInPlace(scale);\r\n this.xx.scaleInPlace(scale);\r\n this.yy.scaleInPlace(scale);\r\n this.zz.scaleInPlace(scale);\r\n this.yz.scaleInPlace(scale);\r\n this.zx.scaleInPlace(scale);\r\n this.xy.scaleInPlace(scale);\r\n };\r\n /**\r\n * Gets the spherical polynomial from harmonics\r\n * @param harmonics the spherical harmonics\r\n * @returns the spherical polynomial\r\n */\r\n SphericalPolynomial.FromHarmonics = function (harmonics) {\r\n var result = new SphericalPolynomial();\r\n result._harmonics = harmonics;\r\n result.x = harmonics.l11.scale(1.02333).scale(-1);\r\n result.y = harmonics.l1_1.scale(1.02333).scale(-1);\r\n result.z = harmonics.l10.scale(1.02333);\r\n result.xx = harmonics.l00.scale(0.886277).subtract(harmonics.l20.scale(0.247708)).add(harmonics.l22.scale(0.429043));\r\n result.yy = harmonics.l00.scale(0.886277).subtract(harmonics.l20.scale(0.247708)).subtract(harmonics.l22.scale(0.429043));\r\n result.zz = harmonics.l00.scale(0.886277).add(harmonics.l20.scale(0.495417));\r\n result.yz = harmonics.l2_1.scale(0.858086).scale(-1);\r\n result.zx = harmonics.l21.scale(0.858086).scale(-1);\r\n result.xy = harmonics.l2_2.scale(0.858086);\r\n result.scaleInPlace(1.0 / Math.PI);\r\n return result;\r\n };\r\n /**\r\n * Constructs a spherical polynomial from an array.\r\n * @param data defines the 9x3 coefficients (x, y, z, xx, yy, zz, yz, zx, xy)\r\n * @returns the spherical polynomial\r\n */\r\n SphericalPolynomial.FromArray = function (data) {\r\n var sp = new SphericalPolynomial();\r\n Vector3.FromArrayToRef(data[0], 0, sp.x);\r\n Vector3.FromArrayToRef(data[1], 0, sp.y);\r\n Vector3.FromArrayToRef(data[2], 0, sp.z);\r\n Vector3.FromArrayToRef(data[3], 0, sp.xx);\r\n Vector3.FromArrayToRef(data[4], 0, sp.yy);\r\n Vector3.FromArrayToRef(data[5], 0, sp.zz);\r\n Vector3.FromArrayToRef(data[6], 0, sp.yz);\r\n Vector3.FromArrayToRef(data[7], 0, sp.zx);\r\n Vector3.FromArrayToRef(data[8], 0, sp.xy);\r\n return sp;\r\n };\r\n return SphericalPolynomial;\r\n}());\r\nexport { SphericalPolynomial };\r\n//# sourceMappingURL=sphericalPolynomial.js.map","import { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Scalar } from \"../../Maths/math.scalar\";\r\nimport { SphericalPolynomial, SphericalHarmonics } from \"../../Maths/sphericalPolynomial\";\r\nimport { ToLinearSpace } from '../../Maths/math.constants';\r\nimport { Color3 } from '../../Maths/math.color';\r\nvar FileFaceOrientation = /** @class */ (function () {\r\n function FileFaceOrientation(name, worldAxisForNormal, worldAxisForFileX, worldAxisForFileY) {\r\n this.name = name;\r\n this.worldAxisForNormal = worldAxisForNormal;\r\n this.worldAxisForFileX = worldAxisForFileX;\r\n this.worldAxisForFileY = worldAxisForFileY;\r\n }\r\n return FileFaceOrientation;\r\n}());\r\n/**\r\n * Helper class dealing with the extraction of spherical polynomial dataArray\r\n * from a cube map.\r\n */\r\nvar CubeMapToSphericalPolynomialTools = /** @class */ (function () {\r\n function CubeMapToSphericalPolynomialTools() {\r\n }\r\n /**\r\n * Converts a texture to the according Spherical Polynomial data.\r\n * This extracts the first 3 orders only as they are the only one used in the lighting.\r\n *\r\n * @param texture The texture to extract the information from.\r\n * @return The Spherical Polynomial data.\r\n */\r\n CubeMapToSphericalPolynomialTools.ConvertCubeMapTextureToSphericalPolynomial = function (texture) {\r\n if (!texture.isCube) {\r\n // Only supports cube Textures currently.\r\n return null;\r\n }\r\n var size = texture.getSize().width;\r\n var right = texture.readPixels(0);\r\n var left = texture.readPixels(1);\r\n var up;\r\n var down;\r\n if (texture.isRenderTarget) {\r\n up = texture.readPixels(3);\r\n down = texture.readPixels(2);\r\n }\r\n else {\r\n up = texture.readPixels(2);\r\n down = texture.readPixels(3);\r\n }\r\n var front = texture.readPixels(4);\r\n var back = texture.readPixels(5);\r\n var gammaSpace = texture.gammaSpace;\r\n // Always read as RGBA.\r\n var format = 5;\r\n var type = 0;\r\n if (texture.textureType == 1 || texture.textureType == 2) {\r\n type = 1;\r\n }\r\n var cubeInfo = {\r\n size: size,\r\n right: right,\r\n left: left,\r\n up: up,\r\n down: down,\r\n front: front,\r\n back: back,\r\n format: format,\r\n type: type,\r\n gammaSpace: gammaSpace,\r\n };\r\n return this.ConvertCubeMapToSphericalPolynomial(cubeInfo);\r\n };\r\n /**\r\n * Converts a cubemap to the according Spherical Polynomial data.\r\n * This extracts the first 3 orders only as they are the only one used in the lighting.\r\n *\r\n * @param cubeInfo The Cube map to extract the information from.\r\n * @return The Spherical Polynomial data.\r\n */\r\n CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial = function (cubeInfo) {\r\n var sphericalHarmonics = new SphericalHarmonics();\r\n var totalSolidAngle = 0.0;\r\n // The (u,v) range is [-1,+1], so the distance between each texel is 2/Size.\r\n var du = 2.0 / cubeInfo.size;\r\n var dv = du;\r\n // The (u,v) of the first texel is half a texel from the corner (-1,-1).\r\n var minUV = du * 0.5 - 1.0;\r\n for (var faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n var fileFace = this.FileFaces[faceIndex];\r\n var dataArray = cubeInfo[fileFace.name];\r\n var v = minUV;\r\n // TODO: we could perform the summation directly into a SphericalPolynomial (SP), which is more efficient than SphericalHarmonic (SH).\r\n // This is possible because during the summation we do not need the SH-specific properties, e.g. orthogonality.\r\n // Because SP is still linear, so summation is fine in that basis.\r\n var stride = cubeInfo.format === 5 ? 4 : 3;\r\n for (var y = 0; y < cubeInfo.size; y++) {\r\n var u = minUV;\r\n for (var x = 0; x < cubeInfo.size; x++) {\r\n // World direction (not normalised)\r\n var worldDirection = fileFace.worldAxisForFileX.scale(u).add(fileFace.worldAxisForFileY.scale(v)).add(fileFace.worldAxisForNormal);\r\n worldDirection.normalize();\r\n var deltaSolidAngle = Math.pow(1.0 + u * u + v * v, -3.0 / 2.0);\r\n var r = dataArray[(y * cubeInfo.size * stride) + (x * stride) + 0];\r\n var g = dataArray[(y * cubeInfo.size * stride) + (x * stride) + 1];\r\n var b = dataArray[(y * cubeInfo.size * stride) + (x * stride) + 2];\r\n // Prevent NaN harmonics with extreme HDRI data.\r\n if (isNaN(r)) {\r\n r = 0;\r\n }\r\n if (isNaN(g)) {\r\n g = 0;\r\n }\r\n if (isNaN(b)) {\r\n b = 0;\r\n }\r\n // Handle Integer types.\r\n if (cubeInfo.type === 0) {\r\n r /= 255;\r\n g /= 255;\r\n b /= 255;\r\n }\r\n // Handle Gamma space textures.\r\n if (cubeInfo.gammaSpace) {\r\n r = Math.pow(Scalar.Clamp(r), ToLinearSpace);\r\n g = Math.pow(Scalar.Clamp(g), ToLinearSpace);\r\n b = Math.pow(Scalar.Clamp(b), ToLinearSpace);\r\n }\r\n // Prevent to explode in case of really high dynamic ranges.\r\n // sh 3 would not be enough to accurately represent it.\r\n var max = 4096;\r\n r = Scalar.Clamp(r, 0, max);\r\n g = Scalar.Clamp(g, 0, max);\r\n b = Scalar.Clamp(b, 0, max);\r\n var color = new Color3(r, g, b);\r\n sphericalHarmonics.addLight(worldDirection, color, deltaSolidAngle);\r\n totalSolidAngle += deltaSolidAngle;\r\n u += du;\r\n }\r\n v += dv;\r\n }\r\n }\r\n // Solid angle for entire sphere is 4*pi\r\n var sphereSolidAngle = 4.0 * Math.PI;\r\n // Adjust the solid angle to allow for how many faces we processed.\r\n var facesProcessed = 6.0;\r\n var expectedSolidAngle = sphereSolidAngle * facesProcessed / 6.0;\r\n // Adjust the harmonics so that the accumulated solid angle matches the expected solid angle.\r\n // This is needed because the numerical integration over the cube uses a\r\n // small angle approximation of solid angle for each texel (see deltaSolidAngle),\r\n // and also to compensate for accumulative error due to float precision in the summation.\r\n var correctionFactor = expectedSolidAngle / totalSolidAngle;\r\n sphericalHarmonics.scaleInPlace(correctionFactor);\r\n sphericalHarmonics.convertIncidentRadianceToIrradiance();\r\n sphericalHarmonics.convertIrradianceToLambertianRadiance();\r\n return SphericalPolynomial.FromHarmonics(sphericalHarmonics);\r\n };\r\n CubeMapToSphericalPolynomialTools.FileFaces = [\r\n new FileFaceOrientation(\"right\", new Vector3(1, 0, 0), new Vector3(0, 0, -1), new Vector3(0, -1, 0)),\r\n new FileFaceOrientation(\"left\", new Vector3(-1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, -1, 0)),\r\n new FileFaceOrientation(\"up\", new Vector3(0, 1, 0), new Vector3(1, 0, 0), new Vector3(0, 0, 1)),\r\n new FileFaceOrientation(\"down\", new Vector3(0, -1, 0), new Vector3(1, 0, 0), new Vector3(0, 0, -1)),\r\n new FileFaceOrientation(\"front\", new Vector3(0, 0, 1), new Vector3(1, 0, 0), new Vector3(0, -1, 0)),\r\n new FileFaceOrientation(\"back\", new Vector3(0, 0, -1), new Vector3(-1, 0, 0), new Vector3(0, -1, 0)) // -Z bottom\r\n ];\r\n return CubeMapToSphericalPolynomialTools;\r\n}());\r\nexport { CubeMapToSphericalPolynomialTools };\r\n//# sourceMappingURL=cubemapToSphericalPolynomial.js.map","import { CubeMapToSphericalPolynomialTools } from \"../../Misc/HighDynamicRange/cubemapToSphericalPolynomial\";\r\nimport { BaseTexture } from \"./baseTexture\";\r\nObject.defineProperty(BaseTexture.prototype, \"sphericalPolynomial\", {\r\n get: function () {\r\n if (this._texture) {\r\n if (this._texture._sphericalPolynomial) {\r\n return this._texture._sphericalPolynomial;\r\n }\r\n if (this._texture.isReady) {\r\n this._texture._sphericalPolynomial =\r\n CubeMapToSphericalPolynomialTools.ConvertCubeMapTextureToSphericalPolynomial(this);\r\n return this._texture._sphericalPolynomial;\r\n }\r\n }\r\n return null;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._sphericalPolynomial = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n//# sourceMappingURL=baseTexture.polynomial.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrFragmentDeclaration';\r\nvar shader = \"uniform vec3 vReflectionColor;\\nuniform vec4 vAlbedoColor;\\n\\nuniform vec4 vLightingIntensity;\\nuniform vec4 vReflectivityColor;\\nuniform vec4 vMetallicReflectanceFactors;\\nuniform vec3 vEmissiveColor;\\nuniform float visibility;\\n\\n#ifdef ALBEDO\\nuniform vec2 vAlbedoInfos;\\n#endif\\n#ifdef AMBIENT\\nuniform vec4 vAmbientInfos;\\n#endif\\n#ifdef BUMP\\nuniform vec3 vBumpInfos;\\nuniform vec2 vTangentSpaceParams;\\n#endif\\n#ifdef OPACITY\\nuniform vec2 vOpacityInfos;\\n#endif\\n#ifdef EMISSIVE\\nuniform vec2 vEmissiveInfos;\\n#endif\\n#ifdef LIGHTMAP\\nuniform vec2 vLightmapInfos;\\n#endif\\n#ifdef REFLECTIVITY\\nuniform vec3 vReflectivityInfos;\\n#endif\\n#ifdef MICROSURFACEMAP\\nuniform vec2 vMicroSurfaceSamplerInfos;\\n#endif\\n\\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(SS_REFRACTION)\\nuniform mat4 view;\\n#endif\\n\\n#ifdef REFLECTION\\nuniform vec2 vReflectionInfos;\\n#ifdef REALTIME_FILTERING\\nuniform vec2 vReflectionFilteringInfo;\\n#endif\\nuniform mat4 reflectionMatrix;\\nuniform vec3 vReflectionMicrosurfaceInfos;\\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\\nuniform vec3 vReflectionPosition;\\nuniform vec3 vReflectionSize;\\n#endif\\n#endif\\n\\n#ifdef CLEARCOAT\\nuniform vec2 vClearCoatParams;\\nuniform vec4 vClearCoatRefractionParams;\\n#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)\\nuniform vec4 vClearCoatInfos;\\n#endif\\n#ifdef CLEARCOAT_TEXTURE\\nuniform mat4 clearCoatMatrix;\\n#endif\\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS\\nuniform mat4 clearCoatRoughnessMatrix;\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nuniform vec2 vClearCoatBumpInfos;\\nuniform vec2 vClearCoatTangentSpaceParams;\\nuniform mat4 clearCoatBumpMatrix;\\n#endif\\n#ifdef CLEARCOAT_TINT\\nuniform vec4 vClearCoatTintParams;\\nuniform float clearCoatColorAtDistance;\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nuniform vec2 vClearCoatTintInfos;\\nuniform mat4 clearCoatTintMatrix;\\n#endif\\n#endif\\n#endif\\n\\n#ifdef ANISOTROPIC\\nuniform vec3 vAnisotropy;\\n#ifdef ANISOTROPIC_TEXTURE\\nuniform vec2 vAnisotropyInfos;\\nuniform mat4 anisotropyMatrix;\\n#endif\\n#endif\\n\\n#ifdef SHEEN\\nuniform vec4 vSheenColor;\\n#ifdef SHEEN_ROUGHNESS\\nuniform float vSheenRoughness;\\n#endif\\n#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)\\nuniform vec4 vSheenInfos;\\n#endif\\n#ifdef SHEEN_TEXTURE\\nuniform mat4 sheenMatrix;\\n#endif\\n#ifdef SHEEN_TEXTURE_ROUGHNESS\\nuniform mat4 sheenRoughnessMatrix;\\n#endif\\n#endif\\n\\n#ifdef SUBSURFACE\\n#ifdef SS_REFRACTION\\nuniform vec3 vRefractionMicrosurfaceInfos;\\nuniform vec4 vRefractionInfos;\\nuniform mat4 refractionMatrix;\\n#ifdef REALTIME_FILTERING\\nuniform vec2 vRefractionFilteringInfo;\\n#endif\\n#endif\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nuniform vec2 vThicknessInfos;\\nuniform mat4 thicknessMatrix;\\n#endif\\nuniform vec2 vThicknessParam;\\nuniform vec3 vDiffusionDistance;\\nuniform vec4 vTintColor;\\nuniform vec3 vSubSurfaceIntensity;\\n#endif\\n#ifdef PREPASS\\n#ifdef PREPASS_IRRADIANCE\\nuniform float scatteringDiffusionProfile;\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrFragmentDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrFragmentDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrUboDeclaration';\r\nvar shader = \"layout(std140,column_major) uniform;\\nuniform Material\\n{\\nuniform vec2 vAlbedoInfos;\\nuniform vec4 vAmbientInfos;\\nuniform vec2 vOpacityInfos;\\nuniform vec2 vEmissiveInfos;\\nuniform vec2 vLightmapInfos;\\nuniform vec3 vReflectivityInfos;\\nuniform vec2 vMicroSurfaceSamplerInfos;\\nuniform vec2 vReflectionInfos;\\nuniform vec2 vReflectionFilteringInfo;\\nuniform vec3 vReflectionPosition;\\nuniform vec3 vReflectionSize;\\nuniform vec3 vBumpInfos;\\nuniform mat4 albedoMatrix;\\nuniform mat4 ambientMatrix;\\nuniform mat4 opacityMatrix;\\nuniform mat4 emissiveMatrix;\\nuniform mat4 lightmapMatrix;\\nuniform mat4 reflectivityMatrix;\\nuniform mat4 microSurfaceSamplerMatrix;\\nuniform mat4 bumpMatrix;\\nuniform vec2 vTangentSpaceParams;\\nuniform mat4 reflectionMatrix;\\nuniform vec3 vReflectionColor;\\nuniform vec4 vAlbedoColor;\\nuniform vec4 vLightingIntensity;\\nuniform vec3 vReflectionMicrosurfaceInfos;\\nuniform float pointSize;\\nuniform vec4 vReflectivityColor;\\nuniform vec3 vEmissiveColor;\\nuniform float visibility;\\nuniform vec4 vMetallicReflectanceFactors;\\nuniform vec2 vMetallicReflectanceInfos;\\nuniform mat4 metallicReflectanceMatrix;\\nuniform vec2 vClearCoatParams;\\nuniform vec4 vClearCoatRefractionParams;\\nuniform vec4 vClearCoatInfos;\\nuniform mat4 clearCoatMatrix;\\nuniform mat4 clearCoatRoughnessMatrix;\\nuniform vec2 vClearCoatBumpInfos;\\nuniform vec2 vClearCoatTangentSpaceParams;\\nuniform mat4 clearCoatBumpMatrix;\\nuniform vec4 vClearCoatTintParams;\\nuniform float clearCoatColorAtDistance;\\nuniform vec2 vClearCoatTintInfos;\\nuniform mat4 clearCoatTintMatrix;\\nuniform vec3 vAnisotropy;\\nuniform vec2 vAnisotropyInfos;\\nuniform mat4 anisotropyMatrix;\\nuniform vec4 vSheenColor;\\nuniform float vSheenRoughness;\\nuniform vec4 vSheenInfos;\\nuniform mat4 sheenMatrix;\\nuniform mat4 sheenRoughnessMatrix;\\nuniform vec3 vRefractionMicrosurfaceInfos;\\nuniform vec2 vRefractionFilteringInfo;\\nuniform vec4 vRefractionInfos;\\nuniform mat4 refractionMatrix;\\nuniform vec2 vThicknessInfos;\\nuniform mat4 thicknessMatrix;\\nuniform vec2 vThicknessParam;\\nuniform vec3 vDiffusionDistance;\\nuniform vec4 vTintColor;\\nuniform vec3 vSubSurfaceIntensity;\\nuniform float scatteringDiffusionProfile;\\nuniform vec4 vDetailInfos;\\nuniform mat4 detailMatrix;\\n};\\nuniform Scene {\\nmat4 viewProjection;\\n#ifdef MULTIVIEW\\nmat4 viewProjectionR;\\n#endif\\nmat4 view;\\n};\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrUboDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrUboDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrFragmentExtraDeclaration';\r\nvar shader = \"uniform vec4 vEyePosition;\\nuniform vec3 vAmbientColor;\\nuniform vec4 vCameraInfos;\\n\\nvarying vec3 vPositionW;\\n#if DEBUGMODE>0\\nuniform vec2 vDebugMode;\\nvarying vec4 vClipSpacePosition;\\n#endif\\n#ifdef MAINUV1\\nvarying vec2 vMainUV1;\\n#endif\\n#ifdef MAINUV2\\nvarying vec2 vMainUV2;\\n#endif\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\\nvarying vec3 vEnvironmentIrradiance;\\n#endif\\n#endif\\n#ifdef VERTEXCOLOR\\nvarying vec4 vColor;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrFragmentExtraDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrFragmentExtraDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrFragmentSamplersDeclaration';\r\nvar shader = \"#ifdef ALBEDO\\n#if ALBEDODIRECTUV == 1\\n#define vAlbedoUV vMainUV1\\n#elif ALBEDODIRECTUV == 2\\n#define vAlbedoUV vMainUV2\\n#else\\nvarying vec2 vAlbedoUV;\\n#endif\\nuniform sampler2D albedoSampler;\\n#endif\\n#ifdef AMBIENT\\n#if AMBIENTDIRECTUV == 1\\n#define vAmbientUV vMainUV1\\n#elif AMBIENTDIRECTUV == 2\\n#define vAmbientUV vMainUV2\\n#else\\nvarying vec2 vAmbientUV;\\n#endif\\nuniform sampler2D ambientSampler;\\n#endif\\n#ifdef OPACITY\\n#if OPACITYDIRECTUV == 1\\n#define vOpacityUV vMainUV1\\n#elif OPACITYDIRECTUV == 2\\n#define vOpacityUV vMainUV2\\n#else\\nvarying vec2 vOpacityUV;\\n#endif\\nuniform sampler2D opacitySampler;\\n#endif\\n#ifdef EMISSIVE\\n#if EMISSIVEDIRECTUV == 1\\n#define vEmissiveUV vMainUV1\\n#elif EMISSIVEDIRECTUV == 2\\n#define vEmissiveUV vMainUV2\\n#else\\nvarying vec2 vEmissiveUV;\\n#endif\\nuniform sampler2D emissiveSampler;\\n#endif\\n#ifdef LIGHTMAP\\n#if LIGHTMAPDIRECTUV == 1\\n#define vLightmapUV vMainUV1\\n#elif LIGHTMAPDIRECTUV == 2\\n#define vLightmapUV vMainUV2\\n#else\\nvarying vec2 vLightmapUV;\\n#endif\\nuniform sampler2D lightmapSampler;\\n#endif\\n#ifdef REFLECTIVITY\\n#if REFLECTIVITYDIRECTUV == 1\\n#define vReflectivityUV vMainUV1\\n#elif REFLECTIVITYDIRECTUV == 2\\n#define vReflectivityUV vMainUV2\\n#else\\nvarying vec2 vReflectivityUV;\\n#endif\\nuniform sampler2D reflectivitySampler;\\n#endif\\n#ifdef MICROSURFACEMAP\\n#if MICROSURFACEMAPDIRECTUV == 1\\n#define vMicroSurfaceSamplerUV vMainUV1\\n#elif MICROSURFACEMAPDIRECTUV == 2\\n#define vMicroSurfaceSamplerUV vMainUV2\\n#else\\nvarying vec2 vMicroSurfaceSamplerUV;\\n#endif\\nuniform sampler2D microSurfaceSampler;\\n#endif\\n#ifdef METALLIC_REFLECTANCE\\n#if METALLIC_REFLECTANCEDIRECTUV == 1\\n#define vMetallicReflectanceUV vMainUV1\\n#elif METALLIC_REFLECTANCEDIRECTUV == 2\\n#define vMetallicReflectanceUV vMainUV2\\n#else\\nvarying vec2 vMetallicReflectanceUV;\\n#endif\\nuniform sampler2D metallicReflectanceSampler;\\n#endif\\n#ifdef CLEARCOAT\\n#if defined(CLEARCOAT_TEXTURE)\\n#if CLEARCOAT_TEXTUREDIRECTUV == 1\\n#define vClearCoatUV vMainUV1\\n#elif CLEARCOAT_TEXTUREDIRECTUV == 2\\n#define vClearCoatUV vMainUV2\\n#else\\nvarying vec2 vClearCoatUV;\\n#endif\\n#endif\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS)\\n#if CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV == 1\\n#define vClearCoatRoughnessUV vMainUV1\\n#elif CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV == 2\\n#define vClearCoatRoughnessUV vMainUV2\\n#else\\nvarying vec2 vClearCoatRoughnessUV;\\n#endif\\n#endif\\n#ifdef CLEARCOAT_TEXTURE\\nuniform sampler2D clearCoatSampler;\\n#endif\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL)\\nuniform sampler2D clearCoatRoughnessSampler;\\n#endif\\n#ifdef CLEARCOAT_BUMP\\n#if CLEARCOAT_BUMPDIRECTUV == 1\\n#define vClearCoatBumpUV vMainUV1\\n#elif CLEARCOAT_BUMPDIRECTUV == 2\\n#define vClearCoatBumpUV vMainUV2\\n#else\\nvarying vec2 vClearCoatBumpUV;\\n#endif\\nuniform sampler2D clearCoatBumpSampler;\\n#endif\\n#ifdef CLEARCOAT_TINT_TEXTURE\\n#if CLEARCOAT_TINT_TEXTUREDIRECTUV == 1\\n#define vClearCoatTintUV vMainUV1\\n#elif CLEARCOAT_TINT_TEXTUREDIRECTUV == 2\\n#define vClearCoatTintUV vMainUV2\\n#else\\nvarying vec2 vClearCoatTintUV;\\n#endif\\nuniform sampler2D clearCoatTintSampler;\\n#endif\\n#endif\\n#ifdef SHEEN\\n#ifdef SHEEN_TEXTURE\\n#if SHEEN_TEXTUREDIRECTUV == 1\\n#define vSheenUV vMainUV1\\n#elif SHEEN_TEXTUREDIRECTUV == 2\\n#define vSheenUV vMainUV2\\n#else\\nvarying vec2 vSheenUV;\\n#endif\\n#endif\\n#ifdef SHEEN_TEXTURE_ROUGHNESS\\n#if SHEEN_TEXTURE_ROUGHNESSDIRECTUV == 1\\n#define vSheenRoughnessUV vMainUV1\\n#elif SHEEN_TEXTURE_ROUGHNESSDIRECTUV == 2\\n#define vSheenRoughnessUV vMainUV2\\n#else\\nvarying vec2 vSheenRoughnessUV;\\n#endif\\n#endif\\n#ifdef SHEEN_TEXTURE\\nuniform sampler2D sheenSampler;\\n#endif\\n#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL)\\nuniform sampler2D sheenRoughnessSampler;\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\n#ifdef ANISOTROPIC_TEXTURE\\n#if ANISOTROPIC_TEXTUREDIRECTUV == 1\\n#define vAnisotropyUV vMainUV1\\n#elif ANISOTROPIC_TEXTUREDIRECTUV == 2\\n#define vAnisotropyUV vMainUV2\\n#else\\nvarying vec2 vAnisotropyUV;\\n#endif\\nuniform sampler2D anisotropySampler;\\n#endif\\n#endif\\n\\n#ifdef REFLECTION\\n#ifdef REFLECTIONMAP_3D\\n#define sampleReflection(s,c) textureCube(s,c)\\nuniform samplerCube reflectionSampler;\\n#ifdef LODBASEDMICROSFURACE\\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\\n#else\\nuniform samplerCube reflectionSamplerLow;\\nuniform samplerCube reflectionSamplerHigh;\\n#endif\\n#ifdef USEIRRADIANCEMAP\\nuniform samplerCube irradianceSampler;\\n#endif\\n#else\\n#define sampleReflection(s,c) texture2D(s,c)\\nuniform sampler2D reflectionSampler;\\n#ifdef LODBASEDMICROSFURACE\\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\\n#else\\nuniform sampler2D reflectionSamplerLow;\\nuniform sampler2D reflectionSamplerHigh;\\n#endif\\n#ifdef USEIRRADIANCEMAP\\nuniform sampler2D irradianceSampler;\\n#endif\\n#endif\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#else\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\n#endif\\n#endif\\n#ifdef ENVIRONMENTBRDF\\nuniform sampler2D environmentBrdfSampler;\\n#endif\\n\\n#ifdef SUBSURFACE\\n#ifdef SS_REFRACTION\\n#ifdef SS_REFRACTIONMAP_3D\\n#define sampleRefraction(s,c) textureCube(s,c)\\nuniform samplerCube refractionSampler;\\n#ifdef LODBASEDMICROSFURACE\\n#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)\\n#else\\nuniform samplerCube refractionSamplerLow;\\nuniform samplerCube refractionSamplerHigh;\\n#endif\\n#else\\n#define sampleRefraction(s,c) texture2D(s,c)\\nuniform sampler2D refractionSampler;\\n#ifdef LODBASEDMICROSFURACE\\n#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)\\n#else\\nuniform sampler2D refractionSamplerLow;\\nuniform sampler2D refractionSamplerHigh;\\n#endif\\n#endif\\n#endif\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\n#if SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 1\\n#define vThicknessUV vMainUV1\\n#elif SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 2\\n#define vThicknessUV vMainUV2\\n#else\\nvarying vec2 vThicknessUV;\\n#endif\\nuniform sampler2D thicknessSampler;\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrFragmentSamplersDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrFragmentSamplersDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'subSurfaceScatteringFunctions';\r\nvar shader = \"bool testLightingForSSS(float diffusionProfile)\\n{\\nreturn diffusionProfile<1.;\\n}\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var subSurfaceScatteringFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=subSurfaceScatteringFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'importanceSampling';\r\nvar shader = \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec3 hemisphereCosSample(vec2 u) {\\n\\nfloat phi=2.*PI*u.x;\\nfloat cosTheta2=1.-u.y;\\nfloat cosTheta=sqrt(cosTheta2);\\nfloat sinTheta=sqrt(1.-cosTheta2);\\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\\n}\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec3 hemisphereImportanceSampleDggx(vec2 u,float a) {\\n\\nfloat phi=2.*PI*u.x;\\n\\nfloat cosTheta2=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));\\nfloat cosTheta=sqrt(cosTheta2);\\nfloat sinTheta=sqrt(1.-cosTheta2);\\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\\n}\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec3 hemisphereImportanceSampleDCharlie(vec2 u,float a) {\\n\\nfloat phi=2.*PI*u.x;\\nfloat sinTheta=pow(u.y,a/(2.*a+1.));\\nfloat cosTheta=sqrt(1.-sinTheta*sinTheta);\\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\\n}\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var importanceSampling = { name: name, shader: shader };\r\n//# sourceMappingURL=importanceSampling.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrHelperFunctions';\r\nvar shader = \"\\n#define RECIPROCAL_PI2 0.15915494\\n#define RECIPROCAL_PI 0.31830988618\\n\\n#define MINIMUMVARIANCE 0.0005\\nfloat convertRoughnessToAverageSlope(float roughness)\\n{\\n\\nreturn square(roughness)+MINIMUMVARIANCE;\\n}\\nfloat fresnelGrazingReflectance(float reflectance0) {\\n\\n\\nfloat reflectance90=saturate(reflectance0*25.0);\\nreturn reflectance90;\\n}\\nvec2 getAARoughnessFactors(vec3 normalVector) {\\n#ifdef SPECULARAA\\nvec3 nDfdx=dFdx(normalVector.xyz);\\nvec3 nDfdy=dFdy(normalVector.xyz);\\nfloat slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));\\n\\nfloat geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);\\n\\nfloat geometricAlphaGFactor=sqrt(slopeSquare);\\n\\ngeometricAlphaGFactor*=0.75;\\nreturn vec2(geometricRoughnessFactor,geometricAlphaGFactor);\\n#else\\nreturn vec2(0.);\\n#endif\\n}\\n#ifdef ANISOTROPIC\\n\\n\\nvec2 getAnisotropicRoughness(float alphaG,float anisotropy) {\\nfloat alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);\\nfloat alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);\\nreturn vec2(alphaT,alphaB);\\n}\\n\\n\\nvec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy) {\\nvec3 anisotropicFrameDirection=anisotropy>=0.0 ? B : T;\\nvec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);\\nvec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);\\nvec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));\\nreturn anisotropicNormal;\\n\\n}\\n#endif\\n#if defined(CLEARCOAT) || defined(SS_REFRACTION)\\n\\n\\n\\nvec3 cocaLambert(vec3 alpha,float distance) {\\nreturn exp(-alpha*distance);\\n}\\n\\nvec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {\\nreturn cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));\\n}\\n\\nvec3 computeColorAtDistanceInMedia(vec3 color,float distance) {\\nreturn -log(color)/distance;\\n}\\nvec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\\nvec3 clearCoatAbsorption=mix(vec3(1.0),\\ncocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),\\nclearCoatIntensity);\\nreturn clearCoatAbsorption;\\n}\\n#endif\\n\\n\\n\\n\\n#ifdef MICROSURFACEAUTOMATIC\\nfloat computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)\\n{\\nconst float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;\\nfloat reflectivityLuminance=getLuminance(reflectivityColor);\\nfloat reflectivityLuma=sqrt(reflectivityLuminance);\\nmicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;\\nreturn microSurface;\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrHelperFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrHelperFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'harmonicsFunctions';\r\nvar shader = \"#ifdef USESPHERICALFROMREFLECTIONMAP\\n#ifdef SPHERICAL_HARMONICS\\nuniform vec3 vSphericalL00;\\nuniform vec3 vSphericalL1_1;\\nuniform vec3 vSphericalL10;\\nuniform vec3 vSphericalL11;\\nuniform vec3 vSphericalL2_2;\\nuniform vec3 vSphericalL2_1;\\nuniform vec3 vSphericalL20;\\nuniform vec3 vSphericalL21;\\nuniform vec3 vSphericalL22;\\n\\n\\n\\n\\n\\n\\n\\nvec3 computeEnvironmentIrradiance(vec3 normal) {\\nreturn vSphericalL00\\n+vSphericalL1_1*(normal.y)\\n+vSphericalL10*(normal.z)\\n+vSphericalL11*(normal.x)\\n+vSphericalL2_2*(normal.y*normal.x)\\n+vSphericalL2_1*(normal.y*normal.z)\\n+vSphericalL20*((3.0*normal.z*normal.z)-1.0)\\n+vSphericalL21*(normal.z*normal.x)\\n+vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));\\n}\\n#else\\nuniform vec3 vSphericalX;\\nuniform vec3 vSphericalY;\\nuniform vec3 vSphericalZ;\\nuniform vec3 vSphericalXX_ZZ;\\nuniform vec3 vSphericalYY_ZZ;\\nuniform vec3 vSphericalZZ;\\nuniform vec3 vSphericalXY;\\nuniform vec3 vSphericalYZ;\\nuniform vec3 vSphericalZX;\\n\\nvec3 computeEnvironmentIrradiance(vec3 normal) {\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfloat Nx=normal.x;\\nfloat Ny=normal.y;\\nfloat Nz=normal.z;\\nvec3 C1=vSphericalZZ.rgb;\\nvec3 Cx=vSphericalX.rgb;\\nvec3 Cy=vSphericalY.rgb;\\nvec3 Cz=vSphericalZ.rgb;\\nvec3 Cxx_zz=vSphericalXX_ZZ.rgb;\\nvec3 Cyy_zz=vSphericalYY_ZZ.rgb;\\nvec3 Cxy=vSphericalXY.rgb;\\nvec3 Cyz=vSphericalYZ.rgb;\\nvec3 Czx=vSphericalZX.rgb;\\nvec3 a1=Cyy_zz*Ny+Cy;\\nvec3 a2=Cyz*Nz+a1;\\nvec3 b1=Czx*Nz+Cx;\\nvec3 b2=Cxy*Ny+b1;\\nvec3 b3=Cxx_zz*Nx+b2;\\nvec3 t1=Cz*Nz+C1;\\nvec3 t2=a2*Ny+t1;\\nvec3 t3=b3*Nx+t2;\\nreturn t3;\\n}\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var harmonicsFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=harmonicsFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrDirectLightingSetupFunctions';\r\nvar shader = \"\\nstruct preLightingInfo\\n{\\n\\nvec3 lightOffset;\\nfloat lightDistanceSquared;\\nfloat lightDistance;\\n\\nfloat attenuation;\\n\\nvec3 L;\\nvec3 H;\\nfloat NdotV;\\nfloat NdotLUnclamped;\\nfloat NdotL;\\nfloat VdotH;\\nfloat roughness;\\n};\\npreLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\\npreLightingInfo result;\\n\\nresult.lightOffset=lightData.xyz-vPositionW;\\nresult.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);\\n\\nresult.lightDistance=sqrt(result.lightDistanceSquared);\\n\\nresult.L=normalize(result.lightOffset);\\nresult.H=normalize(V+result.L);\\nresult.VdotH=saturate(dot(V,result.H));\\nresult.NdotLUnclamped=dot(N,result.L);\\nresult.NdotL=saturateEps(result.NdotLUnclamped);\\nreturn result;\\n}\\npreLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\\npreLightingInfo result;\\n\\nresult.lightDistance=length(-lightData.xyz);\\n\\nresult.L=normalize(-lightData.xyz);\\nresult.H=normalize(V+result.L);\\nresult.VdotH=saturate(dot(V,result.H));\\nresult.NdotLUnclamped=dot(N,result.L);\\nresult.NdotL=saturateEps(result.NdotLUnclamped);\\nreturn result;\\n}\\npreLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\\npreLightingInfo result;\\n\\n\\nresult.NdotL=dot(N,lightData.xyz)*0.5+0.5;\\nresult.NdotL=saturateEps(result.NdotL);\\nresult.NdotLUnclamped=result.NdotL;\\n#ifdef SPECULARTERM\\nresult.L=normalize(lightData.xyz);\\nresult.H=normalize(V+result.L);\\nresult.VdotH=saturate(dot(V,result.H));\\n#endif\\nreturn result;\\n}\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrDirectLightingSetupFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrDirectLightingSetupFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrDirectLightingFalloffFunctions';\r\nvar shader = \"float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)\\n{\\nreturn max(0.,1.0-length(lightOffset)/range);\\n}\\nfloat computeDistanceLightFalloff_Physical(float lightDistanceSquared)\\n{\\nreturn 1.0/maxEps(lightDistanceSquared);\\n}\\nfloat computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)\\n{\\nfloat lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);\\nfloat factor=lightDistanceSquared*inverseSquaredRange;\\nfloat attenuation=saturate(1.0-factor*factor);\\nattenuation*=attenuation;\\n\\nlightDistanceFalloff*=attenuation;\\nreturn lightDistanceFalloff;\\n}\\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)\\n{\\n#ifdef USEPHYSICALLIGHTFALLOFF\\nreturn computeDistanceLightFalloff_Physical(lightDistanceSquared);\\n#elif defined(USEGLTFLIGHTFALLOFF)\\nreturn computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);\\n#else\\nreturn computeDistanceLightFalloff_Standard(lightOffset,range);\\n#endif\\n}\\nfloat computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)\\n{\\nfloat falloff=0.0;\\nfloat cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));\\nif (cosAngle>=cosHalfAngle)\\n{\\nfalloff=max(0.,pow(cosAngle,exponent));\\n}\\nreturn falloff;\\n}\\nfloat computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)\\n{\\nconst float kMinusLog2ConeAngleIntensityRatio=6.64385618977;\\n\\n\\n\\n\\n\\nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);\\n\\n\\nvec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);\\nfloat falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));\\nreturn falloff;\\n}\\nfloat computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)\\n{\\n\\n\\n\\nfloat cd=dot(-lightDirection,directionToLightCenterW);\\nfloat falloff=saturate(cd*lightAngleScale+lightAngleOffset);\\n\\nfalloff*=falloff;\\nreturn falloff;\\n}\\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)\\n{\\n#ifdef USEPHYSICALLIGHTFALLOFF\\nreturn computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);\\n#elif defined(USEGLTFLIGHTFALLOFF)\\nreturn computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);\\n#else\\nreturn computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);\\n#endif\\n}\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrDirectLightingFalloffFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrDirectLightingFalloffFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBRDFFunctions';\r\nvar shader = \"\\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\\n\\n\\n\\n\\n#ifdef MS_BRDF_ENERGY_CONSERVATION\\n\\n\\nvec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\\nreturn 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);\\n}\\n#endif\\n#ifdef ENVIRONMENTBRDF\\nvec3 getBRDFLookup(float NdotV,float perceptualRoughness) {\\n\\nvec2 UV=vec2(NdotV,perceptualRoughness);\\n\\nvec4 brdfLookup=texture2D(environmentBrdfSampler,UV);\\n#ifdef ENVIRONMENTBRDF_RGBD\\nbrdfLookup.rgb=fromRGBD(brdfLookup.rgba);\\n#endif\\nreturn brdfLookup.rgb;\\n}\\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 specularEnvironmentR90,const vec3 environmentBrdf) {\\n#ifdef BRDF_V_HEIGHT_CORRELATED\\nvec3 reflectance=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;\\n\\n#else\\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;\\n#endif\\nreturn reflectance;\\n}\\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\\n#ifdef BRDF_V_HEIGHT_CORRELATED\\nvec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);\\n#else\\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;\\n#endif\\nreturn reflectance;\\n}\\n#endif\\n\\n#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)\\nvec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\\n{\\n\\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\\n}\\n#endif\\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\\n\\nvec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {\\nvec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;\\nreturn sheenEnvironmentReflectance;\\n}\\n#endif\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)\\n{\\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\\n}\\nfloat fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)\\n{\\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\\n}\\n#ifdef CLEARCOAT\\n\\n\\n\\n\\n\\nvec3 getR0RemappedForClearCoat(vec3 f0) {\\n#ifdef CLEARCOAT_DEFAULTIOR\\n#ifdef MOBILE\\nreturn saturate(f0*(f0*0.526868+0.529324)-0.0482256);\\n#else\\nreturn saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);\\n#endif\\n#else\\nvec3 s=sqrt(f0);\\nvec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);\\nreturn t*t;\\n#endif\\n}\\n#endif\\n\\n\\n\\n\\n\\n\\nfloat normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)\\n{\\n\\n\\n\\nfloat a2=square(alphaG);\\nfloat d=NdotH*NdotH*(a2-1.0)+1.0;\\nreturn a2/(PI*d*d);\\n}\\n#ifdef SHEEN\\n\\n\\nfloat normalDistributionFunction_CharlieSheen(float NdotH,float alphaG)\\n{\\nfloat invR=1./alphaG;\\nfloat cos2h=NdotH*NdotH;\\nfloat sin2h=1.-cos2h;\\nreturn (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);\\n}\\n#endif\\n#ifdef ANISOTROPIC\\n\\n\\nfloat normalDistributionFunction_BurleyGGX_Anisotropic(float NdotH,float TdotH,float BdotH,const vec2 alphaTB) {\\nfloat a2=alphaTB.x*alphaTB.y;\\nvec3 v=vec3(alphaTB.y*TdotH,alphaTB.x*BdotH,a2*NdotH);\\nfloat v2=dot(v,v);\\nfloat w2=a2/v2;\\nreturn a2*w2*w2*RECIPROCAL_PI;\\n}\\n#endif\\n\\n\\n\\n\\n#ifdef BRDF_V_HEIGHT_CORRELATED\\n\\n\\n\\nfloat smithVisibility_GGXCorrelated(float NdotL,float NdotV,float alphaG) {\\n#ifdef MOBILE\\n\\nfloat GGXV=NdotL*(NdotV*(1.0-alphaG)+alphaG);\\nfloat GGXL=NdotV*(NdotL*(1.0-alphaG)+alphaG);\\nreturn 0.5/(GGXV+GGXL);\\n#else\\nfloat a2=alphaG*alphaG;\\nfloat GGXV=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);\\nfloat GGXL=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);\\nreturn 0.5/(GGXV+GGXL);\\n#endif\\n}\\n#else\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfloat smithVisibilityG1_TrowbridgeReitzGGXFast(float dot,float alphaG)\\n{\\n#ifdef MOBILE\\n\\nreturn 1.0/(dot+alphaG+(1.0-alphaG)*dot ));\\n#else\\nfloat alphaSquared=alphaG*alphaG;\\nreturn 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));\\n#endif\\n}\\nfloat smithVisibility_TrowbridgeReitzGGXFast(float NdotL,float NdotV,float alphaG)\\n{\\nfloat visibility=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);\\n\\nreturn visibility;\\n}\\n#endif\\n#ifdef ANISOTROPIC\\n\\n\\nfloat smithVisibility_GGXCorrelated_Anisotropic(float NdotL,float NdotV,float TdotV,float BdotV,float TdotL,float BdotL,const vec2 alphaTB) {\\nfloat lambdaV=NdotL*length(vec3(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));\\nfloat lambdaL=NdotV*length(vec3(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));\\nfloat v=0.5/(lambdaV+lambdaL);\\nreturn v;\\n}\\n#endif\\n#ifdef CLEARCOAT\\nfloat visibility_Kelemen(float VdotH) {\\n\\n\\n\\nreturn 0.25/(VdotH*VdotH);\\n}\\n#endif\\n#ifdef SHEEN\\n\\n\\n\\nfloat visibility_Ashikhmin(float NdotL,float NdotV)\\n{\\nreturn 1./(4.*(NdotL+NdotV-NdotL*NdotV));\\n}\\n\\n#endif\\n\\n\\n\\n\\n\\n\\n\\nfloat diffuseBRDF_Burley(float NdotL,float NdotV,float VdotH,float roughness) {\\n\\n\\nfloat diffuseFresnelNV=pow5(saturateEps(1.0-NdotL));\\nfloat diffuseFresnelNL=pow5(saturateEps(1.0-NdotV));\\nfloat diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;\\nfloat fresnel =\\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *\\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);\\nreturn fresnel/PI;\\n}\\n#ifdef SS_TRANSLUCENCY\\n\\n\\nvec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,float thickness) {\\nvec3 S=1./maxEps(diffusionDistance);\\nvec3 temp=exp((-0.333333333*thickness)*S);\\nreturn tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);\\n}\\n\\n\\nfloat computeWrappedDiffuseNdotL(float NdotL,float w) {\\nfloat t=1.0+w;\\nfloat invt2=1.0/square(t);\\nreturn saturate((NdotL+w)*invt2);\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBRDFFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBRDFFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'hdrFilteringFunctions';\r\nvar shader = \"#ifdef NUM_SAMPLES\\n#if NUM_SAMPLES>0\\n#ifdef WEBGL2\\n\\n\\nfloat radicalInverse_VdC(uint bits)\\n{\\nbits=(bits << 16u) | (bits >> 16u);\\nbits=((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\\nbits=((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\\nbits=((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\\nbits=((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\\nreturn float(bits)*2.3283064365386963e-10;\\n}\\nvec2 hammersley(uint i,uint N)\\n{\\nreturn vec2(float(i)/float(N),radicalInverse_VdC(i));\\n}\\n#else\\nfloat vanDerCorpus(int n,int base)\\n{\\nfloat invBase=1.0/float(base);\\nfloat denom=1.0;\\nfloat result=0.0;\\nfor(int i=0; i<32; ++i)\\n{\\nif(n>0)\\n{\\ndenom=mod(float(n),2.0);\\nresult+=denom*invBase;\\ninvBase=invBase/2.0;\\nn=int(float(n)/2.0);\\n}\\n}\\nreturn result;\\n}\\nvec2 hammersley(int i,int N)\\n{\\nreturn vec2(float(i)/float(N),vanDerCorpus(i,2));\\n}\\n#endif\\nfloat log4(float x) {\\nreturn log2(x)/2.;\\n}\\nconst float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);\\nconst float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;\\nconst float K=4.;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n#define inline\\nvec3 irradiance(samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\\n{\\nvec3 n=normalize(inputN);\\nvec3 result=vec3(0.0);\\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);\\ntangent=normalize(cross(tangent,n));\\nvec3 bitangent=cross(n,tangent);\\nmat3 tbn=mat3(tangent,bitangent,n);\\nfloat maxLevel=filteringInfo.y;\\nfloat dim0=filteringInfo.x;\\nfloat omegaP=(4.*PI)/(6.*dim0*dim0);\\n#ifdef WEBGL2\\nfor(uint i=0u; i0.) {\\nfloat pdf_inversed=PI/NoL;\\nfloat omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;\\nfloat l=log4(omegaS)-log4(omegaP)+log4(K);\\nfloat mipLevel=clamp(l,0.0,maxLevel);\\nvec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;\\n#ifdef GAMMA_INPUT\\nc=toLinearSpace(c);\\n#endif\\nresult+=c;\\n}\\n}\\nresult=result*NUM_SAMPLES_FLOAT_INVERSED;\\nreturn result;\\n}\\n#define inline\\nvec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\\n{\\nvec3 n=normalize(inputN);\\nif (alphaG == 0.) {\\nvec3 c=textureCube(inputTexture,n).rgb;\\n#ifdef GAMMA_INPUT\\nc=toLinearSpace(c);\\n#endif\\nreturn c;\\n}\\nvec3 result=vec3(0.);\\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);\\ntangent=normalize(cross(tangent,n));\\nvec3 bitangent=cross(n,tangent);\\nmat3 tbn=mat3(tangent,bitangent,n);\\nfloat maxLevel=filteringInfo.y;\\nfloat dim0=filteringInfo.x;\\nfloat omegaP=(4.*PI)/(6.*dim0*dim0);\\nfloat weight=0.;\\n#ifdef WEBGL2\\nfor(uint i=0u; i0.) {\\nfloat pdf_inversed=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);\\nfloat omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;\\nfloat l=log4(omegaS)-log4(omegaP)+log4(K);\\nfloat mipLevel=clamp(float(l),0.0,maxLevel);\\nweight+=NoL;\\nvec3 c=textureCubeLodEXT(inputTexture,tbn*L,mipLevel).rgb;\\n#ifdef GAMMA_INPUT\\nc=toLinearSpace(c);\\n#endif\\nresult+=c*NoL;\\n}\\n}\\nresult=result/weight;\\nreturn result;\\n}\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var hdrFilteringFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=hdrFilteringFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrDirectLightingFunctions';\r\nvar shader = \"#define CLEARCOATREFLECTANCE90 1.0\\n\\nstruct lightingInfo\\n{\\nvec3 diffuse;\\n#ifdef SPECULARTERM\\nvec3 specular;\\n#endif\\n#ifdef CLEARCOAT\\n\\n\\nvec4 clearCoat;\\n#endif\\n#ifdef SHEEN\\nvec3 sheen;\\n#endif\\n};\\n\\nfloat adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {\\n#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)\\n\\nfloat lightRoughness=lightRadius/lightDistance;\\n\\nfloat totalRoughness=saturate(lightRoughness+roughness);\\nreturn totalRoughness;\\n#else\\nreturn roughness;\\n#endif\\n}\\nvec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {\\nreturn mix(groundColor,lightColor,info.NdotL);\\n}\\nvec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {\\nfloat diffuseTerm=diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness);\\nreturn diffuseTerm*info.attenuation*info.NdotL*lightColor;\\n}\\n#define inline\\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\\nstrq/=strq.w;\\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\\nreturn toLinearSpace(textureColor);\\n}\\n#ifdef SS_TRANSLUCENCY\\nvec3 computeDiffuseAndTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {\\nfloat NdotL=absEps(info.NdotLUnclamped);\\n\\nfloat wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);\\n\\nfloat trAdapt=step(0.,info.NdotLUnclamped);\\nvec3 transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);\\nfloat diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);\\nreturn diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;\\n}\\n#endif\\n#ifdef SPECULARTERM\\nvec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\\nfloat NdotH=saturateEps(dot(N,info.H));\\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\\n#ifdef BRDF_V_HEIGHT_CORRELATED\\nfloat smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);\\n#else\\nfloat smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);\\n#endif\\nvec3 specTerm=fresnel*distribution*smithVisibility;\\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\\n}\\n#endif\\n#ifdef ANISOTROPIC\\nvec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\\nfloat NdotH=saturateEps(dot(N,info.H));\\nfloat TdotH=dot(T,info.H);\\nfloat BdotH=dot(B,info.H);\\nfloat TdotV=dot(T,V);\\nfloat BdotV=dot(B,V);\\nfloat TdotL=dot(T,info.L);\\nfloat BdotL=dot(B,info.L);\\nfloat alphaG=convertRoughnessToAverageSlope(info.roughness);\\nvec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);\\nalphaTB=max(alphaTB,square(geometricRoughnessFactor));\\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\\nfloat distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);\\nfloat smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);\\nvec3 specTerm=fresnel*distribution*smithVisibility;\\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\\n}\\n#endif\\n#ifdef CLEARCOAT\\nvec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {\\nfloat NccdotL=saturateEps(dot(Ncc,info.L));\\nfloat NccdotH=saturateEps(dot(Ncc,info.H));\\nfloat clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);\\nfloat alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\\nfloat fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\\nfresnel*=clearCoatIntensity;\\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);\\nfloat kelemenVisibility=visibility_Kelemen(info.VdotH);\\nfloat clearCoatTerm=fresnel*distribution*kelemenVisibility;\\nreturn vec4(\\nclearCoatTerm*info.attenuation*NccdotL*lightColor,\\n1.0-fresnel\\n);\\n}\\nvec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\\nvec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);\\nfloat NdotLRefract=saturateEps(dot(Ncc,LRefract));\\nvec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);\\nreturn absorption;\\n}\\n#endif\\n#ifdef SHEEN\\nvec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\\nfloat NdotH=saturateEps(dot(N,info.H));\\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\\n\\n\\nfloat fresnel=1.;\\nfloat distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);\\n\\nfloat visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);\\n\\nfloat sheenTerm=fresnel*distribution*visibility;\\nreturn sheenTerm*info.attenuation*info.NdotL*lightColor;\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrDirectLightingFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrDirectLightingFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrIBLFunctions';\r\nvar shader = \"#if defined(REFLECTION) || defined(SS_REFRACTION)\\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {\\nfloat microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;\\nfloat lod=log2(microsurfaceAverageSlopeTexels);\\nreturn lod;\\n}\\nfloat getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {\\nfloat lod=log2(cubeMapDimensionPixels)*roughness;\\nreturn lod;\\n}\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)\\nfloat environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {\\n\\n\\nfloat temp=NdotVUnclamped+ambientOcclusion;\\nreturn saturate(square(temp)-1.0+ambientOcclusion);\\n}\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)\\nfloat environmentHorizonOcclusion(vec3 view,vec3 normal,vec3 geometricNormal) {\\n\\nvec3 reflection=reflect(view,normal);\\nfloat temp=saturate(1.0+1.1*dot(reflection,geometricNormal));\\nreturn square(temp);\\n}\\n#endif\\n\\n\\n\\n\\n#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)\\n\\n\\n#define UNPACK_LOD(x) (1.0-x)*255.0\\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {\\nfloat microsurfaceAverageSlope=alphaG;\\n\\n\\n\\n\\n\\n\\nmicrosurfaceAverageSlope*=sqrt(abs(NdotV));\\nreturn getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrIBLFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrIBLFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockAlbedoOpacity';\r\nvar shader = \"struct albedoOpacityOutParams\\n{\\nvec3 surfaceAlbedo;\\nfloat alpha;\\n};\\n#define pbr_inline\\nvoid albedoOpacityBlock(\\nconst in vec4 vAlbedoColor,\\n#ifdef ALBEDO\\nconst in vec4 albedoTexture,\\nconst in vec2 albedoInfos,\\n#endif\\n#ifdef OPACITY\\nconst in vec4 opacityMap,\\nconst in vec2 vOpacityInfos,\\n#endif\\n#ifdef DETAIL\\nconst in vec4 detailColor,\\nconst in vec4 vDetailInfos,\\n#endif\\nout albedoOpacityOutParams outParams\\n)\\n{\\n\\nvec3 surfaceAlbedo=vAlbedoColor.rgb;\\nfloat alpha=vAlbedoColor.a;\\n#ifdef ALBEDO\\n#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)\\nalpha*=albedoTexture.a;\\n#endif\\n#ifdef GAMMAALBEDO\\nsurfaceAlbedo*=toLinearSpace(albedoTexture.rgb);\\n#else\\nsurfaceAlbedo*=albedoTexture.rgb;\\n#endif\\nsurfaceAlbedo*=albedoInfos.y;\\n#endif\\n#ifdef VERTEXCOLOR\\nsurfaceAlbedo*=vColor.rgb;\\n#endif\\n#ifdef DETAIL\\nfloat detailAlbedo=2.0*mix(0.5,detailColor.r,vDetailInfos.y);\\nsurfaceAlbedo.rgb=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo;\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_ALBEDO\\n\\n#ifdef OPACITY\\n#ifdef OPACITYRGB\\nalpha=getLuminance(opacityMap.rgb);\\n#else\\nalpha*=opacityMap.a;\\n#endif\\nalpha*=vOpacityInfos.y;\\n#endif\\n#ifdef VERTEXALPHA\\nalpha*=vColor.a;\\n#endif\\n#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)\\n#ifdef ALPHATEST\\nif (alpha0\\nvec4 surfaceMetallicColorMap;\\nvec4 surfaceReflectivityColorMap;\\nvec2 metallicRoughness;\\nvec3 metallicF0;\\n#endif\\n};\\n#define pbr_inline\\nvoid reflectivityBlock(\\nconst in vec4 vReflectivityColor,\\n#ifdef METALLICWORKFLOW\\nconst in vec3 surfaceAlbedo,\\nconst in vec4 metallicReflectanceFactors,\\n#endif\\n#ifdef REFLECTIVITY\\nconst in vec3 reflectivityInfos,\\nconst in vec4 surfaceMetallicOrReflectivityColorMap,\\n#endif\\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\\nconst in vec3 ambientOcclusionColorIn,\\n#endif\\n#ifdef MICROSURFACEMAP\\nconst in vec4 microSurfaceTexel,\\n#endif\\n#ifdef DETAIL\\nconst in vec4 detailColor,\\nconst in vec4 vDetailInfos,\\n#endif\\nout reflectivityOutParams outParams\\n)\\n{\\nfloat microSurface=vReflectivityColor.a;\\nvec3 surfaceReflectivityColor=vReflectivityColor.rgb;\\n#ifdef METALLICWORKFLOW\\nvec2 metallicRoughness=surfaceReflectivityColor.rg;\\n#ifdef REFLECTIVITY\\n#if DEBUGMODE>0\\noutParams.surfaceMetallicColorMap=surfaceMetallicOrReflectivityColorMap;\\n#endif\\n#ifdef AOSTOREINMETALMAPRED\\nvec3 aoStoreInMetalMap=vec3(surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r);\\noutParams.ambientOcclusionColor=mix(ambientOcclusionColorIn,aoStoreInMetalMap,reflectivityInfos.z);\\n#endif\\n#ifdef METALLNESSSTOREINMETALMAPBLUE\\nmetallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.b;\\n#else\\nmetallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.r;\\n#endif\\n#ifdef ROUGHNESSSTOREINMETALMAPALPHA\\nmetallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.a;\\n#else\\n#ifdef ROUGHNESSSTOREINMETALMAPGREEN\\nmetallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.g;\\n#endif\\n#endif\\n#endif\\n#ifdef DETAIL\\nfloat detailRoughness=mix(0.5,detailColor.b,vDetailInfos.w);\\nfloat loLerp=mix(0.,metallicRoughness.g,detailRoughness*2.);\\nfloat hiLerp=mix(metallicRoughness.g,1.,(detailRoughness-0.5)*2.);\\nmetallicRoughness.g=mix(loLerp,hiLerp,step(detailRoughness,0.5));\\n#endif\\n#ifdef MICROSURFACEMAP\\nmetallicRoughness.g*=microSurfaceTexel.r;\\n#endif\\n#if DEBUGMODE>0\\noutParams.metallicRoughness=metallicRoughness;\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS\\n\\nmicroSurface=1.0-metallicRoughness.g;\\n\\nvec3 baseColor=surfaceAlbedo;\\n#ifdef FROSTBITE_REFLECTANCE\\n\\n\\n\\n\\n\\n\\noutParams.surfaceAlbedo=baseColor.rgb*(1.0-metallicRoughness.r);\\n\\nsurfaceReflectivityColor=mix(0.16*reflectance*reflectance,baseColor,metallicRoughness.r);\\n#else\\nvec3 metallicF0=metallicReflectanceFactors.rgb;\\n#if DEBUGMODE>0\\noutParams.metallicF0=metallicF0;\\n#endif\\n\\noutParams.surfaceAlbedo=mix(baseColor.rgb*(1.0-metallicF0),vec3(0.,0.,0.),metallicRoughness.r);\\n\\nsurfaceReflectivityColor=mix(metallicF0,baseColor,metallicRoughness.r);\\n#endif\\n#else\\n#ifdef REFLECTIVITY\\nsurfaceReflectivityColor*=surfaceMetallicOrReflectivityColorMap.rgb;\\n#if DEBUGMODE>0\\noutParams.surfaceReflectivityColorMap=surfaceMetallicOrReflectivityColorMap;\\n#endif\\n#ifdef MICROSURFACEFROMREFLECTIVITYMAP\\nmicroSurface*=surfaceMetallicOrReflectivityColorMap.a;\\nmicroSurface*=reflectivityInfos.z;\\n#else\\n#ifdef MICROSURFACEAUTOMATIC\\nmicroSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);\\n#endif\\n#ifdef MICROSURFACEMAP\\nmicroSurface*=microSurfaceTexel.r;\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE\\n#endif\\n#endif\\n#endif\\n\\nmicroSurface=saturate(microSurface);\\n\\nfloat roughness=1.-microSurface;\\noutParams.microSurface=microSurface;\\noutParams.roughness=roughness;\\noutParams.surfaceReflectivityColor=surfaceReflectivityColor;\\n}\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockReflectivity = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockReflectivity.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockAmbientOcclusion';\r\nvar shader = \"struct ambientOcclusionOutParams\\n{\\nvec3 ambientOcclusionColor;\\n#if DEBUGMODE>0\\nvec3 ambientOcclusionColorMap;\\n#endif\\n};\\n#define pbr_inline\\nvoid ambientOcclusionBlock(\\n#ifdef AMBIENT\\nconst in vec3 ambientOcclusionColorMap_,\\nconst in vec4 vAmbientInfos,\\n#endif\\nout ambientOcclusionOutParams outParams\\n)\\n{\\nvec3 ambientOcclusionColor=vec3(1.,1.,1.);\\n#ifdef AMBIENT\\nvec3 ambientOcclusionColorMap=ambientOcclusionColorMap_*vAmbientInfos.y;\\n#ifdef AMBIENTINGRAYSCALE\\nambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);\\n#endif\\nambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);\\n#if DEBUGMODE>0\\noutParams.ambientOcclusionColorMap=ambientOcclusionColorMap;\\n#endif\\n#endif\\noutParams.ambientOcclusionColor=ambientOcclusionColor;\\n}\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockAmbientOcclusion = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockAmbientOcclusion.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockAlphaFresnel';\r\nvar shader = \"#ifdef ALPHAFRESNEL\\n#if defined(ALPHATEST) || defined(ALPHABLEND)\\nstruct alphaFresnelOutParams\\n{\\nfloat alpha;\\n};\\n#define pbr_inline\\nvoid alphaFresnelBlock(\\nconst in vec3 normalW,\\nconst in vec3 viewDirectionW,\\nconst in float alpha,\\nconst in float microSurface,\\nout alphaFresnelOutParams outParams\\n)\\n{\\n\\n\\n\\nfloat opacityPerceptual=alpha;\\n#ifdef LINEARALPHAFRESNEL\\nfloat opacity0=opacityPerceptual;\\n#else\\nfloat opacity0=opacityPerceptual*opacityPerceptual;\\n#endif\\nfloat opacity90=fresnelGrazingReflectance(opacity0);\\nvec3 normalForward=faceforward(normalW,-viewDirectionW,normalW);\\n\\noutParams.alpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)),vec3(opacity0),vec3(opacity90),sqrt(microSurface)).x;\\n#ifdef ALPHATEST\\nif (outParams.alpha0\\nvec3 anisotropyMapData;\\n#endif\\n};\\n#define pbr_inline\\nvoid anisotropicBlock(\\nconst in vec3 vAnisotropy,\\n#ifdef ANISOTROPIC_TEXTURE\\nconst in vec3 anisotropyMapData,\\n#endif\\nconst in mat3 TBN,\\nconst in vec3 normalW,\\nconst in vec3 viewDirectionW,\\nout anisotropicOutParams outParams\\n)\\n{\\nfloat anisotropy=vAnisotropy.b;\\nvec3 anisotropyDirection=vec3(vAnisotropy.xy,0.);\\n#ifdef ANISOTROPIC_TEXTURE\\nanisotropy*=anisotropyMapData.b;\\nanisotropyDirection.rg*=anisotropyMapData.rg*2.0-1.0;\\n#if DEBUGMODE>0\\noutParams.anisotropyMapData=anisotropyMapData;\\n#endif\\n#endif\\nmat3 anisoTBN=mat3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));\\nvec3 anisotropicTangent=normalize(anisoTBN*anisotropyDirection);\\nvec3 anisotropicBitangent=normalize(cross(anisoTBN[2],anisotropicTangent));\\noutParams.anisotropy=anisotropy;\\noutParams.anisotropicTangent=anisotropicTangent;\\noutParams.anisotropicBitangent=anisotropicBitangent;\\noutParams.anisotropicNormal=getAnisotropicBentNormals(anisotropicTangent,anisotropicBitangent,normalW,viewDirectionW,anisotropy);\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockAnisotropic = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockAnisotropic.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockReflection';\r\nvar shader = \"#ifdef REFLECTION\\nstruct reflectionOutParams\\n{\\nvec4 environmentRadiance;\\nvec3 environmentIrradiance;\\n#ifdef REFLECTIONMAP_3D\\nvec3 reflectionCoords;\\n#else\\nvec2 reflectionCoords;\\n#endif\\n#ifdef SS_TRANSLUCENCY\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nvec3 irradianceVector;\\n#endif\\n#endif\\n#endif\\n};\\n#define pbr_inline\\nvoid createReflectionCoords(\\nconst in vec3 vPositionW,\\nconst in vec3 normalW,\\n#ifdef ANISOTROPIC\\nconst in anisotropicOutParams anisotropicOut,\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nout vec3 reflectionCoords\\n#else\\nout vec2 reflectionCoords\\n#endif\\n)\\n{\\n#ifdef ANISOTROPIC\\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),anisotropicOut.anisotropicNormal);\\n#else\\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\\n#endif\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nreflectionVector.z*=-1.0;\\n#endif\\n\\n#ifdef REFLECTIONMAP_3D\\nreflectionCoords=reflectionVector;\\n#else\\nreflectionCoords=reflectionVector.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\nreflectionCoords/=reflectionVector.z;\\n#endif\\nreflectionCoords.y=1.0-reflectionCoords.y;\\n#endif\\n}\\n#define pbr_inline\\n#define inline\\nvoid sampleReflectionTexture(\\nconst in float alphaG,\\nconst in vec3 vReflectionMicrosurfaceInfos,\\nconst in vec2 vReflectionInfos,\\nconst in vec3 vReflectionColor,\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nconst in float NdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nconst in float roughness,\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSampler,\\nconst vec3 reflectionCoords,\\n#else\\nconst in sampler2D reflectionSampler,\\nconst vec2 reflectionCoords,\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSamplerLow,\\nconst in samplerCube reflectionSamplerHigh,\\n#else\\nconst in sampler2D reflectionSamplerLow,\\nconst in sampler2D reflectionSamplerHigh,\\n#endif\\n#endif\\n#ifdef REALTIME_FILTERING\\nconst in vec2 vReflectionFilteringInfo,\\n#endif\\nout vec4 environmentRadiance\\n)\\n{\\n\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);\\n#elif defined(LINEARSPECULARREFLECTION)\\nfloat reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);\\n#else\\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);\\n#endif\\n#ifdef LODBASEDMICROSFURACE\\n\\nreflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\\n#ifdef LODINREFLECTIONALPHA\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfloat automaticReflectionLOD=UNPACK_LOD(sampleReflection(reflectionSampler,reflectionCoords).a);\\nfloat requestedReflectionLOD=max(automaticReflectionLOD,reflectionLOD);\\n#else\\nfloat requestedReflectionLOD=reflectionLOD;\\n#endif\\n#ifdef REALTIME_FILTERING\\nenvironmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0);\\n#else\\nenvironmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\\n#endif\\n#else\\nfloat lodReflectionNormalized=saturate(reflectionLOD/log2(vReflectionMicrosurfaceInfos.x));\\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\\nvec4 environmentMid=sampleReflection(reflectionSampler,reflectionCoords);\\nif (lodReflectionNormalizedDoubled<1.0){\\nenvironmentRadiance=mix(\\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\\nenvironmentMid,\\nlodReflectionNormalizedDoubled\\n);\\n} else {\\nenvironmentRadiance=mix(\\nenvironmentMid,\\nsampleReflection(reflectionSamplerLow,reflectionCoords),\\nlodReflectionNormalizedDoubled-1.0\\n);\\n}\\n#endif\\n#ifdef RGBDREFLECTION\\nenvironmentRadiance.rgb=fromRGBD(environmentRadiance);\\n#endif\\n#ifdef GAMMAREFLECTION\\nenvironmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);\\n#endif\\n\\nenvironmentRadiance.rgb*=vReflectionInfos.x;\\nenvironmentRadiance.rgb*=vReflectionColor.rgb;\\n}\\n#define pbr_inline\\n#define inline\\nvoid reflectionBlock(\\nconst in vec3 vPositionW,\\nconst in vec3 normalW,\\nconst in float alphaG,\\nconst in vec3 vReflectionMicrosurfaceInfos,\\nconst in vec2 vReflectionInfos,\\nconst in vec3 vReflectionColor,\\n#ifdef ANISOTROPIC\\nconst in anisotropicOutParams anisotropicOut,\\n#endif\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nconst in float NdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nconst in float roughness,\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSampler,\\n#else\\nconst in sampler2D reflectionSampler,\\n#endif\\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\\nconst in vec3 vEnvironmentIrradiance,\\n#endif\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nconst in mat4 reflectionMatrix,\\n#endif\\n#endif\\n#ifdef USEIRRADIANCEMAP\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube irradianceSampler,\\n#else\\nconst in sampler2D irradianceSampler,\\n#endif\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSamplerLow,\\nconst in samplerCube reflectionSamplerHigh,\\n#else\\nconst in sampler2D reflectionSamplerLow,\\nconst in sampler2D reflectionSamplerHigh,\\n#endif\\n#endif\\n#ifdef REALTIME_FILTERING\\nconst in vec2 vReflectionFilteringInfo,\\n#endif\\nout reflectionOutParams outParams\\n)\\n{\\n\\nvec4 environmentRadiance=vec4(0.,0.,0.,0.);\\n#ifdef REFLECTIONMAP_3D\\nvec3 reflectionCoords=vec3(0.);\\n#else\\nvec2 reflectionCoords=vec2(0.);\\n#endif\\ncreateReflectionCoords(\\nvPositionW,\\nnormalW,\\n#ifdef ANISOTROPIC\\nanisotropicOut,\\n#endif\\nreflectionCoords\\n);\\nsampleReflectionTexture(\\nalphaG,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nNdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nroughness,\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nreflectionSampler,\\nreflectionCoords,\\n#else\\nreflectionSampler,\\nreflectionCoords,\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\nenvironmentRadiance\\n);\\n\\nvec3 environmentIrradiance=vec3(0.,0.,0.);\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\\nenvironmentIrradiance=vEnvironmentIrradiance;\\n#else\\n#ifdef ANISOTROPIC\\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(anisotropicOut.anisotropicNormal,0)).xyz;\\n#else\\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\\n#endif\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nirradianceVector.z*=-1.0;\\n#endif\\n#ifdef INVERTCUBICMAP\\nirradianceVector.y*=-1.0;\\n#endif\\n#if defined(REALTIME_FILTERING)\\nenvironmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo);\\n#else\\nenvironmentIrradiance=computeEnvironmentIrradiance(irradianceVector);\\n#endif\\n#ifdef SS_TRANSLUCENCY\\noutParams.irradianceVector=irradianceVector;\\n#endif\\n#endif\\n#elif defined(USEIRRADIANCEMAP)\\nvec4 environmentIrradiance4=sampleReflection(irradianceSampler,reflectionCoords);\\nenvironmentIrradiance=environmentIrradiance4.rgb;\\n#ifdef RGBDREFLECTION\\nenvironmentIrradiance.rgb=fromRGBD(environmentIrradiance4);\\n#endif\\n#ifdef GAMMAREFLECTION\\nenvironmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb);\\n#endif\\n#endif\\nenvironmentIrradiance*=vReflectionColor.rgb;\\noutParams.environmentRadiance=environmentRadiance;\\noutParams.environmentIrradiance=environmentIrradiance;\\noutParams.reflectionCoords=reflectionCoords;\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockReflection = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockReflection.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockSheen';\r\nvar shader = \"#ifdef SHEEN\\nstruct sheenOutParams\\n{\\nfloat sheenIntensity;\\nvec3 sheenColor;\\nfloat sheenRoughness;\\n#ifdef SHEEN_LINKWITHALBEDO\\nvec3 surfaceAlbedo;\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\\nfloat sheenAlbedoScaling;\\n#endif\\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nvec3 finalSheenRadianceScaled;\\n#endif\\n#if DEBUGMODE>0\\nvec4 sheenMapData;\\nvec3 sheenEnvironmentReflectance;\\n#endif\\n};\\n#define pbr_inline\\n#define inline\\nvoid sheenBlock(\\nconst in vec4 vSheenColor,\\n#ifdef SHEEN_ROUGHNESS\\nconst in float vSheenRoughness,\\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nconst in vec4 sheenMapRoughnessData,\\n#endif\\n#endif\\nconst in float roughness,\\n#ifdef SHEEN_TEXTURE\\nconst in vec4 sheenMapData,\\n#endif\\nconst in float reflectance,\\n#ifdef SHEEN_LINKWITHALBEDO\\nconst in vec3 baseColor,\\nconst in vec3 surfaceAlbedo,\\n#endif\\n#ifdef ENVIRONMENTBRDF\\nconst in float NdotV,\\nconst in vec3 environmentBrdf,\\n#endif\\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nconst in vec2 AARoughnessFactors,\\nconst in vec3 vReflectionMicrosurfaceInfos,\\nconst in vec2 vReflectionInfos,\\nconst in vec3 vReflectionColor,\\nconst in vec4 vLightingIntensity,\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSampler,\\nconst in vec3 reflectionCoords,\\n#else\\nconst in sampler2D reflectionSampler,\\nconst in vec2 reflectionCoords,\\n#endif\\nconst in float NdotVUnclamped,\\n#ifndef LODBASEDMICROSFURACE\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSamplerLow,\\nconst in samplerCube reflectionSamplerHigh,\\n#else\\nconst in sampler2D reflectionSamplerLow,\\nconst in sampler2D reflectionSamplerHigh,\\n#endif\\n#endif\\n#ifdef REALTIME_FILTERING\\nconst in vec2 vReflectionFilteringInfo,\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\\nconst in float seo,\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\\nconst in float eho,\\n#endif\\n#endif\\nout sheenOutParams outParams\\n)\\n{\\nfloat sheenIntensity=vSheenColor.a;\\n#ifdef SHEEN_TEXTURE\\n#if DEBUGMODE>0\\noutParams.sheenMapData=sheenMapData;\\n#endif\\n#endif\\n#ifdef SHEEN_LINKWITHALBEDO\\nfloat sheenFactor=pow5(1.0-sheenIntensity);\\nvec3 sheenColor=baseColor.rgb*(1.0-sheenFactor);\\nfloat sheenRoughness=sheenIntensity;\\noutParams.surfaceAlbedo=surfaceAlbedo*sheenFactor;\\n#ifdef SHEEN_TEXTURE\\nsheenIntensity*=sheenMapData.a;\\n#endif\\n#else\\nvec3 sheenColor=vSheenColor.rgb;\\n#ifdef SHEEN_TEXTURE\\nsheenColor.rgb*=sheenMapData.rgb;\\n#endif\\n#ifdef SHEEN_ROUGHNESS\\nfloat sheenRoughness=vSheenRoughness;\\n#ifdef SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE\\n#if defined(SHEEN_TEXTURE)\\nsheenRoughness*=sheenMapData.a;\\n#endif\\n#elif defined(SHEEN_TEXTURE_ROUGHNESS)\\n#ifdef SHEEN_TEXTURE_ROUGHNESS_IDENTICAL\\nsheenRoughness*=sheenMapData.a;\\n#else\\nsheenRoughness*=sheenMapRoughnessData.a;\\n#endif\\n#endif\\n#else\\nfloat sheenRoughness=roughness;\\n#ifdef SHEEN_TEXTURE\\nsheenIntensity*=sheenMapData.a;\\n#endif\\n#endif\\n\\n#if !defined(SHEEN_ALBEDOSCALING)\\nsheenIntensity*=(1.-reflectance);\\n#endif\\n\\nsheenColor*=sheenIntensity;\\n#endif\\n\\n#ifdef ENVIRONMENTBRDF\\n\\n#ifdef SHEEN_ROUGHNESS\\nvec3 environmentSheenBrdf=getBRDFLookup(NdotV,sheenRoughness);\\n#else\\nvec3 environmentSheenBrdf=environmentBrdf;\\n#endif\\n\\n#endif\\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nfloat sheenAlphaG=convertRoughnessToAverageSlope(sheenRoughness);\\n#ifdef SPECULARAA\\n\\nsheenAlphaG+=AARoughnessFactors.y;\\n#endif\\nvec4 environmentSheenRadiance=vec4(0.,0.,0.,0.);\\nsampleReflectionTexture(\\nsheenAlphaG,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nNdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nsheenRoughness,\\n#endif\\nreflectionSampler,\\nreflectionCoords,\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\nenvironmentSheenRadiance\\n);\\nvec3 sheenEnvironmentReflectance=getSheenReflectanceFromBRDFLookup(sheenColor,environmentSheenBrdf);\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\\nsheenEnvironmentReflectance*=seo;\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\\nsheenEnvironmentReflectance*=eho;\\n#endif\\n#if DEBUGMODE>0\\noutParams.sheenEnvironmentReflectance=sheenEnvironmentReflectance;\\n#endif\\noutParams.finalSheenRadianceScaled=\\nenvironmentSheenRadiance.rgb *\\nsheenEnvironmentReflectance *\\nvLightingIntensity.z;\\n\\n\\n\\n\\n\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\\n\\n\\n\\noutParams.sheenAlbedoScaling=1.0-sheenIntensity*max(max(sheenColor.r,sheenColor.g),sheenColor.b)*environmentSheenBrdf.b;\\n#endif\\n\\noutParams.sheenIntensity=sheenIntensity;\\noutParams.sheenColor=sheenColor;\\noutParams.sheenRoughness=sheenRoughness;\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockSheen = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockSheen.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockClearcoat';\r\nvar shader = \"struct clearcoatOutParams\\n{\\nvec3 specularEnvironmentR0;\\nfloat conservationFactor;\\nvec3 clearCoatNormalW;\\nvec2 clearCoatAARoughnessFactors;\\nfloat clearCoatIntensity;\\nfloat clearCoatRoughness;\\n#ifdef REFLECTION\\nvec3 finalClearCoatRadianceScaled;\\n#endif\\n#ifdef CLEARCOAT_TINT\\nvec3 absorption;\\nfloat clearCoatNdotVRefract;\\nvec3 clearCoatColor;\\nfloat clearCoatThickness;\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nvec3 energyConservationFactorClearCoat;\\n#endif\\n#if DEBUGMODE>0\\nmat3 TBNClearCoat;\\nvec2 clearCoatMapData;\\nvec4 clearCoatTintMapData;\\nvec4 environmentClearCoatRadiance;\\nfloat clearCoatNdotV;\\nvec3 clearCoatEnvironmentReflectance;\\n#endif\\n};\\n#ifdef CLEARCOAT\\n#define pbr_inline\\n#define inline\\nvoid clearcoatBlock(\\nconst in vec3 vPositionW,\\nconst in vec3 geometricNormalW,\\nconst in vec3 viewDirectionW,\\nconst in vec2 vClearCoatParams,\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nconst in vec4 clearCoatMapRoughnessData,\\n#endif\\nconst in vec3 specularEnvironmentR0,\\n#ifdef CLEARCOAT_TEXTURE\\nconst in vec2 clearCoatMapData,\\n#endif\\n#ifdef CLEARCOAT_TINT\\nconst in vec4 vClearCoatTintParams,\\nconst in float clearCoatColorAtDistance,\\nconst in vec4 vClearCoatRefractionParams,\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nconst in vec4 clearCoatTintMapData,\\n#endif\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nconst in vec2 vClearCoatBumpInfos,\\nconst in vec4 clearCoatBumpMapData,\\nconst in vec2 vClearCoatBumpUV,\\n#if defined(TANGENT) && defined(NORMAL)\\nconst in mat3 vTBN,\\n#else\\nconst in vec2 vClearCoatTangentSpaceParams,\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\nconst in mat4 normalMatrix,\\n#endif\\n#endif\\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\\nconst in vec3 faceNormal,\\n#endif\\n#ifdef REFLECTION\\nconst in vec3 vReflectionMicrosurfaceInfos,\\nconst in vec2 vReflectionInfos,\\nconst in vec3 vReflectionColor,\\nconst in vec4 vLightingIntensity,\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSampler,\\n#else\\nconst in sampler2D reflectionSampler,\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSamplerLow,\\nconst in samplerCube reflectionSamplerHigh,\\n#else\\nconst in sampler2D reflectionSamplerLow,\\nconst in sampler2D reflectionSamplerHigh,\\n#endif\\n#endif\\n#ifdef REALTIME_FILTERING\\nconst in vec2 vReflectionFilteringInfo,\\n#endif\\n#endif\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\n#ifdef RADIANCEOCCLUSION\\nconst in float ambientMonochrome,\\n#endif\\n#endif\\nout clearcoatOutParams outParams\\n)\\n{\\n\\nfloat clearCoatIntensity=vClearCoatParams.x;\\nfloat clearCoatRoughness=vClearCoatParams.y;\\n#ifdef CLEARCOAT_TEXTURE\\nclearCoatIntensity*=clearCoatMapData.x;\\n#ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE\\nclearCoatRoughness*=clearCoatMapData.y;\\n#endif\\n#if DEBUGMODE>0\\noutParams.clearCoatMapData=clearCoatMapData;\\n#endif\\n#endif\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL\\nclearCoatRoughness*=clearCoatMapData.y;\\n#else\\nclearCoatRoughness*=clearCoatMapRoughnessData.y;\\n#endif\\n#endif\\noutParams.clearCoatIntensity=clearCoatIntensity;\\noutParams.clearCoatRoughness=clearCoatRoughness;\\n#ifdef CLEARCOAT_TINT\\nvec3 clearCoatColor=vClearCoatTintParams.rgb;\\nfloat clearCoatThickness=vClearCoatTintParams.a;\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nclearCoatColor*=clearCoatTintMapData.rgb;\\nclearCoatThickness*=clearCoatTintMapData.a;\\n#if DEBUGMODE>0\\noutParams.clearCoatTintMapData=clearCoatTintMapData;\\n#endif\\n#endif\\noutParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);\\noutParams.clearCoatThickness=clearCoatThickness;\\n#endif\\n\\n\\n\\n\\n#ifdef CLEARCOAT_REMAP_F0\\nvec3 specularEnvironmentR0Updated=getR0RemappedForClearCoat(specularEnvironmentR0);\\n#else\\nvec3 specularEnvironmentR0Updated=specularEnvironmentR0;\\n#endif\\noutParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);\\n\\nvec3 clearCoatNormalW=geometricNormalW;\\n#ifdef CLEARCOAT_BUMP\\n#ifdef NORMALXYSCALE\\nfloat clearCoatNormalScale=1.0;\\n#else\\nfloat clearCoatNormalScale=vClearCoatBumpInfos.y;\\n#endif\\n#if defined(TANGENT) && defined(NORMAL)\\nmat3 TBNClearCoat=vTBN;\\n#else\\nmat3 TBNClearCoat=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,vClearCoatBumpUV,vClearCoatTangentSpaceParams);\\n#endif\\n#if DEBUGMODE>0\\noutParams.TBNClearCoat=TBNClearCoat;\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\nclearCoatNormalW=normalize(clearCoatBumpMapData.xyz*2.0-1.0);\\nclearCoatNormalW=normalize(mat3(normalMatrix)*clearCoatNormalW);\\n#else\\nclearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y);\\n#endif\\n#endif\\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\\nclearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal));\\n#endif\\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\\nclearCoatNormalW=gl_FrontFacing ? clearCoatNormalW : -clearCoatNormalW;\\n#endif\\noutParams.clearCoatNormalW=clearCoatNormalW;\\n\\noutParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);\\n\\nfloat clearCoatNdotVUnclamped=dot(clearCoatNormalW,viewDirectionW);\\n\\nfloat clearCoatNdotV=absEps(clearCoatNdotVUnclamped);\\n#if DEBUGMODE>0\\noutParams.clearCoatNdotV=clearCoatNdotV;\\n#endif\\n#ifdef CLEARCOAT_TINT\\n\\nvec3 clearCoatVRefract=-refract(vPositionW,clearCoatNormalW,vClearCoatRefractionParams.y);\\n\\noutParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract));\\n#endif\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\n\\nvec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);\\n#endif\\n\\n#if defined(REFLECTION)\\nfloat clearCoatAlphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\\n#ifdef SPECULARAA\\n\\nclearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y;\\n#endif\\nvec4 environmentClearCoatRadiance=vec4(0.,0.,0.,0.);\\nvec3 clearCoatReflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),clearCoatNormalW);\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nclearCoatReflectionVector.z*=-1.0;\\n#endif\\n\\n#ifdef REFLECTIONMAP_3D\\nvec3 clearCoatReflectionCoords=clearCoatReflectionVector;\\n#else\\nvec2 clearCoatReflectionCoords=clearCoatReflectionVector.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\nclearCoatReflectionCoords/=clearCoatReflectionVector.z;\\n#endif\\nclearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y;\\n#endif\\nsampleReflectionTexture(\\nclearCoatAlphaG,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nclearCoatNdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nclearCoatRoughness,\\n#endif\\nreflectionSampler,\\nclearCoatReflectionCoords,\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\nenvironmentClearCoatRadiance\\n);\\n#if DEBUGMODE>0\\noutParams.environmentClearCoatRadiance=environmentClearCoatRadiance;\\n#endif\\n\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf);\\n#ifdef RADIANCEOCCLUSION\\nfloat clearCoatSeo=environmentRadianceOcclusion(ambientMonochrome,clearCoatNdotVUnclamped);\\nclearCoatEnvironmentReflectance*=clearCoatSeo;\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nfloat clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);\\nclearCoatEnvironmentReflectance*=clearCoatEho;\\n#endif\\n#endif\\n#endif\\n#else\\n\\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness));\\n#endif\\nclearCoatEnvironmentReflectance*=clearCoatIntensity;\\n#if DEBUGMODE>0\\noutParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance;\\n#endif\\noutParams.finalClearCoatRadianceScaled=\\nenvironmentClearCoatRadiance.rgb *\\nclearCoatEnvironmentReflectance *\\nvLightingIntensity.z;\\n#endif\\n#if defined(CLEARCOAT_TINT)\\n\\noutParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity);\\n#endif\\n\\nfloat fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\\nfresnelIBLClearCoat*=clearCoatIntensity;\\noutParams.conservationFactor=(1.-fresnelIBLClearCoat);\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\noutParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf);\\n#endif\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockClearcoat = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockClearcoat.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockSubSurface';\r\nvar shader = \"struct subSurfaceOutParams\\n{\\nvec3 specularEnvironmentReflectance;\\n#ifdef SS_REFRACTION\\nvec3 finalRefraction;\\nvec3 surfaceAlbedo;\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nfloat alpha;\\n#endif\\n#ifdef REFLECTION\\nfloat refractionFactorForIrradiance;\\n#endif\\n#endif\\n#ifdef SS_TRANSLUCENCY\\nvec3 transmittance;\\nfloat translucencyIntensity;\\n#ifdef REFLECTION\\nvec3 refractionIrradiance;\\n#endif\\n#endif\\n#if DEBUGMODE>0\\nvec4 thicknessMap;\\nvec4 environmentRefraction;\\nvec3 refractionTransmittance;\\n#endif\\n};\\n#ifdef SUBSURFACE\\n#define pbr_inline\\n#define inline\\nvoid subSurfaceBlock(\\nconst in vec3 vSubSurfaceIntensity,\\nconst in vec2 vThicknessParam,\\nconst in vec4 vTintColor,\\nconst in vec3 normalW,\\nconst in vec3 specularEnvironmentReflectance,\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nconst in vec4 thicknessMap,\\n#endif\\n#ifdef REFLECTION\\n#ifdef SS_TRANSLUCENCY\\nconst in mat4 reflectionMatrix,\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nconst in vec3 irradianceVector_,\\n#endif\\n#if defined(REALTIME_FILTERING)\\nconst in samplerCube reflectionSampler,\\nconst in vec2 vReflectionFilteringInfo,\\n#endif\\n#endif\\n#ifdef USEIRRADIANCEMAP\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube irradianceSampler,\\n#else\\nconst in sampler2D irradianceSampler,\\n#endif\\n#endif\\n#endif\\n#endif\\n#ifdef SS_REFRACTION\\nconst in vec3 vPositionW,\\nconst in vec3 viewDirectionW,\\nconst in mat4 view,\\nconst in vec3 surfaceAlbedo,\\nconst in vec4 vRefractionInfos,\\nconst in mat4 refractionMatrix,\\nconst in vec3 vRefractionMicrosurfaceInfos,\\nconst in vec4 vLightingIntensity,\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nconst in float alpha,\\n#endif\\n#ifdef SS_LODINREFRACTIONALPHA\\nconst in float NdotVUnclamped,\\n#endif\\n#ifdef SS_LINEARSPECULARREFRACTION\\nconst in float roughness,\\n#else\\nconst in float alphaG,\\n#endif\\n#ifdef SS_REFRACTIONMAP_3D\\nconst in samplerCube refractionSampler,\\n#ifndef LODBASEDMICROSFURACE\\nconst in samplerCube refractionSamplerLow,\\nconst in samplerCube refractionSamplerHigh,\\n#endif\\n#else\\nconst in sampler2D refractionSampler,\\n#ifndef LODBASEDMICROSFURACE\\nconst in sampler2D refractionSamplerLow,\\nconst in sampler2D refractionSamplerHigh,\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\nconst in anisotropicOutParams anisotropicOut,\\n#endif\\n#ifdef REALTIME_FILTERING\\nconst in vec2 vRefractionFilteringInfo,\\n#endif\\n#endif\\n#ifdef SS_TRANSLUCENCY\\nconst in vec3 vDiffusionDistance,\\n#endif\\nout subSurfaceOutParams outParams\\n)\\n{\\noutParams.specularEnvironmentReflectance=specularEnvironmentReflectance;\\n\\n\\n\\n#ifdef SS_REFRACTION\\nfloat refractionIntensity=vSubSurfaceIntensity.x;\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nrefractionIntensity*=(1.0-alpha);\\n\\noutParams.alpha=1.0;\\n#endif\\n#endif\\n#ifdef SS_TRANSLUCENCY\\nfloat translucencyIntensity=vSubSurfaceIntensity.y;\\n#endif\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nfloat thickness=thicknessMap.r*vThicknessParam.y+vThicknessParam.x;\\n#if DEBUGMODE>0\\noutParams.thicknessMap=thicknessMap;\\n#endif\\n#ifdef SS_MASK_FROM_THICKNESS_TEXTURE\\n#ifdef SS_REFRACTION\\nrefractionIntensity*=thicknessMap.g;\\n#endif\\n#ifdef SS_TRANSLUCENCY\\ntranslucencyIntensity*=thicknessMap.b;\\n#endif\\n#elif defined(SS_MASK_FROM_THICKNESS_TEXTURE_GLTF)\\n#ifdef SS_REFRACTION\\nrefractionIntensity*=thicknessMap.r;\\n#elif defined(SS_TRANSLUCENCY)\\ntranslucencyIntensity*=thicknessMap.r;\\n#endif\\nthickness=thicknessMap.g*vThicknessParam.y+vThicknessParam.x;\\n#endif\\n#else\\nfloat thickness=vThicknessParam.y;\\n#endif\\n\\n\\n\\n#ifdef SS_TRANSLUCENCY\\nthickness=maxEps(thickness);\\nvec3 transmittance=transmittanceBRDF_Burley(vTintColor.rgb,vDiffusionDistance,thickness);\\ntransmittance*=translucencyIntensity;\\noutParams.transmittance=transmittance;\\noutParams.translucencyIntensity=translucencyIntensity;\\n#endif\\n\\n\\n\\n#ifdef SS_REFRACTION\\nvec4 environmentRefraction=vec4(0.,0.,0.,0.);\\n#ifdef ANISOTROPIC\\nvec3 refractionVector=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,vRefractionInfos.y);\\n#else\\nvec3 refractionVector=refract(-viewDirectionW,normalW,vRefractionInfos.y);\\n#endif\\n#ifdef SS_REFRACTIONMAP_OPPOSITEZ\\nrefractionVector.z*=-1.0;\\n#endif\\n\\n#ifdef SS_REFRACTIONMAP_3D\\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\\nvec3 refractionCoords=refractionVector;\\nrefractionCoords=vec3(refractionMatrix*vec4(refractionCoords,0));\\n#else\\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\\nrefractionCoords.y=1.0-refractionCoords.y;\\n#endif\\n#ifdef SS_LODINREFRACTIONALPHA\\nfloat refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);\\n#elif defined(SS_LINEARSPECULARREFRACTION)\\nfloat refractionLOD=getLinearLodFromRoughness(vRefractionMicrosurfaceInfos.x,roughness);\\n#else\\nfloat refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,alphaG);\\n#endif\\n#ifdef LODBASEDMICROSFURACE\\n\\nrefractionLOD=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z;\\n#ifdef SS_LODINREFRACTIONALPHA\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfloat automaticRefractionLOD=UNPACK_LOD(sampleRefraction(refractionSampler,refractionCoords).a);\\nfloat requestedRefractionLOD=max(automaticRefractionLOD,refractionLOD);\\n#else\\nfloat requestedRefractionLOD=refractionLOD;\\n#endif\\n#ifdef REALTIME_FILTERING\\nenvironmentRefraction=vec4(radiance(alphaG,refractionSampler,refractionCoords,vRefractionFilteringInfo),1.0);\\n#else\\nenvironmentRefraction=sampleRefractionLod(refractionSampler,refractionCoords,requestedRefractionLOD);\\n#endif\\n#else\\nfloat lodRefractionNormalized=saturate(refractionLOD/log2(vRefractionMicrosurfaceInfos.x));\\nfloat lodRefractionNormalizedDoubled=lodRefractionNormalized*2.0;\\nvec4 environmentRefractionMid=sampleRefraction(refractionSampler,refractionCoords);\\nif (lodRefractionNormalizedDoubled<1.0){\\nenvironmentRefraction=mix(\\nsampleRefraction(refractionSamplerHigh,refractionCoords),\\nenvironmentRefractionMid,\\nlodRefractionNormalizedDoubled\\n);\\n} else {\\nenvironmentRefraction=mix(\\nenvironmentRefractionMid,\\nsampleRefraction(refractionSamplerLow,refractionCoords),\\nlodRefractionNormalizedDoubled-1.0\\n);\\n}\\n#endif\\n#ifdef SS_RGBDREFRACTION\\nenvironmentRefraction.rgb=fromRGBD(environmentRefraction);\\n#endif\\n#ifdef SS_GAMMAREFRACTION\\nenvironmentRefraction.rgb=toLinearSpace(environmentRefraction.rgb);\\n#endif\\n\\nenvironmentRefraction.rgb*=vRefractionInfos.x;\\n#endif\\n\\n\\n\\n#ifdef SS_REFRACTION\\nvec3 refractionTransmittance=vec3(refractionIntensity);\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\\n\\n\\n\\n\\n\\nrefractionTransmittance*=cocaLambert(volumeAlbedo,thickness);\\n#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)\\n\\nfloat maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);\\nvec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);\\n\\nenvironmentRefraction.rgb*=volumeAlbedo;\\n#else\\n\\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\\nrefractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y);\\n#endif\\n#ifdef SS_ALBEDOFORREFRACTIONTINT\\n\\nenvironmentRefraction.rgb*=surfaceAlbedo.rgb;\\n#endif\\n\\noutParams.surfaceAlbedo=surfaceAlbedo*(1.-refractionIntensity);\\n#ifdef REFLECTION\\n\\noutParams.refractionFactorForIrradiance=(1.-refractionIntensity);\\n\\n#endif\\n\\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);\\noutParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);\\n\\nrefractionTransmittance*=1.0-outParams.specularEnvironmentReflectance;\\n#if DEBUGMODE>0\\noutParams.refractionTransmittance=refractionTransmittance;\\n#endif\\noutParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;\\n#if DEBUGMODE>0\\noutParams.environmentRefraction=environmentRefraction;\\n#endif\\n#endif\\n\\n\\n\\n#if defined(REFLECTION) && defined(SS_TRANSLUCENCY)\\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP)\\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nirradianceVector.z*=-1.0;\\n#endif\\n#ifdef INVERTCUBICMAP\\nirradianceVector.y*=-1.0;\\n#endif\\n#else\\nvec3 irradianceVector=irradianceVector_;\\n#endif\\n#if defined(USESPHERICALFROMREFLECTIONMAP)\\n#if defined(REALTIME_FILTERING)\\nvec3 refractionIrradiance=irradiance(reflectionSampler,-irradianceVector,vReflectionFilteringInfo);\\n#else\\nvec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector);\\n#endif\\n#elif defined(USEIRRADIANCEMAP)\\n#ifdef REFLECTIONMAP_3D\\nvec3 irradianceCoords=irradianceVector;\\n#else\\nvec2 irradianceCoords=irradianceVector.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\nirradianceCoords/=irradianceVector.z;\\n#endif\\nirradianceCoords.y=1.0-irradianceCoords.y;\\n#endif\\nvec4 refractionIrradiance=sampleReflection(irradianceSampler,-irradianceCoords);\\n#ifdef RGBDREFLECTION\\nrefractionIrradiance.rgb=fromRGBD(refractionIrradiance);\\n#endif\\n#ifdef GAMMAREFLECTION\\nrefractionIrradiance.rgb=toLinearSpace(refractionIrradiance.rgb);\\n#endif\\n#else\\nvec4 refractionIrradiance=vec4(0.);\\n#endif\\nrefractionIrradiance.rgb*=transmittance;\\noutParams.refractionIrradiance=refractionIrradiance.rgb;\\n#endif\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockSubSurface = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockSubSurface.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockNormalGeometric';\r\nvar shader = \"vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\\n#ifdef NORMAL\\nvec3 normalW=normalize(vNormalW);\\n#else\\nvec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\\n#endif\\nvec3 geometricNormalW=normalW;\\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\\ngeometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW;\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockNormalGeometric = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockNormalGeometric.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockNormalFinal';\r\nvar shader = \"#if defined(FORCENORMALFORWARD) && defined(NORMAL)\\nvec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\\n#if defined(TWOSIDEDLIGHTING)\\nfaceNormal=gl_FrontFacing ? faceNormal : -faceNormal;\\n#endif\\nnormalW*=sign(dot(normalW,faceNormal));\\n#endif\\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\\nnormalW=gl_FrontFacing ? normalW : -normalW;\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockNormalFinal = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockNormalFinal.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockLightmapInit';\r\nvar shader = \"#ifdef LIGHTMAP\\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\\n#ifdef RGBDLIGHTMAP\\nlightmapColor.rgb=fromRGBD(lightmapColor);\\n#endif\\n#ifdef GAMMALIGHTMAP\\nlightmapColor.rgb=toLinearSpace(lightmapColor.rgb);\\n#endif\\nlightmapColor.rgb*=vLightmapInfos.y;\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockLightmapInit = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockLightmapInit.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockGeometryInfo';\r\nvar shader = \"float NdotVUnclamped=dot(normalW,viewDirectionW);\\n\\nfloat NdotV=absEps(NdotVUnclamped);\\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\\nvec2 AARoughnessFactors=getAARoughnessFactors(normalW.xyz);\\n#ifdef SPECULARAA\\n\\nalphaG+=AARoughnessFactors.y;\\n#endif\\n#if defined(ENVIRONMENTBRDF)\\n\\nvec3 environmentBrdf=getBRDFLookup(NdotV,roughness);\\n#endif\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\n#ifdef RADIANCEOCCLUSION\\n#ifdef AMBIENTINGRAYSCALE\\nfloat ambientMonochrome=aoOut.ambientOcclusionColor.r;\\n#else\\nfloat ambientMonochrome=getLuminance(aoOut.ambientOcclusionColor);\\n#endif\\nfloat seo=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nfloat eho=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);\\n#endif\\n#endif\\n#endif\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockGeometryInfo = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockGeometryInfo.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockReflectance0';\r\nvar shader = \"float reflectance=max(max(reflectivityOut.surfaceReflectivityColor.r,reflectivityOut.surfaceReflectivityColor.g),reflectivityOut.surfaceReflectivityColor.b);\\nvec3 specularEnvironmentR0=reflectivityOut.surfaceReflectivityColor.rgb;\\n#ifdef METALLICWORKFLOW\\nvec3 specularEnvironmentR90=vec3(metallicReflectanceFactors.a);\\n#else\\nvec3 specularEnvironmentR90=vec3(1.0,1.0,1.0);\\n#endif\\n\\n#ifdef ALPHAFRESNEL\\nfloat reflectance90=fresnelGrazingReflectance(reflectance);\\nspecularEnvironmentR90=specularEnvironmentR90*reflectance90;\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockReflectance0 = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockReflectance0.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockReflectance';\r\nvar shader = \"#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\nvec3 specularEnvironmentReflectance=getReflectanceFromBRDFLookup(clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,environmentBrdf);\\n#ifdef RADIANCEOCCLUSION\\nspecularEnvironmentReflectance*=seo;\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nspecularEnvironmentReflectance*=eho;\\n#endif\\n#endif\\n#endif\\n#else\\n\\nvec3 specularEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));\\n#endif\\n#ifdef CLEARCOAT\\nspecularEnvironmentReflectance*=clearcoatOut.conservationFactor;\\n#if defined(CLEARCOAT_TINT)\\nspecularEnvironmentReflectance*=clearcoatOut.absorption;\\n#endif\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockReflectance = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockReflectance.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockDirectLighting';\r\nvar shader = \"vec3 diffuseBase=vec3(0.,0.,0.);\\n#ifdef SPECULARTERM\\nvec3 specularBase=vec3(0.,0.,0.);\\n#endif\\n#ifdef CLEARCOAT\\nvec3 clearCoatBase=vec3(0.,0.,0.);\\n#endif\\n#ifdef SHEEN\\nvec3 sheenBase=vec3(0.,0.,0.);\\n#endif\\n\\npreLightingInfo preInfo;\\nlightingInfo info;\\nfloat shadow=1.;\\n#if defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\\nvec3 absorption=vec3(0.);\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockDirectLighting = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockDirectLighting.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockFinalLitComponents';\r\nvar shader = \"\\n\\n\\n\\n#if defined(ENVIRONMENTBRDF)\\n#ifdef MS_BRDF_ENERGY_CONSERVATION\\nvec3 energyConservationFactor=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf);\\n#endif\\n#endif\\n#ifndef METALLICWORKFLOW\\n#ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION\\nsurfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;\\n#endif\\n#endif\\n#if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF)\\nsurfaceAlbedo.rgb=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb;\\n#endif\\n\\n#ifdef REFLECTION\\nvec3 finalIrradiance=reflectionOut.environmentIrradiance;\\n#if defined(CLEARCOAT)\\nfinalIrradiance*=clearcoatOut.conservationFactor;\\n#if defined(CLEARCOAT_TINT)\\nfinalIrradiance*=clearcoatOut.absorption;\\n#endif\\n#endif\\n#if defined(SS_REFRACTION)\\nfinalIrradiance*=subSurfaceOut.refractionFactorForIrradiance;\\n#endif\\n#if defined(SS_TRANSLUCENCY)\\nfinalIrradiance*=(1.0-subSurfaceOut.translucencyIntensity);\\nfinalIrradiance+=subSurfaceOut.refractionIrradiance;\\n#endif\\nfinalIrradiance*=surfaceAlbedo.rgb;\\nfinalIrradiance*=vLightingIntensity.z;\\nfinalIrradiance*=aoOut.ambientOcclusionColor;\\n#endif\\n\\n#ifdef SPECULARTERM\\nvec3 finalSpecular=specularBase;\\nfinalSpecular=max(finalSpecular,0.0);\\nvec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalSpecularScaled*=energyConservationFactor;\\n#endif\\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\\nfinalSpecularScaled*=sheenOut.sheenAlbedoScaling;\\n#endif\\n#endif\\n\\n#ifdef REFLECTION\\nvec3 finalRadiance=reflectionOut.environmentRadiance.rgb;\\nfinalRadiance*=subSurfaceOut.specularEnvironmentReflectance;\\nvec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalRadianceScaled*=energyConservationFactor;\\n#endif\\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\\nfinalRadianceScaled*=sheenOut.sheenAlbedoScaling;\\n#endif\\n#endif\\n\\n#ifdef SHEEN\\nvec3 finalSheen=sheenBase*sheenOut.sheenColor;\\nfinalSheen=max(finalSheen,0.0);\\nvec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w;\\n#if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor;\\n#if defined(CLEARCOAT_TINT)\\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption;\\n#endif\\n#endif\\n#endif\\n\\n#ifdef CLEARCOAT\\nvec3 finalClearCoat=clearCoatBase;\\nfinalClearCoat=max(finalClearCoat,0.0);\\nvec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat;\\n#endif\\n#ifdef SS_REFRACTION\\nsubSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor;\\n#ifdef CLEARCOAT_TINT\\nsubSurfaceOut.finalRefraction*=clearcoatOut.absorption;\\n#endif\\n#endif\\n#endif\\n\\n#ifdef ALPHABLEND\\nfloat luminanceOverAlpha=0.0;\\n#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalRadianceScaled);\\n#if defined(CLEARCOAT)\\nluminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled);\\n#endif\\n#endif\\n#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalSpecularScaled);\\n#endif\\n#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalClearCoatScaled);\\n#endif\\n#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA) || defined(CLEARCOATOVERALPHA)\\nalpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);\\n#endif\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockFinalLitComponents = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockFinalLitComponents.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockFinalUnlitComponents';\r\nvar shader = \"\\nvec3 finalDiffuse=diffuseBase;\\nfinalDiffuse*=surfaceAlbedo.rgb;\\nfinalDiffuse=max(finalDiffuse,0.0);\\nfinalDiffuse*=vLightingIntensity.x;\\n\\nvec3 finalAmbient=vAmbientColor;\\nfinalAmbient*=surfaceAlbedo.rgb;\\n\\nvec3 finalEmissive=vEmissiveColor;\\n#ifdef EMISSIVE\\nvec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;\\nfinalEmissive*=toLinearSpace(emissiveColorTex.rgb);\\nfinalEmissive*=vEmissiveInfos.y;\\n#endif\\nfinalEmissive*=vLightingIntensity.y;\\n\\n#ifdef AMBIENT\\nvec3 ambientOcclusionForDirectDiffuse=mix(vec3(1.),aoOut.ambientOcclusionColor,vAmbientInfos.w);\\n#else\\nvec3 ambientOcclusionForDirectDiffuse=aoOut.ambientOcclusionColor;\\n#endif\\nfinalAmbient*=aoOut.ambientOcclusionColor;\\nfinalDiffuse*=ambientOcclusionForDirectDiffuse;\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockFinalUnlitComponents = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockFinalUnlitComponents.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockFinalColorComposition';\r\nvar shader = \"vec4 finalColor=vec4(\\nfinalAmbient +\\nfinalDiffuse +\\n#ifndef UNLIT\\n#ifdef REFLECTION\\nfinalIrradiance +\\n#endif\\n#ifdef SPECULARTERM\\nfinalSpecularScaled +\\n#endif\\n#ifdef SHEEN\\nfinalSheenScaled +\\n#endif\\n#ifdef CLEARCOAT\\nfinalClearCoatScaled +\\n#endif\\n#ifdef REFLECTION\\nfinalRadianceScaled +\\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\\nsheenOut.finalSheenRadianceScaled +\\n#endif\\n#ifdef CLEARCOAT\\nclearcoatOut.finalClearCoatRadianceScaled +\\n#endif\\n#endif\\n#ifdef SS_REFRACTION\\nsubSurfaceOut.finalRefraction +\\n#endif\\n#endif\\nfinalEmissive,\\nalpha);\\n\\n#ifdef LIGHTMAP\\n#ifndef LIGHTMAPEXCLUDED\\n#ifdef USELIGHTMAPASSHADOWMAP\\nfinalColor.rgb*=lightmapColor.rgb;\\n#else\\nfinalColor.rgb+=lightmapColor.rgb;\\n#endif\\n#endif\\n#endif\\n#define CUSTOM_FRAGMENT_BEFORE_FOG\\n\\nfinalColor=max(finalColor,0.0);\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockFinalColorComposition = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockFinalColorComposition.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockImageProcessing';\r\nvar shader = \"#ifdef IMAGEPROCESSINGPOSTPROCESS\\n\\n\\nfinalColor.rgb=clamp(finalColor.rgb,0.,30.0);\\n#else\\n\\nfinalColor=applyImageProcessing(finalColor);\\n#endif\\nfinalColor.a*=visibility;\\n#ifdef PREMULTIPLYALPHA\\n\\nfinalColor.rgb*=finalColor.a;\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockImageProcessing = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockImageProcessing.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrDebug';\r\nvar shader = \"#if DEBUGMODE>0\\nif (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) {\\n\\n#if DEBUGMODE == 1\\ngl_FragColor.rgb=vPositionW.rgb;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 2 && defined(NORMAL)\\ngl_FragColor.rgb=vNormalW.rgb;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 3 && defined(BUMP) || DEBUGMODE == 3 && defined(PARALLAX) || DEBUGMODE == 3 && defined(ANISOTROPIC)\\n\\ngl_FragColor.rgb=TBN[0];\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 4 && defined(BUMP) || DEBUGMODE == 4 && defined(PARALLAX) || DEBUGMODE == 4 && defined(ANISOTROPIC)\\n\\ngl_FragColor.rgb=TBN[1];\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 5\\n\\ngl_FragColor.rgb=normalW;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 6 && defined(MAINUV1)\\ngl_FragColor.rgb=vec3(vMainUV1,0.0);\\n#elif DEBUGMODE == 7 && defined(MAINUV2)\\ngl_FragColor.rgb=vec3(vMainUV2,0.0);\\n#elif DEBUGMODE == 8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\\n\\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[0];\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\\n\\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[1];\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 10 && defined(CLEARCOAT)\\n\\ngl_FragColor.rgb=clearcoatOut.clearCoatNormalW;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 11 && defined(ANISOTROPIC)\\ngl_FragColor.rgb=anisotropicOut.anisotropicNormal;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 12 && defined(ANISOTROPIC)\\ngl_FragColor.rgb=anisotropicOut.anisotropicTangent;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 13 && defined(ANISOTROPIC)\\ngl_FragColor.rgb=anisotropicOut.anisotropicBitangent;\\n#define DEBUGMODE_NORMALIZE\\n\\n#elif DEBUGMODE == 20 && defined(ALBEDO)\\ngl_FragColor.rgb=albedoTexture.rgb;\\n#elif DEBUGMODE == 21 && defined(AMBIENT)\\ngl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb;\\n#elif DEBUGMODE == 22 && defined(OPACITY)\\ngl_FragColor.rgb=opacityMap.rgb;\\n#elif DEBUGMODE == 23 && defined(EMISSIVE)\\ngl_FragColor.rgb=emissiveColorTex.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 24 && defined(LIGHTMAP)\\ngl_FragColor.rgb=lightmapColor.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)\\ngl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb;\\n#elif DEBUGMODE == 26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)\\ngl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)\\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0);\\n#elif DEBUGMODE == 28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\\ngl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb;\\n#elif DEBUGMODE == 29 && defined(SHEEN) && defined(SHEEN_TEXTURE)\\ngl_FragColor.rgb=sheenOut.sheenMapData.rgb;\\n#elif DEBUGMODE == 30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)\\ngl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb;\\n#elif DEBUGMODE == 31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)\\ngl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb;\\n\\n#elif DEBUGMODE == 40 && defined(SS_REFRACTION)\\n\\ngl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 41 && defined(REFLECTION)\\ngl_FragColor.rgb=reflectionOut.environmentRadiance.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 42 && defined(CLEARCOAT) && defined(REFLECTION)\\ngl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb;\\n#define DEBUGMODE_GAMMA\\n\\n#elif DEBUGMODE == 50\\ngl_FragColor.rgb=diffuseBase.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 51 && defined(SPECULARTERM)\\ngl_FragColor.rgb=specularBase.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 52 && defined(CLEARCOAT)\\ngl_FragColor.rgb=clearCoatBase.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 53 && defined(SHEEN)\\ngl_FragColor.rgb=sheenBase.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 54 && defined(REFLECTION)\\ngl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb;\\n#define DEBUGMODE_GAMMA\\n\\n#elif DEBUGMODE == 60\\ngl_FragColor.rgb=surfaceAlbedo.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 61\\ngl_FragColor.rgb=clearcoatOut.specularEnvironmentR0;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 62 && defined(METALLICWORKFLOW)\\ngl_FragColor.rgb=vec3(reflectivityOut.metallicRoughness.r);\\n#elif DEBUGMODE == 71 && defined(METALLICWORKFLOW)\\ngl_FragColor.rgb=reflectivityOut.metallicF0;\\n#elif DEBUGMODE == 63\\ngl_FragColor.rgb=vec3(roughness);\\n#elif DEBUGMODE == 64\\ngl_FragColor.rgb=vec3(alphaG);\\n#elif DEBUGMODE == 65\\ngl_FragColor.rgb=vec3(NdotV);\\n#elif DEBUGMODE == 66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\\ngl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 67 && defined(CLEARCOAT)\\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness);\\n#elif DEBUGMODE == 68 && defined(CLEARCOAT)\\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV);\\n#elif DEBUGMODE == 69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)\\ngl_FragColor.rgb=subSurfaceOut.transmittance;\\n#elif DEBUGMODE == 70 && defined(SUBSURFACE) && defined(SS_REFRACTION)\\ngl_FragColor.rgb=subSurfaceOut.refractionTransmittance;\\n\\n#elif DEBUGMODE == 80 && defined(RADIANCEOCCLUSION)\\ngl_FragColor.rgb=vec3(seo);\\n#elif DEBUGMODE == 81 && defined(HORIZONOCCLUSION)\\ngl_FragColor.rgb=vec3(eho);\\n#elif DEBUGMODE == 82 && defined(MS_BRDF_ENERGY_CONSERVATION)\\ngl_FragColor.rgb=vec3(energyConservationFactor);\\n#elif DEBUGMODE == 83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\ngl_FragColor.rgb=specularEnvironmentReflectance;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\ngl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 85 && defined(SHEEN) && defined(REFLECTION)\\ngl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 86 && defined(ALPHABLEND)\\ngl_FragColor.rgb=vec3(luminanceOverAlpha);\\n#elif DEBUGMODE == 87\\ngl_FragColor.rgb=vec3(alpha);\\n#endif\\ngl_FragColor.rgb*=vDebugMode.y;\\n#ifdef DEBUGMODE_NORMALIZE\\ngl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5;\\n#endif\\n#ifdef DEBUGMODE_GAMMA\\ngl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb);\\n#endif\\ngl_FragColor.a=1.0;\\n#ifdef PREPASS\\ngl_FragData[0]=toLinearSpace(gl_FragColor);\\ngl_FragData[1]=vec4(0.,0.,0.,0.);\\n#endif\\nreturn;\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrDebug = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrDebug.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/prePassDeclaration\";\r\nimport \"./ShadersInclude/pbrFragmentDeclaration\";\r\nimport \"./ShadersInclude/pbrUboDeclaration\";\r\nimport \"./ShadersInclude/pbrFragmentExtraDeclaration\";\r\nimport \"./ShadersInclude/lightFragmentDeclaration\";\r\nimport \"./ShadersInclude/lightUboDeclaration\";\r\nimport \"./ShadersInclude/pbrFragmentSamplersDeclaration\";\r\nimport \"./ShadersInclude/imageProcessingDeclaration\";\r\nimport \"./ShadersInclude/clipPlaneFragmentDeclaration\";\r\nimport \"./ShadersInclude/logDepthDeclaration\";\r\nimport \"./ShadersInclude/fogFragmentDeclaration\";\r\nimport \"./ShadersInclude/helperFunctions\";\r\nimport \"./ShadersInclude/subSurfaceScatteringFunctions\";\r\nimport \"./ShadersInclude/importanceSampling\";\r\nimport \"./ShadersInclude/pbrHelperFunctions\";\r\nimport \"./ShadersInclude/imageProcessingFunctions\";\r\nimport \"./ShadersInclude/shadowsFragmentFunctions\";\r\nimport \"./ShadersInclude/harmonicsFunctions\";\r\nimport \"./ShadersInclude/pbrDirectLightingSetupFunctions\";\r\nimport \"./ShadersInclude/pbrDirectLightingFalloffFunctions\";\r\nimport \"./ShadersInclude/pbrBRDFFunctions\";\r\nimport \"./ShadersInclude/hdrFilteringFunctions\";\r\nimport \"./ShadersInclude/pbrDirectLightingFunctions\";\r\nimport \"./ShadersInclude/pbrIBLFunctions\";\r\nimport \"./ShadersInclude/bumpFragmentMainFunctions\";\r\nimport \"./ShadersInclude/bumpFragmentFunctions\";\r\nimport \"./ShadersInclude/reflectionFunction\";\r\nimport \"./ShadersInclude/pbrBlockAlbedoOpacity\";\r\nimport \"./ShadersInclude/pbrBlockReflectivity\";\r\nimport \"./ShadersInclude/pbrBlockAmbientOcclusion\";\r\nimport \"./ShadersInclude/pbrBlockAlphaFresnel\";\r\nimport \"./ShadersInclude/pbrBlockAnisotropic\";\r\nimport \"./ShadersInclude/pbrBlockReflection\";\r\nimport \"./ShadersInclude/pbrBlockSheen\";\r\nimport \"./ShadersInclude/pbrBlockClearcoat\";\r\nimport \"./ShadersInclude/pbrBlockSubSurface\";\r\nimport \"./ShadersInclude/clipPlaneFragment\";\r\nimport \"./ShadersInclude/pbrBlockNormalGeometric\";\r\nimport \"./ShadersInclude/bumpFragment\";\r\nimport \"./ShadersInclude/pbrBlockNormalFinal\";\r\nimport \"./ShadersInclude/depthPrePass\";\r\nimport \"./ShadersInclude/pbrBlockLightmapInit\";\r\nimport \"./ShadersInclude/pbrBlockGeometryInfo\";\r\nimport \"./ShadersInclude/pbrBlockReflectance0\";\r\nimport \"./ShadersInclude/pbrBlockReflectance\";\r\nimport \"./ShadersInclude/pbrBlockDirectLighting\";\r\nimport \"./ShadersInclude/lightFragment\";\r\nimport \"./ShadersInclude/pbrBlockFinalLitComponents\";\r\nimport \"./ShadersInclude/pbrBlockFinalUnlitComponents\";\r\nimport \"./ShadersInclude/pbrBlockFinalColorComposition\";\r\nimport \"./ShadersInclude/logDepthFragment\";\r\nimport \"./ShadersInclude/fogFragment\";\r\nimport \"./ShadersInclude/pbrBlockImageProcessing\";\r\nimport \"./ShadersInclude/pbrDebug\";\r\nvar name = 'pbrPixelShader';\r\nvar shader = \"#if defined(BUMP) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\n#ifdef LODBASEDMICROSFURACE\\n#extension GL_EXT_shader_texture_lod : enable\\n#endif\\n#define CUSTOM_FRAGMENT_BEGIN\\n#ifdef LOGARITHMICDEPTH\\n#extension GL_EXT_frag_depth : enable\\n#endif\\n#include[SCENE_MRT_COUNT]\\nprecision highp float;\\n\\n#ifndef FROMLINEARSPACE\\n#define FROMLINEARSPACE\\n#endif\\n\\n#include<__decl__pbrFragment>\\n#include\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#include\\n#include\\n#include\\n#include\\n#include\\n\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#ifdef REFLECTION\\n#include\\n#endif\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\n#include\\n\\n#include\\n#include\\n#include\\n\\nalbedoOpacityOutParams albedoOpacityOut;\\n#ifdef ALBEDO\\nvec4 albedoTexture=texture2D(albedoSampler,vAlbedoUV+uvOffset);\\n#endif\\n#ifdef OPACITY\\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\\n#endif\\nalbedoOpacityBlock(\\nvAlbedoColor,\\n#ifdef ALBEDO\\nalbedoTexture,\\nvAlbedoInfos,\\n#endif\\n#ifdef OPACITY\\nopacityMap,\\nvOpacityInfos,\\n#endif\\n#ifdef DETAIL\\ndetailColor,\\nvDetailInfos,\\n#endif\\nalbedoOpacityOut\\n);\\nvec3 surfaceAlbedo=albedoOpacityOut.surfaceAlbedo;\\nfloat alpha=albedoOpacityOut.alpha;\\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\\n#include\\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\\n\\nambientOcclusionOutParams aoOut;\\n#ifdef AMBIENT\\nvec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb;\\n#endif\\nambientOcclusionBlock(\\n#ifdef AMBIENT\\nambientOcclusionColorMap,\\nvAmbientInfos,\\n#endif\\naoOut\\n);\\n#include\\n#ifdef UNLIT\\nvec3 diffuseBase=vec3(1.,1.,1.);\\n#else\\n\\nvec3 baseColor=surfaceAlbedo;\\nreflectivityOutParams reflectivityOut;\\n#if defined(REFLECTIVITY)\\nvec4 surfaceMetallicOrReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\\nvec4 baseReflectivity=surfaceMetallicOrReflectivityColorMap;\\n#ifndef METALLICWORKFLOW\\nsurfaceMetallicOrReflectivityColorMap=toLinearSpace(surfaceMetallicOrReflectivityColorMap);\\nsurfaceMetallicOrReflectivityColorMap.rgb*=vReflectivityInfos.y;\\n#endif\\n#endif\\n#if defined(MICROSURFACEMAP)\\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\\n#endif\\n#ifdef METALLICWORKFLOW\\nvec4 metallicReflectanceFactors=vMetallicReflectanceFactors;\\n#ifdef METALLIC_REFLECTANCE\\nvec4 metallicReflectanceFactorsMap=texture2D(metallicReflectanceSampler,vMetallicReflectanceUV+uvOffset);\\nmetallicReflectanceFactorsMap=toLinearSpace(metallicReflectanceFactorsMap);\\nmetallicReflectanceFactors*=metallicReflectanceFactorsMap;\\n#endif\\n#endif\\nreflectivityBlock(\\nvReflectivityColor,\\n#ifdef METALLICWORKFLOW\\nsurfaceAlbedo,\\nmetallicReflectanceFactors,\\n#endif\\n#ifdef REFLECTIVITY\\nvReflectivityInfos,\\nsurfaceMetallicOrReflectivityColorMap,\\n#endif\\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\\naoOut.ambientOcclusionColor,\\n#endif\\n#ifdef MICROSURFACEMAP\\nmicroSurfaceTexel,\\n#endif\\n#ifdef DETAIL\\ndetailColor,\\nvDetailInfos,\\n#endif\\nreflectivityOut\\n);\\nfloat microSurface=reflectivityOut.microSurface;\\nfloat roughness=reflectivityOut.roughness;\\n#ifdef METALLICWORKFLOW\\nsurfaceAlbedo=reflectivityOut.surfaceAlbedo;\\n#endif\\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\\naoOut.ambientOcclusionColor=reflectivityOut.ambientOcclusionColor;\\n#endif\\n\\n#ifdef ALPHAFRESNEL\\n#if defined(ALPHATEST) || defined(ALPHABLEND)\\nalphaFresnelOutParams alphaFresnelOut;\\nalphaFresnelBlock(\\nnormalW,\\nviewDirectionW,\\nalpha,\\nmicroSurface,\\nalphaFresnelOut\\n);\\nalpha=alphaFresnelOut.alpha;\\n#endif\\n#endif\\n\\n#include\\n\\n#ifdef ANISOTROPIC\\nanisotropicOutParams anisotropicOut;\\n#ifdef ANISOTROPIC_TEXTURE\\nvec3 anisotropyMapData=texture2D(anisotropySampler,vAnisotropyUV+uvOffset).rgb*vAnisotropyInfos.y;\\n#endif\\nanisotropicBlock(\\nvAnisotropy,\\n#ifdef ANISOTROPIC_TEXTURE\\nanisotropyMapData,\\n#endif\\nTBN,\\nnormalW,\\nviewDirectionW,\\nanisotropicOut\\n);\\n#endif\\n\\n#ifdef REFLECTION\\nreflectionOutParams reflectionOut;\\nreflectionBlock(\\nvPositionW,\\nnormalW,\\nalphaG,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\n#ifdef ANISOTROPIC\\nanisotropicOut,\\n#endif\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nNdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nroughness,\\n#endif\\nreflectionSampler,\\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\\nvEnvironmentIrradiance,\\n#endif\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nreflectionMatrix,\\n#endif\\n#endif\\n#ifdef USEIRRADIANCEMAP\\nirradianceSampler,\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\nreflectionOut\\n);\\n#endif\\n\\n#include\\n\\n#ifdef SHEEN\\nsheenOutParams sheenOut;\\n#ifdef SHEEN_TEXTURE\\nvec4 sheenMapData=toLinearSpace(texture2D(sheenSampler,vSheenUV+uvOffset))*vSheenInfos.y;\\n#endif\\n#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nvec4 sheenMapRoughnessData=texture2D(sheenRoughnessSampler,vSheenRoughnessUV+uvOffset)*vSheenInfos.w;\\n#endif\\nsheenBlock(\\nvSheenColor,\\n#ifdef SHEEN_ROUGHNESS\\nvSheenRoughness,\\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nsheenMapRoughnessData,\\n#endif\\n#endif\\nroughness,\\n#ifdef SHEEN_TEXTURE\\nsheenMapData,\\n#endif\\nreflectance,\\n#ifdef SHEEN_LINKWITHALBEDO\\nbaseColor,\\nsurfaceAlbedo,\\n#endif\\n#ifdef ENVIRONMENTBRDF\\nNdotV,\\nenvironmentBrdf,\\n#endif\\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nAARoughnessFactors,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\nvLightingIntensity,\\nreflectionSampler,\\nreflectionOut.reflectionCoords,\\nNdotVUnclamped,\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\\nseo,\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\\neho,\\n#endif\\n#endif\\nsheenOut\\n);\\n#ifdef SHEEN_LINKWITHALBEDO\\nsurfaceAlbedo=sheenOut.surfaceAlbedo;\\n#endif\\n#endif\\n\\nclearcoatOutParams clearcoatOut;\\n#ifdef CLEARCOAT\\n#ifdef CLEARCOAT_TEXTURE\\nvec2 clearCoatMapData=texture2D(clearCoatSampler,vClearCoatUV+uvOffset).rg*vClearCoatInfos.y;\\n#endif\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nvec4 clearCoatMapRoughnessData=texture2D(clearCoatRoughnessSampler,vClearCoatRoughnessUV+uvOffset)*vClearCoatInfos.w;\\n#endif\\n#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\\nvec4 clearCoatTintMapData=toLinearSpace(texture2D(clearCoatTintSampler,vClearCoatTintUV+uvOffset));\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nvec4 clearCoatBumpMapData=texture2D(clearCoatBumpSampler,vClearCoatBumpUV+uvOffset);\\n#endif\\nclearcoatBlock(\\nvPositionW,\\ngeometricNormalW,\\nviewDirectionW,\\nvClearCoatParams,\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nclearCoatMapRoughnessData,\\n#endif\\nspecularEnvironmentR0,\\n#ifdef CLEARCOAT_TEXTURE\\nclearCoatMapData,\\n#endif\\n#ifdef CLEARCOAT_TINT\\nvClearCoatTintParams,\\nclearCoatColorAtDistance,\\nvClearCoatRefractionParams,\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nclearCoatTintMapData,\\n#endif\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nvClearCoatBumpInfos,\\nclearCoatBumpMapData,\\nvClearCoatBumpUV,\\n#if defined(TANGENT) && defined(NORMAL)\\nvTBN,\\n#else\\nvClearCoatTangentSpaceParams,\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\nnormalMatrix,\\n#endif\\n#endif\\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\\nfaceNormal,\\n#endif\\n#ifdef REFLECTION\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\nvLightingIntensity,\\nreflectionSampler,\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\n#endif\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\n#ifdef RADIANCEOCCLUSION\\nambientMonochrome,\\n#endif\\n#endif\\nclearcoatOut\\n);\\n#else\\nclearcoatOut.specularEnvironmentR0=specularEnvironmentR0;\\n#endif\\n\\n#include\\n\\nsubSurfaceOutParams subSurfaceOut;\\n#ifdef SUBSURFACE\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nvec4 thicknessMap=texture2D(thicknessSampler,vThicknessUV+uvOffset);\\n#endif\\nsubSurfaceBlock(\\nvSubSurfaceIntensity,\\nvThicknessParam,\\nvTintColor,\\nnormalW,\\nspecularEnvironmentReflectance,\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nthicknessMap,\\n#endif\\n#ifdef REFLECTION\\n#ifdef SS_TRANSLUCENCY\\nreflectionMatrix,\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nreflectionOut.irradianceVector,\\n#endif\\n#if defined(REALTIME_FILTERING)\\nreflectionSampler,\\nvReflectionFilteringInfo,\\n#endif\\n#endif\\n#ifdef USEIRRADIANCEMAP\\nirradianceSampler,\\n#endif\\n#endif\\n#endif\\n#ifdef SS_REFRACTION\\nvPositionW,\\nviewDirectionW,\\nview,\\nsurfaceAlbedo,\\nvRefractionInfos,\\nrefractionMatrix,\\nvRefractionMicrosurfaceInfos,\\nvLightingIntensity,\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nalpha,\\n#endif\\n#ifdef SS_LODINREFRACTIONALPHA\\nNdotVUnclamped,\\n#endif\\n#ifdef SS_LINEARSPECULARREFRACTION\\nroughness,\\n#else\\nalphaG,\\n#endif\\nrefractionSampler,\\n#ifndef LODBASEDMICROSFURACE\\nrefractionSamplerLow,\\nrefractionSamplerHigh,\\n#endif\\n#ifdef ANISOTROPIC\\nanisotropicOut,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvRefractionFilteringInfo,\\n#endif\\n#endif\\n#ifdef SS_TRANSLUCENCY\\nvDiffusionDistance,\\n#endif\\nsubSurfaceOut\\n);\\n#ifdef SS_REFRACTION\\nsurfaceAlbedo=subSurfaceOut.surfaceAlbedo;\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nalpha=subSurfaceOut.alpha;\\n#endif\\n#endif\\n#else\\nsubSurfaceOut.specularEnvironmentReflectance=specularEnvironmentReflectance;\\n#endif\\n\\n#include\\n#include[0..maxSimultaneousLights]\\n\\n#include\\n#endif\\n#include\\n#include\\n#include\\n#include(color,finalColor)\\n#include\\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\\n#ifdef PREPASS\\n#ifdef PREPASS_POSITION\\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,1.0);\\n#endif\\n#ifdef PREPASS_VELOCITY\\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\\nvec2 velocity=abs(a-b);\\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\\ngl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\\n#endif\\n#ifdef PREPASS_IRRADIANCE\\nvec3 irradiance=finalDiffuse;\\n#ifndef UNLIT\\n#ifdef REFLECTION\\nirradiance+=finalIrradiance;\\n#endif\\n#endif\\nvec3 sqAlbedo=sqrt(surfaceAlbedo);\\n#ifdef SS_SCATTERING\\ngl_FragData[0]=vec4(finalColor.rgb-irradiance,finalColor.a);\\nirradiance/=sqAlbedo;\\n#else\\ngl_FragData[0]=finalColor;\\nfloat scatteringDiffusionProfile=255.;\\n#endif\\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(irradiance,scatteringDiffusionProfile/255.);\\n#else\\ngl_FragData[0]=vec4(finalColor.rgb,finalColor.a);\\n#endif\\n#ifdef PREPASS_DEPTHNORMAL\\ngl_FragData[PREPASS_DEPTHNORMAL_INDEX]=vec4(vViewPos.z,(view*vec4(normalW,0.0)).rgb);\\n#endif\\n#ifdef PREPASS_ALBEDO\\ngl_FragData[PREPASS_ALBEDO_INDEX]=vec4(sqAlbedo,1.0);\\n#endif\\n#ifdef PREPASS_REFLECTIVITY\\n#if defined(REFLECTIVITY)\\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(baseReflectivity.rgb,1.0);\\n#else\\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(0.0,0.0,0.0,1.0);\\n#endif\\n#endif\\n#endif\\n#if !defined(PREPASS) || defined(WEBGL2)\\ngl_FragColor=finalColor;\\n#endif\\n#include\\n}\\n\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrPixelShader = { name: name, shader: shader };\r\n//# sourceMappingURL=pbr.fragment.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrVertexDeclaration';\r\nvar shader = \"uniform mat4 view;\\nuniform mat4 viewProjection;\\n#ifdef ALBEDO\\nuniform mat4 albedoMatrix;\\nuniform vec2 vAlbedoInfos;\\n#endif\\n#ifdef AMBIENT\\nuniform mat4 ambientMatrix;\\nuniform vec4 vAmbientInfos;\\n#endif\\n#ifdef OPACITY\\nuniform mat4 opacityMatrix;\\nuniform vec2 vOpacityInfos;\\n#endif\\n#ifdef EMISSIVE\\nuniform vec2 vEmissiveInfos;\\nuniform mat4 emissiveMatrix;\\n#endif\\n#ifdef LIGHTMAP\\nuniform vec2 vLightmapInfos;\\nuniform mat4 lightmapMatrix;\\n#endif\\n#ifdef REFLECTIVITY\\nuniform vec3 vReflectivityInfos;\\nuniform mat4 reflectivityMatrix;\\n#endif\\n#ifdef METALLIC_REFLECTANCE\\nuniform vec2 vMetallicReflectanceInfos;\\nuniform mat4 metallicReflectanceMatrix;\\n#endif\\n#ifdef MICROSURFACEMAP\\nuniform vec2 vMicroSurfaceSamplerInfos;\\nuniform mat4 microSurfaceSamplerMatrix;\\n#endif\\n#ifdef BUMP\\nuniform vec3 vBumpInfos;\\nuniform mat4 bumpMatrix;\\n#endif\\n#ifdef POINTSIZE\\nuniform float pointSize;\\n#endif\\n\\n#ifdef REFLECTION\\nuniform vec2 vReflectionInfos;\\nuniform mat4 reflectionMatrix;\\n#endif\\n\\n#ifdef CLEARCOAT\\n#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)\\nuniform vec4 vClearCoatInfos;\\n#endif\\n#ifdef CLEARCOAT_TEXTURE\\nuniform mat4 clearCoatMatrix;\\n#endif\\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS\\nuniform mat4 clearCoatRoughnessMatrix;\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nuniform vec2 vClearCoatBumpInfos;\\nuniform mat4 clearCoatBumpMatrix;\\n#endif\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nuniform vec2 vClearCoatTintInfos;\\nuniform mat4 clearCoatTintMatrix;\\n#endif\\n#endif\\n\\n#ifdef ANISOTROPIC\\n#ifdef ANISOTROPIC_TEXTURE\\nuniform vec2 vAnisotropyInfos;\\nuniform mat4 anisotropyMatrix;\\n#endif\\n#endif\\n\\n#ifdef SHEEN\\n#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)\\nuniform vec4 vSheenInfos;\\n#endif\\n#ifdef SHEEN_TEXTURE\\nuniform mat4 sheenMatrix;\\n#endif\\n#ifdef SHEEN_TEXTURE_ROUGHNESS\\nuniform mat4 sheenRoughnessMatrix;\\n#endif\\n#endif\\n\\n#ifdef SUBSURFACE\\n#ifdef SS_REFRACTION\\nuniform vec4 vRefractionInfos;\\nuniform mat4 refractionMatrix;\\n#endif\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nuniform vec2 vThicknessInfos;\\nuniform mat4 thicknessMatrix;\\n#endif\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrVertexDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrVertexDeclaration.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/pbrVertexDeclaration\";\r\nimport \"./ShadersInclude/pbrUboDeclaration\";\r\nimport \"./ShadersInclude/helperFunctions\";\r\nimport \"./ShadersInclude/bonesDeclaration\";\r\nimport \"./ShadersInclude/instancesDeclaration\";\r\nimport \"./ShadersInclude/prePassVertexDeclaration\";\r\nimport \"./ShadersInclude/harmonicsFunctions\";\r\nimport \"./ShadersInclude/bumpVertexDeclaration\";\r\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\r\nimport \"./ShadersInclude/fogVertexDeclaration\";\r\nimport \"./ShadersInclude/lightFragmentDeclaration\";\r\nimport \"./ShadersInclude/lightUboDeclaration\";\r\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration\";\r\nimport \"./ShadersInclude/morphTargetsVertexDeclaration\";\r\nimport \"./ShadersInclude/logDepthDeclaration\";\r\nimport \"./ShadersInclude/morphTargetsVertex\";\r\nimport \"./ShadersInclude/instancesVertex\";\r\nimport \"./ShadersInclude/bonesVertex\";\r\nimport \"./ShadersInclude/prePassVertex\";\r\nimport \"./ShadersInclude/bumpVertex\";\r\nimport \"./ShadersInclude/clipPlaneVertex\";\r\nimport \"./ShadersInclude/fogVertex\";\r\nimport \"./ShadersInclude/shadowsVertex\";\r\nimport \"./ShadersInclude/logDepthVertex\";\r\nvar name = 'pbrVertexShader';\r\nvar shader = \"precision highp float;\\n#include<__decl__pbrVertex>\\n#define CUSTOM_VERTEX_BEGIN\\n\\nattribute vec3 position;\\n#ifdef NORMAL\\nattribute vec3 normal;\\n#endif\\n#ifdef TANGENT\\nattribute vec4 tangent;\\n#endif\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\n#ifdef MAINUV1\\nvarying vec2 vMainUV1;\\n#endif\\n#ifdef MAINUV2\\nvarying vec2 vMainUV2;\\n#endif\\n#ifdef VERTEXCOLOR\\nattribute vec4 color;\\n#endif\\n#include\\n#include\\n\\n#include\\n#include\\n#if defined(ALBEDO) && ALBEDODIRECTUV == 0\\nvarying vec2 vAlbedoUV;\\n#endif\\n#if defined(DETAIL) && DETAILDIRECTUV == 0\\nvarying vec2 vDetailUV;\\n#endif\\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\\nvarying vec2 vAmbientUV;\\n#endif\\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\\nvarying vec2 vOpacityUV;\\n#endif\\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\\nvarying vec2 vEmissiveUV;\\n#endif\\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\\nvarying vec2 vLightmapUV;\\n#endif\\n#if defined(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\\nvarying vec2 vReflectivityUV;\\n#endif\\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\\nvarying vec2 vMicroSurfaceSamplerUV;\\n#endif\\n#if defined(METALLIC_REFLECTANCE) && METALLIC_REFLECTANCEDIRECTUV == 0\\nvarying vec2 vMetallicReflectanceUV;\\n#endif\\n#if defined(BUMP) && BUMPDIRECTUV == 0\\nvarying vec2 vBumpUV;\\n#endif\\n#ifdef CLEARCOAT\\n#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0\\nvarying vec2 vClearCoatUV;\\n#endif\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV == 0\\nvarying vec2 vClearCoatRoughnessUV;\\n#endif\\n#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0\\nvarying vec2 vClearCoatBumpUV;\\n#endif\\n#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0\\nvarying vec2 vClearCoatTintUV;\\n#endif\\n#endif\\n#ifdef SHEEN\\n#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0\\nvarying vec2 vSheenUV;\\n#endif\\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && SHEEN_TEXTURE_ROUGHNESSDIRECTUV == 0\\nvarying vec2 vSheenRoughnessUV;\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\n#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0\\nvarying vec2 vAnisotropyUV;\\n#endif\\n#endif\\n#ifdef SUBSURFACE\\n#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0\\nvarying vec2 vThicknessUV;\\n#endif\\n#endif\\n\\nvarying vec3 vPositionW;\\n#if DEBUGMODE>0\\nvarying vec4 vClipSpacePosition;\\n#endif\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\\nvarying vec3 vEnvironmentIrradiance;\\n#include\\n#endif\\n#endif\\n#ifdef VERTEXCOLOR\\nvarying vec4 vColor;\\n#endif\\n#include\\n#include\\n#include\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\n#include\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\nvec3 positionUpdated=position;\\n#ifdef NORMAL\\nvec3 normalUpdated=normal;\\n#endif\\n#ifdef TANGENT\\nvec4 tangentUpdated=tangent;\\n#endif\\n#ifdef UV1\\nvec2 uvUpdated=uv;\\n#endif\\n#include[0..maxSimultaneousMorphTargets]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvPositionUVW=positionUpdated;\\n#endif\\n#define CUSTOM_VERTEX_UPDATE_POSITION\\n#define CUSTOM_VERTEX_UPDATE_NORMAL\\n#include\\n#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\\n\\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\\n#endif\\n#include\\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\\nvPositionW=vec3(worldPos);\\n#include\\n#ifdef NORMAL\\nmat3 normalWorld=mat3(finalWorld);\\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));\\nvNormalW=normalize(normalWorld*vNormalW);\\n#else\\n#ifdef NONUNIFORMSCALING\\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\\n#endif\\nvNormalW=normalize(normalWorld*normalUpdated);\\n#endif\\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\\nvec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nreflectionVector.z*=-1.0;\\n#endif\\nvEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\\n#endif\\n#endif\\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR == 0u) {\\ngl_Position=viewProjection*worldPos;\\n} else {\\ngl_Position=viewProjectionR*worldPos;\\n}\\n#else\\ngl_Position=viewProjection*worldPos;\\n#endif\\n#if DEBUGMODE>0\\nvClipSpacePosition=gl_Position;\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\\n#endif\\n\\n#ifndef UV1\\nvec2 uvUpdated=vec2(0.,0.);\\n#endif\\n#ifndef UV2\\nvec2 uv2=vec2(0.,0.);\\n#endif\\n#ifdef MAINUV1\\nvMainUV1=uvUpdated;\\n#endif\\n#ifdef MAINUV2\\nvMainUV2=uv2;\\n#endif\\n#if defined(ALBEDO) && ALBEDODIRECTUV == 0\\nif (vAlbedoInfos.x == 0.)\\n{\\nvAlbedoUV=vec2(albedoMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvAlbedoUV=vec2(albedoMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(DETAIL) && DETAILDIRECTUV == 0\\nif (vDetailInfos.x == 0.)\\n{\\nvDetailUV=vec2(detailMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvDetailUV=vec2(detailMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\\nif (vAmbientInfos.x == 0.)\\n{\\nvAmbientUV=vec2(ambientMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\\nif (vOpacityInfos.x == 0.)\\n{\\nvOpacityUV=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\\nif (vEmissiveInfos.x == 0.)\\n{\\nvEmissiveUV=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\\nif (vLightmapInfos.x == 0.)\\n{\\nvLightmapUV=vec2(lightmapMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\\nif (vReflectivityInfos.x == 0.)\\n{\\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\\nif (vMicroSurfaceSamplerInfos.x == 0.)\\n{\\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(METALLIC_REFLECTANCE) && METALLIC_REFLECTANCEDIRECTUV == 0\\nif (vMetallicReflectanceInfos.x == 0.)\\n{\\nvMetallicReflectanceUV=vec2(metallicReflectanceMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvMetallicReflectanceUV=vec2(metallicReflectanceMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(BUMP) && BUMPDIRECTUV == 0\\nif (vBumpInfos.x == 0.)\\n{\\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#ifdef CLEARCOAT\\n#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0\\nif (vClearCoatInfos.x == 0.)\\n{\\nvClearCoatUV=vec2(clearCoatMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvClearCoatUV=vec2(clearCoatMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV == 0\\nif (vClearCoatInfos.z == 0.)\\n{\\nvClearCoatRoughnessUV=vec2(clearCoatRoughnessMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvClearCoatRoughnessUV=vec2(clearCoatRoughnessMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0\\nif (vClearCoatBumpInfos.x == 0.)\\n{\\nvClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0\\nif (vClearCoatTintInfos.x == 0.)\\n{\\nvClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n#ifdef SHEEN\\n#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0\\nif (vSheenInfos.x == 0.)\\n{\\nvSheenUV=vec2(sheenMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvSheenUV=vec2(sheenMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && SHEEN_TEXTURE_ROUGHNESSDIRECTUV == 0\\nif (vSheenInfos.z == 0.)\\n{\\nvSheenRoughnessUV=vec2(sheenRoughnessMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvSheenRoughnessUV=vec2(sheenRoughnessMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\n#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0\\nif (vAnisotropyInfos.x == 0.)\\n{\\nvAnisotropyUV=vec2(anisotropyMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvAnisotropyUV=vec2(anisotropyMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n#ifdef SUBSURFACE\\n#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0\\nif (vThicknessInfos.x == 0.)\\n{\\nvThicknessUV=vec2(thicknessMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvThicknessUV=vec2(thicknessMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n\\n#include\\n\\n#include\\n\\n#include\\n\\n#include[0..maxSimultaneousLights]\\n\\n#ifdef VERTEXCOLOR\\nvColor=color;\\n#endif\\n\\n#ifdef POINTSIZE\\ngl_PointSize=pointSize;\\n#endif\\n\\n#include\\n#define CUSTOM_VERTEX_MAIN_END\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrVertexShader = { name: name, shader: shader };\r\n//# sourceMappingURL=pbr.vertex.js.map","import { __assign, __decorate, __extends } from \"tslib\";\r\nimport { serialize, serializeAsImageProcessingConfiguration, expandToProperty } from \"../../Misc/decorators\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { SmartArray } from \"../../Misc/smartArray\";\r\nimport { BRDFTextureTools } from \"../../Misc/brdfTextureTools\";\r\nimport { Scene } from \"../../scene\";\r\nimport { Vector4 } from \"../../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../../Meshes/buffer\";\r\nimport { PBRClearCoatConfiguration } from \"./pbrClearCoatConfiguration\";\r\nimport { PBRAnisotropicConfiguration } from \"./pbrAnisotropicConfiguration\";\r\nimport { PBRBRDFConfiguration } from \"./pbrBRDFConfiguration\";\r\nimport { PBRSheenConfiguration } from \"./pbrSheenConfiguration\";\r\nimport { PBRSubSurfaceConfiguration } from \"./pbrSubSurfaceConfiguration\";\r\nimport { PrePassConfiguration } from \"../prePassConfiguration\";\r\nimport { Color3, TmpColors } from '../../Maths/math.color';\r\nimport { Scalar } from \"../../Maths/math.scalar\";\r\nimport { ImageProcessingConfiguration } from \"../../Materials/imageProcessingConfiguration\";\r\nimport { Material } from \"../../Materials/material\";\r\nimport { MaterialDefines } from \"../../Materials/materialDefines\";\r\nimport { PushMaterial } from \"../../Materials/pushMaterial\";\r\nimport { MaterialHelper } from \"../../Materials/materialHelper\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { MaterialFlags } from \"../materialFlags\";\r\nimport \"../../Materials/Textures/baseTexture.polynomial\";\r\nimport \"../../Shaders/pbr.fragment\";\r\nimport \"../../Shaders/pbr.vertex\";\r\nimport { EffectFallbacks } from '../effectFallbacks';\r\nimport { DetailMapConfiguration } from '../material.detailMapConfiguration';\r\nvar onCreatedEffectParameters = { effect: null, subMesh: null };\r\n/**\r\n * Manages the defines for the PBR Material.\r\n * @hidden\r\n */\r\nvar PBRMaterialDefines = /** @class */ (function (_super) {\r\n __extends(PBRMaterialDefines, _super);\r\n /**\r\n * Initializes the PBR Material defines.\r\n */\r\n function PBRMaterialDefines() {\r\n var _this = _super.call(this) || this;\r\n _this.PBR = true;\r\n _this.NUM_SAMPLES = \"0\";\r\n _this.REALTIME_FILTERING = false;\r\n _this.MAINUV1 = false;\r\n _this.MAINUV2 = false;\r\n _this.UV1 = false;\r\n _this.UV2 = false;\r\n _this.ALBEDO = false;\r\n _this.GAMMAALBEDO = false;\r\n _this.ALBEDODIRECTUV = 0;\r\n _this.VERTEXCOLOR = false;\r\n _this.DETAIL = false;\r\n _this.DETAILDIRECTUV = 0;\r\n _this.DETAIL_NORMALBLENDMETHOD = 0;\r\n _this.AMBIENT = false;\r\n _this.AMBIENTDIRECTUV = 0;\r\n _this.AMBIENTINGRAYSCALE = false;\r\n _this.OPACITY = false;\r\n _this.VERTEXALPHA = false;\r\n _this.OPACITYDIRECTUV = 0;\r\n _this.OPACITYRGB = false;\r\n _this.ALPHATEST = false;\r\n _this.DEPTHPREPASS = false;\r\n _this.ALPHABLEND = false;\r\n _this.ALPHAFROMALBEDO = false;\r\n _this.ALPHATESTVALUE = \"0.5\";\r\n _this.SPECULAROVERALPHA = false;\r\n _this.RADIANCEOVERALPHA = false;\r\n _this.ALPHAFRESNEL = false;\r\n _this.LINEARALPHAFRESNEL = false;\r\n _this.PREMULTIPLYALPHA = false;\r\n _this.EMISSIVE = false;\r\n _this.EMISSIVEDIRECTUV = 0;\r\n _this.REFLECTIVITY = false;\r\n _this.REFLECTIVITYDIRECTUV = 0;\r\n _this.SPECULARTERM = false;\r\n _this.MICROSURFACEFROMREFLECTIVITYMAP = false;\r\n _this.MICROSURFACEAUTOMATIC = false;\r\n _this.LODBASEDMICROSFURACE = false;\r\n _this.MICROSURFACEMAP = false;\r\n _this.MICROSURFACEMAPDIRECTUV = 0;\r\n _this.METALLICWORKFLOW = false;\r\n _this.ROUGHNESSSTOREINMETALMAPALPHA = false;\r\n _this.ROUGHNESSSTOREINMETALMAPGREEN = false;\r\n _this.METALLNESSSTOREINMETALMAPBLUE = false;\r\n _this.AOSTOREINMETALMAPRED = false;\r\n _this.METALLIC_REFLECTANCE = false;\r\n _this.METALLIC_REFLECTANCEDIRECTUV = 0;\r\n _this.ENVIRONMENTBRDF = false;\r\n _this.ENVIRONMENTBRDF_RGBD = false;\r\n _this.NORMAL = false;\r\n _this.TANGENT = false;\r\n _this.BUMP = false;\r\n _this.BUMPDIRECTUV = 0;\r\n _this.OBJECTSPACE_NORMALMAP = false;\r\n _this.PARALLAX = false;\r\n _this.PARALLAXOCCLUSION = false;\r\n _this.NORMALXYSCALE = true;\r\n _this.LIGHTMAP = false;\r\n _this.LIGHTMAPDIRECTUV = 0;\r\n _this.USELIGHTMAPASSHADOWMAP = false;\r\n _this.GAMMALIGHTMAP = false;\r\n _this.RGBDLIGHTMAP = false;\r\n _this.REFLECTION = false;\r\n _this.REFLECTIONMAP_3D = false;\r\n _this.REFLECTIONMAP_SPHERICAL = false;\r\n _this.REFLECTIONMAP_PLANAR = false;\r\n _this.REFLECTIONMAP_CUBIC = false;\r\n _this.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\r\n _this.REFLECTIONMAP_PROJECTION = false;\r\n _this.REFLECTIONMAP_SKYBOX = false;\r\n _this.REFLECTIONMAP_EXPLICIT = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n _this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n _this.INVERTCUBICMAP = false;\r\n _this.USESPHERICALFROMREFLECTIONMAP = false;\r\n _this.USEIRRADIANCEMAP = false;\r\n _this.SPHERICAL_HARMONICS = false;\r\n _this.USESPHERICALINVERTEX = false;\r\n _this.REFLECTIONMAP_OPPOSITEZ = false;\r\n _this.LODINREFLECTIONALPHA = false;\r\n _this.GAMMAREFLECTION = false;\r\n _this.RGBDREFLECTION = false;\r\n _this.LINEARSPECULARREFLECTION = false;\r\n _this.RADIANCEOCCLUSION = false;\r\n _this.HORIZONOCCLUSION = false;\r\n _this.INSTANCES = false;\r\n _this.THIN_INSTANCES = false;\r\n _this.PREPASS = false;\r\n _this.PREPASS_IRRADIANCE = false;\r\n _this.PREPASS_IRRADIANCE_INDEX = -1;\r\n _this.PREPASS_ALBEDO = false;\r\n _this.PREPASS_ALBEDO_INDEX = -1;\r\n _this.PREPASS_DEPTHNORMAL = false;\r\n _this.PREPASS_DEPTHNORMAL_INDEX = -1;\r\n _this.PREPASS_POSITION = false;\r\n _this.PREPASS_POSITION_INDEX = -1;\r\n _this.PREPASS_VELOCITY = false;\r\n _this.PREPASS_VELOCITY_INDEX = -1;\r\n _this.PREPASS_REFLECTIVITY = false;\r\n _this.PREPASS_REFLECTIVITY_INDEX = -1;\r\n _this.SCENE_MRT_COUNT = 0;\r\n _this.NUM_BONE_INFLUENCERS = 0;\r\n _this.BonesPerMesh = 0;\r\n _this.BONETEXTURE = false;\r\n _this.BONES_VELOCITY_ENABLED = false;\r\n _this.NONUNIFORMSCALING = false;\r\n _this.MORPHTARGETS = false;\r\n _this.MORPHTARGETS_NORMAL = false;\r\n _this.MORPHTARGETS_TANGENT = false;\r\n _this.MORPHTARGETS_UV = false;\r\n _this.NUM_MORPH_INFLUENCERS = 0;\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n _this.EXPOSURE = false;\r\n _this.MULTIVIEW = false;\r\n _this.USEPHYSICALLIGHTFALLOFF = false;\r\n _this.USEGLTFLIGHTFALLOFF = false;\r\n _this.TWOSIDEDLIGHTING = false;\r\n _this.SHADOWFLOAT = false;\r\n _this.CLIPPLANE = false;\r\n _this.CLIPPLANE2 = false;\r\n _this.CLIPPLANE3 = false;\r\n _this.CLIPPLANE4 = false;\r\n _this.CLIPPLANE5 = false;\r\n _this.CLIPPLANE6 = false;\r\n _this.POINTSIZE = false;\r\n _this.FOG = false;\r\n _this.LOGARITHMICDEPTH = false;\r\n _this.FORCENORMALFORWARD = false;\r\n _this.SPECULARAA = false;\r\n _this.CLEARCOAT = false;\r\n _this.CLEARCOAT_DEFAULTIOR = false;\r\n _this.CLEARCOAT_TEXTURE = false;\r\n _this.CLEARCOAT_TEXTURE_ROUGHNESS = false;\r\n _this.CLEARCOAT_TEXTUREDIRECTUV = 0;\r\n _this.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV = 0;\r\n _this.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\r\n _this.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL = false;\r\n _this.CLEARCOAT_BUMP = false;\r\n _this.CLEARCOAT_BUMPDIRECTUV = 0;\r\n _this.CLEARCOAT_REMAP_F0 = true;\r\n _this.CLEARCOAT_TINT = false;\r\n _this.CLEARCOAT_TINT_TEXTURE = false;\r\n _this.CLEARCOAT_TINT_TEXTUREDIRECTUV = 0;\r\n _this.ANISOTROPIC = false;\r\n _this.ANISOTROPIC_TEXTURE = false;\r\n _this.ANISOTROPIC_TEXTUREDIRECTUV = 0;\r\n _this.BRDF_V_HEIGHT_CORRELATED = false;\r\n _this.MS_BRDF_ENERGY_CONSERVATION = false;\r\n _this.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION = false;\r\n _this.SHEEN = false;\r\n _this.SHEEN_TEXTURE = false;\r\n _this.SHEEN_TEXTURE_ROUGHNESS = false;\r\n _this.SHEEN_TEXTUREDIRECTUV = 0;\r\n _this.SHEEN_TEXTURE_ROUGHNESSDIRECTUV = 0;\r\n _this.SHEEN_LINKWITHALBEDO = false;\r\n _this.SHEEN_ROUGHNESS = false;\r\n _this.SHEEN_ALBEDOSCALING = false;\r\n _this.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\r\n _this.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL = false;\r\n _this.SUBSURFACE = false;\r\n _this.SS_REFRACTION = false;\r\n _this.SS_TRANSLUCENCY = false;\r\n _this.SS_SCATTERING = false;\r\n _this.SS_THICKNESSANDMASK_TEXTURE = false;\r\n _this.SS_THICKNESSANDMASK_TEXTUREDIRECTUV = 0;\r\n _this.SS_REFRACTIONMAP_3D = false;\r\n _this.SS_REFRACTIONMAP_OPPOSITEZ = false;\r\n _this.SS_LODINREFRACTIONALPHA = false;\r\n _this.SS_GAMMAREFRACTION = false;\r\n _this.SS_RGBDREFRACTION = false;\r\n _this.SS_LINEARSPECULARREFRACTION = false;\r\n _this.SS_LINKREFRACTIONTOTRANSPARENCY = false;\r\n _this.SS_ALBEDOFORREFRACTIONTINT = false;\r\n _this.SS_MASK_FROM_THICKNESS_TEXTURE = false;\r\n _this.SS_MASK_FROM_THICKNESS_TEXTURE_GLTF = false;\r\n _this.UNLIT = false;\r\n _this.DEBUGMODE = 0;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n /**\r\n * Resets the PBR Material defines.\r\n */\r\n PBRMaterialDefines.prototype.reset = function () {\r\n _super.prototype.reset.call(this);\r\n this.ALPHATESTVALUE = \"0.5\";\r\n this.PBR = true;\r\n };\r\n return PBRMaterialDefines;\r\n}(MaterialDefines));\r\nexport { PBRMaterialDefines };\r\n/**\r\n * The Physically based material base class of BJS.\r\n *\r\n * This offers the main features of a standard PBR material.\r\n * For more information, please refer to the documentation :\r\n * https://doc.babylonjs.com/how_to/physically_based_rendering\r\n */\r\nvar PBRBaseMaterial = /** @class */ (function (_super) {\r\n __extends(PBRBaseMaterial, _super);\r\n /**\r\n * Instantiates a new PBRMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n function PBRBaseMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Intensity of the direct lights e.g. the four lights available in your scene.\r\n * This impacts both the direct diffuse and specular highlights.\r\n */\r\n _this._directIntensity = 1.0;\r\n /**\r\n * Intensity of the emissive part of the material.\r\n * This helps controlling the emissive effect without modifying the emissive color.\r\n */\r\n _this._emissiveIntensity = 1.0;\r\n /**\r\n * Intensity of the environment e.g. how much the environment will light the object\r\n * either through harmonics for rough material or through the refelction for shiny ones.\r\n */\r\n _this._environmentIntensity = 1.0;\r\n /**\r\n * This is a special control allowing the reduction of the specular highlights coming from the\r\n * four lights of the scene. Those highlights may not be needed in full environment lighting.\r\n */\r\n _this._specularIntensity = 1.0;\r\n /**\r\n * This stores the direct, emissive, environment, and specular light intensities into a Vector4.\r\n */\r\n _this._lightingInfos = new Vector4(_this._directIntensity, _this._emissiveIntensity, _this._environmentIntensity, _this._specularIntensity);\r\n /**\r\n * Debug Control allowing disabling the bump map on this material.\r\n */\r\n _this._disableBumpMap = false;\r\n /**\r\n * AKA Diffuse Texture in standard nomenclature.\r\n */\r\n _this._albedoTexture = null;\r\n /**\r\n * AKA Occlusion Texture in other nomenclature.\r\n */\r\n _this._ambientTexture = null;\r\n /**\r\n * AKA Occlusion Texture Intensity in other nomenclature.\r\n */\r\n _this._ambientTextureStrength = 1.0;\r\n /**\r\n * Defines how much the AO map is occluding the analytical lights (point spot...).\r\n * 1 means it completely occludes it\r\n * 0 mean it has no impact\r\n */\r\n _this._ambientTextureImpactOnAnalyticalLights = PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n /**\r\n * Stores the alpha values in a texture.\r\n */\r\n _this._opacityTexture = null;\r\n /**\r\n * Stores the reflection values in a texture.\r\n */\r\n _this._reflectionTexture = null;\r\n /**\r\n * Stores the emissive values in a texture.\r\n */\r\n _this._emissiveTexture = null;\r\n /**\r\n * AKA Specular texture in other nomenclature.\r\n */\r\n _this._reflectivityTexture = null;\r\n /**\r\n * Used to switch from specular/glossiness to metallic/roughness workflow.\r\n */\r\n _this._metallicTexture = null;\r\n /**\r\n * Specifies the metallic scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the metalness values of the metallic texture.\r\n */\r\n _this._metallic = null;\r\n /**\r\n * Specifies the roughness scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the roughness values of the metallic texture.\r\n */\r\n _this._roughness = null;\r\n /**\r\n * In metallic workflow, specifies an F0 factor to help configuring the material F0.\r\n * By default the indexOfrefraction is used to compute F0;\r\n *\r\n * This is used as a factor against the default reflectance at normal incidence to tweak it.\r\n *\r\n * F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor;\r\n * F90 = metallicReflectanceColor;\r\n */\r\n _this._metallicF0Factor = 1;\r\n /**\r\n * In metallic workflow, specifies an F90 color to help configuring the material F90.\r\n * By default the F90 is always 1;\r\n *\r\n * Please note that this factor is also used as a factor against the default reflectance at normal incidence.\r\n *\r\n * F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor\r\n * F90 = metallicReflectanceColor;\r\n */\r\n _this._metallicReflectanceColor = Color3.White();\r\n /**\r\n * Defines to store metallicReflectanceColor in RGB and metallicF0Factor in A\r\n * This is multiply against the scalar values defined in the material.\r\n */\r\n _this._metallicReflectanceTexture = null;\r\n /**\r\n * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.\r\n * Gray Scale represents roughness in metallic mode and glossiness in specular mode.\r\n */\r\n _this._microSurfaceTexture = null;\r\n /**\r\n * Stores surface normal data used to displace a mesh in a texture.\r\n */\r\n _this._bumpTexture = null;\r\n /**\r\n * Stores the pre-calculated light information of a mesh in a texture.\r\n */\r\n _this._lightmapTexture = null;\r\n /**\r\n * The color of a material in ambient lighting.\r\n */\r\n _this._ambientColor = new Color3(0, 0, 0);\r\n /**\r\n * AKA Diffuse Color in other nomenclature.\r\n */\r\n _this._albedoColor = new Color3(1, 1, 1);\r\n /**\r\n * AKA Specular Color in other nomenclature.\r\n */\r\n _this._reflectivityColor = new Color3(1, 1, 1);\r\n /**\r\n * The color applied when light is reflected from a material.\r\n */\r\n _this._reflectionColor = new Color3(1, 1, 1);\r\n /**\r\n * The color applied when light is emitted from a material.\r\n */\r\n _this._emissiveColor = new Color3(0, 0, 0);\r\n /**\r\n * AKA Glossiness in other nomenclature.\r\n */\r\n _this._microSurface = 0.9;\r\n /**\r\n * Specifies that the material will use the light map as a show map.\r\n */\r\n _this._useLightmapAsShadowmap = false;\r\n /**\r\n * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal\r\n * makes the reflect vector face the model (under horizon).\r\n */\r\n _this._useHorizonOcclusion = true;\r\n /**\r\n * This parameters will enable/disable radiance occlusion by preventing the radiance to lit\r\n * too much the area relying on ambient texture to define their ambient occlusion.\r\n */\r\n _this._useRadianceOcclusion = true;\r\n /**\r\n * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.\r\n */\r\n _this._useAlphaFromAlbedoTexture = false;\r\n /**\r\n * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.\r\n */\r\n _this._useSpecularOverAlpha = true;\r\n /**\r\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\r\n */\r\n _this._useMicroSurfaceFromReflectivityMapAlpha = false;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its alpha channel.\r\n */\r\n _this._useRoughnessFromMetallicTextureAlpha = true;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its green channel.\r\n */\r\n _this._useRoughnessFromMetallicTextureGreen = false;\r\n /**\r\n * Specifies if the metallic texture contains the metallness information in its blue channel.\r\n */\r\n _this._useMetallnessFromMetallicTextureBlue = false;\r\n /**\r\n * Specifies if the metallic texture contains the ambient occlusion information in its red channel.\r\n */\r\n _this._useAmbientOcclusionFromMetallicTextureRed = false;\r\n /**\r\n * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.\r\n */\r\n _this._useAmbientInGrayScale = false;\r\n /**\r\n * In case the reflectivity map does not contain the microsurface information in its alpha channel,\r\n * The material will try to infer what glossiness each pixel should be.\r\n */\r\n _this._useAutoMicroSurfaceFromReflectivityMap = false;\r\n /**\r\n * Defines the falloff type used in this material.\r\n * It by default is Physical.\r\n */\r\n _this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n /**\r\n * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.\r\n */\r\n _this._useRadianceOverAlpha = true;\r\n /**\r\n * Allows using an object space normal map (instead of tangent space).\r\n */\r\n _this._useObjectSpaceNormalMap = false;\r\n /**\r\n * Allows using the bump map in parallax mode.\r\n */\r\n _this._useParallax = false;\r\n /**\r\n * Allows using the bump map in parallax occlusion mode.\r\n */\r\n _this._useParallaxOcclusion = false;\r\n /**\r\n * Controls the scale bias of the parallax mode.\r\n */\r\n _this._parallaxScaleBias = 0.05;\r\n /**\r\n * If sets to true, disables all the lights affecting the material.\r\n */\r\n _this._disableLighting = false;\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n _this._maxSimultaneousLights = 4;\r\n /**\r\n * If sets to true, x component of normal map value will be inverted (x = 1.0 - x).\r\n */\r\n _this._invertNormalMapX = false;\r\n /**\r\n * If sets to true, y component of normal map value will be inverted (y = 1.0 - y).\r\n */\r\n _this._invertNormalMapY = false;\r\n /**\r\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\r\n */\r\n _this._twoSidedLighting = false;\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n _this._alphaCutOff = 0.4;\r\n /**\r\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\r\n */\r\n _this._forceAlphaTest = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)\r\n */\r\n _this._useAlphaFresnel = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)\r\n */\r\n _this._useLinearAlphaFresnel = false;\r\n /**\r\n * Specifies the environment BRDF texture used to comput the scale and offset roughness values\r\n * from cos thetav and roughness:\r\n * http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf\r\n */\r\n _this._environmentBRDFTexture = null;\r\n /**\r\n * Force the shader to compute irradiance in the fragment shader in order to take bump in account.\r\n */\r\n _this._forceIrradianceInFragment = false;\r\n _this._realTimeFiltering = false;\r\n _this._realTimeFilteringQuality = 8;\r\n /**\r\n * Force normal to face away from face.\r\n */\r\n _this._forceNormalForward = false;\r\n /**\r\n * Enables specular anti aliasing in the PBR shader.\r\n * It will both interacts on the Geometry for analytical and IBL lighting.\r\n * It also prefilter the roughness map based on the bump values.\r\n */\r\n _this._enableSpecularAntiAliasing = false;\r\n /**\r\n * Keep track of the image processing observer to allow dispose and replace.\r\n */\r\n _this._imageProcessingObserver = null;\r\n /**\r\n * Stores the available render targets.\r\n */\r\n _this._renderTargets = new SmartArray(16);\r\n /**\r\n * Sets the global ambient color for the material used in lighting calculations.\r\n */\r\n _this._globalAmbientColor = new Color3(0, 0, 0);\r\n /**\r\n * Enables the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n _this._useLogarithmicDepth = false;\r\n /**\r\n * If set to true, no lighting calculations will be applied.\r\n */\r\n _this._unlit = false;\r\n _this._debugMode = 0;\r\n /**\r\n * @hidden\r\n * This is reserved for the inspector.\r\n * Defines the material debug mode.\r\n * It helps seeing only some components of the material while troubleshooting.\r\n */\r\n _this.debugMode = 0;\r\n /**\r\n * @hidden\r\n * This is reserved for the inspector.\r\n * Specify from where on screen the debug mode should start.\r\n * The value goes from -1 (full screen) to 1 (not visible)\r\n * It helps with side by side comparison against the final render\r\n * This defaults to -1\r\n */\r\n _this.debugLimit = -1;\r\n /**\r\n * @hidden\r\n * This is reserved for the inspector.\r\n * As the default viewing range might not be enough (if the ambient is really small for instance)\r\n * You can use the factor to better multiply the final value.\r\n */\r\n _this.debugFactor = 1;\r\n /**\r\n * Defines the clear coat layer parameters for the material.\r\n */\r\n _this.clearCoat = new PBRClearCoatConfiguration(_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n /**\r\n * Defines the anisotropic parameters for the material.\r\n */\r\n _this.anisotropy = new PBRAnisotropicConfiguration(_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n /**\r\n * Defines the BRDF parameters for the material.\r\n */\r\n _this.brdf = new PBRBRDFConfiguration(_this._markAllSubMeshesAsMiscDirty.bind(_this));\r\n /**\r\n * Defines the Sheen parameters for the material.\r\n */\r\n _this.sheen = new PBRSheenConfiguration(_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n /**\r\n * Defines the detail map parameters for the material.\r\n */\r\n _this.detailMap = new DetailMapConfiguration(_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n _this._rebuildInParallel = false;\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n _this.getRenderTargetTextures = function () {\r\n _this._renderTargets.reset();\r\n if (MaterialFlags.ReflectionTextureEnabled && _this._reflectionTexture && _this._reflectionTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._reflectionTexture);\r\n }\r\n _this.subSurface.fillRenderTargetTextures(_this._renderTargets);\r\n return _this._renderTargets;\r\n };\r\n _this._environmentBRDFTexture = BRDFTextureTools.GetEnvironmentBRDFTexture(scene);\r\n _this.subSurface = new PBRSubSurfaceConfiguration(_this._markAllSubMeshesAsTexturesDirty.bind(_this), _this._markScenePrePassDirty.bind(_this), scene);\r\n _this.prePassConfiguration = new PrePassConfiguration();\r\n return _this;\r\n }\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"realTimeFiltering\", {\r\n /**\r\n * Enables realtime filtering on the texture.\r\n */\r\n get: function () {\r\n return this._realTimeFiltering;\r\n },\r\n set: function (b) {\r\n this._realTimeFiltering = b;\r\n this.markAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"realTimeFilteringQuality\", {\r\n /**\r\n * Quality switch for realtime filtering\r\n */\r\n get: function () {\r\n return this._realTimeFilteringQuality;\r\n },\r\n set: function (n) {\r\n this._realTimeFilteringQuality = n;\r\n this.markAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"canRenderToMRT\", {\r\n /**\r\n * Can this material render to several textures at once\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches a new image processing configuration to the PBR Material.\r\n * @param configuration\r\n */\r\n PBRBaseMaterial.prototype._attachImageProcessingConfiguration = function (configuration) {\r\n var _this = this;\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Detaches observer.\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n // Pick the scene configuration if needed.\r\n if (!configuration) {\r\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n // Attaches observer.\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._markAllSubMeshesAsImageProcessingDirty();\r\n });\r\n }\r\n };\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"hasRenderTargetTextures\", {\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n get: function () {\r\n if (MaterialFlags.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n return this.subSurface.hasRenderTargetTextures();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the name of the material class.\r\n */\r\n PBRBaseMaterial.prototype.getClassName = function () {\r\n return \"PBRBaseMaterial\";\r\n };\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"useLogarithmicDepth\", {\r\n /**\r\n * Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n get: function () {\r\n return this._useLogarithmicDepth;\r\n },\r\n /**\r\n * Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n set: function (value) {\r\n this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"_disableAlphaBlending\", {\r\n /**\r\n * Returns true if alpha blending should be disabled.\r\n */\r\n get: function () {\r\n return (this.subSurface.disableAlphaBlending ||\r\n this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_OPAQUE ||\r\n this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_ALPHATEST);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha blend mode.\r\n */\r\n PBRBaseMaterial.prototype.needAlphaBlending = function () {\r\n if (this._disableAlphaBlending) {\r\n return false;\r\n }\r\n return (this.alpha < 1.0) || (this._opacityTexture != null) || this._shouldUseAlphaFromAlbedoTexture();\r\n };\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha test mode.\r\n */\r\n PBRBaseMaterial.prototype.needAlphaTesting = function () {\r\n if (this._forceAlphaTest) {\r\n return true;\r\n }\r\n if (this.subSurface.disableAlphaBlending) {\r\n return false;\r\n }\r\n return this._hasAlphaChannel() && (this._transparencyMode == null || this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_ALPHATEST);\r\n };\r\n /**\r\n * Specifies whether or not the alpha value of the albedo texture should be used for alpha blending.\r\n */\r\n PBRBaseMaterial.prototype._shouldUseAlphaFromAlbedoTexture = function () {\r\n return this._albedoTexture != null && this._albedoTexture.hasAlpha && this._useAlphaFromAlbedoTexture && this._transparencyMode !== PBRBaseMaterial.PBRMATERIAL_OPAQUE;\r\n };\r\n /**\r\n * Specifies whether or not there is a usable alpha channel for transparency.\r\n */\r\n PBRBaseMaterial.prototype._hasAlphaChannel = function () {\r\n return (this._albedoTexture != null && this._albedoTexture.hasAlpha) || this._opacityTexture != null;\r\n };\r\n /**\r\n * Gets the texture used for the alpha test.\r\n */\r\n PBRBaseMaterial.prototype.getAlphaTestTexture = function () {\r\n return this._albedoTexture;\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used.\r\n * @param mesh - BJS mesh.\r\n * @param subMesh - A submesh of the BJS mesh. Used to check if it is ready.\r\n * @param useInstances - Specifies that instances should be used.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRBaseMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n if (subMesh.effect && this.isFrozen) {\r\n if (subMesh.effect._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new PBRMaterialDefines();\r\n }\r\n var defines = subMesh._materialDefines;\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._albedoTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) {\r\n if (!this._ambientTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n if (!this._opacityTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n var reflectionTexture = this._getReflectionTexture();\r\n if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {\r\n if (!reflectionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n if (reflectionTexture.irradianceTexture && !reflectionTexture.irradianceTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._lightmapTexture && MaterialFlags.LightmapTextureEnabled) {\r\n if (!this._lightmapTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._emissiveTexture && MaterialFlags.EmissiveTextureEnabled) {\r\n if (!this._emissiveTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (MaterialFlags.SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n if (!this._metallicTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n else if (this._reflectivityTexture) {\r\n if (!this._reflectivityTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._metallicReflectanceTexture) {\r\n if (!this._metallicReflectanceTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._microSurfaceTexture) {\r\n if (!this._microSurfaceTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n if (engine.getCaps().standardDerivatives && this._bumpTexture && MaterialFlags.BumpTextureEnabled && !this._disableBumpMap) {\r\n // Bump texture cannot be not blocking.\r\n if (!this._bumpTexture.isReady()) {\r\n return false;\r\n }\r\n }\r\n if (this._environmentBRDFTexture && MaterialFlags.ReflectionTextureEnabled) {\r\n // This is blocking.\r\n if (!this._environmentBRDFTexture.isReady()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n if (!this.subSurface.isReadyForSubMesh(defines, scene) ||\r\n !this.clearCoat.isReadyForSubMesh(defines, scene, engine, this._disableBumpMap) ||\r\n !this.sheen.isReadyForSubMesh(defines, scene) ||\r\n !this.anisotropy.isReadyForSubMesh(defines, scene) ||\r\n !this.detailMap.isReadyForSubMesh(defines, scene)) {\r\n return false;\r\n }\r\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\r\n if (!this._imageProcessingConfiguration.isReady()) {\r\n return false;\r\n }\r\n }\r\n if (!engine.getCaps().standardDerivatives && !mesh.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n mesh.createNormals(true);\r\n Logger.Warn(\"PBRMaterial: Normals have been created for the mesh: \" + mesh.name);\r\n }\r\n var previousEffect = subMesh.effect;\r\n var lightDisposed = defines._areLightsDisposed;\r\n var effect = this._prepareEffect(mesh, defines, this.onCompiled, this.onError, useInstances, null, subMesh.getRenderingMesh().hasThinInstances);\r\n if (effect) {\r\n if (this._onEffectCreatedObservable) {\r\n onCreatedEffectParameters.effect = effect;\r\n onCreatedEffectParameters.subMesh = subMesh;\r\n this._onEffectCreatedObservable.notifyObservers(onCreatedEffectParameters);\r\n }\r\n // Use previous effect while new one is compiling\r\n if (this.allowShaderHotSwapping && previousEffect && !effect.isReady()) {\r\n effect = previousEffect;\r\n this._rebuildInParallel = true;\r\n defines.markAsUnprocessed();\r\n if (lightDisposed) {\r\n // re register in case it takes more than one frame.\r\n defines._areLightsDisposed = true;\r\n return false;\r\n }\r\n }\r\n else {\r\n this._rebuildInParallel = false;\r\n scene.resetCachedMaterial();\r\n subMesh.setEffect(effect, defines);\r\n this.buildUniformLayout();\r\n }\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n defines._renderId = scene.getRenderId();\r\n subMesh.effect._wasPreviouslyReady = true;\r\n return true;\r\n };\r\n /**\r\n * Specifies if the material uses metallic roughness workflow.\r\n * @returns boolean specifiying if the material uses metallic roughness workflow.\r\n */\r\n PBRBaseMaterial.prototype.isMetallicWorkflow = function () {\r\n if (this._metallic != null || this._roughness != null || this._metallicTexture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n PBRBaseMaterial.prototype._prepareEffect = function (mesh, defines, onCompiled, onError, useInstances, useClipPlane, useThinInstances) {\r\n if (onCompiled === void 0) { onCompiled = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (useInstances === void 0) { useInstances = null; }\r\n if (useClipPlane === void 0) { useClipPlane = null; }\r\n this._prepareDefines(mesh, defines, useInstances, useClipPlane, useThinInstances);\r\n if (!defines.isDirty) {\r\n return null;\r\n }\r\n defines.markAsProcessed();\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n var fallbackRank = 0;\r\n if (defines.USESPHERICALINVERTEX) {\r\n fallbacks.addFallback(fallbackRank++, \"USESPHERICALINVERTEX\");\r\n }\r\n if (defines.FOG) {\r\n fallbacks.addFallback(fallbackRank, \"FOG\");\r\n }\r\n if (defines.SPECULARAA) {\r\n fallbacks.addFallback(fallbackRank, \"SPECULARAA\");\r\n }\r\n if (defines.POINTSIZE) {\r\n fallbacks.addFallback(fallbackRank, \"POINTSIZE\");\r\n }\r\n if (defines.LOGARITHMICDEPTH) {\r\n fallbacks.addFallback(fallbackRank, \"LOGARITHMICDEPTH\");\r\n }\r\n if (defines.PARALLAX) {\r\n fallbacks.addFallback(fallbackRank, \"PARALLAX\");\r\n }\r\n if (defines.PARALLAXOCCLUSION) {\r\n fallbacks.addFallback(fallbackRank++, \"PARALLAXOCCLUSION\");\r\n }\r\n fallbackRank = PBRAnisotropicConfiguration.AddFallbacks(defines, fallbacks, fallbackRank);\r\n fallbackRank = PBRAnisotropicConfiguration.AddFallbacks(defines, fallbacks, fallbackRank);\r\n fallbackRank = PBRSubSurfaceConfiguration.AddFallbacks(defines, fallbacks, fallbackRank);\r\n fallbackRank = PBRSheenConfiguration.AddFallbacks(defines, fallbacks, fallbackRank);\r\n if (defines.ENVIRONMENTBRDF) {\r\n fallbacks.addFallback(fallbackRank++, \"ENVIRONMENTBRDF\");\r\n }\r\n if (defines.TANGENT) {\r\n fallbacks.addFallback(fallbackRank++, \"TANGENT\");\r\n }\r\n if (defines.BUMP) {\r\n fallbacks.addFallback(fallbackRank++, \"BUMP\");\r\n }\r\n fallbackRank = MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this._maxSimultaneousLights, fallbackRank++);\r\n if (defines.SPECULARTERM) {\r\n fallbacks.addFallback(fallbackRank++, \"SPECULARTERM\");\r\n }\r\n if (defines.USESPHERICALFROMREFLECTIONMAP) {\r\n fallbacks.addFallback(fallbackRank++, \"USESPHERICALFROMREFLECTIONMAP\");\r\n }\r\n if (defines.USEIRRADIANCEMAP) {\r\n fallbacks.addFallback(fallbackRank++, \"USEIRRADIANCEMAP\");\r\n }\r\n if (defines.LIGHTMAP) {\r\n fallbacks.addFallback(fallbackRank++, \"LIGHTMAP\");\r\n }\r\n if (defines.NORMAL) {\r\n fallbacks.addFallback(fallbackRank++, \"NORMAL\");\r\n }\r\n if (defines.AMBIENT) {\r\n fallbacks.addFallback(fallbackRank++, \"AMBIENT\");\r\n }\r\n if (defines.EMISSIVE) {\r\n fallbacks.addFallback(fallbackRank++, \"EMISSIVE\");\r\n }\r\n if (defines.VERTEXCOLOR) {\r\n fallbacks.addFallback(fallbackRank++, \"VERTEXCOLOR\");\r\n }\r\n if (defines.MORPHTARGETS) {\r\n fallbacks.addFallback(fallbackRank++, \"MORPHTARGETS\");\r\n }\r\n if (defines.MULTIVIEW) {\r\n fallbacks.addFallback(0, \"MULTIVIEW\");\r\n }\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n if (defines.TANGENT) {\r\n attribs.push(VertexBuffer.TangentKind);\r\n }\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n MaterialHelper.PrepareAttributesForMorphTargets(attribs, mesh, defines);\r\n var shaderName = \"pbr\";\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vAmbientColor\", \"vAlbedoColor\", \"vReflectivityColor\", \"vMetallicReflectanceFactors\", \"vEmissiveColor\", \"visibility\", \"vReflectionColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vAlbedoInfos\", \"vAmbientInfos\", \"vOpacityInfos\", \"vReflectionInfos\", \"vReflectionPosition\", \"vReflectionSize\", \"vEmissiveInfos\", \"vReflectivityInfos\", \"vReflectionFilteringInfo\", \"vMetallicReflectanceInfos\",\r\n \"vMicroSurfaceSamplerInfos\", \"vBumpInfos\", \"vLightmapInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"vClipPlane5\", \"vClipPlane6\", \"albedoMatrix\", \"ambientMatrix\", \"opacityMatrix\", \"reflectionMatrix\", \"emissiveMatrix\", \"reflectivityMatrix\", \"normalMatrix\", \"microSurfaceSamplerMatrix\", \"bumpMatrix\", \"lightmapMatrix\", \"metallicReflectanceMatrix\",\r\n \"vLightingIntensity\",\r\n \"logarithmicDepthConstant\",\r\n \"vSphericalX\", \"vSphericalY\", \"vSphericalZ\",\r\n \"vSphericalXX_ZZ\", \"vSphericalYY_ZZ\", \"vSphericalZZ\",\r\n \"vSphericalXY\", \"vSphericalYZ\", \"vSphericalZX\",\r\n \"vSphericalL00\",\r\n \"vSphericalL1_1\", \"vSphericalL10\", \"vSphericalL11\",\r\n \"vSphericalL2_2\", \"vSphericalL2_1\", \"vSphericalL20\", \"vSphericalL21\", \"vSphericalL22\",\r\n \"vReflectionMicrosurfaceInfos\",\r\n \"vTangentSpaceParams\", \"boneTextureWidth\",\r\n \"vDebugMode\"\r\n ];\r\n var samplers = [\"albedoSampler\", \"reflectivitySampler\", \"ambientSampler\", \"emissiveSampler\",\r\n \"bumpSampler\", \"lightmapSampler\", \"opacitySampler\",\r\n \"reflectionSampler\", \"reflectionSamplerLow\", \"reflectionSamplerHigh\", \"irradianceSampler\",\r\n \"microSurfaceSampler\", \"environmentBrdfSampler\", \"boneSampler\", \"metallicReflectanceSampler\"];\r\n var uniformBuffers = [\"Material\", \"Scene\"];\r\n DetailMapConfiguration.AddUniforms(uniforms);\r\n DetailMapConfiguration.AddSamplers(samplers);\r\n PBRSubSurfaceConfiguration.AddUniforms(uniforms);\r\n PBRSubSurfaceConfiguration.AddSamplers(samplers);\r\n PBRClearCoatConfiguration.AddUniforms(uniforms);\r\n PBRClearCoatConfiguration.AddSamplers(samplers);\r\n PBRAnisotropicConfiguration.AddUniforms(uniforms);\r\n PBRAnisotropicConfiguration.AddSamplers(samplers);\r\n PBRSheenConfiguration.AddUniforms(uniforms);\r\n PBRSheenConfiguration.AddSamplers(samplers);\r\n PrePassConfiguration.AddUniforms(uniforms);\r\n PrePassConfiguration.AddSamplers(uniforms);\r\n if (ImageProcessingConfiguration) {\r\n ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);\r\n ImageProcessingConfiguration.PrepareSamplers(samplers, defines);\r\n }\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this._maxSimultaneousLights\r\n });\r\n var csnrOptions = {};\r\n if (this.customShaderNameResolve) {\r\n shaderName = this.customShaderNameResolve(shaderName, uniforms, uniformBuffers, samplers, defines, attribs, csnrOptions);\r\n }\r\n var join = defines.toString();\r\n return engine.createEffect(shaderName, {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: onCompiled,\r\n onError: onError,\r\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: defines.NUM_MORPH_INFLUENCERS },\r\n processFinalCode: csnrOptions.processFinalCode,\r\n multiTarget: defines.PREPASS\r\n }, engine);\r\n };\r\n PBRBaseMaterial.prototype._prepareDefines = function (mesh, defines, useInstances, useClipPlane, useThinInstances) {\r\n if (useInstances === void 0) { useInstances = null; }\r\n if (useClipPlane === void 0) { useClipPlane = null; }\r\n if (useThinInstances === void 0) { useThinInstances = false; }\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n // Lights\r\n MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);\r\n defines._needNormals = true;\r\n // Multiview\r\n MaterialHelper.PrepareDefinesForMultiview(scene, defines);\r\n // PrePass\r\n MaterialHelper.PrepareDefinesForPrePass(scene, defines, this.canRenderToMRT);\r\n // Textures\r\n defines.METALLICWORKFLOW = this.isMetallicWorkflow();\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (scene.getEngine().getCaps().textureLOD) {\r\n defines.LODBASEDMICROSFURACE = true;\r\n }\r\n if (this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._albedoTexture, defines, \"ALBEDO\");\r\n defines.GAMMAALBEDO = this._albedoTexture.gammaSpace;\r\n }\r\n else {\r\n defines.ALBEDO = false;\r\n }\r\n if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._ambientTexture, defines, \"AMBIENT\");\r\n defines.AMBIENTINGRAYSCALE = this._useAmbientInGrayScale;\r\n }\r\n else {\r\n defines.AMBIENT = false;\r\n }\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._opacityTexture, defines, \"OPACITY\");\r\n defines.OPACITYRGB = this._opacityTexture.getAlphaFromRGB;\r\n }\r\n else {\r\n defines.OPACITY = false;\r\n }\r\n var reflectionTexture = this._getReflectionTexture();\r\n if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {\r\n defines.REFLECTION = true;\r\n defines.GAMMAREFLECTION = reflectionTexture.gammaSpace;\r\n defines.RGBDREFLECTION = reflectionTexture.isRGBD;\r\n defines.REFLECTIONMAP_OPPOSITEZ = this.getScene().useRightHandedSystem ? !reflectionTexture.invertZ : reflectionTexture.invertZ;\r\n defines.LODINREFLECTIONALPHA = reflectionTexture.lodLevelInAlpha;\r\n defines.LINEARSPECULARREFLECTION = reflectionTexture.linearSpecularLOD;\r\n if (this.realTimeFiltering && this.realTimeFilteringQuality > 0) {\r\n defines.NUM_SAMPLES = \"\" + this.realTimeFilteringQuality;\r\n if (engine.webGLVersion > 1) {\r\n defines.NUM_SAMPLES = defines.NUM_SAMPLES + \"u\";\r\n }\r\n defines.REALTIME_FILTERING = true;\r\n }\r\n else {\r\n defines.REALTIME_FILTERING = false;\r\n }\r\n if (reflectionTexture.coordinatesMode === Texture.INVCUBIC_MODE) {\r\n defines.INVERTCUBICMAP = true;\r\n }\r\n defines.REFLECTIONMAP_3D = reflectionTexture.isCube;\r\n defines.REFLECTIONMAP_CUBIC = false;\r\n defines.REFLECTIONMAP_EXPLICIT = false;\r\n defines.REFLECTIONMAP_PLANAR = false;\r\n defines.REFLECTIONMAP_PROJECTION = false;\r\n defines.REFLECTIONMAP_SKYBOX = false;\r\n defines.REFLECTIONMAP_SPHERICAL = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n switch (reflectionTexture.coordinatesMode) {\r\n case Texture.EXPLICIT_MODE:\r\n defines.REFLECTIONMAP_EXPLICIT = true;\r\n break;\r\n case Texture.PLANAR_MODE:\r\n defines.REFLECTIONMAP_PLANAR = true;\r\n break;\r\n case Texture.PROJECTION_MODE:\r\n defines.REFLECTIONMAP_PROJECTION = true;\r\n break;\r\n case Texture.SKYBOX_MODE:\r\n defines.REFLECTIONMAP_SKYBOX = true;\r\n break;\r\n case Texture.SPHERICAL_MODE:\r\n defines.REFLECTIONMAP_SPHERICAL = true;\r\n break;\r\n case Texture.EQUIRECTANGULAR_MODE:\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = true;\r\n break;\r\n case Texture.FIXED_EQUIRECTANGULAR_MODE:\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true;\r\n break;\r\n case Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true;\r\n break;\r\n case Texture.CUBIC_MODE:\r\n case Texture.INVCUBIC_MODE:\r\n default:\r\n defines.REFLECTIONMAP_CUBIC = true;\r\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = reflectionTexture.boundingBoxSize ? true : false;\r\n break;\r\n }\r\n if (reflectionTexture.coordinatesMode !== Texture.SKYBOX_MODE) {\r\n if (reflectionTexture.irradianceTexture) {\r\n defines.USEIRRADIANCEMAP = true;\r\n defines.USESPHERICALFROMREFLECTIONMAP = false;\r\n }\r\n // Assume using spherical polynomial if the reflection texture is a cube map\r\n else if (reflectionTexture.isCube) {\r\n defines.USESPHERICALFROMREFLECTIONMAP = true;\r\n defines.USEIRRADIANCEMAP = false;\r\n if (this._forceIrradianceInFragment || this.realTimeFiltering || scene.getEngine().getCaps().maxVaryingVectors <= 8) {\r\n defines.USESPHERICALINVERTEX = false;\r\n }\r\n else {\r\n defines.USESPHERICALINVERTEX = true;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n defines.REFLECTION = false;\r\n defines.REFLECTIONMAP_3D = false;\r\n defines.REFLECTIONMAP_SPHERICAL = false;\r\n defines.REFLECTIONMAP_PLANAR = false;\r\n defines.REFLECTIONMAP_CUBIC = false;\r\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\r\n defines.REFLECTIONMAP_PROJECTION = false;\r\n defines.REFLECTIONMAP_SKYBOX = false;\r\n defines.REFLECTIONMAP_EXPLICIT = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n defines.INVERTCUBICMAP = false;\r\n defines.USESPHERICALFROMREFLECTIONMAP = false;\r\n defines.USEIRRADIANCEMAP = false;\r\n defines.USESPHERICALINVERTEX = false;\r\n defines.REFLECTIONMAP_OPPOSITEZ = false;\r\n defines.LODINREFLECTIONALPHA = false;\r\n defines.GAMMAREFLECTION = false;\r\n defines.RGBDREFLECTION = false;\r\n defines.LINEARSPECULARREFLECTION = false;\r\n }\r\n if (this._lightmapTexture && MaterialFlags.LightmapTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._lightmapTexture, defines, \"LIGHTMAP\");\r\n defines.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap;\r\n defines.GAMMALIGHTMAP = this._lightmapTexture.gammaSpace;\r\n defines.RGBDLIGHTMAP = this._lightmapTexture.isRGBD;\r\n }\r\n else {\r\n defines.LIGHTMAP = false;\r\n }\r\n if (this._emissiveTexture && MaterialFlags.EmissiveTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._emissiveTexture, defines, \"EMISSIVE\");\r\n }\r\n else {\r\n defines.EMISSIVE = false;\r\n }\r\n if (MaterialFlags.SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._metallicTexture, defines, \"REFLECTIVITY\");\r\n defines.ROUGHNESSSTOREINMETALMAPALPHA = this._useRoughnessFromMetallicTextureAlpha;\r\n defines.ROUGHNESSSTOREINMETALMAPGREEN = !this._useRoughnessFromMetallicTextureAlpha && this._useRoughnessFromMetallicTextureGreen;\r\n defines.METALLNESSSTOREINMETALMAPBLUE = this._useMetallnessFromMetallicTextureBlue;\r\n defines.AOSTOREINMETALMAPRED = this._useAmbientOcclusionFromMetallicTextureRed;\r\n }\r\n else if (this._reflectivityTexture) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._reflectivityTexture, defines, \"REFLECTIVITY\");\r\n defines.MICROSURFACEFROMREFLECTIVITYMAP = this._useMicroSurfaceFromReflectivityMapAlpha;\r\n defines.MICROSURFACEAUTOMATIC = this._useAutoMicroSurfaceFromReflectivityMap;\r\n }\r\n else {\r\n defines.REFLECTIVITY = false;\r\n }\r\n if (this._metallicReflectanceTexture) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._metallicReflectanceTexture, defines, \"METALLIC_REFLECTANCE\");\r\n }\r\n else {\r\n defines.METALLIC_REFLECTANCE = false;\r\n }\r\n if (this._microSurfaceTexture) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._microSurfaceTexture, defines, \"MICROSURFACEMAP\");\r\n }\r\n else {\r\n defines.MICROSURFACEMAP = false;\r\n }\r\n }\r\n else {\r\n defines.REFLECTIVITY = false;\r\n defines.MICROSURFACEMAP = false;\r\n }\r\n if (scene.getEngine().getCaps().standardDerivatives && this._bumpTexture && MaterialFlags.BumpTextureEnabled && !this._disableBumpMap) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._bumpTexture, defines, \"BUMP\");\r\n if (this._useParallax && this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n defines.PARALLAX = true;\r\n defines.PARALLAXOCCLUSION = !!this._useParallaxOcclusion;\r\n }\r\n else {\r\n defines.PARALLAX = false;\r\n }\r\n defines.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap;\r\n }\r\n else {\r\n defines.BUMP = false;\r\n }\r\n if (this._environmentBRDFTexture && MaterialFlags.ReflectionTextureEnabled) {\r\n defines.ENVIRONMENTBRDF = true;\r\n // Not actual true RGBD, only the B chanel is encoded as RGBD for sheen.\r\n defines.ENVIRONMENTBRDF_RGBD = this._environmentBRDFTexture.isRGBD;\r\n }\r\n else {\r\n defines.ENVIRONMENTBRDF = false;\r\n defines.ENVIRONMENTBRDF_RGBD = false;\r\n }\r\n if (this._shouldUseAlphaFromAlbedoTexture()) {\r\n defines.ALPHAFROMALBEDO = true;\r\n }\r\n else {\r\n defines.ALPHAFROMALBEDO = false;\r\n }\r\n }\r\n defines.SPECULAROVERALPHA = this._useSpecularOverAlpha;\r\n if (this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_STANDARD) {\r\n defines.USEPHYSICALLIGHTFALLOFF = false;\r\n defines.USEGLTFLIGHTFALLOFF = false;\r\n }\r\n else if (this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_GLTF) {\r\n defines.USEPHYSICALLIGHTFALLOFF = false;\r\n defines.USEGLTFLIGHTFALLOFF = true;\r\n }\r\n else {\r\n defines.USEPHYSICALLIGHTFALLOFF = true;\r\n defines.USEGLTFLIGHTFALLOFF = false;\r\n }\r\n defines.RADIANCEOVERALPHA = this._useRadianceOverAlpha;\r\n if (!this.backFaceCulling && this._twoSidedLighting) {\r\n defines.TWOSIDEDLIGHTING = true;\r\n }\r\n else {\r\n defines.TWOSIDEDLIGHTING = false;\r\n }\r\n defines.SPECULARAA = scene.getEngine().getCaps().standardDerivatives && this._enableSpecularAntiAliasing;\r\n }\r\n if (defines._areTexturesDirty || defines._areMiscDirty) {\r\n defines.ALPHATESTVALUE = \"\" + this._alphaCutOff + (this._alphaCutOff % 1 === 0 ? \".\" : \"\");\r\n defines.PREMULTIPLYALPHA = (this.alphaMode === 7 || this.alphaMode === 8);\r\n defines.ALPHABLEND = this.needAlphaBlendingForMesh(mesh);\r\n defines.ALPHAFRESNEL = this._useAlphaFresnel || this._useLinearAlphaFresnel;\r\n defines.LINEARALPHAFRESNEL = this._useLinearAlphaFresnel;\r\n }\r\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\r\n this._imageProcessingConfiguration.prepareDefines(defines);\r\n }\r\n defines.FORCENORMALFORWARD = this._forceNormalForward;\r\n defines.RADIANCEOCCLUSION = this._useRadianceOcclusion;\r\n defines.HORIZONOCCLUSION = this._useHorizonOcclusion;\r\n // Misc.\r\n if (defines._areMiscDirty) {\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh) || this._forceAlphaTest, defines);\r\n defines.UNLIT = this._unlit || ((this.pointsCloud || this.wireframe) && !mesh.isVerticesDataPresent(VertexBuffer.NormalKind));\r\n defines.DEBUGMODE = this._debugMode;\r\n }\r\n // External config\r\n this.detailMap.prepareDefines(defines, scene);\r\n this.subSurface.prepareDefines(defines, scene);\r\n this.clearCoat.prepareDefines(defines, scene);\r\n this.anisotropy.prepareDefines(defines, mesh, scene);\r\n this.brdf.prepareDefines(defines);\r\n this.sheen.prepareDefines(defines, scene);\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false, useClipPlane, useThinInstances);\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true, this._transparencyMode !== PBRBaseMaterial.PBRMATERIAL_OPAQUE);\r\n };\r\n /**\r\n * Force shader compilation\r\n */\r\n PBRBaseMaterial.prototype.forceCompilation = function (mesh, onCompiled, options) {\r\n var _this = this;\r\n var localOptions = __assign({ clipPlane: false, useInstances: false }, options);\r\n var defines = new PBRMaterialDefines();\r\n var effect = this._prepareEffect(mesh, defines, undefined, undefined, localOptions.useInstances, localOptions.clipPlane, mesh.hasThinInstances);\r\n if (this._onEffectCreatedObservable) {\r\n onCreatedEffectParameters.effect = effect;\r\n onCreatedEffectParameters.subMesh = null;\r\n this._onEffectCreatedObservable.notifyObservers(onCreatedEffectParameters);\r\n }\r\n if (effect.isReady()) {\r\n if (onCompiled) {\r\n onCompiled(this);\r\n }\r\n }\r\n else {\r\n effect.onCompileObservable.add(function () {\r\n if (onCompiled) {\r\n onCompiled(_this);\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Initializes the uniform buffer layout for the shader.\r\n */\r\n PBRBaseMaterial.prototype.buildUniformLayout = function () {\r\n // Order is important !\r\n var ubo = this._uniformBuffer;\r\n ubo.addUniform(\"vAlbedoInfos\", 2);\r\n ubo.addUniform(\"vAmbientInfos\", 4);\r\n ubo.addUniform(\"vOpacityInfos\", 2);\r\n ubo.addUniform(\"vEmissiveInfos\", 2);\r\n ubo.addUniform(\"vLightmapInfos\", 2);\r\n ubo.addUniform(\"vReflectivityInfos\", 3);\r\n ubo.addUniform(\"vMicroSurfaceSamplerInfos\", 2);\r\n ubo.addUniform(\"vReflectionInfos\", 2);\r\n ubo.addUniform(\"vReflectionFilteringInfo\", 2);\r\n ubo.addUniform(\"vReflectionPosition\", 3);\r\n ubo.addUniform(\"vReflectionSize\", 3);\r\n ubo.addUniform(\"vBumpInfos\", 3);\r\n ubo.addUniform(\"albedoMatrix\", 16);\r\n ubo.addUniform(\"ambientMatrix\", 16);\r\n ubo.addUniform(\"opacityMatrix\", 16);\r\n ubo.addUniform(\"emissiveMatrix\", 16);\r\n ubo.addUniform(\"lightmapMatrix\", 16);\r\n ubo.addUniform(\"reflectivityMatrix\", 16);\r\n ubo.addUniform(\"microSurfaceSamplerMatrix\", 16);\r\n ubo.addUniform(\"bumpMatrix\", 16);\r\n ubo.addUniform(\"vTangentSpaceParams\", 2);\r\n ubo.addUniform(\"reflectionMatrix\", 16);\r\n ubo.addUniform(\"vReflectionColor\", 3);\r\n ubo.addUniform(\"vAlbedoColor\", 4);\r\n ubo.addUniform(\"vLightingIntensity\", 4);\r\n ubo.addUniform(\"vReflectionMicrosurfaceInfos\", 3);\r\n ubo.addUniform(\"pointSize\", 1);\r\n ubo.addUniform(\"vReflectivityColor\", 4);\r\n ubo.addUniform(\"vEmissiveColor\", 3);\r\n ubo.addUniform(\"visibility\", 1);\r\n ubo.addUniform(\"vMetallicReflectanceFactors\", 4);\r\n ubo.addUniform(\"vMetallicReflectanceInfos\", 2);\r\n ubo.addUniform(\"metallicReflectanceMatrix\", 16);\r\n PBRClearCoatConfiguration.PrepareUniformBuffer(ubo);\r\n PBRAnisotropicConfiguration.PrepareUniformBuffer(ubo);\r\n PBRSheenConfiguration.PrepareUniformBuffer(ubo);\r\n PBRSubSurfaceConfiguration.PrepareUniformBuffer(ubo);\r\n DetailMapConfiguration.PrepareUniformBuffer(ubo);\r\n ubo.create();\r\n };\r\n /**\r\n * Unbinds the material from the mesh\r\n */\r\n PBRBaseMaterial.prototype.unbind = function () {\r\n if (this._activeEffect) {\r\n var needFlag = false;\r\n if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n this._activeEffect.setTexture(\"reflection2DSampler\", null);\r\n needFlag = true;\r\n }\r\n if (this.subSurface.unbind(this._activeEffect)) {\r\n needFlag = true;\r\n }\r\n if (needFlag) {\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\r\n }\r\n _super.prototype.unbind.call(this);\r\n };\r\n /**\r\n * Binds the submesh data.\r\n * @param world - The world matrix.\r\n * @param mesh - The BJS mesh.\r\n * @param subMesh - A submesh of the BJS mesh.\r\n */\r\n PBRBaseMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n // Matrices\r\n if (!defines.INSTANCES || defines.THIN_INSTANCES) {\r\n this.bindOnlyWorldMatrix(world);\r\n }\r\n // PrePass\r\n this.prePassConfiguration.bindForSubMesh(this._activeEffect, scene, mesh, world, this.isFrozen);\r\n // Normal Matrix\r\n if (defines.OBJECTSPACE_NORMALMAP) {\r\n world.toNormalMatrix(this._normalMatrix);\r\n this.bindOnlyNormalMatrix(this._normalMatrix);\r\n }\r\n var mustRebind = this._mustRebind(scene, effect, mesh.visibility);\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect, this.prePassConfiguration);\r\n var reflectionTexture = null;\r\n var ubo = this._uniformBuffer;\r\n if (mustRebind) {\r\n var engine = scene.getEngine();\r\n ubo.bindToEffect(effect, \"Material\");\r\n this.bindViewProjection(effect);\r\n reflectionTexture = this._getReflectionTexture();\r\n if (!ubo.useUbo || !this.isFrozen || !ubo.isSync) {\r\n // Texture uniforms\r\n if (scene.texturesEnabled) {\r\n if (this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n ubo.updateFloat2(\"vAlbedoInfos\", this._albedoTexture.coordinatesIndex, this._albedoTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._albedoTexture, ubo, \"albedo\");\r\n }\r\n if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) {\r\n ubo.updateFloat4(\"vAmbientInfos\", this._ambientTexture.coordinatesIndex, this._ambientTexture.level, this._ambientTextureStrength, this._ambientTextureImpactOnAnalyticalLights);\r\n MaterialHelper.BindTextureMatrix(this._ambientTexture, ubo, \"ambient\");\r\n }\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n ubo.updateFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._opacityTexture, ubo, \"opacity\");\r\n }\r\n if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {\r\n ubo.updateMatrix(\"reflectionMatrix\", reflectionTexture.getReflectionTextureMatrix());\r\n ubo.updateFloat2(\"vReflectionInfos\", reflectionTexture.level, 0);\r\n if (reflectionTexture.boundingBoxSize) {\r\n var cubeTexture = reflectionTexture;\r\n ubo.updateVector3(\"vReflectionPosition\", cubeTexture.boundingBoxPosition);\r\n ubo.updateVector3(\"vReflectionSize\", cubeTexture.boundingBoxSize);\r\n }\r\n if (this.realTimeFiltering) {\r\n var width = reflectionTexture.getSize().width;\r\n ubo.updateFloat2(\"vReflectionFilteringInfo\", width, Scalar.Log2(width));\r\n }\r\n if (!defines.USEIRRADIANCEMAP) {\r\n var polynomials = reflectionTexture.sphericalPolynomial;\r\n if (defines.USESPHERICALFROMREFLECTIONMAP && polynomials) {\r\n if (defines.SPHERICAL_HARMONICS) {\r\n var preScaledHarmonics = polynomials.preScaledHarmonics;\r\n this._activeEffect.setVector3(\"vSphericalL00\", preScaledHarmonics.l00);\r\n this._activeEffect.setVector3(\"vSphericalL1_1\", preScaledHarmonics.l1_1);\r\n this._activeEffect.setVector3(\"vSphericalL10\", preScaledHarmonics.l10);\r\n this._activeEffect.setVector3(\"vSphericalL11\", preScaledHarmonics.l11);\r\n this._activeEffect.setVector3(\"vSphericalL2_2\", preScaledHarmonics.l2_2);\r\n this._activeEffect.setVector3(\"vSphericalL2_1\", preScaledHarmonics.l2_1);\r\n this._activeEffect.setVector3(\"vSphericalL20\", preScaledHarmonics.l20);\r\n this._activeEffect.setVector3(\"vSphericalL21\", preScaledHarmonics.l21);\r\n this._activeEffect.setVector3(\"vSphericalL22\", preScaledHarmonics.l22);\r\n }\r\n else {\r\n this._activeEffect.setFloat3(\"vSphericalX\", polynomials.x.x, polynomials.x.y, polynomials.x.z);\r\n this._activeEffect.setFloat3(\"vSphericalY\", polynomials.y.x, polynomials.y.y, polynomials.y.z);\r\n this._activeEffect.setFloat3(\"vSphericalZ\", polynomials.z.x, polynomials.z.y, polynomials.z.z);\r\n this._activeEffect.setFloat3(\"vSphericalXX_ZZ\", polynomials.xx.x - polynomials.zz.x, polynomials.xx.y - polynomials.zz.y, polynomials.xx.z - polynomials.zz.z);\r\n this._activeEffect.setFloat3(\"vSphericalYY_ZZ\", polynomials.yy.x - polynomials.zz.x, polynomials.yy.y - polynomials.zz.y, polynomials.yy.z - polynomials.zz.z);\r\n this._activeEffect.setFloat3(\"vSphericalZZ\", polynomials.zz.x, polynomials.zz.y, polynomials.zz.z);\r\n this._activeEffect.setFloat3(\"vSphericalXY\", polynomials.xy.x, polynomials.xy.y, polynomials.xy.z);\r\n this._activeEffect.setFloat3(\"vSphericalYZ\", polynomials.yz.x, polynomials.yz.y, polynomials.yz.z);\r\n this._activeEffect.setFloat3(\"vSphericalZX\", polynomials.zx.x, polynomials.zx.y, polynomials.zx.z);\r\n }\r\n }\r\n }\r\n ubo.updateFloat3(\"vReflectionMicrosurfaceInfos\", reflectionTexture.getSize().width, reflectionTexture.lodGenerationScale, reflectionTexture.lodGenerationOffset);\r\n }\r\n if (this._emissiveTexture && MaterialFlags.EmissiveTextureEnabled) {\r\n ubo.updateFloat2(\"vEmissiveInfos\", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._emissiveTexture, ubo, \"emissive\");\r\n }\r\n if (this._lightmapTexture && MaterialFlags.LightmapTextureEnabled) {\r\n ubo.updateFloat2(\"vLightmapInfos\", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._lightmapTexture, ubo, \"lightmap\");\r\n }\r\n if (MaterialFlags.SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n ubo.updateFloat3(\"vReflectivityInfos\", this._metallicTexture.coordinatesIndex, this._metallicTexture.level, this._ambientTextureStrength);\r\n MaterialHelper.BindTextureMatrix(this._metallicTexture, ubo, \"reflectivity\");\r\n }\r\n else if (this._reflectivityTexture) {\r\n ubo.updateFloat3(\"vReflectivityInfos\", this._reflectivityTexture.coordinatesIndex, this._reflectivityTexture.level, 1.0);\r\n MaterialHelper.BindTextureMatrix(this._reflectivityTexture, ubo, \"reflectivity\");\r\n }\r\n if (this._metallicReflectanceTexture) {\r\n ubo.updateFloat2(\"vMetallicReflectanceInfos\", this._metallicReflectanceTexture.coordinatesIndex, this._metallicReflectanceTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._metallicReflectanceTexture, ubo, \"metallicReflectance\");\r\n }\r\n if (this._microSurfaceTexture) {\r\n ubo.updateFloat2(\"vMicroSurfaceSamplerInfos\", this._microSurfaceTexture.coordinatesIndex, this._microSurfaceTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._microSurfaceTexture, ubo, \"microSurfaceSampler\");\r\n }\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.BumpTextureEnabled && !this._disableBumpMap) {\r\n ubo.updateFloat3(\"vBumpInfos\", this._bumpTexture.coordinatesIndex, this._bumpTexture.level, this._parallaxScaleBias);\r\n MaterialHelper.BindTextureMatrix(this._bumpTexture, ubo, \"bump\");\r\n if (scene._mirroredCameraPosition) {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? 1.0 : -1.0, this._invertNormalMapY ? 1.0 : -1.0);\r\n }\r\n else {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? -1.0 : 1.0, this._invertNormalMapY ? -1.0 : 1.0);\r\n }\r\n }\r\n }\r\n // Point size\r\n if (this.pointsCloud) {\r\n ubo.updateFloat(\"pointSize\", this.pointSize);\r\n }\r\n // Colors\r\n if (defines.METALLICWORKFLOW) {\r\n TmpColors.Color3[0].r = (this._metallic === undefined || this._metallic === null) ? 1 : this._metallic;\r\n TmpColors.Color3[0].g = (this._roughness === undefined || this._roughness === null) ? 1 : this._roughness;\r\n ubo.updateColor4(\"vReflectivityColor\", TmpColors.Color3[0], 1);\r\n var ior = this.subSurface.indexOfRefraction;\r\n var outside_ior = 1; // consider air as clear coat and other layaers would remap in the shader.\r\n // We are here deriving our default reflectance from a common value for none metallic surface.\r\n // Based of the schlick fresnel approximation model\r\n // for dielectrics.\r\n var f0 = Math.pow((ior - outside_ior) / (ior + outside_ior), 2);\r\n // Tweak the default F0 and F90 based on our given setup\r\n this._metallicReflectanceColor.scaleToRef(f0 * this._metallicF0Factor, TmpColors.Color3[0]);\r\n var metallicF90 = this._metallicF0Factor;\r\n ubo.updateColor4(\"vMetallicReflectanceFactors\", TmpColors.Color3[0], metallicF90);\r\n }\r\n else {\r\n ubo.updateColor4(\"vReflectivityColor\", this._reflectivityColor, this._microSurface);\r\n }\r\n ubo.updateColor3(\"vEmissiveColor\", MaterialFlags.EmissiveTextureEnabled ? this._emissiveColor : Color3.BlackReadOnly);\r\n ubo.updateColor3(\"vReflectionColor\", this._reflectionColor);\r\n if (!defines.SS_REFRACTION && this.subSurface.linkRefractionWithTransparency) {\r\n ubo.updateColor4(\"vAlbedoColor\", this._albedoColor, 1);\r\n }\r\n else {\r\n ubo.updateColor4(\"vAlbedoColor\", this._albedoColor, this.alpha);\r\n }\r\n // Misc\r\n this._lightingInfos.x = this._directIntensity;\r\n this._lightingInfos.y = this._emissiveIntensity;\r\n this._lightingInfos.z = this._environmentIntensity * scene.environmentIntensity;\r\n this._lightingInfos.w = this._specularIntensity;\r\n ubo.updateVector4(\"vLightingIntensity\", this._lightingInfos);\r\n }\r\n // Visibility\r\n ubo.updateFloat(\"visibility\", mesh.visibility);\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n ubo.setTexture(\"albedoSampler\", this._albedoTexture);\r\n }\r\n if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) {\r\n ubo.setTexture(\"ambientSampler\", this._ambientTexture);\r\n }\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n ubo.setTexture(\"opacitySampler\", this._opacityTexture);\r\n }\r\n if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {\r\n if (defines.LODBASEDMICROSFURACE) {\r\n ubo.setTexture(\"reflectionSampler\", reflectionTexture);\r\n }\r\n else {\r\n ubo.setTexture(\"reflectionSampler\", reflectionTexture._lodTextureMid || reflectionTexture);\r\n ubo.setTexture(\"reflectionSamplerLow\", reflectionTexture._lodTextureLow || reflectionTexture);\r\n ubo.setTexture(\"reflectionSamplerHigh\", reflectionTexture._lodTextureHigh || reflectionTexture);\r\n }\r\n if (defines.USEIRRADIANCEMAP) {\r\n ubo.setTexture(\"irradianceSampler\", reflectionTexture.irradianceTexture);\r\n }\r\n }\r\n if (defines.ENVIRONMENTBRDF) {\r\n ubo.setTexture(\"environmentBrdfSampler\", this._environmentBRDFTexture);\r\n }\r\n if (this._emissiveTexture && MaterialFlags.EmissiveTextureEnabled) {\r\n ubo.setTexture(\"emissiveSampler\", this._emissiveTexture);\r\n }\r\n if (this._lightmapTexture && MaterialFlags.LightmapTextureEnabled) {\r\n ubo.setTexture(\"lightmapSampler\", this._lightmapTexture);\r\n }\r\n if (MaterialFlags.SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n ubo.setTexture(\"reflectivitySampler\", this._metallicTexture);\r\n }\r\n else if (this._reflectivityTexture) {\r\n ubo.setTexture(\"reflectivitySampler\", this._reflectivityTexture);\r\n }\r\n if (this._metallicReflectanceTexture) {\r\n ubo.setTexture(\"metallicReflectanceSampler\", this._metallicReflectanceTexture);\r\n }\r\n if (this._microSurfaceTexture) {\r\n ubo.setTexture(\"microSurfaceSampler\", this._microSurfaceTexture);\r\n }\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.BumpTextureEnabled && !this._disableBumpMap) {\r\n ubo.setTexture(\"bumpSampler\", this._bumpTexture);\r\n }\r\n }\r\n this.detailMap.bindForSubMesh(ubo, scene, this.isFrozen);\r\n this.subSurface.bindForSubMesh(ubo, scene, engine, this.isFrozen, defines.LODBASEDMICROSFURACE, this.realTimeFiltering);\r\n this.clearCoat.bindForSubMesh(ubo, scene, engine, this._disableBumpMap, this.isFrozen, this._invertNormalMapX, this._invertNormalMapY, subMesh);\r\n this.anisotropy.bindForSubMesh(ubo, scene, this.isFrozen);\r\n this.sheen.bindForSubMesh(ubo, scene, this.isFrozen, subMesh);\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n // Colors\r\n scene.ambientColor.multiplyToRef(this._ambientColor, this._globalAmbientColor);\r\n var eyePosition = scene._forcedViewPosition ? scene._forcedViewPosition : (scene._mirroredCameraPosition ? scene._mirroredCameraPosition : scene.activeCamera.globalPosition);\r\n var invertNormal = (scene.useRightHandedSystem === (scene._mirroredCameraPosition != null));\r\n effect.setFloat4(\"vEyePosition\", eyePosition.x, eyePosition.y, eyePosition.z, invertNormal ? -1 : 1);\r\n effect.setColor3(\"vAmbientColor\", this._globalAmbientColor);\r\n effect.setFloat2(\"vDebugMode\", this.debugLimit, this.debugFactor);\r\n }\r\n if (mustRebind || !this.isFrozen) {\r\n // Lights\r\n if (scene.lightsEnabled && !this._disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights, this._rebuildInParallel);\r\n }\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE || reflectionTexture) {\r\n this.bindView(effect);\r\n }\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect, true);\r\n // Morph targets\r\n if (defines.NUM_MORPH_INFLUENCERS) {\r\n MaterialHelper.BindMorphTargetParameters(mesh, this._activeEffect);\r\n }\r\n // image processing\r\n this._imageProcessingConfiguration.bind(this._activeEffect);\r\n // Log. depth\r\n MaterialHelper.BindLogDepth(defines, this._activeEffect, scene);\r\n }\r\n ubo.update();\r\n this._afterBind(mesh, this._activeEffect);\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @returns - Array of animatable textures.\r\n */\r\n PBRBaseMaterial.prototype.getAnimatables = function () {\r\n var results = [];\r\n if (this._albedoTexture && this._albedoTexture.animations && this._albedoTexture.animations.length > 0) {\r\n results.push(this._albedoTexture);\r\n }\r\n if (this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0) {\r\n results.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0) {\r\n results.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0) {\r\n results.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0) {\r\n results.push(this._emissiveTexture);\r\n }\r\n if (this._metallicTexture && this._metallicTexture.animations && this._metallicTexture.animations.length > 0) {\r\n results.push(this._metallicTexture);\r\n }\r\n else if (this._reflectivityTexture && this._reflectivityTexture.animations && this._reflectivityTexture.animations.length > 0) {\r\n results.push(this._reflectivityTexture);\r\n }\r\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\r\n results.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0) {\r\n results.push(this._lightmapTexture);\r\n }\r\n this.detailMap.getAnimatables(results);\r\n this.subSurface.getAnimatables(results);\r\n this.clearCoat.getAnimatables(results);\r\n this.sheen.getAnimatables(results);\r\n this.anisotropy.getAnimatables(results);\r\n return results;\r\n };\r\n /**\r\n * Returns the texture used for reflections.\r\n * @returns - Reflection texture if present. Otherwise, returns the environment texture.\r\n */\r\n PBRBaseMaterial.prototype._getReflectionTexture = function () {\r\n if (this._reflectionTexture) {\r\n return this._reflectionTexture;\r\n }\r\n return this.getScene().environmentTexture;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @returns - Array of BaseTextures\r\n */\r\n PBRBaseMaterial.prototype.getActiveTextures = function () {\r\n var activeTextures = _super.prototype.getActiveTextures.call(this);\r\n if (this._albedoTexture) {\r\n activeTextures.push(this._albedoTexture);\r\n }\r\n if (this._ambientTexture) {\r\n activeTextures.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture) {\r\n activeTextures.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture) {\r\n activeTextures.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture) {\r\n activeTextures.push(this._emissiveTexture);\r\n }\r\n if (this._reflectivityTexture) {\r\n activeTextures.push(this._reflectivityTexture);\r\n }\r\n if (this._metallicTexture) {\r\n activeTextures.push(this._metallicTexture);\r\n }\r\n if (this._metallicReflectanceTexture) {\r\n activeTextures.push(this._metallicReflectanceTexture);\r\n }\r\n if (this._microSurfaceTexture) {\r\n activeTextures.push(this._microSurfaceTexture);\r\n }\r\n if (this._bumpTexture) {\r\n activeTextures.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture) {\r\n activeTextures.push(this._lightmapTexture);\r\n }\r\n this.detailMap.getActiveTextures(activeTextures);\r\n this.subSurface.getActiveTextures(activeTextures);\r\n this.clearCoat.getActiveTextures(activeTextures);\r\n this.sheen.getActiveTextures(activeTextures);\r\n this.anisotropy.getActiveTextures(activeTextures);\r\n return activeTextures;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRBaseMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n if (this._albedoTexture === texture) {\r\n return true;\r\n }\r\n if (this._ambientTexture === texture) {\r\n return true;\r\n }\r\n if (this._opacityTexture === texture) {\r\n return true;\r\n }\r\n if (this._reflectionTexture === texture) {\r\n return true;\r\n }\r\n if (this._reflectivityTexture === texture) {\r\n return true;\r\n }\r\n if (this._metallicTexture === texture) {\r\n return true;\r\n }\r\n if (this._metallicReflectanceTexture === texture) {\r\n return true;\r\n }\r\n if (this._microSurfaceTexture === texture) {\r\n return true;\r\n }\r\n if (this._bumpTexture === texture) {\r\n return true;\r\n }\r\n if (this._lightmapTexture === texture) {\r\n return true;\r\n }\r\n return this.detailMap.hasTexture(texture) ||\r\n this.subSurface.hasTexture(texture) ||\r\n this.clearCoat.hasTexture(texture) ||\r\n this.sheen.hasTexture(texture) ||\r\n this.anisotropy.hasTexture(texture);\r\n };\r\n /**\r\n * Sets the required values to the prepass renderer.\r\n * @param prePassRenderer defines the prepass renderer to setup\r\n */\r\n PBRBaseMaterial.prototype.setPrePassRenderer = function (prePassRenderer) {\r\n if (this.subSurface.isScatteringEnabled) {\r\n var subSurfaceConfiguration = this.getScene().enableSubSurfaceForPrePass();\r\n if (subSurfaceConfiguration) {\r\n subSurfaceConfiguration.enabled = true;\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeEffect - Forces the disposal of effects.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRBaseMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\r\n if (forceDisposeTextures) {\r\n if (this._environmentBRDFTexture && this.getScene().environmentBRDFTexture !== this._environmentBRDFTexture) {\r\n this._environmentBRDFTexture.dispose();\r\n }\r\n (_a = this._albedoTexture) === null || _a === void 0 ? void 0 : _a.dispose();\r\n (_b = this._ambientTexture) === null || _b === void 0 ? void 0 : _b.dispose();\r\n (_c = this._opacityTexture) === null || _c === void 0 ? void 0 : _c.dispose();\r\n (_d = this._reflectionTexture) === null || _d === void 0 ? void 0 : _d.dispose();\r\n (_e = this._emissiveTexture) === null || _e === void 0 ? void 0 : _e.dispose();\r\n (_f = this._metallicTexture) === null || _f === void 0 ? void 0 : _f.dispose();\r\n (_g = this._reflectivityTexture) === null || _g === void 0 ? void 0 : _g.dispose();\r\n (_h = this._bumpTexture) === null || _h === void 0 ? void 0 : _h.dispose();\r\n (_j = this._lightmapTexture) === null || _j === void 0 ? void 0 : _j.dispose();\r\n (_k = this._metallicReflectanceTexture) === null || _k === void 0 ? void 0 : _k.dispose();\r\n (_l = this._microSurfaceTexture) === null || _l === void 0 ? void 0 : _l.dispose();\r\n }\r\n this.detailMap.dispose(forceDisposeTextures);\r\n this.subSurface.dispose(forceDisposeTextures);\r\n this.clearCoat.dispose(forceDisposeTextures);\r\n this.sheen.dispose(forceDisposeTextures);\r\n this.anisotropy.dispose(forceDisposeTextures);\r\n this._renderTargets.dispose();\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);\r\n };\r\n /**\r\n * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_OPAQUE = Material.MATERIAL_OPAQUE;\r\n /**\r\n * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_ALPHATEST = Material.MATERIAL_ALPHATEST;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_ALPHABLEND = Material.MATERIAL_ALPHABLEND;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n * They are also discarded below the alpha cutoff threshold to improve performances.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND = Material.MATERIAL_ALPHATESTANDBLEND;\r\n /**\r\n * Defines the default value of how much AO map is occluding the analytical lights\r\n * (point spot...).\r\n */\r\n PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = 0;\r\n /**\r\n * PBRMaterialLightFalloff Physical: light is falling off following the inverse squared distance law.\r\n */\r\n PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL = 0;\r\n /**\r\n * PBRMaterialLightFalloff gltf: light is falling off as described in the gltf moving to PBR document\r\n * to enhance interoperability with other engines.\r\n */\r\n PBRBaseMaterial.LIGHTFALLOFF_GLTF = 1;\r\n /**\r\n * PBRMaterialLightFalloff Standard: light is falling off like in the standard material\r\n * to enhance interoperability with other materials.\r\n */\r\n PBRBaseMaterial.LIGHTFALLOFF_STANDARD = 2;\r\n __decorate([\r\n serializeAsImageProcessingConfiguration()\r\n ], PBRBaseMaterial.prototype, \"_imageProcessingConfiguration\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBaseMaterial.prototype, \"debugMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRBaseMaterial.prototype, \"useLogarithmicDepth\", null);\r\n return PBRBaseMaterial;\r\n}(PushMaterial));\r\nexport { PBRBaseMaterial };\r\n//# sourceMappingURL=pbrBaseMaterial.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, SerializationHelper, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { BRDFTextureTools } from \"../../Misc/brdfTextureTools\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { PBRBaseMaterial } from \"./pbrBaseMaterial\";\r\nimport { _TypeStore } from '../../Misc/typeStore';\r\n/**\r\n * The Physically based material of BJS.\r\n *\r\n * This offers the main features of a standard PBR material.\r\n * For more information, please refer to the documentation :\r\n * https://doc.babylonjs.com/how_to/physically_based_rendering\r\n */\r\nvar PBRMaterial = /** @class */ (function (_super) {\r\n __extends(PBRMaterial, _super);\r\n /**\r\n * Instantiates a new PBRMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n function PBRMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Intensity of the direct lights e.g. the four lights available in your scene.\r\n * This impacts both the direct diffuse and specular highlights.\r\n */\r\n _this.directIntensity = 1.0;\r\n /**\r\n * Intensity of the emissive part of the material.\r\n * This helps controlling the emissive effect without modifying the emissive color.\r\n */\r\n _this.emissiveIntensity = 1.0;\r\n /**\r\n * Intensity of the environment e.g. how much the environment will light the object\r\n * either through harmonics for rough material or through the refelction for shiny ones.\r\n */\r\n _this.environmentIntensity = 1.0;\r\n /**\r\n * This is a special control allowing the reduction of the specular highlights coming from the\r\n * four lights of the scene. Those highlights may not be needed in full environment lighting.\r\n */\r\n _this.specularIntensity = 1.0;\r\n /**\r\n * Debug Control allowing disabling the bump map on this material.\r\n */\r\n _this.disableBumpMap = false;\r\n /**\r\n * AKA Occlusion Texture Intensity in other nomenclature.\r\n */\r\n _this.ambientTextureStrength = 1.0;\r\n /**\r\n * Defines how much the AO map is occluding the analytical lights (point spot...).\r\n * 1 means it completely occludes it\r\n * 0 mean it has no impact\r\n */\r\n _this.ambientTextureImpactOnAnalyticalLights = PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n /**\r\n * In metallic workflow, specifies an F0 factor to help configuring the material F0.\r\n * By default the indexOfrefraction is used to compute F0;\r\n *\r\n * This is used as a factor against the default reflectance at normal incidence to tweak it.\r\n *\r\n * F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor;\r\n * F90 = metallicReflectanceColor;\r\n */\r\n _this.metallicF0Factor = 1;\r\n /**\r\n * In metallic workflow, specifies an F90 color to help configuring the material F90.\r\n * By default the F90 is always 1;\r\n *\r\n * Please note that this factor is also used as a factor against the default reflectance at normal incidence.\r\n *\r\n * F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor\r\n * F90 = metallicReflectanceColor;\r\n */\r\n _this.metallicReflectanceColor = Color3.White();\r\n /**\r\n * The color of a material in ambient lighting.\r\n */\r\n _this.ambientColor = new Color3(0, 0, 0);\r\n /**\r\n * AKA Diffuse Color in other nomenclature.\r\n */\r\n _this.albedoColor = new Color3(1, 1, 1);\r\n /**\r\n * AKA Specular Color in other nomenclature.\r\n */\r\n _this.reflectivityColor = new Color3(1, 1, 1);\r\n /**\r\n * The color reflected from the material.\r\n */\r\n _this.reflectionColor = new Color3(1.0, 1.0, 1.0);\r\n /**\r\n * The color emitted from the material.\r\n */\r\n _this.emissiveColor = new Color3(0, 0, 0);\r\n /**\r\n * AKA Glossiness in other nomenclature.\r\n */\r\n _this.microSurface = 1.0;\r\n /**\r\n * If true, the light map contains occlusion information instead of lighting info.\r\n */\r\n _this.useLightmapAsShadowmap = false;\r\n /**\r\n * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.\r\n */\r\n _this.useAlphaFromAlbedoTexture = false;\r\n /**\r\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\r\n */\r\n _this.forceAlphaTest = false;\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n _this.alphaCutOff = 0.4;\r\n /**\r\n * Specifies that the material will keep the specular highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.\r\n */\r\n _this.useSpecularOverAlpha = true;\r\n /**\r\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\r\n */\r\n _this.useMicroSurfaceFromReflectivityMapAlpha = false;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its alpha channel.\r\n */\r\n _this.useRoughnessFromMetallicTextureAlpha = true;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its green channel.\r\n */\r\n _this.useRoughnessFromMetallicTextureGreen = false;\r\n /**\r\n * Specifies if the metallic texture contains the metallness information in its blue channel.\r\n */\r\n _this.useMetallnessFromMetallicTextureBlue = false;\r\n /**\r\n * Specifies if the metallic texture contains the ambient occlusion information in its red channel.\r\n */\r\n _this.useAmbientOcclusionFromMetallicTextureRed = false;\r\n /**\r\n * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.\r\n */\r\n _this.useAmbientInGrayScale = false;\r\n /**\r\n * In case the reflectivity map does not contain the microsurface information in its alpha channel,\r\n * The material will try to infer what glossiness each pixel should be.\r\n */\r\n _this.useAutoMicroSurfaceFromReflectivityMap = false;\r\n /**\r\n * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.\r\n */\r\n _this.useRadianceOverAlpha = true;\r\n /**\r\n * Allows using an object space normal map (instead of tangent space).\r\n */\r\n _this.useObjectSpaceNormalMap = false;\r\n /**\r\n * Allows using the bump map in parallax mode.\r\n */\r\n _this.useParallax = false;\r\n /**\r\n * Allows using the bump map in parallax occlusion mode.\r\n */\r\n _this.useParallaxOcclusion = false;\r\n /**\r\n * Controls the scale bias of the parallax mode.\r\n */\r\n _this.parallaxScaleBias = 0.05;\r\n /**\r\n * If sets to true, disables all the lights affecting the material.\r\n */\r\n _this.disableLighting = false;\r\n /**\r\n * Force the shader to compute irradiance in the fragment shader in order to take bump in account.\r\n */\r\n _this.forceIrradianceInFragment = false;\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n _this.maxSimultaneousLights = 4;\r\n /**\r\n * If sets to true, x component of normal map value will invert (x = 1.0 - x).\r\n */\r\n _this.invertNormalMapX = false;\r\n /**\r\n * If sets to true, y component of normal map value will invert (y = 1.0 - y).\r\n */\r\n _this.invertNormalMapY = false;\r\n /**\r\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\r\n */\r\n _this.twoSidedLighting = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)\r\n */\r\n _this.useAlphaFresnel = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)\r\n */\r\n _this.useLinearAlphaFresnel = false;\r\n /**\r\n * Let user defines the brdf lookup texture used for IBL.\r\n * A default 8bit version is embedded but you could point at :\r\n * * Default texture: https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png\r\n * * Default 16bit pixel depth texture: https://assets.babylonjs.com/environments/correlatedMSBRDF.dds\r\n * * LEGACY Default None correlated https://assets.babylonjs.com/environments/uncorrelatedBRDF_RGBD.png\r\n * * LEGACY Default None correlated 16bit pixel depth https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds\r\n */\r\n _this.environmentBRDFTexture = null;\r\n /**\r\n * Force normal to face away from face.\r\n */\r\n _this.forceNormalForward = false;\r\n /**\r\n * Enables specular anti aliasing in the PBR shader.\r\n * It will both interacts on the Geometry for analytical and IBL lighting.\r\n * It also prefilter the roughness map based on the bump values.\r\n */\r\n _this.enableSpecularAntiAliasing = false;\r\n /**\r\n * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal\r\n * makes the reflect vector face the model (under horizon).\r\n */\r\n _this.useHorizonOcclusion = true;\r\n /**\r\n * This parameters will enable/disable radiance occlusion by preventing the radiance to lit\r\n * too much the area relying on ambient texture to define their ambient occlusion.\r\n */\r\n _this.useRadianceOcclusion = true;\r\n /**\r\n * If set to true, no lighting calculations will be applied.\r\n */\r\n _this.unlit = false;\r\n _this._environmentBRDFTexture = BRDFTextureTools.GetEnvironmentBRDFTexture(scene);\r\n return _this;\r\n }\r\n Object.defineProperty(PBRMaterial.prototype, \"refractionTexture\", {\r\n /**\r\n * Stores the refracted light information in a texture.\r\n */\r\n get: function () {\r\n return this.subSurface.refractionTexture;\r\n },\r\n set: function (value) {\r\n this.subSurface.refractionTexture = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n }\r\n else if (!this.subSurface.linkRefractionWithTransparency) {\r\n this.subSurface.isRefractionEnabled = false;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"indexOfRefraction\", {\r\n /**\r\n * Index of refraction of the material base layer.\r\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\r\n *\r\n * This does not only impact refraction but also the Base F0 of Dielectric Materials.\r\n *\r\n * From dielectric fresnel rules: F0 = square((iorT - iorI) / (iorT + iorI))\r\n */\r\n get: function () {\r\n return this.subSurface.indexOfRefraction;\r\n },\r\n set: function (value) {\r\n this.subSurface.indexOfRefraction = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"invertRefractionY\", {\r\n /**\r\n * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.\r\n */\r\n get: function () {\r\n return this.subSurface.invertRefractionY;\r\n },\r\n set: function (value) {\r\n this.subSurface.invertRefractionY = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"linkRefractionWithTransparency\", {\r\n /**\r\n * This parameters will make the material used its opacity to control how much it is refracting aginst not.\r\n * Materials half opaque for instance using refraction could benefit from this control.\r\n */\r\n get: function () {\r\n return this.subSurface.linkRefractionWithTransparency;\r\n },\r\n set: function (value) {\r\n this.subSurface.linkRefractionWithTransparency = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"usePhysicalLightFalloff\", {\r\n /**\r\n * BJS is using an harcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n get: function () {\r\n return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n },\r\n /**\r\n * BJS is using an harcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n set: function (value) {\r\n if (value !== this.usePhysicalLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n if (value) {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n }\r\n else {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"useGLTFLightFalloff\", {\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n get: function () {\r\n return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_GLTF;\r\n },\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n set: function (value) {\r\n if (value !== this.useGLTFLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n if (value) {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_GLTF;\r\n }\r\n else {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n this._attachImageProcessingConfiguration(value);\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n },\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraToneMappingEnabled\", {\r\n /**\r\n * Gets wether tonemapping is enabled or not.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether tonemapping is enabled or not\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraExposure\", {\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.exposure;\r\n },\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.exposure = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraContrast\", {\r\n /**\r\n * Gets The camera contrast used on this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.contrast;\r\n },\r\n /**\r\n * Sets The camera contrast used on this material.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.contrast = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorGradingTexture\", {\r\n /**\r\n * Gets the Color Grading 2D Lookup Texture.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorGradingTexture;\r\n },\r\n /**\r\n * Sets the Color Grading 2D Lookup Texture.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorGradingTexture = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorCurves\", {\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorCurves;\r\n },\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorCurves = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the name of this material class.\r\n */\r\n PBRMaterial.prototype.getClassName = function () {\r\n return \"PBRMaterial\";\r\n };\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n */\r\n PBRMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n var clone = SerializationHelper.Clone(function () { return new PBRMaterial(name, _this.getScene()); }, this);\r\n clone.id = name;\r\n clone.name = name;\r\n this.clearCoat.copyTo(clone.clearCoat);\r\n this.anisotropy.copyTo(clone.anisotropy);\r\n this.brdf.copyTo(clone.brdf);\r\n this.sheen.copyTo(clone.sheen);\r\n this.subSurface.copyTo(clone.subSurface);\r\n return clone;\r\n };\r\n /**\r\n * Serializes this PBR Material.\r\n * @returns - An object with the serialized material.\r\n */\r\n PBRMaterial.prototype.serialize = function () {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.PBRMaterial\";\r\n serializationObject.clearCoat = this.clearCoat.serialize();\r\n serializationObject.anisotropy = this.anisotropy.serialize();\r\n serializationObject.brdf = this.brdf.serialize();\r\n serializationObject.sheen = this.sheen.serialize();\r\n serializationObject.subSurface = this.subSurface.serialize();\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Parses a PBR Material from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene - BJS scene instance.\r\n * @param rootUrl - url for the scene object\r\n * @returns - PBRMaterial\r\n */\r\n PBRMaterial.Parse = function (source, scene, rootUrl) {\r\n var material = SerializationHelper.Parse(function () { return new PBRMaterial(source.name, scene); }, source, scene, rootUrl);\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n return material;\r\n };\r\n /**\r\n * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.\r\n */\r\n PBRMaterial.PBRMATERIAL_OPAQUE = PBRBaseMaterial.PBRMATERIAL_OPAQUE;\r\n /**\r\n * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\r\n */\r\n PBRMaterial.PBRMATERIAL_ALPHATEST = PBRBaseMaterial.PBRMATERIAL_ALPHATEST;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n */\r\n PBRMaterial.PBRMATERIAL_ALPHABLEND = PBRBaseMaterial.PBRMATERIAL_ALPHABLEND;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n * They are also discarded below the alpha cutoff threshold to improve performances.\r\n */\r\n PBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND = PBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND;\r\n /**\r\n * Defines the default value of how much AO map is occluding the analytical lights\r\n * (point spot...).\r\n */\r\n PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"directIntensity\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"emissiveIntensity\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"environmentIntensity\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"specularIntensity\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"disableBumpMap\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"albedoTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientTextureStrength\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientTextureImpactOnAnalyticalLights\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"opacityTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectionTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"emissiveTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectivityTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"metallicTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"metallic\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"roughness\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"metallicF0Factor\", void 0);\r\n __decorate([\r\n serializeAsColor3(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"metallicReflectanceColor\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"metallicReflectanceTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"microSurfaceTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"bumpTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", null)\r\n ], PBRMaterial.prototype, \"lightmapTexture\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"ambient\"),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientColor\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"albedo\"),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"albedoColor\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"reflectivity\"),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectivityColor\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"reflection\"),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectionColor\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"emissive\"),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"emissiveColor\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"microSurface\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useLightmapAsShadowmap\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"useAlphaFromAlbedoTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"forceAlphaTest\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"alphaCutOff\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useSpecularOverAlpha\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useMicroSurfaceFromReflectivityMapAlpha\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRoughnessFromMetallicTextureAlpha\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRoughnessFromMetallicTextureGreen\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useMetallnessFromMetallicTextureBlue\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAmbientOcclusionFromMetallicTextureRed\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAmbientInGrayScale\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAutoMicroSurfaceFromReflectivityMap\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRMaterial.prototype, \"usePhysicalLightFalloff\", null);\r\n __decorate([\r\n serialize()\r\n ], PBRMaterial.prototype, \"useGLTFLightFalloff\", null);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRadianceOverAlpha\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useObjectSpaceNormalMap\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useParallax\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useParallaxOcclusion\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"parallaxScaleBias\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n ], PBRMaterial.prototype, \"disableLighting\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"forceIrradianceInFragment\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n ], PBRMaterial.prototype, \"maxSimultaneousLights\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"invertNormalMapX\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"invertNormalMapY\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"twoSidedLighting\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAlphaFresnel\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useLinearAlphaFresnel\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"environmentBRDFTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"forceNormalForward\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"enableSpecularAntiAliasing\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useHorizonOcclusion\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRadianceOcclusion\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRMaterial.prototype, \"unlit\", void 0);\r\n return PBRMaterial;\r\n}(PBRBaseMaterial));\r\nexport { PBRMaterial };\r\n_TypeStore.RegisteredTypes[\"BABYLON.PBRMaterial\"] = PBRMaterial;\r\n//# sourceMappingURL=pbrMaterial.js.map","import { __decorate } from \"tslib\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { serialize, SerializationHelper } from \"../Misc/decorators\";\r\nimport { _TypeStore } from '../Misc/typeStore';\r\n/**\r\n * Defines a target to use with MorphTargetManager\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_morphtargets\r\n */\r\nvar MorphTarget = /** @class */ (function () {\r\n /**\r\n * Creates a new MorphTarget\r\n * @param name defines the name of the target\r\n * @param influence defines the influence to use\r\n * @param scene defines the scene the morphtarget belongs to\r\n */\r\n function MorphTarget(\r\n /** defines the name of the target */\r\n name, influence, scene) {\r\n if (influence === void 0) { influence = 0; }\r\n if (scene === void 0) { scene = null; }\r\n this.name = name;\r\n /**\r\n * Gets or sets the list of animations\r\n */\r\n this.animations = new Array();\r\n this._positions = null;\r\n this._normals = null;\r\n this._tangents = null;\r\n this._uvs = null;\r\n this._uniqueId = 0;\r\n /**\r\n * Observable raised when the influence changes\r\n */\r\n this.onInfluenceChanged = new Observable();\r\n /** @hidden */\r\n this._onDataLayoutChanged = new Observable();\r\n this._animationPropertiesOverride = null;\r\n this._scene = scene || EngineStore.LastCreatedScene;\r\n this.influence = influence;\r\n if (this._scene) {\r\n this._uniqueId = this._scene.getUniqueId();\r\n }\r\n }\r\n Object.defineProperty(MorphTarget.prototype, \"influence\", {\r\n /**\r\n * Gets or sets the influence of this target (ie. its weight in the overall morphing)\r\n */\r\n get: function () {\r\n return this._influence;\r\n },\r\n set: function (influence) {\r\n if (this._influence === influence) {\r\n return;\r\n }\r\n var previous = this._influence;\r\n this._influence = influence;\r\n if (this.onInfluenceChanged.hasObservers()) {\r\n this.onInfluenceChanged.notifyObservers(previous === 0 || influence === 0);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n get: function () {\r\n if (!this._animationPropertiesOverride && this._scene) {\r\n return this._scene.animationPropertiesOverride;\r\n }\r\n return this._animationPropertiesOverride;\r\n },\r\n set: function (value) {\r\n this._animationPropertiesOverride = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"uniqueId\", {\r\n /**\r\n * Gets the unique ID of this manager\r\n */\r\n get: function () {\r\n return this._uniqueId;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasPositions\", {\r\n /**\r\n * Gets a boolean defining if the target contains position data\r\n */\r\n get: function () {\r\n return !!this._positions;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasNormals\", {\r\n /**\r\n * Gets a boolean defining if the target contains normal data\r\n */\r\n get: function () {\r\n return !!this._normals;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasTangents\", {\r\n /**\r\n * Gets a boolean defining if the target contains tangent data\r\n */\r\n get: function () {\r\n return !!this._tangents;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasUVs\", {\r\n /**\r\n * Gets a boolean defining if the target contains texture coordinates data\r\n */\r\n get: function () {\r\n return !!this._uvs;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Affects position data to this target\r\n * @param data defines the position data to use\r\n */\r\n MorphTarget.prototype.setPositions = function (data) {\r\n var hadPositions = this.hasPositions;\r\n this._positions = data;\r\n if (hadPositions !== this.hasPositions) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the position data stored in this target\r\n * @returns a FloatArray containing the position data (or null if not present)\r\n */\r\n MorphTarget.prototype.getPositions = function () {\r\n return this._positions;\r\n };\r\n /**\r\n * Affects normal data to this target\r\n * @param data defines the normal data to use\r\n */\r\n MorphTarget.prototype.setNormals = function (data) {\r\n var hadNormals = this.hasNormals;\r\n this._normals = data;\r\n if (hadNormals !== this.hasNormals) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the normal data stored in this target\r\n * @returns a FloatArray containing the normal data (or null if not present)\r\n */\r\n MorphTarget.prototype.getNormals = function () {\r\n return this._normals;\r\n };\r\n /**\r\n * Affects tangent data to this target\r\n * @param data defines the tangent data to use\r\n */\r\n MorphTarget.prototype.setTangents = function (data) {\r\n var hadTangents = this.hasTangents;\r\n this._tangents = data;\r\n if (hadTangents !== this.hasTangents) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the tangent data stored in this target\r\n * @returns a FloatArray containing the tangent data (or null if not present)\r\n */\r\n MorphTarget.prototype.getTangents = function () {\r\n return this._tangents;\r\n };\r\n /**\r\n * Affects texture coordinates data to this target\r\n * @param data defines the texture coordinates data to use\r\n */\r\n MorphTarget.prototype.setUVs = function (data) {\r\n var hadUVs = this.hasUVs;\r\n this._uvs = data;\r\n if (hadUVs !== this.hasUVs) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the texture coordinates data stored in this target\r\n * @returns a FloatArray containing the texture coordinates data (or null if not present)\r\n */\r\n MorphTarget.prototype.getUVs = function () {\r\n return this._uvs;\r\n };\r\n /**\r\n * Clone the current target\r\n * @returns a new MorphTarget\r\n */\r\n MorphTarget.prototype.clone = function () {\r\n var _this = this;\r\n var newOne = SerializationHelper.Clone(function () { return new MorphTarget(_this.name, _this.influence, _this._scene); }, this);\r\n newOne._positions = this._positions;\r\n newOne._normals = this._normals;\r\n newOne._tangents = this._tangents;\r\n newOne._uvs = this._uvs;\r\n return newOne;\r\n };\r\n /**\r\n * Serializes the current target into a Serialization object\r\n * @returns the serialized object\r\n */\r\n MorphTarget.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.influence = this.influence;\r\n serializationObject.positions = Array.prototype.slice.call(this.getPositions());\r\n if (this.id != null) {\r\n serializationObject.id = this.id;\r\n }\r\n if (this.hasNormals) {\r\n serializationObject.normals = Array.prototype.slice.call(this.getNormals());\r\n }\r\n if (this.hasTangents) {\r\n serializationObject.tangents = Array.prototype.slice.call(this.getTangents());\r\n }\r\n if (this.hasUVs) {\r\n serializationObject.uvs = Array.prototype.slice.call(this.getUVs());\r\n }\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n return serializationObject;\r\n };\r\n /**\r\n * Returns the string \"MorphTarget\"\r\n * @returns \"MorphTarget\"\r\n */\r\n MorphTarget.prototype.getClassName = function () {\r\n return \"MorphTarget\";\r\n };\r\n // Statics\r\n /**\r\n * Creates a new target from serialized data\r\n * @param serializationObject defines the serialized data to use\r\n * @returns a new MorphTarget\r\n */\r\n MorphTarget.Parse = function (serializationObject) {\r\n var result = new MorphTarget(serializationObject.name, serializationObject.influence);\r\n result.setPositions(serializationObject.positions);\r\n if (serializationObject.id != null) {\r\n result.id = serializationObject.id;\r\n }\r\n if (serializationObject.normals) {\r\n result.setNormals(serializationObject.normals);\r\n }\r\n if (serializationObject.tangents) {\r\n result.setTangents(serializationObject.tangents);\r\n }\r\n if (serializationObject.uvs) {\r\n result.setUVs(serializationObject.uvs);\r\n }\r\n // Animations\r\n if (serializationObject.animations) {\r\n for (var animationIndex = 0; animationIndex < serializationObject.animations.length; animationIndex++) {\r\n var parsedAnimation = serializationObject.animations[animationIndex];\r\n var internalClass = _TypeStore.GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n result.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n /**\r\n * Creates a MorphTarget from mesh data\r\n * @param mesh defines the source mesh\r\n * @param name defines the name to use for the new target\r\n * @param influence defines the influence to attach to the target\r\n * @returns a new MorphTarget\r\n */\r\n MorphTarget.FromMesh = function (mesh, name, influence) {\r\n if (!name) {\r\n name = mesh.name;\r\n }\r\n var result = new MorphTarget(name, influence, mesh.getScene());\r\n result.setPositions(mesh.getVerticesData(VertexBuffer.PositionKind));\r\n if (mesh.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n result.setNormals(mesh.getVerticesData(VertexBuffer.NormalKind));\r\n }\r\n if (mesh.isVerticesDataPresent(VertexBuffer.TangentKind)) {\r\n result.setTangents(mesh.getVerticesData(VertexBuffer.TangentKind));\r\n }\r\n if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n result.setUVs(mesh.getVerticesData(VertexBuffer.UVKind));\r\n }\r\n return result;\r\n };\r\n __decorate([\r\n serialize()\r\n ], MorphTarget.prototype, \"id\", void 0);\r\n return MorphTarget;\r\n}());\r\nexport { MorphTarget };\r\n//# sourceMappingURL=morphTarget.js.map","import { SmartArray } from \"../Misc/smartArray\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { MorphTarget } from \"./morphTarget\";\r\n/**\r\n * This class is used to deform meshes using morphing between different targets\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_morphtargets\r\n */\r\nvar MorphTargetManager = /** @class */ (function () {\r\n /**\r\n * Creates a new MorphTargetManager\r\n * @param scene defines the current scene\r\n */\r\n function MorphTargetManager(scene) {\r\n if (scene === void 0) { scene = null; }\r\n this._targets = new Array();\r\n this._targetInfluenceChangedObservers = new Array();\r\n this._targetDataLayoutChangedObservers = new Array();\r\n this._activeTargets = new SmartArray(16);\r\n this._supportsNormals = false;\r\n this._supportsTangents = false;\r\n this._supportsUVs = false;\r\n this._vertexCount = 0;\r\n this._uniqueId = 0;\r\n this._tempInfluences = new Array();\r\n /**\r\n * Gets or sets a boolean indicating if normals must be morphed\r\n */\r\n this.enableNormalMorphing = true;\r\n /**\r\n * Gets or sets a boolean indicating if tangents must be morphed\r\n */\r\n this.enableTangentMorphing = true;\r\n /**\r\n * Gets or sets a boolean indicating if UV must be morphed\r\n */\r\n this.enableUVMorphing = true;\r\n if (!scene) {\r\n scene = EngineStore.LastCreatedScene;\r\n }\r\n this._scene = scene;\r\n if (this._scene) {\r\n this._scene.morphTargetManagers.push(this);\r\n this._uniqueId = this._scene.getUniqueId();\r\n }\r\n }\r\n Object.defineProperty(MorphTargetManager.prototype, \"uniqueId\", {\r\n /**\r\n * Gets the unique ID of this manager\r\n */\r\n get: function () {\r\n return this._uniqueId;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"vertexCount\", {\r\n /**\r\n * Gets the number of vertices handled by this manager\r\n */\r\n get: function () {\r\n return this._vertexCount;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"supportsNormals\", {\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of normals\r\n */\r\n get: function () {\r\n return this._supportsNormals && this.enableNormalMorphing;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"supportsTangents\", {\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of tangents\r\n */\r\n get: function () {\r\n return this._supportsTangents && this.enableTangentMorphing;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"supportsUVs\", {\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of texture coordinates\r\n */\r\n get: function () {\r\n return this._supportsUVs && this.enableUVMorphing;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"numTargets\", {\r\n /**\r\n * Gets the number of targets stored in this manager\r\n */\r\n get: function () {\r\n return this._targets.length;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"numInfluencers\", {\r\n /**\r\n * Gets the number of influencers (ie. the number of targets with influences > 0)\r\n */\r\n get: function () {\r\n return this._activeTargets.length;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"influences\", {\r\n /**\r\n * Gets the list of influences (one per target)\r\n */\r\n get: function () {\r\n return this._influences;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the active target at specified index. An active target is a target with an influence > 0\r\n * @param index defines the index to check\r\n * @returns the requested target\r\n */\r\n MorphTargetManager.prototype.getActiveTarget = function (index) {\r\n return this._activeTargets.data[index];\r\n };\r\n /**\r\n * Gets the target at specified index\r\n * @param index defines the index to check\r\n * @returns the requested target\r\n */\r\n MorphTargetManager.prototype.getTarget = function (index) {\r\n return this._targets[index];\r\n };\r\n /**\r\n * Add a new target to this manager\r\n * @param target defines the target to add\r\n */\r\n MorphTargetManager.prototype.addTarget = function (target) {\r\n var _this = this;\r\n this._targets.push(target);\r\n this._targetInfluenceChangedObservers.push(target.onInfluenceChanged.add(function (needUpdate) {\r\n _this._syncActiveTargets(needUpdate);\r\n }));\r\n this._targetDataLayoutChangedObservers.push(target._onDataLayoutChanged.add(function () {\r\n _this._syncActiveTargets(true);\r\n }));\r\n this._syncActiveTargets(true);\r\n };\r\n /**\r\n * Removes a target from the manager\r\n * @param target defines the target to remove\r\n */\r\n MorphTargetManager.prototype.removeTarget = function (target) {\r\n var index = this._targets.indexOf(target);\r\n if (index >= 0) {\r\n this._targets.splice(index, 1);\r\n target.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(index, 1)[0]);\r\n target._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(index, 1)[0]);\r\n this._syncActiveTargets(true);\r\n }\r\n };\r\n /**\r\n * Clone the current manager\r\n * @returns a new MorphTargetManager\r\n */\r\n MorphTargetManager.prototype.clone = function () {\r\n var copy = new MorphTargetManager(this._scene);\r\n for (var _i = 0, _a = this._targets; _i < _a.length; _i++) {\r\n var target = _a[_i];\r\n copy.addTarget(target.clone());\r\n }\r\n copy.enableNormalMorphing = this.enableNormalMorphing;\r\n copy.enableTangentMorphing = this.enableTangentMorphing;\r\n copy.enableUVMorphing = this.enableUVMorphing;\r\n return copy;\r\n };\r\n /**\r\n * Serializes the current manager into a Serialization object\r\n * @returns the serialized object\r\n */\r\n MorphTargetManager.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.id = this.uniqueId;\r\n serializationObject.targets = [];\r\n for (var _i = 0, _a = this._targets; _i < _a.length; _i++) {\r\n var target = _a[_i];\r\n serializationObject.targets.push(target.serialize());\r\n }\r\n return serializationObject;\r\n };\r\n MorphTargetManager.prototype._syncActiveTargets = function (needUpdate) {\r\n var influenceCount = 0;\r\n this._activeTargets.reset();\r\n this._supportsNormals = true;\r\n this._supportsTangents = true;\r\n this._supportsUVs = true;\r\n this._vertexCount = 0;\r\n for (var _i = 0, _a = this._targets; _i < _a.length; _i++) {\r\n var target = _a[_i];\r\n if (target.influence === 0) {\r\n continue;\r\n }\r\n this._activeTargets.push(target);\r\n this._tempInfluences[influenceCount++] = target.influence;\r\n this._supportsNormals = this._supportsNormals && target.hasNormals;\r\n this._supportsTangents = this._supportsTangents && target.hasTangents;\r\n this._supportsUVs = this._supportsUVs && target.hasUVs;\r\n var positions = target.getPositions();\r\n if (positions) {\r\n var vertexCount = positions.length / 3;\r\n if (this._vertexCount === 0) {\r\n this._vertexCount = vertexCount;\r\n }\r\n else if (this._vertexCount !== vertexCount) {\r\n Logger.Error(\"Incompatible target. Targets must all have the same vertices count.\");\r\n return;\r\n }\r\n }\r\n }\r\n if (!this._influences || this._influences.length !== influenceCount) {\r\n this._influences = new Float32Array(influenceCount);\r\n }\r\n for (var index = 0; index < influenceCount; index++) {\r\n this._influences[index] = this._tempInfluences[index];\r\n }\r\n if (needUpdate) {\r\n this.synchronize();\r\n }\r\n };\r\n /**\r\n * Syncrhonize the targets with all the meshes using this morph target manager\r\n */\r\n MorphTargetManager.prototype.synchronize = function () {\r\n if (!this._scene) {\r\n return;\r\n }\r\n // Flag meshes as dirty to resync with the active targets\r\n for (var _i = 0, _a = this._scene.meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n if (mesh.morphTargetManager === this) {\r\n mesh._syncGeometryWithMorphTargetManager();\r\n }\r\n }\r\n };\r\n // Statics\r\n /**\r\n * Creates a new MorphTargetManager from serialized data\r\n * @param serializationObject defines the serialized data\r\n * @param scene defines the hosting scene\r\n * @returns the new MorphTargetManager\r\n */\r\n MorphTargetManager.Parse = function (serializationObject, scene) {\r\n var result = new MorphTargetManager(scene);\r\n result._uniqueId = serializationObject.id;\r\n for (var _i = 0, _a = serializationObject.targets; _i < _a.length; _i++) {\r\n var targetData = _a[_i];\r\n result.addTarget(MorphTarget.Parse(targetData));\r\n }\r\n return result;\r\n };\r\n return MorphTargetManager;\r\n}());\r\nexport { MorphTargetManager };\r\n//# sourceMappingURL=morphTargetManager.js.map","import { Deferred } from \"@babylonjs/core/Misc/deferred\";\r\nimport { Quaternion, Vector3, Matrix } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Camera } from \"@babylonjs/core/Cameras/camera\";\r\nimport { FreeCamera } from \"@babylonjs/core/Cameras/freeCamera\";\r\nimport { AnimationGroup } from \"@babylonjs/core/Animations/animationGroup\";\r\nimport { Animation } from \"@babylonjs/core/Animations/animation\";\r\nimport { Bone } from \"@babylonjs/core/Bones/bone\";\r\nimport { Skeleton } from \"@babylonjs/core/Bones/skeleton\";\r\nimport { Material } from \"@babylonjs/core/Materials/material\";\r\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\r\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\r\nimport { Buffer, VertexBuffer } from \"@babylonjs/core/Meshes/buffer\";\r\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { MorphTarget } from \"@babylonjs/core/Morph/morphTarget\";\r\nimport { MorphTargetManager } from \"@babylonjs/core/Morph/morphTargetManager\";\r\nimport { GLTFFileLoader, GLTFLoaderState, GLTFLoaderCoordinateSystemMode, GLTFLoaderAnimationStartMode } from \"../glTFFileLoader\";\r\nimport { AnimationKeyInterpolation } from '@babylonjs/core/Animations/animationKey';\r\nimport { LoadFileError } from '@babylonjs/core/Misc/fileTools';\r\nimport { Logger } from '@babylonjs/core/Misc/logger';\r\nimport { TmpVectors } from '@babylonjs/core/Maths/math.vector';\r\nimport { BoundingInfo } from '@babylonjs/core/Culling/boundingInfo';\r\n/**\r\n * Helper class for working with arrays when loading the glTF asset\r\n */\r\nvar ArrayItem = /** @class */ (function () {\r\n function ArrayItem() {\r\n }\r\n /**\r\n * Gets an item from the given array.\r\n * @param context The context when loading the asset\r\n * @param array The array to get the item from\r\n * @param index The index to the array\r\n * @returns The array item\r\n */\r\n ArrayItem.Get = function (context, array, index) {\r\n if (!array || index == undefined || !array[index]) {\r\n throw new Error(context + \": Failed to find index (\" + index + \")\");\r\n }\r\n return array[index];\r\n };\r\n /**\r\n * Assign an `index` field to each item of the given array.\r\n * @param array The array of items\r\n */\r\n ArrayItem.Assign = function (array) {\r\n if (array) {\r\n for (var index = 0; index < array.length; index++) {\r\n array[index].index = index;\r\n }\r\n }\r\n };\r\n return ArrayItem;\r\n}());\r\nexport { ArrayItem };\r\n/**\r\n * The glTF 2.0 loader\r\n */\r\nvar GLTFLoader = /** @class */ (function () {\r\n /** @hidden */\r\n function GLTFLoader(parent) {\r\n /** @hidden */\r\n this._completePromises = new Array();\r\n /** @hidden */\r\n this._forAssetContainer = false;\r\n /** Storage */\r\n this._babylonLights = [];\r\n /** @hidden */\r\n this._disableInstancedMesh = 0;\r\n this._disposed = false;\r\n this._state = null;\r\n this._extensions = new Array();\r\n this._defaultBabylonMaterialData = {};\r\n this._parent = parent;\r\n }\r\n /**\r\n * Registers a loader extension.\r\n * @param name The name of the loader extension.\r\n * @param factory The factory function that creates the loader extension.\r\n */\r\n GLTFLoader.RegisterExtension = function (name, factory) {\r\n if (GLTFLoader.UnregisterExtension(name)) {\r\n Logger.Warn(\"Extension with the name '\" + name + \"' already exists\");\r\n }\r\n GLTFLoader._RegisteredExtensions[name] = {\r\n factory: factory\r\n };\r\n };\r\n /**\r\n * Unregisters a loader extension.\r\n * @param name The name of the loader extension.\r\n * @returns A boolean indicating whether the extension has been unregistered\r\n */\r\n GLTFLoader.UnregisterExtension = function (name) {\r\n if (!GLTFLoader._RegisteredExtensions[name]) {\r\n return false;\r\n }\r\n delete GLTFLoader._RegisteredExtensions[name];\r\n return true;\r\n };\r\n Object.defineProperty(GLTFLoader.prototype, \"state\", {\r\n /**\r\n * The loader state.\r\n */\r\n get: function () {\r\n return this._state;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFLoader.prototype, \"gltf\", {\r\n /**\r\n * The object that represents the glTF JSON.\r\n */\r\n get: function () {\r\n return this._gltf;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFLoader.prototype, \"bin\", {\r\n /**\r\n * The BIN chunk of a binary glTF.\r\n */\r\n get: function () {\r\n return this._bin;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFLoader.prototype, \"parent\", {\r\n /**\r\n * The parent file loader.\r\n */\r\n get: function () {\r\n return this._parent;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFLoader.prototype, \"babylonScene\", {\r\n /**\r\n * The Babylon scene when loading the asset.\r\n */\r\n get: function () {\r\n return this._babylonScene;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFLoader.prototype, \"rootBabylonMesh\", {\r\n /**\r\n * The root Babylon mesh when loading the asset.\r\n */\r\n get: function () {\r\n return this._rootBabylonMesh;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n GLTFLoader.prototype.dispose = function () {\r\n if (this._disposed) {\r\n return;\r\n }\r\n this._disposed = true;\r\n this._completePromises.length = 0;\r\n for (var name_1 in this._extensions) {\r\n var extension = this._extensions[name_1];\r\n extension.dispose && extension.dispose();\r\n delete this._extensions[name_1];\r\n }\r\n this._gltf = null;\r\n this._babylonScene = null;\r\n this._rootBabylonMesh = null;\r\n this._parent.dispose();\r\n };\r\n /** @hidden */\r\n GLTFLoader.prototype.importMeshAsync = function (meshesNames, scene, forAssetContainer, data, rootUrl, onProgress, fileName) {\r\n var _this = this;\r\n return Promise.resolve().then(function () {\r\n _this._babylonScene = scene;\r\n _this._rootUrl = rootUrl;\r\n _this._fileName = fileName || \"scene\";\r\n _this._forAssetContainer = forAssetContainer;\r\n _this._loadData(data);\r\n var nodes = null;\r\n if (meshesNames) {\r\n var nodeMap_1 = {};\r\n if (_this._gltf.nodes) {\r\n for (var _i = 0, _a = _this._gltf.nodes; _i < _a.length; _i++) {\r\n var node = _a[_i];\r\n if (node.name) {\r\n nodeMap_1[node.name] = node.index;\r\n }\r\n }\r\n }\r\n var names = (meshesNames instanceof Array) ? meshesNames : [meshesNames];\r\n nodes = names.map(function (name) {\r\n var node = nodeMap_1[name];\r\n if (node === undefined) {\r\n throw new Error(\"Failed to find node '\" + name + \"'\");\r\n }\r\n return node;\r\n });\r\n }\r\n return _this._loadAsync(nodes, function () {\r\n return {\r\n meshes: _this._getMeshes(),\r\n particleSystems: [],\r\n skeletons: _this._getSkeletons(),\r\n animationGroups: _this._getAnimationGroups(),\r\n lights: _this._babylonLights,\r\n transformNodes: _this._getTransformNodes(),\r\n geometries: _this._getGeometries()\r\n };\r\n });\r\n });\r\n };\r\n /** @hidden */\r\n GLTFLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress, fileName) {\r\n var _this = this;\r\n return Promise.resolve().then(function () {\r\n _this._babylonScene = scene;\r\n _this._rootUrl = rootUrl;\r\n _this._fileName = fileName || \"scene\";\r\n _this._loadData(data);\r\n return _this._loadAsync(null, function () { return undefined; });\r\n });\r\n };\r\n GLTFLoader.prototype._loadAsync = function (nodes, resultFunc) {\r\n var _this = this;\r\n return Promise.resolve().then(function () {\r\n _this._uniqueRootUrl = (_this._rootUrl.indexOf(\"file:\") === -1 && _this._fileName) ? _this._rootUrl : \"\" + _this._rootUrl + Date.now() + \"/\";\r\n _this._loadExtensions();\r\n _this._checkExtensions();\r\n var loadingToReadyCounterName = GLTFLoaderState[GLTFLoaderState.LOADING] + \" => \" + GLTFLoaderState[GLTFLoaderState.READY];\r\n var loadingToCompleteCounterName = GLTFLoaderState[GLTFLoaderState.LOADING] + \" => \" + GLTFLoaderState[GLTFLoaderState.COMPLETE];\r\n _this._parent._startPerformanceCounter(loadingToReadyCounterName);\r\n _this._parent._startPerformanceCounter(loadingToCompleteCounterName);\r\n _this._setState(GLTFLoaderState.LOADING);\r\n _this._extensionsOnLoading();\r\n var promises = new Array();\r\n // Block the marking of materials dirty until the scene is loaded.\r\n var oldBlockMaterialDirtyMechanism = _this._babylonScene.blockMaterialDirtyMechanism;\r\n _this._babylonScene.blockMaterialDirtyMechanism = true;\r\n if (nodes) {\r\n promises.push(_this.loadSceneAsync(\"/nodes\", { nodes: nodes, index: -1 }));\r\n }\r\n else if (_this._gltf.scene != undefined || (_this._gltf.scenes && _this._gltf.scenes[0])) {\r\n var scene = ArrayItem.Get(\"/scene\", _this._gltf.scenes, _this._gltf.scene || 0);\r\n promises.push(_this.loadSceneAsync(\"/scenes/\" + scene.index, scene));\r\n }\r\n if (_this.parent.loadAllMaterials && _this._gltf.materials) {\r\n for (var m = 0; m < _this._gltf.materials.length; ++m) {\r\n var material = _this._gltf.materials[m];\r\n var context_1 = \"/materials/\" + m;\r\n var babylonDrawMode = Material.TriangleFillMode;\r\n promises.push(_this._loadMaterialAsync(context_1, material, null, babylonDrawMode, function (material) { }));\r\n }\r\n }\r\n // Restore the blocking of material dirty.\r\n _this._babylonScene.blockMaterialDirtyMechanism = oldBlockMaterialDirtyMechanism;\r\n if (_this._parent.compileMaterials) {\r\n promises.push(_this._compileMaterialsAsync());\r\n }\r\n if (_this._parent.compileShadowGenerators) {\r\n promises.push(_this._compileShadowGeneratorsAsync());\r\n }\r\n var resultPromise = Promise.all(promises).then(function () {\r\n if (_this._rootBabylonMesh) {\r\n _this._rootBabylonMesh.setEnabled(true);\r\n }\r\n _this._extensionsOnReady();\r\n _this._setState(GLTFLoaderState.READY);\r\n _this._startAnimations();\r\n return resultFunc();\r\n });\r\n resultPromise.then(function () {\r\n _this._parent._endPerformanceCounter(loadingToReadyCounterName);\r\n Tools.SetImmediate(function () {\r\n if (!_this._disposed) {\r\n Promise.all(_this._completePromises).then(function () {\r\n _this._parent._endPerformanceCounter(loadingToCompleteCounterName);\r\n _this._setState(GLTFLoaderState.COMPLETE);\r\n _this._parent.onCompleteObservable.notifyObservers(undefined);\r\n _this._parent.onCompleteObservable.clear();\r\n _this.dispose();\r\n }, function (error) {\r\n _this._parent.onErrorObservable.notifyObservers(error);\r\n _this._parent.onErrorObservable.clear();\r\n _this.dispose();\r\n });\r\n }\r\n });\r\n });\r\n return resultPromise;\r\n }).catch(function (error) {\r\n if (!_this._disposed) {\r\n _this._parent.onErrorObservable.notifyObservers(error);\r\n _this._parent.onErrorObservable.clear();\r\n _this.dispose();\r\n }\r\n throw error;\r\n });\r\n };\r\n GLTFLoader.prototype._loadData = function (data) {\r\n this._gltf = data.json;\r\n this._setupData();\r\n if (data.bin) {\r\n var buffers = this._gltf.buffers;\r\n if (buffers && buffers[0] && !buffers[0].uri) {\r\n var binaryBuffer = buffers[0];\r\n if (binaryBuffer.byteLength < data.bin.byteLength - 3 || binaryBuffer.byteLength > data.bin.byteLength) {\r\n Logger.Warn(\"Binary buffer length (\" + binaryBuffer.byteLength + \") from JSON does not match chunk length (\" + data.bin.byteLength + \")\");\r\n }\r\n this._bin = data.bin;\r\n }\r\n else {\r\n Logger.Warn(\"Unexpected BIN chunk\");\r\n }\r\n }\r\n };\r\n GLTFLoader.prototype._setupData = function () {\r\n ArrayItem.Assign(this._gltf.accessors);\r\n ArrayItem.Assign(this._gltf.animations);\r\n ArrayItem.Assign(this._gltf.buffers);\r\n ArrayItem.Assign(this._gltf.bufferViews);\r\n ArrayItem.Assign(this._gltf.cameras);\r\n ArrayItem.Assign(this._gltf.images);\r\n ArrayItem.Assign(this._gltf.materials);\r\n ArrayItem.Assign(this._gltf.meshes);\r\n ArrayItem.Assign(this._gltf.nodes);\r\n ArrayItem.Assign(this._gltf.samplers);\r\n ArrayItem.Assign(this._gltf.scenes);\r\n ArrayItem.Assign(this._gltf.skins);\r\n ArrayItem.Assign(this._gltf.textures);\r\n if (this._gltf.nodes) {\r\n var nodeParents = {};\r\n for (var _i = 0, _a = this._gltf.nodes; _i < _a.length; _i++) {\r\n var node = _a[_i];\r\n if (node.children) {\r\n for (var _b = 0, _c = node.children; _b < _c.length; _b++) {\r\n var index = _c[_b];\r\n nodeParents[index] = node.index;\r\n }\r\n }\r\n }\r\n var rootNode = this._createRootNode();\r\n for (var _d = 0, _e = this._gltf.nodes; _d < _e.length; _d++) {\r\n var node = _e[_d];\r\n var parentIndex = nodeParents[node.index];\r\n node.parent = parentIndex === undefined ? rootNode : this._gltf.nodes[parentIndex];\r\n }\r\n }\r\n };\r\n GLTFLoader.prototype._loadExtensions = function () {\r\n for (var name_2 in GLTFLoader._RegisteredExtensions) {\r\n var extension = GLTFLoader._RegisteredExtensions[name_2].factory(this);\r\n if (extension.name !== name_2) {\r\n Logger.Warn(\"The name of the glTF loader extension instance does not match the registered name: \" + extension.name + \" !== \" + name_2);\r\n }\r\n this._extensions.push(extension);\r\n this._parent.onExtensionLoadedObservable.notifyObservers(extension);\r\n }\r\n this._extensions.sort(function (a, b) { return (a.order || Number.MAX_VALUE) - (b.order || Number.MAX_VALUE); });\r\n this._parent.onExtensionLoadedObservable.clear();\r\n };\r\n GLTFLoader.prototype._checkExtensions = function () {\r\n if (this._gltf.extensionsRequired) {\r\n var _loop_1 = function (name_3) {\r\n var available = this_1._extensions.some(function (extension) { return extension.name === name_3 && extension.enabled; });\r\n if (!available) {\r\n throw new Error(\"Require extension \" + name_3 + \" is not available\");\r\n }\r\n };\r\n var this_1 = this;\r\n for (var _i = 0, _a = this._gltf.extensionsRequired; _i < _a.length; _i++) {\r\n var name_3 = _a[_i];\r\n _loop_1(name_3);\r\n }\r\n }\r\n };\r\n GLTFLoader.prototype._setState = function (state) {\r\n this._state = state;\r\n this.log(GLTFLoaderState[this._state]);\r\n };\r\n GLTFLoader.prototype._createRootNode = function () {\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n this._rootBabylonMesh = new Mesh(\"__root__\", this._babylonScene);\r\n this._babylonScene._blockEntityCollection = false;\r\n this._rootBabylonMesh.setEnabled(false);\r\n var rootNode = {\r\n _babylonTransformNode: this._rootBabylonMesh,\r\n index: -1\r\n };\r\n switch (this._parent.coordinateSystemMode) {\r\n case GLTFLoaderCoordinateSystemMode.AUTO: {\r\n if (!this._babylonScene.useRightHandedSystem) {\r\n rootNode.rotation = [0, 1, 0, 0];\r\n rootNode.scale = [1, 1, -1];\r\n GLTFLoader._LoadTransform(rootNode, this._rootBabylonMesh);\r\n }\r\n break;\r\n }\r\n case GLTFLoaderCoordinateSystemMode.FORCE_RIGHT_HANDED: {\r\n this._babylonScene.useRightHandedSystem = true;\r\n break;\r\n }\r\n default: {\r\n throw new Error(\"Invalid coordinate system mode (\" + this._parent.coordinateSystemMode + \")\");\r\n }\r\n }\r\n this._parent.onMeshLoadedObservable.notifyObservers(this._rootBabylonMesh);\r\n return rootNode;\r\n };\r\n /**\r\n * Loads a glTF scene.\r\n * @param context The context when loading the asset\r\n * @param scene The glTF scene property\r\n * @returns A promise that resolves when the load is complete\r\n */\r\n GLTFLoader.prototype.loadSceneAsync = function (context, scene) {\r\n var _this = this;\r\n var extensionPromise = this._extensionsLoadSceneAsync(context, scene);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n var promises = new Array();\r\n this.logOpen(context + \" \" + (scene.name || \"\"));\r\n if (scene.nodes) {\r\n for (var _i = 0, _a = scene.nodes; _i < _a.length; _i++) {\r\n var index = _a[_i];\r\n var node = ArrayItem.Get(context + \"/nodes/\" + index, this._gltf.nodes, index);\r\n promises.push(this.loadNodeAsync(\"/nodes/\" + node.index, node, function (babylonMesh) {\r\n babylonMesh.parent = _this._rootBabylonMesh;\r\n }));\r\n }\r\n }\r\n // Link all Babylon bones for each glTF node with the corresponding Babylon transform node.\r\n // A glTF joint is a pointer to a glTF node in the glTF node hierarchy similar to Unity3D.\r\n if (this._gltf.nodes) {\r\n for (var _b = 0, _c = this._gltf.nodes; _b < _c.length; _b++) {\r\n var node = _c[_b];\r\n if (node._babylonTransformNode && node._babylonBones) {\r\n for (var _d = 0, _e = node._babylonBones; _d < _e.length; _d++) {\r\n var babylonBone = _e[_d];\r\n babylonBone.linkTransformNode(node._babylonTransformNode);\r\n }\r\n }\r\n }\r\n }\r\n promises.push(this._loadAnimationsAsync());\r\n this.logClose();\r\n return Promise.all(promises).then(function () { });\r\n };\r\n GLTFLoader.prototype._forEachPrimitive = function (node, callback) {\r\n if (node._primitiveBabylonMeshes) {\r\n for (var _i = 0, _a = node._primitiveBabylonMeshes; _i < _a.length; _i++) {\r\n var babylonMesh = _a[_i];\r\n callback(babylonMesh);\r\n }\r\n }\r\n };\r\n GLTFLoader.prototype._getGeometries = function () {\r\n var geometries = new Array();\r\n var nodes = this._gltf.nodes;\r\n if (nodes) {\r\n for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {\r\n var node = nodes_1[_i];\r\n this._forEachPrimitive(node, function (babylonMesh) {\r\n var geometry = babylonMesh.geometry;\r\n if (geometry && geometries.indexOf(geometry) === -1) {\r\n geometries.push(geometry);\r\n }\r\n });\r\n }\r\n }\r\n return geometries;\r\n };\r\n GLTFLoader.prototype._getMeshes = function () {\r\n var meshes = new Array();\r\n // Root mesh is always first.\r\n meshes.push(this._rootBabylonMesh);\r\n var nodes = this._gltf.nodes;\r\n if (nodes) {\r\n for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {\r\n var node = nodes_2[_i];\r\n this._forEachPrimitive(node, function (babylonMesh) {\r\n meshes.push(babylonMesh);\r\n });\r\n }\r\n }\r\n return meshes;\r\n };\r\n GLTFLoader.prototype._getTransformNodes = function () {\r\n var transformNodes = new Array();\r\n var nodes = this._gltf.nodes;\r\n if (nodes) {\r\n for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {\r\n var node = nodes_3[_i];\r\n if (node._babylonTransformNode && node._babylonTransformNode.getClassName() === \"TransformNode\") {\r\n transformNodes.push(node._babylonTransformNode);\r\n }\r\n }\r\n }\r\n return transformNodes;\r\n };\r\n GLTFLoader.prototype._getSkeletons = function () {\r\n var skeletons = new Array();\r\n var skins = this._gltf.skins;\r\n if (skins) {\r\n for (var _i = 0, skins_1 = skins; _i < skins_1.length; _i++) {\r\n var skin = skins_1[_i];\r\n if (skin._data) {\r\n skeletons.push(skin._data.babylonSkeleton);\r\n }\r\n }\r\n }\r\n return skeletons;\r\n };\r\n GLTFLoader.prototype._getAnimationGroups = function () {\r\n var animationGroups = new Array();\r\n var animations = this._gltf.animations;\r\n if (animations) {\r\n for (var _i = 0, animations_1 = animations; _i < animations_1.length; _i++) {\r\n var animation = animations_1[_i];\r\n if (animation._babylonAnimationGroup) {\r\n animationGroups.push(animation._babylonAnimationGroup);\r\n }\r\n }\r\n }\r\n return animationGroups;\r\n };\r\n GLTFLoader.prototype._startAnimations = function () {\r\n switch (this._parent.animationStartMode) {\r\n case GLTFLoaderAnimationStartMode.NONE: {\r\n // do nothing\r\n break;\r\n }\r\n case GLTFLoaderAnimationStartMode.FIRST: {\r\n var babylonAnimationGroups = this._getAnimationGroups();\r\n if (babylonAnimationGroups.length !== 0) {\r\n babylonAnimationGroups[0].start(true);\r\n }\r\n break;\r\n }\r\n case GLTFLoaderAnimationStartMode.ALL: {\r\n var babylonAnimationGroups = this._getAnimationGroups();\r\n for (var _i = 0, babylonAnimationGroups_1 = babylonAnimationGroups; _i < babylonAnimationGroups_1.length; _i++) {\r\n var babylonAnimationGroup = babylonAnimationGroups_1[_i];\r\n babylonAnimationGroup.start(true);\r\n }\r\n break;\r\n }\r\n default: {\r\n Logger.Error(\"Invalid animation start mode (\" + this._parent.animationStartMode + \")\");\r\n return;\r\n }\r\n }\r\n };\r\n /**\r\n * Loads a glTF node.\r\n * @param context The context when loading the asset\r\n * @param node The glTF node property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon mesh when the load is complete\r\n */\r\n GLTFLoader.prototype.loadNodeAsync = function (context, node, assign) {\r\n var _this = this;\r\n if (assign === void 0) { assign = function () { }; }\r\n var extensionPromise = this._extensionsLoadNodeAsync(context, node, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n if (node._babylonTransformNode) {\r\n throw new Error(context + \": Invalid recursive node hierarchy\");\r\n }\r\n var promises = new Array();\r\n this.logOpen(context + \" \" + (node.name || \"\"));\r\n var loadNode = function (babylonTransformNode) {\r\n GLTFLoader.AddPointerMetadata(babylonTransformNode, context);\r\n GLTFLoader._LoadTransform(node, babylonTransformNode);\r\n if (node.camera != undefined) {\r\n var camera = ArrayItem.Get(context + \"/camera\", _this._gltf.cameras, node.camera);\r\n promises.push(_this.loadCameraAsync(\"/cameras/\" + camera.index, camera, function (babylonCamera) {\r\n babylonCamera.parent = babylonTransformNode;\r\n }));\r\n }\r\n if (node.children) {\r\n for (var _i = 0, _a = node.children; _i < _a.length; _i++) {\r\n var index = _a[_i];\r\n var childNode = ArrayItem.Get(context + \"/children/\" + index, _this._gltf.nodes, index);\r\n promises.push(_this.loadNodeAsync(\"/nodes/\" + childNode.index, childNode, function (childBabylonMesh) {\r\n childBabylonMesh.parent = babylonTransformNode;\r\n }));\r\n }\r\n }\r\n assign(babylonTransformNode);\r\n };\r\n if (node.mesh == undefined) {\r\n var nodeName = node.name || \"node\" + node.index;\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n node._babylonTransformNode = new TransformNode(nodeName, this._babylonScene);\r\n this._babylonScene._blockEntityCollection = false;\r\n loadNode(node._babylonTransformNode);\r\n }\r\n else {\r\n var mesh = ArrayItem.Get(context + \"/mesh\", this._gltf.meshes, node.mesh);\r\n promises.push(this._loadMeshAsync(\"/meshes/\" + mesh.index, node, mesh, loadNode));\r\n }\r\n this.logClose();\r\n return Promise.all(promises).then(function () {\r\n _this._forEachPrimitive(node, function (babylonMesh) {\r\n if (babylonMesh.geometry && babylonMesh.geometry.useBoundingInfoFromGeometry) {\r\n // simply apply the world matrices to the bounding info - the extends are already ok\r\n babylonMesh._updateBoundingInfo();\r\n }\r\n else {\r\n babylonMesh.refreshBoundingInfo(true);\r\n }\r\n });\r\n return node._babylonTransformNode;\r\n });\r\n };\r\n GLTFLoader.prototype._loadMeshAsync = function (context, node, mesh, assign) {\r\n var primitives = mesh.primitives;\r\n if (!primitives || !primitives.length) {\r\n throw new Error(context + \": Primitives are missing\");\r\n }\r\n if (primitives[0].index == undefined) {\r\n ArrayItem.Assign(primitives);\r\n }\r\n var promises = new Array();\r\n this.logOpen(context + \" \" + (mesh.name || \"\"));\r\n var name = node.name || \"node\" + node.index;\r\n if (primitives.length === 1) {\r\n var primitive = mesh.primitives[0];\r\n promises.push(this._loadMeshPrimitiveAsync(context + \"/primitives/\" + primitive.index, name, node, mesh, primitive, function (babylonMesh) {\r\n node._babylonTransformNode = babylonMesh;\r\n node._primitiveBabylonMeshes = [babylonMesh];\r\n }));\r\n }\r\n else {\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n node._babylonTransformNode = new TransformNode(name, this._babylonScene);\r\n this._babylonScene._blockEntityCollection = false;\r\n node._primitiveBabylonMeshes = [];\r\n for (var _i = 0, primitives_1 = primitives; _i < primitives_1.length; _i++) {\r\n var primitive = primitives_1[_i];\r\n promises.push(this._loadMeshPrimitiveAsync(context + \"/primitives/\" + primitive.index, name + \"_primitive\" + primitive.index, node, mesh, primitive, function (babylonMesh) {\r\n babylonMesh.parent = node._babylonTransformNode;\r\n node._primitiveBabylonMeshes.push(babylonMesh);\r\n }));\r\n }\r\n }\r\n if (node.skin != undefined) {\r\n var skin = ArrayItem.Get(context + \"/skin\", this._gltf.skins, node.skin);\r\n promises.push(this._loadSkinAsync(\"/skins/\" + skin.index, node, skin));\r\n }\r\n assign(node._babylonTransformNode);\r\n this.logClose();\r\n return Promise.all(promises).then(function () {\r\n return node._babylonTransformNode;\r\n });\r\n };\r\n /**\r\n * @hidden Define this method to modify the default behavior when loading data for mesh primitives.\r\n * @param context The context when loading the asset\r\n * @param name The mesh name when loading the asset\r\n * @param node The glTF node when loading the asset\r\n * @param mesh The glTF mesh when loading the asset\r\n * @param primitive The glTF mesh primitive property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled\r\n */\r\n GLTFLoader.prototype._loadMeshPrimitiveAsync = function (context, name, node, mesh, primitive, assign) {\r\n var _this = this;\r\n var extensionPromise = this._extensionsLoadMeshPrimitiveAsync(context, name, node, mesh, primitive, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n this.logOpen(\"\" + context);\r\n var shouldInstance = (this._disableInstancedMesh === 0) && this._parent.createInstances && (node.skin == undefined && !mesh.primitives[0].targets);\r\n var babylonAbstractMesh;\r\n var promise;\r\n if (shouldInstance && primitive._instanceData) {\r\n babylonAbstractMesh = primitive._instanceData.babylonSourceMesh.createInstance(name);\r\n promise = primitive._instanceData.promise;\r\n }\r\n else {\r\n var promises = new Array();\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n var babylonMesh_1 = new Mesh(name, this._babylonScene);\r\n this._babylonScene._blockEntityCollection = false;\r\n babylonMesh_1.overrideMaterialSideOrientation = this._babylonScene.useRightHandedSystem ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\r\n this._createMorphTargets(context, node, mesh, primitive, babylonMesh_1);\r\n promises.push(this._loadVertexDataAsync(context, primitive, babylonMesh_1).then(function (babylonGeometry) {\r\n return _this._loadMorphTargetsAsync(context, primitive, babylonMesh_1, babylonGeometry).then(function () {\r\n _this._babylonScene._blockEntityCollection = _this._forAssetContainer;\r\n babylonGeometry.applyToMesh(babylonMesh_1);\r\n _this._babylonScene._blockEntityCollection = false;\r\n });\r\n }));\r\n var babylonDrawMode = GLTFLoader._GetDrawMode(context, primitive.mode);\r\n if (primitive.material == undefined) {\r\n var babylonMaterial = this._defaultBabylonMaterialData[babylonDrawMode];\r\n if (!babylonMaterial) {\r\n babylonMaterial = this._createDefaultMaterial(\"__GLTFLoader._default\", babylonDrawMode);\r\n this._parent.onMaterialLoadedObservable.notifyObservers(babylonMaterial);\r\n this._defaultBabylonMaterialData[babylonDrawMode] = babylonMaterial;\r\n }\r\n babylonMesh_1.material = babylonMaterial;\r\n }\r\n else {\r\n var material = ArrayItem.Get(context + \"/material\", this._gltf.materials, primitive.material);\r\n promises.push(this._loadMaterialAsync(\"/materials/\" + material.index, material, babylonMesh_1, babylonDrawMode, function (babylonMaterial) {\r\n babylonMesh_1.material = babylonMaterial;\r\n }));\r\n }\r\n promise = Promise.all(promises);\r\n if (shouldInstance) {\r\n primitive._instanceData = {\r\n babylonSourceMesh: babylonMesh_1,\r\n promise: promise\r\n };\r\n }\r\n babylonAbstractMesh = babylonMesh_1;\r\n }\r\n GLTFLoader.AddPointerMetadata(babylonAbstractMesh, context);\r\n this._parent.onMeshLoadedObservable.notifyObservers(babylonAbstractMesh);\r\n assign(babylonAbstractMesh);\r\n this.logClose();\r\n return promise.then(function () {\r\n return babylonAbstractMesh;\r\n });\r\n };\r\n GLTFLoader.prototype._loadVertexDataAsync = function (context, primitive, babylonMesh) {\r\n var _this = this;\r\n var extensionPromise = this._extensionsLoadVertexDataAsync(context, primitive, babylonMesh);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n var attributes = primitive.attributes;\r\n if (!attributes) {\r\n throw new Error(context + \": Attributes are missing\");\r\n }\r\n var promises = new Array();\r\n var babylonGeometry = new Geometry(babylonMesh.name, this._babylonScene);\r\n if (primitive.indices == undefined) {\r\n babylonMesh.isUnIndexed = true;\r\n }\r\n else {\r\n var accessor = ArrayItem.Get(context + \"/indices\", this._gltf.accessors, primitive.indices);\r\n promises.push(this._loadIndicesAccessorAsync(\"/accessors/\" + accessor.index, accessor).then(function (data) {\r\n babylonGeometry.setIndices(data);\r\n }));\r\n }\r\n var loadAttribute = function (attribute, kind, callback) {\r\n if (attributes[attribute] == undefined) {\r\n return;\r\n }\r\n babylonMesh._delayInfo = babylonMesh._delayInfo || [];\r\n if (babylonMesh._delayInfo.indexOf(kind) === -1) {\r\n babylonMesh._delayInfo.push(kind);\r\n }\r\n var accessor = ArrayItem.Get(context + \"/attributes/\" + attribute, _this._gltf.accessors, attributes[attribute]);\r\n promises.push(_this._loadVertexAccessorAsync(\"/accessors/\" + accessor.index, accessor, kind).then(function (babylonVertexBuffer) {\r\n if (babylonVertexBuffer.getKind() === VertexBuffer.PositionKind && !_this.parent.alwaysComputeBoundingBox && !babylonMesh.skeleton) {\r\n var mmin = accessor.min, mmax = accessor.max;\r\n if (mmin !== undefined && mmax !== undefined) {\r\n var min = TmpVectors.Vector3[0], max = TmpVectors.Vector3[1];\r\n min.copyFromFloats.apply(min, mmin);\r\n max.copyFromFloats.apply(max, mmax);\r\n babylonGeometry._boundingInfo = new BoundingInfo(min, max);\r\n babylonGeometry.useBoundingInfoFromGeometry = true;\r\n }\r\n }\r\n babylonGeometry.setVerticesBuffer(babylonVertexBuffer, accessor.count);\r\n }));\r\n if (kind == VertexBuffer.MatricesIndicesExtraKind) {\r\n babylonMesh.numBoneInfluencers = 8;\r\n }\r\n if (callback) {\r\n callback(accessor);\r\n }\r\n };\r\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind);\r\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind);\r\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind);\r\n loadAttribute(\"TEXCOORD_0\", VertexBuffer.UVKind);\r\n loadAttribute(\"TEXCOORD_1\", VertexBuffer.UV2Kind);\r\n loadAttribute(\"JOINTS_0\", VertexBuffer.MatricesIndicesKind);\r\n loadAttribute(\"WEIGHTS_0\", VertexBuffer.MatricesWeightsKind);\r\n loadAttribute(\"JOINTS_1\", VertexBuffer.MatricesIndicesExtraKind);\r\n loadAttribute(\"WEIGHTS_1\", VertexBuffer.MatricesWeightsExtraKind);\r\n loadAttribute(\"COLOR_0\", VertexBuffer.ColorKind, function (accessor) {\r\n if (accessor.type === \"VEC4\" /* VEC4 */) {\r\n babylonMesh.hasVertexAlpha = true;\r\n }\r\n });\r\n return Promise.all(promises).then(function () {\r\n return babylonGeometry;\r\n });\r\n };\r\n GLTFLoader.prototype._createMorphTargets = function (context, node, mesh, primitive, babylonMesh) {\r\n if (!primitive.targets) {\r\n return;\r\n }\r\n if (node._numMorphTargets == undefined) {\r\n node._numMorphTargets = primitive.targets.length;\r\n }\r\n else if (primitive.targets.length !== node._numMorphTargets) {\r\n throw new Error(context + \": Primitives do not have the same number of targets\");\r\n }\r\n var targetNames = mesh.extras ? mesh.extras.targetNames : null;\r\n babylonMesh.morphTargetManager = new MorphTargetManager(babylonMesh.getScene());\r\n for (var index = 0; index < primitive.targets.length; index++) {\r\n var weight = node.weights ? node.weights[index] : mesh.weights ? mesh.weights[index] : 0;\r\n var name_4 = targetNames ? targetNames[index] : \"morphTarget\" + index;\r\n babylonMesh.morphTargetManager.addTarget(new MorphTarget(name_4, weight, babylonMesh.getScene()));\r\n // TODO: tell the target whether it has positions, normals, tangents\r\n }\r\n };\r\n GLTFLoader.prototype._loadMorphTargetsAsync = function (context, primitive, babylonMesh, babylonGeometry) {\r\n if (!primitive.targets) {\r\n return Promise.resolve();\r\n }\r\n var promises = new Array();\r\n var morphTargetManager = babylonMesh.morphTargetManager;\r\n for (var index = 0; index < morphTargetManager.numTargets; index++) {\r\n var babylonMorphTarget = morphTargetManager.getTarget(index);\r\n promises.push(this._loadMorphTargetVertexDataAsync(context + \"/targets/\" + index, babylonGeometry, primitive.targets[index], babylonMorphTarget));\r\n }\r\n return Promise.all(promises).then(function () { });\r\n };\r\n GLTFLoader.prototype._loadMorphTargetVertexDataAsync = function (context, babylonGeometry, attributes, babylonMorphTarget) {\r\n var _this = this;\r\n var promises = new Array();\r\n var loadAttribute = function (attribute, kind, setData) {\r\n if (attributes[attribute] == undefined) {\r\n return;\r\n }\r\n var babylonVertexBuffer = babylonGeometry.getVertexBuffer(kind);\r\n if (!babylonVertexBuffer) {\r\n return;\r\n }\r\n var accessor = ArrayItem.Get(context + \"/\" + attribute, _this._gltf.accessors, attributes[attribute]);\r\n promises.push(_this._loadFloatAccessorAsync(\"/accessors/\" + accessor.index, accessor).then(function (data) {\r\n setData(babylonVertexBuffer, data);\r\n }));\r\n };\r\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind, function (babylonVertexBuffer, data) {\r\n var positions = new Float32Array(data.length);\r\n babylonVertexBuffer.forEach(data.length, function (value, index) {\r\n positions[index] = data[index] + value;\r\n });\r\n babylonMorphTarget.setPositions(positions);\r\n });\r\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind, function (babylonVertexBuffer, data) {\r\n var normals = new Float32Array(data.length);\r\n babylonVertexBuffer.forEach(normals.length, function (value, index) {\r\n normals[index] = data[index] + value;\r\n });\r\n babylonMorphTarget.setNormals(normals);\r\n });\r\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind, function (babylonVertexBuffer, data) {\r\n var tangents = new Float32Array(data.length / 3 * 4);\r\n var dataIndex = 0;\r\n babylonVertexBuffer.forEach(data.length / 3 * 4, function (value, index) {\r\n // Tangent data for morph targets is stored as xyz delta.\r\n // The vertexData.tangent is stored as xyzw.\r\n // So we need to skip every fourth vertexData.tangent.\r\n if (((index + 1) % 4) !== 0) {\r\n tangents[dataIndex] = data[dataIndex] + value;\r\n dataIndex++;\r\n }\r\n });\r\n babylonMorphTarget.setTangents(tangents);\r\n });\r\n return Promise.all(promises).then(function () { });\r\n };\r\n GLTFLoader._LoadTransform = function (node, babylonNode) {\r\n // Ignore the TRS of skinned nodes.\r\n // See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins (second implementation note)\r\n if (node.skin != undefined) {\r\n return;\r\n }\r\n var position = Vector3.Zero();\r\n var rotation = Quaternion.Identity();\r\n var scaling = Vector3.One();\r\n if (node.matrix) {\r\n var matrix = Matrix.FromArray(node.matrix);\r\n matrix.decompose(scaling, rotation, position);\r\n }\r\n else {\r\n if (node.translation) {\r\n position = Vector3.FromArray(node.translation);\r\n }\r\n if (node.rotation) {\r\n rotation = Quaternion.FromArray(node.rotation);\r\n }\r\n if (node.scale) {\r\n scaling = Vector3.FromArray(node.scale);\r\n }\r\n }\r\n babylonNode.position = position;\r\n babylonNode.rotationQuaternion = rotation;\r\n babylonNode.scaling = scaling;\r\n };\r\n GLTFLoader.prototype._loadSkinAsync = function (context, node, skin) {\r\n var _this = this;\r\n var extensionPromise = this._extensionsLoadSkinAsync(context, node, skin);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n var assignSkeleton = function (skeleton) {\r\n _this._forEachPrimitive(node, function (babylonMesh) {\r\n babylonMesh.skeleton = skeleton;\r\n });\r\n };\r\n if (skin._data) {\r\n assignSkeleton(skin._data.babylonSkeleton);\r\n return skin._data.promise;\r\n }\r\n var skeletonId = \"skeleton\" + skin.index;\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n var babylonSkeleton = new Skeleton(skin.name || skeletonId, skeletonId, this._babylonScene);\r\n this._babylonScene._blockEntityCollection = false;\r\n // See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins (second implementation note)\r\n babylonSkeleton.overrideMesh = this._rootBabylonMesh;\r\n this._loadBones(context, skin, babylonSkeleton);\r\n assignSkeleton(babylonSkeleton);\r\n var promise = this._loadSkinInverseBindMatricesDataAsync(context, skin).then(function (inverseBindMatricesData) {\r\n _this._updateBoneMatrices(babylonSkeleton, inverseBindMatricesData);\r\n });\r\n skin._data = {\r\n babylonSkeleton: babylonSkeleton,\r\n promise: promise\r\n };\r\n return promise;\r\n };\r\n GLTFLoader.prototype._loadBones = function (context, skin, babylonSkeleton) {\r\n var babylonBones = {};\r\n for (var _i = 0, _a = skin.joints; _i < _a.length; _i++) {\r\n var index = _a[_i];\r\n var node = ArrayItem.Get(context + \"/joints/\" + index, this._gltf.nodes, index);\r\n this._loadBone(node, skin, babylonSkeleton, babylonBones);\r\n }\r\n };\r\n GLTFLoader.prototype._loadBone = function (node, skin, babylonSkeleton, babylonBones) {\r\n var babylonBone = babylonBones[node.index];\r\n if (babylonBone) {\r\n return babylonBone;\r\n }\r\n var babylonParentBone = null;\r\n if (node.parent && node.parent._babylonTransformNode !== this._rootBabylonMesh) {\r\n babylonParentBone = this._loadBone(node.parent, skin, babylonSkeleton, babylonBones);\r\n }\r\n var boneIndex = skin.joints.indexOf(node.index);\r\n babylonBone = new Bone(node.name || \"joint\" + node.index, babylonSkeleton, babylonParentBone, this._getNodeMatrix(node), null, null, boneIndex);\r\n babylonBones[node.index] = babylonBone;\r\n node._babylonBones = node._babylonBones || [];\r\n node._babylonBones.push(babylonBone);\r\n return babylonBone;\r\n };\r\n GLTFLoader.prototype._loadSkinInverseBindMatricesDataAsync = function (context, skin) {\r\n if (skin.inverseBindMatrices == undefined) {\r\n return Promise.resolve(null);\r\n }\r\n var accessor = ArrayItem.Get(context + \"/inverseBindMatrices\", this._gltf.accessors, skin.inverseBindMatrices);\r\n return this._loadFloatAccessorAsync(\"/accessors/\" + accessor.index, accessor);\r\n };\r\n GLTFLoader.prototype._updateBoneMatrices = function (babylonSkeleton, inverseBindMatricesData) {\r\n for (var _i = 0, _a = babylonSkeleton.bones; _i < _a.length; _i++) {\r\n var babylonBone = _a[_i];\r\n var baseMatrix = Matrix.Identity();\r\n var boneIndex = babylonBone._index;\r\n if (inverseBindMatricesData && boneIndex !== -1) {\r\n Matrix.FromArrayToRef(inverseBindMatricesData, boneIndex * 16, baseMatrix);\r\n baseMatrix.invertToRef(baseMatrix);\r\n }\r\n var babylonParentBone = babylonBone.getParent();\r\n if (babylonParentBone) {\r\n baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);\r\n }\r\n babylonBone.setBindPose(baseMatrix);\r\n babylonBone.updateMatrix(baseMatrix, false, false);\r\n babylonBone._updateDifferenceMatrix(undefined, false);\r\n }\r\n };\r\n GLTFLoader.prototype._getNodeMatrix = function (node) {\r\n return node.matrix ?\r\n Matrix.FromArray(node.matrix) :\r\n Matrix.Compose(node.scale ? Vector3.FromArray(node.scale) : Vector3.One(), node.rotation ? Quaternion.FromArray(node.rotation) : Quaternion.Identity(), node.translation ? Vector3.FromArray(node.translation) : Vector3.Zero());\r\n };\r\n /**\r\n * Loads a glTF camera.\r\n * @param context The context when loading the asset\r\n * @param camera The glTF camera property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon camera when the load is complete\r\n */\r\n GLTFLoader.prototype.loadCameraAsync = function (context, camera, assign) {\r\n if (assign === void 0) { assign = function () { }; }\r\n var extensionPromise = this._extensionsLoadCameraAsync(context, camera, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n var promises = new Array();\r\n this.logOpen(context + \" \" + (camera.name || \"\"));\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n var babylonCamera = new FreeCamera(camera.name || \"camera\" + camera.index, Vector3.Zero(), this._babylonScene, false);\r\n this._babylonScene._blockEntityCollection = false;\r\n babylonCamera.ignoreParentScaling = true;\r\n babylonCamera.rotation = new Vector3(0, Math.PI, 0);\r\n switch (camera.type) {\r\n case \"perspective\" /* PERSPECTIVE */: {\r\n var perspective = camera.perspective;\r\n if (!perspective) {\r\n throw new Error(context + \": Camera perspective properties are missing\");\r\n }\r\n babylonCamera.fov = perspective.yfov;\r\n babylonCamera.minZ = perspective.znear;\r\n babylonCamera.maxZ = perspective.zfar || Number.MAX_VALUE;\r\n break;\r\n }\r\n case \"orthographic\" /* ORTHOGRAPHIC */: {\r\n if (!camera.orthographic) {\r\n throw new Error(context + \": Camera orthographic properties are missing\");\r\n }\r\n babylonCamera.mode = Camera.ORTHOGRAPHIC_CAMERA;\r\n babylonCamera.orthoLeft = -camera.orthographic.xmag;\r\n babylonCamera.orthoRight = camera.orthographic.xmag;\r\n babylonCamera.orthoBottom = -camera.orthographic.ymag;\r\n babylonCamera.orthoTop = camera.orthographic.ymag;\r\n babylonCamera.minZ = camera.orthographic.znear;\r\n babylonCamera.maxZ = camera.orthographic.zfar;\r\n break;\r\n }\r\n default: {\r\n throw new Error(context + \": Invalid camera type (\" + camera.type + \")\");\r\n }\r\n }\r\n GLTFLoader.AddPointerMetadata(babylonCamera, context);\r\n this._parent.onCameraLoadedObservable.notifyObservers(babylonCamera);\r\n assign(babylonCamera);\r\n this.logClose();\r\n return Promise.all(promises).then(function () {\r\n return babylonCamera;\r\n });\r\n };\r\n GLTFLoader.prototype._loadAnimationsAsync = function () {\r\n var animations = this._gltf.animations;\r\n if (!animations) {\r\n return Promise.resolve();\r\n }\r\n var promises = new Array();\r\n for (var index = 0; index < animations.length; index++) {\r\n var animation = animations[index];\r\n promises.push(this.loadAnimationAsync(\"/animations/\" + animation.index, animation));\r\n }\r\n return Promise.all(promises).then(function () { });\r\n };\r\n /**\r\n * Loads a glTF animation.\r\n * @param context The context when loading the asset\r\n * @param animation The glTF animation property\r\n * @returns A promise that resolves with the loaded Babylon animation group when the load is complete\r\n */\r\n GLTFLoader.prototype.loadAnimationAsync = function (context, animation) {\r\n var promise = this._extensionsLoadAnimationAsync(context, animation);\r\n if (promise) {\r\n return promise;\r\n }\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n var babylonAnimationGroup = new AnimationGroup(animation.name || \"animation\" + animation.index, this._babylonScene);\r\n this._babylonScene._blockEntityCollection = false;\r\n animation._babylonAnimationGroup = babylonAnimationGroup;\r\n var promises = new Array();\r\n ArrayItem.Assign(animation.channels);\r\n ArrayItem.Assign(animation.samplers);\r\n for (var _i = 0, _a = animation.channels; _i < _a.length; _i++) {\r\n var channel = _a[_i];\r\n promises.push(this._loadAnimationChannelAsync(context + \"/channels/\" + channel.index, context, animation, channel, babylonAnimationGroup));\r\n }\r\n return Promise.all(promises).then(function () {\r\n babylonAnimationGroup.normalize(0);\r\n return babylonAnimationGroup;\r\n });\r\n };\r\n /**\r\n * @hidden Loads a glTF animation channel.\r\n * @param context The context when loading the asset\r\n * @param animationContext The context of the animation when loading the asset\r\n * @param animation The glTF animation property\r\n * @param channel The glTF animation channel property\r\n * @param babylonAnimationGroup The babylon animation group property\r\n * @param animationTargetOverride The babylon animation channel target override property. My be null.\r\n * @returns A void promise when the channel load is complete\r\n */\r\n GLTFLoader.prototype._loadAnimationChannelAsync = function (context, animationContext, animation, channel, babylonAnimationGroup, animationTargetOverride) {\r\n var _this = this;\r\n if (animationTargetOverride === void 0) { animationTargetOverride = null; }\r\n if (channel.target.node == undefined) {\r\n return Promise.resolve();\r\n }\r\n var targetNode = ArrayItem.Get(context + \"/target/node\", this._gltf.nodes, channel.target.node);\r\n // Ignore animations that have no animation targets.\r\n if ((channel.target.path === \"weights\" /* WEIGHTS */ && !targetNode._numMorphTargets) ||\r\n (channel.target.path !== \"weights\" /* WEIGHTS */ && !targetNode._babylonTransformNode)) {\r\n return Promise.resolve();\r\n }\r\n var sampler = ArrayItem.Get(context + \"/sampler\", animation.samplers, channel.sampler);\r\n return this._loadAnimationSamplerAsync(animationContext + \"/samplers/\" + channel.sampler, sampler).then(function (data) {\r\n var targetPath;\r\n var animationType;\r\n switch (channel.target.path) {\r\n case \"translation\" /* TRANSLATION */: {\r\n targetPath = \"position\";\r\n animationType = Animation.ANIMATIONTYPE_VECTOR3;\r\n break;\r\n }\r\n case \"rotation\" /* ROTATION */: {\r\n targetPath = \"rotationQuaternion\";\r\n animationType = Animation.ANIMATIONTYPE_QUATERNION;\r\n break;\r\n }\r\n case \"scale\" /* SCALE */: {\r\n targetPath = \"scaling\";\r\n animationType = Animation.ANIMATIONTYPE_VECTOR3;\r\n break;\r\n }\r\n case \"weights\" /* WEIGHTS */: {\r\n targetPath = \"influence\";\r\n animationType = Animation.ANIMATIONTYPE_FLOAT;\r\n break;\r\n }\r\n default: {\r\n throw new Error(context + \"/target/path: Invalid value (\" + channel.target.path + \")\");\r\n }\r\n }\r\n var outputBufferOffset = 0;\r\n var getNextOutputValue;\r\n switch (targetPath) {\r\n case \"position\": {\r\n getNextOutputValue = function () {\r\n var value = Vector3.FromArray(data.output, outputBufferOffset);\r\n outputBufferOffset += 3;\r\n return value;\r\n };\r\n break;\r\n }\r\n case \"rotationQuaternion\": {\r\n getNextOutputValue = function () {\r\n var value = Quaternion.FromArray(data.output, outputBufferOffset);\r\n outputBufferOffset += 4;\r\n return value;\r\n };\r\n break;\r\n }\r\n case \"scaling\": {\r\n getNextOutputValue = function () {\r\n var value = Vector3.FromArray(data.output, outputBufferOffset);\r\n outputBufferOffset += 3;\r\n return value;\r\n };\r\n break;\r\n }\r\n case \"influence\": {\r\n getNextOutputValue = function () {\r\n var value = new Array(targetNode._numMorphTargets);\r\n for (var i = 0; i < targetNode._numMorphTargets; i++) {\r\n value[i] = data.output[outputBufferOffset++];\r\n }\r\n return value;\r\n };\r\n break;\r\n }\r\n }\r\n var getNextKey;\r\n switch (data.interpolation) {\r\n case \"STEP\" /* STEP */: {\r\n getNextKey = function (frameIndex) { return ({\r\n frame: data.input[frameIndex],\r\n value: getNextOutputValue(),\r\n interpolation: AnimationKeyInterpolation.STEP\r\n }); };\r\n break;\r\n }\r\n case \"LINEAR\" /* LINEAR */: {\r\n getNextKey = function (frameIndex) { return ({\r\n frame: data.input[frameIndex],\r\n value: getNextOutputValue()\r\n }); };\r\n break;\r\n }\r\n case \"CUBICSPLINE\" /* CUBICSPLINE */: {\r\n getNextKey = function (frameIndex) { return ({\r\n frame: data.input[frameIndex],\r\n inTangent: getNextOutputValue(),\r\n value: getNextOutputValue(),\r\n outTangent: getNextOutputValue()\r\n }); };\r\n break;\r\n }\r\n }\r\n var keys = new Array(data.input.length);\r\n for (var frameIndex = 0; frameIndex < data.input.length; frameIndex++) {\r\n keys[frameIndex] = getNextKey(frameIndex);\r\n }\r\n if (targetPath === \"influence\") {\r\n var _loop_2 = function (targetIndex) {\r\n var animationName = babylonAnimationGroup.name + \"_channel\" + babylonAnimationGroup.targetedAnimations.length;\r\n var babylonAnimation = new Animation(animationName, targetPath, 1, animationType);\r\n babylonAnimation.setKeys(keys.map(function (key) { return ({\r\n frame: key.frame,\r\n inTangent: key.inTangent ? key.inTangent[targetIndex] : undefined,\r\n value: key.value[targetIndex],\r\n outTangent: key.outTangent ? key.outTangent[targetIndex] : undefined\r\n }); }));\r\n _this._forEachPrimitive(targetNode, function (babylonAbstractMesh) {\r\n var babylonMesh = babylonAbstractMesh;\r\n var morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);\r\n var babylonAnimationClone = babylonAnimation.clone();\r\n morphTarget.animations.push(babylonAnimationClone);\r\n babylonAnimationGroup.addTargetedAnimation(babylonAnimationClone, morphTarget);\r\n });\r\n };\r\n for (var targetIndex = 0; targetIndex < targetNode._numMorphTargets; targetIndex++) {\r\n _loop_2(targetIndex);\r\n }\r\n }\r\n else {\r\n var animationName = babylonAnimationGroup.name + \"_channel\" + babylonAnimationGroup.targetedAnimations.length;\r\n var babylonAnimation = new Animation(animationName, targetPath, 1, animationType);\r\n babylonAnimation.setKeys(keys);\r\n if (animationTargetOverride != null && animationTargetOverride.animations != null) {\r\n animationTargetOverride.animations.push(babylonAnimation);\r\n babylonAnimationGroup.addTargetedAnimation(babylonAnimation, animationTargetOverride);\r\n }\r\n else {\r\n targetNode._babylonTransformNode.animations.push(babylonAnimation);\r\n babylonAnimationGroup.addTargetedAnimation(babylonAnimation, targetNode._babylonTransformNode);\r\n }\r\n }\r\n });\r\n };\r\n GLTFLoader.prototype._loadAnimationSamplerAsync = function (context, sampler) {\r\n if (sampler._data) {\r\n return sampler._data;\r\n }\r\n var interpolation = sampler.interpolation || \"LINEAR\" /* LINEAR */;\r\n switch (interpolation) {\r\n case \"STEP\" /* STEP */:\r\n case \"LINEAR\" /* LINEAR */:\r\n case \"CUBICSPLINE\" /* CUBICSPLINE */: {\r\n break;\r\n }\r\n default: {\r\n throw new Error(context + \"/interpolation: Invalid value (\" + sampler.interpolation + \")\");\r\n }\r\n }\r\n var inputAccessor = ArrayItem.Get(context + \"/input\", this._gltf.accessors, sampler.input);\r\n var outputAccessor = ArrayItem.Get(context + \"/output\", this._gltf.accessors, sampler.output);\r\n sampler._data = Promise.all([\r\n this._loadFloatAccessorAsync(\"/accessors/\" + inputAccessor.index, inputAccessor),\r\n this._loadFloatAccessorAsync(\"/accessors/\" + outputAccessor.index, outputAccessor)\r\n ]).then(function (_a) {\r\n var inputData = _a[0], outputData = _a[1];\r\n return {\r\n input: inputData,\r\n interpolation: interpolation,\r\n output: outputData,\r\n };\r\n });\r\n return sampler._data;\r\n };\r\n GLTFLoader.prototype._loadBufferAsync = function (context, buffer, byteOffset, byteLength) {\r\n var extensionPromise = this._extensionsLoadBufferAsync(context, buffer, byteOffset, byteLength);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n if (!buffer._data) {\r\n if (buffer.uri) {\r\n buffer._data = this.loadUriAsync(context + \"/uri\", buffer, buffer.uri);\r\n }\r\n else {\r\n if (!this._bin) {\r\n throw new Error(context + \": Uri is missing or the binary glTF is missing its binary chunk\");\r\n }\r\n buffer._data = this._bin.readAsync(0, buffer.byteLength);\r\n }\r\n }\r\n return buffer._data.then(function (data) {\r\n try {\r\n return new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);\r\n }\r\n catch (e) {\r\n throw new Error(context + \": \" + e.message);\r\n }\r\n });\r\n };\r\n /**\r\n * Loads a glTF buffer view.\r\n * @param context The context when loading the asset\r\n * @param bufferView The glTF buffer view property\r\n * @returns A promise that resolves with the loaded data when the load is complete\r\n */\r\n GLTFLoader.prototype.loadBufferViewAsync = function (context, bufferView) {\r\n var extensionPromise = this._extensionsLoadBufferViewAsync(context, bufferView);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n if (bufferView._data) {\r\n return bufferView._data;\r\n }\r\n var buffer = ArrayItem.Get(context + \"/buffer\", this._gltf.buffers, bufferView.buffer);\r\n bufferView._data = this._loadBufferAsync(\"/buffers/\" + buffer.index, buffer, (bufferView.byteOffset || 0), bufferView.byteLength);\r\n return bufferView._data;\r\n };\r\n GLTFLoader.prototype._loadAccessorAsync = function (context, accessor, constructor) {\r\n var _this = this;\r\n if (accessor._data) {\r\n return accessor._data;\r\n }\r\n var numComponents = GLTFLoader._GetNumComponents(context, accessor.type);\r\n var byteStride = numComponents * VertexBuffer.GetTypeByteLength(accessor.componentType);\r\n var length = numComponents * accessor.count;\r\n if (accessor.bufferView == undefined) {\r\n accessor._data = Promise.resolve(new constructor(length));\r\n }\r\n else {\r\n var bufferView_1 = ArrayItem.Get(context + \"/bufferView\", this._gltf.bufferViews, accessor.bufferView);\r\n accessor._data = this.loadBufferViewAsync(\"/bufferViews/\" + bufferView_1.index, bufferView_1).then(function (data) {\r\n if (accessor.componentType === 5126 /* FLOAT */ && !accessor.normalized && (!bufferView_1.byteStride || bufferView_1.byteStride === byteStride)) {\r\n return GLTFLoader._GetTypedArray(context, accessor.componentType, data, accessor.byteOffset, length);\r\n }\r\n else {\r\n var typedArray_1 = new constructor(length);\r\n VertexBuffer.ForEach(data, accessor.byteOffset || 0, bufferView_1.byteStride || byteStride, numComponents, accessor.componentType, typedArray_1.length, accessor.normalized || false, function (value, index) {\r\n typedArray_1[index] = value;\r\n });\r\n return typedArray_1;\r\n }\r\n });\r\n }\r\n if (accessor.sparse) {\r\n var sparse_1 = accessor.sparse;\r\n accessor._data = accessor._data.then(function (data) {\r\n var typedArray = data;\r\n var indicesBufferView = ArrayItem.Get(context + \"/sparse/indices/bufferView\", _this._gltf.bufferViews, sparse_1.indices.bufferView);\r\n var valuesBufferView = ArrayItem.Get(context + \"/sparse/values/bufferView\", _this._gltf.bufferViews, sparse_1.values.bufferView);\r\n return Promise.all([\r\n _this.loadBufferViewAsync(\"/bufferViews/\" + indicesBufferView.index, indicesBufferView),\r\n _this.loadBufferViewAsync(\"/bufferViews/\" + valuesBufferView.index, valuesBufferView)\r\n ]).then(function (_a) {\r\n var indicesData = _a[0], valuesData = _a[1];\r\n var indices = GLTFLoader._GetTypedArray(context + \"/sparse/indices\", sparse_1.indices.componentType, indicesData, sparse_1.indices.byteOffset, sparse_1.count);\r\n var sparseLength = numComponents * sparse_1.count;\r\n var values;\r\n if (accessor.componentType === 5126 /* FLOAT */ && !accessor.normalized) {\r\n values = GLTFLoader._GetTypedArray(context + \"/sparse/values\", accessor.componentType, valuesData, sparse_1.values.byteOffset, sparseLength);\r\n }\r\n else {\r\n var sparseData = GLTFLoader._GetTypedArray(context + \"/sparse/values\", accessor.componentType, valuesData, sparse_1.values.byteOffset, sparseLength);\r\n values = new constructor(sparseLength);\r\n VertexBuffer.ForEach(sparseData, 0, byteStride, numComponents, accessor.componentType, values.length, accessor.normalized || false, function (value, index) {\r\n values[index] = value;\r\n });\r\n }\r\n var valuesIndex = 0;\r\n for (var indicesIndex = 0; indicesIndex < indices.length; indicesIndex++) {\r\n var dataIndex = indices[indicesIndex] * numComponents;\r\n for (var componentIndex = 0; componentIndex < numComponents; componentIndex++) {\r\n typedArray[dataIndex++] = values[valuesIndex++];\r\n }\r\n }\r\n return typedArray;\r\n });\r\n });\r\n }\r\n return accessor._data;\r\n };\r\n /** @hidden */\r\n GLTFLoader.prototype._loadFloatAccessorAsync = function (context, accessor) {\r\n return this._loadAccessorAsync(context, accessor, Float32Array);\r\n };\r\n GLTFLoader.prototype._loadIndicesAccessorAsync = function (context, accessor) {\r\n if (accessor.type !== \"SCALAR\" /* SCALAR */) {\r\n throw new Error(context + \"/type: Invalid value \" + accessor.type);\r\n }\r\n if (accessor.componentType !== 5121 /* UNSIGNED_BYTE */ &&\r\n accessor.componentType !== 5123 /* UNSIGNED_SHORT */ &&\r\n accessor.componentType !== 5125 /* UNSIGNED_INT */) {\r\n throw new Error(context + \"/componentType: Invalid value \" + accessor.componentType);\r\n }\r\n if (accessor._data) {\r\n return accessor._data;\r\n }\r\n if (accessor.sparse) {\r\n var constructor = GLTFLoader._GetTypedArrayConstructor(context + \"/componentType\", accessor.componentType);\r\n accessor._data = this._loadAccessorAsync(context, accessor, constructor);\r\n }\r\n else {\r\n var bufferView = ArrayItem.Get(context + \"/bufferView\", this._gltf.bufferViews, accessor.bufferView);\r\n accessor._data = this.loadBufferViewAsync(\"/bufferViews/\" + bufferView.index, bufferView).then(function (data) {\r\n return GLTFLoader._GetTypedArray(context, accessor.componentType, data, accessor.byteOffset, accessor.count);\r\n });\r\n }\r\n return accessor._data;\r\n };\r\n GLTFLoader.prototype._loadVertexBufferViewAsync = function (bufferView, kind) {\r\n var _this = this;\r\n if (bufferView._babylonBuffer) {\r\n return bufferView._babylonBuffer;\r\n }\r\n bufferView._babylonBuffer = this.loadBufferViewAsync(\"/bufferViews/\" + bufferView.index, bufferView).then(function (data) {\r\n return new Buffer(_this._babylonScene.getEngine(), data, false);\r\n });\r\n return bufferView._babylonBuffer;\r\n };\r\n GLTFLoader.prototype._loadVertexAccessorAsync = function (context, accessor, kind) {\r\n var _this = this;\r\n if (accessor._babylonVertexBuffer) {\r\n return accessor._babylonVertexBuffer;\r\n }\r\n if (accessor.sparse) {\r\n accessor._babylonVertexBuffer = this._loadFloatAccessorAsync(\"/accessors/\" + accessor.index, accessor).then(function (data) {\r\n return new VertexBuffer(_this._babylonScene.getEngine(), data, kind, false);\r\n });\r\n }\r\n // HACK: If byte offset is not a multiple of component type byte length then load as a float array instead of using Babylon buffers.\r\n else if (accessor.byteOffset && accessor.byteOffset % VertexBuffer.GetTypeByteLength(accessor.componentType) !== 0) {\r\n Logger.Warn(\"Accessor byte offset is not a multiple of component type byte length\");\r\n accessor._babylonVertexBuffer = this._loadFloatAccessorAsync(\"/accessors/\" + accessor.index, accessor).then(function (data) {\r\n return new VertexBuffer(_this._babylonScene.getEngine(), data, kind, false);\r\n });\r\n }\r\n // Load joint indices as a float array since the shaders expect float data but glTF uses unsigned byte/short.\r\n // This prevents certain platforms (e.g. D3D) from having to convert the data to float on the fly.\r\n else if (kind === VertexBuffer.MatricesIndicesKind || kind === VertexBuffer.MatricesIndicesExtraKind) {\r\n accessor._babylonVertexBuffer = this._loadFloatAccessorAsync(\"/accessors/\" + accessor.index, accessor).then(function (data) {\r\n return new VertexBuffer(_this._babylonScene.getEngine(), data, kind, false);\r\n });\r\n }\r\n else {\r\n var bufferView_2 = ArrayItem.Get(context + \"/bufferView\", this._gltf.bufferViews, accessor.bufferView);\r\n accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync(bufferView_2, kind).then(function (babylonBuffer) {\r\n var size = GLTFLoader._GetNumComponents(context, accessor.type);\r\n return new VertexBuffer(_this._babylonScene.getEngine(), babylonBuffer, kind, false, false, bufferView_2.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true, 1, true);\r\n });\r\n }\r\n return accessor._babylonVertexBuffer;\r\n };\r\n GLTFLoader.prototype._loadMaterialMetallicRoughnessPropertiesAsync = function (context, properties, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var promises = new Array();\r\n if (properties) {\r\n if (properties.baseColorFactor) {\r\n babylonMaterial.albedoColor = Color3.FromArray(properties.baseColorFactor);\r\n babylonMaterial.alpha = properties.baseColorFactor[3];\r\n }\r\n else {\r\n babylonMaterial.albedoColor = Color3.White();\r\n }\r\n babylonMaterial.metallic = properties.metallicFactor == undefined ? 1 : properties.metallicFactor;\r\n babylonMaterial.roughness = properties.roughnessFactor == undefined ? 1 : properties.roughnessFactor;\r\n if (properties.baseColorTexture) {\r\n promises.push(this.loadTextureInfoAsync(context + \"/baseColorTexture\", properties.baseColorTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Base Color)\";\r\n babylonMaterial.albedoTexture = texture;\r\n }));\r\n }\r\n if (properties.metallicRoughnessTexture) {\r\n properties.metallicRoughnessTexture.nonColorData = true;\r\n promises.push(this.loadTextureInfoAsync(context + \"/metallicRoughnessTexture\", properties.metallicRoughnessTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Metallic Roughness)\";\r\n babylonMaterial.metallicTexture = texture;\r\n }));\r\n babylonMaterial.useMetallnessFromMetallicTextureBlue = true;\r\n babylonMaterial.useRoughnessFromMetallicTextureGreen = true;\r\n babylonMaterial.useRoughnessFromMetallicTextureAlpha = false;\r\n }\r\n }\r\n return Promise.all(promises).then(function () { });\r\n };\r\n /** @hidden */\r\n GLTFLoader.prototype._loadMaterialAsync = function (context, material, babylonMesh, babylonDrawMode, assign) {\r\n if (assign === void 0) { assign = function () { }; }\r\n var extensionPromise = this._extensionsLoadMaterialAsync(context, material, babylonMesh, babylonDrawMode, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n material._data = material._data || {};\r\n var babylonData = material._data[babylonDrawMode];\r\n if (!babylonData) {\r\n this.logOpen(context + \" \" + (material.name || \"\"));\r\n var babylonMaterial = this.createMaterial(context, material, babylonDrawMode);\r\n babylonData = {\r\n babylonMaterial: babylonMaterial,\r\n babylonMeshes: [],\r\n promise: this.loadMaterialPropertiesAsync(context, material, babylonMaterial)\r\n };\r\n material._data[babylonDrawMode] = babylonData;\r\n GLTFLoader.AddPointerMetadata(babylonMaterial, context);\r\n this._parent.onMaterialLoadedObservable.notifyObservers(babylonMaterial);\r\n this.logClose();\r\n }\r\n if (babylonMesh) {\r\n babylonData.babylonMeshes.push(babylonMesh);\r\n babylonMesh.onDisposeObservable.addOnce(function () {\r\n var index = babylonData.babylonMeshes.indexOf(babylonMesh);\r\n if (index !== -1) {\r\n babylonData.babylonMeshes.splice(index, 1);\r\n }\r\n });\r\n }\r\n assign(babylonData.babylonMaterial);\r\n return babylonData.promise.then(function () {\r\n return babylonData.babylonMaterial;\r\n });\r\n };\r\n GLTFLoader.prototype._createDefaultMaterial = function (name, babylonDrawMode) {\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n var babylonMaterial = new PBRMaterial(name, this._babylonScene);\r\n this._babylonScene._blockEntityCollection = false;\r\n // Moved to mesh so user can change materials on gltf meshes: babylonMaterial.sideOrientation = this._babylonScene.useRightHandedSystem ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\r\n babylonMaterial.fillMode = babylonDrawMode;\r\n babylonMaterial.enableSpecularAntiAliasing = true;\r\n babylonMaterial.useRadianceOverAlpha = !this._parent.transparencyAsCoverage;\r\n babylonMaterial.useSpecularOverAlpha = !this._parent.transparencyAsCoverage;\r\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_OPAQUE;\r\n babylonMaterial.metallic = 1;\r\n babylonMaterial.roughness = 1;\r\n return babylonMaterial;\r\n };\r\n /**\r\n * Creates a Babylon material from a glTF material.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonDrawMode The draw mode for the Babylon material\r\n * @returns The Babylon material\r\n */\r\n GLTFLoader.prototype.createMaterial = function (context, material, babylonDrawMode) {\r\n var extensionPromise = this._extensionsCreateMaterial(context, material, babylonDrawMode);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n var name = material.name || \"material\" + material.index;\r\n var babylonMaterial = this._createDefaultMaterial(name, babylonDrawMode);\r\n return babylonMaterial;\r\n };\r\n /**\r\n * Loads properties from a glTF material into a Babylon material.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonMaterial The Babylon material\r\n * @returns A promise that resolves when the load is complete\r\n */\r\n GLTFLoader.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var extensionPromise = this._extensionsLoadMaterialPropertiesAsync(context, material, babylonMaterial);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n var promises = new Array();\r\n promises.push(this.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\r\n if (material.pbrMetallicRoughness) {\r\n promises.push(this._loadMaterialMetallicRoughnessPropertiesAsync(context + \"/pbrMetallicRoughness\", material.pbrMetallicRoughness, babylonMaterial));\r\n }\r\n this.loadMaterialAlphaProperties(context, material, babylonMaterial);\r\n return Promise.all(promises).then(function () { });\r\n };\r\n /**\r\n * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonMaterial The Babylon material\r\n * @returns A promise that resolves when the load is complete\r\n */\r\n GLTFLoader.prototype.loadMaterialBasePropertiesAsync = function (context, material, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var promises = new Array();\r\n babylonMaterial.emissiveColor = material.emissiveFactor ? Color3.FromArray(material.emissiveFactor) : new Color3(0, 0, 0);\r\n if (material.doubleSided) {\r\n babylonMaterial.backFaceCulling = false;\r\n babylonMaterial.twoSidedLighting = true;\r\n }\r\n if (material.normalTexture) {\r\n material.normalTexture.nonColorData = true;\r\n promises.push(this.loadTextureInfoAsync(context + \"/normalTexture\", material.normalTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Normal)\";\r\n babylonMaterial.bumpTexture = texture;\r\n }));\r\n babylonMaterial.invertNormalMapX = !this._babylonScene.useRightHandedSystem;\r\n babylonMaterial.invertNormalMapY = this._babylonScene.useRightHandedSystem;\r\n if (material.normalTexture.scale != undefined) {\r\n babylonMaterial.bumpTexture.level = material.normalTexture.scale;\r\n }\r\n babylonMaterial.forceIrradianceInFragment = true;\r\n }\r\n if (material.occlusionTexture) {\r\n material.occlusionTexture.nonColorData = true;\r\n promises.push(this.loadTextureInfoAsync(context + \"/occlusionTexture\", material.occlusionTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Occlusion)\";\r\n babylonMaterial.ambientTexture = texture;\r\n }));\r\n babylonMaterial.useAmbientInGrayScale = true;\r\n if (material.occlusionTexture.strength != undefined) {\r\n babylonMaterial.ambientTextureStrength = material.occlusionTexture.strength;\r\n }\r\n }\r\n if (material.emissiveTexture) {\r\n promises.push(this.loadTextureInfoAsync(context + \"/emissiveTexture\", material.emissiveTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Emissive)\";\r\n babylonMaterial.emissiveTexture = texture;\r\n }));\r\n }\r\n return Promise.all(promises).then(function () { });\r\n };\r\n /**\r\n * Loads the alpha properties from a glTF material into a Babylon material.\r\n * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonMaterial The Babylon material\r\n */\r\n GLTFLoader.prototype.loadMaterialAlphaProperties = function (context, material, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var alphaMode = material.alphaMode || \"OPAQUE\" /* OPAQUE */;\r\n switch (alphaMode) {\r\n case \"OPAQUE\" /* OPAQUE */: {\r\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_OPAQUE;\r\n break;\r\n }\r\n case \"MASK\" /* MASK */: {\r\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_ALPHATEST;\r\n babylonMaterial.alphaCutOff = (material.alphaCutoff == undefined ? 0.5 : material.alphaCutoff);\r\n if (babylonMaterial.albedoTexture) {\r\n babylonMaterial.albedoTexture.hasAlpha = true;\r\n }\r\n break;\r\n }\r\n case \"BLEND\" /* BLEND */: {\r\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_ALPHABLEND;\r\n if (babylonMaterial.albedoTexture) {\r\n babylonMaterial.albedoTexture.hasAlpha = true;\r\n babylonMaterial.useAlphaFromAlbedoTexture = true;\r\n }\r\n break;\r\n }\r\n default: {\r\n throw new Error(context + \"/alphaMode: Invalid value (\" + material.alphaMode + \")\");\r\n }\r\n }\r\n };\r\n /**\r\n * Loads a glTF texture info.\r\n * @param context The context when loading the asset\r\n * @param textureInfo The glTF texture info property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon texture when the load is complete\r\n */\r\n GLTFLoader.prototype.loadTextureInfoAsync = function (context, textureInfo, assign) {\r\n var _this = this;\r\n if (assign === void 0) { assign = function () { }; }\r\n var extensionPromise = this._extensionsLoadTextureInfoAsync(context, textureInfo, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n this.logOpen(\"\" + context);\r\n if (textureInfo.texCoord >= 2) {\r\n throw new Error(context + \"/texCoord: Invalid value (\" + textureInfo.texCoord + \")\");\r\n }\r\n var texture = ArrayItem.Get(context + \"/index\", this._gltf.textures, textureInfo.index);\r\n texture._textureInfo = textureInfo;\r\n var promise = this._loadTextureAsync(\"/textures/\" + textureInfo.index, texture, function (babylonTexture) {\r\n babylonTexture.coordinatesIndex = textureInfo.texCoord || 0;\r\n GLTFLoader.AddPointerMetadata(babylonTexture, context);\r\n _this._parent.onTextureLoadedObservable.notifyObservers(babylonTexture);\r\n assign(babylonTexture);\r\n });\r\n this.logClose();\r\n return promise;\r\n };\r\n /** @hidden */\r\n GLTFLoader.prototype._loadTextureAsync = function (context, texture, assign) {\r\n if (assign === void 0) { assign = function () { }; }\r\n var extensionPromise = this._extensionsLoadTextureAsync(context, texture, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n this.logOpen(context + \" \" + (texture.name || \"\"));\r\n var sampler = (texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(context + \"/sampler\", this._gltf.samplers, texture.sampler));\r\n var image = ArrayItem.Get(context + \"/source\", this._gltf.images, texture.source);\r\n var promise = this._createTextureAsync(context, sampler, image, assign);\r\n this.logClose();\r\n return promise;\r\n };\r\n /** @hidden */\r\n GLTFLoader.prototype._createTextureAsync = function (context, sampler, image, assign, textureLoaderOptions) {\r\n var _this = this;\r\n if (assign === void 0) { assign = function () { }; }\r\n var samplerData = this._loadSampler(\"/samplers/\" + sampler.index, sampler);\r\n var promises = new Array();\r\n var deferred = new Deferred();\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n var babylonTexture = new Texture(null, this._babylonScene, samplerData.noMipMaps, false, samplerData.samplingMode, function () {\r\n if (!_this._disposed) {\r\n deferred.resolve();\r\n }\r\n }, function (message, exception) {\r\n if (!_this._disposed) {\r\n deferred.reject(new Error(context + \": \" + ((exception && exception.message) ? exception.message : message || \"Failed to load texture\")));\r\n }\r\n }, undefined, undefined, undefined, image.mimeType, textureLoaderOptions);\r\n this._babylonScene._blockEntityCollection = false;\r\n promises.push(deferred.promise);\r\n promises.push(this.loadImageAsync(\"/images/\" + image.index, image).then(function (data) {\r\n var name = image.uri || _this._fileName + \"#image\" + image.index;\r\n var dataUrl = \"data:\" + _this._uniqueRootUrl + name;\r\n babylonTexture.updateURL(dataUrl, data);\r\n }));\r\n babylonTexture.wrapU = samplerData.wrapU;\r\n babylonTexture.wrapV = samplerData.wrapV;\r\n assign(babylonTexture);\r\n return Promise.all(promises).then(function () {\r\n return babylonTexture;\r\n });\r\n };\r\n GLTFLoader.prototype._loadSampler = function (context, sampler) {\r\n if (!sampler._data) {\r\n sampler._data = {\r\n noMipMaps: (sampler.minFilter === 9728 /* NEAREST */ || sampler.minFilter === 9729 /* LINEAR */),\r\n samplingMode: GLTFLoader._GetTextureSamplingMode(context, sampler),\r\n wrapU: GLTFLoader._GetTextureWrapMode(context + \"/wrapS\", sampler.wrapS),\r\n wrapV: GLTFLoader._GetTextureWrapMode(context + \"/wrapT\", sampler.wrapT)\r\n };\r\n }\r\n return sampler._data;\r\n };\r\n /**\r\n * Loads a glTF image.\r\n * @param context The context when loading the asset\r\n * @param image The glTF image property\r\n * @returns A promise that resolves with the loaded data when the load is complete\r\n */\r\n GLTFLoader.prototype.loadImageAsync = function (context, image) {\r\n if (!image._data) {\r\n this.logOpen(context + \" \" + (image.name || \"\"));\r\n if (image.uri) {\r\n image._data = this.loadUriAsync(context + \"/uri\", image, image.uri);\r\n }\r\n else {\r\n var bufferView = ArrayItem.Get(context + \"/bufferView\", this._gltf.bufferViews, image.bufferView);\r\n image._data = this.loadBufferViewAsync(\"/bufferViews/\" + bufferView.index, bufferView);\r\n }\r\n this.logClose();\r\n }\r\n return image._data;\r\n };\r\n /**\r\n * Loads a glTF uri.\r\n * @param context The context when loading the asset\r\n * @param property The glTF property associated with the uri\r\n * @param uri The base64 or relative uri\r\n * @returns A promise that resolves with the loaded data when the load is complete\r\n */\r\n GLTFLoader.prototype.loadUriAsync = function (context, property, uri) {\r\n var _this = this;\r\n var extensionPromise = this._extensionsLoadUriAsync(context, property, uri);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n if (!GLTFLoader._ValidateUri(uri)) {\r\n throw new Error(context + \": '\" + uri + \"' is invalid\");\r\n }\r\n if (Tools.IsBase64(uri)) {\r\n var data = new Uint8Array(Tools.DecodeBase64(uri));\r\n this.log(\"Decoded \" + uri.substr(0, 64) + \"... (\" + data.length + \" bytes)\");\r\n return Promise.resolve(data);\r\n }\r\n this.log(\"Loading \" + uri);\r\n return this._parent.preprocessUrlAsync(this._rootUrl + uri).then(function (url) {\r\n return new Promise(function (resolve, reject) {\r\n _this._parent._loadFile(url, _this._babylonScene, function (data) {\r\n if (!_this._disposed) {\r\n _this.log(\"Loaded \" + uri + \" (\" + data.byteLength + \" bytes)\");\r\n resolve(new Uint8Array(data));\r\n }\r\n }, true, function (request) {\r\n reject(new LoadFileError(context + \": Failed to load '\" + uri + \"'\" + (request ? \": \" + request.status + \" \" + request.statusText : \"\"), request));\r\n });\r\n });\r\n });\r\n };\r\n /**\r\n * Adds a JSON pointer to the metadata of the Babylon object at `.metadata.gltf.pointers`.\r\n * @param babylonObject the Babylon object with metadata\r\n * @param pointer the JSON pointer\r\n */\r\n GLTFLoader.AddPointerMetadata = function (babylonObject, pointer) {\r\n var metadata = (babylonObject.metadata = babylonObject.metadata || {});\r\n var gltf = (metadata.gltf = metadata.gltf || {});\r\n var pointers = (gltf.pointers = gltf.pointers || []);\r\n pointers.push(pointer);\r\n };\r\n GLTFLoader._GetTextureWrapMode = function (context, mode) {\r\n // Set defaults if undefined\r\n mode = mode == undefined ? 10497 /* REPEAT */ : mode;\r\n switch (mode) {\r\n case 33071 /* CLAMP_TO_EDGE */: return Texture.CLAMP_ADDRESSMODE;\r\n case 33648 /* MIRRORED_REPEAT */: return Texture.MIRROR_ADDRESSMODE;\r\n case 10497 /* REPEAT */: return Texture.WRAP_ADDRESSMODE;\r\n default:\r\n Logger.Warn(context + \": Invalid value (\" + mode + \")\");\r\n return Texture.WRAP_ADDRESSMODE;\r\n }\r\n };\r\n GLTFLoader._GetTextureSamplingMode = function (context, sampler) {\r\n // Set defaults if undefined\r\n var magFilter = sampler.magFilter == undefined ? 9729 /* LINEAR */ : sampler.magFilter;\r\n var minFilter = sampler.minFilter == undefined ? 9987 /* LINEAR_MIPMAP_LINEAR */ : sampler.minFilter;\r\n if (magFilter === 9729 /* LINEAR */) {\r\n switch (minFilter) {\r\n case 9728 /* NEAREST */: return Texture.LINEAR_NEAREST;\r\n case 9729 /* LINEAR */: return Texture.LINEAR_LINEAR;\r\n case 9984 /* NEAREST_MIPMAP_NEAREST */: return Texture.LINEAR_NEAREST_MIPNEAREST;\r\n case 9985 /* LINEAR_MIPMAP_NEAREST */: return Texture.LINEAR_LINEAR_MIPNEAREST;\r\n case 9986 /* NEAREST_MIPMAP_LINEAR */: return Texture.LINEAR_NEAREST_MIPLINEAR;\r\n case 9987 /* LINEAR_MIPMAP_LINEAR */: return Texture.LINEAR_LINEAR_MIPLINEAR;\r\n default:\r\n Logger.Warn(context + \"/minFilter: Invalid value (\" + minFilter + \")\");\r\n return Texture.LINEAR_LINEAR_MIPLINEAR;\r\n }\r\n }\r\n else {\r\n if (magFilter !== 9728 /* NEAREST */) {\r\n Logger.Warn(context + \"/magFilter: Invalid value (\" + magFilter + \")\");\r\n }\r\n switch (minFilter) {\r\n case 9728 /* NEAREST */: return Texture.NEAREST_NEAREST;\r\n case 9729 /* LINEAR */: return Texture.NEAREST_LINEAR;\r\n case 9984 /* NEAREST_MIPMAP_NEAREST */: return Texture.NEAREST_NEAREST_MIPNEAREST;\r\n case 9985 /* LINEAR_MIPMAP_NEAREST */: return Texture.NEAREST_LINEAR_MIPNEAREST;\r\n case 9986 /* NEAREST_MIPMAP_LINEAR */: return Texture.NEAREST_NEAREST_MIPLINEAR;\r\n case 9987 /* LINEAR_MIPMAP_LINEAR */: return Texture.NEAREST_LINEAR_MIPLINEAR;\r\n default:\r\n Logger.Warn(context + \"/minFilter: Invalid value (\" + minFilter + \")\");\r\n return Texture.NEAREST_NEAREST_MIPNEAREST;\r\n }\r\n }\r\n };\r\n GLTFLoader._GetTypedArrayConstructor = function (context, componentType) {\r\n switch (componentType) {\r\n case 5120 /* BYTE */: return Int8Array;\r\n case 5121 /* UNSIGNED_BYTE */: return Uint8Array;\r\n case 5122 /* SHORT */: return Int16Array;\r\n case 5123 /* UNSIGNED_SHORT */: return Uint16Array;\r\n case 5125 /* UNSIGNED_INT */: return Uint32Array;\r\n case 5126 /* FLOAT */: return Float32Array;\r\n default: throw new Error(context + \": Invalid component type \" + componentType);\r\n }\r\n };\r\n GLTFLoader._GetTypedArray = function (context, componentType, bufferView, byteOffset, length) {\r\n var buffer = bufferView.buffer;\r\n byteOffset = bufferView.byteOffset + (byteOffset || 0);\r\n var constructor = GLTFLoader._GetTypedArrayConstructor(context + \"/componentType\", componentType);\r\n try {\r\n return new constructor(buffer, byteOffset, length);\r\n }\r\n catch (e) {\r\n throw new Error(context + \": \" + e);\r\n }\r\n };\r\n GLTFLoader._GetNumComponents = function (context, type) {\r\n switch (type) {\r\n case \"SCALAR\": return 1;\r\n case \"VEC2\": return 2;\r\n case \"VEC3\": return 3;\r\n case \"VEC4\": return 4;\r\n case \"MAT2\": return 4;\r\n case \"MAT3\": return 9;\r\n case \"MAT4\": return 16;\r\n }\r\n throw new Error(context + \": Invalid type (\" + type + \")\");\r\n };\r\n GLTFLoader._ValidateUri = function (uri) {\r\n return (Tools.IsBase64(uri) || uri.indexOf(\"..\") === -1);\r\n };\r\n /** @hidden */\r\n GLTFLoader._GetDrawMode = function (context, mode) {\r\n if (mode == undefined) {\r\n mode = 4 /* TRIANGLES */;\r\n }\r\n switch (mode) {\r\n case 0 /* POINTS */: return Material.PointListDrawMode;\r\n case 1 /* LINES */: return Material.LineListDrawMode;\r\n case 2 /* LINE_LOOP */: return Material.LineLoopDrawMode;\r\n case 3 /* LINE_STRIP */: return Material.LineStripDrawMode;\r\n case 4 /* TRIANGLES */: return Material.TriangleFillMode;\r\n case 5 /* TRIANGLE_STRIP */: return Material.TriangleStripDrawMode;\r\n case 6 /* TRIANGLE_FAN */: return Material.TriangleFanDrawMode;\r\n }\r\n throw new Error(context + \": Invalid mesh primitive mode (\" + mode + \")\");\r\n };\r\n GLTFLoader.prototype._compileMaterialsAsync = function () {\r\n var _this = this;\r\n this._parent._startPerformanceCounter(\"Compile materials\");\r\n var promises = new Array();\r\n if (this._gltf.materials) {\r\n for (var _i = 0, _a = this._gltf.materials; _i < _a.length; _i++) {\r\n var material = _a[_i];\r\n if (material._data) {\r\n for (var babylonDrawMode in material._data) {\r\n var babylonData = material._data[babylonDrawMode];\r\n for (var _b = 0, _c = babylonData.babylonMeshes; _b < _c.length; _b++) {\r\n var babylonMesh = _c[_b];\r\n // Ensure nonUniformScaling is set if necessary.\r\n babylonMesh.computeWorldMatrix(true);\r\n var babylonMaterial = babylonData.babylonMaterial;\r\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh));\r\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { useInstances: true }));\r\n if (this._parent.useClipPlane) {\r\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { clipPlane: true }));\r\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { clipPlane: true, useInstances: true }));\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return Promise.all(promises).then(function () {\r\n _this._parent._endPerformanceCounter(\"Compile materials\");\r\n });\r\n };\r\n GLTFLoader.prototype._compileShadowGeneratorsAsync = function () {\r\n var _this = this;\r\n this._parent._startPerformanceCounter(\"Compile shadow generators\");\r\n var promises = new Array();\r\n var lights = this._babylonScene.lights;\r\n for (var _i = 0, lights_1 = lights; _i < lights_1.length; _i++) {\r\n var light = lights_1[_i];\r\n var generator = light.getShadowGenerator();\r\n if (generator) {\r\n promises.push(generator.forceCompilationAsync());\r\n }\r\n }\r\n return Promise.all(promises).then(function () {\r\n _this._parent._endPerformanceCounter(\"Compile shadow generators\");\r\n });\r\n };\r\n GLTFLoader.prototype._forEachExtensions = function (action) {\r\n for (var _i = 0, _a = this._extensions; _i < _a.length; _i++) {\r\n var extension = _a[_i];\r\n if (extension.enabled) {\r\n action(extension);\r\n }\r\n }\r\n };\r\n GLTFLoader.prototype._applyExtensions = function (property, functionName, actionAsync) {\r\n for (var _i = 0, _a = this._extensions; _i < _a.length; _i++) {\r\n var extension = _a[_i];\r\n if (extension.enabled) {\r\n var id = extension.name + \".\" + functionName;\r\n var loaderProperty = property;\r\n loaderProperty._activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions || {};\r\n var activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions;\r\n if (!activeLoaderExtensionFunctions[id]) {\r\n activeLoaderExtensionFunctions[id] = true;\r\n try {\r\n var result = actionAsync(extension);\r\n if (result) {\r\n return result;\r\n }\r\n }\r\n finally {\r\n delete activeLoaderExtensionFunctions[id];\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n GLTFLoader.prototype._extensionsOnLoading = function () {\r\n this._forEachExtensions(function (extension) { return extension.onLoading && extension.onLoading(); });\r\n };\r\n GLTFLoader.prototype._extensionsOnReady = function () {\r\n this._forEachExtensions(function (extension) { return extension.onReady && extension.onReady(); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadSceneAsync = function (context, scene) {\r\n return this._applyExtensions(scene, \"loadScene\", function (extension) { return extension.loadSceneAsync && extension.loadSceneAsync(context, scene); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadNodeAsync = function (context, node, assign) {\r\n return this._applyExtensions(node, \"loadNode\", function (extension) { return extension.loadNodeAsync && extension.loadNodeAsync(context, node, assign); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadCameraAsync = function (context, camera, assign) {\r\n return this._applyExtensions(camera, \"loadCamera\", function (extension) { return extension.loadCameraAsync && extension.loadCameraAsync(context, camera, assign); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadVertexDataAsync = function (context, primitive, babylonMesh) {\r\n return this._applyExtensions(primitive, \"loadVertexData\", function (extension) { return extension._loadVertexDataAsync && extension._loadVertexDataAsync(context, primitive, babylonMesh); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadMeshPrimitiveAsync = function (context, name, node, mesh, primitive, assign) {\r\n return this._applyExtensions(primitive, \"loadMeshPrimitive\", function (extension) { return extension._loadMeshPrimitiveAsync && extension._loadMeshPrimitiveAsync(context, name, node, mesh, primitive, assign); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadMaterialAsync = function (context, material, babylonMesh, babylonDrawMode, assign) {\r\n return this._applyExtensions(material, \"loadMaterial\", function (extension) { return extension._loadMaterialAsync && extension._loadMaterialAsync(context, material, babylonMesh, babylonDrawMode, assign); });\r\n };\r\n GLTFLoader.prototype._extensionsCreateMaterial = function (context, material, babylonDrawMode) {\r\n return this._applyExtensions(material, \"createMaterial\", function (extension) { return extension.createMaterial && extension.createMaterial(context, material, babylonDrawMode); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n return this._applyExtensions(material, \"loadMaterialProperties\", function (extension) { return extension.loadMaterialPropertiesAsync && extension.loadMaterialPropertiesAsync(context, material, babylonMaterial); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadTextureInfoAsync = function (context, textureInfo, assign) {\r\n return this._applyExtensions(textureInfo, \"loadTextureInfo\", function (extension) { return extension.loadTextureInfoAsync && extension.loadTextureInfoAsync(context, textureInfo, assign); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadTextureAsync = function (context, texture, assign) {\r\n return this._applyExtensions(texture, \"loadTexture\", function (extension) { return extension._loadTextureAsync && extension._loadTextureAsync(context, texture, assign); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadAnimationAsync = function (context, animation) {\r\n return this._applyExtensions(animation, \"loadAnimation\", function (extension) { return extension.loadAnimationAsync && extension.loadAnimationAsync(context, animation); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadSkinAsync = function (context, node, skin) {\r\n return this._applyExtensions(skin, \"loadSkin\", function (extension) { return extension._loadSkinAsync && extension._loadSkinAsync(context, node, skin); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadUriAsync = function (context, property, uri) {\r\n return this._applyExtensions(property, \"loadUri\", function (extension) { return extension._loadUriAsync && extension._loadUriAsync(context, property, uri); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadBufferViewAsync = function (context, bufferView) {\r\n return this._applyExtensions(bufferView, \"loadBufferView\", function (extension) { return extension.loadBufferViewAsync && extension.loadBufferViewAsync(context, bufferView); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadBufferAsync = function (context, buffer, byteOffset, byteLength) {\r\n return this._applyExtensions(buffer, \"loadBuffer\", function (extension) { return extension.loadBufferAsync && extension.loadBufferAsync(context, buffer, byteOffset, byteLength); });\r\n };\r\n /**\r\n * Helper method called by a loader extension to load an glTF extension.\r\n * @param context The context when loading the asset\r\n * @param property The glTF property to load the extension from\r\n * @param extensionName The name of the extension to load\r\n * @param actionAsync The action to run\r\n * @returns The promise returned by actionAsync or null if the extension does not exist\r\n */\r\n GLTFLoader.LoadExtensionAsync = function (context, property, extensionName, actionAsync) {\r\n if (!property.extensions) {\r\n return null;\r\n }\r\n var extensions = property.extensions;\r\n var extension = extensions[extensionName];\r\n if (!extension) {\r\n return null;\r\n }\r\n return actionAsync(context + \"/extensions/\" + extensionName, extension);\r\n };\r\n /**\r\n * Helper method called by a loader extension to load a glTF extra.\r\n * @param context The context when loading the asset\r\n * @param property The glTF property to load the extra from\r\n * @param extensionName The name of the extension to load\r\n * @param actionAsync The action to run\r\n * @returns The promise returned by actionAsync or null if the extra does not exist\r\n */\r\n GLTFLoader.LoadExtraAsync = function (context, property, extensionName, actionAsync) {\r\n if (!property.extras) {\r\n return null;\r\n }\r\n var extras = property.extras;\r\n var extra = extras[extensionName];\r\n if (!extra) {\r\n return null;\r\n }\r\n return actionAsync(context + \"/extras/\" + extensionName, extra);\r\n };\r\n /**\r\n * Checks for presence of an extension.\r\n * @param name The name of the extension to check\r\n * @returns A boolean indicating the presence of the given extension name in `extensionsUsed`\r\n */\r\n GLTFLoader.prototype.isExtensionUsed = function (name) {\r\n return !!this._gltf.extensionsUsed && this._gltf.extensionsUsed.indexOf(name) !== -1;\r\n };\r\n /**\r\n * Increments the indentation level and logs a message.\r\n * @param message The message to log\r\n */\r\n GLTFLoader.prototype.logOpen = function (message) {\r\n this._parent._logOpen(message);\r\n };\r\n /**\r\n * Decrements the indentation level.\r\n */\r\n GLTFLoader.prototype.logClose = function () {\r\n this._parent._logClose();\r\n };\r\n /**\r\n * Logs a message\r\n * @param message The message to log\r\n */\r\n GLTFLoader.prototype.log = function (message) {\r\n this._parent._log(message);\r\n };\r\n /**\r\n * Starts a performance counter.\r\n * @param counterName The name of the performance counter\r\n */\r\n GLTFLoader.prototype.startPerformanceCounter = function (counterName) {\r\n this._parent._startPerformanceCounter(counterName);\r\n };\r\n /**\r\n * Ends a performance counter.\r\n * @param counterName The name of the performance counter\r\n */\r\n GLTFLoader.prototype.endPerformanceCounter = function (counterName) {\r\n this._parent._endPerformanceCounter(counterName);\r\n };\r\n GLTFLoader._RegisteredExtensions = {};\r\n /**\r\n * The default glTF sampler.\r\n */\r\n GLTFLoader.DefaultSampler = { index: -1 };\r\n return GLTFLoader;\r\n}());\r\nexport { GLTFLoader };\r\nGLTFFileLoader._CreateGLTF2Loader = function (parent) { return new GLTFLoader(parent); };\r\n//# sourceMappingURL=glTFLoader.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/helperFunctions\";\r\nvar name = 'rgbdEncodePixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n#include\\nvoid main(void)\\n{\\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var rgbdEncodePixelShader = { name: name, shader: shader };\r\n//# sourceMappingURL=rgbdEncode.fragment.js.map","import { Tools } from \"./tools\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { Scalar } from \"../Maths/math.scalar\";\r\nimport { SphericalPolynomial } from \"../Maths/sphericalPolynomial\";\r\nimport { InternalTexture, InternalTextureSource } from \"../Materials/Textures/internalTexture\";\r\nimport { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Scene } from \"../scene\";\r\nimport { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport \"../Engines/Extensions/engine.renderTargetCube\";\r\nimport \"../Engines/Extensions/engine.readTexture\";\r\nimport \"../Materials/Textures/baseTexture.polynomial\";\r\nimport \"../Shaders/rgbdEncode.fragment\";\r\nimport \"../Shaders/rgbdDecode.fragment\";\r\n/**\r\n * Sets of helpers addressing the serialization and deserialization of environment texture\r\n * stored in a BabylonJS env file.\r\n * Those files are usually stored as .env files.\r\n */\r\nvar EnvironmentTextureTools = /** @class */ (function () {\r\n function EnvironmentTextureTools() {\r\n }\r\n /**\r\n * Gets the environment info from an env file.\r\n * @param data The array buffer containing the .env bytes.\r\n * @returns the environment file info (the json header) if successfully parsed.\r\n */\r\n EnvironmentTextureTools.GetEnvInfo = function (data) {\r\n var dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);\r\n var pos = 0;\r\n for (var i = 0; i < EnvironmentTextureTools._MagicBytes.length; i++) {\r\n if (dataView.getUint8(pos++) !== EnvironmentTextureTools._MagicBytes[i]) {\r\n Logger.Error('Not a babylon environment map');\r\n return null;\r\n }\r\n }\r\n // Read json manifest - collect characters up to null terminator\r\n var manifestString = '';\r\n var charCode = 0x00;\r\n while ((charCode = dataView.getUint8(pos++))) {\r\n manifestString += String.fromCharCode(charCode);\r\n }\r\n var manifest = JSON.parse(manifestString);\r\n if (manifest.specular) {\r\n // Extend the header with the position of the payload.\r\n manifest.specular.specularDataPosition = pos;\r\n // Fallback to 0.8 exactly if lodGenerationScale is not defined for backward compatibility.\r\n manifest.specular.lodGenerationScale = manifest.specular.lodGenerationScale || 0.8;\r\n }\r\n return manifest;\r\n };\r\n /**\r\n * Creates an environment texture from a loaded cube texture.\r\n * @param texture defines the cube texture to convert in env file\r\n * @return a promise containing the environment data if succesfull.\r\n */\r\n EnvironmentTextureTools.CreateEnvTextureAsync = function (texture) {\r\n var _this = this;\r\n var internalTexture = texture.getInternalTexture();\r\n if (!internalTexture) {\r\n return Promise.reject(\"The cube texture is invalid.\");\r\n }\r\n var engine = internalTexture.getEngine();\r\n if (engine && engine.premultipliedAlpha) {\r\n return Promise.reject(\"Env texture can only be created when the engine is created with the premultipliedAlpha option set to false.\");\r\n }\r\n if (texture.textureType === 0) {\r\n return Promise.reject(\"The cube texture should allow HDR (Full Float or Half Float).\");\r\n }\r\n var canvas = engine.getRenderingCanvas();\r\n if (!canvas) {\r\n return Promise.reject(\"Env texture can only be created when the engine is associated to a canvas.\");\r\n }\r\n var textureType = 1;\r\n if (!engine.getCaps().textureFloatRender) {\r\n textureType = 2;\r\n if (!engine.getCaps().textureHalfFloatRender) {\r\n return Promise.reject(\"Env texture can only be created when the browser supports half float or full float rendering.\");\r\n }\r\n }\r\n var cubeWidth = internalTexture.width;\r\n var hostingScene = new Scene(engine);\r\n var specularTextures = {};\r\n var promises = [];\r\n // Read and collect all mipmaps data from the cube.\r\n var mipmapsCount = Scalar.Log2(internalTexture.width);\r\n mipmapsCount = Math.round(mipmapsCount);\r\n var _loop_1 = function (i) {\r\n var faceWidth = Math.pow(2, mipmapsCount - i);\r\n var _loop_2 = function (face) {\r\n var data = texture.readPixels(face, i);\r\n // Creates a temp texture with the face data.\r\n var tempTexture = engine.createRawTexture(data, faceWidth, faceWidth, 5, false, false, 1, null, textureType);\r\n // And rgbdEncode them.\r\n var promise = new Promise(function (resolve, reject) {\r\n var rgbdPostProcess = new PostProcess(\"rgbdEncode\", \"rgbdEncode\", null, null, 1, null, 1, engine, false, undefined, 0, undefined, null, false);\r\n rgbdPostProcess.getEffect().executeWhenCompiled(function () {\r\n rgbdPostProcess.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", tempTexture);\r\n };\r\n // As the process needs to happen on the main canvas, keep track of the current size\r\n var currentW = engine.getRenderWidth();\r\n var currentH = engine.getRenderHeight();\r\n // Set the desired size for the texture\r\n engine.setSize(faceWidth, faceWidth);\r\n hostingScene.postProcessManager.directRender([rgbdPostProcess], null);\r\n // Reading datas from WebGL\r\n Tools.ToBlob(canvas, function (blob) {\r\n var fileReader = new FileReader();\r\n fileReader.onload = function (event) {\r\n var arrayBuffer = event.target.result;\r\n specularTextures[i * 6 + face] = arrayBuffer;\r\n resolve();\r\n };\r\n fileReader.readAsArrayBuffer(blob);\r\n });\r\n // Reapply the previous canvas size\r\n engine.setSize(currentW, currentH);\r\n });\r\n });\r\n promises.push(promise);\r\n };\r\n // All faces of the cube.\r\n for (var face = 0; face < 6; face++) {\r\n _loop_2(face);\r\n }\r\n };\r\n for (var i = 0; i <= mipmapsCount; i++) {\r\n _loop_1(i);\r\n }\r\n // Once all the textures haves been collected as RGBD stored in PNGs\r\n return Promise.all(promises).then(function () {\r\n // We can delete the hosting scene keeping track of all the creation objects\r\n hostingScene.dispose();\r\n // Creates the json header for the env texture\r\n var info = {\r\n version: 1,\r\n width: cubeWidth,\r\n irradiance: _this._CreateEnvTextureIrradiance(texture),\r\n specular: {\r\n mipmaps: [],\r\n lodGenerationScale: texture.lodGenerationScale\r\n }\r\n };\r\n // Sets the specular image data information\r\n var position = 0;\r\n for (var i = 0; i <= mipmapsCount; i++) {\r\n for (var face = 0; face < 6; face++) {\r\n var byteLength = specularTextures[i * 6 + face].byteLength;\r\n info.specular.mipmaps.push({\r\n length: byteLength,\r\n position: position\r\n });\r\n position += byteLength;\r\n }\r\n }\r\n // Encode the JSON as an array buffer\r\n var infoString = JSON.stringify(info);\r\n var infoBuffer = new ArrayBuffer(infoString.length + 1);\r\n var infoView = new Uint8Array(infoBuffer); // Limited to ascii subset matching unicode.\r\n for (var i = 0, strLen = infoString.length; i < strLen; i++) {\r\n infoView[i] = infoString.charCodeAt(i);\r\n }\r\n // Ends up with a null terminator for easier parsing\r\n infoView[infoString.length] = 0x00;\r\n // Computes the final required size and creates the storage\r\n var totalSize = EnvironmentTextureTools._MagicBytes.length + position + infoBuffer.byteLength;\r\n var finalBuffer = new ArrayBuffer(totalSize);\r\n var finalBufferView = new Uint8Array(finalBuffer);\r\n var dataView = new DataView(finalBuffer);\r\n // Copy the magic bytes identifying the file in\r\n var pos = 0;\r\n for (var i = 0; i < EnvironmentTextureTools._MagicBytes.length; i++) {\r\n dataView.setUint8(pos++, EnvironmentTextureTools._MagicBytes[i]);\r\n }\r\n // Add the json info\r\n finalBufferView.set(new Uint8Array(infoBuffer), pos);\r\n pos += infoBuffer.byteLength;\r\n // Finally inserts the texture data\r\n for (var i = 0; i <= mipmapsCount; i++) {\r\n for (var face = 0; face < 6; face++) {\r\n var dataBuffer = specularTextures[i * 6 + face];\r\n finalBufferView.set(new Uint8Array(dataBuffer), pos);\r\n pos += dataBuffer.byteLength;\r\n }\r\n }\r\n // Voila\r\n return finalBuffer;\r\n });\r\n };\r\n /**\r\n * Creates a JSON representation of the spherical data.\r\n * @param texture defines the texture containing the polynomials\r\n * @return the JSON representation of the spherical info\r\n */\r\n EnvironmentTextureTools._CreateEnvTextureIrradiance = function (texture) {\r\n var polynmials = texture.sphericalPolynomial;\r\n if (polynmials == null) {\r\n return null;\r\n }\r\n return {\r\n x: [polynmials.x.x, polynmials.x.y, polynmials.x.z],\r\n y: [polynmials.y.x, polynmials.y.y, polynmials.y.z],\r\n z: [polynmials.z.x, polynmials.z.y, polynmials.z.z],\r\n xx: [polynmials.xx.x, polynmials.xx.y, polynmials.xx.z],\r\n yy: [polynmials.yy.x, polynmials.yy.y, polynmials.yy.z],\r\n zz: [polynmials.zz.x, polynmials.zz.y, polynmials.zz.z],\r\n yz: [polynmials.yz.x, polynmials.yz.y, polynmials.yz.z],\r\n zx: [polynmials.zx.x, polynmials.zx.y, polynmials.zx.z],\r\n xy: [polynmials.xy.x, polynmials.xy.y, polynmials.xy.z]\r\n };\r\n };\r\n /**\r\n * Creates the ArrayBufferViews used for initializing environment texture image data.\r\n * @param data the image data\r\n * @param info parameters that determine what views will be created for accessing the underlying buffer\r\n * @return the views described by info providing access to the underlying buffer\r\n */\r\n EnvironmentTextureTools.CreateImageDataArrayBufferViews = function (data, info) {\r\n if (info.version !== 1) {\r\n throw new Error(\"Unsupported babylon environment map version \\\"\" + info.version + \"\\\"\");\r\n }\r\n var specularInfo = info.specular;\r\n // Double checks the enclosed info\r\n var mipmapsCount = Scalar.Log2(info.width);\r\n mipmapsCount = Math.round(mipmapsCount) + 1;\r\n if (specularInfo.mipmaps.length !== 6 * mipmapsCount) {\r\n throw new Error(\"Unsupported specular mipmaps number \\\"\" + specularInfo.mipmaps.length + \"\\\"\");\r\n }\r\n var imageData = new Array(mipmapsCount);\r\n for (var i = 0; i < mipmapsCount; i++) {\r\n imageData[i] = new Array(6);\r\n for (var face = 0; face < 6; face++) {\r\n var imageInfo = specularInfo.mipmaps[i * 6 + face];\r\n imageData[i][face] = new Uint8Array(data.buffer, data.byteOffset + specularInfo.specularDataPosition + imageInfo.position, imageInfo.length);\r\n }\r\n }\r\n return imageData;\r\n };\r\n /**\r\n * Uploads the texture info contained in the env file to the GPU.\r\n * @param texture defines the internal texture to upload to\r\n * @param data defines the data to load\r\n * @param info defines the texture info retrieved through the GetEnvInfo method\r\n * @returns a promise\r\n */\r\n EnvironmentTextureTools.UploadEnvLevelsAsync = function (texture, data, info) {\r\n if (info.version !== 1) {\r\n throw new Error(\"Unsupported babylon environment map version \\\"\" + info.version + \"\\\"\");\r\n }\r\n var specularInfo = info.specular;\r\n if (!specularInfo) {\r\n // Nothing else parsed so far\r\n return Promise.resolve();\r\n }\r\n texture._lodGenerationScale = specularInfo.lodGenerationScale;\r\n var imageData = EnvironmentTextureTools.CreateImageDataArrayBufferViews(data, info);\r\n return EnvironmentTextureTools.UploadLevelsAsync(texture, imageData);\r\n };\r\n EnvironmentTextureTools._OnImageReadyAsync = function (image, engine, expandTexture, rgbdPostProcess, url, face, i, generateNonLODTextures, lodTextures, cubeRtt, texture) {\r\n return new Promise(function (resolve, reject) {\r\n if (expandTexture) {\r\n var tempTexture_1 = engine.createTexture(null, true, true, null, 1, null, function (message) {\r\n reject(message);\r\n }, image);\r\n rgbdPostProcess.getEffect().executeWhenCompiled(function () {\r\n // Uncompress the data to a RTT\r\n rgbdPostProcess.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", tempTexture_1);\r\n effect.setFloat2(\"scale\", 1, 1);\r\n };\r\n engine.scenes[0].postProcessManager.directRender([rgbdPostProcess], cubeRtt, true, face, i);\r\n // Cleanup\r\n engine.restoreDefaultFramebuffer();\r\n tempTexture_1.dispose();\r\n URL.revokeObjectURL(url);\r\n resolve();\r\n });\r\n }\r\n else {\r\n engine._uploadImageToTexture(texture, image, face, i);\r\n // Upload the face to the non lod texture support\r\n if (generateNonLODTextures) {\r\n var lodTexture = lodTextures[i];\r\n if (lodTexture) {\r\n engine._uploadImageToTexture(lodTexture._texture, image, face, 0);\r\n }\r\n }\r\n resolve();\r\n }\r\n });\r\n };\r\n /**\r\n * Uploads the levels of image data to the GPU.\r\n * @param texture defines the internal texture to upload to\r\n * @param imageData defines the array buffer views of image data [mipmap][face]\r\n * @returns a promise\r\n */\r\n EnvironmentTextureTools.UploadLevelsAsync = function (texture, imageData) {\r\n var _this = this;\r\n if (!Tools.IsExponentOfTwo(texture.width)) {\r\n throw new Error(\"Texture size must be a power of two\");\r\n }\r\n var mipmapsCount = Math.round(Scalar.Log2(texture.width)) + 1;\r\n // Gets everything ready.\r\n var engine = texture.getEngine();\r\n var expandTexture = false;\r\n var generateNonLODTextures = false;\r\n var rgbdPostProcess = null;\r\n var cubeRtt = null;\r\n var lodTextures = null;\r\n var caps = engine.getCaps();\r\n texture.format = 5;\r\n texture.type = 0;\r\n texture.generateMipMaps = true;\r\n texture._cachedAnisotropicFilteringLevel = null;\r\n engine.updateTextureSamplingMode(3, texture);\r\n // Add extra process if texture lod is not supported\r\n if (!caps.textureLOD) {\r\n expandTexture = false;\r\n generateNonLODTextures = true;\r\n lodTextures = {};\r\n }\r\n // in webgl 1 there are no ways to either render or copy lod level information for float textures.\r\n else if (engine.webGLVersion < 2) {\r\n expandTexture = false;\r\n }\r\n // If half float available we can uncompress the texture\r\n else if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\r\n expandTexture = true;\r\n texture.type = 2;\r\n }\r\n // If full float available we can uncompress the texture\r\n else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\r\n expandTexture = true;\r\n texture.type = 1;\r\n }\r\n // Expand the texture if possible\r\n if (expandTexture) {\r\n // Simply run through the decode PP\r\n rgbdPostProcess = new PostProcess(\"rgbdDecode\", \"rgbdDecode\", null, null, 1, null, 3, engine, false, undefined, texture.type, undefined, null, false);\r\n texture._isRGBD = false;\r\n texture.invertY = false;\r\n cubeRtt = engine.createRenderTargetCubeTexture(texture.width, {\r\n generateDepthBuffer: false,\r\n generateMipMaps: true,\r\n generateStencilBuffer: false,\r\n samplingMode: 3,\r\n type: texture.type,\r\n format: 5\r\n });\r\n }\r\n else {\r\n texture._isRGBD = true;\r\n texture.invertY = true;\r\n // In case of missing support, applies the same patch than DDS files.\r\n if (generateNonLODTextures) {\r\n var mipSlices = 3;\r\n var scale = texture._lodGenerationScale;\r\n var offset = texture._lodGenerationOffset;\r\n for (var i = 0; i < mipSlices; i++) {\r\n //compute LOD from even spacing in smoothness (matching shader calculation)\r\n var smoothness = i / (mipSlices - 1);\r\n var roughness = 1 - smoothness;\r\n var minLODIndex = offset; // roughness = 0\r\n var maxLODIndex = (mipmapsCount - 1) * scale + offset; // roughness = 1 (mipmaps start from 0)\r\n var lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;\r\n var mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));\r\n var glTextureFromLod = new InternalTexture(engine, InternalTextureSource.Temp);\r\n glTextureFromLod.isCube = true;\r\n glTextureFromLod.invertY = true;\r\n glTextureFromLod.generateMipMaps = false;\r\n engine.updateTextureSamplingMode(2, glTextureFromLod);\r\n // Wrap in a base texture for easy binding.\r\n var lodTexture = new BaseTexture(null);\r\n lodTexture.isCube = true;\r\n lodTexture._texture = glTextureFromLod;\r\n lodTextures[mipmapIndex] = lodTexture;\r\n switch (i) {\r\n case 0:\r\n texture._lodTextureLow = lodTexture;\r\n break;\r\n case 1:\r\n texture._lodTextureMid = lodTexture;\r\n break;\r\n case 2:\r\n texture._lodTextureHigh = lodTexture;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n var promises = [];\r\n var _loop_3 = function (i) {\r\n var _loop_4 = function (face) {\r\n // Constructs an image element from image data\r\n var bytes = imageData[i][face];\r\n var blob = new Blob([bytes], { type: 'image/png' });\r\n var url = URL.createObjectURL(blob);\r\n var promise = void 0;\r\n if (typeof Image === \"undefined\") {\r\n promise = createImageBitmap(blob).then(function (img) {\r\n return _this._OnImageReadyAsync(img, engine, expandTexture, rgbdPostProcess, url, face, i, generateNonLODTextures, lodTextures, cubeRtt, texture);\r\n });\r\n }\r\n else {\r\n var image_1 = new Image();\r\n image_1.src = url;\r\n // Enqueue promise to upload to the texture.\r\n promise = new Promise(function (resolve, reject) {\r\n image_1.onload = function () {\r\n _this._OnImageReadyAsync(image_1, engine, expandTexture, rgbdPostProcess, url, face, i, generateNonLODTextures, lodTextures, cubeRtt, texture)\r\n .then(function () { return resolve(); })\r\n .catch(function (reason) {\r\n reject(reason);\r\n });\r\n };\r\n image_1.onerror = function (error) {\r\n reject(error);\r\n };\r\n });\r\n }\r\n promises.push(promise);\r\n };\r\n // All faces\r\n for (var face = 0; face < 6; face++) {\r\n _loop_4(face);\r\n }\r\n };\r\n // All mipmaps up to provided number of images\r\n for (var i = 0; i < imageData.length; i++) {\r\n _loop_3(i);\r\n }\r\n // Fill remaining mipmaps with black textures.\r\n if (imageData.length < mipmapsCount) {\r\n var data = void 0;\r\n var size = Math.pow(2, mipmapsCount - 1 - imageData.length);\r\n var dataLength = size * size * 4;\r\n switch (texture.type) {\r\n case 0: {\r\n data = new Uint8Array(dataLength);\r\n break;\r\n }\r\n case 2: {\r\n data = new Uint16Array(dataLength);\r\n break;\r\n }\r\n case 1: {\r\n data = new Float32Array(dataLength);\r\n break;\r\n }\r\n }\r\n for (var i = imageData.length; i < mipmapsCount; i++) {\r\n for (var face = 0; face < 6; face++) {\r\n engine._uploadArrayBufferViewToTexture(texture, data, face, i);\r\n }\r\n }\r\n }\r\n // Once all done, finishes the cleanup and return\r\n return Promise.all(promises).then(function () {\r\n // Release temp RTT.\r\n if (cubeRtt) {\r\n engine._releaseFramebufferObjects(cubeRtt);\r\n engine._releaseTexture(texture);\r\n cubeRtt._swapAndDie(texture);\r\n }\r\n // Release temp Post Process.\r\n if (rgbdPostProcess) {\r\n rgbdPostProcess.dispose();\r\n }\r\n // Flag internal texture as ready in case they are in use.\r\n if (generateNonLODTextures) {\r\n if (texture._lodTextureHigh && texture._lodTextureHigh._texture) {\r\n texture._lodTextureHigh._texture.isReady = true;\r\n }\r\n if (texture._lodTextureMid && texture._lodTextureMid._texture) {\r\n texture._lodTextureMid._texture.isReady = true;\r\n }\r\n if (texture._lodTextureLow && texture._lodTextureLow._texture) {\r\n texture._lodTextureLow._texture.isReady = true;\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Uploads spherical polynomials information to the texture.\r\n * @param texture defines the texture we are trying to upload the information to\r\n * @param info defines the environment texture info retrieved through the GetEnvInfo method\r\n */\r\n EnvironmentTextureTools.UploadEnvSpherical = function (texture, info) {\r\n if (info.version !== 1) {\r\n Logger.Warn('Unsupported babylon environment map version \"' + info.version + '\"');\r\n }\r\n var irradianceInfo = info.irradiance;\r\n if (!irradianceInfo) {\r\n return;\r\n }\r\n var sp = new SphericalPolynomial();\r\n Vector3.FromArrayToRef(irradianceInfo.x, 0, sp.x);\r\n Vector3.FromArrayToRef(irradianceInfo.y, 0, sp.y);\r\n Vector3.FromArrayToRef(irradianceInfo.z, 0, sp.z);\r\n Vector3.FromArrayToRef(irradianceInfo.xx, 0, sp.xx);\r\n Vector3.FromArrayToRef(irradianceInfo.yy, 0, sp.yy);\r\n Vector3.FromArrayToRef(irradianceInfo.zz, 0, sp.zz);\r\n Vector3.FromArrayToRef(irradianceInfo.yz, 0, sp.yz);\r\n Vector3.FromArrayToRef(irradianceInfo.zx, 0, sp.zx);\r\n Vector3.FromArrayToRef(irradianceInfo.xy, 0, sp.xy);\r\n texture._sphericalPolynomial = sp;\r\n };\r\n /** @hidden */\r\n EnvironmentTextureTools._UpdateRGBDAsync = function (internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\r\n internalTexture._source = InternalTextureSource.CubeRawRGBD;\r\n internalTexture._bufferViewArrayArray = data;\r\n internalTexture._lodGenerationScale = lodScale;\r\n internalTexture._lodGenerationOffset = lodOffset;\r\n internalTexture._sphericalPolynomial = sphericalPolynomial;\r\n return EnvironmentTextureTools.UploadLevelsAsync(internalTexture, data).then(function () {\r\n internalTexture.isReady = true;\r\n });\r\n };\r\n /**\r\n * Magic number identifying the env file.\r\n */\r\n EnvironmentTextureTools._MagicBytes = [0x86, 0x16, 0x87, 0x96, 0xf6, 0xd6, 0x96, 0x36];\r\n return EnvironmentTextureTools;\r\n}());\r\nexport { EnvironmentTextureTools };\r\n// References the dependencies.\r\nInternalTexture._UpdateRGBDAsync = EnvironmentTextureTools._UpdateRGBDAsync;\r\n//# sourceMappingURL=environmentTextureTools.js.map","import { __assign } from \"tslib\";\r\nimport { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';\r\nimport { Logger } from '../../Misc/logger';\r\nimport { FileTools } from '../../Misc/fileTools';\r\nThinEngine.prototype._createDepthStencilCubeTexture = function (size, options) {\r\n var internalTexture = new InternalTexture(this, InternalTextureSource.Unknown);\r\n internalTexture.isCube = true;\r\n if (this.webGLVersion === 1) {\r\n Logger.Error(\"Depth cube texture is not supported by WebGL 1.\");\r\n return internalTexture;\r\n }\r\n var internalOptions = __assign({ bilinearFiltering: false, comparisonFunction: 0, generateStencil: false }, options);\r\n var gl = this._gl;\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, internalTexture, true);\r\n this._setupDepthStencilTexture(internalTexture, size, internalOptions.generateStencil, internalOptions.bilinearFiltering, internalOptions.comparisonFunction);\r\n // Create the depth/stencil buffer\r\n for (var face = 0; face < 6; face++) {\r\n if (internalOptions.generateStencil) {\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.DEPTH24_STENCIL8, size, size, 0, gl.DEPTH_STENCIL, gl.UNSIGNED_INT_24_8, null);\r\n }\r\n else {\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.DEPTH_COMPONENT24, size, size, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null);\r\n }\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n return internalTexture;\r\n};\r\nThinEngine.prototype._partialLoadFile = function (url, index, loadedFiles, onfinish, onErrorCallBack) {\r\n if (onErrorCallBack === void 0) { onErrorCallBack = null; }\r\n var onload = function (data) {\r\n loadedFiles[index] = data;\r\n loadedFiles._internalCount++;\r\n if (loadedFiles._internalCount === 6) {\r\n onfinish(loadedFiles);\r\n }\r\n };\r\n var onerror = function (request, exception) {\r\n if (onErrorCallBack && request) {\r\n onErrorCallBack(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n this._loadFile(url, onload, undefined, undefined, true, onerror);\r\n};\r\nThinEngine.prototype._cascadeLoadFiles = function (scene, onfinish, files, onError) {\r\n if (onError === void 0) { onError = null; }\r\n var loadedFiles = [];\r\n loadedFiles._internalCount = 0;\r\n for (var index = 0; index < 6; index++) {\r\n this._partialLoadFile(files[index], index, loadedFiles, onfinish, onError);\r\n }\r\n};\r\nThinEngine.prototype._cascadeLoadImgs = function (scene, onfinish, files, onError, mimeType) {\r\n if (onError === void 0) { onError = null; }\r\n var loadedImages = [];\r\n loadedImages._internalCount = 0;\r\n for (var index = 0; index < 6; index++) {\r\n this._partialLoadImg(files[index], index, loadedImages, scene, onfinish, onError, mimeType);\r\n }\r\n};\r\nThinEngine.prototype._partialLoadImg = function (url, index, loadedImages, scene, onfinish, onErrorCallBack, mimeType) {\r\n if (onErrorCallBack === void 0) { onErrorCallBack = null; }\r\n var img;\r\n var onload = function () {\r\n if (img) {\r\n loadedImages[index] = img;\r\n loadedImages._internalCount++;\r\n if (scene) {\r\n scene._removePendingData(img);\r\n }\r\n }\r\n if (loadedImages._internalCount === 6) {\r\n onfinish(loadedImages);\r\n }\r\n };\r\n var onerror = function (message, exception) {\r\n if (scene) {\r\n scene._removePendingData(img);\r\n }\r\n if (onErrorCallBack) {\r\n onErrorCallBack(message, exception);\r\n }\r\n };\r\n img = FileTools.LoadImage(url, onload, onerror, scene ? scene.offlineProvider : null, mimeType);\r\n if (scene && img) {\r\n scene._addPendingData(img);\r\n }\r\n};\r\nThinEngine.prototype._setCubeMapTextureParams = function (texture, loadMipmap) {\r\n var gl = this._gl;\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, loadMipmap ? gl.LINEAR_MIPMAP_LINEAR : gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n texture.samplingMode = loadMipmap ? 3 : 2;\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n};\r\nThinEngine.prototype.createCubeTexture = function (rootUrl, scene, files, noMipmap, onLoad, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset, fallback, loaderOptions) {\r\n var _this = this;\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = false; }\r\n if (lodScale === void 0) { lodScale = 0; }\r\n if (lodOffset === void 0) { lodOffset = 0; }\r\n if (fallback === void 0) { fallback = null; }\r\n var gl = this._gl;\r\n var texture = fallback ? fallback : new InternalTexture(this, InternalTextureSource.Cube);\r\n texture.isCube = true;\r\n texture.url = rootUrl;\r\n texture.generateMipMaps = !noMipmap;\r\n texture._lodGenerationScale = lodScale;\r\n texture._lodGenerationOffset = lodOffset;\r\n if (!this._doNotHandleContextLost) {\r\n texture._extension = forcedExtension;\r\n texture._files = files;\r\n }\r\n var originalRootUrl = rootUrl;\r\n if (this._transformTextureUrl && !fallback) {\r\n rootUrl = this._transformTextureUrl(rootUrl);\r\n }\r\n var lastDot = rootUrl.lastIndexOf('.');\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? rootUrl.substring(lastDot).toLowerCase() : \"\");\r\n var loader = null;\r\n for (var _i = 0, _a = ThinEngine._TextureLoaders; _i < _a.length; _i++) {\r\n var availableLoader = _a[_i];\r\n if (availableLoader.canLoad(extension)) {\r\n loader = availableLoader;\r\n break;\r\n }\r\n }\r\n var onInternalError = function (request, exception) {\r\n if (rootUrl === originalRootUrl) {\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n }\r\n else {\r\n // fall back to the original url if the transformed url fails to load\r\n Logger.Warn(\"Failed to load \" + rootUrl + \", falling back to the \" + originalRootUrl);\r\n _this.createCubeTexture(originalRootUrl, scene, files, noMipmap, onLoad, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset, texture, loaderOptions);\r\n }\r\n };\r\n if (loader) {\r\n var onloaddata_1 = function (data) {\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n loader.loadCubeData(data, texture, createPolynomials, onLoad, onError);\r\n };\r\n if (files && files.length === 6) {\r\n if (loader.supportCascades) {\r\n this._cascadeLoadFiles(scene, function (images) { return onloaddata_1(images.map(function (image) { return new Uint8Array(image); })); }, files, onError);\r\n }\r\n else {\r\n if (onError) {\r\n onError(\"Textures type does not support cascades.\");\r\n }\r\n else {\r\n Logger.Warn(\"Texture loader does not support cascades.\");\r\n }\r\n }\r\n }\r\n else {\r\n this._loadFile(rootUrl, function (data) { return onloaddata_1(new Uint8Array(data)); }, undefined, undefined, true, onInternalError);\r\n }\r\n }\r\n else {\r\n if (!files) {\r\n throw new Error(\"Cannot load cubemap because files were not defined\");\r\n }\r\n this._cascadeLoadImgs(scene, function (imgs) {\r\n var width = _this.needPOTTextures ? ThinEngine.GetExponentOfTwo(imgs[0].width, _this._caps.maxCubemapTextureSize) : imgs[0].width;\r\n var height = width;\r\n var faces = [\r\n gl.TEXTURE_CUBE_MAP_POSITIVE_X, gl.TEXTURE_CUBE_MAP_POSITIVE_Y, gl.TEXTURE_CUBE_MAP_POSITIVE_Z,\r\n gl.TEXTURE_CUBE_MAP_NEGATIVE_X, gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, gl.TEXTURE_CUBE_MAP_NEGATIVE_Z\r\n ];\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n _this._unpackFlipY(false);\r\n var internalFormat = format ? _this._getInternalFormat(format) : _this._gl.RGBA;\r\n for (var index = 0; index < faces.length; index++) {\r\n if (imgs[index].width !== width || imgs[index].height !== height) {\r\n _this._prepareWorkingCanvas();\r\n if (!_this._workingCanvas || !_this._workingContext) {\r\n Logger.Warn(\"Cannot create canvas to resize texture.\");\r\n return;\r\n }\r\n _this._workingCanvas.width = width;\r\n _this._workingCanvas.height = height;\r\n _this._workingContext.drawImage(imgs[index], 0, 0, imgs[index].width, imgs[index].height, 0, 0, width, height);\r\n gl.texImage2D(faces[index], 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, _this._workingCanvas);\r\n }\r\n else {\r\n gl.texImage2D(faces[index], 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, imgs[index]);\r\n }\r\n }\r\n if (!noMipmap) {\r\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\r\n }\r\n _this._setCubeMapTextureParams(texture, !noMipmap);\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n if (format) {\r\n texture.format = format;\r\n }\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n }, files, onError);\r\n }\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\n//# sourceMappingURL=engine.cubeTexture.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, serializeAsMatrix, SerializationHelper } from \"../../Misc/decorators\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { Matrix, Vector3 } from \"../../Maths/math.vector\";\r\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { _TypeStore } from '../../Misc/typeStore';\r\nimport \"../../Engines/Extensions/engine.cubeTexture\";\r\nimport { StringTools } from '../../Misc/stringTools';\r\nimport { Observable } from '../../Misc/observable';\r\n/**\r\n * Class for creating a cube texture\r\n */\r\nvar CubeTexture = /** @class */ (function (_super) {\r\n __extends(CubeTexture, _super);\r\n /**\r\n * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well\r\n * as prefiltered data.\r\n * @param rootUrl defines the url of the texture or the root name of the six images\r\n * @param null defines the scene or engine the texture is attached to\r\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\r\n * @param noMipmap defines if mipmaps should be created or not\r\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\r\n * @param onLoad defines a callback triggered at the end of the file load if no errors occured\r\n * @param onError defines a callback triggered in case of error during load\r\n * @param format defines the internal format to use for the texture once loaded\r\n * @param prefiltered defines whether or not the texture is created from prefiltered data\r\n * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @param loaderOptions options to be passed to the loader\r\n * @return the cube texture\r\n */\r\n function CubeTexture(rootUrl, sceneOrEngine, extensions, noMipmap, files, onLoad, onError, format, prefiltered, forcedExtension, createPolynomials, lodScale, lodOffset, loaderOptions) {\r\n if (extensions === void 0) { extensions = null; }\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (files === void 0) { files = null; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (format === void 0) { format = 5; }\r\n if (prefiltered === void 0) { prefiltered = false; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = false; }\r\n if (lodScale === void 0) { lodScale = 0.8; }\r\n if (lodOffset === void 0) { lodOffset = 0; }\r\n var _a;\r\n var _this = _super.call(this, sceneOrEngine) || this;\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n _this.onLoadObservable = new Observable();\r\n /**\r\n * Gets or sets the center of the bounding box associated with the cube texture.\r\n * It must define where the camera used to render the texture was set\r\n * @see https://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode\r\n */\r\n _this.boundingBoxPosition = Vector3.Zero();\r\n _this._rotationY = 0;\r\n _this._files = null;\r\n _this._forcedExtension = null;\r\n _this._extensions = null;\r\n _this.name = rootUrl;\r\n _this.url = rootUrl;\r\n _this._noMipmap = noMipmap;\r\n _this.hasAlpha = false;\r\n _this._format = format;\r\n _this.isCube = true;\r\n _this._textureMatrix = Matrix.Identity();\r\n _this._createPolynomials = createPolynomials;\r\n _this.coordinatesMode = Texture.CUBIC_MODE;\r\n _this._extensions = extensions;\r\n _this._files = files;\r\n _this._forcedExtension = forcedExtension;\r\n _this._loaderOptions = loaderOptions;\r\n if (!rootUrl && !files) {\r\n return _this;\r\n }\r\n var lastDot = rootUrl.lastIndexOf(\".\");\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? rootUrl.substring(lastDot).toLowerCase() : \"\");\r\n var isDDS = (extension === \".dds\");\r\n var isEnv = (extension === \".env\");\r\n if (isEnv) {\r\n _this.gammaSpace = false;\r\n _this._prefiltered = false;\r\n _this.anisotropicFilteringLevel = 1;\r\n }\r\n else {\r\n _this._prefiltered = prefiltered;\r\n if (prefiltered) {\r\n _this.gammaSpace = false;\r\n _this.anisotropicFilteringLevel = 1;\r\n }\r\n }\r\n _this._texture = _this._getFromCache(rootUrl, noMipmap);\r\n if (!files) {\r\n if (!isEnv && !isDDS && !extensions) {\r\n extensions = [\"_px.jpg\", \"_py.jpg\", \"_pz.jpg\", \"_nx.jpg\", \"_ny.jpg\", \"_nz.jpg\"];\r\n }\r\n files = [];\r\n if (extensions) {\r\n for (var index = 0; index < extensions.length; index++) {\r\n files.push(rootUrl + extensions[index]);\r\n }\r\n }\r\n }\r\n _this._files = files;\r\n var onLoadProcessing = function () {\r\n _this.onLoadObservable.notifyObservers(_this);\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n if (!_this._texture) {\r\n var scene = _this.getScene();\r\n if (!(scene === null || scene === void 0 ? void 0 : scene.useDelayedTextureLoading)) {\r\n if (prefiltered) {\r\n _this._texture = _this._getEngine().createPrefilteredCubeTexture(rootUrl, scene, lodScale, lodOffset, onLoad, onError, format, forcedExtension, _this._createPolynomials);\r\n }\r\n else {\r\n _this._texture = _this._getEngine().createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError, _this._format, forcedExtension, false, lodScale, lodOffset, null, loaderOptions);\r\n }\r\n (_a = _this._texture) === null || _a === void 0 ? void 0 : _a.onLoadedObservable.add(function () { return _this.onLoadObservable.notifyObservers(_this); });\r\n }\r\n else {\r\n _this.delayLoadState = 4;\r\n }\r\n }\r\n else {\r\n if (_this._texture.isReady) {\r\n Tools.SetImmediate(function () { return onLoadProcessing(); });\r\n }\r\n else {\r\n _this._texture.onLoadedObservable.add(function () { return onLoadProcessing(); });\r\n }\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(CubeTexture.prototype, \"boundingBoxSize\", {\r\n /**\r\n * Returns the bounding box size\r\n * @see https://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode\r\n */\r\n get: function () {\r\n return this._boundingBoxSize;\r\n },\r\n /**\r\n * Gets or sets the size of the bounding box associated with the cube texture\r\n * When defined, the cubemap will switch to local mode\r\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\r\n * @example https://www.babylonjs-playground.com/#RNASML\r\n */\r\n set: function (value) {\r\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\r\n return;\r\n }\r\n this._boundingBoxSize = value;\r\n var scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(1);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(CubeTexture.prototype, \"rotationY\", {\r\n /**\r\n * Gets texture matrix rotation angle around Y axis radians.\r\n */\r\n get: function () {\r\n return this._rotationY;\r\n },\r\n /**\r\n * Sets texture matrix rotation angle around Y axis in radians.\r\n */\r\n set: function (value) {\r\n this._rotationY = value;\r\n this.setReflectionTextureMatrix(Matrix.RotationY(this._rotationY));\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(CubeTexture.prototype, \"noMipmap\", {\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n get: function () {\r\n return this._noMipmap;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a cube texture from an array of image urls\r\n * @param files defines an array of image urls\r\n * @param scene defines the hosting scene\r\n * @param noMipmap specifies if mip maps are not used\r\n * @returns a cube texture\r\n */\r\n CubeTexture.CreateFromImages = function (files, scene, noMipmap) {\r\n var rootUrlKey = \"\";\r\n files.forEach(function (url) { return rootUrlKey += url; });\r\n return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);\r\n };\r\n /**\r\n * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.\r\n * @param url defines the url of the prefiltered texture\r\n * @param scene defines the scene the texture is attached to\r\n * @param forcedExtension defines the extension of the file if different from the url\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @return the prefiltered texture\r\n */\r\n CubeTexture.CreateFromPrefilteredData = function (url, scene, forcedExtension, createPolynomials) {\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = true; }\r\n var oldValue = scene.useDelayedTextureLoading;\r\n scene.useDelayedTextureLoading = false;\r\n var result = new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);\r\n scene.useDelayedTextureLoading = oldValue;\r\n return result;\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"CubeTexture\"\r\n */\r\n CubeTexture.prototype.getClassName = function () {\r\n return \"CubeTexture\";\r\n };\r\n /**\r\n * Update the url (and optional buffer) of this texture if url was null during construction.\r\n * @param url the url of the texture\r\n * @param forcedExtension defines the extension to use\r\n * @param onLoad callback called when the texture is loaded (defaults to null)\r\n * @param prefiltered Defines whether the updated texture is prefiltered or not\r\n */\r\n CubeTexture.prototype.updateURL = function (url, forcedExtension, onLoad, prefiltered) {\r\n var _a;\r\n if (prefiltered === void 0) { prefiltered = false; }\r\n if (this.url) {\r\n this.releaseInternalTexture();\r\n (_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.markAllMaterialsAsDirty(1);\r\n }\r\n if (!this.name || StringTools.StartsWith(this.name, \"data:\")) {\r\n this.name = url;\r\n }\r\n this.url = url;\r\n this.delayLoadState = 4;\r\n this._prefiltered = prefiltered;\r\n if (this._prefiltered) {\r\n this.gammaSpace = false;\r\n this.anisotropicFilteringLevel = 1;\r\n }\r\n this._forcedExtension = forcedExtension || null;\r\n if (onLoad) {\r\n this._delayedOnLoad = onLoad;\r\n }\r\n this.delayLoad(forcedExtension);\r\n };\r\n /**\r\n * Delays loading of the cube texture\r\n * @param forcedExtension defines the extension to use\r\n */\r\n CubeTexture.prototype.delayLoad = function (forcedExtension) {\r\n var _this = this;\r\n var _a;\r\n if (this.delayLoadState !== 4) {\r\n return;\r\n }\r\n this.delayLoadState = 1;\r\n this._texture = this._getFromCache(this.url, this._noMipmap);\r\n if (!this._texture) {\r\n var scene = this.getScene();\r\n if (this._prefiltered) {\r\n this._texture = this._getEngine().createPrefilteredCubeTexture(this.url, scene, 0.8, 0, this._delayedOnLoad, undefined, this._format, forcedExtension, this._createPolynomials);\r\n }\r\n else {\r\n this._texture = this._getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, null, this._format, forcedExtension, false, 0, 0, null, this._loaderOptions);\r\n }\r\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.onLoadedObservable.add(function () { return _this.onLoadObservable.notifyObservers(_this); });\r\n }\r\n };\r\n /**\r\n * Returns the reflection texture matrix\r\n * @returns the reflection texture matrix\r\n */\r\n CubeTexture.prototype.getReflectionTextureMatrix = function () {\r\n return this._textureMatrix;\r\n };\r\n /**\r\n * Sets the reflection texture matrix\r\n * @param value Reflection texture matrix\r\n */\r\n CubeTexture.prototype.setReflectionTextureMatrix = function (value) {\r\n var _this = this;\r\n var _a;\r\n if (value.updateFlag === this._textureMatrix.updateFlag) {\r\n return;\r\n }\r\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\r\n (_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.markAllMaterialsAsDirty(1, function (mat) { return mat.getActiveTextures().indexOf(_this) !== -1; });\r\n }\r\n this._textureMatrix = value;\r\n };\r\n /**\r\n * Parses text to create a cube texture\r\n * @param parsedTexture define the serialized text to read from\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url of the cube texture\r\n * @returns a cube texture\r\n */\r\n CubeTexture.Parse = function (parsedTexture, scene, rootUrl) {\r\n var texture = SerializationHelper.Parse(function () {\r\n var prefiltered = false;\r\n if (parsedTexture.prefiltered) {\r\n prefiltered = parsedTexture.prefiltered;\r\n }\r\n return new CubeTexture(rootUrl + parsedTexture.name, scene, parsedTexture.extensions, false, parsedTexture.files || null, null, null, undefined, prefiltered, parsedTexture.forcedExtension);\r\n }, parsedTexture, scene);\r\n // Local Cubemaps\r\n if (parsedTexture.boundingBoxPosition) {\r\n texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);\r\n }\r\n if (parsedTexture.boundingBoxSize) {\r\n texture.boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);\r\n }\r\n // Animations\r\n if (parsedTexture.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedTexture.animations[animationIndex];\r\n var internalClass = _TypeStore.GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n texture.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Makes a clone, or deep copy, of the cube texture\r\n * @returns a new cube texture\r\n */\r\n CubeTexture.prototype.clone = function () {\r\n var _this = this;\r\n var uniqueId = 0;\r\n var newCubeTexture = SerializationHelper.Clone(function () {\r\n var cubeTexture = new CubeTexture(_this.url, _this.getScene() || _this._getEngine(), _this._extensions, _this._noMipmap, _this._files);\r\n uniqueId = cubeTexture.uniqueId;\r\n return cubeTexture;\r\n }, this);\r\n newCubeTexture.uniqueId = uniqueId;\r\n return newCubeTexture;\r\n };\r\n __decorate([\r\n serialize()\r\n ], CubeTexture.prototype, \"url\", void 0);\r\n __decorate([\r\n serialize(\"rotationY\")\r\n ], CubeTexture.prototype, \"rotationY\", null);\r\n __decorate([\r\n serialize(\"files\")\r\n ], CubeTexture.prototype, \"_files\", void 0);\r\n __decorate([\r\n serialize(\"forcedExtension\")\r\n ], CubeTexture.prototype, \"_forcedExtension\", void 0);\r\n __decorate([\r\n serialize(\"extensions\")\r\n ], CubeTexture.prototype, \"_extensions\", void 0);\r\n __decorate([\r\n serializeAsMatrix(\"textureMatrix\")\r\n ], CubeTexture.prototype, \"_textureMatrix\", void 0);\r\n return CubeTexture;\r\n}(BaseTexture));\r\nexport { CubeTexture };\r\nTexture._CubeTextureParser = CubeTexture.Parse;\r\n// Some exporters relies on Tools.Instantiate\r\n_TypeStore.RegisteredTypes[\"BABYLON.CubeTexture\"] = CubeTexture;\r\n//# sourceMappingURL=cubeTexture.js.map","import { __extends } from \"tslib\";\r\nimport { SerializationHelper } from \"../../Misc/decorators\";\r\nimport { EnvironmentTextureTools } from \"../../Misc/environmentTextureTools\";\r\nimport { InternalTextureSource } from \"./internalTexture\";\r\nimport { CubeTexture } from \"./cubeTexture\";\r\nimport \"../../Engines/Extensions/engine.rawTexture\";\r\n/**\r\n * Raw cube texture where the raw buffers are passed in\r\n */\r\nvar RawCubeTexture = /** @class */ (function (_super) {\r\n __extends(RawCubeTexture, _super);\r\n /**\r\n * Creates a cube texture where the raw buffers are passed in.\r\n * @param scene defines the scene the texture is attached to\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n */\r\n function RawCubeTexture(scene, data, size, format, type, generateMipMaps, invertY, samplingMode, compression) {\r\n if (format === void 0) { format = 5; }\r\n if (type === void 0) { type = 0; }\r\n if (generateMipMaps === void 0) { generateMipMaps = false; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (compression === void 0) { compression = null; }\r\n var _this = _super.call(this, \"\", scene) || this;\r\n _this._texture = scene.getEngine().createRawCubeTexture(data, size, format, type, generateMipMaps, invertY, samplingMode, compression);\r\n return _this;\r\n }\r\n /**\r\n * Updates the raw cube texture.\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param level defines which level of the texture to update\r\n */\r\n RawCubeTexture.prototype.update = function (data, format, type, invertY, compression) {\r\n if (compression === void 0) { compression = null; }\r\n this._texture.getEngine().updateRawCubeTexture(this._texture, data, format, type, invertY, compression);\r\n };\r\n /**\r\n * Updates a raw cube texture with RGBD encoded data.\r\n * @param data defines the array of data [mipmap][face] to use to create each face\r\n * @param sphericalPolynomial defines the spherical polynomial for irradiance\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @returns a promsie that resolves when the operation is complete\r\n */\r\n RawCubeTexture.prototype.updateRGBDAsync = function (data, sphericalPolynomial, lodScale, lodOffset) {\r\n if (sphericalPolynomial === void 0) { sphericalPolynomial = null; }\r\n if (lodScale === void 0) { lodScale = 0.8; }\r\n if (lodOffset === void 0) { lodOffset = 0; }\r\n return RawCubeTexture._UpdateRGBDAsync(this._texture, data, sphericalPolynomial, lodScale, lodOffset);\r\n };\r\n /**\r\n * Clones the raw cube texture.\r\n * @return a new cube texture\r\n */\r\n RawCubeTexture.prototype.clone = function () {\r\n var _this = this;\r\n return SerializationHelper.Clone(function () {\r\n var scene = _this.getScene();\r\n var internalTexture = _this._texture;\r\n var texture = new RawCubeTexture(scene, internalTexture._bufferViewArray, internalTexture.width, internalTexture.format, internalTexture.type, internalTexture.generateMipMaps, internalTexture.invertY, internalTexture.samplingMode, internalTexture._compression);\r\n if (internalTexture.source === InternalTextureSource.CubeRawRGBD) {\r\n texture.updateRGBDAsync(internalTexture._bufferViewArrayArray, internalTexture._sphericalPolynomial, internalTexture._lodGenerationScale, internalTexture._lodGenerationOffset);\r\n }\r\n return texture;\r\n }, this);\r\n };\r\n /** @hidden */\r\n RawCubeTexture._UpdateRGBDAsync = function (internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\r\n internalTexture._source = InternalTextureSource.CubeRawRGBD;\r\n internalTexture._bufferViewArrayArray = data;\r\n internalTexture._lodGenerationScale = lodScale;\r\n internalTexture._lodGenerationOffset = lodOffset;\r\n internalTexture._sphericalPolynomial = sphericalPolynomial;\r\n return EnvironmentTextureTools.UploadLevelsAsync(internalTexture, data).then(function () {\r\n internalTexture.isReady = true;\r\n });\r\n };\r\n return RawCubeTexture;\r\n}(CubeTexture));\r\nexport { RawCubeTexture };\r\n//# sourceMappingURL=rawCubeTexture.js.map","import { Scalar } from \"@babylonjs/core/Maths/math.scalar\";\r\nimport { SphericalHarmonics, SphericalPolynomial } from \"@babylonjs/core/Maths/sphericalPolynomial\";\r\nimport { Quaternion, Matrix } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { RawCubeTexture } from \"@babylonjs/core/Materials/Textures/rawCubeTexture\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nvar NAME = \"EXT_lights_image_based\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_lights_image_based/README.md)\r\n */\r\nvar EXT_lights_image_based = /** @class */ (function () {\r\n /** @hidden */\r\n function EXT_lights_image_based(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n EXT_lights_image_based.prototype.dispose = function () {\r\n this._loader = null;\r\n delete this._lights;\r\n };\r\n /** @hidden */\r\n EXT_lights_image_based.prototype.onLoading = function () {\r\n var extensions = this._loader.gltf.extensions;\r\n if (extensions && extensions[this.name]) {\r\n var extension = extensions[this.name];\r\n this._lights = extension.lights;\r\n }\r\n };\r\n /** @hidden */\r\n EXT_lights_image_based.prototype.loadSceneAsync = function (context, scene) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, scene, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadSceneAsync(context, scene));\r\n _this._loader.logOpen(\"\" + extensionContext);\r\n var light = ArrayItem.Get(extensionContext + \"/light\", _this._lights, extension.light);\r\n promises.push(_this._loadLightAsync(\"/extensions/\" + _this.name + \"/lights/\" + extension.light, light).then(function (texture) {\r\n _this._loader.babylonScene.environmentTexture = texture;\r\n }));\r\n _this._loader.logClose();\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n EXT_lights_image_based.prototype._loadLightAsync = function (context, light) {\r\n var _this = this;\r\n if (!light._loaded) {\r\n var promises = new Array();\r\n this._loader.logOpen(\"\" + context);\r\n var imageData_1 = new Array(light.specularImages.length);\r\n var _loop_1 = function (mipmap) {\r\n var faces = light.specularImages[mipmap];\r\n imageData_1[mipmap] = new Array(faces.length);\r\n var _loop_2 = function (face) {\r\n var specularImageContext = context + \"/specularImages/\" + mipmap + \"/\" + face;\r\n this_1._loader.logOpen(\"\" + specularImageContext);\r\n var index = faces[face];\r\n var image = ArrayItem.Get(specularImageContext, this_1._loader.gltf.images, index);\r\n promises.push(this_1._loader.loadImageAsync(\"/images/\" + index, image).then(function (data) {\r\n imageData_1[mipmap][face] = data;\r\n }));\r\n this_1._loader.logClose();\r\n };\r\n for (var face = 0; face < faces.length; face++) {\r\n _loop_2(face);\r\n }\r\n };\r\n var this_1 = this;\r\n for (var mipmap = 0; mipmap < light.specularImages.length; mipmap++) {\r\n _loop_1(mipmap);\r\n }\r\n this._loader.logClose();\r\n light._loaded = Promise.all(promises).then(function () {\r\n var babylonTexture = new RawCubeTexture(_this._loader.babylonScene, null, light.specularImageSize);\r\n babylonTexture.name = light.name || \"environment\";\r\n light._babylonTexture = babylonTexture;\r\n if (light.intensity != undefined) {\r\n babylonTexture.level = light.intensity;\r\n }\r\n if (light.rotation) {\r\n var rotation = Quaternion.FromArray(light.rotation);\r\n // Invert the rotation so that positive rotation is counter-clockwise.\r\n if (!_this._loader.babylonScene.useRightHandedSystem) {\r\n rotation = Quaternion.Inverse(rotation);\r\n }\r\n Matrix.FromQuaternionToRef(rotation, babylonTexture.getReflectionTextureMatrix());\r\n }\r\n var sphericalHarmonics = SphericalHarmonics.FromArray(light.irradianceCoefficients);\r\n sphericalHarmonics.scaleInPlace(light.intensity);\r\n sphericalHarmonics.convertIrradianceToLambertianRadiance();\r\n var sphericalPolynomial = SphericalPolynomial.FromHarmonics(sphericalHarmonics);\r\n // Compute the lod generation scale to fit exactly to the number of levels available.\r\n var lodGenerationScale = (imageData_1.length - 1) / Scalar.Log2(light.specularImageSize);\r\n return babylonTexture.updateRGBDAsync(imageData_1, sphericalPolynomial, lodGenerationScale);\r\n });\r\n }\r\n return light._loaded.then(function () {\r\n return light._babylonTexture;\r\n });\r\n };\r\n return EXT_lights_image_based;\r\n}());\r\nexport { EXT_lights_image_based };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_lights_image_based(loader); });\r\n//# sourceMappingURL=EXT_lights_image_based.js.map","import { Vector3, Quaternion, Matrix } from '@babylonjs/core/Maths/math.vector';\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport { TmpVectors } from '@babylonjs/core/Maths/math.vector';\r\nvar NAME = \"EXT_mesh_gpu_instancing\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1691)\r\n * [Playground Sample](https://playground.babylonjs.com/#QFIGLW#9)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar EXT_mesh_gpu_instancing = /** @class */ (function () {\r\n /** @hidden */\r\n function EXT_mesh_gpu_instancing(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n EXT_mesh_gpu_instancing.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n EXT_mesh_gpu_instancing.prototype.loadNodeAsync = function (context, node, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {\r\n _this._loader._disableInstancedMesh++;\r\n var promise = _this._loader.loadNodeAsync(\"/nodes/\" + node.index, node, assign);\r\n _this._loader._disableInstancedMesh--;\r\n if (!node._primitiveBabylonMeshes) {\r\n return promise;\r\n }\r\n var promises = new Array();\r\n var instanceCount = 0;\r\n var loadAttribute = function (attribute) {\r\n if (extension.attributes[attribute] == undefined) {\r\n promises.push(Promise.resolve(null));\r\n return;\r\n }\r\n var accessor = ArrayItem.Get(extensionContext + \"/attributes/\" + attribute, _this._loader.gltf.accessors, extension.attributes[attribute]);\r\n promises.push(_this._loader._loadFloatAccessorAsync(\"/accessors/\" + accessor.bufferView, accessor));\r\n if (instanceCount === 0) {\r\n instanceCount = accessor.count;\r\n }\r\n else if (instanceCount !== accessor.count) {\r\n throw new Error(extensionContext + \"/attributes: Instance buffer accessors do not have the same count.\");\r\n }\r\n };\r\n loadAttribute(\"TRANSLATION\");\r\n loadAttribute(\"ROTATION\");\r\n loadAttribute(\"SCALE\");\r\n return promise.then(function (babylonTransformNode) {\r\n return Promise.all(promises).then(function (_a) {\r\n var translationBuffer = _a[0], rotationBuffer = _a[1], scaleBuffer = _a[2];\r\n var matrices = new Float32Array(instanceCount * 16);\r\n TmpVectors.Vector3[0].copyFromFloats(0, 0, 0); // translation\r\n TmpVectors.Quaternion[0].copyFromFloats(0, 0, 0, 1); // rotation\r\n TmpVectors.Vector3[1].copyFromFloats(1, 1, 1); // scale\r\n for (var i = 0; i < instanceCount; ++i) {\r\n translationBuffer && Vector3.FromArrayToRef(translationBuffer, i * 3, TmpVectors.Vector3[0]);\r\n rotationBuffer && Quaternion.FromArrayToRef(rotationBuffer, i * 4, TmpVectors.Quaternion[0]);\r\n scaleBuffer && Vector3.FromArrayToRef(scaleBuffer, i * 3, TmpVectors.Vector3[1]);\r\n Matrix.ComposeToRef(TmpVectors.Vector3[1], TmpVectors.Quaternion[0], TmpVectors.Vector3[0], TmpVectors.Matrix[0]);\r\n TmpVectors.Matrix[0].copyToArray(matrices, i * 16);\r\n }\r\n for (var _i = 0, _b = node._primitiveBabylonMeshes; _i < _b.length; _i++) {\r\n var babylonMesh = _b[_i];\r\n babylonMesh.thinInstanceSetBuffer(\"matrix\", matrices, 16, true);\r\n }\r\n return babylonTransformNode;\r\n });\r\n });\r\n });\r\n };\r\n return EXT_mesh_gpu_instancing;\r\n}());\r\nexport { EXT_mesh_gpu_instancing };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_mesh_gpu_instancing(loader); });\r\n//# sourceMappingURL=EXT_mesh_gpu_instancing.js.map","import { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nvar NAME = \"EXT_texture_webp\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_texture_webp/)\r\n */\r\nvar EXT_texture_webp = /** @class */ (function () {\r\n /** @hidden */\r\n function EXT_texture_webp(loader) {\r\n /** The name of this extension. */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n EXT_texture_webp.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n EXT_texture_webp.prototype._loadTextureAsync = function (context, texture, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, texture, this.name, function (extensionContext, extension) {\r\n var sampler = (texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(context + \"/sampler\", _this._loader.gltf.samplers, texture.sampler));\r\n var image = ArrayItem.Get(extensionContext + \"/source\", _this._loader.gltf.images, extension.source);\r\n return _this._loader._createTextureAsync(context, sampler, image, function (babylonTexture) {\r\n assign(babylonTexture);\r\n });\r\n });\r\n };\r\n return EXT_texture_webp;\r\n}());\r\nexport { EXT_texture_webp };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_texture_webp(loader); });\r\n//# sourceMappingURL=EXT_texture_webp.js.map","/**\r\n * Helper class to push actions to a pool of workers.\r\n */\r\nvar WorkerPool = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param workers Array of workers to use for actions\r\n */\r\n function WorkerPool(workers) {\r\n this._pendingActions = new Array();\r\n this._workerInfos = workers.map(function (worker) { return ({\r\n worker: worker,\r\n active: false\r\n }); });\r\n }\r\n /**\r\n * Terminates all workers and clears any pending actions.\r\n */\r\n WorkerPool.prototype.dispose = function () {\r\n for (var _i = 0, _a = this._workerInfos; _i < _a.length; _i++) {\r\n var workerInfo = _a[_i];\r\n workerInfo.worker.terminate();\r\n }\r\n this._workerInfos = [];\r\n this._pendingActions = [];\r\n };\r\n /**\r\n * Pushes an action to the worker pool. If all the workers are active, the action will be\r\n * pended until a worker has completed its action.\r\n * @param action The action to perform. Call onComplete when the action is complete.\r\n */\r\n WorkerPool.prototype.push = function (action) {\r\n for (var _i = 0, _a = this._workerInfos; _i < _a.length; _i++) {\r\n var workerInfo = _a[_i];\r\n if (!workerInfo.active) {\r\n this._execute(workerInfo, action);\r\n return;\r\n }\r\n }\r\n this._pendingActions.push(action);\r\n };\r\n WorkerPool.prototype._execute = function (workerInfo, action) {\r\n var _this = this;\r\n workerInfo.active = true;\r\n action(workerInfo.worker, function () {\r\n workerInfo.active = false;\r\n var nextAction = _this._pendingActions.shift();\r\n if (nextAction) {\r\n _this._execute(workerInfo, nextAction);\r\n }\r\n });\r\n };\r\n return WorkerPool;\r\n}());\r\nexport { WorkerPool };\r\n//# sourceMappingURL=workerPool.js.map","import { Tools } from \"../../Misc/tools\";\r\nimport { WorkerPool } from '../../Misc/workerPool';\r\nimport { VertexData } from \"../../Meshes/mesh.vertexData\";\r\nfunction createDecoderAsync(wasmBinary) {\r\n return new Promise(function (resolve) {\r\n DracoDecoderModule({ wasmBinary: wasmBinary }).then(function (module) {\r\n resolve({ module: module });\r\n });\r\n });\r\n}\r\nfunction decodeMesh(decoderModule, dataView, attributes, onIndicesData, onAttributeData) {\r\n var buffer = new decoderModule.DecoderBuffer();\r\n buffer.Init(dataView, dataView.byteLength);\r\n var decoder = new decoderModule.Decoder();\r\n var geometry;\r\n var status;\r\n try {\r\n var type = decoder.GetEncodedGeometryType(buffer);\r\n switch (type) {\r\n case decoderModule.TRIANGULAR_MESH:\r\n geometry = new decoderModule.Mesh();\r\n status = decoder.DecodeBufferToMesh(buffer, geometry);\r\n break;\r\n case decoderModule.POINT_CLOUD:\r\n geometry = new decoderModule.PointCloud();\r\n status = decoder.DecodeBufferToPointCloud(buffer, geometry);\r\n break;\r\n default:\r\n throw new Error(\"Invalid geometry type \" + type);\r\n }\r\n if (!status.ok() || !geometry.ptr) {\r\n throw new Error(status.error_msg());\r\n }\r\n if (type === decoderModule.TRIANGULAR_MESH) {\r\n var numFaces = geometry.num_faces();\r\n var numIndices = numFaces * 3;\r\n var byteLength = numIndices * 4;\r\n var ptr = decoderModule._malloc(byteLength);\r\n try {\r\n decoder.GetTrianglesUInt32Array(geometry, byteLength, ptr);\r\n var indices = new Uint32Array(numIndices);\r\n indices.set(new Uint32Array(decoderModule.HEAPF32.buffer, ptr, numIndices));\r\n onIndicesData(indices);\r\n }\r\n finally {\r\n decoderModule._free(ptr);\r\n }\r\n }\r\n var processAttribute = function (kind, attribute) {\r\n var numComponents = attribute.num_components();\r\n var numPoints = geometry.num_points();\r\n var numValues = numPoints * numComponents;\r\n var byteLength = numValues * Float32Array.BYTES_PER_ELEMENT;\r\n var ptr = decoderModule._malloc(byteLength);\r\n try {\r\n decoder.GetAttributeDataArrayForAllPoints(geometry, attribute, decoderModule.DT_FLOAT32, byteLength, ptr);\r\n var values = new Float32Array(decoderModule.HEAPF32.buffer, ptr, numValues);\r\n if (kind === \"color\" && numComponents === 3) {\r\n var babylonData = new Float32Array(numPoints * 4);\r\n for (var i = 0, j = 0; i < babylonData.length; i += 4, j += numComponents) {\r\n babylonData[i + 0] = values[j + 0];\r\n babylonData[i + 1] = values[j + 1];\r\n babylonData[i + 2] = values[j + 2];\r\n babylonData[i + 3] = 1;\r\n }\r\n onAttributeData(kind, babylonData);\r\n }\r\n else {\r\n var babylonData = new Float32Array(numValues);\r\n babylonData.set(new Float32Array(decoderModule.HEAPF32.buffer, ptr, numValues));\r\n onAttributeData(kind, babylonData);\r\n }\r\n }\r\n finally {\r\n decoderModule._free(ptr);\r\n }\r\n };\r\n if (attributes) {\r\n for (var kind in attributes) {\r\n var id = attributes[kind];\r\n var attribute = decoder.GetAttributeByUniqueId(geometry, id);\r\n processAttribute(kind, attribute);\r\n }\r\n }\r\n else {\r\n var nativeAttributeTypes = {\r\n \"position\": \"POSITION\",\r\n \"normal\": \"NORMAL\",\r\n \"color\": \"COLOR\",\r\n \"uv\": \"TEX_COORD\"\r\n };\r\n for (var kind in nativeAttributeTypes) {\r\n var id = decoder.GetAttributeId(geometry, decoderModule[nativeAttributeTypes[kind]]);\r\n if (id !== -1) {\r\n var attribute = decoder.GetAttribute(geometry, id);\r\n processAttribute(kind, attribute);\r\n }\r\n }\r\n }\r\n }\r\n finally {\r\n if (geometry) {\r\n decoderModule.destroy(geometry);\r\n }\r\n decoderModule.destroy(decoder);\r\n decoderModule.destroy(buffer);\r\n }\r\n}\r\n/**\r\n * The worker function that gets converted to a blob url to pass into a worker.\r\n */\r\nfunction worker() {\r\n var decoderPromise;\r\n onmessage = function (event) {\r\n var data = event.data;\r\n switch (data.id) {\r\n case \"init\": {\r\n var decoder = data.decoder;\r\n if (decoder.url) {\r\n importScripts(decoder.url);\r\n decoderPromise = DracoDecoderModule({ wasmBinary: decoder.wasmBinary });\r\n }\r\n postMessage(\"done\");\r\n break;\r\n }\r\n case \"decodeMesh\": {\r\n if (!decoderPromise) {\r\n throw new Error(\"Draco decoder module is not available\");\r\n }\r\n decoderPromise.then(function (decoder) {\r\n decodeMesh(decoder, data.dataView, data.attributes, function (indices) {\r\n postMessage({ id: \"indices\", value: indices }, [indices.buffer]);\r\n }, function (kind, data) {\r\n postMessage({ id: kind, value: data }, [data.buffer]);\r\n });\r\n postMessage(\"done\");\r\n });\r\n break;\r\n }\r\n }\r\n };\r\n}\r\nfunction getAbsoluteUrl(url) {\r\n if (typeof document !== \"object\" || typeof url !== \"string\") {\r\n return url;\r\n }\r\n return Tools.GetAbsoluteUrl(url);\r\n}\r\n/**\r\n * Draco compression (https://google.github.io/draco/)\r\n *\r\n * This class wraps the Draco module.\r\n *\r\n * **Encoder**\r\n *\r\n * The encoder is not currently implemented.\r\n *\r\n * **Decoder**\r\n *\r\n * By default, the configuration points to a copy of the Draco decoder files for glTF from the babylon.js preview cdn https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js.\r\n *\r\n * To update the configuration, use the following code:\r\n * ```javascript\r\n * DracoCompression.Configuration = {\r\n * decoder: {\r\n * wasmUrl: \"\",\r\n * wasmBinaryUrl: \"\",\r\n * fallbackUrl: \"\",\r\n * }\r\n * };\r\n * ```\r\n *\r\n * Draco has two versions, one for WebAssembly and one for JavaScript. The decoder configuration can be set to only support Webssembly or only support the JavaScript version.\r\n * Decoding will automatically fallback to the JavaScript version if WebAssembly version is not configured or if WebAssembly is not supported by the browser.\r\n * Use `DracoCompression.DecoderAvailable` to determine if the decoder configuration is available for the current context.\r\n *\r\n * To decode Draco compressed data, get the default DracoCompression object and call decodeMeshAsync:\r\n * ```javascript\r\n * var vertexData = await DracoCompression.Default.decodeMeshAsync(data);\r\n * ```\r\n *\r\n * @see https://www.babylonjs-playground.com/#N3EK4B#0\r\n */\r\nvar DracoCompression = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param numWorkers The number of workers for async operations. Specify `0` to disable web workers and run synchronously in the current context.\r\n */\r\n function DracoCompression(numWorkers) {\r\n if (numWorkers === void 0) { numWorkers = DracoCompression.DefaultNumWorkers; }\r\n var decoder = DracoCompression.Configuration.decoder;\r\n var decoderInfo = (decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === \"object\") ? {\r\n url: decoder.wasmUrl,\r\n wasmBinaryPromise: Tools.LoadFileAsync(getAbsoluteUrl(decoder.wasmBinaryUrl))\r\n } : {\r\n url: decoder.fallbackUrl,\r\n wasmBinaryPromise: Promise.resolve(undefined)\r\n };\r\n if (numWorkers && typeof Worker === \"function\") {\r\n this._workerPoolPromise = decoderInfo.wasmBinaryPromise.then(function (decoderWasmBinary) {\r\n var workerContent = decodeMesh + \"(\" + worker + \")()\";\r\n var workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: \"application/javascript\" }));\r\n var workerPromises = new Array(numWorkers);\r\n for (var i = 0; i < workerPromises.length; i++) {\r\n workerPromises[i] = new Promise(function (resolve, reject) {\r\n var worker = new Worker(workerBlobUrl);\r\n var onError = function (error) {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n };\r\n var onMessage = function (message) {\r\n if (message.data === \"done\") {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(worker);\r\n }\r\n };\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n worker.postMessage({\r\n id: \"init\",\r\n decoder: {\r\n url: getAbsoluteUrl(decoderInfo.url),\r\n wasmBinary: decoderWasmBinary,\r\n }\r\n });\r\n });\r\n }\r\n return Promise.all(workerPromises).then(function (workers) {\r\n return new WorkerPool(workers);\r\n });\r\n });\r\n }\r\n else {\r\n this._decoderModulePromise = decoderInfo.wasmBinaryPromise.then(function (decoderWasmBinary) {\r\n if (!decoderInfo.url) {\r\n throw new Error(\"Draco decoder module is not available\");\r\n }\r\n return Tools.LoadScriptAsync(decoderInfo.url).then(function () {\r\n return createDecoderAsync(decoderWasmBinary);\r\n });\r\n });\r\n }\r\n }\r\n Object.defineProperty(DracoCompression, \"DecoderAvailable\", {\r\n /**\r\n * Returns true if the decoder configuration is available.\r\n */\r\n get: function () {\r\n var decoder = DracoCompression.Configuration.decoder;\r\n return !!((decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === \"object\") || decoder.fallbackUrl);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n DracoCompression.GetDefaultNumWorkers = function () {\r\n if (typeof navigator !== \"object\" || !navigator.hardwareConcurrency) {\r\n return 1;\r\n }\r\n // Use 50% of the available logical processors but capped at 4.\r\n return Math.min(Math.floor(navigator.hardwareConcurrency * 0.5), 4);\r\n };\r\n Object.defineProperty(DracoCompression, \"Default\", {\r\n /**\r\n * Default instance for the draco compression object.\r\n */\r\n get: function () {\r\n if (!DracoCompression._Default) {\r\n DracoCompression._Default = new DracoCompression();\r\n }\r\n return DracoCompression._Default;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Stop all async operations and release resources.\r\n */\r\n DracoCompression.prototype.dispose = function () {\r\n if (this._workerPoolPromise) {\r\n this._workerPoolPromise.then(function (workerPool) {\r\n workerPool.dispose();\r\n });\r\n }\r\n delete this._workerPoolPromise;\r\n delete this._decoderModulePromise;\r\n };\r\n /**\r\n * Returns a promise that resolves when ready. Call this manually to ensure draco compression is ready before use.\r\n * @returns a promise that resolves when ready\r\n */\r\n DracoCompression.prototype.whenReadyAsync = function () {\r\n if (this._workerPoolPromise) {\r\n return this._workerPoolPromise.then(function () { });\r\n }\r\n if (this._decoderModulePromise) {\r\n return this._decoderModulePromise.then(function () { });\r\n }\r\n return Promise.resolve();\r\n };\r\n /**\r\n * Decode Draco compressed mesh data to vertex data.\r\n * @param data The ArrayBuffer or ArrayBufferView for the Draco compression data\r\n * @param attributes A map of attributes from vertex buffer kinds to Draco unique ids\r\n * @returns A promise that resolves with the decoded vertex data\r\n */\r\n DracoCompression.prototype.decodeMeshAsync = function (data, attributes) {\r\n var dataView = data instanceof ArrayBuffer ? new Uint8Array(data) : data;\r\n if (this._workerPoolPromise) {\r\n return this._workerPoolPromise.then(function (workerPool) {\r\n return new Promise(function (resolve, reject) {\r\n workerPool.push(function (worker, onComplete) {\r\n var vertexData = new VertexData();\r\n var onError = function (error) {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n onComplete();\r\n };\r\n var onMessage = function (message) {\r\n if (message.data === \"done\") {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(vertexData);\r\n onComplete();\r\n }\r\n else if (message.data.id === \"indices\") {\r\n vertexData.indices = message.data.value;\r\n }\r\n else {\r\n vertexData.set(message.data.value, message.data.id);\r\n }\r\n };\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n var dataViewCopy = new Uint8Array(dataView.byteLength);\r\n dataViewCopy.set(new Uint8Array(dataView.buffer, dataView.byteOffset, dataView.byteLength));\r\n worker.postMessage({ id: \"decodeMesh\", dataView: dataViewCopy, attributes: attributes }, [dataViewCopy.buffer]);\r\n });\r\n });\r\n });\r\n }\r\n if (this._decoderModulePromise) {\r\n return this._decoderModulePromise.then(function (decoder) {\r\n var vertexData = new VertexData();\r\n decodeMesh(decoder.module, dataView, attributes, function (indices) {\r\n vertexData.indices = indices;\r\n }, function (kind, data) {\r\n vertexData.set(data, kind);\r\n });\r\n return vertexData;\r\n });\r\n }\r\n throw new Error(\"Draco decoder module is not available\");\r\n };\r\n /**\r\n * The configuration. Defaults to the following urls:\r\n * - wasmUrl: \"https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js\"\r\n * - wasmBinaryUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.wasm\"\r\n * - fallbackUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.js\"\r\n */\r\n DracoCompression.Configuration = {\r\n decoder: {\r\n wasmUrl: \"https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js\",\r\n wasmBinaryUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.wasm\",\r\n fallbackUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.js\"\r\n }\r\n };\r\n /**\r\n * Default number of workers to create when creating the draco compression object.\r\n */\r\n DracoCompression.DefaultNumWorkers = DracoCompression.GetDefaultNumWorkers();\r\n DracoCompression._Default = null;\r\n return DracoCompression;\r\n}());\r\nexport { DracoCompression };\r\n//# sourceMappingURL=dracoCompression.js.map","import { DracoCompression } from \"@babylonjs/core/Meshes/Compression/dracoCompression\";\r\nimport { VertexBuffer } from \"@babylonjs/core/Meshes/buffer\";\r\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nvar NAME = \"KHR_draco_mesh_compression\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)\r\n */\r\nvar KHR_draco_mesh_compression = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_draco_mesh_compression(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = DracoCompression.DecoderAvailable && this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_draco_mesh_compression.prototype.dispose = function () {\r\n delete this.dracoCompression;\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_draco_mesh_compression.prototype._loadVertexDataAsync = function (context, primitive, babylonMesh) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, primitive, this.name, function (extensionContext, extension) {\r\n if (primitive.mode != undefined) {\r\n if (primitive.mode !== 5 /* TRIANGLE_STRIP */ &&\r\n primitive.mode !== 4 /* TRIANGLES */) {\r\n throw new Error(context + \": Unsupported mode \" + primitive.mode);\r\n }\r\n // TODO: handle triangle strips\r\n if (primitive.mode === 5 /* TRIANGLE_STRIP */) {\r\n throw new Error(context + \": Mode \" + primitive.mode + \" is not currently supported\");\r\n }\r\n }\r\n var attributes = {};\r\n var loadAttribute = function (name, kind) {\r\n var uniqueId = extension.attributes[name];\r\n if (uniqueId == undefined) {\r\n return;\r\n }\r\n babylonMesh._delayInfo = babylonMesh._delayInfo || [];\r\n if (babylonMesh._delayInfo.indexOf(kind) === -1) {\r\n babylonMesh._delayInfo.push(kind);\r\n }\r\n attributes[kind] = uniqueId;\r\n };\r\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind);\r\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind);\r\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind);\r\n loadAttribute(\"TEXCOORD_0\", VertexBuffer.UVKind);\r\n loadAttribute(\"TEXCOORD_1\", VertexBuffer.UV2Kind);\r\n loadAttribute(\"JOINTS_0\", VertexBuffer.MatricesIndicesKind);\r\n loadAttribute(\"WEIGHTS_0\", VertexBuffer.MatricesWeightsKind);\r\n loadAttribute(\"COLOR_0\", VertexBuffer.ColorKind);\r\n var bufferView = ArrayItem.Get(extensionContext, _this._loader.gltf.bufferViews, extension.bufferView);\r\n if (!bufferView._dracoBabylonGeometry) {\r\n bufferView._dracoBabylonGeometry = _this._loader.loadBufferViewAsync(\"/bufferViews/\" + bufferView.index, bufferView).then(function (data) {\r\n var dracoCompression = _this.dracoCompression || DracoCompression.Default;\r\n return dracoCompression.decodeMeshAsync(data, attributes).then(function (babylonVertexData) {\r\n var babylonGeometry = new Geometry(babylonMesh.name, _this._loader.babylonScene);\r\n babylonVertexData.applyToGeometry(babylonGeometry);\r\n return babylonGeometry;\r\n }).catch(function (error) {\r\n throw new Error(context + \": \" + error.message);\r\n });\r\n });\r\n }\r\n return bufferView._dracoBabylonGeometry;\r\n });\r\n };\r\n return KHR_draco_mesh_compression;\r\n}());\r\nexport { KHR_draco_mesh_compression };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_draco_mesh_compression(loader); });\r\n//# sourceMappingURL=KHR_draco_mesh_compression.js.map","import { Vector3 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\nimport { DirectionalLight } from \"@babylonjs/core/Lights/directionalLight\";\r\nimport { PointLight } from \"@babylonjs/core/Lights/pointLight\";\r\nimport { SpotLight } from \"@babylonjs/core/Lights/spotLight\";\r\nimport { Light } from \"@babylonjs/core/Lights/light\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nvar NAME = \"KHR_lights_punctual\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual)\r\n */\r\nvar KHR_lights = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_lights(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_lights.prototype.dispose = function () {\r\n this._loader = null;\r\n delete this._lights;\r\n };\r\n /** @hidden */\r\n KHR_lights.prototype.onLoading = function () {\r\n var extensions = this._loader.gltf.extensions;\r\n if (extensions && extensions[this.name]) {\r\n var extension = extensions[this.name];\r\n this._lights = extension.lights;\r\n }\r\n };\r\n /** @hidden */\r\n KHR_lights.prototype.loadNodeAsync = function (context, node, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {\r\n return _this._loader.loadNodeAsync(context, node, function (babylonMesh) {\r\n var babylonLight;\r\n var light = ArrayItem.Get(extensionContext, _this._lights, extension.light);\r\n var name = light.name || babylonMesh.name;\r\n _this._loader.babylonScene._blockEntityCollection = _this._loader._forAssetContainer;\r\n switch (light.type) {\r\n case \"directional\" /* DIRECTIONAL */: {\r\n babylonLight = new DirectionalLight(name, Vector3.Backward(), _this._loader.babylonScene);\r\n break;\r\n }\r\n case \"point\" /* POINT */: {\r\n babylonLight = new PointLight(name, Vector3.Zero(), _this._loader.babylonScene);\r\n break;\r\n }\r\n case \"spot\" /* SPOT */: {\r\n var babylonSpotLight = new SpotLight(name, Vector3.Zero(), Vector3.Backward(), 0, 1, _this._loader.babylonScene);\r\n babylonSpotLight.angle = ((light.spot && light.spot.outerConeAngle) || Math.PI / 4) * 2;\r\n babylonSpotLight.innerAngle = ((light.spot && light.spot.innerConeAngle) || 0) * 2;\r\n babylonLight = babylonSpotLight;\r\n break;\r\n }\r\n default: {\r\n _this._loader.babylonScene._blockEntityCollection = false;\r\n throw new Error(extensionContext + \": Invalid light type (\" + light.type + \")\");\r\n }\r\n }\r\n _this._loader.babylonScene._blockEntityCollection = false;\r\n babylonLight.falloffType = Light.FALLOFF_GLTF;\r\n babylonLight.diffuse = light.color ? Color3.FromArray(light.color) : Color3.White();\r\n babylonLight.intensity = light.intensity == undefined ? 1 : light.intensity;\r\n babylonLight.range = light.range == undefined ? Number.MAX_VALUE : light.range;\r\n babylonLight.parent = babylonMesh;\r\n _this._loader._babylonLights.push(babylonLight);\r\n GLTFLoader.AddPointerMetadata(babylonLight, extensionContext);\r\n assign(babylonMesh);\r\n });\r\n });\r\n };\r\n return KHR_lights;\r\n}());\r\nexport { KHR_lights };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_lights(loader); });\r\n//# sourceMappingURL=KHR_lights_punctual.js.map","import { Color3 } from \"@babylonjs/core/Maths/math.color\";\r\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"KHR_materials_pbrSpecularGlossiness\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)\r\n */\r\nvar KHR_materials_pbrSpecularGlossiness = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_pbrSpecularGlossiness(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 200;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_materials_pbrSpecularGlossiness.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_pbrSpecularGlossiness.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loadSpecularGlossinessPropertiesAsync(extensionContext, material, extension, babylonMaterial));\r\n _this._loader.loadMaterialAlphaProperties(context, material, babylonMaterial);\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n KHR_materials_pbrSpecularGlossiness.prototype._loadSpecularGlossinessPropertiesAsync = function (context, material, properties, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var promises = new Array();\r\n babylonMaterial.metallic = null;\r\n babylonMaterial.roughness = null;\r\n if (properties.diffuseFactor) {\r\n babylonMaterial.albedoColor = Color3.FromArray(properties.diffuseFactor);\r\n babylonMaterial.alpha = properties.diffuseFactor[3];\r\n }\r\n else {\r\n babylonMaterial.albedoColor = Color3.White();\r\n }\r\n babylonMaterial.reflectivityColor = properties.specularFactor ? Color3.FromArray(properties.specularFactor) : Color3.White();\r\n babylonMaterial.microSurface = properties.glossinessFactor == undefined ? 1 : properties.glossinessFactor;\r\n if (properties.diffuseTexture) {\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/diffuseTexture\", properties.diffuseTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Diffuse)\";\r\n babylonMaterial.albedoTexture = texture;\r\n }));\r\n }\r\n if (properties.specularGlossinessTexture) {\r\n properties.specularGlossinessTexture.nonColorData = true;\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/specularGlossinessTexture\", properties.specularGlossinessTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Specular Glossiness)\";\r\n babylonMaterial.reflectivityTexture = texture;\r\n }));\r\n babylonMaterial.reflectivityTexture.hasAlpha = true;\r\n babylonMaterial.useMicroSurfaceFromReflectivityMapAlpha = true;\r\n }\r\n return Promise.all(promises).then(function () { });\r\n };\r\n return KHR_materials_pbrSpecularGlossiness;\r\n}());\r\nexport { KHR_materials_pbrSpecularGlossiness };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_pbrSpecularGlossiness(loader); });\r\n//# sourceMappingURL=KHR_materials_pbrSpecularGlossiness.js.map","import { Color3 } from \"@babylonjs/core/Maths/math.color\";\r\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"KHR_materials_unlit\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)\r\n */\r\nvar KHR_materials_unlit = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_unlit(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 210;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_materials_unlit.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_unlit.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function () {\r\n return _this._loadUnlitPropertiesAsync(context, material, babylonMaterial);\r\n });\r\n };\r\n KHR_materials_unlit.prototype._loadUnlitPropertiesAsync = function (context, material, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var promises = new Array();\r\n babylonMaterial.unlit = true;\r\n var properties = material.pbrMetallicRoughness;\r\n if (properties) {\r\n if (properties.baseColorFactor) {\r\n babylonMaterial.albedoColor = Color3.FromArray(properties.baseColorFactor);\r\n babylonMaterial.alpha = properties.baseColorFactor[3];\r\n }\r\n else {\r\n babylonMaterial.albedoColor = Color3.White();\r\n }\r\n if (properties.baseColorTexture) {\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/baseColorTexture\", properties.baseColorTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Base Color)\";\r\n babylonMaterial.albedoTexture = texture;\r\n }));\r\n }\r\n }\r\n if (material.doubleSided) {\r\n babylonMaterial.backFaceCulling = false;\r\n babylonMaterial.twoSidedLighting = true;\r\n }\r\n this._loader.loadMaterialAlphaProperties(context, material, babylonMaterial);\r\n return Promise.all(promises).then(function () { });\r\n };\r\n return KHR_materials_unlit;\r\n}());\r\nexport { KHR_materials_unlit };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_unlit(loader); });\r\n//# sourceMappingURL=KHR_materials_unlit.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"KHR_materials_clearcoat\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_clearcoat/README.md)\r\n * [Playground Sample](https://www.babylonjs-playground.com/frame.html#7F7PN6#8)\r\n */\r\nvar KHR_materials_clearcoat = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_clearcoat(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 190;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_materials_clearcoat.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_clearcoat.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loadClearCoatPropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n KHR_materials_clearcoat.prototype._loadClearCoatPropertiesAsync = function (context, properties, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var promises = new Array();\r\n babylonMaterial.clearCoat.isEnabled = true;\r\n babylonMaterial.clearCoat.useRoughnessFromMainTexture = false;\r\n babylonMaterial.clearCoat.remapF0OnInterfaceChange = false;\r\n if (properties.clearcoatFactor != undefined) {\r\n babylonMaterial.clearCoat.intensity = properties.clearcoatFactor;\r\n }\r\n else {\r\n babylonMaterial.clearCoat.intensity = 0;\r\n }\r\n if (properties.clearcoatTexture) {\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/clearcoatTexture\", properties.clearcoatTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (ClearCoat Intensity)\";\r\n babylonMaterial.clearCoat.texture = texture;\r\n }));\r\n }\r\n if (properties.clearcoatRoughnessFactor != undefined) {\r\n babylonMaterial.clearCoat.roughness = properties.clearcoatRoughnessFactor;\r\n }\r\n else {\r\n babylonMaterial.clearCoat.roughness = 0;\r\n }\r\n if (properties.clearcoatRoughnessTexture) {\r\n properties.clearcoatRoughnessTexture.nonColorData = true;\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/clearcoatRoughnessTexture\", properties.clearcoatRoughnessTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (ClearCoat Roughness)\";\r\n babylonMaterial.clearCoat.textureRoughness = texture;\r\n }));\r\n }\r\n if (properties.clearcoatNormalTexture) {\r\n properties.clearcoatNormalTexture.nonColorData = true;\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/clearcoatNormalTexture\", properties.clearcoatNormalTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (ClearCoat Normal)\";\r\n babylonMaterial.clearCoat.bumpTexture = texture;\r\n }));\r\n babylonMaterial.invertNormalMapX = !babylonMaterial.getScene().useRightHandedSystem;\r\n babylonMaterial.invertNormalMapY = babylonMaterial.getScene().useRightHandedSystem;\r\n if (properties.clearcoatNormalTexture.scale != undefined) {\r\n babylonMaterial.clearCoat.bumpTexture.level = properties.clearcoatNormalTexture.scale;\r\n }\r\n }\r\n return Promise.all(promises).then(function () { });\r\n };\r\n return KHR_materials_clearcoat;\r\n}());\r\nexport { KHR_materials_clearcoat };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_clearcoat(loader); });\r\n//# sourceMappingURL=KHR_materials_clearcoat.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\nvar NAME = \"KHR_materials_sheen\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1688)\r\n * [Playground Sample](https://www.babylonjs-playground.com/frame.html#BNIZX6#4)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar KHR_materials_sheen = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_sheen(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 190;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_materials_sheen.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_sheen.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loadSheenPropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n KHR_materials_sheen.prototype._loadSheenPropertiesAsync = function (context, properties, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var promises = new Array();\r\n babylonMaterial.sheen.isEnabled = true;\r\n babylonMaterial.sheen.intensity = 1;\r\n if (properties.sheenColorFactor != undefined) {\r\n babylonMaterial.sheen.color = Color3.FromArray(properties.sheenColorFactor);\r\n }\r\n else {\r\n babylonMaterial.sheen.color = Color3.Black();\r\n }\r\n if (properties.sheenColorTexture) {\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/sheenColorTexture\", properties.sheenColorTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Sheen Color)\";\r\n babylonMaterial.sheen.texture = texture;\r\n }));\r\n }\r\n if (properties.sheenRoughnessFactor !== undefined) {\r\n babylonMaterial.sheen.roughness = properties.sheenRoughnessFactor;\r\n }\r\n else {\r\n babylonMaterial.sheen.roughness = 0;\r\n }\r\n if (properties.sheenRoughnessTexture) {\r\n properties.sheenRoughnessTexture.nonColorData = true;\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/sheenRoughnessTexture\", properties.sheenRoughnessTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Sheen Roughness)\";\r\n babylonMaterial.sheen.textureRoughness = texture;\r\n }));\r\n }\r\n babylonMaterial.sheen.albedoScaling = true;\r\n babylonMaterial.sheen.useRoughnessFromMainTexture = false;\r\n return Promise.all(promises).then(function () { });\r\n };\r\n return KHR_materials_sheen;\r\n}());\r\nexport { KHR_materials_sheen };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_sheen(loader); });\r\n//# sourceMappingURL=KHR_materials_sheen.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\nvar NAME = \"KHR_materials_specular\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1719)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar KHR_materials_specular = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_specular(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 190;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_materials_specular.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_specular.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loadSpecularPropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n KHR_materials_specular.prototype._loadSpecularPropertiesAsync = function (context, properties, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var promises = new Array();\r\n if (properties.specularFactor !== undefined) {\r\n babylonMaterial.metallicF0Factor = properties.specularFactor;\r\n }\r\n if (properties.specularColorFactor !== undefined) {\r\n babylonMaterial.metallicReflectanceColor = Color3.FromArray(properties.specularColorFactor);\r\n }\r\n if (properties.specularTexture) {\r\n properties.specularTexture.nonColorData = true;\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/specularTexture\", properties.specularTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Specular F0 Color)\";\r\n babylonMaterial.metallicReflectanceTexture = texture;\r\n }));\r\n }\r\n return Promise.all(promises).then(function () { });\r\n };\r\n return KHR_materials_specular;\r\n}());\r\nexport { KHR_materials_specular };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_specular(loader); });\r\n//# sourceMappingURL=KHR_materials_specular.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"KHR_materials_ior\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1718)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar KHR_materials_ior = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_ior(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 180;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_materials_ior.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_ior.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loadIorPropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n KHR_materials_ior.prototype._loadIorPropertiesAsync = function (context, properties, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n if (properties.ior !== undefined) {\r\n babylonMaterial.indexOfRefraction = properties.ior;\r\n }\r\n else {\r\n babylonMaterial.indexOfRefraction = KHR_materials_ior._DEFAULT_IOR;\r\n }\r\n return Promise.resolve();\r\n };\r\n /**\r\n * Default ior Value from the spec.\r\n */\r\n KHR_materials_ior._DEFAULT_IOR = 1.5;\r\n return KHR_materials_ior;\r\n}());\r\nexport { KHR_materials_ior };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_ior(loader); });\r\n//# sourceMappingURL=KHR_materials_ior.js.map","import { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport { Mesh } from '@babylonjs/core/Meshes/mesh';\r\nvar NAME = \"KHR_materials_variants\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1681)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar KHR_materials_variants = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_variants(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_materials_variants.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /**\r\n * Gets the list of available variant names for this asset.\r\n * @param rootMesh The glTF root mesh\r\n * @returns the list of all the variant names for this model\r\n */\r\n KHR_materials_variants.GetAvailableVariants = function (rootMesh) {\r\n var extensionMetadata = this._GetExtensionMetadata(rootMesh);\r\n if (!extensionMetadata) {\r\n return [];\r\n }\r\n return Object.keys(extensionMetadata.variants);\r\n };\r\n /**\r\n * Gets the list of available variant names for this asset.\r\n * @param rootMesh The glTF root mesh\r\n * @returns the list of all the variant names for this model\r\n */\r\n KHR_materials_variants.prototype.getAvailableVariants = function (rootMesh) {\r\n return KHR_materials_variants.GetAvailableVariants(rootMesh);\r\n };\r\n /**\r\n * Select a variant given a variant name or a list of variant names.\r\n * @param rootMesh The glTF root mesh\r\n * @param variantName The variant name(s) to select.\r\n */\r\n KHR_materials_variants.SelectVariant = function (rootMesh, variantName) {\r\n var extensionMetadata = this._GetExtensionMetadata(rootMesh);\r\n if (!extensionMetadata) {\r\n throw new Error(\"Cannot select variant on a glTF mesh that does not have the \" + NAME + \" extension\");\r\n }\r\n var select = function (variantName) {\r\n var entries = extensionMetadata.variants[variantName];\r\n if (entries) {\r\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\r\n var entry = entries_1[_i];\r\n entry.mesh.material = entry.material;\r\n }\r\n }\r\n };\r\n if (variantName instanceof Array) {\r\n for (var _i = 0, variantName_1 = variantName; _i < variantName_1.length; _i++) {\r\n var name_1 = variantName_1[_i];\r\n select(name_1);\r\n }\r\n }\r\n else {\r\n select(variantName);\r\n }\r\n extensionMetadata.lastSelected = variantName;\r\n };\r\n /**\r\n * Select a variant given a variant name or a list of variant names.\r\n * @param rootMesh The glTF root mesh\r\n * @param variantName The variant name(s) to select.\r\n */\r\n KHR_materials_variants.prototype.selectVariant = function (rootMesh, variantName) {\r\n return KHR_materials_variants.SelectVariant(rootMesh, variantName);\r\n };\r\n /**\r\n * Reset back to the original before selecting a variant.\r\n * @param rootMesh The glTF root mesh\r\n */\r\n KHR_materials_variants.Reset = function (rootMesh) {\r\n var extensionMetadata = this._GetExtensionMetadata(rootMesh);\r\n if (!extensionMetadata) {\r\n throw new Error(\"Cannot reset on a glTF mesh that does not have the \" + NAME + \" extension\");\r\n }\r\n for (var _i = 0, _a = extensionMetadata.original; _i < _a.length; _i++) {\r\n var entry = _a[_i];\r\n entry.mesh.material = entry.material;\r\n }\r\n extensionMetadata.lastSelected = null;\r\n };\r\n /**\r\n * Reset back to the original before selecting a variant.\r\n * @param rootMesh The glTF root mesh\r\n */\r\n KHR_materials_variants.prototype.reset = function (rootMesh) {\r\n return KHR_materials_variants.Reset(rootMesh);\r\n };\r\n /**\r\n * Gets the last selected variant name(s) or null if original.\r\n * @param rootMesh The glTF root mesh\r\n * @returns The selected variant name(s).\r\n */\r\n KHR_materials_variants.GetLastSelectedVariant = function (rootMesh) {\r\n var extensionMetadata = this._GetExtensionMetadata(rootMesh);\r\n if (!extensionMetadata) {\r\n throw new Error(\"Cannot get the last selected variant on a glTF mesh that does not have the \" + NAME + \" extension\");\r\n }\r\n return extensionMetadata.lastSelected;\r\n };\r\n /**\r\n * Gets the last selected variant name(s) or null if original.\r\n * @param rootMesh The glTF root mesh\r\n * @returns The selected variant name(s).\r\n */\r\n KHR_materials_variants.prototype.getLastSelectedVariant = function (rootMesh) {\r\n return KHR_materials_variants.GetLastSelectedVariant(rootMesh);\r\n };\r\n KHR_materials_variants._GetExtensionMetadata = function (rootMesh) {\r\n var _a, _b;\r\n return ((_b = (_a = rootMesh === null || rootMesh === void 0 ? void 0 : rootMesh.metadata) === null || _a === void 0 ? void 0 : _a.gltf) === null || _b === void 0 ? void 0 : _b[NAME]) || null;\r\n };\r\n /** @hidden */\r\n KHR_materials_variants.prototype.onLoading = function () {\r\n var extensions = this._loader.gltf.extensions;\r\n if (extensions && extensions[this.name]) {\r\n var extension = extensions[this.name];\r\n this._variants = extension.variants;\r\n }\r\n };\r\n /** @hidden */\r\n KHR_materials_variants.prototype._loadMeshPrimitiveAsync = function (context, name, node, mesh, primitive, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, primitive, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader._loadMeshPrimitiveAsync(context, name, node, mesh, primitive, function (babylonMesh) {\r\n assign(babylonMesh);\r\n if (babylonMesh instanceof Mesh) {\r\n var babylonDrawMode = GLTFLoader._GetDrawMode(context, primitive.mode);\r\n var root = _this._loader.rootBabylonMesh;\r\n var metadata = (root.metadata = root.metadata || {});\r\n var gltf = (metadata.gltf = metadata.gltf || {});\r\n var extensionMetadata = (gltf[NAME] = gltf[NAME] || { lastSelected: null, original: [], variants: {} });\r\n // Store the original material.\r\n extensionMetadata.original.push({ mesh: babylonMesh, material: babylonMesh.material });\r\n // For each mapping, look at the variants and make a new entry for them.\r\n var variants_1 = extensionMetadata.variants;\r\n for (var _i = 0, _a = extension.mappings; _i < _a.length; _i++) {\r\n var mapping = _a[_i];\r\n var _loop_1 = function (variantIndex) {\r\n var variant = ArrayItem.Get(extensionContext + \"/mapping/\" + variantIndex, _this._variants, variantIndex);\r\n var material = ArrayItem.Get(\"#/materials/\", _this._loader.gltf.materials, mapping.material);\r\n promises.push(_this._loader._loadMaterialAsync(\"#/materials/\" + mapping.material, material, babylonMesh, babylonDrawMode, function (babylonMaterial) {\r\n variants_1[variant.name] = variants_1[variant.name] || [];\r\n variants_1[variant.name].push({\r\n mesh: babylonMesh,\r\n material: babylonMaterial\r\n });\r\n }));\r\n };\r\n for (var _b = 0, _c = mapping.variants; _b < _c.length; _b++) {\r\n var variantIndex = _c[_b];\r\n _loop_1(variantIndex);\r\n }\r\n }\r\n }\r\n }));\r\n return Promise.all(promises).then(function (_a) {\r\n var babylonMesh = _a[0];\r\n return babylonMesh;\r\n });\r\n });\r\n };\r\n return KHR_materials_variants;\r\n}());\r\nexport { KHR_materials_variants };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_variants(loader); });\r\n//# sourceMappingURL=KHR_materials_variants.js.map","import { __assign } from \"tslib\";\r\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { RenderTargetTexture } from \"@babylonjs/core/Materials/Textures/renderTargetTexture\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\n/**\r\n * A class to handle setting up the rendering of opaque objects to be shown through transmissive objects.\r\n */\r\nvar TransmissionHelper = /** @class */ (function () {\r\n /**\r\n * constructor\r\n * @param options Defines the options we want to customize the helper\r\n * @param scene The scene to add the material to\r\n */\r\n function TransmissionHelper(options, scene) {\r\n var _this = this;\r\n this._opaqueRenderTarget = null;\r\n this._opaqueMeshesCache = [];\r\n this._transparentMeshesCache = [];\r\n this._options = __assign(__assign({}, TransmissionHelper._getDefaultOptions()), options);\r\n this._scene = scene;\r\n this._scene._transmissionHelper = this;\r\n this.onErrorObservable = new Observable();\r\n this._scene.onDisposeObservable.addOnce(function (scene) {\r\n _this.dispose();\r\n });\r\n this._parseScene();\r\n this._setupRenderTargets();\r\n }\r\n /**\r\n * Creates the default options for the helper.\r\n */\r\n TransmissionHelper._getDefaultOptions = function () {\r\n return {\r\n renderSize: 512\r\n };\r\n };\r\n /**\r\n * Updates the background according to the new options\r\n * @param options\r\n */\r\n TransmissionHelper.prototype.updateOptions = function (options) {\r\n var _this = this;\r\n // First check if any options are actually being changed. If not, exit.\r\n var newValues = Object.keys(options).filter(function (key) { return _this._options[key] !== options[key]; });\r\n if (!newValues.length) {\r\n return;\r\n }\r\n var newOptions = __assign(__assign({}, this._options), options);\r\n var oldOptions = this._options;\r\n this._options = newOptions;\r\n // If size changes, recreate everything\r\n if (newOptions.renderSize !== oldOptions.renderSize) {\r\n this._setupRenderTargets();\r\n }\r\n };\r\n TransmissionHelper.prototype.getOpaqueTarget = function () {\r\n return this._opaqueRenderTarget;\r\n };\r\n TransmissionHelper.prototype.shouldRenderAsTransmission = function (material) {\r\n if (!material) {\r\n return false;\r\n }\r\n if (material instanceof PBRMaterial && (material.subSurface.isRefractionEnabled)) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n TransmissionHelper.prototype._addMesh = function (mesh) {\r\n if (mesh instanceof Mesh) {\r\n mesh.onMaterialChangedObservable.add(this.onMeshMaterialChanged.bind(this));\r\n if (this.shouldRenderAsTransmission(mesh.material)) {\r\n this._transparentMeshesCache.push(mesh);\r\n }\r\n else {\r\n this._opaqueMeshesCache.push(mesh);\r\n }\r\n }\r\n };\r\n TransmissionHelper.prototype._removeMesh = function (mesh) {\r\n if (mesh instanceof Mesh) {\r\n mesh.onMaterialChangedObservable.remove(this.onMeshMaterialChanged.bind(this));\r\n var idx = this._transparentMeshesCache.indexOf(mesh);\r\n if (idx !== -1) {\r\n this._transparentMeshesCache.splice(idx, 1);\r\n }\r\n idx = this._opaqueMeshesCache.indexOf(mesh);\r\n if (idx !== -1) {\r\n this._opaqueMeshesCache.splice(idx, 1);\r\n }\r\n }\r\n };\r\n TransmissionHelper.prototype._parseScene = function () {\r\n this._scene.meshes.forEach(this._addMesh.bind(this));\r\n // Listen for when a mesh is added to the scene and add it to our cache lists.\r\n this._scene.onNewMeshAddedObservable.add(this._addMesh.bind(this));\r\n // Listen for when a mesh is removed from to the scene and remove it from our cache lists.\r\n this._scene.onMeshRemovedObservable.add(this._removeMesh.bind(this));\r\n };\r\n // When one of the meshes in the scene has its material changed, make sure that it's in the correct cache list.\r\n TransmissionHelper.prototype.onMeshMaterialChanged = function (mesh) {\r\n if (mesh instanceof Mesh) {\r\n var transparentIdx = this._transparentMeshesCache.indexOf(mesh);\r\n var opaqueIdx = this._opaqueMeshesCache.indexOf(mesh);\r\n // If the material is transparent, make sure that it's added to the transparent list and removed from the opaque list\r\n var useTransmission = this.shouldRenderAsTransmission(mesh.material);\r\n if (useTransmission) {\r\n if (mesh.material instanceof PBRMaterial) {\r\n mesh.material.subSurface.refractionTexture = this._opaqueRenderTarget;\r\n }\r\n if (opaqueIdx !== -1) {\r\n this._opaqueMeshesCache.splice(opaqueIdx, 1);\r\n this._transparentMeshesCache.push(mesh);\r\n }\r\n else if (transparentIdx === -1) {\r\n this._transparentMeshesCache.push(mesh);\r\n }\r\n // If the material is opaque, make sure that it's added to the opaque list and removed from the transparent list\r\n }\r\n else {\r\n if (transparentIdx !== -1) {\r\n this._transparentMeshesCache.splice(transparentIdx, 1);\r\n this._opaqueMeshesCache.push(mesh);\r\n }\r\n else if (opaqueIdx === -1) {\r\n this._opaqueMeshesCache.push(mesh);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Setup the render targets according to the specified options.\r\n */\r\n TransmissionHelper.prototype._setupRenderTargets = function () {\r\n var _this = this;\r\n var opaqueRTIndex = -1;\r\n // Remove any layers rendering to the opaque scene.\r\n if (this._scene.layers && this._opaqueRenderTarget) {\r\n for (var _i = 0, _a = this._scene.layers; _i < _a.length; _i++) {\r\n var layer = _a[_i];\r\n var idx = layer.renderTargetTextures.indexOf(this._opaqueRenderTarget);\r\n if (idx >= 0) {\r\n layer.renderTargetTextures.splice(idx, 1);\r\n }\r\n }\r\n }\r\n // Remove opaque render target\r\n if (this._opaqueRenderTarget) {\r\n opaqueRTIndex = this._scene.customRenderTargets.indexOf(this._opaqueRenderTarget);\r\n this._opaqueRenderTarget.dispose();\r\n }\r\n this._opaqueRenderTarget = new RenderTargetTexture(\"opaqueSceneTexture\", this._options.renderSize, this._scene, true);\r\n this._opaqueRenderTarget.renderList = this._opaqueMeshesCache;\r\n // this._opaqueRenderTarget.clearColor = new Color4(0.0, 0.0, 0.0, 0.0);\r\n this._opaqueRenderTarget.gammaSpace = true;\r\n this._opaqueRenderTarget.lodGenerationScale = 1;\r\n this._opaqueRenderTarget.lodGenerationOffset = -4;\r\n if (opaqueRTIndex >= 0) {\r\n this._scene.customRenderTargets.splice(opaqueRTIndex, 0, this._opaqueRenderTarget);\r\n }\r\n else {\r\n opaqueRTIndex = this._scene.customRenderTargets.length;\r\n this._scene.customRenderTargets.push(this._opaqueRenderTarget);\r\n }\r\n // If there are other layers, they should be included in the render of the opaque background.\r\n if (this._scene.layers && this._opaqueRenderTarget) {\r\n for (var _b = 0, _c = this._scene.layers; _b < _c.length; _b++) {\r\n var layer = _c[_b];\r\n layer.renderTargetTextures.push(this._opaqueRenderTarget);\r\n }\r\n }\r\n this._transparentMeshesCache.forEach(function (mesh) {\r\n if (_this.shouldRenderAsTransmission(mesh.material) && mesh.material instanceof PBRMaterial) {\r\n mesh.material.refractionTexture = _this._opaqueRenderTarget;\r\n }\r\n });\r\n };\r\n /**\r\n * Dispose all the elements created by the Helper.\r\n */\r\n TransmissionHelper.prototype.dispose = function () {\r\n this._scene._transmissionHelper = undefined;\r\n if (this._opaqueRenderTarget) {\r\n this._opaqueRenderTarget.dispose();\r\n this._opaqueRenderTarget = null;\r\n }\r\n this._transparentMeshesCache = [];\r\n this._opaqueMeshesCache = [];\r\n };\r\n return TransmissionHelper;\r\n}());\r\nvar NAME = \"KHR_materials_transmission\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1698)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar KHR_materials_transmission = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_transmission(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 175;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n if (this.enabled) {\r\n loader.parent.transparencyAsCoverage = true;\r\n }\r\n }\r\n /** @hidden */\r\n KHR_materials_transmission.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_transmission.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loadTransparentPropertiesAsync(extensionContext, material, babylonMaterial, extension));\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n KHR_materials_transmission.prototype._loadTransparentPropertiesAsync = function (context, material, babylonMaterial, extension) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var pbrMaterial = babylonMaterial;\r\n // Enables \"refraction\" texture which represents transmitted light.\r\n pbrMaterial.subSurface.isRefractionEnabled = true;\r\n // Since this extension models thin-surface transmission only, we must make IOR = 1.0\r\n pbrMaterial.subSurface.volumeIndexOfRefraction = 1.0;\r\n // Albedo colour will tint transmission.\r\n pbrMaterial.subSurface.useAlbedoToTintRefraction = true;\r\n if (extension.transmissionFactor !== undefined) {\r\n pbrMaterial.subSurface.refractionIntensity = extension.transmissionFactor;\r\n var scene = pbrMaterial.getScene();\r\n if (pbrMaterial.subSurface.refractionIntensity && !scene._transmissionHelper) {\r\n new TransmissionHelper({}, pbrMaterial.getScene());\r\n }\r\n }\r\n else {\r\n pbrMaterial.subSurface.refractionIntensity = 0.0;\r\n pbrMaterial.subSurface.isRefractionEnabled = false;\r\n return Promise.resolve();\r\n }\r\n if (extension.transmissionTexture) {\r\n extension.transmissionTexture.nonColorData = true;\r\n return this._loader.loadTextureInfoAsync(context + \"/transmissionTexture\", extension.transmissionTexture, undefined)\r\n .then(function (texture) {\r\n pbrMaterial.subSurface.thicknessTexture = texture;\r\n pbrMaterial.subSurface.useMaskFromThicknessTextureGltf = true;\r\n });\r\n }\r\n else {\r\n return Promise.resolve();\r\n }\r\n };\r\n return KHR_materials_transmission;\r\n}());\r\nexport { KHR_materials_transmission };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_transmission(loader); });\r\n//# sourceMappingURL=KHR_materials_transmission.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"KHR_materials_translucency\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1825)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar KHR_materials_translucency = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_translucency(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 175;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n if (this.enabled) {\r\n loader.parent.transparencyAsCoverage = true;\r\n }\r\n }\r\n /** @hidden */\r\n KHR_materials_translucency.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_translucency.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loadTranslucentPropertiesAsync(extensionContext, material, babylonMaterial, extension));\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n KHR_materials_translucency.prototype._loadTranslucentPropertiesAsync = function (context, material, babylonMaterial, extension) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var pbrMaterial = babylonMaterial;\r\n // Enables \"translucency\" texture which represents diffusely-transmitted light.\r\n pbrMaterial.subSurface.isTranslucencyEnabled = true;\r\n // Since this extension models thin-surface transmission only, we must make the\r\n // internal IOR == 1.0 and set the thickness to 0.\r\n pbrMaterial.subSurface.volumeIndexOfRefraction = 1.0;\r\n pbrMaterial.subSurface.minimumThickness = 0.0;\r\n pbrMaterial.subSurface.maximumThickness = 0.0;\r\n // Albedo colour will tint transmission.\r\n pbrMaterial.subSurface.useAlbedoToTintRefraction = true;\r\n if (extension.translucencyFactor !== undefined) {\r\n pbrMaterial.subSurface.translucencyIntensity = extension.translucencyFactor;\r\n }\r\n else {\r\n pbrMaterial.subSurface.translucencyIntensity = 0.0;\r\n pbrMaterial.subSurface.isTranslucencyEnabled = false;\r\n return Promise.resolve();\r\n }\r\n if (extension.translucencyTexture) {\r\n return this._loader.loadTextureInfoAsync(context + \"/translucencyTexture\", extension.translucencyTexture)\r\n .then(function (texture) {\r\n pbrMaterial.subSurface.thicknessTexture = texture;\r\n pbrMaterial.subSurface.useMaskFromThicknessTextureGltf = true;\r\n });\r\n }\r\n else {\r\n return Promise.resolve();\r\n }\r\n };\r\n return KHR_materials_translucency;\r\n}());\r\nexport { KHR_materials_translucency };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_translucency(loader); });\r\n//# sourceMappingURL=KHR_materials_translucency.js.map","import { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"KHR_mesh_quantization\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization)\r\n */\r\nvar KHR_mesh_quantization = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_mesh_quantization(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_mesh_quantization.prototype.dispose = function () {\r\n };\r\n return KHR_mesh_quantization;\r\n}());\r\nexport { KHR_mesh_quantization };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_mesh_quantization(loader); });\r\n//# sourceMappingURL=KHR_mesh_quantization.js.map","import { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nvar NAME = \"KHR_texture_basisu\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1751)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar KHR_texture_basisu = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_texture_basisu(loader) {\r\n /** The name of this extension. */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_texture_basisu.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_texture_basisu.prototype._loadTextureAsync = function (context, texture, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, texture, this.name, function (extensionContext, extension) {\r\n var sampler = (texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(context + \"/sampler\", _this._loader.gltf.samplers, texture.sampler));\r\n var image = ArrayItem.Get(extensionContext + \"/source\", _this._loader.gltf.images, extension.source);\r\n return _this._loader._createTextureAsync(context, sampler, image, function (babylonTexture) {\r\n assign(babylonTexture);\r\n }, texture._textureInfo.nonColorData ? { useRGBAIfASTCBC7NotAvailableWhenUASTC: true } : undefined);\r\n });\r\n };\r\n return KHR_texture_basisu;\r\n}());\r\nexport { KHR_texture_basisu };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_texture_basisu(loader); });\r\n//# sourceMappingURL=KHR_texture_basisu.js.map","import { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"KHR_texture_transform\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_texture_transform)\r\n */\r\nvar KHR_texture_transform = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_texture_transform(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_texture_transform.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_texture_transform.prototype.loadTextureInfoAsync = function (context, textureInfo, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, textureInfo, this.name, function (extensionContext, extension) {\r\n return _this._loader.loadTextureInfoAsync(context, textureInfo, function (babylonTexture) {\r\n if (!(babylonTexture instanceof Texture)) {\r\n throw new Error(extensionContext + \": Texture type not supported\");\r\n }\r\n if (extension.offset) {\r\n babylonTexture.uOffset = extension.offset[0];\r\n babylonTexture.vOffset = extension.offset[1];\r\n }\r\n // Always rotate around the origin.\r\n babylonTexture.uRotationCenter = 0;\r\n babylonTexture.vRotationCenter = 0;\r\n if (extension.rotation) {\r\n babylonTexture.wAng = -extension.rotation;\r\n }\r\n if (extension.scale) {\r\n babylonTexture.uScale = extension.scale[0];\r\n babylonTexture.vScale = extension.scale[1];\r\n }\r\n if (extension.texCoord != undefined) {\r\n babylonTexture.coordinatesIndex = extension.texCoord;\r\n }\r\n assign(babylonTexture);\r\n });\r\n });\r\n };\r\n return KHR_texture_transform;\r\n}());\r\nexport { KHR_texture_transform };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_texture_transform(loader); });\r\n//# sourceMappingURL=KHR_texture_transform.js.map","/**\r\n * Composed of a frame, and an action function\r\n */\r\nvar AnimationEvent = /** @class */ (function () {\r\n /**\r\n * Initializes the animation event\r\n * @param frame The frame for which the event is triggered\r\n * @param action The event to perform when triggered\r\n * @param onlyOnce Specifies if the event should be triggered only once\r\n */\r\n function AnimationEvent(\r\n /** The frame for which the event is triggered **/\r\n frame, \r\n /** The event to perform when triggered **/\r\n action, \r\n /** Specifies if the event should be triggered only once**/\r\n onlyOnce) {\r\n this.frame = frame;\r\n this.action = action;\r\n this.onlyOnce = onlyOnce;\r\n /**\r\n * Specifies if the animation event is done\r\n */\r\n this.isDone = false;\r\n }\r\n /** @hidden */\r\n AnimationEvent.prototype._clone = function () {\r\n return new AnimationEvent(this.frame, this.action, this.onlyOnce);\r\n };\r\n return AnimationEvent;\r\n}());\r\nexport { AnimationEvent };\r\n//# sourceMappingURL=animationEvent.js.map","import { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { _DevTools } from \"../Misc/devTools\";\r\n/**\r\n * Defines a sound that can be played in the application.\r\n * The sound can either be an ambient track or a simple sound played in reaction to a user action.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\nvar Sound = /** @class */ (function () {\r\n /**\r\n * Create a sound and attach it to a scene\r\n * @param name Name of your sound\r\n * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer, it also works with MediaStreams\r\n * @param scene defines the scene the sound belongs to\r\n * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played\r\n * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming\r\n */\r\n function Sound(name, urlOrArrayBuffer, scene, readyToPlayCallback, options) {\r\n var _this = this;\r\n if (readyToPlayCallback === void 0) { readyToPlayCallback = null; }\r\n var _a, _b, _c, _d;\r\n /**\r\n * Does the sound autoplay once loaded.\r\n */\r\n this.autoplay = false;\r\n /**\r\n * Does the sound loop after it finishes playing once.\r\n */\r\n this.loop = false;\r\n /**\r\n * Does the sound use a custom attenuation curve to simulate the falloff\r\n * happening when the source gets further away from the camera.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-your-own-custom-attenuation-function\r\n */\r\n this.useCustomAttenuation = false;\r\n /**\r\n * Is this sound currently played.\r\n */\r\n this.isPlaying = false;\r\n /**\r\n * Is this sound currently paused.\r\n */\r\n this.isPaused = false;\r\n /**\r\n * Does this sound enables spatial sound.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.spatialSound = false;\r\n /**\r\n * Define the reference distance the sound should be heard perfectly.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.refDistance = 1;\r\n /**\r\n * Define the roll off factor of spatial sounds.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.rolloffFactor = 1;\r\n /**\r\n * Define the max distance the sound should be heard (intensity just became 0 at this point).\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.maxDistance = 100;\r\n /**\r\n * Define the distance attenuation model the sound will follow.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.distanceModel = \"linear\";\r\n /**\r\n * Gets or sets an object used to store user defined information for the sound.\r\n */\r\n this.metadata = null;\r\n /**\r\n * Observable event when the current playing sound finishes.\r\n */\r\n this.onEndedObservable = new Observable();\r\n this._panningModel = \"equalpower\";\r\n this._playbackRate = 1;\r\n this._streaming = false;\r\n this._startTime = 0;\r\n this._startOffset = 0;\r\n this._position = Vector3.Zero();\r\n /** @hidden */\r\n this._positionInEmitterSpace = false;\r\n this._localDirection = new Vector3(1, 0, 0);\r\n this._volume = 1;\r\n this._isReadyToPlay = false;\r\n this._isDirectional = false;\r\n // Used if you'd like to create a directional sound.\r\n // If not set, the sound will be omnidirectional\r\n this._coneInnerAngle = 360;\r\n this._coneOuterAngle = 360;\r\n this._coneOuterGain = 0;\r\n this._isOutputConnected = false;\r\n this._urlType = \"Unknown\";\r\n this.name = name;\r\n this._scene = scene;\r\n Sound._SceneComponentInitialization(scene);\r\n this._readyToPlayCallback = readyToPlayCallback;\r\n // Default custom attenuation function is a linear attenuation\r\n this._customAttenuationFunction = function (currentVolume, currentDistance, maxDistance, refDistance, rolloffFactor) {\r\n if (currentDistance < maxDistance) {\r\n return currentVolume * (1 - currentDistance / maxDistance);\r\n }\r\n else {\r\n return 0;\r\n }\r\n };\r\n if (options) {\r\n this.autoplay = options.autoplay || false;\r\n this.loop = options.loop || false;\r\n // if volume === 0, we need another way to check this option\r\n if (options.volume !== undefined) {\r\n this._volume = options.volume;\r\n }\r\n this.spatialSound = (_a = options.spatialSound) !== null && _a !== void 0 ? _a : false;\r\n this.maxDistance = (_b = options.maxDistance) !== null && _b !== void 0 ? _b : 100;\r\n this.useCustomAttenuation = (_c = options.useCustomAttenuation) !== null && _c !== void 0 ? _c : false;\r\n this.rolloffFactor = options.rolloffFactor || 1;\r\n this.refDistance = options.refDistance || 1;\r\n this.distanceModel = options.distanceModel || \"linear\";\r\n this._playbackRate = options.playbackRate || 1;\r\n this._streaming = (_d = options.streaming) !== null && _d !== void 0 ? _d : false;\r\n this._length = options.length;\r\n this._offset = options.offset;\r\n }\r\n if (Engine.audioEngine.canUseWebAudio && Engine.audioEngine.audioContext) {\r\n this._soundGain = Engine.audioEngine.audioContext.createGain();\r\n this._soundGain.gain.value = this._volume;\r\n this._inputAudioNode = this._soundGain;\r\n this._outputAudioNode = this._soundGain;\r\n if (this.spatialSound) {\r\n this._createSpatialParameters();\r\n }\r\n this._scene.mainSoundTrack.addSound(this);\r\n var validParameter = true;\r\n // if no parameter is passed, you need to call setAudioBuffer yourself to prepare the sound\r\n if (urlOrArrayBuffer) {\r\n try {\r\n if (typeof urlOrArrayBuffer === \"string\") {\r\n this._urlType = \"String\";\r\n }\r\n else if (urlOrArrayBuffer instanceof ArrayBuffer) {\r\n this._urlType = \"ArrayBuffer\";\r\n }\r\n else if (urlOrArrayBuffer instanceof MediaStream) {\r\n this._urlType = \"MediaStream\";\r\n }\r\n else if (Array.isArray(urlOrArrayBuffer)) {\r\n this._urlType = \"Array\";\r\n }\r\n var urls = [];\r\n var codecSupportedFound = false;\r\n switch (this._urlType) {\r\n case \"MediaStream\":\r\n this._streaming = true;\r\n this._isReadyToPlay = true;\r\n this._streamingSource = Engine.audioEngine.audioContext.createMediaStreamSource(urlOrArrayBuffer);\r\n if (this.autoplay) {\r\n this.play(0, this._offset, this._length);\r\n }\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n break;\r\n case \"ArrayBuffer\":\r\n if (urlOrArrayBuffer.byteLength > 0) {\r\n codecSupportedFound = true;\r\n this._soundLoaded(urlOrArrayBuffer);\r\n }\r\n break;\r\n case \"String\":\r\n urls.push(urlOrArrayBuffer);\r\n case \"Array\":\r\n if (urls.length === 0) {\r\n urls = urlOrArrayBuffer;\r\n }\r\n // If we found a supported format, we load it immediately and stop the loop\r\n for (var i = 0; i < urls.length; i++) {\r\n var url = urls[i];\r\n codecSupportedFound =\r\n (options && options.skipCodecCheck) ||\r\n (url.indexOf(\".mp3\", url.length - 4) !== -1 && Engine.audioEngine.isMP3supported) ||\r\n (url.indexOf(\".ogg\", url.length - 4) !== -1 && Engine.audioEngine.isOGGsupported) ||\r\n url.indexOf(\".wav\", url.length - 4) !== -1 ||\r\n url.indexOf(\".m4a\", url.length - 4) !== -1 ||\r\n url.indexOf(\"blob:\") !== -1;\r\n if (codecSupportedFound) {\r\n // Loading sound using XHR2\r\n if (!this._streaming) {\r\n this._scene._loadFile(url, function (data) {\r\n _this._soundLoaded(data);\r\n }, undefined, true, true, function (exception) {\r\n if (exception) {\r\n Logger.Error(\"XHR \" + exception.status + \" error on: \" + url + \".\");\r\n }\r\n Logger.Error(\"Sound creation aborted.\");\r\n _this._scene.mainSoundTrack.removeSound(_this);\r\n });\r\n }\r\n // Streaming sound using HTML5 Audio tag\r\n else {\r\n this._htmlAudioElement = new Audio(url);\r\n this._htmlAudioElement.controls = false;\r\n this._htmlAudioElement.loop = this.loop;\r\n Tools.SetCorsBehavior(url, this._htmlAudioElement);\r\n this._htmlAudioElement.preload = \"auto\";\r\n this._htmlAudioElement.addEventListener(\"canplaythrough\", function () {\r\n _this._isReadyToPlay = true;\r\n if (_this.autoplay) {\r\n _this.play(0, _this._offset, _this._length);\r\n }\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n });\r\n document.body.appendChild(this._htmlAudioElement);\r\n this._htmlAudioElement.load();\r\n }\r\n break;\r\n }\r\n }\r\n break;\r\n default:\r\n validParameter = false;\r\n break;\r\n }\r\n if (!validParameter) {\r\n Logger.Error(\"Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.\");\r\n }\r\n else {\r\n if (!codecSupportedFound) {\r\n this._isReadyToPlay = true;\r\n // Simulating a ready to play event to avoid breaking code path\r\n if (this._readyToPlayCallback) {\r\n window.setTimeout(function () {\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n }, 1000);\r\n }\r\n }\r\n }\r\n }\r\n catch (ex) {\r\n Logger.Error(\"Unexpected error. Sound creation aborted.\");\r\n this._scene.mainSoundTrack.removeSound(this);\r\n }\r\n }\r\n }\r\n else {\r\n // Adding an empty sound to avoid breaking audio calls for non Web Audio browsers\r\n this._scene.mainSoundTrack.addSound(this);\r\n if (!Engine.audioEngine.WarnedWebAudioUnsupported) {\r\n Logger.Error(\"Web Audio is not supported by your browser.\");\r\n Engine.audioEngine.WarnedWebAudioUnsupported = true;\r\n }\r\n // Simulating a ready to play event to avoid breaking code for non web audio browsers\r\n if (this._readyToPlayCallback) {\r\n window.setTimeout(function () {\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n }, 1000);\r\n }\r\n }\r\n }\r\n Object.defineProperty(Sound.prototype, \"currentTime\", {\r\n /**\r\n * Gets the current time for the sound.\r\n */\r\n get: function () {\r\n if (this._htmlAudioElement) {\r\n return this._htmlAudioElement.currentTime;\r\n }\r\n var currentTime = this._startOffset;\r\n if (this.isPlaying && Engine.audioEngine.audioContext) {\r\n currentTime += Engine.audioEngine.audioContext.currentTime - this._startTime;\r\n }\r\n return currentTime;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Release the sound and its associated resources\r\n */\r\n Sound.prototype.dispose = function () {\r\n if (Engine.audioEngine.canUseWebAudio) {\r\n if (this.isPlaying) {\r\n this.stop();\r\n }\r\n this._isReadyToPlay = false;\r\n if (this.soundTrackId === -1) {\r\n this._scene.mainSoundTrack.removeSound(this);\r\n }\r\n else if (this._scene.soundTracks) {\r\n this._scene.soundTracks[this.soundTrackId].removeSound(this);\r\n }\r\n if (this._soundGain) {\r\n this._soundGain.disconnect();\r\n this._soundGain = null;\r\n }\r\n if (this._soundPanner) {\r\n this._soundPanner.disconnect();\r\n this._soundPanner = null;\r\n }\r\n if (this._soundSource) {\r\n this._soundSource.disconnect();\r\n this._soundSource = null;\r\n }\r\n this._audioBuffer = null;\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n this._htmlAudioElement.src = \"\";\r\n document.body.removeChild(this._htmlAudioElement);\r\n }\r\n if (this._streamingSource) {\r\n this._streamingSource.disconnect();\r\n }\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._connectedTransformNode = null;\r\n }\r\n }\r\n };\r\n /**\r\n * Gets if the sounds is ready to be played or not.\r\n * @returns true if ready, otherwise false\r\n */\r\n Sound.prototype.isReady = function () {\r\n return this._isReadyToPlay;\r\n };\r\n Sound.prototype._soundLoaded = function (audioData) {\r\n var _this = this;\r\n if (!Engine.audioEngine.audioContext) {\r\n return;\r\n }\r\n Engine.audioEngine.audioContext.decodeAudioData(audioData, function (buffer) {\r\n _this._audioBuffer = buffer;\r\n _this._isReadyToPlay = true;\r\n if (_this.autoplay) {\r\n _this.play(0, _this._offset, _this._length);\r\n }\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n }, function (err) {\r\n Logger.Error(\"Error while decoding audio data for: \" + _this.name + \" / Error: \" + err);\r\n });\r\n };\r\n /**\r\n * Sets the data of the sound from an audiobuffer\r\n * @param audioBuffer The audioBuffer containing the data\r\n */\r\n Sound.prototype.setAudioBuffer = function (audioBuffer) {\r\n if (Engine.audioEngine.canUseWebAudio) {\r\n this._audioBuffer = audioBuffer;\r\n this._isReadyToPlay = true;\r\n }\r\n };\r\n /**\r\n * Updates the current sounds options such as maxdistance, loop...\r\n * @param options A JSON object containing values named as the object properties\r\n */\r\n Sound.prototype.updateOptions = function (options) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n if (options) {\r\n this.loop = (_a = options.loop) !== null && _a !== void 0 ? _a : this.loop;\r\n this.maxDistance = (_b = options.maxDistance) !== null && _b !== void 0 ? _b : this.maxDistance;\r\n this.useCustomAttenuation = (_c = options.useCustomAttenuation) !== null && _c !== void 0 ? _c : this.useCustomAttenuation;\r\n this.rolloffFactor = (_d = options.rolloffFactor) !== null && _d !== void 0 ? _d : this.rolloffFactor;\r\n this.refDistance = (_e = options.refDistance) !== null && _e !== void 0 ? _e : this.refDistance;\r\n this.distanceModel = (_f = options.distanceModel) !== null && _f !== void 0 ? _f : this.distanceModel;\r\n this._playbackRate = (_g = options.playbackRate) !== null && _g !== void 0 ? _g : this._playbackRate;\r\n this._length = (_h = options.length) !== null && _h !== void 0 ? _h : undefined;\r\n this._offset = (_j = options.offset) !== null && _j !== void 0 ? _j : undefined;\r\n this._updateSpatialParameters();\r\n if (this.isPlaying) {\r\n if (this._streaming && this._htmlAudioElement) {\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n if (this._htmlAudioElement.loop !== this.loop) {\r\n this._htmlAudioElement.loop = this.loop;\r\n }\r\n }\r\n else {\r\n if (this._soundSource) {\r\n this._soundSource.playbackRate.value = this._playbackRate;\r\n if (this._soundSource.loop !== this.loop) {\r\n this._soundSource.loop = this.loop;\r\n }\r\n if (this._offset !== undefined && this._soundSource.loopStart !== this._offset) {\r\n this._soundSource.loopStart = this._offset;\r\n }\r\n if (this._length !== undefined && this._length !== this._soundSource.loopEnd) {\r\n this._soundSource.loopEnd = (this._offset | 0) + this._length;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n Sound.prototype._createSpatialParameters = function () {\r\n if (Engine.audioEngine.canUseWebAudio && Engine.audioEngine.audioContext) {\r\n if (this._scene.headphone) {\r\n this._panningModel = \"HRTF\";\r\n }\r\n this._soundPanner = Engine.audioEngine.audioContext.createPanner();\r\n if (this._soundPanner && this._outputAudioNode) {\r\n this._updateSpatialParameters();\r\n this._soundPanner.connect(this._outputAudioNode);\r\n this._inputAudioNode = this._soundPanner;\r\n }\r\n }\r\n };\r\n Sound.prototype._updateSpatialParameters = function () {\r\n if (this.spatialSound && this._soundPanner) {\r\n if (this.useCustomAttenuation) {\r\n // Tricks to disable in a way embedded Web Audio attenuation\r\n this._soundPanner.distanceModel = \"linear\";\r\n this._soundPanner.maxDistance = Number.MAX_VALUE;\r\n this._soundPanner.refDistance = 1;\r\n this._soundPanner.rolloffFactor = 1;\r\n this._soundPanner.panningModel = this._panningModel;\r\n }\r\n else {\r\n this._soundPanner.distanceModel = this.distanceModel;\r\n this._soundPanner.maxDistance = this.maxDistance;\r\n this._soundPanner.refDistance = this.refDistance;\r\n this._soundPanner.rolloffFactor = this.rolloffFactor;\r\n this._soundPanner.panningModel = this._panningModel;\r\n }\r\n }\r\n };\r\n /**\r\n * Switch the panning model to HRTF:\r\n * Renders a stereo output of higher quality than equalpower — it uses a convolution with measured impulse responses from human subjects.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n Sound.prototype.switchPanningModelToHRTF = function () {\r\n this._panningModel = \"HRTF\";\r\n this._switchPanningModel();\r\n };\r\n /**\r\n * Switch the panning model to Equal Power:\r\n * Represents the equal-power panning algorithm, generally regarded as simple and efficient. equalpower is the default value.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n Sound.prototype.switchPanningModelToEqualPower = function () {\r\n this._panningModel = \"equalpower\";\r\n this._switchPanningModel();\r\n };\r\n Sound.prototype._switchPanningModel = function () {\r\n if (Engine.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner) {\r\n this._soundPanner.panningModel = this._panningModel;\r\n }\r\n };\r\n /**\r\n * Connect this sound to a sound track audio node like gain...\r\n * @param soundTrackAudioNode the sound track audio node to connect to\r\n */\r\n Sound.prototype.connectToSoundTrackAudioNode = function (soundTrackAudioNode) {\r\n if (Engine.audioEngine.canUseWebAudio && this._outputAudioNode) {\r\n if (this._isOutputConnected) {\r\n this._outputAudioNode.disconnect();\r\n }\r\n this._outputAudioNode.connect(soundTrackAudioNode);\r\n this._isOutputConnected = true;\r\n }\r\n };\r\n /**\r\n * Transform this sound into a directional source\r\n * @param coneInnerAngle Size of the inner cone in degree\r\n * @param coneOuterAngle Size of the outer cone in degree\r\n * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)\r\n */\r\n Sound.prototype.setDirectionalCone = function (coneInnerAngle, coneOuterAngle, coneOuterGain) {\r\n if (coneOuterAngle < coneInnerAngle) {\r\n Logger.Error(\"setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneInnerAngle = coneInnerAngle;\r\n this._coneOuterAngle = coneOuterAngle;\r\n this._coneOuterGain = coneOuterGain;\r\n this._isDirectional = true;\r\n if (this.isPlaying && this.loop) {\r\n this.stop();\r\n this.play(0, this._offset, this._length);\r\n }\r\n };\r\n Object.defineProperty(Sound.prototype, \"directionalConeInnerAngle\", {\r\n /**\r\n * Gets or sets the inner angle for the directional cone.\r\n */\r\n get: function () {\r\n return this._coneInnerAngle;\r\n },\r\n /**\r\n * Gets or sets the inner angle for the directional cone.\r\n */\r\n set: function (value) {\r\n if (value != this._coneInnerAngle) {\r\n if (this._coneOuterAngle < value) {\r\n Logger.Error(\"directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneInnerAngle = value;\r\n if (Engine.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner) {\r\n this._soundPanner.coneInnerAngle = this._coneInnerAngle;\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Sound.prototype, \"directionalConeOuterAngle\", {\r\n /**\r\n * Gets or sets the outer angle for the directional cone.\r\n */\r\n get: function () {\r\n return this._coneOuterAngle;\r\n },\r\n /**\r\n * Gets or sets the outer angle for the directional cone.\r\n */\r\n set: function (value) {\r\n if (value != this._coneOuterAngle) {\r\n if (value < this._coneInnerAngle) {\r\n Logger.Error(\"directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneOuterAngle = value;\r\n if (Engine.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner) {\r\n this._soundPanner.coneOuterAngle = this._coneOuterAngle;\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the position of the emitter if spatial sound is enabled\r\n * @param newPosition Defines the new posisiton\r\n */\r\n Sound.prototype.setPosition = function (newPosition) {\r\n this._position = newPosition;\r\n if (Engine.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && !isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z)) {\r\n this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);\r\n }\r\n };\r\n /**\r\n * Sets the local direction of the emitter if spatial sound is enabled\r\n * @param newLocalDirection Defines the new local direction\r\n */\r\n Sound.prototype.setLocalDirectionToMesh = function (newLocalDirection) {\r\n this._localDirection = newLocalDirection;\r\n if (Engine.audioEngine.canUseWebAudio && this._connectedTransformNode && this.isPlaying) {\r\n this._updateDirection();\r\n }\r\n };\r\n Sound.prototype._updateDirection = function () {\r\n if (!this._connectedTransformNode || !this._soundPanner) {\r\n return;\r\n }\r\n var mat = this._connectedTransformNode.getWorldMatrix();\r\n var direction = Vector3.TransformNormal(this._localDirection, mat);\r\n direction.normalize();\r\n this._soundPanner.setOrientation(direction.x, direction.y, direction.z);\r\n };\r\n /** @hidden */\r\n Sound.prototype.updateDistanceFromListener = function () {\r\n if (Engine.audioEngine.canUseWebAudio && this._connectedTransformNode && this.useCustomAttenuation && this._soundGain && this._scene.activeCamera) {\r\n var distance = this._connectedTransformNode.getDistanceToCamera(this._scene.activeCamera);\r\n this._soundGain.gain.value = this._customAttenuationFunction(this._volume, distance, this.maxDistance, this.refDistance, this.rolloffFactor);\r\n }\r\n };\r\n /**\r\n * Sets a new custom attenuation function for the sound.\r\n * @param callback Defines the function used for the attenuation\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-your-own-custom-attenuation-function\r\n */\r\n Sound.prototype.setAttenuationFunction = function (callback) {\r\n this._customAttenuationFunction = callback;\r\n };\r\n /**\r\n * Play the sound\r\n * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.\r\n * @param offset (optional) Start the sound at a specific time in seconds\r\n * @param length (optional) Sound duration (in seconds)\r\n */\r\n Sound.prototype.play = function (time, offset, length) {\r\n var _this = this;\r\n if (this._isReadyToPlay && this._scene.audioEnabled && Engine.audioEngine.audioContext) {\r\n try {\r\n if (this._startOffset < 0) {\r\n time = -this._startOffset;\r\n this._startOffset = 0;\r\n }\r\n var startTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;\r\n if (!this._soundSource || !this._streamingSource) {\r\n if (this.spatialSound && this._soundPanner) {\r\n if (!isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z)) {\r\n this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);\r\n }\r\n if (this._isDirectional) {\r\n this._soundPanner.coneInnerAngle = this._coneInnerAngle;\r\n this._soundPanner.coneOuterAngle = this._coneOuterAngle;\r\n this._soundPanner.coneOuterGain = this._coneOuterGain;\r\n if (this._connectedTransformNode) {\r\n this._updateDirection();\r\n }\r\n else {\r\n this._soundPanner.setOrientation(this._localDirection.x, this._localDirection.y, this._localDirection.z);\r\n }\r\n }\r\n }\r\n }\r\n if (this._streaming) {\r\n if (!this._streamingSource) {\r\n this._streamingSource = Engine.audioEngine.audioContext.createMediaElementSource(this._htmlAudioElement);\r\n this._htmlAudioElement.onended = function () {\r\n _this._onended();\r\n };\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n }\r\n this._streamingSource.disconnect();\r\n if (this._inputAudioNode) {\r\n this._streamingSource.connect(this._inputAudioNode);\r\n }\r\n if (this._htmlAudioElement) {\r\n // required to manage properly the new suspended default state of Chrome\r\n // When the option 'streaming: true' is used, we need first to wait for\r\n // the audio engine to be unlocked by a user gesture before trying to play\r\n // an HTML Audio elememt\r\n var tryToPlay = function () {\r\n if (Engine.audioEngine.unlocked) {\r\n var playPromise = _this._htmlAudioElement.play();\r\n // In browsers that don’t yet support this functionality,\r\n // playPromise won’t be defined.\r\n if (playPromise !== undefined) {\r\n playPromise.catch(function (error) {\r\n // Automatic playback failed.\r\n // Waiting for the audio engine to be unlocked by user click on unmute\r\n Engine.audioEngine.lock();\r\n if (_this.loop || _this.autoplay) {\r\n Engine.audioEngine.onAudioUnlockedObservable.addOnce(function () {\r\n tryToPlay();\r\n });\r\n }\r\n });\r\n }\r\n }\r\n else {\r\n if (_this.loop || _this.autoplay) {\r\n Engine.audioEngine.onAudioUnlockedObservable.addOnce(function () {\r\n tryToPlay();\r\n });\r\n }\r\n }\r\n };\r\n tryToPlay();\r\n }\r\n }\r\n else {\r\n var tryToPlay = function () {\r\n if (Engine.audioEngine.audioContext) {\r\n length = length || _this._length;\r\n offset = offset || _this._offset;\r\n if (_this._soundSource) {\r\n var oldSource_1 = _this._soundSource;\r\n oldSource_1.onended = function () {\r\n oldSource_1.disconnect();\r\n };\r\n }\r\n _this._soundSource = Engine.audioEngine.audioContext.createBufferSource();\r\n if (_this._soundSource && _this._inputAudioNode) {\r\n _this._soundSource.buffer = _this._audioBuffer;\r\n _this._soundSource.connect(_this._inputAudioNode);\r\n _this._soundSource.loop = _this.loop;\r\n if (offset !== undefined) {\r\n _this._soundSource.loopStart = offset;\r\n }\r\n if (length !== undefined) {\r\n _this._soundSource.loopEnd = (offset | 0) + length;\r\n }\r\n _this._soundSource.playbackRate.value = _this._playbackRate;\r\n _this._soundSource.onended = function () {\r\n _this._onended();\r\n };\r\n startTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;\r\n var actualOffset = _this.isPaused ? _this._startOffset % _this._soundSource.buffer.duration : offset ? offset : 0;\r\n _this._soundSource.start(startTime, actualOffset, _this.loop ? undefined : length);\r\n }\r\n }\r\n };\r\n if (Engine.audioEngine.audioContext.state === \"suspended\") {\r\n // Wait a bit for FF as context seems late to be ready.\r\n setTimeout(function () {\r\n if (Engine.audioEngine.audioContext.state === \"suspended\") {\r\n // Automatic playback failed.\r\n // Waiting for the audio engine to be unlocked by user click on unmute\r\n Engine.audioEngine.lock();\r\n if (_this.loop || _this.autoplay) {\r\n Engine.audioEngine.onAudioUnlockedObservable.addOnce(function () {\r\n tryToPlay();\r\n });\r\n }\r\n }\r\n else {\r\n tryToPlay();\r\n }\r\n }, 500);\r\n }\r\n else {\r\n tryToPlay();\r\n }\r\n }\r\n this._startTime = startTime;\r\n this.isPlaying = true;\r\n this.isPaused = false;\r\n }\r\n catch (ex) {\r\n Logger.Error(\"Error while trying to play audio: \" + this.name + \", \" + ex.message);\r\n }\r\n }\r\n };\r\n Sound.prototype._onended = function () {\r\n this.isPlaying = false;\r\n this._startOffset = 0;\r\n if (this.onended) {\r\n this.onended();\r\n }\r\n this.onEndedObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Stop the sound\r\n * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.\r\n */\r\n Sound.prototype.stop = function (time) {\r\n var _this = this;\r\n if (this.isPlaying) {\r\n if (this._streaming) {\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n // Test needed for Firefox or it will generate an Invalid State Error\r\n if (this._htmlAudioElement.currentTime > 0) {\r\n this._htmlAudioElement.currentTime = 0;\r\n }\r\n }\r\n else {\r\n this._streamingSource.disconnect();\r\n }\r\n this.isPlaying = false;\r\n }\r\n else if (Engine.audioEngine.audioContext && this._soundSource) {\r\n var stopTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;\r\n this._soundSource.stop(stopTime);\r\n this._soundSource.onended = function () {\r\n _this.isPlaying = false;\r\n };\r\n if (!this.isPaused) {\r\n this._startOffset = 0;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Put the sound in pause\r\n */\r\n Sound.prototype.pause = function () {\r\n if (this.isPlaying) {\r\n this.isPaused = true;\r\n if (this._streaming) {\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n }\r\n else {\r\n this._streamingSource.disconnect();\r\n }\r\n }\r\n else if (Engine.audioEngine.audioContext) {\r\n this.stop(0);\r\n this._startOffset += Engine.audioEngine.audioContext.currentTime - this._startTime;\r\n }\r\n }\r\n };\r\n /**\r\n * Sets a dedicated volume for this sounds\r\n * @param newVolume Define the new volume of the sound\r\n * @param time Define time for gradual change to new volume\r\n */\r\n Sound.prototype.setVolume = function (newVolume, time) {\r\n if (Engine.audioEngine.canUseWebAudio && this._soundGain) {\r\n if (time && Engine.audioEngine.audioContext) {\r\n this._soundGain.gain.cancelScheduledValues(Engine.audioEngine.audioContext.currentTime);\r\n this._soundGain.gain.setValueAtTime(this._soundGain.gain.value, Engine.audioEngine.audioContext.currentTime);\r\n this._soundGain.gain.linearRampToValueAtTime(newVolume, Engine.audioEngine.audioContext.currentTime + time);\r\n }\r\n else {\r\n this._soundGain.gain.value = newVolume;\r\n }\r\n }\r\n this._volume = newVolume;\r\n };\r\n /**\r\n * Set the sound play back rate\r\n * @param newPlaybackRate Define the playback rate the sound should be played at\r\n */\r\n Sound.prototype.setPlaybackRate = function (newPlaybackRate) {\r\n this._playbackRate = newPlaybackRate;\r\n if (this.isPlaying) {\r\n if (this._streaming && this._htmlAudioElement) {\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n }\r\n else if (this._soundSource) {\r\n this._soundSource.playbackRate.value = this._playbackRate;\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the volume of the sound.\r\n * @returns the volume of the sound\r\n */\r\n Sound.prototype.getVolume = function () {\r\n return this._volume;\r\n };\r\n /**\r\n * Attach the sound to a dedicated mesh\r\n * @param transformNode The transform node to connect the sound with\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#attaching-a-sound-to-a-mesh\r\n */\r\n Sound.prototype.attachToMesh = function (transformNode) {\r\n var _this = this;\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._registerFunc = null;\r\n }\r\n this._connectedTransformNode = transformNode;\r\n if (!this.spatialSound) {\r\n this.spatialSound = true;\r\n this._createSpatialParameters();\r\n if (this.isPlaying && this.loop) {\r\n this.stop();\r\n this.play(0, this._offset, this._length);\r\n }\r\n }\r\n this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode);\r\n this._registerFunc = function (transformNode) { return _this._onRegisterAfterWorldMatrixUpdate(transformNode); };\r\n this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc);\r\n };\r\n /**\r\n * Detach the sound from the previously attached mesh\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#attaching-a-sound-to-a-mesh\r\n */\r\n Sound.prototype.detachFromMesh = function () {\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._registerFunc = null;\r\n this._connectedTransformNode = null;\r\n }\r\n };\r\n Sound.prototype._onRegisterAfterWorldMatrixUpdate = function (node) {\r\n if (this._positionInEmitterSpace) {\r\n node.worldMatrixFromCache.invertToRef(TmpVectors.Matrix[0]);\r\n this.setPosition(TmpVectors.Matrix[0].getTranslation());\r\n }\r\n else {\r\n if (!node.getBoundingInfo) {\r\n this.setPosition(node.absolutePosition);\r\n }\r\n else {\r\n var mesh = node;\r\n var boundingInfo = mesh.getBoundingInfo();\r\n this.setPosition(boundingInfo.boundingSphere.centerWorld);\r\n }\r\n }\r\n if (Engine.audioEngine.canUseWebAudio && this._isDirectional && this.isPlaying) {\r\n this._updateDirection();\r\n }\r\n };\r\n /**\r\n * Clone the current sound in the scene.\r\n * @returns the new sound clone\r\n */\r\n Sound.prototype.clone = function () {\r\n var _this = this;\r\n if (!this._streaming) {\r\n var setBufferAndRun = function () {\r\n if (_this._isReadyToPlay) {\r\n clonedSound._audioBuffer = _this.getAudioBuffer();\r\n clonedSound._isReadyToPlay = true;\r\n if (clonedSound.autoplay) {\r\n clonedSound.play(0, _this._offset, _this._length);\r\n }\r\n }\r\n else {\r\n window.setTimeout(setBufferAndRun, 300);\r\n }\r\n };\r\n var currentOptions = {\r\n autoplay: this.autoplay,\r\n loop: this.loop,\r\n volume: this._volume,\r\n spatialSound: this.spatialSound,\r\n maxDistance: this.maxDistance,\r\n useCustomAttenuation: this.useCustomAttenuation,\r\n rolloffFactor: this.rolloffFactor,\r\n refDistance: this.refDistance,\r\n distanceModel: this.distanceModel,\r\n };\r\n var clonedSound = new Sound(this.name + \"_cloned\", new ArrayBuffer(0), this._scene, null, currentOptions);\r\n if (this.useCustomAttenuation) {\r\n clonedSound.setAttenuationFunction(this._customAttenuationFunction);\r\n }\r\n clonedSound.setPosition(this._position);\r\n clonedSound.setPlaybackRate(this._playbackRate);\r\n setBufferAndRun();\r\n return clonedSound;\r\n }\r\n // Can't clone a streaming sound\r\n else {\r\n return null;\r\n }\r\n };\r\n /**\r\n * Gets the current underlying audio buffer containing the data\r\n * @returns the audio buffer\r\n */\r\n Sound.prototype.getAudioBuffer = function () {\r\n return this._audioBuffer;\r\n };\r\n /**\r\n * Gets the WebAudio AudioBufferSourceNode, lets you keep track of and stop instances of this Sound.\r\n * @returns the source node\r\n */\r\n Sound.prototype.getSoundSource = function () {\r\n return this._soundSource;\r\n };\r\n /**\r\n * Gets the WebAudio GainNode, gives you precise control over the gain of instances of this Sound.\r\n * @returns the gain node\r\n */\r\n Sound.prototype.getSoundGain = function () {\r\n return this._soundGain;\r\n };\r\n /**\r\n * Serializes the Sound in a JSON representation\r\n * @returns the JSON representation of the sound\r\n */\r\n Sound.prototype.serialize = function () {\r\n var serializationObject = {\r\n name: this.name,\r\n url: this.name,\r\n autoplay: this.autoplay,\r\n loop: this.loop,\r\n volume: this._volume,\r\n spatialSound: this.spatialSound,\r\n maxDistance: this.maxDistance,\r\n rolloffFactor: this.rolloffFactor,\r\n refDistance: this.refDistance,\r\n distanceModel: this.distanceModel,\r\n playbackRate: this._playbackRate,\r\n panningModel: this._panningModel,\r\n soundTrackId: this.soundTrackId,\r\n metadata: this.metadata,\r\n };\r\n if (this.spatialSound) {\r\n if (this._connectedTransformNode) {\r\n serializationObject.connectedMeshId = this._connectedTransformNode.id;\r\n }\r\n serializationObject.position = this._position.asArray();\r\n serializationObject.refDistance = this.refDistance;\r\n serializationObject.distanceModel = this.distanceModel;\r\n serializationObject.isDirectional = this._isDirectional;\r\n serializationObject.localDirectionToMesh = this._localDirection.asArray();\r\n serializationObject.coneInnerAngle = this._coneInnerAngle;\r\n serializationObject.coneOuterAngle = this._coneOuterAngle;\r\n serializationObject.coneOuterGain = this._coneOuterGain;\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse a JSON representation of a sound to innstantiate in a given scene\r\n * @param parsedSound Define the JSON representation of the sound (usually coming from the serialize method)\r\n * @param scene Define the scene the new parsed sound should be created in\r\n * @param rootUrl Define the rooturl of the load in case we need to fetch relative dependencies\r\n * @param sourceSound Define a cound place holder if do not need to instantiate a new one\r\n * @returns the newly parsed sound\r\n */\r\n Sound.Parse = function (parsedSound, scene, rootUrl, sourceSound) {\r\n var soundName = parsedSound.name;\r\n var soundUrl;\r\n if (parsedSound.url) {\r\n soundUrl = rootUrl + parsedSound.url;\r\n }\r\n else {\r\n soundUrl = rootUrl + soundName;\r\n }\r\n var options = {\r\n autoplay: parsedSound.autoplay,\r\n loop: parsedSound.loop,\r\n volume: parsedSound.volume,\r\n spatialSound: parsedSound.spatialSound,\r\n maxDistance: parsedSound.maxDistance,\r\n rolloffFactor: parsedSound.rolloffFactor,\r\n refDistance: parsedSound.refDistance,\r\n distanceModel: parsedSound.distanceModel,\r\n playbackRate: parsedSound.playbackRate,\r\n };\r\n var newSound;\r\n if (!sourceSound) {\r\n newSound = new Sound(soundName, soundUrl, scene, function () {\r\n scene._removePendingData(newSound);\r\n }, options);\r\n scene._addPendingData(newSound);\r\n }\r\n else {\r\n var setBufferAndRun = function () {\r\n if (sourceSound._isReadyToPlay) {\r\n newSound._audioBuffer = sourceSound.getAudioBuffer();\r\n newSound._isReadyToPlay = true;\r\n if (newSound.autoplay) {\r\n newSound.play(0, newSound._offset, newSound._length);\r\n }\r\n }\r\n else {\r\n window.setTimeout(setBufferAndRun, 300);\r\n }\r\n };\r\n newSound = new Sound(soundName, new ArrayBuffer(0), scene, null, options);\r\n setBufferAndRun();\r\n }\r\n if (parsedSound.position) {\r\n var soundPosition = Vector3.FromArray(parsedSound.position);\r\n newSound.setPosition(soundPosition);\r\n }\r\n if (parsedSound.isDirectional) {\r\n newSound.setDirectionalCone(parsedSound.coneInnerAngle || 360, parsedSound.coneOuterAngle || 360, parsedSound.coneOuterGain || 0);\r\n if (parsedSound.localDirectionToMesh) {\r\n var localDirectionToMesh = Vector3.FromArray(parsedSound.localDirectionToMesh);\r\n newSound.setLocalDirectionToMesh(localDirectionToMesh);\r\n }\r\n }\r\n if (parsedSound.connectedMeshId) {\r\n var connectedMesh = scene.getMeshByID(parsedSound.connectedMeshId);\r\n if (connectedMesh) {\r\n newSound.attachToMesh(connectedMesh);\r\n }\r\n }\r\n if (parsedSound.metadata) {\r\n newSound.metadata = parsedSound.metadata;\r\n }\r\n return newSound;\r\n };\r\n /** @hidden */\r\n Sound._SceneComponentInitialization = function (_) {\r\n throw _DevTools.WarnImport(\"AudioSceneComponent\");\r\n };\r\n return Sound;\r\n}());\r\nexport { Sound };\r\n//# sourceMappingURL=sound.js.map","import { Logger } from \"../Misc/logger\";\r\n/**\r\n * Wraps one or more Sound objects and selects one with random weight for playback.\r\n */\r\nvar WeightedSound = /** @class */ (function () {\r\n /**\r\n * Creates a new WeightedSound from the list of sounds given.\r\n * @param loop When true a Sound will be selected and played when the current playing Sound completes.\r\n * @param sounds Array of Sounds that will be selected from.\r\n * @param weights Array of number values for selection weights; length must equal sounds, values will be normalized to 1\r\n */\r\n function WeightedSound(loop, sounds, weights) {\r\n var _this = this;\r\n /** When true a Sound will be selected and played when the current playing Sound completes. */\r\n this.loop = false;\r\n this._coneInnerAngle = 360;\r\n this._coneOuterAngle = 360;\r\n this._volume = 1;\r\n /** A Sound is currently playing. */\r\n this.isPlaying = false;\r\n /** A Sound is currently paused. */\r\n this.isPaused = false;\r\n this._sounds = [];\r\n this._weights = [];\r\n if (sounds.length !== weights.length) {\r\n throw new Error('Sounds length does not equal weights length');\r\n }\r\n this.loop = loop;\r\n this._weights = weights;\r\n // Normalize the weights\r\n var weightSum = 0;\r\n for (var _i = 0, weights_1 = weights; _i < weights_1.length; _i++) {\r\n var weight = weights_1[_i];\r\n weightSum += weight;\r\n }\r\n var invWeightSum = weightSum > 0 ? 1 / weightSum : 0;\r\n for (var i = 0; i < this._weights.length; i++) {\r\n this._weights[i] *= invWeightSum;\r\n }\r\n this._sounds = sounds;\r\n for (var _a = 0, _b = this._sounds; _a < _b.length; _a++) {\r\n var sound = _b[_a];\r\n sound.onEndedObservable.add(function () { _this._onended(); });\r\n }\r\n }\r\n Object.defineProperty(WeightedSound.prototype, \"directionalConeInnerAngle\", {\r\n /**\r\n * The size of cone in degrees for a directional sound in which there will be no attenuation.\r\n */\r\n get: function () {\r\n return this._coneInnerAngle;\r\n },\r\n /**\r\n * The size of cone in degress for a directional sound in which there will be no attenuation.\r\n */\r\n set: function (value) {\r\n if (value !== this._coneInnerAngle) {\r\n if (this._coneOuterAngle < value) {\r\n Logger.Error(\"directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneInnerAngle = value;\r\n for (var _i = 0, _a = this._sounds; _i < _a.length; _i++) {\r\n var sound = _a[_i];\r\n sound.directionalConeInnerAngle = value;\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WeightedSound.prototype, \"directionalConeOuterAngle\", {\r\n /**\r\n * Size of cone in degrees for a directional sound outside of which there will be no sound.\r\n * Listener angles between innerAngle and outerAngle will falloff linearly.\r\n */\r\n get: function () {\r\n return this._coneOuterAngle;\r\n },\r\n /**\r\n * Size of cone in degrees for a directional sound outside of which there will be no sound.\r\n * Listener angles between innerAngle and outerAngle will falloff linearly.\r\n */\r\n set: function (value) {\r\n if (value !== this._coneOuterAngle) {\r\n if (value < this._coneInnerAngle) {\r\n Logger.Error(\"directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneOuterAngle = value;\r\n for (var _i = 0, _a = this._sounds; _i < _a.length; _i++) {\r\n var sound = _a[_i];\r\n sound.directionalConeOuterAngle = value;\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WeightedSound.prototype, \"volume\", {\r\n /**\r\n * Playback volume.\r\n */\r\n get: function () {\r\n return this._volume;\r\n },\r\n /**\r\n * Playback volume.\r\n */\r\n set: function (value) {\r\n if (value !== this._volume) {\r\n for (var _i = 0, _a = this._sounds; _i < _a.length; _i++) {\r\n var sound = _a[_i];\r\n sound.setVolume(value);\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n WeightedSound.prototype._onended = function () {\r\n if (this._currentIndex !== undefined) {\r\n this._sounds[this._currentIndex].autoplay = false;\r\n }\r\n if (this.loop && this.isPlaying) {\r\n this.play();\r\n }\r\n else {\r\n this.isPlaying = false;\r\n }\r\n };\r\n /**\r\n * Suspend playback\r\n */\r\n WeightedSound.prototype.pause = function () {\r\n this.isPaused = true;\r\n if (this._currentIndex !== undefined) {\r\n this._sounds[this._currentIndex].pause();\r\n }\r\n };\r\n /**\r\n * Stop playback\r\n */\r\n WeightedSound.prototype.stop = function () {\r\n this.isPlaying = false;\r\n if (this._currentIndex !== undefined) {\r\n this._sounds[this._currentIndex].stop();\r\n }\r\n };\r\n /**\r\n * Start playback.\r\n * @param startOffset Position the clip head at a specific time in seconds.\r\n */\r\n WeightedSound.prototype.play = function (startOffset) {\r\n if (!this.isPaused) {\r\n this.stop();\r\n var randomValue = Math.random();\r\n var total = 0;\r\n for (var i = 0; i < this._weights.length; i++) {\r\n total += this._weights[i];\r\n if (randomValue <= total) {\r\n this._currentIndex = i;\r\n break;\r\n }\r\n }\r\n }\r\n var sound = this._sounds[this._currentIndex];\r\n if (sound.isReady()) {\r\n sound.play(0, this.isPaused ? undefined : startOffset);\r\n }\r\n else {\r\n sound.autoplay = true;\r\n }\r\n this.isPlaying = true;\r\n this.isPaused = false;\r\n };\r\n return WeightedSound;\r\n}());\r\nexport { WeightedSound };\r\n//# sourceMappingURL=weightedsound.js.map","import { Vector3 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { AnimationEvent } from \"@babylonjs/core/Animations/animationEvent\";\r\nimport { Sound } from \"@babylonjs/core/Audio/sound\";\r\nimport { WeightedSound } from \"@babylonjs/core/Audio/weightedsound\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nvar NAME = \"MSFT_audio_emitter\";\r\n/**\r\n * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)\r\n */\r\nvar MSFT_audio_emitter = /** @class */ (function () {\r\n /** @hidden */\r\n function MSFT_audio_emitter(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n MSFT_audio_emitter.prototype.dispose = function () {\r\n this._loader = null;\r\n this._clips = null;\r\n this._emitters = null;\r\n };\r\n /** @hidden */\r\n MSFT_audio_emitter.prototype.onLoading = function () {\r\n var extensions = this._loader.gltf.extensions;\r\n if (extensions && extensions[this.name]) {\r\n var extension = extensions[this.name];\r\n this._clips = extension.clips;\r\n this._emitters = extension.emitters;\r\n ArrayItem.Assign(this._clips);\r\n ArrayItem.Assign(this._emitters);\r\n }\r\n };\r\n /** @hidden */\r\n MSFT_audio_emitter.prototype.loadSceneAsync = function (context, scene) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, scene, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadSceneAsync(context, scene));\r\n for (var _i = 0, _a = extension.emitters; _i < _a.length; _i++) {\r\n var emitterIndex = _a[_i];\r\n var emitter = ArrayItem.Get(extensionContext + \"/emitters\", _this._emitters, emitterIndex);\r\n if (emitter.refDistance != undefined || emitter.maxDistance != undefined || emitter.rolloffFactor != undefined ||\r\n emitter.distanceModel != undefined || emitter.innerAngle != undefined || emitter.outerAngle != undefined) {\r\n throw new Error(extensionContext + \": Direction or Distance properties are not allowed on emitters attached to a scene\");\r\n }\r\n promises.push(_this._loadEmitterAsync(extensionContext + \"/emitters/\" + emitter.index, emitter));\r\n }\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n /** @hidden */\r\n MSFT_audio_emitter.prototype.loadNodeAsync = function (context, node, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n return _this._loader.loadNodeAsync(extensionContext, node, function (babylonMesh) {\r\n var _loop_1 = function (emitterIndex) {\r\n var emitter = ArrayItem.Get(extensionContext + \"/emitters\", _this._emitters, emitterIndex);\r\n promises.push(_this._loadEmitterAsync(extensionContext + \"/emitters/\" + emitter.index, emitter).then(function () {\r\n for (var _i = 0, _a = emitter._babylonSounds; _i < _a.length; _i++) {\r\n var sound = _a[_i];\r\n sound.attachToMesh(babylonMesh);\r\n if (emitter.innerAngle != undefined || emitter.outerAngle != undefined) {\r\n sound.setLocalDirectionToMesh(Vector3.Forward());\r\n sound.setDirectionalCone(2 * Tools.ToDegrees(emitter.innerAngle == undefined ? Math.PI : emitter.innerAngle), 2 * Tools.ToDegrees(emitter.outerAngle == undefined ? Math.PI : emitter.outerAngle), 0);\r\n }\r\n }\r\n }));\r\n };\r\n for (var _i = 0, _a = extension.emitters; _i < _a.length; _i++) {\r\n var emitterIndex = _a[_i];\r\n _loop_1(emitterIndex);\r\n }\r\n assign(babylonMesh);\r\n }).then(function (babylonMesh) {\r\n return Promise.all(promises).then(function () {\r\n return babylonMesh;\r\n });\r\n });\r\n });\r\n };\r\n /** @hidden */\r\n MSFT_audio_emitter.prototype.loadAnimationAsync = function (context, animation) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, animation, this.name, function (extensionContext, extension) {\r\n return _this._loader.loadAnimationAsync(context, animation).then(function (babylonAnimationGroup) {\r\n var promises = new Array();\r\n ArrayItem.Assign(extension.events);\r\n for (var _i = 0, _a = extension.events; _i < _a.length; _i++) {\r\n var event_1 = _a[_i];\r\n promises.push(_this._loadAnimationEventAsync(extensionContext + \"/events/\" + event_1.index, context, animation, event_1, babylonAnimationGroup));\r\n }\r\n return Promise.all(promises).then(function () {\r\n return babylonAnimationGroup;\r\n });\r\n });\r\n });\r\n };\r\n MSFT_audio_emitter.prototype._loadClipAsync = function (context, clip) {\r\n if (clip._objectURL) {\r\n return clip._objectURL;\r\n }\r\n var promise;\r\n if (clip.uri) {\r\n promise = this._loader.loadUriAsync(context, clip, clip.uri);\r\n }\r\n else {\r\n var bufferView = ArrayItem.Get(context + \"/bufferView\", this._loader.gltf.bufferViews, clip.bufferView);\r\n promise = this._loader.loadBufferViewAsync(\"/bufferViews/\" + bufferView.index, bufferView);\r\n }\r\n clip._objectURL = promise.then(function (data) {\r\n return URL.createObjectURL(new Blob([data], { type: clip.mimeType }));\r\n });\r\n return clip._objectURL;\r\n };\r\n MSFT_audio_emitter.prototype._loadEmitterAsync = function (context, emitter) {\r\n var _this = this;\r\n emitter._babylonSounds = emitter._babylonSounds || [];\r\n if (!emitter._babylonData) {\r\n var clipPromises = new Array();\r\n var name_1 = emitter.name || \"emitter\" + emitter.index;\r\n var options_1 = {\r\n loop: false,\r\n autoplay: false,\r\n volume: emitter.volume == undefined ? 1 : emitter.volume,\r\n };\r\n var _loop_2 = function (i) {\r\n var clipContext = \"/extensions/\" + this_1.name + \"/clips\";\r\n var clip = ArrayItem.Get(clipContext, this_1._clips, emitter.clips[i].clip);\r\n clipPromises.push(this_1._loadClipAsync(clipContext + \"/\" + emitter.clips[i].clip, clip).then(function (objectURL) {\r\n var sound = emitter._babylonSounds[i] = new Sound(name_1, objectURL, _this._loader.babylonScene, null, options_1);\r\n sound.refDistance = emitter.refDistance || 1;\r\n sound.maxDistance = emitter.maxDistance || 256;\r\n sound.rolloffFactor = emitter.rolloffFactor || 1;\r\n sound.distanceModel = emitter.distanceModel || 'exponential';\r\n sound._positionInEmitterSpace = true;\r\n }));\r\n };\r\n var this_1 = this;\r\n for (var i = 0; i < emitter.clips.length; i++) {\r\n _loop_2(i);\r\n }\r\n var promise = Promise.all(clipPromises).then(function () {\r\n var weights = emitter.clips.map(function (clip) { return clip.weight || 1; });\r\n var weightedSound = new WeightedSound(emitter.loop || false, emitter._babylonSounds, weights);\r\n if (emitter.innerAngle) {\r\n weightedSound.directionalConeInnerAngle = 2 * Tools.ToDegrees(emitter.innerAngle);\r\n }\r\n if (emitter.outerAngle) {\r\n weightedSound.directionalConeOuterAngle = 2 * Tools.ToDegrees(emitter.outerAngle);\r\n }\r\n if (emitter.volume) {\r\n weightedSound.volume = emitter.volume;\r\n }\r\n emitter._babylonData.sound = weightedSound;\r\n });\r\n emitter._babylonData = {\r\n loaded: promise\r\n };\r\n }\r\n return emitter._babylonData.loaded;\r\n };\r\n MSFT_audio_emitter.prototype._getEventAction = function (context, sound, action, time, startOffset) {\r\n switch (action) {\r\n case \"play\" /* play */: {\r\n return function (currentFrame) {\r\n var frameOffset = (startOffset || 0) + (currentFrame - time);\r\n sound.play(frameOffset);\r\n };\r\n }\r\n case \"stop\" /* stop */: {\r\n return function (currentFrame) {\r\n sound.stop();\r\n };\r\n }\r\n case \"pause\" /* pause */: {\r\n return function (currentFrame) {\r\n sound.pause();\r\n };\r\n }\r\n default: {\r\n throw new Error(context + \": Unsupported action \" + action);\r\n }\r\n }\r\n };\r\n MSFT_audio_emitter.prototype._loadAnimationEventAsync = function (context, animationContext, animation, event, babylonAnimationGroup) {\r\n var _this = this;\r\n if (babylonAnimationGroup.targetedAnimations.length == 0) {\r\n return Promise.resolve();\r\n }\r\n var babylonAnimation = babylonAnimationGroup.targetedAnimations[0];\r\n var emitterIndex = event.emitter;\r\n var emitter = ArrayItem.Get(\"/extensions/\" + this.name + \"/emitters\", this._emitters, emitterIndex);\r\n return this._loadEmitterAsync(context, emitter).then(function () {\r\n var sound = emitter._babylonData.sound;\r\n if (sound) {\r\n var babylonAnimationEvent = new AnimationEvent(event.time, _this._getEventAction(context, sound, event.action, event.time, event.startOffset));\r\n babylonAnimation.animation.addEvent(babylonAnimationEvent);\r\n // Make sure all started audio stops when this animation is terminated.\r\n babylonAnimationGroup.onAnimationGroupEndObservable.add(function () {\r\n sound.stop();\r\n });\r\n babylonAnimationGroup.onAnimationGroupPauseObservable.add(function () {\r\n sound.pause();\r\n });\r\n }\r\n });\r\n };\r\n return MSFT_audio_emitter;\r\n}());\r\nexport { MSFT_audio_emitter };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_audio_emitter(loader); });\r\n//# sourceMappingURL=MSFT_audio_emitter.js.map","import { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Deferred } from \"@babylonjs/core/Misc/deferred\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nvar NAME = \"MSFT_lod\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)\r\n */\r\nvar MSFT_lod = /** @class */ (function () {\r\n /** @hidden */\r\n function MSFT_lod(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 100;\r\n /**\r\n * Maximum number of LODs to load, starting from the lowest LOD.\r\n */\r\n this.maxLODsToLoad = 10;\r\n /**\r\n * Observable raised when all node LODs of one level are loaded.\r\n * The event data is the index of the loaded LOD starting from zero.\r\n * Dispose the loader to cancel the loading of the next level of LODs.\r\n */\r\n this.onNodeLODsLoadedObservable = new Observable();\r\n /**\r\n * Observable raised when all material LODs of one level are loaded.\r\n * The event data is the index of the loaded LOD starting from zero.\r\n * Dispose the loader to cancel the loading of the next level of LODs.\r\n */\r\n this.onMaterialLODsLoadedObservable = new Observable();\r\n this._bufferLODs = new Array();\r\n this._nodeIndexLOD = null;\r\n this._nodeSignalLODs = new Array();\r\n this._nodePromiseLODs = new Array();\r\n this._nodeBufferLODs = new Array();\r\n this._materialIndexLOD = null;\r\n this._materialSignalLODs = new Array();\r\n this._materialPromiseLODs = new Array();\r\n this._materialBufferLODs = new Array();\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n MSFT_lod.prototype.dispose = function () {\r\n this._loader = null;\r\n this._nodeIndexLOD = null;\r\n this._nodeSignalLODs.length = 0;\r\n this._nodePromiseLODs.length = 0;\r\n this._nodeBufferLODs.length = 0;\r\n this._materialIndexLOD = null;\r\n this._materialSignalLODs.length = 0;\r\n this._materialPromiseLODs.length = 0;\r\n this._materialBufferLODs.length = 0;\r\n this.onMaterialLODsLoadedObservable.clear();\r\n this.onNodeLODsLoadedObservable.clear();\r\n };\r\n /** @hidden */\r\n MSFT_lod.prototype.onReady = function () {\r\n var _this = this;\r\n var _loop_1 = function (indexLOD) {\r\n var promise = Promise.all(this_1._nodePromiseLODs[indexLOD]).then(function () {\r\n if (indexLOD !== 0) {\r\n _this._loader.endPerformanceCounter(\"Node LOD \" + indexLOD);\r\n _this._loader.log(\"Loaded node LOD \" + indexLOD);\r\n }\r\n _this.onNodeLODsLoadedObservable.notifyObservers(indexLOD);\r\n if (indexLOD !== _this._nodePromiseLODs.length - 1) {\r\n _this._loader.startPerformanceCounter(\"Node LOD \" + (indexLOD + 1));\r\n _this._loadBufferLOD(_this._nodeBufferLODs, indexLOD + 1);\r\n if (_this._nodeSignalLODs[indexLOD]) {\r\n _this._nodeSignalLODs[indexLOD].resolve();\r\n }\r\n }\r\n });\r\n this_1._loader._completePromises.push(promise);\r\n };\r\n var this_1 = this;\r\n for (var indexLOD = 0; indexLOD < this._nodePromiseLODs.length; indexLOD++) {\r\n _loop_1(indexLOD);\r\n }\r\n var _loop_2 = function (indexLOD) {\r\n var promise = Promise.all(this_2._materialPromiseLODs[indexLOD]).then(function () {\r\n if (indexLOD !== 0) {\r\n _this._loader.endPerformanceCounter(\"Material LOD \" + indexLOD);\r\n _this._loader.log(\"Loaded material LOD \" + indexLOD);\r\n }\r\n _this.onMaterialLODsLoadedObservable.notifyObservers(indexLOD);\r\n if (indexLOD !== _this._materialPromiseLODs.length - 1) {\r\n _this._loader.startPerformanceCounter(\"Material LOD \" + (indexLOD + 1));\r\n _this._loadBufferLOD(_this._materialBufferLODs, indexLOD + 1);\r\n if (_this._materialSignalLODs[indexLOD]) {\r\n _this._materialSignalLODs[indexLOD].resolve();\r\n }\r\n }\r\n });\r\n this_2._loader._completePromises.push(promise);\r\n };\r\n var this_2 = this;\r\n for (var indexLOD = 0; indexLOD < this._materialPromiseLODs.length; indexLOD++) {\r\n _loop_2(indexLOD);\r\n }\r\n };\r\n /** @hidden */\r\n MSFT_lod.prototype.loadSceneAsync = function (context, scene) {\r\n var promise = this._loader.loadSceneAsync(context, scene);\r\n this._loadBufferLOD(this._bufferLODs, 0);\r\n return promise;\r\n };\r\n /** @hidden */\r\n MSFT_lod.prototype.loadNodeAsync = function (context, node, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {\r\n var firstPromise;\r\n var nodeLODs = _this._getLODs(extensionContext, node, _this._loader.gltf.nodes, extension.ids);\r\n _this._loader.logOpen(\"\" + extensionContext);\r\n var _loop_3 = function (indexLOD) {\r\n var nodeLOD = nodeLODs[indexLOD];\r\n if (indexLOD !== 0) {\r\n _this._nodeIndexLOD = indexLOD;\r\n _this._nodeSignalLODs[indexLOD] = _this._nodeSignalLODs[indexLOD] || new Deferred();\r\n }\r\n var assign_1 = function (babylonTransformNode) { babylonTransformNode.setEnabled(false); };\r\n var promise = _this._loader.loadNodeAsync(\"/nodes/\" + nodeLOD.index, nodeLOD, assign_1).then(function (babylonMesh) {\r\n if (indexLOD !== 0) {\r\n // TODO: should not rely on _babylonTransformNode\r\n var previousNodeLOD = nodeLODs[indexLOD - 1];\r\n if (previousNodeLOD._babylonTransformNode) {\r\n _this._disposeTransformNode(previousNodeLOD._babylonTransformNode);\r\n delete previousNodeLOD._babylonTransformNode;\r\n }\r\n }\r\n babylonMesh.setEnabled(true);\r\n return babylonMesh;\r\n });\r\n _this._nodePromiseLODs[indexLOD] = _this._nodePromiseLODs[indexLOD] || [];\r\n if (indexLOD === 0) {\r\n firstPromise = promise;\r\n }\r\n else {\r\n _this._nodeIndexLOD = null;\r\n _this._nodePromiseLODs[indexLOD].push(promise);\r\n }\r\n };\r\n for (var indexLOD = 0; indexLOD < nodeLODs.length; indexLOD++) {\r\n _loop_3(indexLOD);\r\n }\r\n _this._loader.logClose();\r\n return firstPromise;\r\n });\r\n };\r\n /** @hidden */\r\n MSFT_lod.prototype._loadMaterialAsync = function (context, material, babylonMesh, babylonDrawMode, assign) {\r\n var _this = this;\r\n // Don't load material LODs if already loading a node LOD.\r\n if (this._nodeIndexLOD) {\r\n return null;\r\n }\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var firstPromise;\r\n var materialLODs = _this._getLODs(extensionContext, material, _this._loader.gltf.materials, extension.ids);\r\n _this._loader.logOpen(\"\" + extensionContext);\r\n var _loop_4 = function (indexLOD) {\r\n var materialLOD = materialLODs[indexLOD];\r\n if (indexLOD !== 0) {\r\n _this._materialIndexLOD = indexLOD;\r\n }\r\n var promise = _this._loader._loadMaterialAsync(\"/materials/\" + materialLOD.index, materialLOD, babylonMesh, babylonDrawMode, function (babylonMaterial) {\r\n if (indexLOD === 0) {\r\n assign(babylonMaterial);\r\n }\r\n }).then(function (babylonMaterial) {\r\n if (indexLOD !== 0) {\r\n assign(babylonMaterial);\r\n // TODO: should not rely on _data\r\n var previousDataLOD = materialLODs[indexLOD - 1]._data;\r\n if (previousDataLOD[babylonDrawMode]) {\r\n _this._disposeMaterials([previousDataLOD[babylonDrawMode].babylonMaterial]);\r\n delete previousDataLOD[babylonDrawMode];\r\n }\r\n }\r\n return babylonMaterial;\r\n });\r\n _this._materialPromiseLODs[indexLOD] = _this._materialPromiseLODs[indexLOD] || [];\r\n if (indexLOD === 0) {\r\n firstPromise = promise;\r\n }\r\n else {\r\n _this._materialIndexLOD = null;\r\n _this._materialPromiseLODs[indexLOD].push(promise);\r\n }\r\n };\r\n for (var indexLOD = 0; indexLOD < materialLODs.length; indexLOD++) {\r\n _loop_4(indexLOD);\r\n }\r\n _this._loader.logClose();\r\n return firstPromise;\r\n });\r\n };\r\n /** @hidden */\r\n MSFT_lod.prototype._loadUriAsync = function (context, property, uri) {\r\n var _this = this;\r\n // Defer the loading of uris if loading a node or material LOD.\r\n if (this._nodeIndexLOD !== null) {\r\n this._loader.log(\"deferred\");\r\n var previousIndexLOD = this._nodeIndexLOD - 1;\r\n this._nodeSignalLODs[previousIndexLOD] = this._nodeSignalLODs[previousIndexLOD] || new Deferred();\r\n return this._nodeSignalLODs[this._nodeIndexLOD - 1].promise.then(function () {\r\n return _this._loader.loadUriAsync(context, property, uri);\r\n });\r\n }\r\n else if (this._materialIndexLOD !== null) {\r\n this._loader.log(\"deferred\");\r\n var previousIndexLOD = this._materialIndexLOD - 1;\r\n this._materialSignalLODs[previousIndexLOD] = this._materialSignalLODs[previousIndexLOD] || new Deferred();\r\n return this._materialSignalLODs[previousIndexLOD].promise.then(function () {\r\n return _this._loader.loadUriAsync(context, property, uri);\r\n });\r\n }\r\n return null;\r\n };\r\n /** @hidden */\r\n MSFT_lod.prototype.loadBufferAsync = function (context, buffer, byteOffset, byteLength) {\r\n if (this._loader.parent.useRangeRequests && !buffer.uri) {\r\n if (!this._loader.bin) {\r\n throw new Error(context + \": Uri is missing or the binary glTF is missing its binary chunk\");\r\n }\r\n var loadAsync = function (bufferLODs, indexLOD) {\r\n var start = byteOffset;\r\n var end = start + byteLength - 1;\r\n var bufferLOD = bufferLODs[indexLOD];\r\n if (bufferLOD) {\r\n bufferLOD.start = Math.min(bufferLOD.start, start);\r\n bufferLOD.end = Math.max(bufferLOD.end, end);\r\n }\r\n else {\r\n bufferLOD = { start: start, end: end, loaded: new Deferred() };\r\n bufferLODs[indexLOD] = bufferLOD;\r\n }\r\n return bufferLOD.loaded.promise.then(function (data) {\r\n return new Uint8Array(data.buffer, data.byteOffset + byteOffset - bufferLOD.start, byteLength);\r\n });\r\n };\r\n this._loader.log(\"deferred\");\r\n if (this._nodeIndexLOD !== null) {\r\n return loadAsync(this._nodeBufferLODs, this._nodeIndexLOD);\r\n }\r\n else if (this._materialIndexLOD !== null) {\r\n return loadAsync(this._materialBufferLODs, this._materialIndexLOD);\r\n }\r\n else {\r\n return loadAsync(this._bufferLODs, 0);\r\n }\r\n }\r\n return null;\r\n };\r\n MSFT_lod.prototype._loadBufferLOD = function (bufferLODs, indexLOD) {\r\n var bufferLOD = bufferLODs[indexLOD];\r\n if (bufferLOD) {\r\n this._loader.log(\"Loading buffer range [\" + bufferLOD.start + \"-\" + bufferLOD.end + \"]\");\r\n this._loader.bin.readAsync(bufferLOD.start, bufferLOD.end - bufferLOD.start + 1).then(function (data) {\r\n bufferLOD.loaded.resolve(data);\r\n }, function (error) {\r\n bufferLOD.loaded.reject(error);\r\n });\r\n }\r\n };\r\n /**\r\n * Gets an array of LOD properties from lowest to highest.\r\n */\r\n MSFT_lod.prototype._getLODs = function (context, property, array, ids) {\r\n if (this.maxLODsToLoad <= 0) {\r\n throw new Error(\"maxLODsToLoad must be greater than zero\");\r\n }\r\n var properties = new Array();\r\n for (var i = ids.length - 1; i >= 0; i--) {\r\n properties.push(ArrayItem.Get(context + \"/ids/\" + ids[i], array, ids[i]));\r\n if (properties.length === this.maxLODsToLoad) {\r\n return properties;\r\n }\r\n }\r\n properties.push(property);\r\n return properties;\r\n };\r\n MSFT_lod.prototype._disposeTransformNode = function (babylonTransformNode) {\r\n var _this = this;\r\n var babylonMaterials = new Array();\r\n var babylonMaterial = babylonTransformNode.material;\r\n if (babylonMaterial) {\r\n babylonMaterials.push(babylonMaterial);\r\n }\r\n for (var _i = 0, _a = babylonTransformNode.getChildMeshes(); _i < _a.length; _i++) {\r\n var babylonMesh = _a[_i];\r\n if (babylonMesh.material) {\r\n babylonMaterials.push(babylonMesh.material);\r\n }\r\n }\r\n babylonTransformNode.dispose();\r\n var babylonMaterialsToDispose = babylonMaterials.filter(function (babylonMaterial) { return _this._loader.babylonScene.meshes.every(function (mesh) { return mesh.material != babylonMaterial; }); });\r\n this._disposeMaterials(babylonMaterialsToDispose);\r\n };\r\n MSFT_lod.prototype._disposeMaterials = function (babylonMaterials) {\r\n var babylonTextures = {};\r\n for (var _i = 0, babylonMaterials_1 = babylonMaterials; _i < babylonMaterials_1.length; _i++) {\r\n var babylonMaterial = babylonMaterials_1[_i];\r\n for (var _a = 0, _b = babylonMaterial.getActiveTextures(); _a < _b.length; _a++) {\r\n var babylonTexture = _b[_a];\r\n babylonTextures[babylonTexture.uniqueId] = babylonTexture;\r\n }\r\n babylonMaterial.dispose();\r\n }\r\n for (var uniqueId in babylonTextures) {\r\n for (var _c = 0, _d = this._loader.babylonScene.materials; _c < _d.length; _c++) {\r\n var babylonMaterial = _d[_c];\r\n if (babylonMaterial.hasTexture(babylonTextures[uniqueId])) {\r\n delete babylonTextures[uniqueId];\r\n }\r\n }\r\n }\r\n for (var uniqueId in babylonTextures) {\r\n babylonTextures[uniqueId].dispose();\r\n }\r\n };\r\n return MSFT_lod;\r\n}());\r\nexport { MSFT_lod };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_lod(loader); });\r\n//# sourceMappingURL=MSFT_lod.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"MSFT_minecraftMesh\";\r\n/** @hidden */\r\nvar MSFT_minecraftMesh = /** @class */ (function () {\r\n function MSFT_minecraftMesh(loader) {\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n MSFT_minecraftMesh.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n MSFT_minecraftMesh.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtraAsync(context, material, this.name, function (extraContext, extra) {\r\n if (extra) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(extraContext + \": Material type not supported\");\r\n }\r\n var promise = _this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);\r\n if (babylonMaterial.needAlphaBlending()) {\r\n babylonMaterial.forceDepthWrite = true;\r\n babylonMaterial.separateCullingPass = true;\r\n }\r\n babylonMaterial.backFaceCulling = babylonMaterial.forceDepthWrite;\r\n babylonMaterial.twoSidedLighting = true;\r\n return promise;\r\n }\r\n return null;\r\n });\r\n };\r\n return MSFT_minecraftMesh;\r\n}());\r\nexport { MSFT_minecraftMesh };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_minecraftMesh(loader); });\r\n//# sourceMappingURL=MSFT_minecraftMesh.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"MSFT_sRGBFactors\";\r\n/** @hidden */\r\nvar MSFT_sRGBFactors = /** @class */ (function () {\r\n function MSFT_sRGBFactors(loader) {\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n MSFT_sRGBFactors.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n MSFT_sRGBFactors.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtraAsync(context, material, this.name, function (extraContext, extra) {\r\n if (extra) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(extraContext + \": Material type not supported\");\r\n }\r\n var promise = _this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);\r\n if (!babylonMaterial.albedoTexture) {\r\n babylonMaterial.albedoColor.toLinearSpaceToRef(babylonMaterial.albedoColor);\r\n }\r\n if (!babylonMaterial.reflectivityTexture) {\r\n babylonMaterial.reflectivityColor.toLinearSpaceToRef(babylonMaterial.reflectivityColor);\r\n }\r\n return promise;\r\n }\r\n return null;\r\n });\r\n };\r\n return MSFT_sRGBFactors;\r\n}());\r\nexport { MSFT_sRGBFactors };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_sRGBFactors(loader); });\r\n//# sourceMappingURL=MSFT_sRGBFactors.js.map","import { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"ExtrasAsMetadata\";\r\n/**\r\n * Store glTF extras (if present) in BJS objects' metadata\r\n */\r\nvar ExtrasAsMetadata = /** @class */ (function () {\r\n /** @hidden */\r\n function ExtrasAsMetadata(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n this.enabled = true;\r\n this._loader = loader;\r\n }\r\n ExtrasAsMetadata.prototype._assignExtras = function (babylonObject, gltfProp) {\r\n if (gltfProp.extras && Object.keys(gltfProp.extras).length > 0) {\r\n var metadata = (babylonObject.metadata = babylonObject.metadata || {});\r\n var gltf = (metadata.gltf = metadata.gltf || {});\r\n gltf.extras = gltfProp.extras;\r\n }\r\n };\r\n /** @hidden */\r\n ExtrasAsMetadata.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n ExtrasAsMetadata.prototype.loadNodeAsync = function (context, node, assign) {\r\n var _this = this;\r\n return this._loader.loadNodeAsync(context, node, function (babylonTransformNode) {\r\n _this._assignExtras(babylonTransformNode, node);\r\n assign(babylonTransformNode);\r\n });\r\n };\r\n /** @hidden */\r\n ExtrasAsMetadata.prototype.loadCameraAsync = function (context, camera, assign) {\r\n var _this = this;\r\n return this._loader.loadCameraAsync(context, camera, function (babylonCamera) {\r\n _this._assignExtras(babylonCamera, camera);\r\n assign(babylonCamera);\r\n });\r\n };\r\n /** @hidden */\r\n ExtrasAsMetadata.prototype.createMaterial = function (context, material, babylonDrawMode) {\r\n var babylonMaterial = this._loader.createMaterial(context, material, babylonDrawMode);\r\n this._assignExtras(babylonMaterial, material);\r\n return babylonMaterial;\r\n };\r\n return ExtrasAsMetadata;\r\n}());\r\nexport { ExtrasAsMetadata };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new ExtrasAsMetadata(loader); });\r\n//# sourceMappingURL=ExtrasAsMetadata.js.map","module.exports = require('./lib/axios');","'use strict';\n\nvar utils = require('./../utils');\nvar settle = require('./../core/settle');\nvar cookies = require('./../helpers/cookies');\nvar buildURL = require('./../helpers/buildURL');\nvar buildFullPath = require('../core/buildFullPath');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar createError = require('../core/createError');\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n var responseType = config.responseType;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n var fullPath = buildFullPath(config.baseURL, config.url);\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(createError(\n timeoutErrorMessage,\n config,\n config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = config.responseType;\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (!requestData) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n","'use strict';\n\nvar utils = require('./utils');\nvar bind = require('./helpers/bind');\nvar Axios = require('./core/Axios');\nvar mergeConfig = require('./core/mergeConfig');\nvar defaults = require('./defaults');\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = require('./cancel/Cancel');\naxios.CancelToken = require('./cancel/CancelToken');\naxios.isCancel = require('./cancel/isCancel');\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\n// Expose isAxiosError\naxios.isAxiosError = require('./helpers/isAxiosError');\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n","'use strict';\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n","'use strict';\n\nvar Cancel = require('./Cancel');\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n","'use strict';\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n","'use strict';\n\nvar utils = require('./../utils');\nvar buildURL = require('../helpers/buildURL');\nvar InterceptorManager = require('./InterceptorManager');\nvar dispatchRequest = require('./dispatchRequest');\nvar mergeConfig = require('./mergeConfig');\nvar validator = require('../helpers/validator');\n\nvar validators = validator.validators;\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n // Set config.method\n if (config.method) {\n config.method = config.method.toLowerCase();\n } else if (this.defaults.method) {\n config.method = this.defaults.method.toLowerCase();\n } else {\n config.method = 'get';\n }\n\n var transitional = config.transitional;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean, '1.0.0'),\n forcedJSONParsing: validators.transitional(validators.boolean, '1.0.0'),\n clarifyTimeoutError: validators.transitional(validators.boolean, '1.0.0')\n }, false);\n }\n\n // filter out skipped interceptors\n var requestInterceptorChain = [];\n var synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n var responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n var promise;\n\n if (!synchronousRequestInterceptors) {\n var chain = [dispatchRequest, undefined];\n\n Array.prototype.unshift.apply(chain, requestInterceptorChain);\n chain.concat(responseInterceptorChain);\n\n promise = Promise.resolve(config);\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n }\n\n\n var newConfig = config;\n while (requestInterceptorChain.length) {\n var onFulfilled = requestInterceptorChain.shift();\n var onRejected = requestInterceptorChain.shift();\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected(error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest(newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n while (responseInterceptorChain.length) {\n promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n","'use strict';\n\nvar isAbsoluteURL = require('../helpers/isAbsoluteURL');\nvar combineURLs = require('../helpers/combineURLs');\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n * @returns {string} The combined full path\n */\nmodule.exports = function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n};\n","'use strict';\n\nvar enhanceError = require('./enhanceError');\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n","'use strict';\n\nvar utils = require('./../utils');\nvar transformData = require('./transformData');\nvar isCancel = require('../cancel/isCancel');\nvar defaults = require('../defaults');\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n","'use strict';\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n","'use strict';\n\nvar utils = require('../utils');\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n var valueFromConfig2Keys = ['url', 'method', 'data'];\n var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];\n var defaultToConfig2Keys = [\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',\n 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',\n 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'\n ];\n var directMergeKeys = ['validateStatus'];\n\n function getMergedValue(target, source) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge(target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n function mergeDeepProperties(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n }\n\n utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n }\n });\n\n utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);\n\n utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n utils.forEach(directMergeKeys, function merge(prop) {\n if (prop in config2) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (prop in config1) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n var axiosKeys = valueFromConfig2Keys\n .concat(mergeDeepPropertiesKeys)\n .concat(defaultToConfig2Keys)\n .concat(directMergeKeys);\n\n var otherKeys = Object\n .keys(config1)\n .concat(Object.keys(config2))\n .filter(function filterAxiosKeys(key) {\n return axiosKeys.indexOf(key) === -1;\n });\n\n utils.forEach(otherKeys, mergeDeepProperties);\n\n return config;\n};\n","'use strict';\n\nvar createError = require('./createError');\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n","'use strict';\n\nvar utils = require('./../utils');\nvar defaults = require('./../defaults');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n var context = this || defaults;\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn.call(context, data, headers);\n });\n\n return data;\n};\n","'use strict';\n\nvar utils = require('./utils');\nvar normalizeHeaderName = require('./helpers/normalizeHeaderName');\nvar enhanceError = require('./core/enhanceError');\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('./adapters/xhr');\n } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = require('./adapters/http');\n }\n return adapter;\n}\n\nvar defaults = {\n\n transitional: {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n },\n\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {\n setContentTypeIfUnset(headers, 'application/json');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n var transitional = this.transitional;\n var silentJSONParsing = transitional && transitional.silentJSONParsing;\n var forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';\n\n if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw enhanceError(e, this, 'E_JSON_PARSE');\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n","'use strict';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nmodule.exports = function isAxiosError(payload) {\n return (typeof payload === 'object') && (payload.isAxiosError === true);\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n","'use strict';\n\nvar utils = require('../utils');\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n","'use strict';\n\nvar pkg = require('./../../package.json');\n\nvar validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nvar deprecatedWarnings = {};\nvar currentVerArr = pkg.version.split('.');\n\n/**\n * Compare package versions\n * @param {string} version\n * @param {string?} thanVersion\n * @returns {boolean}\n */\nfunction isOlderVersion(version, thanVersion) {\n var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr;\n var destVer = version.split('.');\n for (var i = 0; i < 3; i++) {\n if (pkgVersionArr[i] > destVer[i]) {\n return true;\n } else if (pkgVersionArr[i] < destVer[i]) {\n return false;\n }\n }\n return false;\n}\n\n/**\n * Transitional option validator\n * @param {function|boolean?} validator\n * @param {string?} version\n * @param {string} message\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n var isDeprecated = version && isOlderVersion(version);\n\n function formatMessage(opt, desc) {\n return '[Axios v' + pkg.version + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return function(value, opt, opts) {\n if (validator === false) {\n throw new Error(formatMessage(opt, ' has been removed in ' + version));\n }\n\n if (isDeprecated && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new TypeError('options must be an object');\n }\n var keys = Object.keys(options);\n var i = keys.length;\n while (i-- > 0) {\n var opt = keys[i];\n var validator = schema[opt];\n if (validator) {\n var value = options[opt];\n var result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new TypeError('option ' + opt + ' must be ' + result);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw Error('Unknown option ' + opt);\n }\n }\n}\n\nmodule.exports = {\n isOlderVersion: isOlderVersion,\n assertOptions: assertOptions,\n validators: validators\n};\n","'use strict';\n\nvar bind = require('./helpers/bind');\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return (typeof FormData !== 'undefined') && (val instanceof FormData);\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {Object} val The value to test\n * @return {boolean} True if value is a plain Object, otherwise false\n */\nfunction isPlainObject(val) {\n if (toString.call(val) !== '[object Object]') {\n return false;\n }\n\n var prototype = Object.getPrototypeOf(val);\n return prototype === null || prototype === Object.prototype;\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Determine if a value is a Function\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nfunction isFunction(val) {\n return toString.call(val) === '[object Function]';\n}\n\n/**\n * Determine if a value is a Stream\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nfunction isStream(val) {\n return isObject(val) && isFunction(val.pipe);\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nfunction isURLSearchParams(val) {\n return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.trim ? str.trim() : str.replace(/^\\s+|\\s+$/g, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (isPlainObject(result[key]) && isPlainObject(val)) {\n result[key] = merge(result[key], val);\n } else if (isPlainObject(val)) {\n result[key] = merge({}, val);\n } else if (isArray(val)) {\n result[key] = val.slice();\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n * @return {string} content value without BOM\n */\nfunction stripBOM(content) {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isPlainObject: isPlainObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n extend: extend,\n trim: trim,\n stripBOM: stripBOM\n};\n","/**\n * chroma.js - JavaScript library for color conversions\n *\n * Copyright (c) 2011-2019, Gregor Aisch\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * 3. The name Gregor Aisch may not be used to endorse or promote products\n * derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * -------------------------------------------------------\n *\n * chroma.js includes colors from colorbrewer2.org, which are released under\n * the following license:\n *\n * Copyright (c) 2002 Cynthia Brewer, Mark Harrower,\n * and The Pennsylvania State University.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n *\n * ------------------------------------------------------\n *\n * Named colors are taken from X11 Color Names.\n * http://www.w3.org/TR/css3-color/#svg-color\n *\n * @preserve\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.chroma = factory());\n}(this, (function () { 'use strict';\n\n var limit = function (x, min, max) {\n if ( min === void 0 ) min=0;\n if ( max === void 0 ) max=1;\n\n return x < min ? min : x > max ? max : x;\n };\n\n var clip_rgb = function (rgb) {\n rgb._clipped = false;\n rgb._unclipped = rgb.slice(0);\n for (var i=0; i<=3; i++) {\n if (i < 3) {\n if (rgb[i] < 0 || rgb[i] > 255) { rgb._clipped = true; }\n rgb[i] = limit(rgb[i], 0, 255);\n } else if (i === 3) {\n rgb[i] = limit(rgb[i], 0, 1);\n }\n }\n return rgb;\n };\n\n // ported from jQuery's $.type\n var classToType = {};\n for (var i = 0, list = ['Boolean', 'Number', 'String', 'Function', 'Array', 'Date', 'RegExp', 'Undefined', 'Null']; i < list.length; i += 1) {\n var name = list[i];\n\n classToType[(\"[object \" + name + \"]\")] = name.toLowerCase();\n }\n var type = function(obj) {\n return classToType[Object.prototype.toString.call(obj)] || \"object\";\n };\n\n var unpack = function (args, keyOrder) {\n if ( keyOrder === void 0 ) keyOrder=null;\n\n \t// if called with more than 3 arguments, we return the arguments\n if (args.length >= 3) { return Array.prototype.slice.call(args); }\n // with less than 3 args we check if first arg is object\n // and use the keyOrder string to extract and sort properties\n \tif (type(args[0]) == 'object' && keyOrder) {\n \t\treturn keyOrder.split('')\n \t\t\t.filter(function (k) { return args[0][k] !== undefined; })\n \t\t\t.map(function (k) { return args[0][k]; });\n \t}\n \t// otherwise we just return the first argument\n \t// (which we suppose is an array of args)\n return args[0];\n };\n\n var last = function (args) {\n if (args.length < 2) { return null; }\n var l = args.length-1;\n if (type(args[l]) == 'string') { return args[l].toLowerCase(); }\n return null;\n };\n\n var PI = Math.PI;\n\n var utils = {\n \tclip_rgb: clip_rgb,\n \tlimit: limit,\n \ttype: type,\n \tunpack: unpack,\n \tlast: last,\n \tPI: PI,\n \tTWOPI: PI*2,\n \tPITHIRD: PI/3,\n \tDEG2RAD: PI / 180,\n \tRAD2DEG: 180 / PI\n };\n\n var input = {\n \tformat: {},\n \tautodetect: []\n };\n\n var last$1 = utils.last;\n var clip_rgb$1 = utils.clip_rgb;\n var type$1 = utils.type;\n\n\n var Color = function Color() {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var me = this;\n if (type$1(args[0]) === 'object' &&\n args[0].constructor &&\n args[0].constructor === this.constructor) {\n // the argument is already a Color instance\n return args[0];\n }\n\n // last argument could be the mode\n var mode = last$1(args);\n var autodetect = false;\n\n if (!mode) {\n autodetect = true;\n if (!input.sorted) {\n input.autodetect = input.autodetect.sort(function (a,b) { return b.p - a.p; });\n input.sorted = true;\n }\n // auto-detect format\n for (var i = 0, list = input.autodetect; i < list.length; i += 1) {\n var chk = list[i];\n\n mode = chk.test.apply(chk, args);\n if (mode) { break; }\n }\n }\n\n if (input.format[mode]) {\n var rgb = input.format[mode].apply(null, autodetect ? args : args.slice(0,-1));\n me._rgb = clip_rgb$1(rgb);\n } else {\n throw new Error('unknown format: '+args);\n }\n\n // add alpha channel\n if (me._rgb.length === 3) { me._rgb.push(1); }\n };\n\n Color.prototype.toString = function toString () {\n if (type$1(this.hex) == 'function') { return this.hex(); }\n return (\"[\" + (this._rgb.join(',')) + \"]\");\n };\n\n var Color_1 = Color;\n\n var chroma = function () {\n \tvar args = [], len = arguments.length;\n \twhile ( len-- ) args[ len ] = arguments[ len ];\n\n \treturn new (Function.prototype.bind.apply( chroma.Color, [ null ].concat( args) ));\n };\n\n chroma.Color = Color_1;\n chroma.version = '2.1.0';\n\n var chroma_1 = chroma;\n\n var unpack$1 = utils.unpack;\n var max = Math.max;\n\n var rgb2cmyk = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var ref = unpack$1(args, 'rgb');\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n r = r / 255;\n g = g / 255;\n b = b / 255;\n var k = 1 - max(r,max(g,b));\n var f = k < 1 ? 1 / (1-k) : 0;\n var c = (1-r-k) * f;\n var m = (1-g-k) * f;\n var y = (1-b-k) * f;\n return [c,m,y,k];\n };\n\n var rgb2cmyk_1 = rgb2cmyk;\n\n var unpack$2 = utils.unpack;\n\n var cmyk2rgb = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$2(args, 'cmyk');\n var c = args[0];\n var m = args[1];\n var y = args[2];\n var k = args[3];\n var alpha = args.length > 4 ? args[4] : 1;\n if (k === 1) { return [0,0,0,alpha]; }\n return [\n c >= 1 ? 0 : 255 * (1-c) * (1-k), // r\n m >= 1 ? 0 : 255 * (1-m) * (1-k), // g\n y >= 1 ? 0 : 255 * (1-y) * (1-k), // b\n alpha\n ];\n };\n\n var cmyk2rgb_1 = cmyk2rgb;\n\n var unpack$3 = utils.unpack;\n var type$2 = utils.type;\n\n\n\n Color_1.prototype.cmyk = function() {\n return rgb2cmyk_1(this._rgb);\n };\n\n chroma_1.cmyk = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['cmyk']) ));\n };\n\n input.format.cmyk = cmyk2rgb_1;\n\n input.autodetect.push({\n p: 2,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$3(args, 'cmyk');\n if (type$2(args) === 'array' && args.length === 4) {\n return 'cmyk';\n }\n }\n });\n\n var unpack$4 = utils.unpack;\n var last$2 = utils.last;\n var rnd = function (a) { return Math.round(a*100)/100; };\n\n /*\n * supported arguments:\n * - hsl2css(h,s,l)\n * - hsl2css(h,s,l,a)\n * - hsl2css([h,s,l], mode)\n * - hsl2css([h,s,l,a], mode)\n * - hsl2css({h,s,l,a}, mode)\n */\n var hsl2css = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var hsla = unpack$4(args, 'hsla');\n var mode = last$2(args) || 'lsa';\n hsla[0] = rnd(hsla[0] || 0);\n hsla[1] = rnd(hsla[1]*100) + '%';\n hsla[2] = rnd(hsla[2]*100) + '%';\n if (mode === 'hsla' || (hsla.length > 3 && hsla[3]<1)) {\n hsla[3] = hsla.length > 3 ? hsla[3] : 1;\n mode = 'hsla';\n } else {\n hsla.length = 3;\n }\n return (mode + \"(\" + (hsla.join(',')) + \")\");\n };\n\n var hsl2css_1 = hsl2css;\n\n var unpack$5 = utils.unpack;\n\n /*\n * supported arguments:\n * - rgb2hsl(r,g,b)\n * - rgb2hsl(r,g,b,a)\n * - rgb2hsl([r,g,b])\n * - rgb2hsl([r,g,b,a])\n * - rgb2hsl({r,g,b,a})\n */\n var rgb2hsl = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$5(args, 'rgba');\n var r = args[0];\n var g = args[1];\n var b = args[2];\n\n r /= 255;\n g /= 255;\n b /= 255;\n\n var min = Math.min(r, g, b);\n var max = Math.max(r, g, b);\n\n var l = (max + min) / 2;\n var s, h;\n\n if (max === min){\n s = 0;\n h = Number.NaN;\n } else {\n s = l < 0.5 ? (max - min) / (max + min) : (max - min) / (2 - max - min);\n }\n\n if (r == max) { h = (g - b) / (max - min); }\n else if (g == max) { h = 2 + (b - r) / (max - min); }\n else if (b == max) { h = 4 + (r - g) / (max - min); }\n\n h *= 60;\n if (h < 0) { h += 360; }\n if (args.length>3 && args[3]!==undefined) { return [h,s,l,args[3]]; }\n return [h,s,l];\n };\n\n var rgb2hsl_1 = rgb2hsl;\n\n var unpack$6 = utils.unpack;\n var last$3 = utils.last;\n\n\n var round = Math.round;\n\n /*\n * supported arguments:\n * - rgb2css(r,g,b)\n * - rgb2css(r,g,b,a)\n * - rgb2css([r,g,b], mode)\n * - rgb2css([r,g,b,a], mode)\n * - rgb2css({r,g,b,a}, mode)\n */\n var rgb2css = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var rgba = unpack$6(args, 'rgba');\n var mode = last$3(args) || 'rgb';\n if (mode.substr(0,3) == 'hsl') {\n return hsl2css_1(rgb2hsl_1(rgba), mode);\n }\n rgba[0] = round(rgba[0]);\n rgba[1] = round(rgba[1]);\n rgba[2] = round(rgba[2]);\n if (mode === 'rgba' || (rgba.length > 3 && rgba[3]<1)) {\n rgba[3] = rgba.length > 3 ? rgba[3] : 1;\n mode = 'rgba';\n }\n return (mode + \"(\" + (rgba.slice(0,mode==='rgb'?3:4).join(',')) + \")\");\n };\n\n var rgb2css_1 = rgb2css;\n\n var unpack$7 = utils.unpack;\n var round$1 = Math.round;\n\n var hsl2rgb = function () {\n var assign;\n\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n args = unpack$7(args, 'hsl');\n var h = args[0];\n var s = args[1];\n var l = args[2];\n var r,g,b;\n if (s === 0) {\n r = g = b = l*255;\n } else {\n var t3 = [0,0,0];\n var c = [0,0,0];\n var t2 = l < 0.5 ? l * (1+s) : l+s-l*s;\n var t1 = 2 * l - t2;\n var h_ = h / 360;\n t3[0] = h_ + 1/3;\n t3[1] = h_;\n t3[2] = h_ - 1/3;\n for (var i=0; i<3; i++) {\n if (t3[i] < 0) { t3[i] += 1; }\n if (t3[i] > 1) { t3[i] -= 1; }\n if (6 * t3[i] < 1)\n { c[i] = t1 + (t2 - t1) * 6 * t3[i]; }\n else if (2 * t3[i] < 1)\n { c[i] = t2; }\n else if (3 * t3[i] < 2)\n { c[i] = t1 + (t2 - t1) * ((2 / 3) - t3[i]) * 6; }\n else\n { c[i] = t1; }\n }\n (assign = [round$1(c[0]*255),round$1(c[1]*255),round$1(c[2]*255)], r = assign[0], g = assign[1], b = assign[2]);\n }\n if (args.length > 3) {\n // keep alpha channel\n return [r,g,b,args[3]];\n }\n return [r,g,b,1];\n };\n\n var hsl2rgb_1 = hsl2rgb;\n\n var RE_RGB = /^rgb\\(\\s*(-?\\d+),\\s*(-?\\d+)\\s*,\\s*(-?\\d+)\\s*\\)$/;\n var RE_RGBA = /^rgba\\(\\s*(-?\\d+),\\s*(-?\\d+)\\s*,\\s*(-?\\d+)\\s*,\\s*([01]|[01]?\\.\\d+)\\)$/;\n var RE_RGB_PCT = /^rgb\\(\\s*(-?\\d+(?:\\.\\d+)?)%,\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*(-?\\d+(?:\\.\\d+)?)%\\s*\\)$/;\n var RE_RGBA_PCT = /^rgba\\(\\s*(-?\\d+(?:\\.\\d+)?)%,\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*([01]|[01]?\\.\\d+)\\)$/;\n var RE_HSL = /^hsl\\(\\s*(-?\\d+(?:\\.\\d+)?),\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*(-?\\d+(?:\\.\\d+)?)%\\s*\\)$/;\n var RE_HSLA = /^hsla\\(\\s*(-?\\d+(?:\\.\\d+)?),\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*([01]|[01]?\\.\\d+)\\)$/;\n\n var round$2 = Math.round;\n\n var css2rgb = function (css) {\n css = css.toLowerCase().trim();\n var m;\n\n if (input.format.named) {\n try {\n return input.format.named(css);\n } catch (e) {\n // eslint-disable-next-line\n }\n }\n\n // rgb(250,20,0)\n if ((m = css.match(RE_RGB))) {\n var rgb = m.slice(1,4);\n for (var i=0; i<3; i++) {\n rgb[i] = +rgb[i];\n }\n rgb[3] = 1; // default alpha\n return rgb;\n }\n\n // rgba(250,20,0,0.4)\n if ((m = css.match(RE_RGBA))) {\n var rgb$1 = m.slice(1,5);\n for (var i$1=0; i$1<4; i$1++) {\n rgb$1[i$1] = +rgb$1[i$1];\n }\n return rgb$1;\n }\n\n // rgb(100%,0%,0%)\n if ((m = css.match(RE_RGB_PCT))) {\n var rgb$2 = m.slice(1,4);\n for (var i$2=0; i$2<3; i$2++) {\n rgb$2[i$2] = round$2(rgb$2[i$2] * 2.55);\n }\n rgb$2[3] = 1; // default alpha\n return rgb$2;\n }\n\n // rgba(100%,0%,0%,0.4)\n if ((m = css.match(RE_RGBA_PCT))) {\n var rgb$3 = m.slice(1,5);\n for (var i$3=0; i$3<3; i$3++) {\n rgb$3[i$3] = round$2(rgb$3[i$3] * 2.55);\n }\n rgb$3[3] = +rgb$3[3];\n return rgb$3;\n }\n\n // hsl(0,100%,50%)\n if ((m = css.match(RE_HSL))) {\n var hsl = m.slice(1,4);\n hsl[1] *= 0.01;\n hsl[2] *= 0.01;\n var rgb$4 = hsl2rgb_1(hsl);\n rgb$4[3] = 1;\n return rgb$4;\n }\n\n // hsla(0,100%,50%,0.5)\n if ((m = css.match(RE_HSLA))) {\n var hsl$1 = m.slice(1,4);\n hsl$1[1] *= 0.01;\n hsl$1[2] *= 0.01;\n var rgb$5 = hsl2rgb_1(hsl$1);\n rgb$5[3] = +m[4]; // default alpha = 1\n return rgb$5;\n }\n };\n\n css2rgb.test = function (s) {\n return RE_RGB.test(s) ||\n RE_RGBA.test(s) ||\n RE_RGB_PCT.test(s) ||\n RE_RGBA_PCT.test(s) ||\n RE_HSL.test(s) ||\n RE_HSLA.test(s);\n };\n\n var css2rgb_1 = css2rgb;\n\n var type$3 = utils.type;\n\n\n\n\n Color_1.prototype.css = function(mode) {\n return rgb2css_1(this._rgb, mode);\n };\n\n chroma_1.css = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['css']) ));\n };\n\n input.format.css = css2rgb_1;\n\n input.autodetect.push({\n p: 5,\n test: function (h) {\n var rest = [], len = arguments.length - 1;\n while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];\n\n if (!rest.length && type$3(h) === 'string' && css2rgb_1.test(h)) {\n return 'css';\n }\n }\n });\n\n var unpack$8 = utils.unpack;\n\n input.format.gl = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var rgb = unpack$8(args, 'rgba');\n rgb[0] *= 255;\n rgb[1] *= 255;\n rgb[2] *= 255;\n return rgb;\n };\n\n chroma_1.gl = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['gl']) ));\n };\n\n Color_1.prototype.gl = function() {\n var rgb = this._rgb;\n return [rgb[0]/255, rgb[1]/255, rgb[2]/255, rgb[3]];\n };\n\n var unpack$9 = utils.unpack;\n\n var rgb2hcg = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var ref = unpack$9(args, 'rgb');\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n var min = Math.min(r, g, b);\n var max = Math.max(r, g, b);\n var delta = max - min;\n var c = delta * 100 / 255;\n var _g = min / (255 - delta) * 100;\n var h;\n if (delta === 0) {\n h = Number.NaN;\n } else {\n if (r === max) { h = (g - b) / delta; }\n if (g === max) { h = 2+(b - r) / delta; }\n if (b === max) { h = 4+(r - g) / delta; }\n h *= 60;\n if (h < 0) { h += 360; }\n }\n return [h, c, _g];\n };\n\n var rgb2hcg_1 = rgb2hcg;\n\n var unpack$a = utils.unpack;\n var floor = Math.floor;\n\n /*\n * this is basically just HSV with some minor tweaks\n *\n * hue.. [0..360]\n * chroma .. [0..1]\n * grayness .. [0..1]\n */\n\n var hcg2rgb = function () {\n var assign, assign$1, assign$2, assign$3, assign$4, assign$5;\n\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n args = unpack$a(args, 'hcg');\n var h = args[0];\n var c = args[1];\n var _g = args[2];\n var r,g,b;\n _g = _g * 255;\n var _c = c * 255;\n if (c === 0) {\n r = g = b = _g;\n } else {\n if (h === 360) { h = 0; }\n if (h > 360) { h -= 360; }\n if (h < 0) { h += 360; }\n h /= 60;\n var i = floor(h);\n var f = h - i;\n var p = _g * (1 - c);\n var q = p + _c * (1 - f);\n var t = p + _c * f;\n var v = p + _c;\n switch (i) {\n case 0: (assign = [v, t, p], r = assign[0], g = assign[1], b = assign[2]); break\n case 1: (assign$1 = [q, v, p], r = assign$1[0], g = assign$1[1], b = assign$1[2]); break\n case 2: (assign$2 = [p, v, t], r = assign$2[0], g = assign$2[1], b = assign$2[2]); break\n case 3: (assign$3 = [p, q, v], r = assign$3[0], g = assign$3[1], b = assign$3[2]); break\n case 4: (assign$4 = [t, p, v], r = assign$4[0], g = assign$4[1], b = assign$4[2]); break\n case 5: (assign$5 = [v, p, q], r = assign$5[0], g = assign$5[1], b = assign$5[2]); break\n }\n }\n return [r, g, b, args.length > 3 ? args[3] : 1];\n };\n\n var hcg2rgb_1 = hcg2rgb;\n\n var unpack$b = utils.unpack;\n var type$4 = utils.type;\n\n\n\n\n\n\n Color_1.prototype.hcg = function() {\n return rgb2hcg_1(this._rgb);\n };\n\n chroma_1.hcg = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hcg']) ));\n };\n\n input.format.hcg = hcg2rgb_1;\n\n input.autodetect.push({\n p: 1,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$b(args, 'hcg');\n if (type$4(args) === 'array' && args.length === 3) {\n return 'hcg';\n }\n }\n });\n\n var unpack$c = utils.unpack;\n var last$4 = utils.last;\n var round$3 = Math.round;\n\n var rgb2hex = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var ref = unpack$c(args, 'rgba');\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n var a = ref[3];\n var mode = last$4(args) || 'auto';\n if (a === undefined) { a = 1; }\n if (mode === 'auto') {\n mode = a < 1 ? 'rgba' : 'rgb';\n }\n r = round$3(r);\n g = round$3(g);\n b = round$3(b);\n var u = r << 16 | g << 8 | b;\n var str = \"000000\" + u.toString(16); //#.toUpperCase();\n str = str.substr(str.length - 6);\n var hxa = '0' + round$3(a * 255).toString(16);\n hxa = hxa.substr(hxa.length - 2);\n switch (mode.toLowerCase()) {\n case 'rgba': return (\"#\" + str + hxa);\n case 'argb': return (\"#\" + hxa + str);\n default: return (\"#\" + str);\n }\n };\n\n var rgb2hex_1 = rgb2hex;\n\n var RE_HEX = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;\n var RE_HEXA = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/;\n\n var hex2rgb = function (hex) {\n if (hex.match(RE_HEX)) {\n // remove optional leading #\n if (hex.length === 4 || hex.length === 7) {\n hex = hex.substr(1);\n }\n // expand short-notation to full six-digit\n if (hex.length === 3) {\n hex = hex.split('');\n hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];\n }\n var u = parseInt(hex, 16);\n var r = u >> 16;\n var g = u >> 8 & 0xFF;\n var b = u & 0xFF;\n return [r,g,b,1];\n }\n\n // match rgba hex format, eg #FF000077\n if (hex.match(RE_HEXA)) {\n if (hex.length === 5 || hex.length === 9) {\n // remove optional leading #\n hex = hex.substr(1);\n }\n // expand short-notation to full eight-digit\n if (hex.length === 4) {\n hex = hex.split('');\n hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]+hex[3]+hex[3];\n }\n var u$1 = parseInt(hex, 16);\n var r$1 = u$1 >> 24 & 0xFF;\n var g$1 = u$1 >> 16 & 0xFF;\n var b$1 = u$1 >> 8 & 0xFF;\n var a = Math.round((u$1 & 0xFF) / 0xFF * 100) / 100;\n return [r$1,g$1,b$1,a];\n }\n\n // we used to check for css colors here\n // if _input.css? and rgb = _input.css hex\n // return rgb\n\n throw new Error((\"unknown hex color: \" + hex));\n };\n\n var hex2rgb_1 = hex2rgb;\n\n var type$5 = utils.type;\n\n\n\n\n Color_1.prototype.hex = function(mode) {\n return rgb2hex_1(this._rgb, mode);\n };\n\n chroma_1.hex = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hex']) ));\n };\n\n input.format.hex = hex2rgb_1;\n input.autodetect.push({\n p: 4,\n test: function (h) {\n var rest = [], len = arguments.length - 1;\n while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];\n\n if (!rest.length && type$5(h) === 'string' && [3,4,5,6,7,8,9].indexOf(h.length) >= 0) {\n return 'hex';\n }\n }\n });\n\n var unpack$d = utils.unpack;\n var TWOPI = utils.TWOPI;\n var min = Math.min;\n var sqrt = Math.sqrt;\n var acos = Math.acos;\n\n var rgb2hsi = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n /*\n borrowed from here:\n http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/rgb2hsi.cpp\n */\n var ref = unpack$d(args, 'rgb');\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n r /= 255;\n g /= 255;\n b /= 255;\n var h;\n var min_ = min(r,g,b);\n var i = (r+g+b) / 3;\n var s = i > 0 ? 1 - min_/i : 0;\n if (s === 0) {\n h = NaN;\n } else {\n h = ((r-g)+(r-b)) / 2;\n h /= sqrt((r-g)*(r-g) + (r-b)*(g-b));\n h = acos(h);\n if (b > g) {\n h = TWOPI - h;\n }\n h /= TWOPI;\n }\n return [h*360,s,i];\n };\n\n var rgb2hsi_1 = rgb2hsi;\n\n var unpack$e = utils.unpack;\n var limit$1 = utils.limit;\n var TWOPI$1 = utils.TWOPI;\n var PITHIRD = utils.PITHIRD;\n var cos = Math.cos;\n\n /*\n * hue [0..360]\n * saturation [0..1]\n * intensity [0..1]\n */\n var hsi2rgb = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n /*\n borrowed from here:\n http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/hsi2rgb.cpp\n */\n args = unpack$e(args, 'hsi');\n var h = args[0];\n var s = args[1];\n var i = args[2];\n var r,g,b;\n\n if (isNaN(h)) { h = 0; }\n if (isNaN(s)) { s = 0; }\n // normalize hue\n if (h > 360) { h -= 360; }\n if (h < 0) { h += 360; }\n h /= 360;\n if (h < 1/3) {\n b = (1-s)/3;\n r = (1+s*cos(TWOPI$1*h)/cos(PITHIRD-TWOPI$1*h))/3;\n g = 1 - (b+r);\n } else if (h < 2/3) {\n h -= 1/3;\n r = (1-s)/3;\n g = (1+s*cos(TWOPI$1*h)/cos(PITHIRD-TWOPI$1*h))/3;\n b = 1 - (r+g);\n } else {\n h -= 2/3;\n g = (1-s)/3;\n b = (1+s*cos(TWOPI$1*h)/cos(PITHIRD-TWOPI$1*h))/3;\n r = 1 - (g+b);\n }\n r = limit$1(i*r*3);\n g = limit$1(i*g*3);\n b = limit$1(i*b*3);\n return [r*255, g*255, b*255, args.length > 3 ? args[3] : 1];\n };\n\n var hsi2rgb_1 = hsi2rgb;\n\n var unpack$f = utils.unpack;\n var type$6 = utils.type;\n\n\n\n\n\n\n Color_1.prototype.hsi = function() {\n return rgb2hsi_1(this._rgb);\n };\n\n chroma_1.hsi = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hsi']) ));\n };\n\n input.format.hsi = hsi2rgb_1;\n\n input.autodetect.push({\n p: 2,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$f(args, 'hsi');\n if (type$6(args) === 'array' && args.length === 3) {\n return 'hsi';\n }\n }\n });\n\n var unpack$g = utils.unpack;\n var type$7 = utils.type;\n\n\n\n\n\n\n Color_1.prototype.hsl = function() {\n return rgb2hsl_1(this._rgb);\n };\n\n chroma_1.hsl = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hsl']) ));\n };\n\n input.format.hsl = hsl2rgb_1;\n\n input.autodetect.push({\n p: 2,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$g(args, 'hsl');\n if (type$7(args) === 'array' && args.length === 3) {\n return 'hsl';\n }\n }\n });\n\n var unpack$h = utils.unpack;\n var min$1 = Math.min;\n var max$1 = Math.max;\n\n /*\n * supported arguments:\n * - rgb2hsv(r,g,b)\n * - rgb2hsv([r,g,b])\n * - rgb2hsv({r,g,b})\n */\n var rgb2hsl$1 = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$h(args, 'rgb');\n var r = args[0];\n var g = args[1];\n var b = args[2];\n var min_ = min$1(r, g, b);\n var max_ = max$1(r, g, b);\n var delta = max_ - min_;\n var h,s,v;\n v = max_ / 255.0;\n if (max_ === 0) {\n h = Number.NaN;\n s = 0;\n } else {\n s = delta / max_;\n if (r === max_) { h = (g - b) / delta; }\n if (g === max_) { h = 2+(b - r) / delta; }\n if (b === max_) { h = 4+(r - g) / delta; }\n h *= 60;\n if (h < 0) { h += 360; }\n }\n return [h, s, v]\n };\n\n var rgb2hsv = rgb2hsl$1;\n\n var unpack$i = utils.unpack;\n var floor$1 = Math.floor;\n\n var hsv2rgb = function () {\n var assign, assign$1, assign$2, assign$3, assign$4, assign$5;\n\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n args = unpack$i(args, 'hsv');\n var h = args[0];\n var s = args[1];\n var v = args[2];\n var r,g,b;\n v *= 255;\n if (s === 0) {\n r = g = b = v;\n } else {\n if (h === 360) { h = 0; }\n if (h > 360) { h -= 360; }\n if (h < 0) { h += 360; }\n h /= 60;\n\n var i = floor$1(h);\n var f = h - i;\n var p = v * (1 - s);\n var q = v * (1 - s * f);\n var t = v * (1 - s * (1 - f));\n\n switch (i) {\n case 0: (assign = [v, t, p], r = assign[0], g = assign[1], b = assign[2]); break\n case 1: (assign$1 = [q, v, p], r = assign$1[0], g = assign$1[1], b = assign$1[2]); break\n case 2: (assign$2 = [p, v, t], r = assign$2[0], g = assign$2[1], b = assign$2[2]); break\n case 3: (assign$3 = [p, q, v], r = assign$3[0], g = assign$3[1], b = assign$3[2]); break\n case 4: (assign$4 = [t, p, v], r = assign$4[0], g = assign$4[1], b = assign$4[2]); break\n case 5: (assign$5 = [v, p, q], r = assign$5[0], g = assign$5[1], b = assign$5[2]); break\n }\n }\n return [r,g,b,args.length > 3?args[3]:1];\n };\n\n var hsv2rgb_1 = hsv2rgb;\n\n var unpack$j = utils.unpack;\n var type$8 = utils.type;\n\n\n\n\n\n\n Color_1.prototype.hsv = function() {\n return rgb2hsv(this._rgb);\n };\n\n chroma_1.hsv = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hsv']) ));\n };\n\n input.format.hsv = hsv2rgb_1;\n\n input.autodetect.push({\n p: 2,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$j(args, 'hsv');\n if (type$8(args) === 'array' && args.length === 3) {\n return 'hsv';\n }\n }\n });\n\n var labConstants = {\n // Corresponds roughly to RGB brighter/darker\n Kn: 18,\n\n // D65 standard referent\n Xn: 0.950470,\n Yn: 1,\n Zn: 1.088830,\n\n t0: 0.137931034, // 4 / 29\n t1: 0.206896552, // 6 / 29\n t2: 0.12841855, // 3 * t1 * t1\n t3: 0.008856452, // t1 * t1 * t1\n };\n\n var unpack$k = utils.unpack;\n var pow = Math.pow;\n\n var rgb2lab = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var ref = unpack$k(args, 'rgb');\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n var ref$1 = rgb2xyz(r,g,b);\n var x = ref$1[0];\n var y = ref$1[1];\n var z = ref$1[2];\n var l = 116 * y - 16;\n return [l < 0 ? 0 : l, 500 * (x - y), 200 * (y - z)];\n };\n\n var rgb_xyz = function (r) {\n if ((r /= 255) <= 0.04045) { return r / 12.92; }\n return pow((r + 0.055) / 1.055, 2.4);\n };\n\n var xyz_lab = function (t) {\n if (t > labConstants.t3) { return pow(t, 1 / 3); }\n return t / labConstants.t2 + labConstants.t0;\n };\n\n var rgb2xyz = function (r,g,b) {\n r = rgb_xyz(r);\n g = rgb_xyz(g);\n b = rgb_xyz(b);\n var x = xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / labConstants.Xn);\n var y = xyz_lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / labConstants.Yn);\n var z = xyz_lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / labConstants.Zn);\n return [x,y,z];\n };\n\n var rgb2lab_1 = rgb2lab;\n\n var unpack$l = utils.unpack;\n var pow$1 = Math.pow;\n\n /*\n * L* [0..100]\n * a [-100..100]\n * b [-100..100]\n */\n var lab2rgb = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$l(args, 'lab');\n var l = args[0];\n var a = args[1];\n var b = args[2];\n var x,y,z, r,g,b_;\n\n y = (l + 16) / 116;\n x = isNaN(a) ? y : y + a / 500;\n z = isNaN(b) ? y : y - b / 200;\n\n y = labConstants.Yn * lab_xyz(y);\n x = labConstants.Xn * lab_xyz(x);\n z = labConstants.Zn * lab_xyz(z);\n\n r = xyz_rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z); // D65 -> sRGB\n g = xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z);\n b_ = xyz_rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z);\n\n return [r,g,b_,args.length > 3 ? args[3] : 1];\n };\n\n var xyz_rgb = function (r) {\n return 255 * (r <= 0.00304 ? 12.92 * r : 1.055 * pow$1(r, 1 / 2.4) - 0.055)\n };\n\n var lab_xyz = function (t) {\n return t > labConstants.t1 ? t * t * t : labConstants.t2 * (t - labConstants.t0)\n };\n\n var lab2rgb_1 = lab2rgb;\n\n var unpack$m = utils.unpack;\n var type$9 = utils.type;\n\n\n\n\n\n\n Color_1.prototype.lab = function() {\n return rgb2lab_1(this._rgb);\n };\n\n chroma_1.lab = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['lab']) ));\n };\n\n input.format.lab = lab2rgb_1;\n\n input.autodetect.push({\n p: 2,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$m(args, 'lab');\n if (type$9(args) === 'array' && args.length === 3) {\n return 'lab';\n }\n }\n });\n\n var unpack$n = utils.unpack;\n var RAD2DEG = utils.RAD2DEG;\n var sqrt$1 = Math.sqrt;\n var atan2 = Math.atan2;\n var round$4 = Math.round;\n\n var lab2lch = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var ref = unpack$n(args, 'lab');\n var l = ref[0];\n var a = ref[1];\n var b = ref[2];\n var c = sqrt$1(a * a + b * b);\n var h = (atan2(b, a) * RAD2DEG + 360) % 360;\n if (round$4(c*10000) === 0) { h = Number.NaN; }\n return [l, c, h];\n };\n\n var lab2lch_1 = lab2lch;\n\n var unpack$o = utils.unpack;\n\n\n\n var rgb2lch = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var ref = unpack$o(args, 'rgb');\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n var ref$1 = rgb2lab_1(r,g,b);\n var l = ref$1[0];\n var a = ref$1[1];\n var b_ = ref$1[2];\n return lab2lch_1(l,a,b_);\n };\n\n var rgb2lch_1 = rgb2lch;\n\n var unpack$p = utils.unpack;\n var DEG2RAD = utils.DEG2RAD;\n var sin = Math.sin;\n var cos$1 = Math.cos;\n\n var lch2lab = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n /*\n Convert from a qualitative parameter h and a quantitative parameter l to a 24-bit pixel.\n These formulas were invented by David Dalrymple to obtain maximum contrast without going\n out of gamut if the parameters are in the range 0-1.\n\n A saturation multiplier was added by Gregor Aisch\n */\n var ref = unpack$p(args, 'lch');\n var l = ref[0];\n var c = ref[1];\n var h = ref[2];\n if (isNaN(h)) { h = 0; }\n h = h * DEG2RAD;\n return [l, cos$1(h) * c, sin(h) * c]\n };\n\n var lch2lab_1 = lch2lab;\n\n var unpack$q = utils.unpack;\n\n\n\n var lch2rgb = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$q(args, 'lch');\n var l = args[0];\n var c = args[1];\n var h = args[2];\n var ref = lch2lab_1 (l,c,h);\n var L = ref[0];\n var a = ref[1];\n var b_ = ref[2];\n var ref$1 = lab2rgb_1 (L,a,b_);\n var r = ref$1[0];\n var g = ref$1[1];\n var b = ref$1[2];\n return [r, g, b, args.length > 3 ? args[3] : 1];\n };\n\n var lch2rgb_1 = lch2rgb;\n\n var unpack$r = utils.unpack;\n\n\n var hcl2rgb = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var hcl = unpack$r(args, 'hcl').reverse();\n return lch2rgb_1.apply(void 0, hcl);\n };\n\n var hcl2rgb_1 = hcl2rgb;\n\n var unpack$s = utils.unpack;\n var type$a = utils.type;\n\n\n\n\n\n\n Color_1.prototype.lch = function() { return rgb2lch_1(this._rgb); };\n Color_1.prototype.hcl = function() { return rgb2lch_1(this._rgb).reverse(); };\n\n chroma_1.lch = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['lch']) ));\n };\n chroma_1.hcl = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hcl']) ));\n };\n\n input.format.lch = lch2rgb_1;\n input.format.hcl = hcl2rgb_1;\n\n ['lch','hcl'].forEach(function (m) { return input.autodetect.push({\n p: 2,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$s(args, m);\n if (type$a(args) === 'array' && args.length === 3) {\n return m;\n }\n }\n }); });\n\n /**\n \tX11 color names\n\n \thttp://www.w3.org/TR/css3-color/#svg-color\n */\n\n var w3cx11 = {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflower: '#6495ed',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkgrey: '#a9a9a9',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkslategrey: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dimgrey: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n grey: '#808080',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n indianred: '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n laserlemon: '#ffff54',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrod: '#fafad2',\n lightgoldenrodyellow: '#fafad2',\n lightgray: '#d3d3d3',\n lightgreen: '#90ee90',\n lightgrey: '#d3d3d3',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightslategrey: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n maroon2: '#7f0000',\n maroon3: '#b03060',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370db',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#db7093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n purple2: '#7f007f',\n purple3: '#a020f0',\n rebeccapurple: '#663399',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n slategrey: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32'\n };\n\n var w3cx11_1 = w3cx11;\n\n var type$b = utils.type;\n\n\n\n\n\n Color_1.prototype.name = function() {\n var hex = rgb2hex_1(this._rgb, 'rgb');\n for (var i = 0, list = Object.keys(w3cx11_1); i < list.length; i += 1) {\n var n = list[i];\n\n if (w3cx11_1[n] === hex) { return n.toLowerCase(); }\n }\n return hex;\n };\n\n input.format.named = function (name) {\n name = name.toLowerCase();\n if (w3cx11_1[name]) { return hex2rgb_1(w3cx11_1[name]); }\n throw new Error('unknown color name: '+name);\n };\n\n input.autodetect.push({\n p: 5,\n test: function (h) {\n var rest = [], len = arguments.length - 1;\n while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];\n\n if (!rest.length && type$b(h) === 'string' && w3cx11_1[h.toLowerCase()]) {\n return 'named';\n }\n }\n });\n\n var unpack$t = utils.unpack;\n\n var rgb2num = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var ref = unpack$t(args, 'rgb');\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n return (r << 16) + (g << 8) + b;\n };\n\n var rgb2num_1 = rgb2num;\n\n var type$c = utils.type;\n\n var num2rgb = function (num) {\n if (type$c(num) == \"number\" && num >= 0 && num <= 0xFFFFFF) {\n var r = num >> 16;\n var g = (num >> 8) & 0xFF;\n var b = num & 0xFF;\n return [r,g,b,1];\n }\n throw new Error(\"unknown num color: \"+num);\n };\n\n var num2rgb_1 = num2rgb;\n\n var type$d = utils.type;\n\n\n\n Color_1.prototype.num = function() {\n return rgb2num_1(this._rgb);\n };\n\n chroma_1.num = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['num']) ));\n };\n\n input.format.num = num2rgb_1;\n\n input.autodetect.push({\n p: 5,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n if (args.length === 1 && type$d(args[0]) === 'number' && args[0] >= 0 && args[0] <= 0xFFFFFF) {\n return 'num';\n }\n }\n });\n\n var unpack$u = utils.unpack;\n var type$e = utils.type;\n var round$5 = Math.round;\n\n Color_1.prototype.rgb = function(rnd) {\n if ( rnd === void 0 ) rnd=true;\n\n if (rnd === false) { return this._rgb.slice(0,3); }\n return this._rgb.slice(0,3).map(round$5);\n };\n\n Color_1.prototype.rgba = function(rnd) {\n if ( rnd === void 0 ) rnd=true;\n\n return this._rgb.slice(0,4).map(function (v,i) {\n return i<3 ? (rnd === false ? v : round$5(v)) : v;\n });\n };\n\n chroma_1.rgb = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['rgb']) ));\n };\n\n input.format.rgb = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var rgba = unpack$u(args, 'rgba');\n if (rgba[3] === undefined) { rgba[3] = 1; }\n return rgba;\n };\n\n input.autodetect.push({\n p: 3,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$u(args, 'rgba');\n if (type$e(args) === 'array' && (args.length === 3 ||\n args.length === 4 && type$e(args[3]) == 'number' && args[3] >= 0 && args[3] <= 1)) {\n return 'rgb';\n }\n }\n });\n\n /*\n * Based on implementation by Neil Bartlett\n * https://github.com/neilbartlett/color-temperature\n */\n\n var log = Math.log;\n\n var temperature2rgb = function (kelvin) {\n var temp = kelvin / 100;\n var r,g,b;\n if (temp < 66) {\n r = 255;\n g = -155.25485562709179 - 0.44596950469579133 * (g = temp-2) + 104.49216199393888 * log(g);\n b = temp < 20 ? 0 : -254.76935184120902 + 0.8274096064007395 * (b = temp-10) + 115.67994401066147 * log(b);\n } else {\n r = 351.97690566805693 + 0.114206453784165 * (r = temp-55) - 40.25366309332127 * log(r);\n g = 325.4494125711974 + 0.07943456536662342 * (g = temp-50) - 28.0852963507957 * log(g);\n b = 255;\n }\n return [r,g,b,1];\n };\n\n var temperature2rgb_1 = temperature2rgb;\n\n /*\n * Based on implementation by Neil Bartlett\n * https://github.com/neilbartlett/color-temperature\n **/\n\n\n var unpack$v = utils.unpack;\n var round$6 = Math.round;\n\n var rgb2temperature = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var rgb = unpack$v(args, 'rgb');\n var r = rgb[0], b = rgb[2];\n var minTemp = 1000;\n var maxTemp = 40000;\n var eps = 0.4;\n var temp;\n while (maxTemp - minTemp > eps) {\n temp = (maxTemp + minTemp) * 0.5;\n var rgb$1 = temperature2rgb_1(temp);\n if ((rgb$1[2] / rgb$1[0]) >= (b / r)) {\n maxTemp = temp;\n } else {\n minTemp = temp;\n }\n }\n return round$6(temp);\n };\n\n var rgb2temperature_1 = rgb2temperature;\n\n Color_1.prototype.temp =\n Color_1.prototype.kelvin =\n Color_1.prototype.temperature = function() {\n return rgb2temperature_1(this._rgb);\n };\n\n chroma_1.temp =\n chroma_1.kelvin =\n chroma_1.temperature = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['temp']) ));\n };\n\n input.format.temp =\n input.format.kelvin =\n input.format.temperature = temperature2rgb_1;\n\n var type$f = utils.type;\n\n Color_1.prototype.alpha = function(a, mutate) {\n if ( mutate === void 0 ) mutate=false;\n\n if (a !== undefined && type$f(a) === 'number') {\n if (mutate) {\n this._rgb[3] = a;\n return this;\n }\n return new Color_1([this._rgb[0], this._rgb[1], this._rgb[2], a], 'rgb');\n }\n return this._rgb[3];\n };\n\n Color_1.prototype.clipped = function() {\n return this._rgb._clipped || false;\n };\n\n Color_1.prototype.darken = function(amount) {\n \tif ( amount === void 0 ) amount=1;\n\n \tvar me = this;\n \tvar lab = me.lab();\n \tlab[0] -= labConstants.Kn * amount;\n \treturn new Color_1(lab, 'lab').alpha(me.alpha(), true);\n };\n\n Color_1.prototype.brighten = function(amount) {\n \tif ( amount === void 0 ) amount=1;\n\n \treturn this.darken(-amount);\n };\n\n Color_1.prototype.darker = Color_1.prototype.darken;\n Color_1.prototype.brighter = Color_1.prototype.brighten;\n\n Color_1.prototype.get = function(mc) {\n var ref = mc.split('.');\n var mode = ref[0];\n var channel = ref[1];\n var src = this[mode]();\n if (channel) {\n var i = mode.indexOf(channel);\n if (i > -1) { return src[i]; }\n throw new Error((\"unknown channel \" + channel + \" in mode \" + mode));\n } else {\n return src;\n }\n };\n\n var type$g = utils.type;\n var pow$2 = Math.pow;\n\n var EPS = 1e-7;\n var MAX_ITER = 20;\n\n Color_1.prototype.luminance = function(lum) {\n if (lum !== undefined && type$g(lum) === 'number') {\n if (lum === 0) {\n // return pure black\n return new Color_1([0,0,0,this._rgb[3]], 'rgb');\n }\n if (lum === 1) {\n // return pure white\n return new Color_1([255,255,255,this._rgb[3]], 'rgb');\n }\n // compute new color using...\n var cur_lum = this.luminance();\n var mode = 'rgb';\n var max_iter = MAX_ITER;\n\n var test = function (low, high) {\n var mid = low.interpolate(high, 0.5, mode);\n var lm = mid.luminance();\n if (Math.abs(lum - lm) < EPS || !max_iter--) {\n // close enough\n return mid;\n }\n return lm > lum ? test(low, mid) : test(mid, high);\n };\n\n var rgb = (cur_lum > lum ? test(new Color_1([0,0,0]), this) : test(this, new Color_1([255,255,255]))).rgb();\n return new Color_1(rgb.concat( [this._rgb[3]]));\n }\n return rgb2luminance.apply(void 0, (this._rgb).slice(0,3));\n };\n\n\n var rgb2luminance = function (r,g,b) {\n // relative luminance\n // see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\n r = luminance_x(r);\n g = luminance_x(g);\n b = luminance_x(b);\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n };\n\n var luminance_x = function (x) {\n x /= 255;\n return x <= 0.03928 ? x/12.92 : pow$2((x+0.055)/1.055, 2.4);\n };\n\n var interpolator = {};\n\n var type$h = utils.type;\n\n\n var mix = function (col1, col2, f) {\n if ( f === void 0 ) f=0.5;\n var rest = [], len = arguments.length - 3;\n while ( len-- > 0 ) rest[ len ] = arguments[ len + 3 ];\n\n var mode = rest[0] || 'lrgb';\n if (!interpolator[mode] && !rest.length) {\n // fall back to the first supported mode\n mode = Object.keys(interpolator)[0];\n }\n if (!interpolator[mode]) {\n throw new Error((\"interpolation mode \" + mode + \" is not defined\"));\n }\n if (type$h(col1) !== 'object') { col1 = new Color_1(col1); }\n if (type$h(col2) !== 'object') { col2 = new Color_1(col2); }\n return interpolator[mode](col1, col2, f)\n .alpha(col1.alpha() + f * (col2.alpha() - col1.alpha()));\n };\n\n Color_1.prototype.mix =\n Color_1.prototype.interpolate = function(col2, f) {\n \tif ( f === void 0 ) f=0.5;\n \tvar rest = [], len = arguments.length - 2;\n \twhile ( len-- > 0 ) rest[ len ] = arguments[ len + 2 ];\n\n \treturn mix.apply(void 0, [ this, col2, f ].concat( rest ));\n };\n\n Color_1.prototype.premultiply = function(mutate) {\n \tif ( mutate === void 0 ) mutate=false;\n\n \tvar rgb = this._rgb;\n \tvar a = rgb[3];\n \tif (mutate) {\n \t\tthis._rgb = [rgb[0]*a, rgb[1]*a, rgb[2]*a, a];\n \t\treturn this;\n \t} else {\n \t\treturn new Color_1([rgb[0]*a, rgb[1]*a, rgb[2]*a, a], 'rgb');\n \t}\n };\n\n Color_1.prototype.saturate = function(amount) {\n \tif ( amount === void 0 ) amount=1;\n\n \tvar me = this;\n \tvar lch = me.lch();\n \tlch[1] += labConstants.Kn * amount;\n \tif (lch[1] < 0) { lch[1] = 0; }\n \treturn new Color_1(lch, 'lch').alpha(me.alpha(), true);\n };\n\n Color_1.prototype.desaturate = function(amount) {\n \tif ( amount === void 0 ) amount=1;\n\n \treturn this.saturate(-amount);\n };\n\n var type$i = utils.type;\n\n Color_1.prototype.set = function(mc, value, mutate) {\n if ( mutate === void 0 ) mutate=false;\n\n var ref = mc.split('.');\n var mode = ref[0];\n var channel = ref[1];\n var src = this[mode]();\n if (channel) {\n var i = mode.indexOf(channel);\n if (i > -1) {\n if (type$i(value) == 'string') {\n switch(value.charAt(0)) {\n case '+': src[i] += +value; break;\n case '-': src[i] += +value; break;\n case '*': src[i] *= +(value.substr(1)); break;\n case '/': src[i] /= +(value.substr(1)); break;\n default: src[i] = +value;\n }\n } else if (type$i(value) === 'number') {\n src[i] = value;\n } else {\n throw new Error(\"unsupported value for Color.set\");\n }\n var out = new Color_1(src, mode);\n if (mutate) {\n this._rgb = out._rgb;\n return this;\n }\n return out;\n }\n throw new Error((\"unknown channel \" + channel + \" in mode \" + mode));\n } else {\n return src;\n }\n };\n\n var rgb$1 = function (col1, col2, f) {\n var xyz0 = col1._rgb;\n var xyz1 = col2._rgb;\n return new Color_1(\n xyz0[0] + f * (xyz1[0]-xyz0[0]),\n xyz0[1] + f * (xyz1[1]-xyz0[1]),\n xyz0[2] + f * (xyz1[2]-xyz0[2]),\n 'rgb'\n )\n };\n\n // register interpolator\n interpolator.rgb = rgb$1;\n\n var sqrt$2 = Math.sqrt;\n var pow$3 = Math.pow;\n\n var lrgb = function (col1, col2, f) {\n var ref = col1._rgb;\n var x1 = ref[0];\n var y1 = ref[1];\n var z1 = ref[2];\n var ref$1 = col2._rgb;\n var x2 = ref$1[0];\n var y2 = ref$1[1];\n var z2 = ref$1[2];\n return new Color_1(\n sqrt$2(pow$3(x1,2) * (1-f) + pow$3(x2,2) * f),\n sqrt$2(pow$3(y1,2) * (1-f) + pow$3(y2,2) * f),\n sqrt$2(pow$3(z1,2) * (1-f) + pow$3(z2,2) * f),\n 'rgb'\n )\n };\n\n // register interpolator\n interpolator.lrgb = lrgb;\n\n var lab$1 = function (col1, col2, f) {\n var xyz0 = col1.lab();\n var xyz1 = col2.lab();\n return new Color_1(\n xyz0[0] + f * (xyz1[0]-xyz0[0]),\n xyz0[1] + f * (xyz1[1]-xyz0[1]),\n xyz0[2] + f * (xyz1[2]-xyz0[2]),\n 'lab'\n )\n };\n\n // register interpolator\n interpolator.lab = lab$1;\n\n var _hsx = function (col1, col2, f, m) {\n var assign, assign$1;\n\n var xyz0, xyz1;\n if (m === 'hsl') {\n xyz0 = col1.hsl();\n xyz1 = col2.hsl();\n } else if (m === 'hsv') {\n xyz0 = col1.hsv();\n xyz1 = col2.hsv();\n } else if (m === 'hcg') {\n xyz0 = col1.hcg();\n xyz1 = col2.hcg();\n } else if (m === 'hsi') {\n xyz0 = col1.hsi();\n xyz1 = col2.hsi();\n } else if (m === 'lch' || m === 'hcl') {\n m = 'hcl';\n xyz0 = col1.hcl();\n xyz1 = col2.hcl();\n }\n\n var hue0, hue1, sat0, sat1, lbv0, lbv1;\n if (m.substr(0, 1) === 'h') {\n (assign = xyz0, hue0 = assign[0], sat0 = assign[1], lbv0 = assign[2]);\n (assign$1 = xyz1, hue1 = assign$1[0], sat1 = assign$1[1], lbv1 = assign$1[2]);\n }\n\n var sat, hue, lbv, dh;\n\n if (!isNaN(hue0) && !isNaN(hue1)) {\n // both colors have hue\n if (hue1 > hue0 && hue1 - hue0 > 180) {\n dh = hue1-(hue0+360);\n } else if (hue1 < hue0 && hue0 - hue1 > 180) {\n dh = hue1+360-hue0;\n } else{\n dh = hue1 - hue0;\n }\n hue = hue0 + f * dh;\n } else if (!isNaN(hue0)) {\n hue = hue0;\n if ((lbv1 == 1 || lbv1 == 0) && m != 'hsv') { sat = sat0; }\n } else if (!isNaN(hue1)) {\n hue = hue1;\n if ((lbv0 == 1 || lbv0 == 0) && m != 'hsv') { sat = sat1; }\n } else {\n hue = Number.NaN;\n }\n\n if (sat === undefined) { sat = sat0 + f * (sat1 - sat0); }\n lbv = lbv0 + f * (lbv1-lbv0);\n return new Color_1([hue, sat, lbv], m);\n };\n\n var lch$1 = function (col1, col2, f) {\n \treturn _hsx(col1, col2, f, 'lch');\n };\n\n // register interpolator\n interpolator.lch = lch$1;\n interpolator.hcl = lch$1;\n\n var num$1 = function (col1, col2, f) {\n var c1 = col1.num();\n var c2 = col2.num();\n return new Color_1(c1 + f * (c2-c1), 'num')\n };\n\n // register interpolator\n interpolator.num = num$1;\n\n var hcg$1 = function (col1, col2, f) {\n \treturn _hsx(col1, col2, f, 'hcg');\n };\n\n // register interpolator\n interpolator.hcg = hcg$1;\n\n var hsi$1 = function (col1, col2, f) {\n \treturn _hsx(col1, col2, f, 'hsi');\n };\n\n // register interpolator\n interpolator.hsi = hsi$1;\n\n var hsl$1 = function (col1, col2, f) {\n \treturn _hsx(col1, col2, f, 'hsl');\n };\n\n // register interpolator\n interpolator.hsl = hsl$1;\n\n var hsv$1 = function (col1, col2, f) {\n \treturn _hsx(col1, col2, f, 'hsv');\n };\n\n // register interpolator\n interpolator.hsv = hsv$1;\n\n var clip_rgb$2 = utils.clip_rgb;\n var pow$4 = Math.pow;\n var sqrt$3 = Math.sqrt;\n var PI$1 = Math.PI;\n var cos$2 = Math.cos;\n var sin$1 = Math.sin;\n var atan2$1 = Math.atan2;\n\n var average = function (colors, mode, weights) {\n if ( mode === void 0 ) mode='lrgb';\n if ( weights === void 0 ) weights=null;\n\n var l = colors.length;\n if (!weights) { weights = Array.from(new Array(l)).map(function () { return 1; }); }\n // normalize weights\n var k = l / weights.reduce(function(a, b) { return a + b; });\n weights.forEach(function (w,i) { weights[i] *= k; });\n // convert colors to Color objects\n colors = colors.map(function (c) { return new Color_1(c); });\n if (mode === 'lrgb') {\n return _average_lrgb(colors, weights)\n }\n var first = colors.shift();\n var xyz = first.get(mode);\n var cnt = [];\n var dx = 0;\n var dy = 0;\n // initial color\n for (var i=0; i= 360) { A$1 -= 360; }\n xyz[i$1] = A$1;\n } else {\n xyz[i$1] = xyz[i$1]/cnt[i$1];\n }\n }\n alpha /= l;\n return (new Color_1(xyz, mode)).alpha(alpha > 0.99999 ? 1 : alpha, true);\n };\n\n\n var _average_lrgb = function (colors, weights) {\n var l = colors.length;\n var xyz = [0,0,0,0];\n for (var i=0; i < colors.length; i++) {\n var col = colors[i];\n var f = weights[i] / l;\n var rgb = col._rgb;\n xyz[0] += pow$4(rgb[0],2) * f;\n xyz[1] += pow$4(rgb[1],2) * f;\n xyz[2] += pow$4(rgb[2],2) * f;\n xyz[3] += rgb[3] * f;\n }\n xyz[0] = sqrt$3(xyz[0]);\n xyz[1] = sqrt$3(xyz[1]);\n xyz[2] = sqrt$3(xyz[2]);\n if (xyz[3] > 0.9999999) { xyz[3] = 1; }\n return new Color_1(clip_rgb$2(xyz));\n };\n\n // minimal multi-purpose interface\n\n // @requires utils color analyze\n\n\n var type$j = utils.type;\n\n var pow$5 = Math.pow;\n\n var scale = function(colors) {\n\n // constructor\n var _mode = 'rgb';\n var _nacol = chroma_1('#ccc');\n var _spread = 0;\n // const _fixed = false;\n var _domain = [0, 1];\n var _pos = [];\n var _padding = [0,0];\n var _classes = false;\n var _colors = [];\n var _out = false;\n var _min = 0;\n var _max = 1;\n var _correctLightness = false;\n var _colorCache = {};\n var _useCache = true;\n var _gamma = 1;\n\n // private methods\n\n var setColors = function(colors) {\n colors = colors || ['#fff', '#000'];\n if (colors && type$j(colors) === 'string' && chroma_1.brewer &&\n chroma_1.brewer[colors.toLowerCase()]) {\n colors = chroma_1.brewer[colors.toLowerCase()];\n }\n if (type$j(colors) === 'array') {\n // handle single color\n if (colors.length === 1) {\n colors = [colors[0], colors[0]];\n }\n // make a copy of the colors\n colors = colors.slice(0);\n // convert to chroma classes\n for (var c=0; c= _classes[i]) {\n i++;\n }\n return i-1;\n }\n return 0;\n };\n\n var tMapLightness = function (t) { return t; };\n var tMapDomain = function (t) { return t; };\n\n // const classifyValue = function(value) {\n // let val = value;\n // if (_classes.length > 2) {\n // const n = _classes.length-1;\n // const i = getClass(value);\n // const minc = _classes[0] + ((_classes[1]-_classes[0]) * (0 + (_spread * 0.5))); // center of 1st class\n // const maxc = _classes[n-1] + ((_classes[n]-_classes[n-1]) * (1 - (_spread * 0.5))); // center of last class\n // val = _min + ((((_classes[i] + ((_classes[i+1] - _classes[i]) * 0.5)) - minc) / (maxc-minc)) * (_max - _min));\n // }\n // return val;\n // };\n\n var getColor = function(val, bypassMap) {\n var col, t;\n if (bypassMap == null) { bypassMap = false; }\n if (isNaN(val) || (val === null)) { return _nacol; }\n if (!bypassMap) {\n if (_classes && (_classes.length > 2)) {\n // find the class\n var c = getClass(val);\n t = c / (_classes.length-2);\n } else if (_max !== _min) {\n // just interpolate between min/max\n t = (val - _min) / (_max - _min);\n } else {\n t = 1;\n }\n } else {\n t = val;\n }\n\n // domain map\n t = tMapDomain(t);\n\n if (!bypassMap) {\n t = tMapLightness(t); // lightness correction\n }\n\n if (_gamma !== 1) { t = pow$5(t, _gamma); }\n\n t = _padding[0] + (t * (1 - _padding[0] - _padding[1]));\n\n t = Math.min(1, Math.max(0, t));\n\n var k = Math.floor(t * 10000);\n\n if (_useCache && _colorCache[k]) {\n col = _colorCache[k];\n } else {\n if (type$j(_colors) === 'array') {\n //for i in [0.._pos.length-1]\n for (var i=0; i<_pos.length; i++) {\n var p = _pos[i];\n if (t <= p) {\n col = _colors[i];\n break;\n }\n if ((t >= p) && (i === (_pos.length-1))) {\n col = _colors[i];\n break;\n }\n if (t > p && t < _pos[i+1]) {\n t = (t-p)/(_pos[i+1]-p);\n col = chroma_1.interpolate(_colors[i], _colors[i+1], t, _mode);\n break;\n }\n }\n } else if (type$j(_colors) === 'function') {\n col = _colors(t);\n }\n if (_useCache) { _colorCache[k] = col; }\n }\n return col;\n };\n\n var resetCache = function () { return _colorCache = {}; };\n\n setColors(colors);\n\n // public interface\n\n var f = function(v) {\n var c = chroma_1(getColor(v));\n if (_out && c[_out]) { return c[_out](); } else { return c; }\n };\n\n f.classes = function(classes) {\n if (classes != null) {\n if (type$j(classes) === 'array') {\n _classes = classes;\n _domain = [classes[0], classes[classes.length-1]];\n } else {\n var d = chroma_1.analyze(_domain);\n if (classes === 0) {\n _classes = [d.min, d.max];\n } else {\n _classes = chroma_1.limits(d, 'e', classes);\n }\n }\n return f;\n }\n return _classes;\n };\n\n\n f.domain = function(domain) {\n if (!arguments.length) {\n return _domain;\n }\n _min = domain[0];\n _max = domain[domain.length-1];\n _pos = [];\n var k = _colors.length;\n if ((domain.length === k) && (_min !== _max)) {\n // update positions\n for (var i = 0, list = Array.from(domain); i < list.length; i += 1) {\n var d = list[i];\n\n _pos.push((d-_min) / (_max-_min));\n }\n } else {\n for (var c=0; c 2) {\n // set domain map\n var tOut = domain.map(function (d,i) { return i/(domain.length-1); });\n var tBreaks = domain.map(function (d) { return (d - _min) / (_max - _min); });\n if (!tBreaks.every(function (val, i) { return tOut[i] === val; })) {\n tMapDomain = function (t) {\n if (t <= 0 || t >= 1) { return t; }\n var i = 0;\n while (t >= tBreaks[i+1]) { i++; }\n var f = (t - tBreaks[i]) / (tBreaks[i+1] - tBreaks[i]);\n var out = tOut[i] + f * (tOut[i+1] - tOut[i]);\n return out;\n };\n }\n\n }\n }\n _domain = [_min, _max];\n return f;\n };\n\n f.mode = function(_m) {\n if (!arguments.length) {\n return _mode;\n }\n _mode = _m;\n resetCache();\n return f;\n };\n\n f.range = function(colors, _pos) {\n setColors(colors, _pos);\n return f;\n };\n\n f.out = function(_o) {\n _out = _o;\n return f;\n };\n\n f.spread = function(val) {\n if (!arguments.length) {\n return _spread;\n }\n _spread = val;\n return f;\n };\n\n f.correctLightness = function(v) {\n if (v == null) { v = true; }\n _correctLightness = v;\n resetCache();\n if (_correctLightness) {\n tMapLightness = function(t) {\n var L0 = getColor(0, true).lab()[0];\n var L1 = getColor(1, true).lab()[0];\n var pol = L0 > L1;\n var L_actual = getColor(t, true).lab()[0];\n var L_ideal = L0 + ((L1 - L0) * t);\n var L_diff = L_actual - L_ideal;\n var t0 = 0;\n var t1 = 1;\n var max_iter = 20;\n while ((Math.abs(L_diff) > 1e-2) && (max_iter-- > 0)) {\n (function() {\n if (pol) { L_diff *= -1; }\n if (L_diff < 0) {\n t0 = t;\n t += (t1 - t) * 0.5;\n } else {\n t1 = t;\n t += (t0 - t) * 0.5;\n }\n L_actual = getColor(t, true).lab()[0];\n return L_diff = L_actual - L_ideal;\n })();\n }\n return t;\n };\n } else {\n tMapLightness = function (t) { return t; };\n }\n return f;\n };\n\n f.padding = function(p) {\n if (p != null) {\n if (type$j(p) === 'number') {\n p = [p,p];\n }\n _padding = p;\n return f;\n } else {\n return _padding;\n }\n };\n\n f.colors = function(numColors, out) {\n // If no arguments are given, return the original colors that were provided\n if (arguments.length < 2) { out = 'hex'; }\n var result = [];\n\n if (arguments.length === 0) {\n result = _colors.slice(0);\n\n } else if (numColors === 1) {\n result = [f(0.5)];\n\n } else if (numColors > 1) {\n var dm = _domain[0];\n var dd = _domain[1] - dm;\n result = __range__(0, numColors, false).map(function (i) { return f( dm + ((i/(numColors-1)) * dd) ); });\n\n } else { // returns all colors based on the defined classes\n colors = [];\n var samples = [];\n if (_classes && (_classes.length > 2)) {\n for (var i = 1, end = _classes.length, asc = 1 <= end; asc ? i < end : i > end; asc ? i++ : i--) {\n samples.push((_classes[i-1]+_classes[i])*0.5);\n }\n } else {\n samples = _domain;\n }\n result = samples.map(function (v) { return f(v); });\n }\n\n if (chroma_1[out]) {\n result = result.map(function (c) { return c[out](); });\n }\n return result;\n };\n\n f.cache = function(c) {\n if (c != null) {\n _useCache = c;\n return f;\n } else {\n return _useCache;\n }\n };\n\n f.gamma = function(g) {\n if (g != null) {\n _gamma = g;\n return f;\n } else {\n return _gamma;\n }\n };\n\n f.nodata = function(d) {\n if (d != null) {\n _nacol = chroma_1(d);\n return f;\n } else {\n return _nacol;\n }\n };\n\n return f;\n };\n\n function __range__(left, right, inclusive) {\n var range = [];\n var ascending = left < right;\n var end = !inclusive ? right : ascending ? right + 1 : right - 1;\n for (var i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {\n range.push(i);\n }\n return range;\n }\n\n //\n // interpolates between a set of colors uzing a bezier spline\n //\n\n // @requires utils lab\n\n\n\n\n var bezier = function(colors) {\n var assign, assign$1, assign$2;\n\n var I, lab0, lab1, lab2;\n colors = colors.map(function (c) { return new Color_1(c); });\n if (colors.length === 2) {\n // linear interpolation\n (assign = colors.map(function (c) { return c.lab(); }), lab0 = assign[0], lab1 = assign[1]);\n I = function(t) {\n var lab = ([0, 1, 2].map(function (i) { return lab0[i] + (t * (lab1[i] - lab0[i])); }));\n return new Color_1(lab, 'lab');\n };\n } else if (colors.length === 3) {\n // quadratic bezier interpolation\n (assign$1 = colors.map(function (c) { return c.lab(); }), lab0 = assign$1[0], lab1 = assign$1[1], lab2 = assign$1[2]);\n I = function(t) {\n var lab = ([0, 1, 2].map(function (i) { return ((1-t)*(1-t) * lab0[i]) + (2 * (1-t) * t * lab1[i]) + (t * t * lab2[i]); }));\n return new Color_1(lab, 'lab');\n };\n } else if (colors.length === 4) {\n // cubic bezier interpolation\n var lab3;\n (assign$2 = colors.map(function (c) { return c.lab(); }), lab0 = assign$2[0], lab1 = assign$2[1], lab2 = assign$2[2], lab3 = assign$2[3]);\n I = function(t) {\n var lab = ([0, 1, 2].map(function (i) { return ((1-t)*(1-t)*(1-t) * lab0[i]) + (3 * (1-t) * (1-t) * t * lab1[i]) + (3 * (1-t) * t * t * lab2[i]) + (t*t*t * lab3[i]); }));\n return new Color_1(lab, 'lab');\n };\n } else if (colors.length === 5) {\n var I0 = bezier(colors.slice(0, 3));\n var I1 = bezier(colors.slice(2, 5));\n I = function(t) {\n if (t < 0.5) {\n return I0(t*2);\n } else {\n return I1((t-0.5)*2);\n }\n };\n }\n return I;\n };\n\n var bezier_1 = function (colors) {\n var f = bezier(colors);\n f.scale = function () { return scale(f); };\n return f;\n };\n\n /*\n * interpolates between a set of colors uzing a bezier spline\n * blend mode formulas taken from http://www.venture-ware.com/kevin/coding/lets-learn-math-photoshop-blend-modes/\n */\n\n\n\n\n var blend = function (bottom, top, mode) {\n if (!blend[mode]) {\n throw new Error('unknown blend mode ' + mode);\n }\n return blend[mode](bottom, top);\n };\n\n var blend_f = function (f) { return function (bottom,top) {\n var c0 = chroma_1(top).rgb();\n var c1 = chroma_1(bottom).rgb();\n return chroma_1.rgb(f(c0, c1));\n }; };\n\n var each = function (f) { return function (c0, c1) {\n var out = [];\n out[0] = f(c0[0], c1[0]);\n out[1] = f(c0[1], c1[1]);\n out[2] = f(c0[2], c1[2]);\n return out;\n }; };\n\n var normal = function (a) { return a; };\n var multiply = function (a,b) { return a * b / 255; };\n var darken$1 = function (a,b) { return a > b ? b : a; };\n var lighten = function (a,b) { return a > b ? a : b; };\n var screen = function (a,b) { return 255 * (1 - (1-a/255) * (1-b/255)); };\n var overlay = function (a,b) { return b < 128 ? 2 * a * b / 255 : 255 * (1 - 2 * (1 - a / 255 ) * ( 1 - b / 255 )); };\n var burn = function (a,b) { return 255 * (1 - (1 - b / 255) / (a/255)); };\n var dodge = function (a,b) {\n if (a === 255) { return 255; }\n a = 255 * (b / 255) / (1 - a / 255);\n return a > 255 ? 255 : a\n };\n\n // # add = (a,b) ->\n // # if (a + b > 255) then 255 else a + b\n\n blend.normal = blend_f(each(normal));\n blend.multiply = blend_f(each(multiply));\n blend.screen = blend_f(each(screen));\n blend.overlay = blend_f(each(overlay));\n blend.darken = blend_f(each(darken$1));\n blend.lighten = blend_f(each(lighten));\n blend.dodge = blend_f(each(dodge));\n blend.burn = blend_f(each(burn));\n // blend.add = blend_f(each(add));\n\n var blend_1 = blend;\n\n // cubehelix interpolation\n // based on D.A. Green \"A colour scheme for the display of astronomical intensity images\"\n // http://astron-soc.in/bulletin/11June/289392011.pdf\n\n var type$k = utils.type;\n var clip_rgb$3 = utils.clip_rgb;\n var TWOPI$2 = utils.TWOPI;\n var pow$6 = Math.pow;\n var sin$2 = Math.sin;\n var cos$3 = Math.cos;\n\n\n var cubehelix = function(start, rotations, hue, gamma, lightness) {\n if ( start === void 0 ) start=300;\n if ( rotations === void 0 ) rotations=-1.5;\n if ( hue === void 0 ) hue=1;\n if ( gamma === void 0 ) gamma=1;\n if ( lightness === void 0 ) lightness=[0,1];\n\n var dh = 0, dl;\n if (type$k(lightness) === 'array') {\n dl = lightness[1] - lightness[0];\n } else {\n dl = 0;\n lightness = [lightness, lightness];\n }\n\n var f = function(fract) {\n var a = TWOPI$2 * (((start+120)/360) + (rotations * fract));\n var l = pow$6(lightness[0] + (dl * fract), gamma);\n var h = dh !== 0 ? hue[0] + (fract * dh) : hue;\n var amp = (h * l * (1-l)) / 2;\n var cos_a = cos$3(a);\n var sin_a = sin$2(a);\n var r = l + (amp * ((-0.14861 * cos_a) + (1.78277* sin_a)));\n var g = l + (amp * ((-0.29227 * cos_a) - (0.90649* sin_a)));\n var b = l + (amp * (+1.97294 * cos_a));\n return chroma_1(clip_rgb$3([r*255,g*255,b*255,1]));\n };\n\n f.start = function(s) {\n if ((s == null)) { return start; }\n start = s;\n return f;\n };\n\n f.rotations = function(r) {\n if ((r == null)) { return rotations; }\n rotations = r;\n return f;\n };\n\n f.gamma = function(g) {\n if ((g == null)) { return gamma; }\n gamma = g;\n return f;\n };\n\n f.hue = function(h) {\n if ((h == null)) { return hue; }\n hue = h;\n if (type$k(hue) === 'array') {\n dh = hue[1] - hue[0];\n if (dh === 0) { hue = hue[1]; }\n } else {\n dh = 0;\n }\n return f;\n };\n\n f.lightness = function(h) {\n if ((h == null)) { return lightness; }\n if (type$k(h) === 'array') {\n lightness = h;\n dl = h[1] - h[0];\n } else {\n lightness = [h,h];\n dl = 0;\n }\n return f;\n };\n\n f.scale = function () { return chroma_1.scale(f); };\n\n f.hue(hue);\n\n return f;\n };\n\n var digits = '0123456789abcdef';\n\n var floor$2 = Math.floor;\n var random = Math.random;\n\n var random_1 = function () {\n var code = '#';\n for (var i=0; i<6; i++) {\n code += digits.charAt(floor$2(random() * 16));\n }\n return new Color_1(code, 'hex');\n };\n\n var log$1 = Math.log;\n var pow$7 = Math.pow;\n var floor$3 = Math.floor;\n var abs = Math.abs;\n\n\n var analyze = function (data, key) {\n if ( key === void 0 ) key=null;\n\n var r = {\n min: Number.MAX_VALUE,\n max: Number.MAX_VALUE*-1,\n sum: 0,\n values: [],\n count: 0\n };\n if (type(data) === 'object') {\n data = Object.values(data);\n }\n data.forEach(function (val) {\n if (key && type(val) === 'object') { val = val[key]; }\n if (val !== undefined && val !== null && !isNaN(val)) {\n r.values.push(val);\n r.sum += val;\n if (val < r.min) { r.min = val; }\n if (val > r.max) { r.max = val; }\n r.count += 1;\n }\n });\n\n r.domain = [r.min, r.max];\n\n r.limits = function (mode, num) { return limits(r, mode, num); };\n\n return r;\n };\n\n\n var limits = function (data, mode, num) {\n if ( mode === void 0 ) mode='equal';\n if ( num === void 0 ) num=7;\n\n if (type(data) == 'array') {\n data = analyze(data);\n }\n var min = data.min;\n var max = data.max;\n var values = data.values.sort(function (a,b) { return a-b; });\n\n if (num === 1) { return [min,max]; }\n\n var limits = [];\n\n if (mode.substr(0,1) === 'c') { // continuous\n limits.push(min);\n limits.push(max);\n }\n\n if (mode.substr(0,1) === 'e') { // equal interval\n limits.push(min);\n for (var i=1; i 0');\n }\n var min_log = Math.LOG10E * log$1(min);\n var max_log = Math.LOG10E * log$1(max);\n limits.push(min);\n for (var i$1=1; i$1 pb\n var pr = p - pb;\n limits.push((values[pb]*(1-pr)) + (values[pb+1]*pr));\n }\n }\n limits.push(max);\n\n }\n\n else if (mode.substr(0,1) === 'k') { // k-means clustering\n /*\n implementation based on\n http://code.google.com/p/figue/source/browse/trunk/figue.js#336\n simplified for 1-d input values\n */\n var cluster;\n var n = values.length;\n var assignments = new Array(n);\n var clusterSizes = new Array(num);\n var repeat = true;\n var nb_iters = 0;\n var centroids = null;\n\n // get seed values\n centroids = [];\n centroids.push(min);\n for (var i$3=1; i$3 200) {\n repeat = false;\n }\n }\n\n // finished k-means clustering\n // the next part is borrowed from gabrielflor.it\n var kClusters = {};\n for (var j$5=0; j$5 l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05);\n };\n\n var sqrt$4 = Math.sqrt;\n var atan2$2 = Math.atan2;\n var abs$1 = Math.abs;\n var cos$4 = Math.cos;\n var PI$2 = Math.PI;\n\n var deltaE = function(a, b, L, C) {\n if ( L === void 0 ) L=1;\n if ( C === void 0 ) C=1;\n\n // Delta E (CMC)\n // see http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CMC.html\n a = new Color_1(a);\n b = new Color_1(b);\n var ref = Array.from(a.lab());\n var L1 = ref[0];\n var a1 = ref[1];\n var b1 = ref[2];\n var ref$1 = Array.from(b.lab());\n var L2 = ref$1[0];\n var a2 = ref$1[1];\n var b2 = ref$1[2];\n var c1 = sqrt$4((a1 * a1) + (b1 * b1));\n var c2 = sqrt$4((a2 * a2) + (b2 * b2));\n var sl = L1 < 16.0 ? 0.511 : (0.040975 * L1) / (1.0 + (0.01765 * L1));\n var sc = ((0.0638 * c1) / (1.0 + (0.0131 * c1))) + 0.638;\n var h1 = c1 < 0.000001 ? 0.0 : (atan2$2(b1, a1) * 180.0) / PI$2;\n while (h1 < 0) { h1 += 360; }\n while (h1 >= 360) { h1 -= 360; }\n var t = (h1 >= 164.0) && (h1 <= 345.0) ? (0.56 + abs$1(0.2 * cos$4((PI$2 * (h1 + 168.0)) / 180.0))) : (0.36 + abs$1(0.4 * cos$4((PI$2 * (h1 + 35.0)) / 180.0)));\n var c4 = c1 * c1 * c1 * c1;\n var f = sqrt$4(c4 / (c4 + 1900.0));\n var sh = sc * (((f * t) + 1.0) - f);\n var delL = L1 - L2;\n var delC = c1 - c2;\n var delA = a1 - a2;\n var delB = b1 - b2;\n var dH2 = ((delA * delA) + (delB * delB)) - (delC * delC);\n var v1 = delL / (L * sl);\n var v2 = delC / (C * sc);\n var v3 = sh;\n return sqrt$4((v1 * v1) + (v2 * v2) + (dH2 / (v3 * v3)));\n };\n\n // simple Euclidean distance\n var distance = function(a, b, mode) {\n if ( mode === void 0 ) mode='lab';\n\n // Delta E (CIE 1976)\n // see http://www.brucelindbloom.com/index.html?Equations.html\n a = new Color_1(a);\n b = new Color_1(b);\n var l1 = a.get(mode);\n var l2 = b.get(mode);\n var sum_sq = 0;\n for (var i in l1) {\n var d = (l1[i] || 0) - (l2[i] || 0);\n sum_sq += d*d;\n }\n return Math.sqrt(sum_sq);\n };\n\n var valid = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n try {\n new (Function.prototype.bind.apply( Color_1, [ null ].concat( args) ));\n return true;\n } catch (e) {\n return false;\n }\n };\n\n // some pre-defined color scales:\n\n\n\n\n var scales = {\n \tcool: function cool() { return scale([chroma_1.hsl(180,1,.9), chroma_1.hsl(250,.7,.4)]) },\n \thot: function hot() { return scale(['#000','#f00','#ff0','#fff'], [0,.25,.75,1]).mode('rgb') }\n };\n\n /**\n ColorBrewer colors for chroma.js\n\n Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The\n Pennsylvania State University.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software distributed\n under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n CONDITIONS OF ANY KIND, either express or implied. See the License for the\n specific language governing permissions and limitations under the License.\n */\n\n var colorbrewer = {\n // sequential\n OrRd: ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'],\n PuBu: ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'],\n BuPu: ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'],\n Oranges: ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'],\n BuGn: ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'],\n YlOrBr: ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'],\n YlGn: ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'],\n Reds: ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'],\n RdPu: ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'],\n Greens: ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'],\n YlGnBu: ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'],\n Purples: ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'],\n GnBu: ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'],\n Greys: ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'],\n YlOrRd: ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'],\n PuRd: ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'],\n Blues: ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'],\n PuBuGn: ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'],\n Viridis: ['#440154', '#482777', '#3f4a8a', '#31678e', '#26838f', '#1f9d8a', '#6cce5a', '#b6de2b', '#fee825'],\n\n // diverging\n\n Spectral: ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'],\n RdYlGn: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'],\n RdBu: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'],\n PiYG: ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'],\n PRGn: ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'],\n RdYlBu: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'],\n BrBG: ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'],\n RdGy: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'],\n PuOr: ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'],\n\n // qualitative\n\n Set2: ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494', '#b3b3b3'],\n Accent: ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17', '#666666'],\n Set1: ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf', '#999999'],\n Set3: ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5', '#ffed6f'],\n Dark2: ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666666'],\n Paired: ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'],\n Pastel2: ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc'],\n Pastel1: ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2'],\n };\n\n // add lowercase aliases for case-insensitive matches\n for (var i$1 = 0, list$1 = Object.keys(colorbrewer); i$1 < list$1.length; i$1 += 1) {\n var key = list$1[i$1];\n\n colorbrewer[key.toLowerCase()] = colorbrewer[key];\n }\n\n var colorbrewer_1 = colorbrewer;\n\n // feel free to comment out anything to rollup\n // a smaller chroma.js built\n\n // io --> convert colors\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n // operators --> modify existing Colors\n\n\n\n\n\n\n\n\n\n\n // interpolators\n\n\n\n\n\n\n\n\n\n\n // generators -- > create new colors\n chroma_1.average = average;\n chroma_1.bezier = bezier_1;\n chroma_1.blend = blend_1;\n chroma_1.cubehelix = cubehelix;\n chroma_1.mix = chroma_1.interpolate = mix;\n chroma_1.random = random_1;\n chroma_1.scale = scale;\n\n // other utility methods\n chroma_1.analyze = analyze_1.analyze;\n chroma_1.contrast = contrast;\n chroma_1.deltaE = deltaE;\n chroma_1.distance = distance;\n chroma_1.limits = analyze_1.limits;\n chroma_1.valid = valid;\n\n // scale\n chroma_1.scales = scales;\n\n // colors\n chroma_1.colors = w3cx11_1;\n chroma_1.brewer = colorbrewer_1;\n\n var chroma_js = chroma_1;\n\n return chroma_js;\n\n})));\n","//download.js v4.2, by dandavis; 2008-2016. [MIT] see http://danml.com/download.html for tests/usage\n// v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime\n// v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs\n// v3 added dataURL and Blob Input, bind-toggle arity, and legacy dataURL fallback was improved with force-download mime and base64 support. 3.1 improved safari handling.\n// v4 adds AMD/UMD, commonJS, and plain browser support\n// v4.1 adds url download capability via solo URL argument (same domain/CORS only)\n// v4.2 adds semantic variable names, long (over 2MB) dataURL support, and hidden by default temp anchors\n// https://github.com/rndme/download\n\n(function (root, factory) {\n\tif (typeof define === 'function' && define.amd) {\n\t\t// AMD. Register as an anonymous module.\n\t\tdefine([], factory);\n\t} else if (typeof exports === 'object') {\n\t\t// Node. Does not work with strict CommonJS, but\n\t\t// only CommonJS-like environments that support module.exports,\n\t\t// like Node.\n\t\tmodule.exports = factory();\n\t} else {\n\t\t// Browser globals (root is window)\n\t\troot.download = factory();\n }\n}(this, function () {\n\n\treturn function download(data, strFileName, strMimeType) {\n\n\t\tvar self = window, // this script is only for browsers anyway...\n\t\t\tdefaultMime = \"application/octet-stream\", // this default mime also triggers iframe downloads\n\t\t\tmimeType = strMimeType || defaultMime,\n\t\t\tpayload = data,\n\t\t\turl = !strFileName && !strMimeType && payload,\n\t\t\tanchor = document.createElement(\"a\"),\n\t\t\ttoString = function(a){return String(a);},\n\t\t\tmyBlob = (self.Blob || self.MozBlob || self.WebKitBlob || toString),\n\t\t\tfileName = strFileName || \"download\",\n\t\t\tblob,\n\t\t\treader;\n\t\t\tmyBlob= myBlob.call ? myBlob.bind(self) : Blob ;\n\t \n\t\tif(String(this)===\"true\"){ //reverse arguments, allowing download.bind(true, \"text/xml\", \"export.xml\") to act as a callback\n\t\t\tpayload=[payload, mimeType];\n\t\t\tmimeType=payload[0];\n\t\t\tpayload=payload[1];\n\t\t}\n\n\n\t\tif(url && url.length< 2048){ // if no filename and no mime, assume a url was passed as the only argument\n\t\t\tfileName = url.split(\"/\").pop().split(\"?\")[0];\n\t\t\tanchor.href = url; // assign href prop to temp anchor\n\t\t \tif(anchor.href.indexOf(url) !== -1){ // if the browser determines that it's a potentially valid url path:\n \t\tvar ajax=new XMLHttpRequest();\n \t\tajax.open( \"GET\", url, true);\n \t\tajax.responseType = 'blob';\n \t\tajax.onload= function(e){ \n\t\t\t\t download(e.target.response, fileName, defaultMime);\n\t\t\t\t};\n \t\tsetTimeout(function(){ ajax.send();}, 0); // allows setting custom ajax headers using the return:\n\t\t\t return ajax;\n\t\t\t} // end if valid url?\n\t\t} // end if url?\n\n\n\t\t//go ahead and download dataURLs right away\n\t\tif(/^data:([\\w+-]+\\/[\\w+.-]+)?[,;]/.test(payload)){\n\t\t\n\t\t\tif(payload.length > (1024*1024*1.999) && myBlob !== toString ){\n\t\t\t\tpayload=dataUrlToBlob(payload);\n\t\t\t\tmimeType=payload.type || defaultMime;\n\t\t\t}else{\t\t\t\n\t\t\t\treturn navigator.msSaveBlob ? // IE10 can't do a[download], only Blobs:\n\t\t\t\t\tnavigator.msSaveBlob(dataUrlToBlob(payload), fileName) :\n\t\t\t\t\tsaver(payload) ; // everyone else can save dataURLs un-processed\n\t\t\t}\n\t\t\t\n\t\t}else{//not data url, is it a string with special needs?\n\t\t\tif(/([\\x80-\\xff])/.test(payload)){\t\t\t \n\t\t\t\tvar i=0, tempUiArr= new Uint8Array(payload.length), mx=tempUiArr.length;\n\t\t\t\tfor(i;i {\r\n min(): number;\r\n max(): number;\r\n }\r\n}\r\n\r\nArray.prototype.min = function (): number {\r\n if (this.length > 65536) {\r\n let r = this[0];\r\n this.forEach(function (v: number, _i: any, _a: any) { if (v < r) r = v; });\r\n return r;\r\n } else {\r\n return Math.min.apply(null, this);\r\n }\r\n}\r\n\r\nArray.prototype.max = function (): number {\r\n if (this.length > 65536) {\r\n let r = this[0];\r\n this.forEach(function (v: number, _i: any, _a: any) { if (v > r) r = v; });\r\n return r;\r\n } else {\r\n return Math.max.apply(null, this);\r\n }\r\n}\r\n\r\nexport function matrixMax(matrix: number[][]): number {\r\n let maxRow = matrix.map(function (row) { return row.max(); });\r\n let max = maxRow.max();\r\n return max\r\n}\r\n\r\nexport function matrixMin(matrix: number[][]): number {\r\n let minRow = matrix.map(function (row) { return row.min(); });\r\n let min = minRow.min();\r\n return min\r\n}\r\n\r\nexport function getUniqueVals(source: string[]): string[] {\r\n let length = source.length;\r\n let result: string[] = [];\r\n let seen = new Set();\r\n\r\n outer:\r\n for (let index = 0; index < length; index++) {\r\n let value = source[index];\r\n if (seen.has(value)) continue outer;\r\n seen.add(value);\r\n result.push(value);\r\n }\r\n\r\n return result;\r\n}\r\n\r\nimport { ImgStack } from \"./plotTypes/ImgStack\";\r\nimport { ShapeCloud } from \"./plotTypes/ShapeCloud\";\r\nimport { PointCloud } from \"./plotTypes/PointCloud\";\r\nimport { Surface } from \"./plotTypes/Surface\";\r\nimport { HeatMap } from \"./plotTypes/HeatMap\";\r\nimport { MeshStream } from \"./plotTypes/MeshStream\";\r\nimport { MeshObject } from \"./plotTypes/MeshObject\";\r\nimport { Line } from \"./plotTypes/Line\";\r\nimport { BoundingBox } from \"@babylonjs/core/Culling/boundingBox\";\r\nimport { styleText } from \"./utils/styleText\";\r\nimport { buttonSVGs, legendSVGs } from \"./utils/SVGs\";\r\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\r\nimport { ILoadingScreen } from \"@babylonjs/core/Loading/loadingScreen\";\r\n\r\nexport const PLOTTYPES = {\r\n 'pointCloud': ['coordinates', 'colorBy', 'colorVar'],\r\n 'shapeCloud': ['coordinates', 'colorBy', 'colorVar'],\r\n 'surface': ['coordinates', 'colorBy', 'colorVar'],\r\n 'heatMap': ['coordinates', 'colorBy', 'colorVar'],\r\n 'imageStack': ['values', 'indices', 'attributes'],\r\n 'meshObject': ['meshString'],\r\n 'Line': ['coordinates', 'colorBy', 'colorVar']\r\n}\r\n\r\n/**\r\n * Takes a reasonable guess if a plot can be created from the provided object\r\n * @param plotData Object containing data to be checked for valid plot information\r\n */\r\nexport function isValidPlot(plotData: {}): boolean {\r\n for (let plotIdx = 0; plotIdx < plotData[\"plots\"].length; plotIdx++) {\r\n const plot = plotData[\"plots\"][plotIdx];\r\n let pltType = plot[\"plotType\"]\r\n if (PLOTTYPES.hasOwnProperty(pltType)) {\r\n for (let i = 0; i < PLOTTYPES[pltType].length; i++) {\r\n const prop = PLOTTYPES[pltType][i];\r\n if (plot[prop] === undefined) {\r\n console.log('Plot ' + plotIdx + ' is missing property:' + prop);\r\n return false;\r\n }\r\n }\r\n } else {\r\n console.log('Unrecognized plot type')\r\n return false;\r\n }\r\n }\r\n return true;\r\n}\r\n\r\nexport class Plots {\r\n private _engine: Engine;\r\n private _hl1: HemisphericLight;\r\n private _hl2: HemisphericLight;\r\n protected _legend: AdvancedDynamicTexture;\r\n protected _showLegend: boolean = true;\r\n private _hasAnim: boolean = false;\r\n private _loopingAnim: boolean = false;\r\n private _buttonBar: HTMLDivElement;\r\n private _turntableBtn: HTMLDivElement;\r\n private _loopBtn: HTMLElement;\r\n private _streamControlBtn: HTMLDivElement;\r\n private _animationSlider: HTMLInputElement;\r\n private _axes: Axes[] = [];\r\n private _downloadObj: {} = {};\r\n private _annotationManager: AnnotationManager;\r\n private _backgroundColor: string;\r\n private _recording: boolean = false;\r\n private _turned: number = 0;\r\n private _capturer: CCapture;\r\n private _wasTurning: boolean = false;\r\n private _xScale: number = 1;\r\n private _yScale: number = 1;\r\n private _zScale: number = 1;\r\n private _publishFormOverlay: HTMLDivElement;\r\n private _uniqID: string;\r\n private _shapeLegendPosition: string;\r\n private _fsUIDirty: boolean = true;\r\n private _upAxis: string = \"+y\";\r\n\r\n /** HTML canvas element for this babyplots visualization. */\r\n canvas: HTMLCanvasElement;\r\n /** Babylonjs scene object. */\r\n scene: Scene;\r\n /** Camera of the visualization */\r\n camera: ArcRotateCamera;\r\n /** Array of plots in this visualization. */\r\n plots: Plot[] = [];\r\n /** Turn the camera around the plots. */\r\n turntable: boolean;\r\n /** Rotation speed of the turntable camera. */\r\n rotationRate: number;\r\n /** Highest point on the y axis of any plot. Used for positioning the camera and labels. */\r\n ymax: number = 0;\r\n /** This variable should be exclusively set by the babyplots R package. It controls some specific options for babyplots behavior in the RStudio viewer. */\r\n R: boolean = false;\r\n /** This variable should be exclusively set by the babyplots Python package. It controls some specific options for babyplots behavior in the Jupyter notebook. */\r\n Python: boolean = false;\r\n /** Title of the legend showing the names and plot types of multiple plots, if at least one plot has showShape enabled. */\r\n shapeLegendTitle: string = \"\";\r\n /** AdvancedDynamicTexture for the full screen UI */\r\n uiLayer: AdvancedDynamicTexture;\r\n /** Play or pause state of all animations */\r\n animPaused: boolean = false;\r\n\r\n\r\n /**\r\n * Initialize the 3d visualization\r\n * \r\n * @param canvasElement ID of the canvas element in the DOM\r\n * @param options Object with general options. See a list of possible options [here](https://bp.bleb.li/documentation/js#plotsObject).\r\n */\r\n constructor(canvasElement: string, options = {}) {\r\n // create unique id, needed if multiple babyplots canvases are on the same page.\r\n this._uniqID = uuidv4();\r\n\r\n // apply options\r\n // default settings\r\n let opts = {\r\n backgroundColor: \"#ffffffff\",\r\n xScale: 1,\r\n yScale: 1,\r\n zScale: 1,\r\n turntable: false,\r\n rotationRate: 0.01,\r\n shapeLegendTitle: \"\",\r\n upAxis: \"+y\",\r\n }\r\n Object.assign(opts, options);\r\n\r\n this.turntable = opts.turntable;\r\n this.rotationRate = opts.rotationRate;\r\n this.shapeLegendTitle = opts.shapeLegendTitle;\r\n\r\n // setup enginge and scene\r\n this._backgroundColor = opts.backgroundColor;\r\n this.canvas = document.getElementById(canvasElement) as HTMLCanvasElement;\r\n this._engine = new Engine(this.canvas, true, { preserveDrawingBuffer: true, stencil: true });\r\n this.scene = new Scene(this._engine);\r\n\r\n // camera\r\n this.camera = new ArcRotateCamera(\"Camera\", 0, 0, 10, Vector3.Zero(), this.scene);\r\n this.camera.attachControl(this.canvas, true);\r\n this.scene.activeCamera = this.camera;\r\n this.camera.inputs.attached.keyboard.detachControl();\r\n this.camera.wheelPrecision = 50;\r\n this._upAxis = opts.upAxis;\r\n this._updateCameraUpVector();\r\n\r\n // background color\r\n this.scene.clearColor = Color4.FromHexString(opts.backgroundColor);\r\n\r\n // Loading screen\r\n var loadingScreen = new CustomLoadingScreen(\"Loading\");\r\n this._engine.loadingScreen = loadingScreen;\r\n\r\n // Axis scales\r\n this._xScale = opts.xScale;\r\n this._yScale = opts.yScale;\r\n this._zScale = opts.zScale;\r\n\r\n // two lights to illuminate the plot uniformly (top and bottom)\r\n this._hl1 = new HemisphericLight(\"HemiLight\", new Vector3(0, 1, 0), this.scene);\r\n this._hl1.diffuse = new Color3(1, 1, 1);\r\n this._hl1.specular = new Color3(0.01, 0.01, 0.01);\r\n // bottom light slightly weaker for better depth perception and orientation\r\n this._hl2 = new HemisphericLight(\"HemiLight\", new Vector3(0, -1, 0), this.scene);\r\n this._hl2.diffuse = new Color3(0.8, 0.8, 0.8);\r\n this._hl2.specular = new Color3(0.01, 0.01, 0.01);\r\n\r\n // create fullscreen GUI texture\r\n this.uiLayer = AdvancedDynamicTexture.CreateFullscreenUI(\"UI\", true, this.scene);\r\n\r\n this._annotationManager = new AnnotationManager(this.canvas, this.scene, this.ymax, this.camera, this._backgroundColor, this.uiLayer, this._uniqID);\r\n\r\n this.scene.registerBeforeRender(this._prepRender.bind(this));\r\n\r\n this.scene.registerAfterRender(this._afterRender.bind(this));\r\n\r\n // create container for buttons\r\n // create css style\r\n let styleElem = document.createElement(\"style\");\r\n styleElem.appendChild(document.createTextNode(styleText));\r\n document.getElementsByTagName('head')[0].appendChild(styleElem);\r\n\r\n // create ui elements\r\n let buttonBar = document.createElement(\"div\");\r\n buttonBar.id = \"buttonBar_\" + this._uniqID;\r\n buttonBar.className = \"bbp button-bar\"\r\n buttonBar.style.top = this.canvas.clientTop + 5 + \"px\";\r\n buttonBar.style.left = this.canvas.clientLeft + 5 + \"px\";\r\n this.canvas.parentNode.appendChild(buttonBar);\r\n this._buttonBar = buttonBar;\r\n\r\n // animation and streaming buttons\r\n let streamCtrlBtn = document.createElement(\"div\");\r\n streamCtrlBtn.className = \"button streamctrl loading hidden\";\r\n streamCtrlBtn.onclick = () => (this._streamControlBtn.className === \"button streamctrl pause\") ? this.pauseAnimation() : this.playAnimation();\r\n let streamCtrlLoading = document.createElement(\"div\");\r\n streamCtrlLoading.className = \"btn-label loading\";\r\n streamCtrlLoading.innerHTML = buttonSVGs.loading;\r\n streamCtrlBtn.appendChild(streamCtrlLoading);\r\n let streamCtrlPlay = document.createElement(\"div\");\r\n streamCtrlPlay.className = \"btn-label play\";\r\n streamCtrlPlay.innerHTML = buttonSVGs.play;\r\n streamCtrlBtn.appendChild(streamCtrlPlay);\r\n let streamCtrlPause = document.createElement(\"div\");\r\n streamCtrlPause.className = \"btn-label pause\";\r\n streamCtrlPause.innerHTML = buttonSVGs.pause;\r\n streamCtrlBtn.appendChild(streamCtrlPause);\r\n this._buttonBar.appendChild(streamCtrlBtn);\r\n let animRange = document.createElement(\"input\");\r\n animRange.type = \"range\";\r\n animRange.min = \"0\";\r\n animRange.max = \"0\";\r\n animRange.value = \"0\";\r\n animRange.step = \"1\";\r\n animRange.className = \"anim-slider hidden\";\r\n animRange.disabled = true;\r\n animRange.onchange = () => this.setAnimationFrame();\r\n this._animationSlider = animRange;\r\n this._buttonBar.appendChild(animRange);\r\n\r\n this._streamControlBtn = streamCtrlBtn;\r\n\r\n // prepare download object\r\n this._downloadObj = {\r\n plots: []\r\n };\r\n\r\n this.scene.onPointerDown = (function (_evt: any, pickResult: PickingInfo) {\r\n // (this as Plots)._annotationManager.clearInfo();\r\n for (let i = 0; i < (this as Plots).plots.length; i++) {\r\n let plot = (this as Plots).plots[i];\r\n if (!plot.pickable) {\r\n continue;\r\n }\r\n if (pickResult.pickedMesh === plot.mesh && (plot as CoordinatePlot).dpInfo) {\r\n let pick = (plot as CoordinatePlot).getPick(pickResult);\r\n (this as Plots)._annotationManager.displayInfo(pick.info, pick.target);\r\n }\r\n }\r\n }).bind(this);\r\n }\r\n\r\n private _updateCameraUpVector() {\r\n switch (this._upAxis) {\r\n case \"+x\":\r\n this.camera.upVector = new Vector3(1, 0, 0);\r\n break;\r\n case \"-x\":\r\n this.camera.upVector = new Vector3(-1, 0, 0);\r\n break;\r\n case \"+z\":\r\n this.camera.upVector = new Vector3(0, 0, 1);\r\n break;\r\n case \"-z\":\r\n this.camera.upVector = new Vector3(0, 0, -1);\r\n break;\r\n case \"-y\":\r\n this.camera.upVector = new Vector3(0, -1, 0);\r\n break;\r\n case \"+y\":\r\n default:\r\n this.camera.upVector = new Vector3(0, 1, 0);\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Load a visualization from a saved JSON object. The R, JavaScript and Python implementations of babyplots as well as the NPC allow the export of visualizations as JSON files. Loading of a saved visualization using fromJSON() overwrites previously set properties of the Plots object.\r\n * \r\n * @param plotData Javascript Object with plot data.\r\n */\r\n fromJSON(plotData: {}): void {\r\n if (plotData[\"turntable\"] !== undefined) {\r\n this.turntable = plotData[\"turntable\"];\r\n }\r\n if (plotData[\"rotationRate\"] !== undefined) {\r\n this.rotationRate = plotData[\"rotationRate\"];\r\n }\r\n if (plotData[\"backgroundColor\"]) {\r\n this._backgroundColor = plotData[\"backgroundColor\"];\r\n this.scene.clearColor = Color4.FromHexString(this._backgroundColor);\r\n }\r\n if (plotData[\"xScale\"] !== undefined) {\r\n this._xScale = plotData[\"xScale\"];\r\n }\r\n if (plotData[\"yScale\"] !== undefined) {\r\n this._yScale = plotData[\"yScale\"];\r\n }\r\n if (plotData[\"zScale\"] !== undefined) {\r\n this._zScale = plotData[\"zScale\"];\r\n }\r\n if (plotData[\"shapeLegendTitle\"] !== undefined) {\r\n this.shapeLegendTitle = plotData[\"shapeLegendTitle\"];\r\n }\r\n if (plotData[\"upAxis\"] !== undefined) {\r\n this._upAxis = plotData[\"upAxis\"];\r\n this._updateCameraUpVector();\r\n }\r\n for (let plotIdx = 0; plotIdx < plotData[\"plots\"].length; plotIdx++) {\r\n const plot = plotData[\"plots\"][plotIdx];\r\n if (plot[\"plotType\"] === \"imageStack\") {\r\n this.addImgStack(\r\n plot[\"values\"],\r\n plot[\"indices\"],\r\n plot[\"attributes\"],\r\n {\r\n name: plot[\"name\"],\r\n size: plot[\"size\"],\r\n colorScale: plot[\"colorScale\"],\r\n showLegend: plot[\"showLegend\"],\r\n fontSize: plot[\"fontSize\"],\r\n fontColor: plot[\"fontColor\"],\r\n legendTitle: plot[\"legendTitle\"],\r\n legendTitleFontSize: plot[\"legendTitleFontSize\"],\r\n legendTitleFontColor: plot[\"legendTitleFontColor\"],\r\n legendPosition: plot[\"legendPosition\"],\r\n showAxes: plot[\"showAxes\"],\r\n axisLabels: plot[\"axisLabels\"],\r\n axisColors: plot[\"axisColors\"],\r\n tickBreaks: plot[\"tickBreaks\"],\r\n showTickLines: plot[\"showTickLines\"],\r\n tickLineColors: plot[\"tickLineColors\"],\r\n intensityMode: plot[\"intensityMode\"],\r\n channelColors: plot[\"channelColors\"],\r\n channelOpacities: plot[\"channelOpacities\"]\r\n }\r\n )\r\n } else if (plot[\"plotType\"] === \"meshObject\") {\r\n this.addMeshObject(\r\n plot[\"meshString\"],\r\n {\r\n meshScaling: plot[\"meshScaling\"],\r\n meshRotation: plot[\"meshRotation\"],\r\n meshOffset: plot[\"meshOffset\"]\r\n }\r\n )\r\n } else if (plot[\"plotType\"] === \"meshStream\") {\r\n this.addMeshStream(\r\n plot[\"rootUrl\"],\r\n plot[\"filePrefix\"],\r\n plot[\"fileSuffix\"],\r\n plot[\"fileIteratorStart\"],\r\n plot[\"fileIteratorEnd\"],\r\n plot[\"frameDelay\"],\r\n {\r\n meshRotation: plot[\"meshRotation\"],\r\n meshOffset: plot[\"meshOffset\"]\r\n }\r\n )\r\n } else if ([\"pointCloud\", \"heatMap\", \"surface\", \"shapeCloud\"].indexOf(plot[\"plotType\"]) !== -1) {\r\n this.addPlot(\r\n plot[\"coordinates\"],\r\n plot[\"plotType\"],\r\n plot[\"colorBy\"],\r\n plot[\"colorVar\"],\r\n {\r\n name: plot[\"name\"],\r\n size: plot[\"size\"],\r\n colorScale: plot[\"colorScale\"],\r\n customColorScale: plot[\"customColorScale\"],\r\n colorScaleInverted: plot[\"colorScaleInverted\"],\r\n sortedCategories: plot[\"sortedCategories\"],\r\n showLegend: plot[\"showLegend\"],\r\n legendShowShape: plot[\"legendShowShape\"],\r\n fontSize: plot[\"fontSize\"],\r\n fontColor: plot[\"fontColor\"],\r\n legendTitle: plot[\"legendTitle\"],\r\n legendTitleFontSize: plot[\"legendTitleFontSize\"],\r\n legendTitleFontColor: plot[\"legendTitleFontColor\"],\r\n legendPosition: plot[\"legendPosition\"],\r\n showAxes: plot[\"showAxes\"],\r\n axisLabels: plot[\"axisLabels\"],\r\n axisColors: plot[\"axisColors\"],\r\n tickBreaks: plot[\"tickBreaks\"],\r\n showTickLines: plot[\"showTickLines\"],\r\n tickLineColors: plot[\"tickLineColors\"],\r\n hasAnimation: plot[\"hasAnimation\"],\r\n animationTargets: plot[\"animationTargets\"],\r\n animationDelay: plot[\"animationDelay\"],\r\n animationDuration: plot[\"animationDuration\"],\r\n animationLoop: plot[\"animationLoop\"],\r\n folded: plot[\"folded\"],\r\n foldedEmbedding: plot[\"foldedEmbedding\"],\r\n foldAnimDelay: plot[\"foldAnimDelay\"],\r\n foldAnimDuration: plot[\"foldAnimDuration\"],\r\n foldAnimLoop: plot[\"foldAnimLoop\"],\r\n colnames: plot[\"colnames\"],\r\n rownames: plot[\"rownames\"],\r\n shape: plot[\"shape\"],\r\n shading: plot[\"shading\"],\r\n dpInfo: plot[\"dpInfo\"],\r\n addClusterLabels: plot[\"addClusterLabels\"]\r\n }\r\n )\r\n }\r\n }\r\n if (plotData[\"labels\"]) {\r\n this._annotationManager.fixedLabels = true;\r\n let labelData = plotData[\"labels\"];\r\n if (labelData.length > 0) {\r\n if (Array.isArray(labelData[0])) {\r\n this._annotationManager.addLabels(labelData);\r\n } else {\r\n // legacy label saving\r\n for (let i = 0; i < labelData.length; i++) {\r\n const label = labelData[i];\r\n if (label[\"text\"] && label[\"position\"]) {\r\n this._annotationManager.addLabel(label[\"text\"], label[\"position\"]);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n if (plotData[\"cameraAlpha\"] !== undefined) {\r\n this.camera.alpha = plotData[\"cameraAlpha\"];\r\n }\r\n if (plotData[\"cameraBeta\"] !== undefined) {\r\n this.camera.beta = plotData[\"cameraBeta\"];\r\n }\r\n if (plotData[\"cameraRadius\"] !== undefined) {\r\n this.camera.radius = plotData[\"cameraRadius\"];\r\n }\r\n }\r\n\r\n /**\r\n * Create UI buttons to control certain babyplots features.\r\n * \r\n * @param whichBtns Array of buttons to create. Any combination of [\"json\", \"label\", \"publish\", \"record\"] is allowed.\r\n * \r\n * \"json\": creates a button that triggers the download of the plot data in .json file format.\r\n * \r\n * \"label\": creates a button that opens the label manager that allows creation and editing of labels.\r\n * \r\n * \"publish\": creates a button that opens the publish to bp.bleb.li form.\r\n * \r\n * \"record\": creates a button to record the plot as a gif. (Requires inclusion of CCapture.js and its gif.worker.js).\r\n */\r\n createButtons(whichBtns = [\"json\", \"label\", \"publish\", \"record\", \"turntable\"]): void {\r\n if (whichBtns.indexOf(\"turntable\") !== -1) {\r\n let turntableBtn = document.createElement(\"div\");\r\n turntableBtn.className = \"button\";\r\n turntableBtn.onclick = () => this.toggleTurntable();\r\n turntableBtn.innerHTML = buttonSVGs.turntable;\r\n turntableBtn.title = \"Toggle turntable animation.\"\r\n this._buttonBar.appendChild(turntableBtn);\r\n this._turntableBtn = turntableBtn;\r\n if (this.turntable) {\r\n turntableBtn.className = \"button active\";\r\n }\r\n }\r\n if (whichBtns.indexOf(\"json\") !== -1) {\r\n let jsonBtn = document.createElement(\"div\");\r\n jsonBtn.className = \"button\";\r\n jsonBtn.onclick = this._downloadJson.bind(this);\r\n jsonBtn.innerHTML = buttonSVGs.toJson;\r\n jsonBtn.title = \"Download the plot as json file.\";\r\n this._buttonBar.appendChild(jsonBtn);\r\n }\r\n if (whichBtns.indexOf(\"label\") !== -1) {\r\n let labelBtn = document.createElement(\"div\");\r\n labelBtn.className = \"button\";\r\n labelBtn.onclick = this._annotationManager.toggleLabelControl.bind(this._annotationManager);\r\n labelBtn.innerHTML = buttonSVGs.labels;\r\n labelBtn.title = \"Show or hide the label manager.\";\r\n this._buttonBar.appendChild(labelBtn);\r\n }\r\n if (whichBtns.indexOf(\"record\") !== -1) {\r\n let recordBtn = document.createElement(\"div\");\r\n recordBtn.className = \"button\";\r\n recordBtn.onclick = this._startRecording.bind(this);\r\n recordBtn.innerHTML = buttonSVGs.record;\r\n recordBtn.title = \"Record the plot as a gif.\";\r\n this._buttonBar.appendChild(recordBtn);\r\n }\r\n if (whichBtns.indexOf(\"publish\") !== -1) {\r\n let publishBtn = document.createElement(\"div\");\r\n publishBtn.className = \"button\";\r\n publishBtn.onclick = this._createPublishForm.bind(this);\r\n publishBtn.innerHTML = buttonSVGs.publish;\r\n publishBtn.title = \"Publish the plot to bp.bleb.li.\";\r\n this._buttonBar.appendChild(publishBtn);\r\n }\r\n }\r\n\r\n private _prepDownloadObj() {\r\n this._downloadObj[\"turntable\"] = this.turntable;\r\n this._downloadObj[\"rotationRate\"] = this.rotationRate;\r\n this._downloadObj[\"backgroundColor\"] = this._backgroundColor;\r\n this._downloadObj[\"xScale\"] = this._xScale;\r\n this._downloadObj[\"yScale\"] = this._yScale;\r\n this._downloadObj[\"zScale\"] = this._zScale;\r\n this._downloadObj[\"shapeLegendTitle\"] = this.shapeLegendTitle;\r\n this._downloadObj[\"cameraAlpha\"] = this.camera.alpha;\r\n this._downloadObj[\"cameraBeta\"] = this.camera.beta;\r\n this._downloadObj[\"cameraRadius\"] = this.camera.radius;\r\n this._downloadObj[\"labels\"] = this._annotationManager.exportLabels();\r\n this._downloadObj[\"cameraAlpha\"] = this.camera.alpha;\r\n this._downloadObj[\"cameraBeta\"] = this.camera.beta;\r\n this._downloadObj[\"cameraRadius\"] = this.camera.radius;\r\n this._downloadObj[\"upAxis\"] = this._upAxis;\r\n }\r\n\r\n private _downloadJson() {\r\n let dlElement = document.createElement(\"a\");\r\n this._prepDownloadObj();\r\n let dlContent = encodeURIComponent(JSON.stringify(this._downloadObj));\r\n dlElement.setAttribute(\"href\", \"data:text/plain;charset=utf-8,\" + dlContent);\r\n dlElement.setAttribute(\"download\", \"babyplots_export.json\");\r\n dlElement.style.display = \"none\";\r\n document.body.appendChild(dlElement);\r\n dlElement.click();\r\n document.body.removeChild(dlElement);\r\n }\r\n\r\n private _createPublishForm() {\r\n\r\n if (this._publishFormOverlay !== undefined) {\r\n return\r\n }\r\n\r\n let formOverlay = document.createElement(\"div\");\r\n\r\n formOverlay.id = \"publishOverlay_\" + this._uniqID;\r\n formOverlay.style.position = \"absolute\";\r\n let r = this.canvas.getBoundingClientRect();\r\n if (this.Python) {\r\n formOverlay.style.top = \"0px\";\r\n formOverlay.style.left = \"0px\";\r\n formOverlay.style.width = \"100%\";\r\n formOverlay.style.height = \"100%\";\r\n } else {\r\n formOverlay.style.top = r.y + \"px\";\r\n formOverlay.style.left = r.x + \"px\";\r\n formOverlay.style.width = r.width + \"px\";\r\n formOverlay.style.height = r.height + \"px\";\r\n }\r\n formOverlay.style.backgroundColor = \"#ffffff66\";\r\n let formBox = document.createElement(\"div\");\r\n formBox.style.width = \"275px\";\r\n formBox.style.margin = \"42px auto\";\r\n formBox.style.backgroundColor = \"white\";\r\n formBox.style.padding = \"15px 30px\";\r\n formBox.style.borderRadius = \"10px\";\r\n formBox.style.boxShadow = \"0 0 10px #0003\";\r\n formBox.className = \"bbp publish-form\"\r\n formOverlay.appendChild(formBox);\r\n // Upload description text\r\n let formInfo = document.createElement(\"p\");\r\n formInfo.innerText = \"Upload the plot to your account on https://bp.bleb.li. Only you will be able to see it. You can change the access settings in your account.\";\r\n formInfo.className = \"form-info\";\r\n formBox.appendChild(formInfo);\r\n // Inputs and their labels\r\n let usernameLabel = document.createElement(\"label\");\r\n usernameLabel.id = \"publishUsernameLabel_\" + this._uniqID;\r\n usernameLabel.innerText = \"Username:\";\r\n let usernameInput = document.createElement(\"input\");\r\n usernameInput.type = \"text\";\r\n usernameInput.id = \"publishUsername_\" + this._uniqID;\r\n let passwordLabel = document.createElement(\"label\");\r\n passwordLabel.id = \"publishPasswordLabel_\" + this._uniqID;\r\n passwordLabel.innerText = \"Password:\"\r\n let passwordInput = document.createElement(\"input\");\r\n passwordInput.type = \"password\";\r\n passwordInput.id = \"publishPassword_\" + this._uniqID;\r\n let titleLabel = document.createElement(\"label\");\r\n titleLabel.id = \"publishTitleLabel_\" + this._uniqID;\r\n titleLabel.innerText = \"Plot title:\";\r\n let titleInput = document.createElement(\"input\");\r\n titleInput.type = \"text\";\r\n titleInput.id = \"publishTitle_\" + this._uniqID;\r\n // message placeholder\r\n let msg = document.createElement(\"p\");\r\n msg.id = \"publishMessage_\" + this._uniqID;\r\n // Buttons\r\n let publishBtn = document.createElement(\"button\");\r\n publishBtn.className = \"publish-btn\";\r\n publishBtn.id = \"publishBtn_\" + this._uniqID;\r\n publishBtn.onclick = this._tryPublish.bind(this);\r\n publishBtn.innerText = \"Login and publish\";\r\n let cancelBtn = document.createElement(\"button\");\r\n cancelBtn.className = \"cancel-btn\";\r\n cancelBtn.id = \"cancelBtn_\" + this._uniqID;\r\n cancelBtn.onclick = this._cancelPublish.bind(this);\r\n cancelBtn.innerText = \"Cancel\";\r\n let closeBtn = document.createElement(\"button\");\r\n closeBtn.className = \"close-btn\";\r\n closeBtn.id = \"closeBtn_\" + this._uniqID;\r\n closeBtn.onclick = this._cancelPublish.bind(this);\r\n closeBtn.innerText = \"Close\";\r\n closeBtn.style.display = \"none\";\r\n\r\n // Add all form elements to the form\r\n formBox.appendChild(usernameLabel);\r\n formBox.appendChild(usernameInput);\r\n formBox.appendChild(passwordLabel);\r\n formBox.appendChild(passwordInput);\r\n formBox.appendChild(titleLabel);\r\n formBox.appendChild(titleInput);\r\n formBox.appendChild(msg);\r\n formBox.appendChild(publishBtn);\r\n formBox.appendChild(cancelBtn);\r\n formBox.appendChild(closeBtn);\r\n this._publishFormOverlay = formOverlay;\r\n this.canvas.parentNode.appendChild(formOverlay);\r\n }\r\n\r\n private _resizePublishOverlay() {\r\n if (this._publishFormOverlay === undefined) {\r\n return\r\n }\r\n let r = this.canvas.getBoundingClientRect();\r\n this._publishFormOverlay.style.left = r.x + \"px\";\r\n this._publishFormOverlay.style.top = r.y + \"px\";\r\n this._publishFormOverlay.style.width = r.width + \"px\";\r\n this._publishFormOverlay.style.height = r.height + \"px\";\r\n }\r\n\r\n private _tryPublish() {\r\n this.thumbnail(80, (function (thumb_data) {\r\n this._prepDownloadObj();\r\n axios({\r\n method: 'post',\r\n url: 'https://bp.bleb.li/api/publish',\r\n headers: {\r\n 'Content-Type': \"application/json;charset=UTF-8\"\r\n },\r\n data: {\r\n username: (document.getElementById(\"publishUsername_\" + this._uniqID) as HTMLInputElement).value,\r\n password: (document.getElementById(\"publishPassword_\" + this._uniqID) as HTMLInputElement).value,\r\n plotData: JSON.stringify(this._downloadObj),\r\n plotName: (document.getElementById(\"publishTitle_\" + this._uniqID) as HTMLInputElement).value,\r\n thumb: thumb_data\r\n },\r\n\r\n })\r\n .then((function (response) {\r\n let msg = document.getElementById(\"publishMessage_\" + this._uniqID);\r\n msg.innerText = \"Successfully published plot!\";\r\n msg.className = \"message success\";\r\n document.getElementById(\"publishUsername_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"publishUsernameLabel_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"publishPassword_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"publishPasswordLabel_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"publishTitle_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"publishTitleLabel_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"publishBtn_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"cancelBtn_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"closeBtn_\" + this._uniqID).style.display = \"block\";\r\n\r\n }).bind(this))\r\n .catch((function (response) {\r\n if (response.response.data[\"status\"] === \"not authorized\") {\r\n console.log(\"wrong credentials\");\r\n let msg = document.getElementById(\"publishMessage_\" + this._uniqID);\r\n msg.innerText = \"Invalid username or password.\";\r\n msg.className = \"message warning\";\r\n }\r\n console.log(response);\r\n }).bind(this))\r\n }).bind(this));\r\n }\r\n\r\n private _cancelPublish() {\r\n this._publishFormOverlay.remove();\r\n this._publishFormOverlay = undefined;\r\n }\r\n\r\n private _resetAnimation() {\r\n this._hasAnim = true;\r\n for (let idx = 0; idx < this.plots.length; idx++) {\r\n this.plots[idx].resetAnimation();\r\n }\r\n let boundingBox = this.plots[0].mesh.getBoundingInfo().boundingBox;\r\n let rangeX = [\r\n boundingBox.minimumWorld.x,\r\n boundingBox.maximumWorld.x\r\n ]\r\n let rangeY = [\r\n boundingBox.minimumWorld.y,\r\n boundingBox.maximumWorld.y\r\n ]\r\n let rangeZ = [\r\n boundingBox.minimumWorld.z,\r\n boundingBox.maximumWorld.z\r\n ]\r\n this._axes[0].axisData.range = [rangeX, rangeY, rangeZ]\r\n this._axes[0].update(this.camera, true);\r\n }\r\n\r\n pauseAnimation() {\r\n this.animPaused = true;\r\n this._streamControlBtn.className = \"button streamctrl play\";\r\n }\r\n\r\n playAnimation() {\r\n this.animPaused = false;\r\n this._streamControlBtn.className = \"button streamctrl pause\";\r\n }\r\n\r\n toggleTurntable() {\r\n this.turntable = !this.turntable;\r\n if (this.turntable) {\r\n this._turntableBtn.className = \"button active\";\r\n } else {\r\n this._turntableBtn.className = \"button\";\r\n }\r\n }\r\n\r\n setAnimationFrame() {\r\n for (let idx = 0; idx < this.plots.length; idx++) {\r\n const animPlot = this.plots[idx];\r\n if (animPlot.allLoaded) {\r\n animPlot.goToFrame(parseInt(this._animationSlider.value));\r\n }\r\n }\r\n }\r\n\r\n private _toggleLoopAnimation() {\r\n if (this._loopingAnim) {\r\n this._loopingAnim = false;\r\n for (let idx = 0; idx < this.plots.length; idx++) {\r\n this.plots[idx].setLooping(false);\r\n }\r\n this._loopBtn.className = \"button\";\r\n } else {\r\n this._loopingAnim = true;\r\n for (let idx = 0; idx < this.plots.length; idx++) {\r\n this.plots[idx].setLooping(true);\r\n }\r\n this._loopBtn.className = \"button active\";\r\n }\r\n if (!this._hasAnim) {\r\n this._resetAnimation();\r\n }\r\n\r\n }\r\n\r\n private _startRecording() {\r\n this._recording = true;\r\n }\r\n\r\n /**\r\n * Register before render\r\n */\r\n private _prepRender(): void {\r\n // rotate camera around plot if turntable is true\r\n if (this.turntable) {\r\n this.camera.alpha += this.rotationRate;\r\n }\r\n // update plots with animations\r\n if (this._hasAnim && !this.animPaused) {\r\n let anyAnim = false;\r\n for (let idx = 0; idx < this.plots.length; idx++) {\r\n const animPlot = this.plots[idx];\r\n let animState = animPlot.update();\r\n if (animState) {\r\n anyAnim = true;\r\n if (animPlot.allLoaded && this._streamControlBtn.className === \"button streamctrl loading\") {\r\n this._streamControlBtn.className = \"button streamctrl pause\";\r\n this._animationSlider.disabled = false;\r\n }\r\n if (animPlot.hasOwnProperty(\"frameIndex\")) {\r\n this._animationSlider.value = (animPlot as MeshStream).frameIndex.toString();\r\n }\r\n }\r\n }\r\n this._hasAnim = anyAnim;\r\n if (!this._hasAnim) {\r\n let boundingBox = this.plots[0].mesh.getBoundingInfo().boundingBox;\r\n let rangeX = [\r\n boundingBox.minimumWorld.x,\r\n boundingBox.maximumWorld.x\r\n ]\r\n let rangeY = [\r\n boundingBox.minimumWorld.y,\r\n boundingBox.maximumWorld.y\r\n ]\r\n let rangeZ = [\r\n boundingBox.minimumWorld.z,\r\n boundingBox.maximumWorld.z\r\n ]\r\n this._axes[0].axisData.range = [rangeX, rangeY, rangeZ]\r\n this._axes[0].update(this.camera, true);\r\n }\r\n }\r\n // update axis drawing\r\n if (this._axes) {\r\n for (let i = 0; i < this._axes.length; i++) {\r\n this._axes[i].update(this.camera);\r\n }\r\n }\r\n\r\n if (this._fsUIDirty) {\r\n // create fullscreen GUI texture\r\n this.uiLayer = AdvancedDynamicTexture.CreateFullscreenUI(\"UI\", true, this.scene);\r\n this._updateLegend(this.uiLayer);\r\n this._annotationManager.redrawInfo();\r\n this._fsUIDirty = false;\r\n }\r\n\r\n // update labels\r\n this._annotationManager.update();\r\n\r\n // for (let pltIdx = 0; pltIdx < this.plots.length; pltIdx++) {\r\n // const plot = this.plots[pltIdx];\r\n // plot.update(); \r\n // }\r\n // if (this._mouseOverCheck) {\r\n // const pickResult = this._scene.pick(this._scene.pointerX, this._scene.pointerY);\r\n // const faceId = pickResult.faceId;\r\n // if (faceId == -1) {\r\n // return;\r\n // }\r\n // const idx = this._SPS.pickedParticles[faceId].idx;\r\n // this._mouseOverCallback(idx);\r\n // }\r\n }\r\n\r\n\r\n private _afterRender(): void {\r\n if (this._recording) {\r\n // start recording:\r\n if (this._turned === 0) {\r\n let worker = \"./\";\r\n if (this.R) {\r\n worker = \"lib/babyplots-1/\";\r\n }\r\n this._capturer = new CCapture({\r\n format: \"gif\",\r\n framerate: 30,\r\n verbose: false,\r\n display: false,\r\n quality: 50,\r\n workersPath: worker\r\n });\r\n // create capturer, enable turning\r\n this._capturer.start();\r\n this.rotationRate = 0.02;\r\n // to return turntable option to its initial state after recording\r\n if (this.turntable) {\r\n this._wasTurning = true;\r\n } else {\r\n this.turntable = true;\r\n }\r\n let loadingOverlay = document.createElement(\"div\");\r\n loadingOverlay.className = \"bbp overlay\";\r\n loadingOverlay.id = \"GIFloadingOverlay_\" + this._uniqID;\r\n let loadingText = document.createElement(\"h5\");\r\n loadingText.className = \".loading-message\";\r\n loadingText.innerText = \"Recording GIF...\";\r\n loadingText.id = \"GIFloadingText_\" + this._uniqID;\r\n loadingOverlay.appendChild(loadingText);\r\n this.canvas.parentNode.appendChild(loadingOverlay);\r\n }\r\n // recording in progress:\r\n if (this._turned < 2 * Math.PI) {\r\n // while recording, count rotation and capture screenshots\r\n this._turned += this.rotationRate;\r\n this._capturer.capture(this.canvas);\r\n } else {\r\n // after capturing 360°, stop capturing and save gif\r\n this._recording = false;\r\n this._capturer.stop();\r\n let loadingText = document.getElementById(\"GIFloadingText_\" + this._uniqID);\r\n loadingText.innerText = \"Saving GIF...\";\r\n this._capturer.save((function (blob) {\r\n download(blob, \"babyplots.gif\", 'image/gif');\r\n document.getElementById(\"GIFloadingText_\" + this._uniqID).remove();\r\n document.getElementById(\"GIFloadingOverlay_\" + this._uniqID).remove();\r\n }).bind(this));\r\n this._turned = 0;\r\n this.rotationRate = 0.01;\r\n this._hl2.diffuse = new Color3(0.8, 0.8, 0.8);\r\n if (!this._wasTurning) {\r\n this.turntable = false;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Zoom camera to fit the complete SPS into the field of view\r\n */\r\n private _cameraFitPlot(xRange: number[], yRange: number[], zRange: number[]): void {\r\n let xSize = xRange[1] - xRange[0];\r\n let ySize = yRange[1] - yRange[0];\r\n let zSize = zRange[1] - zRange[0];\r\n let box = BoxBuilder.CreateBox('bdbx', {\r\n width: xSize, height: ySize, depth: zSize\r\n }, this.scene);\r\n let xCenter = xRange[1] - xSize / 2;\r\n let yCenter = yRange[1] - ySize / 2;\r\n let zCenter = zRange[1] - zSize / 2;\r\n box.position = new Vector3(xCenter, yCenter, zCenter);\r\n this.camera.position = new Vector3(xCenter, ySize, zCenter);\r\n this.camera.target = new Vector3(xCenter, yCenter, zCenter);\r\n let radius = box.getBoundingInfo().boundingSphere.radiusWorld;\r\n let aspectRatio = this._engine.getAspectRatio(this.camera);\r\n let halfMinFov = this.camera.fov / 2;\r\n if (aspectRatio < 1) {\r\n halfMinFov = Math.atan(aspectRatio * Math.tan(this.camera.fov / 2));\r\n }\r\n let viewRadius = Math.abs(radius / Math.sin(halfMinFov));\r\n this.camera.radius = viewRadius;\r\n box.dispose();\r\n this.camera.alpha = 0;\r\n this.camera.beta = 1; // 0 is top view, Pi is bottom\r\n this.ymax = yRange[1];\r\n }\r\n\r\n /**\r\n * Creates a 3-dimensional visualization of an RGB image stack, as generated from e.g. a fluorescent microscope, and adds it to the Plots object to visualize it in a canvas. The data must be in a special format for this function which is optimized for size. The easiest way to create this visualization is using the R implementation of babyplots, which includes a function to directly read .tif files.\r\n * \r\n * @param values An array of intensity values. Currently only 8-bit images are supported (0-255).\r\n * @param indices Indices of the values in the original image.\r\n * @param attributes Image attributes. Only a \"dim\" attribute is needed containing the dimensions (x, y, c, z) of the image.\r\n * @param options An object with options to customize the visualization.\r\n * \r\n * Find a list of possible options [here](https://bp.bleb.li/documentation/js#addImgStack).\r\n */\r\n addImgStack(\r\n values: number[],\r\n indices: number[],\r\n attributes: { dim: number[] },\r\n options: {}\r\n ) {\r\n // default options\r\n let opts = {\r\n size: 1,\r\n colorScale: null,\r\n showLegend: false,\r\n fontSize: 11,\r\n fontColor: \"black\",\r\n legendTitle: null,\r\n legendTitleFontSize: 16,\r\n legendTitleFontColor: \"black\",\r\n legendPosition: null,\r\n showAxes: [false, false, false],\r\n axisLabels: [\"X\", \"Y\", \"Z\"],\r\n axisColors: [\"#666666\", \"#666666\", \"#666666\"],\r\n tickBreaks: [2, 2, 2],\r\n showTickLines: [[false, false], [false, false], [false, false]],\r\n tickLineColors: [[\"#aaaaaa\", \"#aaaaaa\"], [\"#aaaaaa\", \"#aaaaaa\"], [\"#aaaaaa\", \"#aaaaaa\"]],\r\n intensityMode: \"alpha\",\r\n channelColors: [\"#ff0000\", \"#00ff00\", \"#0000ff\"],\r\n channelOpacities: [1, 1, 1]\r\n }\r\n // apply user options\r\n Object.assign(opts, options);\r\n // prepare object for download as json button\r\n this._downloadObj[\"plots\"].push({\r\n plotType: \"imageStack\",\r\n values: values,\r\n indices: indices,\r\n attributes: attributes,\r\n size: opts.size,\r\n colorScale: opts.colorScale,\r\n showLegend: opts.showLegend,\r\n fontSize: opts.fontSize,\r\n fontColor: opts.fontColor,\r\n legendTitle: opts.legendTitle,\r\n legendTitleFontSize: opts.legendTitleFontSize,\r\n legendTitleFontColor: opts.legendTitleFontColor,\r\n legendPosition: opts.legendPosition,\r\n showAxes: opts.showAxes,\r\n axisLabels: opts.axisLabels,\r\n axisColors: opts.axisColors,\r\n tickBreaks: opts.tickBreaks,\r\n showTickLines: opts.showTickLines,\r\n tickLineColors: opts.tickLineColors,\r\n intensityMode: opts.intensityMode,\r\n channelColors: opts.channelColors,\r\n channelOpacities: [1, 1, 1]\r\n })\r\n let legendData: LegendData = {\r\n showLegend: false,\r\n discrete: false,\r\n breaks: [],\r\n colorScale: \"\",\r\n inverted: false,\r\n position: opts.legendPosition\r\n }\r\n legendData.fontSize = opts.fontSize;\r\n legendData.fontColor = opts.fontColor;\r\n legendData.legendTitle = opts.legendTitle;\r\n legendData.legendTitleFontSize = opts.legendTitleFontSize;\r\n legendData.legendTitleFontColor = opts.legendTitleFontColor;\r\n\r\n let plot = new ImgStack(\r\n this.scene,\r\n values,\r\n indices,\r\n attributes,\r\n legendData,\r\n opts.size,\r\n this._backgroundColor,\r\n opts.intensityMode,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n opts.channelColors,\r\n opts.channelOpacities\r\n );\r\n this.plots.push(plot);\r\n this._updateLegend(this.uiLayer);\r\n this._cameraFitPlot([0, attributes.dim[2]], [0, attributes.dim[0]], [0, attributes.dim[1]]);\r\n this.camera.wheelPrecision = 1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Creates a plot and adds it to the Plots object to visualize it in a canvas. The plot types section below enumerates the different kinds of visualizations that can be created using this method.\r\n * \r\n * @param coordinates An array of arrays with coordinates of data points.\r\n * @param plotType The name of one of the plot types. Either \"pointCloud\", \"heatMap\", or \"surface\".\r\n * @param colorBy How to interpret the colorVar parameter, either \"direct\", \"categories\", or \"values\". If colorVar is an array of hex strings, colorBy should be \"direct\". If colorVar is an array of discrete values (e.g. category names), colorBy should be \"categories\". If colorVar is an array of continuous values, colorBy should be \"values\".\r\n * @param colorVar an array of hex strings, category names, or values, corresponding to the data points in the coordinates parameter.\r\n * @param options An object with general and plot type specific options.\r\n * \r\n * Find a list of possible options [here](https://bp.bleb.li/documentation/js#addPlot).\r\n */\r\n addPlot(\r\n coordinates: number[][],\r\n plotType: string,\r\n colorBy: string,\r\n colorVar: string[] | number[],\r\n options = {}\r\n ): Plots {\r\n // default options\r\n let opts = {\r\n name: null,\r\n size: 1,\r\n xScale: 1,\r\n yScale: 1,\r\n zScale: 1,\r\n colorScale: \"Oranges\",\r\n customColorScale: [],\r\n colorScaleInverted: false,\r\n sortedCategories: [],\r\n showLegend: false,\r\n fontSize: 11,\r\n fontColor: \"black\",\r\n legendTitle: null,\r\n legendTitleFontSize: 16,\r\n legendTitleFontColor: \"black\",\r\n legendPosition: null,\r\n legendShowShape: false,\r\n showAxes: [false, false, false],\r\n axisLabels: [\"X\", \"Y\", \"Z\"],\r\n axisColors: [\"#666666\", \"#666666\", \"#666666\"],\r\n tickBreaks: [2, 2, 2],\r\n showTickLines: [[false, false], [false, false], [false, false]],\r\n tickLineColors: [[\"#aaaaaa\", \"#aaaaaa\"], [\"#aaaaaa\", \"#aaaaaa\"], [\"#aaaaaa\", \"#aaaaaa\"]],\r\n hasAnimation: false,\r\n animationTargets: null,\r\n animationDelay: null,\r\n animationDuration: null,\r\n animationLoop: false,\r\n foldAnimLoop: null,\r\n colnames: null,\r\n rownames: null,\r\n shape: null,\r\n shading: true,\r\n dpInfo: null,\r\n addClusterLabels: false,\r\n labels: null,\r\n labelSize: undefined,\r\n labelColor: undefined,\r\n // deprecated animation option names:\r\n folded: null,\r\n foldedEmbedding: null,\r\n foldAnimDelay: null,\r\n foldAnimDuration: null,\r\n }\r\n // apply user options\r\n Object.assign(opts, options);\r\n // warnings for deprecated animation option names\r\n // keeping these for a while to not break compatibility, but suggest using the new option names\r\n if (opts.folded) {\r\n deprecationWarning(\"folded\", \"hasAnimation\");\r\n if (!opts.hasAnimation) {\r\n opts.hasAnimation = opts.folded;\r\n }\r\n }\r\n if (opts.foldedEmbedding) {\r\n deprecationWarning(\"foldedEmbedding\", \"animationTargets\");\r\n if (!opts.animationTargets) {\r\n opts.animationTargets = opts.foldedEmbedding;\r\n }\r\n }\r\n if (opts.foldAnimDelay) {\r\n deprecationWarning(\"foldAnimDelay\", \"animationDelay\");\r\n if (!opts.animationDelay) {\r\n opts.animationDelay = opts.foldAnimDelay;\r\n }\r\n }\r\n if (opts.foldAnimDuration) {\r\n deprecationWarning(\"foldAnimDuration\", \"animationDuration\");\r\n if (!opts.animationDuration) {\r\n opts.animationDuration = opts.foldAnimDuration;\r\n }\r\n }\r\n if (opts.foldAnimLoop) {\r\n deprecationWarning(\"foldAnimLoop\", \"animationLoop\");\r\n if (!opts.animationLoop) {\r\n opts.animationLoop = opts.foldAnimLoop;\r\n }\r\n }\r\n // create plot data object for download as json button\r\n this._downloadObj[\"plots\"].push({\r\n plotType: plotType,\r\n coordinates: coordinates,\r\n colorBy: colorBy,\r\n colorVar: colorVar,\r\n name: opts.name,\r\n size: opts.size,\r\n colorScale: opts.colorScale,\r\n customColorScale: opts.customColorScale,\r\n colorScaleInverted: opts.colorScaleInverted,\r\n sortedCategories: opts.sortedCategories,\r\n showLegend: opts.showLegend,\r\n fontSize: opts.fontSize,\r\n fontColor: opts.fontColor,\r\n legendTitle: opts.legendTitle,\r\n legendTitleFontSize: opts.legendTitleFontSize,\r\n legendTitleFontColor: opts.legendTitleFontColor,\r\n legendPosition: opts.legendPosition,\r\n legendShowShape: opts.legendShowShape,\r\n showAxes: opts.showAxes,\r\n axisLabels: opts.axisLabels,\r\n axisColors: opts.axisColors,\r\n tickBreaks: opts.tickBreaks,\r\n showTickLines: opts.showTickLines,\r\n tickLineColors: opts.tickLineColors,\r\n hasAnimation: opts.hasAnimation,\r\n animationTargets: opts.animationTargets,\r\n animationDelay: opts.animationDelay,\r\n animationDuration: opts.animationDuration,\r\n animationLoop: opts.animationLoop,\r\n colnames: opts.colnames,\r\n rownames: opts.rownames,\r\n shape: opts.shape,\r\n shading: opts.shading,\r\n dpInfo: opts.dpInfo,\r\n addClusterLabels: opts.addClusterLabels,\r\n labels: opts.labels,\r\n labelSize: opts.labelSize,\r\n labelColor: opts.labelColor\r\n })\r\n\r\n let coordColors: string[] = [];\r\n var legendData: LegendData;\r\n let rangeX: number[];\r\n let rangeY: number[];\r\n let rangeZ: number[];\r\n this._hasAnim = opts.hasAnimation;\r\n if (opts.hasAnimation) {\r\n let replayBtn = document.createElement(\"div\");\r\n replayBtn.className = \"button\"\r\n replayBtn.innerHTML = buttonSVGs.replay;\r\n replayBtn.onclick = this._resetAnimation.bind(this);\r\n this._buttonBar.appendChild(replayBtn);\r\n let loopBtn = document.createElement(\"div\");\r\n if (opts.animationLoop) {\r\n loopBtn.className = \"button active\"\r\n } else {\r\n loopBtn.className = \"button\"\r\n }\r\n loopBtn.innerHTML = buttonSVGs.loop;\r\n loopBtn.onclick = this._toggleLoopAnimation.bind(this);\r\n this._buttonBar.appendChild(loopBtn);\r\n this._loopBtn = loopBtn;\r\n }\r\n\r\n switch (colorBy) {\r\n case \"categories\":\r\n // color plot by discrete categories\r\n let groups = colorVar as string[];\r\n let uniqueGroups = getUniqueVals(groups);\r\n // sortedCategories can contain an array of category names to order the groups for coloring.\r\n // sortedCategories must be of same length as unique groups in colorVar.\r\n // if no custom ordering is performed through sortedCategories, groups will be sorted alphabetically.\r\n uniqueGroups.sort();\r\n if (opts.sortedCategories) {\r\n if (uniqueGroups.length === opts.sortedCategories.length) {\r\n // sortedCategories must contain the same category names as those present in colorVar.\r\n if (JSON.stringify(uniqueGroups) === JSON.stringify(opts.sortedCategories.slice(0).sort())) {\r\n uniqueGroups = opts.sortedCategories;\r\n }\r\n }\r\n }\r\n let nColors = uniqueGroups.length;\r\n // Paired is default color scale for discrete variable coloring\r\n let colors = chroma.scale(chroma.brewer.Paired).mode('lch').colors(nColors);\r\n // check if color scale should be custom\r\n if (opts.colorScale === \"custom\") {\r\n if (opts.customColorScale !== undefined && opts.customColorScale.length !== 0) {\r\n if (opts.colorScaleInverted) {\r\n colors = chroma.scale(opts.customColorScale).domain([1, 0]).mode('lch').colors(nColors);\r\n } else {\r\n colors = chroma.scale(opts.customColorScale).mode('lch').colors(nColors);\r\n }\r\n } else {\r\n // set colorScale variable to default for legend if custom color scale is invalid\r\n opts.colorScale = \"Paired\";\r\n }\r\n } else {\r\n // check if user selected color scale is a valid chromajs color brewer name\r\n if (opts.colorScale && chroma.brewer.hasOwnProperty(opts.colorScale)) {\r\n if (opts.colorScaleInverted) {\r\n colors = chroma.scale(chroma.brewer[opts.colorScale]).domain([1, 0]).mode('lch').colors(nColors);\r\n } else {\r\n colors = chroma.scale(chroma.brewer[opts.colorScale]).mode('lch').colors(nColors);\r\n }\r\n } else {\r\n // set colorScale variable to default for legend if user selected is not valid\r\n opts.colorScale = \"Paired\";\r\n }\r\n }\r\n for (let i = 0; i < nColors; i++) {\r\n colors[i] += \"ff\";\r\n }\r\n // apply colors to plot points\r\n for (let i = 0; i < colorVar.length; i++) {\r\n let colorIndex = uniqueGroups.indexOf(groups[i]);\r\n coordColors.push(colors[colorIndex]);\r\n }\r\n // prepare object for legend drawing\r\n legendData = {\r\n showLegend: opts.showLegend,\r\n discrete: true,\r\n breaks: uniqueGroups,\r\n colorScale: opts.colorScale,\r\n customColorScale: opts.customColorScale,\r\n inverted: false,\r\n position: opts.legendPosition\r\n }\r\n break;\r\n case \"values\":\r\n // color by a continuous variable\r\n let min = colorVar.min();\r\n let max = colorVar.max();\r\n // Oranges is default color scale for continuous variable coloring\r\n let colorfunc = chroma.scale(chroma.brewer.Oranges).mode('lch');\r\n // check if color scale should be custom\r\n if (opts.colorScale === \"custom\") {\r\n // check if custom color scale is valid\r\n if (opts.customColorScale !== undefined && opts.customColorScale.length !== 0) {\r\n if (opts.colorScaleInverted) {\r\n colorfunc = chroma.scale(opts.customColorScale).domain([1, 0]).mode('lch');\r\n } else {\r\n colorfunc = chroma.scale(opts.customColorScale).mode('lch');\r\n }\r\n } else {\r\n // set colorScale variable to default for legend if custom color scale is invalid\r\n opts.colorScale = \"Oranges\";\r\n }\r\n } else {\r\n // check if user selected color scale is a valid chromajs color brewer name\r\n if (opts.colorScale && chroma.brewer.hasOwnProperty(opts.colorScale)) {\r\n if (opts.colorScaleInverted) {\r\n colorfunc = chroma.scale(chroma.brewer[opts.colorScale]).domain([1, 0]).mode('lch');\r\n } else {\r\n colorfunc = chroma.scale(chroma.brewer[opts.colorScale]).mode('lch');\r\n }\r\n } else {\r\n // set colorScale variable to default for legend if user selected is not valid\r\n opts.colorScale = \"Oranges\";\r\n }\r\n }\r\n // normalize the values to 0-1 range\r\n let norm = (colorVar as number[]).slice().map(v => (v - min) / (max - min));\r\n // apply colors to plot points\r\n coordColors = norm.map(v => colorfunc(v).alpha(1).hex(\"rgba\"));\r\n // prepare object for legend drawing\r\n legendData = {\r\n showLegend: opts.showLegend,\r\n discrete: false,\r\n breaks: [min.toString(), max.toString()],\r\n colorScale: opts.colorScale,\r\n customColorScale: opts.customColorScale,\r\n inverted: opts.colorScaleInverted,\r\n position: opts.legendPosition\r\n }\r\n break;\r\n case \"direct\":\r\n // color by color hex strings in colorVar\r\n for (let i = 0; i < colorVar.length; i++) {\r\n let cl = colorVar[i];\r\n cl = chroma(cl).hex();\r\n if (cl.length == 7) {\r\n cl += \"ff\";\r\n }\r\n coordColors.push(cl);\r\n }\r\n // prepare object for legend drawing\r\n legendData = {\r\n showLegend: false,\r\n discrete: false,\r\n breaks: [],\r\n colorScale: \"\",\r\n customColorScale: opts.customColorScale,\r\n inverted: false,\r\n position: opts.legendPosition\r\n }\r\n break;\r\n }\r\n // add remaining properties to legend object\r\n legendData.fontSize = opts.fontSize;\r\n legendData.fontColor = opts.fontColor;\r\n legendData.legendTitle = opts.legendTitle;\r\n legendData.legendTitleFontSize = opts.legendTitleFontSize;\r\n legendData.legendTitleFontColor = opts.legendTitleFontColor;\r\n legendData.showShape = opts.legendShowShape;\r\n\r\n let plot: Plot;\r\n let scale: number[];\r\n let boundingBox: BoundingBox;\r\n switch (plotType) {\r\n case \"pointCloud\":\r\n plot = new PointCloud(\r\n this.scene,\r\n coordinates,\r\n coordColors,\r\n opts.size,\r\n legendData,\r\n opts.hasAnimation,\r\n opts.animationTargets,\r\n opts.animationDelay,\r\n opts.animationDuration,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n opts.name,\r\n opts.addClusterLabels,\r\n this._annotationManager\r\n );\r\n boundingBox = plot.mesh.getBoundingInfo().boundingBox;\r\n rangeX = [\r\n boundingBox.minimumWorld.x,\r\n boundingBox.maximumWorld.x\r\n ]\r\n rangeY = [\r\n boundingBox.minimumWorld.y,\r\n boundingBox.maximumWorld.y\r\n ]\r\n rangeZ = [\r\n boundingBox.minimumWorld.z,\r\n boundingBox.maximumWorld.z\r\n ]\r\n scale = [\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n ]\r\n break;\r\n case \"surface\":\r\n plot = new Surface(\r\n this.scene,\r\n coordinates,\r\n coordColors,\r\n opts.size,\r\n legendData,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n opts.name\r\n );\r\n rangeX = [0, coordinates.length * this._xScale];\r\n rangeZ = [0, coordinates[0].length * this._zScale];\r\n rangeY = [\r\n matrixMin(coordinates) * this._yScale,\r\n matrixMax(coordinates) * this._yScale\r\n ];\r\n scale = [\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n ]\r\n break\r\n case \"shapeCloud\":\r\n plot = new ShapeCloud(\r\n this.scene,\r\n coordinates,\r\n coordColors,\r\n opts.shape,\r\n opts.shading,\r\n opts.size,\r\n legendData,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n opts.name,\r\n opts.dpInfo\r\n );\r\n boundingBox = plot.mesh.getBoundingInfo().boundingBox;\r\n rangeX = [\r\n boundingBox.minimumWorld.x,\r\n boundingBox.maximumWorld.x\r\n ]\r\n rangeY = [\r\n boundingBox.minimumWorld.y,\r\n boundingBox.maximumWorld.y\r\n ]\r\n rangeZ = [\r\n boundingBox.minimumWorld.z,\r\n boundingBox.maximumWorld.z\r\n ]\r\n scale = [\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n ]\r\n break;\r\n case \"heatMap\":\r\n plot = new HeatMap(\r\n this.scene,\r\n coordinates,\r\n coordColors,\r\n opts.size,\r\n legendData,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n opts.name\r\n );\r\n rangeX = [0, coordinates.length * this._xScale];\r\n rangeZ = [0, coordinates[0].length * this._zScale];\r\n rangeY = [\r\n matrixMin(coordinates) * this._yScale,\r\n matrixMax(coordinates) * this._yScale\r\n ];\r\n scale = [\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n ]\r\n break\r\n case \"line\":\r\n plot = new Line(\r\n this.scene,\r\n coordinates,\r\n coordColors,\r\n opts.size,\r\n legendData,\r\n opts.hasAnimation,\r\n opts.animationDelay,\r\n opts.animationDuration,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n opts.name,\r\n opts.labels,\r\n opts.labelSize,\r\n opts.labelColor,\r\n this._annotationManager\r\n )\r\n boundingBox = plot.mesh.getBoundingInfo().boundingBox;\r\n rangeX = [\r\n boundingBox.minimumWorld.x,\r\n boundingBox.maximumWorld.x\r\n ]\r\n rangeY = [\r\n boundingBox.minimumWorld.y,\r\n boundingBox.maximumWorld.y\r\n ]\r\n rangeZ = [\r\n boundingBox.minimumWorld.z,\r\n boundingBox.maximumWorld.z\r\n ]\r\n scale = [\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n ]\r\n break;\r\n }\r\n\r\n if (opts.animationLoop) {\r\n this._loopingAnim = true;\r\n plot.setLooping(true);\r\n }\r\n this.plots.push(plot);\r\n this._fsUIDirty = true;\r\n let axisData: AxisData = {\r\n showAxes: opts.showAxes,\r\n static: true,\r\n axisLabels: opts.axisLabels,\r\n range: [rangeX, rangeY, rangeZ],\r\n color: opts.axisColors,\r\n scale: scale,\r\n tickBreaks: opts.tickBreaks,\r\n showTickLines: opts.showTickLines,\r\n tickLineColor: opts.tickLineColors,\r\n showPlanes: [false, false, false],\r\n planeColor: [\"#cccccc88\", \"#cccccc88\", \"#cccccc88\"],\r\n plotType: plotType,\r\n colnames: opts.colnames,\r\n rownames: opts.rownames\r\n }\r\n this._axes.push(new Axes(axisData, this.scene, plotType == \"heatMap\"));\r\n this._cameraFitPlot(rangeX, rangeY, rangeZ);\r\n return this\r\n }\r\n\r\n /**\r\n * \r\n * @param meshString A glTF object string\r\n * @param options An object with general and plot type specific options.\r\n * \r\n * Find a list of possible options [here](https://bp.bleb.li/documentation/js#addMeshStream).\r\n */\r\n addMeshObject(\r\n meshString: string,\r\n options: {}\r\n ): Plots {\r\n // default options\r\n let opts = {\r\n meshScaling: [1, 1, 1],\r\n meshRotation: [0, 0, 0],\r\n meshOffset: [0, 0, 0]\r\n }\r\n // apply user options\r\n Object.assign(opts, options);\r\n // prepare object for download as json button\r\n this._downloadObj[\"plots\"].push({\r\n plotType: \"meshObject\",\r\n meshString: meshString,\r\n meshScaling: opts.meshScaling,\r\n meshRotation: opts.meshRotation,\r\n meshOffset: opts.meshOffset\r\n });\r\n\r\n let legendData: LegendData = {\r\n showLegend: false,\r\n discrete: false,\r\n breaks: [],\r\n colorScale: \"\",\r\n inverted: false,\r\n position: undefined\r\n };\r\n\r\n let plot = new MeshObject(\r\n this.scene,\r\n meshString,\r\n legendData,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n opts.meshScaling,\r\n opts.meshRotation,\r\n opts.meshOffset\r\n );\r\n\r\n this.plots.push(plot);\r\n return this\r\n }\r\n\r\n /**\r\n * Streams meshes from a url and displays them sequentially.\r\n * \r\n * @param rootUrl \r\n * @param filePrefix \r\n * @param fileSuffix \r\n * @param fileIteratorStart \r\n * @param fileIteratorEnd \r\n * @param options An object with general and plot type specific options.\r\n * \r\n * Find a list of possible options [here](https://bp.bleb.li/documentation/js#addMeshStream).\r\n */\r\n addMeshStream(\r\n rootUrl: string,\r\n filePrefix: string,\r\n fileSuffix: string,\r\n fileIteratorStart: number,\r\n fileIteratorEnd: number,\r\n frameDelay: number,\r\n options: {}\r\n ): Plots {\r\n // default options\r\n let opts = {\r\n meshRotation: [0, 0, 0],\r\n meshOffset: [0, 0, 0],\r\n clearCoat: false,\r\n clearCoatIntensity: 1,\r\n }\r\n // apply user options\r\n Object.assign(opts, options);\r\n // prepare object for download as json button\r\n this._downloadObj[\"plots\"].push({\r\n plotType: \"meshStream\",\r\n rootUrl: rootUrl,\r\n filePrefix: filePrefix,\r\n fileSuffix: fileSuffix,\r\n fileIteratorStart: fileIteratorStart,\r\n fileIteratorEnd: fileIteratorEnd,\r\n frameDelay: frameDelay,\r\n meshRotation: opts.meshRotation,\r\n meshOffset: opts.meshOffset,\r\n clearCoat: opts.clearCoat,\r\n clearCoatIntensity: opts.clearCoatIntensity\r\n });\r\n\r\n let legendData: LegendData = {\r\n showLegend: false,\r\n discrete: false,\r\n breaks: [],\r\n colorScale: \"\",\r\n inverted: false,\r\n position: undefined\r\n };\r\n\r\n let plot = new MeshStream(\r\n this.scene,\r\n rootUrl,\r\n filePrefix,\r\n fileSuffix,\r\n fileIteratorStart,\r\n fileIteratorEnd,\r\n legendData,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n frameDelay,\r\n opts.meshRotation,\r\n opts.meshOffset,\r\n opts.clearCoat,\r\n opts.clearCoatIntensity\r\n );\r\n this._hasAnim = true;\r\n this.plots.push(plot);\r\n // this._updateLegend(this.uiLayer);\r\n // this._cameraFitPlot([0, attributes.dim[2]], [0, attributes.dim[0]], [0, attributes.dim[1]]);\r\n this.camera.wheelPrecision = 1;\r\n\r\n this._streamControlBtn.className = \"button streamctrl loading\";\r\n this._animationSlider.max = (plot.frameTotal - 1).toString();\r\n this._animationSlider.className = \"anim-slider\";\r\n\r\n // let replayBtn = document.createElement(\"div\");\r\n // replayBtn.className = \"button\"\r\n // replayBtn.innerHTML = buttonSVGs.replay;\r\n // replayBtn.onclick = this._resetAnimation.bind(this);\r\n // let loopBtn = document.createElement(\"div\");\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Creates a color legend for the plots\r\n */\r\n private _updateLegend(uiLayer: AdvancedDynamicTexture): void {\r\n if (this._legend) { this._legend.dispose(); }\r\n\r\n let rightFree = true;\r\n let leftFree = true;\r\n let spaceLeft: number;\r\n let spaceRight: number;\r\n let shapeSpace = 0;\r\n let shapes = [];\r\n for (let i = 0; i < this.plots.length; i++) {\r\n const plot = this.plots[i];\r\n let legendData = plot.legendData;\r\n if (!legendData.legendTitleFontSize) {\r\n legendData.legendTitleFontSize = 16;\r\n }\r\n if (!legendData.fontSize) {\r\n legendData.fontSize = 12;\r\n }\r\n if ([\"right\", \"left\"].indexOf(legendData.position) === -1) {\r\n legendData.position = null;\r\n }\r\n if (legendData.showShape) {\r\n shapeSpace += legendData.fontSize + 5;\r\n shapes.push([plot.name, plot.shape]);\r\n }\r\n if (legendData.showLegend) {\r\n if (legendData.position === null) {\r\n if (rightFree) {\r\n legendData.position = \"right\";\r\n rightFree = false;\r\n if (legendData.discrete) {\r\n spaceRight = legendData.breaks.length * (legendData.fontSize + 2);\r\n } else {\r\n spaceRight = 115;\r\n }\r\n } else if (leftFree) {\r\n legendData.position = \"left\";\r\n leftFree = false;\r\n if (legendData.discrete) {\r\n spaceLeft = legendData.breaks.length * (legendData.fontSize + 2);\r\n } else {\r\n spaceLeft = 115;\r\n }\r\n } else {\r\n legendData.showLegend = false;\r\n }\r\n } else {\r\n if (legendData.position === \"right\") {\r\n rightFree = false;\r\n if (legendData.discrete) {\r\n spaceRight = legendData.breaks.length * (legendData.fontSize + 2);\r\n } else {\r\n spaceRight = 115;\r\n }\r\n } else {\r\n leftFree = false;\r\n if (legendData.discrete) {\r\n spaceRight = legendData.breaks.length * (legendData.fontSize + 2);\r\n } else {\r\n spaceRight = 115;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // if shape legend is requested, decide on which side it should be placed:\r\n if (shapeSpace > 0) {\r\n if (this.shapeLegendTitle && this.shapeLegendTitle !== \"\") {\r\n shapeSpace += 100;\r\n }\r\n if (rightFree) {\r\n this._shapeLegendPosition = \"right\";\r\n } else if (leftFree) {\r\n this._shapeLegendPosition = \"left\";\r\n } else {\r\n if (spaceRight <= spaceLeft) {\r\n this._shapeLegendPosition = \"right\";\r\n } else {\r\n this._shapeLegendPosition = \"left\";\r\n }\r\n }\r\n }\r\n\r\n\r\n let shapeLegendData: shapeLegendData = {\r\n title: this.shapeLegendTitle,\r\n spacing: shapeSpace,\r\n shapes: shapes\r\n }\r\n\r\n let shapeLegendDrawn = false;\r\n for (let i = 0; i < this.plots.length; i++) {\r\n const lgndData = this.plots[i].legendData;\r\n if (lgndData.showLegend) {\r\n if (lgndData.position === this._shapeLegendPosition) {\r\n uiLayer = this._createPlotLegend(lgndData, uiLayer, shapeLegendData);\r\n shapeLegendDrawn = true;\r\n } else {\r\n uiLayer = this._createPlotLegend(lgndData, uiLayer);\r\n }\r\n }\r\n }\r\n\r\n if (!shapeLegendDrawn) {\r\n this._drawStandaloneShapeLegend(uiLayer, shapeSpace, shapeLegendData);\r\n }\r\n\r\n this._legend = uiLayer;\r\n }\r\n\r\n private _drawStandaloneShapeLegend(uiLayer: AdvancedDynamicTexture, shapeSpace: number, shapeLegendData: shapeLegendData) {\r\n let grid = new Grid();\r\n uiLayer.addControl(grid);\r\n\r\n let padding = (this.canvas.height - shapeSpace / 2) / 2;\r\n grid.addRowDefinition(padding, true);\r\n grid.addRowDefinition(shapeSpace, true);\r\n grid.addRowDefinition(padding, true);\r\n\r\n let legendWidth = 0.2;\r\n let legendColumn = 1;\r\n if (this._shapeLegendPosition === \"right\") {\r\n grid.addColumnDefinition(1 - legendWidth);\r\n grid.addColumnDefinition(legendWidth);\r\n } else {\r\n grid.addColumnDefinition(legendWidth);\r\n grid.addColumnDefinition(1 - legendWidth);\r\n legendColumn = 0;\r\n }\r\n\r\n let shapeLegendGrid = this._createShapeLegend(this.plots[0].legendData, shapeLegendData);\r\n\r\n grid.addControl(shapeLegendGrid, 1, legendColumn);\r\n }\r\n\r\n private _createPlotLegend(legendData: LegendData, uiLayer: AdvancedDynamicTexture, shapeLegendData?: shapeLegendData): AdvancedDynamicTexture {\r\n if (!legendData.showLegend) {\r\n return uiLayer;\r\n }\r\n // create grid for placing legend in correct position\r\n let grid = new Grid();\r\n uiLayer.addControl(grid);\r\n\r\n let n = legendData.breaks.length;\r\n let breakN: number;\r\n let legendWidth = 0.2;\r\n let nCols = 1;\r\n\r\n let legendBodyHeight = 0.9;\r\n let legendMinPixels: number;\r\n if (legendData.discrete) {\r\n legendMinPixels = legendData.breaks.length * (legendData.fontSize + 2);\r\n } else {\r\n legendMinPixels = 115;\r\n }\r\n if (legendData.legendTitle && legendData.legendTitle !== \"\") {\r\n legendMinPixels += legendData.legendTitleFontSize + 5;\r\n }\r\n\r\n // main position of legend (right middle)\r\n if (shapeLegendData !== undefined) {\r\n grid.addRowDefinition(0.05);\r\n let totalReqPixels = legendMinPixels + shapeLegendData.spacing;\r\n legendBodyHeight = legendMinPixels / totalReqPixels;\r\n let shapeBodyHeight = shapeLegendData.spacing / totalReqPixels;\r\n grid.addRowDefinition(legendBodyHeight - 0.05);\r\n grid.addRowDefinition(shapeBodyHeight - 0.05);\r\n grid.addRowDefinition(0.05);\r\n }\r\n else {\r\n grid.addRowDefinition(0.05);\r\n grid.addRowDefinition(legendBodyHeight);\r\n grid.addRowDefinition(0.05);\r\n }\r\n\r\n if (legendData.discrete) {\r\n legendData.fontSize;\r\n nCols = Math.ceil(((legendData.fontSize + 2) * n) / (legendBodyHeight * this.canvas.height * 0.7));\r\n\r\n breakN = Math.ceil(n / nCols);\r\n\r\n legendWidth = 0.1 + (0.1 * nCols);\r\n }\r\n\r\n let legendColumn = 1;\r\n if (legendData.position === \"right\") {\r\n grid.addColumnDefinition(1 - legendWidth);\r\n grid.addColumnDefinition(legendWidth);\r\n } else {\r\n grid.addColumnDefinition(legendWidth);\r\n grid.addColumnDefinition(1 - legendWidth);\r\n legendColumn = 0;\r\n }\r\n\r\n // create shape legend\r\n\r\n if (shapeLegendData) {\r\n\r\n let shapeLegendGrid = this._createShapeLegend(legendData, shapeLegendData);\r\n\r\n grid.addControl(shapeLegendGrid, 2, legendColumn);\r\n }\r\n\r\n let legendBody = new Grid();\r\n\r\n legendBody.paddingLeftInPixels = 10;\r\n legendBody.paddingRightInPixels = 10;\r\n\r\n legendBody.addRowDefinition(0.2);\r\n legendBody.addRowDefinition(0.7);\r\n legendBody.addRowDefinition(0.1);\r\n\r\n grid.addControl(legendBody, 1, legendColumn);\r\n\r\n if (legendData.legendTitle && legendData.legendTitle !== \"\") {\r\n let legendTitle = new TextBlock();\r\n legendTitle.text = legendData.legendTitle;\r\n legendTitle.color = legendData.legendTitleFontColor;\r\n legendTitle.fontWeight = \"bold\";\r\n legendTitle.fontSize = legendData.legendTitleFontSize + \"px\";\r\n legendTitle.verticalAlignment = Control.VERTICAL_ALIGNMENT_BOTTOM;\r\n legendTitle.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n legendTitle.textWrapping = true;\r\n legendBody.addControl(legendTitle, 0, legendColumn);\r\n }\r\n\r\n // for continuous measures display color bar and max and min values.\r\n if (!legendData.discrete) {\r\n\r\n let innerGrid = new Grid();\r\n innerGrid.addColumnDefinition(0.2);\r\n innerGrid.addColumnDefinition(0.8);\r\n legendBody.addControl(innerGrid, 1, 0);\r\n\r\n let nBreaks = 115;\r\n let labelSpace = 0.15;\r\n if (legendBodyHeight * this.canvas.height * 0.7 < 100) {\r\n nBreaks = 10;\r\n labelSpace = 0.45;\r\n innerGrid.addRowDefinition(1);\r\n }\r\n else if (legendBodyHeight * this.canvas.height * 0.7 < 150) {\r\n nBreaks = 50;\r\n labelSpace = 0.3;\r\n innerGrid.addRowDefinition(1);\r\n }\r\n else {\r\n let padding = ((legendBodyHeight * this.canvas.height * 0.7) - 115) / 2;\r\n innerGrid.addRowDefinition(padding, true);\r\n innerGrid.addRowDefinition(115, true);\r\n innerGrid.addRowDefinition(padding, true);\r\n }\r\n // color bar\r\n let colors: string[];\r\n if (legendData.colorScale === \"custom\") {\r\n colors = chroma.scale(legendData.customColorScale).mode('lch').colors(nBreaks);\r\n }\r\n else {\r\n colors = chroma.scale(chroma.brewer[legendData.colorScale]).mode('lch').colors(nBreaks);\r\n }\r\n let scaleGrid = new Grid();\r\n for (let i = 0; i < nBreaks; i++) {\r\n scaleGrid.addRowDefinition(1 / nBreaks);\r\n let legendColor = new Rectangle();\r\n if (legendData.inverted) {\r\n legendColor.background = colors[i];\r\n }\r\n else {\r\n legendColor.background = colors[colors.length - i - 1];\r\n }\r\n legendColor.thickness = 0;\r\n legendColor.width = 0.5;\r\n legendColor.height = 1;\r\n scaleGrid.addControl(legendColor, i, 0);\r\n }\r\n\r\n // label text\r\n let labelGrid = new Grid();\r\n labelGrid.addColumnDefinition(1);\r\n labelGrid.addRowDefinition(labelSpace);\r\n labelGrid.addRowDefinition(1 - labelSpace * 2);\r\n labelGrid.addRowDefinition(labelSpace);\r\n\r\n if (this.canvas.height < 130) {\r\n innerGrid.addControl(scaleGrid, 0, 0);\r\n innerGrid.addControl(labelGrid, 0, 1);\r\n }\r\n else {\r\n innerGrid.addControl(scaleGrid, 1, 0);\r\n innerGrid.addControl(labelGrid, 1, 1);\r\n }\r\n\r\n let minText = new TextBlock();\r\n minText.text = parseFloat(legendData.breaks[0]).toFixed(2);\r\n minText.color = legendData.fontColor;\r\n minText.fontSize = legendData.fontSize + \"px\";\r\n minText.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n labelGrid.addControl(minText, 2, 0);\r\n\r\n let maxText = new TextBlock();\r\n maxText.text = parseFloat(legendData.breaks[1]).toFixed(2);\r\n maxText.color = legendData.fontColor;\r\n maxText.fontSize = legendData.fontSize + \"px\";\r\n maxText.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n labelGrid.addControl(maxText, 0, 0);\r\n }\r\n else {\r\n // inner Grid contains legend rows and columns for color and text\r\n let innerGrid = new Grid();\r\n // define number of columns by the number of categories.\r\n if (nCols > 1) {\r\n for (let i = 0; i < nCols; i++) {\r\n innerGrid.addColumnDefinition(0.1);\r\n innerGrid.addColumnDefinition(0.4);\r\n }\r\n }\r\n else {\r\n innerGrid.addColumnDefinition(0.1);\r\n innerGrid.addColumnDefinition(0.9);\r\n }\r\n for (let i = 0; i < n && i < breakN; i++) {\r\n if (n > breakN) {\r\n innerGrid.addRowDefinition(1 / breakN);\r\n }\r\n else {\r\n innerGrid.addRowDefinition(1 / n);\r\n }\r\n }\r\n legendBody.addControl(innerGrid, 1, 0);\r\n\r\n let colors: string[];\r\n if (legendData.colorScale === \"custom\") {\r\n colors = chroma.scale(legendData.customColorScale).mode('lch').colors(n);\r\n }\r\n else {\r\n colors = chroma.scale(chroma.brewer[legendData.colorScale]).mode('lch').colors(n);\r\n }\r\n\r\n // add color box and legend text\r\n for (let i = 0; i < n; i++) {\r\n // color\r\n let legendColor = new Rectangle();\r\n legendColor.background = colors[i];\r\n legendColor.thickness = 0;\r\n legendColor.width = legendData.fontSize + \"px\";\r\n legendColor.height = legendData.fontSize + \"px\";\r\n\r\n let column = Math.floor(i / breakN);\r\n let row = i - column * breakN;\r\n\r\n innerGrid.addControl(legendColor, row, column * 2);\r\n\r\n // text\r\n let legendText = new TextBlock();\r\n legendText.text = legendData.breaks[i].toString();\r\n legendText.color = legendData.fontColor;\r\n legendText.fontSize = legendData.fontSize + \"px\";\r\n legendText.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n\r\n innerGrid.addControl(legendText, row, column * 2 + 1);\r\n }\r\n }\r\n return uiLayer;\r\n }\r\n\r\n private _createShapeLegend(legendData: LegendData, shapeLegendData: shapeLegendData) {\r\n let shapeLegendGrid = new Grid();\r\n legendData.fontColor = legendData.fontColor || \"black\";\r\n legendData.fontSize = legendData.fontSize || 11;\r\n legendData.legendTitleFontColor = legendData.legendTitleFontColor || \"black\";\r\n legendData.legendTitleFontSize = legendData.legendTitleFontSize || 16;\r\n if (shapeLegendData.title && shapeLegendData.title !== \"\") {\r\n shapeLegendGrid.paddingLeftInPixels = 10;\r\n shapeLegendGrid.paddingRightInPixels = 10;\r\n shapeLegendGrid.addRowDefinition(legendData.legendTitleFontSize + 5, true);\r\n shapeLegendGrid.addRowDefinition(shapeLegendData.spacing - (legendData.legendTitleFontSize + 5), true);\r\n shapeLegendGrid.addRowDefinition(0.05);\r\n // shape legend title\r\n let shapeLegendTitle = new TextBlock();\r\n shapeLegendTitle.text = shapeLegendData.title;\r\n shapeLegendTitle.color = legendData.legendTitleFontColor;\r\n shapeLegendTitle.fontWeight = \"bold\";\r\n if (legendData.legendTitleFontSize) {\r\n shapeLegendTitle.fontSize = legendData.legendTitleFontSize + \"px\";\r\n }\r\n else {\r\n shapeLegendTitle.fontSize = \"16px\";\r\n }\r\n shapeLegendTitle.verticalAlignment = Control.VERTICAL_ALIGNMENT_BOTTOM;\r\n shapeLegendTitle.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n shapeLegendTitle.textWrapping = true;\r\n shapeLegendGrid.addControl(shapeLegendTitle, 0, 0);\r\n } else {\r\n shapeLegendGrid.addRowDefinition(0.05);\r\n shapeLegendGrid.addRowDefinition(shapeLegendData.spacing, true);\r\n shapeLegendGrid.addRowDefinition(0.05);\r\n }\r\n let shapeLegendBody = new Grid();\r\n shapeLegendBody.addColumnDefinition(legendData.fontSize + 6, true);\r\n shapeLegendBody.addColumnDefinition(0.9);\r\n let rowHeight = 1 / shapeLegendData.shapes.length;\r\n for (let i = 0; i < shapeLegendData.shapes.length; i++) {\r\n const shapeDef = shapeLegendData.shapes[i];\r\n shapeLegendBody.addRowDefinition(rowHeight);\r\n // shape\r\n let url = \"data:image/svg+xml;base64,\" + window.btoa(legendSVGs[shapeDef[1]]);\r\n let shapeIcon = new Image(shapeDef[0], url);\r\n shapeIcon.width = legendData.fontSize + 2 + \"px\";\r\n shapeIcon.height = legendData.fontSize + 2 + \"px\";\r\n\r\n shapeLegendBody.addControl(shapeIcon, i, 0);\r\n\r\n // text\r\n let shapeText = new TextBlock();\r\n shapeText.text = shapeDef[0];\r\n shapeText.color = legendData.fontColor;\r\n shapeText.fontSize = legendData.fontSize + \"px\";\r\n shapeText.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n\r\n shapeLegendBody.addControl(shapeText, i, 1);\r\n }\r\n\r\n shapeLegendGrid.addControl(shapeLegendBody, 1, 0);\r\n return shapeLegendGrid;\r\n }\r\n\r\n /**\r\n * Start rendering the scene\r\n */\r\n doRender(): Plots {\r\n this._engine.runRenderLoop(() => {\r\n this.scene.render();\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Resizes the visualization to the current size of the canvas. This method should be bound to a resize event of the canvas. It is also recommended to call the resize() method once after the doRender() call.\r\n * \r\n * @param width Optional: Width of the canvas\r\n * @param height Optional: Height of the canvas\r\n */\r\n resize(width?: number, height?: number): Plots {\r\n if (width !== undefined && height !== undefined) {\r\n if (this.R) {\r\n let pad = parseInt(document.body.style.padding.substring(0, document.body.style.padding.length - 2));\r\n this.canvas.width = width - 2 * pad;\r\n this.canvas.height = height - 2 * pad;\r\n } else {\r\n this.canvas.width = width;\r\n this.canvas.height = height;\r\n }\r\n }\r\n this._fsUIDirty = true;\r\n this._resizePublishOverlay();\r\n this._engine.resize();\r\n return this\r\n }\r\n\r\n /**\r\n * Saves a screenshot of the visualization.\r\n * \r\n * @param size Width and height of square thumbnail in pixels\r\n * @param saveCallback Function that takes the created screenshot as base64 encoded string.\r\n */\r\n thumbnail(size: number, saveCallback: (data: string) => void): void {\r\n ScreenshotTools.CreateScreenshot(this._engine, this.camera, size, saveCallback);\r\n }\r\n\r\n /**\r\n * Releases all held resources of the Plots visualization. Useful to clear memory, after a visualization is no longer needed.\r\n */\r\n dispose(): void {\r\n this.scene.dispose();\r\n this._engine.dispose();\r\n // remove UI\r\n let btnbar = document.getElementById(\"buttonBar_\" + this._uniqID);\r\n btnbar.remove();\r\n let lblCntrl = document.getElementById(\"labelControl_\" + this._uniqID);\r\n lblCntrl.remove();\r\n }\r\n\r\n /**\r\n * Add labels from a list of labels.\r\n * \r\n * @param labelList List of lists with the first three elements of the inner lists being the x, y and z coordinates, and the fourth the label text.\r\n */\r\n addLabels(labelList: [[number, number, number, string]]): void {\r\n this._annotationManager.addLabels(labelList);\r\n }\r\n\r\n}\r\n","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { Color3, Vector3 } from \"@babylonjs/core/Maths/math\";\r\nimport { BoxBuilder } from \"@babylonjs/core/Meshes/Builders/boxBuilder\";\r\nimport { PlaneBuilder } from \"@babylonjs/core/Meshes/Builders/planeBuilder\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { CoordinatePlot, LegendData} from \"../babyplots\";\r\n\r\nexport class HeatMap extends CoordinatePlot {\r\n constructor(\r\n scene: Scene,\r\n coordinates: number[][],\r\n colorVar: string[],\r\n size: number,\r\n legendData: LegendData,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n name: string = \"heat map\"\r\n ) {\r\n super(name, \"heatmap\", scene, coordinates, colorVar, size, legendData, xScale, yScale, zScale);\r\n this._createHeatMap();\r\n this.allLoaded = true;\r\n }\r\n private _createHeatMap(): void {\r\n let boxes = [];\r\n for (let row = 0; row < this._coords.length; row++) {\r\n const rowCoords = this._coords[row];\r\n for (let column = 0; column < rowCoords.length; column++) {\r\n const coord = rowCoords[column];\r\n if (coord > 0) {\r\n let height = coord * this.yScale;\r\n let box = BoxBuilder.CreateBox(\"box_\" + row + \"-\" + column, {\r\n height: height,\r\n width: this.xScale * this._size,\r\n depth: this.zScale * this._size\r\n }, this._scene);\r\n box.position = new Vector3(\r\n row * this.xScale + 0.5 * this.xScale,\r\n height / 2,\r\n column * this.zScale + 0.5 * this.zScale\r\n );\r\n let mat = new StandardMaterial(\"box_\" + row + \"-\" + column + \"_color\", this._scene);\r\n mat.alpha = 1;\r\n mat.diffuseColor = Color3.FromHexString(\r\n this._coordColors[column + row * rowCoords.length].substring(0, 7)\r\n );\r\n box.material = mat;\r\n boxes.push(box);\r\n }\r\n else {\r\n let box = PlaneBuilder.CreatePlane(\r\n \"box_\" + row + \"-\" + column,\r\n {\r\n width: this.xScale * this._size,\r\n height: this.zScale * this._size\r\n }, this._scene);\r\n box.position = new Vector3(\r\n row * this.xScale + 0.5 * this.xScale,\r\n 0,\r\n column * this.zScale + 0.5 * this.zScale\r\n );\r\n box.rotation.x = Math.PI / 2;\r\n let mat = new StandardMaterial(\"box_\" + row + \"-\" + column + \"_color\", this._scene);\r\n mat.alpha = 1;\r\n mat.diffuseColor = Color3.FromHexString(\r\n this._coordColors[column + row * rowCoords.length].substring(0, 7)\r\n );\r\n mat.backFaceCulling = false;\r\n box.material = mat;\r\n boxes.push(box);\r\n }\r\n }\r\n }\r\n this.meshes = boxes;\r\n Object.defineProperty(this, \"alpha\", {\r\n set(newAlpha) {\r\n for (let i = 0; i < this.meshes.length; i++) {\r\n const box = this.meshes[i] as Mesh;\r\n box.material.alpha = newAlpha;\r\n }\r\n }\r\n });\r\n }\r\n}\r\n","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { Color3 } from \"@babylonjs/core/Maths/math\";\r\nimport { VertexData } from \"@babylonjs/core/Meshes/mesh.vertexData\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { Plot, LegendData } from \"../babyplots\";\r\nimport chroma from \"chroma-js\";\r\n\r\n\r\n\r\nexport class ImgStack extends Plot {\r\n private _backgroundColor: string;\r\n private _intensityMode: string;\r\n private _channelCoords: number[][][];\r\n private _channelCoordIntensities: number[][];\r\n private _channelColors: string[];\r\n private _channelOpacities: number[];\r\n\r\n size: number;\r\n\r\n constructor(\r\n scene: Scene,\r\n values: number[],\r\n indices: number[],\r\n attributes: { dim: number[] },\r\n legendData: LegendData,\r\n size: number,\r\n backgroundColor: string,\r\n intensityMode: string,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n channelColors: string[] = [\"#ff0000\", \"#00ff00\", \"#0000ff\"],\r\n channelOpacities: number[] = [1, 1, 1],\r\n name: string = \"image stack\"\r\n ) {\r\n let colSize = attributes.dim[0];\r\n let rowSize = attributes.dim[1];\r\n let channels = attributes.dim[2];\r\n let slices = attributes.dim[3];\r\n let channelSize = colSize * rowSize;\r\n let sliceSize = channelSize * channels;\r\n let coords = [];\r\n let Intensities = [];\r\n for (let i = 0; i < channels; i++) {\r\n coords.push([]);\r\n Intensities.push([]);\r\n }\r\n for (let i = 0; i < indices.length; i++) {\r\n const index = indices[i];\r\n let slice = Math.floor(index / sliceSize);\r\n let sliceIndex = index - sliceSize * slice;\r\n let channel = Math.floor(sliceIndex / channelSize);\r\n let channelIndex = sliceIndex - channelSize * channel;\r\n let row = Math.floor(channelIndex / colSize);\r\n let col = channelIndex % colSize;\r\n coords[channel].push([\r\n col * xScale,\r\n row * yScale,\r\n slice * zScale\r\n ]);\r\n Intensities[channel].push(values[i]);\r\n }\r\n super(name, \"imgStack\", scene, legendData, xScale, yScale, zScale);\r\n this.size = size;\r\n this.legendData\r\n this._channelCoords = coords;\r\n this._channelCoordIntensities = Intensities;\r\n this._backgroundColor = backgroundColor;\r\n this._intensityMode = intensityMode;\r\n this._channelColors = channelColors;\r\n this._channelOpacities = channelOpacities;\r\n this.meshes = [];\r\n this._createImgStack();\r\n this.allLoaded = true;\r\n }\r\n\r\n private _createImgStack(): void {\r\n let positions = [];\r\n let colors = [];\r\n for (let c = 0; c < this._channelCoords.length; c++) {\r\n const channelIntensities = this._channelCoordIntensities[c];\r\n if (channelIntensities.length === 0) {\r\n continue;\r\n }\r\n const channelCoords = this._channelCoords[c];\r\n let channelColor = this._channelColors[c];\r\n let channelColorRGB = chroma(channelColor).rgb();\r\n channelColorRGB[0] = channelColorRGB[0] / 255;\r\n channelColorRGB[1] = channelColorRGB[1] / 255;\r\n channelColorRGB[2] = channelColorRGB[2] / 255;\r\n if (this._intensityMode === \"alpha\") {\r\n let alphaLevels = 10;\r\n let minIntensity = channelIntensities.min();\r\n let alphaPositions: number[][] = [];\r\n let alphaColors: number[][] = [];\r\n let alphaIntensities: number[] = [];\r\n for (let i = 0; i < alphaLevels; i++) {\r\n alphaPositions.push([]);\r\n alphaColors.push([]);\r\n alphaIntensities.push((i + 1) * (1 / alphaLevels) * this._channelOpacities[c]);\r\n }\r\n\r\n for (let p = 0; p < channelCoords.length; p++) {\r\n for (let intens = 0; intens < alphaIntensities.length; intens++) {\r\n const testIntensity = alphaIntensities[intens];\r\n if ((channelIntensities[p] - minIntensity) / (1 - minIntensity) <= testIntensity) {\r\n alphaPositions[intens].push(\r\n channelCoords[p][2],\r\n channelCoords[p][0],\r\n channelCoords[p][1]\r\n );\r\n alphaColors[intens].push(\r\n channelColorRGB[0],\r\n channelColorRGB[1],\r\n channelColorRGB[2],\r\n 1\r\n );\r\n break;\r\n }\r\n }\r\n }\r\n\r\n for (let intensIdx = 0; intensIdx < alphaIntensities.length; intensIdx++) {\r\n if (alphaColors[intensIdx].length <= 4) {\r\n continue;\r\n }\r\n let customMesh = new Mesh(`custom-${c}_${intensIdx}`, this._scene);\r\n const intensity = alphaIntensities[intensIdx];\r\n let vertexData = new VertexData();\r\n vertexData.positions = alphaPositions[intensIdx];\r\n vertexData.colors = alphaColors[intensIdx];\r\n vertexData.applyToMesh(customMesh, true);\r\n let mat = new StandardMaterial(`mat-${c}_${intensIdx}`, this._scene);\r\n mat.emissiveColor = new Color3(1, 1, 1);\r\n mat.disableLighting = true;\r\n mat.pointsCloud = true;\r\n mat.pointSize = this.size;\r\n mat.alpha = intensity;\r\n customMesh.material = mat;\r\n this.meshes.push(customMesh);\r\n }\r\n\r\n } else {\r\n for (let p = 0; p < channelCoords.length; p++) {\r\n positions.push(channelCoords[p][2], channelCoords[p][0], channelCoords[p][1]);\r\n if (this._intensityMode === \"mix\") {\r\n let colormix = chroma.mix(this._backgroundColor, channelColor, channelIntensities[p]).rgb();\r\n colors.push(colormix[0] / 255, colormix[1] / 255, colormix[2] / 255, 1);\r\n } else {\r\n colors.push(channelColorRGB[0], channelColorRGB[1], channelColorRGB[2], 1);\r\n }\r\n }\r\n let customMesh = new Mesh(`custom-${c}`, this._scene);\r\n let vertexData = new VertexData();\r\n vertexData.positions = positions;\r\n vertexData.colors = colors;\r\n vertexData.applyToMesh(customMesh, true);\r\n let mat = new StandardMaterial(`mat-${c}`, this._scene);\r\n mat.emissiveColor = new Color3(1, 1, 1);\r\n mat.disableLighting = true;\r\n mat.pointsCloud = true;\r\n mat.pointSize = this.size;\r\n customMesh.material = mat;\r\n this.meshes.push(customMesh);\r\n }\r\n }\r\n }\r\n}","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { Vector3, Color4 } from \"@babylonjs/core/Maths/math\";\r\nimport { LegendData, CoordinatePlot } from \"../babyplots\";\r\nimport { AnnotationManager } from \"../utils/Label\";\r\nimport { LinesBuilder } from \"@babylonjs/core/Meshes/Builders/linesBuilder\";\r\n\r\nexport class Line extends CoordinatePlot {\r\n labels: string[]\r\n labelSize: number\r\n labelColor: string\r\n\r\n private _hasAnimation: boolean;\r\n private _looping: boolean = false;\r\n private _animDirection: number = 1;\r\n private _animationFrames: number = 200;\r\n private _animationDelay: number = 100;\r\n constructor(\r\n scene: Scene,\r\n coordinates: number[][],\r\n colorVar: string[],\r\n size: number,\r\n legendData: LegendData,\r\n hasAnimation?: boolean,\r\n animationDelay?: number,\r\n animationDuration?: number,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n name: string = \"line\",\r\n labels?: string[],\r\n labelSize?: number,\r\n labelColor?: string,\r\n annotationManager?: AnnotationManager\r\n ) {\r\n super(name, \"line\", scene, coordinates, colorVar, size, legendData, xScale, yScale, zScale);\r\n this._hasAnimation = hasAnimation;\r\n if (labels && labels.length === coordinates.length && annotationManager) {\r\n this.labels = labels;\r\n this.labelSize = labelSize;\r\n this.labelColor = labelColor;\r\n this._addLabels(annotationManager);\r\n }\r\n this._createLine();\r\n this.allLoaded = true;\r\n }\r\n /**\r\n * Positions spheres according to coordinates in a SPS\r\n */\r\n private _createLine(): void {\r\n let lineCoords: Vector3[] = [];\r\n for (let i = 0; i < this._coords.length; i++) {\r\n const point = this._coords[i];\r\n lineCoords.push(new Vector3(point[0], point[1], point[2]));\r\n }\r\n let lineColors: Color4[] = [];\r\n for (let i = 0; i < this._coordColors.length; i++) {\r\n const pointColor = this._coordColors[i];\r\n lineColors.push(Color4.FromHexString(pointColor));\r\n }\r\n let lines = LinesBuilder.CreateLines(\r\n \"lines\",\r\n { points: lineCoords, colors: lineColors }\r\n )\r\n\r\n this.mesh = lines;\r\n }\r\n\r\n private _addLabels(annotationManager: AnnotationManager): void {\r\n for (let i = 0; i < this.labels.length; i++) {\r\n let col = this.labelColor;\r\n if (this.labelColor === \"match\") {\r\n col = this._coordColors[i];\r\n }\r\n annotationManager.addLabel(this.labels[i], this._coords[i], col, this.labelSize);\r\n }\r\n annotationManager.fixLabels();\r\n }\r\n}","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\n\r\n\r\nimport { Axis, Space, Vector3 } from \"@babylonjs/core/Maths/math\";\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { SceneLoader } from \"@babylonjs/core/Loading/sceneLoader\";\r\n\r\nimport { LegendData, Plot } from \"../babyplots\";\r\n\r\nimport \"@babylonjs/loaders/glTF\";\r\n\r\nexport class MeshObject extends Plot {\r\n\r\n\r\n worldextends: { min: Vector3; max: Vector3}\r\n\r\n constructor(\r\n scene: Scene,\r\n meshString: string,\r\n legendData: LegendData,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n scaling: number[] = [],\r\n rotation: number[] = [],\r\n offset: number[] = [],\r\n name: string = \"mesh object\"\r\n ) {\r\n super(name, \"meshObject\", scene, legendData, xScale, yScale, zScale);\r\n SceneLoader.ImportMesh(\"\", \"\", \"data:\" + meshString, scene, (meshes, _, __) => {\r\n let rootMesh = meshes[0]\r\n if (scaling.length === 3) {\r\n rootMesh.scaling = new Vector3(\r\n scaling[0],\r\n scaling[1],\r\n scaling[2]\r\n );\r\n }\r\n if (rotation.length === 3) {\r\n rootMesh.rotationQuaternion = null;\r\n rootMesh.rotate(Axis.X, rotation[0], Space.LOCAL);\r\n rootMesh.rotate(Axis.Y, rotation[1], Space.LOCAL);\r\n rootMesh.rotate(Axis.Z, rotation[2], Space.LOCAL);\r\n }\r\n if (offset.length === 3) {\r\n meshes[0].position = new Vector3(\r\n offset[0],\r\n offset[1],\r\n offset[2]\r\n );\r\n }\r\n });\r\n }\r\n}","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { AssetContainer } from \"@babylonjs/core/assetContainer\";\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { SceneLoader } from \"@babylonjs/core/Loading/sceneLoader\";\r\nimport { LegendData, Plot } from \"../babyplots\";\r\nimport { Axis, Space, Vector3 } from \"@babylonjs/core/Maths/math\";\r\n\r\nimport \"@babylonjs/loaders/glTF\";\r\nimport { PBRMaterial } from \"@babylonjs/core\";\r\n\r\n\r\nexport class MeshStream extends Plot {\r\n private _rootUrl: string;\r\n private _filenames: string[] = [];\r\n private _prevTime: number = performance.now();\r\n private _containers: AssetContainer[] = [];\r\n private _rotation: number[];\r\n private _offset: number[];\r\n private _clearCoat: boolean;\r\n private _clearCoatIntensity: number;\r\n\r\n frameIndex: number = 0;\r\n frameTotal: number;\r\n frameDelay: number;\r\n worldextends: { min: Vector3; max: Vector3; };\r\n\r\n constructor(\r\n scene: Scene,\r\n rootUrl: string,\r\n filePrefix: string,\r\n fileSuffix: string,\r\n fileIteratorStart: number,\r\n fileIteratorEnd: number,\r\n legendData: LegendData,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n frameDelay: number = 200,\r\n rotation: number[] = [],\r\n offset: number[] = [],\r\n clearCoat: boolean = false,\r\n clearCoatIntensity: number = 1,\r\n name: string = \"mesh stream\"\r\n ) {\r\n super(name, \"meshStream\", scene, legendData, xScale, yScale, zScale);\r\n this._rootUrl = rootUrl;\r\n this.frameDelay = frameDelay;\r\n this._rotation = rotation;\r\n this._offset = offset;\r\n this._clearCoat = clearCoat;\r\n this._clearCoatIntensity = clearCoatIntensity;\r\n for (let iter = fileIteratorStart; iter <= fileIteratorEnd; iter++) {\r\n this._filenames.push(filePrefix + iter.toString() + fileSuffix);\r\n }\r\n this.frameTotal = this._filenames.length;\r\n this._createMeshStream();\r\n }\r\n\r\n async _createMeshStream(): Promise {\r\n // load meshes one by one, store them and display them as they come in\r\n\r\n let loadingContainers: Promise[] = [];\r\n // load containers\r\n for (let idx = 0; idx < this._filenames.length; idx++) {\r\n const filename = this._filenames[idx];\r\n // start loading container\r\n loadingContainers.push(this._loadMesh(filename));\r\n }\r\n const firstScene = await loadingContainers[0];\r\n firstScene.addAllToScene();\r\n this._containers.push(firstScene)\r\n this._containers = this._containers.concat(await Promise.all(loadingContainers));\r\n this.allLoaded = true;\r\n this.frameIndex = 0;\r\n firstScene.removeAllFromScene();\r\n }\r\n\r\n async _loadMesh(filename: string): Promise {\r\n let container = SceneLoader.LoadAssetContainerAsync(\r\n this._rootUrl, filename, this._scene\r\n ).then(container => {\r\n if (this._rotation.length === 3) {\r\n let rootMesh = container.meshes[0];\r\n rootMesh.rotationQuaternion = null;\r\n rootMesh.rotate(Axis.X, this._rotation[0], Space.LOCAL);\r\n rootMesh.rotate(Axis.Y, this._rotation[1], Space.LOCAL);\r\n rootMesh.rotate(Axis.Z, this._rotation[2], Space.LOCAL);\r\n }\r\n if (this._offset.length === 3) {\r\n let rootMesh = container.meshes[0];\r\n rootMesh.position = new Vector3(\r\n this._offset[0],\r\n this._offset[1],\r\n this._offset[2]\r\n );\r\n }\r\n if (this._clearCoat) {\r\n let materials = container.materials;\r\n materials.forEach((mat, _) => {\r\n (mat as PBRMaterial).clearCoat.isEnabled = true;\r\n (mat as PBRMaterial).clearCoat.intensity = this._clearCoatIntensity;\r\n });\r\n }\r\n this.frameIndex++;\r\n return container;\r\n });\r\n return container;\r\n }\r\n\r\n goToFrame(n: number): void {\r\n if (this.allLoaded && n >= 0 && n < this.frameTotal) {\r\n for (let fi = 0; fi < this._containers.length; fi++) {\r\n this._containers[fi].removeAllFromScene();\r\n }\r\n this._containers[n].addAllToScene();\r\n this.frameIndex = n + 1;\r\n if (this.frameIndex === this._containers.length) {\r\n this.frameIndex = 0;\r\n }\r\n }\r\n }\r\n\r\n update(): boolean {\r\n if (this.allLoaded) {\r\n let timeNow = performance.now();\r\n if (timeNow - this._prevTime > this.frameDelay) {\r\n this._prevTime = timeNow;\r\n if (this.frameIndex === 0) {\r\n this._containers[this._containers.length - 1].removeAllFromScene();\r\n } else {\r\n this._containers[this.frameIndex - 1].removeAllFromScene();\r\n }\r\n this._containers[this.frameIndex].addAllToScene();\r\n if (this.frameIndex === this._containers.length - 1) {\r\n this.frameIndex = 0;\r\n } else {\r\n this.frameIndex++;\r\n }\r\n }\r\n // go through the loaded meshes sequentially, then reset.\r\n }\r\n return true;\r\n }\r\n}\r\n","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { Vector3, Color4, Color3 } from \"@babylonjs/core/Maths/math\";\r\nimport { VertexData } from \"@babylonjs/core/Meshes/mesh.vertexData\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { FloatArray } from \"@babylonjs/core/types\";\r\nimport { LegendData, CoordinatePlot } from \"../babyplots\";\r\nimport { AnnotationManager } from \"../utils/Label\";\r\nimport chroma from \"chroma-js\";\r\n\r\nexport class PointCloud extends CoordinatePlot {\r\n private _hasAnimation: boolean;\r\n private _looping: boolean = false;\r\n private _animDirection: number = 1;\r\n private _animationTargets: number[][];\r\n private _animationVectors: Vector3[] = [];\r\n private _animationCounter: number = 0;\r\n private _animationFrames: number = 200;\r\n private _animationVectorFract: Vector3[] = [];\r\n private _animationDelay: number = 100;\r\n constructor(\r\n scene: Scene,\r\n coordinates: number[][],\r\n colorVar: string[],\r\n size: number,\r\n legendData: LegendData,\r\n hasAnimation?: boolean,\r\n animationTargets?: number[][],\r\n animationDelay?: number,\r\n animationDuration?: number,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n name: string = \"point cloud\",\r\n addLabels: boolean = false,\r\n annotationManager?: AnnotationManager\r\n ) {\r\n super(name, \"point\", scene, coordinates, colorVar, size, legendData, xScale, yScale, zScale);\r\n this._hasAnimation = hasAnimation;\r\n if (animationDelay) {\r\n this._animationDelay = animationDelay;\r\n }\r\n if (animationDuration) {\r\n this._animationFrames = animationDuration;\r\n }\r\n if (hasAnimation) {\r\n if (animationTargets) {\r\n for (let i = 0; i < animationTargets.length; i++) {\r\n if (animationTargets[i].length === 2) {\r\n animationTargets[i].splice(1, 0, 0);\r\n }\r\n let fv = new Vector3(\r\n coordinates[i][0] * this.xScale,\r\n coordinates[i][1] * this.yScale,\r\n coordinates[i][2] * this.zScale\r\n ).subtractFromFloats(\r\n animationTargets[i][0] * this.xScale,\r\n animationTargets[i][1] * this.yScale,\r\n animationTargets[i][2] * this.zScale\r\n );\r\n this._animationVectors.push(fv);\r\n this._animationVectorFract.push(fv.divide(new Vector3(this._animationFrames, this._animationFrames, this._animationFrames)));\r\n }\r\n this._animationTargets = animationTargets;\r\n } else {\r\n animationTargets = JSON.parse(JSON.stringify(coordinates));\r\n for (let i = 0; i < animationTargets.length; i++) {\r\n animationTargets[i][1] = 0;\r\n let fv = new Vector3(\r\n coordinates[i][0] * this.xScale,\r\n coordinates[i][1] * this.yScale,\r\n coordinates[i][2] * this.zScale\r\n ).subtractFromFloats(\r\n animationTargets[i][0] * this.xScale,\r\n animationTargets[i][1] * this.yScale,\r\n animationTargets[i][2] * this.zScale\r\n );\r\n this._animationVectors.push(fv);\r\n this._animationVectorFract.push(fv.divide(new Vector3(this._animationFrames, this._animationFrames, this._animationFrames)));\r\n }\r\n this._animationTargets = animationTargets;\r\n }\r\n }\r\n this._createPointCloud();\r\n if (addLabels && annotationManager) {\r\n this._addLabels(annotationManager);\r\n }\r\n this.allLoaded = true;\r\n }\r\n /**\r\n * Positions spheres according to coordinates in a SPS\r\n */\r\n private _createPointCloud(): void {\r\n // prototype cell\r\n let customMesh = new Mesh(\"custom\", this._scene);\r\n // Set arrays for positions and indices\r\n let positions = [];\r\n let colors = [];\r\n if (this._hasAnimation) {\r\n for (let p = 0; p < this._coords.length; p++) {\r\n positions.push(\r\n this._animationTargets[p][0] * this.xScale,\r\n this._animationTargets[p][1] * this.yScale,\r\n this._animationTargets[p][2] * this.zScale\r\n );\r\n let col = Color4.FromHexString(this._coordColors[p]);\r\n colors.push(col.r, col.g, col.b, col.a);\r\n }\r\n } else {\r\n for (let p = 0; p < this._coords.length; p++) {\r\n positions.push(\r\n this._coords[p][0] * this.xScale,\r\n this._coords[p][1] * this.yScale,\r\n this._coords[p][2] * this.zScale\r\n );\r\n let col = Color4.FromHexString(this._coordColors[p]);\r\n colors.push(col.r, col.g, col.b, col.a);\r\n }\r\n }\r\n var vertexData = new VertexData();\r\n // Assign positions\r\n vertexData.positions = positions;\r\n vertexData.colors = colors;\r\n // Apply vertexData to custom mesh\r\n vertexData.applyToMesh(customMesh, true);\r\n var mat = new StandardMaterial(\"mat\", this._scene);\r\n mat.emissiveColor = new Color3(1, 1, 1);\r\n mat.disableLighting = true;\r\n mat.pointsCloud = true;\r\n mat.pointSize = this._size;\r\n customMesh.material = mat;\r\n this.mesh = customMesh;\r\n Object.defineProperty(this, \"alpha\", {\r\n set(newAlpha) {\r\n this.mesh.material.alpha = newAlpha;\r\n }\r\n });\r\n }\r\n\r\n private _addLabels(annotationManager: AnnotationManager): void {\r\n if (!this.legendData.discrete) return;\r\n let colors: string[];\r\n if (this.legendData.colorScale === \"custom\") {\r\n colors = chroma.scale(this.legendData.customColorScale).mode('lch').colors(this.legendData.breaks.length);\r\n }\r\n else {\r\n colors = chroma.scale(chroma.brewer[this.legendData.colorScale]).mode('lch').colors(this.legendData.breaks.length);\r\n }\r\n let pointGroups: number[][][] = [];\r\n let pointGroupColors: string[] = [];\r\n let pointGroupNames: string[] = [];\r\n for (let i = 0; i < this._coordColors.length; i++) {\r\n const color = this._coordColors[i];\r\n let colorIdx = pointGroupColors.indexOf(color);\r\n if (colorIdx === -1) {\r\n colorIdx = pointGroupColors.length;\r\n pointGroupColors.push(color);\r\n let colorNameIdx = colors.indexOf(color.slice(0, -2));\r\n if (colorNameIdx === -1) {\r\n colorNameIdx = colors.indexOf(color);\r\n if (colorNameIdx === -1) continue;\r\n };\r\n pointGroupNames.push(this.legendData.breaks[colorNameIdx]);\r\n pointGroups.push([]);\r\n }\r\n pointGroups[colorIdx].push(this._coords[i]);\r\n }\r\n let pointGroupCentroids = [];\r\n const sumFun = (prev: number[], curr: number[]) => [prev[0] + curr[0], prev[1] + curr[1], prev[2] + curr[2]];\r\n for (let i = 0; i < pointGroups.length; i++) {\r\n const pointGroup = pointGroups[i];\r\n const sum = pointGroup.reduce(sumFun);\r\n const centroid = [sum[0] / pointGroup.length, sum[1] / pointGroup.length, sum[2] / pointGroup.length];\r\n annotationManager.addLabel(pointGroupNames[i], centroid);\r\n }\r\n annotationManager.fixLabels();\r\n }\r\n\r\n resetAnimation(): void {\r\n this._hasAnimation = true;\r\n let positionFunction = function (this: PointCloud, positions: FloatArray) {\r\n let numberOfVertices = positions.length / 3;\r\n for (let i = 0; i < numberOfVertices; i++) {\r\n positions[i * 3] = this._animationTargets[i][0] * this.xScale;\r\n positions[i * 3 + 1] = this._animationTargets[i][1] * this.zScale;\r\n positions[i * 3 + 2] = this._animationTargets[i][2] * this.yScale;\r\n }\r\n }\r\n this.mesh.updateMeshPositions(positionFunction.bind(this), true);\r\n this.mesh.refreshBoundingInfo();\r\n this._animationCounter = 0;\r\n this._animDirection = 1;\r\n }\r\n\r\n setLooping(looping: boolean): void {\r\n this._looping = looping;\r\n this.resetAnimation();\r\n }\r\n\r\n update(): boolean {\r\n if (this.mesh && this._hasAnimation) {\r\n if (this._animationCounter < this._animationDelay) {\r\n this._animationCounter += 1;\r\n } else if (this._animationCounter < this._animationFrames + this._animationDelay) {\r\n let positionFunction = function (this: PointCloud, positions: FloatArray) {\r\n let numberOfVertices = positions.length / 3;\r\n for (let i = 0; i < numberOfVertices; i++) {\r\n let posVector = new Vector3(\r\n positions[i * 3],\r\n positions[i * 3 + 1],\r\n positions[i * 3 + 2]\r\n );\r\n let vectorFractDir = this._animationVectorFract[i].multiplyByFloats(\r\n this._animDirection,\r\n this._animDirection,\r\n this._animDirection\r\n )\r\n posVector = posVector.addInPlace(vectorFractDir);\r\n positions[i * 3] = posVector.x;\r\n positions[i * 3 + 1] = posVector.y;\r\n positions[i * 3 + 2] = posVector.z;\r\n }\r\n }\r\n this.mesh.updateMeshPositions(positionFunction.bind(this), true);\r\n this._animationCounter += 1;\r\n } else {\r\n if (this._looping) {\r\n this._animationCounter = 0;\r\n this._animDirection *= -1;\r\n } else {\r\n this._hasAnimation = false;\r\n let positionFunction = function (positions: FloatArray) {\r\n let numberOfVertices = positions.length / 3;\r\n for (let i = 0; i < numberOfVertices; i++) {\r\n positions[i * 3] = this._coords[i][0] * this.xScale;\r\n positions[i * 3 + 1] = this._coords[i][1] * this.yScale;\r\n positions[i * 3 + 2] = this._coords[i][2] * this.zScale;\r\n }\r\n }\r\n this.mesh.updateMeshPositions(positionFunction.bind(this), true);\r\n }\r\n this.mesh.refreshBoundingInfo();\r\n }\r\n }\r\n return this._hasAnimation;\r\n }\r\n}\r\n","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport \"@babylonjs/core/Meshes/thinInstanceMesh\";\r\nimport { SphereBuilder } from \"@babylonjs/core/Meshes/Builders/sphereBuilder\";\r\nimport { BoxBuilder } from \"@babylonjs/core/Meshes/Builders/boxBuilder\";\r\nimport { TorusBuilder } from \"@babylonjs/core/Meshes/Builders/torusBuilder\";\r\nimport { CylinderBuilder } from \"@babylonjs/core/Meshes/Builders/cylinderBuilder\";\r\nimport { Color3, Color4, Matrix, Vector3 } from \"@babylonjs/core/Maths/math\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { CoordinatePlot, LegendData } from \"../babyplots\";\r\nimport { v4 as uuidv4 } from \"uuid\";\r\nimport { PickingInfo } from \"@babylonjs/core/Collisions/pickingInfo\";\r\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\r\n\r\nexport class ShapeCloud extends CoordinatePlot {\r\n private _shading: boolean;\r\n private _shape: string;\r\n private _tNodes: TransformNode[] = [];\r\n \r\n dpInfo: string[];\r\n \r\n constructor(\r\n scene: Scene,\r\n coordinates: number[][],\r\n colorVar: string[],\r\n shape: string,\r\n shading: boolean,\r\n size: number,\r\n legendData: LegendData,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n name: string = \"shape cloud\",\r\n dpInfo?: string[]\r\n ) {\r\n super(name, \"shape_\" + shape, scene, coordinates, colorVar, size * 0.1, legendData, xScale, yScale, zScale);\r\n this._shape = shape;\r\n this._shading = shading;\r\n if (dpInfo && dpInfo.length === coordinates.length) {\r\n this.dpInfo = dpInfo;\r\n }\r\n this._createShapeCloud();\r\n this.allLoaded = true;\r\n }\r\n /**\r\n * Creates shapes at coordinates\r\n */\r\n private _createShapeCloud(): void {\r\n let instanceCount = this._coords.length;\r\n\r\n let matricesData = new Float32Array(16 * instanceCount);\r\n let colorData = new Float32Array(4 * instanceCount);\r\n\r\n // set position and color data for shapes\r\n for (let i = 0; i < instanceCount; i++) {\r\n let matrix = Matrix.Translation(\r\n this._coords[i][0] * this.xScale,\r\n this._coords[i][1] * this.zScale,\r\n this._coords[i][2] * this.yScale\r\n );\r\n\r\n matrix.copyToArray(matricesData, i * 16);\r\n\r\n let col = Color4.FromHexString(this._coordColors[i]);\r\n\r\n colorData.set(col.asArray(), i * 4);\r\n }\r\n\r\n let origMesh: Mesh;\r\n let mid = \"root:\" + uuidv4()\r\n\r\n switch (this._shape) {\r\n case \"box\":\r\n origMesh = BoxBuilder.CreateBox(mid, { size: this._size });\r\n break;\r\n case \"sphere\":\r\n origMesh = SphereBuilder.CreateSphere(mid, { diameter: this._size });\r\n break;\r\n case \"cone\":\r\n origMesh = CylinderBuilder.CreateCylinder(mid, { height: this._size, diameterBottom: this._size, diameterTop: 0 }, this._scene);\r\n break;\r\n case \"torus\":\r\n origMesh = TorusBuilder.CreateTorus(mid, { diameter: this._size, thickness: this._size * 0.5 }, this._scene);\r\n break;\r\n case \"cylinder\":\r\n origMesh = CylinderBuilder.CreateCylinder(mid, { height: this._size, diameter: this._size }, this._scene);\r\n break;\r\n default:\r\n origMesh = BoxBuilder.CreateBox(mid, { size: this._size });\r\n break;\r\n }\r\n \r\n origMesh.thinInstanceSetBuffer(\"matrix\", matricesData, 16, true);\r\n origMesh.thinInstanceSetBuffer(\"color\", colorData, 4, true);\r\n\r\n \r\n let mat = new StandardMaterial(\"shapeMat\", this._scene);\r\n if (!this._shading) {\r\n mat.disableLighting = true;\r\n mat.emissiveColor = Color3.White();\r\n }\r\n origMesh.material = mat;\r\n \r\n this.mesh = origMesh;\r\n Object.defineProperty(this, \"alpha\", {\r\n set(newAlpha) {\r\n this.mesh.material.alpha = newAlpha;\r\n }\r\n });\r\n \r\n if (this.dpInfo) {\r\n origMesh.thinInstanceEnablePicking = true;\r\n }\r\n\r\n }\r\n getPick(pickResult: PickingInfo) {\r\n let pickCoords = Vector3.FromArray(this._coords[pickResult.thinInstanceIndex]);\r\n let target: TransformNode;\r\n for (let i = 0; i < this._tNodes.length; i++) {\r\n const tNode = this._tNodes[i];\r\n if (pickCoords.equals(tNode.position)) {\r\n target = tNode;\r\n }\r\n }\r\n if (target === undefined) {\r\n target = new TransformNode(\"pickNode\");\r\n target.position = pickCoords\r\n this._tNodes.push(target);\r\n }\r\n let pick = {\r\n target: target,\r\n info: this.dpInfo[pickResult.thinInstanceIndex]\r\n }\r\n return pick;\r\n }\r\n}\r\n","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { VertexData } from \"@babylonjs/core/Meshes/mesh.vertexData\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { LegendData, CoordinatePlot } from \"../babyplots\";\r\nimport chroma from \"chroma-js\";\r\n\r\n\r\nexport class Surface extends CoordinatePlot {\r\n constructor(\r\n scene: Scene,\r\n coordinates: number[][],\r\n colorVar: string[],\r\n size: number,\r\n legendData: LegendData,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n name: string = \"surface\"\r\n ) {\r\n super(name, \"surface\", scene, coordinates, colorVar, size, legendData, xScale, yScale, zScale);\r\n this._createSurface();\r\n this.allLoaded = true;\r\n }\r\n private _createSurface(): void {\r\n var surface = new Mesh(\"surface\", this._scene);\r\n var positions = [];\r\n var indices = [];\r\n for (let row = 0; row < this._coords.length; row++) {\r\n const rowCoords = this._coords[row];\r\n for (let column = 0; column < rowCoords.length; column++) {\r\n const coord = rowCoords[column];\r\n positions.push(\r\n column * this.xScale,\r\n coord * this.yScale,\r\n row * this.zScale\r\n );\r\n if (row < this._coords.length - 1 && column < rowCoords.length - 1) {\r\n indices.push(\r\n column + row * rowCoords.length,\r\n rowCoords.length + row * rowCoords.length + column,\r\n column + row * rowCoords.length + 1,\r\n column + row * rowCoords.length + 1,\r\n rowCoords.length + row * rowCoords.length + column,\r\n rowCoords.length + row * rowCoords.length + column + 1\r\n );\r\n }\r\n }\r\n }\r\n var colors = [];\r\n for (let i = 0; i < this._coordColors.length; i++) {\r\n const hex = this._coordColors[i];\r\n let rgba = chroma(hex).rgba();\r\n colors.push(rgba[0] / 255, rgba[1] / 255, rgba[2] / 255, rgba[3]);\r\n }\r\n var normals = [];\r\n var vertexData = new VertexData();\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n vertexData.colors = colors;\r\n vertexData.normals = normals;\r\n vertexData.applyToMesh(surface);\r\n var mat = new StandardMaterial(\"surfaceMat\", this._scene);\r\n mat.backFaceCulling = false;\r\n mat.alpha = 1;\r\n surface.material = mat;\r\n this.mesh = surface;\r\n Object.defineProperty(this, \"alpha\", {\r\n set(newAlpha) {\r\n this.mesh.material.alpha = newAlpha;\r\n }\r\n });\r\n }\r\n}\r\n","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { ArcRotateCamera } from \"@babylonjs/core/Cameras/arcRotateCamera\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { LinesBuilder } from \"@babylonjs/core/Meshes/Builders/linesBuilder\";\r\nimport { LinesMesh } from \"@babylonjs/core/Meshes/linesMesh\";\r\nimport { Vector3, Axis, Color3} from \"@babylonjs/core/Maths/math\";\r\nimport { DynamicTexture } from \"@babylonjs/core/Materials/Textures/dynamicTexture\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { AxisData } from \"../babyplots\";\r\n\r\n/**\r\n * Class to store and update plot axes.\r\n */\r\nexport class Axes {\r\n private _axes: LinesMesh[] = [];\r\n private _axisLabels: Mesh[] = [];\r\n private _ticks: LinesMesh[] = [];\r\n private _tickLabels: Mesh[] = [];\r\n private _tickLines: LinesMesh[] = [];\r\n private _scene: Scene;\r\n axisData: AxisData;\r\n /**\r\n * Create axes for plot.\r\n * @param axisData object containing all information about axis setup.\r\n * @param scene BABYLON scene.\r\n */\r\n constructor(axisData: AxisData, scene: Scene, heatmap: boolean = false) {\r\n this.axisData = axisData;\r\n this._scene = scene;\r\n this._createAxes(heatmap);\r\n }\r\n private _roundTicks(num: number, scale: number = 2): number {\r\n if (!(\"\" + num).includes(\"e\")) {\r\n return +(Math.round(parseFloat(num.toString() + \"e+\" + scale.toString())) + \"e-\" + scale);\r\n }\r\n else {\r\n var arr = (\"\" + num).split(\"e\");\r\n var sig = \"\";\r\n if (+arr[1] + scale > 0) {\r\n sig = \"+\";\r\n }\r\n return +(Math.round(parseFloat(+arr[0].toString() + \"e\" + sig.toString() + (+arr[1].toString() + scale.toString()))) + \"e-\" + scale);\r\n }\r\n }\r\n private _createAxes(heatmap: boolean = false): void {\r\n if (heatmap) {\r\n // Tick breaks for heat map on x and z coordinates have to match columns and rows\r\n this.axisData.tickBreaks[0] = 1;\r\n this.axisData.tickBreaks[2] = 1;\r\n }\r\n // Apply scaling factor to tick break interval to get distance between ticks\r\n let xtickBreaks = this.axisData.tickBreaks[0] * this.axisData.scale[0];\r\n let ytickBreaks = this.axisData.tickBreaks[1] * this.axisData.scale[1];\r\n let ztickBreaks = this.axisData.tickBreaks[2] * this.axisData.scale[2];\r\n // Find minima and maxima of the axes as a multiple of the tick interval distance\r\n let xmin = Math.floor(this.axisData.range[0][0] / xtickBreaks) * xtickBreaks;\r\n let ymin = Math.floor(this.axisData.range[1][0] / ytickBreaks) * ytickBreaks;\r\n let zmin = Math.floor(this.axisData.range[2][0] / ztickBreaks) * ztickBreaks;\r\n let xmax = Math.ceil(this.axisData.range[0][1] / xtickBreaks) * xtickBreaks;\r\n let ymax = Math.ceil(this.axisData.range[1][1] / ytickBreaks) * ytickBreaks;\r\n let zmax = Math.ceil(this.axisData.range[2][1] / ztickBreaks) * ztickBreaks;\r\n // Create X axis\r\n if (this.axisData.showAxes[0]) {\r\n // Create axis line\r\n let axisX = LinesBuilder.CreateLines(\"axisX\", {\r\n points: [\r\n new Vector3(xmin, ymin, zmin),\r\n new Vector3(xmax, ymin, zmin)\r\n ]\r\n }, this._scene);\r\n // Apply axis color\r\n axisX.color = Color3.FromHexString(this.axisData.color[0]);\r\n axisX.isPickable = false;\r\n this._axes.push(axisX);\r\n // Create axis label\r\n let xChar = this._makeTextPlane(this.axisData.axisLabels[0], 1, this.axisData.color[0]);\r\n // Place label near end of the axis\r\n xChar.position = new Vector3(xmax / 2, ymin - 0.5 * ymax, zmin);\r\n xChar.isPickable = false;\r\n this._axisLabels.push(xChar);\r\n // Create ticks and tick lines\r\n let xTicks = [];\r\n // Find x coordinates for ticks\r\n // Negative ticks\r\n for (let i = 0; i < -Math.ceil(this.axisData.range[0][0] / xtickBreaks); i++) {\r\n xTicks.push(-(i + 1) * xtickBreaks);\r\n }\r\n // Positive ticks\r\n for (let i = 0; i <= Math.ceil(this.axisData.range[0][1] / xtickBreaks); i++) {\r\n xTicks.push(i * xtickBreaks);\r\n }\r\n // Usually ticks start with 0, heat map starts with 1\r\n let startTick = 0;\r\n if (heatmap) {\r\n startTick = 1;\r\n }\r\n // Create all ticks\r\n for (let i = startTick; i < xTicks.length; i++) {\r\n let tickPos = xTicks[i];\r\n if (heatmap) {\r\n tickPos = tickPos - 0.5 * this.axisData.scale[0];\r\n }\r\n let tick = LinesBuilder.CreateLines(\"xTicks\", {\r\n points: [\r\n new Vector3(tickPos, ymin, zmin + 0.05 * xmax),\r\n new Vector3(tickPos, ymin, zmin),\r\n new Vector3(tickPos, ymin + 0.05 * ymax, zmin)\r\n ]\r\n }, this._scene);\r\n tick.color = Color3.FromHexString(this.axisData.color[0]);\r\n tick.isPickable = false;\r\n this._ticks.push(tick);\r\n let tickLabel = this._roundTicks(tickPos / this.axisData.scale[0]).toString();\r\n if (heatmap) {\r\n tickLabel = this.axisData.colnames[i - 1];\r\n }\r\n if (tickLabel === undefined) {\r\n continue;\r\n }\r\n let tickChar = this._makeTextPlane(tickLabel, 0.6, this.axisData.color[0]);\r\n tickChar.position = new Vector3(tickPos, ymin - 0.1 * ymax, zmin);\r\n tickChar.isPickable = false;\r\n this._tickLabels.push(tickChar);\r\n if (this.axisData.showTickLines[0][0]) {\r\n let tickLine = LinesBuilder.CreateLines(\"xTickLines\", {\r\n points: [\r\n new Vector3(tickPos, ymax, zmin),\r\n new Vector3(tickPos, ymin, zmin)\r\n ]\r\n }, this._scene);\r\n tickLine.color = Color3.FromHexString(this.axisData.tickLineColor[0][0]);\r\n tickLine.isPickable = false;\r\n this._tickLines.push(tickLine);\r\n }\r\n if (this.axisData.showTickLines[0][1]) {\r\n let tickLine = LinesBuilder.CreateLines(\"xTickLines\", {\r\n points: [\r\n new Vector3(tickPos, ymin, zmax),\r\n new Vector3(tickPos, ymin, zmin)\r\n ]\r\n }, this._scene);\r\n tickLine.color = Color3.FromHexString(this.axisData.tickLineColor[0][1]);\r\n tickLine.isPickable = false;\r\n this._tickLines.push(tickLine);\r\n }\r\n }\r\n }\r\n // create Y axis\r\n if (this.axisData.showAxes[1]) {\r\n // axis\r\n let axisY = LinesBuilder.CreateLines(\"axisY\", {\r\n points: [\r\n new Vector3(xmin, ymin, zmin),\r\n new Vector3(xmin, ymax, zmin)\r\n ]\r\n }, this._scene);\r\n axisY.color = Color3.FromHexString(this.axisData.color[1]);\r\n axisY.isPickable = false;\r\n this._axes.push(axisY);\r\n // label\r\n let yChar = this._makeTextPlane(this.axisData.axisLabels[1], 1, this.axisData.color[1]);\r\n yChar.position = new Vector3(xmin, ymax / 2, zmin - 0.5 * ymax);\r\n yChar.isPickable = false;\r\n this._axisLabels.push(yChar);\r\n // y ticks and tick lines\r\n let yTicks = [];\r\n for (let i = 0; i < -Math.ceil(this.axisData.range[1][0] / ytickBreaks); i++) {\r\n yTicks.push(-(i + 1) * ytickBreaks);\r\n }\r\n for (let i = 0; i <= Math.ceil(this.axisData.range[1][1] / ytickBreaks); i++) {\r\n yTicks.push(i * ytickBreaks);\r\n }\r\n for (let i = 0; i < yTicks.length; i++) {\r\n let tickPos = yTicks[i];\r\n let tick = LinesBuilder.CreateLines(\"yTicks\", {\r\n points: [\r\n new Vector3(xmin, tickPos, zmin + 0.05 * zmax),\r\n new Vector3(xmin, tickPos, zmin),\r\n new Vector3(xmin + 0.05 * xmax, tickPos, zmin)\r\n ]\r\n }, this._scene);\r\n tick.color = Color3.FromHexString(this.axisData.color[1]);\r\n tick.isPickable = false;\r\n this._ticks.push(tick);\r\n let tickLabel = this._roundTicks(tickPos / this.axisData.scale[1]);\r\n let tickChar = this._makeTextPlane(tickLabel.toString(), 0.6, this.axisData.color[1]);\r\n tickChar.position = new Vector3(xmin, tickPos, zmin - 0.05 * ymax);\r\n tickChar.isPickable = false;\r\n this._tickLabels.push(tickChar);\r\n // tick lines\r\n if (this.axisData.showTickLines[1][0]) {\r\n let tickLine = LinesBuilder.CreateLines(\"yTicksLines\", {\r\n points: [\r\n new Vector3(xmax, tickPos, zmin),\r\n new Vector3(xmin, tickPos, zmin)\r\n ]\r\n }, this._scene);\r\n tickLine.color = Color3.FromHexString(this.axisData.tickLineColor[1][0]);\r\n tickLine.isPickable = false;\r\n this._tickLines.push(tickLine);\r\n }\r\n if (this.axisData.showTickLines[1][1]) {\r\n let tickLine = LinesBuilder.CreateLines(\"yTickLines\", {\r\n points: [\r\n new Vector3(xmin, tickPos, zmax),\r\n new Vector3(xmin, tickPos, zmin)\r\n ]\r\n }, this._scene);\r\n tickLine.color = Color3.FromHexString(this.axisData.tickLineColor[1][1]);\r\n tickLine.isPickable = false;\r\n this._tickLines.push(tickLine);\r\n }\r\n }\r\n }\r\n // create Z axis\r\n if (this.axisData.showAxes[2]) {\r\n // axis\r\n let axisZ = LinesBuilder.CreateLines(\"axisZ\", {\r\n points: [\r\n new Vector3(xmin, ymin, zmin),\r\n new Vector3(xmin, ymin, zmax)\r\n ]\r\n }, this._scene);\r\n axisZ.color = Color3.FromHexString(this.axisData.color[2]);\r\n axisZ.isPickable = false;\r\n this._axes.push(axisZ);\r\n // label\r\n let zChar = this._makeTextPlane(this.axisData.axisLabels[2], 1, this.axisData.color[2]);\r\n zChar.position = new Vector3(xmin, ymin - 0.5 * ymax, zmax / 2);\r\n zChar.isPickable = false;\r\n this._axisLabels.push(zChar);\r\n // z ticks and tick lines\r\n let zTicks = [];\r\n for (let i = 0; i < -Math.ceil(this.axisData.range[2][0] / ztickBreaks); i++) {\r\n zTicks.push(-(i + 1) * ztickBreaks);\r\n }\r\n for (let i = 0; i <= Math.ceil(this.axisData.range[2][1] / ztickBreaks); i++) {\r\n zTicks.push(i * ztickBreaks);\r\n }\r\n let startTick = 0;\r\n if (heatmap) {\r\n startTick = 1;\r\n }\r\n for (let i = startTick; i < zTicks.length; i++) {\r\n let tickPos = zTicks[i];\r\n if (heatmap) {\r\n tickPos = tickPos - 0.5 * this.axisData.scale[2];\r\n }\r\n let tick = LinesBuilder.CreateLines(\"zTicks\", {\r\n points: [\r\n new Vector3(xmin + 0.05 * xmax, ymin, tickPos),\r\n new Vector3(xmin, ymin, tickPos),\r\n new Vector3(xmin, ymin + 0.05 * ymax, tickPos)\r\n ]\r\n }, this._scene);\r\n tick.color = Color3.FromHexString(this.axisData.color[2]);\r\n tick.isPickable = false;\r\n this._ticks.push(tick);\r\n let tickLabel = this._roundTicks(tickPos / this.axisData.scale[2]).toString();\r\n if (heatmap) {\r\n tickLabel = this.axisData.rownames[i - 1];\r\n }\r\n if (tickLabel === undefined) {\r\n continue;\r\n }\r\n let tickChar = this._makeTextPlane(tickLabel, 0.6, this.axisData.color[2]);\r\n tickChar.position = new Vector3(xmin, ymin - 0.1 * ymax, tickPos);\r\n tickChar.isPickable = false;\r\n this._tickLabels.push(tickChar);\r\n // tick lines\r\n if (this.axisData.showTickLines[2][0]) {\r\n let tickLine = LinesBuilder.CreateLines(\"zTickLines\", {\r\n points: [\r\n new Vector3(xmax, ymin, tickPos),\r\n new Vector3(xmin, ymin, tickPos)\r\n ]\r\n }, this._scene);\r\n tickLine.color = Color3.FromHexString(this.axisData.tickLineColor[2][0]);\r\n tickLine.isPickable = false;\r\n this._tickLines.push(tickLine);\r\n }\r\n if (this.axisData.showTickLines[2][1]) {\r\n let tickLine = LinesBuilder.CreateLines(\"zTickLines\", {\r\n points: [\r\n new Vector3(xmin, ymax, tickPos),\r\n new Vector3(xmin, ymin, tickPos)\r\n ]\r\n }, this._scene);\r\n tickLine.color = Color3.FromHexString(this.axisData.tickLineColor[2][1]);\r\n tickLine.isPickable = false;\r\n this._tickLines.push(tickLine);\r\n }\r\n }\r\n }\r\n }\r\n private _makeTextPlane(text: string, size: number, color: string): Mesh {\r\n var dynamicTexture = new DynamicTexture(\"DynamicTexture\", 75, this._scene, true);\r\n dynamicTexture.hasAlpha = true;\r\n dynamicTexture.drawText(text, 5, 40, (40 - text.length * 4) + \"px Arial\", color, \"transparent\", true);\r\n var plane = Mesh.CreatePlane(\"TextPlane\", size, this._scene, true);\r\n var material = new StandardMaterial(\"TextPlaneMaterial\", this._scene);\r\n material.backFaceCulling = false;\r\n material.specularColor = new Color3(0, 0, 0);\r\n material.diffuseTexture = dynamicTexture;\r\n plane.material = material;\r\n return plane;\r\n }\r\n update(camera: ArcRotateCamera, updateAxisData?: boolean): void {\r\n if (updateAxisData) {\r\n for (let i = 0; i < this._axes.length; i++) {\r\n this._axes[i].dispose();\r\n }\r\n for (let i = 0; i < this._axisLabels.length; i++) {\r\n this._axisLabels[i].dispose();\r\n }\r\n for (let i = 0; i < this._ticks.length; i++) {\r\n this._ticks[i].dispose();\r\n }\r\n for (let i = 0; i < this._tickLabels.length; i++) {\r\n this._tickLabels[i].dispose();\r\n }\r\n for (let i = 0; i < this._tickLines.length; i++) {\r\n this._tickLines[i].dispose();\r\n }\r\n this._createAxes();\r\n }\r\n if (this.axisData.showAxes) {\r\n let axis1 = Vector3.Cross(camera.position, Axis.Y);\r\n let axis2 = Vector3.Cross(axis1, camera.position);\r\n let axis3 = Vector3.Cross(axis1, axis2);\r\n for (let i = 0; i < this._axisLabels.length; i++) {\r\n this._axisLabels[i].rotation = Vector3.RotationFromAxis(axis1, axis2, axis3);\r\n }\r\n for (let i = 0; i < this._tickLabels.length; i++) {\r\n this._tickLabels[i].rotation = Vector3.RotationFromAxis(axis1, axis2, axis3);\r\n }\r\n }\r\n }\r\n}\r\n","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { ArcRotateCamera } from \"@babylonjs/core/Cameras/arcRotateCamera\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { Vector3, Axis, Color3 } from \"@babylonjs/core/Maths/math\";\r\nimport { PlaneBuilder } from \"@babylonjs/core/Meshes/Builders/planeBuilder\";\r\nimport { PointerDragBehavior } from \"@babylonjs/core/Behaviors/Meshes/pointerDragBehavior\";\r\nimport { AdvancedDynamicTexture } from \"@babylonjs/gui/2D/advancedDynamicTexture\";\r\nimport { Button, Rectangle, TextBlock } from \"@babylonjs/gui/2D/controls\";\r\nimport { LinesBuilder } from \"@babylonjs/core/Meshes/Builders/linesBuilder\";\r\nimport { LinesMesh } from \"@babylonjs/core/Meshes/linesMesh\";\r\nimport { CylinderBuilder } from \"@babylonjs/core/Meshes/Builders/cylinderBuilder\";\r\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\r\nimport chroma from \"chroma-js\";\r\n\r\nclass Arrow {\r\n private _lines: LinesMesh;\r\n private _tip: Mesh;\r\n\r\n size: number = 1;\r\n\r\n constructor(from: Vector3, to: Vector3, scene: Scene, color?: string) {\r\n let lines = LinesBuilder.CreateLineSystem('ls', {\r\n lines: [[from, to]],\r\n updatable: true\r\n }, scene);\r\n\r\n lines.color = new Color3(0, 0, 0);\r\n if (color !== undefined) {\r\n lines.color = Color3.FromHexString(color);\r\n }\r\n this._lines = lines;\r\n let tip = CylinderBuilder.CreateCylinder(\"tip\", {\r\n diameterTop: 0,\r\n diameterBottom: this.size,\r\n tessellation: 36\r\n }, scene);\r\n tip.position = to;\r\n this._tip = tip;\r\n\r\n }\r\n}\r\n\r\nclass dpInfo {\r\n private _background: Rectangle;\r\n private _textBlock: TextBlock;\r\n private _text: string;\r\n private _bgColor: string;\r\n private _txtColor: string;\r\n private _uiLayer: AdvancedDynamicTexture;\r\n private _closeBtn: Button;\r\n \r\n target: TransformNode;\r\n disposed: boolean = false;\r\n\r\n constructor(text: string, target: TransformNode, uiLayer: AdvancedDynamicTexture, backgroundColor: string, color: string) {\r\n this._bgColor = backgroundColor;\r\n this._txtColor = color;\r\n this.target = target;\r\n this._uiLayer = uiLayer;\r\n this._text = text;\r\n this.draw();\r\n }\r\n\r\n draw() {\r\n this.disposed = false;\r\n this._background = new Rectangle();\r\n this._uiLayer.addControl(this._background);\r\n let rows = this._text.split(\"\\n\");\r\n let maxRowLen = 0;\r\n for (let i = 0; i < rows.length; i++) {\r\n const row = rows[i];\r\n if (row.length > maxRowLen) {\r\n maxRowLen = row.length;\r\n }\r\n }\r\n let fontSize = 12;\r\n this._background.widthInPixels = maxRowLen * fontSize + 6;\r\n this._background.heightInPixels = rows.length * (fontSize + 4) + 6;\r\n this._background.linkWithMesh(this.target);\r\n this._background.background = this._bgColor;\r\n this._background.alpha = 0.8;\r\n this._background.linkOffsetY = -10;\r\n this._textBlock = new TextBlock();\r\n this._textBlock.text = this._text;\r\n this._textBlock.fontSize = fontSize;\r\n this._textBlock.color = this._txtColor;\r\n this._background.addControl(this._textBlock);\r\n this._closeBtn = Button.CreateSimpleButton(\"close\", \"x\");\r\n this._background.addControl(this._closeBtn);\r\n this._closeBtn.topInPixels = -this._background.heightInPixels/2 + 10;\r\n this._closeBtn.leftInPixels = this._background.widthInPixels/2 - 10;\r\n this._closeBtn.widthInPixels = 20;\r\n this._closeBtn.heightInPixels = 20;\r\n this._closeBtn.fontSize = 10;\r\n this._closeBtn.background = this._txtColor;\r\n this._closeBtn.color = this._bgColor\r\n this._closeBtn.onPointerClickObservable.add((function () {\r\n this.dispose();\r\n }).bind(this));\r\n\r\n }\r\n\r\n dispose() {\r\n if (this._textBlock) {\r\n this._textBlock.dispose();\r\n this._textBlock = undefined;\r\n }\r\n if (this._background) {\r\n this._background.dispose();\r\n this._background = undefined;\r\n }\r\n if (this._closeBtn) {\r\n this._closeBtn.dispose();\r\n this._closeBtn = undefined;\r\n }\r\n this.disposed = true;\r\n }\r\n}\r\n\r\nclass Label {\r\n private _label: Mesh;\r\n private _background: Rectangle;\r\n private _text: TextBlock;\r\n\r\n size: number = 100;\r\n color: string = \"black\";\r\n fixed: boolean = false;\r\n\r\n constructor(text: string, position: Vector3, scene: Scene, color?: string, size?: number) {\r\n if (size !== undefined) {\r\n this.size = size;\r\n }\r\n let plane = PlaneBuilder.CreatePlane('label', {\r\n width: this.size * 0.05,\r\n height: this.size * 0.05\r\n }, scene);\r\n\r\n if (color !== undefined) {\r\n this.color = color;\r\n }\r\n\r\n plane.position = position;\r\n\r\n let advancedTexture = AdvancedDynamicTexture.CreateForMesh(plane);\r\n\r\n let background = new Rectangle();\r\n background.color = \"red\";\r\n background.alpha = 0\r\n advancedTexture.addControl(background);\r\n this._background = background;\r\n\r\n let textBlock = new TextBlock();\r\n textBlock.text = text;\r\n textBlock.color = this.color;\r\n textBlock.fontSize = this.size;\r\n advancedTexture.addControl(textBlock);\r\n this._text = textBlock;\r\n\r\n if (!this.fixed) {\r\n makeDraggable(plane);\r\n }\r\n\r\n this._label = plane;\r\n }\r\n\r\n setText(text: string) {\r\n this._text.text = text;\r\n }\r\n\r\n update(camera: ArcRotateCamera, scene: Scene) {\r\n // draw 3d labels in plot\r\n let axis1 = Vector3.Cross(camera.position, Axis.Y);\r\n let axis2 = Vector3.Cross(axis1, camera.position);\r\n let axis3 = Vector3.Cross(axis1, axis2);\r\n this._label.rotation = Vector3.RotationFromAxis(axis1, axis2, axis3);\r\n\r\n if (!this.fixed) {\r\n // highlighting label under mouse cursor\r\n const meshUnderPointer = scene.meshUnderPointer as Mesh;\r\n if (this._label === meshUnderPointer) {\r\n this._background.alpha = 1;\r\n } else {\r\n this._background.alpha = 0;\r\n }\r\n }\r\n }\r\n\r\n fix() {\r\n this._label.removeBehavior(this._label.getBehaviorByName(\"PointerDrag\"));\r\n this.fixed = true;\r\n }\r\n\r\n unfix() {\r\n makeDraggable(this._label);\r\n this.fixed = false;\r\n }\r\n\r\n dispose() {\r\n this._text.dispose();\r\n this._background.dispose();\r\n this._label.dispose();\r\n }\r\n\r\n export(): [number, number, number, string] {\r\n return [\r\n this._label.position.x,\r\n this._label.position.y,\r\n this._label.position.z,\r\n this._text.text\r\n ]\r\n }\r\n}\r\n\r\nexport class AnnotationManager {\r\n private _canvas: HTMLCanvasElement;\r\n private _scene: Scene;\r\n private _ymax: number;\r\n private _camera: ArcRotateCamera;\r\n private _labelControlBox: HTMLDivElement;\r\n private _editLabelContainer: HTMLDivElement;\r\n private _editLabelForms: HTMLDivElement[] = [];\r\n private _addLabelTextInput: HTMLInputElement;\r\n private _showLabels: boolean = false;\r\n private _arrows: Arrow[] = [];\r\n private _showArrows: boolean = false;\r\n private _bgColor: string;\r\n private _fgColor: string;\r\n private _fullScreenUI: AdvancedDynamicTexture;\r\n private _uniqID: string;\r\n \r\n dpInfos: dpInfo[] = [];\r\n labels: Label[] = [];\r\n fixedLabels: boolean = false;\r\n fixedArrows: boolean = false;\r\n\r\n constructor(canvas: HTMLCanvasElement, scene: Scene, ymax: number, camera: ArcRotateCamera, backgroundColor: string, fullScreenUI: AdvancedDynamicTexture, uniqID: string) {\r\n this._canvas = canvas;\r\n this._scene = scene;\r\n this._ymax = ymax;\r\n this._camera = camera;\r\n this._bgColor = backgroundColor;\r\n this._fgColor = \"white\";\r\n this._fullScreenUI = fullScreenUI;\r\n this._uniqID = uniqID;\r\n if (chroma(backgroundColor).luminance() > 0.5) {\r\n this._fgColor = \"black\";\r\n }\r\n this._createLabelForms();\r\n }\r\n\r\n private _createLabelForms() {\r\n let labelBox = document.createElement(\"div\");\r\n labelBox.id = \"labelControl_\" + this._uniqID;\r\n labelBox.className = \"bbp label-control\";\r\n labelBox.style.display = \"none\";\r\n labelBox.style.top = this._canvas.clientTop + 40 + \"px\";\r\n labelBox.style.left = this._canvas.clientTop + 5 + \"px\";\r\n let addLabelForm = document.createElement(\"div\");\r\n addLabelForm.className = \"label-form\";\r\n let addLabelLabel = document.createElement(\"label\");\r\n addLabelLabel.innerText = \"Label Text:\";\r\n addLabelLabel.htmlFor = \"addLabelInput\";\r\n let addLabelInput = document.createElement(\"input\");\r\n addLabelInput.name = \"addLabelInput\";\r\n addLabelInput.type = \"text\";\r\n this._addLabelTextInput = addLabelInput;\r\n let addLabelBtn = document.createElement(\"button\");\r\n addLabelBtn.innerText = \"Add Label\";\r\n addLabelBtn.onclick = this._addLabelBtnClick.bind(this);\r\n addLabelForm.appendChild(addLabelLabel);\r\n addLabelForm.appendChild(addLabelInput);\r\n addLabelForm.appendChild(addLabelBtn);\r\n labelBox.appendChild(addLabelForm);\r\n let editLabelContainer = document.createElement(\"div\");\r\n editLabelContainer.className = \"edit-container\";\r\n editLabelContainer.style.maxHeight = (this._canvas.height - 100).toString() + \"px\";\r\n labelBox.appendChild(editLabelContainer);\r\n this._editLabelContainer = editLabelContainer;\r\n this._labelControlBox = labelBox;\r\n this._canvas.parentNode.appendChild(labelBox);\r\n }\r\n\r\n update() {\r\n if (this._showArrows) {\r\n\r\n }\r\n if (this._showLabels) {\r\n for (let i = 0; i < this.labels.length; i++) {\r\n const label = this.labels[i];\r\n label.update(this._camera, this._scene);\r\n }\r\n }\r\n }\r\n\r\n toggleLabelControl() {\r\n if (this._labelControlBox.style.display == \"none\") {\r\n this._labelControlBox.style.display = \"block\";\r\n this.unfixLabels();\r\n } else {\r\n this._labelControlBox.style.display = \"none\";\r\n this.fixLabels();\r\n }\r\n }\r\n\r\n private _addLabelBtnClick(event: Event) {\r\n event.preventDefault();\r\n this.addLabel(this._addLabelTextInput.value);\r\n }\r\n\r\n addArrow(from: number[], to: number[]) {\r\n this._arrows.push(new Arrow(\r\n Vector3.FromArray(from),\r\n Vector3.FromArray(to),\r\n this._scene\r\n ));\r\n }\r\n\r\n redrawInfo() {\r\n for (let i = this.dpInfos.length - 1; i >= 0; i--) {\r\n const dpInfo = this.dpInfos[i];\r\n if (dpInfo.disposed) {\r\n this.dpInfos.splice(i, 1);\r\n } else {\r\n dpInfo.dispose();\r\n dpInfo.draw();\r\n }\r\n }\r\n }\r\n\r\n displayInfo(text: string, target: TransformNode) {\r\n let alreadyShown = false;\r\n for (let i = 0; i < this.dpInfos.length; i++) {\r\n const dpInfo = this.dpInfos[i];\r\n if (dpInfo.target === target) {\r\n alreadyShown = true;\r\n if (dpInfo.disposed) {\r\n dpInfo.draw();\r\n }\r\n }\r\n }\r\n if (!alreadyShown) {\r\n this.dpInfos.push(new dpInfo(text, target, this._fullScreenUI, this._bgColor, this._fgColor));\r\n }\r\n }\r\n\r\n clearInfo() {\r\n for (let i = 0; i < this.dpInfos.length; i++) {\r\n this.dpInfos[i].dispose();\r\n }\r\n this.dpInfos = [];\r\n }\r\n\r\n /**\r\n * Add a 3d label to the plot\r\n * @param text Label title\r\n * @param [moveCallback] On dragging of label in 3d plot, the final position will be passed to this function\r\n */\r\n addLabel(text: string, position?: number[], color?: string, size?: number): number {\r\n this._addLabelTextInput.value = \"\";\r\n let labelIdx = this.labels.length;\r\n\r\n let pos: Vector3;\r\n if (position) {\r\n pos = Vector3.FromArray(position)\r\n } else {\r\n pos = new Vector3(0, this._ymax + 2, 0);\r\n }\r\n\r\n text = text.replace(/[\\s\\.]/g, \"\\n\");\r\n text = text.replace(/_/g, \" \");\r\n let col = this._fgColor;\r\n if (color !== undefined) {\r\n col = color;\r\n }\r\n let newLabel = new Label(text, pos, this._scene, col, size);\r\n\r\n this.labels.push(newLabel);\r\n\r\n let editLabelForm = document.createElement(\"div\");\r\n editLabelForm.className = \"label-form\";\r\n let editLabelLabel = document.createElement(\"label\");\r\n editLabelLabel.innerText = \"Edit Label Text:\";\r\n editLabelLabel.htmlFor = \"editLabelInput\";\r\n editLabelForm.appendChild(editLabelLabel);\r\n let editLabelInput = document.createElement(\"input\");\r\n editLabelInput.name = \"editLabelInput\";\r\n editLabelInput.type = \"text\";\r\n editLabelInput.value = text;\r\n editLabelInput.dataset.labelnum = labelIdx.toString();\r\n editLabelInput.onkeyup = this._editLabelText.bind(this);\r\n editLabelForm.appendChild(editLabelInput);\r\n let rmvLabelBtn = document.createElement(\"button\");\r\n rmvLabelBtn.innerText = \"Remove Label\"\r\n rmvLabelBtn.onclick = this._removeLabel.bind(this);\r\n rmvLabelBtn.dataset.labelnum = labelIdx.toString();\r\n editLabelForm.appendChild(rmvLabelBtn);\r\n editLabelForm.dataset.labelnum = labelIdx.toString();\r\n this._editLabelForms.push(editLabelForm);\r\n this._editLabelContainer.appendChild(editLabelForm);\r\n\r\n this._showLabels = true;\r\n return labelIdx;\r\n }\r\n\r\n /**\r\n * Add multiple labels from a list of labels.\r\n * \r\n * @param labelList List of lists with the first three elements of the inner lists being the x, y and z coordinates, and the fourth the label text.\r\n */\r\n addLabels(labelList: [[number, number, number, string]]): void {\r\n for (let i = 0; i < labelList.length; i++) {\r\n const label = labelList[i];\r\n let text = label[3];\r\n let position = label.slice(0, 3) as number[];\r\n this.addLabel(text, position);\r\n }\r\n }\r\n\r\n private _editLabelText(ev: Event): void {\r\n let inputElem = ev.target as HTMLInputElement;\r\n this.labels[parseInt(inputElem.dataset.labelnum)].setText(inputElem.value);\r\n }\r\n\r\n private _removeLabel(ev: Event) {\r\n let btn = ev.target as HTMLButtonElement;\r\n let labelNum = parseInt(btn.dataset.labelnum);\r\n this.labels[labelNum].dispose();\r\n this.labels.splice(labelNum, 1);\r\n let thisForm: HTMLDivElement;\r\n this._editLabelForms.forEach(eLabelForm => {\r\n if (parseInt(eLabelForm.dataset.labelnum) == labelNum) {\r\n thisForm = eLabelForm;\r\n } else if (parseInt(eLabelForm.dataset.labelnum) > labelNum) {\r\n let oldNum = parseInt(eLabelForm.dataset.labelnum)\r\n let newNum = (oldNum - 1).toString()\r\n eLabelForm.dataset.labelnum = newNum;\r\n let oInput = eLabelForm.querySelector('input[data-labelnum=\"' + oldNum + '\"]') as HTMLInputElement;\r\n oInput.dataset.labelnum = newNum;\r\n let oBtn = eLabelForm.querySelector('button[data-labelnum=\"' + oldNum + '\"]') as HTMLButtonElement;\r\n oBtn.dataset.labelnum = newNum;\r\n }\r\n });\r\n thisForm.parentNode.removeChild(thisForm);\r\n }\r\n\r\n exportLabels(): any[] {\r\n let labels = [];\r\n for (let i = 0; i < this.labels.length; i++) {\r\n labels.push(this.labels[i].export());\r\n }\r\n return labels;\r\n }\r\n\r\n fixLabels() {\r\n for (let i = 0; i < this.labels.length; i++) {\r\n this.labels[i].fix();\r\n }\r\n this.fixedLabels = true;\r\n }\r\n\r\n unfixLabels() {\r\n for (let i = 0; i < this.labels.length; i++) {\r\n this.labels[i].unfix();\r\n }\r\n this.fixedLabels = false;\r\n }\r\n}\r\n\r\nfunction makeDraggable(label: Mesh) {\r\n let labelDragBehavior = new PointerDragBehavior();\r\n label.addBehavior(labelDragBehavior);\r\n}","\r\nexport const buttonSVGs = {\r\n logo: '',\r\n toJson: '',\r\n labels: '',\r\n publish: '',\r\n replay: '',\r\n loop: '',\r\n record: '',\r\n play: '',\r\n pause: '',\r\n loading: '',\r\n turntable: '',\r\n};\r\n\r\nexport const legendSVGs = {\r\n heatmap: '',\r\n point: '',\r\n surface: '',\r\n shape_box: '',\r\n shape_cone: '',\r\n shape_cylinder: '',\r\n shape_sphere: '',\r\n shape_torus: '',\r\n};\r\n","/*!\r\n * babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n * ---------------------------------------------\r\n * \r\n * babyplots includes CCapture.js, released under the following license:\r\n * \r\n * CCapture - A library to capture canvas-based animations\r\n * \r\n * The MIT License\r\n * \r\n * Copyright (c) 2012 Jaume Sanchez Elias\r\n * \r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n * \r\n * ---------------------------------------------\r\n * \r\n * babyplots includes axios, released under the following license:\r\n * \r\n * Copyright (c) 2014-present Matt Zabriskie\r\n * \r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n * \r\n * ---------------------------------------------\r\n * \r\n * babyplots includes uuid, released under the following license:\r\n * \r\n * The MIT License (MIT)\r\n * \r\n * Copyright (c) 2010-2020 Robert Kieffer and other contributors\r\n * \r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is furnished\r\n * to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in all\r\n * copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n * \r\n */\r\n\r\n/**\r\n * Logs a warning to the console, formatted with orange text.\r\n * @param text The warning text.\r\n */\r\nexport function warn(text:string) {\r\n console.log(`%c${text}`, \"color:orange;\");\r\n}\r\n\r\nexport function deprecationWarning(deprecated:string, alternative?: string) {\r\n if (alternative) {\r\n warn(`The use of \"${deprecated}\" is deprecated and might be removed in a future version. Please use \"${alternative}\" instead.`);\r\n } else {\r\n warn(`The use of \"${deprecated}\" is deprecated and might be removed in a future version.`);\r\n }\r\n}","\r\nexport const styleText = [\r\n \".bbp.button-bar { position: absolute; z-index: 2; overflow: hidden; padding: 0 10px 4px 0; }\",\r\n \".bbp.button-bar>.button.hidden { display: none; }\",\r\n \".bbp.button-bar>.anim-slider { display: block; float: right; width: 150px; height: 30px }\",\r\n \".bbp.button-bar>.anim-slider.hidden { display: none; }\",\r\n \".bbp.button-bar>.button { float: right; width: 75px; height: 30px; cursor: pointer; border-radius: 2px; background-color: #f0f0f0; margin: 0 4px 0 0; }\",\r\n \".bbp.button-bar>.button:hover { background-color: #ddd; }\",\r\n \".bbp.button-bar>.button>svg { width: 75px; height: 30px; }\",\r\n \".bbp.button-bar>.button.active { background-color: #afafaf; }\",\r\n \".bbp.button-bar>.button.active:hover { background-color: #9f9f9f; }\",\r\n \".bbp.button-bar>.button.streamctrl.loading { cursor: progress; }\",\r\n \".bbp.button-bar>.button.streamctrl.loading:hover { background-color: #f0f0f0; }\",\r\n \".bbp.button-bar>.button.streamctrl.loading>.btn-label.play,.bbp.button-bar>.button.streamctrl.loading>.btn-label.pause {display: none; }\",\r\n \".bbp.button-bar>.button.streamctrl.loading>.btn-label.loading {display: block; }\",\r\n \".bbp.button-bar>.button.streamctrl.play>.btn-label.pause,.bbp.button-bar>.button.streamctrl.play>.btn-label.loading {display: none; }\",\r\n \".bbp.button-bar>.button.streamctrl.play>.btn-label.play {display: block; }\",\r\n \".bbp.button-bar>.button.streamctrl.pause>.btn-label.play,.bbp.button-bar>.button.streamctrl.pause>.btn-label.loading {display: none; }\",\r\n \".bbp.button-bar>.button.streamctrl.pause>.btn-label.pause {display: block; }\",\r\n \".bbp.label-control { position: absolute; z-index: 3; font-family: sans-serif; width: 200px; background-color: #f0f0f0; padding: 5px; border-radius: 2px; }\",\r\n \".bbp.label-control>label { font-size: 11pt; }\",\r\n \".bbp.label-control>.edit-container { overflow: auto; }\",\r\n \".bbp.label-control>.edit-container>.label-form { margin-top: 5px; padding-top: 20px; border-top: solid thin #ccc; }\",\r\n \".bbp.label-control .label-form>input { width: 100%; box-sizing: border-box; }\",\r\n \".bbp.label-control .label-form>button { border: none; font-weight: bold; background-color: white; padding: 5px 10px; margin: 5px 0 2px 0; width: 100%; cursor: pointer; }\",\r\n \".bbp.label-control .label-form>button:hover { background-color: #ddd; }\",\r\n \".bbp.overlay { position: absolute; z-index: 3; overflow: hidden; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; background-color: #fff5; display: flex; justify-content: center; align-items: center;}\",\r\n \".bbp.overlay>h5.loading-message { color: #000; font-family: Verdana, sans-serif;}\",\r\n \".bbp.publish-form>label { display: block; text-align: left; font-family: Verdana, sans-serif; }\",\r\n \".bbp.publish-form>input { width: 100%; margin-bottom: 15px; box-sizing: border-box; }\",\r\n \".bbp.publish-form>.publish-btn { border: none; font-weight: bold; background-color: #e95420; color: white; padding: 5px 10px; margin: 5px 0 2px 0; width: 100%; cursor: pointer; }\",\r\n \".bbp.publish-form>.publish-btn:hover { background-color: #ca491a }\",\r\n \".bbp.publish-form>.close-btn, .bbp.publish-form>.cancel-btn { border: none; font-weight: bold; background-color: white; padding: 5px 10px; margin: 5px 0 2px 0; width: 100%; cursor: pointer; }\",\r\n \".bbp.publish-form>.close-btn:hover, .bbp.publish-form>.cancel-btn:hover { background-color: #ddd }\",\r\n \".bbp.publish-form>p.form-info { font-size: 8pt; font-family: Verdana, sans-serif; }\",\r\n \".bbp.publish-form>p.message { font-size: 10pt; font-family: Verdana, sans-serif; }\",\r\n \".bbp.publish-form>p.message.warning { color: red; margin-top: 0px; }\",\r\n \".bbp.publish-form>p.message.success { color: green; }\",\r\n].join(\" \");\r\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation. Also,\n// find the complete implementation of crypto (msCrypto) on IE11.\nvar getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);\nvar rnds8 = new Uint8Array(16);\nexport default function rng() {\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n\n return getRandomValues(rnds8);\n}","export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;","import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction stringify(arr) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import rng from './rng.js';\nimport stringify from './stringify.js'; // **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\n\nvar _clockseq; // Previous uuid creation time\n\n\nvar _lastMSecs = 0;\nvar _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details\n\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || new Array(16);\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n\n if (node == null || clockseq == null) {\n var seedBytes = options.random || (options.rng || rng)();\n\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];\n }\n\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n } // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n\n\n var msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)\n\n var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression\n\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n\n\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n } // Per 4.2.1.2 Throw error if too many uuids are requested\n\n\n if (nsecs >= 10000) {\n throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n\n msecs += 12219292800000; // `time_low`\n\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff; // `time_mid`\n\n var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff; // `time_high_and_version`\n\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n\n b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n\n b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`\n\n b[i++] = clockseq & 0xff; // `node`\n\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf || stringify(b);\n}\n\nexport default v1;","import validate from './validate.js';\n\nfunction parse(uuid) {\n if (!validate(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n var v;\n var arr = new Uint8Array(16); // Parse ########-....-....-....-............\n\n arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;\n arr[1] = v >>> 16 & 0xff;\n arr[2] = v >>> 8 & 0xff;\n arr[3] = v & 0xff; // Parse ........-####-....-....-............\n\n arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;\n arr[5] = v & 0xff; // Parse ........-....-####-....-............\n\n arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;\n arr[7] = v & 0xff; // Parse ........-....-....-####-............\n\n arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;\n arr[9] = v & 0xff; // Parse ........-....-....-....-############\n // (Use \"/\" to avoid 32-bit truncation when bit-shifting high-order bytes)\n\n arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;\n arr[11] = v / 0x100000000 & 0xff;\n arr[12] = v >>> 24 & 0xff;\n arr[13] = v >>> 16 & 0xff;\n arr[14] = v >>> 8 & 0xff;\n arr[15] = v & 0xff;\n return arr;\n}\n\nexport default parse;","import stringify from './stringify.js';\nimport parse from './parse.js';\n\nfunction stringToBytes(str) {\n str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n var bytes = [];\n\n for (var i = 0; i < str.length; ++i) {\n bytes.push(str.charCodeAt(i));\n }\n\n return bytes;\n}\n\nexport var DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexport var URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\nexport default function (name, version, hashfunc) {\n function generateUUID(value, namespace, buf, offset) {\n if (typeof value === 'string') {\n value = stringToBytes(value);\n }\n\n if (typeof namespace === 'string') {\n namespace = parse(namespace);\n }\n\n if (namespace.length !== 16) {\n throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n } // Compute hash of namespace and value, Per 4.3\n // Future: Use spread syntax when supported on all platforms, e.g. `bytes =\n // hashfunc([...namespace, ... value])`\n\n\n var bytes = new Uint8Array(16 + value.length);\n bytes.set(namespace);\n bytes.set(value, namespace.length);\n bytes = hashfunc(bytes);\n bytes[6] = bytes[6] & 0x0f | version;\n bytes[8] = bytes[8] & 0x3f | 0x80;\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = bytes[i];\n }\n\n return buf;\n }\n\n return stringify(bytes);\n } // Function#name is not settable on some platforms (#270)\n\n\n try {\n generateUUID.name = name; // eslint-disable-next-line no-empty\n } catch (err) {} // For CommonJS default export support\n\n\n generateUUID.DNS = DNS;\n generateUUID.URL = URL;\n return generateUUID;\n}","/*\n * Browser-compatible JavaScript MD5\n *\n * Modification of JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\nfunction md5(bytes) {\n if (typeof bytes === 'string') {\n var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = new Uint8Array(msg.length);\n\n for (var i = 0; i < msg.length; ++i) {\n bytes[i] = msg.charCodeAt(i);\n }\n }\n\n return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));\n}\n/*\n * Convert an array of little-endian words to an array of bytes\n */\n\n\nfunction md5ToHexEncodedArray(input) {\n var output = [];\n var length32 = input.length * 32;\n var hexTab = '0123456789abcdef';\n\n for (var i = 0; i < length32; i += 8) {\n var x = input[i >> 5] >>> i % 32 & 0xff;\n var hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);\n output.push(hex);\n }\n\n return output;\n}\n/**\n * Calculate output length with padding and bit length\n */\n\n\nfunction getOutputLength(inputLength8) {\n return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;\n}\n/*\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n */\n\n\nfunction wordsToMd5(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << len % 32;\n x[getOutputLength(len) - 1] = len;\n var a = 1732584193;\n var b = -271733879;\n var c = -1732584194;\n var d = 271733878;\n\n for (var i = 0; i < x.length; i += 16) {\n var olda = a;\n var oldb = b;\n var oldc = c;\n var oldd = d;\n a = md5ff(a, b, c, d, x[i], 7, -680876936);\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n b = md5gg(b, c, d, a, x[i], 20, -373897302);\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n d = md5hh(d, a, b, c, x[i], 11, -358537222);\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n a = md5ii(a, b, c, d, x[i], 6, -198630844);\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n a = safeAdd(a, olda);\n b = safeAdd(b, oldb);\n c = safeAdd(c, oldc);\n d = safeAdd(d, oldd);\n }\n\n return [a, b, c, d];\n}\n/*\n * Convert an array bytes to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n */\n\n\nfunction bytesToWords(input) {\n if (input.length === 0) {\n return [];\n }\n\n var length8 = input.length * 8;\n var output = new Uint32Array(getOutputLength(length8));\n\n for (var i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;\n }\n\n return output;\n}\n/*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\n\n\nfunction safeAdd(x, y) {\n var lsw = (x & 0xffff) + (y & 0xffff);\n var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return msw << 16 | lsw & 0xffff;\n}\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\n\n\nfunction bitRotateLeft(num, cnt) {\n return num << cnt | num >>> 32 - cnt;\n}\n/*\n * These functions implement the four basic operations the algorithm uses.\n */\n\n\nfunction md5cmn(q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\n\nfunction md5ff(a, b, c, d, x, s, t) {\n return md5cmn(b & c | ~b & d, a, b, x, s, t);\n}\n\nfunction md5gg(a, b, c, d, x, s, t) {\n return md5cmn(b & d | c & ~d, a, b, x, s, t);\n}\n\nfunction md5hh(a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\n\nfunction md5ii(a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\nexport default md5;","import v35 from './v35.js';\nimport md5 from './md5.js';\nvar v3 = v35('v3', 0x30, md5);\nexport default v3;","import rng from './rng.js';\nimport stringify from './stringify.js';\n\nfunction v4(options, buf, offset) {\n options = options || {};\n var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return stringify(rnds);\n}\n\nexport default v4;","// Adapted from Chris Veness' SHA1 code at\n// http://www.movable-type.co.uk/scripts/sha1.html\nfunction f(s, x, y, z) {\n switch (s) {\n case 0:\n return x & y ^ ~x & z;\n\n case 1:\n return x ^ y ^ z;\n\n case 2:\n return x & y ^ x & z ^ y & z;\n\n case 3:\n return x ^ y ^ z;\n }\n}\n\nfunction ROTL(x, n) {\n return x << n | x >>> 32 - n;\n}\n\nfunction sha1(bytes) {\n var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n\n if (typeof bytes === 'string') {\n var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = [];\n\n for (var i = 0; i < msg.length; ++i) {\n bytes.push(msg.charCodeAt(i));\n }\n } else if (!Array.isArray(bytes)) {\n // Convert Array-like to Array\n bytes = Array.prototype.slice.call(bytes);\n }\n\n bytes.push(0x80);\n var l = bytes.length / 4 + 2;\n var N = Math.ceil(l / 16);\n var M = new Array(N);\n\n for (var _i = 0; _i < N; ++_i) {\n var arr = new Uint32Array(16);\n\n for (var j = 0; j < 16; ++j) {\n arr[j] = bytes[_i * 64 + j * 4] << 24 | bytes[_i * 64 + j * 4 + 1] << 16 | bytes[_i * 64 + j * 4 + 2] << 8 | bytes[_i * 64 + j * 4 + 3];\n }\n\n M[_i] = arr;\n }\n\n M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);\n M[N - 1][14] = Math.floor(M[N - 1][14]);\n M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;\n\n for (var _i2 = 0; _i2 < N; ++_i2) {\n var W = new Uint32Array(80);\n\n for (var t = 0; t < 16; ++t) {\n W[t] = M[_i2][t];\n }\n\n for (var _t = 16; _t < 80; ++_t) {\n W[_t] = ROTL(W[_t - 3] ^ W[_t - 8] ^ W[_t - 14] ^ W[_t - 16], 1);\n }\n\n var a = H[0];\n var b = H[1];\n var c = H[2];\n var d = H[3];\n var e = H[4];\n\n for (var _t2 = 0; _t2 < 80; ++_t2) {\n var s = Math.floor(_t2 / 20);\n var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[_t2] >>> 0;\n e = d;\n d = c;\n c = ROTL(b, 30) >>> 0;\n b = a;\n a = T;\n }\n\n H[0] = H[0] + a >>> 0;\n H[1] = H[1] + b >>> 0;\n H[2] = H[2] + c >>> 0;\n H[3] = H[3] + d >>> 0;\n H[4] = H[4] + e >>> 0;\n }\n\n return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];\n}\n\nexport default sha1;","import v35 from './v35.js';\nimport sha1 from './sha1.js';\nvar v5 = v35('v5', 0x50, sha1);\nexport default v5;","export default '00000000-0000-0000-0000-000000000000';","import validate from './validate.js';\n\nfunction version(uuid) {\n if (!validate(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n return parseInt(uuid.substr(14, 1), 16);\n}\n\nexport default version;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(5420);\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://Baby/./node_modules/@babylonjs/core/Animations/animation.js","webpack://Baby/./node_modules/@babylonjs/core/Animations/animationKey.js","webpack://Baby/./node_modules/@babylonjs/core/Animations/animationRange.js","webpack://Baby/./node_modules/@babylonjs/core/Culling/ray.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/pivotTools.js","webpack://Baby/./node_modules/@babylonjs/core/Behaviors/Meshes/pointerDragBehavior.js","webpack://Baby/./node_modules/@babylonjs/core/Behaviors/Cameras/autoRotationBehavior.js","webpack://Baby/./node_modules/@babylonjs/core/Animations/easing.js","webpack://Baby/./node_modules/@babylonjs/core/Behaviors/Cameras/bouncingBehavior.js","webpack://Baby/./node_modules/@babylonjs/core/Behaviors/Cameras/framingBehavior.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/arcRotateCameraPointersInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/BaseCameraPointersInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/arcRotateCameraMouseWheelInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/arcRotateCameraInputsManager.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/arcRotateCamera.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/camera.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/cameraInputsManager.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/targetCamera.js","webpack://Baby/./node_modules/@babylonjs/core/Collisions/intersectionInfo.js","webpack://Baby/./node_modules/@babylonjs/core/Collisions/pickingInfo.js","webpack://Baby/./node_modules/@babylonjs/core/Culling/boundingBox.js","webpack://Baby/./node_modules/@babylonjs/core/Culling/boundingSphere.js","webpack://Baby/./node_modules/@babylonjs/core/Culling/boundingInfo.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.readTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.renderTarget.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.renderTargetCube.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/shaderCodeNode.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/shaderCodeCursor.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/shaderCodeConditionNode.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/shaderCodeTestNode.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/Expressions/shaderDefineExpression.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineOrOperator.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineAndOperator.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Processors/shaderProcessor.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/constants.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/performanceMonitor.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.alpha.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.dynamicBuffer.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/engine.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/engineStore.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/performanceConfigurator.js","webpack://Baby/./node_modules/@babylonjs/core/States/depthCullingState.js","webpack://Baby/./node_modules/@babylonjs/core/States/stencilState.js","webpack://Baby/./node_modules/@babylonjs/core/States/alphaCullingState.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/WebGL/webGLShaderProcessors.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/WebGL/webGL2ShaderProcessors.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/WebGL/webGLPipelineContext.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/thinEngine.js","webpack://Baby/./node_modules/@babylonjs/core/Events/clipboardEvents.js","webpack://Baby/./node_modules/@babylonjs/core/Events/keyboardEvents.js","webpack://Baby/./node_modules/@babylonjs/core/Events/pointerEvents.js","webpack://Baby/./node_modules/@babylonjs/core/Lights/hemisphericLight.js","webpack://Baby/./node_modules/@babylonjs/core/Lights/light.js","webpack://Baby/./node_modules/@babylonjs/core/Loading/sceneLoader.js","webpack://Baby/./node_modules/@babylonjs/core/Loading/sceneLoaderFlags.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/baseTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/thinTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.dynamicTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/dynamicTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/internalTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/renderTargetCreationOptions.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/renderTargetTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/copyTools.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/texture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/effect.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/effectFallbacks.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/colorCurves.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/imageProcessingConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/material.detailMapConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/material.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/materialDefines.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/materialFlags.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/thinMaterialHelper.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/materialHelper.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/multiMaterial.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/prePassConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/pushMaterial.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/shaderMaterial.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/defaultFragmentDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/defaultUboDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/lightsFragmentFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/fresnelFunction.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/default.fragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/defaultVertexDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pointCloudVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/default.vertex.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/standardMaterial.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.uniformBuffer.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/uniformBuffer.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.axis.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.color.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.constants.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.frustum.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.functions.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.vertexFormat.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.path.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.plane.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.scalar.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.size.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.vector.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/math.viewport.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/Builders/boxBuilder.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/Builders/cylinderBuilder.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/instancedMesh.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/color.fragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/color.vertex.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/linesMesh.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/Builders/linesBuilder.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/Builders/planeBuilder.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/Builders/sphereBuilder.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/Builders/torusBuilder.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/WebGL/webGLDataBuffer.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/dataBuffer.js","webpack://Baby/./node_modules/@babylonjs/core/Collisions/meshCollisionData.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/abstractMesh.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/buffer.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/geometry.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/meshLODLevel.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/mesh.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/mesh.vertexData.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/subMesh.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/thinInstanceMesh.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/transformNode.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/arrayTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/canvasGenerator.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/decorators.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/deepCopier.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/devTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/domManagement.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/retryStrategy.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/baseError.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/fileTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/filesInputStore.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/guid.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/instantiationTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/logger.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/observable.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/perfCounter.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/precisionDate.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/fxaa.fragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/fxaa.vertex.js","webpack://Baby/./node_modules/@babylonjs/core/PostProcesses/fxaaPostProcess.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/screenshotTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/smartArray.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/stringTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/andOrNotEvaluator.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/tags.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/timingTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/promise.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/tools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/typeStore.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/webRequest.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/postprocess.vertex.js","webpack://Baby/./node_modules/@babylonjs/core/PostProcesses/postProcess.js","webpack://Baby/./node_modules/@babylonjs/core/PostProcesses/postProcessManager.js","webpack://Baby/./node_modules/@babylonjs/core/Rendering/renderingGroup.js","webpack://Baby/./node_modules/@babylonjs/core/Rendering/renderingManager.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentMainFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertexDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/depthPrePass.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/helperFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/imageProcessingDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/imageProcessingFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassVertex.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassVertexDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/reflectionFunction.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/shadowsFragmentFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js","webpack://Baby/./node_modules/@babylonjs/core/abstractScene.js","webpack://Baby/./node_modules/@babylonjs/core/node.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/stringDictionary.js","webpack://Baby/./node_modules/@babylonjs/core/Actions/actionEvent.js","webpack://Baby/./node_modules/@babylonjs/core/Actions/abstractActionManager.js","webpack://Baby/./node_modules/@babylonjs/core/Inputs/scene.inputManager.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/uniqueIdGenerator.js","webpack://Baby/./node_modules/@babylonjs/core/scene.js","webpack://Baby/./node_modules/@babylonjs/core/sceneComponent.js","webpack://Baby/./node_modules/@babylonjs/core/Layers/layerSceneComponent.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/layer.fragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/layer.vertex.js","webpack://Baby/./node_modules/@babylonjs/core/Layers/layer.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/style.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/advancedDynamicTexture.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/container.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/math2D.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/control.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/rectangle.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/textBlock.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/image.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/button.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/stackPanel.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/checkbox.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/textWrapper.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/inputText.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/grid.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/colorpicker.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/ellipse.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/inputPassword.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/line.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/multiLinePoint.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/multiLine.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/radioButton.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/sliders/baseSlider.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/sliders/slider.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/selector.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/scrollViewers/scrollViewerWindow.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/sliders/scrollBar.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/sliders/imageScrollBar.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/scrollViewers/scrollViewer.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/virtualKeyboard.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/displayGrid.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/sliders/imageBasedSlider.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/controls/statics.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/measure.js","webpack://Baby/./node_modules/@babylonjs/gui/2D/valueAndUnit.js","webpack://Baby/./node_modules/@babylonjs/core/assetContainer.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/dataReader.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/glTFValidation.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/glTFFileLoader.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/1.0/glTFLoaderInterfaces.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/freeCameraKeyboardMoveInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/freeCameraMouseInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/BaseCameraMouseWheelInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/freeCameraMouseWheelInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/Inputs/freeCameraTouchInput.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/freeCameraInputsManager.js","webpack://Baby/./node_modules/@babylonjs/core/Cameras/freeCamera.js","webpack://Baby/./node_modules/@babylonjs/core/Bones/bone.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.rawTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/rawTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Bones/skeleton.js","webpack://Baby/./node_modules/@babylonjs/core/Lights/shadowLight.js","webpack://Baby/./node_modules/@babylonjs/core/Lights/directionalLight.js","webpack://Baby/./node_modules/@babylonjs/core/Lights/pointLight.js","webpack://Baby/./node_modules/@babylonjs/core/Lights/spotLight.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/1.0/glTFLoader.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/1.0/glTFLoaderUtils.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/1.0/glTFBinaryExtension.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/1.0/glTFMaterialsCommonExtension.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/deferred.js","webpack://Baby/./node_modules/@babylonjs/core/Animations/runtimeAnimation.js","webpack://Baby/./node_modules/@babylonjs/core/Animations/animatable.js","webpack://Baby/./node_modules/@babylonjs/core/Animations/animationGroup.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/rgbdDecode.fragment.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/rgbdTextureTools.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/brdfTextureTools.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/PBR/pbrClearCoatConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/PBR/pbrAnisotropicConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/PBR/pbrBRDFConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/PBR/pbrSheenConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/PBR/pbrSubSurfaceConfiguration.js","webpack://Baby/./node_modules/@babylonjs/core/Maths/sphericalPolynomial.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/baseTexture.polynomial.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrFragmentDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrUboDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/subSurfaceScatteringFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/importanceSampling.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrHelperFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/harmonicsFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDirectLightingFalloffFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBRDFFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/hdrFilteringFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDirectLightingFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrIBLFunctions.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflectivity.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAmbientOcclusion.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAlphaFresnel.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAnisotropic.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflection.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockSheen.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockClearcoat.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockSubSurface.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockNormalGeometric.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockNormalFinal.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockLightmapInit.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockGeometryInfo.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflectance0.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflectance.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockDirectLighting.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockFinalUnlitComponents.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockFinalColorComposition.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockImageProcessing.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDebug.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/pbr.fragment.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrVertexDeclaration.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/pbr.vertex.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/PBR/pbrBaseMaterial.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/PBR/pbrMaterial.js","webpack://Baby/./node_modules/@babylonjs/core/Morph/morphTarget.js","webpack://Baby/./node_modules/@babylonjs/core/Morph/morphTargetManager.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/glTFLoader.js","webpack://Baby/./node_modules/@babylonjs/core/Shaders/rgbdEncode.fragment.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/environmentTextureTools.js","webpack://Baby/./node_modules/@babylonjs/core/Engines/Extensions/engine.cubeTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/cubeTexture.js","webpack://Baby/./node_modules/@babylonjs/core/Materials/Textures/rawCubeTexture.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/EXT_lights_image_based.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/EXT_texture_webp.js","webpack://Baby/./node_modules/@babylonjs/core/Misc/workerPool.js","webpack://Baby/./node_modules/@babylonjs/core/Meshes/Compression/dracoCompression.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_draco_mesh_compression.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_lights_punctual.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_unlit.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_clearcoat.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_sheen.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_specular.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_ior.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_variants.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_transmission.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_translucency.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_mesh_quantization.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_texture_basisu.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_texture_transform.js","webpack://Baby/./node_modules/@babylonjs/core/Animations/animationEvent.js","webpack://Baby/./node_modules/@babylonjs/core/Audio/sound.js","webpack://Baby/./node_modules/@babylonjs/core/Audio/weightedsound.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_audio_emitter.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_lod.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_minecraftMesh.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_sRGBFactors.js","webpack://Baby/./node_modules/@babylonjs/loaders/glTF/2.0/Extensions/ExtrasAsMetadata.js","webpack://Baby/./node_modules/axios/index.js","webpack://Baby/./node_modules/axios/lib/adapters/xhr.js","webpack://Baby/./node_modules/axios/lib/axios.js","webpack://Baby/./node_modules/axios/lib/cancel/Cancel.js","webpack://Baby/./node_modules/axios/lib/cancel/CancelToken.js","webpack://Baby/./node_modules/axios/lib/cancel/isCancel.js","webpack://Baby/./node_modules/axios/lib/core/Axios.js","webpack://Baby/./node_modules/axios/lib/core/InterceptorManager.js","webpack://Baby/./node_modules/axios/lib/core/buildFullPath.js","webpack://Baby/./node_modules/axios/lib/core/createError.js","webpack://Baby/./node_modules/axios/lib/core/dispatchRequest.js","webpack://Baby/./node_modules/axios/lib/core/enhanceError.js","webpack://Baby/./node_modules/axios/lib/core/mergeConfig.js","webpack://Baby/./node_modules/axios/lib/core/settle.js","webpack://Baby/./node_modules/axios/lib/core/transformData.js","webpack://Baby/./node_modules/axios/lib/defaults.js","webpack://Baby/./node_modules/axios/lib/helpers/bind.js","webpack://Baby/./node_modules/axios/lib/helpers/buildURL.js","webpack://Baby/./node_modules/axios/lib/helpers/combineURLs.js","webpack://Baby/./node_modules/axios/lib/helpers/cookies.js","webpack://Baby/./node_modules/axios/lib/helpers/isAbsoluteURL.js","webpack://Baby/./node_modules/axios/lib/helpers/isAxiosError.js","webpack://Baby/./node_modules/axios/lib/helpers/isURLSameOrigin.js","webpack://Baby/./node_modules/axios/lib/helpers/normalizeHeaderName.js","webpack://Baby/./node_modules/axios/lib/helpers/parseHeaders.js","webpack://Baby/./node_modules/axios/lib/helpers/spread.js","webpack://Baby/./node_modules/axios/lib/helpers/validator.js","webpack://Baby/./node_modules/axios/lib/utils.js","webpack://Baby/./node_modules/chroma-js/chroma.js","webpack://Baby/./node_modules/downloadjs/download.js","webpack://Baby/./src/babyplots.ts","webpack://Baby/./src/plotTypes/HeatMap.ts","webpack://Baby/./src/plotTypes/ImgStack.ts","webpack://Baby/./src/plotTypes/Line.ts","webpack://Baby/./src/plotTypes/MeshObject.ts","webpack://Baby/./src/plotTypes/MeshStream.ts","webpack://Baby/./src/plotTypes/PointCloud.ts","webpack://Baby/./src/plotTypes/ShapeCloud.ts","webpack://Baby/./src/plotTypes/Surface.ts","webpack://Baby/./src/utils/Axes.ts","webpack://Baby/./src/utils/Label.ts","webpack://Baby/./src/utils/SVGs.ts","webpack://Baby/./src/utils/logging.ts","webpack://Baby/./src/utils/styleText.ts","webpack://Baby/./node_modules/tslib/tslib.es6.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/rng.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/regex.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/validate.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/stringify.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/v1.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/parse.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/v35.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/md5.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/v3.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/v4.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/sha1.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/v5.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/nil.js","webpack://Baby/./node_modules/uuid/dist/esm-browser/version.js","webpack://Baby/webpack/bootstrap","webpack://Baby/webpack/runtime/define property getters","webpack://Baby/webpack/runtime/hasOwnProperty shorthand","webpack://Baby/webpack/runtime/make namespace object","webpack://Baby/webpack/startup"],"names":["Animation","name","targetProperty","framePerSecond","dataType","loopMode","enableBlending","this","_runtimeAnimations","Array","_events","blendingSpeed","_ranges","targetPropertyPath","split","undefined","ANIMATIONLOOPMODE_CYCLE","_PrepareAnimation","totalFrame","from","to","easingFunction","isNaN","parseFloat","isFinite","ANIMATIONTYPE_FLOAT","ANIMATIONTYPE_QUATERNION","ANIMATIONTYPE_VECTOR3","ANIMATIONTYPE_VECTOR2","ANIMATIONTYPE_COLOR3","ANIMATIONTYPE_COLOR4","ANIMATIONTYPE_SIZE","animation","keys","frame","value","setKeys","setEasingFunction","CreateAnimation","property","animationType","ANIMATIONLOOPMODE_CONSTANT","CreateAndStartAnimation","node","onAnimationEnd","getScene","beginDirectAnimation","CreateAndStartHierarchyAnimation","directDescendantsOnly","beginDirectHierarchyAnimation","CreateMergeAndStartAnimation","animations","push","beginAnimation","MakeAnimationAdditive","sourceAnimation","referenceFrame","range","cloneOriginal","clonedName","clone","_keys","length","startIndex","firstKey","endIndex","lastKey","valueStore","referenceValue","referencePosition","referenceQuaternion","referenceScaling","keyPosition","keyQuaternion","keyScaling","referenceFound","rangeValue","getRange","fromKeyFound","toKeyFound","_getKeyValue","index","currentKey","nextKey","animationState","key","repeatCount","_interpolate","splice","normalize","conjugateInPlace","ANIMATIONTYPE_MATRIX","decompose","subtractInPlace","divideInPlace","multiplyToRef","subtractToRef","width","height","TransitionTo","targetValue","host","scene","frameRate","transition","duration","endFrame","Object","defineProperty","prototype","get","enumerable","configurable","_i","_a","isStopped","toString","fullDetails","ret","first","addEvent","event","sort","a","b","removeEvents","getEvents","createRange","deleteRange","deleteFrames","getKeys","getHighestFrame","nKeys","getEasingFunction","_easingFunction","floatInterpolateFunction","startValue","endValue","gradient","floatInterpolateFunctionWithTangents","outTangent","inTangent","quaternionInterpolateFunction","quaternionInterpolateFunctionWithTangents","vector3InterpolateFunction","vector3InterpolateFunctionWithTangents","vector2InterpolateFunction","vector2InterpolateFunctionWithTangents","sizeInterpolateFunction","color3InterpolateFunction","color4InterpolateFunction","currentFrame","state","highLimitValue","startKeyIndex","endKey","startKey","interpolation","useTangent","frameDelta","ease","floatValue","ANIMATIONLOOPMODE_RELATIVE","offsetValue","quatValue","scale","addInPlace","vec3Value","add","vec2Value","AllowMatricesInterpolation","matrixInterpolateFunction","workValue","result","AllowMatrixDecomposeForInterpolation","join","values","slice","serialize","serializationObject","loopBehavior","animationKey","asArray","ranges","source","_UniversalLerp","left","right","amount","constructor","Lerp","Slerp","toFixed","Parse","parsedAnimation","data","_inTangent","equals","_outTangent","keyData","AppendSerializedAnimations","destination","ParseFromFileAsync","url","_this","Promise","resolve","reject","request","addEventListener","readyState","status","JSON","parse","responseText","output","serializationObject_1","serializedAnimation","open","send","CreateFromSnippetAsync","snippetId","snippet","jsonPayload","serializationObject_2","SnippetUrl","replace","N","AnimationKeyInterpolation","AnimationRange","Ray","origin","direction","Number","MAX_VALUE","intersectsBoxMinMax","minimum","maximum","intersectionTreshold","inv","min","max","temp","newMinimum","_TmpVector3","copyFromFloats","x","y","z","newMaximum","d","maxValue","Math","abs","Infinity","intersectsBox","box","intersectsSphere","sphere","center","pyth","radius","rr","dot","intersectsTriangle","vertex0","vertex1","vertex2","edge1","edge2","pvec","tvec","qvec","det","invdet","bv","bw","distance","intersectsPlane","plane","result1","normal","result2","intersectsAxis","axis","offset","t","intersectsMesh","mesh","fastCheck","tm","getWorldMatrix","invertToRef","_tmpRay","TransformToRef","Transform","intersects","intersectsMeshes","meshes","results","i","pickInfo","hit","_comparePickingInfo","pickingInfoA","pickingInfoB","intersectionSegment","sega","segb","threshold","o","u","rsegb","v","w","scaleToRef","rayl","addToRef","sc","sN","tc","tN","c","e","D","sD","tD","smallnum","qtc","qsc","dP","lengthSquared","update","viewportWidth","viewportHeight","world","view","projection","unprojectRayToRef","Zero","CreateNew","CreateNewFromTo","end","subtract","sqrt","ray","matrix","dir","len","num","sourceX","sourceY","invert","nearScreenSource","farScreenSource","nearVec3","farVec3","copyFrom","Scene","camera","cameraViewSpace","createPickingRayToRef","engine","getEngine","activeCamera","viewport","toGlobal","getRenderWidth","getRenderHeight","getHardwareScalingLevel","getViewMatrix","getProjectionMatrix","createPickingRayInCameraSpaceToRef","Error","identity","pickingInfo","rayFunction","onlyBoundingInfo","trianglePredicate","skipBoundingInfo","predicate","meshIndex","isEnabled","isVisible","isPickable","skeleton","overrideMesh","hasThinInstances","thinInstanceEnablePicking","_internalPickForMesh","tmpMatrix","thinMatrices","thinInstanceGetWorldMatrices","result_1","thinInstanceIndex","pickingInfos","result_2","_internalPick","_tempPickingRay","createPickingRay","_pickWithRayInverseMatrix","_cachedRayForTransform","_internalMultiPick","transform","getForwardRayToRef","refRay","position","_scene","useRightHandedSystem","PivotTools","_RemoveAndStorePivotPoint","_PivotCached","getPivotPointToRef","_OldPivotPoint","_PivotPostMultiplyPivotMatrix","_postMultiplyPivotMatrix","equalsToFloats","setPivotMatrix","getPivotPoint","_PivotTranslation","_PivotTmpVector","scaling","multiplyInPlace","_RestorePivotPoint","setPivotPoint","PointerDragBehavior","options","_useAlternatePickedPointAboveMaxDragAngleDragSpeed","maxDragAngle","_useAlternatePickedPointAboveMaxDragAngle","currentDraggingPointerID","dragging","dragDeltaRatio","updateDragPlane","_debugMode","_moving","onDragObservable","onDragStartObservable","onDragEndObservable","moveAttached","enabled","startAndReleaseDragOnPointerEvents","detachCameraControls","useObjectOrientationForDragging","validateDrag","targetPosition","_tmpVector","_alternatePickedPoint","_worldDragAxis","_targetPosition","_attachedToElement","_startDragRay","_lastPointerRay","_dragDelta","_pointA","_pointC","_localAxis","_lookAt","_options","optionCount","dragAxis","dragPlaneNormal","set","init","attach","ownerNode","attachedNode","_planeScene","virtual","detachControl","onDisposeObservable","addOnce","dispose","_dragPlane","Mesh","lastDragPosition","pickPredicate","m","isDescendantOf","_pointerObserver","onPointerObservable","pointerInfo","eventState","type","pickedMesh","pickedPoint","_startDrag","pointerId","releaseDrag","_AnyMouseID","evt","pointerType","hostInformation","isMobile","MouseEvent","_moveDrag","_beforeRenderObserver","onBeforeRenderObservable","absolutePosition","scaleInPlace","getAbsolutePosition","setAbsolutePosition","notifyObservers","dragPlanePoint","leftCamera","getClassName","arcRotateCamera","attachControl","inputs","noPreventDefault","_useCtrlForPanning","_panningMouseButton","startDrag","fromRay","startPickedPoint","lastRay","getTranslationToRef","_updateDragPlanePosition","_pickWithRayOnDragPlane","attachedToElement","dragLength","getRotationMatrix","dragDistance","delta","forward","angle","acos","PI","pickResult","pickWithRay","dragPlanePosition","lookAt","computeWorldMatrix","detach","remove","AutoRotationBehavior","_zoomStopsAnimation","_idleRotationSpeed","_idleRotationWaitTime","_idleRotationSpinupTime","_isPointerDown","_lastFrameTime","_lastInteractionTime","_cameraRotationSpeed","_lastFrameRadius","flag","speed","time","_attachedCamera","_onPrePointerObservableObserver","onPrePointerObservable","pointerInfoPre","_onAfterCheckInputsObserver","onAfterCheckInputsObservable","now","dt","_applyUserInteraction","timeToRotation","alpha","_userIsZooming","inertialRadiusOffset","_shouldAnimationStopForInteraction","zoomHasHitLimit","_userIsMoving","inertialAlphaOffset","inertialBetaOffset","inertialPanningX","inertialPanningY","EasingFunction","_easingMode","EASINGMODE_EASEIN","setEasingMode","easingMode","n","getEasingMode","easeInCore","EASINGMODE_EASEOUT","EASINGMODE_EASEINOUT","BackEase","_super","CircleEase","apply","arguments","amplitude","call","pow","sin","ExponentialEase","BounceEase","bounces","bounciness","num9","num5","num4","num15","num65","log","num3","floor","num13","num8","num7","num6","num2","CubicEase","ElasticEase","oscillations","springiness","exp","exponent","PowerEase","power","QuadraticEase","QuarticEase","QuinticEase","SineEase","BezierCurveEase","x1","y1","x2","y2","BouncingBehavior","transitionDuration","lowerRadiusTransitionRange","upperRadiusTransitionRange","_autoTransitionRange","_radiusIsAnimating","_radiusBounceTransition","_animatables","_onMeshTargetChangedObserver","onMeshTargetChangedObservable","diagonal","getBoundingInfo","diagonalLength","_isRadiusAtLimit","lowerRadiusLimit","_applyBoundRadiusAnimation","upperRadiusLimit","radiusLimit","radiusDelta","EasingMode","_cachedWheelPrecision","wheelPrecision","stopAllAnimations","animatable","_clearAnimationLocks","stop","shift","FramingBehavior","_mode","FitFrustumSidesMode","_radiusScale","_positionScale","_defaultElevation","_elevationReturnTime","_elevationReturnWaitTime","_framingTime","autoCorrectCameraLimitsAndSensibility","_betaIsAnimating","mode","elevation","zoomOnMesh","_maintainCameraAboveGround","focusOnOriginXZ","boundingBox","zoomOnBoundingInfo","minimumWorld","maximumWorld","zoomOnMeshHierarchy","getHierarchyBoundingVectors","zoomOnMeshesHierarchy","boundingInfo","zoomTarget","bottom","zoomTargetY","radiusWorld","centerWorld","_vectorTransition","_calculateLowerRadiusFromModelBoundingSphere","minZ","IgnoreBoundsSizeMode","extend","panningSensibility","_radiusTransition","useInputToRestoreState","storeState","boxVectorGlobalDiagonal","frustumSlope","_getFrustumSlope","distanceForHorizontalFrustum","distanceForVerticalFrustum","timeSinceInteraction","defaultBeta","limitBeta","beta","_betaTransition","animatabe","aspectRatio","getAspectRatio","frustumSlopeY","tan","fov","frustumSlopeX","isUserIsMoving","ArcRotateCameraPointersInput","buttons","angularSensibilityX","angularSensibilityY","pinchPrecision","pinchDeltaPercentage","useNaturalPinchZoom","multiTouchPanning","multiTouchPanAndZoom","pinchInwards","_isPanClick","_twoFingerActivityCount","_isPinching","onTouch","point","offsetX","offsetY","_ctrlKey","onDoubleTap","restoreState","onMultiTouch","pointA","pointB","previousPinchSquaredDistance","pinchSquaredDistance","previousMultiTouchPanPosition","multiTouchPanPosition","moveDeltaX","moveDeltaY","previousPinchDistance","pinchDistance","pinchToPanMaxDistance","onButtonDown","button","onButtonUp","onLostFocus","BaseCameraPointersInput","element","getInputElement","_altKey","_metaKey","_shiftKey","_buttonsPressed","_pointerInput","p","s","isTouch","isInVRExclusivePointerMode","indexOf","srcElement","target","altKey","ctrlKey","metaKey","shiftKey","isPointerLock","movementX","mozMovementX","webkitMovementX","msMovementX","movementY","mozMovementY","webkitMovementY","msMovementY","setPointerCapture","clientX","clientY","preventDefault","focus","releasePointerCapture","_badOS","ed","distX","distY","_observer","_onLostFocus","onContextMenu","bind","hostWindow","getHostWindow","handler","ignored","inputElement","removeEventListener","getSimpleName","ArcRotateCameraKeyboardMoveInput","keysUp","keysDown","keysLeft","keysRight","keysReset","zoomingSensibility","useAltToZoom","angularSpeed","_onCanvasBlurObserver","_engine","onCanvasBlurObservable","_onKeyboardObserver","onKeyboardObservable","info","_ctrlPressed","_altPressed","keyCode","checkInputs","ArcRotateCameraMouseWheelInput","wheelDeltaPercentage","computeDeltaFromMouseWheelLegacyEvent","mouseWheelDelta","wheelDelta","_wheel","mouseWheelLegacyEvent","deltaY","detail","estimatedTargetRadius","targetInertia","inertia","ArcRotateCameraInputsManager","addMouseWheel","addPointers","addKeyboard","ArcRotateCamera","setActiveOnSceneIfNoneActive","lowerAlphaLimit","upperAlphaLimit","lowerBetaLimit","upperBetaLimit","panningDistanceLimit","panningOriginTarget","panningInertia","zoomOnFactor","targetScreenOffset","allowUpsideDown","_viewMatrix","panningAxis","checkCollisions","collisionRadius","_previousPosition","_collisionVelocity","_newPosition","_computationVector","_onCollisionPositionChange","collisionId","newPosition","collidedMesh","setPosition","onCollide","_position","cosa","cos","sina","cosb","sinb","_getTargetPosition","up","upVector","negate","_computeViewMatrix","addAtIndex","_collisionTriggered","_target","setTarget","_upVector","vec","_upToYMatrix","_YToUpMatrix","setMatUp","pointers","attached","keyboard","mousewheel","_bouncingBehavior","useBouncingBehavior","addBehavior","removeBehavior","_framingBehavior","useFramingBehavior","_autoRotationBehavior","useAutoRotationBehavior","_initCache","_cache","_updateCache","ignoreParentClass","_targetHost","pos","_targetBoundingCenter","lockedTargetPosition","_getLockedTargetPosition","_storedAlpha","_storedBeta","_storedRadius","_storedTarget","_storedTargetScreenOffset","_restoreStateValues","_isSynchronizedViewMatrix","useCtrlForPanning","panningMouseButton","attachElement","_reset","detachElement","_checkInputs","parent","_getWorldMatrixDeterminant","_localDirection","_transformedDirection","_cameraTransformMatrix","_checkLimits","rebuildAnglesAndRadius","previousAlpha","alphaCorrectionTurns","round","toBoundingCenter","allowSamePosition","newTarget","currentTarget","_getViewMatrix","collisionsEnabled","coordinator","collisionCoordinator","_collider","createCollider","_radius","getNewPosition","uniqueId","_currentTarget","zoomOn","doNotUpdateMaxZ","minMaxVector","focusOn","meshesOrMinMaxVectorAndDistance","meshesOrMinMaxVector","maxZ","createRigCamera","cameraIndex","alphaShift","cameraRigMode","_cameraRigParams","stereoHalfAngle","rigCam","isRigCamera","rigParent","_updateRigCameras","camLeft","_rigCameras","camRight","clear","Camera","orthoLeft","orthoRight","orthoBottom","orthoTop","PERSPECTIVE_CAMERA","isIntermediate","layerMask","fovMode","FOVMODE_VERTICAL_FIXED","RIG_MODE_NONE","customRenderTargets","outputRenderTarget","onViewMatrixChangedObservable","onProjectionMatrixChangedObservable","onRestoreStateObservable","_webvrViewMatrix","_skipRendering","_projectionMatrix","_postProcesses","_activeMeshes","_globalPosition","_computedViewMatrix","_doNotComputeProjectionMatrix","_transformMatrix","_refreshFrustumPlanes","_isCamera","_isLeftCamera","_isRightCamera","addCamera","_stateStored","_storedFov","getActiveMeshes","isActiveMesh","isReady","completeCheck","pp","renderWidth","renderHeight","_isSynchronized","_isSynchronizedProjectionMatrix","isSynchronizedWithParent","check","_rigPostProcess","_getFirstPostProcess","ppIndex","_cascadePostProcessesToRigCams","firstPostProcess","markTextureDirty","cam","rigPostProcess","getEffectName","concat","attachPostProcess","postProcess","insertAt","isReusable","prePassRenderer","markAsDirty","detachPostProcess","idx","_worldMatrix","force","updateCache","_currentRenderId","getRenderId","_childUpdateId","vrPreViewMatrix","freezeProjectionMatrix","unfreezeProjectionMatrix","_b","_c","_d","_e","_f","_g","_h","reverseDepth","useReverseDepthBuffer","halfWidth","halfHeight","getTransformationMatrix","_updateFrustumPlanes","_frustumPlanes","isInFrustum","checkRigCameras","rigCameras","forEach","isCompletelyInFrustum","getForwardRay","doNotRecurse","disposeMaterialAndTextures","stopAnimation","removeCamera","pop","getLeftTarget","getTarget","getRightTarget","setCameraRigMode","rigParams","interaxialDistance","rightCamera","RIG_MODE_STEREOSCOPIC_ANAGLYPH","_setStereoscopicAnaglyphRigMode","RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL","RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED","RIG_MODE_STEREOSCOPIC_OVERUNDER","RIG_MODE_STEREOSCOPIC_INTERLACED","_setStereoscopicRigMode","RIG_MODE_VR","_setVRRigMode","RIG_MODE_WEBVR","_setWebVRRigMode","_getVRProjectionMatrix","vrMetrics","aspectRatioFov","vrWorkMatrix","vrHMatrix","_updateCameraRotationMatrix","_updateWebVRCameraRotationMatrix","_getWebVRProjectionMatrix","_getWebVRViewMatrix","setCameraRigParameter","_setupInputs","parentId","id","serializeAnimationRanges","GetConstructorFromName","isStereoscopicSideBySide","getDirection","localAxis","getDirectionToRef","interaxial_distance","constructorFunc","_createDefaultParsedCamera","parsedCamera","construct","_waitingParentId","animationIndex","internalClass","autoAnimate","autoAnimateFrom","autoAnimateTo","autoAnimateLoop","autoAnimateSpeed","ORTHOGRAPHIC_CAMERA","FOVMODE_HORIZONTAL_FIXED","RIG_MODE_CUSTOM","ForceAttachControlToAlwaysPreventDefault","CameraInputTypes","CameraInputsManager","input","_addCheckInputs","inputToRemove","rebuildInputCheck","removeByType","inputType","fn","current","attachInput","disconnect","serializedCamera","res","inputsmgr","parsedInputs","parsedinput","TargetCamera","_tmpUpVector","_tmpTargetVector","cameraDirection","cameraRotation","ignoreParentScaling","updateUpVectorFromRotation","_tmpQuaternion","rotation","noRotationConstraint","invertRotation","inverseRotationSpeed","lockedTarget","_initialFocalDistance","_camMatrix","_cameraRotationMatrix","_referencePoint","_transformedReferencePoint","_defaultUp","_cachedRotationZ","_cachedQuaternionRotationZ","getFrontPosition","globalPosition","_storedPosition","_storedRotation","rotationQuaternion","_storedRotationQuaternion","_computeLocalCameraSpeed","getDeltaTime","getFps","atan","vDir","_decideIfNeedsToMove","_updatePosition","directionMultiplier","needToMove","needToRotate","toEulerAnglesToRef","limit","toRotationMatrix","_rotateUpVectorWithCameraRotationMatrix","parentWorldMatrix","_markSyncedWithParent","rigCamera","leftSign","rightSign","_getRigCamPositionAndTarget","halfSpace","_TargetFocalPoint","newFocalTarget","_TargetTransformMatrix","_RigCamTransformMatrix","IntersectionInfo","bu","faceId","subMeshId","PickingInfo","_pickingUnavailable","subMeshFaceId","pickedSprite","originMesh","getNormal","useWorldCoordinates","useVerticesNormals","isVerticesDataPresent","indices","getIndices","normals","getVerticesData","normal0","normal1","normal2","positions","vertex3","p1p2","p3p2","wm","nonUniformScaling","setTranslationFromFloats","transposeToRef","getTextureCoordinates","uvs","uv0","uv1","uv2","BoundingBox","worldMatrix","vectors","extendSize","extendSizeWorld","directions","vectorsWorld","reConstruct","minX","minY","maxX","maxY","_update","factor","tmpVectors","TmpVector3","diff","normalizeFromLength","newRadius","minWorld","maxWorld","isIdentity","setAll","minimizeInPlace","maximizeInPlace","frustumPlanes","IsInFrustum","IsCompletelyInFrustum","intersectsPoint","pointX","pointY","pointZ","IntersectsSphere","intersectsMinMax","myMin","myMax","myMinX","myMinY","myMinZ","myMaxX","myMaxY","myMaxZ","Intersects","box0","box1","minPoint","maxPoint","sphereCenter","sphereRadius","vector","boundingVectors","frustumPlane","dotCoordinate","canReturnFalse","BoundingSphere","tempRadiusVector","tempVector","isCenterInFrustum","squareDistance","sphere0","sphere1","radiusSum","_result0","_result1","computeBoxExtents","r","axisOverlap","BoundingInfo","_isLocked","boundingSphere","centerOn","strategy","_checkCollision","collider","_canDoCollision","precise","texture","faceIndex","level","buffer","gl","_gl","_dummyFramebuffer","dummy","createFramebuffer","bindFramebuffer","FRAMEBUFFER","framebufferTexture2D","COLOR_ATTACHMENT0","TEXTURE_CUBE_MAP_POSITIVE_X","_webGLTexture","TEXTURE_2D","readType","_getWebGLTextureType","UNSIGNED_BYTE","Uint8Array","Float32Array","FLOAT","readPixels","RGBA","_currentFramebuffer","size","fullOptions","generateMipMaps","generateDepthBuffer","generateStencilBuffer","samplingMode","format","_caps","textureFloatLinearFiltering","textureHalfFloatLinearFiltering","textureFloat","layers","filters","_getSamplingParameters","TEXTURE_2D_ARRAY","sizedFormat","_getRGBABufferInternalSizedFormat","internalFormat","_getInternalFormat","_bindTextureDirectly","is2DArray","texImage3D","texImage2D","texParameteri","TEXTURE_MAG_FILTER","mag","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","generateMipmap","currentFrameBuffer","framebuffer","_bindUnboundFramebuffer","_depthStencilBuffer","_setupFramebufferDepthAttachments","_framebuffer","baseWidth","baseHeight","depth","samples","_generateDepthBuffer","_generateStencilBuffer","_internalTexturesCache","isCube","_createDepthStencilCubeTexture","_createDepthStencilTexture","internalTexture","depthTextureExtension","internalOptions","bilinearFiltering","comparisonFunction","generateStencil","_setupDepthStencilTexture","UNSIGNED_INT_24_8","UNSIGNED_INT","DEPTH_STENCIL","DEPTH_COMPONENT","webGLVersion","DEPTH24_STENCIL8","DEPTH_COMPONENT24","TEXTURE_CUBE_MAP","face","ShaderCodeNode","children","isValid","preprocessors","process","line","processor","lineProcessor","isFragment","attributeProcessor","varyingProcessor","uniformProcessor","uniformBufferProcessor","test","lookForClosingBracketForUniformBuffer","endOfUniformBufferProcessor","child","additionalDefineKey","additionalDefineValue","ShaderCodeCursor","_lines","lineIndex","value_1","subLine","trim","ShaderCodeConditionNode","ShaderCodeTestNode","testExpression","isTrue","ShaderDefineExpression","postfixToInfix","postfix","stack","postfix_1","_OperatorPriority","v1","v2","infixToPostfix","infix","stackIdx","pushOperand","operand","_Stack","peek","charAt","token","substr","ShaderDefineIsDefinedOperator","define","not","condition","ShaderDefineOrOperator","leftOperand","rightOperand","ShaderDefineAndOperator","ShaderDefineArithmeticOperator","testValue","parseInt","regexSE","regexSERevert","ShaderProcessor","Process","sourceCode","callback","_ProcessIncludes","codeWithIncludes","migratedCode","_ProcessShaderConversion","_ProcessPrecision","shouldUseHighPrecisionShader","_ExtractOperation","expression","match","exec","operator","indexOperator","operators_1","substring","_BuildSubExpression","_BuildExpression","start","command","_MoveCursorWithinIf","cursor","rootNode","ifNode","currentLine","_MoveCursor","first5","toLowerCase","elseNode","elifNode","canRead","matches","newRootNode","newNode","_EvaluatePreProcessors","lines","_PreparePreProcessors","defines_1","defines","version","platformName","preparedSourceCode","preProcessor","postProcessor","regex","returnValue","String","keepProcessing","includeFile","supportsUniformBuffers","includesShadersStore","includeShaderUrl","shadersRepository","_FileToolsLoadFile","fileContent","includeContent","splits","RegExp","dest","indexString","indexSplits","minIndex","maxIndex","sourceIncludeContent","indexParameters","str","p1","onSuccess","onProgress","offlineProvider","useArrayBuffer","onError","Constants","ALPHA_DISABLE","ALPHA_ADD","ALPHA_COMBINE","ALPHA_SUBTRACT","ALPHA_MULTIPLY","ALPHA_MAXIMIZED","ALPHA_ONEONE","ALPHA_PREMULTIPLIED","ALPHA_PREMULTIPLIED_PORTERDUFF","ALPHA_INTERPOLATE","ALPHA_SCREENMODE","ALPHA_ONEONE_ONEONE","ALPHA_ALPHATOCOLOR","ALPHA_REVERSEONEMINUS","ALPHA_SRC_DSTONEMINUSSRCALPHA","ALPHA_ONEONE_ONEZERO","ALPHA_EXCLUSION","ALPHA_EQUATION_ADD","ALPHA_EQUATION_SUBSTRACT","ALPHA_EQUATION_REVERSE_SUBTRACT","ALPHA_EQUATION_MAX","ALPHA_EQUATION_MIN","ALPHA_EQUATION_DARKEN","DELAYLOADSTATE_NONE","DELAYLOADSTATE_LOADED","DELAYLOADSTATE_LOADING","DELAYLOADSTATE_NOTLOADED","NEVER","ALWAYS","LESS","EQUAL","LEQUAL","GREATER","GEQUAL","NOTEQUAL","KEEP","REPLACE","INCR","DECR","INVERT","INCR_WRAP","DECR_WRAP","TEXTURE_CLAMP_ADDRESSMODE","TEXTURE_WRAP_ADDRESSMODE","TEXTURE_MIRROR_ADDRESSMODE","TEXTUREFORMAT_ALPHA","TEXTUREFORMAT_LUMINANCE","TEXTUREFORMAT_LUMINANCE_ALPHA","TEXTUREFORMAT_RGB","TEXTUREFORMAT_RGBA","TEXTUREFORMAT_RED","TEXTUREFORMAT_R","TEXTUREFORMAT_RG","TEXTUREFORMAT_RED_INTEGER","TEXTUREFORMAT_R_INTEGER","TEXTUREFORMAT_RG_INTEGER","TEXTUREFORMAT_RGB_INTEGER","TEXTUREFORMAT_RGBA_INTEGER","TEXTURETYPE_UNSIGNED_BYTE","TEXTURETYPE_UNSIGNED_INT","TEXTURETYPE_FLOAT","TEXTURETYPE_HALF_FLOAT","TEXTURETYPE_BYTE","TEXTURETYPE_SHORT","TEXTURETYPE_UNSIGNED_SHORT","TEXTURETYPE_INT","TEXTURETYPE_UNSIGNED_INTEGER","TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4","TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1","TEXTURETYPE_UNSIGNED_SHORT_5_6_5","TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV","TEXTURETYPE_UNSIGNED_INT_24_8","TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV","TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV","TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV","TEXTURE_NEAREST_SAMPLINGMODE","TEXTURE_NEAREST_NEAREST","TEXTURE_BILINEAR_SAMPLINGMODE","TEXTURE_LINEAR_LINEAR","TEXTURE_TRILINEAR_SAMPLINGMODE","TEXTURE_LINEAR_LINEAR_MIPLINEAR","TEXTURE_NEAREST_NEAREST_MIPNEAREST","TEXTURE_NEAREST_LINEAR_MIPNEAREST","TEXTURE_NEAREST_LINEAR_MIPLINEAR","TEXTURE_NEAREST_LINEAR","TEXTURE_NEAREST_NEAREST_MIPLINEAR","TEXTURE_LINEAR_NEAREST_MIPNEAREST","TEXTURE_LINEAR_NEAREST_MIPLINEAR","TEXTURE_LINEAR_LINEAR_MIPNEAREST","TEXTURE_LINEAR_NEAREST","TEXTURE_EXPLICIT_MODE","TEXTURE_SPHERICAL_MODE","TEXTURE_PLANAR_MODE","TEXTURE_CUBIC_MODE","TEXTURE_PROJECTION_MODE","TEXTURE_SKYBOX_MODE","TEXTURE_INVCUBIC_MODE","TEXTURE_EQUIRECTANGULAR_MODE","TEXTURE_FIXED_EQUIRECTANGULAR_MODE","TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE","TEXTURE_FILTERING_QUALITY_OFFLINE","TEXTURE_FILTERING_QUALITY_HIGH","TEXTURE_FILTERING_QUALITY_MEDIUM","TEXTURE_FILTERING_QUALITY_LOW","SCALEMODE_FLOOR","SCALEMODE_NEAREST","SCALEMODE_CEILING","MATERIAL_TextureDirtyFlag","MATERIAL_LightDirtyFlag","MATERIAL_FresnelDirtyFlag","MATERIAL_AttributesDirtyFlag","MATERIAL_MiscDirtyFlag","MATERIAL_PrePassDirtyFlag","MATERIAL_AllDirtyFlag","MATERIAL_TriangleFillMode","MATERIAL_WireFrameFillMode","MATERIAL_PointFillMode","MATERIAL_PointListDrawMode","MATERIAL_LineListDrawMode","MATERIAL_LineLoopDrawMode","MATERIAL_LineStripDrawMode","MATERIAL_TriangleStripDrawMode","MATERIAL_TriangleFanDrawMode","MATERIAL_ClockWiseSideOrientation","MATERIAL_CounterClockWiseSideOrientation","ACTION_NothingTrigger","ACTION_OnPickTrigger","ACTION_OnLeftPickTrigger","ACTION_OnRightPickTrigger","ACTION_OnCenterPickTrigger","ACTION_OnPickDownTrigger","ACTION_OnDoublePickTrigger","ACTION_OnPickUpTrigger","ACTION_OnPickOutTrigger","ACTION_OnLongPressTrigger","ACTION_OnPointerOverTrigger","ACTION_OnPointerOutTrigger","ACTION_OnEveryFrameTrigger","ACTION_OnIntersectionEnterTrigger","ACTION_OnIntersectionExitTrigger","ACTION_OnKeyDownTrigger","ACTION_OnKeyUpTrigger","PARTICLES_BILLBOARDMODE_Y","PARTICLES_BILLBOARDMODE_ALL","PARTICLES_BILLBOARDMODE_STRETCHED","MESHES_CULLINGSTRATEGY_STANDARD","MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY","MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION","MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY","SCENELOADER_NO_LOGGING","SCENELOADER_MINIMAL_LOGGING","SCENELOADER_SUMMARY_LOGGING","SCENELOADER_DETAILED_LOGGING","PREPASS_IRRADIANCE_TEXTURE_TYPE","PREPASS_POSITION_TEXTURE_TYPE","PREPASS_VELOCITY_TEXTURE_TYPE","PREPASS_REFLECTIVITY_TEXTURE_TYPE","PREPASS_COLOR_TEXTURE_TYPE","PREPASS_DEPTHNORMAL_TEXTURE_TYPE","PREPASS_ALBEDO_TEXTURE_TYPE","PerformanceMonitor","frameSampleSize","_enabled","_rollingFrameTime","RollingAverage","sampleFrame","timeMs","_lastFrameTimeMs","average","variance","history","isSaturated","enable","disable","reset","_samples","bottomValue","_pos","_sampleCount","_m2","i0","_wrapPosition","g","_alphaState","setAlphaBlendConstants","noDepthWriteChange","_alphaMode","alphaBlend","setAlphaBlendFunctionParameters","ONE","ONE_MINUS_SRC_ALPHA","SRC_ALPHA","ZERO","ONE_MINUS_SRC_COLOR","DST_COLOR","CONSTANT_COLOR","ONE_MINUS_CONSTANT_COLOR","CONSTANT_ALPHA","ONE_MINUS_CONSTANT_ALPHA","DST_ALPHA","ONE_MINUS_DST_COLOR","ONE_MINUS_DST_ALPHA","depthCullingState","depthMask","equation","_alphaEquation","setAlphaEquationParameters","FUNC_ADD","FUNC_SUBTRACT","FUNC_REVERSE_SUBTRACT","MAX","MIN","indexBuffer","arrayBuffer","_currentBoundBuffer","ELEMENT_ARRAY_BUFFER","bindIndexBuffer","Uint16Array","Uint32Array","is32Bits","bufferData","DYNAMIC_DRAW","_resetIndexBufferBinding","vertexBuffer","byteOffset","byteLength","bindArrayBuffer","dataLength","bufferSubData","ARRAY_BUFFER","subarray","ArrayBuffer","_resetVertexBufferBinding","Engine","canvasOrContext","antialias","adaptToDeviceRatio","enableOfflineSupport","disableManifestCheck","scenes","onNewSceneAddedObservable","postProcesses","onResizeObservable","onCanvasFocusObservable","onCanvasPointerOutObservable","onBeginFrameObservable","customAnimationFrameRequester","onEndFrameObservable","onBeforeShaderCompilationObservable","onAfterShaderCompilationObservable","_deterministicLockstep","_lockstepMaxSteps","_timeStep","_fps","_deltaTime","_drawCalls","canvasTabIndex","disablePerformanceMonitorInBackground","_performanceMonitor","Instances","_creationOptions","getContext","canvas_1","_onCanvasFocus","_onCanvasBlur","_onBlur","_windowIsBackground","_onFocus","_onCanvasPointerOut","ev","anyDoc_1","document","_onFullscreenChange","fullscreen","isFullscreen","mozFullScreen","webkitIsFullScreen","msIsFullScreen","_pointerLockRequested","_RequestPointerlock","_onPointerLockChange","mozPointerLockElement","webkitPointerLockElement","msPointerLockElement","pointerLockElement","audioEngine","AudioEngineFactory","getRenderingCanvas","_connectVREvents","OfflineProviderFactory","doNotHandleTouchAction","_disableTouchAction","deterministicLockstep","lockstepMaxSteps","timeStep","_prepareVRComponent","autoEnableWebVR","initWebVR","MarkAllMaterialsAsDirty","engineIndex","sceneIndex","markAllMaterialsAsDirty","DefaultLoadingScreenFactory","canvas","_RescalePostProcessFactory","_renderingCanvas","viewportOwner","useScreen","getScreenAspectRatio","getRenderingCanvasClientRect","getBoundingClientRect","getInputElementClientRect","isDeterministicLockStep","getLockstepMaxSteps","getTimeStep","generateMipMapsForCubemap","unbind","setState","culling","zOffset","reverseSide","_depthCullingState","cull","cullFace","cullBackFaces","BACK","FRONT","setZOffset","frontFace","CW","CCW","getZOffset","setDepthBuffer","depthTest","getDepthWrite","setDepthWrite","getStencilBuffer","_stencilState","stencilTest","setStencilBuffer","getStencilMask","stencilMask","setStencilMask","mask","getStencilFunction","stencilFunc","getStencilFunctionReference","stencilFuncRef","getStencilFunctionMask","stencilFuncMask","setStencilFunction","setStencilFunctionReference","reference","setStencilFunctionMask","getStencilOperationFail","stencilOpStencilFail","getStencilOperationDepthFail","stencilOpDepthFail","getStencilOperationPass","stencilOpStencilDepthPass","setStencilOperationFail","operation","setStencilOperationDepthFail","setStencilOperationPass","setDitheringState","DITHER","setRasterizerState","RASTERIZER_DISCARD","getDepthFunction","depthFunc","setDepthFunction","setDepthFunctionToGreater","setDepthFunctionToGreaterOrEqual","setDepthFunctionToLess","setDepthFunctionToLessOrEqual","cacheStencilState","_cachedStencilBuffer","_cachedStencilFunction","_cachedStencilMask","_cachedStencilOperationPass","_cachedStencilOperationFail","_cachedStencilOperationDepthFail","_cachedStencilReference","restoreStencilState","setDirectViewport","currentViewport","_cachedViewport","_viewport","scissorClear","clearColor","enableScissor","disableScissor","SCISSOR_TEST","scissor","_reportDrawCall","addCount","_submitVRFrame","disableVR","isVRPresenting","_requestVRFrame","_loadFileAsync","_loadFile","exception","getVertexShaderSource","program","shaders","getAttachedShaders","getShaderSource","getFragmentShaderSource","setDepthStencilTexture","channel","uniform","_boundUniforms","depthStencilTexture","_setTexture","setTextureFromPostProcess","_bindTexture","_textures","_currentRenderTextureInd","setTextureFromPostProcessOutput","_outputTexture","_rebuildBuffers","resetCachedMaterial","_rebuildGeometries","_rebuildTextures","_renderFrame","_activeRenderLoops","renderFunction","_renderLoop","_contextWasLost","shouldRender","renderEvenInBackground","beginFrame","_renderViews","requestID","_queueNewFrame","_boundRenderFunction","_frameHandler","_renderingQueueLaunched","switchFullscreen","requestPointerLock","exitFullscreen","enterFullscreen","_RequestFullscreen","_ExitFullscreen","enterPointerlock","exitPointerlock","_ExitPointerlock","_measureFps","resize","setSize","camIndex","cameras","hasObservers","_deletePipelineContext","pipelineContext","webGLPipelineContext","transformFeedback","deleteTransformFeedback","createShaderProgram","vertexCode","fragmentCode","context","transformFeedbackVaryings","_createShaderProgram","vertexShader","fragmentShader","shaderProgram","createProgram","attachShader","createTransformFeedback","bindTransformFeedback","setTranformFeedbackVaryings","linkProgram","isParallelCompiled","_finalizePipelineContext","_releaseTexture","_rescaleTexture","onComplete","LINEAR","rtt","createRenderTargetTexture","_rescalePostProcess","getEffect","executeWhenCompiled","onApply","effect","hostingScene","postProcessManager","directRender","copyTexImage2D","unBindFramebuffer","averageFPS","instantaneousFrameTime","_uploadImageToTexture","image","lod","textureType","bindTarget","_unpackFlipY","invertY","updateRenderTargetTextureSampleCount","getCaps","maxMSAASamples","deleteRenderbuffer","_MSAAFramebuffer","deleteFramebuffer","_MSAARenderBuffer","renderbufferStorageMultisample","colorRenderbuffer","createRenderbuffer","bindRenderbuffer","RENDERBUFFER","_getRGBAMultiSampleBufferFormat","framebufferRenderbuffer","updateTextureComparisonFunction","TEXTURE_COMPARE_FUNC","TEXTURE_COMPARE_MODE","NONE","COMPARE_REF_TO_TEXTURE","_comparisonFunction","createInstancesBuffer","capacity","createBuffer","deleteInstancesBuffer","deleteBuffer","_clientWaitAsync","sync","flags","interval_ms","clientWaitSync","WAIT_FAILED","TIMEOUT_EXPIRED","setTimeout","_readPixelsAsync","h","outputBuffer","_webGLVersion","buf","bindBuffer","PIXEL_PACK_BUFFER","STREAM_READ","fenceSync","SYNC_GPU_COMMANDS_COMPLETE","flush","then","deleteSync","getBufferSubData","hideLoadingUI","window","setAttribute","style","touchAction","msTouchAction","displayLoadingUI","loadingScreen","_loadingScreen","text","loadingUIText","color","loadingUIBackgroundColor","msRequestPointerLock","mozRequestPointerLock","webkitRequestPointerLock","anyDoc","exitPointerLock","msExitPointerLock","mozExitPointerLock","webkitExitPointerLock","requestFunction","requestFullscreen","msRequestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","mozCancelFullScreen","webkitCancelFullScreen","msCancelFullScreen","EngineStore","_LastCreatedScene","UseFallbackTexture","FallbackTexture","PerformanceConfigurator","SetMatrixPrecision","use64bits","MatrixTrackPrecisionChange","MatrixUse64Bits","MatrixTrackedMatrices","_m","MatrixCurrentType","DepthCullingState","_isDepthTestDirty","_isDepthMaskDirty","_isDepthFuncDirty","_isCullFaceDirty","_isCullDirty","_isZOffsetDirty","_isFrontFaceDirty","_zOffset","_cullFace","_cull","_depthFunc","_depthMask","_depthTest","_frontFace","isDirty","CULL_FACE","DEPTH_TEST","POLYGON_OFFSET_FILL","polygonOffset","StencilState","_isStencilTestDirty","_isStencilMaskDirty","_isStencilFuncDirty","_isStencilOpDirty","_stencilFunc","_stencilFuncRef","_stencilFuncMask","_stencilOpStencilFail","_stencilOpDepthFail","_stencilOpStencilDepthPass","_stencilMask","_stencilTest","STENCIL_TEST","stencilOp","AlphaState","_isAlphaBlendDirty","_isBlendFunctionParametersDirty","_isBlendEquationParametersDirty","_isBlendConstantsDirty","_alphaBlend","_blendFunctionParameters","_blendEquationParameters","_blendConstants","value0","value1","value2","value3","rgb","BLEND","blendFuncSeparate","blendEquationSeparate","blendColor","WebGLShaderProcessor","code","drawBuffersExtension","WebGL2ShaderProcessor","attribute","varying","hasDrawBuffersExtension","search","WebGLPipelineContext","vertexCompilationError","fragmentCompilationError","programLinkError","programValidationError","_isRenderingStateCompiled","_handlesSpectorRebuildCallback","onCompiled","_getVertexShaderCode","_getShaderSource","_getFragmentShaderCode","BufferPointer","ThinEngine","forcePOTTextures","preventCacheWipeBetweenFrames","validateShaderPrograms","disableUniformBuffers","_uniformBuffers","_highPrecisionShadersAllowed","_badDesktopOS","onContextLostObservable","onContextRestoredObservable","_doNotHandleContextLost","disableVertexArrayObjects","_colorWrite","_colorWriteChanged","_activeChannel","_currentTextureChannel","_boundTexturesCache","_compiledEffects","_vertexAttribArraysEnabled","_uintIndicesCurrentlySet","_currentBufferPointers","_currentInstanceLocations","_currentInstanceBuffers","_vaoRecordInProgress","_mustWipeVertexAttributes","_nextFreeTextureSlots","_maxSimultaneousTextures","_activeRequests","_transformTextureUrl","premultipliedAlpha","onBeforeTextureInitObservable","_viewportCached","_unpackFlipYCached","enableUnpackFlipYCached","_getDepthStencilBuffer","msInternalFormat","attachment","depthStencilBuffer","renderbufferStorage","useHighPrecisionMatrix","preserveDrawingBuffer","stencil","xrCompatible","doNotHandleContextLost","navigator","userAgent","ua","ExceptionList","targets","capture","captureConstraint","constraint","targets_1","_onContextLost","_onContextRestored","_initGLContext","_rebuildEffects","_rebuildInternalTextures","wipeCaches","powerPreference","disableWebGL2Support","deleteQuery","attributes","getContextAttributes","pixelStorei","UNPACK_COLORSPACE_CONVERSION_WEBGL","useHighPrecisionFloats","devicePixelRatio","limitDeviceRatio","_hardwareScalingLevel","_isStencilEnable","maxVertexAttribs","_shaderProcessor","console","Version","description","parallelShaderCompile","highPrecisionShaderSupported","dimensions","_framebufferDimensionsObject","_emptyTexture","createRawTexture","_emptyTexture3D","createRawTexture3D","_emptyTexture2DArray","createRawTexture2DArray","_emptyCubeTexture","faceData","cubeData","createRawCubeTexture","currentState_1","_rebuild","_prepareEffect","areAllEffectsReady","maxTexturesImageUnits","getParameter","MAX_TEXTURE_IMAGE_UNITS","maxCombinedTexturesImageUnits","MAX_COMBINED_TEXTURE_IMAGE_UNITS","maxVertexTextureImageUnits","MAX_VERTEX_TEXTURE_IMAGE_UNITS","maxTextureSize","MAX_TEXTURE_SIZE","maxSamples","MAX_SAMPLES","maxCubemapTextureSize","MAX_CUBE_MAP_TEXTURE_SIZE","maxRenderTextureSize","MAX_RENDERBUFFER_SIZE","MAX_VERTEX_ATTRIBS","maxVaryingVectors","MAX_VARYING_VECTORS","maxFragmentUniformVectors","MAX_FRAGMENT_UNIFORM_VECTORS","maxVertexUniformVectors","MAX_VERTEX_UNIFORM_VECTORS","getExtension","standardDerivatives","maxAnisotropy","astc","bptc","s3tc","pvrtc","etc1","etc2","textureAnisotropicFilterExtension","uintIndices","fragmentDepthSupported","timerQuery","canUseTimestampForTimerQuery","colorBufferFloat","textureHalfFloat","textureHalfFloatRender","textureFloatRender","vertexArrayObject","instancedArrays","textureLOD","blendMinMax","multiview","oculusMultiview","_glVersion","VERSION","rendererInfo","_glRenderer","UNMASKED_RENDERER_WEBGL","_glVendor","UNMASKED_VENDOR_WEBGL","HALF_FLOAT_OES","RGBA16F","RGBA32F","getQuery","getQueryEXT","TIMESTAMP_EXT","QUERY_COUNTER_BITS_EXT","MAX_TEXTURE_MAX_ANISOTROPY_EXT","_canRenderToFloatFramebuffer","_canRenderToHalfFloatFramebuffer","drawBuffers","drawBuffersWEBGL","DRAW_FRAMEBUFFER","UNSIGNED_INT_24_8_WEBGL","vertexArrayObjectExtension","createVertexArray","createVertexArrayOES","bindVertexArray","bindVertexArrayOES","deleteVertexArray","deleteVertexArrayOES","instanceExtension","drawArraysInstanced","drawArraysInstancedANGLE","drawElementsInstanced","drawElementsInstancedANGLE","vertexAttribDivisor","vertexAttribDivisorANGLE","getShaderPrecisionFormat","vertex_highp","VERTEX_SHADER","HIGH_FLOAT","fragment_highp","FRAGMENT_SHADER","precision","blendMinMaxExtension","MAX_EXT","MIN_EXT","slot","_prepareWorkingCanvas","_workingCanvas","_workingContext","resetTextureCache","hasOwnProperty","getGlInfo","vendor","renderer","setHardwareScalingLevel","getLoadedTexturesCache","stopRenderLoop","ownerDocument","defaultView","_currentRenderTarget","framebufferWidth","drawingBufferWidth","framebufferHeight","drawingBufferHeight","bindedRenderFunction","requester","QueueNewFrame","runRenderLoop","backBuffer","applyStates","COLOR_BUFFER_BIT","clearDepth","DEPTH_BUFFER_BIT","clearStencil","STENCIL_BUFFER_BIT","setViewport","requiredWidth","requiredHeight","flushFramebuffer","clientWidth","innerWidth","clientHeight","innerHeight","forceFullscreenViewport","lodLevel","layer","framebufferTextureLayer","_depthStencilTexture","DEPTH_STENCIL_ATTACHMENT","DEPTH_ATTACHMENT","disableGenerateMipMaps","onBeforeUnbind","_textureArray","unBindMultiColorAttachmentFramebuffer","READ_FRAMEBUFFER","blitFramebuffer","NEAREST","restoreDefaultFramebuffer","_cachedVertexBuffers","createVertexBuffer","_createVertexBuffer","STATIC_DRAW","usage","vbo","dataBuffer","references","createDynamicVertexBuffer","_cachedIndexBuffer","createIndexBuffer","updatable","_normalizeIndexData","BYTES_PER_ELEMENT","_unbindVertexArrayObject","bindUniformBlock","blockName","uniformLocation","getUniformBlockIndex","uniformBlockBinding","underlyingResource","updateArrayBuffer","_vertexAttribPointer","indx","normalized","stride","pointer","changed","active","vertexAttribPointer","_bindIndexBufferWithCache","_bindVertexBuffersAttributes","vertexBuffers","getAttributesNames","unbindAllAttributes","order","getAttributeLocation","enableVertexAttribArray","getBuffer","getSize","byteStride","getIsInstanced","getInstanceDivisor","recordVertexArrayObject","vao","bindVertexArrayObject","_cachedVertexArrayObject","bindBuffersDirectly","vertexDeclaration","vertexStrideSize","_cachedEffectForVertexBuffers","attributesCount","getAttributesCount","bindBuffers","unbindInstanceAttributes","boundBuffer","ul","instancesBuffer","offsetLocation","releaseVertexArrayObject","_releaseBuffer","_deleteBuffer","updateAndBindInstancesBuffer","offsetLocations","bindInstancesBuffer","attributesInfo","computeStride","ai","attributeSize","_currentEffect","getAttributeLocationByName","attributeName","attributeType","divisor","disableInstanceAttributeByName","attributeLocation","disableInstanceAttribute","shouldClean","disableAttributeByIndex","disableVertexAttribArray","draw","useTriangles","indexStart","indexCount","instancesCount","drawElementsType","drawPointClouds","verticesStart","verticesCount","drawArraysType","drawUnIndexed","fillMode","drawMode","_drawMode","indexFormat","UNSIGNED_SHORT","mult","drawElements","drawArrays","TRIANGLES","POINTS","LINES","LINE_LOOP","LINE_STRIP","TRIANGLE_STRIP","TRIANGLE_FAN","_releaseEffect","_key","getPipelineContext","__SPECTOR_rebuildProgram","deleteProgram","createEffect","baseName","attributesNamesOrOptions","uniformsNamesOrEngine","samplers","fallbacks","vertexElement","vertex","vertexToken","vertexSource","fragmentElement","fragment","fragmentToken","fragmentSource","compiledEffect","_ConcatenateShader","shaderVersion","_compileShader","_compileRawShader","shader","createShader","shaderSource","compileShader","createRawShaderProgram","createPipelineContext","getProgramParameter","LINK_STATUS","error","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","getProgramInfoLog","validateProgram","VALIDATE_STATUS","deleteShader","_preparePipelineContext","vertexSourceCode","fragmentSourceCode","createAsRaw","rebuildRebind","webGLRenderingState","COMPLETION_STATUS_KHR","_executeWhenRenderingStateIsCompiled","action","oldHandler","getUniforms","uniformsNames","getUniformLocation","getAttributes","attributesNames","getAttribLocation","enableEffect","bindSamplers","onBind","_onBindObservable","setInt","uniform1i","setIntArray","array","uniform1iv","setIntArray2","uniform2iv","setIntArray3","uniform3iv","setIntArray4","uniform4iv","setArray","uniform1fv","setArray2","uniform2fv","setArray3","uniform3fv","setArray4","uniform4fv","setMatrices","matrices","uniformMatrix4fv","setMatrix3x3","uniformMatrix3fv","setMatrix2x2","uniformMatrix2fv","setFloat","uniform1f","setFloat2","uniform2f","setFloat3","uniform3f","setFloat4","uniform4f","colorMask","setColorWrite","getColorWrite","clearInternalTexturesCache","bruteForce","_currentProgram","UNPACK_PREMULTIPLY_ALPHA_WEBGL","magFilter","minFilter","LINEAR_MIPMAP_NEAREST","LINEAR_MIPMAP_LINEAR","NEAREST_MIPMAP_LINEAR","NEAREST_MIPMAP_NEAREST","_createTexture","createTexture","noMipmap","onLoad","fallback","forcedExtension","mimeType","loaderOptions","fromData","fromBlob","isBase64","originalUrl","_originalUrl","lastDot","lastIndexOf","extension","loader","_TextureLoaders","availableLoader","canLoad","_addPendingData","_buffer","onLoadObserver","onLoadedObservable","onInternalError","message","_removePendingData","callback_1","loadData","loadMipmap","isCompressed","done","loadFailed","_prepareWebGLTexture","isView","responseURL","onload_1","img","potWidth","potHeight","continuationCallback","isPot","RGB","_supportsHardwareTextureRescaling","drawImage","source_1","decoding","close","_FileToolsLoadImage","Blob","compression","UNPACK_FLIP_Y_WEBGL","_getUnpackAlignement","UNPACK_ALIGNMENT","_getTextureTarget","is3D","TEXTURE_3D","isMultiview","updateTextureSamplingMode","_setTextureParameterInteger","updateTextureWrappingMode","wrapU","wrapV","wrapR","_getTextureWrapMode","_cachedWrapU","_cachedWrapV","TEXTURE_WRAP_R","_cachedWrapR","samplingParameters","_uploadCompressedDataToTextureDirectly","compressedTexImage2D","_uploadDataToTextureDirectly","imageData","babylonInternalFormat","useTextureWidthAndHeight","lodMaxWidth","LOG2E","lodMaxHeight","updateTextureData","xOffset","yOffset","texSubImage2D","_uploadArrayBufferViewToTexture","_prepareWebGLTextureContinuation","processFunction","needPOTTextures","GetExponentOfTwo","depthFormat","DEPTH_COMPONENT16","DEPTH_COMPONENT32F","STENCIL_INDEX8","STENCIL_ATTACHMENT","_releaseFramebufferObjects","_deleteTexture","unbindAllTextures","_lodTextureHigh","_lodTextureMid","_lodTextureLow","_irradianceTexture","deleteTexture","_setProgram","useProgram","getSamplers","getUniform","_activateCurrentTexture","activeTexture","TEXTURE0","forTextureDataUpdate","wasPreviouslyBound","isTextureForRendering","_associatedChannel","bindTexture","_colorTextureArray","_bindSamplerUniformToChannel","setTexture","sourceSlot","_currentState","REPEAT","MIRRORED_REPEAT","isPartOfTextureArray","video","delayLoadState","delayLoad","getInternalTexture","emptyCubeTexture","emptyTexture3D","emptyTexture2DArray","emptyTexture","needToBind","_cachedCoordinatesMode","coordinatesMode","textureWrapMode","_setAnisotropicLevel","anisotropicFilteringLevel","setTextureArray","textures","_textureUnits","Int32Array","anisotropicFilterExtension","_cachedAnisotropicFilteringLevel","_setTextureParameterFloat","TEXTURE_MAX_ANISOTROPY_EXT","parameter","texParameterf","releaseEffects","abort","attachContextLostEvent","attachContextRestoredEvent","getError","_canRenderToFramebuffer","NO_ERROR","successful","fb","checkFramebufferStatus","FRAMEBUFFER_COMPLETE","readFormat","UNSIGNED_SHORT_4_4_4_4","UNSIGNED_SHORT_5_5_5_1","UNSIGNED_SHORT_5_6_5","BYTE","SHORT","INT","HALF_FLOAT","UNSIGNED_INT_2_10_10_10_REV","UNSIGNED_INT_10F_11F_11F_REV","UNSIGNED_INT_5_9_9_9_REV","FLOAT_32_UNSIGNED_INT_24_8_REV","ALPHA","LUMINANCE","LUMINANCE_ALPHA","RED","RG","RED_INTEGER","RG_INTEGER","RGB_INTEGER","RGBA_INTEGER","R8_SNORM","RG8_SNORM","RGB8_SNORM","R8I","RG8I","RGB8I","RGBA8I","RGBA8_SNORM","R8","RG8","RGB8","RGBA8","R8UI","RG8UI","RGB8UI","RGBA8UI","R16I","RG16I","RGB16I","RGBA16I","R16UI","RG16UI","RGB16UI","RGBA16UI","R32I","RG32I","RGB32I","RGBA32I","R32UI","RG32UI","RGB32UI","RGBA32UI","R32F","RG32F","RGB32F","R16F","RG16F","RGB16F","RGB565","R11F_G11F_B10F","RGB9_E5","RGBA4","RGB5_A1","RGB10_A2","RGB10_A2UI","onCompleteObservable","hasAlpha","numChannels","isSupported","_HasMajorPerformanceCaveat","_IsSupported","tempcanvas","WebGLRenderingContext","failIfMajorPerformanceCaveat","CeilingPOT","FloorPOT","NearestPOT","f","pot","func","requestPostAnimationFrame","requestAnimationFrame","msRequestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","oRequestAnimationFrame","getHostDocument","CollisionsEpsilon","ClipboardEventTypes","COPY","CUT","PASTE","ClipboardInfo","GetTypeFromCharacter","KeyboardEventTypes","KEYDOWN","KEYUP","KeyboardInfo","KeyboardInfoPre","skipOnPointerObservable","PointerEventTypes","POINTERDOWN","POINTERUP","POINTERMOVE","POINTERWHEEL","POINTERPICK","POINTERTAP","POINTERDOUBLETAP","PointerInfoBase","PointerInfoPre","localX","localY","localPosition","PointerInfo","HemisphericLight","groundColor","_buildUniformLayout","_uniformBuffer","addUniform","create","setDirectionToTarget","getShadowGenerator","transferToEffect","lightIndex","normalizeDirection","updateFloat4","updateColor3","intensity","transferToNodeMaterialEffect","lightDataUniformName","getTypeID","prepareLightSpecificDefines","Light","diffuse","specular","falloffType","FALLOFF_DEFAULT","_range","_inverseSquaredRange","_photometricScale","_intensityMode","INTENSITYMODE_AUTOMATIC","renderPriority","_shadowEnabled","_excludeWithLayerMask","_includeOnlyWithLayerMask","_lightmapMode","_excludedMeshesIds","_includedOnlyMeshesIds","_isLight","addLight","includedOnlyMeshes","excludedMeshes","_resyncMeshes","_computePhotometricScale","_markMeshesAsLightDirty","_includedOnlyMeshes","_hookArrayForIncludedOnly","_excludedMeshes","_hookArrayForExcluded","transferTexturesToEffect","_bindLight","useSpecular","rebuildInParallel","iAsString","needUpdate","_alreadyBound","bindToEffect","_renderId","useUbo","scaledIntensity","getScaledIntensity","updateColor4","shadowsEnabled","shadowEnabled","shadowGenerator","bindShadowLight","_syncParentEnabledState","isDisposed","setEnabled","_shadowGenerator","canAffectMesh","includeOnlyWithLayerMask","excludeWithLayerMask","CompareLightsPriority","_removeLightSource","removeLight","newParent","clonedLight","excludedMeshesIds","includedOnlyMeshesIds","parsedLight","light","lightmapMode","oldPush","items","items_1","item","_resyncLightSource","oldSplice","deleteCount","deleted","deleted_1","array_1","lightSources","_markSubMeshesAsLightDirty","_getPhotometricScale","photometricScale","lightTypeID","photometricMode","intensityMode","LIGHTTYPEID_DIRECTIONALLIGHT","INTENSITYMODE_ILLUMINANCE","INTENSITYMODE_LUMINOUSINTENSITY","LIGHTTYPEID_POINTLIGHT","LIGHTTYPEID_SPOTLIGHT","INTENSITYMODE_LUMINOUSPOWER","INTENSITYMODE_LUMINANCE","apexAngleRadians","LIGHTTYPEID_HEMISPHERICLIGHT","_reorderLightsInScene","_renderPriority","requireLightSorting","sortLightsByPriority","FALLOFF_PHYSICAL","FALLOFF_GLTF","FALLOFF_STANDARD","LIGHTMAP_DEFAULT","LIGHTMAP_SPECULAR","LIGHTMAP_SHADOWSONLY","SceneLoaderAnimationGroupLoadingMode","SceneLoader","GetDefaultPlugin","_registeredPlugins","_GetPluginForExtension","registeredPlugin","_GetPluginForDirectLoad","plugin","canDirectLoad","_GetPluginForFilename","sceneFilename","queryStringPosition","dotPosition","_GetDirectLoad","_LoadData","fileInfo","onDispose","pluginExtension","directLoad","createPlugin","OnPluginActivatedObservable","catch","isBinary","dataCallback","pluginDisposed","manifestChecked","successCallback","errorCallback","requestFile","_requestFile","file","rootUrl","canUseOfflineSupport","exceptionFound","disableOfflineSupportExceptionRules","readFile","_readFile","_GetFileInfo","sceneFile","filename","GetPluginForExtension","IsPluginForExtensionAvailable","RegisterPlugin","extensions","ImportMesh","meshNames","loadingToken","disposeHandler","errorHandler","errorMessage","progressHandler","successHandler","particleSystems","skeletons","animationGroups","transformNodes","geometries","lights","importedMeshesFiles","rewriteRootURL","importMesh","syncedPlugin","loadingPluginName","importMeshAsync","ImportMeshAsync","Load","Append","LoadAsync","ShowLoadingScreen","_showingLoadingScreen","executeWhenReady","load","loadAsync","AppendAsync","LoadAssetContainer","assets","loadAssetContainer","assetContainer","loadAssetContainerAsync","LoadAssetContainerAsync","ImportAnimations","overwriteAnimations","animationGroupLoadingMode","targetConverter","Clean","animatables","animationGroup","getNodes","Stop","Sync","restart","NoSync","startingIndexForNewAnimatables","container","mergeAnimationsTo","onAnimationFileImportedObservable","ImportAnimationsAsync","NO_LOGGING","MINIMAL_LOGGING","SUMMARY_LOGGING","DETAILED_LOGGING","SceneLoaderFlags","_ForceFullSceneLoadingForIncremental","_ShowLoadingScreen","_loggingLevel","_CleanBoneMatrixWeights","BaseTexture","sceneOrEngine","metadata","reservedDataStore","_hasAlpha","getAlphaFromRGB","coordinatesIndex","_coordinatesMode","DEFAULT_ANISOTROPIC_FILTERING_LEVEL","_isCube","_gammaSpace","invertZ","lodLevelInAlpha","isRenderTarget","_prefiltered","_onDisposeObserver","_texture","_uid","_isScene","getUniqueId","addTexture","_wrapU","_wrapV","gamma","_markAllSubMeshesAsTexturesDirty","_isRGBD","_lodGenerationOffset","_lodGenerationScale","_linearSpecularLOD","_getEngine","checkTransformsAreIdentical","getTextureMatrix","getReflectionTextureMatrix","isReadyOrNotBlocking","isBlocking","ratio","_getFromCache","sampling","texturesCache","texturesCacheEntry","incrementReferences","_readTexturePixels","onTextureRemovedObservable","WhenAllReady","numRemaining","onLoadObservable","ThinTexture","_cachedSize","_cachedBaseSize","_size","getBaseSize","updateSamplingMode","releaseInternalTexture","premulAlpha","forceBindTexture","glformat","DynamicTexture","_generateMipMaps","_canvas","createDynamicTexture","textureSize","_context","_recreate","scaleTo","fillRect","updateDynamicTexture","_format","drawText","font","fillStyle","textSize","measureText","fontSize","fillText","newTexture","_IsCanvasElement","base64String","toDataURL","_invertY","InternalTextureSource","InternalTexture","delayAllocation","baseDepth","_invertVScale","_source","Unknown","_bufferView","_bufferViewArray","_bufferViewArrayArray","_extension","_files","_attachments","_isDisabled","_compression","_sphericalPolynomial","_depthStencilTextureArray","_references","updateSize","proxy","Temp","Url","_swapAndDie","Raw","Raw3D","Raw2DArray","Dynamic","RenderTarget","createRenderTargetCubeTexture","size_1","Depth","depthTextureOptions","createDepthStencilTexture","Cube","createCubeTexture","CubeRaw","CubeRawRGBD","_UpdateRGBDAsync","CubePrefiltered","createPrefilteredCubeTexture","cache","sphericalPolynomial","lodScale","lodOffset","RenderTargetCreationOptions","RenderTargetTexture","doNotChangeAspectRatio","isMulti","renderParticles","renderSprites","ignoreCameraViewport","onBeforeBindObservable","onAfterUnbindObservable","onAfterRenderObservable","onClearObservable","_currentRefreshId","_refreshRate","boundingBoxPosition","renderList","_initialSizeParameter","_processSizeParameter","_resizeObserver","_doNotChangeAspectRatio","_renderingManager","_useSceneAutoClearSetup","_renderTargetOptions","getRenderSize","_textureMatrix","_renderList","_hookArray","wasEmpty","_onAfterUnbindObserver","_onBeforeRenderObserver","_onAfterRenderObserver","_onClearObserver","_onRatioRescale","_sizeRatio","_boundingBoxSize","_bestReflectionRenderTargetDimension","resetRefreshCounter","addPostProcess","_postProcessManager","autoClear","clearPostProcesses","removePostProcess","_shouldRender","refreshRate","getRenderLayers","newSize","wasCube","render","useCameraPostProcess","dumpForDebug","useCameraPostProcesses","_waitingRenderList","mesh_1","getMeshByID","renderListPredicate","sceneMeshes","setTransformMatrix","_defaultRenderListPrepared","renderToTarget","incrementRenderId","renderDimension","curved","_prepareRenderingManager","currentRenderList","currentRenderListLength","checkLayerMask","sceneRenderId","isBlocked","customIsReadyFunction","_internalAbstractMeshDataInfo","_currentLODIsUpToDate","_currentLOD","customLODSelector","getLOD","meshToRender","_preActivateForIntermediateRendering","isMasked","subMeshes","_activate","isAnInstance","_actAsRegularMesh","_onlyForInstancesIntermediate","_isActiveIntermediate","subIndex","subMesh","dispatch","particleIndex","particleSystem","emitter","isStarted","dispatchParticles","_bindFrameBuffer","unbindFrameBuffer","_prepareFrame","defaultRenderList","defaultRenderListLength","getCustomRenderList","updateTransformMatrix","_beforeRenderTargetDrawStage","customRenderFunction","_afterRenderTargetDrawStage","_finalizeFrame","setRenderingOrder","renderingGroupId","opaqueSortCompareFn","alphaTestSortCompareFn","transparentSortCompareFn","setRenderingAutoClearDepthStencil","autoClearDepthStencil","renderTargetSize","disposeFramebufferObjects","objBuffer","REFRESHRATE_RENDER_ONCE","freeRenderingGroups","getViewCount","REFRESHRATE_RENDER_ONEVERYFRAME","REFRESHRATE_RENDER_ONEVERYTWOFRAMES","CopyTools","GenerateBase64StringFromTexture","pixels","npixels","val","createElement","ctx","createImageData","putImageData","canvas2","ctx2","translate","Texture","TRILINEAR_SAMPLINGMODE","uOffset","vOffset","uScale","vScale","uAng","vAng","wAng","uRotationCenter","vRotationCenter","wRotationCenter","homogeneousRotationInUVTransform","inspectableCustomProperties","_noMipmap","_rowGenerationMatrix","_cachedTextureMatrix","_projectionModeMatrix","_t0","_t1","_t2","_cachedUOffset","_cachedVOffset","_cachedUScale","_cachedVScale","_cachedUAng","_cachedVAng","_cachedWAng","_cachedProjectionMatrixId","_cachedURotationCenter","_cachedVRotationCenter","_cachedWRotationCenter","_cachedHomogeneousRotationInUVTransform","_initialSamplingMode","BILINEAR_SAMPLINGMODE","_delayedOnLoad","_delayedOnError","_isBlocking","_mimeType","_loaderOptions","useDelayedTextureLoading","updateURL","_prepareRowForTextureGeneration","uBase","setRowFromFloats","mat","hasTexture","PROJECTION_MODE","updateFlag","PLANAR_MODE","projectionMatrix","getActiveTextures","savedName","SerializeBuffers","ForceSerializeBuffers","parsedTexture","customType","parsedCustomTexture","_samplingMode","_CubeTextureParser","onLoaded","mirrorPlane","mirrorTexture","_CreateMirror","renderTargetTexture","reflectionProbes","probe","cubeTexture","_CreateRenderTargetTexture","CreateFromBase64String","UseSerializedUrlIfAny","LoadFromDataString","jsonTexture","NEAREST_SAMPLINGMODE","NEAREST_NEAREST_MIPLINEAR","LINEAR_LINEAR_MIPNEAREST","LINEAR_LINEAR_MIPLINEAR","NEAREST_NEAREST_MIPNEAREST","NEAREST_LINEAR_MIPNEAREST","NEAREST_LINEAR_MIPLINEAR","NEAREST_LINEAR","NEAREST_NEAREST","LINEAR_NEAREST_MIPNEAREST","LINEAR_NEAREST_MIPLINEAR","LINEAR_LINEAR","LINEAR_NEAREST","EXPLICIT_MODE","SPHERICAL_MODE","CUBIC_MODE","SKYBOX_MODE","INVCUBIC_MODE","EQUIRECTANGULAR_MODE","FIXED_EQUIRECTANGULAR_MODE","FIXED_EQUIRECTANGULAR_MIRRORED_MODE","CLAMP_ADDRESSMODE","WRAP_ADDRESSMODE","MIRROR_ADDRESSMODE","Effect","onCompileObservable","onErrorObservable","_wasPreviouslyReady","_bonesComputationForcedToCPU","_multiTarget","_uniformBuffersNames","_samplers","_isReady","_compilationError","_allFallbacksProcessed","_uniforms","_fallbacks","_vertexSourceCode","_fragmentSourceCode","_vertexSourceCodeOverride","_fragmentSourceCodeOverride","_transformFeedbackVaryings","_rawVertexSourceCode","_rawFragmentSourceCode","_pipelineContext","_valueCache","processFinalCode","_attributesNames","_uniformsNames","_samplerList","_indexParameters","multiTarget","uniformBuffersNames","_uniformBuffersNamesList","_attributeLocationByName","_uniqueIdSeed","hostDocument","getElementById","processorOptions","_shouldUseHighPrecisionShader","ShadersRepository","IncludesShadersStore","_loadShader","migratedVertexCode","migratedFragmentCode","_useFinalCode","spectorName","_isReadyInternal","_attributes","getUniformIndex","uniformName","getUniformNames","getUniformBuffersNames","getIndexParameters","getCompilationError","allFallbacksProcessed","isAsync","_checkIsReady","previousPipelineContext","_processCompilationErrors","optionalKey","shaderUrl","HTMLElement","ShadersStore","atob","_rebuildProgram","engine_1","name_1","unBindMesh","_getShaderCodeAndErrorLine","regexp","errorLine","lineNumber","map","LogShaderCodeOnCompilationError","lineErrorVertex","lineErrorFragment","hasMoreFallbacks","reduce","exName","initialPos","currentExName","channelIndex","_cacheMatrix","_cacheFloat2","_cacheFloat3","_cacheFloat4","bindUniformBuffer","bufferName","_baseCache","bindUniformBufferBase","setFloatArray","setFloatArray2","setFloatArray3","setFloatArray4","setMatrix","toArray","setBool","bool","setVector2","vector2","setVector3","vector3","setVector4","vector4","setColor3","color3","setColor4","setDirectColor4","color4","RegisterShader","pixelShader","ResetCache","EffectFallbacks","_defines","_currentRank","_maxRank","_mesh","addFallback","rank","addCPUSkinningFallback","currentDefines","computeBonesUsingShaders","numBoneInfluencers","otherMesh","material","currentFallbacks","ColorCurves","_dirty","_tempColor","_globalCurve","_highlightsCurve","_midtonesCurve","_shadowsCurve","_positiveCurve","_negativeCurve","_globalHue","_globalDensity","_globalSaturation","_globalExposure","_highlightsHue","_highlightsDensity","_highlightsSaturation","_highlightsExposure","_midtonesHue","_midtonesDensity","_midtonesSaturation","_midtonesExposure","_shadowsHue","_shadowsDensity","_shadowsSaturation","_shadowsExposure","Bind","colorCurves","positiveUniform","neutralUniform","negativeUniform","getColorGradingDataToRef","PrepareUniforms","uniformsList","hue","density","saturation","exposure","clamp","applyColorGradingSliderNonlinear","fromHSBToRef","brightness","q","ImageProcessingConfigurationDefines","IMAGEPROCESSING","VIGNETTE","VIGNETTEBLENDMODEMULTIPLY","VIGNETTEBLENDMODEOPAQUE","TONEMAPPING","TONEMAPPING_ACES","CONTRAST","COLORCURVES","COLORGRADING","COLORGRADING3D","SAMPLER3DGREENDEPTH","SAMPLER3DBGRMAP","IMAGEPROCESSINGPOSTPROCESS","EXPOSURE","rebuild","ImageProcessingConfiguration","_colorCurvesEnabled","_colorGradingEnabled","_colorGradingWithGreenDepth","_colorGradingBGR","_exposure","_toneMappingEnabled","_toneMappingType","TONEMAPPING_STANDARD","_contrast","vignetteStretch","vignetteCentreX","vignetteCentreY","vignetteWeight","vignetteColor","vignetteCameraFov","_vignetteBlendMode","VIGNETTEMODE_MULTIPLY","_vignetteEnabled","_applyByPostProcess","_isEnabled","onUpdateParameters","_updateParameters","_colorGradingTexture","uniforms","PrepareSamplers","samplersList","prepareDefines","forPostProcess","applyByPostProcess","vignetteEnabled","vignetteBlendMode","_VIGNETTEMODE_MULTIPLY","toneMappingEnabled","contrast","colorCurvesEnabled","colorGradingEnabled","colorGradingTexture","colorGradingWithGreenDepth","colorGradingBGR","overrideAspectRatio","inverseWidth","inverseHeight","vignetteScaleY","vignetteScaleX","vignetteScaleGeometricMean","vignettePower","_VIGNETTEMODE_OPAQUE","DetailMapConfiguration","markAllSubMeshesAsTexturesDirty","diffuseBlendLevel","roughnessBlendLevel","bumpLevel","_normalBlendMethod","_internalMarkAllSubMeshesAsTexturesDirty","isReadyForSubMesh","_areTexturesDirty","texturesEnabled","DETAIL_NORMALBLENDMETHOD","DETAIL","bindForSubMesh","uniformBuffer","isFrozen","isSync","activeTextures","getAnimatables","forceDisposeTextures","AddUniforms","AddSamplers","PrepareUniformBuffer","copyTo","detailMap","Material","doNotAdd","shadowDepthWrapper","allowShaderHotSwapping","checkReadyOnEveryCall","checkReadyOnlyOnce","_alpha","_backFaceCulling","getRenderTargetTextures","doNotSerialize","_storeEffectOnSubMeshes","_onUnBindObservable","_onBindObserver","_needDepthPrePass","disableDepthWrite","disableColorWrite","forceDepthWrite","depthFunction","separateCullingPass","_fogEnabled","pointSize","_effect","_useUBO","_fillMode","TriangleFillMode","_cachedDepthWriteState","_cachedColorWriteState","_cachedDepthFunctionState","_indexInSceneMaterialArray","meshMap","_forceAlphaTest","_transparencyMode","idSubscript","getMaterialByID","sideOrientation","ClockWiseSideOrientation","CounterClockWiseSideOrientation","addMaterial","useMaterialMeshMap","MiscDirtyFlag","TextureDirtyFlag","onBindObservable","_onEffectCreatedObservable","WireFrameFillMode","LineListDrawMode","LineLoopDrawMode","LineStripDrawMode","forceWireframe","PointFillMode","PointListDrawMode","forcePointsCloud","freeze","markDirty","unfreeze","useInstances","MATERIAL_ALPHATESTANDBLEND","_markAllSubMeshesAsTexturesAndMiscDirty","MATERIAL_OPAQUE","MATERIAL_ALPHATEST","needAlphaBlending","_disableAlphaBlending","needAlphaBlendingForMesh","visibility","hasVertexAlpha","needAlphaTesting","_shouldTurnAlphaTestOn","getAlphaTestTexture","meshes_1","getMaterial","_preBind","overrideOrientation","reverse","backFaceCulling","bindOnlyWorldMatrix","bindSceneUniformBuffer","sceneUbo","bindView","getSceneUniformBuffer","bindViewProjection","getTransformMatrix","_afterBind","_cachedMaterial","_cachedVisibility","getBindedMeshes","meshId","filter","forceCompilation","localOptions","clipPlane","currentHotSwapingState","checkReady","clipPlaneState","allDone","lastError","tempSubMesh","_materialDefines","forceCompilationAsync","reason","blockMaterialDirtyMechanism","_DirtyCallbackArray","_TextureDirtyCallBack","LightDirtyFlag","_LightsDirtyCallBack","FresnelDirtyFlag","_FresnelDirtyCallBack","AttributesDirtyFlag","_AttributeDirtyCallBack","_MiscDirtyCallBack","PrePassDirtyFlag","_PrePassDirtyCallBack","_markAllSubMeshesAsDirty","_RunDirtyCallBacks","meshes_2","_markScenePrePassDirty","enablePrePassRenderer","_markAllSubMeshesAsAllDirty","_AllDirtyCallBack","_markAllSubMeshesAsImageProcessingDirty","_ImageProcessingDirtyCallBack","_markAllSubMeshesAsFresnelDirty","_markAllSubMeshesAsFresnelAndMiscDirty","_FresnelAndMiscDirtyCallBack","_markAllSubMeshesAsLightsDirty","_markAllSubMeshesAsAttributesDirty","_markAllSubMeshesAsMiscDirty","_markAllSubMeshesAsPrePassDirty","_TextureAndMiscDirtyCallBack","setPrePassRenderer","forceDisposeEffect","notBoundToMesh","freeProcessedMaterials","removeMaterial","meshes_3","sourceMesh","geometry","_releaseVertexArrayObject","_materialEffect","parsedMaterial","overloadedAlbedo","BABYLON","LegacyPBRMaterial","TriangleStripDrawMode","TriangleFanDrawMode","AllDirtyFlag","MATERIAL_ALPHABLEND","MATERIAL_NORMALBLENDMETHOD_WHITEOUT","MATERIAL_NORMALBLENDMETHOD_RNM","markAllAsDirty","markAsImageProcessingDirty","markAsTexturesDirty","markAsFresnelDirty","markAsMiscDirty","markAsPrePassDirty","markAsLightDirty","markAsAttributesDirty","cb","MaterialDefines","_isDirty","_areLightsDirty","_areLightsDisposed","_areAttributesDirty","_areFresnelDirty","_areMiscDirty","_arePrePassDirty","_areImageProcessingDirty","_normals","_uvs","_needNormals","_needUVs","markAsProcessed","markAsUnprocessed","disposed","isEqual","other","prop","cloneTo","MaterialFlags","_DiffuseTextureEnabled","_DetailTextureEnabled","_AmbientTextureEnabled","_OpacityTextureEnabled","_ReflectionTextureEnabled","_EmissiveTextureEnabled","_SpecularTextureEnabled","_BumpTextureEnabled","_LightmapTextureEnabled","_RefractionTextureEnabled","_ColorGradingTextureEnabled","_FresnelEnabled","_ClearCoatTextureEnabled","_ClearCoatBumpTextureEnabled","_ClearCoatTintTextureEnabled","_SheenTextureEnabled","_AnisotropicTextureEnabled","_ThicknessTextureEnabled","ThinMaterialHelper","BindClipPlane","holder","clipPlane2","clipPlane3","clipPlane4","clipPlane5","clipPlane6","MaterialHelper","BindEyePosition","variableName","_forcedViewPosition","devicePosition","_mirroredCameraPosition","PrepareDefinesForMergedUV","isIdentityAs3x2","BindTextureMatrix","updateMatrix","GetFogState","fogEnabled","applyFog","fogMode","PrepareDefinesForMisc","useLogarithmicDepth","pointsCloud","alphaTest","PrepareDefinesForFrameBoundValues","useClipPlane","useThinInstances","useClipPlane1","useClipPlane2","useClipPlane3","useClipPlane4","useClipPlane5","useClipPlane6","PrepareDefinesForBones","useBones","materialSupportsBoneTexture","isUsingTextureForMatrices","bones","nonExcluded","excludedSkinnedMesh","PrepareDefinesForMorphTargets","manager","morphTargetManager","supportsUVs","supportsTangents","supportsNormals","numInfluencers","PrepareDefinesForAttributes","useVertexColor","useMorphTargets","useVertexAlpha","hasVertexColors","useVertexColors","PrepareDefinesForMultiview","previousMultiview","MULTIVIEW","PrepareDefinesForPrePass","canRenderToMRT","previousPrePass","PREPASS","texturesList","SCENE_MRT_COUNT","mrtCount","getIndex","PrepareDefinesForLight","specularSupported","needNormals","needRebuild","equalsFloats","specularEnabled","receiveShadows","shadowMap","getShadowMap","PrepareDefinesForLights","maxSimultaneousLights","disableLighting","lightsEnabled","caps","PrepareUniformsAndSamplersForLight","projectedLightTexture","uniformBuffersList","updateOnlyBuffersList","PrepareUniformsAndSamplersList","uniformsListOrOptions","HandleFallbacksForShadows","lightFallbackRank","PrepareAttributesForMorphTargetsInfluencers","attribs","influencers","_TmpMorphInfluencers","NUM_MORPH_INFLUENCERS","PrepareAttributesForMorphTargets","maxAttributesCount","tangent","uv","PrepareAttributesForBones","PrepareAttributesForInstances","PushAttributesForInstances","BindLightProperties","BindLight","BindLights","BindFogParameters","linearSpace","fogStart","fogEnd","fogDensity","fogColor","toLinearSpaceToRef","_tempFogColor","BindBonesParameters","prePassConfiguration","boneTexture","getTransformMatrixTexture","getTransformMatrices","previousBones","_CopyBonesTransformationMatrices","BindMorphTargetParameters","abstractMesh","influences","BindLogDepth","LN2","MultiMaterial","multiMaterials","subMaterials","_subMaterials","getChildren","getSubMaterial","defaultMaterial","subMaterial","cloneChildren","newMultiMaterial","tags","materials","matIndex","subMat","forceDisposeChildren","ParseMultiMaterial","parsedMultiMaterial","multiMaterial","subMatId","getLastMaterialByID","PrePassConfiguration","previousWorldMatrices","previousViewProjection","PushMaterial","_normalMatrix","_activeEffect","_isReadyForSubMesh","bindOnlyNormalMatrix","normalMatrix","_cachedEffect","_mustRebind","isCachedMaterialInvalid","onCreatedEffectParameters","ShaderMaterial","shaderPath","_textureArrays","_floats","_ints","_floatsArrays","_colors3","_colors3Arrays","_colors4","_colors4Arrays","_vectors2","_vectors3","_vectors4","_matrices","_matrixArrays","_matrices3x3","_matrices2x2","_vectors2Arrays","_vectors3Arrays","_vectors4Arrays","_cachedWorldViewMatrix","_cachedWorldViewProjectionMatrix","_multiview","_shaderPath","uniformBuffers","_checkUniform","setFloats","setColor3Array","arr","setColor4Array","float32Array","copyToArray","_checkCache","shaderName","customShaderNameResolve","previousEffect","_cachedDefines","maxSimultaneousMorphTargets","effectOverride","_effectOverride","getCachedMaterial","_transformMatrixR","seffect","propName","propValue","isArray","textureArrays","floats","FloatArrays","colors3","colors3Arrays","colors4","colors4Arrays","vectors2","vectors3","vectors4","matrixArray","matrices3x3","matrices2x2","vectors2Arrays","vectors3Arrays","vectors4Arrays","textureArray","floatsArrays","colors","shaderMaterial","StandardMaterialDefines","MAINUV1","MAINUV2","DIFFUSE","DIFFUSEDIRECTUV","DETAILDIRECTUV","AMBIENT","AMBIENTDIRECTUV","OPACITY","OPACITYDIRECTUV","OPACITYRGB","REFLECTION","EMISSIVE","EMISSIVEDIRECTUV","SPECULAR","SPECULARDIRECTUV","BUMP","BUMPDIRECTUV","PARALLAX","PARALLAXOCCLUSION","SPECULAROVERALPHA","CLIPPLANE","CLIPPLANE2","CLIPPLANE3","CLIPPLANE4","CLIPPLANE5","CLIPPLANE6","ALPHATEST","DEPTHPREPASS","ALPHAFROMDIFFUSE","POINTSIZE","FOG","SPECULARTERM","DIFFUSEFRESNEL","OPACITYFRESNEL","REFLECTIONFRESNEL","REFRACTIONFRESNEL","EMISSIVEFRESNEL","FRESNEL","NORMAL","UV1","UV2","VERTEXCOLOR","VERTEXALPHA","NUM_BONE_INFLUENCERS","BonesPerMesh","BONETEXTURE","BONES_VELOCITY_ENABLED","INSTANCES","THIN_INSTANCES","GLOSSINESS","ROUGHNESS","EMISSIVEASILLUMINATION","LINKEMISSIVEWITHDIFFUSE","REFLECTIONFRESNELFROMSPECULAR","LIGHTMAP","LIGHTMAPDIRECTUV","OBJECTSPACE_NORMALMAP","USELIGHTMAPASSHADOWMAP","REFLECTIONMAP_3D","REFLECTIONMAP_SPHERICAL","REFLECTIONMAP_PLANAR","REFLECTIONMAP_CUBIC","USE_LOCAL_REFLECTIONMAP_CUBIC","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_SKYBOX","REFLECTIONMAP_EXPLICIT","REFLECTIONMAP_EQUIRECTANGULAR","REFLECTIONMAP_EQUIRECTANGULAR_FIXED","REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED","INVERTCUBICMAP","LOGARITHMICDEPTH","REFRACTION","REFRACTIONMAP_3D","REFLECTIONOVERALPHA","TWOSIDEDLIGHTING","SHADOWFLOAT","MORPHTARGETS","MORPHTARGETS_NORMAL","MORPHTARGETS_TANGENT","MORPHTARGETS_UV","NONUNIFORMSCALING","PREMULTIPLYALPHA","ALPHATEST_AFTERALLALPHACOMPUTATIONS","ALPHABLEND","PREPASS_IRRADIANCE","PREPASS_IRRADIANCE_INDEX","PREPASS_ALBEDO","PREPASS_ALBEDO_INDEX","PREPASS_DEPTHNORMAL","PREPASS_DEPTHNORMAL_INDEX","PREPASS_POSITION","PREPASS_POSITION_INDEX","PREPASS_VELOCITY","PREPASS_VELOCITY_INDEX","PREPASS_REFLECTIVITY","PREPASS_REFLECTIVITY_INDEX","RGBDLIGHTMAP","RGBDREFLECTION","RGBDREFRACTION","IS_REFLECTION_LINEAR","IS_REFRACTION_LINEAR","setReflectionMode","modeToEnable","modes_1","StandardMaterial","_diffuseTexture","_ambientTexture","_opacityTexture","_reflectionTexture","_emissiveTexture","_specularTexture","_bumpTexture","_lightmapTexture","_refractionTexture","ambientColor","diffuseColor","specularColor","emissiveColor","specularPower","_useAlphaFromDiffuseTexture","_useEmissiveAsIllumination","_linkEmissiveWithDiffuse","_useSpecularOverAlpha","_useReflectionOverAlpha","_disableLighting","_useObjectSpaceNormalMap","_useParallax","_useParallaxOcclusion","parallaxScaleBias","_roughness","indexOfRefraction","invertRefractionY","alphaCutOff","_useLightmapAsShadowmap","_useReflectionFresnelFromSpecular","_useGlossinessFromSpecularMapAlpha","_maxSimultaneousLights","_invertNormalMapX","_invertNormalMapY","_twoSidedLighting","_renderTargets","_worldViewProjectionMatrix","_globalAmbientColor","_rebuildInParallel","_attachImageProcessingConfiguration","ReflectionTextureEnabled","RefractionTextureEnabled","_imageProcessingConfiguration","configuration","_imageProcessingObserver","imageProcessingConfiguration","_useLogarithmicDepth","_shouldUseAlphaFromDiffuseTexture","_opacityFresnelParameters","_hasAlphaChannel","DiffuseTextureEnabled","AmbientTextureEnabled","OpacityTextureEnabled","isRGBD","boundingBoxSize","EmissiveTextureEnabled","LightmapTextureEnabled","SpecularTextureEnabled","BumpTextureEnabled","alphaMode","transparencyMode","reflectionTexture","gammaSpace","refractionTexture","FresnelEnabled","_diffuseFresnelParameters","_emissiveFresnelParameters","_refractionFresnelParameters","_reflectionFresnelParameters","getRenderingMesh","lightDisposed","csnrOptions","setEffect","buildUniformLayout","ubo","needFlag","toNormalMatrix","mustRebind","diffuseFresnelParameters","leftColor","rightColor","bias","opacityFresnelParameters","toLuminance","reflectionFresnelParameters","refractionFresnelParameters","emissiveFresnelParameters","updateFloat2","roughness","updateVector3","updateFloat3","updateFloat","_j","elements","UNIFORM_BUFFER","count","location","bindBufferBase","UniformBuffer","dynamic","_noUBO","_dynamic","_data","_uniformLocations","_uniformSizes","_uniformLocationPointer","_needSync","updateMatrix3x3","_updateMatrix3x3ForEffect","updateMatrix2x2","_updateMatrix2x2ForEffect","_updateFloatForEffect","_updateFloat2ForEffect","_updateFloat3ForEffect","_updateFloat4ForEffect","_updateMatrixForEffect","_updateVector3ForEffect","updateVector4","_updateVector4ForEffect","_updateColor3ForEffect","_updateColor4ForEffect","_updateMatrix3x3ForUniform","_updateMatrix2x2ForUniform","_updateFloatForUniform","_updateFloat2ForUniform","_updateFloat3ForUniform","_updateFloat4ForUniform","_updateMatrixForUniform","_updateVector3ForUniform","_updateVector4ForUniform","_updateColor3ForUniform","_updateColor4ForUniform","isDynamic","getData","_bufferData","_fillAlignment","alignment","oldPointer","addMatrix","addFloat2","addFloat3","addColor3","addColor4","addVector3","addMatrix3x3","addMatrix2x2","createDynamicUniformBuffer","createUniformBuffer","updateUniformBuffer","updateUniform","_tempBuffer","suffix","updateUniformDirectly","_MAX_UNIFORM_SIZE","Space","Coordinate","Axis","X","Y","Z","Color3","getHashCode","hash","fromArray","FromArrayToRef","toColor4","Color4","multiply","otherColor","scaleAndAddToRef","clampToRef","toHexString","intR","intG","intB","toLinearSpace","convertedColor","toHSV","toHSVToRef","dm","toGammaSpace","toGammaSpaceToRef","HSVtoRGBToRef","chroma","FromHexString","hex","FromInts","FromArray","LerpToRef","Red","Green","Blue","Black","_BlackReadOnly","White","Purple","Magenta","Yellow","Gray","Teal","Random","random","returnAsColor3","intA","FromColor3","CheckColors4","newIndex","TmpColors","ToGammaSpace","ToLinearSpace","Epsilon","Frustum","GetPlanes","GetPlanesToRef","GetNearPlaneToRef","GetFarPlaneToRef","GetLeftPlaneToRef","GetRightPlaneToRef","GetTopPlaneToRef","GetBottomPlaneToRef","extractMinAndMaxIndexed","minimizeInPlaceFromFloats","maximizeInPlaceFromFloats","extractMinAndMax","PositionNormalVertex","PositionNormalTextureVertex","Orientation","BezierCurve","Interpolate","f0","f1","f2","refinedT","refinedT2","Angle","radians","_radians","degrees","BetweenTwoPoints","atan2","FromRadians","FromDegrees","Arc2","startPoint","midPoint","endPoint","startToMid","midToEnd","centerPoint","startAngle","a1","a2","a3","orientation","Path2","_points","_length","closed","addLineTo","newPoint","previousPoint","addArcTo","midX","midY","endX","endY","numberOfSegments","arc","increment","currentAngle","lastPoint","getPoints","getPointAtLengthPosition","normalizedLengthPosition","lengthPosition","previousOffset","j","bToA","nextOffset","localOffset","StartingAt","Path3D","path","firstNormal","raw","alignTangentsWithPath","_curve","_distances","_tangents","_binormals","_pointAtData","previousPointArrayIndex","subPosition","interpolateReady","interpolationMatrix","_raw","_alignTangentsWithPath","_compute","getCurve","getTangents","getNormals","getBinormals","getDistances","getPointAt","_updatePointAtData","getTangentAt","interpolated","getNormalAt","getBinormalAt","getDistanceAt","getPreviousPointIndexAt","getSubPositionAt","getClosestPositionTo","smallestDistance","closestPosition","subLength","_start","curvePoints","slicePoints","l","_getFirstNonNullVector","prev","cur","curTang","prevNor","prevBinor","tg0","pp0","_normalVector","_getLastNonNullVector","NaN","nNVector","nLVector","vt","va","tgl","interpolateTNB","_updateInterpolationMatrix","_setPointAtData","currentPoint","currentLength","targetLength","parentIndex","tangentFrom","normalFrom","binormalFrom","tangentTo","normalTo","binormalTo","quatFrom","quatTo","Curve3","points","_computeLength","CreateQuadraticBezier","v0","nbPoints","bez","val0","val1","val2","CreateCubicBezier","v3","val3","CreateHermiteSpline","t1","p2","t2","hermite","step","CreateCatmullRomSpline","catmullRom","pointsCount","totalPoints","continue","curve","continuedPoints","Plane","norm","magnitude","transformation","invertedMatrix","_TmpMatrix","copyFromPoints","point1","point2","point3","invPyth","z1","z2","yz","xz","xy","isFrontFacingTo","epsilon","signedDistanceTo","FromPoints","FromPositionAndNormal","SignedDistanceToPlaneFromPositionAndNormal","Scalar","WithinEpsilon","ToHex","toUpperCase","Sign","Clamp","Log2","Repeat","Normalize","Denormalize","DeltaAngle","PingPong","tx","SmoothStep","MoveTowards","maxDelta","MoveTowardsAngle","LerpAngle","InverseLerp","Hermite","tangent1","tangent2","squared","cubed","RandomRange","RangeToPercent","number","PercentToRange","percent","NormalizeRadians","TwoPi","Size","src","multiplyByFloats","otherSize","Vector2","otherVector","divide","divideToRef","negateInPlace","negateToRef","equalsWithEpsilon","fract","One","CatmullRom","value4","part1","part2","part3","part4","Dot","newVector","Minimize","Maximize","PointInTriangle","p0","sign","Distance","DistanceSquared","Center","DistanceOfPointFromSegment","segA","segB","l2","proj","Vector3","_x","_y","_z","toQuaternion","Quaternion","RotationYawPitchRoll","addInPlaceFromFloats","subtractFromFloatsToRef","subtractFromFloats","projectOnPlane","projectOnPlaneToRef","V","MathTmp","denom","scaledV","isNonUniformWithinEpsilon","absX","absY","absZ","reorderInPlace","rotateByQuaternionToRef","quaternion","Matrix","TransformCoordinatesToRef","rotateByQuaternionAroundPointToRef","cross","Cross","normalizeToNew","normalizeToRef","GetClipFactor","vector0","vector1","d0","GetAngleBetweenVectors","CrossToRef","FromFloatArray","FromFloatArrayToRef","FromFloatsToRef","Up","_UpReadOnly","_ZeroReadOnly","Down","Forward","rightHandedSystem","Backward","Right","Left","TransformCoordinates","TransformCoordinatesFromFloatsToRef","rx","ry","rz","rw","TransformNormal","TransformNormalToRef","TransformNormalFromFloatsToRef","ClampToRef","CheckExtends","NormalizeToRef","Project","ProjectToRef","cw","ch","cx","cy","viewportMatrix","FromValuesToRef","_UnprojectFromInvertedMatrixToRef","UnprojectFromTransform","Unproject","UnprojectToRef","UnprojectFloatsToRef","sourceZ","screenSource","RotationFromAxis","axis1","axis2","axis3","RotationFromAxisToRef","ref","quat","RotationQuaternionFromAxisToRef","Vector4","toVector3","FromVector3","_w","otherQuaternion","q1","conjugateToRef","conjugate","toEulerAngles","qz","qx","qy","qw","sqw","sqz","sqx","sqy","zAxisY","asin","FromQuaternionToRef","fromRotationMatrix","FromRotationMatrixToRef","FromRotationMatrix","m11","m12","m13","m21","m22","m23","m31","m32","m33","trace","AreClose","quat0","quat1","Inverse","InverseToRef","Identity","IsIdentity","RotationAxis","RotationAxisToRef","FromEulerAngles","RotationYawPitchRollToRef","FromEulerAnglesToRef","FromEulerVector","FromEulerVectorToRef","yaw","pitch","roll","halfRoll","halfPitch","halfYaw","sinRoll","cosRoll","sinPitch","cosPitch","sinYaw","cosYaw","RotationAlphaBetaGamma","RotationAlphaBetaGammaToRef","halfGammaPlusAlpha","halfGammaMinusAlpha","halfBeta","RotationQuaternionFromAxis","rotMat","FromXYZAxesToRef","SlerpToRef","_isIdentity","_isIdentityDirty","_isIdentity3x2","_isIdentity3x2Dirty","_updateIdentityStatus","_markAsUpdated","_updateFlagSeed","isIdentityDirty","isIdentity3x2","isIdentity3x2Dirty","determinant","m00","m01","m02","m03","m10","m20","m30","det_22_33","det_21_33","det_21_32","det_20_33","det_20_32","det_20_31","resultM","otherM","addToSelf","IdentityToRef","cofact_00","cofact_01","cofact_02","cofact_03","detInv","det_12_33","det_11_33","det_11_32","det_10_33","det_10_32","det_10_31","det_12_23","det_11_23","det_11_22","det_10_23","det_10_22","det_10_21","cofact_10","cofact_11","cofact_12","cofact_13","cofact_20","cofact_21","cofact_22","cofact_23","cofact_30","cofact_31","cofact_32","cofact_33","multiplyAtIndex","addTranslationFromFloats","setTranslation","getTranslation","removeRotationAndScaling","multiplyToArray","tm0","tm1","tm2","tm3","tm4","tm5","tm6","tm7","tm8","tm9","tm10","tm11","tm12","tm13","tm14","tm15","om0","om1","om2","om3","om4","om5","om6","om7","om8","om9","om10","om11","om12","om13","om14","om15","om","translation","sx","sy","sz","getRow","setRow","row","transpose","Transpose","TransposeToRef","tmp","getRotationMatrixToRef","toggleModelMatrixHandInPlace","toggleProjectionMatrixHandInPlace","FromFloat32ArrayToRefScaled","_identityReadOnly","initialM11","initialM12","initialM13","initialM14","initialM21","initialM22","initialM23","initialM24","initialM31","initialM32","initialM33","initialM34","initialM41","initialM42","initialM43","initialM44","FromValues","Compose","ComposeToRef","xx","yy","zz","wx","wy","wz","zero","RotationX","RotationXToRef","Invert","RotationY","RotationYToRef","RotationZ","RotationZToRef","c1","RotationAlignToRef","k","Scaling","ScalingToRef","Translation","TranslationToRef","startM","endM","DecomposeLerp","DecomposeLerpToRef","startScale","startRotation","startTranslation","endScale","endRotation","endTranslation","resultScale","resultRotation","resultTranslation","LookAtLH","eye","LookAtLHToRef","xAxis","yAxis","zAxis","xSquareLength","ex","ey","ez","LookAtRH","LookAtRHToRef","OrthoLH","znear","zfar","OrthoLHToRef","OrthoOffCenterLH","top","OrthoOffCenterLHToRef","i1","OrthoOffCenterRH","OrthoOffCenterRHToRef","PerspectiveLH","PerspectiveFovLH","aspect","PerspectiveFovLHToRef","isVerticalFovFixed","PerspectiveFovReverseLHToRef","PerspectiveFovRH","PerspectiveFovRHToRef","PerspectiveFovReverseRHToRef","PerspectiveFovWebVRToRef","rightHanded","rightHandedFactor","upTan","upDegrees","downTan","downDegrees","leftTan","leftDegrees","rightTan","rightDegrees","xScale","yScale","GetFinalMatrix","zmin","zmax","GetAsMatrix2x2","GetAsMatrix3x3","rm","mm","Reflection","ReflectionToRef","temp2","temp3","xaxis","yaxis","zaxis","zw","zx","yw","xw","TmpVectors","Viewport","toGlobalToRef","VertexData","wrap","topBaseAt","bottomBaseAt","topIndex","bottomIndex","basePositions","topFaceBase","bottomFaceBase","topFaceOrder","bottomFaceOrder","unshift","flat","scaleArray","accumulator","currentValue","currentIndex","faceUV","faceColors","frontUVs","backUVs","vertexData","totalColors","BoxBuilder","CreateBox","_originalBuilderSideOrientation","applyToMesh","diameterTop","diameter","diameterBottom","tessellation","subdivisions","hasRings","enclose","cap","surfaceNb","angle_step","ringVertex","ringNormal","ringFirstVertex","ringFirstNormal","quadNormal","ringIdx","cs","i2","i3","createCylinderCap","isTop","circleVector","vbase","textureScale","textureCoordinate","CylinderBuilder","CreateCylinder","cylinder","instance","InstancedMesh","instancedBuffers","_indexInSourceMeshInstanceArray","addInstance","_sourceMesh","_unIndexed","getAnimationRanges","createAnimationRange","infiniteDistance","getPivotMatrix","refreshBoundingInfo","_syncSubMeshes","_lightSources","_resyncLightSources","getTotalVertices","getTotalIndices","createInstance","kind","copyWhenShared","setVerticesData","updateVerticesData","updateExtends","makeItUnique","setIndices","totalVertices","_positions","applySkeleton","_boundingInfo","isLocked","boundingBias","_refreshBoundingInfo","_getPositionData","_preActivate","renderId","intermediateRendering","_registerInstanceForRenderId","_isActive","_onlyForInstances","_postActivate","edgesShareWithInstances","_edgesRenderer","_renderingGroup","_edgesRenderers","pushNoDuplicate","customInstances","billboardMode","TransformNode","_masterMesh","tempMaster","releaseSubMeshes","_generatePointsArray","_updateBoundingInfo","effectiveMesh","worldMatrixFromCache","_updateSubMeshesBoundingInfo","doNotCloneChildren","removeInstance","removeVerticesData","instances","_userInstancedBuffersStorage","strides","sizes","setVerticesBuffer","visibleInstances","renderSelf","instanceCount","expectedSize","instanceIndex","updateDirectly","_instanceDataStorage","LinesMesh","intersectionThreshold","_colorShader","_addClipPlaneDefine","label","_removeClipPlaneDefine","_bind","_geometry","colorEffect","indexToBind","isUnIndexed","getIndexBuffer","_draw","getVertexBuffers","InstancedLinesMesh","vertexColors","shft","dashshft","dashSize","gapSize","dashNb","curvect","lg","nb","curshft","LinesBuilder","CreateLines","CreateDashedLines","CreateLineSystem","vertexColor","lineColors","lineSystem","updateMeshPositions","nbSeg","_creationDataStorage","dashedLines","_CreationDataStorage","PlaneBuilder","CreatePlane","sourcePlane","setDirection","segments","diameterX","diameterY","diameterZ","dedupTopBottomIndices","totalZRotationSteps","totalYRotationSteps","zRotationStep","normalizedZ","angleZ","yRotationStep","normalizedY","angleY","rotationZ","rotationY","afterRotZ","complete","firstIndex","SphereBuilder","CreateSphere","thickness","outerAngle","innerAngle","dx","dy","nextI","nextJ","TorusBuilder","CreateTorus","torus","WebGLDataBuffer","resource","DataBuffer","_MeshCollisionData","_checkCollisions","_collisionMask","_collisionGroup","_surroundingMeshes","_oldPositionForCollisions","_diffPositionForCollisions","_collisionResponse","_FacetDataStorage","facetNb","partitioningSubdivisions","partitioningBBoxRatio","facetDataEnabled","facetParameters","bbSize","subDiv","facetDepthSort","facetDepthSortEnabled","_InternalAbstractMeshDataInfo","_hasVertexAlpha","_useVertexColors","_numBoneInfluencers","_applyFog","_receiveShadows","_facetData","_visibility","_skeleton","_layerMask","_computeBonesUsingShaders","AbstractMesh","cullingStrategy","CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY","onCollideObservable","onCollisionPositionChangeObservable","onMaterialChangedObservable","definedFacingForward","_occlusionQuery","alphaIndex","showSubMeshesBoundingBox","isBlocker","enablePointerMoveEvents","_renderingGroupId","_material","outlineColor","outlineWidth","overlayColor","overlayAlpha","useOctreeForRenderingSelection","useOctreeForPicking","useOctreeForCollisions","alwaysSelectAsActiveMesh","doNotSyncBoundingInfo","actionManager","_meshCollisionData","ellipsoid","ellipsoidOffset","edgesWidth","edgesColor","_intersectionsInProgress","_waitingData","lods","actions","freezeWorldMatrix","_bonesTransformMatrices","_transformMatrixTexture","onRebuildObservable","addMesh","facetDepthSortFrom","_updateNonUniformScalingState","_markSubMeshesAsMiscDirty","_onCollideObserver","_onCollisionPositionChangeObserver","_unBindEffect","_markSubMeshesAsAttributesDirty","response","needInitialSkinMatrix","_unregisterMeshWithPoseMatrix","_registerMeshWithPoseMatrix","_isWorldMatrixFrozen","_getEffectiveParent","_getActionManagerForTrigger","trigger","initialCall","isRecursive","hasSpecificTrigger","isIn","removed","_markSubMeshesAsDirty","_scaling","newScaling","normalizeToUnitCube","includeDescendants","ignoreRotation","setBoundingInfo","skeletonsEnabled","_freeze","_unFreeze","movePOV","amountRight","amountUp","amountForward","calcMovePOV","rotMatrix","translationDelta","defForwardMult","rotatePOV","flipBack","twirlClockwise","tiltRight","calcRotatePOV","matricesIndicesData","matricesWeightsData","needExtras","matricesIndicesExtraData","matricesWeightsExtraData","prepare","skeletonMatrices","finalMatrix","tempMatrix","matWeightIdx","inf","weight","_effectiveMesh","IsGlobal","updateBoundingInfo","_afterComputeWorldMatrix","getChildMeshes","collisionEnabled","moveWithCollisions","displacement","_collideForSubMesh","transformMatrix","_lastColliderWorldVertices","_lastColliderTransformMatrix","_trianglePlanes","_collide","_processCollisionsForSubMeshes","getCollidingSubMeshCandidates","collisionsScalingMatrix","collisionsTransformMatrix","worldToUse","intersectInfo","getIntersectingSubMeshCandidates","anySubmeshSupportIntersect","canIntersects","currentIntersectInfo","worldOrigin","freeActiveMeshes","generator","isOcclusionQueryInProgress","removeMesh","disableFacetData","onAfterWorldMatrixUpdateObservable","addChild","setParent","removeChild","_initFacetData","facetNormals","facetPositions","facetPartitioning","updateFacetData","bInfo","depthSortedIndices","needs32bits","facetDepthSortFunction","sqDistance","depthSortedFacets","depthSortedFacet","ind","facetDepthSortOrigin","bbSizeMax","getFacetLocalNormals","getFacetLocalPositions","getFacetLocalPartitioning","depthSort","distanceTo","sind","updateIndices","facetData","getFacetPosition","getFacetPositionToRef","localPos","getFacetNormal","getFacetNormalToRef","localNorm","getFacetsAtLocalCoordinates","ox","oy","oz","getClosestFacetAtCoordinates","projected","checkFace","facing","invMat","invVect","closest","getClosestFacetAtLocalCoordinates","tmpx","tmpy","tmpz","t0","projx","projy","projz","facetsInBlock","fib","shortest","tmpDistance","getFacetDataParameters","gpuMemoryOnly","createNormals","alignWithNormal","upDirection","axisX","axisZ","_checkOcclusionQuery","disableEdgesRendering","enableEdgesRendering","checkVerticesInsteadOfIndices","getConnectedParticleSystems","OCCLUSION_TYPE_NONE","OCCLUSION_TYPE_OPTIMISTIC","OCCLUSION_TYPE_STRICT","OCCLUSION_ALGORITHM_TYPE_ACCURATE","OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE","CULLINGSTRATEGY_STANDARD","CULLINGSTRATEGY_OPTIMISTIC_INCLUSION","CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY","Buffer","postponeInternalCreation","instanced","useBytes","_isAlreadyOwned","_updatable","_instanced","_divisor","VertexBuffer","isUpdatable","getStrideSize","updateDynamicVertexBuffer","vertexCount","_increaseReferences","takeBufferOwnership","_ownsBuffer","_kind","data_1","Int8Array","Int16Array","typeByteLength","GetTypeByteLength","DeduceStride","_instanceDivisor","getKind","getOffset","ForEach","UVKind","UV2Kind","UV3Kind","UV4Kind","UV5Kind","UV6Kind","NormalKind","PositionKind","ColorKind","MatricesIndicesKind","MatricesIndicesExtraKind","MatricesWeightsKind","MatricesWeightsExtraKind","TangentKind","componentCount","componentType","componentIndex","dataView","DataView","componentByteLength","componentByteOffset","_GetFloatValue","getInt8","getUint8","getInt16","getUint16","getInt32","getUint32","getFloat32","Geometry","_totalVertices","_isDisposed","_indexBufferIsUpdatable","_positionsCache","useBoundingInfoFromGeometry","_meshes","_vertexBuffers","_indices","setAllVerticesData","_vertexArrayObjects","_boundingBias","CreateGeometryForMesh","RandomId","_extend","_indexBuffer","applyToGeometry","notifyUpdate","_updateExtend","_resetPointsArrayCache","numOfMeshes","_createGlobalSubMesh","_disposeVertexArrayObjects","updateVerticesDataDirectly","getVertexBuffer","subMeshes_1","vbs","forceCopy","tightlyPackedByteStride","copy_1","remainder","isVertexBufferUpdatable","vb","_delayInfo","getVerticesDataKinds","needToUpdateSubMeshes","updateDynamicIndexBuffer","orig","copy","releaseForMesh","shouldDispose","previousGeometry","pushGeometry","_applyToMesh","_syncGeometryWithMorphTargetManager","synchronizeInstances","onGeometryUpdated","_queueLoad","delayLoadingFile","_delayLoadingFunction","toLeftHanded","tIndices","tTemp","tPositions","tNormals","arrayIdx","removeGeometry","stopChecking","toNumberArray","serializeVerticeData","tangets","uv2s","uv3s","uv4s","uv5s","uv6s","matricesIndices","_isExpanded","matricesWeights","ExtractFromMesh","_ImportGeometry","parsedGeometry","geometryId","getGeometryByID","binaryInfo","_binaryInfo","positionsAttrDesc","positionsData","normalsAttrDesc","normalsData","tangetsAttrDesc","tangentsData","uvsAttrDesc","uvsData","uvs2AttrDesc","uvs2Data","uvs3AttrDesc","uvs3Data","uvs4AttrDesc","uvs4Data","uvs5AttrDesc","uvs5Data","uvs6AttrDesc","uvs6Data","colorsAttrDesc","colorsData","matricesIndicesAttrDesc","floatIndices","matricesIndicesExtraAttrDesc","matricesWeightsAttrDesc","indicesAttrDesc","indicesData","subMeshesAttrDesc","subMeshesData","materialIndex","tangents","uvs2","uvs3","uvs4","uvs5","uvs6","matricesIndex","matricesIndicesExtra","_CleanMatricesWeights","matricesWeightsExtra","parsedSubMesh","_shouldGenerateFlatShading","convertToFlatShadedMesh","onMeshImportedObservable","noInfluenceBoneIndex","skeletonId","getLastSkeletonByID","numBoneInfluencer","firstZeroWeight","mweight","parsedVertexData","boundingBoxMinimum","boundingBoxMaximum","hasUVs","hasUVs2","hasUVs3","hasUVs4","hasUVs5","hasUVs6","hasColors","hasMatricesIndices","hasMatricesWeights","MeshLODLevel","_InstanceDataStorage","batchCache","_InstancesBatch","instancesBufferSize","mustReturn","hardwareInstancedRendering","_ThinInstanceDataStorage","matrixBuffer","matrixBufferSize","worldMatrices","_InternalMeshDataInfo","_areNormalsFrozen","_preActivateId","_LODLevels","_morphTargetManager","clonePhysicsImpostor","_internalMeshDataInfo","_thinInstanceDataStorage","_effectiveMaterial","DEFAULTSIDE","overrideMaterialSideOrientation","useClonedMeshMap","directDescendants","getDescendants","index_1","getPhysicsEngine","physicsEngine","impostor","getImpostorForPhysicsObject","physicsImpostor","system","_GetDefaultSideOrientation","FRONTSIDE","_sourcePositions","_sourceNormals","_onBeforeRenderObservable","_onBeforeBindObservable","_onAfterRenderObservable","_onBeforeDrawObservable","_onBeforeDrawObserver","onBeforeDrawObservable","instancesData","manualUpdate","instantiateHierarchy","onNewNodeCreated","doNotInstantiate","getChildTransformNodes","ib","getLODLevels","_sortLODLevels","addLODLevel","getLODLevelAtDistance","internalDataInfo","removeLODLevel","bSphere","distanceToCamera","onLODLevelSelection","_checkDelayState","forceInstanceSupport","effectiveMaterial","_k","_l","_o","freezeNormals","unfreezeNormals","overridenInstanceCount","intermediateDefaultRenderId","defaultRenderId","selfDefaultRenderId","previousRenderId","thinInstanceRefreshBoundingInfo","edgesRenderer","totalIndices","needToRecreate","submesh","subdivide","subdivisionSize","markVerticesDataAsUpdatable","makeGeometryUnique","positionFunction","computeNormals","oldGeometry","_getLinesIndexBuffer","_linesIndexCount","registerBeforeRender","unregisterBeforeRender","removeCallback","registerAfterRender","unregisterAfterRender","_getInstancesRenderList","isReplacementMode","previousBatch","isInIntermediateRendering","_isInIntermediateRendering","onlyForInstances","currentRenderId","_renderWithInstances","batch","_id","instanceStorage","currentInstancesBufferSize","bufferSize","needUpdateBuffer","_processInstancedBuffers","_activeIndices","_renderWithThinInstances","_processRendering","renderingMesh","onBeforeDraw","visibleInstancesForSubMesh","visibleInstanceCount","enableAlphaMode","effectiveMeshReplacement","instanceDataStorage","setAlphaMode","_beforeRenderingMeshStage","mainDeterminant","_onBeforeDraw","_afterRenderingMeshStage","isInstance","cleanMatrixWeights","normalizeSkinWeightsAndExtra","normalizeSkinFourWeights","numWeights","recip","validateSkinning","skinned","valid","report","numberNotSorted","missingWeights","maxUsedWeights","numberNotNormalized","numInfluences","usedWeightCounts","lastWeight","usedWeights","tolerance","numBones","numBadBoneIndices","getBinaryData","setMaterialByID","bakeTransformIntoVertices","submeshes","flipFaces","bakeCurrentTransformIntoVertices","bakeIndependenlyOfChildren","resetLocalMatrix","_disposeInstanceSpecificData","_disposeThinInstanceSpecificData","applyDisplacementMap","minHeight","maxHeight","uvOffset","uvScale","forceUpdate","heightMapWidth","heightMapHeight","getImageData","applyDisplacementMapFromBuffer","kindIndex","kinds","newdata","updatableNormals","previousSubmeshes","vertexIndex","p3","localIndex","submeshIndex","previousOne","convertToUnIndexedMesh","flipNormals","vertex_data","increaseVertices","numberPerEdge","currentIndices","tempIndices","deltaPosition","deltaNormal","deltaUV","side","positionPtr","uvPtr","forceSharedVertices","currentUVs","currentPositions","currentColors","ptr","facet","pstring","indexPtr","uniquePositions","_instancedMeshFactory","_PhysicsImpostorParser","physicObject","jsonObject","others_1","optimizeIndices","vectorPositions","dupes","iteration","realPos","testedPosition","againstPosition","originalSubMeshes","pivotMatrix","localMatrix","pickable","materialId","morphTargetManagerId","_getComponent","getPhysicsImpostor","physicsMass","getParam","physicsFriction","physicsRestitution","serializationInstance","matrixData","thinInstances","_userThinInstanceBuffersStorage","userThinInstance","renderOverlay","morphTarget","getActiveTarget","getPositions","getUVs","parsedMesh","_GroundMeshParser","setPreTransformMatrix","showBoundingBox","useFlatShading","getMorphTargetManagerById","lodMeshIds","ids","distances","lodDistances","coverages","lodCoverages","parsedInstance","thinInstanceSetBuffer","CreateRibbon","pathArray","closeArray","closePath","CreateDisc","CreateHemisphere","CreateTorusKnot","tube","radialSegments","tubularSegments","CreatePolygon","shape","holes","earcutInjection","earcut","ExtrudePolygon","ExtrudeShape","ExtrudeShapeCustom","scaleFunction","rotationFunction","ribbonCloseArray","ribbonClosePath","CreateLathe","CreateGround","CreateTiledGround","xmin","xmax","CreateGroundFromHeightMap","onReady","alphaFilter","CreateTube","radiusFunction","CreatePolyhedron","CreateIcoSphere","CreateDecal","CreateCapsule","setPositionsForCPUSkinning","setNormalsForCPUSkinning","_softwareSkinningFrameId","getFrameId","hasNormals","tempVector3","MinMax","minVector","maxVector","MergeMeshes","disposeSource","allow32BitsIndices","meshSubclass","subdivideWithSubMeshes","multiMultiMaterials","otherVertexData","materialArray","materialIndexArray","indiceArray","merge","last","BACKSIDE","DOUBLESIDE","NO_CAP","CAP_START","CAP_END","CAP_ALL","NO_FLIP","FLIP_TILE","ROTATE_TILE","FLIP_ROW","ROTATE_ROW","FLIP_N_ROTATE_TILE","FLIP_N_ROTATE_ROW","CENTER","LEFT","RIGHT","TOP","BOTTOM","_applyTo","updateMesh","updateGeometry","meshOrGeometry","flip","transformed","tangentTransformed","use32BitsIndices","_validate","decal","_mergeElement","isSrcTypedArray","isOthTypedArray","ret32","getElementCount","positionsElementCount","validateElementCount","elementCount","_ExtractFrom","ExtractFromGeometry","CreateTiledBox","CreateTiledPlane","polygon","fUV","fColors","capSubdivisions","ComputeNormals","p1p2x","p1p2y","p1p2z","p3p2x","p3p2y","p3p2z","faceNormalx","faceNormaly","faceNormalz","v1x","v1y","v1z","v2x","v2y","v2z","v3x","v3y","v3z","computeFacetNormals","computeFacetPositions","computeFacetPartitioning","computeDepthSort","faceNormalSign","xSubRatio","ySubRatio","zSubRatio","subSq","b1x","b1y","b1z","b2x","b2y","b2z","b3x","b3y","b3z","block_idx_o","block_idx_v1","block_idx_v2","block_idx_v3","nbFaces","dsf","_ComputeSides","li","ln","lp","lu","ImportVertexData","SubMesh","createBoundingBox","addToMesh","_linesIndexBuffer","_alphaIndex","_distanceToCamera","_currentMaterial","_renderingMesh","AddToMesh","getMesh","getReplacementMesh","getEffectiveMesh","replacementMesh","rootMaterial","_IsMultiMaterial","linesIndices","checkStopper","_intersectLines","_intersectUnIndexedLines","_intersectUnIndexedTriangles","_intersectTriangles","faceID","indexA","indexB","indexC","newMesh","newRenderingMesh","CreateFromIndices","minVertexIndex","maxVertexIndex","refresh","_thinInstanceUpdateBufferSize","thinInstanceSetMatrixAt","thinInstanceAdd","_thinInstanceInitializeUserStorage","thinInstanceBufferUpdated","staticBuffer","forceRefreshParentInfo","POSITIVE_INFINITY","NEGATIVE_INFINITY","numInstances","kindIsMatrix","currentSize","newData","isPure","_forward","_forwardInverted","_up","_right","_rightInverted","_rotation","_rotationQuaternion","_transformToBoneReferal","_isAbsoluteSynced","_billboardMode","BILLBOARDMODE_NONE","_preserveParentRotationForBillboard","scalingDeterminant","_infiniteDistance","ignoreNonUniformScaling","reIntegrateRotationIntoRotationQuaternion","_poseMatrix","_localMatrix","_usePivotMatrix","_absolutePosition","_absoluteScaling","_absoluteRotationQuaternion","_pivotMatrix","_indexInSceneTransformNodesArray","_nonUniformScaling","addTransformNode","newRotation","updatePoseMatrix","getPoseMatrix","pivotMatrixUpdated","localMatrixUpdated","_syncAbsoluteScalingAndRotation","postMultiplyPivotMatrix","_pivotMatrixInverse","newWorldMatrix","unfreezeWorldMatrix","absolutePositionX","absolutePositionY","absolutePositionZ","invertParentWorldMatrix","setPositionWithLocalVector","getPositionExpressedInLocalSpace","invLocalWorldMatrix","locallyTranslate","targetPoint","yawCor","pitchCor","rollCor","space","dv","_lookAtVectorCache","rotationMatrix","parentRotationMatrix","quaternionRotation","tmat","getAbsolutePivotPoint","getAbsolutePivotPointToRef","quatRotation","diffMatrix","invParentMatrix","attachToBone","bone","affectedTransformNode","getSkeleton","detachFromBone","rotate","_rotationAxisCache","rotateAround","tmpVector","finalScale","finalTranslation","finalRotation","translationMatrix","translationMatrixInv","displacementVector","tempV3","addRotation","accumulation","isSynchronized","useBillboardPosition","BILLBOARDMODE_USE_POSITION","useBillboardPath","preserveParentRotationForBillboard","BILLBOARDMODE_X","BILLBOARDMODE_Y","BILLBOARDMODE_Z","_TmpScaling","cameraWorldMatrix","cameraGlobalPosition","_TmpTranslation","_TmpRotation","scaleMatrix","translation_1","storedTranslation","BILLBOARDMODE_ALL","eulerAngles","_worldMatrixDeterminantIsDirty","independentOfChildren","bakedMatrix","tmpRotationQuaternion","registerAfterWorldMatrixUpdate","unregisterAfterWorldMatrixUpdate","getPositionInCameraSpace","getDistanceToCamera","currentSerializationObject","parsedTransformNode","transformNode","_getDescendants","removeTransformNode","transformNodes_1","storedRotation","storedRotationQuaternion","sizeVec","maxDimension","ArrayTools","BuildArray","itemBuilder","CanvasGenerator","CreateCanvas","OffscreenCanvas","__decoratorInitialStore","__mergedStore","_copySource","creationFunction","instanciate","classStore","getMergedStore","propertyDescriptor","sourceProperty","propertyType","classKey","store","initialStore","parent_1","getPrototypeOf","generateSerializableMember","sourceName","propertyKey","getDirectStore","expandToProperty","targetKey","setCallback","generateExpandMember","serializeAsTexture","serializeAsColor3","serializeAsFresnelParameters","serializeAsVector2","serializeAsVector3","serializeAsMeshReference","serializeAsColorCurves","serializeAsColor4","serializeAsImageProcessingConfiguration","serializeAsQuaternion","serializeAsMatrix","SerializationHelper","Serialize","entity","serializedProperties","targetPropertyName","_TextureParser","_FresnelParametersParser","getLastMeshByID","_ColorCurvesParser","_ImageProcessingConfigurationParser","getCameraByID","Clone","Instanciate","cloneValue","destinationObject","DeepCopier","DeepCopy","doNotCopyList","mustCopyList","proerties_1","obj","props","getOwnPropertyNames","getAllPropertyNames","sourceValue","typeOfSourceValue","clonedValue","_DevTools","WarnImport","DomManagement","IsWindowObjectExist","IsNavigatorAvailable","IsDocumentAvailable","GetDOMTextContent","firstChild","nodeType","textContent","RetryStrategy","ExponentialBackoff","maxRetries","baseInterval","retryIndex","BaseError","_setPrototypeOf","setPrototypeOf","proto","__proto__","LoadFileError","object","RequestFileError","ReadFileError","FileTools","_CleanUrl","SetCorsBehavior","CorsBehavior","crossOrigin","LoadImage","usingObjectURL","URL","createObjectURL","PreprocessUrl","Image","LoadFile","createImageBitmap","imgBmp","revokeObjectURL","loadHandler","err","inputText","noOfflineSupport","enableTexturesOffline","loadImage","textureName","decodeURIComponent","blobURL","ReadFile","reader","FileReader","onloadend","onerror","onload","onprogress","readAsArrayBuffer","readAsText","fileName","RequestFile","onOpened","loadUrl","BaseUrl","aborted","fileRequest","retryHandle","XMLHttpRequest","DONE","clearTimeout","retryLoop","responseType","onLoadEnd","onReadyStateChange","IsFileURL","retryStrategy","DefaultRetryStrategy","waitTime","statusText","enableSceneOffline","noOfflineSupport_1","loadFile","protocol","FilesInputStore","FilesToLoad","GUID","InstantiationTools","Instantiate","className","RegisteredExternalClasses","Logger","_AddLogEntry","entry","_LogCache","OnNewCacheEntry","_FormatMessage","padStr","date","Date","getHours","getMinutes","getSeconds","_LogDisabled","_LogEnabled","formattedMessage","_WarnDisabled","_WarnEnabled","warn","_ErrorDisabled","_ErrorEnabled","errorsCount","ClearLogCache","MessageLogLevel","Log","WarningLogLevel","Warn","ErrorLogLevel","NoneLogLevel","AllLogLevel","EventState","skipNextObservers","initalize","Observer","scope","_willBeUnregistered","unregisterOnNextCall","Observable","MultiObserver","_observers","_observables","Watch","observables","observables_1","observer","onObserverAdded","_eventState","_onObserverAdded","insertFirst","unregisterOnFirstCall","_deferUnregister","_remove","makeObserverTopPriority","makeObserverBottomPriority","eventData","userInfo","lastReturnValue","obs","notifyObserversWithPromise","lastReturnedValue","notifyObserver","hasSpecificMask","PerfCounter","_startMonitoringTime","_min","_max","_average","_lastSecAverage","_current","_totalValueCount","_totalAccumulated","_lastSecAccumulated","_lastSecTime","_lastSecValueCount","fetchNewFrame","newCount","fetchResult","Enabled","_fetchResult","beginMonitoring","endMonitoring","newFrame","currentTime","PrecisionDate","performance","FxaaPostProcess","reusable","_getDefines","updateEffect","onApplyObservable","texelSize","glInfo","_Parse","parsedPostProcess","targetCamera","renderTargetSamplingMode","ScreenshotTools","CreateScreenshot","_getScreenshotSize","renderContext","newWidth","newHeight","renderingCanvas","CreateScreenshotAsync","CreateScreenshotUsingRenderTarget","antialiasing","enableStencilBuffer","targetTextureSize","renderCanvas","originalSize","previousCamera","previousCameras","activeCameras","renderToTexture","fxaaPostProcess","CreateScreenshotUsingRenderTargetAsync","SmartArray","_GlobalId","compareFn","contains","SmartArrayNoDuplicate","_duplicateId","__smartArrayFlags","concatWithNoDuplicate","StringTools","EndsWith","StartsWith","Decode","TextDecoder","decode","fromCharCode","EncodeArrayBufferToBase64","chr1","chr2","chr3","enc1","enc2","enc3","enc4","keyStr","bytes","PadNumber","AndOrNotEvaluator","Eval","query","evaluateCallback","_HandleParenthesisContent","parenthesisContent","or","ori","_SimplifyNegation","and","andj","booleanString","Tags","EnableFor","_tags","hasTags","HasTags","addTags","tagsString","AddTagsTo","removeTags","RemoveTagsFrom","matchesTagsQuery","tagsQuery","MatchesQuery","DisableFor","GetTags","asString","tagsArray","tag","_AddTagTo","_RemoveTagFrom","TimingTools","SetImmediate","setImmediate","PromiseStates","FulFillmentAgregator","InternalPromise","resolver","_state","Pending","_children","_rejectWasConsumed","_resolve","_reject","_resultValue","_parent","_result","onRejected","onFulfilled","newPromise","_onFulfilled","_onRejected","Fulfilled","returnedValue","returnedPromise","_reason","_moveChildren","Rejected","onLocalThrow","_RegisterForFulfillment","promise","agregator","rootPromise","all","promises","race","promises_1","PromisePolyfill","Apply","Tools","classes","FetchToRef","Mix","Slice","SliceToArray","IsExponentOfTwo","FloatRound","fround","_tmpFloatArray","GetFilename","GetFolderPath","uri","returnUnchangedIfNoSlash","ToDegrees","ToRadians","MakeArray","allowsNullUndefined","GetPointerPrefix","eventPrefix","PointerEvent","pointerEnabled","CleanUrl","LoadFileAsync","LoadScript","scriptUrl","scriptId","head","getElementsByTagName","script","appendChild","LoadScriptAsync","ReadFileAsDataURL","fileToLoad","progressCallback","readAsDataURL","FileAsURL","content","fileBlob","webkitURL","Format","decimals","IsEmpty","RegisterTopRootEvents","windowElement","events","UnregisterTopRootEvents","DumpFramebuffer","numberOfChannelsByLine","currentCell","targetCell","_ScreenshotCanvas","EncodeScreenshotCanvasData","ToBlob","toBlob","quality","binStr","charCodeAt","blob","stringDate","getFullYear","getMonth","getDate","Download","newWindow","body","msSaveBlob","display","href","download","parentElement","click","BackCompatCameraNoPreventDefault","args","IsBase64","DecodeBase64","decodedString","bufferLength","bufferView","GetAbsoluteUrl","PerformanceUserMarkLogLevel","StartPerformanceCounter","_StartUserMark","EndPerformanceCounter","_EndUserMark","PerformanceConsoleLogLevel","_StartPerformanceConsole","_EndPerformanceConsole","_StartPerformanceCounterDisabled","_EndPerformanceCounterDisabled","counterName","_performance","mark","measure","timeEnd","GetClassName","isType","First","el","getFullClassName","moduleName","classObj","DelayAsync","delay","IsSafari","UseCustomRequestHeaders","CustomRequestHeaders","PerformanceNoneLogLevel","AsyncLoop","iterations","_done","_fn","_successCallback","executeNext","breakLoop","Run","loop","SyncAsyncForLoop","syncedIterations","breakFunction","timeout","ceil","_TypeStore","GetClass","fqdn","RegisteredTypes","WebRequest","_xhr","_native","_injectCustomRequestHeaders","setRequestHeader","listener","method","CustomRequestModifiers","getResponseHeader","PostProcess","fragmentUrl","parameters","vertexUrl","blockCompilation","textureFormat","nodeMaterialSource","enablePixelPerfectMode","scaleMode","alwaysForcePOT","adaptScaleToCurrentViewport","_reusable","_scaleRatio","_texelSize","onActivateObservable","onSizeChangedObservable","_camera","_textureType","_textureFormat","_fragmentUrl","_vertexUrl","_parameters","_onActivateObserver","_onSizeChangedObserver","_onApplyObserver","_forcedOutputTexture","restoreDefaultInputTexture","getCamera","_shareOutputWithPostProcess","shareOutputWith","_disposeTextures","useOwnOutput","activate","sourceTexture","forceDepthStencil","maxSize","webVRCamera","desiredWidth","desiredHeight","needMipMaps","textureOptions","isStencilEnable","inputTexture","_allowPostProcessClearColor","alphaConstants","setAlphaConstants","_prePassEffectConfiguration","addEffectConfiguration","cameraId","postProcessType","PostProcessManager","_prepareBuffers","vertices","_buildIndexBuffer","postProcessesEnabled","targetTexture","doNotBindFrambuffer","doNotPresent","RenderingGroup","_opaqueSubMeshes","_transparentSubMeshes","_alphaTestSubMeshes","_depthOnlySubMeshes","_particleSystems","_spriteManagers","_opaqueSortCompareFn","_renderOpaque","renderOpaqueSorted","renderUnsorted","_alphaTestSortCompareFn","_renderAlphaTest","renderAlphaTestSorted","_transparentSortCompareFn","defaultTransparentSortCompare","_renderTransparent","renderTransparentSorted","activeMeshes","stencilState","_renderSprites","_renderParticles","onBeforeTransparentRendering","edgesRendererIndex","renderSorted","sortCompareFn","transparent","cameraPosition","_zeroVector","sortedArray","needDepthPrePass","backToFrontSortCompare","frontToBackSortCompare","dispatchSprites","spriteManager","onBeforeParticlesRenderingObservable","_activeParticles","onAfterParticlesRenderingObservable","spritesEnabled","onBeforeSpritesRenderingObservable","onAfterSpritesRenderingObservable","RenderingGroupInfo","RenderingManager","_renderingGroups","_autoClearDepthStencil","_customOpaqueSortCompareFn","_customAlphaTestSortCompareFn","_customTransparentSortCompareFn","_renderingGroupInfo","MIN_RENDERINGGROUPS","MAX_RENDERINGGROUPS","_clearDepthStencilBuffer","_depthStencilBufferAlreadyCleaned","spriteManagers","renderingGroup","renderingGroupMask","onBeforeRenderingGroupObservable","AUTOCLEAR","getAutoClearDepthStencilSetup","_beforeRenderingGroupDrawStage","_afterRenderingGroupDrawStage","onAfterRenderingGroupObservable","_prepareRenderingGroup","group","AbstractScene","rootNodes","morphTargetManagers","actionManagers","_environmentTexture","AddParser","parser","_BabylonFileParsers","GetParser","AddIndividualParser","_IndividualBabylonFileParsers","GetIndividualParser","jsonData","parserName","nodes","Node","_doNotSerialize","_isParentEnabled","_parentUpdateId","_parentNode","_worldMatrixDeterminant","_sceneRootNodesIndex","_animationPropertiesOverride","_isNode","_behaviors","AddNodeConstructor","_NodeConstructors","Construct","previousParentNode","_addToSceneRootNodes","_removeFromSceneRootNodes","lastIdx","animationPropertiesOverride","behavior","attachImmediately","isLoading","onDataLoadedObservable","getBehaviorByName","checkAncestors","ancestor","_setReady","getAnimationByName","_AnimationRangeFactory","nAnimations","deleteAnimationRange","getAnimationRange","animationRanges","speedRatio","serializationRanges","localRange","nodes_1","ParseAnimationRanges","parsedNode","thisAbstractMesh","descendants_1","childMesh","minBox","maxBox","StringDictionary","_count","getOrAddWithFactory","factory","getOrAdd","curVal","getAndRemove","ActionEvent","pointerX","pointerY","meshUnderPointer","sourceEvent","additionalData","CreateNewFromSprite","CreateNewFromScene","CreateNewFromPrimitive","prim","pointerPos","AbstractActionManager","hoverCursor","Triggers","t_int","HasSpecificTrigger","_ClickInfo","_singleClick","_doubleClick","_hasSwiped","_ignore","InputManager","_alreadyAttached","_wheelEventName","_meshPickProceed","_currentPickResult","_previousPickResult","_totalPointersPressed","_doubleClickOccured","_pointerX","_pointerY","_startingPointerPosition","_previousStartingPointerPosition","_startingPointerTime","_previousStartingPointerTime","_pointerCaptures","_meshUnderPointerId","_keyboardIsAttached","_pointerOverMesh","getMeshUnderPointerByPointerId","_unTranslatedPointerX","_unTranslatedPointerY","_updatePointerPosition","canvasRect","_processPointerMove","tabIndex","doNotHandleCursors","defaultCursor","isMeshPicked","setPointerOverMesh","hasPointerTriggers","_pointerMoveStage","onPointerMove","pi","_setRayOnPointerInfo","_checkPrePointerObservable","simulatePointerMove","pointerEventInit","simulatePointerDown","_processPointerDown","_pickedDownMesh","hasPickTriggers","processTrigger","pick","cameraToUseForPointers","LongPressDelay","_isPointerSwiping","_pointerDownStage","onPointerDown","DragMovementThreshold","simulatePointerUp","doubleTap","clickInfo","doubleClick","singleClick","_processPointerUp","_pickedUpMesh","onPointerPick","ignore","type_1","hasSwiped","doubleClickActionManager","_pointerUpStage","pickedDownActionManager","onPointerUp","isPointerCaptured","attachUp","attachDown","attachMove","elementToAttachTo","_alreadyAttachedTo","_initActionManager","act","pointerDownPredicate","_delayedSimpleClick","btn","DoubleClickDelay","_previousButtonPressed","_initClickEvent","obs1","obs2","checkPicking","needToIgnoreNext","checkSingleClickImmediately","ExclusiveDoubleClickMode","_previousDelayedSimpleClickTimeout","_delayedSimpleClickTimeout","checkDoubleClick","_onPointerMove","pointerMovePredicate","constantlyUpdateMeshUnderPointer","_onPointerDown","preventDefaultOnPointerDown","_onPointerUp","preventDefaultOnPointerUp","pointerUpPredicate","HasTriggers","_onKeyDown","onPreKeyboardObservable","_onKeyUp","attachedFunction","_onCanvasFocusObserver","activeElement","onmousewheel","underPointerMesh","getPointerOverMesh","UniqueIdGenerator","_UniqueIdCounter","_inputManager","_blockEntityCollection","autoClearDepthAndStencil","_environmentIntensity","_forceWireframe","_skipFrustumClipping","_forcePointsCloud","animationsEnabled","useConstantAnimationDeltaTime","onAfterRenderCameraObservable","onBeforeAnimationsObservable","onAfterAnimationsObservable","onBeforeDrawPhaseObservable","onAfterDrawPhaseObservable","onReadyObservable","onBeforeCameraRenderObservable","_onBeforeCameraRenderObserver","onAfterCameraRenderObservable","_onAfterCameraRenderObserver","onBeforeActiveMeshesEvaluationObservable","onAfterActiveMeshesEvaluationObservable","onNewCameraAddedObservable","onCameraRemovedObservable","onNewLightAddedObservable","onLightRemovedObservable","onNewGeometryAddedObservable","onGeometryRemovedObservable","onNewTransformNodeAddedObservable","onTransformNodeRemovedObservable","onNewMeshAddedObservable","onMeshRemovedObservable","onNewSkeletonAddedObservable","onSkeletonRemovedObservable","onNewMaterialAddedObservable","onNewMultiMaterialAddedObservable","onMaterialRemovedObservable","onMultiMaterialRemovedObservable","onNewTextureAddedObservable","onBeforeRenderTargetsRenderObservable","onAfterRenderTargetsRenderObservable","onBeforeStepObservable","onAfterStepObservable","onActiveCameraChanged","_registeredForLateAnimationBindings","_useRightHandedSystem","_timeAccumulator","_currentStepId","_currentInternalStep","_fogMode","FOGMODE_NONE","prePass","_shadowsEnabled","_lightsEnabled","_texturesEnabled","physicsEnabled","particlesEnabled","_skeletonsEnabled","lensFlaresEnabled","gravity","renderTargetsEnabled","dumpNextRenderTargets","probesEnabled","_meshesForIntersections","proceduralTexturesEnabled","_activeBones","_animationTime","animationTimeScale","_frameId","_executeWhenReadyTimeoutId","_intermediateRendering","_viewUpdateFlag","_projectionUpdateFlag","_toBeDisposed","_pendingData","dispatchAllSubMeshesOfActiveMeshes","_processedMaterials","_activeParticleSystems","_activeSkeletons","_softwareSkinnedMeshes","_activeAnimatables","_components","_serializableComponents","_transientComponents","_beforeCameraUpdateStage","_beforeClearStage","_gatherRenderTargetsStage","_gatherActiveCameraRenderTargetsStage","_isReadyForMeshStage","_beforeEvaluateActiveMeshStage","_evaluateSubMeshStage","_preActiveMeshStage","_cameraDrawRenderTargetStage","_beforeCameraDrawStage","_afterCameraDrawStage","_afterRenderStage","geometriesByUniqueId","_defaultMeshCandidates","_defaultSubMeshCandidates","_preventFreeActiveMeshesAndRenderingGroups","_activeMeshesFrozen","_skipEvaluateActiveMeshesCompletely","getDeterministicFrameTime","_blockMaterialDirtyMechanism","useGeometryUniqueIdsMap","_createUbo","setDefaultCandidateProviders","DefaultMaterialFactory","CollisionCoordinatorFactory","unTranslatedPointer","setStepId","newStepId","getStepId","getInternalStep","_activeCamera","_defaultMaterial","_collisionCoordinator","_registerTransientComponents","register","_addComponent","component","serializableComponent","addFromContainer","_getDefaultMeshCandidates","_getDefaultSubMeshCandidates","getActiveMeshCandidates","getActiveSubMeshCandidates","getCachedEffect","getCachedVisibility","getActiveIndices","getActiveParticles","getActiveBones","getAnimationRatio","_animationRatio","_sceneUbo","_executeOnceBeforeRender","execFunc","executeOnceBeforeRender","wasLoading","getWaitingItemsCount","whenReadyAsync","resetLastAnimationTimeFrame","_animationTimeLast","viewL","projectionL","viewR","projectionR","_multiviewSceneUbo","_updateMultiviewUbo","UniqueId","recursive","toRemove","newTransformNode","lastNode","removeSkeleton","removeMorphTargetManager","index2","removeParticleSystem","removeAnimation","animationName","targetMask","removeAnimationGroup","removeMultiMaterial","lastMaterial","removeActionManager","removeTexture","newLight","newCamera","addSkeleton","newSkeleton","addParticleSystem","newParticleSystem","addAnimation","newAnimation","addAnimationGroup","newAnimationGroup","addMultiMaterial","newMaterial","addMorphTargetManager","newMorphTargetManager","addGeometry","newGeometry","addActionManager","newActionManager","switchActiveCamera","setActiveCameraByID","setActiveCameraByName","getCameraByName","getAnimationGroupByName","getMaterialByUniqueID","getMaterialByName","getTextureByUniqueID","getCameraByUniqueID","getBoneByID","skeletonIndex","boneIndex","getBoneByName","getLightByName","getLightByID","getLightByUniqueID","getParticleSystemByID","_getGeometryByUniqueID","lastGeometry","getGeometries","getMeshesByID","getTransformNodeByID","getTransformNodeByUniqueID","getTransformNodesByID","getMeshByUniqueID","getLastEntryByID","getNodeByID","getNodeByName","getMeshByName","getTransformNodeByName","getSkeletonByUniqueId","getSkeletonById","getSkeletonByName","getMorphTargetById","managerIndex","numTargets","getMorphTargetByName","getPostProcessByName","postProcessIndex","addExternalData","_externalData","getExternalData","getOrAddExternalDataWithFactory","removeExternalData","_evaluateSubMesh","initialMesh","hasInstances","hasRenderTargetTextures","blockfreeActiveMeshesAndRenderingGroups","freezeActiveMeshes","skipEvaluateActiveMeshes","_evaluateActiveMeshes","unfreezeActiveMeshes","len_1","psLength","animate","hasSpecificTriggers2","_activeMesh","_multiviewTexture","_renderForCamera","softwareSkinnedMeshIndex","needRebind","renderIndex","renderTarget","hasSpecialRenderTargetCamera","_processSubCameras","_useMultiviewToSingleView","_renderMultiviewToSingleView","_checkIntersections","actionIndex","getTriggerParameter","areIntersecting","usePreciseIntersection","currentIntersectionInProgress","_executeCurrent","parameterMesh","_advancePhysicsEngineStep","_animate","deltaTime","MinDeltaTime","MaxDeltaTime","defaultFrameTime","defaultFPS","stepsTaken","maxSubSteps","internalSteps","updateCameras","ignoreAnimations","currentActiveCamera","customIndex","afterRender","freezeMaterials","unfreezeMaterials","beforeRender","clearCachedVertexData","vbName","cleanCachedTextureBuffer","baseTexture","getWorldExtends","filterPredicate","createPickingRayInCameraSpace","pickWithBoundingInfo","multiPick","multiPickWithRay","_getByTags","list","listByTags","getMeshesByTags","getCamerasByTags","getLightsByTags","getMaterialByTags","getTransformNodesByTags","useOfflineSupport","_requestFileAsync","_readFileAsync","FOGMODE_EXP","FOGMODE_EXP2","FOGMODE_LINEAR","SceneComponentConstants","NAME_EFFECTLAYER","NAME_LAYER","NAME_LENSFLARESYSTEM","NAME_BOUNDINGBOXRENDERER","NAME_PARTICLESYSTEM","NAME_GAMEPAD","NAME_SIMPLIFICATIONQUEUE","NAME_GEOMETRYBUFFERRENDERER","NAME_PREPASSRENDERER","NAME_DEPTHRENDERER","NAME_POSTPROCESSRENDERPIPELINEMANAGER","NAME_SPRITE","NAME_SUBSURFACE","NAME_OUTLINERENDERER","NAME_PROCEDURALTEXTURE","NAME_SHADOWGENERATOR","NAME_OCTREE","NAME_PHYSICSENGINE","NAME_AUDIO","STEP_ISREADYFORMESH_EFFECTLAYER","STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER","STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER","STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER","STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER","STEP_BEFORECAMERADRAW_EFFECTLAYER","STEP_BEFORECAMERADRAW_LAYER","STEP_BEFORECAMERADRAW_PREPASS","STEP_BEFORERENDERTARGETDRAW_LAYER","STEP_BEFORERENDERINGMESH_PREPASS","STEP_BEFORERENDERINGMESH_OUTLINE","STEP_AFTERRENDERINGMESH_PREPASS","STEP_AFTERRENDERINGMESH_OUTLINE","STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW","STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER","STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE","STEP_BEFORECAMERAUPDATE_GAMEPAD","STEP_BEFORECLEAR_PROCEDURALTEXTURE","STEP_AFTERRENDERTARGETDRAW_LAYER","STEP_AFTERCAMERADRAW_EFFECTLAYER","STEP_AFTERCAMERADRAW_LENSFLARESYSTEM","STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW","STEP_AFTERCAMERADRAW_LAYER","STEP_AFTERCAMERADRAW_PREPASS","STEP_AFTERRENDER_AUDIO","STEP_GATHERRENDERTARGETS_DEPTHRENDERER","STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER","STEP_GATHERRENDERTARGETS_SHADOWGENERATOR","STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER","STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER","STEP_BEFORECLEARSTAGE_PREPASS","STEP_POINTERMOVE_SPRITE","STEP_POINTERDOWN_SPRITE","STEP_POINTERUP_SPRITE","Stage","Create","registerStep","LayerSceneComponent","_drawCameraBackground","_drawCameraForeground","_drawRenderTargetBackground","_drawRenderTargetForeground","layers_1","layers_2","_drawCameraPredicate","isBackground","cameraLayerMask","renderOnlyInRenderTargetTextures","_drawRenderTargetPredicate","renderTargetTextures","removeFromContainer","Layer","imgUrl","alphaBlendingMode","layerComponent","_createIndexBuffer","_previousDefines","currentEffect","Style","_fontFamily","_fontStyle","_fontWeight","_fontSize","onChangedObservable","_host","fromString","AdvancedDynamicTexture","_rootContainer","_lastControlOver","_lastControlDown","_capturingControl","_linkedControls","_isFullscreen","_fullscreenViewport","_idealWidth","_idealHeight","_useSmallestIdeal","_renderAtIdealSize","_blockNextFocusCheck","_renderScale","_cursorChanged","_defaultMousePointerId","_numLayoutCalls","_numRenderCalls","_clipboardData","onClipboardObservable","onControlPickedObservable","onBeginLayoutObservable","onEndLayoutObservable","onBeginRenderObservable","onEndRenderObservable","applyYInversionOnUpdate","_useInvalidateRectOptimization","_invalidatedRectangle","_clearMeasure","onClipboardCopy","rawEvt","onClipboardCut","onClipboardPaste","_rootElement","_renderObserver","_checkUpdate","_preKeyboardObserver","_focusedControl","processKeyboard","_link","_onResize","_background","_markAllAsDirty","rwidth","rheight","_layerToDispose","control","onBlur","onFocus","executeOnAllControls","invalidateRect","invalidMinX","invalidMinY","invalidMaxX","invalidMaxY","createStyle","addControl","removeControl","_pointerMoveObserver","_canvasPointerOutObserver","_canvasBlurObserver","_getGlobalViewport","getProjectedPosition","globalViewport","projectedPosition","renderScale","getProjectedPositionWithZ","_loop_1","_linkedMesh","linkWithMesh","notRenderable","this_1","_moveToProjectedPosition","_render","strokeStyle","_layout","clearRect","save","restore","_changeCursor","_registerLastControlDown","_doPicking","buttonIndex","deltaX","_processObservables","_processPicking","_onPointerOut","_manageFocus","_cleanControlAfterRemovalFromList","_cleanControlAfterRemoval","tempViewport","_shouldBlockPointer","_attachToOnPointerOut","_attachToOnBlur","registerClipboardEvents","self","unRegisterClipboardEvents","attachToMesh","supportPointerMove","_forcePointerUp","focusedControl","friendlyControls","keepsFocusWith","canMoveFocus","friendlyControls_1","otherHost","isAscendant","moveFocusToControl","_lastPickedControl","isFocusInvisible","pointerEvent","entries","CreateForMesh","onlyAlphaTesting","diffuseTexture","emissiveTexture","opacityTexture","CreateForMeshTexture","CreateFullscreenUI","foreground","Container","_measureForChildren","_adaptWidthToChildren","_adaptHeightToChildren","logLayoutCycleErrors","maxLayoutCycle","_markAsDirty","_getTypeName","_flagDescendantsAsMatrixDirty","_markMatrixAsDirty","getChildByName","getChildByType","typeName","containsControl","_reOrderControl","clearControls","children_1","wasAdded","zIndex","_offsetLeft","_offsetTop","_localDraw","shadowBlur","shadowOffsetX","shadowOffsetY","shadowColor","_currentMeasure","_beforeLayout","_processMeasures","parentMeasure","_cachedParentMeasure","isEqualsTo","_evaluateClippingState","transformToRef","_prevCurrentMeasureTransformedIntoGlobalSpace","rebuildCount","_applyStates","computedWidth","computedHeight","_rebuildLayout","_isClipped","_tempParentMeasure","adaptWidthToChildren","_width","isPixel","paddingLeftInPixels","paddingRightInPixels","adaptHeightToChildren","_height","paddingTopInPixels","paddingBottomInPixels","_postMeasure","invalidatedRectangle","clipChildren","_clipForChildren","_intersectsRect","getDescendantsToRef","isHitTestVisible","_additionalProcessing","Vector2WithInfo","Matrix2D","fromValues","l0","l1","l3","l4","l5","detDiv","det4","det5","r0","r1","r2","r3","r4","r5","transformCoordinates","RotationToRef","ty","scaleX","scaleY","parentMatrix","_TempPreTranslationMatrix","_TempScalingMatrix","_TempRotationMatrix","_TempPostTranslationMatrix","_TempCompose0","_TempCompose1","_TempCompose2","Control","_alphaSet","_zIndex","_color","_style","_horizontalAlignment","HORIZONTAL_ALIGNMENT_CENTER","_verticalAlignment","VERTICAL_ALIGNMENT_CENTER","_wasDirty","_paddingLeft","_paddingRight","_paddingTop","_paddingBottom","_left","_top","_scaleX","_scaleY","_transformCenterX","_transformCenterY","_invertTransformMatrix","_transformedPosition","_isMatrixDirty","_isVisible","_isHighlighted","_fontSet","_dummyVector2","_downCount","_enterCount","_doNotRender","_downPointerIds","_disabledColor","_disabledColorItem","_customData","_automaticSize","isPointerBlocker","clipContent","useBitmapCache","_shadowOffsetX","_shadowOffsetY","_shadowBlur","_shadowColor","_linkOffsetX","_linkOffsetY","onWheelObservable","onPointerMoveObservable","onPointerOutObservable","onPointerDownObservable","onPointerUpObservable","onPointerClickObservable","onPointerEnterObservable","onDirtyObservable","onAfterDrawObservable","fixedRatio","_fixedRatioMasterIsWidth","_tmpMeasureA","_fontOffset","getValueInPixel","_resetFontCache","_styleObserver","isPercentage","fontSizeToUse","getValue","paddingLeft","paddingRight","paddingTop","paddingBottom","linkOffsetX","linkOffsetY","getAscendantOfClass","getLocalCoordinates","globalCoordinates","getLocalCoordinatesToRef","getParentLocalCoordinates","moveToVector3","horizontalAlignment","HORIZONTAL_ALIGNMENT_LEFT","verticalAlignment","VERTICAL_ALIGNMENT_TOP","oldLeft","oldTop","newLeft","newTop","ignoreAdaptiveScaling","rect","_transform","useInvalidateRectOptimization","leftShadowOffset","rightShadowOffset","topShadowOffset","bottomShadowOffset","_font","_prepareFont","_cachedOffsetX","_cachedOffsetY","_renderHighlight","isHighlighted","lineWidth","_renderHighlightSpecific","strokeRect","_isFontSizeInPercentage","AllowAlphaInheritance","globalAlpha","addAndTransformToRef","_preMeasure","_measure","_computeAlignment","parentWidth","parentHeight","HORIZONTAL_ALIGNMENT_RIGHT","VERTICAL_ALIGNMENT_BOTTOM","_clip","beginPath","_ClipMeasure","intersection","clip","_cacheData","coordinates","_onPointerEnter","canNotify","notifyClick","canNotifyClick","_onWheelScroll","previousControlOver","fontStyle","fontWeight","fontSizeInPixels","fontFamily","_GetFontOffset","_HORIZONTAL_ALIGNMENT_LEFT","_HORIZONTAL_ALIGNMENT_RIGHT","_HORIZONTAL_ALIGNMENT_CENTER","_VERTICAL_ALIGNMENT_TOP","_VERTICAL_ALIGNMENT_BOTTOM","_VERTICAL_ALIGNMENT_CENTER","_FontHeightSizes","innerHTML","block","verticalAlign","div","whiteSpace","fontAscent","fontHeight","ascent","descent","drawEllipse","AddHeader","Rectangle","_thickness","_cornerRadius","_drawRoundedRect","fill","stroke","moveTo","lineTo","quadraticCurveTo","TextWrapping","TextBlock","_text","_textWrapping","Clip","_textHorizontalAlignment","_textVerticalAlignment","_resizeToFit","_lineSpacing","_outlineWidth","_outlineColor","_underline","_lineThrough","onTextChangedObservable","onLinesReadyObservable","_breakLines","maxLineWidth","internalValue","updateInPlace","lineSpacing","_drawText","textWidth","strokeText","_renderLines","lineJoin","miterLimit","refWidth","Ellipsis","_lines_1","_line","_parseLineEllipsis","WordWrap","_lines_2","_parseLineWordWrap","_lines_3","_parseLine","characters","words","wordSplittingFunction","testLine","testWidth","rootY","computeExpectedHeight","widthInPixels","context_1","_loaded","_stretch","STRETCH_FILL","_autoScale","_sourceLeft","_sourceTop","_sourceWidth","_sourceHeight","_svgAttributesComputationCompleted","_isSVG","_cellWidth","_cellHeight","_cellId","_populateNinePatchSlicesFromImage","_imageDataCache","onImageLoadedObservable","onSVGAttributesComputedObservable","_extractNinePatchSliceDataFromImage","_detectPointerOnOpaqueOnly","_sliceLeft","_sliceRight","_sliceTop","_sliceBottom","synchronizeSizeWithContent","_rotate90","preserveProperties","_domImage","dataUrl","rotatedImage","_handleRotationForSVGImage","srcImage","dstImage","_rotate90SourceProperties","srcLeft","sourceLeft","srcTop","sourceTop","srcWidth","domImage","srcHeight","dstLeft","dstTop","dstWidth","sourceWidth","dstHeight","sourceHeight","_onImageLoaded","_imageWidth","_imageHeight","_svgCheck","SVGSVGElement","svgsrc","elemid","svgExist","querySelector","svgDoc","contentDocument","documentElement","getAttribute","docwidth","docheight","_getSVGAttribs","svgImage","svgobj","elem","vb_width","vb_height","elem_bbox","getBBox","elem_matrix_a","elem_matrix_d","elem_matrix_e","elem_matrix_f","baseVal","consolidate","STRETCH_NONE","STRETCH_UNIFORM","STRETCH_NINE_PATCH","STRETCH_EXTEND","_prepareWorkingCanvasForOpaqueDetection","_drawImage","sw","sh","tw","th","cellId","rowCount","naturalWidth","cellWidth","column","cellHeight","hRatio","vRatio","centerX","centerY","_renderNinePatch","_renderCornerPatch","targetX","targetY","leftWidth","topHeight","bottomHeight","rightWidth","centerWidth","targetCenterWidth","sliceLeft","targetTopHeight","Button","delegatePickingToChildren","alphaStore","pointerEnterAnimation","pointerOutAnimation","pointerDownAnimation","pointerUpAnimation","_image","_textBlock","CreateImageButton","imageUrl","textBlock","textWrapping","textHorizontalAlignment","iconImage","stretch","CreateImageOnlyButton","CreateSimpleButton","CreateImageWithCenterTextButton","StackPanel","_isVertical","_manualWidth","_manualHeight","_doNotTrackManualChanges","ignoreLayoutWarnings","isVertical","stackWidth","stackHeight","panelWidthChanged","panelHeightChanged","previousHeight","previousWidth","Checkbox","_isChecked","_checkSizeRatio","onIsCheckedChangedObservable","actualWidth","actualHeight","offsetWidth","offseHeight","isChecked","AddCheckBoxWithHeader","title","onValueChanged","panel","checkbox","header","TextWrapper","_characters","txt","removePart","idxStart","idxEnd","insertTxt","newCharacters","isWord","rWord","InputText","_placeholderText","_focusedBackground","_focusedColor","_placeholderColor","_margin","_autoStretchWidth","_maxWidth","_isFocused","_blinkIsEven","_cursorOffset","_deadKey","_addKey","_currentKey","_isTextHighlightOn","_textHighlightColor","_highligherOpacity","_highlightedText","_startHighlightIndex","_endHighlightIndex","_cursorIndex","_onFocusSelectAll","promptMessage","disableMobilePrompt","onBeforeKeyAddObservable","onFocusObservable","onBlurObservable","onTextHighlightObservable","onTextCopyObservable","onTextCutObservable","onTextPasteObservable","onKeyboardEventProcessedObservable","_textWrapper","valueAsString","_textHasChanged","autoStretchWidth","_scrollLeft","_blinkTimeout","_onClipboardObserver","_onPointerDblTapObserver","prompt","clipboardInfo","_onCopyText","_onCutText","_onPasteText","_processDblClick","_selectAllText","_connectedVirtualKeyboard","processKey","deletePosition","deadKey","insertPosition","_updateValueFromCursorIndex","moveLeft","moveRight","_clickedCoordinate","clipboardData","setData","types","clipTextLeft","_beforeRenderText","_textWidth","marginWidth","availableWidth","textLeft","absoluteCursorPosition","previousDist","cursorOffsetText","cursorOffsetWidth","cursorLeft","highlightCursorOffsetWidth","highlightCursorLeft","focusedColor","textWrapper","Grid","_rowDefinitions","_columnDefinitions","_cells","_childControls","getRowDefinition","getColumnDefinition","addRowDefinition","addColumnDefinition","setRowDefinition","setColumnDefinition","getChildrenAt","cell","getChildCellInfo","_tag","_removeCell","childIndex","_offsetCell","previousKey","removeColumnDefinition","removeRowDefinition","goodContainer","_getGridDefinitions","definitionCallback","widths","heights","lefts","tops","globalWidthPercentage","availableHeight","globalHeightPercentage","top_1","ColorPicker","_value","_tmpColor","_pointerStartedOnSquare","_pointerStartedOnWheel","_squareLeft","_squareTop","_squareSize","_s","_v","_lastPointerDownID","onValueChangedObservable","_pointerIsDown","_Epsilon","_updateSquareProps","squareSize","_drawGradientSquare","hueValue","lgh","createLinearGradient","addColorStop","lgv","_drawCircle","_createColorWheelCanvas","maxDistSq","innerRadius","minDistSq","distSq","dist","ang","alphaAmount","alphaRatio","wheelThickness","_colorWheelCanvas","_updateValueFromPointer","_isPointOnSquare","_isPointOnWheel","ShowPickerDialogAsync","advancedTexture","pickerWidth","pickerHeight","headerHeight","lastColor","swatchLimit","numSwatchesPerLine","closeIconColor","buttonFontSize","butEdit","buttonWidth","buttonHeight","currentColor","swatchNumber","swatchDrawer","picker","rValInt","gValInt","bValInt","rValDec","gValDec","bValDec","hexVal","newSwatch","lastVal","activeField","drawerMaxRows","rawSwatchSize","gutterSize","colGutters","swatchSize","drawerMaxSize","containerSize","buttonColor","buttonBackgroundColor","buttonBackgroundHoverColor","buttonBackgroundClickColor","luminanceLimitColor","luminanceLimit","inputFieldLabels","inputTextBackgroundColor","inputTextColor","editSwatchMode","updateValues","inputField","pickedColor","background","minusPound","updateInt","field","newValue","newSwatchRGB","createSwatch","savedColors","icon","swatch","swatchColor","swatchLuminence","metadata_1","setEditButtonVisibility","updateSwatches","butSave","editSwatches","gutterCount","currentRows","thisRow","totalButtonsThisRow","buttonIterations","disableButton","enableButton","pickerGrid","disabled","closePicker","dialogContainer","topRow","initialRows","pickerPanel","panelHead","pickerPanelRows","closeButton","headerColor3","textVerticalAlignment","currentSwatch","dialogBody","dialogBodyCols","pickerBodyRight","pickerBodyRightRows","pickerSwatchesButtons","pickerButtonsCol","pickerSwatches","pickeSwatchesRows","activeSwatches","labelWidth","labelHeight","labelTextSize","newText","swatchOutline","currentText","buttonGrid","buttonGridRows","butOK","butCancel","pickerColorValues","rgbValuesQuadrant","labelText","hexValueQuadrant","newHexValue","checkHex","leadingZero","Ellipse","InputPassword","pwdTextWrapper","Line","_lineWidth","_x1","_y1","_x2","_y2","_dash","_connectedControl","_connectedControlDirtyObserver","setLineDash","_effectiveX2","_effectiveY2","MultiLinePoint","multiLine","_multiLine","_point","_control","_controlObserver","onPointUpdate","_meshObserver","resetLinks","_translatePoint","xValue","yValue","MultiLine","getAt","_minX","_minY","_maxX","_maxY","RadioButton","childRadio","AddRadioButtonWithHeader","radio","BaseSlider","_thumbWidth","_minimum","_maximum","_barOffset","_isThumbClamped","_displayThumb","_step","_effectiveBarOffset","_getThumbPosition","_backgroundBoxLength","_getThumbThickness","thumbThickness","_backgroundBoxThickness","_prepareRenderingData","_renderLeft","_renderTop","_renderWidth","_renderHeight","_effectiveThumbThickness","displayThumb","isThumbClamped","Slider","_borderColor","_thumbColor","_isThumbCircle","_displayValueBar","isThumbCircle","thumbPosition","SelectorGroup","_groupPanel","_selectors","_groupHeader","_addGroupHeader","groupHeading","_getSelector","selectorNb","removeSelector","CheckboxGroup","addCheckbox","checked","_selector","isHorizontal","controlFirst","groupPanel","selectors","buttonBackground","_setSelectorLabel","_setSelectorLabelColor","_setSelectorButtonColor","_setSelectorButtonBackground","RadioGroup","_selectNb","addRadio","SliderGroup","addSlider","unit","onValueChange","borderColor","SelectionPanel","groups","_buttonColor","_buttonBackground","_headerColor","_barColor","_barHeight","_spacerHeight","_bars","_groups","_panel","_addSpacer","_setHeaderColor","_setbuttonColor","_labelColor","_setLabelColor","_setButtonBackground","_setBarColor","_setBarHeight","_setSpacerHeight","separator","bar","addGroup","removeGroup","groupNb","setHeaderName","relabel","removeFromGroupSelector","addToGroupCheckbox","addToGroupRadio","addToGroupSlider","onVal","_ScrollViewerWindow","_freezeControls","_bucketWidth","_bucketHeight","_buckets","_restoreMeasures","_updateMeasures","_useBuckets","_makeBuckets","setBucketSizes","_bucketLen","_dispatchInBuckets","_oldLeft","_oldTop","bStartX","_origLeft","origLeft","bEndX","bStartY","_origTop","origTop","bEndY","bucket","lstc","leftInPixels","topInPixels","origLeftForChildren","origTopForChildren","_updateChildrenMeasures","_parentMeasure","_scrollChildren","_scrollChildrenWithBuckets","scrollLeft","scrollTop","maxWidth","parentClientWidth","parentClientHeight","ScrollBar","_tempMeasure","_first","_originX","_originY","ImageScrollBar","_thumbLength","_thumbHeight","_barImageHeight","num90RotationInVerticalMode","_backgroundBaseImage","isLoaded","_backgroundImage","rotatedValue","_thumbBaseImage","_thumbImage","ScrollViewer","isImageBased","_barSize","_pointerIsOver","_wheelPrecision","_horizontalBarImageHeight","_verticalBarImageHeight","_oldWindowContentsWidth","_oldWindowContentsHeight","_forceHorizontalBar","_forceVerticalBar","_useImageBar","_horizontalBarSpace","_verticalBarSpace","_dragSpace","_grid","_horizontalBar","_verticalBar","_window","_addBar","barColor","barBackground","freezeControls","bucketWidth","bucketHeight","resetWindow","_buildClientSizes","idealRatio","forceVerticalBar","forceHorizontalBar","_clientWidth","_clientHeight","_updateScroller","_setWindowPosition","_barImage","hb","thumbImage","_horizontalBarImage","_verticalBarImage","thumbLength","thumbHeight","barImageHeight","_barBackground","_barBackgroundImage","backgroundImage","_horizontalBarBackgroundImage","_verticalBarBackgroundImage","windowContentsWidth","windowContentsHeight","_endLeft","_endTop","thumbWidth","_attachWheel","barControl","barContainer","barOffset","_onWheelObserver","KeyPropertySet","VirtualKeyboard","onKeyPressObservable","defaultButtonWidth","defaultButtonHeight","defaultButtonPaddingLeft","defaultButtonPaddingRight","defaultButtonPaddingTop","defaultButtonPaddingBottom","defaultButtonColor","defaultButtonBackground","shiftButtonColor","selectedShiftThickness","shiftState","_currentlyConnectedInputText","_connectedInputTexts","_onKeyPressObserver","_createKey","propertySet","addKeysRow","propertySets","maxKey","properties","heightInPixels","applyShiftState","rowContainer","button_tblock","connect","some","onFocusObserver","onBlurObserver","filtered","_removeConnectedInputObservables","connectedInputText","CreateDefaultLayout","DisplayGrid","_minorLineTickness","_minorLineColor","_majorLineTickness","_majorLineColor","_majorLineFrequency","_displayMajorLines","_displayMinorLines","cellCountX","cellCountY","cellX","cellY","ImageBasedSlider","_valueBarImage","tmpRect","tmpRect2","tmpV1","tmpV2","Measure","CombineToRef","addX","addY","addWidth","addHeight","Empty","ValueAndUnit","negativeValueAllowed","UNITMODE_PIXEL","_originalUnit","UNITMODE_PERCENTAGE","refValue","idealWidth","idealHeight","useSmallestIdeal","percentage","_Regex","sourceUnit","_UNITMODE_PERCENTAGE","_UNITMODE_PIXEL","KeepAssets","InstantiatedEntries","AssetContainer","_wasAddedToScene","instantiateModelsToScene","nameFunction","cloneMaterials","convertionMap","storeMap","alreadySwappedSkeletons","alreadySwappedMaterials","onClone","clonedMesh","oldMorphTargetManager","oldTarget","newOne","sourceMaterial","swap","multi","_linkedTransformNode","addAllToScene","addReflectionProbe","environmentTexture","removeAllFromScene","removeReflectionProbe","_moveAssets","sourceAssets","targetAssets","keepAssets","sourceAssets_1","asset","move","keepAssets_1","moveAllFromScene","createRootMesh","rootMesh","_targetConverter","nodeInAC","nodeInScene","animationInAC","animationsWithSameProperty_1","animationInScene","animationWithSameProperty","newAnimationGroups","animationGroupInAC","fromFrame","toFrame","loopAnimation","onAnimationLoop","DataReader","readAsync","_dataView","_dataByteOffset","readUint32","readUint8Array","readString","skipBytes","validateAsync","getExternalResource","externalResourceFunction","GLTFValidator","validateBytes","validateString","workerFunc","pendingExternalResources","onmessage","importScripts","postMessage","GLTFLoaderCoordinateSystemMode","GLTFLoaderAnimationStartMode","GLTFLoaderState","GLTFValidation","ValidateAsync","Worker","workerContent","workerBlobUrl","worker","onMessage","Configuration","_LoadScriptPromise","EComponentType","EShaderType","EParameterType","ETextureWrapMode","ETextureFilterType","ETextureFormat","ECullingType","EBlendingFunction","GLTFFileLoader","onParsedObservable","coordinateSystemMode","AUTO","animationStartMode","FIRST","compileMaterials","compileShadowGenerators","transparencyAsCoverage","useRangeRequests","createInstances","alwaysComputeBoundingBox","loadAllMaterials","preprocessUrlAsync","onMeshLoadedObservable","onTextureLoadedObservable","onMaterialLoadedObservable","onCameraLoadedObservable","onExtensionLoadedObservable","validate","onValidatedObservable","_loader","_requests","_logIndentLevel","_loggingEnabled","_log","_logDisabled","_capturePerformanceCounters","_startPerformanceCounter","_startPerformanceCounterDisabled","_endPerformanceCounter","_endPerformanceCounterDisabled","_onParsedObserver","_onMeshLoadedObserver","_onTextureLoadedObserver","_onMaterialLoadedObserver","_onCameraLoadedObserver","_onCompleteObserver","_onErrorObserver","_onExtensionLoadedObserver","_logEnabled","_startPerformanceCounterEnabled","_endPerformanceCounterEnabled","_onValidatedObserver","_progressCallback","fileRequest_1","webRequest","_unpackBinaryAsync","loaderData","json","_parseJson","arrayBuffer_1","meshesNames","_getLoader","magicBase64Encoded","arrayBuffer_2","whenCompleteAsync","_onProgress","_lengthComputable","lengthComputable","loaded","_total","total","request_1","minVersion","_parseVersion","_compareVersion","major","minor","createLoader","1","_CreateGLTF1Loader","2","_CreateGLTF2Loader","parsed","dataReader","magic","loggingEnabled","unpacked","_unpackBinaryV1Async","_unpackBinaryV2Async","contentLength","contentFormat","bodyLength","bin","startByteOffset_1","ChunkFormat","chunkLength","startByteOffset_2","_logOpen","_logClose","spaces","_logSpaces","IncrementalLoading","HomogeneousCoordinates","FreeCameraKeyboardMoveInput","keysUpward","keysDownward","FreeCameraMouseInput","touchEnabled","angularSensibility","previousPosition","onPointerMovedObservable","_allowCameraRotation","_onMouseMove","_CameraProperty","BaseCameraMouseWheelInput","wheelPrecisionX","wheelPrecisionY","wheelPrecisionZ","_wheelDeltaX","_wheelDeltaY","_wheelDeltaZ","_ffMultiplier","_normalize","platformScale","deltaMode","WheelEvent","DOM_DELTA_LINE","deltaZ","wheelDeltaY","wheelDeltaX","wheelDeltaZ","FreeCameraMouseWheelInput","_moveRelative","_rotateRelative","_moveScene","_wheelXAction","MoveRelative","_wheelXActionCoordinate","_wheelYAction","_wheelYActionCoordinate","_wheelZAction","_wheelZActionCoordinate","RotateRelative","MoveScene","_updateCamera","cameraTransformMatrix","transformedDirection","moveRelative","rotateRelative","moveScene","updateCameraProperty","cameraProperty","coordinate","FreeCameraTouchInput","allowMouse","touchAngularSensibility","touchMoveSensibility","_offsetX","_offsetY","_pointerPressed","isMouseEvent","FreeCameraInputsManager","_mouseInput","_mouseWheelInput","addMouse","removeMouse","removeMouseWheel","addTouch","FreeCamera","applyGravity","_needMoveForGravity","_oldPosition","_diffPosition","newPos","mouse","_collideWithWorld","collisionMask","actualDisplacement","Bone","parentBone","restPose","baseMatrix","_index","_absoluteTransform","_invertedAbsoluteTransform","_scalingDeterminant","_worldTransform","_needToDecompose","_needToCompose","_waitingTransformNodeId","_restPose","_bindPose","_baseMatrix","_updateDifferenceMatrix","_compose","getParent","updateDifferenceMatrix","getLocalMatrix","getBaseMatrix","getRestPose","setRestPose","getBindPose","setBindPose","returnToRest","_numBonesWithLinkedTransformNode","getInvertedAbsoluteTransform","getAbsoluteTransform","linkTransformNode","getTransformNode","_decompose","_localPosition","_markAsDirtyAndCompose","getRotation","setRotation","_localRotation","setRotationQuaternion","getScale","setScale","_localScaling","updateLocalMatrix","_markAsDirtyAndDecompose","rootMatrix","updateChildren","lm","computeAbsoluteTransforms","_tmpMats","_tmpVecs","scaleChildren","locMat","scaleMat","cm","getScaleToRef","setYawPitchRoll","_tmpQuat","rotMatInv","_getNegativeRotationToRef","_rotateWithMatrix","rmat","setAxisAngle","setRotationMatrix","rotMat2","lmat","lx","ly","lz","parentScale","parentScaleInv","getPosition","getPositionToRef","getAbsolutePositionToRef","poseMatrix","getRotationToRef","getRotationQuaternionToRef","getRotationQuaternion","amat","getAbsolutePositionFromLocal","getAbsolutePositionFromLocalToRef","getLocalPositionFromAbsolute","getLocalPositionFromAbsoluteToRef","setCurrentPoseAsRest","_convertRGBtoRGBATextureData","rgbData","rgbaData","_makeCreateRawTextureFunction","updateRawTexture3D","updateRawTexture2DArray","_makeUpdateRawTextureFunction","internalType","internalSizedFomat","compressedTexImage3D","updateRawTexture","updateRawCubeTexture","needConversion","mipmapGenerator","faceDataArrays","mipData","mipSize","mipFaceData","internalCallback","RawTexture","CreateLuminanceTexture","CreateLuminanceAlphaTexture","CreateAlphaTexture","CreateRGBTexture","CreateRGBATexture","CreateRTexture","Skeleton","_meshesWithPoseMatrix","_identity","_lastAbsoluteTransformsUpdateId","_canUseTextureForBones","_uniqueId","_hasWaitingData","_waitingOverrideMeshId","_useTextureToStoreBoneMatrices","onBeforeComputeObservable","engineCaps","useTextureToStoreBoneMatrices","_transformMatrices","getBoneIndexByName","nBones","copyAnimationRange","rescaleAsRequired","frameOffset","_getHighestAnimationFrame","boneDict","sourceBones","skelDimensionsRatio","dimensionsAtRest","boneName","sourceBone","highest","sceneAnimatables","getAllAnimatablesByTarget","rangeAnimatable","sceneAnimatable","animIndex","isAdditive","_computeTransformMatrices","targetMatrix","initialSkinMatrix","mappedIndex","bone_1","_matrix","_synchronizedWithMesh","textureWidth","rangeName","overrideMeshId","parent_2","serializedBone","parentBoneIndex","rest","linkedTransformNodeId","parsedSkeleton","parsedBone","parsedBoneIndex","sortBones","visited","_sortBones","ShadowLight","_needProjectionMatrixCompute","_setPosition","_setDirection","_direction","_shadowMinZ","forceProjectionMatrixCompute","_shadowMaxZ","computeTransformedInformation","transformedPosition","getDepthScale","getShadowDirection","needCube","needProjectionMatrixCompute","getDepthMinZ","shadowMinZ","getDepthMaxZ","shadowMaxZ","setShadowProjectionMatrix","viewMatrix","customProjectionMatrixBuilder","_setDefaultShadowProjectionMatrix","DirectionalLight","_shadowFrustumSize","_shadowOrthoScale","autoUpdateExtends","autoCalcShadowZBounds","_orthoLeft","_orthoRight","MIN_VALUE","_orthoTop","_orthoBottom","shadowFrustumSize","_setDefaultFixedFrustumShadowProjectionMatrix","_setDefaultAutoExtendShadowProjectionMatrix","shadowOrthoScale","PointLight","_shadowAngle","previousNeedCube","recreateShadowMap","shadowAngle","SpotLight","ETokenType","_innerAngle","_projectionTextureMatrix","_projectionTextureLightNear","_projectionTextureLightFar","_projectionTextureUpDirection","_projectionTextureViewLightDirty","_projectionTextureProjectionLightDirty","_projectionTextureDirty","_projectionTextureViewTargetVector","_projectionTextureViewLightMatrix","_projectionTextureProjectionLightMatrix","_projectionTextureScalingMatrix","_angle","_cosHalfAngle","_computeAngleValues","_shadowAngleScale","_projectionTexture","_IsProceduralTexture","_IsTexture","onGeneratedObservable","_computeProjectionTextureViewLightMatrix","_computeProjectionTextureProjectionLightMatrix","light_far","projectionTextureLightFar","light_near","projectionTextureLightNear","P","Q","S","_computeProjectionTextureMatrix","_lightAngleScale","_lightAngleOffset","projectionTexture","GLTFUtils","SetMatrix","semantic","FLOAT_MAT2","FLOAT_MAT3","FLOAT_MAT4","SetUniform","FLOAT_VEC2","FLOAT_VEC3","FLOAT_VEC4","GetWrapMode","GetByteStrideFromType","accessor","GetTextureFilterMode","GetBufferFromBufferView","gltfRuntime","loadedBufferView","loadedBufferViews","GetBufferFromAccessor","bufferViews","DecodeBufferToText","GetDefaultMaterial","_DefaultMaterial","Tokenizer","toParse","currentToken","UNKNOWN","currentIdentifier","currentString","isLetterOrDigitPattern","_toParse","_maxPos","getNextToken","isEnd","END_OF_INPUT","read","IDENTIFIER","glTFTransforms","babylonTransforms","glTFAnimationPaths","babylonAnimationPaths","parseObject","parsedObjects","runtimeProperty","parsedObject","normalizeUVs","attributeParameter","configureBoneTransformation","getParentBone","skins","jointName","nde","getNodeToRoot","nodesToRoot","nodeToRoot","getJointNode","nodeIsInJoints","jointNames","importSkeleton","babylonSkeleton","nodesToRootToAdd","getNodesToRoot","jointNode","existingBone","foundBone","jointNode_1","joint","forAssetContainer","babylonNode","verticesStarts","verticesCounts","indexStarts","indexCounts","meshID","primitives","tempVertexData","primitive","accessors","uvKind","material_1","configureNode","importNode","importOnlyMeshes","skin","importMeshesNames","orthoCamera","perspectiveCamera","persCamera","ambienLight","hemiLight","directionalLight","dirLight","pointLight","ptLight","spotLight","spLight","fallOfAngle","fallOffExponent","configureNodeFromMatrix","traverseNodes","meshIncluded","postLoad","currentScene","thing","anim","channels","lastAnimation","sampler","inputData","outputData","bufferInput","bufferOutput","targetID","targetNode","isBone","targetPath","targetPathIndex","babylonAnimation","arrayOffset","modifyKey","loadAnimations","onShaderCompileSuccess","technique","unTreatedUniforms","_","materialValues","techniqueUniforms","unif","onLoadTexture","SAMPLER_2D","GLTFLoaderExtension","LoadTextureAsync","prepareShaderMaterialUniforms","babylonTexture","onBindShaderMaterial","parseShaderUniforms","tokenizer","uniformParameter","transformIndex","importMaterials","LoadMaterialAsync","GLTFLoaderBase","CreateRuntime","parsedData","buffers","images","programs","techniques","extensionsUsed","buffersCount","shaderscount","loadedBufferCount","loadedShaderCount","dummyNodes","parsedBuffers","parsedBuffer","parseBuffers","parsedShaders","sha","parsedShader","parseShaders","LoadBufferAsync","LoadTextureBufferAsync","CreateTextureAsync","createMipMaps","revokeBlobURL","wrapS","wrapT","LoadShaderStringAsync","shaderString","states","newVertexShader","newPixelShader","vertexTokenizer","pixelTokenizer","attr","foundAttribute","onShaderCompileError","functions","blendFunc","GLTFLoader","RegisterExtension","Extensions","_importMeshAsync","LoadRuntimeAsync","_createNodes","skl","_loadBuffersAsync","_loadShadersAsync","_loadAsync","LoadRuntimeExtensionsAsync","hasShaders","processShader","VERTEX","hasBuffers","processBuffer","_name","loadRuntimeAsync","loadRuntimeExtensionsAsync","loadBufferAsync","loadTextureBufferAsync","createTextureAsync","loadShaderStringAsync","loadMaterialAsync","ApplyExtensions","loaderExtension","defaultFunc","extensionName","GLTFBinaryExtension","_bin","sourceExt","binaryExtensionShader","shaderBytes","GLTFMaterialsCommonExtension","ambientLight","ambient","directional","spot","fallOffAngle","standardMaterial","doubleSided","transparency","shininess","_loadTexture","emission","propertyPath","Deferred","_staticOffsetValueQuaternion","_staticOffsetValueVector3","_staticOffsetValueVector2","_staticOffsetValueSize","_staticOffsetValueColor3","RuntimeAnimation","_currentFrame","_originalValue","_originalBlendValue","_offsetsCache","_highLimitsCache","_stopped","_blendingFactor","_currentValue","_currentActiveTarget","_directTarget","_targetPath","_weight","_ratioOffset","_previousDelay","_previousRatio","_targetIsArray","_animation","_activeTargets","_animationState","_getCorrectLoopMode","_minFrame","_maxFrame","_minValue","_maxValue","newKey","target_1","_preparePath","_getOriginalValues","_clone","_enableBlending","targetIndex","restoreOriginal","_setValue","isDone","runtimeAnimations","setValue","originalValue","_registerTargetForLateAnimationBinding","goToFrame","onlyOnce","_prepareForSpeedRatioChange","newSpeedRatio","newRatio","keyOffset","fromValue","toValue","syncRoot","masterFrame","_onLoop","Animatable","_localDelayOffset","_pausedDelay","_paused","_speedRatio","_syncRoot","disposeOnEnd","animationStarted","onAnimationEndObservable","onAnimationLoopObservable","appendAnimations","syncWith","root","getAnimations","newRuntimeAnimation","getAnimationByTargetProperty","getRuntimeAnimationByTargetProperty","disableBlending","fps","pause","_raiseOnAnimationEnd","runtimeAnimation","waitAsync","running","isRunning","animationTime","_processLateAnimationBindings","returnedAnimatable","stopCurrent","shouldRunTargetAnimations","children_2","animatables_1","_lateAnimationHolders","totalWeight","totalAdditiveWeight","additiveAnimations","normalizer","finalPosition","finalScaling","finalQuaternion","originalAnimation","skipOverride","currentPosition","currentScaling","currentQuaternion","animIndex_1","refQuaternion","cumulativeQuaternion","quaternions","weights","cumulativeAmount","animIndex_2","matrixDecomposeMode","finalValue","_processLateAnimationBindingsForMatrices","_processLateAnimationBindingsForQuaternions","scale_1","animIndex_3","sourceRange","origTranslation","sourceKeys","sourceBoneLength","sourceParent","parentScalingReqd","parentRatio","dimensionsScalingReqd","destKeys","TargetedAnimation","targetId","AnimationGroup","_targetedAnimations","_from","_to","_loopAnimation","_isAdditive","onAnimationGroupLoopObservable","onAnimationGroupEndObservable","onAnimationGroupPauseObservable","onAnimationGroupPlayObservable","_isStarted","_isPaused","addTargetedAnimation","targetedAnimation","_processLoop","_animationLoopFlags","_animationLoopCount","_checkAnimationGroupEnded","play","setWeightForAllAnimatables","syncAllAnimationsWith","newName","newGroup","targetAnimation","targetedAnimations","targetedAnimationIndex","parsedAnimationGroup","sourceAnimationGroup","RGBDTextureTools","ExpandRGBDTexture","expandTexture","rgbdPostProcess_1","expandedTexture_1","BRDFTextureTools","GetEnvironmentBRDFTexture","environmentBRDFTexture","previousState","_environmentBRDFBase64Texture","_instanceNumber","PBRClearCoatConfiguration","_indexOfRefraction","_DefaultIndexOfRefraction","_useRoughnessFromMainTexture","useRoughnessFromMainTexture","_textureRoughness","textureRoughness","_remapF0OnInterfaceChange","remapF0OnInterfaceChange","bumpTexture","_isTintEnabled","isTintEnabled","tintColor","tintColorAtDistance","tintThickness","_tintTexture","tintTexture","disableBumpMap","CLEARCOAT","CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE","CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL","CLEARCOAT_REMAP_F0","CLEARCOAT_TEXTURE","CLEARCOAT_TEXTURE_ROUGHNESS","CLEARCOAT_BUMP","CLEARCOAT_DEFAULTIOR","CLEARCOAT_TINT","CLEARCOAT_TINT_TEXTURE","invertNormalMapX","invertNormalMapY","identicalTextures","eta","AddFallbacks","currentRank","clearCoatConfiguration","PBRAnisotropicConfiguration","ANISOTROPIC","ANISOTROPIC_TEXTURE","anisotropicConfiguration","PBRBRDFConfiguration","markAllSubMeshesAsMiscDirty","_useEnergyConservation","DEFAULT_USE_ENERGY_CONSERVATION","useEnergyConservation","_useSmithVisibilityHeightCorrelated","DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED","useSmithVisibilityHeightCorrelated","_useSphericalHarmonics","DEFAULT_USE_SPHERICAL_HARMONICS","useSphericalHarmonics","_useSpecularGlossinessInputEnergyConservation","DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION","useSpecularGlossinessInputEnergyConservation","_internalMarkAllSubMeshesAsMiscDirty","BRDF_V_HEIGHT_CORRELATED","MS_BRDF_ENERGY_CONSERVATION","SPHERICAL_HARMONICS","SPECULAR_GLOSSINESS_ENERGY_CONSERVATION","brdfConfiguration","PBRSheenConfiguration","_linkSheenWithAlbedo","linkSheenWithAlbedo","_albedoScaling","albedoScaling","SHEEN","SHEEN_LINKWITHALBEDO","SHEEN_ROUGHNESS","SHEEN_ALBEDOSCALING","SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE","SHEEN_TEXTURE_ROUGHNESS_IDENTICAL","SHEEN_TEXTURE","SHEEN_TEXTURE_ROUGHNESS","sheenConfiguration","PBRSubSurfaceConfiguration","markScenePrePassDirty","_isRefractionEnabled","isRefractionEnabled","_isTranslucencyEnabled","isTranslucencyEnabled","_isScatteringEnabled","isScatteringEnabled","_scatteringDiffusionProfileIndex","refractionIntensity","translucencyIntensity","useAlbedoToTintRefraction","_thicknessTexture","thicknessTexture","_volumeIndexOfRefraction","_invertRefractionY","_linkRefractionWithTransparency","linkRefractionWithTransparency","minimumThickness","maximumThickness","diffusionDistance","_useMaskFromThicknessTexture","useMaskFromThicknessTexture","_useMaskFromThicknessTextureGltf","useMaskFromThicknessTextureGltf","_internalMarkScenePrePassDirty","subSurfaceConfiguration","ssDiffusionProfileColors","enableSubSurfaceForPrePass","addDiffusionProfile","_getRefractionTexture","SUBSURFACE","SS_TRANSLUCENCY","SS_SCATTERING","SS_THICKNESSANDMASK_TEXTURE","SS_MASK_FROM_THICKNESS_TEXTURE","SS_MASK_FROM_THICKNESS_TEXTURE_GLTF","SS_REFRACTION","SS_REFRACTIONMAP_3D","SS_GAMMAREFRACTION","SS_RGBDREFRACTION","SS_LINEARSPECULARREFRACTION","SS_REFRACTIONMAP_OPPOSITEZ","SS_LODINREFRACTIONALPHA","SS_LINKREFRACTIONTOTRANSPARENCY","SS_ALBEDOFORREFRACTIONTINT","linearSpecularLOD","lodBasedMicrosurface","realTimeFiltering","refractionIor","volumeIndexOfRefraction","lodGenerationScale","lodGenerationOffset","activeEffect","fillRenderTargetTextures","renderTargets","SH3ylmBasisConstants","SH3ylmBasisTrigonometricTerms","applySH3","SHCosKernelConvolution","SphericalHarmonics","preScaled","l00","l1_1","l10","l11","l2_2","l2_1","l20","l21","l22","deltaSolidAngle","convertIncidentRadianceToIrradiance","convertIrradianceToLambertianRadiance","preScaleForRendering","FromPolynomial","polynomial","SphericalPolynomial","_harmonics","addAmbient","colorVector","FromHarmonics","harmonics","sp","FileFaceOrientation","worldAxisForNormal","worldAxisForFileX","worldAxisForFileY","CubeMapToSphericalPolynomialTools","ConvertCubeMapTextureToSphericalPolynomial","down","front","back","cubeInfo","ConvertCubeMapToSphericalPolynomial","sphericalHarmonics","totalSolidAngle","du","minUV","fileFace","FileFaces","dataArray","worldDirection","correctionFactor","PBRMaterialDefines","PBR","NUM_SAMPLES","REALTIME_FILTERING","ALBEDO","GAMMAALBEDO","ALBEDODIRECTUV","AMBIENTINGRAYSCALE","ALPHAFROMALBEDO","ALPHATESTVALUE","RADIANCEOVERALPHA","ALPHAFRESNEL","LINEARALPHAFRESNEL","REFLECTIVITY","REFLECTIVITYDIRECTUV","MICROSURFACEFROMREFLECTIVITYMAP","MICROSURFACEAUTOMATIC","LODBASEDMICROSFURACE","MICROSURFACEMAP","MICROSURFACEMAPDIRECTUV","METALLICWORKFLOW","ROUGHNESSSTOREINMETALMAPALPHA","ROUGHNESSSTOREINMETALMAPGREEN","METALLNESSSTOREINMETALMAPBLUE","AOSTOREINMETALMAPRED","METALLIC_REFLECTANCE","METALLIC_REFLECTANCEDIRECTUV","ENVIRONMENTBRDF","ENVIRONMENTBRDF_RGBD","TANGENT","NORMALXYSCALE","GAMMALIGHTMAP","USESPHERICALFROMREFLECTIONMAP","USEIRRADIANCEMAP","USESPHERICALINVERTEX","REFLECTIONMAP_OPPOSITEZ","LODINREFLECTIONALPHA","GAMMAREFLECTION","LINEARSPECULARREFLECTION","RADIANCEOCCLUSION","HORIZONOCCLUSION","USEPHYSICALLIGHTFALLOFF","USEGLTFLIGHTFALLOFF","FORCENORMALFORWARD","SPECULARAA","CLEARCOAT_TEXTUREDIRECTUV","CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV","CLEARCOAT_BUMPDIRECTUV","CLEARCOAT_TINT_TEXTUREDIRECTUV","ANISOTROPIC_TEXTUREDIRECTUV","SHEEN_TEXTUREDIRECTUV","SHEEN_TEXTURE_ROUGHNESSDIRECTUV","SS_THICKNESSANDMASK_TEXTUREDIRECTUV","UNLIT","DEBUGMODE","PBRBaseMaterial","_directIntensity","_emissiveIntensity","_specularIntensity","_lightingInfos","_disableBumpMap","_albedoTexture","_ambientTextureStrength","_ambientTextureImpactOnAnalyticalLights","DEFAULT_AO_ON_ANALYTICAL_LIGHTS","_reflectivityTexture","_metallicTexture","_metallic","_metallicF0Factor","_metallicReflectanceColor","_metallicReflectanceTexture","_microSurfaceTexture","_ambientColor","_albedoColor","_reflectivityColor","_reflectionColor","_emissiveColor","_microSurface","_useHorizonOcclusion","_useRadianceOcclusion","_useAlphaFromAlbedoTexture","_useMicroSurfaceFromReflectivityMapAlpha","_useRoughnessFromMetallicTextureAlpha","_useRoughnessFromMetallicTextureGreen","_useMetallnessFromMetallicTextureBlue","_useAmbientOcclusionFromMetallicTextureRed","_useAmbientInGrayScale","_useAutoMicroSurfaceFromReflectivityMap","_lightFalloff","LIGHTFALLOFF_PHYSICAL","_useRadianceOverAlpha","_parallaxScaleBias","_alphaCutOff","_useAlphaFresnel","_useLinearAlphaFresnel","_environmentBRDFTexture","_forceIrradianceInFragment","_realTimeFiltering","_realTimeFilteringQuality","_forceNormalForward","_enableSpecularAntiAliasing","_unlit","debugMode","debugLimit","debugFactor","clearCoat","anisotropy","brdf","sheen","subSurface","disableAlphaBlending","PBRMATERIAL_OPAQUE","PBRMATERIAL_ALPHATEST","_shouldUseAlphaFromAlbedoTexture","_getReflectionTexture","irradianceTexture","isMetallicWorkflow","_prepareDefines","fallbackRank","realTimeFilteringQuality","LIGHTFALLOFF_STANDARD","LIGHTFALLOFF_GLTF","wireframe","polynomials","preScaledHarmonics","ior","metallicF90","environmentIntensity","eyePosition","invertNormal","PBRMATERIAL_ALPHABLEND","PBRMATERIAL_ALPHATESTANDBLEND","PBRMaterial","directIntensity","emissiveIntensity","specularIntensity","ambientTextureStrength","ambientTextureImpactOnAnalyticalLights","metallicF0Factor","metallicReflectanceColor","albedoColor","reflectivityColor","reflectionColor","microSurface","useLightmapAsShadowmap","useAlphaFromAlbedoTexture","forceAlphaTest","useSpecularOverAlpha","useMicroSurfaceFromReflectivityMapAlpha","useRoughnessFromMetallicTextureAlpha","useRoughnessFromMetallicTextureGreen","useMetallnessFromMetallicTextureBlue","useAmbientOcclusionFromMetallicTextureRed","useAmbientInGrayScale","useAutoMicroSurfaceFromReflectivityMap","useRadianceOverAlpha","useObjectSpaceNormalMap","useParallax","useParallaxOcclusion","forceIrradianceInFragment","twoSidedLighting","useAlphaFresnel","useLinearAlphaFresnel","forceNormalForward","enableSpecularAntiAliasing","useHorizonOcclusion","useRadianceOcclusion","unlit","usePhysicalLightFalloff","useGLTFLightFalloff","MorphTarget","influence","onInfluenceChanged","_onDataLayoutChanged","_influence","previous","setPositions","hadPositions","hasPositions","setNormals","hadNormals","setTangents","hadTangents","hasTangents","setUVs","hadUVs","FromMesh","MorphTargetManager","_targets","_targetInfluenceChangedObservers","_targetDataLayoutChangedObservers","_supportsNormals","_supportsTangents","_supportsUVs","_vertexCount","_tempInfluences","enableNormalMorphing","enableTangentMorphing","enableUVMorphing","_influences","addTarget","_syncActiveTargets","removeTarget","influenceCount","synchronize","targetData","ArrayItem","Get","Assign","_completePromises","_forAssetContainer","_babylonLights","_disableInstancedMesh","_disposed","_extensions","_defaultBabylonMaterialData","UnregisterExtension","_RegisteredExtensions","_gltf","_babylonScene","_rootBabylonMesh","_rootUrl","_fileName","_loadData","nodeMap_1","_getMeshes","_getSkeletons","_getAnimationGroups","_getTransformNodes","_getGeometries","resultFunc","_uniqueRootUrl","_loadExtensions","_checkExtensions","loadingToReadyCounterName","LOADING","READY","loadingToCompleteCounterName","COMPLETE","_setState","_extensionsOnLoading","oldBlockMaterialDirtyMechanism","loadSceneAsync","babylonDrawMode","_loadMaterialAsync","_compileMaterialsAsync","_compileShadowGeneratorsAsync","resultPromise","_extensionsOnReady","_startAnimations","_setupData","binaryBuffer","nodeParents","_createRootNode","name_2","extensionsRequired","name_3","_babylonTransformNode","_LoadTransform","FORCE_RIGHT_HANDED","extensionPromise","_extensionsLoadSceneAsync","logOpen","loadNodeAsync","babylonMesh","_babylonBones","_loadAnimationsAsync","logClose","_forEachPrimitive","_primitiveBabylonMeshes","nodes_2","nodes_3","skins_1","animations_1","_babylonAnimationGroup","babylonAnimationGroups","ALL","babylonAnimationGroups_1","assign","_extensionsLoadNodeAsync","loadNode","babylonTransformNode","AddPointerMetadata","loadCameraAsync","babylonCamera","childNode","childBabylonMesh","nodeName","_loadMeshAsync","_loadMeshPrimitiveAsync","primitives_1","_loadSkinAsync","_extensionsLoadMeshPrimitiveAsync","babylonAbstractMesh","shouldInstance","_instanceData","babylonSourceMesh","babylonMesh_1","_createMorphTargets","_loadVertexDataAsync","babylonGeometry","_loadMorphTargetsAsync","_GetDrawMode","babylonMaterial","_createDefaultMaterial","_extensionsLoadVertexDataAsync","_loadIndicesAccessorAsync","loadAttribute","_loadVertexAccessorAsync","babylonVertexBuffer","mmin","mmax","_numMorphTargets","targetNames","extras","name_4","babylonMorphTarget","_loadMorphTargetVertexDataAsync","_loadFloatAccessorAsync","dataIndex","_extensionsLoadSkinAsync","assignSkeleton","_loadBones","_loadSkinInverseBindMatricesDataAsync","inverseBindMatricesData","_updateBoneMatrices","babylonBones","joints","_loadBone","babylonBone","babylonParentBone","_getNodeMatrix","inverseBindMatrices","_extensionsLoadCameraAsync","perspective","yfov","orthographic","xmag","ymag","loadAnimationAsync","_extensionsLoadAnimationAsync","babylonAnimationGroup","_loadAnimationChannelAsync","animationContext","animationTargetOverride","_loadAnimationSamplerAsync","getNextOutputValue","getNextKey","outputBufferOffset","frameIndex","_loop_2","babylonAnimationClone","inputAccessor","outputAccessor","_loadBufferAsync","_extensionsLoadBufferAsync","loadUriAsync","loadBufferViewAsync","_extensionsLoadBufferViewAsync","_loadAccessorAsync","numComponents","_GetNumComponents","bufferView_1","typedArray_1","_GetTypedArray","sparse","sparse_1","typedArray","indicesBufferView","valuesBufferView","valuesData","sparseLength","sparseData","valuesIndex","indicesIndex","_GetTypedArrayConstructor","_loadVertexBufferViewAsync","_babylonBuffer","_babylonVertexBuffer","bufferView_2","babylonBuffer","_loadMaterialMetallicRoughnessPropertiesAsync","baseColorFactor","metallic","metallicFactor","roughnessFactor","baseColorTexture","loadTextureInfoAsync","albedoTexture","metallicRoughnessTexture","nonColorData","metallicTexture","_extensionsLoadMaterialAsync","babylonData","createMaterial","babylonMeshes","loadMaterialPropertiesAsync","_extensionsCreateMaterial","_extensionsLoadMaterialPropertiesAsync","loadMaterialBasePropertiesAsync","pbrMetallicRoughness","loadMaterialAlphaProperties","emissiveFactor","normalTexture","occlusionTexture","ambientTexture","strength","alphaCutoff","textureInfo","_extensionsLoadTextureInfoAsync","texCoord","_textureInfo","_loadTextureAsync","_extensionsLoadTextureAsync","DefaultSampler","_createTextureAsync","textureLoaderOptions","samplerData","_loadSampler","deferred","noMipMaps","loadImageAsync","_GetTextureSamplingMode","_GetTextureWrapMode","_extensionsLoadUriAsync","_ValidateUri","babylonObject","gltf","lights_1","_forEachExtensions","_applyExtensions","functionName","actionAsync","loaderProperty","_activeLoaderExtensionFunctions","activeLoaderExtensionFunctions","onLoading","_loadUriAsync","LoadExtensionAsync","LoadExtraAsync","extra","isExtensionUsed","startPerformanceCounter","endPerformanceCounter","EnvironmentTextureTools","GetEnvInfo","_MagicBytes","manifestString","charCode","manifest","specularDataPosition","CreateEnvTextureAsync","cubeWidth","specularTextures","mipmapsCount","faceWidth","tempTexture","rgbdPostProcess","currentW","currentH","fileReader","irradiance","_CreateEnvTextureIrradiance","mipmaps","infoString","stringify","infoBuffer","infoView","strLen","totalSize","finalBuffer","finalBufferView","setUint8","polynmials","CreateImageDataArrayBufferViews","specularInfo","imageInfo","UploadEnvLevelsAsync","UploadLevelsAsync","_OnImageReadyAsync","generateNonLODTextures","lodTextures","cubeRtt","tempTexture_1","lodTexture","maxLODIndex","lodIndex","mipmapIndex","glTextureFromLod","_loop_3","_loop_4","image_1","UploadEnvSpherical","irradianceInfo","loadedFiles","onfinish","onErrorCallBack","_internalCount","files","_partialLoadFile","loadedImages","_partialLoadImg","createPolynomials","originalRootUrl","onloaddata_1","loadCubeData","supportCascades","_cascadeLoadFiles","_cascadeLoadImgs","imgs","faces","TEXTURE_CUBE_MAP_POSITIVE_Y","TEXTURE_CUBE_MAP_POSITIVE_Z","TEXTURE_CUBE_MAP_NEGATIVE_X","TEXTURE_CUBE_MAP_NEGATIVE_Y","TEXTURE_CUBE_MAP_NEGATIVE_Z","_setCubeMapTextureParams","CubeTexture","prefiltered","_rotationY","_forcedExtension","_createPolynomials","isDDS","isEnv","onLoadProcessing","setReflectionTextureMatrix","CreateFromImages","rootUrlKey","CreateFromPrefilteredData","oldValue","newCubeTexture","RawCubeTexture","updateRGBDAsync","NAME","EXT_lights_image_based","_lights","extensionContext","_loadLightAsync","babylonScene","imageData_1","specularImages","mipmap","specularImageContext","specularImageSize","_babylonTexture","irradianceCoefficients","EXT_mesh_gpu_instancing","translationBuffer","rotationBuffer","scaleBuffer","EXT_texture_webp","WorkerPool","workers","_pendingActions","_workerInfos","terminate","workerInfo","_execute","nextAction","decodeMesh","decoderModule","onIndicesData","onAttributeData","DecoderBuffer","Init","decoder","Decoder","GetEncodedGeometryType","TRIANGULAR_MESH","DecodeBufferToMesh","POINT_CLOUD","PointCloud","DecodeBufferToPointCloud","ok","error_msg","numIndices","num_faces","_malloc","GetTrianglesUInt32Array","HEAPF32","_free","processAttribute","num_components","numPoints","num_points","numValues","GetAttributeDataArrayForAllPoints","DT_FLOAT32","GetAttributeByUniqueId","nativeAttributeTypes","GetAttributeId","GetAttribute","destroy","decoderPromise","DracoDecoderModule","wasmBinary","getAbsoluteUrl","DracoCompression","numWorkers","DefaultNumWorkers","decoderInfo","wasmUrl","wasmBinaryUrl","WebAssembly","wasmBinaryPromise","fallbackUrl","_workerPoolPromise","decoderWasmBinary","workerPromises","_decoderModulePromise","module","GetDefaultNumWorkers","hardwareConcurrency","_Default","workerPool","decodeMeshAsync","dataViewCopy","KHR_draco_mesh_compression","DecoderAvailable","dracoCompression","_dracoBabylonGeometry","Default","babylonVertexData","KHR_lights","babylonLight","babylonSpotLight","outerConeAngle","innerConeAngle","KHR_materials_pbrSpecularGlossiness","_loadSpecularGlossinessPropertiesAsync","diffuseFactor","specularFactor","glossinessFactor","specularGlossinessTexture","reflectivityTexture","KHR_materials_unlit","_loadUnlitPropertiesAsync","KHR_materials_clearcoat","_loadClearCoatPropertiesAsync","clearcoatFactor","clearcoatTexture","clearcoatRoughnessFactor","clearcoatRoughnessTexture","clearcoatNormalTexture","KHR_materials_sheen","_loadSheenPropertiesAsync","sheenColorFactor","sheenColorTexture","sheenRoughnessFactor","sheenRoughnessTexture","KHR_materials_specular","_loadSpecularPropertiesAsync","specularColorFactor","specularTexture","metallicReflectanceTexture","KHR_materials_ior","_loadIorPropertiesAsync","_DEFAULT_IOR","KHR_materials_variants","GetAvailableVariants","extensionMetadata","_GetExtensionMetadata","variants","getAvailableVariants","SelectVariant","variantName","select","entries_1","variantName_1","lastSelected","selectVariant","Reset","original","GetLastSelectedVariant","getLastSelectedVariant","_variants","rootBabylonMesh","variants_1","mappings","mapping","variantIndex","variant","TransmissionHelper","_opaqueRenderTarget","_opaqueMeshesCache","_transparentMeshesCache","_getDefaultOptions","_transmissionHelper","_parseScene","_setupRenderTargets","renderSize","updateOptions","newOptions","oldOptions","getOpaqueTarget","shouldRenderAsTransmission","_addMesh","onMeshMaterialChanged","_removeMesh","transparentIdx","opaqueIdx","opaqueRTIndex","KHR_materials_transmission","_loadTransparentPropertiesAsync","pbrMaterial","transmissionFactor","transmissionTexture","KHR_materials_translucency","_loadTranslucentPropertiesAsync","translucencyFactor","translucencyTexture","KHR_mesh_quantization","KHR_texture_basisu","useRGBAIfASTCBC7NotAvailableWhenUASTC","KHR_texture_transform","AnimationEvent","Sound","urlOrArrayBuffer","readyToPlayCallback","autoplay","useCustomAttenuation","isPlaying","isPaused","spatialSound","refDistance","rolloffFactor","maxDistance","distanceModel","onEndedObservable","_panningModel","_playbackRate","_streaming","_startTime","_startOffset","_positionInEmitterSpace","_volume","_isReadyToPlay","_isDirectional","_coneInnerAngle","_coneOuterAngle","_coneOuterGain","_isOutputConnected","_urlType","_SceneComponentInitialization","_readyToPlayCallback","_customAttenuationFunction","currentVolume","currentDistance","volume","playbackRate","streaming","_offset","_soundGain","gain","_inputAudioNode","_outputAudioNode","_createSpatialParameters","mainSoundTrack","addSound","validParameter","MediaStream","urls","codecSupportedFound","_streamingSource","_soundLoaded","skipCodecCheck","_htmlAudioElement","Audio","controls","preload","removeSound","soundTrackId","soundTracks","_soundPanner","_soundSource","_audioBuffer","_connectedTransformNode","_registerFunc","audioData","setAudioBuffer","audioBuffer","_updateSpatialParameters","loopStart","loopEnd","headphone","panningModel","switchPanningModelToHRTF","_switchPanningModel","switchPanningModelToEqualPower","connectToSoundTrackAudioNode","soundTrackAudioNode","setDirectionalCone","coneInnerAngle","coneOuterAngle","coneOuterGain","setLocalDirectionToMesh","newLocalDirection","_updateDirection","setOrientation","updateDistanceFromListener","setAttenuationFunction","audioEnabled","startTime","onended","_onended","tryToPlay","playPromise","oldSource_1","actualOffset","stopTime","setVolume","newVolume","cancelScheduledValues","setValueAtTime","linearRampToValueAtTime","setPlaybackRate","newPlaybackRate","getVolume","_onRegisterAfterWorldMatrixUpdate","detachFromMesh","setBufferAndRun","clonedSound","getAudioBuffer","currentOptions","getSoundSource","getSoundGain","connectedMeshId","isDirectional","localDirectionToMesh","parsedSound","sourceSound","soundUrl","soundName","newSound","soundPosition","connectedMesh","WeightedSound","sounds","_sounds","_weights","weightSum","weights_1","invWeightSum","directionalConeInnerAngle","directionalConeOuterAngle","_currentIndex","startOffset","randomValue","sound","MSFT_audio_emitter","_clips","_emitters","clips","emitters","emitterIndex","_loadEmitterAsync","_babylonSounds","event_1","_loadAnimationEventAsync","_loadClipAsync","_objectURL","_babylonData","clipPromises","options_1","clipContext","objectURL","weightedSound","_getEventAction","babylonAnimationEvent","MSFT_lod","maxLODsToLoad","onNodeLODsLoadedObservable","onMaterialLODsLoadedObservable","_bufferLODs","_nodeIndexLOD","_nodeSignalLODs","_nodePromiseLODs","_nodeBufferLODs","_materialIndexLOD","_materialSignalLODs","_materialPromiseLODs","_materialBufferLODs","indexLOD","_loadBufferLOD","this_2","firstPromise","nodeLODs","_getLODs","nodeLOD","previousNodeLOD","_disposeTransformNode","materialLODs","materialLOD","previousDataLOD","_disposeMaterials","previousIndexLOD","bufferLODs","bufferLOD","babylonMaterials","babylonMaterialsToDispose","every","babylonTextures","babylonMaterials_1","MSFT_minecraftMesh","extraContext","MSFT_sRGBFactors","ExtrasAsMetadata","_assignExtras","gltfProp","exports","utils","settle","cookies","buildURL","buildFullPath","parseHeaders","isURLSameOrigin","createError","config","requestData","requestHeaders","headers","isFormData","auth","username","password","unescape","encodeURIComponent","Authorization","btoa","fullPath","baseURL","responseHeaders","getAllResponseHeaders","params","paramsSerializer","onreadystatechange","onabort","ontimeout","timeoutErrorMessage","transitional","clarifyTimeoutError","isStandardBrowserEnv","xsrfValue","withCredentials","xsrfCookieName","xsrfHeaderName","isUndefined","onDownloadProgress","onUploadProgress","upload","cancelToken","cancel","Axios","mergeConfig","defaultConfig","axios","instanceConfig","defaults","Cancel","CancelToken","isCancel","spread","isAxiosError","default","__CANCEL__","executor","TypeError","resolvePromise","throwIfRequested","InterceptorManager","dispatchRequest","validator","validators","interceptors","assertOptions","silentJSONParsing","boolean","forcedJSONParsing","requestInterceptorChain","synchronousRequestInterceptors","interceptor","runWhen","synchronous","fulfilled","rejected","responseInterceptorChain","chain","newConfig","getUri","handlers","use","eject","isAbsoluteURL","combineURLs","requestedURL","enhanceError","transformData","throwIfCancellationRequested","transformRequest","common","adapter","transformResponse","toJSON","columnNumber","config1","config2","valueFromConfig2Keys","mergeDeepPropertiesKeys","defaultToConfig2Keys","directMergeKeys","getMergedValue","isPlainObject","mergeDeepProperties","axiosKeys","otherKeys","validateStatus","fns","normalizeHeaderName","DEFAULT_CONTENT_TYPE","setContentTypeIfUnset","isArrayBuffer","isBuffer","isStream","isFile","isBlob","isArrayBufferView","isURLSearchParams","isObject","strictJSONParsing","isString","maxContentLength","maxBodyLength","thisArg","encode","serializedParams","parts","isDate","toISOString","hashmarkIndex","relativeURL","write","expires","domain","secure","cookie","isNumber","toGMTString","payload","originURL","msie","urlParsingNode","resolveURL","hostname","port","pathname","requestURL","normalizedName","ignoreDuplicateOf","pkg","deprecatedWarnings","currentVerArr","isOlderVersion","thanVersion","pkgVersionArr","destVer","isDeprecated","formatMessage","opt","desc","opts","schema","allowUnknown","isFunction","FormData","pipe","URLSearchParams","product","assignValue","stripBOM","clip_rgb","_clipped","_unclipped","classToType","unpack","keyOrder","TWOPI","PITHIRD","DEG2RAD","RAD2DEG","autodetect","last$1","clip_rgb$1","type$1","Color","me","sorted","chk","_rgb","Color_1","Function","chroma_1","unpack$1","rgb2cmyk_1","unpack$2","cmyk2rgb_1","unpack$3","type$2","cmyk","unpack$4","last$2","rnd","hsl2css_1","hsla","unpack$5","rgb2hsl_1","unpack$6","last$3","rgb2css_1","rgba","unpack$7","round$1","hsl2rgb_1","t3","h_","RE_RGB","RE_RGBA","RE_RGB_PCT","RE_RGBA_PCT","RE_HSL","RE_HSLA","round$2","css2rgb","css","named","rgb$1","i$1","rgb$2","i$2","rgb$3","i$3","hsl","rgb$4","hsl$1","rgb$5","css2rgb_1","type$3","unpack$8","unpack$9","rgb2hcg_1","unpack$a","hcg2rgb_1","assign$1","assign$2","assign$3","assign$4","assign$5","unpack$b","type$4","hcg","unpack$c","last$4","round$3","rgb2hex_1","hxa","RE_HEX","RE_HEXA","hex2rgb_1","u$1","type$5","unpack$d","rgb2hsi_1","min_","unpack$e","limit$1","TWOPI$1","hsi2rgb_1","unpack$f","type$6","hsi","unpack$g","type$7","unpack$h","min$1","max$1","rgb2hsv","max_","unpack$i","floor$1","hsv2rgb_1","unpack$j","type$8","hsv","labConstants","Kn","Xn","Yn","Zn","unpack$k","rgb2lab","ref$1","rgb2xyz","rgb_xyz","xyz_lab","rgb2lab_1","unpack$l","pow$1","lab2rgb","lab_xyz","xyz_rgb","lab2rgb_1","unpack$m","type$9","lab","unpack$n","sqrt$1","round$4","lab2lch_1","unpack$o","rgb2lch_1","b_","unpack$p","cos$1","lch2lab_1","unpack$q","lch2rgb_1","L","unpack$r","hcl2rgb_1","hcl","unpack$s","type$a","lch","w3cx11_1","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflower","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","laserlemon","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrod","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","maroon2","maroon3","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","purple2","purple3","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","type$b","unpack$t","rgb2num_1","type$c","num2rgb_1","type$d","unpack$u","type$e","round$5","temperature2rgb_1","kelvin","unpack$v","round$6","rgb2temperature_1","minTemp","maxTemp","eps","temperature","type$f","mutate","clipped","darken","brighten","darker","brighter","mc","type$g","pow$2","EPS","MAX_ITER","luminance","lum","cur_lum","max_iter","low","high","mid","interpolate","rgb2luminance","luminance_x","interpolator","type$h","mix","col1","col2","premultiply","saturate","desaturate","type$i","out","xyz0","xyz1","sqrt$2","pow$3","lrgb","lab$1","_hsx","hue0","hue1","sat0","sat1","lbv0","lbv1","sat","lch$1","num$1","c2","hcg$1","hsi$1","hsv$1","clip_rgb$2","pow$4","sqrt$3","PI$1","cos$2","sin$1","atan2$1","_average_lrgb","xyz","cnt","A","ci","xyz2","A$1","col","type$j","pow$5","_nacol","_spread","_domain","_padding","_classes","_colors","_out","_correctLightness","_colorCache","_useCache","_gamma","setColors","brewer","c$1","resetCache","getClass","tMapLightness","tMapDomain","getColor","bypassMap","analyze","limits","tOut","tBreaks","correctLightness","L0","L1","pol","L_actual","L_ideal","L_diff","padding","numColors","dd","__range__","asc","nodata","inclusive","ascending","bezier","I","lab0","lab1","lab2","lab3","I0","I1","bezier_1","blend","blend_f","c0","each","darken$1","lighten","screen","overlay","burn","dodge","blend_1","type$k","clip_rgb$3","TWOPI$2","pow$6","sin$2","cos$3","cubehelix","rotations","lightness","dl","dh","amp","cos_a","sin_a","digits","floor$2","random_1","log$1","pow$7","floor$3","sum","min_log","LOG10E","max_log","pb","pr","cluster","assignments","clusterSizes","repeat","nb_iters","centroids","i$4","mindist","best","j$1","newCentroids","j$2","i$5","j$3","j$4","kClusters","j$5","i$6","tmpKMeansBreaks","j$6","i$7","analyze_1","sqrt$4","atan2$2","abs$1","cos$4","PI$2","deltaE","C","b1","L2","b2","sl","h1","c4","delC","delA","delB","sum_sq","scales","cool","hot","colorbrewer","OrRd","PuBu","BuPu","Oranges","BuGn","YlOrBr","YlGn","Reds","RdPu","Greens","YlGnBu","Purples","GnBu","Greys","YlOrRd","PuRd","Blues","PuBuGn","Viridis","Spectral","RdYlGn","RdBu","PiYG","PRGn","RdYlBu","BrBG","RdGy","PuOr","Set2","Accent","Set1","Set3","Dark2","Paired","Pastel2","Pastel1","list$1","colorbrewer_1","strFileName","strMimeType","defaultMime","anchor","myBlob","MozBlob","WebKitBlob","ajax","dataUrlToBlob","saver","tempUiArr","mx","strUrl","binData","uiArr","winMode","confirm","CustomLoadingScreen","legendData","zScale","allLoaded","resetAnimation","setLooping","looping","Plot","colorVar","_coords","_coordColors","getPick","matrixMax","matrixMin","getUniqueVals","seen","Set","has","CoordinatePlot","PLOTTYPES","plotData","plotIdx","plot","pltType","canvasElement","_showLegend","_hasAnim","_loopingAnim","_axes","_downloadObj","_recording","_turned","_wasTurning","_xScale","_yScale","_zScale","_fsUIDirty","_upAxis","plots","ymax","R","Python","shapeLegendTitle","animPaused","_uniqID","backgroundColor","turntable","rotationRate","upAxis","_backgroundColor","_updateCameraUpVector","_hl1","_hl2","uiLayer","_annotationManager","AnnotationManager","_prepRender","_afterRender","styleElem","createTextNode","styleText","buttonBar","clientTop","clientLeft","parentNode","_buttonBar","streamCtrlBtn","onclick","_streamControlBtn","pauseAnimation","playAnimation","streamCtrlLoading","buttonSVGs","loading","streamCtrlPlay","streamCtrlPause","animRange","onchange","setAnimationFrame","_animationSlider","_evt","dpInfo","displayInfo","fromJSON","addImgStack","colorScale","showLegend","fontColor","legendTitle","legendTitleFontSize","legendTitleFontColor","legendPosition","showAxes","axisLabels","axisColors","tickBreaks","showTickLines","tickLineColors","channelColors","channelOpacities","addMeshObject","meshScaling","meshRotation","meshOffset","addMeshStream","addPlot","customColorScale","colorScaleInverted","sortedCategories","legendShowShape","hasAnimation","animationTargets","animationDelay","animationDuration","animationLoop","folded","foldedEmbedding","foldAnimDelay","foldAnimDuration","foldAnimLoop","colnames","rownames","shading","addClusterLabels","labels","labelSize","labelColor","fixedLabels","labelData","addLabels","addLabel","createButtons","whichBtns","turntableBtn","toggleTurntable","_turntableBtn","jsonBtn","_downloadJson","toJson","labelBtn","toggleLabelControl","recordBtn","_startRecording","record","publishBtn","_createPublishForm","publish","_prepDownloadObj","exportLabels","dlElement","dlContent","_publishFormOverlay","formOverlay","formBox","margin","borderRadius","boxShadow","formInfo","innerText","usernameLabel","usernameInput","passwordLabel","passwordInput","titleLabel","titleInput","msg","_tryPublish","cancelBtn","_cancelPublish","closeBtn","_resizePublishOverlay","thumbnail","thumb_data","plotName","thumb","_resetAnimation","rangeX","rangeY","rangeZ","axisData","animPlot","_toggleLoopAnimation","_loopBtn","anyAnim","_updateLegend","redrawInfo","_capturer","CCapture","framerate","verbose","workersPath","loadingOverlay","loadingText","_cameraFitPlot","xRange","yRange","zRange","xSize","ySize","zSize","xCenter","yCenter","zCenter","halfMinFov","viewRadius","plotType","discrete","breaks","inverted","ImgStack","dim","colorBy","deprecationWarning","coordColors","replayBtn","replay","loopBtn","uniqueGroups","nColors","colorIndex","cl","showShape","Surface","ShapeCloud","HeatMap","static","tickLineColor","showPlanes","planeColor","Axes","meshString","MeshObject","filePrefix","fileSuffix","fileIteratorStart","fileIteratorEnd","frameDelay","clearCoatIntensity","MeshStream","frameTotal","_legend","spaceLeft","spaceRight","rightFree","leftFree","shapeSpace","shapes","_shapeLegendPosition","shapeLegendData","spacing","shapeLegendDrawn","lgndData","_createPlotLegend","_drawStandaloneShapeLegend","grid","legendWidth","legendColumn","shapeLegendGrid","_createShapeLegend","breakN","legendMinPixels","nCols","legendBodyHeight","totalReqPixels","shapeBodyHeight","legendBody","innerGrid","legendColor","legendText","nBreaks","labelSpace","scaleGrid","labelGrid","minText","maxText","shapeLegendBody","rowHeight","shapeDef","legendSVGs","shapeIcon","shapeText","doRender","pad","saveCallback","labelList","Plots","_createHeatMap","boxes","rowCoords","coord","newAlpha","colSize","rowSize","channelSize","sliceSize","coords","Intensities","sliceIndex","_channelCoords","_channelCoordIntensities","_channelColors","_channelOpacities","_createImgStack","channelIntensities","channelCoords","channelColor","channelColorRGB","minIntensity","alphaPositions","alphaColors","alphaIntensities","intens","testIntensity","intensIdx","customMesh","colormix","annotationManager","_looping","_animDirection","_animationFrames","_animationDelay","_hasAnimation","_addLabels","_createLine","lineCoords","pointColor","fixLabels","__","LOCAL","_filenames","_prevTime","_containers","_clearCoat","_clearCoatIntensity","iter","_createMeshStream","loadingContainers","_loadMesh","firstScene","fi","timeNow","_animationVectors","_animationCounter","_animationVectorFract","fv","_animationTargets","_createPointCloud","pointGroups","pointGroupColors","pointGroupNames","colorIdx","colorNameIdx","sumFun","curr","pointGroup","centroid","numberOfVertices","posVector","vectorFractDir","_tNodes","_shape","_shading","_createShapeCloud","origMesh","matricesData","colorData","pickCoords","tNode","_createSurface","surface","heatmap","_axisLabels","_ticks","_tickLabels","_tickLines","_createAxes","_roundTicks","includes","sig","xtickBreaks","ytickBreaks","ztickBreaks","ymin","xChar","_makeTextPlane","xTicks","startTick","tickPos","tick","tickLabel","tickChar","tickLine","axisY","yChar","yTicks","zChar","zTicks","dynamicTexture","updateAxisData","tip","_tip","_bgColor","_txtColor","_uiLayer","rows","maxRowLen","_closeBtn","plotCreated","fixed","makeDraggable","_label","setText","fix","unfix","export","fullScreenUI","uniqID","_editLabelForms","_showLabels","_arrows","_showArrows","dpInfos","fixedArrows","_ymax","_fgColor","_fullScreenUI","_createLabelForms","labelBox","addLabelForm","addLabelLabel","htmlFor","addLabelInput","_addLabelTextInput","addLabelBtn","_addLabelBtnClick","editLabelContainer","_editLabelContainer","_labelControlBox","unfixLabels","addArrow","Arrow","alreadyShown","clearInfo","labelIdx","newLabel","Label","editLabelForm","editLabelLabel","editLabelInput","dataset","labelnum","onkeyup","_editLabelText","rmvLabelBtn","_removeLabel","inputElem","thisForm","labelNum","eLabelForm","oldNum","newNum","labelDragBehavior","logo","shape_box","shape_cone","shape_cylinder","shape_sphere","shape_torus","deprecated","alternative","extendStatics","__extends","__assign","__decorate","decorators","getOwnPropertyDescriptor","Reflect","decorate","__spreadArrays","il","jl","getRandomValues","crypto","msCrypto","rnds8","rng","uuid","byteToHex","_nodeId","_clockseq","_lastMSecs","_lastNSecs","clockseq","seedBytes","msecs","nsecs","tl","tmh","hashfunc","generateUUID","namespace","stringToBytes","DNS","getOutputLength","inputLength8","safeAdd","lsw","md5cmn","md5ff","md5gg","md5hh","md5ii","v35","length32","hexTab","md5ToHexEncodedArray","olda","oldb","oldc","oldd","wordsToMd5","length8","bytesToWords","rnds","ROTL","K","H","M","_i2","W","_t","T","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","definition","Symbol","toStringTag","__webpack_exports__"],"mappings":";0KAsBIA,EAA2B,WAU3B,SAASA,EAETC,EAEAC,EAEAC,EAEAC,EAEAC,EAEAC,GACIC,KAAKN,KAAOA,EACZM,KAAKL,eAAiBA,EACtBK,KAAKJ,eAAiBA,EACtBI,KAAKH,SAAWA,EAChBG,KAAKF,SAAWA,EAChBE,KAAKD,eAAiBA,EAItBC,KAAKC,mBAAqB,IAAIC,MAI9BF,KAAKG,QAAU,IAAID,MAInBF,KAAKI,cAAgB,IAIrBJ,KAAKK,QAAU,GACfL,KAAKM,mBAAqBX,EAAeY,MAAM,KAC/CP,KAAKH,SAAWA,EAChBG,KAAKF,cAAwBU,IAAbV,EAAyBL,EAAUgB,wBAA0BX,EA4kCjF,OAvkCAL,EAAUiB,kBAAoB,SAAUhB,EAAMC,EAAgBC,EAAgBe,EAAYC,EAAMC,EAAIf,EAAUgB,GAC1G,IAAIjB,OAAWW,EAsBf,IArBKO,MAAMC,WAAWJ,KAAUK,SAASL,GACrCf,EAAWJ,EAAUyB,oBAEhBN,aAAgB,KACrBf,EAAWJ,EAAU0B,yBAEhBP,aAAgB,IACrBf,EAAWJ,EAAU2B,sBAEhBR,aAAgB,KACrBf,EAAWJ,EAAU4B,sBAEhBT,aAAgB,KACrBf,EAAWJ,EAAU6B,qBAEhBV,aAAgB,KACrBf,EAAWJ,EAAU8B,qBAEhBX,aAAgB,MACrBf,EAAWJ,EAAU+B,oBAEThB,MAAZX,EACA,OAAO,KAEX,IAAI4B,EAAY,IAAIhC,EAAUC,EAAMC,EAAgBC,EAAgBC,EAAUC,GAC1E4B,EAAO,CAAC,CAAEC,MAAO,EAAGC,MAAOhB,GAAQ,CAAEe,MAAOhB,EAAYiB,MAAOf,IAKnE,OAJAY,EAAUI,QAAQH,QACKlB,IAAnBM,G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ots.js","sourcesContent":["import { Vector3, Quaternion, Vector2, Matrix, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Color3, Color4 } from '../Maths/math.color';\r\nimport { Scalar } from \"../Maths/math.scalar\";\r\nimport { SerializationHelper } from \"../Misc/decorators\";\r\nimport { _TypeStore } from '../Misc/typeStore';\r\nimport { AnimationKeyInterpolation } from './animationKey';\r\nimport { AnimationRange } from './animationRange';\r\nimport { Node } from \"../node\";\r\nimport { Size } from '../Maths/math.size';\r\nimport { WebRequest } from '../Misc/webRequest';\r\n/**\r\n * @hidden\r\n */\r\nvar _IAnimationState = /** @class */ (function () {\r\n function _IAnimationState() {\r\n }\r\n return _IAnimationState;\r\n}());\r\nexport { _IAnimationState };\r\n/**\r\n * Class used to store any kind of animation\r\n */\r\nvar Animation = /** @class */ (function () {\r\n /**\r\n * Initializes the animation\r\n * @param name Name of the animation\r\n * @param targetProperty Property to animate\r\n * @param framePerSecond The frames per second of the animation\r\n * @param dataType The data type of the animation\r\n * @param loopMode The loop mode of the animation\r\n * @param enableBlending Specifies if blending should be enabled\r\n */\r\n function Animation(\r\n /**Name of the animation */\r\n name, \r\n /**Property to animate */\r\n targetProperty, \r\n /**The frames per second of the animation */\r\n framePerSecond, \r\n /**The data type of the animation */\r\n dataType, \r\n /**The loop mode of the animation */\r\n loopMode, \r\n /**Specifies if blending should be enabled */\r\n enableBlending) {\r\n this.name = name;\r\n this.targetProperty = targetProperty;\r\n this.framePerSecond = framePerSecond;\r\n this.dataType = dataType;\r\n this.loopMode = loopMode;\r\n this.enableBlending = enableBlending;\r\n /**\r\n * @hidden Internal use only\r\n */\r\n this._runtimeAnimations = new Array();\r\n /**\r\n * The set of event that will be linked to this animation\r\n */\r\n this._events = new Array();\r\n /**\r\n * Stores the blending speed of the animation\r\n */\r\n this.blendingSpeed = 0.01;\r\n /**\r\n * Stores the animation ranges for the animation\r\n */\r\n this._ranges = {};\r\n this.targetPropertyPath = targetProperty.split(\".\");\r\n this.dataType = dataType;\r\n this.loopMode = loopMode === undefined ? Animation.ANIMATIONLOOPMODE_CYCLE : loopMode;\r\n }\r\n /**\r\n * @hidden Internal use\r\n */\r\n Animation._PrepareAnimation = function (name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction) {\r\n var dataType = undefined;\r\n if (!isNaN(parseFloat(from)) && isFinite(from)) {\r\n dataType = Animation.ANIMATIONTYPE_FLOAT;\r\n }\r\n else if (from instanceof Quaternion) {\r\n dataType = Animation.ANIMATIONTYPE_QUATERNION;\r\n }\r\n else if (from instanceof Vector3) {\r\n dataType = Animation.ANIMATIONTYPE_VECTOR3;\r\n }\r\n else if (from instanceof Vector2) {\r\n dataType = Animation.ANIMATIONTYPE_VECTOR2;\r\n }\r\n else if (from instanceof Color3) {\r\n dataType = Animation.ANIMATIONTYPE_COLOR3;\r\n }\r\n else if (from instanceof Color4) {\r\n dataType = Animation.ANIMATIONTYPE_COLOR4;\r\n }\r\n else if (from instanceof Size) {\r\n dataType = Animation.ANIMATIONTYPE_SIZE;\r\n }\r\n if (dataType == undefined) {\r\n return null;\r\n }\r\n var animation = new Animation(name, targetProperty, framePerSecond, dataType, loopMode);\r\n var keys = [{ frame: 0, value: from }, { frame: totalFrame, value: to }];\r\n animation.setKeys(keys);\r\n if (easingFunction !== undefined) {\r\n animation.setEasingFunction(easingFunction);\r\n }\r\n return animation;\r\n };\r\n /**\r\n * Sets up an animation\r\n * @param property The property to animate\r\n * @param animationType The animation type to apply\r\n * @param framePerSecond The frames per second of the animation\r\n * @param easingFunction The easing function used in the animation\r\n * @returns The created animation\r\n */\r\n Animation.CreateAnimation = function (property, animationType, framePerSecond, easingFunction) {\r\n var animation = new Animation(property + \"Animation\", property, framePerSecond, animationType, Animation.ANIMATIONLOOPMODE_CONSTANT);\r\n animation.setEasingFunction(easingFunction);\r\n return animation;\r\n };\r\n /**\r\n * Create and start an animation on a node\r\n * @param name defines the name of the global animation that will be run on all nodes\r\n * @param node defines the root node where the animation will take place\r\n * @param targetProperty defines property to animate\r\n * @param framePerSecond defines the number of frame per second yo use\r\n * @param totalFrame defines the number of frames in total\r\n * @param from defines the initial value\r\n * @param to defines the final value\r\n * @param loopMode defines which loop mode you want to use (off by default)\r\n * @param easingFunction defines the easing function to use (linear by default)\r\n * @param onAnimationEnd defines the callback to call when animation end\r\n * @returns the animatable created for this animation\r\n */\r\n Animation.CreateAndStartAnimation = function (name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {\r\n var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\r\n if (!animation) {\r\n return null;\r\n }\r\n return node.getScene().beginDirectAnimation(node, [animation], 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);\r\n };\r\n /**\r\n * Create and start an animation on a node and its descendants\r\n * @param name defines the name of the global animation that will be run on all nodes\r\n * @param node defines the root node where the animation will take place\r\n * @param directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used\r\n * @param targetProperty defines property to animate\r\n * @param framePerSecond defines the number of frame per second to use\r\n * @param totalFrame defines the number of frames in total\r\n * @param from defines the initial value\r\n * @param to defines the final value\r\n * @param loopMode defines which loop mode you want to use (off by default)\r\n * @param easingFunction defines the easing function to use (linear by default)\r\n * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)\r\n * @returns the list of animatables created for all nodes\r\n * @example https://www.babylonjs-playground.com/#MH0VLI\r\n */\r\n Animation.CreateAndStartHierarchyAnimation = function (name, node, directDescendantsOnly, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {\r\n var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\r\n if (!animation) {\r\n return null;\r\n }\r\n var scene = node.getScene();\r\n return scene.beginDirectHierarchyAnimation(node, directDescendantsOnly, [animation], 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);\r\n };\r\n /**\r\n * Creates a new animation, merges it with the existing animations and starts it\r\n * @param name Name of the animation\r\n * @param node Node which contains the scene that begins the animations\r\n * @param targetProperty Specifies which property to animate\r\n * @param framePerSecond The frames per second of the animation\r\n * @param totalFrame The total number of frames\r\n * @param from The frame at the beginning of the animation\r\n * @param to The frame at the end of the animation\r\n * @param loopMode Specifies the loop mode of the animation\r\n * @param easingFunction (Optional) The easing function of the animation, which allow custom mathematical formulas for animations\r\n * @param onAnimationEnd Callback to run once the animation is complete\r\n * @returns Nullable animation\r\n */\r\n Animation.CreateMergeAndStartAnimation = function (name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {\r\n var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\r\n if (!animation) {\r\n return null;\r\n }\r\n node.animations.push(animation);\r\n return node.getScene().beginAnimation(node, 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);\r\n };\r\n /**\r\n * Convert the keyframes for all animations belonging to the group to be relative to a given reference frame.\r\n * @param sourceAnimation defines the Animation containing keyframes to convert\r\n * @param referenceFrame defines the frame that keyframes in the range will be relative to\r\n * @param range defines the name of the AnimationRange belonging to the Animation to convert\r\n * @param cloneOriginal defines whether or not to clone the animation and convert the clone or convert the original animation (default is false)\r\n * @param clonedName defines the name of the resulting cloned Animation if cloneOriginal is true\r\n * @returns a new Animation if cloneOriginal is true or the original Animation if cloneOriginal is false\r\n */\r\n Animation.MakeAnimationAdditive = function (sourceAnimation, referenceFrame, range, cloneOriginal, clonedName) {\r\n if (referenceFrame === void 0) { referenceFrame = 0; }\r\n if (cloneOriginal === void 0) { cloneOriginal = false; }\r\n var animation = sourceAnimation;\r\n if (cloneOriginal) {\r\n animation = sourceAnimation.clone();\r\n animation.name = clonedName || animation.name;\r\n }\r\n if (!animation._keys.length) {\r\n return animation;\r\n }\r\n referenceFrame = referenceFrame >= 0 ? referenceFrame : 0;\r\n var startIndex = 0;\r\n var firstKey = animation._keys[0];\r\n var endIndex = animation._keys.length - 1;\r\n var lastKey = animation._keys[endIndex];\r\n var valueStore = {\r\n referenceValue: firstKey.value,\r\n referencePosition: TmpVectors.Vector3[0],\r\n referenceQuaternion: TmpVectors.Quaternion[0],\r\n referenceScaling: TmpVectors.Vector3[1],\r\n keyPosition: TmpVectors.Vector3[2],\r\n keyQuaternion: TmpVectors.Quaternion[1],\r\n keyScaling: TmpVectors.Vector3[3]\r\n };\r\n var referenceFound = false;\r\n var from = firstKey.frame;\r\n var to = lastKey.frame;\r\n if (range) {\r\n var rangeValue = animation.getRange(range);\r\n if (rangeValue) {\r\n from = rangeValue.from;\r\n to = rangeValue.to;\r\n }\r\n }\r\n var fromKeyFound = firstKey.frame === from;\r\n var toKeyFound = lastKey.frame === to;\r\n // There's only one key, so use it\r\n if (animation._keys.length === 1) {\r\n var value = animation._getKeyValue(animation._keys[0]);\r\n valueStore.referenceValue = value.clone ? value.clone() : value;\r\n referenceFound = true;\r\n }\r\n // Reference frame is before the first frame, so just use the first frame\r\n else if (referenceFrame <= firstKey.frame) {\r\n var value = animation._getKeyValue(firstKey.value);\r\n valueStore.referenceValue = value.clone ? value.clone() : value;\r\n referenceFound = true;\r\n }\r\n // Reference frame is after the last frame, so just use the last frame\r\n else if (referenceFrame >= lastKey.frame) {\r\n var value = animation._getKeyValue(lastKey.value);\r\n valueStore.referenceValue = value.clone ? value.clone() : value;\r\n referenceFound = true;\r\n }\r\n // Find key bookends, create them if they don't exist\r\n var index = 0;\r\n while (!referenceFound || !fromKeyFound || !toKeyFound && index < animation._keys.length - 1) {\r\n var currentKey = animation._keys[index];\r\n var nextKey = animation._keys[index + 1];\r\n // If reference frame wasn't found yet, check if we can interpolate to it\r\n if (!referenceFound && referenceFrame >= currentKey.frame && referenceFrame <= nextKey.frame) {\r\n var value = void 0;\r\n if (referenceFrame === currentKey.frame) {\r\n value = animation._getKeyValue(currentKey.value);\r\n }\r\n else if (referenceFrame === nextKey.frame) {\r\n value = animation._getKeyValue(nextKey.value);\r\n }\r\n else {\r\n var animationState = {\r\n key: index,\r\n repeatCount: 0,\r\n loopMode: this.ANIMATIONLOOPMODE_CONSTANT\r\n };\r\n value = animation._interpolate(referenceFrame, animationState);\r\n }\r\n valueStore.referenceValue = value.clone ? value.clone() : value;\r\n referenceFound = true;\r\n }\r\n // If from key wasn't found yet, check if we can interpolate to it\r\n if (!fromKeyFound && from >= currentKey.frame && from <= nextKey.frame) {\r\n if (from === currentKey.frame) {\r\n startIndex = index;\r\n }\r\n else if (from === nextKey.frame) {\r\n startIndex = index + 1;\r\n }\r\n else {\r\n var animationState = {\r\n key: index,\r\n repeatCount: 0,\r\n loopMode: this.ANIMATIONLOOPMODE_CONSTANT\r\n };\r\n var value = animation._interpolate(from, animationState);\r\n var key = {\r\n frame: from,\r\n value: value.clone ? value.clone() : value\r\n };\r\n animation._keys.splice(index + 1, 0, key);\r\n startIndex = index + 1;\r\n }\r\n fromKeyFound = true;\r\n }\r\n // If to key wasn't found yet, check if we can interpolate to it\r\n if (!toKeyFound && to >= currentKey.frame && to <= nextKey.frame) {\r\n if (to === currentKey.frame) {\r\n endIndex = index;\r\n }\r\n else if (to === nextKey.frame) {\r\n endIndex = index + 1;\r\n }\r\n else {\r\n var animationState = {\r\n key: index,\r\n repeatCount: 0,\r\n loopMode: this.ANIMATIONLOOPMODE_CONSTANT\r\n };\r\n var value = animation._interpolate(to, animationState);\r\n var key = {\r\n frame: to,\r\n value: value.clone ? value.clone() : value\r\n };\r\n animation._keys.splice(index + 1, 0, key);\r\n endIndex = index + 1;\r\n }\r\n toKeyFound = true;\r\n }\r\n index++;\r\n }\r\n // Conjugate the quaternion\r\n if (animation.dataType === Animation.ANIMATIONTYPE_QUATERNION) {\r\n valueStore.referenceValue.normalize().conjugateInPlace();\r\n }\r\n // Decompose matrix and conjugate the quaternion\r\n else if (animation.dataType === Animation.ANIMATIONTYPE_MATRIX) {\r\n valueStore.referenceValue.decompose(valueStore.referenceScaling, valueStore.referenceQuaternion, valueStore.referencePosition);\r\n valueStore.referenceQuaternion.normalize().conjugateInPlace();\r\n }\r\n // Subtract the reference value from all of the key values\r\n for (var index = startIndex; index <= endIndex; index++) {\r\n var key = animation._keys[index];\r\n // If this key was duplicated to create a frame 0 key, skip it because its value has already been updated\r\n if (index && animation.dataType !== Animation.ANIMATIONTYPE_FLOAT && key.value === firstKey.value) {\r\n continue;\r\n }\r\n switch (animation.dataType) {\r\n case Animation.ANIMATIONTYPE_MATRIX:\r\n key.value.decompose(valueStore.keyScaling, valueStore.keyQuaternion, valueStore.keyPosition);\r\n valueStore.keyPosition.subtractInPlace(valueStore.referencePosition);\r\n valueStore.keyScaling.divideInPlace(valueStore.referenceScaling);\r\n valueStore.referenceQuaternion.multiplyToRef(valueStore.keyQuaternion, valueStore.keyQuaternion);\r\n Matrix.ComposeToRef(valueStore.keyScaling, valueStore.keyQuaternion, valueStore.keyPosition, key.value);\r\n break;\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n valueStore.referenceValue.multiplyToRef(key.value, key.value);\r\n break;\r\n case Animation.ANIMATIONTYPE_VECTOR2:\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n case Animation.ANIMATIONTYPE_COLOR4:\r\n key.value.subtractToRef(valueStore.referenceValue, key.value);\r\n break;\r\n case Animation.ANIMATIONTYPE_SIZE:\r\n key.value.width -= valueStore.referenceValue.width;\r\n key.value.height -= valueStore.referenceValue.height;\r\n break;\r\n default:\r\n key.value -= valueStore.referenceValue;\r\n }\r\n }\r\n return animation;\r\n };\r\n /**\r\n * Transition property of an host to the target Value\r\n * @param property The property to transition\r\n * @param targetValue The target Value of the property\r\n * @param host The object where the property to animate belongs\r\n * @param scene Scene used to run the animation\r\n * @param frameRate Framerate (in frame/s) to use\r\n * @param transition The transition type we want to use\r\n * @param duration The duration of the animation, in milliseconds\r\n * @param onAnimationEnd Callback trigger at the end of the animation\r\n * @returns Nullable animation\r\n */\r\n Animation.TransitionTo = function (property, targetValue, host, scene, frameRate, transition, duration, onAnimationEnd) {\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n if (duration <= 0) {\r\n host[property] = targetValue;\r\n if (onAnimationEnd) {\r\n onAnimationEnd();\r\n }\r\n return null;\r\n }\r\n var endFrame = frameRate * (duration / 1000);\r\n transition.setKeys([{\r\n frame: 0,\r\n value: host[property].clone ? host[property].clone() : host[property]\r\n },\r\n {\r\n frame: endFrame,\r\n value: targetValue\r\n }]);\r\n if (!host.animations) {\r\n host.animations = [];\r\n }\r\n host.animations.push(transition);\r\n var animation = scene.beginAnimation(host, 0, endFrame, false);\r\n animation.onAnimationEnd = onAnimationEnd;\r\n return animation;\r\n };\r\n Object.defineProperty(Animation.prototype, \"runtimeAnimations\", {\r\n /**\r\n * Return the array of runtime animations currently using this animation\r\n */\r\n get: function () {\r\n return this._runtimeAnimations;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animation.prototype, \"hasRunningRuntimeAnimations\", {\r\n /**\r\n * Specifies if any of the runtime animations are currently running\r\n */\r\n get: function () {\r\n for (var _i = 0, _a = this._runtimeAnimations; _i < _a.length; _i++) {\r\n var runtimeAnimation = _a[_i];\r\n if (!runtimeAnimation.isStopped) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Converts the animation to a string\r\n * @param fullDetails support for multiple levels of logging within scene loading\r\n * @returns String form of the animation\r\n */\r\n Animation.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name + \", property: \" + this.targetProperty;\r\n ret += \", datatype: \" + ([\"Float\", \"Vector3\", \"Quaternion\", \"Matrix\", \"Color3\", \"Vector2\"])[this.dataType];\r\n ret += \", nKeys: \" + (this._keys ? this._keys.length : \"none\");\r\n ret += \", nRanges: \" + (this._ranges ? Object.keys(this._ranges).length : \"none\");\r\n if (fullDetails) {\r\n ret += \", Ranges: {\";\r\n var first = true;\r\n for (var name in this._ranges) {\r\n if (first) {\r\n ret += \", \";\r\n first = false;\r\n }\r\n ret += name;\r\n }\r\n ret += \"}\";\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Add an event to this animation\r\n * @param event Event to add\r\n */\r\n Animation.prototype.addEvent = function (event) {\r\n this._events.push(event);\r\n this._events.sort(function (a, b) { return a.frame - b.frame; });\r\n };\r\n /**\r\n * Remove all events found at the given frame\r\n * @param frame The frame to remove events from\r\n */\r\n Animation.prototype.removeEvents = function (frame) {\r\n for (var index = 0; index < this._events.length; index++) {\r\n if (this._events[index].frame === frame) {\r\n this._events.splice(index, 1);\r\n index--;\r\n }\r\n }\r\n };\r\n /**\r\n * Retrieves all the events from the animation\r\n * @returns Events from the animation\r\n */\r\n Animation.prototype.getEvents = function () {\r\n return this._events;\r\n };\r\n /**\r\n * Creates an animation range\r\n * @param name Name of the animation range\r\n * @param from Starting frame of the animation range\r\n * @param to Ending frame of the animation\r\n */\r\n Animation.prototype.createRange = function (name, from, to) {\r\n // check name not already in use; could happen for bones after serialized\r\n if (!this._ranges[name]) {\r\n this._ranges[name] = new AnimationRange(name, from, to);\r\n }\r\n };\r\n /**\r\n * Deletes an animation range by name\r\n * @param name Name of the animation range to delete\r\n * @param deleteFrames Specifies if the key frames for the range should also be deleted (true) or not (false)\r\n */\r\n Animation.prototype.deleteRange = function (name, deleteFrames) {\r\n if (deleteFrames === void 0) { deleteFrames = true; }\r\n var range = this._ranges[name];\r\n if (!range) {\r\n return;\r\n }\r\n if (deleteFrames) {\r\n var from = range.from;\r\n var to = range.to;\r\n // this loop MUST go high to low for multiple splices to work\r\n for (var key = this._keys.length - 1; key >= 0; key--) {\r\n if (this._keys[key].frame >= from && this._keys[key].frame <= to) {\r\n this._keys.splice(key, 1);\r\n }\r\n }\r\n }\r\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\r\n };\r\n /**\r\n * Gets the animation range by name, or null if not defined\r\n * @param name Name of the animation range\r\n * @returns Nullable animation range\r\n */\r\n Animation.prototype.getRange = function (name) {\r\n return this._ranges[name];\r\n };\r\n /**\r\n * Gets the key frames from the animation\r\n * @returns The key frames of the animation\r\n */\r\n Animation.prototype.getKeys = function () {\r\n return this._keys;\r\n };\r\n /**\r\n * Gets the highest frame rate of the animation\r\n * @returns Highest frame rate of the animation\r\n */\r\n Animation.prototype.getHighestFrame = function () {\r\n var ret = 0;\r\n for (var key = 0, nKeys = this._keys.length; key < nKeys; key++) {\r\n if (ret < this._keys[key].frame) {\r\n ret = this._keys[key].frame;\r\n }\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Gets the easing function of the animation\r\n * @returns Easing function of the animation\r\n */\r\n Animation.prototype.getEasingFunction = function () {\r\n return this._easingFunction;\r\n };\r\n /**\r\n * Sets the easing function of the animation\r\n * @param easingFunction A custom mathematical formula for animation\r\n */\r\n Animation.prototype.setEasingFunction = function (easingFunction) {\r\n this._easingFunction = easingFunction;\r\n };\r\n /**\r\n * Interpolates a scalar linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated scalar value\r\n */\r\n Animation.prototype.floatInterpolateFunction = function (startValue, endValue, gradient) {\r\n return Scalar.Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a scalar cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated scalar value\r\n */\r\n Animation.prototype.floatInterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return Scalar.Hermite(startValue, outTangent, endValue, inTangent, gradient);\r\n };\r\n /**\r\n * Interpolates a quaternion using a spherical linear interpolation\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated quaternion value\r\n */\r\n Animation.prototype.quaternionInterpolateFunction = function (startValue, endValue, gradient) {\r\n return Quaternion.Slerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a quaternion cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated quaternion value\r\n */\r\n Animation.prototype.quaternionInterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return Quaternion.Hermite(startValue, outTangent, endValue, inTangent, gradient).normalize();\r\n };\r\n /**\r\n * Interpolates a Vector3 linearl\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated scalar value\r\n */\r\n Animation.prototype.vector3InterpolateFunction = function (startValue, endValue, gradient) {\r\n return Vector3.Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a Vector3 cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns InterpolatedVector3 value\r\n */\r\n Animation.prototype.vector3InterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return Vector3.Hermite(startValue, outTangent, endValue, inTangent, gradient);\r\n };\r\n /**\r\n * Interpolates a Vector2 linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Vector2 value\r\n */\r\n Animation.prototype.vector2InterpolateFunction = function (startValue, endValue, gradient) {\r\n return Vector2.Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a Vector2 cubically\r\n * @param startValue Start value of the animation curve\r\n * @param outTangent End tangent of the animation\r\n * @param endValue End value of the animation curve\r\n * @param inTangent Start tangent of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Vector2 value\r\n */\r\n Animation.prototype.vector2InterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {\r\n return Vector2.Hermite(startValue, outTangent, endValue, inTangent, gradient);\r\n };\r\n /**\r\n * Interpolates a size linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Size value\r\n */\r\n Animation.prototype.sizeInterpolateFunction = function (startValue, endValue, gradient) {\r\n return Size.Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a Color3 linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Color3 value\r\n */\r\n Animation.prototype.color3InterpolateFunction = function (startValue, endValue, gradient) {\r\n return Color3.Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Interpolates a Color4 linearly\r\n * @param startValue Start value of the animation curve\r\n * @param endValue End value of the animation curve\r\n * @param gradient Scalar amount to interpolate\r\n * @returns Interpolated Color3 value\r\n */\r\n Animation.prototype.color4InterpolateFunction = function (startValue, endValue, gradient) {\r\n return Color4.Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * @hidden Internal use only\r\n */\r\n Animation.prototype._getKeyValue = function (value) {\r\n if (typeof value === \"function\") {\r\n return value();\r\n }\r\n return value;\r\n };\r\n /**\r\n * @hidden Internal use only\r\n */\r\n Animation.prototype._interpolate = function (currentFrame, state) {\r\n if (state.loopMode === Animation.ANIMATIONLOOPMODE_CONSTANT && state.repeatCount > 0) {\r\n return state.highLimitValue.clone ? state.highLimitValue.clone() : state.highLimitValue;\r\n }\r\n var keys = this._keys;\r\n if (keys.length === 1) {\r\n return this._getKeyValue(keys[0].value);\r\n }\r\n var startKeyIndex = state.key;\r\n if (keys[startKeyIndex].frame >= currentFrame) {\r\n while (startKeyIndex - 1 >= 0 && keys[startKeyIndex].frame >= currentFrame) {\r\n startKeyIndex--;\r\n }\r\n }\r\n for (var key = startKeyIndex; key < keys.length; key++) {\r\n var endKey = keys[key + 1];\r\n if (endKey.frame >= currentFrame) {\r\n state.key = key;\r\n var startKey = keys[key];\r\n var startValue = this._getKeyValue(startKey.value);\r\n if (startKey.interpolation === AnimationKeyInterpolation.STEP) {\r\n return startValue;\r\n }\r\n var endValue = this._getKeyValue(endKey.value);\r\n var useTangent = startKey.outTangent !== undefined && endKey.inTangent !== undefined;\r\n var frameDelta = endKey.frame - startKey.frame;\r\n // gradient : percent of currentFrame between the frame inf and the frame sup\r\n var gradient = (currentFrame - startKey.frame) / frameDelta;\r\n // check for easingFunction and correction of gradient\r\n var easingFunction = this.getEasingFunction();\r\n if (easingFunction != null) {\r\n gradient = easingFunction.ease(gradient);\r\n }\r\n switch (this.dataType) {\r\n // Float\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n var floatValue = useTangent ? this.floatInterpolateFunctionWithTangents(startValue, startKey.outTangent * frameDelta, endValue, endKey.inTangent * frameDelta, gradient) : this.floatInterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return floatValue;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return state.offsetValue * state.repeatCount + floatValue;\r\n }\r\n break;\r\n // Quaternion\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n var quatValue = useTangent ? this.quaternionInterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.quaternionInterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return quatValue;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return quatValue.addInPlace(state.offsetValue.scale(state.repeatCount));\r\n }\r\n return quatValue;\r\n // Vector3\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n var vec3Value = useTangent ? this.vector3InterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.vector3InterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return vec3Value;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return vec3Value.add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Vector2\r\n case Animation.ANIMATIONTYPE_VECTOR2:\r\n var vec2Value = useTangent ? this.vector2InterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.vector2InterpolateFunction(startValue, endValue, gradient);\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return vec2Value;\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return vec2Value.add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Size\r\n case Animation.ANIMATIONTYPE_SIZE:\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return this.sizeInterpolateFunction(startValue, endValue, gradient);\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return this.sizeInterpolateFunction(startValue, endValue, gradient).add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Color3\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return this.color3InterpolateFunction(startValue, endValue, gradient);\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return this.color3InterpolateFunction(startValue, endValue, gradient).add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Color4\r\n case Animation.ANIMATIONTYPE_COLOR4:\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n return this.color4InterpolateFunction(startValue, endValue, gradient);\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return this.color4InterpolateFunction(startValue, endValue, gradient).add(state.offsetValue.scale(state.repeatCount));\r\n }\r\n // Matrix\r\n case Animation.ANIMATIONTYPE_MATRIX:\r\n switch (state.loopMode) {\r\n case Animation.ANIMATIONLOOPMODE_CYCLE:\r\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\r\n if (Animation.AllowMatricesInterpolation) {\r\n return this.matrixInterpolateFunction(startValue, endValue, gradient, state.workValue);\r\n }\r\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\r\n return startValue;\r\n }\r\n default:\r\n break;\r\n }\r\n break;\r\n }\r\n }\r\n return this._getKeyValue(keys[keys.length - 1].value);\r\n };\r\n /**\r\n * Defines the function to use to interpolate matrices\r\n * @param startValue defines the start matrix\r\n * @param endValue defines the end matrix\r\n * @param gradient defines the gradient between both matrices\r\n * @param result defines an optional target matrix where to store the interpolation\r\n * @returns the interpolated matrix\r\n */\r\n Animation.prototype.matrixInterpolateFunction = function (startValue, endValue, gradient, result) {\r\n if (Animation.AllowMatrixDecomposeForInterpolation) {\r\n if (result) {\r\n Matrix.DecomposeLerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n }\r\n return Matrix.DecomposeLerp(startValue, endValue, gradient);\r\n }\r\n if (result) {\r\n Matrix.LerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n }\r\n return Matrix.Lerp(startValue, endValue, gradient);\r\n };\r\n /**\r\n * Makes a copy of the animation\r\n * @returns Cloned animation\r\n */\r\n Animation.prototype.clone = function () {\r\n var clone = new Animation(this.name, this.targetPropertyPath.join(\".\"), this.framePerSecond, this.dataType, this.loopMode);\r\n clone.enableBlending = this.enableBlending;\r\n clone.blendingSpeed = this.blendingSpeed;\r\n if (this._keys) {\r\n clone.setKeys(this._keys);\r\n }\r\n if (this._ranges) {\r\n clone._ranges = {};\r\n for (var name in this._ranges) {\r\n var range = this._ranges[name];\r\n if (!range) {\r\n continue;\r\n }\r\n clone._ranges[name] = range.clone();\r\n }\r\n }\r\n return clone;\r\n };\r\n /**\r\n * Sets the key frames of the animation\r\n * @param values The animation key frames to set\r\n */\r\n Animation.prototype.setKeys = function (values) {\r\n this._keys = values.slice(0);\r\n };\r\n /**\r\n * Serializes the animation to an object\r\n * @returns Serialized object\r\n */\r\n Animation.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.property = this.targetProperty;\r\n serializationObject.framePerSecond = this.framePerSecond;\r\n serializationObject.dataType = this.dataType;\r\n serializationObject.loopBehavior = this.loopMode;\r\n serializationObject.enableBlending = this.enableBlending;\r\n serializationObject.blendingSpeed = this.blendingSpeed;\r\n var dataType = this.dataType;\r\n serializationObject.keys = [];\r\n var keys = this.getKeys();\r\n for (var index = 0; index < keys.length; index++) {\r\n var animationKey = keys[index];\r\n var key = {};\r\n key.frame = animationKey.frame;\r\n switch (dataType) {\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n key.values = [animationKey.value];\r\n if (animationKey.inTangent !== undefined) {\r\n key.values.push(animationKey.inTangent);\r\n }\r\n if (animationKey.outTangent !== undefined) {\r\n if (animationKey.inTangent === undefined) {\r\n key.values.push(undefined);\r\n }\r\n key.values.push(animationKey.outTangent);\r\n }\r\n break;\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n case Animation.ANIMATIONTYPE_MATRIX:\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n case Animation.ANIMATIONTYPE_COLOR4:\r\n key.values = animationKey.value.asArray();\r\n if (animationKey.inTangent != undefined) {\r\n key.values.push(animationKey.inTangent.asArray());\r\n }\r\n if (animationKey.outTangent != undefined) {\r\n if (animationKey.inTangent === undefined) {\r\n key.values.push(undefined);\r\n }\r\n key.values.push(animationKey.outTangent.asArray());\r\n }\r\n break;\r\n }\r\n serializationObject.keys.push(key);\r\n }\r\n serializationObject.ranges = [];\r\n for (var name in this._ranges) {\r\n var source = this._ranges[name];\r\n if (!source) {\r\n continue;\r\n }\r\n var range = {};\r\n range.name = name;\r\n range.from = source.from;\r\n range.to = source.to;\r\n serializationObject.ranges.push(range);\r\n }\r\n return serializationObject;\r\n };\r\n /** @hidden */\r\n Animation._UniversalLerp = function (left, right, amount) {\r\n var constructor = left.constructor;\r\n if (constructor.Lerp) { // Lerp supported\r\n return constructor.Lerp(left, right, amount);\r\n }\r\n else if (constructor.Slerp) { // Slerp supported\r\n return constructor.Slerp(left, right, amount);\r\n }\r\n else if (left.toFixed) { // Number\r\n return left * (1.0 - amount) + amount * right;\r\n }\r\n else { // Blending not supported\r\n return right;\r\n }\r\n };\r\n /**\r\n * Parses an animation object and creates an animation\r\n * @param parsedAnimation Parsed animation object\r\n * @returns Animation object\r\n */\r\n Animation.Parse = function (parsedAnimation) {\r\n var animation = new Animation(parsedAnimation.name, parsedAnimation.property, parsedAnimation.framePerSecond, parsedAnimation.dataType, parsedAnimation.loopBehavior);\r\n var dataType = parsedAnimation.dataType;\r\n var keys = [];\r\n var data;\r\n var index;\r\n if (parsedAnimation.enableBlending) {\r\n animation.enableBlending = parsedAnimation.enableBlending;\r\n }\r\n if (parsedAnimation.blendingSpeed) {\r\n animation.blendingSpeed = parsedAnimation.blendingSpeed;\r\n }\r\n for (index = 0; index < parsedAnimation.keys.length; index++) {\r\n var key = parsedAnimation.keys[index];\r\n var inTangent;\r\n var outTangent;\r\n switch (dataType) {\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n data = key.values[0];\r\n if (key.values.length >= 1) {\r\n inTangent = key.values[1];\r\n }\r\n if (key.values.length >= 2) {\r\n outTangent = key.values[2];\r\n }\r\n break;\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n data = Quaternion.FromArray(key.values);\r\n if (key.values.length >= 8) {\r\n var _inTangent = Quaternion.FromArray(key.values.slice(4, 8));\r\n if (!_inTangent.equals(Quaternion.Zero())) {\r\n inTangent = _inTangent;\r\n }\r\n }\r\n if (key.values.length >= 12) {\r\n var _outTangent = Quaternion.FromArray(key.values.slice(8, 12));\r\n if (!_outTangent.equals(Quaternion.Zero())) {\r\n outTangent = _outTangent;\r\n }\r\n }\r\n break;\r\n case Animation.ANIMATIONTYPE_MATRIX:\r\n data = Matrix.FromArray(key.values);\r\n break;\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n data = Color3.FromArray(key.values);\r\n break;\r\n case Animation.ANIMATIONTYPE_COLOR4:\r\n data = Color4.FromArray(key.values);\r\n break;\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n default:\r\n data = Vector3.FromArray(key.values);\r\n break;\r\n }\r\n var keyData = {};\r\n keyData.frame = key.frame;\r\n keyData.value = data;\r\n if (inTangent != undefined) {\r\n keyData.inTangent = inTangent;\r\n }\r\n if (outTangent != undefined) {\r\n keyData.outTangent = outTangent;\r\n }\r\n keys.push(keyData);\r\n }\r\n animation.setKeys(keys);\r\n if (parsedAnimation.ranges) {\r\n for (index = 0; index < parsedAnimation.ranges.length; index++) {\r\n data = parsedAnimation.ranges[index];\r\n animation.createRange(data.name, data.from, data.to);\r\n }\r\n }\r\n return animation;\r\n };\r\n /**\r\n * Appends the serialized animations from the source animations\r\n * @param source Source containing the animations\r\n * @param destination Target to store the animations\r\n */\r\n Animation.AppendSerializedAnimations = function (source, destination) {\r\n SerializationHelper.AppendSerializedAnimations(source, destination);\r\n };\r\n /**\r\n * Creates a new animation or an array of animations from a snippet saved in a remote file\r\n * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)\r\n * @param url defines the url to load from\r\n * @returns a promise that will resolve to the new animation or an array of animations\r\n */\r\n Animation.ParseFromFileAsync = function (name, url) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n var request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", function () {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n var serializationObject = JSON.parse(request.responseText);\r\n if (serializationObject.length) {\r\n var output = new Array();\r\n for (var _i = 0, serializationObject_1 = serializationObject; _i < serializationObject_1.length; _i++) {\r\n var serializedAnimation = serializationObject_1[_i];\r\n output.push(_this.Parse(serializedAnimation));\r\n }\r\n resolve(output);\r\n }\r\n else {\r\n var output = _this.Parse(serializationObject);\r\n if (name) {\r\n output.name = name;\r\n }\r\n resolve(output);\r\n }\r\n }\r\n else {\r\n reject(\"Unable to load the animation\");\r\n }\r\n }\r\n });\r\n request.open(\"GET\", url);\r\n request.send();\r\n });\r\n };\r\n /**\r\n * Creates an animation or an array of animations from a snippet saved by the Inspector\r\n * @param snippetId defines the snippet to load\r\n * @returns a promise that will resolve to the new animation or a new array of animations\r\n */\r\n Animation.CreateFromSnippetAsync = function (snippetId) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n var request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", function () {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n var snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n if (snippet.animations) {\r\n var serializationObject = JSON.parse(snippet.animations);\r\n var output = new Array();\r\n for (var _i = 0, serializationObject_2 = serializationObject; _i < serializationObject_2.length; _i++) {\r\n var serializedAnimation = serializationObject_2[_i];\r\n output.push(_this.Parse(serializedAnimation));\r\n }\r\n resolve(output);\r\n }\r\n else {\r\n var serializationObject = JSON.parse(snippet.animation);\r\n var output = _this.Parse(serializationObject);\r\n output.snippetId = snippetId;\r\n resolve(output);\r\n }\r\n }\r\n else {\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n request.open(\"GET\", _this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n };\r\n /**\r\n * Use matrix interpolation instead of using direct key value when animating matrices\r\n */\r\n Animation.AllowMatricesInterpolation = false;\r\n /**\r\n * When matrix interpolation is enabled, this boolean forces the system to use Matrix.DecomposeLerp instead of Matrix.Lerp. Interpolation is more precise but slower\r\n */\r\n Animation.AllowMatrixDecomposeForInterpolation = true;\r\n /** Define the Url to load snippets */\r\n Animation.SnippetUrl = \"https://snippet.babylonjs.com\";\r\n // Statics\r\n /**\r\n * Float animation type\r\n */\r\n Animation.ANIMATIONTYPE_FLOAT = 0;\r\n /**\r\n * Vector3 animation type\r\n */\r\n Animation.ANIMATIONTYPE_VECTOR3 = 1;\r\n /**\r\n * Quaternion animation type\r\n */\r\n Animation.ANIMATIONTYPE_QUATERNION = 2;\r\n /**\r\n * Matrix animation type\r\n */\r\n Animation.ANIMATIONTYPE_MATRIX = 3;\r\n /**\r\n * Color3 animation type\r\n */\r\n Animation.ANIMATIONTYPE_COLOR3 = 4;\r\n /**\r\n * Color3 animation type\r\n */\r\n Animation.ANIMATIONTYPE_COLOR4 = 7;\r\n /**\r\n * Vector2 animation type\r\n */\r\n Animation.ANIMATIONTYPE_VECTOR2 = 5;\r\n /**\r\n * Size animation type\r\n */\r\n Animation.ANIMATIONTYPE_SIZE = 6;\r\n /**\r\n * Relative Loop Mode\r\n */\r\n Animation.ANIMATIONLOOPMODE_RELATIVE = 0;\r\n /**\r\n * Cycle Loop Mode\r\n */\r\n Animation.ANIMATIONLOOPMODE_CYCLE = 1;\r\n /**\r\n * Constant Loop Mode\r\n */\r\n Animation.ANIMATIONLOOPMODE_CONSTANT = 2;\r\n return Animation;\r\n}());\r\nexport { Animation };\r\n_TypeStore.RegisteredTypes[\"BABYLON.Animation\"] = Animation;\r\nNode._AnimationRangeFactory = function (name, from, to) { return new AnimationRange(name, from, to); };\r\n//# sourceMappingURL=animation.js.map","/**\r\n * Enum for the animation key frame interpolation type\r\n */\r\nexport var AnimationKeyInterpolation;\r\n(function (AnimationKeyInterpolation) {\r\n /**\r\n * Do not interpolate between keys and use the start key value only. Tangents are ignored\r\n */\r\n AnimationKeyInterpolation[AnimationKeyInterpolation[\"STEP\"] = 1] = \"STEP\";\r\n})(AnimationKeyInterpolation || (AnimationKeyInterpolation = {}));\r\n//# sourceMappingURL=animationKey.js.map","/**\r\n * Represents the range of an animation\r\n */\r\nvar AnimationRange = /** @class */ (function () {\r\n /**\r\n * Initializes the range of an animation\r\n * @param name The name of the animation range\r\n * @param from The starting frame of the animation\r\n * @param to The ending frame of the animation\r\n */\r\n function AnimationRange(\r\n /**The name of the animation range**/\r\n name, \r\n /**The starting frame of the animation */\r\n from, \r\n /**The ending frame of the animation*/\r\n to) {\r\n this.name = name;\r\n this.from = from;\r\n this.to = to;\r\n }\r\n /**\r\n * Makes a copy of the animation range\r\n * @returns A copy of the animation range\r\n */\r\n AnimationRange.prototype.clone = function () {\r\n return new AnimationRange(this.name, this.from, this.to);\r\n };\r\n return AnimationRange;\r\n}());\r\nexport { AnimationRange };\r\n//# sourceMappingURL=animationRange.js.map","import { ArrayTools } from \"../Misc/arrayTools\";\r\nimport { Matrix, Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport { PickingInfo } from \"../Collisions/pickingInfo\";\r\nimport { IntersectionInfo } from \"../Collisions/intersectionInfo\";\r\nimport { Scene } from \"../scene\";\r\nimport { Camera } from \"../Cameras/camera\";\r\n/**\r\n * Class representing a ray with position and direction\r\n */\r\nvar Ray = /** @class */ (function () {\r\n /**\r\n * Creates a new ray\r\n * @param origin origin point\r\n * @param direction direction\r\n * @param length length of the ray\r\n */\r\n function Ray(\r\n /** origin point */\r\n origin, \r\n /** direction */\r\n direction, \r\n /** length of the ray */\r\n length) {\r\n if (length === void 0) { length = Number.MAX_VALUE; }\r\n this.origin = origin;\r\n this.direction = direction;\r\n this.length = length;\r\n }\r\n // Methods\r\n /**\r\n * Checks if the ray intersects a box\r\n * This does not account for the ray lenght by design to improve perfs.\r\n * @param minimum bound of the box\r\n * @param maximum bound of the box\r\n * @param intersectionTreshold extra extend to be added to the box in all direction\r\n * @returns if the box was hit\r\n */\r\n Ray.prototype.intersectsBoxMinMax = function (minimum, maximum, intersectionTreshold) {\r\n if (intersectionTreshold === void 0) { intersectionTreshold = 0; }\r\n var newMinimum = Ray._TmpVector3[0].copyFromFloats(minimum.x - intersectionTreshold, minimum.y - intersectionTreshold, minimum.z - intersectionTreshold);\r\n var newMaximum = Ray._TmpVector3[1].copyFromFloats(maximum.x + intersectionTreshold, maximum.y + intersectionTreshold, maximum.z + intersectionTreshold);\r\n var d = 0.0;\r\n var maxValue = Number.MAX_VALUE;\r\n var inv;\r\n var min;\r\n var max;\r\n var temp;\r\n if (Math.abs(this.direction.x) < 0.0000001) {\r\n if (this.origin.x < newMinimum.x || this.origin.x > newMaximum.x) {\r\n return false;\r\n }\r\n }\r\n else {\r\n inv = 1.0 / this.direction.x;\r\n min = (newMinimum.x - this.origin.x) * inv;\r\n max = (newMaximum.x - this.origin.x) * inv;\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n if (Math.abs(this.direction.y) < 0.0000001) {\r\n if (this.origin.y < newMinimum.y || this.origin.y > newMaximum.y) {\r\n return false;\r\n }\r\n }\r\n else {\r\n inv = 1.0 / this.direction.y;\r\n min = (newMinimum.y - this.origin.y) * inv;\r\n max = (newMaximum.y - this.origin.y) * inv;\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n if (Math.abs(this.direction.z) < 0.0000001) {\r\n if (this.origin.z < newMinimum.z || this.origin.z > newMaximum.z) {\r\n return false;\r\n }\r\n }\r\n else {\r\n inv = 1.0 / this.direction.z;\r\n min = (newMinimum.z - this.origin.z) * inv;\r\n max = (newMaximum.z - this.origin.z) * inv;\r\n if (max === -Infinity) {\r\n max = Infinity;\r\n }\r\n if (min > max) {\r\n temp = min;\r\n min = max;\r\n max = temp;\r\n }\r\n d = Math.max(min, d);\r\n maxValue = Math.min(max, maxValue);\r\n if (d > maxValue) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks if the ray intersects a box\r\n * This does not account for the ray lenght by design to improve perfs.\r\n * @param box the bounding box to check\r\n * @param intersectionTreshold extra extend to be added to the BoundingBox in all direction\r\n * @returns if the box was hit\r\n */\r\n Ray.prototype.intersectsBox = function (box, intersectionTreshold) {\r\n if (intersectionTreshold === void 0) { intersectionTreshold = 0; }\r\n return this.intersectsBoxMinMax(box.minimum, box.maximum, intersectionTreshold);\r\n };\r\n /**\r\n * If the ray hits a sphere\r\n * @param sphere the bounding sphere to check\r\n * @param intersectionTreshold extra extend to be added to the BoundingSphere in all direction\r\n * @returns true if it hits the sphere\r\n */\r\n Ray.prototype.intersectsSphere = function (sphere, intersectionTreshold) {\r\n if (intersectionTreshold === void 0) { intersectionTreshold = 0; }\r\n var x = sphere.center.x - this.origin.x;\r\n var y = sphere.center.y - this.origin.y;\r\n var z = sphere.center.z - this.origin.z;\r\n var pyth = x * x + y * y + z * z;\r\n var radius = sphere.radius + intersectionTreshold;\r\n var rr = radius * radius;\r\n if (pyth <= rr) {\r\n return true;\r\n }\r\n var dot = x * this.direction.x + y * this.direction.y + z * this.direction.z;\r\n if (dot < 0.0) {\r\n return false;\r\n }\r\n var temp = pyth - dot * dot;\r\n return temp <= rr;\r\n };\r\n /**\r\n * If the ray hits a triange\r\n * @param vertex0 triangle vertex\r\n * @param vertex1 triangle vertex\r\n * @param vertex2 triangle vertex\r\n * @returns intersection information if hit\r\n */\r\n Ray.prototype.intersectsTriangle = function (vertex0, vertex1, vertex2) {\r\n var edge1 = Ray._TmpVector3[0];\r\n var edge2 = Ray._TmpVector3[1];\r\n var pvec = Ray._TmpVector3[2];\r\n var tvec = Ray._TmpVector3[3];\r\n var qvec = Ray._TmpVector3[4];\r\n vertex1.subtractToRef(vertex0, edge1);\r\n vertex2.subtractToRef(vertex0, edge2);\r\n Vector3.CrossToRef(this.direction, edge2, pvec);\r\n var det = Vector3.Dot(edge1, pvec);\r\n if (det === 0) {\r\n return null;\r\n }\r\n var invdet = 1 / det;\r\n this.origin.subtractToRef(vertex0, tvec);\r\n var bv = Vector3.Dot(tvec, pvec) * invdet;\r\n if (bv < 0 || bv > 1.0) {\r\n return null;\r\n }\r\n Vector3.CrossToRef(tvec, edge1, qvec);\r\n var bw = Vector3.Dot(this.direction, qvec) * invdet;\r\n if (bw < 0 || bv + bw > 1.0) {\r\n return null;\r\n }\r\n //check if the distance is longer than the predefined length.\r\n var distance = Vector3.Dot(edge2, qvec) * invdet;\r\n if (distance > this.length) {\r\n return null;\r\n }\r\n return new IntersectionInfo(1 - bv - bw, bv, distance);\r\n };\r\n /**\r\n * Checks if ray intersects a plane\r\n * @param plane the plane to check\r\n * @returns the distance away it was hit\r\n */\r\n Ray.prototype.intersectsPlane = function (plane) {\r\n var distance;\r\n var result1 = Vector3.Dot(plane.normal, this.direction);\r\n if (Math.abs(result1) < 9.99999997475243e-7) {\r\n return null;\r\n }\r\n else {\r\n var result2 = Vector3.Dot(plane.normal, this.origin);\r\n distance = (-plane.d - result2) / result1;\r\n if (distance < 0.0) {\r\n if (distance < -9.99999997475243e-7) {\r\n return null;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n return distance;\r\n }\r\n };\r\n /**\r\n * Calculate the intercept of a ray on a given axis\r\n * @param axis to check 'x' | 'y' | 'z'\r\n * @param offset from axis interception (i.e. an offset of 1y is intercepted above ground)\r\n * @returns a vector containing the coordinates where 'axis' is equal to zero (else offset), or null if there is no intercept.\r\n */\r\n Ray.prototype.intersectsAxis = function (axis, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n switch (axis) {\r\n case \"y\":\r\n var t = (this.origin.y - offset) / this.direction.y;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new Vector3(this.origin.x + this.direction.x * -t, offset, this.origin.z + this.direction.z * -t);\r\n case \"x\":\r\n var t = (this.origin.x - offset) / this.direction.x;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new Vector3(offset, this.origin.y + this.direction.y * -t, this.origin.z + this.direction.z * -t);\r\n case \"z\":\r\n var t = (this.origin.z - offset) / this.direction.z;\r\n if (t > 0) {\r\n return null;\r\n }\r\n return new Vector3(this.origin.x + this.direction.x * -t, this.origin.y + this.direction.y * -t, offset);\r\n default:\r\n return null;\r\n }\r\n };\r\n /**\r\n * Checks if ray intersects a mesh\r\n * @param mesh the mesh to check\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @returns picking info of the intersecton\r\n */\r\n Ray.prototype.intersectsMesh = function (mesh, fastCheck) {\r\n var tm = TmpVectors.Matrix[0];\r\n mesh.getWorldMatrix().invertToRef(tm);\r\n if (this._tmpRay) {\r\n Ray.TransformToRef(this, tm, this._tmpRay);\r\n }\r\n else {\r\n this._tmpRay = Ray.Transform(this, tm);\r\n }\r\n return mesh.intersects(this._tmpRay, fastCheck);\r\n };\r\n /**\r\n * Checks if ray intersects a mesh\r\n * @param meshes the meshes to check\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param results array to store result in\r\n * @returns Array of picking infos\r\n */\r\n Ray.prototype.intersectsMeshes = function (meshes, fastCheck, results) {\r\n if (results) {\r\n results.length = 0;\r\n }\r\n else {\r\n results = [];\r\n }\r\n for (var i = 0; i < meshes.length; i++) {\r\n var pickInfo = this.intersectsMesh(meshes[i], fastCheck);\r\n if (pickInfo.hit) {\r\n results.push(pickInfo);\r\n }\r\n }\r\n results.sort(this._comparePickingInfo);\r\n return results;\r\n };\r\n Ray.prototype._comparePickingInfo = function (pickingInfoA, pickingInfoB) {\r\n if (pickingInfoA.distance < pickingInfoB.distance) {\r\n return -1;\r\n }\r\n else if (pickingInfoA.distance > pickingInfoB.distance) {\r\n return 1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n };\r\n /**\r\n * Intersection test between the ray and a given segment whithin a given tolerance (threshold)\r\n * @param sega the first point of the segment to test the intersection against\r\n * @param segb the second point of the segment to test the intersection against\r\n * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful\r\n * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection\r\n */\r\n Ray.prototype.intersectionSegment = function (sega, segb, threshold) {\r\n var o = this.origin;\r\n var u = TmpVectors.Vector3[0];\r\n var rsegb = TmpVectors.Vector3[1];\r\n var v = TmpVectors.Vector3[2];\r\n var w = TmpVectors.Vector3[3];\r\n segb.subtractToRef(sega, u);\r\n this.direction.scaleToRef(Ray.rayl, v);\r\n o.addToRef(v, rsegb);\r\n sega.subtractToRef(o, w);\r\n var a = Vector3.Dot(u, u); // always >= 0\r\n var b = Vector3.Dot(u, v);\r\n var c = Vector3.Dot(v, v); // always >= 0\r\n var d = Vector3.Dot(u, w);\r\n var e = Vector3.Dot(v, w);\r\n var D = a * c - b * b; // always >= 0\r\n var sc, sN, sD = D; // sc = sN / sD, default sD = D >= 0\r\n var tc, tN, tD = D; // tc = tN / tD, default tD = D >= 0\r\n // compute the line parameters of the two closest points\r\n if (D < Ray.smallnum) {\r\n // the lines are almost parallel\r\n sN = 0.0; // force using point P0 on segment S1\r\n sD = 1.0; // to prevent possible division by 0.0 later\r\n tN = e;\r\n tD = c;\r\n }\r\n else {\r\n // get the closest points on the infinite lines\r\n sN = b * e - c * d;\r\n tN = a * e - b * d;\r\n if (sN < 0.0) {\r\n // sc < 0 => the s=0 edge is visible\r\n sN = 0.0;\r\n tN = e;\r\n tD = c;\r\n }\r\n else if (sN > sD) {\r\n // sc > 1 => the s=1 edge is visible\r\n sN = sD;\r\n tN = e + b;\r\n tD = c;\r\n }\r\n }\r\n if (tN < 0.0) {\r\n // tc < 0 => the t=0 edge is visible\r\n tN = 0.0;\r\n // recompute sc for this edge\r\n if (-d < 0.0) {\r\n sN = 0.0;\r\n }\r\n else if (-d > a) {\r\n sN = sD;\r\n }\r\n else {\r\n sN = -d;\r\n sD = a;\r\n }\r\n }\r\n else if (tN > tD) {\r\n // tc > 1 => the t=1 edge is visible\r\n tN = tD;\r\n // recompute sc for this edge\r\n if (-d + b < 0.0) {\r\n sN = 0;\r\n }\r\n else if (-d + b > a) {\r\n sN = sD;\r\n }\r\n else {\r\n sN = -d + b;\r\n sD = a;\r\n }\r\n }\r\n // finally do the division to get sc and tc\r\n sc = Math.abs(sN) < Ray.smallnum ? 0.0 : sN / sD;\r\n tc = Math.abs(tN) < Ray.smallnum ? 0.0 : tN / tD;\r\n // get the difference of the two closest points\r\n var qtc = TmpVectors.Vector3[4];\r\n v.scaleToRef(tc, qtc);\r\n var qsc = TmpVectors.Vector3[5];\r\n u.scaleToRef(sc, qsc);\r\n qsc.addInPlace(w);\r\n var dP = TmpVectors.Vector3[6];\r\n qsc.subtractToRef(qtc, dP); // = S1(sc) - S2(tc)\r\n var isIntersected = tc > 0 && tc <= this.length && dP.lengthSquared() < threshold * threshold; // return intersection result\r\n if (isIntersected) {\r\n return qsc.length();\r\n }\r\n return -1;\r\n };\r\n /**\r\n * Update the ray from viewport position\r\n * @param x position\r\n * @param y y position\r\n * @param viewportWidth viewport width\r\n * @param viewportHeight viewport height\r\n * @param world world matrix\r\n * @param view view matrix\r\n * @param projection projection matrix\r\n * @returns this ray updated\r\n */\r\n Ray.prototype.update = function (x, y, viewportWidth, viewportHeight, world, view, projection) {\r\n this.unprojectRayToRef(x, y, viewportWidth, viewportHeight, world, view, projection);\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Creates a ray with origin and direction of 0,0,0\r\n * @returns the new ray\r\n */\r\n Ray.Zero = function () {\r\n return new Ray(Vector3.Zero(), Vector3.Zero());\r\n };\r\n /**\r\n * Creates a new ray from screen space and viewport\r\n * @param x position\r\n * @param y y position\r\n * @param viewportWidth viewport width\r\n * @param viewportHeight viewport height\r\n * @param world world matrix\r\n * @param view view matrix\r\n * @param projection projection matrix\r\n * @returns new ray\r\n */\r\n Ray.CreateNew = function (x, y, viewportWidth, viewportHeight, world, view, projection) {\r\n var result = Ray.Zero();\r\n return result.update(x, y, viewportWidth, viewportHeight, world, view, projection);\r\n };\r\n /**\r\n * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be\r\n * transformed to the given world matrix.\r\n * @param origin The origin point\r\n * @param end The end point\r\n * @param world a matrix to transform the ray to. Default is the identity matrix.\r\n * @returns the new ray\r\n */\r\n Ray.CreateNewFromTo = function (origin, end, world) {\r\n if (world === void 0) { world = Matrix.IdentityReadOnly; }\r\n var direction = end.subtract(origin);\r\n var length = Math.sqrt(direction.x * direction.x + direction.y * direction.y + direction.z * direction.z);\r\n direction.normalize();\r\n return Ray.Transform(new Ray(origin, direction, length), world);\r\n };\r\n /**\r\n * Transforms a ray by a matrix\r\n * @param ray ray to transform\r\n * @param matrix matrix to apply\r\n * @returns the resulting new ray\r\n */\r\n Ray.Transform = function (ray, matrix) {\r\n var result = new Ray(new Vector3(0, 0, 0), new Vector3(0, 0, 0));\r\n Ray.TransformToRef(ray, matrix, result);\r\n return result;\r\n };\r\n /**\r\n * Transforms a ray by a matrix\r\n * @param ray ray to transform\r\n * @param matrix matrix to apply\r\n * @param result ray to store result in\r\n */\r\n Ray.TransformToRef = function (ray, matrix, result) {\r\n Vector3.TransformCoordinatesToRef(ray.origin, matrix, result.origin);\r\n Vector3.TransformNormalToRef(ray.direction, matrix, result.direction);\r\n result.length = ray.length;\r\n var dir = result.direction;\r\n var len = dir.length();\r\n if (!(len === 0 || len === 1)) {\r\n var num = 1.0 / len;\r\n dir.x *= num;\r\n dir.y *= num;\r\n dir.z *= num;\r\n result.length *= len;\r\n }\r\n };\r\n /**\r\n * Unproject a ray from screen space to object space\r\n * @param sourceX defines the screen space x coordinate to use\r\n * @param sourceY defines the screen space y coordinate to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n */\r\n Ray.prototype.unprojectRayToRef = function (sourceX, sourceY, viewportWidth, viewportHeight, world, view, projection) {\r\n var matrix = TmpVectors.Matrix[0];\r\n world.multiplyToRef(view, matrix);\r\n matrix.multiplyToRef(projection, matrix);\r\n matrix.invert();\r\n var nearScreenSource = TmpVectors.Vector3[0];\r\n nearScreenSource.x = (sourceX / viewportWidth) * 2 - 1;\r\n nearScreenSource.y = -((sourceY / viewportHeight) * 2 - 1);\r\n nearScreenSource.z = -1.0;\r\n var farScreenSource = TmpVectors.Vector3[1].copyFromFloats(nearScreenSource.x, nearScreenSource.y, 1.0);\r\n var nearVec3 = TmpVectors.Vector3[2];\r\n var farVec3 = TmpVectors.Vector3[3];\r\n Vector3._UnprojectFromInvertedMatrixToRef(nearScreenSource, matrix, nearVec3);\r\n Vector3._UnprojectFromInvertedMatrixToRef(farScreenSource, matrix, farVec3);\r\n this.origin.copyFrom(nearVec3);\r\n farVec3.subtractToRef(nearVec3, this.direction);\r\n this.direction.normalize();\r\n };\r\n Ray._TmpVector3 = ArrayTools.BuildArray(6, Vector3.Zero);\r\n Ray.smallnum = 0.00000001;\r\n Ray.rayl = 10e8;\r\n return Ray;\r\n}());\r\nexport { Ray };\r\nScene.prototype.createPickingRay = function (x, y, world, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n var result = Ray.Zero();\r\n this.createPickingRayToRef(x, y, world, result, camera, cameraViewSpace);\r\n return result;\r\n};\r\nScene.prototype.createPickingRayToRef = function (x, y, world, result, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n var engine = this.getEngine();\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n return this;\r\n }\r\n camera = this.activeCamera;\r\n }\r\n var cameraViewport = camera.viewport;\r\n var viewport = cameraViewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight());\r\n // Moving coordinates to local viewport world\r\n x = x / engine.getHardwareScalingLevel() - viewport.x;\r\n y = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - viewport.y - viewport.height);\r\n result.update(x, y, viewport.width, viewport.height, world ? world : Matrix.IdentityReadOnly, cameraViewSpace ? Matrix.IdentityReadOnly : camera.getViewMatrix(), camera.getProjectionMatrix());\r\n return this;\r\n};\r\nScene.prototype.createPickingRayInCameraSpace = function (x, y, camera) {\r\n var result = Ray.Zero();\r\n this.createPickingRayInCameraSpaceToRef(x, y, result, camera);\r\n return result;\r\n};\r\nScene.prototype.createPickingRayInCameraSpaceToRef = function (x, y, result, camera) {\r\n if (!PickingInfo) {\r\n return this;\r\n }\r\n var engine = this.getEngine();\r\n if (!camera) {\r\n if (!this.activeCamera) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n camera = this.activeCamera;\r\n }\r\n var cameraViewport = camera.viewport;\r\n var viewport = cameraViewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight());\r\n var identity = Matrix.Identity();\r\n // Moving coordinates to local viewport world\r\n x = x / engine.getHardwareScalingLevel() - viewport.x;\r\n y = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - viewport.y - viewport.height);\r\n result.update(x, y, viewport.width, viewport.height, identity, identity, camera.getProjectionMatrix());\r\n return this;\r\n};\r\nScene.prototype._internalPickForMesh = function (pickingInfo, rayFunction, mesh, world, fastCheck, onlyBoundingInfo, trianglePredicate, skipBoundingInfo) {\r\n var ray = rayFunction(world);\r\n var result = mesh.intersects(ray, fastCheck, trianglePredicate, onlyBoundingInfo, world, skipBoundingInfo);\r\n if (!result || !result.hit) {\r\n return null;\r\n }\r\n if (!fastCheck && pickingInfo != null && result.distance >= pickingInfo.distance) {\r\n return null;\r\n }\r\n return result;\r\n};\r\nScene.prototype._internalPick = function (rayFunction, predicate, fastCheck, onlyBoundingInfo, trianglePredicate) {\r\n if (!PickingInfo) {\r\n return null;\r\n }\r\n var pickingInfo = null;\r\n for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\r\n var mesh = this.meshes[meshIndex];\r\n if (predicate) {\r\n if (!predicate(mesh)) {\r\n continue;\r\n }\r\n }\r\n else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {\r\n continue;\r\n }\r\n var world = mesh.skeleton && mesh.skeleton.overrideMesh ? mesh.skeleton.overrideMesh.getWorldMatrix() : mesh.getWorldMatrix();\r\n if (mesh.hasThinInstances && mesh.thinInstanceEnablePicking) {\r\n // first check if the ray intersects the whole bounding box/sphere of the mesh\r\n var result = this._internalPickForMesh(pickingInfo, rayFunction, mesh, world, true, true, trianglePredicate);\r\n if (result) {\r\n if (onlyBoundingInfo) {\r\n // the user only asked for a bounding info check so we can return\r\n return pickingInfo;\r\n }\r\n var tmpMatrix = TmpVectors.Matrix[1];\r\n var thinMatrices = mesh.thinInstanceGetWorldMatrices();\r\n for (var index = 0; index < thinMatrices.length; index++) {\r\n var thinMatrix = thinMatrices[index];\r\n thinMatrix.multiplyToRef(world, tmpMatrix);\r\n var result_1 = this._internalPickForMesh(pickingInfo, rayFunction, mesh, tmpMatrix, fastCheck, onlyBoundingInfo, trianglePredicate, true);\r\n if (result_1) {\r\n pickingInfo = result_1;\r\n pickingInfo.thinInstanceIndex = index;\r\n if (fastCheck) {\r\n return pickingInfo;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n var result = this._internalPickForMesh(pickingInfo, rayFunction, mesh, world, fastCheck, onlyBoundingInfo, trianglePredicate);\r\n if (result) {\r\n pickingInfo = result;\r\n if (fastCheck) {\r\n return pickingInfo;\r\n }\r\n }\r\n }\r\n }\r\n return pickingInfo || new PickingInfo();\r\n};\r\nScene.prototype._internalMultiPick = function (rayFunction, predicate, trianglePredicate) {\r\n if (!PickingInfo) {\r\n return null;\r\n }\r\n var pickingInfos = new Array();\r\n for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\r\n var mesh = this.meshes[meshIndex];\r\n if (predicate) {\r\n if (!predicate(mesh)) {\r\n continue;\r\n }\r\n }\r\n else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {\r\n continue;\r\n }\r\n var world = mesh.skeleton && mesh.skeleton.overrideMesh ? mesh.skeleton.overrideMesh.getWorldMatrix() : mesh.getWorldMatrix();\r\n if (mesh.hasThinInstances && mesh.thinInstanceEnablePicking) {\r\n var result = this._internalPickForMesh(null, rayFunction, mesh, world, true, true, trianglePredicate);\r\n if (result) {\r\n var tmpMatrix = TmpVectors.Matrix[1];\r\n var thinMatrices = mesh.thinInstanceGetWorldMatrices();\r\n for (var index = 0; index < thinMatrices.length; index++) {\r\n var thinMatrix = thinMatrices[index];\r\n thinMatrix.multiplyToRef(world, tmpMatrix);\r\n var result_2 = this._internalPickForMesh(null, rayFunction, mesh, tmpMatrix, false, false, trianglePredicate, true);\r\n if (result_2) {\r\n result_2.thinInstanceIndex = index;\r\n pickingInfos.push(result_2);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n var result = this._internalPickForMesh(null, rayFunction, mesh, world, false, false, trianglePredicate);\r\n if (result) {\r\n pickingInfos.push(result);\r\n }\r\n }\r\n }\r\n return pickingInfos;\r\n};\r\nScene.prototype.pickWithBoundingInfo = function (x, y, predicate, fastCheck, camera) {\r\n var _this = this;\r\n if (!PickingInfo) {\r\n return null;\r\n }\r\n var result = this._internalPick(function (world) {\r\n if (!_this._tempPickingRay) {\r\n _this._tempPickingRay = Ray.Zero();\r\n }\r\n _this.createPickingRayToRef(x, y, world, _this._tempPickingRay, camera || null);\r\n return _this._tempPickingRay;\r\n }, predicate, fastCheck, true);\r\n if (result) {\r\n result.ray = this.createPickingRay(x, y, Matrix.Identity(), camera || null);\r\n }\r\n return result;\r\n};\r\nScene.prototype.pick = function (x, y, predicate, fastCheck, camera, trianglePredicate) {\r\n var _this = this;\r\n if (!PickingInfo) {\r\n return null;\r\n }\r\n var result = this._internalPick(function (world) {\r\n if (!_this._tempPickingRay) {\r\n _this._tempPickingRay = Ray.Zero();\r\n }\r\n _this.createPickingRayToRef(x, y, world, _this._tempPickingRay, camera || null);\r\n return _this._tempPickingRay;\r\n }, predicate, fastCheck, false, trianglePredicate);\r\n if (result) {\r\n result.ray = this.createPickingRay(x, y, Matrix.Identity(), camera || null);\r\n }\r\n return result;\r\n};\r\nScene.prototype.pickWithRay = function (ray, predicate, fastCheck, trianglePredicate) {\r\n var _this = this;\r\n var result = this._internalPick(function (world) {\r\n if (!_this._pickWithRayInverseMatrix) {\r\n _this._pickWithRayInverseMatrix = Matrix.Identity();\r\n }\r\n world.invertToRef(_this._pickWithRayInverseMatrix);\r\n if (!_this._cachedRayForTransform) {\r\n _this._cachedRayForTransform = Ray.Zero();\r\n }\r\n Ray.TransformToRef(ray, _this._pickWithRayInverseMatrix, _this._cachedRayForTransform);\r\n return _this._cachedRayForTransform;\r\n }, predicate, fastCheck, false, trianglePredicate);\r\n if (result) {\r\n result.ray = ray;\r\n }\r\n return result;\r\n};\r\nScene.prototype.multiPick = function (x, y, predicate, camera, trianglePredicate) {\r\n var _this = this;\r\n return this._internalMultiPick(function (world) { return _this.createPickingRay(x, y, world, camera || null); }, predicate, trianglePredicate);\r\n};\r\nScene.prototype.multiPickWithRay = function (ray, predicate, trianglePredicate) {\r\n var _this = this;\r\n return this._internalMultiPick(function (world) {\r\n if (!_this._pickWithRayInverseMatrix) {\r\n _this._pickWithRayInverseMatrix = Matrix.Identity();\r\n }\r\n world.invertToRef(_this._pickWithRayInverseMatrix);\r\n if (!_this._cachedRayForTransform) {\r\n _this._cachedRayForTransform = Ray.Zero();\r\n }\r\n Ray.TransformToRef(ray, _this._pickWithRayInverseMatrix, _this._cachedRayForTransform);\r\n return _this._cachedRayForTransform;\r\n }, predicate, trianglePredicate);\r\n};\r\nCamera.prototype.getForwardRay = function (length, transform, origin) {\r\n if (length === void 0) { length = 100; }\r\n return this.getForwardRayToRef(new Ray(Vector3.Zero(), Vector3.Zero(), length), length, transform, origin);\r\n};\r\nCamera.prototype.getForwardRayToRef = function (refRay, length, transform, origin) {\r\n if (length === void 0) { length = 100; }\r\n if (!transform) {\r\n transform = this.getWorldMatrix();\r\n }\r\n refRay.length = length;\r\n if (!origin) {\r\n refRay.origin.copyFrom(this.position);\r\n }\r\n else {\r\n refRay.origin.copyFrom(origin);\r\n }\r\n TmpVectors.Vector3[2].set(0, 0, this._scene.useRightHandedSystem ? -1 : 1);\r\n Vector3.TransformNormalToRef(TmpVectors.Vector3[2], transform, TmpVectors.Vector3[3]);\r\n Vector3.NormalizeToRef(TmpVectors.Vector3[3], refRay.direction);\r\n return refRay;\r\n};\r\n//# sourceMappingURL=ray.js.map","import { Vector3, Matrix } from '../Maths/math.vector';\r\n/**\r\n * Class containing a set of static utilities functions for managing Pivots\r\n * @hidden\r\n */\r\nvar PivotTools = /** @class */ (function () {\r\n function PivotTools() {\r\n }\r\n /** @hidden */\r\n PivotTools._RemoveAndStorePivotPoint = function (mesh) {\r\n if (mesh && PivotTools._PivotCached === 0) {\r\n // Save old pivot and set pivot to 0,0,0\r\n mesh.getPivotPointToRef(PivotTools._OldPivotPoint);\r\n PivotTools._PivotPostMultiplyPivotMatrix = mesh._postMultiplyPivotMatrix;\r\n if (!PivotTools._OldPivotPoint.equalsToFloats(0, 0, 0)) {\r\n mesh.setPivotMatrix(Matrix.IdentityReadOnly);\r\n PivotTools._OldPivotPoint.subtractToRef(mesh.getPivotPoint(), PivotTools._PivotTranslation);\r\n PivotTools._PivotTmpVector.copyFromFloats(1, 1, 1);\r\n PivotTools._PivotTmpVector.subtractInPlace(mesh.scaling);\r\n PivotTools._PivotTmpVector.multiplyInPlace(PivotTools._PivotTranslation);\r\n mesh.position.addInPlace(PivotTools._PivotTmpVector);\r\n }\r\n }\r\n PivotTools._PivotCached++;\r\n };\r\n /** @hidden */\r\n PivotTools._RestorePivotPoint = function (mesh) {\r\n if (mesh && !PivotTools._OldPivotPoint.equalsToFloats(0, 0, 0) && PivotTools._PivotCached === 1) {\r\n mesh.setPivotPoint(PivotTools._OldPivotPoint);\r\n mesh._postMultiplyPivotMatrix = PivotTools._PivotPostMultiplyPivotMatrix;\r\n PivotTools._PivotTmpVector.copyFromFloats(1, 1, 1);\r\n PivotTools._PivotTmpVector.subtractInPlace(mesh.scaling);\r\n PivotTools._PivotTmpVector.multiplyInPlace(PivotTools._PivotTranslation);\r\n mesh.position.subtractInPlace(PivotTools._PivotTmpVector);\r\n }\r\n this._PivotCached--;\r\n };\r\n // Stores the state of the pivot cache (_oldPivotPoint, _pivotTranslation)\r\n // store/remove pivot point should only be applied during their outermost calls\r\n PivotTools._PivotCached = 0;\r\n PivotTools._OldPivotPoint = new Vector3();\r\n PivotTools._PivotTranslation = new Vector3();\r\n PivotTools._PivotTmpVector = new Vector3();\r\n PivotTools._PivotPostMultiplyPivotMatrix = false;\r\n return PivotTools;\r\n}());\r\nexport { PivotTools };\r\n//# sourceMappingURL=pivotTools.js.map","import { Mesh } from \"../../Meshes/mesh\";\r\nimport { Scene } from \"../../scene\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Ray } from \"../../Culling/ray\";\r\nimport { PivotTools } from '../../Misc/pivotTools';\r\nimport \"../../Meshes/Builders/planeBuilder\";\r\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to be dragged around the screen based on pointer events\r\n */\r\nvar PointerDragBehavior = /** @class */ (function () {\r\n /**\r\n * Creates a pointer drag behavior that can be attached to a mesh\r\n * @param options The drag axis or normal of the plane that will be dragged across. If no options are specified the drag plane will always face the ray's origin (eg. camera)\r\n */\r\n function PointerDragBehavior(options) {\r\n this._useAlternatePickedPointAboveMaxDragAngleDragSpeed = -1.1;\r\n /**\r\n * The maximum tolerated angle between the drag plane and dragging pointer rays to trigger pointer events. Set to 0 to allow any angle (default: 0)\r\n */\r\n this.maxDragAngle = 0;\r\n /**\r\n * @hidden\r\n */\r\n this._useAlternatePickedPointAboveMaxDragAngle = false;\r\n /**\r\n * The id of the pointer that is currently interacting with the behavior (-1 when no pointer is active)\r\n */\r\n this.currentDraggingPointerID = -1;\r\n /**\r\n * If the behavior is currently in a dragging state\r\n */\r\n this.dragging = false;\r\n /**\r\n * The distance towards the target drag position to move each frame. This can be useful to avoid jitter. Set this to 1 for no delay. (Default: 0.2)\r\n */\r\n this.dragDeltaRatio = 0.2;\r\n /**\r\n * If the drag plane orientation should be updated during the dragging (Default: true)\r\n */\r\n this.updateDragPlane = true;\r\n // Debug mode will display drag planes to help visualize behavior\r\n this._debugMode = false;\r\n this._moving = false;\r\n /**\r\n * Fires each time the attached mesh is dragged with the pointer\r\n * * delta between last drag position and current drag position in world space\r\n * * dragDistance along the drag axis\r\n * * dragPlaneNormal normal of the current drag plane used during the drag\r\n * * dragPlanePoint in world space where the drag intersects the drag plane\r\n */\r\n this.onDragObservable = new Observable();\r\n /**\r\n * Fires each time a drag begins (eg. mouse down on mesh)\r\n */\r\n this.onDragStartObservable = new Observable();\r\n /**\r\n * Fires each time a drag ends (eg. mouse release after drag)\r\n */\r\n this.onDragEndObservable = new Observable();\r\n /**\r\n * If the attached mesh should be moved when dragged\r\n */\r\n this.moveAttached = true;\r\n /**\r\n * If the drag behavior will react to drag events (Default: true)\r\n */\r\n this.enabled = true;\r\n /**\r\n * If pointer events should start and release the drag (Default: true)\r\n */\r\n this.startAndReleaseDragOnPointerEvents = true;\r\n /**\r\n * If camera controls should be detached during the drag\r\n */\r\n this.detachCameraControls = true;\r\n /**\r\n * If set, the drag plane/axis will be rotated based on the attached mesh's world rotation (Default: true)\r\n */\r\n this.useObjectOrientationForDragging = true;\r\n /**\r\n * Predicate to determine if it is valid to move the object to a new position when it is moved\r\n */\r\n this.validateDrag = function (targetPosition) { return true; };\r\n this._tmpVector = new Vector3(0, 0, 0);\r\n this._alternatePickedPoint = new Vector3(0, 0, 0);\r\n this._worldDragAxis = new Vector3(0, 0, 0);\r\n this._targetPosition = new Vector3(0, 0, 0);\r\n this._attachedToElement = false;\r\n this._startDragRay = new Ray(new Vector3(), new Vector3());\r\n this._lastPointerRay = {};\r\n this._dragDelta = new Vector3();\r\n // Variables to avoid instantiation in the below method\r\n this._pointA = new Vector3(0, 0, 0);\r\n this._pointC = new Vector3(0, 0, 0);\r\n this._localAxis = new Vector3(0, 0, 0);\r\n this._lookAt = new Vector3(0, 0, 0);\r\n this._options = options ? options : {};\r\n var optionCount = 0;\r\n if (this._options.dragAxis) {\r\n optionCount++;\r\n }\r\n if (this._options.dragPlaneNormal) {\r\n optionCount++;\r\n }\r\n if (optionCount > 1) {\r\n throw \"Multiple drag modes specified in dragBehavior options. Only one expected\";\r\n }\r\n }\r\n Object.defineProperty(PointerDragBehavior.prototype, \"options\", {\r\n /**\r\n * Gets the options used by the behavior\r\n */\r\n get: function () {\r\n return this._options;\r\n },\r\n /**\r\n * Sets the options used by the behavior\r\n */\r\n set: function (options) {\r\n this._options = options;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PointerDragBehavior.prototype, \"name\", {\r\n /**\r\n * The name of the behavior\r\n */\r\n get: function () {\r\n return \"PointerDrag\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior\r\n */\r\n PointerDragBehavior.prototype.init = function () { };\r\n /**\r\n * Attaches the drag behavior the passed in mesh\r\n * @param ownerNode The mesh that will be dragged around once attached\r\n * @param predicate Predicate to use for pick filtering\r\n */\r\n PointerDragBehavior.prototype.attach = function (ownerNode, predicate) {\r\n var _this = this;\r\n this._scene = ownerNode.getScene();\r\n this.attachedNode = ownerNode;\r\n // Initialize drag plane to not interfere with existing scene\r\n if (!PointerDragBehavior._planeScene) {\r\n if (this._debugMode) {\r\n PointerDragBehavior._planeScene = this._scene;\r\n }\r\n else {\r\n PointerDragBehavior._planeScene = new Scene(this._scene.getEngine(), { virtual: true });\r\n PointerDragBehavior._planeScene.detachControl();\r\n this._scene.onDisposeObservable.addOnce(function () {\r\n PointerDragBehavior._planeScene.dispose();\r\n PointerDragBehavior._planeScene = null;\r\n });\r\n }\r\n }\r\n this._dragPlane = Mesh.CreatePlane(\"pointerDragPlane\", this._debugMode ? 1 : 10000, PointerDragBehavior._planeScene, false, Mesh.DOUBLESIDE);\r\n // State of the drag\r\n this.lastDragPosition = new Vector3(0, 0, 0);\r\n var pickPredicate = !!predicate ? predicate : function (m) {\r\n return _this.attachedNode == m || m.isDescendantOf(_this.attachedNode);\r\n };\r\n this._pointerObserver = this._scene.onPointerObservable.add(function (pointerInfo, eventState) {\r\n if (!_this.enabled) {\r\n return;\r\n }\r\n if (pointerInfo.type == PointerEventTypes.POINTERDOWN) {\r\n if (_this.startAndReleaseDragOnPointerEvents && !_this.dragging && pointerInfo.pickInfo && pointerInfo.pickInfo.hit && pointerInfo.pickInfo.pickedMesh && pointerInfo.pickInfo.pickedPoint && pointerInfo.pickInfo.ray && pickPredicate(pointerInfo.pickInfo.pickedMesh)) {\r\n _this._startDrag(pointerInfo.event.pointerId, pointerInfo.pickInfo.ray, pointerInfo.pickInfo.pickedPoint);\r\n }\r\n }\r\n else if (pointerInfo.type == PointerEventTypes.POINTERUP) {\r\n if (_this.startAndReleaseDragOnPointerEvents && _this.currentDraggingPointerID == pointerInfo.event.pointerId) {\r\n _this.releaseDrag();\r\n }\r\n }\r\n else if (pointerInfo.type == PointerEventTypes.POINTERMOVE) {\r\n var pointerId = pointerInfo.event.pointerId;\r\n // If drag was started with anyMouseID specified, set pointerID to the next mouse that moved\r\n if (_this.currentDraggingPointerID === PointerDragBehavior._AnyMouseID && pointerId !== PointerDragBehavior._AnyMouseID) {\r\n var evt = pointerInfo.event;\r\n var isMouseEvent = evt.pointerType === \"mouse\" || (!_this._scene.getEngine().hostInformation.isMobile && evt instanceof MouseEvent);\r\n if (isMouseEvent) {\r\n if (_this._lastPointerRay[_this.currentDraggingPointerID]) {\r\n _this._lastPointerRay[pointerId] = _this._lastPointerRay[_this.currentDraggingPointerID];\r\n delete _this._lastPointerRay[_this.currentDraggingPointerID];\r\n }\r\n _this.currentDraggingPointerID = pointerId;\r\n }\r\n }\r\n // Keep track of last pointer ray, this is used simulating the start of a drag in startDrag()\r\n if (!_this._lastPointerRay[pointerId]) {\r\n _this._lastPointerRay[pointerId] = new Ray(new Vector3(), new Vector3());\r\n }\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.ray) {\r\n _this._lastPointerRay[pointerId].origin.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n _this._lastPointerRay[pointerId].direction.copyFrom(pointerInfo.pickInfo.ray.direction);\r\n if (_this.currentDraggingPointerID == pointerId && _this.dragging) {\r\n _this._moveDrag(pointerInfo.pickInfo.ray);\r\n }\r\n }\r\n }\r\n });\r\n this._beforeRenderObserver = this._scene.onBeforeRenderObservable.add(function () {\r\n if (_this._moving && _this.moveAttached) {\r\n PivotTools._RemoveAndStorePivotPoint(_this.attachedNode);\r\n // Slowly move mesh to avoid jitter\r\n _this._targetPosition.subtractToRef((_this.attachedNode).absolutePosition, _this._tmpVector);\r\n _this._tmpVector.scaleInPlace(_this.dragDeltaRatio);\r\n (_this.attachedNode).getAbsolutePosition().addToRef(_this._tmpVector, _this._tmpVector);\r\n if (_this.validateDrag(_this._tmpVector)) {\r\n (_this.attachedNode).setAbsolutePosition(_this._tmpVector);\r\n }\r\n PivotTools._RestorePivotPoint(_this.attachedNode);\r\n }\r\n });\r\n };\r\n /**\r\n * Force relase the drag action by code.\r\n */\r\n PointerDragBehavior.prototype.releaseDrag = function () {\r\n if (this.dragging) {\r\n this.dragging = false;\r\n this.onDragEndObservable.notifyObservers({ dragPlanePoint: this.lastDragPosition, pointerId: this.currentDraggingPointerID });\r\n }\r\n this.currentDraggingPointerID = -1;\r\n this._moving = false;\r\n // Reattach camera controls\r\n if (this.detachCameraControls && this._attachedToElement && this._scene.activeCamera && !this._scene.activeCamera.leftCamera) {\r\n if (this._scene.activeCamera.getClassName() === \"ArcRotateCamera\") {\r\n var arcRotateCamera = this._scene.activeCamera;\r\n arcRotateCamera.attachControl(arcRotateCamera.inputs ? arcRotateCamera.inputs.noPreventDefault : true, arcRotateCamera._useCtrlForPanning, arcRotateCamera._panningMouseButton);\r\n }\r\n else {\r\n this._scene.activeCamera.attachControl(this._scene.activeCamera.inputs ? this._scene.activeCamera.inputs.noPreventDefault : true);\r\n }\r\n this._attachedToElement = false;\r\n }\r\n };\r\n /**\r\n * Simulates the start of a pointer drag event on the behavior\r\n * @param pointerId pointerID of the pointer that should be simulated (Default: Any mouse pointer ID)\r\n * @param fromRay initial ray of the pointer to be simulated (Default: Ray from camera to attached mesh)\r\n * @param startPickedPoint picked point of the pointer to be simulated (Default: attached mesh position)\r\n */\r\n PointerDragBehavior.prototype.startDrag = function (pointerId, fromRay, startPickedPoint) {\r\n if (pointerId === void 0) { pointerId = PointerDragBehavior._AnyMouseID; }\r\n this._startDrag(pointerId, fromRay, startPickedPoint);\r\n var lastRay = this._lastPointerRay[pointerId];\r\n if (pointerId === PointerDragBehavior._AnyMouseID) {\r\n lastRay = this._lastPointerRay[Object.keys(this._lastPointerRay)[0]];\r\n }\r\n if (lastRay) {\r\n // if there was a last pointer ray drag the object there\r\n this._moveDrag(lastRay);\r\n }\r\n };\r\n PointerDragBehavior.prototype._startDrag = function (pointerId, fromRay, startPickedPoint) {\r\n if (!this._scene.activeCamera || this.dragging || !this.attachedNode) {\r\n return;\r\n }\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedNode);\r\n // Create start ray from the camera to the object\r\n if (fromRay) {\r\n this._startDragRay.direction.copyFrom(fromRay.direction);\r\n this._startDragRay.origin.copyFrom(fromRay.origin);\r\n }\r\n else {\r\n this._startDragRay.origin.copyFrom(this._scene.activeCamera.position);\r\n this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector);\r\n this._tmpVector.subtractToRef(this._scene.activeCamera.position, this._startDragRay.direction);\r\n }\r\n this._updateDragPlanePosition(this._startDragRay, startPickedPoint ? startPickedPoint : this._tmpVector);\r\n var pickedPoint = this._pickWithRayOnDragPlane(this._startDragRay);\r\n if (pickedPoint) {\r\n this.dragging = true;\r\n this.currentDraggingPointerID = pointerId;\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n this.onDragStartObservable.notifyObservers({ dragPlanePoint: pickedPoint, pointerId: this.currentDraggingPointerID });\r\n this._targetPosition.copyFrom((this.attachedNode).absolutePosition);\r\n // Detatch camera controls\r\n if (this.detachCameraControls && this._scene.activeCamera && this._scene.activeCamera.inputs && !this._scene.activeCamera.leftCamera) {\r\n if (this._scene.activeCamera.inputs.attachedToElement) {\r\n this._scene.activeCamera.detachControl();\r\n this._attachedToElement = true;\r\n }\r\n else {\r\n this._attachedToElement = false;\r\n }\r\n }\r\n }\r\n PivotTools._RestorePivotPoint(this.attachedNode);\r\n };\r\n PointerDragBehavior.prototype._moveDrag = function (ray) {\r\n this._moving = true;\r\n var pickedPoint = this._pickWithRayOnDragPlane(ray);\r\n if (pickedPoint) {\r\n if (this.updateDragPlane) {\r\n this._updateDragPlanePosition(ray, pickedPoint);\r\n }\r\n var dragLength = 0;\r\n // depending on the drag mode option drag accordingly\r\n if (this._options.dragAxis) {\r\n // Convert local drag axis to world if useObjectOrientationForDragging\r\n this.useObjectOrientationForDragging ? Vector3.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._worldDragAxis) : this._worldDragAxis.copyFrom(this._options.dragAxis);\r\n // Project delta drag from the drag plane onto the drag axis\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._tmpVector);\r\n dragLength = Vector3.Dot(this._tmpVector, this._worldDragAxis);\r\n this._worldDragAxis.scaleToRef(dragLength, this._dragDelta);\r\n }\r\n else {\r\n dragLength = this._dragDelta.length();\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._dragDelta);\r\n }\r\n this._targetPosition.addInPlace(this._dragDelta);\r\n this.onDragObservable.notifyObservers({ dragDistance: dragLength, delta: this._dragDelta, dragPlanePoint: pickedPoint, dragPlaneNormal: this._dragPlane.forward, pointerId: this.currentDraggingPointerID });\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n }\r\n };\r\n PointerDragBehavior.prototype._pickWithRayOnDragPlane = function (ray) {\r\n var _this = this;\r\n if (!ray) {\r\n return null;\r\n }\r\n // Calculate angle between plane normal and ray\r\n var angle = Math.acos(Vector3.Dot(this._dragPlane.forward, ray.direction));\r\n // Correct if ray is casted from oposite side\r\n if (angle > Math.PI / 2) {\r\n angle = Math.PI - angle;\r\n }\r\n // If the angle is too perpendicular to the plane pick another point on the plane where it is looking\r\n if (this.maxDragAngle > 0 && angle > this.maxDragAngle) {\r\n if (this._useAlternatePickedPointAboveMaxDragAngle) {\r\n // Invert ray direction along the towards object axis\r\n this._tmpVector.copyFrom(ray.direction);\r\n (this.attachedNode).absolutePosition.subtractToRef(ray.origin, this._alternatePickedPoint);\r\n this._alternatePickedPoint.normalize();\r\n this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed * Vector3.Dot(this._alternatePickedPoint, this._tmpVector));\r\n this._tmpVector.addInPlace(this._alternatePickedPoint);\r\n // Project resulting vector onto the drag plane and add it to the attached nodes absolute position to get a picked point\r\n var dot = Vector3.Dot(this._dragPlane.forward, this._tmpVector);\r\n this._dragPlane.forward.scaleToRef(-dot, this._alternatePickedPoint);\r\n this._alternatePickedPoint.addInPlace(this._tmpVector);\r\n this._alternatePickedPoint.addInPlace((this.attachedNode).absolutePosition);\r\n return this._alternatePickedPoint;\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n var pickResult = PointerDragBehavior._planeScene.pickWithRay(ray, function (m) { return m == _this._dragPlane; });\r\n if (pickResult && pickResult.hit && pickResult.pickedMesh && pickResult.pickedPoint) {\r\n return pickResult.pickedPoint;\r\n }\r\n else {\r\n return null;\r\n }\r\n };\r\n // Position the drag plane based on the attached mesh position, for single axis rotate the plane along the axis to face the camera\r\n PointerDragBehavior.prototype._updateDragPlanePosition = function (ray, dragPlanePosition) {\r\n this._pointA.copyFrom(dragPlanePosition);\r\n if (this._options.dragAxis) {\r\n this.useObjectOrientationForDragging ? Vector3.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragAxis);\r\n // Calculate plane normal that is the cross product of local axis and (eye-dragPlanePosition)\r\n ray.origin.subtractToRef(this._pointA, this._pointC);\r\n this._pointC.normalize();\r\n if (Math.abs(Vector3.Dot(this._localAxis, this._pointC)) > 0.999) {\r\n // the drag axis is colinear with the (eye to position) ray. The cross product will give jittered values.\r\n // A new axis vector need to be computed\r\n if (Math.abs(Vector3.Dot(Vector3.UpReadOnly, this._pointC)) > 0.999) {\r\n this._lookAt.copyFrom(Vector3.Right());\r\n }\r\n else {\r\n this._lookAt.copyFrom(Vector3.UpReadOnly);\r\n }\r\n }\r\n else {\r\n Vector3.CrossToRef(this._localAxis, this._pointC, this._lookAt);\r\n // Get perpendicular line from previous result and drag axis to adjust lineB to be perpendiculat to camera\r\n Vector3.CrossToRef(this._localAxis, this._lookAt, this._lookAt);\r\n this._lookAt.normalize();\r\n }\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._lookAt, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n }\r\n else if (this._options.dragPlaneNormal) {\r\n this.useObjectOrientationForDragging ? Vector3.TransformCoordinatesToRef(this._options.dragPlaneNormal, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragPlaneNormal);\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._localAxis, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n }\r\n else {\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._dragPlane.lookAt(ray.origin);\r\n }\r\n // Update the position of the drag plane so it doesn't get out of sync with the node (eg. when moving back and forth quickly)\r\n this._dragPlane.position.copyFrom(this.attachedNode.absolutePosition);\r\n this._dragPlane.computeWorldMatrix(true);\r\n };\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n PointerDragBehavior.prototype.detach = function () {\r\n if (this._pointerObserver) {\r\n this._scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n if (this._beforeRenderObserver) {\r\n this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n this.releaseDrag();\r\n };\r\n PointerDragBehavior._AnyMouseID = -2;\r\n return PointerDragBehavior;\r\n}());\r\nexport { PointerDragBehavior };\r\n//# sourceMappingURL=pointerDragBehavior.js.map","import { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\n/**\r\n * The autoRotation behavior (AutoRotationBehavior) is designed to create a smooth rotation of an ArcRotateCamera when there is no user interaction.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior\r\n */\r\nvar AutoRotationBehavior = /** @class */ (function () {\r\n function AutoRotationBehavior() {\r\n this._zoomStopsAnimation = false;\r\n this._idleRotationSpeed = 0.05;\r\n this._idleRotationWaitTime = 2000;\r\n this._idleRotationSpinupTime = 2000;\r\n this._isPointerDown = false;\r\n this._lastFrameTime = null;\r\n this._lastInteractionTime = -Infinity;\r\n this._cameraRotationSpeed = 0;\r\n this._lastFrameRadius = 0;\r\n }\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"name\", {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n get: function () {\r\n return \"AutoRotation\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"zoomStopsAnimation\", {\r\n /**\r\n * Gets the flag that indicates if user zooming should stop animation.\r\n */\r\n get: function () {\r\n return this._zoomStopsAnimation;\r\n },\r\n /**\r\n * Sets the flag that indicates if user zooming should stop animation.\r\n */\r\n set: function (flag) {\r\n this._zoomStopsAnimation = flag;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"idleRotationSpeed\", {\r\n /**\r\n * Gets the default speed at which the camera rotates around the model.\r\n */\r\n get: function () {\r\n return this._idleRotationSpeed;\r\n },\r\n /**\r\n * Sets the default speed at which the camera rotates around the model.\r\n */\r\n set: function (speed) {\r\n this._idleRotationSpeed = speed;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"idleRotationWaitTime\", {\r\n /**\r\n * Gets the time (milliseconds) to wait after user interaction before the camera starts rotating.\r\n */\r\n get: function () {\r\n return this._idleRotationWaitTime;\r\n },\r\n /**\r\n * Sets the time (in milliseconds) to wait after user interaction before the camera starts rotating.\r\n */\r\n set: function (time) {\r\n this._idleRotationWaitTime = time;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"idleRotationSpinupTime\", {\r\n /**\r\n * Gets the time (milliseconds) to take to spin up to the full idle rotation speed.\r\n */\r\n get: function () {\r\n return this._idleRotationSpinupTime;\r\n },\r\n /**\r\n * Sets the time (milliseconds) to take to spin up to the full idle rotation speed.\r\n */\r\n set: function (time) {\r\n this._idleRotationSpinupTime = time;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AutoRotationBehavior.prototype, \"rotationInProgress\", {\r\n /**\r\n * Gets a value indicating if the camera is currently rotating because of this behavior\r\n */\r\n get: function () {\r\n return Math.abs(this._cameraRotationSpeed) > 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior.\r\n */\r\n AutoRotationBehavior.prototype.init = function () {\r\n // Do notihng\r\n };\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n AutoRotationBehavior.prototype.attach = function (camera) {\r\n var _this = this;\r\n this._attachedCamera = camera;\r\n var scene = this._attachedCamera.getScene();\r\n this._onPrePointerObservableObserver = scene.onPrePointerObservable.add(function (pointerInfoPre) {\r\n if (pointerInfoPre.type === PointerEventTypes.POINTERDOWN) {\r\n _this._isPointerDown = true;\r\n return;\r\n }\r\n if (pointerInfoPre.type === PointerEventTypes.POINTERUP) {\r\n _this._isPointerDown = false;\r\n }\r\n });\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(function () {\r\n var now = PrecisionDate.Now;\r\n var dt = 0;\r\n if (_this._lastFrameTime != null) {\r\n dt = now - _this._lastFrameTime;\r\n }\r\n _this._lastFrameTime = now;\r\n // Stop the animation if there is user interaction and the animation should stop for this interaction\r\n _this._applyUserInteraction();\r\n var timeToRotation = now - _this._lastInteractionTime - _this._idleRotationWaitTime;\r\n var scale = Math.max(Math.min(timeToRotation / (_this._idleRotationSpinupTime), 1), 0);\r\n _this._cameraRotationSpeed = _this._idleRotationSpeed * scale;\r\n // Step camera rotation by rotation speed\r\n if (_this._attachedCamera) {\r\n _this._attachedCamera.alpha -= _this._cameraRotationSpeed * (dt / 1000);\r\n }\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n AutoRotationBehavior.prototype.detach = function () {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n var scene = this._attachedCamera.getScene();\r\n if (this._onPrePointerObservableObserver) {\r\n scene.onPrePointerObservable.remove(this._onPrePointerObservableObserver);\r\n }\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n this._attachedCamera = null;\r\n };\r\n /**\r\n * Returns true if user is scrolling.\r\n * @return true if user is scrolling.\r\n */\r\n AutoRotationBehavior.prototype._userIsZooming = function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n return this._attachedCamera.inertialRadiusOffset !== 0;\r\n };\r\n AutoRotationBehavior.prototype._shouldAnimationStopForInteraction = function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n var zoomHasHitLimit = false;\r\n if (this._lastFrameRadius === this._attachedCamera.radius && this._attachedCamera.inertialRadiusOffset !== 0) {\r\n zoomHasHitLimit = true;\r\n }\r\n // Update the record of previous radius - works as an approx. indicator of hitting radius limits\r\n this._lastFrameRadius = this._attachedCamera.radius;\r\n return this._zoomStopsAnimation ? zoomHasHitLimit : this._userIsZooming();\r\n };\r\n /**\r\n * Applies any current user interaction to the camera. Takes into account maximum alpha rotation.\r\n */\r\n AutoRotationBehavior.prototype._applyUserInteraction = function () {\r\n if (this._userIsMoving() && !this._shouldAnimationStopForInteraction()) {\r\n this._lastInteractionTime = PrecisionDate.Now;\r\n }\r\n };\r\n // Tools\r\n AutoRotationBehavior.prototype._userIsMoving = function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n return this._attachedCamera.inertialAlphaOffset !== 0 ||\r\n this._attachedCamera.inertialBetaOffset !== 0 ||\r\n this._attachedCamera.inertialRadiusOffset !== 0 ||\r\n this._attachedCamera.inertialPanningX !== 0 ||\r\n this._attachedCamera.inertialPanningY !== 0 ||\r\n this._isPointerDown;\r\n };\r\n return AutoRotationBehavior;\r\n}());\r\nexport { AutoRotationBehavior };\r\n//# sourceMappingURL=autoRotationBehavior.js.map","import { __extends } from \"tslib\";\r\nimport { BezierCurve } from \"../Maths/math.path\";\r\n/**\r\n * Base class used for every default easing function.\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar EasingFunction = /** @class */ (function () {\r\n function EasingFunction() {\r\n this._easingMode = EasingFunction.EASINGMODE_EASEIN;\r\n }\r\n /**\r\n * Sets the easing mode of the current function.\r\n * @param easingMode Defines the willing mode (EASINGMODE_EASEIN, EASINGMODE_EASEOUT or EASINGMODE_EASEINOUT)\r\n */\r\n EasingFunction.prototype.setEasingMode = function (easingMode) {\r\n var n = Math.min(Math.max(easingMode, 0), 2);\r\n this._easingMode = n;\r\n };\r\n /**\r\n * Gets the current easing mode.\r\n * @returns the easing mode\r\n */\r\n EasingFunction.prototype.getEasingMode = function () {\r\n return this._easingMode;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n EasingFunction.prototype.easeInCore = function (gradient) {\r\n throw new Error('You must implement this method');\r\n };\r\n /**\r\n * Given an input gradient between 0 and 1, this returns the corresponding value\r\n * of the easing function.\r\n * @param gradient Defines the value between 0 and 1 we want the easing value for\r\n * @returns the corresponding value on the curve defined by the easing function\r\n */\r\n EasingFunction.prototype.ease = function (gradient) {\r\n switch (this._easingMode) {\r\n case EasingFunction.EASINGMODE_EASEIN:\r\n return this.easeInCore(gradient);\r\n case EasingFunction.EASINGMODE_EASEOUT:\r\n return (1 - this.easeInCore(1 - gradient));\r\n }\r\n if (gradient >= 0.5) {\r\n return (((1 - this.easeInCore((1 - gradient) * 2)) * 0.5) + 0.5);\r\n }\r\n return (this.easeInCore(gradient * 2) * 0.5);\r\n };\r\n /**\r\n * Interpolation follows the mathematical formula associated with the easing function.\r\n */\r\n EasingFunction.EASINGMODE_EASEIN = 0;\r\n /**\r\n * Interpolation follows 100% interpolation minus the output of the formula associated with the easing function.\r\n */\r\n EasingFunction.EASINGMODE_EASEOUT = 1;\r\n /**\r\n * Interpolation uses EaseIn for the first half of the animation and EaseOut for the second half.\r\n */\r\n EasingFunction.EASINGMODE_EASEINOUT = 2;\r\n return EasingFunction;\r\n}());\r\nexport { EasingFunction };\r\n/**\r\n * Easing function with a circle shape (see link below).\r\n * @see https://easings.net/#easeInCirc\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar CircleEase = /** @class */ (function (_super) {\r\n __extends(CircleEase, _super);\r\n function CircleEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n CircleEase.prototype.easeInCore = function (gradient) {\r\n gradient = Math.max(0, Math.min(1, gradient));\r\n return (1.0 - Math.sqrt(1.0 - (gradient * gradient)));\r\n };\r\n return CircleEase;\r\n}(EasingFunction));\r\nexport { CircleEase };\r\n/**\r\n * Easing function with a ease back shape (see link below).\r\n * @see https://easings.net/#easeInBack\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar BackEase = /** @class */ (function (_super) {\r\n __extends(BackEase, _super);\r\n /**\r\n * Instantiates a back ease easing\r\n * @see https://easings.net/#easeInBack\r\n * @param amplitude Defines the amplitude of the function\r\n */\r\n function BackEase(\r\n /** Defines the amplitude of the function */\r\n amplitude) {\r\n if (amplitude === void 0) { amplitude = 1; }\r\n var _this = _super.call(this) || this;\r\n _this.amplitude = amplitude;\r\n return _this;\r\n }\r\n /** @hidden */\r\n BackEase.prototype.easeInCore = function (gradient) {\r\n var num = Math.max(0, this.amplitude);\r\n return (Math.pow(gradient, 3.0) - ((gradient * num) * Math.sin(3.1415926535897931 * gradient)));\r\n };\r\n return BackEase;\r\n}(EasingFunction));\r\nexport { BackEase };\r\n/**\r\n * Easing function with a bouncing shape (see link below).\r\n * @see https://easings.net/#easeInBounce\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar BounceEase = /** @class */ (function (_super) {\r\n __extends(BounceEase, _super);\r\n /**\r\n * Instantiates a bounce easing\r\n * @see https://easings.net/#easeInBounce\r\n * @param bounces Defines the number of bounces\r\n * @param bounciness Defines the amplitude of the bounce\r\n */\r\n function BounceEase(\r\n /** Defines the number of bounces */\r\n bounces, \r\n /** Defines the amplitude of the bounce */\r\n bounciness) {\r\n if (bounces === void 0) { bounces = 3; }\r\n if (bounciness === void 0) { bounciness = 2; }\r\n var _this = _super.call(this) || this;\r\n _this.bounces = bounces;\r\n _this.bounciness = bounciness;\r\n return _this;\r\n }\r\n /** @hidden */\r\n BounceEase.prototype.easeInCore = function (gradient) {\r\n var y = Math.max(0.0, this.bounces);\r\n var bounciness = this.bounciness;\r\n if (bounciness <= 1.0) {\r\n bounciness = 1.001;\r\n }\r\n var num9 = Math.pow(bounciness, y);\r\n var num5 = 1.0 - bounciness;\r\n var num4 = ((1.0 - num9) / num5) + (num9 * 0.5);\r\n var num15 = gradient * num4;\r\n var num65 = Math.log((-num15 * (1.0 - bounciness)) + 1.0) / Math.log(bounciness);\r\n var num3 = Math.floor(num65);\r\n var num13 = num3 + 1.0;\r\n var num8 = (1.0 - Math.pow(bounciness, num3)) / (num5 * num4);\r\n var num12 = (1.0 - Math.pow(bounciness, num13)) / (num5 * num4);\r\n var num7 = (num8 + num12) * 0.5;\r\n var num6 = gradient - num7;\r\n var num2 = num7 - num8;\r\n return (((-Math.pow(1.0 / bounciness, y - num3) / (num2 * num2)) * (num6 - num2)) * (num6 + num2));\r\n };\r\n return BounceEase;\r\n}(EasingFunction));\r\nexport { BounceEase };\r\n/**\r\n * Easing function with a power of 3 shape (see link below).\r\n * @see https://easings.net/#easeInCubic\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar CubicEase = /** @class */ (function (_super) {\r\n __extends(CubicEase, _super);\r\n function CubicEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n CubicEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient * gradient);\r\n };\r\n return CubicEase;\r\n}(EasingFunction));\r\nexport { CubicEase };\r\n/**\r\n * Easing function with an elastic shape (see link below).\r\n * @see https://easings.net/#easeInElastic\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar ElasticEase = /** @class */ (function (_super) {\r\n __extends(ElasticEase, _super);\r\n /**\r\n * Instantiates an elastic easing function\r\n * @see https://easings.net/#easeInElastic\r\n * @param oscillations Defines the number of oscillations\r\n * @param springiness Defines the amplitude of the oscillations\r\n */\r\n function ElasticEase(\r\n /** Defines the number of oscillations*/\r\n oscillations, \r\n /** Defines the amplitude of the oscillations*/\r\n springiness) {\r\n if (oscillations === void 0) { oscillations = 3; }\r\n if (springiness === void 0) { springiness = 3; }\r\n var _this = _super.call(this) || this;\r\n _this.oscillations = oscillations;\r\n _this.springiness = springiness;\r\n return _this;\r\n }\r\n /** @hidden */\r\n ElasticEase.prototype.easeInCore = function (gradient) {\r\n var num2;\r\n var num3 = Math.max(0.0, this.oscillations);\r\n var num = Math.max(0.0, this.springiness);\r\n if (num == 0) {\r\n num2 = gradient;\r\n }\r\n else {\r\n num2 = (Math.exp(num * gradient) - 1.0) / (Math.exp(num) - 1.0);\r\n }\r\n return (num2 * Math.sin(((6.2831853071795862 * num3) + 1.5707963267948966) * gradient));\r\n };\r\n return ElasticEase;\r\n}(EasingFunction));\r\nexport { ElasticEase };\r\n/**\r\n * Easing function with an exponential shape (see link below).\r\n * @see https://easings.net/#easeInExpo\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar ExponentialEase = /** @class */ (function (_super) {\r\n __extends(ExponentialEase, _super);\r\n /**\r\n * Instantiates an exponential easing function\r\n * @see https://easings.net/#easeInExpo\r\n * @param exponent Defines the exponent of the function\r\n */\r\n function ExponentialEase(\r\n /** Defines the exponent of the function */\r\n exponent) {\r\n if (exponent === void 0) { exponent = 2; }\r\n var _this = _super.call(this) || this;\r\n _this.exponent = exponent;\r\n return _this;\r\n }\r\n /** @hidden */\r\n ExponentialEase.prototype.easeInCore = function (gradient) {\r\n if (this.exponent <= 0) {\r\n return gradient;\r\n }\r\n return ((Math.exp(this.exponent * gradient) - 1.0) / (Math.exp(this.exponent) - 1.0));\r\n };\r\n return ExponentialEase;\r\n}(EasingFunction));\r\nexport { ExponentialEase };\r\n/**\r\n * Easing function with a power shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar PowerEase = /** @class */ (function (_super) {\r\n __extends(PowerEase, _super);\r\n /**\r\n * Instantiates an power base easing function\r\n * @see https://easings.net/#easeInQuad\r\n * @param power Defines the power of the function\r\n */\r\n function PowerEase(\r\n /** Defines the power of the function */\r\n power) {\r\n if (power === void 0) { power = 2; }\r\n var _this = _super.call(this) || this;\r\n _this.power = power;\r\n return _this;\r\n }\r\n /** @hidden */\r\n PowerEase.prototype.easeInCore = function (gradient) {\r\n var y = Math.max(0.0, this.power);\r\n return Math.pow(gradient, y);\r\n };\r\n return PowerEase;\r\n}(EasingFunction));\r\nexport { PowerEase };\r\n/**\r\n * Easing function with a power of 2 shape (see link below).\r\n * @see https://easings.net/#easeInQuad\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar QuadraticEase = /** @class */ (function (_super) {\r\n __extends(QuadraticEase, _super);\r\n function QuadraticEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n QuadraticEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient);\r\n };\r\n return QuadraticEase;\r\n}(EasingFunction));\r\nexport { QuadraticEase };\r\n/**\r\n * Easing function with a power of 4 shape (see link below).\r\n * @see https://easings.net/#easeInQuart\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar QuarticEase = /** @class */ (function (_super) {\r\n __extends(QuarticEase, _super);\r\n function QuarticEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n QuarticEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient * gradient * gradient);\r\n };\r\n return QuarticEase;\r\n}(EasingFunction));\r\nexport { QuarticEase };\r\n/**\r\n * Easing function with a power of 5 shape (see link below).\r\n * @see https://easings.net/#easeInQuint\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar QuinticEase = /** @class */ (function (_super) {\r\n __extends(QuinticEase, _super);\r\n function QuinticEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n QuinticEase.prototype.easeInCore = function (gradient) {\r\n return (gradient * gradient * gradient * gradient * gradient);\r\n };\r\n return QuinticEase;\r\n}(EasingFunction));\r\nexport { QuinticEase };\r\n/**\r\n * Easing function with a sin shape (see link below).\r\n * @see https://easings.net/#easeInSine\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar SineEase = /** @class */ (function (_super) {\r\n __extends(SineEase, _super);\r\n function SineEase() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** @hidden */\r\n SineEase.prototype.easeInCore = function (gradient) {\r\n return (1.0 - Math.sin(1.5707963267948966 * (1.0 - gradient)));\r\n };\r\n return SineEase;\r\n}(EasingFunction));\r\nexport { SineEase };\r\n/**\r\n * Easing function with a bezier shape (see link below).\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @see https://doc.babylonjs.com/babylon101/animations#easing-functions\r\n */\r\nvar BezierCurveEase = /** @class */ (function (_super) {\r\n __extends(BezierCurveEase, _super);\r\n /**\r\n * Instantiates a bezier function\r\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\r\n * @param x1 Defines the x component of the start tangent in the bezier curve\r\n * @param y1 Defines the y component of the start tangent in the bezier curve\r\n * @param x2 Defines the x component of the end tangent in the bezier curve\r\n * @param y2 Defines the y component of the end tangent in the bezier curve\r\n */\r\n function BezierCurveEase(\r\n /** Defines the x component of the start tangent in the bezier curve */\r\n x1, \r\n /** Defines the y component of the start tangent in the bezier curve */\r\n y1, \r\n /** Defines the x component of the end tangent in the bezier curve */\r\n x2, \r\n /** Defines the y component of the end tangent in the bezier curve */\r\n y2) {\r\n if (x1 === void 0) { x1 = 0; }\r\n if (y1 === void 0) { y1 = 0; }\r\n if (x2 === void 0) { x2 = 1; }\r\n if (y2 === void 0) { y2 = 1; }\r\n var _this = _super.call(this) || this;\r\n _this.x1 = x1;\r\n _this.y1 = y1;\r\n _this.x2 = x2;\r\n _this.y2 = y2;\r\n return _this;\r\n }\r\n /** @hidden */\r\n BezierCurveEase.prototype.easeInCore = function (gradient) {\r\n return BezierCurve.Interpolate(gradient, this.x1, this.y1, this.x2, this.y2);\r\n };\r\n return BezierCurveEase;\r\n}(EasingFunction));\r\nexport { BezierCurveEase };\r\n//# sourceMappingURL=easing.js.map","import { BackEase, EasingFunction } from \"../../Animations/easing\";\r\nimport { Animation } from \"../../Animations/animation\";\r\n/**\r\n * Add a bouncing effect to an ArcRotateCamera when reaching a specified minimum and maximum radius\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior\r\n */\r\nvar BouncingBehavior = /** @class */ (function () {\r\n function BouncingBehavior() {\r\n /**\r\n * The duration of the animation, in milliseconds\r\n */\r\n this.transitionDuration = 450;\r\n /**\r\n * Length of the distance animated by the transition when lower radius is reached\r\n */\r\n this.lowerRadiusTransitionRange = 2;\r\n /**\r\n * Length of the distance animated by the transition when upper radius is reached\r\n */\r\n this.upperRadiusTransitionRange = -2;\r\n this._autoTransitionRange = false;\r\n // Animations\r\n this._radiusIsAnimating = false;\r\n this._radiusBounceTransition = null;\r\n this._animatables = new Array();\r\n }\r\n Object.defineProperty(BouncingBehavior.prototype, \"name\", {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n get: function () {\r\n return \"Bouncing\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BouncingBehavior.prototype, \"autoTransitionRange\", {\r\n /**\r\n * Gets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically\r\n */\r\n get: function () {\r\n return this._autoTransitionRange;\r\n },\r\n /**\r\n * Sets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically\r\n * Transition ranges will be set to 5% of the bounding box diagonal in world space\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (this._autoTransitionRange === value) {\r\n return;\r\n }\r\n this._autoTransitionRange = value;\r\n var camera = this._attachedCamera;\r\n if (!camera) {\r\n return;\r\n }\r\n if (value) {\r\n this._onMeshTargetChangedObserver = camera.onMeshTargetChangedObservable.add(function (mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n mesh.computeWorldMatrix(true);\r\n var diagonal = mesh.getBoundingInfo().diagonalLength;\r\n _this.lowerRadiusTransitionRange = diagonal * 0.05;\r\n _this.upperRadiusTransitionRange = diagonal * 0.05;\r\n });\r\n }\r\n else if (this._onMeshTargetChangedObserver) {\r\n camera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior.\r\n */\r\n BouncingBehavior.prototype.init = function () {\r\n // Do notihng\r\n };\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n BouncingBehavior.prototype.attach = function (camera) {\r\n var _this = this;\r\n this._attachedCamera = camera;\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(function () {\r\n if (!_this._attachedCamera) {\r\n return;\r\n }\r\n // Add the bounce animation to the lower radius limit\r\n if (_this._isRadiusAtLimit(_this._attachedCamera.lowerRadiusLimit)) {\r\n _this._applyBoundRadiusAnimation(_this.lowerRadiusTransitionRange);\r\n }\r\n // Add the bounce animation to the upper radius limit\r\n if (_this._isRadiusAtLimit(_this._attachedCamera.upperRadiusLimit)) {\r\n _this._applyBoundRadiusAnimation(_this.upperRadiusTransitionRange);\r\n }\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n BouncingBehavior.prototype.detach = function () {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n if (this._onAfterCheckInputsObserver) {\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n }\r\n if (this._onMeshTargetChangedObserver) {\r\n this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n this._attachedCamera = null;\r\n };\r\n /**\r\n * Checks if the camera radius is at the specified limit. Takes into account animation locks.\r\n * @param radiusLimit The limit to check against.\r\n * @return Bool to indicate if at limit.\r\n */\r\n BouncingBehavior.prototype._isRadiusAtLimit = function (radiusLimit) {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n if (this._attachedCamera.radius === radiusLimit && !this._radiusIsAnimating) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Applies an animation to the radius of the camera, extending by the radiusDelta.\r\n * @param radiusDelta The delta by which to animate to. Can be negative.\r\n */\r\n BouncingBehavior.prototype._applyBoundRadiusAnimation = function (radiusDelta) {\r\n var _this = this;\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n if (!this._radiusBounceTransition) {\r\n BouncingBehavior.EasingFunction.setEasingMode(BouncingBehavior.EasingMode);\r\n this._radiusBounceTransition = Animation.CreateAnimation(\"radius\", Animation.ANIMATIONTYPE_FLOAT, 60, BouncingBehavior.EasingFunction);\r\n }\r\n // Prevent zoom until bounce has completed\r\n this._cachedWheelPrecision = this._attachedCamera.wheelPrecision;\r\n this._attachedCamera.wheelPrecision = Infinity;\r\n this._attachedCamera.inertialRadiusOffset = 0;\r\n // Animate to the radius limit\r\n this.stopAllAnimations();\r\n this._radiusIsAnimating = true;\r\n var animatable = Animation.TransitionTo(\"radius\", this._attachedCamera.radius + radiusDelta, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusBounceTransition, this.transitionDuration, function () { return _this._clearAnimationLocks(); });\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n };\r\n /**\r\n * Removes all animation locks. Allows new animations to be added to any of the camera properties.\r\n */\r\n BouncingBehavior.prototype._clearAnimationLocks = function () {\r\n this._radiusIsAnimating = false;\r\n if (this._attachedCamera) {\r\n this._attachedCamera.wheelPrecision = this._cachedWheelPrecision;\r\n }\r\n };\r\n /**\r\n * Stops and removes all animations that have been applied to the camera\r\n */\r\n BouncingBehavior.prototype.stopAllAnimations = function () {\r\n if (this._attachedCamera) {\r\n this._attachedCamera.animations = [];\r\n }\r\n while (this._animatables.length) {\r\n this._animatables[0].onAnimationEnd = null;\r\n this._animatables[0].stop();\r\n this._animatables.shift();\r\n }\r\n };\r\n /**\r\n * The easing function used by animations\r\n */\r\n BouncingBehavior.EasingFunction = new BackEase(0.3);\r\n /**\r\n * The easing mode used by animations\r\n */\r\n BouncingBehavior.EasingMode = EasingFunction.EASINGMODE_EASEOUT;\r\n return BouncingBehavior;\r\n}());\r\nexport { BouncingBehavior };\r\n//# sourceMappingURL=bouncingBehavior.js.map","import { ExponentialEase, EasingFunction } from \"../../Animations/easing\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\nimport { Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Animation } from \"../../Animations/animation\";\r\n/**\r\n * The framing behavior (FramingBehavior) is designed to automatically position an ArcRotateCamera when its target is set to a mesh. It is also useful if you want to prevent the camera to go under a virtual horizontal plane.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior\r\n */\r\nvar FramingBehavior = /** @class */ (function () {\r\n function FramingBehavior() {\r\n this._mode = FramingBehavior.FitFrustumSidesMode;\r\n this._radiusScale = 1.0;\r\n this._positionScale = 0.5;\r\n this._defaultElevation = 0.3;\r\n this._elevationReturnTime = 1500;\r\n this._elevationReturnWaitTime = 1000;\r\n this._zoomStopsAnimation = false;\r\n this._framingTime = 1500;\r\n /**\r\n * Define if the behavior should automatically change the configured\r\n * camera limits and sensibilities.\r\n */\r\n this.autoCorrectCameraLimitsAndSensibility = true;\r\n this._isPointerDown = false;\r\n this._lastInteractionTime = -Infinity;\r\n // Framing control\r\n this._animatables = new Array();\r\n this._betaIsAnimating = false;\r\n }\r\n Object.defineProperty(FramingBehavior.prototype, \"name\", {\r\n /**\r\n * Gets the name of the behavior.\r\n */\r\n get: function () {\r\n return \"Framing\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"mode\", {\r\n /**\r\n * Gets current mode used by the behavior.\r\n */\r\n get: function () {\r\n return this._mode;\r\n },\r\n /**\r\n * Sets the current mode used by the behavior\r\n */\r\n set: function (mode) {\r\n this._mode = mode;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"radiusScale\", {\r\n /**\r\n * Gets the scale applied to the radius\r\n */\r\n get: function () {\r\n return this._radiusScale;\r\n },\r\n /**\r\n * Sets the scale applied to the radius (1 by default)\r\n */\r\n set: function (radius) {\r\n this._radiusScale = radius;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"positionScale\", {\r\n /**\r\n * Gets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.\r\n */\r\n get: function () {\r\n return this._positionScale;\r\n },\r\n /**\r\n * Sets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.\r\n */\r\n set: function (scale) {\r\n this._positionScale = scale;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"defaultElevation\", {\r\n /**\r\n * Gets the angle above/below the horizontal plane to return to when the return to default elevation idle\r\n * behaviour is triggered, in radians.\r\n */\r\n get: function () {\r\n return this._defaultElevation;\r\n },\r\n /**\r\n * Sets the angle above/below the horizontal plane to return to when the return to default elevation idle\r\n * behaviour is triggered, in radians.\r\n */\r\n set: function (elevation) {\r\n this._defaultElevation = elevation;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"elevationReturnTime\", {\r\n /**\r\n * Gets the time (in milliseconds) taken to return to the default beta position.\r\n * Negative value indicates camera should not return to default.\r\n */\r\n get: function () {\r\n return this._elevationReturnTime;\r\n },\r\n /**\r\n * Sets the time (in milliseconds) taken to return to the default beta position.\r\n * Negative value indicates camera should not return to default.\r\n */\r\n set: function (speed) {\r\n this._elevationReturnTime = speed;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"elevationReturnWaitTime\", {\r\n /**\r\n * Gets the delay (in milliseconds) taken before the camera returns to the default beta position.\r\n */\r\n get: function () {\r\n return this._elevationReturnWaitTime;\r\n },\r\n /**\r\n * Sets the delay (in milliseconds) taken before the camera returns to the default beta position.\r\n */\r\n set: function (time) {\r\n this._elevationReturnWaitTime = time;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"zoomStopsAnimation\", {\r\n /**\r\n * Gets the flag that indicates if user zooming should stop animation.\r\n */\r\n get: function () {\r\n return this._zoomStopsAnimation;\r\n },\r\n /**\r\n * Sets the flag that indicates if user zooming should stop animation.\r\n */\r\n set: function (flag) {\r\n this._zoomStopsAnimation = flag;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FramingBehavior.prototype, \"framingTime\", {\r\n /**\r\n * Gets the transition time when framing the mesh, in milliseconds\r\n */\r\n get: function () {\r\n return this._framingTime;\r\n },\r\n /**\r\n * Sets the transition time when framing the mesh, in milliseconds\r\n */\r\n set: function (time) {\r\n this._framingTime = time;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Initializes the behavior.\r\n */\r\n FramingBehavior.prototype.init = function () {\r\n // Do notihng\r\n };\r\n /**\r\n * Attaches the behavior to its arc rotate camera.\r\n * @param camera Defines the camera to attach the behavior to\r\n */\r\n FramingBehavior.prototype.attach = function (camera) {\r\n var _this = this;\r\n this._attachedCamera = camera;\r\n var scene = this._attachedCamera.getScene();\r\n FramingBehavior.EasingFunction.setEasingMode(FramingBehavior.EasingMode);\r\n this._onPrePointerObservableObserver = scene.onPrePointerObservable.add(function (pointerInfoPre) {\r\n if (pointerInfoPre.type === PointerEventTypes.POINTERDOWN) {\r\n _this._isPointerDown = true;\r\n return;\r\n }\r\n if (pointerInfoPre.type === PointerEventTypes.POINTERUP) {\r\n _this._isPointerDown = false;\r\n }\r\n });\r\n this._onMeshTargetChangedObserver = camera.onMeshTargetChangedObservable.add(function (mesh) {\r\n if (mesh) {\r\n _this.zoomOnMesh(mesh);\r\n }\r\n });\r\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(function () {\r\n // Stop the animation if there is user interaction and the animation should stop for this interaction\r\n _this._applyUserInteraction();\r\n // Maintain the camera above the ground. If the user pulls the camera beneath the ground plane, lift it\r\n // back to the default position after a given timeout\r\n _this._maintainCameraAboveGround();\r\n });\r\n };\r\n /**\r\n * Detaches the behavior from its current arc rotate camera.\r\n */\r\n FramingBehavior.prototype.detach = function () {\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n var scene = this._attachedCamera.getScene();\r\n if (this._onPrePointerObservableObserver) {\r\n scene.onPrePointerObservable.remove(this._onPrePointerObservableObserver);\r\n }\r\n if (this._onAfterCheckInputsObserver) {\r\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\r\n }\r\n if (this._onMeshTargetChangedObserver) {\r\n this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\r\n }\r\n this._attachedCamera = null;\r\n };\r\n /**\r\n * Targets the given mesh and updates zoom level accordingly.\r\n * @param mesh The mesh to target.\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnMesh = function (mesh, focusOnOriginXZ, onAnimationEnd) {\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n mesh.computeWorldMatrix(true);\r\n var boundingBox = mesh.getBoundingInfo().boundingBox;\r\n this.zoomOnBoundingInfo(boundingBox.minimumWorld, boundingBox.maximumWorld, focusOnOriginXZ, onAnimationEnd);\r\n };\r\n /**\r\n * Targets the given mesh with its children and updates zoom level accordingly.\r\n * @param mesh The mesh to target.\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnMeshHierarchy = function (mesh, focusOnOriginXZ, onAnimationEnd) {\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n mesh.computeWorldMatrix(true);\r\n var boundingBox = mesh.getHierarchyBoundingVectors(true);\r\n this.zoomOnBoundingInfo(boundingBox.min, boundingBox.max, focusOnOriginXZ, onAnimationEnd);\r\n };\r\n /**\r\n * Targets the given meshes with their children and updates zoom level accordingly.\r\n * @param meshes The mesh to target.\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnMeshesHierarchy = function (meshes, focusOnOriginXZ, onAnimationEnd) {\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n var min = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var max = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n for (var i = 0; i < meshes.length; i++) {\r\n var boundingInfo = meshes[i].getHierarchyBoundingVectors(true);\r\n Vector3.CheckExtends(boundingInfo.min, min, max);\r\n Vector3.CheckExtends(boundingInfo.max, min, max);\r\n }\r\n this.zoomOnBoundingInfo(min, max, focusOnOriginXZ, onAnimationEnd);\r\n };\r\n /**\r\n * Targets the bounding box info defined by its extends and updates zoom level accordingly.\r\n * @param minimumWorld Determines the smaller position of the bounding box extend\r\n * @param maximumWorld Determines the bigger position of the bounding box extend\r\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\r\n * @param onAnimationEnd Callback triggered at the end of the framing animation\r\n */\r\n FramingBehavior.prototype.zoomOnBoundingInfo = function (minimumWorld, maximumWorld, focusOnOriginXZ, onAnimationEnd) {\r\n var _this = this;\r\n if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }\r\n if (onAnimationEnd === void 0) { onAnimationEnd = null; }\r\n var zoomTarget;\r\n if (!this._attachedCamera) {\r\n return;\r\n }\r\n // Find target by interpolating from bottom of bounding box in world-space to top via framingPositionY\r\n var bottom = minimumWorld.y;\r\n var top = maximumWorld.y;\r\n var zoomTargetY = bottom + (top - bottom) * this._positionScale;\r\n var radiusWorld = maximumWorld.subtract(minimumWorld).scale(0.5);\r\n if (focusOnOriginXZ) {\r\n zoomTarget = new Vector3(0, zoomTargetY, 0);\r\n }\r\n else {\r\n var centerWorld = minimumWorld.add(radiusWorld);\r\n zoomTarget = new Vector3(centerWorld.x, zoomTargetY, centerWorld.z);\r\n }\r\n if (!this._vectorTransition) {\r\n this._vectorTransition = Animation.CreateAnimation(\"target\", Animation.ANIMATIONTYPE_VECTOR3, 60, FramingBehavior.EasingFunction);\r\n }\r\n this._betaIsAnimating = true;\r\n var animatable = Animation.TransitionTo(\"target\", zoomTarget, this._attachedCamera, this._attachedCamera.getScene(), 60, this._vectorTransition, this._framingTime);\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n // sets the radius and lower radius bounds\r\n // Small delta ensures camera is not always at lower zoom limit.\r\n var radius = 0;\r\n if (this._mode === FramingBehavior.FitFrustumSidesMode) {\r\n var position = this._calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld);\r\n if (this.autoCorrectCameraLimitsAndSensibility) {\r\n this._attachedCamera.lowerRadiusLimit = radiusWorld.length() + this._attachedCamera.minZ;\r\n }\r\n radius = position;\r\n }\r\n else if (this._mode === FramingBehavior.IgnoreBoundsSizeMode) {\r\n radius = this._calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld);\r\n if (this.autoCorrectCameraLimitsAndSensibility && this._attachedCamera.lowerRadiusLimit === null) {\r\n this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ;\r\n }\r\n }\r\n // Set sensibilities\r\n if (this.autoCorrectCameraLimitsAndSensibility) {\r\n var extend = maximumWorld.subtract(minimumWorld).length();\r\n this._attachedCamera.panningSensibility = 5000 / extend;\r\n this._attachedCamera.wheelPrecision = 100 / radius;\r\n }\r\n // transition to new radius\r\n if (!this._radiusTransition) {\r\n this._radiusTransition = Animation.CreateAnimation(\"radius\", Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);\r\n }\r\n animatable = Animation.TransitionTo(\"radius\", radius, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, function () {\r\n _this.stopAllAnimations();\r\n if (onAnimationEnd) {\r\n onAnimationEnd();\r\n }\r\n if (_this._attachedCamera && _this._attachedCamera.useInputToRestoreState) {\r\n _this._attachedCamera.storeState();\r\n }\r\n });\r\n if (animatable) {\r\n this._animatables.push(animatable);\r\n }\r\n };\r\n /**\r\n * Calculates the lowest radius for the camera based on the bounding box of the mesh.\r\n * @param mesh The mesh on which to base the calculation. mesh boundingInfo used to estimate necessary\r\n *\t\t\t frustum width.\r\n * @return The minimum distance from the primary mesh's center point at which the camera must be kept in order\r\n *\t\t to fully enclose the mesh in the viewing frustum.\r\n */\r\n FramingBehavior.prototype._calculateLowerRadiusFromModelBoundingSphere = function (minimumWorld, maximumWorld) {\r\n var size = maximumWorld.subtract(minimumWorld);\r\n var boxVectorGlobalDiagonal = size.length();\r\n var frustumSlope = this._getFrustumSlope();\r\n // Formula for setting distance\r\n // (Good explanation: http://stackoverflow.com/questions/2866350/move-camera-to-fit-3d-scene)\r\n var radiusWithoutFraming = boxVectorGlobalDiagonal * 0.5;\r\n // Horizon distance\r\n var radius = radiusWithoutFraming * this._radiusScale;\r\n var distanceForHorizontalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlope.x * frustumSlope.x));\r\n var distanceForVerticalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlope.y * frustumSlope.y));\r\n var distance = Math.max(distanceForHorizontalFrustum, distanceForVerticalFrustum);\r\n var camera = this._attachedCamera;\r\n if (!camera) {\r\n return 0;\r\n }\r\n if (camera.lowerRadiusLimit && this._mode === FramingBehavior.IgnoreBoundsSizeMode) {\r\n // Don't exceed the requested limit\r\n distance = distance < camera.lowerRadiusLimit ? camera.lowerRadiusLimit : distance;\r\n }\r\n // Don't exceed the upper radius limit\r\n if (camera.upperRadiusLimit) {\r\n distance = distance > camera.upperRadiusLimit ? camera.upperRadiusLimit : distance;\r\n }\r\n return distance;\r\n };\r\n /**\r\n * Keeps the camera above the ground plane. If the user pulls the camera below the ground plane, the camera\r\n * is automatically returned to its default position (expected to be above ground plane).\r\n */\r\n FramingBehavior.prototype._maintainCameraAboveGround = function () {\r\n var _this = this;\r\n if (this._elevationReturnTime < 0) {\r\n return;\r\n }\r\n var timeSinceInteraction = PrecisionDate.Now - this._lastInteractionTime;\r\n var defaultBeta = Math.PI * 0.5 - this._defaultElevation;\r\n var limitBeta = Math.PI * 0.5;\r\n // Bring the camera back up if below the ground plane\r\n if (this._attachedCamera && !this._betaIsAnimating && this._attachedCamera.beta > limitBeta && timeSinceInteraction >= this._elevationReturnWaitTime) {\r\n this._betaIsAnimating = true;\r\n //Transition to new position\r\n this.stopAllAnimations();\r\n if (!this._betaTransition) {\r\n this._betaTransition = Animation.CreateAnimation(\"beta\", Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);\r\n }\r\n var animatabe = Animation.TransitionTo(\"beta\", defaultBeta, this._attachedCamera, this._attachedCamera.getScene(), 60, this._betaTransition, this._elevationReturnTime, function () {\r\n _this._clearAnimationLocks();\r\n _this.stopAllAnimations();\r\n });\r\n if (animatabe) {\r\n this._animatables.push(animatabe);\r\n }\r\n }\r\n };\r\n /**\r\n * Returns the frustum slope based on the canvas ratio and camera FOV\r\n * @returns The frustum slope represented as a Vector2 with X and Y slopes\r\n */\r\n FramingBehavior.prototype._getFrustumSlope = function () {\r\n // Calculate the viewport ratio\r\n // Aspect Ratio is Height/Width.\r\n var camera = this._attachedCamera;\r\n if (!camera) {\r\n return Vector2.Zero();\r\n }\r\n var engine = camera.getScene().getEngine();\r\n var aspectRatio = engine.getAspectRatio(camera);\r\n // Camera FOV is the vertical field of view (top-bottom) in radians.\r\n // Slope of the frustum top/bottom planes in view space, relative to the forward vector.\r\n var frustumSlopeY = Math.tan(camera.fov / 2);\r\n // Slope of the frustum left/right planes in view space, relative to the forward vector.\r\n // Provides the amount that one side (e.g. left) of the frustum gets wider for every unit\r\n // along the forward vector.\r\n var frustumSlopeX = frustumSlopeY * aspectRatio;\r\n return new Vector2(frustumSlopeX, frustumSlopeY);\r\n };\r\n /**\r\n * Removes all animation locks. Allows new animations to be added to any of the arcCamera properties.\r\n */\r\n FramingBehavior.prototype._clearAnimationLocks = function () {\r\n this._betaIsAnimating = false;\r\n };\r\n /**\r\n * Applies any current user interaction to the camera. Takes into account maximum alpha rotation.\r\n */\r\n FramingBehavior.prototype._applyUserInteraction = function () {\r\n if (this.isUserIsMoving) {\r\n this._lastInteractionTime = PrecisionDate.Now;\r\n this.stopAllAnimations();\r\n this._clearAnimationLocks();\r\n }\r\n };\r\n /**\r\n * Stops and removes all animations that have been applied to the camera\r\n */\r\n FramingBehavior.prototype.stopAllAnimations = function () {\r\n if (this._attachedCamera) {\r\n this._attachedCamera.animations = [];\r\n }\r\n while (this._animatables.length) {\r\n if (this._animatables[0]) {\r\n this._animatables[0].onAnimationEnd = null;\r\n this._animatables[0].stop();\r\n }\r\n this._animatables.shift();\r\n }\r\n };\r\n Object.defineProperty(FramingBehavior.prototype, \"isUserIsMoving\", {\r\n /**\r\n * Gets a value indicating if the user is moving the camera\r\n */\r\n get: function () {\r\n if (!this._attachedCamera) {\r\n return false;\r\n }\r\n return this._attachedCamera.inertialAlphaOffset !== 0 ||\r\n this._attachedCamera.inertialBetaOffset !== 0 ||\r\n this._attachedCamera.inertialRadiusOffset !== 0 ||\r\n this._attachedCamera.inertialPanningX !== 0 ||\r\n this._attachedCamera.inertialPanningY !== 0 ||\r\n this._isPointerDown;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * The easing function used by animations\r\n */\r\n FramingBehavior.EasingFunction = new ExponentialEase();\r\n /**\r\n * The easing mode used by animations\r\n */\r\n FramingBehavior.EasingMode = EasingFunction.EASINGMODE_EASEINOUT;\r\n // Statics\r\n /**\r\n * The camera can move all the way towards the mesh.\r\n */\r\n FramingBehavior.IgnoreBoundsSizeMode = 0;\r\n /**\r\n * The camera is not allowed to zoom closer to the mesh than the point at which the adjusted bounding sphere touches the frustum sides\r\n */\r\n FramingBehavior.FitFrustumSidesMode = 1;\r\n return FramingBehavior;\r\n}());\r\nexport { FramingBehavior };\r\n//# sourceMappingURL=framingBehavior.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport { BaseCameraPointersInput } from \"../../Cameras/Inputs/BaseCameraPointersInput\";\r\n/**\r\n * Manage the pointers inputs to control an arc rotate camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraPointersInput = /** @class */ (function (_super) {\r\n __extends(ArcRotateCameraPointersInput, _super);\r\n function ArcRotateCameraPointersInput() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * Defines the buttons associated with the input to handle camera move.\r\n */\r\n _this.buttons = [0, 1, 2];\r\n /**\r\n * Defines the pointer angular sensibility along the X axis or how fast is\r\n * the camera rotating.\r\n */\r\n _this.angularSensibilityX = 1000.0;\r\n /**\r\n * Defines the pointer angular sensibility along the Y axis or how fast is\r\n * the camera rotating.\r\n */\r\n _this.angularSensibilityY = 1000.0;\r\n /**\r\n * Defines the pointer pinch precision or how fast is the camera zooming.\r\n */\r\n _this.pinchPrecision = 12.0;\r\n /**\r\n * pinchDeltaPercentage will be used instead of pinchPrecision if different\r\n * from 0.\r\n * It defines the percentage of current camera.radius to use as delta when\r\n * pinch zoom is used.\r\n */\r\n _this.pinchDeltaPercentage = 0;\r\n /**\r\n * When useNaturalPinchZoom is true, multi touch zoom will zoom in such\r\n * that any object in the plane at the camera's target point will scale\r\n * perfectly with finger motion.\r\n * Overrides pinchDeltaPercentage and pinchPrecision.\r\n */\r\n _this.useNaturalPinchZoom = false;\r\n /**\r\n * Defines the pointer panning sensibility or how fast is the camera moving.\r\n */\r\n _this.panningSensibility = 1000.0;\r\n /**\r\n * Defines whether panning (2 fingers swipe) is enabled through multitouch.\r\n */\r\n _this.multiTouchPanning = true;\r\n /**\r\n * Defines whether panning is enabled for both pan (2 fingers swipe) and\r\n * zoom (pinch) through multitouch.\r\n */\r\n _this.multiTouchPanAndZoom = true;\r\n /**\r\n * Revers pinch action direction.\r\n */\r\n _this.pinchInwards = true;\r\n _this._isPanClick = false;\r\n _this._twoFingerActivityCount = 0;\r\n _this._isPinching = false;\r\n return _this;\r\n }\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraPointersInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraPointersInput\";\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if only a single touch is active.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onTouch = function (point, offsetX, offsetY) {\r\n if (this.panningSensibility !== 0 &&\r\n ((this._ctrlKey && this.camera._useCtrlForPanning) || this._isPanClick)) {\r\n this.camera.inertialPanningX += -offsetX / this.panningSensibility;\r\n this.camera.inertialPanningY += offsetY / this.panningSensibility;\r\n }\r\n else {\r\n this.camera.inertialAlphaOffset -= offsetX / this.angularSensibilityX;\r\n this.camera.inertialBetaOffset -= offsetY / this.angularSensibilityY;\r\n }\r\n };\r\n /**\r\n * Called on pointer POINTERDOUBLETAP event.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onDoubleTap = function (type) {\r\n if (this.camera.useInputToRestoreState) {\r\n this.camera.restoreState();\r\n }\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if multiple touches are active.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onMultiTouch = function (pointA, pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition) {\r\n if (previousPinchSquaredDistance === 0 && previousMultiTouchPanPosition === null) {\r\n // First time this method is called for new pinch.\r\n // Next time this is called there will be a\r\n // previousPinchSquaredDistance and pinchSquaredDistance to compare.\r\n return;\r\n }\r\n if (pinchSquaredDistance === 0 && multiTouchPanPosition === null) {\r\n // Last time this method is called at the end of a pinch.\r\n return;\r\n }\r\n var direction = this.pinchInwards ? 1 : -1;\r\n if (this.multiTouchPanAndZoom) {\r\n if (this.useNaturalPinchZoom) {\r\n this.camera.radius = this.camera.radius *\r\n Math.sqrt(previousPinchSquaredDistance) / Math.sqrt(pinchSquaredDistance);\r\n }\r\n else if (this.pinchDeltaPercentage) {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) * 0.001 *\r\n this.camera.radius * this.pinchDeltaPercentage;\r\n }\r\n else {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) /\r\n (this.pinchPrecision * direction *\r\n (this.angularSensibilityX + this.angularSensibilityY) / 2);\r\n }\r\n if (this.panningSensibility !== 0 &&\r\n previousMultiTouchPanPosition && multiTouchPanPosition) {\r\n var moveDeltaX = multiTouchPanPosition.x - previousMultiTouchPanPosition.x;\r\n var moveDeltaY = multiTouchPanPosition.y - previousMultiTouchPanPosition.y;\r\n this.camera.inertialPanningX += -moveDeltaX / this.panningSensibility;\r\n this.camera.inertialPanningY += moveDeltaY / this.panningSensibility;\r\n }\r\n }\r\n else {\r\n this._twoFingerActivityCount++;\r\n var previousPinchDistance = Math.sqrt(previousPinchSquaredDistance);\r\n var pinchDistance = Math.sqrt(pinchSquaredDistance);\r\n if (this._isPinching ||\r\n (this._twoFingerActivityCount < 20 &&\r\n Math.abs(pinchDistance - previousPinchDistance) >\r\n this.camera.pinchToPanMaxDistance)) {\r\n // Since pinch has not been active long, assume we intend to zoom.\r\n if (this.pinchDeltaPercentage) {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) * 0.001 *\r\n this.camera.radius * this.pinchDeltaPercentage;\r\n }\r\n else {\r\n this.camera.inertialRadiusOffset +=\r\n (pinchSquaredDistance - previousPinchSquaredDistance) /\r\n (this.pinchPrecision * direction *\r\n (this.angularSensibilityX + this.angularSensibilityY) / 2);\r\n }\r\n // Since we are pinching, remain pinching on next iteration.\r\n this._isPinching = true;\r\n }\r\n else {\r\n // Pause between pinch starting and moving implies not a zoom event.\r\n // Pan instead.\r\n if (this.panningSensibility !== 0 && this.multiTouchPanning &&\r\n multiTouchPanPosition && previousMultiTouchPanPosition) {\r\n var moveDeltaX = multiTouchPanPosition.x - previousMultiTouchPanPosition.x;\r\n var moveDeltaY = multiTouchPanPosition.y - previousMultiTouchPanPosition.y;\r\n this.camera.inertialPanningX += -moveDeltaX / this.panningSensibility;\r\n this.camera.inertialPanningY += moveDeltaY / this.panningSensibility;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Called each time a new POINTERDOWN event occurs. Ie, for each button\r\n * press.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onButtonDown = function (evt) {\r\n this._isPanClick = evt.button === this.camera._panningMouseButton;\r\n };\r\n /**\r\n * Called each time a new POINTERUP event occurs. Ie, for each button\r\n * release.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onButtonUp = function (evt) {\r\n this._twoFingerActivityCount = 0;\r\n this._isPinching = false;\r\n };\r\n /**\r\n * Called when window becomes inactive.\r\n */\r\n ArcRotateCameraPointersInput.prototype.onLostFocus = function () {\r\n this._isPanClick = false;\r\n this._twoFingerActivityCount = 0;\r\n this._isPinching = false;\r\n };\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"buttons\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"angularSensibilityX\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"angularSensibilityY\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"pinchPrecision\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"pinchDeltaPercentage\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"useNaturalPinchZoom\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"panningSensibility\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"multiTouchPanning\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraPointersInput.prototype, \"multiTouchPanAndZoom\", void 0);\r\n return ArcRotateCameraPointersInput;\r\n}(BaseCameraPointersInput));\r\nexport { ArcRotateCameraPointersInput };\r\nCameraInputTypes[\"ArcRotateCameraPointersInput\"] =\r\n ArcRotateCameraPointersInput;\r\n//# sourceMappingURL=arcRotateCameraPointersInput.js.map","import { __decorate } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\n/**\r\n * Base class for Camera Pointer Inputs.\r\n * See FollowCameraPointersInput in src/Cameras/Inputs/followCameraPointersInput.ts\r\n * for example usage.\r\n */\r\nvar BaseCameraPointersInput = /** @class */ (function () {\r\n function BaseCameraPointersInput() {\r\n /**\r\n * Defines the buttons associated with the input to handle camera move.\r\n */\r\n this.buttons = [0, 1, 2];\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param element Defines the element the controls should be listened from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n BaseCameraPointersInput.prototype.attachControl = function (noPreventDefault) {\r\n var _this = this;\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n var engine = this.camera.getEngine();\r\n var element = engine.getInputElement();\r\n var previousPinchSquaredDistance = 0;\r\n var previousMultiTouchPanPosition = null;\r\n this.pointA = null;\r\n this.pointB = null;\r\n this._altKey = false;\r\n this._ctrlKey = false;\r\n this._metaKey = false;\r\n this._shiftKey = false;\r\n this._buttonsPressed = 0;\r\n this._pointerInput = function (p, s) {\r\n var evt = p.event;\r\n var isTouch = evt.pointerType === \"touch\";\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n if (p.type !== PointerEventTypes.POINTERMOVE &&\r\n _this.buttons.indexOf(evt.button) === -1) {\r\n return;\r\n }\r\n var srcElement = (evt.srcElement || evt.target);\r\n _this._altKey = evt.altKey;\r\n _this._ctrlKey = evt.ctrlKey;\r\n _this._metaKey = evt.metaKey;\r\n _this._shiftKey = evt.shiftKey;\r\n _this._buttonsPressed = evt.buttons;\r\n if (engine.isPointerLock) {\r\n var offsetX = evt.movementX ||\r\n evt.mozMovementX ||\r\n evt.webkitMovementX ||\r\n evt.msMovementX ||\r\n 0;\r\n var offsetY = evt.movementY ||\r\n evt.mozMovementY ||\r\n evt.webkitMovementY ||\r\n evt.msMovementY ||\r\n 0;\r\n _this.onTouch(null, offsetX, offsetY);\r\n _this.pointA = null;\r\n _this.pointB = null;\r\n }\r\n else if (p.type === PointerEventTypes.POINTERDOWN && srcElement) {\r\n try {\r\n srcElement.setPointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error. Execution will continue.\r\n }\r\n if (_this.pointA === null) {\r\n _this.pointA = { x: evt.clientX,\r\n y: evt.clientY,\r\n pointerId: evt.pointerId,\r\n type: evt.pointerType };\r\n }\r\n else if (_this.pointB === null) {\r\n _this.pointB = { x: evt.clientX,\r\n y: evt.clientY,\r\n pointerId: evt.pointerId,\r\n type: evt.pointerType };\r\n }\r\n _this.onButtonDown(evt);\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n element && element.focus();\r\n }\r\n }\r\n else if (p.type === PointerEventTypes.POINTERDOUBLETAP) {\r\n _this.onDoubleTap(evt.pointerType);\r\n }\r\n else if (p.type === PointerEventTypes.POINTERUP && srcElement) {\r\n try {\r\n srcElement.releasePointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error.\r\n }\r\n if (!isTouch) {\r\n _this.pointB = null; // Mouse and pen are mono pointer\r\n }\r\n //would be better to use pointers.remove(evt.pointerId) for multitouch gestures,\r\n //but emptying completely pointers collection is required to fix a bug on iPhone :\r\n //when changing orientation while pinching camera,\r\n //one pointer stay pressed forever if we don't release all pointers\r\n //will be ok to put back pointers.remove(evt.pointerId); when iPhone bug corrected\r\n if (engine._badOS) {\r\n _this.pointA = _this.pointB = null;\r\n }\r\n else {\r\n //only remove the impacted pointer in case of multitouch allowing on most\r\n //platforms switching from rotate to zoom and pan seamlessly.\r\n if (_this.pointB && _this.pointA && _this.pointA.pointerId == evt.pointerId) {\r\n _this.pointA = _this.pointB;\r\n _this.pointB = null;\r\n }\r\n else if (_this.pointA && _this.pointB &&\r\n _this.pointB.pointerId == evt.pointerId) {\r\n _this.pointB = null;\r\n }\r\n else {\r\n _this.pointA = _this.pointB = null;\r\n }\r\n }\r\n if (previousPinchSquaredDistance !== 0 || previousMultiTouchPanPosition) {\r\n // Previous pinch data is populated but a button has been lifted\r\n // so pinch has ended.\r\n _this.onMultiTouch(_this.pointA, _this.pointB, previousPinchSquaredDistance, 0, // pinchSquaredDistance\r\n previousMultiTouchPanPosition, null // multiTouchPanPosition\r\n );\r\n previousPinchSquaredDistance = 0;\r\n previousMultiTouchPanPosition = null;\r\n }\r\n _this.onButtonUp(evt);\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n else if (p.type === PointerEventTypes.POINTERMOVE) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n // One button down\r\n if (_this.pointA && _this.pointB === null) {\r\n var offsetX = evt.clientX - _this.pointA.x;\r\n var offsetY = evt.clientY - _this.pointA.y;\r\n _this.onTouch(_this.pointA, offsetX, offsetY);\r\n _this.pointA.x = evt.clientX;\r\n _this.pointA.y = evt.clientY;\r\n }\r\n // Two buttons down: pinch\r\n else if (_this.pointA && _this.pointB) {\r\n var ed = (_this.pointA.pointerId === evt.pointerId) ?\r\n _this.pointA : _this.pointB;\r\n ed.x = evt.clientX;\r\n ed.y = evt.clientY;\r\n var distX = _this.pointA.x - _this.pointB.x;\r\n var distY = _this.pointA.y - _this.pointB.y;\r\n var pinchSquaredDistance = (distX * distX) + (distY * distY);\r\n var multiTouchPanPosition = { x: (_this.pointA.x + _this.pointB.x) / 2,\r\n y: (_this.pointA.y + _this.pointB.y) / 2,\r\n pointerId: evt.pointerId,\r\n type: p.type };\r\n _this.onMultiTouch(_this.pointA, _this.pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition);\r\n previousMultiTouchPanPosition = multiTouchPanPosition;\r\n previousPinchSquaredDistance = pinchSquaredDistance;\r\n }\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP |\r\n PointerEventTypes.POINTERMOVE);\r\n this._onLostFocus = function () {\r\n _this.pointA = _this.pointB = null;\r\n previousPinchSquaredDistance = 0;\r\n previousMultiTouchPanPosition = null;\r\n _this.onLostFocus();\r\n };\r\n element && element.addEventListener(\"contextmenu\", this.onContextMenu.bind(this), false);\r\n var hostWindow = this.camera.getScene().getEngine().getHostWindow();\r\n if (hostWindow) {\r\n Tools.RegisterTopRootEvents(hostWindow, [\r\n { name: \"blur\", handler: this._onLostFocus }\r\n ]);\r\n }\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n BaseCameraPointersInput.prototype.detachControl = function (ignored) {\r\n if (this._onLostFocus) {\r\n var hostWindow = this.camera.getScene().getEngine().getHostWindow();\r\n if (hostWindow) {\r\n Tools.UnregisterTopRootEvents(hostWindow, [\r\n { name: \"blur\", handler: this._onLostFocus }\r\n ]);\r\n }\r\n }\r\n if (this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n if (this.onContextMenu) {\r\n var inputElement = this.camera.getScene().getEngine().getInputElement();\r\n inputElement && inputElement.removeEventListener(\"contextmenu\", this.onContextMenu);\r\n }\r\n this._onLostFocus = null;\r\n }\r\n this._altKey = false;\r\n this._ctrlKey = false;\r\n this._metaKey = false;\r\n this._shiftKey = false;\r\n this._buttonsPressed = 0;\r\n };\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n BaseCameraPointersInput.prototype.getClassName = function () {\r\n return \"BaseCameraPointersInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n BaseCameraPointersInput.prototype.getSimpleName = function () {\r\n return \"pointers\";\r\n };\r\n /**\r\n * Called on pointer POINTERDOUBLETAP event.\r\n * Override this method to provide functionality on POINTERDOUBLETAP event.\r\n */\r\n BaseCameraPointersInput.prototype.onDoubleTap = function (type) {\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if only a single touch is active.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onTouch = function (point, offsetX, offsetY) {\r\n };\r\n /**\r\n * Called on pointer POINTERMOVE event if multiple touches are active.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onMultiTouch = function (pointA, pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition) {\r\n };\r\n /**\r\n * Called on JS contextmenu event.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onContextMenu = function (evt) {\r\n evt.preventDefault();\r\n };\r\n /**\r\n * Called each time a new POINTERDOWN event occurs. Ie, for each button\r\n * press.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onButtonDown = function (evt) {\r\n };\r\n /**\r\n * Called each time a new POINTERUP event occurs. Ie, for each button\r\n * release.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onButtonUp = function (evt) {\r\n };\r\n /**\r\n * Called when window becomes inactive.\r\n * Override this method to provide functionality.\r\n */\r\n BaseCameraPointersInput.prototype.onLostFocus = function () {\r\n };\r\n __decorate([\r\n serialize()\r\n ], BaseCameraPointersInput.prototype, \"buttons\", void 0);\r\n return BaseCameraPointersInput;\r\n}());\r\nexport { BaseCameraPointersInput };\r\n//# sourceMappingURL=BaseCameraPointersInput.js.map","import { __decorate } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport { KeyboardEventTypes } from \"../../Events/keyboardEvents\";\r\nimport { Tools } from '../../Misc/tools';\r\n/**\r\n * Manage the keyboard inputs to control the movement of an arc rotate camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraKeyboardMoveInput = /** @class */ (function () {\r\n function ArcRotateCameraKeyboardMoveInput() {\r\n /**\r\n * Defines the list of key codes associated with the up action (increase alpha)\r\n */\r\n this.keysUp = [38];\r\n /**\r\n * Defines the list of key codes associated with the down action (decrease alpha)\r\n */\r\n this.keysDown = [40];\r\n /**\r\n * Defines the list of key codes associated with the left action (increase beta)\r\n */\r\n this.keysLeft = [37];\r\n /**\r\n * Defines the list of key codes associated with the right action (decrease beta)\r\n */\r\n this.keysRight = [39];\r\n /**\r\n * Defines the list of key codes associated with the reset action.\r\n * Those keys reset the camera to its last stored state (with the method camera.storeState())\r\n */\r\n this.keysReset = [220];\r\n /**\r\n * Defines the panning sensibility of the inputs.\r\n * (How fast is the camera panning)\r\n */\r\n this.panningSensibility = 50.0;\r\n /**\r\n * Defines the zooming sensibility of the inputs.\r\n * (How fast is the camera zooming)\r\n */\r\n this.zoomingSensibility = 25.0;\r\n /**\r\n * Defines whether maintaining the alt key down switch the movement mode from\r\n * orientation to zoom.\r\n */\r\n this.useAltToZoom = true;\r\n /**\r\n * Rotation speed of the camera\r\n */\r\n this.angularSpeed = 0.01;\r\n this._keys = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.attachControl = function (noPreventDefault) {\r\n var _this = this;\r\n // was there a second variable defined?\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n if (this._onCanvasBlurObserver) {\r\n return;\r\n }\r\n this._scene = this.camera.getScene();\r\n this._engine = this._scene.getEngine();\r\n this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function () {\r\n _this._keys = [];\r\n });\r\n this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function (info) {\r\n var evt = info.event;\r\n if (!evt.metaKey) {\r\n if (info.type === KeyboardEventTypes.KEYDOWN) {\r\n _this._ctrlPressed = evt.ctrlKey;\r\n _this._altPressed = evt.altKey;\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1 || _this.keysReset.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index === -1) {\r\n _this._keys.push(evt.keyCode);\r\n }\r\n if (evt.preventDefault) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1 || _this.keysReset.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index >= 0) {\r\n _this._keys.splice(index, 1);\r\n }\r\n if (evt.preventDefault) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.detachControl = function (ignored) {\r\n if (this._scene) {\r\n if (this._onKeyboardObserver) {\r\n this._scene.onKeyboardObservable.remove(this._onKeyboardObserver);\r\n }\r\n if (this._onCanvasBlurObserver) {\r\n this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n this._onKeyboardObserver = null;\r\n this._onCanvasBlurObserver = null;\r\n }\r\n this._keys = [];\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.checkInputs = function () {\r\n if (this._onKeyboardObserver) {\r\n var camera = this.camera;\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var keyCode = this._keys[index];\r\n if (this.keysLeft.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningX -= 1 / this.panningSensibility;\r\n }\r\n else {\r\n camera.inertialAlphaOffset -= this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysUp.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningY += 1 / this.panningSensibility;\r\n }\r\n else if (this._altPressed && this.useAltToZoom) {\r\n camera.inertialRadiusOffset += 1 / this.zoomingSensibility;\r\n }\r\n else {\r\n camera.inertialBetaOffset -= this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysRight.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningX += 1 / this.panningSensibility;\r\n }\r\n else {\r\n camera.inertialAlphaOffset += this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysDown.indexOf(keyCode) !== -1) {\r\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\r\n camera.inertialPanningY -= 1 / this.panningSensibility;\r\n }\r\n else if (this._altPressed && this.useAltToZoom) {\r\n camera.inertialRadiusOffset -= 1 / this.zoomingSensibility;\r\n }\r\n else {\r\n camera.inertialBetaOffset += this.angularSpeed;\r\n }\r\n }\r\n else if (this.keysReset.indexOf(keyCode) !== -1) {\r\n if (camera.useInputToRestoreState) {\r\n camera.restoreState();\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraKeyboardMoveInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n ArcRotateCameraKeyboardMoveInput.prototype.getSimpleName = function () {\r\n return \"keyboard\";\r\n };\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysUp\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysDown\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysLeft\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysRight\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"keysReset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"panningSensibility\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"zoomingSensibility\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"useAltToZoom\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraKeyboardMoveInput.prototype, \"angularSpeed\", void 0);\r\n return ArcRotateCameraKeyboardMoveInput;\r\n}());\r\nexport { ArcRotateCameraKeyboardMoveInput };\r\nCameraInputTypes[\"ArcRotateCameraKeyboardMoveInput\"] = ArcRotateCameraKeyboardMoveInput;\r\n//# sourceMappingURL=arcRotateCameraKeyboardMoveInput.js.map","import { __decorate } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Scalar } from '../../Maths/math.scalar';\r\nimport { Tools } from '../../Misc/tools';\r\n/**\r\n * Manage the mouse wheel inputs to control an arc rotate camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraMouseWheelInput = /** @class */ (function () {\r\n function ArcRotateCameraMouseWheelInput() {\r\n /**\r\n * Gets or Set the mouse wheel precision or how fast is the camera zooming.\r\n */\r\n this.wheelPrecision = 3.0;\r\n /**\r\n * wheelDeltaPercentage will be used instead of wheelPrecision if different from 0.\r\n * It defines the percentage of current camera.radius to use as delta when wheel is used.\r\n */\r\n this.wheelDeltaPercentage = 0;\r\n }\r\n ArcRotateCameraMouseWheelInput.prototype.computeDeltaFromMouseWheelLegacyEvent = function (mouseWheelDelta, radius) {\r\n var delta = 0;\r\n var wheelDelta = (mouseWheelDelta * 0.01 * this.wheelDeltaPercentage) * radius;\r\n if (mouseWheelDelta > 0) {\r\n delta = wheelDelta / (1.0 + this.wheelDeltaPercentage);\r\n }\r\n else {\r\n delta = wheelDelta * (1.0 + this.wheelDeltaPercentage);\r\n }\r\n return delta;\r\n };\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.attachControl = function (noPreventDefault) {\r\n var _this = this;\r\n // was there a second variable defined?\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n this._wheel = function (p, s) {\r\n //sanity check - this should be a PointerWheel event.\r\n if (p.type !== PointerEventTypes.POINTERWHEEL) {\r\n return;\r\n }\r\n var event = p.event;\r\n var delta = 0;\r\n var mouseWheelLegacyEvent = event;\r\n var wheelDelta = 0;\r\n if (mouseWheelLegacyEvent.wheelDelta) {\r\n wheelDelta = mouseWheelLegacyEvent.wheelDelta;\r\n }\r\n else {\r\n wheelDelta = -(event.deltaY || event.detail) * 60;\r\n }\r\n if (_this.wheelDeltaPercentage) {\r\n delta = _this.computeDeltaFromMouseWheelLegacyEvent(wheelDelta, _this.camera.radius);\r\n // If zooming in, estimate the target radius and use that to compute the delta for inertia\r\n // this will stop multiple scroll events zooming in from adding too much inertia\r\n if (delta > 0) {\r\n var estimatedTargetRadius = _this.camera.radius;\r\n var targetInertia = _this.camera.inertialRadiusOffset + delta;\r\n for (var i = 0; i < 20 && Math.abs(targetInertia) > 0.001; i++) {\r\n estimatedTargetRadius -= targetInertia;\r\n targetInertia *= _this.camera.inertia;\r\n }\r\n estimatedTargetRadius = Scalar.Clamp(estimatedTargetRadius, 0, Number.MAX_VALUE);\r\n delta = _this.computeDeltaFromMouseWheelLegacyEvent(wheelDelta, estimatedTargetRadius);\r\n }\r\n }\r\n else {\r\n delta = wheelDelta / (_this.wheelPrecision * 40);\r\n }\r\n if (delta) {\r\n _this.camera.inertialRadiusOffset += delta;\r\n }\r\n if (event.preventDefault) {\r\n if (!noPreventDefault) {\r\n event.preventDefault();\r\n }\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, PointerEventTypes.POINTERWHEEL);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.detachControl = function (ignored) {\r\n if (this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n this._wheel = null;\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.getClassName = function () {\r\n return \"ArcRotateCameraMouseWheelInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n ArcRotateCameraMouseWheelInput.prototype.getSimpleName = function () {\r\n return \"mousewheel\";\r\n };\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraMouseWheelInput.prototype, \"wheelPrecision\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCameraMouseWheelInput.prototype, \"wheelDeltaPercentage\", void 0);\r\n return ArcRotateCameraMouseWheelInput;\r\n}());\r\nexport { ArcRotateCameraMouseWheelInput };\r\nCameraInputTypes[\"ArcRotateCameraMouseWheelInput\"] = ArcRotateCameraMouseWheelInput;\r\n//# sourceMappingURL=arcRotateCameraMouseWheelInput.js.map","import { __extends } from \"tslib\";\r\nimport { ArcRotateCameraPointersInput } from \"../Cameras/Inputs/arcRotateCameraPointersInput\";\r\nimport { ArcRotateCameraKeyboardMoveInput } from \"../Cameras/Inputs/arcRotateCameraKeyboardMoveInput\";\r\nimport { ArcRotateCameraMouseWheelInput } from \"../Cameras/Inputs/arcRotateCameraMouseWheelInput\";\r\nimport { CameraInputsManager } from \"../Cameras/cameraInputsManager\";\r\n/**\r\n * Default Inputs manager for the ArcRotateCamera.\r\n * It groups all the default supported inputs for ease of use.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar ArcRotateCameraInputsManager = /** @class */ (function (_super) {\r\n __extends(ArcRotateCameraInputsManager, _super);\r\n /**\r\n * Instantiates a new ArcRotateCameraInputsManager.\r\n * @param camera Defines the camera the inputs belong to\r\n */\r\n function ArcRotateCameraInputsManager(camera) {\r\n return _super.call(this, camera) || this;\r\n }\r\n /**\r\n * Add mouse wheel input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n ArcRotateCameraInputsManager.prototype.addMouseWheel = function () {\r\n this.add(new ArcRotateCameraMouseWheelInput());\r\n return this;\r\n };\r\n /**\r\n * Add pointers input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n ArcRotateCameraInputsManager.prototype.addPointers = function () {\r\n this.add(new ArcRotateCameraPointersInput());\r\n return this;\r\n };\r\n /**\r\n * Add keyboard input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n ArcRotateCameraInputsManager.prototype.addKeyboard = function () {\r\n this.add(new ArcRotateCameraKeyboardMoveInput());\r\n return this;\r\n };\r\n return ArcRotateCameraInputsManager;\r\n}(CameraInputsManager));\r\nexport { ArcRotateCameraInputsManager };\r\n//# sourceMappingURL=arcRotateCameraInputsManager.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, serializeAsVector3 } from \"../Misc/decorators\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Matrix, Vector3, Vector2 } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { AutoRotationBehavior } from \"../Behaviors/Cameras/autoRotationBehavior\";\r\nimport { BouncingBehavior } from \"../Behaviors/Cameras/bouncingBehavior\";\r\nimport { FramingBehavior } from \"../Behaviors/Cameras/framingBehavior\";\r\nimport { Camera } from \"./camera\";\r\nimport { TargetCamera } from \"./targetCamera\";\r\nimport { ArcRotateCameraInputsManager } from \"../Cameras/arcRotateCameraInputsManager\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport { Tools } from \"../Misc/tools\";\r\nNode.AddNodeConstructor(\"ArcRotateCamera\", function (name, scene) {\r\n return function () { return new ArcRotateCamera(name, 0, 0, 1.0, Vector3.Zero(), scene); };\r\n});\r\n/**\r\n * This represents an orbital type of camera.\r\n *\r\n * This camera always points towards a given target position and can be rotated around that target with the target as the centre of rotation. It can be controlled with cursors and mouse, or with touch events.\r\n * Think of this camera as one orbiting its target position, or more imaginatively as a spy satellite orbiting the earth. Its position relative to the target (earth) can be set by three parameters, alpha (radians) the longitudinal rotation, beta (radians) the latitudinal rotation and radius the distance from the target position.\r\n * @see https://doc.babylonjs.com/babylon101/cameras#arc-rotate-camera\r\n */\r\nvar ArcRotateCamera = /** @class */ (function (_super) {\r\n __extends(ArcRotateCamera, _super);\r\n /**\r\n * Instantiates a new ArcRotateCamera in a given scene\r\n * @param name Defines the name of the camera\r\n * @param alpha Defines the camera rotation along the logitudinal axis\r\n * @param beta Defines the camera rotation along the latitudinal axis\r\n * @param radius Defines the camera distance from its target\r\n * @param target Defines the camera target\r\n * @param scene Defines the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active if not other active cameras have been defined\r\n */\r\n function ArcRotateCamera(name, alpha, beta, radius, target, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, Vector3.Zero(), scene, setActiveOnSceneIfNoneActive) || this;\r\n /**\r\n * Current inertia value on the longitudinal axis.\r\n * The bigger this number the longer it will take for the camera to stop.\r\n */\r\n _this.inertialAlphaOffset = 0;\r\n /**\r\n * Current inertia value on the latitudinal axis.\r\n * The bigger this number the longer it will take for the camera to stop.\r\n */\r\n _this.inertialBetaOffset = 0;\r\n /**\r\n * Current inertia value on the radius axis.\r\n * The bigger this number the longer it will take for the camera to stop.\r\n */\r\n _this.inertialRadiusOffset = 0;\r\n /**\r\n * Minimum allowed angle on the longitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerAlphaLimit = null;\r\n /**\r\n * Maximum allowed angle on the longitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperAlphaLimit = null;\r\n /**\r\n * Minimum allowed angle on the latitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerBetaLimit = 0.01;\r\n /**\r\n * Maximum allowed angle on the latitudinal axis.\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperBetaLimit = Math.PI - 0.01;\r\n /**\r\n * Minimum allowed distance of the camera to the target (The camera can not get closer).\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.lowerRadiusLimit = null;\r\n /**\r\n * Maximum allowed distance of the camera to the target (The camera can not get further).\r\n * This can help limiting how the Camera is able to move in the scene.\r\n */\r\n _this.upperRadiusLimit = null;\r\n /**\r\n * Defines the current inertia value used during panning of the camera along the X axis.\r\n */\r\n _this.inertialPanningX = 0;\r\n /**\r\n * Defines the current inertia value used during panning of the camera along the Y axis.\r\n */\r\n _this.inertialPanningY = 0;\r\n /**\r\n * Defines the distance used to consider the camera in pan mode vs pinch/zoom.\r\n * Basically if your fingers moves away from more than this distance you will be considered\r\n * in pinch mode.\r\n */\r\n _this.pinchToPanMaxDistance = 20;\r\n /**\r\n * Defines the maximum distance the camera can pan.\r\n * This could help keeping the cammera always in your scene.\r\n */\r\n _this.panningDistanceLimit = null;\r\n /**\r\n * Defines the target of the camera before paning.\r\n */\r\n _this.panningOriginTarget = Vector3.Zero();\r\n /**\r\n * Defines the value of the inertia used during panning.\r\n * 0 would mean stop inertia and one would mean no decelleration at all.\r\n */\r\n _this.panningInertia = 0.9;\r\n //-- end properties for backward compatibility for inputs\r\n /**\r\n * Defines how much the radius should be scaled while zomming on a particular mesh (through the zoomOn function)\r\n */\r\n _this.zoomOnFactor = 1;\r\n /**\r\n * Defines a screen offset for the camera position.\r\n */\r\n _this.targetScreenOffset = Vector2.Zero();\r\n /**\r\n * Allows the camera to be completely reversed.\r\n * If false the camera can not arrive upside down.\r\n */\r\n _this.allowUpsideDown = true;\r\n /**\r\n * Define if double tap/click is used to restore the previously saved state of the camera.\r\n */\r\n _this.useInputToRestoreState = true;\r\n /** @hidden */\r\n _this._viewMatrix = new Matrix();\r\n /**\r\n * Defines the allowed panning axis.\r\n */\r\n _this.panningAxis = new Vector3(1, 1, 0);\r\n /**\r\n * Observable triggered when the mesh target has been changed on the camera.\r\n */\r\n _this.onMeshTargetChangedObservable = new Observable();\r\n /**\r\n * Defines whether the camera should check collision with the objects oh the scene.\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#how-can-i-do-this\r\n */\r\n _this.checkCollisions = false;\r\n /**\r\n * Defines the collision radius of the camera.\r\n * This simulates a sphere around the camera.\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#arcrotatecamera\r\n */\r\n _this.collisionRadius = new Vector3(0.5, 0.5, 0.5);\r\n _this._previousPosition = Vector3.Zero();\r\n _this._collisionVelocity = Vector3.Zero();\r\n _this._newPosition = Vector3.Zero();\r\n _this._computationVector = Vector3.Zero();\r\n _this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {\r\n if (collidedMesh === void 0) { collidedMesh = null; }\r\n if (!collidedMesh) {\r\n _this._previousPosition.copyFrom(_this._position);\r\n }\r\n else {\r\n _this.setPosition(newPosition);\r\n if (_this.onCollide) {\r\n _this.onCollide(collidedMesh);\r\n }\r\n }\r\n // Recompute because of constraints\r\n var cosa = Math.cos(_this.alpha);\r\n var sina = Math.sin(_this.alpha);\r\n var cosb = Math.cos(_this.beta);\r\n var sinb = Math.sin(_this.beta);\r\n if (sinb === 0) {\r\n sinb = 0.0001;\r\n }\r\n var target = _this._getTargetPosition();\r\n _this._computationVector.copyFromFloats(_this.radius * cosa * sinb, _this.radius * cosb, _this.radius * sina * sinb);\r\n target.addToRef(_this._computationVector, _this._newPosition);\r\n _this._position.copyFrom(_this._newPosition);\r\n var up = _this.upVector;\r\n if (_this.allowUpsideDown && _this.beta < 0) {\r\n up = up.clone();\r\n up = up.negate();\r\n }\r\n _this._computeViewMatrix(_this._position, target, up);\r\n _this._viewMatrix.addAtIndex(12, _this.targetScreenOffset.x);\r\n _this._viewMatrix.addAtIndex(13, _this.targetScreenOffset.y);\r\n _this._collisionTriggered = false;\r\n };\r\n _this._target = Vector3.Zero();\r\n if (target) {\r\n _this.setTarget(target);\r\n }\r\n _this.alpha = alpha;\r\n _this.beta = beta;\r\n _this.radius = radius;\r\n _this.getViewMatrix();\r\n _this.inputs = new ArcRotateCameraInputsManager(_this);\r\n _this.inputs.addKeyboard().addMouseWheel().addPointers();\r\n return _this;\r\n }\r\n Object.defineProperty(ArcRotateCamera.prototype, \"target\", {\r\n /**\r\n * Defines the target point of the camera.\r\n * The camera looks towards it form the radius distance.\r\n * Please note that you can set the target to a mesh and thus the target will be copied from mesh.position\r\n */\r\n get: function () {\r\n return this._target;\r\n },\r\n set: function (value) {\r\n this.setTarget(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"position\", {\r\n /**\r\n * Define the current local position of the camera in the scene\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n set: function (newPosition) {\r\n this.setPosition(newPosition);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"upVector\", {\r\n get: function () {\r\n return this._upVector;\r\n },\r\n /**\r\n * The vector the camera should consider as up. (default is Vector3(0, 1, 0) as returned by Vector3.Up())\r\n * Setting this will copy the given vector to the camera's upVector, and set rotation matrices to and from Y up.\r\n * DO NOT set the up vector using copyFrom or copyFromFloats, as this bypasses setting the above matrices.\r\n */\r\n set: function (vec) {\r\n if (!this._upToYMatrix) {\r\n this._YToUpMatrix = new Matrix();\r\n this._upToYMatrix = new Matrix();\r\n this._upVector = Vector3.Zero();\r\n }\r\n vec.normalize();\r\n this._upVector.copyFrom(vec);\r\n this.setMatUp();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the Y-up to camera up-vector rotation matrix, and the up-vector to Y-up rotation matrix.\r\n */\r\n ArcRotateCamera.prototype.setMatUp = function () {\r\n // from y-up to custom-up (used in _getViewMatrix)\r\n Matrix.RotationAlignToRef(Vector3.UpReadOnly, this._upVector, this._YToUpMatrix);\r\n // from custom-up to y-up (used in rebuildAnglesAndRadius)\r\n Matrix.RotationAlignToRef(this._upVector, Vector3.UpReadOnly, this._upToYMatrix);\r\n };\r\n Object.defineProperty(ArcRotateCamera.prototype, \"angularSensibilityX\", {\r\n //-- begin properties for backward compatibility for inputs\r\n /**\r\n * Gets or Set the pointer angular sensibility along the X axis or how fast is the camera rotating.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.angularSensibilityX;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.angularSensibilityX = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"angularSensibilityY\", {\r\n /**\r\n * Gets or Set the pointer angular sensibility along the Y axis or how fast is the camera rotating.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.angularSensibilityY;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.angularSensibilityY = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"pinchPrecision\", {\r\n /**\r\n * Gets or Set the pointer pinch precision or how fast is the camera zooming.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.pinchPrecision;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.pinchPrecision = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"pinchDeltaPercentage\", {\r\n /**\r\n * Gets or Set the pointer pinch delta percentage or how fast is the camera zooming.\r\n * It will be used instead of pinchDeltaPrecision if different from 0.\r\n * It defines the percentage of current camera.radius to use as delta when pinch zoom is used.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.pinchDeltaPercentage;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.pinchDeltaPercentage = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"useNaturalPinchZoom\", {\r\n /**\r\n * Gets or Set the pointer use natural pinch zoom to override the pinch precision\r\n * and pinch delta percentage.\r\n * When useNaturalPinchZoom is true, multi touch zoom will zoom in such\r\n * that any object in the plane at the camera's target point will scale\r\n * perfectly with finger motion.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.useNaturalPinchZoom;\r\n }\r\n return false;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.useNaturalPinchZoom = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"panningSensibility\", {\r\n /**\r\n * Gets or Set the pointer panning sensibility or how fast is the camera moving.\r\n */\r\n get: function () {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n return pointers.panningSensibility;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var pointers = this.inputs.attached[\"pointers\"];\r\n if (pointers) {\r\n pointers.panningSensibility = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysUp\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control beta angle in a positive direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUp;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUp = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysDown\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control beta angle in a negative direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDown;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDown = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysLeft\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control alpha angle in a negative direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysLeft;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysLeft = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"keysRight\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control alpha angle in a positive direction.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRight;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRight = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"wheelPrecision\", {\r\n /**\r\n * Gets or Set the mouse wheel precision or how fast is the camera zooming.\r\n */\r\n get: function () {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n return mousewheel.wheelPrecision;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n mousewheel.wheelPrecision = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"wheelDeltaPercentage\", {\r\n /**\r\n * Gets or Set the mouse wheel delta percentage or how fast is the camera zooming.\r\n * It will be used instead of pinchDeltaPrecision if different from 0.\r\n * It defines the percentage of current camera.radius to use as delta when pinch zoom is used.\r\n */\r\n get: function () {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n return mousewheel.wheelDeltaPercentage;\r\n }\r\n return 0;\r\n },\r\n set: function (value) {\r\n var mousewheel = this.inputs.attached[\"mousewheel\"];\r\n if (mousewheel) {\r\n mousewheel.wheelDeltaPercentage = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"bouncingBehavior\", {\r\n /**\r\n * Gets the bouncing behavior of the camera if it has been enabled.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior\r\n */\r\n get: function () {\r\n return this._bouncingBehavior;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"useBouncingBehavior\", {\r\n /**\r\n * Defines if the bouncing behavior of the camera is enabled on the camera.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#bouncing-behavior\r\n */\r\n get: function () {\r\n return this._bouncingBehavior != null;\r\n },\r\n set: function (value) {\r\n if (value === this.useBouncingBehavior) {\r\n return;\r\n }\r\n if (value) {\r\n this._bouncingBehavior = new BouncingBehavior();\r\n this.addBehavior(this._bouncingBehavior);\r\n }\r\n else if (this._bouncingBehavior) {\r\n this.removeBehavior(this._bouncingBehavior);\r\n this._bouncingBehavior = null;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"framingBehavior\", {\r\n /**\r\n * Gets the framing behavior of the camera if it has been enabled.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior\r\n */\r\n get: function () {\r\n return this._framingBehavior;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"useFramingBehavior\", {\r\n /**\r\n * Defines if the framing behavior of the camera is enabled on the camera.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior\r\n */\r\n get: function () {\r\n return this._framingBehavior != null;\r\n },\r\n set: function (value) {\r\n if (value === this.useFramingBehavior) {\r\n return;\r\n }\r\n if (value) {\r\n this._framingBehavior = new FramingBehavior();\r\n this.addBehavior(this._framingBehavior);\r\n }\r\n else if (this._framingBehavior) {\r\n this.removeBehavior(this._framingBehavior);\r\n this._framingBehavior = null;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"autoRotationBehavior\", {\r\n /**\r\n * Gets the auto rotation behavior of the camera if it has been enabled.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior\r\n */\r\n get: function () {\r\n return this._autoRotationBehavior;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ArcRotateCamera.prototype, \"useAutoRotationBehavior\", {\r\n /**\r\n * Defines if the auto rotation behavior of the camera is enabled on the camera.\r\n * @see https://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior\r\n */\r\n get: function () {\r\n return this._autoRotationBehavior != null;\r\n },\r\n set: function (value) {\r\n if (value === this.useAutoRotationBehavior) {\r\n return;\r\n }\r\n if (value) {\r\n this._autoRotationBehavior = new AutoRotationBehavior();\r\n this.addBehavior(this._autoRotationBehavior);\r\n }\r\n else if (this._autoRotationBehavior) {\r\n this.removeBehavior(this._autoRotationBehavior);\r\n this._autoRotationBehavior = null;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Cache\r\n /** @hidden */\r\n ArcRotateCamera.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache._target = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.alpha = undefined;\r\n this._cache.beta = undefined;\r\n this._cache.radius = undefined;\r\n this._cache.targetScreenOffset = Vector2.Zero();\r\n };\r\n /** @hidden */\r\n ArcRotateCamera.prototype._updateCache = function (ignoreParentClass) {\r\n if (!ignoreParentClass) {\r\n _super.prototype._updateCache.call(this);\r\n }\r\n this._cache._target.copyFrom(this._getTargetPosition());\r\n this._cache.alpha = this.alpha;\r\n this._cache.beta = this.beta;\r\n this._cache.radius = this.radius;\r\n this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset);\r\n };\r\n ArcRotateCamera.prototype._getTargetPosition = function () {\r\n if (this._targetHost && this._targetHost.getAbsolutePosition) {\r\n var pos = this._targetHost.absolutePosition;\r\n if (this._targetBoundingCenter) {\r\n pos.addToRef(this._targetBoundingCenter, this._target);\r\n }\r\n else {\r\n this._target.copyFrom(pos);\r\n }\r\n }\r\n var lockedTargetPosition = this._getLockedTargetPosition();\r\n if (lockedTargetPosition) {\r\n return lockedTargetPosition;\r\n }\r\n return this._target;\r\n };\r\n /**\r\n * Stores the current state of the camera (alpha, beta, radius and target)\r\n * @returns the camera itself\r\n */\r\n ArcRotateCamera.prototype.storeState = function () {\r\n this._storedAlpha = this.alpha;\r\n this._storedBeta = this.beta;\r\n this._storedRadius = this.radius;\r\n this._storedTarget = this._getTargetPosition().clone();\r\n this._storedTargetScreenOffset = this.targetScreenOffset.clone();\r\n return _super.prototype.storeState.call(this);\r\n };\r\n /**\r\n * @hidden\r\n * Restored camera state. You must call storeState() first\r\n */\r\n ArcRotateCamera.prototype._restoreStateValues = function () {\r\n if (!_super.prototype._restoreStateValues.call(this)) {\r\n return false;\r\n }\r\n this.setTarget(this._storedTarget.clone());\r\n this.alpha = this._storedAlpha;\r\n this.beta = this._storedBeta;\r\n this.radius = this._storedRadius;\r\n this.targetScreenOffset = this._storedTargetScreenOffset.clone();\r\n this.inertialAlphaOffset = 0;\r\n this.inertialBetaOffset = 0;\r\n this.inertialRadiusOffset = 0;\r\n this.inertialPanningX = 0;\r\n this.inertialPanningY = 0;\r\n return true;\r\n };\r\n // Synchronized\r\n /** @hidden */\r\n ArcRotateCamera.prototype._isSynchronizedViewMatrix = function () {\r\n if (!_super.prototype._isSynchronizedViewMatrix.call(this)) {\r\n return false;\r\n }\r\n return this._cache._target.equals(this._getTargetPosition()) && this._cache.alpha === this.alpha && this._cache.beta === this.beta && this._cache.radius === this.radius && this._cache.targetScreenOffset.equals(this.targetScreenOffset);\r\n };\r\n /**\r\n * Attached controls to the current camera.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n * @param useCtrlForPanning Defines whether ctrl is used for paning within the controls\r\n * @param panningMouseButton Defines whether panning is allowed through mouse click button\r\n */\r\n ArcRotateCamera.prototype.attachControl = function (ignored, noPreventDefault, useCtrlForPanning, panningMouseButton) {\r\n var _this = this;\r\n if (useCtrlForPanning === void 0) { useCtrlForPanning = true; }\r\n if (panningMouseButton === void 0) { panningMouseButton = 2; }\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n this._useCtrlForPanning = useCtrlForPanning;\r\n this._panningMouseButton = panningMouseButton;\r\n // backwards compatibility\r\n if (typeof arguments[0] === \"boolean\") {\r\n if (arguments.length > 1) {\r\n this._useCtrlForPanning = arguments[1];\r\n }\r\n if (arguments.length > 2) {\r\n this._panningMouseButton = arguments[2];\r\n }\r\n }\r\n this.inputs.attachElement(noPreventDefault);\r\n this._reset = function () {\r\n _this.inertialAlphaOffset = 0;\r\n _this.inertialBetaOffset = 0;\r\n _this.inertialRadiusOffset = 0;\r\n _this.inertialPanningX = 0;\r\n _this.inertialPanningY = 0;\r\n };\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n ArcRotateCamera.prototype.detachControl = function (ignored) {\r\n this.inputs.detachElement();\r\n if (this._reset) {\r\n this._reset();\r\n }\r\n };\r\n /** @hidden */\r\n ArcRotateCamera.prototype._checkInputs = function () {\r\n //if (async) collision inspection was triggered, don't update the camera's position - until the collision callback was called.\r\n if (this._collisionTriggered) {\r\n return;\r\n }\r\n this.inputs.checkInputs();\r\n // Inertia\r\n if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset !== 0) {\r\n var inertialAlphaOffset = this.inertialAlphaOffset;\r\n if (this.beta <= 0) {\r\n inertialAlphaOffset *= -1;\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n inertialAlphaOffset *= -1;\r\n }\r\n if (this.parent && this.parent._getWorldMatrixDeterminant() < 0) {\r\n inertialAlphaOffset *= -1;\r\n }\r\n this.alpha += inertialAlphaOffset;\r\n this.beta += this.inertialBetaOffset;\r\n this.radius -= this.inertialRadiusOffset;\r\n this.inertialAlphaOffset *= this.inertia;\r\n this.inertialBetaOffset *= this.inertia;\r\n this.inertialRadiusOffset *= this.inertia;\r\n if (Math.abs(this.inertialAlphaOffset) < Epsilon) {\r\n this.inertialAlphaOffset = 0;\r\n }\r\n if (Math.abs(this.inertialBetaOffset) < Epsilon) {\r\n this.inertialBetaOffset = 0;\r\n }\r\n if (Math.abs(this.inertialRadiusOffset) < this.speed * Epsilon) {\r\n this.inertialRadiusOffset = 0;\r\n }\r\n }\r\n // Panning inertia\r\n if (this.inertialPanningX !== 0 || this.inertialPanningY !== 0) {\r\n if (!this._localDirection) {\r\n this._localDirection = Vector3.Zero();\r\n this._transformedDirection = Vector3.Zero();\r\n }\r\n this._localDirection.copyFromFloats(this.inertialPanningX, this.inertialPanningY, this.inertialPanningY);\r\n this._localDirection.multiplyInPlace(this.panningAxis);\r\n this._viewMatrix.invertToRef(this._cameraTransformMatrix);\r\n Vector3.TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection);\r\n //Eliminate y if map panning is enabled (panningAxis == 1,0,1)\r\n if (!this.panningAxis.y) {\r\n this._transformedDirection.y = 0;\r\n }\r\n if (!this._targetHost) {\r\n if (this.panningDistanceLimit) {\r\n this._transformedDirection.addInPlace(this._target);\r\n var distanceSquared = Vector3.DistanceSquared(this._transformedDirection, this.panningOriginTarget);\r\n if (distanceSquared <= this.panningDistanceLimit * this.panningDistanceLimit) {\r\n this._target.copyFrom(this._transformedDirection);\r\n }\r\n }\r\n else {\r\n this._target.addInPlace(this._transformedDirection);\r\n }\r\n }\r\n this.inertialPanningX *= this.panningInertia;\r\n this.inertialPanningY *= this.panningInertia;\r\n if (Math.abs(this.inertialPanningX) < this.speed * Epsilon) {\r\n this.inertialPanningX = 0;\r\n }\r\n if (Math.abs(this.inertialPanningY) < this.speed * Epsilon) {\r\n this.inertialPanningY = 0;\r\n }\r\n }\r\n // Limits\r\n this._checkLimits();\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n ArcRotateCamera.prototype._checkLimits = function () {\r\n if (this.lowerBetaLimit === null || this.lowerBetaLimit === undefined) {\r\n if (this.allowUpsideDown && this.beta > Math.PI) {\r\n this.beta = this.beta - 2 * Math.PI;\r\n }\r\n }\r\n else {\r\n if (this.beta < this.lowerBetaLimit) {\r\n this.beta = this.lowerBetaLimit;\r\n }\r\n }\r\n if (this.upperBetaLimit === null || this.upperBetaLimit === undefined) {\r\n if (this.allowUpsideDown && this.beta < -Math.PI) {\r\n this.beta = this.beta + 2 * Math.PI;\r\n }\r\n }\r\n else {\r\n if (this.beta > this.upperBetaLimit) {\r\n this.beta = this.upperBetaLimit;\r\n }\r\n }\r\n if (this.lowerAlphaLimit !== null && this.alpha < this.lowerAlphaLimit) {\r\n this.alpha = this.lowerAlphaLimit;\r\n }\r\n if (this.upperAlphaLimit !== null && this.alpha > this.upperAlphaLimit) {\r\n this.alpha = this.upperAlphaLimit;\r\n }\r\n if (this.lowerRadiusLimit !== null && this.radius < this.lowerRadiusLimit) {\r\n this.radius = this.lowerRadiusLimit;\r\n this.inertialRadiusOffset = 0;\r\n }\r\n if (this.upperRadiusLimit !== null && this.radius > this.upperRadiusLimit) {\r\n this.radius = this.upperRadiusLimit;\r\n this.inertialRadiusOffset = 0;\r\n }\r\n };\r\n /**\r\n * Rebuilds angles (alpha, beta) and radius from the give position and target\r\n */\r\n ArcRotateCamera.prototype.rebuildAnglesAndRadius = function () {\r\n this._position.subtractToRef(this._getTargetPosition(), this._computationVector);\r\n // need to rotate to Y up equivalent if up vector not Axis.Y\r\n if (this._upVector.x !== 0 || this._upVector.y !== 1.0 || this._upVector.z !== 0) {\r\n Vector3.TransformCoordinatesToRef(this._computationVector, this._upToYMatrix, this._computationVector);\r\n }\r\n this.radius = this._computationVector.length();\r\n if (this.radius === 0) {\r\n this.radius = 0.0001; // Just to avoid division by zero\r\n }\r\n // Alpha\r\n var previousAlpha = this.alpha;\r\n if (this._computationVector.x === 0 && this._computationVector.z === 0) {\r\n this.alpha = Math.PI / 2; // avoid division by zero when looking along up axis, and set to acos(0)\r\n }\r\n else {\r\n this.alpha = Math.acos(this._computationVector.x / Math.sqrt(Math.pow(this._computationVector.x, 2) + Math.pow(this._computationVector.z, 2)));\r\n }\r\n if (this._computationVector.z < 0) {\r\n this.alpha = 2 * Math.PI - this.alpha;\r\n }\r\n // Calculate the number of revolutions between the new and old alpha values.\r\n var alphaCorrectionTurns = Math.round((previousAlpha - this.alpha) / (2.0 * Math.PI));\r\n // Adjust alpha so that its numerical representation is the closest one to the old value.\r\n this.alpha += alphaCorrectionTurns * 2.0 * Math.PI;\r\n // Beta\r\n this.beta = Math.acos(this._computationVector.y / this.radius);\r\n this._checkLimits();\r\n };\r\n /**\r\n * Use a position to define the current camera related information like alpha, beta and radius\r\n * @param position Defines the position to set the camera at\r\n */\r\n ArcRotateCamera.prototype.setPosition = function (position) {\r\n if (this._position.equals(position)) {\r\n return;\r\n }\r\n this._position.copyFrom(position);\r\n this.rebuildAnglesAndRadius();\r\n };\r\n /**\r\n * Defines the target the camera should look at.\r\n * This will automatically adapt alpha beta and radius to fit within the new target.\r\n * @param target Defines the new target as a Vector or a mesh\r\n * @param toBoundingCenter In case of a mesh target, defines whether to target the mesh position or its bounding information center\r\n * @param allowSamePosition If false, prevents reapplying the new computed position if it is identical to the current one (optim)\r\n */\r\n ArcRotateCamera.prototype.setTarget = function (target, toBoundingCenter, allowSamePosition) {\r\n if (toBoundingCenter === void 0) { toBoundingCenter = false; }\r\n if (allowSamePosition === void 0) { allowSamePosition = false; }\r\n if (target.getBoundingInfo) {\r\n if (toBoundingCenter) {\r\n this._targetBoundingCenter = target.getBoundingInfo().boundingBox.centerWorld.clone();\r\n }\r\n else {\r\n this._targetBoundingCenter = null;\r\n }\r\n target.computeWorldMatrix();\r\n this._targetHost = target;\r\n this._target = this._getTargetPosition();\r\n this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);\r\n }\r\n else {\r\n var newTarget = target;\r\n var currentTarget = this._getTargetPosition();\r\n if (currentTarget && !allowSamePosition && currentTarget.equals(newTarget)) {\r\n return;\r\n }\r\n this._targetHost = null;\r\n this._target = newTarget;\r\n this._targetBoundingCenter = null;\r\n this.onMeshTargetChangedObservable.notifyObservers(null);\r\n }\r\n this.rebuildAnglesAndRadius();\r\n };\r\n /** @hidden */\r\n ArcRotateCamera.prototype._getViewMatrix = function () {\r\n // Compute\r\n var cosa = Math.cos(this.alpha);\r\n var sina = Math.sin(this.alpha);\r\n var cosb = Math.cos(this.beta);\r\n var sinb = Math.sin(this.beta);\r\n if (sinb === 0) {\r\n sinb = 0.0001;\r\n }\r\n if (this.radius === 0) {\r\n this.radius = 0.0001; // Just to avoid division by zero\r\n }\r\n var target = this._getTargetPosition();\r\n this._computationVector.copyFromFloats(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb);\r\n // Rotate according to up vector\r\n if (this._upVector.x !== 0 || this._upVector.y !== 1.0 || this._upVector.z !== 0) {\r\n Vector3.TransformCoordinatesToRef(this._computationVector, this._YToUpMatrix, this._computationVector);\r\n }\r\n target.addToRef(this._computationVector, this._newPosition);\r\n if (this.getScene().collisionsEnabled && this.checkCollisions) {\r\n var coordinator = this.getScene().collisionCoordinator;\r\n if (!this._collider) {\r\n this._collider = coordinator.createCollider();\r\n }\r\n this._collider._radius = this.collisionRadius;\r\n this._newPosition.subtractToRef(this._position, this._collisionVelocity);\r\n this._collisionTriggered = true;\r\n coordinator.getNewPosition(this._position, this._collisionVelocity, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);\r\n }\r\n else {\r\n this._position.copyFrom(this._newPosition);\r\n var up = this.upVector;\r\n if (this.allowUpsideDown && sinb < 0) {\r\n up = up.negate();\r\n }\r\n this._computeViewMatrix(this._position, target, up);\r\n this._viewMatrix.addAtIndex(12, this.targetScreenOffset.x);\r\n this._viewMatrix.addAtIndex(13, this.targetScreenOffset.y);\r\n }\r\n this._currentTarget = target;\r\n return this._viewMatrix;\r\n };\r\n /**\r\n * Zooms on a mesh to be at the min distance where we could see it fully in the current viewport.\r\n * @param meshes Defines the mesh to zoom on\r\n * @param doNotUpdateMaxZ Defines whether or not maxZ should be updated whilst zooming on the mesh (this can happen if the mesh is big and the maxradius pretty small for instance)\r\n */\r\n ArcRotateCamera.prototype.zoomOn = function (meshes, doNotUpdateMaxZ) {\r\n if (doNotUpdateMaxZ === void 0) { doNotUpdateMaxZ = false; }\r\n meshes = meshes || this.getScene().meshes;\r\n var minMaxVector = Mesh.MinMax(meshes);\r\n var distance = Vector3.Distance(minMaxVector.min, minMaxVector.max);\r\n this.radius = distance * this.zoomOnFactor;\r\n this.focusOn({ min: minMaxVector.min, max: minMaxVector.max, distance: distance }, doNotUpdateMaxZ);\r\n };\r\n /**\r\n * Focus on a mesh or a bounding box. This adapts the target and maxRadius if necessary but does not update the current radius.\r\n * The target will be changed but the radius\r\n * @param meshesOrMinMaxVectorAndDistance Defines the mesh or bounding info to focus on\r\n * @param doNotUpdateMaxZ Defines whether or not maxZ should be updated whilst zooming on the mesh (this can happen if the mesh is big and the maxradius pretty small for instance)\r\n */\r\n ArcRotateCamera.prototype.focusOn = function (meshesOrMinMaxVectorAndDistance, doNotUpdateMaxZ) {\r\n if (doNotUpdateMaxZ === void 0) { doNotUpdateMaxZ = false; }\r\n var meshesOrMinMaxVector;\r\n var distance;\r\n if (meshesOrMinMaxVectorAndDistance.min === undefined) {\r\n // meshes\r\n var meshes = meshesOrMinMaxVectorAndDistance || this.getScene().meshes;\r\n meshesOrMinMaxVector = Mesh.MinMax(meshes);\r\n distance = Vector3.Distance(meshesOrMinMaxVector.min, meshesOrMinMaxVector.max);\r\n }\r\n else {\r\n //minMaxVector and distance\r\n var minMaxVectorAndDistance = meshesOrMinMaxVectorAndDistance;\r\n meshesOrMinMaxVector = minMaxVectorAndDistance;\r\n distance = minMaxVectorAndDistance.distance;\r\n }\r\n this._target = Mesh.Center(meshesOrMinMaxVector);\r\n if (!doNotUpdateMaxZ) {\r\n this.maxZ = distance * 2;\r\n }\r\n };\r\n /**\r\n * @override\r\n * Override Camera.createRigCamera\r\n */\r\n ArcRotateCamera.prototype.createRigCamera = function (name, cameraIndex) {\r\n var alphaShift = 0;\r\n switch (this.cameraRigMode) {\r\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED:\r\n case Camera.RIG_MODE_VR:\r\n alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? 1 : -1);\r\n break;\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? -1 : 1);\r\n break;\r\n }\r\n var rigCam = new ArcRotateCamera(name, this.alpha + alphaShift, this.beta, this.radius, this._target, this.getScene());\r\n rigCam._cameraRigParams = {};\r\n rigCam.isRigCamera = true;\r\n rigCam.rigParent = this;\r\n rigCam.upVector = this.upVector;\r\n return rigCam;\r\n };\r\n /**\r\n * @hidden\r\n * @override\r\n * Override Camera._updateRigCameras\r\n */\r\n ArcRotateCamera.prototype._updateRigCameras = function () {\r\n var camLeft = this._rigCameras[0];\r\n var camRight = this._rigCameras[1];\r\n camLeft.beta = camRight.beta = this.beta;\r\n switch (this.cameraRigMode) {\r\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED:\r\n case Camera.RIG_MODE_VR:\r\n camLeft.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;\r\n camRight.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;\r\n break;\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n camLeft.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;\r\n camRight.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;\r\n break;\r\n }\r\n _super.prototype._updateRigCameras.call(this);\r\n };\r\n /**\r\n * Destroy the camera and release the current resources hold by it.\r\n */\r\n ArcRotateCamera.prototype.dispose = function () {\r\n this.inputs.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n ArcRotateCamera.prototype.getClassName = function () {\r\n return \"ArcRotateCamera\";\r\n };\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"alpha\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"beta\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"radius\", void 0);\r\n __decorate([\r\n serializeAsVector3(\"target\")\r\n ], ArcRotateCamera.prototype, \"_target\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"inertialAlphaOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"inertialBetaOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"inertialRadiusOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"lowerAlphaLimit\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"upperAlphaLimit\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"lowerBetaLimit\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"upperBetaLimit\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"lowerRadiusLimit\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"upperRadiusLimit\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"inertialPanningX\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"inertialPanningY\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"pinchToPanMaxDistance\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"panningDistanceLimit\", void 0);\r\n __decorate([\r\n serializeAsVector3()\r\n ], ArcRotateCamera.prototype, \"panningOriginTarget\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"panningInertia\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"zoomOnFactor\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"targetScreenOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"allowUpsideDown\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ArcRotateCamera.prototype, \"useInputToRestoreState\", void 0);\r\n return ArcRotateCamera;\r\n}(TargetCamera));\r\nexport { ArcRotateCamera };\r\n//# sourceMappingURL=arcRotateCamera.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, SerializationHelper, serializeAsVector3 } from \"../Misc/decorators\";\r\nimport { SmartArray } from \"../Misc/smartArray\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Matrix, Vector3, Quaternion } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { _TypeStore } from '../Misc/typeStore';\r\nimport { _DevTools } from '../Misc/devTools';\r\nimport { Viewport } from '../Maths/math.viewport';\r\nimport { Frustum } from '../Maths/math.frustum';\r\n/**\r\n * This is the base class of all the camera used in the application.\r\n * @see https://doc.babylonjs.com/features/cameras\r\n */\r\nvar Camera = /** @class */ (function (_super) {\r\n __extends(Camera, _super);\r\n /**\r\n * Instantiates a new camera object.\r\n * This should not be used directly but through the inherited cameras: ArcRotate, Free...\r\n * @see https://doc.babylonjs.com/features/cameras\r\n * @param name Defines the name of the camera in the scene\r\n * @param position Defines the position of the camera\r\n * @param scene Defines the scene the camera belongs too\r\n * @param setActiveOnSceneIfNoneActive Defines if the camera should be set as active after creation if no other camera have been defined in the scene\r\n */\r\n function Camera(name, position, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, scene) || this;\r\n /** @hidden */\r\n _this._position = Vector3.Zero();\r\n _this._upVector = Vector3.Up();\r\n /**\r\n * Define the current limit on the left side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoLeft = null;\r\n /**\r\n * Define the current limit on the right side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoRight = null;\r\n /**\r\n * Define the current limit on the bottom side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoBottom = null;\r\n /**\r\n * Define the current limit on the top side for an orthographic camera\r\n * In scene unit\r\n */\r\n _this.orthoTop = null;\r\n /**\r\n * Field Of View is set in Radians. (default is 0.8)\r\n */\r\n _this.fov = 0.8;\r\n /**\r\n * Define the minimum distance the camera can see from.\r\n * This is important to note that the depth buffer are not infinite and the closer it starts\r\n * the more your scene might encounter depth fighting issue.\r\n */\r\n _this.minZ = 1;\r\n /**\r\n * Define the maximum distance the camera can see to.\r\n * This is important to note that the depth buffer are not infinite and the further it end\r\n * the more your scene might encounter depth fighting issue.\r\n */\r\n _this.maxZ = 10000.0;\r\n /**\r\n * Define the default inertia of the camera.\r\n * This helps giving a smooth feeling to the camera movement.\r\n */\r\n _this.inertia = 0.9;\r\n /**\r\n * Define the mode of the camera (Camera.PERSPECTIVE_CAMERA or Camera.ORTHOGRAPHIC_CAMERA)\r\n */\r\n _this.mode = Camera.PERSPECTIVE_CAMERA;\r\n /**\r\n * Define whether the camera is intermediate.\r\n * This is useful to not present the output directly to the screen in case of rig without post process for instance\r\n */\r\n _this.isIntermediate = false;\r\n /**\r\n * Define the viewport of the camera.\r\n * This correspond to the portion of the screen the camera will render to in normalized 0 to 1 unit.\r\n */\r\n _this.viewport = new Viewport(0, 0, 1.0, 1.0);\r\n /**\r\n * Restricts the camera to viewing objects with the same layerMask.\r\n * A camera with a layerMask of 1 will render mesh.layerMask & camera.layerMask!== 0\r\n */\r\n _this.layerMask = 0x0FFFFFFF;\r\n /**\r\n * fovMode sets the camera frustum bounds to the viewport bounds. (default is FOVMODE_VERTICAL_FIXED)\r\n */\r\n _this.fovMode = Camera.FOVMODE_VERTICAL_FIXED;\r\n /**\r\n * Rig mode of the camera.\r\n * This is useful to create the camera with two \"eyes\" instead of one to create VR or stereoscopic scenes.\r\n * This is normally controlled byt the camera themselves as internal use.\r\n */\r\n _this.cameraRigMode = Camera.RIG_MODE_NONE;\r\n /**\r\n * Defines the list of custom render target which are rendered to and then used as the input to this camera's render. Eg. display another camera view on a TV in the main scene\r\n * This is pretty helpfull if you wish to make a camera render to a texture you could reuse somewhere\r\n * else in the scene. (Eg. security camera)\r\n *\r\n * To change the final output target of the camera, camera.outputRenderTarget should be used instead (eg. webXR renders to a render target corrisponding to an HMD)\r\n */\r\n _this.customRenderTargets = new Array();\r\n /**\r\n * When set, the camera will render to this render target instead of the default canvas\r\n *\r\n * If the desire is to use the output of a camera as a texture in the scene consider using camera.customRenderTargets instead\r\n */\r\n _this.outputRenderTarget = null;\r\n /**\r\n * Observable triggered when the camera view matrix has changed.\r\n */\r\n _this.onViewMatrixChangedObservable = new Observable();\r\n /**\r\n * Observable triggered when the camera Projection matrix has changed.\r\n */\r\n _this.onProjectionMatrixChangedObservable = new Observable();\r\n /**\r\n * Observable triggered when the inputs have been processed.\r\n */\r\n _this.onAfterCheckInputsObservable = new Observable();\r\n /**\r\n * Observable triggered when reset has been called and applied to the camera.\r\n */\r\n _this.onRestoreStateObservable = new Observable();\r\n /**\r\n * Is this camera a part of a rig system?\r\n */\r\n _this.isRigCamera = false;\r\n /** @hidden */\r\n _this._rigCameras = new Array();\r\n _this._webvrViewMatrix = Matrix.Identity();\r\n /** @hidden */\r\n _this._skipRendering = false;\r\n /** @hidden */\r\n _this._projectionMatrix = new Matrix();\r\n /** @hidden */\r\n _this._postProcesses = new Array();\r\n /** @hidden */\r\n _this._activeMeshes = new SmartArray(256);\r\n _this._globalPosition = Vector3.Zero();\r\n /** @hidden */\r\n _this._computedViewMatrix = Matrix.Identity();\r\n _this._doNotComputeProjectionMatrix = false;\r\n _this._transformMatrix = Matrix.Zero();\r\n _this._refreshFrustumPlanes = true;\r\n /** @hidden */\r\n _this._isCamera = true;\r\n /** @hidden */\r\n _this._isLeftCamera = false;\r\n /** @hidden */\r\n _this._isRightCamera = false;\r\n _this.getScene().addCamera(_this);\r\n if (setActiveOnSceneIfNoneActive && !_this.getScene().activeCamera) {\r\n _this.getScene().activeCamera = _this;\r\n }\r\n _this.position = position;\r\n return _this;\r\n }\r\n Object.defineProperty(Camera.prototype, \"position\", {\r\n /**\r\n * Define the current local position of the camera in the scene\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n set: function (newPosition) {\r\n this._position = newPosition;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"upVector\", {\r\n get: function () {\r\n return this._upVector;\r\n },\r\n /**\r\n * The vector the camera should consider as up.\r\n * (default is Vector3(0, 1, 0) aka Vector3.Up())\r\n */\r\n set: function (vec) {\r\n this._upVector = vec;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Store current camera state (fov, position, etc..)\r\n * @returns the camera\r\n */\r\n Camera.prototype.storeState = function () {\r\n this._stateStored = true;\r\n this._storedFov = this.fov;\r\n return this;\r\n };\r\n /**\r\n * Restores the camera state values if it has been stored. You must call storeState() first\r\n */\r\n Camera.prototype._restoreStateValues = function () {\r\n if (!this._stateStored) {\r\n return false;\r\n }\r\n this.fov = this._storedFov;\r\n return true;\r\n };\r\n /**\r\n * Restored camera state. You must call storeState() first.\r\n * @returns true if restored and false otherwise\r\n */\r\n Camera.prototype.restoreState = function () {\r\n if (this._restoreStateValues()) {\r\n this.onRestoreStateObservable.notifyObservers(this);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets the class name of the camera.\r\n * @returns the class name\r\n */\r\n Camera.prototype.getClassName = function () {\r\n return \"Camera\";\r\n };\r\n /**\r\n * Gets a string representation of the camera useful for debug purpose.\r\n * @param fullDetails Defines that a more verboe level of logging is required\r\n * @returns the string representation\r\n */\r\n Camera.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n ret += \", type: \" + this.getClassName();\r\n if (this.animations) {\r\n for (var i = 0; i < this.animations.length; i++) {\r\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\r\n }\r\n }\r\n if (fullDetails) {\r\n }\r\n return ret;\r\n };\r\n Object.defineProperty(Camera.prototype, \"globalPosition\", {\r\n /**\r\n * Gets the current world space position of the camera.\r\n */\r\n get: function () {\r\n return this._globalPosition;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the list of active meshes this frame (meshes no culled or excluded by lod s in the frame)\r\n * @returns the active meshe list\r\n */\r\n Camera.prototype.getActiveMeshes = function () {\r\n return this._activeMeshes;\r\n };\r\n /**\r\n * Check whether a mesh is part of the current active mesh list of the camera\r\n * @param mesh Defines the mesh to check\r\n * @returns true if active, false otherwise\r\n */\r\n Camera.prototype.isActiveMesh = function (mesh) {\r\n return (this._activeMeshes.indexOf(mesh) !== -1);\r\n };\r\n /**\r\n * Is this camera ready to be used/rendered\r\n * @param completeCheck defines if a complete check (including post processes) has to be done (false by default)\r\n * @return true if the camera is ready\r\n */\r\n Camera.prototype.isReady = function (completeCheck) {\r\n if (completeCheck === void 0) { completeCheck = false; }\r\n if (completeCheck) {\r\n for (var _i = 0, _a = this._postProcesses; _i < _a.length; _i++) {\r\n var pp = _a[_i];\r\n if (pp && !pp.isReady()) {\r\n return false;\r\n }\r\n }\r\n }\r\n return _super.prototype.isReady.call(this, completeCheck);\r\n };\r\n /** @hidden */\r\n Camera.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache.position = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.upVector = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.mode = undefined;\r\n this._cache.minZ = undefined;\r\n this._cache.maxZ = undefined;\r\n this._cache.fov = undefined;\r\n this._cache.fovMode = undefined;\r\n this._cache.aspectRatio = undefined;\r\n this._cache.orthoLeft = undefined;\r\n this._cache.orthoRight = undefined;\r\n this._cache.orthoBottom = undefined;\r\n this._cache.orthoTop = undefined;\r\n this._cache.renderWidth = undefined;\r\n this._cache.renderHeight = undefined;\r\n };\r\n /** @hidden */\r\n Camera.prototype._updateCache = function (ignoreParentClass) {\r\n if (!ignoreParentClass) {\r\n _super.prototype._updateCache.call(this);\r\n }\r\n this._cache.position.copyFrom(this.position);\r\n this._cache.upVector.copyFrom(this.upVector);\r\n };\r\n /** @hidden */\r\n Camera.prototype._isSynchronized = function () {\r\n return this._isSynchronizedViewMatrix() && this._isSynchronizedProjectionMatrix();\r\n };\r\n /** @hidden */\r\n Camera.prototype._isSynchronizedViewMatrix = function () {\r\n if (!_super.prototype._isSynchronized.call(this)) {\r\n return false;\r\n }\r\n return this._cache.position.equals(this.position)\r\n && this._cache.upVector.equals(this.upVector)\r\n && this.isSynchronizedWithParent();\r\n };\r\n /** @hidden */\r\n Camera.prototype._isSynchronizedProjectionMatrix = function () {\r\n var check = this._cache.mode === this.mode\r\n && this._cache.minZ === this.minZ\r\n && this._cache.maxZ === this.maxZ;\r\n if (!check) {\r\n return false;\r\n }\r\n var engine = this.getEngine();\r\n if (this.mode === Camera.PERSPECTIVE_CAMERA) {\r\n check = this._cache.fov === this.fov\r\n && this._cache.fovMode === this.fovMode\r\n && this._cache.aspectRatio === engine.getAspectRatio(this);\r\n }\r\n else {\r\n check = this._cache.orthoLeft === this.orthoLeft\r\n && this._cache.orthoRight === this.orthoRight\r\n && this._cache.orthoBottom === this.orthoBottom\r\n && this._cache.orthoTop === this.orthoTop\r\n && this._cache.renderWidth === engine.getRenderWidth()\r\n && this._cache.renderHeight === engine.getRenderHeight();\r\n }\r\n return check;\r\n };\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n Camera.prototype.attachControl = function (ignored, noPreventDefault) {\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n Camera.prototype.detachControl = function (ignored) {\r\n };\r\n /**\r\n * Update the camera state according to the different inputs gathered during the frame.\r\n */\r\n Camera.prototype.update = function () {\r\n this._checkInputs();\r\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n this._updateRigCameras();\r\n }\r\n };\r\n /** @hidden */\r\n Camera.prototype._checkInputs = function () {\r\n this.onAfterCheckInputsObservable.notifyObservers(this);\r\n };\r\n Object.defineProperty(Camera.prototype, \"rigCameras\", {\r\n /** @hidden */\r\n get: function () {\r\n return this._rigCameras;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"rigPostProcess\", {\r\n /**\r\n * Gets the post process used by the rig cameras\r\n */\r\n get: function () {\r\n return this._rigPostProcess;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Internal, gets the first post proces.\r\n * @returns the first post process to be run on this camera.\r\n */\r\n Camera.prototype._getFirstPostProcess = function () {\r\n for (var ppIndex = 0; ppIndex < this._postProcesses.length; ppIndex++) {\r\n if (this._postProcesses[ppIndex] !== null) {\r\n return this._postProcesses[ppIndex];\r\n }\r\n }\r\n return null;\r\n };\r\n Camera.prototype._cascadePostProcessesToRigCams = function () {\r\n // invalidate framebuffer\r\n var firstPostProcess = this._getFirstPostProcess();\r\n if (firstPostProcess) {\r\n firstPostProcess.markTextureDirty();\r\n }\r\n // glue the rigPostProcess to the end of the user postprocesses & assign to each sub-camera\r\n for (var i = 0, len = this._rigCameras.length; i < len; i++) {\r\n var cam = this._rigCameras[i];\r\n var rigPostProcess = cam._rigPostProcess;\r\n // for VR rig, there does not have to be a post process\r\n if (rigPostProcess) {\r\n var isPass = rigPostProcess.getEffectName() === \"pass\";\r\n if (isPass) {\r\n // any rig which has a PassPostProcess for rig[0], cannot be isIntermediate when there are also user postProcesses\r\n cam.isIntermediate = this._postProcesses.length === 0;\r\n }\r\n cam._postProcesses = this._postProcesses.slice(0).concat(rigPostProcess);\r\n rigPostProcess.markTextureDirty();\r\n }\r\n else {\r\n cam._postProcesses = this._postProcesses.slice(0);\r\n }\r\n }\r\n };\r\n /**\r\n * Attach a post process to the camera.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses#attach-postprocess\r\n * @param postProcess The post process to attach to the camera\r\n * @param insertAt The position of the post process in case several of them are in use in the scene\r\n * @returns the position the post process has been inserted at\r\n */\r\n Camera.prototype.attachPostProcess = function (postProcess, insertAt) {\r\n if (insertAt === void 0) { insertAt = null; }\r\n if (!postProcess.isReusable() && this._postProcesses.indexOf(postProcess) > -1) {\r\n Logger.Error(\"You're trying to reuse a post process not defined as reusable.\");\r\n return 0;\r\n }\r\n if (insertAt == null || insertAt < 0) {\r\n this._postProcesses.push(postProcess);\r\n }\r\n else if (this._postProcesses[insertAt] === null) {\r\n this._postProcesses[insertAt] = postProcess;\r\n }\r\n else {\r\n this._postProcesses.splice(insertAt, 0, postProcess);\r\n }\r\n this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated\r\n // Update prePass\r\n if (this._scene.prePassRenderer) {\r\n this._scene.prePassRenderer.markAsDirty();\r\n }\r\n return this._postProcesses.indexOf(postProcess);\r\n };\r\n /**\r\n * Detach a post process to the camera.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_postprocesses#attach-postprocess\r\n * @param postProcess The post process to detach from the camera\r\n */\r\n Camera.prototype.detachPostProcess = function (postProcess) {\r\n var idx = this._postProcesses.indexOf(postProcess);\r\n if (idx !== -1) {\r\n this._postProcesses[idx] = null;\r\n }\r\n // Update prePass\r\n if (this._scene.prePassRenderer) {\r\n this._scene.prePassRenderer.markAsDirty();\r\n }\r\n this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated\r\n };\r\n /**\r\n * Gets the current world matrix of the camera\r\n */\r\n Camera.prototype.getWorldMatrix = function () {\r\n if (this._isSynchronizedViewMatrix()) {\r\n return this._worldMatrix;\r\n }\r\n // Getting the the view matrix will also compute the world matrix.\r\n this.getViewMatrix();\r\n return this._worldMatrix;\r\n };\r\n /** @hidden */\r\n Camera.prototype._getViewMatrix = function () {\r\n return Matrix.Identity();\r\n };\r\n /**\r\n * Gets the current view matrix of the camera.\r\n * @param force forces the camera to recompute the matrix without looking at the cached state\r\n * @returns the view matrix\r\n */\r\n Camera.prototype.getViewMatrix = function (force) {\r\n if (!force && this._isSynchronizedViewMatrix()) {\r\n return this._computedViewMatrix;\r\n }\r\n this.updateCache();\r\n this._computedViewMatrix = this._getViewMatrix();\r\n this._currentRenderId = this.getScene().getRenderId();\r\n this._childUpdateId++;\r\n this._refreshFrustumPlanes = true;\r\n if (this._cameraRigParams && this._cameraRigParams.vrPreViewMatrix) {\r\n this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix, this._computedViewMatrix);\r\n }\r\n // Notify parent camera if rig camera is changed\r\n if (this.parent && this.parent.onViewMatrixChangedObservable) {\r\n this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent);\r\n }\r\n this.onViewMatrixChangedObservable.notifyObservers(this);\r\n this._computedViewMatrix.invertToRef(this._worldMatrix);\r\n return this._computedViewMatrix;\r\n };\r\n /**\r\n * Freeze the projection matrix.\r\n * It will prevent the cache check of the camera projection compute and can speed up perf\r\n * if no parameter of the camera are meant to change\r\n * @param projection Defines manually a projection if necessary\r\n */\r\n Camera.prototype.freezeProjectionMatrix = function (projection) {\r\n this._doNotComputeProjectionMatrix = true;\r\n if (projection !== undefined) {\r\n this._projectionMatrix = projection;\r\n }\r\n };\r\n /**\r\n * Unfreeze the projection matrix if it has previously been freezed by freezeProjectionMatrix.\r\n */\r\n Camera.prototype.unfreezeProjectionMatrix = function () {\r\n this._doNotComputeProjectionMatrix = false;\r\n };\r\n /**\r\n * Gets the current projection matrix of the camera.\r\n * @param force forces the camera to recompute the matrix without looking at the cached state\r\n * @returns the projection matrix\r\n */\r\n Camera.prototype.getProjectionMatrix = function (force) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h;\r\n if (this._doNotComputeProjectionMatrix || (!force && this._isSynchronizedProjectionMatrix())) {\r\n return this._projectionMatrix;\r\n }\r\n // Cache\r\n this._cache.mode = this.mode;\r\n this._cache.minZ = this.minZ;\r\n this._cache.maxZ = this.maxZ;\r\n // Matrix\r\n this._refreshFrustumPlanes = true;\r\n var engine = this.getEngine();\r\n var scene = this.getScene();\r\n if (this.mode === Camera.PERSPECTIVE_CAMERA) {\r\n this._cache.fov = this.fov;\r\n this._cache.fovMode = this.fovMode;\r\n this._cache.aspectRatio = engine.getAspectRatio(this);\r\n if (this.minZ <= 0) {\r\n this.minZ = 0.1;\r\n }\r\n var reverseDepth = engine.useReverseDepthBuffer;\r\n var getProjectionMatrix = void 0;\r\n if (scene.useRightHandedSystem) {\r\n getProjectionMatrix = reverseDepth ? Matrix.PerspectiveFovReverseRHToRef : Matrix.PerspectiveFovRHToRef;\r\n }\r\n else {\r\n getProjectionMatrix = reverseDepth ? Matrix.PerspectiveFovReverseLHToRef : Matrix.PerspectiveFovLHToRef;\r\n }\r\n getProjectionMatrix(this.fov, engine.getAspectRatio(this), this.minZ, this.maxZ, this._projectionMatrix, this.fovMode === Camera.FOVMODE_VERTICAL_FIXED);\r\n }\r\n else {\r\n var halfWidth = engine.getRenderWidth() / 2.0;\r\n var halfHeight = engine.getRenderHeight() / 2.0;\r\n if (scene.useRightHandedSystem) {\r\n Matrix.OrthoOffCenterRHToRef((_a = this.orthoLeft) !== null && _a !== void 0 ? _a : -halfWidth, (_b = this.orthoRight) !== null && _b !== void 0 ? _b : halfWidth, (_c = this.orthoBottom) !== null && _c !== void 0 ? _c : -halfHeight, (_d = this.orthoTop) !== null && _d !== void 0 ? _d : halfHeight, this.minZ, this.maxZ, this._projectionMatrix);\r\n }\r\n else {\r\n Matrix.OrthoOffCenterLHToRef((_e = this.orthoLeft) !== null && _e !== void 0 ? _e : -halfWidth, (_f = this.orthoRight) !== null && _f !== void 0 ? _f : halfWidth, (_g = this.orthoBottom) !== null && _g !== void 0 ? _g : -halfHeight, (_h = this.orthoTop) !== null && _h !== void 0 ? _h : halfHeight, this.minZ, this.maxZ, this._projectionMatrix);\r\n }\r\n this._cache.orthoLeft = this.orthoLeft;\r\n this._cache.orthoRight = this.orthoRight;\r\n this._cache.orthoBottom = this.orthoBottom;\r\n this._cache.orthoTop = this.orthoTop;\r\n this._cache.renderWidth = engine.getRenderWidth();\r\n this._cache.renderHeight = engine.getRenderHeight();\r\n }\r\n this.onProjectionMatrixChangedObservable.notifyObservers(this);\r\n return this._projectionMatrix;\r\n };\r\n /**\r\n * Gets the transformation matrix (ie. the multiplication of view by projection matrices)\r\n * @returns a Matrix\r\n */\r\n Camera.prototype.getTransformationMatrix = function () {\r\n this._computedViewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);\r\n return this._transformMatrix;\r\n };\r\n Camera.prototype._updateFrustumPlanes = function () {\r\n if (!this._refreshFrustumPlanes) {\r\n return;\r\n }\r\n this.getTransformationMatrix();\r\n if (!this._frustumPlanes) {\r\n this._frustumPlanes = Frustum.GetPlanes(this._transformMatrix);\r\n }\r\n else {\r\n Frustum.GetPlanesToRef(this._transformMatrix, this._frustumPlanes);\r\n }\r\n this._refreshFrustumPlanes = false;\r\n };\r\n /**\r\n * Checks if a cullable object (mesh...) is in the camera frustum\r\n * This checks the bounding box center. See isCompletelyInFrustum for a full bounding check\r\n * @param target The object to check\r\n * @param checkRigCameras If the rig cameras should be checked (eg. with webVR camera both eyes should be checked) (Default: false)\r\n * @returns true if the object is in frustum otherwise false\r\n */\r\n Camera.prototype.isInFrustum = function (target, checkRigCameras) {\r\n if (checkRigCameras === void 0) { checkRigCameras = false; }\r\n this._updateFrustumPlanes();\r\n if (checkRigCameras && this.rigCameras.length > 0) {\r\n var result = false;\r\n this.rigCameras.forEach(function (cam) {\r\n cam._updateFrustumPlanes();\r\n result = result || target.isInFrustum(cam._frustumPlanes);\r\n });\r\n return result;\r\n }\r\n else {\r\n return target.isInFrustum(this._frustumPlanes);\r\n }\r\n };\r\n /**\r\n * Checks if a cullable object (mesh...) is in the camera frustum\r\n * Unlike isInFrustum this cheks the full bounding box\r\n * @param target The object to check\r\n * @returns true if the object is in frustum otherwise false\r\n */\r\n Camera.prototype.isCompletelyInFrustum = function (target) {\r\n this._updateFrustumPlanes();\r\n return target.isCompletelyInFrustum(this._frustumPlanes);\r\n };\r\n /**\r\n * Gets a ray in the forward direction from the camera.\r\n * @param length Defines the length of the ray to create\r\n * @param transform Defines the transform to apply to the ray, by default the world matrx is used to create a workd space ray\r\n * @param origin Defines the start point of the ray which defaults to the camera position\r\n * @returns the forward ray\r\n */\r\n Camera.prototype.getForwardRay = function (length, transform, origin) {\r\n if (length === void 0) { length = 100; }\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Gets a ray in the forward direction from the camera.\r\n * @param refRay the ray to (re)use when setting the values\r\n * @param length Defines the length of the ray to create\r\n * @param transform Defines the transform to apply to the ray, by default the world matrx is used to create a workd space ray\r\n * @param origin Defines the start point of the ray which defaults to the camera position\r\n * @returns the forward ray\r\n */\r\n Camera.prototype.getForwardRayToRef = function (refRay, length, transform, origin) {\r\n if (length === void 0) { length = 100; }\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n Camera.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n // Observables\r\n this.onViewMatrixChangedObservable.clear();\r\n this.onProjectionMatrixChangedObservable.clear();\r\n this.onAfterCheckInputsObservable.clear();\r\n this.onRestoreStateObservable.clear();\r\n // Inputs\r\n if (this.inputs) {\r\n this.inputs.clear();\r\n }\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from scene\r\n this.getScene().removeCamera(this);\r\n while (this._rigCameras.length > 0) {\r\n var camera = this._rigCameras.pop();\r\n if (camera) {\r\n camera.dispose();\r\n }\r\n }\r\n // Postprocesses\r\n if (this._rigPostProcess) {\r\n this._rigPostProcess.dispose(this);\r\n this._rigPostProcess = null;\r\n this._postProcesses = [];\r\n }\r\n else if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n this._rigPostProcess = null;\r\n this._postProcesses = [];\r\n }\r\n else {\r\n var i = this._postProcesses.length;\r\n while (--i >= 0) {\r\n var postProcess = this._postProcesses[i];\r\n if (postProcess) {\r\n postProcess.dispose(this);\r\n }\r\n }\r\n }\r\n // Render targets\r\n var i = this.customRenderTargets.length;\r\n while (--i >= 0) {\r\n this.customRenderTargets[i].dispose();\r\n }\r\n this.customRenderTargets = [];\r\n // Active Meshes\r\n this._activeMeshes.dispose();\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n Object.defineProperty(Camera.prototype, \"isLeftCamera\", {\r\n /**\r\n * Gets the left camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n return this._isLeftCamera;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"isRightCamera\", {\r\n /**\r\n * Gets the right camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n return this._isRightCamera;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"leftCamera\", {\r\n /**\r\n * Gets the left camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n if (this._rigCameras.length < 1) {\r\n return null;\r\n }\r\n return this._rigCameras[0];\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Camera.prototype, \"rightCamera\", {\r\n /**\r\n * Gets the right camera of a rig setup in case of Rigged Camera\r\n */\r\n get: function () {\r\n if (this._rigCameras.length < 2) {\r\n return null;\r\n }\r\n return this._rigCameras[1];\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the left camera target of a rig setup in case of Rigged Camera\r\n * @returns the target position\r\n */\r\n Camera.prototype.getLeftTarget = function () {\r\n if (this._rigCameras.length < 1) {\r\n return null;\r\n }\r\n return this._rigCameras[0].getTarget();\r\n };\r\n /**\r\n * Gets the right camera target of a rig setup in case of Rigged Camera\r\n * @returns the target position\r\n */\r\n Camera.prototype.getRightTarget = function () {\r\n if (this._rigCameras.length < 2) {\r\n return null;\r\n }\r\n return this._rigCameras[1].getTarget();\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Camera.prototype.setCameraRigMode = function (mode, rigParams) {\r\n if (this.cameraRigMode === mode) {\r\n return;\r\n }\r\n while (this._rigCameras.length > 0) {\r\n var camera = this._rigCameras.pop();\r\n if (camera) {\r\n camera.dispose();\r\n }\r\n }\r\n this.cameraRigMode = mode;\r\n this._cameraRigParams = {};\r\n //we have to implement stereo camera calcultating left and right viewpoints from interaxialDistance and target,\r\n //not from a given angle as it is now, but until that complete code rewriting provisional stereoHalfAngle value is introduced\r\n this._cameraRigParams.interaxialDistance = rigParams.interaxialDistance || 0.0637;\r\n this._cameraRigParams.stereoHalfAngle = Tools.ToRadians(this._cameraRigParams.interaxialDistance / 0.0637);\r\n // create the rig cameras, unless none\r\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n var leftCamera = this.createRigCamera(this.name + \"_L\", 0);\r\n if (leftCamera) {\r\n leftCamera._isLeftCamera = true;\r\n }\r\n var rightCamera = this.createRigCamera(this.name + \"_R\", 1);\r\n if (rightCamera) {\r\n rightCamera._isRightCamera = true;\r\n }\r\n if (leftCamera && rightCamera) {\r\n this._rigCameras.push(leftCamera);\r\n this._rigCameras.push(rightCamera);\r\n }\r\n }\r\n switch (this.cameraRigMode) {\r\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n Camera._setStereoscopicAnaglyphRigMode(this);\r\n break;\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED:\r\n Camera._setStereoscopicRigMode(this);\r\n break;\r\n case Camera.RIG_MODE_VR:\r\n Camera._setVRRigMode(this, rigParams);\r\n break;\r\n case Camera.RIG_MODE_WEBVR:\r\n Camera._setWebVRRigMode(this, rigParams);\r\n break;\r\n }\r\n this._cascadePostProcessesToRigCams();\r\n this.update();\r\n };\r\n /** @hidden */\r\n Camera._setStereoscopicRigMode = function (camera) {\r\n throw \"Import Cameras/RigModes/stereoscopicRigMode before using stereoscopic rig mode\";\r\n };\r\n /** @hidden */\r\n Camera._setStereoscopicAnaglyphRigMode = function (camera) {\r\n throw \"Import Cameras/RigModes/stereoscopicAnaglyphRigMode before using stereoscopic anaglyph rig mode\";\r\n };\r\n /** @hidden */\r\n Camera._setVRRigMode = function (camera, rigParams) {\r\n throw \"Import Cameras/RigModes/vrRigMode before using VR rig mode\";\r\n };\r\n /** @hidden */\r\n Camera._setWebVRRigMode = function (camera, rigParams) {\r\n throw \"Import Cameras/RigModes/WebVRRigMode before using Web VR rig mode\";\r\n };\r\n /** @hidden */\r\n Camera.prototype._getVRProjectionMatrix = function () {\r\n Matrix.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov, this._cameraRigParams.vrMetrics.aspectRatio, this.minZ, this.maxZ, this._cameraRigParams.vrWorkMatrix);\r\n this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix, this._projectionMatrix);\r\n return this._projectionMatrix;\r\n };\r\n Camera.prototype._updateCameraRotationMatrix = function () {\r\n //Here for WebVR\r\n };\r\n Camera.prototype._updateWebVRCameraRotationMatrix = function () {\r\n //Here for WebVR\r\n };\r\n /**\r\n * This function MUST be overwritten by the different WebVR cameras available.\r\n * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.\r\n * @hidden\r\n */\r\n Camera.prototype._getWebVRProjectionMatrix = function () {\r\n return Matrix.Identity();\r\n };\r\n /**\r\n * This function MUST be overwritten by the different WebVR cameras available.\r\n * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.\r\n * @hidden\r\n */\r\n Camera.prototype._getWebVRViewMatrix = function () {\r\n return Matrix.Identity();\r\n };\r\n /** @hidden */\r\n Camera.prototype.setCameraRigParameter = function (name, value) {\r\n if (!this._cameraRigParams) {\r\n this._cameraRigParams = {};\r\n }\r\n this._cameraRigParams[name] = value;\r\n //provisionnally:\r\n if (name === \"interaxialDistance\") {\r\n this._cameraRigParams.stereoHalfAngle = Tools.ToRadians(value / 0.0637);\r\n }\r\n };\r\n /**\r\n * needs to be overridden by children so sub has required properties to be copied\r\n * @hidden\r\n */\r\n Camera.prototype.createRigCamera = function (name, cameraIndex) {\r\n return null;\r\n };\r\n /**\r\n * May need to be overridden by children\r\n * @hidden\r\n */\r\n Camera.prototype._updateRigCameras = function () {\r\n for (var i = 0; i < this._rigCameras.length; i++) {\r\n this._rigCameras[i].minZ = this.minZ;\r\n this._rigCameras[i].maxZ = this.maxZ;\r\n this._rigCameras[i].fov = this.fov;\r\n this._rigCameras[i].upVector.copyFrom(this.upVector);\r\n }\r\n // only update viewport when ANAGLYPH\r\n if (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH) {\r\n this._rigCameras[0].viewport = this._rigCameras[1].viewport = this.viewport;\r\n }\r\n };\r\n /** @hidden */\r\n Camera.prototype._setupInputs = function () {\r\n };\r\n /**\r\n * Serialiaze the camera setup to a json represention\r\n * @returns the JSON representation\r\n */\r\n Camera.prototype.serialize = function () {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n // Type\r\n serializationObject.type = this.getClassName();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n if (this.inputs) {\r\n this.inputs.serialize(serializationObject);\r\n }\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n serializationObject.ranges = this.serializeAnimationRanges();\r\n return serializationObject;\r\n };\r\n /**\r\n * Clones the current camera.\r\n * @param name The cloned camera name\r\n * @returns the cloned camera\r\n */\r\n Camera.prototype.clone = function (name) {\r\n return SerializationHelper.Clone(Camera.GetConstructorFromName(this.getClassName(), name, this.getScene(), this.interaxialDistance, this.isStereoscopicSideBySide), this);\r\n };\r\n /**\r\n * Gets the direction of the camera relative to a given local axis.\r\n * @param localAxis Defines the reference axis to provide a relative direction.\r\n * @return the direction\r\n */\r\n Camera.prototype.getDirection = function (localAxis) {\r\n var result = Vector3.Zero();\r\n this.getDirectionToRef(localAxis, result);\r\n return result;\r\n };\r\n Object.defineProperty(Camera.prototype, \"absoluteRotation\", {\r\n /**\r\n * Returns the current camera absolute rotation\r\n */\r\n get: function () {\r\n var result = Quaternion.Zero();\r\n this.getWorldMatrix().decompose(undefined, result);\r\n return result;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the direction of the camera relative to a given local axis into a passed vector.\r\n * @param localAxis Defines the reference axis to provide a relative direction.\r\n * @param result Defines the vector to store the result in\r\n */\r\n Camera.prototype.getDirectionToRef = function (localAxis, result) {\r\n Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);\r\n };\r\n /**\r\n * Gets a camera constructor for a given camera type\r\n * @param type The type of the camera to construct (should be equal to one of the camera class name)\r\n * @param name The name of the camera the result will be able to instantiate\r\n * @param scene The scene the result will construct the camera in\r\n * @param interaxial_distance In case of stereoscopic setup, the distance between both eyes\r\n * @param isStereoscopicSideBySide In case of stereoscopic setup, should the sereo be side b side\r\n * @returns a factory method to construc the camera\r\n */\r\n Camera.GetConstructorFromName = function (type, name, scene, interaxial_distance, isStereoscopicSideBySide) {\r\n if (interaxial_distance === void 0) { interaxial_distance = 0; }\r\n if (isStereoscopicSideBySide === void 0) { isStereoscopicSideBySide = true; }\r\n var constructorFunc = Node.Construct(type, name, scene, {\r\n interaxial_distance: interaxial_distance,\r\n isStereoscopicSideBySide: isStereoscopicSideBySide\r\n });\r\n if (constructorFunc) {\r\n return constructorFunc;\r\n }\r\n // Default to universal camera\r\n return function () { return Camera._createDefaultParsedCamera(name, scene); };\r\n };\r\n /**\r\n * Compute the world matrix of the camera.\r\n * @returns the camera world matrix\r\n */\r\n Camera.prototype.computeWorldMatrix = function () {\r\n return this.getWorldMatrix();\r\n };\r\n /**\r\n * Parse a JSON and creates the camera from the parsed information\r\n * @param parsedCamera The JSON to parse\r\n * @param scene The scene to instantiate the camera in\r\n * @returns the newly constructed camera\r\n */\r\n Camera.Parse = function (parsedCamera, scene) {\r\n var type = parsedCamera.type;\r\n var construct = Camera.GetConstructorFromName(type, parsedCamera.name, scene, parsedCamera.interaxial_distance, parsedCamera.isStereoscopicSideBySide);\r\n var camera = SerializationHelper.Parse(construct, parsedCamera, scene);\r\n // Parent\r\n if (parsedCamera.parentId) {\r\n camera._waitingParentId = parsedCamera.parentId;\r\n }\r\n //If camera has an input manager, let it parse inputs settings\r\n if (camera.inputs) {\r\n camera.inputs.parse(parsedCamera);\r\n camera._setupInputs();\r\n }\r\n if (parsedCamera.upVector) {\r\n camera.upVector = Vector3.FromArray(parsedCamera.upVector); // need to force the upVector\r\n }\r\n if (camera.setPosition) { // need to force position\r\n camera.position.copyFromFloats(0, 0, 0);\r\n camera.setPosition(Vector3.FromArray(parsedCamera.position));\r\n }\r\n // Target\r\n if (parsedCamera.target) {\r\n if (camera.setTarget) {\r\n camera.setTarget(Vector3.FromArray(parsedCamera.target));\r\n }\r\n }\r\n // Apply 3d rig, when found\r\n if (parsedCamera.cameraRigMode) {\r\n var rigParams = (parsedCamera.interaxial_distance) ? { interaxialDistance: parsedCamera.interaxial_distance } : {};\r\n camera.setCameraRigMode(parsedCamera.cameraRigMode, rigParams);\r\n }\r\n // Animations\r\n if (parsedCamera.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedCamera.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedCamera.animations[animationIndex];\r\n var internalClass = _TypeStore.GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n camera.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n Node.ParseAnimationRanges(camera, parsedCamera, scene);\r\n }\r\n if (parsedCamera.autoAnimate) {\r\n scene.beginAnimation(camera, parsedCamera.autoAnimateFrom, parsedCamera.autoAnimateTo, parsedCamera.autoAnimateLoop, parsedCamera.autoAnimateSpeed || 1.0);\r\n }\r\n return camera;\r\n };\r\n /** @hidden */\r\n Camera._createDefaultParsedCamera = function (name, scene) {\r\n throw _DevTools.WarnImport(\"UniversalCamera\");\r\n };\r\n /**\r\n * This is the default projection mode used by the cameras.\r\n * It helps recreating a feeling of perspective and better appreciate depth.\r\n * This is the best way to simulate real life cameras.\r\n */\r\n Camera.PERSPECTIVE_CAMERA = 0;\r\n /**\r\n * This helps creating camera with an orthographic mode.\r\n * Orthographic is commonly used in engineering as a means to produce object specifications that communicate dimensions unambiguously, each line of 1 unit length (cm, meter..whatever) will appear to have the same length everywhere on the drawing. This allows the drafter to dimension only a subset of lines and let the reader know that other lines of that length on the drawing are also that length in reality. Every parallel line in the drawing is also parallel in the object.\r\n */\r\n Camera.ORTHOGRAPHIC_CAMERA = 1;\r\n /**\r\n * This is the default FOV mode for perspective cameras.\r\n * This setting aligns the upper and lower bounds of the viewport to the upper and lower bounds of the camera frustum.\r\n */\r\n Camera.FOVMODE_VERTICAL_FIXED = 0;\r\n /**\r\n * This setting aligns the left and right bounds of the viewport to the left and right bounds of the camera frustum.\r\n */\r\n Camera.FOVMODE_HORIZONTAL_FIXED = 1;\r\n /**\r\n * This specifies ther is no need for a camera rig.\r\n * Basically only one eye is rendered corresponding to the camera.\r\n */\r\n Camera.RIG_MODE_NONE = 0;\r\n /**\r\n * Simulates a camera Rig with one blue eye and one red eye.\r\n * This can be use with 3d blue and red glasses.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH = 10;\r\n /**\r\n * Defines that both eyes of the camera will be rendered side by side with a parallel target.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL = 11;\r\n /**\r\n * Defines that both eyes of the camera will be rendered side by side with a none parallel target.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED = 12;\r\n /**\r\n * Defines that both eyes of the camera will be rendered over under each other.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER = 13;\r\n /**\r\n * Defines that both eyes of the camera will be rendered on successive lines interlaced for passive 3d monitors.\r\n */\r\n Camera.RIG_MODE_STEREOSCOPIC_INTERLACED = 14;\r\n /**\r\n * Defines that both eyes of the camera should be renderered in a VR mode (carbox).\r\n */\r\n Camera.RIG_MODE_VR = 20;\r\n /**\r\n * Defines that both eyes of the camera should be renderered in a VR mode (webVR).\r\n */\r\n Camera.RIG_MODE_WEBVR = 21;\r\n /**\r\n * Custom rig mode allowing rig cameras to be populated manually with any number of cameras\r\n */\r\n Camera.RIG_MODE_CUSTOM = 22;\r\n /**\r\n * Defines if by default attaching controls should prevent the default javascript event to continue.\r\n */\r\n Camera.ForceAttachControlToAlwaysPreventDefault = false;\r\n __decorate([\r\n serializeAsVector3(\"position\")\r\n ], Camera.prototype, \"_position\", void 0);\r\n __decorate([\r\n serializeAsVector3(\"upVector\")\r\n ], Camera.prototype, \"_upVector\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"orthoLeft\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"orthoRight\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"orthoBottom\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"orthoTop\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"fov\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"minZ\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"maxZ\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"inertia\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"mode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"layerMask\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"fovMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"cameraRigMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"interaxialDistance\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Camera.prototype, \"isStereoscopicSideBySide\", void 0);\r\n return Camera;\r\n}(Node));\r\nexport { Camera };\r\n//# sourceMappingURL=camera.js.map","import { Logger } from \"../Misc/logger\";\r\nimport { SerializationHelper } from \"../Misc/decorators\";\r\nimport { Camera } from \"./camera\";\r\n/**\r\n * @ignore\r\n * This is a list of all the different input types that are available in the application.\r\n * Fo instance: ArcRotateCameraGamepadInput...\r\n */\r\nexport var CameraInputTypes = {};\r\n/**\r\n * This represents the input manager used within a camera.\r\n * It helps dealing with all the different kind of input attached to a camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar CameraInputsManager = /** @class */ (function () {\r\n /**\r\n * Instantiate a new Camera Input Manager.\r\n * @param camera Defines the camera the input manager blongs to\r\n */\r\n function CameraInputsManager(camera) {\r\n /**\r\n * Defines the dom element the camera is collecting inputs from.\r\n * This is null if the controls have not been attached.\r\n */\r\n this.attachedToElement = false;\r\n this.attached = {};\r\n this.camera = camera;\r\n this.checkInputs = function () { };\r\n }\r\n /**\r\n * Add an input method to a camera\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n * @param input camera input method\r\n */\r\n CameraInputsManager.prototype.add = function (input) {\r\n var type = input.getSimpleName();\r\n if (this.attached[type]) {\r\n Logger.Warn(\"camera input of type \" + type + \" already exists on camera\");\r\n return;\r\n }\r\n this.attached[type] = input;\r\n input.camera = this.camera;\r\n //for checkInputs, we are dynamically creating a function\r\n //the goal is to avoid the performance penalty of looping for inputs in the render loop\r\n if (input.checkInputs) {\r\n this.checkInputs = this._addCheckInputs(input.checkInputs.bind(input));\r\n }\r\n if (this.attachedToElement) {\r\n input.attachControl();\r\n }\r\n };\r\n /**\r\n * Remove a specific input method from a camera\r\n * example: camera.inputs.remove(camera.inputs.attached.mouse);\r\n * @param inputToRemove camera input method\r\n */\r\n CameraInputsManager.prototype.remove = function (inputToRemove) {\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n if (input === inputToRemove) {\r\n input.detachControl();\r\n input.camera = null;\r\n delete this.attached[cam];\r\n this.rebuildInputCheck();\r\n }\r\n }\r\n };\r\n /**\r\n * Remove a specific input type from a camera\r\n * example: camera.inputs.remove(\"ArcRotateCameraGamepadInput\");\r\n * @param inputType the type of the input to remove\r\n */\r\n CameraInputsManager.prototype.removeByType = function (inputType) {\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n if (input.getClassName() === inputType) {\r\n input.detachControl();\r\n input.camera = null;\r\n delete this.attached[cam];\r\n this.rebuildInputCheck();\r\n }\r\n }\r\n };\r\n CameraInputsManager.prototype._addCheckInputs = function (fn) {\r\n var current = this.checkInputs;\r\n return function () {\r\n current();\r\n fn();\r\n };\r\n };\r\n /**\r\n * Attach the input controls to the currently attached dom element to listen the events from.\r\n * @param input Defines the input to attach\r\n */\r\n CameraInputsManager.prototype.attachInput = function (input) {\r\n if (this.attachedToElement) {\r\n input.attachControl(this.noPreventDefault);\r\n }\r\n };\r\n /**\r\n * Attach the current manager inputs controls to a specific dom element to listen the events from.\r\n * @param element Defines the dom element to collect the events from\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n CameraInputsManager.prototype.attachElement = function (noPreventDefault) {\r\n if (noPreventDefault === void 0) { noPreventDefault = false; }\r\n if (this.attachedToElement) {\r\n return;\r\n }\r\n noPreventDefault = Camera.ForceAttachControlToAlwaysPreventDefault ? false : noPreventDefault;\r\n this.attachedToElement = true;\r\n this.noPreventDefault = noPreventDefault;\r\n for (var cam in this.attached) {\r\n this.attached[cam].attachControl(noPreventDefault);\r\n }\r\n };\r\n /**\r\n * Detach the current manager inputs controls from a specific dom element.\r\n * @param element Defines the dom element to collect the events from\r\n * @param disconnect Defines whether the input should be removed from the current list of attached inputs\r\n */\r\n CameraInputsManager.prototype.detachElement = function (disconnect) {\r\n if (disconnect === void 0) { disconnect = false; }\r\n for (var cam in this.attached) {\r\n this.attached[cam].detachControl();\r\n if (disconnect) {\r\n this.attached[cam].camera = null;\r\n }\r\n }\r\n this.attachedToElement = false;\r\n };\r\n /**\r\n * Rebuild the dynamic inputCheck function from the current list of\r\n * defined inputs in the manager.\r\n */\r\n CameraInputsManager.prototype.rebuildInputCheck = function () {\r\n this.checkInputs = function () { };\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n if (input.checkInputs) {\r\n this.checkInputs = this._addCheckInputs(input.checkInputs.bind(input));\r\n }\r\n }\r\n };\r\n /**\r\n * Remove all attached input methods from a camera\r\n */\r\n CameraInputsManager.prototype.clear = function () {\r\n if (this.attachedToElement) {\r\n this.detachElement(true);\r\n }\r\n this.attached = {};\r\n this.attachedToElement = false;\r\n this.checkInputs = function () { };\r\n };\r\n /**\r\n * Serialize the current input manager attached to a camera.\r\n * This ensures than once parsed,\r\n * the input associated to the camera will be identical to the current ones\r\n * @param serializedCamera Defines the camera serialization JSON the input serialization should write to\r\n */\r\n CameraInputsManager.prototype.serialize = function (serializedCamera) {\r\n var inputs = {};\r\n for (var cam in this.attached) {\r\n var input = this.attached[cam];\r\n var res = SerializationHelper.Serialize(input);\r\n inputs[input.getClassName()] = res;\r\n }\r\n serializedCamera.inputsmgr = inputs;\r\n };\r\n /**\r\n * Parses an input manager serialized JSON to restore the previous list of inputs\r\n * and states associated to a camera.\r\n * @param parsedCamera Defines the JSON to parse\r\n */\r\n CameraInputsManager.prototype.parse = function (parsedCamera) {\r\n var parsedInputs = parsedCamera.inputsmgr;\r\n if (parsedInputs) {\r\n this.clear();\r\n for (var n in parsedInputs) {\r\n var construct = CameraInputTypes[n];\r\n if (construct) {\r\n var parsedinput = parsedInputs[n];\r\n var input = SerializationHelper.Parse(function () {\r\n return new construct();\r\n }, parsedinput, null);\r\n this.add(input);\r\n }\r\n }\r\n }\r\n else {\r\n //2016-03-08 this part is for managing backward compatibility\r\n for (var n in this.attached) {\r\n var construct = CameraInputTypes[this.attached[n].getClassName()];\r\n if (construct) {\r\n var input = SerializationHelper.Parse(function () {\r\n return new construct();\r\n }, parsedCamera, null);\r\n this.remove(this.attached[n]);\r\n this.add(input);\r\n }\r\n }\r\n }\r\n };\r\n return CameraInputsManager;\r\n}());\r\nexport { CameraInputsManager };\r\n//# sourceMappingURL=cameraInputsManager.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, serializeAsVector3, serializeAsMeshReference } from \"../Misc/decorators\";\r\nimport { Camera } from \"./camera\";\r\nimport { Quaternion, Matrix, Vector3, Vector2, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Epsilon } from '../Maths/math.constants';\r\nimport { Axis } from '../Maths/math.axis';\r\n/**\r\n * A target camera takes a mesh or position as a target and continues to look at it while it moves.\r\n * This is the base of the follow, arc rotate cameras and Free camera\r\n * @see https://doc.babylonjs.com/features/cameras\r\n */\r\nvar TargetCamera = /** @class */ (function (_super) {\r\n __extends(TargetCamera, _super);\r\n /**\r\n * Instantiates a target camera that takes a mesh or position as a target and continues to look at it while it moves.\r\n * This is the base of the follow, arc rotate cameras and Free camera\r\n * @see https://doc.babylonjs.com/features/cameras\r\n * @param name Defines the name of the camera in the scene\r\n * @param position Defines the start position of the camera in the scene\r\n * @param scene Defines the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active if not other active cameras have been defined\r\n */\r\n function TargetCamera(name, position, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, position, scene, setActiveOnSceneIfNoneActive) || this;\r\n _this._tmpUpVector = Vector3.Zero();\r\n _this._tmpTargetVector = Vector3.Zero();\r\n /**\r\n * Define the current direction the camera is moving to\r\n */\r\n _this.cameraDirection = new Vector3(0, 0, 0);\r\n /**\r\n * Define the current rotation the camera is rotating to\r\n */\r\n _this.cameraRotation = new Vector2(0, 0);\r\n /** Gets or sets a boolean indicating that the scaling of the parent hierarchy will not be taken in account by the camera */\r\n _this.ignoreParentScaling = false;\r\n /**\r\n * When set, the up vector of the camera will be updated by the rotation of the camera\r\n */\r\n _this.updateUpVectorFromRotation = false;\r\n _this._tmpQuaternion = new Quaternion();\r\n /**\r\n * Define the current rotation of the camera\r\n */\r\n _this.rotation = new Vector3(0, 0, 0);\r\n /**\r\n * Define the current speed of the camera\r\n */\r\n _this.speed = 2.0;\r\n /**\r\n * Add constraint to the camera to prevent it to move freely in all directions and\r\n * around all axis.\r\n */\r\n _this.noRotationConstraint = false;\r\n /**\r\n * Reverses mouselook direction to 'natural' panning as opposed to traditional direct\r\n * panning\r\n */\r\n _this.invertRotation = false;\r\n /**\r\n * Speed multiplier for inverse camera panning\r\n */\r\n _this.inverseRotationSpeed = 0.2;\r\n /**\r\n * Define the current target of the camera as an object or a position.\r\n */\r\n _this.lockedTarget = null;\r\n /** @hidden */\r\n _this._currentTarget = Vector3.Zero();\r\n /** @hidden */\r\n _this._initialFocalDistance = 1;\r\n /** @hidden */\r\n _this._viewMatrix = Matrix.Zero();\r\n /** @hidden */\r\n _this._camMatrix = Matrix.Zero();\r\n /** @hidden */\r\n _this._cameraTransformMatrix = Matrix.Zero();\r\n /** @hidden */\r\n _this._cameraRotationMatrix = Matrix.Zero();\r\n /** @hidden */\r\n _this._referencePoint = new Vector3(0, 0, 1);\r\n /** @hidden */\r\n _this._transformedReferencePoint = Vector3.Zero();\r\n _this._defaultUp = Vector3.Up();\r\n _this._cachedRotationZ = 0;\r\n _this._cachedQuaternionRotationZ = 0;\r\n return _this;\r\n }\r\n /**\r\n * Gets the position in front of the camera at a given distance.\r\n * @param distance The distance from the camera we want the position to be\r\n * @returns the position\r\n */\r\n TargetCamera.prototype.getFrontPosition = function (distance) {\r\n this.getWorldMatrix();\r\n var direction = this.getTarget().subtract(this.position);\r\n direction.normalize();\r\n direction.scaleInPlace(distance);\r\n return this.globalPosition.add(direction);\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._getLockedTargetPosition = function () {\r\n if (!this.lockedTarget) {\r\n return null;\r\n }\r\n if (this.lockedTarget.absolutePosition) {\r\n this.lockedTarget.computeWorldMatrix();\r\n }\r\n return this.lockedTarget.absolutePosition || this.lockedTarget;\r\n };\r\n /**\r\n * Store current camera state of the camera (fov, position, rotation, etc..)\r\n * @returns the camera\r\n */\r\n TargetCamera.prototype.storeState = function () {\r\n this._storedPosition = this.position.clone();\r\n this._storedRotation = this.rotation.clone();\r\n if (this.rotationQuaternion) {\r\n this._storedRotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n return _super.prototype.storeState.call(this);\r\n };\r\n /**\r\n * Restored camera state. You must call storeState() first\r\n * @returns whether it was successful or not\r\n * @hidden\r\n */\r\n TargetCamera.prototype._restoreStateValues = function () {\r\n if (!_super.prototype._restoreStateValues.call(this)) {\r\n return false;\r\n }\r\n this.position = this._storedPosition.clone();\r\n this.rotation = this._storedRotation.clone();\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion = this._storedRotationQuaternion.clone();\r\n }\r\n this.cameraDirection.copyFromFloats(0, 0, 0);\r\n this.cameraRotation.copyFromFloats(0, 0);\r\n return true;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache.lockedTarget = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.rotation = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n this._cache.rotationQuaternion = new Quaternion(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._updateCache = function (ignoreParentClass) {\r\n if (!ignoreParentClass) {\r\n _super.prototype._updateCache.call(this);\r\n }\r\n var lockedTargetPosition = this._getLockedTargetPosition();\r\n if (!lockedTargetPosition) {\r\n this._cache.lockedTarget = null;\r\n }\r\n else {\r\n if (!this._cache.lockedTarget) {\r\n this._cache.lockedTarget = lockedTargetPosition.clone();\r\n }\r\n else {\r\n this._cache.lockedTarget.copyFrom(lockedTargetPosition);\r\n }\r\n }\r\n this._cache.rotation.copyFrom(this.rotation);\r\n if (this.rotationQuaternion) {\r\n this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n }\r\n };\r\n // Synchronized\r\n /** @hidden */\r\n TargetCamera.prototype._isSynchronizedViewMatrix = function () {\r\n if (!_super.prototype._isSynchronizedViewMatrix.call(this)) {\r\n return false;\r\n }\r\n var lockedTargetPosition = this._getLockedTargetPosition();\r\n return (this._cache.lockedTarget ? this._cache.lockedTarget.equals(lockedTargetPosition) : !lockedTargetPosition)\r\n && (this.rotationQuaternion ? this.rotationQuaternion.equals(this._cache.rotationQuaternion) : this._cache.rotation.equals(this.rotation));\r\n };\r\n // Methods\r\n /** @hidden */\r\n TargetCamera.prototype._computeLocalCameraSpeed = function () {\r\n var engine = this.getEngine();\r\n return this.speed * Math.sqrt((engine.getDeltaTime() / (engine.getFps() * 100.0)));\r\n };\r\n // Target\r\n /**\r\n * Defines the target the camera should look at.\r\n * @param target Defines the new target as a Vector or a mesh\r\n */\r\n TargetCamera.prototype.setTarget = function (target) {\r\n this.upVector.normalize();\r\n this._initialFocalDistance = target.subtract(this.position).length();\r\n if (this.position.z === target.z) {\r\n this.position.z += Epsilon;\r\n }\r\n this._referencePoint.normalize().scaleInPlace(this._initialFocalDistance);\r\n Matrix.LookAtLHToRef(this.position, target, this._defaultUp, this._camMatrix);\r\n this._camMatrix.invert();\r\n this.rotation.x = Math.atan(this._camMatrix.m[6] / this._camMatrix.m[10]);\r\n var vDir = target.subtract(this.position);\r\n if (vDir.x >= 0.0) {\r\n this.rotation.y = (-Math.atan(vDir.z / vDir.x) + Math.PI / 2.0);\r\n }\r\n else {\r\n this.rotation.y = (-Math.atan(vDir.z / vDir.x) - Math.PI / 2.0);\r\n }\r\n this.rotation.z = 0;\r\n if (isNaN(this.rotation.x)) {\r\n this.rotation.x = 0;\r\n }\r\n if (isNaN(this.rotation.y)) {\r\n this.rotation.y = 0;\r\n }\r\n if (isNaN(this.rotation.z)) {\r\n this.rotation.z = 0;\r\n }\r\n if (this.rotationQuaternion) {\r\n Quaternion.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion);\r\n }\r\n };\r\n Object.defineProperty(TargetCamera.prototype, \"target\", {\r\n /**\r\n * Defines the target point of the camera.\r\n * The camera looks towards it form the radius distance.\r\n */\r\n get: function () {\r\n return this.getTarget();\r\n },\r\n set: function (value) {\r\n this.setTarget(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Return the current target position of the camera. This value is expressed in local space.\r\n * @returns the target position\r\n */\r\n TargetCamera.prototype.getTarget = function () {\r\n return this._currentTarget;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._decideIfNeedsToMove = function () {\r\n return Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._updatePosition = function () {\r\n if (this.parent) {\r\n this.parent.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]);\r\n Vector3.TransformNormalToRef(this.cameraDirection, TmpVectors.Matrix[0], TmpVectors.Vector3[0]);\r\n this.position.addInPlace(TmpVectors.Vector3[0]);\r\n return;\r\n }\r\n this.position.addInPlace(this.cameraDirection);\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._checkInputs = function () {\r\n var directionMultiplier = this.invertRotation ? -this.inverseRotationSpeed : 1.0;\r\n var needToMove = this._decideIfNeedsToMove();\r\n var needToRotate = Math.abs(this.cameraRotation.x) > 0 || Math.abs(this.cameraRotation.y) > 0;\r\n // Move\r\n if (needToMove) {\r\n this._updatePosition();\r\n }\r\n // Rotate\r\n if (needToRotate) {\r\n //rotate, if quaternion is set and rotation was used\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion.toEulerAnglesToRef(this.rotation);\r\n }\r\n this.rotation.x += this.cameraRotation.x * directionMultiplier;\r\n this.rotation.y += this.cameraRotation.y * directionMultiplier;\r\n // Apply constraints\r\n if (!this.noRotationConstraint) {\r\n var limit = 1.570796;\r\n if (this.rotation.x > limit) {\r\n this.rotation.x = limit;\r\n }\r\n if (this.rotation.x < -limit) {\r\n this.rotation.x = -limit;\r\n }\r\n }\r\n //rotate, if quaternion is set and rotation was used\r\n if (this.rotationQuaternion) {\r\n var len = this.rotation.lengthSquared();\r\n if (len) {\r\n Quaternion.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion);\r\n }\r\n }\r\n }\r\n // Inertia\r\n if (needToMove) {\r\n if (Math.abs(this.cameraDirection.x) < this.speed * Epsilon) {\r\n this.cameraDirection.x = 0;\r\n }\r\n if (Math.abs(this.cameraDirection.y) < this.speed * Epsilon) {\r\n this.cameraDirection.y = 0;\r\n }\r\n if (Math.abs(this.cameraDirection.z) < this.speed * Epsilon) {\r\n this.cameraDirection.z = 0;\r\n }\r\n this.cameraDirection.scaleInPlace(this.inertia);\r\n }\r\n if (needToRotate) {\r\n if (Math.abs(this.cameraRotation.x) < this.speed * Epsilon) {\r\n this.cameraRotation.x = 0;\r\n }\r\n if (Math.abs(this.cameraRotation.y) < this.speed * Epsilon) {\r\n this.cameraRotation.y = 0;\r\n }\r\n this.cameraRotation.scaleInPlace(this.inertia);\r\n }\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n TargetCamera.prototype._updateCameraRotationMatrix = function () {\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix);\r\n }\r\n else {\r\n Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);\r\n }\r\n };\r\n /**\r\n * Update the up vector to apply the rotation of the camera (So if you changed the camera rotation.z this will let you update the up vector as well)\r\n * @returns the current camera\r\n */\r\n TargetCamera.prototype._rotateUpVectorWithCameraRotationMatrix = function () {\r\n Vector3.TransformNormalToRef(this._defaultUp, this._cameraRotationMatrix, this.upVector);\r\n return this;\r\n };\r\n /** @hidden */\r\n TargetCamera.prototype._getViewMatrix = function () {\r\n if (this.lockedTarget) {\r\n this.setTarget(this._getLockedTargetPosition());\r\n }\r\n // Compute\r\n this._updateCameraRotationMatrix();\r\n // Apply the changed rotation to the upVector\r\n if (this.rotationQuaternion && this._cachedQuaternionRotationZ != this.rotationQuaternion.z) {\r\n this._rotateUpVectorWithCameraRotationMatrix();\r\n this._cachedQuaternionRotationZ = this.rotationQuaternion.z;\r\n }\r\n else if (this._cachedRotationZ != this.rotation.z) {\r\n this._rotateUpVectorWithCameraRotationMatrix();\r\n this._cachedRotationZ = this.rotation.z;\r\n }\r\n Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);\r\n // Computing target and final matrix\r\n this.position.addToRef(this._transformedReferencePoint, this._currentTarget);\r\n if (this.updateUpVectorFromRotation) {\r\n if (this.rotationQuaternion) {\r\n Axis.Y.rotateByQuaternionToRef(this.rotationQuaternion, this.upVector);\r\n }\r\n else {\r\n Quaternion.FromEulerVectorToRef(this.rotation, this._tmpQuaternion);\r\n Axis.Y.rotateByQuaternionToRef(this._tmpQuaternion, this.upVector);\r\n }\r\n }\r\n this._computeViewMatrix(this.position, this._currentTarget, this.upVector);\r\n return this._viewMatrix;\r\n };\r\n TargetCamera.prototype._computeViewMatrix = function (position, target, up) {\r\n if (this.ignoreParentScaling) {\r\n if (this.parent) {\r\n var parentWorldMatrix = this.parent.getWorldMatrix();\r\n Vector3.TransformCoordinatesToRef(position, parentWorldMatrix, this._globalPosition);\r\n Vector3.TransformCoordinatesToRef(target, parentWorldMatrix, this._tmpTargetVector);\r\n Vector3.TransformNormalToRef(up, parentWorldMatrix, this._tmpUpVector);\r\n this._markSyncedWithParent();\r\n }\r\n else {\r\n this._globalPosition.copyFrom(position);\r\n this._tmpTargetVector.copyFrom(target);\r\n this._tmpUpVector.copyFrom(up);\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n Matrix.LookAtRHToRef(this._globalPosition, this._tmpTargetVector, this._tmpUpVector, this._viewMatrix);\r\n }\r\n else {\r\n Matrix.LookAtLHToRef(this._globalPosition, this._tmpTargetVector, this._tmpUpVector, this._viewMatrix);\r\n }\r\n return;\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n Matrix.LookAtRHToRef(position, target, up, this._viewMatrix);\r\n }\r\n else {\r\n Matrix.LookAtLHToRef(position, target, up, this._viewMatrix);\r\n }\r\n if (this.parent) {\r\n var parentWorldMatrix = this.parent.getWorldMatrix();\r\n this._viewMatrix.invert();\r\n this._viewMatrix.multiplyToRef(parentWorldMatrix, this._viewMatrix);\r\n this._viewMatrix.getTranslationToRef(this._globalPosition);\r\n this._viewMatrix.invert();\r\n this._markSyncedWithParent();\r\n }\r\n else {\r\n this._globalPosition.copyFrom(position);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n */\r\n TargetCamera.prototype.createRigCamera = function (name, cameraIndex) {\r\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n var rigCamera = new TargetCamera(name, this.position.clone(), this.getScene());\r\n rigCamera.isRigCamera = true;\r\n rigCamera.rigParent = this;\r\n if (this.cameraRigMode === Camera.RIG_MODE_VR || this.cameraRigMode === Camera.RIG_MODE_WEBVR) {\r\n if (!this.rotationQuaternion) {\r\n this.rotationQuaternion = new Quaternion();\r\n }\r\n rigCamera._cameraRigParams = {};\r\n rigCamera.rotationQuaternion = new Quaternion();\r\n }\r\n return rigCamera;\r\n }\r\n return null;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n TargetCamera.prototype._updateRigCameras = function () {\r\n var camLeft = this._rigCameras[0];\r\n var camRight = this._rigCameras[1];\r\n this.computeWorldMatrix();\r\n switch (this.cameraRigMode) {\r\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\r\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\r\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\r\n case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED:\r\n //provisionnaly using _cameraRigParams.stereoHalfAngle instead of calculations based on _cameraRigParams.interaxialDistance:\r\n var leftSign = (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? 1 : -1;\r\n var rightSign = (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? -1 : 1;\r\n this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * leftSign, camLeft);\r\n this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * rightSign, camRight);\r\n break;\r\n case Camera.RIG_MODE_VR:\r\n if (camLeft.rotationQuaternion) {\r\n camLeft.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n camRight.rotationQuaternion.copyFrom(this.rotationQuaternion);\r\n }\r\n else {\r\n camLeft.rotation.copyFrom(this.rotation);\r\n camRight.rotation.copyFrom(this.rotation);\r\n }\r\n camLeft.position.copyFrom(this.position);\r\n camRight.position.copyFrom(this.position);\r\n break;\r\n }\r\n _super.prototype._updateRigCameras.call(this);\r\n };\r\n TargetCamera.prototype._getRigCamPositionAndTarget = function (halfSpace, rigCamera) {\r\n var target = this.getTarget();\r\n target.subtractToRef(this.position, TargetCamera._TargetFocalPoint);\r\n TargetCamera._TargetFocalPoint.normalize().scaleInPlace(this._initialFocalDistance);\r\n var newFocalTarget = TargetCamera._TargetFocalPoint.addInPlace(this.position);\r\n Matrix.TranslationToRef(-newFocalTarget.x, -newFocalTarget.y, -newFocalTarget.z, TargetCamera._TargetTransformMatrix);\r\n TargetCamera._TargetTransformMatrix.multiplyToRef(Matrix.RotationAxis(rigCamera.upVector, halfSpace), TargetCamera._RigCamTransformMatrix);\r\n Matrix.TranslationToRef(newFocalTarget.x, newFocalTarget.y, newFocalTarget.z, TargetCamera._TargetTransformMatrix);\r\n TargetCamera._RigCamTransformMatrix.multiplyToRef(TargetCamera._TargetTransformMatrix, TargetCamera._RigCamTransformMatrix);\r\n Vector3.TransformCoordinatesToRef(this.position, TargetCamera._RigCamTransformMatrix, rigCamera.position);\r\n rigCamera.setTarget(newFocalTarget);\r\n };\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n TargetCamera.prototype.getClassName = function () {\r\n return \"TargetCamera\";\r\n };\r\n TargetCamera._RigCamTransformMatrix = new Matrix();\r\n TargetCamera._TargetTransformMatrix = new Matrix();\r\n TargetCamera._TargetFocalPoint = new Vector3();\r\n __decorate([\r\n serializeAsVector3()\r\n ], TargetCamera.prototype, \"rotation\", void 0);\r\n __decorate([\r\n serialize()\r\n ], TargetCamera.prototype, \"speed\", void 0);\r\n __decorate([\r\n serializeAsMeshReference(\"lockedTargetId\")\r\n ], TargetCamera.prototype, \"lockedTarget\", void 0);\r\n return TargetCamera;\r\n}(Camera));\r\nexport { TargetCamera };\r\n//# sourceMappingURL=targetCamera.js.map","/**\r\n * @hidden\r\n */\r\nvar IntersectionInfo = /** @class */ (function () {\r\n function IntersectionInfo(bu, bv, distance) {\r\n this.bu = bu;\r\n this.bv = bv;\r\n this.distance = distance;\r\n this.faceId = 0;\r\n this.subMeshId = 0;\r\n }\r\n return IntersectionInfo;\r\n}());\r\nexport { IntersectionInfo };\r\n//# sourceMappingURL=intersectionInfo.js.map","import { Vector3, Vector2, TmpVectors } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\n/**\r\n * Information about the result of picking within a scene\r\n * @see https://doc.babylonjs.com/babylon101/picking_collisions\r\n */\r\nvar PickingInfo = /** @class */ (function () {\r\n function PickingInfo() {\r\n /** @hidden */\r\n this._pickingUnavailable = false;\r\n /**\r\n * If the pick collided with an object\r\n */\r\n this.hit = false;\r\n /**\r\n * Distance away where the pick collided\r\n */\r\n this.distance = 0;\r\n /**\r\n * The location of pick collision\r\n */\r\n this.pickedPoint = null;\r\n /**\r\n * The mesh corresponding the the pick collision\r\n */\r\n this.pickedMesh = null;\r\n /** (See getTextureCoordinates) The barycentric U coordinate that is used when calculating the texture coordinates of the collision.*/\r\n this.bu = 0;\r\n /** (See getTextureCoordinates) The barycentric V coordinate that is used when calculating the texture coordinates of the collision.*/\r\n this.bv = 0;\r\n /** The index of the face on the mesh that was picked, or the index of the Line if the picked Mesh is a LinesMesh */\r\n this.faceId = -1;\r\n /** The index of the face on the subMesh that was picked, or the index of the Line if the picked Mesh is a LinesMesh */\r\n this.subMeshFaceId = -1;\r\n /** Id of the the submesh that was picked */\r\n this.subMeshId = 0;\r\n /** If a sprite was picked, this will be the sprite the pick collided with */\r\n this.pickedSprite = null;\r\n /** If we are pikcing a mesh with thin instance, this will give you the picked thin instance */\r\n this.thinInstanceIndex = -1;\r\n /**\r\n * If a mesh was used to do the picking (eg. 6dof controller) this will be populated.\r\n */\r\n this.originMesh = null;\r\n /**\r\n * The ray that was used to perform the picking.\r\n */\r\n this.ray = null;\r\n }\r\n /**\r\n * Gets the normal correspodning to the face the pick collided with\r\n * @param useWorldCoordinates If the resulting normal should be relative to the world (default: false)\r\n * @param useVerticesNormals If the vertices normals should be used to calculate the normal instead of the normal map\r\n * @returns The normal correspodning to the face the pick collided with\r\n */\r\n PickingInfo.prototype.getNormal = function (useWorldCoordinates, useVerticesNormals) {\r\n if (useWorldCoordinates === void 0) { useWorldCoordinates = false; }\r\n if (useVerticesNormals === void 0) { useVerticesNormals = true; }\r\n if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n return null;\r\n }\r\n var indices = this.pickedMesh.getIndices();\r\n if (!indices) {\r\n return null;\r\n }\r\n var result;\r\n if (useVerticesNormals) {\r\n var normals = this.pickedMesh.getVerticesData(VertexBuffer.NormalKind);\r\n var normal0 = Vector3.FromArray(normals, indices[this.faceId * 3] * 3);\r\n var normal1 = Vector3.FromArray(normals, indices[this.faceId * 3 + 1] * 3);\r\n var normal2 = Vector3.FromArray(normals, indices[this.faceId * 3 + 2] * 3);\r\n normal0 = normal0.scale(this.bu);\r\n normal1 = normal1.scale(this.bv);\r\n normal2 = normal2.scale(1.0 - this.bu - this.bv);\r\n result = new Vector3(normal0.x + normal1.x + normal2.x, normal0.y + normal1.y + normal2.y, normal0.z + normal1.z + normal2.z);\r\n }\r\n else {\r\n var positions = this.pickedMesh.getVerticesData(VertexBuffer.PositionKind);\r\n var vertex1 = Vector3.FromArray(positions, indices[this.faceId * 3] * 3);\r\n var vertex2 = Vector3.FromArray(positions, indices[this.faceId * 3 + 1] * 3);\r\n var vertex3 = Vector3.FromArray(positions, indices[this.faceId * 3 + 2] * 3);\r\n var p1p2 = vertex1.subtract(vertex2);\r\n var p3p2 = vertex3.subtract(vertex2);\r\n result = Vector3.Cross(p1p2, p3p2);\r\n }\r\n if (useWorldCoordinates) {\r\n var wm = this.pickedMesh.getWorldMatrix();\r\n if (this.pickedMesh.nonUniformScaling) {\r\n TmpVectors.Matrix[0].copyFrom(wm);\r\n wm = TmpVectors.Matrix[0];\r\n wm.setTranslationFromFloats(0, 0, 0);\r\n wm.invert();\r\n wm.transposeToRef(TmpVectors.Matrix[1]);\r\n wm = TmpVectors.Matrix[1];\r\n }\r\n result = Vector3.TransformNormal(result, wm);\r\n }\r\n result.normalize();\r\n return result;\r\n };\r\n /**\r\n * Gets the texture coordinates of where the pick occured\r\n * @returns the vector containing the coordnates of the texture\r\n */\r\n PickingInfo.prototype.getTextureCoordinates = function () {\r\n if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n return null;\r\n }\r\n var indices = this.pickedMesh.getIndices();\r\n if (!indices) {\r\n return null;\r\n }\r\n var uvs = this.pickedMesh.getVerticesData(VertexBuffer.UVKind);\r\n if (!uvs) {\r\n return null;\r\n }\r\n var uv0 = Vector2.FromArray(uvs, indices[this.faceId * 3] * 2);\r\n var uv1 = Vector2.FromArray(uvs, indices[this.faceId * 3 + 1] * 2);\r\n var uv2 = Vector2.FromArray(uvs, indices[this.faceId * 3 + 2] * 2);\r\n uv0 = uv0.scale(this.bu);\r\n uv1 = uv1.scale(this.bv);\r\n uv2 = uv2.scale(1.0 - this.bu - this.bv);\r\n return new Vector2(uv0.x + uv1.x + uv2.x, uv0.y + uv1.y + uv2.y);\r\n };\r\n return PickingInfo;\r\n}());\r\nexport { PickingInfo };\r\n//# sourceMappingURL=pickingInfo.js.map","import { ArrayTools } from \"../Misc/arrayTools\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Epsilon } from '../Maths/math.constants';\r\n/**\r\n * Class used to store bounding box information\r\n */\r\nvar BoundingBox = /** @class */ (function () {\r\n /**\r\n * Creates a new bounding box\r\n * @param min defines the minimum vector (in local space)\r\n * @param max defines the maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n function BoundingBox(min, max, worldMatrix) {\r\n /**\r\n * Gets the 8 vectors representing the bounding box in local space\r\n */\r\n this.vectors = ArrayTools.BuildArray(8, Vector3.Zero);\r\n /**\r\n * Gets the center of the bounding box in local space\r\n */\r\n this.center = Vector3.Zero();\r\n /**\r\n * Gets the center of the bounding box in world space\r\n */\r\n this.centerWorld = Vector3.Zero();\r\n /**\r\n * Gets the extend size in local space\r\n */\r\n this.extendSize = Vector3.Zero();\r\n /**\r\n * Gets the extend size in world space\r\n */\r\n this.extendSizeWorld = Vector3.Zero();\r\n /**\r\n * Gets the OBB (object bounding box) directions\r\n */\r\n this.directions = ArrayTools.BuildArray(3, Vector3.Zero);\r\n /**\r\n * Gets the 8 vectors representing the bounding box in world space\r\n */\r\n this.vectorsWorld = ArrayTools.BuildArray(8, Vector3.Zero);\r\n /**\r\n * Gets the minimum vector in world space\r\n */\r\n this.minimumWorld = Vector3.Zero();\r\n /**\r\n * Gets the maximum vector in world space\r\n */\r\n this.maximumWorld = Vector3.Zero();\r\n /**\r\n * Gets the minimum vector in local space\r\n */\r\n this.minimum = Vector3.Zero();\r\n /**\r\n * Gets the maximum vector in local space\r\n */\r\n this.maximum = Vector3.Zero();\r\n this.reConstruct(min, max, worldMatrix);\r\n }\r\n // Methods\r\n /**\r\n * Recreates the entire bounding box from scratch as if we call the constructor in place\r\n * @param min defines the new minimum vector (in local space)\r\n * @param max defines the new maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n BoundingBox.prototype.reConstruct = function (min, max, worldMatrix) {\r\n var minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\r\n var vectors = this.vectors;\r\n this.minimum.copyFromFloats(minX, minY, minZ);\r\n this.maximum.copyFromFloats(maxX, maxY, maxZ);\r\n vectors[0].copyFromFloats(minX, minY, minZ);\r\n vectors[1].copyFromFloats(maxX, maxY, maxZ);\r\n vectors[2].copyFromFloats(maxX, minY, minZ);\r\n vectors[3].copyFromFloats(minX, maxY, minZ);\r\n vectors[4].copyFromFloats(minX, minY, maxZ);\r\n vectors[5].copyFromFloats(maxX, maxY, minZ);\r\n vectors[6].copyFromFloats(minX, maxY, maxZ);\r\n vectors[7].copyFromFloats(maxX, minY, maxZ);\r\n // OBB\r\n max.addToRef(min, this.center).scaleInPlace(0.5);\r\n max.subtractToRef(min, this.extendSize).scaleInPlace(0.5);\r\n this._worldMatrix = worldMatrix || Matrix.IdentityReadOnly;\r\n this._update(this._worldMatrix);\r\n };\r\n /**\r\n * Scale the current bounding box by applying a scale factor\r\n * @param factor defines the scale factor to apply\r\n * @returns the current bounding box\r\n */\r\n BoundingBox.prototype.scale = function (factor) {\r\n var tmpVectors = BoundingBox.TmpVector3;\r\n var diff = this.maximum.subtractToRef(this.minimum, tmpVectors[0]);\r\n var len = diff.length();\r\n diff.normalizeFromLength(len);\r\n var distance = len * factor;\r\n var newRadius = diff.scaleInPlace(distance * 0.5);\r\n var min = this.center.subtractToRef(newRadius, tmpVectors[1]);\r\n var max = this.center.addToRef(newRadius, tmpVectors[2]);\r\n this.reConstruct(min, max, this._worldMatrix);\r\n return this;\r\n };\r\n /**\r\n * Gets the world matrix of the bounding box\r\n * @returns a matrix\r\n */\r\n BoundingBox.prototype.getWorldMatrix = function () {\r\n return this._worldMatrix;\r\n };\r\n /** @hidden */\r\n BoundingBox.prototype._update = function (world) {\r\n var minWorld = this.minimumWorld;\r\n var maxWorld = this.maximumWorld;\r\n var directions = this.directions;\r\n var vectorsWorld = this.vectorsWorld;\r\n var vectors = this.vectors;\r\n if (!world.isIdentity()) {\r\n minWorld.setAll(Number.MAX_VALUE);\r\n maxWorld.setAll(-Number.MAX_VALUE);\r\n for (var index = 0; index < 8; ++index) {\r\n var v = vectorsWorld[index];\r\n Vector3.TransformCoordinatesToRef(vectors[index], world, v);\r\n minWorld.minimizeInPlace(v);\r\n maxWorld.maximizeInPlace(v);\r\n }\r\n // Extend\r\n maxWorld.subtractToRef(minWorld, this.extendSizeWorld).scaleInPlace(0.5);\r\n maxWorld.addToRef(minWorld, this.centerWorld).scaleInPlace(0.5);\r\n }\r\n else {\r\n minWorld.copyFrom(this.minimum);\r\n maxWorld.copyFrom(this.maximum);\r\n for (var index = 0; index < 8; ++index) {\r\n vectorsWorld[index].copyFrom(vectors[index]);\r\n }\r\n // Extend\r\n this.extendSizeWorld.copyFrom(this.extendSize);\r\n this.centerWorld.copyFrom(this.center);\r\n }\r\n Vector3.FromArrayToRef(world.m, 0, directions[0]);\r\n Vector3.FromArrayToRef(world.m, 4, directions[1]);\r\n Vector3.FromArrayToRef(world.m, 8, directions[2]);\r\n this._worldMatrix = world;\r\n };\r\n /**\r\n * Tests if the bounding box is intersecting the frustum planes\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.prototype.isInFrustum = function (frustumPlanes) {\r\n return BoundingBox.IsInFrustum(this.vectorsWorld, frustumPlanes);\r\n };\r\n /**\r\n * Tests if the bounding box is entirely inside the frustum planes\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if there is an inclusion\r\n */\r\n BoundingBox.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n return BoundingBox.IsCompletelyInFrustum(this.vectorsWorld, frustumPlanes);\r\n };\r\n /**\r\n * Tests if a point is inside the bounding box\r\n * @param point defines the point to test\r\n * @returns true if the point is inside the bounding box\r\n */\r\n BoundingBox.prototype.intersectsPoint = function (point) {\r\n var min = this.minimumWorld;\r\n var max = this.maximumWorld;\r\n var minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\r\n var pointX = point.x, pointY = point.y, pointZ = point.z;\r\n var delta = -Epsilon;\r\n if (maxX - pointX < delta || delta > pointX - minX) {\r\n return false;\r\n }\r\n if (maxY - pointY < delta || delta > pointY - minY) {\r\n return false;\r\n }\r\n if (maxZ - pointZ < delta || delta > pointZ - minZ) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if the bounding box intersects with a bounding sphere\r\n * @param sphere defines the sphere to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.prototype.intersectsSphere = function (sphere) {\r\n return BoundingBox.IntersectsSphere(this.minimumWorld, this.maximumWorld, sphere.centerWorld, sphere.radiusWorld);\r\n };\r\n /**\r\n * Tests if the bounding box intersects with a box defined by a min and max vectors\r\n * @param min defines the min vector to use\r\n * @param max defines the max vector to use\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.prototype.intersectsMinMax = function (min, max) {\r\n var myMin = this.minimumWorld;\r\n var myMax = this.maximumWorld;\r\n var myMinX = myMin.x, myMinY = myMin.y, myMinZ = myMin.z, myMaxX = myMax.x, myMaxY = myMax.y, myMaxZ = myMax.z;\r\n var minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\r\n if (myMaxX < minX || myMinX > maxX) {\r\n return false;\r\n }\r\n if (myMaxY < minY || myMinY > maxY) {\r\n return false;\r\n }\r\n if (myMaxZ < minZ || myMinZ > maxZ) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n // Statics\r\n /**\r\n * Tests if two bounding boxes are intersections\r\n * @param box0 defines the first box to test\r\n * @param box1 defines the second box to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.Intersects = function (box0, box1) {\r\n return box0.intersectsMinMax(box1.minimumWorld, box1.maximumWorld);\r\n };\r\n /**\r\n * Tests if a bounding box defines by a min/max vectors intersects a sphere\r\n * @param minPoint defines the minimum vector of the bounding box\r\n * @param maxPoint defines the maximum vector of the bounding box\r\n * @param sphereCenter defines the sphere center\r\n * @param sphereRadius defines the sphere radius\r\n * @returns true if there is an intersection\r\n */\r\n BoundingBox.IntersectsSphere = function (minPoint, maxPoint, sphereCenter, sphereRadius) {\r\n var vector = BoundingBox.TmpVector3[0];\r\n Vector3.ClampToRef(sphereCenter, minPoint, maxPoint, vector);\r\n var num = Vector3.DistanceSquared(sphereCenter, vector);\r\n return (num <= (sphereRadius * sphereRadius));\r\n };\r\n /**\r\n * Tests if a bounding box defined with 8 vectors is entirely inside frustum planes\r\n * @param boundingVectors defines an array of 8 vectors representing a bounding box\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @return true if there is an inclusion\r\n */\r\n BoundingBox.IsCompletelyInFrustum = function (boundingVectors, frustumPlanes) {\r\n for (var p = 0; p < 6; ++p) {\r\n var frustumPlane = frustumPlanes[p];\r\n for (var i = 0; i < 8; ++i) {\r\n if (frustumPlane.dotCoordinate(boundingVectors[i]) < 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if a bounding box defined with 8 vectors intersects frustum planes\r\n * @param boundingVectors defines an array of 8 vectors representing a bounding box\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @return true if there is an intersection\r\n */\r\n BoundingBox.IsInFrustum = function (boundingVectors, frustumPlanes) {\r\n for (var p = 0; p < 6; ++p) {\r\n var canReturnFalse = true;\r\n var frustumPlane = frustumPlanes[p];\r\n for (var i = 0; i < 8; ++i) {\r\n if (frustumPlane.dotCoordinate(boundingVectors[i]) >= 0) {\r\n canReturnFalse = false;\r\n break;\r\n }\r\n }\r\n if (canReturnFalse) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n BoundingBox.TmpVector3 = ArrayTools.BuildArray(3, Vector3.Zero);\r\n return BoundingBox;\r\n}());\r\nexport { BoundingBox };\r\n//# sourceMappingURL=boundingBox.js.map","import { ArrayTools } from \"../Misc/arrayTools\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\n/**\r\n * Class used to store bounding sphere information\r\n */\r\nvar BoundingSphere = /** @class */ (function () {\r\n /**\r\n * Creates a new bounding sphere\r\n * @param min defines the minimum vector (in local space)\r\n * @param max defines the maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n function BoundingSphere(min, max, worldMatrix) {\r\n /**\r\n * Gets the center of the bounding sphere in local space\r\n */\r\n this.center = Vector3.Zero();\r\n /**\r\n * Gets the center of the bounding sphere in world space\r\n */\r\n this.centerWorld = Vector3.Zero();\r\n /**\r\n * Gets the minimum vector in local space\r\n */\r\n this.minimum = Vector3.Zero();\r\n /**\r\n * Gets the maximum vector in local space\r\n */\r\n this.maximum = Vector3.Zero();\r\n this.reConstruct(min, max, worldMatrix);\r\n }\r\n /**\r\n * Recreates the entire bounding sphere from scratch as if we call the constructor in place\r\n * @param min defines the new minimum vector (in local space)\r\n * @param max defines the new maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n BoundingSphere.prototype.reConstruct = function (min, max, worldMatrix) {\r\n this.minimum.copyFrom(min);\r\n this.maximum.copyFrom(max);\r\n var distance = Vector3.Distance(min, max);\r\n max.addToRef(min, this.center).scaleInPlace(0.5);\r\n this.radius = distance * 0.5;\r\n this._update(worldMatrix || Matrix.IdentityReadOnly);\r\n };\r\n /**\r\n * Scale the current bounding sphere by applying a scale factor\r\n * @param factor defines the scale factor to apply\r\n * @returns the current bounding box\r\n */\r\n BoundingSphere.prototype.scale = function (factor) {\r\n var newRadius = this.radius * factor;\r\n var tmpVectors = BoundingSphere.TmpVector3;\r\n var tempRadiusVector = tmpVectors[0].setAll(newRadius);\r\n var min = this.center.subtractToRef(tempRadiusVector, tmpVectors[1]);\r\n var max = this.center.addToRef(tempRadiusVector, tmpVectors[2]);\r\n this.reConstruct(min, max, this._worldMatrix);\r\n return this;\r\n };\r\n /**\r\n * Gets the world matrix of the bounding box\r\n * @returns a matrix\r\n */\r\n BoundingSphere.prototype.getWorldMatrix = function () {\r\n return this._worldMatrix;\r\n };\r\n // Methods\r\n /** @hidden */\r\n BoundingSphere.prototype._update = function (worldMatrix) {\r\n if (!worldMatrix.isIdentity()) {\r\n Vector3.TransformCoordinatesToRef(this.center, worldMatrix, this.centerWorld);\r\n var tempVector = BoundingSphere.TmpVector3[0];\r\n Vector3.TransformNormalFromFloatsToRef(1.0, 1.0, 1.0, worldMatrix, tempVector);\r\n this.radiusWorld = Math.max(Math.abs(tempVector.x), Math.abs(tempVector.y), Math.abs(tempVector.z)) * this.radius;\r\n }\r\n else {\r\n this.centerWorld.copyFrom(this.center);\r\n this.radiusWorld = this.radius;\r\n }\r\n };\r\n /**\r\n * Tests if the bounding sphere is intersecting the frustum planes\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if there is an intersection\r\n */\r\n BoundingSphere.prototype.isInFrustum = function (frustumPlanes) {\r\n var center = this.centerWorld;\r\n var radius = this.radiusWorld;\r\n for (var i = 0; i < 6; i++) {\r\n if (frustumPlanes[i].dotCoordinate(center) <= -radius) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if the bounding sphere center is in between the frustum planes.\r\n * Used for optimistic fast inclusion.\r\n * @param frustumPlanes defines the frustum planes to test\r\n * @returns true if the sphere center is in between the frustum planes\r\n */\r\n BoundingSphere.prototype.isCenterInFrustum = function (frustumPlanes) {\r\n var center = this.centerWorld;\r\n for (var i = 0; i < 6; i++) {\r\n if (frustumPlanes[i].dotCoordinate(center) < 0) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Tests if a point is inside the bounding sphere\r\n * @param point defines the point to test\r\n * @returns true if the point is inside the bounding sphere\r\n */\r\n BoundingSphere.prototype.intersectsPoint = function (point) {\r\n var squareDistance = Vector3.DistanceSquared(this.centerWorld, point);\r\n if (this.radiusWorld * this.radiusWorld < squareDistance) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n // Statics\r\n /**\r\n * Checks if two sphere intersct\r\n * @param sphere0 sphere 0\r\n * @param sphere1 sphere 1\r\n * @returns true if the speres intersect\r\n */\r\n BoundingSphere.Intersects = function (sphere0, sphere1) {\r\n var squareDistance = Vector3.DistanceSquared(sphere0.centerWorld, sphere1.centerWorld);\r\n var radiusSum = sphere0.radiusWorld + sphere1.radiusWorld;\r\n if (radiusSum * radiusSum < squareDistance) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n BoundingSphere.TmpVector3 = ArrayTools.BuildArray(3, Vector3.Zero);\r\n return BoundingSphere;\r\n}());\r\nexport { BoundingSphere };\r\n//# sourceMappingURL=boundingSphere.js.map","import { ArrayTools } from \"../Misc/arrayTools\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { BoundingBox } from \"./boundingBox\";\r\nimport { BoundingSphere } from \"./boundingSphere\";\r\nvar _result0 = { min: 0, max: 0 };\r\nvar _result1 = { min: 0, max: 0 };\r\nvar computeBoxExtents = function (axis, box, result) {\r\n var p = Vector3.Dot(box.centerWorld, axis);\r\n var r0 = Math.abs(Vector3.Dot(box.directions[0], axis)) * box.extendSize.x;\r\n var r1 = Math.abs(Vector3.Dot(box.directions[1], axis)) * box.extendSize.y;\r\n var r2 = Math.abs(Vector3.Dot(box.directions[2], axis)) * box.extendSize.z;\r\n var r = r0 + r1 + r2;\r\n result.min = p - r;\r\n result.max = p + r;\r\n};\r\nvar axisOverlap = function (axis, box0, box1) {\r\n computeBoxExtents(axis, box0, _result0);\r\n computeBoxExtents(axis, box1, _result1);\r\n return !(_result0.min > _result1.max || _result1.min > _result0.max);\r\n};\r\n/**\r\n * Info for a bounding data of a mesh\r\n */\r\nvar BoundingInfo = /** @class */ (function () {\r\n /**\r\n * Constructs bounding info\r\n * @param minimum min vector of the bounding box/sphere\r\n * @param maximum max vector of the bounding box/sphere\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n function BoundingInfo(minimum, maximum, worldMatrix) {\r\n this._isLocked = false;\r\n this.boundingBox = new BoundingBox(minimum, maximum, worldMatrix);\r\n this.boundingSphere = new BoundingSphere(minimum, maximum, worldMatrix);\r\n }\r\n /**\r\n * Recreates the entire bounding info from scratch as if we call the constructor in place\r\n * @param min defines the new minimum vector (in local space)\r\n * @param max defines the new maximum vector (in local space)\r\n * @param worldMatrix defines the new world matrix\r\n */\r\n BoundingInfo.prototype.reConstruct = function (min, max, worldMatrix) {\r\n this.boundingBox.reConstruct(min, max, worldMatrix);\r\n this.boundingSphere.reConstruct(min, max, worldMatrix);\r\n };\r\n Object.defineProperty(BoundingInfo.prototype, \"minimum\", {\r\n /**\r\n * min vector of the bounding box/sphere\r\n */\r\n get: function () {\r\n return this.boundingBox.minimum;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BoundingInfo.prototype, \"maximum\", {\r\n /**\r\n * max vector of the bounding box/sphere\r\n */\r\n get: function () {\r\n return this.boundingBox.maximum;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BoundingInfo.prototype, \"isLocked\", {\r\n /**\r\n * If the info is locked and won't be updated to avoid perf overhead\r\n */\r\n get: function () {\r\n return this._isLocked;\r\n },\r\n set: function (value) {\r\n this._isLocked = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Updates the bounding sphere and box\r\n * @param world world matrix to be used to update\r\n */\r\n BoundingInfo.prototype.update = function (world) {\r\n if (this._isLocked) {\r\n return;\r\n }\r\n this.boundingBox._update(world);\r\n this.boundingSphere._update(world);\r\n };\r\n /**\r\n * Recreate the bounding info to be centered around a specific point given a specific extend.\r\n * @param center New center of the bounding info\r\n * @param extend New extend of the bounding info\r\n * @returns the current bounding info\r\n */\r\n BoundingInfo.prototype.centerOn = function (center, extend) {\r\n var minimum = BoundingInfo.TmpVector3[0].copyFrom(center).subtractInPlace(extend);\r\n var maximum = BoundingInfo.TmpVector3[1].copyFrom(center).addInPlace(extend);\r\n this.boundingBox.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());\r\n this.boundingSphere.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());\r\n return this;\r\n };\r\n /**\r\n * Scale the current bounding info by applying a scale factor\r\n * @param factor defines the scale factor to apply\r\n * @returns the current bounding info\r\n */\r\n BoundingInfo.prototype.scale = function (factor) {\r\n this.boundingBox.scale(factor);\r\n this.boundingSphere.scale(factor);\r\n return this;\r\n };\r\n /**\r\n * Returns `true` if the bounding info is within the frustum defined by the passed array of planes.\r\n * @param frustumPlanes defines the frustum to test\r\n * @param strategy defines the strategy to use for the culling (default is BABYLON.AbstractMesh.CULLINGSTRATEGY_STANDARD)\r\n * @returns true if the bounding info is in the frustum planes\r\n */\r\n BoundingInfo.prototype.isInFrustum = function (frustumPlanes, strategy) {\r\n if (strategy === void 0) { strategy = 0; }\r\n var inclusionTest = (strategy === 2 || strategy === 3);\r\n if (inclusionTest) {\r\n if (this.boundingSphere.isCenterInFrustum(frustumPlanes)) {\r\n return true;\r\n }\r\n }\r\n if (!this.boundingSphere.isInFrustum(frustumPlanes)) {\r\n return false;\r\n }\r\n var bSphereOnlyTest = (strategy === 1 || strategy === 3);\r\n if (bSphereOnlyTest) {\r\n return true;\r\n }\r\n return this.boundingBox.isInFrustum(frustumPlanes);\r\n };\r\n Object.defineProperty(BoundingInfo.prototype, \"diagonalLength\", {\r\n /**\r\n * Gets the world distance between the min and max points of the bounding box\r\n */\r\n get: function () {\r\n var boundingBox = this.boundingBox;\r\n var diag = boundingBox.maximumWorld.subtractToRef(boundingBox.minimumWorld, BoundingInfo.TmpVector3[0]);\r\n return diag.length();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Checks if a cullable object (mesh...) is in the camera frustum\r\n * Unlike isInFrustum this cheks the full bounding box\r\n * @param frustumPlanes Camera near/planes\r\n * @returns true if the object is in frustum otherwise false\r\n */\r\n BoundingInfo.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n return this.boundingBox.isCompletelyInFrustum(frustumPlanes);\r\n };\r\n /** @hidden */\r\n BoundingInfo.prototype._checkCollision = function (collider) {\r\n return collider._canDoCollision(this.boundingSphere.centerWorld, this.boundingSphere.radiusWorld, this.boundingBox.minimumWorld, this.boundingBox.maximumWorld);\r\n };\r\n /**\r\n * Checks if a point is inside the bounding box and bounding sphere or the mesh\r\n * @see https://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh\r\n * @param point the point to check intersection with\r\n * @returns if the point intersects\r\n */\r\n BoundingInfo.prototype.intersectsPoint = function (point) {\r\n if (!this.boundingSphere.centerWorld) {\r\n return false;\r\n }\r\n if (!this.boundingSphere.intersectsPoint(point)) {\r\n return false;\r\n }\r\n if (!this.boundingBox.intersectsPoint(point)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks if another bounding info intersects the bounding box and bounding sphere or the mesh\r\n * @see https://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh\r\n * @param boundingInfo the bounding info to check intersection with\r\n * @param precise if the intersection should be done using OBB\r\n * @returns if the bounding info intersects\r\n */\r\n BoundingInfo.prototype.intersects = function (boundingInfo, precise) {\r\n if (!BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {\r\n return false;\r\n }\r\n if (!BoundingBox.Intersects(this.boundingBox, boundingInfo.boundingBox)) {\r\n return false;\r\n }\r\n if (!precise) {\r\n return true;\r\n }\r\n var box0 = this.boundingBox;\r\n var box1 = boundingInfo.boundingBox;\r\n if (!axisOverlap(box0.directions[0], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box0.directions[1], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box0.directions[2], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box1.directions[0], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box1.directions[1], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(box1.directions[2], box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[0]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[1]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[2]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[0]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[1]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[2]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[0]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[1]), box0, box1)) {\r\n return false;\r\n }\r\n if (!axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[2]), box0, box1)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n BoundingInfo.TmpVector3 = ArrayTools.BuildArray(2, Vector3.Zero);\r\n return BoundingInfo;\r\n}());\r\nexport { BoundingInfo };\r\n//# sourceMappingURL=boundingInfo.js.map","import { ThinEngine } from \"../../Engines/thinEngine\";\r\nThinEngine.prototype._readTexturePixels = function (texture, width, height, faceIndex, level, buffer) {\r\n if (faceIndex === void 0) { faceIndex = -1; }\r\n if (level === void 0) { level = 0; }\r\n if (buffer === void 0) { buffer = null; }\r\n var gl = this._gl;\r\n if (!gl) {\r\n throw new Error(\"Engine does not have gl rendering context.\");\r\n }\r\n if (!this._dummyFramebuffer) {\r\n var dummy = gl.createFramebuffer();\r\n if (!dummy) {\r\n throw new Error(\"Unable to create dummy framebuffer\");\r\n }\r\n this._dummyFramebuffer = dummy;\r\n }\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, this._dummyFramebuffer);\r\n if (faceIndex > -1) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._webGLTexture, level);\r\n }\r\n else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, level);\r\n }\r\n var readType = (texture.type !== undefined) ? this._getWebGLTextureType(texture.type) : gl.UNSIGNED_BYTE;\r\n switch (readType) {\r\n case gl.UNSIGNED_BYTE:\r\n if (!buffer) {\r\n buffer = new Uint8Array(4 * width * height);\r\n }\r\n readType = gl.UNSIGNED_BYTE;\r\n break;\r\n default:\r\n if (!buffer) {\r\n buffer = new Float32Array(4 * width * height);\r\n }\r\n readType = gl.FLOAT;\r\n break;\r\n }\r\n gl.readPixels(0, 0, width, height, gl.RGBA, readType, buffer);\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, this._currentFramebuffer);\r\n return buffer;\r\n};\r\n//# sourceMappingURL=engine.readTexture.js.map","import { __assign } from \"tslib\";\r\nimport { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';\r\nimport { Logger } from '../../Misc/logger';\r\nimport { RenderTargetCreationOptions } from '../../Materials/Textures/renderTargetCreationOptions';\r\nimport { ThinEngine } from '../thinEngine';\r\nThinEngine.prototype.createRenderTargetTexture = function (size, options) {\r\n var fullOptions = new RenderTargetCreationOptions();\r\n if (options !== undefined && typeof options === \"object\") {\r\n fullOptions.generateMipMaps = options.generateMipMaps;\r\n fullOptions.generateDepthBuffer = !!options.generateDepthBuffer;\r\n fullOptions.generateStencilBuffer = !!options.generateStencilBuffer;\r\n fullOptions.type = options.type === undefined ? 0 : options.type;\r\n fullOptions.samplingMode = options.samplingMode === undefined ? 3 : options.samplingMode;\r\n fullOptions.format = options.format === undefined ? 5 : options.format;\r\n }\r\n else {\r\n fullOptions.generateMipMaps = options;\r\n fullOptions.generateDepthBuffer = true;\r\n fullOptions.generateStencilBuffer = false;\r\n fullOptions.type = 0;\r\n fullOptions.samplingMode = 3;\r\n fullOptions.format = 5;\r\n }\r\n if (fullOptions.type === 1 && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = 1;\r\n }\r\n else if (fullOptions.type === 2 && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = 1;\r\n }\r\n if (fullOptions.type === 1 && !this._caps.textureFloat) {\r\n fullOptions.type = 0;\r\n Logger.Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\r\n }\r\n var gl = this._gl;\r\n var texture = new InternalTexture(this, InternalTextureSource.RenderTarget);\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n var layers = size.layers || 0;\r\n var filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps ? true : false);\r\n var target = layers !== 0 ? gl.TEXTURE_2D_ARRAY : gl.TEXTURE_2D;\r\n var sizedFormat = this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format);\r\n var internalFormat = this._getInternalFormat(fullOptions.format);\r\n var type = this._getWebGLTextureType(fullOptions.type);\r\n // Bind\r\n this._bindTextureDirectly(target, texture);\r\n if (layers !== 0) {\r\n texture.is2DArray = true;\r\n gl.texImage3D(target, 0, sizedFormat, width, height, layers, 0, internalFormat, type, null);\r\n }\r\n else {\r\n gl.texImage2D(target, 0, sizedFormat, width, height, 0, internalFormat, type, null);\r\n }\r\n gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n // MipMaps\r\n if (fullOptions.generateMipMaps) {\r\n this._gl.generateMipmap(target);\r\n }\r\n this._bindTextureDirectly(target, null);\r\n var currentFrameBuffer = this._currentFramebuffer;\r\n // Create the framebuffer\r\n var framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer ? true : false, fullOptions.generateDepthBuffer, width, height);\r\n // No need to rebind on every frame\r\n if (!texture.is2DArray) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, 0);\r\n }\r\n this._bindUnboundFramebuffer(currentFrameBuffer);\r\n texture._framebuffer = framebuffer;\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.depth = layers;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = fullOptions.generateMipMaps ? true : false;\r\n texture.samplingMode = fullOptions.samplingMode;\r\n texture.type = fullOptions.type;\r\n texture.format = fullOptions.format;\r\n texture._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n texture._generateStencilBuffer = fullOptions.generateStencilBuffer ? true : false;\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\nThinEngine.prototype.createDepthStencilTexture = function (size, options) {\r\n if (options.isCube) {\r\n var width = size.width || size;\r\n return this._createDepthStencilCubeTexture(width, options);\r\n }\r\n else {\r\n return this._createDepthStencilTexture(size, options);\r\n }\r\n};\r\nThinEngine.prototype._createDepthStencilTexture = function (size, options) {\r\n var gl = this._gl;\r\n var layers = size.layers || 0;\r\n var target = layers !== 0 ? gl.TEXTURE_2D_ARRAY : gl.TEXTURE_2D;\r\n var internalTexture = new InternalTexture(this, InternalTextureSource.Depth);\r\n if (!this._caps.depthTextureExtension) {\r\n Logger.Error(\"Depth texture is not supported by your browser or hardware.\");\r\n return internalTexture;\r\n }\r\n var internalOptions = __assign({ bilinearFiltering: false, comparisonFunction: 0, generateStencil: false }, options);\r\n this._bindTextureDirectly(target, internalTexture, true);\r\n this._setupDepthStencilTexture(internalTexture, size, internalOptions.generateStencil, internalOptions.bilinearFiltering, internalOptions.comparisonFunction);\r\n var type = internalOptions.generateStencil ? gl.UNSIGNED_INT_24_8 : gl.UNSIGNED_INT;\r\n var internalFormat = internalOptions.generateStencil ? gl.DEPTH_STENCIL : gl.DEPTH_COMPONENT;\r\n var sizedFormat = internalFormat;\r\n if (this.webGLVersion > 1) {\r\n sizedFormat = internalOptions.generateStencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;\r\n }\r\n if (internalTexture.is2DArray) {\r\n gl.texImage3D(target, 0, sizedFormat, internalTexture.width, internalTexture.height, layers, 0, internalFormat, type, null);\r\n }\r\n else {\r\n gl.texImage2D(target, 0, sizedFormat, internalTexture.width, internalTexture.height, 0, internalFormat, type, null);\r\n }\r\n this._bindTextureDirectly(target, null);\r\n return internalTexture;\r\n};\r\n//# sourceMappingURL=engine.renderTarget.js.map","import { __assign } from \"tslib\";\r\nimport { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';\r\nimport { Logger } from '../../Misc/logger';\r\nimport { ThinEngine } from '../thinEngine';\r\nThinEngine.prototype.createRenderTargetCubeTexture = function (size, options) {\r\n var fullOptions = __assign({ generateMipMaps: true, generateDepthBuffer: true, generateStencilBuffer: false, type: 0, samplingMode: 3, format: 5 }, options);\r\n fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && fullOptions.generateStencilBuffer;\r\n if (fullOptions.type === 1 && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = 1;\r\n }\r\n else if (fullOptions.type === 2 && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n fullOptions.samplingMode = 1;\r\n }\r\n var gl = this._gl;\r\n var texture = new InternalTexture(this, InternalTextureSource.RenderTarget);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n var filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps);\r\n if (fullOptions.type === 1 && !this._caps.textureFloat) {\r\n fullOptions.type = 0;\r\n Logger.Warn(\"Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type\");\r\n }\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n for (var face = 0; face < 6; face++) {\r\n gl.texImage2D((gl.TEXTURE_CUBE_MAP_POSITIVE_X + face), 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), size, size, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);\r\n }\r\n // Create the framebuffer\r\n var framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer, fullOptions.generateDepthBuffer, size, size);\r\n // MipMaps\r\n if (fullOptions.generateMipMaps) {\r\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\r\n }\r\n // Unbind\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n this._bindUnboundFramebuffer(null);\r\n texture._framebuffer = framebuffer;\r\n texture.width = size;\r\n texture.height = size;\r\n texture.isReady = true;\r\n texture.isCube = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = fullOptions.generateMipMaps;\r\n texture.samplingMode = fullOptions.samplingMode;\r\n texture.type = fullOptions.type;\r\n texture.format = fullOptions.format;\r\n texture._generateDepthBuffer = fullOptions.generateDepthBuffer;\r\n texture._generateStencilBuffer = fullOptions.generateStencilBuffer;\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\n//# sourceMappingURL=engine.renderTargetCube.js.map","import { StringTools } from '../../Misc/stringTools';\r\n/** @hidden */\r\nvar ShaderCodeNode = /** @class */ (function () {\r\n function ShaderCodeNode() {\r\n this.children = [];\r\n }\r\n ShaderCodeNode.prototype.isValid = function (preprocessors) {\r\n return true;\r\n };\r\n ShaderCodeNode.prototype.process = function (preprocessors, options) {\r\n var result = \"\";\r\n if (this.line) {\r\n var value = this.line;\r\n var processor = options.processor;\r\n if (processor) {\r\n // This must be done before other replacements to avoid mistakenly changing something that was already changed.\r\n if (processor.lineProcessor) {\r\n value = processor.lineProcessor(value, options.isFragment);\r\n }\r\n if (processor.attributeProcessor && StringTools.StartsWith(this.line, \"attribute\")) {\r\n value = processor.attributeProcessor(this.line);\r\n }\r\n else if (processor.varyingProcessor && StringTools.StartsWith(this.line, \"varying\")) {\r\n value = processor.varyingProcessor(this.line, options.isFragment);\r\n }\r\n else if ((processor.uniformProcessor || processor.uniformBufferProcessor) && StringTools.StartsWith(this.line, \"uniform\")) {\r\n var regex = /uniform (.+) (.+)/;\r\n if (regex.test(this.line)) { // uniform\r\n if (processor.uniformProcessor) {\r\n value = processor.uniformProcessor(this.line, options.isFragment);\r\n }\r\n }\r\n else { // Uniform buffer\r\n if (processor.uniformBufferProcessor) {\r\n value = processor.uniformBufferProcessor(this.line, options.isFragment);\r\n options.lookForClosingBracketForUniformBuffer = true;\r\n }\r\n }\r\n }\r\n if (processor.endOfUniformBufferProcessor) {\r\n if (options.lookForClosingBracketForUniformBuffer && this.line.indexOf(\"}\") !== -1) {\r\n options.lookForClosingBracketForUniformBuffer = false;\r\n value = processor.endOfUniformBufferProcessor(this.line, options.isFragment);\r\n }\r\n }\r\n }\r\n result += value + \"\\r\\n\";\r\n }\r\n this.children.forEach(function (child) {\r\n result += child.process(preprocessors, options);\r\n });\r\n if (this.additionalDefineKey) {\r\n preprocessors[this.additionalDefineKey] = this.additionalDefineValue || \"true\";\r\n }\r\n return result;\r\n };\r\n return ShaderCodeNode;\r\n}());\r\nexport { ShaderCodeNode };\r\n//# sourceMappingURL=shaderCodeNode.js.map","/** @hidden */\r\nvar ShaderCodeCursor = /** @class */ (function () {\r\n function ShaderCodeCursor() {\r\n }\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"currentLine\", {\r\n get: function () {\r\n return this._lines[this.lineIndex];\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"canRead\", {\r\n get: function () {\r\n return this.lineIndex < this._lines.length - 1;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"lines\", {\r\n set: function (value) {\r\n this._lines = [];\r\n for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {\r\n var line = value_1[_i];\r\n // Prevent removing line break in macros.\r\n if (line[0] === \"#\") {\r\n this._lines.push(line);\r\n continue;\r\n }\r\n var split = line.split(\";\");\r\n for (var index = 0; index < split.length; index++) {\r\n var subLine = split[index];\r\n subLine = subLine.trim();\r\n if (!subLine) {\r\n continue;\r\n }\r\n this._lines.push(subLine + (index !== split.length - 1 ? \";\" : \"\"));\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return ShaderCodeCursor;\r\n}());\r\nexport { ShaderCodeCursor };\r\n//# sourceMappingURL=shaderCodeCursor.js.map","import { __extends } from \"tslib\";\r\nimport { ShaderCodeNode } from './shaderCodeNode';\r\n/** @hidden */\r\nvar ShaderCodeConditionNode = /** @class */ (function (_super) {\r\n __extends(ShaderCodeConditionNode, _super);\r\n function ShaderCodeConditionNode() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderCodeConditionNode.prototype.process = function (preprocessors, options) {\r\n for (var index = 0; index < this.children.length; index++) {\r\n var node = this.children[index];\r\n if (node.isValid(preprocessors)) {\r\n return node.process(preprocessors, options);\r\n }\r\n }\r\n return \"\";\r\n };\r\n return ShaderCodeConditionNode;\r\n}(ShaderCodeNode));\r\nexport { ShaderCodeConditionNode };\r\n//# sourceMappingURL=shaderCodeConditionNode.js.map","import { __extends } from \"tslib\";\r\nimport { ShaderCodeNode } from './shaderCodeNode';\r\n/** @hidden */\r\nvar ShaderCodeTestNode = /** @class */ (function (_super) {\r\n __extends(ShaderCodeTestNode, _super);\r\n function ShaderCodeTestNode() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderCodeTestNode.prototype.isValid = function (preprocessors) {\r\n return this.testExpression.isTrue(preprocessors);\r\n };\r\n return ShaderCodeTestNode;\r\n}(ShaderCodeNode));\r\nexport { ShaderCodeTestNode };\r\n//# sourceMappingURL=shaderCodeTestNode.js.map","/** @hidden */\r\nvar ShaderDefineExpression = /** @class */ (function () {\r\n function ShaderDefineExpression() {\r\n }\r\n ShaderDefineExpression.prototype.isTrue = function (preprocessors) {\r\n return true;\r\n };\r\n ShaderDefineExpression.postfixToInfix = function (postfix) {\r\n var stack = [];\r\n for (var _i = 0, postfix_1 = postfix; _i < postfix_1.length; _i++) {\r\n var c = postfix_1[_i];\r\n if (ShaderDefineExpression._OperatorPriority[c] === undefined) {\r\n stack.push(c);\r\n }\r\n else {\r\n var v1 = stack[stack.length - 1], v2 = stack[stack.length - 2];\r\n stack.length -= 2;\r\n stack.push(\"(\" + v2 + c + v1 + \")\");\r\n }\r\n }\r\n return stack[stack.length - 1];\r\n };\r\n ShaderDefineExpression.infixToPostfix = function (infix) {\r\n var result = [];\r\n var stackIdx = -1;\r\n var pushOperand = function () {\r\n operand = operand.trim();\r\n if (operand !== '') {\r\n result.push(operand);\r\n operand = '';\r\n }\r\n };\r\n var push = function (s) {\r\n if (stackIdx < ShaderDefineExpression._Stack.length - 1) {\r\n ShaderDefineExpression._Stack[++stackIdx] = s;\r\n }\r\n };\r\n var peek = function () { return ShaderDefineExpression._Stack[stackIdx]; };\r\n var pop = function () { return stackIdx === -1 ? '!!INVALID EXPRESSION!!' : ShaderDefineExpression._Stack[stackIdx--]; };\r\n var idx = 0, operand = '';\r\n while (idx < infix.length) {\r\n var c = infix.charAt(idx), token = idx < infix.length - 1 ? infix.substr(idx, 2) : '';\r\n if (c === '(') {\r\n operand = '';\r\n push(c);\r\n }\r\n else if (c === ')') {\r\n pushOperand();\r\n while (stackIdx !== -1 && peek() !== '(') {\r\n result.push(pop());\r\n }\r\n pop();\r\n }\r\n else if (ShaderDefineExpression._OperatorPriority[token] > 1) {\r\n pushOperand();\r\n while (stackIdx !== -1 && ShaderDefineExpression._OperatorPriority[peek()] >= ShaderDefineExpression._OperatorPriority[token]) {\r\n result.push(pop());\r\n }\r\n push(token);\r\n idx++;\r\n }\r\n else {\r\n operand += c;\r\n }\r\n idx++;\r\n }\r\n pushOperand();\r\n while (stackIdx !== -1) {\r\n if (peek() === '(') {\r\n pop();\r\n }\r\n else {\r\n result.push(pop());\r\n }\r\n }\r\n return result;\r\n };\r\n ShaderDefineExpression._OperatorPriority = {\r\n \")\": 0,\r\n \"(\": 1,\r\n \"||\": 2,\r\n \"&&\": 3,\r\n };\r\n ShaderDefineExpression._Stack = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''];\r\n return ShaderDefineExpression;\r\n}());\r\nexport { ShaderDefineExpression };\r\n//# sourceMappingURL=shaderDefineExpression.js.map","import { __extends } from \"tslib\";\r\nimport { ShaderDefineExpression } from \"../shaderDefineExpression\";\r\n/** @hidden */\r\nvar ShaderDefineIsDefinedOperator = /** @class */ (function (_super) {\r\n __extends(ShaderDefineIsDefinedOperator, _super);\r\n function ShaderDefineIsDefinedOperator(define, not) {\r\n if (not === void 0) { not = false; }\r\n var _this = _super.call(this) || this;\r\n _this.define = define;\r\n _this.not = not;\r\n return _this;\r\n }\r\n ShaderDefineIsDefinedOperator.prototype.isTrue = function (preprocessors) {\r\n var condition = preprocessors[this.define] !== undefined;\r\n if (this.not) {\r\n condition = !condition;\r\n }\r\n return condition;\r\n };\r\n return ShaderDefineIsDefinedOperator;\r\n}(ShaderDefineExpression));\r\nexport { ShaderDefineIsDefinedOperator };\r\n//# sourceMappingURL=shaderDefineIsDefinedOperator.js.map","import { __extends } from \"tslib\";\r\nimport { ShaderDefineExpression } from '../shaderDefineExpression';\r\n/** @hidden */\r\nvar ShaderDefineOrOperator = /** @class */ (function (_super) {\r\n __extends(ShaderDefineOrOperator, _super);\r\n function ShaderDefineOrOperator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderDefineOrOperator.prototype.isTrue = function (preprocessors) {\r\n return this.leftOperand.isTrue(preprocessors) || this.rightOperand.isTrue(preprocessors);\r\n };\r\n return ShaderDefineOrOperator;\r\n}(ShaderDefineExpression));\r\nexport { ShaderDefineOrOperator };\r\n//# sourceMappingURL=shaderDefineOrOperator.js.map","import { __extends } from \"tslib\";\r\nimport { ShaderDefineExpression } from '../shaderDefineExpression';\r\n/** @hidden */\r\nvar ShaderDefineAndOperator = /** @class */ (function (_super) {\r\n __extends(ShaderDefineAndOperator, _super);\r\n function ShaderDefineAndOperator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderDefineAndOperator.prototype.isTrue = function (preprocessors) {\r\n return this.leftOperand.isTrue(preprocessors) && this.rightOperand.isTrue(preprocessors);\r\n };\r\n return ShaderDefineAndOperator;\r\n}(ShaderDefineExpression));\r\nexport { ShaderDefineAndOperator };\r\n//# sourceMappingURL=shaderDefineAndOperator.js.map","import { __extends } from \"tslib\";\r\nimport { ShaderDefineExpression } from '../shaderDefineExpression';\r\n/** @hidden */\r\nvar ShaderDefineArithmeticOperator = /** @class */ (function (_super) {\r\n __extends(ShaderDefineArithmeticOperator, _super);\r\n function ShaderDefineArithmeticOperator(define, operand, testValue) {\r\n var _this = _super.call(this) || this;\r\n _this.define = define;\r\n _this.operand = operand;\r\n _this.testValue = testValue;\r\n return _this;\r\n }\r\n ShaderDefineArithmeticOperator.prototype.isTrue = function (preprocessors) {\r\n var value = preprocessors[this.define];\r\n if (value === undefined) {\r\n value = this.define;\r\n }\r\n var condition = false;\r\n var left = parseInt(value);\r\n var right = parseInt(this.testValue);\r\n switch (this.operand) {\r\n case \">\":\r\n condition = left > right;\r\n break;\r\n case \"<\":\r\n condition = left < right;\r\n break;\r\n case \"<=\":\r\n condition = left <= right;\r\n break;\r\n case \">=\":\r\n condition = left >= right;\r\n break;\r\n case \"==\":\r\n condition = left === right;\r\n break;\r\n }\r\n return condition;\r\n };\r\n return ShaderDefineArithmeticOperator;\r\n}(ShaderDefineExpression));\r\nexport { ShaderDefineArithmeticOperator };\r\n//# sourceMappingURL=shaderDefineArithmeticOperator.js.map","import { ShaderCodeNode } from './shaderCodeNode';\r\nimport { ShaderCodeCursor } from './shaderCodeCursor';\r\nimport { ShaderCodeConditionNode } from './shaderCodeConditionNode';\r\nimport { ShaderCodeTestNode } from './shaderCodeTestNode';\r\nimport { ShaderDefineIsDefinedOperator } from './Expressions/Operators/shaderDefineIsDefinedOperator';\r\nimport { ShaderDefineOrOperator } from './Expressions/Operators/shaderDefineOrOperator';\r\nimport { ShaderDefineAndOperator } from './Expressions/Operators/shaderDefineAndOperator';\r\nimport { ShaderDefineExpression } from './Expressions/shaderDefineExpression';\r\nimport { ShaderDefineArithmeticOperator } from './Expressions/Operators/shaderDefineArithmeticOperator';\r\nimport { _DevTools } from '../../Misc/devTools';\r\nvar regexSE = /defined\\s*?\\((.+?)\\)/g;\r\nvar regexSERevert = /defined\\s*?\\[(.+?)\\]/g;\r\n/** @hidden */\r\nvar ShaderProcessor = /** @class */ (function () {\r\n function ShaderProcessor() {\r\n }\r\n ShaderProcessor.Process = function (sourceCode, options, callback, engine) {\r\n var _this = this;\r\n this._ProcessIncludes(sourceCode, options, function (codeWithIncludes) {\r\n var migratedCode = _this._ProcessShaderConversion(codeWithIncludes, options, engine);\r\n callback(migratedCode);\r\n });\r\n };\r\n ShaderProcessor._ProcessPrecision = function (source, options) {\r\n var shouldUseHighPrecisionShader = options.shouldUseHighPrecisionShader;\r\n if (source.indexOf(\"precision highp float\") === -1) {\r\n if (!shouldUseHighPrecisionShader) {\r\n source = \"precision mediump float;\\n\" + source;\r\n }\r\n else {\r\n source = \"precision highp float;\\n\" + source;\r\n }\r\n }\r\n else {\r\n if (!shouldUseHighPrecisionShader) { // Moving highp to mediump\r\n source = source.replace(\"precision highp float\", \"precision mediump float\");\r\n }\r\n }\r\n return source;\r\n };\r\n ShaderProcessor._ExtractOperation = function (expression) {\r\n var regex = /defined\\((.+)\\)/;\r\n var match = regex.exec(expression);\r\n if (match && match.length) {\r\n return new ShaderDefineIsDefinedOperator(match[1].trim(), expression[0] === \"!\");\r\n }\r\n var operators = [\"==\", \">=\", \"<=\", \"<\", \">\"];\r\n var operator = \"\";\r\n var indexOperator = 0;\r\n for (var _i = 0, operators_1 = operators; _i < operators_1.length; _i++) {\r\n operator = operators_1[_i];\r\n indexOperator = expression.indexOf(operator);\r\n if (indexOperator > -1) {\r\n break;\r\n }\r\n }\r\n if (indexOperator === -1) {\r\n return new ShaderDefineIsDefinedOperator(expression);\r\n }\r\n var define = expression.substring(0, indexOperator).trim();\r\n var value = expression.substring(indexOperator + operator.length).trim();\r\n return new ShaderDefineArithmeticOperator(define, operator, value);\r\n };\r\n ShaderProcessor._BuildSubExpression = function (expression) {\r\n expression = expression.replace(regexSE, \"defined[$1]\");\r\n var postfix = ShaderDefineExpression.infixToPostfix(expression);\r\n var stack = [];\r\n for (var _i = 0, postfix_1 = postfix; _i < postfix_1.length; _i++) {\r\n var c = postfix_1[_i];\r\n if (c !== '||' && c !== '&&') {\r\n stack.push(c);\r\n }\r\n else if (stack.length >= 2) {\r\n var v1 = stack[stack.length - 1], v2 = stack[stack.length - 2];\r\n stack.length -= 2;\r\n var operator = c == '&&' ? new ShaderDefineAndOperator() : new ShaderDefineOrOperator();\r\n if (typeof (v1) === 'string') {\r\n v1 = v1.replace(regexSERevert, \"defined($1)\");\r\n }\r\n if (typeof (v2) === 'string') {\r\n v2 = v2.replace(regexSERevert, \"defined($1)\");\r\n }\r\n operator.leftOperand = typeof (v2) === 'string' ? this._ExtractOperation(v2) : v2;\r\n operator.rightOperand = typeof (v1) === 'string' ? this._ExtractOperation(v1) : v1;\r\n stack.push(operator);\r\n }\r\n }\r\n var result = stack[stack.length - 1];\r\n if (typeof (result) === 'string') {\r\n result = result.replace(regexSERevert, \"defined($1)\");\r\n }\r\n // note: stack.length !== 1 if there was an error in the parsing\r\n return typeof (result) === 'string' ? this._ExtractOperation(result) : result;\r\n };\r\n ShaderProcessor._BuildExpression = function (line, start) {\r\n var node = new ShaderCodeTestNode();\r\n var command = line.substring(0, start);\r\n var expression = line.substring(start);\r\n expression = expression.substring(0, ((expression.indexOf(\"//\") + 1) || (expression.length + 1)) - 1).trim();\r\n if (command === \"#ifdef\") {\r\n node.testExpression = new ShaderDefineIsDefinedOperator(expression);\r\n }\r\n else if (command === \"#ifndef\") {\r\n node.testExpression = new ShaderDefineIsDefinedOperator(expression, true);\r\n }\r\n else {\r\n node.testExpression = this._BuildSubExpression(expression);\r\n }\r\n return node;\r\n };\r\n ShaderProcessor._MoveCursorWithinIf = function (cursor, rootNode, ifNode) {\r\n var line = cursor.currentLine;\r\n while (this._MoveCursor(cursor, ifNode)) {\r\n line = cursor.currentLine;\r\n var first5 = line.substring(0, 5).toLowerCase();\r\n if (first5 === \"#else\") {\r\n var elseNode = new ShaderCodeNode();\r\n rootNode.children.push(elseNode);\r\n this._MoveCursor(cursor, elseNode);\r\n return;\r\n }\r\n else if (first5 === \"#elif\") {\r\n var elifNode = this._BuildExpression(line, 5);\r\n rootNode.children.push(elifNode);\r\n ifNode = elifNode;\r\n }\r\n }\r\n };\r\n ShaderProcessor._MoveCursor = function (cursor, rootNode) {\r\n while (cursor.canRead) {\r\n cursor.lineIndex++;\r\n var line = cursor.currentLine;\r\n var keywords = /(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/;\r\n var matches = keywords.exec(line);\r\n if (matches && matches.length) {\r\n var keyword = matches[0];\r\n switch (keyword) {\r\n case \"#ifdef\": {\r\n var newRootNode = new ShaderCodeConditionNode();\r\n rootNode.children.push(newRootNode);\r\n var ifNode = this._BuildExpression(line, 6);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n case \"#else\":\r\n case \"#elif\":\r\n return true;\r\n case \"#endif\":\r\n return false;\r\n case \"#ifndef\": {\r\n var newRootNode = new ShaderCodeConditionNode();\r\n rootNode.children.push(newRootNode);\r\n var ifNode = this._BuildExpression(line, 7);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n case \"#if\": {\r\n var newRootNode = new ShaderCodeConditionNode();\r\n var ifNode = this._BuildExpression(line, 3);\r\n rootNode.children.push(newRootNode);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n var newNode = new ShaderCodeNode();\r\n newNode.line = line;\r\n rootNode.children.push(newNode);\r\n // Detect additional defines\r\n if (line[0] === \"#\" && line[1] === \"d\") {\r\n var split = line.replace(\";\", \"\").split(\" \");\r\n newNode.additionalDefineKey = split[1];\r\n if (split.length === 3) {\r\n newNode.additionalDefineValue = split[2];\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n ShaderProcessor._EvaluatePreProcessors = function (sourceCode, preprocessors, options) {\r\n var rootNode = new ShaderCodeNode();\r\n var cursor = new ShaderCodeCursor();\r\n cursor.lineIndex = -1;\r\n cursor.lines = sourceCode.split(\"\\n\");\r\n // Decompose (We keep it in 2 steps so it is easier to maintain and perf hit is insignificant)\r\n this._MoveCursor(cursor, rootNode);\r\n // Recompose\r\n return rootNode.process(preprocessors, options);\r\n };\r\n ShaderProcessor._PreparePreProcessors = function (options) {\r\n var defines = options.defines;\r\n var preprocessors = {};\r\n for (var _i = 0, defines_1 = defines; _i < defines_1.length; _i++) {\r\n var define = defines_1[_i];\r\n var keyValue = define.replace(\"#define\", \"\").replace(\";\", \"\").trim();\r\n var split = keyValue.split(\" \");\r\n preprocessors[split[0]] = split.length > 1 ? split[1] : \"\";\r\n }\r\n preprocessors[\"GL_ES\"] = \"true\";\r\n preprocessors[\"__VERSION__\"] = options.version;\r\n preprocessors[options.platformName] = \"true\";\r\n return preprocessors;\r\n };\r\n ShaderProcessor._ProcessShaderConversion = function (sourceCode, options, engine) {\r\n var preparedSourceCode = this._ProcessPrecision(sourceCode, options);\r\n if (!options.processor) {\r\n return preparedSourceCode;\r\n }\r\n // Already converted\r\n if (preparedSourceCode.indexOf(\"#version 3\") !== -1) {\r\n return preparedSourceCode.replace(\"#version 300 es\", \"\");\r\n }\r\n var defines = options.defines;\r\n var preprocessors = this._PreparePreProcessors(options);\r\n // General pre processing\r\n if (options.processor.preProcessor) {\r\n preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, options.isFragment);\r\n }\r\n preparedSourceCode = this._EvaluatePreProcessors(preparedSourceCode, preprocessors, options);\r\n // Post processing\r\n if (options.processor.postProcessor) {\r\n preparedSourceCode = options.processor.postProcessor(preparedSourceCode, defines, options.isFragment, engine);\r\n }\r\n return preparedSourceCode;\r\n };\r\n ShaderProcessor._ProcessIncludes = function (sourceCode, options, callback) {\r\n var _this = this;\r\n var regex = /#include<(.+)>(\\((.*)\\))*(\\[(.*)\\])*/g;\r\n var match = regex.exec(sourceCode);\r\n var returnValue = new String(sourceCode);\r\n var keepProcessing = false;\r\n while (match != null) {\r\n var includeFile = match[1];\r\n // Uniform declaration\r\n if (includeFile.indexOf(\"__decl__\") !== -1) {\r\n includeFile = includeFile.replace(/__decl__/, \"\");\r\n if (options.supportsUniformBuffers) {\r\n includeFile = includeFile.replace(/Vertex/, \"Ubo\");\r\n includeFile = includeFile.replace(/Fragment/, \"Ubo\");\r\n }\r\n includeFile = includeFile + \"Declaration\";\r\n }\r\n if (options.includesShadersStore[includeFile]) {\r\n // Substitution\r\n var includeContent = options.includesShadersStore[includeFile];\r\n if (match[2]) {\r\n var splits = match[3].split(\",\");\r\n for (var index = 0; index < splits.length; index += 2) {\r\n var source = new RegExp(splits[index], \"g\");\r\n var dest = splits[index + 1];\r\n includeContent = includeContent.replace(source, dest);\r\n }\r\n }\r\n if (match[4]) {\r\n var indexString = match[5];\r\n if (indexString.indexOf(\"..\") !== -1) {\r\n var indexSplits = indexString.split(\"..\");\r\n var minIndex = parseInt(indexSplits[0]);\r\n var maxIndex = parseInt(indexSplits[1]);\r\n var sourceIncludeContent = includeContent.slice(0);\r\n includeContent = \"\";\r\n if (isNaN(maxIndex)) {\r\n maxIndex = options.indexParameters[indexSplits[1]];\r\n }\r\n for (var i = minIndex; i < maxIndex; i++) {\r\n if (!options.supportsUniformBuffers) {\r\n // Ubo replacement\r\n sourceIncludeContent = sourceIncludeContent.replace(/light\\{X\\}.(\\w*)/g, function (str, p1) {\r\n return p1 + \"{X}\";\r\n });\r\n }\r\n includeContent += sourceIncludeContent.replace(/\\{X\\}/g, i.toString()) + \"\\n\";\r\n }\r\n }\r\n else {\r\n if (!options.supportsUniformBuffers) {\r\n // Ubo replacement\r\n includeContent = includeContent.replace(/light\\{X\\}.(\\w*)/g, function (str, p1) {\r\n return p1 + \"{X}\";\r\n });\r\n }\r\n includeContent = includeContent.replace(/\\{X\\}/g, indexString);\r\n }\r\n }\r\n // Replace\r\n returnValue = returnValue.replace(match[0], includeContent);\r\n keepProcessing = keepProcessing || includeContent.indexOf(\"#include<\") >= 0;\r\n }\r\n else {\r\n var includeShaderUrl = options.shadersRepository + \"ShadersInclude/\" + includeFile + \".fx\";\r\n ShaderProcessor._FileToolsLoadFile(includeShaderUrl, function (fileContent) {\r\n options.includesShadersStore[includeFile] = fileContent;\r\n _this._ProcessIncludes(returnValue, options, callback);\r\n });\r\n return;\r\n }\r\n match = regex.exec(sourceCode);\r\n }\r\n if (keepProcessing) {\r\n this._ProcessIncludes(returnValue.toString(), options, callback);\r\n }\r\n else {\r\n callback(returnValue);\r\n }\r\n };\r\n /**\r\n * Loads a file from a url\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n * @hidden\r\n */\r\n ShaderProcessor._FileToolsLoadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n throw _DevTools.WarnImport(\"FileTools\");\r\n };\r\n return ShaderProcessor;\r\n}());\r\nexport { ShaderProcessor };\r\n//# sourceMappingURL=shaderProcessor.js.map","/** Defines the cross module used constants to avoid circular dependncies */\r\nvar Constants = /** @class */ (function () {\r\n function Constants() {\r\n }\r\n /** Defines that alpha blending is disabled */\r\n Constants.ALPHA_DISABLE = 0;\r\n /** Defines that alpha blending is SRC ALPHA * SRC + DEST */\r\n Constants.ALPHA_ADD = 1;\r\n /** Defines that alpha blending is SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */\r\n Constants.ALPHA_COMBINE = 2;\r\n /** Defines that alpha blending is DEST - SRC * DEST */\r\n Constants.ALPHA_SUBTRACT = 3;\r\n /** Defines that alpha blending is SRC * DEST */\r\n Constants.ALPHA_MULTIPLY = 4;\r\n /** Defines that alpha blending is SRC ALPHA * SRC + (1 - SRC) * DEST */\r\n Constants.ALPHA_MAXIMIZED = 5;\r\n /** Defines that alpha blending is SRC + DEST */\r\n Constants.ALPHA_ONEONE = 6;\r\n /** Defines that alpha blending is SRC + (1 - SRC ALPHA) * DEST */\r\n Constants.ALPHA_PREMULTIPLIED = 7;\r\n /**\r\n * Defines that alpha blending is SRC + (1 - SRC ALPHA) * DEST\r\n * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Constants.ALPHA_PREMULTIPLIED_PORTERDUFF = 8;\r\n /** Defines that alpha blending is CST * SRC + (1 - CST) * DEST */\r\n Constants.ALPHA_INTERPOLATE = 9;\r\n /**\r\n * Defines that alpha blending is SRC + (1 - SRC) * DEST\r\n * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Constants.ALPHA_SCREENMODE = 10;\r\n /**\r\n * Defines that alpha blending is SRC + DST\r\n * Alpha will be set to SRC ALPHA + DST ALPHA\r\n */\r\n Constants.ALPHA_ONEONE_ONEONE = 11;\r\n /**\r\n * Defines that alpha blending is SRC * DST ALPHA + DST\r\n * Alpha will be set to 0\r\n */\r\n Constants.ALPHA_ALPHATOCOLOR = 12;\r\n /**\r\n * Defines that alpha blending is SRC * (1 - DST) + DST * (1 - SRC)\r\n */\r\n Constants.ALPHA_REVERSEONEMINUS = 13;\r\n /**\r\n * Defines that alpha blending is SRC + DST * (1 - SRC ALPHA)\r\n * Alpha will be set to SRC ALPHA + DST ALPHA * (1 - SRC ALPHA)\r\n */\r\n Constants.ALPHA_SRC_DSTONEMINUSSRCALPHA = 14;\r\n /**\r\n * Defines that alpha blending is SRC + DST\r\n * Alpha will be set to SRC ALPHA\r\n */\r\n Constants.ALPHA_ONEONE_ONEZERO = 15;\r\n /**\r\n * Defines that alpha blending is SRC * (1 - DST) + DST * (1 - SRC)\r\n * Alpha will be set to DST ALPHA\r\n */\r\n Constants.ALPHA_EXCLUSION = 16;\r\n /** Defines that alpha blending equation a SUM */\r\n Constants.ALPHA_EQUATION_ADD = 0;\r\n /** Defines that alpha blending equation a SUBSTRACTION */\r\n Constants.ALPHA_EQUATION_SUBSTRACT = 1;\r\n /** Defines that alpha blending equation a REVERSE SUBSTRACTION */\r\n Constants.ALPHA_EQUATION_REVERSE_SUBTRACT = 2;\r\n /** Defines that alpha blending equation a MAX operation */\r\n Constants.ALPHA_EQUATION_MAX = 3;\r\n /** Defines that alpha blending equation a MIN operation */\r\n Constants.ALPHA_EQUATION_MIN = 4;\r\n /**\r\n * Defines that alpha blending equation a DARKEN operation:\r\n * It takes the min of the src and sums the alpha channels.\r\n */\r\n Constants.ALPHA_EQUATION_DARKEN = 5;\r\n /** Defines that the ressource is not delayed*/\r\n Constants.DELAYLOADSTATE_NONE = 0;\r\n /** Defines that the ressource was successfully delay loaded */\r\n Constants.DELAYLOADSTATE_LOADED = 1;\r\n /** Defines that the ressource is currently delay loading */\r\n Constants.DELAYLOADSTATE_LOADING = 2;\r\n /** Defines that the ressource is delayed and has not started loading */\r\n Constants.DELAYLOADSTATE_NOTLOADED = 4;\r\n // Depht or Stencil test Constants.\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */\r\n Constants.NEVER = 0x0200;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\r\n Constants.ALWAYS = 0x0207;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */\r\n Constants.LESS = 0x0201;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */\r\n Constants.EQUAL = 0x0202;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */\r\n Constants.LEQUAL = 0x0203;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */\r\n Constants.GREATER = 0x0204;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */\r\n Constants.GEQUAL = 0x0206;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */\r\n Constants.NOTEQUAL = 0x0205;\r\n // Stencil Actions Constants.\r\n /** Passed to stencilOperation to specify that stencil value must be kept */\r\n Constants.KEEP = 0x1E00;\r\n /** Passed to stencilOperation to specify that stencil value must be replaced */\r\n Constants.REPLACE = 0x1E01;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented */\r\n Constants.INCR = 0x1E02;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented */\r\n Constants.DECR = 0x1E03;\r\n /** Passed to stencilOperation to specify that stencil value must be inverted */\r\n Constants.INVERT = 0x150A;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */\r\n Constants.INCR_WRAP = 0x8507;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */\r\n Constants.DECR_WRAP = 0x8508;\r\n /** Texture is not repeating outside of 0..1 UVs */\r\n Constants.TEXTURE_CLAMP_ADDRESSMODE = 0;\r\n /** Texture is repeating outside of 0..1 UVs */\r\n Constants.TEXTURE_WRAP_ADDRESSMODE = 1;\r\n /** Texture is repeating and mirrored */\r\n Constants.TEXTURE_MIRROR_ADDRESSMODE = 2;\r\n /** ALPHA */\r\n Constants.TEXTUREFORMAT_ALPHA = 0;\r\n /** LUMINANCE */\r\n Constants.TEXTUREFORMAT_LUMINANCE = 1;\r\n /** LUMINANCE_ALPHA */\r\n Constants.TEXTUREFORMAT_LUMINANCE_ALPHA = 2;\r\n /** RGB */\r\n Constants.TEXTUREFORMAT_RGB = 4;\r\n /** RGBA */\r\n Constants.TEXTUREFORMAT_RGBA = 5;\r\n /** RED */\r\n Constants.TEXTUREFORMAT_RED = 6;\r\n /** RED (2nd reference) */\r\n Constants.TEXTUREFORMAT_R = 6;\r\n /** RG */\r\n Constants.TEXTUREFORMAT_RG = 7;\r\n /** RED_INTEGER */\r\n Constants.TEXTUREFORMAT_RED_INTEGER = 8;\r\n /** RED_INTEGER (2nd reference) */\r\n Constants.TEXTUREFORMAT_R_INTEGER = 8;\r\n /** RG_INTEGER */\r\n Constants.TEXTUREFORMAT_RG_INTEGER = 9;\r\n /** RGB_INTEGER */\r\n Constants.TEXTUREFORMAT_RGB_INTEGER = 10;\r\n /** RGBA_INTEGER */\r\n Constants.TEXTUREFORMAT_RGBA_INTEGER = 11;\r\n /** UNSIGNED_BYTE */\r\n Constants.TEXTURETYPE_UNSIGNED_BYTE = 0;\r\n /** UNSIGNED_BYTE (2nd reference) */\r\n Constants.TEXTURETYPE_UNSIGNED_INT = 0;\r\n /** FLOAT */\r\n Constants.TEXTURETYPE_FLOAT = 1;\r\n /** HALF_FLOAT */\r\n Constants.TEXTURETYPE_HALF_FLOAT = 2;\r\n /** BYTE */\r\n Constants.TEXTURETYPE_BYTE = 3;\r\n /** SHORT */\r\n Constants.TEXTURETYPE_SHORT = 4;\r\n /** UNSIGNED_SHORT */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT = 5;\r\n /** INT */\r\n Constants.TEXTURETYPE_INT = 6;\r\n /** UNSIGNED_INT */\r\n Constants.TEXTURETYPE_UNSIGNED_INTEGER = 7;\r\n /** UNSIGNED_SHORT_4_4_4_4 */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = 8;\r\n /** UNSIGNED_SHORT_5_5_5_1 */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = 9;\r\n /** UNSIGNED_SHORT_5_6_5 */\r\n Constants.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = 10;\r\n /** UNSIGNED_INT_2_10_10_10_REV */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = 11;\r\n /** UNSIGNED_INT_24_8 */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_24_8 = 12;\r\n /** UNSIGNED_INT_10F_11F_11F_REV */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = 13;\r\n /** UNSIGNED_INT_5_9_9_9_REV */\r\n Constants.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = 14;\r\n /** FLOAT_32_UNSIGNED_INT_24_8_REV */\r\n Constants.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = 15;\r\n /** nearest is mag = nearest and min = nearest and no mip */\r\n Constants.TEXTURE_NEAREST_SAMPLINGMODE = 1;\r\n /** mag = nearest and min = nearest and mip = none */\r\n Constants.TEXTURE_NEAREST_NEAREST = 1;\r\n /** Bilinear is mag = linear and min = linear and no mip */\r\n Constants.TEXTURE_BILINEAR_SAMPLINGMODE = 2;\r\n /** mag = linear and min = linear and mip = none */\r\n Constants.TEXTURE_LINEAR_LINEAR = 2;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Constants.TEXTURE_TRILINEAR_SAMPLINGMODE = 3;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR = 3;\r\n /** mag = nearest and min = nearest and mip = nearest */\r\n Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST = 4;\r\n /** mag = nearest and min = linear and mip = nearest */\r\n Constants.TEXTURE_NEAREST_LINEAR_MIPNEAREST = 5;\r\n /** mag = nearest and min = linear and mip = linear */\r\n Constants.TEXTURE_NEAREST_LINEAR_MIPLINEAR = 6;\r\n /** mag = nearest and min = linear and mip = none */\r\n Constants.TEXTURE_NEAREST_LINEAR = 7;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Constants.TEXTURE_NEAREST_NEAREST_MIPLINEAR = 8;\r\n /** mag = linear and min = nearest and mip = nearest */\r\n Constants.TEXTURE_LINEAR_NEAREST_MIPNEAREST = 9;\r\n /** mag = linear and min = nearest and mip = linear */\r\n Constants.TEXTURE_LINEAR_NEAREST_MIPLINEAR = 10;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST = 11;\r\n /** mag = linear and min = nearest and mip = none */\r\n Constants.TEXTURE_LINEAR_NEAREST = 12;\r\n /** Explicit coordinates mode */\r\n Constants.TEXTURE_EXPLICIT_MODE = 0;\r\n /** Spherical coordinates mode */\r\n Constants.TEXTURE_SPHERICAL_MODE = 1;\r\n /** Planar coordinates mode */\r\n Constants.TEXTURE_PLANAR_MODE = 2;\r\n /** Cubic coordinates mode */\r\n Constants.TEXTURE_CUBIC_MODE = 3;\r\n /** Projection coordinates mode */\r\n Constants.TEXTURE_PROJECTION_MODE = 4;\r\n /** Skybox coordinates mode */\r\n Constants.TEXTURE_SKYBOX_MODE = 5;\r\n /** Inverse Cubic coordinates mode */\r\n Constants.TEXTURE_INVCUBIC_MODE = 6;\r\n /** Equirectangular coordinates mode */\r\n Constants.TEXTURE_EQUIRECTANGULAR_MODE = 7;\r\n /** Equirectangular Fixed coordinates mode */\r\n Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = 8;\r\n /** Equirectangular Fixed Mirrored coordinates mode */\r\n Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9;\r\n /** Offline (baking) quality for texture filtering */\r\n Constants.TEXTURE_FILTERING_QUALITY_OFFLINE = 4096;\r\n /** High quality for texture filtering */\r\n Constants.TEXTURE_FILTERING_QUALITY_HIGH = 64;\r\n /** Medium quality for texture filtering */\r\n Constants.TEXTURE_FILTERING_QUALITY_MEDIUM = 16;\r\n /** Low quality for texture filtering */\r\n Constants.TEXTURE_FILTERING_QUALITY_LOW = 8;\r\n // Texture rescaling mode\r\n /** Defines that texture rescaling will use a floor to find the closer power of 2 size */\r\n Constants.SCALEMODE_FLOOR = 1;\r\n /** Defines that texture rescaling will look for the nearest power of 2 size */\r\n Constants.SCALEMODE_NEAREST = 2;\r\n /** Defines that texture rescaling will use a ceil to find the closer power of 2 size */\r\n Constants.SCALEMODE_CEILING = 3;\r\n /**\r\n * The dirty texture flag value\r\n */\r\n Constants.MATERIAL_TextureDirtyFlag = 1;\r\n /**\r\n * The dirty light flag value\r\n */\r\n Constants.MATERIAL_LightDirtyFlag = 2;\r\n /**\r\n * The dirty fresnel flag value\r\n */\r\n Constants.MATERIAL_FresnelDirtyFlag = 4;\r\n /**\r\n * The dirty attribute flag value\r\n */\r\n Constants.MATERIAL_AttributesDirtyFlag = 8;\r\n /**\r\n * The dirty misc flag value\r\n */\r\n Constants.MATERIAL_MiscDirtyFlag = 16;\r\n /**\r\n * The dirty prepass flag value\r\n */\r\n Constants.MATERIAL_PrePassDirtyFlag = 32;\r\n /**\r\n * The all dirty flag value\r\n */\r\n Constants.MATERIAL_AllDirtyFlag = 63;\r\n /**\r\n * Returns the triangle fill mode\r\n */\r\n Constants.MATERIAL_TriangleFillMode = 0;\r\n /**\r\n * Returns the wireframe mode\r\n */\r\n Constants.MATERIAL_WireFrameFillMode = 1;\r\n /**\r\n * Returns the point fill mode\r\n */\r\n Constants.MATERIAL_PointFillMode = 2;\r\n /**\r\n * Returns the point list draw mode\r\n */\r\n Constants.MATERIAL_PointListDrawMode = 3;\r\n /**\r\n * Returns the line list draw mode\r\n */\r\n Constants.MATERIAL_LineListDrawMode = 4;\r\n /**\r\n * Returns the line loop draw mode\r\n */\r\n Constants.MATERIAL_LineLoopDrawMode = 5;\r\n /**\r\n * Returns the line strip draw mode\r\n */\r\n Constants.MATERIAL_LineStripDrawMode = 6;\r\n /**\r\n * Returns the triangle strip draw mode\r\n */\r\n Constants.MATERIAL_TriangleStripDrawMode = 7;\r\n /**\r\n * Returns the triangle fan draw mode\r\n */\r\n Constants.MATERIAL_TriangleFanDrawMode = 8;\r\n /**\r\n * Stores the clock-wise side orientation\r\n */\r\n Constants.MATERIAL_ClockWiseSideOrientation = 0;\r\n /**\r\n * Stores the counter clock-wise side orientation\r\n */\r\n Constants.MATERIAL_CounterClockWiseSideOrientation = 1;\r\n /**\r\n * Nothing\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_NothingTrigger = 0;\r\n /**\r\n * On pick\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickTrigger = 1;\r\n /**\r\n * On left pick\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnLeftPickTrigger = 2;\r\n /**\r\n * On right pick\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnRightPickTrigger = 3;\r\n /**\r\n * On center pick\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnCenterPickTrigger = 4;\r\n /**\r\n * On pick down\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickDownTrigger = 5;\r\n /**\r\n * On double pick\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnDoublePickTrigger = 6;\r\n /**\r\n * On pick up\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickUpTrigger = 7;\r\n /**\r\n * On pick out.\r\n * This trigger will only be raised if you also declared a OnPickDown\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPickOutTrigger = 16;\r\n /**\r\n * On long press\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnLongPressTrigger = 8;\r\n /**\r\n * On pointer over\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPointerOverTrigger = 9;\r\n /**\r\n * On pointer out\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnPointerOutTrigger = 10;\r\n /**\r\n * On every frame\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnEveryFrameTrigger = 11;\r\n /**\r\n * On intersection enter\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnIntersectionEnterTrigger = 12;\r\n /**\r\n * On intersection exit\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnIntersectionExitTrigger = 13;\r\n /**\r\n * On key down\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnKeyDownTrigger = 14;\r\n /**\r\n * On key up\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions#triggers\r\n */\r\n Constants.ACTION_OnKeyUpTrigger = 15;\r\n /**\r\n * Billboard mode will only apply to Y axis\r\n */\r\n Constants.PARTICLES_BILLBOARDMODE_Y = 2;\r\n /**\r\n * Billboard mode will apply to all axes\r\n */\r\n Constants.PARTICLES_BILLBOARDMODE_ALL = 7;\r\n /**\r\n * Special billboard mode where the particle will be biilboard to the camera but rotated to align with direction\r\n */\r\n Constants.PARTICLES_BILLBOARDMODE_STRETCHED = 8;\r\n /** Default culling strategy : this is an exclusion test and it's the more accurate.\r\n * Test order :\r\n * Is the bounding sphere outside the frustum ?\r\n * If not, are the bounding box vertices outside the frustum ?\r\n * It not, then the cullable object is in the frustum.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_STANDARD = 0;\r\n /** Culling strategy : Bounding Sphere Only.\r\n * This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested.\r\n * It's also less accurate than the standard because some not visible objects can still be selected.\r\n * Test : is the bounding sphere outside the frustum ?\r\n * If not, then the cullable object is in the frustum.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = 1;\r\n /** Culling strategy : Optimistic Inclusion.\r\n * This in an inclusion test first, then the standard exclusion test.\r\n * This can be faster when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside.\r\n * Anyway, it's as accurate as the standard strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the default culling strategy.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = 2;\r\n /** Culling strategy : Optimistic Inclusion then Bounding Sphere Only.\r\n * This in an inclusion test first, then the bounding sphere only exclusion test.\r\n * This can be the fastest test when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it.\r\n * It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here.\r\n */\r\n Constants.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = 3;\r\n /**\r\n * No logging while loading\r\n */\r\n Constants.SCENELOADER_NO_LOGGING = 0;\r\n /**\r\n * Minimal logging while loading\r\n */\r\n Constants.SCENELOADER_MINIMAL_LOGGING = 1;\r\n /**\r\n * Summary logging while loading\r\n */\r\n Constants.SCENELOADER_SUMMARY_LOGGING = 2;\r\n /**\r\n * Detailled logging while loading\r\n */\r\n Constants.SCENELOADER_DETAILED_LOGGING = 3;\r\n /**\r\n * Constant used to retrieve the irradiance texture index in the textures array in the prepass\r\n * using getIndex(0)\r\n */\r\n Constants.PREPASS_IRRADIANCE_TEXTURE_TYPE = 0;\r\n /**\r\n * Constant used to retrieve the position texture index in the textures array in the prepass\r\n * using getIndex(undefined)\r\n */\r\n Constants.PREPASS_POSITION_TEXTURE_TYPE = 1;\r\n /**\r\n * Constant used to retrieve the velocity texture index in the textures array in the prepass\r\n * using getIndex(undefined)\r\n */\r\n Constants.PREPASS_VELOCITY_TEXTURE_TYPE = 2;\r\n /**\r\n * Constant used to retrieve the reflectivity texture index in the textures array in the prepass\r\n * using the getIndex(3)\r\n */\r\n Constants.PREPASS_REFLECTIVITY_TEXTURE_TYPE = 3;\r\n /**\r\n * Constant used to retrieve the lit color texture index in the textures array in the prepass\r\n * using the getIndex(4)\r\n */\r\n Constants.PREPASS_COLOR_TEXTURE_TYPE = 4;\r\n /**\r\n * Constant used to retrieve depth + normal index in the textures array in the prepass\r\n * using the getIndex(5)\r\n */\r\n Constants.PREPASS_DEPTHNORMAL_TEXTURE_TYPE = 5;\r\n /**\r\n * Constant used to retrieve albedo index in the textures array in the prepass\r\n * using the getIndex(6)\r\n */\r\n Constants.PREPASS_ALBEDO_TEXTURE_TYPE = 6;\r\n return Constants;\r\n}());\r\nexport { Constants };\r\n//# sourceMappingURL=constants.js.map","import { PrecisionDate } from \"./precisionDate\";\r\n/**\r\n * Performance monitor tracks rolling average frame-time and frame-time variance over a user defined sliding-window\r\n */\r\nvar PerformanceMonitor = /** @class */ (function () {\r\n /**\r\n * constructor\r\n * @param frameSampleSize The number of samples required to saturate the sliding window\r\n */\r\n function PerformanceMonitor(frameSampleSize) {\r\n if (frameSampleSize === void 0) { frameSampleSize = 30; }\r\n this._enabled = true;\r\n this._rollingFrameTime = new RollingAverage(frameSampleSize);\r\n }\r\n /**\r\n * Samples current frame\r\n * @param timeMs A timestamp in milliseconds of the current frame to compare with other frames\r\n */\r\n PerformanceMonitor.prototype.sampleFrame = function (timeMs) {\r\n if (timeMs === void 0) { timeMs = PrecisionDate.Now; }\r\n if (!this._enabled) {\r\n return;\r\n }\r\n if (this._lastFrameTimeMs != null) {\r\n var dt = timeMs - this._lastFrameTimeMs;\r\n this._rollingFrameTime.add(dt);\r\n }\r\n this._lastFrameTimeMs = timeMs;\r\n };\r\n Object.defineProperty(PerformanceMonitor.prototype, \"averageFrameTime\", {\r\n /**\r\n * Returns the average frame time in milliseconds over the sliding window (or the subset of frames sampled so far)\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.average;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"averageFrameTimeVariance\", {\r\n /**\r\n * Returns the variance frame time in milliseconds over the sliding window (or the subset of frames sampled so far)\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.variance;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"instantaneousFrameTime\", {\r\n /**\r\n * Returns the frame time of the most recent frame\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.history(0);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"averageFPS\", {\r\n /**\r\n * Returns the average framerate in frames per second over the sliding window (or the subset of frames sampled so far)\r\n */\r\n get: function () {\r\n return 1000.0 / this._rollingFrameTime.average;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"instantaneousFPS\", {\r\n /**\r\n * Returns the average framerate in frames per second using the most recent frame time\r\n */\r\n get: function () {\r\n var history = this._rollingFrameTime.history(0);\r\n if (history === 0) {\r\n return 0;\r\n }\r\n return 1000.0 / history;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerformanceMonitor.prototype, \"isSaturated\", {\r\n /**\r\n * Returns true if enough samples have been taken to completely fill the sliding window\r\n */\r\n get: function () {\r\n return this._rollingFrameTime.isSaturated();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Enables contributions to the sliding window sample set\r\n */\r\n PerformanceMonitor.prototype.enable = function () {\r\n this._enabled = true;\r\n };\r\n /**\r\n * Disables contributions to the sliding window sample set\r\n * Samples will not be interpolated over the disabled period\r\n */\r\n PerformanceMonitor.prototype.disable = function () {\r\n this._enabled = false;\r\n //clear last sample to avoid interpolating over the disabled period when next enabled\r\n this._lastFrameTimeMs = null;\r\n };\r\n Object.defineProperty(PerformanceMonitor.prototype, \"isEnabled\", {\r\n /**\r\n * Returns true if sampling is enabled\r\n */\r\n get: function () {\r\n return this._enabled;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Resets performance monitor\r\n */\r\n PerformanceMonitor.prototype.reset = function () {\r\n //clear last sample to avoid interpolating over the disabled period when next enabled\r\n this._lastFrameTimeMs = null;\r\n //wipe record\r\n this._rollingFrameTime.reset();\r\n };\r\n return PerformanceMonitor;\r\n}());\r\nexport { PerformanceMonitor };\r\n/**\r\n * RollingAverage\r\n *\r\n * Utility to efficiently compute the rolling average and variance over a sliding window of samples\r\n */\r\nvar RollingAverage = /** @class */ (function () {\r\n /**\r\n * constructor\r\n * @param length The number of samples required to saturate the sliding window\r\n */\r\n function RollingAverage(length) {\r\n this._samples = new Array(length);\r\n this.reset();\r\n }\r\n /**\r\n * Adds a sample to the sample set\r\n * @param v The sample value\r\n */\r\n RollingAverage.prototype.add = function (v) {\r\n //http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance\r\n var delta;\r\n //we need to check if we've already wrapped round\r\n if (this.isSaturated()) {\r\n //remove bottom of stack from mean\r\n var bottomValue = this._samples[this._pos];\r\n delta = bottomValue - this.average;\r\n this.average -= delta / (this._sampleCount - 1);\r\n this._m2 -= delta * (bottomValue - this.average);\r\n }\r\n else {\r\n this._sampleCount++;\r\n }\r\n //add new value to mean\r\n delta = v - this.average;\r\n this.average += delta / (this._sampleCount);\r\n this._m2 += delta * (v - this.average);\r\n //set the new variance\r\n this.variance = this._m2 / (this._sampleCount - 1);\r\n this._samples[this._pos] = v;\r\n this._pos++;\r\n this._pos %= this._samples.length; //positive wrap around\r\n };\r\n /**\r\n * Returns previously added values or null if outside of history or outside the sliding window domain\r\n * @param i Index in history. For example, pass 0 for the most recent value and 1 for the value before that\r\n * @return Value previously recorded with add() or null if outside of range\r\n */\r\n RollingAverage.prototype.history = function (i) {\r\n if ((i >= this._sampleCount) || (i >= this._samples.length)) {\r\n return 0;\r\n }\r\n var i0 = this._wrapPosition(this._pos - 1.0);\r\n return this._samples[this._wrapPosition(i0 - i)];\r\n };\r\n /**\r\n * Returns true if enough samples have been taken to completely fill the sliding window\r\n * @return true if sample-set saturated\r\n */\r\n RollingAverage.prototype.isSaturated = function () {\r\n return this._sampleCount >= this._samples.length;\r\n };\r\n /**\r\n * Resets the rolling average (equivalent to 0 samples taken so far)\r\n */\r\n RollingAverage.prototype.reset = function () {\r\n this.average = 0;\r\n this.variance = 0;\r\n this._sampleCount = 0;\r\n this._pos = 0;\r\n this._m2 = 0;\r\n };\r\n /**\r\n * Wraps a value around the sample range boundaries\r\n * @param i Position in sample range, for example if the sample length is 5, and i is -3, then 2 will be returned.\r\n * @return Wrapped position in sample range\r\n */\r\n RollingAverage.prototype._wrapPosition = function (i) {\r\n var max = this._samples.length;\r\n return ((i % max) + max) % max;\r\n };\r\n return RollingAverage;\r\n}());\r\nexport { RollingAverage };\r\n//# sourceMappingURL=performanceMonitor.js.map","import { ThinEngine } from \"../../Engines/thinEngine\";\r\nThinEngine.prototype.setAlphaConstants = function (r, g, b, a) {\r\n this._alphaState.setAlphaBlendConstants(r, g, b, a);\r\n};\r\nThinEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange) {\r\n if (noDepthWriteChange === void 0) { noDepthWriteChange = false; }\r\n if (this._alphaMode === mode) {\r\n return;\r\n }\r\n switch (mode) {\r\n case 0:\r\n this._alphaState.alphaBlend = false;\r\n break;\r\n case 7:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 8:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 2:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 6:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 1:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 3:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 4:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 5:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 9:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR, this._gl.ONE_MINUS_CONSTANT_COLOR, this._gl.CONSTANT_ALPHA, this._gl.ONE_MINUS_CONSTANT_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 10:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 11:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 12:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ZERO);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 13:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE_MINUS_DST_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 14:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 15:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ZERO);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n case 16:\r\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ZERO, this._gl.ONE);\r\n this._alphaState.alphaBlend = true;\r\n break;\r\n }\r\n if (!noDepthWriteChange) {\r\n this.depthCullingState.depthMask = (mode === 0);\r\n }\r\n this._alphaMode = mode;\r\n};\r\nThinEngine.prototype.getAlphaMode = function () {\r\n return this._alphaMode;\r\n};\r\nThinEngine.prototype.setAlphaEquation = function (equation) {\r\n if (this._alphaEquation === equation) {\r\n return;\r\n }\r\n switch (equation) {\r\n case 0:\r\n this._alphaState.setAlphaEquationParameters(this._gl.FUNC_ADD, this._gl.FUNC_ADD);\r\n break;\r\n case 1:\r\n this._alphaState.setAlphaEquationParameters(this._gl.FUNC_SUBTRACT, this._gl.FUNC_SUBTRACT);\r\n break;\r\n case 2:\r\n this._alphaState.setAlphaEquationParameters(this._gl.FUNC_REVERSE_SUBTRACT, this._gl.FUNC_REVERSE_SUBTRACT);\r\n break;\r\n case 3:\r\n this._alphaState.setAlphaEquationParameters(this._gl.MAX, this._gl.MAX);\r\n break;\r\n case 4:\r\n this._alphaState.setAlphaEquationParameters(this._gl.MIN, this._gl.MIN);\r\n break;\r\n case 5:\r\n this._alphaState.setAlphaEquationParameters(this._gl.MIN, this._gl.FUNC_ADD);\r\n break;\r\n }\r\n this._alphaEquation = equation;\r\n};\r\nThinEngine.prototype.getAlphaEquation = function () {\r\n return this._alphaEquation;\r\n};\r\n//# sourceMappingURL=engine.alpha.js.map","import { ThinEngine } from \"../../Engines/thinEngine\";\r\nThinEngine.prototype.updateDynamicIndexBuffer = function (indexBuffer, indices, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n // Force cache update\r\n this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER] = null;\r\n this.bindIndexBuffer(indexBuffer);\r\n var arrayBuffer;\r\n if (indices instanceof Uint16Array || indices instanceof Uint32Array) {\r\n arrayBuffer = indices;\r\n }\r\n else {\r\n arrayBuffer = indexBuffer.is32Bits ? new Uint32Array(indices) : new Uint16Array(indices);\r\n }\r\n this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, arrayBuffer, this._gl.DYNAMIC_DRAW);\r\n this._resetIndexBufferBinding();\r\n};\r\nThinEngine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, data, byteOffset, byteLength) {\r\n this.bindArrayBuffer(vertexBuffer);\r\n if (byteOffset === undefined) {\r\n byteOffset = 0;\r\n }\r\n var dataLength = data.length || data.byteLength;\r\n if (byteLength === undefined || byteLength >= dataLength && byteOffset === 0) {\r\n if (data instanceof Array) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, new Float32Array(data));\r\n }\r\n else {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, data);\r\n }\r\n }\r\n else {\r\n if (data instanceof Array) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(data).subarray(byteOffset, byteOffset + byteLength));\r\n }\r\n else {\r\n if (data instanceof ArrayBuffer) {\r\n data = new Uint8Array(data, byteOffset, byteLength);\r\n }\r\n else {\r\n data = new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);\r\n }\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\r\n }\r\n }\r\n this._resetVertexBufferBinding();\r\n};\r\n//# sourceMappingURL=engine.dynamicBuffer.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { DomManagement } from \"../Misc/domManagement\";\r\nimport { EngineStore } from \"./engineStore\";\r\nimport { _DevTools } from '../Misc/devTools';\r\nimport { ThinEngine } from './thinEngine';\r\nimport { PerformanceMonitor } from '../Misc/performanceMonitor';\r\nimport { PerfCounter } from '../Misc/perfCounter';\r\nimport { WebGLDataBuffer } from '../Meshes/WebGL/webGLDataBuffer';\r\nimport { Logger } from '../Misc/logger';\r\nimport \"./Extensions/engine.alpha\";\r\nimport \"./Extensions/engine.readTexture\";\r\nimport \"./Extensions/engine.dynamicBuffer\";\r\n/**\r\n * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio\r\n */\r\nvar Engine = /** @class */ (function (_super) {\r\n __extends(Engine, _super);\r\n /**\r\n * Creates a new engine\r\n * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which alreay used the WebGL context\r\n * @param antialias defines enable antialiasing (default: false)\r\n * @param options defines further options to be sent to the getContext() function\r\n * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)\r\n */\r\n function Engine(canvasOrContext, antialias, options, adaptToDeviceRatio) {\r\n if (adaptToDeviceRatio === void 0) { adaptToDeviceRatio = false; }\r\n var _this = _super.call(this, canvasOrContext, antialias, options, adaptToDeviceRatio) || this;\r\n // Members\r\n /**\r\n * Gets or sets a boolean to enable/disable IndexedDB support and avoid XHR on .manifest\r\n **/\r\n _this.enableOfflineSupport = false;\r\n /**\r\n * Gets or sets a boolean to enable/disable checking manifest if IndexedDB support is enabled (js will always consider the database is up to date)\r\n **/\r\n _this.disableManifestCheck = false;\r\n /**\r\n * Gets the list of created scenes\r\n */\r\n _this.scenes = new Array();\r\n /**\r\n * Event raised when a new scene is created\r\n */\r\n _this.onNewSceneAddedObservable = new Observable();\r\n /**\r\n * Gets the list of created postprocesses\r\n */\r\n _this.postProcesses = new Array();\r\n /**\r\n * Gets a boolean indicating if the pointer is currently locked\r\n */\r\n _this.isPointerLock = false;\r\n // Observables\r\n /**\r\n * Observable event triggered each time the rendering canvas is resized\r\n */\r\n _this.onResizeObservable = new Observable();\r\n /**\r\n * Observable event triggered each time the canvas loses focus\r\n */\r\n _this.onCanvasBlurObservable = new Observable();\r\n /**\r\n * Observable event triggered each time the canvas gains focus\r\n */\r\n _this.onCanvasFocusObservable = new Observable();\r\n /**\r\n * Observable event triggered each time the canvas receives pointerout event\r\n */\r\n _this.onCanvasPointerOutObservable = new Observable();\r\n /**\r\n * Observable raised when the engine begins a new frame\r\n */\r\n _this.onBeginFrameObservable = new Observable();\r\n /**\r\n * If set, will be used to request the next animation frame for the render loop\r\n */\r\n _this.customAnimationFrameRequester = null;\r\n /**\r\n * Observable raised when the engine ends the current frame\r\n */\r\n _this.onEndFrameObservable = new Observable();\r\n /**\r\n * Observable raised when the engine is about to compile a shader\r\n */\r\n _this.onBeforeShaderCompilationObservable = new Observable();\r\n /**\r\n * Observable raised when the engine has jsut compiled a shader\r\n */\r\n _this.onAfterShaderCompilationObservable = new Observable();\r\n // Deterministic lockstepMaxSteps\r\n _this._deterministicLockstep = false;\r\n _this._lockstepMaxSteps = 4;\r\n _this._timeStep = 1 / 60;\r\n // FPS\r\n _this._fps = 60;\r\n _this._deltaTime = 0;\r\n /** @hidden */\r\n _this._drawCalls = new PerfCounter();\r\n /** Gets or sets the tab index to set to the rendering canvas. 1 is the minimum value to set to be able to capture keyboard events */\r\n _this.canvasTabIndex = 1;\r\n /**\r\n * Turn this value on if you want to pause FPS computation when in background\r\n */\r\n _this.disablePerformanceMonitorInBackground = false;\r\n _this._performanceMonitor = new PerformanceMonitor();\r\n Engine.Instances.push(_this);\r\n if (!canvasOrContext) {\r\n return _this;\r\n }\r\n options = _this._creationOptions;\r\n if (canvasOrContext.getContext) {\r\n var canvas_1 = canvasOrContext;\r\n _this._onCanvasFocus = function () {\r\n _this.onCanvasFocusObservable.notifyObservers(_this);\r\n };\r\n _this._onCanvasBlur = function () {\r\n _this.onCanvasBlurObservable.notifyObservers(_this);\r\n };\r\n canvas_1.addEventListener(\"focus\", _this._onCanvasFocus);\r\n canvas_1.addEventListener(\"blur\", _this._onCanvasBlur);\r\n _this._onBlur = function () {\r\n if (_this.disablePerformanceMonitorInBackground) {\r\n _this._performanceMonitor.disable();\r\n }\r\n _this._windowIsBackground = true;\r\n };\r\n _this._onFocus = function () {\r\n if (_this.disablePerformanceMonitorInBackground) {\r\n _this._performanceMonitor.enable();\r\n }\r\n _this._windowIsBackground = false;\r\n };\r\n _this._onCanvasPointerOut = function (ev) {\r\n _this.onCanvasPointerOutObservable.notifyObservers(ev);\r\n };\r\n canvas_1.addEventListener(\"pointerout\", _this._onCanvasPointerOut);\r\n if (DomManagement.IsWindowObjectExist()) {\r\n var hostWindow = _this.getHostWindow();\r\n hostWindow.addEventListener(\"blur\", _this._onBlur);\r\n hostWindow.addEventListener(\"focus\", _this._onFocus);\r\n var anyDoc_1 = document;\r\n // Fullscreen\r\n _this._onFullscreenChange = function () {\r\n if (anyDoc_1.fullscreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.fullscreen;\r\n }\r\n else if (anyDoc_1.mozFullScreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.mozFullScreen;\r\n }\r\n else if (anyDoc_1.webkitIsFullScreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.webkitIsFullScreen;\r\n }\r\n else if (anyDoc_1.msIsFullScreen !== undefined) {\r\n _this.isFullscreen = anyDoc_1.msIsFullScreen;\r\n }\r\n // Pointer lock\r\n if (_this.isFullscreen && _this._pointerLockRequested && canvas_1) {\r\n Engine._RequestPointerlock(canvas_1);\r\n }\r\n };\r\n document.addEventListener(\"fullscreenchange\", _this._onFullscreenChange, false);\r\n document.addEventListener(\"mozfullscreenchange\", _this._onFullscreenChange, false);\r\n document.addEventListener(\"webkitfullscreenchange\", _this._onFullscreenChange, false);\r\n document.addEventListener(\"msfullscreenchange\", _this._onFullscreenChange, false);\r\n // Pointer lock\r\n _this._onPointerLockChange = function () {\r\n _this.isPointerLock = (anyDoc_1.mozPointerLockElement === canvas_1 ||\r\n anyDoc_1.webkitPointerLockElement === canvas_1 ||\r\n anyDoc_1.msPointerLockElement === canvas_1 ||\r\n anyDoc_1.pointerLockElement === canvas_1);\r\n };\r\n document.addEventListener(\"pointerlockchange\", _this._onPointerLockChange, false);\r\n document.addEventListener(\"mspointerlockchange\", _this._onPointerLockChange, false);\r\n document.addEventListener(\"mozpointerlockchange\", _this._onPointerLockChange, false);\r\n document.addEventListener(\"webkitpointerlockchange\", _this._onPointerLockChange, false);\r\n // Create Audio Engine if needed.\r\n if (!Engine.audioEngine && options.audioEngine && Engine.AudioEngineFactory) {\r\n Engine.audioEngine = Engine.AudioEngineFactory(_this.getRenderingCanvas());\r\n }\r\n }\r\n _this._connectVREvents();\r\n _this.enableOfflineSupport = Engine.OfflineProviderFactory !== undefined;\r\n if (!options.doNotHandleTouchAction) {\r\n _this._disableTouchAction();\r\n }\r\n _this._deterministicLockstep = !!options.deterministicLockstep;\r\n _this._lockstepMaxSteps = options.lockstepMaxSteps || 0;\r\n _this._timeStep = options.timeStep || 1 / 60;\r\n }\r\n // Load WebVR Devices\r\n _this._prepareVRComponent();\r\n if (options.autoEnableWebVR) {\r\n _this.initWebVR();\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(Engine, \"NpmPackage\", {\r\n /**\r\n * Returns the current npm package of the sdk\r\n */\r\n // Not mixed with Version for tooling purpose.\r\n get: function () {\r\n return ThinEngine.NpmPackage;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"Version\", {\r\n /**\r\n * Returns the current version of the framework\r\n */\r\n get: function () {\r\n return ThinEngine.Version;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"Instances\", {\r\n /** Gets the list of created engines */\r\n get: function () {\r\n return EngineStore.Instances;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"LastCreatedEngine\", {\r\n /**\r\n * Gets the latest created engine\r\n */\r\n get: function () {\r\n return EngineStore.LastCreatedEngine;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine, \"LastCreatedScene\", {\r\n /**\r\n * Gets the latest created scene\r\n */\r\n get: function () {\r\n return EngineStore.LastCreatedScene;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Will flag all materials in all scenes in all engines as dirty to trigger new shader compilation\r\n * @param flag defines which part of the materials must be marked as dirty\r\n * @param predicate defines a predicate used to filter which materials should be affected\r\n */\r\n Engine.MarkAllMaterialsAsDirty = function (flag, predicate) {\r\n for (var engineIndex = 0; engineIndex < Engine.Instances.length; engineIndex++) {\r\n var engine = Engine.Instances[engineIndex];\r\n for (var sceneIndex = 0; sceneIndex < engine.scenes.length; sceneIndex++) {\r\n engine.scenes[sceneIndex].markAllMaterialsAsDirty(flag, predicate);\r\n }\r\n }\r\n };\r\n /**\r\n * Method called to create the default loading screen.\r\n * This can be overriden in your own app.\r\n * @param canvas The rendering canvas element\r\n * @returns The loading screen\r\n */\r\n Engine.DefaultLoadingScreenFactory = function (canvas) {\r\n throw _DevTools.WarnImport(\"LoadingScreen\");\r\n };\r\n Object.defineProperty(Engine.prototype, \"_supportsHardwareTextureRescaling\", {\r\n get: function () {\r\n return !!Engine._RescalePostProcessFactory;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"performanceMonitor\", {\r\n /**\r\n * Gets the performance monitor attached to this engine\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#engineinstrumentation\r\n */\r\n get: function () {\r\n return this._performanceMonitor;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Events\r\n /**\r\n * Gets the HTML element used to attach event listeners\r\n * @returns a HTML element\r\n */\r\n Engine.prototype.getInputElement = function () {\r\n return this._renderingCanvas;\r\n };\r\n /**\r\n * Gets current aspect ratio\r\n * @param viewportOwner defines the camera to use to get the aspect ratio\r\n * @param useScreen defines if screen size must be used (or the current render target if any)\r\n * @returns a number defining the aspect ratio\r\n */\r\n Engine.prototype.getAspectRatio = function (viewportOwner, useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n var viewport = viewportOwner.viewport;\r\n return (this.getRenderWidth(useScreen) * viewport.width) / (this.getRenderHeight(useScreen) * viewport.height);\r\n };\r\n /**\r\n * Gets current screen aspect ratio\r\n * @returns a number defining the aspect ratio\r\n */\r\n Engine.prototype.getScreenAspectRatio = function () {\r\n return (this.getRenderWidth(true)) / (this.getRenderHeight(true));\r\n };\r\n /**\r\n * Gets the client rect of the HTML canvas attached with the current webGL context\r\n * @returns a client rectanglee\r\n */\r\n Engine.prototype.getRenderingCanvasClientRect = function () {\r\n if (!this._renderingCanvas) {\r\n return null;\r\n }\r\n return this._renderingCanvas.getBoundingClientRect();\r\n };\r\n /**\r\n * Gets the client rect of the HTML element used for events\r\n * @returns a client rectanglee\r\n */\r\n Engine.prototype.getInputElementClientRect = function () {\r\n if (!this._renderingCanvas) {\r\n return null;\r\n }\r\n return this.getInputElement().getBoundingClientRect();\r\n };\r\n /**\r\n * Gets a boolean indicating that the engine is running in deterministic lock step mode\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns true if engine is in deterministic lock step mode\r\n */\r\n Engine.prototype.isDeterministicLockStep = function () {\r\n return this._deterministicLockstep;\r\n };\r\n /**\r\n * Gets the max steps when engine is running in deterministic lock step\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns the max steps\r\n */\r\n Engine.prototype.getLockstepMaxSteps = function () {\r\n return this._lockstepMaxSteps;\r\n };\r\n /**\r\n * Returns the time in ms between steps when using deterministic lock step.\r\n * @returns time step in (ms)\r\n */\r\n Engine.prototype.getTimeStep = function () {\r\n return this._timeStep * 1000;\r\n };\r\n /**\r\n * Force the mipmap generation for the given render target texture\r\n * @param texture defines the render target texture to use\r\n * @param unbind defines whether or not to unbind the texture after generation. Defaults to true.\r\n */\r\n Engine.prototype.generateMipMapsForCubemap = function (texture, unbind) {\r\n if (unbind === void 0) { unbind = true; }\r\n if (texture.generateMipMaps) {\r\n var gl = this._gl;\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\r\n if (unbind) {\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n }\r\n };\r\n /** States */\r\n /**\r\n * Set various states to the webGL context\r\n * @param culling defines backface culling state\r\n * @param zOffset defines the value to apply to zOffset (0 by default)\r\n * @param force defines if states must be applied even if cache is up to date\r\n * @param reverseSide defines if culling must be reversed (CCW instead of CW and CW instead of CCW)\r\n */\r\n Engine.prototype.setState = function (culling, zOffset, force, reverseSide) {\r\n if (zOffset === void 0) { zOffset = 0; }\r\n if (reverseSide === void 0) { reverseSide = false; }\r\n // Culling\r\n if (this._depthCullingState.cull !== culling || force) {\r\n this._depthCullingState.cull = culling;\r\n }\r\n // Cull face\r\n var cullFace = this.cullBackFaces ? this._gl.BACK : this._gl.FRONT;\r\n if (this._depthCullingState.cullFace !== cullFace || force) {\r\n this._depthCullingState.cullFace = cullFace;\r\n }\r\n // Z offset\r\n this.setZOffset(zOffset);\r\n // Front face\r\n var frontFace = reverseSide ? this._gl.CW : this._gl.CCW;\r\n if (this._depthCullingState.frontFace !== frontFace || force) {\r\n this._depthCullingState.frontFace = frontFace;\r\n }\r\n };\r\n /**\r\n * Set the z offset to apply to current rendering\r\n * @param value defines the offset to apply\r\n */\r\n Engine.prototype.setZOffset = function (value) {\r\n this._depthCullingState.zOffset = value;\r\n };\r\n /**\r\n * Gets the current value of the zOffset\r\n * @returns the current zOffset state\r\n */\r\n Engine.prototype.getZOffset = function () {\r\n return this._depthCullingState.zOffset;\r\n };\r\n /**\r\n * Enable or disable depth buffering\r\n * @param enable defines the state to set\r\n */\r\n Engine.prototype.setDepthBuffer = function (enable) {\r\n this._depthCullingState.depthTest = enable;\r\n };\r\n /**\r\n * Gets a boolean indicating if depth writing is enabled\r\n * @returns the current depth writing state\r\n */\r\n Engine.prototype.getDepthWrite = function () {\r\n return this._depthCullingState.depthMask;\r\n };\r\n /**\r\n * Enable or disable depth writing\r\n * @param enable defines the state to set\r\n */\r\n Engine.prototype.setDepthWrite = function (enable) {\r\n this._depthCullingState.depthMask = enable;\r\n };\r\n /**\r\n * Gets a boolean indicating if stencil buffer is enabled\r\n * @returns the current stencil buffer state\r\n */\r\n Engine.prototype.getStencilBuffer = function () {\r\n return this._stencilState.stencilTest;\r\n };\r\n /**\r\n * Enable or disable the stencil buffer\r\n * @param enable defines if the stencil buffer must be enabled or disabled\r\n */\r\n Engine.prototype.setStencilBuffer = function (enable) {\r\n this._stencilState.stencilTest = enable;\r\n };\r\n /**\r\n * Gets the current stencil mask\r\n * @returns a number defining the new stencil mask to use\r\n */\r\n Engine.prototype.getStencilMask = function () {\r\n return this._stencilState.stencilMask;\r\n };\r\n /**\r\n * Sets the current stencil mask\r\n * @param mask defines the new stencil mask to use\r\n */\r\n Engine.prototype.setStencilMask = function (mask) {\r\n this._stencilState.stencilMask = mask;\r\n };\r\n /**\r\n * Gets the current stencil function\r\n * @returns a number defining the stencil function to use\r\n */\r\n Engine.prototype.getStencilFunction = function () {\r\n return this._stencilState.stencilFunc;\r\n };\r\n /**\r\n * Gets the current stencil reference value\r\n * @returns a number defining the stencil reference value to use\r\n */\r\n Engine.prototype.getStencilFunctionReference = function () {\r\n return this._stencilState.stencilFuncRef;\r\n };\r\n /**\r\n * Gets the current stencil mask\r\n * @returns a number defining the stencil mask to use\r\n */\r\n Engine.prototype.getStencilFunctionMask = function () {\r\n return this._stencilState.stencilFuncMask;\r\n };\r\n /**\r\n * Sets the current stencil function\r\n * @param stencilFunc defines the new stencil function to use\r\n */\r\n Engine.prototype.setStencilFunction = function (stencilFunc) {\r\n this._stencilState.stencilFunc = stencilFunc;\r\n };\r\n /**\r\n * Sets the current stencil reference\r\n * @param reference defines the new stencil reference to use\r\n */\r\n Engine.prototype.setStencilFunctionReference = function (reference) {\r\n this._stencilState.stencilFuncRef = reference;\r\n };\r\n /**\r\n * Sets the current stencil mask\r\n * @param mask defines the new stencil mask to use\r\n */\r\n Engine.prototype.setStencilFunctionMask = function (mask) {\r\n this._stencilState.stencilFuncMask = mask;\r\n };\r\n /**\r\n * Gets the current stencil operation when stencil fails\r\n * @returns a number defining stencil operation to use when stencil fails\r\n */\r\n Engine.prototype.getStencilOperationFail = function () {\r\n return this._stencilState.stencilOpStencilFail;\r\n };\r\n /**\r\n * Gets the current stencil operation when depth fails\r\n * @returns a number defining stencil operation to use when depth fails\r\n */\r\n Engine.prototype.getStencilOperationDepthFail = function () {\r\n return this._stencilState.stencilOpDepthFail;\r\n };\r\n /**\r\n * Gets the current stencil operation when stencil passes\r\n * @returns a number defining stencil operation to use when stencil passes\r\n */\r\n Engine.prototype.getStencilOperationPass = function () {\r\n return this._stencilState.stencilOpStencilDepthPass;\r\n };\r\n /**\r\n * Sets the stencil operation to use when stencil fails\r\n * @param operation defines the stencil operation to use when stencil fails\r\n */\r\n Engine.prototype.setStencilOperationFail = function (operation) {\r\n this._stencilState.stencilOpStencilFail = operation;\r\n };\r\n /**\r\n * Sets the stencil operation to use when depth fails\r\n * @param operation defines the stencil operation to use when depth fails\r\n */\r\n Engine.prototype.setStencilOperationDepthFail = function (operation) {\r\n this._stencilState.stencilOpDepthFail = operation;\r\n };\r\n /**\r\n * Sets the stencil operation to use when stencil passes\r\n * @param operation defines the stencil operation to use when stencil passes\r\n */\r\n Engine.prototype.setStencilOperationPass = function (operation) {\r\n this._stencilState.stencilOpStencilDepthPass = operation;\r\n };\r\n /**\r\n * Sets a boolean indicating if the dithering state is enabled or disabled\r\n * @param value defines the dithering state\r\n */\r\n Engine.prototype.setDitheringState = function (value) {\r\n if (value) {\r\n this._gl.enable(this._gl.DITHER);\r\n }\r\n else {\r\n this._gl.disable(this._gl.DITHER);\r\n }\r\n };\r\n /**\r\n * Sets a boolean indicating if the rasterizer state is enabled or disabled\r\n * @param value defines the rasterizer state\r\n */\r\n Engine.prototype.setRasterizerState = function (value) {\r\n if (value) {\r\n this._gl.disable(this._gl.RASTERIZER_DISCARD);\r\n }\r\n else {\r\n this._gl.enable(this._gl.RASTERIZER_DISCARD);\r\n }\r\n };\r\n /**\r\n * Gets the current depth function\r\n * @returns a number defining the depth function\r\n */\r\n Engine.prototype.getDepthFunction = function () {\r\n return this._depthCullingState.depthFunc;\r\n };\r\n /**\r\n * Sets the current depth function\r\n * @param depthFunc defines the function to use\r\n */\r\n Engine.prototype.setDepthFunction = function (depthFunc) {\r\n this._depthCullingState.depthFunc = depthFunc;\r\n };\r\n /**\r\n * Sets the current depth function to GREATER\r\n */\r\n Engine.prototype.setDepthFunctionToGreater = function () {\r\n this._depthCullingState.depthFunc = this._gl.GREATER;\r\n };\r\n /**\r\n * Sets the current depth function to GEQUAL\r\n */\r\n Engine.prototype.setDepthFunctionToGreaterOrEqual = function () {\r\n this._depthCullingState.depthFunc = this._gl.GEQUAL;\r\n };\r\n /**\r\n * Sets the current depth function to LESS\r\n */\r\n Engine.prototype.setDepthFunctionToLess = function () {\r\n this._depthCullingState.depthFunc = this._gl.LESS;\r\n };\r\n /**\r\n * Sets the current depth function to LEQUAL\r\n */\r\n Engine.prototype.setDepthFunctionToLessOrEqual = function () {\r\n this._depthCullingState.depthFunc = this._gl.LEQUAL;\r\n };\r\n /**\r\n * Caches the the state of the stencil buffer\r\n */\r\n Engine.prototype.cacheStencilState = function () {\r\n this._cachedStencilBuffer = this.getStencilBuffer();\r\n this._cachedStencilFunction = this.getStencilFunction();\r\n this._cachedStencilMask = this.getStencilMask();\r\n this._cachedStencilOperationPass = this.getStencilOperationPass();\r\n this._cachedStencilOperationFail = this.getStencilOperationFail();\r\n this._cachedStencilOperationDepthFail = this.getStencilOperationDepthFail();\r\n this._cachedStencilReference = this.getStencilFunctionReference();\r\n };\r\n /**\r\n * Restores the state of the stencil buffer\r\n */\r\n Engine.prototype.restoreStencilState = function () {\r\n this.setStencilFunction(this._cachedStencilFunction);\r\n this.setStencilMask(this._cachedStencilMask);\r\n this.setStencilBuffer(this._cachedStencilBuffer);\r\n this.setStencilOperationPass(this._cachedStencilOperationPass);\r\n this.setStencilOperationFail(this._cachedStencilOperationFail);\r\n this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail);\r\n this.setStencilFunctionReference(this._cachedStencilReference);\r\n };\r\n /**\r\n * Directly set the WebGL Viewport\r\n * @param x defines the x coordinate of the viewport (in screen space)\r\n * @param y defines the y coordinate of the viewport (in screen space)\r\n * @param width defines the width of the viewport (in screen space)\r\n * @param height defines the height of the viewport (in screen space)\r\n * @return the current viewport Object (if any) that is being replaced by this call. You can restore this viewport later on to go back to the original state\r\n */\r\n Engine.prototype.setDirectViewport = function (x, y, width, height) {\r\n var currentViewport = this._cachedViewport;\r\n this._cachedViewport = null;\r\n this._viewport(x, y, width, height);\r\n return currentViewport;\r\n };\r\n /**\r\n * Executes a scissor clear (ie. a clear on a specific portion of the screen)\r\n * @param x defines the x-coordinate of the top left corner of the clear rectangle\r\n * @param y defines the y-coordinate of the corner of the clear rectangle\r\n * @param width defines the width of the clear rectangle\r\n * @param height defines the height of the clear rectangle\r\n * @param clearColor defines the clear color\r\n */\r\n Engine.prototype.scissorClear = function (x, y, width, height, clearColor) {\r\n this.enableScissor(x, y, width, height);\r\n this.clear(clearColor, true, true, true);\r\n this.disableScissor();\r\n };\r\n /**\r\n * Enable scissor test on a specific rectangle (ie. render will only be executed on a specific portion of the screen)\r\n * @param x defines the x-coordinate of the top left corner of the clear rectangle\r\n * @param y defines the y-coordinate of the corner of the clear rectangle\r\n * @param width defines the width of the clear rectangle\r\n * @param height defines the height of the clear rectangle\r\n */\r\n Engine.prototype.enableScissor = function (x, y, width, height) {\r\n var gl = this._gl;\r\n // Change state\r\n gl.enable(gl.SCISSOR_TEST);\r\n gl.scissor(x, y, width, height);\r\n };\r\n /**\r\n * Disable previously set scissor test rectangle\r\n */\r\n Engine.prototype.disableScissor = function () {\r\n var gl = this._gl;\r\n gl.disable(gl.SCISSOR_TEST);\r\n };\r\n Engine.prototype._reportDrawCall = function () {\r\n this._drawCalls.addCount(1, false);\r\n };\r\n /**\r\n * Initializes a webVR display and starts listening to display change events\r\n * The onVRDisplayChangedObservable will be notified upon these changes\r\n * @returns The onVRDisplayChangedObservable\r\n */\r\n Engine.prototype.initWebVR = function () {\r\n throw _DevTools.WarnImport(\"WebVRCamera\");\r\n };\r\n /** @hidden */\r\n Engine.prototype._prepareVRComponent = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /** @hidden */\r\n Engine.prototype._connectVREvents = function (canvas, document) {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /** @hidden */\r\n Engine.prototype._submitVRFrame = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /**\r\n * Call this function to leave webVR mode\r\n * Will do nothing if webVR is not supported or if there is no webVR device\r\n * @see https://doc.babylonjs.com/how_to/webvr_camera\r\n */\r\n Engine.prototype.disableVR = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /**\r\n * Gets a boolean indicating that the system is in VR mode and is presenting\r\n * @returns true if VR mode is engaged\r\n */\r\n Engine.prototype.isVRPresenting = function () {\r\n return false;\r\n };\r\n /** @hidden */\r\n Engine.prototype._requestVRFrame = function () {\r\n // Do nothing as the engine side effect will overload it\r\n };\r\n /** @hidden */\r\n Engine.prototype._loadFileAsync = function (url, offlineProvider, useArrayBuffer) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._loadFile(url, function (data) {\r\n resolve(data);\r\n }, undefined, offlineProvider, useArrayBuffer, function (request, exception) {\r\n reject(exception);\r\n });\r\n });\r\n };\r\n /**\r\n * Gets the source code of the vertex shader associated with a specific webGL program\r\n * @param program defines the program to use\r\n * @returns a string containing the source code of the vertex shader associated with the program\r\n */\r\n Engine.prototype.getVertexShaderSource = function (program) {\r\n var shaders = this._gl.getAttachedShaders(program);\r\n if (!shaders) {\r\n return null;\r\n }\r\n return this._gl.getShaderSource(shaders[0]);\r\n };\r\n /**\r\n * Gets the source code of the fragment shader associated with a specific webGL program\r\n * @param program defines the program to use\r\n * @returns a string containing the source code of the fragment shader associated with the program\r\n */\r\n Engine.prototype.getFragmentShaderSource = function (program) {\r\n var shaders = this._gl.getAttachedShaders(program);\r\n if (!shaders) {\r\n return null;\r\n }\r\n return this._gl.getShaderSource(shaders[1]);\r\n };\r\n /**\r\n * Sets a depth stencil texture from a render target to the according uniform.\r\n * @param channel The texture channel\r\n * @param uniform The uniform to set\r\n * @param texture The render target texture containing the depth stencil texture to apply\r\n */\r\n Engine.prototype.setDepthStencilTexture = function (channel, uniform, texture) {\r\n if (channel === undefined) {\r\n return;\r\n }\r\n if (uniform) {\r\n this._boundUniforms[channel] = uniform;\r\n }\r\n if (!texture || !texture.depthStencilTexture) {\r\n this._setTexture(channel, null);\r\n }\r\n else {\r\n this._setTexture(channel, texture, false, true);\r\n }\r\n };\r\n /**\r\n * Sets a texture to the webGL context from a postprocess\r\n * @param channel defines the channel to use\r\n * @param postProcess defines the source postprocess\r\n */\r\n Engine.prototype.setTextureFromPostProcess = function (channel, postProcess) {\r\n this._bindTexture(channel, postProcess ? postProcess._textures.data[postProcess._currentRenderTextureInd] : null);\r\n };\r\n /**\r\n * Binds the output of the passed in post process to the texture channel specified\r\n * @param channel The channel the texture should be bound to\r\n * @param postProcess The post process which's output should be bound\r\n */\r\n Engine.prototype.setTextureFromPostProcessOutput = function (channel, postProcess) {\r\n this._bindTexture(channel, postProcess ? postProcess._outputTexture : null);\r\n };\r\n Engine.prototype._rebuildBuffers = function () {\r\n // Index / Vertex\r\n for (var _i = 0, _a = this.scenes; _i < _a.length; _i++) {\r\n var scene = _a[_i];\r\n scene.resetCachedMaterial();\r\n scene._rebuildGeometries();\r\n scene._rebuildTextures();\r\n }\r\n _super.prototype._rebuildBuffers.call(this);\r\n };\r\n /** @hidden */\r\n Engine.prototype._renderFrame = function () {\r\n for (var index = 0; index < this._activeRenderLoops.length; index++) {\r\n var renderFunction = this._activeRenderLoops[index];\r\n renderFunction();\r\n }\r\n };\r\n Engine.prototype._renderLoop = function () {\r\n if (!this._contextWasLost) {\r\n var shouldRender = true;\r\n if (!this.renderEvenInBackground && this._windowIsBackground) {\r\n shouldRender = false;\r\n }\r\n if (shouldRender) {\r\n // Start new frame\r\n this.beginFrame();\r\n // Child canvases\r\n if (!this._renderViews()) {\r\n // Main frame\r\n this._renderFrame();\r\n }\r\n // Present\r\n this.endFrame();\r\n }\r\n }\r\n if (this._activeRenderLoops.length > 0) {\r\n // Register new frame\r\n if (this.customAnimationFrameRequester) {\r\n this.customAnimationFrameRequester.requestID = this._queueNewFrame(this.customAnimationFrameRequester.renderFunction || this._boundRenderFunction, this.customAnimationFrameRequester);\r\n this._frameHandler = this.customAnimationFrameRequester.requestID;\r\n }\r\n else if (this.isVRPresenting()) {\r\n this._requestVRFrame();\r\n }\r\n else {\r\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\r\n }\r\n }\r\n else {\r\n this._renderingQueueLaunched = false;\r\n }\r\n };\r\n /** @hidden */\r\n Engine.prototype._renderViews = function () {\r\n return false;\r\n };\r\n /**\r\n * Toggle full screen mode\r\n * @param requestPointerLock defines if a pointer lock should be requested from the user\r\n */\r\n Engine.prototype.switchFullscreen = function (requestPointerLock) {\r\n if (this.isFullscreen) {\r\n this.exitFullscreen();\r\n }\r\n else {\r\n this.enterFullscreen(requestPointerLock);\r\n }\r\n };\r\n /**\r\n * Enters full screen mode\r\n * @param requestPointerLock defines if a pointer lock should be requested from the user\r\n */\r\n Engine.prototype.enterFullscreen = function (requestPointerLock) {\r\n if (!this.isFullscreen) {\r\n this._pointerLockRequested = requestPointerLock;\r\n if (this._renderingCanvas) {\r\n Engine._RequestFullscreen(this._renderingCanvas);\r\n }\r\n }\r\n };\r\n /**\r\n * Exits full screen mode\r\n */\r\n Engine.prototype.exitFullscreen = function () {\r\n if (this.isFullscreen) {\r\n Engine._ExitFullscreen();\r\n }\r\n };\r\n /**\r\n * Enters Pointerlock mode\r\n */\r\n Engine.prototype.enterPointerlock = function () {\r\n if (this._renderingCanvas) {\r\n Engine._RequestPointerlock(this._renderingCanvas);\r\n }\r\n };\r\n /**\r\n * Exits Pointerlock mode\r\n */\r\n Engine.prototype.exitPointerlock = function () {\r\n Engine._ExitPointerlock();\r\n };\r\n /**\r\n * Begin a new frame\r\n */\r\n Engine.prototype.beginFrame = function () {\r\n this._measureFps();\r\n this.onBeginFrameObservable.notifyObservers(this);\r\n _super.prototype.beginFrame.call(this);\r\n };\r\n /**\r\n * Enf the current frame\r\n */\r\n Engine.prototype.endFrame = function () {\r\n _super.prototype.endFrame.call(this);\r\n this._submitVRFrame();\r\n this.onEndFrameObservable.notifyObservers(this);\r\n };\r\n Engine.prototype.resize = function () {\r\n // We're not resizing the size of the canvas while in VR mode & presenting\r\n if (this.isVRPresenting()) {\r\n return;\r\n }\r\n _super.prototype.resize.call(this);\r\n };\r\n /**\r\n * Force a specific size of the canvas\r\n * @param width defines the new canvas' width\r\n * @param height defines the new canvas' height\r\n * @returns true if the size was changed\r\n */\r\n Engine.prototype.setSize = function (width, height) {\r\n if (!this._renderingCanvas) {\r\n return false;\r\n }\r\n if (!_super.prototype.setSize.call(this, width, height)) {\r\n return false;\r\n }\r\n if (this.scenes) {\r\n for (var index = 0; index < this.scenes.length; index++) {\r\n var scene = this.scenes[index];\r\n for (var camIndex = 0; camIndex < scene.cameras.length; camIndex++) {\r\n var cam = scene.cameras[camIndex];\r\n cam._currentRenderId = 0;\r\n }\r\n }\r\n if (this.onResizeObservable.hasObservers()) {\r\n this.onResizeObservable.notifyObservers(this);\r\n }\r\n }\r\n return true;\r\n };\r\n Engine.prototype._deletePipelineContext = function (pipelineContext) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (webGLPipelineContext && webGLPipelineContext.program) {\r\n if (webGLPipelineContext.transformFeedback) {\r\n this.deleteTransformFeedback(webGLPipelineContext.transformFeedback);\r\n webGLPipelineContext.transformFeedback = null;\r\n }\r\n }\r\n _super.prototype._deletePipelineContext.call(this, pipelineContext);\r\n };\r\n Engine.prototype.createShaderProgram = function (pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n context = context || this._gl;\r\n this.onBeforeShaderCompilationObservable.notifyObservers(this);\r\n var program = _super.prototype.createShaderProgram.call(this, pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings);\r\n this.onAfterShaderCompilationObservable.notifyObservers(this);\r\n return program;\r\n };\r\n Engine.prototype._createShaderProgram = function (pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n var shaderProgram = context.createProgram();\r\n pipelineContext.program = shaderProgram;\r\n if (!shaderProgram) {\r\n throw new Error(\"Unable to create program\");\r\n }\r\n context.attachShader(shaderProgram, vertexShader);\r\n context.attachShader(shaderProgram, fragmentShader);\r\n if (this.webGLVersion > 1 && transformFeedbackVaryings) {\r\n var transformFeedback = this.createTransformFeedback();\r\n this.bindTransformFeedback(transformFeedback);\r\n this.setTranformFeedbackVaryings(shaderProgram, transformFeedbackVaryings);\r\n pipelineContext.transformFeedback = transformFeedback;\r\n }\r\n context.linkProgram(shaderProgram);\r\n if (this.webGLVersion > 1 && transformFeedbackVaryings) {\r\n this.bindTransformFeedback(null);\r\n }\r\n pipelineContext.context = context;\r\n pipelineContext.vertexShader = vertexShader;\r\n pipelineContext.fragmentShader = fragmentShader;\r\n if (!pipelineContext.isParallelCompiled) {\r\n this._finalizePipelineContext(pipelineContext);\r\n }\r\n return shaderProgram;\r\n };\r\n Engine.prototype._releaseTexture = function (texture) {\r\n _super.prototype._releaseTexture.call(this, texture);\r\n // Set output texture of post process to null if the texture has been released/disposed\r\n this.scenes.forEach(function (scene) {\r\n scene.postProcesses.forEach(function (postProcess) {\r\n if (postProcess._outputTexture == texture) {\r\n postProcess._outputTexture = null;\r\n }\r\n });\r\n scene.cameras.forEach(function (camera) {\r\n camera._postProcesses.forEach(function (postProcess) {\r\n if (postProcess) {\r\n if (postProcess._outputTexture == texture) {\r\n postProcess._outputTexture = null;\r\n }\r\n }\r\n });\r\n });\r\n });\r\n };\r\n /**\r\n * @hidden\r\n * Rescales a texture\r\n * @param source input texutre\r\n * @param destination destination texture\r\n * @param scene scene to use to render the resize\r\n * @param internalFormat format to use when resizing\r\n * @param onComplete callback to be called when resize has completed\r\n */\r\n Engine.prototype._rescaleTexture = function (source, destination, scene, internalFormat, onComplete) {\r\n var _this = this;\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE);\r\n var rtt = this.createRenderTargetTexture({\r\n width: destination.width,\r\n height: destination.height,\r\n }, {\r\n generateMipMaps: false,\r\n type: 0,\r\n samplingMode: 2,\r\n generateDepthBuffer: false,\r\n generateStencilBuffer: false\r\n });\r\n if (!this._rescalePostProcess && Engine._RescalePostProcessFactory) {\r\n this._rescalePostProcess = Engine._RescalePostProcessFactory(this);\r\n }\r\n this._rescalePostProcess.getEffect().executeWhenCompiled(function () {\r\n _this._rescalePostProcess.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", source);\r\n };\r\n var hostingScene = scene;\r\n if (!hostingScene) {\r\n hostingScene = _this.scenes[_this.scenes.length - 1];\r\n }\r\n hostingScene.postProcessManager.directRender([_this._rescalePostProcess], rtt, true);\r\n _this._bindTextureDirectly(_this._gl.TEXTURE_2D, destination, true);\r\n _this._gl.copyTexImage2D(_this._gl.TEXTURE_2D, 0, internalFormat, 0, 0, destination.width, destination.height, 0);\r\n _this.unBindFramebuffer(rtt);\r\n _this._releaseTexture(rtt);\r\n if (onComplete) {\r\n onComplete();\r\n }\r\n });\r\n };\r\n // FPS\r\n /**\r\n * Gets the current framerate\r\n * @returns a number representing the framerate\r\n */\r\n Engine.prototype.getFps = function () {\r\n return this._fps;\r\n };\r\n /**\r\n * Gets the time spent between current and previous frame\r\n * @returns a number representing the delta time in ms\r\n */\r\n Engine.prototype.getDeltaTime = function () {\r\n return this._deltaTime;\r\n };\r\n Engine.prototype._measureFps = function () {\r\n this._performanceMonitor.sampleFrame();\r\n this._fps = this._performanceMonitor.averageFPS;\r\n this._deltaTime = this._performanceMonitor.instantaneousFrameTime || 0;\r\n };\r\n /** @hidden */\r\n Engine.prototype._uploadImageToTexture = function (texture, image, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(texture.type);\r\n var format = this._getInternalFormat(texture.format);\r\n var internalFormat = this._getRGBABufferInternalSizedFormat(texture.type, format);\r\n var bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\r\n this._bindTextureDirectly(bindTarget, texture, true);\r\n this._unpackFlipY(texture.invertY);\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n gl.texImage2D(target, lod, internalFormat, format, textureType, image);\r\n this._bindTextureDirectly(bindTarget, null, true);\r\n };\r\n /**\r\n * Updates the sample count of a render target texture\r\n * @see https://doc.babylonjs.com/features/webgl2#multisample-render-targets\r\n * @param texture defines the texture to update\r\n * @param samples defines the sample count to set\r\n * @returns the effective sample count (could be 0 if multisample render targets are not supported)\r\n */\r\n Engine.prototype.updateRenderTargetTextureSampleCount = function (texture, samples) {\r\n if (this.webGLVersion < 2 || !texture) {\r\n return 1;\r\n }\r\n if (texture.samples === samples) {\r\n return samples;\r\n }\r\n var gl = this._gl;\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n // Dispose previous render buffers\r\n if (texture._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(texture._depthStencilBuffer);\r\n texture._depthStencilBuffer = null;\r\n }\r\n if (texture._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(texture._MSAAFramebuffer);\r\n texture._MSAAFramebuffer = null;\r\n }\r\n if (texture._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(texture._MSAARenderBuffer);\r\n texture._MSAARenderBuffer = null;\r\n }\r\n if (samples > 1 && gl.renderbufferStorageMultisample) {\r\n var framebuffer = gl.createFramebuffer();\r\n if (!framebuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n texture._MSAAFramebuffer = framebuffer;\r\n this._bindUnboundFramebuffer(texture._MSAAFramebuffer);\r\n var colorRenderbuffer = gl.createRenderbuffer();\r\n if (!colorRenderbuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, colorRenderbuffer);\r\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, this._getRGBAMultiSampleBufferFormat(texture.type), texture.width, texture.height);\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, colorRenderbuffer);\r\n texture._MSAARenderBuffer = colorRenderbuffer;\r\n }\r\n else {\r\n this._bindUnboundFramebuffer(texture._framebuffer);\r\n }\r\n texture.samples = samples;\r\n texture._depthStencilBuffer = this._setupFramebufferDepthAttachments(texture._generateStencilBuffer, texture._generateDepthBuffer, texture.width, texture.height, samples);\r\n this._bindUnboundFramebuffer(null);\r\n return samples;\r\n };\r\n /**\r\n * Updates a depth texture Comparison Mode and Function.\r\n * If the comparison Function is equal to 0, the mode will be set to none.\r\n * Otherwise, this only works in webgl 2 and requires a shadow sampler in the shader.\r\n * @param texture The texture to set the comparison function for\r\n * @param comparisonFunction The comparison function to set, 0 if no comparison required\r\n */\r\n Engine.prototype.updateTextureComparisonFunction = function (texture, comparisonFunction) {\r\n if (this.webGLVersion === 1) {\r\n Logger.Error(\"WebGL 1 does not support texture comparison.\");\r\n return;\r\n }\r\n var gl = this._gl;\r\n if (texture.isCube) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);\r\n if (comparisonFunction === 0) {\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, 515);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.NONE);\r\n }\r\n else {\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n else {\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n if (comparisonFunction === 0) {\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, 515);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.NONE);\r\n }\r\n else {\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n }\r\n texture._comparisonFunction = comparisonFunction;\r\n };\r\n /**\r\n * Creates a webGL buffer to use with instanciation\r\n * @param capacity defines the size of the buffer\r\n * @returns the webGL buffer\r\n */\r\n Engine.prototype.createInstancesBuffer = function (capacity) {\r\n var buffer = this._gl.createBuffer();\r\n if (!buffer) {\r\n throw new Error(\"Unable to create instance buffer\");\r\n }\r\n var result = new WebGLDataBuffer(buffer);\r\n result.capacity = capacity;\r\n this.bindArrayBuffer(result);\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, capacity, this._gl.DYNAMIC_DRAW);\r\n return result;\r\n };\r\n /**\r\n * Delete a webGL buffer used with instanciation\r\n * @param buffer defines the webGL buffer to delete\r\n */\r\n Engine.prototype.deleteInstancesBuffer = function (buffer) {\r\n this._gl.deleteBuffer(buffer);\r\n };\r\n Engine.prototype._clientWaitAsync = function (sync, flags, interval_ms) {\r\n if (flags === void 0) { flags = 0; }\r\n if (interval_ms === void 0) { interval_ms = 10; }\r\n var gl = this._gl;\r\n return new Promise(function (resolve, reject) {\r\n var check = function () {\r\n var res = gl.clientWaitSync(sync, flags, 0);\r\n if (res == gl.WAIT_FAILED) {\r\n reject();\r\n return;\r\n }\r\n if (res == gl.TIMEOUT_EXPIRED) {\r\n setTimeout(check, interval_ms);\r\n return;\r\n }\r\n resolve();\r\n };\r\n check();\r\n });\r\n };\r\n /** @hidden */\r\n Engine.prototype._readPixelsAsync = function (x, y, w, h, format, type, outputBuffer) {\r\n if (this._webGLVersion < 2) {\r\n throw new Error(\"_readPixelsAsync only work on WebGL2+\");\r\n }\r\n var gl = this._gl;\r\n var buf = gl.createBuffer();\r\n gl.bindBuffer(gl.PIXEL_PACK_BUFFER, buf);\r\n gl.bufferData(gl.PIXEL_PACK_BUFFER, outputBuffer.byteLength, gl.STREAM_READ);\r\n gl.readPixels(x, y, w, h, format, type, 0);\r\n gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);\r\n var sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);\r\n if (!sync) {\r\n return null;\r\n }\r\n gl.flush();\r\n return this._clientWaitAsync(sync, 0, 10).then(function () {\r\n gl.deleteSync(sync);\r\n gl.bindBuffer(gl.PIXEL_PACK_BUFFER, buf);\r\n gl.getBufferSubData(gl.PIXEL_PACK_BUFFER, 0, outputBuffer);\r\n gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);\r\n gl.deleteBuffer(buf);\r\n return outputBuffer;\r\n });\r\n };\r\n Engine.prototype.dispose = function () {\r\n this.hideLoadingUI();\r\n this.onNewSceneAddedObservable.clear();\r\n // Release postProcesses\r\n while (this.postProcesses.length) {\r\n this.postProcesses[0].dispose();\r\n }\r\n // Rescale PP\r\n if (this._rescalePostProcess) {\r\n this._rescalePostProcess.dispose();\r\n }\r\n // Release scenes\r\n while (this.scenes.length) {\r\n this.scenes[0].dispose();\r\n }\r\n // Release audio engine\r\n if (Engine.Instances.length === 1 && Engine.audioEngine) {\r\n Engine.audioEngine.dispose();\r\n }\r\n //WebVR\r\n this.disableVR();\r\n // Events\r\n if (DomManagement.IsWindowObjectExist()) {\r\n window.removeEventListener(\"blur\", this._onBlur);\r\n window.removeEventListener(\"focus\", this._onFocus);\r\n if (this._renderingCanvas) {\r\n this._renderingCanvas.removeEventListener(\"focus\", this._onCanvasFocus);\r\n this._renderingCanvas.removeEventListener(\"blur\", this._onCanvasBlur);\r\n this._renderingCanvas.removeEventListener(\"pointerout\", this._onCanvasPointerOut);\r\n }\r\n if (DomManagement.IsDocumentAvailable()) {\r\n document.removeEventListener(\"fullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"mozfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"webkitfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"msfullscreenchange\", this._onFullscreenChange);\r\n document.removeEventListener(\"pointerlockchange\", this._onPointerLockChange);\r\n document.removeEventListener(\"mspointerlockchange\", this._onPointerLockChange);\r\n document.removeEventListener(\"mozpointerlockchange\", this._onPointerLockChange);\r\n document.removeEventListener(\"webkitpointerlockchange\", this._onPointerLockChange);\r\n }\r\n }\r\n _super.prototype.dispose.call(this);\r\n // Remove from Instances\r\n var index = Engine.Instances.indexOf(this);\r\n if (index >= 0) {\r\n Engine.Instances.splice(index, 1);\r\n }\r\n // Observables\r\n this.onResizeObservable.clear();\r\n this.onCanvasBlurObservable.clear();\r\n this.onCanvasFocusObservable.clear();\r\n this.onCanvasPointerOutObservable.clear();\r\n this.onBeginFrameObservable.clear();\r\n this.onEndFrameObservable.clear();\r\n };\r\n Engine.prototype._disableTouchAction = function () {\r\n if (!this._renderingCanvas || !this._renderingCanvas.setAttribute) {\r\n return;\r\n }\r\n this._renderingCanvas.setAttribute(\"touch-action\", \"none\");\r\n this._renderingCanvas.style.touchAction = \"none\";\r\n this._renderingCanvas.style.msTouchAction = \"none\";\r\n };\r\n // Loading screen\r\n /**\r\n * Display the loading screen\r\n * @see https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n Engine.prototype.displayLoadingUI = function () {\r\n if (!DomManagement.IsWindowObjectExist()) {\r\n return;\r\n }\r\n var loadingScreen = this.loadingScreen;\r\n if (loadingScreen) {\r\n loadingScreen.displayLoadingUI();\r\n }\r\n };\r\n /**\r\n * Hide the loading screen\r\n * @see https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n Engine.prototype.hideLoadingUI = function () {\r\n if (!DomManagement.IsWindowObjectExist()) {\r\n return;\r\n }\r\n var loadingScreen = this._loadingScreen;\r\n if (loadingScreen) {\r\n loadingScreen.hideLoadingUI();\r\n }\r\n };\r\n Object.defineProperty(Engine.prototype, \"loadingScreen\", {\r\n /**\r\n * Gets the current loading screen object\r\n * @see https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n get: function () {\r\n if (!this._loadingScreen && this._renderingCanvas) {\r\n this._loadingScreen = Engine.DefaultLoadingScreenFactory(this._renderingCanvas);\r\n }\r\n return this._loadingScreen;\r\n },\r\n /**\r\n * Sets the current loading screen object\r\n * @see https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n set: function (loadingScreen) {\r\n this._loadingScreen = loadingScreen;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"loadingUIText\", {\r\n /**\r\n * Sets the current loading screen text\r\n * @see https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n set: function (text) {\r\n this.loadingScreen.loadingUIText = text;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Engine.prototype, \"loadingUIBackgroundColor\", {\r\n /**\r\n * Sets the current loading screen background color\r\n * @see https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n set: function (color) {\r\n this.loadingScreen.loadingUIBackgroundColor = color;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** Pointerlock and fullscreen */\r\n /**\r\n * Ask the browser to promote the current element to pointerlock mode\r\n * @param element defines the DOM element to promote\r\n */\r\n Engine._RequestPointerlock = function (element) {\r\n element.requestPointerLock = element.requestPointerLock || element.msRequestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock;\r\n if (element.requestPointerLock) {\r\n element.requestPointerLock();\r\n }\r\n };\r\n /**\r\n * Asks the browser to exit pointerlock mode\r\n */\r\n Engine._ExitPointerlock = function () {\r\n var anyDoc = document;\r\n document.exitPointerLock = document.exitPointerLock || anyDoc.msExitPointerLock || anyDoc.mozExitPointerLock || anyDoc.webkitExitPointerLock;\r\n if (document.exitPointerLock) {\r\n document.exitPointerLock();\r\n }\r\n };\r\n /**\r\n * Ask the browser to promote the current element to fullscreen rendering mode\r\n * @param element defines the DOM element to promote\r\n */\r\n Engine._RequestFullscreen = function (element) {\r\n var requestFunction = element.requestFullscreen || element.msRequestFullscreen || element.webkitRequestFullscreen || element.mozRequestFullScreen;\r\n if (!requestFunction) {\r\n return;\r\n }\r\n requestFunction.call(element);\r\n };\r\n /**\r\n * Asks the browser to exit fullscreen mode\r\n */\r\n Engine._ExitFullscreen = function () {\r\n var anyDoc = document;\r\n if (document.exitFullscreen) {\r\n document.exitFullscreen();\r\n }\r\n else if (anyDoc.mozCancelFullScreen) {\r\n anyDoc.mozCancelFullScreen();\r\n }\r\n else if (anyDoc.webkitCancelFullScreen) {\r\n anyDoc.webkitCancelFullScreen();\r\n }\r\n else if (anyDoc.msCancelFullScreen) {\r\n anyDoc.msCancelFullScreen();\r\n }\r\n };\r\n // Const statics\r\n /** Defines that alpha blending is disabled */\r\n Engine.ALPHA_DISABLE = 0;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + DEST */\r\n Engine.ALPHA_ADD = 1;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */\r\n Engine.ALPHA_COMBINE = 2;\r\n /** Defines that alpha blending to DEST - SRC * DEST */\r\n Engine.ALPHA_SUBTRACT = 3;\r\n /** Defines that alpha blending to SRC * DEST */\r\n Engine.ALPHA_MULTIPLY = 4;\r\n /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST */\r\n Engine.ALPHA_MAXIMIZED = 5;\r\n /** Defines that alpha blending to SRC + DEST */\r\n Engine.ALPHA_ONEONE = 6;\r\n /** Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST */\r\n Engine.ALPHA_PREMULTIPLIED = 7;\r\n /**\r\n * Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST\r\n * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Engine.ALPHA_PREMULTIPLIED_PORTERDUFF = 8;\r\n /** Defines that alpha blending to CST * SRC + (1 - CST) * DEST */\r\n Engine.ALPHA_INTERPOLATE = 9;\r\n /**\r\n * Defines that alpha blending to SRC + (1 - SRC) * DEST\r\n * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA\r\n */\r\n Engine.ALPHA_SCREENMODE = 10;\r\n /** Defines that the ressource is not delayed*/\r\n Engine.DELAYLOADSTATE_NONE = 0;\r\n /** Defines that the ressource was successfully delay loaded */\r\n Engine.DELAYLOADSTATE_LOADED = 1;\r\n /** Defines that the ressource is currently delay loading */\r\n Engine.DELAYLOADSTATE_LOADING = 2;\r\n /** Defines that the ressource is delayed and has not started loading */\r\n Engine.DELAYLOADSTATE_NOTLOADED = 4;\r\n // Depht or Stencil test Constants.\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */\r\n Engine.NEVER = 512;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\r\n Engine.ALWAYS = 519;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */\r\n Engine.LESS = 513;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */\r\n Engine.EQUAL = 514;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */\r\n Engine.LEQUAL = 515;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */\r\n Engine.GREATER = 516;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */\r\n Engine.GEQUAL = 518;\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */\r\n Engine.NOTEQUAL = 517;\r\n // Stencil Actions Constants.\r\n /** Passed to stencilOperation to specify that stencil value must be kept */\r\n Engine.KEEP = 7680;\r\n /** Passed to stencilOperation to specify that stencil value must be replaced */\r\n Engine.REPLACE = 7681;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented */\r\n Engine.INCR = 7682;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented */\r\n Engine.DECR = 7683;\r\n /** Passed to stencilOperation to specify that stencil value must be inverted */\r\n Engine.INVERT = 5386;\r\n /** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */\r\n Engine.INCR_WRAP = 34055;\r\n /** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */\r\n Engine.DECR_WRAP = 34056;\r\n /** Texture is not repeating outside of 0..1 UVs */\r\n Engine.TEXTURE_CLAMP_ADDRESSMODE = 0;\r\n /** Texture is repeating outside of 0..1 UVs */\r\n Engine.TEXTURE_WRAP_ADDRESSMODE = 1;\r\n /** Texture is repeating and mirrored */\r\n Engine.TEXTURE_MIRROR_ADDRESSMODE = 2;\r\n /** ALPHA */\r\n Engine.TEXTUREFORMAT_ALPHA = 0;\r\n /** LUMINANCE */\r\n Engine.TEXTUREFORMAT_LUMINANCE = 1;\r\n /** LUMINANCE_ALPHA */\r\n Engine.TEXTUREFORMAT_LUMINANCE_ALPHA = 2;\r\n /** RGB */\r\n Engine.TEXTUREFORMAT_RGB = 4;\r\n /** RGBA */\r\n Engine.TEXTUREFORMAT_RGBA = 5;\r\n /** RED */\r\n Engine.TEXTUREFORMAT_RED = 6;\r\n /** RED (2nd reference) */\r\n Engine.TEXTUREFORMAT_R = 6;\r\n /** RG */\r\n Engine.TEXTUREFORMAT_RG = 7;\r\n /** RED_INTEGER */\r\n Engine.TEXTUREFORMAT_RED_INTEGER = 8;\r\n /** RED_INTEGER (2nd reference) */\r\n Engine.TEXTUREFORMAT_R_INTEGER = 8;\r\n /** RG_INTEGER */\r\n Engine.TEXTUREFORMAT_RG_INTEGER = 9;\r\n /** RGB_INTEGER */\r\n Engine.TEXTUREFORMAT_RGB_INTEGER = 10;\r\n /** RGBA_INTEGER */\r\n Engine.TEXTUREFORMAT_RGBA_INTEGER = 11;\r\n /** UNSIGNED_BYTE */\r\n Engine.TEXTURETYPE_UNSIGNED_BYTE = 0;\r\n /** UNSIGNED_BYTE (2nd reference) */\r\n Engine.TEXTURETYPE_UNSIGNED_INT = 0;\r\n /** FLOAT */\r\n Engine.TEXTURETYPE_FLOAT = 1;\r\n /** HALF_FLOAT */\r\n Engine.TEXTURETYPE_HALF_FLOAT = 2;\r\n /** BYTE */\r\n Engine.TEXTURETYPE_BYTE = 3;\r\n /** SHORT */\r\n Engine.TEXTURETYPE_SHORT = 4;\r\n /** UNSIGNED_SHORT */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT = 5;\r\n /** INT */\r\n Engine.TEXTURETYPE_INT = 6;\r\n /** UNSIGNED_INT */\r\n Engine.TEXTURETYPE_UNSIGNED_INTEGER = 7;\r\n /** UNSIGNED_SHORT_4_4_4_4 */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = 8;\r\n /** UNSIGNED_SHORT_5_5_5_1 */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = 9;\r\n /** UNSIGNED_SHORT_5_6_5 */\r\n Engine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = 10;\r\n /** UNSIGNED_INT_2_10_10_10_REV */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = 11;\r\n /** UNSIGNED_INT_24_8 */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_24_8 = 12;\r\n /** UNSIGNED_INT_10F_11F_11F_REV */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = 13;\r\n /** UNSIGNED_INT_5_9_9_9_REV */\r\n Engine.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = 14;\r\n /** FLOAT_32_UNSIGNED_INT_24_8_REV */\r\n Engine.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = 15;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Engine.TEXTURE_NEAREST_SAMPLINGMODE = 1;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Engine.TEXTURE_BILINEAR_SAMPLINGMODE = 2;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Engine.TEXTURE_TRILINEAR_SAMPLINGMODE = 3;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR = 8;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST = 11;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR = 3;\r\n /** mag = nearest and min = nearest and mip = nearest */\r\n Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST = 4;\r\n /** mag = nearest and min = linear and mip = nearest */\r\n Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST = 5;\r\n /** mag = nearest and min = linear and mip = linear */\r\n Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR = 6;\r\n /** mag = nearest and min = linear and mip = none */\r\n Engine.TEXTURE_NEAREST_LINEAR = 7;\r\n /** mag = nearest and min = nearest and mip = none */\r\n Engine.TEXTURE_NEAREST_NEAREST = 1;\r\n /** mag = linear and min = nearest and mip = nearest */\r\n Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST = 9;\r\n /** mag = linear and min = nearest and mip = linear */\r\n Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR = 10;\r\n /** mag = linear and min = linear and mip = none */\r\n Engine.TEXTURE_LINEAR_LINEAR = 2;\r\n /** mag = linear and min = nearest and mip = none */\r\n Engine.TEXTURE_LINEAR_NEAREST = 12;\r\n /** Explicit coordinates mode */\r\n Engine.TEXTURE_EXPLICIT_MODE = 0;\r\n /** Spherical coordinates mode */\r\n Engine.TEXTURE_SPHERICAL_MODE = 1;\r\n /** Planar coordinates mode */\r\n Engine.TEXTURE_PLANAR_MODE = 2;\r\n /** Cubic coordinates mode */\r\n Engine.TEXTURE_CUBIC_MODE = 3;\r\n /** Projection coordinates mode */\r\n Engine.TEXTURE_PROJECTION_MODE = 4;\r\n /** Skybox coordinates mode */\r\n Engine.TEXTURE_SKYBOX_MODE = 5;\r\n /** Inverse Cubic coordinates mode */\r\n Engine.TEXTURE_INVCUBIC_MODE = 6;\r\n /** Equirectangular coordinates mode */\r\n Engine.TEXTURE_EQUIRECTANGULAR_MODE = 7;\r\n /** Equirectangular Fixed coordinates mode */\r\n Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = 8;\r\n /** Equirectangular Fixed Mirrored coordinates mode */\r\n Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9;\r\n // Texture rescaling mode\r\n /** Defines that texture rescaling will use a floor to find the closer power of 2 size */\r\n Engine.SCALEMODE_FLOOR = 1;\r\n /** Defines that texture rescaling will look for the nearest power of 2 size */\r\n Engine.SCALEMODE_NEAREST = 2;\r\n /** Defines that texture rescaling will use a ceil to find the closer power of 2 size */\r\n Engine.SCALEMODE_CEILING = 3;\r\n /**\r\n * Method called to create the default rescale post process on each engine.\r\n */\r\n Engine._RescalePostProcessFactory = null;\r\n return Engine;\r\n}(ThinEngine));\r\nexport { Engine };\r\n//# sourceMappingURL=engine.js.map","/**\r\n * The engine store class is responsible to hold all the instances of Engine and Scene created\r\n * during the life time of the application.\r\n */\r\nvar EngineStore = /** @class */ (function () {\r\n function EngineStore() {\r\n }\r\n Object.defineProperty(EngineStore, \"LastCreatedEngine\", {\r\n /**\r\n * Gets the latest created engine\r\n */\r\n get: function () {\r\n if (this.Instances.length === 0) {\r\n return null;\r\n }\r\n return this.Instances[this.Instances.length - 1];\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(EngineStore, \"LastCreatedScene\", {\r\n /**\r\n * Gets the latest created scene\r\n */\r\n get: function () {\r\n return this._LastCreatedScene;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** Gets the list of created engines */\r\n EngineStore.Instances = new Array();\r\n /** @hidden */\r\n EngineStore._LastCreatedScene = null;\r\n /**\r\n * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded\r\n * @ignorenaming\r\n */\r\n EngineStore.UseFallbackTexture = true;\r\n /**\r\n * Texture content used if a texture cannot loaded\r\n * @ignorenaming\r\n */\r\n EngineStore.FallbackTexture = \"\";\r\n return EngineStore;\r\n}());\r\nexport { EngineStore };\r\n//# sourceMappingURL=engineStore.js.map","/** @hidden */\r\nvar PerformanceConfigurator = /** @class */ (function () {\r\n function PerformanceConfigurator() {\r\n }\r\n /** @hidden */\r\n PerformanceConfigurator.SetMatrixPrecision = function (use64bits) {\r\n PerformanceConfigurator.MatrixTrackPrecisionChange = false;\r\n if (use64bits && !PerformanceConfigurator.MatrixUse64Bits) {\r\n if (PerformanceConfigurator.MatrixTrackedMatrices) {\r\n for (var m = 0; m < PerformanceConfigurator.MatrixTrackedMatrices.length; ++m) {\r\n var matrix = PerformanceConfigurator.MatrixTrackedMatrices[m];\r\n var values = matrix._m;\r\n matrix._m = new Array(16);\r\n for (var i = 0; i < 16; ++i) {\r\n matrix._m[i] = values[i];\r\n }\r\n }\r\n }\r\n }\r\n PerformanceConfigurator.MatrixUse64Bits = use64bits;\r\n PerformanceConfigurator.MatrixCurrentType = PerformanceConfigurator.MatrixUse64Bits ? Array : Float32Array;\r\n PerformanceConfigurator.MatrixTrackedMatrices = null; // reclaim some memory, as we don't need _TrackedMatrices anymore\r\n };\r\n /** @hidden */\r\n PerformanceConfigurator.MatrixUse64Bits = false;\r\n /** @hidden */\r\n PerformanceConfigurator.MatrixTrackPrecisionChange = true;\r\n /** @hidden */\r\n PerformanceConfigurator.MatrixCurrentType = Float32Array;\r\n /** @hidden */\r\n PerformanceConfigurator.MatrixTrackedMatrices = [];\r\n return PerformanceConfigurator;\r\n}());\r\nexport { PerformanceConfigurator };\r\n//# sourceMappingURL=performanceConfigurator.js.map","/**\r\n * @hidden\r\n **/\r\nvar DepthCullingState = /** @class */ (function () {\r\n /**\r\n * Initializes the state.\r\n */\r\n function DepthCullingState() {\r\n this._isDepthTestDirty = false;\r\n this._isDepthMaskDirty = false;\r\n this._isDepthFuncDirty = false;\r\n this._isCullFaceDirty = false;\r\n this._isCullDirty = false;\r\n this._isZOffsetDirty = false;\r\n this._isFrontFaceDirty = false;\r\n this.reset();\r\n }\r\n Object.defineProperty(DepthCullingState.prototype, \"isDirty\", {\r\n get: function () {\r\n return this._isDepthFuncDirty || this._isDepthTestDirty || this._isDepthMaskDirty || this._isCullFaceDirty || this._isCullDirty || this._isZOffsetDirty || this._isFrontFaceDirty;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthCullingState.prototype, \"zOffset\", {\r\n get: function () {\r\n return this._zOffset;\r\n },\r\n set: function (value) {\r\n if (this._zOffset === value) {\r\n return;\r\n }\r\n this._zOffset = value;\r\n this._isZOffsetDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthCullingState.prototype, \"cullFace\", {\r\n get: function () {\r\n return this._cullFace;\r\n },\r\n set: function (value) {\r\n if (this._cullFace === value) {\r\n return;\r\n }\r\n this._cullFace = value;\r\n this._isCullFaceDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthCullingState.prototype, \"cull\", {\r\n get: function () {\r\n return this._cull;\r\n },\r\n set: function (value) {\r\n if (this._cull === value) {\r\n return;\r\n }\r\n this._cull = value;\r\n this._isCullDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthCullingState.prototype, \"depthFunc\", {\r\n get: function () {\r\n return this._depthFunc;\r\n },\r\n set: function (value) {\r\n if (this._depthFunc === value) {\r\n return;\r\n }\r\n this._depthFunc = value;\r\n this._isDepthFuncDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthCullingState.prototype, \"depthMask\", {\r\n get: function () {\r\n return this._depthMask;\r\n },\r\n set: function (value) {\r\n if (this._depthMask === value) {\r\n return;\r\n }\r\n this._depthMask = value;\r\n this._isDepthMaskDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthCullingState.prototype, \"depthTest\", {\r\n get: function () {\r\n return this._depthTest;\r\n },\r\n set: function (value) {\r\n if (this._depthTest === value) {\r\n return;\r\n }\r\n this._depthTest = value;\r\n this._isDepthTestDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DepthCullingState.prototype, \"frontFace\", {\r\n get: function () {\r\n return this._frontFace;\r\n },\r\n set: function (value) {\r\n if (this._frontFace === value) {\r\n return;\r\n }\r\n this._frontFace = value;\r\n this._isFrontFaceDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n DepthCullingState.prototype.reset = function () {\r\n this._depthMask = true;\r\n this._depthTest = true;\r\n this._depthFunc = null;\r\n this._cullFace = null;\r\n this._cull = null;\r\n this._zOffset = 0;\r\n this._frontFace = null;\r\n this._isDepthTestDirty = true;\r\n this._isDepthMaskDirty = true;\r\n this._isDepthFuncDirty = false;\r\n this._isCullFaceDirty = false;\r\n this._isCullDirty = false;\r\n this._isZOffsetDirty = false;\r\n this._isFrontFaceDirty = false;\r\n };\r\n DepthCullingState.prototype.apply = function (gl) {\r\n if (!this.isDirty) {\r\n return;\r\n }\r\n // Cull\r\n if (this._isCullDirty) {\r\n if (this.cull) {\r\n gl.enable(gl.CULL_FACE);\r\n }\r\n else {\r\n gl.disable(gl.CULL_FACE);\r\n }\r\n this._isCullDirty = false;\r\n }\r\n // Cull face\r\n if (this._isCullFaceDirty) {\r\n gl.cullFace(this.cullFace);\r\n this._isCullFaceDirty = false;\r\n }\r\n // Depth mask\r\n if (this._isDepthMaskDirty) {\r\n gl.depthMask(this.depthMask);\r\n this._isDepthMaskDirty = false;\r\n }\r\n // Depth test\r\n if (this._isDepthTestDirty) {\r\n if (this.depthTest) {\r\n gl.enable(gl.DEPTH_TEST);\r\n }\r\n else {\r\n gl.disable(gl.DEPTH_TEST);\r\n }\r\n this._isDepthTestDirty = false;\r\n }\r\n // Depth func\r\n if (this._isDepthFuncDirty) {\r\n gl.depthFunc(this.depthFunc);\r\n this._isDepthFuncDirty = false;\r\n }\r\n // zOffset\r\n if (this._isZOffsetDirty) {\r\n if (this.zOffset) {\r\n gl.enable(gl.POLYGON_OFFSET_FILL);\r\n gl.polygonOffset(this.zOffset, 0);\r\n }\r\n else {\r\n gl.disable(gl.POLYGON_OFFSET_FILL);\r\n }\r\n this._isZOffsetDirty = false;\r\n }\r\n // Front face\r\n if (this._isFrontFaceDirty) {\r\n gl.frontFace(this.frontFace);\r\n this._isFrontFaceDirty = false;\r\n }\r\n };\r\n return DepthCullingState;\r\n}());\r\nexport { DepthCullingState };\r\n//# sourceMappingURL=depthCullingState.js.map","/**\r\n * @hidden\r\n **/\r\nvar StencilState = /** @class */ (function () {\r\n function StencilState() {\r\n this._isStencilTestDirty = false;\r\n this._isStencilMaskDirty = false;\r\n this._isStencilFuncDirty = false;\r\n this._isStencilOpDirty = false;\r\n this.reset();\r\n }\r\n Object.defineProperty(StencilState.prototype, \"isDirty\", {\r\n get: function () {\r\n return this._isStencilTestDirty || this._isStencilMaskDirty || this._isStencilFuncDirty || this._isStencilOpDirty;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilFunc\", {\r\n get: function () {\r\n return this._stencilFunc;\r\n },\r\n set: function (value) {\r\n if (this._stencilFunc === value) {\r\n return;\r\n }\r\n this._stencilFunc = value;\r\n this._isStencilFuncDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilFuncRef\", {\r\n get: function () {\r\n return this._stencilFuncRef;\r\n },\r\n set: function (value) {\r\n if (this._stencilFuncRef === value) {\r\n return;\r\n }\r\n this._stencilFuncRef = value;\r\n this._isStencilFuncDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilFuncMask\", {\r\n get: function () {\r\n return this._stencilFuncMask;\r\n },\r\n set: function (value) {\r\n if (this._stencilFuncMask === value) {\r\n return;\r\n }\r\n this._stencilFuncMask = value;\r\n this._isStencilFuncDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilOpStencilFail\", {\r\n get: function () {\r\n return this._stencilOpStencilFail;\r\n },\r\n set: function (value) {\r\n if (this._stencilOpStencilFail === value) {\r\n return;\r\n }\r\n this._stencilOpStencilFail = value;\r\n this._isStencilOpDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilOpDepthFail\", {\r\n get: function () {\r\n return this._stencilOpDepthFail;\r\n },\r\n set: function (value) {\r\n if (this._stencilOpDepthFail === value) {\r\n return;\r\n }\r\n this._stencilOpDepthFail = value;\r\n this._isStencilOpDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilOpStencilDepthPass\", {\r\n get: function () {\r\n return this._stencilOpStencilDepthPass;\r\n },\r\n set: function (value) {\r\n if (this._stencilOpStencilDepthPass === value) {\r\n return;\r\n }\r\n this._stencilOpStencilDepthPass = value;\r\n this._isStencilOpDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilMask\", {\r\n get: function () {\r\n return this._stencilMask;\r\n },\r\n set: function (value) {\r\n if (this._stencilMask === value) {\r\n return;\r\n }\r\n this._stencilMask = value;\r\n this._isStencilMaskDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StencilState.prototype, \"stencilTest\", {\r\n get: function () {\r\n return this._stencilTest;\r\n },\r\n set: function (value) {\r\n if (this._stencilTest === value) {\r\n return;\r\n }\r\n this._stencilTest = value;\r\n this._isStencilTestDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n StencilState.prototype.reset = function () {\r\n this._stencilTest = false;\r\n this._stencilMask = 0xFF;\r\n this._stencilFunc = StencilState.ALWAYS;\r\n this._stencilFuncRef = 1;\r\n this._stencilFuncMask = 0xFF;\r\n this._stencilOpStencilFail = StencilState.KEEP;\r\n this._stencilOpDepthFail = StencilState.KEEP;\r\n this._stencilOpStencilDepthPass = StencilState.REPLACE;\r\n this._isStencilTestDirty = true;\r\n this._isStencilMaskDirty = true;\r\n this._isStencilFuncDirty = true;\r\n this._isStencilOpDirty = true;\r\n };\r\n StencilState.prototype.apply = function (gl) {\r\n if (!this.isDirty) {\r\n return;\r\n }\r\n // Stencil test\r\n if (this._isStencilTestDirty) {\r\n if (this.stencilTest) {\r\n gl.enable(gl.STENCIL_TEST);\r\n }\r\n else {\r\n gl.disable(gl.STENCIL_TEST);\r\n }\r\n this._isStencilTestDirty = false;\r\n }\r\n // Stencil mask\r\n if (this._isStencilMaskDirty) {\r\n gl.stencilMask(this.stencilMask);\r\n this._isStencilMaskDirty = false;\r\n }\r\n // Stencil func\r\n if (this._isStencilFuncDirty) {\r\n gl.stencilFunc(this.stencilFunc, this.stencilFuncRef, this.stencilFuncMask);\r\n this._isStencilFuncDirty = false;\r\n }\r\n // Stencil op\r\n if (this._isStencilOpDirty) {\r\n gl.stencilOp(this.stencilOpStencilFail, this.stencilOpDepthFail, this.stencilOpStencilDepthPass);\r\n this._isStencilOpDirty = false;\r\n }\r\n };\r\n /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\r\n StencilState.ALWAYS = 519;\r\n /** Passed to stencilOperation to specify that stencil value must be kept */\r\n StencilState.KEEP = 7680;\r\n /** Passed to stencilOperation to specify that stencil value must be replaced */\r\n StencilState.REPLACE = 7681;\r\n return StencilState;\r\n}());\r\nexport { StencilState };\r\n//# sourceMappingURL=stencilState.js.map","/**\r\n * @hidden\r\n **/\r\nvar AlphaState = /** @class */ (function () {\r\n /**\r\n * Initializes the state.\r\n */\r\n function AlphaState() {\r\n this._isAlphaBlendDirty = false;\r\n this._isBlendFunctionParametersDirty = false;\r\n this._isBlendEquationParametersDirty = false;\r\n this._isBlendConstantsDirty = false;\r\n this._alphaBlend = false;\r\n this._blendFunctionParameters = new Array(4);\r\n this._blendEquationParameters = new Array(2);\r\n this._blendConstants = new Array(4);\r\n this.reset();\r\n }\r\n Object.defineProperty(AlphaState.prototype, \"isDirty\", {\r\n get: function () {\r\n return this._isAlphaBlendDirty || this._isBlendFunctionParametersDirty;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AlphaState.prototype, \"alphaBlend\", {\r\n get: function () {\r\n return this._alphaBlend;\r\n },\r\n set: function (value) {\r\n if (this._alphaBlend === value) {\r\n return;\r\n }\r\n this._alphaBlend = value;\r\n this._isAlphaBlendDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n AlphaState.prototype.setAlphaBlendConstants = function (r, g, b, a) {\r\n if (this._blendConstants[0] === r &&\r\n this._blendConstants[1] === g &&\r\n this._blendConstants[2] === b &&\r\n this._blendConstants[3] === a) {\r\n return;\r\n }\r\n this._blendConstants[0] = r;\r\n this._blendConstants[1] = g;\r\n this._blendConstants[2] = b;\r\n this._blendConstants[3] = a;\r\n this._isBlendConstantsDirty = true;\r\n };\r\n AlphaState.prototype.setAlphaBlendFunctionParameters = function (value0, value1, value2, value3) {\r\n if (this._blendFunctionParameters[0] === value0 &&\r\n this._blendFunctionParameters[1] === value1 &&\r\n this._blendFunctionParameters[2] === value2 &&\r\n this._blendFunctionParameters[3] === value3) {\r\n return;\r\n }\r\n this._blendFunctionParameters[0] = value0;\r\n this._blendFunctionParameters[1] = value1;\r\n this._blendFunctionParameters[2] = value2;\r\n this._blendFunctionParameters[3] = value3;\r\n this._isBlendFunctionParametersDirty = true;\r\n };\r\n AlphaState.prototype.setAlphaEquationParameters = function (rgb, alpha) {\r\n if (this._blendEquationParameters[0] === rgb &&\r\n this._blendEquationParameters[1] === alpha) {\r\n return;\r\n }\r\n this._blendEquationParameters[0] = rgb;\r\n this._blendEquationParameters[1] = alpha;\r\n this._isBlendEquationParametersDirty = true;\r\n };\r\n AlphaState.prototype.reset = function () {\r\n this._alphaBlend = false;\r\n this._blendFunctionParameters[0] = null;\r\n this._blendFunctionParameters[1] = null;\r\n this._blendFunctionParameters[2] = null;\r\n this._blendFunctionParameters[3] = null;\r\n this._blendEquationParameters[0] = null;\r\n this._blendEquationParameters[1] = null;\r\n this._blendConstants[0] = null;\r\n this._blendConstants[1] = null;\r\n this._blendConstants[2] = null;\r\n this._blendConstants[3] = null;\r\n this._isAlphaBlendDirty = true;\r\n this._isBlendFunctionParametersDirty = false;\r\n this._isBlendEquationParametersDirty = false;\r\n this._isBlendConstantsDirty = false;\r\n };\r\n AlphaState.prototype.apply = function (gl) {\r\n if (!this.isDirty) {\r\n return;\r\n }\r\n // Alpha blend\r\n if (this._isAlphaBlendDirty) {\r\n if (this._alphaBlend) {\r\n gl.enable(gl.BLEND);\r\n }\r\n else {\r\n gl.disable(gl.BLEND);\r\n }\r\n this._isAlphaBlendDirty = false;\r\n }\r\n // Alpha function\r\n if (this._isBlendFunctionParametersDirty) {\r\n gl.blendFuncSeparate(this._blendFunctionParameters[0], this._blendFunctionParameters[1], this._blendFunctionParameters[2], this._blendFunctionParameters[3]);\r\n this._isBlendFunctionParametersDirty = false;\r\n }\r\n // Alpha equation\r\n if (this._isBlendEquationParametersDirty) {\r\n gl.blendEquationSeparate(this._blendEquationParameters[0], this._blendEquationParameters[1]);\r\n this._isBlendEquationParametersDirty = false;\r\n }\r\n // Constants\r\n if (this._isBlendConstantsDirty) {\r\n gl.blendColor(this._blendConstants[0], this._blendConstants[1], this._blendConstants[2], this._blendConstants[3]);\r\n this._isBlendConstantsDirty = false;\r\n }\r\n };\r\n return AlphaState;\r\n}());\r\nexport { AlphaState };\r\n//# sourceMappingURL=alphaCullingState.js.map","/** @hidden */\r\nvar WebGLShaderProcessor = /** @class */ (function () {\r\n function WebGLShaderProcessor() {\r\n }\r\n WebGLShaderProcessor.prototype.postProcessor = function (code, defines, isFragment, engine) {\r\n // Remove extensions\r\n if (!engine.getCaps().drawBuffersExtension) {\r\n // even if enclosed in #if/#endif, IE11 does parse the #extension declaration, so we need to remove it altogether\r\n var regex = /#extension.+GL_EXT_draw_buffers.+(enable|require)/g;\r\n code = code.replace(regex, \"\");\r\n }\r\n return code;\r\n };\r\n return WebGLShaderProcessor;\r\n}());\r\nexport { WebGLShaderProcessor };\r\n//# sourceMappingURL=webGLShaderProcessors.js.map","/** @hidden */\r\nvar WebGL2ShaderProcessor = /** @class */ (function () {\r\n function WebGL2ShaderProcessor() {\r\n }\r\n WebGL2ShaderProcessor.prototype.attributeProcessor = function (attribute) {\r\n return attribute.replace(\"attribute\", \"in\");\r\n };\r\n WebGL2ShaderProcessor.prototype.varyingProcessor = function (varying, isFragment) {\r\n return varying.replace(\"varying\", isFragment ? \"in\" : \"out\");\r\n };\r\n WebGL2ShaderProcessor.prototype.postProcessor = function (code, defines, isFragment) {\r\n var hasDrawBuffersExtension = code.search(/#extension.+GL_EXT_draw_buffers.+require/) !== -1;\r\n // Remove extensions\r\n var regex = /#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g;\r\n code = code.replace(regex, \"\");\r\n // Replace instructions\r\n code = code.replace(/texture2D\\s*\\(/g, \"texture(\");\r\n if (isFragment) {\r\n code = code.replace(/texture2DLodEXT\\s*\\(/g, \"textureLod(\");\r\n code = code.replace(/textureCubeLodEXT\\s*\\(/g, \"textureLod(\");\r\n code = code.replace(/textureCube\\s*\\(/g, \"texture(\");\r\n code = code.replace(/gl_FragDepthEXT/g, \"gl_FragDepth\");\r\n code = code.replace(/gl_FragColor/g, \"glFragColor\");\r\n code = code.replace(/gl_FragData/g, \"glFragData\");\r\n code = code.replace(/void\\s+?main\\s*\\(/g, (hasDrawBuffersExtension ? \"\" : \"out vec4 glFragColor;\\n\") + \"void main(\");\r\n }\r\n else {\r\n var hasMultiviewExtension = defines.indexOf(\"#define MULTIVIEW\") !== -1;\r\n if (hasMultiviewExtension) {\r\n return \"#extension GL_OVR_multiview2 : require\\nlayout (num_views = 2) in;\\n\" + code;\r\n }\r\n }\r\n return code;\r\n };\r\n return WebGL2ShaderProcessor;\r\n}());\r\nexport { WebGL2ShaderProcessor };\r\n//# sourceMappingURL=webGL2ShaderProcessors.js.map","/** @hidden */\r\nvar WebGLPipelineContext = /** @class */ (function () {\r\n function WebGLPipelineContext() {\r\n this.vertexCompilationError = null;\r\n this.fragmentCompilationError = null;\r\n this.programLinkError = null;\r\n this.programValidationError = null;\r\n }\r\n Object.defineProperty(WebGLPipelineContext.prototype, \"isAsync\", {\r\n get: function () {\r\n return this.isParallelCompiled;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebGLPipelineContext.prototype, \"isReady\", {\r\n get: function () {\r\n if (this.program) {\r\n if (this.isParallelCompiled) {\r\n return this.engine._isRenderingStateCompiled(this);\r\n }\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n WebGLPipelineContext.prototype._handlesSpectorRebuildCallback = function (onCompiled) {\r\n if (onCompiled && this.program) {\r\n onCompiled(this.program);\r\n }\r\n };\r\n WebGLPipelineContext.prototype._getVertexShaderCode = function () {\r\n return this.vertexShader ? this.engine._getShaderSource(this.vertexShader) : null;\r\n };\r\n WebGLPipelineContext.prototype._getFragmentShaderCode = function () {\r\n return this.fragmentShader ? this.engine._getShaderSource(this.fragmentShader) : null;\r\n };\r\n return WebGLPipelineContext;\r\n}());\r\nexport { WebGLPipelineContext };\r\n//# sourceMappingURL=webGLPipelineContext.js.map","import { EngineStore } from './engineStore';\r\nimport { Effect } from '../Materials/effect';\r\nimport { _DevTools } from '../Misc/devTools';\r\nimport { Observable } from '../Misc/observable';\r\nimport { DepthCullingState } from '../States/depthCullingState';\r\nimport { StencilState } from '../States/stencilState';\r\nimport { AlphaState } from '../States/alphaCullingState';\r\nimport { InternalTexture, InternalTextureSource } from '../Materials/Textures/internalTexture';\r\nimport { Logger } from '../Misc/logger';\r\nimport { DomManagement } from '../Misc/domManagement';\r\nimport { WebGLShaderProcessor } from './WebGL/webGLShaderProcessors';\r\nimport { WebGL2ShaderProcessor } from './WebGL/webGL2ShaderProcessors';\r\nimport { WebGLDataBuffer } from '../Meshes/WebGL/webGLDataBuffer';\r\nimport { WebGLPipelineContext } from './WebGL/webGLPipelineContext';\r\nimport { CanvasGenerator } from '../Misc/canvasGenerator';\r\nimport { PerformanceConfigurator } from './performanceConfigurator';\r\n/**\r\n * Keeps track of all the buffer info used in engine.\r\n */\r\nvar BufferPointer = /** @class */ (function () {\r\n function BufferPointer() {\r\n }\r\n return BufferPointer;\r\n}());\r\n/**\r\n * The base engine class (root of all engines)\r\n */\r\nvar ThinEngine = /** @class */ (function () {\r\n /**\r\n * Creates a new engine\r\n * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which alreay used the WebGL context\r\n * @param antialias defines enable antialiasing (default: false)\r\n * @param options defines further options to be sent to the getContext() function\r\n * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)\r\n */\r\n function ThinEngine(canvasOrContext, antialias, options, adaptToDeviceRatio) {\r\n var _this = this;\r\n if (adaptToDeviceRatio === void 0) { adaptToDeviceRatio = false; }\r\n /**\r\n * Gets or sets a boolean that indicates if textures must be forced to power of 2 size even if not required\r\n */\r\n this.forcePOTTextures = false;\r\n /**\r\n * Gets a boolean indicating if the engine is currently rendering in fullscreen mode\r\n */\r\n this.isFullscreen = false;\r\n /**\r\n * Gets or sets a boolean indicating if back faces must be culled (true by default)\r\n */\r\n this.cullBackFaces = true;\r\n /**\r\n * Gets or sets a boolean indicating if the engine must keep rendering even if the window is not in foregroun\r\n */\r\n this.renderEvenInBackground = true;\r\n /**\r\n * Gets or sets a boolean indicating that cache can be kept between frames\r\n */\r\n this.preventCacheWipeBetweenFrames = false;\r\n /** Gets or sets a boolean indicating if the engine should validate programs after compilation */\r\n this.validateShaderPrograms = false;\r\n /**\r\n * Gets or sets a boolean indicating if depth buffer should be reverse, going from far to near.\r\n * This can provide greater z depth for distant objects.\r\n */\r\n this.useReverseDepthBuffer = false;\r\n // Uniform buffers list\r\n /**\r\n * Gets or sets a boolean indicating that uniform buffers must be disabled even if they are supported\r\n */\r\n this.disableUniformBuffers = false;\r\n /** @hidden */\r\n this._uniformBuffers = new Array();\r\n /** @hidden */\r\n this._webGLVersion = 1.0;\r\n this._windowIsBackground = false;\r\n this._highPrecisionShadersAllowed = true;\r\n /** @hidden */\r\n this._badOS = false;\r\n /** @hidden */\r\n this._badDesktopOS = false;\r\n this._renderingQueueLaunched = false;\r\n this._activeRenderLoops = new Array();\r\n // Lost context\r\n /**\r\n * Observable signaled when a context lost event is raised\r\n */\r\n this.onContextLostObservable = new Observable();\r\n /**\r\n * Observable signaled when a context restored event is raised\r\n */\r\n this.onContextRestoredObservable = new Observable();\r\n this._contextWasLost = false;\r\n /** @hidden */\r\n this._doNotHandleContextLost = false;\r\n /**\r\n * Gets or sets a boolean indicating that vertex array object must be disabled even if they are supported\r\n */\r\n this.disableVertexArrayObjects = false;\r\n // States\r\n /** @hidden */\r\n this._colorWrite = true;\r\n /** @hidden */\r\n this._colorWriteChanged = true;\r\n /** @hidden */\r\n this._depthCullingState = new DepthCullingState();\r\n /** @hidden */\r\n this._stencilState = new StencilState();\r\n /** @hidden */\r\n this._alphaState = new AlphaState();\r\n /** @hidden */\r\n this._alphaMode = 1;\r\n /** @hidden */\r\n this._alphaEquation = 0;\r\n // Cache\r\n /** @hidden */\r\n this._internalTexturesCache = new Array();\r\n /** @hidden */\r\n this._activeChannel = 0;\r\n this._currentTextureChannel = -1;\r\n /** @hidden */\r\n this._boundTexturesCache = {};\r\n this._compiledEffects = {};\r\n this._vertexAttribArraysEnabled = [];\r\n this._uintIndicesCurrentlySet = false;\r\n this._currentBoundBuffer = new Array();\r\n /** @hidden */\r\n this._currentFramebuffer = null;\r\n /** @hidden */\r\n this._dummyFramebuffer = null;\r\n this._currentBufferPointers = new Array();\r\n this._currentInstanceLocations = new Array();\r\n this._currentInstanceBuffers = new Array();\r\n this._vaoRecordInProgress = false;\r\n this._mustWipeVertexAttributes = false;\r\n this._nextFreeTextureSlots = new Array();\r\n this._maxSimultaneousTextures = 0;\r\n this._activeRequests = new Array();\r\n /** @hidden */\r\n this._transformTextureUrl = null;\r\n /**\r\n * Gets information about the current host\r\n */\r\n this.hostInformation = {\r\n isMobile: false\r\n };\r\n /**\r\n * Defines whether the engine has been created with the premultipliedAlpha option on or not.\r\n */\r\n this.premultipliedAlpha = true;\r\n /**\r\n * Observable event triggered before each texture is initialized\r\n */\r\n this.onBeforeTextureInitObservable = new Observable();\r\n this._viewportCached = { x: 0, y: 0, z: 0, w: 0 };\r\n this._unpackFlipYCached = null;\r\n /**\r\n * In case you are sharing the context with other applications, it might\r\n * be interested to not cache the unpack flip y state to ensure a consistent\r\n * value would be set.\r\n */\r\n this.enableUnpackFlipYCached = true;\r\n this._getDepthStencilBuffer = function (width, height, samples, internalFormat, msInternalFormat, attachment) {\r\n var gl = _this._gl;\r\n var depthStencilBuffer = gl.createRenderbuffer();\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);\r\n if (samples > 1 && gl.renderbufferStorageMultisample) {\r\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, msInternalFormat, width, height);\r\n }\r\n else {\r\n gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);\r\n }\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, depthStencilBuffer);\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\r\n return depthStencilBuffer;\r\n };\r\n this._boundUniforms = {};\r\n var canvas = null;\r\n if (!canvasOrContext) {\r\n return;\r\n }\r\n options = options || {};\r\n PerformanceConfigurator.SetMatrixPrecision(!!options.useHighPrecisionMatrix);\r\n if (canvasOrContext.getContext) {\r\n canvas = canvasOrContext;\r\n this._renderingCanvas = canvas;\r\n if (antialias != null) {\r\n options.antialias = antialias;\r\n }\r\n if (options.deterministicLockstep === undefined) {\r\n options.deterministicLockstep = false;\r\n }\r\n if (options.lockstepMaxSteps === undefined) {\r\n options.lockstepMaxSteps = 4;\r\n }\r\n if (options.timeStep === undefined) {\r\n options.timeStep = 1 / 60;\r\n }\r\n if (options.preserveDrawingBuffer === undefined) {\r\n options.preserveDrawingBuffer = false;\r\n }\r\n if (options.audioEngine === undefined) {\r\n options.audioEngine = true;\r\n }\r\n if (options.stencil === undefined) {\r\n options.stencil = true;\r\n }\r\n if (options.premultipliedAlpha === false) {\r\n this.premultipliedAlpha = false;\r\n }\r\n if (options.xrCompatible === undefined) {\r\n options.xrCompatible = true;\r\n }\r\n this._doNotHandleContextLost = options.doNotHandleContextLost ? true : false;\r\n // Exceptions\r\n if (navigator && navigator.userAgent) {\r\n var ua = navigator.userAgent;\r\n this.hostInformation.isMobile = ua.indexOf(\"Mobile\") !== -1;\r\n for (var _i = 0, _a = ThinEngine.ExceptionList; _i < _a.length; _i++) {\r\n var exception = _a[_i];\r\n var key = exception.key;\r\n var targets = exception.targets;\r\n var check = new RegExp(key);\r\n if (check.test(ua)) {\r\n if (exception.capture && exception.captureConstraint) {\r\n var capture = exception.capture;\r\n var constraint = exception.captureConstraint;\r\n var regex = new RegExp(capture);\r\n var matches = regex.exec(ua);\r\n if (matches && matches.length > 0) {\r\n var capturedValue = parseInt(matches[matches.length - 1]);\r\n if (capturedValue >= constraint) {\r\n continue;\r\n }\r\n }\r\n }\r\n for (var _b = 0, targets_1 = targets; _b < targets_1.length; _b++) {\r\n var target = targets_1[_b];\r\n switch (target) {\r\n case \"uniformBuffer\":\r\n this.disableUniformBuffers = true;\r\n break;\r\n case \"vao\":\r\n this.disableVertexArrayObjects = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Context lost\r\n if (!this._doNotHandleContextLost) {\r\n this._onContextLost = function (evt) {\r\n evt.preventDefault();\r\n _this._contextWasLost = true;\r\n Logger.Warn(\"WebGL context lost.\");\r\n _this.onContextLostObservable.notifyObservers(_this);\r\n };\r\n this._onContextRestored = function () {\r\n // Adding a timeout to avoid race condition at browser level\r\n setTimeout(function () {\r\n // Rebuild gl context\r\n _this._initGLContext();\r\n // Rebuild effects\r\n _this._rebuildEffects();\r\n // Rebuild textures\r\n _this._rebuildInternalTextures();\r\n // Rebuild buffers\r\n _this._rebuildBuffers();\r\n // Cache\r\n _this.wipeCaches(true);\r\n Logger.Warn(\"WebGL context successfully restored.\");\r\n _this.onContextRestoredObservable.notifyObservers(_this);\r\n _this._contextWasLost = false;\r\n }, 0);\r\n };\r\n canvas.addEventListener(\"webglcontextlost\", this._onContextLost, false);\r\n canvas.addEventListener(\"webglcontextrestored\", this._onContextRestored, false);\r\n options.powerPreference = \"high-performance\";\r\n }\r\n // GL\r\n if (!options.disableWebGL2Support) {\r\n try {\r\n this._gl = (canvas.getContext(\"webgl2\", options) || canvas.getContext(\"experimental-webgl2\", options));\r\n if (this._gl) {\r\n this._webGLVersion = 2.0;\r\n // Prevent weird browsers to lie (yeah that happens!)\r\n if (!this._gl.deleteQuery) {\r\n this._webGLVersion = 1.0;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Do nothing\r\n }\r\n }\r\n if (!this._gl) {\r\n if (!canvas) {\r\n throw new Error(\"The provided canvas is null or undefined.\");\r\n }\r\n try {\r\n this._gl = (canvas.getContext(\"webgl\", options) || canvas.getContext(\"experimental-webgl\", options));\r\n }\r\n catch (e) {\r\n throw new Error(\"WebGL not supported\");\r\n }\r\n }\r\n if (!this._gl) {\r\n throw new Error(\"WebGL not supported\");\r\n }\r\n }\r\n else {\r\n this._gl = canvasOrContext;\r\n this._renderingCanvas = this._gl.canvas;\r\n if (this._gl.renderbufferStorageMultisample) {\r\n this._webGLVersion = 2.0;\r\n }\r\n var attributes = this._gl.getContextAttributes();\r\n if (attributes) {\r\n options.stencil = attributes.stencil;\r\n }\r\n }\r\n // Ensures a consistent color space unpacking of textures cross browser.\r\n this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);\r\n if (options.useHighPrecisionFloats !== undefined) {\r\n this._highPrecisionShadersAllowed = options.useHighPrecisionFloats;\r\n }\r\n // Viewport\r\n var devicePixelRatio = DomManagement.IsWindowObjectExist() ? (window.devicePixelRatio || 1.0) : 1.0;\r\n var limitDeviceRatio = options.limitDeviceRatio || devicePixelRatio;\r\n this._hardwareScalingLevel = adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, devicePixelRatio) : 1.0;\r\n this.resize();\r\n this._isStencilEnable = options.stencil ? true : false;\r\n this._initGLContext();\r\n // Prepare buffer pointers\r\n for (var i = 0; i < this._caps.maxVertexAttribs; i++) {\r\n this._currentBufferPointers[i] = new BufferPointer();\r\n }\r\n // Shader processor\r\n if (this.webGLVersion > 1) {\r\n this._shaderProcessor = new WebGL2ShaderProcessor();\r\n }\r\n else {\r\n this._shaderProcessor = new WebGLShaderProcessor();\r\n }\r\n // Detect if we are running on a faulty buggy OS.\r\n this._badOS = /iPad/i.test(navigator.userAgent) || /iPhone/i.test(navigator.userAgent);\r\n // Starting with iOS 14, we can trust the browser\r\n // let matches = navigator.userAgent.match(/Version\\/(\\d+)/);\r\n // if (matches && matches.length === 2) {\r\n // if (parseInt(matches[1]) >= 14) {\r\n // this._badOS = false;\r\n // }\r\n // }\r\n // Detect if we are running on a faulty buggy desktop OS.\r\n this._badDesktopOS = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\r\n this._creationOptions = options;\r\n console.log(\"Babylon.js v\" + ThinEngine.Version + \" - \" + this.description);\r\n }\r\n Object.defineProperty(ThinEngine, \"NpmPackage\", {\r\n /**\r\n * Returns the current npm package of the sdk\r\n */\r\n // Not mixed with Version for tooling purpose.\r\n get: function () {\r\n return \"babylonjs@4.2.0\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine, \"Version\", {\r\n /**\r\n * Returns the current version of the framework\r\n */\r\n get: function () {\r\n return \"4.2.0\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"description\", {\r\n /**\r\n * Returns a string describing the current engine\r\n */\r\n get: function () {\r\n var description = \"WebGL\" + this.webGLVersion;\r\n if (this._caps.parallelShaderCompile) {\r\n description += \" - Parallel shader compilation\";\r\n }\r\n return description;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine, \"ShadersRepository\", {\r\n /**\r\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\r\n */\r\n get: function () {\r\n return Effect.ShadersRepository;\r\n },\r\n set: function (value) {\r\n Effect.ShadersRepository = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"supportsUniformBuffers\", {\r\n /**\r\n * Gets a boolean indicating that the engine supports uniform buffers\r\n * @see https://doc.babylonjs.com/features/webgl2#uniform-buffer-objets\r\n */\r\n get: function () {\r\n return this.webGLVersion > 1 && !this.disableUniformBuffers;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"_shouldUseHighPrecisionShader\", {\r\n /** @hidden */\r\n get: function () {\r\n return !!(this._caps.highPrecisionShaderSupported && this._highPrecisionShadersAllowed);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"needPOTTextures\", {\r\n /**\r\n * Gets a boolean indicating that only power of 2 textures are supported\r\n * Please note that you can still use non power of 2 textures but in this case the engine will forcefully convert them\r\n */\r\n get: function () {\r\n return this._webGLVersion < 2 || this.forcePOTTextures;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"doNotHandleContextLost\", {\r\n /**\r\n * Gets or sets a boolean indicating if resources should be retained to be able to handle context lost events\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#handling-webgl-context-lost\r\n */\r\n get: function () {\r\n return this._doNotHandleContextLost;\r\n },\r\n set: function (value) {\r\n this._doNotHandleContextLost = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"_supportsHardwareTextureRescaling\", {\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"framebufferDimensionsObject\", {\r\n /**\r\n * sets the object from which width and height will be taken from when getting render width and height\r\n * Will fallback to the gl object\r\n * @param dimensions the framebuffer width and height that will be used.\r\n */\r\n set: function (dimensions) {\r\n this._framebufferDimensionsObject = dimensions;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"currentViewport\", {\r\n /**\r\n * Gets the current viewport\r\n */\r\n get: function () {\r\n return this._cachedViewport;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"emptyTexture\", {\r\n /**\r\n * Gets the default empty texture\r\n */\r\n get: function () {\r\n if (!this._emptyTexture) {\r\n this._emptyTexture = this.createRawTexture(new Uint8Array(4), 1, 1, 5, false, false, 1);\r\n }\r\n return this._emptyTexture;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"emptyTexture3D\", {\r\n /**\r\n * Gets the default empty 3D texture\r\n */\r\n get: function () {\r\n if (!this._emptyTexture3D) {\r\n this._emptyTexture3D = this.createRawTexture3D(new Uint8Array(4), 1, 1, 1, 5, false, false, 1);\r\n }\r\n return this._emptyTexture3D;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"emptyTexture2DArray\", {\r\n /**\r\n * Gets the default empty 2D array texture\r\n */\r\n get: function () {\r\n if (!this._emptyTexture2DArray) {\r\n this._emptyTexture2DArray = this.createRawTexture2DArray(new Uint8Array(4), 1, 1, 1, 5, false, false, 1);\r\n }\r\n return this._emptyTexture2DArray;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"emptyCubeTexture\", {\r\n /**\r\n * Gets the default empty cube texture\r\n */\r\n get: function () {\r\n if (!this._emptyCubeTexture) {\r\n var faceData = new Uint8Array(4);\r\n var cubeData = [faceData, faceData, faceData, faceData, faceData, faceData];\r\n this._emptyCubeTexture = this.createRawCubeTexture(cubeData, 1, 5, 0, false, false, 1);\r\n }\r\n return this._emptyCubeTexture;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ThinEngine.prototype._rebuildInternalTextures = function () {\r\n var currentState = this._internalTexturesCache.slice(); // Do a copy because the rebuild will add proxies\r\n for (var _i = 0, currentState_1 = currentState; _i < currentState_1.length; _i++) {\r\n var internalTexture = currentState_1[_i];\r\n internalTexture._rebuild();\r\n }\r\n };\r\n ThinEngine.prototype._rebuildEffects = function () {\r\n for (var key in this._compiledEffects) {\r\n var effect = this._compiledEffects[key];\r\n effect._prepareEffect();\r\n }\r\n Effect.ResetCache();\r\n };\r\n /**\r\n * Gets a boolean indicating if all created effects are ready\r\n * @returns true if all effects are ready\r\n */\r\n ThinEngine.prototype.areAllEffectsReady = function () {\r\n for (var key in this._compiledEffects) {\r\n var effect = this._compiledEffects[key];\r\n if (!effect.isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n ThinEngine.prototype._rebuildBuffers = function () {\r\n // Uniforms\r\n for (var _i = 0, _a = this._uniformBuffers; _i < _a.length; _i++) {\r\n var uniformBuffer = _a[_i];\r\n uniformBuffer._rebuild();\r\n }\r\n };\r\n ThinEngine.prototype._initGLContext = function () {\r\n // Caps\r\n this._caps = {\r\n maxTexturesImageUnits: this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),\r\n maxCombinedTexturesImageUnits: this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),\r\n maxVertexTextureImageUnits: this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),\r\n maxTextureSize: this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),\r\n maxSamples: this._webGLVersion > 1 ? this._gl.getParameter(this._gl.MAX_SAMPLES) : 1,\r\n maxCubemapTextureSize: this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),\r\n maxRenderTextureSize: this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),\r\n maxVertexAttribs: this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),\r\n maxVaryingVectors: this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),\r\n maxFragmentUniformVectors: this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),\r\n maxVertexUniformVectors: this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),\r\n parallelShaderCompile: this._gl.getExtension('KHR_parallel_shader_compile'),\r\n standardDerivatives: this._webGLVersion > 1 || (this._gl.getExtension('OES_standard_derivatives') !== null),\r\n maxAnisotropy: 1,\r\n astc: this._gl.getExtension('WEBGL_compressed_texture_astc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_astc'),\r\n bptc: this._gl.getExtension('EXT_texture_compression_bptc') || this._gl.getExtension('WEBKIT_EXT_texture_compression_bptc'),\r\n s3tc: this._gl.getExtension('WEBGL_compressed_texture_s3tc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_s3tc'),\r\n pvrtc: this._gl.getExtension('WEBGL_compressed_texture_pvrtc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\r\n etc1: this._gl.getExtension('WEBGL_compressed_texture_etc1') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_etc1'),\r\n etc2: this._gl.getExtension('WEBGL_compressed_texture_etc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_etc') ||\r\n this._gl.getExtension('WEBGL_compressed_texture_es3_0'),\r\n textureAnisotropicFilterExtension: this._gl.getExtension('EXT_texture_filter_anisotropic') || this._gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic') || this._gl.getExtension('MOZ_EXT_texture_filter_anisotropic'),\r\n uintIndices: this._webGLVersion > 1 || this._gl.getExtension('OES_element_index_uint') !== null,\r\n fragmentDepthSupported: this._webGLVersion > 1 || this._gl.getExtension('EXT_frag_depth') !== null,\r\n highPrecisionShaderSupported: false,\r\n timerQuery: this._gl.getExtension('EXT_disjoint_timer_query_webgl2') || this._gl.getExtension(\"EXT_disjoint_timer_query\"),\r\n canUseTimestampForTimerQuery: false,\r\n drawBuffersExtension: false,\r\n maxMSAASamples: 1,\r\n colorBufferFloat: this._webGLVersion > 1 && this._gl.getExtension('EXT_color_buffer_float'),\r\n textureFloat: (this._webGLVersion > 1 || this._gl.getExtension('OES_texture_float')) ? true : false,\r\n textureHalfFloat: (this._webGLVersion > 1 || this._gl.getExtension('OES_texture_half_float')) ? true : false,\r\n textureHalfFloatRender: false,\r\n textureFloatLinearFiltering: false,\r\n textureFloatRender: false,\r\n textureHalfFloatLinearFiltering: false,\r\n vertexArrayObject: false,\r\n instancedArrays: false,\r\n textureLOD: (this._webGLVersion > 1 || this._gl.getExtension('EXT_shader_texture_lod')) ? true : false,\r\n blendMinMax: false,\r\n multiview: this._gl.getExtension('OVR_multiview2'),\r\n oculusMultiview: this._gl.getExtension('OCULUS_multiview'),\r\n depthTextureExtension: false\r\n };\r\n // Infos\r\n this._glVersion = this._gl.getParameter(this._gl.VERSION);\r\n var rendererInfo = this._gl.getExtension(\"WEBGL_debug_renderer_info\");\r\n if (rendererInfo != null) {\r\n this._glRenderer = this._gl.getParameter(rendererInfo.UNMASKED_RENDERER_WEBGL);\r\n this._glVendor = this._gl.getParameter(rendererInfo.UNMASKED_VENDOR_WEBGL);\r\n }\r\n if (!this._glVendor) {\r\n this._glVendor = \"Unknown vendor\";\r\n }\r\n if (!this._glRenderer) {\r\n this._glRenderer = \"Unknown renderer\";\r\n }\r\n // Constants\r\n if (this._gl.HALF_FLOAT_OES !== 0x8D61) {\r\n this._gl.HALF_FLOAT_OES = 0x8D61; // Half floating-point type (16-bit).\r\n }\r\n if (this._gl.RGBA16F !== 0x881A) {\r\n this._gl.RGBA16F = 0x881A; // RGBA 16-bit floating-point color-renderable internal sized format.\r\n }\r\n if (this._gl.RGBA32F !== 0x8814) {\r\n this._gl.RGBA32F = 0x8814; // RGBA 32-bit floating-point color-renderable internal sized format.\r\n }\r\n if (this._gl.DEPTH24_STENCIL8 !== 35056) {\r\n this._gl.DEPTH24_STENCIL8 = 35056;\r\n }\r\n // Extensions\r\n if (this._caps.timerQuery) {\r\n if (this._webGLVersion === 1) {\r\n this._gl.getQuery = this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery);\r\n }\r\n this._caps.canUseTimestampForTimerQuery = this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT, this._caps.timerQuery.QUERY_COUNTER_BITS_EXT) > 0;\r\n }\r\n this._caps.maxAnisotropy = this._caps.textureAnisotropicFilterExtension ? this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0;\r\n this._caps.textureFloatLinearFiltering = this._caps.textureFloat && this._gl.getExtension('OES_texture_float_linear') ? true : false;\r\n this._caps.textureFloatRender = this._caps.textureFloat && this._canRenderToFloatFramebuffer() ? true : false;\r\n this._caps.textureHalfFloatLinearFiltering = (this._webGLVersion > 1 || (this._caps.textureHalfFloat && this._gl.getExtension('OES_texture_half_float_linear'))) ? true : false;\r\n // Checks if some of the format renders first to allow the use of webgl inspector.\r\n if (this._webGLVersion > 1) {\r\n if (this._gl.HALF_FLOAT_OES !== 0x140B) {\r\n this._gl.HALF_FLOAT_OES = 0x140B;\r\n }\r\n }\r\n this._caps.textureHalfFloatRender = this._caps.textureHalfFloat && this._canRenderToHalfFloatFramebuffer();\r\n // Draw buffers\r\n if (this._webGLVersion > 1) {\r\n this._caps.drawBuffersExtension = true;\r\n this._caps.maxMSAASamples = this._gl.getParameter(this._gl.MAX_SAMPLES);\r\n }\r\n else {\r\n var drawBuffersExtension = this._gl.getExtension('WEBGL_draw_buffers');\r\n if (drawBuffersExtension !== null) {\r\n this._caps.drawBuffersExtension = true;\r\n this._gl.drawBuffers = drawBuffersExtension.drawBuffersWEBGL.bind(drawBuffersExtension);\r\n this._gl.DRAW_FRAMEBUFFER = this._gl.FRAMEBUFFER;\r\n for (var i = 0; i < 16; i++) {\r\n this._gl[\"COLOR_ATTACHMENT\" + i + \"_WEBGL\"] = drawBuffersExtension[\"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n }\r\n }\r\n }\r\n // Depth Texture\r\n if (this._webGLVersion > 1) {\r\n this._caps.depthTextureExtension = true;\r\n }\r\n else {\r\n var depthTextureExtension = this._gl.getExtension('WEBGL_depth_texture');\r\n if (depthTextureExtension != null) {\r\n this._caps.depthTextureExtension = true;\r\n this._gl.UNSIGNED_INT_24_8 = depthTextureExtension.UNSIGNED_INT_24_8_WEBGL;\r\n }\r\n }\r\n // Vertex array object\r\n if (this.disableVertexArrayObjects) {\r\n this._caps.vertexArrayObject = false;\r\n }\r\n else if (this._webGLVersion > 1) {\r\n this._caps.vertexArrayObject = true;\r\n }\r\n else {\r\n var vertexArrayObjectExtension = this._gl.getExtension('OES_vertex_array_object');\r\n if (vertexArrayObjectExtension != null) {\r\n this._caps.vertexArrayObject = true;\r\n this._gl.createVertexArray = vertexArrayObjectExtension.createVertexArrayOES.bind(vertexArrayObjectExtension);\r\n this._gl.bindVertexArray = vertexArrayObjectExtension.bindVertexArrayOES.bind(vertexArrayObjectExtension);\r\n this._gl.deleteVertexArray = vertexArrayObjectExtension.deleteVertexArrayOES.bind(vertexArrayObjectExtension);\r\n }\r\n }\r\n // Instances count\r\n if (this._webGLVersion > 1) {\r\n this._caps.instancedArrays = true;\r\n }\r\n else {\r\n var instanceExtension = this._gl.getExtension('ANGLE_instanced_arrays');\r\n if (instanceExtension != null) {\r\n this._caps.instancedArrays = true;\r\n this._gl.drawArraysInstanced = instanceExtension.drawArraysInstancedANGLE.bind(instanceExtension);\r\n this._gl.drawElementsInstanced = instanceExtension.drawElementsInstancedANGLE.bind(instanceExtension);\r\n this._gl.vertexAttribDivisor = instanceExtension.vertexAttribDivisorANGLE.bind(instanceExtension);\r\n }\r\n else {\r\n this._caps.instancedArrays = false;\r\n }\r\n }\r\n if (this._gl.getShaderPrecisionFormat) {\r\n var vertex_highp = this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER, this._gl.HIGH_FLOAT);\r\n var fragment_highp = this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER, this._gl.HIGH_FLOAT);\r\n if (vertex_highp && fragment_highp) {\r\n this._caps.highPrecisionShaderSupported = vertex_highp.precision !== 0 && fragment_highp.precision !== 0;\r\n }\r\n }\r\n if (this._webGLVersion > 1) {\r\n this._caps.blendMinMax = true;\r\n }\r\n else {\r\n var blendMinMaxExtension = this._gl.getExtension('EXT_blend_minmax');\r\n if (blendMinMaxExtension != null) {\r\n this._caps.blendMinMax = true;\r\n this._gl.MAX = blendMinMaxExtension.MAX_EXT;\r\n this._gl.MIN = blendMinMaxExtension.MIN_EXT;\r\n }\r\n }\r\n // Depth buffer\r\n this._depthCullingState.depthTest = true;\r\n this._depthCullingState.depthFunc = this._gl.LEQUAL;\r\n this._depthCullingState.depthMask = true;\r\n // Texture maps\r\n this._maxSimultaneousTextures = this._caps.maxCombinedTexturesImageUnits;\r\n for (var slot = 0; slot < this._maxSimultaneousTextures; slot++) {\r\n this._nextFreeTextureSlots.push(slot);\r\n }\r\n };\r\n Object.defineProperty(ThinEngine.prototype, \"webGLVersion\", {\r\n /**\r\n * Gets version of the current webGL context\r\n */\r\n get: function () {\r\n return this._webGLVersion;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"Engine\" string\r\n */\r\n ThinEngine.prototype.getClassName = function () {\r\n return \"ThinEngine\";\r\n };\r\n Object.defineProperty(ThinEngine.prototype, \"isStencilEnable\", {\r\n /**\r\n * Returns true if the stencil buffer has been enabled through the creation option of the context.\r\n */\r\n get: function () {\r\n return this._isStencilEnable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n ThinEngine.prototype._prepareWorkingCanvas = function () {\r\n if (this._workingCanvas) {\r\n return;\r\n }\r\n this._workingCanvas = CanvasGenerator.CreateCanvas(1, 1);\r\n var context = this._workingCanvas.getContext(\"2d\");\r\n if (context) {\r\n this._workingContext = context;\r\n }\r\n };\r\n /**\r\n * Reset the texture cache to empty state\r\n */\r\n ThinEngine.prototype.resetTextureCache = function () {\r\n for (var key in this._boundTexturesCache) {\r\n if (!this._boundTexturesCache.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n this._boundTexturesCache[key] = null;\r\n }\r\n this._currentTextureChannel = -1;\r\n };\r\n /**\r\n * Gets an object containing information about the current webGL context\r\n * @returns an object containing the vender, the renderer and the version of the current webGL context\r\n */\r\n ThinEngine.prototype.getGlInfo = function () {\r\n return {\r\n vendor: this._glVendor,\r\n renderer: this._glRenderer,\r\n version: this._glVersion\r\n };\r\n };\r\n /**\r\n * Defines the hardware scaling level.\r\n * By default the hardware scaling level is computed from the window device ratio.\r\n * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.\r\n * @param level defines the level to use\r\n */\r\n ThinEngine.prototype.setHardwareScalingLevel = function (level) {\r\n this._hardwareScalingLevel = level;\r\n this.resize();\r\n };\r\n /**\r\n * Gets the current hardware scaling level.\r\n * By default the hardware scaling level is computed from the window device ratio.\r\n * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.\r\n * @returns a number indicating the current hardware scaling level\r\n */\r\n ThinEngine.prototype.getHardwareScalingLevel = function () {\r\n return this._hardwareScalingLevel;\r\n };\r\n /**\r\n * Gets the list of loaded textures\r\n * @returns an array containing all loaded textures\r\n */\r\n ThinEngine.prototype.getLoadedTexturesCache = function () {\r\n return this._internalTexturesCache;\r\n };\r\n /**\r\n * Gets the object containing all engine capabilities\r\n * @returns the EngineCapabilities object\r\n */\r\n ThinEngine.prototype.getCaps = function () {\r\n return this._caps;\r\n };\r\n /**\r\n * stop executing a render loop function and remove it from the execution array\r\n * @param renderFunction defines the function to be removed. If not provided all functions will be removed.\r\n */\r\n ThinEngine.prototype.stopRenderLoop = function (renderFunction) {\r\n if (!renderFunction) {\r\n this._activeRenderLoops = [];\r\n return;\r\n }\r\n var index = this._activeRenderLoops.indexOf(renderFunction);\r\n if (index >= 0) {\r\n this._activeRenderLoops.splice(index, 1);\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._renderLoop = function () {\r\n if (!this._contextWasLost) {\r\n var shouldRender = true;\r\n if (!this.renderEvenInBackground && this._windowIsBackground) {\r\n shouldRender = false;\r\n }\r\n if (shouldRender) {\r\n // Start new frame\r\n this.beginFrame();\r\n for (var index = 0; index < this._activeRenderLoops.length; index++) {\r\n var renderFunction = this._activeRenderLoops[index];\r\n renderFunction();\r\n }\r\n // Present\r\n this.endFrame();\r\n }\r\n }\r\n if (this._activeRenderLoops.length > 0) {\r\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\r\n }\r\n else {\r\n this._renderingQueueLaunched = false;\r\n }\r\n };\r\n /**\r\n * Gets the HTML canvas attached with the current webGL context\r\n * @returns a HTML canvas\r\n */\r\n ThinEngine.prototype.getRenderingCanvas = function () {\r\n return this._renderingCanvas;\r\n };\r\n /**\r\n * Gets host window\r\n * @returns the host window object\r\n */\r\n ThinEngine.prototype.getHostWindow = function () {\r\n if (!DomManagement.IsWindowObjectExist()) {\r\n return null;\r\n }\r\n if (this._renderingCanvas && this._renderingCanvas.ownerDocument && this._renderingCanvas.ownerDocument.defaultView) {\r\n return this._renderingCanvas.ownerDocument.defaultView;\r\n }\r\n return window;\r\n };\r\n /**\r\n * Gets the current render width\r\n * @param useScreen defines if screen size must be used (or the current render target if any)\r\n * @returns a number defining the current render width\r\n */\r\n ThinEngine.prototype.getRenderWidth = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.width;\r\n }\r\n return this._framebufferDimensionsObject ? this._framebufferDimensionsObject.framebufferWidth : this._gl.drawingBufferWidth;\r\n };\r\n /**\r\n * Gets the current render height\r\n * @param useScreen defines if screen size must be used (or the current render target if any)\r\n * @returns a number defining the current render height\r\n */\r\n ThinEngine.prototype.getRenderHeight = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.height;\r\n }\r\n return this._framebufferDimensionsObject ? this._framebufferDimensionsObject.framebufferHeight : this._gl.drawingBufferHeight;\r\n };\r\n /**\r\n * Can be used to override the current requestAnimationFrame requester.\r\n * @hidden\r\n */\r\n ThinEngine.prototype._queueNewFrame = function (bindedRenderFunction, requester) {\r\n return ThinEngine.QueueNewFrame(bindedRenderFunction, requester);\r\n };\r\n /**\r\n * Register and execute a render loop. The engine can have more than one render function\r\n * @param renderFunction defines the function to continuously execute\r\n */\r\n ThinEngine.prototype.runRenderLoop = function (renderFunction) {\r\n if (this._activeRenderLoops.indexOf(renderFunction) !== -1) {\r\n return;\r\n }\r\n this._activeRenderLoops.push(renderFunction);\r\n if (!this._renderingQueueLaunched) {\r\n this._renderingQueueLaunched = true;\r\n this._boundRenderFunction = this._renderLoop.bind(this);\r\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\r\n }\r\n };\r\n /**\r\n * Clear the current render buffer or the current render target (if any is set up)\r\n * @param color defines the color to use\r\n * @param backBuffer defines if the back buffer must be cleared\r\n * @param depth defines if the depth buffer must be cleared\r\n * @param stencil defines if the stencil buffer must be cleared\r\n */\r\n ThinEngine.prototype.clear = function (color, backBuffer, depth, stencil) {\r\n if (stencil === void 0) { stencil = false; }\r\n this.applyStates();\r\n var mode = 0;\r\n if (backBuffer && color) {\r\n this._gl.clearColor(color.r, color.g, color.b, color.a !== undefined ? color.a : 1.0);\r\n mode |= this._gl.COLOR_BUFFER_BIT;\r\n }\r\n if (depth) {\r\n if (this.useReverseDepthBuffer) {\r\n this._depthCullingState.depthFunc = this._gl.GREATER;\r\n this._gl.clearDepth(0.0);\r\n }\r\n else {\r\n this._gl.clearDepth(1.0);\r\n }\r\n mode |= this._gl.DEPTH_BUFFER_BIT;\r\n }\r\n if (stencil) {\r\n this._gl.clearStencil(0);\r\n mode |= this._gl.STENCIL_BUFFER_BIT;\r\n }\r\n this._gl.clear(mode);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._viewport = function (x, y, width, height) {\r\n if (x !== this._viewportCached.x ||\r\n y !== this._viewportCached.y ||\r\n width !== this._viewportCached.z ||\r\n height !== this._viewportCached.w) {\r\n this._viewportCached.x = x;\r\n this._viewportCached.y = y;\r\n this._viewportCached.z = width;\r\n this._viewportCached.w = height;\r\n this._gl.viewport(x, y, width, height);\r\n }\r\n };\r\n /**\r\n * Set the WebGL's viewport\r\n * @param viewport defines the viewport element to be used\r\n * @param requiredWidth defines the width required for rendering. If not provided the rendering canvas' width is used\r\n * @param requiredHeight defines the height required for rendering. If not provided the rendering canvas' height is used\r\n */\r\n ThinEngine.prototype.setViewport = function (viewport, requiredWidth, requiredHeight) {\r\n var width = requiredWidth || this.getRenderWidth();\r\n var height = requiredHeight || this.getRenderHeight();\r\n var x = viewport.x || 0;\r\n var y = viewport.y || 0;\r\n this._cachedViewport = viewport;\r\n this._viewport(x * width, y * height, width * viewport.width, height * viewport.height);\r\n };\r\n /**\r\n * Begin a new frame\r\n */\r\n ThinEngine.prototype.beginFrame = function () {\r\n };\r\n /**\r\n * Enf the current frame\r\n */\r\n ThinEngine.prototype.endFrame = function () {\r\n // Force a flush in case we are using a bad OS.\r\n if (this._badOS) {\r\n this.flushFramebuffer();\r\n }\r\n };\r\n /**\r\n * Resize the view according to the canvas' size\r\n */\r\n ThinEngine.prototype.resize = function () {\r\n var width;\r\n var height;\r\n if (DomManagement.IsWindowObjectExist()) {\r\n width = this._renderingCanvas ? (this._renderingCanvas.clientWidth || this._renderingCanvas.width) : window.innerWidth;\r\n height = this._renderingCanvas ? (this._renderingCanvas.clientHeight || this._renderingCanvas.height) : window.innerHeight;\r\n }\r\n else {\r\n width = this._renderingCanvas ? this._renderingCanvas.width : 100;\r\n height = this._renderingCanvas ? this._renderingCanvas.height : 100;\r\n }\r\n this.setSize(width / this._hardwareScalingLevel, height / this._hardwareScalingLevel);\r\n };\r\n /**\r\n * Force a specific size of the canvas\r\n * @param width defines the new canvas' width\r\n * @param height defines the new canvas' height\r\n * @returns true if the size was changed\r\n */\r\n ThinEngine.prototype.setSize = function (width, height) {\r\n if (!this._renderingCanvas) {\r\n return false;\r\n }\r\n width = width | 0;\r\n height = height | 0;\r\n if (this._renderingCanvas.width === width && this._renderingCanvas.height === height) {\r\n return false;\r\n }\r\n this._renderingCanvas.width = width;\r\n this._renderingCanvas.height = height;\r\n return true;\r\n };\r\n /**\r\n * Binds the frame buffer to the specified texture.\r\n * @param texture The texture to render to or null for the default canvas\r\n * @param faceIndex The face of the texture to render to in case of cube texture\r\n * @param requiredWidth The width of the target to render to\r\n * @param requiredHeight The height of the target to render to\r\n * @param forceFullscreenViewport Forces the viewport to be the entire texture/screen if true\r\n * @param lodLevel defines the lod level to bind to the frame buffer\r\n * @param layer defines the 2d array index to bind to frame buffer to\r\n */\r\n ThinEngine.prototype.bindFramebuffer = function (texture, faceIndex, requiredWidth, requiredHeight, forceFullscreenViewport, lodLevel, layer) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lodLevel === void 0) { lodLevel = 0; }\r\n if (layer === void 0) { layer = 0; }\r\n if (this._currentRenderTarget) {\r\n this.unBindFramebuffer(this._currentRenderTarget);\r\n }\r\n this._currentRenderTarget = texture;\r\n this._bindUnboundFramebuffer(texture._MSAAFramebuffer ? texture._MSAAFramebuffer : texture._framebuffer);\r\n var gl = this._gl;\r\n if (texture.is2DArray) {\r\n gl.framebufferTextureLayer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, texture._webGLTexture, lodLevel, layer);\r\n }\r\n else if (texture.isCube) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._webGLTexture, lodLevel);\r\n }\r\n var depthStencilTexture = texture._depthStencilTexture;\r\n if (depthStencilTexture) {\r\n var attachment = (depthStencilTexture._generateStencilBuffer) ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;\r\n if (texture.is2DArray) {\r\n gl.framebufferTextureLayer(gl.FRAMEBUFFER, attachment, depthStencilTexture._webGLTexture, lodLevel, layer);\r\n }\r\n else if (texture.isCube) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, depthStencilTexture._webGLTexture, lodLevel);\r\n }\r\n else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, depthStencilTexture._webGLTexture, lodLevel);\r\n }\r\n }\r\n if (this._cachedViewport && !forceFullscreenViewport) {\r\n this.setViewport(this._cachedViewport, requiredWidth, requiredHeight);\r\n }\r\n else {\r\n if (!requiredWidth) {\r\n requiredWidth = texture.width;\r\n if (lodLevel) {\r\n requiredWidth = requiredWidth / Math.pow(2, lodLevel);\r\n }\r\n }\r\n if (!requiredHeight) {\r\n requiredHeight = texture.height;\r\n if (lodLevel) {\r\n requiredHeight = requiredHeight / Math.pow(2, lodLevel);\r\n }\r\n }\r\n this._viewport(0, 0, requiredWidth, requiredHeight);\r\n }\r\n this.wipeCaches();\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._bindUnboundFramebuffer = function (framebuffer) {\r\n if (this._currentFramebuffer !== framebuffer) {\r\n this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer);\r\n this._currentFramebuffer = framebuffer;\r\n }\r\n };\r\n /**\r\n * Unbind the current render target texture from the webGL context\r\n * @param texture defines the render target texture to unbind\r\n * @param disableGenerateMipMaps defines a boolean indicating that mipmaps must not be generated\r\n * @param onBeforeUnbind defines a function which will be called before the effective unbind\r\n */\r\n ThinEngine.prototype.unBindFramebuffer = function (texture, disableGenerateMipMaps, onBeforeUnbind) {\r\n if (disableGenerateMipMaps === void 0) { disableGenerateMipMaps = false; }\r\n this._currentRenderTarget = null;\r\n // If MSAA, we need to bitblt back to main texture\r\n var gl = this._gl;\r\n if (texture._MSAAFramebuffer) {\r\n if (texture._textureArray) {\r\n // This texture is part of a MRT texture, we need to treat all attachments\r\n this.unBindMultiColorAttachmentFramebuffer(texture._textureArray, disableGenerateMipMaps, onBeforeUnbind);\r\n return;\r\n }\r\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, texture._MSAAFramebuffer);\r\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, texture._framebuffer);\r\n gl.blitFramebuffer(0, 0, texture.width, texture.height, 0, 0, texture.width, texture.height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\r\n }\r\n if (texture.generateMipMaps && !disableGenerateMipMaps && !texture.isCube) {\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n }\r\n if (onBeforeUnbind) {\r\n if (texture._MSAAFramebuffer) {\r\n // Bind the correct framebuffer\r\n this._bindUnboundFramebuffer(texture._framebuffer);\r\n }\r\n onBeforeUnbind();\r\n }\r\n this._bindUnboundFramebuffer(null);\r\n };\r\n /**\r\n * Force a webGL flush (ie. a flush of all waiting webGL commands)\r\n */\r\n ThinEngine.prototype.flushFramebuffer = function () {\r\n this._gl.flush();\r\n };\r\n /**\r\n * Unbind the current render target and bind the default framebuffer\r\n */\r\n ThinEngine.prototype.restoreDefaultFramebuffer = function () {\r\n if (this._currentRenderTarget) {\r\n this.unBindFramebuffer(this._currentRenderTarget);\r\n }\r\n else {\r\n this._bindUnboundFramebuffer(null);\r\n }\r\n if (this._cachedViewport) {\r\n this.setViewport(this._cachedViewport);\r\n }\r\n this.wipeCaches();\r\n };\r\n // VBOs\r\n /** @hidden */\r\n ThinEngine.prototype._resetVertexBufferBinding = function () {\r\n this.bindArrayBuffer(null);\r\n this._cachedVertexBuffers = null;\r\n };\r\n /**\r\n * Creates a vertex buffer\r\n * @param data the data for the vertex buffer\r\n * @returns the new WebGL static buffer\r\n */\r\n ThinEngine.prototype.createVertexBuffer = function (data) {\r\n return this._createVertexBuffer(data, this._gl.STATIC_DRAW);\r\n };\r\n ThinEngine.prototype._createVertexBuffer = function (data, usage) {\r\n var vbo = this._gl.createBuffer();\r\n if (!vbo) {\r\n throw new Error(\"Unable to create vertex buffer\");\r\n }\r\n var dataBuffer = new WebGLDataBuffer(vbo);\r\n this.bindArrayBuffer(dataBuffer);\r\n if (data instanceof Array) {\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(data), this._gl.STATIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, data, this._gl.STATIC_DRAW);\r\n }\r\n this._resetVertexBufferBinding();\r\n dataBuffer.references = 1;\r\n return dataBuffer;\r\n };\r\n /**\r\n * Creates a dynamic vertex buffer\r\n * @param data the data for the dynamic vertex buffer\r\n * @returns the new WebGL dynamic buffer\r\n */\r\n ThinEngine.prototype.createDynamicVertexBuffer = function (data) {\r\n return this._createVertexBuffer(data, this._gl.DYNAMIC_DRAW);\r\n };\r\n ThinEngine.prototype._resetIndexBufferBinding = function () {\r\n this.bindIndexBuffer(null);\r\n this._cachedIndexBuffer = null;\r\n };\r\n /**\r\n * Creates a new index buffer\r\n * @param indices defines the content of the index buffer\r\n * @param updatable defines if the index buffer must be updatable\r\n * @returns a new webGL buffer\r\n */\r\n ThinEngine.prototype.createIndexBuffer = function (indices, updatable) {\r\n var vbo = this._gl.createBuffer();\r\n var dataBuffer = new WebGLDataBuffer(vbo);\r\n if (!vbo) {\r\n throw new Error(\"Unable to create index buffer\");\r\n }\r\n this.bindIndexBuffer(dataBuffer);\r\n var data = this._normalizeIndexData(indices);\r\n this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, data, updatable ? this._gl.DYNAMIC_DRAW : this._gl.STATIC_DRAW);\r\n this._resetIndexBufferBinding();\r\n dataBuffer.references = 1;\r\n dataBuffer.is32Bits = (data.BYTES_PER_ELEMENT === 4);\r\n return dataBuffer;\r\n };\r\n ThinEngine.prototype._normalizeIndexData = function (indices) {\r\n if (indices instanceof Uint16Array) {\r\n return indices;\r\n }\r\n // Check 32 bit support\r\n if (this._caps.uintIndices) {\r\n if (indices instanceof Uint32Array) {\r\n return indices;\r\n }\r\n else {\r\n // number[] or Int32Array, check if 32 bit is necessary\r\n for (var index = 0; index < indices.length; index++) {\r\n if (indices[index] >= 65535) {\r\n return new Uint32Array(indices);\r\n }\r\n }\r\n return new Uint16Array(indices);\r\n }\r\n }\r\n // No 32 bit support, force conversion to 16 bit (values greater 16 bit are lost)\r\n return new Uint16Array(indices);\r\n };\r\n /**\r\n * Bind a webGL buffer to the webGL context\r\n * @param buffer defines the buffer to bind\r\n */\r\n ThinEngine.prototype.bindArrayBuffer = function (buffer) {\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.bindBuffer(buffer, this._gl.ARRAY_BUFFER);\r\n };\r\n /**\r\n * Bind a specific block at a given index in a specific shader program\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param blockName defines the block name\r\n * @param index defines the index where to bind the block\r\n */\r\n ThinEngine.prototype.bindUniformBlock = function (pipelineContext, blockName, index) {\r\n var program = pipelineContext.program;\r\n var uniformLocation = this._gl.getUniformBlockIndex(program, blockName);\r\n this._gl.uniformBlockBinding(program, uniformLocation, index);\r\n };\r\n ThinEngine.prototype.bindIndexBuffer = function (buffer) {\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.bindBuffer(buffer, this._gl.ELEMENT_ARRAY_BUFFER);\r\n };\r\n ThinEngine.prototype.bindBuffer = function (buffer, target) {\r\n if (this._vaoRecordInProgress || this._currentBoundBuffer[target] !== buffer) {\r\n this._gl.bindBuffer(target, buffer ? buffer.underlyingResource : null);\r\n this._currentBoundBuffer[target] = buffer;\r\n }\r\n };\r\n /**\r\n * update the bound buffer with the given data\r\n * @param data defines the data to update\r\n */\r\n ThinEngine.prototype.updateArrayBuffer = function (data) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\r\n };\r\n ThinEngine.prototype._vertexAttribPointer = function (buffer, indx, size, type, normalized, stride, offset) {\r\n var pointer = this._currentBufferPointers[indx];\r\n if (!pointer) {\r\n return;\r\n }\r\n var changed = false;\r\n if (!pointer.active) {\r\n changed = true;\r\n pointer.active = true;\r\n pointer.index = indx;\r\n pointer.size = size;\r\n pointer.type = type;\r\n pointer.normalized = normalized;\r\n pointer.stride = stride;\r\n pointer.offset = offset;\r\n pointer.buffer = buffer;\r\n }\r\n else {\r\n if (pointer.buffer !== buffer) {\r\n pointer.buffer = buffer;\r\n changed = true;\r\n }\r\n if (pointer.size !== size) {\r\n pointer.size = size;\r\n changed = true;\r\n }\r\n if (pointer.type !== type) {\r\n pointer.type = type;\r\n changed = true;\r\n }\r\n if (pointer.normalized !== normalized) {\r\n pointer.normalized = normalized;\r\n changed = true;\r\n }\r\n if (pointer.stride !== stride) {\r\n pointer.stride = stride;\r\n changed = true;\r\n }\r\n if (pointer.offset !== offset) {\r\n pointer.offset = offset;\r\n changed = true;\r\n }\r\n }\r\n if (changed || this._vaoRecordInProgress) {\r\n this.bindArrayBuffer(buffer);\r\n this._gl.vertexAttribPointer(indx, size, type, normalized, stride, offset);\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._bindIndexBufferWithCache = function (indexBuffer) {\r\n if (indexBuffer == null) {\r\n return;\r\n }\r\n if (this._cachedIndexBuffer !== indexBuffer) {\r\n this._cachedIndexBuffer = indexBuffer;\r\n this.bindIndexBuffer(indexBuffer);\r\n this._uintIndicesCurrentlySet = indexBuffer.is32Bits;\r\n }\r\n };\r\n ThinEngine.prototype._bindVertexBuffersAttributes = function (vertexBuffers, effect) {\r\n var attributes = effect.getAttributesNames();\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.unbindAllAttributes();\r\n for (var index = 0; index < attributes.length; index++) {\r\n var order = effect.getAttributeLocation(index);\r\n if (order >= 0) {\r\n var vertexBuffer = vertexBuffers[attributes[index]];\r\n if (!vertexBuffer) {\r\n continue;\r\n }\r\n this._gl.enableVertexAttribArray(order);\r\n if (!this._vaoRecordInProgress) {\r\n this._vertexAttribArraysEnabled[order] = true;\r\n }\r\n var buffer = vertexBuffer.getBuffer();\r\n if (buffer) {\r\n this._vertexAttribPointer(buffer, order, vertexBuffer.getSize(), vertexBuffer.type, vertexBuffer.normalized, vertexBuffer.byteStride, vertexBuffer.byteOffset);\r\n if (vertexBuffer.getIsInstanced()) {\r\n this._gl.vertexAttribDivisor(order, vertexBuffer.getInstanceDivisor());\r\n if (!this._vaoRecordInProgress) {\r\n this._currentInstanceLocations.push(order);\r\n this._currentInstanceBuffers.push(buffer);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Records a vertex array object\r\n * @see https://doc.babylonjs.com/features/webgl2#vertex-array-objects\r\n * @param vertexBuffers defines the list of vertex buffers to store\r\n * @param indexBuffer defines the index buffer to store\r\n * @param effect defines the effect to store\r\n * @returns the new vertex array object\r\n */\r\n ThinEngine.prototype.recordVertexArrayObject = function (vertexBuffers, indexBuffer, effect) {\r\n var vao = this._gl.createVertexArray();\r\n this._vaoRecordInProgress = true;\r\n this._gl.bindVertexArray(vao);\r\n this._mustWipeVertexAttributes = true;\r\n this._bindVertexBuffersAttributes(vertexBuffers, effect);\r\n this.bindIndexBuffer(indexBuffer);\r\n this._vaoRecordInProgress = false;\r\n this._gl.bindVertexArray(null);\r\n return vao;\r\n };\r\n /**\r\n * Bind a specific vertex array object\r\n * @see https://doc.babylonjs.com/features/webgl2#vertex-array-objects\r\n * @param vertexArrayObject defines the vertex array object to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n */\r\n ThinEngine.prototype.bindVertexArrayObject = function (vertexArrayObject, indexBuffer) {\r\n if (this._cachedVertexArrayObject !== vertexArrayObject) {\r\n this._cachedVertexArrayObject = vertexArrayObject;\r\n this._gl.bindVertexArray(vertexArrayObject);\r\n this._cachedVertexBuffers = null;\r\n this._cachedIndexBuffer = null;\r\n this._uintIndicesCurrentlySet = indexBuffer != null && indexBuffer.is32Bits;\r\n this._mustWipeVertexAttributes = true;\r\n }\r\n };\r\n /**\r\n * Bind webGl buffers directly to the webGL context\r\n * @param vertexBuffer defines the vertex buffer to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n * @param vertexDeclaration defines the vertex declaration to use with the vertex buffer\r\n * @param vertexStrideSize defines the vertex stride of the vertex buffer\r\n * @param effect defines the effect associated with the vertex buffer\r\n */\r\n ThinEngine.prototype.bindBuffersDirectly = function (vertexBuffer, indexBuffer, vertexDeclaration, vertexStrideSize, effect) {\r\n if (this._cachedVertexBuffers !== vertexBuffer || this._cachedEffectForVertexBuffers !== effect) {\r\n this._cachedVertexBuffers = vertexBuffer;\r\n this._cachedEffectForVertexBuffers = effect;\r\n var attributesCount = effect.getAttributesCount();\r\n this._unbindVertexArrayObject();\r\n this.unbindAllAttributes();\r\n var offset = 0;\r\n for (var index = 0; index < attributesCount; index++) {\r\n if (index < vertexDeclaration.length) {\r\n var order = effect.getAttributeLocation(index);\r\n if (order >= 0) {\r\n this._gl.enableVertexAttribArray(order);\r\n this._vertexAttribArraysEnabled[order] = true;\r\n this._vertexAttribPointer(vertexBuffer, order, vertexDeclaration[index], this._gl.FLOAT, false, vertexStrideSize, offset);\r\n }\r\n offset += vertexDeclaration[index] * 4;\r\n }\r\n }\r\n }\r\n this._bindIndexBufferWithCache(indexBuffer);\r\n };\r\n ThinEngine.prototype._unbindVertexArrayObject = function () {\r\n if (!this._cachedVertexArrayObject) {\r\n return;\r\n }\r\n this._cachedVertexArrayObject = null;\r\n this._gl.bindVertexArray(null);\r\n };\r\n /**\r\n * Bind a list of vertex buffers to the webGL context\r\n * @param vertexBuffers defines the list of vertex buffers to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n * @param effect defines the effect associated with the vertex buffers\r\n */\r\n ThinEngine.prototype.bindBuffers = function (vertexBuffers, indexBuffer, effect) {\r\n if (this._cachedVertexBuffers !== vertexBuffers || this._cachedEffectForVertexBuffers !== effect) {\r\n this._cachedVertexBuffers = vertexBuffers;\r\n this._cachedEffectForVertexBuffers = effect;\r\n this._bindVertexBuffersAttributes(vertexBuffers, effect);\r\n }\r\n this._bindIndexBufferWithCache(indexBuffer);\r\n };\r\n /**\r\n * Unbind all instance attributes\r\n */\r\n ThinEngine.prototype.unbindInstanceAttributes = function () {\r\n var boundBuffer;\r\n for (var i = 0, ul = this._currentInstanceLocations.length; i < ul; i++) {\r\n var instancesBuffer = this._currentInstanceBuffers[i];\r\n if (boundBuffer != instancesBuffer && instancesBuffer.references) {\r\n boundBuffer = instancesBuffer;\r\n this.bindArrayBuffer(instancesBuffer);\r\n }\r\n var offsetLocation = this._currentInstanceLocations[i];\r\n this._gl.vertexAttribDivisor(offsetLocation, 0);\r\n }\r\n this._currentInstanceBuffers.length = 0;\r\n this._currentInstanceLocations.length = 0;\r\n };\r\n /**\r\n * Release and free the memory of a vertex array object\r\n * @param vao defines the vertex array object to delete\r\n */\r\n ThinEngine.prototype.releaseVertexArrayObject = function (vao) {\r\n this._gl.deleteVertexArray(vao);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._releaseBuffer = function (buffer) {\r\n buffer.references--;\r\n if (buffer.references === 0) {\r\n this._deleteBuffer(buffer);\r\n return true;\r\n }\r\n return false;\r\n };\r\n ThinEngine.prototype._deleteBuffer = function (buffer) {\r\n this._gl.deleteBuffer(buffer.underlyingResource);\r\n };\r\n /**\r\n * Update the content of a webGL buffer used with instanciation and bind it to the webGL context\r\n * @param instancesBuffer defines the webGL buffer to update and bind\r\n * @param data defines the data to store in the buffer\r\n * @param offsetLocations defines the offsets or attributes information used to determine where data must be stored in the buffer\r\n */\r\n ThinEngine.prototype.updateAndBindInstancesBuffer = function (instancesBuffer, data, offsetLocations) {\r\n this.bindArrayBuffer(instancesBuffer);\r\n if (data) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\r\n }\r\n if (offsetLocations[0].index !== undefined) {\r\n this.bindInstancesBuffer(instancesBuffer, offsetLocations, true);\r\n }\r\n else {\r\n for (var index = 0; index < 4; index++) {\r\n var offsetLocation = offsetLocations[index];\r\n if (!this._vertexAttribArraysEnabled[offsetLocation]) {\r\n this._gl.enableVertexAttribArray(offsetLocation);\r\n this._vertexAttribArraysEnabled[offsetLocation] = true;\r\n }\r\n this._vertexAttribPointer(instancesBuffer, offsetLocation, 4, this._gl.FLOAT, false, 64, index * 16);\r\n this._gl.vertexAttribDivisor(offsetLocation, 1);\r\n this._currentInstanceLocations.push(offsetLocation);\r\n this._currentInstanceBuffers.push(instancesBuffer);\r\n }\r\n }\r\n };\r\n /**\r\n * Bind the content of a webGL buffer used with instantiation\r\n * @param instancesBuffer defines the webGL buffer to bind\r\n * @param attributesInfo defines the offsets or attributes information used to determine where data must be stored in the buffer\r\n * @param computeStride defines Whether to compute the strides from the info or use the default 0\r\n */\r\n ThinEngine.prototype.bindInstancesBuffer = function (instancesBuffer, attributesInfo, computeStride) {\r\n if (computeStride === void 0) { computeStride = true; }\r\n this.bindArrayBuffer(instancesBuffer);\r\n var stride = 0;\r\n if (computeStride) {\r\n for (var i = 0; i < attributesInfo.length; i++) {\r\n var ai = attributesInfo[i];\r\n stride += ai.attributeSize * 4;\r\n }\r\n }\r\n for (var i = 0; i < attributesInfo.length; i++) {\r\n var ai = attributesInfo[i];\r\n if (ai.index === undefined) {\r\n ai.index = this._currentEffect.getAttributeLocationByName(ai.attributeName);\r\n }\r\n if (ai.index < 0) {\r\n continue;\r\n }\r\n if (!this._vertexAttribArraysEnabled[ai.index]) {\r\n this._gl.enableVertexAttribArray(ai.index);\r\n this._vertexAttribArraysEnabled[ai.index] = true;\r\n }\r\n this._vertexAttribPointer(instancesBuffer, ai.index, ai.attributeSize, ai.attributeType || this._gl.FLOAT, ai.normalized || false, stride, ai.offset);\r\n this._gl.vertexAttribDivisor(ai.index, ai.divisor === undefined ? 1 : ai.divisor);\r\n this._currentInstanceLocations.push(ai.index);\r\n this._currentInstanceBuffers.push(instancesBuffer);\r\n }\r\n };\r\n /**\r\n * Disable the instance attribute corresponding to the name in parameter\r\n * @param name defines the name of the attribute to disable\r\n */\r\n ThinEngine.prototype.disableInstanceAttributeByName = function (name) {\r\n if (!this._currentEffect) {\r\n return;\r\n }\r\n var attributeLocation = this._currentEffect.getAttributeLocationByName(name);\r\n this.disableInstanceAttribute(attributeLocation);\r\n };\r\n /**\r\n * Disable the instance attribute corresponding to the location in parameter\r\n * @param attributeLocation defines the attribute location of the attribute to disable\r\n */\r\n ThinEngine.prototype.disableInstanceAttribute = function (attributeLocation) {\r\n var shouldClean = false;\r\n var index;\r\n while ((index = this._currentInstanceLocations.indexOf(attributeLocation)) !== -1) {\r\n this._currentInstanceLocations.splice(index, 1);\r\n this._currentInstanceBuffers.splice(index, 1);\r\n shouldClean = true;\r\n index = this._currentInstanceLocations.indexOf(attributeLocation);\r\n }\r\n if (shouldClean) {\r\n this._gl.vertexAttribDivisor(attributeLocation, 0);\r\n this.disableAttributeByIndex(attributeLocation);\r\n }\r\n };\r\n /**\r\n * Disable the attribute corresponding to the location in parameter\r\n * @param attributeLocation defines the attribute location of the attribute to disable\r\n */\r\n ThinEngine.prototype.disableAttributeByIndex = function (attributeLocation) {\r\n this._gl.disableVertexAttribArray(attributeLocation);\r\n this._vertexAttribArraysEnabled[attributeLocation] = false;\r\n this._currentBufferPointers[attributeLocation].active = false;\r\n };\r\n /**\r\n * Send a draw order\r\n * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)\r\n * @param indexStart defines the starting index\r\n * @param indexCount defines the number of index to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.draw = function (useTriangles, indexStart, indexCount, instancesCount) {\r\n this.drawElementsType(useTriangles ? 0 : 1, indexStart, indexCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of points\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.drawPointClouds = function (verticesStart, verticesCount, instancesCount) {\r\n this.drawArraysType(2, verticesStart, verticesCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of unindexed primitives\r\n * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.drawUnIndexed = function (useTriangles, verticesStart, verticesCount, instancesCount) {\r\n this.drawArraysType(useTriangles ? 0 : 1, verticesStart, verticesCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of indexed primitives\r\n * @param fillMode defines the primitive to use\r\n * @param indexStart defines the starting index\r\n * @param indexCount defines the number of index to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.drawElementsType = function (fillMode, indexStart, indexCount, instancesCount) {\r\n // Apply states\r\n this.applyStates();\r\n this._reportDrawCall();\r\n // Render\r\n var drawMode = this._drawMode(fillMode);\r\n var indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;\r\n var mult = this._uintIndicesCurrentlySet ? 4 : 2;\r\n if (instancesCount) {\r\n this._gl.drawElementsInstanced(drawMode, indexCount, indexFormat, indexStart * mult, instancesCount);\r\n }\r\n else {\r\n this._gl.drawElements(drawMode, indexCount, indexFormat, indexStart * mult);\r\n }\r\n };\r\n /**\r\n * Draw a list of unindexed primitives\r\n * @param fillMode defines the primitive to use\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.drawArraysType = function (fillMode, verticesStart, verticesCount, instancesCount) {\r\n // Apply states\r\n this.applyStates();\r\n this._reportDrawCall();\r\n var drawMode = this._drawMode(fillMode);\r\n if (instancesCount) {\r\n this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);\r\n }\r\n else {\r\n this._gl.drawArrays(drawMode, verticesStart, verticesCount);\r\n }\r\n };\r\n ThinEngine.prototype._drawMode = function (fillMode) {\r\n switch (fillMode) {\r\n // Triangle views\r\n case 0:\r\n return this._gl.TRIANGLES;\r\n case 2:\r\n return this._gl.POINTS;\r\n case 1:\r\n return this._gl.LINES;\r\n // Draw modes\r\n case 3:\r\n return this._gl.POINTS;\r\n case 4:\r\n return this._gl.LINES;\r\n case 5:\r\n return this._gl.LINE_LOOP;\r\n case 6:\r\n return this._gl.LINE_STRIP;\r\n case 7:\r\n return this._gl.TRIANGLE_STRIP;\r\n case 8:\r\n return this._gl.TRIANGLE_FAN;\r\n default:\r\n return this._gl.TRIANGLES;\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._reportDrawCall = function () {\r\n // Will be implemented by children\r\n };\r\n // Shaders\r\n /** @hidden */\r\n ThinEngine.prototype._releaseEffect = function (effect) {\r\n if (this._compiledEffects[effect._key]) {\r\n delete this._compiledEffects[effect._key];\r\n this._deletePipelineContext(effect.getPipelineContext());\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._deletePipelineContext = function (pipelineContext) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (webGLPipelineContext && webGLPipelineContext.program) {\r\n webGLPipelineContext.program.__SPECTOR_rebuildProgram = null;\r\n this._gl.deleteProgram(webGLPipelineContext.program);\r\n }\r\n };\r\n /**\r\n * Create a new effect (used to store vertex/fragment shaders)\r\n * @param baseName defines the base name of the effect (The name of file without .fragment.fx or .vertex.fx)\r\n * @param attributesNamesOrOptions defines either a list of attribute names or an IEffectCreationOptions object\r\n * @param uniformsNamesOrEngine defines either a list of uniform names or the engine to use\r\n * @param samplers defines an array of string used to represent textures\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param fallbacks defines the list of potential fallbacks to use if shader conmpilation fails\r\n * @param onCompiled defines a function to call when the effect creation is successful\r\n * @param onError defines a function to call when the effect creation has failed\r\n * @param indexParameters defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)\r\n * @returns the new Effect\r\n */\r\n ThinEngine.prototype.createEffect = function (baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, defines, fallbacks, onCompiled, onError, indexParameters) {\r\n var vertex = baseName.vertexElement || baseName.vertex || baseName.vertexToken || baseName.vertexSource || baseName;\r\n var fragment = baseName.fragmentElement || baseName.fragment || baseName.fragmentToken || baseName.fragmentSource || baseName;\r\n var name = vertex + \"+\" + fragment + \"@\" + (defines ? defines : attributesNamesOrOptions.defines);\r\n if (this._compiledEffects[name]) {\r\n var compiledEffect = this._compiledEffects[name];\r\n if (onCompiled && compiledEffect.isReady()) {\r\n onCompiled(compiledEffect);\r\n }\r\n return compiledEffect;\r\n }\r\n var effect = new Effect(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, this, defines, fallbacks, onCompiled, onError, indexParameters);\r\n effect._key = name;\r\n this._compiledEffects[name] = effect;\r\n return effect;\r\n };\r\n ThinEngine._ConcatenateShader = function (source, defines, shaderVersion) {\r\n if (shaderVersion === void 0) { shaderVersion = \"\"; }\r\n return shaderVersion + (defines ? defines + \"\\n\" : \"\") + source;\r\n };\r\n ThinEngine.prototype._compileShader = function (source, type, defines, shaderVersion) {\r\n return this._compileRawShader(ThinEngine._ConcatenateShader(source, defines, shaderVersion), type);\r\n };\r\n ThinEngine.prototype._compileRawShader = function (source, type) {\r\n var gl = this._gl;\r\n var shader = gl.createShader(type === \"vertex\" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);\r\n if (!shader) {\r\n throw new Error(\"Something went wrong while compile the shader.\");\r\n }\r\n gl.shaderSource(shader, source);\r\n gl.compileShader(shader);\r\n return shader;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getShaderSource = function (shader) {\r\n return this._gl.getShaderSource(shader);\r\n };\r\n /**\r\n * Directly creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @returns the new webGL program\r\n */\r\n ThinEngine.prototype.createRawShaderProgram = function (pipelineContext, vertexCode, fragmentCode, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n context = context || this._gl;\r\n var vertexShader = this._compileRawShader(vertexCode, \"vertex\");\r\n var fragmentShader = this._compileRawShader(fragmentCode, \"fragment\");\r\n return this._createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings);\r\n };\r\n /**\r\n * Creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @returns the new webGL program\r\n */\r\n ThinEngine.prototype.createShaderProgram = function (pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n context = context || this._gl;\r\n var shaderVersion = (this._webGLVersion > 1) ? \"#version 300 es\\n#define WEBGL2 \\n\" : \"\";\r\n var vertexShader = this._compileShader(vertexCode, \"vertex\", defines, shaderVersion);\r\n var fragmentShader = this._compileShader(fragmentCode, \"fragment\", defines, shaderVersion);\r\n return this._createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings);\r\n };\r\n /**\r\n * Creates a new pipeline context\r\n * @returns the new pipeline\r\n */\r\n ThinEngine.prototype.createPipelineContext = function () {\r\n var pipelineContext = new WebGLPipelineContext();\r\n pipelineContext.engine = this;\r\n if (this._caps.parallelShaderCompile) {\r\n pipelineContext.isParallelCompiled = true;\r\n }\r\n return pipelineContext;\r\n };\r\n ThinEngine.prototype._createShaderProgram = function (pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n var shaderProgram = context.createProgram();\r\n pipelineContext.program = shaderProgram;\r\n if (!shaderProgram) {\r\n throw new Error(\"Unable to create program\");\r\n }\r\n context.attachShader(shaderProgram, vertexShader);\r\n context.attachShader(shaderProgram, fragmentShader);\r\n context.linkProgram(shaderProgram);\r\n pipelineContext.context = context;\r\n pipelineContext.vertexShader = vertexShader;\r\n pipelineContext.fragmentShader = fragmentShader;\r\n if (!pipelineContext.isParallelCompiled) {\r\n this._finalizePipelineContext(pipelineContext);\r\n }\r\n return shaderProgram;\r\n };\r\n ThinEngine.prototype._finalizePipelineContext = function (pipelineContext) {\r\n var context = pipelineContext.context;\r\n var vertexShader = pipelineContext.vertexShader;\r\n var fragmentShader = pipelineContext.fragmentShader;\r\n var program = pipelineContext.program;\r\n var linked = context.getProgramParameter(program, context.LINK_STATUS);\r\n if (!linked) { // Get more info\r\n // Vertex\r\n if (!this._gl.getShaderParameter(vertexShader, this._gl.COMPILE_STATUS)) {\r\n var log = this._gl.getShaderInfoLog(vertexShader);\r\n if (log) {\r\n pipelineContext.vertexCompilationError = log;\r\n throw new Error(\"VERTEX SHADER \" + log);\r\n }\r\n }\r\n // Fragment\r\n if (!this._gl.getShaderParameter(fragmentShader, this._gl.COMPILE_STATUS)) {\r\n var log = this._gl.getShaderInfoLog(fragmentShader);\r\n if (log) {\r\n pipelineContext.fragmentCompilationError = log;\r\n throw new Error(\"FRAGMENT SHADER \" + log);\r\n }\r\n }\r\n var error = context.getProgramInfoLog(program);\r\n if (error) {\r\n pipelineContext.programLinkError = error;\r\n throw new Error(error);\r\n }\r\n }\r\n if (this.validateShaderPrograms) {\r\n context.validateProgram(program);\r\n var validated = context.getProgramParameter(program, context.VALIDATE_STATUS);\r\n if (!validated) {\r\n var error = context.getProgramInfoLog(program);\r\n if (error) {\r\n pipelineContext.programValidationError = error;\r\n throw new Error(error);\r\n }\r\n }\r\n }\r\n context.deleteShader(vertexShader);\r\n context.deleteShader(fragmentShader);\r\n pipelineContext.vertexShader = undefined;\r\n pipelineContext.fragmentShader = undefined;\r\n if (pipelineContext.onCompiled) {\r\n pipelineContext.onCompiled();\r\n pipelineContext.onCompiled = undefined;\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._preparePipelineContext = function (pipelineContext, vertexSourceCode, fragmentSourceCode, createAsRaw, rebuildRebind, defines, transformFeedbackVaryings) {\r\n var webGLRenderingState = pipelineContext;\r\n if (createAsRaw) {\r\n webGLRenderingState.program = this.createRawShaderProgram(webGLRenderingState, vertexSourceCode, fragmentSourceCode, undefined, transformFeedbackVaryings);\r\n }\r\n else {\r\n webGLRenderingState.program = this.createShaderProgram(webGLRenderingState, vertexSourceCode, fragmentSourceCode, defines, undefined, transformFeedbackVaryings);\r\n }\r\n webGLRenderingState.program.__SPECTOR_rebuildProgram = rebuildRebind;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._isRenderingStateCompiled = function (pipelineContext) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (this._gl.getProgramParameter(webGLPipelineContext.program, this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)) {\r\n this._finalizePipelineContext(webGLPipelineContext);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._executeWhenRenderingStateIsCompiled = function (pipelineContext, action) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (!webGLPipelineContext.isParallelCompiled) {\r\n action();\r\n return;\r\n }\r\n var oldHandler = webGLPipelineContext.onCompiled;\r\n if (oldHandler) {\r\n webGLPipelineContext.onCompiled = function () {\r\n oldHandler();\r\n action();\r\n };\r\n }\r\n else {\r\n webGLPipelineContext.onCompiled = action;\r\n }\r\n };\r\n /**\r\n * Gets the list of webGL uniform locations associated with a specific program based on a list of uniform names\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param uniformsNames defines the list of uniform names\r\n * @returns an array of webGL uniform locations\r\n */\r\n ThinEngine.prototype.getUniforms = function (pipelineContext, uniformsNames) {\r\n var results = new Array();\r\n var webGLPipelineContext = pipelineContext;\r\n for (var index = 0; index < uniformsNames.length; index++) {\r\n results.push(this._gl.getUniformLocation(webGLPipelineContext.program, uniformsNames[index]));\r\n }\r\n return results;\r\n };\r\n /**\r\n * Gets the lsit of active attributes for a given webGL program\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param attributesNames defines the list of attribute names to get\r\n * @returns an array of indices indicating the offset of each attribute\r\n */\r\n ThinEngine.prototype.getAttributes = function (pipelineContext, attributesNames) {\r\n var results = [];\r\n var webGLPipelineContext = pipelineContext;\r\n for (var index = 0; index < attributesNames.length; index++) {\r\n try {\r\n results.push(this._gl.getAttribLocation(webGLPipelineContext.program, attributesNames[index]));\r\n }\r\n catch (e) {\r\n results.push(-1);\r\n }\r\n }\r\n return results;\r\n };\r\n /**\r\n * Activates an effect, mkaing it the current one (ie. the one used for rendering)\r\n * @param effect defines the effect to activate\r\n */\r\n ThinEngine.prototype.enableEffect = function (effect) {\r\n if (!effect || effect === this._currentEffect) {\r\n return;\r\n }\r\n // Use program\r\n this.bindSamplers(effect);\r\n this._currentEffect = effect;\r\n if (effect.onBind) {\r\n effect.onBind(effect);\r\n }\r\n if (effect._onBindObservable) {\r\n effect._onBindObservable.notifyObservers(effect);\r\n }\r\n };\r\n /**\r\n * Set the value of an uniform to a number (int)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param value defines the int number to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setInt = function (uniform, value) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniform1i(uniform, value);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setIntArray = function (uniform, array) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniform1iv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setIntArray2 = function (uniform, array) {\r\n if (!uniform || array.length % 2 !== 0) {\r\n return false;\r\n }\r\n this._gl.uniform2iv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setIntArray3 = function (uniform, array) {\r\n if (!uniform || array.length % 3 !== 0) {\r\n return false;\r\n }\r\n this._gl.uniform3iv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec4)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setIntArray4 = function (uniform, array) {\r\n if (!uniform || array.length % 4 !== 0) {\r\n return false;\r\n }\r\n this._gl.uniform4iv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setArray = function (uniform, array) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniform1fv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setArray2 = function (uniform, array) {\r\n if (!uniform || array.length % 2 !== 0) {\r\n return false;\r\n }\r\n this._gl.uniform2fv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setArray3 = function (uniform, array) {\r\n if (!uniform || array.length % 3 !== 0) {\r\n return false;\r\n }\r\n this._gl.uniform3fv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec4)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setArray4 = function (uniform, array) {\r\n if (!uniform || array.length % 4 !== 0) {\r\n return false;\r\n }\r\n this._gl.uniform4fv(uniform, array);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to an array of float32 (stored as matrices)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrices defines the array of float32 to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setMatrices = function (uniform, matrices) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniformMatrix4fv(uniform, false, matrices);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to a matrix (3x3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrix defines the Float32Array representing the 3x3 matrix to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setMatrix3x3 = function (uniform, matrix) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniformMatrix3fv(uniform, false, matrix);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to a matrix (2x2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrix defines the Float32Array representing the 2x2 matrix to store\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setMatrix2x2 = function (uniform, matrix) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniformMatrix2fv(uniform, false, matrix);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to a number (float)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param value defines the float number to store\r\n * @returns true if the value was transfered\r\n */\r\n ThinEngine.prototype.setFloat = function (uniform, value) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniform1f(uniform, value);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to a vec2\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setFloat2 = function (uniform, x, y) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniform2f(uniform, x, y);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to a vec3\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n * @param z defines the 3rd component of the value\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setFloat3 = function (uniform, x, y, z) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniform3f(uniform, x, y, z);\r\n return true;\r\n };\r\n /**\r\n * Set the value of an uniform to a vec4\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n * @param z defines the 3rd component of the value\r\n * @param w defines the 4th component of the value\r\n * @returns true if the value was set\r\n */\r\n ThinEngine.prototype.setFloat4 = function (uniform, x, y, z, w) {\r\n if (!uniform) {\r\n return false;\r\n }\r\n this._gl.uniform4f(uniform, x, y, z, w);\r\n return true;\r\n };\r\n // States\r\n /**\r\n * Apply all cached states (depth, culling, stencil and alpha)\r\n */\r\n ThinEngine.prototype.applyStates = function () {\r\n this._depthCullingState.apply(this._gl);\r\n this._stencilState.apply(this._gl);\r\n this._alphaState.apply(this._gl);\r\n if (this._colorWriteChanged) {\r\n this._colorWriteChanged = false;\r\n var enable = this._colorWrite;\r\n this._gl.colorMask(enable, enable, enable, enable);\r\n }\r\n };\r\n /**\r\n * Enable or disable color writing\r\n * @param enable defines the state to set\r\n */\r\n ThinEngine.prototype.setColorWrite = function (enable) {\r\n if (enable !== this._colorWrite) {\r\n this._colorWriteChanged = true;\r\n this._colorWrite = enable;\r\n }\r\n };\r\n /**\r\n * Gets a boolean indicating if color writing is enabled\r\n * @returns the current color writing state\r\n */\r\n ThinEngine.prototype.getColorWrite = function () {\r\n return this._colorWrite;\r\n };\r\n Object.defineProperty(ThinEngine.prototype, \"depthCullingState\", {\r\n /**\r\n * Gets the depth culling state manager\r\n */\r\n get: function () {\r\n return this._depthCullingState;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"alphaState\", {\r\n /**\r\n * Gets the alpha state manager\r\n */\r\n get: function () {\r\n return this._alphaState;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"stencilState\", {\r\n /**\r\n * Gets the stencil state manager\r\n */\r\n get: function () {\r\n return this._stencilState;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Textures\r\n /**\r\n * Clears the list of texture accessible through engine.\r\n * This can help preventing texture load conflict due to name collision.\r\n */\r\n ThinEngine.prototype.clearInternalTexturesCache = function () {\r\n this._internalTexturesCache = [];\r\n };\r\n /**\r\n * Force the entire cache to be cleared\r\n * You should not have to use this function unless your engine needs to share the webGL context with another engine\r\n * @param bruteForce defines a boolean to force clearing ALL caches (including stencil, detoh and alpha states)\r\n */\r\n ThinEngine.prototype.wipeCaches = function (bruteForce) {\r\n if (this.preventCacheWipeBetweenFrames && !bruteForce) {\r\n return;\r\n }\r\n this._currentEffect = null;\r\n this._viewportCached.x = 0;\r\n this._viewportCached.y = 0;\r\n this._viewportCached.z = 0;\r\n this._viewportCached.w = 0;\r\n // Done before in case we clean the attributes\r\n this._unbindVertexArrayObject();\r\n if (bruteForce) {\r\n this._currentProgram = null;\r\n this.resetTextureCache();\r\n this._stencilState.reset();\r\n this._depthCullingState.reset();\r\n this._depthCullingState.depthFunc = this._gl.LEQUAL;\r\n this._alphaState.reset();\r\n this._alphaMode = 1;\r\n this._alphaEquation = 0;\r\n this._colorWrite = true;\r\n this._colorWriteChanged = true;\r\n this._unpackFlipYCached = null;\r\n this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);\r\n this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);\r\n this._mustWipeVertexAttributes = true;\r\n this.unbindAllAttributes();\r\n }\r\n this._resetVertexBufferBinding();\r\n this._cachedIndexBuffer = null;\r\n this._cachedEffectForVertexBuffers = null;\r\n this.bindIndexBuffer(null);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getSamplingParameters = function (samplingMode, generateMipMaps) {\r\n var gl = this._gl;\r\n var magFilter = gl.NEAREST;\r\n var minFilter = gl.NEAREST;\r\n switch (samplingMode) {\r\n case 11:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case 3:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case 8:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case 4:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case 5:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case 6:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case 7:\r\n magFilter = gl.NEAREST;\r\n minFilter = gl.LINEAR;\r\n break;\r\n case 1:\r\n magFilter = gl.NEAREST;\r\n minFilter = gl.NEAREST;\r\n break;\r\n case 9:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case 10:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case 2:\r\n magFilter = gl.LINEAR;\r\n minFilter = gl.LINEAR;\r\n break;\r\n case 12:\r\n magFilter = gl.LINEAR;\r\n minFilter = gl.NEAREST;\r\n break;\r\n }\r\n return {\r\n min: minFilter,\r\n mag: magFilter\r\n };\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._createTexture = function () {\r\n var texture = this._gl.createTexture();\r\n if (!texture) {\r\n throw new Error(\"Unable to create texture\");\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Usually called from Texture.ts.\r\n * Passed information to create a WebGLTexture\r\n * @param url defines a value which contains one of the following:\r\n * * A conventional http URL, e.g. 'http://...' or 'file://...'\r\n * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'\r\n * * An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated. Ignored for compressed textures. They must be in the file\r\n * @param invertY when true, image is flipped when loaded. You probably want true. Certain compressed textures may invert this if their default is inverted (eg. ktx)\r\n * @param scene needed for loading to the correct scene\r\n * @param samplingMode mode with should be used sample / access the texture (Default: Texture.TRILINEAR_SAMPLINGMODE)\r\n * @param onLoad optional callback to be called upon successful completion\r\n * @param onError optional callback to be called upon failure\r\n * @param buffer a source of a file previously fetched as either a base64 string, an ArrayBuffer (compressed or image format), HTMLImageElement (image format), or a Blob\r\n * @param fallback an internal argument in case the function must be called again, due to etc1 not having alpha capabilities\r\n * @param format internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param mimeType defines an optional mime type\r\n * @param loaderOptions options to be passed to the loader\r\n * @returns a InternalTexture for assignment back into BABYLON.Texture\r\n */\r\n ThinEngine.prototype.createTexture = function (url, noMipmap, invertY, scene, samplingMode, onLoad, onError, buffer, fallback, format, forcedExtension, mimeType, loaderOptions) {\r\n var _this = this;\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (fallback === void 0) { fallback = null; }\r\n if (format === void 0) { format = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n url = url || \"\";\r\n var fromData = url.substr(0, 5) === \"data:\";\r\n var fromBlob = url.substr(0, 5) === \"blob:\";\r\n var isBase64 = fromData && url.indexOf(\";base64,\") !== -1;\r\n var texture = fallback ? fallback : new InternalTexture(this, InternalTextureSource.Url);\r\n var originalUrl = url;\r\n if (this._transformTextureUrl && !isBase64 && !fallback && !buffer) {\r\n url = this._transformTextureUrl(url);\r\n }\r\n if (originalUrl !== url) {\r\n texture._originalUrl = originalUrl;\r\n }\r\n // establish the file extension, if possible\r\n var lastDot = url.lastIndexOf('.');\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\");\r\n var loader = null;\r\n // Remove query string\r\n var queryStringIndex = extension.indexOf(\"?\");\r\n if (queryStringIndex > -1) {\r\n extension = extension.split(\"?\")[0];\r\n }\r\n for (var _i = 0, _a = ThinEngine._TextureLoaders; _i < _a.length; _i++) {\r\n var availableLoader = _a[_i];\r\n if (availableLoader.canLoad(extension, mimeType)) {\r\n loader = availableLoader;\r\n break;\r\n }\r\n }\r\n if (scene) {\r\n scene._addPendingData(texture);\r\n }\r\n texture.url = url;\r\n texture.generateMipMaps = !noMipmap;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n if (!this._doNotHandleContextLost) {\r\n // Keep a link to the buffer only if we plan to handle context lost\r\n texture._buffer = buffer;\r\n }\r\n var onLoadObserver = null;\r\n if (onLoad && !fallback) {\r\n onLoadObserver = texture.onLoadedObservable.add(onLoad);\r\n }\r\n if (!fallback) {\r\n this._internalTexturesCache.push(texture);\r\n }\r\n var onInternalError = function (message, exception) {\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n if (url === originalUrl) {\r\n if (onLoadObserver) {\r\n texture.onLoadedObservable.remove(onLoadObserver);\r\n }\r\n if (EngineStore.UseFallbackTexture) {\r\n _this.createTexture(EngineStore.FallbackTexture, noMipmap, texture.invertY, scene, samplingMode, null, onError, buffer, texture);\r\n }\r\n if (onError) {\r\n onError((message || \"Unknown error\") + (EngineStore.UseFallbackTexture ? \" - Fallback texture was used\" : \"\"), exception);\r\n }\r\n }\r\n else {\r\n // fall back to the original url if the transformed url fails to load\r\n Logger.Warn(\"Failed to load \" + url + \", falling back to \" + originalUrl);\r\n _this.createTexture(originalUrl, noMipmap, texture.invertY, scene, samplingMode, onLoad, onError, buffer, texture, format, forcedExtension, mimeType, loaderOptions);\r\n }\r\n };\r\n // processing for non-image formats\r\n if (loader) {\r\n var callback_1 = function (data) {\r\n loader.loadData(data, texture, function (width, height, loadMipmap, isCompressed, done, loadFailed) {\r\n if (loadFailed) {\r\n onInternalError(\"TextureLoader failed to load data\");\r\n }\r\n else {\r\n _this._prepareWebGLTexture(texture, scene, width, height, texture.invertY, !loadMipmap, isCompressed, function () {\r\n done();\r\n return false;\r\n }, samplingMode);\r\n }\r\n }, loaderOptions);\r\n };\r\n if (!buffer) {\r\n this._loadFile(url, function (data) { return callback_1(new Uint8Array(data)); }, undefined, scene ? scene.offlineProvider : undefined, true, function (request, exception) {\r\n onInternalError(\"Unable to load \" + (request ? request.responseURL : url, exception));\r\n });\r\n }\r\n else {\r\n if (buffer instanceof ArrayBuffer) {\r\n callback_1(new Uint8Array(buffer));\r\n }\r\n else if (ArrayBuffer.isView(buffer)) {\r\n callback_1(buffer);\r\n }\r\n else {\r\n if (onError) {\r\n onError(\"Unable to load: only ArrayBuffer or ArrayBufferView is supported\", null);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n var onload_1 = function (img) {\r\n if (fromBlob && !_this._doNotHandleContextLost) {\r\n // We need to store the image if we need to rebuild the texture\r\n // in case of a webgl context lost\r\n texture._buffer = img;\r\n }\r\n _this._prepareWebGLTexture(texture, scene, img.width, img.height, texture.invertY, noMipmap, false, function (potWidth, potHeight, continuationCallback) {\r\n var gl = _this._gl;\r\n var isPot = (img.width === potWidth && img.height === potHeight);\r\n var internalFormat = format ? _this._getInternalFormat(format) : ((extension === \".jpg\") ? gl.RGB : gl.RGBA);\r\n if (isPot) {\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, img);\r\n return false;\r\n }\r\n var maxTextureSize = _this._caps.maxTextureSize;\r\n if (img.width > maxTextureSize || img.height > maxTextureSize || !_this._supportsHardwareTextureRescaling) {\r\n _this._prepareWorkingCanvas();\r\n if (!_this._workingCanvas || !_this._workingContext) {\r\n return false;\r\n }\r\n _this._workingCanvas.width = potWidth;\r\n _this._workingCanvas.height = potHeight;\r\n _this._workingContext.drawImage(img, 0, 0, img.width, img.height, 0, 0, potWidth, potHeight);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, _this._workingCanvas);\r\n texture.width = potWidth;\r\n texture.height = potHeight;\r\n return false;\r\n }\r\n else {\r\n // Using shaders when possible to rescale because canvas.drawImage is lossy\r\n var source_1 = new InternalTexture(_this, InternalTextureSource.Temp);\r\n _this._bindTextureDirectly(gl.TEXTURE_2D, source_1, true);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, img);\r\n _this._rescaleTexture(source_1, texture, scene, internalFormat, function () {\r\n _this._releaseTexture(source_1);\r\n _this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n continuationCallback();\r\n });\r\n }\r\n return true;\r\n }, samplingMode);\r\n };\r\n if (!fromData || isBase64) {\r\n if (buffer && (buffer.decoding || buffer.close)) {\r\n onload_1(buffer);\r\n }\r\n else {\r\n ThinEngine._FileToolsLoadImage(url, onload_1, onInternalError, scene ? scene.offlineProvider : null, mimeType);\r\n }\r\n }\r\n else if (typeof buffer === \"string\" || buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer) || buffer instanceof Blob) {\r\n ThinEngine._FileToolsLoadImage(buffer, onload_1, onInternalError, scene ? scene.offlineProvider : null, mimeType);\r\n }\r\n else if (buffer) {\r\n onload_1(buffer);\r\n }\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @param mimeType optional mime type\r\n * @returns the HTMLImageElement of the loaded image\r\n * @hidden\r\n */\r\n ThinEngine._FileToolsLoadImage = function (input, onLoad, onError, offlineProvider, mimeType) {\r\n throw _DevTools.WarnImport(\"FileTools\");\r\n };\r\n /**\r\n * @hidden\r\n */\r\n ThinEngine.prototype._rescaleTexture = function (source, destination, scene, internalFormat, onComplete) {\r\n };\r\n /**\r\n * Creates a raw texture\r\n * @param data defines the data to store in the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param format defines the format of the data\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @returns the raw texture inside an InternalTexture\r\n */\r\n ThinEngine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression, type) {\r\n if (compression === void 0) { compression = null; }\r\n if (type === void 0) { type = 0; }\r\n throw _DevTools.WarnImport(\"Engine.RawTexture\");\r\n };\r\n /**\r\n * Creates a new raw cube texture\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n ThinEngine.prototype.createRawCubeTexture = function (data, size, format, type, generateMipMaps, invertY, samplingMode, compression) {\r\n if (compression === void 0) { compression = null; }\r\n throw _DevTools.WarnImport(\"Engine.RawTexture\");\r\n };\r\n /**\r\n * Creates a new raw 3D texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the depth of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @returns a new raw 3D texture (stored in an InternalTexture)\r\n */\r\n ThinEngine.prototype.createRawTexture3D = function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = 0; }\r\n throw _DevTools.WarnImport(\"Engine.RawTexture\");\r\n };\r\n /**\r\n * Creates a new raw 2D array texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the number of layers of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @returns a new raw 2D array texture (stored in an InternalTexture)\r\n */\r\n ThinEngine.prototype.createRawTexture2DArray = function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = 0; }\r\n throw _DevTools.WarnImport(\"Engine.RawTexture\");\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._unpackFlipY = function (value) {\r\n if (this._unpackFlipYCached !== value) {\r\n this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, value ? 1 : 0);\r\n if (this.enableUnpackFlipYCached) {\r\n this._unpackFlipYCached = value;\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getUnpackAlignement = function () {\r\n return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT);\r\n };\r\n ThinEngine.prototype._getTextureTarget = function (texture) {\r\n if (texture.isCube) {\r\n return this._gl.TEXTURE_CUBE_MAP;\r\n }\r\n else if (texture.is3D) {\r\n return this._gl.TEXTURE_3D;\r\n }\r\n else if (texture.is2DArray || texture.isMultiview) {\r\n return this._gl.TEXTURE_2D_ARRAY;\r\n }\r\n return this._gl.TEXTURE_2D;\r\n };\r\n /**\r\n * Update the sampling mode of a given texture\r\n * @param samplingMode defines the required sampling mode\r\n * @param texture defines the texture to update\r\n * @param generateMipMaps defines whether to generate mipmaps for the texture\r\n */\r\n ThinEngine.prototype.updateTextureSamplingMode = function (samplingMode, texture, generateMipMaps) {\r\n if (generateMipMaps === void 0) { generateMipMaps = false; }\r\n var target = this._getTextureTarget(texture);\r\n var filters = this._getSamplingParameters(samplingMode, texture.generateMipMaps || generateMipMaps);\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_MAG_FILTER, filters.mag, texture);\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (generateMipMaps) {\r\n texture.generateMipMaps = true;\r\n this._gl.generateMipmap(target);\r\n }\r\n this._bindTextureDirectly(target, null);\r\n texture.samplingMode = samplingMode;\r\n };\r\n /**\r\n * Update the sampling mode of a given texture\r\n * @param texture defines the texture to update\r\n * @param wrapU defines the texture wrap mode of the u coordinates\r\n * @param wrapV defines the texture wrap mode of the v coordinates\r\n * @param wrapR defines the texture wrap mode of the r coordinates\r\n */\r\n ThinEngine.prototype.updateTextureWrappingMode = function (texture, wrapU, wrapV, wrapR) {\r\n if (wrapV === void 0) { wrapV = null; }\r\n if (wrapR === void 0) { wrapR = null; }\r\n var target = this._getTextureTarget(texture);\r\n if (wrapU !== null) {\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(wrapU), texture);\r\n texture._cachedWrapU = wrapU;\r\n }\r\n if (wrapV !== null) {\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(wrapV), texture);\r\n texture._cachedWrapV = wrapV;\r\n }\r\n if ((texture.is2DArray || texture.is3D) && (wrapR !== null)) {\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(wrapR), texture);\r\n texture._cachedWrapR = wrapR;\r\n }\r\n this._bindTextureDirectly(target, null);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._setupDepthStencilTexture = function (internalTexture, size, generateStencil, bilinearFiltering, comparisonFunction) {\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n var layers = size.layers || 0;\r\n internalTexture.baseWidth = width;\r\n internalTexture.baseHeight = height;\r\n internalTexture.width = width;\r\n internalTexture.height = height;\r\n internalTexture.is2DArray = layers > 0;\r\n internalTexture.depth = layers;\r\n internalTexture.isReady = true;\r\n internalTexture.samples = 1;\r\n internalTexture.generateMipMaps = false;\r\n internalTexture._generateDepthBuffer = true;\r\n internalTexture._generateStencilBuffer = generateStencil;\r\n internalTexture.samplingMode = bilinearFiltering ? 2 : 1;\r\n internalTexture.type = 0;\r\n internalTexture._comparisonFunction = comparisonFunction;\r\n var gl = this._gl;\r\n var target = this._getTextureTarget(internalTexture);\r\n var samplingParameters = this._getSamplingParameters(internalTexture.samplingMode, false);\r\n gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, samplingParameters.mag);\r\n gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, samplingParameters.min);\r\n gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n if (comparisonFunction === 0) {\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, 515);\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.NONE);\r\n }\r\n else {\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._uploadCompressedDataToTextureDirectly = function (texture, internalFormat, width, height, data, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n this._gl.compressedTexImage2D(target, lod, internalFormat, width, height, 0, data);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod, babylonInternalFormat, useTextureWidthAndHeight) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n if (useTextureWidthAndHeight === void 0) { useTextureWidthAndHeight = false; }\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(texture.type);\r\n var format = this._getInternalFormat(texture.format);\r\n var internalFormat = babylonInternalFormat === undefined ? this._getRGBABufferInternalSizedFormat(texture.type, texture.format) : this._getInternalFormat(babylonInternalFormat);\r\n this._unpackFlipY(texture.invertY);\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n var lodMaxWidth = Math.round(Math.log(texture.width) * Math.LOG2E);\r\n var lodMaxHeight = Math.round(Math.log(texture.height) * Math.LOG2E);\r\n var width = useTextureWidthAndHeight ? texture.width : Math.pow(2, Math.max(lodMaxWidth - lod, 0));\r\n var height = useTextureWidthAndHeight ? texture.height : Math.pow(2, Math.max(lodMaxHeight - lod, 0));\r\n gl.texImage2D(target, lod, internalFormat, width, height, 0, format, textureType, imageData);\r\n };\r\n /**\r\n * Update a portion of an internal texture\r\n * @param texture defines the texture to update\r\n * @param imageData defines the data to store into the texture\r\n * @param xOffset defines the x coordinates of the update rectangle\r\n * @param yOffset defines the y coordinates of the update rectangle\r\n * @param width defines the width of the update rectangle\r\n * @param height defines the height of the update rectangle\r\n * @param faceIndex defines the face index if texture is a cube (0 by default)\r\n * @param lod defines the lod level to update (0 by default)\r\n */\r\n ThinEngine.prototype.updateTextureData = function (texture, imageData, xOffset, yOffset, width, height, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(texture.type);\r\n var format = this._getInternalFormat(texture.format);\r\n this._unpackFlipY(texture.invertY);\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n gl.texSubImage2D(target, lod, xOffset, yOffset, width, height, format, textureType, imageData);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._uploadArrayBufferViewToTexture = function (texture, imageData, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\r\n this._bindTextureDirectly(bindTarget, texture, true);\r\n this._uploadDataToTextureDirectly(texture, imageData, faceIndex, lod);\r\n this._bindTextureDirectly(bindTarget, null, true);\r\n };\r\n ThinEngine.prototype._prepareWebGLTextureContinuation = function (texture, scene, noMipmap, isCompressed, samplingMode) {\r\n var gl = this._gl;\r\n if (!gl) {\r\n return;\r\n }\r\n var filters = this._getSamplingParameters(samplingMode, !noMipmap);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (!noMipmap && !isCompressed) {\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n // this.resetTextureCache();\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n };\r\n ThinEngine.prototype._prepareWebGLTexture = function (texture, scene, width, height, invertY, noMipmap, isCompressed, processFunction, samplingMode) {\r\n var _this = this;\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n var maxTextureSize = this.getCaps().maxTextureSize;\r\n var potWidth = Math.min(maxTextureSize, this.needPOTTextures ? ThinEngine.GetExponentOfTwo(width, maxTextureSize) : width);\r\n var potHeight = Math.min(maxTextureSize, this.needPOTTextures ? ThinEngine.GetExponentOfTwo(height, maxTextureSize) : height);\r\n var gl = this._gl;\r\n if (!gl) {\r\n return;\r\n }\r\n if (!texture._webGLTexture) {\r\n // this.resetTextureCache();\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n return;\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = potWidth;\r\n texture.height = potHeight;\r\n texture.isReady = true;\r\n if (processFunction(potWidth, potHeight, function () {\r\n _this._prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);\r\n })) {\r\n // Returning as texture needs extra async steps\r\n return;\r\n }\r\n this._prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._setupFramebufferDepthAttachments = function (generateStencilBuffer, generateDepthBuffer, width, height, samples) {\r\n if (samples === void 0) { samples = 1; }\r\n var gl = this._gl;\r\n // Create the depth/stencil buffer\r\n if (generateStencilBuffer && generateDepthBuffer) {\r\n return this._getDepthStencilBuffer(width, height, samples, gl.DEPTH_STENCIL, gl.DEPTH24_STENCIL8, gl.DEPTH_STENCIL_ATTACHMENT);\r\n }\r\n if (generateDepthBuffer) {\r\n var depthFormat = gl.DEPTH_COMPONENT16;\r\n if (this._webGLVersion > 1) {\r\n depthFormat = gl.DEPTH_COMPONENT32F;\r\n }\r\n return this._getDepthStencilBuffer(width, height, samples, depthFormat, depthFormat, gl.DEPTH_ATTACHMENT);\r\n }\r\n if (generateStencilBuffer) {\r\n return this._getDepthStencilBuffer(width, height, samples, gl.STENCIL_INDEX8, gl.STENCIL_INDEX8, gl.STENCIL_ATTACHMENT);\r\n }\r\n return null;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._releaseFramebufferObjects = function (texture) {\r\n var gl = this._gl;\r\n if (texture._framebuffer) {\r\n gl.deleteFramebuffer(texture._framebuffer);\r\n texture._framebuffer = null;\r\n }\r\n if (texture._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(texture._depthStencilBuffer);\r\n texture._depthStencilBuffer = null;\r\n }\r\n if (texture._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(texture._MSAAFramebuffer);\r\n texture._MSAAFramebuffer = null;\r\n }\r\n if (texture._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(texture._MSAARenderBuffer);\r\n texture._MSAARenderBuffer = null;\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._releaseTexture = function (texture) {\r\n this._releaseFramebufferObjects(texture);\r\n this._deleteTexture(texture._webGLTexture);\r\n // Unbind channels\r\n this.unbindAllTextures();\r\n var index = this._internalTexturesCache.indexOf(texture);\r\n if (index !== -1) {\r\n this._internalTexturesCache.splice(index, 1);\r\n }\r\n // Integrated fixed lod samplers.\r\n if (texture._lodTextureHigh) {\r\n texture._lodTextureHigh.dispose();\r\n }\r\n if (texture._lodTextureMid) {\r\n texture._lodTextureMid.dispose();\r\n }\r\n if (texture._lodTextureLow) {\r\n texture._lodTextureLow.dispose();\r\n }\r\n // Integrated irradiance map.\r\n if (texture._irradianceTexture) {\r\n texture._irradianceTexture.dispose();\r\n }\r\n };\r\n ThinEngine.prototype._deleteTexture = function (texture) {\r\n this._gl.deleteTexture(texture);\r\n };\r\n ThinEngine.prototype._setProgram = function (program) {\r\n if (this._currentProgram !== program) {\r\n this._gl.useProgram(program);\r\n this._currentProgram = program;\r\n }\r\n };\r\n /**\r\n * Binds an effect to the webGL context\r\n * @param effect defines the effect to bind\r\n */\r\n ThinEngine.prototype.bindSamplers = function (effect) {\r\n var webGLPipelineContext = effect.getPipelineContext();\r\n this._setProgram(webGLPipelineContext.program);\r\n var samplers = effect.getSamplers();\r\n for (var index = 0; index < samplers.length; index++) {\r\n var uniform = effect.getUniform(samplers[index]);\r\n if (uniform) {\r\n this._boundUniforms[index] = uniform;\r\n }\r\n }\r\n this._currentEffect = null;\r\n };\r\n ThinEngine.prototype._activateCurrentTexture = function () {\r\n if (this._currentTextureChannel !== this._activeChannel) {\r\n this._gl.activeTexture(this._gl.TEXTURE0 + this._activeChannel);\r\n this._currentTextureChannel = this._activeChannel;\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._bindTextureDirectly = function (target, texture, forTextureDataUpdate, force) {\r\n if (forTextureDataUpdate === void 0) { forTextureDataUpdate = false; }\r\n if (force === void 0) { force = false; }\r\n var wasPreviouslyBound = false;\r\n var isTextureForRendering = texture && texture._associatedChannel > -1;\r\n if (forTextureDataUpdate && isTextureForRendering) {\r\n this._activeChannel = texture._associatedChannel;\r\n }\r\n var currentTextureBound = this._boundTexturesCache[this._activeChannel];\r\n if (currentTextureBound !== texture || force) {\r\n this._activateCurrentTexture();\r\n if (texture && texture.isMultiview) {\r\n this._gl.bindTexture(target, texture ? texture._colorTextureArray : null);\r\n }\r\n else {\r\n this._gl.bindTexture(target, texture ? texture._webGLTexture : null);\r\n }\r\n this._boundTexturesCache[this._activeChannel] = texture;\r\n if (texture) {\r\n texture._associatedChannel = this._activeChannel;\r\n }\r\n }\r\n else if (forTextureDataUpdate) {\r\n wasPreviouslyBound = true;\r\n this._activateCurrentTexture();\r\n }\r\n if (isTextureForRendering && !forTextureDataUpdate) {\r\n this._bindSamplerUniformToChannel(texture._associatedChannel, this._activeChannel);\r\n }\r\n return wasPreviouslyBound;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._bindTexture = function (channel, texture) {\r\n if (channel === undefined) {\r\n return;\r\n }\r\n if (texture) {\r\n texture._associatedChannel = channel;\r\n }\r\n this._activeChannel = channel;\r\n var target = texture ? this._getTextureTarget(texture) : this._gl.TEXTURE_2D;\r\n this._bindTextureDirectly(target, texture);\r\n };\r\n /**\r\n * Unbind all textures from the webGL context\r\n */\r\n ThinEngine.prototype.unbindAllTextures = function () {\r\n for (var channel = 0; channel < this._maxSimultaneousTextures; channel++) {\r\n this._activeChannel = channel;\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n if (this.webGLVersion > 1) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, null);\r\n }\r\n }\r\n };\r\n /**\r\n * Sets a texture to the according uniform.\r\n * @param channel The texture channel\r\n * @param uniform The uniform to set\r\n * @param texture The texture to apply\r\n */\r\n ThinEngine.prototype.setTexture = function (channel, uniform, texture) {\r\n if (channel === undefined) {\r\n return;\r\n }\r\n if (uniform) {\r\n this._boundUniforms[channel] = uniform;\r\n }\r\n this._setTexture(channel, texture);\r\n };\r\n ThinEngine.prototype._bindSamplerUniformToChannel = function (sourceSlot, destination) {\r\n var uniform = this._boundUniforms[sourceSlot];\r\n if (!uniform || uniform._currentState === destination) {\r\n return;\r\n }\r\n this._gl.uniform1i(uniform, destination);\r\n uniform._currentState = destination;\r\n };\r\n ThinEngine.prototype._getTextureWrapMode = function (mode) {\r\n switch (mode) {\r\n case 1:\r\n return this._gl.REPEAT;\r\n case 0:\r\n return this._gl.CLAMP_TO_EDGE;\r\n case 2:\r\n return this._gl.MIRRORED_REPEAT;\r\n }\r\n return this._gl.REPEAT;\r\n };\r\n ThinEngine.prototype._setTexture = function (channel, texture, isPartOfTextureArray, depthStencilTexture) {\r\n if (isPartOfTextureArray === void 0) { isPartOfTextureArray = false; }\r\n if (depthStencilTexture === void 0) { depthStencilTexture = false; }\r\n // Not ready?\r\n if (!texture) {\r\n if (this._boundTexturesCache[channel] != null) {\r\n this._activeChannel = channel;\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n if (this.webGLVersion > 1) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, null);\r\n }\r\n }\r\n return false;\r\n }\r\n // Video\r\n if (texture.video) {\r\n this._activeChannel = channel;\r\n texture.update();\r\n }\r\n else if (texture.delayLoadState === 4) { // Delay loading\r\n texture.delayLoad();\r\n return false;\r\n }\r\n var internalTexture;\r\n if (depthStencilTexture) {\r\n internalTexture = texture.depthStencilTexture;\r\n }\r\n else if (texture.isReady()) {\r\n internalTexture = texture.getInternalTexture();\r\n }\r\n else if (texture.isCube) {\r\n internalTexture = this.emptyCubeTexture;\r\n }\r\n else if (texture.is3D) {\r\n internalTexture = this.emptyTexture3D;\r\n }\r\n else if (texture.is2DArray) {\r\n internalTexture = this.emptyTexture2DArray;\r\n }\r\n else {\r\n internalTexture = this.emptyTexture;\r\n }\r\n if (!isPartOfTextureArray && internalTexture) {\r\n internalTexture._associatedChannel = channel;\r\n }\r\n var needToBind = true;\r\n if (this._boundTexturesCache[channel] === internalTexture) {\r\n if (!isPartOfTextureArray) {\r\n this._bindSamplerUniformToChannel(internalTexture._associatedChannel, channel);\r\n }\r\n needToBind = false;\r\n }\r\n this._activeChannel = channel;\r\n var target = this._getTextureTarget(internalTexture);\r\n if (needToBind) {\r\n this._bindTextureDirectly(target, internalTexture, isPartOfTextureArray);\r\n }\r\n if (internalTexture && !internalTexture.isMultiview) {\r\n // CUBIC_MODE and SKYBOX_MODE both require CLAMP_TO_EDGE. All other modes use REPEAT.\r\n if (internalTexture.isCube && internalTexture._cachedCoordinatesMode !== texture.coordinatesMode) {\r\n internalTexture._cachedCoordinatesMode = texture.coordinatesMode;\r\n var textureWrapMode = (texture.coordinatesMode !== 3 && texture.coordinatesMode !== 5) ? 1 : 0;\r\n texture.wrapU = textureWrapMode;\r\n texture.wrapV = textureWrapMode;\r\n }\r\n if (internalTexture._cachedWrapU !== texture.wrapU) {\r\n internalTexture._cachedWrapU = texture.wrapU;\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(texture.wrapU), internalTexture);\r\n }\r\n if (internalTexture._cachedWrapV !== texture.wrapV) {\r\n internalTexture._cachedWrapV = texture.wrapV;\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(texture.wrapV), internalTexture);\r\n }\r\n if (internalTexture.is3D && internalTexture._cachedWrapR !== texture.wrapR) {\r\n internalTexture._cachedWrapR = texture.wrapR;\r\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(texture.wrapR), internalTexture);\r\n }\r\n this._setAnisotropicLevel(target, internalTexture, texture.anisotropicFilteringLevel);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Sets an array of texture to the webGL context\r\n * @param channel defines the channel where the texture array must be set\r\n * @param uniform defines the associated uniform location\r\n * @param textures defines the array of textures to bind\r\n */\r\n ThinEngine.prototype.setTextureArray = function (channel, uniform, textures) {\r\n if (channel === undefined || !uniform) {\r\n return;\r\n }\r\n if (!this._textureUnits || this._textureUnits.length !== textures.length) {\r\n this._textureUnits = new Int32Array(textures.length);\r\n }\r\n for (var i = 0; i < textures.length; i++) {\r\n var texture = textures[i].getInternalTexture();\r\n if (texture) {\r\n this._textureUnits[i] = channel + i;\r\n texture._associatedChannel = channel + i;\r\n }\r\n else {\r\n this._textureUnits[i] = -1;\r\n }\r\n }\r\n this._gl.uniform1iv(uniform, this._textureUnits);\r\n for (var index = 0; index < textures.length; index++) {\r\n this._setTexture(this._textureUnits[index], textures[index], true);\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._setAnisotropicLevel = function (target, internalTexture, anisotropicFilteringLevel) {\r\n var anisotropicFilterExtension = this._caps.textureAnisotropicFilterExtension;\r\n if (internalTexture.samplingMode !== 11\r\n && internalTexture.samplingMode !== 3\r\n && internalTexture.samplingMode !== 2) {\r\n anisotropicFilteringLevel = 1; // Forcing the anisotropic to 1 because else webgl will force filters to linear\r\n }\r\n if (anisotropicFilterExtension && internalTexture._cachedAnisotropicFilteringLevel !== anisotropicFilteringLevel) {\r\n this._setTextureParameterFloat(target, anisotropicFilterExtension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(anisotropicFilteringLevel, this._caps.maxAnisotropy), internalTexture);\r\n internalTexture._cachedAnisotropicFilteringLevel = anisotropicFilteringLevel;\r\n }\r\n };\r\n ThinEngine.prototype._setTextureParameterFloat = function (target, parameter, value, texture) {\r\n this._bindTextureDirectly(target, texture, true, true);\r\n this._gl.texParameterf(target, parameter, value);\r\n };\r\n ThinEngine.prototype._setTextureParameterInteger = function (target, parameter, value, texture) {\r\n if (texture) {\r\n this._bindTextureDirectly(target, texture, true, true);\r\n }\r\n this._gl.texParameteri(target, parameter, value);\r\n };\r\n /**\r\n * Unbind all vertex attributes from the webGL context\r\n */\r\n ThinEngine.prototype.unbindAllAttributes = function () {\r\n if (this._mustWipeVertexAttributes) {\r\n this._mustWipeVertexAttributes = false;\r\n for (var i = 0; i < this._caps.maxVertexAttribs; i++) {\r\n this.disableAttributeByIndex(i);\r\n }\r\n return;\r\n }\r\n for (var i = 0, ul = this._vertexAttribArraysEnabled.length; i < ul; i++) {\r\n if (i >= this._caps.maxVertexAttribs || !this._vertexAttribArraysEnabled[i]) {\r\n continue;\r\n }\r\n this.disableAttributeByIndex(i);\r\n }\r\n };\r\n /**\r\n * Force the engine to release all cached effects. This means that next effect compilation will have to be done completely even if a similar effect was already compiled\r\n */\r\n ThinEngine.prototype.releaseEffects = function () {\r\n for (var name in this._compiledEffects) {\r\n var webGLPipelineContext = this._compiledEffects[name].getPipelineContext();\r\n this._deletePipelineContext(webGLPipelineContext);\r\n }\r\n this._compiledEffects = {};\r\n };\r\n /**\r\n * Dispose and release all associated resources\r\n */\r\n ThinEngine.prototype.dispose = function () {\r\n this.stopRenderLoop();\r\n // Clear observables\r\n if (this.onBeforeTextureInitObservable) {\r\n this.onBeforeTextureInitObservable.clear();\r\n }\r\n // Empty texture\r\n if (this._emptyTexture) {\r\n this._releaseTexture(this._emptyTexture);\r\n this._emptyTexture = null;\r\n }\r\n if (this._emptyCubeTexture) {\r\n this._releaseTexture(this._emptyCubeTexture);\r\n this._emptyCubeTexture = null;\r\n }\r\n if (this._dummyFramebuffer) {\r\n this._gl.deleteFramebuffer(this._dummyFramebuffer);\r\n }\r\n // Release effects\r\n this.releaseEffects();\r\n // Unbind\r\n this.unbindAllAttributes();\r\n this._boundUniforms = [];\r\n // Events\r\n if (DomManagement.IsWindowObjectExist()) {\r\n if (this._renderingCanvas) {\r\n if (!this._doNotHandleContextLost) {\r\n this._renderingCanvas.removeEventListener(\"webglcontextlost\", this._onContextLost);\r\n this._renderingCanvas.removeEventListener(\"webglcontextrestored\", this._onContextRestored);\r\n }\r\n }\r\n }\r\n this._workingCanvas = null;\r\n this._workingContext = null;\r\n this._currentBufferPointers = [];\r\n this._renderingCanvas = null;\r\n this._currentProgram = null;\r\n this._boundRenderFunction = null;\r\n Effect.ResetCache();\r\n // Abort active requests\r\n for (var _i = 0, _a = this._activeRequests; _i < _a.length; _i++) {\r\n var request = _a[_i];\r\n request.abort();\r\n }\r\n };\r\n /**\r\n * Attach a new callback raised when context lost event is fired\r\n * @param callback defines the callback to call\r\n */\r\n ThinEngine.prototype.attachContextLostEvent = function (callback) {\r\n if (this._renderingCanvas) {\r\n this._renderingCanvas.addEventListener(\"webglcontextlost\", callback, false);\r\n }\r\n };\r\n /**\r\n * Attach a new callback raised when context restored event is fired\r\n * @param callback defines the callback to call\r\n */\r\n ThinEngine.prototype.attachContextRestoredEvent = function (callback) {\r\n if (this._renderingCanvas) {\r\n this._renderingCanvas.addEventListener(\"webglcontextrestored\", callback, false);\r\n }\r\n };\r\n /**\r\n * Get the current error code of the webGL context\r\n * @returns the error code\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getError\r\n */\r\n ThinEngine.prototype.getError = function () {\r\n return this._gl.getError();\r\n };\r\n ThinEngine.prototype._canRenderToFloatFramebuffer = function () {\r\n if (this._webGLVersion > 1) {\r\n return this._caps.colorBufferFloat;\r\n }\r\n return this._canRenderToFramebuffer(1);\r\n };\r\n ThinEngine.prototype._canRenderToHalfFloatFramebuffer = function () {\r\n if (this._webGLVersion > 1) {\r\n return this._caps.colorBufferFloat;\r\n }\r\n return this._canRenderToFramebuffer(2);\r\n };\r\n // Thank you : http://stackoverflow.com/questions/28827511/webgl-ios-render-to-floating-point-texture\r\n ThinEngine.prototype._canRenderToFramebuffer = function (type) {\r\n var gl = this._gl;\r\n //clear existing errors\r\n while (gl.getError() !== gl.NO_ERROR) { }\r\n var successful = true;\r\n var texture = gl.createTexture();\r\n gl.bindTexture(gl.TEXTURE_2D, texture);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(type), 1, 1, 0, gl.RGBA, this._getWebGLTextureType(type), null);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\r\n var fb = gl.createFramebuffer();\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\r\n var status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\r\n successful = successful && (status === gl.FRAMEBUFFER_COMPLETE);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n //try render by clearing frame buffer's color buffer\r\n if (successful) {\r\n gl.clear(gl.COLOR_BUFFER_BIT);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n }\r\n //try reading from frame to ensure render occurs (just creating the FBO is not sufficient to determine if rendering is supported)\r\n if (successful) {\r\n //in practice it's sufficient to just read from the backbuffer rather than handle potentially issues reading from the texture\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\r\n var readFormat = gl.RGBA;\r\n var readType = gl.UNSIGNED_BYTE;\r\n var buffer = new Uint8Array(4);\r\n gl.readPixels(0, 0, 1, 1, readFormat, readType, buffer);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n }\r\n //clean up\r\n gl.deleteTexture(texture);\r\n gl.deleteFramebuffer(fb);\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\r\n //clear accumulated errors\r\n while (!successful && (gl.getError() !== gl.NO_ERROR)) { }\r\n return successful;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getWebGLTextureType = function (type) {\r\n if (this._webGLVersion === 1) {\r\n switch (type) {\r\n case 1:\r\n return this._gl.FLOAT;\r\n case 2:\r\n return this._gl.HALF_FLOAT_OES;\r\n case 0:\r\n return this._gl.UNSIGNED_BYTE;\r\n case 8:\r\n return this._gl.UNSIGNED_SHORT_4_4_4_4;\r\n case 9:\r\n return this._gl.UNSIGNED_SHORT_5_5_5_1;\r\n case 10:\r\n return this._gl.UNSIGNED_SHORT_5_6_5;\r\n }\r\n return this._gl.UNSIGNED_BYTE;\r\n }\r\n switch (type) {\r\n case 3:\r\n return this._gl.BYTE;\r\n case 0:\r\n return this._gl.UNSIGNED_BYTE;\r\n case 4:\r\n return this._gl.SHORT;\r\n case 5:\r\n return this._gl.UNSIGNED_SHORT;\r\n case 6:\r\n return this._gl.INT;\r\n case 7: // Refers to UNSIGNED_INT\r\n return this._gl.UNSIGNED_INT;\r\n case 1:\r\n return this._gl.FLOAT;\r\n case 2:\r\n return this._gl.HALF_FLOAT;\r\n case 8:\r\n return this._gl.UNSIGNED_SHORT_4_4_4_4;\r\n case 9:\r\n return this._gl.UNSIGNED_SHORT_5_5_5_1;\r\n case 10:\r\n return this._gl.UNSIGNED_SHORT_5_6_5;\r\n case 11:\r\n return this._gl.UNSIGNED_INT_2_10_10_10_REV;\r\n case 12:\r\n return this._gl.UNSIGNED_INT_24_8;\r\n case 13:\r\n return this._gl.UNSIGNED_INT_10F_11F_11F_REV;\r\n case 14:\r\n return this._gl.UNSIGNED_INT_5_9_9_9_REV;\r\n case 15:\r\n return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV;\r\n }\r\n return this._gl.UNSIGNED_BYTE;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getInternalFormat = function (format) {\r\n var internalFormat = this._gl.RGBA;\r\n switch (format) {\r\n case 0:\r\n internalFormat = this._gl.ALPHA;\r\n break;\r\n case 1:\r\n internalFormat = this._gl.LUMINANCE;\r\n break;\r\n case 2:\r\n internalFormat = this._gl.LUMINANCE_ALPHA;\r\n break;\r\n case 6:\r\n internalFormat = this._gl.RED;\r\n break;\r\n case 7:\r\n internalFormat = this._gl.RG;\r\n break;\r\n case 4:\r\n internalFormat = this._gl.RGB;\r\n break;\r\n case 5:\r\n internalFormat = this._gl.RGBA;\r\n break;\r\n }\r\n if (this._webGLVersion > 1) {\r\n switch (format) {\r\n case 8:\r\n internalFormat = this._gl.RED_INTEGER;\r\n break;\r\n case 9:\r\n internalFormat = this._gl.RG_INTEGER;\r\n break;\r\n case 10:\r\n internalFormat = this._gl.RGB_INTEGER;\r\n break;\r\n case 11:\r\n internalFormat = this._gl.RGBA_INTEGER;\r\n break;\r\n }\r\n }\r\n return internalFormat;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getRGBABufferInternalSizedFormat = function (type, format) {\r\n if (this._webGLVersion === 1) {\r\n if (format !== undefined) {\r\n switch (format) {\r\n case 0:\r\n return this._gl.ALPHA;\r\n case 1:\r\n return this._gl.LUMINANCE;\r\n case 2:\r\n return this._gl.LUMINANCE_ALPHA;\r\n case 4:\r\n return this._gl.RGB;\r\n }\r\n }\r\n return this._gl.RGBA;\r\n }\r\n switch (type) {\r\n case 3:\r\n switch (format) {\r\n case 6:\r\n return this._gl.R8_SNORM;\r\n case 7:\r\n return this._gl.RG8_SNORM;\r\n case 4:\r\n return this._gl.RGB8_SNORM;\r\n case 8:\r\n return this._gl.R8I;\r\n case 9:\r\n return this._gl.RG8I;\r\n case 10:\r\n return this._gl.RGB8I;\r\n case 11:\r\n return this._gl.RGBA8I;\r\n default:\r\n return this._gl.RGBA8_SNORM;\r\n }\r\n case 0:\r\n switch (format) {\r\n case 6:\r\n return this._gl.R8;\r\n case 7:\r\n return this._gl.RG8;\r\n case 4:\r\n return this._gl.RGB8; // By default. Other possibilities are RGB565, SRGB8.\r\n case 5:\r\n return this._gl.RGBA8; // By default. Other possibilities are RGB5_A1, RGBA4, SRGB8_ALPHA8.\r\n case 8:\r\n return this._gl.R8UI;\r\n case 9:\r\n return this._gl.RG8UI;\r\n case 10:\r\n return this._gl.RGB8UI;\r\n case 11:\r\n return this._gl.RGBA8UI;\r\n case 0:\r\n return this._gl.ALPHA;\r\n case 1:\r\n return this._gl.LUMINANCE;\r\n case 2:\r\n return this._gl.LUMINANCE_ALPHA;\r\n default:\r\n return this._gl.RGBA8;\r\n }\r\n case 4:\r\n switch (format) {\r\n case 8:\r\n return this._gl.R16I;\r\n case 9:\r\n return this._gl.RG16I;\r\n case 10:\r\n return this._gl.RGB16I;\r\n case 11:\r\n return this._gl.RGBA16I;\r\n default:\r\n return this._gl.RGBA16I;\r\n }\r\n case 5:\r\n switch (format) {\r\n case 8:\r\n return this._gl.R16UI;\r\n case 9:\r\n return this._gl.RG16UI;\r\n case 10:\r\n return this._gl.RGB16UI;\r\n case 11:\r\n return this._gl.RGBA16UI;\r\n default:\r\n return this._gl.RGBA16UI;\r\n }\r\n case 6:\r\n switch (format) {\r\n case 8:\r\n return this._gl.R32I;\r\n case 9:\r\n return this._gl.RG32I;\r\n case 10:\r\n return this._gl.RGB32I;\r\n case 11:\r\n return this._gl.RGBA32I;\r\n default:\r\n return this._gl.RGBA32I;\r\n }\r\n case 7: // Refers to UNSIGNED_INT\r\n switch (format) {\r\n case 8:\r\n return this._gl.R32UI;\r\n case 9:\r\n return this._gl.RG32UI;\r\n case 10:\r\n return this._gl.RGB32UI;\r\n case 11:\r\n return this._gl.RGBA32UI;\r\n default:\r\n return this._gl.RGBA32UI;\r\n }\r\n case 1:\r\n switch (format) {\r\n case 6:\r\n return this._gl.R32F; // By default. Other possibility is R16F.\r\n case 7:\r\n return this._gl.RG32F; // By default. Other possibility is RG16F.\r\n case 4:\r\n return this._gl.RGB32F; // By default. Other possibilities are RGB16F, R11F_G11F_B10F, RGB9_E5.\r\n case 5:\r\n return this._gl.RGBA32F; // By default. Other possibility is RGBA16F.\r\n default:\r\n return this._gl.RGBA32F;\r\n }\r\n case 2:\r\n switch (format) {\r\n case 6:\r\n return this._gl.R16F;\r\n case 7:\r\n return this._gl.RG16F;\r\n case 4:\r\n return this._gl.RGB16F; // By default. Other possibilities are R11F_G11F_B10F, RGB9_E5.\r\n case 5:\r\n return this._gl.RGBA16F;\r\n default:\r\n return this._gl.RGBA16F;\r\n }\r\n case 10:\r\n return this._gl.RGB565;\r\n case 13:\r\n return this._gl.R11F_G11F_B10F;\r\n case 14:\r\n return this._gl.RGB9_E5;\r\n case 8:\r\n return this._gl.RGBA4;\r\n case 9:\r\n return this._gl.RGB5_A1;\r\n case 11:\r\n switch (format) {\r\n case 5:\r\n return this._gl.RGB10_A2; // By default. Other possibility is RGB5_A1.\r\n case 11:\r\n return this._gl.RGB10_A2UI;\r\n default:\r\n return this._gl.RGB10_A2;\r\n }\r\n }\r\n return this._gl.RGBA8;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getRGBAMultiSampleBufferFormat = function (type) {\r\n if (type === 1) {\r\n return this._gl.RGBA32F;\r\n }\r\n else if (type === 2) {\r\n return this._gl.RGBA16F;\r\n }\r\n return this._gl.RGBA8;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._loadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n var _this = this;\r\n var request = ThinEngine._FileToolsLoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\r\n this._activeRequests.push(request);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._activeRequests.splice(_this._activeRequests.indexOf(request), 1);\r\n });\r\n return request;\r\n };\r\n /**\r\n * Loads a file from a url\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n * @hidden\r\n */\r\n ThinEngine._FileToolsLoadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n throw _DevTools.WarnImport(\"FileTools\");\r\n };\r\n /**\r\n * Reads pixels from the current frame buffer. Please note that this function can be slow\r\n * @param x defines the x coordinate of the rectangle where pixels must be read\r\n * @param y defines the y coordinate of the rectangle where pixels must be read\r\n * @param width defines the width of the rectangle where pixels must be read\r\n * @param height defines the height of the rectangle where pixels must be read\r\n * @param hasAlpha defines whether the output should have alpha or not (defaults to true)\r\n * @returns a Uint8Array containing RGBA colors\r\n */\r\n ThinEngine.prototype.readPixels = function (x, y, width, height, hasAlpha) {\r\n if (hasAlpha === void 0) { hasAlpha = true; }\r\n var numChannels = hasAlpha ? 4 : 3;\r\n var format = hasAlpha ? this._gl.RGBA : this._gl.RGB;\r\n var data = new Uint8Array(height * width * numChannels);\r\n this._gl.readPixels(x, y, width, height, format, this._gl.UNSIGNED_BYTE, data);\r\n return data;\r\n };\r\n Object.defineProperty(ThinEngine, \"IsSupported\", {\r\n /**\r\n * Gets a boolean indicating if the engine can be instanciated (ie. if a webGL context can be found)\r\n */\r\n get: function () {\r\n return this.isSupported(); // Backward compat\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a boolean indicating if the engine can be instanciated (ie. if a webGL context can be found)\r\n * @returns true if the engine can be created\r\n * @ignorenaming\r\n */\r\n ThinEngine.isSupported = function () {\r\n if (this._HasMajorPerformanceCaveat !== null) {\r\n return !this._HasMajorPerformanceCaveat; // We know it is performant so WebGL is supported\r\n }\r\n if (this._IsSupported === null) {\r\n try {\r\n var tempcanvas = CanvasGenerator.CreateCanvas(1, 1);\r\n var gl = tempcanvas.getContext(\"webgl\") || tempcanvas.getContext(\"experimental-webgl\");\r\n this._IsSupported = gl != null && !!window.WebGLRenderingContext;\r\n }\r\n catch (e) {\r\n this._IsSupported = false;\r\n }\r\n }\r\n return this._IsSupported;\r\n };\r\n Object.defineProperty(ThinEngine, \"HasMajorPerformanceCaveat\", {\r\n /**\r\n * Gets a boolean indicating if the engine can be instanciated on a performant device (ie. if a webGL context can be found and it does not use a slow implementation)\r\n */\r\n get: function () {\r\n if (this._HasMajorPerformanceCaveat === null) {\r\n try {\r\n var tempcanvas = CanvasGenerator.CreateCanvas(1, 1);\r\n var gl = tempcanvas.getContext(\"webgl\", { failIfMajorPerformanceCaveat: true }) || tempcanvas.getContext(\"experimental-webgl\", { failIfMajorPerformanceCaveat: true });\r\n this._HasMajorPerformanceCaveat = !gl;\r\n }\r\n catch (e) {\r\n this._HasMajorPerformanceCaveat = false;\r\n }\r\n }\r\n return this._HasMajorPerformanceCaveat;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Find the next highest power of two.\r\n * @param x Number to start search from.\r\n * @return Next highest power of two.\r\n */\r\n ThinEngine.CeilingPOT = function (x) {\r\n x--;\r\n x |= x >> 1;\r\n x |= x >> 2;\r\n x |= x >> 4;\r\n x |= x >> 8;\r\n x |= x >> 16;\r\n x++;\r\n return x;\r\n };\r\n /**\r\n * Find the next lowest power of two.\r\n * @param x Number to start search from.\r\n * @return Next lowest power of two.\r\n */\r\n ThinEngine.FloorPOT = function (x) {\r\n x = x | (x >> 1);\r\n x = x | (x >> 2);\r\n x = x | (x >> 4);\r\n x = x | (x >> 8);\r\n x = x | (x >> 16);\r\n return x - (x >> 1);\r\n };\r\n /**\r\n * Find the nearest power of two.\r\n * @param x Number to start search from.\r\n * @return Next nearest power of two.\r\n */\r\n ThinEngine.NearestPOT = function (x) {\r\n var c = ThinEngine.CeilingPOT(x);\r\n var f = ThinEngine.FloorPOT(x);\r\n return (c - x) > (x - f) ? f : c;\r\n };\r\n /**\r\n * Get the closest exponent of two\r\n * @param value defines the value to approximate\r\n * @param max defines the maximum value to return\r\n * @param mode defines how to define the closest value\r\n * @returns closest exponent of two of the given value\r\n */\r\n ThinEngine.GetExponentOfTwo = function (value, max, mode) {\r\n if (mode === void 0) { mode = 2; }\r\n var pot;\r\n switch (mode) {\r\n case 1:\r\n pot = ThinEngine.FloorPOT(value);\r\n break;\r\n case 2:\r\n pot = ThinEngine.NearestPOT(value);\r\n break;\r\n case 3:\r\n default:\r\n pot = ThinEngine.CeilingPOT(value);\r\n break;\r\n }\r\n return Math.min(pot, max);\r\n };\r\n /**\r\n * Queue a new function into the requested animation frame pool (ie. this function will be executed byt the browser for the next frame)\r\n * @param func - the function to be called\r\n * @param requester - the object that will request the next frame. Falls back to window.\r\n * @returns frame number\r\n */\r\n ThinEngine.QueueNewFrame = function (func, requester) {\r\n if (!DomManagement.IsWindowObjectExist()) {\r\n if (typeof requestAnimationFrame !== \"undefined\") {\r\n return requestAnimationFrame(func);\r\n }\r\n return setTimeout(func, 16);\r\n }\r\n if (!requester) {\r\n requester = window;\r\n }\r\n if (requester.requestPostAnimationFrame) {\r\n return requester.requestPostAnimationFrame(func);\r\n }\r\n else if (requester.requestAnimationFrame) {\r\n return requester.requestAnimationFrame(func);\r\n }\r\n else if (requester.msRequestAnimationFrame) {\r\n return requester.msRequestAnimationFrame(func);\r\n }\r\n else if (requester.webkitRequestAnimationFrame) {\r\n return requester.webkitRequestAnimationFrame(func);\r\n }\r\n else if (requester.mozRequestAnimationFrame) {\r\n return requester.mozRequestAnimationFrame(func);\r\n }\r\n else if (requester.oRequestAnimationFrame) {\r\n return requester.oRequestAnimationFrame(func);\r\n }\r\n else {\r\n return window.setTimeout(func, 16);\r\n }\r\n };\r\n /**\r\n * Gets host document\r\n * @returns the host document object\r\n */\r\n ThinEngine.prototype.getHostDocument = function () {\r\n if (this._renderingCanvas && this._renderingCanvas.ownerDocument) {\r\n return this._renderingCanvas.ownerDocument;\r\n }\r\n return document;\r\n };\r\n /** Use this array to turn off some WebGL2 features on known buggy browsers version */\r\n ThinEngine.ExceptionList = [\r\n { key: \"Chrome\\/63\\.0\", capture: \"63\\\\.0\\\\.3239\\\\.(\\\\d+)\", captureConstraint: 108, targets: [\"uniformBuffer\"] },\r\n { key: \"Firefox\\/58\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\r\n { key: \"Firefox\\/59\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\r\n { key: \"Chrome\\/72.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Chrome\\/73.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Chrome\\/74.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Mac OS.+Chrome\\/71\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Mac OS.+Chrome\\/72\", capture: null, captureConstraint: null, targets: [\"vao\"] }\r\n ];\r\n /** @hidden */\r\n ThinEngine._TextureLoaders = [];\r\n // Updatable statics so stick with vars here\r\n /**\r\n * Gets or sets the epsilon value used by collision engine\r\n */\r\n ThinEngine.CollisionsEpsilon = 0.001;\r\n // Statics\r\n ThinEngine._IsSupported = null;\r\n ThinEngine._HasMajorPerformanceCaveat = null;\r\n return ThinEngine;\r\n}());\r\nexport { ThinEngine };\r\n//# sourceMappingURL=thinEngine.js.map","/**\r\n * Gather the list of clipboard event types as constants.\r\n */\r\nvar ClipboardEventTypes = /** @class */ (function () {\r\n function ClipboardEventTypes() {\r\n }\r\n /**\r\n * The clipboard event is fired when a copy command is active (pressed).\r\n */\r\n ClipboardEventTypes.COPY = 0x01; //\r\n /**\r\n * The clipboard event is fired when a cut command is active (pressed).\r\n */\r\n ClipboardEventTypes.CUT = 0x02;\r\n /**\r\n * The clipboard event is fired when a paste command is active (pressed).\r\n */\r\n ClipboardEventTypes.PASTE = 0x03;\r\n return ClipboardEventTypes;\r\n}());\r\nexport { ClipboardEventTypes };\r\n/**\r\n * This class is used to store clipboard related info for the onClipboardObservable event.\r\n */\r\nvar ClipboardInfo = /** @class */ (function () {\r\n /**\r\n *Creates an instance of ClipboardInfo.\r\n * @param type Defines the type of event (BABYLON.ClipboardEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function ClipboardInfo(\r\n /**\r\n * Defines the type of event (BABYLON.ClipboardEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n this.type = type;\r\n this.event = event;\r\n }\r\n /**\r\n * Get the clipboard event's type from the keycode.\r\n * @param keyCode Defines the keyCode for the current keyboard event.\r\n * @return {number}\r\n */\r\n ClipboardInfo.GetTypeFromCharacter = function (keyCode) {\r\n var charCode = keyCode;\r\n //TODO: add codes for extended ASCII\r\n switch (charCode) {\r\n case 67: return ClipboardEventTypes.COPY;\r\n case 86: return ClipboardEventTypes.PASTE;\r\n case 88: return ClipboardEventTypes.CUT;\r\n default: return -1;\r\n }\r\n };\r\n return ClipboardInfo;\r\n}());\r\nexport { ClipboardInfo };\r\n//# sourceMappingURL=clipboardEvents.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * Gather the list of keyboard event types as constants.\r\n */\r\nvar KeyboardEventTypes = /** @class */ (function () {\r\n function KeyboardEventTypes() {\r\n }\r\n /**\r\n * The keydown event is fired when a key becomes active (pressed).\r\n */\r\n KeyboardEventTypes.KEYDOWN = 0x01;\r\n /**\r\n * The keyup event is fired when a key has been released.\r\n */\r\n KeyboardEventTypes.KEYUP = 0x02;\r\n return KeyboardEventTypes;\r\n}());\r\nexport { KeyboardEventTypes };\r\n/**\r\n * This class is used to store keyboard related info for the onKeyboardObservable event.\r\n */\r\nvar KeyboardInfo = /** @class */ (function () {\r\n /**\r\n * Instantiates a new keyboard info.\r\n * This class is used to store keyboard related info for the onKeyboardObservable event.\r\n * @param type Defines the type of event (KeyboardEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function KeyboardInfo(\r\n /**\r\n * Defines the type of event (KeyboardEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n this.type = type;\r\n this.event = event;\r\n }\r\n return KeyboardInfo;\r\n}());\r\nexport { KeyboardInfo };\r\n/**\r\n * This class is used to store keyboard related info for the onPreKeyboardObservable event.\r\n * Set the skipOnKeyboardObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onKeyboardObservable\r\n */\r\nvar KeyboardInfoPre = /** @class */ (function (_super) {\r\n __extends(KeyboardInfoPre, _super);\r\n /**\r\n * Instantiates a new keyboard pre info.\r\n * This class is used to store keyboard related info for the onPreKeyboardObservable event.\r\n * @param type Defines the type of event (KeyboardEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function KeyboardInfoPre(\r\n /**\r\n * Defines the type of event (KeyboardEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n var _this = _super.call(this, type, event) || this;\r\n _this.type = type;\r\n _this.event = event;\r\n _this.skipOnPointerObservable = false;\r\n return _this;\r\n }\r\n return KeyboardInfoPre;\r\n}(KeyboardInfo));\r\nexport { KeyboardInfoPre };\r\n//# sourceMappingURL=keyboardEvents.js.map","import { __extends } from \"tslib\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\n/**\r\n * Gather the list of pointer event types as constants.\r\n */\r\nvar PointerEventTypes = /** @class */ (function () {\r\n function PointerEventTypes() {\r\n }\r\n /**\r\n * The pointerdown event is fired when a pointer becomes active. For mouse, it is fired when the device transitions from no buttons depressed to at least one button depressed. For touch, it is fired when physical contact is made with the digitizer. For pen, it is fired when the stylus makes physical contact with the digitizer.\r\n */\r\n PointerEventTypes.POINTERDOWN = 0x01;\r\n /**\r\n * The pointerup event is fired when a pointer is no longer active.\r\n */\r\n PointerEventTypes.POINTERUP = 0x02;\r\n /**\r\n * The pointermove event is fired when a pointer changes coordinates.\r\n */\r\n PointerEventTypes.POINTERMOVE = 0x04;\r\n /**\r\n * The pointerwheel event is fired when a mouse wheel has been rotated.\r\n */\r\n PointerEventTypes.POINTERWHEEL = 0x08;\r\n /**\r\n * The pointerpick event is fired when a mesh or sprite has been picked by the pointer.\r\n */\r\n PointerEventTypes.POINTERPICK = 0x10;\r\n /**\r\n * The pointertap event is fired when a the object has been touched and released without drag.\r\n */\r\n PointerEventTypes.POINTERTAP = 0x20;\r\n /**\r\n * The pointerdoubletap event is fired when a the object has been touched and released twice without drag.\r\n */\r\n PointerEventTypes.POINTERDOUBLETAP = 0x40;\r\n return PointerEventTypes;\r\n}());\r\nexport { PointerEventTypes };\r\n/**\r\n * Base class of pointer info types.\r\n */\r\nvar PointerInfoBase = /** @class */ (function () {\r\n /**\r\n * Instantiates the base class of pointers info.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n */\r\n function PointerInfoBase(\r\n /**\r\n * Defines the type of event (PointerEventTypes)\r\n */\r\n type, \r\n /**\r\n * Defines the related dom event\r\n */\r\n event) {\r\n this.type = type;\r\n this.event = event;\r\n }\r\n return PointerInfoBase;\r\n}());\r\nexport { PointerInfoBase };\r\n/**\r\n * This class is used to store pointer related info for the onPrePointerObservable event.\r\n * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable\r\n */\r\nvar PointerInfoPre = /** @class */ (function (_super) {\r\n __extends(PointerInfoPre, _super);\r\n /**\r\n * Instantiates a PointerInfoPre to store pointer related info to the onPrePointerObservable event.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n * @param localX Defines the local x coordinates of the pointer when the event occured\r\n * @param localY Defines the local y coordinates of the pointer when the event occured\r\n */\r\n function PointerInfoPre(type, event, localX, localY) {\r\n var _this = _super.call(this, type, event) || this;\r\n /**\r\n * Ray from a pointer if availible (eg. 6dof controller)\r\n */\r\n _this.ray = null;\r\n _this.skipOnPointerObservable = false;\r\n _this.localPosition = new Vector2(localX, localY);\r\n return _this;\r\n }\r\n return PointerInfoPre;\r\n}(PointerInfoBase));\r\nexport { PointerInfoPre };\r\n/**\r\n * This type contains all the data related to a pointer event in Babylon.js.\r\n * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.\r\n */\r\nvar PointerInfo = /** @class */ (function (_super) {\r\n __extends(PointerInfo, _super);\r\n /**\r\n * Instantiates a PointerInfo to store pointer related info to the onPointerObservable event.\r\n * @param type Defines the type of event (PointerEventTypes)\r\n * @param event Defines the related dom event\r\n * @param pickInfo Defines the picking info associated to the info (if any)\\\r\n */\r\n function PointerInfo(type, event, \r\n /**\r\n * Defines the picking info associated to the info (if any)\\\r\n */\r\n pickInfo) {\r\n var _this = _super.call(this, type, event) || this;\r\n _this.pickInfo = pickInfo;\r\n return _this;\r\n }\r\n return PointerInfo;\r\n}(PointerInfoBase));\r\nexport { PointerInfo };\r\n//# sourceMappingURL=pointerEvents.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serializeAsColor3, serializeAsVector3 } from \"../Misc/decorators\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport { Node } from \"../node\";\r\nimport { Light } from \"./light\";\r\nNode.AddNodeConstructor(\"Light_Type_3\", function (name, scene) {\r\n return function () { return new HemisphericLight(name, Vector3.Zero(), scene); };\r\n});\r\n/**\r\n * The HemisphericLight simulates the ambient environment light,\r\n * so the passed direction is the light reflection direction, not the incoming direction.\r\n */\r\nvar HemisphericLight = /** @class */ (function (_super) {\r\n __extends(HemisphericLight, _super);\r\n /**\r\n * Creates a HemisphericLight object in the scene according to the passed direction (Vector3).\r\n * The HemisphericLight simulates the ambient environment light, so the passed direction is the light reflection direction, not the incoming direction.\r\n * The HemisphericLight can't cast shadows.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The friendly name of the light\r\n * @param direction The direction of the light reflection\r\n * @param scene The scene the light belongs to\r\n */\r\n function HemisphericLight(name, direction, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * The groundColor is the light in the opposite direction to the one specified during creation.\r\n * You can think of the diffuse and specular light as coming from the centre of the object in the given direction and the groundColor light in the opposite direction.\r\n */\r\n _this.groundColor = new Color3(0.0, 0.0, 0.0);\r\n _this.direction = direction || Vector3.Up();\r\n return _this;\r\n }\r\n HemisphericLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"vLightGround\", 3);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n /**\r\n * Returns the string \"HemisphericLight\".\r\n * @return The class name\r\n */\r\n HemisphericLight.prototype.getClassName = function () {\r\n return \"HemisphericLight\";\r\n };\r\n /**\r\n * Sets the HemisphericLight direction towards the passed target (Vector3).\r\n * Returns the updated direction.\r\n * @param target The target the direction should point to\r\n * @return The computed direction\r\n */\r\n HemisphericLight.prototype.setDirectionToTarget = function (target) {\r\n this.direction = Vector3.Normalize(target.subtract(Vector3.Zero()));\r\n return this.direction;\r\n };\r\n /**\r\n * Returns the shadow generator associated to the light.\r\n * @returns Always null for hemispheric lights because it does not support shadows.\r\n */\r\n HemisphericLight.prototype.getShadowGenerator = function () {\r\n return null;\r\n };\r\n /**\r\n * Sets the passed Effect object with the HemisphericLight normalized direction and color and the passed name (string).\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The hemispheric light\r\n */\r\n HemisphericLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n var normalizeDirection = Vector3.Normalize(this.direction);\r\n this._uniformBuffer.updateFloat4(\"vLightData\", normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, 0.0, lightIndex);\r\n this._uniformBuffer.updateColor3(\"vLightGround\", this.groundColor.scale(this.intensity), lightIndex);\r\n return this;\r\n };\r\n HemisphericLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n var normalizeDirection = Vector3.Normalize(this.direction);\r\n effect.setFloat3(lightDataUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z);\r\n return this;\r\n };\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @param useWasUpdatedFlag defines a reserved property\r\n * @returns the world matrix\r\n */\r\n HemisphericLight.prototype.computeWorldMatrix = function () {\r\n if (!this._worldMatrix) {\r\n this._worldMatrix = Matrix.Identity();\r\n }\r\n return this._worldMatrix;\r\n };\r\n /**\r\n * Returns the integer 3.\r\n * @return The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n HemisphericLight.prototype.getTypeID = function () {\r\n return Light.LIGHTTYPEID_HEMISPHERICLIGHT;\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n HemisphericLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"HEMILIGHT\" + lightIndex] = true;\r\n };\r\n __decorate([\r\n serializeAsColor3()\r\n ], HemisphericLight.prototype, \"groundColor\", void 0);\r\n __decorate([\r\n serializeAsVector3()\r\n ], HemisphericLight.prototype, \"direction\", void 0);\r\n return HemisphericLight;\r\n}(Light));\r\nexport { HemisphericLight };\r\n//# sourceMappingURL=hemisphericLight.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, SerializationHelper, serializeAsColor3, expandToProperty } from \"../Misc/decorators\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color3, TmpColors } from \"../Maths/math.color\";\r\nimport { Node } from \"../node\";\r\nimport { UniformBuffer } from \"../Materials/uniformBuffer\";\r\nimport { _TypeStore } from '../Misc/typeStore';\r\n/**\r\n * Base class of all the lights in Babylon. It groups all the generic information about lights.\r\n * Lights are used, as you would expect, to affect how meshes are seen, in terms of both illumination and colour.\r\n * All meshes allow light to pass through them unless shadow generation is activated. The default number of lights allowed is four but this can be increased.\r\n */\r\nvar Light = /** @class */ (function (_super) {\r\n __extends(Light, _super);\r\n /**\r\n * Creates a Light object in the scene.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The firendly name of the light\r\n * @param scene The scene the light belongs too\r\n */\r\n function Light(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Diffuse gives the basic color to an object.\r\n */\r\n _this.diffuse = new Color3(1.0, 1.0, 1.0);\r\n /**\r\n * Specular produces a highlight color on an object.\r\n * Note: This is note affecting PBR materials.\r\n */\r\n _this.specular = new Color3(1.0, 1.0, 1.0);\r\n /**\r\n * Defines the falloff type for this light. This lets overrriding how punctual light are\r\n * falling off base on range or angle.\r\n * This can be set to any values in Light.FALLOFF_x.\r\n *\r\n * Note: This is only useful for PBR Materials at the moment. This could be extended if required to\r\n * other types of materials.\r\n */\r\n _this.falloffType = Light.FALLOFF_DEFAULT;\r\n /**\r\n * Strength of the light.\r\n * Note: By default it is define in the framework own unit.\r\n * Note: In PBR materials the intensityMode can be use to chose what unit the intensity is defined in.\r\n */\r\n _this.intensity = 1.0;\r\n _this._range = Number.MAX_VALUE;\r\n _this._inverseSquaredRange = 0;\r\n /**\r\n * Cached photometric scale default to 1.0 as the automatic intensity mode defaults to 1.0 for every type\r\n * of light.\r\n */\r\n _this._photometricScale = 1.0;\r\n _this._intensityMode = Light.INTENSITYMODE_AUTOMATIC;\r\n _this._radius = 0.00001;\r\n /**\r\n * Defines the rendering priority of the lights. It can help in case of fallback or number of lights\r\n * exceeding the number allowed of the materials.\r\n */\r\n _this.renderPriority = 0;\r\n _this._shadowEnabled = true;\r\n _this._excludeWithLayerMask = 0;\r\n _this._includeOnlyWithLayerMask = 0;\r\n _this._lightmapMode = 0;\r\n /**\r\n * @hidden Internal use only.\r\n */\r\n _this._excludedMeshesIds = new Array();\r\n /**\r\n * @hidden Internal use only.\r\n */\r\n _this._includedOnlyMeshesIds = new Array();\r\n /** @hidden */\r\n _this._isLight = true;\r\n _this.getScene().addLight(_this);\r\n _this._uniformBuffer = new UniformBuffer(_this.getScene().getEngine());\r\n _this._buildUniformLayout();\r\n _this.includedOnlyMeshes = new Array();\r\n _this.excludedMeshes = new Array();\r\n _this._resyncMeshes();\r\n return _this;\r\n }\r\n Object.defineProperty(Light.prototype, \"range\", {\r\n /**\r\n * Defines how far from the source the light is impacting in scene units.\r\n * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.\r\n */\r\n get: function () {\r\n return this._range;\r\n },\r\n /**\r\n * Defines how far from the source the light is impacting in scene units.\r\n * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.\r\n */\r\n set: function (value) {\r\n this._range = value;\r\n this._inverseSquaredRange = 1.0 / (this.range * this.range);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"intensityMode\", {\r\n /**\r\n * Gets the photometric scale used to interpret the intensity.\r\n * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.\r\n */\r\n get: function () {\r\n return this._intensityMode;\r\n },\r\n /**\r\n * Sets the photometric scale used to interpret the intensity.\r\n * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.\r\n */\r\n set: function (value) {\r\n this._intensityMode = value;\r\n this._computePhotometricScale();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"radius\", {\r\n /**\r\n * Gets the light radius used by PBR Materials to simulate soft area lights.\r\n */\r\n get: function () {\r\n return this._radius;\r\n },\r\n /**\r\n * sets the light radius used by PBR Materials to simulate soft area lights.\r\n */\r\n set: function (value) {\r\n this._radius = value;\r\n this._computePhotometricScale();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"shadowEnabled\", {\r\n /**\r\n * Gets wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching\r\n * the current shadow generator.\r\n */\r\n get: function () {\r\n return this._shadowEnabled;\r\n },\r\n /**\r\n * Sets wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching\r\n * the current shadow generator.\r\n */\r\n set: function (value) {\r\n if (this._shadowEnabled === value) {\r\n return;\r\n }\r\n this._shadowEnabled = value;\r\n this._markMeshesAsLightDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"includedOnlyMeshes\", {\r\n /**\r\n * Gets the only meshes impacted by this light.\r\n */\r\n get: function () {\r\n return this._includedOnlyMeshes;\r\n },\r\n /**\r\n * Sets the only meshes impacted by this light.\r\n */\r\n set: function (value) {\r\n this._includedOnlyMeshes = value;\r\n this._hookArrayForIncludedOnly(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"excludedMeshes\", {\r\n /**\r\n * Gets the meshes not impacted by this light.\r\n */\r\n get: function () {\r\n return this._excludedMeshes;\r\n },\r\n /**\r\n * Sets the meshes not impacted by this light.\r\n */\r\n set: function (value) {\r\n this._excludedMeshes = value;\r\n this._hookArrayForExcluded(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"excludeWithLayerMask\", {\r\n /**\r\n * Gets the layer id use to find what meshes are not impacted by the light.\r\n * Inactive if 0\r\n */\r\n get: function () {\r\n return this._excludeWithLayerMask;\r\n },\r\n /**\r\n * Sets the layer id use to find what meshes are not impacted by the light.\r\n * Inactive if 0\r\n */\r\n set: function (value) {\r\n this._excludeWithLayerMask = value;\r\n this._resyncMeshes();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"includeOnlyWithLayerMask\", {\r\n /**\r\n * Gets the layer id use to find what meshes are impacted by the light.\r\n * Inactive if 0\r\n */\r\n get: function () {\r\n return this._includeOnlyWithLayerMask;\r\n },\r\n /**\r\n * Sets the layer id use to find what meshes are impacted by the light.\r\n * Inactive if 0\r\n */\r\n set: function (value) {\r\n this._includeOnlyWithLayerMask = value;\r\n this._resyncMeshes();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Light.prototype, \"lightmapMode\", {\r\n /**\r\n * Gets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)\r\n */\r\n get: function () {\r\n return this._lightmapMode;\r\n },\r\n /**\r\n * Sets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)\r\n */\r\n set: function (value) {\r\n if (this._lightmapMode === value) {\r\n return;\r\n }\r\n this._lightmapMode = value;\r\n this._markMeshesAsLightDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the passed Effect \"effect\" with the Light textures.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The light\r\n */\r\n Light.prototype.transferTexturesToEffect = function (effect, lightIndex) {\r\n // Do nothing by default.\r\n return this;\r\n };\r\n /**\r\n * Binds the lights information from the scene to the effect for the given mesh.\r\n * @param lightIndex Light index\r\n * @param scene The scene where the light belongs to\r\n * @param effect The effect we are binding the data to\r\n * @param useSpecular Defines if specular is supported\r\n * @param rebuildInParallel Specifies whether the shader is rebuilding in parallel\r\n */\r\n Light.prototype._bindLight = function (lightIndex, scene, effect, useSpecular, rebuildInParallel) {\r\n if (rebuildInParallel === void 0) { rebuildInParallel = false; }\r\n var iAsString = lightIndex.toString();\r\n var needUpdate = false;\r\n if (rebuildInParallel && this._uniformBuffer._alreadyBound) {\r\n return;\r\n }\r\n this._uniformBuffer.bindToEffect(effect, \"Light\" + iAsString);\r\n if (this._renderId !== scene.getRenderId() || !this._uniformBuffer.useUbo) {\r\n this._renderId = scene.getRenderId();\r\n var scaledIntensity = this.getScaledIntensity();\r\n this.transferToEffect(effect, iAsString);\r\n this.diffuse.scaleToRef(scaledIntensity, TmpColors.Color3[0]);\r\n this._uniformBuffer.updateColor4(\"vLightDiffuse\", TmpColors.Color3[0], this.range, iAsString);\r\n if (useSpecular) {\r\n this.specular.scaleToRef(scaledIntensity, TmpColors.Color3[1]);\r\n this._uniformBuffer.updateColor4(\"vLightSpecular\", TmpColors.Color3[1], this.radius, iAsString);\r\n }\r\n needUpdate = true;\r\n }\r\n // Textures might still need to be rebound.\r\n this.transferTexturesToEffect(effect, iAsString);\r\n // Shadows\r\n if (scene.shadowsEnabled && this.shadowEnabled) {\r\n var shadowGenerator = this.getShadowGenerator();\r\n if (shadowGenerator) {\r\n shadowGenerator.bindShadowLight(iAsString, effect);\r\n needUpdate = true;\r\n }\r\n }\r\n if (needUpdate) {\r\n this._uniformBuffer.update();\r\n }\r\n };\r\n /**\r\n * Returns the string \"Light\".\r\n * @returns the class name\r\n */\r\n Light.prototype.getClassName = function () {\r\n return \"Light\";\r\n };\r\n /**\r\n * Converts the light information to a readable string for debug purpose.\r\n * @param fullDetails Supports for multiple levels of logging within scene loading\r\n * @returns the human readable light info\r\n */\r\n Light.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n ret += \", type: \" + ([\"Point\", \"Directional\", \"Spot\", \"Hemispheric\"])[this.getTypeID()];\r\n if (this.animations) {\r\n for (var i = 0; i < this.animations.length; i++) {\r\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\r\n }\r\n }\r\n if (fullDetails) {\r\n }\r\n return ret;\r\n };\r\n /** @hidden */\r\n Light.prototype._syncParentEnabledState = function () {\r\n _super.prototype._syncParentEnabledState.call(this);\r\n if (!this.isDisposed()) {\r\n this._resyncMeshes();\r\n }\r\n };\r\n /**\r\n * Set the enabled state of this node.\r\n * @param value - the new enabled state\r\n */\r\n Light.prototype.setEnabled = function (value) {\r\n _super.prototype.setEnabled.call(this, value);\r\n this._resyncMeshes();\r\n };\r\n /**\r\n * Returns the Light associated shadow generator if any.\r\n * @return the associated shadow generator.\r\n */\r\n Light.prototype.getShadowGenerator = function () {\r\n return this._shadowGenerator;\r\n };\r\n /**\r\n * Returns a Vector3, the absolute light position in the World.\r\n * @returns the world space position of the light\r\n */\r\n Light.prototype.getAbsolutePosition = function () {\r\n return Vector3.Zero();\r\n };\r\n /**\r\n * Specifies if the light will affect the passed mesh.\r\n * @param mesh The mesh to test against the light\r\n * @return true the mesh is affected otherwise, false.\r\n */\r\n Light.prototype.canAffectMesh = function (mesh) {\r\n if (!mesh) {\r\n return true;\r\n }\r\n if (this.includedOnlyMeshes && this.includedOnlyMeshes.length > 0 && this.includedOnlyMeshes.indexOf(mesh) === -1) {\r\n return false;\r\n }\r\n if (this.excludedMeshes && this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {\r\n return false;\r\n }\r\n if (this.includeOnlyWithLayerMask !== 0 && (this.includeOnlyWithLayerMask & mesh.layerMask) === 0) {\r\n return false;\r\n }\r\n if (this.excludeWithLayerMask !== 0 && this.excludeWithLayerMask & mesh.layerMask) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Sort function to order lights for rendering.\r\n * @param a First Light object to compare to second.\r\n * @param b Second Light object to compare first.\r\n * @return -1 to reduce's a's index relative to be, 0 for no change, 1 to increase a's index relative to b.\r\n */\r\n Light.CompareLightsPriority = function (a, b) {\r\n //shadow-casting lights have priority over non-shadow-casting lights\r\n //the renderPrioirty is a secondary sort criterion\r\n if (a.shadowEnabled !== b.shadowEnabled) {\r\n return (b.shadowEnabled ? 1 : 0) - (a.shadowEnabled ? 1 : 0);\r\n }\r\n return b.renderPriority - a.renderPriority;\r\n };\r\n /**\r\n * Releases resources associated with this node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n Light.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n if (this._shadowGenerator) {\r\n this._shadowGenerator.dispose();\r\n this._shadowGenerator = null;\r\n }\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from meshes\r\n for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._removeLightSource(this, true);\r\n }\r\n this._uniformBuffer.dispose();\r\n // Remove from scene\r\n this.getScene().removeLight(this);\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Returns the light type ID (integer).\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n Light.prototype.getTypeID = function () {\r\n return 0;\r\n };\r\n /**\r\n * Returns the intensity scaled by the Photometric Scale according to the light type and intensity mode.\r\n * @returns the scaled intensity in intensity mode unit\r\n */\r\n Light.prototype.getScaledIntensity = function () {\r\n return this._photometricScale * this.intensity;\r\n };\r\n /**\r\n * Returns a new Light object, named \"name\", from the current one.\r\n * @param name The name of the cloned light\r\n * @param newParent The parent of this light, if it has one\r\n * @returns the new created light\r\n */\r\n Light.prototype.clone = function (name, newParent) {\r\n if (newParent === void 0) { newParent = null; }\r\n var constructor = Light.GetConstructorFromName(this.getTypeID(), name, this.getScene());\r\n if (!constructor) {\r\n return null;\r\n }\r\n var clonedLight = SerializationHelper.Clone(constructor, this);\r\n if (newParent) {\r\n clonedLight.parent = newParent;\r\n }\r\n clonedLight.setEnabled(this.isEnabled());\r\n return clonedLight;\r\n };\r\n /**\r\n * Serializes the current light into a Serialization object.\r\n * @returns the serialized object.\r\n */\r\n Light.prototype.serialize = function () {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n // Type\r\n serializationObject.type = this.getTypeID();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n // Inclusion / exclusions\r\n if (this.excludedMeshes.length > 0) {\r\n serializationObject.excludedMeshesIds = [];\r\n this.excludedMeshes.forEach(function (mesh) {\r\n serializationObject.excludedMeshesIds.push(mesh.id);\r\n });\r\n }\r\n if (this.includedOnlyMeshes.length > 0) {\r\n serializationObject.includedOnlyMeshesIds = [];\r\n this.includedOnlyMeshes.forEach(function (mesh) {\r\n serializationObject.includedOnlyMeshesIds.push(mesh.id);\r\n });\r\n }\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n serializationObject.ranges = this.serializeAnimationRanges();\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a new typed light from the passed type (integer) : point light = 0, directional light = 1, spot light = 2, hemispheric light = 3.\r\n * This new light is named \"name\" and added to the passed scene.\r\n * @param type Type according to the types available in Light.LIGHTTYPEID_x\r\n * @param name The friendly name of the light\r\n * @param scene The scene the new light will belong to\r\n * @returns the constructor function\r\n */\r\n Light.GetConstructorFromName = function (type, name, scene) {\r\n var constructorFunc = Node.Construct(\"Light_Type_\" + type, name, scene);\r\n if (constructorFunc) {\r\n return constructorFunc;\r\n }\r\n // Default to no light for none present once.\r\n return null;\r\n };\r\n /**\r\n * Parses the passed \"parsedLight\" and returns a new instanced Light from this parsing.\r\n * @param parsedLight The JSON representation of the light\r\n * @param scene The scene to create the parsed light in\r\n * @returns the created light after parsing\r\n */\r\n Light.Parse = function (parsedLight, scene) {\r\n var constructor = Light.GetConstructorFromName(parsedLight.type, parsedLight.name, scene);\r\n if (!constructor) {\r\n return null;\r\n }\r\n var light = SerializationHelper.Parse(constructor, parsedLight, scene);\r\n // Inclusion / exclusions\r\n if (parsedLight.excludedMeshesIds) {\r\n light._excludedMeshesIds = parsedLight.excludedMeshesIds;\r\n }\r\n if (parsedLight.includedOnlyMeshesIds) {\r\n light._includedOnlyMeshesIds = parsedLight.includedOnlyMeshesIds;\r\n }\r\n // Parent\r\n if (parsedLight.parentId) {\r\n light._waitingParentId = parsedLight.parentId;\r\n }\r\n // Falloff\r\n if (parsedLight.falloffType !== undefined) {\r\n light.falloffType = parsedLight.falloffType;\r\n }\r\n // Lightmaps\r\n if (parsedLight.lightmapMode !== undefined) {\r\n light.lightmapMode = parsedLight.lightmapMode;\r\n }\r\n // Animations\r\n if (parsedLight.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedLight.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedLight.animations[animationIndex];\r\n var internalClass = _TypeStore.GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n light.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n Node.ParseAnimationRanges(light, parsedLight, scene);\r\n }\r\n if (parsedLight.autoAnimate) {\r\n scene.beginAnimation(light, parsedLight.autoAnimateFrom, parsedLight.autoAnimateTo, parsedLight.autoAnimateLoop, parsedLight.autoAnimateSpeed || 1.0);\r\n }\r\n return light;\r\n };\r\n Light.prototype._hookArrayForExcluded = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var result = oldPush.apply(array, items);\r\n for (var _a = 0, items_1 = items; _a < items_1.length; _a++) {\r\n var item = items_1[_a];\r\n item._resyncLightSource(_this);\r\n }\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n for (var _i = 0, deleted_1 = deleted; _i < deleted_1.length; _i++) {\r\n var item = deleted_1[_i];\r\n item._resyncLightSource(_this);\r\n }\r\n return deleted;\r\n };\r\n for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {\r\n var item = array_1[_i];\r\n item._resyncLightSource(this);\r\n }\r\n };\r\n Light.prototype._hookArrayForIncludedOnly = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var result = oldPush.apply(array, items);\r\n _this._resyncMeshes();\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n _this._resyncMeshes();\r\n return deleted;\r\n };\r\n this._resyncMeshes();\r\n };\r\n Light.prototype._resyncMeshes = function () {\r\n for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._resyncLightSource(this);\r\n }\r\n };\r\n /**\r\n * Forces the meshes to update their light related information in their rendering used effects\r\n * @hidden Internal Use Only\r\n */\r\n Light.prototype._markMeshesAsLightDirty = function () {\r\n for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n if (mesh.lightSources.indexOf(this) !== -1) {\r\n mesh._markSubMeshesAsLightDirty();\r\n }\r\n }\r\n };\r\n /**\r\n * Recomputes the cached photometric scale if needed.\r\n */\r\n Light.prototype._computePhotometricScale = function () {\r\n this._photometricScale = this._getPhotometricScale();\r\n this.getScene().resetCachedMaterial();\r\n };\r\n /**\r\n * Returns the Photometric Scale according to the light type and intensity mode.\r\n */\r\n Light.prototype._getPhotometricScale = function () {\r\n var photometricScale = 0.0;\r\n var lightTypeID = this.getTypeID();\r\n //get photometric mode\r\n var photometricMode = this.intensityMode;\r\n if (photometricMode === Light.INTENSITYMODE_AUTOMATIC) {\r\n if (lightTypeID === Light.LIGHTTYPEID_DIRECTIONALLIGHT) {\r\n photometricMode = Light.INTENSITYMODE_ILLUMINANCE;\r\n }\r\n else {\r\n photometricMode = Light.INTENSITYMODE_LUMINOUSINTENSITY;\r\n }\r\n }\r\n //compute photometric scale\r\n switch (lightTypeID) {\r\n case Light.LIGHTTYPEID_POINTLIGHT:\r\n case Light.LIGHTTYPEID_SPOTLIGHT:\r\n switch (photometricMode) {\r\n case Light.INTENSITYMODE_LUMINOUSPOWER:\r\n photometricScale = 1.0 / (4.0 * Math.PI);\r\n break;\r\n case Light.INTENSITYMODE_LUMINOUSINTENSITY:\r\n photometricScale = 1.0;\r\n break;\r\n case Light.INTENSITYMODE_LUMINANCE:\r\n photometricScale = this.radius * this.radius;\r\n break;\r\n }\r\n break;\r\n case Light.LIGHTTYPEID_DIRECTIONALLIGHT:\r\n switch (photometricMode) {\r\n case Light.INTENSITYMODE_ILLUMINANCE:\r\n photometricScale = 1.0;\r\n break;\r\n case Light.INTENSITYMODE_LUMINANCE:\r\n // When radius (and therefore solid angle) is non-zero a directional lights brightness can be specified via central (peak) luminance.\r\n // For a directional light the 'radius' defines the angular radius (in radians) rather than world-space radius (e.g. in metres).\r\n var apexAngleRadians = this.radius;\r\n // Impose a minimum light angular size to avoid the light becoming an infinitely small angular light source (i.e. a dirac delta function).\r\n apexAngleRadians = Math.max(apexAngleRadians, 0.001);\r\n var solidAngle = 2.0 * Math.PI * (1.0 - Math.cos(apexAngleRadians));\r\n photometricScale = solidAngle;\r\n break;\r\n }\r\n break;\r\n case Light.LIGHTTYPEID_HEMISPHERICLIGHT:\r\n // No fall off in hemisperic light.\r\n photometricScale = 1.0;\r\n break;\r\n }\r\n return photometricScale;\r\n };\r\n /**\r\n * Reorder the light in the scene according to their defined priority.\r\n * @hidden Internal Use Only\r\n */\r\n Light.prototype._reorderLightsInScene = function () {\r\n var scene = this.getScene();\r\n if (this._renderPriority != 0) {\r\n scene.requireLightSorting = true;\r\n }\r\n this.getScene().sortLightsByPriority();\r\n };\r\n /**\r\n * Falloff Default: light is falling off following the material specification:\r\n * standard material is using standard falloff whereas pbr material can request special falloff per materials.\r\n */\r\n Light.FALLOFF_DEFAULT = 0;\r\n /**\r\n * Falloff Physical: light is falling off following the inverse squared distance law.\r\n */\r\n Light.FALLOFF_PHYSICAL = 1;\r\n /**\r\n * Falloff gltf: light is falling off as described in the gltf moving to PBR document\r\n * to enhance interoperability with other engines.\r\n */\r\n Light.FALLOFF_GLTF = 2;\r\n /**\r\n * Falloff Standard: light is falling off like in the standard material\r\n * to enhance interoperability with other materials.\r\n */\r\n Light.FALLOFF_STANDARD = 3;\r\n //lightmapMode Consts\r\n /**\r\n * If every light affecting the material is in this lightmapMode,\r\n * material.lightmapTexture adds or multiplies\r\n * (depends on material.useLightmapAsShadowmap)\r\n * after every other light calculations.\r\n */\r\n Light.LIGHTMAP_DEFAULT = 0;\r\n /**\r\n * material.lightmapTexture as only diffuse lighting from this light\r\n * adds only specular lighting from this light\r\n * adds dynamic shadows\r\n */\r\n Light.LIGHTMAP_SPECULAR = 1;\r\n /**\r\n * material.lightmapTexture as only lighting\r\n * no light calculation from this light\r\n * only adds dynamic shadows from this light\r\n */\r\n Light.LIGHTMAP_SHADOWSONLY = 2;\r\n // Intensity Mode Consts\r\n /**\r\n * Each light type uses the default quantity according to its type:\r\n * point/spot lights use luminous intensity\r\n * directional lights use illuminance\r\n */\r\n Light.INTENSITYMODE_AUTOMATIC = 0;\r\n /**\r\n * lumen (lm)\r\n */\r\n Light.INTENSITYMODE_LUMINOUSPOWER = 1;\r\n /**\r\n * candela (lm/sr)\r\n */\r\n Light.INTENSITYMODE_LUMINOUSINTENSITY = 2;\r\n /**\r\n * lux (lm/m^2)\r\n */\r\n Light.INTENSITYMODE_ILLUMINANCE = 3;\r\n /**\r\n * nit (cd/m^2)\r\n */\r\n Light.INTENSITYMODE_LUMINANCE = 4;\r\n // Light types ids const.\r\n /**\r\n * Light type const id of the point light.\r\n */\r\n Light.LIGHTTYPEID_POINTLIGHT = 0;\r\n /**\r\n * Light type const id of the directional light.\r\n */\r\n Light.LIGHTTYPEID_DIRECTIONALLIGHT = 1;\r\n /**\r\n * Light type const id of the spot light.\r\n */\r\n Light.LIGHTTYPEID_SPOTLIGHT = 2;\r\n /**\r\n * Light type const id of the hemispheric light.\r\n */\r\n Light.LIGHTTYPEID_HEMISPHERICLIGHT = 3;\r\n __decorate([\r\n serializeAsColor3()\r\n ], Light.prototype, \"diffuse\", void 0);\r\n __decorate([\r\n serializeAsColor3()\r\n ], Light.prototype, \"specular\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Light.prototype, \"falloffType\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Light.prototype, \"intensity\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Light.prototype, \"range\", null);\r\n __decorate([\r\n serialize()\r\n ], Light.prototype, \"intensityMode\", null);\r\n __decorate([\r\n serialize()\r\n ], Light.prototype, \"radius\", null);\r\n __decorate([\r\n serialize()\r\n ], Light.prototype, \"_renderPriority\", void 0);\r\n __decorate([\r\n expandToProperty(\"_reorderLightsInScene\")\r\n ], Light.prototype, \"renderPriority\", void 0);\r\n __decorate([\r\n serialize(\"shadowEnabled\")\r\n ], Light.prototype, \"_shadowEnabled\", void 0);\r\n __decorate([\r\n serialize(\"excludeWithLayerMask\")\r\n ], Light.prototype, \"_excludeWithLayerMask\", void 0);\r\n __decorate([\r\n serialize(\"includeOnlyWithLayerMask\")\r\n ], Light.prototype, \"_includeOnlyWithLayerMask\", void 0);\r\n __decorate([\r\n serialize(\"lightmapMode\")\r\n ], Light.prototype, \"_lightmapMode\", void 0);\r\n return Light;\r\n}(Node));\r\nexport { Light };\r\n//# sourceMappingURL=light.js.map","import { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { FilesInputStore } from \"../Misc/filesInputStore\";\r\nimport { Scene } from \"../scene\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { SceneLoaderFlags } from \"./sceneLoaderFlags\";\r\n/**\r\n * Mode that determines how to handle old animation groups before loading new ones.\r\n */\r\nexport var SceneLoaderAnimationGroupLoadingMode;\r\n(function (SceneLoaderAnimationGroupLoadingMode) {\r\n /**\r\n * Reset all old animations to initial state then dispose them.\r\n */\r\n SceneLoaderAnimationGroupLoadingMode[SceneLoaderAnimationGroupLoadingMode[\"Clean\"] = 0] = \"Clean\";\r\n /**\r\n * Stop all old animations.\r\n */\r\n SceneLoaderAnimationGroupLoadingMode[SceneLoaderAnimationGroupLoadingMode[\"Stop\"] = 1] = \"Stop\";\r\n /**\r\n * Restart old animations from first frame.\r\n */\r\n SceneLoaderAnimationGroupLoadingMode[SceneLoaderAnimationGroupLoadingMode[\"Sync\"] = 2] = \"Sync\";\r\n /**\r\n * Old animations remains untouched.\r\n */\r\n SceneLoaderAnimationGroupLoadingMode[SceneLoaderAnimationGroupLoadingMode[\"NoSync\"] = 3] = \"NoSync\";\r\n})(SceneLoaderAnimationGroupLoadingMode || (SceneLoaderAnimationGroupLoadingMode = {}));\r\n/**\r\n * Class used to load scene from various file formats using registered plugins\r\n * @see https://doc.babylonjs.com/how_to/load_from_any_file_type\r\n */\r\nvar SceneLoader = /** @class */ (function () {\r\n function SceneLoader() {\r\n }\r\n Object.defineProperty(SceneLoader, \"ForceFullSceneLoadingForIncremental\", {\r\n /**\r\n * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data\r\n */\r\n get: function () {\r\n return SceneLoaderFlags.ForceFullSceneLoadingForIncremental;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags.ForceFullSceneLoadingForIncremental = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoader, \"ShowLoadingScreen\", {\r\n /**\r\n * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene\r\n */\r\n get: function () {\r\n return SceneLoaderFlags.ShowLoadingScreen;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags.ShowLoadingScreen = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoader, \"loggingLevel\", {\r\n /**\r\n * Defines the current logging level (while loading the scene)\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return SceneLoaderFlags.loggingLevel;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags.loggingLevel = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoader, \"CleanBoneMatrixWeights\", {\r\n /**\r\n * Gets or set a boolean indicating if matrix weights must be cleaned upon loading\r\n */\r\n get: function () {\r\n return SceneLoaderFlags.CleanBoneMatrixWeights;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags.CleanBoneMatrixWeights = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the default plugin (used to load Babylon files)\r\n * @returns the .babylon plugin\r\n */\r\n SceneLoader.GetDefaultPlugin = function () {\r\n return SceneLoader._registeredPlugins[\".babylon\"];\r\n };\r\n SceneLoader._GetPluginForExtension = function (extension) {\r\n var registeredPlugin = SceneLoader._registeredPlugins[extension];\r\n if (registeredPlugin) {\r\n return registeredPlugin;\r\n }\r\n Logger.Warn(\"Unable to find a plugin to load \" + extension + \" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/how_to/load_from_any_file_type\");\r\n return SceneLoader.GetDefaultPlugin();\r\n };\r\n SceneLoader._GetPluginForDirectLoad = function (data) {\r\n for (var extension in SceneLoader._registeredPlugins) {\r\n var plugin = SceneLoader._registeredPlugins[extension].plugin;\r\n if (plugin.canDirectLoad && plugin.canDirectLoad(data)) {\r\n return SceneLoader._registeredPlugins[extension];\r\n }\r\n }\r\n return SceneLoader.GetDefaultPlugin();\r\n };\r\n SceneLoader._GetPluginForFilename = function (sceneFilename) {\r\n var queryStringPosition = sceneFilename.indexOf(\"?\");\r\n if (queryStringPosition !== -1) {\r\n sceneFilename = sceneFilename.substring(0, queryStringPosition);\r\n }\r\n var dotPosition = sceneFilename.lastIndexOf(\".\");\r\n var extension = sceneFilename.substring(dotPosition, sceneFilename.length).toLowerCase();\r\n return SceneLoader._GetPluginForExtension(extension);\r\n };\r\n SceneLoader._GetDirectLoad = function (sceneFilename) {\r\n if (sceneFilename.substr(0, 5) === \"data:\") {\r\n return sceneFilename.substr(5);\r\n }\r\n return null;\r\n };\r\n SceneLoader._LoadData = function (fileInfo, scene, onSuccess, onProgress, onError, onDispose, pluginExtension) {\r\n var directLoad = SceneLoader._GetDirectLoad(fileInfo.name);\r\n var registeredPlugin = pluginExtension ? SceneLoader._GetPluginForExtension(pluginExtension) : (directLoad ? SceneLoader._GetPluginForDirectLoad(fileInfo.name) : SceneLoader._GetPluginForFilename(fileInfo.name));\r\n var plugin;\r\n if (registeredPlugin.plugin.createPlugin !== undefined) {\r\n plugin = registeredPlugin.plugin.createPlugin();\r\n }\r\n else {\r\n plugin = registeredPlugin.plugin;\r\n }\r\n if (!plugin) {\r\n throw \"The loader plugin corresponding to the file type you are trying to load has not been found. If using es6, please import the plugin you wish to use before.\";\r\n }\r\n SceneLoader.OnPluginActivatedObservable.notifyObservers(plugin);\r\n if (directLoad) {\r\n if (plugin.directLoad) {\r\n var result = plugin.directLoad(scene, directLoad);\r\n if (result.then) {\r\n result.then(function (data) {\r\n onSuccess(plugin, data);\r\n }).catch(function (error) {\r\n onError(\"Error in directLoad of _loadData: \" + error, error);\r\n });\r\n }\r\n else {\r\n onSuccess(plugin, result);\r\n }\r\n }\r\n else {\r\n onSuccess(plugin, directLoad);\r\n }\r\n return plugin;\r\n }\r\n var useArrayBuffer = registeredPlugin.isBinary;\r\n var dataCallback = function (data, responseURL) {\r\n if (scene.isDisposed) {\r\n onError(\"Scene has been disposed\");\r\n return;\r\n }\r\n onSuccess(plugin, data, responseURL);\r\n };\r\n var request = null;\r\n var pluginDisposed = false;\r\n var onDisposeObservable = plugin.onDisposeObservable;\r\n if (onDisposeObservable) {\r\n onDisposeObservable.add(function () {\r\n pluginDisposed = true;\r\n if (request) {\r\n request.abort();\r\n request = null;\r\n }\r\n onDispose();\r\n });\r\n }\r\n var manifestChecked = function () {\r\n if (pluginDisposed) {\r\n return;\r\n }\r\n var successCallback = function (data, request) {\r\n dataCallback(data, request ? request.responseURL : undefined);\r\n };\r\n var errorCallback = function (error) {\r\n onError(error.message, error);\r\n };\r\n request = plugin.requestFile\r\n ? plugin.requestFile(scene, fileInfo.url, successCallback, onProgress, useArrayBuffer, errorCallback)\r\n : scene._requestFile(fileInfo.url, successCallback, onProgress, true, useArrayBuffer, errorCallback);\r\n };\r\n var file = fileInfo.file || FilesInputStore.FilesToLoad[fileInfo.name.toLowerCase()];\r\n if (fileInfo.rootUrl.indexOf(\"file:\") === -1 || (fileInfo.rootUrl.indexOf(\"file:\") !== -1 && !file)) {\r\n var engine = scene.getEngine();\r\n var canUseOfflineSupport = engine.enableOfflineSupport;\r\n if (canUseOfflineSupport) {\r\n // Also check for exceptions\r\n var exceptionFound = false;\r\n for (var _i = 0, _a = scene.disableOfflineSupportExceptionRules; _i < _a.length; _i++) {\r\n var regex = _a[_i];\r\n if (regex.test(fileInfo.url)) {\r\n exceptionFound = true;\r\n break;\r\n }\r\n }\r\n canUseOfflineSupport = !exceptionFound;\r\n }\r\n if (canUseOfflineSupport && Engine.OfflineProviderFactory) {\r\n // Checking if a manifest file has been set for this scene and if offline mode has been requested\r\n scene.offlineProvider = Engine.OfflineProviderFactory(fileInfo.url, manifestChecked, engine.disableManifestCheck);\r\n }\r\n else {\r\n manifestChecked();\r\n }\r\n }\r\n // Loading file from disk via input file or drag'n'drop\r\n else {\r\n if (file) {\r\n var errorCallback = function (error) {\r\n onError(error.message, error);\r\n };\r\n request = plugin.readFile\r\n ? plugin.readFile(scene, file, dataCallback, onProgress, useArrayBuffer, errorCallback)\r\n : scene._readFile(file, dataCallback, onProgress, useArrayBuffer, errorCallback);\r\n }\r\n else {\r\n onError(\"Unable to find file named \" + fileInfo.name);\r\n }\r\n }\r\n return plugin;\r\n };\r\n SceneLoader._GetFileInfo = function (rootUrl, sceneFilename) {\r\n var url;\r\n var name;\r\n var file = null;\r\n if (!sceneFilename) {\r\n url = rootUrl;\r\n name = Tools.GetFilename(rootUrl);\r\n rootUrl = Tools.GetFolderPath(rootUrl);\r\n }\r\n else if (sceneFilename.name) {\r\n var sceneFile = sceneFilename;\r\n url = rootUrl + sceneFile.name;\r\n name = sceneFile.name;\r\n file = sceneFile;\r\n }\r\n else {\r\n var filename = sceneFilename;\r\n if (filename.substr(0, 1) === \"/\") {\r\n Tools.Error(\"Wrong sceneFilename parameter\");\r\n return null;\r\n }\r\n url = rootUrl + filename;\r\n name = filename;\r\n }\r\n return {\r\n url: url,\r\n rootUrl: rootUrl,\r\n name: name,\r\n file: file\r\n };\r\n };\r\n // Public functions\r\n /**\r\n * Gets a plugin that can load the given extension\r\n * @param extension defines the extension to load\r\n * @returns a plugin or null if none works\r\n */\r\n SceneLoader.GetPluginForExtension = function (extension) {\r\n return SceneLoader._GetPluginForExtension(extension).plugin;\r\n };\r\n /**\r\n * Gets a boolean indicating that the given extension can be loaded\r\n * @param extension defines the extension to load\r\n * @returns true if the extension is supported\r\n */\r\n SceneLoader.IsPluginForExtensionAvailable = function (extension) {\r\n return !!SceneLoader._registeredPlugins[extension];\r\n };\r\n /**\r\n * Adds a new plugin to the list of registered plugins\r\n * @param plugin defines the plugin to add\r\n */\r\n SceneLoader.RegisterPlugin = function (plugin) {\r\n if (typeof plugin.extensions === \"string\") {\r\n var extension = plugin.extensions;\r\n SceneLoader._registeredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: false\r\n };\r\n }\r\n else {\r\n var extensions = plugin.extensions;\r\n Object.keys(extensions).forEach(function (extension) {\r\n SceneLoader._registeredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: extensions[extension].isBinary\r\n };\r\n });\r\n }\r\n };\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with a list of imported meshes, particleSystems, skeletons, and animationGroups when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.ImportMesh = function (meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!scene) {\r\n Logger.Error(\"No scene available to import mesh to\");\r\n return null;\r\n }\r\n var fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n var loadingToken = {};\r\n scene._addPendingData(loadingToken);\r\n var disposeHandler = function () {\r\n scene._removePendingData(loadingToken);\r\n };\r\n var errorHandler = function (message, exception) {\r\n var errorMessage = \"Unable to import meshes from \" + fileInfo.url + \": \" + message;\r\n if (onError) {\r\n onError(scene, errorMessage, exception);\r\n }\r\n else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n disposeHandler();\r\n };\r\n var progressHandler = onProgress ? function (event) {\r\n try {\r\n onProgress(event);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onProgress callback: \" + e, e);\r\n }\r\n } : undefined;\r\n var successHandler = function (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights) {\r\n scene.importedMeshesFiles.push(fileInfo.url);\r\n if (onSuccess) {\r\n try {\r\n onSuccess(meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onSuccess callback: \" + e, e);\r\n }\r\n }\r\n scene._removePendingData(loadingToken);\r\n };\r\n return SceneLoader._LoadData(fileInfo, scene, function (plugin, data, responseURL) {\r\n if (plugin.rewriteRootURL) {\r\n fileInfo.rootUrl = plugin.rewriteRootURL(fileInfo.rootUrl, responseURL);\r\n }\r\n if (plugin.importMesh) {\r\n var syncedPlugin = plugin;\r\n var meshes = new Array();\r\n var particleSystems = new Array();\r\n var skeletons = new Array();\r\n if (!syncedPlugin.importMesh(meshNames, scene, data, fileInfo.rootUrl, meshes, particleSystems, skeletons, errorHandler)) {\r\n return;\r\n }\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(meshes, particleSystems, skeletons, [], [], [], []);\r\n }\r\n else {\r\n var asyncedPlugin = plugin;\r\n asyncedPlugin.importMeshAsync(meshNames, scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name).then(function (result) {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(result.meshes, result.particleSystems, result.skeletons, result.animationGroups, result.transformNodes, result.geometries, result.lights);\r\n }).catch(function (error) {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n }, progressHandler, errorHandler, disposeHandler, pluginExtension);\r\n };\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups\r\n */\r\n SceneLoader.ImportMeshAsync = function (meshNames, rootUrl, sceneFilename, scene, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.ImportMesh(meshNames, rootUrl, sceneFilename, scene, function (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights) {\r\n resolve({\r\n meshes: meshes,\r\n particleSystems: particleSystems,\r\n skeletons: skeletons,\r\n animationGroups: animationGroups,\r\n transformNodes: transformNodes,\r\n geometries: geometries,\r\n lights: lights\r\n });\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * Load a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.Load = function (rootUrl, sceneFilename, engine, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (engine === void 0) { engine = EngineStore.LastCreatedEngine; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!engine) {\r\n Tools.Error(\"No engine available\");\r\n return null;\r\n }\r\n return SceneLoader.Append(rootUrl, sceneFilename, new Scene(engine), onSuccess, onProgress, onError, pluginExtension);\r\n };\r\n /**\r\n * Load a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded scene\r\n */\r\n SceneLoader.LoadAsync = function (rootUrl, sceneFilename, engine, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (engine === void 0) { engine = EngineStore.LastCreatedEngine; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.Load(rootUrl, sceneFilename, engine, function (scene) {\r\n resolve(scene);\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * Append a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.Append = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {\r\n var _this = this;\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!scene) {\r\n Logger.Error(\"No scene available to append to\");\r\n return null;\r\n }\r\n var fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n if (SceneLoader.ShowLoadingScreen && !this._showingLoadingScreen) {\r\n this._showingLoadingScreen = true;\r\n scene.getEngine().displayLoadingUI();\r\n scene.executeWhenReady(function () {\r\n scene.getEngine().hideLoadingUI();\r\n _this._showingLoadingScreen = false;\r\n });\r\n }\r\n var loadingToken = {};\r\n scene._addPendingData(loadingToken);\r\n var disposeHandler = function () {\r\n scene._removePendingData(loadingToken);\r\n };\r\n var errorHandler = function (message, exception) {\r\n var errorMessage = \"Unable to load from \" + fileInfo.url + (message ? \": \" + message : \"\");\r\n if (onError) {\r\n onError(scene, errorMessage, exception);\r\n }\r\n else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n disposeHandler();\r\n };\r\n var progressHandler = onProgress ? function (event) {\r\n try {\r\n onProgress(event);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n } : undefined;\r\n var successHandler = function () {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(scene);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n scene._removePendingData(loadingToken);\r\n };\r\n return SceneLoader._LoadData(fileInfo, scene, function (plugin, data) {\r\n if (plugin.load) {\r\n var syncedPlugin = plugin;\r\n if (!syncedPlugin.load(scene, data, fileInfo.rootUrl, errorHandler)) {\r\n return;\r\n }\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n }\r\n else {\r\n var asyncedPlugin = plugin;\r\n asyncedPlugin.loadAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name).then(function () {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n }).catch(function (error) {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n }, progressHandler, errorHandler, disposeHandler, pluginExtension);\r\n };\r\n /**\r\n * Append a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The given scene\r\n */\r\n SceneLoader.AppendAsync = function (rootUrl, sceneFilename, scene, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.Append(rootUrl, sceneFilename, scene, function (scene) {\r\n resolve(scene);\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * Load a scene into an asset container\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded plugin\r\n */\r\n SceneLoader.LoadAssetContainer = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!scene) {\r\n Logger.Error(\"No scene available to load asset container to\");\r\n return null;\r\n }\r\n var fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n var loadingToken = {};\r\n scene._addPendingData(loadingToken);\r\n var disposeHandler = function () {\r\n scene._removePendingData(loadingToken);\r\n };\r\n var errorHandler = function (message, exception) {\r\n var errorMessage = \"Unable to load assets from \" + fileInfo.url + (message ? \": \" + message : \"\");\r\n if (exception && exception.message) {\r\n errorMessage += \" (\" + exception.message + \")\";\r\n }\r\n if (onError) {\r\n onError(scene, errorMessage, exception);\r\n }\r\n else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n disposeHandler();\r\n };\r\n var progressHandler = onProgress ? function (event) {\r\n try {\r\n onProgress(event);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n } : undefined;\r\n var successHandler = function (assets) {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(assets);\r\n }\r\n catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n scene._removePendingData(loadingToken);\r\n };\r\n return SceneLoader._LoadData(fileInfo, scene, function (plugin, data) {\r\n if (plugin.loadAssetContainer) {\r\n var syncedPlugin = plugin;\r\n var assetContainer = syncedPlugin.loadAssetContainer(scene, data, fileInfo.rootUrl, errorHandler);\r\n if (!assetContainer) {\r\n return;\r\n }\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n }\r\n else if (plugin.loadAssetContainerAsync) {\r\n var asyncedPlugin = plugin;\r\n asyncedPlugin.loadAssetContainerAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name).then(function (assetContainer) {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n }).catch(function (error) {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n else {\r\n errorHandler(\"LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.\");\r\n }\r\n }, progressHandler, errorHandler, disposeHandler, pluginExtension);\r\n };\r\n /**\r\n * Load a scene into an asset container\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene (default: empty string)\r\n * @param scene is the instance of Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns The loaded asset container\r\n */\r\n SceneLoader.LoadAssetContainerAsync = function (rootUrl, sceneFilename, scene, onProgress, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.LoadAssetContainer(rootUrl, sceneFilename, scene, function (assetContainer) {\r\n resolve(assetContainer);\r\n }, onProgress, function (scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * Import animations from a file into a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param overwriteAnimations when true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n * @param animationGroupLoadingMode defines how to handle old animations groups before importing new ones\r\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n */\r\n SceneLoader.ImportAnimations = function (rootUrl, sceneFilename, scene, overwriteAnimations, animationGroupLoadingMode, targetConverter, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (overwriteAnimations === void 0) { overwriteAnimations = true; }\r\n if (animationGroupLoadingMode === void 0) { animationGroupLoadingMode = SceneLoaderAnimationGroupLoadingMode.Clean; }\r\n if (targetConverter === void 0) { targetConverter = null; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n if (!scene) {\r\n Logger.Error(\"No scene available to load animations to\");\r\n return;\r\n }\r\n if (overwriteAnimations) {\r\n // Reset, stop and dispose all animations before loading new ones\r\n for (var _i = 0, _a = scene.animatables; _i < _a.length; _i++) {\r\n var animatable = _a[_i];\r\n animatable.reset();\r\n }\r\n scene.stopAllAnimations();\r\n scene.animationGroups.slice().forEach(function (animationGroup) {\r\n animationGroup.dispose();\r\n });\r\n var nodes = scene.getNodes();\r\n nodes.forEach(function (node) {\r\n if (node.animations) {\r\n node.animations = [];\r\n }\r\n });\r\n }\r\n else {\r\n switch (animationGroupLoadingMode) {\r\n case SceneLoaderAnimationGroupLoadingMode.Clean:\r\n scene.animationGroups.slice().forEach(function (animationGroup) {\r\n animationGroup.dispose();\r\n });\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.Stop:\r\n scene.animationGroups.forEach(function (animationGroup) {\r\n animationGroup.stop();\r\n });\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.Sync:\r\n scene.animationGroups.forEach(function (animationGroup) {\r\n animationGroup.reset();\r\n animationGroup.restart();\r\n });\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.NoSync:\r\n // nothing to do\r\n break;\r\n default:\r\n Logger.Error(\"Unknown animation group loading mode value '\" + animationGroupLoadingMode + \"'\");\r\n return;\r\n }\r\n }\r\n var startingIndexForNewAnimatables = scene.animatables.length;\r\n var onAssetContainerLoaded = function (container) {\r\n container.mergeAnimationsTo(scene, scene.animatables.slice(startingIndexForNewAnimatables), targetConverter);\r\n container.dispose();\r\n scene.onAnimationFileImportedObservable.notifyObservers(scene);\r\n if (onSuccess) {\r\n onSuccess(scene);\r\n }\r\n };\r\n this.LoadAssetContainer(rootUrl, sceneFilename, scene, onAssetContainerLoaded, onProgress, onError, pluginExtension);\r\n };\r\n /**\r\n * Import animations from a file into a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param overwriteAnimations when true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n * @param animationGroupLoadingMode defines how to handle old animations groups before importing new ones\r\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @returns the updated scene with imported animations\r\n */\r\n SceneLoader.ImportAnimationsAsync = function (rootUrl, sceneFilename, scene, overwriteAnimations, animationGroupLoadingMode, targetConverter, onSuccess, onProgress, onError, pluginExtension) {\r\n if (sceneFilename === void 0) { sceneFilename = \"\"; }\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (overwriteAnimations === void 0) { overwriteAnimations = true; }\r\n if (animationGroupLoadingMode === void 0) { animationGroupLoadingMode = SceneLoaderAnimationGroupLoadingMode.Clean; }\r\n if (targetConverter === void 0) { targetConverter = null; }\r\n if (onSuccess === void 0) { onSuccess = null; }\r\n if (onProgress === void 0) { onProgress = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (pluginExtension === void 0) { pluginExtension = null; }\r\n return new Promise(function (resolve, reject) {\r\n SceneLoader.ImportAnimations(rootUrl, sceneFilename, scene, overwriteAnimations, animationGroupLoadingMode, targetConverter, function (_scene) {\r\n resolve(_scene);\r\n }, onProgress, function (_scene, message, exception) {\r\n reject(exception || new Error(message));\r\n }, pluginExtension);\r\n });\r\n };\r\n /**\r\n * No logging while loading\r\n */\r\n SceneLoader.NO_LOGGING = 0;\r\n /**\r\n * Minimal logging while loading\r\n */\r\n SceneLoader.MINIMAL_LOGGING = 1;\r\n /**\r\n * Summary logging while loading\r\n */\r\n SceneLoader.SUMMARY_LOGGING = 2;\r\n /**\r\n * Detailled logging while loading\r\n */\r\n SceneLoader.DETAILED_LOGGING = 3;\r\n // Members\r\n /**\r\n * Event raised when a plugin is used to load a scene\r\n */\r\n SceneLoader.OnPluginActivatedObservable = new Observable();\r\n SceneLoader._registeredPlugins = {};\r\n SceneLoader._showingLoadingScreen = false;\r\n return SceneLoader;\r\n}());\r\nexport { SceneLoader };\r\n//# sourceMappingURL=sceneLoader.js.map","/**\r\n * Class used to represent data loading progression\r\n */\r\nvar SceneLoaderFlags = /** @class */ (function () {\r\n function SceneLoaderFlags() {\r\n }\r\n Object.defineProperty(SceneLoaderFlags, \"ForceFullSceneLoadingForIncremental\", {\r\n /**\r\n * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._ForceFullSceneLoadingForIncremental;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._ForceFullSceneLoadingForIncremental = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoaderFlags, \"ShowLoadingScreen\", {\r\n /**\r\n * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._ShowLoadingScreen;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._ShowLoadingScreen = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoaderFlags, \"loggingLevel\", {\r\n /**\r\n * Defines the current logging level (while loading the scene)\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._loggingLevel;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._loggingLevel = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SceneLoaderFlags, \"CleanBoneMatrixWeights\", {\r\n /**\r\n * Gets or set a boolean indicating if matrix weights must be cleaned upon loading\r\n */\r\n get: function () {\r\n return SceneLoaderFlags._CleanBoneMatrixWeights;\r\n },\r\n set: function (value) {\r\n SceneLoaderFlags._CleanBoneMatrixWeights = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Flags\r\n SceneLoaderFlags._ForceFullSceneLoadingForIncremental = false;\r\n SceneLoaderFlags._ShowLoadingScreen = true;\r\n SceneLoaderFlags._CleanBoneMatrixWeights = false;\r\n SceneLoaderFlags._loggingLevel = 0;\r\n return SceneLoaderFlags;\r\n}());\r\nexport { SceneLoaderFlags };\r\n//# sourceMappingURL=sceneLoaderFlags.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, SerializationHelper, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Matrix } from \"../../Maths/math.vector\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport { GUID } from '../../Misc/guid';\r\nimport \"../../Misc/fileTools\";\r\nimport { ThinTexture } from './thinTexture';\r\n/**\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n */\r\nvar BaseTexture = /** @class */ (function (_super) {\r\n __extends(BaseTexture, _super);\r\n /**\r\n * Instantiates a new BaseTexture.\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n * @param sceneOrEngine Define the scene or engine the texture blongs to\r\n */\r\n function BaseTexture(sceneOrEngine) {\r\n var _this = _super.call(this, null) || this;\r\n /**\r\n * Gets or sets an object used to store user defined information.\r\n */\r\n _this.metadata = null;\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n _this.reservedDataStore = null;\r\n _this._hasAlpha = false;\r\n /**\r\n * Defines if the alpha value should be determined via the rgb values.\r\n * If true the luminance of the pixel might be used to find the corresponding alpha value.\r\n */\r\n _this.getAlphaFromRGB = false;\r\n /**\r\n * Intensity or strength of the texture.\r\n * It is commonly used by materials to fine tune the intensity of the texture\r\n */\r\n _this.level = 1;\r\n /**\r\n * Define the UV chanel to use starting from 0 and defaulting to 0.\r\n * This is part of the texture as textures usually maps to one uv set.\r\n */\r\n _this.coordinatesIndex = 0;\r\n _this._coordinatesMode = 0;\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n _this.wrapR = 1;\r\n /**\r\n * With compliant hardware and browser (supporting anisotropic filtering)\r\n * this defines the level of anisotropic filtering in the texture.\r\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\r\n */\r\n _this.anisotropicFilteringLevel = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;\r\n _this._isCube = false;\r\n _this._gammaSpace = true;\r\n /**\r\n * Is Z inverted in the texture (useful in a cube texture).\r\n */\r\n _this.invertZ = false;\r\n /**\r\n * @hidden\r\n */\r\n _this.lodLevelInAlpha = false;\r\n /**\r\n * Define if the texture is a render target.\r\n */\r\n _this.isRenderTarget = false;\r\n /** @hidden */\r\n _this._prefiltered = false;\r\n /**\r\n * Define the list of animation attached to the texture.\r\n */\r\n _this.animations = new Array();\r\n /**\r\n * An event triggered when the texture is disposed.\r\n */\r\n _this.onDisposeObservable = new Observable();\r\n _this._onDisposeObserver = null;\r\n _this._scene = null;\r\n /** @hidden */\r\n _this._texture = null;\r\n _this._uid = null;\r\n if (sceneOrEngine) {\r\n if (BaseTexture._isScene(sceneOrEngine)) {\r\n _this._scene = sceneOrEngine;\r\n }\r\n else {\r\n _this._engine = sceneOrEngine;\r\n }\r\n }\r\n else {\r\n _this._scene = EngineStore.LastCreatedScene;\r\n }\r\n if (_this._scene) {\r\n _this.uniqueId = _this._scene.getUniqueId();\r\n _this._scene.addTexture(_this);\r\n _this._engine = _this._scene.getEngine();\r\n }\r\n _this._uid = null;\r\n return _this;\r\n }\r\n Object.defineProperty(BaseTexture.prototype, \"hasAlpha\", {\r\n get: function () {\r\n return this._hasAlpha;\r\n },\r\n /**\r\n * Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).\r\n */\r\n set: function (value) {\r\n if (this._hasAlpha === value) {\r\n return;\r\n }\r\n this._hasAlpha = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(1 | 16);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"coordinatesMode\", {\r\n get: function () {\r\n return this._coordinatesMode;\r\n },\r\n /**\r\n * How a texture is mapped.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | EXPLICIT_MODE | |\r\n * | 1 | SPHERICAL_MODE | |\r\n * | 2 | PLANAR_MODE | |\r\n * | 3 | CUBIC_MODE | |\r\n * | 4 | PROJECTION_MODE | |\r\n * | 5 | SKYBOX_MODE | |\r\n * | 6 | INVCUBIC_MODE | |\r\n * | 7 | EQUIRECTANGULAR_MODE | |\r\n * | 8 | FIXED_EQUIRECTANGULAR_MODE | |\r\n * | 9 | FIXED_EQUIRECTANGULAR_MIRRORED_MODE | |\r\n */\r\n set: function (value) {\r\n if (this._coordinatesMode === value) {\r\n return;\r\n }\r\n this._coordinatesMode = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(1);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"wrapU\", {\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n get: function () {\r\n return this._wrapU;\r\n },\r\n set: function (value) {\r\n this._wrapU = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"wrapV\", {\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n get: function () {\r\n return this._wrapV;\r\n },\r\n set: function (value) {\r\n this._wrapV = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"isCube\", {\r\n /**\r\n * Define if the texture is a cube texture or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return this._isCube;\r\n }\r\n return this._texture.isCube;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n this._isCube = value;\r\n }\r\n else {\r\n this._texture.isCube = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"is3D\", {\r\n /**\r\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n return this._texture.is3D;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._texture.is3D = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"is2DArray\", {\r\n /**\r\n * Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n return this._texture.is2DArray;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._texture.is2DArray = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"gammaSpace\", {\r\n /**\r\n * Define if the texture contains data in gamma space (most of the png/jpg aside bump).\r\n * HDR texture are usually stored in linear space.\r\n * This only impacts the PBR and Background materials\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return this._gammaSpace;\r\n }\r\n else {\r\n if (this._texture._gammaSpace === null) {\r\n this._texture._gammaSpace = this._gammaSpace;\r\n }\r\n }\r\n return this._texture._gammaSpace;\r\n },\r\n set: function (gamma) {\r\n if (!this._texture) {\r\n if (this._gammaSpace === gamma) {\r\n return;\r\n }\r\n this._gammaSpace = gamma;\r\n }\r\n else {\r\n if (this._texture._gammaSpace === gamma) {\r\n return;\r\n }\r\n this._texture._gammaSpace = gamma;\r\n }\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"isRGBD\", {\r\n /**\r\n * Gets or sets whether or not the texture contains RGBD data.\r\n */\r\n get: function () {\r\n return this._texture != null && this._texture._isRGBD;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._isRGBD = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"noMipmap\", {\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"lodGenerationOffset\", {\r\n /**\r\n * With prefiltered texture, defined the offset used during the prefiltering steps.\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodGenerationOffset;\r\n }\r\n return 0.0;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._lodGenerationOffset = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"lodGenerationScale\", {\r\n /**\r\n * With prefiltered texture, defined the scale used during the prefiltering steps.\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodGenerationScale;\r\n }\r\n return 0.0;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._lodGenerationScale = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"linearSpecularLOD\", {\r\n /**\r\n * With prefiltered texture, defined if the specular generation is based on a linear ramp.\r\n * By default we are using a log2 of the linear roughness helping to keep a better resolution for\r\n * average roughness values.\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._linearSpecularLOD;\r\n }\r\n return false;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._linearSpecularLOD = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"irradianceTexture\", {\r\n /**\r\n * In case a better definition than spherical harmonics is required for the diffuse part of the environment.\r\n * You can set the irradiance texture to rely on a texture instead of the spherical approach.\r\n * This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).\r\n */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._irradianceTexture;\r\n }\r\n return null;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._irradianceTexture = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"uid\", {\r\n /**\r\n * Define the unique id of the texture in the scene.\r\n */\r\n get: function () {\r\n if (!this._uid) {\r\n this._uid = GUID.RandomId();\r\n }\r\n return this._uid;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Return a string representation of the texture.\r\n * @returns the texture as a string\r\n */\r\n BaseTexture.prototype.toString = function () {\r\n return this.name;\r\n };\r\n /**\r\n * Get the class name of the texture.\r\n * @returns \"BaseTexture\"\r\n */\r\n BaseTexture.prototype.getClassName = function () {\r\n return \"BaseTexture\";\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"onDispose\", {\r\n /**\r\n * Callback triggered when the texture has been disposed.\r\n * Kept for back compatibility, you can use the onDisposeObservable instead.\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"isBlocking\", {\r\n /**\r\n * Define if the texture is preventinga material to render or not.\r\n * If not and the texture is not ready, the engine will use a default black texture instead.\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Get the scene the texture belongs to.\r\n * @returns the scene or null if undefined\r\n */\r\n BaseTexture.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /** @hidden */\r\n BaseTexture.prototype._getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * Checks if the texture has the same transform matrix than another texture\r\n * @param texture texture to check against\r\n * @returns true if the transforms are the same, else false\r\n */\r\n BaseTexture.prototype.checkTransformsAreIdentical = function (texture) {\r\n return texture !== null;\r\n };\r\n /**\r\n * Get the texture transform matrix used to offset tile the texture for istance.\r\n * @returns the transformation matrix\r\n */\r\n BaseTexture.prototype.getTextureMatrix = function () {\r\n return Matrix.IdentityReadOnly;\r\n };\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n BaseTexture.prototype.getReflectionTextureMatrix = function () {\r\n return Matrix.IdentityReadOnly;\r\n };\r\n /**\r\n * Get if the texture is ready to be consumed (either it is ready or it is not blocking)\r\n * @returns true if ready or not blocking\r\n */\r\n BaseTexture.prototype.isReadyOrNotBlocking = function () {\r\n return !this.isBlocking || this.isReady();\r\n };\r\n /**\r\n * Scales the texture if is `canRescale()`\r\n * @param ratio the resize factor we want to use to rescale\r\n */\r\n BaseTexture.prototype.scale = function (ratio) {\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"canRescale\", {\r\n /**\r\n * Get if the texture can rescale.\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n BaseTexture.prototype._getFromCache = function (url, noMipmap, sampling, invertY) {\r\n var engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n var texturesCache = engine.getLoadedTexturesCache();\r\n for (var index = 0; index < texturesCache.length; index++) {\r\n var texturesCacheEntry = texturesCache[index];\r\n if (invertY === undefined || invertY === texturesCacheEntry.invertY) {\r\n if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {\r\n if (!sampling || sampling === texturesCacheEntry.samplingMode) {\r\n texturesCacheEntry.incrementReferences();\r\n return texturesCacheEntry;\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /** @hidden */\r\n BaseTexture.prototype._rebuild = function () {\r\n };\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n BaseTexture.prototype.clone = function () {\r\n return null;\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"textureType\", {\r\n /**\r\n * Get the texture underlying type (INT, FLOAT...)\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return 0;\r\n }\r\n return (this._texture.type !== undefined) ? this._texture.type : 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"textureFormat\", {\r\n /**\r\n * Get the texture underlying format (RGB, RGBA...)\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return 5;\r\n }\r\n return (this._texture.format !== undefined) ? this._texture.format : 5;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Indicates that textures need to be re-calculated for all materials\r\n */\r\n BaseTexture.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n scene.markAllMaterialsAsDirty(1);\r\n };\r\n /**\r\n * Reads the pixels stored in the webgl texture and returns them as an ArrayBuffer.\r\n * This will returns an RGBA array buffer containing either in values (0-255) or\r\n * float values (0-1) depending of the underlying buffer type.\r\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\r\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\r\n * @param buffer defines a user defined buffer to fill with data (can be null)\r\n * @returns The Array buffer containing the pixels data.\r\n */\r\n BaseTexture.prototype.readPixels = function (faceIndex, level, buffer) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (level === void 0) { level = 0; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (!this._texture) {\r\n return null;\r\n }\r\n var size = this.getSize();\r\n var width = size.width;\r\n var height = size.height;\r\n var engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n if (level != 0) {\r\n width = width / Math.pow(2, level);\r\n height = height / Math.pow(2, level);\r\n width = Math.round(width);\r\n height = Math.round(height);\r\n }\r\n try {\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixels(this._texture, width, height, faceIndex, level, buffer);\r\n }\r\n return engine._readTexturePixels(this._texture, width, height, -1, level, buffer);\r\n }\r\n catch (e) {\r\n return null;\r\n }\r\n };\r\n Object.defineProperty(BaseTexture.prototype, \"_lodTextureHigh\", {\r\n /** @hidden */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodTextureHigh;\r\n }\r\n return null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"_lodTextureMid\", {\r\n /** @hidden */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodTextureMid;\r\n }\r\n return null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseTexture.prototype, \"_lodTextureLow\", {\r\n /** @hidden */\r\n get: function () {\r\n if (this._texture) {\r\n return this._texture._lodTextureLow;\r\n }\r\n return null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n BaseTexture.prototype.dispose = function () {\r\n if (this._scene) {\r\n // Animations\r\n if (this._scene.stopAnimation) {\r\n this._scene.stopAnimation(this);\r\n }\r\n // Remove from scene\r\n this._scene._removePendingData(this);\r\n var index = this._scene.textures.indexOf(this);\r\n if (index >= 0) {\r\n this._scene.textures.splice(index, 1);\r\n }\r\n this._scene.onTextureRemovedObservable.notifyObservers(this);\r\n this._scene = null;\r\n }\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Serialize the texture into a JSON representation that can be parsed later on.\r\n * @returns the JSON representation of the texture\r\n */\r\n BaseTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n return serializationObject;\r\n };\r\n /**\r\n * Helper function to be called back once a list of texture contains only ready textures.\r\n * @param textures Define the list of textures to wait for\r\n * @param callback Define the callback triggered once the entire list will be ready\r\n */\r\n BaseTexture.WhenAllReady = function (textures, callback) {\r\n var numRemaining = textures.length;\r\n if (numRemaining === 0) {\r\n callback();\r\n return;\r\n }\r\n for (var i = 0; i < textures.length; i++) {\r\n var texture = textures[i];\r\n if (texture.isReady()) {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n }\r\n else {\r\n var onLoadObservable = texture.onLoadObservable;\r\n if (onLoadObservable) {\r\n onLoadObservable.addOnce(function () {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n });\r\n }\r\n }\r\n }\r\n };\r\n BaseTexture._isScene = function (sceneOrEngine) {\r\n return sceneOrEngine.getClassName() === \"Scene\";\r\n };\r\n /**\r\n * Default anisotropic filtering level for the application.\r\n * It is set to 4 as a good tradeoff between perf and quality.\r\n */\r\n BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"uniqueId\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"name\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"metadata\", void 0);\r\n __decorate([\r\n serialize(\"hasAlpha\")\r\n ], BaseTexture.prototype, \"_hasAlpha\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"getAlphaFromRGB\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"level\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"coordinatesIndex\", void 0);\r\n __decorate([\r\n serialize(\"coordinatesMode\")\r\n ], BaseTexture.prototype, \"_coordinatesMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"wrapU\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"wrapV\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"wrapR\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"anisotropicFilteringLevel\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"isCube\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"is3D\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"is2DArray\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"gammaSpace\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"invertZ\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"lodLevelInAlpha\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"lodGenerationOffset\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"lodGenerationScale\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"linearSpecularLOD\", null);\r\n __decorate([\r\n serializeAsTexture()\r\n ], BaseTexture.prototype, \"irradianceTexture\", null);\r\n __decorate([\r\n serialize()\r\n ], BaseTexture.prototype, \"isRenderTarget\", void 0);\r\n return BaseTexture;\r\n}(ThinTexture));\r\nexport { BaseTexture };\r\n//# sourceMappingURL=baseTexture.js.map","import { Size } from '../../Maths/math.size';\r\n/**\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties required to work with Thin Engine.\r\n */\r\nvar ThinTexture = /** @class */ (function () {\r\n /**\r\n * Instantiates a new ThinTexture.\r\n * Base class of all the textures in babylon.\r\n * This can be used as an internal texture wrapper in ThinEngine to benefit from the cache\r\n * @param internalTexture Define the internalTexture to wrap\r\n */\r\n function ThinTexture(internalTexture) {\r\n this._wrapU = 1;\r\n this._wrapV = 1;\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n this.wrapR = 1;\r\n /**\r\n * With compliant hardware and browser (supporting anisotropic filtering)\r\n * this defines the level of anisotropic filtering in the texture.\r\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\r\n */\r\n this.anisotropicFilteringLevel = 4;\r\n /**\r\n * Define the current state of the loading sequence when in delayed load mode.\r\n */\r\n this.delayLoadState = 0;\r\n /** @hidden */\r\n this._texture = null;\r\n this._engine = null;\r\n this._cachedSize = Size.Zero();\r\n this._cachedBaseSize = Size.Zero();\r\n this._texture = internalTexture;\r\n if (this._texture) {\r\n this._engine = this._texture.getEngine();\r\n }\r\n }\r\n Object.defineProperty(ThinTexture.prototype, \"wrapU\", {\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n get: function () {\r\n return this._wrapU;\r\n },\r\n set: function (value) {\r\n this._wrapU = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinTexture.prototype, \"wrapV\", {\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n get: function () {\r\n return this._wrapV;\r\n },\r\n set: function (value) {\r\n this._wrapV = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinTexture.prototype, \"coordinatesMode\", {\r\n /**\r\n * How a texture is mapped.\r\n * Unused in thin texture mode.\r\n */\r\n get: function () {\r\n return 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinTexture.prototype, \"isCube\", {\r\n /**\r\n * Define if the texture is a cube texture or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n return this._texture.isCube;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._texture.isCube = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinTexture.prototype, \"is3D\", {\r\n /**\r\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n return this._texture.is3D;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._texture.is3D = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinTexture.prototype, \"is2DArray\", {\r\n /**\r\n * Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n return this._texture.is2DArray;\r\n },\r\n set: function (value) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n this._texture.is2DArray = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Get the class name of the texture.\r\n * @returns \"ThinTexture\"\r\n */\r\n ThinTexture.prototype.getClassName = function () {\r\n return \"ThinTexture\";\r\n };\r\n /**\r\n * Get if the texture is ready to be used (downloaded, converted, mip mapped...).\r\n * @returns true if fully ready\r\n */\r\n ThinTexture.prototype.isReady = function () {\r\n if (this.delayLoadState === 4) {\r\n this.delayLoad();\r\n return false;\r\n }\r\n if (this._texture) {\r\n return this._texture.isReady;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Triggers the load sequence in delayed load mode.\r\n */\r\n ThinTexture.prototype.delayLoad = function () {\r\n };\r\n /**\r\n * Get the underlying lower level texture from Babylon.\r\n * @returns the insternal texture\r\n */\r\n ThinTexture.prototype.getInternalTexture = function () {\r\n return this._texture;\r\n };\r\n /**\r\n * Get the size of the texture.\r\n * @returns the texture size.\r\n */\r\n ThinTexture.prototype.getSize = function () {\r\n if (this._texture) {\r\n if (this._texture.width) {\r\n this._cachedSize.width = this._texture.width;\r\n this._cachedSize.height = this._texture.height;\r\n return this._cachedSize;\r\n }\r\n if (this._texture._size) {\r\n this._cachedSize.width = this._texture._size;\r\n this._cachedSize.height = this._texture._size;\r\n return this._cachedSize;\r\n }\r\n }\r\n return this._cachedSize;\r\n };\r\n /**\r\n * Get the base size of the texture.\r\n * It can be different from the size if the texture has been resized for POT for instance\r\n * @returns the base size\r\n */\r\n ThinTexture.prototype.getBaseSize = function () {\r\n if (!this.isReady() || !this._texture) {\r\n this._cachedBaseSize.width = 0;\r\n this._cachedBaseSize.height = 0;\r\n return this._cachedBaseSize;\r\n }\r\n if (this._texture._size) {\r\n this._cachedBaseSize.width = this._texture._size;\r\n this._cachedBaseSize.height = this._texture._size;\r\n return this._cachedBaseSize;\r\n }\r\n this._cachedBaseSize.width = this._texture.baseWidth;\r\n this._cachedBaseSize.height = this._texture.baseHeight;\r\n return this._cachedBaseSize;\r\n };\r\n /**\r\n * Update the sampling mode of the texture.\r\n * Default is Trilinear mode.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 1 | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR | Nearest is: mag = nearest, min = nearest, mip = linear |\r\n * | 2 | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |\r\n * | 3 | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |\r\n * | 4 | NEAREST_NEAREST_MIPNEAREST | |\r\n * | 5 | NEAREST_LINEAR_MIPNEAREST | |\r\n * | 6 | NEAREST_LINEAR_MIPLINEAR | |\r\n * | 7 | NEAREST_LINEAR | |\r\n * | 8 | NEAREST_NEAREST | |\r\n * | 9 | LINEAR_NEAREST_MIPNEAREST | |\r\n * | 10 | LINEAR_NEAREST_MIPLINEAR | |\r\n * | 11 | LINEAR_LINEAR | |\r\n * | 12 | LINEAR_NEAREST | |\r\n *\r\n * > _mag_: magnification filter (close to the viewer)\r\n * > _min_: minification filter (far from the viewer)\r\n * > _mip_: filter used between mip map levels\r\n *@param samplingMode Define the new sampling mode of the texture\r\n */\r\n ThinTexture.prototype.updateSamplingMode = function (samplingMode) {\r\n if (this._texture && this._engine) {\r\n this._engine.updateTextureSamplingMode(samplingMode, this._texture);\r\n }\r\n };\r\n /**\r\n * Release and destroy the underlying lower level texture aka internalTexture.\r\n */\r\n ThinTexture.prototype.releaseInternalTexture = function () {\r\n if (this._texture) {\r\n this._texture.dispose();\r\n this._texture = null;\r\n }\r\n };\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n ThinTexture.prototype.dispose = function () {\r\n if (this._texture) {\r\n this.releaseInternalTexture();\r\n this._engine = null;\r\n }\r\n };\r\n return ThinTexture;\r\n}());\r\nexport { ThinTexture };\r\n//# sourceMappingURL=thinTexture.js.map","import { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';\r\nThinEngine.prototype.createDynamicTexture = function (width, height, generateMipMaps, samplingMode) {\r\n var texture = new InternalTexture(this, InternalTextureSource.Dynamic);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n if (generateMipMaps) {\r\n width = this.needPOTTextures ? ThinEngine.GetExponentOfTwo(width, this._caps.maxTextureSize) : width;\r\n height = this.needPOTTextures ? ThinEngine.GetExponentOfTwo(height, this._caps.maxTextureSize) : height;\r\n }\r\n // this.resetTextureCache();\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = false;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n this.updateTextureSamplingMode(samplingMode, texture);\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\nThinEngine.prototype.updateDynamicTexture = function (texture, source, invertY, premulAlpha, format, forceBindTexture) {\r\n if (premulAlpha === void 0) { premulAlpha = false; }\r\n if (forceBindTexture === void 0) { forceBindTexture = false; }\r\n if (!texture) {\r\n return;\r\n }\r\n var gl = this._gl;\r\n var target = gl.TEXTURE_2D;\r\n var wasPreviouslyBound = this._bindTextureDirectly(target, texture, true, forceBindTexture);\r\n this._unpackFlipY(invertY === undefined ? texture.invertY : invertY);\r\n if (premulAlpha) {\r\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);\r\n }\r\n var textureType = this._getWebGLTextureType(texture.type);\r\n var glformat = this._getInternalFormat(format ? format : texture.format);\r\n var internalFormat = this._getRGBABufferInternalSizedFormat(texture.type, glformat);\r\n gl.texImage2D(target, 0, internalFormat, glformat, textureType, source);\r\n if (texture.generateMipMaps) {\r\n gl.generateMipmap(target);\r\n }\r\n if (!wasPreviouslyBound) {\r\n this._bindTextureDirectly(target, null);\r\n }\r\n if (premulAlpha) {\r\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);\r\n }\r\n texture.isReady = true;\r\n};\r\n//# sourceMappingURL=engine.dynamicTexture.js.map","import { __extends } from \"tslib\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport \"../../Engines/Extensions/engine.dynamicTexture\";\r\nimport { CanvasGenerator } from '../../Misc/canvasGenerator';\r\n/**\r\n * A class extending Texture allowing drawing on a texture\r\n * @see https://doc.babylonjs.com/how_to/dynamictexture\r\n */\r\nvar DynamicTexture = /** @class */ (function (_super) {\r\n __extends(DynamicTexture, _super);\r\n /**\r\n * Creates a DynamicTexture\r\n * @param name defines the name of the texture\r\n * @param options provides 3 alternatives for width and height of texture, a canvas, object with width and height properties, number for both width and height\r\n * @param scene defines the scene where you want the texture\r\n * @param generateMipMaps defines the use of MinMaps or not (default is false)\r\n * @param samplingMode defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n * @param format defines the texture format to use (default is Engine.TEXTUREFORMAT_RGBA)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading\r\n */\r\n function DynamicTexture(name, options, scene, generateMipMaps, samplingMode, format, invertY) {\r\n if (scene === void 0) { scene = null; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (format === void 0) { format = 5; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps, invertY, samplingMode, undefined, undefined, undefined, undefined, format) || this;\r\n _this.name = name;\r\n _this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n _this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n _this._generateMipMaps = generateMipMaps;\r\n var engine = _this._getEngine();\r\n if (!engine) {\r\n return _this;\r\n }\r\n if (options.getContext) {\r\n _this._canvas = options;\r\n _this._texture = engine.createDynamicTexture(options.width, options.height, generateMipMaps, samplingMode);\r\n }\r\n else {\r\n _this._canvas = CanvasGenerator.CreateCanvas(1, 1);\r\n if (options.width || options.width === 0) {\r\n _this._texture = engine.createDynamicTexture(options.width, options.height, generateMipMaps, samplingMode);\r\n }\r\n else {\r\n _this._texture = engine.createDynamicTexture(options, options, generateMipMaps, samplingMode);\r\n }\r\n }\r\n var textureSize = _this.getSize();\r\n _this._canvas.width = textureSize.width;\r\n _this._canvas.height = textureSize.height;\r\n _this._context = _this._canvas.getContext(\"2d\");\r\n return _this;\r\n }\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"DynamicTexture\"\r\n */\r\n DynamicTexture.prototype.getClassName = function () {\r\n return \"DynamicTexture\";\r\n };\r\n Object.defineProperty(DynamicTexture.prototype, \"canRescale\", {\r\n /**\r\n * Gets the current state of canRescale\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n DynamicTexture.prototype._recreate = function (textureSize) {\r\n this._canvas.width = textureSize.width;\r\n this._canvas.height = textureSize.height;\r\n this.releaseInternalTexture();\r\n this._texture = this._getEngine().createDynamicTexture(textureSize.width, textureSize.height, this._generateMipMaps, this.samplingMode);\r\n };\r\n /**\r\n * Scales the texture\r\n * @param ratio the scale factor to apply to both width and height\r\n */\r\n DynamicTexture.prototype.scale = function (ratio) {\r\n var textureSize = this.getSize();\r\n textureSize.width *= ratio;\r\n textureSize.height *= ratio;\r\n this._recreate(textureSize);\r\n };\r\n /**\r\n * Resizes the texture\r\n * @param width the new width\r\n * @param height the new height\r\n */\r\n DynamicTexture.prototype.scaleTo = function (width, height) {\r\n var textureSize = this.getSize();\r\n textureSize.width = width;\r\n textureSize.height = height;\r\n this._recreate(textureSize);\r\n };\r\n /**\r\n * Gets the context of the canvas used by the texture\r\n * @returns the canvas context of the dynamic texture\r\n */\r\n DynamicTexture.prototype.getContext = function () {\r\n return this._context;\r\n };\r\n /**\r\n * Clears the texture\r\n */\r\n DynamicTexture.prototype.clear = function () {\r\n var size = this.getSize();\r\n this._context.fillRect(0, 0, size.width, size.height);\r\n };\r\n /**\r\n * Updates the texture\r\n * @param invertY defines the direction for the Y axis (default is true - y increases downwards)\r\n * @param premulAlpha defines if alpha is stored as premultiplied (default is false)\r\n */\r\n DynamicTexture.prototype.update = function (invertY, premulAlpha) {\r\n if (premulAlpha === void 0) { premulAlpha = false; }\r\n this._getEngine().updateDynamicTexture(this._texture, this._canvas, invertY === undefined ? true : invertY, premulAlpha, this._format || undefined);\r\n };\r\n /**\r\n * Draws text onto the texture\r\n * @param text defines the text to be drawn\r\n * @param x defines the placement of the text from the left\r\n * @param y defines the placement of the text from the top when invertY is true and from the bottom when false\r\n * @param font defines the font to be used with font-style, font-size, font-name\r\n * @param color defines the color used for the text\r\n * @param clearColor defines the color for the canvas, use null to not overwrite canvas\r\n * @param invertY defines the direction for the Y axis (default is true - y increases downwards)\r\n * @param update defines whether texture is immediately update (default is true)\r\n */\r\n DynamicTexture.prototype.drawText = function (text, x, y, font, color, clearColor, invertY, update) {\r\n if (update === void 0) { update = true; }\r\n var size = this.getSize();\r\n if (clearColor) {\r\n this._context.fillStyle = clearColor;\r\n this._context.fillRect(0, 0, size.width, size.height);\r\n }\r\n this._context.font = font;\r\n if (x === null || x === undefined) {\r\n var textSize = this._context.measureText(text);\r\n x = (size.width - textSize.width) / 2;\r\n }\r\n if (y === null || y === undefined) {\r\n var fontSize = parseInt((font.replace(/\\D/g, '')));\r\n y = (size.height / 2) + (fontSize / 3.65);\r\n }\r\n this._context.fillStyle = color || \"\";\r\n this._context.fillText(text, x, y);\r\n if (update) {\r\n this.update(invertY);\r\n }\r\n };\r\n /**\r\n * Clones the texture\r\n * @returns the clone of the texture.\r\n */\r\n DynamicTexture.prototype.clone = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n var textureSize = this.getSize();\r\n var newTexture = new DynamicTexture(this.name, textureSize, scene, this._generateMipMaps);\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n // Dynamic Texture\r\n newTexture.wrapU = this.wrapU;\r\n newTexture.wrapV = this.wrapV;\r\n return newTexture;\r\n };\r\n /**\r\n * Serializes the dynamic texture. The scene should be ready before the dynamic texture is serialized\r\n * @returns a serialized dynamic texture object\r\n */\r\n DynamicTexture.prototype.serialize = function () {\r\n var scene = this.getScene();\r\n if (scene && !scene.isReady()) {\r\n Logger.Warn(\"The scene must be ready before serializing the dynamic texture\");\r\n }\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n if (this._IsCanvasElement(this._canvas)) {\r\n serializationObject.base64String = this._canvas.toDataURL();\r\n }\r\n serializationObject.invertY = this._invertY;\r\n serializationObject.samplingMode = this.samplingMode;\r\n return serializationObject;\r\n };\r\n DynamicTexture.prototype._IsCanvasElement = function (canvas) {\r\n return canvas.toDataURL !== undefined;\r\n };\r\n /** @hidden */\r\n DynamicTexture.prototype._rebuild = function () {\r\n this.update();\r\n };\r\n return DynamicTexture;\r\n}(Texture));\r\nexport { DynamicTexture };\r\n//# sourceMappingURL=dynamicTexture.js.map","import { Observable } from \"../../Misc/observable\";\r\nimport { RenderTargetCreationOptions } from \"../../Materials/Textures/renderTargetCreationOptions\";\r\nimport { _DevTools } from '../../Misc/devTools';\r\n/**\r\n * Defines the source of the internal texture\r\n */\r\nexport var InternalTextureSource;\r\n(function (InternalTextureSource) {\r\n /**\r\n * The source of the texture data is unknown\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Unknown\"] = 0] = \"Unknown\";\r\n /**\r\n * Texture data comes from an URL\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Url\"] = 1] = \"Url\";\r\n /**\r\n * Texture data is only used for temporary storage\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Temp\"] = 2] = \"Temp\";\r\n /**\r\n * Texture data comes from raw data (ArrayBuffer)\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Raw\"] = 3] = \"Raw\";\r\n /**\r\n * Texture content is dynamic (video or dynamic texture)\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Dynamic\"] = 4] = \"Dynamic\";\r\n /**\r\n * Texture content is generated by rendering to it\r\n */\r\n InternalTextureSource[InternalTextureSource[\"RenderTarget\"] = 5] = \"RenderTarget\";\r\n /**\r\n * Texture content is part of a multi render target process\r\n */\r\n InternalTextureSource[InternalTextureSource[\"MultiRenderTarget\"] = 6] = \"MultiRenderTarget\";\r\n /**\r\n * Texture data comes from a cube data file\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Cube\"] = 7] = \"Cube\";\r\n /**\r\n * Texture data comes from a raw cube data\r\n */\r\n InternalTextureSource[InternalTextureSource[\"CubeRaw\"] = 8] = \"CubeRaw\";\r\n /**\r\n * Texture data come from a prefiltered cube data file\r\n */\r\n InternalTextureSource[InternalTextureSource[\"CubePrefiltered\"] = 9] = \"CubePrefiltered\";\r\n /**\r\n * Texture content is raw 3D data\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Raw3D\"] = 10] = \"Raw3D\";\r\n /**\r\n * Texture content is raw 2D array data\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Raw2DArray\"] = 11] = \"Raw2DArray\";\r\n /**\r\n * Texture content is a depth texture\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Depth\"] = 12] = \"Depth\";\r\n /**\r\n * Texture data comes from a raw cube data encoded with RGBD\r\n */\r\n InternalTextureSource[InternalTextureSource[\"CubeRawRGBD\"] = 13] = \"CubeRawRGBD\";\r\n})(InternalTextureSource || (InternalTextureSource = {}));\r\n/**\r\n * Class used to store data associated with WebGL texture data for the engine\r\n * This class should not be used directly\r\n */\r\nvar InternalTexture = /** @class */ (function () {\r\n /**\r\n * Creates a new InternalTexture\r\n * @param engine defines the engine to use\r\n * @param source defines the type of data that will be used\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n function InternalTexture(engine, source, delayAllocation) {\r\n if (delayAllocation === void 0) { delayAllocation = false; }\r\n /**\r\n * Defines if the texture is ready\r\n */\r\n this.isReady = false;\r\n /**\r\n * Defines if the texture is a cube texture\r\n */\r\n this.isCube = false;\r\n /**\r\n * Defines if the texture contains 3D data\r\n */\r\n this.is3D = false;\r\n /**\r\n * Defines if the texture contains 2D array data\r\n */\r\n this.is2DArray = false;\r\n /**\r\n * Defines if the texture contains multiview data\r\n */\r\n this.isMultiview = false;\r\n /**\r\n * Gets the URL used to load this texture\r\n */\r\n this.url = \"\";\r\n /**\r\n * Gets the sampling mode of the texture\r\n */\r\n this.samplingMode = -1;\r\n /**\r\n * Gets a boolean indicating if the texture needs mipmaps generation\r\n */\r\n this.generateMipMaps = false;\r\n /**\r\n * Gets the number of samples used by the texture (WebGL2+ only)\r\n */\r\n this.samples = 0;\r\n /**\r\n * Gets the type of the texture (int, float...)\r\n */\r\n this.type = -1;\r\n /**\r\n * Gets the format of the texture (RGB, RGBA...)\r\n */\r\n this.format = -1;\r\n /**\r\n * Observable called when the texture is loaded\r\n */\r\n this.onLoadedObservable = new Observable();\r\n /**\r\n * Gets the width of the texture\r\n */\r\n this.width = 0;\r\n /**\r\n * Gets the height of the texture\r\n */\r\n this.height = 0;\r\n /**\r\n * Gets the depth of the texture\r\n */\r\n this.depth = 0;\r\n /**\r\n * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseWidth = 0;\r\n /**\r\n * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseHeight = 0;\r\n /**\r\n * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseDepth = 0;\r\n /**\r\n * Gets a boolean indicating if the texture is inverted on Y axis\r\n */\r\n this.invertY = false;\r\n // Private\r\n /** @hidden */\r\n this._invertVScale = false;\r\n /** @hidden */\r\n this._associatedChannel = -1;\r\n /** @hidden */\r\n this._source = InternalTextureSource.Unknown;\r\n /** @hidden */\r\n this._buffer = null;\r\n /** @hidden */\r\n this._bufferView = null;\r\n /** @hidden */\r\n this._bufferViewArray = null;\r\n /** @hidden */\r\n this._bufferViewArrayArray = null;\r\n /** @hidden */\r\n this._size = 0;\r\n /** @hidden */\r\n this._extension = \"\";\r\n /** @hidden */\r\n this._files = null;\r\n /** @hidden */\r\n this._workingCanvas = null;\r\n /** @hidden */\r\n this._workingContext = null;\r\n /** @hidden */\r\n this._framebuffer = null;\r\n /** @hidden */\r\n this._depthStencilBuffer = null;\r\n /** @hidden */\r\n this._MSAAFramebuffer = null;\r\n /** @hidden */\r\n this._MSAARenderBuffer = null;\r\n /** @hidden */\r\n this._attachments = null;\r\n /** @hidden */\r\n this._textureArray = null;\r\n /** @hidden */\r\n this._cachedCoordinatesMode = null;\r\n /** @hidden */\r\n this._cachedWrapU = null;\r\n /** @hidden */\r\n this._cachedWrapV = null;\r\n /** @hidden */\r\n this._cachedWrapR = null;\r\n /** @hidden */\r\n this._cachedAnisotropicFilteringLevel = null;\r\n /** @hidden */\r\n this._isDisabled = false;\r\n /** @hidden */\r\n this._compression = null;\r\n /** @hidden */\r\n this._generateStencilBuffer = false;\r\n /** @hidden */\r\n this._generateDepthBuffer = false;\r\n /** @hidden */\r\n this._comparisonFunction = 0;\r\n /** @hidden */\r\n this._sphericalPolynomial = null;\r\n /** @hidden */\r\n this._lodGenerationScale = 0;\r\n /** @hidden */\r\n this._lodGenerationOffset = 0;\r\n // Multiview\r\n /** @hidden */\r\n this._colorTextureArray = null;\r\n /** @hidden */\r\n this._depthStencilTextureArray = null;\r\n // The following three fields helps sharing generated fixed LODs for texture filtering\r\n // In environment not supporting the textureLOD extension like EDGE. They are for internal use only.\r\n // They are at the level of the gl texture to benefit from the cache.\r\n /** @hidden */\r\n this._lodTextureHigh = null;\r\n /** @hidden */\r\n this._lodTextureMid = null;\r\n /** @hidden */\r\n this._lodTextureLow = null;\r\n /** @hidden */\r\n this._isRGBD = false;\r\n /** @hidden */\r\n this._linearSpecularLOD = false;\r\n /** @hidden */\r\n this._irradianceTexture = null;\r\n /** @hidden */\r\n this._webGLTexture = null;\r\n /** @hidden */\r\n this._references = 1;\r\n /** @hidden */\r\n this._gammaSpace = null;\r\n this._engine = engine;\r\n this._source = source;\r\n if (!delayAllocation) {\r\n this._webGLTexture = engine._createTexture();\r\n }\r\n }\r\n /**\r\n * Gets the Engine the texture belongs to.\r\n * @returns The babylon engine\r\n */\r\n InternalTexture.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n Object.defineProperty(InternalTexture.prototype, \"source\", {\r\n /**\r\n * Gets the data source type of the texture\r\n */\r\n get: function () {\r\n return this._source;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Increments the number of references (ie. the number of Texture that point to it)\r\n */\r\n InternalTexture.prototype.incrementReferences = function () {\r\n this._references++;\r\n };\r\n /**\r\n * Change the size of the texture (not the size of the content)\r\n * @param width defines the new width\r\n * @param height defines the new height\r\n * @param depth defines the new depth (1 by default)\r\n */\r\n InternalTexture.prototype.updateSize = function (width, height, depth) {\r\n if (depth === void 0) { depth = 1; }\r\n this.width = width;\r\n this.height = height;\r\n this.depth = depth;\r\n this.baseWidth = width;\r\n this.baseHeight = height;\r\n this.baseDepth = depth;\r\n this._size = width * height * depth;\r\n };\r\n /** @hidden */\r\n InternalTexture.prototype._rebuild = function () {\r\n var _this = this;\r\n var _a;\r\n var proxy;\r\n this.isReady = false;\r\n this._cachedCoordinatesMode = null;\r\n this._cachedWrapU = null;\r\n this._cachedWrapV = null;\r\n this._cachedAnisotropicFilteringLevel = null;\r\n switch (this.source) {\r\n case InternalTextureSource.Temp:\r\n return;\r\n case InternalTextureSource.Url:\r\n proxy = this._engine.createTexture((_a = this._originalUrl) !== null && _a !== void 0 ? _a : this.url, !this.generateMipMaps, this.invertY, null, this.samplingMode, function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n }, null, this._buffer, undefined, this.format);\r\n return;\r\n case InternalTextureSource.Raw:\r\n proxy = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.Raw3D:\r\n proxy = this._engine.createRawTexture3D(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.Raw2DArray:\r\n proxy = this._engine.createRawTexture2DArray(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.Dynamic:\r\n proxy = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode);\r\n proxy._swapAndDie(this);\r\n this._engine.updateDynamicTexture(this, this._engine.getRenderingCanvas(), this.invertY, undefined, undefined, true);\r\n // The engine will make sure to update content so no need to flag it as isReady = true\r\n return;\r\n case InternalTextureSource.RenderTarget:\r\n var options = new RenderTargetCreationOptions();\r\n options.generateDepthBuffer = this._generateDepthBuffer;\r\n options.generateMipMaps = this.generateMipMaps;\r\n options.generateStencilBuffer = this._generateStencilBuffer;\r\n options.samplingMode = this.samplingMode;\r\n options.type = this.type;\r\n if (this.isCube) {\r\n proxy = this._engine.createRenderTargetCubeTexture(this.width, options);\r\n }\r\n else {\r\n var size_1 = {\r\n width: this.width,\r\n height: this.height,\r\n layers: this.is2DArray ? this.depth : undefined\r\n };\r\n proxy = this._engine.createRenderTargetTexture(size_1, options);\r\n }\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.Depth:\r\n var depthTextureOptions = {\r\n bilinearFiltering: this.samplingMode !== 2,\r\n comparisonFunction: this._comparisonFunction,\r\n generateStencil: this._generateStencilBuffer,\r\n isCube: this.isCube\r\n };\r\n var size = {\r\n width: this.width,\r\n height: this.height,\r\n layers: this.is2DArray ? this.depth : undefined\r\n };\r\n proxy = this._engine.createDepthStencilTexture(size, depthTextureOptions);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.Cube:\r\n proxy = this._engine.createCubeTexture(this.url, null, this._files, !this.generateMipMaps, function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n }, null, this.format, this._extension);\r\n return;\r\n case InternalTextureSource.CubeRaw:\r\n proxy = this._engine.createRawCubeTexture(this._bufferViewArray, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.CubeRawRGBD:\r\n proxy = this._engine.createRawCubeTexture(null, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n InternalTexture._UpdateRGBDAsync(proxy, this._bufferViewArrayArray, this._sphericalPolynomial, this._lodGenerationScale, this._lodGenerationOffset).then(function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n });\r\n return;\r\n case InternalTextureSource.CubePrefiltered:\r\n proxy = this._engine.createPrefilteredCubeTexture(this.url, null, this._lodGenerationScale, this._lodGenerationOffset, function (proxy) {\r\n if (proxy) {\r\n proxy._swapAndDie(_this);\r\n }\r\n _this.isReady = true;\r\n }, null, this.format, this._extension);\r\n proxy._sphericalPolynomial = this._sphericalPolynomial;\r\n return;\r\n }\r\n };\r\n /** @hidden */\r\n InternalTexture.prototype._swapAndDie = function (target) {\r\n target._webGLTexture = this._webGLTexture;\r\n target._isRGBD = this._isRGBD;\r\n if (this._framebuffer) {\r\n target._framebuffer = this._framebuffer;\r\n }\r\n if (this._depthStencilBuffer) {\r\n target._depthStencilBuffer = this._depthStencilBuffer;\r\n }\r\n target._depthStencilTexture = this._depthStencilTexture;\r\n if (this._lodTextureHigh) {\r\n if (target._lodTextureHigh) {\r\n target._lodTextureHigh.dispose();\r\n }\r\n target._lodTextureHigh = this._lodTextureHigh;\r\n }\r\n if (this._lodTextureMid) {\r\n if (target._lodTextureMid) {\r\n target._lodTextureMid.dispose();\r\n }\r\n target._lodTextureMid = this._lodTextureMid;\r\n }\r\n if (this._lodTextureLow) {\r\n if (target._lodTextureLow) {\r\n target._lodTextureLow.dispose();\r\n }\r\n target._lodTextureLow = this._lodTextureLow;\r\n }\r\n if (this._irradianceTexture) {\r\n if (target._irradianceTexture) {\r\n target._irradianceTexture.dispose();\r\n }\r\n target._irradianceTexture = this._irradianceTexture;\r\n }\r\n var cache = this._engine.getLoadedTexturesCache();\r\n var index = cache.indexOf(this);\r\n if (index !== -1) {\r\n cache.splice(index, 1);\r\n }\r\n var index = cache.indexOf(target);\r\n if (index === -1) {\r\n cache.push(target);\r\n }\r\n };\r\n /**\r\n * Dispose the current allocated resources\r\n */\r\n InternalTexture.prototype.dispose = function () {\r\n if (!this._webGLTexture) {\r\n return;\r\n }\r\n this._references--;\r\n if (this._references === 0) {\r\n this._engine._releaseTexture(this);\r\n this._webGLTexture = null;\r\n }\r\n };\r\n /** @hidden */\r\n InternalTexture._UpdateRGBDAsync = function (internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\r\n throw _DevTools.WarnImport(\"environmentTextureTools\");\r\n };\r\n return InternalTexture;\r\n}());\r\nexport { InternalTexture };\r\n//# sourceMappingURL=internalTexture.js.map","/**\r\n * Define options used to create a render target texture\r\n */\r\nvar RenderTargetCreationOptions = /** @class */ (function () {\r\n function RenderTargetCreationOptions() {\r\n }\r\n return RenderTargetCreationOptions;\r\n}());\r\nexport { RenderTargetCreationOptions };\r\n//# sourceMappingURL=renderTargetCreationOptions.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { Matrix, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { PostProcessManager } from \"../../PostProcesses/postProcessManager\";\r\nimport { RenderingManager } from \"../../Rendering/renderingManager\";\r\nimport \"../../Engines/Extensions/engine.renderTarget\";\r\nimport \"../../Engines/Extensions/engine.renderTargetCube\";\r\nimport { Engine } from '../../Engines/engine';\r\n/**\r\n * This Helps creating a texture that will be created from a camera in your scene.\r\n * It is basically a dynamic texture that could be used to create special effects for instance.\r\n * Actually, It is the base of lot of effects in the framework like post process, shadows, effect layers and rendering pipelines...\r\n */\r\nvar RenderTargetTexture = /** @class */ (function (_super) {\r\n __extends(RenderTargetTexture, _super);\r\n /**\r\n * Instantiate a render target texture. This is mainly used to render of screen the scene to for instance apply post processse\r\n * or used a shadow, depth texture...\r\n * @param name The friendly name of the texture\r\n * @param size The size of the RTT (number if square, or {width: number, height:number} or {ratio:} to define a ratio from the main scene)\r\n * @param scene The scene the RTT belongs to. The latest created scene will be used if not precised.\r\n * @param generateMipMaps True if mip maps need to be generated after render.\r\n * @param doNotChangeAspectRatio True to not change the aspect ratio of the scene in the RTT\r\n * @param type The type of the buffer in the RTT (int, half float, float...)\r\n * @param isCube True if a cube texture needs to be created\r\n * @param samplingMode The sampling mode to be usedwith the render target (Linear, Nearest...)\r\n * @param generateDepthBuffer True to generate a depth buffer\r\n * @param generateStencilBuffer True to generate a stencil buffer\r\n * @param isMulti True if multiple textures need to be created (Draw Buffers)\r\n * @param format The internal format of the buffer in the RTT (RED, RG, RGB, RGBA, ALPHA...)\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n function RenderTargetTexture(name, size, scene, generateMipMaps, doNotChangeAspectRatio, type, isCube, samplingMode, generateDepthBuffer, generateStencilBuffer, isMulti, format, delayAllocation) {\r\n if (doNotChangeAspectRatio === void 0) { doNotChangeAspectRatio = true; }\r\n if (type === void 0) { type = 0; }\r\n if (isCube === void 0) { isCube = false; }\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (generateDepthBuffer === void 0) { generateDepthBuffer = true; }\r\n if (generateStencilBuffer === void 0) { generateStencilBuffer = false; }\r\n if (isMulti === void 0) { isMulti = false; }\r\n if (format === void 0) { format = 5; }\r\n if (delayAllocation === void 0) { delayAllocation = false; }\r\n var _this = _super.call(this, null, scene, !generateMipMaps) || this;\r\n /**\r\n * Define if particles should be rendered in your texture.\r\n */\r\n _this.renderParticles = true;\r\n /**\r\n * Define if sprites should be rendered in your texture.\r\n */\r\n _this.renderSprites = false;\r\n /**\r\n * Define if the camera viewport should be respected while rendering the texture or if the render should be done to the entire texture.\r\n */\r\n _this.ignoreCameraViewport = false;\r\n /**\r\n * An event triggered when the texture is unbind.\r\n */\r\n _this.onBeforeBindObservable = new Observable();\r\n /**\r\n * An event triggered when the texture is unbind.\r\n */\r\n _this.onAfterUnbindObservable = new Observable();\r\n /**\r\n * An event triggered before rendering the texture\r\n */\r\n _this.onBeforeRenderObservable = new Observable();\r\n /**\r\n * An event triggered after rendering the texture\r\n */\r\n _this.onAfterRenderObservable = new Observable();\r\n /**\r\n * An event triggered after the texture clear\r\n */\r\n _this.onClearObservable = new Observable();\r\n /**\r\n * An event triggered when the texture is resized.\r\n */\r\n _this.onResizeObservable = new Observable();\r\n _this._currentRefreshId = -1;\r\n _this._refreshRate = 1;\r\n _this._samples = 1;\r\n /**\r\n * Gets or sets the center of the bounding box associated with the texture (when in cube mode)\r\n * It must define where the camera used to render the texture is set\r\n */\r\n _this.boundingBoxPosition = Vector3.Zero();\r\n scene = _this.getScene();\r\n if (!scene) {\r\n return _this;\r\n }\r\n _this._coordinatesMode = Texture.PROJECTION_MODE;\r\n _this.renderList = new Array();\r\n _this.name = name;\r\n _this.isRenderTarget = true;\r\n _this._initialSizeParameter = size;\r\n _this._processSizeParameter(size);\r\n _this._resizeObserver = _this.getScene().getEngine().onResizeObservable.add(function () {\r\n });\r\n _this._generateMipMaps = generateMipMaps ? true : false;\r\n _this._doNotChangeAspectRatio = doNotChangeAspectRatio;\r\n // Rendering groups\r\n _this._renderingManager = new RenderingManager(scene);\r\n _this._renderingManager._useSceneAutoClearSetup = true;\r\n if (isMulti) {\r\n return _this;\r\n }\r\n _this._renderTargetOptions = {\r\n generateMipMaps: generateMipMaps,\r\n type: type,\r\n format: format,\r\n samplingMode: samplingMode,\r\n generateDepthBuffer: generateDepthBuffer,\r\n generateStencilBuffer: generateStencilBuffer\r\n };\r\n if (samplingMode === Texture.NEAREST_SAMPLINGMODE) {\r\n _this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n _this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n }\r\n if (!delayAllocation) {\r\n if (isCube) {\r\n _this._texture = scene.getEngine().createRenderTargetCubeTexture(_this.getRenderSize(), _this._renderTargetOptions);\r\n _this.coordinatesMode = Texture.INVCUBIC_MODE;\r\n _this._textureMatrix = Matrix.Identity();\r\n }\r\n else {\r\n _this._texture = scene.getEngine().createRenderTargetTexture(_this._size, _this._renderTargetOptions);\r\n }\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(RenderTargetTexture.prototype, \"renderList\", {\r\n /**\r\n * Use this list to define the list of mesh you want to render.\r\n */\r\n get: function () {\r\n return this._renderList;\r\n },\r\n set: function (value) {\r\n this._renderList = value;\r\n if (this._renderList) {\r\n this._hookArray(this._renderList);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n RenderTargetTexture.prototype._hookArray = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var wasEmpty = array.length === 0;\r\n var result = oldPush.apply(array, items);\r\n if (wasEmpty && _this.getScene()) {\r\n _this.getScene().meshes.forEach(function (mesh) {\r\n mesh._markSubMeshesAsLightDirty();\r\n });\r\n }\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n if (array.length === 0) {\r\n _this.getScene().meshes.forEach(function (mesh) {\r\n mesh._markSubMeshesAsLightDirty();\r\n });\r\n }\r\n return deleted;\r\n };\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onAfterUnbind\", {\r\n /**\r\n * Set a after unbind callback in the texture.\r\n * This has been kept for backward compatibility and use of onAfterUnbindObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onAfterUnbindObserver) {\r\n this.onAfterUnbindObservable.remove(this._onAfterUnbindObserver);\r\n }\r\n this._onAfterUnbindObserver = this.onAfterUnbindObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onBeforeRender\", {\r\n /**\r\n * Set a before render callback in the texture.\r\n * This has been kept for backward compatibility and use of onBeforeRenderObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onAfterRender\", {\r\n /**\r\n * Set a after render callback in the texture.\r\n * This has been kept for backward compatibility and use of onAfterRenderObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"onClear\", {\r\n /**\r\n * Set a clear callback in the texture.\r\n * This has been kept for backward compatibility and use of onClearObservable is recommended.\r\n */\r\n set: function (callback) {\r\n if (this._onClearObserver) {\r\n this.onClearObservable.remove(this._onClearObserver);\r\n }\r\n this._onClearObserver = this.onClearObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"renderTargetOptions\", {\r\n /**\r\n * Gets render target creation options that were used.\r\n */\r\n get: function () {\r\n return this._renderTargetOptions;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n RenderTargetTexture.prototype._onRatioRescale = function () {\r\n if (this._sizeRatio) {\r\n this.resize(this._initialSizeParameter);\r\n }\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"boundingBoxSize\", {\r\n get: function () {\r\n return this._boundingBoxSize;\r\n },\r\n /**\r\n * Gets or sets the size of the bounding box associated with the texture (when in cube mode)\r\n * When defined, the cubemap will switch to local mode\r\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\r\n * @example https://www.babylonjs-playground.com/#RNASML\r\n */\r\n set: function (value) {\r\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\r\n return;\r\n }\r\n this._boundingBoxSize = value;\r\n var scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(1);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderTargetTexture.prototype, \"depthStencilTexture\", {\r\n /**\r\n * In case the RTT has been created with a depth texture, get the associated\r\n * depth texture.\r\n * Otherwise, return null.\r\n */\r\n get: function () {\r\n var _a;\r\n return ((_a = this.getInternalTexture()) === null || _a === void 0 ? void 0 : _a._depthStencilTexture) || null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a depth stencil texture.\r\n * This is only available in WebGL 2 or with the depth texture extension available.\r\n * @param comparisonFunction Specifies the comparison function to set on the texture. If 0 or undefined, the texture is not in comparison mode\r\n * @param bilinearFiltering Specifies whether or not bilinear filtering is enable on the texture\r\n * @param generateStencil Specifies whether or not a stencil should be allocated in the texture\r\n */\r\n RenderTargetTexture.prototype.createDepthStencilTexture = function (comparisonFunction, bilinearFiltering, generateStencil) {\r\n if (comparisonFunction === void 0) { comparisonFunction = 0; }\r\n if (bilinearFiltering === void 0) { bilinearFiltering = true; }\r\n if (generateStencil === void 0) { generateStencil = false; }\r\n var internalTexture = this.getInternalTexture();\r\n if (!this.getScene() || !internalTexture) {\r\n return;\r\n }\r\n var engine = this.getScene().getEngine();\r\n internalTexture._depthStencilTexture = engine.createDepthStencilTexture(this._size, {\r\n bilinearFiltering: bilinearFiltering,\r\n comparisonFunction: comparisonFunction,\r\n generateStencil: generateStencil,\r\n isCube: this.isCube\r\n });\r\n };\r\n RenderTargetTexture.prototype._processSizeParameter = function (size) {\r\n if (size.ratio) {\r\n this._sizeRatio = size.ratio;\r\n var engine = this._getEngine();\r\n this._size = {\r\n width: this._bestReflectionRenderTargetDimension(engine.getRenderWidth(), this._sizeRatio),\r\n height: this._bestReflectionRenderTargetDimension(engine.getRenderHeight(), this._sizeRatio)\r\n };\r\n }\r\n else {\r\n this._size = size;\r\n }\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"samples\", {\r\n /**\r\n * Define the number of samples to use in case of MSAA.\r\n * It defaults to one meaning no MSAA has been enabled.\r\n */\r\n get: function () {\r\n return this._samples;\r\n },\r\n set: function (value) {\r\n if (this._samples === value) {\r\n return;\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._samples = scene.getEngine().updateRenderTargetTextureSampleCount(this._texture, value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Resets the refresh counter of the texture and start bak from scratch.\r\n * Could be useful to regenerate the texture if it is setup to render only once.\r\n */\r\n RenderTargetTexture.prototype.resetRefreshCounter = function () {\r\n this._currentRefreshId = -1;\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"refreshRate\", {\r\n /**\r\n * Define the refresh rate of the texture or the rendering frequency.\r\n * Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...\r\n */\r\n get: function () {\r\n return this._refreshRate;\r\n },\r\n set: function (value) {\r\n this._refreshRate = value;\r\n this.resetRefreshCounter();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Adds a post process to the render target rendering passes.\r\n * @param postProcess define the post process to add\r\n */\r\n RenderTargetTexture.prototype.addPostProcess = function (postProcess) {\r\n if (!this._postProcessManager) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._postProcessManager = new PostProcessManager(scene);\r\n this._postProcesses = new Array();\r\n }\r\n this._postProcesses.push(postProcess);\r\n this._postProcesses[0].autoClear = false;\r\n };\r\n /**\r\n * Clear all the post processes attached to the render target\r\n * @param dispose define if the cleared post processesshould also be disposed (false by default)\r\n */\r\n RenderTargetTexture.prototype.clearPostProcesses = function (dispose) {\r\n if (dispose === void 0) { dispose = false; }\r\n if (!this._postProcesses) {\r\n return;\r\n }\r\n if (dispose) {\r\n for (var _i = 0, _a = this._postProcesses; _i < _a.length; _i++) {\r\n var postProcess = _a[_i];\r\n postProcess.dispose();\r\n }\r\n }\r\n this._postProcesses = [];\r\n };\r\n /**\r\n * Remove one of the post process from the list of attached post processes to the texture\r\n * @param postProcess define the post process to remove from the list\r\n */\r\n RenderTargetTexture.prototype.removePostProcess = function (postProcess) {\r\n if (!this._postProcesses) {\r\n return;\r\n }\r\n var index = this._postProcesses.indexOf(postProcess);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._postProcesses.splice(index, 1);\r\n if (this._postProcesses.length > 0) {\r\n this._postProcesses[0].autoClear = false;\r\n }\r\n };\r\n /** @hidden */\r\n RenderTargetTexture.prototype._shouldRender = function () {\r\n if (this._currentRefreshId === -1) { // At least render once\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n if (this.refreshRate === this._currentRefreshId) {\r\n this._currentRefreshId = 1;\r\n return true;\r\n }\r\n this._currentRefreshId++;\r\n return false;\r\n };\r\n /**\r\n * Gets the actual render size of the texture.\r\n * @returns the width of the render size\r\n */\r\n RenderTargetTexture.prototype.getRenderSize = function () {\r\n return this.getRenderWidth();\r\n };\r\n /**\r\n * Gets the actual render width of the texture.\r\n * @returns the width of the render size\r\n */\r\n RenderTargetTexture.prototype.getRenderWidth = function () {\r\n if (this._size.width) {\r\n return this._size.width;\r\n }\r\n return this._size;\r\n };\r\n /**\r\n * Gets the actual render height of the texture.\r\n * @returns the height of the render size\r\n */\r\n RenderTargetTexture.prototype.getRenderHeight = function () {\r\n if (this._size.width) {\r\n return this._size.height;\r\n }\r\n return this._size;\r\n };\r\n /**\r\n * Gets the actual number of layers of the texture.\r\n * @returns the number of layers\r\n */\r\n RenderTargetTexture.prototype.getRenderLayers = function () {\r\n var layers = this._size.layers;\r\n if (layers) {\r\n return layers;\r\n }\r\n return 0;\r\n };\r\n Object.defineProperty(RenderTargetTexture.prototype, \"canRescale\", {\r\n /**\r\n * Get if the texture can be rescaled or not.\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Resize the texture using a ratio.\r\n * @param ratio the ratio to apply to the texture size in order to compute the new target size\r\n */\r\n RenderTargetTexture.prototype.scale = function (ratio) {\r\n var newSize = Math.max(1, this.getRenderSize() * ratio);\r\n this.resize(newSize);\r\n };\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n RenderTargetTexture.prototype.getReflectionTextureMatrix = function () {\r\n if (this.isCube) {\r\n return this._textureMatrix;\r\n }\r\n return _super.prototype.getReflectionTextureMatrix.call(this);\r\n };\r\n /**\r\n * Resize the texture to a new desired size.\r\n * Be carrefull as it will recreate all the data in the new texture.\r\n * @param size Define the new size. It can be:\r\n * - a number for squared texture,\r\n * - an object containing { width: number, height: number }\r\n * - or an object containing a ratio { ratio: number }\r\n */\r\n RenderTargetTexture.prototype.resize = function (size) {\r\n var wasCube = this.isCube;\r\n this.releaseInternalTexture();\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._processSizeParameter(size);\r\n if (wasCube) {\r\n this._texture = scene.getEngine().createRenderTargetCubeTexture(this.getRenderSize(), this._renderTargetOptions);\r\n }\r\n else {\r\n this._texture = scene.getEngine().createRenderTargetTexture(this._size, this._renderTargetOptions);\r\n }\r\n if (this.onResizeObservable.hasObservers()) {\r\n this.onResizeObservable.notifyObservers(this);\r\n }\r\n };\r\n /**\r\n * Renders all the objects from the render list into the texture.\r\n * @param useCameraPostProcess Define if camera post processes should be used during the rendering\r\n * @param dumpForDebug Define if the rendering result should be dumped (copied) for debugging purpose\r\n */\r\n RenderTargetTexture.prototype.render = function (useCameraPostProcess, dumpForDebug) {\r\n if (useCameraPostProcess === void 0) { useCameraPostProcess = false; }\r\n if (dumpForDebug === void 0) { dumpForDebug = false; }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n if (this.useCameraPostProcesses !== undefined) {\r\n useCameraPostProcess = this.useCameraPostProcesses;\r\n }\r\n if (this._waitingRenderList) {\r\n this.renderList = [];\r\n for (var index = 0; index < this._waitingRenderList.length; index++) {\r\n var id = this._waitingRenderList[index];\r\n var mesh_1 = scene.getMeshByID(id);\r\n if (mesh_1) {\r\n this.renderList.push(mesh_1);\r\n }\r\n }\r\n this._waitingRenderList = undefined;\r\n }\r\n // Is predicate defined?\r\n if (this.renderListPredicate) {\r\n if (this.renderList) {\r\n this.renderList.length = 0; // Clear previous renderList\r\n }\r\n else {\r\n this.renderList = [];\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var sceneMeshes = scene.meshes;\r\n for (var index = 0; index < sceneMeshes.length; index++) {\r\n var mesh = sceneMeshes[index];\r\n if (this.renderListPredicate(mesh)) {\r\n this.renderList.push(mesh);\r\n }\r\n }\r\n }\r\n this.onBeforeBindObservable.notifyObservers(this);\r\n // Set custom projection.\r\n // Needs to be before binding to prevent changing the aspect ratio.\r\n var camera;\r\n if (this.activeCamera) {\r\n camera = this.activeCamera;\r\n engine.setViewport(this.activeCamera.viewport, this.getRenderWidth(), this.getRenderHeight());\r\n if (this.activeCamera !== scene.activeCamera) {\r\n scene.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(true));\r\n }\r\n }\r\n else {\r\n camera = scene.activeCamera;\r\n if (camera) {\r\n engine.setViewport(camera.viewport, this.getRenderWidth(), this.getRenderHeight());\r\n }\r\n }\r\n this._defaultRenderListPrepared = false;\r\n if (this.is2DArray) {\r\n for (var layer = 0; layer < this.getRenderLayers(); layer++) {\r\n this.renderToTarget(0, useCameraPostProcess, dumpForDebug, layer, camera);\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n }\r\n }\r\n else if (this.isCube) {\r\n for (var face = 0; face < 6; face++) {\r\n this.renderToTarget(face, useCameraPostProcess, dumpForDebug, undefined, camera);\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n }\r\n }\r\n else {\r\n this.renderToTarget(0, useCameraPostProcess, dumpForDebug, undefined, camera);\r\n }\r\n this.onAfterUnbindObservable.notifyObservers(this);\r\n if (scene.activeCamera) {\r\n // Do not avoid setting uniforms when multiple scenes are active as another camera may have overwrite these\r\n if (scene.getEngine().scenes.length > 1 || (this.activeCamera && this.activeCamera !== scene.activeCamera)) {\r\n scene.setTransformMatrix(scene.activeCamera.getViewMatrix(), scene.activeCamera.getProjectionMatrix(true));\r\n }\r\n engine.setViewport(scene.activeCamera.viewport);\r\n }\r\n scene.resetCachedMaterial();\r\n };\r\n RenderTargetTexture.prototype._bestReflectionRenderTargetDimension = function (renderDimension, scale) {\r\n var minimum = 128;\r\n var x = renderDimension * scale;\r\n var curved = Engine.NearestPOT(x + (minimum * minimum / (minimum + x)));\r\n // Ensure we don't exceed the render dimension (while staying POT)\r\n return Math.min(Engine.FloorPOT(renderDimension), curved);\r\n };\r\n RenderTargetTexture.prototype._prepareRenderingManager = function (currentRenderList, currentRenderListLength, camera, checkLayerMask) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._renderingManager.reset();\r\n var sceneRenderId = scene.getRenderId();\r\n for (var meshIndex = 0; meshIndex < currentRenderListLength; meshIndex++) {\r\n var mesh = currentRenderList[meshIndex];\r\n if (mesh && !mesh.isBlocked) {\r\n if (this.customIsReadyFunction) {\r\n if (!this.customIsReadyFunction(mesh, this.refreshRate)) {\r\n this.resetRefreshCounter();\r\n continue;\r\n }\r\n }\r\n else if (!mesh.isReady(this.refreshRate === 0)) {\r\n this.resetRefreshCounter();\r\n continue;\r\n }\r\n if (!mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate && scene.activeCamera) {\r\n mesh._internalAbstractMeshDataInfo._currentLOD = scene.customLODSelector ? scene.customLODSelector(mesh, scene.activeCamera) : mesh.getLOD(scene.activeCamera);\r\n mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate = true;\r\n }\r\n if (!mesh._internalAbstractMeshDataInfo._currentLOD) {\r\n continue;\r\n }\r\n var meshToRender = mesh._internalAbstractMeshDataInfo._currentLOD;\r\n meshToRender._preActivateForIntermediateRendering(sceneRenderId);\r\n var isMasked = void 0;\r\n if (checkLayerMask && camera) {\r\n isMasked = ((mesh.layerMask & camera.layerMask) === 0);\r\n }\r\n else {\r\n isMasked = false;\r\n }\r\n if (mesh.isEnabled() && mesh.isVisible && mesh.subMeshes && !isMasked) {\r\n if (meshToRender !== mesh) {\r\n meshToRender._activate(sceneRenderId, true);\r\n }\r\n if (mesh._activate(sceneRenderId, true) && mesh.subMeshes.length) {\r\n if (!mesh.isAnInstance) {\r\n meshToRender._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = false;\r\n }\r\n else {\r\n if (mesh._internalAbstractMeshDataInfo._actAsRegularMesh) {\r\n meshToRender = mesh;\r\n }\r\n }\r\n meshToRender._internalAbstractMeshDataInfo._isActiveIntermediate = true;\r\n for (var subIndex = 0; subIndex < meshToRender.subMeshes.length; subIndex++) {\r\n var subMesh = meshToRender.subMeshes[subIndex];\r\n this._renderingManager.dispatch(subMesh, meshToRender);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n for (var particleIndex = 0; particleIndex < scene.particleSystems.length; particleIndex++) {\r\n var particleSystem = scene.particleSystems[particleIndex];\r\n var emitter = particleSystem.emitter;\r\n if (!particleSystem.isStarted() || !emitter || !emitter.position || !emitter.isEnabled()) {\r\n continue;\r\n }\r\n if (currentRenderList.indexOf(emitter) >= 0) {\r\n this._renderingManager.dispatchParticles(particleSystem);\r\n }\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * @param faceIndex face index to bind to if this is a cubetexture\r\n * @param layer defines the index of the texture to bind in the array\r\n */\r\n RenderTargetTexture.prototype._bindFrameBuffer = function (faceIndex, layer) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (layer === void 0) { layer = 0; }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n if (this._texture) {\r\n engine.bindFramebuffer(this._texture, this.isCube ? faceIndex : undefined, undefined, undefined, this.ignoreCameraViewport, 0, layer);\r\n }\r\n };\r\n RenderTargetTexture.prototype.unbindFrameBuffer = function (engine, faceIndex) {\r\n var _this = this;\r\n if (!this._texture) {\r\n return;\r\n }\r\n engine.unBindFramebuffer(this._texture, this.isCube, function () {\r\n _this.onAfterRenderObservable.notifyObservers(faceIndex);\r\n });\r\n };\r\n RenderTargetTexture.prototype.renderToTarget = function (faceIndex, useCameraPostProcess, dumpForDebug, layer, camera) {\r\n if (layer === void 0) { layer = 0; }\r\n if (camera === void 0) { camera = null; }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n if (!this._texture) {\r\n return;\r\n }\r\n // Bind\r\n if (this._postProcessManager) {\r\n this._postProcessManager._prepareFrame(this._texture, this._postProcesses);\r\n }\r\n else if (!useCameraPostProcess || !scene.postProcessManager._prepareFrame(this._texture)) {\r\n this._bindFrameBuffer(faceIndex, layer);\r\n }\r\n if (this.is2DArray) {\r\n this.onBeforeRenderObservable.notifyObservers(layer);\r\n }\r\n else {\r\n this.onBeforeRenderObservable.notifyObservers(faceIndex);\r\n }\r\n // Get the list of meshes to render\r\n var currentRenderList = null;\r\n var defaultRenderList = this.renderList ? this.renderList : scene.getActiveMeshes().data;\r\n var defaultRenderListLength = this.renderList ? this.renderList.length : scene.getActiveMeshes().length;\r\n if (this.getCustomRenderList) {\r\n currentRenderList = this.getCustomRenderList(this.is2DArray ? layer : faceIndex, defaultRenderList, defaultRenderListLength);\r\n }\r\n if (!currentRenderList) {\r\n // No custom render list provided, we prepare the rendering for the default list, but check\r\n // first if we did not already performed the preparation before so as to avoid re-doing it several times\r\n if (!this._defaultRenderListPrepared) {\r\n this._prepareRenderingManager(defaultRenderList, defaultRenderListLength, camera, !this.renderList);\r\n this._defaultRenderListPrepared = true;\r\n }\r\n currentRenderList = defaultRenderList;\r\n }\r\n else {\r\n // Prepare the rendering for the custom render list provided\r\n this._prepareRenderingManager(currentRenderList, currentRenderList.length, camera, false);\r\n }\r\n // Clear\r\n if (this.onClearObservable.hasObservers()) {\r\n this.onClearObservable.notifyObservers(engine);\r\n }\r\n else {\r\n engine.clear(this.clearColor || scene.clearColor, true, true, true);\r\n }\r\n if (!this._doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n // Before Camera Draw\r\n for (var _i = 0, _a = scene._beforeRenderTargetDrawStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(this);\r\n }\r\n // Render\r\n this._renderingManager.render(this.customRenderFunction, currentRenderList, this.renderParticles, this.renderSprites);\r\n // After Camera Draw\r\n for (var _b = 0, _c = scene._afterRenderTargetDrawStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action(this);\r\n }\r\n if (this._postProcessManager) {\r\n this._postProcessManager._finalizeFrame(false, this._texture, faceIndex, this._postProcesses, this.ignoreCameraViewport);\r\n }\r\n else if (useCameraPostProcess) {\r\n scene.postProcessManager._finalizeFrame(false, this._texture, faceIndex);\r\n }\r\n if (!this._doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n // Dump ?\r\n if (dumpForDebug) {\r\n Tools.DumpFramebuffer(this.getRenderWidth(), this.getRenderHeight(), engine);\r\n }\r\n // Unbind\r\n if (!this.isCube || faceIndex === 5) {\r\n if (this.isCube) {\r\n if (faceIndex === 5) {\r\n engine.generateMipMapsForCubemap(this._texture);\r\n }\r\n }\r\n this.unbindFrameBuffer(engine, faceIndex);\r\n }\r\n else {\r\n this.onAfterRenderObservable.notifyObservers(faceIndex);\r\n }\r\n };\r\n /**\r\n * Overrides the default sort function applied in the renderging group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversly depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n RenderTargetTexture.prototype.setRenderingOrder = function (renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);\r\n };\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n */\r\n RenderTargetTexture.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil) {\r\n this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil);\r\n this._renderingManager._useSceneAutoClearSetup = false;\r\n };\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n RenderTargetTexture.prototype.clone = function () {\r\n var textureSize = this.getSize();\r\n var newTexture = new RenderTargetTexture(this.name, textureSize, this.getScene(), this._renderTargetOptions.generateMipMaps, this._doNotChangeAspectRatio, this._renderTargetOptions.type, this.isCube, this._renderTargetOptions.samplingMode, this._renderTargetOptions.generateDepthBuffer, this._renderTargetOptions.generateStencilBuffer);\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n // RenderTarget Texture\r\n newTexture.coordinatesMode = this.coordinatesMode;\r\n if (this.renderList) {\r\n newTexture.renderList = this.renderList.slice(0);\r\n }\r\n return newTexture;\r\n };\r\n /**\r\n * Serialize the texture to a JSON representation we can easily use in the resepective Parse function.\r\n * @returns The JSON representation of the texture\r\n */\r\n RenderTargetTexture.prototype.serialize = function () {\r\n if (!this.name) {\r\n return null;\r\n }\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n serializationObject.renderTargetSize = this.getRenderSize();\r\n serializationObject.renderList = [];\r\n if (this.renderList) {\r\n for (var index = 0; index < this.renderList.length; index++) {\r\n serializationObject.renderList.push(this.renderList[index].id);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * This will remove the attached framebuffer objects. The texture will not be able to be used as render target anymore\r\n */\r\n RenderTargetTexture.prototype.disposeFramebufferObjects = function () {\r\n var objBuffer = this.getInternalTexture();\r\n var scene = this.getScene();\r\n if (objBuffer && scene) {\r\n scene.getEngine()._releaseFramebufferObjects(objBuffer);\r\n }\r\n };\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n RenderTargetTexture.prototype.dispose = function () {\r\n this.onResizeObservable.clear();\r\n this.onClearObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onAfterUnbindObservable.clear();\r\n this.onBeforeBindObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n if (this._postProcessManager) {\r\n this._postProcessManager.dispose();\r\n this._postProcessManager = null;\r\n }\r\n this.clearPostProcesses(true);\r\n if (this._resizeObserver) {\r\n this.getScene().getEngine().onResizeObservable.remove(this._resizeObserver);\r\n this._resizeObserver = null;\r\n }\r\n this.renderList = null;\r\n // Remove from custom render targets\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var index = scene.customRenderTargets.indexOf(this);\r\n if (index >= 0) {\r\n scene.customRenderTargets.splice(index, 1);\r\n }\r\n for (var _i = 0, _a = scene.cameras; _i < _a.length; _i++) {\r\n var camera = _a[_i];\r\n index = camera.customRenderTargets.indexOf(this);\r\n if (index >= 0) {\r\n camera.customRenderTargets.splice(index, 1);\r\n }\r\n }\r\n if (this.depthStencilTexture) {\r\n this.getScene().getEngine()._releaseTexture(this.depthStencilTexture);\r\n }\r\n _super.prototype.dispose.call(this);\r\n };\r\n /** @hidden */\r\n RenderTargetTexture.prototype._rebuild = function () {\r\n if (this.refreshRate === RenderTargetTexture.REFRESHRATE_RENDER_ONCE) {\r\n this.refreshRate = RenderTargetTexture.REFRESHRATE_RENDER_ONCE;\r\n }\r\n if (this._postProcessManager) {\r\n this._postProcessManager._rebuild();\r\n }\r\n };\r\n /**\r\n * Clear the info related to rendering groups preventing retention point in material dispose.\r\n */\r\n RenderTargetTexture.prototype.freeRenderingGroups = function () {\r\n if (this._renderingManager) {\r\n this._renderingManager.freeRenderingGroups();\r\n }\r\n };\r\n /**\r\n * Gets the number of views the corresponding to the texture (eg. a MultiviewRenderTarget will have > 1)\r\n * @returns the view count\r\n */\r\n RenderTargetTexture.prototype.getViewCount = function () {\r\n return 1;\r\n };\r\n /**\r\n * The texture will only be rendered once which can be useful to improve performance if everything in your render is static for instance.\r\n */\r\n RenderTargetTexture.REFRESHRATE_RENDER_ONCE = 0;\r\n /**\r\n * The texture will only be rendered rendered every frame and is recomended for dynamic contents.\r\n */\r\n RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME = 1;\r\n /**\r\n * The texture will be rendered every 2 frames which could be enough if your dynamic objects are not\r\n * the central point of your effect and can save a lot of performances.\r\n */\r\n RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYTWOFRAMES = 2;\r\n return RenderTargetTexture;\r\n}(Texture));\r\nexport { RenderTargetTexture };\r\nTexture._CreateRenderTargetTexture = function (name, renderTargetSize, scene, generateMipMaps) {\r\n return new RenderTargetTexture(name, renderTargetSize, scene, generateMipMaps);\r\n};\r\n//# sourceMappingURL=renderTargetTexture.js.map","/**\r\n * Class used to host copy specific utilities\r\n */\r\nvar CopyTools = /** @class */ (function () {\r\n function CopyTools() {\r\n }\r\n /**\r\n * Reads the pixels stored in the webgl texture and returns them as a base64 string\r\n * @param texture defines the texture to read pixels from\r\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\r\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\r\n * @returns The base64 encoded string or null\r\n */\r\n CopyTools.GenerateBase64StringFromTexture = function (texture, faceIndex, level) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (level === void 0) { level = 0; }\r\n var internalTexture = texture.getInternalTexture();\r\n if (!internalTexture) {\r\n return null;\r\n }\r\n var pixels = texture.readPixels(faceIndex, level);\r\n if (!pixels) {\r\n return null;\r\n }\r\n var size = texture.getSize();\r\n var width = size.width;\r\n var height = size.height;\r\n if (pixels instanceof Float32Array) {\r\n var len = pixels.byteLength / pixels.BYTES_PER_ELEMENT;\r\n var npixels = new Uint8Array(len);\r\n while (--len >= 0) {\r\n var val = pixels[len];\r\n if (val < 0) {\r\n val = 0;\r\n }\r\n else if (val > 1) {\r\n val = 1;\r\n }\r\n npixels[len] = val * 255;\r\n }\r\n pixels = npixels;\r\n }\r\n var canvas = document.createElement('canvas');\r\n canvas.width = width;\r\n canvas.height = height;\r\n var ctx = canvas.getContext('2d');\r\n if (!ctx) {\r\n return null;\r\n }\r\n var imageData = ctx.createImageData(width, height);\r\n var castData = imageData.data;\r\n castData.set(pixels);\r\n ctx.putImageData(imageData, 0, 0);\r\n if (internalTexture.invertY) {\r\n var canvas2 = document.createElement('canvas');\r\n canvas2.width = width;\r\n canvas2.height = height;\r\n var ctx2 = canvas2.getContext('2d');\r\n if (!ctx2) {\r\n return null;\r\n }\r\n ctx2.translate(0, height);\r\n ctx2.scale(1, -1);\r\n ctx2.drawImage(canvas, 0, 0);\r\n return canvas2.toDataURL('image/png');\r\n }\r\n return canvas.toDataURL('image/png');\r\n };\r\n return CopyTools;\r\n}());\r\nexport { CopyTools };\r\n//# sourceMappingURL=copyTools.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, SerializationHelper } from \"../../Misc/decorators\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { _TypeStore } from '../../Misc/typeStore';\r\nimport { _DevTools } from '../../Misc/devTools';\r\nimport { TimingTools } from '../../Misc/timingTools';\r\nimport { InstantiationTools } from '../../Misc/instantiationTools';\r\nimport { Plane } from '../../Maths/math.plane';\r\nimport { StringTools } from '../../Misc/stringTools';\r\nimport { CopyTools } from '../../Misc/copyTools';\r\n/**\r\n * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.\r\n * @see https://doc.babylonjs.com/babylon101/materials#texture\r\n */\r\nvar Texture = /** @class */ (function (_super) {\r\n __extends(Texture, _super);\r\n /**\r\n * Instantiates a new texture.\r\n * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.\r\n * @see https://doc.babylonjs.com/babylon101/materials#texture\r\n * @param url defines the url of the picture to load as a texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param noMipmap defines if the texture will require mip maps or not\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode defines the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad defines a callback triggered when the texture has been loaded\r\n * @param onError defines a callback triggered when an error occurred during the loading session\r\n * @param buffer defines the buffer to load the texture from in case the texture is loaded from a buffer representation\r\n * @param deleteBuffer defines if the buffer we are loading the texture from should be deleted after load\r\n * @param format defines the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @param mimeType defines an optional mime type information\r\n * @param loaderOptions options to be passed to the loader\r\n */\r\n function Texture(url, sceneOrEngine, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer, format, mimeType, loaderOptions) {\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (invertY === void 0) { invertY = true; }\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (deleteBuffer === void 0) { deleteBuffer = false; }\r\n var _this = _super.call(this, sceneOrEngine) || this;\r\n /**\r\n * Define the url of the texture.\r\n */\r\n _this.url = null;\r\n /**\r\n * Define an offset on the texture to offset the u coordinates of the UVs\r\n * @see https://doc.babylonjs.com/how_to/more_materials#offsetting\r\n */\r\n _this.uOffset = 0;\r\n /**\r\n * Define an offset on the texture to offset the v coordinates of the UVs\r\n * @see https://doc.babylonjs.com/how_to/more_materials#offsetting\r\n */\r\n _this.vOffset = 0;\r\n /**\r\n * Define an offset on the texture to scale the u coordinates of the UVs\r\n * @see https://doc.babylonjs.com/how_to/more_materials#tiling\r\n */\r\n _this.uScale = 1.0;\r\n /**\r\n * Define an offset on the texture to scale the v coordinates of the UVs\r\n * @see https://doc.babylonjs.com/how_to/more_materials#tiling\r\n */\r\n _this.vScale = 1.0;\r\n /**\r\n * Define an offset on the texture to rotate around the u coordinates of the UVs\r\n * @see https://doc.babylonjs.com/how_to/more_materials\r\n */\r\n _this.uAng = 0;\r\n /**\r\n * Define an offset on the texture to rotate around the v coordinates of the UVs\r\n * @see https://doc.babylonjs.com/how_to/more_materials\r\n */\r\n _this.vAng = 0;\r\n /**\r\n * Define an offset on the texture to rotate around the w coordinates of the UVs (in case of 3d texture)\r\n * @see https://doc.babylonjs.com/how_to/more_materials\r\n */\r\n _this.wAng = 0;\r\n /**\r\n * Defines the center of rotation (U)\r\n */\r\n _this.uRotationCenter = 0.5;\r\n /**\r\n * Defines the center of rotation (V)\r\n */\r\n _this.vRotationCenter = 0.5;\r\n /**\r\n * Defines the center of rotation (W)\r\n */\r\n _this.wRotationCenter = 0.5;\r\n /**\r\n * Sets this property to true to avoid deformations when rotating the texture with non-uniform scaling\r\n */\r\n _this.homogeneousRotationInUVTransform = false;\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility\r\n */\r\n _this.inspectableCustomProperties = null;\r\n _this._noMipmap = false;\r\n /** @hidden */\r\n _this._invertY = false;\r\n _this._rowGenerationMatrix = null;\r\n _this._cachedTextureMatrix = null;\r\n _this._projectionModeMatrix = null;\r\n _this._t0 = null;\r\n _this._t1 = null;\r\n _this._t2 = null;\r\n _this._cachedUOffset = -1;\r\n _this._cachedVOffset = -1;\r\n _this._cachedUScale = 0;\r\n _this._cachedVScale = 0;\r\n _this._cachedUAng = -1;\r\n _this._cachedVAng = -1;\r\n _this._cachedWAng = -1;\r\n _this._cachedProjectionMatrixId = -1;\r\n _this._cachedURotationCenter = -1;\r\n _this._cachedVRotationCenter = -1;\r\n _this._cachedWRotationCenter = -1;\r\n _this._cachedHomogeneousRotationInUVTransform = false;\r\n _this._cachedCoordinatesMode = -1;\r\n /** @hidden */\r\n _this._initialSamplingMode = Texture.BILINEAR_SAMPLINGMODE;\r\n /** @hidden */\r\n _this._buffer = null;\r\n _this._deleteBuffer = false;\r\n _this._format = null;\r\n _this._delayedOnLoad = null;\r\n _this._delayedOnError = null;\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n _this.onLoadObservable = new Observable();\r\n _this._isBlocking = true;\r\n _this.name = url || \"\";\r\n _this.url = url;\r\n _this._noMipmap = noMipmap;\r\n _this._invertY = invertY;\r\n _this._initialSamplingMode = samplingMode;\r\n _this._buffer = buffer;\r\n _this._deleteBuffer = deleteBuffer;\r\n _this._mimeType = mimeType;\r\n _this._loaderOptions = loaderOptions;\r\n if (format) {\r\n _this._format = format;\r\n }\r\n var scene = _this.getScene();\r\n var engine = _this._getEngine();\r\n if (!engine) {\r\n return _this;\r\n }\r\n engine.onBeforeTextureInitObservable.notifyObservers(_this);\r\n var load = function () {\r\n if (_this._texture) {\r\n if (_this._texture._invertVScale) {\r\n _this.vScale *= -1;\r\n _this.vOffset += 1;\r\n }\r\n // Update texutre to match internal texture's wrapping\r\n if (_this._texture._cachedWrapU !== null) {\r\n _this.wrapU = _this._texture._cachedWrapU;\r\n _this._texture._cachedWrapU = null;\r\n }\r\n if (_this._texture._cachedWrapV !== null) {\r\n _this.wrapV = _this._texture._cachedWrapV;\r\n _this._texture._cachedWrapV = null;\r\n }\r\n if (_this._texture._cachedWrapR !== null) {\r\n _this.wrapR = _this._texture._cachedWrapR;\r\n _this._texture._cachedWrapR = null;\r\n }\r\n }\r\n if (_this.onLoadObservable.hasObservers()) {\r\n _this.onLoadObservable.notifyObservers(_this);\r\n }\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n if (!_this.isBlocking && scene) {\r\n scene.resetCachedMaterial();\r\n }\r\n };\r\n if (!_this.url) {\r\n _this._delayedOnLoad = load;\r\n _this._delayedOnError = onError;\r\n return _this;\r\n }\r\n _this._texture = _this._getFromCache(_this.url, noMipmap, samplingMode, invertY);\r\n if (!_this._texture) {\r\n if (!scene || !scene.useDelayedTextureLoading) {\r\n _this._texture = engine.createTexture(_this.url, noMipmap, invertY, scene, samplingMode, load, onError, _this._buffer, undefined, _this._format, null, mimeType, loaderOptions);\r\n if (deleteBuffer) {\r\n _this._buffer = null;\r\n }\r\n }\r\n else {\r\n _this.delayLoadState = 4;\r\n _this._delayedOnLoad = load;\r\n _this._delayedOnError = onError;\r\n }\r\n }\r\n else {\r\n if (_this._texture.isReady) {\r\n TimingTools.SetImmediate(function () { return load(); });\r\n }\r\n else {\r\n _this._texture.onLoadedObservable.add(load);\r\n }\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(Texture.prototype, \"noMipmap\", {\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n get: function () {\r\n return this._noMipmap;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Texture.prototype, \"mimeType\", {\r\n /** Returns the texture mime type if it was defined by a loader (undefined else) */\r\n get: function () {\r\n return this._mimeType;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Texture.prototype, \"isBlocking\", {\r\n get: function () {\r\n return this._isBlocking;\r\n },\r\n /**\r\n * Is the texture preventing material to render while loading.\r\n * If false, a default texture will be used instead of the loading one during the preparation step.\r\n */\r\n set: function (value) {\r\n this._isBlocking = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Texture.prototype, \"samplingMode\", {\r\n /**\r\n * Get the current sampling mode associated with the texture.\r\n */\r\n get: function () {\r\n if (!this._texture) {\r\n return this._initialSamplingMode;\r\n }\r\n return this._texture.samplingMode;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Texture.prototype, \"invertY\", {\r\n /**\r\n * Gets a boolean indicating if the texture needs to be inverted on the y axis during loading\r\n */\r\n get: function () {\r\n return this._invertY;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Update the url (and optional buffer) of this texture if url was null during construction.\r\n * @param url the url of the texture\r\n * @param buffer the buffer of the texture (defaults to null)\r\n * @param onLoad callback called when the texture is loaded (defaults to null)\r\n */\r\n Texture.prototype.updateURL = function (url, buffer, onLoad) {\r\n if (buffer === void 0) { buffer = null; }\r\n if (this.url) {\r\n this.releaseInternalTexture();\r\n this.getScene().markAllMaterialsAsDirty(1);\r\n }\r\n if (!this.name || StringTools.StartsWith(this.name, \"data:\")) {\r\n this.name = url;\r\n }\r\n this.url = url;\r\n this._buffer = buffer;\r\n this.delayLoadState = 4;\r\n if (onLoad) {\r\n this._delayedOnLoad = onLoad;\r\n }\r\n this.delayLoad();\r\n };\r\n /**\r\n * Finish the loading sequence of a texture flagged as delayed load.\r\n * @hidden\r\n */\r\n Texture.prototype.delayLoad = function () {\r\n if (this.delayLoadState !== 4) {\r\n return;\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this.delayLoadState = 1;\r\n this._texture = this._getFromCache(this.url, this._noMipmap, this.samplingMode, this._invertY);\r\n if (!this._texture) {\r\n this._texture = scene.getEngine().createTexture(this.url, this._noMipmap, this._invertY, scene, this.samplingMode, this._delayedOnLoad, this._delayedOnError, this._buffer, null, this._format, null, this._mimeType, this._loaderOptions);\r\n if (this._deleteBuffer) {\r\n this._buffer = null;\r\n }\r\n }\r\n else {\r\n if (this._delayedOnLoad) {\r\n if (this._texture.isReady) {\r\n TimingTools.SetImmediate(this._delayedOnLoad);\r\n }\r\n else {\r\n this._texture.onLoadedObservable.add(this._delayedOnLoad);\r\n }\r\n }\r\n }\r\n this._delayedOnLoad = null;\r\n this._delayedOnError = null;\r\n };\r\n Texture.prototype._prepareRowForTextureGeneration = function (x, y, z, t) {\r\n x *= this._cachedUScale;\r\n y *= this._cachedVScale;\r\n x -= this.uRotationCenter * this._cachedUScale;\r\n y -= this.vRotationCenter * this._cachedVScale;\r\n z -= this.wRotationCenter;\r\n Vector3.TransformCoordinatesFromFloatsToRef(x, y, z, this._rowGenerationMatrix, t);\r\n t.x += this.uRotationCenter * this._cachedUScale + this._cachedUOffset;\r\n t.y += this.vRotationCenter * this._cachedVScale + this._cachedVOffset;\r\n t.z += this.wRotationCenter;\r\n };\r\n /**\r\n * Checks if the texture has the same transform matrix than another texture\r\n * @param texture texture to check against\r\n * @returns true if the transforms are the same, else false\r\n */\r\n Texture.prototype.checkTransformsAreIdentical = function (texture) {\r\n return texture !== null &&\r\n this.uOffset === texture.uOffset &&\r\n this.vOffset === texture.vOffset &&\r\n this.uScale === texture.uScale &&\r\n this.vScale === texture.vScale &&\r\n this.uAng === texture.uAng &&\r\n this.vAng === texture.vAng &&\r\n this.wAng === texture.wAng;\r\n };\r\n /**\r\n * Get the current texture matrix which includes the requested offsetting, tiling and rotation components.\r\n * @returns the transform matrix of the texture.\r\n */\r\n Texture.prototype.getTextureMatrix = function (uBase) {\r\n var _this = this;\r\n if (uBase === void 0) { uBase = 1; }\r\n if (this.uOffset === this._cachedUOffset &&\r\n this.vOffset === this._cachedVOffset &&\r\n this.uScale * uBase === this._cachedUScale &&\r\n this.vScale === this._cachedVScale &&\r\n this.uAng === this._cachedUAng &&\r\n this.vAng === this._cachedVAng &&\r\n this.wAng === this._cachedWAng &&\r\n this.uRotationCenter === this._cachedURotationCenter &&\r\n this.vRotationCenter === this._cachedVRotationCenter &&\r\n this.wRotationCenter === this._cachedWRotationCenter &&\r\n this.homogeneousRotationInUVTransform === this._cachedHomogeneousRotationInUVTransform) {\r\n return this._cachedTextureMatrix;\r\n }\r\n this._cachedUOffset = this.uOffset;\r\n this._cachedVOffset = this.vOffset;\r\n this._cachedUScale = this.uScale * uBase;\r\n this._cachedVScale = this.vScale;\r\n this._cachedUAng = this.uAng;\r\n this._cachedVAng = this.vAng;\r\n this._cachedWAng = this.wAng;\r\n this._cachedURotationCenter = this.uRotationCenter;\r\n this._cachedVRotationCenter = this.vRotationCenter;\r\n this._cachedWRotationCenter = this.wRotationCenter;\r\n this._cachedHomogeneousRotationInUVTransform = this.homogeneousRotationInUVTransform;\r\n if (!this._cachedTextureMatrix || !this._rowGenerationMatrix) {\r\n this._cachedTextureMatrix = Matrix.Zero();\r\n this._rowGenerationMatrix = new Matrix();\r\n this._t0 = Vector3.Zero();\r\n this._t1 = Vector3.Zero();\r\n this._t2 = Vector3.Zero();\r\n }\r\n Matrix.RotationYawPitchRollToRef(this.vAng, this.uAng, this.wAng, this._rowGenerationMatrix);\r\n if (this.homogeneousRotationInUVTransform) {\r\n Matrix.TranslationToRef(-this._cachedURotationCenter, -this._cachedVRotationCenter, -this._cachedWRotationCenter, TmpVectors.Matrix[0]);\r\n Matrix.TranslationToRef(this._cachedURotationCenter, this._cachedVRotationCenter, this._cachedWRotationCenter, TmpVectors.Matrix[1]);\r\n Matrix.ScalingToRef(this._cachedUScale, this._cachedVScale, 0, TmpVectors.Matrix[2]);\r\n Matrix.TranslationToRef(this._cachedUOffset, this._cachedVOffset, 0, TmpVectors.Matrix[3]);\r\n TmpVectors.Matrix[0].multiplyToRef(this._rowGenerationMatrix, this._cachedTextureMatrix);\r\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[1], this._cachedTextureMatrix);\r\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[2], this._cachedTextureMatrix);\r\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[3], this._cachedTextureMatrix);\r\n // copy the translation row to the 3rd row of the matrix so that we don't need to update the shaders (which expects the translation to be on the 3rd row)\r\n this._cachedTextureMatrix.setRowFromFloats(2, this._cachedTextureMatrix.m[12], this._cachedTextureMatrix.m[13], this._cachedTextureMatrix.m[14], 1);\r\n }\r\n else {\r\n this._prepareRowForTextureGeneration(0, 0, 0, this._t0);\r\n this._prepareRowForTextureGeneration(1.0, 0, 0, this._t1);\r\n this._prepareRowForTextureGeneration(0, 1.0, 0, this._t2);\r\n this._t1.subtractInPlace(this._t0);\r\n this._t2.subtractInPlace(this._t0);\r\n Matrix.FromValuesToRef(this._t1.x, this._t1.y, this._t1.z, 0.0, this._t2.x, this._t2.y, this._t2.z, 0.0, this._t0.x, this._t0.y, this._t0.z, 0.0, 0.0, 0.0, 0.0, 1.0, this._cachedTextureMatrix);\r\n }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this._cachedTextureMatrix;\r\n }\r\n scene.markAllMaterialsAsDirty(1, function (mat) {\r\n return mat.hasTexture(_this);\r\n });\r\n return this._cachedTextureMatrix;\r\n };\r\n /**\r\n * Get the current matrix used to apply reflection. This is useful to rotate an environment texture for instance.\r\n * @returns The reflection texture transform\r\n */\r\n Texture.prototype.getReflectionTextureMatrix = function () {\r\n var _this = this;\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return this._cachedTextureMatrix;\r\n }\r\n if (this.uOffset === this._cachedUOffset &&\r\n this.vOffset === this._cachedVOffset &&\r\n this.uScale === this._cachedUScale &&\r\n this.vScale === this._cachedVScale &&\r\n this.coordinatesMode === this._cachedCoordinatesMode) {\r\n if (this.coordinatesMode === Texture.PROJECTION_MODE) {\r\n if (this._cachedProjectionMatrixId === scene.getProjectionMatrix().updateFlag) {\r\n return this._cachedTextureMatrix;\r\n }\r\n }\r\n else {\r\n return this._cachedTextureMatrix;\r\n }\r\n }\r\n if (!this._cachedTextureMatrix) {\r\n this._cachedTextureMatrix = Matrix.Zero();\r\n }\r\n if (!this._projectionModeMatrix) {\r\n this._projectionModeMatrix = Matrix.Zero();\r\n }\r\n this._cachedUOffset = this.uOffset;\r\n this._cachedVOffset = this.vOffset;\r\n this._cachedUScale = this.uScale;\r\n this._cachedVScale = this.vScale;\r\n this._cachedCoordinatesMode = this.coordinatesMode;\r\n switch (this.coordinatesMode) {\r\n case Texture.PLANAR_MODE:\r\n Matrix.IdentityToRef(this._cachedTextureMatrix);\r\n this._cachedTextureMatrix[0] = this.uScale;\r\n this._cachedTextureMatrix[5] = this.vScale;\r\n this._cachedTextureMatrix[12] = this.uOffset;\r\n this._cachedTextureMatrix[13] = this.vOffset;\r\n break;\r\n case Texture.PROJECTION_MODE:\r\n Matrix.FromValuesToRef(0.5, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 1.0, 1.0, this._projectionModeMatrix);\r\n var projectionMatrix = scene.getProjectionMatrix();\r\n this._cachedProjectionMatrixId = projectionMatrix.updateFlag;\r\n projectionMatrix.multiplyToRef(this._projectionModeMatrix, this._cachedTextureMatrix);\r\n break;\r\n default:\r\n Matrix.IdentityToRef(this._cachedTextureMatrix);\r\n break;\r\n }\r\n scene.markAllMaterialsAsDirty(1, function (mat) {\r\n return (mat.getActiveTextures().indexOf(_this) !== -1);\r\n });\r\n return this._cachedTextureMatrix;\r\n };\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n Texture.prototype.clone = function () {\r\n var _this = this;\r\n return SerializationHelper.Clone(function () {\r\n return new Texture(_this._texture ? _this._texture.url : null, _this.getScene(), _this._noMipmap, _this._invertY, _this.samplingMode, undefined, undefined, _this._texture ? _this._texture._buffer : undefined);\r\n }, this);\r\n };\r\n /**\r\n * Serialize the texture to a JSON representation we can easily use in the resepective Parse function.\r\n * @returns The JSON representation of the texture\r\n */\r\n Texture.prototype.serialize = function () {\r\n var savedName = this.name;\r\n if (!Texture.SerializeBuffers) {\r\n if (StringTools.StartsWith(this.name, \"data:\")) {\r\n this.name = \"\";\r\n }\r\n }\r\n if (StringTools.StartsWith(this.name, \"data:\") && this.url === this.name) {\r\n this.url = \"\";\r\n }\r\n var serializationObject = _super.prototype.serialize.call(this);\r\n if (!serializationObject) {\r\n return null;\r\n }\r\n if (Texture.SerializeBuffers || Texture.ForceSerializeBuffers) {\r\n if (typeof this._buffer === \"string\" && this._buffer.substr(0, 5) === \"data:\") {\r\n serializationObject.base64String = this._buffer;\r\n serializationObject.name = serializationObject.name.replace(\"data:\", \"\");\r\n }\r\n else if (this.url && StringTools.StartsWith(this.url, \"data:\") && this._buffer instanceof Uint8Array) {\r\n serializationObject.base64String = \"data:image/png;base64,\" + StringTools.EncodeArrayBufferToBase64(this._buffer);\r\n }\r\n else if (Texture.ForceSerializeBuffers) {\r\n serializationObject.base64String = CopyTools.GenerateBase64StringFromTexture(this);\r\n }\r\n }\r\n serializationObject.invertY = this._invertY;\r\n serializationObject.samplingMode = this.samplingMode;\r\n this.name = savedName;\r\n return serializationObject;\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"Texture\"\r\n */\r\n Texture.prototype.getClassName = function () {\r\n return \"Texture\";\r\n };\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n Texture.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onLoadObservable.clear();\r\n this._delayedOnLoad = null;\r\n this._delayedOnError = null;\r\n };\r\n /**\r\n * Parse the JSON representation of a texture in order to recreate the texture in the given scene.\r\n * @param parsedTexture Define the JSON representation of the texture\r\n * @param scene Define the scene the parsed texture should be instantiated in\r\n * @param rootUrl Define the root url of the parsing sequence in the case of relative dependencies\r\n * @returns The parsed texture if successful\r\n */\r\n Texture.Parse = function (parsedTexture, scene, rootUrl) {\r\n if (parsedTexture.customType) {\r\n var customTexture = InstantiationTools.Instantiate(parsedTexture.customType);\r\n // Update Sampling Mode\r\n var parsedCustomTexture = customTexture.Parse(parsedTexture, scene, rootUrl);\r\n if (parsedTexture.samplingMode && parsedCustomTexture.updateSamplingMode && parsedCustomTexture._samplingMode) {\r\n if (parsedCustomTexture._samplingMode !== parsedTexture.samplingMode) {\r\n parsedCustomTexture.updateSamplingMode(parsedTexture.samplingMode);\r\n }\r\n }\r\n return parsedCustomTexture;\r\n }\r\n if (parsedTexture.isCube && !parsedTexture.isRenderTarget) {\r\n return Texture._CubeTextureParser(parsedTexture, scene, rootUrl);\r\n }\r\n if (!parsedTexture.name && !parsedTexture.isRenderTarget) {\r\n return null;\r\n }\r\n var onLoaded = function () {\r\n // Clear cache\r\n if (texture && texture._texture) {\r\n texture._texture._cachedWrapU = null;\r\n texture._texture._cachedWrapV = null;\r\n texture._texture._cachedWrapR = null;\r\n }\r\n // Update Sampling Mode\r\n if (parsedTexture.samplingMode) {\r\n var sampling = parsedTexture.samplingMode;\r\n if (texture && texture.samplingMode !== sampling) {\r\n texture.updateSamplingMode(sampling);\r\n }\r\n }\r\n // Animations\r\n if (texture && parsedTexture.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedTexture.animations[animationIndex];\r\n var internalClass = _TypeStore.GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n texture.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n };\r\n var texture = SerializationHelper.Parse(function () {\r\n var generateMipMaps = true;\r\n if (parsedTexture.noMipmap) {\r\n generateMipMaps = false;\r\n }\r\n if (parsedTexture.mirrorPlane) {\r\n var mirrorTexture = Texture._CreateMirror(parsedTexture.name, parsedTexture.renderTargetSize, scene, generateMipMaps);\r\n mirrorTexture._waitingRenderList = parsedTexture.renderList;\r\n mirrorTexture.mirrorPlane = Plane.FromArray(parsedTexture.mirrorPlane);\r\n onLoaded();\r\n return mirrorTexture;\r\n }\r\n else if (parsedTexture.isRenderTarget) {\r\n var renderTargetTexture = null;\r\n if (parsedTexture.isCube) {\r\n // Search for an existing reflection probe (which contains a cube render target texture)\r\n if (scene.reflectionProbes) {\r\n for (var index = 0; index < scene.reflectionProbes.length; index++) {\r\n var probe = scene.reflectionProbes[index];\r\n if (probe.name === parsedTexture.name) {\r\n return probe.cubeTexture;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n renderTargetTexture = Texture._CreateRenderTargetTexture(parsedTexture.name, parsedTexture.renderTargetSize, scene, generateMipMaps);\r\n renderTargetTexture._waitingRenderList = parsedTexture.renderList;\r\n }\r\n onLoaded();\r\n return renderTargetTexture;\r\n }\r\n else {\r\n var texture;\r\n if (parsedTexture.base64String) {\r\n texture = Texture.CreateFromBase64String(parsedTexture.base64String, parsedTexture.name, scene, !generateMipMaps, parsedTexture.invertY, undefined, onLoaded);\r\n }\r\n else {\r\n var url = void 0;\r\n if (parsedTexture.name && parsedTexture.name.indexOf(\"://\") > 0) {\r\n url = parsedTexture.name;\r\n }\r\n else {\r\n url = rootUrl + parsedTexture.name;\r\n }\r\n if (StringTools.StartsWith(parsedTexture.url, \"data:\") || (Texture.UseSerializedUrlIfAny && parsedTexture.url)) {\r\n url = parsedTexture.url;\r\n }\r\n texture = new Texture(url, scene, !generateMipMaps, parsedTexture.invertY, undefined, onLoaded);\r\n }\r\n return texture;\r\n }\r\n }, parsedTexture, scene);\r\n return texture;\r\n };\r\n /**\r\n * Creates a texture from its base 64 representation.\r\n * @param data Define the base64 payload without the data: prefix\r\n * @param name Define the name of the texture in the scene useful fo caching purpose for instance\r\n * @param scene Define the scene the texture should belong to\r\n * @param noMipmap Forces the texture to not create mip map information if true\r\n * @param invertY define if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad define a callback triggered when the texture has been loaded\r\n * @param onError define a callback triggered when an error occurred during the loading session\r\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @returns the created texture\r\n */\r\n Texture.CreateFromBase64String = function (data, name, scene, noMipmap, invertY, samplingMode, onLoad, onError, format) {\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (format === void 0) { format = 5; }\r\n return new Texture(\"data:\" + name, scene, noMipmap, invertY, samplingMode, onLoad, onError, data, false, format);\r\n };\r\n /**\r\n * Creates a texture from its data: representation. (data: will be added in case only the payload has been passed in)\r\n * @param data Define the base64 payload without the data: prefix\r\n * @param name Define the name of the texture in the scene useful fo caching purpose for instance\r\n * @param buffer define the buffer to load the texture from in case the texture is loaded from a buffer representation\r\n * @param scene Define the scene the texture should belong to\r\n * @param deleteBuffer define if the buffer we are loading the texture from should be deleted after load\r\n * @param noMipmap Forces the texture to not create mip map information if true\r\n * @param invertY define if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad define a callback triggered when the texture has been loaded\r\n * @param onError define a callback triggered when an error occurred during the loading session\r\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @returns the created texture\r\n */\r\n Texture.LoadFromDataString = function (name, buffer, scene, deleteBuffer, noMipmap, invertY, samplingMode, onLoad, onError, format) {\r\n if (deleteBuffer === void 0) { deleteBuffer = false; }\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (invertY === void 0) { invertY = true; }\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (format === void 0) { format = 5; }\r\n if (name.substr(0, 5) !== \"data:\") {\r\n name = \"data:\" + name;\r\n }\r\n return new Texture(name, scene, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer, format);\r\n };\r\n /**\r\n * Gets or sets a general boolean used to indicate that textures containing direct data (buffers) must be saved as part of the serialization process\r\n */\r\n Texture.SerializeBuffers = true;\r\n /**\r\n * Gets or sets a general boolean used to indicate that texture buffers must be saved as part of the serialization process.\r\n * If no buffer exists, one will be created as base64 string from the internal webgl data.\r\n */\r\n Texture.ForceSerializeBuffers = false;\r\n /** @hidden */\r\n Texture._CubeTextureParser = function (jsonTexture, scene, rootUrl) {\r\n throw _DevTools.WarnImport(\"CubeTexture\");\r\n };\r\n /** @hidden */\r\n Texture._CreateMirror = function (name, renderTargetSize, scene, generateMipMaps) {\r\n throw _DevTools.WarnImport(\"MirrorTexture\");\r\n };\r\n /** @hidden */\r\n Texture._CreateRenderTargetTexture = function (name, renderTargetSize, scene, generateMipMaps) {\r\n throw _DevTools.WarnImport(\"RenderTargetTexture\");\r\n };\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Texture.NEAREST_SAMPLINGMODE = 1;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n Texture.NEAREST_NEAREST_MIPLINEAR = 8; // nearest is mag = nearest and min = nearest and mip = linear\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Texture.BILINEAR_SAMPLINGMODE = 2;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n Texture.LINEAR_LINEAR_MIPNEAREST = 11; // Bilinear is mag = linear and min = linear and mip = nearest\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Texture.TRILINEAR_SAMPLINGMODE = 3;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n Texture.LINEAR_LINEAR_MIPLINEAR = 3; // Trilinear is mag = linear and min = linear and mip = linear\r\n /** mag = nearest and min = nearest and mip = nearest */\r\n Texture.NEAREST_NEAREST_MIPNEAREST = 4;\r\n /** mag = nearest and min = linear and mip = nearest */\r\n Texture.NEAREST_LINEAR_MIPNEAREST = 5;\r\n /** mag = nearest and min = linear and mip = linear */\r\n Texture.NEAREST_LINEAR_MIPLINEAR = 6;\r\n /** mag = nearest and min = linear and mip = none */\r\n Texture.NEAREST_LINEAR = 7;\r\n /** mag = nearest and min = nearest and mip = none */\r\n Texture.NEAREST_NEAREST = 1;\r\n /** mag = linear and min = nearest and mip = nearest */\r\n Texture.LINEAR_NEAREST_MIPNEAREST = 9;\r\n /** mag = linear and min = nearest and mip = linear */\r\n Texture.LINEAR_NEAREST_MIPLINEAR = 10;\r\n /** mag = linear and min = linear and mip = none */\r\n Texture.LINEAR_LINEAR = 2;\r\n /** mag = linear and min = nearest and mip = none */\r\n Texture.LINEAR_NEAREST = 12;\r\n /** Explicit coordinates mode */\r\n Texture.EXPLICIT_MODE = 0;\r\n /** Spherical coordinates mode */\r\n Texture.SPHERICAL_MODE = 1;\r\n /** Planar coordinates mode */\r\n Texture.PLANAR_MODE = 2;\r\n /** Cubic coordinates mode */\r\n Texture.CUBIC_MODE = 3;\r\n /** Projection coordinates mode */\r\n Texture.PROJECTION_MODE = 4;\r\n /** Inverse Cubic coordinates mode */\r\n Texture.SKYBOX_MODE = 5;\r\n /** Inverse Cubic coordinates mode */\r\n Texture.INVCUBIC_MODE = 6;\r\n /** Equirectangular coordinates mode */\r\n Texture.EQUIRECTANGULAR_MODE = 7;\r\n /** Equirectangular Fixed coordinates mode */\r\n Texture.FIXED_EQUIRECTANGULAR_MODE = 8;\r\n /** Equirectangular Fixed Mirrored coordinates mode */\r\n Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9;\r\n /** Texture is not repeating outside of 0..1 UVs */\r\n Texture.CLAMP_ADDRESSMODE = 0;\r\n /** Texture is repeating outside of 0..1 UVs */\r\n Texture.WRAP_ADDRESSMODE = 1;\r\n /** Texture is repeating and mirrored */\r\n Texture.MIRROR_ADDRESSMODE = 2;\r\n /**\r\n * Gets or sets a boolean which defines if the texture url must be build from the serialized URL instead of just using the name and loading them side by side with the scene file\r\n */\r\n Texture.UseSerializedUrlIfAny = false;\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"url\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"uOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"vOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"uScale\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"vScale\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"uAng\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"vAng\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"wAng\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"uRotationCenter\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"vRotationCenter\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"wRotationCenter\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"homogeneousRotationInUVTransform\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Texture.prototype, \"isBlocking\", null);\r\n return Texture;\r\n}(BaseTexture));\r\nexport { Texture };\r\n// References the dependencies.\r\n_TypeStore.RegisteredTypes[\"BABYLON.Texture\"] = Texture;\r\nSerializationHelper._TextureParser = Texture.Parse;\r\n//# sourceMappingURL=texture.js.map","import { Observable } from \"../Misc/observable\";\r\nimport { DomManagement } from \"../Misc/domManagement\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { ShaderProcessor } from '../Engines/Processors/shaderProcessor';\r\n/**\r\n * Effect containing vertex and fragment shader that can be executed on an object.\r\n */\r\nvar Effect = /** @class */ (function () {\r\n /**\r\n * Instantiates an effect.\r\n * An effect can be used to create/manage/execute vertex and fragment shaders.\r\n * @param baseName Name of the effect.\r\n * @param attributesNamesOrOptions List of attribute names that will be passed to the shader or set of all options to create the effect.\r\n * @param uniformsNamesOrEngine List of uniform variable names that will be passed to the shader or the engine that will be used to render effect.\r\n * @param samplers List of sampler variables that will be passed to the shader.\r\n * @param engine Engine to be used to render the effect\r\n * @param defines Define statements to be added to the shader.\r\n * @param fallbacks Possible fallbacks for this effect to improve performance when needed.\r\n * @param onCompiled Callback that will be called when the shader is compiled.\r\n * @param onError Callback that will be called if an error occurs during shader compilation.\r\n * @param indexParameters Parameters to be used with Babylons include syntax to iterate over an array (eg. {lights: 10})\r\n */\r\n function Effect(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, engine, defines, fallbacks, onCompiled, onError, indexParameters) {\r\n var _this = this;\r\n if (samplers === void 0) { samplers = null; }\r\n if (defines === void 0) { defines = null; }\r\n if (fallbacks === void 0) { fallbacks = null; }\r\n if (onCompiled === void 0) { onCompiled = null; }\r\n if (onError === void 0) { onError = null; }\r\n var _a;\r\n /**\r\n * Name of the effect.\r\n */\r\n this.name = null;\r\n /**\r\n * String container all the define statements that should be set on the shader.\r\n */\r\n this.defines = \"\";\r\n /**\r\n * Callback that will be called when the shader is compiled.\r\n */\r\n this.onCompiled = null;\r\n /**\r\n * Callback that will be called if an error occurs during shader compilation.\r\n */\r\n this.onError = null;\r\n /**\r\n * Callback that will be called when effect is bound.\r\n */\r\n this.onBind = null;\r\n /**\r\n * Unique ID of the effect.\r\n */\r\n this.uniqueId = 0;\r\n /**\r\n * Observable that will be called when the shader is compiled.\r\n * It is recommended to use executeWhenCompile() or to make sure that scene.isReady() is called to get this observable raised.\r\n */\r\n this.onCompileObservable = new Observable();\r\n /**\r\n * Observable that will be called if an error occurs during shader compilation.\r\n */\r\n this.onErrorObservable = new Observable();\r\n /** @hidden */\r\n this._onBindObservable = null;\r\n /**\r\n * @hidden\r\n * Specifies if the effect was previously ready\r\n */\r\n this._wasPreviouslyReady = false;\r\n /** @hidden */\r\n this._bonesComputationForcedToCPU = false;\r\n /** @hidden */\r\n this._multiTarget = false;\r\n this._uniformBuffersNames = {};\r\n this._samplers = {};\r\n this._isReady = false;\r\n this._compilationError = \"\";\r\n this._allFallbacksProcessed = false;\r\n this._uniforms = {};\r\n /**\r\n * Key for the effect.\r\n * @hidden\r\n */\r\n this._key = \"\";\r\n this._fallbacks = null;\r\n this._vertexSourceCode = \"\";\r\n this._fragmentSourceCode = \"\";\r\n this._vertexSourceCodeOverride = \"\";\r\n this._fragmentSourceCodeOverride = \"\";\r\n this._transformFeedbackVaryings = null;\r\n this._rawVertexSourceCode = \"\";\r\n this._rawFragmentSourceCode = \"\";\r\n /**\r\n * Compiled shader to webGL program.\r\n * @hidden\r\n */\r\n this._pipelineContext = null;\r\n this._valueCache = {};\r\n this.name = baseName;\r\n var processFinalCode = null;\r\n if (attributesNamesOrOptions.attributes) {\r\n var options = attributesNamesOrOptions;\r\n this._engine = uniformsNamesOrEngine;\r\n this._attributesNames = options.attributes;\r\n this._uniformsNames = options.uniformsNames.concat(options.samplers);\r\n this._samplerList = options.samplers.slice();\r\n this.defines = options.defines;\r\n this.onError = options.onError;\r\n this.onCompiled = options.onCompiled;\r\n this._fallbacks = options.fallbacks;\r\n this._indexParameters = options.indexParameters;\r\n this._transformFeedbackVaryings = options.transformFeedbackVaryings || null;\r\n this._multiTarget = !!options.multiTarget;\r\n if (options.uniformBuffersNames) {\r\n this._uniformBuffersNamesList = options.uniformBuffersNames.slice();\r\n for (var i = 0; i < options.uniformBuffersNames.length; i++) {\r\n this._uniformBuffersNames[options.uniformBuffersNames[i]] = i;\r\n }\r\n }\r\n processFinalCode = (_a = options.processFinalCode) !== null && _a !== void 0 ? _a : null;\r\n }\r\n else {\r\n this._engine = engine;\r\n this.defines = (defines == null ? \"\" : defines);\r\n this._uniformsNames = uniformsNamesOrEngine.concat(samplers);\r\n this._samplerList = samplers ? samplers.slice() : [];\r\n this._attributesNames = attributesNamesOrOptions;\r\n this._uniformBuffersNamesList = [];\r\n this.onError = onError;\r\n this.onCompiled = onCompiled;\r\n this._indexParameters = indexParameters;\r\n this._fallbacks = fallbacks;\r\n }\r\n this._attributeLocationByName = {};\r\n this.uniqueId = Effect._uniqueIdSeed++;\r\n var vertexSource;\r\n var fragmentSource;\r\n var hostDocument = DomManagement.IsWindowObjectExist() ? this._engine.getHostDocument() : null;\r\n if (baseName.vertexSource) {\r\n vertexSource = \"source:\" + baseName.vertexSource;\r\n }\r\n else if (baseName.vertexElement) {\r\n vertexSource = hostDocument ? hostDocument.getElementById(baseName.vertexElement) : null;\r\n if (!vertexSource) {\r\n vertexSource = baseName.vertexElement;\r\n }\r\n }\r\n else {\r\n vertexSource = baseName.vertex || baseName;\r\n }\r\n if (baseName.fragmentSource) {\r\n fragmentSource = \"source:\" + baseName.fragmentSource;\r\n }\r\n else if (baseName.fragmentElement) {\r\n fragmentSource = hostDocument ? hostDocument.getElementById(baseName.fragmentElement) : null;\r\n if (!fragmentSource) {\r\n fragmentSource = baseName.fragmentElement;\r\n }\r\n }\r\n else {\r\n fragmentSource = baseName.fragment || baseName;\r\n }\r\n var processorOptions = {\r\n defines: this.defines.split(\"\\n\"),\r\n indexParameters: this._indexParameters,\r\n isFragment: false,\r\n shouldUseHighPrecisionShader: this._engine._shouldUseHighPrecisionShader,\r\n processor: this._engine._shaderProcessor,\r\n supportsUniformBuffers: this._engine.supportsUniformBuffers,\r\n shadersRepository: Effect.ShadersRepository,\r\n includesShadersStore: Effect.IncludesShadersStore,\r\n version: (this._engine.webGLVersion * 100).toString(),\r\n platformName: this._engine.webGLVersion >= 2 ? \"WEBGL2\" : \"WEBGL1\"\r\n };\r\n this._loadShader(vertexSource, \"Vertex\", \"\", function (vertexCode) {\r\n _this._rawVertexSourceCode = vertexCode;\r\n _this._loadShader(fragmentSource, \"Fragment\", \"Pixel\", function (fragmentCode) {\r\n _this._rawFragmentSourceCode = fragmentCode;\r\n ShaderProcessor.Process(vertexCode, processorOptions, function (migratedVertexCode) {\r\n if (processFinalCode) {\r\n migratedVertexCode = processFinalCode(\"vertex\", migratedVertexCode);\r\n }\r\n processorOptions.isFragment = true;\r\n ShaderProcessor.Process(fragmentCode, processorOptions, function (migratedFragmentCode) {\r\n if (processFinalCode) {\r\n migratedFragmentCode = processFinalCode(\"fragment\", migratedFragmentCode);\r\n }\r\n _this._useFinalCode(migratedVertexCode, migratedFragmentCode, baseName);\r\n }, _this._engine);\r\n }, _this._engine);\r\n });\r\n });\r\n }\r\n Object.defineProperty(Effect.prototype, \"onBindObservable\", {\r\n /**\r\n * Observable that will be called when effect is bound.\r\n */\r\n get: function () {\r\n if (!this._onBindObservable) {\r\n this._onBindObservable = new Observable();\r\n }\r\n return this._onBindObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Effect.prototype._useFinalCode = function (migratedVertexCode, migratedFragmentCode, baseName) {\r\n if (baseName) {\r\n var vertex = baseName.vertexElement || baseName.vertex || baseName.spectorName || baseName;\r\n var fragment = baseName.fragmentElement || baseName.fragment || baseName.spectorName || baseName;\r\n this._vertexSourceCode = \"#define SHADER_NAME vertex:\" + vertex + \"\\n\" + migratedVertexCode;\r\n this._fragmentSourceCode = \"#define SHADER_NAME fragment:\" + fragment + \"\\n\" + migratedFragmentCode;\r\n }\r\n else {\r\n this._vertexSourceCode = migratedVertexCode;\r\n this._fragmentSourceCode = migratedFragmentCode;\r\n }\r\n this._prepareEffect();\r\n };\r\n Object.defineProperty(Effect.prototype, \"key\", {\r\n /**\r\n * Unique key for this effect\r\n */\r\n get: function () {\r\n return this._key;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * If the effect has been compiled and prepared.\r\n * @returns if the effect is compiled and prepared.\r\n */\r\n Effect.prototype.isReady = function () {\r\n try {\r\n return this._isReadyInternal();\r\n }\r\n catch (_a) {\r\n return false;\r\n }\r\n };\r\n Effect.prototype._isReadyInternal = function () {\r\n if (this._isReady) {\r\n return true;\r\n }\r\n if (this._pipelineContext) {\r\n return this._pipelineContext.isReady;\r\n }\r\n return false;\r\n };\r\n /**\r\n * The engine the effect was initialized with.\r\n * @returns the engine.\r\n */\r\n Effect.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * The pipeline context for this effect\r\n * @returns the associated pipeline context\r\n */\r\n Effect.prototype.getPipelineContext = function () {\r\n return this._pipelineContext;\r\n };\r\n /**\r\n * The set of names of attribute variables for the shader.\r\n * @returns An array of attribute names.\r\n */\r\n Effect.prototype.getAttributesNames = function () {\r\n return this._attributesNames;\r\n };\r\n /**\r\n * Returns the attribute at the given index.\r\n * @param index The index of the attribute.\r\n * @returns The location of the attribute.\r\n */\r\n Effect.prototype.getAttributeLocation = function (index) {\r\n return this._attributes[index];\r\n };\r\n /**\r\n * Returns the attribute based on the name of the variable.\r\n * @param name of the attribute to look up.\r\n * @returns the attribute location.\r\n */\r\n Effect.prototype.getAttributeLocationByName = function (name) {\r\n return this._attributeLocationByName[name];\r\n };\r\n /**\r\n * The number of attributes.\r\n * @returns the numnber of attributes.\r\n */\r\n Effect.prototype.getAttributesCount = function () {\r\n return this._attributes.length;\r\n };\r\n /**\r\n * Gets the index of a uniform variable.\r\n * @param uniformName of the uniform to look up.\r\n * @returns the index.\r\n */\r\n Effect.prototype.getUniformIndex = function (uniformName) {\r\n return this._uniformsNames.indexOf(uniformName);\r\n };\r\n /**\r\n * Returns the attribute based on the name of the variable.\r\n * @param uniformName of the uniform to look up.\r\n * @returns the location of the uniform.\r\n */\r\n Effect.prototype.getUniform = function (uniformName) {\r\n return this._uniforms[uniformName];\r\n };\r\n /**\r\n * Returns an array of sampler variable names\r\n * @returns The array of sampler variable names.\r\n */\r\n Effect.prototype.getSamplers = function () {\r\n return this._samplerList;\r\n };\r\n /**\r\n * Returns an array of uniform variable names\r\n * @returns The array of uniform variable names.\r\n */\r\n Effect.prototype.getUniformNames = function () {\r\n return this._uniformsNames;\r\n };\r\n /**\r\n * Returns an array of uniform buffer variable names\r\n * @returns The array of uniform buffer variable names.\r\n */\r\n Effect.prototype.getUniformBuffersNames = function () {\r\n return this._uniformBuffersNamesList;\r\n };\r\n /**\r\n * Returns the index parameters used to create the effect\r\n * @returns The index parameters object\r\n */\r\n Effect.prototype.getIndexParameters = function () {\r\n return this._indexParameters;\r\n };\r\n /**\r\n * The error from the last compilation.\r\n * @returns the error string.\r\n */\r\n Effect.prototype.getCompilationError = function () {\r\n return this._compilationError;\r\n };\r\n /**\r\n * Gets a boolean indicating that all fallbacks were used during compilation\r\n * @returns true if all fallbacks were used\r\n */\r\n Effect.prototype.allFallbacksProcessed = function () {\r\n return this._allFallbacksProcessed;\r\n };\r\n /**\r\n * Adds a callback to the onCompiled observable and call the callback imediatly if already ready.\r\n * @param func The callback to be used.\r\n */\r\n Effect.prototype.executeWhenCompiled = function (func) {\r\n var _this = this;\r\n if (this.isReady()) {\r\n func(this);\r\n return;\r\n }\r\n this.onCompileObservable.add(function (effect) {\r\n func(effect);\r\n });\r\n if (!this._pipelineContext || this._pipelineContext.isAsync) {\r\n setTimeout(function () {\r\n _this._checkIsReady(null);\r\n }, 16);\r\n }\r\n };\r\n Effect.prototype._checkIsReady = function (previousPipelineContext) {\r\n var _this = this;\r\n try {\r\n if (this._isReadyInternal()) {\r\n return;\r\n }\r\n }\r\n catch (e) {\r\n this._processCompilationErrors(e, previousPipelineContext);\r\n return;\r\n }\r\n setTimeout(function () {\r\n _this._checkIsReady(previousPipelineContext);\r\n }, 16);\r\n };\r\n Effect.prototype._loadShader = function (shader, key, optionalKey, callback) {\r\n if (typeof (HTMLElement) !== \"undefined\") {\r\n // DOM element ?\r\n if (shader instanceof HTMLElement) {\r\n var shaderCode = DomManagement.GetDOMTextContent(shader);\r\n callback(shaderCode);\r\n return;\r\n }\r\n }\r\n // Direct source ?\r\n if (shader.substr(0, 7) === \"source:\") {\r\n callback(shader.substr(7));\r\n return;\r\n }\r\n // Base64 encoded ?\r\n if (shader.substr(0, 7) === \"base64:\") {\r\n var shaderBinary = window.atob(shader.substr(7));\r\n callback(shaderBinary);\r\n return;\r\n }\r\n // Is in local store ?\r\n if (Effect.ShadersStore[shader + key + \"Shader\"]) {\r\n callback(Effect.ShadersStore[shader + key + \"Shader\"]);\r\n return;\r\n }\r\n if (optionalKey && Effect.ShadersStore[shader + optionalKey + \"Shader\"]) {\r\n callback(Effect.ShadersStore[shader + optionalKey + \"Shader\"]);\r\n return;\r\n }\r\n var shaderUrl;\r\n if (shader[0] === \".\" || shader[0] === \"/\" || shader.indexOf(\"http\") > -1) {\r\n shaderUrl = shader;\r\n }\r\n else {\r\n shaderUrl = Effect.ShadersRepository + shader;\r\n }\r\n // Vertex shader\r\n this._engine._loadFile(shaderUrl + \".\" + key.toLowerCase() + \".fx\", callback);\r\n };\r\n Object.defineProperty(Effect.prototype, \"vertexSourceCode\", {\r\n /**\r\n * Gets the vertex shader source code of this effect\r\n */\r\n get: function () {\r\n return this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride ? this._vertexSourceCodeOverride : this._vertexSourceCode;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Effect.prototype, \"fragmentSourceCode\", {\r\n /**\r\n * Gets the fragment shader source code of this effect\r\n */\r\n get: function () {\r\n return this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride ? this._fragmentSourceCodeOverride : this._fragmentSourceCode;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Effect.prototype, \"rawVertexSourceCode\", {\r\n /**\r\n * Gets the vertex shader source code before it has been processed by the preprocessor\r\n */\r\n get: function () {\r\n return this._rawVertexSourceCode;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Effect.prototype, \"rawFragmentSourceCode\", {\r\n /**\r\n * Gets the fragment shader source code before it has been processed by the preprocessor\r\n */\r\n get: function () {\r\n return this._rawFragmentSourceCode;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Recompiles the webGL program\r\n * @param vertexSourceCode The source code for the vertex shader.\r\n * @param fragmentSourceCode The source code for the fragment shader.\r\n * @param onCompiled Callback called when completed.\r\n * @param onError Callback called on error.\r\n * @hidden\r\n */\r\n Effect.prototype._rebuildProgram = function (vertexSourceCode, fragmentSourceCode, onCompiled, onError) {\r\n var _this = this;\r\n this._isReady = false;\r\n this._vertexSourceCodeOverride = vertexSourceCode;\r\n this._fragmentSourceCodeOverride = fragmentSourceCode;\r\n this.onError = function (effect, error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n };\r\n this.onCompiled = function () {\r\n var scenes = _this.getEngine().scenes;\r\n if (scenes) {\r\n for (var i = 0; i < scenes.length; i++) {\r\n scenes[i].markAllMaterialsAsDirty(63);\r\n }\r\n }\r\n _this._pipelineContext._handlesSpectorRebuildCallback(onCompiled);\r\n };\r\n this._fallbacks = null;\r\n this._prepareEffect();\r\n };\r\n /**\r\n * Prepares the effect\r\n * @hidden\r\n */\r\n Effect.prototype._prepareEffect = function () {\r\n var _this = this;\r\n var attributesNames = this._attributesNames;\r\n var defines = this.defines;\r\n this._valueCache = {};\r\n var previousPipelineContext = this._pipelineContext;\r\n try {\r\n var engine_1 = this._engine;\r\n this._pipelineContext = engine_1.createPipelineContext();\r\n var rebuildRebind = this._rebuildProgram.bind(this);\r\n if (this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride) {\r\n engine_1._preparePipelineContext(this._pipelineContext, this._vertexSourceCodeOverride, this._fragmentSourceCodeOverride, true, rebuildRebind, null, this._transformFeedbackVaryings);\r\n }\r\n else {\r\n engine_1._preparePipelineContext(this._pipelineContext, this._vertexSourceCode, this._fragmentSourceCode, false, rebuildRebind, defines, this._transformFeedbackVaryings);\r\n }\r\n engine_1._executeWhenRenderingStateIsCompiled(this._pipelineContext, function () {\r\n if (engine_1.supportsUniformBuffers) {\r\n for (var name in _this._uniformBuffersNames) {\r\n _this.bindUniformBlock(name, _this._uniformBuffersNames[name]);\r\n }\r\n }\r\n var uniforms = engine_1.getUniforms(_this._pipelineContext, _this._uniformsNames);\r\n uniforms.forEach(function (uniform, index) {\r\n _this._uniforms[_this._uniformsNames[index]] = uniform;\r\n });\r\n _this._attributes = engine_1.getAttributes(_this._pipelineContext, attributesNames);\r\n if (attributesNames) {\r\n for (var i = 0; i < attributesNames.length; i++) {\r\n var name_1 = attributesNames[i];\r\n _this._attributeLocationByName[name_1] = _this._attributes[i];\r\n }\r\n }\r\n var index;\r\n for (index = 0; index < _this._samplerList.length; index++) {\r\n var sampler = _this.getUniform(_this._samplerList[index]);\r\n if (sampler == null) {\r\n _this._samplerList.splice(index, 1);\r\n index--;\r\n }\r\n }\r\n _this._samplerList.forEach(function (name, index) {\r\n _this._samplers[name] = index;\r\n });\r\n engine_1.bindSamplers(_this);\r\n _this._compilationError = \"\";\r\n _this._isReady = true;\r\n if (_this.onCompiled) {\r\n _this.onCompiled(_this);\r\n }\r\n _this.onCompileObservable.notifyObservers(_this);\r\n _this.onCompileObservable.clear();\r\n // Unbind mesh reference in fallbacks\r\n if (_this._fallbacks) {\r\n _this._fallbacks.unBindMesh();\r\n }\r\n if (previousPipelineContext) {\r\n _this.getEngine()._deletePipelineContext(previousPipelineContext);\r\n }\r\n });\r\n if (this._pipelineContext.isAsync) {\r\n this._checkIsReady(previousPipelineContext);\r\n }\r\n }\r\n catch (e) {\r\n this._processCompilationErrors(e, previousPipelineContext);\r\n }\r\n };\r\n Effect.prototype._getShaderCodeAndErrorLine = function (code, error, isFragment) {\r\n var regexp = isFragment ? /FRAGMENT SHADER ERROR: 0:(\\d+?):/ : /VERTEX SHADER ERROR: 0:(\\d+?):/;\r\n var errorLine = null;\r\n if (error && code) {\r\n var res = error.match(regexp);\r\n if (res && res.length === 2) {\r\n var lineNumber = parseInt(res[1]);\r\n var lines = code.split(\"\\n\", -1);\r\n if (lines.length >= lineNumber) {\r\n errorLine = \"Offending line [\" + lineNumber + \"] in \" + (isFragment ? \"fragment\" : \"vertex\") + \" code: \" + lines[lineNumber - 1];\r\n }\r\n }\r\n }\r\n return [code, errorLine];\r\n };\r\n Effect.prototype._processCompilationErrors = function (e, previousPipelineContext) {\r\n var _a, _b;\r\n var _c, _d, _e;\r\n if (previousPipelineContext === void 0) { previousPipelineContext = null; }\r\n this._compilationError = e.message;\r\n var attributesNames = this._attributesNames;\r\n var fallbacks = this._fallbacks;\r\n // Let's go through fallbacks then\r\n Logger.Error(\"Unable to compile effect:\");\r\n Logger.Error(\"Uniforms: \" + this._uniformsNames.map(function (uniform) {\r\n return \" \" + uniform;\r\n }));\r\n Logger.Error(\"Attributes: \" + attributesNames.map(function (attribute) {\r\n return \" \" + attribute;\r\n }));\r\n Logger.Error(\"Defines:\\r\\n\" + this.defines);\r\n if (Effect.LogShaderCodeOnCompilationError) {\r\n var lineErrorVertex = null, lineErrorFragment = null, code = null;\r\n if ((_c = this._pipelineContext) === null || _c === void 0 ? void 0 : _c._getVertexShaderCode()) {\r\n _a = this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(), this._compilationError, false), code = _a[0], lineErrorVertex = _a[1];\r\n if (code) {\r\n Logger.Error(\"Vertex code:\");\r\n Logger.Error(code);\r\n }\r\n }\r\n if ((_d = this._pipelineContext) === null || _d === void 0 ? void 0 : _d._getFragmentShaderCode()) {\r\n _b = this._getShaderCodeAndErrorLine((_e = this._pipelineContext) === null || _e === void 0 ? void 0 : _e._getFragmentShaderCode(), this._compilationError, true), code = _b[0], lineErrorFragment = _b[1];\r\n if (code) {\r\n Logger.Error(\"Fragment code:\");\r\n Logger.Error(code);\r\n }\r\n }\r\n if (lineErrorVertex) {\r\n Logger.Error(lineErrorVertex);\r\n }\r\n if (lineErrorFragment) {\r\n Logger.Error(lineErrorFragment);\r\n }\r\n }\r\n Logger.Error(\"Error: \" + this._compilationError);\r\n if (previousPipelineContext) {\r\n this._pipelineContext = previousPipelineContext;\r\n this._isReady = true;\r\n if (this.onError) {\r\n this.onError(this, this._compilationError);\r\n }\r\n this.onErrorObservable.notifyObservers(this);\r\n }\r\n if (fallbacks) {\r\n this._pipelineContext = null;\r\n if (fallbacks.hasMoreFallbacks) {\r\n this._allFallbacksProcessed = false;\r\n Logger.Error(\"Trying next fallback.\");\r\n this.defines = fallbacks.reduce(this.defines, this);\r\n this._prepareEffect();\r\n }\r\n else { // Sorry we did everything we can\r\n this._allFallbacksProcessed = true;\r\n if (this.onError) {\r\n this.onError(this, this._compilationError);\r\n }\r\n this.onErrorObservable.notifyObservers(this);\r\n this.onErrorObservable.clear();\r\n // Unbind mesh reference in fallbacks\r\n if (this._fallbacks) {\r\n this._fallbacks.unBindMesh();\r\n }\r\n }\r\n }\r\n else {\r\n this._allFallbacksProcessed = true;\r\n }\r\n };\r\n Object.defineProperty(Effect.prototype, \"isSupported\", {\r\n /**\r\n * Checks if the effect is supported. (Must be called after compilation)\r\n */\r\n get: function () {\r\n return this._compilationError === \"\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Binds a texture to the engine to be used as output of the shader.\r\n * @param channel Name of the output variable.\r\n * @param texture Texture to bind.\r\n * @hidden\r\n */\r\n Effect.prototype._bindTexture = function (channel, texture) {\r\n this._engine._bindTexture(this._samplers[channel], texture);\r\n };\r\n /**\r\n * Sets a texture on the engine to be used in the shader.\r\n * @param channel Name of the sampler variable.\r\n * @param texture Texture to set.\r\n */\r\n Effect.prototype.setTexture = function (channel, texture) {\r\n this._engine.setTexture(this._samplers[channel], this._uniforms[channel], texture);\r\n };\r\n /**\r\n * Sets a depth stencil texture from a render target on the engine to be used in the shader.\r\n * @param channel Name of the sampler variable.\r\n * @param texture Texture to set.\r\n */\r\n Effect.prototype.setDepthStencilTexture = function (channel, texture) {\r\n this._engine.setDepthStencilTexture(this._samplers[channel], this._uniforms[channel], texture);\r\n };\r\n /**\r\n * Sets an array of textures on the engine to be used in the shader.\r\n * @param channel Name of the variable.\r\n * @param textures Textures to set.\r\n */\r\n Effect.prototype.setTextureArray = function (channel, textures) {\r\n var exName = channel + \"Ex\";\r\n if (this._samplerList.indexOf(exName + \"0\") === -1) {\r\n var initialPos = this._samplerList.indexOf(channel);\r\n for (var index = 1; index < textures.length; index++) {\r\n var currentExName = exName + (index - 1).toString();\r\n this._samplerList.splice(initialPos + index, 0, currentExName);\r\n }\r\n // Reset every channels\r\n var channelIndex = 0;\r\n for (var _i = 0, _a = this._samplerList; _i < _a.length; _i++) {\r\n var key = _a[_i];\r\n this._samplers[key] = channelIndex;\r\n channelIndex += 1;\r\n }\r\n }\r\n this._engine.setTextureArray(this._samplers[channel], this._uniforms[channel], textures);\r\n };\r\n /**\r\n * Sets a texture to be the input of the specified post process. (To use the output, pass in the next post process in the pipeline)\r\n * @param channel Name of the sampler variable.\r\n * @param postProcess Post process to get the input texture from.\r\n */\r\n Effect.prototype.setTextureFromPostProcess = function (channel, postProcess) {\r\n this._engine.setTextureFromPostProcess(this._samplers[channel], postProcess);\r\n };\r\n /**\r\n * (Warning! setTextureFromPostProcessOutput may be desired instead)\r\n * Sets the input texture of the passed in post process to be input of this effect. (To use the output of the passed in post process use setTextureFromPostProcessOutput)\r\n * @param channel Name of the sampler variable.\r\n * @param postProcess Post process to get the output texture from.\r\n */\r\n Effect.prototype.setTextureFromPostProcessOutput = function (channel, postProcess) {\r\n this._engine.setTextureFromPostProcessOutput(this._samplers[channel], postProcess);\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheMatrix = function (uniformName, matrix) {\r\n var cache = this._valueCache[uniformName];\r\n var flag = matrix.updateFlag;\r\n if (cache !== undefined && cache === flag) {\r\n return false;\r\n }\r\n this._valueCache[uniformName] = flag;\r\n return true;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat2 = function (uniformName, x, y) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache || cache.length !== 2) {\r\n cache = [x, y];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat3 = function (uniformName, x, y, z) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache || cache.length !== 3) {\r\n cache = [x, y, z];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n if (cache[2] !== z) {\r\n cache[2] = z;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat4 = function (uniformName, x, y, z, w) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache || cache.length !== 4) {\r\n cache = [x, y, z, w];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n if (cache[2] !== z) {\r\n cache[2] = z;\r\n changed = true;\r\n }\r\n if (cache[3] !== w) {\r\n cache[3] = w;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /**\r\n * Binds a buffer to a uniform.\r\n * @param buffer Buffer to bind.\r\n * @param name Name of the uniform variable to bind to.\r\n */\r\n Effect.prototype.bindUniformBuffer = function (buffer, name) {\r\n var bufferName = this._uniformBuffersNames[name];\r\n if (bufferName === undefined || Effect._baseCache[bufferName] === buffer) {\r\n return;\r\n }\r\n Effect._baseCache[bufferName] = buffer;\r\n this._engine.bindUniformBufferBase(buffer, bufferName);\r\n };\r\n /**\r\n * Binds block to a uniform.\r\n * @param blockName Name of the block to bind.\r\n * @param index Index to bind.\r\n */\r\n Effect.prototype.bindUniformBlock = function (blockName, index) {\r\n this._engine.bindUniformBlock(this._pipelineContext, blockName, index);\r\n };\r\n /**\r\n * Sets an interger value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setInt = function (uniformName, value) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === value) {\r\n return this;\r\n }\r\n if (this._engine.setInt(this._uniforms[uniformName], value)) {\r\n this._valueCache[uniformName] = value;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets an int array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets matrices on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param matrices matrices to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrices = function (uniformName, matrices) {\r\n if (!matrices) {\r\n return this;\r\n }\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrices(this._uniforms[uniformName], matrices); // the cast is ok because it is gl.uniformMatrix4fv() which is called at the end, and this function accepts Float32Array and Array\r\n return this;\r\n };\r\n /**\r\n * Sets matrix on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix = function (uniformName, matrix) {\r\n if (this._cacheMatrix(uniformName, matrix)) {\r\n if (!this._engine.setMatrices(this._uniforms[uniformName], matrix.toArray())) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a 3x3 matrix on a uniform variable. (Speicified as [1,2,3,4,5,6,7,8,9] will result in [1,2,3][4,5,6][7,8,9] matrix)\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix3x3 = function (uniformName, matrix) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrix3x3(this._uniforms[uniformName], matrix); // the cast is ok because it is gl.uniformMatrix3fv() which is called at the end, and this function accepts Float32Array and Array\r\n return this;\r\n };\r\n /**\r\n * Sets a 2x2 matrix on a uniform variable. (Speicified as [1,2,3,4] will result in [1,2][3,4] matrix)\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix2x2 = function (uniformName, matrix) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrix2x2(this._uniforms[uniformName], matrix); // the cast is ok because it is gl.uniformMatrix2fv() which is called at the end, and this function accepts Float32Array and Array\r\n return this;\r\n };\r\n /**\r\n * Sets a float on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat = function (uniformName, value) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === value) {\r\n return this;\r\n }\r\n if (this._engine.setFloat(this._uniforms[uniformName], value)) {\r\n this._valueCache[uniformName] = value;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a boolean on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param bool value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setBool = function (uniformName, bool) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === bool) {\r\n return this;\r\n }\r\n if (this._engine.setInt(this._uniforms[uniformName], bool ? 1 : 0)) {\r\n this._valueCache[uniformName] = bool;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector2 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector2 vector2 to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector2 = function (uniformName, vector2) {\r\n if (this._cacheFloat2(uniformName, vector2.x, vector2.y)) {\r\n if (!this._engine.setFloat2(this._uniforms[uniformName], vector2.x, vector2.y)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float2 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float2.\r\n * @param y Second float in float2.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat2 = function (uniformName, x, y) {\r\n if (this._cacheFloat2(uniformName, x, y)) {\r\n if (!this._engine.setFloat2(this._uniforms[uniformName], x, y)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector3 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector3 = function (uniformName, vector3) {\r\n if (this._cacheFloat3(uniformName, vector3.x, vector3.y, vector3.z)) {\r\n if (!this._engine.setFloat3(this._uniforms[uniformName], vector3.x, vector3.y, vector3.z)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float3.\r\n * @param y Second float in float3.\r\n * @param z Third float in float3.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat3 = function (uniformName, x, y, z) {\r\n if (this._cacheFloat3(uniformName, x, y, z)) {\r\n if (!this._engine.setFloat3(this._uniforms[uniformName], x, y, z)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector4 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector4 = function (uniformName, vector4) {\r\n if (this._cacheFloat4(uniformName, vector4.x, vector4.y, vector4.z, vector4.w)) {\r\n if (!this._engine.setFloat4(this._uniforms[uniformName], vector4.x, vector4.y, vector4.z, vector4.w)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float4.\r\n * @param y Second float in float4.\r\n * @param z Third float in float4.\r\n * @param w Fourth float in float4.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat4 = function (uniformName, x, y, z, w) {\r\n if (this._cacheFloat4(uniformName, x, y, z, w)) {\r\n if (!this._engine.setFloat4(this._uniforms[uniformName], x, y, z, w)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param color3 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setColor3 = function (uniformName, color3) {\r\n if (this._cacheFloat3(uniformName, color3.r, color3.g, color3.b)) {\r\n if (!this._engine.setFloat3(this._uniforms[uniformName], color3.r, color3.g, color3.b)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param color3 Value to be set.\r\n * @param alpha Alpha value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setColor4 = function (uniformName, color3, alpha) {\r\n if (this._cacheFloat4(uniformName, color3.r, color3.g, color3.b, alpha)) {\r\n if (!this._engine.setFloat4(this._uniforms[uniformName], color3.r, color3.g, color3.b, alpha)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color4 on a uniform variable\r\n * @param uniformName defines the name of the variable\r\n * @param color4 defines the value to be set\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setDirectColor4 = function (uniformName, color4) {\r\n if (this._cacheFloat4(uniformName, color4.r, color4.g, color4.b, color4.a)) {\r\n if (!this._engine.setFloat4(this._uniforms[uniformName], color4.r, color4.g, color4.b, color4.a)) {\r\n this._valueCache[uniformName] = null;\r\n }\r\n }\r\n return this;\r\n };\r\n /** Release all associated resources */\r\n Effect.prototype.dispose = function () {\r\n this._engine._releaseEffect(this);\r\n };\r\n /**\r\n * This function will add a new shader to the shader store\r\n * @param name the name of the shader\r\n * @param pixelShader optional pixel shader content\r\n * @param vertexShader optional vertex shader content\r\n */\r\n Effect.RegisterShader = function (name, pixelShader, vertexShader) {\r\n if (pixelShader) {\r\n Effect.ShadersStore[name + \"PixelShader\"] = pixelShader;\r\n }\r\n if (vertexShader) {\r\n Effect.ShadersStore[name + \"VertexShader\"] = vertexShader;\r\n }\r\n };\r\n /**\r\n * Resets the cache of effects.\r\n */\r\n Effect.ResetCache = function () {\r\n Effect._baseCache = {};\r\n };\r\n /**\r\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\r\n */\r\n Effect.ShadersRepository = \"src/Shaders/\";\r\n /**\r\n * Enable logging of the shader code when a compilation error occurs\r\n */\r\n Effect.LogShaderCodeOnCompilationError = true;\r\n Effect._uniqueIdSeed = 0;\r\n Effect._baseCache = {};\r\n /**\r\n * Store of each shader (The can be looked up using effect.key)\r\n */\r\n Effect.ShadersStore = {};\r\n /**\r\n * Store of each included file for a shader (The can be looked up using effect.key)\r\n */\r\n Effect.IncludesShadersStore = {};\r\n return Effect;\r\n}());\r\nexport { Effect };\r\n//# sourceMappingURL=effect.js.map","/**\r\n * EffectFallbacks can be used to add fallbacks (properties to disable) to certain properties when desired to improve performance.\r\n * (Eg. Start at high quality with reflection and fog, if fps is low, remove reflection, if still low remove fog)\r\n */\r\nvar EffectFallbacks = /** @class */ (function () {\r\n function EffectFallbacks() {\r\n this._defines = {};\r\n this._currentRank = 32;\r\n this._maxRank = -1;\r\n this._mesh = null;\r\n }\r\n /**\r\n * Removes the fallback from the bound mesh.\r\n */\r\n EffectFallbacks.prototype.unBindMesh = function () {\r\n this._mesh = null;\r\n };\r\n /**\r\n * Adds a fallback on the specified property.\r\n * @param rank The rank of the fallback (Lower ranks will be fallbacked to first)\r\n * @param define The name of the define in the shader\r\n */\r\n EffectFallbacks.prototype.addFallback = function (rank, define) {\r\n if (!this._defines[rank]) {\r\n if (rank < this._currentRank) {\r\n this._currentRank = rank;\r\n }\r\n if (rank > this._maxRank) {\r\n this._maxRank = rank;\r\n }\r\n this._defines[rank] = new Array();\r\n }\r\n this._defines[rank].push(define);\r\n };\r\n /**\r\n * Sets the mesh to use CPU skinning when needing to fallback.\r\n * @param rank The rank of the fallback (Lower ranks will be fallbacked to first)\r\n * @param mesh The mesh to use the fallbacks.\r\n */\r\n EffectFallbacks.prototype.addCPUSkinningFallback = function (rank, mesh) {\r\n this._mesh = mesh;\r\n if (rank < this._currentRank) {\r\n this._currentRank = rank;\r\n }\r\n if (rank > this._maxRank) {\r\n this._maxRank = rank;\r\n }\r\n };\r\n Object.defineProperty(EffectFallbacks.prototype, \"hasMoreFallbacks\", {\r\n /**\r\n * Checks to see if more fallbacks are still availible.\r\n */\r\n get: function () {\r\n return this._currentRank <= this._maxRank;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Removes the defines that should be removed when falling back.\r\n * @param currentDefines defines the current define statements for the shader.\r\n * @param effect defines the current effect we try to compile\r\n * @returns The resulting defines with defines of the current rank removed.\r\n */\r\n EffectFallbacks.prototype.reduce = function (currentDefines, effect) {\r\n // First we try to switch to CPU skinning\r\n if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0) {\r\n this._mesh.computeBonesUsingShaders = false;\r\n currentDefines = currentDefines.replace(\"#define NUM_BONE_INFLUENCERS \" + this._mesh.numBoneInfluencers, \"#define NUM_BONE_INFLUENCERS 0\");\r\n effect._bonesComputationForcedToCPU = true;\r\n var scene = this._mesh.getScene();\r\n for (var index = 0; index < scene.meshes.length; index++) {\r\n var otherMesh = scene.meshes[index];\r\n if (!otherMesh.material) {\r\n if (!this._mesh.material && otherMesh.computeBonesUsingShaders && otherMesh.numBoneInfluencers > 0) {\r\n otherMesh.computeBonesUsingShaders = false;\r\n }\r\n continue;\r\n }\r\n if (!otherMesh.computeBonesUsingShaders || otherMesh.numBoneInfluencers === 0) {\r\n continue;\r\n }\r\n if (otherMesh.material.getEffect() === effect) {\r\n otherMesh.computeBonesUsingShaders = false;\r\n }\r\n else if (otherMesh.subMeshes) {\r\n for (var _i = 0, _a = otherMesh.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n var subMeshEffect = subMesh.effect;\r\n if (subMeshEffect === effect) {\r\n otherMesh.computeBonesUsingShaders = false;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n var currentFallbacks = this._defines[this._currentRank];\r\n if (currentFallbacks) {\r\n for (var index = 0; index < currentFallbacks.length; index++) {\r\n currentDefines = currentDefines.replace(\"#define \" + currentFallbacks[index], \"\");\r\n }\r\n }\r\n this._currentRank++;\r\n }\r\n return currentDefines;\r\n };\r\n return EffectFallbacks;\r\n}());\r\nexport { EffectFallbacks };\r\n//# sourceMappingURL=effectFallbacks.js.map","import { __decorate } from \"tslib\";\r\nimport { SerializationHelper, serialize } from \"../Misc/decorators\";\r\nimport { Color4 } from '../Maths/math.color';\r\n/**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\nvar ColorCurves = /** @class */ (function () {\r\n function ColorCurves() {\r\n this._dirty = true;\r\n this._tempColor = new Color4(0, 0, 0, 0);\r\n this._globalCurve = new Color4(0, 0, 0, 0);\r\n this._highlightsCurve = new Color4(0, 0, 0, 0);\r\n this._midtonesCurve = new Color4(0, 0, 0, 0);\r\n this._shadowsCurve = new Color4(0, 0, 0, 0);\r\n this._positiveCurve = new Color4(0, 0, 0, 0);\r\n this._negativeCurve = new Color4(0, 0, 0, 0);\r\n this._globalHue = 30;\r\n this._globalDensity = 0;\r\n this._globalSaturation = 0;\r\n this._globalExposure = 0;\r\n this._highlightsHue = 30;\r\n this._highlightsDensity = 0;\r\n this._highlightsSaturation = 0;\r\n this._highlightsExposure = 0;\r\n this._midtonesHue = 30;\r\n this._midtonesDensity = 0;\r\n this._midtonesSaturation = 0;\r\n this._midtonesExposure = 0;\r\n this._shadowsHue = 30;\r\n this._shadowsDensity = 0;\r\n this._shadowsSaturation = 0;\r\n this._shadowsExposure = 0;\r\n }\r\n Object.defineProperty(ColorCurves.prototype, \"globalHue\", {\r\n /**\r\n * Gets the global Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._globalHue;\r\n },\r\n /**\r\n * Sets the global Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._globalHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"globalDensity\", {\r\n /**\r\n * Gets the global Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._globalDensity;\r\n },\r\n /**\r\n * Sets the global Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._globalDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"globalSaturation\", {\r\n /**\r\n * Gets the global Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._globalSaturation;\r\n },\r\n /**\r\n * Sets the global Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._globalSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"globalExposure\", {\r\n /**\r\n * Gets the global Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._globalExposure;\r\n },\r\n /**\r\n * Sets the global Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._globalExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsHue\", {\r\n /**\r\n * Gets the highlights Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._highlightsHue;\r\n },\r\n /**\r\n * Sets the highlights Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._highlightsHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsDensity\", {\r\n /**\r\n * Gets the highlights Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._highlightsDensity;\r\n },\r\n /**\r\n * Sets the highlights Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._highlightsDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsSaturation\", {\r\n /**\r\n * Gets the highlights Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._highlightsSaturation;\r\n },\r\n /**\r\n * Sets the highlights Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._highlightsSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"highlightsExposure\", {\r\n /**\r\n * Gets the highlights Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._highlightsExposure;\r\n },\r\n /**\r\n * Sets the highlights Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._highlightsExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesHue\", {\r\n /**\r\n * Gets the midtones Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._midtonesHue;\r\n },\r\n /**\r\n * Sets the midtones Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._midtonesHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesDensity\", {\r\n /**\r\n * Gets the midtones Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._midtonesDensity;\r\n },\r\n /**\r\n * Sets the midtones Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._midtonesDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesSaturation\", {\r\n /**\r\n * Gets the midtones Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._midtonesSaturation;\r\n },\r\n /**\r\n * Sets the midtones Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._midtonesSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"midtonesExposure\", {\r\n /**\r\n * Gets the midtones Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._midtonesExposure;\r\n },\r\n /**\r\n * Sets the midtones Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._midtonesExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsHue\", {\r\n /**\r\n * Gets the shadows Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n get: function () {\r\n return this._shadowsHue;\r\n },\r\n /**\r\n * Sets the shadows Hue value.\r\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\r\n */\r\n set: function (value) {\r\n this._shadowsHue = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsDensity\", {\r\n /**\r\n * Gets the shadows Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n get: function () {\r\n return this._shadowsDensity;\r\n },\r\n /**\r\n * Sets the shadows Density value.\r\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\r\n * Values less than zero provide a filter of opposite hue.\r\n */\r\n set: function (value) {\r\n this._shadowsDensity = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsSaturation\", {\r\n /**\r\n * Gets the shadows Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n get: function () {\r\n return this._shadowsSaturation;\r\n },\r\n /**\r\n * Sets the shadows Saturation value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\r\n */\r\n set: function (value) {\r\n this._shadowsSaturation = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorCurves.prototype, \"shadowsExposure\", {\r\n /**\r\n * Gets the shadows Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n get: function () {\r\n return this._shadowsExposure;\r\n },\r\n /**\r\n * Sets the shadows Exposure value.\r\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\r\n */\r\n set: function (value) {\r\n this._shadowsExposure = value;\r\n this._dirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the class name\r\n * @returns The class name\r\n */\r\n ColorCurves.prototype.getClassName = function () {\r\n return \"ColorCurves\";\r\n };\r\n /**\r\n * Binds the color curves to the shader.\r\n * @param colorCurves The color curve to bind\r\n * @param effect The effect to bind to\r\n * @param positiveUniform The positive uniform shader parameter\r\n * @param neutralUniform The neutral uniform shader parameter\r\n * @param negativeUniform The negative uniform shader parameter\r\n */\r\n ColorCurves.Bind = function (colorCurves, effect, positiveUniform, neutralUniform, negativeUniform) {\r\n if (positiveUniform === void 0) { positiveUniform = \"vCameraColorCurvePositive\"; }\r\n if (neutralUniform === void 0) { neutralUniform = \"vCameraColorCurveNeutral\"; }\r\n if (negativeUniform === void 0) { negativeUniform = \"vCameraColorCurveNegative\"; }\r\n if (colorCurves._dirty) {\r\n colorCurves._dirty = false;\r\n // Fill in global info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._globalHue, colorCurves._globalDensity, colorCurves._globalSaturation, colorCurves._globalExposure, colorCurves._globalCurve);\r\n // Compute highlights info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._highlightsHue, colorCurves._highlightsDensity, colorCurves._highlightsSaturation, colorCurves._highlightsExposure, colorCurves._tempColor);\r\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._highlightsCurve);\r\n // Compute midtones info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._midtonesHue, colorCurves._midtonesDensity, colorCurves._midtonesSaturation, colorCurves._midtonesExposure, colorCurves._tempColor);\r\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._midtonesCurve);\r\n // Compute shadows info.\r\n colorCurves.getColorGradingDataToRef(colorCurves._shadowsHue, colorCurves._shadowsDensity, colorCurves._shadowsSaturation, colorCurves._shadowsExposure, colorCurves._tempColor);\r\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._shadowsCurve);\r\n // Compute deltas (neutral is midtones).\r\n colorCurves._highlightsCurve.subtractToRef(colorCurves._midtonesCurve, colorCurves._positiveCurve);\r\n colorCurves._midtonesCurve.subtractToRef(colorCurves._shadowsCurve, colorCurves._negativeCurve);\r\n }\r\n if (effect) {\r\n effect.setFloat4(positiveUniform, colorCurves._positiveCurve.r, colorCurves._positiveCurve.g, colorCurves._positiveCurve.b, colorCurves._positiveCurve.a);\r\n effect.setFloat4(neutralUniform, colorCurves._midtonesCurve.r, colorCurves._midtonesCurve.g, colorCurves._midtonesCurve.b, colorCurves._midtonesCurve.a);\r\n effect.setFloat4(negativeUniform, colorCurves._negativeCurve.r, colorCurves._negativeCurve.g, colorCurves._negativeCurve.b, colorCurves._negativeCurve.a);\r\n }\r\n };\r\n /**\r\n * Prepare the list of uniforms associated with the ColorCurves effects.\r\n * @param uniformsList The list of uniforms used in the effect\r\n */\r\n ColorCurves.PrepareUniforms = function (uniformsList) {\r\n uniformsList.push(\"vCameraColorCurveNeutral\", \"vCameraColorCurvePositive\", \"vCameraColorCurveNegative\");\r\n };\r\n /**\r\n * Returns color grading data based on a hue, density, saturation and exposure value.\r\n * @param filterHue The hue of the color filter.\r\n * @param filterDensity The density of the color filter.\r\n * @param saturation The saturation.\r\n * @param exposure The exposure.\r\n * @param result The result data container.\r\n */\r\n ColorCurves.prototype.getColorGradingDataToRef = function (hue, density, saturation, exposure, result) {\r\n if (hue == null) {\r\n return;\r\n }\r\n hue = ColorCurves.clamp(hue, 0, 360);\r\n density = ColorCurves.clamp(density, -100, 100);\r\n saturation = ColorCurves.clamp(saturation, -100, 100);\r\n exposure = ColorCurves.clamp(exposure, -100, 100);\r\n // Remap the slider/config filter density with non-linear mapping and also scale by half\r\n // so that the maximum filter density is only 50% control. This provides fine control\r\n // for small values and reasonable range.\r\n density = ColorCurves.applyColorGradingSliderNonlinear(density);\r\n density *= 0.5;\r\n exposure = ColorCurves.applyColorGradingSliderNonlinear(exposure);\r\n if (density < 0) {\r\n density *= -1;\r\n hue = (hue + 180) % 360;\r\n }\r\n ColorCurves.fromHSBToRef(hue, density, 50 + 0.25 * exposure, result);\r\n result.scaleToRef(2, result);\r\n result.a = 1 + 0.01 * saturation;\r\n };\r\n /**\r\n * Takes an input slider value and returns an adjusted value that provides extra control near the centre.\r\n * @param value The input slider value in range [-100,100].\r\n * @returns Adjusted value.\r\n */\r\n ColorCurves.applyColorGradingSliderNonlinear = function (value) {\r\n value /= 100;\r\n var x = Math.abs(value);\r\n x = Math.pow(x, 2);\r\n if (value < 0) {\r\n x *= -1;\r\n }\r\n x *= 100;\r\n return x;\r\n };\r\n /**\r\n * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).\r\n * @param hue The hue (H) input.\r\n * @param saturation The saturation (S) input.\r\n * @param brightness The brightness (B) input.\r\n * @result An RGBA color represented as Vector4.\r\n */\r\n ColorCurves.fromHSBToRef = function (hue, saturation, brightness, result) {\r\n var h = ColorCurves.clamp(hue, 0, 360);\r\n var s = ColorCurves.clamp(saturation / 100, 0, 1);\r\n var v = ColorCurves.clamp(brightness / 100, 0, 1);\r\n if (s === 0) {\r\n result.r = v;\r\n result.g = v;\r\n result.b = v;\r\n }\r\n else {\r\n // sector 0 to 5\r\n h /= 60;\r\n var i = Math.floor(h);\r\n // fractional part of h\r\n var f = h - i;\r\n var p = v * (1 - s);\r\n var q = v * (1 - s * f);\r\n var t = v * (1 - s * (1 - f));\r\n switch (i) {\r\n case 0:\r\n result.r = v;\r\n result.g = t;\r\n result.b = p;\r\n break;\r\n case 1:\r\n result.r = q;\r\n result.g = v;\r\n result.b = p;\r\n break;\r\n case 2:\r\n result.r = p;\r\n result.g = v;\r\n result.b = t;\r\n break;\r\n case 3:\r\n result.r = p;\r\n result.g = q;\r\n result.b = v;\r\n break;\r\n case 4:\r\n result.r = t;\r\n result.g = p;\r\n result.b = v;\r\n break;\r\n default: // case 5:\r\n result.r = v;\r\n result.g = p;\r\n result.b = q;\r\n break;\r\n }\r\n }\r\n result.a = 1;\r\n };\r\n /**\r\n * Returns a value clamped between min and max\r\n * @param value The value to clamp\r\n * @param min The minimum of value\r\n * @param max The maximum of value\r\n * @returns The clamped value.\r\n */\r\n ColorCurves.clamp = function (value, min, max) {\r\n return Math.min(Math.max(value, min), max);\r\n };\r\n /**\r\n * Clones the current color curve instance.\r\n * @return The cloned curves\r\n */\r\n ColorCurves.prototype.clone = function () {\r\n return SerializationHelper.Clone(function () { return new ColorCurves(); }, this);\r\n };\r\n /**\r\n * Serializes the current color curve instance to a json representation.\r\n * @return a JSON representation\r\n */\r\n ColorCurves.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses the color curve from a json representation.\r\n * @param source the JSON source to parse\r\n * @return The parsed curves\r\n */\r\n ColorCurves.Parse = function (source) {\r\n return SerializationHelper.Parse(function () { return new ColorCurves(); }, source, null, null);\r\n };\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_globalHue\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_globalDensity\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_globalSaturation\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_globalExposure\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_highlightsHue\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_highlightsDensity\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_highlightsSaturation\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_highlightsExposure\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_midtonesHue\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_midtonesDensity\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_midtonesSaturation\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ColorCurves.prototype, \"_midtonesExposure\", void 0);\r\n return ColorCurves;\r\n}());\r\nexport { ColorCurves };\r\n// References the dependencies.\r\nSerializationHelper._ColorCurvesParser = ColorCurves.Parse;\r\n//# sourceMappingURL=colorCurves.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, SerializationHelper, serializeAsTexture, serializeAsColorCurves, serializeAsColor4 } from \"../Misc/decorators\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport { MaterialDefines } from \"../Materials/materialDefines\";\r\nimport { ColorCurves } from \"../Materials/colorCurves\";\r\n/**\r\n * @hidden\r\n */\r\nvar ImageProcessingConfigurationDefines = /** @class */ (function (_super) {\r\n __extends(ImageProcessingConfigurationDefines, _super);\r\n function ImageProcessingConfigurationDefines() {\r\n var _this = _super.call(this) || this;\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n _this.EXPOSURE = false;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n return ImageProcessingConfigurationDefines;\r\n}(MaterialDefines));\r\nexport { ImageProcessingConfigurationDefines };\r\n/**\r\n * This groups together the common properties used for image processing either in direct forward pass\r\n * or through post processing effect depending on the use of the image processing pipeline in your scene\r\n * or not.\r\n */\r\nvar ImageProcessingConfiguration = /** @class */ (function () {\r\n function ImageProcessingConfiguration() {\r\n /**\r\n * Color curves setup used in the effect if colorCurvesEnabled is set to true\r\n */\r\n this.colorCurves = new ColorCurves();\r\n this._colorCurvesEnabled = false;\r\n this._colorGradingEnabled = false;\r\n this._colorGradingWithGreenDepth = true;\r\n this._colorGradingBGR = true;\r\n /** @hidden */\r\n this._exposure = 1.0;\r\n this._toneMappingEnabled = false;\r\n this._toneMappingType = ImageProcessingConfiguration.TONEMAPPING_STANDARD;\r\n this._contrast = 1.0;\r\n /**\r\n * Vignette stretch size.\r\n */\r\n this.vignetteStretch = 0;\r\n /**\r\n * Vignette centre X Offset.\r\n */\r\n this.vignetteCentreX = 0;\r\n /**\r\n * Vignette centre Y Offset.\r\n */\r\n this.vignetteCentreY = 0;\r\n /**\r\n * Vignette weight or intensity of the vignette effect.\r\n */\r\n this.vignetteWeight = 1.5;\r\n /**\r\n * Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)\r\n * if vignetteEnabled is set to true.\r\n */\r\n this.vignetteColor = new Color4(0, 0, 0, 0);\r\n /**\r\n * Camera field of view used by the Vignette effect.\r\n */\r\n this.vignetteCameraFov = 0.5;\r\n this._vignetteBlendMode = ImageProcessingConfiguration.VIGNETTEMODE_MULTIPLY;\r\n this._vignetteEnabled = false;\r\n this._applyByPostProcess = false;\r\n this._isEnabled = true;\r\n /**\r\n * An event triggered when the configuration changes and requires Shader to Update some parameters.\r\n */\r\n this.onUpdateParameters = new Observable();\r\n }\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this._colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._colorCurvesEnabled === value) {\r\n return;\r\n }\r\n this._colorCurvesEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingTexture\", {\r\n /**\r\n * Color grading LUT texture used in the effect if colorGradingEnabled is set to true\r\n */\r\n get: function () {\r\n return this._colorGradingTexture;\r\n },\r\n /**\r\n * Color grading LUT texture used in the effect if colorGradingEnabled is set to true\r\n */\r\n set: function (value) {\r\n if (this._colorGradingTexture === value) {\r\n return;\r\n }\r\n this._colorGradingTexture = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this._colorGradingEnabled;\r\n },\r\n /**\r\n * Sets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._colorGradingEnabled === value) {\r\n return;\r\n }\r\n this._colorGradingEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingWithGreenDepth\", {\r\n /**\r\n * Gets wether the color grading effect is using a green depth for the 3d Texture.\r\n */\r\n get: function () {\r\n return this._colorGradingWithGreenDepth;\r\n },\r\n /**\r\n * Sets wether the color grading effect is using a green depth for the 3d Texture.\r\n */\r\n set: function (value) {\r\n if (this._colorGradingWithGreenDepth === value) {\r\n return;\r\n }\r\n this._colorGradingWithGreenDepth = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"colorGradingBGR\", {\r\n /**\r\n * Gets wether the color grading texture contains BGR values.\r\n */\r\n get: function () {\r\n return this._colorGradingBGR;\r\n },\r\n /**\r\n * Sets wether the color grading texture contains BGR values.\r\n */\r\n set: function (value) {\r\n if (this._colorGradingBGR === value) {\r\n return;\r\n }\r\n this._colorGradingBGR = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"exposure\", {\r\n /**\r\n * Gets the Exposure used in the effect.\r\n */\r\n get: function () {\r\n return this._exposure;\r\n },\r\n /**\r\n * Sets the Exposure used in the effect.\r\n */\r\n set: function (value) {\r\n if (this._exposure === value) {\r\n return;\r\n }\r\n this._exposure = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"toneMappingEnabled\", {\r\n /**\r\n * Gets wether the tone mapping effect is enabled.\r\n */\r\n get: function () {\r\n return this._toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether the tone mapping effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._toneMappingEnabled === value) {\r\n return;\r\n }\r\n this._toneMappingEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"toneMappingType\", {\r\n /**\r\n * Gets the type of tone mapping effect.\r\n */\r\n get: function () {\r\n return this._toneMappingType;\r\n },\r\n /**\r\n * Sets the type of tone mapping effect used in BabylonJS.\r\n */\r\n set: function (value) {\r\n if (this._toneMappingType === value) {\r\n return;\r\n }\r\n this._toneMappingType = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"contrast\", {\r\n /**\r\n * Gets the contrast used in the effect.\r\n */\r\n get: function () {\r\n return this._contrast;\r\n },\r\n /**\r\n * Sets the contrast used in the effect.\r\n */\r\n set: function (value) {\r\n if (this._contrast === value) {\r\n return;\r\n }\r\n this._contrast = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"vignetteBlendMode\", {\r\n /**\r\n * Gets the vignette blend mode allowing different kind of effect.\r\n */\r\n get: function () {\r\n return this._vignetteBlendMode;\r\n },\r\n /**\r\n * Sets the vignette blend mode allowing different kind of effect.\r\n */\r\n set: function (value) {\r\n if (this._vignetteBlendMode === value) {\r\n return;\r\n }\r\n this._vignetteBlendMode = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"vignetteEnabled\", {\r\n /**\r\n * Gets wether the vignette effect is enabled.\r\n */\r\n get: function () {\r\n return this._vignetteEnabled;\r\n },\r\n /**\r\n * Sets wether the vignette effect is enabled.\r\n */\r\n set: function (value) {\r\n if (this._vignetteEnabled === value) {\r\n return;\r\n }\r\n this._vignetteEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"applyByPostProcess\", {\r\n /**\r\n * Gets wether the image processing is applied through a post process or not.\r\n */\r\n get: function () {\r\n return this._applyByPostProcess;\r\n },\r\n /**\r\n * Sets wether the image processing is applied through a post process or not.\r\n */\r\n set: function (value) {\r\n if (this._applyByPostProcess === value) {\r\n return;\r\n }\r\n this._applyByPostProcess = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration.prototype, \"isEnabled\", {\r\n /**\r\n * Gets wether the image processing is enabled or not.\r\n */\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n /**\r\n * Sets wether the image processing is enabled or not.\r\n */\r\n set: function (value) {\r\n if (this._isEnabled === value) {\r\n return;\r\n }\r\n this._isEnabled = value;\r\n this._updateParameters();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Method called each time the image processing information changes requires to recompile the effect.\r\n */\r\n ImageProcessingConfiguration.prototype._updateParameters = function () {\r\n this.onUpdateParameters.notifyObservers(this);\r\n };\r\n /**\r\n * Gets the current class name.\r\n * @return \"ImageProcessingConfiguration\"\r\n */\r\n ImageProcessingConfiguration.prototype.getClassName = function () {\r\n return \"ImageProcessingConfiguration\";\r\n };\r\n /**\r\n * Prepare the list of uniforms associated with the Image Processing effects.\r\n * @param uniforms The list of uniforms used in the effect\r\n * @param defines the list of defines currently in use\r\n */\r\n ImageProcessingConfiguration.PrepareUniforms = function (uniforms, defines) {\r\n if (defines.EXPOSURE) {\r\n uniforms.push(\"exposureLinear\");\r\n }\r\n if (defines.CONTRAST) {\r\n uniforms.push(\"contrast\");\r\n }\r\n if (defines.COLORGRADING) {\r\n uniforms.push(\"colorTransformSettings\");\r\n }\r\n if (defines.VIGNETTE) {\r\n uniforms.push(\"vInverseScreenSize\");\r\n uniforms.push(\"vignetteSettings1\");\r\n uniforms.push(\"vignetteSettings2\");\r\n }\r\n if (defines.COLORCURVES) {\r\n ColorCurves.PrepareUniforms(uniforms);\r\n }\r\n };\r\n /**\r\n * Prepare the list of samplers associated with the Image Processing effects.\r\n * @param samplersList The list of uniforms used in the effect\r\n * @param defines the list of defines currently in use\r\n */\r\n ImageProcessingConfiguration.PrepareSamplers = function (samplersList, defines) {\r\n if (defines.COLORGRADING) {\r\n samplersList.push(\"txColorTransform\");\r\n }\r\n };\r\n /**\r\n * Prepare the list of defines associated to the shader.\r\n * @param defines the list of defines to complete\r\n * @param forPostProcess Define if we are currently in post process mode or not\r\n */\r\n ImageProcessingConfiguration.prototype.prepareDefines = function (defines, forPostProcess) {\r\n if (forPostProcess === void 0) { forPostProcess = false; }\r\n if (forPostProcess !== this.applyByPostProcess || !this._isEnabled) {\r\n defines.VIGNETTE = false;\r\n defines.TONEMAPPING = false;\r\n defines.TONEMAPPING_ACES = false;\r\n defines.CONTRAST = false;\r\n defines.EXPOSURE = false;\r\n defines.COLORCURVES = false;\r\n defines.COLORGRADING = false;\r\n defines.COLORGRADING3D = false;\r\n defines.IMAGEPROCESSING = false;\r\n defines.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess && this._isEnabled;\r\n return;\r\n }\r\n defines.VIGNETTE = this.vignetteEnabled;\r\n defines.VIGNETTEBLENDMODEMULTIPLY = (this.vignetteBlendMode === ImageProcessingConfiguration._VIGNETTEMODE_MULTIPLY);\r\n defines.VIGNETTEBLENDMODEOPAQUE = !defines.VIGNETTEBLENDMODEMULTIPLY;\r\n defines.TONEMAPPING = this.toneMappingEnabled;\r\n switch (this._toneMappingType) {\r\n case ImageProcessingConfiguration.TONEMAPPING_ACES:\r\n defines.TONEMAPPING_ACES = true;\r\n break;\r\n default:\r\n defines.TONEMAPPING_ACES = false;\r\n break;\r\n }\r\n defines.CONTRAST = (this.contrast !== 1.0);\r\n defines.EXPOSURE = (this.exposure !== 1.0);\r\n defines.COLORCURVES = (this.colorCurvesEnabled && !!this.colorCurves);\r\n defines.COLORGRADING = (this.colorGradingEnabled && !!this.colorGradingTexture);\r\n if (defines.COLORGRADING) {\r\n defines.COLORGRADING3D = this.colorGradingTexture.is3D;\r\n }\r\n else {\r\n defines.COLORGRADING3D = false;\r\n }\r\n defines.SAMPLER3DGREENDEPTH = this.colorGradingWithGreenDepth;\r\n defines.SAMPLER3DBGRMAP = this.colorGradingBGR;\r\n defines.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess;\r\n defines.IMAGEPROCESSING = defines.VIGNETTE || defines.TONEMAPPING || defines.CONTRAST || defines.EXPOSURE || defines.COLORCURVES || defines.COLORGRADING;\r\n };\r\n /**\r\n * Returns true if all the image processing information are ready.\r\n * @returns True if ready, otherwise, false\r\n */\r\n ImageProcessingConfiguration.prototype.isReady = function () {\r\n // Color Grading texure can not be none blocking.\r\n return !this.colorGradingEnabled || !this.colorGradingTexture || this.colorGradingTexture.isReady();\r\n };\r\n /**\r\n * Binds the image processing to the shader.\r\n * @param effect The effect to bind to\r\n * @param overrideAspectRatio Override the aspect ratio of the effect\r\n */\r\n ImageProcessingConfiguration.prototype.bind = function (effect, overrideAspectRatio) {\r\n // Color Curves\r\n if (this._colorCurvesEnabled && this.colorCurves) {\r\n ColorCurves.Bind(this.colorCurves, effect);\r\n }\r\n // Vignette\r\n if (this._vignetteEnabled) {\r\n var inverseWidth = 1 / effect.getEngine().getRenderWidth();\r\n var inverseHeight = 1 / effect.getEngine().getRenderHeight();\r\n effect.setFloat2(\"vInverseScreenSize\", inverseWidth, inverseHeight);\r\n var aspectRatio = overrideAspectRatio != null ? overrideAspectRatio : (inverseHeight / inverseWidth);\r\n var vignetteScaleY = Math.tan(this.vignetteCameraFov * 0.5);\r\n var vignetteScaleX = vignetteScaleY * aspectRatio;\r\n var vignetteScaleGeometricMean = Math.sqrt(vignetteScaleX * vignetteScaleY);\r\n vignetteScaleX = Tools.Mix(vignetteScaleX, vignetteScaleGeometricMean, this.vignetteStretch);\r\n vignetteScaleY = Tools.Mix(vignetteScaleY, vignetteScaleGeometricMean, this.vignetteStretch);\r\n effect.setFloat4(\"vignetteSettings1\", vignetteScaleX, vignetteScaleY, -vignetteScaleX * this.vignetteCentreX, -vignetteScaleY * this.vignetteCentreY);\r\n var vignettePower = -2.0 * this.vignetteWeight;\r\n effect.setFloat4(\"vignetteSettings2\", this.vignetteColor.r, this.vignetteColor.g, this.vignetteColor.b, vignettePower);\r\n }\r\n // Exposure\r\n effect.setFloat(\"exposureLinear\", this.exposure);\r\n // Contrast\r\n effect.setFloat(\"contrast\", this.contrast);\r\n // Color transform settings\r\n if (this.colorGradingTexture) {\r\n effect.setTexture(\"txColorTransform\", this.colorGradingTexture);\r\n var textureSize = this.colorGradingTexture.getSize().height;\r\n effect.setFloat4(\"colorTransformSettings\", (textureSize - 1) / textureSize, // textureScale\r\n 0.5 / textureSize, // textureOffset\r\n textureSize, // textureSize\r\n this.colorGradingTexture.level // weight\r\n );\r\n }\r\n };\r\n /**\r\n * Clones the current image processing instance.\r\n * @return The cloned image processing\r\n */\r\n ImageProcessingConfiguration.prototype.clone = function () {\r\n return SerializationHelper.Clone(function () { return new ImageProcessingConfiguration(); }, this);\r\n };\r\n /**\r\n * Serializes the current image processing instance to a json representation.\r\n * @return a JSON representation\r\n */\r\n ImageProcessingConfiguration.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses the image processing from a json representation.\r\n * @param source the JSON source to parse\r\n * @return The parsed image processing\r\n */\r\n ImageProcessingConfiguration.Parse = function (source) {\r\n return SerializationHelper.Parse(function () { return new ImageProcessingConfiguration(); }, source, null, null);\r\n };\r\n Object.defineProperty(ImageProcessingConfiguration, \"VIGNETTEMODE_MULTIPLY\", {\r\n /**\r\n * Used to apply the vignette as a mix with the pixel color.\r\n */\r\n get: function () {\r\n return this._VIGNETTEMODE_MULTIPLY;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageProcessingConfiguration, \"VIGNETTEMODE_OPAQUE\", {\r\n /**\r\n * Used to apply the vignette as a replacement of the pixel color.\r\n */\r\n get: function () {\r\n return this._VIGNETTEMODE_OPAQUE;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Default tone mapping applied in BabylonJS.\r\n */\r\n ImageProcessingConfiguration.TONEMAPPING_STANDARD = 0;\r\n /**\r\n * ACES Tone mapping (used by default in unreal and unity). This can help getting closer\r\n * to other engines rendering to increase portability.\r\n */\r\n ImageProcessingConfiguration.TONEMAPPING_ACES = 1;\r\n // Static constants associated to the image processing.\r\n ImageProcessingConfiguration._VIGNETTEMODE_MULTIPLY = 0;\r\n ImageProcessingConfiguration._VIGNETTEMODE_OPAQUE = 1;\r\n __decorate([\r\n serializeAsColorCurves()\r\n ], ImageProcessingConfiguration.prototype, \"colorCurves\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_colorCurvesEnabled\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"colorGradingTexture\")\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingTexture\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingEnabled\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingWithGreenDepth\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_colorGradingBGR\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_exposure\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_toneMappingEnabled\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_toneMappingType\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_contrast\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteStretch\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteCentreX\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteCentreY\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteWeight\", void 0);\r\n __decorate([\r\n serializeAsColor4()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteColor\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"vignetteCameraFov\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_vignetteBlendMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_vignetteEnabled\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_applyByPostProcess\", void 0);\r\n __decorate([\r\n serialize()\r\n ], ImageProcessingConfiguration.prototype, \"_isEnabled\", void 0);\r\n return ImageProcessingConfiguration;\r\n}());\r\nexport { ImageProcessingConfiguration };\r\n// References the dependencies.\r\nSerializationHelper._ImageProcessingConfigurationParser = ImageProcessingConfiguration.Parse;\r\n//# sourceMappingURL=imageProcessingConfiguration.js.map","import { __decorate } from \"tslib\";\r\nimport { Material } from \"./material\";\r\nimport { serialize, expandToProperty, serializeAsTexture, SerializationHelper } from '../Misc/decorators';\r\nimport { MaterialFlags } from './materialFlags';\r\nimport { MaterialHelper } from './materialHelper';\r\n/**\r\n * Define the code related to the detail map parameters of a material\r\n *\r\n * Inspired from:\r\n * Unity: https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@9.0/manual/Mask-Map-and-Detail-Map.html and https://docs.unity3d.com/Manual/StandardShaderMaterialParameterDetail.html\r\n * Unreal: https://docs.unrealengine.com/en-US/Engine/Rendering/Materials/HowTo/DetailTexturing/index.html\r\n * Cryengine: https://docs.cryengine.com/display/SDKDOC2/Detail+Maps\r\n */\r\nvar DetailMapConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new detail map\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function DetailMapConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._texture = null;\r\n /**\r\n * Defines how strongly the detail diffuse/albedo channel is blended with the regular diffuse/albedo texture\r\n * Bigger values mean stronger blending\r\n */\r\n this.diffuseBlendLevel = 1;\r\n /**\r\n * Defines how strongly the detail roughness channel is blended with the regular roughness value\r\n * Bigger values mean stronger blending. Only used with PBR materials\r\n */\r\n this.roughnessBlendLevel = 1;\r\n /**\r\n * Defines how strong the bump effect from the detail map is\r\n * Bigger values mean stronger effect\r\n */\r\n this.bumpLevel = 1;\r\n this._normalBlendMethod = Material.MATERIAL_NORMALBLENDMETHOD_WHITEOUT;\r\n this._isEnabled = false;\r\n /**\r\n * Enable or disable the detail map on this material\r\n */\r\n this.isEnabled = false;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n DetailMapConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Gets whether the submesh is ready to be used or not.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n DetailMapConfiguration.prototype.isReadyForSubMesh = function (defines, scene) {\r\n var engine = scene.getEngine();\r\n if (defines._areTexturesDirty && scene.texturesEnabled) {\r\n if (engine.getCaps().standardDerivatives && this._texture && MaterialFlags.DetailTextureEnabled) {\r\n // Detail texture cannot be not blocking.\r\n if (!this._texture.isReady()) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Update the defines for detail map usage\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n */\r\n DetailMapConfiguration.prototype.prepareDefines = function (defines, scene) {\r\n if (this._isEnabled) {\r\n defines.DETAIL_NORMALBLENDMETHOD = this._normalBlendMethod;\r\n var engine = scene.getEngine();\r\n if (defines._areTexturesDirty) {\r\n if (engine.getCaps().standardDerivatives && this._texture && MaterialFlags.DetailTextureEnabled && this._isEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._texture, defines, \"DETAIL\");\r\n defines.DETAIL_NORMALBLENDMETHOD = this._normalBlendMethod;\r\n }\r\n else {\r\n defines.DETAIL = false;\r\n }\r\n }\r\n }\r\n else {\r\n defines.DETAIL = false;\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param isFrozen defines whether the material is frozen or not.\r\n */\r\n DetailMapConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, isFrozen) {\r\n if (!this._isEnabled) {\r\n return;\r\n }\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (this._texture && MaterialFlags.DetailTextureEnabled) {\r\n uniformBuffer.updateFloat4(\"vDetailInfos\", this._texture.coordinatesIndex, this.diffuseBlendLevel, this.bumpLevel, this.roughnessBlendLevel);\r\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"detail\");\r\n }\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.DetailTextureEnabled) {\r\n uniformBuffer.setTexture(\"detailSampler\", this._texture);\r\n }\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n DetailMapConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n DetailMapConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n DetailMapConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n DetailMapConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n var _a;\r\n if (forceDisposeTextures) {\r\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.dispose();\r\n }\r\n };\r\n /**\r\n * Get the current class name useful for serialization or dynamic coding.\r\n * @returns \"DetailMap\"\r\n */\r\n DetailMapConfiguration.prototype.getClassName = function () {\r\n return \"DetailMap\";\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n DetailMapConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vDetailInfos\");\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n DetailMapConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"detailSampler\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n DetailMapConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vDetailInfos\", 4);\r\n uniformBuffer.addUniform(\"detailMatrix\", 16);\r\n };\r\n /**\r\n * Makes a duplicate of the current instance into another one.\r\n * @param detailMap define the instance where to copy the info\r\n */\r\n DetailMapConfiguration.prototype.copyTo = function (detailMap) {\r\n SerializationHelper.Clone(function () { return detailMap; }, this);\r\n };\r\n /**\r\n * Serializes this detail map instance\r\n * @returns - An object with the serialized instance.\r\n */\r\n DetailMapConfiguration.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses a detail map setting from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n DetailMapConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n SerializationHelper.Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n __decorate([\r\n serializeAsTexture(\"detailTexture\"),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], DetailMapConfiguration.prototype, \"texture\", void 0);\r\n __decorate([\r\n serialize()\r\n ], DetailMapConfiguration.prototype, \"diffuseBlendLevel\", void 0);\r\n __decorate([\r\n serialize()\r\n ], DetailMapConfiguration.prototype, \"roughnessBlendLevel\", void 0);\r\n __decorate([\r\n serialize()\r\n ], DetailMapConfiguration.prototype, \"bumpLevel\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], DetailMapConfiguration.prototype, \"normalBlendMethod\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], DetailMapConfiguration.prototype, \"isEnabled\", void 0);\r\n return DetailMapConfiguration;\r\n}());\r\nexport { DetailMapConfiguration };\r\n//# sourceMappingURL=material.detailMapConfiguration.js.map","import { __assign, __decorate } from \"tslib\";\r\nimport { serialize, SerializationHelper } from \"../Misc/decorators\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { SubMesh } from \"../Meshes/subMesh\";\r\nimport { UniformBuffer } from \"./uniformBuffer\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Plane } from '../Maths/math.plane';\r\n/**\r\n * Base class for the main features of a material in Babylon.js\r\n */\r\nvar Material = /** @class */ (function () {\r\n /**\r\n * Creates a material instance\r\n * @param name defines the name of the material\r\n * @param scene defines the scene to reference\r\n * @param doNotAdd specifies if the material should be added to the scene\r\n */\r\n function Material(name, scene, doNotAdd) {\r\n /**\r\n * Custom shadow depth material to use for shadow rendering instead of the in-built one\r\n */\r\n this.shadowDepthWrapper = null;\r\n /**\r\n * Gets or sets a boolean indicating that the material is allowed (if supported) to do shader hot swapping.\r\n * This means that the material can keep using a previous shader while a new one is being compiled.\r\n * This is mostly used when shader parallel compilation is supported (true by default)\r\n */\r\n this.allowShaderHotSwapping = true;\r\n /**\r\n * Gets or sets user defined metadata\r\n */\r\n this.metadata = null;\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n this.reservedDataStore = null;\r\n /**\r\n * Specifies if the ready state should be checked on each call\r\n */\r\n this.checkReadyOnEveryCall = false;\r\n /**\r\n * Specifies if the ready state should be checked once\r\n */\r\n this.checkReadyOnlyOnce = false;\r\n /**\r\n * The state of the material\r\n */\r\n this.state = \"\";\r\n /**\r\n * The alpha value of the material\r\n */\r\n this._alpha = 1.0;\r\n /**\r\n * Specifies if back face culling is enabled\r\n */\r\n this._backFaceCulling = true;\r\n /**\r\n * Callback triggered when the material is compiled\r\n */\r\n this.onCompiled = null;\r\n /**\r\n * Callback triggered when an error occurs\r\n */\r\n this.onError = null;\r\n /**\r\n * Callback triggered to get the render target textures\r\n */\r\n this.getRenderTargetTextures = null;\r\n /**\r\n * Specifies if the material should be serialized\r\n */\r\n this.doNotSerialize = false;\r\n /**\r\n * @hidden\r\n */\r\n this._storeEffectOnSubMeshes = false;\r\n /**\r\n * Stores the animations for the material\r\n */\r\n this.animations = null;\r\n /**\r\n * An event triggered when the material is disposed\r\n */\r\n this.onDisposeObservable = new Observable();\r\n /**\r\n * An observer which watches for dispose events\r\n */\r\n this._onDisposeObserver = null;\r\n this._onUnBindObservable = null;\r\n /**\r\n * An observer which watches for bind events\r\n */\r\n this._onBindObserver = null;\r\n /**\r\n * Stores the value of the alpha mode\r\n */\r\n this._alphaMode = 2;\r\n /**\r\n * Stores the state of the need depth pre-pass value\r\n */\r\n this._needDepthPrePass = false;\r\n /**\r\n * Specifies if depth writing should be disabled\r\n */\r\n this.disableDepthWrite = false;\r\n /**\r\n * Specifies if color writing should be disabled\r\n */\r\n this.disableColorWrite = false;\r\n /**\r\n * Specifies if depth writing should be forced\r\n */\r\n this.forceDepthWrite = false;\r\n /**\r\n * Specifies the depth function that should be used. 0 means the default engine function\r\n */\r\n this.depthFunction = 0;\r\n /**\r\n * Specifies if there should be a separate pass for culling\r\n */\r\n this.separateCullingPass = false;\r\n /**\r\n * Stores the state specifing if fog should be enabled\r\n */\r\n this._fogEnabled = true;\r\n /**\r\n * Stores the size of points\r\n */\r\n this.pointSize = 1.0;\r\n /**\r\n * Stores the z offset value\r\n */\r\n this.zOffset = 0;\r\n /**\r\n * @hidden\r\n * Stores the effects for the material\r\n */\r\n this._effect = null;\r\n /**\r\n * Specifies if uniform buffers should be used\r\n */\r\n this._useUBO = false;\r\n /**\r\n * Stores the fill mode state\r\n */\r\n this._fillMode = Material.TriangleFillMode;\r\n /**\r\n * Specifies if the depth write state should be cached\r\n */\r\n this._cachedDepthWriteState = false;\r\n /**\r\n * Specifies if the color write state should be cached\r\n */\r\n this._cachedColorWriteState = false;\r\n /**\r\n * Specifies if the depth function state should be cached\r\n */\r\n this._cachedDepthFunctionState = 0;\r\n /** @hidden */\r\n this._indexInSceneMaterialArray = -1;\r\n /** @hidden */\r\n this.meshMap = null;\r\n /**\r\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\r\n */\r\n this._forceAlphaTest = false;\r\n /**\r\n * The transparency mode of the material.\r\n */\r\n this._transparencyMode = null;\r\n this.name = name;\r\n var idSubscript = 1;\r\n this._scene = scene || EngineStore.LastCreatedScene;\r\n this.id = name || Tools.RandomId();\r\n while (this._scene.getMaterialByID(this.id)) {\r\n this.id = name + \" \" + idSubscript++;\r\n }\r\n this.uniqueId = this._scene.getUniqueId();\r\n if (this._scene.useRightHandedSystem) {\r\n this.sideOrientation = Material.ClockWiseSideOrientation;\r\n }\r\n else {\r\n this.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n }\r\n this._uniformBuffer = new UniformBuffer(this._scene.getEngine());\r\n this._useUBO = this.getScene().getEngine().supportsUniformBuffers;\r\n if (!doNotAdd) {\r\n this._scene.addMaterial(this);\r\n }\r\n if (this._scene.useMaterialMeshMap) {\r\n this.meshMap = {};\r\n }\r\n }\r\n Object.defineProperty(Material.prototype, \"canRenderToMRT\", {\r\n /**\r\n * If the material can be rendered to several textures with MRT extension\r\n */\r\n get: function () {\r\n // By default, shaders are not compatible with MRTs\r\n // Base classes should override that if their shader supports MRT\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"alpha\", {\r\n /**\r\n * Gets the alpha value of the material\r\n */\r\n get: function () {\r\n return this._alpha;\r\n },\r\n /**\r\n * Sets the alpha value of the material\r\n */\r\n set: function (value) {\r\n if (this._alpha === value) {\r\n return;\r\n }\r\n this._alpha = value;\r\n this.markAsDirty(Material.MiscDirtyFlag);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"backFaceCulling\", {\r\n /**\r\n * Gets the back-face culling state\r\n */\r\n get: function () {\r\n return this._backFaceCulling;\r\n },\r\n /**\r\n * Sets the back-face culling state\r\n */\r\n set: function (value) {\r\n if (this._backFaceCulling === value) {\r\n return;\r\n }\r\n this._backFaceCulling = value;\r\n this.markAsDirty(Material.TextureDirtyFlag);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"hasRenderTargetTextures\", {\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onDispose\", {\r\n /**\r\n * Called during a dispose event\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onBindObservable\", {\r\n /**\r\n * An event triggered when the material is bound\r\n */\r\n get: function () {\r\n if (!this._onBindObservable) {\r\n this._onBindObservable = new Observable();\r\n }\r\n return this._onBindObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onBind\", {\r\n /**\r\n * Called during a bind event\r\n */\r\n set: function (callback) {\r\n if (this._onBindObserver) {\r\n this.onBindObservable.remove(this._onBindObserver);\r\n }\r\n this._onBindObserver = this.onBindObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onUnBindObservable\", {\r\n /**\r\n * An event triggered when the material is unbound\r\n */\r\n get: function () {\r\n if (!this._onUnBindObservable) {\r\n this._onUnBindObservable = new Observable();\r\n }\r\n return this._onUnBindObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"onEffectCreatedObservable\", {\r\n /**\r\n * An event triggered when the effect is (re)created\r\n */\r\n get: function () {\r\n if (!this._onEffectCreatedObservable) {\r\n this._onEffectCreatedObservable = new Observable();\r\n }\r\n return this._onEffectCreatedObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"alphaMode\", {\r\n /**\r\n * Gets the value of the alpha mode\r\n */\r\n get: function () {\r\n return this._alphaMode;\r\n },\r\n /**\r\n * Sets the value of the alpha mode.\r\n *\r\n * | Value | Type | Description |\r\n * | --- | --- | --- |\r\n * | 0 | ALPHA_DISABLE | |\r\n * | 1 | ALPHA_ADD | |\r\n * | 2 | ALPHA_COMBINE | |\r\n * | 3 | ALPHA_SUBTRACT | |\r\n * | 4 | ALPHA_MULTIPLY | |\r\n * | 5 | ALPHA_MAXIMIZED | |\r\n * | 6 | ALPHA_ONEONE | |\r\n * | 7 | ALPHA_PREMULTIPLIED | |\r\n * | 8 | ALPHA_PREMULTIPLIED_PORTERDUFF | |\r\n * | 9 | ALPHA_INTERPOLATE | |\r\n * | 10 | ALPHA_SCREENMODE | |\r\n *\r\n */\r\n set: function (value) {\r\n if (this._alphaMode === value) {\r\n return;\r\n }\r\n this._alphaMode = value;\r\n this.markAsDirty(Material.TextureDirtyFlag);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"needDepthPrePass\", {\r\n /**\r\n * Gets the depth pre-pass value\r\n */\r\n get: function () {\r\n return this._needDepthPrePass;\r\n },\r\n /**\r\n * Sets the need depth pre-pass value\r\n */\r\n set: function (value) {\r\n if (this._needDepthPrePass === value) {\r\n return;\r\n }\r\n this._needDepthPrePass = value;\r\n if (this._needDepthPrePass) {\r\n this.checkReadyOnEveryCall = true;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"fogEnabled\", {\r\n /**\r\n * Gets the value of the fog enabled state\r\n */\r\n get: function () {\r\n return this._fogEnabled;\r\n },\r\n /**\r\n * Sets the state for enabling fog\r\n */\r\n set: function (value) {\r\n if (this._fogEnabled === value) {\r\n return;\r\n }\r\n this._fogEnabled = value;\r\n this.markAsDirty(Material.MiscDirtyFlag);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"wireframe\", {\r\n get: function () {\r\n switch (this._fillMode) {\r\n case Material.WireFrameFillMode:\r\n case Material.LineListDrawMode:\r\n case Material.LineLoopDrawMode:\r\n case Material.LineStripDrawMode:\r\n return true;\r\n }\r\n return this._scene.forceWireframe;\r\n },\r\n /**\r\n * Sets the state of wireframe mode\r\n */\r\n set: function (value) {\r\n this.fillMode = (value ? Material.WireFrameFillMode : Material.TriangleFillMode);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"pointsCloud\", {\r\n /**\r\n * Gets the value specifying if point clouds are enabled\r\n */\r\n get: function () {\r\n switch (this._fillMode) {\r\n case Material.PointFillMode:\r\n case Material.PointListDrawMode:\r\n return true;\r\n }\r\n return this._scene.forcePointsCloud;\r\n },\r\n /**\r\n * Sets the state of point cloud mode\r\n */\r\n set: function (value) {\r\n this.fillMode = (value ? Material.PointFillMode : Material.TriangleFillMode);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"fillMode\", {\r\n /**\r\n * Gets the material fill mode\r\n */\r\n get: function () {\r\n return this._fillMode;\r\n },\r\n /**\r\n * Sets the material fill mode\r\n */\r\n set: function (value) {\r\n if (this._fillMode === value) {\r\n return;\r\n }\r\n this._fillMode = value;\r\n this.markAsDirty(Material.MiscDirtyFlag);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a string representation of the current material\r\n * @param fullDetails defines a boolean indicating which levels of logging is desired\r\n * @returns a string with material information\r\n */\r\n Material.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n if (fullDetails) {\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Gets the class name of the material\r\n * @returns a string with the class name of the material\r\n */\r\n Material.prototype.getClassName = function () {\r\n return \"Material\";\r\n };\r\n Object.defineProperty(Material.prototype, \"isFrozen\", {\r\n /**\r\n * Specifies if updates for the material been locked\r\n */\r\n get: function () {\r\n return this.checkReadyOnlyOnce;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Locks updates for the material\r\n */\r\n Material.prototype.freeze = function () {\r\n this.markDirty();\r\n this.checkReadyOnlyOnce = true;\r\n };\r\n /**\r\n * Unlocks updates for the material\r\n */\r\n Material.prototype.unfreeze = function () {\r\n this.markDirty();\r\n this.checkReadyOnlyOnce = false;\r\n };\r\n /**\r\n * Specifies if the material is ready to be used\r\n * @param mesh defines the mesh to check\r\n * @param useInstances specifies if instances should be used\r\n * @returns a boolean indicating if the material is ready to be used\r\n */\r\n Material.prototype.isReady = function (mesh, useInstances) {\r\n return true;\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n Material.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n return false;\r\n };\r\n /**\r\n * Returns the material effect\r\n * @returns the effect associated with the material\r\n */\r\n Material.prototype.getEffect = function () {\r\n return this._effect;\r\n };\r\n /**\r\n * Returns the current scene\r\n * @returns a Scene\r\n */\r\n Material.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n Object.defineProperty(Material.prototype, \"transparencyMode\", {\r\n /**\r\n * Gets the current transparency mode.\r\n */\r\n get: function () {\r\n return this._transparencyMode;\r\n },\r\n /**\r\n * Sets the transparency mode of the material.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | OPAQUE | |\r\n * | 1 | ALPHATEST | |\r\n * | 2 | ALPHABLEND | |\r\n * | 3 | ALPHATESTANDBLEND | |\r\n *\r\n */\r\n set: function (value) {\r\n if (this._transparencyMode === value) {\r\n return;\r\n }\r\n this._transparencyMode = value;\r\n this._forceAlphaTest = (value === Material.MATERIAL_ALPHATESTANDBLEND);\r\n this._markAllSubMeshesAsTexturesAndMiscDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Material.prototype, \"_disableAlphaBlending\", {\r\n /**\r\n * Returns true if alpha blending should be disabled.\r\n */\r\n get: function () {\r\n return (this._transparencyMode === Material.MATERIAL_OPAQUE ||\r\n this._transparencyMode === Material.MATERIAL_ALPHATEST);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha blend mode.\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n Material.prototype.needAlphaBlending = function () {\r\n if (this._disableAlphaBlending) {\r\n return false;\r\n }\r\n return (this.alpha < 1.0);\r\n };\r\n /**\r\n * Specifies if the mesh will require alpha blending\r\n * @param mesh defines the mesh to check\r\n * @returns a boolean specifying if alpha blending is needed for the mesh\r\n */\r\n Material.prototype.needAlphaBlendingForMesh = function (mesh) {\r\n if (this._disableAlphaBlending && mesh.visibility >= 1.0) {\r\n return false;\r\n }\r\n return this.needAlphaBlending() || (mesh.visibility < 1.0) || mesh.hasVertexAlpha;\r\n };\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha test mode.\r\n * @returns a boolean specifying if an alpha test is needed.\r\n */\r\n Material.prototype.needAlphaTesting = function () {\r\n if (this._forceAlphaTest) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Specifies if material alpha testing should be turned on for the mesh\r\n * @param mesh defines the mesh to check\r\n */\r\n Material.prototype._shouldTurnAlphaTestOn = function (mesh) {\r\n return (!this.needAlphaBlendingForMesh(mesh) && this.needAlphaTesting());\r\n };\r\n /**\r\n * Gets the texture used for the alpha test\r\n * @returns the texture to use for alpha testing\r\n */\r\n Material.prototype.getAlphaTestTexture = function () {\r\n return null;\r\n };\r\n /**\r\n * Marks the material to indicate that it needs to be re-calculated\r\n */\r\n Material.prototype.markDirty = function () {\r\n var meshes = this.getScene().meshes;\r\n for (var _i = 0, meshes_1 = meshes; _i < meshes_1.length; _i++) {\r\n var mesh = meshes_1[_i];\r\n if (!mesh.subMeshes) {\r\n continue;\r\n }\r\n for (var _a = 0, _b = mesh.subMeshes; _a < _b.length; _a++) {\r\n var subMesh = _b[_a];\r\n if (subMesh.getMaterial() !== this) {\r\n continue;\r\n }\r\n if (!subMesh.effect) {\r\n continue;\r\n }\r\n subMesh.effect._wasPreviouslyReady = false;\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Material.prototype._preBind = function (effect, overrideOrientation) {\r\n if (overrideOrientation === void 0) { overrideOrientation = null; }\r\n var engine = this._scene.getEngine();\r\n var orientation = (overrideOrientation == null) ? this.sideOrientation : overrideOrientation;\r\n var reverse = orientation === Material.ClockWiseSideOrientation;\r\n engine.enableEffect(effect ? effect : this._effect);\r\n engine.setState(this.backFaceCulling, this.zOffset, false, reverse);\r\n return reverse;\r\n };\r\n /**\r\n * Binds the material to the mesh\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh to bind the material to\r\n */\r\n Material.prototype.bind = function (world, mesh) {\r\n };\r\n /**\r\n * Binds the submesh to the material\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n Material.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n };\r\n /**\r\n * Binds the world matrix to the material\r\n * @param world defines the world transformation matrix\r\n */\r\n Material.prototype.bindOnlyWorldMatrix = function (world) {\r\n };\r\n /**\r\n * Binds the scene's uniform buffer to the effect.\r\n * @param effect defines the effect to bind to the scene uniform buffer\r\n * @param sceneUbo defines the uniform buffer storing scene data\r\n */\r\n Material.prototype.bindSceneUniformBuffer = function (effect, sceneUbo) {\r\n sceneUbo.bindToEffect(effect, \"Scene\");\r\n };\r\n /**\r\n * Binds the view matrix to the effect\r\n * @param effect defines the effect to bind the view matrix to\r\n */\r\n Material.prototype.bindView = function (effect) {\r\n if (!this._useUBO) {\r\n effect.setMatrix(\"view\", this.getScene().getViewMatrix());\r\n }\r\n else {\r\n this.bindSceneUniformBuffer(effect, this.getScene().getSceneUniformBuffer());\r\n }\r\n };\r\n /**\r\n * Binds the view projection matrix to the effect\r\n * @param effect defines the effect to bind the view projection matrix to\r\n */\r\n Material.prototype.bindViewProjection = function (effect) {\r\n if (!this._useUBO) {\r\n effect.setMatrix(\"viewProjection\", this.getScene().getTransformMatrix());\r\n }\r\n else {\r\n this.bindSceneUniformBuffer(effect, this.getScene().getSceneUniformBuffer());\r\n }\r\n };\r\n /**\r\n * Processes to execute after binding the material to a mesh\r\n * @param mesh defines the rendered mesh\r\n */\r\n Material.prototype._afterBind = function (mesh) {\r\n this._scene._cachedMaterial = this;\r\n if (mesh) {\r\n this._scene._cachedVisibility = mesh.visibility;\r\n }\r\n else {\r\n this._scene._cachedVisibility = 1;\r\n }\r\n if (this._onBindObservable && mesh) {\r\n this._onBindObservable.notifyObservers(mesh);\r\n }\r\n if (this.disableDepthWrite) {\r\n var engine = this._scene.getEngine();\r\n this._cachedDepthWriteState = engine.getDepthWrite();\r\n engine.setDepthWrite(false);\r\n }\r\n if (this.disableColorWrite) {\r\n var engine = this._scene.getEngine();\r\n this._cachedColorWriteState = engine.getColorWrite();\r\n engine.setColorWrite(false);\r\n }\r\n if (this.depthFunction !== 0) {\r\n var engine = this._scene.getEngine();\r\n this._cachedDepthFunctionState = engine.getDepthFunction() || 0;\r\n engine.setDepthFunction(this.depthFunction);\r\n }\r\n };\r\n /**\r\n * Unbinds the material from the mesh\r\n */\r\n Material.prototype.unbind = function () {\r\n if (this._onUnBindObservable) {\r\n this._onUnBindObservable.notifyObservers(this);\r\n }\r\n if (this.depthFunction !== 0) {\r\n var engine = this._scene.getEngine();\r\n engine.setDepthFunction(this._cachedDepthFunctionState);\r\n }\r\n if (this.disableDepthWrite) {\r\n var engine = this._scene.getEngine();\r\n engine.setDepthWrite(this._cachedDepthWriteState);\r\n }\r\n if (this.disableColorWrite) {\r\n var engine = this._scene.getEngine();\r\n engine.setColorWrite(this._cachedColorWriteState);\r\n }\r\n };\r\n /**\r\n * Gets the active textures from the material\r\n * @returns an array of textures\r\n */\r\n Material.prototype.getActiveTextures = function () {\r\n return [];\r\n };\r\n /**\r\n * Specifies if the material uses a texture\r\n * @param texture defines the texture to check against the material\r\n * @returns a boolean specifying if the material uses the texture\r\n */\r\n Material.prototype.hasTexture = function (texture) {\r\n return false;\r\n };\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n Material.prototype.clone = function (name) {\r\n return null;\r\n };\r\n /**\r\n * Gets the meshes bound to the material\r\n * @returns an array of meshes bound to the material\r\n */\r\n Material.prototype.getBindedMeshes = function () {\r\n var _this = this;\r\n if (this.meshMap) {\r\n var result = new Array();\r\n for (var meshId in this.meshMap) {\r\n var mesh = this.meshMap[meshId];\r\n if (mesh) {\r\n result.push(mesh);\r\n }\r\n }\r\n return result;\r\n }\r\n else {\r\n var meshes = this._scene.meshes;\r\n return meshes.filter(function (mesh) { return mesh.material === _this; });\r\n }\r\n };\r\n /**\r\n * Force shader compilation\r\n * @param mesh defines the mesh associated with this material\r\n * @param onCompiled defines a function to execute once the material is compiled\r\n * @param options defines the options to configure the compilation\r\n * @param onError defines a function to execute if the material fails compiling\r\n */\r\n Material.prototype.forceCompilation = function (mesh, onCompiled, options, onError) {\r\n var _this = this;\r\n var localOptions = __assign({ clipPlane: false, useInstances: false }, options);\r\n var scene = this.getScene();\r\n var currentHotSwapingState = this.allowShaderHotSwapping;\r\n this.allowShaderHotSwapping = false; // Turned off to let us evaluate the real compilation state\r\n var checkReady = function () {\r\n if (!_this._scene || !_this._scene.getEngine()) {\r\n return;\r\n }\r\n var clipPlaneState = scene.clipPlane;\r\n if (localOptions.clipPlane) {\r\n scene.clipPlane = new Plane(0, 0, 0, 1);\r\n }\r\n if (_this._storeEffectOnSubMeshes) {\r\n var allDone = true, lastError = null;\r\n if (mesh.subMeshes) {\r\n var tempSubMesh = new SubMesh(0, 0, 0, 0, 0, mesh, undefined, false, false);\r\n if (tempSubMesh._materialDefines) {\r\n tempSubMesh._materialDefines._renderId = -1;\r\n }\r\n if (!_this.isReadyForSubMesh(mesh, tempSubMesh, localOptions.useInstances)) {\r\n if (tempSubMesh.effect && tempSubMesh.effect.getCompilationError() && tempSubMesh.effect.allFallbacksProcessed()) {\r\n lastError = tempSubMesh.effect.getCompilationError();\r\n }\r\n else {\r\n allDone = false;\r\n setTimeout(checkReady, 16);\r\n }\r\n }\r\n }\r\n if (allDone) {\r\n _this.allowShaderHotSwapping = currentHotSwapingState;\r\n if (lastError) {\r\n if (onError) {\r\n onError(lastError);\r\n }\r\n }\r\n if (onCompiled) {\r\n onCompiled(_this);\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.isReady()) {\r\n _this.allowShaderHotSwapping = currentHotSwapingState;\r\n if (onCompiled) {\r\n onCompiled(_this);\r\n }\r\n }\r\n else {\r\n setTimeout(checkReady, 16);\r\n }\r\n }\r\n if (localOptions.clipPlane) {\r\n scene.clipPlane = clipPlaneState;\r\n }\r\n };\r\n checkReady();\r\n };\r\n /**\r\n * Force shader compilation\r\n * @param mesh defines the mesh that will use this material\r\n * @param options defines additional options for compiling the shaders\r\n * @returns a promise that resolves when the compilation completes\r\n */\r\n Material.prototype.forceCompilationAsync = function (mesh, options) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this.forceCompilation(mesh, function () {\r\n resolve();\r\n }, options, function (reason) {\r\n reject(reason);\r\n });\r\n });\r\n };\r\n /**\r\n * Marks a define in the material to indicate that it needs to be re-computed\r\n * @param flag defines a flag used to determine which parts of the material have to be marked as dirty\r\n */\r\n Material.prototype.markAsDirty = function (flag) {\r\n if (this.getScene().blockMaterialDirtyMechanism) {\r\n return;\r\n }\r\n Material._DirtyCallbackArray.length = 0;\r\n if (flag & Material.TextureDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._TextureDirtyCallBack);\r\n }\r\n if (flag & Material.LightDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._LightsDirtyCallBack);\r\n }\r\n if (flag & Material.FresnelDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._FresnelDirtyCallBack);\r\n }\r\n if (flag & Material.AttributesDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._AttributeDirtyCallBack);\r\n }\r\n if (flag & Material.MiscDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._MiscDirtyCallBack);\r\n }\r\n if (flag & Material.PrePassDirtyFlag) {\r\n Material._DirtyCallbackArray.push(Material._PrePassDirtyCallBack);\r\n }\r\n if (Material._DirtyCallbackArray.length) {\r\n this._markAllSubMeshesAsDirty(Material._RunDirtyCallBacks);\r\n }\r\n this.getScene().resetCachedMaterial();\r\n };\r\n /**\r\n * Marks all submeshes of a material to indicate that their material defines need to be re-calculated\r\n * @param func defines a function which checks material defines against the submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsDirty = function (func) {\r\n if (this.getScene().blockMaterialDirtyMechanism) {\r\n return;\r\n }\r\n var meshes = this.getScene().meshes;\r\n for (var _i = 0, meshes_2 = meshes; _i < meshes_2.length; _i++) {\r\n var mesh = meshes_2[_i];\r\n if (!mesh.subMeshes) {\r\n continue;\r\n }\r\n for (var _a = 0, _b = mesh.subMeshes; _a < _b.length; _a++) {\r\n var subMesh = _b[_a];\r\n if (subMesh.getMaterial() !== this) {\r\n continue;\r\n }\r\n if (!subMesh._materialDefines) {\r\n continue;\r\n }\r\n func(subMesh._materialDefines);\r\n }\r\n }\r\n };\r\n /**\r\n * Indicates that the scene should check if the rendering now needs a prepass\r\n */\r\n Material.prototype._markScenePrePassDirty = function () {\r\n if (this.getScene().blockMaterialDirtyMechanism) {\r\n return;\r\n }\r\n var prePassRenderer = this.getScene().enablePrePassRenderer();\r\n if (prePassRenderer) {\r\n prePassRenderer.markAsDirty();\r\n }\r\n };\r\n /**\r\n * Indicates that we need to re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsAllDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._AllDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that image processing needs to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsImageProcessingDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._ImageProcessingDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that textures need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._TextureDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that fresnel needs to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsFresnelDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._FresnelDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that fresnel and misc need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsFresnelAndMiscDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._FresnelAndMiscDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that lights need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsLightsDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._LightsDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that attributes need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsAttributesDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._AttributeDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that misc needs to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsMiscDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._MiscDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that prepass needs to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsPrePassDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._MiscDirtyCallBack);\r\n };\r\n /**\r\n * Indicates that textures and misc need to be re-calculated for all submeshes\r\n */\r\n Material.prototype._markAllSubMeshesAsTexturesAndMiscDirty = function () {\r\n this._markAllSubMeshesAsDirty(Material._TextureAndMiscDirtyCallBack);\r\n };\r\n /**\r\n * Sets the required values to the prepass renderer.\r\n * @param prePassRenderer defines the prepass renderer to setup.\r\n * @returns true if the pre pass is needed.\r\n */\r\n Material.prototype.setPrePassRenderer = function (prePassRenderer) {\r\n // Do Nothing by default\r\n return false;\r\n };\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\r\n * @param notBoundToMesh specifies if the material that is being disposed is known to be not bound to any mesh\r\n */\r\n Material.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures, notBoundToMesh) {\r\n var scene = this.getScene();\r\n // Animations\r\n scene.stopAnimation(this);\r\n scene.freeProcessedMaterials();\r\n // Remove from scene\r\n scene.removeMaterial(this);\r\n if (notBoundToMesh !== true) {\r\n // Remove from meshes\r\n if (this.meshMap) {\r\n for (var meshId in this.meshMap) {\r\n var mesh = this.meshMap[meshId];\r\n if (mesh) {\r\n mesh.material = null; // will set the entry in the map to undefined\r\n this.releaseVertexArrayObject(mesh, forceDisposeEffect);\r\n }\r\n }\r\n }\r\n else {\r\n var meshes = scene.meshes;\r\n for (var _i = 0, meshes_3 = meshes; _i < meshes_3.length; _i++) {\r\n var mesh = meshes_3[_i];\r\n if (mesh.material === this && !mesh.sourceMesh) {\r\n mesh.material = null;\r\n this.releaseVertexArrayObject(mesh, forceDisposeEffect);\r\n }\r\n }\r\n }\r\n }\r\n this._uniformBuffer.dispose();\r\n // Shader are kept in cache for further use but we can get rid of this by using forceDisposeEffect\r\n if (forceDisposeEffect && this._effect) {\r\n if (!this._storeEffectOnSubMeshes) {\r\n this._effect.dispose();\r\n }\r\n this._effect = null;\r\n }\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n if (this._onBindObservable) {\r\n this._onBindObservable.clear();\r\n }\r\n if (this._onUnBindObservable) {\r\n this._onUnBindObservable.clear();\r\n }\r\n if (this._onEffectCreatedObservable) {\r\n this._onEffectCreatedObservable.clear();\r\n }\r\n };\r\n /** @hidden */\r\n Material.prototype.releaseVertexArrayObject = function (mesh, forceDisposeEffect) {\r\n if (mesh.geometry) {\r\n var geometry = (mesh.geometry);\r\n if (this._storeEffectOnSubMeshes) {\r\n for (var _i = 0, _a = mesh.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n geometry._releaseVertexArrayObject(subMesh._materialEffect);\r\n if (forceDisposeEffect && subMesh._materialEffect) {\r\n subMesh._materialEffect.dispose();\r\n }\r\n }\r\n }\r\n else {\r\n geometry._releaseVertexArrayObject(this._effect);\r\n }\r\n }\r\n };\r\n /**\r\n * Serializes this material\r\n * @returns the serialized material object\r\n */\r\n Material.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Creates a material from parsed material data\r\n * @param parsedMaterial defines parsed material data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures\r\n * @returns a new material\r\n */\r\n Material.Parse = function (parsedMaterial, scene, rootUrl) {\r\n if (!parsedMaterial.customType) {\r\n parsedMaterial.customType = \"BABYLON.StandardMaterial\";\r\n }\r\n else if (parsedMaterial.customType === \"BABYLON.PBRMaterial\" && parsedMaterial.overloadedAlbedo) {\r\n parsedMaterial.customType = \"BABYLON.LegacyPBRMaterial\";\r\n if (!BABYLON.LegacyPBRMaterial) {\r\n Logger.Error(\"Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library.\");\r\n return null;\r\n }\r\n }\r\n var materialType = Tools.Instantiate(parsedMaterial.customType);\r\n return materialType.Parse(parsedMaterial, scene, rootUrl);\r\n };\r\n /**\r\n * Returns the triangle fill mode\r\n */\r\n Material.TriangleFillMode = 0;\r\n /**\r\n * Returns the wireframe mode\r\n */\r\n Material.WireFrameFillMode = 1;\r\n /**\r\n * Returns the point fill mode\r\n */\r\n Material.PointFillMode = 2;\r\n /**\r\n * Returns the point list draw mode\r\n */\r\n Material.PointListDrawMode = 3;\r\n /**\r\n * Returns the line list draw mode\r\n */\r\n Material.LineListDrawMode = 4;\r\n /**\r\n * Returns the line loop draw mode\r\n */\r\n Material.LineLoopDrawMode = 5;\r\n /**\r\n * Returns the line strip draw mode\r\n */\r\n Material.LineStripDrawMode = 6;\r\n /**\r\n * Returns the triangle strip draw mode\r\n */\r\n Material.TriangleStripDrawMode = 7;\r\n /**\r\n * Returns the triangle fan draw mode\r\n */\r\n Material.TriangleFanDrawMode = 8;\r\n /**\r\n * Stores the clock-wise side orientation\r\n */\r\n Material.ClockWiseSideOrientation = 0;\r\n /**\r\n * Stores the counter clock-wise side orientation\r\n */\r\n Material.CounterClockWiseSideOrientation = 1;\r\n /**\r\n * The dirty texture flag value\r\n */\r\n Material.TextureDirtyFlag = 1;\r\n /**\r\n * The dirty light flag value\r\n */\r\n Material.LightDirtyFlag = 2;\r\n /**\r\n * The dirty fresnel flag value\r\n */\r\n Material.FresnelDirtyFlag = 4;\r\n /**\r\n * The dirty attribute flag value\r\n */\r\n Material.AttributesDirtyFlag = 8;\r\n /**\r\n * The dirty misc flag value\r\n */\r\n Material.MiscDirtyFlag = 16;\r\n /**\r\n * The dirty prepass flag value\r\n */\r\n Material.PrePassDirtyFlag = 32;\r\n /**\r\n * The all dirty flag value\r\n */\r\n Material.AllDirtyFlag = 63;\r\n /**\r\n * MaterialTransparencyMode: No transparency mode, Alpha channel is not use.\r\n */\r\n Material.MATERIAL_OPAQUE = 0;\r\n /**\r\n * MaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\r\n */\r\n Material.MATERIAL_ALPHATEST = 1;\r\n /**\r\n * MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n */\r\n Material.MATERIAL_ALPHABLEND = 2;\r\n /**\r\n * MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n * They are also discarded below the alpha cutoff threshold to improve performances.\r\n */\r\n Material.MATERIAL_ALPHATESTANDBLEND = 3;\r\n /**\r\n * The Whiteout method is used to blend normals.\r\n * Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/\r\n */\r\n Material.MATERIAL_NORMALBLENDMETHOD_WHITEOUT = 0;\r\n /**\r\n * The Reoriented Normal Mapping method is used to blend normals.\r\n * Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/\r\n */\r\n Material.MATERIAL_NORMALBLENDMETHOD_RNM = 1;\r\n Material._AllDirtyCallBack = function (defines) { return defines.markAllAsDirty(); };\r\n Material._ImageProcessingDirtyCallBack = function (defines) { return defines.markAsImageProcessingDirty(); };\r\n Material._TextureDirtyCallBack = function (defines) { return defines.markAsTexturesDirty(); };\r\n Material._FresnelDirtyCallBack = function (defines) { return defines.markAsFresnelDirty(); };\r\n Material._MiscDirtyCallBack = function (defines) { return defines.markAsMiscDirty(); };\r\n Material._PrePassDirtyCallBack = function (defines) { return defines.markAsPrePassDirty(); };\r\n Material._LightsDirtyCallBack = function (defines) { return defines.markAsLightDirty(); };\r\n Material._AttributeDirtyCallBack = function (defines) { return defines.markAsAttributesDirty(); };\r\n Material._FresnelAndMiscDirtyCallBack = function (defines) {\r\n Material._FresnelDirtyCallBack(defines);\r\n Material._MiscDirtyCallBack(defines);\r\n };\r\n Material._TextureAndMiscDirtyCallBack = function (defines) {\r\n Material._TextureDirtyCallBack(defines);\r\n Material._MiscDirtyCallBack(defines);\r\n };\r\n Material._DirtyCallbackArray = [];\r\n Material._RunDirtyCallBacks = function (defines) {\r\n for (var _i = 0, _a = Material._DirtyCallbackArray; _i < _a.length; _i++) {\r\n var cb = _a[_i];\r\n cb(defines);\r\n }\r\n };\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"id\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"uniqueId\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"name\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"checkReadyOnEveryCall\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"checkReadyOnlyOnce\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"state\", void 0);\r\n __decorate([\r\n serialize(\"alpha\")\r\n ], Material.prototype, \"_alpha\", void 0);\r\n __decorate([\r\n serialize(\"backFaceCulling\")\r\n ], Material.prototype, \"_backFaceCulling\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"sideOrientation\", void 0);\r\n __decorate([\r\n serialize(\"alphaMode\")\r\n ], Material.prototype, \"_alphaMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"_needDepthPrePass\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"disableDepthWrite\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"disableColorWrite\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"forceDepthWrite\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"depthFunction\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"separateCullingPass\", void 0);\r\n __decorate([\r\n serialize(\"fogEnabled\")\r\n ], Material.prototype, \"_fogEnabled\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"pointSize\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"zOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"pointsCloud\", null);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"fillMode\", null);\r\n __decorate([\r\n serialize()\r\n ], Material.prototype, \"transparencyMode\", null);\r\n return Material;\r\n}());\r\nexport { Material };\r\n//# sourceMappingURL=material.js.map","/**\r\n * Manages the defines for the Material\r\n */\r\nvar MaterialDefines = /** @class */ (function () {\r\n function MaterialDefines() {\r\n this._isDirty = true;\r\n /** @hidden */\r\n this._areLightsDirty = true;\r\n /** @hidden */\r\n this._areLightsDisposed = false;\r\n /** @hidden */\r\n this._areAttributesDirty = true;\r\n /** @hidden */\r\n this._areTexturesDirty = true;\r\n /** @hidden */\r\n this._areFresnelDirty = true;\r\n /** @hidden */\r\n this._areMiscDirty = true;\r\n /** @hidden */\r\n this._arePrePassDirty = true;\r\n /** @hidden */\r\n this._areImageProcessingDirty = true;\r\n /** @hidden */\r\n this._normals = false;\r\n /** @hidden */\r\n this._uvs = false;\r\n /** @hidden */\r\n this._needNormals = false;\r\n /** @hidden */\r\n this._needUVs = false;\r\n }\r\n Object.defineProperty(MaterialDefines.prototype, \"isDirty\", {\r\n /**\r\n * Specifies if the material needs to be re-calculated\r\n */\r\n get: function () {\r\n return this._isDirty;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Marks the material to indicate that it has been re-calculated\r\n */\r\n MaterialDefines.prototype.markAsProcessed = function () {\r\n this._isDirty = false;\r\n this._areAttributesDirty = false;\r\n this._areTexturesDirty = false;\r\n this._areFresnelDirty = false;\r\n this._areLightsDirty = false;\r\n this._areLightsDisposed = false;\r\n this._areMiscDirty = false;\r\n this._arePrePassDirty = false;\r\n this._areImageProcessingDirty = false;\r\n };\r\n /**\r\n * Marks the material to indicate that it needs to be re-calculated\r\n */\r\n MaterialDefines.prototype.markAsUnprocessed = function () {\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the material to indicate all of its defines need to be re-calculated\r\n */\r\n MaterialDefines.prototype.markAllAsDirty = function () {\r\n this._areTexturesDirty = true;\r\n this._areAttributesDirty = true;\r\n this._areLightsDirty = true;\r\n this._areFresnelDirty = true;\r\n this._areMiscDirty = true;\r\n this._areImageProcessingDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the material to indicate that image processing needs to be re-calculated\r\n */\r\n MaterialDefines.prototype.markAsImageProcessingDirty = function () {\r\n this._areImageProcessingDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the material to indicate the lights need to be re-calculated\r\n * @param disposed Defines whether the light is dirty due to dispose or not\r\n */\r\n MaterialDefines.prototype.markAsLightDirty = function (disposed) {\r\n if (disposed === void 0) { disposed = false; }\r\n this._areLightsDirty = true;\r\n this._areLightsDisposed = this._areLightsDisposed || disposed;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the attribute state as changed\r\n */\r\n MaterialDefines.prototype.markAsAttributesDirty = function () {\r\n this._areAttributesDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the texture state as changed\r\n */\r\n MaterialDefines.prototype.markAsTexturesDirty = function () {\r\n this._areTexturesDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the fresnel state as changed\r\n */\r\n MaterialDefines.prototype.markAsFresnelDirty = function () {\r\n this._areFresnelDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the misc state as changed\r\n */\r\n MaterialDefines.prototype.markAsMiscDirty = function () {\r\n this._areMiscDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Marks the prepass state as changed\r\n */\r\n MaterialDefines.prototype.markAsPrePassDirty = function () {\r\n this._arePrePassDirty = true;\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Rebuilds the material defines\r\n */\r\n MaterialDefines.prototype.rebuild = function () {\r\n this._keys = [];\r\n for (var _i = 0, _a = Object.keys(this); _i < _a.length; _i++) {\r\n var key = _a[_i];\r\n if (key[0] === \"_\") {\r\n continue;\r\n }\r\n this._keys.push(key);\r\n }\r\n };\r\n /**\r\n * Specifies if two material defines are equal\r\n * @param other - A material define instance to compare to\r\n * @returns - Boolean indicating if the material defines are equal (true) or not (false)\r\n */\r\n MaterialDefines.prototype.isEqual = function (other) {\r\n if (this._keys.length !== other._keys.length) {\r\n return false;\r\n }\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n if (this[prop] !== other[prop]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Clones this instance's defines to another instance\r\n * @param other - material defines to clone values to\r\n */\r\n MaterialDefines.prototype.cloneTo = function (other) {\r\n if (this._keys.length !== other._keys.length) {\r\n other._keys = this._keys.slice(0);\r\n }\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n other[prop] = this[prop];\r\n }\r\n };\r\n /**\r\n * Resets the material define values\r\n */\r\n MaterialDefines.prototype.reset = function () {\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n var type = typeof this[prop];\r\n switch (type) {\r\n case \"number\":\r\n this[prop] = 0;\r\n break;\r\n case \"string\":\r\n this[prop] = \"\";\r\n break;\r\n default:\r\n this[prop] = false;\r\n break;\r\n }\r\n }\r\n };\r\n /**\r\n * Converts the material define values to a string\r\n * @returns - String of material define information\r\n */\r\n MaterialDefines.prototype.toString = function () {\r\n var result = \"\";\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var prop = this._keys[index];\r\n var value = this[prop];\r\n var type = typeof value;\r\n switch (type) {\r\n case \"number\":\r\n case \"string\":\r\n result += \"#define \" + prop + \" \" + value + \"\\n\";\r\n break;\r\n default:\r\n if (value) {\r\n result += \"#define \" + prop + \"\\n\";\r\n }\r\n break;\r\n }\r\n }\r\n return result;\r\n };\r\n return MaterialDefines;\r\n}());\r\nexport { MaterialDefines };\r\n//# sourceMappingURL=materialDefines.js.map","import { Engine } from \"../Engines/engine\";\r\n/**\r\n * This groups all the flags used to control the materials channel.\r\n */\r\nvar MaterialFlags = /** @class */ (function () {\r\n function MaterialFlags() {\r\n }\r\n Object.defineProperty(MaterialFlags, \"DiffuseTextureEnabled\", {\r\n /**\r\n * Are diffuse textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._DiffuseTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._DiffuseTextureEnabled === value) {\r\n return;\r\n }\r\n this._DiffuseTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"DetailTextureEnabled\", {\r\n /**\r\n * Are detail textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._DetailTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._DetailTextureEnabled === value) {\r\n return;\r\n }\r\n this._DetailTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"AmbientTextureEnabled\", {\r\n /**\r\n * Are ambient textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._AmbientTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._AmbientTextureEnabled === value) {\r\n return;\r\n }\r\n this._AmbientTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"OpacityTextureEnabled\", {\r\n /**\r\n * Are opacity textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._OpacityTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._OpacityTextureEnabled === value) {\r\n return;\r\n }\r\n this._OpacityTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ReflectionTextureEnabled\", {\r\n /**\r\n * Are reflection textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ReflectionTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ReflectionTextureEnabled === value) {\r\n return;\r\n }\r\n this._ReflectionTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"EmissiveTextureEnabled\", {\r\n /**\r\n * Are emissive textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._EmissiveTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._EmissiveTextureEnabled === value) {\r\n return;\r\n }\r\n this._EmissiveTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"SpecularTextureEnabled\", {\r\n /**\r\n * Are specular textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._SpecularTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._SpecularTextureEnabled === value) {\r\n return;\r\n }\r\n this._SpecularTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"BumpTextureEnabled\", {\r\n /**\r\n * Are bump textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._BumpTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._BumpTextureEnabled === value) {\r\n return;\r\n }\r\n this._BumpTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"LightmapTextureEnabled\", {\r\n /**\r\n * Are lightmap textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._LightmapTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._LightmapTextureEnabled === value) {\r\n return;\r\n }\r\n this._LightmapTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"RefractionTextureEnabled\", {\r\n /**\r\n * Are refraction textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._RefractionTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._RefractionTextureEnabled === value) {\r\n return;\r\n }\r\n this._RefractionTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ColorGradingTextureEnabled\", {\r\n /**\r\n * Are color grading textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ColorGradingTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ColorGradingTextureEnabled === value) {\r\n return;\r\n }\r\n this._ColorGradingTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"FresnelEnabled\", {\r\n /**\r\n * Are fresnels enabled in the application.\r\n */\r\n get: function () {\r\n return this._FresnelEnabled;\r\n },\r\n set: function (value) {\r\n if (this._FresnelEnabled === value) {\r\n return;\r\n }\r\n this._FresnelEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(4);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ClearCoatTextureEnabled\", {\r\n /**\r\n * Are clear coat textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ClearCoatTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ClearCoatTextureEnabled === value) {\r\n return;\r\n }\r\n this._ClearCoatTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ClearCoatBumpTextureEnabled\", {\r\n /**\r\n * Are clear coat bump textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ClearCoatBumpTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ClearCoatBumpTextureEnabled === value) {\r\n return;\r\n }\r\n this._ClearCoatBumpTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ClearCoatTintTextureEnabled\", {\r\n /**\r\n * Are clear coat tint textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ClearCoatTintTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ClearCoatTintTextureEnabled === value) {\r\n return;\r\n }\r\n this._ClearCoatTintTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"SheenTextureEnabled\", {\r\n /**\r\n * Are sheen textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._SheenTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._SheenTextureEnabled === value) {\r\n return;\r\n }\r\n this._SheenTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"AnisotropicTextureEnabled\", {\r\n /**\r\n * Are anisotropic textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._AnisotropicTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._AnisotropicTextureEnabled === value) {\r\n return;\r\n }\r\n this._AnisotropicTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MaterialFlags, \"ThicknessTextureEnabled\", {\r\n /**\r\n * Are thickness textures enabled in the application.\r\n */\r\n get: function () {\r\n return this._ThicknessTextureEnabled;\r\n },\r\n set: function (value) {\r\n if (this._ThicknessTextureEnabled === value) {\r\n return;\r\n }\r\n this._ThicknessTextureEnabled = value;\r\n Engine.MarkAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Flags used to enable or disable a type of texture for all Standard Materials\r\n MaterialFlags._DiffuseTextureEnabled = true;\r\n MaterialFlags._DetailTextureEnabled = true;\r\n MaterialFlags._AmbientTextureEnabled = true;\r\n MaterialFlags._OpacityTextureEnabled = true;\r\n MaterialFlags._ReflectionTextureEnabled = true;\r\n MaterialFlags._EmissiveTextureEnabled = true;\r\n MaterialFlags._SpecularTextureEnabled = true;\r\n MaterialFlags._BumpTextureEnabled = true;\r\n MaterialFlags._LightmapTextureEnabled = true;\r\n MaterialFlags._RefractionTextureEnabled = true;\r\n MaterialFlags._ColorGradingTextureEnabled = true;\r\n MaterialFlags._FresnelEnabled = true;\r\n MaterialFlags._ClearCoatTextureEnabled = true;\r\n MaterialFlags._ClearCoatBumpTextureEnabled = true;\r\n MaterialFlags._ClearCoatTintTextureEnabled = true;\r\n MaterialFlags._SheenTextureEnabled = true;\r\n MaterialFlags._AnisotropicTextureEnabled = true;\r\n MaterialFlags._ThicknessTextureEnabled = true;\r\n return MaterialFlags;\r\n}());\r\nexport { MaterialFlags };\r\n//# sourceMappingURL=materialFlags.js.map","/**\r\n * \"Static Class\" containing a few commonly used helper while dealing with material for rendering purpose.\r\n *\r\n * It is complementary with MaterialHelper but provides completely independent functions (for tree shaking sake)\r\n *\r\n * This works by convention in BabylonJS but is meant to be use only with shader following the in place naming rules and conventions.\r\n */\r\nvar ThinMaterialHelper = /** @class */ (function () {\r\n function ThinMaterialHelper() {\r\n }\r\n /**\r\n * Binds the clip plane information from the holder to the effect.\r\n * @param effect The effect we are binding the data to\r\n * @param holder The entity containing the clip plane information\r\n */\r\n ThinMaterialHelper.BindClipPlane = function (effect, holder) {\r\n if (holder.clipPlane) {\r\n var clipPlane = holder.clipPlane;\r\n effect.setFloat4(\"vClipPlane\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (holder.clipPlane2) {\r\n var clipPlane = holder.clipPlane2;\r\n effect.setFloat4(\"vClipPlane2\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (holder.clipPlane3) {\r\n var clipPlane = holder.clipPlane3;\r\n effect.setFloat4(\"vClipPlane3\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (holder.clipPlane4) {\r\n var clipPlane = holder.clipPlane4;\r\n effect.setFloat4(\"vClipPlane4\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (holder.clipPlane5) {\r\n var clipPlane = holder.clipPlane5;\r\n effect.setFloat4(\"vClipPlane5\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n if (holder.clipPlane6) {\r\n var clipPlane = holder.clipPlane6;\r\n effect.setFloat4(\"vClipPlane6\", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n };\r\n return ThinMaterialHelper;\r\n}());\r\nexport { ThinMaterialHelper };\r\n//# sourceMappingURL=thinMaterialHelper.js.map","import { Logger } from \"../Misc/logger\";\r\nimport { Scene } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { Light } from \"../Lights/light\";\r\nimport { Color3 } from '../Maths/math.color';\r\nimport { ThinMaterialHelper } from './thinMaterialHelper';\r\n/**\r\n * \"Static Class\" containing the most commonly used helper while dealing with material for rendering purpose.\r\n *\r\n * It contains the basic tools to help defining defines, binding uniform for the common part of the materials.\r\n *\r\n * This works by convention in BabylonJS but is meant to be use only with shader following the in place naming rules and conventions.\r\n */\r\nvar MaterialHelper = /** @class */ (function () {\r\n function MaterialHelper() {\r\n }\r\n /**\r\n * Bind the current view position to an effect.\r\n * @param effect The effect to be bound\r\n * @param scene The scene the eyes position is used from\r\n * @param variableName name of the shader variable that will hold the eye position\r\n */\r\n MaterialHelper.BindEyePosition = function (effect, scene, variableName) {\r\n if (variableName === void 0) { variableName = \"vEyePosition\"; }\r\n if (scene._forcedViewPosition) {\r\n effect.setVector3(variableName, scene._forcedViewPosition);\r\n return;\r\n }\r\n var globalPosition = scene.activeCamera.globalPosition;\r\n if (!globalPosition) {\r\n // Use WebVRFreecamera's device position as global position is not it's actual position in babylon space\r\n globalPosition = scene.activeCamera.devicePosition;\r\n }\r\n effect.setVector3(variableName, scene._mirroredCameraPosition ? scene._mirroredCameraPosition : globalPosition);\r\n };\r\n /**\r\n * Helps preparing the defines values about the UVs in used in the effect.\r\n * UVs are shared as much as we can accross channels in the shaders.\r\n * @param texture The texture we are preparing the UVs for\r\n * @param defines The defines to update\r\n * @param key The channel key \"diffuse\", \"specular\"... used in the shader\r\n */\r\n MaterialHelper.PrepareDefinesForMergedUV = function (texture, defines, key) {\r\n defines._needUVs = true;\r\n defines[key] = true;\r\n if (texture.getTextureMatrix().isIdentityAs3x2()) {\r\n defines[key + \"DIRECTUV\"] = texture.coordinatesIndex + 1;\r\n if (texture.coordinatesIndex === 0) {\r\n defines[\"MAINUV1\"] = true;\r\n }\r\n else {\r\n defines[\"MAINUV2\"] = true;\r\n }\r\n }\r\n else {\r\n defines[key + \"DIRECTUV\"] = 0;\r\n }\r\n };\r\n /**\r\n * Binds a texture matrix value to its corrsponding uniform\r\n * @param texture The texture to bind the matrix for\r\n * @param uniformBuffer The uniform buffer receivin the data\r\n * @param key The channel key \"diffuse\", \"specular\"... used in the shader\r\n */\r\n MaterialHelper.BindTextureMatrix = function (texture, uniformBuffer, key) {\r\n var matrix = texture.getTextureMatrix();\r\n uniformBuffer.updateMatrix(key + \"Matrix\", matrix);\r\n };\r\n /**\r\n * Gets the current status of the fog (should it be enabled?)\r\n * @param mesh defines the mesh to evaluate for fog support\r\n * @param scene defines the hosting scene\r\n * @returns true if fog must be enabled\r\n */\r\n MaterialHelper.GetFogState = function (mesh, scene) {\r\n return (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE);\r\n };\r\n /**\r\n * Helper used to prepare the list of defines associated with misc. values for shader compilation\r\n * @param mesh defines the current mesh\r\n * @param scene defines the current scene\r\n * @param useLogarithmicDepth defines if logarithmic depth has to be turned on\r\n * @param pointsCloud defines if point cloud rendering has to be turned on\r\n * @param fogEnabled defines if fog has to be turned on\r\n * @param alphaTest defines if alpha testing has to be turned on\r\n * @param defines defines the current list of defines\r\n */\r\n MaterialHelper.PrepareDefinesForMisc = function (mesh, scene, useLogarithmicDepth, pointsCloud, fogEnabled, alphaTest, defines) {\r\n if (defines._areMiscDirty) {\r\n defines[\"LOGARITHMICDEPTH\"] = useLogarithmicDepth;\r\n defines[\"POINTSIZE\"] = pointsCloud;\r\n defines[\"FOG\"] = fogEnabled && this.GetFogState(mesh, scene);\r\n defines[\"NONUNIFORMSCALING\"] = mesh.nonUniformScaling;\r\n defines[\"ALPHATEST\"] = alphaTest;\r\n }\r\n };\r\n /**\r\n * Helper used to prepare the list of defines associated with frame values for shader compilation\r\n * @param scene defines the current scene\r\n * @param engine defines the current engine\r\n * @param defines specifies the list of active defines\r\n * @param useInstances defines if instances have to be turned on\r\n * @param useClipPlane defines if clip plane have to be turned on\r\n * @param useInstances defines if instances have to be turned on\r\n * @param useThinInstances defines if thin instances have to be turned on\r\n */\r\n MaterialHelper.PrepareDefinesForFrameBoundValues = function (scene, engine, defines, useInstances, useClipPlane, useThinInstances) {\r\n if (useClipPlane === void 0) { useClipPlane = null; }\r\n if (useThinInstances === void 0) { useThinInstances = false; }\r\n var changed = false;\r\n var useClipPlane1 = false;\r\n var useClipPlane2 = false;\r\n var useClipPlane3 = false;\r\n var useClipPlane4 = false;\r\n var useClipPlane5 = false;\r\n var useClipPlane6 = false;\r\n useClipPlane1 = useClipPlane == null ? (scene.clipPlane !== undefined && scene.clipPlane !== null) : useClipPlane;\r\n useClipPlane2 = useClipPlane == null ? (scene.clipPlane2 !== undefined && scene.clipPlane2 !== null) : useClipPlane;\r\n useClipPlane3 = useClipPlane == null ? (scene.clipPlane3 !== undefined && scene.clipPlane3 !== null) : useClipPlane;\r\n useClipPlane4 = useClipPlane == null ? (scene.clipPlane4 !== undefined && scene.clipPlane4 !== null) : useClipPlane;\r\n useClipPlane5 = useClipPlane == null ? (scene.clipPlane5 !== undefined && scene.clipPlane5 !== null) : useClipPlane;\r\n useClipPlane6 = useClipPlane == null ? (scene.clipPlane6 !== undefined && scene.clipPlane6 !== null) : useClipPlane;\r\n if (defines[\"CLIPPLANE\"] !== useClipPlane1) {\r\n defines[\"CLIPPLANE\"] = useClipPlane1;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE2\"] !== useClipPlane2) {\r\n defines[\"CLIPPLANE2\"] = useClipPlane2;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE3\"] !== useClipPlane3) {\r\n defines[\"CLIPPLANE3\"] = useClipPlane3;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE4\"] !== useClipPlane4) {\r\n defines[\"CLIPPLANE4\"] = useClipPlane4;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE5\"] !== useClipPlane5) {\r\n defines[\"CLIPPLANE5\"] = useClipPlane5;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE6\"] !== useClipPlane6) {\r\n defines[\"CLIPPLANE6\"] = useClipPlane6;\r\n changed = true;\r\n }\r\n if (defines[\"DEPTHPREPASS\"] !== !engine.getColorWrite()) {\r\n defines[\"DEPTHPREPASS\"] = !defines[\"DEPTHPREPASS\"];\r\n changed = true;\r\n }\r\n if (defines[\"INSTANCES\"] !== useInstances) {\r\n defines[\"INSTANCES\"] = useInstances;\r\n changed = true;\r\n }\r\n if (defines[\"THIN_INSTANCES\"] !== useThinInstances) {\r\n defines[\"THIN_INSTANCES\"] = useThinInstances;\r\n changed = true;\r\n }\r\n if (changed) {\r\n defines.markAsUnprocessed();\r\n }\r\n };\r\n /**\r\n * Prepares the defines for bones\r\n * @param mesh The mesh containing the geometry data we will draw\r\n * @param defines The defines to update\r\n */\r\n MaterialHelper.PrepareDefinesForBones = function (mesh, defines) {\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n defines[\"NUM_BONE_INFLUENCERS\"] = mesh.numBoneInfluencers;\r\n var materialSupportsBoneTexture = defines[\"BONETEXTURE\"] !== undefined;\r\n if (mesh.skeleton.isUsingTextureForMatrices && materialSupportsBoneTexture) {\r\n defines[\"BONETEXTURE\"] = true;\r\n }\r\n else {\r\n defines[\"BonesPerMesh\"] = (mesh.skeleton.bones.length + 1);\r\n defines[\"BONETEXTURE\"] = materialSupportsBoneTexture ? false : undefined;\r\n var prePassRenderer = mesh.getScene().prePassRenderer;\r\n if (prePassRenderer && prePassRenderer.enabled) {\r\n var nonExcluded = prePassRenderer.excludedSkinnedMesh.indexOf(mesh) === -1;\r\n defines[\"BONES_VELOCITY_ENABLED\"] = nonExcluded;\r\n }\r\n }\r\n }\r\n else {\r\n defines[\"NUM_BONE_INFLUENCERS\"] = 0;\r\n defines[\"BonesPerMesh\"] = 0;\r\n }\r\n };\r\n /**\r\n * Prepares the defines for morph targets\r\n * @param mesh The mesh containing the geometry data we will draw\r\n * @param defines The defines to update\r\n */\r\n MaterialHelper.PrepareDefinesForMorphTargets = function (mesh, defines) {\r\n var manager = mesh.morphTargetManager;\r\n if (manager) {\r\n defines[\"MORPHTARGETS_UV\"] = manager.supportsUVs && defines[\"UV1\"];\r\n defines[\"MORPHTARGETS_TANGENT\"] = manager.supportsTangents && defines[\"TANGENT\"];\r\n defines[\"MORPHTARGETS_NORMAL\"] = manager.supportsNormals && defines[\"NORMAL\"];\r\n defines[\"MORPHTARGETS\"] = (manager.numInfluencers > 0);\r\n defines[\"NUM_MORPH_INFLUENCERS\"] = manager.numInfluencers;\r\n }\r\n else {\r\n defines[\"MORPHTARGETS_UV\"] = false;\r\n defines[\"MORPHTARGETS_TANGENT\"] = false;\r\n defines[\"MORPHTARGETS_NORMAL\"] = false;\r\n defines[\"MORPHTARGETS\"] = false;\r\n defines[\"NUM_MORPH_INFLUENCERS\"] = 0;\r\n }\r\n };\r\n /**\r\n * Prepares the defines used in the shader depending on the attributes data available in the mesh\r\n * @param mesh The mesh containing the geometry data we will draw\r\n * @param defines The defines to update\r\n * @param useVertexColor Precise whether vertex colors should be used or not (override mesh info)\r\n * @param useBones Precise whether bones should be used or not (override mesh info)\r\n * @param useMorphTargets Precise whether morph targets should be used or not (override mesh info)\r\n * @param useVertexAlpha Precise whether vertex alpha should be used or not (override mesh info)\r\n * @returns false if defines are considered not dirty and have not been checked\r\n */\r\n MaterialHelper.PrepareDefinesForAttributes = function (mesh, defines, useVertexColor, useBones, useMorphTargets, useVertexAlpha) {\r\n if (useMorphTargets === void 0) { useMorphTargets = false; }\r\n if (useVertexAlpha === void 0) { useVertexAlpha = true; }\r\n if (!defines._areAttributesDirty && defines._needNormals === defines._normals && defines._needUVs === defines._uvs) {\r\n return false;\r\n }\r\n defines._normals = defines._needNormals;\r\n defines._uvs = defines._needUVs;\r\n defines[\"NORMAL\"] = (defines._needNormals && mesh.isVerticesDataPresent(VertexBuffer.NormalKind));\r\n if (defines._needNormals && mesh.isVerticesDataPresent(VertexBuffer.TangentKind)) {\r\n defines[\"TANGENT\"] = true;\r\n }\r\n if (defines._needUVs) {\r\n defines[\"UV1\"] = mesh.isVerticesDataPresent(VertexBuffer.UVKind);\r\n defines[\"UV2\"] = mesh.isVerticesDataPresent(VertexBuffer.UV2Kind);\r\n }\r\n else {\r\n defines[\"UV1\"] = false;\r\n defines[\"UV2\"] = false;\r\n }\r\n if (useVertexColor) {\r\n var hasVertexColors = mesh.useVertexColors && mesh.isVerticesDataPresent(VertexBuffer.ColorKind);\r\n defines[\"VERTEXCOLOR\"] = hasVertexColors;\r\n defines[\"VERTEXALPHA\"] = mesh.hasVertexAlpha && hasVertexColors && useVertexAlpha;\r\n }\r\n if (useBones) {\r\n this.PrepareDefinesForBones(mesh, defines);\r\n }\r\n if (useMorphTargets) {\r\n this.PrepareDefinesForMorphTargets(mesh, defines);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Prepares the defines related to multiview\r\n * @param scene The scene we are intending to draw\r\n * @param defines The defines to update\r\n */\r\n MaterialHelper.PrepareDefinesForMultiview = function (scene, defines) {\r\n if (scene.activeCamera) {\r\n var previousMultiview = defines.MULTIVIEW;\r\n defines.MULTIVIEW = (scene.activeCamera.outputRenderTarget !== null && scene.activeCamera.outputRenderTarget.getViewCount() > 1);\r\n if (defines.MULTIVIEW != previousMultiview) {\r\n defines.markAsUnprocessed();\r\n }\r\n }\r\n };\r\n /**\r\n * Prepares the defines related to the prepass\r\n * @param scene The scene we are intending to draw\r\n * @param defines The defines to update\r\n * @param canRenderToMRT Indicates if this material renders to several textures in the prepass\r\n */\r\n MaterialHelper.PrepareDefinesForPrePass = function (scene, defines, canRenderToMRT) {\r\n var previousPrePass = defines.PREPASS;\r\n if (!defines._arePrePassDirty) {\r\n return;\r\n }\r\n var texturesList = [\r\n {\r\n type: 1,\r\n define: \"PREPASS_POSITION\",\r\n index: \"PREPASS_POSITION_INDEX\",\r\n },\r\n {\r\n type: 2,\r\n define: \"PREPASS_VELOCITY\",\r\n index: \"PREPASS_VELOCITY_INDEX\",\r\n },\r\n {\r\n type: 3,\r\n define: \"PREPASS_REFLECTIVITY\",\r\n index: \"PREPASS_REFLECTIVITY_INDEX\",\r\n },\r\n {\r\n type: 0,\r\n define: \"PREPASS_IRRADIANCE\",\r\n index: \"PREPASS_IRRADIANCE_INDEX\",\r\n },\r\n {\r\n type: 6,\r\n define: \"PREPASS_ALBEDO\",\r\n index: \"PREPASS_ALBEDO_INDEX\",\r\n },\r\n {\r\n type: 5,\r\n define: \"PREPASS_DEPTHNORMAL\",\r\n index: \"PREPASS_DEPTHNORMAL_INDEX\",\r\n }\r\n ];\r\n if (scene.prePassRenderer && scene.prePassRenderer.enabled && canRenderToMRT) {\r\n defines.PREPASS = true;\r\n defines.SCENE_MRT_COUNT = scene.prePassRenderer.mrtCount;\r\n for (var i = 0; i < texturesList.length; i++) {\r\n var index = scene.prePassRenderer.getIndex(texturesList[i].type);\r\n if (index !== -1) {\r\n defines[texturesList[i].define] = true;\r\n defines[texturesList[i].index] = index;\r\n }\r\n else {\r\n defines[texturesList[i].define] = false;\r\n }\r\n }\r\n }\r\n else {\r\n defines.PREPASS = false;\r\n for (var i = 0; i < texturesList.length; i++) {\r\n defines[texturesList[i].define] = false;\r\n }\r\n }\r\n if (defines.PREPASS != previousPrePass) {\r\n defines.markAsUnprocessed();\r\n defines.markAsImageProcessingDirty();\r\n }\r\n };\r\n /**\r\n * Prepares the defines related to the light information passed in parameter\r\n * @param scene The scene we are intending to draw\r\n * @param mesh The mesh the effect is compiling for\r\n * @param light The light the effect is compiling for\r\n * @param lightIndex The index of the light\r\n * @param defines The defines to update\r\n * @param specularSupported Specifies whether specular is supported or not (override lights data)\r\n * @param state Defines the current state regarding what is needed (normals, etc...)\r\n */\r\n MaterialHelper.PrepareDefinesForLight = function (scene, mesh, light, lightIndex, defines, specularSupported, state) {\r\n state.needNormals = true;\r\n if (defines[\"LIGHT\" + lightIndex] === undefined) {\r\n state.needRebuild = true;\r\n }\r\n defines[\"LIGHT\" + lightIndex] = true;\r\n defines[\"SPOTLIGHT\" + lightIndex] = false;\r\n defines[\"HEMILIGHT\" + lightIndex] = false;\r\n defines[\"POINTLIGHT\" + lightIndex] = false;\r\n defines[\"DIRLIGHT\" + lightIndex] = false;\r\n light.prepareLightSpecificDefines(defines, lightIndex);\r\n // FallOff.\r\n defines[\"LIGHT_FALLOFF_PHYSICAL\" + lightIndex] = false;\r\n defines[\"LIGHT_FALLOFF_GLTF\" + lightIndex] = false;\r\n defines[\"LIGHT_FALLOFF_STANDARD\" + lightIndex] = false;\r\n switch (light.falloffType) {\r\n case Light.FALLOFF_GLTF:\r\n defines[\"LIGHT_FALLOFF_GLTF\" + lightIndex] = true;\r\n break;\r\n case Light.FALLOFF_PHYSICAL:\r\n defines[\"LIGHT_FALLOFF_PHYSICAL\" + lightIndex] = true;\r\n break;\r\n case Light.FALLOFF_STANDARD:\r\n defines[\"LIGHT_FALLOFF_STANDARD\" + lightIndex] = true;\r\n break;\r\n }\r\n // Specular\r\n if (specularSupported && !light.specular.equalsFloats(0, 0, 0)) {\r\n state.specularEnabled = true;\r\n }\r\n // Shadows\r\n defines[\"SHADOW\" + lightIndex] = false;\r\n defines[\"SHADOWCSM\" + lightIndex] = false;\r\n defines[\"SHADOWCSMDEBUG\" + lightIndex] = false;\r\n defines[\"SHADOWCSMNUM_CASCADES\" + lightIndex] = false;\r\n defines[\"SHADOWCSMUSESHADOWMAXZ\" + lightIndex] = false;\r\n defines[\"SHADOWCSMNOBLEND\" + lightIndex] = false;\r\n defines[\"SHADOWCSM_RIGHTHANDED\" + lightIndex] = false;\r\n defines[\"SHADOWPCF\" + lightIndex] = false;\r\n defines[\"SHADOWPCSS\" + lightIndex] = false;\r\n defines[\"SHADOWPOISSON\" + lightIndex] = false;\r\n defines[\"SHADOWESM\" + lightIndex] = false;\r\n defines[\"SHADOWCLOSEESM\" + lightIndex] = false;\r\n defines[\"SHADOWCUBE\" + lightIndex] = false;\r\n defines[\"SHADOWLOWQUALITY\" + lightIndex] = false;\r\n defines[\"SHADOWMEDIUMQUALITY\" + lightIndex] = false;\r\n if (mesh && mesh.receiveShadows && scene.shadowsEnabled && light.shadowEnabled) {\r\n var shadowGenerator = light.getShadowGenerator();\r\n if (shadowGenerator) {\r\n var shadowMap = shadowGenerator.getShadowMap();\r\n if (shadowMap) {\r\n if (shadowMap.renderList && shadowMap.renderList.length > 0) {\r\n state.shadowEnabled = true;\r\n shadowGenerator.prepareDefines(defines, lightIndex);\r\n }\r\n }\r\n }\r\n }\r\n if (light.lightmapMode != Light.LIGHTMAP_DEFAULT) {\r\n state.lightmapMode = true;\r\n defines[\"LIGHTMAPEXCLUDED\" + lightIndex] = true;\r\n defines[\"LIGHTMAPNOSPECULAR\" + lightIndex] = (light.lightmapMode == Light.LIGHTMAP_SHADOWSONLY);\r\n }\r\n else {\r\n defines[\"LIGHTMAPEXCLUDED\" + lightIndex] = false;\r\n defines[\"LIGHTMAPNOSPECULAR\" + lightIndex] = false;\r\n }\r\n };\r\n /**\r\n * Prepares the defines related to the light information passed in parameter\r\n * @param scene The scene we are intending to draw\r\n * @param mesh The mesh the effect is compiling for\r\n * @param defines The defines to update\r\n * @param specularSupported Specifies whether specular is supported or not (override lights data)\r\n * @param maxSimultaneousLights Specfies how manuy lights can be added to the effect at max\r\n * @param disableLighting Specifies whether the lighting is disabled (override scene and light)\r\n * @returns true if normals will be required for the rest of the effect\r\n */\r\n MaterialHelper.PrepareDefinesForLights = function (scene, mesh, defines, specularSupported, maxSimultaneousLights, disableLighting) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n if (disableLighting === void 0) { disableLighting = false; }\r\n if (!defines._areLightsDirty) {\r\n return defines._needNormals;\r\n }\r\n var lightIndex = 0;\r\n var state = {\r\n needNormals: false,\r\n needRebuild: false,\r\n lightmapMode: false,\r\n shadowEnabled: false,\r\n specularEnabled: false\r\n };\r\n if (scene.lightsEnabled && !disableLighting) {\r\n for (var _i = 0, _a = mesh.lightSources; _i < _a.length; _i++) {\r\n var light = _a[_i];\r\n this.PrepareDefinesForLight(scene, mesh, light, lightIndex, defines, specularSupported, state);\r\n lightIndex++;\r\n if (lightIndex === maxSimultaneousLights) {\r\n break;\r\n }\r\n }\r\n }\r\n defines[\"SPECULARTERM\"] = state.specularEnabled;\r\n defines[\"SHADOWS\"] = state.shadowEnabled;\r\n // Resetting all other lights if any\r\n for (var index = lightIndex; index < maxSimultaneousLights; index++) {\r\n if (defines[\"LIGHT\" + index] !== undefined) {\r\n defines[\"LIGHT\" + index] = false;\r\n defines[\"HEMILIGHT\" + index] = false;\r\n defines[\"POINTLIGHT\" + index] = false;\r\n defines[\"DIRLIGHT\" + index] = false;\r\n defines[\"SPOTLIGHT\" + index] = false;\r\n defines[\"SHADOW\" + index] = false;\r\n defines[\"SHADOWCSM\" + index] = false;\r\n defines[\"SHADOWCSMDEBUG\" + index] = false;\r\n defines[\"SHADOWCSMNUM_CASCADES\" + index] = false;\r\n defines[\"SHADOWCSMUSESHADOWMAXZ\" + index] = false;\r\n defines[\"SHADOWCSMNOBLEND\" + index] = false;\r\n defines[\"SHADOWCSM_RIGHTHANDED\" + index] = false;\r\n defines[\"SHADOWPCF\" + index] = false;\r\n defines[\"SHADOWPCSS\" + index] = false;\r\n defines[\"SHADOWPOISSON\" + index] = false;\r\n defines[\"SHADOWESM\" + index] = false;\r\n defines[\"SHADOWCLOSEESM\" + index] = false;\r\n defines[\"SHADOWCUBE\" + index] = false;\r\n defines[\"SHADOWLOWQUALITY\" + index] = false;\r\n defines[\"SHADOWMEDIUMQUALITY\" + index] = false;\r\n }\r\n }\r\n var caps = scene.getEngine().getCaps();\r\n if (defines[\"SHADOWFLOAT\"] === undefined) {\r\n state.needRebuild = true;\r\n }\r\n defines[\"SHADOWFLOAT\"] = state.shadowEnabled &&\r\n ((caps.textureFloatRender && caps.textureFloatLinearFiltering) ||\r\n (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering));\r\n defines[\"LIGHTMAPEXCLUDED\"] = state.lightmapMode;\r\n if (state.needRebuild) {\r\n defines.rebuild();\r\n }\r\n return state.needNormals;\r\n };\r\n /**\r\n * Prepares the uniforms and samplers list to be used in the effect (for a specific light)\r\n * @param lightIndex defines the light index\r\n * @param uniformsList The uniform list\r\n * @param samplersList The sampler list\r\n * @param projectedLightTexture defines if projected texture must be used\r\n * @param uniformBuffersList defines an optional list of uniform buffers\r\n * @param updateOnlyBuffersList True to only update the uniformBuffersList array\r\n */\r\n MaterialHelper.PrepareUniformsAndSamplersForLight = function (lightIndex, uniformsList, samplersList, projectedLightTexture, uniformBuffersList, updateOnlyBuffersList) {\r\n if (uniformBuffersList === void 0) { uniformBuffersList = null; }\r\n if (updateOnlyBuffersList === void 0) { updateOnlyBuffersList = false; }\r\n if (uniformBuffersList) {\r\n uniformBuffersList.push(\"Light\" + lightIndex);\r\n }\r\n if (updateOnlyBuffersList) {\r\n return;\r\n }\r\n uniformsList.push(\"vLightData\" + lightIndex, \"vLightDiffuse\" + lightIndex, \"vLightSpecular\" + lightIndex, \"vLightDirection\" + lightIndex, \"vLightFalloff\" + lightIndex, \"vLightGround\" + lightIndex, \"lightMatrix\" + lightIndex, \"shadowsInfo\" + lightIndex, \"depthValues\" + lightIndex);\r\n samplersList.push(\"shadowSampler\" + lightIndex);\r\n samplersList.push(\"depthSampler\" + lightIndex);\r\n uniformsList.push(\"viewFrustumZ\" + lightIndex, \"cascadeBlendFactor\" + lightIndex, \"lightSizeUVCorrection\" + lightIndex, \"depthCorrection\" + lightIndex, \"penumbraDarkness\" + lightIndex, \"frustumLengths\" + lightIndex);\r\n if (projectedLightTexture) {\r\n samplersList.push(\"projectionLightSampler\" + lightIndex);\r\n uniformsList.push(\"textureProjectionMatrix\" + lightIndex);\r\n }\r\n };\r\n /**\r\n * Prepares the uniforms and samplers list to be used in the effect\r\n * @param uniformsListOrOptions The uniform names to prepare or an EffectCreationOptions containing the liist and extra information\r\n * @param samplersList The sampler list\r\n * @param defines The defines helping in the list generation\r\n * @param maxSimultaneousLights The maximum number of simultanous light allowed in the effect\r\n */\r\n MaterialHelper.PrepareUniformsAndSamplersList = function (uniformsListOrOptions, samplersList, defines, maxSimultaneousLights) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n var uniformsList;\r\n var uniformBuffersList = null;\r\n if (uniformsListOrOptions.uniformsNames) {\r\n var options = uniformsListOrOptions;\r\n uniformsList = options.uniformsNames;\r\n uniformBuffersList = options.uniformBuffersNames;\r\n samplersList = options.samplers;\r\n defines = options.defines;\r\n maxSimultaneousLights = options.maxSimultaneousLights || 0;\r\n }\r\n else {\r\n uniformsList = uniformsListOrOptions;\r\n if (!samplersList) {\r\n samplersList = [];\r\n }\r\n }\r\n for (var lightIndex = 0; lightIndex < maxSimultaneousLights; lightIndex++) {\r\n if (!defines[\"LIGHT\" + lightIndex]) {\r\n break;\r\n }\r\n this.PrepareUniformsAndSamplersForLight(lightIndex, uniformsList, samplersList, defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex], uniformBuffersList);\r\n }\r\n if (defines[\"NUM_MORPH_INFLUENCERS\"]) {\r\n uniformsList.push(\"morphTargetInfluences\");\r\n }\r\n };\r\n /**\r\n * This helps decreasing rank by rank the shadow quality (0 being the highest rank and quality)\r\n * @param defines The defines to update while falling back\r\n * @param fallbacks The authorized effect fallbacks\r\n * @param maxSimultaneousLights The maximum number of lights allowed\r\n * @param rank the current rank of the Effect\r\n * @returns The newly affected rank\r\n */\r\n MaterialHelper.HandleFallbacksForShadows = function (defines, fallbacks, maxSimultaneousLights, rank) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n if (rank === void 0) { rank = 0; }\r\n var lightFallbackRank = 0;\r\n for (var lightIndex = 0; lightIndex < maxSimultaneousLights; lightIndex++) {\r\n if (!defines[\"LIGHT\" + lightIndex]) {\r\n break;\r\n }\r\n if (lightIndex > 0) {\r\n lightFallbackRank = rank + lightIndex;\r\n fallbacks.addFallback(lightFallbackRank, \"LIGHT\" + lightIndex);\r\n }\r\n if (!defines[\"SHADOWS\"]) {\r\n if (defines[\"SHADOW\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOW\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWPCF\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWPCF\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWPCSS\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWPCSS\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWPOISSON\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWPOISSON\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWESM\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWESM\" + lightIndex);\r\n }\r\n if (defines[\"SHADOWCLOSEESM\" + lightIndex]) {\r\n fallbacks.addFallback(rank, \"SHADOWCLOSEESM\" + lightIndex);\r\n }\r\n }\r\n }\r\n return lightFallbackRank++;\r\n };\r\n /**\r\n * Prepares the list of attributes required for morph targets according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param mesh The mesh to prepare the morph targets attributes for\r\n * @param influencers The number of influencers\r\n */\r\n MaterialHelper.PrepareAttributesForMorphTargetsInfluencers = function (attribs, mesh, influencers) {\r\n this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS = influencers;\r\n this.PrepareAttributesForMorphTargets(attribs, mesh, this._TmpMorphInfluencers);\r\n };\r\n /**\r\n * Prepares the list of attributes required for morph targets according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param mesh The mesh to prepare the morph targets attributes for\r\n * @param defines The current Defines of the effect\r\n */\r\n MaterialHelper.PrepareAttributesForMorphTargets = function (attribs, mesh, defines) {\r\n var influencers = defines[\"NUM_MORPH_INFLUENCERS\"];\r\n if (influencers > 0 && EngineStore.LastCreatedEngine) {\r\n var maxAttributesCount = EngineStore.LastCreatedEngine.getCaps().maxVertexAttribs;\r\n var manager = mesh.morphTargetManager;\r\n var normal = manager && manager.supportsNormals && defines[\"NORMAL\"];\r\n var tangent = manager && manager.supportsTangents && defines[\"TANGENT\"];\r\n var uv = manager && manager.supportsUVs && defines[\"UV1\"];\r\n for (var index = 0; index < influencers; index++) {\r\n attribs.push(VertexBuffer.PositionKind + index);\r\n if (normal) {\r\n attribs.push(VertexBuffer.NormalKind + index);\r\n }\r\n if (tangent) {\r\n attribs.push(VertexBuffer.TangentKind + index);\r\n }\r\n if (uv) {\r\n attribs.push(VertexBuffer.UVKind + \"_\" + index);\r\n }\r\n if (attribs.length > maxAttributesCount) {\r\n Logger.Error(\"Cannot add more vertex attributes for mesh \" + mesh.name);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Prepares the list of attributes required for bones according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param mesh The mesh to prepare the bones attributes for\r\n * @param defines The current Defines of the effect\r\n * @param fallbacks The current efffect fallback strategy\r\n */\r\n MaterialHelper.PrepareAttributesForBones = function (attribs, mesh, defines, fallbacks) {\r\n if (defines[\"NUM_BONE_INFLUENCERS\"] > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n attribs.push(VertexBuffer.MatricesIndicesKind);\r\n attribs.push(VertexBuffer.MatricesWeightsKind);\r\n if (defines[\"NUM_BONE_INFLUENCERS\"] > 4) {\r\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\r\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\r\n }\r\n }\r\n };\r\n /**\r\n * Check and prepare the list of attributes required for instances according to the effect defines.\r\n * @param attribs The current list of supported attribs\r\n * @param defines The current MaterialDefines of the effect\r\n */\r\n MaterialHelper.PrepareAttributesForInstances = function (attribs, defines) {\r\n if (defines[\"INSTANCES\"] || defines[\"THIN_INSTANCES\"]) {\r\n this.PushAttributesForInstances(attribs);\r\n }\r\n };\r\n /**\r\n * Add the list of attributes required for instances to the attribs array.\r\n * @param attribs The current list of supported attribs\r\n */\r\n MaterialHelper.PushAttributesForInstances = function (attribs) {\r\n attribs.push(\"world0\");\r\n attribs.push(\"world1\");\r\n attribs.push(\"world2\");\r\n attribs.push(\"world3\");\r\n };\r\n /**\r\n * Binds the light information to the effect.\r\n * @param light The light containing the generator\r\n * @param effect The effect we are binding the data to\r\n * @param lightIndex The light index in the effect used to render\r\n */\r\n MaterialHelper.BindLightProperties = function (light, effect, lightIndex) {\r\n light.transferToEffect(effect, lightIndex + \"\");\r\n };\r\n /**\r\n * Binds the lights information from the scene to the effect for the given mesh.\r\n * @param light Light to bind\r\n * @param lightIndex Light index\r\n * @param scene The scene where the light belongs to\r\n * @param effect The effect we are binding the data to\r\n * @param useSpecular Defines if specular is supported\r\n * @param rebuildInParallel Specifies whether the shader is rebuilding in parallel\r\n */\r\n MaterialHelper.BindLight = function (light, lightIndex, scene, effect, useSpecular, rebuildInParallel) {\r\n if (rebuildInParallel === void 0) { rebuildInParallel = false; }\r\n light._bindLight(lightIndex, scene, effect, useSpecular, rebuildInParallel);\r\n };\r\n /**\r\n * Binds the lights information from the scene to the effect for the given mesh.\r\n * @param scene The scene the lights belongs to\r\n * @param mesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n * @param defines The generated defines for the effect\r\n * @param maxSimultaneousLights The maximum number of light that can be bound to the effect\r\n * @param rebuildInParallel Specifies whether the shader is rebuilding in parallel\r\n */\r\n MaterialHelper.BindLights = function (scene, mesh, effect, defines, maxSimultaneousLights, rebuildInParallel) {\r\n if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }\r\n if (rebuildInParallel === void 0) { rebuildInParallel = false; }\r\n var len = Math.min(mesh.lightSources.length, maxSimultaneousLights);\r\n for (var i = 0; i < len; i++) {\r\n var light = mesh.lightSources[i];\r\n this.BindLight(light, i, scene, effect, typeof defines === \"boolean\" ? defines : defines[\"SPECULARTERM\"], rebuildInParallel);\r\n }\r\n };\r\n /**\r\n * Binds the fog information from the scene to the effect for the given mesh.\r\n * @param scene The scene the lights belongs to\r\n * @param mesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n * @param linearSpace Defines if the fog effect is applied in linear space\r\n */\r\n MaterialHelper.BindFogParameters = function (scene, mesh, effect, linearSpace) {\r\n if (linearSpace === void 0) { linearSpace = false; }\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n effect.setFloat4(\"vFogInfos\", scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);\r\n // Convert fog color to linear space if used in a linear space computed shader.\r\n if (linearSpace) {\r\n scene.fogColor.toLinearSpaceToRef(this._tempFogColor);\r\n effect.setColor3(\"vFogColor\", this._tempFogColor);\r\n }\r\n else {\r\n effect.setColor3(\"vFogColor\", scene.fogColor);\r\n }\r\n }\r\n };\r\n /**\r\n * Binds the bones information from the mesh to the effect.\r\n * @param mesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n * @param prePassConfiguration Configuration for the prepass, in case prepass is activated\r\n */\r\n MaterialHelper.BindBonesParameters = function (mesh, effect, prePassConfiguration) {\r\n if (!effect || !mesh) {\r\n return;\r\n }\r\n if (mesh.computeBonesUsingShaders && effect._bonesComputationForcedToCPU) {\r\n mesh.computeBonesUsingShaders = false;\r\n }\r\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n var skeleton = mesh.skeleton;\r\n if (skeleton.isUsingTextureForMatrices && effect.getUniformIndex(\"boneTextureWidth\") > -1) {\r\n var boneTexture = skeleton.getTransformMatrixTexture(mesh);\r\n effect.setTexture(\"boneSampler\", boneTexture);\r\n effect.setFloat(\"boneTextureWidth\", 4.0 * (skeleton.bones.length + 1));\r\n }\r\n else {\r\n var matrices = skeleton.getTransformMatrices(mesh);\r\n if (matrices) {\r\n effect.setMatrices(\"mBones\", matrices);\r\n if (prePassConfiguration && mesh.getScene().prePassRenderer && mesh.getScene().prePassRenderer.getIndex(2)) {\r\n if (prePassConfiguration.previousBones[mesh.uniqueId]) {\r\n effect.setMatrices(\"mPreviousBones\", prePassConfiguration.previousBones[mesh.uniqueId]);\r\n }\r\n MaterialHelper._CopyBonesTransformationMatrices(matrices, prePassConfiguration.previousBones[mesh.uniqueId]);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n // Copies the bones transformation matrices into the target array and returns the target's reference\r\n MaterialHelper._CopyBonesTransformationMatrices = function (source, target) {\r\n target.set(source);\r\n return target;\r\n };\r\n /**\r\n * Binds the morph targets information from the mesh to the effect.\r\n * @param abstractMesh The mesh we are binding the information to render\r\n * @param effect The effect we are binding the data to\r\n */\r\n MaterialHelper.BindMorphTargetParameters = function (abstractMesh, effect) {\r\n var manager = abstractMesh.morphTargetManager;\r\n if (!abstractMesh || !manager) {\r\n return;\r\n }\r\n effect.setFloatArray(\"morphTargetInfluences\", manager.influences);\r\n };\r\n /**\r\n * Binds the logarithmic depth information from the scene to the effect for the given defines.\r\n * @param defines The generated defines used in the effect\r\n * @param effect The effect we are binding the data to\r\n * @param scene The scene we are willing to render with logarithmic scale for\r\n */\r\n MaterialHelper.BindLogDepth = function (defines, effect, scene) {\r\n if (defines[\"LOGARITHMICDEPTH\"]) {\r\n effect.setFloat(\"logarithmicDepthConstant\", 2.0 / (Math.log(scene.activeCamera.maxZ + 1.0) / Math.LN2));\r\n }\r\n };\r\n /**\r\n * Binds the clip plane information from the scene to the effect.\r\n * @param scene The scene the clip plane information are extracted from\r\n * @param effect The effect we are binding the data to\r\n */\r\n MaterialHelper.BindClipPlane = function (effect, scene) {\r\n ThinMaterialHelper.BindClipPlane(effect, scene);\r\n };\r\n MaterialHelper._TmpMorphInfluencers = { \"NUM_MORPH_INFLUENCERS\": 0 };\r\n MaterialHelper._tempFogColor = Color3.Black();\r\n return MaterialHelper;\r\n}());\r\nexport { MaterialHelper };\r\n//# sourceMappingURL=materialHelper.js.map","import { __extends } from \"tslib\";\r\nimport { Material } from \"../Materials/material\";\r\nimport { Tags } from \"../Misc/tags\";\r\nimport { _TypeStore } from '../Misc/typeStore';\r\n/**\r\n * A multi-material is used to apply different materials to different parts of the same object without the need of\r\n * separate meshes. This can be use to improve performances.\r\n * @see https://doc.babylonjs.com/how_to/multi_materials\r\n */\r\nvar MultiMaterial = /** @class */ (function (_super) {\r\n __extends(MultiMaterial, _super);\r\n /**\r\n * Instantiates a new Multi Material\r\n * A multi-material is used to apply different materials to different parts of the same object without the need of\r\n * separate meshes. This can be use to improve performances.\r\n * @see https://doc.babylonjs.com/how_to/multi_materials\r\n * @param name Define the name in the scene\r\n * @param scene Define the scene the material belongs to\r\n */\r\n function MultiMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene, true) || this;\r\n scene.multiMaterials.push(_this);\r\n _this.subMaterials = new Array();\r\n _this._storeEffectOnSubMeshes = true; // multimaterial is considered like a push material\r\n return _this;\r\n }\r\n Object.defineProperty(MultiMaterial.prototype, \"subMaterials\", {\r\n /**\r\n * Gets or Sets the list of Materials used within the multi material.\r\n * They need to be ordered according to the submeshes order in the associated mesh\r\n */\r\n get: function () {\r\n return this._subMaterials;\r\n },\r\n set: function (value) {\r\n this._subMaterials = value;\r\n this._hookArray(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Function used to align with Node.getChildren()\r\n * @returns the list of Materials used within the multi material\r\n */\r\n MultiMaterial.prototype.getChildren = function () {\r\n return this.subMaterials;\r\n };\r\n MultiMaterial.prototype._hookArray = function (array) {\r\n var _this = this;\r\n var oldPush = array.push;\r\n array.push = function () {\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n var result = oldPush.apply(array, items);\r\n _this._markAllSubMeshesAsTexturesDirty();\r\n return result;\r\n };\r\n var oldSplice = array.splice;\r\n array.splice = function (index, deleteCount) {\r\n var deleted = oldSplice.apply(array, [index, deleteCount]);\r\n _this._markAllSubMeshesAsTexturesDirty();\r\n return deleted;\r\n };\r\n };\r\n /**\r\n * Get one of the submaterial by its index in the submaterials array\r\n * @param index The index to look the sub material at\r\n * @returns The Material if the index has been defined\r\n */\r\n MultiMaterial.prototype.getSubMaterial = function (index) {\r\n if (index < 0 || index >= this.subMaterials.length) {\r\n return this.getScene().defaultMaterial;\r\n }\r\n return this.subMaterials[index];\r\n };\r\n /**\r\n * Get the list of active textures for the whole sub materials list.\r\n * @returns All the textures that will be used during the rendering\r\n */\r\n MultiMaterial.prototype.getActiveTextures = function () {\r\n var _a;\r\n return (_a = _super.prototype.getActiveTextures.call(this)).concat.apply(_a, this.subMaterials.map(function (subMaterial) {\r\n if (subMaterial) {\r\n return subMaterial.getActiveTextures();\r\n }\r\n else {\r\n return [];\r\n }\r\n }));\r\n };\r\n /**\r\n * Specifies if any sub-materials of this multi-material use a given texture.\r\n * @param texture Defines the texture to check against this multi-material's sub-materials.\r\n * @returns A boolean specifying if any sub-material of this multi-material uses the texture.\r\n */\r\n MultiMaterial.prototype.hasTexture = function (texture) {\r\n var _a;\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n for (var i = 0; i < this.subMaterials.length; i++) {\r\n if ((_a = this.subMaterials[i]) === null || _a === void 0 ? void 0 : _a.hasTexture(texture)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets the current class name of the material e.g. \"MultiMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n MultiMaterial.prototype.getClassName = function () {\r\n return \"MultiMaterial\";\r\n };\r\n /**\r\n * Checks if the material is ready to render the requested sub mesh\r\n * @param mesh Define the mesh the submesh belongs to\r\n * @param subMesh Define the sub mesh to look readyness for\r\n * @param useInstances Define whether or not the material is used with instances\r\n * @returns true if ready, otherwise false\r\n */\r\n MultiMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n for (var index = 0; index < this.subMaterials.length; index++) {\r\n var subMaterial = this.subMaterials[index];\r\n if (subMaterial) {\r\n if (subMaterial._storeEffectOnSubMeshes) {\r\n if (!subMaterial.isReadyForSubMesh(mesh, subMesh, useInstances)) {\r\n return false;\r\n }\r\n continue;\r\n }\r\n if (!subMaterial.isReady(mesh)) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Clones the current material and its related sub materials\r\n * @param name Define the name of the newly cloned material\r\n * @param cloneChildren Define if submaterial will be cloned or shared with the parent instance\r\n * @returns the cloned material\r\n */\r\n MultiMaterial.prototype.clone = function (name, cloneChildren) {\r\n var newMultiMaterial = new MultiMaterial(name, this.getScene());\r\n for (var index = 0; index < this.subMaterials.length; index++) {\r\n var subMaterial = null;\r\n var current = this.subMaterials[index];\r\n if (cloneChildren && current) {\r\n subMaterial = current.clone(name + \"-\" + current.name);\r\n }\r\n else {\r\n subMaterial = this.subMaterials[index];\r\n }\r\n newMultiMaterial.subMaterials.push(subMaterial);\r\n }\r\n return newMultiMaterial;\r\n };\r\n /**\r\n * Serializes the materials into a JSON representation.\r\n * @returns the JSON representation\r\n */\r\n MultiMaterial.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.id = this.id;\r\n if (Tags) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n serializationObject.materials = [];\r\n for (var matIndex = 0; matIndex < this.subMaterials.length; matIndex++) {\r\n var subMat = this.subMaterials[matIndex];\r\n if (subMat) {\r\n serializationObject.materials.push(subMat.id);\r\n }\r\n else {\r\n serializationObject.materials.push(null);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Dispose the material and release its associated resources\r\n * @param forceDisposeEffect Define if we want to force disposing the associated effect (if false the shader is not released and could be reuse later on)\r\n * @param forceDisposeTextures Define if we want to force disposing the associated textures (if false, they will not be disposed and can still be use elsewhere in the app)\r\n * @param forceDisposeChildren Define if we want to force disposing the associated submaterials (if false, they will not be disposed and can still be use elsewhere in the app)\r\n */\r\n MultiMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures, forceDisposeChildren) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n if (forceDisposeChildren) {\r\n for (var index = 0; index < this.subMaterials.length; index++) {\r\n var subMaterial = this.subMaterials[index];\r\n if (subMaterial) {\r\n subMaterial.dispose(forceDisposeEffect, forceDisposeTextures);\r\n }\r\n }\r\n }\r\n var index = scene.multiMaterials.indexOf(this);\r\n if (index >= 0) {\r\n scene.multiMaterials.splice(index, 1);\r\n }\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);\r\n };\r\n /**\r\n * Creates a MultiMaterial from parsed MultiMaterial data.\r\n * @param parsedMultiMaterial defines parsed MultiMaterial data.\r\n * @param scene defines the hosting scene\r\n * @returns a new MultiMaterial\r\n */\r\n MultiMaterial.ParseMultiMaterial = function (parsedMultiMaterial, scene) {\r\n var multiMaterial = new MultiMaterial(parsedMultiMaterial.name, scene);\r\n multiMaterial.id = parsedMultiMaterial.id;\r\n if (Tags) {\r\n Tags.AddTagsTo(multiMaterial, parsedMultiMaterial.tags);\r\n }\r\n for (var matIndex = 0; matIndex < parsedMultiMaterial.materials.length; matIndex++) {\r\n var subMatId = parsedMultiMaterial.materials[matIndex];\r\n if (subMatId) {\r\n // If the same multimaterial is loaded twice, the 2nd multimaterial needs to reference the latest material by that id which\r\n // is why this lookup should use getLastMaterialByID instead of getMaterialByID\r\n multiMaterial.subMaterials.push(scene.getLastMaterialByID(subMatId));\r\n }\r\n else {\r\n multiMaterial.subMaterials.push(null);\r\n }\r\n }\r\n return multiMaterial;\r\n };\r\n return MultiMaterial;\r\n}(Material));\r\nexport { MultiMaterial };\r\n_TypeStore.RegisteredTypes[\"BABYLON.MultiMaterial\"] = MultiMaterial;\r\n//# sourceMappingURL=multiMaterial.js.map","import { Matrix } from \"../Maths/math.vector\";\r\n/**\r\n * Configuration needed for prepass-capable materials\r\n */\r\nvar PrePassConfiguration = /** @class */ (function () {\r\n function PrePassConfiguration() {\r\n /**\r\n * Previous world matrices of meshes carrying this material\r\n * Used for computing velocity\r\n */\r\n this.previousWorldMatrices = {};\r\n /**\r\n * Previous bones of meshes carrying this material\r\n * Used for computing velocity\r\n */\r\n this.previousBones = {};\r\n }\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PrePassConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"previousWorld\", \"previousViewProjection\");\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PrePassConfiguration.AddSamplers = function (samplers) {\r\n // pass\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param effect defines the effect to update\r\n * @param scene defines the scene the material belongs to.\r\n * @param mesh The mesh\r\n * @param world World matrix of this mesh\r\n * @param isFrozen Is the material frozen\r\n */\r\n PrePassConfiguration.prototype.bindForSubMesh = function (effect, scene, mesh, world, isFrozen) {\r\n if (scene.prePassRenderer && scene.prePassRenderer.enabled) {\r\n if (scene.prePassRenderer.getIndex(2) !== -1) {\r\n if (!this.previousWorldMatrices[mesh.uniqueId]) {\r\n this.previousWorldMatrices[mesh.uniqueId] = Matrix.Identity();\r\n }\r\n if (!this.previousViewProjection) {\r\n this.previousViewProjection = scene.getTransformMatrix();\r\n }\r\n effect.setMatrix(\"previousWorld\", this.previousWorldMatrices[mesh.uniqueId]);\r\n effect.setMatrix(\"previousViewProjection\", this.previousViewProjection);\r\n this.previousWorldMatrices[mesh.uniqueId] = world.clone();\r\n this.previousViewProjection = scene.getTransformMatrix().clone();\r\n }\r\n }\r\n };\r\n return PrePassConfiguration;\r\n}());\r\nexport { PrePassConfiguration };\r\n//# sourceMappingURL=prePassConfiguration.js.map","import { __extends } from \"tslib\";\r\nimport { Matrix } from \"../Maths/math.vector\";\r\nimport { Material } from \"../Materials/material\";\r\n/**\r\n * Base class of materials working in push mode in babylon JS\r\n * @hidden\r\n */\r\nvar PushMaterial = /** @class */ (function (_super) {\r\n __extends(PushMaterial, _super);\r\n function PushMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._normalMatrix = new Matrix();\r\n _this._storeEffectOnSubMeshes = true;\r\n return _this;\r\n }\r\n PushMaterial.prototype.getEffect = function () {\r\n return this._activeEffect;\r\n };\r\n PushMaterial.prototype.isReady = function (mesh, useInstances) {\r\n if (!mesh) {\r\n return false;\r\n }\r\n if (!mesh.subMeshes || mesh.subMeshes.length === 0) {\r\n return true;\r\n }\r\n return this.isReadyForSubMesh(mesh, mesh.subMeshes[0], useInstances);\r\n };\r\n PushMaterial.prototype._isReadyForSubMesh = function (subMesh) {\r\n var defines = subMesh._materialDefines;\r\n if (!this.checkReadyOnEveryCall && subMesh.effect && defines) {\r\n if (defines._renderId === this.getScene().getRenderId()) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Binds the given world matrix to the active effect\r\n *\r\n * @param world the matrix to bind\r\n */\r\n PushMaterial.prototype.bindOnlyWorldMatrix = function (world) {\r\n this._activeEffect.setMatrix(\"world\", world);\r\n };\r\n /**\r\n * Binds the given normal matrix to the active effect\r\n *\r\n * @param normalMatrix the matrix to bind\r\n */\r\n PushMaterial.prototype.bindOnlyNormalMatrix = function (normalMatrix) {\r\n this._activeEffect.setMatrix(\"normalMatrix\", normalMatrix);\r\n };\r\n PushMaterial.prototype.bind = function (world, mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n this.bindForSubMesh(world, mesh, mesh.subMeshes[0]);\r\n };\r\n PushMaterial.prototype._afterBind = function (mesh, effect) {\r\n if (effect === void 0) { effect = null; }\r\n _super.prototype._afterBind.call(this, mesh);\r\n this.getScene()._cachedEffect = effect;\r\n };\r\n PushMaterial.prototype._mustRebind = function (scene, effect, visibility) {\r\n if (visibility === void 0) { visibility = 1; }\r\n return scene.isCachedMaterialInvalid(this, effect, visibility);\r\n };\r\n return PushMaterial;\r\n}(Material));\r\nexport { PushMaterial };\r\n//# sourceMappingURL=pushMaterial.js.map","import { __assign, __extends } from \"tslib\";\r\nimport { SerializationHelper } from \"../Misc/decorators\";\r\nimport { Matrix, Vector3, Vector2, Vector4 } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { MaterialHelper } from \"./materialHelper\";\r\nimport { Material } from \"./material\";\r\nimport { _TypeStore } from '../Misc/typeStore';\r\nimport { Color3, Color4 } from '../Maths/math.color';\r\nimport { EffectFallbacks } from './effectFallbacks';\r\nimport { WebRequest } from '../Misc/webRequest';\r\nimport { Engine } from '../Engines/engine';\r\nvar onCreatedEffectParameters = { effect: null, subMesh: null };\r\n/**\r\n * The ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh.\r\n *\r\n * This returned material effects how the mesh will look based on the code in the shaders.\r\n *\r\n * @see https://doc.babylonjs.com/how_to/shader_material\r\n */\r\nvar ShaderMaterial = /** @class */ (function (_super) {\r\n __extends(ShaderMaterial, _super);\r\n /**\r\n * Instantiate a new shader material.\r\n * The ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh.\r\n * This returned material effects how the mesh will look based on the code in the shaders.\r\n * @see https://doc.babylonjs.com/how_to/shader_material\r\n * @param name Define the name of the material in the scene\r\n * @param scene Define the scene the material belongs to\r\n * @param shaderPath Defines the route to the shader code in one of three ways:\r\n * * object: { vertex: \"custom\", fragment: \"custom\" }, used with Effect.ShadersStore[\"customVertexShader\"] and Effect.ShadersStore[\"customFragmentShader\"]\r\n * * object: { vertexElement: \"vertexShaderCode\", fragmentElement: \"fragmentShaderCode\" }, used with shader code in script tags\r\n * * object: { vertexSource: \"vertex shader code string\", fragmentSource: \"fragment shader code string\" } using with strings containing the shaders code\r\n * * string: \"./COMMON_NAME\", used with external files COMMON_NAME.vertex.fx and COMMON_NAME.fragment.fx in index.html folder.\r\n * @param options Define the options used to create the shader\r\n */\r\n function ShaderMaterial(name, scene, shaderPath, options) {\r\n if (options === void 0) { options = {}; }\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._textures = {};\r\n _this._textureArrays = {};\r\n _this._floats = {};\r\n _this._ints = {};\r\n _this._floatsArrays = {};\r\n _this._colors3 = {};\r\n _this._colors3Arrays = {};\r\n _this._colors4 = {};\r\n _this._colors4Arrays = {};\r\n _this._vectors2 = {};\r\n _this._vectors3 = {};\r\n _this._vectors4 = {};\r\n _this._matrices = {};\r\n _this._matrixArrays = {};\r\n _this._matrices3x3 = {};\r\n _this._matrices2x2 = {};\r\n _this._vectors2Arrays = {};\r\n _this._vectors3Arrays = {};\r\n _this._vectors4Arrays = {};\r\n _this._cachedWorldViewMatrix = new Matrix();\r\n _this._cachedWorldViewProjectionMatrix = new Matrix();\r\n _this._multiview = false;\r\n _this._shaderPath = shaderPath;\r\n _this._options = __assign({ needAlphaBlending: false, needAlphaTesting: false, attributes: [\"position\", \"normal\", \"uv\"], uniforms: [\"worldViewProjection\"], uniformBuffers: [], samplers: [], defines: [] }, options);\r\n return _this;\r\n }\r\n Object.defineProperty(ShaderMaterial.prototype, \"shaderPath\", {\r\n /**\r\n * Gets the shader path used to define the shader code\r\n * It can be modified to trigger a new compilation\r\n */\r\n get: function () {\r\n return this._shaderPath;\r\n },\r\n /**\r\n * Sets the shader path used to define the shader code\r\n * It can be modified to trigger a new compilation\r\n */\r\n set: function (shaderPath) {\r\n this._shaderPath = shaderPath;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShaderMaterial.prototype, \"options\", {\r\n /**\r\n * Gets the options used to compile the shader.\r\n * They can be modified to trigger a new compilation\r\n */\r\n get: function () {\r\n return this._options;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current class name of the material e.g. \"ShaderMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n ShaderMaterial.prototype.getClassName = function () {\r\n return \"ShaderMaterial\";\r\n };\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n ShaderMaterial.prototype.needAlphaBlending = function () {\r\n return (this.alpha < 1.0) || this._options.needAlphaBlending;\r\n };\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns a boolean specifying if an alpha test is needed.\r\n */\r\n ShaderMaterial.prototype.needAlphaTesting = function () {\r\n return this._options.needAlphaTesting;\r\n };\r\n ShaderMaterial.prototype._checkUniform = function (uniformName) {\r\n if (this._options.uniforms.indexOf(uniformName) === -1) {\r\n this._options.uniforms.push(uniformName);\r\n }\r\n };\r\n /**\r\n * Set a texture in the shader.\r\n * @param name Define the name of the uniform samplers as defined in the shader\r\n * @param texture Define the texture to bind to this sampler\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setTexture = function (name, texture) {\r\n if (this._options.samplers.indexOf(name) === -1) {\r\n this._options.samplers.push(name);\r\n }\r\n this._textures[name] = texture;\r\n return this;\r\n };\r\n /**\r\n * Set a texture array in the shader.\r\n * @param name Define the name of the uniform sampler array as defined in the shader\r\n * @param textures Define the list of textures to bind to this sampler\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setTextureArray = function (name, textures) {\r\n if (this._options.samplers.indexOf(name) === -1) {\r\n this._options.samplers.push(name);\r\n }\r\n this._checkUniform(name);\r\n this._textureArrays[name] = textures;\r\n return this;\r\n };\r\n /**\r\n * Set a float in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setFloat = function (name, value) {\r\n this._checkUniform(name);\r\n this._floats[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a int in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setInt = function (name, value) {\r\n this._checkUniform(name);\r\n this._ints[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set an array of floats in the shader.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setFloats = function (name, value) {\r\n this._checkUniform(name);\r\n this._floatsArrays[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 in the shader from a Color3.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 array in the shader from a Color3 array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor3Array = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors3Arrays[name] = value.reduce(function (arr, color) {\r\n color.toArray(arr, arr.length);\r\n return arr;\r\n }, []);\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 in the shader from a Color4.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor4 = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors4[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 array in the shader from a Color4 array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setColor4Array = function (name, value) {\r\n this._checkUniform(name);\r\n this._colors4Arrays[name] = value.reduce(function (arr, color) {\r\n color.toArray(arr, arr.length);\r\n return arr;\r\n }, []);\r\n return this;\r\n };\r\n /**\r\n * Set a vec2 in the shader from a Vector2.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setVector2 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors2[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 in the shader from a Vector3.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setVector3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 in the shader from a Vector4.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setVector4 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors4[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a mat4 in the shader from a Matrix.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setMatrix = function (name, value) {\r\n this._checkUniform(name);\r\n this._matrices[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a float32Array in the shader from a matrix array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setMatrices = function (name, value) {\r\n this._checkUniform(name);\r\n var float32Array = new Float32Array(value.length * 16);\r\n for (var index = 0; index < value.length; index++) {\r\n var matrix = value[index];\r\n matrix.copyToArray(float32Array, index * 16);\r\n }\r\n this._matrixArrays[name] = float32Array;\r\n return this;\r\n };\r\n /**\r\n * Set a mat3 in the shader from a Float32Array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setMatrix3x3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._matrices3x3[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a mat2 in the shader from a Float32Array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setMatrix2x2 = function (name, value) {\r\n this._checkUniform(name);\r\n this._matrices2x2[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec2 array in the shader from a number array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setArray2 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors2Arrays[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec3 array in the shader from a number array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setArray3 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors3Arrays[name] = value;\r\n return this;\r\n };\r\n /**\r\n * Set a vec4 array in the shader from a number array.\r\n * @param name Define the name of the uniform as defined in the shader\r\n * @param value Define the value to give to the uniform\r\n * @return the material itself allowing \"fluent\" like uniform updates\r\n */\r\n ShaderMaterial.prototype.setArray4 = function (name, value) {\r\n this._checkUniform(name);\r\n this._vectors4Arrays[name] = value;\r\n return this;\r\n };\r\n ShaderMaterial.prototype._checkCache = function (mesh, useInstances) {\r\n if (!mesh) {\r\n return true;\r\n }\r\n if (this._effect && (this._effect.defines.indexOf(\"#define INSTANCES\") !== -1) !== useInstances) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n ShaderMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n return this.isReady(mesh, useInstances);\r\n };\r\n /**\r\n * Checks if the material is ready to render the requested mesh\r\n * @param mesh Define the mesh to render\r\n * @param useInstances Define whether or not the material is used with instances\r\n * @returns true if ready, otherwise false\r\n */\r\n ShaderMaterial.prototype.isReady = function (mesh, useInstances) {\r\n var _a, _b;\r\n if (this._effect && this.isFrozen) {\r\n if (this._effect._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (!this.checkReadyOnEveryCall) {\r\n if (this._renderId === scene.getRenderId()) {\r\n if (this._checkCache(mesh, useInstances)) {\r\n return true;\r\n }\r\n }\r\n }\r\n // Instances\r\n var defines = [];\r\n var attribs = [];\r\n var fallbacks = new EffectFallbacks();\r\n // global multiview\r\n if (engine.getCaps().multiview &&\r\n scene.activeCamera &&\r\n scene.activeCamera.outputRenderTarget &&\r\n scene.activeCamera.outputRenderTarget.getViewCount() > 1) {\r\n this._multiview = true;\r\n defines.push(\"#define MULTIVIEW\");\r\n if (this._options.uniforms.indexOf(\"viewProjection\") !== -1 &&\r\n this._options.uniforms.push(\"viewProjectionR\") === -1) {\r\n this._options.uniforms.push(\"viewProjectionR\");\r\n }\r\n }\r\n for (var index = 0; index < this._options.defines.length; index++) {\r\n defines.push(this._options.defines[index]);\r\n }\r\n for (var index = 0; index < this._options.attributes.length; index++) {\r\n attribs.push(this._options.attributes[index]);\r\n }\r\n if (mesh && mesh.isVerticesDataPresent(VertexBuffer.ColorKind)) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n defines.push(\"#define VERTEXCOLOR\");\r\n }\r\n if (useInstances) {\r\n defines.push(\"#define INSTANCES\");\r\n MaterialHelper.PushAttributesForInstances(attribs);\r\n if (mesh === null || mesh === void 0 ? void 0 : mesh.hasThinInstances) {\r\n defines.push(\"#define THIN_INSTANCES\");\r\n }\r\n }\r\n // Bones\r\n var numInfluencers = 0;\r\n if (mesh && mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\r\n attribs.push(VertexBuffer.MatricesIndicesKind);\r\n attribs.push(VertexBuffer.MatricesWeightsKind);\r\n if (mesh.numBoneInfluencers > 4) {\r\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\r\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\r\n }\r\n var skeleton = mesh.skeleton;\r\n numInfluencers = mesh.numBoneInfluencers;\r\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + numInfluencers);\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n if (skeleton.isUsingTextureForMatrices) {\r\n defines.push(\"#define BONETEXTURE\");\r\n if (this._options.uniforms.indexOf(\"boneTextureWidth\") === -1) {\r\n this._options.uniforms.push(\"boneTextureWidth\");\r\n }\r\n if (this._options.samplers.indexOf(\"boneSampler\") === -1) {\r\n this._options.samplers.push(\"boneSampler\");\r\n }\r\n }\r\n else {\r\n defines.push(\"#define BonesPerMesh \" + (skeleton.bones.length + 1));\r\n if (this._options.uniforms.indexOf(\"mBones\") === -1) {\r\n this._options.uniforms.push(\"mBones\");\r\n }\r\n }\r\n }\r\n else {\r\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\r\n }\r\n // Textures\r\n for (var name in this._textures) {\r\n if (!this._textures[name].isReady()) {\r\n return false;\r\n }\r\n }\r\n // Alpha test\r\n if (mesh && this._shouldTurnAlphaTestOn(mesh)) {\r\n defines.push(\"#define ALPHATEST\");\r\n }\r\n var shaderName = this._shaderPath, uniforms = this._options.uniforms, uniformBuffers = this._options.uniformBuffers, samplers = this._options.samplers;\r\n if (this.customShaderNameResolve) {\r\n uniforms = uniforms.slice();\r\n uniformBuffers = uniformBuffers.slice();\r\n samplers = samplers.slice();\r\n shaderName = this.customShaderNameResolve(shaderName, uniforms, uniformBuffers, samplers, defines, attribs);\r\n }\r\n var previousEffect = this._effect;\r\n var join = defines.join(\"\\n\");\r\n if (this._cachedDefines !== join) {\r\n this._cachedDefines = join;\r\n this._effect = engine.createEffect(shaderName, {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousMorphTargets: numInfluencers }\r\n }, engine);\r\n if (this._onEffectCreatedObservable) {\r\n onCreatedEffectParameters.effect = this._effect;\r\n this._onEffectCreatedObservable.notifyObservers(onCreatedEffectParameters);\r\n }\r\n }\r\n if ((_b = !((_a = this._effect) === null || _a === void 0 ? void 0 : _a.isReady())) !== null && _b !== void 0 ? _b : true) {\r\n return false;\r\n }\r\n if (previousEffect !== this._effect) {\r\n scene.resetCachedMaterial();\r\n }\r\n this._renderId = scene.getRenderId();\r\n this._effect._wasPreviouslyReady = true;\r\n return true;\r\n };\r\n /**\r\n * Binds the world matrix to the material\r\n * @param world defines the world transformation matrix\r\n * @param effectOverride - If provided, use this effect instead of internal effect\r\n */\r\n ShaderMaterial.prototype.bindOnlyWorldMatrix = function (world, effectOverride) {\r\n var scene = this.getScene();\r\n var effect = effectOverride !== null && effectOverride !== void 0 ? effectOverride : this._effect;\r\n if (!effect) {\r\n return;\r\n }\r\n if (this._options.uniforms.indexOf(\"world\") !== -1) {\r\n effect.setMatrix(\"world\", world);\r\n }\r\n if (this._options.uniforms.indexOf(\"worldView\") !== -1) {\r\n world.multiplyToRef(scene.getViewMatrix(), this._cachedWorldViewMatrix);\r\n effect.setMatrix(\"worldView\", this._cachedWorldViewMatrix);\r\n }\r\n if (this._options.uniforms.indexOf(\"worldViewProjection\") !== -1) {\r\n world.multiplyToRef(scene.getTransformMatrix(), this._cachedWorldViewProjectionMatrix);\r\n effect.setMatrix(\"worldViewProjection\", this._cachedWorldViewProjectionMatrix);\r\n }\r\n };\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n ShaderMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n this.bind(world, mesh, subMesh._effectOverride);\r\n };\r\n /**\r\n * Binds the material to the mesh\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh to bind the material to\r\n * @param effectOverride - If provided, use this effect instead of internal effect\r\n */\r\n ShaderMaterial.prototype.bind = function (world, mesh, effectOverride) {\r\n // Std values\r\n this.bindOnlyWorldMatrix(world, effectOverride);\r\n var effect = effectOverride !== null && effectOverride !== void 0 ? effectOverride : this._effect;\r\n if (effect && this.getScene().getCachedMaterial() !== this) {\r\n if (this._options.uniforms.indexOf(\"view\") !== -1) {\r\n effect.setMatrix(\"view\", this.getScene().getViewMatrix());\r\n }\r\n if (this._options.uniforms.indexOf(\"projection\") !== -1) {\r\n effect.setMatrix(\"projection\", this.getScene().getProjectionMatrix());\r\n }\r\n if (this._options.uniforms.indexOf(\"viewProjection\") !== -1) {\r\n effect.setMatrix(\"viewProjection\", this.getScene().getTransformMatrix());\r\n if (this._multiview) {\r\n effect.setMatrix(\"viewProjectionR\", this.getScene()._transformMatrixR);\r\n }\r\n }\r\n if (this.getScene().activeCamera && this._options.uniforms.indexOf(\"cameraPosition\") !== -1) {\r\n effect.setVector3(\"cameraPosition\", this.getScene().activeCamera.globalPosition);\r\n }\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, effect);\r\n var name;\r\n // Texture\r\n for (name in this._textures) {\r\n effect.setTexture(name, this._textures[name]);\r\n }\r\n // Texture arrays\r\n for (name in this._textureArrays) {\r\n effect.setTextureArray(name, this._textureArrays[name]);\r\n }\r\n // Int\r\n for (name in this._ints) {\r\n effect.setInt(name, this._ints[name]);\r\n }\r\n // Float\r\n for (name in this._floats) {\r\n effect.setFloat(name, this._floats[name]);\r\n }\r\n // Floats\r\n for (name in this._floatsArrays) {\r\n effect.setArray(name, this._floatsArrays[name]);\r\n }\r\n // Color3\r\n for (name in this._colors3) {\r\n effect.setColor3(name, this._colors3[name]);\r\n }\r\n // Color3Array\r\n for (name in this._colors3Arrays) {\r\n effect.setArray3(name, this._colors3Arrays[name]);\r\n }\r\n // Color4\r\n for (name in this._colors4) {\r\n var color = this._colors4[name];\r\n effect.setFloat4(name, color.r, color.g, color.b, color.a);\r\n }\r\n // Color4Array\r\n for (name in this._colors4Arrays) {\r\n effect.setArray4(name, this._colors4Arrays[name]);\r\n }\r\n // Vector2\r\n for (name in this._vectors2) {\r\n effect.setVector2(name, this._vectors2[name]);\r\n }\r\n // Vector3\r\n for (name in this._vectors3) {\r\n effect.setVector3(name, this._vectors3[name]);\r\n }\r\n // Vector4\r\n for (name in this._vectors4) {\r\n effect.setVector4(name, this._vectors4[name]);\r\n }\r\n // Matrix\r\n for (name in this._matrices) {\r\n effect.setMatrix(name, this._matrices[name]);\r\n }\r\n // MatrixArray\r\n for (name in this._matrixArrays) {\r\n effect.setMatrices(name, this._matrixArrays[name]);\r\n }\r\n // Matrix 3x3\r\n for (name in this._matrices3x3) {\r\n effect.setMatrix3x3(name, this._matrices3x3[name]);\r\n }\r\n // Matrix 2x2\r\n for (name in this._matrices2x2) {\r\n effect.setMatrix2x2(name, this._matrices2x2[name]);\r\n }\r\n // Vector2Array\r\n for (name in this._vectors2Arrays) {\r\n effect.setArray2(name, this._vectors2Arrays[name]);\r\n }\r\n // Vector3Array\r\n for (name in this._vectors3Arrays) {\r\n effect.setArray3(name, this._vectors3Arrays[name]);\r\n }\r\n // Vector4Array\r\n for (name in this._vectors4Arrays) {\r\n effect.setArray4(name, this._vectors4Arrays[name]);\r\n }\r\n }\r\n var seffect = this._effect;\r\n this._effect = effect; // make sure the active effect is the right one if there are some observers for onBind that would need to get the current effect\r\n this._afterBind(mesh);\r\n this._effect = seffect;\r\n };\r\n ShaderMaterial.prototype._afterBind = function (mesh) {\r\n _super.prototype._afterBind.call(this, mesh);\r\n this.getScene()._cachedEffect = this._effect;\r\n };\r\n /**\r\n * Gets the active textures from the material\r\n * @returns an array of textures\r\n */\r\n ShaderMaterial.prototype.getActiveTextures = function () {\r\n var activeTextures = _super.prototype.getActiveTextures.call(this);\r\n for (var name in this._textures) {\r\n activeTextures.push(this._textures[name]);\r\n }\r\n for (var name in this._textureArrays) {\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n activeTextures.push(array[index]);\r\n }\r\n }\r\n return activeTextures;\r\n };\r\n /**\r\n * Specifies if the material uses a texture\r\n * @param texture defines the texture to check against the material\r\n * @returns a boolean specifying if the material uses the texture\r\n */\r\n ShaderMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n for (var name in this._textures) {\r\n if (this._textures[name] === texture) {\r\n return true;\r\n }\r\n }\r\n for (var name in this._textureArrays) {\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n if (array[index] === texture) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n ShaderMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n var result = SerializationHelper.Clone(function () { return new ShaderMaterial(name, _this.getScene(), _this._shaderPath, _this._options); }, this);\r\n result.name = name;\r\n result.id = name;\r\n // Shader code path\r\n if (typeof result._shaderPath === 'object') {\r\n result._shaderPath = __assign({}, result._shaderPath);\r\n }\r\n // Options\r\n this._options = __assign({}, this._options);\r\n Object.keys(this._options).forEach(function (propName) {\r\n var propValue = _this._options[propName];\r\n if (Array.isArray(propValue)) {\r\n _this._options[propName] = propValue.slice(0);\r\n }\r\n });\r\n // Texture\r\n for (var key in this._textures) {\r\n result.setTexture(key, this._textures[key]);\r\n }\r\n // Float\r\n for (var key in this._floats) {\r\n result.setFloat(key, this._floats[key]);\r\n }\r\n // Floats\r\n for (var key in this._floatsArrays) {\r\n result.setFloats(key, this._floatsArrays[key]);\r\n }\r\n // Color3\r\n for (var key in this._colors3) {\r\n result.setColor3(key, this._colors3[key]);\r\n }\r\n // Color4\r\n for (var key in this._colors4) {\r\n result.setColor4(key, this._colors4[key]);\r\n }\r\n // Vector2\r\n for (var key in this._vectors2) {\r\n result.setVector2(key, this._vectors2[key]);\r\n }\r\n // Vector3\r\n for (var key in this._vectors3) {\r\n result.setVector3(key, this._vectors3[key]);\r\n }\r\n // Vector4\r\n for (var key in this._vectors4) {\r\n result.setVector4(key, this._vectors4[key]);\r\n }\r\n // Matrix\r\n for (var key in this._matrices) {\r\n result.setMatrix(key, this._matrices[key]);\r\n }\r\n // Matrix 3x3\r\n for (var key in this._matrices3x3) {\r\n result.setMatrix3x3(key, this._matrices3x3[key]);\r\n }\r\n // Matrix 2x2\r\n for (var key in this._matrices2x2) {\r\n result.setMatrix2x2(key, this._matrices2x2[key]);\r\n }\r\n return result;\r\n };\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\r\n * @param notBoundToMesh specifies if the material that is being disposed is known to be not bound to any mesh\r\n */\r\n ShaderMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures, notBoundToMesh) {\r\n if (forceDisposeTextures) {\r\n var name;\r\n for (name in this._textures) {\r\n this._textures[name].dispose();\r\n }\r\n for (name in this._textureArrays) {\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n array[index].dispose();\r\n }\r\n }\r\n }\r\n this._textures = {};\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures, notBoundToMesh);\r\n };\r\n /**\r\n * Serializes this material in a JSON representation\r\n * @returns the serialized material object\r\n */\r\n ShaderMaterial.prototype.serialize = function () {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.ShaderMaterial\";\r\n serializationObject.options = this._options;\r\n serializationObject.shaderPath = this._shaderPath;\r\n var name;\r\n // Texture\r\n serializationObject.textures = {};\r\n for (name in this._textures) {\r\n serializationObject.textures[name] = this._textures[name].serialize();\r\n }\r\n // Texture arrays\r\n serializationObject.textureArrays = {};\r\n for (name in this._textureArrays) {\r\n serializationObject.textureArrays[name] = [];\r\n var array = this._textureArrays[name];\r\n for (var index = 0; index < array.length; index++) {\r\n serializationObject.textureArrays[name].push(array[index].serialize());\r\n }\r\n }\r\n // Float\r\n serializationObject.floats = {};\r\n for (name in this._floats) {\r\n serializationObject.floats[name] = this._floats[name];\r\n }\r\n // Floats\r\n serializationObject.FloatArrays = {};\r\n for (name in this._floatsArrays) {\r\n serializationObject.FloatArrays[name] = this._floatsArrays[name];\r\n }\r\n // Color3\r\n serializationObject.colors3 = {};\r\n for (name in this._colors3) {\r\n serializationObject.colors3[name] = this._colors3[name].asArray();\r\n }\r\n // Color3 array\r\n serializationObject.colors3Arrays = {};\r\n for (name in this._colors3Arrays) {\r\n serializationObject.colors3Arrays[name] = this._colors3Arrays[name];\r\n }\r\n // Color4\r\n serializationObject.colors4 = {};\r\n for (name in this._colors4) {\r\n serializationObject.colors4[name] = this._colors4[name].asArray();\r\n }\r\n // Color4 array\r\n serializationObject.colors4Arrays = {};\r\n for (name in this._colors4Arrays) {\r\n serializationObject.colors4Arrays[name] = this._colors4Arrays[name];\r\n }\r\n // Vector2\r\n serializationObject.vectors2 = {};\r\n for (name in this._vectors2) {\r\n serializationObject.vectors2[name] = this._vectors2[name].asArray();\r\n }\r\n // Vector3\r\n serializationObject.vectors3 = {};\r\n for (name in this._vectors3) {\r\n serializationObject.vectors3[name] = this._vectors3[name].asArray();\r\n }\r\n // Vector4\r\n serializationObject.vectors4 = {};\r\n for (name in this._vectors4) {\r\n serializationObject.vectors4[name] = this._vectors4[name].asArray();\r\n }\r\n // Matrix\r\n serializationObject.matrices = {};\r\n for (name in this._matrices) {\r\n serializationObject.matrices[name] = this._matrices[name].asArray();\r\n }\r\n // MatrixArray\r\n serializationObject.matrixArray = {};\r\n for (name in this._matrixArrays) {\r\n serializationObject.matrixArray[name] = this._matrixArrays[name];\r\n }\r\n // Matrix 3x3\r\n serializationObject.matrices3x3 = {};\r\n for (name in this._matrices3x3) {\r\n serializationObject.matrices3x3[name] = this._matrices3x3[name];\r\n }\r\n // Matrix 2x2\r\n serializationObject.matrices2x2 = {};\r\n for (name in this._matrices2x2) {\r\n serializationObject.matrices2x2[name] = this._matrices2x2[name];\r\n }\r\n // Vector2Array\r\n serializationObject.vectors2Arrays = {};\r\n for (name in this._vectors2Arrays) {\r\n serializationObject.vectors2Arrays[name] = this._vectors2Arrays[name];\r\n }\r\n // Vector3Array\r\n serializationObject.vectors3Arrays = {};\r\n for (name in this._vectors3Arrays) {\r\n serializationObject.vectors3Arrays[name] = this._vectors3Arrays[name];\r\n }\r\n // Vector4Array\r\n serializationObject.vectors4Arrays = {};\r\n for (name in this._vectors4Arrays) {\r\n serializationObject.vectors4Arrays[name] = this._vectors4Arrays[name];\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a shader material from parsed shader material data\r\n * @param source defines the JSON represnetation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new material\r\n */\r\n ShaderMaterial.Parse = function (source, scene, rootUrl) {\r\n var material = SerializationHelper.Parse(function () { return new ShaderMaterial(source.name, scene, source.shaderPath, source.options); }, source, scene, rootUrl);\r\n var name;\r\n // Texture\r\n for (name in source.textures) {\r\n material.setTexture(name, Texture.Parse(source.textures[name], scene, rootUrl));\r\n }\r\n // Texture arrays\r\n for (name in source.textureArrays) {\r\n var array = source.textureArrays[name];\r\n var textureArray = new Array();\r\n for (var index = 0; index < array.length; index++) {\r\n textureArray.push(Texture.Parse(array[index], scene, rootUrl));\r\n }\r\n material.setTextureArray(name, textureArray);\r\n }\r\n // Float\r\n for (name in source.floats) {\r\n material.setFloat(name, source.floats[name]);\r\n }\r\n // Float s\r\n for (name in source.floatsArrays) {\r\n material.setFloats(name, source.floatsArrays[name]);\r\n }\r\n // Color3\r\n for (name in source.colors3) {\r\n material.setColor3(name, Color3.FromArray(source.colors3[name]));\r\n }\r\n // Color3 arrays\r\n for (name in source.colors3Arrays) {\r\n var colors = source.colors3Arrays[name].reduce(function (arr, num, i) {\r\n if (i % 3 === 0) {\r\n arr.push([num]);\r\n }\r\n else {\r\n arr[arr.length - 1].push(num);\r\n }\r\n return arr;\r\n }, []).map(function (color) { return Color3.FromArray(color); });\r\n material.setColor3Array(name, colors);\r\n }\r\n // Color4\r\n for (name in source.colors4) {\r\n material.setColor4(name, Color4.FromArray(source.colors4[name]));\r\n }\r\n // Color4 arrays\r\n for (name in source.colors4Arrays) {\r\n var colors = source.colors4Arrays[name].reduce(function (arr, num, i) {\r\n if (i % 4 === 0) {\r\n arr.push([num]);\r\n }\r\n else {\r\n arr[arr.length - 1].push(num);\r\n }\r\n return arr;\r\n }, []).map(function (color) { return Color4.FromArray(color); });\r\n material.setColor4Array(name, colors);\r\n }\r\n // Vector2\r\n for (name in source.vectors2) {\r\n material.setVector2(name, Vector2.FromArray(source.vectors2[name]));\r\n }\r\n // Vector3\r\n for (name in source.vectors3) {\r\n material.setVector3(name, Vector3.FromArray(source.vectors3[name]));\r\n }\r\n // Vector4\r\n for (name in source.vectors4) {\r\n material.setVector4(name, Vector4.FromArray(source.vectors4[name]));\r\n }\r\n // Matrix\r\n for (name in source.matrices) {\r\n material.setMatrix(name, Matrix.FromArray(source.matrices[name]));\r\n }\r\n // MatrixArray\r\n for (name in source.matrixArray) {\r\n material._matrixArrays[name] = new Float32Array(source.matrixArray[name]);\r\n }\r\n // Matrix 3x3\r\n for (name in source.matrices3x3) {\r\n material.setMatrix3x3(name, source.matrices3x3[name]);\r\n }\r\n // Matrix 2x2\r\n for (name in source.matrices2x2) {\r\n material.setMatrix2x2(name, source.matrices2x2[name]);\r\n }\r\n // Vector2Array\r\n for (name in source.vectors2Arrays) {\r\n material.setArray2(name, source.vectors2Arrays[name]);\r\n }\r\n // Vector3Array\r\n for (name in source.vectors3Arrays) {\r\n material.setArray3(name, source.vectors3Arrays[name]);\r\n }\r\n // Vector4Array\r\n for (name in source.vectors4Arrays) {\r\n material.setArray4(name, source.vectors4Arrays[name]);\r\n }\r\n return material;\r\n };\r\n /**\r\n * Creates a new ShaderMaterial from a snippet saved in a remote file\r\n * @param name defines the name of the ShaderMaterial to create (can be null or empty to use the one from the json data)\r\n * @param url defines the url to load from\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a promise that will resolve to the new ShaderMaterial\r\n */\r\n ShaderMaterial.ParseFromFileAsync = function (name, url, scene, rootUrl) {\r\n var _this = this;\r\n if (rootUrl === void 0) { rootUrl = \"\"; }\r\n return new Promise(function (resolve, reject) {\r\n var request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", function () {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n var serializationObject = JSON.parse(request.responseText);\r\n var output = _this.Parse(serializationObject, scene || Engine.LastCreatedScene, rootUrl);\r\n if (name) {\r\n output.name = name;\r\n }\r\n resolve(output);\r\n }\r\n else {\r\n reject(\"Unable to load the ShaderMaterial\");\r\n }\r\n }\r\n });\r\n request.open(\"GET\", url);\r\n request.send();\r\n });\r\n };\r\n /**\r\n * Creates a ShaderMaterial from a snippet saved by the Inspector\r\n * @param snippetId defines the snippet to load\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a promise that will resolve to the new ShaderMaterial\r\n */\r\n ShaderMaterial.CreateFromSnippetAsync = function (snippetId, scene, rootUrl) {\r\n var _this = this;\r\n if (rootUrl === void 0) { rootUrl = \"\"; }\r\n return new Promise(function (resolve, reject) {\r\n var request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", function () {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n var snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n var serializationObject = JSON.parse(snippet.shaderMaterial);\r\n var output = _this.Parse(serializationObject, scene || Engine.LastCreatedScene, rootUrl);\r\n output.snippetId = snippetId;\r\n resolve(output);\r\n }\r\n else {\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n request.open(\"GET\", _this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n };\r\n /** Define the Url to load snippets */\r\n ShaderMaterial.SnippetUrl = \"https://snippet.babylonjs.com\";\r\n return ShaderMaterial;\r\n}(Material));\r\nexport { ShaderMaterial };\r\n_TypeStore.RegisteredTypes[\"BABYLON.ShaderMaterial\"] = ShaderMaterial;\r\n//# sourceMappingURL=shaderMaterial.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'defaultFragmentDeclaration';\r\nvar shader = \"uniform vec4 vDiffuseColor;\\n#ifdef SPECULARTERM\\nuniform vec4 vSpecularColor;\\n#endif\\nuniform vec3 vEmissiveColor;\\nuniform float visibility;\\n\\n#ifdef DIFFUSE\\nuniform vec2 vDiffuseInfos;\\n#endif\\n#ifdef AMBIENT\\nuniform vec2 vAmbientInfos;\\n#endif\\n#ifdef OPACITY\\nuniform vec2 vOpacityInfos;\\n#endif\\n#ifdef EMISSIVE\\nuniform vec2 vEmissiveInfos;\\n#endif\\n#ifdef LIGHTMAP\\nuniform vec2 vLightmapInfos;\\n#endif\\n#ifdef BUMP\\nuniform vec3 vBumpInfos;\\nuniform vec2 vTangentSpaceParams;\\n#endif\\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\\nuniform mat4 view;\\n#endif\\n#ifdef REFRACTION\\nuniform vec4 vRefractionInfos;\\n#ifndef REFRACTIONMAP_3D\\nuniform mat4 refractionMatrix;\\n#endif\\n#ifdef REFRACTIONFRESNEL\\nuniform vec4 refractionLeftColor;\\nuniform vec4 refractionRightColor;\\n#endif\\n#endif\\n#if defined(SPECULAR) && defined(SPECULARTERM)\\nuniform vec2 vSpecularInfos;\\n#endif\\n#ifdef DIFFUSEFRESNEL\\nuniform vec4 diffuseLeftColor;\\nuniform vec4 diffuseRightColor;\\n#endif\\n#ifdef OPACITYFRESNEL\\nuniform vec4 opacityParts;\\n#endif\\n#ifdef EMISSIVEFRESNEL\\nuniform vec4 emissiveLeftColor;\\nuniform vec4 emissiveRightColor;\\n#endif\\n\\n#ifdef REFLECTION\\nuniform vec2 vReflectionInfos;\\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)\\nuniform mat4 reflectionMatrix;\\n#endif\\n#ifndef REFLECTIONMAP_SKYBOX\\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\\nuniform vec3 vReflectionPosition;\\nuniform vec3 vReflectionSize;\\n#endif\\n#endif\\n#ifdef REFLECTIONFRESNEL\\nuniform vec4 reflectionLeftColor;\\nuniform vec4 reflectionRightColor;\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var defaultFragmentDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=defaultFragmentDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'defaultUboDeclaration';\r\nvar shader = \"layout(std140,column_major) uniform;\\nuniform Material\\n{\\nvec4 diffuseLeftColor;\\nvec4 diffuseRightColor;\\nvec4 opacityParts;\\nvec4 reflectionLeftColor;\\nvec4 reflectionRightColor;\\nvec4 refractionLeftColor;\\nvec4 refractionRightColor;\\nvec4 emissiveLeftColor;\\nvec4 emissiveRightColor;\\nvec2 vDiffuseInfos;\\nvec2 vAmbientInfos;\\nvec2 vOpacityInfos;\\nvec2 vReflectionInfos;\\nvec3 vReflectionPosition;\\nvec3 vReflectionSize;\\nvec2 vEmissiveInfos;\\nvec2 vLightmapInfos;\\nvec2 vSpecularInfos;\\nvec3 vBumpInfos;\\nmat4 diffuseMatrix;\\nmat4 ambientMatrix;\\nmat4 opacityMatrix;\\nmat4 reflectionMatrix;\\nmat4 emissiveMatrix;\\nmat4 lightmapMatrix;\\nmat4 specularMatrix;\\nmat4 bumpMatrix;\\nvec2 vTangentSpaceParams;\\nfloat pointSize;\\nmat4 refractionMatrix;\\nvec4 vRefractionInfos;\\nvec4 vSpecularColor;\\nvec3 vEmissiveColor;\\nfloat visibility;\\nvec4 vDiffuseColor;\\nvec4 vDetailInfos;\\nmat4 detailMatrix;\\n};\\nuniform Scene {\\nmat4 viewProjection;\\n#ifdef MULTIVIEW\\nmat4 viewProjectionR;\\n#endif\\nmat4 view;\\n};\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var defaultUboDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=defaultUboDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'lightsFragmentFunctions';\r\nvar shader = \"\\nstruct lightingInfo\\n{\\nvec3 diffuse;\\n#ifdef SPECULARTERM\\nvec3 specular;\\n#endif\\n#ifdef NDOTL\\nfloat ndl;\\n#endif\\n};\\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\\nlightingInfo result;\\nvec3 lightVectorW;\\nfloat attenuation=1.0;\\nif (lightData.w == 0.)\\n{\\nvec3 direction=lightData.xyz-vPositionW;\\nattenuation=max(0.,1.0-length(direction)/range);\\nlightVectorW=normalize(direction);\\n}\\nelse\\n{\\nlightVectorW=normalize(-lightData.xyz);\\n}\\n\\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=ndl*diffuseColor*attenuation;\\n#ifdef SPECULARTERM\\n\\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor*attenuation;\\n#endif\\nreturn result;\\n}\\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\\nlightingInfo result;\\nvec3 direction=lightData.xyz-vPositionW;\\nvec3 lightVectorW=normalize(direction);\\nfloat attenuation=max(0.,1.0-length(direction)/range);\\n\\nfloat cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));\\nif (cosAngle>=lightDirection.w)\\n{\\ncosAngle=max(0.,pow(cosAngle,lightData.w));\\nattenuation*=cosAngle;\\n\\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=ndl*diffuseColor*attenuation;\\n#ifdef SPECULARTERM\\n\\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor*attenuation;\\n#endif\\nreturn result;\\n}\\nresult.diffuse=vec3(0.);\\n#ifdef SPECULARTERM\\nresult.specular=vec3(0.);\\n#endif\\n#ifdef NDOTL\\nresult.ndl=0.;\\n#endif\\nreturn result;\\n}\\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\\nlightingInfo result;\\n\\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\\n#ifdef SPECULARTERM\\n\\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor;\\n#endif\\nreturn result;\\n}\\n#define inline\\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\\nstrq/=strq.w;\\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\\nreturn textureColor;\\n}\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var lightsFragmentFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=lightsFragmentFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'fresnelFunction';\r\nvar shader = \"#ifdef FRESNEL\\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\\n{\\nfloat fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);\\nreturn clamp(fresnelTerm,0.,1.);\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var fresnelFunction = { name: name, shader: shader };\r\n//# sourceMappingURL=fresnelFunction.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/defaultFragmentDeclaration\";\r\nimport \"./ShadersInclude/defaultUboDeclaration\";\r\nimport \"./ShadersInclude/prePassDeclaration\";\r\nimport \"./ShadersInclude/helperFunctions\";\r\nimport \"./ShadersInclude/lightFragmentDeclaration\";\r\nimport \"./ShadersInclude/lightUboDeclaration\";\r\nimport \"./ShadersInclude/lightsFragmentFunctions\";\r\nimport \"./ShadersInclude/shadowsFragmentFunctions\";\r\nimport \"./ShadersInclude/fresnelFunction\";\r\nimport \"./ShadersInclude/reflectionFunction\";\r\nimport \"./ShadersInclude/imageProcessingDeclaration\";\r\nimport \"./ShadersInclude/imageProcessingFunctions\";\r\nimport \"./ShadersInclude/bumpFragmentMainFunctions\";\r\nimport \"./ShadersInclude/bumpFragmentFunctions\";\r\nimport \"./ShadersInclude/clipPlaneFragmentDeclaration\";\r\nimport \"./ShadersInclude/logDepthDeclaration\";\r\nimport \"./ShadersInclude/fogFragmentDeclaration\";\r\nimport \"./ShadersInclude/clipPlaneFragment\";\r\nimport \"./ShadersInclude/bumpFragment\";\r\nimport \"./ShadersInclude/depthPrePass\";\r\nimport \"./ShadersInclude/lightFragment\";\r\nimport \"./ShadersInclude/logDepthFragment\";\r\nimport \"./ShadersInclude/fogFragment\";\r\nvar name = 'defaultPixelShader';\r\nvar shader = \"#include<__decl__defaultFragment>\\n#if defined(BUMP) || !defined(NORMAL)\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\n#include[SCENE_MRT_COUNT]\\n#define CUSTOM_FRAGMENT_BEGIN\\n#ifdef LOGARITHMICDEPTH\\n#extension GL_EXT_frag_depth : enable\\n#endif\\n\\n#define RECIPROCAL_PI2 0.15915494\\nuniform vec3 vEyePosition;\\nuniform vec3 vAmbientColor;\\n\\nvarying vec3 vPositionW;\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#endif\\n#ifdef VERTEXCOLOR\\nvarying vec4 vColor;\\n#endif\\n#ifdef MAINUV1\\nvarying vec2 vMainUV1;\\n#endif\\n#ifdef MAINUV2\\nvarying vec2 vMainUV2;\\n#endif\\n\\n#include\\n\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#include\\n#include\\n\\n#ifdef DIFFUSE\\n#if DIFFUSEDIRECTUV == 1\\n#define vDiffuseUV vMainUV1\\n#elif DIFFUSEDIRECTUV == 2\\n#define vDiffuseUV vMainUV2\\n#else\\nvarying vec2 vDiffuseUV;\\n#endif\\nuniform sampler2D diffuseSampler;\\n#endif\\n#ifdef AMBIENT\\n#if AMBIENTDIRECTUV == 1\\n#define vAmbientUV vMainUV1\\n#elif AMBIENTDIRECTUV == 2\\n#define vAmbientUV vMainUV2\\n#else\\nvarying vec2 vAmbientUV;\\n#endif\\nuniform sampler2D ambientSampler;\\n#endif\\n#ifdef OPACITY\\n#if OPACITYDIRECTUV == 1\\n#define vOpacityUV vMainUV1\\n#elif OPACITYDIRECTUV == 2\\n#define vOpacityUV vMainUV2\\n#else\\nvarying vec2 vOpacityUV;\\n#endif\\nuniform sampler2D opacitySampler;\\n#endif\\n#ifdef EMISSIVE\\n#if EMISSIVEDIRECTUV == 1\\n#define vEmissiveUV vMainUV1\\n#elif EMISSIVEDIRECTUV == 2\\n#define vEmissiveUV vMainUV2\\n#else\\nvarying vec2 vEmissiveUV;\\n#endif\\nuniform sampler2D emissiveSampler;\\n#endif\\n#ifdef LIGHTMAP\\n#if LIGHTMAPDIRECTUV == 1\\n#define vLightmapUV vMainUV1\\n#elif LIGHTMAPDIRECTUV == 2\\n#define vLightmapUV vMainUV2\\n#else\\nvarying vec2 vLightmapUV;\\n#endif\\nuniform sampler2D lightmapSampler;\\n#endif\\n#ifdef REFRACTION\\n#ifdef REFRACTIONMAP_3D\\nuniform samplerCube refractionCubeSampler;\\n#else\\nuniform sampler2D refraction2DSampler;\\n#endif\\n#endif\\n#if defined(SPECULAR) && defined(SPECULARTERM)\\n#if SPECULARDIRECTUV == 1\\n#define vSpecularUV vMainUV1\\n#elif SPECULARDIRECTUV == 2\\n#define vSpecularUV vMainUV2\\n#else\\nvarying vec2 vSpecularUV;\\n#endif\\nuniform sampler2D specularSampler;\\n#endif\\n#ifdef ALPHATEST\\nuniform float alphaCutOff;\\n#endif\\n\\n#include\\n\\n#ifdef REFLECTION\\n#ifdef REFLECTIONMAP_3D\\nuniform samplerCube reflectionCubeSampler;\\n#else\\nuniform sampler2D reflection2DSampler;\\n#endif\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#else\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\n#endif\\n#include\\n#endif\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\n#include\\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\\n\\nvec4 baseColor=vec4(1.,1.,1.,1.);\\nvec3 diffuseColor=vDiffuseColor.rgb;\\n\\nfloat alpha=vDiffuseColor.a;\\n\\n#ifdef NORMAL\\nvec3 normalW=normalize(vNormalW);\\n#else\\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\\n#endif\\n#include\\n#ifdef TWOSIDEDLIGHTING\\nnormalW=gl_FrontFacing ? normalW : -normalW;\\n#endif\\n#ifdef DIFFUSE\\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\\n#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)\\nif (baseColor.a\\n#ifdef VERTEXCOLOR\\nbaseColor.rgb*=vColor.rgb;\\n#endif\\n#ifdef DETAIL\\nbaseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\\n\\nvec3 baseAmbientColor=vec3(1.,1.,1.);\\n#ifdef AMBIENT\\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\\n#endif\\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\\n\\n#ifdef SPECULARTERM\\nfloat glossiness=vSpecularColor.a;\\nvec3 specularColor=vSpecularColor.rgb;\\n#ifdef SPECULAR\\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);\\nspecularColor=specularMapColor.rgb;\\n#ifdef GLOSSINESS\\nglossiness=glossiness*specularMapColor.a;\\n#endif\\n#endif\\n#else\\nfloat glossiness=0.;\\n#endif\\n\\nvec3 diffuseBase=vec3(0.,0.,0.);\\nlightingInfo info;\\n#ifdef SPECULARTERM\\nvec3 specularBase=vec3(0.,0.,0.);\\n#endif\\nfloat shadow=1.;\\n#ifdef LIGHTMAP\\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\\n#ifdef RGBDLIGHTMAP\\nlightmapColor.rgb=fromRGBD(lightmapColor);\\n#endif\\nlightmapColor.rgb*=vLightmapInfos.y;\\n#endif\\n#include[0..maxSimultaneousLights]\\n\\nvec4 refractionColor=vec4(0.,0.,0.,1.);\\n#ifdef REFRACTION\\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\\n#ifdef REFRACTIONMAP_3D\\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\\nif (dot(refractionVector,viewDirectionW)<1.0) {\\nrefractionColor=textureCube(refractionCubeSampler,refractionVector);\\n}\\n#else\\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\\nrefractionCoords.y=1.0-refractionCoords.y;\\nrefractionColor=texture2D(refraction2DSampler,refractionCoords);\\n#endif\\n#ifdef RGBDREFRACTION\\nrefractionColor.rgb=fromRGBD(refractionColor);\\n#endif\\n#ifdef IS_REFRACTION_LINEAR\\nrefractionColor.rgb=toGammaSpace(refractionColor.rgb);\\n#endif\\nrefractionColor.rgb*=vRefractionInfos.x;\\n#endif\\n\\nvec4 reflectionColor=vec4(0.,0.,0.,1.);\\n#ifdef REFLECTION\\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\\n#ifdef REFLECTIONMAP_3D\\n#ifdef ROUGHNESS\\nfloat bias=vReflectionInfos.y;\\n#ifdef SPECULARTERM\\n#ifdef SPECULAR\\n#ifdef GLOSSINESS\\nbias*=(1.0-specularMapColor.a);\\n#endif\\n#endif\\n#endif\\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);\\n#else\\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);\\n#endif\\n#else\\nvec2 coords=vReflectionUVW.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\ncoords/=vReflectionUVW.z;\\n#endif\\ncoords.y=1.0-coords.y;\\nreflectionColor=texture2D(reflection2DSampler,coords);\\n#endif\\n#ifdef RGBDREFLECTION\\nreflectionColor.rgb=fromRGBD(reflectionColor);\\n#endif\\n#ifdef IS_REFLECTION_LINEAR\\nreflectionColor.rgb=toGammaSpace(reflectionColor.rgb);\\n#endif\\nreflectionColor.rgb*=vReflectionInfos.x;\\n#ifdef REFLECTIONFRESNEL\\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\\n#ifdef REFLECTIONFRESNELFROMSPECULAR\\n#ifdef SPECULARTERM\\nreflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\\n#else\\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\\n#endif\\n#else\\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\\n#endif\\n#endif\\n#endif\\n#ifdef REFRACTIONFRESNEL\\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);\\nrefractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\\n#endif\\n#ifdef OPACITY\\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\\n#ifdef OPACITYRGB\\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\\n#else\\nalpha*=opacityMap.a*vOpacityInfos.y;\\n#endif\\n#endif\\n#ifdef VERTEXALPHA\\nalpha*=vColor.a;\\n#endif\\n#ifdef OPACITYFRESNEL\\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\\n#endif\\n#ifdef ALPHATEST\\n#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS\\nif (alpha\\n#include\\n\\n\\n#ifdef IMAGEPROCESSINGPOSTPROCESS\\ncolor.rgb=toLinearSpace(color.rgb);\\n#else\\n#ifdef IMAGEPROCESSING\\ncolor.rgb=toLinearSpace(color.rgb);\\ncolor=applyImageProcessing(color);\\n#endif\\n#endif\\ncolor.a*=visibility;\\n#ifdef PREMULTIPLYALPHA\\n\\ncolor.rgb*=color.a;\\n#endif\\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\\n#ifdef PREPASS\\ngl_FragData[0]=color;\\n#ifdef PREPASS_POSITION\\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,1.0);\\n#endif\\n#ifdef PREPASS_VELOCITY\\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\\nvec2 velocity=abs(a-b);\\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\\ngl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\\n#endif\\n#ifdef PREPASS_IRRADIANCE\\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,1.0);\\n#endif\\n#ifdef PREPASS_DEPTHNORMAL\\ngl_FragData[PREPASS_DEPTHNORMAL_INDEX]=vec4(vViewPos.z,(view*vec4(normalW,0.0)).rgb);\\n#endif\\n#ifdef PREPASS_ALBEDO\\ngl_FragData[PREPASS_ALBEDO_INDEX]=vec4(0.0,0.0,0.0,1.0);\\n#endif\\n#ifdef PREPASS_REFLECTIVITY\\n#if defined(SPECULAR)\\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=specularMapColor;\\n#else\\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(0.0,0.0,0.0,1.0);\\n#endif\\n#endif\\n#endif\\n#if !defined(PREPASS) || defined(WEBGL2)\\ngl_FragColor=color;\\n#endif\\n}\\n\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var defaultPixelShader = { name: name, shader: shader };\r\n//# sourceMappingURL=default.fragment.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'defaultVertexDeclaration';\r\nvar shader = \"\\nuniform mat4 viewProjection;\\nuniform mat4 view;\\n#ifdef DIFFUSE\\nuniform mat4 diffuseMatrix;\\nuniform vec2 vDiffuseInfos;\\n#endif\\n#ifdef AMBIENT\\nuniform mat4 ambientMatrix;\\nuniform vec2 vAmbientInfos;\\n#endif\\n#ifdef OPACITY\\nuniform mat4 opacityMatrix;\\nuniform vec2 vOpacityInfos;\\n#endif\\n#ifdef EMISSIVE\\nuniform vec2 vEmissiveInfos;\\nuniform mat4 emissiveMatrix;\\n#endif\\n#ifdef LIGHTMAP\\nuniform vec2 vLightmapInfos;\\nuniform mat4 lightmapMatrix;\\n#endif\\n#if defined(SPECULAR) && defined(SPECULARTERM)\\nuniform vec2 vSpecularInfos;\\nuniform mat4 specularMatrix;\\n#endif\\n#ifdef BUMP\\nuniform vec3 vBumpInfos;\\nuniform mat4 bumpMatrix;\\n#endif\\n#ifdef REFLECTION\\nuniform mat4 reflectionMatrix;\\n#endif\\n#ifdef POINTSIZE\\nuniform float pointSize;\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var defaultVertexDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=defaultVertexDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pointCloudVertex';\r\nvar shader = \"#ifdef POINTSIZE\\ngl_PointSize=pointSize;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pointCloudVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=pointCloudVertex.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/defaultVertexDeclaration\";\r\nimport \"./ShadersInclude/defaultUboDeclaration\";\r\nimport \"./ShadersInclude/helperFunctions\";\r\nimport \"./ShadersInclude/bonesDeclaration\";\r\nimport \"./ShadersInclude/instancesDeclaration\";\r\nimport \"./ShadersInclude/prePassVertexDeclaration\";\r\nimport \"./ShadersInclude/bumpVertexDeclaration\";\r\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\r\nimport \"./ShadersInclude/fogVertexDeclaration\";\r\nimport \"./ShadersInclude/lightFragmentDeclaration\";\r\nimport \"./ShadersInclude/lightUboDeclaration\";\r\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration\";\r\nimport \"./ShadersInclude/morphTargetsVertexDeclaration\";\r\nimport \"./ShadersInclude/logDepthDeclaration\";\r\nimport \"./ShadersInclude/morphTargetsVertex\";\r\nimport \"./ShadersInclude/instancesVertex\";\r\nimport \"./ShadersInclude/bonesVertex\";\r\nimport \"./ShadersInclude/prePassVertex\";\r\nimport \"./ShadersInclude/bumpVertex\";\r\nimport \"./ShadersInclude/clipPlaneVertex\";\r\nimport \"./ShadersInclude/fogVertex\";\r\nimport \"./ShadersInclude/shadowsVertex\";\r\nimport \"./ShadersInclude/pointCloudVertex\";\r\nimport \"./ShadersInclude/logDepthVertex\";\r\nvar name = 'defaultVertexShader';\r\nvar shader = \"#include<__decl__defaultVertex>\\n\\n#define CUSTOM_VERTEX_BEGIN\\nattribute vec3 position;\\n#ifdef NORMAL\\nattribute vec3 normal;\\n#endif\\n#ifdef TANGENT\\nattribute vec4 tangent;\\n#endif\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\n#ifdef VERTEXCOLOR\\nattribute vec4 color;\\n#endif\\n#include\\n#include\\n\\n#include\\n#include\\n#ifdef MAINUV1\\nvarying vec2 vMainUV1;\\n#endif\\n#ifdef MAINUV2\\nvarying vec2 vMainUV2;\\n#endif\\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\\nvarying vec2 vDiffuseUV;\\n#endif\\n#if defined(DETAIL) && DETAILDIRECTUV == 0\\nvarying vec2 vDetailUV;\\n#endif\\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\\nvarying vec2 vAmbientUV;\\n#endif\\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\\nvarying vec2 vOpacityUV;\\n#endif\\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\\nvarying vec2 vEmissiveUV;\\n#endif\\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\\nvarying vec2 vLightmapUV;\\n#endif\\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\\nvarying vec2 vSpecularUV;\\n#endif\\n#if defined(BUMP) && BUMPDIRECTUV == 0\\nvarying vec2 vBumpUV;\\n#endif\\n\\nvarying vec3 vPositionW;\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#endif\\n#ifdef VERTEXCOLOR\\nvarying vec4 vColor;\\n#endif\\n#include\\n#include\\n#include\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\n#include\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\nvec3 positionUpdated=position;\\n#ifdef NORMAL\\nvec3 normalUpdated=normal;\\n#endif\\n#ifdef TANGENT\\nvec4 tangentUpdated=tangent;\\n#endif\\n#ifdef UV1\\nvec2 uvUpdated=uv;\\n#endif\\n#include[0..maxSimultaneousMorphTargets]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvPositionUVW=positionUpdated;\\n#endif\\n#define CUSTOM_VERTEX_UPDATE_POSITION\\n#define CUSTOM_VERTEX_UPDATE_NORMAL\\n#include\\n#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\\n\\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\\n#endif\\n#include\\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\\n#ifdef NORMAL\\nmat3 normalWorld=mat3(finalWorld);\\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));\\nvNormalW=normalize(normalWorld*vNormalW);\\n#else\\n#ifdef NONUNIFORMSCALING\\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\\n#endif\\nvNormalW=normalize(normalWorld*normalUpdated);\\n#endif\\n#endif\\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR == 0u) {\\ngl_Position=viewProjection*worldPos;\\n} else {\\ngl_Position=viewProjectionR*worldPos;\\n}\\n#else\\ngl_Position=viewProjection*worldPos;\\n#endif\\nvPositionW=vec3(worldPos);\\n#include\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\\n#endif\\n\\n#ifndef UV1\\nvec2 uvUpdated=vec2(0.,0.);\\n#endif\\n#ifndef UV2\\nvec2 uv2=vec2(0.,0.);\\n#endif\\n#ifdef MAINUV1\\nvMainUV1=uvUpdated;\\n#endif\\n#ifdef MAINUV2\\nvMainUV2=uv2;\\n#endif\\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\\nif (vDiffuseInfos.x == 0.)\\n{\\nvDiffuseUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(DETAIL) && DETAILDIRECTUV == 0\\nif (vDetailInfos.x == 0.)\\n{\\nvDetailUV=vec2(detailMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvDetailUV=vec2(detailMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\\nif (vAmbientInfos.x == 0.)\\n{\\nvAmbientUV=vec2(ambientMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\\nif (vOpacityInfos.x == 0.)\\n{\\nvOpacityUV=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\\nif (vEmissiveInfos.x == 0.)\\n{\\nvEmissiveUV=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\\nif (vLightmapInfos.x == 0.)\\n{\\nvLightmapUV=vec2(lightmapMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\\nif (vSpecularInfos.x == 0.)\\n{\\nvSpecularUV=vec2(specularMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvSpecularUV=vec2(specularMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(BUMP) && BUMPDIRECTUV == 0\\nif (vBumpInfos.x == 0.)\\n{\\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#include\\n#include\\n#include\\n#include[0..maxSimultaneousLights]\\n#ifdef VERTEXCOLOR\\n\\nvColor=color;\\n#endif\\n#include\\n#include\\n#define CUSTOM_VERTEX_MAIN_END\\n}\\n\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var defaultVertexShader = { name: name, shader: shader };\r\n//# sourceMappingURL=default.vertex.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, SerializationHelper, serializeAsColor3, expandToProperty, serializeAsFresnelParameters, serializeAsTexture } from \"../Misc/decorators\";\r\nimport { SmartArray } from \"../Misc/smartArray\";\r\nimport { Scene } from \"../scene\";\r\nimport { Matrix } from \"../Maths/math.vector\";\r\nimport { Color3 } from '../Maths/math.color';\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { PrePassConfiguration } from \"./prePassConfiguration\";\r\nimport { ImageProcessingConfiguration } from \"./imageProcessingConfiguration\";\r\nimport { Material } from \"../Materials/material\";\r\nimport { MaterialDefines } from \"../Materials/materialDefines\";\r\nimport { PushMaterial } from \"./pushMaterial\";\r\nimport { MaterialHelper } from \"./materialHelper\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { _TypeStore } from \"../Misc/typeStore\";\r\nimport { MaterialFlags } from \"./materialFlags\";\r\nimport \"../Shaders/default.fragment\";\r\nimport \"../Shaders/default.vertex\";\r\nimport { EffectFallbacks } from './effectFallbacks';\r\nimport { DetailMapConfiguration } from './material.detailMapConfiguration';\r\nvar onCreatedEffectParameters = { effect: null, subMesh: null };\r\n/** @hidden */\r\nvar StandardMaterialDefines = /** @class */ (function (_super) {\r\n __extends(StandardMaterialDefines, _super);\r\n function StandardMaterialDefines() {\r\n var _this = _super.call(this) || this;\r\n _this.MAINUV1 = false;\r\n _this.MAINUV2 = false;\r\n _this.DIFFUSE = false;\r\n _this.DIFFUSEDIRECTUV = 0;\r\n _this.DETAIL = false;\r\n _this.DETAILDIRECTUV = 0;\r\n _this.DETAIL_NORMALBLENDMETHOD = 0;\r\n _this.AMBIENT = false;\r\n _this.AMBIENTDIRECTUV = 0;\r\n _this.OPACITY = false;\r\n _this.OPACITYDIRECTUV = 0;\r\n _this.OPACITYRGB = false;\r\n _this.REFLECTION = false;\r\n _this.EMISSIVE = false;\r\n _this.EMISSIVEDIRECTUV = 0;\r\n _this.SPECULAR = false;\r\n _this.SPECULARDIRECTUV = 0;\r\n _this.BUMP = false;\r\n _this.BUMPDIRECTUV = 0;\r\n _this.PARALLAX = false;\r\n _this.PARALLAXOCCLUSION = false;\r\n _this.SPECULAROVERALPHA = false;\r\n _this.CLIPPLANE = false;\r\n _this.CLIPPLANE2 = false;\r\n _this.CLIPPLANE3 = false;\r\n _this.CLIPPLANE4 = false;\r\n _this.CLIPPLANE5 = false;\r\n _this.CLIPPLANE6 = false;\r\n _this.ALPHATEST = false;\r\n _this.DEPTHPREPASS = false;\r\n _this.ALPHAFROMDIFFUSE = false;\r\n _this.POINTSIZE = false;\r\n _this.FOG = false;\r\n _this.SPECULARTERM = false;\r\n _this.DIFFUSEFRESNEL = false;\r\n _this.OPACITYFRESNEL = false;\r\n _this.REFLECTIONFRESNEL = false;\r\n _this.REFRACTIONFRESNEL = false;\r\n _this.EMISSIVEFRESNEL = false;\r\n _this.FRESNEL = false;\r\n _this.NORMAL = false;\r\n _this.UV1 = false;\r\n _this.UV2 = false;\r\n _this.VERTEXCOLOR = false;\r\n _this.VERTEXALPHA = false;\r\n _this.NUM_BONE_INFLUENCERS = 0;\r\n _this.BonesPerMesh = 0;\r\n _this.BONETEXTURE = false;\r\n _this.BONES_VELOCITY_ENABLED = false;\r\n _this.INSTANCES = false;\r\n _this.THIN_INSTANCES = false;\r\n _this.GLOSSINESS = false;\r\n _this.ROUGHNESS = false;\r\n _this.EMISSIVEASILLUMINATION = false;\r\n _this.LINKEMISSIVEWITHDIFFUSE = false;\r\n _this.REFLECTIONFRESNELFROMSPECULAR = false;\r\n _this.LIGHTMAP = false;\r\n _this.LIGHTMAPDIRECTUV = 0;\r\n _this.OBJECTSPACE_NORMALMAP = false;\r\n _this.USELIGHTMAPASSHADOWMAP = false;\r\n _this.REFLECTIONMAP_3D = false;\r\n _this.REFLECTIONMAP_SPHERICAL = false;\r\n _this.REFLECTIONMAP_PLANAR = false;\r\n _this.REFLECTIONMAP_CUBIC = false;\r\n _this.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\r\n _this.REFLECTIONMAP_PROJECTION = false;\r\n _this.REFLECTIONMAP_SKYBOX = false;\r\n _this.REFLECTIONMAP_EXPLICIT = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n _this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n _this.INVERTCUBICMAP = false;\r\n _this.LOGARITHMICDEPTH = false;\r\n _this.REFRACTION = false;\r\n _this.REFRACTIONMAP_3D = false;\r\n _this.REFLECTIONOVERALPHA = false;\r\n _this.TWOSIDEDLIGHTING = false;\r\n _this.SHADOWFLOAT = false;\r\n _this.MORPHTARGETS = false;\r\n _this.MORPHTARGETS_NORMAL = false;\r\n _this.MORPHTARGETS_TANGENT = false;\r\n _this.MORPHTARGETS_UV = false;\r\n _this.NUM_MORPH_INFLUENCERS = 0;\r\n _this.NONUNIFORMSCALING = false; // https://playground.babylonjs.com#V6DWIH\r\n _this.PREMULTIPLYALPHA = false; // https://playground.babylonjs.com#LNVJJ7\r\n _this.ALPHATEST_AFTERALLALPHACOMPUTATIONS = false;\r\n _this.ALPHABLEND = true;\r\n _this.PREPASS = false;\r\n _this.PREPASS_IRRADIANCE = false;\r\n _this.PREPASS_IRRADIANCE_INDEX = -1;\r\n _this.PREPASS_ALBEDO = false;\r\n _this.PREPASS_ALBEDO_INDEX = -1;\r\n _this.PREPASS_DEPTHNORMAL = false;\r\n _this.PREPASS_DEPTHNORMAL_INDEX = -1;\r\n _this.PREPASS_POSITION = false;\r\n _this.PREPASS_POSITION_INDEX = -1;\r\n _this.PREPASS_VELOCITY = false;\r\n _this.PREPASS_VELOCITY_INDEX = -1;\r\n _this.PREPASS_REFLECTIVITY = false;\r\n _this.PREPASS_REFLECTIVITY_INDEX = -1;\r\n _this.SCENE_MRT_COUNT = 0;\r\n _this.RGBDLIGHTMAP = false;\r\n _this.RGBDREFLECTION = false;\r\n _this.RGBDREFRACTION = false;\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n _this.MULTIVIEW = false;\r\n /**\r\n * If the reflection texture on this material is in linear color space\r\n * @hidden\r\n */\r\n _this.IS_REFLECTION_LINEAR = false;\r\n /**\r\n * If the refraction texture on this material is in linear color space\r\n * @hidden\r\n */\r\n _this.IS_REFRACTION_LINEAR = false;\r\n _this.EXPOSURE = false;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n StandardMaterialDefines.prototype.setReflectionMode = function (modeToEnable) {\r\n var modes = [\r\n \"REFLECTIONMAP_CUBIC\", \"REFLECTIONMAP_EXPLICIT\", \"REFLECTIONMAP_PLANAR\",\r\n \"REFLECTIONMAP_PROJECTION\", \"REFLECTIONMAP_PROJECTION\", \"REFLECTIONMAP_SKYBOX\",\r\n \"REFLECTIONMAP_SPHERICAL\", \"REFLECTIONMAP_EQUIRECTANGULAR\", \"REFLECTIONMAP_EQUIRECTANGULAR_FIXED\",\r\n \"REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\"\r\n ];\r\n for (var _i = 0, modes_1 = modes; _i < modes_1.length; _i++) {\r\n var mode = modes_1[_i];\r\n this[mode] = (mode === modeToEnable);\r\n }\r\n };\r\n return StandardMaterialDefines;\r\n}(MaterialDefines));\r\nexport { StandardMaterialDefines };\r\n/**\r\n * This is the default material used in Babylon. It is the best trade off between quality\r\n * and performances.\r\n * @see https://doc.babylonjs.com/babylon101/materials\r\n */\r\nvar StandardMaterial = /** @class */ (function (_super) {\r\n __extends(StandardMaterial, _super);\r\n /**\r\n * Instantiates a new standard material.\r\n * This is the default material used in Babylon. It is the best trade off between quality\r\n * and performances.\r\n * @see https://doc.babylonjs.com/babylon101/materials\r\n * @param name Define the name of the material in the scene\r\n * @param scene Define the scene the material belong to\r\n */\r\n function StandardMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._diffuseTexture = null;\r\n _this._ambientTexture = null;\r\n _this._opacityTexture = null;\r\n _this._reflectionTexture = null;\r\n _this._emissiveTexture = null;\r\n _this._specularTexture = null;\r\n _this._bumpTexture = null;\r\n _this._lightmapTexture = null;\r\n _this._refractionTexture = null;\r\n /**\r\n * The color of the material lit by the environmental background lighting.\r\n * @see https://doc.babylonjs.com/babylon101/materials#ambient-color-example\r\n */\r\n _this.ambientColor = new Color3(0, 0, 0);\r\n /**\r\n * The basic color of the material as viewed under a light.\r\n */\r\n _this.diffuseColor = new Color3(1, 1, 1);\r\n /**\r\n * Define how the color and intensity of the highlight given by the light in the material.\r\n */\r\n _this.specularColor = new Color3(1, 1, 1);\r\n /**\r\n * Define the color of the material as if self lit.\r\n * This will be mixed in the final result even in the absence of light.\r\n */\r\n _this.emissiveColor = new Color3(0, 0, 0);\r\n /**\r\n * Defines how sharp are the highlights in the material.\r\n * The bigger the value the sharper giving a more glossy feeling to the result.\r\n * Reversely, the smaller the value the blurrier giving a more rough feeling to the result.\r\n */\r\n _this.specularPower = 64;\r\n _this._useAlphaFromDiffuseTexture = false;\r\n _this._useEmissiveAsIllumination = false;\r\n _this._linkEmissiveWithDiffuse = false;\r\n _this._useSpecularOverAlpha = false;\r\n _this._useReflectionOverAlpha = false;\r\n _this._disableLighting = false;\r\n _this._useObjectSpaceNormalMap = false;\r\n _this._useParallax = false;\r\n _this._useParallaxOcclusion = false;\r\n /**\r\n * Apply a scaling factor that determine which \"depth\" the height map should reprensent. A value between 0.05 and 0.1 is reasonnable in Parallax, you can reach 0.2 using Parallax Occlusion.\r\n */\r\n _this.parallaxScaleBias = 0.05;\r\n _this._roughness = 0;\r\n /**\r\n * In case of refraction, define the value of the index of refraction.\r\n * @see https://doc.babylonjs.com/how_to/reflect#how-to-obtain-reflections-and-refractions\r\n */\r\n _this.indexOfRefraction = 0.98;\r\n /**\r\n * Invert the refraction texture alongside the y axis.\r\n * It can be useful with procedural textures or probe for instance.\r\n * @see https://doc.babylonjs.com/how_to/reflect#how-to-obtain-reflections-and-refractions\r\n */\r\n _this.invertRefractionY = true;\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n _this.alphaCutOff = 0.4;\r\n _this._useLightmapAsShadowmap = false;\r\n _this._useReflectionFresnelFromSpecular = false;\r\n _this._useGlossinessFromSpecularMapAlpha = false;\r\n _this._maxSimultaneousLights = 4;\r\n _this._invertNormalMapX = false;\r\n _this._invertNormalMapY = false;\r\n _this._twoSidedLighting = false;\r\n /**\r\n * Defines the detail map parameters for the material.\r\n */\r\n _this.detailMap = new DetailMapConfiguration(_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n _this._renderTargets = new SmartArray(16);\r\n _this._worldViewProjectionMatrix = Matrix.Zero();\r\n _this._globalAmbientColor = new Color3(0, 0, 0);\r\n _this._rebuildInParallel = false;\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n _this.prePassConfiguration = new PrePassConfiguration();\r\n _this.getRenderTargetTextures = function () {\r\n _this._renderTargets.reset();\r\n if (StandardMaterial.ReflectionTextureEnabled && _this._reflectionTexture && _this._reflectionTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._reflectionTexture);\r\n }\r\n if (StandardMaterial.RefractionTextureEnabled && _this._refractionTexture && _this._refractionTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._refractionTexture);\r\n }\r\n return _this._renderTargets;\r\n };\r\n return _this;\r\n }\r\n Object.defineProperty(StandardMaterial.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n this._attachImageProcessingConfiguration(value);\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches a new image processing configuration to the Standard Material.\r\n * @param configuration\r\n */\r\n StandardMaterial.prototype._attachImageProcessingConfiguration = function (configuration) {\r\n var _this = this;\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Detaches observer\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n // Pick the scene configuration if needed\r\n if (!configuration) {\r\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n // Attaches observer\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._markAllSubMeshesAsImageProcessingDirty();\r\n });\r\n }\r\n };\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n },\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraToneMappingEnabled\", {\r\n /**\r\n * Gets wether tonemapping is enabled or not.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether tonemapping is enabled or not\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraExposure\", {\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.exposure;\r\n },\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.exposure = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraContrast\", {\r\n /**\r\n * Gets The camera contrast used on this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.contrast;\r\n },\r\n /**\r\n * Sets The camera contrast used on this material.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.contrast = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorGradingTexture\", {\r\n /**\r\n * Gets the Color Grading 2D Lookup Texture.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorGradingTexture;\r\n },\r\n /**\r\n * Sets the Color Grading 2D Lookup Texture.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorGradingTexture = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"cameraColorCurves\", {\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorCurves;\r\n },\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorCurves = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"canRenderToMRT\", {\r\n /**\r\n * Can this material render to several textures at once\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial.prototype, \"hasRenderTargetTextures\", {\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n get: function () {\r\n if (StandardMaterial.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n if (StandardMaterial.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current class name of the material e.g. \"StandardMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n StandardMaterial.prototype.getClassName = function () {\r\n return \"StandardMaterial\";\r\n };\r\n Object.defineProperty(StandardMaterial.prototype, \"useLogarithmicDepth\", {\r\n /**\r\n * In case the depth buffer does not allow enough depth precision for your scene (might be the case in large scenes)\r\n * You can try switching to logarithmic depth.\r\n * @see https://doc.babylonjs.com/how_to/using_logarithmic_depth_buffer\r\n */\r\n get: function () {\r\n return this._useLogarithmicDepth;\r\n },\r\n set: function (value) {\r\n this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;\r\n this._markAllSubMeshesAsMiscDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n StandardMaterial.prototype.needAlphaBlending = function () {\r\n if (this._disableAlphaBlending) {\r\n return false;\r\n }\r\n return (this.alpha < 1.0) || (this._opacityTexture != null) || this._shouldUseAlphaFromDiffuseTexture() || this._opacityFresnelParameters && this._opacityFresnelParameters.isEnabled;\r\n };\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns a boolean specifying if an alpha test is needed.\r\n */\r\n StandardMaterial.prototype.needAlphaTesting = function () {\r\n if (this._forceAlphaTest) {\r\n return true;\r\n }\r\n return this._hasAlphaChannel() && (this._transparencyMode == null || this._transparencyMode === Material.MATERIAL_ALPHATEST);\r\n };\r\n /**\r\n * Specifies whether or not the alpha value of the diffuse texture should be used for alpha blending.\r\n */\r\n StandardMaterial.prototype._shouldUseAlphaFromDiffuseTexture = function () {\r\n return this._diffuseTexture != null && this._diffuseTexture.hasAlpha && this._useAlphaFromDiffuseTexture && this._transparencyMode !== Material.MATERIAL_OPAQUE;\r\n };\r\n /**\r\n * Specifies whether or not there is a usable alpha channel for transparency.\r\n */\r\n StandardMaterial.prototype._hasAlphaChannel = function () {\r\n return (this._diffuseTexture != null && this._diffuseTexture.hasAlpha) || this._opacityTexture != null;\r\n };\r\n /**\r\n * Get the texture used for alpha test purpose.\r\n * @returns the diffuse texture in case of the standard material.\r\n */\r\n StandardMaterial.prototype.getAlphaTestTexture = function () {\r\n return this._diffuseTexture;\r\n };\r\n /**\r\n * Get if the submesh is ready to be used and all its information available.\r\n * Child classes can use it to update shaders\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @param useInstances specifies that instances should be used\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n StandardMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n if (useInstances === void 0) { useInstances = false; }\r\n if (subMesh.effect && this.isFrozen) {\r\n if (subMesh.effect._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new StandardMaterialDefines();\r\n }\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n var engine = scene.getEngine();\r\n // Lights\r\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);\r\n // Multiview\r\n MaterialHelper.PrepareDefinesForMultiview(scene, defines);\r\n // PrePass\r\n MaterialHelper.PrepareDefinesForPrePass(scene, defines, this.canRenderToMRT);\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n defines.MAINUV1 = false;\r\n defines.MAINUV2 = false;\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\r\n if (!this._diffuseTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._diffuseTexture, defines, \"DIFFUSE\");\r\n }\r\n }\r\n else {\r\n defines.DIFFUSE = false;\r\n }\r\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\r\n if (!this._ambientTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._ambientTexture, defines, \"AMBIENT\");\r\n }\r\n }\r\n else {\r\n defines.AMBIENT = false;\r\n }\r\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\r\n if (!this._opacityTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._opacityTexture, defines, \"OPACITY\");\r\n defines.OPACITYRGB = this._opacityTexture.getAlphaFromRGB;\r\n }\r\n }\r\n else {\r\n defines.OPACITY = false;\r\n }\r\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\r\n if (!this._reflectionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n defines._needNormals = true;\r\n defines.REFLECTION = true;\r\n defines.ROUGHNESS = (this._roughness > 0);\r\n defines.REFLECTIONOVERALPHA = this._useReflectionOverAlpha;\r\n defines.INVERTCUBICMAP = (this._reflectionTexture.coordinatesMode === Texture.INVCUBIC_MODE);\r\n defines.REFLECTIONMAP_3D = this._reflectionTexture.isCube;\r\n defines.RGBDREFLECTION = this._reflectionTexture.isRGBD;\r\n switch (this._reflectionTexture.coordinatesMode) {\r\n case Texture.EXPLICIT_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_EXPLICIT\");\r\n break;\r\n case Texture.PLANAR_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_PLANAR\");\r\n break;\r\n case Texture.PROJECTION_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_PROJECTION\");\r\n break;\r\n case Texture.SKYBOX_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_SKYBOX\");\r\n break;\r\n case Texture.SPHERICAL_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_SPHERICAL\");\r\n break;\r\n case Texture.EQUIRECTANGULAR_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_EQUIRECTANGULAR\");\r\n break;\r\n case Texture.FIXED_EQUIRECTANGULAR_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_EQUIRECTANGULAR_FIXED\");\r\n break;\r\n case Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:\r\n defines.setReflectionMode(\"REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\");\r\n break;\r\n case Texture.CUBIC_MODE:\r\n case Texture.INVCUBIC_MODE:\r\n default:\r\n defines.setReflectionMode(\"REFLECTIONMAP_CUBIC\");\r\n break;\r\n }\r\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = this._reflectionTexture.boundingBoxSize ? true : false;\r\n }\r\n }\r\n else {\r\n defines.REFLECTION = false;\r\n }\r\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\r\n if (!this._emissiveTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._emissiveTexture, defines, \"EMISSIVE\");\r\n }\r\n }\r\n else {\r\n defines.EMISSIVE = false;\r\n }\r\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\r\n if (!this._lightmapTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._lightmapTexture, defines, \"LIGHTMAP\");\r\n defines.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap;\r\n defines.RGBDLIGHTMAP = this._lightmapTexture.isRGBD;\r\n }\r\n }\r\n else {\r\n defines.LIGHTMAP = false;\r\n }\r\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\r\n if (!this._specularTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._specularTexture, defines, \"SPECULAR\");\r\n defines.GLOSSINESS = this._useGlossinessFromSpecularMapAlpha;\r\n }\r\n }\r\n else {\r\n defines.SPECULAR = false;\r\n }\r\n if (scene.getEngine().getCaps().standardDerivatives && this._bumpTexture && StandardMaterial.BumpTextureEnabled) {\r\n // Bump texure can not be not blocking.\r\n if (!this._bumpTexture.isReady()) {\r\n return false;\r\n }\r\n else {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._bumpTexture, defines, \"BUMP\");\r\n defines.PARALLAX = this._useParallax;\r\n defines.PARALLAXOCCLUSION = this._useParallaxOcclusion;\r\n }\r\n defines.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap;\r\n }\r\n else {\r\n defines.BUMP = false;\r\n }\r\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\r\n if (!this._refractionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n else {\r\n defines._needUVs = true;\r\n defines.REFRACTION = true;\r\n defines.REFRACTIONMAP_3D = this._refractionTexture.isCube;\r\n defines.RGBDREFRACTION = this._refractionTexture.isRGBD;\r\n }\r\n }\r\n else {\r\n defines.REFRACTION = false;\r\n }\r\n defines.TWOSIDEDLIGHTING = !this._backFaceCulling && this._twoSidedLighting;\r\n }\r\n else {\r\n defines.DIFFUSE = false;\r\n defines.AMBIENT = false;\r\n defines.OPACITY = false;\r\n defines.REFLECTION = false;\r\n defines.EMISSIVE = false;\r\n defines.LIGHTMAP = false;\r\n defines.BUMP = false;\r\n defines.REFRACTION = false;\r\n }\r\n defines.ALPHAFROMDIFFUSE = this._shouldUseAlphaFromDiffuseTexture();\r\n defines.EMISSIVEASILLUMINATION = this._useEmissiveAsIllumination;\r\n defines.LINKEMISSIVEWITHDIFFUSE = this._linkEmissiveWithDiffuse;\r\n defines.SPECULAROVERALPHA = this._useSpecularOverAlpha;\r\n defines.PREMULTIPLYALPHA = (this.alphaMode === 7 || this.alphaMode === 8);\r\n defines.ALPHATEST_AFTERALLALPHACOMPUTATIONS = this.transparencyMode !== null;\r\n defines.ALPHABLEND = this.transparencyMode === null || this.needAlphaBlendingForMesh(mesh); // check on null for backward compatibility\r\n }\r\n if (!this.detailMap.isReadyForSubMesh(defines, scene)) {\r\n return false;\r\n }\r\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\r\n if (!this._imageProcessingConfiguration.isReady()) {\r\n return false;\r\n }\r\n this._imageProcessingConfiguration.prepareDefines(defines);\r\n defines.IS_REFLECTION_LINEAR = (this.reflectionTexture != null && !this.reflectionTexture.gammaSpace);\r\n defines.IS_REFRACTION_LINEAR = (this.refractionTexture != null && !this.refractionTexture.gammaSpace);\r\n }\r\n if (defines._areFresnelDirty) {\r\n if (StandardMaterial.FresnelEnabled) {\r\n // Fresnel\r\n if (this._diffuseFresnelParameters || this._opacityFresnelParameters ||\r\n this._emissiveFresnelParameters || this._refractionFresnelParameters ||\r\n this._reflectionFresnelParameters) {\r\n defines.DIFFUSEFRESNEL = (this._diffuseFresnelParameters && this._diffuseFresnelParameters.isEnabled);\r\n defines.OPACITYFRESNEL = (this._opacityFresnelParameters && this._opacityFresnelParameters.isEnabled);\r\n defines.REFLECTIONFRESNEL = (this._reflectionFresnelParameters && this._reflectionFresnelParameters.isEnabled);\r\n defines.REFLECTIONFRESNELFROMSPECULAR = this._useReflectionFresnelFromSpecular;\r\n defines.REFRACTIONFRESNEL = (this._refractionFresnelParameters && this._refractionFresnelParameters.isEnabled);\r\n defines.EMISSIVEFRESNEL = (this._emissiveFresnelParameters && this._emissiveFresnelParameters.isEnabled);\r\n defines._needNormals = true;\r\n defines.FRESNEL = true;\r\n }\r\n }\r\n else {\r\n defines.FRESNEL = false;\r\n }\r\n }\r\n // Misc.\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh) || this._forceAlphaTest, defines);\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true);\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances, null, subMesh.getRenderingMesh().hasThinInstances);\r\n // External config\r\n this.detailMap.prepareDefines(defines, scene);\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n var lightDisposed = defines._areLightsDisposed;\r\n defines.markAsProcessed();\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n if (defines.REFLECTION) {\r\n fallbacks.addFallback(0, \"REFLECTION\");\r\n }\r\n if (defines.SPECULAR) {\r\n fallbacks.addFallback(0, \"SPECULAR\");\r\n }\r\n if (defines.BUMP) {\r\n fallbacks.addFallback(0, \"BUMP\");\r\n }\r\n if (defines.PARALLAX) {\r\n fallbacks.addFallback(1, \"PARALLAX\");\r\n }\r\n if (defines.PARALLAXOCCLUSION) {\r\n fallbacks.addFallback(0, \"PARALLAXOCCLUSION\");\r\n }\r\n if (defines.SPECULAROVERALPHA) {\r\n fallbacks.addFallback(0, \"SPECULAROVERALPHA\");\r\n }\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n if (defines.POINTSIZE) {\r\n fallbacks.addFallback(0, \"POINTSIZE\");\r\n }\r\n if (defines.LOGARITHMICDEPTH) {\r\n fallbacks.addFallback(0, \"LOGARITHMICDEPTH\");\r\n }\r\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this._maxSimultaneousLights);\r\n if (defines.SPECULARTERM) {\r\n fallbacks.addFallback(0, \"SPECULARTERM\");\r\n }\r\n if (defines.DIFFUSEFRESNEL) {\r\n fallbacks.addFallback(1, \"DIFFUSEFRESNEL\");\r\n }\r\n if (defines.OPACITYFRESNEL) {\r\n fallbacks.addFallback(2, \"OPACITYFRESNEL\");\r\n }\r\n if (defines.REFLECTIONFRESNEL) {\r\n fallbacks.addFallback(3, \"REFLECTIONFRESNEL\");\r\n }\r\n if (defines.EMISSIVEFRESNEL) {\r\n fallbacks.addFallback(4, \"EMISSIVEFRESNEL\");\r\n }\r\n if (defines.FRESNEL) {\r\n fallbacks.addFallback(4, \"FRESNEL\");\r\n }\r\n if (defines.MULTIVIEW) {\r\n fallbacks.addFallback(0, \"MULTIVIEW\");\r\n }\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n MaterialHelper.PrepareAttributesForMorphTargets(attribs, mesh, defines);\r\n var shaderName = \"default\";\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vAmbientColor\", \"vDiffuseColor\", \"vSpecularColor\", \"vEmissiveColor\", \"visibility\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vDiffuseInfos\", \"vAmbientInfos\", \"vOpacityInfos\", \"vReflectionInfos\", \"vEmissiveInfos\", \"vSpecularInfos\", \"vBumpInfos\", \"vLightmapInfos\", \"vRefractionInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"vClipPlane5\", \"vClipPlane6\", \"diffuseMatrix\", \"ambientMatrix\", \"opacityMatrix\", \"reflectionMatrix\", \"emissiveMatrix\", \"specularMatrix\", \"bumpMatrix\", \"normalMatrix\", \"lightmapMatrix\", \"refractionMatrix\",\r\n \"diffuseLeftColor\", \"diffuseRightColor\", \"opacityParts\", \"reflectionLeftColor\", \"reflectionRightColor\", \"emissiveLeftColor\", \"emissiveRightColor\", \"refractionLeftColor\", \"refractionRightColor\",\r\n \"vReflectionPosition\", \"vReflectionSize\",\r\n \"logarithmicDepthConstant\", \"vTangentSpaceParams\", \"alphaCutOff\", \"boneTextureWidth\"\r\n ];\r\n var samplers = [\"diffuseSampler\", \"ambientSampler\", \"opacitySampler\", \"reflectionCubeSampler\",\r\n \"reflection2DSampler\", \"emissiveSampler\", \"specularSampler\", \"bumpSampler\", \"lightmapSampler\",\r\n \"refractionCubeSampler\", \"refraction2DSampler\", \"boneSampler\"];\r\n var uniformBuffers = [\"Material\", \"Scene\"];\r\n DetailMapConfiguration.AddUniforms(uniforms);\r\n DetailMapConfiguration.AddSamplers(samplers);\r\n PrePassConfiguration.AddUniforms(uniforms);\r\n PrePassConfiguration.AddSamplers(uniforms);\r\n if (ImageProcessingConfiguration) {\r\n ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);\r\n ImageProcessingConfiguration.PrepareSamplers(samplers, defines);\r\n }\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this._maxSimultaneousLights\r\n });\r\n var csnrOptions = {};\r\n if (this.customShaderNameResolve) {\r\n shaderName = this.customShaderNameResolve(shaderName, uniforms, uniformBuffers, samplers, defines, attribs, csnrOptions);\r\n }\r\n var join = defines.toString();\r\n var previousEffect = subMesh.effect;\r\n var effect = scene.getEngine().createEffect(shaderName, {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: defines.NUM_MORPH_INFLUENCERS },\r\n processFinalCode: csnrOptions.processFinalCode,\r\n multiTarget: defines.PREPASS\r\n }, engine);\r\n if (effect) {\r\n if (this._onEffectCreatedObservable) {\r\n onCreatedEffectParameters.effect = effect;\r\n onCreatedEffectParameters.subMesh = subMesh;\r\n this._onEffectCreatedObservable.notifyObservers(onCreatedEffectParameters);\r\n }\r\n // Use previous effect while new one is compiling\r\n if (this.allowShaderHotSwapping && previousEffect && !effect.isReady()) {\r\n effect = previousEffect;\r\n this._rebuildInParallel = true;\r\n defines.markAsUnprocessed();\r\n if (lightDisposed) {\r\n // re register in case it takes more than one frame.\r\n defines._areLightsDisposed = true;\r\n return false;\r\n }\r\n }\r\n else {\r\n this._rebuildInParallel = false;\r\n scene.resetCachedMaterial();\r\n subMesh.setEffect(effect, defines);\r\n this.buildUniformLayout();\r\n }\r\n }\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n defines._renderId = scene.getRenderId();\r\n subMesh.effect._wasPreviouslyReady = true;\r\n return true;\r\n };\r\n /**\r\n * Builds the material UBO layouts.\r\n * Used internally during the effect preparation.\r\n */\r\n StandardMaterial.prototype.buildUniformLayout = function () {\r\n // Order is important !\r\n var ubo = this._uniformBuffer;\r\n ubo.addUniform(\"diffuseLeftColor\", 4);\r\n ubo.addUniform(\"diffuseRightColor\", 4);\r\n ubo.addUniform(\"opacityParts\", 4);\r\n ubo.addUniform(\"reflectionLeftColor\", 4);\r\n ubo.addUniform(\"reflectionRightColor\", 4);\r\n ubo.addUniform(\"refractionLeftColor\", 4);\r\n ubo.addUniform(\"refractionRightColor\", 4);\r\n ubo.addUniform(\"emissiveLeftColor\", 4);\r\n ubo.addUniform(\"emissiveRightColor\", 4);\r\n ubo.addUniform(\"vDiffuseInfos\", 2);\r\n ubo.addUniform(\"vAmbientInfos\", 2);\r\n ubo.addUniform(\"vOpacityInfos\", 2);\r\n ubo.addUniform(\"vReflectionInfos\", 2);\r\n ubo.addUniform(\"vReflectionPosition\", 3);\r\n ubo.addUniform(\"vReflectionSize\", 3);\r\n ubo.addUniform(\"vEmissiveInfos\", 2);\r\n ubo.addUniform(\"vLightmapInfos\", 2);\r\n ubo.addUniform(\"vSpecularInfos\", 2);\r\n ubo.addUniform(\"vBumpInfos\", 3);\r\n ubo.addUniform(\"diffuseMatrix\", 16);\r\n ubo.addUniform(\"ambientMatrix\", 16);\r\n ubo.addUniform(\"opacityMatrix\", 16);\r\n ubo.addUniform(\"reflectionMatrix\", 16);\r\n ubo.addUniform(\"emissiveMatrix\", 16);\r\n ubo.addUniform(\"lightmapMatrix\", 16);\r\n ubo.addUniform(\"specularMatrix\", 16);\r\n ubo.addUniform(\"bumpMatrix\", 16);\r\n ubo.addUniform(\"vTangentSpaceParams\", 2);\r\n ubo.addUniform(\"pointSize\", 1);\r\n ubo.addUniform(\"refractionMatrix\", 16);\r\n ubo.addUniform(\"vRefractionInfos\", 4);\r\n ubo.addUniform(\"vSpecularColor\", 4);\r\n ubo.addUniform(\"vEmissiveColor\", 3);\r\n ubo.addUniform(\"visibility\", 1);\r\n ubo.addUniform(\"vDiffuseColor\", 4);\r\n DetailMapConfiguration.PrepareUniformBuffer(ubo);\r\n ubo.create();\r\n };\r\n /**\r\n * Unbinds the material from the mesh\r\n */\r\n StandardMaterial.prototype.unbind = function () {\r\n if (this._activeEffect) {\r\n var needFlag = false;\r\n if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n this._activeEffect.setTexture(\"reflection2DSampler\", null);\r\n needFlag = true;\r\n }\r\n if (this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n this._activeEffect.setTexture(\"refraction2DSampler\", null);\r\n needFlag = true;\r\n }\r\n if (needFlag) {\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\r\n }\r\n _super.prototype.unbind.call(this);\r\n };\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n StandardMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n // Matrices\r\n if (!defines.INSTANCES || defines.THIN_INSTANCES) {\r\n this.bindOnlyWorldMatrix(world);\r\n }\r\n // PrePass\r\n this.prePassConfiguration.bindForSubMesh(this._activeEffect, scene, mesh, world, this.isFrozen);\r\n // Normal Matrix\r\n if (defines.OBJECTSPACE_NORMALMAP) {\r\n world.toNormalMatrix(this._normalMatrix);\r\n this.bindOnlyNormalMatrix(this._normalMatrix);\r\n }\r\n var mustRebind = this._mustRebind(scene, effect, mesh.visibility);\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, effect);\r\n var ubo = this._uniformBuffer;\r\n if (mustRebind) {\r\n ubo.bindToEffect(effect, \"Material\");\r\n this.bindViewProjection(effect);\r\n if (!ubo.useUbo || !this.isFrozen || !ubo.isSync) {\r\n if (StandardMaterial.FresnelEnabled && defines.FRESNEL) {\r\n // Fresnel\r\n if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"diffuseLeftColor\", this.diffuseFresnelParameters.leftColor, this.diffuseFresnelParameters.power);\r\n ubo.updateColor4(\"diffuseRightColor\", this.diffuseFresnelParameters.rightColor, this.diffuseFresnelParameters.bias);\r\n }\r\n if (this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"opacityParts\", new Color3(this.opacityFresnelParameters.leftColor.toLuminance(), this.opacityFresnelParameters.rightColor.toLuminance(), this.opacityFresnelParameters.bias), this.opacityFresnelParameters.power);\r\n }\r\n if (this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"reflectionLeftColor\", this.reflectionFresnelParameters.leftColor, this.reflectionFresnelParameters.power);\r\n ubo.updateColor4(\"reflectionRightColor\", this.reflectionFresnelParameters.rightColor, this.reflectionFresnelParameters.bias);\r\n }\r\n if (this.refractionFresnelParameters && this.refractionFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"refractionLeftColor\", this.refractionFresnelParameters.leftColor, this.refractionFresnelParameters.power);\r\n ubo.updateColor4(\"refractionRightColor\", this.refractionFresnelParameters.rightColor, this.refractionFresnelParameters.bias);\r\n }\r\n if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {\r\n ubo.updateColor4(\"emissiveLeftColor\", this.emissiveFresnelParameters.leftColor, this.emissiveFresnelParameters.power);\r\n ubo.updateColor4(\"emissiveRightColor\", this.emissiveFresnelParameters.rightColor, this.emissiveFresnelParameters.bias);\r\n }\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\r\n ubo.updateFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._diffuseTexture, ubo, \"diffuse\");\r\n }\r\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\r\n ubo.updateFloat2(\"vAmbientInfos\", this._ambientTexture.coordinatesIndex, this._ambientTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._ambientTexture, ubo, \"ambient\");\r\n }\r\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\r\n ubo.updateFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._opacityTexture, ubo, \"opacity\");\r\n }\r\n if (this._hasAlphaChannel()) {\r\n effect.setFloat(\"alphaCutOff\", this.alphaCutOff);\r\n }\r\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\r\n ubo.updateFloat2(\"vReflectionInfos\", this._reflectionTexture.level, this.roughness);\r\n ubo.updateMatrix(\"reflectionMatrix\", this._reflectionTexture.getReflectionTextureMatrix());\r\n if (this._reflectionTexture.boundingBoxSize) {\r\n var cubeTexture = this._reflectionTexture;\r\n ubo.updateVector3(\"vReflectionPosition\", cubeTexture.boundingBoxPosition);\r\n ubo.updateVector3(\"vReflectionSize\", cubeTexture.boundingBoxSize);\r\n }\r\n }\r\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\r\n ubo.updateFloat2(\"vEmissiveInfos\", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._emissiveTexture, ubo, \"emissive\");\r\n }\r\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\r\n ubo.updateFloat2(\"vLightmapInfos\", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._lightmapTexture, ubo, \"lightmap\");\r\n }\r\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\r\n ubo.updateFloat2(\"vSpecularInfos\", this._specularTexture.coordinatesIndex, this._specularTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._specularTexture, ubo, \"specular\");\r\n }\r\n if (this._bumpTexture && scene.getEngine().getCaps().standardDerivatives && StandardMaterial.BumpTextureEnabled) {\r\n ubo.updateFloat3(\"vBumpInfos\", this._bumpTexture.coordinatesIndex, 1.0 / this._bumpTexture.level, this.parallaxScaleBias);\r\n MaterialHelper.BindTextureMatrix(this._bumpTexture, ubo, \"bump\");\r\n if (scene._mirroredCameraPosition) {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? 1.0 : -1.0, this._invertNormalMapY ? 1.0 : -1.0);\r\n }\r\n else {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? -1.0 : 1.0, this._invertNormalMapY ? -1.0 : 1.0);\r\n }\r\n }\r\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\r\n var depth = 1.0;\r\n if (!this._refractionTexture.isCube) {\r\n ubo.updateMatrix(\"refractionMatrix\", this._refractionTexture.getReflectionTextureMatrix());\r\n if (this._refractionTexture.depth) {\r\n depth = this._refractionTexture.depth;\r\n }\r\n }\r\n ubo.updateFloat4(\"vRefractionInfos\", this._refractionTexture.level, this.indexOfRefraction, depth, this.invertRefractionY ? -1 : 1);\r\n }\r\n }\r\n // Point size\r\n if (this.pointsCloud) {\r\n ubo.updateFloat(\"pointSize\", this.pointSize);\r\n }\r\n if (defines.SPECULARTERM) {\r\n ubo.updateColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\r\n }\r\n ubo.updateColor3(\"vEmissiveColor\", StandardMaterial.EmissiveTextureEnabled ? this.emissiveColor : Color3.BlackReadOnly);\r\n // Diffuse\r\n ubo.updateColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha);\r\n }\r\n // Visibility\r\n ubo.updateFloat(\"visibility\", mesh.visibility);\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\r\n effect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n }\r\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\r\n effect.setTexture(\"ambientSampler\", this._ambientTexture);\r\n }\r\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\r\n effect.setTexture(\"opacitySampler\", this._opacityTexture);\r\n }\r\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\r\n if (this._reflectionTexture.isCube) {\r\n effect.setTexture(\"reflectionCubeSampler\", this._reflectionTexture);\r\n }\r\n else {\r\n effect.setTexture(\"reflection2DSampler\", this._reflectionTexture);\r\n }\r\n }\r\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\r\n effect.setTexture(\"emissiveSampler\", this._emissiveTexture);\r\n }\r\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\r\n effect.setTexture(\"lightmapSampler\", this._lightmapTexture);\r\n }\r\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\r\n effect.setTexture(\"specularSampler\", this._specularTexture);\r\n }\r\n if (this._bumpTexture && scene.getEngine().getCaps().standardDerivatives && StandardMaterial.BumpTextureEnabled) {\r\n effect.setTexture(\"bumpSampler\", this._bumpTexture);\r\n }\r\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\r\n var depth = 1.0;\r\n if (this._refractionTexture.isCube) {\r\n effect.setTexture(\"refractionCubeSampler\", this._refractionTexture);\r\n }\r\n else {\r\n effect.setTexture(\"refraction2DSampler\", this._refractionTexture);\r\n }\r\n }\r\n }\r\n this.detailMap.bindForSubMesh(ubo, scene, this.isFrozen);\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(effect, scene);\r\n // Colors\r\n scene.ambientColor.multiplyToRef(this.ambientColor, this._globalAmbientColor);\r\n MaterialHelper.BindEyePosition(effect, scene);\r\n effect.setColor3(\"vAmbientColor\", this._globalAmbientColor);\r\n }\r\n if (mustRebind || !this.isFrozen) {\r\n // Lights\r\n if (scene.lightsEnabled && !this._disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, effect, defines, this._maxSimultaneousLights, this._rebuildInParallel);\r\n }\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE || this._reflectionTexture || this._refractionTexture) {\r\n this.bindView(effect);\r\n }\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, effect);\r\n // Morph targets\r\n if (defines.NUM_MORPH_INFLUENCERS) {\r\n MaterialHelper.BindMorphTargetParameters(mesh, effect);\r\n }\r\n // Log. depth\r\n if (this.useLogarithmicDepth) {\r\n MaterialHelper.BindLogDepth(defines, effect, scene);\r\n }\r\n // image processing\r\n if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {\r\n this._imageProcessingConfiguration.bind(this._activeEffect);\r\n }\r\n }\r\n ubo.update();\r\n this._afterBind(mesh, this._activeEffect);\r\n };\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n StandardMaterial.prototype.getAnimatables = function () {\r\n var results = [];\r\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\r\n results.push(this._diffuseTexture);\r\n }\r\n if (this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0) {\r\n results.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0) {\r\n results.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0) {\r\n results.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0) {\r\n results.push(this._emissiveTexture);\r\n }\r\n if (this._specularTexture && this._specularTexture.animations && this._specularTexture.animations.length > 0) {\r\n results.push(this._specularTexture);\r\n }\r\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\r\n results.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0) {\r\n results.push(this._lightmapTexture);\r\n }\r\n if (this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0) {\r\n results.push(this._refractionTexture);\r\n }\r\n this.detailMap.getAnimatables(results);\r\n return results;\r\n };\r\n /**\r\n * Gets the active textures from the material\r\n * @returns an array of textures\r\n */\r\n StandardMaterial.prototype.getActiveTextures = function () {\r\n var activeTextures = _super.prototype.getActiveTextures.call(this);\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n if (this._ambientTexture) {\r\n activeTextures.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture) {\r\n activeTextures.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture) {\r\n activeTextures.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture) {\r\n activeTextures.push(this._emissiveTexture);\r\n }\r\n if (this._specularTexture) {\r\n activeTextures.push(this._specularTexture);\r\n }\r\n if (this._bumpTexture) {\r\n activeTextures.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture) {\r\n activeTextures.push(this._lightmapTexture);\r\n }\r\n if (this._refractionTexture) {\r\n activeTextures.push(this._refractionTexture);\r\n }\r\n this.detailMap.getActiveTextures(activeTextures);\r\n return activeTextures;\r\n };\r\n /**\r\n * Specifies if the material uses a texture\r\n * @param texture defines the texture to check against the material\r\n * @returns a boolean specifying if the material uses the texture\r\n */\r\n StandardMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n if (this._diffuseTexture === texture) {\r\n return true;\r\n }\r\n if (this._ambientTexture === texture) {\r\n return true;\r\n }\r\n if (this._opacityTexture === texture) {\r\n return true;\r\n }\r\n if (this._reflectionTexture === texture) {\r\n return true;\r\n }\r\n if (this._emissiveTexture === texture) {\r\n return true;\r\n }\r\n if (this._specularTexture === texture) {\r\n return true;\r\n }\r\n if (this._bumpTexture === texture) {\r\n return true;\r\n }\r\n if (this._lightmapTexture === texture) {\r\n return true;\r\n }\r\n if (this._refractionTexture === texture) {\r\n return true;\r\n }\r\n return this.detailMap.hasTexture(texture);\r\n };\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\r\n */\r\n StandardMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n if (forceDisposeTextures) {\r\n (_a = this._diffuseTexture) === null || _a === void 0 ? void 0 : _a.dispose();\r\n (_b = this._ambientTexture) === null || _b === void 0 ? void 0 : _b.dispose();\r\n (_c = this._opacityTexture) === null || _c === void 0 ? void 0 : _c.dispose();\r\n (_d = this._reflectionTexture) === null || _d === void 0 ? void 0 : _d.dispose();\r\n (_e = this._emissiveTexture) === null || _e === void 0 ? void 0 : _e.dispose();\r\n (_f = this._specularTexture) === null || _f === void 0 ? void 0 : _f.dispose();\r\n (_g = this._bumpTexture) === null || _g === void 0 ? void 0 : _g.dispose();\r\n (_h = this._lightmapTexture) === null || _h === void 0 ? void 0 : _h.dispose();\r\n (_j = this._refractionTexture) === null || _j === void 0 ? void 0 : _j.dispose();\r\n }\r\n this.detailMap.dispose(forceDisposeTextures);\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);\r\n };\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n StandardMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n var result = SerializationHelper.Clone(function () { return new StandardMaterial(name, _this.getScene()); }, this);\r\n result.name = name;\r\n result.id = name;\r\n return result;\r\n };\r\n /**\r\n * Serializes this material in a JSON representation\r\n * @returns the serialized material object\r\n */\r\n StandardMaterial.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Creates a standard material from parsed material data\r\n * @param source defines the JSON representation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new standard material\r\n */\r\n StandardMaterial.Parse = function (source, scene, rootUrl) {\r\n return SerializationHelper.Parse(function () { return new StandardMaterial(source.name, scene); }, source, scene, rootUrl);\r\n };\r\n Object.defineProperty(StandardMaterial, \"DiffuseTextureEnabled\", {\r\n // Flags used to enable or disable a type of texture for all Standard Materials\r\n /**\r\n * Are diffuse textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.DiffuseTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.DiffuseTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"DetailTextureEnabled\", {\r\n /**\r\n * Are detail textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.DetailTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.DetailTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"AmbientTextureEnabled\", {\r\n /**\r\n * Are ambient textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.AmbientTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.AmbientTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"OpacityTextureEnabled\", {\r\n /**\r\n * Are opacity textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.OpacityTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.OpacityTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"ReflectionTextureEnabled\", {\r\n /**\r\n * Are reflection textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.ReflectionTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.ReflectionTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"EmissiveTextureEnabled\", {\r\n /**\r\n * Are emissive textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.EmissiveTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.EmissiveTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"SpecularTextureEnabled\", {\r\n /**\r\n * Are specular textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.SpecularTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.SpecularTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"BumpTextureEnabled\", {\r\n /**\r\n * Are bump textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.BumpTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.BumpTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"LightmapTextureEnabled\", {\r\n /**\r\n * Are lightmap textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.LightmapTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.LightmapTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"RefractionTextureEnabled\", {\r\n /**\r\n * Are refraction textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.RefractionTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.RefractionTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"ColorGradingTextureEnabled\", {\r\n /**\r\n * Are color grading textures enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.ColorGradingTextureEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.ColorGradingTextureEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StandardMaterial, \"FresnelEnabled\", {\r\n /**\r\n * Are fresnels enabled in the application.\r\n */\r\n get: function () {\r\n return MaterialFlags.FresnelEnabled;\r\n },\r\n set: function (value) {\r\n MaterialFlags.FresnelEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n __decorate([\r\n serializeAsTexture(\"diffuseTexture\")\r\n ], StandardMaterial.prototype, \"_diffuseTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], StandardMaterial.prototype, \"diffuseTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"ambientTexture\")\r\n ], StandardMaterial.prototype, \"_ambientTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"ambientTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"opacityTexture\")\r\n ], StandardMaterial.prototype, \"_opacityTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], StandardMaterial.prototype, \"opacityTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"reflectionTexture\")\r\n ], StandardMaterial.prototype, \"_reflectionTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"reflectionTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"emissiveTexture\")\r\n ], StandardMaterial.prototype, \"_emissiveTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"emissiveTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"specularTexture\")\r\n ], StandardMaterial.prototype, \"_specularTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"specularTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"bumpTexture\")\r\n ], StandardMaterial.prototype, \"_bumpTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"bumpTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"lightmapTexture\")\r\n ], StandardMaterial.prototype, \"_lightmapTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"lightmapTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(\"refractionTexture\")\r\n ], StandardMaterial.prototype, \"_refractionTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"refractionTexture\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"ambient\")\r\n ], StandardMaterial.prototype, \"ambientColor\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"diffuse\")\r\n ], StandardMaterial.prototype, \"diffuseColor\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"specular\")\r\n ], StandardMaterial.prototype, \"specularColor\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"emissive\")\r\n ], StandardMaterial.prototype, \"emissiveColor\", void 0);\r\n __decorate([\r\n serialize()\r\n ], StandardMaterial.prototype, \"specularPower\", void 0);\r\n __decorate([\r\n serialize(\"useAlphaFromDiffuseTexture\")\r\n ], StandardMaterial.prototype, \"_useAlphaFromDiffuseTexture\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], StandardMaterial.prototype, \"useAlphaFromDiffuseTexture\", void 0);\r\n __decorate([\r\n serialize(\"useEmissiveAsIllumination\")\r\n ], StandardMaterial.prototype, \"_useEmissiveAsIllumination\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useEmissiveAsIllumination\", void 0);\r\n __decorate([\r\n serialize(\"linkEmissiveWithDiffuse\")\r\n ], StandardMaterial.prototype, \"_linkEmissiveWithDiffuse\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"linkEmissiveWithDiffuse\", void 0);\r\n __decorate([\r\n serialize(\"useSpecularOverAlpha\")\r\n ], StandardMaterial.prototype, \"_useSpecularOverAlpha\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useSpecularOverAlpha\", void 0);\r\n __decorate([\r\n serialize(\"useReflectionOverAlpha\")\r\n ], StandardMaterial.prototype, \"_useReflectionOverAlpha\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useReflectionOverAlpha\", void 0);\r\n __decorate([\r\n serialize(\"disableLighting\")\r\n ], StandardMaterial.prototype, \"_disableLighting\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n ], StandardMaterial.prototype, \"disableLighting\", void 0);\r\n __decorate([\r\n serialize(\"useObjectSpaceNormalMap\")\r\n ], StandardMaterial.prototype, \"_useObjectSpaceNormalMap\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useObjectSpaceNormalMap\", void 0);\r\n __decorate([\r\n serialize(\"useParallax\")\r\n ], StandardMaterial.prototype, \"_useParallax\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useParallax\", void 0);\r\n __decorate([\r\n serialize(\"useParallaxOcclusion\")\r\n ], StandardMaterial.prototype, \"_useParallaxOcclusion\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useParallaxOcclusion\", void 0);\r\n __decorate([\r\n serialize()\r\n ], StandardMaterial.prototype, \"parallaxScaleBias\", void 0);\r\n __decorate([\r\n serialize(\"roughness\")\r\n ], StandardMaterial.prototype, \"_roughness\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"roughness\", void 0);\r\n __decorate([\r\n serialize()\r\n ], StandardMaterial.prototype, \"indexOfRefraction\", void 0);\r\n __decorate([\r\n serialize()\r\n ], StandardMaterial.prototype, \"invertRefractionY\", void 0);\r\n __decorate([\r\n serialize()\r\n ], StandardMaterial.prototype, \"alphaCutOff\", void 0);\r\n __decorate([\r\n serialize(\"useLightmapAsShadowmap\")\r\n ], StandardMaterial.prototype, \"_useLightmapAsShadowmap\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useLightmapAsShadowmap\", void 0);\r\n __decorate([\r\n serializeAsFresnelParameters(\"diffuseFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_diffuseFresnelParameters\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"diffuseFresnelParameters\", void 0);\r\n __decorate([\r\n serializeAsFresnelParameters(\"opacityFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_opacityFresnelParameters\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsFresnelAndMiscDirty\")\r\n ], StandardMaterial.prototype, \"opacityFresnelParameters\", void 0);\r\n __decorate([\r\n serializeAsFresnelParameters(\"reflectionFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_reflectionFresnelParameters\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"reflectionFresnelParameters\", void 0);\r\n __decorate([\r\n serializeAsFresnelParameters(\"refractionFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_refractionFresnelParameters\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"refractionFresnelParameters\", void 0);\r\n __decorate([\r\n serializeAsFresnelParameters(\"emissiveFresnelParameters\")\r\n ], StandardMaterial.prototype, \"_emissiveFresnelParameters\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"emissiveFresnelParameters\", void 0);\r\n __decorate([\r\n serialize(\"useReflectionFresnelFromSpecular\")\r\n ], StandardMaterial.prototype, \"_useReflectionFresnelFromSpecular\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\r\n ], StandardMaterial.prototype, \"useReflectionFresnelFromSpecular\", void 0);\r\n __decorate([\r\n serialize(\"useGlossinessFromSpecularMapAlpha\")\r\n ], StandardMaterial.prototype, \"_useGlossinessFromSpecularMapAlpha\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"useGlossinessFromSpecularMapAlpha\", void 0);\r\n __decorate([\r\n serialize(\"maxSimultaneousLights\")\r\n ], StandardMaterial.prototype, \"_maxSimultaneousLights\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n ], StandardMaterial.prototype, \"maxSimultaneousLights\", void 0);\r\n __decorate([\r\n serialize(\"invertNormalMapX\")\r\n ], StandardMaterial.prototype, \"_invertNormalMapX\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"invertNormalMapX\", void 0);\r\n __decorate([\r\n serialize(\"invertNormalMapY\")\r\n ], StandardMaterial.prototype, \"_invertNormalMapY\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"invertNormalMapY\", void 0);\r\n __decorate([\r\n serialize(\"twoSidedLighting\")\r\n ], StandardMaterial.prototype, \"_twoSidedLighting\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], StandardMaterial.prototype, \"twoSidedLighting\", void 0);\r\n __decorate([\r\n serialize()\r\n ], StandardMaterial.prototype, \"useLogarithmicDepth\", null);\r\n return StandardMaterial;\r\n}(PushMaterial));\r\nexport { StandardMaterial };\r\n_TypeStore.RegisteredTypes[\"BABYLON.StandardMaterial\"] = StandardMaterial;\r\nScene.DefaultMaterialFactory = function (scene) {\r\n return new StandardMaterial(\"default material\", scene);\r\n};\r\n//# sourceMappingURL=standardMaterial.js.map","import { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport { WebGLDataBuffer } from '../../Meshes/WebGL/webGLDataBuffer';\r\nThinEngine.prototype.createUniformBuffer = function (elements) {\r\n var ubo = this._gl.createBuffer();\r\n if (!ubo) {\r\n throw new Error(\"Unable to create uniform buffer\");\r\n }\r\n var result = new WebGLDataBuffer(ubo);\r\n this.bindUniformBuffer(result);\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.STATIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.STATIC_DRAW);\r\n }\r\n this.bindUniformBuffer(null);\r\n result.references = 1;\r\n return result;\r\n};\r\nThinEngine.prototype.createDynamicUniformBuffer = function (elements) {\r\n var ubo = this._gl.createBuffer();\r\n if (!ubo) {\r\n throw new Error(\"Unable to create dynamic uniform buffer\");\r\n }\r\n var result = new WebGLDataBuffer(ubo);\r\n this.bindUniformBuffer(result);\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.DYNAMIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.DYNAMIC_DRAW);\r\n }\r\n this.bindUniformBuffer(null);\r\n result.references = 1;\r\n return result;\r\n};\r\nThinEngine.prototype.updateUniformBuffer = function (uniformBuffer, elements, offset, count) {\r\n this.bindUniformBuffer(uniformBuffer);\r\n if (offset === undefined) {\r\n offset = 0;\r\n }\r\n if (count === undefined) {\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, elements);\r\n }\r\n else {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, new Float32Array(elements));\r\n }\r\n }\r\n else {\r\n if (elements instanceof Float32Array) {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, elements.subarray(offset, offset + count));\r\n }\r\n else {\r\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, new Float32Array(elements).subarray(offset, offset + count));\r\n }\r\n }\r\n this.bindUniformBuffer(null);\r\n};\r\nThinEngine.prototype.bindUniformBuffer = function (buffer) {\r\n this._gl.bindBuffer(this._gl.UNIFORM_BUFFER, buffer ? buffer.underlyingResource : null);\r\n};\r\nThinEngine.prototype.bindUniformBufferBase = function (buffer, location) {\r\n this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER, location, buffer ? buffer.underlyingResource : null);\r\n};\r\nThinEngine.prototype.bindUniformBlock = function (pipelineContext, blockName, index) {\r\n var program = pipelineContext.program;\r\n var uniformLocation = this._gl.getUniformBlockIndex(program, blockName);\r\n this._gl.uniformBlockBinding(program, uniformLocation, index);\r\n};\r\n//# sourceMappingURL=engine.uniformBuffer.js.map","import { Logger } from \"../Misc/logger\";\r\nimport \"../Engines/Extensions/engine.uniformBuffer\";\r\n/**\r\n * Uniform buffer objects.\r\n *\r\n * Handles blocks of uniform on the GPU.\r\n *\r\n * If WebGL 2 is not available, this class falls back on traditionnal setUniformXXX calls.\r\n *\r\n * For more information, please refer to :\r\n * https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object\r\n */\r\nvar UniformBuffer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new Uniform buffer objects.\r\n *\r\n * Handles blocks of uniform on the GPU.\r\n *\r\n * If WebGL 2 is not available, this class falls back on traditionnal setUniformXXX calls.\r\n *\r\n * For more information, please refer to :\r\n * @see https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object\r\n * @param engine Define the engine the buffer is associated with\r\n * @param data Define the data contained in the buffer\r\n * @param dynamic Define if the buffer is updatable\r\n */\r\n function UniformBuffer(engine, data, dynamic) {\r\n /** @hidden */\r\n this._alreadyBound = false;\r\n // Matrix cache\r\n this._valueCache = {};\r\n this._engine = engine;\r\n this._noUBO = !engine.supportsUniformBuffers;\r\n this._dynamic = dynamic;\r\n this._data = data || [];\r\n this._uniformLocations = {};\r\n this._uniformSizes = {};\r\n this._uniformLocationPointer = 0;\r\n this._needSync = false;\r\n if (this._noUBO) {\r\n this.updateMatrix3x3 = this._updateMatrix3x3ForEffect;\r\n this.updateMatrix2x2 = this._updateMatrix2x2ForEffect;\r\n this.updateFloat = this._updateFloatForEffect;\r\n this.updateFloat2 = this._updateFloat2ForEffect;\r\n this.updateFloat3 = this._updateFloat3ForEffect;\r\n this.updateFloat4 = this._updateFloat4ForEffect;\r\n this.updateMatrix = this._updateMatrixForEffect;\r\n this.updateVector3 = this._updateVector3ForEffect;\r\n this.updateVector4 = this._updateVector4ForEffect;\r\n this.updateColor3 = this._updateColor3ForEffect;\r\n this.updateColor4 = this._updateColor4ForEffect;\r\n }\r\n else {\r\n this._engine._uniformBuffers.push(this);\r\n this.updateMatrix3x3 = this._updateMatrix3x3ForUniform;\r\n this.updateMatrix2x2 = this._updateMatrix2x2ForUniform;\r\n this.updateFloat = this._updateFloatForUniform;\r\n this.updateFloat2 = this._updateFloat2ForUniform;\r\n this.updateFloat3 = this._updateFloat3ForUniform;\r\n this.updateFloat4 = this._updateFloat4ForUniform;\r\n this.updateMatrix = this._updateMatrixForUniform;\r\n this.updateVector3 = this._updateVector3ForUniform;\r\n this.updateVector4 = this._updateVector4ForUniform;\r\n this.updateColor3 = this._updateColor3ForUniform;\r\n this.updateColor4 = this._updateColor4ForUniform;\r\n }\r\n }\r\n Object.defineProperty(UniformBuffer.prototype, \"useUbo\", {\r\n /**\r\n * Indicates if the buffer is using the WebGL2 UBO implementation,\r\n * or just falling back on setUniformXXX calls.\r\n */\r\n get: function () {\r\n return !this._noUBO;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(UniformBuffer.prototype, \"isSync\", {\r\n /**\r\n * Indicates if the WebGL underlying uniform buffer is in sync\r\n * with the javascript cache data.\r\n */\r\n get: function () {\r\n return !this._needSync;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Indicates if the WebGL underlying uniform buffer is dynamic.\r\n * Also, a dynamic UniformBuffer will disable cache verification and always\r\n * update the underlying WebGL uniform buffer to the GPU.\r\n * @returns if Dynamic, otherwise false\r\n */\r\n UniformBuffer.prototype.isDynamic = function () {\r\n return this._dynamic !== undefined;\r\n };\r\n /**\r\n * The data cache on JS side.\r\n * @returns the underlying data as a float array\r\n */\r\n UniformBuffer.prototype.getData = function () {\r\n return this._bufferData;\r\n };\r\n /**\r\n * The underlying WebGL Uniform buffer.\r\n * @returns the webgl buffer\r\n */\r\n UniformBuffer.prototype.getBuffer = function () {\r\n return this._buffer;\r\n };\r\n /**\r\n * std140 layout specifies how to align data within an UBO structure.\r\n * See https://khronos.org/registry/OpenGL/specs/gl/glspec45.core.pdf#page=159\r\n * for specs.\r\n */\r\n UniformBuffer.prototype._fillAlignment = function (size) {\r\n // This code has been simplified because we only use floats, vectors of 1, 2, 3, 4 components\r\n // and 4x4 matrices\r\n // TODO : change if other types are used\r\n var alignment;\r\n if (size <= 2) {\r\n alignment = size;\r\n }\r\n else {\r\n alignment = 4;\r\n }\r\n if ((this._uniformLocationPointer % alignment) !== 0) {\r\n var oldPointer = this._uniformLocationPointer;\r\n this._uniformLocationPointer += alignment - (this._uniformLocationPointer % alignment);\r\n var diff = this._uniformLocationPointer - oldPointer;\r\n for (var i = 0; i < diff; i++) {\r\n this._data.push(0);\r\n }\r\n }\r\n };\r\n /**\r\n * Adds an uniform in the buffer.\r\n * Warning : the subsequents calls of this function must be in the same order as declared in the shader\r\n * for the layout to be correct !\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param size Data size, or data directly.\r\n */\r\n UniformBuffer.prototype.addUniform = function (name, size) {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n if (this._uniformLocations[name] !== undefined) {\r\n // Already existing uniform\r\n return;\r\n }\r\n // This function must be called in the order of the shader layout !\r\n // size can be the size of the uniform, or data directly\r\n var data;\r\n if (size instanceof Array) {\r\n data = size;\r\n size = data.length;\r\n }\r\n else {\r\n size = size;\r\n data = [];\r\n // Fill with zeros\r\n for (var i = 0; i < size; i++) {\r\n data.push(0);\r\n }\r\n }\r\n this._fillAlignment(size);\r\n this._uniformSizes[name] = size;\r\n this._uniformLocations[name] = this._uniformLocationPointer;\r\n this._uniformLocationPointer += size;\r\n for (var i = 0; i < size; i++) {\r\n this._data.push(data[i]);\r\n }\r\n this._needSync = true;\r\n };\r\n /**\r\n * Adds a Matrix 4x4 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param mat A 4x4 matrix.\r\n */\r\n UniformBuffer.prototype.addMatrix = function (name, mat) {\r\n this.addUniform(name, Array.prototype.slice.call(mat.toArray()));\r\n };\r\n /**\r\n * Adds a vec2 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param x Define the x component value of the vec2\r\n * @param y Define the y component value of the vec2\r\n */\r\n UniformBuffer.prototype.addFloat2 = function (name, x, y) {\r\n var temp = [x, y];\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param x Define the x component value of the vec3\r\n * @param y Define the y component value of the vec3\r\n * @param z Define the z component value of the vec3\r\n */\r\n UniformBuffer.prototype.addFloat3 = function (name, x, y, z) {\r\n var temp = [x, y, z];\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param color Define the vec3 from a Color\r\n */\r\n UniformBuffer.prototype.addColor3 = function (name, color) {\r\n var temp = new Array();\r\n color.toArray(temp);\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec4 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param color Define the rgb components from a Color\r\n * @param alpha Define the a component of the vec4\r\n */\r\n UniformBuffer.prototype.addColor4 = function (name, color, alpha) {\r\n var temp = new Array();\r\n color.toArray(temp);\r\n temp.push(alpha);\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param vector Define the vec3 components from a Vector\r\n */\r\n UniformBuffer.prototype.addVector3 = function (name, vector) {\r\n var temp = new Array();\r\n vector.toArray(temp);\r\n this.addUniform(name, temp);\r\n };\r\n /**\r\n * Adds a Matrix 3x3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n */\r\n UniformBuffer.prototype.addMatrix3x3 = function (name) {\r\n this.addUniform(name, 12);\r\n };\r\n /**\r\n * Adds a Matrix 2x2 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n */\r\n UniformBuffer.prototype.addMatrix2x2 = function (name) {\r\n this.addUniform(name, 8);\r\n };\r\n /**\r\n * Effectively creates the WebGL Uniform Buffer, once layout is completed with `addUniform`.\r\n */\r\n UniformBuffer.prototype.create = function () {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n if (this._buffer) {\r\n return; // nothing to do\r\n }\r\n // See spec, alignment must be filled as a vec4\r\n this._fillAlignment(4);\r\n this._bufferData = new Float32Array(this._data);\r\n this._rebuild();\r\n this._needSync = true;\r\n };\r\n /** @hidden */\r\n UniformBuffer.prototype._rebuild = function () {\r\n if (this._noUBO || !this._bufferData) {\r\n return;\r\n }\r\n if (this._dynamic) {\r\n this._buffer = this._engine.createDynamicUniformBuffer(this._bufferData);\r\n }\r\n else {\r\n this._buffer = this._engine.createUniformBuffer(this._bufferData);\r\n }\r\n };\r\n /**\r\n * Updates the WebGL Uniform Buffer on the GPU.\r\n * If the `dynamic` flag is set to true, no cache comparison is done.\r\n * Otherwise, the buffer will be updated only if the cache differs.\r\n */\r\n UniformBuffer.prototype.update = function () {\r\n if (!this._buffer) {\r\n this.create();\r\n return;\r\n }\r\n if (!this._dynamic && !this._needSync) {\r\n return;\r\n }\r\n this._engine.updateUniformBuffer(this._buffer, this._bufferData);\r\n this._needSync = false;\r\n };\r\n /**\r\n * Updates the value of an uniform. The `update` method must be called afterwards to make it effective in the GPU.\r\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\r\n * @param data Define the flattened data\r\n * @param size Define the size of the data.\r\n */\r\n UniformBuffer.prototype.updateUniform = function (uniformName, data, size) {\r\n var location = this._uniformLocations[uniformName];\r\n if (location === undefined) {\r\n if (this._buffer) {\r\n // Cannot add an uniform if the buffer is already created\r\n Logger.Error(\"Cannot add an uniform after UBO has been created.\");\r\n return;\r\n }\r\n this.addUniform(uniformName, size);\r\n location = this._uniformLocations[uniformName];\r\n }\r\n if (!this._buffer) {\r\n this.create();\r\n }\r\n if (!this._dynamic) {\r\n // Cache for static uniform buffers\r\n var changed = false;\r\n for (var i = 0; i < size; i++) {\r\n // We are checking the matrix cache before calling updateUniform so we do not need to check it here\r\n // Hence the test for size === 16 to simply commit the matrix values\r\n if (size === 16 || this._bufferData[location + i] !== data[i]) {\r\n changed = true;\r\n this._bufferData[location + i] = data[i];\r\n }\r\n }\r\n this._needSync = this._needSync || changed;\r\n }\r\n else {\r\n // No cache for dynamic\r\n for (var i = 0; i < size; i++) {\r\n this._bufferData[location + i] = data[i];\r\n }\r\n }\r\n };\r\n UniformBuffer.prototype._cacheMatrix = function (name, matrix) {\r\n var cache = this._valueCache[name];\r\n var flag = matrix.updateFlag;\r\n if (cache !== undefined && cache === flag) {\r\n return false;\r\n }\r\n this._valueCache[name] = flag;\r\n return true;\r\n };\r\n // Update methods\r\n UniformBuffer.prototype._updateMatrix3x3ForUniform = function (name, matrix) {\r\n // To match std140, matrix must be realigned\r\n for (var i = 0; i < 3; i++) {\r\n UniformBuffer._tempBuffer[i * 4] = matrix[i * 3];\r\n UniformBuffer._tempBuffer[i * 4 + 1] = matrix[i * 3 + 1];\r\n UniformBuffer._tempBuffer[i * 4 + 2] = matrix[i * 3 + 2];\r\n UniformBuffer._tempBuffer[i * 4 + 3] = 0.0;\r\n }\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 12);\r\n };\r\n UniformBuffer.prototype._updateMatrix3x3ForEffect = function (name, matrix) {\r\n this._currentEffect.setMatrix3x3(name, matrix);\r\n };\r\n UniformBuffer.prototype._updateMatrix2x2ForEffect = function (name, matrix) {\r\n this._currentEffect.setMatrix2x2(name, matrix);\r\n };\r\n UniformBuffer.prototype._updateMatrix2x2ForUniform = function (name, matrix) {\r\n // To match std140, matrix must be realigned\r\n for (var i = 0; i < 2; i++) {\r\n UniformBuffer._tempBuffer[i * 4] = matrix[i * 2];\r\n UniformBuffer._tempBuffer[i * 4 + 1] = matrix[i * 2 + 1];\r\n UniformBuffer._tempBuffer[i * 4 + 2] = 0.0;\r\n UniformBuffer._tempBuffer[i * 4 + 3] = 0.0;\r\n }\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 8);\r\n };\r\n UniformBuffer.prototype._updateFloatForEffect = function (name, x) {\r\n this._currentEffect.setFloat(name, x);\r\n };\r\n UniformBuffer.prototype._updateFloatForUniform = function (name, x) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 1);\r\n };\r\n UniformBuffer.prototype._updateFloat2ForEffect = function (name, x, y, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setFloat2(name + suffix, x, y);\r\n };\r\n UniformBuffer.prototype._updateFloat2ForUniform = function (name, x, y) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n UniformBuffer._tempBuffer[1] = y;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 2);\r\n };\r\n UniformBuffer.prototype._updateFloat3ForEffect = function (name, x, y, z, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setFloat3(name + suffix, x, y, z);\r\n };\r\n UniformBuffer.prototype._updateFloat3ForUniform = function (name, x, y, z) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n UniformBuffer._tempBuffer[1] = y;\r\n UniformBuffer._tempBuffer[2] = z;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 3);\r\n };\r\n UniformBuffer.prototype._updateFloat4ForEffect = function (name, x, y, z, w, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setFloat4(name + suffix, x, y, z, w);\r\n };\r\n UniformBuffer.prototype._updateFloat4ForUniform = function (name, x, y, z, w) {\r\n UniformBuffer._tempBuffer[0] = x;\r\n UniformBuffer._tempBuffer[1] = y;\r\n UniformBuffer._tempBuffer[2] = z;\r\n UniformBuffer._tempBuffer[3] = w;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 4);\r\n };\r\n UniformBuffer.prototype._updateMatrixForEffect = function (name, mat) {\r\n this._currentEffect.setMatrix(name, mat);\r\n };\r\n UniformBuffer.prototype._updateMatrixForUniform = function (name, mat) {\r\n if (this._cacheMatrix(name, mat)) {\r\n this.updateUniform(name, mat.toArray(), 16);\r\n }\r\n };\r\n UniformBuffer.prototype._updateVector3ForEffect = function (name, vector) {\r\n this._currentEffect.setVector3(name, vector);\r\n };\r\n UniformBuffer.prototype._updateVector3ForUniform = function (name, vector) {\r\n vector.toArray(UniformBuffer._tempBuffer);\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 3);\r\n };\r\n UniformBuffer.prototype._updateVector4ForEffect = function (name, vector) {\r\n this._currentEffect.setVector4(name, vector);\r\n };\r\n UniformBuffer.prototype._updateVector4ForUniform = function (name, vector) {\r\n vector.toArray(UniformBuffer._tempBuffer);\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 4);\r\n };\r\n UniformBuffer.prototype._updateColor3ForEffect = function (name, color, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setColor3(name + suffix, color);\r\n };\r\n UniformBuffer.prototype._updateColor3ForUniform = function (name, color) {\r\n color.toArray(UniformBuffer._tempBuffer);\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 3);\r\n };\r\n UniformBuffer.prototype._updateColor4ForEffect = function (name, color, alpha, suffix) {\r\n if (suffix === void 0) { suffix = \"\"; }\r\n this._currentEffect.setColor4(name + suffix, color, alpha);\r\n };\r\n UniformBuffer.prototype._updateColor4ForUniform = function (name, color, alpha) {\r\n color.toArray(UniformBuffer._tempBuffer);\r\n UniformBuffer._tempBuffer[3] = alpha;\r\n this.updateUniform(name, UniformBuffer._tempBuffer, 4);\r\n };\r\n /**\r\n * Sets a sampler uniform on the effect.\r\n * @param name Define the name of the sampler.\r\n * @param texture Define the texture to set in the sampler\r\n */\r\n UniformBuffer.prototype.setTexture = function (name, texture) {\r\n this._currentEffect.setTexture(name, texture);\r\n };\r\n /**\r\n * Directly updates the value of the uniform in the cache AND on the GPU.\r\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\r\n * @param data Define the flattened data\r\n */\r\n UniformBuffer.prototype.updateUniformDirectly = function (uniformName, data) {\r\n this.updateUniform(uniformName, data, data.length);\r\n this.update();\r\n };\r\n /**\r\n * Binds this uniform buffer to an effect.\r\n * @param effect Define the effect to bind the buffer to\r\n * @param name Name of the uniform block in the shader.\r\n */\r\n UniformBuffer.prototype.bindToEffect = function (effect, name) {\r\n this._currentEffect = effect;\r\n if (this._noUBO || !this._buffer) {\r\n return;\r\n }\r\n this._alreadyBound = true;\r\n effect.bindUniformBuffer(this._buffer, name);\r\n };\r\n /**\r\n * Disposes the uniform buffer.\r\n */\r\n UniformBuffer.prototype.dispose = function () {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n var uniformBuffers = this._engine._uniformBuffers;\r\n var index = uniformBuffers.indexOf(this);\r\n if (index !== -1) {\r\n uniformBuffers[index] = uniformBuffers[uniformBuffers.length - 1];\r\n uniformBuffers.pop();\r\n }\r\n if (!this._buffer) {\r\n return;\r\n }\r\n if (this._engine._releaseBuffer(this._buffer)) {\r\n this._buffer = null;\r\n }\r\n };\r\n // Pool for avoiding memory leaks\r\n UniformBuffer._MAX_UNIFORM_SIZE = 256;\r\n UniformBuffer._tempBuffer = new Float32Array(UniformBuffer._MAX_UNIFORM_SIZE);\r\n return UniformBuffer;\r\n}());\r\nexport { UniformBuffer };\r\n//# sourceMappingURL=uniformBuffer.js.map","import { Vector3 } from './math.vector';\r\n/** Defines supported spaces */\r\nexport var Space;\r\n(function (Space) {\r\n /** Local (object) space */\r\n Space[Space[\"LOCAL\"] = 0] = \"LOCAL\";\r\n /** World space */\r\n Space[Space[\"WORLD\"] = 1] = \"WORLD\";\r\n /** Bone space */\r\n Space[Space[\"BONE\"] = 2] = \"BONE\";\r\n})(Space || (Space = {}));\r\n/** Defines the 3 main axes */\r\nvar Axis = /** @class */ (function () {\r\n function Axis() {\r\n }\r\n /** X axis */\r\n Axis.X = new Vector3(1.0, 0.0, 0.0);\r\n /** Y axis */\r\n Axis.Y = new Vector3(0.0, 1.0, 0.0);\r\n /** Z axis */\r\n Axis.Z = new Vector3(0.0, 0.0, 1.0);\r\n return Axis;\r\n}());\r\nexport { Axis };\r\n/**\r\n * Defines cartesian components.\r\n */\r\nexport var Coordinate;\r\n(function (Coordinate) {\r\n /** X axis */\r\n Coordinate[Coordinate[\"X\"] = 0] = \"X\";\r\n /** Y axis */\r\n Coordinate[Coordinate[\"Y\"] = 1] = \"Y\";\r\n /** Z axis */\r\n Coordinate[Coordinate[\"Z\"] = 2] = \"Z\";\r\n})(Coordinate || (Coordinate = {}));\r\n//# sourceMappingURL=math.axis.js.map","import { Scalar } from './math.scalar';\r\nimport { ToLinearSpace, ToGammaSpace } from './math.constants';\r\nimport { ArrayTools } from '../Misc/arrayTools';\r\nimport { _TypeStore } from '../Misc/typeStore';\r\n/**\r\n * Class used to hold a RBG color\r\n */\r\nvar Color3 = /** @class */ (function () {\r\n /**\r\n * Creates a new Color3 object from red, green, blue values, all between 0 and 1\r\n * @param r defines the red component (between 0 and 1, default is 0)\r\n * @param g defines the green component (between 0 and 1, default is 0)\r\n * @param b defines the blue component (between 0 and 1, default is 0)\r\n */\r\n function Color3(\r\n /**\r\n * Defines the red component (between 0 and 1, default is 0)\r\n */\r\n r, \r\n /**\r\n * Defines the green component (between 0 and 1, default is 0)\r\n */\r\n g, \r\n /**\r\n * Defines the blue component (between 0 and 1, default is 0)\r\n */\r\n b) {\r\n if (r === void 0) { r = 0; }\r\n if (g === void 0) { g = 0; }\r\n if (b === void 0) { b = 0; }\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n }\r\n /**\r\n * Creates a string with the Color3 current values\r\n * @returns the string representation of the Color3 object\r\n */\r\n Color3.prototype.toString = function () {\r\n return \"{R: \" + this.r + \" G:\" + this.g + \" B:\" + this.b + \"}\";\r\n };\r\n /**\r\n * Returns the string \"Color3\"\r\n * @returns \"Color3\"\r\n */\r\n Color3.prototype.getClassName = function () {\r\n return \"Color3\";\r\n };\r\n /**\r\n * Compute the Color3 hash code\r\n * @returns an unique number that can be used to hash Color3 objects\r\n */\r\n Color3.prototype.getHashCode = function () {\r\n var hash = (this.r * 255) | 0;\r\n hash = (hash * 397) ^ ((this.g * 255) | 0);\r\n hash = (hash * 397) ^ ((this.b * 255) | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Stores in the given array from the given starting index the red, green, blue values as successive elements\r\n * @param array defines the array where to store the r,g,b components\r\n * @param index defines an optional index in the target array to define where to start storing values\r\n * @returns the current Color3 object\r\n */\r\n Color3.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this.r;\r\n array[index + 1] = this.g;\r\n array[index + 2] = this.b;\r\n return this;\r\n };\r\n /**\r\n * Update the current color with values stored in an array from the starting index of the given array\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @returns the current Color3 object\r\n */\r\n Color3.prototype.fromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n Color3.FromArrayToRef(array, offset, this);\r\n return this;\r\n };\r\n /**\r\n * Returns a new Color4 object from the current Color3 and the given alpha\r\n * @param alpha defines the alpha component on the new Color4 object (default is 1)\r\n * @returns a new Color4 object\r\n */\r\n Color3.prototype.toColor4 = function (alpha) {\r\n if (alpha === void 0) { alpha = 1; }\r\n return new Color4(this.r, this.g, this.b, alpha);\r\n };\r\n /**\r\n * Returns a new array populated with 3 numeric elements : red, green and blue values\r\n * @returns the new array\r\n */\r\n Color3.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Returns the luminance value\r\n * @returns a float value\r\n */\r\n Color3.prototype.toLuminance = function () {\r\n return this.r * 0.3 + this.g * 0.59 + this.b * 0.11;\r\n };\r\n /**\r\n * Multiply each Color3 rgb values by the given Color3 rgb values in a new Color3 object\r\n * @param otherColor defines the second operand\r\n * @returns the new Color3 object\r\n */\r\n Color3.prototype.multiply = function (otherColor) {\r\n return new Color3(this.r * otherColor.r, this.g * otherColor.g, this.b * otherColor.b);\r\n };\r\n /**\r\n * Multiply the rgb values of the Color3 and the given Color3 and stores the result in the object \"result\"\r\n * @param otherColor defines the second operand\r\n * @param result defines the Color3 object where to store the result\r\n * @returns the current Color3\r\n */\r\n Color3.prototype.multiplyToRef = function (otherColor, result) {\r\n result.r = this.r * otherColor.r;\r\n result.g = this.g * otherColor.g;\r\n result.b = this.b * otherColor.b;\r\n return this;\r\n };\r\n /**\r\n * Determines equality between Color3 objects\r\n * @param otherColor defines the second operand\r\n * @returns true if the rgb values are equal to the given ones\r\n */\r\n Color3.prototype.equals = function (otherColor) {\r\n return otherColor && this.r === otherColor.r && this.g === otherColor.g && this.b === otherColor.b;\r\n };\r\n /**\r\n * Determines equality between the current Color3 object and a set of r,b,g values\r\n * @param r defines the red component to check\r\n * @param g defines the green component to check\r\n * @param b defines the blue component to check\r\n * @returns true if the rgb values are equal to the given ones\r\n */\r\n Color3.prototype.equalsFloats = function (r, g, b) {\r\n return this.r === r && this.g === g && this.b === b;\r\n };\r\n /**\r\n * Multiplies in place each rgb value by scale\r\n * @param scale defines the scaling factor\r\n * @returns the updated Color3\r\n */\r\n Color3.prototype.scale = function (scale) {\r\n return new Color3(this.r * scale, this.g * scale, this.b * scale);\r\n };\r\n /**\r\n * Multiplies the rgb values by scale and stores the result into \"result\"\r\n * @param scale defines the scaling factor\r\n * @param result defines the Color3 object where to store the result\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.scaleToRef = function (scale, result) {\r\n result.r = this.r * scale;\r\n result.g = this.g * scale;\r\n result.b = this.b * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Color3 values by a factor and add the result to a given Color3\r\n * @param scale defines the scale factor\r\n * @param result defines color to store the result into\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.r += this.r * scale;\r\n result.g += this.g * scale;\r\n result.b += this.b * scale;\r\n return this;\r\n };\r\n /**\r\n * Clamps the rgb values by the min and max values and stores the result into \"result\"\r\n * @param min defines minimum clamping value (default is 0)\r\n * @param max defines maximum clamping value (default is 1)\r\n * @param result defines color to store the result into\r\n * @returns the original Color3\r\n */\r\n Color3.prototype.clampToRef = function (min, max, result) {\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 1; }\r\n result.r = Scalar.Clamp(this.r, min, max);\r\n result.g = Scalar.Clamp(this.g, min, max);\r\n result.b = Scalar.Clamp(this.b, min, max);\r\n return this;\r\n };\r\n /**\r\n * Creates a new Color3 set with the added values of the current Color3 and of the given one\r\n * @param otherColor defines the second operand\r\n * @returns the new Color3\r\n */\r\n Color3.prototype.add = function (otherColor) {\r\n return new Color3(this.r + otherColor.r, this.g + otherColor.g, this.b + otherColor.b);\r\n };\r\n /**\r\n * Stores the result of the addition of the current Color3 and given one rgb values into \"result\"\r\n * @param otherColor defines the second operand\r\n * @param result defines Color3 object to store the result into\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.addToRef = function (otherColor, result) {\r\n result.r = this.r + otherColor.r;\r\n result.g = this.g + otherColor.g;\r\n result.b = this.b + otherColor.b;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Color3 set with the subtracted values of the given one from the current Color3\r\n * @param otherColor defines the second operand\r\n * @returns the new Color3\r\n */\r\n Color3.prototype.subtract = function (otherColor) {\r\n return new Color3(this.r - otherColor.r, this.g - otherColor.g, this.b - otherColor.b);\r\n };\r\n /**\r\n * Stores the result of the subtraction of given one from the current Color3 rgb values into \"result\"\r\n * @param otherColor defines the second operand\r\n * @param result defines Color3 object to store the result into\r\n * @returns the unmodified current Color3\r\n */\r\n Color3.prototype.subtractToRef = function (otherColor, result) {\r\n result.r = this.r - otherColor.r;\r\n result.g = this.g - otherColor.g;\r\n result.b = this.b - otherColor.b;\r\n return this;\r\n };\r\n /**\r\n * Copy the current object\r\n * @returns a new Color3 copied the current one\r\n */\r\n Color3.prototype.clone = function () {\r\n return new Color3(this.r, this.g, this.b);\r\n };\r\n /**\r\n * Copies the rgb values from the source in the current Color3\r\n * @param source defines the source Color3 object\r\n * @returns the updated Color3 object\r\n */\r\n Color3.prototype.copyFrom = function (source) {\r\n this.r = source.r;\r\n this.g = source.g;\r\n this.b = source.b;\r\n return this;\r\n };\r\n /**\r\n * Updates the Color3 rgb values from the given floats\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @returns the current Color3 object\r\n */\r\n Color3.prototype.copyFromFloats = function (r, g, b) {\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n return this;\r\n };\r\n /**\r\n * Updates the Color3 rgb values from the given floats\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @returns the current Color3 object\r\n */\r\n Color3.prototype.set = function (r, g, b) {\r\n return this.copyFromFloats(r, g, b);\r\n };\r\n /**\r\n * Compute the Color3 hexadecimal code as a string\r\n * @returns a string containing the hexadecimal representation of the Color3 object\r\n */\r\n Color3.prototype.toHexString = function () {\r\n var intR = (this.r * 255) | 0;\r\n var intG = (this.g * 255) | 0;\r\n var intB = (this.b * 255) | 0;\r\n return \"#\" + Scalar.ToHex(intR) + Scalar.ToHex(intG) + Scalar.ToHex(intB);\r\n };\r\n /**\r\n * Computes a new Color3 converted from the current one to linear space\r\n * @returns a new Color3 object\r\n */\r\n Color3.prototype.toLinearSpace = function () {\r\n var convertedColor = new Color3();\r\n this.toLinearSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts current color in rgb space to HSV values\r\n * @returns a new color3 representing the HSV values\r\n */\r\n Color3.prototype.toHSV = function () {\r\n var result = new Color3();\r\n this.toHSVToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Converts current color in rgb space to HSV values\r\n * @param result defines the Color3 where to store the HSV values\r\n */\r\n Color3.prototype.toHSVToRef = function (result) {\r\n var r = this.r;\r\n var g = this.g;\r\n var b = this.b;\r\n var max = Math.max(r, g, b);\r\n var min = Math.min(r, g, b);\r\n var h = 0;\r\n var s = 0;\r\n var v = max;\r\n var dm = max - min;\r\n if (max !== 0) {\r\n s = dm / max;\r\n }\r\n if (max != min) {\r\n if (max == r) {\r\n h = (g - b) / dm;\r\n if (g < b) {\r\n h += 6;\r\n }\r\n }\r\n else if (max == g) {\r\n h = (b - r) / dm + 2;\r\n }\r\n else if (max == b) {\r\n h = (r - g) / dm + 4;\r\n }\r\n h *= 60;\r\n }\r\n result.r = h;\r\n result.g = s;\r\n result.b = v;\r\n };\r\n /**\r\n * Converts the Color3 values to linear space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color3 object where to store the linear space version\r\n * @returns the unmodified Color3\r\n */\r\n Color3.prototype.toLinearSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, ToLinearSpace);\r\n convertedColor.g = Math.pow(this.g, ToLinearSpace);\r\n convertedColor.b = Math.pow(this.b, ToLinearSpace);\r\n return this;\r\n };\r\n /**\r\n * Computes a new Color3 converted from the current one to gamma space\r\n * @returns a new Color3 object\r\n */\r\n Color3.prototype.toGammaSpace = function () {\r\n var convertedColor = new Color3();\r\n this.toGammaSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts the Color3 values to gamma space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color3 object where to store the gamma space version\r\n * @returns the unmodified Color3\r\n */\r\n Color3.prototype.toGammaSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, ToGammaSpace);\r\n convertedColor.g = Math.pow(this.g, ToGammaSpace);\r\n convertedColor.b = Math.pow(this.b, ToGammaSpace);\r\n return this;\r\n };\r\n /**\r\n * Convert Hue, saturation and value to a Color3 (RGB)\r\n * @param hue defines the hue\r\n * @param saturation defines the saturation\r\n * @param value defines the value\r\n * @param result defines the Color3 where to store the RGB values\r\n */\r\n Color3.HSVtoRGBToRef = function (hue, saturation, value, result) {\r\n var chroma = value * saturation;\r\n var h = hue / 60;\r\n var x = chroma * (1 - Math.abs((h % 2) - 1));\r\n var r = 0;\r\n var g = 0;\r\n var b = 0;\r\n if (h >= 0 && h <= 1) {\r\n r = chroma;\r\n g = x;\r\n }\r\n else if (h >= 1 && h <= 2) {\r\n r = x;\r\n g = chroma;\r\n }\r\n else if (h >= 2 && h <= 3) {\r\n g = chroma;\r\n b = x;\r\n }\r\n else if (h >= 3 && h <= 4) {\r\n g = x;\r\n b = chroma;\r\n }\r\n else if (h >= 4 && h <= 5) {\r\n r = x;\r\n b = chroma;\r\n }\r\n else if (h >= 5 && h <= 6) {\r\n r = chroma;\r\n b = x;\r\n }\r\n var m = value - chroma;\r\n result.set((r + m), (g + m), (b + m));\r\n };\r\n /**\r\n * Creates a new Color3 from the string containing valid hexadecimal values\r\n * @param hex defines a string containing valid hexadecimal values\r\n * @returns a new Color3 object\r\n */\r\n Color3.FromHexString = function (hex) {\r\n if (hex.substring(0, 1) !== \"#\" || hex.length !== 7) {\r\n return new Color3(0, 0, 0);\r\n }\r\n var r = parseInt(hex.substring(1, 3), 16);\r\n var g = parseInt(hex.substring(3, 5), 16);\r\n var b = parseInt(hex.substring(5, 7), 16);\r\n return Color3.FromInts(r, g, b);\r\n };\r\n /**\r\n * Creates a new Color3 from the starting index of the given array\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @returns a new Color3 object\r\n */\r\n Color3.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Color3(array[offset], array[offset + 1], array[offset + 2]);\r\n };\r\n /**\r\n * Creates a new Color3 from the starting index element of the given array\r\n * @param array defines the source array to read from\r\n * @param offset defines the offset in the source array\r\n * @param result defines the target Color3 object\r\n */\r\n Color3.FromArrayToRef = function (array, offset, result) {\r\n if (offset === void 0) { offset = 0; }\r\n result.r = array[offset];\r\n result.g = array[offset + 1];\r\n result.b = array[offset + 2];\r\n };\r\n /**\r\n * Creates a new Color3 from integer values (< 256)\r\n * @param r defines the red component to read from (value between 0 and 255)\r\n * @param g defines the green component to read from (value between 0 and 255)\r\n * @param b defines the blue component to read from (value between 0 and 255)\r\n * @returns a new Color3 object\r\n */\r\n Color3.FromInts = function (r, g, b) {\r\n return new Color3(r / 255.0, g / 255.0, b / 255.0);\r\n };\r\n /**\r\n * Creates a new Color3 with values linearly interpolated of \"amount\" between the start Color3 and the end Color3\r\n * @param start defines the start Color3 value\r\n * @param end defines the end Color3 value\r\n * @param amount defines the gradient value between start and end\r\n * @returns a new Color3 object\r\n */\r\n Color3.Lerp = function (start, end, amount) {\r\n var result = new Color3(0.0, 0.0, 0.0);\r\n Color3.LerpToRef(start, end, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new Color3 with values linearly interpolated of \"amount\" between the start Color3 and the end Color3\r\n * @param left defines the start value\r\n * @param right defines the end value\r\n * @param amount defines the gradient factor\r\n * @param result defines the Color3 object where to store the result\r\n */\r\n Color3.LerpToRef = function (left, right, amount, result) {\r\n result.r = left.r + ((right.r - left.r) * amount);\r\n result.g = left.g + ((right.g - left.g) * amount);\r\n result.b = left.b + ((right.b - left.b) * amount);\r\n };\r\n /**\r\n * Returns a Color3 value containing a red color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Red = function () { return new Color3(1, 0, 0); };\r\n /**\r\n * Returns a Color3 value containing a green color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Green = function () { return new Color3(0, 1, 0); };\r\n /**\r\n * Returns a Color3 value containing a blue color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Blue = function () { return new Color3(0, 0, 1); };\r\n /**\r\n * Returns a Color3 value containing a black color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Black = function () { return new Color3(0, 0, 0); };\r\n Object.defineProperty(Color3, \"BlackReadOnly\", {\r\n /**\r\n * Gets a Color3 value containing a black color that must not be updated\r\n */\r\n get: function () {\r\n return Color3._BlackReadOnly;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a Color3 value containing a white color\r\n * @returns a new Color3 object\r\n */\r\n Color3.White = function () { return new Color3(1, 1, 1); };\r\n /**\r\n * Returns a Color3 value containing a purple color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Purple = function () { return new Color3(0.5, 0, 0.5); };\r\n /**\r\n * Returns a Color3 value containing a magenta color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Magenta = function () { return new Color3(1, 0, 1); };\r\n /**\r\n * Returns a Color3 value containing a yellow color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Yellow = function () { return new Color3(1, 1, 0); };\r\n /**\r\n * Returns a Color3 value containing a gray color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Gray = function () { return new Color3(0.5, 0.5, 0.5); };\r\n /**\r\n * Returns a Color3 value containing a teal color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Teal = function () { return new Color3(0, 1.0, 1.0); };\r\n /**\r\n * Returns a Color3 value containing a random color\r\n * @returns a new Color3 object\r\n */\r\n Color3.Random = function () { return new Color3(Math.random(), Math.random(), Math.random()); };\r\n // Statics\r\n Color3._BlackReadOnly = Color3.Black();\r\n return Color3;\r\n}());\r\nexport { Color3 };\r\n/**\r\n * Class used to hold a RBGA color\r\n */\r\nvar Color4 = /** @class */ (function () {\r\n /**\r\n * Creates a new Color4 object from red, green, blue values, all between 0 and 1\r\n * @param r defines the red component (between 0 and 1, default is 0)\r\n * @param g defines the green component (between 0 and 1, default is 0)\r\n * @param b defines the blue component (between 0 and 1, default is 0)\r\n * @param a defines the alpha component (between 0 and 1, default is 1)\r\n */\r\n function Color4(\r\n /**\r\n * Defines the red component (between 0 and 1, default is 0)\r\n */\r\n r, \r\n /**\r\n * Defines the green component (between 0 and 1, default is 0)\r\n */\r\n g, \r\n /**\r\n * Defines the blue component (between 0 and 1, default is 0)\r\n */\r\n b, \r\n /**\r\n * Defines the alpha component (between 0 and 1, default is 1)\r\n */\r\n a) {\r\n if (r === void 0) { r = 0; }\r\n if (g === void 0) { g = 0; }\r\n if (b === void 0) { b = 0; }\r\n if (a === void 0) { a = 1; }\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n this.a = a;\r\n }\r\n // Operators\r\n /**\r\n * Adds in place the given Color4 values to the current Color4 object\r\n * @param right defines the second operand\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.addInPlace = function (right) {\r\n this.r += right.r;\r\n this.g += right.g;\r\n this.b += right.b;\r\n this.a += right.a;\r\n return this;\r\n };\r\n /**\r\n * Creates a new array populated with 4 numeric elements : red, green, blue, alpha values\r\n * @returns the new array\r\n */\r\n Color4.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Stores from the starting index in the given array the Color4 successive values\r\n * @param array defines the array where to store the r,g,b components\r\n * @param index defines an optional index in the target array to define where to start storing values\r\n * @returns the current Color4 object\r\n */\r\n Color4.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this.r;\r\n array[index + 1] = this.g;\r\n array[index + 2] = this.b;\r\n array[index + 3] = this.a;\r\n return this;\r\n };\r\n /**\r\n * Update the current color with values stored in an array from the starting index of the given array\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @returns the current Color4 object\r\n */\r\n Color4.prototype.fromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n Color4.FromArrayToRef(array, offset, this);\r\n return this;\r\n };\r\n /**\r\n * Determines equality between Color4 objects\r\n * @param otherColor defines the second operand\r\n * @returns true if the rgba values are equal to the given ones\r\n */\r\n Color4.prototype.equals = function (otherColor) {\r\n return otherColor && this.r === otherColor.r && this.g === otherColor.g && this.b === otherColor.b && this.a === otherColor.a;\r\n };\r\n /**\r\n * Creates a new Color4 set with the added values of the current Color4 and of the given one\r\n * @param right defines the second operand\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.add = function (right) {\r\n return new Color4(this.r + right.r, this.g + right.g, this.b + right.b, this.a + right.a);\r\n };\r\n /**\r\n * Creates a new Color4 set with the subtracted values of the given one from the current Color4\r\n * @param right defines the second operand\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.subtract = function (right) {\r\n return new Color4(this.r - right.r, this.g - right.g, this.b - right.b, this.a - right.a);\r\n };\r\n /**\r\n * Subtracts the given ones from the current Color4 values and stores the results in \"result\"\r\n * @param right defines the second operand\r\n * @param result defines the Color4 object where to store the result\r\n * @returns the current Color4 object\r\n */\r\n Color4.prototype.subtractToRef = function (right, result) {\r\n result.r = this.r - right.r;\r\n result.g = this.g - right.g;\r\n result.b = this.b - right.b;\r\n result.a = this.a - right.a;\r\n return this;\r\n };\r\n /**\r\n * Creates a new Color4 with the current Color4 values multiplied by scale\r\n * @param scale defines the scaling factor to apply\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.scale = function (scale) {\r\n return new Color4(this.r * scale, this.g * scale, this.b * scale, this.a * scale);\r\n };\r\n /**\r\n * Multiplies the current Color4 values by scale and stores the result in \"result\"\r\n * @param scale defines the scaling factor to apply\r\n * @param result defines the Color4 object where to store the result\r\n * @returns the current unmodified Color4\r\n */\r\n Color4.prototype.scaleToRef = function (scale, result) {\r\n result.r = this.r * scale;\r\n result.g = this.g * scale;\r\n result.b = this.b * scale;\r\n result.a = this.a * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Color4 values by a factor and add the result to a given Color4\r\n * @param scale defines the scale factor\r\n * @param result defines the Color4 object where to store the result\r\n * @returns the unmodified current Color4\r\n */\r\n Color4.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.r += this.r * scale;\r\n result.g += this.g * scale;\r\n result.b += this.b * scale;\r\n result.a += this.a * scale;\r\n return this;\r\n };\r\n /**\r\n * Clamps the rgb values by the min and max values and stores the result into \"result\"\r\n * @param min defines minimum clamping value (default is 0)\r\n * @param max defines maximum clamping value (default is 1)\r\n * @param result defines color to store the result into.\r\n * @returns the cuurent Color4\r\n */\r\n Color4.prototype.clampToRef = function (min, max, result) {\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 1; }\r\n result.r = Scalar.Clamp(this.r, min, max);\r\n result.g = Scalar.Clamp(this.g, min, max);\r\n result.b = Scalar.Clamp(this.b, min, max);\r\n result.a = Scalar.Clamp(this.a, min, max);\r\n return this;\r\n };\r\n /**\r\n * Multipy an Color4 value by another and return a new Color4 object\r\n * @param color defines the Color4 value to multiply by\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.multiply = function (color) {\r\n return new Color4(this.r * color.r, this.g * color.g, this.b * color.b, this.a * color.a);\r\n };\r\n /**\r\n * Multipy a Color4 value by another and push the result in a reference value\r\n * @param color defines the Color4 value to multiply by\r\n * @param result defines the Color4 to fill the result in\r\n * @returns the result Color4\r\n */\r\n Color4.prototype.multiplyToRef = function (color, result) {\r\n result.r = this.r * color.r;\r\n result.g = this.g * color.g;\r\n result.b = this.b * color.b;\r\n result.a = this.a * color.a;\r\n return result;\r\n };\r\n /**\r\n * Creates a string with the Color4 current values\r\n * @returns the string representation of the Color4 object\r\n */\r\n Color4.prototype.toString = function () {\r\n return \"{R: \" + this.r + \" G:\" + this.g + \" B:\" + this.b + \" A:\" + this.a + \"}\";\r\n };\r\n /**\r\n * Returns the string \"Color4\"\r\n * @returns \"Color4\"\r\n */\r\n Color4.prototype.getClassName = function () {\r\n return \"Color4\";\r\n };\r\n /**\r\n * Compute the Color4 hash code\r\n * @returns an unique number that can be used to hash Color4 objects\r\n */\r\n Color4.prototype.getHashCode = function () {\r\n var hash = (this.r * 255) | 0;\r\n hash = (hash * 397) ^ ((this.g * 255) | 0);\r\n hash = (hash * 397) ^ ((this.b * 255) | 0);\r\n hash = (hash * 397) ^ ((this.a * 255) | 0);\r\n return hash;\r\n };\r\n /**\r\n * Creates a new Color4 copied from the current one\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.clone = function () {\r\n return new Color4(this.r, this.g, this.b, this.a);\r\n };\r\n /**\r\n * Copies the given Color4 values into the current one\r\n * @param source defines the source Color4 object\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.copyFrom = function (source) {\r\n this.r = source.r;\r\n this.g = source.g;\r\n this.b = source.b;\r\n this.a = source.a;\r\n return this;\r\n };\r\n /**\r\n * Copies the given float values into the current one\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @param a defines the alpha component to read from\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.copyFromFloats = function (r, g, b, a) {\r\n this.r = r;\r\n this.g = g;\r\n this.b = b;\r\n this.a = a;\r\n return this;\r\n };\r\n /**\r\n * Copies the given float values into the current one\r\n * @param r defines the red component to read from\r\n * @param g defines the green component to read from\r\n * @param b defines the blue component to read from\r\n * @param a defines the alpha component to read from\r\n * @returns the current updated Color4 object\r\n */\r\n Color4.prototype.set = function (r, g, b, a) {\r\n return this.copyFromFloats(r, g, b, a);\r\n };\r\n /**\r\n * Compute the Color4 hexadecimal code as a string\r\n * @param returnAsColor3 defines if the string should only contains RGB values (off by default)\r\n * @returns a string containing the hexadecimal representation of the Color4 object\r\n */\r\n Color4.prototype.toHexString = function (returnAsColor3) {\r\n if (returnAsColor3 === void 0) { returnAsColor3 = false; }\r\n var intR = (this.r * 255) | 0;\r\n var intG = (this.g * 255) | 0;\r\n var intB = (this.b * 255) | 0;\r\n if (returnAsColor3) {\r\n return \"#\" + Scalar.ToHex(intR) + Scalar.ToHex(intG) + Scalar.ToHex(intB);\r\n }\r\n var intA = (this.a * 255) | 0;\r\n return \"#\" + Scalar.ToHex(intR) + Scalar.ToHex(intG) + Scalar.ToHex(intB) + Scalar.ToHex(intA);\r\n };\r\n /**\r\n * Computes a new Color4 converted from the current one to linear space\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.toLinearSpace = function () {\r\n var convertedColor = new Color4();\r\n this.toLinearSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts the Color4 values to linear space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color4 object where to store the linear space version\r\n * @returns the unmodified Color4\r\n */\r\n Color4.prototype.toLinearSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, ToLinearSpace);\r\n convertedColor.g = Math.pow(this.g, ToLinearSpace);\r\n convertedColor.b = Math.pow(this.b, ToLinearSpace);\r\n convertedColor.a = this.a;\r\n return this;\r\n };\r\n /**\r\n * Computes a new Color4 converted from the current one to gamma space\r\n * @returns a new Color4 object\r\n */\r\n Color4.prototype.toGammaSpace = function () {\r\n var convertedColor = new Color4();\r\n this.toGammaSpaceToRef(convertedColor);\r\n return convertedColor;\r\n };\r\n /**\r\n * Converts the Color4 values to gamma space and stores the result in \"convertedColor\"\r\n * @param convertedColor defines the Color4 object where to store the gamma space version\r\n * @returns the unmodified Color4\r\n */\r\n Color4.prototype.toGammaSpaceToRef = function (convertedColor) {\r\n convertedColor.r = Math.pow(this.r, ToGammaSpace);\r\n convertedColor.g = Math.pow(this.g, ToGammaSpace);\r\n convertedColor.b = Math.pow(this.b, ToGammaSpace);\r\n convertedColor.a = this.a;\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Creates a new Color4 from the string containing valid hexadecimal values\r\n * @param hex defines a string containing valid hexadecimal values\r\n * @returns a new Color4 object\r\n */\r\n Color4.FromHexString = function (hex) {\r\n if (hex.substring(0, 1) !== \"#\" || hex.length !== 9) {\r\n return new Color4(0.0, 0.0, 0.0, 0.0);\r\n }\r\n var r = parseInt(hex.substring(1, 3), 16);\r\n var g = parseInt(hex.substring(3, 5), 16);\r\n var b = parseInt(hex.substring(5, 7), 16);\r\n var a = parseInt(hex.substring(7, 9), 16);\r\n return Color4.FromInts(r, g, b, a);\r\n };\r\n /**\r\n * Creates a new Color4 object set with the linearly interpolated values of \"amount\" between the left Color4 object and the right Color4 object\r\n * @param left defines the start value\r\n * @param right defines the end value\r\n * @param amount defines the gradient factor\r\n * @returns a new Color4 object\r\n */\r\n Color4.Lerp = function (left, right, amount) {\r\n var result = new Color4(0.0, 0.0, 0.0, 0.0);\r\n Color4.LerpToRef(left, right, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Set the given \"result\" with the linearly interpolated values of \"amount\" between the left Color4 object and the right Color4 object\r\n * @param left defines the start value\r\n * @param right defines the end value\r\n * @param amount defines the gradient factor\r\n * @param result defines the Color4 object where to store data\r\n */\r\n Color4.LerpToRef = function (left, right, amount, result) {\r\n result.r = left.r + (right.r - left.r) * amount;\r\n result.g = left.g + (right.g - left.g) * amount;\r\n result.b = left.b + (right.b - left.b) * amount;\r\n result.a = left.a + (right.a - left.a) * amount;\r\n };\r\n /**\r\n * Creates a new Color4 from a Color3 and an alpha value\r\n * @param color3 defines the source Color3 to read from\r\n * @param alpha defines the alpha component (1.0 by default)\r\n * @returns a new Color4 object\r\n */\r\n Color4.FromColor3 = function (color3, alpha) {\r\n if (alpha === void 0) { alpha = 1.0; }\r\n return new Color4(color3.r, color3.g, color3.b, alpha);\r\n };\r\n /**\r\n * Creates a new Color4 from the starting index element of the given array\r\n * @param array defines the source array to read from\r\n * @param offset defines the offset in the source array\r\n * @returns a new Color4 object\r\n */\r\n Color4.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Color4(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\r\n };\r\n /**\r\n * Creates a new Color4 from the starting index element of the given array\r\n * @param array defines the source array to read from\r\n * @param offset defines the offset in the source array\r\n * @param result defines the target Color4 object\r\n */\r\n Color4.FromArrayToRef = function (array, offset, result) {\r\n if (offset === void 0) { offset = 0; }\r\n result.r = array[offset];\r\n result.g = array[offset + 1];\r\n result.b = array[offset + 2];\r\n result.a = array[offset + 3];\r\n };\r\n /**\r\n * Creates a new Color3 from integer values (< 256)\r\n * @param r defines the red component to read from (value between 0 and 255)\r\n * @param g defines the green component to read from (value between 0 and 255)\r\n * @param b defines the blue component to read from (value between 0 and 255)\r\n * @param a defines the alpha component to read from (value between 0 and 255)\r\n * @returns a new Color3 object\r\n */\r\n Color4.FromInts = function (r, g, b, a) {\r\n return new Color4(r / 255.0, g / 255.0, b / 255.0, a / 255.0);\r\n };\r\n /**\r\n * Check the content of a given array and convert it to an array containing RGBA data\r\n * If the original array was already containing count * 4 values then it is returned directly\r\n * @param colors defines the array to check\r\n * @param count defines the number of RGBA data to expect\r\n * @returns an array containing count * 4 values (RGBA)\r\n */\r\n Color4.CheckColors4 = function (colors, count) {\r\n // Check if color3 was used\r\n if (colors.length === count * 3) {\r\n var colors4 = [];\r\n for (var index = 0; index < colors.length; index += 3) {\r\n var newIndex = (index / 3) * 4;\r\n colors4[newIndex] = colors[index];\r\n colors4[newIndex + 1] = colors[index + 1];\r\n colors4[newIndex + 2] = colors[index + 2];\r\n colors4[newIndex + 3] = 1.0;\r\n }\r\n return colors4;\r\n }\r\n return colors;\r\n };\r\n return Color4;\r\n}());\r\nexport { Color4 };\r\n/**\r\n * @hidden\r\n */\r\nvar TmpColors = /** @class */ (function () {\r\n function TmpColors() {\r\n }\r\n TmpColors.Color3 = ArrayTools.BuildArray(3, Color3.Black);\r\n TmpColors.Color4 = ArrayTools.BuildArray(3, function () { return new Color4(0, 0, 0, 0); });\r\n return TmpColors;\r\n}());\r\nexport { TmpColors };\r\n_TypeStore.RegisteredTypes[\"BABYLON.Color3\"] = Color3;\r\n_TypeStore.RegisteredTypes[\"BABYLON.Color4\"] = Color4;\r\n//# sourceMappingURL=math.color.js.map","/**\r\n * Constant used to convert a value to gamma space\r\n * @ignorenaming\r\n */\r\nexport var ToGammaSpace = 1 / 2.2;\r\n/**\r\n * Constant used to convert a value to linear space\r\n * @ignorenaming\r\n */\r\nexport var ToLinearSpace = 2.2;\r\n/**\r\n * Constant used to define the minimal number value in Babylon.js\r\n * @ignorenaming\r\n */\r\nvar Epsilon = 0.001;\r\nexport { Epsilon };\r\n//# sourceMappingURL=math.constants.js.map","import { Plane } from './math.plane';\r\n/**\r\n * Represents a camera frustum\r\n */\r\nvar Frustum = /** @class */ (function () {\r\n function Frustum() {\r\n }\r\n /**\r\n * Gets the planes representing the frustum\r\n * @param transform matrix to be applied to the returned planes\r\n * @returns a new array of 6 Frustum planes computed by the given transformation matrix.\r\n */\r\n Frustum.GetPlanes = function (transform) {\r\n var frustumPlanes = [];\r\n for (var index = 0; index < 6; index++) {\r\n frustumPlanes.push(new Plane(0.0, 0.0, 0.0, 0.0));\r\n }\r\n Frustum.GetPlanesToRef(transform, frustumPlanes);\r\n return frustumPlanes;\r\n };\r\n /**\r\n * Gets the near frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetNearPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] + m[2];\r\n frustumPlane.normal.y = m[7] + m[6];\r\n frustumPlane.normal.z = m[11] + m[10];\r\n frustumPlane.d = m[15] + m[14];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the far frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetFarPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] - m[2];\r\n frustumPlane.normal.y = m[7] - m[6];\r\n frustumPlane.normal.z = m[11] - m[10];\r\n frustumPlane.d = m[15] - m[14];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the left frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetLeftPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] + m[0];\r\n frustumPlane.normal.y = m[7] + m[4];\r\n frustumPlane.normal.z = m[11] + m[8];\r\n frustumPlane.d = m[15] + m[12];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the right frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetRightPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] - m[0];\r\n frustumPlane.normal.y = m[7] - m[4];\r\n frustumPlane.normal.z = m[11] - m[8];\r\n frustumPlane.d = m[15] - m[12];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the top frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetTopPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] - m[1];\r\n frustumPlane.normal.y = m[7] - m[5];\r\n frustumPlane.normal.z = m[11] - m[9];\r\n frustumPlane.d = m[15] - m[13];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Gets the bottom frustum plane transformed by the transform matrix\r\n * @param transform transformation matrix to be applied to the resulting frustum plane\r\n * @param frustumPlane the resuling frustum plane\r\n */\r\n Frustum.GetBottomPlaneToRef = function (transform, frustumPlane) {\r\n var m = transform.m;\r\n frustumPlane.normal.x = m[3] + m[1];\r\n frustumPlane.normal.y = m[7] + m[5];\r\n frustumPlane.normal.z = m[11] + m[9];\r\n frustumPlane.d = m[15] + m[13];\r\n frustumPlane.normalize();\r\n };\r\n /**\r\n * Sets the given array \"frustumPlanes\" with the 6 Frustum planes computed by the given transformation matrix.\r\n * @param transform transformation matrix to be applied to the resulting frustum planes\r\n * @param frustumPlanes the resuling frustum planes\r\n */\r\n Frustum.GetPlanesToRef = function (transform, frustumPlanes) {\r\n // Near\r\n Frustum.GetNearPlaneToRef(transform, frustumPlanes[0]);\r\n // Far\r\n Frustum.GetFarPlaneToRef(transform, frustumPlanes[1]);\r\n // Left\r\n Frustum.GetLeftPlaneToRef(transform, frustumPlanes[2]);\r\n // Right\r\n Frustum.GetRightPlaneToRef(transform, frustumPlanes[3]);\r\n // Top\r\n Frustum.GetTopPlaneToRef(transform, frustumPlanes[4]);\r\n // Bottom\r\n Frustum.GetBottomPlaneToRef(transform, frustumPlanes[5]);\r\n };\r\n return Frustum;\r\n}());\r\nexport { Frustum };\r\n//# sourceMappingURL=math.frustum.js.map","import { Vector3 } from './math.vector';\r\n/**\r\n * Extracts minimum and maximum values from a list of indexed positions\r\n * @param positions defines the positions to use\r\n * @param indices defines the indices to the positions\r\n * @param indexStart defines the start index\r\n * @param indexCount defines the end index\r\n * @param bias defines bias value to add to the result\r\n * @return minimum and maximum values\r\n */\r\nexport function extractMinAndMaxIndexed(positions, indices, indexStart, indexCount, bias) {\r\n if (bias === void 0) { bias = null; }\r\n var minimum = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var maximum = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n for (var index = indexStart; index < indexStart + indexCount; index++) {\r\n var offset = indices[index] * 3;\r\n var x = positions[offset];\r\n var y = positions[offset + 1];\r\n var z = positions[offset + 2];\r\n minimum.minimizeInPlaceFromFloats(x, y, z);\r\n maximum.maximizeInPlaceFromFloats(x, y, z);\r\n }\r\n if (bias) {\r\n minimum.x -= minimum.x * bias.x + bias.y;\r\n minimum.y -= minimum.y * bias.x + bias.y;\r\n minimum.z -= minimum.z * bias.x + bias.y;\r\n maximum.x += maximum.x * bias.x + bias.y;\r\n maximum.y += maximum.y * bias.x + bias.y;\r\n maximum.z += maximum.z * bias.x + bias.y;\r\n }\r\n return {\r\n minimum: minimum,\r\n maximum: maximum\r\n };\r\n}\r\n/**\r\n * Extracts minimum and maximum values from a list of positions\r\n * @param positions defines the positions to use\r\n * @param start defines the start index in the positions array\r\n * @param count defines the number of positions to handle\r\n * @param bias defines bias value to add to the result\r\n * @param stride defines the stride size to use (distance between two positions in the positions array)\r\n * @return minimum and maximum values\r\n */\r\nexport function extractMinAndMax(positions, start, count, bias, stride) {\r\n if (bias === void 0) { bias = null; }\r\n var minimum = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var maximum = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n if (!stride) {\r\n stride = 3;\r\n }\r\n for (var index = start, offset = start * stride; index < start + count; index++, offset += stride) {\r\n var x = positions[offset];\r\n var y = positions[offset + 1];\r\n var z = positions[offset + 2];\r\n minimum.minimizeInPlaceFromFloats(x, y, z);\r\n maximum.maximizeInPlaceFromFloats(x, y, z);\r\n }\r\n if (bias) {\r\n minimum.x -= minimum.x * bias.x + bias.y;\r\n minimum.y -= minimum.y * bias.x + bias.y;\r\n minimum.z -= minimum.z * bias.x + bias.y;\r\n maximum.x += maximum.x * bias.x + bias.y;\r\n maximum.y += maximum.y * bias.x + bias.y;\r\n maximum.z += maximum.z * bias.x + bias.y;\r\n }\r\n return {\r\n minimum: minimum,\r\n maximum: maximum\r\n };\r\n}\r\n//# sourceMappingURL=math.functions.js.map","import { Vector3, Vector2 } from './math.vector';\r\n/**\r\n * Contains position and normal vectors for a vertex\r\n */\r\nvar PositionNormalVertex = /** @class */ (function () {\r\n /**\r\n * Creates a PositionNormalVertex\r\n * @param position the position of the vertex (defaut: 0,0,0)\r\n * @param normal the normal of the vertex (defaut: 0,1,0)\r\n */\r\n function PositionNormalVertex(\r\n /** the position of the vertex (defaut: 0,0,0) */\r\n position, \r\n /** the normal of the vertex (defaut: 0,1,0) */\r\n normal) {\r\n if (position === void 0) { position = Vector3.Zero(); }\r\n if (normal === void 0) { normal = Vector3.Up(); }\r\n this.position = position;\r\n this.normal = normal;\r\n }\r\n /**\r\n * Clones the PositionNormalVertex\r\n * @returns the cloned PositionNormalVertex\r\n */\r\n PositionNormalVertex.prototype.clone = function () {\r\n return new PositionNormalVertex(this.position.clone(), this.normal.clone());\r\n };\r\n return PositionNormalVertex;\r\n}());\r\nexport { PositionNormalVertex };\r\n/**\r\n * Contains position, normal and uv vectors for a vertex\r\n */\r\nvar PositionNormalTextureVertex = /** @class */ (function () {\r\n /**\r\n * Creates a PositionNormalTextureVertex\r\n * @param position the position of the vertex (defaut: 0,0,0)\r\n * @param normal the normal of the vertex (defaut: 0,1,0)\r\n * @param uv the uv of the vertex (default: 0,0)\r\n */\r\n function PositionNormalTextureVertex(\r\n /** the position of the vertex (defaut: 0,0,0) */\r\n position, \r\n /** the normal of the vertex (defaut: 0,1,0) */\r\n normal, \r\n /** the uv of the vertex (default: 0,0) */\r\n uv) {\r\n if (position === void 0) { position = Vector3.Zero(); }\r\n if (normal === void 0) { normal = Vector3.Up(); }\r\n if (uv === void 0) { uv = Vector2.Zero(); }\r\n this.position = position;\r\n this.normal = normal;\r\n this.uv = uv;\r\n }\r\n /**\r\n * Clones the PositionNormalTextureVertex\r\n * @returns the cloned PositionNormalTextureVertex\r\n */\r\n PositionNormalTextureVertex.prototype.clone = function () {\r\n return new PositionNormalTextureVertex(this.position.clone(), this.normal.clone(), this.uv.clone());\r\n };\r\n return PositionNormalTextureVertex;\r\n}());\r\nexport { PositionNormalTextureVertex };\r\n//# sourceMappingURL=math.vertexFormat.js.map","import { Scalar } from \"./math.scalar\";\r\nimport { Vector2, Vector3, Quaternion, Matrix } from \"./math.vector\";\r\nimport { Epsilon } from \"./math.constants\";\r\n/**\r\n * Defines potential orientation for back face culling\r\n */\r\nexport var Orientation;\r\n(function (Orientation) {\r\n /**\r\n * Clockwise\r\n */\r\n Orientation[Orientation[\"CW\"] = 0] = \"CW\";\r\n /** Counter clockwise */\r\n Orientation[Orientation[\"CCW\"] = 1] = \"CCW\";\r\n})(Orientation || (Orientation = {}));\r\n/** Class used to represent a Bezier curve */\r\nvar BezierCurve = /** @class */ (function () {\r\n function BezierCurve() {\r\n }\r\n /**\r\n * Returns the cubic Bezier interpolated value (float) at \"t\" (float) from the given x1, y1, x2, y2 floats\r\n * @param t defines the time\r\n * @param x1 defines the left coordinate on X axis\r\n * @param y1 defines the left coordinate on Y axis\r\n * @param x2 defines the right coordinate on X axis\r\n * @param y2 defines the right coordinate on Y axis\r\n * @returns the interpolated value\r\n */\r\n BezierCurve.Interpolate = function (t, x1, y1, x2, y2) {\r\n // Extract X (which is equal to time here)\r\n var f0 = 1 - 3 * x2 + 3 * x1;\r\n var f1 = 3 * x2 - 6 * x1;\r\n var f2 = 3 * x1;\r\n var refinedT = t;\r\n for (var i = 0; i < 5; i++) {\r\n var refinedT2 = refinedT * refinedT;\r\n var refinedT3 = refinedT2 * refinedT;\r\n var x = f0 * refinedT3 + f1 * refinedT2 + f2 * refinedT;\r\n var slope = 1.0 / (3.0 * f0 * refinedT2 + 2.0 * f1 * refinedT + f2);\r\n refinedT -= (x - t) * slope;\r\n refinedT = Math.min(1, Math.max(0, refinedT));\r\n }\r\n // Resolve cubic bezier for the given x\r\n return 3 * Math.pow(1 - refinedT, 2) * refinedT * y1 + 3 * (1 - refinedT) * Math.pow(refinedT, 2) * y2 + Math.pow(refinedT, 3);\r\n };\r\n return BezierCurve;\r\n}());\r\nexport { BezierCurve };\r\n/**\r\n * Defines angle representation\r\n */\r\nvar Angle = /** @class */ (function () {\r\n /**\r\n * Creates an Angle object of \"radians\" radians (float).\r\n * @param radians the angle in radians\r\n */\r\n function Angle(radians) {\r\n this._radians = radians;\r\n if (this._radians < 0.0) {\r\n this._radians += 2.0 * Math.PI;\r\n }\r\n }\r\n /**\r\n * Get value in degrees\r\n * @returns the Angle value in degrees (float)\r\n */\r\n Angle.prototype.degrees = function () {\r\n return (this._radians * 180.0) / Math.PI;\r\n };\r\n /**\r\n * Get value in radians\r\n * @returns the Angle value in radians (float)\r\n */\r\n Angle.prototype.radians = function () {\r\n return this._radians;\r\n };\r\n /**\r\n * Gets a new Angle object valued with the gradient angle, in radians, of the line joining two points\r\n * @param a defines first point as the origin\r\n * @param b defines point\r\n * @returns a new Angle\r\n */\r\n Angle.BetweenTwoPoints = function (a, b) {\r\n var delta = b.subtract(a);\r\n var theta = Math.atan2(delta.y, delta.x);\r\n return new Angle(theta);\r\n };\r\n /**\r\n * Gets a new Angle object from the given float in radians\r\n * @param radians defines the angle value in radians\r\n * @returns a new Angle\r\n */\r\n Angle.FromRadians = function (radians) {\r\n return new Angle(radians);\r\n };\r\n /**\r\n * Gets a new Angle object from the given float in degrees\r\n * @param degrees defines the angle value in degrees\r\n * @returns a new Angle\r\n */\r\n Angle.FromDegrees = function (degrees) {\r\n return new Angle((degrees * Math.PI) / 180.0);\r\n };\r\n return Angle;\r\n}());\r\nexport { Angle };\r\n/**\r\n * This represents an arc in a 2d space.\r\n */\r\nvar Arc2 = /** @class */ (function () {\r\n /**\r\n * Creates an Arc object from the three given points : start, middle and end.\r\n * @param startPoint Defines the start point of the arc\r\n * @param midPoint Defines the midlle point of the arc\r\n * @param endPoint Defines the end point of the arc\r\n */\r\n function Arc2(\r\n /** Defines the start point of the arc */\r\n startPoint, \r\n /** Defines the mid point of the arc */\r\n midPoint, \r\n /** Defines the end point of the arc */\r\n endPoint) {\r\n this.startPoint = startPoint;\r\n this.midPoint = midPoint;\r\n this.endPoint = endPoint;\r\n var temp = Math.pow(midPoint.x, 2) + Math.pow(midPoint.y, 2);\r\n var startToMid = (Math.pow(startPoint.x, 2) + Math.pow(startPoint.y, 2) - temp) / 2;\r\n var midToEnd = (temp - Math.pow(endPoint.x, 2) - Math.pow(endPoint.y, 2)) / 2;\r\n var det = (startPoint.x - midPoint.x) * (midPoint.y - endPoint.y) - (midPoint.x - endPoint.x) * (startPoint.y - midPoint.y);\r\n this.centerPoint = new Vector2((startToMid * (midPoint.y - endPoint.y) - midToEnd * (startPoint.y - midPoint.y)) / det, ((startPoint.x - midPoint.x) * midToEnd - (midPoint.x - endPoint.x) * startToMid) / det);\r\n this.radius = this.centerPoint.subtract(this.startPoint).length();\r\n this.startAngle = Angle.BetweenTwoPoints(this.centerPoint, this.startPoint);\r\n var a1 = this.startAngle.degrees();\r\n var a2 = Angle.BetweenTwoPoints(this.centerPoint, this.midPoint).degrees();\r\n var a3 = Angle.BetweenTwoPoints(this.centerPoint, this.endPoint).degrees();\r\n // angles correction\r\n if (a2 - a1 > +180.0) {\r\n a2 -= 360.0;\r\n }\r\n if (a2 - a1 < -180.0) {\r\n a2 += 360.0;\r\n }\r\n if (a3 - a2 > +180.0) {\r\n a3 -= 360.0;\r\n }\r\n if (a3 - a2 < -180.0) {\r\n a3 += 360.0;\r\n }\r\n this.orientation = a2 - a1 < 0 ? Orientation.CW : Orientation.CCW;\r\n this.angle = Angle.FromDegrees(this.orientation === Orientation.CW ? a1 - a3 : a3 - a1);\r\n }\r\n return Arc2;\r\n}());\r\nexport { Arc2 };\r\n/**\r\n * Represents a 2D path made up of multiple 2D points\r\n */\r\nvar Path2 = /** @class */ (function () {\r\n /**\r\n * Creates a Path2 object from the starting 2D coordinates x and y.\r\n * @param x the starting points x value\r\n * @param y the starting points y value\r\n */\r\n function Path2(x, y) {\r\n this._points = new Array();\r\n this._length = 0.0;\r\n /**\r\n * If the path start and end point are the same\r\n */\r\n this.closed = false;\r\n this._points.push(new Vector2(x, y));\r\n }\r\n /**\r\n * Adds a new segment until the given coordinates (x, y) to the current Path2.\r\n * @param x the added points x value\r\n * @param y the added points y value\r\n * @returns the updated Path2.\r\n */\r\n Path2.prototype.addLineTo = function (x, y) {\r\n if (this.closed) {\r\n return this;\r\n }\r\n var newPoint = new Vector2(x, y);\r\n var previousPoint = this._points[this._points.length - 1];\r\n this._points.push(newPoint);\r\n this._length += newPoint.subtract(previousPoint).length();\r\n return this;\r\n };\r\n /**\r\n * Adds _numberOfSegments_ segments according to the arc definition (middle point coordinates, end point coordinates, the arc start point being the current Path2 last point) to the current Path2.\r\n * @param midX middle point x value\r\n * @param midY middle point y value\r\n * @param endX end point x value\r\n * @param endY end point y value\r\n * @param numberOfSegments (default: 36)\r\n * @returns the updated Path2.\r\n */\r\n Path2.prototype.addArcTo = function (midX, midY, endX, endY, numberOfSegments) {\r\n if (numberOfSegments === void 0) { numberOfSegments = 36; }\r\n if (this.closed) {\r\n return this;\r\n }\r\n var startPoint = this._points[this._points.length - 1];\r\n var midPoint = new Vector2(midX, midY);\r\n var endPoint = new Vector2(endX, endY);\r\n var arc = new Arc2(startPoint, midPoint, endPoint);\r\n var increment = arc.angle.radians() / numberOfSegments;\r\n if (arc.orientation === Orientation.CW) {\r\n increment *= -1;\r\n }\r\n var currentAngle = arc.startAngle.radians() + increment;\r\n for (var i = 0; i < numberOfSegments; i++) {\r\n var x = Math.cos(currentAngle) * arc.radius + arc.centerPoint.x;\r\n var y = Math.sin(currentAngle) * arc.radius + arc.centerPoint.y;\r\n this.addLineTo(x, y);\r\n currentAngle += increment;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Closes the Path2.\r\n * @returns the Path2.\r\n */\r\n Path2.prototype.close = function () {\r\n this.closed = true;\r\n return this;\r\n };\r\n /**\r\n * Gets the sum of the distance between each sequential point in the path\r\n * @returns the Path2 total length (float).\r\n */\r\n Path2.prototype.length = function () {\r\n var result = this._length;\r\n if (this.closed) {\r\n var lastPoint = this._points[this._points.length - 1];\r\n var firstPoint = this._points[0];\r\n result += firstPoint.subtract(lastPoint).length();\r\n }\r\n return result;\r\n };\r\n /**\r\n * Gets the points which construct the path\r\n * @returns the Path2 internal array of points.\r\n */\r\n Path2.prototype.getPoints = function () {\r\n return this._points;\r\n };\r\n /**\r\n * Retreives the point at the distance aways from the starting point\r\n * @param normalizedLengthPosition the length along the path to retreive the point from\r\n * @returns a new Vector2 located at a percentage of the Path2 total length on this path.\r\n */\r\n Path2.prototype.getPointAtLengthPosition = function (normalizedLengthPosition) {\r\n if (normalizedLengthPosition < 0 || normalizedLengthPosition > 1) {\r\n return Vector2.Zero();\r\n }\r\n var lengthPosition = normalizedLengthPosition * this.length();\r\n var previousOffset = 0;\r\n for (var i = 0; i < this._points.length; i++) {\r\n var j = (i + 1) % this._points.length;\r\n var a = this._points[i];\r\n var b = this._points[j];\r\n var bToA = b.subtract(a);\r\n var nextOffset = bToA.length() + previousOffset;\r\n if (lengthPosition >= previousOffset && lengthPosition <= nextOffset) {\r\n var dir = bToA.normalize();\r\n var localOffset = lengthPosition - previousOffset;\r\n return new Vector2(a.x + dir.x * localOffset, a.y + dir.y * localOffset);\r\n }\r\n previousOffset = nextOffset;\r\n }\r\n return Vector2.Zero();\r\n };\r\n /**\r\n * Creates a new path starting from an x and y position\r\n * @param x starting x value\r\n * @param y starting y value\r\n * @returns a new Path2 starting at the coordinates (x, y).\r\n */\r\n Path2.StartingAt = function (x, y) {\r\n return new Path2(x, y);\r\n };\r\n return Path2;\r\n}());\r\nexport { Path2 };\r\n/**\r\n * Represents a 3D path made up of multiple 3D points\r\n */\r\nvar Path3D = /** @class */ (function () {\r\n /**\r\n * new Path3D(path, normal, raw)\r\n * Creates a Path3D. A Path3D is a logical math object, so not a mesh.\r\n * please read the description in the tutorial : https://doc.babylonjs.com/how_to/how_to_use_path3d\r\n * @param path an array of Vector3, the curve axis of the Path3D\r\n * @param firstNormal (options) Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.\r\n * @param raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.\r\n * @param alignTangentsWithPath (optional, default false) : boolean, if true the tangents will be aligned with the path.\r\n */\r\n function Path3D(\r\n /**\r\n * an array of Vector3, the curve axis of the Path3D\r\n */\r\n path, firstNormal, raw, alignTangentsWithPath) {\r\n if (firstNormal === void 0) { firstNormal = null; }\r\n if (alignTangentsWithPath === void 0) { alignTangentsWithPath = false; }\r\n this.path = path;\r\n this._curve = new Array();\r\n this._distances = new Array();\r\n this._tangents = new Array();\r\n this._normals = new Array();\r\n this._binormals = new Array();\r\n // holds interpolated point data\r\n this._pointAtData = {\r\n id: 0,\r\n point: Vector3.Zero(),\r\n previousPointArrayIndex: 0,\r\n position: 0,\r\n subPosition: 0,\r\n interpolateReady: false,\r\n interpolationMatrix: Matrix.Identity(),\r\n };\r\n for (var p = 0; p < path.length; p++) {\r\n this._curve[p] = path[p].clone(); // hard copy\r\n }\r\n this._raw = raw || false;\r\n this._alignTangentsWithPath = alignTangentsWithPath;\r\n this._compute(firstNormal, alignTangentsWithPath);\r\n }\r\n /**\r\n * Returns the Path3D array of successive Vector3 designing its curve.\r\n * @returns the Path3D array of successive Vector3 designing its curve.\r\n */\r\n Path3D.prototype.getCurve = function () {\r\n return this._curve;\r\n };\r\n /**\r\n * Returns the Path3D array of successive Vector3 designing its curve.\r\n * @returns the Path3D array of successive Vector3 designing its curve.\r\n */\r\n Path3D.prototype.getPoints = function () {\r\n return this._curve;\r\n };\r\n /**\r\n * @returns the computed length (float) of the path.\r\n */\r\n Path3D.prototype.length = function () {\r\n return this._distances[this._distances.length - 1];\r\n };\r\n /**\r\n * Returns an array populated with tangent vectors on each Path3D curve point.\r\n * @returns an array populated with tangent vectors on each Path3D curve point.\r\n */\r\n Path3D.prototype.getTangents = function () {\r\n return this._tangents;\r\n };\r\n /**\r\n * Returns an array populated with normal vectors on each Path3D curve point.\r\n * @returns an array populated with normal vectors on each Path3D curve point.\r\n */\r\n Path3D.prototype.getNormals = function () {\r\n return this._normals;\r\n };\r\n /**\r\n * Returns an array populated with binormal vectors on each Path3D curve point.\r\n * @returns an array populated with binormal vectors on each Path3D curve point.\r\n */\r\n Path3D.prototype.getBinormals = function () {\r\n return this._binormals;\r\n };\r\n /**\r\n * Returns an array populated with distances (float) of the i-th point from the first curve point.\r\n * @returns an array populated with distances (float) of the i-th point from the first curve point.\r\n */\r\n Path3D.prototype.getDistances = function () {\r\n return this._distances;\r\n };\r\n /**\r\n * Returns an interpolated point along this path\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @returns a new Vector3 as the point\r\n */\r\n Path3D.prototype.getPointAt = function (position) {\r\n return this._updatePointAtData(position).point;\r\n };\r\n /**\r\n * Returns the tangent vector of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated tangent instead of the tangent of the previous path point.\r\n * @returns a tangent vector corresponding to the interpolated Path3D curve point, if not interpolated, the tangent is taken from the precomputed tangents array.\r\n */\r\n Path3D.prototype.getTangentAt = function (position, interpolated) {\r\n if (interpolated === void 0) { interpolated = false; }\r\n this._updatePointAtData(position, interpolated);\r\n return interpolated ? Vector3.TransformCoordinates(Vector3.Forward(), this._pointAtData.interpolationMatrix) : this._tangents[this._pointAtData.previousPointArrayIndex];\r\n };\r\n /**\r\n * Returns the tangent vector of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated normal instead of the normal of the previous path point.\r\n * @returns a normal vector corresponding to the interpolated Path3D curve point, if not interpolated, the normal is taken from the precomputed normals array.\r\n */\r\n Path3D.prototype.getNormalAt = function (position, interpolated) {\r\n if (interpolated === void 0) { interpolated = false; }\r\n this._updatePointAtData(position, interpolated);\r\n return interpolated ? Vector3.TransformCoordinates(Vector3.Right(), this._pointAtData.interpolationMatrix) : this._normals[this._pointAtData.previousPointArrayIndex];\r\n };\r\n /**\r\n * Returns the binormal vector of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated binormal instead of the binormal of the previous path point.\r\n * @returns a binormal vector corresponding to the interpolated Path3D curve point, if not interpolated, the binormal is taken from the precomputed binormals array.\r\n */\r\n Path3D.prototype.getBinormalAt = function (position, interpolated) {\r\n if (interpolated === void 0) { interpolated = false; }\r\n this._updatePointAtData(position, interpolated);\r\n return interpolated ? Vector3.TransformCoordinates(Vector3.UpReadOnly, this._pointAtData.interpolationMatrix) : this._binormals[this._pointAtData.previousPointArrayIndex];\r\n };\r\n /**\r\n * Returns the distance (float) of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @returns the distance of the interpolated Path3D curve point at the specified position along this path.\r\n */\r\n Path3D.prototype.getDistanceAt = function (position) {\r\n return this.length() * position;\r\n };\r\n /**\r\n * Returns the array index of the previous point of an interpolated point along this path\r\n * @param position the position of the point to interpolate along this path, from 0.0 to 1.0\r\n * @returns the array index\r\n */\r\n Path3D.prototype.getPreviousPointIndexAt = function (position) {\r\n this._updatePointAtData(position);\r\n return this._pointAtData.previousPointArrayIndex;\r\n };\r\n /**\r\n * Returns the position of an interpolated point relative to the two path points it lies between, from 0.0 (point A) to 1.0 (point B)\r\n * @param position the position of the point to interpolate along this path, from 0.0 to 1.0\r\n * @returns the sub position\r\n */\r\n Path3D.prototype.getSubPositionAt = function (position) {\r\n this._updatePointAtData(position);\r\n return this._pointAtData.subPosition;\r\n };\r\n /**\r\n * Returns the position of the closest virtual point on this path to an arbitrary Vector3, from 0.0 to 1.0\r\n * @param target the vector of which to get the closest position to\r\n * @returns the position of the closest virtual point on this path to the target vector\r\n */\r\n Path3D.prototype.getClosestPositionTo = function (target) {\r\n var smallestDistance = Number.MAX_VALUE;\r\n var closestPosition = 0.0;\r\n for (var i = 0; i < this._curve.length - 1; i++) {\r\n var point = this._curve[i + 0];\r\n var tangent = this._curve[i + 1].subtract(point).normalize();\r\n var subLength = this._distances[i + 1] - this._distances[i + 0];\r\n var subPosition = Math.min((Math.max(Vector3.Dot(tangent, target.subtract(point).normalize()), 0.0) * Vector3.Distance(point, target)) / subLength, 1.0);\r\n var distance = Vector3.Distance(point.add(tangent.scale(subPosition * subLength)), target);\r\n if (distance < smallestDistance) {\r\n smallestDistance = distance;\r\n closestPosition = (this._distances[i + 0] + subLength * subPosition) / this.length();\r\n }\r\n }\r\n return closestPosition;\r\n };\r\n /**\r\n * Returns a sub path (slice) of this path\r\n * @param start the position of the fist path point, from 0.0 to 1.0, or a negative value, which will get wrapped around from the end of the path to 0.0 to 1.0 values\r\n * @param end the position of the last path point, from 0.0 to 1.0, or a negative value, which will get wrapped around from the end of the path to 0.0 to 1.0 values\r\n * @returns a sub path (slice) of this path\r\n */\r\n Path3D.prototype.slice = function (start, end) {\r\n if (start === void 0) { start = 0.0; }\r\n if (end === void 0) { end = 1.0; }\r\n if (start < 0.0) {\r\n start = 1 - ((start * -1.0) % 1.0);\r\n }\r\n if (end < 0.0) {\r\n end = 1 - ((end * -1.0) % 1.0);\r\n }\r\n if (start > end) {\r\n var _start = start;\r\n start = end;\r\n end = _start;\r\n }\r\n var curvePoints = this.getCurve();\r\n var startPoint = this.getPointAt(start);\r\n var startIndex = this.getPreviousPointIndexAt(start);\r\n var endPoint = this.getPointAt(end);\r\n var endIndex = this.getPreviousPointIndexAt(end) + 1;\r\n var slicePoints = [];\r\n if (start !== 0.0) {\r\n startIndex++;\r\n slicePoints.push(startPoint);\r\n }\r\n slicePoints.push.apply(slicePoints, curvePoints.slice(startIndex, endIndex));\r\n if (end !== 1.0 || start === 1.0) {\r\n slicePoints.push(endPoint);\r\n }\r\n return new Path3D(slicePoints, this.getNormalAt(start), this._raw, this._alignTangentsWithPath);\r\n };\r\n /**\r\n * Forces the Path3D tangent, normal, binormal and distance recomputation.\r\n * @param path path which all values are copied into the curves points\r\n * @param firstNormal which should be projected onto the curve\r\n * @param alignTangentsWithPath (optional, default false) : boolean, if true the tangents will be aligned with the path\r\n * @returns the same object updated.\r\n */\r\n Path3D.prototype.update = function (path, firstNormal, alignTangentsWithPath) {\r\n if (firstNormal === void 0) { firstNormal = null; }\r\n if (alignTangentsWithPath === void 0) { alignTangentsWithPath = false; }\r\n for (var p = 0; p < path.length; p++) {\r\n this._curve[p].x = path[p].x;\r\n this._curve[p].y = path[p].y;\r\n this._curve[p].z = path[p].z;\r\n }\r\n this._compute(firstNormal, alignTangentsWithPath);\r\n return this;\r\n };\r\n // private function compute() : computes tangents, normals and binormals\r\n Path3D.prototype._compute = function (firstNormal, alignTangentsWithPath) {\r\n if (alignTangentsWithPath === void 0) { alignTangentsWithPath = false; }\r\n var l = this._curve.length;\r\n if (l < 2) {\r\n return;\r\n }\r\n // first and last tangents\r\n this._tangents[0] = this._getFirstNonNullVector(0);\r\n if (!this._raw) {\r\n this._tangents[0].normalize();\r\n }\r\n this._tangents[l - 1] = this._curve[l - 1].subtract(this._curve[l - 2]);\r\n if (!this._raw) {\r\n this._tangents[l - 1].normalize();\r\n }\r\n // normals and binormals at first point : arbitrary vector with _normalVector()\r\n var tg0 = this._tangents[0];\r\n var pp0 = this._normalVector(tg0, firstNormal);\r\n this._normals[0] = pp0;\r\n if (!this._raw) {\r\n this._normals[0].normalize();\r\n }\r\n this._binormals[0] = Vector3.Cross(tg0, this._normals[0]);\r\n if (!this._raw) {\r\n this._binormals[0].normalize();\r\n }\r\n this._distances[0] = 0.0;\r\n // normals and binormals : next points\r\n var prev; // previous vector (segment)\r\n var cur; // current vector (segment)\r\n var curTang; // current tangent\r\n // previous normal\r\n var prevNor; // previous normal\r\n var prevBinor; // previous binormal\r\n for (var i = 1; i < l; i++) {\r\n // tangents\r\n prev = this._getLastNonNullVector(i);\r\n if (i < l - 1) {\r\n cur = this._getFirstNonNullVector(i);\r\n this._tangents[i] = alignTangentsWithPath ? cur : prev.add(cur);\r\n this._tangents[i].normalize();\r\n }\r\n this._distances[i] = this._distances[i - 1] + this._curve[i].subtract(this._curve[i - 1]).length();\r\n // normals and binormals\r\n // http://www.cs.cmu.edu/afs/andrew/scs/cs/15-462/web/old/asst2camera.html\r\n curTang = this._tangents[i];\r\n prevBinor = this._binormals[i - 1];\r\n this._normals[i] = Vector3.Cross(prevBinor, curTang);\r\n if (!this._raw) {\r\n if (this._normals[i].length() === 0) {\r\n prevNor = this._normals[i - 1];\r\n this._normals[i] = prevNor.clone();\r\n }\r\n else {\r\n this._normals[i].normalize();\r\n }\r\n }\r\n this._binormals[i] = Vector3.Cross(curTang, this._normals[i]);\r\n if (!this._raw) {\r\n this._binormals[i].normalize();\r\n }\r\n }\r\n this._pointAtData.id = NaN;\r\n };\r\n // private function getFirstNonNullVector(index)\r\n // returns the first non null vector from index : curve[index + N].subtract(curve[index])\r\n Path3D.prototype._getFirstNonNullVector = function (index) {\r\n var i = 1;\r\n var nNVector = this._curve[index + i].subtract(this._curve[index]);\r\n while (nNVector.length() === 0 && index + i + 1 < this._curve.length) {\r\n i++;\r\n nNVector = this._curve[index + i].subtract(this._curve[index]);\r\n }\r\n return nNVector;\r\n };\r\n // private function getLastNonNullVector(index)\r\n // returns the last non null vector from index : curve[index].subtract(curve[index - N])\r\n Path3D.prototype._getLastNonNullVector = function (index) {\r\n var i = 1;\r\n var nLVector = this._curve[index].subtract(this._curve[index - i]);\r\n while (nLVector.length() === 0 && index > i + 1) {\r\n i++;\r\n nLVector = this._curve[index].subtract(this._curve[index - i]);\r\n }\r\n return nLVector;\r\n };\r\n // private function normalVector(v0, vt, va) :\r\n // returns an arbitrary point in the plane defined by the point v0 and the vector vt orthogonal to this plane\r\n // if va is passed, it returns the va projection on the plane orthogonal to vt at the point v0\r\n Path3D.prototype._normalVector = function (vt, va) {\r\n var normal0;\r\n var tgl = vt.length();\r\n if (tgl === 0.0) {\r\n tgl = 1.0;\r\n }\r\n if (va === undefined || va === null) {\r\n var point;\r\n if (!Scalar.WithinEpsilon(Math.abs(vt.y) / tgl, 1.0, Epsilon)) {\r\n // search for a point in the plane\r\n point = new Vector3(0.0, -1.0, 0.0);\r\n }\r\n else if (!Scalar.WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, Epsilon)) {\r\n point = new Vector3(1.0, 0.0, 0.0);\r\n }\r\n else if (!Scalar.WithinEpsilon(Math.abs(vt.z) / tgl, 1.0, Epsilon)) {\r\n point = new Vector3(0.0, 0.0, 1.0);\r\n }\r\n else {\r\n point = Vector3.Zero();\r\n }\r\n normal0 = Vector3.Cross(vt, point);\r\n }\r\n else {\r\n normal0 = Vector3.Cross(vt, va);\r\n Vector3.CrossToRef(normal0, vt, normal0);\r\n }\r\n normal0.normalize();\r\n return normal0;\r\n };\r\n /**\r\n * Updates the point at data for an interpolated point along this curve\r\n * @param position the position of the point along this curve, from 0.0 to 1.0\r\n * @interpolateTNB wether to compute the interpolated tangent, normal and binormal\r\n * @returns the (updated) point at data\r\n */\r\n Path3D.prototype._updatePointAtData = function (position, interpolateTNB) {\r\n if (interpolateTNB === void 0) { interpolateTNB = false; }\r\n // set an id for caching the result\r\n if (this._pointAtData.id === position) {\r\n if (!this._pointAtData.interpolateReady) {\r\n this._updateInterpolationMatrix();\r\n }\r\n return this._pointAtData;\r\n }\r\n else {\r\n this._pointAtData.id = position;\r\n }\r\n var curvePoints = this.getPoints();\r\n // clamp position between 0.0 and 1.0\r\n if (position <= 0.0) {\r\n return this._setPointAtData(0.0, 0.0, curvePoints[0], 0, interpolateTNB);\r\n }\r\n else if (position >= 1.0) {\r\n return this._setPointAtData(1.0, 1.0, curvePoints[curvePoints.length - 1], curvePoints.length - 1, interpolateTNB);\r\n }\r\n var previousPoint = curvePoints[0];\r\n var currentPoint;\r\n var currentLength = 0.0;\r\n var targetLength = position * this.length();\r\n for (var i = 1; i < curvePoints.length; i++) {\r\n currentPoint = curvePoints[i];\r\n var distance = Vector3.Distance(previousPoint, currentPoint);\r\n currentLength += distance;\r\n if (currentLength === targetLength) {\r\n return this._setPointAtData(position, 1.0, currentPoint, i, interpolateTNB);\r\n }\r\n else if (currentLength > targetLength) {\r\n var toLength = currentLength - targetLength;\r\n var diff = toLength / distance;\r\n var dir = previousPoint.subtract(currentPoint);\r\n var point = currentPoint.add(dir.scaleInPlace(diff));\r\n return this._setPointAtData(position, 1 - diff, point, i - 1, interpolateTNB);\r\n }\r\n previousPoint = currentPoint;\r\n }\r\n return this._pointAtData;\r\n };\r\n /**\r\n * Updates the point at data from the specified parameters\r\n * @param position where along the path the interpolated point is, from 0.0 to 1.0\r\n * @param point the interpolated point\r\n * @param parentIndex the index of an existing curve point that is on, or else positionally the first behind, the interpolated point\r\n */\r\n Path3D.prototype._setPointAtData = function (position, subPosition, point, parentIndex, interpolateTNB) {\r\n this._pointAtData.point = point;\r\n this._pointAtData.position = position;\r\n this._pointAtData.subPosition = subPosition;\r\n this._pointAtData.previousPointArrayIndex = parentIndex;\r\n this._pointAtData.interpolateReady = interpolateTNB;\r\n if (interpolateTNB) {\r\n this._updateInterpolationMatrix();\r\n }\r\n return this._pointAtData;\r\n };\r\n /**\r\n * Updates the point at interpolation matrix for the tangents, normals and binormals\r\n */\r\n Path3D.prototype._updateInterpolationMatrix = function () {\r\n this._pointAtData.interpolationMatrix = Matrix.Identity();\r\n var parentIndex = this._pointAtData.previousPointArrayIndex;\r\n if (parentIndex !== this._tangents.length - 1) {\r\n var index = parentIndex + 1;\r\n var tangentFrom = this._tangents[parentIndex].clone();\r\n var normalFrom = this._normals[parentIndex].clone();\r\n var binormalFrom = this._binormals[parentIndex].clone();\r\n var tangentTo = this._tangents[index].clone();\r\n var normalTo = this._normals[index].clone();\r\n var binormalTo = this._binormals[index].clone();\r\n var quatFrom = Quaternion.RotationQuaternionFromAxis(normalFrom, binormalFrom, tangentFrom);\r\n var quatTo = Quaternion.RotationQuaternionFromAxis(normalTo, binormalTo, tangentTo);\r\n var quatAt = Quaternion.Slerp(quatFrom, quatTo, this._pointAtData.subPosition);\r\n quatAt.toRotationMatrix(this._pointAtData.interpolationMatrix);\r\n }\r\n };\r\n return Path3D;\r\n}());\r\nexport { Path3D };\r\n/**\r\n * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.\r\n * A Curve3 is designed from a series of successive Vector3.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_curve3\r\n */\r\nvar Curve3 = /** @class */ (function () {\r\n /**\r\n * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.\r\n * A Curve3 is designed from a series of successive Vector3.\r\n * Tuto : https://doc.babylonjs.com/how_to/how_to_use_curve3#curve3-object\r\n * @param points points which make up the curve\r\n */\r\n function Curve3(points) {\r\n this._length = 0.0;\r\n this._points = points;\r\n this._length = this._computeLength(points);\r\n }\r\n /**\r\n * Returns a Curve3 object along a Quadratic Bezier curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#quadratic-bezier-curve\r\n * @param v0 (Vector3) the origin point of the Quadratic Bezier\r\n * @param v1 (Vector3) the control point\r\n * @param v2 (Vector3) the end point of the Quadratic Bezier\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateQuadraticBezier = function (v0, v1, v2, nbPoints) {\r\n nbPoints = nbPoints > 2 ? nbPoints : 3;\r\n var bez = new Array();\r\n var equation = function (t, val0, val1, val2) {\r\n var res = (1.0 - t) * (1.0 - t) * val0 + 2.0 * t * (1.0 - t) * val1 + t * t * val2;\r\n return res;\r\n };\r\n for (var i = 0; i <= nbPoints; i++) {\r\n bez.push(new Vector3(equation(i / nbPoints, v0.x, v1.x, v2.x), equation(i / nbPoints, v0.y, v1.y, v2.y), equation(i / nbPoints, v0.z, v1.z, v2.z)));\r\n }\r\n return new Curve3(bez);\r\n };\r\n /**\r\n * Returns a Curve3 object along a Cubic Bezier curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#cubic-bezier-curve\r\n * @param v0 (Vector3) the origin point of the Cubic Bezier\r\n * @param v1 (Vector3) the first control point\r\n * @param v2 (Vector3) the second control point\r\n * @param v3 (Vector3) the end point of the Cubic Bezier\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateCubicBezier = function (v0, v1, v2, v3, nbPoints) {\r\n nbPoints = nbPoints > 3 ? nbPoints : 4;\r\n var bez = new Array();\r\n var equation = function (t, val0, val1, val2, val3) {\r\n var res = (1.0 - t) * (1.0 - t) * (1.0 - t) * val0 + 3.0 * t * (1.0 - t) * (1.0 - t) * val1 + 3.0 * t * t * (1.0 - t) * val2 + t * t * t * val3;\r\n return res;\r\n };\r\n for (var i = 0; i <= nbPoints; i++) {\r\n bez.push(new Vector3(equation(i / nbPoints, v0.x, v1.x, v2.x, v3.x), equation(i / nbPoints, v0.y, v1.y, v2.y, v3.y), equation(i / nbPoints, v0.z, v1.z, v2.z, v3.z)));\r\n }\r\n return new Curve3(bez);\r\n };\r\n /**\r\n * Returns a Curve3 object along a Hermite Spline curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#hermite-spline\r\n * @param p1 (Vector3) the origin point of the Hermite Spline\r\n * @param t1 (Vector3) the tangent vector at the origin point\r\n * @param p2 (Vector3) the end point of the Hermite Spline\r\n * @param t2 (Vector3) the tangent vector at the end point\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateHermiteSpline = function (p1, t1, p2, t2, nbPoints) {\r\n var hermite = new Array();\r\n var step = 1.0 / nbPoints;\r\n for (var i = 0; i <= nbPoints; i++) {\r\n hermite.push(Vector3.Hermite(p1, t1, p2, t2, i * step));\r\n }\r\n return new Curve3(hermite);\r\n };\r\n /**\r\n * Returns a Curve3 object along a CatmullRom Spline curve :\r\n * @param points (array of Vector3) the points the spline must pass through. At least, four points required\r\n * @param nbPoints (integer) the wanted number of points between each curve control points\r\n * @param closed (boolean) optional with default false, when true forms a closed loop from the points\r\n * @returns the created Curve3\r\n */\r\n Curve3.CreateCatmullRomSpline = function (points, nbPoints, closed) {\r\n var catmullRom = new Array();\r\n var step = 1.0 / nbPoints;\r\n var amount = 0.0;\r\n if (closed) {\r\n var pointsCount = points.length;\r\n for (var i = 0; i < pointsCount; i++) {\r\n amount = 0;\r\n for (var c = 0; c < nbPoints; c++) {\r\n catmullRom.push(Vector3.CatmullRom(points[i % pointsCount], points[(i + 1) % pointsCount], points[(i + 2) % pointsCount], points[(i + 3) % pointsCount], amount));\r\n amount += step;\r\n }\r\n }\r\n catmullRom.push(catmullRom[0]);\r\n }\r\n else {\r\n var totalPoints = new Array();\r\n totalPoints.push(points[0].clone());\r\n Array.prototype.push.apply(totalPoints, points);\r\n totalPoints.push(points[points.length - 1].clone());\r\n for (var i = 0; i < totalPoints.length - 3; i++) {\r\n amount = 0;\r\n for (var c = 0; c < nbPoints; c++) {\r\n catmullRom.push(Vector3.CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\r\n amount += step;\r\n }\r\n }\r\n i--;\r\n catmullRom.push(Vector3.CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\r\n }\r\n return new Curve3(catmullRom);\r\n };\r\n /**\r\n * @returns the Curve3 stored array of successive Vector3\r\n */\r\n Curve3.prototype.getPoints = function () {\r\n return this._points;\r\n };\r\n /**\r\n * @returns the computed length (float) of the curve.\r\n */\r\n Curve3.prototype.length = function () {\r\n return this._length;\r\n };\r\n /**\r\n * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);\r\n * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.\r\n * curveA and curveB keep unchanged.\r\n * @param curve the curve to continue from this curve\r\n * @returns the newly constructed curve\r\n */\r\n Curve3.prototype.continue = function (curve) {\r\n var lastPoint = this._points[this._points.length - 1];\r\n var continuedPoints = this._points.slice();\r\n var curvePoints = curve.getPoints();\r\n for (var i = 1; i < curvePoints.length; i++) {\r\n continuedPoints.push(curvePoints[i].subtract(curvePoints[0]).add(lastPoint));\r\n }\r\n var continuedCurve = new Curve3(continuedPoints);\r\n return continuedCurve;\r\n };\r\n Curve3.prototype._computeLength = function (path) {\r\n var l = 0;\r\n for (var i = 1; i < path.length; i++) {\r\n l += path[i].subtract(path[i - 1]).length();\r\n }\r\n return l;\r\n };\r\n return Curve3;\r\n}());\r\nexport { Curve3 };\r\n//# sourceMappingURL=math.path.js.map","import { Vector3, Matrix } from './math.vector';\r\n/**\r\n * Represents a plane by the equation ax + by + cz + d = 0\r\n */\r\nvar Plane = /** @class */ (function () {\r\n /**\r\n * Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0\r\n * @param a a component of the plane\r\n * @param b b component of the plane\r\n * @param c c component of the plane\r\n * @param d d component of the plane\r\n */\r\n function Plane(a, b, c, d) {\r\n this.normal = new Vector3(a, b, c);\r\n this.d = d;\r\n }\r\n /**\r\n * @returns the plane coordinates as a new array of 4 elements [a, b, c, d].\r\n */\r\n Plane.prototype.asArray = function () {\r\n return [this.normal.x, this.normal.y, this.normal.z, this.d];\r\n };\r\n // Methods\r\n /**\r\n * @returns a new plane copied from the current Plane.\r\n */\r\n Plane.prototype.clone = function () {\r\n return new Plane(this.normal.x, this.normal.y, this.normal.z, this.d);\r\n };\r\n /**\r\n * @returns the string \"Plane\".\r\n */\r\n Plane.prototype.getClassName = function () {\r\n return \"Plane\";\r\n };\r\n /**\r\n * @returns the Plane hash code.\r\n */\r\n Plane.prototype.getHashCode = function () {\r\n var hash = this.normal.getHashCode();\r\n hash = (hash * 397) ^ (this.d | 0);\r\n return hash;\r\n };\r\n /**\r\n * Normalize the current Plane in place.\r\n * @returns the updated Plane.\r\n */\r\n Plane.prototype.normalize = function () {\r\n var norm = (Math.sqrt((this.normal.x * this.normal.x) + (this.normal.y * this.normal.y) + (this.normal.z * this.normal.z)));\r\n var magnitude = 0.0;\r\n if (norm !== 0) {\r\n magnitude = 1.0 / norm;\r\n }\r\n this.normal.x *= magnitude;\r\n this.normal.y *= magnitude;\r\n this.normal.z *= magnitude;\r\n this.d *= magnitude;\r\n return this;\r\n };\r\n /**\r\n * Applies a transformation the plane and returns the result\r\n * @param transformation the transformation matrix to be applied to the plane\r\n * @returns a new Plane as the result of the transformation of the current Plane by the given matrix.\r\n */\r\n Plane.prototype.transform = function (transformation) {\r\n var invertedMatrix = Plane._TmpMatrix;\r\n transformation.invertToRef(invertedMatrix);\r\n var m = invertedMatrix.m;\r\n var x = this.normal.x;\r\n var y = this.normal.y;\r\n var z = this.normal.z;\r\n var d = this.d;\r\n var normalX = x * m[0] + y * m[1] + z * m[2] + d * m[3];\r\n var normalY = x * m[4] + y * m[5] + z * m[6] + d * m[7];\r\n var normalZ = x * m[8] + y * m[9] + z * m[10] + d * m[11];\r\n var finalD = x * m[12] + y * m[13] + z * m[14] + d * m[15];\r\n return new Plane(normalX, normalY, normalZ, finalD);\r\n };\r\n /**\r\n * Compute the dot product between the point and the plane normal\r\n * @param point point to calculate the dot product with\r\n * @returns the dot product (float) of the point coordinates and the plane normal.\r\n */\r\n Plane.prototype.dotCoordinate = function (point) {\r\n return ((((this.normal.x * point.x) + (this.normal.y * point.y)) + (this.normal.z * point.z)) + this.d);\r\n };\r\n /**\r\n * Updates the current Plane from the plane defined by the three given points.\r\n * @param point1 one of the points used to contruct the plane\r\n * @param point2 one of the points used to contruct the plane\r\n * @param point3 one of the points used to contruct the plane\r\n * @returns the updated Plane.\r\n */\r\n Plane.prototype.copyFromPoints = function (point1, point2, point3) {\r\n var x1 = point2.x - point1.x;\r\n var y1 = point2.y - point1.y;\r\n var z1 = point2.z - point1.z;\r\n var x2 = point3.x - point1.x;\r\n var y2 = point3.y - point1.y;\r\n var z2 = point3.z - point1.z;\r\n var yz = (y1 * z2) - (z1 * y2);\r\n var xz = (z1 * x2) - (x1 * z2);\r\n var xy = (x1 * y2) - (y1 * x2);\r\n var pyth = (Math.sqrt((yz * yz) + (xz * xz) + (xy * xy)));\r\n var invPyth;\r\n if (pyth !== 0) {\r\n invPyth = 1.0 / pyth;\r\n }\r\n else {\r\n invPyth = 0.0;\r\n }\r\n this.normal.x = yz * invPyth;\r\n this.normal.y = xz * invPyth;\r\n this.normal.z = xy * invPyth;\r\n this.d = -((this.normal.x * point1.x) + (this.normal.y * point1.y) + (this.normal.z * point1.z));\r\n return this;\r\n };\r\n /**\r\n * Checks if the plane is facing a given direction (meaning if the plane's normal is pointing in the opposite direction of the given vector).\r\n * Note that for this function to work as expected you should make sure that:\r\n * - direction and the plane normal are normalized\r\n * - epsilon is a number just bigger than -1, something like -0.99 for eg\r\n * @param direction the direction to check if the plane is facing\r\n * @param epsilon value the dot product is compared against (returns true if dot <= epsilon)\r\n * @returns True if the plane is facing the given direction\r\n */\r\n Plane.prototype.isFrontFacingTo = function (direction, epsilon) {\r\n var dot = Vector3.Dot(this.normal, direction);\r\n return (dot <= epsilon);\r\n };\r\n /**\r\n * Calculates the distance to a point\r\n * @param point point to calculate distance to\r\n * @returns the signed distance (float) from the given point to the Plane.\r\n */\r\n Plane.prototype.signedDistanceTo = function (point) {\r\n return Vector3.Dot(point, this.normal) + this.d;\r\n };\r\n // Statics\r\n /**\r\n * Creates a plane from an array\r\n * @param array the array to create a plane from\r\n * @returns a new Plane from the given array.\r\n */\r\n Plane.FromArray = function (array) {\r\n return new Plane(array[0], array[1], array[2], array[3]);\r\n };\r\n /**\r\n * Creates a plane from three points\r\n * @param point1 point used to create the plane\r\n * @param point2 point used to create the plane\r\n * @param point3 point used to create the plane\r\n * @returns a new Plane defined by the three given points.\r\n */\r\n Plane.FromPoints = function (point1, point2, point3) {\r\n var result = new Plane(0.0, 0.0, 0.0, 0.0);\r\n result.copyFromPoints(point1, point2, point3);\r\n return result;\r\n };\r\n /**\r\n * Creates a plane from an origin point and a normal\r\n * @param origin origin of the plane to be constructed\r\n * @param normal normal of the plane to be constructed\r\n * @returns a new Plane the normal vector to this plane at the given origin point.\r\n * Note : the vector \"normal\" is updated because normalized.\r\n */\r\n Plane.FromPositionAndNormal = function (origin, normal) {\r\n var result = new Plane(0.0, 0.0, 0.0, 0.0);\r\n normal.normalize();\r\n result.normal = normal;\r\n result.d = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);\r\n return result;\r\n };\r\n /**\r\n * Calculates the distance from a plane and a point\r\n * @param origin origin of the plane to be constructed\r\n * @param normal normal of the plane to be constructed\r\n * @param point point to calculate distance to\r\n * @returns the signed distance between the plane defined by the normal vector at the \"origin\"\" point and the given other point.\r\n */\r\n Plane.SignedDistanceToPlaneFromPositionAndNormal = function (origin, normal, point) {\r\n var d = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);\r\n return Vector3.Dot(point, normal) + d;\r\n };\r\n Plane._TmpMatrix = Matrix.Identity();\r\n return Plane;\r\n}());\r\nexport { Plane };\r\n//# sourceMappingURL=math.plane.js.map","/**\r\n * Scalar computation library\r\n */\r\nvar Scalar = /** @class */ (function () {\r\n function Scalar() {\r\n }\r\n /**\r\n * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)\r\n * @param a number\r\n * @param b number\r\n * @param epsilon (default = 1.401298E-45)\r\n * @returns true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)\r\n */\r\n Scalar.WithinEpsilon = function (a, b, epsilon) {\r\n if (epsilon === void 0) { epsilon = 1.401298E-45; }\r\n var num = a - b;\r\n return -epsilon <= num && num <= epsilon;\r\n };\r\n /**\r\n * Returns a string : the upper case translation of the number i to hexadecimal.\r\n * @param i number\r\n * @returns the upper case translation of the number i to hexadecimal.\r\n */\r\n Scalar.ToHex = function (i) {\r\n var str = i.toString(16);\r\n if (i <= 15) {\r\n return (\"0\" + str).toUpperCase();\r\n }\r\n return str.toUpperCase();\r\n };\r\n /**\r\n * Returns -1 if value is negative and +1 is value is positive.\r\n * @param value the value\r\n * @returns the value itself if it's equal to zero.\r\n */\r\n Scalar.Sign = function (value) {\r\n value = +value; // convert to a number\r\n if (value === 0 || isNaN(value)) {\r\n return value;\r\n }\r\n return value > 0 ? 1 : -1;\r\n };\r\n /**\r\n * Returns the value itself if it's between min and max.\r\n * Returns min if the value is lower than min.\r\n * Returns max if the value is greater than max.\r\n * @param value the value to clmap\r\n * @param min the min value to clamp to (default: 0)\r\n * @param max the max value to clamp to (default: 1)\r\n * @returns the clamped value\r\n */\r\n Scalar.Clamp = function (value, min, max) {\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 1; }\r\n return Math.min(max, Math.max(min, value));\r\n };\r\n /**\r\n * the log2 of value.\r\n * @param value the value to compute log2 of\r\n * @returns the log2 of value.\r\n */\r\n Scalar.Log2 = function (value) {\r\n return Math.log(value) * Math.LOG2E;\r\n };\r\n /**\r\n * Loops the value, so that it is never larger than length and never smaller than 0.\r\n *\r\n * This is similar to the modulo operator but it works with floating point numbers.\r\n * For example, using 3.0 for t and 2.5 for length, the result would be 0.5.\r\n * With t = 5 and length = 2.5, the result would be 0.0.\r\n * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator\r\n * @param value the value\r\n * @param length the length\r\n * @returns the looped value\r\n */\r\n Scalar.Repeat = function (value, length) {\r\n return value - Math.floor(value / length) * length;\r\n };\r\n /**\r\n * Normalize the value between 0.0 and 1.0 using min and max values\r\n * @param value value to normalize\r\n * @param min max to normalize between\r\n * @param max min to normalize between\r\n * @returns the normalized value\r\n */\r\n Scalar.Normalize = function (value, min, max) {\r\n return (value - min) / (max - min);\r\n };\r\n /**\r\n * Denormalize the value from 0.0 and 1.0 using min and max values\r\n * @param normalized value to denormalize\r\n * @param min max to denormalize between\r\n * @param max min to denormalize between\r\n * @returns the denormalized value\r\n */\r\n Scalar.Denormalize = function (normalized, min, max) {\r\n return (normalized * (max - min) + min);\r\n };\r\n /**\r\n * Calculates the shortest difference between two given angles given in degrees.\r\n * @param current current angle in degrees\r\n * @param target target angle in degrees\r\n * @returns the delta\r\n */\r\n Scalar.DeltaAngle = function (current, target) {\r\n var num = Scalar.Repeat(target - current, 360.0);\r\n if (num > 180.0) {\r\n num -= 360.0;\r\n }\r\n return num;\r\n };\r\n /**\r\n * PingPongs the value t, so that it is never larger than length and never smaller than 0.\r\n * @param tx value\r\n * @param length length\r\n * @returns The returned value will move back and forth between 0 and length\r\n */\r\n Scalar.PingPong = function (tx, length) {\r\n var t = Scalar.Repeat(tx, length * 2.0);\r\n return length - Math.abs(t - length);\r\n };\r\n /**\r\n * Interpolates between min and max with smoothing at the limits.\r\n *\r\n * This function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up\r\n * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.\r\n * @param from from\r\n * @param to to\r\n * @param tx value\r\n * @returns the smooth stepped value\r\n */\r\n Scalar.SmoothStep = function (from, to, tx) {\r\n var t = Scalar.Clamp(tx);\r\n t = -2.0 * t * t * t + 3.0 * t * t;\r\n return to * t + from * (1.0 - t);\r\n };\r\n /**\r\n * Moves a value current towards target.\r\n *\r\n * This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta.\r\n * Negative values of maxDelta pushes the value away from target.\r\n * @param current current value\r\n * @param target target value\r\n * @param maxDelta max distance to move\r\n * @returns resulting value\r\n */\r\n Scalar.MoveTowards = function (current, target, maxDelta) {\r\n var result = 0;\r\n if (Math.abs(target - current) <= maxDelta) {\r\n result = target;\r\n }\r\n else {\r\n result = current + Scalar.Sign(target - current) * maxDelta;\r\n }\r\n return result;\r\n };\r\n /**\r\n * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.\r\n *\r\n * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta\r\n * are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.\r\n * @param current current value\r\n * @param target target value\r\n * @param maxDelta max distance to move\r\n * @returns resulting angle\r\n */\r\n Scalar.MoveTowardsAngle = function (current, target, maxDelta) {\r\n var num = Scalar.DeltaAngle(current, target);\r\n var result = 0;\r\n if (-maxDelta < num && num < maxDelta) {\r\n result = target;\r\n }\r\n else {\r\n target = current + num;\r\n result = Scalar.MoveTowards(current, target, maxDelta);\r\n }\r\n return result;\r\n };\r\n /**\r\n * Creates a new scalar with values linearly interpolated of \"amount\" between the start scalar and the end scalar.\r\n * @param start start value\r\n * @param end target value\r\n * @param amount amount to lerp between\r\n * @returns the lerped value\r\n */\r\n Scalar.Lerp = function (start, end, amount) {\r\n return start + ((end - start) * amount);\r\n };\r\n /**\r\n * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.\r\n * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.\r\n * @param start start value\r\n * @param end target value\r\n * @param amount amount to lerp between\r\n * @returns the lerped value\r\n */\r\n Scalar.LerpAngle = function (start, end, amount) {\r\n var num = Scalar.Repeat(end - start, 360.0);\r\n if (num > 180.0) {\r\n num -= 360.0;\r\n }\r\n return start + num * Scalar.Clamp(amount);\r\n };\r\n /**\r\n * Calculates the linear parameter t that produces the interpolant value within the range [a, b].\r\n * @param a start value\r\n * @param b target value\r\n * @param value value between a and b\r\n * @returns the inverseLerp value\r\n */\r\n Scalar.InverseLerp = function (a, b, value) {\r\n var result = 0;\r\n if (a != b) {\r\n result = Scalar.Clamp((value - a) / (b - a));\r\n }\r\n else {\r\n result = 0.0;\r\n }\r\n return result;\r\n };\r\n /**\r\n * Returns a new scalar located for \"amount\" (float) on the Hermite spline defined by the scalars \"value1\", \"value3\", \"tangent1\", \"tangent2\".\r\n * @see http://mathworld.wolfram.com/HermitePolynomial.html\r\n * @param value1 spline value\r\n * @param tangent1 spline value\r\n * @param value2 spline value\r\n * @param tangent2 spline value\r\n * @param amount input value\r\n * @returns hermite result\r\n */\r\n Scalar.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n return (((value1 * part1) + (value2 * part2)) + (tangent1 * part3)) + (tangent2 * part4);\r\n };\r\n /**\r\n * Returns a random float number between and min and max values\r\n * @param min min value of random\r\n * @param max max value of random\r\n * @returns random value\r\n */\r\n Scalar.RandomRange = function (min, max) {\r\n if (min === max) {\r\n return min;\r\n }\r\n return ((Math.random() * (max - min)) + min);\r\n };\r\n /**\r\n * This function returns percentage of a number in a given range.\r\n *\r\n * RangeToPercent(40,20,60) will return 0.5 (50%)\r\n * RangeToPercent(34,0,100) will return 0.34 (34%)\r\n * @param number to convert to percentage\r\n * @param min min range\r\n * @param max max range\r\n * @returns the percentage\r\n */\r\n Scalar.RangeToPercent = function (number, min, max) {\r\n return ((number - min) / (max - min));\r\n };\r\n /**\r\n * This function returns number that corresponds to the percentage in a given range.\r\n *\r\n * PercentToRange(0.34,0,100) will return 34.\r\n * @param percent to convert to number\r\n * @param min min range\r\n * @param max max range\r\n * @returns the number\r\n */\r\n Scalar.PercentToRange = function (percent, min, max) {\r\n return ((max - min) * percent + min);\r\n };\r\n /**\r\n * Returns the angle converted to equivalent value between -Math.PI and Math.PI radians.\r\n * @param angle The angle to normalize in radian.\r\n * @return The converted angle.\r\n */\r\n Scalar.NormalizeRadians = function (angle) {\r\n // More precise but slower version kept for reference.\r\n // angle = angle % Tools.TwoPi;\r\n // angle = (angle + Tools.TwoPi) % Tools.TwoPi;\r\n //if (angle > Math.PI) {\r\n //\tangle -= Tools.TwoPi;\r\n //}\r\n angle -= (Scalar.TwoPi * Math.floor((angle + Math.PI) / Scalar.TwoPi));\r\n return angle;\r\n };\r\n /**\r\n * Two pi constants convenient for computation.\r\n */\r\n Scalar.TwoPi = Math.PI * 2;\r\n return Scalar;\r\n}());\r\nexport { Scalar };\r\n//# sourceMappingURL=math.scalar.js.map","/**\r\n * Size containing widht and height\r\n */\r\nvar Size = /** @class */ (function () {\r\n /**\r\n * Creates a Size object from the given width and height (floats).\r\n * @param width width of the new size\r\n * @param height height of the new size\r\n */\r\n function Size(width, height) {\r\n this.width = width;\r\n this.height = height;\r\n }\r\n /**\r\n * Returns a string with the Size width and height\r\n * @returns a string with the Size width and height\r\n */\r\n Size.prototype.toString = function () {\r\n return \"{W: \" + this.width + \", H: \" + this.height + \"}\";\r\n };\r\n /**\r\n * \"Size\"\r\n * @returns the string \"Size\"\r\n */\r\n Size.prototype.getClassName = function () {\r\n return \"Size\";\r\n };\r\n /**\r\n * Returns the Size hash code.\r\n * @returns a hash code for a unique width and height\r\n */\r\n Size.prototype.getHashCode = function () {\r\n var hash = this.width | 0;\r\n hash = (hash * 397) ^ (this.height | 0);\r\n return hash;\r\n };\r\n /**\r\n * Updates the current size from the given one.\r\n * @param src the given size\r\n */\r\n Size.prototype.copyFrom = function (src) {\r\n this.width = src.width;\r\n this.height = src.height;\r\n };\r\n /**\r\n * Updates in place the current Size from the given floats.\r\n * @param width width of the new size\r\n * @param height height of the new size\r\n * @returns the updated Size.\r\n */\r\n Size.prototype.copyFromFloats = function (width, height) {\r\n this.width = width;\r\n this.height = height;\r\n return this;\r\n };\r\n /**\r\n * Updates in place the current Size from the given floats.\r\n * @param width width to set\r\n * @param height height to set\r\n * @returns the updated Size.\r\n */\r\n Size.prototype.set = function (width, height) {\r\n return this.copyFromFloats(width, height);\r\n };\r\n /**\r\n * Multiplies the width and height by numbers\r\n * @param w factor to multiple the width by\r\n * @param h factor to multiple the height by\r\n * @returns a new Size set with the multiplication result of the current Size and the given floats.\r\n */\r\n Size.prototype.multiplyByFloats = function (w, h) {\r\n return new Size(this.width * w, this.height * h);\r\n };\r\n /**\r\n * Clones the size\r\n * @returns a new Size copied from the given one.\r\n */\r\n Size.prototype.clone = function () {\r\n return new Size(this.width, this.height);\r\n };\r\n /**\r\n * True if the current Size and the given one width and height are strictly equal.\r\n * @param other the other size to compare against\r\n * @returns True if the current Size and the given one width and height are strictly equal.\r\n */\r\n Size.prototype.equals = function (other) {\r\n if (!other) {\r\n return false;\r\n }\r\n return (this.width === other.width) && (this.height === other.height);\r\n };\r\n Object.defineProperty(Size.prototype, \"surface\", {\r\n /**\r\n * The surface of the Size : width * height (float).\r\n */\r\n get: function () {\r\n return this.width * this.height;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Create a new size of zero\r\n * @returns a new Size set to (0.0, 0.0)\r\n */\r\n Size.Zero = function () {\r\n return new Size(0.0, 0.0);\r\n };\r\n /**\r\n * Sums the width and height of two sizes\r\n * @param otherSize size to add to this size\r\n * @returns a new Size set as the addition result of the current Size and the given one.\r\n */\r\n Size.prototype.add = function (otherSize) {\r\n var r = new Size(this.width + otherSize.width, this.height + otherSize.height);\r\n return r;\r\n };\r\n /**\r\n * Subtracts the width and height of two\r\n * @param otherSize size to subtract to this size\r\n * @returns a new Size set as the subtraction result of the given one from the current Size.\r\n */\r\n Size.prototype.subtract = function (otherSize) {\r\n var r = new Size(this.width - otherSize.width, this.height - otherSize.height);\r\n return r;\r\n };\r\n /**\r\n * Creates a new Size set at the linear interpolation \"amount\" between \"start\" and \"end\"\r\n * @param start starting size to lerp between\r\n * @param end end size to lerp between\r\n * @param amount amount to lerp between the start and end values\r\n * @returns a new Size set at the linear interpolation \"amount\" between \"start\" and \"end\"\r\n */\r\n Size.Lerp = function (start, end, amount) {\r\n var w = start.width + ((end.width - start.width) * amount);\r\n var h = start.height + ((end.height - start.height) * amount);\r\n return new Size(w, h);\r\n };\r\n return Size;\r\n}());\r\nexport { Size };\r\n//# sourceMappingURL=math.size.js.map","import { Scalar } from \"./math.scalar\";\r\nimport { Epsilon } from './math.constants';\r\nimport { ArrayTools } from '../Misc/arrayTools';\r\nimport { _TypeStore } from '../Misc/typeStore';\r\nimport { PerformanceConfigurator } from '../Engines/performanceConfigurator';\r\n/**\r\n * Class representing a vector containing 2 coordinates\r\n */\r\nvar Vector2 = /** @class */ (function () {\r\n /**\r\n * Creates a new Vector2 from the given x and y coordinates\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n */\r\n function Vector2(\r\n /** defines the first coordinate */\r\n x, \r\n /** defines the second coordinate */\r\n y) {\r\n if (x === void 0) { x = 0; }\r\n if (y === void 0) { y = 0; }\r\n this.x = x;\r\n this.y = y;\r\n }\r\n /**\r\n * Gets a string with the Vector2 coordinates\r\n * @returns a string with the Vector2 coordinates\r\n */\r\n Vector2.prototype.toString = function () {\r\n return \"{X: \" + this.x + \" Y: \" + this.y + \"}\";\r\n };\r\n /**\r\n * Gets class name\r\n * @returns the string \"Vector2\"\r\n */\r\n Vector2.prototype.getClassName = function () {\r\n return \"Vector2\";\r\n };\r\n /**\r\n * Gets current vector hash code\r\n * @returns the Vector2 hash code as a number\r\n */\r\n Vector2.prototype.getHashCode = function () {\r\n var hash = this.x | 0;\r\n hash = (hash * 397) ^ (this.y | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Sets the Vector2 coordinates in the given array or Float32Array from the given index.\r\n * @param array defines the source array\r\n * @param index defines the offset in source array\r\n * @returns the current Vector2\r\n */\r\n Vector2.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this.x;\r\n array[index + 1] = this.y;\r\n return this;\r\n };\r\n /**\r\n * Update the current vector from an array\r\n * @param array defines the destination array\r\n * @param index defines the offset in the destination array\r\n * @returns the current Vector3\r\n */\r\n Vector2.prototype.fromArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n Vector2.FromArrayToRef(array, index, this);\r\n return this;\r\n };\r\n /**\r\n * Copy the current vector to an array\r\n * @returns a new array with 2 elements: the Vector2 coordinates.\r\n */\r\n Vector2.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Sets the Vector2 coordinates with the given Vector2 coordinates\r\n * @param source defines the source Vector2\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.copyFrom = function (source) {\r\n this.x = source.x;\r\n this.y = source.y;\r\n return this;\r\n };\r\n /**\r\n * Sets the Vector2 coordinates with the given floats\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.copyFromFloats = function (x, y) {\r\n this.x = x;\r\n this.y = y;\r\n return this;\r\n };\r\n /**\r\n * Sets the Vector2 coordinates with the given floats\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.set = function (x, y) {\r\n return this.copyFromFloats(x, y);\r\n };\r\n /**\r\n * Add another vector with the current one\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2 set with the addition of the current Vector2 and the given one coordinates\r\n */\r\n Vector2.prototype.add = function (otherVector) {\r\n return new Vector2(this.x + otherVector.x, this.y + otherVector.y);\r\n };\r\n /**\r\n * Sets the \"result\" coordinates with the addition of the current Vector2 and the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.addToRef = function (otherVector, result) {\r\n result.x = this.x + otherVector.x;\r\n result.y = this.y + otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Set the Vector2 coordinates by adding the given Vector2 coordinates\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.addInPlace = function (otherVector) {\r\n this.x += otherVector.x;\r\n this.y += otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector2 by adding the current Vector2 coordinates to the given Vector3 x, y coordinates\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.addVector3 = function (otherVector) {\r\n return new Vector2(this.x + otherVector.x, this.y + otherVector.y);\r\n };\r\n /**\r\n * Gets a new Vector2 set with the subtracted coordinates of the given one from the current Vector2\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.subtract = function (otherVector) {\r\n return new Vector2(this.x - otherVector.x, this.y - otherVector.y);\r\n };\r\n /**\r\n * Sets the \"result\" coordinates with the subtraction of the given one from the current Vector2 coordinates.\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.subtractToRef = function (otherVector, result) {\r\n result.x = this.x - otherVector.x;\r\n result.y = this.y - otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Sets the current Vector2 coordinates by subtracting from it the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.subtractInPlace = function (otherVector) {\r\n this.x -= otherVector.x;\r\n this.y -= otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Multiplies in place the current Vector2 coordinates by the given ones\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.multiplyInPlace = function (otherVector) {\r\n this.x *= otherVector.x;\r\n this.y *= otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector2 set with the multiplication of the current Vector2 and the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.multiply = function (otherVector) {\r\n return new Vector2(this.x * otherVector.x, this.y * otherVector.y);\r\n };\r\n /**\r\n * Sets \"result\" coordinates with the multiplication of the current Vector2 and the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.multiplyToRef = function (otherVector, result) {\r\n result.x = this.x * otherVector.x;\r\n result.y = this.y * otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector2 set with the Vector2 coordinates multiplied by the given floats\r\n * @param x defines the first coordinate\r\n * @param y defines the second coordinate\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.multiplyByFloats = function (x, y) {\r\n return new Vector2(this.x * x, this.y * y);\r\n };\r\n /**\r\n * Returns a new Vector2 set with the Vector2 coordinates divided by the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.divide = function (otherVector) {\r\n return new Vector2(this.x / otherVector.x, this.y / otherVector.y);\r\n };\r\n /**\r\n * Sets the \"result\" coordinates with the Vector2 divided by the given one coordinates\r\n * @param otherVector defines the other vector\r\n * @param result defines the target vector\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.divideToRef = function (otherVector, result) {\r\n result.x = this.x / otherVector.x;\r\n result.y = this.y / otherVector.y;\r\n return this;\r\n };\r\n /**\r\n * Divides the current Vector2 coordinates by the given ones\r\n * @param otherVector defines the other vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.divideInPlace = function (otherVector) {\r\n return this.divideToRef(otherVector, this);\r\n };\r\n /**\r\n * Gets a new Vector2 with current Vector2 negated coordinates\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.negate = function () {\r\n return new Vector2(-this.x, -this.y);\r\n };\r\n /**\r\n * Negate this vector in place\r\n * @returns this\r\n */\r\n Vector2.prototype.negateInPlace = function () {\r\n this.x *= -1;\r\n this.y *= -1;\r\n return this;\r\n };\r\n /**\r\n * Negate the current Vector2 and stores the result in the given vector \"result\" coordinates\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector2\r\n */\r\n Vector2.prototype.negateToRef = function (result) {\r\n return result.copyFromFloats(this.x * -1, this.y * -1);\r\n };\r\n /**\r\n * Multiply the Vector2 coordinates by scale\r\n * @param scale defines the scaling factor\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.scaleInPlace = function (scale) {\r\n this.x *= scale;\r\n this.y *= scale;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector2 scaled by \"scale\" from the current Vector2\r\n * @param scale defines the scaling factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.scale = function (scale) {\r\n var result = new Vector2(0, 0);\r\n this.scaleToRef(scale, result);\r\n return result;\r\n };\r\n /**\r\n * Scale the current Vector2 values by a factor to a given Vector2\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector2 object where to store the result\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.scaleToRef = function (scale, result) {\r\n result.x = this.x * scale;\r\n result.y = this.y * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Vector2 values by a factor and add the result to a given Vector2\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector2 object where to store the result\r\n * @returns the unmodified current Vector2\r\n */\r\n Vector2.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.x += this.x * scale;\r\n result.y += this.y * scale;\r\n return this;\r\n };\r\n /**\r\n * Gets a boolean if two vectors are equals\r\n * @param otherVector defines the other vector\r\n * @returns true if the given vector coordinates strictly equal the current Vector2 ones\r\n */\r\n Vector2.prototype.equals = function (otherVector) {\r\n return otherVector && this.x === otherVector.x && this.y === otherVector.y;\r\n };\r\n /**\r\n * Gets a boolean if two vectors are equals (using an epsilon value)\r\n * @param otherVector defines the other vector\r\n * @param epsilon defines the minimal distance to consider equality\r\n * @returns true if the given vector coordinates are close to the current ones by a distance of epsilon.\r\n */\r\n Vector2.prototype.equalsWithEpsilon = function (otherVector, epsilon) {\r\n if (epsilon === void 0) { epsilon = Epsilon; }\r\n return otherVector && Scalar.WithinEpsilon(this.x, otherVector.x, epsilon) && Scalar.WithinEpsilon(this.y, otherVector.y, epsilon);\r\n };\r\n /**\r\n * Gets a new Vector2 from current Vector2 floored values\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.floor = function () {\r\n return new Vector2(Math.floor(this.x), Math.floor(this.y));\r\n };\r\n /**\r\n * Gets a new Vector2 from current Vector2 floored values\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.fract = function () {\r\n return new Vector2(this.x - Math.floor(this.x), this.y - Math.floor(this.y));\r\n };\r\n // Properties\r\n /**\r\n * Gets the length of the vector\r\n * @returns the vector length (float)\r\n */\r\n Vector2.prototype.length = function () {\r\n return Math.sqrt(this.x * this.x + this.y * this.y);\r\n };\r\n /**\r\n * Gets the vector squared length\r\n * @returns the vector squared length (float)\r\n */\r\n Vector2.prototype.lengthSquared = function () {\r\n return (this.x * this.x + this.y * this.y);\r\n };\r\n // Methods\r\n /**\r\n * Normalize the vector\r\n * @returns the current updated Vector2\r\n */\r\n Vector2.prototype.normalize = function () {\r\n var len = this.length();\r\n if (len === 0) {\r\n return this;\r\n }\r\n this.x /= len;\r\n this.y /= len;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector2 copied from the Vector2\r\n * @returns a new Vector2\r\n */\r\n Vector2.prototype.clone = function () {\r\n return new Vector2(this.x, this.y);\r\n };\r\n // Statics\r\n /**\r\n * Gets a new Vector2(0, 0)\r\n * @returns a new Vector2\r\n */\r\n Vector2.Zero = function () {\r\n return new Vector2(0, 0);\r\n };\r\n /**\r\n * Gets a new Vector2(1, 1)\r\n * @returns a new Vector2\r\n */\r\n Vector2.One = function () {\r\n return new Vector2(1, 1);\r\n };\r\n /**\r\n * Gets a new Vector2 set from the given index element of the given array\r\n * @param array defines the data source\r\n * @param offset defines the offset in the data source\r\n * @returns a new Vector2\r\n */\r\n Vector2.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Vector2(array[offset], array[offset + 1]);\r\n };\r\n /**\r\n * Sets \"result\" from the given index element of the given array\r\n * @param array defines the data source\r\n * @param offset defines the offset in the data source\r\n * @param result defines the target vector\r\n */\r\n Vector2.FromArrayToRef = function (array, offset, result) {\r\n result.x = array[offset];\r\n result.y = array[offset + 1];\r\n };\r\n /**\r\n * Gets a new Vector2 located for \"amount\" (float) on the CatmullRom spline defined by the given four Vector2\r\n * @param value1 defines 1st point of control\r\n * @param value2 defines 2nd point of control\r\n * @param value3 defines 3rd point of control\r\n * @param value4 defines 4th point of control\r\n * @param amount defines the interpolation factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.CatmullRom = function (value1, value2, value3, value4, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var x = 0.5 * ((((2.0 * value2.x) + ((-value1.x + value3.x) * amount)) +\r\n (((((2.0 * value1.x) - (5.0 * value2.x)) + (4.0 * value3.x)) - value4.x) * squared)) +\r\n ((((-value1.x + (3.0 * value2.x)) - (3.0 * value3.x)) + value4.x) * cubed));\r\n var y = 0.5 * ((((2.0 * value2.y) + ((-value1.y + value3.y) * amount)) +\r\n (((((2.0 * value1.y) - (5.0 * value2.y)) + (4.0 * value3.y)) - value4.y) * squared)) +\r\n ((((-value1.y + (3.0 * value2.y)) - (3.0 * value3.y)) + value4.y) * cubed));\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Returns a new Vector2 set with same the coordinates than \"value\" ones if the vector \"value\" is in the square defined by \"min\" and \"max\".\r\n * If a coordinate of \"value\" is lower than \"min\" coordinates, the returned Vector2 is given this \"min\" coordinate.\r\n * If a coordinate of \"value\" is greater than \"max\" coordinates, the returned Vector2 is given this \"max\" coordinate\r\n * @param value defines the value to clamp\r\n * @param min defines the lower limit\r\n * @param max defines the upper limit\r\n * @returns a new Vector2\r\n */\r\n Vector2.Clamp = function (value, min, max) {\r\n var x = value.x;\r\n x = (x > max.x) ? max.x : x;\r\n x = (x < min.x) ? min.x : x;\r\n var y = value.y;\r\n y = (y > max.y) ? max.y : y;\r\n y = (y < min.y) ? min.y : y;\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Returns a new Vector2 located for \"amount\" (float) on the Hermite spline defined by the vectors \"value1\", \"value3\", \"tangent1\", \"tangent2\"\r\n * @param value1 defines the 1st control point\r\n * @param tangent1 defines the outgoing tangent\r\n * @param value2 defines the 2nd control point\r\n * @param tangent2 defines the incoming tangent\r\n * @param amount defines the interpolation factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n var x = (((value1.x * part1) + (value2.x * part2)) + (tangent1.x * part3)) + (tangent2.x * part4);\r\n var y = (((value1.y * part1) + (value2.y * part2)) + (tangent1.y * part3)) + (tangent2.y * part4);\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Returns a new Vector2 located for \"amount\" (float) on the linear interpolation between the vector \"start\" adn the vector \"end\".\r\n * @param start defines the start vector\r\n * @param end defines the end vector\r\n * @param amount defines the interpolation factor\r\n * @returns a new Vector2\r\n */\r\n Vector2.Lerp = function (start, end, amount) {\r\n var x = start.x + ((end.x - start.x) * amount);\r\n var y = start.y + ((end.y - start.y) * amount);\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Gets the dot product of the vector \"left\" and the vector \"right\"\r\n * @param left defines first vector\r\n * @param right defines second vector\r\n * @returns the dot product (float)\r\n */\r\n Vector2.Dot = function (left, right) {\r\n return left.x * right.x + left.y * right.y;\r\n };\r\n /**\r\n * Returns a new Vector2 equal to the normalized given vector\r\n * @param vector defines the vector to normalize\r\n * @returns a new Vector2\r\n */\r\n Vector2.Normalize = function (vector) {\r\n var newVector = vector.clone();\r\n newVector.normalize();\r\n return newVector;\r\n };\r\n /**\r\n * Gets a new Vector2 set with the minimal coordinate values from the \"left\" and \"right\" vectors\r\n * @param left defines 1st vector\r\n * @param right defines 2nd vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.Minimize = function (left, right) {\r\n var x = (left.x < right.x) ? left.x : right.x;\r\n var y = (left.y < right.y) ? left.y : right.y;\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Gets a new Vecto2 set with the maximal coordinate values from the \"left\" and \"right\" vectors\r\n * @param left defines 1st vector\r\n * @param right defines 2nd vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.Maximize = function (left, right) {\r\n var x = (left.x > right.x) ? left.x : right.x;\r\n var y = (left.y > right.y) ? left.y : right.y;\r\n return new Vector2(x, y);\r\n };\r\n /**\r\n * Gets a new Vector2 set with the transformed coordinates of the given vector by the given transformation matrix\r\n * @param vector defines the vector to transform\r\n * @param transformation defines the matrix to apply\r\n * @returns a new Vector2\r\n */\r\n Vector2.Transform = function (vector, transformation) {\r\n var r = Vector2.Zero();\r\n Vector2.TransformToRef(vector, transformation, r);\r\n return r;\r\n };\r\n /**\r\n * Transforms the given vector coordinates by the given transformation matrix and stores the result in the vector \"result\" coordinates\r\n * @param vector defines the vector to transform\r\n * @param transformation defines the matrix to apply\r\n * @param result defines the target vector\r\n */\r\n Vector2.TransformToRef = function (vector, transformation, result) {\r\n var m = transformation.m;\r\n var x = (vector.x * m[0]) + (vector.y * m[4]) + m[12];\r\n var y = (vector.x * m[1]) + (vector.y * m[5]) + m[13];\r\n result.x = x;\r\n result.y = y;\r\n };\r\n /**\r\n * Determines if a given vector is included in a triangle\r\n * @param p defines the vector to test\r\n * @param p0 defines 1st triangle point\r\n * @param p1 defines 2nd triangle point\r\n * @param p2 defines 3rd triangle point\r\n * @returns true if the point \"p\" is in the triangle defined by the vertors \"p0\", \"p1\", \"p2\"\r\n */\r\n Vector2.PointInTriangle = function (p, p0, p1, p2) {\r\n var a = 1 / 2 * (-p1.y * p2.x + p0.y * (-p1.x + p2.x) + p0.x * (p1.y - p2.y) + p1.x * p2.y);\r\n var sign = a < 0 ? -1 : 1;\r\n var s = (p0.y * p2.x - p0.x * p2.y + (p2.y - p0.y) * p.x + (p0.x - p2.x) * p.y) * sign;\r\n var t = (p0.x * p1.y - p0.y * p1.x + (p0.y - p1.y) * p.x + (p1.x - p0.x) * p.y) * sign;\r\n return s > 0 && t > 0 && (s + t) < 2 * a * sign;\r\n };\r\n /**\r\n * Gets the distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines first vector\r\n * @param value2 defines second vector\r\n * @returns the distance between vectors\r\n */\r\n Vector2.Distance = function (value1, value2) {\r\n return Math.sqrt(Vector2.DistanceSquared(value1, value2));\r\n };\r\n /**\r\n * Returns the squared distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines first vector\r\n * @param value2 defines second vector\r\n * @returns the squared distance between vectors\r\n */\r\n Vector2.DistanceSquared = function (value1, value2) {\r\n var x = value1.x - value2.x;\r\n var y = value1.y - value2.y;\r\n return (x * x) + (y * y);\r\n };\r\n /**\r\n * Gets a new Vector2 located at the center of the vectors \"value1\" and \"value2\"\r\n * @param value1 defines first vector\r\n * @param value2 defines second vector\r\n * @returns a new Vector2\r\n */\r\n Vector2.Center = function (value1, value2) {\r\n var center = value1.add(value2);\r\n center.scaleInPlace(0.5);\r\n return center;\r\n };\r\n /**\r\n * Gets the shortest distance (float) between the point \"p\" and the segment defined by the two points \"segA\" and \"segB\".\r\n * @param p defines the middle point\r\n * @param segA defines one point of the segment\r\n * @param segB defines the other point of the segment\r\n * @returns the shortest distance\r\n */\r\n Vector2.DistanceOfPointFromSegment = function (p, segA, segB) {\r\n var l2 = Vector2.DistanceSquared(segA, segB);\r\n if (l2 === 0.0) {\r\n return Vector2.Distance(p, segA);\r\n }\r\n var v = segB.subtract(segA);\r\n var t = Math.max(0, Math.min(1, Vector2.Dot(p.subtract(segA), v) / l2));\r\n var proj = segA.add(v.multiplyByFloats(t, t));\r\n return Vector2.Distance(p, proj);\r\n };\r\n return Vector2;\r\n}());\r\nexport { Vector2 };\r\n/**\r\n * Class used to store (x,y,z) vector representation\r\n * A Vector3 is the main object used in 3D geometry\r\n * It can represent etiher the coordinates of a point the space, either a direction\r\n * Reminder: js uses a left handed forward facing system\r\n */\r\nvar Vector3 = /** @class */ (function () {\r\n /**\r\n * Creates a new Vector3 object from the given x, y, z (floats) coordinates.\r\n * @param x defines the first coordinates (on X axis)\r\n * @param y defines the second coordinates (on Y axis)\r\n * @param z defines the third coordinates (on Z axis)\r\n */\r\n function Vector3(x, y, z) {\r\n if (x === void 0) { x = 0; }\r\n if (y === void 0) { y = 0; }\r\n if (z === void 0) { z = 0; }\r\n /** @hidden */\r\n this._isDirty = true;\r\n this._x = x;\r\n this._y = y;\r\n this._z = z;\r\n }\r\n Object.defineProperty(Vector3.prototype, \"x\", {\r\n /** Gets or sets the x coordinate */\r\n get: function () {\r\n return this._x;\r\n },\r\n set: function (value) {\r\n this._x = value;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Vector3.prototype, \"y\", {\r\n /** Gets or sets the y coordinate */\r\n get: function () {\r\n return this._y;\r\n },\r\n set: function (value) {\r\n this._y = value;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Vector3.prototype, \"z\", {\r\n /** Gets or sets the z coordinate */\r\n get: function () {\r\n return this._z;\r\n },\r\n set: function (value) {\r\n this._z = value;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a string representation of the Vector3\r\n * @returns a string with the Vector3 coordinates.\r\n */\r\n Vector3.prototype.toString = function () {\r\n return \"{X: \" + this._x + \" Y:\" + this._y + \" Z:\" + this._z + \"}\";\r\n };\r\n /**\r\n * Gets the class name\r\n * @returns the string \"Vector3\"\r\n */\r\n Vector3.prototype.getClassName = function () {\r\n return \"Vector3\";\r\n };\r\n /**\r\n * Creates the Vector3 hash code\r\n * @returns a number which tends to be unique between Vector3 instances\r\n */\r\n Vector3.prototype.getHashCode = function () {\r\n var hash = this._x | 0;\r\n hash = (hash * 397) ^ (this._y | 0);\r\n hash = (hash * 397) ^ (this._z | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Creates an array containing three elements : the coordinates of the Vector3\r\n * @returns a new array of numbers\r\n */\r\n Vector3.prototype.asArray = function () {\r\n var result = [];\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Populates the given array or Float32Array from the given index with the successive coordinates of the Vector3\r\n * @param array defines the destination array\r\n * @param index defines the offset in the destination array\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.toArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n array[index] = this._x;\r\n array[index + 1] = this._y;\r\n array[index + 2] = this._z;\r\n return this;\r\n };\r\n /**\r\n * Update the current vector from an array\r\n * @param array defines the destination array\r\n * @param index defines the offset in the destination array\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.fromArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n Vector3.FromArrayToRef(array, index, this);\r\n return this;\r\n };\r\n /**\r\n * Converts the current Vector3 into a quaternion (considering that the Vector3 contains Euler angles representation of a rotation)\r\n * @returns a new Quaternion object, computed from the Vector3 coordinates\r\n */\r\n Vector3.prototype.toQuaternion = function () {\r\n return Quaternion.RotationYawPitchRoll(this._y, this._x, this._z);\r\n };\r\n /**\r\n * Adds the given vector to the current Vector3\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.addInPlace = function (otherVector) {\r\n return this.addInPlaceFromFloats(otherVector._x, otherVector._y, otherVector._z);\r\n };\r\n /**\r\n * Adds the given coordinates to the current Vector3\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.addInPlaceFromFloats = function (x, y, z) {\r\n this.x += x;\r\n this.y += y;\r\n this.z += z;\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector3, result of the addition the current Vector3 and the given vector\r\n * @param otherVector defines the second operand\r\n * @returns the resulting Vector3\r\n */\r\n Vector3.prototype.add = function (otherVector) {\r\n return new Vector3(this._x + otherVector._x, this._y + otherVector._y, this._z + otherVector._z);\r\n };\r\n /**\r\n * Adds the current Vector3 to the given one and stores the result in the vector \"result\"\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.addToRef = function (otherVector, result) {\r\n return result.copyFromFloats(this._x + otherVector._x, this._y + otherVector._y, this._z + otherVector._z);\r\n };\r\n /**\r\n * Subtract the given vector from the current Vector3\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.subtractInPlace = function (otherVector) {\r\n this.x -= otherVector._x;\r\n this.y -= otherVector._y;\r\n this.z -= otherVector._z;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3, result of the subtraction of the given vector from the current Vector3\r\n * @param otherVector defines the second operand\r\n * @returns the resulting Vector3\r\n */\r\n Vector3.prototype.subtract = function (otherVector) {\r\n return new Vector3(this._x - otherVector._x, this._y - otherVector._y, this._z - otherVector._z);\r\n };\r\n /**\r\n * Subtracts the given vector from the current Vector3 and stores the result in the vector \"result\".\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.subtractToRef = function (otherVector, result) {\r\n return this.subtractFromFloatsToRef(otherVector._x, otherVector._y, otherVector._z, result);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the subtraction of the given floats from the current Vector3 coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the resulting Vector3\r\n */\r\n Vector3.prototype.subtractFromFloats = function (x, y, z) {\r\n return new Vector3(this._x - x, this._y - y, this._z - z);\r\n };\r\n /**\r\n * Subtracts the given floats from the current Vector3 coordinates and set the given vector \"result\" with this result\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.subtractFromFloatsToRef = function (x, y, z, result) {\r\n return result.copyFromFloats(this._x - x, this._y - y, this._z - z);\r\n };\r\n /**\r\n * Gets a new Vector3 set with the current Vector3 negated coordinates\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.negate = function () {\r\n return new Vector3(-this._x, -this._y, -this._z);\r\n };\r\n /**\r\n * Negate this vector in place\r\n * @returns this\r\n */\r\n Vector3.prototype.negateInPlace = function () {\r\n this.x *= -1;\r\n this.y *= -1;\r\n this.z *= -1;\r\n return this;\r\n };\r\n /**\r\n * Negate the current Vector3 and stores the result in the given vector \"result\" coordinates\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.negateToRef = function (result) {\r\n return result.copyFromFloats(this._x * -1, this._y * -1, this._z * -1);\r\n };\r\n /**\r\n * Multiplies the Vector3 coordinates by the float \"scale\"\r\n * @param scale defines the multiplier factor\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.scaleInPlace = function (scale) {\r\n this.x *= scale;\r\n this.y *= scale;\r\n this.z *= scale;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float \"scale\"\r\n * @param scale defines the multiplier factor\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.scale = function (scale) {\r\n return new Vector3(this._x * scale, this._y * scale, this._z * scale);\r\n };\r\n /**\r\n * Multiplies the current Vector3 coordinates by the float \"scale\" and stores the result in the given vector \"result\" coordinates\r\n * @param scale defines the multiplier factor\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.scaleToRef = function (scale, result) {\r\n return result.copyFromFloats(this._x * scale, this._y * scale, this._z * scale);\r\n };\r\n /**\r\n * Scale the current Vector3 values by a factor and add the result to a given Vector3\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the unmodified current Vector3\r\n */\r\n Vector3.prototype.scaleAndAddToRef = function (scale, result) {\r\n return result.addInPlaceFromFloats(this._x * scale, this._y * scale, this._z * scale);\r\n };\r\n /**\r\n * Projects the current vector3 to a plane along a ray starting from a specified origin and directed towards the point.\r\n * @param origin defines the origin of the projection ray\r\n * @param plane defines the plane to project to\r\n * @returns the projected vector3\r\n */\r\n Vector3.prototype.projectOnPlane = function (plane, origin) {\r\n var result = Vector3.Zero();\r\n this.projectOnPlaneToRef(plane, origin, result);\r\n return result;\r\n };\r\n /**\r\n * Projects the current vector3 to a plane along a ray starting from a specified origin and directed towards the point.\r\n * @param origin defines the origin of the projection ray\r\n * @param plane defines the plane to project to\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.prototype.projectOnPlaneToRef = function (plane, origin, result) {\r\n var n = plane.normal;\r\n var d = plane.d;\r\n var V = MathTmp.Vector3[0];\r\n // ray direction\r\n this.subtractToRef(origin, V);\r\n V.normalize();\r\n var denom = Vector3.Dot(V, n);\r\n var t = -(Vector3.Dot(origin, n) + d) / denom;\r\n // P = P0 + t*V\r\n var scaledV = V.scaleInPlace(t);\r\n origin.addToRef(scaledV, result);\r\n };\r\n /**\r\n * Returns true if the current Vector3 and the given vector coordinates are strictly equal\r\n * @param otherVector defines the second operand\r\n * @returns true if both vectors are equals\r\n */\r\n Vector3.prototype.equals = function (otherVector) {\r\n return otherVector && this._x === otherVector._x && this._y === otherVector._y && this._z === otherVector._z;\r\n };\r\n /**\r\n * Returns true if the current Vector3 and the given vector coordinates are distant less than epsilon\r\n * @param otherVector defines the second operand\r\n * @param epsilon defines the minimal distance to define values as equals\r\n * @returns true if both vectors are distant less than epsilon\r\n */\r\n Vector3.prototype.equalsWithEpsilon = function (otherVector, epsilon) {\r\n if (epsilon === void 0) { epsilon = Epsilon; }\r\n return otherVector && Scalar.WithinEpsilon(this._x, otherVector._x, epsilon) && Scalar.WithinEpsilon(this._y, otherVector._y, epsilon) && Scalar.WithinEpsilon(this._z, otherVector._z, epsilon);\r\n };\r\n /**\r\n * Returns true if the current Vector3 coordinates equals the given floats\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns true if both vectors are equals\r\n */\r\n Vector3.prototype.equalsToFloats = function (x, y, z) {\r\n return this._x === x && this._y === y && this._z === z;\r\n };\r\n /**\r\n * Multiplies the current Vector3 coordinates by the given ones\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.multiplyInPlace = function (otherVector) {\r\n this.x *= otherVector._x;\r\n this.y *= otherVector._y;\r\n this.z *= otherVector._z;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3, result of the multiplication of the current Vector3 by the given vector\r\n * @param otherVector defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.multiply = function (otherVector) {\r\n return this.multiplyByFloats(otherVector._x, otherVector._y, otherVector._z);\r\n };\r\n /**\r\n * Multiplies the current Vector3 by the given one and stores the result in the given vector \"result\"\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.multiplyToRef = function (otherVector, result) {\r\n return result.copyFromFloats(this._x * otherVector._x, this._y * otherVector._y, this._z * otherVector._z);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the mulliplication of the current Vector3 coordinates by the given floats\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.multiplyByFloats = function (x, y, z) {\r\n return new Vector3(this._x * x, this._y * y, this._z * z);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the division of the current Vector3 coordinates by the given ones\r\n * @param otherVector defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.divide = function (otherVector) {\r\n return new Vector3(this._x / otherVector._x, this._y / otherVector._y, this._z / otherVector._z);\r\n };\r\n /**\r\n * Divides the current Vector3 coordinates by the given ones and stores the result in the given vector \"result\"\r\n * @param otherVector defines the second operand\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector3\r\n */\r\n Vector3.prototype.divideToRef = function (otherVector, result) {\r\n return result.copyFromFloats(this._x / otherVector._x, this._y / otherVector._y, this._z / otherVector._z);\r\n };\r\n /**\r\n * Divides the current Vector3 coordinates by the given ones.\r\n * @param otherVector defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.divideInPlace = function (otherVector) {\r\n return this.divideToRef(otherVector, this);\r\n };\r\n /**\r\n * Updates the current Vector3 with the minimal coordinate values between its and the given vector ones\r\n * @param other defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.minimizeInPlace = function (other) {\r\n return this.minimizeInPlaceFromFloats(other._x, other._y, other._z);\r\n };\r\n /**\r\n * Updates the current Vector3 with the maximal coordinate values between its and the given vector ones.\r\n * @param other defines the second operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.maximizeInPlace = function (other) {\r\n return this.maximizeInPlaceFromFloats(other._x, other._y, other._z);\r\n };\r\n /**\r\n * Updates the current Vector3 with the minimal coordinate values between its and the given coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.minimizeInPlaceFromFloats = function (x, y, z) {\r\n if (x < this._x) {\r\n this.x = x;\r\n }\r\n if (y < this._y) {\r\n this.y = y;\r\n }\r\n if (z < this._z) {\r\n this.z = z;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the current Vector3 with the maximal coordinate values between its and the given coordinates.\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.maximizeInPlaceFromFloats = function (x, y, z) {\r\n if (x > this._x) {\r\n this.x = x;\r\n }\r\n if (y > this._y) {\r\n this.y = y;\r\n }\r\n if (z > this._z) {\r\n this.z = z;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Due to float precision, scale of a mesh could be uniform but float values are off by a small fraction\r\n * Check if is non uniform within a certain amount of decimal places to account for this\r\n * @param epsilon the amount the values can differ\r\n * @returns if the the vector is non uniform to a certain number of decimal places\r\n */\r\n Vector3.prototype.isNonUniformWithinEpsilon = function (epsilon) {\r\n var absX = Math.abs(this._x);\r\n var absY = Math.abs(this._y);\r\n if (!Scalar.WithinEpsilon(absX, absY, epsilon)) {\r\n return true;\r\n }\r\n var absZ = Math.abs(this._z);\r\n if (!Scalar.WithinEpsilon(absX, absZ, epsilon)) {\r\n return true;\r\n }\r\n if (!Scalar.WithinEpsilon(absY, absZ, epsilon)) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n Object.defineProperty(Vector3.prototype, \"isNonUniform\", {\r\n /**\r\n * Gets a boolean indicating that the vector is non uniform meaning x, y or z are not all the same\r\n */\r\n get: function () {\r\n var absX = Math.abs(this._x);\r\n var absY = Math.abs(this._y);\r\n if (absX !== absY) {\r\n return true;\r\n }\r\n var absZ = Math.abs(this._z);\r\n if (absX !== absZ) {\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a new Vector3 from current Vector3 floored values\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.floor = function () {\r\n return new Vector3(Math.floor(this._x), Math.floor(this._y), Math.floor(this._z));\r\n };\r\n /**\r\n * Gets a new Vector3 from current Vector3 floored values\r\n * @returns a new Vector3\r\n */\r\n Vector3.prototype.fract = function () {\r\n return new Vector3(this._x - Math.floor(this._x), this._y - Math.floor(this._y), this._z - Math.floor(this._z));\r\n };\r\n // Properties\r\n /**\r\n * Gets the length of the Vector3\r\n * @returns the length of the Vector3\r\n */\r\n Vector3.prototype.length = function () {\r\n return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z);\r\n };\r\n /**\r\n * Gets the squared length of the Vector3\r\n * @returns squared length of the Vector3\r\n */\r\n Vector3.prototype.lengthSquared = function () {\r\n return (this._x * this._x + this._y * this._y + this._z * this._z);\r\n };\r\n /**\r\n * Normalize the current Vector3.\r\n * Please note that this is an in place operation.\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.normalize = function () {\r\n return this.normalizeFromLength(this.length());\r\n };\r\n /**\r\n * Reorders the x y z properties of the vector in place\r\n * @param order new ordering of the properties (eg. for vector 1,2,3 with \"ZYX\" will produce 3,2,1)\r\n * @returns the current updated vector\r\n */\r\n Vector3.prototype.reorderInPlace = function (order) {\r\n var _this = this;\r\n order = order.toLowerCase();\r\n if (order === \"xyz\") {\r\n return this;\r\n }\r\n MathTmp.Vector3[0].copyFrom(this);\r\n [\"x\", \"y\", \"z\"].forEach(function (val, i) {\r\n _this[val] = MathTmp.Vector3[0][order[i]];\r\n });\r\n return this;\r\n };\r\n /**\r\n * Rotates the vector around 0,0,0 by a quaternion\r\n * @param quaternion the rotation quaternion\r\n * @param result vector to store the result\r\n * @returns the resulting vector\r\n */\r\n Vector3.prototype.rotateByQuaternionToRef = function (quaternion, result) {\r\n quaternion.toRotationMatrix(MathTmp.Matrix[0]);\r\n Vector3.TransformCoordinatesToRef(this, MathTmp.Matrix[0], result);\r\n return result;\r\n };\r\n /**\r\n * Rotates a vector around a given point\r\n * @param quaternion the rotation quaternion\r\n * @param point the point to rotate around\r\n * @param result vector to store the result\r\n * @returns the resulting vector\r\n */\r\n Vector3.prototype.rotateByQuaternionAroundPointToRef = function (quaternion, point, result) {\r\n this.subtractToRef(point, MathTmp.Vector3[0]);\r\n MathTmp.Vector3[0].rotateByQuaternionToRef(quaternion, MathTmp.Vector3[0]);\r\n point.addToRef(MathTmp.Vector3[0], result);\r\n return result;\r\n };\r\n /**\r\n * Returns a new Vector3 as the cross product of the current vector and the \"other\" one\r\n * The cross product is then orthogonal to both current and \"other\"\r\n * @param other defines the right operand\r\n * @returns the cross product\r\n */\r\n Vector3.prototype.cross = function (other) {\r\n return Vector3.Cross(this, other);\r\n };\r\n /**\r\n * Normalize the current Vector3 with the given input length.\r\n * Please note that this is an in place operation.\r\n * @param len the length of the vector\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.normalizeFromLength = function (len) {\r\n if (len === 0 || len === 1.0) {\r\n return this;\r\n }\r\n return this.scaleInPlace(1.0 / len);\r\n };\r\n /**\r\n * Normalize the current Vector3 to a new vector\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.normalizeToNew = function () {\r\n var normalized = new Vector3(0, 0, 0);\r\n this.normalizeToRef(normalized);\r\n return normalized;\r\n };\r\n /**\r\n * Normalize the current Vector3 to the reference\r\n * @param reference define the Vector3 to update\r\n * @returns the updated Vector3\r\n */\r\n Vector3.prototype.normalizeToRef = function (reference) {\r\n var len = this.length();\r\n if (len === 0 || len === 1.0) {\r\n return reference.copyFromFloats(this._x, this._y, this._z);\r\n }\r\n return this.scaleToRef(1.0 / len, reference);\r\n };\r\n /**\r\n * Creates a new Vector3 copied from the current Vector3\r\n * @returns the new Vector3\r\n */\r\n Vector3.prototype.clone = function () {\r\n return new Vector3(this._x, this._y, this._z);\r\n };\r\n /**\r\n * Copies the given vector coordinates to the current Vector3 ones\r\n * @param source defines the source Vector3\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.copyFrom = function (source) {\r\n return this.copyFromFloats(source._x, source._y, source._z);\r\n };\r\n /**\r\n * Copies the given floats to the current Vector3 coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.copyFromFloats = function (x, y, z) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n return this;\r\n };\r\n /**\r\n * Copies the given floats to the current Vector3 coordinates\r\n * @param x defines the x coordinate of the operand\r\n * @param y defines the y coordinate of the operand\r\n * @param z defines the z coordinate of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.set = function (x, y, z) {\r\n return this.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Copies the given float to the current Vector3 coordinates\r\n * @param v defines the x, y and z coordinates of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector3.prototype.setAll = function (v) {\r\n this.x = this.y = this.z = v;\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Get the clip factor between two vectors\r\n * @param vector0 defines the first operand\r\n * @param vector1 defines the second operand\r\n * @param axis defines the axis to use\r\n * @param size defines the size along the axis\r\n * @returns the clip factor\r\n */\r\n Vector3.GetClipFactor = function (vector0, vector1, axis, size) {\r\n var d0 = Vector3.Dot(vector0, axis) - size;\r\n var d1 = Vector3.Dot(vector1, axis) - size;\r\n var s = d0 / (d0 - d1);\r\n return s;\r\n };\r\n /**\r\n * Get angle between two vectors\r\n * @param vector0 angle between vector0 and vector1\r\n * @param vector1 angle between vector0 and vector1\r\n * @param normal direction of the normal\r\n * @return the angle between vector0 and vector1\r\n */\r\n Vector3.GetAngleBetweenVectors = function (vector0, vector1, normal) {\r\n var v0 = vector0.normalizeToRef(MathTmp.Vector3[1]);\r\n var v1 = vector1.normalizeToRef(MathTmp.Vector3[2]);\r\n var dot = Vector3.Dot(v0, v1);\r\n var n = MathTmp.Vector3[3];\r\n Vector3.CrossToRef(v0, v1, n);\r\n if (Vector3.Dot(n, normal) > 0) {\r\n return Math.acos(dot);\r\n }\r\n return -Math.acos(dot);\r\n };\r\n /**\r\n * Returns a new Vector3 set from the index \"offset\" of the given array\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @returns the new Vector3\r\n */\r\n Vector3.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n return new Vector3(array[offset], array[offset + 1], array[offset + 2]);\r\n };\r\n /**\r\n * Returns a new Vector3 set from the index \"offset\" of the given Float32Array\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @returns the new Vector3\r\n * @deprecated Please use FromArray instead.\r\n */\r\n Vector3.FromFloatArray = function (array, offset) {\r\n return Vector3.FromArray(array, offset);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the element values from the index \"offset\" of the given array\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.FromArrayToRef = function (array, offset, result) {\r\n result.x = array[offset];\r\n result.y = array[offset + 1];\r\n result.z = array[offset + 2];\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the element values from the index \"offset\" of the given Float32Array\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @param result defines the Vector3 where to store the result\r\n * @deprecated Please use FromArrayToRef instead.\r\n */\r\n Vector3.FromFloatArrayToRef = function (array, offset, result) {\r\n return Vector3.FromArrayToRef(array, offset, result);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the given floats.\r\n * @param x defines the x coordinate of the source\r\n * @param y defines the y coordinate of the source\r\n * @param z defines the z coordinate of the source\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.FromFloatsToRef = function (x, y, z, result) {\r\n result.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 0.0, 0.0)\r\n * @returns a new empty Vector3\r\n */\r\n Vector3.Zero = function () {\r\n return new Vector3(0.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (1.0, 1.0, 1.0)\r\n * @returns a new unit Vector3\r\n */\r\n Vector3.One = function () {\r\n return new Vector3(1.0, 1.0, 1.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 1.0, 0.0)\r\n * @returns a new up Vector3\r\n */\r\n Vector3.Up = function () {\r\n return new Vector3(0.0, 1.0, 0.0);\r\n };\r\n Object.defineProperty(Vector3, \"UpReadOnly\", {\r\n /**\r\n * Gets a up Vector3 that must not be updated\r\n */\r\n get: function () {\r\n return Vector3._UpReadOnly;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Vector3, \"ZeroReadOnly\", {\r\n /**\r\n * Gets a zero Vector3 that must not be updated\r\n */\r\n get: function () {\r\n return Vector3._ZeroReadOnly;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a new Vector3 set to (0.0, -1.0, 0.0)\r\n * @returns a new down Vector3\r\n */\r\n Vector3.Down = function () {\r\n return new Vector3(0.0, -1.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 0.0, 1.0)\r\n * @param rightHandedSystem is the scene right-handed (negative z)\r\n * @returns a new forward Vector3\r\n */\r\n Vector3.Forward = function (rightHandedSystem) {\r\n if (rightHandedSystem === void 0) { rightHandedSystem = false; }\r\n return new Vector3(0.0, 0.0, (rightHandedSystem ? -1.0 : 1.0));\r\n };\r\n /**\r\n * Returns a new Vector3 set to (0.0, 0.0, -1.0)\r\n * @param rightHandedSystem is the scene right-handed (negative-z)\r\n * @returns a new forward Vector3\r\n */\r\n Vector3.Backward = function (rightHandedSystem) {\r\n if (rightHandedSystem === void 0) { rightHandedSystem = false; }\r\n return new Vector3(0.0, 0.0, (rightHandedSystem ? 1.0 : -1.0));\r\n };\r\n /**\r\n * Returns a new Vector3 set to (1.0, 0.0, 0.0)\r\n * @returns a new right Vector3\r\n */\r\n Vector3.Right = function () {\r\n return new Vector3(1.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set to (-1.0, 0.0, 0.0)\r\n * @returns a new left Vector3\r\n */\r\n Vector3.Left = function () {\r\n return new Vector3(-1.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the transformation by the given matrix of the given vector.\r\n * This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @returns the transformed Vector3\r\n */\r\n Vector3.TransformCoordinates = function (vector, transformation) {\r\n var result = Vector3.Zero();\r\n Vector3.TransformCoordinatesToRef(vector, transformation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" coordinates with the result of the transformation by the given matrix of the given vector\r\n * This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformCoordinatesToRef = function (vector, transformation, result) {\r\n Vector3.TransformCoordinatesFromFloatsToRef(vector._x, vector._y, vector._z, transformation, result);\r\n };\r\n /**\r\n * Sets the given vector \"result\" coordinates with the result of the transformation by the given matrix of the given floats (x, y, z)\r\n * This method computes tranformed coordinates only, not transformed direction vectors\r\n * @param x define the x coordinate of the source vector\r\n * @param y define the y coordinate of the source vector\r\n * @param z define the z coordinate of the source vector\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformCoordinatesFromFloatsToRef = function (x, y, z, transformation, result) {\r\n var m = transformation.m;\r\n var rx = x * m[0] + y * m[4] + z * m[8] + m[12];\r\n var ry = x * m[1] + y * m[5] + z * m[9] + m[13];\r\n var rz = x * m[2] + y * m[6] + z * m[10] + m[14];\r\n var rw = 1 / (x * m[3] + y * m[7] + z * m[11] + m[15]);\r\n result.x = rx * rw;\r\n result.y = ry * rw;\r\n result.z = rz * rw;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the result of the normal transformation by the given matrix of the given vector\r\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @returns the new Vector3\r\n */\r\n Vector3.TransformNormal = function (vector, transformation) {\r\n var result = Vector3.Zero();\r\n Vector3.TransformNormalToRef(vector, transformation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given vector\r\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\r\n * @param vector defines the Vector3 to transform\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformNormalToRef = function (vector, transformation, result) {\r\n this.TransformNormalFromFloatsToRef(vector._x, vector._y, vector._z, transformation, result);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given floats (x, y, z)\r\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\r\n * @param x define the x coordinate of the source vector\r\n * @param y define the y coordinate of the source vector\r\n * @param z define the z coordinate of the source vector\r\n * @param transformation defines the transformation matrix\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.TransformNormalFromFloatsToRef = function (x, y, z, transformation, result) {\r\n var m = transformation.m;\r\n result.x = x * m[0] + y * m[4] + z * m[8];\r\n result.y = x * m[1] + y * m[5] + z * m[9];\r\n result.z = x * m[2] + y * m[6] + z * m[10];\r\n };\r\n /**\r\n * Returns a new Vector3 located for \"amount\" on the CatmullRom interpolation spline defined by the vectors \"value1\", \"value2\", \"value3\", \"value4\"\r\n * @param value1 defines the first control point\r\n * @param value2 defines the second control point\r\n * @param value3 defines the third control point\r\n * @param value4 defines the fourth control point\r\n * @param amount defines the amount on the spline to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.CatmullRom = function (value1, value2, value3, value4, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var x = 0.5 * ((((2.0 * value2._x) + ((-value1._x + value3._x) * amount)) +\r\n (((((2.0 * value1._x) - (5.0 * value2._x)) + (4.0 * value3._x)) - value4._x) * squared)) +\r\n ((((-value1._x + (3.0 * value2._x)) - (3.0 * value3._x)) + value4._x) * cubed));\r\n var y = 0.5 * ((((2.0 * value2._y) + ((-value1._y + value3._y) * amount)) +\r\n (((((2.0 * value1._y) - (5.0 * value2._y)) + (4.0 * value3._y)) - value4._y) * squared)) +\r\n ((((-value1._y + (3.0 * value2._y)) - (3.0 * value3._y)) + value4._y) * cubed));\r\n var z = 0.5 * ((((2.0 * value2._z) + ((-value1._z + value3._z) * amount)) +\r\n (((((2.0 * value1._z) - (5.0 * value2._z)) + (4.0 * value3._z)) - value4._z) * squared)) +\r\n ((((-value1._z + (3.0 * value2._z)) - (3.0 * value3._z)) + value4._z) * cubed));\r\n return new Vector3(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the coordinates of \"value\", if the vector \"value\" is in the cube defined by the vectors \"min\" and \"max\"\r\n * If a coordinate value of \"value\" is lower than one of the \"min\" coordinate, then this \"value\" coordinate is set with the \"min\" one\r\n * If a coordinate value of \"value\" is greater than one of the \"max\" coordinate, then this \"value\" coordinate is set with the \"max\" one\r\n * @param value defines the current value\r\n * @param min defines the lower range value\r\n * @param max defines the upper range value\r\n * @returns the new Vector3\r\n */\r\n Vector3.Clamp = function (value, min, max) {\r\n var v = new Vector3();\r\n Vector3.ClampToRef(value, min, max, v);\r\n return v;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the coordinates of \"value\", if the vector \"value\" is in the cube defined by the vectors \"min\" and \"max\"\r\n * If a coordinate value of \"value\" is lower than one of the \"min\" coordinate, then this \"value\" coordinate is set with the \"min\" one\r\n * If a coordinate value of \"value\" is greater than one of the \"max\" coordinate, then this \"value\" coordinate is set with the \"max\" one\r\n * @param value defines the current value\r\n * @param min defines the lower range value\r\n * @param max defines the upper range value\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.ClampToRef = function (value, min, max, result) {\r\n var x = value._x;\r\n x = (x > max._x) ? max._x : x;\r\n x = (x < min._x) ? min._x : x;\r\n var y = value._y;\r\n y = (y > max._y) ? max._y : y;\r\n y = (y < min._y) ? min._y : y;\r\n var z = value._z;\r\n z = (z > max._z) ? max._z : z;\r\n z = (z < min._z) ? min._z : z;\r\n result.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Checks if a given vector is inside a specific range\r\n * @param v defines the vector to test\r\n * @param min defines the minimum range\r\n * @param max defines the maximum range\r\n */\r\n Vector3.CheckExtends = function (v, min, max) {\r\n min.minimizeInPlace(v);\r\n max.maximizeInPlace(v);\r\n };\r\n /**\r\n * Returns a new Vector3 located for \"amount\" (float) on the Hermite interpolation spline defined by the vectors \"value1\", \"tangent1\", \"value2\", \"tangent2\"\r\n * @param value1 defines the first control point\r\n * @param tangent1 defines the first tangent vector\r\n * @param value2 defines the second control point\r\n * @param tangent2 defines the second tangent vector\r\n * @param amount defines the amount on the interpolation spline (between 0 and 1)\r\n * @returns the new Vector3\r\n */\r\n Vector3.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n var x = (((value1._x * part1) + (value2._x * part2)) + (tangent1._x * part3)) + (tangent2._x * part4);\r\n var y = (((value1._y * part1) + (value2._y * part2)) + (tangent1._y * part3)) + (tangent2._y * part4);\r\n var z = (((value1._z * part1) + (value2._z * part2)) + (tangent1._z * part3)) + (tangent2._z * part4);\r\n return new Vector3(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 located for \"amount\" (float) on the linear interpolation between the vectors \"start\" and \"end\"\r\n * @param start defines the start value\r\n * @param end defines the end value\r\n * @param amount max defines amount between both (between 0 and 1)\r\n * @returns the new Vector3\r\n */\r\n Vector3.Lerp = function (start, end, amount) {\r\n var result = new Vector3(0, 0, 0);\r\n Vector3.LerpToRef(start, end, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the linear interpolation from the vector \"start\" for \"amount\" to the vector \"end\"\r\n * @param start defines the start value\r\n * @param end defines the end value\r\n * @param amount max defines amount between both (between 0 and 1)\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.LerpToRef = function (start, end, amount, result) {\r\n result.x = start._x + ((end._x - start._x) * amount);\r\n result.y = start._y + ((end._y - start._y) * amount);\r\n result.z = start._z + ((end._z - start._z) * amount);\r\n };\r\n /**\r\n * Returns the dot product (float) between the vectors \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @returns the dot product\r\n */\r\n Vector3.Dot = function (left, right) {\r\n return (left._x * right._x + left._y * right._y + left._z * right._z);\r\n };\r\n /**\r\n * Returns a new Vector3 as the cross product of the vectors \"left\" and \"right\"\r\n * The cross product is then orthogonal to both \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @returns the cross product\r\n */\r\n Vector3.Cross = function (left, right) {\r\n var result = Vector3.Zero();\r\n Vector3.CrossToRef(left, right, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the cross product of \"left\" and \"right\"\r\n * The cross product is then orthogonal to both \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.CrossToRef = function (left, right, result) {\r\n var x = left._y * right._z - left._z * right._y;\r\n var y = left._z * right._x - left._x * right._z;\r\n var z = left._x * right._y - left._y * right._x;\r\n result.copyFromFloats(x, y, z);\r\n };\r\n /**\r\n * Returns a new Vector3 as the normalization of the given vector\r\n * @param vector defines the Vector3 to normalize\r\n * @returns the new Vector3\r\n */\r\n Vector3.Normalize = function (vector) {\r\n var result = Vector3.Zero();\r\n Vector3.NormalizeToRef(vector, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the normalization of the given first vector\r\n * @param vector defines the Vector3 to normalize\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.NormalizeToRef = function (vector, result) {\r\n vector.normalizeToRef(result);\r\n };\r\n /**\r\n * Project a Vector3 onto screen space\r\n * @param vector defines the Vector3 to project\r\n * @param world defines the world matrix to use\r\n * @param transform defines the transform (view x projection) matrix to use\r\n * @param viewport defines the screen viewport to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.Project = function (vector, world, transform, viewport) {\r\n var result = new Vector3();\r\n Vector3.ProjectToRef(vector, world, transform, viewport, result);\r\n return result;\r\n };\r\n /**\r\n * Project a Vector3 onto screen space to reference\r\n * @param vector defines the Vector3 to project\r\n * @param world defines the world matrix to use\r\n * @param transform defines the transform (view x projection) matrix to use\r\n * @param viewport defines the screen viewport to use\r\n * @param result the vector in which the screen space will be stored\r\n * @returns the new Vector3\r\n */\r\n Vector3.ProjectToRef = function (vector, world, transform, viewport, result) {\r\n var cw = viewport.width;\r\n var ch = viewport.height;\r\n var cx = viewport.x;\r\n var cy = viewport.y;\r\n var viewportMatrix = MathTmp.Matrix[1];\r\n Matrix.FromValuesToRef(cw / 2.0, 0, 0, 0, 0, -ch / 2.0, 0, 0, 0, 0, 0.5, 0, cx + cw / 2.0, ch / 2.0 + cy, 0.5, 1, viewportMatrix);\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(transform, matrix);\r\n matrix.multiplyToRef(viewportMatrix, matrix);\r\n Vector3.TransformCoordinatesToRef(vector, matrix, result);\r\n return result;\r\n };\r\n /** @hidden */\r\n Vector3._UnprojectFromInvertedMatrixToRef = function (source, matrix, result) {\r\n Vector3.TransformCoordinatesToRef(source, matrix, result);\r\n var m = matrix.m;\r\n var num = source._x * m[3] + source._y * m[7] + source._z * m[11] + m[15];\r\n if (Scalar.WithinEpsilon(num, 1.0)) {\r\n result.scaleInPlace(1.0 / num);\r\n }\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param source defines the screen space Vector3 to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param transform defines the transform (view x projection) matrix to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.UnprojectFromTransform = function (source, viewportWidth, viewportHeight, world, transform) {\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(transform, matrix);\r\n matrix.invert();\r\n source.x = source._x / viewportWidth * 2 - 1;\r\n source.y = -(source._y / viewportHeight * 2 - 1);\r\n var vector = new Vector3();\r\n Vector3._UnprojectFromInvertedMatrixToRef(source, matrix, vector);\r\n return vector;\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param source defines the screen space Vector3 to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n * @returns the new Vector3\r\n */\r\n Vector3.Unproject = function (source, viewportWidth, viewportHeight, world, view, projection) {\r\n var result = Vector3.Zero();\r\n Vector3.UnprojectToRef(source, viewportWidth, viewportHeight, world, view, projection, result);\r\n return result;\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param source defines the screen space Vector3 to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.UnprojectToRef = function (source, viewportWidth, viewportHeight, world, view, projection, result) {\r\n Vector3.UnprojectFloatsToRef(source._x, source._y, source._z, viewportWidth, viewportHeight, world, view, projection, result);\r\n };\r\n /**\r\n * Unproject from screen space to object space\r\n * @param sourceX defines the screen space x coordinate to use\r\n * @param sourceY defines the screen space y coordinate to use\r\n * @param sourceZ defines the screen space z coordinate to use\r\n * @param viewportWidth defines the current width of the viewport\r\n * @param viewportHeight defines the current height of the viewport\r\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\r\n * @param view defines the view matrix to use\r\n * @param projection defines the projection matrix to use\r\n * @param result defines the Vector3 where to store the result\r\n */\r\n Vector3.UnprojectFloatsToRef = function (sourceX, sourceY, sourceZ, viewportWidth, viewportHeight, world, view, projection, result) {\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(view, matrix);\r\n matrix.multiplyToRef(projection, matrix);\r\n matrix.invert();\r\n var screenSource = MathTmp.Vector3[0];\r\n screenSource.x = sourceX / viewportWidth * 2 - 1;\r\n screenSource.y = -(sourceY / viewportHeight * 2 - 1);\r\n screenSource.z = 2 * sourceZ - 1.0;\r\n Vector3._UnprojectFromInvertedMatrixToRef(screenSource, matrix, result);\r\n };\r\n /**\r\n * Gets the minimal coordinate values between two Vector3\r\n * @param left defines the first operand\r\n * @param right defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.Minimize = function (left, right) {\r\n var min = left.clone();\r\n min.minimizeInPlace(right);\r\n return min;\r\n };\r\n /**\r\n * Gets the maximal coordinate values between two Vector3\r\n * @param left defines the first operand\r\n * @param right defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.Maximize = function (left, right) {\r\n var max = left.clone();\r\n max.maximizeInPlace(right);\r\n return max;\r\n };\r\n /**\r\n * Returns the distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines the first operand\r\n * @param value2 defines the second operand\r\n * @returns the distance\r\n */\r\n Vector3.Distance = function (value1, value2) {\r\n return Math.sqrt(Vector3.DistanceSquared(value1, value2));\r\n };\r\n /**\r\n * Returns the squared distance between the vectors \"value1\" and \"value2\"\r\n * @param value1 defines the first operand\r\n * @param value2 defines the second operand\r\n * @returns the squared distance\r\n */\r\n Vector3.DistanceSquared = function (value1, value2) {\r\n var x = value1._x - value2._x;\r\n var y = value1._y - value2._y;\r\n var z = value1._z - value2._z;\r\n return (x * x) + (y * y) + (z * z);\r\n };\r\n /**\r\n * Returns a new Vector3 located at the center between \"value1\" and \"value2\"\r\n * @param value1 defines the first operand\r\n * @param value2 defines the second operand\r\n * @returns the new Vector3\r\n */\r\n Vector3.Center = function (value1, value2) {\r\n var center = value1.add(value2);\r\n center.scaleInPlace(0.5);\r\n return center;\r\n };\r\n /**\r\n * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),\r\n * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply\r\n * to something in order to rotate it from its local system to the given target system\r\n * Note: axis1, axis2 and axis3 are normalized during this operation\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @returns a new Vector3\r\n */\r\n Vector3.RotationFromAxis = function (axis1, axis2, axis3) {\r\n var rotation = Vector3.Zero();\r\n Vector3.RotationFromAxisToRef(axis1, axis2, axis3, rotation);\r\n return rotation;\r\n };\r\n /**\r\n * The same than RotationFromAxis but updates the given ref Vector3 parameter instead of returning a new Vector3\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @param ref defines the Vector3 where to store the result\r\n */\r\n Vector3.RotationFromAxisToRef = function (axis1, axis2, axis3, ref) {\r\n var quat = MathTmp.Quaternion[0];\r\n Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, quat);\r\n quat.toEulerAnglesToRef(ref);\r\n };\r\n Vector3._UpReadOnly = Vector3.Up();\r\n Vector3._ZeroReadOnly = Vector3.Zero();\r\n return Vector3;\r\n}());\r\nexport { Vector3 };\r\n/**\r\n * Vector4 class created for EulerAngle class conversion to Quaternion\r\n */\r\nvar Vector4 = /** @class */ (function () {\r\n /**\r\n * Creates a Vector4 object from the given floats.\r\n * @param x x value of the vector\r\n * @param y y value of the vector\r\n * @param z z value of the vector\r\n * @param w w value of the vector\r\n */\r\n function Vector4(\r\n /** x value of the vector */\r\n x, \r\n /** y value of the vector */\r\n y, \r\n /** z value of the vector */\r\n z, \r\n /** w value of the vector */\r\n w) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n this.w = w;\r\n }\r\n /**\r\n * Returns the string with the Vector4 coordinates.\r\n * @returns a string containing all the vector values\r\n */\r\n Vector4.prototype.toString = function () {\r\n return \"{X: \" + this.x + \" Y:\" + this.y + \" Z:\" + this.z + \" W:\" + this.w + \"}\";\r\n };\r\n /**\r\n * Returns the string \"Vector4\".\r\n * @returns \"Vector4\"\r\n */\r\n Vector4.prototype.getClassName = function () {\r\n return \"Vector4\";\r\n };\r\n /**\r\n * Returns the Vector4 hash code.\r\n * @returns a unique hash code\r\n */\r\n Vector4.prototype.getHashCode = function () {\r\n var hash = this.x | 0;\r\n hash = (hash * 397) ^ (this.y | 0);\r\n hash = (hash * 397) ^ (this.z | 0);\r\n hash = (hash * 397) ^ (this.w | 0);\r\n return hash;\r\n };\r\n // Operators\r\n /**\r\n * Returns a new array populated with 4 elements : the Vector4 coordinates.\r\n * @returns the resulting array\r\n */\r\n Vector4.prototype.asArray = function () {\r\n var result = new Array();\r\n this.toArray(result, 0);\r\n return result;\r\n };\r\n /**\r\n * Populates the given array from the given index with the Vector4 coordinates.\r\n * @param array array to populate\r\n * @param index index of the array to start at (default: 0)\r\n * @returns the Vector4.\r\n */\r\n Vector4.prototype.toArray = function (array, index) {\r\n if (index === undefined) {\r\n index = 0;\r\n }\r\n array[index] = this.x;\r\n array[index + 1] = this.y;\r\n array[index + 2] = this.z;\r\n array[index + 3] = this.w;\r\n return this;\r\n };\r\n /**\r\n * Update the current vector from an array\r\n * @param array defines the destination array\r\n * @param index defines the offset in the destination array\r\n * @returns the current Vector3\r\n */\r\n Vector4.prototype.fromArray = function (array, index) {\r\n if (index === void 0) { index = 0; }\r\n Vector4.FromArrayToRef(array, index, this);\r\n return this;\r\n };\r\n /**\r\n * Adds the given vector to the current Vector4.\r\n * @param otherVector the vector to add\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.addInPlace = function (otherVector) {\r\n this.x += otherVector.x;\r\n this.y += otherVector.y;\r\n this.z += otherVector.z;\r\n this.w += otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 as the result of the addition of the current Vector4 and the given one.\r\n * @param otherVector the vector to add\r\n * @returns the resulting vector\r\n */\r\n Vector4.prototype.add = function (otherVector) {\r\n return new Vector4(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z, this.w + otherVector.w);\r\n };\r\n /**\r\n * Updates the given vector \"result\" with the result of the addition of the current Vector4 and the given one.\r\n * @param otherVector the vector to add\r\n * @param result the vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.addToRef = function (otherVector, result) {\r\n result.x = this.x + otherVector.x;\r\n result.y = this.y + otherVector.y;\r\n result.z = this.z + otherVector.z;\r\n result.w = this.w + otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Subtract in place the given vector from the current Vector4.\r\n * @param otherVector the vector to subtract\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.subtractInPlace = function (otherVector) {\r\n this.x -= otherVector.x;\r\n this.y -= otherVector.y;\r\n this.z -= otherVector.z;\r\n this.w -= otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 with the result of the subtraction of the given vector from the current Vector4.\r\n * @param otherVector the vector to add\r\n * @returns the new vector with the result\r\n */\r\n Vector4.prototype.subtract = function (otherVector) {\r\n return new Vector4(this.x - otherVector.x, this.y - otherVector.y, this.z - otherVector.z, this.w - otherVector.w);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the subtraction of the given vector from the current Vector4.\r\n * @param otherVector the vector to subtract\r\n * @param result the vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.subtractToRef = function (otherVector, result) {\r\n result.x = this.x - otherVector.x;\r\n result.y = this.y - otherVector.y;\r\n result.z = this.z - otherVector.z;\r\n result.w = this.w - otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the result of the subtraction of the given floats from the current Vector4 coordinates.\r\n */\r\n /**\r\n * Returns a new Vector4 set with the result of the subtraction of the given floats from the current Vector4 coordinates.\r\n * @param x value to subtract\r\n * @param y value to subtract\r\n * @param z value to subtract\r\n * @param w value to subtract\r\n * @returns new vector containing the result\r\n */\r\n Vector4.prototype.subtractFromFloats = function (x, y, z, w) {\r\n return new Vector4(this.x - x, this.y - y, this.z - z, this.w - w);\r\n };\r\n /**\r\n * Sets the given vector \"result\" set with the result of the subtraction of the given floats from the current Vector4 coordinates.\r\n * @param x value to subtract\r\n * @param y value to subtract\r\n * @param z value to subtract\r\n * @param w value to subtract\r\n * @param result the vector to store the result in\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.subtractFromFloatsToRef = function (x, y, z, w, result) {\r\n result.x = this.x - x;\r\n result.y = this.y - y;\r\n result.z = this.z - z;\r\n result.w = this.w - w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the current Vector4 negated coordinates.\r\n * @returns a new vector with the negated values\r\n */\r\n Vector4.prototype.negate = function () {\r\n return new Vector4(-this.x, -this.y, -this.z, -this.w);\r\n };\r\n /**\r\n * Negate this vector in place\r\n * @returns this\r\n */\r\n Vector4.prototype.negateInPlace = function () {\r\n this.x *= -1;\r\n this.y *= -1;\r\n this.z *= -1;\r\n this.w *= -1;\r\n return this;\r\n };\r\n /**\r\n * Negate the current Vector4 and stores the result in the given vector \"result\" coordinates\r\n * @param result defines the Vector3 object where to store the result\r\n * @returns the current Vector4\r\n */\r\n Vector4.prototype.negateToRef = function (result) {\r\n return result.copyFromFloats(this.x * -1, this.y * -1, this.z * -1, this.w * -1);\r\n };\r\n /**\r\n * Multiplies the current Vector4 coordinates by scale (float).\r\n * @param scale the number to scale with\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.scaleInPlace = function (scale) {\r\n this.x *= scale;\r\n this.y *= scale;\r\n this.z *= scale;\r\n this.w *= scale;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the current Vector4 coordinates multiplied by scale (float).\r\n * @param scale the number to scale with\r\n * @returns a new vector with the result\r\n */\r\n Vector4.prototype.scale = function (scale) {\r\n return new Vector4(this.x * scale, this.y * scale, this.z * scale, this.w * scale);\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the current Vector4 coordinates multiplied by scale (float).\r\n * @param scale the number to scale with\r\n * @param result a vector to store the result in\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.scaleToRef = function (scale, result) {\r\n result.x = this.x * scale;\r\n result.y = this.y * scale;\r\n result.z = this.z * scale;\r\n result.w = this.w * scale;\r\n return this;\r\n };\r\n /**\r\n * Scale the current Vector4 values by a factor and add the result to a given Vector4\r\n * @param scale defines the scale factor\r\n * @param result defines the Vector4 object where to store the result\r\n * @returns the unmodified current Vector4\r\n */\r\n Vector4.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.x += this.x * scale;\r\n result.y += this.y * scale;\r\n result.z += this.z * scale;\r\n result.w += this.w * scale;\r\n return this;\r\n };\r\n /**\r\n * Boolean : True if the current Vector4 coordinates are stricly equal to the given ones.\r\n * @param otherVector the vector to compare against\r\n * @returns true if they are equal\r\n */\r\n Vector4.prototype.equals = function (otherVector) {\r\n return otherVector && this.x === otherVector.x && this.y === otherVector.y && this.z === otherVector.z && this.w === otherVector.w;\r\n };\r\n /**\r\n * Boolean : True if the current Vector4 coordinates are each beneath the distance \"epsilon\" from the given vector ones.\r\n * @param otherVector vector to compare against\r\n * @param epsilon (Default: very small number)\r\n * @returns true if they are equal\r\n */\r\n Vector4.prototype.equalsWithEpsilon = function (otherVector, epsilon) {\r\n if (epsilon === void 0) { epsilon = Epsilon; }\r\n return otherVector\r\n && Scalar.WithinEpsilon(this.x, otherVector.x, epsilon)\r\n && Scalar.WithinEpsilon(this.y, otherVector.y, epsilon)\r\n && Scalar.WithinEpsilon(this.z, otherVector.z, epsilon)\r\n && Scalar.WithinEpsilon(this.w, otherVector.w, epsilon);\r\n };\r\n /**\r\n * Boolean : True if the given floats are strictly equal to the current Vector4 coordinates.\r\n * @param x x value to compare against\r\n * @param y y value to compare against\r\n * @param z z value to compare against\r\n * @param w w value to compare against\r\n * @returns true if equal\r\n */\r\n Vector4.prototype.equalsToFloats = function (x, y, z, w) {\r\n return this.x === x && this.y === y && this.z === z && this.w === w;\r\n };\r\n /**\r\n * Multiplies in place the current Vector4 by the given one.\r\n * @param otherVector vector to multiple with\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.multiplyInPlace = function (otherVector) {\r\n this.x *= otherVector.x;\r\n this.y *= otherVector.y;\r\n this.z *= otherVector.z;\r\n this.w *= otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the multiplication result of the current Vector4 and the given one.\r\n * @param otherVector vector to multiple with\r\n * @returns resulting new vector\r\n */\r\n Vector4.prototype.multiply = function (otherVector) {\r\n return new Vector4(this.x * otherVector.x, this.y * otherVector.y, this.z * otherVector.z, this.w * otherVector.w);\r\n };\r\n /**\r\n * Updates the given vector \"result\" with the multiplication result of the current Vector4 and the given one.\r\n * @param otherVector vector to multiple with\r\n * @param result vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.multiplyToRef = function (otherVector, result) {\r\n result.x = this.x * otherVector.x;\r\n result.y = this.y * otherVector.y;\r\n result.z = this.z * otherVector.z;\r\n result.w = this.w * otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the multiplication result of the given floats and the current Vector4 coordinates.\r\n * @param x x value multiply with\r\n * @param y y value multiply with\r\n * @param z z value multiply with\r\n * @param w w value multiply with\r\n * @returns resulting new vector\r\n */\r\n Vector4.prototype.multiplyByFloats = function (x, y, z, w) {\r\n return new Vector4(this.x * x, this.y * y, this.z * z, this.w * w);\r\n };\r\n /**\r\n * Returns a new Vector4 set with the division result of the current Vector4 by the given one.\r\n * @param otherVector vector to devide with\r\n * @returns resulting new vector\r\n */\r\n Vector4.prototype.divide = function (otherVector) {\r\n return new Vector4(this.x / otherVector.x, this.y / otherVector.y, this.z / otherVector.z, this.w / otherVector.w);\r\n };\r\n /**\r\n * Updates the given vector \"result\" with the division result of the current Vector4 by the given one.\r\n * @param otherVector vector to devide with\r\n * @param result vector to store the result\r\n * @returns the current Vector4.\r\n */\r\n Vector4.prototype.divideToRef = function (otherVector, result) {\r\n result.x = this.x / otherVector.x;\r\n result.y = this.y / otherVector.y;\r\n result.z = this.z / otherVector.z;\r\n result.w = this.w / otherVector.w;\r\n return this;\r\n };\r\n /**\r\n * Divides the current Vector3 coordinates by the given ones.\r\n * @param otherVector vector to devide with\r\n * @returns the updated Vector3.\r\n */\r\n Vector4.prototype.divideInPlace = function (otherVector) {\r\n return this.divideToRef(otherVector, this);\r\n };\r\n /**\r\n * Updates the Vector4 coordinates with the minimum values between its own and the given vector ones\r\n * @param other defines the second operand\r\n * @returns the current updated Vector4\r\n */\r\n Vector4.prototype.minimizeInPlace = function (other) {\r\n if (other.x < this.x) {\r\n this.x = other.x;\r\n }\r\n if (other.y < this.y) {\r\n this.y = other.y;\r\n }\r\n if (other.z < this.z) {\r\n this.z = other.z;\r\n }\r\n if (other.w < this.w) {\r\n this.w = other.w;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the Vector4 coordinates with the maximum values between its own and the given vector ones\r\n * @param other defines the second operand\r\n * @returns the current updated Vector4\r\n */\r\n Vector4.prototype.maximizeInPlace = function (other) {\r\n if (other.x > this.x) {\r\n this.x = other.x;\r\n }\r\n if (other.y > this.y) {\r\n this.y = other.y;\r\n }\r\n if (other.z > this.z) {\r\n this.z = other.z;\r\n }\r\n if (other.w > this.w) {\r\n this.w = other.w;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Gets a new Vector4 from current Vector4 floored values\r\n * @returns a new Vector4\r\n */\r\n Vector4.prototype.floor = function () {\r\n return new Vector4(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z), Math.floor(this.w));\r\n };\r\n /**\r\n * Gets a new Vector4 from current Vector3 floored values\r\n * @returns a new Vector4\r\n */\r\n Vector4.prototype.fract = function () {\r\n return new Vector4(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z), this.w - Math.floor(this.w));\r\n };\r\n // Properties\r\n /**\r\n * Returns the Vector4 length (float).\r\n * @returns the length\r\n */\r\n Vector4.prototype.length = function () {\r\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\r\n };\r\n /**\r\n * Returns the Vector4 squared length (float).\r\n * @returns the length squared\r\n */\r\n Vector4.prototype.lengthSquared = function () {\r\n return (this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\r\n };\r\n // Methods\r\n /**\r\n * Normalizes in place the Vector4.\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.normalize = function () {\r\n var len = this.length();\r\n if (len === 0) {\r\n return this;\r\n }\r\n return this.scaleInPlace(1.0 / len);\r\n };\r\n /**\r\n * Returns a new Vector3 from the Vector4 (x, y, z) coordinates.\r\n * @returns this converted to a new vector3\r\n */\r\n Vector4.prototype.toVector3 = function () {\r\n return new Vector3(this.x, this.y, this.z);\r\n };\r\n /**\r\n * Returns a new Vector4 copied from the current one.\r\n * @returns the new cloned vector\r\n */\r\n Vector4.prototype.clone = function () {\r\n return new Vector4(this.x, this.y, this.z, this.w);\r\n };\r\n /**\r\n * Updates the current Vector4 with the given one coordinates.\r\n * @param source the source vector to copy from\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.copyFrom = function (source) {\r\n this.x = source.x;\r\n this.y = source.y;\r\n this.z = source.z;\r\n this.w = source.w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current Vector4 coordinates with the given floats.\r\n * @param x float to copy from\r\n * @param y float to copy from\r\n * @param z float to copy from\r\n * @param w float to copy from\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.copyFromFloats = function (x, y, z, w) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n this.w = w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current Vector4 coordinates with the given floats.\r\n * @param x float to set from\r\n * @param y float to set from\r\n * @param z float to set from\r\n * @param w float to set from\r\n * @returns the updated Vector4.\r\n */\r\n Vector4.prototype.set = function (x, y, z, w) {\r\n return this.copyFromFloats(x, y, z, w);\r\n };\r\n /**\r\n * Copies the given float to the current Vector3 coordinates\r\n * @param v defines the x, y, z and w coordinates of the operand\r\n * @returns the current updated Vector3\r\n */\r\n Vector4.prototype.setAll = function (v) {\r\n this.x = this.y = this.z = this.w = v;\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Returns a new Vector4 set from the starting index of the given array.\r\n * @param array the array to pull values from\r\n * @param offset the offset into the array to start at\r\n * @returns the new vector\r\n */\r\n Vector4.FromArray = function (array, offset) {\r\n if (!offset) {\r\n offset = 0;\r\n }\r\n return new Vector4(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\r\n };\r\n /**\r\n * Updates the given vector \"result\" from the starting index of the given array.\r\n * @param array the array to pull values from\r\n * @param offset the offset into the array to start at\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.FromArrayToRef = function (array, offset, result) {\r\n result.x = array[offset];\r\n result.y = array[offset + 1];\r\n result.z = array[offset + 2];\r\n result.w = array[offset + 3];\r\n };\r\n /**\r\n * Updates the given vector \"result\" from the starting index of the given Float32Array.\r\n * @param array the array to pull values from\r\n * @param offset the offset into the array to start at\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.FromFloatArrayToRef = function (array, offset, result) {\r\n Vector4.FromArrayToRef(array, offset, result);\r\n };\r\n /**\r\n * Updates the given vector \"result\" coordinates from the given floats.\r\n * @param x float to set from\r\n * @param y float to set from\r\n * @param z float to set from\r\n * @param w float to set from\r\n * @param result the vector to the floats in\r\n */\r\n Vector4.FromFloatsToRef = function (x, y, z, w, result) {\r\n result.x = x;\r\n result.y = y;\r\n result.z = z;\r\n result.w = w;\r\n };\r\n /**\r\n * Returns a new Vector4 set to (0.0, 0.0, 0.0, 0.0)\r\n * @returns the new vector\r\n */\r\n Vector4.Zero = function () {\r\n return new Vector4(0.0, 0.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Returns a new Vector4 set to (1.0, 1.0, 1.0, 1.0)\r\n * @returns the new vector\r\n */\r\n Vector4.One = function () {\r\n return new Vector4(1.0, 1.0, 1.0, 1.0);\r\n };\r\n /**\r\n * Returns a new normalized Vector4 from the given one.\r\n * @param vector the vector to normalize\r\n * @returns the vector\r\n */\r\n Vector4.Normalize = function (vector) {\r\n var result = Vector4.Zero();\r\n Vector4.NormalizeToRef(vector, result);\r\n return result;\r\n };\r\n /**\r\n * Updates the given vector \"result\" from the normalization of the given one.\r\n * @param vector the vector to normalize\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.NormalizeToRef = function (vector, result) {\r\n result.copyFrom(vector);\r\n result.normalize();\r\n };\r\n /**\r\n * Returns a vector with the minimum values from the left and right vectors\r\n * @param left left vector to minimize\r\n * @param right right vector to minimize\r\n * @returns a new vector with the minimum of the left and right vector values\r\n */\r\n Vector4.Minimize = function (left, right) {\r\n var min = left.clone();\r\n min.minimizeInPlace(right);\r\n return min;\r\n };\r\n /**\r\n * Returns a vector with the maximum values from the left and right vectors\r\n * @param left left vector to maximize\r\n * @param right right vector to maximize\r\n * @returns a new vector with the maximum of the left and right vector values\r\n */\r\n Vector4.Maximize = function (left, right) {\r\n var max = left.clone();\r\n max.maximizeInPlace(right);\r\n return max;\r\n };\r\n /**\r\n * Returns the distance (float) between the vectors \"value1\" and \"value2\".\r\n * @param value1 value to calulate the distance between\r\n * @param value2 value to calulate the distance between\r\n * @return the distance between the two vectors\r\n */\r\n Vector4.Distance = function (value1, value2) {\r\n return Math.sqrt(Vector4.DistanceSquared(value1, value2));\r\n };\r\n /**\r\n * Returns the squared distance (float) between the vectors \"value1\" and \"value2\".\r\n * @param value1 value to calulate the distance between\r\n * @param value2 value to calulate the distance between\r\n * @return the distance between the two vectors squared\r\n */\r\n Vector4.DistanceSquared = function (value1, value2) {\r\n var x = value1.x - value2.x;\r\n var y = value1.y - value2.y;\r\n var z = value1.z - value2.z;\r\n var w = value1.w - value2.w;\r\n return (x * x) + (y * y) + (z * z) + (w * w);\r\n };\r\n /**\r\n * Returns a new Vector4 located at the center between the vectors \"value1\" and \"value2\".\r\n * @param value1 value to calulate the center between\r\n * @param value2 value to calulate the center between\r\n * @return the center between the two vectors\r\n */\r\n Vector4.Center = function (value1, value2) {\r\n var center = value1.add(value2);\r\n center.scaleInPlace(0.5);\r\n return center;\r\n };\r\n /**\r\n * Returns a new Vector4 set with the result of the normal transformation by the given matrix of the given vector.\r\n * This methods computes transformed normalized direction vectors only.\r\n * @param vector the vector to transform\r\n * @param transformation the transformation matrix to apply\r\n * @returns the new vector\r\n */\r\n Vector4.TransformNormal = function (vector, transformation) {\r\n var result = Vector4.Zero();\r\n Vector4.TransformNormalToRef(vector, transformation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given vector.\r\n * This methods computes transformed normalized direction vectors only.\r\n * @param vector the vector to transform\r\n * @param transformation the transformation matrix to apply\r\n * @param result the vector to store the result in\r\n */\r\n Vector4.TransformNormalToRef = function (vector, transformation, result) {\r\n var m = transformation.m;\r\n var x = (vector.x * m[0]) + (vector.y * m[4]) + (vector.z * m[8]);\r\n var y = (vector.x * m[1]) + (vector.y * m[5]) + (vector.z * m[9]);\r\n var z = (vector.x * m[2]) + (vector.y * m[6]) + (vector.z * m[10]);\r\n result.x = x;\r\n result.y = y;\r\n result.z = z;\r\n result.w = vector.w;\r\n };\r\n /**\r\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given floats (x, y, z, w).\r\n * This methods computes transformed normalized direction vectors only.\r\n * @param x value to transform\r\n * @param y value to transform\r\n * @param z value to transform\r\n * @param w value to transform\r\n * @param transformation the transformation matrix to apply\r\n * @param result the vector to store the results in\r\n */\r\n Vector4.TransformNormalFromFloatsToRef = function (x, y, z, w, transformation, result) {\r\n var m = transformation.m;\r\n result.x = (x * m[0]) + (y * m[4]) + (z * m[8]);\r\n result.y = (x * m[1]) + (y * m[5]) + (z * m[9]);\r\n result.z = (x * m[2]) + (y * m[6]) + (z * m[10]);\r\n result.w = w;\r\n };\r\n /**\r\n * Creates a new Vector4 from a Vector3\r\n * @param source defines the source data\r\n * @param w defines the 4th component (default is 0)\r\n * @returns a new Vector4\r\n */\r\n Vector4.FromVector3 = function (source, w) {\r\n if (w === void 0) { w = 0; }\r\n return new Vector4(source._x, source._y, source._z, w);\r\n };\r\n return Vector4;\r\n}());\r\nexport { Vector4 };\r\n/**\r\n * Class used to store quaternion data\r\n * @see https://en.wikipedia.org/wiki/Quaternion\r\n * @see https://doc.babylonjs.com/features/position,_rotation,_scaling\r\n */\r\nvar Quaternion = /** @class */ (function () {\r\n /**\r\n * Creates a new Quaternion from the given floats\r\n * @param x defines the first component (0 by default)\r\n * @param y defines the second component (0 by default)\r\n * @param z defines the third component (0 by default)\r\n * @param w defines the fourth component (1.0 by default)\r\n */\r\n function Quaternion(x, y, z, w) {\r\n if (x === void 0) { x = 0.0; }\r\n if (y === void 0) { y = 0.0; }\r\n if (z === void 0) { z = 0.0; }\r\n if (w === void 0) { w = 1.0; }\r\n /** @hidden */\r\n this._isDirty = true;\r\n this._x = x;\r\n this._y = y;\r\n this._z = z;\r\n this._w = w;\r\n }\r\n Object.defineProperty(Quaternion.prototype, \"x\", {\r\n /** Gets or sets the x coordinate */\r\n get: function () {\r\n return this._x;\r\n },\r\n set: function (value) {\r\n this._x = value;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Quaternion.prototype, \"y\", {\r\n /** Gets or sets the y coordinate */\r\n get: function () {\r\n return this._y;\r\n },\r\n set: function (value) {\r\n this._y = value;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Quaternion.prototype, \"z\", {\r\n /** Gets or sets the z coordinate */\r\n get: function () {\r\n return this._z;\r\n },\r\n set: function (value) {\r\n this._z = value;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Quaternion.prototype, \"w\", {\r\n /** Gets or sets the w coordinate */\r\n get: function () {\r\n return this._w;\r\n },\r\n set: function (value) {\r\n this._w = value;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string representation for the current quaternion\r\n * @returns a string with the Quaternion coordinates\r\n */\r\n Quaternion.prototype.toString = function () {\r\n return \"{X: \" + this._x + \" Y:\" + this._y + \" Z:\" + this._z + \" W:\" + this._w + \"}\";\r\n };\r\n /**\r\n * Gets the class name of the quaternion\r\n * @returns the string \"Quaternion\"\r\n */\r\n Quaternion.prototype.getClassName = function () {\r\n return \"Quaternion\";\r\n };\r\n /**\r\n * Gets a hash code for this quaternion\r\n * @returns the quaternion hash code\r\n */\r\n Quaternion.prototype.getHashCode = function () {\r\n var hash = this._x | 0;\r\n hash = (hash * 397) ^ (this._y | 0);\r\n hash = (hash * 397) ^ (this._z | 0);\r\n hash = (hash * 397) ^ (this._w | 0);\r\n return hash;\r\n };\r\n /**\r\n * Copy the quaternion to an array\r\n * @returns a new array populated with 4 elements from the quaternion coordinates\r\n */\r\n Quaternion.prototype.asArray = function () {\r\n return [this._x, this._y, this._z, this._w];\r\n };\r\n /**\r\n * Check if two quaternions are equals\r\n * @param otherQuaternion defines the second operand\r\n * @return true if the current quaternion and the given one coordinates are strictly equals\r\n */\r\n Quaternion.prototype.equals = function (otherQuaternion) {\r\n return otherQuaternion && this._x === otherQuaternion._x && this._y === otherQuaternion._y && this._z === otherQuaternion._z && this._w === otherQuaternion._w;\r\n };\r\n /**\r\n * Gets a boolean if two quaternions are equals (using an epsilon value)\r\n * @param otherQuaternion defines the other quaternion\r\n * @param epsilon defines the minimal distance to consider equality\r\n * @returns true if the given quaternion coordinates are close to the current ones by a distance of epsilon.\r\n */\r\n Quaternion.prototype.equalsWithEpsilon = function (otherQuaternion, epsilon) {\r\n if (epsilon === void 0) { epsilon = Epsilon; }\r\n return otherQuaternion\r\n && Scalar.WithinEpsilon(this._x, otherQuaternion._x, epsilon)\r\n && Scalar.WithinEpsilon(this._y, otherQuaternion._y, epsilon)\r\n && Scalar.WithinEpsilon(this._z, otherQuaternion._z, epsilon)\r\n && Scalar.WithinEpsilon(this._w, otherQuaternion._w, epsilon);\r\n };\r\n /**\r\n * Clone the current quaternion\r\n * @returns a new quaternion copied from the current one\r\n */\r\n Quaternion.prototype.clone = function () {\r\n return new Quaternion(this._x, this._y, this._z, this._w);\r\n };\r\n /**\r\n * Copy a quaternion to the current one\r\n * @param other defines the other quaternion\r\n * @returns the updated current quaternion\r\n */\r\n Quaternion.prototype.copyFrom = function (other) {\r\n this.x = other._x;\r\n this.y = other._y;\r\n this.z = other._z;\r\n this.w = other._w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion with the given float coordinates\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n * @param z defines the z coordinate\r\n * @param w defines the w coordinate\r\n * @returns the updated current quaternion\r\n */\r\n Quaternion.prototype.copyFromFloats = function (x, y, z, w) {\r\n this.x = x;\r\n this.y = y;\r\n this.z = z;\r\n this.w = w;\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion from the given float coordinates\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n * @param z defines the z coordinate\r\n * @param w defines the w coordinate\r\n * @returns the updated current quaternion\r\n */\r\n Quaternion.prototype.set = function (x, y, z, w) {\r\n return this.copyFromFloats(x, y, z, w);\r\n };\r\n /**\r\n * Adds two quaternions\r\n * @param other defines the second operand\r\n * @returns a new quaternion as the addition result of the given one and the current quaternion\r\n */\r\n Quaternion.prototype.add = function (other) {\r\n return new Quaternion(this._x + other._x, this._y + other._y, this._z + other._z, this._w + other._w);\r\n };\r\n /**\r\n * Add a quaternion to the current one\r\n * @param other defines the quaternion to add\r\n * @returns the current quaternion\r\n */\r\n Quaternion.prototype.addInPlace = function (other) {\r\n this._x += other._x;\r\n this._y += other._y;\r\n this._z += other._z;\r\n this._w += other._w;\r\n return this;\r\n };\r\n /**\r\n * Subtract two quaternions\r\n * @param other defines the second operand\r\n * @returns a new quaternion as the subtraction result of the given one from the current one\r\n */\r\n Quaternion.prototype.subtract = function (other) {\r\n return new Quaternion(this._x - other._x, this._y - other._y, this._z - other._z, this._w - other._w);\r\n };\r\n /**\r\n * Multiplies the current quaternion by a scale factor\r\n * @param value defines the scale factor\r\n * @returns a new quaternion set by multiplying the current quaternion coordinates by the float \"scale\"\r\n */\r\n Quaternion.prototype.scale = function (value) {\r\n return new Quaternion(this._x * value, this._y * value, this._z * value, this._w * value);\r\n };\r\n /**\r\n * Scale the current quaternion values by a factor and stores the result to a given quaternion\r\n * @param scale defines the scale factor\r\n * @param result defines the Quaternion object where to store the result\r\n * @returns the unmodified current quaternion\r\n */\r\n Quaternion.prototype.scaleToRef = function (scale, result) {\r\n result.x = this._x * scale;\r\n result.y = this._y * scale;\r\n result.z = this._z * scale;\r\n result.w = this._w * scale;\r\n return this;\r\n };\r\n /**\r\n * Multiplies in place the current quaternion by a scale factor\r\n * @param value defines the scale factor\r\n * @returns the current modified quaternion\r\n */\r\n Quaternion.prototype.scaleInPlace = function (value) {\r\n this.x *= value;\r\n this.y *= value;\r\n this.z *= value;\r\n this.w *= value;\r\n return this;\r\n };\r\n /**\r\n * Scale the current quaternion values by a factor and add the result to a given quaternion\r\n * @param scale defines the scale factor\r\n * @param result defines the Quaternion object where to store the result\r\n * @returns the unmodified current quaternion\r\n */\r\n Quaternion.prototype.scaleAndAddToRef = function (scale, result) {\r\n result.x += this._x * scale;\r\n result.y += this._y * scale;\r\n result.z += this._z * scale;\r\n result.w += this._w * scale;\r\n return this;\r\n };\r\n /**\r\n * Multiplies two quaternions\r\n * @param q1 defines the second operand\r\n * @returns a new quaternion set as the multiplication result of the current one with the given one \"q1\"\r\n */\r\n Quaternion.prototype.multiply = function (q1) {\r\n var result = new Quaternion(0, 0, 0, 1.0);\r\n this.multiplyToRef(q1, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given \"result\" as the the multiplication result of the current one with the given one \"q1\"\r\n * @param q1 defines the second operand\r\n * @param result defines the target quaternion\r\n * @returns the current quaternion\r\n */\r\n Quaternion.prototype.multiplyToRef = function (q1, result) {\r\n var x = this._x * q1._w + this._y * q1._z - this._z * q1._y + this._w * q1._x;\r\n var y = -this._x * q1._z + this._y * q1._w + this._z * q1._x + this._w * q1._y;\r\n var z = this._x * q1._y - this._y * q1._x + this._z * q1._w + this._w * q1._z;\r\n var w = -this._x * q1._x - this._y * q1._y - this._z * q1._z + this._w * q1._w;\r\n result.copyFromFloats(x, y, z, w);\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion with the multiplication of itself with the given one \"q1\"\r\n * @param q1 defines the second operand\r\n * @returns the currentupdated quaternion\r\n */\r\n Quaternion.prototype.multiplyInPlace = function (q1) {\r\n this.multiplyToRef(q1, this);\r\n return this;\r\n };\r\n /**\r\n * Conjugates (1-q) the current quaternion and stores the result in the given quaternion\r\n * @param ref defines the target quaternion\r\n * @returns the current quaternion\r\n */\r\n Quaternion.prototype.conjugateToRef = function (ref) {\r\n ref.copyFromFloats(-this._x, -this._y, -this._z, this._w);\r\n return this;\r\n };\r\n /**\r\n * Conjugates in place (1-q) the current quaternion\r\n * @returns the current updated quaternion\r\n */\r\n Quaternion.prototype.conjugateInPlace = function () {\r\n this.x *= -1;\r\n this.y *= -1;\r\n this.z *= -1;\r\n return this;\r\n };\r\n /**\r\n * Conjugates in place (1-q) the current quaternion\r\n * @returns a new quaternion\r\n */\r\n Quaternion.prototype.conjugate = function () {\r\n var result = new Quaternion(-this._x, -this._y, -this._z, this._w);\r\n return result;\r\n };\r\n /**\r\n * Gets length of current quaternion\r\n * @returns the quaternion length (float)\r\n */\r\n Quaternion.prototype.length = function () {\r\n return Math.sqrt((this._x * this._x) + (this._y * this._y) + (this._z * this._z) + (this._w * this._w));\r\n };\r\n /**\r\n * Normalize in place the current quaternion\r\n * @returns the current updated quaternion\r\n */\r\n Quaternion.prototype.normalize = function () {\r\n var len = this.length();\r\n if (len === 0) {\r\n return this;\r\n }\r\n var inv = 1.0 / len;\r\n this.x *= inv;\r\n this.y *= inv;\r\n this.z *= inv;\r\n this.w *= inv;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the Euler angles translated from the current quaternion\r\n * @param order is a reserved parameter and is ignored for now\r\n * @returns a new Vector3 containing the Euler angles\r\n */\r\n Quaternion.prototype.toEulerAngles = function (order) {\r\n if (order === void 0) { order = \"YZX\"; }\r\n var result = Vector3.Zero();\r\n this.toEulerAnglesToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given vector3 \"result\" with the Euler angles translated from the current quaternion\r\n * @param result defines the vector which will be filled with the Euler angles\r\n * @returns the current unchanged quaternion\r\n */\r\n Quaternion.prototype.toEulerAnglesToRef = function (result) {\r\n var qz = this._z;\r\n var qx = this._x;\r\n var qy = this._y;\r\n var qw = this._w;\r\n var sqw = qw * qw;\r\n var sqz = qz * qz;\r\n var sqx = qx * qx;\r\n var sqy = qy * qy;\r\n var zAxisY = qy * qz - qx * qw;\r\n var limit = .4999999;\r\n if (zAxisY < -limit) {\r\n result.y = 2 * Math.atan2(qy, qw);\r\n result.x = Math.PI / 2;\r\n result.z = 0;\r\n }\r\n else if (zAxisY > limit) {\r\n result.y = 2 * Math.atan2(qy, qw);\r\n result.x = -Math.PI / 2;\r\n result.z = 0;\r\n }\r\n else {\r\n result.z = Math.atan2(2.0 * (qx * qy + qz * qw), (-sqz - sqx + sqy + sqw));\r\n result.x = Math.asin(-2.0 * (qz * qy - qx * qw));\r\n result.y = Math.atan2(2.0 * (qz * qx + qy * qw), (sqz - sqx - sqy + sqw));\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the given rotation matrix with the current quaternion values\r\n * @param result defines the target matrix\r\n * @returns the current unchanged quaternion\r\n */\r\n Quaternion.prototype.toRotationMatrix = function (result) {\r\n Matrix.FromQuaternionToRef(this, result);\r\n return this;\r\n };\r\n /**\r\n * Updates the current quaternion from the given rotation matrix values\r\n * @param matrix defines the source matrix\r\n * @returns the current updated quaternion\r\n */\r\n Quaternion.prototype.fromRotationMatrix = function (matrix) {\r\n Quaternion.FromRotationMatrixToRef(matrix, this);\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Creates a new quaternion from a rotation matrix\r\n * @param matrix defines the source matrix\r\n * @returns a new quaternion created from the given rotation matrix values\r\n */\r\n Quaternion.FromRotationMatrix = function (matrix) {\r\n var result = new Quaternion();\r\n Quaternion.FromRotationMatrixToRef(matrix, result);\r\n return result;\r\n };\r\n /**\r\n * Updates the given quaternion with the given rotation matrix values\r\n * @param matrix defines the source matrix\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.FromRotationMatrixToRef = function (matrix, result) {\r\n var data = matrix.m;\r\n var m11 = data[0], m12 = data[4], m13 = data[8];\r\n var m21 = data[1], m22 = data[5], m23 = data[9];\r\n var m31 = data[2], m32 = data[6], m33 = data[10];\r\n var trace = m11 + m22 + m33;\r\n var s;\r\n if (trace > 0) {\r\n s = 0.5 / Math.sqrt(trace + 1.0);\r\n result.w = 0.25 / s;\r\n result.x = (m32 - m23) * s;\r\n result.y = (m13 - m31) * s;\r\n result.z = (m21 - m12) * s;\r\n }\r\n else if (m11 > m22 && m11 > m33) {\r\n s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33);\r\n result.w = (m32 - m23) / s;\r\n result.x = 0.25 * s;\r\n result.y = (m12 + m21) / s;\r\n result.z = (m13 + m31) / s;\r\n }\r\n else if (m22 > m33) {\r\n s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33);\r\n result.w = (m13 - m31) / s;\r\n result.x = (m12 + m21) / s;\r\n result.y = 0.25 * s;\r\n result.z = (m23 + m32) / s;\r\n }\r\n else {\r\n s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22);\r\n result.w = (m21 - m12) / s;\r\n result.x = (m13 + m31) / s;\r\n result.y = (m23 + m32) / s;\r\n result.z = 0.25 * s;\r\n }\r\n };\r\n /**\r\n * Returns the dot product (float) between the quaternions \"left\" and \"right\"\r\n * @param left defines the left operand\r\n * @param right defines the right operand\r\n * @returns the dot product\r\n */\r\n Quaternion.Dot = function (left, right) {\r\n return (left._x * right._x + left._y * right._y + left._z * right._z + left._w * right._w);\r\n };\r\n /**\r\n * Checks if the two quaternions are close to each other\r\n * @param quat0 defines the first quaternion to check\r\n * @param quat1 defines the second quaternion to check\r\n * @returns true if the two quaternions are close to each other\r\n */\r\n Quaternion.AreClose = function (quat0, quat1) {\r\n var dot = Quaternion.Dot(quat0, quat1);\r\n return dot >= 0;\r\n };\r\n /**\r\n * Creates an empty quaternion\r\n * @returns a new quaternion set to (0.0, 0.0, 0.0)\r\n */\r\n Quaternion.Zero = function () {\r\n return new Quaternion(0.0, 0.0, 0.0, 0.0);\r\n };\r\n /**\r\n * Inverse a given quaternion\r\n * @param q defines the source quaternion\r\n * @returns a new quaternion as the inverted current quaternion\r\n */\r\n Quaternion.Inverse = function (q) {\r\n return new Quaternion(-q._x, -q._y, -q._z, q._w);\r\n };\r\n /**\r\n * Inverse a given quaternion\r\n * @param q defines the source quaternion\r\n * @param result the quaternion the result will be stored in\r\n * @returns the result quaternion\r\n */\r\n Quaternion.InverseToRef = function (q, result) {\r\n result.set(-q._x, -q._y, -q._z, q._w);\r\n return result;\r\n };\r\n /**\r\n * Creates an identity quaternion\r\n * @returns the identity quaternion\r\n */\r\n Quaternion.Identity = function () {\r\n return new Quaternion(0.0, 0.0, 0.0, 1.0);\r\n };\r\n /**\r\n * Gets a boolean indicating if the given quaternion is identity\r\n * @param quaternion defines the quaternion to check\r\n * @returns true if the quaternion is identity\r\n */\r\n Quaternion.IsIdentity = function (quaternion) {\r\n return quaternion && quaternion._x === 0 && quaternion._y === 0 && quaternion._z === 0 && quaternion._w === 1;\r\n };\r\n /**\r\n * Creates a quaternion from a rotation around an axis\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle to use\r\n * @returns a new quaternion created from the given axis (Vector3) and angle in radians (float)\r\n */\r\n Quaternion.RotationAxis = function (axis, angle) {\r\n return Quaternion.RotationAxisToRef(axis, angle, new Quaternion());\r\n };\r\n /**\r\n * Creates a rotation around an axis and stores it into the given quaternion\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle to use\r\n * @param result defines the target quaternion\r\n * @returns the target quaternion\r\n */\r\n Quaternion.RotationAxisToRef = function (axis, angle, result) {\r\n var sin = Math.sin(angle / 2);\r\n axis.normalize();\r\n result.w = Math.cos(angle / 2);\r\n result.x = axis._x * sin;\r\n result.y = axis._y * sin;\r\n result.z = axis._z * sin;\r\n return result;\r\n };\r\n /**\r\n * Creates a new quaternion from data stored into an array\r\n * @param array defines the data source\r\n * @param offset defines the offset in the source array where the data starts\r\n * @returns a new quaternion\r\n */\r\n Quaternion.FromArray = function (array, offset) {\r\n if (!offset) {\r\n offset = 0;\r\n }\r\n return new Quaternion(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\r\n };\r\n /**\r\n * Updates the given quaternion \"result\" from the starting index of the given array.\r\n * @param array the array to pull values from\r\n * @param offset the offset into the array to start at\r\n * @param result the quaternion to store the result in\r\n */\r\n Quaternion.FromArrayToRef = function (array, offset, result) {\r\n result.x = array[offset];\r\n result.y = array[offset + 1];\r\n result.z = array[offset + 2];\r\n result.w = array[offset + 3];\r\n };\r\n /**\r\n * Create a quaternion from Euler rotation angles\r\n * @param x Pitch\r\n * @param y Yaw\r\n * @param z Roll\r\n * @returns the new Quaternion\r\n */\r\n Quaternion.FromEulerAngles = function (x, y, z) {\r\n var q = new Quaternion();\r\n Quaternion.RotationYawPitchRollToRef(y, x, z, q);\r\n return q;\r\n };\r\n /**\r\n * Updates a quaternion from Euler rotation angles\r\n * @param x Pitch\r\n * @param y Yaw\r\n * @param z Roll\r\n * @param result the quaternion to store the result\r\n * @returns the updated quaternion\r\n */\r\n Quaternion.FromEulerAnglesToRef = function (x, y, z, result) {\r\n Quaternion.RotationYawPitchRollToRef(y, x, z, result);\r\n return result;\r\n };\r\n /**\r\n * Create a quaternion from Euler rotation vector\r\n * @param vec the Euler vector (x Pitch, y Yaw, z Roll)\r\n * @returns the new Quaternion\r\n */\r\n Quaternion.FromEulerVector = function (vec) {\r\n var q = new Quaternion();\r\n Quaternion.RotationYawPitchRollToRef(vec._y, vec._x, vec._z, q);\r\n return q;\r\n };\r\n /**\r\n * Updates a quaternion from Euler rotation vector\r\n * @param vec the Euler vector (x Pitch, y Yaw, z Roll)\r\n * @param result the quaternion to store the result\r\n * @returns the updated quaternion\r\n */\r\n Quaternion.FromEulerVectorToRef = function (vec, result) {\r\n Quaternion.RotationYawPitchRollToRef(vec._y, vec._x, vec._z, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new quaternion from the given Euler float angles (y, x, z)\r\n * @param yaw defines the rotation around Y axis\r\n * @param pitch defines the rotation around X axis\r\n * @param roll defines the rotation around Z axis\r\n * @returns the new quaternion\r\n */\r\n Quaternion.RotationYawPitchRoll = function (yaw, pitch, roll) {\r\n var q = new Quaternion();\r\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, q);\r\n return q;\r\n };\r\n /**\r\n * Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion\r\n * @param yaw defines the rotation around Y axis\r\n * @param pitch defines the rotation around X axis\r\n * @param roll defines the rotation around Z axis\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {\r\n // Produces a quaternion from Euler angles in the z-y-x orientation (Tait-Bryan angles)\r\n var halfRoll = roll * 0.5;\r\n var halfPitch = pitch * 0.5;\r\n var halfYaw = yaw * 0.5;\r\n var sinRoll = Math.sin(halfRoll);\r\n var cosRoll = Math.cos(halfRoll);\r\n var sinPitch = Math.sin(halfPitch);\r\n var cosPitch = Math.cos(halfPitch);\r\n var sinYaw = Math.sin(halfYaw);\r\n var cosYaw = Math.cos(halfYaw);\r\n result.x = (cosYaw * sinPitch * cosRoll) + (sinYaw * cosPitch * sinRoll);\r\n result.y = (sinYaw * cosPitch * cosRoll) - (cosYaw * sinPitch * sinRoll);\r\n result.z = (cosYaw * cosPitch * sinRoll) - (sinYaw * sinPitch * cosRoll);\r\n result.w = (cosYaw * cosPitch * cosRoll) + (sinYaw * sinPitch * sinRoll);\r\n };\r\n /**\r\n * Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation\r\n * @param alpha defines the rotation around first axis\r\n * @param beta defines the rotation around second axis\r\n * @param gamma defines the rotation around third axis\r\n * @returns the new quaternion\r\n */\r\n Quaternion.RotationAlphaBetaGamma = function (alpha, beta, gamma) {\r\n var result = new Quaternion();\r\n Quaternion.RotationAlphaBetaGammaToRef(alpha, beta, gamma, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation and stores it in the target quaternion\r\n * @param alpha defines the rotation around first axis\r\n * @param beta defines the rotation around second axis\r\n * @param gamma defines the rotation around third axis\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.RotationAlphaBetaGammaToRef = function (alpha, beta, gamma, result) {\r\n // Produces a quaternion from Euler angles in the z-x-z orientation\r\n var halfGammaPlusAlpha = (gamma + alpha) * 0.5;\r\n var halfGammaMinusAlpha = (gamma - alpha) * 0.5;\r\n var halfBeta = beta * 0.5;\r\n result.x = Math.cos(halfGammaMinusAlpha) * Math.sin(halfBeta);\r\n result.y = Math.sin(halfGammaMinusAlpha) * Math.sin(halfBeta);\r\n result.z = Math.sin(halfGammaPlusAlpha) * Math.cos(halfBeta);\r\n result.w = Math.cos(halfGammaPlusAlpha) * Math.cos(halfBeta);\r\n };\r\n /**\r\n * Creates a new quaternion containing the rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation)\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @returns the new quaternion\r\n */\r\n Quaternion.RotationQuaternionFromAxis = function (axis1, axis2, axis3) {\r\n var quat = new Quaternion(0.0, 0.0, 0.0, 0.0);\r\n Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, quat);\r\n return quat;\r\n };\r\n /**\r\n * Creates a rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation) and stores it in the target quaternion\r\n * @param axis1 defines the first axis\r\n * @param axis2 defines the second axis\r\n * @param axis3 defines the third axis\r\n * @param ref defines the target quaternion\r\n */\r\n Quaternion.RotationQuaternionFromAxisToRef = function (axis1, axis2, axis3, ref) {\r\n var rotMat = MathTmp.Matrix[0];\r\n Matrix.FromXYZAxesToRef(axis1.normalize(), axis2.normalize(), axis3.normalize(), rotMat);\r\n Quaternion.FromRotationMatrixToRef(rotMat, ref);\r\n };\r\n /**\r\n * Interpolates between two quaternions\r\n * @param left defines first quaternion\r\n * @param right defines second quaternion\r\n * @param amount defines the gradient to use\r\n * @returns the new interpolated quaternion\r\n */\r\n Quaternion.Slerp = function (left, right, amount) {\r\n var result = Quaternion.Identity();\r\n Quaternion.SlerpToRef(left, right, amount, result);\r\n return result;\r\n };\r\n /**\r\n * Interpolates between two quaternions and stores it into a target quaternion\r\n * @param left defines first quaternion\r\n * @param right defines second quaternion\r\n * @param amount defines the gradient to use\r\n * @param result defines the target quaternion\r\n */\r\n Quaternion.SlerpToRef = function (left, right, amount, result) {\r\n var num2;\r\n var num3;\r\n var num4 = (((left._x * right._x) + (left._y * right._y)) + (left._z * right._z)) + (left._w * right._w);\r\n var flag = false;\r\n if (num4 < 0) {\r\n flag = true;\r\n num4 = -num4;\r\n }\r\n if (num4 > 0.999999) {\r\n num3 = 1 - amount;\r\n num2 = flag ? -amount : amount;\r\n }\r\n else {\r\n var num5 = Math.acos(num4);\r\n var num6 = (1.0 / Math.sin(num5));\r\n num3 = (Math.sin((1.0 - amount) * num5)) * num6;\r\n num2 = flag ? ((-Math.sin(amount * num5)) * num6) : ((Math.sin(amount * num5)) * num6);\r\n }\r\n result.x = (num3 * left._x) + (num2 * right._x);\r\n result.y = (num3 * left._y) + (num2 * right._y);\r\n result.z = (num3 * left._z) + (num2 * right._z);\r\n result.w = (num3 * left._w) + (num2 * right._w);\r\n };\r\n /**\r\n * Interpolate between two quaternions using Hermite interpolation\r\n * @param value1 defines first quaternion\r\n * @param tangent1 defines the incoming tangent\r\n * @param value2 defines second quaternion\r\n * @param tangent2 defines the outgoing tangent\r\n * @param amount defines the target quaternion\r\n * @returns the new interpolated quaternion\r\n */\r\n Quaternion.Hermite = function (value1, tangent1, value2, tangent2, amount) {\r\n var squared = amount * amount;\r\n var cubed = amount * squared;\r\n var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;\r\n var part2 = (-2.0 * cubed) + (3.0 * squared);\r\n var part3 = (cubed - (2.0 * squared)) + amount;\r\n var part4 = cubed - squared;\r\n var x = (((value1._x * part1) + (value2._x * part2)) + (tangent1._x * part3)) + (tangent2._x * part4);\r\n var y = (((value1._y * part1) + (value2._y * part2)) + (tangent1._y * part3)) + (tangent2._y * part4);\r\n var z = (((value1._z * part1) + (value2._z * part2)) + (tangent1._z * part3)) + (tangent2._z * part4);\r\n var w = (((value1._w * part1) + (value2._w * part2)) + (tangent1._w * part3)) + (tangent2._w * part4);\r\n return new Quaternion(x, y, z, w);\r\n };\r\n return Quaternion;\r\n}());\r\nexport { Quaternion };\r\n/**\r\n * Class used to store matrix data (4x4)\r\n */\r\nvar Matrix = /** @class */ (function () {\r\n /**\r\n * Creates an empty matrix (filled with zeros)\r\n */\r\n function Matrix() {\r\n this._isIdentity = false;\r\n this._isIdentityDirty = true;\r\n this._isIdentity3x2 = true;\r\n this._isIdentity3x2Dirty = true;\r\n /**\r\n * Gets the update flag of the matrix which is an unique number for the matrix.\r\n * It will be incremented every time the matrix data change.\r\n * You can use it to speed the comparison between two versions of the same matrix.\r\n */\r\n this.updateFlag = -1;\r\n if (PerformanceConfigurator.MatrixTrackPrecisionChange) {\r\n PerformanceConfigurator.MatrixTrackedMatrices.push(this);\r\n }\r\n this._m = new PerformanceConfigurator.MatrixCurrentType(16);\r\n this._updateIdentityStatus(false);\r\n }\r\n Object.defineProperty(Matrix, \"Use64Bits\", {\r\n /**\r\n * Gets the precision of matrix computations\r\n */\r\n get: function () {\r\n return PerformanceConfigurator.MatrixUse64Bits;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Matrix.prototype, \"m\", {\r\n /**\r\n * Gets the internal data of the matrix\r\n */\r\n get: function () { return this._m; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Matrix.prototype._markAsUpdated = function () {\r\n this.updateFlag = Matrix._updateFlagSeed++;\r\n this._isIdentity = false;\r\n this._isIdentity3x2 = false;\r\n this._isIdentityDirty = true;\r\n this._isIdentity3x2Dirty = true;\r\n };\r\n /** @hidden */\r\n Matrix.prototype._updateIdentityStatus = function (isIdentity, isIdentityDirty, isIdentity3x2, isIdentity3x2Dirty) {\r\n if (isIdentityDirty === void 0) { isIdentityDirty = false; }\r\n if (isIdentity3x2 === void 0) { isIdentity3x2 = false; }\r\n if (isIdentity3x2Dirty === void 0) { isIdentity3x2Dirty = true; }\r\n this.updateFlag = Matrix._updateFlagSeed++;\r\n this._isIdentity = isIdentity;\r\n this._isIdentity3x2 = isIdentity || isIdentity3x2;\r\n this._isIdentityDirty = this._isIdentity ? false : isIdentityDirty;\r\n this._isIdentity3x2Dirty = this._isIdentity3x2 ? false : isIdentity3x2Dirty;\r\n };\r\n // Properties\r\n /**\r\n * Check if the current matrix is identity\r\n * @returns true is the matrix is the identity matrix\r\n */\r\n Matrix.prototype.isIdentity = function () {\r\n if (this._isIdentityDirty) {\r\n this._isIdentityDirty = false;\r\n var m = this._m;\r\n this._isIdentity = (m[0] === 1.0 && m[1] === 0.0 && m[2] === 0.0 && m[3] === 0.0 &&\r\n m[4] === 0.0 && m[5] === 1.0 && m[6] === 0.0 && m[7] === 0.0 &&\r\n m[8] === 0.0 && m[9] === 0.0 && m[10] === 1.0 && m[11] === 0.0 &&\r\n m[12] === 0.0 && m[13] === 0.0 && m[14] === 0.0 && m[15] === 1.0);\r\n }\r\n return this._isIdentity;\r\n };\r\n /**\r\n * Check if the current matrix is identity as a texture matrix (3x2 store in 4x4)\r\n * @returns true is the matrix is the identity matrix\r\n */\r\n Matrix.prototype.isIdentityAs3x2 = function () {\r\n if (this._isIdentity3x2Dirty) {\r\n this._isIdentity3x2Dirty = false;\r\n if (this._m[0] !== 1.0 || this._m[5] !== 1.0 || this._m[15] !== 1.0) {\r\n this._isIdentity3x2 = false;\r\n }\r\n else if (this._m[1] !== 0.0 || this._m[2] !== 0.0 || this._m[3] !== 0.0 ||\r\n this._m[4] !== 0.0 || this._m[6] !== 0.0 || this._m[7] !== 0.0 ||\r\n this._m[8] !== 0.0 || this._m[9] !== 0.0 || this._m[10] !== 0.0 || this._m[11] !== 0.0 ||\r\n this._m[12] !== 0.0 || this._m[13] !== 0.0 || this._m[14] !== 0.0) {\r\n this._isIdentity3x2 = false;\r\n }\r\n else {\r\n this._isIdentity3x2 = true;\r\n }\r\n }\r\n return this._isIdentity3x2;\r\n };\r\n /**\r\n * Gets the determinant of the matrix\r\n * @returns the matrix determinant\r\n */\r\n Matrix.prototype.determinant = function () {\r\n if (this._isIdentity === true) {\r\n return 1;\r\n }\r\n var m = this._m;\r\n var m00 = m[0], m01 = m[1], m02 = m[2], m03 = m[3];\r\n var m10 = m[4], m11 = m[5], m12 = m[6], m13 = m[7];\r\n var m20 = m[8], m21 = m[9], m22 = m[10], m23 = m[11];\r\n var m30 = m[12], m31 = m[13], m32 = m[14], m33 = m[15];\r\n // https://en.wikipedia.org/wiki/Laplace_expansion\r\n // to compute the deterrminant of a 4x4 Matrix we compute the cofactors of any row or column,\r\n // then we multiply each Cofactor by its corresponding matrix value and sum them all to get the determinant\r\n // Cofactor(i, j) = sign(i,j) * det(Minor(i, j))\r\n // where\r\n // - sign(i,j) = (i+j) % 2 === 0 ? 1 : -1\r\n // - Minor(i, j) is the 3x3 matrix we get by removing row i and column j from current Matrix\r\n //\r\n // Here we do that for the 1st row.\r\n var det_22_33 = m22 * m33 - m32 * m23;\r\n var det_21_33 = m21 * m33 - m31 * m23;\r\n var det_21_32 = m21 * m32 - m31 * m22;\r\n var det_20_33 = m20 * m33 - m30 * m23;\r\n var det_20_32 = m20 * m32 - m22 * m30;\r\n var det_20_31 = m20 * m31 - m30 * m21;\r\n var cofact_00 = +(m11 * det_22_33 - m12 * det_21_33 + m13 * det_21_32);\r\n var cofact_01 = -(m10 * det_22_33 - m12 * det_20_33 + m13 * det_20_32);\r\n var cofact_02 = +(m10 * det_21_33 - m11 * det_20_33 + m13 * det_20_31);\r\n var cofact_03 = -(m10 * det_21_32 - m11 * det_20_32 + m12 * det_20_31);\r\n return m00 * cofact_00 + m01 * cofact_01 + m02 * cofact_02 + m03 * cofact_03;\r\n };\r\n // Methods\r\n /**\r\n * Returns the matrix as a Float32Array or Array\r\n * @returns the matrix underlying array\r\n */\r\n Matrix.prototype.toArray = function () {\r\n return this._m;\r\n };\r\n /**\r\n * Returns the matrix as a Float32Array or Array\r\n * @returns the matrix underlying array.\r\n */\r\n Matrix.prototype.asArray = function () {\r\n return this._m;\r\n };\r\n /**\r\n * Inverts the current matrix in place\r\n * @returns the current inverted matrix\r\n */\r\n Matrix.prototype.invert = function () {\r\n this.invertToRef(this);\r\n return this;\r\n };\r\n /**\r\n * Sets all the matrix elements to zero\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.reset = function () {\r\n Matrix.FromValuesToRef(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, this);\r\n this._updateIdentityStatus(false);\r\n return this;\r\n };\r\n /**\r\n * Adds the current matrix with a second one\r\n * @param other defines the matrix to add\r\n * @returns a new matrix as the addition of the current matrix and the given one\r\n */\r\n Matrix.prototype.add = function (other) {\r\n var result = new Matrix();\r\n this.addToRef(other, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given matrix \"result\" to the addition of the current matrix and the given one\r\n * @param other defines the matrix to add\r\n * @param result defines the target matrix\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.addToRef = function (other, result) {\r\n var m = this._m;\r\n var resultM = result._m;\r\n var otherM = other.m;\r\n for (var index = 0; index < 16; index++) {\r\n resultM[index] = m[index] + otherM[index];\r\n }\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Adds in place the given matrix to the current matrix\r\n * @param other defines the second operand\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.addToSelf = function (other) {\r\n var m = this._m;\r\n var otherM = other.m;\r\n for (var index = 0; index < 16; index++) {\r\n m[index] += otherM[index];\r\n }\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Sets the given matrix to the current inverted Matrix\r\n * @param other defines the target matrix\r\n * @returns the unmodified current matrix\r\n */\r\n Matrix.prototype.invertToRef = function (other) {\r\n if (this._isIdentity === true) {\r\n Matrix.IdentityToRef(other);\r\n return this;\r\n }\r\n // the inverse of a Matrix is the transpose of cofactor matrix divided by the determinant\r\n var m = this._m;\r\n var m00 = m[0], m01 = m[1], m02 = m[2], m03 = m[3];\r\n var m10 = m[4], m11 = m[5], m12 = m[6], m13 = m[7];\r\n var m20 = m[8], m21 = m[9], m22 = m[10], m23 = m[11];\r\n var m30 = m[12], m31 = m[13], m32 = m[14], m33 = m[15];\r\n var det_22_33 = m22 * m33 - m32 * m23;\r\n var det_21_33 = m21 * m33 - m31 * m23;\r\n var det_21_32 = m21 * m32 - m31 * m22;\r\n var det_20_33 = m20 * m33 - m30 * m23;\r\n var det_20_32 = m20 * m32 - m22 * m30;\r\n var det_20_31 = m20 * m31 - m30 * m21;\r\n var cofact_00 = +(m11 * det_22_33 - m12 * det_21_33 + m13 * det_21_32);\r\n var cofact_01 = -(m10 * det_22_33 - m12 * det_20_33 + m13 * det_20_32);\r\n var cofact_02 = +(m10 * det_21_33 - m11 * det_20_33 + m13 * det_20_31);\r\n var cofact_03 = -(m10 * det_21_32 - m11 * det_20_32 + m12 * det_20_31);\r\n var det = m00 * cofact_00 + m01 * cofact_01 + m02 * cofact_02 + m03 * cofact_03;\r\n if (det === 0) {\r\n // not invertible\r\n other.copyFrom(this);\r\n return this;\r\n }\r\n var detInv = 1 / det;\r\n var det_12_33 = m12 * m33 - m32 * m13;\r\n var det_11_33 = m11 * m33 - m31 * m13;\r\n var det_11_32 = m11 * m32 - m31 * m12;\r\n var det_10_33 = m10 * m33 - m30 * m13;\r\n var det_10_32 = m10 * m32 - m30 * m12;\r\n var det_10_31 = m10 * m31 - m30 * m11;\r\n var det_12_23 = m12 * m23 - m22 * m13;\r\n var det_11_23 = m11 * m23 - m21 * m13;\r\n var det_11_22 = m11 * m22 - m21 * m12;\r\n var det_10_23 = m10 * m23 - m20 * m13;\r\n var det_10_22 = m10 * m22 - m20 * m12;\r\n var det_10_21 = m10 * m21 - m20 * m11;\r\n var cofact_10 = -(m01 * det_22_33 - m02 * det_21_33 + m03 * det_21_32);\r\n var cofact_11 = +(m00 * det_22_33 - m02 * det_20_33 + m03 * det_20_32);\r\n var cofact_12 = -(m00 * det_21_33 - m01 * det_20_33 + m03 * det_20_31);\r\n var cofact_13 = +(m00 * det_21_32 - m01 * det_20_32 + m02 * det_20_31);\r\n var cofact_20 = +(m01 * det_12_33 - m02 * det_11_33 + m03 * det_11_32);\r\n var cofact_21 = -(m00 * det_12_33 - m02 * det_10_33 + m03 * det_10_32);\r\n var cofact_22 = +(m00 * det_11_33 - m01 * det_10_33 + m03 * det_10_31);\r\n var cofact_23 = -(m00 * det_11_32 - m01 * det_10_32 + m02 * det_10_31);\r\n var cofact_30 = -(m01 * det_12_23 - m02 * det_11_23 + m03 * det_11_22);\r\n var cofact_31 = +(m00 * det_12_23 - m02 * det_10_23 + m03 * det_10_22);\r\n var cofact_32 = -(m00 * det_11_23 - m01 * det_10_23 + m03 * det_10_21);\r\n var cofact_33 = +(m00 * det_11_22 - m01 * det_10_22 + m02 * det_10_21);\r\n Matrix.FromValuesToRef(cofact_00 * detInv, cofact_10 * detInv, cofact_20 * detInv, cofact_30 * detInv, cofact_01 * detInv, cofact_11 * detInv, cofact_21 * detInv, cofact_31 * detInv, cofact_02 * detInv, cofact_12 * detInv, cofact_22 * detInv, cofact_32 * detInv, cofact_03 * detInv, cofact_13 * detInv, cofact_23 * detInv, cofact_33 * detInv, other);\r\n return this;\r\n };\r\n /**\r\n * add a value at the specified position in the current Matrix\r\n * @param index the index of the value within the matrix. between 0 and 15.\r\n * @param value the value to be added\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.addAtIndex = function (index, value) {\r\n this._m[index] += value;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * mutiply the specified position in the current Matrix by a value\r\n * @param index the index of the value within the matrix. between 0 and 15.\r\n * @param value the value to be added\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.multiplyAtIndex = function (index, value) {\r\n this._m[index] *= value;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Inserts the translation vector (using 3 floats) in the current matrix\r\n * @param x defines the 1st component of the translation\r\n * @param y defines the 2nd component of the translation\r\n * @param z defines the 3rd component of the translation\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.setTranslationFromFloats = function (x, y, z) {\r\n this._m[12] = x;\r\n this._m[13] = y;\r\n this._m[14] = z;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Adds the translation vector (using 3 floats) in the current matrix\r\n * @param x defines the 1st component of the translation\r\n * @param y defines the 2nd component of the translation\r\n * @param z defines the 3rd component of the translation\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.addTranslationFromFloats = function (x, y, z) {\r\n this._m[12] += x;\r\n this._m[13] += y;\r\n this._m[14] += z;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Inserts the translation vector in the current matrix\r\n * @param vector3 defines the translation to insert\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.setTranslation = function (vector3) {\r\n return this.setTranslationFromFloats(vector3._x, vector3._y, vector3._z);\r\n };\r\n /**\r\n * Gets the translation value of the current matrix\r\n * @returns a new Vector3 as the extracted translation from the matrix\r\n */\r\n Matrix.prototype.getTranslation = function () {\r\n return new Vector3(this._m[12], this._m[13], this._m[14]);\r\n };\r\n /**\r\n * Fill a Vector3 with the extracted translation from the matrix\r\n * @param result defines the Vector3 where to store the translation\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.getTranslationToRef = function (result) {\r\n result.x = this._m[12];\r\n result.y = this._m[13];\r\n result.z = this._m[14];\r\n return this;\r\n };\r\n /**\r\n * Remove rotation and scaling part from the matrix\r\n * @returns the updated matrix\r\n */\r\n Matrix.prototype.removeRotationAndScaling = function () {\r\n var m = this.m;\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, m[12], m[13], m[14], m[15], this);\r\n this._updateIdentityStatus(m[12] === 0 && m[13] === 0 && m[14] === 0 && m[15] === 1);\r\n return this;\r\n };\r\n /**\r\n * Multiply two matrices\r\n * @param other defines the second operand\r\n * @returns a new matrix set with the multiplication result of the current Matrix and the given one\r\n */\r\n Matrix.prototype.multiply = function (other) {\r\n var result = new Matrix();\r\n this.multiplyToRef(other, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the current matrix from the given one\r\n * @param other defines the source matrix\r\n * @returns the current updated matrix\r\n */\r\n Matrix.prototype.copyFrom = function (other) {\r\n other.copyToArray(this._m);\r\n var o = other;\r\n this._updateIdentityStatus(o._isIdentity, o._isIdentityDirty, o._isIdentity3x2, o._isIdentity3x2Dirty);\r\n return this;\r\n };\r\n /**\r\n * Populates the given array from the starting index with the current matrix values\r\n * @param array defines the target array\r\n * @param offset defines the offset in the target array where to start storing values\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.copyToArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n var source = this._m;\r\n array[offset] = source[0];\r\n array[offset + 1] = source[1];\r\n array[offset + 2] = source[2];\r\n array[offset + 3] = source[3];\r\n array[offset + 4] = source[4];\r\n array[offset + 5] = source[5];\r\n array[offset + 6] = source[6];\r\n array[offset + 7] = source[7];\r\n array[offset + 8] = source[8];\r\n array[offset + 9] = source[9];\r\n array[offset + 10] = source[10];\r\n array[offset + 11] = source[11];\r\n array[offset + 12] = source[12];\r\n array[offset + 13] = source[13];\r\n array[offset + 14] = source[14];\r\n array[offset + 15] = source[15];\r\n return this;\r\n };\r\n /**\r\n * Sets the given matrix \"result\" with the multiplication result of the current Matrix and the given one\r\n * @param other defines the second operand\r\n * @param result defines the matrix where to store the multiplication\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.multiplyToRef = function (other, result) {\r\n if (this._isIdentity) {\r\n result.copyFrom(other);\r\n return this;\r\n }\r\n if (other._isIdentity) {\r\n result.copyFrom(this);\r\n return this;\r\n }\r\n this.multiplyToArray(other, result._m, 0);\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Sets the Float32Array \"result\" from the given index \"offset\" with the multiplication of the current matrix and the given one\r\n * @param other defines the second operand\r\n * @param result defines the array where to store the multiplication\r\n * @param offset defines the offset in the target array where to start storing values\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.multiplyToArray = function (other, result, offset) {\r\n var m = this._m;\r\n var otherM = other.m;\r\n var tm0 = m[0], tm1 = m[1], tm2 = m[2], tm3 = m[3];\r\n var tm4 = m[4], tm5 = m[5], tm6 = m[6], tm7 = m[7];\r\n var tm8 = m[8], tm9 = m[9], tm10 = m[10], tm11 = m[11];\r\n var tm12 = m[12], tm13 = m[13], tm14 = m[14], tm15 = m[15];\r\n var om0 = otherM[0], om1 = otherM[1], om2 = otherM[2], om3 = otherM[3];\r\n var om4 = otherM[4], om5 = otherM[5], om6 = otherM[6], om7 = otherM[7];\r\n var om8 = otherM[8], om9 = otherM[9], om10 = otherM[10], om11 = otherM[11];\r\n var om12 = otherM[12], om13 = otherM[13], om14 = otherM[14], om15 = otherM[15];\r\n result[offset] = tm0 * om0 + tm1 * om4 + tm2 * om8 + tm3 * om12;\r\n result[offset + 1] = tm0 * om1 + tm1 * om5 + tm2 * om9 + tm3 * om13;\r\n result[offset + 2] = tm0 * om2 + tm1 * om6 + tm2 * om10 + tm3 * om14;\r\n result[offset + 3] = tm0 * om3 + tm1 * om7 + tm2 * om11 + tm3 * om15;\r\n result[offset + 4] = tm4 * om0 + tm5 * om4 + tm6 * om8 + tm7 * om12;\r\n result[offset + 5] = tm4 * om1 + tm5 * om5 + tm6 * om9 + tm7 * om13;\r\n result[offset + 6] = tm4 * om2 + tm5 * om6 + tm6 * om10 + tm7 * om14;\r\n result[offset + 7] = tm4 * om3 + tm5 * om7 + tm6 * om11 + tm7 * om15;\r\n result[offset + 8] = tm8 * om0 + tm9 * om4 + tm10 * om8 + tm11 * om12;\r\n result[offset + 9] = tm8 * om1 + tm9 * om5 + tm10 * om9 + tm11 * om13;\r\n result[offset + 10] = tm8 * om2 + tm9 * om6 + tm10 * om10 + tm11 * om14;\r\n result[offset + 11] = tm8 * om3 + tm9 * om7 + tm10 * om11 + tm11 * om15;\r\n result[offset + 12] = tm12 * om0 + tm13 * om4 + tm14 * om8 + tm15 * om12;\r\n result[offset + 13] = tm12 * om1 + tm13 * om5 + tm14 * om9 + tm15 * om13;\r\n result[offset + 14] = tm12 * om2 + tm13 * om6 + tm14 * om10 + tm15 * om14;\r\n result[offset + 15] = tm12 * om3 + tm13 * om7 + tm14 * om11 + tm15 * om15;\r\n return this;\r\n };\r\n /**\r\n * Check equality between this matrix and a second one\r\n * @param value defines the second matrix to compare\r\n * @returns true is the current matrix and the given one values are strictly equal\r\n */\r\n Matrix.prototype.equals = function (value) {\r\n var other = value;\r\n if (!other) {\r\n return false;\r\n }\r\n if (this._isIdentity || other._isIdentity) {\r\n if (!this._isIdentityDirty && !other._isIdentityDirty) {\r\n return this._isIdentity && other._isIdentity;\r\n }\r\n }\r\n var m = this.m;\r\n var om = other.m;\r\n return (m[0] === om[0] && m[1] === om[1] && m[2] === om[2] && m[3] === om[3] &&\r\n m[4] === om[4] && m[5] === om[5] && m[6] === om[6] && m[7] === om[7] &&\r\n m[8] === om[8] && m[9] === om[9] && m[10] === om[10] && m[11] === om[11] &&\r\n m[12] === om[12] && m[13] === om[13] && m[14] === om[14] && m[15] === om[15]);\r\n };\r\n /**\r\n * Clone the current matrix\r\n * @returns a new matrix from the current matrix\r\n */\r\n Matrix.prototype.clone = function () {\r\n var matrix = new Matrix();\r\n matrix.copyFrom(this);\r\n return matrix;\r\n };\r\n /**\r\n * Returns the name of the current matrix class\r\n * @returns the string \"Matrix\"\r\n */\r\n Matrix.prototype.getClassName = function () {\r\n return \"Matrix\";\r\n };\r\n /**\r\n * Gets the hash code of the current matrix\r\n * @returns the hash code\r\n */\r\n Matrix.prototype.getHashCode = function () {\r\n var hash = this._m[0] | 0;\r\n for (var i = 1; i < 16; i++) {\r\n hash = (hash * 397) ^ (this._m[i] | 0);\r\n }\r\n return hash;\r\n };\r\n /**\r\n * Decomposes the current Matrix into a translation, rotation and scaling components\r\n * @param scale defines the scale vector3 given as a reference to update\r\n * @param rotation defines the rotation quaternion given as a reference to update\r\n * @param translation defines the translation vector3 given as a reference to update\r\n * @returns true if operation was successful\r\n */\r\n Matrix.prototype.decompose = function (scale, rotation, translation) {\r\n if (this._isIdentity) {\r\n if (translation) {\r\n translation.setAll(0);\r\n }\r\n if (scale) {\r\n scale.setAll(1);\r\n }\r\n if (rotation) {\r\n rotation.copyFromFloats(0, 0, 0, 1);\r\n }\r\n return true;\r\n }\r\n var m = this._m;\r\n if (translation) {\r\n translation.copyFromFloats(m[12], m[13], m[14]);\r\n }\r\n scale = scale || MathTmp.Vector3[0];\r\n scale.x = Math.sqrt(m[0] * m[0] + m[1] * m[1] + m[2] * m[2]);\r\n scale.y = Math.sqrt(m[4] * m[4] + m[5] * m[5] + m[6] * m[6]);\r\n scale.z = Math.sqrt(m[8] * m[8] + m[9] * m[9] + m[10] * m[10]);\r\n if (this.determinant() <= 0) {\r\n scale.y *= -1;\r\n }\r\n if (scale._x === 0 || scale._y === 0 || scale._z === 0) {\r\n if (rotation) {\r\n rotation.copyFromFloats(0.0, 0.0, 0.0, 1.0);\r\n }\r\n return false;\r\n }\r\n if (rotation) {\r\n var sx = 1 / scale._x, sy = 1 / scale._y, sz = 1 / scale._z;\r\n Matrix.FromValuesToRef(m[0] * sx, m[1] * sx, m[2] * sx, 0.0, m[4] * sy, m[5] * sy, m[6] * sy, 0.0, m[8] * sz, m[9] * sz, m[10] * sz, 0.0, 0.0, 0.0, 0.0, 1.0, MathTmp.Matrix[0]);\r\n Quaternion.FromRotationMatrixToRef(MathTmp.Matrix[0], rotation);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Gets specific row of the matrix\r\n * @param index defines the number of the row to get\r\n * @returns the index-th row of the current matrix as a new Vector4\r\n */\r\n Matrix.prototype.getRow = function (index) {\r\n if (index < 0 || index > 3) {\r\n return null;\r\n }\r\n var i = index * 4;\r\n return new Vector4(this._m[i + 0], this._m[i + 1], this._m[i + 2], this._m[i + 3]);\r\n };\r\n /**\r\n * Sets the index-th row of the current matrix to the vector4 values\r\n * @param index defines the number of the row to set\r\n * @param row defines the target vector4\r\n * @returns the updated current matrix\r\n */\r\n Matrix.prototype.setRow = function (index, row) {\r\n return this.setRowFromFloats(index, row.x, row.y, row.z, row.w);\r\n };\r\n /**\r\n * Compute the transpose of the matrix\r\n * @returns the new transposed matrix\r\n */\r\n Matrix.prototype.transpose = function () {\r\n return Matrix.Transpose(this);\r\n };\r\n /**\r\n * Compute the transpose of the matrix and store it in a given matrix\r\n * @param result defines the target matrix\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.transposeToRef = function (result) {\r\n Matrix.TransposeToRef(this, result);\r\n return this;\r\n };\r\n /**\r\n * Sets the index-th row of the current matrix with the given 4 x float values\r\n * @param index defines the row index\r\n * @param x defines the x component to set\r\n * @param y defines the y component to set\r\n * @param z defines the z component to set\r\n * @param w defines the w component to set\r\n * @returns the updated current matrix\r\n */\r\n Matrix.prototype.setRowFromFloats = function (index, x, y, z, w) {\r\n if (index < 0 || index > 3) {\r\n return this;\r\n }\r\n var i = index * 4;\r\n this._m[i + 0] = x;\r\n this._m[i + 1] = y;\r\n this._m[i + 2] = z;\r\n this._m[i + 3] = w;\r\n this._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Compute a new matrix set with the current matrix values multiplied by scale (float)\r\n * @param scale defines the scale factor\r\n * @returns a new matrix\r\n */\r\n Matrix.prototype.scale = function (scale) {\r\n var result = new Matrix();\r\n this.scaleToRef(scale, result);\r\n return result;\r\n };\r\n /**\r\n * Scale the current matrix values by a factor to a given result matrix\r\n * @param scale defines the scale factor\r\n * @param result defines the matrix to store the result\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.scaleToRef = function (scale, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] = this._m[index] * scale;\r\n }\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Scale the current matrix values by a factor and add the result to a given matrix\r\n * @param scale defines the scale factor\r\n * @param result defines the Matrix to store the result\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.scaleAndAddToRef = function (scale, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] += this._m[index] * scale;\r\n }\r\n result._markAsUpdated();\r\n return this;\r\n };\r\n /**\r\n * Writes to the given matrix a normal matrix, computed from this one (using values from identity matrix for fourth row and column).\r\n * @param ref matrix to store the result\r\n */\r\n Matrix.prototype.toNormalMatrix = function (ref) {\r\n var tmp = MathTmp.Matrix[0];\r\n this.invertToRef(tmp);\r\n tmp.transposeToRef(ref);\r\n var m = ref._m;\r\n Matrix.FromValuesToRef(m[0], m[1], m[2], 0.0, m[4], m[5], m[6], 0.0, m[8], m[9], m[10], 0.0, 0.0, 0.0, 0.0, 1.0, ref);\r\n };\r\n /**\r\n * Gets only rotation part of the current matrix\r\n * @returns a new matrix sets to the extracted rotation matrix from the current one\r\n */\r\n Matrix.prototype.getRotationMatrix = function () {\r\n var result = new Matrix();\r\n this.getRotationMatrixToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Extracts the rotation matrix from the current one and sets it as the given \"result\"\r\n * @param result defines the target matrix to store data to\r\n * @returns the current matrix\r\n */\r\n Matrix.prototype.getRotationMatrixToRef = function (result) {\r\n var scale = MathTmp.Vector3[0];\r\n if (!this.decompose(scale)) {\r\n Matrix.IdentityToRef(result);\r\n return this;\r\n }\r\n var m = this._m;\r\n var sx = 1 / scale._x, sy = 1 / scale._y, sz = 1 / scale._z;\r\n Matrix.FromValuesToRef(m[0] * sx, m[1] * sx, m[2] * sx, 0.0, m[4] * sy, m[5] * sy, m[6] * sy, 0.0, m[8] * sz, m[9] * sz, m[10] * sz, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n return this;\r\n };\r\n /**\r\n * Toggles model matrix from being right handed to left handed in place and vice versa\r\n */\r\n Matrix.prototype.toggleModelMatrixHandInPlace = function () {\r\n var m = this._m;\r\n m[2] *= -1;\r\n m[6] *= -1;\r\n m[8] *= -1;\r\n m[9] *= -1;\r\n m[14] *= -1;\r\n this._markAsUpdated();\r\n };\r\n /**\r\n * Toggles projection matrix from being right handed to left handed in place and vice versa\r\n */\r\n Matrix.prototype.toggleProjectionMatrixHandInPlace = function () {\r\n var m = this._m;\r\n m[8] *= -1;\r\n m[9] *= -1;\r\n m[10] *= -1;\r\n m[11] *= -1;\r\n this._markAsUpdated();\r\n };\r\n // Statics\r\n /**\r\n * Creates a matrix from an array\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @returns a new Matrix set from the starting index of the given array\r\n */\r\n Matrix.FromArray = function (array, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n var result = new Matrix();\r\n Matrix.FromArrayToRef(array, offset, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the content of an array into a given matrix\r\n * @param array defines the source array\r\n * @param offset defines an offset in the source array\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromArrayToRef = function (array, offset, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] = array[index + offset];\r\n }\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Stores an array into a matrix after having multiplied each component by a given factor\r\n * @param array defines the source array\r\n * @param offset defines the offset in the source array\r\n * @param scale defines the scaling factor\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromFloat32ArrayToRefScaled = function (array, offset, scale, result) {\r\n for (var index = 0; index < 16; index++) {\r\n result._m[index] = array[index + offset] * scale;\r\n }\r\n result._markAsUpdated();\r\n };\r\n Object.defineProperty(Matrix, \"IdentityReadOnly\", {\r\n /**\r\n * Gets an identity matrix that must not be updated\r\n */\r\n get: function () {\r\n return Matrix._identityReadOnly;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Stores a list of values (16) inside a given matrix\r\n * @param initialM11 defines 1st value of 1st row\r\n * @param initialM12 defines 2nd value of 1st row\r\n * @param initialM13 defines 3rd value of 1st row\r\n * @param initialM14 defines 4th value of 1st row\r\n * @param initialM21 defines 1st value of 2nd row\r\n * @param initialM22 defines 2nd value of 2nd row\r\n * @param initialM23 defines 3rd value of 2nd row\r\n * @param initialM24 defines 4th value of 2nd row\r\n * @param initialM31 defines 1st value of 3rd row\r\n * @param initialM32 defines 2nd value of 3rd row\r\n * @param initialM33 defines 3rd value of 3rd row\r\n * @param initialM34 defines 4th value of 3rd row\r\n * @param initialM41 defines 1st value of 4th row\r\n * @param initialM42 defines 2nd value of 4th row\r\n * @param initialM43 defines 3rd value of 4th row\r\n * @param initialM44 defines 4th value of 4th row\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromValuesToRef = function (initialM11, initialM12, initialM13, initialM14, initialM21, initialM22, initialM23, initialM24, initialM31, initialM32, initialM33, initialM34, initialM41, initialM42, initialM43, initialM44, result) {\r\n var m = result._m;\r\n m[0] = initialM11;\r\n m[1] = initialM12;\r\n m[2] = initialM13;\r\n m[3] = initialM14;\r\n m[4] = initialM21;\r\n m[5] = initialM22;\r\n m[6] = initialM23;\r\n m[7] = initialM24;\r\n m[8] = initialM31;\r\n m[9] = initialM32;\r\n m[10] = initialM33;\r\n m[11] = initialM34;\r\n m[12] = initialM41;\r\n m[13] = initialM42;\r\n m[14] = initialM43;\r\n m[15] = initialM44;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates new matrix from a list of values (16)\r\n * @param initialM11 defines 1st value of 1st row\r\n * @param initialM12 defines 2nd value of 1st row\r\n * @param initialM13 defines 3rd value of 1st row\r\n * @param initialM14 defines 4th value of 1st row\r\n * @param initialM21 defines 1st value of 2nd row\r\n * @param initialM22 defines 2nd value of 2nd row\r\n * @param initialM23 defines 3rd value of 2nd row\r\n * @param initialM24 defines 4th value of 2nd row\r\n * @param initialM31 defines 1st value of 3rd row\r\n * @param initialM32 defines 2nd value of 3rd row\r\n * @param initialM33 defines 3rd value of 3rd row\r\n * @param initialM34 defines 4th value of 3rd row\r\n * @param initialM41 defines 1st value of 4th row\r\n * @param initialM42 defines 2nd value of 4th row\r\n * @param initialM43 defines 3rd value of 4th row\r\n * @param initialM44 defines 4th value of 4th row\r\n * @returns the new matrix\r\n */\r\n Matrix.FromValues = function (initialM11, initialM12, initialM13, initialM14, initialM21, initialM22, initialM23, initialM24, initialM31, initialM32, initialM33, initialM34, initialM41, initialM42, initialM43, initialM44) {\r\n var result = new Matrix();\r\n var m = result._m;\r\n m[0] = initialM11;\r\n m[1] = initialM12;\r\n m[2] = initialM13;\r\n m[3] = initialM14;\r\n m[4] = initialM21;\r\n m[5] = initialM22;\r\n m[6] = initialM23;\r\n m[7] = initialM24;\r\n m[8] = initialM31;\r\n m[9] = initialM32;\r\n m[10] = initialM33;\r\n m[11] = initialM34;\r\n m[12] = initialM41;\r\n m[13] = initialM42;\r\n m[14] = initialM43;\r\n m[15] = initialM44;\r\n result._markAsUpdated();\r\n return result;\r\n };\r\n /**\r\n * Creates a new matrix composed by merging scale (vector3), rotation (quaternion) and translation (vector3)\r\n * @param scale defines the scale vector3\r\n * @param rotation defines the rotation quaternion\r\n * @param translation defines the translation vector3\r\n * @returns a new matrix\r\n */\r\n Matrix.Compose = function (scale, rotation, translation) {\r\n var result = new Matrix();\r\n Matrix.ComposeToRef(scale, rotation, translation, result);\r\n return result;\r\n };\r\n /**\r\n * Sets a matrix to a value composed by merging scale (vector3), rotation (quaternion) and translation (vector3)\r\n * @param scale defines the scale vector3\r\n * @param rotation defines the rotation quaternion\r\n * @param translation defines the translation vector3\r\n * @param result defines the target matrix\r\n */\r\n Matrix.ComposeToRef = function (scale, rotation, translation, result) {\r\n var m = result._m;\r\n var x = rotation._x, y = rotation._y, z = rotation._z, w = rotation._w;\r\n var x2 = x + x, y2 = y + y, z2 = z + z;\r\n var xx = x * x2, xy = x * y2, xz = x * z2;\r\n var yy = y * y2, yz = y * z2, zz = z * z2;\r\n var wx = w * x2, wy = w * y2, wz = w * z2;\r\n var sx = scale._x, sy = scale._y, sz = scale._z;\r\n m[0] = (1 - (yy + zz)) * sx;\r\n m[1] = (xy + wz) * sx;\r\n m[2] = (xz - wy) * sx;\r\n m[3] = 0;\r\n m[4] = (xy - wz) * sy;\r\n m[5] = (1 - (xx + zz)) * sy;\r\n m[6] = (yz + wx) * sy;\r\n m[7] = 0;\r\n m[8] = (xz + wy) * sz;\r\n m[9] = (yz - wx) * sz;\r\n m[10] = (1 - (xx + yy)) * sz;\r\n m[11] = 0;\r\n m[12] = translation._x;\r\n m[13] = translation._y;\r\n m[14] = translation._z;\r\n m[15] = 1;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates a new identity matrix\r\n * @returns a new identity matrix\r\n */\r\n Matrix.Identity = function () {\r\n var identity = Matrix.FromValues(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);\r\n identity._updateIdentityStatus(true);\r\n return identity;\r\n };\r\n /**\r\n * Creates a new identity matrix and stores the result in a given matrix\r\n * @param result defines the target matrix\r\n */\r\n Matrix.IdentityToRef = function (result) {\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(true);\r\n };\r\n /**\r\n * Creates a new zero matrix\r\n * @returns a new zero matrix\r\n */\r\n Matrix.Zero = function () {\r\n var zero = Matrix.FromValues(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);\r\n zero._updateIdentityStatus(false);\r\n return zero;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the X axis\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationX = function (angle) {\r\n var result = new Matrix();\r\n Matrix.RotationXToRef(angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new matrix as the invert of a given matrix\r\n * @param source defines the source matrix\r\n * @returns the new matrix\r\n */\r\n Matrix.Invert = function (source) {\r\n var result = new Matrix();\r\n source.invertToRef(result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the X axis and stores it in a given matrix\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationXToRef = function (angle, result) {\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, c, s, 0.0, 0.0, -s, c, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(c === 1 && s === 0);\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Y axis\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationY = function (angle) {\r\n var result = new Matrix();\r\n Matrix.RotationYToRef(angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Y axis and stores it in a given matrix\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationYToRef = function (angle, result) {\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n Matrix.FromValuesToRef(c, 0.0, -s, 0.0, 0.0, 1.0, 0.0, 0.0, s, 0.0, c, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(c === 1 && s === 0);\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Z axis\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationZ = function (angle) {\r\n var result = new Matrix();\r\n Matrix.RotationZToRef(angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the Z axis and stores it in a given matrix\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationZToRef = function (angle, result) {\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n Matrix.FromValuesToRef(c, s, 0.0, 0.0, -s, c, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(c === 1 && s === 0);\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the given axis\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle (in radians) to use\r\n * @return the new matrix\r\n */\r\n Matrix.RotationAxis = function (axis, angle) {\r\n var result = new Matrix();\r\n Matrix.RotationAxisToRef(axis, angle, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a new rotation matrix for \"angle\" radians around the given axis and stores it in a given matrix\r\n * @param axis defines the axis to use\r\n * @param angle defines the angle (in radians) to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationAxisToRef = function (axis, angle, result) {\r\n var s = Math.sin(-angle);\r\n var c = Math.cos(-angle);\r\n var c1 = 1 - c;\r\n axis.normalize();\r\n var m = result._m;\r\n m[0] = (axis._x * axis._x) * c1 + c;\r\n m[1] = (axis._x * axis._y) * c1 - (axis._z * s);\r\n m[2] = (axis._x * axis._z) * c1 + (axis._y * s);\r\n m[3] = 0.0;\r\n m[4] = (axis._y * axis._x) * c1 + (axis._z * s);\r\n m[5] = (axis._y * axis._y) * c1 + c;\r\n m[6] = (axis._y * axis._z) * c1 - (axis._x * s);\r\n m[7] = 0.0;\r\n m[8] = (axis._z * axis._x) * c1 - (axis._y * s);\r\n m[9] = (axis._z * axis._y) * c1 + (axis._x * s);\r\n m[10] = (axis._z * axis._z) * c1 + c;\r\n m[11] = 0.0;\r\n m[12] = 0.0;\r\n m[13] = 0.0;\r\n m[14] = 0.0;\r\n m[15] = 1.0;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Takes normalised vectors and returns a rotation matrix to align \"from\" with \"to\".\r\n * Taken from http://www.iquilezles.org/www/articles/noacos/noacos.htm\r\n * @param from defines the vector to align\r\n * @param to defines the vector to align to\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationAlignToRef = function (from, to, result) {\r\n var v = Vector3.Cross(to, from);\r\n var c = Vector3.Dot(to, from);\r\n var k = 1 / (1 + c);\r\n var m = result._m;\r\n m[0] = v._x * v._x * k + c;\r\n m[1] = v._y * v._x * k - v._z;\r\n m[2] = v._z * v._x * k + v._y;\r\n m[3] = 0;\r\n m[4] = v._x * v._y * k + v._z;\r\n m[5] = v._y * v._y * k + c;\r\n m[6] = v._z * v._y * k - v._x;\r\n m[7] = 0;\r\n m[8] = v._x * v._z * k - v._y;\r\n m[9] = v._y * v._z * k + v._x;\r\n m[10] = v._z * v._z * k + c;\r\n m[11] = 0;\r\n m[12] = 0;\r\n m[13] = 0;\r\n m[14] = 0;\r\n m[15] = 1;\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates a rotation matrix\r\n * @param yaw defines the yaw angle in radians (Y axis)\r\n * @param pitch defines the pitch angle in radians (X axis)\r\n * @param roll defines the roll angle in radians (Z axis)\r\n * @returns the new rotation matrix\r\n */\r\n Matrix.RotationYawPitchRoll = function (yaw, pitch, roll) {\r\n var result = new Matrix();\r\n Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a rotation matrix and stores it in a given matrix\r\n * @param yaw defines the yaw angle in radians (Y axis)\r\n * @param pitch defines the pitch angle in radians (X axis)\r\n * @param roll defines the roll angle in radians (Z axis)\r\n * @param result defines the target matrix\r\n */\r\n Matrix.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {\r\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, MathTmp.Quaternion[0]);\r\n MathTmp.Quaternion[0].toRotationMatrix(result);\r\n };\r\n /**\r\n * Creates a scaling matrix\r\n * @param x defines the scale factor on X axis\r\n * @param y defines the scale factor on Y axis\r\n * @param z defines the scale factor on Z axis\r\n * @returns the new matrix\r\n */\r\n Matrix.Scaling = function (x, y, z) {\r\n var result = new Matrix();\r\n Matrix.ScalingToRef(x, y, z, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a scaling matrix and stores it in a given matrix\r\n * @param x defines the scale factor on X axis\r\n * @param y defines the scale factor on Y axis\r\n * @param z defines the scale factor on Z axis\r\n * @param result defines the target matrix\r\n */\r\n Matrix.ScalingToRef = function (x, y, z, result) {\r\n Matrix.FromValuesToRef(x, 0.0, 0.0, 0.0, 0.0, y, 0.0, 0.0, 0.0, 0.0, z, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n result._updateIdentityStatus(x === 1 && y === 1 && z === 1);\r\n };\r\n /**\r\n * Creates a translation matrix\r\n * @param x defines the translation on X axis\r\n * @param y defines the translation on Y axis\r\n * @param z defines the translationon Z axis\r\n * @returns the new matrix\r\n */\r\n Matrix.Translation = function (x, y, z) {\r\n var result = new Matrix();\r\n Matrix.TranslationToRef(x, y, z, result);\r\n return result;\r\n };\r\n /**\r\n * Creates a translation matrix and stores it in a given matrix\r\n * @param x defines the translation on X axis\r\n * @param y defines the translation on Y axis\r\n * @param z defines the translationon Z axis\r\n * @param result defines the target matrix\r\n */\r\n Matrix.TranslationToRef = function (x, y, z, result) {\r\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, x, y, z, 1.0, result);\r\n result._updateIdentityStatus(x === 0 && y === 0 && z === 0);\r\n };\r\n /**\r\n * Returns a new Matrix whose values are the interpolated values for \"gradient\" (float) between the ones of the matrices \"startValue\" and \"endValue\".\r\n * @param startValue defines the start value\r\n * @param endValue defines the end value\r\n * @param gradient defines the gradient factor\r\n * @returns the new matrix\r\n */\r\n Matrix.Lerp = function (startValue, endValue, gradient) {\r\n var result = new Matrix();\r\n Matrix.LerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n };\r\n /**\r\n * Set the given matrix \"result\" as the interpolated values for \"gradient\" (float) between the ones of the matrices \"startValue\" and \"endValue\".\r\n * @param startValue defines the start value\r\n * @param endValue defines the end value\r\n * @param gradient defines the gradient factor\r\n * @param result defines the Matrix object where to store data\r\n */\r\n Matrix.LerpToRef = function (startValue, endValue, gradient, result) {\r\n var resultM = result._m;\r\n var startM = startValue.m;\r\n var endM = endValue.m;\r\n for (var index = 0; index < 16; index++) {\r\n resultM[index] = startM[index] * (1.0 - gradient) + endM[index] * gradient;\r\n }\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Builds a new matrix whose values are computed by:\r\n * * decomposing the the \"startValue\" and \"endValue\" matrices into their respective scale, rotation and translation matrices\r\n * * interpolating for \"gradient\" (float) the values between each of these decomposed matrices between the start and the end\r\n * * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices\r\n * @param startValue defines the first matrix\r\n * @param endValue defines the second matrix\r\n * @param gradient defines the gradient between the two matrices\r\n * @returns the new matrix\r\n */\r\n Matrix.DecomposeLerp = function (startValue, endValue, gradient) {\r\n var result = new Matrix();\r\n Matrix.DecomposeLerpToRef(startValue, endValue, gradient, result);\r\n return result;\r\n };\r\n /**\r\n * Update a matrix to values which are computed by:\r\n * * decomposing the the \"startValue\" and \"endValue\" matrices into their respective scale, rotation and translation matrices\r\n * * interpolating for \"gradient\" (float) the values between each of these decomposed matrices between the start and the end\r\n * * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices\r\n * @param startValue defines the first matrix\r\n * @param endValue defines the second matrix\r\n * @param gradient defines the gradient between the two matrices\r\n * @param result defines the target matrix\r\n */\r\n Matrix.DecomposeLerpToRef = function (startValue, endValue, gradient, result) {\r\n var startScale = MathTmp.Vector3[0];\r\n var startRotation = MathTmp.Quaternion[0];\r\n var startTranslation = MathTmp.Vector3[1];\r\n startValue.decompose(startScale, startRotation, startTranslation);\r\n var endScale = MathTmp.Vector3[2];\r\n var endRotation = MathTmp.Quaternion[1];\r\n var endTranslation = MathTmp.Vector3[3];\r\n endValue.decompose(endScale, endRotation, endTranslation);\r\n var resultScale = MathTmp.Vector3[4];\r\n Vector3.LerpToRef(startScale, endScale, gradient, resultScale);\r\n var resultRotation = MathTmp.Quaternion[2];\r\n Quaternion.SlerpToRef(startRotation, endRotation, gradient, resultRotation);\r\n var resultTranslation = MathTmp.Vector3[5];\r\n Vector3.LerpToRef(startTranslation, endTranslation, gradient, resultTranslation);\r\n Matrix.ComposeToRef(resultScale, resultRotation, resultTranslation, result);\r\n };\r\n /**\r\n * Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\"\r\n * This function works in left handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @returns the new matrix\r\n */\r\n Matrix.LookAtLH = function (eye, target, up) {\r\n var result = new Matrix();\r\n Matrix.LookAtLHToRef(eye, target, up, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given \"result\" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\".\r\n * This function works in left handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @param result defines the target matrix\r\n */\r\n Matrix.LookAtLHToRef = function (eye, target, up, result) {\r\n var xAxis = MathTmp.Vector3[0];\r\n var yAxis = MathTmp.Vector3[1];\r\n var zAxis = MathTmp.Vector3[2];\r\n // Z axis\r\n target.subtractToRef(eye, zAxis);\r\n zAxis.normalize();\r\n // X axis\r\n Vector3.CrossToRef(up, zAxis, xAxis);\r\n var xSquareLength = xAxis.lengthSquared();\r\n if (xSquareLength === 0) {\r\n xAxis.x = 1.0;\r\n }\r\n else {\r\n xAxis.normalizeFromLength(Math.sqrt(xSquareLength));\r\n }\r\n // Y axis\r\n Vector3.CrossToRef(zAxis, xAxis, yAxis);\r\n yAxis.normalize();\r\n // Eye angles\r\n var ex = -Vector3.Dot(xAxis, eye);\r\n var ey = -Vector3.Dot(yAxis, eye);\r\n var ez = -Vector3.Dot(zAxis, eye);\r\n Matrix.FromValuesToRef(xAxis._x, yAxis._x, zAxis._x, 0.0, xAxis._y, yAxis._y, zAxis._y, 0.0, xAxis._z, yAxis._z, zAxis._z, 0.0, ex, ey, ez, 1.0, result);\r\n };\r\n /**\r\n * Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\"\r\n * This function works in right handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @returns the new matrix\r\n */\r\n Matrix.LookAtRH = function (eye, target, up) {\r\n var result = new Matrix();\r\n Matrix.LookAtRHToRef(eye, target, up, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the given \"result\" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like \"up\".\r\n * This function works in right handed mode\r\n * @param eye defines the final position of the entity\r\n * @param target defines where the entity should look at\r\n * @param up defines the up vector for the entity\r\n * @param result defines the target matrix\r\n */\r\n Matrix.LookAtRHToRef = function (eye, target, up, result) {\r\n var xAxis = MathTmp.Vector3[0];\r\n var yAxis = MathTmp.Vector3[1];\r\n var zAxis = MathTmp.Vector3[2];\r\n // Z axis\r\n eye.subtractToRef(target, zAxis);\r\n zAxis.normalize();\r\n // X axis\r\n Vector3.CrossToRef(up, zAxis, xAxis);\r\n var xSquareLength = xAxis.lengthSquared();\r\n if (xSquareLength === 0) {\r\n xAxis.x = 1.0;\r\n }\r\n else {\r\n xAxis.normalizeFromLength(Math.sqrt(xSquareLength));\r\n }\r\n // Y axis\r\n Vector3.CrossToRef(zAxis, xAxis, yAxis);\r\n yAxis.normalize();\r\n // Eye angles\r\n var ex = -Vector3.Dot(xAxis, eye);\r\n var ey = -Vector3.Dot(yAxis, eye);\r\n var ez = -Vector3.Dot(zAxis, eye);\r\n Matrix.FromValuesToRef(xAxis._x, yAxis._x, zAxis._x, 0.0, xAxis._y, yAxis._y, zAxis._y, 0.0, xAxis._z, yAxis._z, zAxis._z, 0.0, ex, ey, ez, 1.0, result);\r\n };\r\n /**\r\n * Create a left-handed orthographic projection matrix\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed orthographic projection matrix\r\n */\r\n Matrix.OrthoLH = function (width, height, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.OrthoLHToRef(width, height, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Store a left-handed orthographic projection to a given matrix\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.OrthoLHToRef = function (width, height, znear, zfar, result) {\r\n var n = znear;\r\n var f = zfar;\r\n var a = 2.0 / width;\r\n var b = 2.0 / height;\r\n var c = 2.0 / (f - n);\r\n var d = -(f + n) / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 0.0, 0.0, 0.0, d, 1.0, result);\r\n result._updateIdentityStatus(a === 1 && b === 1 && c === 1 && d === 0);\r\n };\r\n /**\r\n * Create a left-handed orthographic projection matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed orthographic projection matrix\r\n */\r\n Matrix.OrthoOffCenterLH = function (left, right, bottom, top, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.OrthoOffCenterLHToRef(left, right, bottom, top, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a left-handed orthographic projection into a given matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.OrthoOffCenterLHToRef = function (left, right, bottom, top, znear, zfar, result) {\r\n var n = znear;\r\n var f = zfar;\r\n var a = 2.0 / (right - left);\r\n var b = 2.0 / (top - bottom);\r\n var c = 2.0 / (f - n);\r\n var d = -(f + n) / (f - n);\r\n var i0 = (left + right) / (left - right);\r\n var i1 = (top + bottom) / (bottom - top);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 0.0, i0, i1, d, 1.0, result);\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Creates a right-handed orthographic projection matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a right-handed orthographic projection matrix\r\n */\r\n Matrix.OrthoOffCenterRH = function (left, right, bottom, top, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.OrthoOffCenterRHToRef(left, right, bottom, top, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a right-handed orthographic projection into a given matrix\r\n * @param left defines the viewport left coordinate\r\n * @param right defines the viewport right coordinate\r\n * @param bottom defines the viewport bottom coordinate\r\n * @param top defines the viewport top coordinate\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.OrthoOffCenterRHToRef = function (left, right, bottom, top, znear, zfar, result) {\r\n Matrix.OrthoOffCenterLHToRef(left, right, bottom, top, znear, zfar, result);\r\n result._m[10] *= -1; // No need to call _markAsUpdated as previous function already called it and let _isIdentityDirty to true\r\n };\r\n /**\r\n * Creates a left-handed perspective projection matrix\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed perspective projection matrix\r\n */\r\n Matrix.PerspectiveLH = function (width, height, znear, zfar) {\r\n var matrix = new Matrix();\r\n var n = znear;\r\n var f = zfar;\r\n var a = 2.0 * n / width;\r\n var b = 2.0 * n / height;\r\n var c = (f + n) / (f - n);\r\n var d = -2.0 * f * n / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 1.0, 0.0, 0.0, d, 0.0, matrix);\r\n matrix._updateIdentityStatus(false);\r\n return matrix;\r\n };\r\n /**\r\n * Creates a left-handed perspective projection matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a left-handed perspective projection matrix\r\n */\r\n Matrix.PerspectiveFovLH = function (fov, aspect, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.PerspectiveFovLHToRef(fov, aspect, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a left-handed perspective projection into a given matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\r\n */\r\n Matrix.PerspectiveFovLHToRef = function (fov, aspect, znear, zfar, result, isVerticalFovFixed) {\r\n if (isVerticalFovFixed === void 0) { isVerticalFovFixed = true; }\r\n var n = znear;\r\n var f = zfar;\r\n var t = 1.0 / (Math.tan(fov * 0.5));\r\n var a = isVerticalFovFixed ? (t / aspect) : t;\r\n var b = isVerticalFovFixed ? t : (t * aspect);\r\n var c = (f + n) / (f - n);\r\n var d = -2.0 * f * n / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 1.0, 0.0, 0.0, d, 0.0, result);\r\n result._updateIdentityStatus(false);\r\n };\r\n /**\r\n * Stores a left-handed perspective projection into a given matrix with depth reversed\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar not used as infinity is used as far clip\r\n * @param result defines the target matrix\r\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\r\n */\r\n Matrix.PerspectiveFovReverseLHToRef = function (fov, aspect, znear, zfar, result, isVerticalFovFixed) {\r\n if (isVerticalFovFixed === void 0) { isVerticalFovFixed = true; }\r\n var t = 1.0 / (Math.tan(fov * 0.5));\r\n var a = isVerticalFovFixed ? (t / aspect) : t;\r\n var b = isVerticalFovFixed ? t : (t * aspect);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, -znear, 1.0, 0.0, 0.0, 1.0, 0.0, result);\r\n result._updateIdentityStatus(false);\r\n };\r\n /**\r\n * Creates a right-handed perspective projection matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @returns a new matrix as a right-handed perspective projection matrix\r\n */\r\n Matrix.PerspectiveFovRH = function (fov, aspect, znear, zfar) {\r\n var matrix = new Matrix();\r\n Matrix.PerspectiveFovRHToRef(fov, aspect, znear, zfar, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Stores a right-handed perspective projection into a given matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\r\n */\r\n Matrix.PerspectiveFovRHToRef = function (fov, aspect, znear, zfar, result, isVerticalFovFixed) {\r\n //alternatively this could be expressed as:\r\n // m = PerspectiveFovLHToRef\r\n // m[10] *= -1.0;\r\n // m[11] *= -1.0;\r\n if (isVerticalFovFixed === void 0) { isVerticalFovFixed = true; }\r\n var n = znear;\r\n var f = zfar;\r\n var t = 1.0 / (Math.tan(fov * 0.5));\r\n var a = isVerticalFovFixed ? (t / aspect) : t;\r\n var b = isVerticalFovFixed ? t : (t * aspect);\r\n var c = -(f + n) / (f - n);\r\n var d = -2 * f * n / (f - n);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, -1.0, 0.0, 0.0, d, 0.0, result);\r\n result._updateIdentityStatus(false);\r\n };\r\n /**\r\n * Stores a right-handed perspective projection into a given matrix\r\n * @param fov defines the horizontal field of view\r\n * @param aspect defines the aspect ratio\r\n * @param znear defines the near clip plane\r\n * @param zfar not used as infinity is used as far clip\r\n * @param result defines the target matrix\r\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\r\n */\r\n Matrix.PerspectiveFovReverseRHToRef = function (fov, aspect, znear, zfar, result, isVerticalFovFixed) {\r\n //alternatively this could be expressed as:\r\n // m = PerspectiveFovLHToRef\r\n // m[10] *= -1.0;\r\n // m[11] *= -1.0;\r\n if (isVerticalFovFixed === void 0) { isVerticalFovFixed = true; }\r\n var t = 1.0 / (Math.tan(fov * 0.5));\r\n var a = isVerticalFovFixed ? (t / aspect) : t;\r\n var b = isVerticalFovFixed ? t : (t * aspect);\r\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, -znear, -1.0, 0.0, 0.0, -1.0, 0.0, result);\r\n result._updateIdentityStatus(false);\r\n };\r\n /**\r\n * Stores a perspective projection for WebVR info a given matrix\r\n * @param fov defines the field of view\r\n * @param znear defines the near clip plane\r\n * @param zfar defines the far clip plane\r\n * @param result defines the target matrix\r\n * @param rightHanded defines if the matrix must be in right-handed mode (false by default)\r\n */\r\n Matrix.PerspectiveFovWebVRToRef = function (fov, znear, zfar, result, rightHanded) {\r\n if (rightHanded === void 0) { rightHanded = false; }\r\n var rightHandedFactor = rightHanded ? -1 : 1;\r\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\r\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\r\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\r\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\r\n var xScale = 2.0 / (leftTan + rightTan);\r\n var yScale = 2.0 / (upTan + downTan);\r\n var m = result._m;\r\n m[0] = xScale;\r\n m[1] = m[2] = m[3] = m[4] = 0.0;\r\n m[5] = yScale;\r\n m[6] = m[7] = 0.0;\r\n m[8] = ((leftTan - rightTan) * xScale * 0.5);\r\n m[9] = -((upTan - downTan) * yScale * 0.5);\r\n m[10] = -zfar / (znear - zfar);\r\n m[11] = 1.0 * rightHandedFactor;\r\n m[12] = m[13] = m[15] = 0.0;\r\n m[14] = -(2.0 * zfar * znear) / (zfar - znear);\r\n result._markAsUpdated();\r\n };\r\n /**\r\n * Computes a complete transformation matrix\r\n * @param viewport defines the viewport to use\r\n * @param world defines the world matrix\r\n * @param view defines the view matrix\r\n * @param projection defines the projection matrix\r\n * @param zmin defines the near clip plane\r\n * @param zmax defines the far clip plane\r\n * @returns the transformation matrix\r\n */\r\n Matrix.GetFinalMatrix = function (viewport, world, view, projection, zmin, zmax) {\r\n var cw = viewport.width;\r\n var ch = viewport.height;\r\n var cx = viewport.x;\r\n var cy = viewport.y;\r\n var viewportMatrix = Matrix.FromValues(cw / 2.0, 0.0, 0.0, 0.0, 0.0, -ch / 2.0, 0.0, 0.0, 0.0, 0.0, zmax - zmin, 0.0, cx + cw / 2.0, ch / 2.0 + cy, zmin, 1.0);\r\n var matrix = MathTmp.Matrix[0];\r\n world.multiplyToRef(view, matrix);\r\n matrix.multiplyToRef(projection, matrix);\r\n return matrix.multiply(viewportMatrix);\r\n };\r\n /**\r\n * Extracts a 2x2 matrix from a given matrix and store the result in a Float32Array\r\n * @param matrix defines the matrix to use\r\n * @returns a new Float32Array array with 4 elements : the 2x2 matrix extracted from the given matrix\r\n */\r\n Matrix.GetAsMatrix2x2 = function (matrix) {\r\n var m = matrix.m;\r\n var arr = [m[0], m[1], m[4], m[5]];\r\n return PerformanceConfigurator.MatrixUse64Bits ? arr : new Float32Array(arr);\r\n };\r\n /**\r\n * Extracts a 3x3 matrix from a given matrix and store the result in a Float32Array\r\n * @param matrix defines the matrix to use\r\n * @returns a new Float32Array array with 9 elements : the 3x3 matrix extracted from the given matrix\r\n */\r\n Matrix.GetAsMatrix3x3 = function (matrix) {\r\n var m = matrix.m;\r\n var arr = [\r\n m[0], m[1], m[2],\r\n m[4], m[5], m[6],\r\n m[8], m[9], m[10]\r\n ];\r\n return PerformanceConfigurator.MatrixUse64Bits ? arr : new Float32Array(arr);\r\n };\r\n /**\r\n * Compute the transpose of a given matrix\r\n * @param matrix defines the matrix to transpose\r\n * @returns the new matrix\r\n */\r\n Matrix.Transpose = function (matrix) {\r\n var result = new Matrix();\r\n Matrix.TransposeToRef(matrix, result);\r\n return result;\r\n };\r\n /**\r\n * Compute the transpose of a matrix and store it in a target matrix\r\n * @param matrix defines the matrix to transpose\r\n * @param result defines the target matrix\r\n */\r\n Matrix.TransposeToRef = function (matrix, result) {\r\n var rm = result._m;\r\n var mm = matrix.m;\r\n rm[0] = mm[0];\r\n rm[1] = mm[4];\r\n rm[2] = mm[8];\r\n rm[3] = mm[12];\r\n rm[4] = mm[1];\r\n rm[5] = mm[5];\r\n rm[6] = mm[9];\r\n rm[7] = mm[13];\r\n rm[8] = mm[2];\r\n rm[9] = mm[6];\r\n rm[10] = mm[10];\r\n rm[11] = mm[14];\r\n rm[12] = mm[3];\r\n rm[13] = mm[7];\r\n rm[14] = mm[11];\r\n rm[15] = mm[15];\r\n // identity-ness does not change when transposing\r\n result._updateIdentityStatus(matrix._isIdentity, matrix._isIdentityDirty);\r\n };\r\n /**\r\n * Computes a reflection matrix from a plane\r\n * @param plane defines the reflection plane\r\n * @returns a new matrix\r\n */\r\n Matrix.Reflection = function (plane) {\r\n var matrix = new Matrix();\r\n Matrix.ReflectionToRef(plane, matrix);\r\n return matrix;\r\n };\r\n /**\r\n * Computes a reflection matrix from a plane\r\n * @param plane defines the reflection plane\r\n * @param result defines the target matrix\r\n */\r\n Matrix.ReflectionToRef = function (plane, result) {\r\n plane.normalize();\r\n var x = plane.normal.x;\r\n var y = plane.normal.y;\r\n var z = plane.normal.z;\r\n var temp = -2 * x;\r\n var temp2 = -2 * y;\r\n var temp3 = -2 * z;\r\n Matrix.FromValuesToRef(temp * x + 1, temp2 * x, temp3 * x, 0.0, temp * y, temp2 * y + 1, temp3 * y, 0.0, temp * z, temp2 * z, temp3 * z + 1, 0.0, temp * plane.d, temp2 * plane.d, temp3 * plane.d, 1.0, result);\r\n };\r\n /**\r\n * Sets the given matrix as a rotation matrix composed from the 3 left handed axes\r\n * @param xaxis defines the value of the 1st axis\r\n * @param yaxis defines the value of the 2nd axis\r\n * @param zaxis defines the value of the 3rd axis\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromXYZAxesToRef = function (xaxis, yaxis, zaxis, result) {\r\n Matrix.FromValuesToRef(xaxis._x, xaxis._y, xaxis._z, 0.0, yaxis._x, yaxis._y, yaxis._z, 0.0, zaxis._x, zaxis._y, zaxis._z, 0.0, 0.0, 0.0, 0.0, 1.0, result);\r\n };\r\n /**\r\n * Creates a rotation matrix from a quaternion and stores it in a target matrix\r\n * @param quat defines the quaternion to use\r\n * @param result defines the target matrix\r\n */\r\n Matrix.FromQuaternionToRef = function (quat, result) {\r\n var xx = quat._x * quat._x;\r\n var yy = quat._y * quat._y;\r\n var zz = quat._z * quat._z;\r\n var xy = quat._x * quat._y;\r\n var zw = quat._z * quat._w;\r\n var zx = quat._z * quat._x;\r\n var yw = quat._y * quat._w;\r\n var yz = quat._y * quat._z;\r\n var xw = quat._x * quat._w;\r\n result._m[0] = 1.0 - (2.0 * (yy + zz));\r\n result._m[1] = 2.0 * (xy + zw);\r\n result._m[2] = 2.0 * (zx - yw);\r\n result._m[3] = 0.0;\r\n result._m[4] = 2.0 * (xy - zw);\r\n result._m[5] = 1.0 - (2.0 * (zz + xx));\r\n result._m[6] = 2.0 * (yz + xw);\r\n result._m[7] = 0.0;\r\n result._m[8] = 2.0 * (zx + yw);\r\n result._m[9] = 2.0 * (yz - xw);\r\n result._m[10] = 1.0 - (2.0 * (yy + xx));\r\n result._m[11] = 0.0;\r\n result._m[12] = 0.0;\r\n result._m[13] = 0.0;\r\n result._m[14] = 0.0;\r\n result._m[15] = 1.0;\r\n result._markAsUpdated();\r\n };\r\n Matrix._updateFlagSeed = 0;\r\n Matrix._identityReadOnly = Matrix.Identity();\r\n return Matrix;\r\n}());\r\nexport { Matrix };\r\n/**\r\n * @hidden\r\n * Same as Tmp but not exported to keep it only for math functions to avoid conflicts\r\n */\r\nvar MathTmp = /** @class */ (function () {\r\n function MathTmp() {\r\n }\r\n MathTmp.Vector3 = ArrayTools.BuildArray(6, Vector3.Zero);\r\n MathTmp.Matrix = ArrayTools.BuildArray(2, Matrix.Identity);\r\n MathTmp.Quaternion = ArrayTools.BuildArray(3, Quaternion.Zero);\r\n return MathTmp;\r\n}());\r\n/**\r\n * @hidden\r\n */\r\nvar TmpVectors = /** @class */ (function () {\r\n function TmpVectors() {\r\n }\r\n TmpVectors.Vector2 = ArrayTools.BuildArray(3, Vector2.Zero); // 3 temp Vector2 at once should be enough\r\n TmpVectors.Vector3 = ArrayTools.BuildArray(13, Vector3.Zero); // 13 temp Vector3 at once should be enough\r\n TmpVectors.Vector4 = ArrayTools.BuildArray(3, Vector4.Zero); // 3 temp Vector4 at once should be enough\r\n TmpVectors.Quaternion = ArrayTools.BuildArray(2, Quaternion.Zero); // 2 temp Quaternion at once should be enough\r\n TmpVectors.Matrix = ArrayTools.BuildArray(8, Matrix.Identity); // 8 temp Matrices at once should be enough\r\n return TmpVectors;\r\n}());\r\nexport { TmpVectors };\r\n_TypeStore.RegisteredTypes[\"BABYLON.Vector2\"] = Vector2;\r\n_TypeStore.RegisteredTypes[\"BABYLON.Vector3\"] = Vector3;\r\n_TypeStore.RegisteredTypes[\"BABYLON.Vector4\"] = Vector4;\r\n_TypeStore.RegisteredTypes[\"BABYLON.Matrix\"] = Matrix;\r\n//# sourceMappingURL=math.vector.js.map","/**\r\n * Class used to represent a viewport on screen\r\n */\r\nvar Viewport = /** @class */ (function () {\r\n /**\r\n * Creates a Viewport object located at (x, y) and sized (width, height)\r\n * @param x defines viewport left coordinate\r\n * @param y defines viewport top coordinate\r\n * @param width defines the viewport width\r\n * @param height defines the viewport height\r\n */\r\n function Viewport(\r\n /** viewport left coordinate */\r\n x, \r\n /** viewport top coordinate */\r\n y, \r\n /**viewport width */\r\n width, \r\n /** viewport height */\r\n height) {\r\n this.x = x;\r\n this.y = y;\r\n this.width = width;\r\n this.height = height;\r\n }\r\n /**\r\n * Creates a new viewport using absolute sizing (from 0-> width, 0-> height instead of 0->1)\r\n * @param renderWidth defines the rendering width\r\n * @param renderHeight defines the rendering height\r\n * @returns a new Viewport\r\n */\r\n Viewport.prototype.toGlobal = function (renderWidth, renderHeight) {\r\n return new Viewport(this.x * renderWidth, this.y * renderHeight, this.width * renderWidth, this.height * renderHeight);\r\n };\r\n /**\r\n * Stores absolute viewport value into a target viewport (from 0-> width, 0-> height instead of 0->1)\r\n * @param renderWidth defines the rendering width\r\n * @param renderHeight defines the rendering height\r\n * @param ref defines the target viewport\r\n * @returns the current viewport\r\n */\r\n Viewport.prototype.toGlobalToRef = function (renderWidth, renderHeight, ref) {\r\n ref.x = this.x * renderWidth;\r\n ref.y = this.y * renderHeight;\r\n ref.width = this.width * renderWidth;\r\n ref.height = this.height * renderHeight;\r\n return this;\r\n };\r\n /**\r\n * Returns a new Viewport copied from the current one\r\n * @returns a new Viewport\r\n */\r\n Viewport.prototype.clone = function () {\r\n return new Viewport(this.x, this.y, this.width, this.height);\r\n };\r\n return Viewport;\r\n}());\r\nexport { Viewport };\r\n//# sourceMappingURL=math.viewport.js.map","import { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nVertexData.CreateBox = function (options) {\r\n var nbFaces = 6;\r\n var indices = [0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23];\r\n var normals = [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0];\r\n var uvs = [];\r\n var positions = [];\r\n var width = options.width || options.size || 1;\r\n var height = options.height || options.size || 1;\r\n var depth = options.depth || options.size || 1;\r\n var wrap = options.wrap || false;\r\n var topBaseAt = (options.topBaseAt === void 0) ? 1 : options.topBaseAt;\r\n var bottomBaseAt = (options.bottomBaseAt === void 0) ? 0 : options.bottomBaseAt;\r\n topBaseAt = (topBaseAt + 4) % 4; // places values as 0 to 3\r\n bottomBaseAt = (bottomBaseAt + 4) % 4; // places values as 0 to 3\r\n var topOrder = [2, 0, 3, 1];\r\n var bottomOrder = [2, 0, 1, 3];\r\n var topIndex = topOrder[topBaseAt];\r\n var bottomIndex = bottomOrder[bottomBaseAt];\r\n var basePositions = [1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1];\r\n if (wrap) {\r\n indices = [2, 3, 0, 2, 0, 1, 4, 5, 6, 4, 6, 7, 9, 10, 11, 9, 11, 8, 12, 14, 15, 12, 13, 14];\r\n basePositions = [-1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1];\r\n var topFaceBase = [[1, 1, 1], [-1, 1, 1], [-1, 1, -1], [1, 1, -1]];\r\n var bottomFaceBase = [[-1, -1, 1], [1, -1, 1], [1, -1, -1], [-1, -1, -1]];\r\n var topFaceOrder = [17, 18, 19, 16];\r\n var bottomFaceOrder = [22, 23, 20, 21];\r\n while (topIndex > 0) {\r\n topFaceBase.unshift(topFaceBase.pop());\r\n topFaceOrder.unshift(topFaceOrder.pop());\r\n topIndex--;\r\n }\r\n while (bottomIndex > 0) {\r\n bottomFaceBase.unshift(bottomFaceBase.pop());\r\n bottomFaceOrder.unshift(bottomFaceOrder.pop());\r\n bottomIndex--;\r\n }\r\n topFaceBase = topFaceBase.flat();\r\n bottomFaceBase = bottomFaceBase.flat();\r\n basePositions = basePositions.concat(topFaceBase).concat(bottomFaceBase);\r\n indices.push(topFaceOrder[0], topFaceOrder[2], topFaceOrder[3], topFaceOrder[0], topFaceOrder[1], topFaceOrder[2]);\r\n indices.push(bottomFaceOrder[0], bottomFaceOrder[2], bottomFaceOrder[3], bottomFaceOrder[0], bottomFaceOrder[1], bottomFaceOrder[2]);\r\n }\r\n var scaleArray = [width / 2, height / 2, depth / 2];\r\n positions = basePositions.reduce(function (accumulator, currentValue, currentIndex) { return accumulator.concat(currentValue * scaleArray[currentIndex % 3]); }, []);\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n var faceUV = options.faceUV || new Array(6);\r\n var faceColors = options.faceColors;\r\n var colors = [];\r\n // default face colors and UV if undefined\r\n for (var f = 0; f < 6; f++) {\r\n if (faceUV[f] === undefined) {\r\n faceUV[f] = new Vector4(0, 0, 1, 1);\r\n }\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new Color4(1, 1, 1, 1);\r\n }\r\n }\r\n // Create each face in turn.\r\n for (var index = 0; index < nbFaces; index++) {\r\n uvs.push(faceUV[index].z, faceUV[index].w);\r\n uvs.push(faceUV[index].x, faceUV[index].w);\r\n uvs.push(faceUV[index].x, faceUV[index].y);\r\n uvs.push(faceUV[index].z, faceUV[index].y);\r\n if (faceColors) {\r\n for (var c = 0; c < 4; c++) {\r\n colors.push(faceColors[index].r, faceColors[index].g, faceColors[index].b, faceColors[index].a);\r\n }\r\n }\r\n }\r\n // sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n var totalColors = (sideOrientation === VertexData.DOUBLESIDE) ? colors.concat(colors) : colors;\r\n vertexData.colors = totalColors;\r\n }\r\n return vertexData;\r\n};\r\nMesh.CreateBox = function (name, size, scene, updatable, sideOrientation) {\r\n if (scene === void 0) { scene = null; }\r\n var options = {\r\n size: size,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return BoxBuilder.CreateBox(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar BoxBuilder = /** @class */ (function () {\r\n function BoxBuilder() {\r\n }\r\n /**\r\n * Creates a box mesh\r\n * * The parameter `size` sets the size (float) of each box side (default 1)\r\n * * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value of `size`)\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements)\r\n * * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#box\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the box mesh\r\n */\r\n BoxBuilder.CreateBox = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var box = new Mesh(name, scene);\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n box._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = VertexData.CreateBox(options);\r\n vertexData.applyToMesh(box, options.updatable);\r\n return box;\r\n };\r\n return BoxBuilder;\r\n}());\r\nexport { BoxBuilder };\r\n//# sourceMappingURL=boxBuilder.js.map","import { Vector4, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Scene } from \"../../scene\";\r\nimport { Axis } from '../../Maths/math.axis';\r\nVertexData.CreateCylinder = function (options) {\r\n var height = options.height || 2;\r\n var diameterTop = (options.diameterTop === 0) ? 0 : options.diameterTop || options.diameter || 1;\r\n var diameterBottom = (options.diameterBottom === 0) ? 0 : options.diameterBottom || options.diameter || 1;\r\n diameterTop = diameterTop || 0.00001; // Prevent broken normals\r\n diameterBottom = diameterBottom || 0.00001; // Prevent broken normals\r\n var tessellation = options.tessellation || 24;\r\n var subdivisions = options.subdivisions || 1;\r\n var hasRings = options.hasRings ? true : false;\r\n var enclose = options.enclose ? true : false;\r\n var cap = (options.cap === 0) ? 0 : options.cap || Mesh.CAP_ALL;\r\n var arc = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n var faceUV = options.faceUV || new Array(3);\r\n var faceColors = options.faceColors;\r\n // default face colors and UV if undefined\r\n var quadNb = (arc !== 1 && enclose) ? 2 : 0;\r\n var ringNb = (hasRings) ? subdivisions : 1;\r\n var surfaceNb = 2 + (1 + quadNb) * ringNb;\r\n var f;\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new Color4(1, 1, 1, 1);\r\n }\r\n }\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceUV && faceUV[f] === undefined) {\r\n faceUV[f] = new Vector4(0, 0, 1, 1);\r\n }\r\n }\r\n var indices = new Array();\r\n var positions = new Array();\r\n var normals = new Array();\r\n var uvs = new Array();\r\n var colors = new Array();\r\n var angle_step = Math.PI * 2 * arc / tessellation;\r\n var angle;\r\n var h;\r\n var radius;\r\n var tan = (diameterBottom - diameterTop) / 2 / height;\r\n var ringVertex = Vector3.Zero();\r\n var ringNormal = Vector3.Zero();\r\n var ringFirstVertex = Vector3.Zero();\r\n var ringFirstNormal = Vector3.Zero();\r\n var quadNormal = Vector3.Zero();\r\n var Y = Axis.Y;\r\n // positions, normals, uvs\r\n var i;\r\n var j;\r\n var r;\r\n var ringIdx = 1;\r\n var s = 1; // surface index\r\n var cs = 0;\r\n var v = 0;\r\n for (i = 0; i <= subdivisions; i++) {\r\n h = i / subdivisions;\r\n radius = (h * (diameterTop - diameterBottom) + diameterBottom) / 2;\r\n ringIdx = (hasRings && i !== 0 && i !== subdivisions) ? 2 : 1;\r\n for (r = 0; r < ringIdx; r++) {\r\n if (hasRings) {\r\n s += r;\r\n }\r\n if (enclose) {\r\n s += 2 * r;\r\n }\r\n for (j = 0; j <= tessellation; j++) {\r\n angle = j * angle_step;\r\n // position\r\n ringVertex.x = Math.cos(-angle) * radius;\r\n ringVertex.y = -height / 2 + h * height;\r\n ringVertex.z = Math.sin(-angle) * radius;\r\n // normal\r\n if (diameterTop === 0 && i === subdivisions) {\r\n // if no top cap, reuse former normals\r\n ringNormal.x = normals[normals.length - (tessellation + 1) * 3];\r\n ringNormal.y = normals[normals.length - (tessellation + 1) * 3 + 1];\r\n ringNormal.z = normals[normals.length - (tessellation + 1) * 3 + 2];\r\n }\r\n else {\r\n ringNormal.x = ringVertex.x;\r\n ringNormal.z = ringVertex.z;\r\n ringNormal.y = Math.sqrt(ringNormal.x * ringNormal.x + ringNormal.z * ringNormal.z) * tan;\r\n ringNormal.normalize();\r\n }\r\n // keep first ring vertex values for enclose\r\n if (j === 0) {\r\n ringFirstVertex.copyFrom(ringVertex);\r\n ringFirstNormal.copyFrom(ringNormal);\r\n }\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n normals.push(ringNormal.x, ringNormal.y, ringNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s].y : faceUV[s].w;\r\n }\r\n else {\r\n v = faceUV[s].y + (faceUV[s].w - faceUV[s].y) * h;\r\n }\r\n uvs.push(faceUV[s].x + (faceUV[s].z - faceUV[s].x) * j / tessellation, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s].r, faceColors[s].g, faceColors[s].b, faceColors[s].a);\r\n }\r\n }\r\n // if enclose, add four vertices and their dedicated normals\r\n if (arc !== 1 && enclose) {\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(ringFirstVertex.x, ringFirstVertex.y, ringFirstVertex.z);\r\n Vector3.CrossToRef(Y, ringNormal, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n Vector3.CrossToRef(ringFirstNormal, Y, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 1].y : faceUV[s + 1].w;\r\n }\r\n else {\r\n v = faceUV[s + 1].y + (faceUV[s + 1].w - faceUV[s + 1].y) * h;\r\n }\r\n uvs.push(faceUV[s + 1].x, v);\r\n uvs.push(faceUV[s + 1].z, v);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 2].y : faceUV[s + 2].w;\r\n }\r\n else {\r\n v = faceUV[s + 2].y + (faceUV[s + 2].w - faceUV[s + 2].y) * h;\r\n }\r\n uvs.push(faceUV[s + 2].x, v);\r\n uvs.push(faceUV[s + 2].z, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n }\r\n }\r\n if (cs !== s) {\r\n cs = s;\r\n }\r\n }\r\n }\r\n // indices\r\n var e = (arc !== 1 && enclose) ? tessellation + 4 : tessellation; // correction of number of iteration if enclose\r\n var s;\r\n i = 0;\r\n for (s = 0; s < subdivisions; s++) {\r\n var i0 = 0;\r\n var i1 = 0;\r\n var i2 = 0;\r\n var i3 = 0;\r\n for (j = 0; j < tessellation; j++) {\r\n i0 = i * (e + 1) + j;\r\n i1 = (i + 1) * (e + 1) + j;\r\n i2 = i * (e + 1) + (j + 1);\r\n i3 = (i + 1) * (e + 1) + (j + 1);\r\n indices.push(i0, i1, i2);\r\n indices.push(i3, i2, i1);\r\n }\r\n if (arc !== 1 && enclose) { // if enclose, add two quads\r\n indices.push(i0 + 2, i1 + 2, i2 + 2);\r\n indices.push(i3 + 2, i2 + 2, i1 + 2);\r\n indices.push(i0 + 4, i1 + 4, i2 + 4);\r\n indices.push(i3 + 4, i2 + 4, i1 + 4);\r\n }\r\n i = (hasRings) ? (i + 2) : (i + 1);\r\n }\r\n // Caps\r\n var createCylinderCap = function (isTop) {\r\n var radius = isTop ? diameterTop / 2 : diameterBottom / 2;\r\n if (radius === 0) {\r\n return;\r\n }\r\n // Cap positions, normals & uvs\r\n var angle;\r\n var circleVector;\r\n var i;\r\n var u = (isTop) ? faceUV[surfaceNb - 1] : faceUV[0];\r\n var c = null;\r\n if (faceColors) {\r\n c = (isTop) ? faceColors[surfaceNb - 1] : faceColors[0];\r\n }\r\n // cap center\r\n var vbase = positions.length / 3;\r\n var offset = isTop ? height / 2 : -height / 2;\r\n var center = new Vector3(0, offset, 0);\r\n positions.push(center.x, center.y, center.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * 0.5, u.y + (u.w - u.y) * 0.5);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n var textureScale = new Vector2(0.5, 0.5);\r\n for (i = 0; i <= tessellation; i++) {\r\n angle = Math.PI * 2 * i * arc / tessellation;\r\n var cos = Math.cos(-angle);\r\n var sin = Math.sin(-angle);\r\n circleVector = new Vector3(cos * radius, offset, sin * radius);\r\n var textureCoordinate = new Vector2(cos * textureScale.x + 0.5, sin * textureScale.y + 0.5);\r\n positions.push(circleVector.x, circleVector.y, circleVector.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * textureCoordinate.x, u.y + (u.w - u.y) * textureCoordinate.y);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n }\r\n // Cap indices\r\n for (i = 0; i < tessellation; i++) {\r\n if (!isTop) {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 1));\r\n indices.push(vbase + (i + 2));\r\n }\r\n else {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 2));\r\n indices.push(vbase + (i + 1));\r\n }\r\n }\r\n };\r\n // add caps to geometry based on cap parameter\r\n if ((cap === Mesh.CAP_START)\r\n || (cap === Mesh.CAP_ALL)) {\r\n createCylinderCap(false);\r\n }\r\n if ((cap === Mesh.CAP_END)\r\n || (cap === Mesh.CAP_ALL)) {\r\n createCylinderCap(true);\r\n }\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n vertexData.colors = colors;\r\n }\r\n return vertexData;\r\n};\r\nMesh.CreateCylinder = function (name, height, diameterTop, diameterBottom, tessellation, subdivisions, scene, updatable, sideOrientation) {\r\n if (scene === undefined || !(scene instanceof Scene)) {\r\n if (scene !== undefined) {\r\n sideOrientation = updatable || Mesh.DEFAULTSIDE;\r\n updatable = scene;\r\n }\r\n scene = subdivisions;\r\n subdivisions = 1;\r\n }\r\n var options = {\r\n height: height,\r\n diameterTop: diameterTop,\r\n diameterBottom: diameterBottom,\r\n tessellation: tessellation,\r\n subdivisions: subdivisions,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return CylinderBuilder.CreateCylinder(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar CylinderBuilder = /** @class */ (function () {\r\n function CylinderBuilder() {\r\n }\r\n /**\r\n * Creates a cylinder or a cone mesh\r\n * * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).\r\n * * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).\r\n * * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter \"diameterBottom\" can't be zero.\r\n * * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.\r\n * * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).\r\n * * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.\r\n * * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.\r\n * * The parameter `cap` sets the way the cylinder is capped. Possible values : BABYLON.Mesh.NO_CAP, BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL (default).\r\n * * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).\r\n * * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3\r\n * * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7\r\n * * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17\r\n * * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.\r\n * * If `enclose` is false, a ring surface is one element.\r\n * * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.\r\n * * Example how to set colors and textures on a sliced cylinder : https://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the cylinder mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#cylinder-or-cone\r\n */\r\n CylinderBuilder.CreateCylinder = function (name, options, scene) {\r\n var cylinder = new Mesh(name, scene);\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n cylinder._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = VertexData.CreateCylinder(options);\r\n vertexData.applyToMesh(cylinder, options.updatable);\r\n return cylinder;\r\n };\r\n return CylinderBuilder;\r\n}());\r\nexport { CylinderBuilder };\r\n//# sourceMappingURL=cylinderBuilder.js.map","import { __extends } from \"tslib\";\r\nimport { TmpVectors } from \"../Maths/math.vector\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { DeepCopier } from \"../Misc/deepCopier\";\r\nimport { TransformNode } from './transformNode';\r\nimport { VertexBuffer } from './buffer';\r\nimport { BoundingInfo } from '../Culling/boundingInfo';\r\nimport { Tools } from '../Misc/tools';\r\nMesh._instancedMeshFactory = function (name, mesh) {\r\n var instance = new InstancedMesh(name, mesh);\r\n if (mesh.instancedBuffers) {\r\n instance.instancedBuffers = {};\r\n for (var key in mesh.instancedBuffers) {\r\n instance.instancedBuffers[key] = mesh.instancedBuffers[key];\r\n }\r\n }\r\n return instance;\r\n};\r\n/**\r\n * Creates an instance based on a source mesh.\r\n */\r\nvar InstancedMesh = /** @class */ (function (_super) {\r\n __extends(InstancedMesh, _super);\r\n function InstancedMesh(name, source) {\r\n var _this = _super.call(this, name, source.getScene()) || this;\r\n /** @hidden */\r\n _this._indexInSourceMeshInstanceArray = -1;\r\n source.addInstance(_this);\r\n _this._sourceMesh = source;\r\n _this._unIndexed = source._unIndexed;\r\n _this.position.copyFrom(source.position);\r\n _this.rotation.copyFrom(source.rotation);\r\n _this.scaling.copyFrom(source.scaling);\r\n if (source.rotationQuaternion) {\r\n _this.rotationQuaternion = source.rotationQuaternion.clone();\r\n }\r\n _this.animations = Tools.Slice(source.animations);\r\n for (var _i = 0, _a = source.getAnimationRanges(); _i < _a.length; _i++) {\r\n var range = _a[_i];\r\n if (range != null) {\r\n _this.createAnimationRange(range.name, range.from, range.to);\r\n }\r\n }\r\n _this.infiniteDistance = source.infiniteDistance;\r\n _this.setPivotMatrix(source.getPivotMatrix());\r\n _this.refreshBoundingInfo();\r\n _this._syncSubMeshes();\r\n return _this;\r\n }\r\n /**\r\n * Returns the string \"InstancedMesh\".\r\n */\r\n InstancedMesh.prototype.getClassName = function () {\r\n return \"InstancedMesh\";\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"lightSources\", {\r\n /** Gets the list of lights affecting that mesh */\r\n get: function () {\r\n return this._sourceMesh._lightSources;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n InstancedMesh.prototype._resyncLightSources = function () {\r\n // Do nothing as all the work will be done by source mesh\r\n };\r\n InstancedMesh.prototype._resyncLightSource = function (light) {\r\n // Do nothing as all the work will be done by source mesh\r\n };\r\n InstancedMesh.prototype._removeLightSource = function (light, dispose) {\r\n // Do nothing as all the work will be done by source mesh\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"receiveShadows\", {\r\n // Methods\r\n /**\r\n * If the source mesh receives shadows\r\n */\r\n get: function () {\r\n return this._sourceMesh.receiveShadows;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"material\", {\r\n /**\r\n * The material of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.material;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"visibility\", {\r\n /**\r\n * Visibility of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.visibility;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"skeleton\", {\r\n /**\r\n * Skeleton of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.skeleton;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InstancedMesh.prototype, \"renderingGroupId\", {\r\n /**\r\n * Rendering ground id of the source mesh\r\n */\r\n get: function () {\r\n return this._sourceMesh.renderingGroupId;\r\n },\r\n set: function (value) {\r\n if (!this._sourceMesh || value === this._sourceMesh.renderingGroupId) {\r\n return;\r\n }\r\n //no-op with warning\r\n Logger.Warn(\"Note - setting renderingGroupId of an instanced mesh has no effect on the scene\");\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the total number of vertices (integer).\r\n */\r\n InstancedMesh.prototype.getTotalVertices = function () {\r\n return this._sourceMesh ? this._sourceMesh.getTotalVertices() : 0;\r\n };\r\n /**\r\n * Returns a positive integer : the total number of indices in this mesh geometry.\r\n * @returns the numner of indices or zero if the mesh has no geometry.\r\n */\r\n InstancedMesh.prototype.getTotalIndices = function () {\r\n return this._sourceMesh.getTotalIndices();\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"sourceMesh\", {\r\n /**\r\n * The source mesh of the instance\r\n */\r\n get: function () {\r\n return this._sourceMesh;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a new InstancedMesh object from the mesh model.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_instances\r\n * @param name defines the name of the new instance\r\n * @returns a new InstancedMesh\r\n */\r\n InstancedMesh.prototype.createInstance = function (name) {\r\n return this._sourceMesh.createInstance(name);\r\n };\r\n /**\r\n * Is this node ready to be used/rendered\r\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\r\n * @return {boolean} is it ready\r\n */\r\n InstancedMesh.prototype.isReady = function (completeCheck) {\r\n if (completeCheck === void 0) { completeCheck = false; }\r\n return this._sourceMesh.isReady(completeCheck, true);\r\n };\r\n /**\r\n * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.\r\n * @param kind kind of verticies to retreive (eg. positons, normals, uvs, etc.)\r\n * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.\r\n * @returns a float array or a Float32Array of the requested kind of data : positons, normals, uvs, etc.\r\n */\r\n InstancedMesh.prototype.getVerticesData = function (kind, copyWhenShared) {\r\n return this._sourceMesh.getVerticesData(kind, copyWhenShared);\r\n };\r\n /**\r\n * Sets the vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.\r\n * The `data` are either a numeric array either a Float32Array.\r\n * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.\r\n * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc).\r\n * Note that a new underlying VertexBuffer object is created each call.\r\n * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\r\n *\r\n * Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n *\r\n * Returns the Mesh.\r\n */\r\n InstancedMesh.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n if (this.sourceMesh) {\r\n this.sourceMesh.setVerticesData(kind, data, updatable, stride);\r\n }\r\n return this.sourceMesh;\r\n };\r\n /**\r\n * Updates the existing vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, it is simply returned as it is.\r\n * The `data` are either a numeric array either a Float32Array.\r\n * No new underlying VertexBuffer object is created.\r\n * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\r\n * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.\r\n *\r\n * Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n *\r\n * Returns the Mesh.\r\n */\r\n InstancedMesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {\r\n if (this.sourceMesh) {\r\n this.sourceMesh.updateVerticesData(kind, data, updateExtends, makeItUnique);\r\n }\r\n return this.sourceMesh;\r\n };\r\n /**\r\n * Sets the mesh indices.\r\n * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).\r\n * If the mesh has no geometry, a new Geometry object is created and set to the mesh.\r\n * This method creates a new index buffer each call.\r\n * Returns the Mesh.\r\n */\r\n InstancedMesh.prototype.setIndices = function (indices, totalVertices) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n if (this.sourceMesh) {\r\n this.sourceMesh.setIndices(indices, totalVertices);\r\n }\r\n return this.sourceMesh;\r\n };\r\n /**\r\n * Boolean : True if the mesh owns the requested kind of data.\r\n */\r\n InstancedMesh.prototype.isVerticesDataPresent = function (kind) {\r\n return this._sourceMesh.isVerticesDataPresent(kind);\r\n };\r\n /**\r\n * Returns an array of indices (IndicesArray).\r\n */\r\n InstancedMesh.prototype.getIndices = function () {\r\n return this._sourceMesh.getIndices();\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"_positions\", {\r\n get: function () {\r\n return this._sourceMesh._positions;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\r\n * This means the mesh underlying bounding box and sphere are recomputed.\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @returns the current mesh\r\n */\r\n InstancedMesh.prototype.refreshBoundingInfo = function (applySkeleton) {\r\n if (applySkeleton === void 0) { applySkeleton = false; }\r\n if (this._boundingInfo && this._boundingInfo.isLocked) {\r\n return this;\r\n }\r\n var bias = this._sourceMesh.geometry ? this._sourceMesh.geometry.boundingBias : null;\r\n this._refreshBoundingInfo(this._sourceMesh._getPositionData(applySkeleton), bias);\r\n return this;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._preActivate = function () {\r\n if (this._currentLOD) {\r\n this._currentLOD._preActivate();\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._activate = function (renderId, intermediateRendering) {\r\n if (!this._sourceMesh.subMeshes) {\r\n Logger.Warn(\"Instances should only be created for meshes with geometry.\");\r\n }\r\n if (this._currentLOD) {\r\n var differentSign = (this._currentLOD._getWorldMatrixDeterminant() > 0) !== (this._getWorldMatrixDeterminant() > 0);\r\n if (differentSign) {\r\n this._internalAbstractMeshDataInfo._actAsRegularMesh = true;\r\n return true;\r\n }\r\n this._internalAbstractMeshDataInfo._actAsRegularMesh = false;\r\n this._currentLOD._registerInstanceForRenderId(this, renderId);\r\n if (intermediateRendering) {\r\n if (!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate) {\r\n this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = true;\r\n return true;\r\n }\r\n }\r\n else {\r\n if (!this._currentLOD._internalAbstractMeshDataInfo._isActive) {\r\n this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances = true;\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._postActivate = function () {\r\n if (this._sourceMesh.edgesShareWithInstances && this._sourceMesh._edgesRenderer && this._sourceMesh._edgesRenderer.isEnabled && this._sourceMesh._renderingGroup) {\r\n // we are using the edge renderer of the source mesh\r\n this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer);\r\n this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix());\r\n }\r\n else if (this._edgesRenderer && this._edgesRenderer.isEnabled && this._sourceMesh._renderingGroup) {\r\n // we are using the edge renderer defined for this instance\r\n this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer);\r\n }\r\n };\r\n InstancedMesh.prototype.getWorldMatrix = function () {\r\n if (this._currentLOD && this._currentLOD.billboardMode !== TransformNode.BILLBOARDMODE_NONE && this._currentLOD._masterMesh !== this) {\r\n var tempMaster = this._currentLOD._masterMesh;\r\n this._currentLOD._masterMesh = this;\r\n TmpVectors.Vector3[7].copyFrom(this._currentLOD.position);\r\n this._currentLOD.position.set(0, 0, 0);\r\n TmpVectors.Matrix[0].copyFrom(this._currentLOD.computeWorldMatrix(true));\r\n this._currentLOD.position.copyFrom(TmpVectors.Vector3[7]);\r\n this._currentLOD._masterMesh = tempMaster;\r\n return TmpVectors.Matrix[0];\r\n }\r\n return _super.prototype.getWorldMatrix.call(this);\r\n };\r\n Object.defineProperty(InstancedMesh.prototype, \"isAnInstance\", {\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the current associated LOD AbstractMesh.\r\n */\r\n InstancedMesh.prototype.getLOD = function (camera) {\r\n if (!camera) {\r\n return this;\r\n }\r\n var boundingInfo = this.getBoundingInfo();\r\n this._currentLOD = this.sourceMesh.getLOD(camera, boundingInfo.boundingSphere);\r\n if (this._currentLOD === this.sourceMesh) {\r\n return this.sourceMesh;\r\n }\r\n return this._currentLOD;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._preActivateForIntermediateRendering = function (renderId) {\r\n return this.sourceMesh._preActivateForIntermediateRendering(renderId);\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._syncSubMeshes = function () {\r\n this.releaseSubMeshes();\r\n if (this._sourceMesh.subMeshes) {\r\n for (var index = 0; index < this._sourceMesh.subMeshes.length; index++) {\r\n this._sourceMesh.subMeshes[index].clone(this, this._sourceMesh);\r\n }\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._generatePointsArray = function () {\r\n return this._sourceMesh._generatePointsArray();\r\n };\r\n /** @hidden */\r\n InstancedMesh.prototype._updateBoundingInfo = function () {\r\n var effectiveMesh = this;\r\n if (this._boundingInfo) {\r\n this._boundingInfo.update(effectiveMesh.worldMatrixFromCache);\r\n }\r\n else {\r\n this._boundingInfo = new BoundingInfo(this.absolutePosition, this.absolutePosition, effectiveMesh.worldMatrixFromCache);\r\n }\r\n this._updateSubMeshesBoundingInfo(effectiveMesh.worldMatrixFromCache);\r\n return this;\r\n };\r\n /**\r\n * Creates a new InstancedMesh from the current mesh.\r\n * - name (string) : the cloned mesh name\r\n * - newParent (optional Node) : the optional Node to parent the clone to.\r\n * - doNotCloneChildren (optional boolean, default `false`) : if `true` the model children aren't cloned.\r\n *\r\n * Returns the clone.\r\n */\r\n InstancedMesh.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n if (newParent === void 0) { newParent = null; }\r\n var result = this._sourceMesh.createInstance(name);\r\n // Deep copy\r\n DeepCopier.DeepCopy(this, result, [\r\n \"name\", \"subMeshes\", \"uniqueId\", \"parent\", \"lightSources\",\r\n \"receiveShadows\", \"material\", \"visibility\", \"skeleton\",\r\n \"sourceMesh\", \"isAnInstance\", \"facetNb\", \"isFacetDataEnabled\",\r\n \"isBlocked\", \"useBones\", \"hasInstances\", \"collider\", \"edgesRenderer\",\r\n \"forward\", \"up\", \"right\", \"absolutePosition\", \"absoluteScaling\", \"absoluteRotationQuaternion\",\r\n \"isWorldMatrixFrozen\", \"nonUniformScaling\", \"behaviors\", \"worldMatrixFromCache\", \"hasThinInstances\"\r\n ], []);\r\n // Bounding info\r\n this.refreshBoundingInfo();\r\n // Parent\r\n if (newParent) {\r\n result.parent = newParent;\r\n }\r\n if (!doNotCloneChildren) {\r\n // Children\r\n for (var index = 0; index < this.getScene().meshes.length; index++) {\r\n var mesh = this.getScene().meshes[index];\r\n if (mesh.parent === this) {\r\n mesh.clone(mesh.name, result);\r\n }\r\n }\r\n }\r\n result.computeWorldMatrix(true);\r\n return result;\r\n };\r\n /**\r\n * Disposes the InstancedMesh.\r\n * Returns nothing.\r\n */\r\n InstancedMesh.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n // Remove from mesh\r\n this._sourceMesh.removeInstance(this);\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n return InstancedMesh;\r\n}(AbstractMesh));\r\nexport { InstancedMesh };\r\nMesh.prototype.edgesShareWithInstances = false;\r\nMesh.prototype.registerInstancedBuffer = function (kind, stride) {\r\n // Remove existing one\r\n this.removeVerticesData(kind);\r\n // Creates the instancedBuffer field if not present\r\n if (!this.instancedBuffers) {\r\n this.instancedBuffers = {};\r\n for (var _i = 0, _a = this.instances; _i < _a.length; _i++) {\r\n var instance = _a[_i];\r\n instance.instancedBuffers = {};\r\n }\r\n this._userInstancedBuffersStorage = {\r\n data: {},\r\n vertexBuffers: {},\r\n strides: {},\r\n sizes: {}\r\n };\r\n }\r\n // Creates an empty property for this kind\r\n this.instancedBuffers[kind] = null;\r\n this._userInstancedBuffersStorage.strides[kind] = stride;\r\n this._userInstancedBuffersStorage.sizes[kind] = stride * 32; // Initial size\r\n this._userInstancedBuffersStorage.data[kind] = new Float32Array(this._userInstancedBuffersStorage.sizes[kind]);\r\n this._userInstancedBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), this._userInstancedBuffersStorage.data[kind], kind, true, false, stride, true);\r\n this.setVerticesBuffer(this._userInstancedBuffersStorage.vertexBuffers[kind]);\r\n for (var _b = 0, _c = this.instances; _b < _c.length; _b++) {\r\n var instance = _c[_b];\r\n instance.instancedBuffers[kind] = null;\r\n }\r\n};\r\nMesh.prototype._processInstancedBuffers = function (visibleInstances, renderSelf) {\r\n var instanceCount = visibleInstances.length;\r\n for (var kind in this.instancedBuffers) {\r\n var size = this._userInstancedBuffersStorage.sizes[kind];\r\n var stride = this._userInstancedBuffersStorage.strides[kind];\r\n // Resize if required\r\n var expectedSize = (instanceCount + 1) * stride;\r\n while (size < expectedSize) {\r\n size *= 2;\r\n }\r\n if (this._userInstancedBuffersStorage.data[kind].length != size) {\r\n this._userInstancedBuffersStorage.data[kind] = new Float32Array(size);\r\n this._userInstancedBuffersStorage.sizes[kind] = size;\r\n if (this._userInstancedBuffersStorage.vertexBuffers[kind]) {\r\n this._userInstancedBuffersStorage.vertexBuffers[kind].dispose();\r\n this._userInstancedBuffersStorage.vertexBuffers[kind] = null;\r\n }\r\n }\r\n var data = this._userInstancedBuffersStorage.data[kind];\r\n // Update data buffer\r\n var offset = 0;\r\n if (renderSelf) {\r\n var value = this.instancedBuffers[kind];\r\n if (value.toArray) {\r\n value.toArray(data, offset);\r\n }\r\n else {\r\n value.copyToArray(data, offset);\r\n }\r\n offset += stride;\r\n }\r\n for (var instanceIndex = 0; instanceIndex < instanceCount; instanceIndex++) {\r\n var instance = visibleInstances[instanceIndex];\r\n var value = instance.instancedBuffers[kind];\r\n if (value.toArray) {\r\n value.toArray(data, offset);\r\n }\r\n else {\r\n value.copyToArray(data, offset);\r\n }\r\n offset += stride;\r\n }\r\n // Update vertex buffer\r\n if (!this._userInstancedBuffersStorage.vertexBuffers[kind]) {\r\n this._userInstancedBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), this._userInstancedBuffersStorage.data[kind], kind, true, false, stride, true);\r\n this.setVerticesBuffer(this._userInstancedBuffersStorage.vertexBuffers[kind]);\r\n }\r\n else {\r\n this._userInstancedBuffersStorage.vertexBuffers[kind].updateDirectly(data, 0);\r\n }\r\n }\r\n};\r\nMesh.prototype._disposeInstanceSpecificData = function () {\r\n if (this._instanceDataStorage.instancesBuffer) {\r\n this._instanceDataStorage.instancesBuffer.dispose();\r\n this._instanceDataStorage.instancesBuffer = null;\r\n }\r\n while (this.instances.length) {\r\n this.instances[0].dispose();\r\n }\r\n for (var kind in this.instancedBuffers) {\r\n if (this._userInstancedBuffersStorage.vertexBuffers[kind]) {\r\n this._userInstancedBuffersStorage.vertexBuffers[kind].dispose();\r\n }\r\n }\r\n this.instancedBuffers = {};\r\n};\r\n//# sourceMappingURL=instancedMesh.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/clipPlaneFragmentDeclaration\";\r\nimport \"./ShadersInclude/clipPlaneFragment\";\r\nvar name = 'colorPixelShader';\r\nvar shader = \"#ifdef VERTEXCOLOR\\nvarying vec4 vColor;\\n#else\\nuniform vec4 color;\\n#endif\\n#include\\nvoid main(void) {\\n#include\\n#ifdef VERTEXCOLOR\\ngl_FragColor=vColor;\\n#else\\ngl_FragColor=color;\\n#endif\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var colorPixelShader = { name: name, shader: shader };\r\n//# sourceMappingURL=color.fragment.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/bonesDeclaration\";\r\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\r\nimport \"./ShadersInclude/instancesDeclaration\";\r\nimport \"./ShadersInclude/instancesVertex\";\r\nimport \"./ShadersInclude/bonesVertex\";\r\nimport \"./ShadersInclude/clipPlaneVertex\";\r\nvar name = 'colorVertexShader';\r\nvar shader = \"\\nattribute vec3 position;\\n#ifdef VERTEXCOLOR\\nattribute vec4 color;\\n#endif\\n#include\\n#include\\n\\n#include\\nuniform mat4 viewProjection;\\n#ifdef MULTIVIEW\\nuniform mat4 viewProjectionR;\\n#endif\\n\\n#ifdef VERTEXCOLOR\\nvarying vec4 vColor;\\n#endif\\nvoid main(void) {\\n#include\\n#include\\nvec4 worldPos=finalWorld*vec4(position,1.0);\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR == 0u) {\\ngl_Position=viewProjection*worldPos;\\n} else {\\ngl_Position=viewProjectionR*worldPos;\\n}\\n#else\\ngl_Position=viewProjection*worldPos;\\n#endif\\n#include\\n#ifdef VERTEXCOLOR\\n\\nvColor=color;\\n#endif\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var colorVertexShader = { name: name, shader: shader };\r\n//# sourceMappingURL=color.vertex.js.map","import { __extends } from \"tslib\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { InstancedMesh } from \"../Meshes/instancedMesh\";\r\nimport { Material } from \"../Materials/material\";\r\nimport { ShaderMaterial } from \"../Materials/shaderMaterial\";\r\nimport { MaterialHelper } from '../Materials/materialHelper';\r\nimport \"../Shaders/color.fragment\";\r\nimport \"../Shaders/color.vertex\";\r\n/**\r\n * Line mesh\r\n * @see https://doc.babylonjs.com/babylon101/parametric_shapes\r\n */\r\nvar LinesMesh = /** @class */ (function (_super) {\r\n __extends(LinesMesh, _super);\r\n /**\r\n * Creates a new LinesMesh\r\n * @param name defines the name\r\n * @param scene defines the hosting scene\r\n * @param parent defines the parent mesh if any\r\n * @param source defines the optional source LinesMesh used to clone data from\r\n * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.\r\n * When false, achieved by calling a clone(), also passing False.\r\n * This will make creation of children, recursive.\r\n * @param useVertexColor defines if this LinesMesh supports vertex color\r\n * @param useVertexAlpha defines if this LinesMesh supports vertex alpha\r\n */\r\n function LinesMesh(name, scene, parent, source, doNotCloneChildren, \r\n /**\r\n * If vertex color should be applied to the mesh\r\n */\r\n useVertexColor, \r\n /**\r\n * If vertex alpha should be applied to the mesh\r\n */\r\n useVertexAlpha) {\r\n if (scene === void 0) { scene = null; }\r\n if (parent === void 0) { parent = null; }\r\n if (source === void 0) { source = null; }\r\n var _this = _super.call(this, name, scene, parent, source, doNotCloneChildren) || this;\r\n _this.useVertexColor = useVertexColor;\r\n _this.useVertexAlpha = useVertexAlpha;\r\n /**\r\n * Color of the line (Default: White)\r\n */\r\n _this.color = new Color3(1, 1, 1);\r\n /**\r\n * Alpha of the line (Default: 1)\r\n */\r\n _this.alpha = 1;\r\n if (source) {\r\n _this.color = source.color.clone();\r\n _this.alpha = source.alpha;\r\n _this.useVertexColor = source.useVertexColor;\r\n _this.useVertexAlpha = source.useVertexAlpha;\r\n }\r\n _this.intersectionThreshold = 0.1;\r\n var defines = [];\r\n var options = {\r\n attributes: [VertexBuffer.PositionKind, \"world0\", \"world1\", \"world2\", \"world3\"],\r\n uniforms: [\"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"vClipPlane5\", \"vClipPlane6\", \"world\", \"viewProjection\"],\r\n needAlphaBlending: true,\r\n defines: defines\r\n };\r\n if (useVertexAlpha === false) {\r\n options.needAlphaBlending = false;\r\n }\r\n if (!useVertexColor) {\r\n options.uniforms.push(\"color\");\r\n _this.color4 = new Color4();\r\n }\r\n else {\r\n options.defines.push(\"#define VERTEXCOLOR\");\r\n options.attributes.push(VertexBuffer.ColorKind);\r\n }\r\n _this._colorShader = new ShaderMaterial(\"colorShader\", _this.getScene(), \"color\", options);\r\n return _this;\r\n }\r\n LinesMesh.prototype._addClipPlaneDefine = function (label) {\r\n var define = \"#define \" + label;\r\n var index = this._colorShader.options.defines.indexOf(define);\r\n if (index !== -1) {\r\n return;\r\n }\r\n this._colorShader.options.defines.push(define);\r\n };\r\n LinesMesh.prototype._removeClipPlaneDefine = function (label) {\r\n var define = \"#define \" + label;\r\n var index = this._colorShader.options.defines.indexOf(define);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._colorShader.options.defines.splice(index, 1);\r\n };\r\n LinesMesh.prototype.isReady = function () {\r\n var scene = this.getScene();\r\n // Clip planes\r\n scene.clipPlane ? this._addClipPlaneDefine(\"CLIPPLANE\") : this._removeClipPlaneDefine(\"CLIPPLANE\");\r\n scene.clipPlane2 ? this._addClipPlaneDefine(\"CLIPPLANE2\") : this._removeClipPlaneDefine(\"CLIPPLANE2\");\r\n scene.clipPlane3 ? this._addClipPlaneDefine(\"CLIPPLANE3\") : this._removeClipPlaneDefine(\"CLIPPLANE3\");\r\n scene.clipPlane4 ? this._addClipPlaneDefine(\"CLIPPLANE4\") : this._removeClipPlaneDefine(\"CLIPPLANE4\");\r\n scene.clipPlane5 ? this._addClipPlaneDefine(\"CLIPPLANE5\") : this._removeClipPlaneDefine(\"CLIPPLANE5\");\r\n scene.clipPlane6 ? this._addClipPlaneDefine(\"CLIPPLANE6\") : this._removeClipPlaneDefine(\"CLIPPLANE6\");\r\n if (!this._colorShader.isReady(this)) {\r\n return false;\r\n }\r\n return _super.prototype.isReady.call(this);\r\n };\r\n /**\r\n * Returns the string \"LineMesh\"\r\n */\r\n LinesMesh.prototype.getClassName = function () {\r\n return \"LinesMesh\";\r\n };\r\n Object.defineProperty(LinesMesh.prototype, \"material\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n return this._colorShader;\r\n },\r\n /**\r\n * @hidden\r\n */\r\n set: function (value) {\r\n // Do nothing\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(LinesMesh.prototype, \"checkCollisions\", {\r\n /**\r\n * @hidden\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n LinesMesh.prototype._bind = function (subMesh, effect, fillMode) {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n var colorEffect = this._colorShader.getEffect();\r\n // VBOs\r\n var indexToBind = this.isUnIndexed ? null : this._geometry.getIndexBuffer();\r\n this._geometry._bind(colorEffect, indexToBind);\r\n // Color\r\n if (!this.useVertexColor) {\r\n var _a = this.color, r = _a.r, g = _a.g, b = _a.b;\r\n this.color4.set(r, g, b, this.alpha);\r\n this._colorShader.setColor4(\"color\", this.color4);\r\n }\r\n // Clip planes\r\n MaterialHelper.BindClipPlane(colorEffect, this.getScene());\r\n return this;\r\n };\r\n /** @hidden */\r\n LinesMesh.prototype._draw = function (subMesh, fillMode, instancesCount) {\r\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\r\n return this;\r\n }\r\n var engine = this.getScene().getEngine();\r\n // Draw order\r\n if (this._unIndexed) {\r\n engine.drawArraysType(Material.LineListDrawMode, subMesh.verticesStart, subMesh.verticesCount, instancesCount);\r\n }\r\n else {\r\n engine.drawElementsType(Material.LineListDrawMode, subMesh.indexStart, subMesh.indexCount, instancesCount);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Disposes of the line mesh\r\n * @param doNotRecurse If children should be disposed\r\n */\r\n LinesMesh.prototype.dispose = function (doNotRecurse) {\r\n this._colorShader.dispose(false, false, true);\r\n _super.prototype.dispose.call(this, doNotRecurse);\r\n };\r\n /**\r\n * Returns a new LineMesh object cloned from the current one.\r\n */\r\n LinesMesh.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n if (newParent === void 0) { newParent = null; }\r\n return new LinesMesh(name, this.getScene(), newParent, this, doNotCloneChildren);\r\n };\r\n /**\r\n * Creates a new InstancedLinesMesh object from the mesh model.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_instances\r\n * @param name defines the name of the new instance\r\n * @returns a new InstancedLinesMesh\r\n */\r\n LinesMesh.prototype.createInstance = function (name) {\r\n return new InstancedLinesMesh(name, this);\r\n };\r\n return LinesMesh;\r\n}(Mesh));\r\nexport { LinesMesh };\r\n/**\r\n * Creates an instance based on a source LinesMesh\r\n */\r\nvar InstancedLinesMesh = /** @class */ (function (_super) {\r\n __extends(InstancedLinesMesh, _super);\r\n function InstancedLinesMesh(name, source) {\r\n var _this = _super.call(this, name, source) || this;\r\n _this.intersectionThreshold = source.intersectionThreshold;\r\n return _this;\r\n }\r\n /**\r\n * Returns the string \"InstancedLinesMesh\".\r\n */\r\n InstancedLinesMesh.prototype.getClassName = function () {\r\n return \"InstancedLinesMesh\";\r\n };\r\n return InstancedLinesMesh;\r\n}(InstancedMesh));\r\nexport { InstancedLinesMesh };\r\n//# sourceMappingURL=linesMesh.js.map","import { Vector3 } from \"../../Maths/math.vector\";\r\nimport { _CreationDataStorage, Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { LinesMesh } from \"../../Meshes/linesMesh\";\r\nimport { VertexBuffer } from \"../../Meshes/buffer\";\r\nVertexData.CreateLineSystem = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n var vertexColors = [];\r\n var idx = 0;\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var index = 0; index < points.length; index++) {\r\n positions.push(points[index].x, points[index].y, points[index].z);\r\n if (colors) {\r\n var color = colors[l];\r\n vertexColors.push(color[index].r, color[index].g, color[index].b, color[index].a);\r\n }\r\n if (index > 0) {\r\n indices.push(idx - 1);\r\n indices.push(idx);\r\n }\r\n idx++;\r\n }\r\n }\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n if (colors) {\r\n vertexData.colors = vertexColors;\r\n }\r\n return vertexData;\r\n};\r\nVertexData.CreateDashedLines = function (options) {\r\n var dashSize = options.dashSize || 3;\r\n var gapSize = options.gapSize || 1;\r\n var dashNb = options.dashNb || 200;\r\n var points = options.points;\r\n var positions = new Array();\r\n var indices = new Array();\r\n var curvect = Vector3.Zero();\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var idx = 0;\r\n var i = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / dashNb;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n for (var j = 0; j < nb; j++) {\r\n curshft = shft * j;\r\n positions.push(points[i].x + curshft * curvect.x, points[i].y + curshft * curvect.y, points[i].z + curshft * curvect.z);\r\n positions.push(points[i].x + (curshft + dashshft) * curvect.x, points[i].y + (curshft + dashshft) * curvect.y, points[i].z + (curshft + dashshft) * curvect.z);\r\n indices.push(idx, idx + 1);\r\n idx += 2;\r\n }\r\n }\r\n // Result\r\n var vertexData = new VertexData();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n return vertexData;\r\n};\r\nMesh.CreateLines = function (name, points, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (instance === void 0) { instance = null; }\r\n var options = {\r\n points: points,\r\n updatable: updatable,\r\n instance: instance\r\n };\r\n return LinesBuilder.CreateLines(name, options, scene);\r\n};\r\nMesh.CreateDashedLines = function (name, points, dashSize, gapSize, dashNb, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n var options = {\r\n points: points,\r\n dashSize: dashSize,\r\n gapSize: gapSize,\r\n dashNb: dashNb,\r\n updatable: updatable,\r\n instance: instance\r\n };\r\n return LinesBuilder.CreateDashedLines(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar LinesBuilder = /** @class */ (function () {\r\n function LinesBuilder() {\r\n }\r\n /**\r\n * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh\r\n * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function\r\n * * The parameter `lines` is an array of lines, each line being an array of successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter\r\n * * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * Updating a simple Line mesh, you just need to update every line in the `lines` array : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#line-system\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line system mesh\r\n */\r\n LinesBuilder.CreateLineSystem = function (name, options, scene) {\r\n var instance = options.instance;\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n if (instance) { // lines update\r\n var positions = instance.getVerticesData(VertexBuffer.PositionKind);\r\n var vertexColor;\r\n var lineColors;\r\n if (colors) {\r\n vertexColor = instance.getVerticesData(VertexBuffer.ColorKind);\r\n }\r\n var i = 0;\r\n var c = 0;\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var p = 0; p < points.length; p++) {\r\n positions[i] = points[p].x;\r\n positions[i + 1] = points[p].y;\r\n positions[i + 2] = points[p].z;\r\n if (colors && vertexColor) {\r\n lineColors = colors[l];\r\n vertexColor[c] = lineColors[p].r;\r\n vertexColor[c + 1] = lineColors[p].g;\r\n vertexColor[c + 2] = lineColors[p].b;\r\n vertexColor[c + 3] = lineColors[p].a;\r\n c += 4;\r\n }\r\n i += 3;\r\n }\r\n }\r\n instance.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\r\n if (colors && vertexColor) {\r\n instance.updateVerticesData(VertexBuffer.ColorKind, vertexColor, false, false);\r\n }\r\n return instance;\r\n }\r\n // line system creation\r\n var useVertexColor = (colors) ? true : false;\r\n var lineSystem = new LinesMesh(name, scene, null, undefined, undefined, useVertexColor, options.useVertexAlpha);\r\n var vertexData = VertexData.CreateLineSystem(options);\r\n vertexData.applyToMesh(lineSystem, options.updatable);\r\n return lineSystem;\r\n };\r\n /**\r\n * Creates a line mesh\r\n * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `colors` is an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need alpha blending (faster)\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#lines\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line mesh\r\n */\r\n LinesBuilder.CreateLines = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var colors = (options.colors) ? [options.colors] : null;\r\n var lines = LinesBuilder.CreateLineSystem(name, { lines: [options.points], updatable: options.updatable, instance: options.instance, colors: colors, useVertexAlpha: options.useVertexAlpha }, scene);\r\n return lines;\r\n };\r\n /**\r\n * Creates a dashed line mesh\r\n * * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200)\r\n * * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3)\r\n * * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the dashed line mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#dashed-lines\r\n */\r\n LinesBuilder.CreateDashedLines = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var points = options.points;\r\n var instance = options.instance;\r\n var gapSize = options.gapSize || 1;\r\n var dashSize = options.dashSize || 3;\r\n if (instance) { // dashed lines update\r\n var positionFunction = function (positions) {\r\n var curvect = Vector3.Zero();\r\n var nbSeg = positions.length / 6;\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var p = 0;\r\n var i = 0;\r\n var j = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / nbSeg;\r\n var dashSize = instance._creationDataStorage.dashSize;\r\n var gapSize = instance._creationDataStorage.gapSize;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n j = 0;\r\n while (j < nb && p < positions.length) {\r\n curshft = shft * j;\r\n positions[p] = points[i].x + curshft * curvect.x;\r\n positions[p + 1] = points[i].y + curshft * curvect.y;\r\n positions[p + 2] = points[i].z + curshft * curvect.z;\r\n positions[p + 3] = points[i].x + (curshft + dashshft) * curvect.x;\r\n positions[p + 4] = points[i].y + (curshft + dashshft) * curvect.y;\r\n positions[p + 5] = points[i].z + (curshft + dashshft) * curvect.z;\r\n p += 6;\r\n j++;\r\n }\r\n }\r\n while (p < positions.length) {\r\n positions[p] = points[i].x;\r\n positions[p + 1] = points[i].y;\r\n positions[p + 2] = points[i].z;\r\n p += 3;\r\n }\r\n };\r\n instance.updateMeshPositions(positionFunction, false);\r\n return instance;\r\n }\r\n // dashed lines creation\r\n var dashedLines = new LinesMesh(name, scene, null, undefined, undefined, undefined, options.useVertexAlpha);\r\n var vertexData = VertexData.CreateDashedLines(options);\r\n vertexData.applyToMesh(dashedLines, options.updatable);\r\n dashedLines._creationDataStorage = new _CreationDataStorage();\r\n dashedLines._creationDataStorage.dashSize = dashSize;\r\n dashedLines._creationDataStorage.gapSize = gapSize;\r\n return dashedLines;\r\n };\r\n return LinesBuilder;\r\n}());\r\nexport { LinesBuilder };\r\n//# sourceMappingURL=linesBuilder.js.map","import { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nVertexData.CreatePlane = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n var width = options.width || options.size || 1;\r\n var height = options.height || options.size || 1;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n // Vertices\r\n var halfWidth = width / 2.0;\r\n var halfHeight = height / 2.0;\r\n positions.push(-halfWidth, -halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(0.0, 0.0);\r\n positions.push(halfWidth, -halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(1.0, 0.0);\r\n positions.push(halfWidth, halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(1.0, 1.0);\r\n positions.push(-halfWidth, halfHeight, 0);\r\n normals.push(0, 0, -1.0);\r\n uvs.push(0.0, 1.0);\r\n // Indices\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\nMesh.CreatePlane = function (name, size, scene, updatable, sideOrientation) {\r\n var options = {\r\n size: size,\r\n width: size,\r\n height: size,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return PlaneBuilder.CreatePlane(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar PlaneBuilder = /** @class */ (function () {\r\n function PlaneBuilder() {\r\n }\r\n /**\r\n * Creates a plane mesh\r\n * * The parameter `size` sets the size (float) of both sides of the plane at once (default 1)\r\n * * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value of `size`)\r\n * * The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the plane mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#plane\r\n */\r\n PlaneBuilder.CreatePlane = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var plane = new Mesh(name, scene);\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n plane._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = VertexData.CreatePlane(options);\r\n vertexData.applyToMesh(plane, options.updatable);\r\n if (options.sourcePlane) {\r\n plane.translate(options.sourcePlane.normal, -options.sourcePlane.d);\r\n plane.setDirection(options.sourcePlane.normal.scale(-1));\r\n }\r\n return plane;\r\n };\r\n return PlaneBuilder;\r\n}());\r\nexport { PlaneBuilder };\r\n//# sourceMappingURL=planeBuilder.js.map","import { Vector3, Matrix } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nVertexData.CreateSphere = function (options) {\r\n var segments = options.segments || 32;\r\n var diameterX = options.diameterX || options.diameter || 1;\r\n var diameterY = options.diameterY || options.diameter || 1;\r\n var diameterZ = options.diameterZ || options.diameter || 1;\r\n var arc = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n var slice = options.slice && (options.slice <= 0) ? 1.0 : options.slice || 1.0;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n var dedupTopBottomIndices = !!options.dedupTopBottomIndices;\r\n var radius = new Vector3(diameterX / 2, diameterY / 2, diameterZ / 2);\r\n var totalZRotationSteps = 2 + segments;\r\n var totalYRotationSteps = 2 * totalZRotationSteps;\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n for (var zRotationStep = 0; zRotationStep <= totalZRotationSteps; zRotationStep++) {\r\n var normalizedZ = zRotationStep / totalZRotationSteps;\r\n var angleZ = normalizedZ * Math.PI * slice;\r\n for (var yRotationStep = 0; yRotationStep <= totalYRotationSteps; yRotationStep++) {\r\n var normalizedY = yRotationStep / totalYRotationSteps;\r\n var angleY = normalizedY * Math.PI * 2 * arc;\r\n var rotationZ = Matrix.RotationZ(-angleZ);\r\n var rotationY = Matrix.RotationY(angleY);\r\n var afterRotZ = Vector3.TransformCoordinates(Vector3.Up(), rotationZ);\r\n var complete = Vector3.TransformCoordinates(afterRotZ, rotationY);\r\n var vertex = complete.multiply(radius);\r\n var normal = complete.divide(radius).normalize();\r\n positions.push(vertex.x, vertex.y, vertex.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(normalizedY, normalizedZ);\r\n }\r\n if (zRotationStep > 0) {\r\n var verticesCount = positions.length / 3;\r\n for (var firstIndex = verticesCount - 2 * (totalYRotationSteps + 1); (firstIndex + totalYRotationSteps + 2) < verticesCount; firstIndex++) {\r\n if (dedupTopBottomIndices) {\r\n if (zRotationStep > 1) {\r\n indices.push((firstIndex));\r\n indices.push((firstIndex + 1));\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n }\r\n if (zRotationStep < totalZRotationSteps || slice < 1.0) {\r\n indices.push((firstIndex + totalYRotationSteps + 1));\r\n indices.push((firstIndex + 1));\r\n indices.push((firstIndex + totalYRotationSteps + 2));\r\n }\r\n }\r\n else {\r\n indices.push(firstIndex);\r\n indices.push(firstIndex + 1);\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n indices.push(firstIndex + totalYRotationSteps + 1);\r\n indices.push(firstIndex + 1);\r\n indices.push(firstIndex + totalYRotationSteps + 2);\r\n }\r\n }\r\n }\r\n }\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\nMesh.CreateSphere = function (name, segments, diameter, scene, updatable, sideOrientation) {\r\n var options = {\r\n segments: segments,\r\n diameterX: diameter,\r\n diameterY: diameter,\r\n diameterZ: diameter,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return SphereBuilder.CreateSphere(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar SphereBuilder = /** @class */ (function () {\r\n function SphereBuilder() {\r\n }\r\n /**\r\n * Creates a sphere mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the sphere (default 1)\r\n * * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value of `diameter`)\r\n * * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio\r\n * * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the sphere mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#sphere\r\n */\r\n SphereBuilder.CreateSphere = function (name, options, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var sphere = new Mesh(name, scene);\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n sphere._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = VertexData.CreateSphere(options);\r\n vertexData.applyToMesh(sphere, options.updatable);\r\n return sphere;\r\n };\r\n return SphereBuilder;\r\n}());\r\nexport { SphereBuilder };\r\n//# sourceMappingURL=sphereBuilder.js.map","import { Matrix, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nVertexData.CreateTorus = function (options) {\r\n var indices = [];\r\n var positions = [];\r\n var normals = [];\r\n var uvs = [];\r\n var diameter = options.diameter || 1;\r\n var thickness = options.thickness || 0.5;\r\n var tessellation = options.tessellation || 16;\r\n var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n var stride = tessellation + 1;\r\n for (var i = 0; i <= tessellation; i++) {\r\n var u = i / tessellation;\r\n var outerAngle = i * Math.PI * 2.0 / tessellation - Math.PI / 2.0;\r\n var transform = Matrix.Translation(diameter / 2.0, 0, 0).multiply(Matrix.RotationY(outerAngle));\r\n for (var j = 0; j <= tessellation; j++) {\r\n var v = 1 - j / tessellation;\r\n var innerAngle = j * Math.PI * 2.0 / tessellation + Math.PI;\r\n var dx = Math.cos(innerAngle);\r\n var dy = Math.sin(innerAngle);\r\n // Create a vertex.\r\n var normal = new Vector3(dx, dy, 0);\r\n var position = normal.scale(thickness / 2);\r\n var textureCoordinate = new Vector2(u, v);\r\n position = Vector3.TransformCoordinates(position, transform);\r\n normal = Vector3.TransformNormal(normal, transform);\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(textureCoordinate.x, textureCoordinate.y);\r\n // And create indices for two triangles.\r\n var nextI = (i + 1) % stride;\r\n var nextJ = (j + 1) % stride;\r\n indices.push(i * stride + j);\r\n indices.push(i * stride + nextJ);\r\n indices.push(nextI * stride + j);\r\n indices.push(i * stride + nextJ);\r\n indices.push(nextI * stride + nextJ);\r\n indices.push(nextI * stride + j);\r\n }\r\n }\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n // Result\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n};\r\nMesh.CreateTorus = function (name, diameter, thickness, tessellation, scene, updatable, sideOrientation) {\r\n var options = {\r\n diameter: diameter,\r\n thickness: thickness,\r\n tessellation: tessellation,\r\n sideOrientation: sideOrientation,\r\n updatable: updatable\r\n };\r\n return TorusBuilder.CreateTorus(name, options, scene);\r\n};\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n */\r\nvar TorusBuilder = /** @class */ (function () {\r\n function TorusBuilder() {\r\n }\r\n /**\r\n * Creates a torus mesh\r\n * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)\r\n * * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5)\r\n * * The parameter `tessellation` sets the number of torus sides (postive integer, default 16)\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the torus mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#torus\r\n */\r\n TorusBuilder.CreateTorus = function (name, options, scene) {\r\n var torus = new Mesh(name, scene);\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n torus._originalBuilderSideOrientation = options.sideOrientation;\r\n var vertexData = VertexData.CreateTorus(options);\r\n vertexData.applyToMesh(torus, options.updatable);\r\n return torus;\r\n };\r\n return TorusBuilder;\r\n}());\r\nexport { TorusBuilder };\r\n//# sourceMappingURL=torusBuilder.js.map","import { __extends } from \"tslib\";\r\nimport { DataBuffer } from '../dataBuffer';\r\n/** @hidden */\r\nvar WebGLDataBuffer = /** @class */ (function (_super) {\r\n __extends(WebGLDataBuffer, _super);\r\n function WebGLDataBuffer(resource) {\r\n var _this = _super.call(this) || this;\r\n _this._buffer = resource;\r\n return _this;\r\n }\r\n Object.defineProperty(WebGLDataBuffer.prototype, \"underlyingResource\", {\r\n get: function () {\r\n return this._buffer;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return WebGLDataBuffer;\r\n}(DataBuffer));\r\nexport { WebGLDataBuffer };\r\n//# sourceMappingURL=webGLDataBuffer.js.map","/**\r\n * Class used to store gfx data (like WebGLBuffer)\r\n */\r\nvar DataBuffer = /** @class */ (function () {\r\n function DataBuffer() {\r\n /**\r\n * Gets or sets the number of objects referencing this buffer\r\n */\r\n this.references = 0;\r\n /** Gets or sets the size of the underlying buffer */\r\n this.capacity = 0;\r\n /**\r\n * Gets or sets a boolean indicating if the buffer contains 32bits indices\r\n */\r\n this.is32Bits = false;\r\n }\r\n Object.defineProperty(DataBuffer.prototype, \"underlyingResource\", {\r\n /**\r\n * Gets the underlying buffer\r\n */\r\n get: function () {\r\n return null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return DataBuffer;\r\n}());\r\nexport { DataBuffer };\r\n//# sourceMappingURL=dataBuffer.js.map","import { Vector3 } from '../Maths/math.vector';\r\n/**\r\n * @hidden\r\n */\r\nvar _MeshCollisionData = /** @class */ (function () {\r\n function _MeshCollisionData() {\r\n this._checkCollisions = false;\r\n this._collisionMask = -1;\r\n this._collisionGroup = -1;\r\n this._surroundingMeshes = null;\r\n this._collider = null;\r\n this._oldPositionForCollisions = new Vector3(0, 0, 0);\r\n this._diffPositionForCollisions = new Vector3(0, 0, 0);\r\n this._collisionResponse = true;\r\n }\r\n return _MeshCollisionData;\r\n}());\r\nexport { _MeshCollisionData };\r\n//# sourceMappingURL=meshCollisionData.js.map","import { __extends } from \"tslib\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Quaternion, Matrix, Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { VertexData } from \"../Meshes/mesh.vertexData\";\r\nimport { TransformNode } from \"../Meshes/transformNode\";\r\nimport { PickingInfo } from \"../Collisions/pickingInfo\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { _MeshCollisionData } from '../Collisions/meshCollisionData';\r\nimport { _DevTools } from '../Misc/devTools';\r\nimport { extractMinAndMax } from '../Maths/math.functions';\r\nimport { Color3, Color4 } from '../Maths/math.color';\r\nimport { Epsilon } from '../Maths/math.constants';\r\nimport { Axis } from '../Maths/math.axis';\r\nimport { _TypeStore } from '../Misc/typeStore';\r\n/** @hidden */\r\nvar _FacetDataStorage = /** @class */ (function () {\r\n function _FacetDataStorage() {\r\n this.facetNb = 0; // facet number\r\n this.partitioningSubdivisions = 10; // number of subdivisions per axis in the partioning space\r\n this.partitioningBBoxRatio = 1.01; // the partioning array space is by default 1% bigger than the bounding box\r\n this.facetDataEnabled = false; // is the facet data feature enabled on this mesh ?\r\n this.facetParameters = {}; // keep a reference to the object parameters to avoid memory re-allocation\r\n this.bbSize = Vector3.Zero(); // bbox size approximated for facet data\r\n this.subDiv = {\r\n max: 1,\r\n X: 1,\r\n Y: 1,\r\n Z: 1\r\n };\r\n this.facetDepthSort = false; // is the facet depth sort to be computed\r\n this.facetDepthSortEnabled = false; // is the facet depth sort initialized\r\n }\r\n return _FacetDataStorage;\r\n}());\r\n/**\r\n * @hidden\r\n **/\r\nvar _InternalAbstractMeshDataInfo = /** @class */ (function () {\r\n function _InternalAbstractMeshDataInfo() {\r\n this._hasVertexAlpha = false;\r\n this._useVertexColors = true;\r\n this._numBoneInfluencers = 4;\r\n this._applyFog = true;\r\n this._receiveShadows = false;\r\n this._facetData = new _FacetDataStorage();\r\n this._visibility = 1.0;\r\n this._skeleton = null;\r\n this._layerMask = 0x0FFFFFFF;\r\n this._computeBonesUsingShaders = true;\r\n this._isActive = false;\r\n this._onlyForInstances = false;\r\n this._isActiveIntermediate = false;\r\n this._onlyForInstancesIntermediate = false;\r\n this._actAsRegularMesh = false;\r\n this._currentLOD = null;\r\n this._currentLODIsUpToDate = false;\r\n }\r\n return _InternalAbstractMeshDataInfo;\r\n}());\r\n/**\r\n * Class used to store all common mesh properties\r\n */\r\nvar AbstractMesh = /** @class */ (function (_super) {\r\n __extends(AbstractMesh, _super);\r\n // Constructor\r\n /**\r\n * Creates a new AbstractMesh\r\n * @param name defines the name of the mesh\r\n * @param scene defines the hosting scene\r\n */\r\n function AbstractMesh(name, scene) {\r\n if (scene === void 0) { scene = null; }\r\n var _this = _super.call(this, name, scene, false) || this;\r\n // Internal data\r\n /** @hidden */\r\n _this._internalAbstractMeshDataInfo = new _InternalAbstractMeshDataInfo();\r\n /**\r\n * The culling strategy to use to check whether the mesh must be rendered or not.\r\n * This value can be changed at any time and will be used on the next render mesh selection.\r\n * The possible values are :\r\n * - AbstractMesh.CULLINGSTRATEGY_STANDARD\r\n * - AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY\r\n * Please read each static variable documentation to get details about the culling process.\r\n * */\r\n _this.cullingStrategy = AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY;\r\n // Events\r\n /**\r\n * An event triggered when this mesh collides with another one\r\n */\r\n _this.onCollideObservable = new Observable();\r\n /**\r\n * An event triggered when the collision's position changes\r\n */\r\n _this.onCollisionPositionChangeObservable = new Observable();\r\n /**\r\n * An event triggered when material is changed\r\n */\r\n _this.onMaterialChangedObservable = new Observable();\r\n // Properties\r\n /**\r\n * Gets or sets the orientation for POV movement & rotation\r\n */\r\n _this.definedFacingForward = true;\r\n /** @hidden */\r\n _this._occlusionQuery = null;\r\n /** @hidden */\r\n _this._renderingGroup = null;\r\n /** Gets or sets the alpha index used to sort transparent meshes\r\n * @see https://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered#alpha-index\r\n */\r\n _this.alphaIndex = Number.MAX_VALUE;\r\n /**\r\n * Gets or sets a boolean indicating if the mesh is visible (renderable). Default is true\r\n */\r\n _this.isVisible = true;\r\n /**\r\n * Gets or sets a boolean indicating if the mesh can be picked (by scene.pick for instance or through actions). Default is true\r\n */\r\n _this.isPickable = true;\r\n /** Gets or sets a boolean indicating that bounding boxes of subMeshes must be rendered as well (false by default) */\r\n _this.showSubMeshesBoundingBox = false;\r\n /** Gets or sets a boolean indicating if the mesh must be considered as a ray blocker for lens flares (false by default)\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lens_flares\r\n */\r\n _this.isBlocker = false;\r\n /**\r\n * Gets or sets a boolean indicating that pointer move events must be supported on this mesh (false by default)\r\n */\r\n _this.enablePointerMoveEvents = false;\r\n _this._renderingGroupId = 0;\r\n _this._material = null;\r\n /** Defines color to use when rendering outline */\r\n _this.outlineColor = Color3.Red();\r\n /** Define width to use when rendering outline */\r\n _this.outlineWidth = 0.02;\r\n /** Defines color to use when rendering overlay */\r\n _this.overlayColor = Color3.Red();\r\n /** Defines alpha to use when rendering overlay */\r\n _this.overlayAlpha = 0.5;\r\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes selection (true by default) */\r\n _this.useOctreeForRenderingSelection = true;\r\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes picking (true by default) */\r\n _this.useOctreeForPicking = true;\r\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes collision (true by default) */\r\n _this.useOctreeForCollisions = true;\r\n /**\r\n * True if the mesh must be rendered in any case (this will shortcut the frustum clipping phase)\r\n */\r\n _this.alwaysSelectAsActiveMesh = false;\r\n /**\r\n * Gets or sets a boolean indicating that the bounding info does not need to be kept in sync (for performance reason)\r\n */\r\n _this.doNotSyncBoundingInfo = false;\r\n /**\r\n * Gets or sets the current action manager\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_actions\r\n */\r\n _this.actionManager = null;\r\n // Collisions\r\n _this._meshCollisionData = new _MeshCollisionData();\r\n /**\r\n * Gets or sets the ellipsoid used to impersonate this mesh when using collision engine (default is (0.5, 1, 0.5))\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.ellipsoid = new Vector3(0.5, 1, 0.5);\r\n /**\r\n * Gets or sets the ellipsoid offset used to impersonate this mesh when using collision engine (default is (0, 0, 0))\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.ellipsoidOffset = new Vector3(0, 0, 0);\r\n // Edges\r\n /**\r\n * Defines edge width used when edgesRenderer is enabled\r\n * @see https://www.babylonjs-playground.com/#10OJSG#13\r\n */\r\n _this.edgesWidth = 1;\r\n /**\r\n * Defines edge color used when edgesRenderer is enabled\r\n * @see https://www.babylonjs-playground.com/#10OJSG#13\r\n */\r\n _this.edgesColor = new Color4(1, 0, 0, 1);\r\n /** @hidden */\r\n _this._edgesRenderer = null;\r\n /** @hidden */\r\n _this._masterMesh = null;\r\n /** @hidden */\r\n _this._boundingInfo = null;\r\n /** @hidden */\r\n _this._renderId = 0;\r\n /** @hidden */\r\n _this._intersectionsInProgress = new Array();\r\n /** @hidden */\r\n _this._unIndexed = false;\r\n /** @hidden */\r\n _this._lightSources = new Array();\r\n // Loading properties\r\n /** @hidden */\r\n _this._waitingData = {\r\n lods: null,\r\n actions: null,\r\n freezeWorldMatrix: null\r\n };\r\n /** @hidden */\r\n _this._bonesTransformMatrices = null;\r\n /** @hidden */\r\n _this._transformMatrixTexture = null;\r\n /**\r\n * An event triggered when the mesh is rebuilt.\r\n */\r\n _this.onRebuildObservable = new Observable();\r\n _this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {\r\n if (collidedMesh === void 0) { collidedMesh = null; }\r\n newPosition.subtractToRef(_this._meshCollisionData._oldPositionForCollisions, _this._meshCollisionData._diffPositionForCollisions);\r\n if (_this._meshCollisionData._diffPositionForCollisions.length() > Engine.CollisionsEpsilon) {\r\n _this.position.addInPlace(_this._meshCollisionData._diffPositionForCollisions);\r\n }\r\n if (collidedMesh) {\r\n _this.onCollideObservable.notifyObservers(collidedMesh);\r\n }\r\n _this.onCollisionPositionChangeObservable.notifyObservers(_this.position);\r\n };\r\n _this.getScene().addMesh(_this);\r\n _this._resyncLightSources();\r\n return _this;\r\n }\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_NONE\", {\r\n /**\r\n * No billboard\r\n */\r\n get: function () {\r\n return TransformNode.BILLBOARDMODE_NONE;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_X\", {\r\n /** Billboard on X axis */\r\n get: function () {\r\n return TransformNode.BILLBOARDMODE_X;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_Y\", {\r\n /** Billboard on Y axis */\r\n get: function () {\r\n return TransformNode.BILLBOARDMODE_Y;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_Z\", {\r\n /** Billboard on Z axis */\r\n get: function () {\r\n return TransformNode.BILLBOARDMODE_Z;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_ALL\", {\r\n /** Billboard on all axes */\r\n get: function () {\r\n return TransformNode.BILLBOARDMODE_ALL;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh, \"BILLBOARDMODE_USE_POSITION\", {\r\n /** Billboard on using position instead of orientation */\r\n get: function () {\r\n return TransformNode.BILLBOARDMODE_USE_POSITION;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"facetNb\", {\r\n /**\r\n * Gets the number of facets in the mesh\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata#what-is-a-mesh-facet\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetNb;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"partitioningSubdivisions\", {\r\n /**\r\n * Gets or set the number (integer) of subdivisions per axis in the partioning space\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata#tweaking-the-partitioning\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions;\r\n },\r\n set: function (nb) {\r\n this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions = nb;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"partitioningBBoxRatio\", {\r\n /**\r\n * The ratio (float) to apply to the bouding box size to set to the partioning space.\r\n * Ex : 1.01 (default) the partioning space is 1% bigger than the bounding box\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata#tweaking-the-partitioning\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio;\r\n },\r\n set: function (ratio) {\r\n this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio = ratio;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"mustDepthSortFacets\", {\r\n /**\r\n * Gets or sets a boolean indicating that the facets must be depth sorted on next call to `updateFacetData()`.\r\n * Works only for updatable meshes.\r\n * Doesn't work with multi-materials\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata#facet-depth-sort\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetDepthSort;\r\n },\r\n set: function (sort) {\r\n this._internalAbstractMeshDataInfo._facetData.facetDepthSort = sort;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"facetDepthSortFrom\", {\r\n /**\r\n * The location (Vector3) where the facet depth sort must be computed from.\r\n * By default, the active camera position.\r\n * Used only when facet depth sort is enabled\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata#facet-depth-sort\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom;\r\n },\r\n set: function (location) {\r\n this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom = location;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"isFacetDataEnabled\", {\r\n /**\r\n * gets a boolean indicating if facetData is enabled\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata#what-is-a-mesh-facet\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n AbstractMesh.prototype._updateNonUniformScalingState = function (value) {\r\n if (!_super.prototype._updateNonUniformScalingState.call(this, value)) {\r\n return false;\r\n }\r\n this._markSubMeshesAsMiscDirty();\r\n return true;\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"onCollide\", {\r\n /** Set a function to call when this mesh collides with another one */\r\n set: function (callback) {\r\n if (this._meshCollisionData._onCollideObserver) {\r\n this.onCollideObservable.remove(this._meshCollisionData._onCollideObserver);\r\n }\r\n this._meshCollisionData._onCollideObserver = this.onCollideObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"onCollisionPositionChange\", {\r\n /** Set a function to call when the collision's position changes */\r\n set: function (callback) {\r\n if (this._meshCollisionData._onCollisionPositionChangeObserver) {\r\n this.onCollisionPositionChangeObservable.remove(this._meshCollisionData._onCollisionPositionChangeObserver);\r\n }\r\n this._meshCollisionData._onCollisionPositionChangeObserver = this.onCollisionPositionChangeObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"visibility\", {\r\n /**\r\n * Gets or sets mesh visibility between 0 and 1 (default is 1)\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._visibility;\r\n },\r\n /**\r\n * Gets or sets mesh visibility between 0 and 1 (default is 1)\r\n */\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._visibility === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._visibility = value;\r\n this._markSubMeshesAsMiscDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"renderingGroupId\", {\r\n /**\r\n * Specifies the rendering group id for this mesh (0 by default)\r\n * @see https://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered#rendering-groups\r\n */\r\n get: function () {\r\n return this._renderingGroupId;\r\n },\r\n set: function (value) {\r\n this._renderingGroupId = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"material\", {\r\n /** Gets or sets current material */\r\n get: function () {\r\n return this._material;\r\n },\r\n set: function (value) {\r\n if (this._material === value) {\r\n return;\r\n }\r\n // remove from material mesh map id needed\r\n if (this._material && this._material.meshMap) {\r\n this._material.meshMap[this.uniqueId] = undefined;\r\n }\r\n this._material = value;\r\n if (value && value.meshMap) {\r\n value.meshMap[this.uniqueId] = this;\r\n }\r\n if (this.onMaterialChangedObservable.hasObservers()) {\r\n this.onMaterialChangedObservable.notifyObservers(this);\r\n }\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n this._unBindEffect();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"receiveShadows\", {\r\n /**\r\n * Gets or sets a boolean indicating that this mesh can receive realtime shadows\r\n * @see https://doc.babylonjs.com/babylon101/shadows\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._receiveShadows;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._receiveShadows === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._receiveShadows = value;\r\n this._markSubMeshesAsLightDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"hasVertexAlpha\", {\r\n /** Gets or sets a boolean indicating that this mesh contains vertex color data with alpha values */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._hasVertexAlpha;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._hasVertexAlpha === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._hasVertexAlpha = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n this._markSubMeshesAsMiscDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"useVertexColors\", {\r\n /** Gets or sets a boolean indicating that this mesh needs to use vertex color data to render (if this kind of vertex data is available in the geometry) */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._useVertexColors;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._useVertexColors === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._useVertexColors = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"computeBonesUsingShaders\", {\r\n /**\r\n * Gets or sets a boolean indicating that bone animations must be computed by the CPU (false by default)\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._computeBonesUsingShaders;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._computeBonesUsingShaders === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._computeBonesUsingShaders = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"numBoneInfluencers\", {\r\n /** Gets or sets the number of allowed bone influences per vertex (4 by default) */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._numBoneInfluencers;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._numBoneInfluencers === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._numBoneInfluencers = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"applyFog\", {\r\n /** Gets or sets a boolean indicating that this mesh will allow fog to be rendered on it (true by default) */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._applyFog;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._applyFog === value) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._applyFog = value;\r\n this._markSubMeshesAsMiscDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"layerMask\", {\r\n /**\r\n * Gets or sets the current layer mask (default is 0x0FFFFFFF)\r\n * @see https://doc.babylonjs.com/how_to/layermasks_and_multi-cam_textures\r\n */\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._layerMask;\r\n },\r\n set: function (value) {\r\n if (value === this._internalAbstractMeshDataInfo._layerMask) {\r\n return;\r\n }\r\n this._internalAbstractMeshDataInfo._layerMask = value;\r\n this._resyncLightSources();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"collisionMask\", {\r\n /**\r\n * Gets or sets a collision mask used to mask collisions (default is -1).\r\n * A collision between A and B will happen if A.collisionGroup & b.collisionMask !== 0\r\n */\r\n get: function () {\r\n return this._meshCollisionData._collisionMask;\r\n },\r\n set: function (mask) {\r\n this._meshCollisionData._collisionMask = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"collisionResponse\", {\r\n /**\r\n * Gets or sets a collision response flag (default is true).\r\n * when collisionResponse is false, events are still triggered but colliding entity has no response\r\n * This helps creating trigger volume when user wants collision feedback events but not position/velocity\r\n * to respond to the collision.\r\n */\r\n get: function () {\r\n return this._meshCollisionData._collisionResponse;\r\n },\r\n set: function (response) {\r\n this._meshCollisionData._collisionResponse = response;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"collisionGroup\", {\r\n /**\r\n * Gets or sets the current collision group mask (-1 by default).\r\n * A collision between A and B will happen if A.collisionGroup & b.collisionMask !== 0\r\n */\r\n get: function () {\r\n return this._meshCollisionData._collisionGroup;\r\n },\r\n set: function (mask) {\r\n this._meshCollisionData._collisionGroup = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"surroundingMeshes\", {\r\n /**\r\n * Gets or sets current surrounding meshes (null by default).\r\n *\r\n * By default collision detection is tested against every mesh in the scene.\r\n * It is possible to set surroundingMeshes to a defined list of meshes and then only these specified\r\n * meshes will be tested for the collision.\r\n *\r\n * Note: if set to an empty array no collision will happen when this mesh is moved.\r\n */\r\n get: function () {\r\n return this._meshCollisionData._surroundingMeshes;\r\n },\r\n set: function (meshes) {\r\n this._meshCollisionData._surroundingMeshes = meshes;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"lightSources\", {\r\n /** Gets the list of lights affecting that mesh */\r\n get: function () {\r\n return this._lightSources;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"_positions\", {\r\n /** @hidden */\r\n get: function () {\r\n return null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"skeleton\", {\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._skeleton;\r\n },\r\n /**\r\n * Gets or sets a skeleton to apply skining transformations\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\n set: function (value) {\r\n var skeleton = this._internalAbstractMeshDataInfo._skeleton;\r\n if (skeleton && skeleton.needInitialSkinMatrix) {\r\n skeleton._unregisterMeshWithPoseMatrix(this);\r\n }\r\n if (value && value.needInitialSkinMatrix) {\r\n value._registerMeshWithPoseMatrix(this);\r\n }\r\n this._internalAbstractMeshDataInfo._skeleton = value;\r\n if (!this._internalAbstractMeshDataInfo._skeleton) {\r\n this._bonesTransformMatrices = null;\r\n }\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"AbstractMesh\"\r\n * @returns \"AbstractMesh\"\r\n */\r\n AbstractMesh.prototype.getClassName = function () {\r\n return \"AbstractMesh\";\r\n };\r\n /**\r\n * Gets a string representation of the current mesh\r\n * @param fullDetails defines a boolean indicating if full details must be included\r\n * @returns a string representation of the current mesh\r\n */\r\n AbstractMesh.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name + \", isInstance: \" + (this.getClassName() !== \"InstancedMesh\" ? \"YES\" : \"NO\");\r\n ret += \", # of submeshes: \" + (this.subMeshes ? this.subMeshes.length : 0);\r\n var skeleton = this._internalAbstractMeshDataInfo._skeleton;\r\n if (skeleton) {\r\n ret += \", skeleton: \" + skeleton.name;\r\n }\r\n if (fullDetails) {\r\n ret += \", billboard mode: \" + ([\"NONE\", \"X\", \"Y\", null, \"Z\", null, null, \"ALL\"])[this.billboardMode];\r\n ret += \", freeze wrld mat: \" + (this._isWorldMatrixFrozen || this._waitingData.freezeWorldMatrix ? \"YES\" : \"NO\");\r\n }\r\n return ret;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n AbstractMesh.prototype._getEffectiveParent = function () {\r\n if (this._masterMesh && this.billboardMode !== TransformNode.BILLBOARDMODE_NONE) {\r\n return this._masterMesh;\r\n }\r\n return _super.prototype._getEffectiveParent.call(this);\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._getActionManagerForTrigger = function (trigger, initialCall) {\r\n if (initialCall === void 0) { initialCall = true; }\r\n if (this.actionManager && (initialCall || this.actionManager.isRecursive)) {\r\n if (trigger) {\r\n if (this.actionManager.hasSpecificTrigger(trigger)) {\r\n return this.actionManager;\r\n }\r\n }\r\n else {\r\n return this.actionManager;\r\n }\r\n }\r\n if (!this.parent) {\r\n return null;\r\n }\r\n return this.parent._getActionManagerForTrigger(trigger, false);\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._rebuild = function () {\r\n this.onRebuildObservable.notifyObservers(this);\r\n if (this._occlusionQuery) {\r\n this._occlusionQuery = null;\r\n }\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n subMesh._rebuild();\r\n }\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._resyncLightSources = function () {\r\n this._lightSources.length = 0;\r\n for (var _i = 0, _a = this.getScene().lights; _i < _a.length; _i++) {\r\n var light = _a[_i];\r\n if (!light.isEnabled()) {\r\n continue;\r\n }\r\n if (light.canAffectMesh(this)) {\r\n this._lightSources.push(light);\r\n }\r\n }\r\n this._markSubMeshesAsLightDirty();\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._resyncLightSource = function (light) {\r\n var isIn = light.isEnabled() && light.canAffectMesh(this);\r\n var index = this._lightSources.indexOf(light);\r\n var removed = false;\r\n if (index === -1) {\r\n if (!isIn) {\r\n return;\r\n }\r\n this._lightSources.push(light);\r\n }\r\n else {\r\n if (isIn) {\r\n return;\r\n }\r\n removed = true;\r\n this._lightSources.splice(index, 1);\r\n }\r\n this._markSubMeshesAsLightDirty(removed);\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._unBindEffect = function () {\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n subMesh.setEffect(null);\r\n }\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._removeLightSource = function (light, dispose) {\r\n var index = this._lightSources.indexOf(light);\r\n if (index === -1) {\r\n return;\r\n }\r\n this._lightSources.splice(index, 1);\r\n this._markSubMeshesAsLightDirty(dispose);\r\n };\r\n AbstractMesh.prototype._markSubMeshesAsDirty = function (func) {\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var subMesh = _a[_i];\r\n if (subMesh._materialDefines) {\r\n func(subMesh._materialDefines);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._markSubMeshesAsLightDirty = function (dispose) {\r\n if (dispose === void 0) { dispose = false; }\r\n this._markSubMeshesAsDirty(function (defines) { return defines.markAsLightDirty(dispose); });\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._markSubMeshesAsAttributesDirty = function () {\r\n this._markSubMeshesAsDirty(function (defines) { return defines.markAsAttributesDirty(); });\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._markSubMeshesAsMiscDirty = function () {\r\n this._markSubMeshesAsDirty(function (defines) { return defines.markAsMiscDirty(); });\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"scaling\", {\r\n /**\r\n * Gets or sets a Vector3 depicting the mesh scaling along each local axis X, Y, Z. Default is (1.0, 1.0, 1.0)\r\n */\r\n get: function () {\r\n return this._scaling;\r\n },\r\n set: function (newScaling) {\r\n this._scaling = newScaling;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"isBlocked\", {\r\n // Methods\r\n /**\r\n * Returns true if the mesh is blocked. Implemented by child classes\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the mesh itself by default. Implemented by child classes\r\n * @param camera defines the camera to use to pick the right LOD level\r\n * @returns the currentAbstractMesh\r\n */\r\n AbstractMesh.prototype.getLOD = function (camera) {\r\n return this;\r\n };\r\n /**\r\n * Returns 0 by default. Implemented by child classes\r\n * @returns an integer\r\n */\r\n AbstractMesh.prototype.getTotalVertices = function () {\r\n return 0;\r\n };\r\n /**\r\n * Returns a positive integer : the total number of indices in this mesh geometry.\r\n * @returns the numner of indices or zero if the mesh has no geometry.\r\n */\r\n AbstractMesh.prototype.getTotalIndices = function () {\r\n return 0;\r\n };\r\n /**\r\n * Returns null by default. Implemented by child classes\r\n * @returns null\r\n */\r\n AbstractMesh.prototype.getIndices = function () {\r\n return null;\r\n };\r\n /**\r\n * Returns the array of the requested vertex data kind. Implemented by child classes\r\n * @param kind defines the vertex data kind to use\r\n * @returns null\r\n */\r\n AbstractMesh.prototype.getVerticesData = function (kind) {\r\n return null;\r\n };\r\n /**\r\n * Sets the vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.\r\n * Note that a new underlying VertexBuffer object is created each call.\r\n * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\r\n * @param kind defines vertex data kind:\r\n * * VertexBuffer.PositionKind\r\n * * VertexBuffer.UVKind\r\n * * VertexBuffer.UV2Kind\r\n * * VertexBuffer.UV3Kind\r\n * * VertexBuffer.UV4Kind\r\n * * VertexBuffer.UV5Kind\r\n * * VertexBuffer.UV6Kind\r\n * * VertexBuffer.ColorKind\r\n * * VertexBuffer.MatricesIndicesKind\r\n * * VertexBuffer.MatricesIndicesExtraKind\r\n * * VertexBuffer.MatricesWeightsKind\r\n * * VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updatable defines if the data must be flagged as updatable (or static)\r\n * @param stride defines the vertex stride (size of an entire vertex). Can be null and in this case will be deduced from vertex data kind\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n return this;\r\n };\r\n /**\r\n * Updates the existing vertex data of the mesh geometry for the requested `kind`.\r\n * If the mesh has no geometry, it is simply returned as it is.\r\n * @param kind defines vertex data kind:\r\n * * VertexBuffer.PositionKind\r\n * * VertexBuffer.UVKind\r\n * * VertexBuffer.UV2Kind\r\n * * VertexBuffer.UV3Kind\r\n * * VertexBuffer.UV4Kind\r\n * * VertexBuffer.UV5Kind\r\n * * VertexBuffer.UV6Kind\r\n * * VertexBuffer.ColorKind\r\n * * VertexBuffer.MatricesIndicesKind\r\n * * VertexBuffer.MatricesIndicesExtraKind\r\n * * VertexBuffer.MatricesWeightsKind\r\n * * VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updateExtends If `kind` is `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed\r\n * @param makeItUnique If true, a new global geometry is created from this data and is set to the mesh\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {\r\n return this;\r\n };\r\n /**\r\n * Sets the mesh indices,\r\n * If the mesh has no geometry, a new Geometry object is created and set to the mesh.\r\n * @param indices Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array)\r\n * @param totalVertices Defines the total number of vertices\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.setIndices = function (indices, totalVertices) {\r\n return this;\r\n };\r\n /**\r\n * Gets a boolean indicating if specific vertex data is present\r\n * @param kind defines the vertex data kind to use\r\n * @returns true is data kind is present\r\n */\r\n AbstractMesh.prototype.isVerticesDataPresent = function (kind) {\r\n return false;\r\n };\r\n /**\r\n * Returns the mesh BoundingInfo object or creates a new one and returns if it was undefined.\r\n * Note that it returns a shallow bounding of the mesh (i.e. it does not include children).\r\n * To get the full bounding of all children, call `getHierarchyBoundingVectors` instead.\r\n * @returns a BoundingInfo\r\n */\r\n AbstractMesh.prototype.getBoundingInfo = function () {\r\n if (this._masterMesh) {\r\n return this._masterMesh.getBoundingInfo();\r\n }\r\n if (!this._boundingInfo) {\r\n // this._boundingInfo is being created here\r\n this._updateBoundingInfo();\r\n }\r\n // cannot be null.\r\n return this._boundingInfo;\r\n };\r\n /**\r\n * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)\r\n * @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false\r\n * @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false\r\n * @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.normalizeToUnitCube = function (includeDescendants, ignoreRotation, predicate) {\r\n if (includeDescendants === void 0) { includeDescendants = true; }\r\n if (ignoreRotation === void 0) { ignoreRotation = false; }\r\n return _super.prototype.normalizeToUnitCube.call(this, includeDescendants, ignoreRotation, predicate);\r\n };\r\n /**\r\n * Overwrite the current bounding info\r\n * @param boundingInfo defines the new bounding info\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.setBoundingInfo = function (boundingInfo) {\r\n this._boundingInfo = boundingInfo;\r\n return this;\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"useBones\", {\r\n /** Gets a boolean indicating if this mesh has skinning data and an attached skeleton */\r\n get: function () {\r\n return (this.skeleton && this.getScene().skeletonsEnabled && this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind) && this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind));\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n AbstractMesh.prototype._preActivate = function () {\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._preActivateForIntermediateRendering = function (renderId) {\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._activate = function (renderId, intermediateRendering) {\r\n this._renderId = renderId;\r\n return true;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._postActivate = function () {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._freeze = function () {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._unFreeze = function () {\r\n // Do nothing\r\n };\r\n /**\r\n * Gets the current world matrix\r\n * @returns a Matrix\r\n */\r\n AbstractMesh.prototype.getWorldMatrix = function () {\r\n if (this._masterMesh && this.billboardMode === TransformNode.BILLBOARDMODE_NONE) {\r\n return this._masterMesh.getWorldMatrix();\r\n }\r\n return _super.prototype.getWorldMatrix.call(this);\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._getWorldMatrixDeterminant = function () {\r\n if (this._masterMesh) {\r\n return this._masterMesh._getWorldMatrixDeterminant();\r\n }\r\n return _super.prototype._getWorldMatrixDeterminant.call(this);\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"isAnInstance\", {\r\n /**\r\n * Gets a boolean indicating if this mesh is an instance or a regular mesh\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"hasInstances\", {\r\n /**\r\n * Gets a boolean indicating if this mesh has instances\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"hasThinInstances\", {\r\n /**\r\n * Gets a boolean indicating if this mesh has thin instances\r\n */\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // ================================== Point of View Movement =================================\r\n /**\r\n * Perform relative position change from the point of view of behind the front of the mesh.\r\n * This is performed taking into account the meshes current rotation, so you do not have to care.\r\n * Supports definition of mesh facing forward or backward\r\n * @param amountRight defines the distance on the right axis\r\n * @param amountUp defines the distance on the up axis\r\n * @param amountForward defines the distance on the forward axis\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.movePOV = function (amountRight, amountUp, amountForward) {\r\n this.position.addInPlace(this.calcMovePOV(amountRight, amountUp, amountForward));\r\n return this;\r\n };\r\n /**\r\n * Calculate relative position change from the point of view of behind the front of the mesh.\r\n * This is performed taking into account the meshes current rotation, so you do not have to care.\r\n * Supports definition of mesh facing forward or backward\r\n * @param amountRight defines the distance on the right axis\r\n * @param amountUp defines the distance on the up axis\r\n * @param amountForward defines the distance on the forward axis\r\n * @returns the new displacement vector\r\n */\r\n AbstractMesh.prototype.calcMovePOV = function (amountRight, amountUp, amountForward) {\r\n var rotMatrix = new Matrix();\r\n var rotQuaternion = (this.rotationQuaternion) ? this.rotationQuaternion : Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);\r\n rotQuaternion.toRotationMatrix(rotMatrix);\r\n var translationDelta = Vector3.Zero();\r\n var defForwardMult = this.definedFacingForward ? -1 : 1;\r\n Vector3.TransformCoordinatesFromFloatsToRef(amountRight * defForwardMult, amountUp, amountForward * defForwardMult, rotMatrix, translationDelta);\r\n return translationDelta;\r\n };\r\n // ================================== Point of View Rotation =================================\r\n /**\r\n * Perform relative rotation change from the point of view of behind the front of the mesh.\r\n * Supports definition of mesh facing forward or backward\r\n * @param flipBack defines the flip\r\n * @param twirlClockwise defines the twirl\r\n * @param tiltRight defines the tilt\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.rotatePOV = function (flipBack, twirlClockwise, tiltRight) {\r\n this.rotation.addInPlace(this.calcRotatePOV(flipBack, twirlClockwise, tiltRight));\r\n return this;\r\n };\r\n /**\r\n * Calculate relative rotation change from the point of view of behind the front of the mesh.\r\n * Supports definition of mesh facing forward or backward.\r\n * @param flipBack defines the flip\r\n * @param twirlClockwise defines the twirl\r\n * @param tiltRight defines the tilt\r\n * @returns the new rotation vector\r\n */\r\n AbstractMesh.prototype.calcRotatePOV = function (flipBack, twirlClockwise, tiltRight) {\r\n var defForwardMult = this.definedFacingForward ? 1 : -1;\r\n return new Vector3(flipBack * defForwardMult, twirlClockwise, tiltRight * defForwardMult);\r\n };\r\n /**\r\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\r\n * This means the mesh underlying bounding box and sphere are recomputed.\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.refreshBoundingInfo = function (applySkeleton) {\r\n if (applySkeleton === void 0) { applySkeleton = false; }\r\n if (this._boundingInfo && this._boundingInfo.isLocked) {\r\n return this;\r\n }\r\n this._refreshBoundingInfo(this._getPositionData(applySkeleton), null);\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._refreshBoundingInfo = function (data, bias) {\r\n if (data) {\r\n var extend = extractMinAndMax(data, 0, this.getTotalVertices(), bias);\r\n if (this._boundingInfo) {\r\n this._boundingInfo.reConstruct(extend.minimum, extend.maximum);\r\n }\r\n else {\r\n this._boundingInfo = new BoundingInfo(extend.minimum, extend.maximum);\r\n }\r\n }\r\n if (this.subMeshes) {\r\n for (var index = 0; index < this.subMeshes.length; index++) {\r\n this.subMeshes[index].refreshBoundingInfo(data);\r\n }\r\n }\r\n this._updateBoundingInfo();\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._getPositionData = function (applySkeleton) {\r\n var data = this.getVerticesData(VertexBuffer.PositionKind);\r\n if (data && applySkeleton && this.skeleton) {\r\n data = Tools.Slice(data);\r\n this._generatePointsArray();\r\n var matricesIndicesData = this.getVerticesData(VertexBuffer.MatricesIndicesKind);\r\n var matricesWeightsData = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\r\n if (matricesWeightsData && matricesIndicesData) {\r\n var needExtras = this.numBoneInfluencers > 4;\r\n var matricesIndicesExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\r\n var matricesWeightsExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\r\n this.skeleton.prepare();\r\n var skeletonMatrices = this.skeleton.getTransformMatrices(this);\r\n var tempVector = TmpVectors.Vector3[0];\r\n var finalMatrix = TmpVectors.Matrix[0];\r\n var tempMatrix = TmpVectors.Matrix[1];\r\n var matWeightIdx = 0;\r\n for (var index = 0; index < data.length; index += 3, matWeightIdx += 4) {\r\n finalMatrix.reset();\r\n var inf;\r\n var weight;\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n if (needExtras) {\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsExtraData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesExtraData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n }\r\n Vector3.TransformCoordinatesFromFloatsToRef(data[index], data[index + 1], data[index + 2], finalMatrix, tempVector);\r\n tempVector.toArray(data, index);\r\n if (this._positions) {\r\n this._positions[index / 3].copyFrom(tempVector);\r\n }\r\n }\r\n }\r\n }\r\n return data;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._updateBoundingInfo = function () {\r\n var effectiveMesh = this._effectiveMesh;\r\n if (this._boundingInfo) {\r\n this._boundingInfo.update(effectiveMesh.worldMatrixFromCache);\r\n }\r\n else {\r\n this._boundingInfo = new BoundingInfo(this.absolutePosition, this.absolutePosition, effectiveMesh.worldMatrixFromCache);\r\n }\r\n this._updateSubMeshesBoundingInfo(effectiveMesh.worldMatrixFromCache);\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._updateSubMeshesBoundingInfo = function (matrix) {\r\n if (!this.subMeshes) {\r\n return this;\r\n }\r\n var count = this.subMeshes.length;\r\n for (var subIndex = 0; subIndex < count; subIndex++) {\r\n var subMesh = this.subMeshes[subIndex];\r\n if (count > 1 || !subMesh.IsGlobal) {\r\n subMesh.updateBoundingInfo(matrix);\r\n }\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._afterComputeWorldMatrix = function () {\r\n if (this.doNotSyncBoundingInfo) {\r\n return;\r\n }\r\n // Bounding info\r\n this._updateBoundingInfo();\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"_effectiveMesh\", {\r\n /** @hidden */\r\n get: function () {\r\n return (this.skeleton && this.skeleton.overrideMesh) || this;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns `true` if the mesh is within the frustum defined by the passed array of planes.\r\n * A mesh is in the frustum if its bounding box intersects the frustum\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the mesh is in the frustum planes\r\n */\r\n AbstractMesh.prototype.isInFrustum = function (frustumPlanes) {\r\n return this._boundingInfo !== null && this._boundingInfo.isInFrustum(frustumPlanes, this.cullingStrategy);\r\n };\r\n /**\r\n * Returns `true` if the mesh is completely in the frustum defined be the passed array of planes.\r\n * A mesh is completely in the frustum if its bounding box it completely inside the frustum.\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the mesh is completely in the frustum planes\r\n */\r\n AbstractMesh.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n return this._boundingInfo !== null && this._boundingInfo.isCompletelyInFrustum(frustumPlanes);\r\n };\r\n /**\r\n * True if the mesh intersects another mesh or a SolidParticle object\r\n * @param mesh defines a target mesh or SolidParticle to test\r\n * @param precise Unless the parameter `precise` is set to `true` the intersection is computed according to Axis Aligned Bounding Boxes (AABB), else according to OBB (Oriented BBoxes)\r\n * @param includeDescendants Can be set to true to test if the mesh defined in parameters intersects with the current mesh or any child meshes\r\n * @returns true if there is an intersection\r\n */\r\n AbstractMesh.prototype.intersectsMesh = function (mesh, precise, includeDescendants) {\r\n if (precise === void 0) { precise = false; }\r\n if (!this._boundingInfo || !mesh._boundingInfo) {\r\n return false;\r\n }\r\n if (this._boundingInfo.intersects(mesh._boundingInfo, precise)) {\r\n return true;\r\n }\r\n if (includeDescendants) {\r\n for (var _i = 0, _a = this.getChildMeshes(); _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (child.intersectsMesh(mesh, precise, true)) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns true if the passed point (Vector3) is inside the mesh bounding box\r\n * @param point defines the point to test\r\n * @returns true if there is an intersection\r\n */\r\n AbstractMesh.prototype.intersectsPoint = function (point) {\r\n if (!this._boundingInfo) {\r\n return false;\r\n }\r\n return this._boundingInfo.intersectsPoint(point);\r\n };\r\n Object.defineProperty(AbstractMesh.prototype, \"checkCollisions\", {\r\n // Collisions\r\n /**\r\n * Gets or sets a boolean indicating that this mesh can be used in the collision engine\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n get: function () {\r\n return this._meshCollisionData._checkCollisions;\r\n },\r\n set: function (collisionEnabled) {\r\n this._meshCollisionData._checkCollisions = collisionEnabled;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AbstractMesh.prototype, \"collider\", {\r\n /**\r\n * Gets Collider object used to compute collisions (not physics)\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n get: function () {\r\n return this._meshCollisionData._collider;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Move the mesh using collision engine\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n * @param displacement defines the requested displacement vector\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.moveWithCollisions = function (displacement) {\r\n var globalPosition = this.getAbsolutePosition();\r\n globalPosition.addToRef(this.ellipsoidOffset, this._meshCollisionData._oldPositionForCollisions);\r\n var coordinator = this.getScene().collisionCoordinator;\r\n if (!this._meshCollisionData._collider) {\r\n this._meshCollisionData._collider = coordinator.createCollider();\r\n }\r\n this._meshCollisionData._collider._radius = this.ellipsoid;\r\n coordinator.getNewPosition(this._meshCollisionData._oldPositionForCollisions, displacement, this._meshCollisionData._collider, 3, this, this._onCollisionPositionChange, this.uniqueId);\r\n return this;\r\n };\r\n // Collisions\r\n /** @hidden */\r\n AbstractMesh.prototype._collideForSubMesh = function (subMesh, transformMatrix, collider) {\r\n this._generatePointsArray();\r\n if (!this._positions) {\r\n return this;\r\n }\r\n // Transformation\r\n if (!subMesh._lastColliderWorldVertices || !subMesh._lastColliderTransformMatrix.equals(transformMatrix)) {\r\n subMesh._lastColliderTransformMatrix = transformMatrix.clone();\r\n subMesh._lastColliderWorldVertices = [];\r\n subMesh._trianglePlanes = [];\r\n var start = subMesh.verticesStart;\r\n var end = (subMesh.verticesStart + subMesh.verticesCount);\r\n for (var i = start; i < end; i++) {\r\n subMesh._lastColliderWorldVertices.push(Vector3.TransformCoordinates(this._positions[i], transformMatrix));\r\n }\r\n }\r\n // Collide\r\n collider._collide(subMesh._trianglePlanes, subMesh._lastColliderWorldVertices, this.getIndices(), subMesh.indexStart, subMesh.indexStart + subMesh.indexCount, subMesh.verticesStart, !!subMesh.getMaterial(), this);\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._processCollisionsForSubMeshes = function (collider, transformMatrix) {\r\n var subMeshes = this._scene.getCollidingSubMeshCandidates(this, collider);\r\n var len = subMeshes.length;\r\n for (var index = 0; index < len; index++) {\r\n var subMesh = subMeshes.data[index];\r\n // Bounding test\r\n if (len > 1 && !subMesh._checkCollision(collider)) {\r\n continue;\r\n }\r\n this._collideForSubMesh(subMesh, transformMatrix, collider);\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._checkCollision = function (collider) {\r\n // Bounding box test\r\n if (!this._boundingInfo || !this._boundingInfo._checkCollision(collider)) {\r\n return this;\r\n }\r\n // Transformation matrix\r\n var collisionsScalingMatrix = TmpVectors.Matrix[0];\r\n var collisionsTransformMatrix = TmpVectors.Matrix[1];\r\n Matrix.ScalingToRef(1.0 / collider._radius.x, 1.0 / collider._radius.y, 1.0 / collider._radius.z, collisionsScalingMatrix);\r\n this.worldMatrixFromCache.multiplyToRef(collisionsScalingMatrix, collisionsTransformMatrix);\r\n this._processCollisionsForSubMeshes(collider, collisionsTransformMatrix);\r\n return this;\r\n };\r\n // Picking\r\n /** @hidden */\r\n AbstractMesh.prototype._generatePointsArray = function () {\r\n return false;\r\n };\r\n /**\r\n * Checks if the passed Ray intersects with the mesh\r\n * @param ray defines the ray to use\r\n * @param fastCheck defines if fast mode (but less precise) must be used (false by default)\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)\r\n * @param worldToUse defines the world matrix to use to get the world coordinate of the intersection point\r\n * @param skipBoundingInfo a boolean indicating if we should skip the bounding info check\r\n * @returns the picking info\r\n * @see https://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh\r\n */\r\n AbstractMesh.prototype.intersects = function (ray, fastCheck, trianglePredicate, onlyBoundingInfo, worldToUse, skipBoundingInfo) {\r\n var _a;\r\n if (onlyBoundingInfo === void 0) { onlyBoundingInfo = false; }\r\n if (skipBoundingInfo === void 0) { skipBoundingInfo = false; }\r\n var pickingInfo = new PickingInfo();\r\n var intersectionThreshold = this.getClassName() === \"InstancedLinesMesh\" || this.getClassName() === \"LinesMesh\" ? this.intersectionThreshold : 0;\r\n var boundingInfo = this._boundingInfo;\r\n if (!this.subMeshes || !boundingInfo) {\r\n return pickingInfo;\r\n }\r\n if (!skipBoundingInfo && (!ray.intersectsSphere(boundingInfo.boundingSphere, intersectionThreshold) || !ray.intersectsBox(boundingInfo.boundingBox, intersectionThreshold))) {\r\n return pickingInfo;\r\n }\r\n if (onlyBoundingInfo) {\r\n pickingInfo.hit = skipBoundingInfo ? false : true;\r\n pickingInfo.pickedMesh = skipBoundingInfo ? null : this;\r\n pickingInfo.distance = skipBoundingInfo ? 0 : Vector3.Distance(ray.origin, boundingInfo.boundingSphere.center);\r\n pickingInfo.subMeshId = 0;\r\n return pickingInfo;\r\n }\r\n if (!this._generatePointsArray()) {\r\n return pickingInfo;\r\n }\r\n var intersectInfo = null;\r\n var subMeshes = this._scene.getIntersectingSubMeshCandidates(this, ray);\r\n var len = subMeshes.length;\r\n // Check if all submeshes are using a material that don't allow picking (point/lines rendering)\r\n // if no submesh can be picked that way, then fallback to BBox picking\r\n var anySubmeshSupportIntersect = false;\r\n for (var index = 0; index < len; index++) {\r\n var subMesh = subMeshes.data[index];\r\n var material = subMesh.getMaterial();\r\n if (!material) {\r\n continue;\r\n }\r\n if (((_a = this.getIndices()) === null || _a === void 0 ? void 0 : _a.length) && (material.fillMode == 7 ||\r\n material.fillMode == 0 ||\r\n material.fillMode == 1 ||\r\n material.fillMode == 2)) {\r\n anySubmeshSupportIntersect = true;\r\n break;\r\n }\r\n }\r\n // no sub mesh support intersection, fallback to BBox that has already be done\r\n if (!anySubmeshSupportIntersect) {\r\n pickingInfo.hit = true;\r\n pickingInfo.pickedMesh = this;\r\n pickingInfo.distance = Vector3.Distance(ray.origin, boundingInfo.boundingSphere.center);\r\n pickingInfo.subMeshId = -1;\r\n return pickingInfo;\r\n }\r\n // at least 1 submesh supports intersection, keep going\r\n for (var index = 0; index < len; index++) {\r\n var subMesh = subMeshes.data[index];\r\n // Bounding test\r\n if (len > 1 && !subMesh.canIntersects(ray)) {\r\n continue;\r\n }\r\n var currentIntersectInfo = subMesh.intersects(ray, this._positions, this.getIndices(), fastCheck, trianglePredicate);\r\n if (currentIntersectInfo) {\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.subMeshId = index;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n if (intersectInfo) {\r\n // Get picked point\r\n var world = worldToUse !== null && worldToUse !== void 0 ? worldToUse : (this.skeleton && this.skeleton.overrideMesh ? this.skeleton.overrideMesh.getWorldMatrix() : this.getWorldMatrix());\r\n var worldOrigin = TmpVectors.Vector3[0];\r\n var direction = TmpVectors.Vector3[1];\r\n Vector3.TransformCoordinatesToRef(ray.origin, world, worldOrigin);\r\n ray.direction.scaleToRef(intersectInfo.distance, direction);\r\n var worldDirection = Vector3.TransformNormal(direction, world);\r\n var pickedPoint = worldDirection.addInPlace(worldOrigin);\r\n // Return result\r\n pickingInfo.hit = true;\r\n pickingInfo.distance = Vector3.Distance(worldOrigin, pickedPoint);\r\n pickingInfo.pickedPoint = pickedPoint;\r\n pickingInfo.pickedMesh = this;\r\n pickingInfo.bu = intersectInfo.bu || 0;\r\n pickingInfo.bv = intersectInfo.bv || 0;\r\n pickingInfo.subMeshFaceId = intersectInfo.faceId;\r\n pickingInfo.faceId = intersectInfo.faceId + subMeshes.data[intersectInfo.subMeshId].indexStart / (this.getClassName().indexOf(\"LinesMesh\") !== -1 ? 2 : 3);\r\n pickingInfo.subMeshId = intersectInfo.subMeshId;\r\n return pickingInfo;\r\n }\r\n return pickingInfo;\r\n };\r\n /**\r\n * Clones the current mesh\r\n * @param name defines the mesh name\r\n * @param newParent defines the new mesh parent\r\n * @param doNotCloneChildren defines a boolean indicating that children must not be cloned (false by default)\r\n * @returns the new mesh\r\n */\r\n AbstractMesh.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n return null;\r\n };\r\n /**\r\n * Disposes all the submeshes of the current meshnp\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.releaseSubMeshes = function () {\r\n if (this.subMeshes) {\r\n while (this.subMeshes.length) {\r\n this.subMeshes[0].dispose();\r\n }\r\n }\r\n else {\r\n this.subMeshes = new Array();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Releases resources associated with this abstract mesh.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n AbstractMesh.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n var _this = this;\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n var index;\r\n // mesh map release.\r\n if (this._scene.useMaterialMeshMap) {\r\n // remove from material mesh map id needed\r\n if (this._material && this._material.meshMap) {\r\n this._material.meshMap[this.uniqueId] = undefined;\r\n }\r\n }\r\n // Smart Array Retainers.\r\n this.getScene().freeActiveMeshes();\r\n this.getScene().freeRenderingGroups();\r\n // Action manager\r\n if (this.actionManager !== undefined && this.actionManager !== null) {\r\n this.actionManager.dispose();\r\n this.actionManager = null;\r\n }\r\n // Skeleton\r\n this._internalAbstractMeshDataInfo._skeleton = null;\r\n if (this._transformMatrixTexture) {\r\n this._transformMatrixTexture.dispose();\r\n this._transformMatrixTexture = null;\r\n }\r\n // Intersections in progress\r\n for (index = 0; index < this._intersectionsInProgress.length; index++) {\r\n var other = this._intersectionsInProgress[index];\r\n var pos = other._intersectionsInProgress.indexOf(this);\r\n other._intersectionsInProgress.splice(pos, 1);\r\n }\r\n this._intersectionsInProgress = [];\r\n // Lights\r\n var lights = this.getScene().lights;\r\n lights.forEach(function (light) {\r\n var meshIndex = light.includedOnlyMeshes.indexOf(_this);\r\n if (meshIndex !== -1) {\r\n light.includedOnlyMeshes.splice(meshIndex, 1);\r\n }\r\n meshIndex = light.excludedMeshes.indexOf(_this);\r\n if (meshIndex !== -1) {\r\n light.excludedMeshes.splice(meshIndex, 1);\r\n }\r\n // Shadow generators\r\n var generator = light.getShadowGenerator();\r\n if (generator) {\r\n var shadowMap = generator.getShadowMap();\r\n if (shadowMap && shadowMap.renderList) {\r\n meshIndex = shadowMap.renderList.indexOf(_this);\r\n if (meshIndex !== -1) {\r\n shadowMap.renderList.splice(meshIndex, 1);\r\n }\r\n }\r\n }\r\n });\r\n // SubMeshes\r\n if (this.getClassName() !== \"InstancedMesh\" || this.getClassName() !== \"InstancedLinesMesh\") {\r\n this.releaseSubMeshes();\r\n }\r\n // Query\r\n var engine = this.getScene().getEngine();\r\n if (this._occlusionQuery) {\r\n this.isOcclusionQueryInProgress = false;\r\n engine.deleteQuery(this._occlusionQuery);\r\n this._occlusionQuery = null;\r\n }\r\n // Engine\r\n engine.wipeCaches();\r\n // Remove from scene\r\n this.getScene().removeMesh(this);\r\n if (disposeMaterialAndTextures) {\r\n if (this.material) {\r\n if (this.material.getClassName() === \"MultiMaterial\") {\r\n this.material.dispose(false, true, true);\r\n }\r\n else {\r\n this.material.dispose(false, true);\r\n }\r\n }\r\n }\r\n if (!doNotRecurse) {\r\n // Particles\r\n for (index = 0; index < this.getScene().particleSystems.length; index++) {\r\n if (this.getScene().particleSystems[index].emitter === this) {\r\n this.getScene().particleSystems[index].dispose();\r\n index--;\r\n }\r\n }\r\n }\r\n // facet data\r\n if (this._internalAbstractMeshDataInfo._facetData.facetDataEnabled) {\r\n this.disableFacetData();\r\n }\r\n this.onAfterWorldMatrixUpdateObservable.clear();\r\n this.onCollideObservable.clear();\r\n this.onCollisionPositionChangeObservable.clear();\r\n this.onRebuildObservable.clear();\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Adds the passed mesh as a child to the current mesh\r\n * @param mesh defines the child mesh\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.addChild = function (mesh) {\r\n mesh.setParent(this);\r\n return this;\r\n };\r\n /**\r\n * Removes the passed mesh from the current mesh children list\r\n * @param mesh defines the child mesh\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.removeChild = function (mesh) {\r\n mesh.setParent(null);\r\n return this;\r\n };\r\n // Facet data\r\n /** @hidden */\r\n AbstractMesh.prototype._initFacetData = function () {\r\n var data = this._internalAbstractMeshDataInfo._facetData;\r\n if (!data.facetNormals) {\r\n data.facetNormals = new Array();\r\n }\r\n if (!data.facetPositions) {\r\n data.facetPositions = new Array();\r\n }\r\n if (!data.facetPartitioning) {\r\n data.facetPartitioning = new Array();\r\n }\r\n data.facetNb = (this.getIndices().length / 3) | 0;\r\n data.partitioningSubdivisions = (data.partitioningSubdivisions) ? data.partitioningSubdivisions : 10; // default nb of partitioning subdivisions = 10\r\n data.partitioningBBoxRatio = (data.partitioningBBoxRatio) ? data.partitioningBBoxRatio : 1.01; // default ratio 1.01 = the partitioning is 1% bigger than the bounding box\r\n for (var f = 0; f < data.facetNb; f++) {\r\n data.facetNormals[f] = Vector3.Zero();\r\n data.facetPositions[f] = Vector3.Zero();\r\n }\r\n data.facetDataEnabled = true;\r\n return this;\r\n };\r\n /**\r\n * Updates the mesh facetData arrays and the internal partitioning when the mesh is morphed or updated.\r\n * This method can be called within the render loop.\r\n * You don't need to call this method by yourself in the render loop when you update/morph a mesh with the methods CreateXXX() as they automatically manage this computation\r\n * @returns the current mesh\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.updateFacetData = function () {\r\n var data = this._internalAbstractMeshDataInfo._facetData;\r\n if (!data.facetDataEnabled) {\r\n this._initFacetData();\r\n }\r\n var positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n var indices = this.getIndices();\r\n var normals = this.getVerticesData(VertexBuffer.NormalKind);\r\n var bInfo = this.getBoundingInfo();\r\n if (data.facetDepthSort && !data.facetDepthSortEnabled) {\r\n // init arrays, matrix and sort function on first call\r\n data.facetDepthSortEnabled = true;\r\n if (indices instanceof Uint16Array) {\r\n data.depthSortedIndices = new Uint16Array(indices);\r\n }\r\n else if (indices instanceof Uint32Array) {\r\n data.depthSortedIndices = new Uint32Array(indices);\r\n }\r\n else {\r\n var needs32bits = false;\r\n for (var i = 0; i < indices.length; i++) {\r\n if (indices[i] > 65535) {\r\n needs32bits = true;\r\n break;\r\n }\r\n }\r\n if (needs32bits) {\r\n data.depthSortedIndices = new Uint32Array(indices);\r\n }\r\n else {\r\n data.depthSortedIndices = new Uint16Array(indices);\r\n }\r\n }\r\n data.facetDepthSortFunction = function (f1, f2) {\r\n return (f2.sqDistance - f1.sqDistance);\r\n };\r\n if (!data.facetDepthSortFrom) {\r\n var camera = this.getScene().activeCamera;\r\n data.facetDepthSortFrom = (camera) ? camera.position : Vector3.Zero();\r\n }\r\n data.depthSortedFacets = [];\r\n for (var f = 0; f < data.facetNb; f++) {\r\n var depthSortedFacet = { ind: f * 3, sqDistance: 0.0 };\r\n data.depthSortedFacets.push(depthSortedFacet);\r\n }\r\n data.invertedMatrix = Matrix.Identity();\r\n data.facetDepthSortOrigin = Vector3.Zero();\r\n }\r\n data.bbSize.x = (bInfo.maximum.x - bInfo.minimum.x > Epsilon) ? bInfo.maximum.x - bInfo.minimum.x : Epsilon;\r\n data.bbSize.y = (bInfo.maximum.y - bInfo.minimum.y > Epsilon) ? bInfo.maximum.y - bInfo.minimum.y : Epsilon;\r\n data.bbSize.z = (bInfo.maximum.z - bInfo.minimum.z > Epsilon) ? bInfo.maximum.z - bInfo.minimum.z : Epsilon;\r\n var bbSizeMax = (data.bbSize.x > data.bbSize.y) ? data.bbSize.x : data.bbSize.y;\r\n bbSizeMax = (bbSizeMax > data.bbSize.z) ? bbSizeMax : data.bbSize.z;\r\n data.subDiv.max = data.partitioningSubdivisions;\r\n data.subDiv.X = Math.floor(data.subDiv.max * data.bbSize.x / bbSizeMax); // adjust the number of subdivisions per axis\r\n data.subDiv.Y = Math.floor(data.subDiv.max * data.bbSize.y / bbSizeMax); // according to each bbox size per axis\r\n data.subDiv.Z = Math.floor(data.subDiv.max * data.bbSize.z / bbSizeMax);\r\n data.subDiv.X = data.subDiv.X < 1 ? 1 : data.subDiv.X; // at least one subdivision\r\n data.subDiv.Y = data.subDiv.Y < 1 ? 1 : data.subDiv.Y;\r\n data.subDiv.Z = data.subDiv.Z < 1 ? 1 : data.subDiv.Z;\r\n // set the parameters for ComputeNormals()\r\n data.facetParameters.facetNormals = this.getFacetLocalNormals();\r\n data.facetParameters.facetPositions = this.getFacetLocalPositions();\r\n data.facetParameters.facetPartitioning = this.getFacetLocalPartitioning();\r\n data.facetParameters.bInfo = bInfo;\r\n data.facetParameters.bbSize = data.bbSize;\r\n data.facetParameters.subDiv = data.subDiv;\r\n data.facetParameters.ratio = this.partitioningBBoxRatio;\r\n data.facetParameters.depthSort = data.facetDepthSort;\r\n if (data.facetDepthSort && data.facetDepthSortEnabled) {\r\n this.computeWorldMatrix(true);\r\n this._worldMatrix.invertToRef(data.invertedMatrix);\r\n Vector3.TransformCoordinatesToRef(data.facetDepthSortFrom, data.invertedMatrix, data.facetDepthSortOrigin);\r\n data.facetParameters.distanceTo = data.facetDepthSortOrigin;\r\n }\r\n data.facetParameters.depthSortedFacets = data.depthSortedFacets;\r\n VertexData.ComputeNormals(positions, indices, normals, data.facetParameters);\r\n if (data.facetDepthSort && data.facetDepthSortEnabled) {\r\n data.depthSortedFacets.sort(data.facetDepthSortFunction);\r\n var l = (data.depthSortedIndices.length / 3) | 0;\r\n for (var f = 0; f < l; f++) {\r\n var sind = data.depthSortedFacets[f].ind;\r\n data.depthSortedIndices[f * 3] = indices[sind];\r\n data.depthSortedIndices[f * 3 + 1] = indices[sind + 1];\r\n data.depthSortedIndices[f * 3 + 2] = indices[sind + 2];\r\n }\r\n this.updateIndices(data.depthSortedIndices, undefined, true);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns the facetLocalNormals array.\r\n * The normals are expressed in the mesh local spac\r\n * @returns an array of Vector3\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetLocalNormals = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (!facetData.facetNormals) {\r\n this.updateFacetData();\r\n }\r\n return facetData.facetNormals;\r\n };\r\n /**\r\n * Returns the facetLocalPositions array.\r\n * The facet positions are expressed in the mesh local space\r\n * @returns an array of Vector3\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetLocalPositions = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (!facetData.facetPositions) {\r\n this.updateFacetData();\r\n }\r\n return facetData.facetPositions;\r\n };\r\n /**\r\n * Returns the facetLocalPartioning array\r\n * @returns an array of array of numbers\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetLocalPartitioning = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (!facetData.facetPartitioning) {\r\n this.updateFacetData();\r\n }\r\n return facetData.facetPartitioning;\r\n };\r\n /**\r\n * Returns the i-th facet position in the world system.\r\n * This method allocates a new Vector3 per call\r\n * @param i defines the facet index\r\n * @returns a new Vector3\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetPosition = function (i) {\r\n var pos = Vector3.Zero();\r\n this.getFacetPositionToRef(i, pos);\r\n return pos;\r\n };\r\n /**\r\n * Sets the reference Vector3 with the i-th facet position in the world system\r\n * @param i defines the facet index\r\n * @param ref defines the target vector\r\n * @returns the current mesh\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetPositionToRef = function (i, ref) {\r\n var localPos = (this.getFacetLocalPositions())[i];\r\n var world = this.getWorldMatrix();\r\n Vector3.TransformCoordinatesToRef(localPos, world, ref);\r\n return this;\r\n };\r\n /**\r\n * Returns the i-th facet normal in the world system.\r\n * This method allocates a new Vector3 per call\r\n * @param i defines the facet index\r\n * @returns a new Vector3\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetNormal = function (i) {\r\n var norm = Vector3.Zero();\r\n this.getFacetNormalToRef(i, norm);\r\n return norm;\r\n };\r\n /**\r\n * Sets the reference Vector3 with the i-th facet normal in the world system\r\n * @param i defines the facet index\r\n * @param ref defines the target vector\r\n * @returns the current mesh\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetNormalToRef = function (i, ref) {\r\n var localNorm = (this.getFacetLocalNormals())[i];\r\n Vector3.TransformNormalToRef(localNorm, this.getWorldMatrix(), ref);\r\n return this;\r\n };\r\n /**\r\n * Returns the facets (in an array) in the same partitioning block than the one the passed coordinates are located (expressed in the mesh local system)\r\n * @param x defines x coordinate\r\n * @param y defines y coordinate\r\n * @param z defines z coordinate\r\n * @returns the array of facet indexes\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetsAtLocalCoordinates = function (x, y, z) {\r\n var bInfo = this.getBoundingInfo();\r\n var data = this._internalAbstractMeshDataInfo._facetData;\r\n var ox = Math.floor((x - bInfo.minimum.x * data.partitioningBBoxRatio) * data.subDiv.X * data.partitioningBBoxRatio / data.bbSize.x);\r\n var oy = Math.floor((y - bInfo.minimum.y * data.partitioningBBoxRatio) * data.subDiv.Y * data.partitioningBBoxRatio / data.bbSize.y);\r\n var oz = Math.floor((z - bInfo.minimum.z * data.partitioningBBoxRatio) * data.subDiv.Z * data.partitioningBBoxRatio / data.bbSize.z);\r\n if (ox < 0 || ox > data.subDiv.max || oy < 0 || oy > data.subDiv.max || oz < 0 || oz > data.subDiv.max) {\r\n return null;\r\n }\r\n return data.facetPartitioning[ox + data.subDiv.max * oy + data.subDiv.max * data.subDiv.max * oz];\r\n };\r\n /**\r\n * Returns the closest mesh facet index at (x,y,z) World coordinates, null if not found\r\n * @param projected sets as the (x,y,z) world projection on the facet\r\n * @param checkFace if true (default false), only the facet \"facing\" to (x,y,z) or only the ones \"turning their backs\", according to the parameter \"facing\" are returned\r\n * @param facing if facing and checkFace are true, only the facet \"facing\" to (x, y, z) are returned : positive dot (x, y, z) * facet position. If facing si false and checkFace is true, only the facet \"turning their backs\" to (x, y, z) are returned : negative dot (x, y, z) * facet position\r\n * @param x defines x coordinate\r\n * @param y defines y coordinate\r\n * @param z defines z coordinate\r\n * @returns the face index if found (or null instead)\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getClosestFacetAtCoordinates = function (x, y, z, projected, checkFace, facing) {\r\n if (checkFace === void 0) { checkFace = false; }\r\n if (facing === void 0) { facing = true; }\r\n var world = this.getWorldMatrix();\r\n var invMat = TmpVectors.Matrix[5];\r\n world.invertToRef(invMat);\r\n var invVect = TmpVectors.Vector3[8];\r\n Vector3.TransformCoordinatesFromFloatsToRef(x, y, z, invMat, invVect); // transform (x,y,z) to coordinates in the mesh local space\r\n var closest = this.getClosestFacetAtLocalCoordinates(invVect.x, invVect.y, invVect.z, projected, checkFace, facing);\r\n if (projected) {\r\n // tranform the local computed projected vector to world coordinates\r\n Vector3.TransformCoordinatesFromFloatsToRef(projected.x, projected.y, projected.z, world, projected);\r\n }\r\n return closest;\r\n };\r\n /**\r\n * Returns the closest mesh facet index at (x,y,z) local coordinates, null if not found\r\n * @param projected sets as the (x,y,z) local projection on the facet\r\n * @param checkFace if true (default false), only the facet \"facing\" to (x,y,z) or only the ones \"turning their backs\", according to the parameter \"facing\" are returned\r\n * @param facing if facing and checkFace are true, only the facet \"facing\" to (x, y, z) are returned : positive dot (x, y, z) * facet position. If facing si false and checkFace is true, only the facet \"turning their backs\" to (x, y, z) are returned : negative dot (x, y, z) * facet position\r\n * @param x defines x coordinate\r\n * @param y defines y coordinate\r\n * @param z defines z coordinate\r\n * @returns the face index if found (or null instead)\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getClosestFacetAtLocalCoordinates = function (x, y, z, projected, checkFace, facing) {\r\n if (checkFace === void 0) { checkFace = false; }\r\n if (facing === void 0) { facing = true; }\r\n var closest = null;\r\n var tmpx = 0.0;\r\n var tmpy = 0.0;\r\n var tmpz = 0.0;\r\n var d = 0.0; // tmp dot facet normal * facet position\r\n var t0 = 0.0;\r\n var projx = 0.0;\r\n var projy = 0.0;\r\n var projz = 0.0;\r\n // Get all the facets in the same partitioning block than (x, y, z)\r\n var facetPositions = this.getFacetLocalPositions();\r\n var facetNormals = this.getFacetLocalNormals();\r\n var facetsInBlock = this.getFacetsAtLocalCoordinates(x, y, z);\r\n if (!facetsInBlock) {\r\n return null;\r\n }\r\n // Get the closest facet to (x, y, z)\r\n var shortest = Number.MAX_VALUE; // init distance vars\r\n var tmpDistance = shortest;\r\n var fib; // current facet in the block\r\n var norm; // current facet normal\r\n var p0; // current facet barycenter position\r\n // loop on all the facets in the current partitioning block\r\n for (var idx = 0; idx < facetsInBlock.length; idx++) {\r\n fib = facetsInBlock[idx];\r\n norm = facetNormals[fib];\r\n p0 = facetPositions[fib];\r\n d = (x - p0.x) * norm.x + (y - p0.y) * norm.y + (z - p0.z) * norm.z;\r\n if (!checkFace || (checkFace && facing && d >= 0.0) || (checkFace && !facing && d <= 0.0)) {\r\n // compute (x,y,z) projection on the facet = (projx, projy, projz)\r\n d = norm.x * p0.x + norm.y * p0.y + norm.z * p0.z;\r\n t0 = -(norm.x * x + norm.y * y + norm.z * z - d) / (norm.x * norm.x + norm.y * norm.y + norm.z * norm.z);\r\n projx = x + norm.x * t0;\r\n projy = y + norm.y * t0;\r\n projz = z + norm.z * t0;\r\n tmpx = projx - x;\r\n tmpy = projy - y;\r\n tmpz = projz - z;\r\n tmpDistance = tmpx * tmpx + tmpy * tmpy + tmpz * tmpz; // compute length between (x, y, z) and its projection on the facet\r\n if (tmpDistance < shortest) { // just keep the closest facet to (x, y, z)\r\n shortest = tmpDistance;\r\n closest = fib;\r\n if (projected) {\r\n projected.x = projx;\r\n projected.y = projy;\r\n projected.z = projz;\r\n }\r\n }\r\n }\r\n }\r\n return closest;\r\n };\r\n /**\r\n * Returns the object \"parameter\" set with all the expected parameters for facetData computation by ComputeNormals()\r\n * @returns the parameters\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.getFacetDataParameters = function () {\r\n return this._internalAbstractMeshDataInfo._facetData.facetParameters;\r\n };\r\n /**\r\n * Disables the feature FacetData and frees the related memory\r\n * @returns the current mesh\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata\r\n */\r\n AbstractMesh.prototype.disableFacetData = function () {\r\n var facetData = this._internalAbstractMeshDataInfo._facetData;\r\n if (facetData.facetDataEnabled) {\r\n facetData.facetDataEnabled = false;\r\n facetData.facetPositions = new Array();\r\n facetData.facetNormals = new Array();\r\n facetData.facetPartitioning = new Array();\r\n facetData.facetParameters = null;\r\n facetData.depthSortedIndices = new Uint32Array(0);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Updates the AbstractMesh indices array\r\n * @param indices defines the data source\r\n * @param offset defines the offset in the index buffer where to store the new data (can be null)\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.updateIndices = function (indices, offset, gpuMemoryOnly) {\r\n if (gpuMemoryOnly === void 0) { gpuMemoryOnly = false; }\r\n return this;\r\n };\r\n /**\r\n * Creates new normals data for the mesh\r\n * @param updatable defines if the normal vertex buffer must be flagged as updatable\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.createNormals = function (updatable) {\r\n var positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n var indices = this.getIndices();\r\n var normals;\r\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n normals = this.getVerticesData(VertexBuffer.NormalKind);\r\n }\r\n else {\r\n normals = [];\r\n }\r\n VertexData.ComputeNormals(positions, indices, normals, { useRightHandedSystem: this.getScene().useRightHandedSystem });\r\n this.setVerticesData(VertexBuffer.NormalKind, normals, updatable);\r\n return this;\r\n };\r\n /**\r\n * Align the mesh with a normal\r\n * @param normal defines the normal to use\r\n * @param upDirection can be used to redefined the up vector to use (will use the (0, 1, 0) by default)\r\n * @returns the current mesh\r\n */\r\n AbstractMesh.prototype.alignWithNormal = function (normal, upDirection) {\r\n if (!upDirection) {\r\n upDirection = Axis.Y;\r\n }\r\n var axisX = TmpVectors.Vector3[0];\r\n var axisZ = TmpVectors.Vector3[1];\r\n Vector3.CrossToRef(upDirection, normal, axisZ);\r\n Vector3.CrossToRef(normal, axisZ, axisX);\r\n if (this.rotationQuaternion) {\r\n Quaternion.RotationQuaternionFromAxisToRef(axisX, normal, axisZ, this.rotationQuaternion);\r\n }\r\n else {\r\n Vector3.RotationFromAxisToRef(axisX, normal, axisZ, this.rotation);\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n AbstractMesh.prototype._checkOcclusionQuery = function () {\r\n return false;\r\n };\r\n /**\r\n * Disables the mesh edge rendering mode\r\n * @returns the currentAbstractMesh\r\n */\r\n AbstractMesh.prototype.disableEdgesRendering = function () {\r\n throw _DevTools.WarnImport(\"EdgesRenderer\");\r\n };\r\n /**\r\n * Enables the edge rendering mode on the mesh.\r\n * This mode makes the mesh edges visible\r\n * @param epsilon defines the maximal distance between two angles to detect a face\r\n * @param checkVerticesInsteadOfIndices indicates that we should check vertex list directly instead of faces\r\n * @param options options to the edge renderer\r\n * @returns the currentAbstractMesh\r\n * @see https://www.babylonjs-playground.com/#19O9TU#0\r\n */\r\n AbstractMesh.prototype.enableEdgesRendering = function (epsilon, checkVerticesInsteadOfIndices, options) {\r\n throw _DevTools.WarnImport(\"EdgesRenderer\");\r\n };\r\n /**\r\n * This function returns all of the particle systems in the scene that use the mesh as an emitter.\r\n * @returns an array of particle systems in the scene that use the mesh as an emitter\r\n */\r\n AbstractMesh.prototype.getConnectedParticleSystems = function () {\r\n var _this = this;\r\n return this._scene.particleSystems.filter(function (particleSystem) { return particleSystem.emitter === _this; });\r\n };\r\n /** No occlusion */\r\n AbstractMesh.OCCLUSION_TYPE_NONE = 0;\r\n /** Occlusion set to optimisitic */\r\n AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC = 1;\r\n /** Occlusion set to strict */\r\n AbstractMesh.OCCLUSION_TYPE_STRICT = 2;\r\n /** Use an accurante occlusion algorithm */\r\n AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE = 0;\r\n /** Use a conservative occlusion algorithm */\r\n AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE = 1;\r\n /** Default culling strategy : this is an exclusion test and it's the more accurate.\r\n * Test order :\r\n * Is the bounding sphere outside the frustum ?\r\n * If not, are the bounding box vertices outside the frustum ?\r\n * It not, then the cullable object is in the frustum.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_STANDARD = 0;\r\n /** Culling strategy : Bounding Sphere Only.\r\n * This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested.\r\n * It's also less accurate than the standard because some not visible objects can still be selected.\r\n * Test : is the bounding sphere outside the frustum ?\r\n * If not, then the cullable object is in the frustum.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = 1;\r\n /** Culling strategy : Optimistic Inclusion.\r\n * This in an inclusion test first, then the standard exclusion test.\r\n * This can be faster when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside.\r\n * Anyway, it's as accurate as the standard strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the default culling strategy.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = 2;\r\n /** Culling strategy : Optimistic Inclusion then Bounding Sphere Only.\r\n * This in an inclusion test first, then the bounding sphere only exclusion test.\r\n * This can be the fastest test when a cullable object is expected to be almost always in the camera frustum.\r\n * This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it.\r\n * It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy.\r\n * Test :\r\n * Is the cullable object bounding sphere center in the frustum ?\r\n * If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here.\r\n */\r\n AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = 3;\r\n return AbstractMesh;\r\n}(TransformNode));\r\nexport { AbstractMesh };\r\n_TypeStore.RegisteredTypes[\"BABYLON.AbstractMesh\"] = AbstractMesh;\r\n//# sourceMappingURL=abstractMesh.js.map","/**\r\n * Class used to store data that will be store in GPU memory\r\n */\r\nvar Buffer = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param engine the engine\r\n * @param data the data to use for this buffer\r\n * @param updatable whether the data is updatable\r\n * @param stride the stride (optional)\r\n * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional)\r\n * @param instanced whether the buffer is instanced (optional)\r\n * @param useBytes set to true if the stride in in bytes (optional)\r\n * @param divisor sets an optional divisor for instances (1 by default)\r\n */\r\n function Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced, useBytes, divisor) {\r\n if (stride === void 0) { stride = 0; }\r\n if (postponeInternalCreation === void 0) { postponeInternalCreation = false; }\r\n if (instanced === void 0) { instanced = false; }\r\n if (useBytes === void 0) { useBytes = false; }\r\n this._isAlreadyOwned = false;\r\n if (engine.getScene) { // old versions of VertexBuffer accepted 'mesh' instead of 'engine'\r\n this._engine = engine.getScene().getEngine();\r\n }\r\n else {\r\n this._engine = engine;\r\n }\r\n this._updatable = updatable;\r\n this._instanced = instanced;\r\n this._divisor = divisor || 1;\r\n this._data = data;\r\n this.byteStride = useBytes ? stride : stride * Float32Array.BYTES_PER_ELEMENT;\r\n if (!postponeInternalCreation) { // by default\r\n this.create();\r\n }\r\n }\r\n /**\r\n * Create a new VertexBuffer based on the current buffer\r\n * @param kind defines the vertex buffer kind (position, normal, etc.)\r\n * @param offset defines offset in the buffer (0 by default)\r\n * @param size defines the size in floats of attributes (position is 3 for instance)\r\n * @param stride defines the stride size in floats in the buffer (the offset to apply to reach next value when data is interleaved)\r\n * @param instanced defines if the vertex buffer contains indexed data\r\n * @param useBytes defines if the offset and stride are in bytes *\r\n * @param divisor sets an optional divisor for instances (1 by default)\r\n * @returns the new vertex buffer\r\n */\r\n Buffer.prototype.createVertexBuffer = function (kind, offset, size, stride, instanced, useBytes, divisor) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n var byteOffset = useBytes ? offset : offset * Float32Array.BYTES_PER_ELEMENT;\r\n var byteStride = stride ? (useBytes ? stride : stride * Float32Array.BYTES_PER_ELEMENT) : this.byteStride;\r\n // a lot of these parameters are ignored as they are overriden by the buffer\r\n return new VertexBuffer(this._engine, this, kind, this._updatable, true, byteStride, instanced === undefined ? this._instanced : instanced, byteOffset, size, undefined, undefined, true, this._divisor || divisor);\r\n };\r\n // Properties\r\n /**\r\n * Gets a boolean indicating if the Buffer is updatable?\r\n * @returns true if the buffer is updatable\r\n */\r\n Buffer.prototype.isUpdatable = function () {\r\n return this._updatable;\r\n };\r\n /**\r\n * Gets current buffer's data\r\n * @returns a DataArray or null\r\n */\r\n Buffer.prototype.getData = function () {\r\n return this._data;\r\n };\r\n /**\r\n * Gets underlying native buffer\r\n * @returns underlying native buffer\r\n */\r\n Buffer.prototype.getBuffer = function () {\r\n return this._buffer;\r\n };\r\n /**\r\n * Gets the stride in float32 units (i.e. byte stride / 4).\r\n * May not be an integer if the byte stride is not divisible by 4.\r\n * @returns the stride in float32 units\r\n * @deprecated Please use byteStride instead.\r\n */\r\n Buffer.prototype.getStrideSize = function () {\r\n return this.byteStride / Float32Array.BYTES_PER_ELEMENT;\r\n };\r\n // Methods\r\n /**\r\n * Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property\r\n * @param data defines the data to store\r\n */\r\n Buffer.prototype.create = function (data) {\r\n if (data === void 0) { data = null; }\r\n if (!data && this._buffer) {\r\n return; // nothing to do\r\n }\r\n data = data || this._data;\r\n if (!data) {\r\n return;\r\n }\r\n if (!this._buffer) { // create buffer\r\n if (this._updatable) {\r\n this._buffer = this._engine.createDynamicVertexBuffer(data);\r\n this._data = data;\r\n }\r\n else {\r\n this._buffer = this._engine.createVertexBuffer(data);\r\n }\r\n }\r\n else if (this._updatable) { // update buffer\r\n this._engine.updateDynamicVertexBuffer(this._buffer, data);\r\n this._data = data;\r\n }\r\n };\r\n /** @hidden */\r\n Buffer.prototype._rebuild = function () {\r\n this._buffer = null;\r\n this.create(this._data);\r\n };\r\n /**\r\n * Update current buffer data\r\n * @param data defines the data to store\r\n */\r\n Buffer.prototype.update = function (data) {\r\n this.create(data);\r\n };\r\n /**\r\n * Updates the data directly.\r\n * @param data the new data\r\n * @param offset the new offset\r\n * @param vertexCount the vertex count (optional)\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n Buffer.prototype.updateDirectly = function (data, offset, vertexCount, useBytes) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n if (!this._buffer) {\r\n return;\r\n }\r\n if (this._updatable) { // update buffer\r\n this._engine.updateDynamicVertexBuffer(this._buffer, data, useBytes ? offset : offset * Float32Array.BYTES_PER_ELEMENT, (vertexCount ? vertexCount * this.byteStride : undefined));\r\n this._data = null;\r\n }\r\n };\r\n /** @hidden */\r\n Buffer.prototype._increaseReferences = function () {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n if (!this._isAlreadyOwned) {\r\n this._isAlreadyOwned = true;\r\n return;\r\n }\r\n this._buffer.references++;\r\n };\r\n /**\r\n * Release all resources\r\n */\r\n Buffer.prototype.dispose = function () {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n if (this._engine._releaseBuffer(this._buffer)) {\r\n this._buffer = null;\r\n }\r\n };\r\n return Buffer;\r\n}());\r\nexport { Buffer };\r\n/**\r\n * Specialized buffer used to store vertex data\r\n */\r\nvar VertexBuffer = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param engine the engine\r\n * @param data the data to use for this vertex buffer\r\n * @param kind the vertex buffer kind\r\n * @param updatable whether the data is updatable\r\n * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional)\r\n * @param stride the stride (optional)\r\n * @param instanced whether the buffer is instanced (optional)\r\n * @param offset the offset of the data (optional)\r\n * @param size the number of components (optional)\r\n * @param type the type of the component (optional)\r\n * @param normalized whether the data contains normalized data (optional)\r\n * @param useBytes set to true if stride and offset are in bytes (optional)\r\n * @param divisor defines the instance divisor to use (1 by default)\r\n * @param takeBufferOwnership defines if the buffer should be released when the vertex buffer is disposed\r\n */\r\n function VertexBuffer(engine, data, kind, updatable, postponeInternalCreation, stride, instanced, offset, size, type, normalized, useBytes, divisor, takeBufferOwnership) {\r\n if (normalized === void 0) { normalized = false; }\r\n if (useBytes === void 0) { useBytes = false; }\r\n if (divisor === void 0) { divisor = 1; }\r\n if (takeBufferOwnership === void 0) { takeBufferOwnership = false; }\r\n if (data instanceof Buffer) {\r\n this._buffer = data;\r\n this._ownsBuffer = takeBufferOwnership;\r\n if (takeBufferOwnership) {\r\n this._buffer._increaseReferences();\r\n }\r\n }\r\n else {\r\n this._buffer = new Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced, useBytes);\r\n this._ownsBuffer = true;\r\n }\r\n this._kind = kind;\r\n if (type == undefined) {\r\n var data_1 = this.getData();\r\n this.type = VertexBuffer.FLOAT;\r\n if (data_1 instanceof Int8Array) {\r\n this.type = VertexBuffer.BYTE;\r\n }\r\n else if (data_1 instanceof Uint8Array) {\r\n this.type = VertexBuffer.UNSIGNED_BYTE;\r\n }\r\n else if (data_1 instanceof Int16Array) {\r\n this.type = VertexBuffer.SHORT;\r\n }\r\n else if (data_1 instanceof Uint16Array) {\r\n this.type = VertexBuffer.UNSIGNED_SHORT;\r\n }\r\n else if (data_1 instanceof Int32Array) {\r\n this.type = VertexBuffer.INT;\r\n }\r\n else if (data_1 instanceof Uint32Array) {\r\n this.type = VertexBuffer.UNSIGNED_INT;\r\n }\r\n }\r\n else {\r\n this.type = type;\r\n }\r\n var typeByteLength = VertexBuffer.GetTypeByteLength(this.type);\r\n if (useBytes) {\r\n this._size = size || (stride ? (stride / typeByteLength) : VertexBuffer.DeduceStride(kind));\r\n this.byteStride = stride || this._buffer.byteStride || (this._size * typeByteLength);\r\n this.byteOffset = offset || 0;\r\n }\r\n else {\r\n this._size = size || stride || VertexBuffer.DeduceStride(kind);\r\n this.byteStride = stride ? (stride * typeByteLength) : (this._buffer.byteStride || (this._size * typeByteLength));\r\n this.byteOffset = (offset || 0) * typeByteLength;\r\n }\r\n this.normalized = normalized;\r\n this._instanced = instanced !== undefined ? instanced : false;\r\n this._instanceDivisor = instanced ? divisor : 0;\r\n }\r\n Object.defineProperty(VertexBuffer.prototype, \"instanceDivisor\", {\r\n /**\r\n * Gets or sets the instance divisor when in instanced mode\r\n */\r\n get: function () {\r\n return this._instanceDivisor;\r\n },\r\n set: function (value) {\r\n this._instanceDivisor = value;\r\n if (value == 0) {\r\n this._instanced = false;\r\n }\r\n else {\r\n this._instanced = true;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n VertexBuffer.prototype._rebuild = function () {\r\n if (!this._buffer) {\r\n return;\r\n }\r\n this._buffer._rebuild();\r\n };\r\n /**\r\n * Returns the kind of the VertexBuffer (string)\r\n * @returns a string\r\n */\r\n VertexBuffer.prototype.getKind = function () {\r\n return this._kind;\r\n };\r\n // Properties\r\n /**\r\n * Gets a boolean indicating if the VertexBuffer is updatable?\r\n * @returns true if the buffer is updatable\r\n */\r\n VertexBuffer.prototype.isUpdatable = function () {\r\n return this._buffer.isUpdatable();\r\n };\r\n /**\r\n * Gets current buffer's data\r\n * @returns a DataArray or null\r\n */\r\n VertexBuffer.prototype.getData = function () {\r\n return this._buffer.getData();\r\n };\r\n /**\r\n * Gets underlying native buffer\r\n * @returns underlying native buffer\r\n */\r\n VertexBuffer.prototype.getBuffer = function () {\r\n return this._buffer.getBuffer();\r\n };\r\n /**\r\n * Gets the stride in float32 units (i.e. byte stride / 4).\r\n * May not be an integer if the byte stride is not divisible by 4.\r\n * @returns the stride in float32 units\r\n * @deprecated Please use byteStride instead.\r\n */\r\n VertexBuffer.prototype.getStrideSize = function () {\r\n return this.byteStride / VertexBuffer.GetTypeByteLength(this.type);\r\n };\r\n /**\r\n * Returns the offset as a multiple of the type byte length.\r\n * @returns the offset in bytes\r\n * @deprecated Please use byteOffset instead.\r\n */\r\n VertexBuffer.prototype.getOffset = function () {\r\n return this.byteOffset / VertexBuffer.GetTypeByteLength(this.type);\r\n };\r\n /**\r\n * Returns the number of components per vertex attribute (integer)\r\n * @returns the size in float\r\n */\r\n VertexBuffer.prototype.getSize = function () {\r\n return this._size;\r\n };\r\n /**\r\n * Gets a boolean indicating is the internal buffer of the VertexBuffer is instanced\r\n * @returns true if this buffer is instanced\r\n */\r\n VertexBuffer.prototype.getIsInstanced = function () {\r\n return this._instanced;\r\n };\r\n /**\r\n * Returns the instancing divisor, zero for non-instanced (integer).\r\n * @returns a number\r\n */\r\n VertexBuffer.prototype.getInstanceDivisor = function () {\r\n return this._instanceDivisor;\r\n };\r\n // Methods\r\n /**\r\n * Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property\r\n * @param data defines the data to store\r\n */\r\n VertexBuffer.prototype.create = function (data) {\r\n this._buffer.create(data);\r\n };\r\n /**\r\n * Updates the underlying buffer according to the passed numeric array or Float32Array.\r\n * This function will create a new buffer if the current one is not updatable\r\n * @param data defines the data to store\r\n */\r\n VertexBuffer.prototype.update = function (data) {\r\n this._buffer.update(data);\r\n };\r\n /**\r\n * Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array.\r\n * Returns the directly updated WebGLBuffer.\r\n * @param data the new data\r\n * @param offset the new offset\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n VertexBuffer.prototype.updateDirectly = function (data, offset, useBytes) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n this._buffer.updateDirectly(data, offset, undefined, useBytes);\r\n };\r\n /**\r\n * Disposes the VertexBuffer and the underlying WebGLBuffer.\r\n */\r\n VertexBuffer.prototype.dispose = function () {\r\n if (this._ownsBuffer) {\r\n this._buffer.dispose();\r\n }\r\n };\r\n /**\r\n * Enumerates each value of this vertex buffer as numbers.\r\n * @param count the number of values to enumerate\r\n * @param callback the callback function called for each value\r\n */\r\n VertexBuffer.prototype.forEach = function (count, callback) {\r\n VertexBuffer.ForEach(this._buffer.getData(), this.byteOffset, this.byteStride, this._size, this.type, count, this.normalized, callback);\r\n };\r\n /**\r\n * Deduces the stride given a kind.\r\n * @param kind The kind string to deduce\r\n * @returns The deduced stride\r\n */\r\n VertexBuffer.DeduceStride = function (kind) {\r\n switch (kind) {\r\n case VertexBuffer.UVKind:\r\n case VertexBuffer.UV2Kind:\r\n case VertexBuffer.UV3Kind:\r\n case VertexBuffer.UV4Kind:\r\n case VertexBuffer.UV5Kind:\r\n case VertexBuffer.UV6Kind:\r\n return 2;\r\n case VertexBuffer.NormalKind:\r\n case VertexBuffer.PositionKind:\r\n return 3;\r\n case VertexBuffer.ColorKind:\r\n case VertexBuffer.MatricesIndicesKind:\r\n case VertexBuffer.MatricesIndicesExtraKind:\r\n case VertexBuffer.MatricesWeightsKind:\r\n case VertexBuffer.MatricesWeightsExtraKind:\r\n case VertexBuffer.TangentKind:\r\n return 4;\r\n default:\r\n throw new Error(\"Invalid kind '\" + kind + \"'\");\r\n }\r\n };\r\n /**\r\n * Gets the byte length of the given type.\r\n * @param type the type\r\n * @returns the number of bytes\r\n */\r\n VertexBuffer.GetTypeByteLength = function (type) {\r\n switch (type) {\r\n case VertexBuffer.BYTE:\r\n case VertexBuffer.UNSIGNED_BYTE:\r\n return 1;\r\n case VertexBuffer.SHORT:\r\n case VertexBuffer.UNSIGNED_SHORT:\r\n return 2;\r\n case VertexBuffer.INT:\r\n case VertexBuffer.UNSIGNED_INT:\r\n case VertexBuffer.FLOAT:\r\n return 4;\r\n default:\r\n throw new Error(\"Invalid type '\" + type + \"'\");\r\n }\r\n };\r\n /**\r\n * Enumerates each value of the given parameters as numbers.\r\n * @param data the data to enumerate\r\n * @param byteOffset the byte offset of the data\r\n * @param byteStride the byte stride of the data\r\n * @param componentCount the number of components per element\r\n * @param componentType the type of the component\r\n * @param count the number of values to enumerate\r\n * @param normalized whether the data is normalized\r\n * @param callback the callback function called for each value\r\n */\r\n VertexBuffer.ForEach = function (data, byteOffset, byteStride, componentCount, componentType, count, normalized, callback) {\r\n if (data instanceof Array) {\r\n var offset = byteOffset / 4;\r\n var stride = byteStride / 4;\r\n for (var index = 0; index < count; index += componentCount) {\r\n for (var componentIndex = 0; componentIndex < componentCount; componentIndex++) {\r\n callback(data[offset + componentIndex], index + componentIndex);\r\n }\r\n offset += stride;\r\n }\r\n }\r\n else {\r\n var dataView = data instanceof ArrayBuffer ? new DataView(data) : new DataView(data.buffer, data.byteOffset, data.byteLength);\r\n var componentByteLength = VertexBuffer.GetTypeByteLength(componentType);\r\n for (var index = 0; index < count; index += componentCount) {\r\n var componentByteOffset = byteOffset;\r\n for (var componentIndex = 0; componentIndex < componentCount; componentIndex++) {\r\n var value = VertexBuffer._GetFloatValue(dataView, componentType, componentByteOffset, normalized);\r\n callback(value, index + componentIndex);\r\n componentByteOffset += componentByteLength;\r\n }\r\n byteOffset += byteStride;\r\n }\r\n }\r\n };\r\n VertexBuffer._GetFloatValue = function (dataView, type, byteOffset, normalized) {\r\n switch (type) {\r\n case VertexBuffer.BYTE: {\r\n var value = dataView.getInt8(byteOffset);\r\n if (normalized) {\r\n value = Math.max(value / 127, -1);\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.UNSIGNED_BYTE: {\r\n var value = dataView.getUint8(byteOffset);\r\n if (normalized) {\r\n value = value / 255;\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.SHORT: {\r\n var value = dataView.getInt16(byteOffset, true);\r\n if (normalized) {\r\n value = Math.max(value / 32767, -1);\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.UNSIGNED_SHORT: {\r\n var value = dataView.getUint16(byteOffset, true);\r\n if (normalized) {\r\n value = value / 65535;\r\n }\r\n return value;\r\n }\r\n case VertexBuffer.INT: {\r\n return dataView.getInt32(byteOffset, true);\r\n }\r\n case VertexBuffer.UNSIGNED_INT: {\r\n return dataView.getUint32(byteOffset, true);\r\n }\r\n case VertexBuffer.FLOAT: {\r\n return dataView.getFloat32(byteOffset, true);\r\n }\r\n default: {\r\n throw new Error(\"Invalid component type \" + type);\r\n }\r\n }\r\n };\r\n /**\r\n * The byte type.\r\n */\r\n VertexBuffer.BYTE = 5120;\r\n /**\r\n * The unsigned byte type.\r\n */\r\n VertexBuffer.UNSIGNED_BYTE = 5121;\r\n /**\r\n * The short type.\r\n */\r\n VertexBuffer.SHORT = 5122;\r\n /**\r\n * The unsigned short type.\r\n */\r\n VertexBuffer.UNSIGNED_SHORT = 5123;\r\n /**\r\n * The integer type.\r\n */\r\n VertexBuffer.INT = 5124;\r\n /**\r\n * The unsigned integer type.\r\n */\r\n VertexBuffer.UNSIGNED_INT = 5125;\r\n /**\r\n * The float type.\r\n */\r\n VertexBuffer.FLOAT = 5126;\r\n // Enums\r\n /**\r\n * Positions\r\n */\r\n VertexBuffer.PositionKind = \"position\";\r\n /**\r\n * Normals\r\n */\r\n VertexBuffer.NormalKind = \"normal\";\r\n /**\r\n * Tangents\r\n */\r\n VertexBuffer.TangentKind = \"tangent\";\r\n /**\r\n * Texture coordinates\r\n */\r\n VertexBuffer.UVKind = \"uv\";\r\n /**\r\n * Texture coordinates 2\r\n */\r\n VertexBuffer.UV2Kind = \"uv2\";\r\n /**\r\n * Texture coordinates 3\r\n */\r\n VertexBuffer.UV3Kind = \"uv3\";\r\n /**\r\n * Texture coordinates 4\r\n */\r\n VertexBuffer.UV4Kind = \"uv4\";\r\n /**\r\n * Texture coordinates 5\r\n */\r\n VertexBuffer.UV5Kind = \"uv5\";\r\n /**\r\n * Texture coordinates 6\r\n */\r\n VertexBuffer.UV6Kind = \"uv6\";\r\n /**\r\n * Colors\r\n */\r\n VertexBuffer.ColorKind = \"color\";\r\n /**\r\n * Matrix indices (for bones)\r\n */\r\n VertexBuffer.MatricesIndicesKind = \"matricesIndices\";\r\n /**\r\n * Matrix weights (for bones)\r\n */\r\n VertexBuffer.MatricesWeightsKind = \"matricesWeights\";\r\n /**\r\n * Additional matrix indices (for bones)\r\n */\r\n VertexBuffer.MatricesIndicesExtraKind = \"matricesIndicesExtra\";\r\n /**\r\n * Additional matrix weights (for bones)\r\n */\r\n VertexBuffer.MatricesWeightsExtraKind = \"matricesWeightsExtra\";\r\n return VertexBuffer;\r\n}());\r\nexport { VertexBuffer };\r\n//# sourceMappingURL=buffer.js.map","import { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport { VertexData } from \"../Meshes/mesh.vertexData\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { SubMesh } from \"../Meshes/subMesh\";\r\nimport { SceneLoaderFlags } from \"../Loading/sceneLoaderFlags\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Tags } from \"../Misc/tags\";\r\nimport { extractMinAndMax } from \"../Maths/math.functions\";\r\n/**\r\n * Class used to store geometry data (vertex buffers + index buffer)\r\n */\r\nvar Geometry = /** @class */ (function () {\r\n /**\r\n * Creates a new geometry\r\n * @param id defines the unique ID\r\n * @param scene defines the hosting scene\r\n * @param vertexData defines the VertexData used to get geometry data\r\n * @param updatable defines if geometry must be updatable (false by default)\r\n * @param mesh defines the mesh that will be associated with the geometry\r\n */\r\n function Geometry(id, scene, vertexData, updatable, mesh) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (mesh === void 0) { mesh = null; }\r\n /**\r\n * Gets the delay loading state of the geometry (none by default which means not delayed)\r\n */\r\n this.delayLoadState = 0;\r\n this._totalVertices = 0;\r\n this._isDisposed = false;\r\n this._indexBufferIsUpdatable = false;\r\n this._positionsCache = [];\r\n /**\r\n * If set to true (false by defaut), the bounding info applied to the meshes sharing this geometry will be the bounding info defined at the class level\r\n * and won't be computed based on the vertex positions (which is what we get when useBoundingInfoFromGeometry = false)\r\n */\r\n this.useBoundingInfoFromGeometry = false;\r\n this.id = id;\r\n this.uniqueId = scene.getUniqueId();\r\n this._engine = scene.getEngine();\r\n this._meshes = [];\r\n this._scene = scene;\r\n //Init vertex buffer cache\r\n this._vertexBuffers = {};\r\n this._indices = [];\r\n this._updatable = updatable;\r\n // vertexData\r\n if (vertexData) {\r\n this.setAllVerticesData(vertexData, updatable);\r\n }\r\n else {\r\n this._totalVertices = 0;\r\n this._indices = [];\r\n }\r\n if (this._engine.getCaps().vertexArrayObject) {\r\n this._vertexArrayObjects = {};\r\n }\r\n // applyToMesh\r\n if (mesh) {\r\n this.applyToMesh(mesh);\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n Object.defineProperty(Geometry.prototype, \"boundingBias\", {\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n get: function () {\r\n return this._boundingBias;\r\n },\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n set: function (value) {\r\n if (this._boundingBias) {\r\n this._boundingBias.copyFrom(value);\r\n }\r\n else {\r\n this._boundingBias = value.clone();\r\n }\r\n this._updateBoundingInfo(true, null);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Static function used to attach a new empty geometry to a mesh\r\n * @param mesh defines the mesh to attach the geometry to\r\n * @returns the new Geometry\r\n */\r\n Geometry.CreateGeometryForMesh = function (mesh) {\r\n var geometry = new Geometry(Geometry.RandomId(), mesh.getScene());\r\n geometry.applyToMesh(mesh);\r\n return geometry;\r\n };\r\n Object.defineProperty(Geometry.prototype, \"meshes\", {\r\n /** Get the list of meshes using this geometry */\r\n get: function () {\r\n return this._meshes;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Geometry.prototype, \"extend\", {\r\n /**\r\n * Gets the current extend of the geometry\r\n */\r\n get: function () {\r\n return this._extend;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the hosting scene\r\n * @returns the hosting Scene\r\n */\r\n Geometry.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n /**\r\n * Gets the hosting engine\r\n * @returns the hosting Engine\r\n */\r\n Geometry.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * Defines if the geometry is ready to use\r\n * @returns true if the geometry is ready to be used\r\n */\r\n Geometry.prototype.isReady = function () {\r\n return this.delayLoadState === 1 || this.delayLoadState === 0;\r\n };\r\n Object.defineProperty(Geometry.prototype, \"doNotSerialize\", {\r\n /**\r\n * Gets a value indicating that the geometry should not be serialized\r\n */\r\n get: function () {\r\n for (var index = 0; index < this._meshes.length; index++) {\r\n if (!this._meshes[index].doNotSerialize) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Geometry.prototype._rebuild = function () {\r\n if (this._vertexArrayObjects) {\r\n this._vertexArrayObjects = {};\r\n }\r\n // Index buffer\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices);\r\n }\r\n // Vertex buffers\r\n for (var key in this._vertexBuffers) {\r\n var vertexBuffer = this._vertexBuffers[key];\r\n vertexBuffer._rebuild();\r\n }\r\n };\r\n /**\r\n * Affects all geometry data in one call\r\n * @param vertexData defines the geometry data\r\n * @param updatable defines if the geometry must be flagged as updatable (false as default)\r\n */\r\n Geometry.prototype.setAllVerticesData = function (vertexData, updatable) {\r\n vertexData.applyToGeometry(this, updatable);\r\n this.notifyUpdate();\r\n };\r\n /**\r\n * Set specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the vertex data to use\r\n * @param updatable defines if the vertex must be flagged as updatable (false as default)\r\n * @param stride defines the stride to use (0 by default). This value is deduced from the kind value if not specified\r\n */\r\n Geometry.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (updatable && Array.isArray(data)) {\r\n // to avoid converting to Float32Array at each draw call in engine.updateDynamicVertexBuffer, we make the conversion a single time here\r\n data = new Float32Array(data);\r\n }\r\n var buffer = new VertexBuffer(this._engine, data, kind, updatable, this._meshes.length === 0, stride);\r\n this.setVerticesBuffer(buffer);\r\n };\r\n /**\r\n * Removes a specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n */\r\n Geometry.prototype.removeVerticesData = function (kind) {\r\n if (this._vertexBuffers[kind]) {\r\n this._vertexBuffers[kind].dispose();\r\n delete this._vertexBuffers[kind];\r\n }\r\n };\r\n /**\r\n * Affect a vertex buffer to the geometry. the vertexBuffer.getKind() function is used to determine where to store the data\r\n * @param buffer defines the vertex buffer to use\r\n * @param totalVertices defines the total number of vertices for position kind (could be null)\r\n */\r\n Geometry.prototype.setVerticesBuffer = function (buffer, totalVertices) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n var kind = buffer.getKind();\r\n if (this._vertexBuffers[kind]) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n this._vertexBuffers[kind] = buffer;\r\n if (kind === VertexBuffer.PositionKind) {\r\n var data = buffer.getData();\r\n if (totalVertices != null) {\r\n this._totalVertices = totalVertices;\r\n }\r\n else {\r\n if (data != null) {\r\n this._totalVertices = data.length / (buffer.byteStride / 4);\r\n }\r\n }\r\n this._updateExtend(data);\r\n this._resetPointsArrayCache();\r\n var meshes = this._meshes;\r\n var numOfMeshes = meshes.length;\r\n for (var index = 0; index < numOfMeshes; index++) {\r\n var mesh = meshes[index];\r\n mesh._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);\r\n mesh._createGlobalSubMesh(false);\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n this.notifyUpdate(kind);\r\n if (this._vertexArrayObjects) {\r\n this._disposeVertexArrayObjects();\r\n this._vertexArrayObjects = {}; // Will trigger a rebuild of the VAO if supported\r\n }\r\n };\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will directly update the underlying DataBuffer according to the passed numeric array or Float32Array\r\n * It will do nothing if the buffer is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n Geometry.prototype.updateVerticesDataDirectly = function (kind, data, offset, useBytes) {\r\n if (useBytes === void 0) { useBytes = false; }\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n vertexBuffer.updateDirectly(data, offset, useBytes);\r\n this.notifyUpdate(kind);\r\n };\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will create a new buffer if the current one is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param updateExtends defines if the geometry extends must be recomputed (false by default)\r\n */\r\n Geometry.prototype.updateVerticesData = function (kind, data, updateExtends) {\r\n if (updateExtends === void 0) { updateExtends = false; }\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n vertexBuffer.update(data);\r\n if (kind === VertexBuffer.PositionKind) {\r\n this._updateBoundingInfo(updateExtends, data);\r\n }\r\n this.notifyUpdate(kind);\r\n };\r\n Geometry.prototype._updateBoundingInfo = function (updateExtends, data) {\r\n if (updateExtends) {\r\n this._updateExtend(data);\r\n }\r\n this._resetPointsArrayCache();\r\n if (updateExtends) {\r\n var meshes = this._meshes;\r\n for (var _i = 0, meshes_1 = meshes; _i < meshes_1.length; _i++) {\r\n var mesh = meshes_1[_i];\r\n if (mesh._boundingInfo) {\r\n mesh._boundingInfo.reConstruct(this._extend.minimum, this._extend.maximum);\r\n }\r\n else {\r\n mesh._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);\r\n }\r\n var subMeshes = mesh.subMeshes;\r\n for (var _a = 0, subMeshes_1 = subMeshes; _a < subMeshes_1.length; _a++) {\r\n var subMesh = subMeshes_1[_a];\r\n subMesh.refreshBoundingInfo();\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Geometry.prototype._bind = function (effect, indexToBind) {\r\n if (!effect) {\r\n return;\r\n }\r\n if (indexToBind === undefined) {\r\n indexToBind = this._indexBuffer;\r\n }\r\n var vbs = this.getVertexBuffers();\r\n if (!vbs) {\r\n return;\r\n }\r\n if (indexToBind != this._indexBuffer || !this._vertexArrayObjects) {\r\n this._engine.bindBuffers(vbs, indexToBind, effect);\r\n return;\r\n }\r\n // Using VAO\r\n if (!this._vertexArrayObjects[effect.key]) {\r\n this._vertexArrayObjects[effect.key] = this._engine.recordVertexArrayObject(vbs, indexToBind, effect);\r\n }\r\n this._engine.bindVertexArrayObject(this._vertexArrayObjects[effect.key], indexToBind);\r\n };\r\n /**\r\n * Gets total number of vertices\r\n * @returns the total number of vertices\r\n */\r\n Geometry.prototype.getTotalVertices = function () {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n return this._totalVertices;\r\n };\r\n /**\r\n * Gets a specific vertex data attached to this geometry. Float data is constructed if the vertex buffer data cannot be returned directly.\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns a float array containing vertex data\r\n */\r\n Geometry.prototype.getVerticesData = function (kind, copyWhenShared, forceCopy) {\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return null;\r\n }\r\n var data = vertexBuffer.getData();\r\n if (!data) {\r\n return null;\r\n }\r\n var tightlyPackedByteStride = vertexBuffer.getSize() * VertexBuffer.GetTypeByteLength(vertexBuffer.type);\r\n var count = this._totalVertices * vertexBuffer.getSize();\r\n if (vertexBuffer.type !== VertexBuffer.FLOAT || vertexBuffer.byteStride !== tightlyPackedByteStride) {\r\n var copy_1 = [];\r\n vertexBuffer.forEach(count, function (value) { return copy_1.push(value); });\r\n return copy_1;\r\n }\r\n if (!(data instanceof Array || data instanceof Float32Array) || vertexBuffer.byteOffset !== 0 || data.length !== count) {\r\n if (data instanceof Array) {\r\n var offset = vertexBuffer.byteOffset / 4;\r\n return Tools.Slice(data, offset, offset + count);\r\n }\r\n else if (data instanceof ArrayBuffer) {\r\n return new Float32Array(data, vertexBuffer.byteOffset, count);\r\n }\r\n else {\r\n var offset = data.byteOffset + vertexBuffer.byteOffset;\r\n if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {\r\n var result = new Float32Array(count);\r\n var source = new Float32Array(data.buffer, offset, count);\r\n result.set(source);\r\n return result;\r\n }\r\n // Portect against bad data\r\n var remainder = offset % 4;\r\n if (remainder) {\r\n offset = Math.max(0, offset - remainder);\r\n }\r\n return new Float32Array(data.buffer, offset, count);\r\n }\r\n }\r\n if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {\r\n return Tools.Slice(data);\r\n }\r\n return data;\r\n };\r\n /**\r\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if the vertex buffer with the specified kind is updatable\r\n */\r\n Geometry.prototype.isVertexBufferUpdatable = function (kind) {\r\n var vb = this._vertexBuffers[kind];\r\n if (!vb) {\r\n return false;\r\n }\r\n return vb.isUpdatable();\r\n };\r\n /**\r\n * Gets a specific vertex buffer\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns a VertexBuffer\r\n */\r\n Geometry.prototype.getVertexBuffer = function (kind) {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers[kind];\r\n };\r\n /**\r\n * Returns all vertex buffers\r\n * @return an object holding all vertex buffers indexed by kind\r\n */\r\n Geometry.prototype.getVertexBuffers = function () {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers;\r\n };\r\n /**\r\n * Gets a boolean indicating if specific vertex buffer is present\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if data is present\r\n */\r\n Geometry.prototype.isVerticesDataPresent = function (kind) {\r\n if (!this._vertexBuffers) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._vertexBuffers[kind] !== undefined;\r\n };\r\n /**\r\n * Gets a list of all attached data kinds (Position, normal, etc...)\r\n * @returns a list of string containing all kinds\r\n */\r\n Geometry.prototype.getVerticesDataKinds = function () {\r\n var result = [];\r\n var kind;\r\n if (!this._vertexBuffers && this._delayInfo) {\r\n for (kind in this._delayInfo) {\r\n result.push(kind);\r\n }\r\n }\r\n else {\r\n for (kind in this._vertexBuffers) {\r\n result.push(kind);\r\n }\r\n }\r\n return result;\r\n };\r\n /**\r\n * Update index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n */\r\n Geometry.prototype.updateIndices = function (indices, offset, gpuMemoryOnly) {\r\n if (gpuMemoryOnly === void 0) { gpuMemoryOnly = false; }\r\n if (!this._indexBuffer) {\r\n return;\r\n }\r\n if (!this._indexBufferIsUpdatable) {\r\n this.setIndices(indices, null, true);\r\n }\r\n else {\r\n var needToUpdateSubMeshes = indices.length !== this._indices.length;\r\n if (!gpuMemoryOnly) {\r\n this._indices = indices.slice();\r\n }\r\n this._engine.updateDynamicIndexBuffer(this._indexBuffer, indices, offset);\r\n if (needToUpdateSubMeshes) {\r\n for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._createGlobalSubMesh(true);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Creates a new index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param totalVertices defines the total number of vertices (could be null)\r\n * @param updatable defines if the index buffer must be flagged as updatable (false by default)\r\n */\r\n Geometry.prototype.setIndices = function (indices, totalVertices, updatable) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n this._disposeVertexArrayObjects();\r\n this._indices = indices;\r\n this._indexBufferIsUpdatable = updatable;\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, updatable);\r\n }\r\n if (totalVertices != undefined) {\r\n // including null and undefined\r\n this._totalVertices = totalVertices;\r\n }\r\n for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._createGlobalSubMesh(true);\r\n }\r\n this.notifyUpdate();\r\n };\r\n /**\r\n * Return the total number of indices\r\n * @returns the total number of indices\r\n */\r\n Geometry.prototype.getTotalIndices = function () {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n return this._indices.length;\r\n };\r\n /**\r\n * Gets the index buffer array\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns the index buffer array\r\n */\r\n Geometry.prototype.getIndices = function (copyWhenShared, forceCopy) {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n var orig = this._indices;\r\n if (!forceCopy && (!copyWhenShared || this._meshes.length === 1)) {\r\n return orig;\r\n }\r\n else {\r\n var len = orig.length;\r\n var copy = [];\r\n for (var i = 0; i < len; i++) {\r\n copy.push(orig[i]);\r\n }\r\n return copy;\r\n }\r\n };\r\n /**\r\n * Gets the index buffer\r\n * @return the index buffer\r\n */\r\n Geometry.prototype.getIndexBuffer = function () {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._indexBuffer;\r\n };\r\n /** @hidden */\r\n Geometry.prototype._releaseVertexArrayObject = function (effect) {\r\n if (effect === void 0) { effect = null; }\r\n if (!effect || !this._vertexArrayObjects) {\r\n return;\r\n }\r\n if (this._vertexArrayObjects[effect.key]) {\r\n this._engine.releaseVertexArrayObject(this._vertexArrayObjects[effect.key]);\r\n delete this._vertexArrayObjects[effect.key];\r\n }\r\n };\r\n /**\r\n * Release the associated resources for a specific mesh\r\n * @param mesh defines the source mesh\r\n * @param shouldDispose defines if the geometry must be disposed if there is no more mesh pointing to it\r\n */\r\n Geometry.prototype.releaseForMesh = function (mesh, shouldDispose) {\r\n var meshes = this._meshes;\r\n var index = meshes.indexOf(mesh);\r\n if (index === -1) {\r\n return;\r\n }\r\n meshes.splice(index, 1);\r\n mesh._geometry = null;\r\n if (meshes.length === 0 && shouldDispose) {\r\n this.dispose();\r\n }\r\n };\r\n /**\r\n * Apply current geometry to a given mesh\r\n * @param mesh defines the mesh to apply geometry to\r\n */\r\n Geometry.prototype.applyToMesh = function (mesh) {\r\n if (mesh._geometry === this) {\r\n return;\r\n }\r\n var previousGeometry = mesh._geometry;\r\n if (previousGeometry) {\r\n previousGeometry.releaseForMesh(mesh);\r\n }\r\n var meshes = this._meshes;\r\n // must be done before setting vertexBuffers because of mesh._createGlobalSubMesh()\r\n mesh._geometry = this;\r\n this._scene.pushGeometry(this);\r\n meshes.push(mesh);\r\n if (this.isReady()) {\r\n this._applyToMesh(mesh);\r\n }\r\n else {\r\n mesh._boundingInfo = this._boundingInfo;\r\n }\r\n };\r\n Geometry.prototype._updateExtend = function (data) {\r\n if (data === void 0) { data = null; }\r\n if (this.useBoundingInfoFromGeometry && this._boundingInfo) {\r\n this._extend = {\r\n minimum: this._boundingInfo.minimum.clone(),\r\n maximum: this._boundingInfo.maximum.clone(),\r\n };\r\n }\r\n else {\r\n if (!data) {\r\n data = this.getVerticesData(VertexBuffer.PositionKind);\r\n }\r\n this._extend = extractMinAndMax(data, 0, this._totalVertices, this.boundingBias, 3);\r\n }\r\n };\r\n Geometry.prototype._applyToMesh = function (mesh) {\r\n var numOfMeshes = this._meshes.length;\r\n // vertexBuffers\r\n for (var kind in this._vertexBuffers) {\r\n if (numOfMeshes === 1) {\r\n this._vertexBuffers[kind].create();\r\n }\r\n var buffer = this._vertexBuffers[kind].getBuffer();\r\n if (buffer) {\r\n buffer.references = numOfMeshes;\r\n }\r\n if (kind === VertexBuffer.PositionKind) {\r\n if (!this._extend) {\r\n this._updateExtend();\r\n }\r\n mesh._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);\r\n mesh._createGlobalSubMesh(false);\r\n //bounding info was just created again, world matrix should be applied again.\r\n mesh._updateBoundingInfo();\r\n }\r\n }\r\n // indexBuffer\r\n if (numOfMeshes === 1 && this._indices && this._indices.length > 0) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices);\r\n }\r\n if (this._indexBuffer) {\r\n this._indexBuffer.references = numOfMeshes;\r\n }\r\n // morphTargets\r\n mesh._syncGeometryWithMorphTargetManager();\r\n // instances\r\n mesh.synchronizeInstances();\r\n };\r\n Geometry.prototype.notifyUpdate = function (kind) {\r\n if (this.onGeometryUpdated) {\r\n this.onGeometryUpdated(this, kind);\r\n }\r\n for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._markSubMeshesAsAttributesDirty();\r\n }\r\n };\r\n /**\r\n * Load the geometry if it was flagged as delay loaded\r\n * @param scene defines the hosting scene\r\n * @param onLoaded defines a callback called when the geometry is loaded\r\n */\r\n Geometry.prototype.load = function (scene, onLoaded) {\r\n if (this.delayLoadState === 2) {\r\n return;\r\n }\r\n if (this.isReady()) {\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n return;\r\n }\r\n this.delayLoadState = 2;\r\n this._queueLoad(scene, onLoaded);\r\n };\r\n Geometry.prototype._queueLoad = function (scene, onLoaded) {\r\n var _this = this;\r\n if (!this.delayLoadingFile) {\r\n return;\r\n }\r\n scene._addPendingData(this);\r\n scene._loadFile(this.delayLoadingFile, function (data) {\r\n if (!_this._delayLoadingFunction) {\r\n return;\r\n }\r\n _this._delayLoadingFunction(JSON.parse(data), _this);\r\n _this.delayLoadState = 1;\r\n _this._delayInfo = [];\r\n scene._removePendingData(_this);\r\n var meshes = _this._meshes;\r\n var numOfMeshes = meshes.length;\r\n for (var index = 0; index < numOfMeshes; index++) {\r\n _this._applyToMesh(meshes[index]);\r\n }\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n }, undefined, true);\r\n };\r\n /**\r\n * Invert the geometry to move from a right handed system to a left handed one.\r\n */\r\n Geometry.prototype.toLeftHanded = function () {\r\n // Flip faces\r\n var tIndices = this.getIndices(false);\r\n if (tIndices != null && tIndices.length > 0) {\r\n for (var i = 0; i < tIndices.length; i += 3) {\r\n var tTemp = tIndices[i + 0];\r\n tIndices[i + 0] = tIndices[i + 2];\r\n tIndices[i + 2] = tTemp;\r\n }\r\n this.setIndices(tIndices);\r\n }\r\n // Negate position.z\r\n var tPositions = this.getVerticesData(VertexBuffer.PositionKind, false);\r\n if (tPositions != null && tPositions.length > 0) {\r\n for (var i = 0; i < tPositions.length; i += 3) {\r\n tPositions[i + 2] = -tPositions[i + 2];\r\n }\r\n this.setVerticesData(VertexBuffer.PositionKind, tPositions, false);\r\n }\r\n // Negate normal.z\r\n var tNormals = this.getVerticesData(VertexBuffer.NormalKind, false);\r\n if (tNormals != null && tNormals.length > 0) {\r\n for (var i = 0; i < tNormals.length; i += 3) {\r\n tNormals[i + 2] = -tNormals[i + 2];\r\n }\r\n this.setVerticesData(VertexBuffer.NormalKind, tNormals, false);\r\n }\r\n };\r\n // Cache\r\n /** @hidden */\r\n Geometry.prototype._resetPointsArrayCache = function () {\r\n this._positions = null;\r\n };\r\n /** @hidden */\r\n Geometry.prototype._generatePointsArray = function () {\r\n if (this._positions) {\r\n return true;\r\n }\r\n var data = this.getVerticesData(VertexBuffer.PositionKind);\r\n if (!data || data.length === 0) {\r\n return false;\r\n }\r\n for (var index = this._positionsCache.length * 3, arrayIdx = this._positionsCache.length; index < data.length; index += 3, ++arrayIdx) {\r\n this._positionsCache[arrayIdx] = Vector3.FromArray(data, index);\r\n }\r\n for (var index = 0, arrayIdx = 0; index < data.length; index += 3, ++arrayIdx) {\r\n this._positionsCache[arrayIdx].set(data[0 + index], data[1 + index], data[2 + index]);\r\n }\r\n // just in case the number of positions was reduced, splice the array\r\n this._positionsCache.length = data.length / 3;\r\n this._positions = this._positionsCache;\r\n return true;\r\n };\r\n /**\r\n * Gets a value indicating if the geometry is disposed\r\n * @returns true if the geometry was disposed\r\n */\r\n Geometry.prototype.isDisposed = function () {\r\n return this._isDisposed;\r\n };\r\n Geometry.prototype._disposeVertexArrayObjects = function () {\r\n if (this._vertexArrayObjects) {\r\n for (var kind in this._vertexArrayObjects) {\r\n this._engine.releaseVertexArrayObject(this._vertexArrayObjects[kind]);\r\n }\r\n this._vertexArrayObjects = {};\r\n }\r\n };\r\n /**\r\n * Free all associated resources\r\n */\r\n Geometry.prototype.dispose = function () {\r\n var meshes = this._meshes;\r\n var numOfMeshes = meshes.length;\r\n var index;\r\n for (index = 0; index < numOfMeshes; index++) {\r\n this.releaseForMesh(meshes[index]);\r\n }\r\n this._meshes = [];\r\n this._disposeVertexArrayObjects();\r\n for (var kind in this._vertexBuffers) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n this._vertexBuffers = {};\r\n this._totalVertices = 0;\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n this._indexBuffer = null;\r\n this._indices = [];\r\n this.delayLoadState = 0;\r\n this.delayLoadingFile = null;\r\n this._delayLoadingFunction = null;\r\n this._delayInfo = [];\r\n this._boundingInfo = null;\r\n this._scene.removeGeometry(this);\r\n this._isDisposed = true;\r\n };\r\n /**\r\n * Clone the current geometry into a new geometry\r\n * @param id defines the unique ID of the new geometry\r\n * @returns a new geometry object\r\n */\r\n Geometry.prototype.copy = function (id) {\r\n var vertexData = new VertexData();\r\n vertexData.indices = [];\r\n var indices = this.getIndices();\r\n if (indices) {\r\n for (var index = 0; index < indices.length; index++) {\r\n vertexData.indices.push(indices[index]);\r\n }\r\n }\r\n var updatable = false;\r\n var stopChecking = false;\r\n var kind;\r\n for (kind in this._vertexBuffers) {\r\n // using slice() to make a copy of the array and not just reference it\r\n var data = this.getVerticesData(kind);\r\n if (data) {\r\n if (data instanceof Float32Array) {\r\n vertexData.set(new Float32Array(data), kind);\r\n }\r\n else {\r\n vertexData.set(data.slice(0), kind);\r\n }\r\n if (!stopChecking) {\r\n var vb = this.getVertexBuffer(kind);\r\n if (vb) {\r\n updatable = vb.isUpdatable();\r\n stopChecking = !updatable;\r\n }\r\n }\r\n }\r\n }\r\n var geometry = new Geometry(id, this._scene, vertexData, updatable);\r\n geometry.delayLoadState = this.delayLoadState;\r\n geometry.delayLoadingFile = this.delayLoadingFile;\r\n geometry._delayLoadingFunction = this._delayLoadingFunction;\r\n for (kind in this._delayInfo) {\r\n geometry._delayInfo = geometry._delayInfo || [];\r\n geometry._delayInfo.push(kind);\r\n }\r\n // Bounding info\r\n geometry._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);\r\n return geometry;\r\n };\r\n /**\r\n * Serialize the current geometry info (and not the vertices data) into a JSON object\r\n * @return a JSON representation of the current geometry data (without the vertices data)\r\n */\r\n Geometry.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.id = this.id;\r\n serializationObject.updatable = this._updatable;\r\n if (Tags && Tags.HasTags(this)) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n return serializationObject;\r\n };\r\n Geometry.prototype.toNumberArray = function (origin) {\r\n if (Array.isArray(origin)) {\r\n return origin;\r\n }\r\n else {\r\n return Array.prototype.slice.call(origin);\r\n }\r\n };\r\n /**\r\n * Serialize all vertices data into a JSON oject\r\n * @returns a JSON representation of the current geometry data\r\n */\r\n Geometry.prototype.serializeVerticeData = function () {\r\n var serializationObject = this.serialize();\r\n if (this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\r\n serializationObject.positions = this.toNumberArray(this.getVerticesData(VertexBuffer.PositionKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.PositionKind)) {\r\n serializationObject.positions._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n serializationObject.normals = this.toNumberArray(this.getVerticesData(VertexBuffer.NormalKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.NormalKind)) {\r\n serializationObject.normals._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.TangentKind)) {\r\n serializationObject.tangets = this.toNumberArray(this.getVerticesData(VertexBuffer.TangentKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.TangentKind)) {\r\n serializationObject.tangets._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n serializationObject.uvs = this.toNumberArray(this.getVerticesData(VertexBuffer.UVKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UVKind)) {\r\n serializationObject.uvs._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\r\n serializationObject.uv2s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV2Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV2Kind)) {\r\n serializationObject.uv2s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.UV3Kind)) {\r\n serializationObject.uv3s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV3Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV3Kind)) {\r\n serializationObject.uv3s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.UV4Kind)) {\r\n serializationObject.uv4s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV4Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV4Kind)) {\r\n serializationObject.uv4s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.UV5Kind)) {\r\n serializationObject.uv5s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV5Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV5Kind)) {\r\n serializationObject.uv5s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.UV6Kind)) {\r\n serializationObject.uv6s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV6Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV6Kind)) {\r\n serializationObject.uv6s._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.ColorKind)) {\r\n serializationObject.colors = this.toNumberArray(this.getVerticesData(VertexBuffer.ColorKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.ColorKind)) {\r\n serializationObject.colors._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\r\n serializationObject.matricesIndices = this.toNumberArray(this.getVerticesData(VertexBuffer.MatricesIndicesKind));\r\n serializationObject.matricesIndices._isExpanded = true;\r\n if (this.isVertexBufferUpdatable(VertexBuffer.MatricesIndicesKind)) {\r\n serializationObject.matricesIndices._updatable = true;\r\n }\r\n }\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\r\n serializationObject.matricesWeights = this.toNumberArray(this.getVerticesData(VertexBuffer.MatricesWeightsKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.MatricesWeightsKind)) {\r\n serializationObject.matricesWeights._updatable = true;\r\n }\r\n }\r\n serializationObject.indices = this.toNumberArray(this.getIndices());\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Extracts a clone of a mesh geometry\r\n * @param mesh defines the source mesh\r\n * @param id defines the unique ID of the new geometry object\r\n * @returns the new geometry object\r\n */\r\n Geometry.ExtractFromMesh = function (mesh, id) {\r\n var geometry = mesh._geometry;\r\n if (!geometry) {\r\n return null;\r\n }\r\n return geometry.copy(id);\r\n };\r\n /**\r\n * You should now use Tools.RandomId(), this method is still here for legacy reasons.\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a string containing a new GUID\r\n */\r\n Geometry.RandomId = function () {\r\n return Tools.RandomId();\r\n };\r\n /** @hidden */\r\n Geometry._ImportGeometry = function (parsedGeometry, mesh) {\r\n var scene = mesh.getScene();\r\n // Geometry\r\n var geometryId = parsedGeometry.geometryId;\r\n if (geometryId) {\r\n var geometry = scene.getGeometryByID(geometryId);\r\n if (geometry) {\r\n geometry.applyToMesh(mesh);\r\n }\r\n }\r\n else if (parsedGeometry instanceof ArrayBuffer) {\r\n var binaryInfo = mesh._binaryInfo;\r\n if (binaryInfo.positionsAttrDesc && binaryInfo.positionsAttrDesc.count > 0) {\r\n var positionsData = new Float32Array(parsedGeometry, binaryInfo.positionsAttrDesc.offset, binaryInfo.positionsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.PositionKind, positionsData, false);\r\n }\r\n if (binaryInfo.normalsAttrDesc && binaryInfo.normalsAttrDesc.count > 0) {\r\n var normalsData = new Float32Array(parsedGeometry, binaryInfo.normalsAttrDesc.offset, binaryInfo.normalsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.NormalKind, normalsData, false);\r\n }\r\n if (binaryInfo.tangetsAttrDesc && binaryInfo.tangetsAttrDesc.count > 0) {\r\n var tangentsData = new Float32Array(parsedGeometry, binaryInfo.tangetsAttrDesc.offset, binaryInfo.tangetsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.TangentKind, tangentsData, false);\r\n }\r\n if (binaryInfo.uvsAttrDesc && binaryInfo.uvsAttrDesc.count > 0) {\r\n var uvsData = new Float32Array(parsedGeometry, binaryInfo.uvsAttrDesc.offset, binaryInfo.uvsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.UVKind, uvsData, false);\r\n }\r\n if (binaryInfo.uvs2AttrDesc && binaryInfo.uvs2AttrDesc.count > 0) {\r\n var uvs2Data = new Float32Array(parsedGeometry, binaryInfo.uvs2AttrDesc.offset, binaryInfo.uvs2AttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.UV2Kind, uvs2Data, false);\r\n }\r\n if (binaryInfo.uvs3AttrDesc && binaryInfo.uvs3AttrDesc.count > 0) {\r\n var uvs3Data = new Float32Array(parsedGeometry, binaryInfo.uvs3AttrDesc.offset, binaryInfo.uvs3AttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.UV3Kind, uvs3Data, false);\r\n }\r\n if (binaryInfo.uvs4AttrDesc && binaryInfo.uvs4AttrDesc.count > 0) {\r\n var uvs4Data = new Float32Array(parsedGeometry, binaryInfo.uvs4AttrDesc.offset, binaryInfo.uvs4AttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.UV4Kind, uvs4Data, false);\r\n }\r\n if (binaryInfo.uvs5AttrDesc && binaryInfo.uvs5AttrDesc.count > 0) {\r\n var uvs5Data = new Float32Array(parsedGeometry, binaryInfo.uvs5AttrDesc.offset, binaryInfo.uvs5AttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.UV5Kind, uvs5Data, false);\r\n }\r\n if (binaryInfo.uvs6AttrDesc && binaryInfo.uvs6AttrDesc.count > 0) {\r\n var uvs6Data = new Float32Array(parsedGeometry, binaryInfo.uvs6AttrDesc.offset, binaryInfo.uvs6AttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.UV6Kind, uvs6Data, false);\r\n }\r\n if (binaryInfo.colorsAttrDesc && binaryInfo.colorsAttrDesc.count > 0) {\r\n var colorsData = new Float32Array(parsedGeometry, binaryInfo.colorsAttrDesc.offset, binaryInfo.colorsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.ColorKind, colorsData, false, binaryInfo.colorsAttrDesc.stride);\r\n }\r\n if (binaryInfo.matricesIndicesAttrDesc && binaryInfo.matricesIndicesAttrDesc.count > 0) {\r\n var matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesAttrDesc.offset, binaryInfo.matricesIndicesAttrDesc.count);\r\n var floatIndices = [];\r\n for (var i = 0; i < matricesIndicesData.length; i++) {\r\n var index = matricesIndicesData[i];\r\n floatIndices.push(index & 0x000000ff);\r\n floatIndices.push((index & 0x0000ff00) >> 8);\r\n floatIndices.push((index & 0x00ff0000) >> 16);\r\n floatIndices.push((index >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, false);\r\n }\r\n if (binaryInfo.matricesIndicesExtraAttrDesc && binaryInfo.matricesIndicesExtraAttrDesc.count > 0) {\r\n var matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesExtraAttrDesc.offset, binaryInfo.matricesIndicesExtraAttrDesc.count);\r\n var floatIndices = [];\r\n for (var i = 0; i < matricesIndicesData.length; i++) {\r\n var index = matricesIndicesData[i];\r\n floatIndices.push(index & 0x000000ff);\r\n floatIndices.push((index & 0x0000ff00) >> 8);\r\n floatIndices.push((index & 0x00ff0000) >> 16);\r\n floatIndices.push((index >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, floatIndices, false);\r\n }\r\n if (binaryInfo.matricesWeightsAttrDesc && binaryInfo.matricesWeightsAttrDesc.count > 0) {\r\n var matricesWeightsData = new Float32Array(parsedGeometry, binaryInfo.matricesWeightsAttrDesc.offset, binaryInfo.matricesWeightsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeightsData, false);\r\n }\r\n if (binaryInfo.indicesAttrDesc && binaryInfo.indicesAttrDesc.count > 0) {\r\n var indicesData = new Int32Array(parsedGeometry, binaryInfo.indicesAttrDesc.offset, binaryInfo.indicesAttrDesc.count);\r\n mesh.setIndices(indicesData, null);\r\n }\r\n if (binaryInfo.subMeshesAttrDesc && binaryInfo.subMeshesAttrDesc.count > 0) {\r\n var subMeshesData = new Int32Array(parsedGeometry, binaryInfo.subMeshesAttrDesc.offset, binaryInfo.subMeshesAttrDesc.count * 5);\r\n mesh.subMeshes = [];\r\n for (var i = 0; i < binaryInfo.subMeshesAttrDesc.count; i++) {\r\n var materialIndex = subMeshesData[i * 5 + 0];\r\n var verticesStart = subMeshesData[i * 5 + 1];\r\n var verticesCount = subMeshesData[i * 5 + 2];\r\n var indexStart = subMeshesData[i * 5 + 3];\r\n var indexCount = subMeshesData[i * 5 + 4];\r\n SubMesh.AddToMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh);\r\n }\r\n }\r\n }\r\n else if (parsedGeometry.positions && parsedGeometry.normals && parsedGeometry.indices) {\r\n mesh.setVerticesData(VertexBuffer.PositionKind, parsedGeometry.positions, parsedGeometry.positions._updatable);\r\n mesh.setVerticesData(VertexBuffer.NormalKind, parsedGeometry.normals, parsedGeometry.normals._updatable);\r\n if (parsedGeometry.tangents) {\r\n mesh.setVerticesData(VertexBuffer.TangentKind, parsedGeometry.tangents, parsedGeometry.tangents._updatable);\r\n }\r\n if (parsedGeometry.uvs) {\r\n mesh.setVerticesData(VertexBuffer.UVKind, parsedGeometry.uvs, parsedGeometry.uvs._updatable);\r\n }\r\n if (parsedGeometry.uvs2) {\r\n mesh.setVerticesData(VertexBuffer.UV2Kind, parsedGeometry.uvs2, parsedGeometry.uvs2._updatable);\r\n }\r\n if (parsedGeometry.uvs3) {\r\n mesh.setVerticesData(VertexBuffer.UV3Kind, parsedGeometry.uvs3, parsedGeometry.uvs3._updatable);\r\n }\r\n if (parsedGeometry.uvs4) {\r\n mesh.setVerticesData(VertexBuffer.UV4Kind, parsedGeometry.uvs4, parsedGeometry.uvs4._updatable);\r\n }\r\n if (parsedGeometry.uvs5) {\r\n mesh.setVerticesData(VertexBuffer.UV5Kind, parsedGeometry.uvs5, parsedGeometry.uvs5._updatable);\r\n }\r\n if (parsedGeometry.uvs6) {\r\n mesh.setVerticesData(VertexBuffer.UV6Kind, parsedGeometry.uvs6, parsedGeometry.uvs6._updatable);\r\n }\r\n if (parsedGeometry.colors) {\r\n mesh.setVerticesData(VertexBuffer.ColorKind, Color4.CheckColors4(parsedGeometry.colors, parsedGeometry.positions.length / 3), parsedGeometry.colors._updatable);\r\n }\r\n if (parsedGeometry.matricesIndices) {\r\n if (!parsedGeometry.matricesIndices._isExpanded) {\r\n var floatIndices = [];\r\n for (var i = 0; i < parsedGeometry.matricesIndices.length; i++) {\r\n var matricesIndex = parsedGeometry.matricesIndices[i];\r\n floatIndices.push(matricesIndex & 0x000000ff);\r\n floatIndices.push((matricesIndex & 0x0000ff00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00ff0000) >> 16);\r\n floatIndices.push((matricesIndex >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, parsedGeometry.matricesIndices._updatable);\r\n }\r\n else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, parsedGeometry.matricesIndices, parsedGeometry.matricesIndices._updatable);\r\n }\r\n }\r\n if (parsedGeometry.matricesIndicesExtra) {\r\n if (!parsedGeometry.matricesIndicesExtra._isExpanded) {\r\n var floatIndices = [];\r\n for (var i = 0; i < parsedGeometry.matricesIndicesExtra.length; i++) {\r\n var matricesIndex = parsedGeometry.matricesIndicesExtra[i];\r\n floatIndices.push(matricesIndex & 0x000000ff);\r\n floatIndices.push((matricesIndex & 0x0000ff00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00ff0000) >> 16);\r\n floatIndices.push((matricesIndex >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, floatIndices, parsedGeometry.matricesIndicesExtra._updatable);\r\n }\r\n else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, parsedGeometry.matricesIndicesExtra, parsedGeometry.matricesIndicesExtra._updatable);\r\n }\r\n }\r\n if (parsedGeometry.matricesWeights) {\r\n Geometry._CleanMatricesWeights(parsedGeometry, mesh);\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, parsedGeometry.matricesWeights, parsedGeometry.matricesWeights._updatable);\r\n }\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsExtraKind, parsedGeometry.matricesWeightsExtra, parsedGeometry.matricesWeights._updatable);\r\n }\r\n mesh.setIndices(parsedGeometry.indices, null);\r\n }\r\n // SubMeshes\r\n if (parsedGeometry.subMeshes) {\r\n mesh.subMeshes = [];\r\n for (var subIndex = 0; subIndex < parsedGeometry.subMeshes.length; subIndex++) {\r\n var parsedSubMesh = parsedGeometry.subMeshes[subIndex];\r\n SubMesh.AddToMesh(parsedSubMesh.materialIndex, parsedSubMesh.verticesStart, parsedSubMesh.verticesCount, parsedSubMesh.indexStart, parsedSubMesh.indexCount, mesh);\r\n }\r\n }\r\n // Flat shading\r\n if (mesh._shouldGenerateFlatShading) {\r\n mesh.convertToFlatShadedMesh();\r\n mesh._shouldGenerateFlatShading = false;\r\n }\r\n // Update\r\n mesh.computeWorldMatrix(true);\r\n scene.onMeshImportedObservable.notifyObservers(mesh);\r\n };\r\n Geometry._CleanMatricesWeights = function (parsedGeometry, mesh) {\r\n var epsilon = 1e-3;\r\n if (!SceneLoaderFlags.CleanBoneMatrixWeights) {\r\n return;\r\n }\r\n var noInfluenceBoneIndex = 0.0;\r\n if (parsedGeometry.skeletonId > -1) {\r\n var skeleton = mesh.getScene().getLastSkeletonByID(parsedGeometry.skeletonId);\r\n if (!skeleton) {\r\n return;\r\n }\r\n noInfluenceBoneIndex = skeleton.bones.length;\r\n }\r\n else {\r\n return;\r\n }\r\n var matricesIndices = mesh.getVerticesData(VertexBuffer.MatricesIndicesKind);\r\n var matricesIndicesExtra = mesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind);\r\n var matricesWeights = parsedGeometry.matricesWeights;\r\n var matricesWeightsExtra = parsedGeometry.matricesWeightsExtra;\r\n var influencers = parsedGeometry.numBoneInfluencer;\r\n var size = matricesWeights.length;\r\n for (var i = 0; i < size; i += 4) {\r\n var weight = 0.0;\r\n var firstZeroWeight = -1;\r\n for (var j = 0; j < 4; j++) {\r\n var w = matricesWeights[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j;\r\n }\r\n }\r\n if (matricesWeightsExtra) {\r\n for (var j = 0; j < 4; j++) {\r\n var w = matricesWeightsExtra[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j + 4;\r\n }\r\n }\r\n }\r\n if (firstZeroWeight < 0 || firstZeroWeight > influencers - 1) {\r\n firstZeroWeight = influencers - 1;\r\n }\r\n if (weight > epsilon) {\r\n var mweight = 1.0 / weight;\r\n for (var j = 0; j < 4; j++) {\r\n matricesWeights[i + j] *= mweight;\r\n }\r\n if (matricesWeightsExtra) {\r\n for (var j = 0; j < 4; j++) {\r\n matricesWeightsExtra[i + j] *= mweight;\r\n }\r\n }\r\n }\r\n else {\r\n if (firstZeroWeight >= 4) {\r\n matricesWeightsExtra[i + firstZeroWeight - 4] = 1.0 - weight;\r\n matricesIndicesExtra[i + firstZeroWeight - 4] = noInfluenceBoneIndex;\r\n }\r\n else {\r\n matricesWeights[i + firstZeroWeight] = 1.0 - weight;\r\n matricesIndices[i + firstZeroWeight] = noInfluenceBoneIndex;\r\n }\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, matricesIndices);\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, matricesIndicesExtra);\r\n }\r\n };\r\n /**\r\n * Create a new geometry from persisted data (Using .babylon file format)\r\n * @param parsedVertexData defines the persisted data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url to use to load assets (like delayed data)\r\n * @returns the new geometry object\r\n */\r\n Geometry.Parse = function (parsedVertexData, scene, rootUrl) {\r\n if (scene.getGeometryByID(parsedVertexData.id)) {\r\n return null; // null since geometry could be something else than a box...\r\n }\r\n var geometry = new Geometry(parsedVertexData.id, scene, undefined, parsedVertexData.updatable);\r\n if (Tags) {\r\n Tags.AddTagsTo(geometry, parsedVertexData.tags);\r\n }\r\n if (parsedVertexData.delayLoadingFile) {\r\n geometry.delayLoadState = 4;\r\n geometry.delayLoadingFile = rootUrl + parsedVertexData.delayLoadingFile;\r\n geometry._boundingInfo = new BoundingInfo(Vector3.FromArray(parsedVertexData.boundingBoxMinimum), Vector3.FromArray(parsedVertexData.boundingBoxMaximum));\r\n geometry._delayInfo = [];\r\n if (parsedVertexData.hasUVs) {\r\n geometry._delayInfo.push(VertexBuffer.UVKind);\r\n }\r\n if (parsedVertexData.hasUVs2) {\r\n geometry._delayInfo.push(VertexBuffer.UV2Kind);\r\n }\r\n if (parsedVertexData.hasUVs3) {\r\n geometry._delayInfo.push(VertexBuffer.UV3Kind);\r\n }\r\n if (parsedVertexData.hasUVs4) {\r\n geometry._delayInfo.push(VertexBuffer.UV4Kind);\r\n }\r\n if (parsedVertexData.hasUVs5) {\r\n geometry._delayInfo.push(VertexBuffer.UV5Kind);\r\n }\r\n if (parsedVertexData.hasUVs6) {\r\n geometry._delayInfo.push(VertexBuffer.UV6Kind);\r\n }\r\n if (parsedVertexData.hasColors) {\r\n geometry._delayInfo.push(VertexBuffer.ColorKind);\r\n }\r\n if (parsedVertexData.hasMatricesIndices) {\r\n geometry._delayInfo.push(VertexBuffer.MatricesIndicesKind);\r\n }\r\n if (parsedVertexData.hasMatricesWeights) {\r\n geometry._delayInfo.push(VertexBuffer.MatricesWeightsKind);\r\n }\r\n geometry._delayLoadingFunction = VertexData.ImportVertexData;\r\n }\r\n else {\r\n VertexData.ImportVertexData(parsedVertexData, geometry);\r\n }\r\n scene.pushGeometry(geometry, true);\r\n return geometry;\r\n };\r\n return Geometry;\r\n}());\r\nexport { Geometry };\r\n//# sourceMappingURL=geometry.js.map","/**\r\n * Class used to represent a specific level of detail of a mesh\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n */\r\nvar MeshLODLevel = /** @class */ (function () {\r\n /**\r\n * Creates a new LOD level\r\n * @param distance defines the distance where this level should star being displayed\r\n * @param mesh defines the mesh to use to render this level\r\n */\r\n function MeshLODLevel(\r\n /** Defines the distance where this level should start being displayed */\r\n distance, \r\n /** Defines the mesh to use to render this level */\r\n mesh) {\r\n this.distance = distance;\r\n this.mesh = mesh;\r\n }\r\n return MeshLODLevel;\r\n}());\r\nexport { MeshLODLevel };\r\n//# sourceMappingURL=meshLODLevel.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Tools, AsyncLoop } from \"../Misc/tools\";\r\nimport { DeepCopier } from \"../Misc/deepCopier\";\r\nimport { Tags } from \"../Misc/tags\";\r\nimport { Quaternion, Matrix, Vector3, Vector2 } from \"../Maths/math.vector\";\r\nimport { Color3 } from '../Maths/math.color';\r\nimport { Node } from \"../node\";\r\nimport { VertexBuffer } from \"./buffer\";\r\nimport { VertexData } from \"./mesh.vertexData\";\r\nimport { Buffer } from \"./buffer\";\r\nimport { Geometry } from \"./geometry\";\r\nimport { AbstractMesh } from \"./abstractMesh\";\r\nimport { SubMesh } from \"./subMesh\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { Material } from \"../Materials/material\";\r\nimport { MultiMaterial } from \"../Materials/multiMaterial\";\r\nimport { SceneLoaderFlags } from \"../Loading/sceneLoaderFlags\";\r\nimport { SerializationHelper } from \"../Misc/decorators\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { _TypeStore } from '../Misc/typeStore';\r\nimport { _DevTools } from '../Misc/devTools';\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { MeshLODLevel } from './meshLODLevel';\r\nimport { CanvasGenerator } from '../Misc/canvasGenerator';\r\n/**\r\n * @hidden\r\n **/\r\nvar _CreationDataStorage = /** @class */ (function () {\r\n function _CreationDataStorage() {\r\n }\r\n return _CreationDataStorage;\r\n}());\r\nexport { _CreationDataStorage };\r\n/**\r\n * @hidden\r\n **/\r\nvar _InstanceDataStorage = /** @class */ (function () {\r\n function _InstanceDataStorage() {\r\n this.visibleInstances = {};\r\n this.batchCache = new _InstancesBatch();\r\n this.instancesBufferSize = 32 * 16 * 4; // let's start with a maximum of 32 instances\r\n }\r\n return _InstanceDataStorage;\r\n}());\r\n/**\r\n * @hidden\r\n **/\r\nvar _InstancesBatch = /** @class */ (function () {\r\n function _InstancesBatch() {\r\n this.mustReturn = false;\r\n this.visibleInstances = new Array();\r\n this.renderSelf = new Array();\r\n this.hardwareInstancedRendering = new Array();\r\n }\r\n return _InstancesBatch;\r\n}());\r\nexport { _InstancesBatch };\r\n/**\r\n * @hidden\r\n **/\r\nvar _ThinInstanceDataStorage = /** @class */ (function () {\r\n function _ThinInstanceDataStorage() {\r\n this.instancesCount = 0;\r\n this.matrixBuffer = null;\r\n this.matrixBufferSize = 32 * 16; // let's start with a maximum of 32 thin instances\r\n this.boundingVectors = [];\r\n this.worldMatrices = null;\r\n }\r\n return _ThinInstanceDataStorage;\r\n}());\r\n/**\r\n * @hidden\r\n **/\r\nvar _InternalMeshDataInfo = /** @class */ (function () {\r\n function _InternalMeshDataInfo() {\r\n this._areNormalsFrozen = false; // Will be used by ribbons mainly\r\n // Will be used to save a source mesh reference, If any\r\n this._source = null;\r\n // Will be used to for fast cloned mesh lookup\r\n this.meshMap = null;\r\n this._preActivateId = -1;\r\n this._LODLevels = new Array();\r\n // Morph\r\n this._morphTargetManager = null;\r\n }\r\n return _InternalMeshDataInfo;\r\n}());\r\n/**\r\n * Class used to represent renderable models\r\n */\r\nvar Mesh = /** @class */ (function (_super) {\r\n __extends(Mesh, _super);\r\n /**\r\n * @constructor\r\n * @param name The value used by scene.getMeshByName() to do a lookup.\r\n * @param scene The scene to add this mesh to.\r\n * @param parent The parent of this mesh, if it has one\r\n * @param source An optional Mesh from which geometry is shared, cloned.\r\n * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.\r\n * When false, achieved by calling a clone(), also passing False.\r\n * This will make creation of children, recursive.\r\n * @param clonePhysicsImpostor When cloning, include cloning mesh physics impostor, default True.\r\n */\r\n function Mesh(name, scene, parent, source, doNotCloneChildren, clonePhysicsImpostor) {\r\n if (scene === void 0) { scene = null; }\r\n if (parent === void 0) { parent = null; }\r\n if (source === void 0) { source = null; }\r\n if (clonePhysicsImpostor === void 0) { clonePhysicsImpostor = true; }\r\n var _this = _super.call(this, name, scene) || this;\r\n // Internal data\r\n _this._internalMeshDataInfo = new _InternalMeshDataInfo();\r\n // Members\r\n /**\r\n * Gets the delay loading state of the mesh (when delay loading is turned on)\r\n * @see https://doc.babylonjs.com/how_to/using_the_incremental_loading_system\r\n */\r\n _this.delayLoadState = 0;\r\n /**\r\n * Gets the list of instances created from this mesh\r\n * it is not supposed to be modified manually.\r\n * Note also that the order of the InstancedMesh wihin the array is not significant and might change.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_instances\r\n */\r\n _this.instances = new Array();\r\n // Private\r\n /** @hidden */\r\n _this._creationDataStorage = null;\r\n /** @hidden */\r\n _this._geometry = null;\r\n /** @hidden */\r\n _this._instanceDataStorage = new _InstanceDataStorage();\r\n /** @hidden */\r\n _this._thinInstanceDataStorage = new _ThinInstanceDataStorage();\r\n _this._effectiveMaterial = null;\r\n /** @hidden */\r\n _this._shouldGenerateFlatShading = false;\r\n // Use by builder only to know what orientation were the mesh build in.\r\n /** @hidden */\r\n _this._originalBuilderSideOrientation = Mesh.DEFAULTSIDE;\r\n /**\r\n * Use this property to change the original side orientation defined at construction time\r\n */\r\n _this.overrideMaterialSideOrientation = null;\r\n scene = _this.getScene();\r\n if (source) {\r\n // Geometry\r\n if (source._geometry) {\r\n source._geometry.applyToMesh(_this);\r\n }\r\n // Deep copy\r\n DeepCopier.DeepCopy(source, _this, [\r\n \"name\", \"material\", \"skeleton\", \"instances\", \"parent\", \"uniqueId\", \"source\", \"metadata\", \"morphTargetManager\",\r\n \"hasInstances\", \"source\", \"worldMatrixInstancedBuffer\", \"hasLODLevels\", \"geometry\", \"isBlocked\", \"areNormalsFrozen\",\r\n \"facetNb\", \"isFacetDataEnabled\", \"lightSources\", \"useBones\", \"isAnInstance\", \"collider\", \"edgesRenderer\", \"forward\",\r\n \"up\", \"right\", \"absolutePosition\", \"absoluteScaling\", \"absoluteRotationQuaternion\", \"isWorldMatrixFrozen\",\r\n \"nonUniformScaling\", \"behaviors\", \"worldMatrixFromCache\", \"hasThinInstances\", \"cloneMeshMap\"\r\n ], [\"_poseMatrix\"]);\r\n // Source mesh\r\n _this._internalMeshDataInfo._source = source;\r\n if (scene.useClonedMeshMap) {\r\n if (!source._internalMeshDataInfo.meshMap) {\r\n source._internalMeshDataInfo.meshMap = {};\r\n }\r\n source._internalMeshDataInfo.meshMap[_this.uniqueId] = _this;\r\n }\r\n // Construction Params\r\n // Clone parameters allowing mesh to be updated in case of parametric shapes.\r\n _this._originalBuilderSideOrientation = source._originalBuilderSideOrientation;\r\n _this._creationDataStorage = source._creationDataStorage;\r\n // Animation ranges\r\n if (source._ranges) {\r\n var ranges = source._ranges;\r\n for (var name in ranges) {\r\n if (!ranges.hasOwnProperty(name)) {\r\n continue;\r\n }\r\n if (!ranges[name]) {\r\n continue;\r\n }\r\n _this.createAnimationRange(name, ranges[name].from, ranges[name].to);\r\n }\r\n }\r\n // Metadata\r\n if (source.metadata && source.metadata.clone) {\r\n _this.metadata = source.metadata.clone();\r\n }\r\n else {\r\n _this.metadata = source.metadata;\r\n }\r\n // Tags\r\n if (Tags && Tags.HasTags(source)) {\r\n Tags.AddTagsTo(_this, Tags.GetTags(source, true));\r\n }\r\n // Enabled\r\n _this.setEnabled(source.isEnabled());\r\n // Parent\r\n _this.parent = source.parent;\r\n // Pivot\r\n _this.setPivotMatrix(source.getPivotMatrix());\r\n _this.id = name + \".\" + source.id;\r\n // Material\r\n _this.material = source.material;\r\n var index;\r\n if (!doNotCloneChildren) {\r\n // Children\r\n var directDescendants = source.getDescendants(true);\r\n for (var index_1 = 0; index_1 < directDescendants.length; index_1++) {\r\n var child = directDescendants[index_1];\r\n if (child.clone) {\r\n child.clone(name + \".\" + child.name, _this);\r\n }\r\n }\r\n }\r\n // Morphs\r\n if (source.morphTargetManager) {\r\n _this.morphTargetManager = source.morphTargetManager;\r\n }\r\n // Physics clone\r\n if (scene.getPhysicsEngine) {\r\n var physicsEngine = scene.getPhysicsEngine();\r\n if (clonePhysicsImpostor && physicsEngine) {\r\n var impostor = physicsEngine.getImpostorForPhysicsObject(source);\r\n if (impostor) {\r\n _this.physicsImpostor = impostor.clone(_this);\r\n }\r\n }\r\n }\r\n // Particles\r\n for (index = 0; index < scene.particleSystems.length; index++) {\r\n var system = scene.particleSystems[index];\r\n if (system.emitter === source) {\r\n system.clone(system.name, _this);\r\n }\r\n }\r\n _this.refreshBoundingInfo();\r\n _this.computeWorldMatrix(true);\r\n }\r\n // Parent\r\n if (parent !== null) {\r\n _this.parent = parent;\r\n }\r\n _this._instanceDataStorage.hardwareInstancedRendering = _this.getEngine().getCaps().instancedArrays;\r\n return _this;\r\n }\r\n /**\r\n * Gets the default side orientation.\r\n * @param orientation the orientation to value to attempt to get\r\n * @returns the default orientation\r\n * @hidden\r\n */\r\n Mesh._GetDefaultSideOrientation = function (orientation) {\r\n return orientation || Mesh.FRONTSIDE; // works as Mesh.FRONTSIDE is 0\r\n };\r\n Object.defineProperty(Mesh.prototype, \"computeBonesUsingShaders\", {\r\n get: function () {\r\n return this._internalAbstractMeshDataInfo._computeBonesUsingShaders;\r\n },\r\n set: function (value) {\r\n if (this._internalAbstractMeshDataInfo._computeBonesUsingShaders === value) {\r\n return;\r\n }\r\n if (value && this._internalMeshDataInfo._sourcePositions) {\r\n // switch from software to GPU computation: we need to reset the vertex and normal buffers that have been updated by the software process\r\n this.setVerticesData(VertexBuffer.PositionKind, this._internalMeshDataInfo._sourcePositions.slice(), true);\r\n if (this._internalMeshDataInfo._sourceNormals) {\r\n this.setVerticesData(VertexBuffer.NormalKind, this._internalMeshDataInfo._sourceNormals.slice(), true);\r\n }\r\n }\r\n this._internalAbstractMeshDataInfo._computeBonesUsingShaders = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onBeforeRenderObservable\", {\r\n /**\r\n * An event triggered before rendering the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onBeforeRenderObservable) {\r\n this._internalMeshDataInfo._onBeforeRenderObservable = new Observable();\r\n }\r\n return this._internalMeshDataInfo._onBeforeRenderObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onBeforeBindObservable\", {\r\n /**\r\n * An event triggered before binding the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onBeforeBindObservable) {\r\n this._internalMeshDataInfo._onBeforeBindObservable = new Observable();\r\n }\r\n return this._internalMeshDataInfo._onBeforeBindObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onAfterRenderObservable\", {\r\n /**\r\n * An event triggered after rendering the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onAfterRenderObservable) {\r\n this._internalMeshDataInfo._onAfterRenderObservable = new Observable();\r\n }\r\n return this._internalMeshDataInfo._onAfterRenderObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onBeforeDrawObservable\", {\r\n /**\r\n * An event triggered before drawing the mesh\r\n */\r\n get: function () {\r\n if (!this._internalMeshDataInfo._onBeforeDrawObservable) {\r\n this._internalMeshDataInfo._onBeforeDrawObservable = new Observable();\r\n }\r\n return this._internalMeshDataInfo._onBeforeDrawObservable;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"onBeforeDraw\", {\r\n /**\r\n * Sets a callback to call before drawing the mesh. It is recommended to use onBeforeDrawObservable instead\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeDrawObserver) {\r\n this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver);\r\n }\r\n this._onBeforeDrawObserver = this.onBeforeDrawObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"hasInstances\", {\r\n get: function () {\r\n return this.instances.length > 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"hasThinInstances\", {\r\n get: function () {\r\n var _a;\r\n return ((_a = this._thinInstanceDataStorage.instancesCount) !== null && _a !== void 0 ? _a : 0) > 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"morphTargetManager\", {\r\n /**\r\n * Gets or sets the morph target manager\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_morphtargets\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._morphTargetManager;\r\n },\r\n set: function (value) {\r\n if (this._internalMeshDataInfo._morphTargetManager === value) {\r\n return;\r\n }\r\n this._internalMeshDataInfo._morphTargetManager = value;\r\n this._syncGeometryWithMorphTargetManager();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"source\", {\r\n /**\r\n * Gets the source mesh (the one used to clone this one from)\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._source;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"cloneMeshMap\", {\r\n /**\r\n * Gets the list of clones of this mesh\r\n * The scene must have been constructed with useClonedMeshMap=true for this to work!\r\n * Note that useClonedMeshMap=true is the default setting\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo.meshMap;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"isUnIndexed\", {\r\n /**\r\n * Gets or sets a boolean indicating that this mesh does not use index buffer\r\n */\r\n get: function () {\r\n return this._unIndexed;\r\n },\r\n set: function (value) {\r\n if (this._unIndexed !== value) {\r\n this._unIndexed = value;\r\n this._markSubMeshesAsAttributesDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"worldMatrixInstancedBuffer\", {\r\n /** Gets the array buffer used to store the instanced buffer used for instances' world matrices */\r\n get: function () {\r\n return this._instanceDataStorage.instancesData;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Mesh.prototype, \"manualUpdateOfWorldMatrixInstancedBuffer\", {\r\n /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices is manual */\r\n get: function () {\r\n return this._instanceDataStorage.manualUpdate;\r\n },\r\n set: function (value) {\r\n this._instanceDataStorage.manualUpdate = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Methods\r\n Mesh.prototype.instantiateHierarchy = function (newParent, options, onNewNodeCreated) {\r\n if (newParent === void 0) { newParent = null; }\r\n var instance = (this.getTotalVertices() > 0 && (!options || !options.doNotInstantiate)) ? this.createInstance(\"instance of \" + (this.name || this.id)) : this.clone(\"Clone of \" + (this.name || this.id), newParent || this.parent, true);\r\n if (instance) {\r\n instance.parent = newParent || this.parent;\r\n instance.position = this.position.clone();\r\n instance.scaling = this.scaling.clone();\r\n if (this.rotationQuaternion) {\r\n instance.rotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n else {\r\n instance.rotation = this.rotation.clone();\r\n }\r\n if (onNewNodeCreated) {\r\n onNewNodeCreated(this, instance);\r\n }\r\n }\r\n for (var _i = 0, _a = this.getChildTransformNodes(true); _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child.instantiateHierarchy(instance, options, onNewNodeCreated);\r\n }\r\n return instance;\r\n };\r\n /**\r\n * Gets the class name\r\n * @returns the string \"Mesh\".\r\n */\r\n Mesh.prototype.getClassName = function () {\r\n return \"Mesh\";\r\n };\r\n Object.defineProperty(Mesh.prototype, \"_isMesh\", {\r\n /** @hidden */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a description of this mesh\r\n * @param fullDetails define if full details about this mesh must be used\r\n * @returns a descriptive string representing this mesh\r\n */\r\n Mesh.prototype.toString = function (fullDetails) {\r\n var ret = _super.prototype.toString.call(this, fullDetails);\r\n ret += \", n vertices: \" + this.getTotalVertices();\r\n ret += \", parent: \" + (this._waitingParentId ? this._waitingParentId : (this.parent ? this.parent.name : \"NONE\"));\r\n if (this.animations) {\r\n for (var i = 0; i < this.animations.length; i++) {\r\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\r\n }\r\n }\r\n if (fullDetails) {\r\n if (this._geometry) {\r\n var ib = this.getIndices();\r\n var vb = this.getVerticesData(VertexBuffer.PositionKind);\r\n if (vb && ib) {\r\n ret += \", flat shading: \" + (vb.length / 3 === ib.length ? \"YES\" : \"NO\");\r\n }\r\n }\r\n else {\r\n ret += \", flat shading: UNKNOWN\";\r\n }\r\n }\r\n return ret;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._unBindEffect = function () {\r\n _super.prototype._unBindEffect.call(this);\r\n for (var _i = 0, _a = this.instances; _i < _a.length; _i++) {\r\n var instance = _a[_i];\r\n instance._unBindEffect();\r\n }\r\n };\r\n Object.defineProperty(Mesh.prototype, \"hasLODLevels\", {\r\n /**\r\n * Gets a boolean indicating if this mesh has LOD\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._LODLevels.length > 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the list of MeshLODLevel associated with the current mesh\r\n * @returns an array of MeshLODLevel\r\n */\r\n Mesh.prototype.getLODLevels = function () {\r\n return this._internalMeshDataInfo._LODLevels;\r\n };\r\n Mesh.prototype._sortLODLevels = function () {\r\n this._internalMeshDataInfo._LODLevels.sort(function (a, b) {\r\n if (a.distance < b.distance) {\r\n return 1;\r\n }\r\n if (a.distance > b.distance) {\r\n return -1;\r\n }\r\n return 0;\r\n });\r\n };\r\n /**\r\n * Add a mesh as LOD level triggered at the given distance.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param distance The distance from the center of the object to show this level\r\n * @param mesh The mesh to be added as LOD level (can be null)\r\n * @return This mesh (for chaining)\r\n */\r\n Mesh.prototype.addLODLevel = function (distance, mesh) {\r\n if (mesh && mesh._masterMesh) {\r\n Logger.Warn(\"You cannot use a mesh as LOD level twice\");\r\n return this;\r\n }\r\n var level = new MeshLODLevel(distance, mesh);\r\n this._internalMeshDataInfo._LODLevels.push(level);\r\n if (mesh) {\r\n mesh._masterMesh = this;\r\n }\r\n this._sortLODLevels();\r\n return this;\r\n };\r\n /**\r\n * Returns the LOD level mesh at the passed distance or null if not found.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param distance The distance from the center of the object to show this level\r\n * @returns a Mesh or `null`\r\n */\r\n Mesh.prototype.getLODLevelAtDistance = function (distance) {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n for (var index = 0; index < internalDataInfo._LODLevels.length; index++) {\r\n var level = internalDataInfo._LODLevels[index];\r\n if (level.distance === distance) {\r\n return level.mesh;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Remove a mesh from the LOD array\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param mesh defines the mesh to be removed\r\n * @return This mesh (for chaining)\r\n */\r\n Mesh.prototype.removeLODLevel = function (mesh) {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n for (var index = 0; index < internalDataInfo._LODLevels.length; index++) {\r\n if (internalDataInfo._LODLevels[index].mesh === mesh) {\r\n internalDataInfo._LODLevels.splice(index, 1);\r\n if (mesh) {\r\n mesh._masterMesh = null;\r\n }\r\n }\r\n }\r\n this._sortLODLevels();\r\n return this;\r\n };\r\n /**\r\n * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_lod\r\n * @param camera defines the camera to use to compute distance\r\n * @param boundingSphere defines a custom bounding sphere to use instead of the one from this mesh\r\n * @return This mesh (for chaining)\r\n */\r\n Mesh.prototype.getLOD = function (camera, boundingSphere) {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._LODLevels || internalDataInfo._LODLevels.length === 0) {\r\n return this;\r\n }\r\n var bSphere;\r\n if (boundingSphere) {\r\n bSphere = boundingSphere;\r\n }\r\n else {\r\n var boundingInfo = this.getBoundingInfo();\r\n bSphere = boundingInfo.boundingSphere;\r\n }\r\n var distanceToCamera = bSphere.centerWorld.subtract(camera.globalPosition).length();\r\n if (internalDataInfo._LODLevels[internalDataInfo._LODLevels.length - 1].distance > distanceToCamera) {\r\n if (this.onLODLevelSelection) {\r\n this.onLODLevelSelection(distanceToCamera, this, this);\r\n }\r\n return this;\r\n }\r\n for (var index = 0; index < internalDataInfo._LODLevels.length; index++) {\r\n var level = internalDataInfo._LODLevels[index];\r\n if (level.distance < distanceToCamera) {\r\n if (level.mesh) {\r\n if (level.mesh.delayLoadState === 4) {\r\n level.mesh._checkDelayState();\r\n return this;\r\n }\r\n if (level.mesh.delayLoadState === 2) {\r\n return this;\r\n }\r\n level.mesh._preActivate();\r\n level.mesh._updateSubMeshesBoundingInfo(this.worldMatrixFromCache);\r\n }\r\n if (this.onLODLevelSelection) {\r\n this.onLODLevelSelection(distanceToCamera, this, level.mesh);\r\n }\r\n return level.mesh;\r\n }\r\n }\r\n if (this.onLODLevelSelection) {\r\n this.onLODLevelSelection(distanceToCamera, this, this);\r\n }\r\n return this;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"geometry\", {\r\n /**\r\n * Gets the mesh internal Geometry object\r\n */\r\n get: function () {\r\n return this._geometry;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the total number of vertices within the mesh geometry or zero if the mesh has no geometry.\r\n * @returns the total number of vertices\r\n */\r\n Mesh.prototype.getTotalVertices = function () {\r\n if (this._geometry === null || this._geometry === undefined) {\r\n return 0;\r\n }\r\n return this._geometry.getTotalVertices();\r\n };\r\n /**\r\n * Returns the content of an associated vertex buffer\r\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param copyWhenShared defines a boolean indicating that if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one\r\n * @param forceCopy defines a boolean forcing the copy of the buffer no matter what the value of copyWhenShared is\r\n * @returns a FloatArray or null if the mesh has no geometry or no vertex buffer for this kind.\r\n */\r\n Mesh.prototype.getVerticesData = function (kind, copyWhenShared, forceCopy) {\r\n if (!this._geometry) {\r\n return null;\r\n }\r\n return this._geometry.getVerticesData(kind, copyWhenShared, forceCopy);\r\n };\r\n /**\r\n * Returns the mesh VertexBuffer object from the requested `kind`\r\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.NormalKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns a FloatArray or null if the mesh has no vertex buffer for this kind.\r\n */\r\n Mesh.prototype.getVertexBuffer = function (kind) {\r\n if (!this._geometry) {\r\n return null;\r\n }\r\n return this._geometry.getVertexBuffer(kind);\r\n };\r\n /**\r\n * Tests if a specific vertex buffer is associated with this mesh\r\n * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.NormalKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns a boolean\r\n */\r\n Mesh.prototype.isVerticesDataPresent = function (kind) {\r\n if (!this._geometry) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._geometry.isVerticesDataPresent(kind);\r\n };\r\n /**\r\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable.\r\n * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns a boolean\r\n */\r\n Mesh.prototype.isVertexBufferUpdatable = function (kind) {\r\n if (!this._geometry) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._geometry.isVertexBufferUpdatable(kind);\r\n };\r\n /**\r\n * Returns a string which contains the list of existing `kinds` of Vertex Data associated with this mesh.\r\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.NormalKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @returns an array of strings\r\n */\r\n Mesh.prototype.getVerticesDataKinds = function () {\r\n if (!this._geometry) {\r\n var result = new Array();\r\n if (this._delayInfo) {\r\n this._delayInfo.forEach(function (kind) {\r\n result.push(kind);\r\n });\r\n }\r\n return result;\r\n }\r\n return this._geometry.getVerticesDataKinds();\r\n };\r\n /**\r\n * Returns a positive integer : the total number of indices in this mesh geometry.\r\n * @returns the numner of indices or zero if the mesh has no geometry.\r\n */\r\n Mesh.prototype.getTotalIndices = function () {\r\n if (!this._geometry) {\r\n return 0;\r\n }\r\n return this._geometry.getTotalIndices();\r\n };\r\n /**\r\n * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.\r\n * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns the indices array or an empty array if the mesh has no geometry\r\n */\r\n Mesh.prototype.getIndices = function (copyWhenShared, forceCopy) {\r\n if (!this._geometry) {\r\n return [];\r\n }\r\n return this._geometry.getIndices(copyWhenShared, forceCopy);\r\n };\r\n Object.defineProperty(Mesh.prototype, \"isBlocked\", {\r\n get: function () {\r\n return this._masterMesh !== null && this._masterMesh !== undefined;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Determine if the current mesh is ready to be rendered\r\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\r\n * @param forceInstanceSupport will check if the mesh will be ready when used with instances (false by default)\r\n * @returns true if all associated assets are ready (material, textures, shaders)\r\n */\r\n Mesh.prototype.isReady = function (completeCheck, forceInstanceSupport) {\r\n var _a, _b, _c, _d, _e, _f;\r\n if (completeCheck === void 0) { completeCheck = false; }\r\n if (forceInstanceSupport === void 0) { forceInstanceSupport = false; }\r\n if (this.delayLoadState === 2) {\r\n return false;\r\n }\r\n if (!_super.prototype.isReady.call(this, completeCheck)) {\r\n return false;\r\n }\r\n if (!this.subMeshes || this.subMeshes.length === 0) {\r\n return true;\r\n }\r\n if (!completeCheck) {\r\n return true;\r\n }\r\n var engine = this.getEngine();\r\n var scene = this.getScene();\r\n var hardwareInstancedRendering = forceInstanceSupport || engine.getCaps().instancedArrays && (this.instances.length > 0 || this.hasThinInstances);\r\n this.computeWorldMatrix();\r\n var mat = this.material || scene.defaultMaterial;\r\n if (mat) {\r\n if (mat._storeEffectOnSubMeshes) {\r\n for (var _i = 0, _g = this.subMeshes; _i < _g.length; _i++) {\r\n var subMesh = _g[_i];\r\n var effectiveMaterial = subMesh.getMaterial();\r\n if (effectiveMaterial) {\r\n if (effectiveMaterial._storeEffectOnSubMeshes) {\r\n if (!effectiveMaterial.isReadyForSubMesh(this, subMesh, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n else {\r\n if (!effectiveMaterial.isReady(this, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (!mat.isReady(this, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n // Shadows\r\n for (var _h = 0, _j = this.lightSources; _h < _j.length; _h++) {\r\n var light = _j[_h];\r\n var generator = light.getShadowGenerator();\r\n if (generator && (!((_a = generator.getShadowMap()) === null || _a === void 0 ? void 0 : _a.renderList) || ((_b = generator.getShadowMap()) === null || _b === void 0 ? void 0 : _b.renderList) && ((_d = (_c = generator.getShadowMap()) === null || _c === void 0 ? void 0 : _c.renderList) === null || _d === void 0 ? void 0 : _d.indexOf(this)) !== -1)) {\r\n for (var _k = 0, _l = this.subMeshes; _k < _l.length; _k++) {\r\n var subMesh = _l[_k];\r\n if (!generator.isReady(subMesh, hardwareInstancedRendering, (_f = (_e = subMesh.getMaterial()) === null || _e === void 0 ? void 0 : _e.needAlphaBlendingForMesh(this)) !== null && _f !== void 0 ? _f : false)) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n // LOD\r\n for (var _m = 0, _o = this._internalMeshDataInfo._LODLevels; _m < _o.length; _m++) {\r\n var lod = _o[_m];\r\n if (lod.mesh && !lod.mesh.isReady(hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"areNormalsFrozen\", {\r\n /**\r\n * Gets a boolean indicating if the normals aren't to be recomputed on next mesh `positions` array update. This property is pertinent only for updatable parametric shapes.\r\n */\r\n get: function () {\r\n return this._internalMeshDataInfo._areNormalsFrozen;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It prevents the mesh normals from being recomputed on next `positions` array update.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.freezeNormals = function () {\r\n this._internalMeshDataInfo._areNormalsFrozen = true;\r\n return this;\r\n };\r\n /**\r\n * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It reactivates the mesh normals computation if it was previously frozen\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.unfreezeNormals = function () {\r\n this._internalMeshDataInfo._areNormalsFrozen = false;\r\n return this;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"overridenInstanceCount\", {\r\n /**\r\n * Sets a value overriding the instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs\r\n */\r\n set: function (count) {\r\n this._instanceDataStorage.overridenInstanceCount = count;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Methods\r\n /** @hidden */\r\n Mesh.prototype._preActivate = function () {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n var sceneRenderId = this.getScene().getRenderId();\r\n if (internalDataInfo._preActivateId === sceneRenderId) {\r\n return this;\r\n }\r\n internalDataInfo._preActivateId = sceneRenderId;\r\n this._instanceDataStorage.visibleInstances = null;\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._preActivateForIntermediateRendering = function (renderId) {\r\n if (this._instanceDataStorage.visibleInstances) {\r\n this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId = renderId;\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._registerInstanceForRenderId = function (instance, renderId) {\r\n if (!this._instanceDataStorage.visibleInstances) {\r\n this._instanceDataStorage.visibleInstances = {\r\n defaultRenderId: renderId,\r\n selfDefaultRenderId: this._renderId\r\n };\r\n }\r\n if (!this._instanceDataStorage.visibleInstances[renderId]) {\r\n if (this._instanceDataStorage.previousRenderId !== undefined && this._instanceDataStorage.isFrozen) {\r\n this._instanceDataStorage.visibleInstances[this._instanceDataStorage.previousRenderId] = null;\r\n }\r\n this._instanceDataStorage.previousRenderId = renderId;\r\n this._instanceDataStorage.visibleInstances[renderId] = new Array();\r\n }\r\n this._instanceDataStorage.visibleInstances[renderId].push(instance);\r\n return this;\r\n };\r\n Mesh.prototype._afterComputeWorldMatrix = function () {\r\n _super.prototype._afterComputeWorldMatrix.call(this);\r\n if (!this.hasThinInstances) {\r\n return;\r\n }\r\n if (!this.doNotSyncBoundingInfo) {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n }\r\n };\r\n /** @hidden */\r\n Mesh.prototype._postActivate = function () {\r\n if (this.edgesShareWithInstances && this.edgesRenderer && this.edgesRenderer.isEnabled && this._renderingGroup) {\r\n this._renderingGroup._edgesRenderers.pushNoDuplicate(this.edgesRenderer);\r\n this.edgesRenderer.customInstances.push(this.getWorldMatrix());\r\n }\r\n };\r\n /**\r\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\r\n * This means the mesh underlying bounding box and sphere are recomputed.\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.refreshBoundingInfo = function (applySkeleton) {\r\n if (applySkeleton === void 0) { applySkeleton = false; }\r\n if (this._boundingInfo && this._boundingInfo.isLocked) {\r\n return this;\r\n }\r\n var bias = this.geometry ? this.geometry.boundingBias : null;\r\n this._refreshBoundingInfo(this._getPositionData(applySkeleton), bias);\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._createGlobalSubMesh = function (force) {\r\n var totalVertices = this.getTotalVertices();\r\n if (!totalVertices || !this.getIndices()) {\r\n return null;\r\n }\r\n // Check if we need to recreate the submeshes\r\n if (this.subMeshes && this.subMeshes.length > 0) {\r\n var ib = this.getIndices();\r\n if (!ib) {\r\n return null;\r\n }\r\n var totalIndices = ib.length;\r\n var needToRecreate = false;\r\n if (force) {\r\n needToRecreate = true;\r\n }\r\n else {\r\n for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {\r\n var submesh = _a[_i];\r\n if (submesh.indexStart + submesh.indexCount > totalIndices) {\r\n needToRecreate = true;\r\n break;\r\n }\r\n if (submesh.verticesStart + submesh.verticesCount > totalVertices) {\r\n needToRecreate = true;\r\n break;\r\n }\r\n }\r\n }\r\n if (!needToRecreate) {\r\n return this.subMeshes[0];\r\n }\r\n }\r\n this.releaseSubMeshes();\r\n return new SubMesh(0, 0, totalVertices, 0, this.getTotalIndices(), this);\r\n };\r\n /**\r\n * This function will subdivide the mesh into multiple submeshes\r\n * @param count defines the expected number of submeshes\r\n */\r\n Mesh.prototype.subdivide = function (count) {\r\n if (count < 1) {\r\n return;\r\n }\r\n var totalIndices = this.getTotalIndices();\r\n var subdivisionSize = (totalIndices / count) | 0;\r\n var offset = 0;\r\n // Ensure that subdivisionSize is a multiple of 3\r\n while (subdivisionSize % 3 !== 0) {\r\n subdivisionSize++;\r\n }\r\n this.releaseSubMeshes();\r\n for (var index = 0; index < count; index++) {\r\n if (offset >= totalIndices) {\r\n break;\r\n }\r\n SubMesh.CreateFromIndices(0, offset, index === count - 1 ? totalIndices - offset : subdivisionSize, this);\r\n offset += subdivisionSize;\r\n }\r\n this.synchronizeInstances();\r\n };\r\n /**\r\n * Copy a FloatArray into a specific associated vertex buffer\r\n * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updatable defines if the updated vertex buffer must be flagged as updatable\r\n * @param stride defines the data stride size (can be null)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setVerticesData = function (kind, data, updatable, stride) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (!this._geometry) {\r\n var vertexData = new VertexData();\r\n vertexData.set(data, kind);\r\n var scene = this.getScene();\r\n new Geometry(Geometry.RandomId(), scene, vertexData, updatable, this);\r\n }\r\n else {\r\n this._geometry.setVerticesData(kind, data, updatable, stride);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Delete a vertex buffer associated with this mesh\r\n * @param kind defines which buffer to delete (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n */\r\n Mesh.prototype.removeVerticesData = function (kind) {\r\n if (!this._geometry) {\r\n return;\r\n }\r\n this._geometry.removeVerticesData(kind);\r\n };\r\n /**\r\n * Flags an associated vertex buffer as updatable\r\n * @param kind defines which buffer to use (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param updatable defines if the updated vertex buffer must be flagged as updatable\r\n */\r\n Mesh.prototype.markVerticesDataAsUpdatable = function (kind, updatable) {\r\n if (updatable === void 0) { updatable = true; }\r\n var vb = this.getVertexBuffer(kind);\r\n if (!vb || vb.isUpdatable() === updatable) {\r\n return;\r\n }\r\n this.setVerticesData(kind, this.getVerticesData(kind), updatable);\r\n };\r\n /**\r\n * Sets the mesh global Vertex Buffer\r\n * @param buffer defines the buffer to use\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setVerticesBuffer = function (buffer) {\r\n if (!this._geometry) {\r\n this._geometry = Geometry.CreateGeometryForMesh(this);\r\n }\r\n this._geometry.setVerticesBuffer(buffer);\r\n return this;\r\n };\r\n /**\r\n * Update a specific associated vertex buffer\r\n * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :\r\n * - VertexBuffer.PositionKind\r\n * - VertexBuffer.UVKind\r\n * - VertexBuffer.UV2Kind\r\n * - VertexBuffer.UV3Kind\r\n * - VertexBuffer.UV4Kind\r\n * - VertexBuffer.UV5Kind\r\n * - VertexBuffer.UV6Kind\r\n * - VertexBuffer.ColorKind\r\n * - VertexBuffer.MatricesIndicesKind\r\n * - VertexBuffer.MatricesIndicesExtraKind\r\n * - VertexBuffer.MatricesWeightsKind\r\n * - VertexBuffer.MatricesWeightsExtraKind\r\n * @param data defines the data source\r\n * @param updateExtends defines if extends info of the mesh must be updated (can be null). This is mostly useful for \"position\" kind\r\n * @param makeItUnique defines if the geometry associated with the mesh must be cloned to make the change only for this mesh (and not all meshes associated with the same geometry)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.updateVerticesData = function (kind, data, updateExtends, makeItUnique) {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n if (!makeItUnique) {\r\n this._geometry.updateVerticesData(kind, data, updateExtends);\r\n }\r\n else {\r\n this.makeGeometryUnique();\r\n this.updateVerticesData(kind, data, updateExtends, false);\r\n }\r\n return this;\r\n };\r\n /**\r\n * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.\r\n * @see https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#other-shapes-updatemeshpositions\r\n * @param positionFunction is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything\r\n * @param computeNormals is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.updateMeshPositions = function (positionFunction, computeNormals) {\r\n if (computeNormals === void 0) { computeNormals = true; }\r\n var positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n if (!positions) {\r\n return this;\r\n }\r\n positionFunction(positions);\r\n this.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\r\n if (computeNormals) {\r\n var indices = this.getIndices();\r\n var normals = this.getVerticesData(VertexBuffer.NormalKind);\r\n if (!normals) {\r\n return this;\r\n }\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n this.updateVerticesData(VertexBuffer.NormalKind, normals, false, false);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Creates a un-shared specific occurence of the geometry for the mesh.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.makeGeometryUnique = function () {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n if (this._geometry.meshes.length === 1) {\r\n return this;\r\n }\r\n var oldGeometry = this._geometry;\r\n var geometry = this._geometry.copy(Geometry.RandomId());\r\n oldGeometry.releaseForMesh(this, true);\r\n geometry.applyToMesh(this);\r\n return this;\r\n };\r\n /**\r\n * Set the index buffer of this mesh\r\n * @param indices defines the source data\r\n * @param totalVertices defines the total number of vertices referenced by this index data (can be null)\r\n * @param updatable defines if the updated index buffer must be flagged as updatable (default is false)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setIndices = function (indices, totalVertices, updatable) {\r\n if (totalVertices === void 0) { totalVertices = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (!this._geometry) {\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n var scene = this.getScene();\r\n new Geometry(Geometry.RandomId(), scene, vertexData, updatable, this);\r\n }\r\n else {\r\n this._geometry.setIndices(indices, totalVertices, updatable);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Update the current index buffer\r\n * @param indices defines the source data\r\n * @param offset defines the offset in the index buffer where to store the new data (can be null)\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.updateIndices = function (indices, offset, gpuMemoryOnly) {\r\n if (gpuMemoryOnly === void 0) { gpuMemoryOnly = false; }\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n this._geometry.updateIndices(indices, offset, gpuMemoryOnly);\r\n return this;\r\n };\r\n /**\r\n * Invert the geometry to move from a right handed system to a left handed one.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.toLeftHanded = function () {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n this._geometry.toLeftHanded();\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._bind = function (subMesh, effect, fillMode) {\r\n if (!this._geometry) {\r\n return this;\r\n }\r\n var engine = this.getScene().getEngine();\r\n // Wireframe\r\n var indexToBind;\r\n if (this._unIndexed) {\r\n indexToBind = null;\r\n }\r\n else {\r\n switch (fillMode) {\r\n case Material.PointFillMode:\r\n indexToBind = null;\r\n break;\r\n case Material.WireFrameFillMode:\r\n indexToBind = subMesh._getLinesIndexBuffer(this.getIndices(), engine);\r\n break;\r\n default:\r\n case Material.TriangleFillMode:\r\n indexToBind = this._geometry.getIndexBuffer();\r\n break;\r\n }\r\n }\r\n // VBOs\r\n this._geometry._bind(effect, indexToBind);\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._draw = function (subMesh, fillMode, instancesCount) {\r\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\r\n return this;\r\n }\r\n if (this._internalMeshDataInfo._onBeforeDrawObservable) {\r\n this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);\r\n }\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (this._unIndexed || fillMode == Material.PointFillMode) {\r\n // or triangles as points\r\n engine.drawArraysType(fillMode, subMesh.verticesStart, subMesh.verticesCount, instancesCount);\r\n }\r\n else if (fillMode == Material.WireFrameFillMode) {\r\n // Triangles as wireframe\r\n engine.drawElementsType(fillMode, 0, subMesh._linesIndexCount, instancesCount);\r\n }\r\n else {\r\n engine.drawElementsType(fillMode, subMesh.indexStart, subMesh.indexCount, instancesCount);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Registers for this mesh a javascript function called just before the rendering process\r\n * @param func defines the function to call before rendering this mesh\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.registerBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.add(func);\r\n return this;\r\n };\r\n /**\r\n * Disposes a previously registered javascript function called before the rendering\r\n * @param func defines the function to remove\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.unregisterBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.removeCallback(func);\r\n return this;\r\n };\r\n /**\r\n * Registers for this mesh a javascript function called just after the rendering is complete\r\n * @param func defines the function to call after rendering this mesh\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.registerAfterRender = function (func) {\r\n this.onAfterRenderObservable.add(func);\r\n return this;\r\n };\r\n /**\r\n * Disposes a previously registered javascript function called after the rendering.\r\n * @param func defines the function to remove\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.unregisterAfterRender = function (func) {\r\n this.onAfterRenderObservable.removeCallback(func);\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._getInstancesRenderList = function (subMeshId, isReplacementMode) {\r\n if (isReplacementMode === void 0) { isReplacementMode = false; }\r\n if (this._instanceDataStorage.isFrozen && this._instanceDataStorage.previousBatch) {\r\n return this._instanceDataStorage.previousBatch;\r\n }\r\n var scene = this.getScene();\r\n var isInIntermediateRendering = scene._isInIntermediateRendering();\r\n var onlyForInstances = isInIntermediateRendering ? this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate : this._internalAbstractMeshDataInfo._onlyForInstances;\r\n var batchCache = this._instanceDataStorage.batchCache;\r\n batchCache.mustReturn = false;\r\n batchCache.renderSelf[subMeshId] = isReplacementMode || (!onlyForInstances && this.isEnabled() && this.isVisible);\r\n batchCache.visibleInstances[subMeshId] = null;\r\n if (this._instanceDataStorage.visibleInstances && !isReplacementMode) {\r\n var visibleInstances = this._instanceDataStorage.visibleInstances;\r\n var currentRenderId = scene.getRenderId();\r\n var defaultRenderId = (isInIntermediateRendering ? visibleInstances.intermediateDefaultRenderId : visibleInstances.defaultRenderId);\r\n batchCache.visibleInstances[subMeshId] = visibleInstances[currentRenderId];\r\n if (!batchCache.visibleInstances[subMeshId] && defaultRenderId) {\r\n batchCache.visibleInstances[subMeshId] = visibleInstances[defaultRenderId];\r\n }\r\n }\r\n batchCache.hardwareInstancedRendering[subMeshId] =\r\n !isReplacementMode &&\r\n this._instanceDataStorage.hardwareInstancedRendering\r\n && (batchCache.visibleInstances[subMeshId] !== null)\r\n && (batchCache.visibleInstances[subMeshId] !== undefined);\r\n this._instanceDataStorage.previousBatch = batchCache;\r\n return batchCache;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._renderWithInstances = function (subMesh, fillMode, batch, effect, engine) {\r\n var visibleInstances = batch.visibleInstances[subMesh._id];\r\n if (!visibleInstances) {\r\n return this;\r\n }\r\n var instanceStorage = this._instanceDataStorage;\r\n var currentInstancesBufferSize = instanceStorage.instancesBufferSize;\r\n var instancesBuffer = instanceStorage.instancesBuffer;\r\n var matricesCount = visibleInstances.length + 1;\r\n var bufferSize = matricesCount * 16 * 4;\r\n while (instanceStorage.instancesBufferSize < bufferSize) {\r\n instanceStorage.instancesBufferSize *= 2;\r\n }\r\n if (!instanceStorage.instancesData || currentInstancesBufferSize != instanceStorage.instancesBufferSize) {\r\n instanceStorage.instancesData = new Float32Array(instanceStorage.instancesBufferSize / 4);\r\n }\r\n var offset = 0;\r\n var instancesCount = 0;\r\n var renderSelf = batch.renderSelf[subMesh._id];\r\n var needUpdateBuffer = !instancesBuffer || currentInstancesBufferSize !== instanceStorage.instancesBufferSize;\r\n if (!this._instanceDataStorage.manualUpdate && (!instanceStorage.isFrozen || needUpdateBuffer)) {\r\n var world = this._effectiveMesh.getWorldMatrix();\r\n if (renderSelf) {\r\n world.copyToArray(instanceStorage.instancesData, offset);\r\n offset += 16;\r\n instancesCount++;\r\n }\r\n if (visibleInstances) {\r\n for (var instanceIndex = 0; instanceIndex < visibleInstances.length; instanceIndex++) {\r\n var instance = visibleInstances[instanceIndex];\r\n instance.getWorldMatrix().copyToArray(instanceStorage.instancesData, offset);\r\n offset += 16;\r\n instancesCount++;\r\n }\r\n }\r\n }\r\n else {\r\n instancesCount = (renderSelf ? 1 : 0) + visibleInstances.length;\r\n }\r\n if (needUpdateBuffer) {\r\n if (instancesBuffer) {\r\n instancesBuffer.dispose();\r\n }\r\n instancesBuffer = new Buffer(engine, instanceStorage.instancesData, true, 16, false, true);\r\n instanceStorage.instancesBuffer = instancesBuffer;\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world0\", 0, 4));\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world1\", 4, 4));\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world2\", 8, 4));\r\n this.setVerticesBuffer(instancesBuffer.createVertexBuffer(\"world3\", 12, 4));\r\n }\r\n else {\r\n if (!this._instanceDataStorage.isFrozen) {\r\n instancesBuffer.updateDirectly(instanceStorage.instancesData, 0, instancesCount);\r\n }\r\n }\r\n this._processInstancedBuffers(visibleInstances, renderSelf);\r\n // Stats\r\n this.getScene()._activeIndices.addCount(subMesh.indexCount * instancesCount, false);\r\n // Draw\r\n this._bind(subMesh, effect, fillMode);\r\n this._draw(subMesh, fillMode, instancesCount);\r\n engine.unbindInstanceAttributes();\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._renderWithThinInstances = function (subMesh, fillMode, effect, engine) {\r\n var _a, _b;\r\n // Stats\r\n var instancesCount = (_b = (_a = this._thinInstanceDataStorage) === null || _a === void 0 ? void 0 : _a.instancesCount) !== null && _b !== void 0 ? _b : 0;\r\n this.getScene()._activeIndices.addCount(subMesh.indexCount * instancesCount, false);\r\n // Draw\r\n this._bind(subMesh, effect, fillMode);\r\n this._draw(subMesh, fillMode, instancesCount);\r\n engine.unbindInstanceAttributes();\r\n };\r\n /** @hidden */\r\n Mesh.prototype._processInstancedBuffers = function (visibleInstances, renderSelf) {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n Mesh.prototype._processRendering = function (renderingMesh, subMesh, effect, fillMode, batch, hardwareInstancedRendering, onBeforeDraw, effectiveMaterial) {\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (hardwareInstancedRendering && subMesh.getRenderingMesh().hasThinInstances) {\r\n this._renderWithThinInstances(subMesh, fillMode, effect, engine);\r\n return this;\r\n }\r\n if (hardwareInstancedRendering) {\r\n this._renderWithInstances(subMesh, fillMode, batch, effect, engine);\r\n }\r\n else {\r\n var instanceCount = 0;\r\n if (batch.renderSelf[subMesh._id]) {\r\n // Draw\r\n if (onBeforeDraw) {\r\n onBeforeDraw(false, renderingMesh._effectiveMesh.getWorldMatrix(), effectiveMaterial);\r\n }\r\n instanceCount++;\r\n this._draw(subMesh, fillMode, this._instanceDataStorage.overridenInstanceCount);\r\n }\r\n var visibleInstancesForSubMesh = batch.visibleInstances[subMesh._id];\r\n if (visibleInstancesForSubMesh) {\r\n var visibleInstanceCount = visibleInstancesForSubMesh.length;\r\n instanceCount += visibleInstanceCount;\r\n // Stats\r\n for (var instanceIndex = 0; instanceIndex < visibleInstanceCount; instanceIndex++) {\r\n var instance = visibleInstancesForSubMesh[instanceIndex];\r\n // World\r\n var world = instance.getWorldMatrix();\r\n if (onBeforeDraw) {\r\n onBeforeDraw(true, world, effectiveMaterial);\r\n }\r\n // Draw\r\n this._draw(subMesh, fillMode);\r\n }\r\n }\r\n // Stats\r\n scene._activeIndices.addCount(subMesh.indexCount * instanceCount, false);\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._rebuild = function () {\r\n if (this._instanceDataStorage.instancesBuffer) {\r\n // Dispose instance buffer to be recreated in _renderWithInstances when rendered\r\n this._instanceDataStorage.instancesBuffer.dispose();\r\n this._instanceDataStorage.instancesBuffer = null;\r\n }\r\n _super.prototype._rebuild.call(this);\r\n };\r\n /** @hidden */\r\n Mesh.prototype._freeze = function () {\r\n if (!this.subMeshes) {\r\n return;\r\n }\r\n // Prepare batches\r\n for (var index = 0; index < this.subMeshes.length; index++) {\r\n this._getInstancesRenderList(index);\r\n }\r\n this._effectiveMaterial = null;\r\n this._instanceDataStorage.isFrozen = true;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._unFreeze = function () {\r\n this._instanceDataStorage.isFrozen = false;\r\n this._instanceDataStorage.previousBatch = null;\r\n };\r\n /**\r\n * Triggers the draw call for the mesh. Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager\r\n * @param subMesh defines the subMesh to render\r\n * @param enableAlphaMode defines if alpha mode can be changed\r\n * @param effectiveMeshReplacement defines an optional mesh used to provide info for the rendering\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.render = function (subMesh, enableAlphaMode, effectiveMeshReplacement) {\r\n var scene = this.getScene();\r\n if (this._internalAbstractMeshDataInfo._isActiveIntermediate) {\r\n this._internalAbstractMeshDataInfo._isActiveIntermediate = false;\r\n }\r\n else {\r\n this._internalAbstractMeshDataInfo._isActive = false;\r\n }\r\n if (this._checkOcclusionQuery()) {\r\n return this;\r\n }\r\n // Managing instances\r\n var batch = this._getInstancesRenderList(subMesh._id, !!effectiveMeshReplacement);\r\n if (batch.mustReturn) {\r\n return this;\r\n }\r\n // Checking geometry state\r\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\r\n return this;\r\n }\r\n if (this._internalMeshDataInfo._onBeforeRenderObservable) {\r\n this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers(this);\r\n }\r\n var engine = scene.getEngine();\r\n var hardwareInstancedRendering = batch.hardwareInstancedRendering[subMesh._id] || subMesh.getRenderingMesh().hasThinInstances;\r\n var instanceDataStorage = this._instanceDataStorage;\r\n var material = subMesh.getMaterial();\r\n if (!material) {\r\n return this;\r\n }\r\n // Material\r\n if (!instanceDataStorage.isFrozen || !this._effectiveMaterial || this._effectiveMaterial !== material) {\r\n if (material._storeEffectOnSubMeshes) {\r\n if (!material.isReadyForSubMesh(this, subMesh, hardwareInstancedRendering)) {\r\n return this;\r\n }\r\n }\r\n else if (!material.isReady(this, hardwareInstancedRendering)) {\r\n return this;\r\n }\r\n this._effectiveMaterial = material;\r\n }\r\n // Alpha mode\r\n if (enableAlphaMode) {\r\n engine.setAlphaMode(this._effectiveMaterial.alphaMode);\r\n }\r\n var effect;\r\n if (this._effectiveMaterial._storeEffectOnSubMeshes) {\r\n effect = subMesh.effect;\r\n }\r\n else {\r\n effect = this._effectiveMaterial.getEffect();\r\n }\r\n for (var _i = 0, _a = scene._beforeRenderingMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(this, subMesh, batch, effect);\r\n }\r\n if (!effect) {\r\n return this;\r\n }\r\n var effectiveMesh = effectiveMeshReplacement || this._effectiveMesh;\r\n var sideOrientation;\r\n if (!instanceDataStorage.isFrozen &&\r\n (this._effectiveMaterial.backFaceCulling || this.overrideMaterialSideOrientation !== null)) {\r\n var mainDeterminant = effectiveMesh._getWorldMatrixDeterminant();\r\n sideOrientation = this.overrideMaterialSideOrientation;\r\n if (sideOrientation == null) {\r\n sideOrientation = this._effectiveMaterial.sideOrientation;\r\n }\r\n if (mainDeterminant < 0) {\r\n sideOrientation = (sideOrientation === Material.ClockWiseSideOrientation ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation);\r\n }\r\n instanceDataStorage.sideOrientation = sideOrientation;\r\n }\r\n else {\r\n sideOrientation = instanceDataStorage.sideOrientation;\r\n }\r\n var reverse = this._effectiveMaterial._preBind(effect, sideOrientation);\r\n if (this._effectiveMaterial.forceDepthWrite) {\r\n engine.setDepthWrite(true);\r\n }\r\n // Bind\r\n var fillMode = scene.forcePointsCloud ? Material.PointFillMode : (scene.forceWireframe ? Material.WireFrameFillMode : this._effectiveMaterial.fillMode);\r\n if (this._internalMeshDataInfo._onBeforeBindObservable) {\r\n this._internalMeshDataInfo._onBeforeBindObservable.notifyObservers(this);\r\n }\r\n if (!hardwareInstancedRendering) { // Binding will be done later because we need to add more info to the VB\r\n this._bind(subMesh, effect, fillMode);\r\n }\r\n var world = effectiveMesh.getWorldMatrix();\r\n if (this._effectiveMaterial._storeEffectOnSubMeshes) {\r\n this._effectiveMaterial.bindForSubMesh(world, this, subMesh);\r\n }\r\n else {\r\n this._effectiveMaterial.bind(world, this);\r\n }\r\n if (!this._effectiveMaterial.backFaceCulling && this._effectiveMaterial.separateCullingPass) {\r\n engine.setState(true, this._effectiveMaterial.zOffset, false, !reverse);\r\n this._processRendering(this, subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._effectiveMaterial);\r\n engine.setState(true, this._effectiveMaterial.zOffset, false, reverse);\r\n }\r\n // Draw\r\n this._processRendering(this, subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._effectiveMaterial);\r\n // Unbind\r\n this._effectiveMaterial.unbind();\r\n for (var _b = 0, _c = scene._afterRenderingMeshStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action(this, subMesh, batch, effect);\r\n }\r\n if (this._internalMeshDataInfo._onAfterRenderObservable) {\r\n this._internalMeshDataInfo._onAfterRenderObservable.notifyObservers(this);\r\n }\r\n return this;\r\n };\r\n Mesh.prototype._onBeforeDraw = function (isInstance, world, effectiveMaterial) {\r\n if (isInstance && effectiveMaterial) {\r\n effectiveMaterial.bindOnlyWorldMatrix(world);\r\n }\r\n };\r\n /**\r\n * Renormalize the mesh and patch it up if there are no weights\r\n * Similar to normalization by adding the weights compute the reciprocal and multiply all elements, this wil ensure that everything adds to 1.\r\n * However in the case of zero weights then we set just a single influence to 1.\r\n * We check in the function for extra's present and if so we use the normalizeSkinWeightsWithExtras rather than the FourWeights version.\r\n */\r\n Mesh.prototype.cleanMatrixWeights = function () {\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsExtraKind)) {\r\n this.normalizeSkinWeightsAndExtra();\r\n }\r\n else {\r\n this.normalizeSkinFourWeights();\r\n }\r\n }\r\n };\r\n // faster 4 weight version.\r\n Mesh.prototype.normalizeSkinFourWeights = function () {\r\n var matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\r\n var numWeights = matricesWeights.length;\r\n for (var a = 0; a < numWeights; a += 4) {\r\n // accumulate weights\r\n var t = matricesWeights[a] + matricesWeights[a + 1] + matricesWeights[a + 2] + matricesWeights[a + 3];\r\n // check for invalid weight and just set it to 1.\r\n if (t === 0) {\r\n matricesWeights[a] = 1;\r\n }\r\n else {\r\n // renormalize so everything adds to 1 use reciprical\r\n var recip = 1 / t;\r\n matricesWeights[a] *= recip;\r\n matricesWeights[a + 1] *= recip;\r\n matricesWeights[a + 2] *= recip;\r\n matricesWeights[a + 3] *= recip;\r\n }\r\n }\r\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeights);\r\n };\r\n // handle special case of extra verts. (in theory gltf can handle 12 influences)\r\n Mesh.prototype.normalizeSkinWeightsAndExtra = function () {\r\n var matricesWeightsExtra = this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind);\r\n var matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\r\n var numWeights = matricesWeights.length;\r\n for (var a = 0; a < numWeights; a += 4) {\r\n // accumulate weights\r\n var t = matricesWeights[a] + matricesWeights[a + 1] + matricesWeights[a + 2] + matricesWeights[a + 3];\r\n t += matricesWeightsExtra[a] + matricesWeightsExtra[a + 1] + matricesWeightsExtra[a + 2] + matricesWeightsExtra[a + 3];\r\n // check for invalid weight and just set it to 1.\r\n if (t === 0) {\r\n matricesWeights[a] = 1;\r\n }\r\n else {\r\n // renormalize so everything adds to 1 use reciprical\r\n var recip = 1 / t;\r\n matricesWeights[a] *= recip;\r\n matricesWeights[a + 1] *= recip;\r\n matricesWeights[a + 2] *= recip;\r\n matricesWeights[a + 3] *= recip;\r\n // same goes for extras\r\n matricesWeightsExtra[a] *= recip;\r\n matricesWeightsExtra[a + 1] *= recip;\r\n matricesWeightsExtra[a + 2] *= recip;\r\n matricesWeightsExtra[a + 3] *= recip;\r\n }\r\n }\r\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeights);\r\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeightsExtra);\r\n };\r\n /**\r\n * ValidateSkinning is used to determine that a mesh has valid skinning data along with skin metrics, if missing weights,\r\n * or not normalized it is returned as invalid mesh the string can be used for console logs, or on screen messages to let\r\n * the user know there was an issue with importing the mesh\r\n * @returns a validation object with skinned, valid and report string\r\n */\r\n Mesh.prototype.validateSkinning = function () {\r\n var matricesWeightsExtra = this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind);\r\n var matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\r\n if (matricesWeights === null || this.skeleton == null) {\r\n return { skinned: false, valid: true, report: \"not skinned\" };\r\n }\r\n var numWeights = matricesWeights.length;\r\n var numberNotSorted = 0;\r\n var missingWeights = 0;\r\n var maxUsedWeights = 0;\r\n var numberNotNormalized = 0;\r\n var numInfluences = matricesWeightsExtra === null ? 4 : 8;\r\n var usedWeightCounts = new Array();\r\n for (var a = 0; a <= numInfluences; a++) {\r\n usedWeightCounts[a] = 0;\r\n }\r\n var toleranceEpsilon = 0.001;\r\n for (var a = 0; a < numWeights; a += 4) {\r\n var lastWeight = matricesWeights[a];\r\n var t = lastWeight;\r\n var usedWeights = t === 0 ? 0 : 1;\r\n for (var b = 1; b < numInfluences; b++) {\r\n var d = b < 4 ? matricesWeights[a + b] : matricesWeightsExtra[a + b - 4];\r\n if (d > lastWeight) {\r\n numberNotSorted++;\r\n }\r\n if (d !== 0) {\r\n usedWeights++;\r\n }\r\n t += d;\r\n lastWeight = d;\r\n }\r\n // count the buffer weights usage\r\n usedWeightCounts[usedWeights]++;\r\n // max influences\r\n if (usedWeights > maxUsedWeights) {\r\n maxUsedWeights = usedWeights;\r\n }\r\n // check for invalid weight and just set it to 1.\r\n if (t === 0) {\r\n missingWeights++;\r\n }\r\n else {\r\n // renormalize so everything adds to 1 use reciprical\r\n var recip = 1 / t;\r\n var tolerance = 0;\r\n for (b = 0; b < numInfluences; b++) {\r\n if (b < 4) {\r\n tolerance += Math.abs(matricesWeights[a + b] - (matricesWeights[a + b] * recip));\r\n }\r\n else {\r\n tolerance += Math.abs(matricesWeightsExtra[a + b - 4] - (matricesWeightsExtra[a + b - 4] * recip));\r\n }\r\n }\r\n // arbitary epsilon value for dicdating not normalized\r\n if (tolerance > toleranceEpsilon) {\r\n numberNotNormalized++;\r\n }\r\n }\r\n }\r\n // validate bone indices are in range of the skeleton\r\n var numBones = this.skeleton.bones.length;\r\n var matricesIndices = this.getVerticesData(VertexBuffer.MatricesIndicesKind);\r\n var matricesIndicesExtra = this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind);\r\n var numBadBoneIndices = 0;\r\n for (var a = 0; a < numWeights; a += 4) {\r\n for (var b = 0; b < numInfluences; b++) {\r\n var index = b < 4 ? matricesIndices[a + b] : matricesIndicesExtra[a + b - 4];\r\n if (index >= numBones || index < 0) {\r\n numBadBoneIndices++;\r\n }\r\n }\r\n }\r\n // log mesh stats\r\n var output = \"Number of Weights = \" + numWeights / 4 + \"\\nMaximum influences = \" + maxUsedWeights +\r\n \"\\nMissing Weights = \" + missingWeights + \"\\nNot Sorted = \" + numberNotSorted +\r\n \"\\nNot Normalized = \" + numberNotNormalized + \"\\nWeightCounts = [\" + usedWeightCounts + \"]\" +\r\n \"\\nNumber of bones = \" + numBones + \"\\nBad Bone Indices = \" + numBadBoneIndices;\r\n return { skinned: true, valid: missingWeights === 0 && numberNotNormalized === 0 && numBadBoneIndices === 0, report: output };\r\n };\r\n /** @hidden */\r\n Mesh.prototype._checkDelayState = function () {\r\n var scene = this.getScene();\r\n if (this._geometry) {\r\n this._geometry.load(scene);\r\n }\r\n else if (this.delayLoadState === 4) {\r\n this.delayLoadState = 2;\r\n this._queueLoad(scene);\r\n }\r\n return this;\r\n };\r\n Mesh.prototype._queueLoad = function (scene) {\r\n var _this = this;\r\n scene._addPendingData(this);\r\n var getBinaryData = (this.delayLoadingFile.indexOf(\".babylonbinarymeshdata\") !== -1);\r\n Tools.LoadFile(this.delayLoadingFile, function (data) {\r\n if (data instanceof ArrayBuffer) {\r\n _this._delayLoadingFunction(data, _this);\r\n }\r\n else {\r\n _this._delayLoadingFunction(JSON.parse(data), _this);\r\n }\r\n _this.instances.forEach(function (instance) {\r\n instance.refreshBoundingInfo();\r\n instance._syncSubMeshes();\r\n });\r\n _this.delayLoadState = 1;\r\n scene._removePendingData(_this);\r\n }, function () { }, scene.offlineProvider, getBinaryData);\r\n return this;\r\n };\r\n /**\r\n * Returns `true` if the mesh is within the frustum defined by the passed array of planes.\r\n * A mesh is in the frustum if its bounding box intersects the frustum\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the mesh is in the frustum planes\r\n */\r\n Mesh.prototype.isInFrustum = function (frustumPlanes) {\r\n if (this.delayLoadState === 2) {\r\n return false;\r\n }\r\n if (!_super.prototype.isInFrustum.call(this, frustumPlanes)) {\r\n return false;\r\n }\r\n this._checkDelayState();\r\n return true;\r\n };\r\n /**\r\n * Sets the mesh material by the material or multiMaterial `id` property\r\n * @param id is a string identifying the material or the multiMaterial\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.setMaterialByID = function (id) {\r\n var materials = this.getScene().materials;\r\n var index;\r\n for (index = materials.length - 1; index > -1; index--) {\r\n if (materials[index].id === id) {\r\n this.material = materials[index];\r\n return this;\r\n }\r\n }\r\n // Multi\r\n var multiMaterials = this.getScene().multiMaterials;\r\n for (index = multiMaterials.length - 1; index > -1; index--) {\r\n if (multiMaterials[index].id === id) {\r\n this.material = multiMaterials[index];\r\n return this;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns as a new array populated with the mesh material and/or skeleton, if any.\r\n * @returns an array of IAnimatable\r\n */\r\n Mesh.prototype.getAnimatables = function () {\r\n var results = new Array();\r\n if (this.material) {\r\n results.push(this.material);\r\n }\r\n if (this.skeleton) {\r\n results.push(this.skeleton);\r\n }\r\n return results;\r\n };\r\n /**\r\n * Modifies the mesh geometry according to the passed transformation matrix.\r\n * This method returns nothing but it really modifies the mesh even if it's originally not set as updatable.\r\n * The mesh normals are modified using the same transformation.\r\n * Note that, under the hood, this method sets a new VertexBuffer each call.\r\n * @param transform defines the transform matrix to use\r\n * @see https://doc.babylonjs.com/resources/baking_transformations\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.bakeTransformIntoVertices = function (transform) {\r\n // Position\r\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\r\n return this;\r\n }\r\n var submeshes = this.subMeshes.splice(0);\r\n this._resetPointsArrayCache();\r\n var data = this.getVerticesData(VertexBuffer.PositionKind);\r\n var temp = new Array();\r\n var index;\r\n for (index = 0; index < data.length; index += 3) {\r\n Vector3.TransformCoordinates(Vector3.FromArray(data, index), transform).toArray(temp, index);\r\n }\r\n this.setVerticesData(VertexBuffer.PositionKind, temp, this.getVertexBuffer(VertexBuffer.PositionKind).isUpdatable());\r\n // Normals\r\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n data = this.getVerticesData(VertexBuffer.NormalKind);\r\n temp = [];\r\n for (index = 0; index < data.length; index += 3) {\r\n Vector3.TransformNormal(Vector3.FromArray(data, index), transform).normalize().toArray(temp, index);\r\n }\r\n this.setVerticesData(VertexBuffer.NormalKind, temp, this.getVertexBuffer(VertexBuffer.NormalKind).isUpdatable());\r\n }\r\n // flip faces?\r\n if (transform.m[0] * transform.m[5] * transform.m[10] < 0) {\r\n this.flipFaces();\r\n }\r\n // Restore submeshes\r\n this.releaseSubMeshes();\r\n this.subMeshes = submeshes;\r\n return this;\r\n };\r\n /**\r\n * Modifies the mesh geometry according to its own current World Matrix.\r\n * The mesh World Matrix is then reset.\r\n * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.\r\n * Note that, under the hood, this method sets a new VertexBuffer each call.\r\n * @see https://doc.babylonjs.com/resources/baking_transformations\r\n * @param bakeIndependenlyOfChildren indicates whether to preserve all child nodes' World Matrix during baking\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.bakeCurrentTransformIntoVertices = function (bakeIndependenlyOfChildren) {\r\n if (bakeIndependenlyOfChildren === void 0) { bakeIndependenlyOfChildren = true; }\r\n this.bakeTransformIntoVertices(this.computeWorldMatrix(true));\r\n this.resetLocalMatrix(bakeIndependenlyOfChildren);\r\n return this;\r\n };\r\n Object.defineProperty(Mesh.prototype, \"_positions\", {\r\n // Cache\r\n /** @hidden */\r\n get: function () {\r\n if (this._geometry) {\r\n return this._geometry._positions;\r\n }\r\n return null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Mesh.prototype._resetPointsArrayCache = function () {\r\n if (this._geometry) {\r\n this._geometry._resetPointsArrayCache();\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n Mesh.prototype._generatePointsArray = function () {\r\n if (this._geometry) {\r\n return this._geometry._generatePointsArray();\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns a new Mesh object generated from the current mesh properties.\r\n * This method must not get confused with createInstance()\r\n * @param name is a string, the name given to the new mesh\r\n * @param newParent can be any Node object (default `null`)\r\n * @param doNotCloneChildren allows/denies the recursive cloning of the original mesh children if any (default `false`)\r\n * @param clonePhysicsImpostor allows/denies the cloning in the same time of the original mesh `body` used by the physics engine, if any (default `true`)\r\n * @returns a new mesh\r\n */\r\n Mesh.prototype.clone = function (name, newParent, doNotCloneChildren, clonePhysicsImpostor) {\r\n if (name === void 0) { name = \"\"; }\r\n if (newParent === void 0) { newParent = null; }\r\n if (clonePhysicsImpostor === void 0) { clonePhysicsImpostor = true; }\r\n return new Mesh(name, this.getScene(), newParent, this, doNotCloneChildren, clonePhysicsImpostor);\r\n };\r\n /**\r\n * Releases resources associated with this mesh.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n Mesh.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n this.morphTargetManager = null;\r\n if (this._geometry) {\r\n this._geometry.releaseForMesh(this, true);\r\n }\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (internalDataInfo._onBeforeDrawObservable) {\r\n internalDataInfo._onBeforeDrawObservable.clear();\r\n }\r\n if (internalDataInfo._onBeforeBindObservable) {\r\n internalDataInfo._onBeforeBindObservable.clear();\r\n }\r\n if (internalDataInfo._onBeforeRenderObservable) {\r\n internalDataInfo._onBeforeRenderObservable.clear();\r\n }\r\n if (internalDataInfo._onAfterRenderObservable) {\r\n internalDataInfo._onAfterRenderObservable.clear();\r\n }\r\n // Sources\r\n if (this._scene.useClonedMeshMap) {\r\n if (internalDataInfo.meshMap) {\r\n for (var uniqueId in internalDataInfo.meshMap) {\r\n var mesh = internalDataInfo.meshMap[uniqueId];\r\n if (mesh) {\r\n mesh._internalMeshDataInfo._source = null;\r\n internalDataInfo.meshMap[uniqueId] = undefined;\r\n }\r\n }\r\n }\r\n if (internalDataInfo._source && internalDataInfo._source._internalMeshDataInfo.meshMap) {\r\n internalDataInfo._source._internalMeshDataInfo.meshMap[this.uniqueId] = undefined;\r\n }\r\n }\r\n else {\r\n var meshes = this.getScene().meshes;\r\n for (var _i = 0, meshes_1 = meshes; _i < meshes_1.length; _i++) {\r\n var abstractMesh = meshes_1[_i];\r\n var mesh = abstractMesh;\r\n if (mesh._internalMeshDataInfo && mesh._internalMeshDataInfo._source && mesh._internalMeshDataInfo._source === this) {\r\n mesh._internalMeshDataInfo._source = null;\r\n }\r\n }\r\n }\r\n internalDataInfo._source = null;\r\n // Instances\r\n this._disposeInstanceSpecificData();\r\n // Thin instances\r\n this._disposeThinInstanceSpecificData();\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /** @hidden */\r\n Mesh.prototype._disposeInstanceSpecificData = function () {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n Mesh.prototype._disposeThinInstanceSpecificData = function () {\r\n // Do nothing\r\n };\r\n /**\r\n * Modifies the mesh geometry according to a displacement map.\r\n * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.\r\n * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.\r\n * @param url is a string, the URL from the image file is to be downloaded.\r\n * @param minHeight is the lower limit of the displacement.\r\n * @param maxHeight is the upper limit of the displacement.\r\n * @param onSuccess is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.\r\n * @param uvOffset is an optional vector2 used to offset UV.\r\n * @param uvScale is an optional vector2 used to scale UV.\r\n * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.\r\n * @returns the Mesh.\r\n */\r\n Mesh.prototype.applyDisplacementMap = function (url, minHeight, maxHeight, onSuccess, uvOffset, uvScale, forceUpdate) {\r\n var _this = this;\r\n if (forceUpdate === void 0) { forceUpdate = false; }\r\n var scene = this.getScene();\r\n var onload = function (img) {\r\n // Getting height map data\r\n var heightMapWidth = img.width;\r\n var heightMapHeight = img.height;\r\n var canvas = CanvasGenerator.CreateCanvas(heightMapWidth, heightMapHeight);\r\n var context = canvas.getContext(\"2d\");\r\n context.drawImage(img, 0, 0);\r\n // Create VertexData from map data\r\n //Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949\r\n var buffer = context.getImageData(0, 0, heightMapWidth, heightMapHeight).data;\r\n _this.applyDisplacementMapFromBuffer(buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate);\r\n //execute success callback, if set\r\n if (onSuccess) {\r\n onSuccess(_this);\r\n }\r\n };\r\n Tools.LoadImage(url, onload, function () { }, scene.offlineProvider);\r\n return this;\r\n };\r\n /**\r\n * Modifies the mesh geometry according to a displacementMap buffer.\r\n * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.\r\n * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.\r\n * @param buffer is a `Uint8Array` buffer containing series of `Uint8` lower than 255, the red, green, blue and alpha values of each successive pixel.\r\n * @param heightMapWidth is the width of the buffer image.\r\n * @param heightMapHeight is the height of the buffer image.\r\n * @param minHeight is the lower limit of the displacement.\r\n * @param maxHeight is the upper limit of the displacement.\r\n * @param onSuccess is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.\r\n * @param uvOffset is an optional vector2 used to offset UV.\r\n * @param uvScale is an optional vector2 used to scale UV.\r\n * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.\r\n * @returns the Mesh.\r\n */\r\n Mesh.prototype.applyDisplacementMapFromBuffer = function (buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate) {\r\n if (forceUpdate === void 0) { forceUpdate = false; }\r\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind)\r\n || !this.isVerticesDataPresent(VertexBuffer.NormalKind)\r\n || !this.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n Logger.Warn(\"Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing\");\r\n return this;\r\n }\r\n var positions = this.getVerticesData(VertexBuffer.PositionKind, true, true);\r\n var normals = this.getVerticesData(VertexBuffer.NormalKind);\r\n var uvs = this.getVerticesData(VertexBuffer.UVKind);\r\n var position = Vector3.Zero();\r\n var normal = Vector3.Zero();\r\n var uv = Vector2.Zero();\r\n uvOffset = uvOffset || Vector2.Zero();\r\n uvScale = uvScale || new Vector2(1, 1);\r\n for (var index = 0; index < positions.length; index += 3) {\r\n Vector3.FromArrayToRef(positions, index, position);\r\n Vector3.FromArrayToRef(normals, index, normal);\r\n Vector2.FromArrayToRef(uvs, (index / 3) * 2, uv);\r\n // Compute height\r\n var u = ((Math.abs(uv.x * uvScale.x + uvOffset.x % 1) * (heightMapWidth - 1)) % heightMapWidth) | 0;\r\n var v = ((Math.abs(uv.y * uvScale.y + uvOffset.y % 1) * (heightMapHeight - 1)) % heightMapHeight) | 0;\r\n var pos = (u + v * heightMapWidth) * 4;\r\n var r = buffer[pos] / 255.0;\r\n var g = buffer[pos + 1] / 255.0;\r\n var b = buffer[pos + 2] / 255.0;\r\n var gradient = r * 0.3 + g * 0.59 + b * 0.11;\r\n normal.normalize();\r\n normal.scaleInPlace(minHeight + (maxHeight - minHeight) * gradient);\r\n position = position.add(normal);\r\n position.toArray(positions, index);\r\n }\r\n VertexData.ComputeNormals(positions, this.getIndices(), normals);\r\n if (forceUpdate) {\r\n this.setVerticesData(VertexBuffer.PositionKind, positions);\r\n this.setVerticesData(VertexBuffer.NormalKind, normals);\r\n }\r\n else {\r\n this.updateVerticesData(VertexBuffer.PositionKind, positions);\r\n this.updateVerticesData(VertexBuffer.NormalKind, normals);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Modify the mesh to get a flat shading rendering.\r\n * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.\r\n * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.\r\n * @returns current mesh\r\n */\r\n Mesh.prototype.convertToFlatShadedMesh = function () {\r\n var kinds = this.getVerticesDataKinds();\r\n var vbs = {};\r\n var data = {};\r\n var newdata = {};\r\n var updatableNormals = false;\r\n var kindIndex;\r\n var kind;\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n if (kind === VertexBuffer.NormalKind) {\r\n updatableNormals = vertexBuffer.isUpdatable();\r\n kinds.splice(kindIndex, 1);\r\n kindIndex--;\r\n continue;\r\n }\r\n vbs[kind] = vertexBuffer;\r\n data[kind] = vbs[kind].getData();\r\n newdata[kind] = [];\r\n }\r\n // Save previous submeshes\r\n var previousSubmeshes = this.subMeshes.slice(0);\r\n var indices = this.getIndices();\r\n var totalIndices = this.getTotalIndices();\r\n // Generating unique vertices per face\r\n var index;\r\n for (index = 0; index < totalIndices; index++) {\r\n var vertexIndex = indices[index];\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var stride = vbs[kind].getStrideSize();\r\n for (var offset = 0; offset < stride; offset++) {\r\n newdata[kind].push(data[kind][vertexIndex * stride + offset]);\r\n }\r\n }\r\n }\r\n // Updating faces & normal\r\n var normals = [];\r\n var positions = newdata[VertexBuffer.PositionKind];\r\n for (index = 0; index < totalIndices; index += 3) {\r\n indices[index] = index;\r\n indices[index + 1] = index + 1;\r\n indices[index + 2] = index + 2;\r\n var p1 = Vector3.FromArray(positions, index * 3);\r\n var p2 = Vector3.FromArray(positions, (index + 1) * 3);\r\n var p3 = Vector3.FromArray(positions, (index + 2) * 3);\r\n var p1p2 = p1.subtract(p2);\r\n var p3p2 = p3.subtract(p2);\r\n var normal = Vector3.Normalize(Vector3.Cross(p1p2, p3p2));\r\n // Store same normals for every vertex\r\n for (var localIndex = 0; localIndex < 3; localIndex++) {\r\n normals.push(normal.x);\r\n normals.push(normal.y);\r\n normals.push(normal.z);\r\n }\r\n }\r\n this.setIndices(indices);\r\n this.setVerticesData(VertexBuffer.NormalKind, normals, updatableNormals);\r\n // Updating vertex buffers\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n this.setVerticesData(kind, newdata[kind], vbs[kind].isUpdatable());\r\n }\r\n // Updating submeshes\r\n this.releaseSubMeshes();\r\n for (var submeshIndex = 0; submeshIndex < previousSubmeshes.length; submeshIndex++) {\r\n var previousOne = previousSubmeshes[submeshIndex];\r\n SubMesh.AddToMesh(previousOne.materialIndex, previousOne.indexStart, previousOne.indexCount, previousOne.indexStart, previousOne.indexCount, this);\r\n }\r\n this.synchronizeInstances();\r\n return this;\r\n };\r\n /**\r\n * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.\r\n * In other words, more vertices, no more indices and a single bigger VBO.\r\n * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.\r\n * @returns current mesh\r\n */\r\n Mesh.prototype.convertToUnIndexedMesh = function () {\r\n var kinds = this.getVerticesDataKinds();\r\n var vbs = {};\r\n var data = {};\r\n var newdata = {};\r\n var kindIndex;\r\n var kind;\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var vertexBuffer = this.getVertexBuffer(kind);\r\n vbs[kind] = vertexBuffer;\r\n data[kind] = vbs[kind].getData();\r\n newdata[kind] = [];\r\n }\r\n // Save previous submeshes\r\n var previousSubmeshes = this.subMeshes.slice(0);\r\n var indices = this.getIndices();\r\n var totalIndices = this.getTotalIndices();\r\n // Generating unique vertices per face\r\n var index;\r\n for (index = 0; index < totalIndices; index++) {\r\n var vertexIndex = indices[index];\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n var stride = vbs[kind].getStrideSize();\r\n for (var offset = 0; offset < stride; offset++) {\r\n newdata[kind].push(data[kind][vertexIndex * stride + offset]);\r\n }\r\n }\r\n }\r\n // Updating indices\r\n for (index = 0; index < totalIndices; index += 3) {\r\n indices[index] = index;\r\n indices[index + 1] = index + 1;\r\n indices[index + 2] = index + 2;\r\n }\r\n this.setIndices(indices);\r\n // Updating vertex buffers\r\n for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {\r\n kind = kinds[kindIndex];\r\n this.setVerticesData(kind, newdata[kind], vbs[kind].isUpdatable());\r\n }\r\n // Updating submeshes\r\n this.releaseSubMeshes();\r\n for (var submeshIndex = 0; submeshIndex < previousSubmeshes.length; submeshIndex++) {\r\n var previousOne = previousSubmeshes[submeshIndex];\r\n SubMesh.AddToMesh(previousOne.materialIndex, previousOne.indexStart, previousOne.indexCount, previousOne.indexStart, previousOne.indexCount, this);\r\n }\r\n this._unIndexed = true;\r\n this.synchronizeInstances();\r\n return this;\r\n };\r\n /**\r\n * Inverses facet orientations.\r\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\r\n * @param flipNormals will also inverts the normals\r\n * @returns current mesh\r\n */\r\n Mesh.prototype.flipFaces = function (flipNormals) {\r\n if (flipNormals === void 0) { flipNormals = false; }\r\n var vertex_data = VertexData.ExtractFromMesh(this);\r\n var i;\r\n if (flipNormals && this.isVerticesDataPresent(VertexBuffer.NormalKind) && vertex_data.normals) {\r\n for (i = 0; i < vertex_data.normals.length; i++) {\r\n vertex_data.normals[i] *= -1;\r\n }\r\n }\r\n if (vertex_data.indices) {\r\n var temp;\r\n for (i = 0; i < vertex_data.indices.length; i += 3) {\r\n // reassign indices\r\n temp = vertex_data.indices[i + 1];\r\n vertex_data.indices[i + 1] = vertex_data.indices[i + 2];\r\n vertex_data.indices[i + 2] = temp;\r\n }\r\n }\r\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(VertexBuffer.PositionKind));\r\n return this;\r\n };\r\n /**\r\n * Increase the number of facets and hence vertices in a mesh\r\n * Vertex normals are interpolated from existing vertex normals\r\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\r\n * @param numberPerEdge the number of new vertices to add to each edge of a facet, optional default 1\r\n */\r\n Mesh.prototype.increaseVertices = function (numberPerEdge) {\r\n var vertex_data = VertexData.ExtractFromMesh(this);\r\n var uvs = vertex_data.uvs;\r\n var currentIndices = vertex_data.indices;\r\n var positions = vertex_data.positions;\r\n var normals = vertex_data.normals;\r\n if (!currentIndices || !positions || !normals || !uvs) {\r\n Logger.Warn(\"VertexData contains null entries\");\r\n }\r\n else {\r\n var segments = numberPerEdge + 1; //segments per current facet edge, become sides of new facets\r\n var tempIndices = new Array();\r\n for (var i = 0; i < segments + 1; i++) {\r\n tempIndices[i] = new Array();\r\n }\r\n var a; //vertex index of one end of a side\r\n var b; //vertex index of other end of the side\r\n var deltaPosition = new Vector3(0, 0, 0);\r\n var deltaNormal = new Vector3(0, 0, 0);\r\n var deltaUV = new Vector2(0, 0);\r\n var indices = new Array();\r\n var vertexIndex = new Array();\r\n var side = new Array();\r\n var len;\r\n var positionPtr = positions.length;\r\n var uvPtr = uvs.length;\r\n for (var i = 0; i < currentIndices.length; i += 3) {\r\n vertexIndex[0] = currentIndices[i];\r\n vertexIndex[1] = currentIndices[i + 1];\r\n vertexIndex[2] = currentIndices[i + 2];\r\n for (var j = 0; j < 3; j++) {\r\n a = vertexIndex[j];\r\n b = vertexIndex[(j + 1) % 3];\r\n if (side[a] === undefined && side[b] === undefined) {\r\n side[a] = new Array();\r\n side[b] = new Array();\r\n }\r\n else {\r\n if (side[a] === undefined) {\r\n side[a] = new Array();\r\n }\r\n if (side[b] === undefined) {\r\n side[b] = new Array();\r\n }\r\n }\r\n if (side[a][b] === undefined && side[b][a] === undefined) {\r\n side[a][b] = [];\r\n deltaPosition.x = (positions[3 * b] - positions[3 * a]) / segments;\r\n deltaPosition.y = (positions[3 * b + 1] - positions[3 * a + 1]) / segments;\r\n deltaPosition.z = (positions[3 * b + 2] - positions[3 * a + 2]) / segments;\r\n deltaNormal.x = (normals[3 * b] - normals[3 * a]) / segments;\r\n deltaNormal.y = (normals[3 * b + 1] - normals[3 * a + 1]) / segments;\r\n deltaNormal.z = (normals[3 * b + 2] - normals[3 * a + 2]) / segments;\r\n deltaUV.x = (uvs[2 * b] - uvs[2 * a]) / segments;\r\n deltaUV.y = (uvs[2 * b + 1] - uvs[2 * a + 1]) / segments;\r\n side[a][b].push(a);\r\n for (var k = 1; k < segments; k++) {\r\n side[a][b].push(positions.length / 3);\r\n positions[positionPtr] = positions[3 * a] + k * deltaPosition.x;\r\n normals[positionPtr++] = normals[3 * a] + k * deltaNormal.x;\r\n positions[positionPtr] = positions[3 * a + 1] + k * deltaPosition.y;\r\n normals[positionPtr++] = normals[3 * a + 1] + k * deltaNormal.y;\r\n positions[positionPtr] = positions[3 * a + 2] + k * deltaPosition.z;\r\n normals[positionPtr++] = normals[3 * a + 2] + k * deltaNormal.z;\r\n uvs[uvPtr++] = uvs[2 * a] + k * deltaUV.x;\r\n uvs[uvPtr++] = uvs[2 * a + 1] + k * deltaUV.y;\r\n }\r\n side[a][b].push(b);\r\n side[b][a] = new Array();\r\n len = side[a][b].length;\r\n for (var idx = 0; idx < len; idx++) {\r\n side[b][a][idx] = side[a][b][len - 1 - idx];\r\n }\r\n }\r\n }\r\n //Calculate positions, normals and uvs of new internal vertices\r\n tempIndices[0][0] = currentIndices[i];\r\n tempIndices[1][0] = side[currentIndices[i]][currentIndices[i + 1]][1];\r\n tempIndices[1][1] = side[currentIndices[i]][currentIndices[i + 2]][1];\r\n for (var k = 2; k < segments; k++) {\r\n tempIndices[k][0] = side[currentIndices[i]][currentIndices[i + 1]][k];\r\n tempIndices[k][k] = side[currentIndices[i]][currentIndices[i + 2]][k];\r\n deltaPosition.x = (positions[3 * tempIndices[k][k]] - positions[3 * tempIndices[k][0]]) / k;\r\n deltaPosition.y = (positions[3 * tempIndices[k][k] + 1] - positions[3 * tempIndices[k][0] + 1]) / k;\r\n deltaPosition.z = (positions[3 * tempIndices[k][k] + 2] - positions[3 * tempIndices[k][0] + 2]) / k;\r\n deltaNormal.x = (normals[3 * tempIndices[k][k]] - normals[3 * tempIndices[k][0]]) / k;\r\n deltaNormal.y = (normals[3 * tempIndices[k][k] + 1] - normals[3 * tempIndices[k][0] + 1]) / k;\r\n deltaNormal.z = (normals[3 * tempIndices[k][k] + 2] - normals[3 * tempIndices[k][0] + 2]) / k;\r\n deltaUV.x = (uvs[2 * tempIndices[k][k]] - uvs[2 * tempIndices[k][0]]) / k;\r\n deltaUV.y = (uvs[2 * tempIndices[k][k] + 1] - uvs[2 * tempIndices[k][0] + 1]) / k;\r\n for (var j = 1; j < k; j++) {\r\n tempIndices[k][j] = positions.length / 3;\r\n positions[positionPtr] = positions[3 * tempIndices[k][0]] + j * deltaPosition.x;\r\n normals[positionPtr++] = normals[3 * tempIndices[k][0]] + j * deltaNormal.x;\r\n positions[positionPtr] = positions[3 * tempIndices[k][0] + 1] + j * deltaPosition.y;\r\n normals[positionPtr++] = normals[3 * tempIndices[k][0] + 1] + j * deltaNormal.y;\r\n positions[positionPtr] = positions[3 * tempIndices[k][0] + 2] + j * deltaPosition.z;\r\n normals[positionPtr++] = normals[3 * tempIndices[k][0] + 2] + j * deltaNormal.z;\r\n uvs[uvPtr++] = uvs[2 * tempIndices[k][0]] + j * deltaUV.x;\r\n uvs[uvPtr++] = uvs[2 * tempIndices[k][0] + 1] + j * deltaUV.y;\r\n }\r\n }\r\n tempIndices[segments] = side[currentIndices[i + 1]][currentIndices[i + 2]];\r\n // reform indices\r\n indices.push(tempIndices[0][0], tempIndices[1][0], tempIndices[1][1]);\r\n for (var k = 1; k < segments; k++) {\r\n for (var j = 0; j < k; j++) {\r\n indices.push(tempIndices[k][j], tempIndices[k + 1][j], tempIndices[k + 1][j + 1]);\r\n indices.push(tempIndices[k][j], tempIndices[k + 1][j + 1], tempIndices[k][j + 1]);\r\n }\r\n indices.push(tempIndices[k][j], tempIndices[k + 1][j], tempIndices[k + 1][j + 1]);\r\n }\r\n }\r\n vertex_data.indices = indices;\r\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(VertexBuffer.PositionKind));\r\n }\r\n };\r\n /**\r\n * Force adjacent facets to share vertices and remove any facets that have all vertices in a line\r\n * This will undo any application of covertToFlatShadedMesh\r\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\r\n */\r\n Mesh.prototype.forceSharedVertices = function () {\r\n var vertex_data = VertexData.ExtractFromMesh(this);\r\n var currentUVs = vertex_data.uvs;\r\n var currentIndices = vertex_data.indices;\r\n var currentPositions = vertex_data.positions;\r\n var currentColors = vertex_data.colors;\r\n if (currentIndices === void 0 || currentPositions === void 0 || currentIndices === null || currentPositions === null) {\r\n Logger.Warn(\"VertexData contains empty entries\");\r\n }\r\n else {\r\n var positions = new Array();\r\n var indices = new Array();\r\n var uvs = new Array();\r\n var colors = new Array();\r\n var pstring = new Array(); //lists facet vertex positions (a,b,c) as string \"a|b|c\"\r\n var indexPtr = 0; // pointer to next available index value\r\n var uniquePositions = {}; // unique vertex positions\r\n var ptr; // pointer to element in uniquePositions\r\n var facet;\r\n for (var i = 0; i < currentIndices.length; i += 3) {\r\n facet = [currentIndices[i], currentIndices[i + 1], currentIndices[i + 2]]; //facet vertex indices\r\n pstring = new Array();\r\n for (var j = 0; j < 3; j++) {\r\n pstring[j] = \"\";\r\n for (var k = 0; k < 3; k++) {\r\n //small values make 0\r\n if (Math.abs(currentPositions[3 * facet[j] + k]) < 0.00000001) {\r\n currentPositions[3 * facet[j] + k] = 0;\r\n }\r\n pstring[j] += currentPositions[3 * facet[j] + k] + \"|\";\r\n }\r\n }\r\n //check facet vertices to see that none are repeated\r\n // do not process any facet that has a repeated vertex, ie is a line\r\n if (!(pstring[0] == pstring[1] || pstring[0] == pstring[2] || pstring[1] == pstring[2])) {\r\n //for each facet position check if already listed in uniquePositions\r\n // if not listed add to uniquePositions and set index pointer\r\n // if listed use its index in uniquePositions and new index pointer\r\n for (var j = 0; j < 3; j++) {\r\n ptr = uniquePositions[pstring[j]];\r\n if (ptr === undefined) {\r\n uniquePositions[pstring[j]] = indexPtr;\r\n ptr = indexPtr++;\r\n //not listed so add individual x, y, z coordinates to positions\r\n for (var k = 0; k < 3; k++) {\r\n positions.push(currentPositions[3 * facet[j] + k]);\r\n }\r\n if (currentColors !== null && currentColors !== void 0) {\r\n for (var k = 0; k < 4; k++) {\r\n colors.push(currentColors[4 * facet[j] + k]);\r\n }\r\n }\r\n if (currentUVs !== null && currentUVs !== void 0) {\r\n for (var k = 0; k < 2; k++) {\r\n uvs.push(currentUVs[2 * facet[j] + k]);\r\n }\r\n }\r\n }\r\n // add new index pointer to indices array\r\n indices.push(ptr);\r\n }\r\n }\r\n }\r\n var normals = new Array();\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n //create new vertex data object and update\r\n vertex_data.positions = positions;\r\n vertex_data.indices = indices;\r\n vertex_data.normals = normals;\r\n if (currentUVs !== null && currentUVs !== void 0) {\r\n vertex_data.uvs = uvs;\r\n }\r\n if (currentColors !== null && currentColors !== void 0) {\r\n vertex_data.colors = colors;\r\n }\r\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(VertexBuffer.PositionKind));\r\n }\r\n };\r\n // Instances\r\n /** @hidden */\r\n Mesh._instancedMeshFactory = function (name, mesh) {\r\n throw _DevTools.WarnImport(\"InstancedMesh\");\r\n };\r\n /** @hidden */\r\n Mesh._PhysicsImpostorParser = function (scene, physicObject, jsonObject) {\r\n throw _DevTools.WarnImport(\"PhysicsImpostor\");\r\n };\r\n /**\r\n * Creates a new InstancedMesh object from the mesh model.\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_instances\r\n * @param name defines the name of the new instance\r\n * @returns a new InstancedMesh\r\n */\r\n Mesh.prototype.createInstance = function (name) {\r\n var geometry = this.geometry;\r\n if (geometry && geometry.meshes.length > 1) {\r\n var others = geometry.meshes.slice(0);\r\n for (var _i = 0, others_1 = others; _i < others_1.length; _i++) {\r\n var other = others_1[_i];\r\n if (other === this) {\r\n continue;\r\n }\r\n other.makeGeometryUnique();\r\n }\r\n }\r\n return Mesh._instancedMeshFactory(name, this);\r\n };\r\n /**\r\n * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.\r\n * After this call, all the mesh instances have the same submeshes than the current mesh.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.synchronizeInstances = function () {\r\n if (this._geometry && this._geometry.meshes.length !== 1 && this.instances.length) {\r\n this.makeGeometryUnique();\r\n }\r\n for (var instanceIndex = 0; instanceIndex < this.instances.length; instanceIndex++) {\r\n var instance = this.instances[instanceIndex];\r\n instance._syncSubMeshes();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Optimization of the mesh's indices, in case a mesh has duplicated vertices.\r\n * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.\r\n * This should be used together with the simplification to avoid disappearing triangles.\r\n * @param successCallback an optional success callback to be called after the optimization finished.\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.optimizeIndices = function (successCallback) {\r\n var _this = this;\r\n var indices = this.getIndices();\r\n var positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n if (!positions || !indices) {\r\n return this;\r\n }\r\n var vectorPositions = new Array();\r\n for (var pos = 0; pos < positions.length; pos = pos + 3) {\r\n vectorPositions.push(Vector3.FromArray(positions, pos));\r\n }\r\n var dupes = new Array();\r\n AsyncLoop.SyncAsyncForLoop(vectorPositions.length, 40, function (iteration) {\r\n var realPos = vectorPositions.length - 1 - iteration;\r\n var testedPosition = vectorPositions[realPos];\r\n for (var j = 0; j < realPos; ++j) {\r\n var againstPosition = vectorPositions[j];\r\n if (testedPosition.equals(againstPosition)) {\r\n dupes[realPos] = j;\r\n break;\r\n }\r\n }\r\n }, function () {\r\n for (var i = 0; i < indices.length; ++i) {\r\n indices[i] = dupes[indices[i]] || indices[i];\r\n }\r\n //indices are now reordered\r\n var originalSubMeshes = _this.subMeshes.slice(0);\r\n _this.setIndices(indices);\r\n _this.subMeshes = originalSubMeshes;\r\n if (successCallback) {\r\n successCallback(_this);\r\n }\r\n });\r\n return this;\r\n };\r\n /**\r\n * Serialize current mesh\r\n * @param serializationObject defines the object which will receive the serialization data\r\n */\r\n Mesh.prototype.serialize = function (serializationObject) {\r\n serializationObject.name = this.name;\r\n serializationObject.id = this.id;\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.type = this.getClassName();\r\n if (Tags && Tags.HasTags(this)) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n serializationObject.position = this.position.asArray();\r\n if (this.rotationQuaternion) {\r\n serializationObject.rotationQuaternion = this.rotationQuaternion.asArray();\r\n }\r\n else if (this.rotation) {\r\n serializationObject.rotation = this.rotation.asArray();\r\n }\r\n serializationObject.scaling = this.scaling.asArray();\r\n if (this._postMultiplyPivotMatrix) {\r\n serializationObject.pivotMatrix = this.getPivotMatrix().asArray();\r\n }\r\n else {\r\n serializationObject.localMatrix = this.getPivotMatrix().asArray();\r\n }\r\n serializationObject.isEnabled = this.isEnabled(false);\r\n serializationObject.isVisible = this.isVisible;\r\n serializationObject.infiniteDistance = this.infiniteDistance;\r\n serializationObject.pickable = this.isPickable;\r\n serializationObject.receiveShadows = this.receiveShadows;\r\n serializationObject.billboardMode = this.billboardMode;\r\n serializationObject.visibility = this.visibility;\r\n serializationObject.checkCollisions = this.checkCollisions;\r\n serializationObject.isBlocker = this.isBlocker;\r\n serializationObject.overrideMaterialSideOrientation = this.overrideMaterialSideOrientation;\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n // Geometry\r\n serializationObject.isUnIndexed = this.isUnIndexed;\r\n var geometry = this._geometry;\r\n if (geometry) {\r\n var geometryId = geometry.id;\r\n serializationObject.geometryId = geometryId;\r\n // SubMeshes\r\n serializationObject.subMeshes = [];\r\n for (var subIndex = 0; subIndex < this.subMeshes.length; subIndex++) {\r\n var subMesh = this.subMeshes[subIndex];\r\n serializationObject.subMeshes.push({\r\n materialIndex: subMesh.materialIndex,\r\n verticesStart: subMesh.verticesStart,\r\n verticesCount: subMesh.verticesCount,\r\n indexStart: subMesh.indexStart,\r\n indexCount: subMesh.indexCount\r\n });\r\n }\r\n }\r\n // Material\r\n if (this.material) {\r\n if (!this.material.doNotSerialize) {\r\n serializationObject.materialId = this.material.id;\r\n }\r\n }\r\n else {\r\n this.material = null;\r\n }\r\n // Morph targets\r\n if (this.morphTargetManager) {\r\n serializationObject.morphTargetManagerId = this.morphTargetManager.uniqueId;\r\n }\r\n // Skeleton\r\n if (this.skeleton) {\r\n serializationObject.skeletonId = this.skeleton.id;\r\n serializationObject.numBoneInfluencers = this.numBoneInfluencers;\r\n }\r\n // Physics\r\n //TODO implement correct serialization for physics impostors.\r\n if (this.getScene()._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE)) {\r\n var impostor = this.getPhysicsImpostor();\r\n if (impostor) {\r\n serializationObject.physicsMass = impostor.getParam(\"mass\");\r\n serializationObject.physicsFriction = impostor.getParam(\"friction\");\r\n serializationObject.physicsRestitution = impostor.getParam(\"mass\");\r\n serializationObject.physicsImpostor = impostor.type;\r\n }\r\n }\r\n // Metadata\r\n if (this.metadata) {\r\n serializationObject.metadata = this.metadata;\r\n }\r\n // Instances\r\n serializationObject.instances = [];\r\n for (var index = 0; index < this.instances.length; index++) {\r\n var instance = this.instances[index];\r\n if (instance.doNotSerialize) {\r\n continue;\r\n }\r\n var serializationInstance = {\r\n name: instance.name,\r\n id: instance.id,\r\n isEnabled: instance.isEnabled(false),\r\n isVisible: instance.isVisible,\r\n isPickable: instance.isPickable,\r\n checkCollisions: instance.checkCollisions,\r\n position: instance.position.asArray(),\r\n scaling: instance.scaling.asArray()\r\n };\r\n if (instance.parent) {\r\n serializationInstance.parentId = instance.parent.id;\r\n }\r\n if (instance.rotationQuaternion) {\r\n serializationInstance.rotationQuaternion = instance.rotationQuaternion.asArray();\r\n }\r\n else if (instance.rotation) {\r\n serializationInstance.rotation = instance.rotation.asArray();\r\n }\r\n // Physics\r\n //TODO implement correct serialization for physics impostors.\r\n if (this.getScene()._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE)) {\r\n var impostor = instance.getPhysicsImpostor();\r\n if (impostor) {\r\n serializationInstance.physicsMass = impostor.getParam(\"mass\");\r\n serializationInstance.physicsFriction = impostor.getParam(\"friction\");\r\n serializationInstance.physicsRestitution = impostor.getParam(\"mass\");\r\n serializationInstance.physicsImpostor = impostor.type;\r\n }\r\n }\r\n // Metadata\r\n if (instance.metadata) {\r\n serializationInstance.metadata = instance.metadata;\r\n }\r\n serializationObject.instances.push(serializationInstance);\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(instance, serializationInstance);\r\n serializationInstance.ranges = instance.serializeAnimationRanges();\r\n }\r\n // Thin instances\r\n if (this._thinInstanceDataStorage.instancesCount && this._thinInstanceDataStorage.matrixData) {\r\n serializationObject.thinInstances = {\r\n instancesCount: this._thinInstanceDataStorage.instancesCount,\r\n matrixData: Tools.SliceToArray(this._thinInstanceDataStorage.matrixData),\r\n matrixBufferSize: this._thinInstanceDataStorage.matrixBufferSize,\r\n };\r\n if (this._userThinInstanceBuffersStorage) {\r\n var userThinInstance = {\r\n data: {},\r\n sizes: {},\r\n strides: {},\r\n };\r\n for (var kind in this._userThinInstanceBuffersStorage.data) {\r\n userThinInstance.data[kind] = Tools.SliceToArray(this._userThinInstanceBuffersStorage.data[kind]);\r\n userThinInstance.sizes[kind] = this._userThinInstanceBuffersStorage.sizes[kind];\r\n userThinInstance.strides[kind] = this._userThinInstanceBuffersStorage.strides[kind];\r\n }\r\n serializationObject.thinInstances.userThinInstance = userThinInstance;\r\n }\r\n }\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n serializationObject.ranges = this.serializeAnimationRanges();\r\n // Layer mask\r\n serializationObject.layerMask = this.layerMask;\r\n // Alpha\r\n serializationObject.alphaIndex = this.alphaIndex;\r\n serializationObject.hasVertexAlpha = this.hasVertexAlpha;\r\n // Overlay\r\n serializationObject.overlayAlpha = this.overlayAlpha;\r\n serializationObject.overlayColor = this.overlayColor.asArray();\r\n serializationObject.renderOverlay = this.renderOverlay;\r\n // Fog\r\n serializationObject.applyFog = this.applyFog;\r\n // Action Manager\r\n if (this.actionManager) {\r\n serializationObject.actions = this.actionManager.serialize(this.name);\r\n }\r\n };\r\n /** @hidden */\r\n Mesh.prototype._syncGeometryWithMorphTargetManager = function () {\r\n if (!this.geometry) {\r\n return;\r\n }\r\n this._markSubMeshesAsAttributesDirty();\r\n var morphTargetManager = this._internalMeshDataInfo._morphTargetManager;\r\n if (morphTargetManager && morphTargetManager.vertexCount) {\r\n if (morphTargetManager.vertexCount !== this.getTotalVertices()) {\r\n Logger.Error(\"Mesh is incompatible with morph targets. Targets and mesh must all have the same vertices count.\");\r\n this.morphTargetManager = null;\r\n return;\r\n }\r\n for (var index = 0; index < morphTargetManager.numInfluencers; index++) {\r\n var morphTarget = morphTargetManager.getActiveTarget(index);\r\n var positions = morphTarget.getPositions();\r\n if (!positions) {\r\n Logger.Error(\"Invalid morph target. Target must have positions.\");\r\n return;\r\n }\r\n this.geometry.setVerticesData(VertexBuffer.PositionKind + index, positions, false, 3);\r\n var normals = morphTarget.getNormals();\r\n if (normals) {\r\n this.geometry.setVerticesData(VertexBuffer.NormalKind + index, normals, false, 3);\r\n }\r\n var tangents = morphTarget.getTangents();\r\n if (tangents) {\r\n this.geometry.setVerticesData(VertexBuffer.TangentKind + index, tangents, false, 3);\r\n }\r\n var uvs = morphTarget.getUVs();\r\n if (uvs) {\r\n this.geometry.setVerticesData(VertexBuffer.UVKind + \"_\" + index, uvs, false, 2);\r\n }\r\n }\r\n }\r\n else {\r\n var index = 0;\r\n // Positions\r\n while (this.geometry.isVerticesDataPresent(VertexBuffer.PositionKind + index)) {\r\n this.geometry.removeVerticesData(VertexBuffer.PositionKind + index);\r\n if (this.geometry.isVerticesDataPresent(VertexBuffer.NormalKind + index)) {\r\n this.geometry.removeVerticesData(VertexBuffer.NormalKind + index);\r\n }\r\n if (this.geometry.isVerticesDataPresent(VertexBuffer.TangentKind + index)) {\r\n this.geometry.removeVerticesData(VertexBuffer.TangentKind + index);\r\n }\r\n if (this.geometry.isVerticesDataPresent(VertexBuffer.UVKind + index)) {\r\n this.geometry.removeVerticesData(VertexBuffer.UVKind + \"_\" + index);\r\n }\r\n index++;\r\n }\r\n }\r\n };\r\n /**\r\n * Returns a new Mesh object parsed from the source provided.\r\n * @param parsedMesh is the source\r\n * @param scene defines the hosting scene\r\n * @param rootUrl is the root URL to prefix the `delayLoadingFile` property with\r\n * @returns a new Mesh\r\n */\r\n Mesh.Parse = function (parsedMesh, scene, rootUrl) {\r\n var mesh;\r\n if (parsedMesh.type && parsedMesh.type === \"GroundMesh\") {\r\n mesh = Mesh._GroundMeshParser(parsedMesh, scene);\r\n }\r\n else {\r\n mesh = new Mesh(parsedMesh.name, scene);\r\n }\r\n mesh.id = parsedMesh.id;\r\n if (Tags) {\r\n Tags.AddTagsTo(mesh, parsedMesh.tags);\r\n }\r\n mesh.position = Vector3.FromArray(parsedMesh.position);\r\n if (parsedMesh.metadata !== undefined) {\r\n mesh.metadata = parsedMesh.metadata;\r\n }\r\n if (parsedMesh.rotationQuaternion) {\r\n mesh.rotationQuaternion = Quaternion.FromArray(parsedMesh.rotationQuaternion);\r\n }\r\n else if (parsedMesh.rotation) {\r\n mesh.rotation = Vector3.FromArray(parsedMesh.rotation);\r\n }\r\n mesh.scaling = Vector3.FromArray(parsedMesh.scaling);\r\n if (parsedMesh.localMatrix) {\r\n mesh.setPreTransformMatrix(Matrix.FromArray(parsedMesh.localMatrix));\r\n }\r\n else if (parsedMesh.pivotMatrix) {\r\n mesh.setPivotMatrix(Matrix.FromArray(parsedMesh.pivotMatrix));\r\n }\r\n mesh.setEnabled(parsedMesh.isEnabled);\r\n mesh.isVisible = parsedMesh.isVisible;\r\n mesh.infiniteDistance = parsedMesh.infiniteDistance;\r\n mesh.showBoundingBox = parsedMesh.showBoundingBox;\r\n mesh.showSubMeshesBoundingBox = parsedMesh.showSubMeshesBoundingBox;\r\n if (parsedMesh.applyFog !== undefined) {\r\n mesh.applyFog = parsedMesh.applyFog;\r\n }\r\n if (parsedMesh.pickable !== undefined) {\r\n mesh.isPickable = parsedMesh.pickable;\r\n }\r\n if (parsedMesh.alphaIndex !== undefined) {\r\n mesh.alphaIndex = parsedMesh.alphaIndex;\r\n }\r\n mesh.receiveShadows = parsedMesh.receiveShadows;\r\n mesh.billboardMode = parsedMesh.billboardMode;\r\n if (parsedMesh.visibility !== undefined) {\r\n mesh.visibility = parsedMesh.visibility;\r\n }\r\n mesh.checkCollisions = parsedMesh.checkCollisions;\r\n mesh.overrideMaterialSideOrientation = parsedMesh.overrideMaterialSideOrientation;\r\n if (parsedMesh.isBlocker !== undefined) {\r\n mesh.isBlocker = parsedMesh.isBlocker;\r\n }\r\n mesh._shouldGenerateFlatShading = parsedMesh.useFlatShading;\r\n // freezeWorldMatrix\r\n if (parsedMesh.freezeWorldMatrix) {\r\n mesh._waitingData.freezeWorldMatrix = parsedMesh.freezeWorldMatrix;\r\n }\r\n // Parent\r\n if (parsedMesh.parentId) {\r\n mesh._waitingParentId = parsedMesh.parentId;\r\n }\r\n // Actions\r\n if (parsedMesh.actions !== undefined) {\r\n mesh._waitingData.actions = parsedMesh.actions;\r\n }\r\n // Overlay\r\n if (parsedMesh.overlayAlpha !== undefined) {\r\n mesh.overlayAlpha = parsedMesh.overlayAlpha;\r\n }\r\n if (parsedMesh.overlayColor !== undefined) {\r\n mesh.overlayColor = Color3.FromArray(parsedMesh.overlayColor);\r\n }\r\n if (parsedMesh.renderOverlay !== undefined) {\r\n mesh.renderOverlay = parsedMesh.renderOverlay;\r\n }\r\n // Geometry\r\n mesh.isUnIndexed = !!parsedMesh.isUnIndexed;\r\n mesh.hasVertexAlpha = parsedMesh.hasVertexAlpha;\r\n if (parsedMesh.delayLoadingFile) {\r\n mesh.delayLoadState = 4;\r\n mesh.delayLoadingFile = rootUrl + parsedMesh.delayLoadingFile;\r\n mesh._boundingInfo = new BoundingInfo(Vector3.FromArray(parsedMesh.boundingBoxMinimum), Vector3.FromArray(parsedMesh.boundingBoxMaximum));\r\n if (parsedMesh._binaryInfo) {\r\n mesh._binaryInfo = parsedMesh._binaryInfo;\r\n }\r\n mesh._delayInfo = [];\r\n if (parsedMesh.hasUVs) {\r\n mesh._delayInfo.push(VertexBuffer.UVKind);\r\n }\r\n if (parsedMesh.hasUVs2) {\r\n mesh._delayInfo.push(VertexBuffer.UV2Kind);\r\n }\r\n if (parsedMesh.hasUVs3) {\r\n mesh._delayInfo.push(VertexBuffer.UV3Kind);\r\n }\r\n if (parsedMesh.hasUVs4) {\r\n mesh._delayInfo.push(VertexBuffer.UV4Kind);\r\n }\r\n if (parsedMesh.hasUVs5) {\r\n mesh._delayInfo.push(VertexBuffer.UV5Kind);\r\n }\r\n if (parsedMesh.hasUVs6) {\r\n mesh._delayInfo.push(VertexBuffer.UV6Kind);\r\n }\r\n if (parsedMesh.hasColors) {\r\n mesh._delayInfo.push(VertexBuffer.ColorKind);\r\n }\r\n if (parsedMesh.hasMatricesIndices) {\r\n mesh._delayInfo.push(VertexBuffer.MatricesIndicesKind);\r\n }\r\n if (parsedMesh.hasMatricesWeights) {\r\n mesh._delayInfo.push(VertexBuffer.MatricesWeightsKind);\r\n }\r\n mesh._delayLoadingFunction = Geometry._ImportGeometry;\r\n if (SceneLoaderFlags.ForceFullSceneLoadingForIncremental) {\r\n mesh._checkDelayState();\r\n }\r\n }\r\n else {\r\n Geometry._ImportGeometry(parsedMesh, mesh);\r\n }\r\n // Material\r\n if (parsedMesh.materialId) {\r\n mesh.setMaterialByID(parsedMesh.materialId);\r\n }\r\n else {\r\n mesh.material = null;\r\n }\r\n // Morph targets\r\n if (parsedMesh.morphTargetManagerId > -1) {\r\n mesh.morphTargetManager = scene.getMorphTargetManagerById(parsedMesh.morphTargetManagerId);\r\n }\r\n // Skeleton\r\n if (parsedMesh.skeletonId !== undefined && parsedMesh.skeletonId !== null) {\r\n mesh.skeleton = scene.getLastSkeletonByID(parsedMesh.skeletonId);\r\n if (parsedMesh.numBoneInfluencers) {\r\n mesh.numBoneInfluencers = parsedMesh.numBoneInfluencers;\r\n }\r\n }\r\n // Animations\r\n if (parsedMesh.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedMesh.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedMesh.animations[animationIndex];\r\n var internalClass = _TypeStore.GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n mesh.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n Node.ParseAnimationRanges(mesh, parsedMesh, scene);\r\n }\r\n if (parsedMesh.autoAnimate) {\r\n scene.beginAnimation(mesh, parsedMesh.autoAnimateFrom, parsedMesh.autoAnimateTo, parsedMesh.autoAnimateLoop, parsedMesh.autoAnimateSpeed || 1.0);\r\n }\r\n // Layer Mask\r\n if (parsedMesh.layerMask && (!isNaN(parsedMesh.layerMask))) {\r\n mesh.layerMask = Math.abs(parseInt(parsedMesh.layerMask));\r\n }\r\n else {\r\n mesh.layerMask = 0x0FFFFFFF;\r\n }\r\n // Physics\r\n if (parsedMesh.physicsImpostor) {\r\n Mesh._PhysicsImpostorParser(scene, mesh, parsedMesh);\r\n }\r\n // Levels\r\n if (parsedMesh.lodMeshIds) {\r\n mesh._waitingData.lods = {\r\n ids: parsedMesh.lodMeshIds,\r\n distances: (parsedMesh.lodDistances) ? parsedMesh.lodDistances : null,\r\n coverages: (parsedMesh.lodCoverages) ? parsedMesh.lodCoverages : null\r\n };\r\n }\r\n // Instances\r\n if (parsedMesh.instances) {\r\n for (var index = 0; index < parsedMesh.instances.length; index++) {\r\n var parsedInstance = parsedMesh.instances[index];\r\n var instance = mesh.createInstance(parsedInstance.name);\r\n if (parsedInstance.id) {\r\n instance.id = parsedInstance.id;\r\n }\r\n if (Tags) {\r\n if (parsedInstance.tags) {\r\n Tags.AddTagsTo(instance, parsedInstance.tags);\r\n }\r\n else {\r\n Tags.AddTagsTo(instance, parsedMesh.tags);\r\n }\r\n }\r\n instance.position = Vector3.FromArray(parsedInstance.position);\r\n if (parsedInstance.metadata !== undefined) {\r\n instance.metadata = parsedInstance.metadata;\r\n }\r\n if (parsedInstance.parentId) {\r\n instance._waitingParentId = parsedInstance.parentId;\r\n }\r\n if (parsedInstance.isEnabled !== undefined && parsedInstance.isEnabled !== null) {\r\n instance.setEnabled(parsedInstance.isEnabled);\r\n }\r\n if (parsedInstance.isVisible !== undefined && parsedInstance.isVisible !== null) {\r\n instance.isVisible = parsedInstance.isVisible;\r\n }\r\n if (parsedInstance.isPickable !== undefined && parsedInstance.isPickable !== null) {\r\n instance.isPickable = parsedInstance.isPickable;\r\n }\r\n if (parsedInstance.rotationQuaternion) {\r\n instance.rotationQuaternion = Quaternion.FromArray(parsedInstance.rotationQuaternion);\r\n }\r\n else if (parsedInstance.rotation) {\r\n instance.rotation = Vector3.FromArray(parsedInstance.rotation);\r\n }\r\n instance.scaling = Vector3.FromArray(parsedInstance.scaling);\r\n if (parsedInstance.checkCollisions != undefined && parsedInstance.checkCollisions != null) {\r\n instance.checkCollisions = parsedInstance.checkCollisions;\r\n }\r\n if (parsedInstance.pickable != undefined && parsedInstance.pickable != null) {\r\n instance.isPickable = parsedInstance.pickable;\r\n }\r\n if (parsedInstance.showBoundingBox != undefined && parsedInstance.showBoundingBox != null) {\r\n instance.showBoundingBox = parsedInstance.showBoundingBox;\r\n }\r\n if (parsedInstance.showSubMeshesBoundingBox != undefined && parsedInstance.showSubMeshesBoundingBox != null) {\r\n instance.showSubMeshesBoundingBox = parsedInstance.showSubMeshesBoundingBox;\r\n }\r\n if (parsedInstance.alphaIndex != undefined && parsedInstance.showSubMeshesBoundingBox != null) {\r\n instance.alphaIndex = parsedInstance.alphaIndex;\r\n }\r\n // Physics\r\n if (parsedInstance.physicsImpostor) {\r\n Mesh._PhysicsImpostorParser(scene, instance, parsedInstance);\r\n }\r\n // Animation\r\n if (parsedInstance.animations) {\r\n for (animationIndex = 0; animationIndex < parsedInstance.animations.length; animationIndex++) {\r\n parsedAnimation = parsedInstance.animations[animationIndex];\r\n var internalClass = _TypeStore.GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n instance.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n Node.ParseAnimationRanges(instance, parsedInstance, scene);\r\n if (parsedInstance.autoAnimate) {\r\n scene.beginAnimation(instance, parsedInstance.autoAnimateFrom, parsedInstance.autoAnimateTo, parsedInstance.autoAnimateLoop, parsedInstance.autoAnimateSpeed || 1.0);\r\n }\r\n }\r\n }\r\n }\r\n // Thin instances\r\n if (parsedMesh.thinInstances) {\r\n var thinInstances = parsedMesh.thinInstances;\r\n if (thinInstances.matrixData) {\r\n mesh.thinInstanceSetBuffer(\"matrix\", new Float32Array(thinInstances.matrixData), 16, false);\r\n mesh._thinInstanceDataStorage.matrixBufferSize = thinInstances.matrixBufferSize;\r\n mesh._thinInstanceDataStorage.instancesCount = thinInstances.instancesCount;\r\n }\r\n else {\r\n mesh._thinInstanceDataStorage.matrixBufferSize = thinInstances.matrixBufferSize;\r\n }\r\n if (parsedMesh.thinInstances.userThinInstance) {\r\n var userThinInstance = parsedMesh.thinInstances.userThinInstance;\r\n for (var kind in userThinInstance.data) {\r\n mesh.thinInstanceSetBuffer(kind, new Float32Array(userThinInstance.data[kind]), userThinInstance.strides[kind], false);\r\n mesh._userThinInstanceBuffersStorage.sizes[kind] = userThinInstance.sizes[kind];\r\n }\r\n }\r\n }\r\n return mesh;\r\n };\r\n /**\r\n * Creates a ribbon mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @param name defines the name of the mesh to create\r\n * @param pathArray is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.\r\n * @param closeArray creates a seam between the first and the last paths of the path array (default is false)\r\n * @param closePath creates a seam between the first and the last points of each path of the path array\r\n * @param offset is taken in account only if the `pathArray` is containing a single path\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance defines an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#ribbon)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateRibbon = function (name, pathArray, closeArray, closePath, offset, scene, updatable, sideOrientation, instance) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a plane polygonal mesh. By default, this is a disc. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param radius sets the radius size (float) of the polygon (default 0.5)\r\n * @param tessellation sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateDisc = function (name, radius, tessellation, scene, updatable, sideOrientation) {\r\n if (scene === void 0) { scene = null; }\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a box mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param size sets the size (float) of each box side (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateBox = function (name, size, scene, updatable, sideOrientation) {\r\n if (scene === void 0) { scene = null; }\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a sphere mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * @param diameter sets the diameter size (float) of the sphere (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateSphere = function (name, segments, diameter, scene, updatable, sideOrientation) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a hemisphere mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\r\n * @param diameter sets the diameter size (float) of the sphere (default 1)\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateHemisphere = function (name, segments, diameter, scene) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a cylinder or a cone mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param height sets the height size (float) of the cylinder/cone (float, default 2)\r\n * @param diameterTop set the top cap diameter (floats, default 1)\r\n * @param diameterBottom set the bottom cap diameter (floats, default 1). This value can't be zero\r\n * @param tessellation sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance\r\n * @param subdivisions sets the number of rings along the cylinder height (positive integer, default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateCylinder = function (name, height, diameterTop, diameterBottom, tessellation, subdivisions, scene, updatable, sideOrientation) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n // Torus (Code from SharpDX.org)\r\n /**\r\n * Creates a torus mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param diameter sets the diameter size (float) of the torus (default 1)\r\n * @param thickness sets the diameter size of the tube of the torus (float, default 0.5)\r\n * @param tessellation sets the number of torus sides (postive integer, default 16)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTorus = function (name, diameter, thickness, tessellation, scene, updatable, sideOrientation) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a torus knot mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param radius sets the global radius size (float) of the torus knot (default 2)\r\n * @param tube sets the diameter size of the tube of the torus (float, default 0.5)\r\n * @param radialSegments sets the number of sides on each tube segments (positive integer, default 32)\r\n * @param tubularSegments sets the number of tubes to decompose the knot into (positive integer, default 32)\r\n * @param p the number of windings on X axis (positive integers, default 2)\r\n * @param q the number of windings on Y axis (positive integers, default 3)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTorusKnot = function (name, radius, tube, radialSegments, tubularSegments, p, q, scene, updatable, sideOrientation) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a line mesh. Please consider using the same method from the MeshBuilder class instead.\r\n * @param name defines the name of the mesh to create\r\n * @param points is an array successive Vector3\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines).\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateLines = function (name, points, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n if (updatable === void 0) { updatable = false; }\r\n if (instance === void 0) { instance = null; }\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a dashed line mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param points is an array successive Vector3\r\n * @param dashSize is the size of the dashes relatively the dash number (positive float, default 3)\r\n * @param gapSize is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * @param dashNb is the intended total number of dashes (positive integer, default 200)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateDashedLines = function (name, points, dashSize, gapSize, dashNb, scene, updatable, instance) {\r\n if (scene === void 0) { scene = null; }\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a polygon mesh.Please consider using the same method from the MeshBuilder class instead\r\n * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.\r\n * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors.\r\n * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * Remember you can only change the shape positions, not their number when updating a polygon.\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#non-regular-polygon\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * @param scene defines the hosting scene\r\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreatePolygon = function (name, shape, scene, holes, updatable, sideOrientation, earcutInjection) {\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates an extruded polygon mesh, with depth in the Y direction. Please consider using the same method from the MeshBuilder class instead.\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-non-regular-polygon\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\r\n * @param depth defines the height of extrusion\r\n * @param scene defines the hosting scene\r\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns a new Mesh\r\n */\r\n Mesh.ExtrudePolygon = function (name, shape, depth, scene, holes, updatable, sideOrientation, earcutInjection) {\r\n if (earcutInjection === void 0) { earcutInjection = earcut; }\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates an extruded shape mesh.\r\n * The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters. Please consider using the same method from the MeshBuilder class instead\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\r\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\r\n * @param scale is the value to scale the shape\r\n * @param rotation is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#extruded-shape)\r\n * @returns a new Mesh\r\n */\r\n Mesh.ExtrudeShape = function (name, shape, path, scale, rotation, cap, scene, updatable, sideOrientation, instance) {\r\n if (scene === void 0) { scene = null; }\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates an custom extruded shape mesh.\r\n * The custom extrusion is a parametric shape.\r\n * It has no predefined shape. Its final shape will depend on the input parameters.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\r\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\r\n * @param scaleFunction is a custom Javascript function called on each path point\r\n * @param rotationFunction is a custom Javascript function called on each path point\r\n * @param ribbonCloseArray forces the extrusion underlying ribbon to close all the paths in its `pathArray`\r\n * @param ribbonClosePath forces the extrusion underlying ribbon to close its `pathArray`\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape)\r\n * @returns a new Mesh\r\n */\r\n Mesh.ExtrudeShapeCustom = function (name, shape, path, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, scene, updatable, sideOrientation, instance) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates lathe mesh.\r\n * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param shape is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\r\n * @param radius is the radius value of the lathe\r\n * @param tessellation is the side number of the lathe.\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateLathe = function (name, shape, radius, tessellation, scene, updatable, sideOrientation) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a plane mesh. Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param size sets the size (float) of both sides of the plane at once (default 1)\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreatePlane = function (name, size, scene, updatable, sideOrientation) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a ground mesh.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param width set the width of the ground\r\n * @param height set the height of the ground\r\n * @param subdivisions sets the number of subdivisions per side\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateGround = function (name, width, height, subdivisions, scene, updatable) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a tiled ground mesh.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @param name defines the name of the mesh to create\r\n * @param xmin set the ground minimum X coordinate\r\n * @param zmin set the ground minimum Y coordinate\r\n * @param xmax set the ground maximum X coordinate\r\n * @param zmax set the ground maximum Z coordinate\r\n * @param subdivisions is an object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * @param precision is an object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTiledGround = function (name, xmin, zmin, xmax, zmax, subdivisions, precision, scene, updatable) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a ground mesh from a height map.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @see https://doc.babylonjs.com/babylon101/height_map\r\n * @param name defines the name of the mesh to create\r\n * @param url sets the URL of the height map image resource\r\n * @param width set the ground width size\r\n * @param height set the ground height size\r\n * @param subdivisions sets the number of subdivision per side\r\n * @param minHeight is the minimum altitude on the ground\r\n * @param maxHeight is the maximum altitude on the ground\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param onReady is a callback function that will be called once the mesh is built (the height map download can last some time)\r\n * @param alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateGroundFromHeightMap = function (name, url, width, height, subdivisions, minHeight, maxHeight, scene, updatable, onReady, alphaFilter) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a tube mesh.\r\n * The tube is a parametric shape.\r\n * It has no predefined shape. Its final shape will depend on the input parameters.\r\n * Please consider using the same method from the MeshBuilder class instead\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes\r\n * @param name defines the name of the mesh to create\r\n * @param path is a required array of successive Vector3. It is the curve used as the axis of the tube\r\n * @param radius sets the tube radius size\r\n * @param tessellation is the number of sides on the tubular surface\r\n * @param radiusFunction is a custom function. If it is not null, it overwrittes the parameter `radius`. This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path\r\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\r\n * @param scene defines the hosting scene\r\n * @param updatable defines if the mesh must be flagged as updatable\r\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)\r\n * @param instance is an instance of an existing Tube object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#tube)\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateTube = function (name, path, radius, tessellation, radiusFunction, cap, scene, updatable, sideOrientation, instance) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a polyhedron mesh.\r\n * Please consider using the same method from the MeshBuilder class instead.\r\n * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type\r\n * * The parameter `size` (positive float, default 1) sets the polygon size\r\n * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)\r\n * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`\r\n * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron\r\n * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)\r\n * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors\r\n * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored\r\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh to create\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreatePolyhedron = function (name, options, scene) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\r\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\r\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`)\r\n * * The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\r\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\r\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns a new Mesh\r\n * @see https://doc.babylonjs.com/how_to/polyhedra_shapes#icosphere\r\n */\r\n Mesh.CreateIcoSphere = function (name, options, scene) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /**\r\n * Creates a decal mesh.\r\n * Please consider using the same method from the MeshBuilder class instead.\r\n * A decal is a mesh usually applied as a model onto the surface of another mesh\r\n * @param name defines the name of the mesh\r\n * @param sourceMesh defines the mesh receiving the decal\r\n * @param position sets the position of the decal in world coordinates\r\n * @param normal sets the normal of the mesh where the decal is applied onto in world coordinates\r\n * @param size sets the decal scaling\r\n * @param angle sets the angle to rotate the decal\r\n * @returns a new Mesh\r\n */\r\n Mesh.CreateDecal = function (name, sourceMesh, position, normal, size, angle) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n /** Creates a Capsule Mesh\r\n * @param name defines the name of the mesh.\r\n * @param options the constructors options used to shape the mesh.\r\n * @param scene defines the scene the mesh is scoped to.\r\n * @returns the capsule mesh\r\n * @see https://doc.babylonjs.com/how_to/capsule_shape\r\n */\r\n Mesh.CreateCapsule = function (name, options, scene) {\r\n throw _DevTools.WarnImport(\"MeshBuilder\");\r\n };\r\n // Skeletons\r\n /**\r\n * Prepare internal position array for software CPU skinning\r\n * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh\r\n */\r\n Mesh.prototype.setPositionsForCPUSkinning = function () {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._sourcePositions) {\r\n var source = this.getVerticesData(VertexBuffer.PositionKind);\r\n if (!source) {\r\n return internalDataInfo._sourcePositions;\r\n }\r\n internalDataInfo._sourcePositions = new Float32Array(source);\r\n if (!this.isVertexBufferUpdatable(VertexBuffer.PositionKind)) {\r\n this.setVerticesData(VertexBuffer.PositionKind, source, true);\r\n }\r\n }\r\n return internalDataInfo._sourcePositions;\r\n };\r\n /**\r\n * Prepare internal normal array for software CPU skinning\r\n * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.\r\n */\r\n Mesh.prototype.setNormalsForCPUSkinning = function () {\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._sourceNormals) {\r\n var source = this.getVerticesData(VertexBuffer.NormalKind);\r\n if (!source) {\r\n return internalDataInfo._sourceNormals;\r\n }\r\n internalDataInfo._sourceNormals = new Float32Array(source);\r\n if (!this.isVertexBufferUpdatable(VertexBuffer.NormalKind)) {\r\n this.setVerticesData(VertexBuffer.NormalKind, source, true);\r\n }\r\n }\r\n return internalDataInfo._sourceNormals;\r\n };\r\n /**\r\n * Updates the vertex buffer by applying transformation from the bones\r\n * @param skeleton defines the skeleton to apply to current mesh\r\n * @returns the current mesh\r\n */\r\n Mesh.prototype.applySkeleton = function (skeleton) {\r\n if (!this.geometry) {\r\n return this;\r\n }\r\n if (this.geometry._softwareSkinningFrameId == this.getScene().getFrameId()) {\r\n return this;\r\n }\r\n this.geometry._softwareSkinningFrameId = this.getScene().getFrameId();\r\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\r\n return this;\r\n }\r\n if (!this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\r\n return this;\r\n }\r\n if (!this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\r\n return this;\r\n }\r\n var hasNormals = this.isVerticesDataPresent(VertexBuffer.NormalKind);\r\n var internalDataInfo = this._internalMeshDataInfo;\r\n if (!internalDataInfo._sourcePositions) {\r\n var submeshes = this.subMeshes.slice();\r\n this.setPositionsForCPUSkinning();\r\n this.subMeshes = submeshes;\r\n }\r\n if (hasNormals && !internalDataInfo._sourceNormals) {\r\n this.setNormalsForCPUSkinning();\r\n }\r\n // positionsData checks for not being Float32Array will only pass at most once\r\n var positionsData = this.getVerticesData(VertexBuffer.PositionKind);\r\n if (!positionsData) {\r\n return this;\r\n }\r\n if (!(positionsData instanceof Float32Array)) {\r\n positionsData = new Float32Array(positionsData);\r\n }\r\n // normalsData checks for not being Float32Array will only pass at most once\r\n var normalsData = this.getVerticesData(VertexBuffer.NormalKind);\r\n if (hasNormals) {\r\n if (!normalsData) {\r\n return this;\r\n }\r\n if (!(normalsData instanceof Float32Array)) {\r\n normalsData = new Float32Array(normalsData);\r\n }\r\n }\r\n var matricesIndicesData = this.getVerticesData(VertexBuffer.MatricesIndicesKind);\r\n var matricesWeightsData = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\r\n if (!matricesWeightsData || !matricesIndicesData) {\r\n return this;\r\n }\r\n var needExtras = this.numBoneInfluencers > 4;\r\n var matricesIndicesExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\r\n var matricesWeightsExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\r\n var skeletonMatrices = skeleton.getTransformMatrices(this);\r\n var tempVector3 = Vector3.Zero();\r\n var finalMatrix = new Matrix();\r\n var tempMatrix = new Matrix();\r\n var matWeightIdx = 0;\r\n var inf;\r\n for (var index = 0; index < positionsData.length; index += 3, matWeightIdx += 4) {\r\n var weight;\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n if (needExtras) {\r\n for (inf = 0; inf < 4; inf++) {\r\n weight = matricesWeightsExtraData[matWeightIdx + inf];\r\n if (weight > 0) {\r\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesExtraData[matWeightIdx + inf] * 16), weight, tempMatrix);\r\n finalMatrix.addToSelf(tempMatrix);\r\n }\r\n }\r\n }\r\n Vector3.TransformCoordinatesFromFloatsToRef(internalDataInfo._sourcePositions[index], internalDataInfo._sourcePositions[index + 1], internalDataInfo._sourcePositions[index + 2], finalMatrix, tempVector3);\r\n tempVector3.toArray(positionsData, index);\r\n if (hasNormals) {\r\n Vector3.TransformNormalFromFloatsToRef(internalDataInfo._sourceNormals[index], internalDataInfo._sourceNormals[index + 1], internalDataInfo._sourceNormals[index + 2], finalMatrix, tempVector3);\r\n tempVector3.toArray(normalsData, index);\r\n }\r\n finalMatrix.reset();\r\n }\r\n this.updateVerticesData(VertexBuffer.PositionKind, positionsData);\r\n if (hasNormals) {\r\n this.updateVerticesData(VertexBuffer.NormalKind, normalsData);\r\n }\r\n return this;\r\n };\r\n // Tools\r\n /**\r\n * Returns an object containing a min and max Vector3 which are the minimum and maximum vectors of each mesh bounding box from the passed array, in the world coordinates\r\n * @param meshes defines the list of meshes to scan\r\n * @returns an object `{min:` Vector3`, max:` Vector3`}`\r\n */\r\n Mesh.MinMax = function (meshes) {\r\n var minVector = null;\r\n var maxVector = null;\r\n meshes.forEach(function (mesh) {\r\n var boundingInfo = mesh.getBoundingInfo();\r\n var boundingBox = boundingInfo.boundingBox;\r\n if (!minVector || !maxVector) {\r\n minVector = boundingBox.minimumWorld;\r\n maxVector = boundingBox.maximumWorld;\r\n }\r\n else {\r\n minVector.minimizeInPlace(boundingBox.minimumWorld);\r\n maxVector.maximizeInPlace(boundingBox.maximumWorld);\r\n }\r\n });\r\n if (!minVector || !maxVector) {\r\n return {\r\n min: Vector3.Zero(),\r\n max: Vector3.Zero()\r\n };\r\n }\r\n return {\r\n min: minVector,\r\n max: maxVector\r\n };\r\n };\r\n /**\r\n * Returns the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array\r\n * @param meshesOrMinMaxVector could be an array of meshes or a `{min:` Vector3`, max:` Vector3`}` object\r\n * @returns a vector3\r\n */\r\n Mesh.Center = function (meshesOrMinMaxVector) {\r\n var minMaxVector = (meshesOrMinMaxVector instanceof Array) ? Mesh.MinMax(meshesOrMinMaxVector) : meshesOrMinMaxVector;\r\n return Vector3.Center(minMaxVector.min, minMaxVector.max);\r\n };\r\n /**\r\n * Merge the array of meshes into a single mesh for performance reasons.\r\n * @param meshes defines he vertices source. They should all be of the same material. Entries can empty\r\n * @param disposeSource when true (default), dispose of the vertices from the source meshes\r\n * @param allow32BitsIndices when the sum of the vertices > 64k, this must be set to true\r\n * @param meshSubclass when set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.\r\n * @param subdivideWithSubMeshes when true (false default), subdivide mesh to his subMesh array with meshes source.\r\n * @param multiMultiMaterials when true (false default), subdivide mesh and accept multiple multi materials, ignores subdivideWithSubMeshes.\r\n * @returns a new mesh\r\n */\r\n Mesh.MergeMeshes = function (meshes, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials) {\r\n if (disposeSource === void 0) { disposeSource = true; }\r\n var index;\r\n if (!allow32BitsIndices) {\r\n var totalVertices = 0;\r\n // Counting vertices\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n totalVertices += meshes[index].getTotalVertices();\r\n if (totalVertices >= 65536) {\r\n Logger.Warn(\"Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices\");\r\n return null;\r\n }\r\n }\r\n }\r\n }\r\n if (multiMultiMaterials) {\r\n var newMultiMaterial = null;\r\n var subIndex;\r\n var matIndex;\r\n subdivideWithSubMeshes = false;\r\n }\r\n var materialArray = new Array();\r\n var materialIndexArray = new Array();\r\n // Merge\r\n var vertexData = null;\r\n var otherVertexData;\r\n var indiceArray = new Array();\r\n var source = null;\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n var mesh = meshes[index];\r\n if (mesh.isAnInstance) {\r\n Logger.Warn(\"Cannot merge instance meshes.\");\r\n return null;\r\n }\r\n var wm = mesh.computeWorldMatrix(true);\r\n otherVertexData = VertexData.ExtractFromMesh(mesh, true, true);\r\n otherVertexData.transform(wm);\r\n if (vertexData) {\r\n vertexData.merge(otherVertexData, allow32BitsIndices);\r\n }\r\n else {\r\n vertexData = otherVertexData;\r\n source = mesh;\r\n }\r\n if (subdivideWithSubMeshes) {\r\n indiceArray.push(mesh.getTotalIndices());\r\n }\r\n if (multiMultiMaterials) {\r\n if (mesh.material) {\r\n var material = mesh.material;\r\n if (material instanceof MultiMaterial) {\r\n for (matIndex = 0; matIndex < material.subMaterials.length; matIndex++) {\r\n if (materialArray.indexOf(material.subMaterials[matIndex]) < 0) {\r\n materialArray.push(material.subMaterials[matIndex]);\r\n }\r\n }\r\n for (subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\r\n materialIndexArray.push(materialArray.indexOf(material.subMaterials[mesh.subMeshes[subIndex].materialIndex]));\r\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\r\n }\r\n }\r\n else {\r\n if (materialArray.indexOf(material) < 0) {\r\n materialArray.push(material);\r\n }\r\n for (subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\r\n materialIndexArray.push(materialArray.indexOf(material));\r\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\r\n }\r\n }\r\n }\r\n else {\r\n for (subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\r\n materialIndexArray.push(0);\r\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n source = source;\r\n if (!meshSubclass) {\r\n meshSubclass = new Mesh(source.name + \"_merged\", source.getScene());\r\n }\r\n vertexData.applyToMesh(meshSubclass);\r\n // Setting properties\r\n meshSubclass.checkCollisions = source.checkCollisions;\r\n meshSubclass.overrideMaterialSideOrientation = source.overrideMaterialSideOrientation;\r\n // Cleaning\r\n if (disposeSource) {\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n meshes[index].dispose();\r\n }\r\n }\r\n }\r\n // Subdivide\r\n if (subdivideWithSubMeshes || multiMultiMaterials) {\r\n //-- removal of global submesh\r\n meshSubclass.releaseSubMeshes();\r\n index = 0;\r\n var offset = 0;\r\n //-- apply subdivision according to index table\r\n while (index < indiceArray.length) {\r\n SubMesh.CreateFromIndices(0, offset, indiceArray[index], meshSubclass);\r\n offset += indiceArray[index];\r\n index++;\r\n }\r\n }\r\n if (multiMultiMaterials) {\r\n newMultiMaterial = new MultiMaterial(source.name + \"_merged\", source.getScene());\r\n newMultiMaterial.subMaterials = materialArray;\r\n for (subIndex = 0; subIndex < meshSubclass.subMeshes.length; subIndex++) {\r\n meshSubclass.subMeshes[subIndex].materialIndex = materialIndexArray[subIndex];\r\n }\r\n meshSubclass.material = newMultiMaterial;\r\n }\r\n else {\r\n meshSubclass.material = source.material;\r\n }\r\n return meshSubclass;\r\n };\r\n /** @hidden */\r\n Mesh.prototype.addInstance = function (instance) {\r\n instance._indexInSourceMeshInstanceArray = this.instances.length;\r\n this.instances.push(instance);\r\n };\r\n /** @hidden */\r\n Mesh.prototype.removeInstance = function (instance) {\r\n // Remove from mesh\r\n var index = instance._indexInSourceMeshInstanceArray;\r\n if (index != -1) {\r\n if (index !== this.instances.length - 1) {\r\n var last = this.instances[this.instances.length - 1];\r\n this.instances[index] = last;\r\n last._indexInSourceMeshInstanceArray = index;\r\n }\r\n instance._indexInSourceMeshInstanceArray = -1;\r\n this.instances.pop();\r\n }\r\n };\r\n // Consts\r\n /**\r\n * Mesh side orientation : usually the external or front surface\r\n */\r\n Mesh.FRONTSIDE = VertexData.FRONTSIDE;\r\n /**\r\n * Mesh side orientation : usually the internal or back surface\r\n */\r\n Mesh.BACKSIDE = VertexData.BACKSIDE;\r\n /**\r\n * Mesh side orientation : both internal and external or front and back surfaces\r\n */\r\n Mesh.DOUBLESIDE = VertexData.DOUBLESIDE;\r\n /**\r\n * Mesh side orientation : by default, `FRONTSIDE`\r\n */\r\n Mesh.DEFAULTSIDE = VertexData.DEFAULTSIDE;\r\n /**\r\n * Mesh cap setting : no cap\r\n */\r\n Mesh.NO_CAP = 0;\r\n /**\r\n * Mesh cap setting : one cap at the beginning of the mesh\r\n */\r\n Mesh.CAP_START = 1;\r\n /**\r\n * Mesh cap setting : one cap at the end of the mesh\r\n */\r\n Mesh.CAP_END = 2;\r\n /**\r\n * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh\r\n */\r\n Mesh.CAP_ALL = 3;\r\n /**\r\n * Mesh pattern setting : no flip or rotate\r\n */\r\n Mesh.NO_FLIP = 0;\r\n /**\r\n * Mesh pattern setting : flip (reflect in y axis) alternate tiles on each row or column\r\n */\r\n Mesh.FLIP_TILE = 1;\r\n /**\r\n * Mesh pattern setting : rotate (180degs) alternate tiles on each row or column\r\n */\r\n Mesh.ROTATE_TILE = 2;\r\n /**\r\n * Mesh pattern setting : flip (reflect in y axis) all tiles on alternate rows\r\n */\r\n Mesh.FLIP_ROW = 3;\r\n /**\r\n * Mesh pattern setting : rotate (180degs) all tiles on alternate rows\r\n */\r\n Mesh.ROTATE_ROW = 4;\r\n /**\r\n * Mesh pattern setting : flip and rotate alternate tiles on each row or column\r\n */\r\n Mesh.FLIP_N_ROTATE_TILE = 5;\r\n /**\r\n * Mesh pattern setting : rotate pattern and rotate\r\n */\r\n Mesh.FLIP_N_ROTATE_ROW = 6;\r\n /**\r\n * Mesh tile positioning : part tiles same on left/right or top/bottom\r\n */\r\n Mesh.CENTER = 0;\r\n /**\r\n * Mesh tile positioning : part tiles on left\r\n */\r\n Mesh.LEFT = 1;\r\n /**\r\n * Mesh tile positioning : part tiles on right\r\n */\r\n Mesh.RIGHT = 2;\r\n /**\r\n * Mesh tile positioning : part tiles on top\r\n */\r\n Mesh.TOP = 3;\r\n /**\r\n * Mesh tile positioning : part tiles on bottom\r\n */\r\n Mesh.BOTTOM = 4;\r\n // Statics\r\n /** @hidden */\r\n Mesh._GroundMeshParser = function (parsedMesh, scene) {\r\n throw _DevTools.WarnImport(\"GroundMesh\");\r\n };\r\n return Mesh;\r\n}(AbstractMesh));\r\nexport { Mesh };\r\n_TypeStore.RegisteredTypes[\"BABYLON.Mesh\"] = Mesh;\r\n//# sourceMappingURL=mesh.js.map","import { Vector3, Vector4 } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { _DevTools } from '../Misc/devTools';\r\nimport { Color4 } from '../Maths/math.color';\r\nimport { Logger } from '../Misc/logger';\r\n/**\r\n * This class contains the various kinds of data on every vertex of a mesh used in determining its shape and appearance\r\n */\r\nvar VertexData = /** @class */ (function () {\r\n function VertexData() {\r\n }\r\n /**\r\n * Uses the passed data array to set the set the values for the specified kind of data\r\n * @param data a linear array of floating numbers\r\n * @param kind the type of data that is being set, eg positions, colors etc\r\n */\r\n VertexData.prototype.set = function (data, kind) {\r\n if (!data.length) {\r\n Logger.Warn(\"Setting vertex data kind '\" + kind + \"' with an empty array\");\r\n }\r\n switch (kind) {\r\n case VertexBuffer.PositionKind:\r\n this.positions = data;\r\n break;\r\n case VertexBuffer.NormalKind:\r\n this.normals = data;\r\n break;\r\n case VertexBuffer.TangentKind:\r\n this.tangents = data;\r\n break;\r\n case VertexBuffer.UVKind:\r\n this.uvs = data;\r\n break;\r\n case VertexBuffer.UV2Kind:\r\n this.uvs2 = data;\r\n break;\r\n case VertexBuffer.UV3Kind:\r\n this.uvs3 = data;\r\n break;\r\n case VertexBuffer.UV4Kind:\r\n this.uvs4 = data;\r\n break;\r\n case VertexBuffer.UV5Kind:\r\n this.uvs5 = data;\r\n break;\r\n case VertexBuffer.UV6Kind:\r\n this.uvs6 = data;\r\n break;\r\n case VertexBuffer.ColorKind:\r\n this.colors = data;\r\n break;\r\n case VertexBuffer.MatricesIndicesKind:\r\n this.matricesIndices = data;\r\n break;\r\n case VertexBuffer.MatricesWeightsKind:\r\n this.matricesWeights = data;\r\n break;\r\n case VertexBuffer.MatricesIndicesExtraKind:\r\n this.matricesIndicesExtra = data;\r\n break;\r\n case VertexBuffer.MatricesWeightsExtraKind:\r\n this.matricesWeightsExtra = data;\r\n break;\r\n }\r\n };\r\n /**\r\n * Associates the vertexData to the passed Mesh.\r\n * Sets it as updatable or not (default `false`)\r\n * @param mesh the mesh the vertexData is applied to\r\n * @param updatable when used and having the value true allows new data to update the vertexData\r\n * @returns the VertexData\r\n */\r\n VertexData.prototype.applyToMesh = function (mesh, updatable) {\r\n this._applyTo(mesh, updatable);\r\n return this;\r\n };\r\n /**\r\n * Associates the vertexData to the passed Geometry.\r\n * Sets it as updatable or not (default `false`)\r\n * @param geometry the geometry the vertexData is applied to\r\n * @param updatable when used and having the value true allows new data to update the vertexData\r\n * @returns VertexData\r\n */\r\n VertexData.prototype.applyToGeometry = function (geometry, updatable) {\r\n this._applyTo(geometry, updatable);\r\n return this;\r\n };\r\n /**\r\n * Updates the associated mesh\r\n * @param mesh the mesh to be updated\r\n * @param updateExtends when true the mesh BoundingInfo will be renewed when and if position kind is updated, optional with default false\r\n * @param makeItUnique when true, and when and if position kind is updated, a new global geometry will be created from these positions and set to the mesh, optional with default false\r\n * @returns VertexData\r\n */\r\n VertexData.prototype.updateMesh = function (mesh) {\r\n this._update(mesh);\r\n return this;\r\n };\r\n /**\r\n * Updates the associated geometry\r\n * @param geometry the geometry to be updated\r\n * @param updateExtends when true BoundingInfo will be renewed when and if position kind is updated, optional with default false\r\n * @param makeItUnique when true, and when and if position kind is updated, a new global geometry will be created from these positions and set to the mesh, optional with default false\r\n * @returns VertexData.\r\n */\r\n VertexData.prototype.updateGeometry = function (geometry) {\r\n this._update(geometry);\r\n return this;\r\n };\r\n VertexData.prototype._applyTo = function (meshOrGeometry, updatable) {\r\n if (updatable === void 0) { updatable = false; }\r\n if (this.positions) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.PositionKind, this.positions, updatable);\r\n }\r\n if (this.normals) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.NormalKind, this.normals, updatable);\r\n }\r\n if (this.tangents) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.TangentKind, this.tangents, updatable);\r\n }\r\n if (this.uvs) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.UVKind, this.uvs, updatable);\r\n }\r\n if (this.uvs2) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.UV2Kind, this.uvs2, updatable);\r\n }\r\n if (this.uvs3) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.UV3Kind, this.uvs3, updatable);\r\n }\r\n if (this.uvs4) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.UV4Kind, this.uvs4, updatable);\r\n }\r\n if (this.uvs5) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.UV5Kind, this.uvs5, updatable);\r\n }\r\n if (this.uvs6) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.UV6Kind, this.uvs6, updatable);\r\n }\r\n if (this.colors) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.ColorKind, this.colors, updatable);\r\n }\r\n if (this.matricesIndices) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.MatricesIndicesKind, this.matricesIndices, updatable);\r\n }\r\n if (this.matricesWeights) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.MatricesWeightsKind, this.matricesWeights, updatable);\r\n }\r\n if (this.matricesIndicesExtra) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, this.matricesIndicesExtra, updatable);\r\n }\r\n if (this.matricesWeightsExtra) {\r\n meshOrGeometry.setVerticesData(VertexBuffer.MatricesWeightsExtraKind, this.matricesWeightsExtra, updatable);\r\n }\r\n if (this.indices) {\r\n meshOrGeometry.setIndices(this.indices, null, updatable);\r\n }\r\n else {\r\n meshOrGeometry.setIndices([], null);\r\n }\r\n return this;\r\n };\r\n VertexData.prototype._update = function (meshOrGeometry, updateExtends, makeItUnique) {\r\n if (this.positions) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.PositionKind, this.positions, updateExtends, makeItUnique);\r\n }\r\n if (this.normals) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.NormalKind, this.normals, updateExtends, makeItUnique);\r\n }\r\n if (this.tangents) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.TangentKind, this.tangents, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.UVKind, this.uvs, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs2) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.UV2Kind, this.uvs2, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs3) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.UV3Kind, this.uvs3, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs4) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.UV4Kind, this.uvs4, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs5) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.UV5Kind, this.uvs5, updateExtends, makeItUnique);\r\n }\r\n if (this.uvs6) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.UV6Kind, this.uvs6, updateExtends, makeItUnique);\r\n }\r\n if (this.colors) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.ColorKind, this.colors, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesIndices) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.MatricesIndicesKind, this.matricesIndices, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesWeights) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.MatricesWeightsKind, this.matricesWeights, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesIndicesExtra) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.MatricesIndicesExtraKind, this.matricesIndicesExtra, updateExtends, makeItUnique);\r\n }\r\n if (this.matricesWeightsExtra) {\r\n meshOrGeometry.updateVerticesData(VertexBuffer.MatricesWeightsExtraKind, this.matricesWeightsExtra, updateExtends, makeItUnique);\r\n }\r\n if (this.indices) {\r\n meshOrGeometry.setIndices(this.indices, null);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Transforms each position and each normal of the vertexData according to the passed Matrix\r\n * @param matrix the transforming matrix\r\n * @returns the VertexData\r\n */\r\n VertexData.prototype.transform = function (matrix) {\r\n var flip = matrix.determinant() < 0;\r\n var transformed = Vector3.Zero();\r\n var index;\r\n if (this.positions) {\r\n var position = Vector3.Zero();\r\n for (index = 0; index < this.positions.length; index += 3) {\r\n Vector3.FromArrayToRef(this.positions, index, position);\r\n Vector3.TransformCoordinatesToRef(position, matrix, transformed);\r\n this.positions[index] = transformed.x;\r\n this.positions[index + 1] = transformed.y;\r\n this.positions[index + 2] = transformed.z;\r\n }\r\n }\r\n if (this.normals) {\r\n var normal = Vector3.Zero();\r\n for (index = 0; index < this.normals.length; index += 3) {\r\n Vector3.FromArrayToRef(this.normals, index, normal);\r\n Vector3.TransformNormalToRef(normal, matrix, transformed);\r\n this.normals[index] = transformed.x;\r\n this.normals[index + 1] = transformed.y;\r\n this.normals[index + 2] = transformed.z;\r\n }\r\n }\r\n if (this.tangents) {\r\n var tangent = Vector4.Zero();\r\n var tangentTransformed = Vector4.Zero();\r\n for (index = 0; index < this.tangents.length; index += 4) {\r\n Vector4.FromArrayToRef(this.tangents, index, tangent);\r\n Vector4.TransformNormalToRef(tangent, matrix, tangentTransformed);\r\n this.tangents[index] = tangentTransformed.x;\r\n this.tangents[index + 1] = tangentTransformed.y;\r\n this.tangents[index + 2] = tangentTransformed.z;\r\n this.tangents[index + 3] = tangentTransformed.w;\r\n }\r\n }\r\n if (flip && this.indices) {\r\n for (index = 0; index < this.indices.length; index += 3) {\r\n var tmp = this.indices[index + 1];\r\n this.indices[index + 1] = this.indices[index + 2];\r\n this.indices[index + 2] = tmp;\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Merges the passed VertexData into the current one\r\n * @param other the VertexData to be merged into the current one\r\n * @param use32BitsIndices defines a boolean indicating if indices must be store in a 32 bits array\r\n * @returns the modified VertexData\r\n */\r\n VertexData.prototype.merge = function (other, use32BitsIndices) {\r\n if (use32BitsIndices === void 0) { use32BitsIndices = false; }\r\n this._validate();\r\n other._validate();\r\n if (!this.normals !== !other.normals ||\r\n !this.tangents !== !other.tangents ||\r\n !this.uvs !== !other.uvs ||\r\n !this.uvs2 !== !other.uvs2 ||\r\n !this.uvs3 !== !other.uvs3 ||\r\n !this.uvs4 !== !other.uvs4 ||\r\n !this.uvs5 !== !other.uvs5 ||\r\n !this.uvs6 !== !other.uvs6 ||\r\n !this.colors !== !other.colors ||\r\n !this.matricesIndices !== !other.matricesIndices ||\r\n !this.matricesWeights !== !other.matricesWeights ||\r\n !this.matricesIndicesExtra !== !other.matricesIndicesExtra ||\r\n !this.matricesWeightsExtra !== !other.matricesWeightsExtra) {\r\n throw new Error(\"Cannot merge vertex data that do not have the same set of attributes\");\r\n }\r\n if (other.indices) {\r\n if (!this.indices) {\r\n this.indices = [];\r\n }\r\n var offset = this.positions ? this.positions.length / 3 : 0;\r\n var isSrcTypedArray = this.indices.BYTES_PER_ELEMENT !== undefined;\r\n if (isSrcTypedArray) {\r\n var len = this.indices.length + other.indices.length;\r\n var temp = use32BitsIndices || this.indices instanceof Uint32Array ? new Uint32Array(len) : new Uint16Array(len);\r\n temp.set(this.indices);\r\n var decal = this.indices.length;\r\n for (var index = 0; index < other.indices.length; index++) {\r\n temp[decal + index] = other.indices[index] + offset;\r\n }\r\n this.indices = temp;\r\n }\r\n else {\r\n for (var index = 0; index < other.indices.length; index++) {\r\n this.indices.push(other.indices[index] + offset);\r\n }\r\n }\r\n }\r\n this.positions = this._mergeElement(this.positions, other.positions);\r\n this.normals = this._mergeElement(this.normals, other.normals);\r\n this.tangents = this._mergeElement(this.tangents, other.tangents);\r\n this.uvs = this._mergeElement(this.uvs, other.uvs);\r\n this.uvs2 = this._mergeElement(this.uvs2, other.uvs2);\r\n this.uvs3 = this._mergeElement(this.uvs3, other.uvs3);\r\n this.uvs4 = this._mergeElement(this.uvs4, other.uvs4);\r\n this.uvs5 = this._mergeElement(this.uvs5, other.uvs5);\r\n this.uvs6 = this._mergeElement(this.uvs6, other.uvs6);\r\n this.colors = this._mergeElement(this.colors, other.colors);\r\n this.matricesIndices = this._mergeElement(this.matricesIndices, other.matricesIndices);\r\n this.matricesWeights = this._mergeElement(this.matricesWeights, other.matricesWeights);\r\n this.matricesIndicesExtra = this._mergeElement(this.matricesIndicesExtra, other.matricesIndicesExtra);\r\n this.matricesWeightsExtra = this._mergeElement(this.matricesWeightsExtra, other.matricesWeightsExtra);\r\n return this;\r\n };\r\n VertexData.prototype._mergeElement = function (source, other) {\r\n if (!source) {\r\n return other;\r\n }\r\n if (!other) {\r\n return source;\r\n }\r\n var len = other.length + source.length;\r\n var isSrcTypedArray = source instanceof Float32Array;\r\n var isOthTypedArray = other instanceof Float32Array;\r\n // use non-loop method when the source is Float32Array\r\n if (isSrcTypedArray) {\r\n var ret32 = new Float32Array(len);\r\n ret32.set(source);\r\n ret32.set(other, source.length);\r\n return ret32;\r\n // source is number[], when other is also use concat\r\n }\r\n else if (!isOthTypedArray) {\r\n return source.concat(other);\r\n // source is a number[], but other is a Float32Array, loop required\r\n }\r\n else {\r\n var ret = source.slice(0); // copy source to a separate array\r\n for (var i = 0, len = other.length; i < len; i++) {\r\n ret.push(other[i]);\r\n }\r\n return ret;\r\n }\r\n };\r\n VertexData.prototype._validate = function () {\r\n if (!this.positions) {\r\n throw new Error(\"Positions are required\");\r\n }\r\n var getElementCount = function (kind, values) {\r\n var stride = VertexBuffer.DeduceStride(kind);\r\n if ((values.length % stride) !== 0) {\r\n throw new Error(\"The \" + kind + \"s array count must be a multiple of \" + stride);\r\n }\r\n return values.length / stride;\r\n };\r\n var positionsElementCount = getElementCount(VertexBuffer.PositionKind, this.positions);\r\n var validateElementCount = function (kind, values) {\r\n var elementCount = getElementCount(kind, values);\r\n if (elementCount !== positionsElementCount) {\r\n throw new Error(\"The \" + kind + \"s element count (\" + elementCount + \") does not match the positions count (\" + positionsElementCount + \")\");\r\n }\r\n };\r\n if (this.normals) {\r\n validateElementCount(VertexBuffer.NormalKind, this.normals);\r\n }\r\n if (this.tangents) {\r\n validateElementCount(VertexBuffer.TangentKind, this.tangents);\r\n }\r\n if (this.uvs) {\r\n validateElementCount(VertexBuffer.UVKind, this.uvs);\r\n }\r\n if (this.uvs2) {\r\n validateElementCount(VertexBuffer.UV2Kind, this.uvs2);\r\n }\r\n if (this.uvs3) {\r\n validateElementCount(VertexBuffer.UV3Kind, this.uvs3);\r\n }\r\n if (this.uvs4) {\r\n validateElementCount(VertexBuffer.UV4Kind, this.uvs4);\r\n }\r\n if (this.uvs5) {\r\n validateElementCount(VertexBuffer.UV5Kind, this.uvs5);\r\n }\r\n if (this.uvs6) {\r\n validateElementCount(VertexBuffer.UV6Kind, this.uvs6);\r\n }\r\n if (this.colors) {\r\n validateElementCount(VertexBuffer.ColorKind, this.colors);\r\n }\r\n if (this.matricesIndices) {\r\n validateElementCount(VertexBuffer.MatricesIndicesKind, this.matricesIndices);\r\n }\r\n if (this.matricesWeights) {\r\n validateElementCount(VertexBuffer.MatricesWeightsKind, this.matricesWeights);\r\n }\r\n if (this.matricesIndicesExtra) {\r\n validateElementCount(VertexBuffer.MatricesIndicesExtraKind, this.matricesIndicesExtra);\r\n }\r\n if (this.matricesWeightsExtra) {\r\n validateElementCount(VertexBuffer.MatricesWeightsExtraKind, this.matricesWeightsExtra);\r\n }\r\n };\r\n /**\r\n * Serializes the VertexData\r\n * @returns a serialized object\r\n */\r\n VertexData.prototype.serialize = function () {\r\n var serializationObject = this.serialize();\r\n if (this.positions) {\r\n serializationObject.positions = this.positions;\r\n }\r\n if (this.normals) {\r\n serializationObject.normals = this.normals;\r\n }\r\n if (this.tangents) {\r\n serializationObject.tangents = this.tangents;\r\n }\r\n if (this.uvs) {\r\n serializationObject.uvs = this.uvs;\r\n }\r\n if (this.uvs2) {\r\n serializationObject.uvs2 = this.uvs2;\r\n }\r\n if (this.uvs3) {\r\n serializationObject.uvs3 = this.uvs3;\r\n }\r\n if (this.uvs4) {\r\n serializationObject.uvs4 = this.uvs4;\r\n }\r\n if (this.uvs5) {\r\n serializationObject.uvs5 = this.uvs5;\r\n }\r\n if (this.uvs6) {\r\n serializationObject.uvs6 = this.uvs6;\r\n }\r\n if (this.colors) {\r\n serializationObject.colors = this.colors;\r\n }\r\n if (this.matricesIndices) {\r\n serializationObject.matricesIndices = this.matricesIndices;\r\n serializationObject.matricesIndices._isExpanded = true;\r\n }\r\n if (this.matricesWeights) {\r\n serializationObject.matricesWeights = this.matricesWeights;\r\n }\r\n if (this.matricesIndicesExtra) {\r\n serializationObject.matricesIndicesExtra = this.matricesIndicesExtra;\r\n serializationObject.matricesIndicesExtra._isExpanded = true;\r\n }\r\n if (this.matricesWeightsExtra) {\r\n serializationObject.matricesWeightsExtra = this.matricesWeightsExtra;\r\n }\r\n serializationObject.indices = this.indices;\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Extracts the vertexData from a mesh\r\n * @param mesh the mesh from which to extract the VertexData\r\n * @param copyWhenShared defines if the VertexData must be cloned when shared between multiple meshes, optional, default false\r\n * @param forceCopy indicating that the VertexData must be cloned, optional, default false\r\n * @returns the object VertexData associated to the passed mesh\r\n */\r\n VertexData.ExtractFromMesh = function (mesh, copyWhenShared, forceCopy) {\r\n return VertexData._ExtractFrom(mesh, copyWhenShared, forceCopy);\r\n };\r\n /**\r\n * Extracts the vertexData from the geometry\r\n * @param geometry the geometry from which to extract the VertexData\r\n * @param copyWhenShared defines if the VertexData must be cloned when the geometrty is shared between multiple meshes, optional, default false\r\n * @param forceCopy indicating that the VertexData must be cloned, optional, default false\r\n * @returns the object VertexData associated to the passed mesh\r\n */\r\n VertexData.ExtractFromGeometry = function (geometry, copyWhenShared, forceCopy) {\r\n return VertexData._ExtractFrom(geometry, copyWhenShared, forceCopy);\r\n };\r\n VertexData._ExtractFrom = function (meshOrGeometry, copyWhenShared, forceCopy) {\r\n var result = new VertexData();\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.PositionKind)) {\r\n result.positions = meshOrGeometry.getVerticesData(VertexBuffer.PositionKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n result.normals = meshOrGeometry.getVerticesData(VertexBuffer.NormalKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.TangentKind)) {\r\n result.tangents = meshOrGeometry.getVerticesData(VertexBuffer.TangentKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n result.uvs = meshOrGeometry.getVerticesData(VertexBuffer.UVKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\r\n result.uvs2 = meshOrGeometry.getVerticesData(VertexBuffer.UV2Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV3Kind)) {\r\n result.uvs3 = meshOrGeometry.getVerticesData(VertexBuffer.UV3Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV4Kind)) {\r\n result.uvs4 = meshOrGeometry.getVerticesData(VertexBuffer.UV4Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV5Kind)) {\r\n result.uvs5 = meshOrGeometry.getVerticesData(VertexBuffer.UV5Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV6Kind)) {\r\n result.uvs6 = meshOrGeometry.getVerticesData(VertexBuffer.UV6Kind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.ColorKind)) {\r\n result.colors = meshOrGeometry.getVerticesData(VertexBuffer.ColorKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\r\n result.matricesIndices = meshOrGeometry.getVerticesData(VertexBuffer.MatricesIndicesKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\r\n result.matricesWeights = meshOrGeometry.getVerticesData(VertexBuffer.MatricesWeightsKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.MatricesIndicesExtraKind)) {\r\n result.matricesIndicesExtra = meshOrGeometry.getVerticesData(VertexBuffer.MatricesIndicesExtraKind, copyWhenShared, forceCopy);\r\n }\r\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.MatricesWeightsExtraKind)) {\r\n result.matricesWeightsExtra = meshOrGeometry.getVerticesData(VertexBuffer.MatricesWeightsExtraKind, copyWhenShared, forceCopy);\r\n }\r\n result.indices = meshOrGeometry.getIndices(copyWhenShared, forceCopy);\r\n return result;\r\n };\r\n /**\r\n * Creates the VertexData for a Ribbon\r\n * @param options an object used to set the following optional parameters for the ribbon, required but can be empty\r\n * * pathArray array of paths, each of which an array of successive Vector3\r\n * * closeArray creates a seam between the first and the last paths of the pathArray, optional, default false\r\n * * closePath creates a seam between the first and the last points of each path of the path array, optional, default false\r\n * * offset a positive integer, only used when pathArray contains a single path (offset = 10 means the point 1 is joined to the point 11), default rounded half size of the pathArray length\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * * invertUV swaps in the U and V coordinates when applying a texture, optional, default false\r\n * * uvs a linear array, of length 2 * number of vertices, of custom UV values, optional\r\n * * colors a linear array, of length 4 * number of vertices, of custom color values, optional\r\n * @returns the VertexData of the ribbon\r\n */\r\n VertexData.CreateRibbon = function (options) {\r\n throw _DevTools.WarnImport(\"ribbonBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a box\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * size sets the width, height and depth of the box to the value of size, optional default 1\r\n * * width sets the width (x direction) of the box, overwrites the width set by size, optional, default size\r\n * * height sets the height (y direction) of the box, overwrites the height set by size, optional, default size\r\n * * depth sets the depth (z direction) of the box, overwrites the depth set by size, optional, default size\r\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\r\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreateBox = function (options) {\r\n throw _DevTools.WarnImport(\"boxBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a tiled box\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * faceTiles sets the pattern, tile size and number of tiles for a face\r\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\r\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreateTiledBox = function (options) {\r\n throw _DevTools.WarnImport(\"tiledBoxBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a tiled plane\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * pattern a limited pattern arrangement depending on the number\r\n * * tileSize sets the width, height and depth of the tile to the value of size, optional default 1\r\n * * tileWidth sets the width (x direction) of the tile, overwrites the width set by size, optional, default size\r\n * * tileHeight sets the height (y direction) of the tile, overwrites the height set by size, optional, default size\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the tiled plane\r\n */\r\n VertexData.CreateTiledPlane = function (options) {\r\n throw _DevTools.WarnImport(\"tiledPlaneBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for an ellipsoid, defaults to a sphere\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * segments sets the number of horizontal strips optional, default 32\r\n * * diameter sets the axes dimensions, diameterX, diameterY and diameterZ to the value of diameter, optional default 1\r\n * * diameterX sets the diameterX (x direction) of the ellipsoid, overwrites the diameterX set by diameter, optional, default diameter\r\n * * diameterY sets the diameterY (y direction) of the ellipsoid, overwrites the diameterY set by diameter, optional, default diameter\r\n * * diameterZ sets the diameterZ (z direction) of the ellipsoid, overwrites the diameterZ set by diameter, optional, default diameter\r\n * * arc a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the circumference (latitude) given by the arc value, optional, default 1\r\n * * slice a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the height (latitude) given by the arc value, optional, default 1\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the ellipsoid\r\n */\r\n VertexData.CreateSphere = function (options) {\r\n throw _DevTools.WarnImport(\"sphereBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a cylinder, cone or prism\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * height sets the height (y direction) of the cylinder, optional, default 2\r\n * * diameterTop sets the diameter of the top of the cone, overwrites diameter, optional, default diameter\r\n * * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter\r\n * * diameter sets the diameter of the top and bottom of the cone, optional default 1\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\r\n * * subdivisions` the number of rings along the cylinder height, optional, default 1\r\n * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * hasRings when true makes each subdivision independantly treated as a face for faceUV and faceColors, optional, default false\r\n * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the cylinder, cone or prism\r\n */\r\n VertexData.CreateCylinder = function (options) {\r\n throw _DevTools.WarnImport(\"cylinderBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a torus\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * diameter the diameter of the torus, optional default 1\r\n * * thickness the diameter of the tube forming the torus, optional default 0.5\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the torus\r\n */\r\n VertexData.CreateTorus = function (options) {\r\n throw _DevTools.WarnImport(\"torusBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the LineSystem\r\n * @param options an object used to set the following optional parameters for the LineSystem, required but can be empty\r\n * - lines an array of lines, each line being an array of successive Vector3\r\n * - colors an array of line colors, each of the line colors being an array of successive Color4, one per line point\r\n * @returns the VertexData of the LineSystem\r\n */\r\n VertexData.CreateLineSystem = function (options) {\r\n throw _DevTools.WarnImport(\"linesBuilder\");\r\n };\r\n /**\r\n * Create the VertexData for a DashedLines\r\n * @param options an object used to set the following optional parameters for the DashedLines, required but can be empty\r\n * - points an array successive Vector3\r\n * - dashSize the size of the dashes relative to the dash number, optional, default 3\r\n * - gapSize the size of the gap between two successive dashes relative to the dash number, optional, default 1\r\n * - dashNb the intended total number of dashes, optional, default 200\r\n * @returns the VertexData for the DashedLines\r\n */\r\n VertexData.CreateDashedLines = function (options) {\r\n throw _DevTools.WarnImport(\"linesBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a Ground\r\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\r\n * - width the width (x direction) of the ground, optional, default 1\r\n * - height the height (z direction) of the ground, optional, default 1\r\n * - subdivisions the number of subdivisions per side, optional, default 1\r\n * @returns the VertexData of the Ground\r\n */\r\n VertexData.CreateGround = function (options) {\r\n throw _DevTools.WarnImport(\"groundBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a TiledGround by subdividing the ground into tiles\r\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\r\n * * xmin the ground minimum X coordinate, optional, default -1\r\n * * zmin the ground minimum Z coordinate, optional, default -1\r\n * * xmax the ground maximum X coordinate, optional, default 1\r\n * * zmax the ground maximum Z coordinate, optional, default 1\r\n * * subdivisions a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default {w: 6, h: 6}\r\n * * precision a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}\r\n * @returns the VertexData of the TiledGround\r\n */\r\n VertexData.CreateTiledGround = function (options) {\r\n throw _DevTools.WarnImport(\"groundBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the Ground designed from a heightmap\r\n * @param options an object used to set the following parameters for the Ground, required and provided by MeshBuilder.CreateGroundFromHeightMap\r\n * * width the width (x direction) of the ground\r\n * * height the height (z direction) of the ground\r\n * * subdivisions the number of subdivisions per side\r\n * * minHeight the minimum altitude on the ground, optional, default 0\r\n * * maxHeight the maximum altitude on the ground, optional default 1\r\n * * colorFilter the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)\r\n * * buffer the array holding the image color data\r\n * * bufferWidth the width of image\r\n * * bufferHeight the height of image\r\n * * alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @returns the VertexData of the Ground designed from a heightmap\r\n */\r\n VertexData.CreateGroundFromHeightMap = function (options) {\r\n throw _DevTools.WarnImport(\"groundBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for a Plane\r\n * @param options an object used to set the following optional parameters for the plane, required but can be empty\r\n * * size sets the width and height of the plane to the value of size, optional default 1\r\n * * width sets the width (x direction) of the plane, overwrites the width set by size, optional, default size\r\n * * height sets the height (y direction) of the plane, overwrites the height set by size, optional, default size\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreatePlane = function (options) {\r\n throw _DevTools.WarnImport(\"planeBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the Disc or regular Polygon\r\n * @param options an object used to set the following optional parameters for the disc, required but can be empty\r\n * * radius the radius of the disc, optional default 0.5\r\n * * tessellation the number of polygon sides, optional, default 64\r\n * * arc a number from 0 to 1, to create an unclosed polygon based on the fraction of the circumference given by the arc value, optional, default 1\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the box\r\n */\r\n VertexData.CreateDisc = function (options) {\r\n throw _DevTools.WarnImport(\"discBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData for an irregular Polygon in the XoZ plane using a mesh built by polygonTriangulation.build()\r\n * All parameters are provided by MeshBuilder.CreatePolygon as needed\r\n * @param polygon a mesh built from polygonTriangulation.build()\r\n * @param sideOrientation takes the values Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * @param fUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * @param fColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * @param frontUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * @param backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @param wrap a boolean, default false, when true and fUVs used texture is wrapped around all sides, when false texture is applied side\r\n * @returns the VertexData of the Polygon\r\n */\r\n VertexData.CreatePolygon = function (polygon, sideOrientation, fUV, fColors, frontUVs, backUVs, wrap) {\r\n throw _DevTools.WarnImport(\"polygonBuilder\");\r\n };\r\n /**\r\n * Creates the VertexData of the IcoSphere\r\n * @param options an object used to set the following optional parameters for the IcoSphere, required but can be empty\r\n * * radius the radius of the IcoSphere, optional default 1\r\n * * radiusX allows stretching in the x direction, optional, default radius\r\n * * radiusY allows stretching in the y direction, optional, default radius\r\n * * radiusZ allows stretching in the z direction, optional, default radius\r\n * * flat when true creates a flat shaded mesh, optional, default true\r\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the IcoSphere\r\n */\r\n VertexData.CreateIcoSphere = function (options) {\r\n throw _DevTools.WarnImport(\"icoSphereBuilder\");\r\n };\r\n // inspired from // http://stemkoski.github.io/Three.js/Polyhedra.html\r\n /**\r\n * Creates the VertexData for a Polyhedron\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * * type provided types are:\r\n * * 0 : Tetrahedron, 1 : Octahedron, 2 : Dodecahedron, 3 : Icosahedron, 4 : Rhombicuboctahedron, 5 : Triangular Prism, 6 : Pentagonal Prism, 7 : Hexagonal Prism, 8 : Square Pyramid (J1)\r\n * * 9 : Pentagonal Pyramid (J2), 10 : Triangular Dipyramid (J12), 11 : Pentagonal Dipyramid (J13), 12 : Elongated Square Dipyramid (J15), 13 : Elongated Pentagonal Dipyramid (J16), 14 : Elongated Pentagonal Cupola (J20)\r\n * * size the size of the IcoSphere, optional default 1\r\n * * sizeX allows stretching in the x direction, optional, default size\r\n * * sizeY allows stretching in the y direction, optional, default size\r\n * * sizeZ allows stretching in the z direction, optional, default size\r\n * * custom a number that overwrites the type to create from an extended set of polyhedron from https://www.babylonjs-playground.com/#21QRSK#15 with minimised editor\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * flat when true creates a flat shaded mesh, optional, default true\r\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the Polyhedron\r\n */\r\n VertexData.CreatePolyhedron = function (options) {\r\n throw _DevTools.WarnImport(\"polyhedronBuilder\");\r\n };\r\n //\r\n /**\r\n * Creates the VertexData for a Capsule, inspired from https://github.com/maximeq/three-js-capsule-geometry/blob/master/src/CapsuleBufferGeometry.js\r\n * @param options an object used to set the following optional parameters for the capsule, required but can be empty\r\n * @returns the VertexData of the Capsule\r\n */\r\n VertexData.CreateCapsule = function (options) {\r\n if (options === void 0) { options = {\r\n orientation: Vector3.Up(),\r\n subdivisions: 2,\r\n tessellation: 16,\r\n height: 1,\r\n radius: 0.25,\r\n capSubdivisions: 6\r\n }; }\r\n throw _DevTools.WarnImport(\"capsuleBuilder\");\r\n };\r\n // based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473\r\n /**\r\n * Creates the VertexData for a TorusKnot\r\n * @param options an object used to set the following optional parameters for the TorusKnot, required but can be empty\r\n * * radius the radius of the torus knot, optional, default 2\r\n * * tube the thickness of the tube, optional, default 0.5\r\n * * radialSegments the number of sides on each tube segments, optional, default 32\r\n * * tubularSegments the number of tubes to decompose the knot into, optional, default 32\r\n * * p the number of windings around the z axis, optional, default 2\r\n * * q the number of windings around the x axis, optional, default 3\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the Torus Knot\r\n */\r\n VertexData.CreateTorusKnot = function (options) {\r\n throw _DevTools.WarnImport(\"torusKnotBuilder\");\r\n };\r\n // Tools\r\n /**\r\n * Compute normals for given positions and indices\r\n * @param positions an array of vertex positions, [...., x, y, z, ......]\r\n * @param indices an array of indices in groups of three for each triangular facet, [...., i, j, k, ......]\r\n * @param normals an array of vertex normals, [...., x, y, z, ......]\r\n * @param options an object used to set the following optional parameters for the TorusKnot, optional\r\n * * facetNormals : optional array of facet normals (vector3)\r\n * * facetPositions : optional array of facet positions (vector3)\r\n * * facetPartitioning : optional partitioning array. facetPositions is required for facetPartitioning computation\r\n * * ratio : optional partitioning ratio / bounding box, required for facetPartitioning computation\r\n * * bInfo : optional bounding info, required for facetPartitioning computation\r\n * * bbSize : optional bounding box size data, required for facetPartitioning computation\r\n * * subDiv : optional partitioning data about subdivsions on each axis (int), required for facetPartitioning computation\r\n * * useRightHandedSystem: optional boolean to for right handed system computation\r\n * * depthSort : optional boolean to enable the facet depth sort computation\r\n * * distanceTo : optional Vector3 to compute the facet depth from this location\r\n * * depthSortedFacets : optional array of depthSortedFacets to store the facet distances from the reference location\r\n */\r\n VertexData.ComputeNormals = function (positions, indices, normals, options) {\r\n // temporary scalar variables\r\n var index = 0; // facet index\r\n var p1p2x = 0.0; // p1p2 vector x coordinate\r\n var p1p2y = 0.0; // p1p2 vector y coordinate\r\n var p1p2z = 0.0; // p1p2 vector z coordinate\r\n var p3p2x = 0.0; // p3p2 vector x coordinate\r\n var p3p2y = 0.0; // p3p2 vector y coordinate\r\n var p3p2z = 0.0; // p3p2 vector z coordinate\r\n var faceNormalx = 0.0; // facet normal x coordinate\r\n var faceNormaly = 0.0; // facet normal y coordinate\r\n var faceNormalz = 0.0; // facet normal z coordinate\r\n var length = 0.0; // facet normal length before normalization\r\n var v1x = 0; // vector1 x index in the positions array\r\n var v1y = 0; // vector1 y index in the positions array\r\n var v1z = 0; // vector1 z index in the positions array\r\n var v2x = 0; // vector2 x index in the positions array\r\n var v2y = 0; // vector2 y index in the positions array\r\n var v2z = 0; // vector2 z index in the positions array\r\n var v3x = 0; // vector3 x index in the positions array\r\n var v3y = 0; // vector3 y index in the positions array\r\n var v3z = 0; // vector3 z index in the positions array\r\n var computeFacetNormals = false;\r\n var computeFacetPositions = false;\r\n var computeFacetPartitioning = false;\r\n var computeDepthSort = false;\r\n var faceNormalSign = 1;\r\n var ratio = 0;\r\n var distanceTo = null;\r\n if (options) {\r\n computeFacetNormals = (options.facetNormals) ? true : false;\r\n computeFacetPositions = (options.facetPositions) ? true : false;\r\n computeFacetPartitioning = (options.facetPartitioning) ? true : false;\r\n faceNormalSign = (options.useRightHandedSystem === true) ? -1 : 1;\r\n ratio = options.ratio || 0;\r\n computeDepthSort = (options.depthSort) ? true : false;\r\n distanceTo = (options.distanceTo);\r\n if (computeDepthSort) {\r\n if (distanceTo === undefined) {\r\n distanceTo = Vector3.Zero();\r\n }\r\n var depthSortedFacets = options.depthSortedFacets;\r\n }\r\n }\r\n // facetPartitioning reinit if needed\r\n var xSubRatio = 0;\r\n var ySubRatio = 0;\r\n var zSubRatio = 0;\r\n var subSq = 0;\r\n if (computeFacetPartitioning && options && options.bbSize) {\r\n var ox = 0; // X partitioning index for facet position\r\n var oy = 0; // Y partinioning index for facet position\r\n var oz = 0; // Z partinioning index for facet position\r\n var b1x = 0; // X partitioning index for facet v1 vertex\r\n var b1y = 0; // Y partitioning index for facet v1 vertex\r\n var b1z = 0; // z partitioning index for facet v1 vertex\r\n var b2x = 0; // X partitioning index for facet v2 vertex\r\n var b2y = 0; // Y partitioning index for facet v2 vertex\r\n var b2z = 0; // Z partitioning index for facet v2 vertex\r\n var b3x = 0; // X partitioning index for facet v3 vertex\r\n var b3y = 0; // Y partitioning index for facet v3 vertex\r\n var b3z = 0; // Z partitioning index for facet v3 vertex\r\n var block_idx_o = 0; // facet barycenter block index\r\n var block_idx_v1 = 0; // v1 vertex block index\r\n var block_idx_v2 = 0; // v2 vertex block index\r\n var block_idx_v3 = 0; // v3 vertex block index\r\n var bbSizeMax = (options.bbSize.x > options.bbSize.y) ? options.bbSize.x : options.bbSize.y;\r\n bbSizeMax = (bbSizeMax > options.bbSize.z) ? bbSizeMax : options.bbSize.z;\r\n xSubRatio = options.subDiv.X * ratio / options.bbSize.x;\r\n ySubRatio = options.subDiv.Y * ratio / options.bbSize.y;\r\n zSubRatio = options.subDiv.Z * ratio / options.bbSize.z;\r\n subSq = options.subDiv.max * options.subDiv.max;\r\n options.facetPartitioning.length = 0;\r\n }\r\n // reset the normals\r\n for (index = 0; index < positions.length; index++) {\r\n normals[index] = 0.0;\r\n }\r\n // Loop : 1 indice triplet = 1 facet\r\n var nbFaces = (indices.length / 3) | 0;\r\n for (index = 0; index < nbFaces; index++) {\r\n // get the indexes of the coordinates of each vertex of the facet\r\n v1x = indices[index * 3] * 3;\r\n v1y = v1x + 1;\r\n v1z = v1x + 2;\r\n v2x = indices[index * 3 + 1] * 3;\r\n v2y = v2x + 1;\r\n v2z = v2x + 2;\r\n v3x = indices[index * 3 + 2] * 3;\r\n v3y = v3x + 1;\r\n v3z = v3x + 2;\r\n p1p2x = positions[v1x] - positions[v2x]; // compute two vectors per facet : p1p2 and p3p2\r\n p1p2y = positions[v1y] - positions[v2y];\r\n p1p2z = positions[v1z] - positions[v2z];\r\n p3p2x = positions[v3x] - positions[v2x];\r\n p3p2y = positions[v3y] - positions[v2y];\r\n p3p2z = positions[v3z] - positions[v2z];\r\n // compute the face normal with the cross product\r\n faceNormalx = faceNormalSign * (p1p2y * p3p2z - p1p2z * p3p2y);\r\n faceNormaly = faceNormalSign * (p1p2z * p3p2x - p1p2x * p3p2z);\r\n faceNormalz = faceNormalSign * (p1p2x * p3p2y - p1p2y * p3p2x);\r\n // normalize this normal and store it in the array facetData\r\n length = Math.sqrt(faceNormalx * faceNormalx + faceNormaly * faceNormaly + faceNormalz * faceNormalz);\r\n length = (length === 0) ? 1.0 : length;\r\n faceNormalx /= length;\r\n faceNormaly /= length;\r\n faceNormalz /= length;\r\n if (computeFacetNormals && options) {\r\n options.facetNormals[index].x = faceNormalx;\r\n options.facetNormals[index].y = faceNormaly;\r\n options.facetNormals[index].z = faceNormalz;\r\n }\r\n if (computeFacetPositions && options) {\r\n // compute and the facet barycenter coordinates in the array facetPositions\r\n options.facetPositions[index].x = (positions[v1x] + positions[v2x] + positions[v3x]) / 3.0;\r\n options.facetPositions[index].y = (positions[v1y] + positions[v2y] + positions[v3y]) / 3.0;\r\n options.facetPositions[index].z = (positions[v1z] + positions[v2z] + positions[v3z]) / 3.0;\r\n }\r\n if (computeFacetPartitioning && options) {\r\n // store the facet indexes in arrays in the main facetPartitioning array :\r\n // compute each facet vertex (+ facet barycenter) index in the partiniong array\r\n ox = Math.floor((options.facetPositions[index].x - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n oy = Math.floor((options.facetPositions[index].y - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n oz = Math.floor((options.facetPositions[index].z - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n b1x = Math.floor((positions[v1x] - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n b1y = Math.floor((positions[v1y] - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n b1z = Math.floor((positions[v1z] - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n b2x = Math.floor((positions[v2x] - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n b2y = Math.floor((positions[v2y] - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n b2z = Math.floor((positions[v2z] - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n b3x = Math.floor((positions[v3x] - options.bInfo.minimum.x * ratio) * xSubRatio);\r\n b3y = Math.floor((positions[v3y] - options.bInfo.minimum.y * ratio) * ySubRatio);\r\n b3z = Math.floor((positions[v3z] - options.bInfo.minimum.z * ratio) * zSubRatio);\r\n block_idx_v1 = b1x + options.subDiv.max * b1y + subSq * b1z;\r\n block_idx_v2 = b2x + options.subDiv.max * b2y + subSq * b2z;\r\n block_idx_v3 = b3x + options.subDiv.max * b3y + subSq * b3z;\r\n block_idx_o = ox + options.subDiv.max * oy + subSq * oz;\r\n options.facetPartitioning[block_idx_o] = options.facetPartitioning[block_idx_o] ? options.facetPartitioning[block_idx_o] : new Array();\r\n options.facetPartitioning[block_idx_v1] = options.facetPartitioning[block_idx_v1] ? options.facetPartitioning[block_idx_v1] : new Array();\r\n options.facetPartitioning[block_idx_v2] = options.facetPartitioning[block_idx_v2] ? options.facetPartitioning[block_idx_v2] : new Array();\r\n options.facetPartitioning[block_idx_v3] = options.facetPartitioning[block_idx_v3] ? options.facetPartitioning[block_idx_v3] : new Array();\r\n // push each facet index in each block containing the vertex\r\n options.facetPartitioning[block_idx_v1].push(index);\r\n if (block_idx_v2 != block_idx_v1) {\r\n options.facetPartitioning[block_idx_v2].push(index);\r\n }\r\n if (!(block_idx_v3 == block_idx_v2 || block_idx_v3 == block_idx_v1)) {\r\n options.facetPartitioning[block_idx_v3].push(index);\r\n }\r\n if (!(block_idx_o == block_idx_v1 || block_idx_o == block_idx_v2 || block_idx_o == block_idx_v3)) {\r\n options.facetPartitioning[block_idx_o].push(index);\r\n }\r\n }\r\n if (computeDepthSort && options && options.facetPositions) {\r\n var dsf = depthSortedFacets[index];\r\n dsf.ind = index * 3;\r\n dsf.sqDistance = Vector3.DistanceSquared(options.facetPositions[index], distanceTo);\r\n }\r\n // compute the normals anyway\r\n normals[v1x] += faceNormalx; // accumulate all the normals per face\r\n normals[v1y] += faceNormaly;\r\n normals[v1z] += faceNormalz;\r\n normals[v2x] += faceNormalx;\r\n normals[v2y] += faceNormaly;\r\n normals[v2z] += faceNormalz;\r\n normals[v3x] += faceNormalx;\r\n normals[v3y] += faceNormaly;\r\n normals[v3z] += faceNormalz;\r\n }\r\n // last normalization of each normal\r\n for (index = 0; index < normals.length / 3; index++) {\r\n faceNormalx = normals[index * 3];\r\n faceNormaly = normals[index * 3 + 1];\r\n faceNormalz = normals[index * 3 + 2];\r\n length = Math.sqrt(faceNormalx * faceNormalx + faceNormaly * faceNormaly + faceNormalz * faceNormalz);\r\n length = (length === 0) ? 1.0 : length;\r\n faceNormalx /= length;\r\n faceNormaly /= length;\r\n faceNormalz /= length;\r\n normals[index * 3] = faceNormalx;\r\n normals[index * 3 + 1] = faceNormaly;\r\n normals[index * 3 + 2] = faceNormalz;\r\n }\r\n };\r\n /** @hidden */\r\n VertexData._ComputeSides = function (sideOrientation, positions, indices, normals, uvs, frontUVs, backUVs) {\r\n var li = indices.length;\r\n var ln = normals.length;\r\n var i;\r\n var n;\r\n sideOrientation = sideOrientation || VertexData.DEFAULTSIDE;\r\n switch (sideOrientation) {\r\n case VertexData.FRONTSIDE:\r\n // nothing changed\r\n break;\r\n case VertexData.BACKSIDE:\r\n var tmp;\r\n // indices\r\n for (i = 0; i < li; i += 3) {\r\n tmp = indices[i];\r\n indices[i] = indices[i + 2];\r\n indices[i + 2] = tmp;\r\n }\r\n // normals\r\n for (n = 0; n < ln; n++) {\r\n normals[n] = -normals[n];\r\n }\r\n break;\r\n case VertexData.DOUBLESIDE:\r\n // positions\r\n var lp = positions.length;\r\n var l = lp / 3;\r\n for (var p = 0; p < lp; p++) {\r\n positions[lp + p] = positions[p];\r\n }\r\n // indices\r\n for (i = 0; i < li; i += 3) {\r\n indices[i + li] = indices[i + 2] + l;\r\n indices[i + 1 + li] = indices[i + 1] + l;\r\n indices[i + 2 + li] = indices[i] + l;\r\n }\r\n // normals\r\n for (n = 0; n < ln; n++) {\r\n normals[ln + n] = -normals[n];\r\n }\r\n // uvs\r\n var lu = uvs.length;\r\n var u = 0;\r\n for (u = 0; u < lu; u++) {\r\n uvs[u + lu] = uvs[u];\r\n }\r\n frontUVs = frontUVs ? frontUVs : new Vector4(0.0, 0.0, 1.0, 1.0);\r\n backUVs = backUVs ? backUVs : new Vector4(0.0, 0.0, 1.0, 1.0);\r\n u = 0;\r\n for (i = 0; i < lu / 2; i++) {\r\n uvs[u] = frontUVs.x + (frontUVs.z - frontUVs.x) * uvs[u];\r\n uvs[u + 1] = frontUVs.y + (frontUVs.w - frontUVs.y) * uvs[u + 1];\r\n uvs[u + lu] = backUVs.x + (backUVs.z - backUVs.x) * uvs[u + lu];\r\n uvs[u + lu + 1] = backUVs.y + (backUVs.w - backUVs.y) * uvs[u + lu + 1];\r\n u += 2;\r\n }\r\n break;\r\n }\r\n };\r\n /**\r\n * Applies VertexData created from the imported parameters to the geometry\r\n * @param parsedVertexData the parsed data from an imported file\r\n * @param geometry the geometry to apply the VertexData to\r\n */\r\n VertexData.ImportVertexData = function (parsedVertexData, geometry) {\r\n var vertexData = new VertexData();\r\n // positions\r\n var positions = parsedVertexData.positions;\r\n if (positions) {\r\n vertexData.set(positions, VertexBuffer.PositionKind);\r\n }\r\n // normals\r\n var normals = parsedVertexData.normals;\r\n if (normals) {\r\n vertexData.set(normals, VertexBuffer.NormalKind);\r\n }\r\n // tangents\r\n var tangents = parsedVertexData.tangents;\r\n if (tangents) {\r\n vertexData.set(tangents, VertexBuffer.TangentKind);\r\n }\r\n // uvs\r\n var uvs = parsedVertexData.uvs;\r\n if (uvs) {\r\n vertexData.set(uvs, VertexBuffer.UVKind);\r\n }\r\n // uv2s\r\n var uv2s = parsedVertexData.uv2s;\r\n if (uv2s) {\r\n vertexData.set(uv2s, VertexBuffer.UV2Kind);\r\n }\r\n // uv3s\r\n var uv3s = parsedVertexData.uv3s;\r\n if (uv3s) {\r\n vertexData.set(uv3s, VertexBuffer.UV3Kind);\r\n }\r\n // uv4s\r\n var uv4s = parsedVertexData.uv4s;\r\n if (uv4s) {\r\n vertexData.set(uv4s, VertexBuffer.UV4Kind);\r\n }\r\n // uv5s\r\n var uv5s = parsedVertexData.uv5s;\r\n if (uv5s) {\r\n vertexData.set(uv5s, VertexBuffer.UV5Kind);\r\n }\r\n // uv6s\r\n var uv6s = parsedVertexData.uv6s;\r\n if (uv6s) {\r\n vertexData.set(uv6s, VertexBuffer.UV6Kind);\r\n }\r\n // colors\r\n var colors = parsedVertexData.colors;\r\n if (colors) {\r\n vertexData.set(Color4.CheckColors4(colors, positions.length / 3), VertexBuffer.ColorKind);\r\n }\r\n // matricesIndices\r\n var matricesIndices = parsedVertexData.matricesIndices;\r\n if (matricesIndices) {\r\n vertexData.set(matricesIndices, VertexBuffer.MatricesIndicesKind);\r\n }\r\n // matricesWeights\r\n var matricesWeights = parsedVertexData.matricesWeights;\r\n if (matricesWeights) {\r\n vertexData.set(matricesWeights, VertexBuffer.MatricesWeightsKind);\r\n }\r\n // indices\r\n var indices = parsedVertexData.indices;\r\n if (indices) {\r\n vertexData.indices = indices;\r\n }\r\n geometry.setAllVerticesData(vertexData, parsedVertexData.updatable);\r\n };\r\n /**\r\n * Mesh side orientation : usually the external or front surface\r\n */\r\n VertexData.FRONTSIDE = 0;\r\n /**\r\n * Mesh side orientation : usually the internal or back surface\r\n */\r\n VertexData.BACKSIDE = 1;\r\n /**\r\n * Mesh side orientation : both internal and external or front and back surfaces\r\n */\r\n VertexData.DOUBLESIDE = 2;\r\n /**\r\n * Mesh side orientation : by default, `FRONTSIDE`\r\n */\r\n VertexData.DEFAULTSIDE = 0;\r\n return VertexData;\r\n}());\r\nexport { VertexData };\r\n//# sourceMappingURL=mesh.vertexData.js.map","import { VertexBuffer } from \"./buffer\";\r\nimport { IntersectionInfo } from \"../Collisions/intersectionInfo\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { extractMinAndMaxIndexed } from '../Maths/math.functions';\r\n/**\r\n * Defines a subdivision inside a mesh\r\n */\r\nvar SubMesh = /** @class */ (function () {\r\n /**\r\n * Creates a new submesh\r\n * @param materialIndex defines the material index to use\r\n * @param verticesStart defines vertex index start\r\n * @param verticesCount defines vertices count\r\n * @param indexStart defines index start\r\n * @param indexCount defines indices count\r\n * @param mesh defines the parent mesh\r\n * @param renderingMesh defines an optional rendering mesh\r\n * @param createBoundingBox defines if bounding box should be created for this submesh\r\n * @param addToMesh defines a boolean indicating that the submesh must be added to the mesh.subMeshes array (true by default)\r\n */\r\n function SubMesh(\r\n /** the material index to use */\r\n materialIndex, \r\n /** vertex index start */\r\n verticesStart, \r\n /** vertices count */\r\n verticesCount, \r\n /** index start */\r\n indexStart, \r\n /** indices count */\r\n indexCount, mesh, renderingMesh, createBoundingBox, addToMesh) {\r\n if (createBoundingBox === void 0) { createBoundingBox = true; }\r\n if (addToMesh === void 0) { addToMesh = true; }\r\n this.materialIndex = materialIndex;\r\n this.verticesStart = verticesStart;\r\n this.verticesCount = verticesCount;\r\n this.indexStart = indexStart;\r\n this.indexCount = indexCount;\r\n /** @hidden */\r\n this._materialDefines = null;\r\n /** @hidden */\r\n this._materialEffect = null;\r\n /** @hidden */\r\n this._effectOverride = null;\r\n /** @hidden */\r\n this._linesIndexCount = 0;\r\n this._linesIndexBuffer = null;\r\n /** @hidden */\r\n this._lastColliderWorldVertices = null;\r\n /** @hidden */\r\n this._lastColliderTransformMatrix = null;\r\n /** @hidden */\r\n this._renderId = 0;\r\n /** @hidden */\r\n this._alphaIndex = 0;\r\n /** @hidden */\r\n this._distanceToCamera = 0;\r\n this._currentMaterial = null;\r\n this._mesh = mesh;\r\n this._renderingMesh = renderingMesh || mesh;\r\n if (addToMesh) {\r\n mesh.subMeshes.push(this);\r\n }\r\n this._trianglePlanes = [];\r\n this._id = mesh.subMeshes.length - 1;\r\n if (createBoundingBox) {\r\n this.refreshBoundingInfo();\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n Object.defineProperty(SubMesh.prototype, \"materialDefines\", {\r\n /**\r\n * Gets material defines used by the effect associated to the sub mesh\r\n */\r\n get: function () {\r\n return this._materialDefines;\r\n },\r\n /**\r\n * Sets material defines used by the effect associated to the sub mesh\r\n */\r\n set: function (defines) {\r\n this._materialDefines = defines;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SubMesh.prototype, \"effect\", {\r\n /**\r\n * Gets associated effect\r\n */\r\n get: function () {\r\n var _a;\r\n return (_a = this._effectOverride) !== null && _a !== void 0 ? _a : this._materialEffect;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Sets associated effect (effect used to render this submesh)\r\n * @param effect defines the effect to associate with\r\n * @param defines defines the set of defines used to compile this effect\r\n */\r\n SubMesh.prototype.setEffect = function (effect, defines) {\r\n if (defines === void 0) { defines = null; }\r\n if (this._materialEffect === effect) {\r\n if (!effect) {\r\n this._materialDefines = null;\r\n }\r\n return;\r\n }\r\n this._materialDefines = defines;\r\n this._materialEffect = effect;\r\n };\r\n /**\r\n * Add a new submesh to a mesh\r\n * @param materialIndex defines the material index to use\r\n * @param verticesStart defines vertex index start\r\n * @param verticesCount defines vertices count\r\n * @param indexStart defines index start\r\n * @param indexCount defines indices count\r\n * @param mesh defines the parent mesh\r\n * @param renderingMesh defines an optional rendering mesh\r\n * @param createBoundingBox defines if bounding box should be created for this submesh\r\n * @returns the new submesh\r\n */\r\n SubMesh.AddToMesh = function (materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox) {\r\n if (createBoundingBox === void 0) { createBoundingBox = true; }\r\n return new SubMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox);\r\n };\r\n Object.defineProperty(SubMesh.prototype, \"IsGlobal\", {\r\n /**\r\n * Returns true if this submesh covers the entire parent mesh\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return (this.verticesStart === 0 && this.verticesCount === this._mesh.getTotalVertices());\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the submesh BoudingInfo object\r\n * @returns current bounding info (or mesh's one if the submesh is global)\r\n */\r\n SubMesh.prototype.getBoundingInfo = function () {\r\n if (this.IsGlobal) {\r\n return this._mesh.getBoundingInfo();\r\n }\r\n return this._boundingInfo;\r\n };\r\n /**\r\n * Sets the submesh BoundingInfo\r\n * @param boundingInfo defines the new bounding info to use\r\n * @returns the SubMesh\r\n */\r\n SubMesh.prototype.setBoundingInfo = function (boundingInfo) {\r\n this._boundingInfo = boundingInfo;\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh of the current submesh\r\n * @return the parent mesh\r\n */\r\n SubMesh.prototype.getMesh = function () {\r\n return this._mesh;\r\n };\r\n /**\r\n * Returns the rendering mesh of the submesh\r\n * @returns the rendering mesh (could be different from parent mesh)\r\n */\r\n SubMesh.prototype.getRenderingMesh = function () {\r\n return this._renderingMesh;\r\n };\r\n /**\r\n * Returns the replacement mesh of the submesh\r\n * @returns the replacement mesh (could be different from parent mesh)\r\n */\r\n SubMesh.prototype.getReplacementMesh = function () {\r\n return this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : null;\r\n };\r\n /**\r\n * Returns the effective mesh of the submesh\r\n * @returns the effective mesh (could be different from parent mesh)\r\n */\r\n SubMesh.prototype.getEffectiveMesh = function () {\r\n var replacementMesh = this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : null;\r\n return replacementMesh ? replacementMesh : this._renderingMesh;\r\n };\r\n /**\r\n * Returns the submesh material\r\n * @returns null or the current material\r\n */\r\n SubMesh.prototype.getMaterial = function () {\r\n var rootMaterial = this._renderingMesh.material;\r\n if (rootMaterial === null || rootMaterial === undefined) {\r\n return this._mesh.getScene().defaultMaterial;\r\n }\r\n else if (this._IsMultiMaterial(rootMaterial)) {\r\n var effectiveMaterial = rootMaterial.getSubMaterial(this.materialIndex);\r\n if (this._currentMaterial !== effectiveMaterial) {\r\n this._currentMaterial = effectiveMaterial;\r\n this._materialDefines = null;\r\n }\r\n return effectiveMaterial;\r\n }\r\n return rootMaterial;\r\n };\r\n SubMesh.prototype._IsMultiMaterial = function (material) {\r\n return material.getSubMaterial !== undefined;\r\n };\r\n // Methods\r\n /**\r\n * Sets a new updated BoundingInfo object to the submesh\r\n * @param data defines an optional position array to use to determine the bounding info\r\n * @returns the SubMesh\r\n */\r\n SubMesh.prototype.refreshBoundingInfo = function (data) {\r\n if (data === void 0) { data = null; }\r\n this._lastColliderWorldVertices = null;\r\n if (this.IsGlobal || !this._renderingMesh || !this._renderingMesh.geometry) {\r\n return this;\r\n }\r\n if (!data) {\r\n data = this._renderingMesh.getVerticesData(VertexBuffer.PositionKind);\r\n }\r\n if (!data) {\r\n this._boundingInfo = this._mesh.getBoundingInfo();\r\n return this;\r\n }\r\n var indices = this._renderingMesh.getIndices();\r\n var extend;\r\n //is this the only submesh?\r\n if (this.indexStart === 0 && this.indexCount === indices.length) {\r\n var boundingInfo = this._renderingMesh.getBoundingInfo();\r\n //the rendering mesh's bounding info can be used, it is the standard submesh for all indices.\r\n extend = { minimum: boundingInfo.minimum.clone(), maximum: boundingInfo.maximum.clone() };\r\n }\r\n else {\r\n extend = extractMinAndMaxIndexed(data, indices, this.indexStart, this.indexCount, this._renderingMesh.geometry.boundingBias);\r\n }\r\n if (this._boundingInfo) {\r\n this._boundingInfo.reConstruct(extend.minimum, extend.maximum);\r\n }\r\n else {\r\n this._boundingInfo = new BoundingInfo(extend.minimum, extend.maximum);\r\n }\r\n return this;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._checkCollision = function (collider) {\r\n var boundingInfo = this.getBoundingInfo();\r\n return boundingInfo._checkCollision(collider);\r\n };\r\n /**\r\n * Updates the submesh BoundingInfo\r\n * @param world defines the world matrix to use to update the bounding info\r\n * @returns the submesh\r\n */\r\n SubMesh.prototype.updateBoundingInfo = function (world) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n this.refreshBoundingInfo();\r\n boundingInfo = this.getBoundingInfo();\r\n }\r\n if (boundingInfo) {\r\n boundingInfo.update(world);\r\n }\r\n return this;\r\n };\r\n /**\r\n * True is the submesh bounding box intersects the frustum defined by the passed array of planes.\r\n * @param frustumPlanes defines the frustum planes\r\n * @returns true if the submesh is intersecting with the frustum\r\n */\r\n SubMesh.prototype.isInFrustum = function (frustumPlanes) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return boundingInfo.isInFrustum(frustumPlanes, this._mesh.cullingStrategy);\r\n };\r\n /**\r\n * True is the submesh bounding box is completely inside the frustum defined by the passed array of planes\r\n * @param frustumPlanes defines the frustum planes\r\n * @returns true if the submesh is inside the frustum\r\n */\r\n SubMesh.prototype.isCompletelyInFrustum = function (frustumPlanes) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return boundingInfo.isCompletelyInFrustum(frustumPlanes);\r\n };\r\n /**\r\n * Renders the submesh\r\n * @param enableAlphaMode defines if alpha needs to be used\r\n * @returns the submesh\r\n */\r\n SubMesh.prototype.render = function (enableAlphaMode) {\r\n this._renderingMesh.render(this, enableAlphaMode, this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : undefined);\r\n return this;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n SubMesh.prototype._getLinesIndexBuffer = function (indices, engine) {\r\n if (!this._linesIndexBuffer) {\r\n var linesIndices = [];\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 3) {\r\n linesIndices.push(indices[index], indices[index + 1], indices[index + 1], indices[index + 2], indices[index + 2], indices[index]);\r\n }\r\n this._linesIndexBuffer = engine.createIndexBuffer(linesIndices);\r\n this._linesIndexCount = linesIndices.length;\r\n }\r\n return this._linesIndexBuffer;\r\n };\r\n /**\r\n * Checks if the submesh intersects with a ray\r\n * @param ray defines the ray to test\r\n * @returns true is the passed ray intersects the submesh bounding box\r\n */\r\n SubMesh.prototype.canIntersects = function (ray) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return false;\r\n }\r\n return ray.intersectsBox(boundingInfo.boundingBox);\r\n };\r\n /**\r\n * Intersects current submesh with a ray\r\n * @param ray defines the ray to test\r\n * @param positions defines mesh's positions array\r\n * @param indices defines mesh's indices array\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns intersection info or null if no intersection\r\n */\r\n SubMesh.prototype.intersects = function (ray, positions, indices, fastCheck, trianglePredicate) {\r\n var material = this.getMaterial();\r\n if (!material) {\r\n return null;\r\n }\r\n var step = 3;\r\n var checkStopper = false;\r\n switch (material.fillMode) {\r\n case 3:\r\n case 4:\r\n case 5:\r\n case 6:\r\n case 8:\r\n return null;\r\n case 7:\r\n step = 1;\r\n checkStopper = true;\r\n break;\r\n default:\r\n break;\r\n }\r\n // LineMesh first as it's also a Mesh...\r\n if (this._mesh.getClassName() === \"InstancedLinesMesh\" || this._mesh.getClassName() === \"LinesMesh\") {\r\n // Check if mesh is unindexed\r\n if (!indices.length) {\r\n return this._intersectUnIndexedLines(ray, positions, indices, this._mesh.intersectionThreshold, fastCheck);\r\n }\r\n return this._intersectLines(ray, positions, indices, this._mesh.intersectionThreshold, fastCheck);\r\n }\r\n else {\r\n // Check if mesh is unindexed\r\n if (!indices.length && this._mesh._unIndexed) {\r\n return this._intersectUnIndexedTriangles(ray, positions, indices, fastCheck, trianglePredicate);\r\n }\r\n return this._intersectTriangles(ray, positions, indices, step, checkStopper, fastCheck, trianglePredicate);\r\n }\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectLines = function (ray, positions, indices, intersectionThreshold, fastCheck) {\r\n var intersectInfo = null;\r\n // Line test\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 2) {\r\n var p0 = positions[indices[index]];\r\n var p1 = positions[indices[index + 1]];\r\n var length = ray.intersectionSegment(p0, p1, intersectionThreshold);\r\n if (length < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || length < intersectInfo.distance) {\r\n intersectInfo = new IntersectionInfo(null, null, length);\r\n intersectInfo.faceId = index / 2;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectUnIndexedLines = function (ray, positions, indices, intersectionThreshold, fastCheck) {\r\n var intersectInfo = null;\r\n // Line test\r\n for (var index = this.verticesStart; index < this.verticesStart + this.verticesCount; index += 2) {\r\n var p0 = positions[index];\r\n var p1 = positions[index + 1];\r\n var length = ray.intersectionSegment(p0, p1, intersectionThreshold);\r\n if (length < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || length < intersectInfo.distance) {\r\n intersectInfo = new IntersectionInfo(null, null, length);\r\n intersectInfo.faceId = index / 2;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectTriangles = function (ray, positions, indices, step, checkStopper, fastCheck, trianglePredicate) {\r\n var intersectInfo = null;\r\n // Triangles test\r\n var faceID = -1;\r\n for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += step) {\r\n faceID++;\r\n var indexA = indices[index];\r\n var indexB = indices[index + 1];\r\n var indexC = indices[index + 2];\r\n if (checkStopper && indexC === 0xFFFFFFFF) {\r\n index += 2;\r\n continue;\r\n }\r\n var p0 = positions[indexA];\r\n var p1 = positions[indexB];\r\n var p2 = positions[indexC];\r\n if (trianglePredicate && !trianglePredicate(p0, p1, p2, ray)) {\r\n continue;\r\n }\r\n var currentIntersectInfo = ray.intersectsTriangle(p0, p1, p2);\r\n if (currentIntersectInfo) {\r\n if (currentIntersectInfo.distance < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.faceId = faceID;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._intersectUnIndexedTriangles = function (ray, positions, indices, fastCheck, trianglePredicate) {\r\n var intersectInfo = null;\r\n // Triangles test\r\n for (var index = this.verticesStart; index < this.verticesStart + this.verticesCount; index += 3) {\r\n var p0 = positions[index];\r\n var p1 = positions[index + 1];\r\n var p2 = positions[index + 2];\r\n if (trianglePredicate && !trianglePredicate(p0, p1, p2, ray)) {\r\n continue;\r\n }\r\n var currentIntersectInfo = ray.intersectsTriangle(p0, p1, p2);\r\n if (currentIntersectInfo) {\r\n if (currentIntersectInfo.distance < 0) {\r\n continue;\r\n }\r\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\r\n intersectInfo = currentIntersectInfo;\r\n intersectInfo.faceId = index / 3;\r\n if (fastCheck) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return intersectInfo;\r\n };\r\n /** @hidden */\r\n SubMesh.prototype._rebuild = function () {\r\n if (this._linesIndexBuffer) {\r\n this._linesIndexBuffer = null;\r\n }\r\n };\r\n // Clone\r\n /**\r\n * Creates a new submesh from the passed mesh\r\n * @param newMesh defines the new hosting mesh\r\n * @param newRenderingMesh defines an optional rendering mesh\r\n * @returns the new submesh\r\n */\r\n SubMesh.prototype.clone = function (newMesh, newRenderingMesh) {\r\n var result = new SubMesh(this.materialIndex, this.verticesStart, this.verticesCount, this.indexStart, this.indexCount, newMesh, newRenderingMesh, false);\r\n if (!this.IsGlobal) {\r\n var boundingInfo = this.getBoundingInfo();\r\n if (!boundingInfo) {\r\n return result;\r\n }\r\n result._boundingInfo = new BoundingInfo(boundingInfo.minimum, boundingInfo.maximum);\r\n }\r\n return result;\r\n };\r\n // Dispose\r\n /**\r\n * Release associated resources\r\n */\r\n SubMesh.prototype.dispose = function () {\r\n if (this._linesIndexBuffer) {\r\n this._mesh.getScene().getEngine()._releaseBuffer(this._linesIndexBuffer);\r\n this._linesIndexBuffer = null;\r\n }\r\n // Remove from mesh\r\n var index = this._mesh.subMeshes.indexOf(this);\r\n this._mesh.subMeshes.splice(index, 1);\r\n };\r\n /**\r\n * Gets the class name\r\n * @returns the string \"SubMesh\".\r\n */\r\n SubMesh.prototype.getClassName = function () {\r\n return \"SubMesh\";\r\n };\r\n // Statics\r\n /**\r\n * Creates a new submesh from indices data\r\n * @param materialIndex the index of the main mesh material\r\n * @param startIndex the index where to start the copy in the mesh indices array\r\n * @param indexCount the number of indices to copy then from the startIndex\r\n * @param mesh the main mesh to create the submesh from\r\n * @param renderingMesh the optional rendering mesh\r\n * @returns a new submesh\r\n */\r\n SubMesh.CreateFromIndices = function (materialIndex, startIndex, indexCount, mesh, renderingMesh) {\r\n var minVertexIndex = Number.MAX_VALUE;\r\n var maxVertexIndex = -Number.MAX_VALUE;\r\n var whatWillRender = (renderingMesh || mesh);\r\n var indices = whatWillRender.getIndices();\r\n for (var index = startIndex; index < startIndex + indexCount; index++) {\r\n var vertexIndex = indices[index];\r\n if (vertexIndex < minVertexIndex) {\r\n minVertexIndex = vertexIndex;\r\n }\r\n if (vertexIndex > maxVertexIndex) {\r\n maxVertexIndex = vertexIndex;\r\n }\r\n }\r\n return new SubMesh(materialIndex, minVertexIndex, maxVertexIndex - minVertexIndex + 1, startIndex, indexCount, mesh, renderingMesh);\r\n };\r\n return SubMesh;\r\n}());\r\nexport { SubMesh };\r\n//# sourceMappingURL=subMesh.js.map","import { Mesh } from \"../Meshes/mesh\";\r\nimport { VertexBuffer, Buffer } from './buffer';\r\nimport { Matrix, Vector3, TmpVectors } from '../Maths/math.vector';\r\nMesh.prototype.thinInstanceAdd = function (matrix, refresh) {\r\n if (refresh === void 0) { refresh = true; }\r\n this._thinInstanceUpdateBufferSize(\"matrix\", Array.isArray(matrix) ? matrix.length : 1);\r\n var index = this._thinInstanceDataStorage.instancesCount;\r\n if (Array.isArray(matrix)) {\r\n for (var i = 0; i < matrix.length; ++i) {\r\n this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, matrix[i], (i === matrix.length - 1) && refresh);\r\n }\r\n }\r\n else {\r\n this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, matrix, refresh);\r\n }\r\n return index;\r\n};\r\nMesh.prototype.thinInstanceAddSelf = function (refresh) {\r\n if (refresh === void 0) { refresh = true; }\r\n return this.thinInstanceAdd(Matrix.IdentityReadOnly, refresh);\r\n};\r\nMesh.prototype.thinInstanceRegisterAttribute = function (kind, stride) {\r\n this.removeVerticesData(kind);\r\n this._thinInstanceInitializeUserStorage();\r\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = stride * Math.max(32, this._thinInstanceDataStorage.instancesCount); // Initial size\r\n this._userThinInstanceBuffersStorage.data[kind] = new Float32Array(this._userThinInstanceBuffersStorage.sizes[kind]);\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), this._userThinInstanceBuffersStorage.data[kind], kind, true, false, stride, true);\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]);\r\n};\r\nMesh.prototype.thinInstanceSetMatrixAt = function (index, matrix, refresh) {\r\n if (refresh === void 0) { refresh = true; }\r\n if (!this._thinInstanceDataStorage.matrixData || index >= this._thinInstanceDataStorage.instancesCount) {\r\n return false;\r\n }\r\n var matrixData = this._thinInstanceDataStorage.matrixData;\r\n matrix.copyToArray(matrixData, index * 16);\r\n if (this._thinInstanceDataStorage.worldMatrices) {\r\n this._thinInstanceDataStorage.worldMatrices[index] = matrix;\r\n }\r\n if (refresh) {\r\n this.thinInstanceBufferUpdated(\"matrix\");\r\n if (!this.doNotSyncBoundingInfo) {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n }\r\n }\r\n return true;\r\n};\r\nMesh.prototype.thinInstanceSetAttributeAt = function (kind, index, value, refresh) {\r\n if (refresh === void 0) { refresh = true; }\r\n if (!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.data[kind] || index >= this._thinInstanceDataStorage.instancesCount) {\r\n return false;\r\n }\r\n this._thinInstanceUpdateBufferSize(kind, 0); // make sur the buffer for the kind attribute is big enough\r\n this._userThinInstanceBuffersStorage.data[kind].set(value, index * this._userThinInstanceBuffersStorage.strides[kind]);\r\n if (refresh) {\r\n this.thinInstanceBufferUpdated(kind);\r\n }\r\n return true;\r\n};\r\nObject.defineProperty(Mesh.prototype, \"thinInstanceCount\", {\r\n get: function () {\r\n return this._thinInstanceDataStorage.instancesCount;\r\n },\r\n set: function (value) {\r\n var _a, _b;\r\n var numMaxInstances = ((_b = (_a = this._thinInstanceDataStorage.matrixData) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) / 16;\r\n if (value <= numMaxInstances) {\r\n this._thinInstanceDataStorage.instancesCount = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\nMesh.prototype.thinInstanceSetBuffer = function (kind, buffer, stride, staticBuffer) {\r\n var _a, _b;\r\n if (stride === void 0) { stride = 0; }\r\n if (staticBuffer === void 0) { staticBuffer = false; }\r\n stride = stride || 16;\r\n if (kind === \"matrix\") {\r\n (_a = this._thinInstanceDataStorage.matrixBuffer) === null || _a === void 0 ? void 0 : _a.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = null;\r\n this._thinInstanceDataStorage.matrixBufferSize = buffer ? buffer.length : 32 * stride;\r\n this._thinInstanceDataStorage.matrixData = buffer;\r\n this._thinInstanceDataStorage.worldMatrices = null;\r\n if (buffer !== null) {\r\n this._thinInstanceDataStorage.instancesCount = buffer.length / stride;\r\n var matrixBuffer = new Buffer(this.getEngine(), buffer, !staticBuffer, stride, false, true);\r\n this._thinInstanceDataStorage.matrixBuffer = matrixBuffer;\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world0\", 0, 4));\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world1\", 4, 4));\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world2\", 8, 4));\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world3\", 12, 4));\r\n if (!this.doNotSyncBoundingInfo) {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n }\r\n }\r\n else {\r\n this._thinInstanceDataStorage.instancesCount = 0;\r\n if (!this.doNotSyncBoundingInfo) {\r\n // mesh has no more thin instances, so need to recompute the bounding box because it's the regular mesh that will now be displayed\r\n this.refreshBoundingInfo(true);\r\n }\r\n }\r\n }\r\n else {\r\n if (buffer === null) {\r\n if ((_b = this._userThinInstanceBuffersStorage) === null || _b === void 0 ? void 0 : _b.data[kind]) {\r\n this.removeVerticesData(kind);\r\n delete this._userThinInstanceBuffersStorage.data[kind];\r\n delete this._userThinInstanceBuffersStorage.strides[kind];\r\n delete this._userThinInstanceBuffersStorage.sizes[kind];\r\n delete this._userThinInstanceBuffersStorage.vertexBuffers[kind];\r\n }\r\n }\r\n else {\r\n this._thinInstanceInitializeUserStorage();\r\n this._userThinInstanceBuffersStorage.data[kind] = buffer;\r\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = buffer.length;\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), buffer, kind, !staticBuffer, false, stride, true);\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]);\r\n }\r\n }\r\n};\r\nMesh.prototype.thinInstanceBufferUpdated = function (kind) {\r\n var _a;\r\n if (kind === \"matrix\") {\r\n if (this._thinInstanceDataStorage.matrixBuffer) {\r\n this._thinInstanceDataStorage.matrixBuffer.updateDirectly(this._thinInstanceDataStorage.matrixData, 0, this._thinInstanceDataStorage.instancesCount);\r\n }\r\n }\r\n else if ((_a = this._userThinInstanceBuffersStorage) === null || _a === void 0 ? void 0 : _a.vertexBuffers[kind]) {\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind].updateDirectly(this._userThinInstanceBuffersStorage.data[kind], 0);\r\n }\r\n};\r\nMesh.prototype.thinInstancePartialBufferUpdate = function (kind, data, offset) {\r\n var _a;\r\n if (kind === \"matrix\") {\r\n if (this._thinInstanceDataStorage.matrixBuffer) {\r\n this._thinInstanceDataStorage.matrixBuffer.updateDirectly(data, offset);\r\n }\r\n }\r\n else if ((_a = this._userThinInstanceBuffersStorage) === null || _a === void 0 ? void 0 : _a.vertexBuffers[kind]) {\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind].updateDirectly(data, offset);\r\n }\r\n};\r\nMesh.prototype.thinInstanceGetWorldMatrices = function () {\r\n if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {\r\n return [];\r\n }\r\n var matrixData = this._thinInstanceDataStorage.matrixData;\r\n if (!this._thinInstanceDataStorage.worldMatrices) {\r\n this._thinInstanceDataStorage.worldMatrices = new Array();\r\n for (var i = 0; i < this._thinInstanceDataStorage.instancesCount; ++i) {\r\n this._thinInstanceDataStorage.worldMatrices[i] = Matrix.FromArray(matrixData, i * 16);\r\n }\r\n }\r\n return this._thinInstanceDataStorage.worldMatrices;\r\n};\r\nMesh.prototype.thinInstanceRefreshBoundingInfo = function (forceRefreshParentInfo) {\r\n if (forceRefreshParentInfo === void 0) { forceRefreshParentInfo = false; }\r\n if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {\r\n return;\r\n }\r\n var vectors = this._thinInstanceDataStorage.boundingVectors;\r\n if (forceRefreshParentInfo) {\r\n vectors.length = 0;\r\n this.refreshBoundingInfo(true);\r\n }\r\n var boundingInfo = this.getBoundingInfo();\r\n var matrixData = this._thinInstanceDataStorage.matrixData;\r\n if (vectors.length === 0) {\r\n for (var v = 0; v < boundingInfo.boundingBox.vectors.length; ++v) {\r\n vectors.push(boundingInfo.boundingBox.vectors[v].clone());\r\n }\r\n }\r\n TmpVectors.Vector3[0].setAll(Number.POSITIVE_INFINITY); // min\r\n TmpVectors.Vector3[1].setAll(Number.NEGATIVE_INFINITY); // max\r\n for (var i = 0; i < this._thinInstanceDataStorage.instancesCount; ++i) {\r\n Matrix.FromArrayToRef(matrixData, i * 16, TmpVectors.Matrix[0]);\r\n for (var v = 0; v < vectors.length; ++v) {\r\n Vector3.TransformCoordinatesToRef(vectors[v], TmpVectors.Matrix[0], TmpVectors.Vector3[2]);\r\n TmpVectors.Vector3[0].minimizeInPlace(TmpVectors.Vector3[2]);\r\n TmpVectors.Vector3[1].maximizeInPlace(TmpVectors.Vector3[2]);\r\n }\r\n }\r\n boundingInfo.reConstruct(TmpVectors.Vector3[0], TmpVectors.Vector3[1]);\r\n this._updateBoundingInfo();\r\n};\r\nMesh.prototype._thinInstanceUpdateBufferSize = function (kind, numInstances) {\r\n var _a, _b;\r\n if (numInstances === void 0) { numInstances = 1; }\r\n var kindIsMatrix = kind === \"matrix\";\r\n if (!kindIsMatrix && (!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.strides[kind])) {\r\n return;\r\n }\r\n var stride = kindIsMatrix ? 16 : this._userThinInstanceBuffersStorage.strides[kind];\r\n var currentSize = kindIsMatrix ? this._thinInstanceDataStorage.matrixBufferSize : this._userThinInstanceBuffersStorage.sizes[kind];\r\n var data = kindIsMatrix ? this._thinInstanceDataStorage.matrixData : this._userThinInstanceBuffersStorage.data[kind];\r\n var bufferSize = (this._thinInstanceDataStorage.instancesCount + numInstances) * stride;\r\n var newSize = currentSize;\r\n while (newSize < bufferSize) {\r\n newSize *= 2;\r\n }\r\n if (!data || currentSize != newSize) {\r\n if (!data) {\r\n data = new Float32Array(newSize);\r\n }\r\n else {\r\n var newData = new Float32Array(newSize);\r\n newData.set(data, 0);\r\n data = newData;\r\n }\r\n if (kindIsMatrix) {\r\n (_a = this._thinInstanceDataStorage.matrixBuffer) === null || _a === void 0 ? void 0 : _a.dispose();\r\n var matrixBuffer = new Buffer(this.getEngine(), data, true, stride, false, true);\r\n this._thinInstanceDataStorage.matrixBuffer = matrixBuffer;\r\n this._thinInstanceDataStorage.matrixData = data;\r\n this._thinInstanceDataStorage.matrixBufferSize = newSize;\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world0\", 0, 4));\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world1\", 4, 4));\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world2\", 8, 4));\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(\"world3\", 12, 4));\r\n }\r\n else {\r\n (_b = this._userThinInstanceBuffersStorage.vertexBuffers[kind]) === null || _b === void 0 ? void 0 : _b.dispose();\r\n this._userThinInstanceBuffersStorage.data[kind] = data;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = newSize;\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), data, kind, true, false, stride, true);\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]);\r\n }\r\n }\r\n};\r\nMesh.prototype._thinInstanceInitializeUserStorage = function () {\r\n if (!this._userThinInstanceBuffersStorage) {\r\n this._userThinInstanceBuffersStorage = {\r\n data: {},\r\n sizes: {},\r\n vertexBuffers: {},\r\n strides: {},\r\n };\r\n }\r\n};\r\nMesh.prototype._disposeThinInstanceSpecificData = function () {\r\n var _a;\r\n if ((_a = this._thinInstanceDataStorage) === null || _a === void 0 ? void 0 : _a.matrixBuffer) {\r\n this._thinInstanceDataStorage.matrixBuffer.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = null;\r\n }\r\n};\r\n//# sourceMappingURL=thinInstanceMesh.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, serializeAsVector3, serializeAsQuaternion, SerializationHelper } from \"../Misc/decorators\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Quaternion, Matrix, Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport { Space } from '../Maths/math.axis';\r\n/**\r\n * A TransformNode is an object that is not rendered but can be used as a center of transformation. This can decrease memory usage and increase rendering speed compared to using an empty mesh as a parent and is less complicated than using a pivot matrix.\r\n * @see https://doc.babylonjs.com/how_to/transformnode\r\n */\r\nvar TransformNode = /** @class */ (function (_super) {\r\n __extends(TransformNode, _super);\r\n function TransformNode(name, scene, isPure) {\r\n if (scene === void 0) { scene = null; }\r\n if (isPure === void 0) { isPure = true; }\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._forward = new Vector3(0, 0, 1);\r\n _this._forwardInverted = new Vector3(0, 0, -1);\r\n _this._up = new Vector3(0, 1, 0);\r\n _this._right = new Vector3(1, 0, 0);\r\n _this._rightInverted = new Vector3(-1, 0, 0);\r\n // Properties\r\n _this._position = Vector3.Zero();\r\n _this._rotation = Vector3.Zero();\r\n _this._rotationQuaternion = null;\r\n _this._scaling = Vector3.One();\r\n _this._isDirty = false;\r\n _this._transformToBoneReferal = null;\r\n _this._isAbsoluteSynced = false;\r\n _this._billboardMode = TransformNode.BILLBOARDMODE_NONE;\r\n _this._preserveParentRotationForBillboard = false;\r\n /**\r\n * Multiplication factor on scale x/y/z when computing the world matrix. Eg. for a 1x1x1 cube setting this to 2 will make it a 2x2x2 cube\r\n */\r\n _this.scalingDeterminant = 1;\r\n _this._infiniteDistance = false;\r\n /**\r\n * Gets or sets a boolean indicating that non uniform scaling (when at least one component is different from others) should be ignored.\r\n * By default the system will update normals to compensate\r\n */\r\n _this.ignoreNonUniformScaling = false;\r\n /**\r\n * Gets or sets a boolean indicating that even if rotationQuaternion is defined, you can keep updating rotation property and Babylon.js will just mix both\r\n */\r\n _this.reIntegrateRotationIntoRotationQuaternion = false;\r\n // Cache\r\n /** @hidden */\r\n _this._poseMatrix = null;\r\n /** @hidden */\r\n _this._localMatrix = Matrix.Zero();\r\n _this._usePivotMatrix = false;\r\n _this._absolutePosition = Vector3.Zero();\r\n _this._absoluteScaling = Vector3.Zero();\r\n _this._absoluteRotationQuaternion = Quaternion.Identity();\r\n _this._pivotMatrix = Matrix.Identity();\r\n /** @hidden */\r\n _this._postMultiplyPivotMatrix = false;\r\n _this._isWorldMatrixFrozen = false;\r\n /** @hidden */\r\n _this._indexInSceneTransformNodesArray = -1;\r\n /**\r\n * An event triggered after the world matrix is updated\r\n */\r\n _this.onAfterWorldMatrixUpdateObservable = new Observable();\r\n _this._nonUniformScaling = false;\r\n if (isPure) {\r\n _this.getScene().addTransformNode(_this);\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(TransformNode.prototype, \"billboardMode\", {\r\n /**\r\n * Gets or sets the billboard mode. Default is 0.\r\n *\r\n * | Value | Type | Description |\r\n * | --- | --- | --- |\r\n * | 0 | BILLBOARDMODE_NONE | |\r\n * | 1 | BILLBOARDMODE_X | |\r\n * | 2 | BILLBOARDMODE_Y | |\r\n * | 4 | BILLBOARDMODE_Z | |\r\n * | 7 | BILLBOARDMODE_ALL | |\r\n *\r\n */\r\n get: function () {\r\n return this._billboardMode;\r\n },\r\n set: function (value) {\r\n if (this._billboardMode === value) {\r\n return;\r\n }\r\n this._billboardMode = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"preserveParentRotationForBillboard\", {\r\n /**\r\n * Gets or sets a boolean indicating that parent rotation should be preserved when using billboards.\r\n * This could be useful for glTF objects where parent rotation helps converting from right handed to left handed\r\n */\r\n get: function () {\r\n return this._preserveParentRotationForBillboard;\r\n },\r\n set: function (value) {\r\n if (value === this._preserveParentRotationForBillboard) {\r\n return;\r\n }\r\n this._preserveParentRotationForBillboard = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"infiniteDistance\", {\r\n /**\r\n * Gets or sets the distance of the object to max, often used by skybox\r\n */\r\n get: function () {\r\n return this._infiniteDistance;\r\n },\r\n set: function (value) {\r\n if (this._infiniteDistance === value) {\r\n return;\r\n }\r\n this._infiniteDistance = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"TransformNode\" string\r\n */\r\n TransformNode.prototype.getClassName = function () {\r\n return \"TransformNode\";\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"position\", {\r\n /**\r\n * Gets or set the node position (default is (0.0, 0.0, 0.0))\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n set: function (newPosition) {\r\n this._position = newPosition;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"rotation\", {\r\n /**\r\n * Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).\r\n * If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion\r\n */\r\n get: function () {\r\n return this._rotation;\r\n },\r\n set: function (newRotation) {\r\n this._rotation = newRotation;\r\n this._rotationQuaternion = null;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"scaling\", {\r\n /**\r\n * Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).\r\n */\r\n get: function () {\r\n return this._scaling;\r\n },\r\n set: function (newScaling) {\r\n this._scaling = newScaling;\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"rotationQuaternion\", {\r\n /**\r\n * Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (undefined by default, but can be null).\r\n * If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)\r\n */\r\n get: function () {\r\n return this._rotationQuaternion;\r\n },\r\n set: function (quaternion) {\r\n this._rotationQuaternion = quaternion;\r\n //reset the rotation vector.\r\n if (quaternion) {\r\n this._rotation.setAll(0.0);\r\n }\r\n this._isDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"forward\", {\r\n /**\r\n * The forward direction of that transform in world space.\r\n */\r\n get: function () {\r\n return Vector3.Normalize(Vector3.TransformNormal(this.getScene().useRightHandedSystem ? this._forwardInverted : this._forward, this.getWorldMatrix()));\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"up\", {\r\n /**\r\n * The up direction of that transform in world space.\r\n */\r\n get: function () {\r\n return Vector3.Normalize(Vector3.TransformNormal(this._up, this.getWorldMatrix()));\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"right\", {\r\n /**\r\n * The right direction of that transform in world space.\r\n */\r\n get: function () {\r\n return Vector3.Normalize(Vector3.TransformNormal(this.getScene().useRightHandedSystem ? this._rightInverted : this._right, this.getWorldMatrix()));\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Copies the parameter passed Matrix into the mesh Pose matrix.\r\n * @param matrix the matrix to copy the pose from\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.updatePoseMatrix = function (matrix) {\r\n if (!this._poseMatrix) {\r\n this._poseMatrix = matrix.clone();\r\n return this;\r\n }\r\n this._poseMatrix.copyFrom(matrix);\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh Pose matrix.\r\n * @returns the pose matrix\r\n */\r\n TransformNode.prototype.getPoseMatrix = function () {\r\n if (!this._poseMatrix) {\r\n this._poseMatrix = Matrix.Identity();\r\n }\r\n return this._poseMatrix;\r\n };\r\n /** @hidden */\r\n TransformNode.prototype._isSynchronized = function () {\r\n var cache = this._cache;\r\n if (this.billboardMode !== cache.billboardMode || this.billboardMode !== TransformNode.BILLBOARDMODE_NONE) {\r\n return false;\r\n }\r\n if (cache.pivotMatrixUpdated) {\r\n return false;\r\n }\r\n if (this.infiniteDistance) {\r\n return false;\r\n }\r\n if (this.position._isDirty) {\r\n return false;\r\n }\r\n if (this.scaling._isDirty) {\r\n return false;\r\n }\r\n if (this._rotationQuaternion && this._rotationQuaternion._isDirty || this.rotation._isDirty) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n TransformNode.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n var cache = this._cache;\r\n cache.localMatrixUpdated = false;\r\n cache.billboardMode = -1;\r\n cache.infiniteDistance = false;\r\n };\r\n /**\r\n * Flag the transform node as dirty (Forcing it to update everything)\r\n * @param property if set to \"rotation\" the objects rotationQuaternion will be set to null\r\n * @returns this transform node\r\n */\r\n TransformNode.prototype.markAsDirty = function (property) {\r\n this._currentRenderId = Number.MAX_VALUE;\r\n this._isDirty = true;\r\n return this;\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"absolutePosition\", {\r\n /**\r\n * Returns the current mesh absolute position.\r\n * Returns a Vector3.\r\n */\r\n get: function () {\r\n return this._absolutePosition;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"absoluteScaling\", {\r\n /**\r\n * Returns the current mesh absolute scaling.\r\n * Returns a Vector3.\r\n */\r\n get: function () {\r\n this._syncAbsoluteScalingAndRotation();\r\n return this._absoluteScaling;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TransformNode.prototype, \"absoluteRotationQuaternion\", {\r\n /**\r\n * Returns the current mesh absolute rotation.\r\n * Returns a Quaternion.\r\n */\r\n get: function () {\r\n this._syncAbsoluteScalingAndRotation();\r\n return this._absoluteRotationQuaternion;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Sets a new matrix to apply before all other transformation\r\n * @param matrix defines the transform matrix\r\n * @returns the current TransformNode\r\n */\r\n TransformNode.prototype.setPreTransformMatrix = function (matrix) {\r\n return this.setPivotMatrix(matrix, false);\r\n };\r\n /**\r\n * Sets a new pivot matrix to the current node\r\n * @param matrix defines the new pivot matrix to use\r\n * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect\r\n * @returns the current TransformNode\r\n */\r\n TransformNode.prototype.setPivotMatrix = function (matrix, postMultiplyPivotMatrix) {\r\n if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = true; }\r\n this._pivotMatrix.copyFrom(matrix);\r\n this._usePivotMatrix = !this._pivotMatrix.isIdentity();\r\n this._cache.pivotMatrixUpdated = true;\r\n this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;\r\n if (this._postMultiplyPivotMatrix) {\r\n if (!this._pivotMatrixInverse) {\r\n this._pivotMatrixInverse = Matrix.Invert(this._pivotMatrix);\r\n }\r\n else {\r\n this._pivotMatrix.invertToRef(this._pivotMatrixInverse);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh pivot matrix.\r\n * Default : Identity.\r\n * @returns the matrix\r\n */\r\n TransformNode.prototype.getPivotMatrix = function () {\r\n return this._pivotMatrix;\r\n };\r\n /**\r\n * Instantiate (when possible) or clone that node with its hierarchy\r\n * @param newParent defines the new parent to use for the instance (or clone)\r\n * @param options defines options to configure how copy is done\r\n * @param onNewNodeCreated defines an option callback to call when a clone or an instance is created\r\n * @returns an instance (or a clone) of the current node with its hiearchy\r\n */\r\n TransformNode.prototype.instantiateHierarchy = function (newParent, options, onNewNodeCreated) {\r\n if (newParent === void 0) { newParent = null; }\r\n var clone = this.clone(\"Clone of \" + (this.name || this.id), newParent || this.parent, true);\r\n if (clone) {\r\n if (onNewNodeCreated) {\r\n onNewNodeCreated(this, clone);\r\n }\r\n }\r\n for (var _i = 0, _a = this.getChildTransformNodes(true); _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child.instantiateHierarchy(clone, options, onNewNodeCreated);\r\n }\r\n return clone;\r\n };\r\n /**\r\n * Prevents the World matrix to be computed any longer\r\n * @param newWorldMatrix defines an optional matrix to use as world matrix\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.freezeWorldMatrix = function (newWorldMatrix) {\r\n if (newWorldMatrix === void 0) { newWorldMatrix = null; }\r\n if (newWorldMatrix) {\r\n this._worldMatrix = newWorldMatrix;\r\n }\r\n else {\r\n this._isWorldMatrixFrozen = false; // no guarantee world is not already frozen, switch off temporarily\r\n this.computeWorldMatrix(true);\r\n }\r\n this._isDirty = false;\r\n this._isWorldMatrixFrozen = true;\r\n return this;\r\n };\r\n /**\r\n * Allows back the World matrix computation.\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.unfreezeWorldMatrix = function () {\r\n this._isWorldMatrixFrozen = false;\r\n this.computeWorldMatrix(true);\r\n return this;\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"isWorldMatrixFrozen\", {\r\n /**\r\n * True if the World matrix has been frozen.\r\n */\r\n get: function () {\r\n return this._isWorldMatrixFrozen;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Retuns the mesh absolute position in the World.\r\n * @returns a Vector3.\r\n */\r\n TransformNode.prototype.getAbsolutePosition = function () {\r\n this.computeWorldMatrix();\r\n return this._absolutePosition;\r\n };\r\n /**\r\n * Sets the mesh absolute position in the World from a Vector3 or an Array(3).\r\n * @param absolutePosition the absolute position to set\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.setAbsolutePosition = function (absolutePosition) {\r\n if (!absolutePosition) {\r\n return this;\r\n }\r\n var absolutePositionX;\r\n var absolutePositionY;\r\n var absolutePositionZ;\r\n if (absolutePosition.x === undefined) {\r\n if (arguments.length < 3) {\r\n return this;\r\n }\r\n absolutePositionX = arguments[0];\r\n absolutePositionY = arguments[1];\r\n absolutePositionZ = arguments[2];\r\n }\r\n else {\r\n absolutePositionX = absolutePosition.x;\r\n absolutePositionY = absolutePosition.y;\r\n absolutePositionZ = absolutePosition.z;\r\n }\r\n if (this.parent) {\r\n var invertParentWorldMatrix = TmpVectors.Matrix[0];\r\n this.parent.getWorldMatrix().invertToRef(invertParentWorldMatrix);\r\n Vector3.TransformCoordinatesFromFloatsToRef(absolutePositionX, absolutePositionY, absolutePositionZ, invertParentWorldMatrix, this.position);\r\n }\r\n else {\r\n this.position.x = absolutePositionX;\r\n this.position.y = absolutePositionY;\r\n this.position.z = absolutePositionZ;\r\n }\r\n this._absolutePosition.copyFrom(absolutePosition);\r\n return this;\r\n };\r\n /**\r\n * Sets the mesh position in its local space.\r\n * @param vector3 the position to set in localspace\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.setPositionWithLocalVector = function (vector3) {\r\n this.computeWorldMatrix();\r\n this.position = Vector3.TransformNormal(vector3, this._localMatrix);\r\n return this;\r\n };\r\n /**\r\n * Returns the mesh position in the local space from the current World matrix values.\r\n * @returns a new Vector3.\r\n */\r\n TransformNode.prototype.getPositionExpressedInLocalSpace = function () {\r\n this.computeWorldMatrix();\r\n var invLocalWorldMatrix = TmpVectors.Matrix[0];\r\n this._localMatrix.invertToRef(invLocalWorldMatrix);\r\n return Vector3.TransformNormal(this.position, invLocalWorldMatrix);\r\n };\r\n /**\r\n * Translates the mesh along the passed Vector3 in its local space.\r\n * @param vector3 the distance to translate in localspace\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.locallyTranslate = function (vector3) {\r\n this.computeWorldMatrix(true);\r\n this.position = Vector3.TransformCoordinates(vector3, this._localMatrix);\r\n return this;\r\n };\r\n /**\r\n * Orients a mesh towards a target point. Mesh must be drawn facing user.\r\n * @param targetPoint the position (must be in same space as current mesh) to look at\r\n * @param yawCor optional yaw (y-axis) correction in radians\r\n * @param pitchCor optional pitch (x-axis) correction in radians\r\n * @param rollCor optional roll (z-axis) correction in radians\r\n * @param space the choosen space of the target\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.lookAt = function (targetPoint, yawCor, pitchCor, rollCor, space) {\r\n if (yawCor === void 0) { yawCor = 0; }\r\n if (pitchCor === void 0) { pitchCor = 0; }\r\n if (rollCor === void 0) { rollCor = 0; }\r\n if (space === void 0) { space = Space.LOCAL; }\r\n var dv = TransformNode._lookAtVectorCache;\r\n var pos = space === Space.LOCAL ? this.position : this.getAbsolutePosition();\r\n targetPoint.subtractToRef(pos, dv);\r\n this.setDirection(dv, yawCor, pitchCor, rollCor);\r\n // Correct for parent's rotation offset\r\n if (space === Space.WORLD && this.parent) {\r\n if (this.rotationQuaternion) {\r\n // Get local rotation matrix of the looking object\r\n var rotationMatrix = TmpVectors.Matrix[0];\r\n this.rotationQuaternion.toRotationMatrix(rotationMatrix);\r\n // Offset rotation by parent's inverted rotation matrix to correct in world space\r\n var parentRotationMatrix = TmpVectors.Matrix[1];\r\n this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);\r\n parentRotationMatrix.invert();\r\n rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);\r\n this.rotationQuaternion.fromRotationMatrix(rotationMatrix);\r\n }\r\n else {\r\n // Get local rotation matrix of the looking object\r\n var quaternionRotation = TmpVectors.Quaternion[0];\r\n Quaternion.FromEulerVectorToRef(this.rotation, quaternionRotation);\r\n var rotationMatrix = TmpVectors.Matrix[0];\r\n quaternionRotation.toRotationMatrix(rotationMatrix);\r\n // Offset rotation by parent's inverted rotation matrix to correct in world space\r\n var parentRotationMatrix = TmpVectors.Matrix[1];\r\n this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);\r\n parentRotationMatrix.invert();\r\n rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);\r\n quaternionRotation.fromRotationMatrix(rotationMatrix);\r\n quaternionRotation.toEulerAnglesToRef(this.rotation);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.\r\n * This Vector3 is expressed in the World space.\r\n * @param localAxis axis to rotate\r\n * @returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.\r\n */\r\n TransformNode.prototype.getDirection = function (localAxis) {\r\n var result = Vector3.Zero();\r\n this.getDirectionToRef(localAxis, result);\r\n return result;\r\n };\r\n /**\r\n * Sets the Vector3 \"result\" as the rotated Vector3 \"localAxis\" in the same rotation than the mesh.\r\n * localAxis is expressed in the mesh local space.\r\n * result is computed in the Wordl space from the mesh World matrix.\r\n * @param localAxis axis to rotate\r\n * @param result the resulting transformnode\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.getDirectionToRef = function (localAxis, result) {\r\n Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);\r\n return this;\r\n };\r\n /**\r\n * Sets this transform node rotation to the given local axis.\r\n * @param localAxis the axis in local space\r\n * @param yawCor optional yaw (y-axis) correction in radians\r\n * @param pitchCor optional pitch (x-axis) correction in radians\r\n * @param rollCor optional roll (z-axis) correction in radians\r\n * @returns this TransformNode\r\n */\r\n TransformNode.prototype.setDirection = function (localAxis, yawCor, pitchCor, rollCor) {\r\n if (yawCor === void 0) { yawCor = 0; }\r\n if (pitchCor === void 0) { pitchCor = 0; }\r\n if (rollCor === void 0) { rollCor = 0; }\r\n var yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;\r\n var len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);\r\n var pitch = -Math.atan2(localAxis.y, len);\r\n if (this.rotationQuaternion) {\r\n Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);\r\n }\r\n else {\r\n this.rotation.x = pitch + pitchCor;\r\n this.rotation.y = yaw + yawCor;\r\n this.rotation.z = rollCor;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a new pivot point to the current node\r\n * @param point defines the new pivot point to use\r\n * @param space defines if the point is in world or local space (local by default)\r\n * @returns the current TransformNode\r\n */\r\n TransformNode.prototype.setPivotPoint = function (point, space) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (this.getScene().getRenderId() == 0) {\r\n this.computeWorldMatrix(true);\r\n }\r\n var wm = this.getWorldMatrix();\r\n if (space == Space.WORLD) {\r\n var tmat = TmpVectors.Matrix[0];\r\n wm.invertToRef(tmat);\r\n point = Vector3.TransformCoordinates(point, tmat);\r\n }\r\n return this.setPivotMatrix(Matrix.Translation(-point.x, -point.y, -point.z), true);\r\n };\r\n /**\r\n * Returns a new Vector3 set with the mesh pivot point coordinates in the local space.\r\n * @returns the pivot point\r\n */\r\n TransformNode.prototype.getPivotPoint = function () {\r\n var point = Vector3.Zero();\r\n this.getPivotPointToRef(point);\r\n return point;\r\n };\r\n /**\r\n * Sets the passed Vector3 \"result\" with the coordinates of the mesh pivot point in the local space.\r\n * @param result the vector3 to store the result\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.getPivotPointToRef = function (result) {\r\n result.x = -this._pivotMatrix.m[12];\r\n result.y = -this._pivotMatrix.m[13];\r\n result.z = -this._pivotMatrix.m[14];\r\n return this;\r\n };\r\n /**\r\n * Returns a new Vector3 set with the mesh pivot point World coordinates.\r\n * @returns a new Vector3 set with the mesh pivot point World coordinates.\r\n */\r\n TransformNode.prototype.getAbsolutePivotPoint = function () {\r\n var point = Vector3.Zero();\r\n this.getAbsolutePivotPointToRef(point);\r\n return point;\r\n };\r\n /**\r\n * Sets the Vector3 \"result\" coordinates with the mesh pivot point World coordinates.\r\n * @param result vector3 to store the result\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.getAbsolutePivotPointToRef = function (result) {\r\n this.getPivotPointToRef(result);\r\n Vector3.TransformCoordinatesToRef(result, this.getWorldMatrix(), result);\r\n return this;\r\n };\r\n /**\r\n * Defines the passed node as the parent of the current node.\r\n * The node will remain exactly where it is and its position / rotation will be updated accordingly\r\n * @see https://doc.babylonjs.com/how_to/parenting\r\n * @param node the node ot set as the parent\r\n * @returns this TransformNode.\r\n */\r\n TransformNode.prototype.setParent = function (node) {\r\n if (!node && !this.parent) {\r\n return this;\r\n }\r\n var quatRotation = TmpVectors.Quaternion[0];\r\n var position = TmpVectors.Vector3[0];\r\n var scale = TmpVectors.Vector3[1];\r\n if (!node) {\r\n this.computeWorldMatrix(true);\r\n this.getWorldMatrix().decompose(scale, quatRotation, position);\r\n }\r\n else {\r\n var diffMatrix = TmpVectors.Matrix[0];\r\n var invParentMatrix = TmpVectors.Matrix[1];\r\n this.computeWorldMatrix(true);\r\n node.computeWorldMatrix(true);\r\n node.getWorldMatrix().invertToRef(invParentMatrix);\r\n this.getWorldMatrix().multiplyToRef(invParentMatrix, diffMatrix);\r\n diffMatrix.decompose(scale, quatRotation, position);\r\n }\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion.copyFrom(quatRotation);\r\n }\r\n else {\r\n quatRotation.toEulerAnglesToRef(this.rotation);\r\n }\r\n this.scaling.copyFrom(scale);\r\n this.position.copyFrom(position);\r\n this.parent = node;\r\n return this;\r\n };\r\n Object.defineProperty(TransformNode.prototype, \"nonUniformScaling\", {\r\n /**\r\n * True if the scaling property of this object is non uniform eg. (1,2,1)\r\n */\r\n get: function () {\r\n return this._nonUniformScaling;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n TransformNode.prototype._updateNonUniformScalingState = function (value) {\r\n if (this._nonUniformScaling === value) {\r\n return false;\r\n }\r\n this._nonUniformScaling = value;\r\n return true;\r\n };\r\n /**\r\n * Attach the current TransformNode to another TransformNode associated with a bone\r\n * @param bone Bone affecting the TransformNode\r\n * @param affectedTransformNode TransformNode associated with the bone\r\n * @returns this object\r\n */\r\n TransformNode.prototype.attachToBone = function (bone, affectedTransformNode) {\r\n this._transformToBoneReferal = affectedTransformNode;\r\n this.parent = bone;\r\n bone.getSkeleton().prepare();\r\n if (bone.getWorldMatrix().determinant() < 0) {\r\n this.scalingDeterminant *= -1;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Detach the transform node if its associated with a bone\r\n * @returns this object\r\n */\r\n TransformNode.prototype.detachFromBone = function () {\r\n if (!this.parent) {\r\n return this;\r\n }\r\n if (this.parent.getWorldMatrix().determinant() < 0) {\r\n this.scalingDeterminant *= -1;\r\n }\r\n this._transformToBoneReferal = null;\r\n this.parent = null;\r\n return this;\r\n };\r\n /**\r\n * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space.\r\n * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.\r\n * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.\r\n * The passed axis is also normalized.\r\n * @param axis the axis to rotate around\r\n * @param amount the amount to rotate in radians\r\n * @param space Space to rotate in (Default: local)\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.rotate = function (axis, amount, space) {\r\n axis.normalize();\r\n if (!this.rotationQuaternion) {\r\n this.rotationQuaternion = this.rotation.toQuaternion();\r\n this.rotation.setAll(0);\r\n }\r\n var rotationQuaternion;\r\n if (!space || space === Space.LOCAL) {\r\n rotationQuaternion = Quaternion.RotationAxisToRef(axis, amount, TransformNode._rotationAxisCache);\r\n this.rotationQuaternion.multiplyToRef(rotationQuaternion, this.rotationQuaternion);\r\n }\r\n else {\r\n if (this.parent) {\r\n var invertParentWorldMatrix = TmpVectors.Matrix[0];\r\n this.parent.getWorldMatrix().invertToRef(invertParentWorldMatrix);\r\n axis = Vector3.TransformNormal(axis, invertParentWorldMatrix);\r\n }\r\n rotationQuaternion = Quaternion.RotationAxisToRef(axis, amount, TransformNode._rotationAxisCache);\r\n rotationQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space.\r\n * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.\r\n * The passed axis is also normalized. .\r\n * Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm\r\n * @param point the point to rotate around\r\n * @param axis the axis to rotate around\r\n * @param amount the amount to rotate in radians\r\n * @returns the TransformNode\r\n */\r\n TransformNode.prototype.rotateAround = function (point, axis, amount) {\r\n axis.normalize();\r\n if (!this.rotationQuaternion) {\r\n this.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);\r\n this.rotation.setAll(0);\r\n }\r\n var tmpVector = TmpVectors.Vector3[0];\r\n var finalScale = TmpVectors.Vector3[1];\r\n var finalTranslation = TmpVectors.Vector3[2];\r\n var finalRotation = TmpVectors.Quaternion[0];\r\n var translationMatrix = TmpVectors.Matrix[0]; // T\r\n var translationMatrixInv = TmpVectors.Matrix[1]; // T'\r\n var rotationMatrix = TmpVectors.Matrix[2]; // R\r\n var finalMatrix = TmpVectors.Matrix[3]; // T' x R x T\r\n point.subtractToRef(this.position, tmpVector);\r\n Matrix.TranslationToRef(tmpVector.x, tmpVector.y, tmpVector.z, translationMatrix); // T\r\n Matrix.TranslationToRef(-tmpVector.x, -tmpVector.y, -tmpVector.z, translationMatrixInv); // T'\r\n Matrix.RotationAxisToRef(axis, amount, rotationMatrix); // R\r\n translationMatrixInv.multiplyToRef(rotationMatrix, finalMatrix); // T' x R\r\n finalMatrix.multiplyToRef(translationMatrix, finalMatrix); // T' x R x T\r\n finalMatrix.decompose(finalScale, finalRotation, finalTranslation);\r\n this.position.addInPlace(finalTranslation);\r\n finalRotation.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\r\n return this;\r\n };\r\n /**\r\n * Translates the mesh along the axis vector for the passed distance in the given space.\r\n * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.\r\n * @param axis the axis to translate in\r\n * @param distance the distance to translate\r\n * @param space Space to rotate in (Default: local)\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.translate = function (axis, distance, space) {\r\n var displacementVector = axis.scale(distance);\r\n if (!space || space === Space.LOCAL) {\r\n var tempV3 = this.getPositionExpressedInLocalSpace().add(displacementVector);\r\n this.setPositionWithLocalVector(tempV3);\r\n }\r\n else {\r\n this.setAbsolutePosition(this.getAbsolutePosition().add(displacementVector));\r\n }\r\n return this;\r\n };\r\n /**\r\n * Adds a rotation step to the mesh current rotation.\r\n * x, y, z are Euler angles expressed in radians.\r\n * This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set.\r\n * This means this rotation is made in the mesh local space only.\r\n * It's useful to set a custom rotation order different from the BJS standard one YXZ.\r\n * Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.\r\n * ```javascript\r\n * mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);\r\n * ```\r\n * Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.\r\n * Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.\r\n * @param x Rotation to add\r\n * @param y Rotation to add\r\n * @param z Rotation to add\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.addRotation = function (x, y, z) {\r\n var rotationQuaternion;\r\n if (this.rotationQuaternion) {\r\n rotationQuaternion = this.rotationQuaternion;\r\n }\r\n else {\r\n rotationQuaternion = TmpVectors.Quaternion[1];\r\n Quaternion.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, rotationQuaternion);\r\n }\r\n var accumulation = TmpVectors.Quaternion[0];\r\n Quaternion.RotationYawPitchRollToRef(y, x, z, accumulation);\r\n rotationQuaternion.multiplyInPlace(accumulation);\r\n if (!this.rotationQuaternion) {\r\n rotationQuaternion.toEulerAnglesToRef(this.rotation);\r\n }\r\n return this;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n TransformNode.prototype._getEffectiveParent = function () {\r\n return this.parent;\r\n };\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @returns the world matrix\r\n */\r\n TransformNode.prototype.computeWorldMatrix = function (force) {\r\n if (this._isWorldMatrixFrozen && !this._isDirty) {\r\n return this._worldMatrix;\r\n }\r\n var currentRenderId = this.getScene().getRenderId();\r\n if (!this._isDirty && !force && this.isSynchronized()) {\r\n this._currentRenderId = currentRenderId;\r\n return this._worldMatrix;\r\n }\r\n var camera = this.getScene().activeCamera;\r\n var useBillboardPosition = (this._billboardMode & TransformNode.BILLBOARDMODE_USE_POSITION) !== 0;\r\n var useBillboardPath = this._billboardMode !== TransformNode.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard;\r\n // Billboarding based on camera position\r\n if (useBillboardPath && camera && useBillboardPosition) {\r\n this.lookAt(camera.position);\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {\r\n this.rotation.x = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {\r\n this.rotation.y = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {\r\n this.rotation.z = 0;\r\n }\r\n }\r\n this._updateCache();\r\n var cache = this._cache;\r\n cache.pivotMatrixUpdated = false;\r\n cache.billboardMode = this.billboardMode;\r\n cache.infiniteDistance = this.infiniteDistance;\r\n this._currentRenderId = currentRenderId;\r\n this._childUpdateId++;\r\n this._isDirty = false;\r\n this._position._isDirty = false;\r\n this._rotation._isDirty = false;\r\n this._scaling._isDirty = false;\r\n var parent = this._getEffectiveParent();\r\n // Scaling\r\n var scaling = TransformNode._TmpScaling;\r\n var translation = this._position;\r\n // Translation\r\n if (this._infiniteDistance) {\r\n if (!this.parent && camera) {\r\n var cameraWorldMatrix = camera.getWorldMatrix();\r\n var cameraGlobalPosition = new Vector3(cameraWorldMatrix.m[12], cameraWorldMatrix.m[13], cameraWorldMatrix.m[14]);\r\n translation = TransformNode._TmpTranslation;\r\n translation.copyFromFloats(this._position.x + cameraGlobalPosition.x, this._position.y + cameraGlobalPosition.y, this._position.z + cameraGlobalPosition.z);\r\n }\r\n }\r\n // Scaling\r\n scaling.copyFromFloats(this._scaling.x * this.scalingDeterminant, this._scaling.y * this.scalingDeterminant, this._scaling.z * this.scalingDeterminant);\r\n // Rotation\r\n var rotation;\r\n if (this._rotationQuaternion) {\r\n this._rotationQuaternion._isDirty = false;\r\n rotation = this._rotationQuaternion;\r\n if (this.reIntegrateRotationIntoRotationQuaternion) {\r\n var len = this.rotation.lengthSquared();\r\n if (len) {\r\n this._rotationQuaternion.multiplyInPlace(Quaternion.RotationYawPitchRoll(this._rotation.y, this._rotation.x, this._rotation.z));\r\n this._rotation.copyFromFloats(0, 0, 0);\r\n }\r\n }\r\n }\r\n else {\r\n rotation = TransformNode._TmpRotation;\r\n Quaternion.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, rotation);\r\n }\r\n // Compose\r\n if (this._usePivotMatrix) {\r\n var scaleMatrix = TmpVectors.Matrix[1];\r\n Matrix.ScalingToRef(scaling.x, scaling.y, scaling.z, scaleMatrix);\r\n // Rotation\r\n var rotationMatrix = TmpVectors.Matrix[0];\r\n rotation.toRotationMatrix(rotationMatrix);\r\n // Composing transformations\r\n this._pivotMatrix.multiplyToRef(scaleMatrix, TmpVectors.Matrix[4]);\r\n TmpVectors.Matrix[4].multiplyToRef(rotationMatrix, this._localMatrix);\r\n // Post multiply inverse of pivotMatrix\r\n if (this._postMultiplyPivotMatrix) {\r\n this._localMatrix.multiplyToRef(this._pivotMatrixInverse, this._localMatrix);\r\n }\r\n this._localMatrix.addTranslationFromFloats(translation.x, translation.y, translation.z);\r\n }\r\n else {\r\n Matrix.ComposeToRef(scaling, rotation, translation, this._localMatrix);\r\n }\r\n // Parent\r\n if (parent && parent.getWorldMatrix) {\r\n if (force) {\r\n parent.computeWorldMatrix();\r\n }\r\n if (useBillboardPath) {\r\n if (this._transformToBoneReferal) {\r\n parent.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), TmpVectors.Matrix[7]);\r\n }\r\n else {\r\n TmpVectors.Matrix[7].copyFrom(parent.getWorldMatrix());\r\n }\r\n // Extract scaling and translation from parent\r\n var translation_1 = TmpVectors.Vector3[5];\r\n var scale = TmpVectors.Vector3[6];\r\n TmpVectors.Matrix[7].decompose(scale, undefined, translation_1);\r\n Matrix.ScalingToRef(scale.x, scale.y, scale.z, TmpVectors.Matrix[7]);\r\n TmpVectors.Matrix[7].setTranslation(translation_1);\r\n this._localMatrix.multiplyToRef(TmpVectors.Matrix[7], this._worldMatrix);\r\n }\r\n else {\r\n if (this._transformToBoneReferal) {\r\n this._localMatrix.multiplyToRef(parent.getWorldMatrix(), TmpVectors.Matrix[6]);\r\n TmpVectors.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), this._worldMatrix);\r\n }\r\n else {\r\n this._localMatrix.multiplyToRef(parent.getWorldMatrix(), this._worldMatrix);\r\n }\r\n }\r\n this._markSyncedWithParent();\r\n }\r\n else {\r\n this._worldMatrix.copyFrom(this._localMatrix);\r\n }\r\n // Billboarding based on camera orientation (testing PG:http://www.babylonjs-playground.com/#UJEIL#13)\r\n if (useBillboardPath && camera && this.billboardMode && !useBillboardPosition) {\r\n var storedTranslation = TmpVectors.Vector3[0];\r\n this._worldMatrix.getTranslationToRef(storedTranslation); // Save translation\r\n // Cancel camera rotation\r\n TmpVectors.Matrix[1].copyFrom(camera.getViewMatrix());\r\n TmpVectors.Matrix[1].setTranslationFromFloats(0, 0, 0);\r\n TmpVectors.Matrix[1].invertToRef(TmpVectors.Matrix[0]);\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_ALL) !== TransformNode.BILLBOARDMODE_ALL) {\r\n TmpVectors.Matrix[0].decompose(undefined, TmpVectors.Quaternion[0], undefined);\r\n var eulerAngles = TmpVectors.Vector3[1];\r\n TmpVectors.Quaternion[0].toEulerAnglesToRef(eulerAngles);\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {\r\n eulerAngles.x = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {\r\n eulerAngles.y = 0;\r\n }\r\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {\r\n eulerAngles.z = 0;\r\n }\r\n Matrix.RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, TmpVectors.Matrix[0]);\r\n }\r\n this._worldMatrix.setTranslationFromFloats(0, 0, 0);\r\n this._worldMatrix.multiplyToRef(TmpVectors.Matrix[0], this._worldMatrix);\r\n // Restore translation\r\n this._worldMatrix.setTranslation(TmpVectors.Vector3[0]);\r\n }\r\n // Normal matrix\r\n if (!this.ignoreNonUniformScaling) {\r\n if (this._scaling.isNonUniformWithinEpsilon(0.000001)) {\r\n this._updateNonUniformScalingState(true);\r\n }\r\n else if (parent && parent._nonUniformScaling) {\r\n this._updateNonUniformScalingState(parent._nonUniformScaling);\r\n }\r\n else {\r\n this._updateNonUniformScalingState(false);\r\n }\r\n }\r\n else {\r\n this._updateNonUniformScalingState(false);\r\n }\r\n this._afterComputeWorldMatrix();\r\n // Absolute position\r\n this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);\r\n this._isAbsoluteSynced = false;\r\n // Callbacks\r\n this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);\r\n if (!this._poseMatrix) {\r\n this._poseMatrix = Matrix.Invert(this._worldMatrix);\r\n }\r\n // Cache the determinant\r\n this._worldMatrixDeterminantIsDirty = true;\r\n return this._worldMatrix;\r\n };\r\n /**\r\n * Resets this nodeTransform's local matrix to Matrix.Identity().\r\n * @param independentOfChildren indicates if all child nodeTransform's world-space transform should be preserved.\r\n */\r\n TransformNode.prototype.resetLocalMatrix = function (independentOfChildren) {\r\n if (independentOfChildren === void 0) { independentOfChildren = true; }\r\n this.computeWorldMatrix();\r\n if (independentOfChildren) {\r\n var children = this.getChildren();\r\n for (var i = 0; i < children.length; ++i) {\r\n var child = children[i];\r\n if (child) {\r\n child.computeWorldMatrix();\r\n var bakedMatrix = TmpVectors.Matrix[0];\r\n child._localMatrix.multiplyToRef(this._localMatrix, bakedMatrix);\r\n var tmpRotationQuaternion = TmpVectors.Quaternion[0];\r\n bakedMatrix.decompose(child.scaling, tmpRotationQuaternion, child.position);\r\n if (child.rotationQuaternion) {\r\n child.rotationQuaternion = tmpRotationQuaternion;\r\n }\r\n else {\r\n tmpRotationQuaternion.toEulerAnglesToRef(child.rotation);\r\n }\r\n }\r\n }\r\n }\r\n this.scaling.copyFromFloats(1, 1, 1);\r\n this.position.copyFromFloats(0, 0, 0);\r\n this.rotation.copyFromFloats(0, 0, 0);\r\n //only if quaternion is already set\r\n if (this.rotationQuaternion) {\r\n this.rotationQuaternion = Quaternion.Identity();\r\n }\r\n this._worldMatrix = Matrix.Identity();\r\n };\r\n TransformNode.prototype._afterComputeWorldMatrix = function () {\r\n };\r\n /**\r\n * If you'd like to be called back after the mesh position, rotation or scaling has been updated.\r\n * @param func callback function to add\r\n *\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.registerAfterWorldMatrixUpdate = function (func) {\r\n this.onAfterWorldMatrixUpdateObservable.add(func);\r\n return this;\r\n };\r\n /**\r\n * Removes a registered callback function.\r\n * @param func callback function to remove\r\n * @returns the TransformNode.\r\n */\r\n TransformNode.prototype.unregisterAfterWorldMatrixUpdate = function (func) {\r\n this.onAfterWorldMatrixUpdateObservable.removeCallback(func);\r\n return this;\r\n };\r\n /**\r\n * Gets the position of the current mesh in camera space\r\n * @param camera defines the camera to use\r\n * @returns a position\r\n */\r\n TransformNode.prototype.getPositionInCameraSpace = function (camera) {\r\n if (camera === void 0) { camera = null; }\r\n if (!camera) {\r\n camera = this.getScene().activeCamera;\r\n }\r\n return Vector3.TransformCoordinates(this.getAbsolutePosition(), camera.getViewMatrix());\r\n };\r\n /**\r\n * Returns the distance from the mesh to the active camera\r\n * @param camera defines the camera to use\r\n * @returns the distance\r\n */\r\n TransformNode.prototype.getDistanceToCamera = function (camera) {\r\n if (camera === void 0) { camera = null; }\r\n if (!camera) {\r\n camera = this.getScene().activeCamera;\r\n }\r\n return this.getAbsolutePosition().subtract(camera.globalPosition).length();\r\n };\r\n /**\r\n * Clone the current transform node\r\n * @param name Name of the new clone\r\n * @param newParent New parent for the clone\r\n * @param doNotCloneChildren Do not clone children hierarchy\r\n * @returns the new transform node\r\n */\r\n TransformNode.prototype.clone = function (name, newParent, doNotCloneChildren) {\r\n var _this = this;\r\n var result = SerializationHelper.Clone(function () { return new TransformNode(name, _this.getScene()); }, this);\r\n result.name = name;\r\n result.id = name;\r\n if (newParent) {\r\n result.parent = newParent;\r\n }\r\n if (!doNotCloneChildren) {\r\n // Children\r\n var directDescendants = this.getDescendants(true);\r\n for (var index = 0; index < directDescendants.length; index++) {\r\n var child = directDescendants[index];\r\n if (child.clone) {\r\n child.clone(name + \".\" + child.name, result);\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n /**\r\n * Serializes the objects information.\r\n * @param currentSerializationObject defines the object to serialize in\r\n * @returns the serialized object\r\n */\r\n TransformNode.prototype.serialize = function (currentSerializationObject) {\r\n var serializationObject = SerializationHelper.Serialize(this, currentSerializationObject);\r\n serializationObject.type = this.getClassName();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n serializationObject.localMatrix = this.getPivotMatrix().asArray();\r\n serializationObject.isEnabled = this.isEnabled();\r\n // Parent\r\n if (this.parent) {\r\n serializationObject.parentId = this.parent.id;\r\n }\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Returns a new TransformNode object parsed from the source provided.\r\n * @param parsedTransformNode is the source.\r\n * @param scene the scne the object belongs to\r\n * @param rootUrl is a string, it's the root URL to prefix the `delayLoadingFile` property with\r\n * @returns a new TransformNode object parsed from the source provided.\r\n */\r\n TransformNode.Parse = function (parsedTransformNode, scene, rootUrl) {\r\n var transformNode = SerializationHelper.Parse(function () { return new TransformNode(parsedTransformNode.name, scene); }, parsedTransformNode, scene, rootUrl);\r\n if (parsedTransformNode.localMatrix) {\r\n transformNode.setPreTransformMatrix(Matrix.FromArray(parsedTransformNode.localMatrix));\r\n }\r\n else if (parsedTransformNode.pivotMatrix) {\r\n transformNode.setPivotMatrix(Matrix.FromArray(parsedTransformNode.pivotMatrix));\r\n }\r\n transformNode.setEnabled(parsedTransformNode.isEnabled);\r\n // Parent\r\n if (parsedTransformNode.parentId) {\r\n transformNode._waitingParentId = parsedTransformNode.parentId;\r\n }\r\n return transformNode;\r\n };\r\n /**\r\n * Get all child-transformNodes of this node\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @returns an array of TransformNode\r\n */\r\n TransformNode.prototype.getChildTransformNodes = function (directDescendantsOnly, predicate) {\r\n var results = [];\r\n this._getDescendants(results, directDescendantsOnly, function (node) {\r\n return ((!predicate || predicate(node)) && (node instanceof TransformNode));\r\n });\r\n return results;\r\n };\r\n /**\r\n * Releases resources associated with this transform node.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n TransformNode.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {\r\n if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from scene\r\n this.getScene().removeTransformNode(this);\r\n this.onAfterWorldMatrixUpdateObservable.clear();\r\n if (doNotRecurse) {\r\n var transformNodes = this.getChildTransformNodes(true);\r\n for (var _i = 0, transformNodes_1 = transformNodes; _i < transformNodes_1.length; _i++) {\r\n var transformNode = transformNodes_1[_i];\r\n transformNode.parent = null;\r\n transformNode.computeWorldMatrix(true);\r\n }\r\n }\r\n _super.prototype.dispose.call(this, doNotRecurse, disposeMaterialAndTextures);\r\n };\r\n /**\r\n * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)\r\n * @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false\r\n * @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false\r\n * @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling\r\n * @returns the current mesh\r\n */\r\n TransformNode.prototype.normalizeToUnitCube = function (includeDescendants, ignoreRotation, predicate) {\r\n if (includeDescendants === void 0) { includeDescendants = true; }\r\n if (ignoreRotation === void 0) { ignoreRotation = false; }\r\n var storedRotation = null;\r\n var storedRotationQuaternion = null;\r\n if (ignoreRotation) {\r\n if (this.rotationQuaternion) {\r\n storedRotationQuaternion = this.rotationQuaternion.clone();\r\n this.rotationQuaternion.copyFromFloats(0, 0, 0, 1);\r\n }\r\n else if (this.rotation) {\r\n storedRotation = this.rotation.clone();\r\n this.rotation.copyFromFloats(0, 0, 0);\r\n }\r\n }\r\n var boundingVectors = this.getHierarchyBoundingVectors(includeDescendants, predicate);\r\n var sizeVec = boundingVectors.max.subtract(boundingVectors.min);\r\n var maxDimension = Math.max(sizeVec.x, sizeVec.y, sizeVec.z);\r\n if (maxDimension === 0) {\r\n return this;\r\n }\r\n var scale = 1 / maxDimension;\r\n this.scaling.scaleInPlace(scale);\r\n if (ignoreRotation) {\r\n if (this.rotationQuaternion && storedRotationQuaternion) {\r\n this.rotationQuaternion.copyFrom(storedRotationQuaternion);\r\n }\r\n else if (this.rotation && storedRotation) {\r\n this.rotation.copyFrom(storedRotation);\r\n }\r\n }\r\n return this;\r\n };\r\n TransformNode.prototype._syncAbsoluteScalingAndRotation = function () {\r\n if (!this._isAbsoluteSynced) {\r\n this._worldMatrix.decompose(this._absoluteScaling, this._absoluteRotationQuaternion);\r\n this._isAbsoluteSynced = true;\r\n }\r\n };\r\n // Statics\r\n /**\r\n * Object will not rotate to face the camera\r\n */\r\n TransformNode.BILLBOARDMODE_NONE = 0;\r\n /**\r\n * Object will rotate to face the camera but only on the x axis\r\n */\r\n TransformNode.BILLBOARDMODE_X = 1;\r\n /**\r\n * Object will rotate to face the camera but only on the y axis\r\n */\r\n TransformNode.BILLBOARDMODE_Y = 2;\r\n /**\r\n * Object will rotate to face the camera but only on the z axis\r\n */\r\n TransformNode.BILLBOARDMODE_Z = 4;\r\n /**\r\n * Object will rotate to face the camera\r\n */\r\n TransformNode.BILLBOARDMODE_ALL = 7;\r\n /**\r\n * Object will rotate to face the camera's position instead of orientation\r\n */\r\n TransformNode.BILLBOARDMODE_USE_POSITION = 128;\r\n TransformNode._TmpRotation = Quaternion.Zero();\r\n TransformNode._TmpScaling = Vector3.Zero();\r\n TransformNode._TmpTranslation = Vector3.Zero();\r\n TransformNode._lookAtVectorCache = new Vector3(0, 0, 0);\r\n TransformNode._rotationAxisCache = new Quaternion();\r\n __decorate([\r\n serializeAsVector3(\"position\")\r\n ], TransformNode.prototype, \"_position\", void 0);\r\n __decorate([\r\n serializeAsVector3(\"rotation\")\r\n ], TransformNode.prototype, \"_rotation\", void 0);\r\n __decorate([\r\n serializeAsQuaternion(\"rotationQuaternion\")\r\n ], TransformNode.prototype, \"_rotationQuaternion\", void 0);\r\n __decorate([\r\n serializeAsVector3(\"scaling\")\r\n ], TransformNode.prototype, \"_scaling\", void 0);\r\n __decorate([\r\n serialize(\"billboardMode\")\r\n ], TransformNode.prototype, \"_billboardMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], TransformNode.prototype, \"scalingDeterminant\", void 0);\r\n __decorate([\r\n serialize(\"infiniteDistance\")\r\n ], TransformNode.prototype, \"_infiniteDistance\", void 0);\r\n __decorate([\r\n serialize()\r\n ], TransformNode.prototype, \"ignoreNonUniformScaling\", void 0);\r\n __decorate([\r\n serialize()\r\n ], TransformNode.prototype, \"reIntegrateRotationIntoRotationQuaternion\", void 0);\r\n return TransformNode;\r\n}(Node));\r\nexport { TransformNode };\r\n//# sourceMappingURL=transformNode.js.map","/**\r\n * Class containing a set of static utilities functions for arrays.\r\n */\r\nvar ArrayTools = /** @class */ (function () {\r\n function ArrayTools() {\r\n }\r\n /**\r\n * Returns an array of the given size filled with element built from the given constructor and the paramters\r\n * @param size the number of element to construct and put in the array\r\n * @param itemBuilder a callback responsible for creating new instance of item. Called once per array entry.\r\n * @returns a new array filled with new objects\r\n */\r\n ArrayTools.BuildArray = function (size, itemBuilder) {\r\n var a = [];\r\n for (var i = 0; i < size; ++i) {\r\n a.push(itemBuilder());\r\n }\r\n return a;\r\n };\r\n return ArrayTools;\r\n}());\r\nexport { ArrayTools };\r\n//# sourceMappingURL=arrayTools.js.map","/**\r\n * Helper class used to generate a canvas to manipulate images\r\n */\r\nvar CanvasGenerator = /** @class */ (function () {\r\n function CanvasGenerator() {\r\n }\r\n /**\r\n * Create a new canvas (or offscreen canvas depending on the context)\r\n * @param width defines the expected width\r\n * @param height defines the expected height\r\n * @return a new canvas or offscreen canvas\r\n */\r\n CanvasGenerator.CreateCanvas = function (width, height) {\r\n if (typeof document === \"undefined\") {\r\n return new OffscreenCanvas(width, height);\r\n }\r\n var canvas = document.createElement(\"canvas\");\r\n canvas.width = width;\r\n canvas.height = height;\r\n return canvas;\r\n };\r\n return CanvasGenerator;\r\n}());\r\nexport { CanvasGenerator };\r\n//# sourceMappingURL=canvasGenerator.js.map","import { Tags } from \"../Misc/tags\";\r\nimport { Quaternion, Vector2, Vector3, Matrix } from \"../Maths/math.vector\";\r\nimport { _DevTools } from './devTools';\r\nimport { Color4, Color3 } from '../Maths/math.color';\r\nvar __decoratorInitialStore = {};\r\nvar __mergedStore = {};\r\nvar _copySource = function (creationFunction, source, instanciate) {\r\n var destination = creationFunction();\r\n // Tags\r\n if (Tags) {\r\n Tags.AddTagsTo(destination, source.tags);\r\n }\r\n var classStore = getMergedStore(destination);\r\n // Properties\r\n for (var property in classStore) {\r\n var propertyDescriptor = classStore[property];\r\n var sourceProperty = source[property];\r\n var propertyType = propertyDescriptor.type;\r\n if (sourceProperty !== undefined && sourceProperty !== null && property !== \"uniqueId\") {\r\n switch (propertyType) {\r\n case 0: // Value\r\n case 6: // Mesh reference\r\n case 11: // Camera reference\r\n destination[property] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n destination[property] = (instanciate || sourceProperty.isRenderTarget) ? sourceProperty : sourceProperty.clone();\r\n break;\r\n case 2: // Color3\r\n case 3: // FresnelParameters\r\n case 4: // Vector2\r\n case 5: // Vector3\r\n case 7: // Color Curves\r\n case 10: // Quaternion\r\n case 12: // Matrix\r\n destination[property] = instanciate ? sourceProperty : sourceProperty.clone();\r\n break;\r\n }\r\n }\r\n }\r\n return destination;\r\n};\r\nfunction getDirectStore(target) {\r\n var classKey = target.getClassName();\r\n if (!__decoratorInitialStore[classKey]) {\r\n __decoratorInitialStore[classKey] = {};\r\n }\r\n return __decoratorInitialStore[classKey];\r\n}\r\n/**\r\n * Return the list of properties flagged as serializable\r\n * @param target: host object\r\n */\r\nfunction getMergedStore(target) {\r\n var classKey = target.getClassName();\r\n if (__mergedStore[classKey]) {\r\n return __mergedStore[classKey];\r\n }\r\n __mergedStore[classKey] = {};\r\n var store = __mergedStore[classKey];\r\n var currentTarget = target;\r\n var currentKey = classKey;\r\n while (currentKey) {\r\n var initialStore = __decoratorInitialStore[currentKey];\r\n for (var property in initialStore) {\r\n store[property] = initialStore[property];\r\n }\r\n var parent_1 = void 0;\r\n var done = false;\r\n do {\r\n parent_1 = Object.getPrototypeOf(currentTarget);\r\n if (!parent_1.getClassName) {\r\n done = true;\r\n break;\r\n }\r\n if (parent_1.getClassName() !== currentKey) {\r\n break;\r\n }\r\n currentTarget = parent_1;\r\n } while (parent_1);\r\n if (done) {\r\n break;\r\n }\r\n currentKey = parent_1.getClassName();\r\n currentTarget = parent_1;\r\n }\r\n return store;\r\n}\r\nfunction generateSerializableMember(type, sourceName) {\r\n return function (target, propertyKey) {\r\n var classStore = getDirectStore(target);\r\n if (!classStore[propertyKey]) {\r\n classStore[propertyKey] = { type: type, sourceName: sourceName };\r\n }\r\n };\r\n}\r\nfunction generateExpandMember(setCallback, targetKey) {\r\n if (targetKey === void 0) { targetKey = null; }\r\n return function (target, propertyKey) {\r\n var key = targetKey || (\"_\" + propertyKey);\r\n Object.defineProperty(target, propertyKey, {\r\n get: function () {\r\n return this[key];\r\n },\r\n set: function (value) {\r\n if (this[key] === value) {\r\n return;\r\n }\r\n this[key] = value;\r\n target[setCallback].apply(this);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n };\r\n}\r\nexport function expandToProperty(callback, targetKey) {\r\n if (targetKey === void 0) { targetKey = null; }\r\n return generateExpandMember(callback, targetKey);\r\n}\r\nexport function serialize(sourceName) {\r\n return generateSerializableMember(0, sourceName); // value member\r\n}\r\nexport function serializeAsTexture(sourceName) {\r\n return generateSerializableMember(1, sourceName); // texture member\r\n}\r\nexport function serializeAsColor3(sourceName) {\r\n return generateSerializableMember(2, sourceName); // color3 member\r\n}\r\nexport function serializeAsFresnelParameters(sourceName) {\r\n return generateSerializableMember(3, sourceName); // fresnel parameters member\r\n}\r\nexport function serializeAsVector2(sourceName) {\r\n return generateSerializableMember(4, sourceName); // vector2 member\r\n}\r\nexport function serializeAsVector3(sourceName) {\r\n return generateSerializableMember(5, sourceName); // vector3 member\r\n}\r\nexport function serializeAsMeshReference(sourceName) {\r\n return generateSerializableMember(6, sourceName); // mesh reference member\r\n}\r\nexport function serializeAsColorCurves(sourceName) {\r\n return generateSerializableMember(7, sourceName); // color curves\r\n}\r\nexport function serializeAsColor4(sourceName) {\r\n return generateSerializableMember(8, sourceName); // color 4\r\n}\r\nexport function serializeAsImageProcessingConfiguration(sourceName) {\r\n return generateSerializableMember(9, sourceName); // image processing\r\n}\r\nexport function serializeAsQuaternion(sourceName) {\r\n return generateSerializableMember(10, sourceName); // quaternion member\r\n}\r\nexport function serializeAsMatrix(sourceName) {\r\n return generateSerializableMember(12, sourceName); // matrix member\r\n}\r\n/**\r\n * Decorator used to define property that can be serialized as reference to a camera\r\n * @param sourceName defines the name of the property to decorate\r\n */\r\nexport function serializeAsCameraReference(sourceName) {\r\n return generateSerializableMember(11, sourceName); // camera reference member\r\n}\r\n/**\r\n * Class used to help serialization objects\r\n */\r\nvar SerializationHelper = /** @class */ (function () {\r\n function SerializationHelper() {\r\n }\r\n /**\r\n * Appends the serialized animations from the source animations\r\n * @param source Source containing the animations\r\n * @param destination Target to store the animations\r\n */\r\n SerializationHelper.AppendSerializedAnimations = function (source, destination) {\r\n if (source.animations) {\r\n destination.animations = [];\r\n for (var animationIndex = 0; animationIndex < source.animations.length; animationIndex++) {\r\n var animation = source.animations[animationIndex];\r\n destination.animations.push(animation.serialize());\r\n }\r\n }\r\n };\r\n /**\r\n * Static function used to serialized a specific entity\r\n * @param entity defines the entity to serialize\r\n * @param serializationObject defines the optional target obecjt where serialization data will be stored\r\n * @returns a JSON compatible object representing the serialization of the entity\r\n */\r\n SerializationHelper.Serialize = function (entity, serializationObject) {\r\n if (!serializationObject) {\r\n serializationObject = {};\r\n }\r\n // Tags\r\n if (Tags) {\r\n serializationObject.tags = Tags.GetTags(entity);\r\n }\r\n var serializedProperties = getMergedStore(entity);\r\n // Properties\r\n for (var property in serializedProperties) {\r\n var propertyDescriptor = serializedProperties[property];\r\n var targetPropertyName = propertyDescriptor.sourceName || property;\r\n var propertyType = propertyDescriptor.type;\r\n var sourceProperty = entity[property];\r\n if (sourceProperty !== undefined && sourceProperty !== null && property !== \"uniqueId\") {\r\n switch (propertyType) {\r\n case 0: // Value\r\n serializationObject[targetPropertyName] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 2: // Color3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 3: // FresnelParameters\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 4: // Vector2\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 5: // Vector3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 6: // Mesh reference\r\n serializationObject[targetPropertyName] = sourceProperty.id;\r\n break;\r\n case 7: // Color Curves\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 8: // Color 4\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 9: // Image Processing\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 10: // Quaternion\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 11: // Camera reference\r\n serializationObject[targetPropertyName] = sourceProperty.id;\r\n case 12: // Matrix\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n }\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a new entity from a serialization data object\r\n * @param creationFunction defines a function used to instanciated the new entity\r\n * @param source defines the source serialization data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url for resources\r\n * @returns a new entity\r\n */\r\n SerializationHelper.Parse = function (creationFunction, source, scene, rootUrl) {\r\n if (rootUrl === void 0) { rootUrl = null; }\r\n var destination = creationFunction();\r\n if (!rootUrl) {\r\n rootUrl = \"\";\r\n }\r\n // Tags\r\n if (Tags) {\r\n Tags.AddTagsTo(destination, source.tags);\r\n }\r\n var classStore = getMergedStore(destination);\r\n // Properties\r\n for (var property in classStore) {\r\n var propertyDescriptor = classStore[property];\r\n var sourceProperty = source[propertyDescriptor.sourceName || property];\r\n var propertyType = propertyDescriptor.type;\r\n if (sourceProperty !== undefined && sourceProperty !== null && property !== \"uniqueId\") {\r\n var dest = destination;\r\n switch (propertyType) {\r\n case 0: // Value\r\n dest[property] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n if (scene) {\r\n dest[property] = SerializationHelper._TextureParser(sourceProperty, scene, rootUrl);\r\n }\r\n break;\r\n case 2: // Color3\r\n dest[property] = Color3.FromArray(sourceProperty);\r\n break;\r\n case 3: // FresnelParameters\r\n dest[property] = SerializationHelper._FresnelParametersParser(sourceProperty);\r\n break;\r\n case 4: // Vector2\r\n dest[property] = Vector2.FromArray(sourceProperty);\r\n break;\r\n case 5: // Vector3\r\n dest[property] = Vector3.FromArray(sourceProperty);\r\n break;\r\n case 6: // Mesh reference\r\n if (scene) {\r\n dest[property] = scene.getLastMeshByID(sourceProperty);\r\n }\r\n break;\r\n case 7: // Color Curves\r\n dest[property] = SerializationHelper._ColorCurvesParser(sourceProperty);\r\n break;\r\n case 8: // Color 4\r\n dest[property] = Color4.FromArray(sourceProperty);\r\n break;\r\n case 9: // Image Processing\r\n dest[property] = SerializationHelper._ImageProcessingConfigurationParser(sourceProperty);\r\n break;\r\n case 10: // Quaternion\r\n dest[property] = Quaternion.FromArray(sourceProperty);\r\n break;\r\n case 11: // Camera reference\r\n if (scene) {\r\n dest[property] = scene.getCameraByID(sourceProperty);\r\n }\r\n case 12: // Matrix\r\n dest[property] = Matrix.FromArray(sourceProperty);\r\n break;\r\n }\r\n }\r\n }\r\n return destination;\r\n };\r\n /**\r\n * Clones an object\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @returns the cloned object\r\n */\r\n SerializationHelper.Clone = function (creationFunction, source) {\r\n return _copySource(creationFunction, source, false);\r\n };\r\n /**\r\n * Instanciates a new object based on a source one (some data will be shared between both object)\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @returns the new object\r\n */\r\n SerializationHelper.Instanciate = function (creationFunction, source) {\r\n return _copySource(creationFunction, source, true);\r\n };\r\n /** @hidden */\r\n SerializationHelper._ImageProcessingConfigurationParser = function (sourceProperty) {\r\n throw _DevTools.WarnImport(\"ImageProcessingConfiguration\");\r\n };\r\n /** @hidden */\r\n SerializationHelper._FresnelParametersParser = function (sourceProperty) {\r\n throw _DevTools.WarnImport(\"FresnelParameters\");\r\n };\r\n /** @hidden */\r\n SerializationHelper._ColorCurvesParser = function (sourceProperty) {\r\n throw _DevTools.WarnImport(\"ColorCurves\");\r\n };\r\n /** @hidden */\r\n SerializationHelper._TextureParser = function (sourceProperty, scene, rootUrl) {\r\n throw _DevTools.WarnImport(\"Texture\");\r\n };\r\n return SerializationHelper;\r\n}());\r\nexport { SerializationHelper };\r\n//# sourceMappingURL=decorators.js.map","import { StringTools } from './stringTools';\r\nimport { Logger } from './logger';\r\nvar cloneValue = function (source, destinationObject) {\r\n if (!source) {\r\n return null;\r\n }\r\n if (source.getClassName && source.getClassName() === \"Mesh\") {\r\n return null;\r\n }\r\n if (source.getClassName && source.getClassName() === \"SubMesh\") {\r\n return source.clone(destinationObject);\r\n }\r\n else if (source.clone) {\r\n return source.clone();\r\n }\r\n return null;\r\n};\r\nfunction getAllPropertyNames(obj) {\r\n var props = [];\r\n do {\r\n Object.getOwnPropertyNames(obj).forEach(function (prop) {\r\n if (props.indexOf(prop) === -1) {\r\n props.push(prop);\r\n }\r\n });\r\n } while (obj = Object.getPrototypeOf(obj));\r\n return props;\r\n}\r\n/**\r\n * Class containing a set of static utilities functions for deep copy.\r\n */\r\nvar DeepCopier = /** @class */ (function () {\r\n function DeepCopier() {\r\n }\r\n /**\r\n * Tries to copy an object by duplicating every property\r\n * @param source defines the source object\r\n * @param destination defines the target object\r\n * @param doNotCopyList defines a list of properties to avoid\r\n * @param mustCopyList defines a list of properties to copy (even if they start with _)\r\n */\r\n DeepCopier.DeepCopy = function (source, destination, doNotCopyList, mustCopyList) {\r\n var proerties = getAllPropertyNames(source);\r\n for (var _i = 0, proerties_1 = proerties; _i < proerties_1.length; _i++) {\r\n var prop = proerties_1[_i];\r\n if (prop[0] === \"_\" && (!mustCopyList || mustCopyList.indexOf(prop) === -1)) {\r\n continue;\r\n }\r\n if (StringTools.EndsWith(prop, \"Observable\")) {\r\n continue;\r\n }\r\n if (doNotCopyList && doNotCopyList.indexOf(prop) !== -1) {\r\n continue;\r\n }\r\n var sourceValue = source[prop];\r\n var typeOfSourceValue = typeof sourceValue;\r\n if (typeOfSourceValue === \"function\") {\r\n continue;\r\n }\r\n try {\r\n if (typeOfSourceValue === \"object\") {\r\n if (sourceValue instanceof Array) {\r\n destination[prop] = [];\r\n if (sourceValue.length > 0) {\r\n if (typeof sourceValue[0] == \"object\") {\r\n for (var index = 0; index < sourceValue.length; index++) {\r\n var clonedValue = cloneValue(sourceValue[index], destination);\r\n if (destination[prop].indexOf(clonedValue) === -1) { // Test if auto inject was not done\r\n destination[prop].push(clonedValue);\r\n }\r\n }\r\n }\r\n else {\r\n destination[prop] = sourceValue.slice(0);\r\n }\r\n }\r\n }\r\n else {\r\n destination[prop] = cloneValue(sourceValue, destination);\r\n }\r\n }\r\n else {\r\n destination[prop] = sourceValue;\r\n }\r\n }\r\n catch (e) {\r\n // Log a warning (it could be because of a read-only property)\r\n Logger.Warn(e.message);\r\n }\r\n }\r\n };\r\n return DeepCopier;\r\n}());\r\nexport { DeepCopier };\r\n//# sourceMappingURL=deepCopier.js.map","/** @hidden */\r\nvar _DevTools = /** @class */ (function () {\r\n function _DevTools() {\r\n }\r\n _DevTools.WarnImport = function (name) {\r\n return name + \" needs to be imported before as it contains a side-effect required by your code.\";\r\n };\r\n return _DevTools;\r\n}());\r\nexport { _DevTools };\r\n//# sourceMappingURL=devTools.js.map","/**\r\n * Sets of helpers dealing with the DOM and some of the recurrent functions needed in\r\n * Babylon.js\r\n */\r\nvar DomManagement = /** @class */ (function () {\r\n function DomManagement() {\r\n }\r\n /**\r\n * Checks if the window object exists\r\n * @returns true if the window object exists\r\n */\r\n DomManagement.IsWindowObjectExist = function () {\r\n return (typeof window) !== \"undefined\";\r\n };\r\n /**\r\n * Checks if the navigator object exists\r\n * @returns true if the navigator object exists\r\n */\r\n DomManagement.IsNavigatorAvailable = function () {\r\n return (typeof navigator) !== \"undefined\";\r\n };\r\n /**\r\n * Check if the document object exists\r\n * @returns true if the document object exists\r\n */\r\n DomManagement.IsDocumentAvailable = function () {\r\n return (typeof document) !== \"undefined\";\r\n };\r\n /**\r\n * Extracts text content from a DOM element hierarchy\r\n * @param element defines the root element\r\n * @returns a string\r\n */\r\n DomManagement.GetDOMTextContent = function (element) {\r\n var result = \"\";\r\n var child = element.firstChild;\r\n while (child) {\r\n if (child.nodeType === 3) {\r\n result += child.textContent;\r\n }\r\n child = (child.nextSibling);\r\n }\r\n return result;\r\n };\r\n return DomManagement;\r\n}());\r\nexport { DomManagement };\r\n//# sourceMappingURL=domManagement.js.map","/**\r\n * Class used to define a retry strategy when error happens while loading assets\r\n */\r\nvar RetryStrategy = /** @class */ (function () {\r\n function RetryStrategy() {\r\n }\r\n /**\r\n * Function used to defines an exponential back off strategy\r\n * @param maxRetries defines the maximum number of retries (3 by default)\r\n * @param baseInterval defines the interval between retries\r\n * @returns the strategy function to use\r\n */\r\n RetryStrategy.ExponentialBackoff = function (maxRetries, baseInterval) {\r\n if (maxRetries === void 0) { maxRetries = 3; }\r\n if (baseInterval === void 0) { baseInterval = 500; }\r\n return function (url, request, retryIndex) {\r\n if (request.status !== 0 || retryIndex >= maxRetries || url.indexOf(\"file:\") !== -1) {\r\n return -1;\r\n }\r\n return Math.pow(2, retryIndex) * baseInterval;\r\n };\r\n };\r\n return RetryStrategy;\r\n}());\r\nexport { RetryStrategy };\r\n//# sourceMappingURL=retryStrategy.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * @ignore\r\n * Application error to support additional information when loading a file\r\n */\r\nvar BaseError = /** @class */ (function (_super) {\r\n __extends(BaseError, _super);\r\n function BaseError() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n // See https://stackoverflow.com/questions/12915412/how-do-i-extend-a-host-object-e-g-error-in-typescript\r\n // and https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work\r\n // Polyfill for Object.setPrototypeOf if necessary.\r\n BaseError._setPrototypeOf = Object.setPrototypeOf || (function (o, proto) { o.__proto__ = proto; return o; });\r\n return BaseError;\r\n}(Error));\r\nexport { BaseError };\r\n//# sourceMappingURL=baseError.js.map","import { __extends } from \"tslib\";\r\nimport { WebRequest } from './webRequest';\r\nimport { DomManagement } from './domManagement';\r\nimport { Observable } from './observable';\r\nimport { FilesInputStore } from './filesInputStore';\r\nimport { RetryStrategy } from './retryStrategy';\r\nimport { BaseError } from './baseError';\r\nimport { StringTools } from './stringTools';\r\nimport { ThinEngine } from '../Engines/thinEngine';\r\nimport { ShaderProcessor } from '../Engines/Processors/shaderProcessor';\r\n/** @ignore */\r\nvar LoadFileError = /** @class */ (function (_super) {\r\n __extends(LoadFileError, _super);\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param request defines the optional web request\r\n * @param file defines the optional file\r\n */\r\n function LoadFileError(message, object) {\r\n var _this = _super.call(this, message) || this;\r\n _this.name = \"LoadFileError\";\r\n BaseError._setPrototypeOf(_this, LoadFileError.prototype);\r\n if (object instanceof WebRequest) {\r\n _this.request = object;\r\n }\r\n else {\r\n _this.file = object;\r\n }\r\n return _this;\r\n }\r\n return LoadFileError;\r\n}(BaseError));\r\nexport { LoadFileError };\r\n/** @ignore */\r\nvar RequestFileError = /** @class */ (function (_super) {\r\n __extends(RequestFileError, _super);\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param request defines the optional web request\r\n */\r\n function RequestFileError(message, request) {\r\n var _this = _super.call(this, message) || this;\r\n _this.request = request;\r\n _this.name = \"RequestFileError\";\r\n BaseError._setPrototypeOf(_this, RequestFileError.prototype);\r\n return _this;\r\n }\r\n return RequestFileError;\r\n}(BaseError));\r\nexport { RequestFileError };\r\n/** @ignore */\r\nvar ReadFileError = /** @class */ (function (_super) {\r\n __extends(ReadFileError, _super);\r\n /**\r\n * Creates a new ReadFileError\r\n * @param message defines the message of the error\r\n * @param file defines the optional file\r\n */\r\n function ReadFileError(message, file) {\r\n var _this = _super.call(this, message) || this;\r\n _this.file = file;\r\n _this.name = \"ReadFileError\";\r\n BaseError._setPrototypeOf(_this, ReadFileError.prototype);\r\n return _this;\r\n }\r\n return ReadFileError;\r\n}(BaseError));\r\nexport { ReadFileError };\r\n/**\r\n * @hidden\r\n */\r\nvar FileTools = /** @class */ (function () {\r\n function FileTools() {\r\n }\r\n /**\r\n * Removes unwanted characters from an url\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\n FileTools._CleanUrl = function (url) {\r\n url = url.replace(/#/mg, \"%23\");\r\n return url;\r\n };\r\n /**\r\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\r\n * @param url define the url we are trying\r\n * @param element define the dom element where to configure the cors policy\r\n */\r\n FileTools.SetCorsBehavior = function (url, element) {\r\n if (url && url.indexOf(\"data:\") === 0) {\r\n return;\r\n }\r\n if (FileTools.CorsBehavior) {\r\n if (typeof (FileTools.CorsBehavior) === 'string' || this.CorsBehavior instanceof String) {\r\n element.crossOrigin = FileTools.CorsBehavior;\r\n }\r\n else {\r\n var result = FileTools.CorsBehavior(url);\r\n if (result) {\r\n element.crossOrigin = result;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @param mimeType optional mime type\r\n * @returns the HTMLImageElement of the loaded image\r\n */\r\n FileTools.LoadImage = function (input, onLoad, onError, offlineProvider, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"\"; }\r\n var url;\r\n var usingObjectURL = false;\r\n if (input instanceof ArrayBuffer || ArrayBuffer.isView(input)) {\r\n if (typeof Blob !== 'undefined') {\r\n url = URL.createObjectURL(new Blob([input], { type: mimeType }));\r\n usingObjectURL = true;\r\n }\r\n else {\r\n url = \"data:\" + mimeType + \";base64,\" + StringTools.EncodeArrayBufferToBase64(input);\r\n }\r\n }\r\n else if (input instanceof Blob) {\r\n url = URL.createObjectURL(input);\r\n usingObjectURL = true;\r\n }\r\n else {\r\n url = FileTools._CleanUrl(input);\r\n url = FileTools.PreprocessUrl(input);\r\n }\r\n if (typeof Image === \"undefined\") {\r\n FileTools.LoadFile(url, function (data) {\r\n createImageBitmap(new Blob([data], { type: mimeType })).then(function (imgBmp) {\r\n onLoad(imgBmp);\r\n if (usingObjectURL) {\r\n URL.revokeObjectURL(url);\r\n }\r\n }).catch(function (reason) {\r\n if (onError) {\r\n onError(\"Error while trying to load image: \" + input, reason);\r\n }\r\n });\r\n }, undefined, offlineProvider || undefined, true, function (request, exception) {\r\n if (onError) {\r\n onError(\"Error while trying to load image: \" + input, exception);\r\n }\r\n });\r\n return null;\r\n }\r\n var img = new Image();\r\n FileTools.SetCorsBehavior(url, img);\r\n var loadHandler = function () {\r\n img.removeEventListener(\"load\", loadHandler);\r\n img.removeEventListener(\"error\", errorHandler);\r\n onLoad(img);\r\n // Must revoke the URL after calling onLoad to avoid security exceptions in\r\n // certain scenarios (e.g. when hosted in vscode).\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n var errorHandler = function (err) {\r\n img.removeEventListener(\"load\", loadHandler);\r\n img.removeEventListener(\"error\", errorHandler);\r\n if (onError) {\r\n var inputText = input.toString();\r\n onError(\"Error while trying to load image: \" + (inputText.length < 32 ? inputText : inputText.slice(0, 32) + \"...\"), err);\r\n }\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n img.addEventListener(\"load\", loadHandler);\r\n img.addEventListener(\"error\", errorHandler);\r\n var noOfflineSupport = function () {\r\n img.src = url;\r\n };\r\n var loadFromOfflineSupport = function () {\r\n if (offlineProvider) {\r\n offlineProvider.loadImage(url, img);\r\n }\r\n };\r\n if (url.substr(0, 5) !== \"data:\" && offlineProvider && offlineProvider.enableTexturesOffline) {\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\r\n }\r\n else {\r\n if (url.indexOf(\"file:\") !== -1) {\r\n var textureName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (FilesInputStore.FilesToLoad[textureName]) {\r\n try {\r\n var blobURL;\r\n try {\r\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\r\n }\r\n catch (ex) {\r\n // Chrome doesn't support oneTimeOnly parameter\r\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\r\n }\r\n img.src = blobURL;\r\n usingObjectURL = true;\r\n }\r\n catch (e) {\r\n img.src = \"\";\r\n }\r\n return img;\r\n }\r\n }\r\n noOfflineSupport();\r\n }\r\n return img;\r\n };\r\n /**\r\n * Reads a file from a File object\r\n * @param file defines the file to load\r\n * @param onSuccess defines the callback to call when data is loaded\r\n * @param onProgress defines the callback to call during loading process\r\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\r\n * @param onError defines the callback to call when an error occurs\r\n * @returns a file request object\r\n */\r\n FileTools.ReadFile = function (file, onSuccess, onProgress, useArrayBuffer, onError) {\r\n var reader = new FileReader();\r\n var request = {\r\n onCompleteObservable: new Observable(),\r\n abort: function () { return reader.abort(); },\r\n };\r\n reader.onloadend = function (e) { return request.onCompleteObservable.notifyObservers(request); };\r\n if (onError) {\r\n reader.onerror = function (e) {\r\n onError(new ReadFileError(\"Unable to read \" + file.name, file));\r\n };\r\n }\r\n reader.onload = function (e) {\r\n //target doesn't have result from ts 1.3\r\n onSuccess(e.target['result']);\r\n };\r\n if (onProgress) {\r\n reader.onprogress = onProgress;\r\n }\r\n if (!useArrayBuffer) {\r\n // Asynchronous read\r\n reader.readAsText(file);\r\n }\r\n else {\r\n reader.readAsArrayBuffer(file);\r\n }\r\n return request;\r\n };\r\n /**\r\n * Loads a file from a url\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n */\r\n FileTools.LoadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n // If file and file input are set\r\n if (url.indexOf(\"file:\") !== -1) {\r\n var fileName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (fileName.indexOf('./') === 0) {\r\n fileName = fileName.substring(2);\r\n }\r\n var file = FilesInputStore.FilesToLoad[fileName];\r\n if (file) {\r\n return FileTools.ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError ? function (error) { return onError(undefined, new LoadFileError(error.message, error.file)); } : undefined);\r\n }\r\n }\r\n return FileTools.RequestFile(url, function (data, request) {\r\n onSuccess(data, request ? request.responseURL : undefined);\r\n }, onProgress, offlineProvider, useArrayBuffer, onError ? function (error) {\r\n onError(error.request, new LoadFileError(error.message, error.request));\r\n } : undefined);\r\n };\r\n /**\r\n * Loads a file\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param onOpened callback called when the web request is opened\r\n * @returns a file request object\r\n */\r\n FileTools.RequestFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError, onOpened) {\r\n url = FileTools._CleanUrl(url);\r\n url = FileTools.PreprocessUrl(url);\r\n var loadUrl = FileTools.BaseUrl + url;\r\n var aborted = false;\r\n var fileRequest = {\r\n onCompleteObservable: new Observable(),\r\n abort: function () { return aborted = true; },\r\n };\r\n var requestFile = function () {\r\n var request = new WebRequest();\r\n var retryHandle = null;\r\n fileRequest.abort = function () {\r\n aborted = true;\r\n if (request.readyState !== (XMLHttpRequest.DONE || 4)) {\r\n request.abort();\r\n }\r\n if (retryHandle !== null) {\r\n clearTimeout(retryHandle);\r\n retryHandle = null;\r\n }\r\n };\r\n var retryLoop = function (retryIndex) {\r\n request.open('GET', loadUrl);\r\n if (onOpened) {\r\n onOpened(request);\r\n }\r\n if (useArrayBuffer) {\r\n request.responseType = \"arraybuffer\";\r\n }\r\n if (onProgress) {\r\n request.addEventListener(\"progress\", onProgress);\r\n }\r\n var onLoadEnd = function () {\r\n request.removeEventListener(\"loadend\", onLoadEnd);\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n fileRequest.onCompleteObservable.clear();\r\n };\r\n request.addEventListener(\"loadend\", onLoadEnd);\r\n var onReadyStateChange = function () {\r\n if (aborted) {\r\n return;\r\n }\r\n // In case of undefined state in some browsers.\r\n if (request.readyState === (XMLHttpRequest.DONE || 4)) {\r\n // Some browsers have issues where onreadystatechange can be called multiple times with the same value.\r\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\r\n if ((request.status >= 200 && request.status < 300) || (request.status === 0 && (!DomManagement.IsWindowObjectExist() || FileTools.IsFileURL()))) {\r\n onSuccess(useArrayBuffer ? request.response : request.responseText, request);\r\n return;\r\n }\r\n var retryStrategy = FileTools.DefaultRetryStrategy;\r\n if (retryStrategy) {\r\n var waitTime = retryStrategy(loadUrl, request, retryIndex);\r\n if (waitTime !== -1) {\r\n // Prevent the request from completing for retry.\r\n request.removeEventListener(\"loadend\", onLoadEnd);\r\n request = new WebRequest();\r\n retryHandle = setTimeout(function () { return retryLoop(retryIndex + 1); }, waitTime);\r\n return;\r\n }\r\n }\r\n var error = new RequestFileError(\"Error status: \" + request.status + \" \" + request.statusText + \" - Unable to load \" + loadUrl, request);\r\n if (onError) {\r\n onError(error);\r\n }\r\n }\r\n };\r\n request.addEventListener(\"readystatechange\", onReadyStateChange);\r\n request.send();\r\n };\r\n retryLoop(0);\r\n };\r\n // Caching all files\r\n if (offlineProvider && offlineProvider.enableSceneOffline) {\r\n var noOfflineSupport_1 = function (request) {\r\n if (request && request.status > 400) {\r\n if (onError) {\r\n onError(request);\r\n }\r\n }\r\n else {\r\n requestFile();\r\n }\r\n };\r\n var loadFromOfflineSupport = function () {\r\n // TODO: database needs to support aborting and should return a IFileRequest\r\n if (offlineProvider) {\r\n offlineProvider.loadFile(FileTools.BaseUrl + url, function (data) {\r\n if (!aborted) {\r\n onSuccess(data);\r\n }\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n }, onProgress ? function (event) {\r\n if (!aborted) {\r\n onProgress(event);\r\n }\r\n } : undefined, noOfflineSupport_1, useArrayBuffer);\r\n }\r\n };\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport_1);\r\n }\r\n else {\r\n requestFile();\r\n }\r\n return fileRequest;\r\n };\r\n /**\r\n * Checks if the loaded document was accessed via `file:`-Protocol.\r\n * @returns boolean\r\n */\r\n FileTools.IsFileURL = function () {\r\n return typeof location !== \"undefined\" && location.protocol === \"file:\";\r\n };\r\n /**\r\n * Gets or sets the retry strategy to apply when an error happens while loading an asset\r\n */\r\n FileTools.DefaultRetryStrategy = RetryStrategy.ExponentialBackoff();\r\n /**\r\n * Gets or sets the base URL to use to load assets\r\n */\r\n FileTools.BaseUrl = \"\";\r\n /**\r\n * Default behaviour for cors in the application.\r\n * It can be a string if the expected behavior is identical in the entire app.\r\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\r\n */\r\n FileTools.CorsBehavior = \"anonymous\";\r\n /**\r\n * Gets or sets a function used to pre-process url before using them to load assets\r\n */\r\n FileTools.PreprocessUrl = function (url) {\r\n return url;\r\n };\r\n return FileTools;\r\n}());\r\nexport { FileTools };\r\nThinEngine._FileToolsLoadImage = FileTools.LoadImage.bind(FileTools);\r\nThinEngine._FileToolsLoadFile = FileTools.LoadFile.bind(FileTools);\r\nShaderProcessor._FileToolsLoadFile = FileTools.LoadFile.bind(FileTools);\r\n//# sourceMappingURL=fileTools.js.map","/**\r\n * Class used to help managing file picking and drag'n'drop\r\n * File Storage\r\n */\r\nvar FilesInputStore = /** @class */ (function () {\r\n function FilesInputStore() {\r\n }\r\n /**\r\n * List of files ready to be loaded\r\n */\r\n FilesInputStore.FilesToLoad = {};\r\n return FilesInputStore;\r\n}());\r\nexport { FilesInputStore };\r\n//# sourceMappingURL=filesInputStore.js.map","/**\r\n * Class used to manipulate GUIDs\r\n */\r\nvar GUID = /** @class */ (function () {\r\n function GUID() {\r\n }\r\n /**\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a pseudo random id\r\n */\r\n GUID.RandomId = function () {\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\r\n var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n };\r\n return GUID;\r\n}());\r\nexport { GUID };\r\n//# sourceMappingURL=guid.js.map","import { Logger } from './logger';\r\nimport { _TypeStore } from './typeStore';\r\n/**\r\n * Class used to enable instatition of objects by class name\r\n */\r\nvar InstantiationTools = /** @class */ (function () {\r\n function InstantiationTools() {\r\n }\r\n /**\r\n * Tries to instantiate a new object from a given class name\r\n * @param className defines the class name to instantiate\r\n * @returns the new object or null if the system was not able to do the instantiation\r\n */\r\n InstantiationTools.Instantiate = function (className) {\r\n if (this.RegisteredExternalClasses && this.RegisteredExternalClasses[className]) {\r\n return this.RegisteredExternalClasses[className];\r\n }\r\n var internalClass = _TypeStore.GetClass(className);\r\n if (internalClass) {\r\n return internalClass;\r\n }\r\n Logger.Warn(className + \" not found, you may have missed an import.\");\r\n var arr = className.split(\".\");\r\n var fn = (window || this);\r\n for (var i = 0, len = arr.length; i < len; i++) {\r\n fn = fn[arr[i]];\r\n }\r\n if (typeof fn !== \"function\") {\r\n return null;\r\n }\r\n return fn;\r\n };\r\n /**\r\n * Use this object to register external classes like custom textures or material\r\n * to allow the laoders to instantiate them\r\n */\r\n InstantiationTools.RegisteredExternalClasses = {};\r\n return InstantiationTools;\r\n}());\r\nexport { InstantiationTools };\r\n//# sourceMappingURL=instantiationTools.js.map","/**\r\n * Logger used througouht the application to allow configuration of\r\n * the log level required for the messages.\r\n */\r\nvar Logger = /** @class */ (function () {\r\n function Logger() {\r\n }\r\n Logger._AddLogEntry = function (entry) {\r\n Logger._LogCache = entry + Logger._LogCache;\r\n if (Logger.OnNewCacheEntry) {\r\n Logger.OnNewCacheEntry(entry);\r\n }\r\n };\r\n Logger._FormatMessage = function (message) {\r\n var padStr = function (i) { return (i < 10) ? \"0\" + i : \"\" + i; };\r\n var date = new Date();\r\n return \"[\" + padStr(date.getHours()) + \":\" + padStr(date.getMinutes()) + \":\" + padStr(date.getSeconds()) + \"]: \" + message;\r\n };\r\n Logger._LogDisabled = function (message) {\r\n // nothing to do\r\n };\r\n Logger._LogEnabled = function (message) {\r\n var formattedMessage = Logger._FormatMessage(message);\r\n console.log(\"BJS - \" + formattedMessage);\r\n var entry = \"
\" + formattedMessage + \"

\";\r\n Logger._AddLogEntry(entry);\r\n };\r\n Logger._WarnDisabled = function (message) {\r\n // nothing to do\r\n };\r\n Logger._WarnEnabled = function (message) {\r\n var formattedMessage = Logger._FormatMessage(message);\r\n console.warn(\"BJS - \" + formattedMessage);\r\n var entry = \"
\" + formattedMessage + \"

\";\r\n Logger._AddLogEntry(entry);\r\n };\r\n Logger._ErrorDisabled = function (message) {\r\n // nothing to do\r\n };\r\n Logger._ErrorEnabled = function (message) {\r\n Logger.errorsCount++;\r\n var formattedMessage = Logger._FormatMessage(message);\r\n console.error(\"BJS - \" + formattedMessage);\r\n var entry = \"
\" + formattedMessage + \"

\";\r\n Logger._AddLogEntry(entry);\r\n };\r\n Object.defineProperty(Logger, \"LogCache\", {\r\n /**\r\n * Gets current log cache (list of logs)\r\n */\r\n get: function () {\r\n return Logger._LogCache;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Clears the log cache\r\n */\r\n Logger.ClearLogCache = function () {\r\n Logger._LogCache = \"\";\r\n Logger.errorsCount = 0;\r\n };\r\n Object.defineProperty(Logger, \"LogLevels\", {\r\n /**\r\n * Sets the current log level (MessageLogLevel / WarningLogLevel / ErrorLogLevel)\r\n */\r\n set: function (level) {\r\n if ((level & Logger.MessageLogLevel) === Logger.MessageLogLevel) {\r\n Logger.Log = Logger._LogEnabled;\r\n }\r\n else {\r\n Logger.Log = Logger._LogDisabled;\r\n }\r\n if ((level & Logger.WarningLogLevel) === Logger.WarningLogLevel) {\r\n Logger.Warn = Logger._WarnEnabled;\r\n }\r\n else {\r\n Logger.Warn = Logger._WarnDisabled;\r\n }\r\n if ((level & Logger.ErrorLogLevel) === Logger.ErrorLogLevel) {\r\n Logger.Error = Logger._ErrorEnabled;\r\n }\r\n else {\r\n Logger.Error = Logger._ErrorDisabled;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * No log\r\n */\r\n Logger.NoneLogLevel = 0;\r\n /**\r\n * Only message logs\r\n */\r\n Logger.MessageLogLevel = 1;\r\n /**\r\n * Only warning logs\r\n */\r\n Logger.WarningLogLevel = 2;\r\n /**\r\n * Only error logs\r\n */\r\n Logger.ErrorLogLevel = 4;\r\n /**\r\n * All logs\r\n */\r\n Logger.AllLogLevel = 7;\r\n Logger._LogCache = \"\";\r\n /**\r\n * Gets a value indicating the number of loading errors\r\n * @ignorenaming\r\n */\r\n Logger.errorsCount = 0;\r\n /**\r\n * Log a message to the console\r\n */\r\n Logger.Log = Logger._LogEnabled;\r\n /**\r\n * Write a warning message to the console\r\n */\r\n Logger.Warn = Logger._WarnEnabled;\r\n /**\r\n * Write an error message to the console\r\n */\r\n Logger.Error = Logger._ErrorEnabled;\r\n return Logger;\r\n}());\r\nexport { Logger };\r\n//# sourceMappingURL=logger.js.map","/**\r\n * A class serves as a medium between the observable and its observers\r\n */\r\nvar EventState = /** @class */ (function () {\r\n /**\r\n * Create a new EventState\r\n * @param mask defines the mask associated with this state\r\n * @param skipNextObservers defines a flag which will instruct the observable to skip following observers when set to true\r\n * @param target defines the original target of the state\r\n * @param currentTarget defines the current target of the state\r\n */\r\n function EventState(mask, skipNextObservers, target, currentTarget) {\r\n if (skipNextObservers === void 0) { skipNextObservers = false; }\r\n this.initalize(mask, skipNextObservers, target, currentTarget);\r\n }\r\n /**\r\n * Initialize the current event state\r\n * @param mask defines the mask associated with this state\r\n * @param skipNextObservers defines a flag which will instruct the observable to skip following observers when set to true\r\n * @param target defines the original target of the state\r\n * @param currentTarget defines the current target of the state\r\n * @returns the current event state\r\n */\r\n EventState.prototype.initalize = function (mask, skipNextObservers, target, currentTarget) {\r\n if (skipNextObservers === void 0) { skipNextObservers = false; }\r\n this.mask = mask;\r\n this.skipNextObservers = skipNextObservers;\r\n this.target = target;\r\n this.currentTarget = currentTarget;\r\n return this;\r\n };\r\n return EventState;\r\n}());\r\nexport { EventState };\r\n/**\r\n * Represent an Observer registered to a given Observable object.\r\n */\r\nvar Observer = /** @class */ (function () {\r\n /**\r\n * Creates a new observer\r\n * @param callback defines the callback to call when the observer is notified\r\n * @param mask defines the mask of the observer (used to filter notifications)\r\n * @param scope defines the current scope used to restore the JS context\r\n */\r\n function Observer(\r\n /**\r\n * Defines the callback to call when the observer is notified\r\n */\r\n callback, \r\n /**\r\n * Defines the mask of the observer (used to filter notifications)\r\n */\r\n mask, \r\n /**\r\n * Defines the current scope used to restore the JS context\r\n */\r\n scope) {\r\n if (scope === void 0) { scope = null; }\r\n this.callback = callback;\r\n this.mask = mask;\r\n this.scope = scope;\r\n /** @hidden */\r\n this._willBeUnregistered = false;\r\n /**\r\n * Gets or sets a property defining that the observer as to be unregistered after the next notification\r\n */\r\n this.unregisterOnNextCall = false;\r\n }\r\n return Observer;\r\n}());\r\nexport { Observer };\r\n/**\r\n * Represent a list of observers registered to multiple Observables object.\r\n */\r\nvar MultiObserver = /** @class */ (function () {\r\n function MultiObserver() {\r\n }\r\n /**\r\n * Release associated resources\r\n */\r\n MultiObserver.prototype.dispose = function () {\r\n if (this._observers && this._observables) {\r\n for (var index = 0; index < this._observers.length; index++) {\r\n this._observables[index].remove(this._observers[index]);\r\n }\r\n }\r\n this._observers = null;\r\n this._observables = null;\r\n };\r\n /**\r\n * Raise a callback when one of the observable will notify\r\n * @param observables defines a list of observables to watch\r\n * @param callback defines the callback to call on notification\r\n * @param mask defines the mask used to filter notifications\r\n * @param scope defines the current scope used to restore the JS context\r\n * @returns the new MultiObserver\r\n */\r\n MultiObserver.Watch = function (observables, callback, mask, scope) {\r\n if (mask === void 0) { mask = -1; }\r\n if (scope === void 0) { scope = null; }\r\n var result = new MultiObserver();\r\n result._observers = new Array();\r\n result._observables = observables;\r\n for (var _i = 0, observables_1 = observables; _i < observables_1.length; _i++) {\r\n var observable = observables_1[_i];\r\n var observer = observable.add(callback, mask, false, scope);\r\n if (observer) {\r\n result._observers.push(observer);\r\n }\r\n }\r\n return result;\r\n };\r\n return MultiObserver;\r\n}());\r\nexport { MultiObserver };\r\n/**\r\n * The Observable class is a simple implementation of the Observable pattern.\r\n *\r\n * There's one slight particularity though: a given Observable can notify its observer using a particular mask value, only the Observers registered with this mask value will be notified.\r\n * This enable a more fine grained execution without having to rely on multiple different Observable objects.\r\n * For instance you may have a given Observable that have four different types of notifications: Move (mask = 0x01), Stop (mask = 0x02), Turn Right (mask = 0X04), Turn Left (mask = 0X08).\r\n * A given observer can register itself with only Move and Stop (mask = 0x03), then it will only be notified when one of these two occurs and will never be for Turn Left/Right.\r\n */\r\nvar Observable = /** @class */ (function () {\r\n /**\r\n * Creates a new observable\r\n * @param onObserverAdded defines a callback to call when a new observer is added\r\n */\r\n function Observable(onObserverAdded) {\r\n this._observers = new Array();\r\n this._eventState = new EventState(0);\r\n if (onObserverAdded) {\r\n this._onObserverAdded = onObserverAdded;\r\n }\r\n }\r\n Object.defineProperty(Observable.prototype, \"observers\", {\r\n /**\r\n * Gets the list of observers\r\n */\r\n get: function () {\r\n return this._observers;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Create a new Observer with the specified callback\r\n * @param callback the callback that will be executed for that Observer\r\n * @param mask the mask used to filter observers\r\n * @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.\r\n * @param scope optional scope for the callback to be called from\r\n * @param unregisterOnFirstCall defines if the observer as to be unregistered after the next notification\r\n * @returns the new observer created for the callback\r\n */\r\n Observable.prototype.add = function (callback, mask, insertFirst, scope, unregisterOnFirstCall) {\r\n if (mask === void 0) { mask = -1; }\r\n if (insertFirst === void 0) { insertFirst = false; }\r\n if (scope === void 0) { scope = null; }\r\n if (unregisterOnFirstCall === void 0) { unregisterOnFirstCall = false; }\r\n if (!callback) {\r\n return null;\r\n }\r\n var observer = new Observer(callback, mask, scope);\r\n observer.unregisterOnNextCall = unregisterOnFirstCall;\r\n if (insertFirst) {\r\n this._observers.unshift(observer);\r\n }\r\n else {\r\n this._observers.push(observer);\r\n }\r\n if (this._onObserverAdded) {\r\n this._onObserverAdded(observer);\r\n }\r\n return observer;\r\n };\r\n /**\r\n * Create a new Observer with the specified callback and unregisters after the next notification\r\n * @param callback the callback that will be executed for that Observer\r\n * @returns the new observer created for the callback\r\n */\r\n Observable.prototype.addOnce = function (callback) {\r\n return this.add(callback, undefined, undefined, undefined, true);\r\n };\r\n /**\r\n * Remove an Observer from the Observable object\r\n * @param observer the instance of the Observer to remove\r\n * @returns false if it doesn't belong to this Observable\r\n */\r\n Observable.prototype.remove = function (observer) {\r\n if (!observer) {\r\n return false;\r\n }\r\n var index = this._observers.indexOf(observer);\r\n if (index !== -1) {\r\n this._deferUnregister(observer);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Remove a callback from the Observable object\r\n * @param callback the callback to remove\r\n * @param scope optional scope. If used only the callbacks with this scope will be removed\r\n * @returns false if it doesn't belong to this Observable\r\n */\r\n Observable.prototype.removeCallback = function (callback, scope) {\r\n for (var index = 0; index < this._observers.length; index++) {\r\n var observer = this._observers[index];\r\n if (observer._willBeUnregistered) {\r\n continue;\r\n }\r\n if (observer.callback === callback && (!scope || scope === observer.scope)) {\r\n this._deferUnregister(observer);\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n Observable.prototype._deferUnregister = function (observer) {\r\n var _this = this;\r\n observer.unregisterOnNextCall = false;\r\n observer._willBeUnregistered = true;\r\n setTimeout(function () {\r\n _this._remove(observer);\r\n }, 0);\r\n };\r\n // This should only be called when not iterating over _observers to avoid callback skipping.\r\n // Removes an observer from the _observer Array.\r\n Observable.prototype._remove = function (observer) {\r\n if (!observer) {\r\n return false;\r\n }\r\n var index = this._observers.indexOf(observer);\r\n if (index !== -1) {\r\n this._observers.splice(index, 1);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Moves the observable to the top of the observer list making it get called first when notified\r\n * @param observer the observer to move\r\n */\r\n Observable.prototype.makeObserverTopPriority = function (observer) {\r\n this._remove(observer);\r\n this._observers.unshift(observer);\r\n };\r\n /**\r\n * Moves the observable to the bottom of the observer list making it get called last when notified\r\n * @param observer the observer to move\r\n */\r\n Observable.prototype.makeObserverBottomPriority = function (observer) {\r\n this._remove(observer);\r\n this._observers.push(observer);\r\n };\r\n /**\r\n * Notify all Observers by calling their respective callback with the given data\r\n * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute\r\n * @param eventData defines the data to send to all observers\r\n * @param mask defines the mask of the current notification (observers with incompatible mask (ie mask & observer.mask === 0) will not be notified)\r\n * @param target defines the original target of the state\r\n * @param currentTarget defines the current target of the state\r\n * @param userInfo defines any user info to send to observers\r\n * @returns false if the complete observer chain was not processed (because one observer set the skipNextObservers to true)\r\n */\r\n Observable.prototype.notifyObservers = function (eventData, mask, target, currentTarget, userInfo) {\r\n if (mask === void 0) { mask = -1; }\r\n if (!this._observers.length) {\r\n return true;\r\n }\r\n var state = this._eventState;\r\n state.mask = mask;\r\n state.target = target;\r\n state.currentTarget = currentTarget;\r\n state.skipNextObservers = false;\r\n state.lastReturnValue = eventData;\r\n state.userInfo = userInfo;\r\n for (var _i = 0, _a = this._observers; _i < _a.length; _i++) {\r\n var obs = _a[_i];\r\n if (obs._willBeUnregistered) {\r\n continue;\r\n }\r\n if (obs.mask & mask) {\r\n if (obs.scope) {\r\n state.lastReturnValue = obs.callback.apply(obs.scope, [eventData, state]);\r\n }\r\n else {\r\n state.lastReturnValue = obs.callback(eventData, state);\r\n }\r\n if (obs.unregisterOnNextCall) {\r\n this._deferUnregister(obs);\r\n }\r\n }\r\n if (state.skipNextObservers) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Calling this will execute each callback, expecting it to be a promise or return a value.\r\n * If at any point in the chain one function fails, the promise will fail and the execution will not continue.\r\n * This is useful when a chain of events (sometimes async events) is needed to initialize a certain object\r\n * and it is crucial that all callbacks will be executed.\r\n * The order of the callbacks is kept, callbacks are not executed parallel.\r\n *\r\n * @param eventData The data to be sent to each callback\r\n * @param mask is used to filter observers defaults to -1\r\n * @param target defines the callback target (see EventState)\r\n * @param currentTarget defines he current object in the bubbling phase\r\n * @param userInfo defines any user info to send to observers\r\n * @returns {Promise} will return a Promise than resolves when all callbacks executed successfully.\r\n */\r\n Observable.prototype.notifyObserversWithPromise = function (eventData, mask, target, currentTarget, userInfo) {\r\n var _this = this;\r\n if (mask === void 0) { mask = -1; }\r\n // create an empty promise\r\n var p = Promise.resolve(eventData);\r\n // no observers? return this promise.\r\n if (!this._observers.length) {\r\n return p;\r\n }\r\n var state = this._eventState;\r\n state.mask = mask;\r\n state.target = target;\r\n state.currentTarget = currentTarget;\r\n state.skipNextObservers = false;\r\n state.userInfo = userInfo;\r\n // execute one callback after another (not using Promise.all, the order is important)\r\n this._observers.forEach(function (obs) {\r\n if (state.skipNextObservers) {\r\n return;\r\n }\r\n if (obs._willBeUnregistered) {\r\n return;\r\n }\r\n if (obs.mask & mask) {\r\n if (obs.scope) {\r\n p = p.then(function (lastReturnedValue) {\r\n state.lastReturnValue = lastReturnedValue;\r\n return obs.callback.apply(obs.scope, [eventData, state]);\r\n });\r\n }\r\n else {\r\n p = p.then(function (lastReturnedValue) {\r\n state.lastReturnValue = lastReturnedValue;\r\n return obs.callback(eventData, state);\r\n });\r\n }\r\n if (obs.unregisterOnNextCall) {\r\n _this._deferUnregister(obs);\r\n }\r\n }\r\n });\r\n // return the eventData\r\n return p.then(function () { return eventData; });\r\n };\r\n /**\r\n * Notify a specific observer\r\n * @param observer defines the observer to notify\r\n * @param eventData defines the data to be sent to each callback\r\n * @param mask is used to filter observers defaults to -1\r\n */\r\n Observable.prototype.notifyObserver = function (observer, eventData, mask) {\r\n if (mask === void 0) { mask = -1; }\r\n var state = this._eventState;\r\n state.mask = mask;\r\n state.skipNextObservers = false;\r\n observer.callback(eventData, state);\r\n };\r\n /**\r\n * Gets a boolean indicating if the observable has at least one observer\r\n * @returns true is the Observable has at least one Observer registered\r\n */\r\n Observable.prototype.hasObservers = function () {\r\n return this._observers.length > 0;\r\n };\r\n /**\r\n * Clear the list of observers\r\n */\r\n Observable.prototype.clear = function () {\r\n this._observers = new Array();\r\n this._onObserverAdded = null;\r\n };\r\n /**\r\n * Clone the current observable\r\n * @returns a new observable\r\n */\r\n Observable.prototype.clone = function () {\r\n var result = new Observable();\r\n result._observers = this._observers.slice(0);\r\n return result;\r\n };\r\n /**\r\n * Does this observable handles observer registered with a given mask\r\n * @param mask defines the mask to be tested\r\n * @return whether or not one observer registered with the given mask is handeled\r\n **/\r\n Observable.prototype.hasSpecificMask = function (mask) {\r\n if (mask === void 0) { mask = -1; }\r\n for (var _i = 0, _a = this._observers; _i < _a.length; _i++) {\r\n var obs = _a[_i];\r\n if (obs.mask & mask || obs.mask === mask) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n return Observable;\r\n}());\r\nexport { Observable };\r\n//# sourceMappingURL=observable.js.map","import { PrecisionDate } from './precisionDate';\r\n/**\r\n * This class is used to track a performance counter which is number based.\r\n * The user has access to many properties which give statistics of different nature.\r\n *\r\n * The implementer can track two kinds of Performance Counter: time and count.\r\n * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.\r\n * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.\r\n */\r\nvar PerfCounter = /** @class */ (function () {\r\n /**\r\n * Creates a new counter\r\n */\r\n function PerfCounter() {\r\n this._startMonitoringTime = 0;\r\n this._min = 0;\r\n this._max = 0;\r\n this._average = 0;\r\n this._lastSecAverage = 0;\r\n this._current = 0;\r\n this._totalValueCount = 0;\r\n this._totalAccumulated = 0;\r\n this._lastSecAccumulated = 0;\r\n this._lastSecTime = 0;\r\n this._lastSecValueCount = 0;\r\n }\r\n Object.defineProperty(PerfCounter.prototype, \"min\", {\r\n /**\r\n * Returns the smallest value ever\r\n */\r\n get: function () {\r\n return this._min;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"max\", {\r\n /**\r\n * Returns the biggest value ever\r\n */\r\n get: function () {\r\n return this._max;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"average\", {\r\n /**\r\n * Returns the average value since the performance counter is running\r\n */\r\n get: function () {\r\n return this._average;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"lastSecAverage\", {\r\n /**\r\n * Returns the average value of the last second the counter was monitored\r\n */\r\n get: function () {\r\n return this._lastSecAverage;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"current\", {\r\n /**\r\n * Returns the current value\r\n */\r\n get: function () {\r\n return this._current;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"total\", {\r\n /**\r\n * Gets the accumulated total\r\n */\r\n get: function () {\r\n return this._totalAccumulated;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PerfCounter.prototype, \"count\", {\r\n /**\r\n * Gets the total value count\r\n */\r\n get: function () {\r\n return this._totalValueCount;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Call this method to start monitoring a new frame.\r\n * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.\r\n */\r\n PerfCounter.prototype.fetchNewFrame = function () {\r\n this._totalValueCount++;\r\n this._current = 0;\r\n this._lastSecValueCount++;\r\n };\r\n /**\r\n * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)\r\n * @param newCount the count value to add to the monitored count\r\n * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.\r\n */\r\n PerfCounter.prototype.addCount = function (newCount, fetchResult) {\r\n if (!PerfCounter.Enabled) {\r\n return;\r\n }\r\n this._current += newCount;\r\n if (fetchResult) {\r\n this._fetchResult();\r\n }\r\n };\r\n /**\r\n * Start monitoring this performance counter\r\n */\r\n PerfCounter.prototype.beginMonitoring = function () {\r\n if (!PerfCounter.Enabled) {\r\n return;\r\n }\r\n this._startMonitoringTime = PrecisionDate.Now;\r\n };\r\n /**\r\n * Compute the time lapsed since the previous beginMonitoring() call.\r\n * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter\r\n */\r\n PerfCounter.prototype.endMonitoring = function (newFrame) {\r\n if (newFrame === void 0) { newFrame = true; }\r\n if (!PerfCounter.Enabled) {\r\n return;\r\n }\r\n if (newFrame) {\r\n this.fetchNewFrame();\r\n }\r\n var currentTime = PrecisionDate.Now;\r\n this._current = currentTime - this._startMonitoringTime;\r\n if (newFrame) {\r\n this._fetchResult();\r\n }\r\n };\r\n PerfCounter.prototype._fetchResult = function () {\r\n this._totalAccumulated += this._current;\r\n this._lastSecAccumulated += this._current;\r\n // Min/Max update\r\n this._min = Math.min(this._min, this._current);\r\n this._max = Math.max(this._max, this._current);\r\n this._average = this._totalAccumulated / this._totalValueCount;\r\n // Reset last sec?\r\n var now = PrecisionDate.Now;\r\n if ((now - this._lastSecTime) > 1000) {\r\n this._lastSecAverage = this._lastSecAccumulated / this._lastSecValueCount;\r\n this._lastSecTime = now;\r\n this._lastSecAccumulated = 0;\r\n this._lastSecValueCount = 0;\r\n }\r\n };\r\n /**\r\n * Gets or sets a global boolean to turn on and off all the counters\r\n */\r\n PerfCounter.Enabled = true;\r\n return PerfCounter;\r\n}());\r\nexport { PerfCounter };\r\n//# sourceMappingURL=perfCounter.js.map","import { DomManagement } from './domManagement';\r\n/**\r\n * Class containing a set of static utilities functions for precision date\r\n */\r\nvar PrecisionDate = /** @class */ (function () {\r\n function PrecisionDate() {\r\n }\r\n Object.defineProperty(PrecisionDate, \"Now\", {\r\n /**\r\n * Gets either window.performance.now() if supported or Date.now() else\r\n */\r\n get: function () {\r\n if (DomManagement.IsWindowObjectExist() && window.performance && window.performance.now) {\r\n return window.performance.now();\r\n }\r\n return Date.now();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return PrecisionDate;\r\n}());\r\nexport { PrecisionDate };\r\n//# sourceMappingURL=precisionDate.js.map","import { Effect } from \"../Materials/effect\";\r\nvar name = 'fxaaPixelShader';\r\nvar shader = \"uniform sampler2D textureSampler;\\nuniform vec2 texelSize;\\nvarying vec2 vUV;\\nvarying vec2 sampleCoordS;\\nvarying vec2 sampleCoordE;\\nvarying vec2 sampleCoordN;\\nvarying vec2 sampleCoordW;\\nvarying vec2 sampleCoordNW;\\nvarying vec2 sampleCoordSE;\\nvarying vec2 sampleCoordNE;\\nvarying vec2 sampleCoordSW;\\nconst float fxaaQualitySubpix=1.0;\\nconst float fxaaQualityEdgeThreshold=0.166;\\nconst float fxaaQualityEdgeThresholdMin=0.0833;\\nconst vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);\\n#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)\\nvoid main(){\\nvec2 posM;\\nposM.x=vUV.x;\\nposM.y=vUV.y;\\nvec4 rgbyM=texture2D(textureSampler,vUV,0.0);\\nfloat lumaM=FxaaLuma(rgbyM);\\nfloat lumaS=FxaaLuma(texture2D(textureSampler,sampleCoordS,0.0));\\nfloat lumaE=FxaaLuma(texture2D(textureSampler,sampleCoordE,0.0));\\nfloat lumaN=FxaaLuma(texture2D(textureSampler,sampleCoordN,0.0));\\nfloat lumaW=FxaaLuma(texture2D(textureSampler,sampleCoordW,0.0));\\nfloat maxSM=max(lumaS,lumaM);\\nfloat minSM=min(lumaS,lumaM);\\nfloat maxESM=max(lumaE,maxSM);\\nfloat minESM=min(lumaE,minSM);\\nfloat maxWN=max(lumaN,lumaW);\\nfloat minWN=min(lumaN,lumaW);\\nfloat rangeMax=max(maxWN,maxESM);\\nfloat rangeMin=min(minWN,minESM);\\nfloat rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;\\nfloat range=rangeMax-rangeMin;\\nfloat rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\\n#ifndef MALI\\nif(range=edgeVert;\\nfloat subpixA=subpixNSWE*2.0+subpixNWSWNESE;\\nif (!horzSpan)\\n{\\nlumaN=lumaW;\\n}\\nif (!horzSpan)\\n{\\nlumaS=lumaE;\\n}\\nif (horzSpan)\\n{\\nlengthSign=texelSize.y;\\n}\\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;\\nfloat gradientN=lumaN-lumaM;\\nfloat gradientS=lumaS-lumaM;\\nfloat lumaNN=lumaN+lumaM;\\nfloat lumaSS=lumaS+lumaM;\\nbool pairN=abs(gradientN)>=abs(gradientS);\\nfloat gradient=max(abs(gradientN),abs(gradientS));\\nif (pairN)\\n{\\nlengthSign=-lengthSign;\\n}\\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);\\nvec2 posB;\\nposB.x=posM.x;\\nposB.y=posM.y;\\nvec2 offNP;\\noffNP.x=(!horzSpan) ? 0.0 : texelSize.x;\\noffNP.y=(horzSpan) ? 0.0 : texelSize.y;\\nif (!horzSpan)\\n{\\nposB.x+=lengthSign*0.5;\\n}\\nif (horzSpan)\\n{\\nposB.y+=lengthSign*0.5;\\n}\\nvec2 posN;\\nposN.x=posB.x-offNP.x*1.5;\\nposN.y=posB.y-offNP.y*1.5;\\nvec2 posP;\\nposP.x=posB.x+offNP.x*1.5;\\nposP.y=posB.y+offNP.y*1.5;\\nfloat subpixD=((-2.0)*subpixC)+3.0;\\nfloat lumaEndN=FxaaLuma(texture2D(textureSampler,posN,0.0));\\nfloat subpixE=subpixC*subpixC;\\nfloat lumaEndP=FxaaLuma(texture2D(textureSampler,posP,0.0));\\nif (!pairN)\\n{\\nlumaNN=lumaSS;\\n}\\nfloat gradientScaled=gradient*1.0/4.0;\\nfloat lumaMM=lumaM-lumaNN*0.5;\\nfloat subpixF=subpixD*subpixE;\\nbool lumaMLTZero=lumaMM<0.0;\\nlumaEndN-=lumaNN*0.5;\\nlumaEndP-=lumaNN*0.5;\\nbool doneN=abs(lumaEndN)>=gradientScaled;\\nbool doneP=abs(lumaEndP)>=gradientScaled;\\nif (!doneN)\\n{\\nposN.x-=offNP.x*3.0;\\n}\\nif (!doneN)\\n{\\nposN.y-=offNP.y*3.0;\\n}\\nbool doneNP=(!doneN) || (!doneP);\\nif (!doneP)\\n{\\nposP.x+=offNP.x*3.0;\\n}\\nif (!doneP)\\n{\\nposP.y+=offNP.y*3.0;\\n}\\nif (doneNP)\\n{\\nif (!doneN) lumaEndN=FxaaLuma(texture2D(textureSampler,posN.xy,0.0));\\nif (!doneP) lumaEndP=FxaaLuma(texture2D(textureSampler,posP.xy,0.0));\\nif (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;\\nif (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;\\ndoneN=abs(lumaEndN)>=gradientScaled;\\ndoneP=abs(lumaEndP)>=gradientScaled;\\nif (!doneN) posN.x-=offNP.x*12.0;\\nif (!doneN) posN.y-=offNP.y*12.0;\\ndoneNP=(!doneN) || (!doneP);\\nif (!doneP) posP.x+=offNP.x*12.0;\\nif (!doneP) posP.y+=offNP.y*12.0;\\n}\\nfloat dstN=posM.x-posN.x;\\nfloat dstP=posP.x-posM.x;\\nif (!horzSpan)\\n{\\ndstN=posM.y-posN.y;\\n}\\nif (!horzSpan)\\n{\\ndstP=posP.y-posM.y;\\n}\\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;\\nfloat spanLength=(dstP+dstN);\\nbool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;\\nfloat spanLengthRcp=1.0/spanLength;\\nbool directionN=dstN -1) {\r\n return \"#define MALI 1\\n\";\r\n }\r\n return null;\r\n };\r\n /** @hidden */\r\n FxaaPostProcess._Parse = function (parsedPostProcess, targetCamera, scene, rootUrl) {\r\n return SerializationHelper.Parse(function () {\r\n return new FxaaPostProcess(parsedPostProcess.name, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.reusable);\r\n }, parsedPostProcess, scene, rootUrl);\r\n };\r\n return FxaaPostProcess;\r\n}(PostProcess));\r\nexport { FxaaPostProcess };\r\n_TypeStore.RegisteredTypes[\"BABYLON.FxaaPostProcess\"] = FxaaPostProcess;\r\n//# sourceMappingURL=fxaaPostProcess.js.map","import { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport { FxaaPostProcess } from \"../PostProcesses/fxaaPostProcess\";\r\nimport { Logger } from \"./logger\";\r\nimport { Tools } from \"./tools\";\r\n/**\r\n * Class containing a set of static utilities functions for screenshots\r\n */\r\nvar ScreenshotTools = /** @class */ (function () {\r\n function ScreenshotTools() {\r\n }\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n */\r\n ScreenshotTools.CreateScreenshot = function (engine, camera, size, successCallback, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n var _a = ScreenshotTools._getScreenshotSize(engine, camera, size), height = _a.height, width = _a.width;\r\n if (!(height && width)) {\r\n Logger.Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n if (!Tools._ScreenshotCanvas) {\r\n Tools._ScreenshotCanvas = document.createElement('canvas');\r\n }\r\n Tools._ScreenshotCanvas.width = width;\r\n Tools._ScreenshotCanvas.height = height;\r\n var renderContext = Tools._ScreenshotCanvas.getContext(\"2d\");\r\n var ratio = engine.getRenderWidth() / engine.getRenderHeight();\r\n var newWidth = width;\r\n var newHeight = newWidth / ratio;\r\n if (newHeight > height) {\r\n newHeight = height;\r\n newWidth = newHeight * ratio;\r\n }\r\n var offsetX = Math.max(0, width - newWidth) / 2;\r\n var offsetY = Math.max(0, height - newHeight) / 2;\r\n var renderingCanvas = engine.getRenderingCanvas();\r\n if (renderContext && renderingCanvas) {\r\n renderContext.drawImage(renderingCanvas, offsetX, offsetY, newWidth, newHeight);\r\n }\r\n Tools.EncodeScreenshotCanvasData(successCallback, mimeType);\r\n };\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n ScreenshotTools.CreateScreenshotAsync = function (engine, camera, size, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n return new Promise(function (resolve, reject) {\r\n ScreenshotTools.CreateScreenshot(engine, camera, size, function (data) {\r\n if (typeof (data) !== \"undefined\") {\r\n resolve(data);\r\n }\r\n else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n }, mimeType);\r\n });\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)\r\n */\r\n ScreenshotTools.CreateScreenshotUsingRenderTarget = function (engine, camera, size, successCallback, mimeType, samples, antialiasing, fileName, renderSprites, enableStencilBuffer) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n if (renderSprites === void 0) { renderSprites = false; }\r\n if (enableStencilBuffer === void 0) { enableStencilBuffer = false; }\r\n var _a = ScreenshotTools._getScreenshotSize(engine, camera, size), height = _a.height, width = _a.width;\r\n var targetTextureSize = { width: width, height: height };\r\n if (!(height && width)) {\r\n Logger.Error(\"Invalid 'size' parameter !\");\r\n return;\r\n }\r\n var renderCanvas = engine.getRenderingCanvas();\r\n if (!renderCanvas) {\r\n Logger.Error(\"No rendering canvas found !\");\r\n return;\r\n }\r\n var originalSize = { width: renderCanvas.width, height: renderCanvas.height };\r\n engine.setSize(width, height);\r\n var scene = camera.getScene();\r\n var previousCamera = null;\r\n var previousCameras = scene.activeCameras;\r\n if (scene.activeCamera !== camera || scene.activeCameras && scene.activeCameras.length) {\r\n previousCamera = scene.activeCamera;\r\n scene.activeCamera = camera;\r\n }\r\n scene.render();\r\n // At this point size can be a number, or an object (according to engine.prototype.createRenderTargetTexture method)\r\n var texture = new RenderTargetTexture(\"screenShot\", targetTextureSize, scene, false, false, 0, false, Texture.NEAREST_SAMPLINGMODE, undefined, enableStencilBuffer);\r\n texture.renderList = null;\r\n texture.samples = samples;\r\n texture.renderSprites = renderSprites;\r\n texture.onAfterRenderObservable.add(function () {\r\n Tools.DumpFramebuffer(width, height, engine, successCallback, mimeType, fileName);\r\n });\r\n var renderToTexture = function () {\r\n scene.incrementRenderId();\r\n scene.resetCachedMaterial();\r\n texture.render(true);\r\n texture.dispose();\r\n if (previousCamera) {\r\n scene.activeCamera = previousCamera;\r\n }\r\n scene.activeCameras = previousCameras;\r\n engine.setSize(originalSize.width, originalSize.height);\r\n camera.getProjectionMatrix(true); // Force cache refresh;\r\n };\r\n if (antialiasing) {\r\n var fxaaPostProcess = new FxaaPostProcess('antialiasing', 1.0, scene.activeCamera);\r\n texture.addPostProcess(fxaaPostProcess);\r\n // Async Shader Compilation can lead to none ready effects in synchronous code\r\n if (!fxaaPostProcess.getEffect().isReady()) {\r\n fxaaPostProcess.getEffect().onCompiled = function () {\r\n renderToTexture();\r\n };\r\n }\r\n // The effect is ready we can render\r\n else {\r\n renderToTexture();\r\n }\r\n }\r\n else {\r\n // No need to wait for extra resources to be ready\r\n renderToTexture();\r\n }\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n ScreenshotTools.CreateScreenshotUsingRenderTargetAsync = function (engine, camera, size, mimeType, samples, antialiasing, fileName, renderSprites) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n if (renderSprites === void 0) { renderSprites = false; }\r\n return new Promise(function (resolve, reject) {\r\n ScreenshotTools.CreateScreenshotUsingRenderTarget(engine, camera, size, function (data) {\r\n if (typeof (data) !== \"undefined\") {\r\n resolve(data);\r\n }\r\n else {\r\n reject(new Error(\"Data is undefined\"));\r\n }\r\n }, mimeType, samples, antialiasing, fileName, renderSprites);\r\n });\r\n };\r\n /**\r\n * Gets height and width for screenshot size\r\n * @private\r\n */\r\n ScreenshotTools._getScreenshotSize = function (engine, camera, size) {\r\n var height = 0;\r\n var width = 0;\r\n //If a size value defined as object\r\n if (typeof (size) === 'object') {\r\n var precision = size.precision\r\n ? Math.abs(size.precision) // prevent GL_INVALID_VALUE : glViewport: negative width/height\r\n : 1;\r\n //If a width and height values is specified\r\n if (size.width && size.height) {\r\n height = size.height * precision;\r\n width = size.width * precision;\r\n }\r\n //If passing only width, computing height to keep display canvas ratio.\r\n else if (size.width && !size.height) {\r\n width = size.width * precision;\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n //If passing only height, computing width to keep display canvas ratio.\r\n else if (size.height && !size.width) {\r\n height = size.height * precision;\r\n width = Math.round(height * engine.getAspectRatio(camera));\r\n }\r\n else {\r\n width = Math.round(engine.getRenderWidth() * precision);\r\n height = Math.round(width / engine.getAspectRatio(camera));\r\n }\r\n }\r\n //Assuming here that \"size\" parameter is a number\r\n else if (!isNaN(size)) {\r\n height = size;\r\n width = size;\r\n }\r\n // When creating the image data from the CanvasRenderingContext2D, the width and height is clamped to the size of the _gl context\r\n // On certain GPUs, it seems as if the _gl context truncates to an integer automatically. Therefore, if a user tries to pass the width of their canvas element\r\n // and it happens to be a float (1000.5 x 600.5 px), the engine.readPixels will return a different size array than context.createImageData\r\n // to resolve this, we truncate the floats here to ensure the same size\r\n if (width) {\r\n width = Math.floor(width);\r\n }\r\n if (height) {\r\n height = Math.floor(height);\r\n }\r\n return { height: height | 0, width: width | 0 };\r\n };\r\n return ScreenshotTools;\r\n}());\r\nexport { ScreenshotTools };\r\nTools.CreateScreenshot = ScreenshotTools.CreateScreenshot;\r\nTools.CreateScreenshotAsync = ScreenshotTools.CreateScreenshotAsync;\r\nTools.CreateScreenshotUsingRenderTarget = ScreenshotTools.CreateScreenshotUsingRenderTarget;\r\nTools.CreateScreenshotUsingRenderTargetAsync = ScreenshotTools.CreateScreenshotUsingRenderTargetAsync;\r\n//# sourceMappingURL=screenshotTools.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\r\n */\r\nvar SmartArray = /** @class */ (function () {\r\n /**\r\n * Instantiates a Smart Array.\r\n * @param capacity defines the default capacity of the array.\r\n */\r\n function SmartArray(capacity) {\r\n /**\r\n * The active length of the array.\r\n */\r\n this.length = 0;\r\n this.data = new Array(capacity);\r\n this._id = SmartArray._GlobalId++;\r\n }\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * @param value defines the object to push in the array.\r\n */\r\n SmartArray.prototype.push = function (value) {\r\n this.data[this.length++] = value;\r\n if (this.length > this.data.length) {\r\n this.data.length *= 2;\r\n }\r\n };\r\n /**\r\n * Iterates over the active data and apply the lambda to them.\r\n * @param func defines the action to apply on each value.\r\n */\r\n SmartArray.prototype.forEach = function (func) {\r\n for (var index = 0; index < this.length; index++) {\r\n func(this.data[index]);\r\n }\r\n };\r\n /**\r\n * Sorts the full sets of data.\r\n * @param compareFn defines the comparison function to apply.\r\n */\r\n SmartArray.prototype.sort = function (compareFn) {\r\n this.data.sort(compareFn);\r\n };\r\n /**\r\n * Resets the active data to an empty array.\r\n */\r\n SmartArray.prototype.reset = function () {\r\n this.length = 0;\r\n };\r\n /**\r\n * Releases all the data from the array as well as the array.\r\n */\r\n SmartArray.prototype.dispose = function () {\r\n this.reset();\r\n if (this.data) {\r\n this.data.length = 0;\r\n this.data = [];\r\n }\r\n };\r\n /**\r\n * Concats the active data with a given array.\r\n * @param array defines the data to concatenate with.\r\n */\r\n SmartArray.prototype.concat = function (array) {\r\n if (array.length === 0) {\r\n return;\r\n }\r\n if (this.length + array.length > this.data.length) {\r\n this.data.length = (this.length + array.length) * 2;\r\n }\r\n for (var index = 0; index < array.length; index++) {\r\n this.data[this.length++] = (array.data || array)[index];\r\n }\r\n };\r\n /**\r\n * Returns the position of a value in the active data.\r\n * @param value defines the value to find the index for\r\n * @returns the index if found in the active data otherwise -1\r\n */\r\n SmartArray.prototype.indexOf = function (value) {\r\n var position = this.data.indexOf(value);\r\n if (position >= this.length) {\r\n return -1;\r\n }\r\n return position;\r\n };\r\n /**\r\n * Returns whether an element is part of the active data.\r\n * @param value defines the value to look for\r\n * @returns true if found in the active data otherwise false\r\n */\r\n SmartArray.prototype.contains = function (value) {\r\n return this.indexOf(value) !== -1;\r\n };\r\n // Statics\r\n SmartArray._GlobalId = 0;\r\n return SmartArray;\r\n}());\r\nexport { SmartArray };\r\n/**\r\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\r\n * The data in this array can only be present once\r\n */\r\nvar SmartArrayNoDuplicate = /** @class */ (function (_super) {\r\n __extends(SmartArrayNoDuplicate, _super);\r\n function SmartArrayNoDuplicate() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._duplicateId = 0;\r\n return _this;\r\n }\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * THIS DOES NOT PREVENT DUPPLICATE DATA\r\n * @param value defines the object to push in the array.\r\n */\r\n SmartArrayNoDuplicate.prototype.push = function (value) {\r\n _super.prototype.push.call(this, value);\r\n if (!value.__smartArrayFlags) {\r\n value.__smartArrayFlags = {};\r\n }\r\n value.__smartArrayFlags[this._id] = this._duplicateId;\r\n };\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * If the data is already present, it won t be added again\r\n * @param value defines the object to push in the array.\r\n * @returns true if added false if it was already present\r\n */\r\n SmartArrayNoDuplicate.prototype.pushNoDuplicate = function (value) {\r\n if (value.__smartArrayFlags && value.__smartArrayFlags[this._id] === this._duplicateId) {\r\n return false;\r\n }\r\n this.push(value);\r\n return true;\r\n };\r\n /**\r\n * Resets the active data to an empty array.\r\n */\r\n SmartArrayNoDuplicate.prototype.reset = function () {\r\n _super.prototype.reset.call(this);\r\n this._duplicateId++;\r\n };\r\n /**\r\n * Concats the active data with a given array.\r\n * This ensures no dupplicate will be present in the result.\r\n * @param array defines the data to concatenate with.\r\n */\r\n SmartArrayNoDuplicate.prototype.concatWithNoDuplicate = function (array) {\r\n if (array.length === 0) {\r\n return;\r\n }\r\n if (this.length + array.length > this.data.length) {\r\n this.data.length = (this.length + array.length) * 2;\r\n }\r\n for (var index = 0; index < array.length; index++) {\r\n var item = (array.data || array)[index];\r\n this.pushNoDuplicate(item);\r\n }\r\n };\r\n return SmartArrayNoDuplicate;\r\n}(SmartArray));\r\nexport { SmartArrayNoDuplicate };\r\n//# sourceMappingURL=smartArray.js.map","/**\r\n * Helper to manipulate strings\r\n */\r\nvar StringTools = /** @class */ (function () {\r\n function StringTools() {\r\n }\r\n /**\r\n * Checks for a matching suffix at the end of a string (for ES5 and lower)\r\n * @param str Source string\r\n * @param suffix Suffix to search for in the source string\r\n * @returns Boolean indicating whether the suffix was found (true) or not (false)\r\n */\r\n StringTools.EndsWith = function (str, suffix) {\r\n return str.indexOf(suffix, str.length - suffix.length) !== -1;\r\n };\r\n /**\r\n * Checks for a matching suffix at the beginning of a string (for ES5 and lower)\r\n * @param str Source string\r\n * @param suffix Suffix to search for in the source string\r\n * @returns Boolean indicating whether the suffix was found (true) or not (false)\r\n */\r\n StringTools.StartsWith = function (str, suffix) {\r\n if (!str) {\r\n return false;\r\n }\r\n return str.indexOf(suffix) === 0;\r\n };\r\n /**\r\n * Decodes a buffer into a string\r\n * @param buffer The buffer to decode\r\n * @returns The decoded string\r\n */\r\n StringTools.Decode = function (buffer) {\r\n if (typeof TextDecoder !== \"undefined\") {\r\n return new TextDecoder().decode(buffer);\r\n }\r\n var result = \"\";\r\n for (var i = 0; i < buffer.byteLength; i++) {\r\n result += String.fromCharCode(buffer[i]);\r\n }\r\n return result;\r\n };\r\n /**\r\n * Encode a buffer to a base64 string\r\n * @param buffer defines the buffer to encode\r\n * @returns the encoded string\r\n */\r\n StringTools.EncodeArrayBufferToBase64 = function (buffer) {\r\n var keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n var output = \"\";\r\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\r\n var i = 0;\r\n var bytes = ArrayBuffer.isView(buffer) ? new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength) : new Uint8Array(buffer);\r\n while (i < bytes.length) {\r\n chr1 = bytes[i++];\r\n chr2 = i < bytes.length ? bytes[i++] : Number.NaN;\r\n chr3 = i < bytes.length ? bytes[i++] : Number.NaN;\r\n enc1 = chr1 >> 2;\r\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\r\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\r\n enc4 = chr3 & 63;\r\n if (isNaN(chr2)) {\r\n enc3 = enc4 = 64;\r\n }\r\n else if (isNaN(chr3)) {\r\n enc4 = 64;\r\n }\r\n output += keyStr.charAt(enc1) + keyStr.charAt(enc2) +\r\n keyStr.charAt(enc3) + keyStr.charAt(enc4);\r\n }\r\n return output;\r\n };\r\n /**\r\n * Converts a number to string and pads with preceeding zeroes until it is of specified length.\r\n * @param num the number to convert and pad\r\n * @param length the expected length of the string\r\n * @returns the padded string\r\n */\r\n StringTools.PadNumber = function (num, length) {\r\n var str = String(num);\r\n while (str.length < length) {\r\n str = \"0\" + str;\r\n }\r\n return str;\r\n };\r\n return StringTools;\r\n}());\r\nexport { StringTools };\r\n//# sourceMappingURL=stringTools.js.map","/**\r\n * Class used to evalaute queries containing `and` and `or` operators\r\n */\r\nvar AndOrNotEvaluator = /** @class */ (function () {\r\n function AndOrNotEvaluator() {\r\n }\r\n /**\r\n * Evaluate a query\r\n * @param query defines the query to evaluate\r\n * @param evaluateCallback defines the callback used to filter result\r\n * @returns true if the query matches\r\n */\r\n AndOrNotEvaluator.Eval = function (query, evaluateCallback) {\r\n if (!query.match(/\\([^\\(\\)]*\\)/g)) {\r\n query = AndOrNotEvaluator._HandleParenthesisContent(query, evaluateCallback);\r\n }\r\n else {\r\n query = query.replace(/\\([^\\(\\)]*\\)/g, function (r) {\r\n // remove parenthesis\r\n r = r.slice(1, r.length - 1);\r\n return AndOrNotEvaluator._HandleParenthesisContent(r, evaluateCallback);\r\n });\r\n }\r\n if (query === \"true\") {\r\n return true;\r\n }\r\n if (query === \"false\") {\r\n return false;\r\n }\r\n return AndOrNotEvaluator.Eval(query, evaluateCallback);\r\n };\r\n AndOrNotEvaluator._HandleParenthesisContent = function (parenthesisContent, evaluateCallback) {\r\n evaluateCallback = evaluateCallback || (function (r) {\r\n return r === \"true\" ? true : false;\r\n });\r\n var result;\r\n var or = parenthesisContent.split(\"||\");\r\n for (var i in or) {\r\n if (or.hasOwnProperty(i)) {\r\n var ori = AndOrNotEvaluator._SimplifyNegation(or[i].trim());\r\n var and = ori.split(\"&&\");\r\n if (and.length > 1) {\r\n for (var j = 0; j < and.length; ++j) {\r\n var andj = AndOrNotEvaluator._SimplifyNegation(and[j].trim());\r\n if (andj !== \"true\" && andj !== \"false\") {\r\n if (andj[0] === \"!\") {\r\n result = !evaluateCallback(andj.substring(1));\r\n }\r\n else {\r\n result = evaluateCallback(andj);\r\n }\r\n }\r\n else {\r\n result = andj === \"true\" ? true : false;\r\n }\r\n if (!result) { // no need to continue since 'false && ... && ...' will always return false\r\n ori = \"false\";\r\n break;\r\n }\r\n }\r\n }\r\n if (result || ori === \"true\") { // no need to continue since 'true || ... || ...' will always return true\r\n result = true;\r\n break;\r\n }\r\n // result equals false (or undefined)\r\n if (ori !== \"true\" && ori !== \"false\") {\r\n if (ori[0] === \"!\") {\r\n result = !evaluateCallback(ori.substring(1));\r\n }\r\n else {\r\n result = evaluateCallback(ori);\r\n }\r\n }\r\n else {\r\n result = ori === \"true\" ? true : false;\r\n }\r\n }\r\n }\r\n // the whole parenthesis scope is replaced by 'true' or 'false'\r\n return result ? \"true\" : \"false\";\r\n };\r\n AndOrNotEvaluator._SimplifyNegation = function (booleanString) {\r\n booleanString = booleanString.replace(/^[\\s!]+/, function (r) {\r\n // remove whitespaces\r\n r = r.replace(/[\\s]/g, function () { return \"\"; });\r\n return r.length % 2 ? \"!\" : \"\";\r\n });\r\n booleanString = booleanString.trim();\r\n if (booleanString === \"!true\") {\r\n booleanString = \"false\";\r\n }\r\n else if (booleanString === \"!false\") {\r\n booleanString = \"true\";\r\n }\r\n return booleanString;\r\n };\r\n return AndOrNotEvaluator;\r\n}());\r\nexport { AndOrNotEvaluator };\r\n//# sourceMappingURL=andOrNotEvaluator.js.map","import { AndOrNotEvaluator } from \"./andOrNotEvaluator\";\r\n/**\r\n * Class used to store custom tags\r\n */\r\nvar Tags = /** @class */ (function () {\r\n function Tags() {\r\n }\r\n /**\r\n * Adds support for tags on the given object\r\n * @param obj defines the object to use\r\n */\r\n Tags.EnableFor = function (obj) {\r\n obj._tags = obj._tags || {};\r\n obj.hasTags = function () {\r\n return Tags.HasTags(obj);\r\n };\r\n obj.addTags = function (tagsString) {\r\n return Tags.AddTagsTo(obj, tagsString);\r\n };\r\n obj.removeTags = function (tagsString) {\r\n return Tags.RemoveTagsFrom(obj, tagsString);\r\n };\r\n obj.matchesTagsQuery = function (tagsQuery) {\r\n return Tags.MatchesQuery(obj, tagsQuery);\r\n };\r\n };\r\n /**\r\n * Removes tags support\r\n * @param obj defines the object to use\r\n */\r\n Tags.DisableFor = function (obj) {\r\n delete obj._tags;\r\n delete obj.hasTags;\r\n delete obj.addTags;\r\n delete obj.removeTags;\r\n delete obj.matchesTagsQuery;\r\n };\r\n /**\r\n * Gets a boolean indicating if the given object has tags\r\n * @param obj defines the object to use\r\n * @returns a boolean\r\n */\r\n Tags.HasTags = function (obj) {\r\n if (!obj._tags) {\r\n return false;\r\n }\r\n var tags = obj._tags;\r\n for (var i in tags) {\r\n if (tags.hasOwnProperty(i)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets the tags available on a given object\r\n * @param obj defines the object to use\r\n * @param asString defines if the tags must be returned as a string instead of an array of strings\r\n * @returns the tags\r\n */\r\n Tags.GetTags = function (obj, asString) {\r\n if (asString === void 0) { asString = true; }\r\n if (!obj._tags) {\r\n return null;\r\n }\r\n if (asString) {\r\n var tagsArray = [];\r\n for (var tag in obj._tags) {\r\n if (obj._tags.hasOwnProperty(tag) && obj._tags[tag] === true) {\r\n tagsArray.push(tag);\r\n }\r\n }\r\n return tagsArray.join(\" \");\r\n }\r\n else {\r\n return obj._tags;\r\n }\r\n };\r\n /**\r\n * Adds tags to an object\r\n * @param obj defines the object to use\r\n * @param tagsString defines the tag string. The tags 'true' and 'false' are reserved and cannot be used as tags.\r\n * A tag cannot start with '||', '&&', and '!'. It cannot contain whitespaces\r\n */\r\n Tags.AddTagsTo = function (obj, tagsString) {\r\n if (!tagsString) {\r\n return;\r\n }\r\n if (typeof tagsString !== \"string\") {\r\n return;\r\n }\r\n var tags = tagsString.split(\" \");\r\n tags.forEach(function (tag, index, array) {\r\n Tags._AddTagTo(obj, tag);\r\n });\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Tags._AddTagTo = function (obj, tag) {\r\n tag = tag.trim();\r\n if (tag === \"\" || tag === \"true\" || tag === \"false\") {\r\n return;\r\n }\r\n if (tag.match(/[\\s]/) || tag.match(/^([!]|([|]|[&]){2})/)) {\r\n return;\r\n }\r\n Tags.EnableFor(obj);\r\n obj._tags[tag] = true;\r\n };\r\n /**\r\n * Removes specific tags from a specific object\r\n * @param obj defines the object to use\r\n * @param tagsString defines the tags to remove\r\n */\r\n Tags.RemoveTagsFrom = function (obj, tagsString) {\r\n if (!Tags.HasTags(obj)) {\r\n return;\r\n }\r\n var tags = tagsString.split(\" \");\r\n for (var t in tags) {\r\n Tags._RemoveTagFrom(obj, tags[t]);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Tags._RemoveTagFrom = function (obj, tag) {\r\n delete obj._tags[tag];\r\n };\r\n /**\r\n * Defines if tags hosted on an object match a given query\r\n * @param obj defines the object to use\r\n * @param tagsQuery defines the tag query\r\n * @returns a boolean\r\n */\r\n Tags.MatchesQuery = function (obj, tagsQuery) {\r\n if (tagsQuery === undefined) {\r\n return true;\r\n }\r\n if (tagsQuery === \"\") {\r\n return Tags.HasTags(obj);\r\n }\r\n return AndOrNotEvaluator.Eval(tagsQuery, function (r) { return Tags.HasTags(obj) && obj._tags[r]; });\r\n };\r\n return Tags;\r\n}());\r\nexport { Tags };\r\n//# sourceMappingURL=tags.js.map","import { DomManagement } from './domManagement';\r\n/**\r\n * Class used to provide helper for timing\r\n */\r\nvar TimingTools = /** @class */ (function () {\r\n function TimingTools() {\r\n }\r\n /**\r\n * Polyfill for setImmediate\r\n * @param action defines the action to execute after the current execution block\r\n */\r\n TimingTools.SetImmediate = function (action) {\r\n if (DomManagement.IsWindowObjectExist() && window.setImmediate) {\r\n window.setImmediate(action);\r\n }\r\n else {\r\n setTimeout(action, 1);\r\n }\r\n };\r\n return TimingTools;\r\n}());\r\nexport { TimingTools };\r\n//# sourceMappingURL=timingTools.js.map","var PromiseStates;\r\n(function (PromiseStates) {\r\n PromiseStates[PromiseStates[\"Pending\"] = 0] = \"Pending\";\r\n PromiseStates[PromiseStates[\"Fulfilled\"] = 1] = \"Fulfilled\";\r\n PromiseStates[PromiseStates[\"Rejected\"] = 2] = \"Rejected\";\r\n})(PromiseStates || (PromiseStates = {}));\r\nvar FulFillmentAgregator = /** @class */ (function () {\r\n function FulFillmentAgregator() {\r\n this.count = 0;\r\n this.target = 0;\r\n this.results = [];\r\n }\r\n return FulFillmentAgregator;\r\n}());\r\nvar InternalPromise = /** @class */ (function () {\r\n function InternalPromise(resolver) {\r\n var _this = this;\r\n this._state = PromiseStates.Pending;\r\n this._children = new Array();\r\n this._rejectWasConsumed = false;\r\n if (!resolver) {\r\n return;\r\n }\r\n try {\r\n resolver(function (value) {\r\n _this._resolve(value);\r\n }, function (reason) {\r\n _this._reject(reason);\r\n });\r\n }\r\n catch (e) {\r\n this._reject(e);\r\n }\r\n }\r\n Object.defineProperty(InternalPromise.prototype, \"_result\", {\r\n get: function () {\r\n return this._resultValue;\r\n },\r\n set: function (value) {\r\n this._resultValue = value;\r\n if (this._parent && this._parent._result === undefined) {\r\n this._parent._result = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n InternalPromise.prototype.catch = function (onRejected) {\r\n return this.then(undefined, onRejected);\r\n };\r\n InternalPromise.prototype.then = function (onFulfilled, onRejected) {\r\n var _this = this;\r\n var newPromise = new InternalPromise();\r\n newPromise._onFulfilled = onFulfilled;\r\n newPromise._onRejected = onRejected;\r\n // Composition\r\n this._children.push(newPromise);\r\n newPromise._parent = this;\r\n if (this._state !== PromiseStates.Pending) {\r\n setTimeout(function () {\r\n if (_this._state === PromiseStates.Fulfilled || _this._rejectWasConsumed) {\r\n var returnedValue = newPromise._resolve(_this._result);\r\n if (returnedValue !== undefined && returnedValue !== null) {\r\n if (returnedValue._state !== undefined) {\r\n var returnedPromise = returnedValue;\r\n newPromise._children.push(returnedPromise);\r\n returnedPromise._parent = newPromise;\r\n newPromise = returnedPromise;\r\n }\r\n else {\r\n newPromise._result = returnedValue;\r\n }\r\n }\r\n }\r\n else {\r\n newPromise._reject(_this._reason);\r\n }\r\n });\r\n }\r\n return newPromise;\r\n };\r\n InternalPromise.prototype._moveChildren = function (children) {\r\n var _a;\r\n var _this = this;\r\n (_a = this._children).push.apply(_a, children.splice(0, children.length));\r\n this._children.forEach(function (child) {\r\n child._parent = _this;\r\n });\r\n if (this._state === PromiseStates.Fulfilled) {\r\n for (var _i = 0, _b = this._children; _i < _b.length; _i++) {\r\n var child = _b[_i];\r\n child._resolve(this._result);\r\n }\r\n }\r\n else if (this._state === PromiseStates.Rejected) {\r\n for (var _c = 0, _d = this._children; _c < _d.length; _c++) {\r\n var child = _d[_c];\r\n child._reject(this._reason);\r\n }\r\n }\r\n };\r\n InternalPromise.prototype._resolve = function (value) {\r\n try {\r\n this._state = PromiseStates.Fulfilled;\r\n var returnedValue = null;\r\n if (this._onFulfilled) {\r\n returnedValue = this._onFulfilled(value);\r\n }\r\n if (returnedValue !== undefined && returnedValue !== null) {\r\n if (returnedValue._state !== undefined) {\r\n // Transmit children\r\n var returnedPromise = returnedValue;\r\n returnedPromise._parent = this;\r\n returnedPromise._moveChildren(this._children);\r\n value = returnedPromise._result;\r\n }\r\n else {\r\n value = returnedValue;\r\n }\r\n }\r\n this._result = value;\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._resolve(value);\r\n }\r\n this._children.length = 0;\r\n delete this._onFulfilled;\r\n delete this._onRejected;\r\n }\r\n catch (e) {\r\n this._reject(e, true);\r\n }\r\n };\r\n InternalPromise.prototype._reject = function (reason, onLocalThrow) {\r\n if (onLocalThrow === void 0) { onLocalThrow = false; }\r\n this._state = PromiseStates.Rejected;\r\n this._reason = reason;\r\n if (this._onRejected && !onLocalThrow) {\r\n try {\r\n this._onRejected(reason);\r\n this._rejectWasConsumed = true;\r\n }\r\n catch (e) {\r\n reason = e;\r\n }\r\n }\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (this._rejectWasConsumed) {\r\n child._resolve(null);\r\n }\r\n else {\r\n child._reject(reason);\r\n }\r\n }\r\n this._children.length = 0;\r\n delete this._onFulfilled;\r\n delete this._onRejected;\r\n };\r\n InternalPromise.resolve = function (value) {\r\n var newPromise = new InternalPromise();\r\n newPromise._resolve(value);\r\n return newPromise;\r\n };\r\n InternalPromise._RegisterForFulfillment = function (promise, agregator, index) {\r\n promise.then(function (value) {\r\n agregator.results[index] = value;\r\n agregator.count++;\r\n if (agregator.count === agregator.target) {\r\n agregator.rootPromise._resolve(agregator.results);\r\n }\r\n return null;\r\n }, function (reason) {\r\n if (agregator.rootPromise._state !== PromiseStates.Rejected) {\r\n agregator.rootPromise._reject(reason);\r\n }\r\n });\r\n };\r\n InternalPromise.all = function (promises) {\r\n var newPromise = new InternalPromise();\r\n var agregator = new FulFillmentAgregator();\r\n agregator.target = promises.length;\r\n agregator.rootPromise = newPromise;\r\n if (promises.length) {\r\n for (var index = 0; index < promises.length; index++) {\r\n InternalPromise._RegisterForFulfillment(promises[index], agregator, index);\r\n }\r\n }\r\n else {\r\n newPromise._resolve([]);\r\n }\r\n return newPromise;\r\n };\r\n InternalPromise.race = function (promises) {\r\n var newPromise = new InternalPromise();\r\n if (promises.length) {\r\n for (var _i = 0, promises_1 = promises; _i < promises_1.length; _i++) {\r\n var promise = promises_1[_i];\r\n promise.then(function (value) {\r\n if (newPromise) {\r\n newPromise._resolve(value);\r\n newPromise = null;\r\n }\r\n return null;\r\n }, function (reason) {\r\n if (newPromise) {\r\n newPromise._reject(reason);\r\n newPromise = null;\r\n }\r\n });\r\n }\r\n }\r\n return newPromise;\r\n };\r\n return InternalPromise;\r\n}());\r\n/**\r\n * Helper class that provides a small promise polyfill\r\n */\r\nvar PromisePolyfill = /** @class */ (function () {\r\n function PromisePolyfill() {\r\n }\r\n /**\r\n * Static function used to check if the polyfill is required\r\n * If this is the case then the function will inject the polyfill to window.Promise\r\n * @param force defines a boolean used to force the injection (mostly for testing purposes)\r\n */\r\n PromisePolyfill.Apply = function (force) {\r\n if (force === void 0) { force = false; }\r\n if (force || typeof Promise === 'undefined') {\r\n var root = window;\r\n root.Promise = InternalPromise;\r\n }\r\n };\r\n return PromisePolyfill;\r\n}());\r\nexport { PromisePolyfill };\r\n//# sourceMappingURL=promise.js.map","import { Observable } from \"./observable\";\r\nimport { DomManagement } from \"./domManagement\";\r\nimport { Logger } from \"./logger\";\r\nimport { DeepCopier } from \"./deepCopier\";\r\nimport { PrecisionDate } from \"./precisionDate\";\r\nimport { _DevTools } from \"./devTools\";\r\nimport { WebRequest } from \"./webRequest\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { FileTools } from \"./fileTools\";\r\nimport { PromisePolyfill } from \"./promise\";\r\nimport { TimingTools } from \"./timingTools\";\r\nimport { InstantiationTools } from \"./instantiationTools\";\r\nimport { GUID } from \"./guid\";\r\n/**\r\n * Class containing a set of static utilities functions\r\n */\r\nvar Tools = /** @class */ (function () {\r\n function Tools() {\r\n }\r\n Object.defineProperty(Tools, \"BaseUrl\", {\r\n /**\r\n * Gets or sets the base URL to use to load assets\r\n */\r\n get: function () {\r\n return FileTools.BaseUrl;\r\n },\r\n set: function (value) {\r\n FileTools.BaseUrl = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"DefaultRetryStrategy\", {\r\n /**\r\n * Gets or sets the retry strategy to apply when an error happens while loading an asset\r\n */\r\n get: function () {\r\n return FileTools.DefaultRetryStrategy;\r\n },\r\n set: function (strategy) {\r\n FileTools.DefaultRetryStrategy = strategy;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"CorsBehavior\", {\r\n /**\r\n * Default behaviour for cors in the application.\r\n * It can be a string if the expected behavior is identical in the entire app.\r\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\r\n */\r\n get: function () {\r\n return FileTools.CorsBehavior;\r\n },\r\n set: function (value) {\r\n FileTools.CorsBehavior = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"UseFallbackTexture\", {\r\n /**\r\n * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return EngineStore.UseFallbackTexture;\r\n },\r\n set: function (value) {\r\n EngineStore.UseFallbackTexture = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"RegisteredExternalClasses\", {\r\n /**\r\n * Use this object to register external classes like custom textures or material\r\n * to allow the laoders to instantiate them\r\n */\r\n get: function () {\r\n return InstantiationTools.RegisteredExternalClasses;\r\n },\r\n set: function (classes) {\r\n InstantiationTools.RegisteredExternalClasses = classes;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"fallbackTexture\", {\r\n /**\r\n * Texture content used if a texture cannot loaded\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return EngineStore.FallbackTexture;\r\n },\r\n set: function (value) {\r\n EngineStore.FallbackTexture = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Read the content of a byte array at a specified coordinates (taking in account wrapping)\r\n * @param u defines the coordinate on X axis\r\n * @param v defines the coordinate on Y axis\r\n * @param width defines the width of the source data\r\n * @param height defines the height of the source data\r\n * @param pixels defines the source byte array\r\n * @param color defines the output color\r\n */\r\n Tools.FetchToRef = function (u, v, width, height, pixels, color) {\r\n var wrappedU = (Math.abs(u) * width) % width | 0;\r\n var wrappedV = (Math.abs(v) * height) % height | 0;\r\n var position = (wrappedU + wrappedV * width) * 4;\r\n color.r = pixels[position] / 255;\r\n color.g = pixels[position + 1] / 255;\r\n color.b = pixels[position + 2] / 255;\r\n color.a = pixels[position + 3] / 255;\r\n };\r\n /**\r\n * Interpolates between a and b via alpha\r\n * @param a The lower value (returned when alpha = 0)\r\n * @param b The upper value (returned when alpha = 1)\r\n * @param alpha The interpolation-factor\r\n * @return The mixed value\r\n */\r\n Tools.Mix = function (a, b, alpha) {\r\n return a * (1 - alpha) + b * alpha;\r\n };\r\n /**\r\n * Tries to instantiate a new object from a given class name\r\n * @param className defines the class name to instantiate\r\n * @returns the new object or null if the system was not able to do the instantiation\r\n */\r\n Tools.Instantiate = function (className) {\r\n return InstantiationTools.Instantiate(className);\r\n };\r\n /**\r\n * Provides a slice function that will work even on IE\r\n * @param data defines the array to slice\r\n * @param start defines the start of the data (optional)\r\n * @param end defines the end of the data (optional)\r\n * @returns the new sliced array\r\n */\r\n Tools.Slice = function (data, start, end) {\r\n if (data.slice) {\r\n return data.slice(start, end);\r\n }\r\n return Array.prototype.slice.call(data, start, end);\r\n };\r\n /**\r\n * Provides a slice function that will work even on IE\r\n * The difference between this and Slice is that this will force-convert to array\r\n * @param data defines the array to slice\r\n * @param start defines the start of the data (optional)\r\n * @param end defines the end of the data (optional)\r\n * @returns the new sliced array\r\n */\r\n Tools.SliceToArray = function (data, start, end) {\r\n if (Array.isArray(data)) {\r\n return data.slice(start, end);\r\n }\r\n return Array.prototype.slice.call(data, start, end);\r\n };\r\n /**\r\n * Polyfill for setImmediate\r\n * @param action defines the action to execute after the current execution block\r\n */\r\n Tools.SetImmediate = function (action) {\r\n TimingTools.SetImmediate(action);\r\n };\r\n /**\r\n * Function indicating if a number is an exponent of 2\r\n * @param value defines the value to test\r\n * @returns true if the value is an exponent of 2\r\n */\r\n Tools.IsExponentOfTwo = function (value) {\r\n var count = 1;\r\n do {\r\n count *= 2;\r\n } while (count < value);\r\n return count === value;\r\n };\r\n /**\r\n * Returns the nearest 32-bit single precision float representation of a Number\r\n * @param value A Number. If the parameter is of a different type, it will get converted\r\n * to a number or to NaN if it cannot be converted\r\n * @returns number\r\n */\r\n Tools.FloatRound = function (value) {\r\n if (Math.fround) {\r\n return Math.fround(value);\r\n }\r\n return (Tools._tmpFloatArray[0] = value);\r\n };\r\n /**\r\n * Extracts the filename from a path\r\n * @param path defines the path to use\r\n * @returns the filename\r\n */\r\n Tools.GetFilename = function (path) {\r\n var index = path.lastIndexOf(\"/\");\r\n if (index < 0) {\r\n return path;\r\n }\r\n return path.substring(index + 1);\r\n };\r\n /**\r\n * Extracts the \"folder\" part of a path (everything before the filename).\r\n * @param uri The URI to extract the info from\r\n * @param returnUnchangedIfNoSlash Do not touch the URI if no slashes are present\r\n * @returns The \"folder\" part of the path\r\n */\r\n Tools.GetFolderPath = function (uri, returnUnchangedIfNoSlash) {\r\n if (returnUnchangedIfNoSlash === void 0) { returnUnchangedIfNoSlash = false; }\r\n var index = uri.lastIndexOf(\"/\");\r\n if (index < 0) {\r\n if (returnUnchangedIfNoSlash) {\r\n return uri;\r\n }\r\n return \"\";\r\n }\r\n return uri.substring(0, index + 1);\r\n };\r\n /**\r\n * Convert an angle in radians to degrees\r\n * @param angle defines the angle to convert\r\n * @returns the angle in degrees\r\n */\r\n Tools.ToDegrees = function (angle) {\r\n return (angle * 180) / Math.PI;\r\n };\r\n /**\r\n * Convert an angle in degrees to radians\r\n * @param angle defines the angle to convert\r\n * @returns the angle in radians\r\n */\r\n Tools.ToRadians = function (angle) {\r\n return (angle * Math.PI) / 180;\r\n };\r\n /**\r\n * Returns an array if obj is not an array\r\n * @param obj defines the object to evaluate as an array\r\n * @param allowsNullUndefined defines a boolean indicating if obj is allowed to be null or undefined\r\n * @returns either obj directly if obj is an array or a new array containing obj\r\n */\r\n Tools.MakeArray = function (obj, allowsNullUndefined) {\r\n if (allowsNullUndefined !== true && (obj === undefined || obj == null)) {\r\n return null;\r\n }\r\n return Array.isArray(obj) ? obj : [obj];\r\n };\r\n /**\r\n * Gets the pointer prefix to use\r\n * @param engine defines the engine we are finding the prefix for\r\n * @returns \"pointer\" if touch is enabled. Else returns \"mouse\"\r\n */\r\n Tools.GetPointerPrefix = function (engine) {\r\n var eventPrefix = \"pointer\";\r\n // Check if pointer events are supported\r\n if (DomManagement.IsWindowObjectExist() && !window.PointerEvent && DomManagement.IsNavigatorAvailable() && !navigator.pointerEnabled) {\r\n eventPrefix = \"mouse\";\r\n }\r\n // Special Fallback MacOS Safari...\r\n if (engine._badDesktopOS &&\r\n !engine._badOS &&\r\n // And not ipad pros who claim to be macs...\r\n !(document && \"ontouchend\" in document)) {\r\n eventPrefix = \"mouse\";\r\n }\r\n return eventPrefix;\r\n };\r\n /**\r\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\r\n * @param url define the url we are trying\r\n * @param element define the dom element where to configure the cors policy\r\n */\r\n Tools.SetCorsBehavior = function (url, element) {\r\n FileTools.SetCorsBehavior(url, element);\r\n };\r\n // External files\r\n /**\r\n * Removes unwanted characters from an url\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\n Tools.CleanUrl = function (url) {\r\n url = url.replace(/#/gm, \"%23\");\r\n return url;\r\n };\r\n Object.defineProperty(Tools, \"PreprocessUrl\", {\r\n /**\r\n * Gets or sets a function used to pre-process url before using them to load assets\r\n */\r\n get: function () {\r\n return FileTools.PreprocessUrl;\r\n },\r\n set: function (processor) {\r\n FileTools.PreprocessUrl = processor;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @param mimeType optional mime type\r\n * @returns the HTMLImageElement of the loaded image\r\n */\r\n Tools.LoadImage = function (input, onLoad, onError, offlineProvider, mimeType) {\r\n return FileTools.LoadImage(input, onLoad, onError, offlineProvider, mimeType);\r\n };\r\n /**\r\n * Loads a file from a url\r\n * @param url url string, ArrayBuffer, or Blob to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n */\r\n Tools.LoadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n return FileTools.LoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\r\n };\r\n /**\r\n * Loads a file from a url\r\n * @param url the file url to load\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @returns a promise containing an ArrayBuffer corresponding to the loaded file\r\n */\r\n Tools.LoadFileAsync = function (url, useArrayBuffer) {\r\n if (useArrayBuffer === void 0) { useArrayBuffer = true; }\r\n return new Promise(function (resolve, reject) {\r\n FileTools.LoadFile(url, function (data) {\r\n resolve(data);\r\n }, undefined, undefined, useArrayBuffer, function (request, exception) {\r\n reject(exception);\r\n });\r\n });\r\n };\r\n /**\r\n * Load a script (identified by an url). When the url returns, the\r\n * content of this file is added into a new script element, attached to the DOM (body element)\r\n * @param scriptUrl defines the url of the script to laod\r\n * @param onSuccess defines the callback called when the script is loaded\r\n * @param onError defines the callback to call if an error occurs\r\n * @param scriptId defines the id of the script element\r\n */\r\n Tools.LoadScript = function (scriptUrl, onSuccess, onError, scriptId) {\r\n if (!DomManagement.IsWindowObjectExist()) {\r\n return;\r\n }\r\n var head = document.getElementsByTagName(\"head\")[0];\r\n var script = document.createElement(\"script\");\r\n script.setAttribute(\"type\", \"text/javascript\");\r\n script.setAttribute(\"src\", scriptUrl);\r\n if (scriptId) {\r\n script.id = scriptId;\r\n }\r\n script.onload = function () {\r\n if (onSuccess) {\r\n onSuccess();\r\n }\r\n };\r\n script.onerror = function (e) {\r\n if (onError) {\r\n onError(\"Unable to load script '\" + scriptUrl + \"'\", e);\r\n }\r\n };\r\n head.appendChild(script);\r\n };\r\n /**\r\n * Load an asynchronous script (identified by an url). When the url returns, the\r\n * content of this file is added into a new script element, attached to the DOM (body element)\r\n * @param scriptUrl defines the url of the script to laod\r\n * @param scriptId defines the id of the script element\r\n * @returns a promise request object\r\n */\r\n Tools.LoadScriptAsync = function (scriptUrl, scriptId) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this.LoadScript(scriptUrl, function () {\r\n resolve();\r\n }, function (message, exception) {\r\n reject(exception);\r\n });\r\n });\r\n };\r\n /**\r\n * Loads a file from a blob\r\n * @param fileToLoad defines the blob to use\r\n * @param callback defines the callback to call when data is loaded\r\n * @param progressCallback defines the callback to call during loading process\r\n * @returns a file request object\r\n */\r\n Tools.ReadFileAsDataURL = function (fileToLoad, callback, progressCallback) {\r\n var reader = new FileReader();\r\n var request = {\r\n onCompleteObservable: new Observable(),\r\n abort: function () { return reader.abort(); },\r\n };\r\n reader.onloadend = function (e) {\r\n request.onCompleteObservable.notifyObservers(request);\r\n };\r\n reader.onload = function (e) {\r\n //target doesn't have result from ts 1.3\r\n callback(e.target[\"result\"]);\r\n };\r\n reader.onprogress = progressCallback;\r\n reader.readAsDataURL(fileToLoad);\r\n return request;\r\n };\r\n /**\r\n * Reads a file from a File object\r\n * @param file defines the file to load\r\n * @param onSuccess defines the callback to call when data is loaded\r\n * @param onProgress defines the callback to call during loading process\r\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\r\n * @param onError defines the callback to call when an error occurs\r\n * @returns a file request object\r\n */\r\n Tools.ReadFile = function (file, onSuccess, onProgress, useArrayBuffer, onError) {\r\n return FileTools.ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError);\r\n };\r\n /**\r\n * Creates a data url from a given string content\r\n * @param content defines the content to convert\r\n * @returns the new data url link\r\n */\r\n Tools.FileAsURL = function (content) {\r\n var fileBlob = new Blob([content]);\r\n var url = window.URL || window.webkitURL;\r\n var link = url.createObjectURL(fileBlob);\r\n return link;\r\n };\r\n /**\r\n * Format the given number to a specific decimal format\r\n * @param value defines the number to format\r\n * @param decimals defines the number of decimals to use\r\n * @returns the formatted string\r\n */\r\n Tools.Format = function (value, decimals) {\r\n if (decimals === void 0) { decimals = 2; }\r\n return value.toFixed(decimals);\r\n };\r\n /**\r\n * Tries to copy an object by duplicating every property\r\n * @param source defines the source object\r\n * @param destination defines the target object\r\n * @param doNotCopyList defines a list of properties to avoid\r\n * @param mustCopyList defines a list of properties to copy (even if they start with _)\r\n */\r\n Tools.DeepCopy = function (source, destination, doNotCopyList, mustCopyList) {\r\n DeepCopier.DeepCopy(source, destination, doNotCopyList, mustCopyList);\r\n };\r\n /**\r\n * Gets a boolean indicating if the given object has no own property\r\n * @param obj defines the object to test\r\n * @returns true if object has no own property\r\n */\r\n Tools.IsEmpty = function (obj) {\r\n for (var i in obj) {\r\n if (obj.hasOwnProperty(i)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Function used to register events at window level\r\n * @param windowElement defines the Window object to use\r\n * @param events defines the events to register\r\n */\r\n Tools.RegisterTopRootEvents = function (windowElement, events) {\r\n for (var index = 0; index < events.length; index++) {\r\n var event = events[index];\r\n windowElement.addEventListener(event.name, event.handler, false);\r\n try {\r\n if (window.parent) {\r\n window.parent.addEventListener(event.name, event.handler, false);\r\n }\r\n }\r\n catch (e) {\r\n // Silently fails...\r\n }\r\n }\r\n };\r\n /**\r\n * Function used to unregister events from window level\r\n * @param windowElement defines the Window object to use\r\n * @param events defines the events to unregister\r\n */\r\n Tools.UnregisterTopRootEvents = function (windowElement, events) {\r\n for (var index = 0; index < events.length; index++) {\r\n var event = events[index];\r\n windowElement.removeEventListener(event.name, event.handler);\r\n try {\r\n if (windowElement.parent) {\r\n windowElement.parent.removeEventListener(event.name, event.handler);\r\n }\r\n }\r\n catch (e) {\r\n // Silently fails...\r\n }\r\n }\r\n };\r\n /**\r\n * Dumps the current bound framebuffer\r\n * @param width defines the rendering width\r\n * @param height defines the rendering height\r\n * @param engine defines the hosting engine\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\r\n */\r\n Tools.DumpFramebuffer = function (width, height, engine, successCallback, mimeType, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n // Read the contents of the framebuffer\r\n var numberOfChannelsByLine = width * 4;\r\n var halfHeight = height / 2;\r\n //Reading datas from WebGL\r\n var data = engine.readPixels(0, 0, width, height);\r\n //To flip image on Y axis.\r\n for (var i = 0; i < halfHeight; i++) {\r\n for (var j = 0; j < numberOfChannelsByLine; j++) {\r\n var currentCell = j + i * numberOfChannelsByLine;\r\n var targetLine = height - i - 1;\r\n var targetCell = j + targetLine * numberOfChannelsByLine;\r\n var temp = data[currentCell];\r\n data[currentCell] = data[targetCell];\r\n data[targetCell] = temp;\r\n }\r\n }\r\n // Create a 2D canvas to store the result\r\n if (!Tools._ScreenshotCanvas) {\r\n Tools._ScreenshotCanvas = document.createElement(\"canvas\");\r\n }\r\n Tools._ScreenshotCanvas.width = width;\r\n Tools._ScreenshotCanvas.height = height;\r\n var context = Tools._ScreenshotCanvas.getContext(\"2d\");\r\n if (context) {\r\n // Copy the pixels to a 2D canvas\r\n var imageData = context.createImageData(width, height);\r\n var castData = imageData.data;\r\n castData.set(data);\r\n context.putImageData(imageData, 0, 0);\r\n Tools.EncodeScreenshotCanvasData(successCallback, mimeType, fileName);\r\n }\r\n };\r\n /**\r\n * Converts the canvas data to blob.\r\n * This acts as a polyfill for browsers not supporting the to blob function.\r\n * @param canvas Defines the canvas to extract the data from\r\n * @param successCallback Defines the callback triggered once the data are available\r\n * @param mimeType Defines the mime type of the result\r\n */\r\n Tools.ToBlob = function (canvas, successCallback, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n // We need HTMLCanvasElement.toBlob for HD screenshots\r\n if (!canvas.toBlob) {\r\n // low performance polyfill based on toDataURL (https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob)\r\n canvas.toBlob = function (callback, type, quality) {\r\n var _this = this;\r\n setTimeout(function () {\r\n var binStr = atob(_this.toDataURL(type, quality).split(\",\")[1]), len = binStr.length, arr = new Uint8Array(len);\r\n for (var i = 0; i < len; i++) {\r\n arr[i] = binStr.charCodeAt(i);\r\n }\r\n callback(new Blob([arr]));\r\n });\r\n };\r\n }\r\n canvas.toBlob(function (blob) {\r\n successCallback(blob);\r\n }, mimeType);\r\n };\r\n /**\r\n * Encodes the canvas data to base 64 or automatically download the result if filename is defined\r\n * @param successCallback defines the callback triggered once the data are available\r\n * @param mimeType defines the mime type of the result\r\n * @param fileName defines he filename to download. If present, the result will automatically be downloaded\r\n */\r\n Tools.EncodeScreenshotCanvasData = function (successCallback, mimeType, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (successCallback) {\r\n var base64Image = Tools._ScreenshotCanvas.toDataURL(mimeType);\r\n successCallback(base64Image);\r\n }\r\n else {\r\n this.ToBlob(Tools._ScreenshotCanvas, function (blob) {\r\n //Creating a link if the browser have the download attribute on the a tag, to automatically start download generated image.\r\n if (\"download\" in document.createElement(\"a\")) {\r\n if (!fileName) {\r\n var date = new Date();\r\n var stringDate = (date.getFullYear() + \"-\" + (date.getMonth() + 1)).slice(2) + \"-\" + date.getDate() + \"_\" + date.getHours() + \"-\" + (\"0\" + date.getMinutes()).slice(-2);\r\n fileName = \"screenshot_\" + stringDate + \".png\";\r\n }\r\n Tools.Download(blob, fileName);\r\n }\r\n else {\r\n var url = URL.createObjectURL(blob);\r\n var newWindow = window.open(\"\");\r\n if (!newWindow) {\r\n return;\r\n }\r\n var img = newWindow.document.createElement(\"img\");\r\n img.onload = function () {\r\n // no longer need to read the blob so it's revoked\r\n URL.revokeObjectURL(url);\r\n };\r\n img.src = url;\r\n newWindow.document.body.appendChild(img);\r\n }\r\n }, mimeType);\r\n }\r\n };\r\n /**\r\n * Downloads a blob in the browser\r\n * @param blob defines the blob to download\r\n * @param fileName defines the name of the downloaded file\r\n */\r\n Tools.Download = function (blob, fileName) {\r\n if (navigator && navigator.msSaveBlob) {\r\n navigator.msSaveBlob(blob, fileName);\r\n return;\r\n }\r\n var url = window.URL.createObjectURL(blob);\r\n var a = document.createElement(\"a\");\r\n document.body.appendChild(a);\r\n a.style.display = \"none\";\r\n a.href = url;\r\n a.download = fileName;\r\n a.addEventListener(\"click\", function () {\r\n if (a.parentElement) {\r\n a.parentElement.removeChild(a);\r\n }\r\n });\r\n a.click();\r\n window.URL.revokeObjectURL(url);\r\n };\r\n /**\r\n * Will return the right value of the noPreventDefault variable\r\n * Needed to keep backwards compatibility to the old API.\r\n *\r\n * @param args arguments passed to the attachControl function\r\n * @returns the correct value for noPreventDefault\r\n */\r\n Tools.BackCompatCameraNoPreventDefault = function (args) {\r\n // is it used correctly?\r\n if (typeof args[0] === \"boolean\") {\r\n return args[0];\r\n }\r\n else if (typeof args[1] === \"boolean\") {\r\n return args[1];\r\n }\r\n return false;\r\n };\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback defines the callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n */\r\n Tools.CreateScreenshot = function (engine, camera, size, successCallback, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n throw _DevTools.WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Captures a screenshot of the current rendering\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine defines the rendering engine\r\n * @param camera defines the source camera\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n Tools.CreateScreenshotAsync = function (engine, camera, size, mimeType) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n throw _DevTools.WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param successCallback The callback receives a single parameter which contains the\r\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\r\n * src parameter of an to display it\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n */\r\n Tools.CreateScreenshotUsingRenderTarget = function (engine, camera, size, successCallback, mimeType, samples, antialiasing, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n throw _DevTools.WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Generates an image screenshot from the specified camera.\r\n * @see https://doc.babylonjs.com/how_to/render_scene_on_a_png\r\n * @param engine The engine to use for rendering\r\n * @param camera The camera to use for rendering\r\n * @param size This parameter can be set to a single number or to an object with the\r\n * following (optional) properties: precision, width, height. If a single number is passed,\r\n * it will be used for both width and height. If an object is passed, the screenshot size\r\n * will be derived from the parameters. The precision property is a multiplier allowing\r\n * rendering at a higher or lower resolution\r\n * @param mimeType The MIME type of the screenshot image (default: image/png).\r\n * Check your browser for supported MIME types\r\n * @param samples Texture samples (default: 1)\r\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\r\n * @param fileName A name for for the downloaded file.\r\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\r\n * to the src parameter of an to display it\r\n */\r\n Tools.CreateScreenshotUsingRenderTargetAsync = function (engine, camera, size, mimeType, samples, antialiasing, fileName) {\r\n if (mimeType === void 0) { mimeType = \"image/png\"; }\r\n if (samples === void 0) { samples = 1; }\r\n if (antialiasing === void 0) { antialiasing = false; }\r\n throw _DevTools.WarnImport(\"ScreenshotTools\");\r\n };\r\n /**\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a pseudo random id\r\n */\r\n Tools.RandomId = function () {\r\n return GUID.RandomId();\r\n };\r\n /**\r\n * Test if the given uri is a base64 string\r\n * @param uri The uri to test\r\n * @return True if the uri is a base64 string or false otherwise\r\n */\r\n Tools.IsBase64 = function (uri) {\r\n return uri.length < 5 ? false : uri.substr(0, 5) === \"data:\";\r\n };\r\n /**\r\n * Decode the given base64 uri.\r\n * @param uri The uri to decode\r\n * @return The decoded base64 data.\r\n */\r\n Tools.DecodeBase64 = function (uri) {\r\n var decodedString = atob(uri.split(\",\")[1]);\r\n var bufferLength = decodedString.length;\r\n var bufferView = new Uint8Array(new ArrayBuffer(bufferLength));\r\n for (var i = 0; i < bufferLength; i++) {\r\n bufferView[i] = decodedString.charCodeAt(i);\r\n }\r\n return bufferView.buffer;\r\n };\r\n /**\r\n * Gets the absolute url.\r\n * @param url the input url\r\n * @return the absolute url\r\n */\r\n Tools.GetAbsoluteUrl = function (url) {\r\n var a = document.createElement(\"a\");\r\n a.href = url;\r\n return a.href;\r\n };\r\n Object.defineProperty(Tools, \"errorsCount\", {\r\n /**\r\n * Gets a value indicating the number of loading errors\r\n * @ignorenaming\r\n */\r\n get: function () {\r\n return Logger.errorsCount;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Log a message to the console\r\n * @param message defines the message to log\r\n */\r\n Tools.Log = function (message) {\r\n Logger.Log(message);\r\n };\r\n /**\r\n * Write a warning message to the console\r\n * @param message defines the message to log\r\n */\r\n Tools.Warn = function (message) {\r\n Logger.Warn(message);\r\n };\r\n /**\r\n * Write an error message to the console\r\n * @param message defines the message to log\r\n */\r\n Tools.Error = function (message) {\r\n Logger.Error(message);\r\n };\r\n Object.defineProperty(Tools, \"LogCache\", {\r\n /**\r\n * Gets current log cache (list of logs)\r\n */\r\n get: function () {\r\n return Logger.LogCache;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Clears the log cache\r\n */\r\n Tools.ClearLogCache = function () {\r\n Logger.ClearLogCache();\r\n };\r\n Object.defineProperty(Tools, \"LogLevels\", {\r\n /**\r\n * Sets the current log level (MessageLogLevel / WarningLogLevel / ErrorLogLevel)\r\n */\r\n set: function (level) {\r\n Logger.LogLevels = level;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Tools, \"PerformanceLogLevel\", {\r\n /**\r\n * Sets the current performance log level\r\n */\r\n set: function (level) {\r\n if ((level & Tools.PerformanceUserMarkLogLevel) === Tools.PerformanceUserMarkLogLevel) {\r\n Tools.StartPerformanceCounter = Tools._StartUserMark;\r\n Tools.EndPerformanceCounter = Tools._EndUserMark;\r\n return;\r\n }\r\n if ((level & Tools.PerformanceConsoleLogLevel) === Tools.PerformanceConsoleLogLevel) {\r\n Tools.StartPerformanceCounter = Tools._StartPerformanceConsole;\r\n Tools.EndPerformanceCounter = Tools._EndPerformanceConsole;\r\n return;\r\n }\r\n Tools.StartPerformanceCounter = Tools._StartPerformanceCounterDisabled;\r\n Tools.EndPerformanceCounter = Tools._EndPerformanceCounterDisabled;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Tools._StartPerformanceCounterDisabled = function (counterName, condition) { };\r\n Tools._EndPerformanceCounterDisabled = function (counterName, condition) { };\r\n Tools._StartUserMark = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!Tools._performance) {\r\n if (!DomManagement.IsWindowObjectExist()) {\r\n return;\r\n }\r\n Tools._performance = window.performance;\r\n }\r\n if (!condition || !Tools._performance.mark) {\r\n return;\r\n }\r\n Tools._performance.mark(counterName + \"-Begin\");\r\n };\r\n Tools._EndUserMark = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!condition || !Tools._performance.mark) {\r\n return;\r\n }\r\n Tools._performance.mark(counterName + \"-End\");\r\n Tools._performance.measure(counterName, counterName + \"-Begin\", counterName + \"-End\");\r\n };\r\n Tools._StartPerformanceConsole = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!condition) {\r\n return;\r\n }\r\n Tools._StartUserMark(counterName, condition);\r\n if (console.time) {\r\n console.time(counterName);\r\n }\r\n };\r\n Tools._EndPerformanceConsole = function (counterName, condition) {\r\n if (condition === void 0) { condition = true; }\r\n if (!condition) {\r\n return;\r\n }\r\n Tools._EndUserMark(counterName, condition);\r\n console.timeEnd(counterName);\r\n };\r\n Object.defineProperty(Tools, \"Now\", {\r\n /**\r\n * Gets either window.performance.now() if supported or Date.now() else\r\n */\r\n get: function () {\r\n return PrecisionDate.Now;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * This method will return the name of the class used to create the instance of the given object.\r\n * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.\r\n * @param object the object to get the class name from\r\n * @param isType defines if the object is actually a type\r\n * @returns the name of the class, will be \"object\" for a custom data type not using the @className decorator\r\n */\r\n Tools.GetClassName = function (object, isType) {\r\n if (isType === void 0) { isType = false; }\r\n var name = null;\r\n if (!isType && object.getClassName) {\r\n name = object.getClassName();\r\n }\r\n else {\r\n if (object instanceof Object) {\r\n var classObj = isType ? object : Object.getPrototypeOf(object);\r\n name = classObj.constructor[\"__bjsclassName__\"];\r\n }\r\n if (!name) {\r\n name = typeof object;\r\n }\r\n }\r\n return name;\r\n };\r\n /**\r\n * Gets the first element of an array satisfying a given predicate\r\n * @param array defines the array to browse\r\n * @param predicate defines the predicate to use\r\n * @returns null if not found or the element\r\n */\r\n Tools.First = function (array, predicate) {\r\n for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {\r\n var el = array_1[_i];\r\n if (predicate(el)) {\r\n return el;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * This method will return the name of the full name of the class, including its owning module (if any).\r\n * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator or implementing a method getClassName():string (in which case the module won't be specified).\r\n * @param object the object to get the class name from\r\n * @param isType defines if the object is actually a type\r\n * @return a string that can have two forms: \"moduleName.className\" if module was specified when the class' Name was registered or \"className\" if there was not module specified.\r\n * @ignorenaming\r\n */\r\n Tools.getFullClassName = function (object, isType) {\r\n if (isType === void 0) { isType = false; }\r\n var className = null;\r\n var moduleName = null;\r\n if (!isType && object.getClassName) {\r\n className = object.getClassName();\r\n }\r\n else {\r\n if (object instanceof Object) {\r\n var classObj = isType ? object : Object.getPrototypeOf(object);\r\n className = classObj.constructor[\"__bjsclassName__\"];\r\n moduleName = classObj.constructor[\"__bjsmoduleName__\"];\r\n }\r\n if (!className) {\r\n className = typeof object;\r\n }\r\n }\r\n if (!className) {\r\n return null;\r\n }\r\n return (moduleName != null ? moduleName + \".\" : \"\") + className;\r\n };\r\n /**\r\n * Returns a promise that resolves after the given amount of time.\r\n * @param delay Number of milliseconds to delay\r\n * @returns Promise that resolves after the given amount of time\r\n */\r\n Tools.DelayAsync = function (delay) {\r\n return new Promise(function (resolve) {\r\n setTimeout(function () {\r\n resolve();\r\n }, delay);\r\n });\r\n };\r\n /**\r\n * Utility function to detect if the current user agent is Safari\r\n * @returns whether or not the current user agent is safari\r\n */\r\n Tools.IsSafari = function () {\r\n return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\r\n };\r\n /**\r\n * Enable/Disable Custom HTTP Request Headers globally.\r\n * default = false\r\n * @see CustomRequestHeaders\r\n */\r\n Tools.UseCustomRequestHeaders = false;\r\n /**\r\n * Custom HTTP Request Headers to be sent with XMLHttpRequests\r\n * i.e. when loading files, where the server/service expects an Authorization header\r\n */\r\n Tools.CustomRequestHeaders = WebRequest.CustomRequestHeaders;\r\n Tools._tmpFloatArray = new Float32Array(1);\r\n /**\r\n * Extracts text content from a DOM element hierarchy\r\n * Back Compat only, please use DomManagement.GetDOMTextContent instead.\r\n */\r\n Tools.GetDOMTextContent = DomManagement.GetDOMTextContent;\r\n // Logs\r\n /**\r\n * No log\r\n */\r\n Tools.NoneLogLevel = Logger.NoneLogLevel;\r\n /**\r\n * Only message logs\r\n */\r\n Tools.MessageLogLevel = Logger.MessageLogLevel;\r\n /**\r\n * Only warning logs\r\n */\r\n Tools.WarningLogLevel = Logger.WarningLogLevel;\r\n /**\r\n * Only error logs\r\n */\r\n Tools.ErrorLogLevel = Logger.ErrorLogLevel;\r\n /**\r\n * All logs\r\n */\r\n Tools.AllLogLevel = Logger.AllLogLevel;\r\n /**\r\n * Checks if the window object exists\r\n * Back Compat only, please use DomManagement.IsWindowObjectExist instead.\r\n */\r\n Tools.IsWindowObjectExist = DomManagement.IsWindowObjectExist;\r\n // Performances\r\n /**\r\n * No performance log\r\n */\r\n Tools.PerformanceNoneLogLevel = 0;\r\n /**\r\n * Use user marks to log performance\r\n */\r\n Tools.PerformanceUserMarkLogLevel = 1;\r\n /**\r\n * Log performance to the console\r\n */\r\n Tools.PerformanceConsoleLogLevel = 2;\r\n /**\r\n * Starts a performance counter\r\n */\r\n Tools.StartPerformanceCounter = Tools._StartPerformanceCounterDisabled;\r\n /**\r\n * Ends a specific performance coutner\r\n */\r\n Tools.EndPerformanceCounter = Tools._EndPerformanceCounterDisabled;\r\n return Tools;\r\n}());\r\nexport { Tools };\r\n/**\r\n * Use this className as a decorator on a given class definition to add it a name and optionally its module.\r\n * You can then use the Tools.getClassName(obj) on an instance to retrieve its class name.\r\n * This method is the only way to get it done in all cases, even if the .js file declaring the class is minified\r\n * @param name The name of the class, case should be preserved\r\n * @param module The name of the Module hosting the class, optional, but strongly recommended to specify if possible. Case should be preserved.\r\n */\r\nexport function className(name, module) {\r\n return function (target) {\r\n target[\"__bjsclassName__\"] = name;\r\n target[\"__bjsmoduleName__\"] = module != null ? module : null;\r\n };\r\n}\r\n/**\r\n * An implementation of a loop for asynchronous functions.\r\n */\r\nvar AsyncLoop = /** @class */ (function () {\r\n /**\r\n * Constructor.\r\n * @param iterations the number of iterations.\r\n * @param func the function to run each iteration\r\n * @param successCallback the callback that will be called upon succesful execution\r\n * @param offset starting offset.\r\n */\r\n function AsyncLoop(\r\n /**\r\n * Defines the number of iterations for the loop\r\n */\r\n iterations, func, successCallback, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n this.iterations = iterations;\r\n this.index = offset - 1;\r\n this._done = false;\r\n this._fn = func;\r\n this._successCallback = successCallback;\r\n }\r\n /**\r\n * Execute the next iteration. Must be called after the last iteration was finished.\r\n */\r\n AsyncLoop.prototype.executeNext = function () {\r\n if (!this._done) {\r\n if (this.index + 1 < this.iterations) {\r\n ++this.index;\r\n this._fn(this);\r\n }\r\n else {\r\n this.breakLoop();\r\n }\r\n }\r\n };\r\n /**\r\n * Break the loop and run the success callback.\r\n */\r\n AsyncLoop.prototype.breakLoop = function () {\r\n this._done = true;\r\n this._successCallback();\r\n };\r\n /**\r\n * Create and run an async loop.\r\n * @param iterations the number of iterations.\r\n * @param fn the function to run each iteration\r\n * @param successCallback the callback that will be called upon succesful execution\r\n * @param offset starting offset.\r\n * @returns the created async loop object\r\n */\r\n AsyncLoop.Run = function (iterations, fn, successCallback, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n var loop = new AsyncLoop(iterations, fn, successCallback, offset);\r\n loop.executeNext();\r\n return loop;\r\n };\r\n /**\r\n * A for-loop that will run a given number of iterations synchronous and the rest async.\r\n * @param iterations total number of iterations\r\n * @param syncedIterations number of synchronous iterations in each async iteration.\r\n * @param fn the function to call each iteration.\r\n * @param callback a success call back that will be called when iterating stops.\r\n * @param breakFunction a break condition (optional)\r\n * @param timeout timeout settings for the setTimeout function. default - 0.\r\n * @returns the created async loop object\r\n */\r\n AsyncLoop.SyncAsyncForLoop = function (iterations, syncedIterations, fn, callback, breakFunction, timeout) {\r\n if (timeout === void 0) { timeout = 0; }\r\n return AsyncLoop.Run(Math.ceil(iterations / syncedIterations), function (loop) {\r\n if (breakFunction && breakFunction()) {\r\n loop.breakLoop();\r\n }\r\n else {\r\n setTimeout(function () {\r\n for (var i = 0; i < syncedIterations; ++i) {\r\n var iteration = loop.index * syncedIterations + i;\r\n if (iteration >= iterations) {\r\n break;\r\n }\r\n fn(iteration);\r\n if (breakFunction && breakFunction()) {\r\n loop.breakLoop();\r\n break;\r\n }\r\n }\r\n loop.executeNext();\r\n }, timeout);\r\n }\r\n }, callback);\r\n };\r\n return AsyncLoop;\r\n}());\r\nexport { AsyncLoop };\r\n// Will only be define if Tools is imported freeing up some space when only engine is required\r\nEngineStore.FallbackTexture =\r\n \"data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z\";\r\n// Register promise fallback for IE\r\nPromisePolyfill.Apply();\r\n//# sourceMappingURL=tools.js.map","/** @hidden */\r\nvar _TypeStore = /** @class */ (function () {\r\n function _TypeStore() {\r\n }\r\n /** @hidden */\r\n _TypeStore.GetClass = function (fqdn) {\r\n if (this.RegisteredTypes && this.RegisteredTypes[fqdn]) {\r\n return this.RegisteredTypes[fqdn];\r\n }\r\n return null;\r\n };\r\n /** @hidden */\r\n _TypeStore.RegisteredTypes = {};\r\n return _TypeStore;\r\n}());\r\nexport { _TypeStore };\r\n//# sourceMappingURL=typeStore.js.map","/** @hidden */\r\nfunction createXMLHttpRequest() {\r\n // If running in Babylon Native, then defer to the native XMLHttpRequest, which has the same public contract\r\n if (typeof _native !== 'undefined' && _native.XMLHttpRequest) {\r\n return new _native.XMLHttpRequest();\r\n }\r\n else {\r\n return new XMLHttpRequest();\r\n }\r\n}\r\n/**\r\n * Extended version of XMLHttpRequest with support for customizations (headers, ...)\r\n */\r\nvar WebRequest = /** @class */ (function () {\r\n function WebRequest() {\r\n this._xhr = createXMLHttpRequest();\r\n }\r\n WebRequest.prototype._injectCustomRequestHeaders = function () {\r\n for (var key in WebRequest.CustomRequestHeaders) {\r\n var val = WebRequest.CustomRequestHeaders[key];\r\n if (val) {\r\n this._xhr.setRequestHeader(key, val);\r\n }\r\n }\r\n };\r\n Object.defineProperty(WebRequest.prototype, \"onprogress\", {\r\n /**\r\n * Gets or sets a function to be called when loading progress changes\r\n */\r\n get: function () {\r\n return this._xhr.onprogress;\r\n },\r\n set: function (value) {\r\n this._xhr.onprogress = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"readyState\", {\r\n /**\r\n * Returns client's state\r\n */\r\n get: function () {\r\n return this._xhr.readyState;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"status\", {\r\n /**\r\n * Returns client's status\r\n */\r\n get: function () {\r\n return this._xhr.status;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"statusText\", {\r\n /**\r\n * Returns client's status as a text\r\n */\r\n get: function () {\r\n return this._xhr.statusText;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"response\", {\r\n /**\r\n * Returns client's response\r\n */\r\n get: function () {\r\n return this._xhr.response;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"responseURL\", {\r\n /**\r\n * Returns client's response url\r\n */\r\n get: function () {\r\n return this._xhr.responseURL;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"responseText\", {\r\n /**\r\n * Returns client's response as text\r\n */\r\n get: function () {\r\n return this._xhr.responseText;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebRequest.prototype, \"responseType\", {\r\n /**\r\n * Gets or sets the expected response type\r\n */\r\n get: function () {\r\n return this._xhr.responseType;\r\n },\r\n set: function (value) {\r\n this._xhr.responseType = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n WebRequest.prototype.addEventListener = function (type, listener, options) {\r\n this._xhr.addEventListener(type, listener, options);\r\n };\r\n WebRequest.prototype.removeEventListener = function (type, listener, options) {\r\n this._xhr.removeEventListener(type, listener, options);\r\n };\r\n /**\r\n * Cancels any network activity\r\n */\r\n WebRequest.prototype.abort = function () {\r\n this._xhr.abort();\r\n };\r\n /**\r\n * Initiates the request. The optional argument provides the request body. The argument is ignored if request method is GET or HEAD\r\n * @param body defines an optional request body\r\n */\r\n WebRequest.prototype.send = function (body) {\r\n if (WebRequest.CustomRequestHeaders) {\r\n this._injectCustomRequestHeaders();\r\n }\r\n this._xhr.send(body);\r\n };\r\n /**\r\n * Sets the request method, request URL\r\n * @param method defines the method to use (GET, POST, etc..)\r\n * @param url defines the url to connect with\r\n */\r\n WebRequest.prototype.open = function (method, url) {\r\n for (var _i = 0, _a = WebRequest.CustomRequestModifiers; _i < _a.length; _i++) {\r\n var update = _a[_i];\r\n update(this._xhr, url);\r\n }\r\n // Clean url\r\n url = url.replace(\"file:http:\", \"http:\");\r\n url = url.replace(\"file:https:\", \"https:\");\r\n return this._xhr.open(method, url, true);\r\n };\r\n /**\r\n * Sets the value of a request header.\r\n * @param name The name of the header whose value is to be set\r\n * @param value The value to set as the body of the header\r\n */\r\n WebRequest.prototype.setRequestHeader = function (name, value) {\r\n this._xhr.setRequestHeader(name, value);\r\n };\r\n /**\r\n * Get the string containing the text of a particular header's value.\r\n * @param name The name of the header\r\n * @returns The string containing the text of the given header name\r\n */\r\n WebRequest.prototype.getResponseHeader = function (name) {\r\n return this._xhr.getResponseHeader(name);\r\n };\r\n /**\r\n * Custom HTTP Request Headers to be sent with XMLHttpRequests\r\n * i.e. when loading files, where the server/service expects an Authorization header\r\n */\r\n WebRequest.CustomRequestHeaders = {};\r\n /**\r\n * Add callback functions in this array to update all the requests before they get sent to the network\r\n */\r\n WebRequest.CustomRequestModifiers = new Array();\r\n return WebRequest;\r\n}());\r\nexport { WebRequest };\r\n//# sourceMappingURL=webRequest.js.map","import { Effect } from \"../Materials/effect\";\r\nvar name = 'postprocessVertexShader';\r\nvar shader = \"\\nattribute vec2 position;\\nuniform vec2 scale;\\n\\nvarying vec2 vUV;\\nconst vec2 madd=vec2(0.5,0.5);\\nvoid main(void) {\\nvUV=(position*madd+madd)*scale;\\ngl_Position=vec4(position,0.0,1.0);\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var postprocessVertexShader = { name: name, shader: shader };\r\n//# sourceMappingURL=postprocess.vertex.js.map","import { __decorate } from \"tslib\";\r\nimport { SmartArray } from \"../Misc/smartArray\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\nimport \"../Shaders/postprocess.vertex\";\r\nimport { Engine } from '../Engines/engine';\r\nimport \"../Engines/Extensions/engine.renderTarget\";\r\nimport { serialize, serializeAsColor4, SerializationHelper } from '../Misc/decorators';\r\nimport { _TypeStore } from '../Misc/typeStore';\r\n/**\r\n * PostProcess can be used to apply a shader to a texture after it has been rendered\r\n * See https://doc.babylonjs.com/how_to/how_to_use_postprocesses\r\n */\r\nvar PostProcess = /** @class */ (function () {\r\n /**\r\n * Creates a new instance PostProcess\r\n * @param name The name of the PostProcess.\r\n * @param fragmentUrl The url of the fragment shader to be used.\r\n * @param parameters Array of the names of uniform non-sampler2D variables that will be passed to the shader.\r\n * @param samplers Array of the names of uniform sampler2D variables that will be passed to the shader.\r\n * @param options The required width/height ratio to downsize to before computing the render pass. (Use 1.0 for full size)\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param defines String of defines that will be set when running the fragment shader. (default: null)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n * @param vertexUrl The url of the vertex shader to be used. (default: \"postprocess\")\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param blockCompilation If the shader should not be compiled immediatly. (default: false)\r\n * @param textureFormat Format of textures used when performing the post process. (default: TEXTUREFORMAT_RGBA)\r\n */\r\n function PostProcess(name, fragmentUrl, parameters, samplers, options, camera, samplingMode, engine, reusable, defines, textureType, vertexUrl, indexParameters, blockCompilation, textureFormat) {\r\n if (samplingMode === void 0) { samplingMode = 1; }\r\n if (defines === void 0) { defines = null; }\r\n if (textureType === void 0) { textureType = 0; }\r\n if (vertexUrl === void 0) { vertexUrl = \"postprocess\"; }\r\n if (blockCompilation === void 0) { blockCompilation = false; }\r\n if (textureFormat === void 0) { textureFormat = 5; }\r\n /**\r\n * Width of the texture to apply the post process on\r\n */\r\n this.width = -1;\r\n /**\r\n * Height of the texture to apply the post process on\r\n */\r\n this.height = -1;\r\n /**\r\n * Gets the node material used to create this postprocess (null if the postprocess was manually created)\r\n */\r\n this.nodeMaterialSource = null;\r\n /**\r\n * Internal, reference to the location where this postprocess was output to. (Typically the texture on the next postprocess in the chain)\r\n * @hidden\r\n */\r\n this._outputTexture = null;\r\n /**\r\n * If the buffer needs to be cleared before applying the post process. (default: true)\r\n * Should be set to false if shader will overwrite all previous pixels.\r\n */\r\n this.autoClear = true;\r\n /**\r\n * Type of alpha mode to use when performing the post process (default: Engine.ALPHA_DISABLE)\r\n */\r\n this.alphaMode = 0;\r\n /**\r\n * Animations to be used for the post processing\r\n */\r\n this.animations = new Array();\r\n /**\r\n * Enable Pixel Perfect mode where texture is not scaled to be power of 2.\r\n * Can only be used on a single postprocess or on the last one of a chain. (default: false)\r\n */\r\n this.enablePixelPerfectMode = false;\r\n /**\r\n * Force the postprocess to be applied without taking in account viewport\r\n */\r\n this.forceFullscreenViewport = true;\r\n /**\r\n * Scale mode for the post process (default: Engine.SCALEMODE_FLOOR)\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 1 | SCALEMODE_FLOOR | [engine.scalemode_floor](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_floor) |\r\n * | 2 | SCALEMODE_NEAREST | [engine.scalemode_nearest](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_nearest) |\r\n * | 3 | SCALEMODE_CEILING | [engine.scalemode_ceiling](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_ceiling) |\r\n *\r\n */\r\n this.scaleMode = 1;\r\n /**\r\n * Force textures to be a power of two (default: false)\r\n */\r\n this.alwaysForcePOT = false;\r\n this._samples = 1;\r\n /**\r\n * Modify the scale of the post process to be the same as the viewport (default: false)\r\n */\r\n this.adaptScaleToCurrentViewport = false;\r\n this._reusable = false;\r\n /**\r\n * Smart array of input and output textures for the post process.\r\n * @hidden\r\n */\r\n this._textures = new SmartArray(2);\r\n /**\r\n * The index in _textures that corresponds to the output texture.\r\n * @hidden\r\n */\r\n this._currentRenderTextureInd = 0;\r\n this._scaleRatio = new Vector2(1, 1);\r\n this._texelSize = Vector2.Zero();\r\n // Events\r\n /**\r\n * An event triggered when the postprocess is activated.\r\n */\r\n this.onActivateObservable = new Observable();\r\n /**\r\n * An event triggered when the postprocess changes its size.\r\n */\r\n this.onSizeChangedObservable = new Observable();\r\n /**\r\n * An event triggered when the postprocess applies its effect.\r\n */\r\n this.onApplyObservable = new Observable();\r\n /**\r\n * An event triggered before rendering the postprocess\r\n */\r\n this.onBeforeRenderObservable = new Observable();\r\n /**\r\n * An event triggered after rendering the postprocess\r\n */\r\n this.onAfterRenderObservable = new Observable();\r\n this.name = name;\r\n if (camera != null) {\r\n this._camera = camera;\r\n this._scene = camera.getScene();\r\n camera.attachPostProcess(this);\r\n this._engine = this._scene.getEngine();\r\n this._scene.postProcesses.push(this);\r\n this.uniqueId = this._scene.getUniqueId();\r\n }\r\n else if (engine) {\r\n this._engine = engine;\r\n this._engine.postProcesses.push(this);\r\n }\r\n this._options = options;\r\n this.renderTargetSamplingMode = samplingMode ? samplingMode : 1;\r\n this._reusable = reusable || false;\r\n this._textureType = textureType;\r\n this._textureFormat = textureFormat;\r\n this._samplers = samplers || [];\r\n this._samplers.push(\"textureSampler\");\r\n this._fragmentUrl = fragmentUrl;\r\n this._vertexUrl = vertexUrl;\r\n this._parameters = parameters || [];\r\n this._parameters.push(\"scale\");\r\n this._indexParameters = indexParameters;\r\n if (!blockCompilation) {\r\n this.updateEffect(defines);\r\n }\r\n }\r\n Object.defineProperty(PostProcess.prototype, \"samples\", {\r\n /**\r\n * Number of sample textures (default: 1)\r\n */\r\n get: function () {\r\n return this._samples;\r\n },\r\n set: function (n) {\r\n var _this = this;\r\n this._samples = Math.min(n, this._engine.getCaps().maxMSAASamples);\r\n this._textures.forEach(function (texture) {\r\n if (texture.samples !== _this._samples) {\r\n _this._engine.updateRenderTargetTextureSampleCount(texture, _this._samples);\r\n }\r\n });\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the fragment url or shader name used in the post process.\r\n * @returns the fragment url or name in the shader store.\r\n */\r\n PostProcess.prototype.getEffectName = function () {\r\n return this._fragmentUrl;\r\n };\r\n Object.defineProperty(PostProcess.prototype, \"onActivate\", {\r\n /**\r\n * A function that is added to the onActivateObservable\r\n */\r\n set: function (callback) {\r\n if (this._onActivateObserver) {\r\n this.onActivateObservable.remove(this._onActivateObserver);\r\n }\r\n if (callback) {\r\n this._onActivateObserver = this.onActivateObservable.add(callback);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onSizeChanged\", {\r\n /**\r\n * A function that is added to the onSizeChangedObservable\r\n */\r\n set: function (callback) {\r\n if (this._onSizeChangedObserver) {\r\n this.onSizeChangedObservable.remove(this._onSizeChangedObserver);\r\n }\r\n this._onSizeChangedObserver = this.onSizeChangedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onApply\", {\r\n /**\r\n * A function that is added to the onApplyObservable\r\n */\r\n set: function (callback) {\r\n if (this._onApplyObserver) {\r\n this.onApplyObservable.remove(this._onApplyObserver);\r\n }\r\n this._onApplyObserver = this.onApplyObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onBeforeRender\", {\r\n /**\r\n * A function that is added to the onBeforeRenderObservable\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"onAfterRender\", {\r\n /**\r\n * A function that is added to the onAfterRenderObservable\r\n */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"inputTexture\", {\r\n /**\r\n * The input texture for this post process and the output texture of the previous post process. When added to a pipeline the previous post process will\r\n * render it's output into this texture and this texture will be used as textureSampler in the fragment shader of this post process.\r\n */\r\n get: function () {\r\n return this._textures.data[this._currentRenderTextureInd];\r\n },\r\n set: function (value) {\r\n this._forcedOutputTexture = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Since inputTexture should always be defined, if we previously manually set `inputTexture`,\r\n * the only way to unset it is to use this function to restore its internal state\r\n */\r\n PostProcess.prototype.restoreDefaultInputTexture = function () {\r\n this._forcedOutputTexture = null;\r\n };\r\n /**\r\n * Gets the camera which post process is applied to.\r\n * @returns The camera the post process is applied to.\r\n */\r\n PostProcess.prototype.getCamera = function () {\r\n return this._camera;\r\n };\r\n Object.defineProperty(PostProcess.prototype, \"texelSize\", {\r\n /**\r\n * Gets the texel size of the postprocess.\r\n * See https://en.wikipedia.org/wiki/Texel_(graphics)\r\n */\r\n get: function () {\r\n if (this._shareOutputWithPostProcess) {\r\n return this._shareOutputWithPostProcess.texelSize;\r\n }\r\n if (this._forcedOutputTexture) {\r\n this._texelSize.copyFromFloats(1.0 / this._forcedOutputTexture.width, 1.0 / this._forcedOutputTexture.height);\r\n }\r\n return this._texelSize;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"PostProcess\" string\r\n */\r\n PostProcess.prototype.getClassName = function () {\r\n return \"PostProcess\";\r\n };\r\n /**\r\n * Gets the engine which this post process belongs to.\r\n * @returns The engine the post process was enabled with.\r\n */\r\n PostProcess.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * The effect that is created when initializing the post process.\r\n * @returns The created effect corresponding the the postprocess.\r\n */\r\n PostProcess.prototype.getEffect = function () {\r\n return this._effect;\r\n };\r\n /**\r\n * To avoid multiple redundant textures for multiple post process, the output the output texture for this post process can be shared with another.\r\n * @param postProcess The post process to share the output with.\r\n * @returns This post process.\r\n */\r\n PostProcess.prototype.shareOutputWith = function (postProcess) {\r\n this._disposeTextures();\r\n this._shareOutputWithPostProcess = postProcess;\r\n return this;\r\n };\r\n /**\r\n * Reverses the effect of calling shareOutputWith and returns the post process back to its original state.\r\n * This should be called if the post process that shares output with this post process is disabled/disposed.\r\n */\r\n PostProcess.prototype.useOwnOutput = function () {\r\n if (this._textures.length == 0) {\r\n this._textures = new SmartArray(2);\r\n }\r\n this._shareOutputWithPostProcess = null;\r\n };\r\n /**\r\n * Updates the effect with the current post process compile time values and recompiles the shader.\r\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\r\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\r\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\r\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\r\n * @param onCompiled Called when the shader has been compiled.\r\n * @param onError Called if there is an error when compiling a shader.\r\n * @param vertexUrl The url of the vertex shader to be used (default: the one given at construction time)\r\n * @param fragmentUrl The url of the fragment shader to be used (default: the one given at construction time)\r\n */\r\n PostProcess.prototype.updateEffect = function (defines, uniforms, samplers, indexParameters, onCompiled, onError, vertexUrl, fragmentUrl) {\r\n if (defines === void 0) { defines = null; }\r\n if (uniforms === void 0) { uniforms = null; }\r\n if (samplers === void 0) { samplers = null; }\r\n this._effect = this._engine.createEffect({ vertex: vertexUrl !== null && vertexUrl !== void 0 ? vertexUrl : this._vertexUrl, fragment: fragmentUrl !== null && fragmentUrl !== void 0 ? fragmentUrl : this._fragmentUrl }, [\"position\"], uniforms || this._parameters, samplers || this._samplers, defines !== null ? defines : \"\", undefined, onCompiled, onError, indexParameters || this._indexParameters);\r\n };\r\n /**\r\n * The post process is reusable if it can be used multiple times within one frame.\r\n * @returns If the post process is reusable\r\n */\r\n PostProcess.prototype.isReusable = function () {\r\n return this._reusable;\r\n };\r\n /** invalidate frameBuffer to hint the postprocess to create a depth buffer */\r\n PostProcess.prototype.markTextureDirty = function () {\r\n this.width = -1;\r\n };\r\n /**\r\n * Activates the post process by intializing the textures to be used when executed. Notifies onActivateObservable.\r\n * When this post process is used in a pipeline, this is call will bind the input texture of this post process to the output of the previous.\r\n * @param camera The camera that will be used in the post process. This camera will be used when calling onActivateObservable.\r\n * @param sourceTexture The source texture to be inspected to get the width and height if not specified in the post process constructor. (default: null)\r\n * @param forceDepthStencil If true, a depth and stencil buffer will be generated. (default: false)\r\n * @returns The target texture that was bound to be written to.\r\n */\r\n PostProcess.prototype.activate = function (camera, sourceTexture, forceDepthStencil) {\r\n var _this = this;\r\n if (sourceTexture === void 0) { sourceTexture = null; }\r\n camera = camera || this._camera;\r\n var scene = camera.getScene();\r\n var engine = scene.getEngine();\r\n var maxSize = engine.getCaps().maxTextureSize;\r\n var requiredWidth = ((sourceTexture ? sourceTexture.width : this._engine.getRenderWidth(true)) * this._options) | 0;\r\n var requiredHeight = ((sourceTexture ? sourceTexture.height : this._engine.getRenderHeight(true)) * this._options) | 0;\r\n // If rendering to a webvr camera's left or right eye only half the width should be used to avoid resize when rendered to screen\r\n var webVRCamera = camera.parent;\r\n if (webVRCamera && (webVRCamera.leftCamera == camera || webVRCamera.rightCamera == camera)) {\r\n requiredWidth /= 2;\r\n }\r\n var desiredWidth = (this._options.width || requiredWidth);\r\n var desiredHeight = this._options.height || requiredHeight;\r\n var needMipMaps = this.renderTargetSamplingMode !== 7 &&\r\n this.renderTargetSamplingMode !== 1 &&\r\n this.renderTargetSamplingMode !== 2;\r\n if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {\r\n if (this.adaptScaleToCurrentViewport) {\r\n var currentViewport = engine.currentViewport;\r\n if (currentViewport) {\r\n desiredWidth *= currentViewport.width;\r\n desiredHeight *= currentViewport.height;\r\n }\r\n }\r\n if (needMipMaps || this.alwaysForcePOT) {\r\n if (!this._options.width) {\r\n desiredWidth = engine.needPOTTextures ? Engine.GetExponentOfTwo(desiredWidth, maxSize, this.scaleMode) : desiredWidth;\r\n }\r\n if (!this._options.height) {\r\n desiredHeight = engine.needPOTTextures ? Engine.GetExponentOfTwo(desiredHeight, maxSize, this.scaleMode) : desiredHeight;\r\n }\r\n }\r\n if (this.width !== desiredWidth || this.height !== desiredHeight) {\r\n if (this._textures.length > 0) {\r\n for (var i = 0; i < this._textures.length; i++) {\r\n this._engine._releaseTexture(this._textures.data[i]);\r\n }\r\n this._textures.reset();\r\n }\r\n this.width = desiredWidth;\r\n this.height = desiredHeight;\r\n var textureSize = { width: this.width, height: this.height };\r\n var textureOptions = {\r\n generateMipMaps: needMipMaps,\r\n generateDepthBuffer: forceDepthStencil || camera._postProcesses.indexOf(this) === 0,\r\n generateStencilBuffer: (forceDepthStencil || camera._postProcesses.indexOf(this) === 0) && this._engine.isStencilEnable,\r\n samplingMode: this.renderTargetSamplingMode,\r\n type: this._textureType,\r\n format: this._textureFormat\r\n };\r\n this._textures.push(this._engine.createRenderTargetTexture(textureSize, textureOptions));\r\n if (this._reusable) {\r\n this._textures.push(this._engine.createRenderTargetTexture(textureSize, textureOptions));\r\n }\r\n this._texelSize.copyFromFloats(1.0 / this.width, 1.0 / this.height);\r\n this.onSizeChangedObservable.notifyObservers(this);\r\n }\r\n this._textures.forEach(function (texture) {\r\n if (texture.samples !== _this.samples) {\r\n _this._engine.updateRenderTargetTextureSampleCount(texture, _this.samples);\r\n }\r\n });\r\n }\r\n var target;\r\n if (this._shareOutputWithPostProcess) {\r\n target = this._shareOutputWithPostProcess.inputTexture;\r\n }\r\n else if (this._forcedOutputTexture) {\r\n target = this._forcedOutputTexture;\r\n this.width = this._forcedOutputTexture.width;\r\n this.height = this._forcedOutputTexture.height;\r\n }\r\n else {\r\n target = this.inputTexture;\r\n }\r\n // Bind the input of this post process to be used as the output of the previous post process.\r\n if (this.enablePixelPerfectMode) {\r\n this._scaleRatio.copyFromFloats(requiredWidth / desiredWidth, requiredHeight / desiredHeight);\r\n this._engine.bindFramebuffer(target, 0, requiredWidth, requiredHeight, this.forceFullscreenViewport);\r\n }\r\n else {\r\n this._scaleRatio.copyFromFloats(1, 1);\r\n this._engine.bindFramebuffer(target, 0, undefined, undefined, this.forceFullscreenViewport);\r\n }\r\n this.onActivateObservable.notifyObservers(camera);\r\n // Clear\r\n if (this.autoClear && this.alphaMode === 0) {\r\n this._engine.clear(this.clearColor ? this.clearColor : scene.clearColor, scene._allowPostProcessClearColor, true, true);\r\n }\r\n if (this._reusable) {\r\n this._currentRenderTextureInd = (this._currentRenderTextureInd + 1) % 2;\r\n }\r\n return target;\r\n };\r\n Object.defineProperty(PostProcess.prototype, \"isSupported\", {\r\n /**\r\n * If the post process is supported.\r\n */\r\n get: function () {\r\n return this._effect.isSupported;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PostProcess.prototype, \"aspectRatio\", {\r\n /**\r\n * The aspect ratio of the output texture.\r\n */\r\n get: function () {\r\n if (this._shareOutputWithPostProcess) {\r\n return this._shareOutputWithPostProcess.aspectRatio;\r\n }\r\n if (this._forcedOutputTexture) {\r\n return this._forcedOutputTexture.width / this._forcedOutputTexture.height;\r\n }\r\n return this.width / this.height;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Get a value indicating if the post-process is ready to be used\r\n * @returns true if the post-process is ready (shader is compiled)\r\n */\r\n PostProcess.prototype.isReady = function () {\r\n return this._effect && this._effect.isReady();\r\n };\r\n /**\r\n * Binds all textures and uniforms to the shader, this will be run on every pass.\r\n * @returns the effect corresponding to this post process. Null if not compiled or not ready.\r\n */\r\n PostProcess.prototype.apply = function () {\r\n // Check\r\n if (!this._effect || !this._effect.isReady()) {\r\n return null;\r\n }\r\n // States\r\n this._engine.enableEffect(this._effect);\r\n this._engine.setState(false);\r\n this._engine.setDepthBuffer(false);\r\n this._engine.setDepthWrite(false);\r\n // Alpha\r\n this._engine.setAlphaMode(this.alphaMode);\r\n if (this.alphaConstants) {\r\n this.getEngine().setAlphaConstants(this.alphaConstants.r, this.alphaConstants.g, this.alphaConstants.b, this.alphaConstants.a);\r\n }\r\n // Bind the output texture of the preivous post process as the input to this post process.\r\n var source;\r\n if (this._shareOutputWithPostProcess) {\r\n source = this._shareOutputWithPostProcess.inputTexture;\r\n }\r\n else if (this._forcedOutputTexture) {\r\n source = this._forcedOutputTexture;\r\n }\r\n else {\r\n source = this.inputTexture;\r\n }\r\n this._effect._bindTexture(\"textureSampler\", source);\r\n // Parameters\r\n this._effect.setVector2(\"scale\", this._scaleRatio);\r\n this.onApplyObservable.notifyObservers(this._effect);\r\n return this._effect;\r\n };\r\n PostProcess.prototype._disposeTextures = function () {\r\n if (this._shareOutputWithPostProcess || this._forcedOutputTexture) {\r\n return;\r\n }\r\n if (this._textures.length > 0) {\r\n for (var i = 0; i < this._textures.length; i++) {\r\n this._engine._releaseTexture(this._textures.data[i]);\r\n }\r\n }\r\n this._textures.dispose();\r\n };\r\n /**\r\n * Sets the required values to the prepass renderer.\r\n * @param prePassRenderer defines the prepass renderer to setup.\r\n * @returns true if the pre pass is needed.\r\n */\r\n PostProcess.prototype.setPrePassRenderer = function (prePassRenderer) {\r\n if (this._prePassEffectConfiguration) {\r\n this._prePassEffectConfiguration = prePassRenderer.addEffectConfiguration(this._prePassEffectConfiguration);\r\n this._prePassEffectConfiguration.enabled = true;\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Disposes the post process.\r\n * @param camera The camera to dispose the post process on.\r\n */\r\n PostProcess.prototype.dispose = function (camera) {\r\n camera = camera || this._camera;\r\n this._disposeTextures();\r\n var index;\r\n if (this._scene) {\r\n index = this._scene.postProcesses.indexOf(this);\r\n if (index !== -1) {\r\n this._scene.postProcesses.splice(index, 1);\r\n }\r\n }\r\n index = this._engine.postProcesses.indexOf(this);\r\n if (index !== -1) {\r\n this._engine.postProcesses.splice(index, 1);\r\n }\r\n if (!camera) {\r\n return;\r\n }\r\n camera.detachPostProcess(this);\r\n index = camera._postProcesses.indexOf(this);\r\n if (index === 0 && camera._postProcesses.length > 0) {\r\n var firstPostProcess = this._camera._getFirstPostProcess();\r\n if (firstPostProcess) {\r\n firstPostProcess.markTextureDirty();\r\n }\r\n }\r\n this.onActivateObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onApplyObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n this.onSizeChangedObservable.clear();\r\n };\r\n /**\r\n * Serializes the particle system to a JSON object\r\n * @returns the JSON object\r\n */\r\n PostProcess.prototype.serialize = function () {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.\" + this.getClassName();\r\n serializationObject.cameraId = this.getCamera().id;\r\n serializationObject.reusable = this._reusable;\r\n serializationObject.options = this._options;\r\n serializationObject.textureType = this._textureType;\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a material from parsed material data\r\n * @param parsedPostProcess defines parsed post process data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures\r\n * @returns a new post process\r\n */\r\n PostProcess.Parse = function (parsedPostProcess, scene, rootUrl) {\r\n var postProcessType = _TypeStore.GetClass(parsedPostProcess.customType);\r\n if (!postProcessType || !postProcessType._Parse) {\r\n return null;\r\n }\r\n var camera = scene.getCameraByID(parsedPostProcess.cameraId);\r\n if (!camera) {\r\n return null;\r\n }\r\n return postProcessType._Parse(parsedPostProcess, camera, scene, rootUrl);\r\n };\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"uniqueId\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"name\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"width\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"height\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"renderTargetSamplingMode\", void 0);\r\n __decorate([\r\n serializeAsColor4()\r\n ], PostProcess.prototype, \"clearColor\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"autoClear\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"alphaMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"alphaConstants\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"enablePixelPerfectMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"forceFullscreenViewport\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"scaleMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"alwaysForcePOT\", void 0);\r\n __decorate([\r\n serialize(\"samples\")\r\n ], PostProcess.prototype, \"_samples\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PostProcess.prototype, \"adaptScaleToCurrentViewport\", void 0);\r\n return PostProcess;\r\n}());\r\nexport { PostProcess };\r\n_TypeStore.RegisteredTypes[\"BABYLON.PostProcess\"] = PostProcess;\r\n//# sourceMappingURL=postProcess.js.map","import { Material } from \"../Materials/material\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\n/**\r\n * PostProcessManager is used to manage one or more post processes or post process pipelines\r\n * See https://doc.babylonjs.com/how_to/how_to_use_postprocesses\r\n */\r\nvar PostProcessManager = /** @class */ (function () {\r\n /**\r\n * Creates a new instance PostProcess\r\n * @param scene The scene that the post process is associated with.\r\n */\r\n function PostProcessManager(scene) {\r\n this._vertexBuffers = {};\r\n this._scene = scene;\r\n }\r\n PostProcessManager.prototype._prepareBuffers = function () {\r\n if (this._vertexBuffers[VertexBuffer.PositionKind]) {\r\n return;\r\n }\r\n // VBO\r\n var vertices = [];\r\n vertices.push(1, 1);\r\n vertices.push(-1, 1);\r\n vertices.push(-1, -1);\r\n vertices.push(1, -1);\r\n this._vertexBuffers[VertexBuffer.PositionKind] = new VertexBuffer(this._scene.getEngine(), vertices, VertexBuffer.PositionKind, false, false, 2);\r\n this._buildIndexBuffer();\r\n };\r\n PostProcessManager.prototype._buildIndexBuffer = function () {\r\n // Indices\r\n var indices = [];\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n this._indexBuffer = this._scene.getEngine().createIndexBuffer(indices);\r\n };\r\n /**\r\n * Rebuilds the vertex buffers of the manager.\r\n * @hidden\r\n */\r\n PostProcessManager.prototype._rebuild = function () {\r\n var vb = this._vertexBuffers[VertexBuffer.PositionKind];\r\n if (!vb) {\r\n return;\r\n }\r\n vb._rebuild();\r\n this._buildIndexBuffer();\r\n };\r\n // Methods\r\n /**\r\n * Prepares a frame to be run through a post process.\r\n * @param sourceTexture The input texture to the post procesess. (default: null)\r\n * @param postProcesses An array of post processes to be run. (default: null)\r\n * @returns True if the post processes were able to be run.\r\n * @hidden\r\n */\r\n PostProcessManager.prototype._prepareFrame = function (sourceTexture, postProcesses) {\r\n if (sourceTexture === void 0) { sourceTexture = null; }\r\n if (postProcesses === void 0) { postProcesses = null; }\r\n var camera = this._scene.activeCamera;\r\n if (!camera) {\r\n return false;\r\n }\r\n postProcesses = postProcesses || camera._postProcesses.filter(function (pp) { return pp != null; });\r\n if (!postProcesses || postProcesses.length === 0 || !this._scene.postProcessesEnabled) {\r\n return false;\r\n }\r\n postProcesses[0].activate(camera, sourceTexture, postProcesses !== null && postProcesses !== undefined);\r\n return true;\r\n };\r\n /**\r\n * Manually render a set of post processes to a texture.\r\n * Please note, the frame buffer won't be unbound after the call in case you have more render to do.\r\n * @param postProcesses An array of post processes to be run.\r\n * @param targetTexture The target texture to render to.\r\n * @param forceFullscreenViewport force gl.viewport to be full screen eg. 0,0,textureWidth,textureHeight\r\n * @param faceIndex defines the face to render to if a cubemap is defined as the target\r\n * @param lodLevel defines which lod of the texture to render to\r\n * @param doNotBindFrambuffer If set to true, assumes that the framebuffer has been bound previously\r\n */\r\n PostProcessManager.prototype.directRender = function (postProcesses, targetTexture, forceFullscreenViewport, faceIndex, lodLevel, doNotBindFrambuffer) {\r\n if (targetTexture === void 0) { targetTexture = null; }\r\n if (forceFullscreenViewport === void 0) { forceFullscreenViewport = false; }\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lodLevel === void 0) { lodLevel = 0; }\r\n if (doNotBindFrambuffer === void 0) { doNotBindFrambuffer = false; }\r\n var engine = this._scene.getEngine();\r\n for (var index = 0; index < postProcesses.length; index++) {\r\n if (index < postProcesses.length - 1) {\r\n postProcesses[index + 1].activate(this._scene.activeCamera, targetTexture);\r\n }\r\n else {\r\n if (targetTexture) {\r\n engine.bindFramebuffer(targetTexture, faceIndex, undefined, undefined, forceFullscreenViewport, lodLevel);\r\n }\r\n else if (!doNotBindFrambuffer) {\r\n engine.restoreDefaultFramebuffer();\r\n }\r\n }\r\n var pp = postProcesses[index];\r\n var effect = pp.apply();\r\n if (effect) {\r\n pp.onBeforeRenderObservable.notifyObservers(effect);\r\n // VBOs\r\n this._prepareBuffers();\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n // Draw order\r\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\r\n pp.onAfterRenderObservable.notifyObservers(effect);\r\n }\r\n }\r\n // Restore depth buffer\r\n engine.setDepthBuffer(true);\r\n engine.setDepthWrite(true);\r\n };\r\n /**\r\n * Finalize the result of the output of the postprocesses.\r\n * @param doNotPresent If true the result will not be displayed to the screen.\r\n * @param targetTexture The target texture to render to.\r\n * @param faceIndex The index of the face to bind the target texture to.\r\n * @param postProcesses The array of post processes to render.\r\n * @param forceFullscreenViewport force gl.viewport to be full screen eg. 0,0,textureWidth,textureHeight (default: false)\r\n * @hidden\r\n */\r\n PostProcessManager.prototype._finalizeFrame = function (doNotPresent, targetTexture, faceIndex, postProcesses, forceFullscreenViewport) {\r\n if (forceFullscreenViewport === void 0) { forceFullscreenViewport = false; }\r\n var camera = this._scene.activeCamera;\r\n if (!camera) {\r\n return;\r\n }\r\n postProcesses = postProcesses || camera._postProcesses.filter(function (pp) { return pp != null; });\r\n if (postProcesses.length === 0 || !this._scene.postProcessesEnabled) {\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n for (var index = 0, len = postProcesses.length; index < len; index++) {\r\n var pp = postProcesses[index];\r\n if (index < len - 1) {\r\n pp._outputTexture = postProcesses[index + 1].activate(camera, targetTexture);\r\n }\r\n else {\r\n if (targetTexture) {\r\n engine.bindFramebuffer(targetTexture, faceIndex, undefined, undefined, forceFullscreenViewport);\r\n pp._outputTexture = targetTexture;\r\n }\r\n else {\r\n engine.restoreDefaultFramebuffer();\r\n pp._outputTexture = null;\r\n }\r\n }\r\n if (doNotPresent) {\r\n break;\r\n }\r\n var effect = pp.apply();\r\n if (effect) {\r\n pp.onBeforeRenderObservable.notifyObservers(effect);\r\n // VBOs\r\n this._prepareBuffers();\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\r\n // Draw order\r\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\r\n pp.onAfterRenderObservable.notifyObservers(effect);\r\n }\r\n }\r\n // Restore states\r\n engine.setDepthBuffer(true);\r\n engine.setDepthWrite(true);\r\n engine.setAlphaMode(0);\r\n };\r\n /**\r\n * Disposes of the post process manager.\r\n */\r\n PostProcessManager.prototype.dispose = function () {\r\n var buffer = this._vertexBuffers[VertexBuffer.PositionKind];\r\n if (buffer) {\r\n buffer.dispose();\r\n this._vertexBuffers[VertexBuffer.PositionKind] = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n };\r\n return PostProcessManager;\r\n}());\r\nexport { PostProcessManager };\r\n//# sourceMappingURL=postProcessManager.js.map","import { SmartArray, SmartArrayNoDuplicate } from \"../Misc/smartArray\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\n/**\r\n * This represents the object necessary to create a rendering group.\r\n * This is exclusively used and created by the rendering manager.\r\n * To modify the behavior, you use the available helpers in your scene or meshes.\r\n * @hidden\r\n */\r\nvar RenderingGroup = /** @class */ (function () {\r\n /**\r\n * Creates a new rendering group.\r\n * @param index The rendering group index\r\n * @param opaqueSortCompareFn The opaque sort comparison function. If null no order is applied\r\n * @param alphaTestSortCompareFn The alpha test sort comparison function. If null no order is applied\r\n * @param transparentSortCompareFn The transparent sort comparison function. If null back to front + alpha index sort is applied\r\n */\r\n function RenderingGroup(index, scene, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this.index = index;\r\n this._opaqueSubMeshes = new SmartArray(256);\r\n this._transparentSubMeshes = new SmartArray(256);\r\n this._alphaTestSubMeshes = new SmartArray(256);\r\n this._depthOnlySubMeshes = new SmartArray(256);\r\n this._particleSystems = new SmartArray(256);\r\n this._spriteManagers = new SmartArray(256);\r\n /** @hidden */\r\n this._edgesRenderers = new SmartArrayNoDuplicate(16);\r\n this._scene = scene;\r\n this.opaqueSortCompareFn = opaqueSortCompareFn;\r\n this.alphaTestSortCompareFn = alphaTestSortCompareFn;\r\n this.transparentSortCompareFn = transparentSortCompareFn;\r\n }\r\n Object.defineProperty(RenderingGroup.prototype, \"opaqueSortCompareFn\", {\r\n /**\r\n * Set the opaque sort comparison function.\r\n * If null the sub meshes will be render in the order they were created\r\n */\r\n set: function (value) {\r\n this._opaqueSortCompareFn = value;\r\n if (value) {\r\n this._renderOpaque = this.renderOpaqueSorted;\r\n }\r\n else {\r\n this._renderOpaque = RenderingGroup.renderUnsorted;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderingGroup.prototype, \"alphaTestSortCompareFn\", {\r\n /**\r\n * Set the alpha test sort comparison function.\r\n * If null the sub meshes will be render in the order they were created\r\n */\r\n set: function (value) {\r\n this._alphaTestSortCompareFn = value;\r\n if (value) {\r\n this._renderAlphaTest = this.renderAlphaTestSorted;\r\n }\r\n else {\r\n this._renderAlphaTest = RenderingGroup.renderUnsorted;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RenderingGroup.prototype, \"transparentSortCompareFn\", {\r\n /**\r\n * Set the transparent sort comparison function.\r\n * If null the sub meshes will be render in the order they were created\r\n */\r\n set: function (value) {\r\n if (value) {\r\n this._transparentSortCompareFn = value;\r\n }\r\n else {\r\n this._transparentSortCompareFn = RenderingGroup.defaultTransparentSortCompare;\r\n }\r\n this._renderTransparent = this.renderTransparentSorted;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Render all the sub meshes contained in the group.\r\n * @param customRenderFunction Used to override the default render behaviour of the group.\r\n * @returns true if rendered some submeshes.\r\n */\r\n RenderingGroup.prototype.render = function (customRenderFunction, renderSprites, renderParticles, activeMeshes) {\r\n if (customRenderFunction) {\r\n customRenderFunction(this._opaqueSubMeshes, this._alphaTestSubMeshes, this._transparentSubMeshes, this._depthOnlySubMeshes);\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n // Depth only\r\n if (this._depthOnlySubMeshes.length !== 0) {\r\n engine.setColorWrite(false);\r\n this._renderAlphaTest(this._depthOnlySubMeshes);\r\n engine.setColorWrite(true);\r\n }\r\n // Opaque\r\n if (this._opaqueSubMeshes.length !== 0) {\r\n this._renderOpaque(this._opaqueSubMeshes);\r\n }\r\n // Alpha test\r\n if (this._alphaTestSubMeshes.length !== 0) {\r\n this._renderAlphaTest(this._alphaTestSubMeshes);\r\n }\r\n var stencilState = engine.getStencilBuffer();\r\n engine.setStencilBuffer(false);\r\n // Sprites\r\n if (renderSprites) {\r\n this._renderSprites();\r\n }\r\n // Particles\r\n if (renderParticles) {\r\n this._renderParticles(activeMeshes);\r\n }\r\n if (this.onBeforeTransparentRendering) {\r\n this.onBeforeTransparentRendering();\r\n }\r\n // Transparent\r\n if (this._transparentSubMeshes.length !== 0) {\r\n engine.setStencilBuffer(stencilState);\r\n this._renderTransparent(this._transparentSubMeshes);\r\n engine.setAlphaMode(0);\r\n }\r\n // Set back stencil to false in case it changes before the edge renderer.\r\n engine.setStencilBuffer(false);\r\n // Edges\r\n if (this._edgesRenderers.length) {\r\n for (var edgesRendererIndex = 0; edgesRendererIndex < this._edgesRenderers.length; edgesRendererIndex++) {\r\n this._edgesRenderers.data[edgesRendererIndex].render();\r\n }\r\n engine.setAlphaMode(0);\r\n }\r\n // Restore Stencil state.\r\n engine.setStencilBuffer(stencilState);\r\n };\r\n /**\r\n * Renders the opaque submeshes in the order from the opaqueSortCompareFn.\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.prototype.renderOpaqueSorted = function (subMeshes) {\r\n return RenderingGroup.renderSorted(subMeshes, this._opaqueSortCompareFn, this._scene.activeCamera, false);\r\n };\r\n /**\r\n * Renders the opaque submeshes in the order from the alphatestSortCompareFn.\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.prototype.renderAlphaTestSorted = function (subMeshes) {\r\n return RenderingGroup.renderSorted(subMeshes, this._alphaTestSortCompareFn, this._scene.activeCamera, false);\r\n };\r\n /**\r\n * Renders the opaque submeshes in the order from the transparentSortCompareFn.\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.prototype.renderTransparentSorted = function (subMeshes) {\r\n return RenderingGroup.renderSorted(subMeshes, this._transparentSortCompareFn, this._scene.activeCamera, true);\r\n };\r\n /**\r\n * Renders the submeshes in a specified order.\r\n * @param subMeshes The submeshes to sort before render\r\n * @param sortCompareFn The comparison function use to sort\r\n * @param cameraPosition The camera position use to preprocess the submeshes to help sorting\r\n * @param transparent Specifies to activate blending if true\r\n */\r\n RenderingGroup.renderSorted = function (subMeshes, sortCompareFn, camera, transparent) {\r\n var subIndex = 0;\r\n var subMesh;\r\n var cameraPosition = camera ? camera.globalPosition : RenderingGroup._zeroVector;\r\n for (; subIndex < subMeshes.length; subIndex++) {\r\n subMesh = subMeshes.data[subIndex];\r\n subMesh._alphaIndex = subMesh.getMesh().alphaIndex;\r\n subMesh._distanceToCamera = Vector3.Distance(subMesh.getBoundingInfo().boundingSphere.centerWorld, cameraPosition);\r\n }\r\n var sortedArray = subMeshes.data.slice(0, subMeshes.length);\r\n if (sortCompareFn) {\r\n sortedArray.sort(sortCompareFn);\r\n }\r\n for (subIndex = 0; subIndex < sortedArray.length; subIndex++) {\r\n subMesh = sortedArray[subIndex];\r\n if (transparent) {\r\n var material = subMesh.getMaterial();\r\n if (material && material.needDepthPrePass) {\r\n var engine = material.getScene().getEngine();\r\n engine.setColorWrite(false);\r\n engine.setAlphaMode(0);\r\n subMesh.render(false);\r\n engine.setColorWrite(true);\r\n }\r\n }\r\n subMesh.render(transparent);\r\n }\r\n };\r\n /**\r\n * Renders the submeshes in the order they were dispatched (no sort applied).\r\n * @param subMeshes The submeshes to render\r\n */\r\n RenderingGroup.renderUnsorted = function (subMeshes) {\r\n for (var subIndex = 0; subIndex < subMeshes.length; subIndex++) {\r\n var submesh = subMeshes.data[subIndex];\r\n submesh.render(false);\r\n }\r\n };\r\n /**\r\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\r\n * are rendered back to front if in the same alpha index.\r\n *\r\n * @param a The first submesh\r\n * @param b The second submesh\r\n * @returns The result of the comparison\r\n */\r\n RenderingGroup.defaultTransparentSortCompare = function (a, b) {\r\n // Alpha index first\r\n if (a._alphaIndex > b._alphaIndex) {\r\n return 1;\r\n }\r\n if (a._alphaIndex < b._alphaIndex) {\r\n return -1;\r\n }\r\n // Then distance to camera\r\n return RenderingGroup.backToFrontSortCompare(a, b);\r\n };\r\n /**\r\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\r\n * are rendered back to front.\r\n *\r\n * @param a The first submesh\r\n * @param b The second submesh\r\n * @returns The result of the comparison\r\n */\r\n RenderingGroup.backToFrontSortCompare = function (a, b) {\r\n // Then distance to camera\r\n if (a._distanceToCamera < b._distanceToCamera) {\r\n return 1;\r\n }\r\n if (a._distanceToCamera > b._distanceToCamera) {\r\n return -1;\r\n }\r\n return 0;\r\n };\r\n /**\r\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\r\n * are rendered front to back (prevent overdraw).\r\n *\r\n * @param a The first submesh\r\n * @param b The second submesh\r\n * @returns The result of the comparison\r\n */\r\n RenderingGroup.frontToBackSortCompare = function (a, b) {\r\n // Then distance to camera\r\n if (a._distanceToCamera < b._distanceToCamera) {\r\n return -1;\r\n }\r\n if (a._distanceToCamera > b._distanceToCamera) {\r\n return 1;\r\n }\r\n return 0;\r\n };\r\n /**\r\n * Resets the different lists of submeshes to prepare a new frame.\r\n */\r\n RenderingGroup.prototype.prepare = function () {\r\n this._opaqueSubMeshes.reset();\r\n this._transparentSubMeshes.reset();\r\n this._alphaTestSubMeshes.reset();\r\n this._depthOnlySubMeshes.reset();\r\n this._particleSystems.reset();\r\n this._spriteManagers.reset();\r\n this._edgesRenderers.reset();\r\n };\r\n RenderingGroup.prototype.dispose = function () {\r\n this._opaqueSubMeshes.dispose();\r\n this._transparentSubMeshes.dispose();\r\n this._alphaTestSubMeshes.dispose();\r\n this._depthOnlySubMeshes.dispose();\r\n this._particleSystems.dispose();\r\n this._spriteManagers.dispose();\r\n this._edgesRenderers.dispose();\r\n };\r\n /**\r\n * Inserts the submesh in its correct queue depending on its material.\r\n * @param subMesh The submesh to dispatch\r\n * @param [mesh] Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.\r\n * @param [material] Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.\r\n */\r\n RenderingGroup.prototype.dispatch = function (subMesh, mesh, material) {\r\n // Get mesh and materials if not provided\r\n if (mesh === undefined) {\r\n mesh = subMesh.getMesh();\r\n }\r\n if (material === undefined) {\r\n material = subMesh.getMaterial();\r\n }\r\n if (material === null || material === undefined) {\r\n return;\r\n }\r\n if (material.needAlphaBlendingForMesh(mesh)) { // Transparent\r\n this._transparentSubMeshes.push(subMesh);\r\n }\r\n else if (material.needAlphaTesting()) { // Alpha test\r\n if (material.needDepthPrePass) {\r\n this._depthOnlySubMeshes.push(subMesh);\r\n }\r\n this._alphaTestSubMeshes.push(subMesh);\r\n }\r\n else {\r\n if (material.needDepthPrePass) {\r\n this._depthOnlySubMeshes.push(subMesh);\r\n }\r\n this._opaqueSubMeshes.push(subMesh); // Opaque\r\n }\r\n mesh._renderingGroup = this;\r\n if (mesh._edgesRenderer && mesh._edgesRenderer.isEnabled) {\r\n this._edgesRenderers.pushNoDuplicate(mesh._edgesRenderer);\r\n }\r\n };\r\n RenderingGroup.prototype.dispatchSprites = function (spriteManager) {\r\n this._spriteManagers.push(spriteManager);\r\n };\r\n RenderingGroup.prototype.dispatchParticles = function (particleSystem) {\r\n this._particleSystems.push(particleSystem);\r\n };\r\n RenderingGroup.prototype._renderParticles = function (activeMeshes) {\r\n if (this._particleSystems.length === 0) {\r\n return;\r\n }\r\n // Particles\r\n var activeCamera = this._scene.activeCamera;\r\n this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);\r\n for (var particleIndex = 0; particleIndex < this._particleSystems.length; particleIndex++) {\r\n var particleSystem = this._particleSystems.data[particleIndex];\r\n if ((activeCamera && activeCamera.layerMask & particleSystem.layerMask) === 0) {\r\n continue;\r\n }\r\n var emitter = particleSystem.emitter;\r\n if (!emitter.position || !activeMeshes || activeMeshes.indexOf(emitter) !== -1) {\r\n this._scene._activeParticles.addCount(particleSystem.render(), false);\r\n }\r\n }\r\n this._scene.onAfterParticlesRenderingObservable.notifyObservers(this._scene);\r\n };\r\n RenderingGroup.prototype._renderSprites = function () {\r\n if (!this._scene.spritesEnabled || this._spriteManagers.length === 0) {\r\n return;\r\n }\r\n // Sprites\r\n var activeCamera = this._scene.activeCamera;\r\n this._scene.onBeforeSpritesRenderingObservable.notifyObservers(this._scene);\r\n for (var id = 0; id < this._spriteManagers.length; id++) {\r\n var spriteManager = this._spriteManagers.data[id];\r\n if (((activeCamera && activeCamera.layerMask & spriteManager.layerMask) !== 0)) {\r\n spriteManager.render();\r\n }\r\n }\r\n this._scene.onAfterSpritesRenderingObservable.notifyObservers(this._scene);\r\n };\r\n RenderingGroup._zeroVector = Vector3.Zero();\r\n return RenderingGroup;\r\n}());\r\nexport { RenderingGroup };\r\n//# sourceMappingURL=renderingGroup.js.map","import { RenderingGroup } from \"./renderingGroup\";\r\n/**\r\n * This class is used by the onRenderingGroupObservable\r\n */\r\nvar RenderingGroupInfo = /** @class */ (function () {\r\n function RenderingGroupInfo() {\r\n }\r\n return RenderingGroupInfo;\r\n}());\r\nexport { RenderingGroupInfo };\r\n/**\r\n * This is the manager responsible of all the rendering for meshes sprites and particles.\r\n * It is enable to manage the different groups as well as the different necessary sort functions.\r\n * This should not be used directly aside of the few static configurations\r\n */\r\nvar RenderingManager = /** @class */ (function () {\r\n /**\r\n * Instantiates a new rendering group for a particular scene\r\n * @param scene Defines the scene the groups belongs to\r\n */\r\n function RenderingManager(scene) {\r\n /**\r\n * @hidden\r\n */\r\n this._useSceneAutoClearSetup = false;\r\n this._renderingGroups = new Array();\r\n this._autoClearDepthStencil = {};\r\n this._customOpaqueSortCompareFn = {};\r\n this._customAlphaTestSortCompareFn = {};\r\n this._customTransparentSortCompareFn = {};\r\n this._renderingGroupInfo = new RenderingGroupInfo();\r\n this._scene = scene;\r\n for (var i = RenderingManager.MIN_RENDERINGGROUPS; i < RenderingManager.MAX_RENDERINGGROUPS; i++) {\r\n this._autoClearDepthStencil[i] = { autoClear: true, depth: true, stencil: true };\r\n }\r\n }\r\n RenderingManager.prototype._clearDepthStencilBuffer = function (depth, stencil) {\r\n if (depth === void 0) { depth = true; }\r\n if (stencil === void 0) { stencil = true; }\r\n if (this._depthStencilBufferAlreadyCleaned) {\r\n return;\r\n }\r\n this._scene.getEngine().clear(null, false, depth, stencil);\r\n this._depthStencilBufferAlreadyCleaned = true;\r\n };\r\n /**\r\n * Renders the entire managed groups. This is used by the scene or the different rennder targets.\r\n * @hidden\r\n */\r\n RenderingManager.prototype.render = function (customRenderFunction, activeMeshes, renderParticles, renderSprites) {\r\n // Update the observable context (not null as it only goes away on dispose)\r\n var info = this._renderingGroupInfo;\r\n info.scene = this._scene;\r\n info.camera = this._scene.activeCamera;\r\n // Dispatch sprites\r\n if (this._scene.spriteManagers && renderSprites) {\r\n for (var index = 0; index < this._scene.spriteManagers.length; index++) {\r\n var manager = this._scene.spriteManagers[index];\r\n this.dispatchSprites(manager);\r\n }\r\n }\r\n // Render\r\n for (var index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n this._depthStencilBufferAlreadyCleaned = index === RenderingManager.MIN_RENDERINGGROUPS;\r\n var renderingGroup = this._renderingGroups[index];\r\n if (!renderingGroup) {\r\n continue;\r\n }\r\n var renderingGroupMask = Math.pow(2, index);\r\n info.renderingGroupId = index;\r\n // Before Observable\r\n this._scene.onBeforeRenderingGroupObservable.notifyObservers(info, renderingGroupMask);\r\n // Clear depth/stencil if needed\r\n if (RenderingManager.AUTOCLEAR) {\r\n var autoClear = this._useSceneAutoClearSetup ?\r\n this._scene.getAutoClearDepthStencilSetup(index) :\r\n this._autoClearDepthStencil[index];\r\n if (autoClear && autoClear.autoClear) {\r\n this._clearDepthStencilBuffer(autoClear.depth, autoClear.stencil);\r\n }\r\n }\r\n // Render\r\n for (var _i = 0, _a = this._scene._beforeRenderingGroupDrawStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(index);\r\n }\r\n renderingGroup.render(customRenderFunction, renderSprites, renderParticles, activeMeshes);\r\n for (var _b = 0, _c = this._scene._afterRenderingGroupDrawStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action(index);\r\n }\r\n // After Observable\r\n this._scene.onAfterRenderingGroupObservable.notifyObservers(info, renderingGroupMask);\r\n }\r\n };\r\n /**\r\n * Resets the different information of the group to prepare a new frame\r\n * @hidden\r\n */\r\n RenderingManager.prototype.reset = function () {\r\n for (var index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n var renderingGroup = this._renderingGroups[index];\r\n if (renderingGroup) {\r\n renderingGroup.prepare();\r\n }\r\n }\r\n };\r\n /**\r\n * Dispose and release the group and its associated resources.\r\n * @hidden\r\n */\r\n RenderingManager.prototype.dispose = function () {\r\n this.freeRenderingGroups();\r\n this._renderingGroups.length = 0;\r\n this._renderingGroupInfo = null;\r\n };\r\n /**\r\n * Clear the info related to rendering groups preventing retention points during dispose.\r\n */\r\n RenderingManager.prototype.freeRenderingGroups = function () {\r\n for (var index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n var renderingGroup = this._renderingGroups[index];\r\n if (renderingGroup) {\r\n renderingGroup.dispose();\r\n }\r\n }\r\n };\r\n RenderingManager.prototype._prepareRenderingGroup = function (renderingGroupId) {\r\n if (this._renderingGroups[renderingGroupId] === undefined) {\r\n this._renderingGroups[renderingGroupId] = new RenderingGroup(renderingGroupId, this._scene, this._customOpaqueSortCompareFn[renderingGroupId], this._customAlphaTestSortCompareFn[renderingGroupId], this._customTransparentSortCompareFn[renderingGroupId]);\r\n }\r\n };\r\n /**\r\n * Add a sprite manager to the rendering manager in order to render it this frame.\r\n * @param spriteManager Define the sprite manager to render\r\n */\r\n RenderingManager.prototype.dispatchSprites = function (spriteManager) {\r\n var renderingGroupId = spriteManager.renderingGroupId || 0;\r\n this._prepareRenderingGroup(renderingGroupId);\r\n this._renderingGroups[renderingGroupId].dispatchSprites(spriteManager);\r\n };\r\n /**\r\n * Add a particle system to the rendering manager in order to render it this frame.\r\n * @param particleSystem Define the particle system to render\r\n */\r\n RenderingManager.prototype.dispatchParticles = function (particleSystem) {\r\n var renderingGroupId = particleSystem.renderingGroupId || 0;\r\n this._prepareRenderingGroup(renderingGroupId);\r\n this._renderingGroups[renderingGroupId].dispatchParticles(particleSystem);\r\n };\r\n /**\r\n * Add a submesh to the manager in order to render it this frame\r\n * @param subMesh The submesh to dispatch\r\n * @param mesh Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.\r\n * @param material Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.\r\n */\r\n RenderingManager.prototype.dispatch = function (subMesh, mesh, material) {\r\n if (mesh === undefined) {\r\n mesh = subMesh.getMesh();\r\n }\r\n var renderingGroupId = mesh.renderingGroupId || 0;\r\n this._prepareRenderingGroup(renderingGroupId);\r\n this._renderingGroups[renderingGroupId].dispatch(subMesh, mesh, material);\r\n };\r\n /**\r\n * Overrides the default sort function applied in the renderging group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversly depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n RenderingManager.prototype.setRenderingOrder = function (renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this._customOpaqueSortCompareFn[renderingGroupId] = opaqueSortCompareFn;\r\n this._customAlphaTestSortCompareFn[renderingGroupId] = alphaTestSortCompareFn;\r\n this._customTransparentSortCompareFn[renderingGroupId] = transparentSortCompareFn;\r\n if (this._renderingGroups[renderingGroupId]) {\r\n var group = this._renderingGroups[renderingGroupId];\r\n group.opaqueSortCompareFn = this._customOpaqueSortCompareFn[renderingGroupId];\r\n group.alphaTestSortCompareFn = this._customAlphaTestSortCompareFn[renderingGroupId];\r\n group.transparentSortCompareFn = this._customTransparentSortCompareFn[renderingGroupId];\r\n }\r\n };\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n * @param depth Automatically clears depth between groups if true and autoClear is true.\r\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\r\n */\r\n RenderingManager.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil, depth, stencil) {\r\n if (depth === void 0) { depth = true; }\r\n if (stencil === void 0) { stencil = true; }\r\n this._autoClearDepthStencil[renderingGroupId] = {\r\n autoClear: autoClearDepthStencil,\r\n depth: depth,\r\n stencil: stencil\r\n };\r\n };\r\n /**\r\n * Gets the current auto clear configuration for one rendering group of the rendering\r\n * manager.\r\n * @param index the rendering group index to get the information for\r\n * @returns The auto clear setup for the requested rendering group\r\n */\r\n RenderingManager.prototype.getAutoClearDepthStencilSetup = function (index) {\r\n return this._autoClearDepthStencil[index];\r\n };\r\n /**\r\n * The max id used for rendering groups (not included)\r\n */\r\n RenderingManager.MAX_RENDERINGGROUPS = 4;\r\n /**\r\n * The min id used for rendering groups (included)\r\n */\r\n RenderingManager.MIN_RENDERINGGROUPS = 0;\r\n /**\r\n * Used to globally prevent autoclearing scenes.\r\n */\r\n RenderingManager.AUTOCLEAR = true;\r\n return RenderingManager;\r\n}());\r\nexport { RenderingManager };\r\n//# sourceMappingURL=renderingManager.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'bonesDeclaration';\r\nvar shader = \"#if NUM_BONE_INFLUENCERS>0\\n#ifdef BONETEXTURE\\nuniform sampler2D boneSampler;\\nuniform float boneTextureWidth;\\n#else\\nuniform mat4 mBones[BonesPerMesh];\\n#ifdef BONES_VELOCITY_ENABLED\\nuniform mat4 mPreviousBones[BonesPerMesh];\\n#endif\\n#endif\\nattribute vec4 matricesIndices;\\nattribute vec4 matricesWeights;\\n#if NUM_BONE_INFLUENCERS>4\\nattribute vec4 matricesIndicesExtra;\\nattribute vec4 matricesWeightsExtra;\\n#endif\\n#ifdef BONETEXTURE\\n#define inline\\nmat4 readMatrixFromRawSampler(sampler2D smp,float index)\\n{\\nfloat offset=index*4.0;\\nfloat dx=1.0/boneTextureWidth;\\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));\\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));\\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));\\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));\\nreturn mat4(m0,m1,m2,m3);\\n}\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var bonesDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=bonesDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'bonesVertex';\r\nvar shader = \"#if NUM_BONE_INFLUENCERS>0\\nmat4 influence;\\n#ifdef BONETEXTURE\\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\\n#endif\\n#else\\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\\n#endif\\n#endif\\nfinalWorld=finalWorld*influence;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var bonesVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=bonesVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'bumpFragment';\r\nvar shader = \"vec2 uvOffset=vec2(0.0,0.0);\\n#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)\\n#ifdef NORMALXYSCALE\\nfloat normalScale=1.0;\\n#elif defined(BUMP)\\nfloat normalScale=vBumpInfos.y;\\n#else\\nfloat normalScale=1.0;\\n#endif\\n#if defined(TANGENT) && defined(NORMAL)\\nmat3 TBN=vTBN;\\n#elif defined(BUMP)\\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vBumpUV);\\n#else\\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vDetailUV,vec2(1.,1.));\\n#endif\\n#elif defined(ANISOTROPIC)\\n#if defined(TANGENT) && defined(NORMAL)\\nmat3 TBN=vTBN;\\n#else\\nmat3 TBN=cotangent_frame(normalW,vPositionW,vMainUV1,vec2(1.,1.));\\n#endif\\n#endif\\n#ifdef PARALLAX\\nmat3 invTBN=transposeMat3(TBN);\\n#ifdef PARALLAXOCCLUSION\\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\\n#else\\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\\n#endif\\n#endif\\n#ifdef DETAIL\\nvec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);\\nvec2 detailNormalRG=detailColor.wy*2.0-1.0;\\nfloat detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));\\nvec3 detailNormal=vec3(detailNormalRG,detailNormalB);\\n#endif\\n#ifdef BUMP\\n#ifdef OBJECTSPACE_NORMALMAP\\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz*2.0-1.0);\\nnormalW=normalize(mat3(normalMatrix)*normalW);\\n#elif !defined(DETAIL)\\nnormalW=perturbNormal(TBN,vBumpUV+uvOffset);\\n#else\\nvec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0;\\n\\n#if DETAIL_NORMALBLENDMETHOD == 0\\ndetailNormal.xy*=vDetailInfos.z;\\nvec3 blendedNormal=normalize(vec3(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z));\\n#elif DETAIL_NORMALBLENDMETHOD == 1\\ndetailNormal.xy*=vDetailInfos.z;\\nbumpNormal+=vec3(0.0,0.0,1.0);\\ndetailNormal*=vec3(-1.0,-1.0,1.0);\\nvec3 blendedNormal=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal;\\n#endif\\nnormalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y);\\n#endif\\n#elif defined(DETAIL)\\ndetailNormal.xy*=vDetailInfos.z;\\nnormalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var bumpFragment = { name: name, shader: shader };\r\n//# sourceMappingURL=bumpFragment.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'bumpFragmentFunctions';\r\nvar shader = \"#if defined(BUMP)\\n#if BUMPDIRECTUV == 1\\n#define vBumpUV vMainUV1\\n#elif BUMPDIRECTUV == 2\\n#define vBumpUV vMainUV2\\n#else\\nvarying vec2 vBumpUV;\\n#endif\\nuniform sampler2D bumpSampler;\\nvec3 perturbNormal(mat3 cotangentFrame,vec2 uv)\\n{\\nreturn perturbNormal(cotangentFrame,texture2D(bumpSampler,uv).xyz,vBumpInfos.y);\\n}\\n#endif\\n#if defined(DETAIL)\\n#if DETAILDIRECTUV == 1\\n#define vDetailUV vMainUV1\\n#elif DETAILDIRECTUV == 2\\n#define vDetailUV vMainUV2\\n#else\\nvarying vec2 vDetailUV;\\n#endif\\nuniform sampler2D detailSampler;\\n#endif\\n#if defined(BUMP)\\nvec3 perturbNormal(mat3 cotangentFrame,vec3 color)\\n{\\nreturn perturbNormal(cotangentFrame,color,vBumpInfos.y);\\n}\\n\\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\\n{\\nreturn cotangent_frame(normal,p,uv,vTangentSpaceParams);\\n}\\n#endif\\n#if defined(BUMP) && defined(PARALLAX)\\nconst float minSamples=4.;\\nconst float maxSamples=15.;\\nconst int iMaxSamples=15;\\n\\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\\nparallaxLimit*=parallaxScale;\\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\\nfloat stepSize=1.0/numSamples;\\n\\nfloat currRayHeight=1.0;\\nvec2 vCurrOffset=vec2(0,0);\\nvec2 vLastOffset=vec2(0,0);\\nfloat lastSampledHeight=1.0;\\nfloat currSampledHeight=1.0;\\nfor (int i=0; icurrRayHeight)\\n{\\nfloat delta1=currSampledHeight-currRayHeight;\\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\\nfloat ratio=delta1/(delta1+delta2);\\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\\n\\nbreak;\\n}\\nelse\\n{\\ncurrRayHeight-=stepSize;\\nvLastOffset=vCurrOffset;\\nvCurrOffset+=stepSize*vMaxOffset;\\nlastSampledHeight=currSampledHeight;\\n}\\n}\\nreturn vCurrOffset;\\n}\\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\\n{\\n\\nfloat height=texture2D(bumpSampler,vBumpUV).w;\\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\\nreturn -texCoordOffset;\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var bumpFragmentFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=bumpFragmentFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'bumpFragmentMainFunctions';\r\nvar shader = \"#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL)\\n#if defined(TANGENT) && defined(NORMAL)\\nvarying mat3 vTBN;\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\nuniform mat4 normalMatrix;\\n#endif\\nvec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)\\n{\\n#ifdef NORMALXYSCALE\\nnormal=normalize(normal*vec3(scale,scale,1.0));\\n#endif\\nreturn normalize(cotangentFrame*normal);\\n}\\nvec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)\\n{\\nreturn perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);\\n}\\n\\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\\n{\\n\\nuv=gl_FrontFacing ? uv : -uv;\\n\\nvec3 dp1=dFdx(p);\\nvec3 dp2=dFdy(p);\\nvec2 duv1=dFdx(uv);\\nvec2 duv2=dFdy(uv);\\n\\nvec3 dp2perp=cross(dp2,normal);\\nvec3 dp1perp=cross(normal,dp1);\\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\\nvec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;\\n\\ntangent*=tangentSpaceParams.x;\\nbitangent*=tangentSpaceParams.y;\\n\\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(bitangent,bitangent)));\\nreturn mat3(tangent*invmax,bitangent*invmax,normal);\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var bumpFragmentMainFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=bumpFragmentMainFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'bumpVertex';\r\nvar shader = \"#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\\n#if defined(TANGENT) && defined(NORMAL)\\nvec3 tbnNormal=normalize(normalUpdated);\\nvec3 tbnTangent=normalize(tangentUpdated.xyz);\\nvec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;\\nvTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var bumpVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=bumpVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'bumpVertexDeclaration';\r\nvar shader = \"#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\\n#if defined(TANGENT) && defined(NORMAL)\\nvarying mat3 vTBN;\\n#endif\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var bumpVertexDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=bumpVertexDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'clipPlaneFragment';\r\nvar shader = \"#ifdef CLIPPLANE\\nif (fClipDistance>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE2\\nif (fClipDistance2>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE3\\nif (fClipDistance3>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE4\\nif (fClipDistance4>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE5\\nif (fClipDistance5>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE6\\nif (fClipDistance6>0.0)\\n{\\ndiscard;\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var clipPlaneFragment = { name: name, shader: shader };\r\n//# sourceMappingURL=clipPlaneFragment.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'clipPlaneFragmentDeclaration';\r\nvar shader = \"#ifdef CLIPPLANE\\nvarying float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nvarying float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nvarying float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nvarying float fClipDistance4;\\n#endif\\n#ifdef CLIPPLANE5\\nvarying float fClipDistance5;\\n#endif\\n#ifdef CLIPPLANE6\\nvarying float fClipDistance6;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var clipPlaneFragmentDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=clipPlaneFragmentDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'clipPlaneVertex';\r\nvar shader = \"#ifdef CLIPPLANE\\nfClipDistance=dot(worldPos,vClipPlane);\\n#endif\\n#ifdef CLIPPLANE2\\nfClipDistance2=dot(worldPos,vClipPlane2);\\n#endif\\n#ifdef CLIPPLANE3\\nfClipDistance3=dot(worldPos,vClipPlane3);\\n#endif\\n#ifdef CLIPPLANE4\\nfClipDistance4=dot(worldPos,vClipPlane4);\\n#endif\\n#ifdef CLIPPLANE5\\nfClipDistance5=dot(worldPos,vClipPlane5);\\n#endif\\n#ifdef CLIPPLANE6\\nfClipDistance6=dot(worldPos,vClipPlane6);\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var clipPlaneVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=clipPlaneVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'clipPlaneVertexDeclaration';\r\nvar shader = \"#ifdef CLIPPLANE\\nuniform vec4 vClipPlane;\\nvarying float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nuniform vec4 vClipPlane2;\\nvarying float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nuniform vec4 vClipPlane3;\\nvarying float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nuniform vec4 vClipPlane4;\\nvarying float fClipDistance4;\\n#endif\\n#ifdef CLIPPLANE5\\nuniform vec4 vClipPlane5;\\nvarying float fClipDistance5;\\n#endif\\n#ifdef CLIPPLANE6\\nuniform vec4 vClipPlane6;\\nvarying float fClipDistance6;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var clipPlaneVertexDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=clipPlaneVertexDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'depthPrePass';\r\nvar shader = \"#ifdef DEPTHPREPASS\\ngl_FragColor=vec4(0.,0.,0.,1.0);\\nreturn;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var depthPrePass = { name: name, shader: shader };\r\n//# sourceMappingURL=depthPrePass.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'fogFragment';\r\nvar shader = \"#ifdef FOG\\nfloat fog=CalcFogFactor();\\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var fogFragment = { name: name, shader: shader };\r\n//# sourceMappingURL=fogFragment.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'fogFragmentDeclaration';\r\nvar shader = \"#ifdef FOG\\n#define FOGMODE_NONE 0.\\n#define FOGMODE_EXP 1.\\n#define FOGMODE_EXP2 2.\\n#define FOGMODE_LINEAR 3.\\n#define E 2.71828\\nuniform vec4 vFogInfos;\\nuniform vec3 vFogColor;\\nvarying vec3 vFogDistance;\\nfloat CalcFogFactor()\\n{\\nfloat fogCoeff=1.0;\\nfloat fogStart=vFogInfos.y;\\nfloat fogEnd=vFogInfos.z;\\nfloat fogDensity=vFogInfos.w;\\nfloat fogDistance=length(vFogDistance);\\nif (FOGMODE_LINEAR == vFogInfos.x)\\n{\\nfogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);\\n}\\nelse if (FOGMODE_EXP == vFogInfos.x)\\n{\\nfogCoeff=1.0/pow(E,fogDistance*fogDensity);\\n}\\nelse if (FOGMODE_EXP2 == vFogInfos.x)\\n{\\nfogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);\\n}\\nreturn clamp(fogCoeff,0.0,1.0);\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var fogFragmentDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=fogFragmentDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'fogVertex';\r\nvar shader = \"#ifdef FOG\\nvFogDistance=(view*worldPos).xyz;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var fogVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=fogVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'fogVertexDeclaration';\r\nvar shader = \"#ifdef FOG\\nvarying vec3 vFogDistance;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var fogVertexDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=fogVertexDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'helperFunctions';\r\nvar shader = \"const float PI=3.1415926535897932384626433832795;\\nconst float HALF_MIN=5.96046448e-08;\\nconst float LinearEncodePowerApprox=2.2;\\nconst float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;\\nconst vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);\\nconst float Epsilon=0.0000001;\\n#define saturate(x) clamp(x,0.0,1.0)\\n#define absEps(x) abs(x)+Epsilon\\n#define maxEps(x) max(x,Epsilon)\\n#define saturateEps(x) clamp(x,Epsilon,1.0)\\nmat3 transposeMat3(mat3 inMatrix) {\\nvec3 i0=inMatrix[0];\\nvec3 i1=inMatrix[1];\\nvec3 i2=inMatrix[2];\\nmat3 outMatrix=mat3(\\nvec3(i0.x,i1.x,i2.x),\\nvec3(i0.y,i1.y,i2.y),\\nvec3(i0.z,i1.z,i2.z)\\n);\\nreturn outMatrix;\\n}\\n\\nmat3 inverseMat3(mat3 inMatrix) {\\nfloat a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];\\nfloat a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];\\nfloat a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];\\nfloat b01=a22*a11-a12*a21;\\nfloat b11=-a22*a10+a12*a20;\\nfloat b21=a21*a10-a11*a20;\\nfloat det=a00*b01+a01*b11+a02*b21;\\nreturn mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;\\n}\\nfloat toLinearSpace(float color)\\n{\\nreturn pow(color,LinearEncodePowerApprox);\\n}\\nvec3 toLinearSpace(vec3 color)\\n{\\nreturn pow(color,vec3(LinearEncodePowerApprox));\\n}\\nvec4 toLinearSpace(vec4 color)\\n{\\nreturn vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);\\n}\\nvec3 toGammaSpace(vec3 color)\\n{\\nreturn pow(color,vec3(GammaEncodePowerApprox));\\n}\\nvec4 toGammaSpace(vec4 color)\\n{\\nreturn vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);\\n}\\nfloat toGammaSpace(float color)\\n{\\nreturn pow(color,GammaEncodePowerApprox);\\n}\\nfloat square(float value)\\n{\\nreturn value*value;\\n}\\nfloat pow5(float value) {\\nfloat sq=value*value;\\nreturn sq*sq*value;\\n}\\nfloat getLuminance(vec3 color)\\n{\\nreturn clamp(dot(color,LuminanceEncodeApprox),0.,1.);\\n}\\n\\nfloat getRand(vec2 seed) {\\nreturn fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);\\n}\\nfloat dither(vec2 seed,float varianceAmount) {\\nfloat rand=getRand(seed);\\nfloat dither=mix(-varianceAmount/255.0,varianceAmount/255.0,rand);\\nreturn dither;\\n}\\n\\nconst float rgbdMaxRange=255.0;\\nvec4 toRGBD(vec3 color) {\\nfloat maxRGB=maxEps(max(color.r,max(color.g,color.b)));\\nfloat D=max(rgbdMaxRange/maxRGB,1.);\\nD=clamp(floor(D)/255.0,0.,1.);\\n\\nvec3 rgb=color.rgb*D;\\n\\nrgb=toGammaSpace(rgb);\\nreturn vec4(rgb,D);\\n}\\nvec3 fromRGBD(vec4 rgbd) {\\n\\nrgbd.rgb=toLinearSpace(rgbd.rgb);\\n\\nreturn rgbd.rgb/rgbd.a;\\n}\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var helperFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=helperFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'imageProcessingDeclaration';\r\nvar shader = \"#ifdef EXPOSURE\\nuniform float exposureLinear;\\n#endif\\n#ifdef CONTRAST\\nuniform float contrast;\\n#endif\\n#ifdef VIGNETTE\\nuniform vec2 vInverseScreenSize;\\nuniform vec4 vignetteSettings1;\\nuniform vec4 vignetteSettings2;\\n#endif\\n#ifdef COLORCURVES\\nuniform vec4 vCameraColorCurveNegative;\\nuniform vec4 vCameraColorCurveNeutral;\\nuniform vec4 vCameraColorCurvePositive;\\n#endif\\n#ifdef COLORGRADING\\n#ifdef COLORGRADING3D\\nuniform highp sampler3D txColorTransform;\\n#else\\nuniform sampler2D txColorTransform;\\n#endif\\nuniform vec4 colorTransformSettings;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var imageProcessingDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=imageProcessingDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'imageProcessingFunctions';\r\nvar shader = \"#if defined(COLORGRADING) && !defined(COLORGRADING3D)\\n\\n#define inline\\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\\n{\\nfloat sliceSize=2.0*sampler3dSetting.x;\\n#ifdef SAMPLER3DGREENDEPTH\\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\\n#else\\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\\n#endif\\nfloat sliceInteger=floor(sliceContinuous);\\n\\n\\nfloat sliceFraction=sliceContinuous-sliceInteger;\\n#ifdef SAMPLER3DGREENDEPTH\\nvec2 sliceUV=color.rb;\\n#else\\nvec2 sliceUV=color.rg;\\n#endif\\nsliceUV.x*=sliceSize;\\nsliceUV.x+=sliceInteger*sliceSize;\\nsliceUV=saturate(sliceUV);\\nvec4 slice0Color=texture2D(colorTransform,sliceUV);\\nsliceUV.x+=sliceSize;\\nsliceUV=saturate(sliceUV);\\nvec4 slice1Color=texture2D(colorTransform,sliceUV);\\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\\n#ifdef SAMPLER3DBGRMAP\\ncolor.rgb=result.rgb;\\n#else\\ncolor.rgb=result.bgr;\\n#endif\\nreturn color;\\n}\\n#endif\\n#ifdef TONEMAPPING_ACES\\n\\n\\n\\n\\n\\nconst mat3 ACESInputMat=mat3(\\nvec3(0.59719,0.07600,0.02840),\\nvec3(0.35458,0.90834,0.13383),\\nvec3(0.04823,0.01566,0.83777)\\n);\\n\\nconst mat3 ACESOutputMat=mat3(\\nvec3( 1.60475,-0.10208,-0.00327),\\nvec3(-0.53108,1.10813,-0.07276),\\nvec3(-0.07367,-0.00605,1.07602)\\n);\\nvec3 RRTAndODTFit(vec3 v)\\n{\\nvec3 a=v*(v+0.0245786)-0.000090537;\\nvec3 b=v*(0.983729*v+0.4329510)+0.238081;\\nreturn a/b;\\n}\\nvec3 ACESFitted(vec3 color)\\n{\\ncolor=ACESInputMat*color;\\n\\ncolor=RRTAndODTFit(color);\\ncolor=ACESOutputMat*color;\\n\\ncolor=saturate(color);\\nreturn color;\\n}\\n#endif\\nvec4 applyImageProcessing(vec4 result) {\\n#ifdef EXPOSURE\\nresult.rgb*=exposureLinear;\\n#endif\\n#ifdef VIGNETTE\\n\\nvec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;\\nviewportXY=viewportXY*2.0-1.0;\\nvec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);\\nfloat vignetteTerm=dot(vignetteXY1,vignetteXY1);\\nfloat vignette=pow(vignetteTerm,vignetteSettings2.w);\\n\\nvec3 vignetteColor=vignetteSettings2.rgb;\\n#ifdef VIGNETTEBLENDMODEMULTIPLY\\nvec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);\\nresult.rgb*=vignetteColorMultiplier;\\n#endif\\n#ifdef VIGNETTEBLENDMODEOPAQUE\\nresult.rgb=mix(vignetteColor,result.rgb,vignette);\\n#endif\\n#endif\\n#ifdef TONEMAPPING\\n#ifdef TONEMAPPING_ACES\\nresult.rgb=ACESFitted(result.rgb);\\n#else\\nconst float tonemappingCalibration=1.590579;\\nresult.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\\n#endif\\n#endif\\n\\nresult.rgb=toGammaSpace(result.rgb);\\nresult.rgb=saturate(result.rgb);\\n#ifdef CONTRAST\\n\\nvec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);\\nif (contrast<1.0) {\\n\\nresult.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);\\n} else {\\n\\nresult.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);\\n}\\n#endif\\n\\n#ifdef COLORGRADING\\nvec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;\\n#ifdef COLORGRADING3D\\nvec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;\\n#else\\nvec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;\\n#endif\\nresult.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);\\n#endif\\n#ifdef COLORCURVES\\n\\nfloat luma=getLuminance(result.rgb);\\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));\\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\\nresult.rgb*=colorCurve.rgb;\\nresult.rgb=mix(vec3(luma),result.rgb,colorCurve.a);\\n#endif\\nreturn result;\\n}\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var imageProcessingFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=imageProcessingFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'instancesDeclaration';\r\nvar shader = \"#ifdef INSTANCES\\nattribute vec4 world0;\\nattribute vec4 world1;\\nattribute vec4 world2;\\nattribute vec4 world3;\\n#ifdef THIN_INSTANCES\\nuniform mat4 world;\\n#endif\\n#else\\nuniform mat4 world;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var instancesDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=instancesDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'instancesVertex';\r\nvar shader = \"#ifdef INSTANCES\\nmat4 finalWorld=mat4(world0,world1,world2,world3);\\n#ifdef THIN_INSTANCES\\nfinalWorld=world*finalWorld;\\n#endif\\n#else\\nmat4 finalWorld=world;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var instancesVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=instancesVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'lightFragment';\r\nvar shader = \"#ifdef LIGHT{X}\\n#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\\n\\n#else\\n#ifdef PBR\\n\\n#ifdef SPOTLIGHT{X}\\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(POINTLIGHT{X})\\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(HEMILIGHT{X})\\npreInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(DIRLIGHT{X})\\npreInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#endif\\npreInfo.NdotV=NdotV;\\n\\n#ifdef SPOTLIGHT{X}\\n#ifdef LIGHT_FALLOFF_GLTF{X}\\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\\npreInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\\npreInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);\\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\\npreInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);\\n#else\\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\\npreInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\\n#endif\\n#elif defined(POINTLIGHT{X})\\n#ifdef LIGHT_FALLOFF_GLTF{X}\\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\\n#else\\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\\n#endif\\n#else\\npreInfo.attenuation=1.0;\\n#endif\\n\\n\\n#ifdef HEMILIGHT{X}\\npreInfo.roughness=roughness;\\n#else\\npreInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\\n#endif\\n\\n#ifdef HEMILIGHT{X}\\ninfo.diffuse=computeHemisphericDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb,light{X}.vLightGround);\\n#elif defined(SS_TRANSLUCENCY)\\ninfo.diffuse=computeDiffuseAndTransmittedLighting(preInfo,light{X}.vLightDiffuse.rgb,subSurfaceOut.transmittance);\\n#else\\ninfo.diffuse=computeDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb);\\n#endif\\n\\n#ifdef SPECULARTERM\\n#ifdef ANISOTROPIC\\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#else\\ninfo.specular=computeSpecularLighting(preInfo,normalW,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#endif\\n#endif\\n\\n#ifdef SHEEN\\n#ifdef SHEEN_LINKWITHALBEDO\\n\\npreInfo.roughness=sheenOut.sheenIntensity;\\n#else\\n#ifdef HEMILIGHT{X}\\npreInfo.roughness=sheenOut.sheenRoughness;\\n#else\\npreInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\\n#endif\\n#endif\\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#endif\\n\\n#ifdef CLEARCOAT\\n\\n#ifdef HEMILIGHT{X}\\npreInfo.roughness=clearcoatOut.clearCoatRoughness;\\n#else\\npreInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\\n#endif\\ninfo.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,light{X}.vLightDiffuse.rgb);\\n#ifdef CLEARCOAT_TINT\\n\\nabsorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);\\ninfo.diffuse*=absorption;\\n#ifdef SPECULARTERM\\ninfo.specular*=absorption;\\n#endif\\n#endif\\n\\ninfo.diffuse*=info.clearCoat.w;\\n#ifdef SPECULARTERM\\ninfo.specular*=info.clearCoat.w;\\n#endif\\n#ifdef SHEEN\\ninfo.sheen*=info.clearCoat.w;\\n#endif\\n#endif\\n#else\\n#ifdef SPOTLIGHT{X}\\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\\n#elif defined(HEMILIGHT{X})\\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness);\\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\\n#endif\\n#endif\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightSampler{X},textureProjectionMatrix{X});\\n#endif\\n#endif\\n#ifdef SHADOW{X}\\n#ifdef SHADOWCSM{X}\\nfor (int i=0; i=0.) {\\nindex{X}=i;\\nbreak;\\n}\\n}\\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\\nif (index{X}>=0)\\n#endif\\n{\\n#if defined(SHADOWPCF{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nshadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCSS{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#else\\nshadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#endif\\n#else\\nshadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#ifdef SHADOWCSMDEBUG{X}\\nshadowDebug{X}=vec3(shadow)*vCascadeColorsMultiplier{X}[index{X}];\\n#endif\\n#ifndef SHADOWCSMNOBLEND{X}\\nfloat frustumLength=frustumLengths{X}[index{X}];\\nfloat diffRatio=clamp(diff{X}/frustumLength,0.,1.)*cascadeBlendFactor{X};\\nif (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.)\\n{\\nindex{X}+=1;\\nfloat nextShadow=0.;\\n#if defined(SHADOWPCF{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nnextShadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nnextShadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nnextShadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCSS{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nnextShadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nnextShadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#else\\nnextShadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#endif\\n#else\\nnextShadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\nshadow=mix(nextShadow,shadow,diffRatio);\\n#ifdef SHADOWCSMDEBUG{X}\\nshadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio);\\n#endif\\n}\\n#endif\\n}\\n#elif defined(SHADOWCLOSEESM{X})\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithCloseESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWESM{X})\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPOISSON{X})\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithPoissonSamplingCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCF{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCSS{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#else\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.depthValues);\\n#else\\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#endif\\n#ifdef SHADOWONLY\\n#ifndef SHADOWINUSE\\n#define SHADOWINUSE\\n#endif\\nglobalShadow+=shadow;\\nshadowLightCount+=1.0;\\n#endif\\n#else\\nshadow=1.;\\n#endif\\n#ifndef SHADOWONLY\\n#ifdef CUSTOMUSERLIGHTING\\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\\n#ifdef SPECULARTERM\\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\\n#endif\\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\\ndiffuseBase+=lightmapColor.rgb*shadow;\\n#ifdef SPECULARTERM\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\\n#endif\\n#endif\\n#ifdef CLEARCOAT\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\\n#endif\\n#endif\\n#ifdef SHEEN\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nsheenBase+=info.sheen.rgb*shadow;\\n#endif\\n#endif\\n#else\\n#ifdef SHADOWCSMDEBUG{X}\\ndiffuseBase+=info.diffuse*shadowDebug{X};\\n#else\\ndiffuseBase+=info.diffuse*shadow;\\n#endif\\n#ifdef SPECULARTERM\\nspecularBase+=info.specular*shadow;\\n#endif\\n#ifdef CLEARCOAT\\nclearCoatBase+=info.clearCoat.rgb*shadow;\\n#endif\\n#ifdef SHEEN\\nsheenBase+=info.sheen.rgb*shadow;\\n#endif\\n#endif\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var lightFragment = { name: name, shader: shader };\r\n//# sourceMappingURL=lightFragment.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'lightFragmentDeclaration';\r\nvar shader = \"#ifdef LIGHT{X}\\nuniform vec4 vLightData{X};\\nuniform vec4 vLightDiffuse{X};\\n#ifdef SPECULARTERM\\nuniform vec4 vLightSpecular{X};\\n#else\\nvec4 vLightSpecular{X}=vec4(0.);\\n#endif\\n#ifdef SHADOW{X}\\n#ifdef SHADOWCSM{X}\\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float cascadeBlendFactor{X};\\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying vec4 vPositionFromCamera{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DArrayShadow shadowSampler{X};\\nuniform highp sampler2DArray depthSampler{X};\\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float penumbraDarkness{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DArrayShadow shadowSampler{X};\\n#else\\nuniform highp sampler2DArray shadowSampler{X};\\n#endif\\n#ifdef SHADOWCSMDEBUG{X}\\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\\n(\\nvec3 ( 1.5,0.0,0.0 ),\\nvec3 ( 0.0,1.5,0.0 ),\\nvec3 ( 0.0,0.0,5.5 ),\\nvec3 ( 1.5,0.0,5.5 ),\\nvec3 ( 1.5,1.5,0.0 ),\\nvec3 ( 1.0,1.0,1.0 ),\\nvec3 ( 0.0,1.0,5.5 ),\\nvec3 ( 0.5,3.5,0.75 )\\n);\\nvec3 shadowDebug{X};\\n#endif\\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\\nint index{X}=-1;\\n#else\\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\\n#endif\\nfloat diff{X}=0.;\\n#elif defined(SHADOWCUBE{X})\\nuniform samplerCube shadowSampler{X};\\n#else\\nvarying vec4 vPositionFromLight{X};\\nvarying float vDepthMetric{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\nuniform highp sampler2D depthSampler{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\n#else\\nuniform sampler2D shadowSampler{X};\\n#endif\\nuniform mat4 lightMatrix{X};\\n#endif\\nuniform vec4 shadowsInfo{X};\\nuniform vec2 depthValues{X};\\n#endif\\n#ifdef SPOTLIGHT{X}\\nuniform vec4 vLightDirection{X};\\nuniform vec4 vLightFalloff{X};\\n#elif defined(POINTLIGHT{X})\\nuniform vec4 vLightFalloff{X};\\n#elif defined(HEMILIGHT{X})\\nuniform vec3 vLightGround{X};\\n#endif\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\nuniform mat4 textureProjectionMatrix{X};\\nuniform sampler2D projectionLightSampler{X};\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var lightFragmentDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=lightFragmentDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'lightUboDeclaration';\r\nvar shader = \"#ifdef LIGHT{X}\\nuniform Light{X}\\n{\\nvec4 vLightData;\\nvec4 vLightDiffuse;\\nvec4 vLightSpecular;\\n#ifdef SPOTLIGHT{X}\\nvec4 vLightDirection;\\nvec4 vLightFalloff;\\n#elif defined(POINTLIGHT{X})\\nvec4 vLightFalloff;\\n#elif defined(HEMILIGHT{X})\\nvec3 vLightGround;\\n#endif\\nvec4 shadowsInfo;\\nvec2 depthValues;\\n} light{X};\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\nuniform mat4 textureProjectionMatrix{X};\\nuniform sampler2D projectionLightSampler{X};\\n#endif\\n#ifdef SHADOW{X}\\n#ifdef SHADOWCSM{X}\\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float cascadeBlendFactor{X};\\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying vec4 vPositionFromCamera{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DArrayShadow shadowSampler{X};\\nuniform highp sampler2DArray depthSampler{X};\\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float penumbraDarkness{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DArrayShadow shadowSampler{X};\\n#else\\nuniform highp sampler2DArray shadowSampler{X};\\n#endif\\n#ifdef SHADOWCSMDEBUG{X}\\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\\n(\\nvec3 ( 1.5,0.0,0.0 ),\\nvec3 ( 0.0,1.5,0.0 ),\\nvec3 ( 0.0,0.0,5.5 ),\\nvec3 ( 1.5,0.0,5.5 ),\\nvec3 ( 1.5,1.5,0.0 ),\\nvec3 ( 1.0,1.0,1.0 ),\\nvec3 ( 0.0,1.0,5.5 ),\\nvec3 ( 0.5,3.5,0.75 )\\n);\\nvec3 shadowDebug{X};\\n#endif\\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\\nint index{X}=-1;\\n#else\\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\\n#endif\\nfloat diff{X}=0.;\\n#elif defined(SHADOWCUBE{X})\\nuniform samplerCube shadowSampler{X};\\n#else\\nvarying vec4 vPositionFromLight{X};\\nvarying float vDepthMetric{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\nuniform highp sampler2D depthSampler{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\n#else\\nuniform sampler2D shadowSampler{X};\\n#endif\\nuniform mat4 lightMatrix{X};\\n#endif\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var lightUboDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=lightUboDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'logDepthDeclaration';\r\nvar shader = \"#ifdef LOGARITHMICDEPTH\\nuniform float logarithmicDepthConstant;\\nvarying float vFragmentDepth;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var logDepthDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=logDepthDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'logDepthFragment';\r\nvar shader = \"#ifdef LOGARITHMICDEPTH\\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var logDepthFragment = { name: name, shader: shader };\r\n//# sourceMappingURL=logDepthFragment.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'logDepthVertex';\r\nvar shader = \"#ifdef LOGARITHMICDEPTH\\nvFragmentDepth=1.0+gl_Position.w;\\ngl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var logDepthVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=logDepthVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'morphTargetsVertex';\r\nvar shader = \"#ifdef MORPHTARGETS\\npositionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];\\n#ifdef MORPHTARGETS_NORMAL\\nnormalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];\\n#endif\\n#ifdef MORPHTARGETS_TANGENT\\ntangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];\\n#endif\\n#ifdef MORPHTARGETS_UV\\nuvUpdated+=(uv_{X}-uv)*morphTargetInfluences[{X}];\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var morphTargetsVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=morphTargetsVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'morphTargetsVertexDeclaration';\r\nvar shader = \"#ifdef MORPHTARGETS\\nattribute vec3 position{X};\\n#ifdef MORPHTARGETS_NORMAL\\nattribute vec3 normal{X};\\n#endif\\n#ifdef MORPHTARGETS_TANGENT\\nattribute vec3 tangent{X};\\n#endif\\n#ifdef MORPHTARGETS_UV\\nattribute vec2 uv_{X};\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var morphTargetsVertexDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=morphTargetsVertexDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'morphTargetsVertexGlobalDeclaration';\r\nvar shader = \"#ifdef MORPHTARGETS\\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var morphTargetsVertexGlobalDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=morphTargetsVertexGlobalDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'prePassDeclaration';\r\nvar shader = \"#ifdef PREPASS\\n#extension GL_EXT_draw_buffers : require\\n#ifdef WEBGL2\\nlayout(location=0) out highp vec4 glFragData[{X}];\\nhighp vec4 gl_FragColor;\\n#endif\\n#ifdef PREPASS_DEPTHNORMAL\\nvarying highp vec3 vViewPos;\\n#endif\\n#ifdef PREPASS_VELOCITY\\nvarying highp vec4 vCurrentPosition;\\nvarying highp vec4 vPreviousPosition;\\n#endif\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var prePassDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=prePassDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'prePassVertex';\r\nvar shader = \"#ifdef PREPASS_DEPTHNORMAL\\nvViewPos=(view*worldPos).rgb;\\n#endif\\n#if defined(PREPASS_VELOCITY) && defined(BONES_VELOCITY_ENABLED)\\nvCurrentPosition=viewProjection*worldPos;\\n#if NUM_BONE_INFLUENCERS>0\\nmat4 previousInfluence;\\npreviousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\\n#endif\\nvPreviousPosition=previousViewProjection*previousWorld*previousInfluence*vec4(positionUpdated,1.0);\\n#else\\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var prePassVertex = { name: name, shader: shader };\r\n//# sourceMappingURL=prePassVertex.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'prePassVertexDeclaration';\r\nvar shader = \"#ifdef PREPASS\\n#ifdef PREPASS_DEPTHNORMAL\\nvarying vec3 vViewPos;\\n#endif\\n#ifdef PREPASS_VELOCITY\\nuniform mat4 previousWorld;\\nuniform mat4 previousViewProjection;\\nvarying vec4 vCurrentPosition;\\nvarying vec4 vPreviousPosition;\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var prePassVertexDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=prePassVertexDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'reflectionFunction';\r\nvar shader = \"vec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {\\n\\nvec3 invOrigVec=vec3(1.0,1.0,1.0)/origVec;\\nvec3 halfSize=cubeSize*0.5;\\nvec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;\\nvec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;\\n\\nvec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);\\n\\nfloat distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);\\n\\nvec3 intersectPositionWS=vertexPos+origVec*distance;\\n\\nreturn intersectPositionWS-cubePos;\\n}\\nvec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\\n{\\nfloat lon=atan(direction.z,direction.x);\\nfloat lat=acos(direction.y);\\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\\nfloat s=sphereCoords.x*0.5+0.5;\\nfloat t=sphereCoords.y;\\nreturn vec3(s,t,0);\\n}\\nvec3 computeMirroredFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\\n{\\nfloat lon=atan(direction.z,direction.x);\\nfloat lat=acos(direction.y);\\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\\nfloat s=sphereCoords.x*0.5+0.5;\\nfloat t=sphereCoords.y;\\nreturn vec3(1.0-s,t,0);\\n}\\nvec3 computeEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\\n{\\nvec3 cameraToVertex=normalize(worldPos.xyz-eyePosition);\\nvec3 r=normalize(reflect(cameraToVertex,worldNormal));\\nr=vec3(reflectionMatrix*vec4(r,0));\\nfloat lon=atan(r.z,r.x);\\nfloat lat=acos(r.y);\\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\\nfloat s=sphereCoords.x*0.5+0.5;\\nfloat t=sphereCoords.y;\\nreturn vec3(s,t,0);\\n}\\nvec3 computeSphericalCoords(vec4 worldPos,vec3 worldNormal,mat4 view,mat4 reflectionMatrix)\\n{\\nvec3 viewDir=normalize(vec3(view*worldPos));\\nvec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));\\nvec3 r=reflect(viewDir,viewNormal);\\nr=vec3(reflectionMatrix*vec4(r,0));\\nr.z=r.z-1.0;\\nfloat m=2.0*length(r);\\nreturn vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);\\n}\\nvec3 computePlanarCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\\n{\\nvec3 viewDir=worldPos.xyz-eyePosition;\\nvec3 coords=normalize(reflect(viewDir,worldNormal));\\nreturn vec3(reflectionMatrix*vec4(coords,1));\\n}\\nvec3 computeCubicCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\\n{\\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\\n\\nvec3 coords=reflect(viewDir,worldNormal);\\ncoords=vec3(reflectionMatrix*vec4(coords,0));\\n#ifdef INVERTCUBICMAP\\ncoords.y*=-1.0;\\n#endif\\nreturn coords;\\n}\\nvec3 computeCubicLocalCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix,vec3 reflectionSize,vec3 reflectionPosition)\\n{\\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\\n\\nvec3 coords=reflect(viewDir,worldNormal);\\ncoords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);\\ncoords=vec3(reflectionMatrix*vec4(coords,0));\\n#ifdef INVERTCUBICMAP\\ncoords.y*=-1.0;\\n#endif\\nreturn coords;\\n}\\nvec3 computeProjectionCoords(vec4 worldPos,mat4 view,mat4 reflectionMatrix)\\n{\\nreturn vec3(reflectionMatrix*(view*worldPos));\\n}\\nvec3 computeSkyBoxCoords(vec3 positionW,mat4 reflectionMatrix)\\n{\\nreturn vec3(reflectionMatrix*vec4(positionW,1.));\\n}\\n#ifdef REFLECTION\\nvec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)\\n{\\n#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\\nvec3 direction=normalize(vDirectionW);\\nreturn computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction);\\n#endif\\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\\nvec3 direction=normalize(vDirectionW);\\nreturn computeFixedEquirectangularCoords(worldPos,worldNormal,direction);\\n#endif\\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\\nreturn computeEquirectangularCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_SPHERICAL\\nreturn computeSphericalCoords(worldPos,worldNormal,view,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_PLANAR\\nreturn computePlanarCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_CUBIC\\n#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC\\nreturn computeCubicLocalCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix,vReflectionSize,vReflectionPosition);\\n#else\\nreturn computeCubicCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\\n#endif\\n#endif\\n#ifdef REFLECTIONMAP_PROJECTION\\nreturn computeProjectionCoords(worldPos,view,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_SKYBOX\\nreturn computeSkyBoxCoords(vPositionUVW,reflectionMatrix);\\n#endif\\n#ifdef REFLECTIONMAP_EXPLICIT\\nreturn vec3(0,0,0);\\n#endif\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var reflectionFunction = { name: name, shader: shader };\r\n//# sourceMappingURL=reflectionFunction.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'shadowsFragmentFunctions';\r\nvar shader = \"#ifdef SHADOWS\\n#ifndef SHADOWFLOAT\\n\\nfloat unpack(vec4 color)\\n{\\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\\nreturn dot(color,bit_shift);\\n}\\n#endif\\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\\n{\\nfloat mask=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));\\nreturn mix(value,1.0,mask);\\n}\\n#define inline\\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\\n{\\nvec3 directionToLight=vPositionW-lightPosition;\\nfloat depth=length(directionToLight);\\ndepth=(depth+depthValues.x)/(depthValues.y);\\ndepth=clamp(depth,0.,1.0);\\ndirectionToLight=normalize(directionToLight);\\ndirectionToLight.y=-directionToLight.y;\\n#ifndef SHADOWFLOAT\\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\\n#else\\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\\n#endif\\nreturn depth>shadow ? darkness : 1.0;\\n}\\n#define inline\\nfloat computeShadowWithPoissonSamplingCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\\n{\\nvec3 directionToLight=vPositionW-lightPosition;\\nfloat depth=length(directionToLight);\\ndepth=(depth+depthValues.x)/(depthValues.y);\\ndepth=clamp(depth,0.,1.0);\\ndirectionToLight=normalize(directionToLight);\\ndirectionToLight.y=-directionToLight.y;\\nfloat visibility=1.;\\nvec3 poissonDisk[4];\\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\\n\\n#ifndef SHADOWFLOAT\\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;\\n}\\n#endif\\n#define inline\\nfloat computeShadow(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nelse\\n{\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\n#ifndef SHADOWFLOAT\\nfloat shadow=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadow=texture2D(shadowSampler,uv).x;\\n#endif\\nreturn shadowPixelDepth>shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;\\n}\\n}\\n#define inline\\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nelse\\n{\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\nfloat visibility=1.;\\nvec2 poissonDisk[4];\\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\\npoissonDisk[3]=vec2(0.34495938,0.29387760);\\n\\n#ifndef SHADOWFLOAT\\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nelse\\n{\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\n#ifndef SHADOWFLOAT\\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\\n#endif\\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);\\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\n#define inline\\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nelse\\n{\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\n#ifndef SHADOWFLOAT\\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\\n#endif\\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\n#ifdef WEBGL2\\n#define GREATEST_LESS_THAN_ONE 0.99999994\\n\\n#define inline\\nfloat computeShadowWithCSMPCF1(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);\\nfloat shadow=texture(shadowSampler,uvDepthLayer);\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n\\n\\n\\n#define inline\\nfloat computeShadowWithCSMPCF3(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\\nuv+=0.5;\\nvec2 st=fract(uv);\\nvec2 base_uv=floor(uv)-0.5;\\nbase_uv*=shadowMapSizeAndInverse.y;\\n\\n\\n\\n\\nvec2 uvw0=3.-2.*st;\\nvec2 uvw1=1.+2.*st;\\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));\\nshadow=shadow/16.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n\\n\\n\\n#define inline\\nfloat computeShadowWithCSMPCF5(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\\nuv+=0.5;\\nvec2 st=fract(uv);\\nvec2 base_uv=floor(uv)-0.5;\\nbase_uv*=shadowMapSizeAndInverse.y;\\n\\n\\nvec2 uvw0=4.-3.*st;\\nvec2 uvw1=vec2(7.);\\nvec2 uvw2=1.+3.*st;\\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));\\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[0]),layer,uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));\\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[1]),layer,uvDepth.z));\\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[2]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[2]),layer,uvDepth.z));\\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[2]),layer,uvDepth.z));\\nshadow=shadow/144.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n\\n#define inline\\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nelse\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nfloat shadow=texture2D(shadowSampler,uvDepth);\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\n\\n\\n\\n#define inline\\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nelse\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\\nuv+=0.5;\\nvec2 st=fract(uv);\\nvec2 base_uv=floor(uv)-0.5;\\nbase_uv*=shadowMapSizeAndInverse.y;\\n\\n\\n\\n\\nvec2 uvw0=3.-2.*st;\\nvec2 uvw1=1.+2.*st;\\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\\nshadow=shadow/16.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\n\\n\\n\\n#define inline\\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nelse\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x;\\nuv+=0.5;\\nvec2 st=fract(uv);\\nvec2 base_uv=floor(uv)-0.5;\\nbase_uv*=shadowMapSizeAndInverse.y;\\n\\n\\nvec2 uvw0=4.-3.*st;\\nvec2 uvw1=vec2(7.);\\nvec2 uvw2=1.+3.*st;\\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z));\\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z));\\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z));\\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z));\\nshadow=shadow/144.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\nconst vec3 PoissonSamplers32[64]=vec3[64](\\nvec3(0.06407013,0.05409927,0.),\\nvec3(0.7366577,0.5789394,0.),\\nvec3(-0.6270542,-0.5320278,0.),\\nvec3(-0.4096107,0.8411095,0.),\\nvec3(0.6849564,-0.4990818,0.),\\nvec3(-0.874181,-0.04579735,0.),\\nvec3(0.9989998,0.0009880066,0.),\\nvec3(-0.004920578,-0.9151649,0.),\\nvec3(0.1805763,0.9747483,0.),\\nvec3(-0.2138451,0.2635818,0.),\\nvec3(0.109845,0.3884785,0.),\\nvec3(0.06876755,-0.3581074,0.),\\nvec3(0.374073,-0.7661266,0.),\\nvec3(0.3079132,-0.1216763,0.),\\nvec3(-0.3794335,-0.8271583,0.),\\nvec3(-0.203878,-0.07715034,0.),\\nvec3(0.5912697,0.1469799,0.),\\nvec3(-0.88069,0.3031784,0.),\\nvec3(0.5040108,0.8283722,0.),\\nvec3(-0.5844124,0.5494877,0.),\\nvec3(0.6017799,-0.1726654,0.),\\nvec3(-0.5554981,0.1559997,0.),\\nvec3(-0.3016369,-0.3900928,0.),\\nvec3(-0.5550632,-0.1723762,0.),\\nvec3(0.925029,0.2995041,0.),\\nvec3(-0.2473137,0.5538505,0.),\\nvec3(0.9183037,-0.2862392,0.),\\nvec3(0.2469421,0.6718712,0.),\\nvec3(0.3916397,-0.4328209,0.),\\nvec3(-0.03576927,-0.6220032,0.),\\nvec3(-0.04661255,0.7995201,0.),\\nvec3(0.4402924,0.3640312,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.)\\n);\\nconst vec3 PoissonSamplers64[64]=vec3[64](\\nvec3(-0.613392,0.617481,0.),\\nvec3(0.170019,-0.040254,0.),\\nvec3(-0.299417,0.791925,0.),\\nvec3(0.645680,0.493210,0.),\\nvec3(-0.651784,0.717887,0.),\\nvec3(0.421003,0.027070,0.),\\nvec3(-0.817194,-0.271096,0.),\\nvec3(-0.705374,-0.668203,0.),\\nvec3(0.977050,-0.108615,0.),\\nvec3(0.063326,0.142369,0.),\\nvec3(0.203528,0.214331,0.),\\nvec3(-0.667531,0.326090,0.),\\nvec3(-0.098422,-0.295755,0.),\\nvec3(-0.885922,0.215369,0.),\\nvec3(0.566637,0.605213,0.),\\nvec3(0.039766,-0.396100,0.),\\nvec3(0.751946,0.453352,0.),\\nvec3(0.078707,-0.715323,0.),\\nvec3(-0.075838,-0.529344,0.),\\nvec3(0.724479,-0.580798,0.),\\nvec3(0.222999,-0.215125,0.),\\nvec3(-0.467574,-0.405438,0.),\\nvec3(-0.248268,-0.814753,0.),\\nvec3(0.354411,-0.887570,0.),\\nvec3(0.175817,0.382366,0.),\\nvec3(0.487472,-0.063082,0.),\\nvec3(-0.084078,0.898312,0.),\\nvec3(0.488876,-0.783441,0.),\\nvec3(0.470016,0.217933,0.),\\nvec3(-0.696890,-0.549791,0.),\\nvec3(-0.149693,0.605762,0.),\\nvec3(0.034211,0.979980,0.),\\nvec3(0.503098,-0.308878,0.),\\nvec3(-0.016205,-0.872921,0.),\\nvec3(0.385784,-0.393902,0.),\\nvec3(-0.146886,-0.859249,0.),\\nvec3(0.643361,0.164098,0.),\\nvec3(0.634388,-0.049471,0.),\\nvec3(-0.688894,0.007843,0.),\\nvec3(0.464034,-0.188818,0.),\\nvec3(-0.440840,0.137486,0.),\\nvec3(0.364483,0.511704,0.),\\nvec3(0.034028,0.325968,0.),\\nvec3(0.099094,-0.308023,0.),\\nvec3(0.693960,-0.366253,0.),\\nvec3(0.678884,-0.204688,0.),\\nvec3(0.001801,0.780328,0.),\\nvec3(0.145177,-0.898984,0.),\\nvec3(0.062655,-0.611866,0.),\\nvec3(0.315226,-0.604297,0.),\\nvec3(-0.780145,0.486251,0.),\\nvec3(-0.371868,0.882138,0.),\\nvec3(0.200476,0.494430,0.),\\nvec3(-0.494552,-0.711051,0.),\\nvec3(0.612476,0.705252,0.),\\nvec3(-0.578845,-0.768792,0.),\\nvec3(-0.772454,-0.090976,0.),\\nvec3(0.504440,0.372295,0.),\\nvec3(0.155736,0.065157,0.),\\nvec3(0.391522,0.849605,0.),\\nvec3(-0.620106,-0.328104,0.),\\nvec3(0.789239,-0.419965,0.),\\nvec3(-0.545396,0.538133,0.),\\nvec3(-0.178564,-0.596057,0.)\\n);\\n\\n\\n\\n\\n\\n#define inline\\nfloat computeShadowWithCSMPCSS(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=clamp(uvDepth.z,0.,GREATEST_LESS_THAN_ONE);\\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);\\nfloat blockerDepth=0.0;\\nfloat sumBlockerDepth=0.0;\\nfloat numBlocker=0.0;\\nfor (int i=0; i1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nelse\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nfloat blockerDepth=0.0;\\nfloat sumBlockerDepth=0.0;\\nfloat numBlocker=0.0;\\nfor (int i=0; i= 1 && t_int <= 7) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Does exist one action manager that handles actions of a given trigger\r\n * @param trigger defines the trigger to be tested\r\n * @return a boolean indicating whether the trigger is handeled by at least one action manager\r\n **/\r\n AbstractActionManager.HasSpecificTrigger = function (trigger) {\r\n for (var t in AbstractActionManager.Triggers) {\r\n if (AbstractActionManager.Triggers.hasOwnProperty(t)) {\r\n var t_int = parseInt(t);\r\n if (t_int === trigger) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n /** Gets the list of active triggers */\r\n AbstractActionManager.Triggers = {};\r\n return AbstractActionManager;\r\n}());\r\nexport { AbstractActionManager };\r\n//# sourceMappingURL=abstractActionManager.js.map","import { PointerInfoPre, PointerInfo, PointerEventTypes } from \"../Events/pointerEvents\";\r\nimport { AbstractActionManager } from \"../Actions/abstractActionManager\";\r\nimport { Vector2, Matrix } from \"../Maths/math.vector\";\r\nimport { ActionEvent } from \"../Actions/actionEvent\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { KeyboardEventTypes, KeyboardInfoPre, KeyboardInfo } from \"../Events/keyboardEvents\";\r\n/** @hidden */\r\nvar _ClickInfo = /** @class */ (function () {\r\n function _ClickInfo() {\r\n this._singleClick = false;\r\n this._doubleClick = false;\r\n this._hasSwiped = false;\r\n this._ignore = false;\r\n }\r\n Object.defineProperty(_ClickInfo.prototype, \"singleClick\", {\r\n get: function () {\r\n return this._singleClick;\r\n },\r\n set: function (b) {\r\n this._singleClick = b;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ClickInfo.prototype, \"doubleClick\", {\r\n get: function () {\r\n return this._doubleClick;\r\n },\r\n set: function (b) {\r\n this._doubleClick = b;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ClickInfo.prototype, \"hasSwiped\", {\r\n get: function () {\r\n return this._hasSwiped;\r\n },\r\n set: function (b) {\r\n this._hasSwiped = b;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ClickInfo.prototype, \"ignore\", {\r\n get: function () {\r\n return this._ignore;\r\n },\r\n set: function (b) {\r\n this._ignore = b;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return _ClickInfo;\r\n}());\r\n/**\r\n * Class used to manage all inputs for the scene.\r\n */\r\nvar InputManager = /** @class */ (function () {\r\n /**\r\n * Creates a new InputManager\r\n * @param scene defines the hosting scene\r\n */\r\n function InputManager(scene) {\r\n /** This is a defensive check to not allow control attachment prior to an already active one. If already attached, previous control is unattached before attaching the new one. */\r\n this._alreadyAttached = false;\r\n // Pointers\r\n this._wheelEventName = \"\";\r\n this._meshPickProceed = false;\r\n this._currentPickResult = null;\r\n this._previousPickResult = null;\r\n this._totalPointersPressed = 0;\r\n this._doubleClickOccured = false;\r\n this._pointerX = 0;\r\n this._pointerY = 0;\r\n this._startingPointerPosition = new Vector2(0, 0);\r\n this._previousStartingPointerPosition = new Vector2(0, 0);\r\n this._startingPointerTime = 0;\r\n this._previousStartingPointerTime = 0;\r\n this._pointerCaptures = {};\r\n this._meshUnderPointerId = [];\r\n this._keyboardIsAttached = false;\r\n this._scene = scene;\r\n }\r\n Object.defineProperty(InputManager.prototype, \"meshUnderPointer\", {\r\n /**\r\n * Gets the mesh that is currently under the pointer\r\n */\r\n get: function () {\r\n return this._pointerOverMesh;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * When using more than one pointer (for example in XR) you can get the mesh under the specific pointer\r\n * @param pointerId the pointer id to use\r\n * @returns The mesh under this pointer id or null if not found\r\n */\r\n InputManager.prototype.getMeshUnderPointerByPointerId = function (pointerId) {\r\n return this._meshUnderPointerId[pointerId];\r\n };\r\n Object.defineProperty(InputManager.prototype, \"unTranslatedPointer\", {\r\n /**\r\n * Gets the pointer coordinates in 2D without any translation (ie. straight out of the pointer event)\r\n */\r\n get: function () {\r\n return new Vector2(this._unTranslatedPointerX, this._unTranslatedPointerY);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputManager.prototype, \"pointerX\", {\r\n /**\r\n * Gets or sets the current on-screen X position of the pointer\r\n */\r\n get: function () {\r\n return this._pointerX;\r\n },\r\n set: function (value) {\r\n this._pointerX = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputManager.prototype, \"pointerY\", {\r\n /**\r\n * Gets or sets the current on-screen Y position of the pointer\r\n */\r\n get: function () {\r\n return this._pointerY;\r\n },\r\n set: function (value) {\r\n this._pointerY = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n InputManager.prototype._updatePointerPosition = function (evt) {\r\n var canvasRect = this._scene.getEngine().getInputElementClientRect();\r\n if (!canvasRect) {\r\n return;\r\n }\r\n this._pointerX = evt.clientX - canvasRect.left;\r\n this._pointerY = evt.clientY - canvasRect.top;\r\n this._unTranslatedPointerX = this._pointerX;\r\n this._unTranslatedPointerY = this._pointerY;\r\n };\r\n InputManager.prototype._processPointerMove = function (pickResult, evt) {\r\n var scene = this._scene;\r\n var engine = scene.getEngine();\r\n var canvas = engine.getInputElement();\r\n if (!canvas) {\r\n return;\r\n }\r\n canvas.tabIndex = engine.canvasTabIndex;\r\n // Restore pointer\r\n if (!scene.doNotHandleCursors) {\r\n canvas.style.cursor = scene.defaultCursor;\r\n }\r\n var isMeshPicked = pickResult && pickResult.hit && pickResult.pickedMesh ? true : false;\r\n if (isMeshPicked) {\r\n scene.setPointerOverMesh(pickResult.pickedMesh, evt.pointerId);\r\n if (this._pointerOverMesh && this._pointerOverMesh.actionManager && this._pointerOverMesh.actionManager.hasPointerTriggers) {\r\n if (!scene.doNotHandleCursors) {\r\n if (this._pointerOverMesh.actionManager.hoverCursor) {\r\n canvas.style.cursor = this._pointerOverMesh.actionManager.hoverCursor;\r\n }\r\n else {\r\n canvas.style.cursor = scene.hoverCursor;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n scene.setPointerOverMesh(null, evt.pointerId);\r\n }\r\n for (var _i = 0, _a = scene._pointerMoveStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, isMeshPicked, canvas);\r\n }\r\n if (pickResult) {\r\n var type = evt.type === this._wheelEventName ? PointerEventTypes.POINTERWHEEL : PointerEventTypes.POINTERMOVE;\r\n if (scene.onPointerMove) {\r\n scene.onPointerMove(evt, pickResult, type);\r\n }\r\n if (scene.onPointerObservable.hasObservers()) {\r\n var pi = new PointerInfo(type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n };\r\n // Pointers handling\r\n InputManager.prototype._setRayOnPointerInfo = function (pointerInfo) {\r\n var scene = this._scene;\r\n if (pointerInfo.pickInfo && !pointerInfo.pickInfo._pickingUnavailable) {\r\n if (!pointerInfo.pickInfo.ray) {\r\n pointerInfo.pickInfo.ray = scene.createPickingRay(pointerInfo.event.offsetX, pointerInfo.event.offsetY, Matrix.Identity(), scene.activeCamera);\r\n }\r\n }\r\n };\r\n InputManager.prototype._checkPrePointerObservable = function (pickResult, evt, type) {\r\n var scene = this._scene;\r\n var pi = new PointerInfoPre(type, evt, this._unTranslatedPointerX, this._unTranslatedPointerY);\r\n if (pickResult) {\r\n pi.ray = pickResult.ray;\r\n }\r\n scene.onPrePointerObservable.notifyObservers(pi, type);\r\n if (pi.skipOnPointerObservable) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Use this method to simulate a pointer move on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n */\r\n InputManager.prototype.simulatePointerMove = function (pickResult, pointerEventInit) {\r\n var evt = new PointerEvent(\"pointermove\", pointerEventInit);\r\n if (this._checkPrePointerObservable(pickResult, evt, PointerEventTypes.POINTERMOVE)) {\r\n return;\r\n }\r\n this._processPointerMove(pickResult, evt);\r\n };\r\n /**\r\n * Use this method to simulate a pointer down on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n */\r\n InputManager.prototype.simulatePointerDown = function (pickResult, pointerEventInit) {\r\n var evt = new PointerEvent(\"pointerdown\", pointerEventInit);\r\n if (this._checkPrePointerObservable(pickResult, evt, PointerEventTypes.POINTERDOWN)) {\r\n return;\r\n }\r\n this._processPointerDown(pickResult, evt);\r\n };\r\n InputManager.prototype._processPointerDown = function (pickResult, evt) {\r\n var _this = this;\r\n var scene = this._scene;\r\n if (pickResult && pickResult.hit && pickResult.pickedMesh) {\r\n this._pickedDownMesh = pickResult.pickedMesh;\r\n var actionManager = pickResult.pickedMesh._getActionManagerForTrigger();\r\n if (actionManager) {\r\n if (actionManager.hasPickTriggers) {\r\n actionManager.processTrigger(5, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n switch (evt.button) {\r\n case 0:\r\n actionManager.processTrigger(2, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n break;\r\n case 1:\r\n actionManager.processTrigger(4, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n break;\r\n case 2:\r\n actionManager.processTrigger(3, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n break;\r\n }\r\n }\r\n if (actionManager.hasSpecificTrigger(8)) {\r\n window.setTimeout(function () {\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, function (mesh) { return (mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.actionManager && mesh.actionManager.hasSpecificTrigger(8) && mesh == _this._pickedDownMesh); }, false, scene.cameraToUseForPointers);\r\n if (pickResult && pickResult.hit && pickResult.pickedMesh && actionManager) {\r\n if (_this._totalPointersPressed !== 0 && Date.now() - _this._startingPointerTime > InputManager.LongPressDelay && !_this._isPointerSwiping()) {\r\n _this._startingPointerTime = 0;\r\n actionManager.processTrigger(8, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n }\r\n }\r\n }, InputManager.LongPressDelay);\r\n }\r\n }\r\n }\r\n else {\r\n for (var _i = 0, _a = scene._pointerDownStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, evt);\r\n }\r\n }\r\n if (pickResult) {\r\n var type = PointerEventTypes.POINTERDOWN;\r\n if (scene.onPointerDown) {\r\n scene.onPointerDown(evt, pickResult, type);\r\n }\r\n if (scene.onPointerObservable.hasObservers()) {\r\n var pi = new PointerInfo(type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n InputManager.prototype._isPointerSwiping = function () {\r\n return Math.abs(this._startingPointerPosition.x - this._pointerX) > InputManager.DragMovementThreshold || Math.abs(this._startingPointerPosition.y - this._pointerY) > InputManager.DragMovementThreshold;\r\n };\r\n /**\r\n * Use this method to simulate a pointer up on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @param doubleTap indicates that the pointer up event should be considered as part of a double click (false by default)\r\n */\r\n InputManager.prototype.simulatePointerUp = function (pickResult, pointerEventInit, doubleTap) {\r\n var evt = new PointerEvent(\"pointerup\", pointerEventInit);\r\n var clickInfo = new _ClickInfo();\r\n if (doubleTap) {\r\n clickInfo.doubleClick = true;\r\n }\r\n else {\r\n clickInfo.singleClick = true;\r\n }\r\n if (this._checkPrePointerObservable(pickResult, evt, PointerEventTypes.POINTERUP)) {\r\n return;\r\n }\r\n this._processPointerUp(pickResult, evt, clickInfo);\r\n };\r\n InputManager.prototype._processPointerUp = function (pickResult, evt, clickInfo) {\r\n var scene = this._scene;\r\n if (pickResult && pickResult && pickResult.pickedMesh) {\r\n this._pickedUpMesh = pickResult.pickedMesh;\r\n if (this._pickedDownMesh === this._pickedUpMesh) {\r\n if (scene.onPointerPick) {\r\n scene.onPointerPick(evt, pickResult);\r\n }\r\n if (clickInfo.singleClick && !clickInfo.ignore && scene.onPointerObservable.hasObservers()) {\r\n var type_1 = PointerEventTypes.POINTERPICK;\r\n var pi = new PointerInfo(type_1, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type_1);\r\n }\r\n }\r\n var actionManager = pickResult.pickedMesh._getActionManagerForTrigger();\r\n if (actionManager && !clickInfo.ignore) {\r\n actionManager.processTrigger(7, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n if (!clickInfo.hasSwiped && clickInfo.singleClick) {\r\n actionManager.processTrigger(1, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n }\r\n var doubleClickActionManager = pickResult.pickedMesh._getActionManagerForTrigger(6);\r\n if (clickInfo.doubleClick && doubleClickActionManager) {\r\n doubleClickActionManager.processTrigger(6, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\r\n }\r\n }\r\n }\r\n else {\r\n if (!clickInfo.ignore) {\r\n for (var _i = 0, _a = scene._pointerUpStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, evt);\r\n }\r\n }\r\n }\r\n if (this._pickedDownMesh && this._pickedDownMesh !== this._pickedUpMesh) {\r\n var pickedDownActionManager = this._pickedDownMesh._getActionManagerForTrigger(16);\r\n if (pickedDownActionManager) {\r\n pickedDownActionManager.processTrigger(16, ActionEvent.CreateNew(this._pickedDownMesh, evt));\r\n }\r\n }\r\n var type = 0;\r\n if (scene.onPointerObservable.hasObservers()) {\r\n if (!clickInfo.ignore && !clickInfo.hasSwiped) {\r\n if (clickInfo.singleClick && scene.onPointerObservable.hasSpecificMask(PointerEventTypes.POINTERTAP)) {\r\n type = PointerEventTypes.POINTERTAP;\r\n }\r\n else if (clickInfo.doubleClick && scene.onPointerObservable.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP)) {\r\n type = PointerEventTypes.POINTERDOUBLETAP;\r\n }\r\n if (type) {\r\n var pi = new PointerInfo(type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n if (!clickInfo.ignore) {\r\n type = PointerEventTypes.POINTERUP;\r\n var pi = new PointerInfo(type, evt, pickResult);\r\n this._setRayOnPointerInfo(pi);\r\n scene.onPointerObservable.notifyObservers(pi, type);\r\n }\r\n }\r\n if (scene.onPointerUp && !clickInfo.ignore) {\r\n scene.onPointerUp(evt, pickResult, type);\r\n }\r\n };\r\n /**\r\n * Gets a boolean indicating if the current pointer event is captured (meaning that the scene has already handled the pointer down)\r\n * @param pointerId defines the pointer id to use in a multi-touch scenario (0 by default)\r\n * @returns true if the pointer was captured\r\n */\r\n InputManager.prototype.isPointerCaptured = function (pointerId) {\r\n if (pointerId === void 0) { pointerId = 0; }\r\n return this._pointerCaptures[pointerId];\r\n };\r\n /**\r\n * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp\r\n * @param attachUp defines if you want to attach events to pointerup\r\n * @param attachDown defines if you want to attach events to pointerdown\r\n * @param attachMove defines if you want to attach events to pointermove\r\n * @param elementToAttachTo defines the target DOM element to attach to (will use the canvas by default)\r\n */\r\n InputManager.prototype.attachControl = function (attachUp, attachDown, attachMove, elementToAttachTo) {\r\n var _this = this;\r\n if (attachUp === void 0) { attachUp = true; }\r\n if (attachDown === void 0) { attachDown = true; }\r\n if (attachMove === void 0) { attachMove = true; }\r\n if (elementToAttachTo === void 0) { elementToAttachTo = null; }\r\n var scene = this._scene;\r\n if (!elementToAttachTo) {\r\n elementToAttachTo = scene.getEngine().getInputElement();\r\n }\r\n if (!elementToAttachTo) {\r\n return;\r\n }\r\n if (this._alreadyAttached) {\r\n this.detachControl();\r\n }\r\n this._alreadyAttachedTo = elementToAttachTo;\r\n var engine = scene.getEngine();\r\n this._initActionManager = function (act, clickInfo) {\r\n if (!_this._meshPickProceed) {\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, scene.pointerDownPredicate, false, scene.cameraToUseForPointers);\r\n _this._currentPickResult = pickResult;\r\n if (pickResult) {\r\n act = pickResult.hit && pickResult.pickedMesh ? pickResult.pickedMesh._getActionManagerForTrigger() : null;\r\n }\r\n _this._meshPickProceed = true;\r\n }\r\n return act;\r\n };\r\n this._delayedSimpleClick = function (btn, clickInfo, cb) {\r\n // double click delay is over and that no double click has been raised since, or the 2 consecutive keys pressed are different\r\n if ((Date.now() - _this._previousStartingPointerTime > InputManager.DoubleClickDelay && !_this._doubleClickOccured) || btn !== _this._previousButtonPressed) {\r\n _this._doubleClickOccured = false;\r\n clickInfo.singleClick = true;\r\n clickInfo.ignore = false;\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n };\r\n this._initClickEvent = function (obs1, obs2, evt, cb) {\r\n var clickInfo = new _ClickInfo();\r\n _this._currentPickResult = null;\r\n var act = null;\r\n var checkPicking = obs1.hasSpecificMask(PointerEventTypes.POINTERPICK) ||\r\n obs2.hasSpecificMask(PointerEventTypes.POINTERPICK) ||\r\n obs1.hasSpecificMask(PointerEventTypes.POINTERTAP) ||\r\n obs2.hasSpecificMask(PointerEventTypes.POINTERTAP) ||\r\n obs1.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP) ||\r\n obs2.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP);\r\n if (!checkPicking && AbstractActionManager) {\r\n act = _this._initActionManager(act, clickInfo);\r\n if (act) {\r\n checkPicking = act.hasPickTriggers;\r\n }\r\n }\r\n var needToIgnoreNext = false;\r\n if (checkPicking) {\r\n var btn = evt.button;\r\n clickInfo.hasSwiped = _this._isPointerSwiping();\r\n if (!clickInfo.hasSwiped) {\r\n var checkSingleClickImmediately = !InputManager.ExclusiveDoubleClickMode;\r\n if (!checkSingleClickImmediately) {\r\n checkSingleClickImmediately = !obs1.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP) && !obs2.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP);\r\n if (checkSingleClickImmediately && !AbstractActionManager.HasSpecificTrigger(6)) {\r\n act = _this._initActionManager(act, clickInfo);\r\n if (act) {\r\n checkSingleClickImmediately = !act.hasSpecificTrigger(6);\r\n }\r\n }\r\n }\r\n if (checkSingleClickImmediately) {\r\n // single click detected if double click delay is over or two different successive keys pressed without exclusive double click or no double click required\r\n if (Date.now() - _this._previousStartingPointerTime > InputManager.DoubleClickDelay || btn !== _this._previousButtonPressed) {\r\n clickInfo.singleClick = true;\r\n cb(clickInfo, _this._currentPickResult);\r\n needToIgnoreNext = true;\r\n }\r\n }\r\n // at least one double click is required to be check and exclusive double click is enabled\r\n else {\r\n // wait that no double click has been raised during the double click delay\r\n _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;\r\n _this._delayedSimpleClickTimeout = window.setTimeout(_this._delayedSimpleClick.bind(_this, btn, clickInfo, cb), InputManager.DoubleClickDelay);\r\n }\r\n var checkDoubleClick = obs1.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP) || obs2.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP);\r\n if (!checkDoubleClick && AbstractActionManager.HasSpecificTrigger(6)) {\r\n act = _this._initActionManager(act, clickInfo);\r\n if (act) {\r\n checkDoubleClick = act.hasSpecificTrigger(6);\r\n }\r\n }\r\n if (checkDoubleClick) {\r\n // two successive keys pressed are equal, double click delay is not over and double click has not just occurred\r\n if (btn === _this._previousButtonPressed && Date.now() - _this._previousStartingPointerTime < InputManager.DoubleClickDelay && !_this._doubleClickOccured) {\r\n // pointer has not moved for 2 clicks, it's a double click\r\n if (!clickInfo.hasSwiped && !_this._isPointerSwiping()) {\r\n _this._previousStartingPointerTime = 0;\r\n _this._doubleClickOccured = true;\r\n clickInfo.doubleClick = true;\r\n clickInfo.ignore = false;\r\n if (InputManager.ExclusiveDoubleClickMode && _this._previousDelayedSimpleClickTimeout) {\r\n clearTimeout(_this._previousDelayedSimpleClickTimeout);\r\n }\r\n _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n // if the two successive clicks are too far, it's just two simple clicks\r\n else {\r\n _this._doubleClickOccured = false;\r\n _this._previousStartingPointerTime = _this._startingPointerTime;\r\n _this._previousStartingPointerPosition.x = _this._startingPointerPosition.x;\r\n _this._previousStartingPointerPosition.y = _this._startingPointerPosition.y;\r\n _this._previousButtonPressed = btn;\r\n if (InputManager.ExclusiveDoubleClickMode) {\r\n if (_this._previousDelayedSimpleClickTimeout) {\r\n clearTimeout(_this._previousDelayedSimpleClickTimeout);\r\n }\r\n _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;\r\n cb(clickInfo, _this._previousPickResult);\r\n }\r\n else {\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n }\r\n needToIgnoreNext = true;\r\n }\r\n // just the first click of the double has been raised\r\n else {\r\n _this._doubleClickOccured = false;\r\n _this._previousStartingPointerTime = _this._startingPointerTime;\r\n _this._previousStartingPointerPosition.x = _this._startingPointerPosition.x;\r\n _this._previousStartingPointerPosition.y = _this._startingPointerPosition.y;\r\n _this._previousButtonPressed = btn;\r\n }\r\n }\r\n }\r\n }\r\n if (!needToIgnoreNext) {\r\n cb(clickInfo, _this._currentPickResult);\r\n }\r\n };\r\n this._onPointerMove = function (evt) {\r\n // preserve compatibility with Safari when pointerId is not present\r\n if (evt.pointerId === undefined) {\r\n evt.pointerId = 0;\r\n }\r\n _this._updatePointerPosition(evt);\r\n // PreObservable support\r\n if (_this._checkPrePointerObservable(null, evt, evt.type === _this._wheelEventName ? PointerEventTypes.POINTERWHEEL : PointerEventTypes.POINTERMOVE)) {\r\n return;\r\n }\r\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\r\n return;\r\n }\r\n if (!scene.pointerMovePredicate) {\r\n scene.pointerMovePredicate = function (mesh) {\r\n return mesh.isPickable &&\r\n mesh.isVisible &&\r\n mesh.isReady() &&\r\n mesh.isEnabled() &&\r\n (mesh.enablePointerMoveEvents || scene.constantlyUpdateMeshUnderPointer || mesh._getActionManagerForTrigger() != null) &&\r\n (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0);\r\n };\r\n }\r\n // Meshes\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, scene.pointerMovePredicate, false, scene.cameraToUseForPointers);\r\n _this._processPointerMove(pickResult, evt);\r\n };\r\n this._onPointerDown = function (evt) {\r\n _this._totalPointersPressed++;\r\n _this._pickedDownMesh = null;\r\n _this._meshPickProceed = false;\r\n // preserve compatibility with Safari when pointerId is not present\r\n if (evt.pointerId === undefined) {\r\n evt.pointerId = 0;\r\n }\r\n _this._updatePointerPosition(evt);\r\n if (scene.preventDefaultOnPointerDown && elementToAttachTo) {\r\n evt.preventDefault();\r\n elementToAttachTo.focus();\r\n }\r\n _this._startingPointerPosition.x = _this._pointerX;\r\n _this._startingPointerPosition.y = _this._pointerY;\r\n _this._startingPointerTime = Date.now();\r\n // PreObservable support\r\n if (_this._checkPrePointerObservable(null, evt, PointerEventTypes.POINTERDOWN)) {\r\n return;\r\n }\r\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\r\n return;\r\n }\r\n _this._pointerCaptures[evt.pointerId] = true;\r\n if (!scene.pointerDownPredicate) {\r\n scene.pointerDownPredicate = function (mesh) {\r\n return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled() && (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0);\r\n };\r\n }\r\n // Meshes\r\n _this._pickedDownMesh = null;\r\n var pickResult = scene.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, scene.pointerDownPredicate, false, scene.cameraToUseForPointers);\r\n _this._processPointerDown(pickResult, evt);\r\n };\r\n this._onPointerUp = function (evt) {\r\n if (_this._totalPointersPressed === 0) {\r\n // We are attaching the pointer up to windows because of a bug in FF\r\n return; // So we need to test it the pointer down was pressed before.\r\n }\r\n _this._totalPointersPressed--;\r\n _this._pickedUpMesh = null;\r\n _this._meshPickProceed = false;\r\n // preserve compatibility with Safari when pointerId is not present\r\n if (evt.pointerId === undefined) {\r\n evt.pointerId = 0;\r\n }\r\n _this._updatePointerPosition(evt);\r\n if (scene.preventDefaultOnPointerUp && elementToAttachTo) {\r\n evt.preventDefault();\r\n elementToAttachTo.focus();\r\n }\r\n _this._initClickEvent(scene.onPrePointerObservable, scene.onPointerObservable, evt, function (clickInfo, pickResult) {\r\n // PreObservable support\r\n if (scene.onPrePointerObservable.hasObservers()) {\r\n if (!clickInfo.ignore) {\r\n if (!clickInfo.hasSwiped) {\r\n if (clickInfo.singleClick && scene.onPrePointerObservable.hasSpecificMask(PointerEventTypes.POINTERTAP)) {\r\n if (_this._checkPrePointerObservable(null, evt, PointerEventTypes.POINTERTAP)) {\r\n return;\r\n }\r\n }\r\n if (clickInfo.doubleClick && scene.onPrePointerObservable.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP)) {\r\n if (_this._checkPrePointerObservable(null, evt, PointerEventTypes.POINTERDOUBLETAP)) {\r\n return;\r\n }\r\n }\r\n }\r\n if (_this._checkPrePointerObservable(null, evt, PointerEventTypes.POINTERUP)) {\r\n return;\r\n }\r\n }\r\n }\r\n if (!_this._pointerCaptures[evt.pointerId]) {\r\n return;\r\n }\r\n _this._pointerCaptures[evt.pointerId] = false;\r\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\r\n return;\r\n }\r\n if (!scene.pointerUpPredicate) {\r\n scene.pointerUpPredicate = function (mesh) {\r\n return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled() && (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0);\r\n };\r\n }\r\n // Meshes\r\n if (!_this._meshPickProceed && ((AbstractActionManager && AbstractActionManager.HasTriggers) || scene.onPointerObservable.hasObservers())) {\r\n _this._initActionManager(null, clickInfo);\r\n }\r\n if (!pickResult) {\r\n pickResult = _this._currentPickResult;\r\n }\r\n _this._processPointerUp(pickResult, evt, clickInfo);\r\n _this._previousPickResult = _this._currentPickResult;\r\n });\r\n };\r\n this._onKeyDown = function (evt) {\r\n var type = KeyboardEventTypes.KEYDOWN;\r\n if (scene.onPreKeyboardObservable.hasObservers()) {\r\n var pi = new KeyboardInfoPre(type, evt);\r\n scene.onPreKeyboardObservable.notifyObservers(pi, type);\r\n if (pi.skipOnPointerObservable) {\r\n return;\r\n }\r\n }\r\n if (scene.onKeyboardObservable.hasObservers()) {\r\n var pi = new KeyboardInfo(type, evt);\r\n scene.onKeyboardObservable.notifyObservers(pi, type);\r\n }\r\n if (scene.actionManager) {\r\n scene.actionManager.processTrigger(14, ActionEvent.CreateNewFromScene(scene, evt));\r\n }\r\n };\r\n this._onKeyUp = function (evt) {\r\n var type = KeyboardEventTypes.KEYUP;\r\n if (scene.onPreKeyboardObservable.hasObservers()) {\r\n var pi = new KeyboardInfoPre(type, evt);\r\n scene.onPreKeyboardObservable.notifyObservers(pi, type);\r\n if (pi.skipOnPointerObservable) {\r\n return;\r\n }\r\n }\r\n if (scene.onKeyboardObservable.hasObservers()) {\r\n var pi = new KeyboardInfo(type, evt);\r\n scene.onKeyboardObservable.notifyObservers(pi, type);\r\n }\r\n if (scene.actionManager) {\r\n scene.actionManager.processTrigger(15, ActionEvent.CreateNewFromScene(scene, evt));\r\n }\r\n };\r\n var attachedFunction = function () {\r\n if (!elementToAttachTo || _this._keyboardIsAttached) {\r\n return;\r\n }\r\n elementToAttachTo.addEventListener(\"keydown\", _this._onKeyDown, false);\r\n elementToAttachTo.addEventListener(\"keyup\", _this._onKeyUp, false);\r\n _this._keyboardIsAttached = true;\r\n };\r\n // Keyboard events\r\n this._onCanvasFocusObserver = engine.onCanvasFocusObservable.add((function () {\r\n if (document.activeElement === elementToAttachTo) {\r\n attachedFunction();\r\n }\r\n return attachedFunction;\r\n })());\r\n this._onCanvasBlurObserver = engine.onCanvasBlurObservable.add(function () {\r\n if (!elementToAttachTo) {\r\n return;\r\n }\r\n elementToAttachTo.removeEventListener(\"keydown\", _this._onKeyDown);\r\n elementToAttachTo.removeEventListener(\"keyup\", _this._onKeyUp);\r\n _this._keyboardIsAttached = false;\r\n });\r\n attachedFunction();\r\n // Pointer events\r\n var eventPrefix = Tools.GetPointerPrefix(engine);\r\n if (attachMove) {\r\n elementToAttachTo.addEventListener(eventPrefix + \"move\", this._onPointerMove, false);\r\n // Wheel\r\n this._wheelEventName =\r\n \"onwheel\" in document.createElement(\"div\")\r\n ? \"wheel\" // Modern browsers support \"wheel\"\r\n : document.onmousewheel !== undefined\r\n ? \"mousewheel\" // Webkit and IE support at least \"mousewheel\"\r\n : \"DOMMouseScroll\"; // let's assume that remaining browsers are older Firefox\r\n elementToAttachTo.addEventListener(this._wheelEventName, this._onPointerMove, false);\r\n }\r\n if (attachDown) {\r\n elementToAttachTo.addEventListener(eventPrefix + \"down\", this._onPointerDown, false);\r\n }\r\n if (attachUp) {\r\n var hostWindow = scene.getEngine().getHostWindow();\r\n if (hostWindow) {\r\n hostWindow.addEventListener(eventPrefix + \"up\", this._onPointerUp, false);\r\n }\r\n }\r\n this._alreadyAttached = true;\r\n };\r\n /**\r\n * Detaches all event handlers\r\n */\r\n InputManager.prototype.detachControl = function () {\r\n var engine = this._scene.getEngine();\r\n var eventPrefix = Tools.GetPointerPrefix(engine);\r\n if (!this._alreadyAttachedTo) {\r\n return;\r\n }\r\n if (!this._alreadyAttached) {\r\n return;\r\n }\r\n // Pointer\r\n this._alreadyAttachedTo.removeEventListener(eventPrefix + \"move\", this._onPointerMove);\r\n this._alreadyAttachedTo.removeEventListener(this._wheelEventName, this._onPointerMove);\r\n this._alreadyAttachedTo.removeEventListener(eventPrefix + \"down\", this._onPointerDown);\r\n window.removeEventListener(eventPrefix + \"up\", this._onPointerUp);\r\n // Blur / Focus\r\n if (this._onCanvasBlurObserver) {\r\n engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n if (this._onCanvasFocusObserver) {\r\n engine.onCanvasFocusObservable.remove(this._onCanvasFocusObserver);\r\n }\r\n // Keyboard\r\n this._alreadyAttachedTo.removeEventListener(\"keydown\", this._onKeyDown);\r\n this._alreadyAttachedTo.removeEventListener(\"keyup\", this._onKeyUp);\r\n // Cursor\r\n if (!this._scene.doNotHandleCursors) {\r\n this._alreadyAttachedTo.style.cursor = this._scene.defaultCursor;\r\n }\r\n this._alreadyAttached = false;\r\n };\r\n /**\r\n * Force the value of meshUnderPointer\r\n * @param mesh defines the mesh to use\r\n * @param pointerId optional pointer id when using more than one pointer. Defaults to 0\r\n */\r\n InputManager.prototype.setPointerOverMesh = function (mesh, pointerId) {\r\n if (pointerId === void 0) { pointerId = 0; }\r\n // Sanity check\r\n if (pointerId < 0) {\r\n pointerId = 0;\r\n }\r\n if (this._meshUnderPointerId[pointerId] === mesh) {\r\n return;\r\n }\r\n var underPointerMesh = this._meshUnderPointerId[pointerId];\r\n var actionManager;\r\n if (underPointerMesh) {\r\n actionManager = underPointerMesh._getActionManagerForTrigger(10);\r\n if (actionManager) {\r\n actionManager.processTrigger(10, ActionEvent.CreateNew(underPointerMesh, undefined, { pointerId: pointerId }));\r\n }\r\n }\r\n this._meshUnderPointerId[pointerId] = mesh;\r\n this._pointerOverMesh = mesh;\r\n underPointerMesh = this._meshUnderPointerId[pointerId];\r\n if (underPointerMesh) {\r\n actionManager = underPointerMesh._getActionManagerForTrigger(9);\r\n if (actionManager) {\r\n actionManager.processTrigger(9, ActionEvent.CreateNew(underPointerMesh, undefined, { pointerId: pointerId }));\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the mesh under the pointer\r\n * @returns a Mesh or null if no mesh is under the pointer\r\n */\r\n InputManager.prototype.getPointerOverMesh = function () {\r\n return this._pointerOverMesh;\r\n };\r\n /** The distance in pixel that you have to move to prevent some events */\r\n InputManager.DragMovementThreshold = 10; // in pixels\r\n /** Time in milliseconds to wait to raise long press events if button is still pressed */\r\n InputManager.LongPressDelay = 500; // in milliseconds\r\n /** Time in milliseconds with two consecutive clicks will be considered as a double click */\r\n InputManager.DoubleClickDelay = 300; // in milliseconds\r\n /** If you need to check double click without raising a single click at first click, enable this flag */\r\n InputManager.ExclusiveDoubleClickMode = false;\r\n return InputManager;\r\n}());\r\nexport { InputManager };\r\n//# sourceMappingURL=scene.inputManager.js.map","/**\r\n * Helper class used to generate session unique ID\r\n */\r\nvar UniqueIdGenerator = /** @class */ (function () {\r\n function UniqueIdGenerator() {\r\n }\r\n Object.defineProperty(UniqueIdGenerator, \"UniqueId\", {\r\n /**\r\n * Gets an unique (relatively to the current scene) Id\r\n */\r\n get: function () {\r\n var result = this._UniqueIdCounter;\r\n this._UniqueIdCounter++;\r\n return result;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Statics\r\n UniqueIdGenerator._UniqueIdCounter = 0;\r\n return UniqueIdGenerator;\r\n}());\r\nexport { UniqueIdGenerator };\r\n//# sourceMappingURL=uniqueIdGenerator.js.map","import { __assign, __extends } from \"tslib\";\r\nimport { Tools } from \"./Misc/tools\";\r\nimport { PrecisionDate } from \"./Misc/precisionDate\";\r\nimport { Observable } from \"./Misc/observable\";\r\nimport { SmartArrayNoDuplicate, SmartArray } from \"./Misc/smartArray\";\r\nimport { StringDictionary } from \"./Misc/stringDictionary\";\r\nimport { Tags } from \"./Misc/tags\";\r\nimport { Vector3, Matrix } from \"./Maths/math.vector\";\r\nimport { TransformNode } from \"./Meshes/transformNode\";\r\nimport { AbstractMesh } from \"./Meshes/abstractMesh\";\r\nimport { Camera } from \"./Cameras/camera\";\r\nimport { AbstractScene } from \"./abstractScene\";\r\nimport { ImageProcessingConfiguration } from \"./Materials/imageProcessingConfiguration\";\r\nimport { UniformBuffer } from \"./Materials/uniformBuffer\";\r\nimport { Light } from \"./Lights/light\";\r\nimport { PickingInfo } from \"./Collisions/pickingInfo\";\r\nimport { ActionEvent } from \"./Actions/actionEvent\";\r\nimport { PostProcessManager } from \"./PostProcesses/postProcessManager\";\r\nimport { RenderingManager } from \"./Rendering/renderingManager\";\r\nimport { Stage } from \"./sceneComponent\";\r\nimport { DomManagement } from \"./Misc/domManagement\";\r\nimport { Logger } from \"./Misc/logger\";\r\nimport { EngineStore } from \"./Engines/engineStore\";\r\nimport { _DevTools } from './Misc/devTools';\r\nimport { InputManager } from './Inputs/scene.inputManager';\r\nimport { PerfCounter } from './Misc/perfCounter';\r\nimport { Color4, Color3 } from './Maths/math.color';\r\nimport { Frustum } from './Maths/math.frustum';\r\nimport { UniqueIdGenerator } from './Misc/uniqueIdGenerator';\r\nimport { FileTools } from './Misc/fileTools';\r\n/**\r\n * Represents a scene to be rendered by the engine.\r\n * @see https://doc.babylonjs.com/features/scene\r\n */\r\nvar Scene = /** @class */ (function (_super) {\r\n __extends(Scene, _super);\r\n /**\r\n * Creates a new Scene\r\n * @param engine defines the engine to use to render this scene\r\n * @param options defines the scene options\r\n */\r\n function Scene(engine, options) {\r\n var _this = _super.call(this) || this;\r\n // Members\r\n /** @hidden */\r\n _this._inputManager = new InputManager(_this);\r\n /** Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position */\r\n _this.cameraToUseForPointers = null;\r\n /** @hidden */\r\n _this._isScene = true;\r\n /** @hidden */\r\n _this._blockEntityCollection = false;\r\n /**\r\n * Gets or sets a boolean that indicates if the scene must clear the render buffer before rendering a frame\r\n */\r\n _this.autoClear = true;\r\n /**\r\n * Gets or sets a boolean that indicates if the scene must clear the depth and stencil buffers before rendering a frame\r\n */\r\n _this.autoClearDepthAndStencil = true;\r\n /**\r\n * Defines the color used to clear the render buffer (Default is (0.2, 0.2, 0.3, 1.0))\r\n */\r\n _this.clearColor = new Color4(0.2, 0.2, 0.3, 1.0);\r\n /**\r\n * Defines the color used to simulate the ambient color (Default is (0, 0, 0))\r\n */\r\n _this.ambientColor = new Color3(0, 0, 0);\r\n /** @hidden */\r\n _this._environmentIntensity = 1;\r\n _this._forceWireframe = false;\r\n _this._skipFrustumClipping = false;\r\n _this._forcePointsCloud = false;\r\n /**\r\n * Gets or sets a boolean indicating if animations are enabled\r\n */\r\n _this.animationsEnabled = true;\r\n _this._animationPropertiesOverride = null;\r\n /**\r\n * Gets or sets a boolean indicating if a constant deltatime has to be used\r\n * This is mostly useful for testing purposes when you do not want the animations to scale with the framerate\r\n */\r\n _this.useConstantAnimationDeltaTime = false;\r\n /**\r\n * Gets or sets a boolean indicating if the scene must keep the meshUnderPointer property updated\r\n * Please note that it requires to run a ray cast through the scene on every frame\r\n */\r\n _this.constantlyUpdateMeshUnderPointer = false;\r\n /**\r\n * Defines the HTML cursor to use when hovering over interactive elements\r\n */\r\n _this.hoverCursor = \"pointer\";\r\n /**\r\n * Defines the HTML default cursor to use (empty by default)\r\n */\r\n _this.defaultCursor = \"\";\r\n /**\r\n * Defines whether cursors are handled by the scene.\r\n */\r\n _this.doNotHandleCursors = false;\r\n /**\r\n * This is used to call preventDefault() on pointer down\r\n * in order to block unwanted artifacts like system double clicks\r\n */\r\n _this.preventDefaultOnPointerDown = true;\r\n /**\r\n * This is used to call preventDefault() on pointer up\r\n * in order to block unwanted artifacts like system double clicks\r\n */\r\n _this.preventDefaultOnPointerUp = true;\r\n // Metadata\r\n /**\r\n * Gets or sets user defined metadata\r\n */\r\n _this.metadata = null;\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n _this.reservedDataStore = null;\r\n /**\r\n * Use this array to add regular expressions used to disable offline support for specific urls\r\n */\r\n _this.disableOfflineSupportExceptionRules = new Array();\r\n /**\r\n * An event triggered when the scene is disposed.\r\n */\r\n _this.onDisposeObservable = new Observable();\r\n _this._onDisposeObserver = null;\r\n /**\r\n * An event triggered before rendering the scene (right after animations and physics)\r\n */\r\n _this.onBeforeRenderObservable = new Observable();\r\n _this._onBeforeRenderObserver = null;\r\n /**\r\n * An event triggered after rendering the scene\r\n */\r\n _this.onAfterRenderObservable = new Observable();\r\n /**\r\n * An event triggered after rendering the scene for an active camera (When scene.render is called this will be called after each camera)\r\n */\r\n _this.onAfterRenderCameraObservable = new Observable();\r\n _this._onAfterRenderObserver = null;\r\n /**\r\n * An event triggered before animating the scene\r\n */\r\n _this.onBeforeAnimationsObservable = new Observable();\r\n /**\r\n * An event triggered after animations processing\r\n */\r\n _this.onAfterAnimationsObservable = new Observable();\r\n /**\r\n * An event triggered before draw calls are ready to be sent\r\n */\r\n _this.onBeforeDrawPhaseObservable = new Observable();\r\n /**\r\n * An event triggered after draw calls have been sent\r\n */\r\n _this.onAfterDrawPhaseObservable = new Observable();\r\n /**\r\n * An event triggered when the scene is ready\r\n */\r\n _this.onReadyObservable = new Observable();\r\n /**\r\n * An event triggered before rendering a camera\r\n */\r\n _this.onBeforeCameraRenderObservable = new Observable();\r\n _this._onBeforeCameraRenderObserver = null;\r\n /**\r\n * An event triggered after rendering a camera\r\n */\r\n _this.onAfterCameraRenderObservable = new Observable();\r\n _this._onAfterCameraRenderObserver = null;\r\n /**\r\n * An event triggered when active meshes evaluation is about to start\r\n */\r\n _this.onBeforeActiveMeshesEvaluationObservable = new Observable();\r\n /**\r\n * An event triggered when active meshes evaluation is done\r\n */\r\n _this.onAfterActiveMeshesEvaluationObservable = new Observable();\r\n /**\r\n * An event triggered when particles rendering is about to start\r\n * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)\r\n */\r\n _this.onBeforeParticlesRenderingObservable = new Observable();\r\n /**\r\n * An event triggered when particles rendering is done\r\n * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)\r\n */\r\n _this.onAfterParticlesRenderingObservable = new Observable();\r\n /**\r\n * An event triggered when SceneLoader.Append or SceneLoader.Load or SceneLoader.ImportMesh were successfully executed\r\n */\r\n _this.onDataLoadedObservable = new Observable();\r\n /**\r\n * An event triggered when a camera is created\r\n */\r\n _this.onNewCameraAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a camera is removed\r\n */\r\n _this.onCameraRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a light is created\r\n */\r\n _this.onNewLightAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a light is removed\r\n */\r\n _this.onLightRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a geometry is created\r\n */\r\n _this.onNewGeometryAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a geometry is removed\r\n */\r\n _this.onGeometryRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a transform node is created\r\n */\r\n _this.onNewTransformNodeAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a transform node is removed\r\n */\r\n _this.onTransformNodeRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a mesh is created\r\n */\r\n _this.onNewMeshAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a mesh is removed\r\n */\r\n _this.onMeshRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a skeleton is created\r\n */\r\n _this.onNewSkeletonAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a skeleton is removed\r\n */\r\n _this.onSkeletonRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a material is created\r\n */\r\n _this.onNewMaterialAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a multi material is created\r\n */\r\n _this.onNewMultiMaterialAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a material is removed\r\n */\r\n _this.onMaterialRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a multi material is removed\r\n */\r\n _this.onMultiMaterialRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when a texture is created\r\n */\r\n _this.onNewTextureAddedObservable = new Observable();\r\n /**\r\n * An event triggered when a texture is removed\r\n */\r\n _this.onTextureRemovedObservable = new Observable();\r\n /**\r\n * An event triggered when render targets are about to be rendered\r\n * Can happen multiple times per frame.\r\n */\r\n _this.onBeforeRenderTargetsRenderObservable = new Observable();\r\n /**\r\n * An event triggered when render targets were rendered.\r\n * Can happen multiple times per frame.\r\n */\r\n _this.onAfterRenderTargetsRenderObservable = new Observable();\r\n /**\r\n * An event triggered before calculating deterministic simulation step\r\n */\r\n _this.onBeforeStepObservable = new Observable();\r\n /**\r\n * An event triggered after calculating deterministic simulation step\r\n */\r\n _this.onAfterStepObservable = new Observable();\r\n /**\r\n * An event triggered when the activeCamera property is updated\r\n */\r\n _this.onActiveCameraChanged = new Observable();\r\n /**\r\n * This Observable will be triggered before rendering each renderingGroup of each rendered camera.\r\n * The RenderinGroupInfo class contains all the information about the context in which the observable is called\r\n * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)\r\n */\r\n _this.onBeforeRenderingGroupObservable = new Observable();\r\n /**\r\n * This Observable will be triggered after rendering each renderingGroup of each rendered camera.\r\n * The RenderinGroupInfo class contains all the information about the context in which the observable is called\r\n * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)\r\n */\r\n _this.onAfterRenderingGroupObservable = new Observable();\r\n /**\r\n * This Observable will when a mesh has been imported into the scene.\r\n */\r\n _this.onMeshImportedObservable = new Observable();\r\n /**\r\n * This Observable will when an animation file has been imported into the scene.\r\n */\r\n _this.onAnimationFileImportedObservable = new Observable();\r\n // Animations\r\n /** @hidden */\r\n _this._registeredForLateAnimationBindings = new SmartArrayNoDuplicate(256);\r\n /**\r\n * This observable event is triggered when any ponter event is triggered. It is registered during Scene.attachControl() and it is called BEFORE the 3D engine process anything (mesh/sprite picking for instance).\r\n * You have the possibility to skip the process and the call to onPointerObservable by setting PointerInfoPre.skipOnPointerObservable to true\r\n */\r\n _this.onPrePointerObservable = new Observable();\r\n /**\r\n * Observable event triggered each time an input event is received from the rendering canvas\r\n */\r\n _this.onPointerObservable = new Observable();\r\n // Keyboard\r\n /**\r\n * This observable event is triggered when any keyboard event si raised and registered during Scene.attachControl()\r\n * You have the possibility to skip the process and the call to onKeyboardObservable by setting KeyboardInfoPre.skipOnPointerObservable to true\r\n */\r\n _this.onPreKeyboardObservable = new Observable();\r\n /**\r\n * Observable event triggered each time an keyboard event is received from the hosting window\r\n */\r\n _this.onKeyboardObservable = new Observable();\r\n // Coordinates system\r\n _this._useRightHandedSystem = false;\r\n // Deterministic lockstep\r\n _this._timeAccumulator = 0;\r\n _this._currentStepId = 0;\r\n _this._currentInternalStep = 0;\r\n // Fog\r\n _this._fogEnabled = true;\r\n _this._fogMode = Scene.FOGMODE_NONE;\r\n /**\r\n * Gets or sets the fog color to use\r\n * @see https://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is Color3(0.2, 0.2, 0.3))\r\n */\r\n _this.fogColor = new Color3(0.2, 0.2, 0.3);\r\n /**\r\n * Gets or sets the fog density to use\r\n * @see https://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is 0.1)\r\n */\r\n _this.fogDensity = 0.1;\r\n /**\r\n * Gets or sets the fog start distance to use\r\n * @see https://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is 0)\r\n */\r\n _this.fogStart = 0;\r\n /**\r\n * Gets or sets the fog end distance to use\r\n * @see https://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is 1000)\r\n */\r\n _this.fogEnd = 1000.0;\r\n /**\r\n * Flag indicating that the frame buffer binding is handled by another component\r\n */\r\n _this.prePass = false;\r\n // Lights\r\n _this._shadowsEnabled = true;\r\n _this._lightsEnabled = true;\r\n /** All of the active cameras added to this scene. */\r\n _this.activeCameras = new Array();\r\n // Textures\r\n _this._texturesEnabled = true;\r\n // Physics\r\n /**\r\n * Gets or sets a boolean indicating if physic engines are enabled on this scene\r\n */\r\n _this.physicsEnabled = true;\r\n // Particles\r\n /**\r\n * Gets or sets a boolean indicating if particles are enabled on this scene\r\n */\r\n _this.particlesEnabled = true;\r\n // Sprites\r\n /**\r\n * Gets or sets a boolean indicating if sprites are enabled on this scene\r\n */\r\n _this.spritesEnabled = true;\r\n // Skeletons\r\n _this._skeletonsEnabled = true;\r\n // Lens flares\r\n /**\r\n * Gets or sets a boolean indicating if lens flares are enabled on this scene\r\n */\r\n _this.lensFlaresEnabled = true;\r\n // Collisions\r\n /**\r\n * Gets or sets a boolean indicating if collisions are enabled on this scene\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.collisionsEnabled = true;\r\n /**\r\n * Defines the gravity applied to this scene (used only for collisions)\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity\r\n */\r\n _this.gravity = new Vector3(0, -9.807, 0);\r\n // Postprocesses\r\n /**\r\n * Gets or sets a boolean indicating if postprocesses are enabled on this scene\r\n */\r\n _this.postProcessesEnabled = true;\r\n // Customs render targets\r\n /**\r\n * Gets or sets a boolean indicating if render targets are enabled on this scene\r\n */\r\n _this.renderTargetsEnabled = true;\r\n /**\r\n * Gets or sets a boolean indicating if next render targets must be dumped as image for debugging purposes\r\n * We recommend not using it and instead rely on Spector.js: http://spector.babylonjs.com\r\n */\r\n _this.dumpNextRenderTargets = false;\r\n /**\r\n * The list of user defined render targets added to the scene\r\n */\r\n _this.customRenderTargets = new Array();\r\n /**\r\n * Gets the list of meshes imported to the scene through SceneLoader\r\n */\r\n _this.importedMeshesFiles = new Array();\r\n // Probes\r\n /**\r\n * Gets or sets a boolean indicating if probes are enabled on this scene\r\n */\r\n _this.probesEnabled = true;\r\n _this._meshesForIntersections = new SmartArrayNoDuplicate(256);\r\n // Procedural textures\r\n /**\r\n * Gets or sets a boolean indicating if procedural textures are enabled on this scene\r\n */\r\n _this.proceduralTexturesEnabled = true;\r\n // Performance counters\r\n _this._totalVertices = new PerfCounter();\r\n /** @hidden */\r\n _this._activeIndices = new PerfCounter();\r\n /** @hidden */\r\n _this._activeParticles = new PerfCounter();\r\n /** @hidden */\r\n _this._activeBones = new PerfCounter();\r\n /** @hidden */\r\n _this._animationTime = 0;\r\n /**\r\n * Gets or sets a general scale for animation speed\r\n * @see https://www.babylonjs-playground.com/#IBU2W7#3\r\n */\r\n _this.animationTimeScale = 1;\r\n _this._renderId = 0;\r\n _this._frameId = 0;\r\n _this._executeWhenReadyTimeoutId = -1;\r\n _this._intermediateRendering = false;\r\n _this._viewUpdateFlag = -1;\r\n _this._projectionUpdateFlag = -1;\r\n /** @hidden */\r\n _this._toBeDisposed = new Array(256);\r\n _this._activeRequests = new Array();\r\n /** @hidden */\r\n _this._pendingData = new Array();\r\n _this._isDisposed = false;\r\n /**\r\n * Gets or sets a boolean indicating that all submeshes of active meshes must be rendered\r\n * Use this boolean to avoid computing frustum clipping on submeshes (This could help when you are CPU bound)\r\n */\r\n _this.dispatchAllSubMeshesOfActiveMeshes = false;\r\n _this._activeMeshes = new SmartArray(256);\r\n _this._processedMaterials = new SmartArray(256);\r\n _this._renderTargets = new SmartArrayNoDuplicate(256);\r\n /** @hidden */\r\n _this._activeParticleSystems = new SmartArray(256);\r\n _this._activeSkeletons = new SmartArrayNoDuplicate(32);\r\n _this._softwareSkinnedMeshes = new SmartArrayNoDuplicate(32);\r\n /** @hidden */\r\n _this._activeAnimatables = new Array();\r\n _this._transformMatrix = Matrix.Zero();\r\n /**\r\n * Gets or sets a boolean indicating if lights must be sorted by priority (off by default)\r\n * This is useful if there are more lights that the maximum simulteanous authorized\r\n */\r\n _this.requireLightSorting = false;\r\n /**\r\n * @hidden\r\n * Backing store of defined scene components.\r\n */\r\n _this._components = [];\r\n /**\r\n * @hidden\r\n * Backing store of defined scene components.\r\n */\r\n _this._serializableComponents = [];\r\n /**\r\n * List of components to register on the next registration step.\r\n */\r\n _this._transientComponents = [];\r\n /**\r\n * @hidden\r\n * Defines the actions happening before camera updates.\r\n */\r\n _this._beforeCameraUpdateStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening before clear the canvas.\r\n */\r\n _this._beforeClearStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions when collecting render targets for the frame.\r\n */\r\n _this._gatherRenderTargetsStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening for one camera in the frame.\r\n */\r\n _this._gatherActiveCameraRenderTargetsStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the per mesh ready checks.\r\n */\r\n _this._isReadyForMeshStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening before evaluate active mesh checks.\r\n */\r\n _this._beforeEvaluateActiveMeshStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the evaluate sub mesh checks.\r\n */\r\n _this._evaluateSubMeshStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the active mesh stage.\r\n */\r\n _this._preActiveMeshStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening during the per camera render target step.\r\n */\r\n _this._cameraDrawRenderTargetStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before the active camera is drawing.\r\n */\r\n _this._beforeCameraDrawStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before a render target is drawing.\r\n */\r\n _this._beforeRenderTargetDrawStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before a rendering group is drawing.\r\n */\r\n _this._beforeRenderingGroupDrawStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just before a mesh is drawing.\r\n */\r\n _this._beforeRenderingMeshStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after a mesh has been drawn.\r\n */\r\n _this._afterRenderingMeshStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after a rendering group has been drawn.\r\n */\r\n _this._afterRenderingGroupDrawStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after the active camera has been drawn.\r\n */\r\n _this._afterCameraDrawStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after a render target has been drawn.\r\n */\r\n _this._afterRenderTargetDrawStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening just after rendering all cameras and computing intersections.\r\n */\r\n _this._afterRenderStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening when a pointer move event happens.\r\n */\r\n _this._pointerMoveStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening when a pointer down event happens.\r\n */\r\n _this._pointerDownStage = Stage.Create();\r\n /**\r\n * @hidden\r\n * Defines the actions happening when a pointer up event happens.\r\n */\r\n _this._pointerUpStage = Stage.Create();\r\n /**\r\n * an optional map from Geometry Id to Geometry index in the 'geometries' array\r\n */\r\n _this.geometriesByUniqueId = null;\r\n _this._defaultMeshCandidates = {\r\n data: [],\r\n length: 0\r\n };\r\n _this._defaultSubMeshCandidates = {\r\n data: [],\r\n length: 0\r\n };\r\n _this._preventFreeActiveMeshesAndRenderingGroups = false;\r\n /** @hidden */\r\n _this._activeMeshesFrozen = false;\r\n _this._skipEvaluateActiveMeshesCompletely = false;\r\n /** @hidden */\r\n _this._allowPostProcessClearColor = true;\r\n /**\r\n * User updatable function that will return a deterministic frame time when engine is in deterministic lock step mode\r\n */\r\n _this.getDeterministicFrameTime = function () {\r\n return _this._engine.getTimeStep();\r\n };\r\n _this._blockMaterialDirtyMechanism = false;\r\n var fullOptions = __assign({ useGeometryUniqueIdsMap: true, useMaterialMeshMap: true, useClonedMeshMap: true, virtual: false }, options);\r\n _this._engine = engine || EngineStore.LastCreatedEngine;\r\n if (!fullOptions.virtual) {\r\n EngineStore._LastCreatedScene = _this;\r\n _this._engine.scenes.push(_this);\r\n }\r\n _this._uid = null;\r\n _this._renderingManager = new RenderingManager(_this);\r\n if (PostProcessManager) {\r\n _this.postProcessManager = new PostProcessManager(_this);\r\n }\r\n if (DomManagement.IsWindowObjectExist()) {\r\n _this.attachControl();\r\n }\r\n // Uniform Buffer\r\n _this._createUbo();\r\n // Default Image processing definition\r\n if (ImageProcessingConfiguration) {\r\n _this._imageProcessingConfiguration = new ImageProcessingConfiguration();\r\n }\r\n _this.setDefaultCandidateProviders();\r\n if (fullOptions.useGeometryUniqueIdsMap) {\r\n _this.geometriesByUniqueId = {};\r\n }\r\n _this.useMaterialMeshMap = fullOptions.useMaterialMeshMap;\r\n _this.useClonedMeshMap = fullOptions.useClonedMeshMap;\r\n if (!options || !options.virtual) {\r\n _this._engine.onNewSceneAddedObservable.notifyObservers(_this);\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Factory used to create the default material.\r\n * @param name The name of the material to create\r\n * @param scene The scene to create the material for\r\n * @returns The default material\r\n */\r\n Scene.DefaultMaterialFactory = function (scene) {\r\n throw _DevTools.WarnImport(\"StandardMaterial\");\r\n };\r\n /**\r\n * Factory used to create the a collision coordinator.\r\n * @returns The collision coordinator\r\n */\r\n Scene.CollisionCoordinatorFactory = function () {\r\n throw _DevTools.WarnImport(\"DefaultCollisionCoordinator\");\r\n };\r\n Object.defineProperty(Scene.prototype, \"environmentTexture\", {\r\n /**\r\n * Texture used in all pbr material as the reflection texture.\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to reference from here than from all the materials.\r\n */\r\n get: function () {\r\n return this._environmentTexture;\r\n },\r\n /**\r\n * Texture used in all pbr material as the reflection texture.\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to set here than in all the materials.\r\n */\r\n set: function (value) {\r\n if (this._environmentTexture === value) {\r\n return;\r\n }\r\n this._environmentTexture = value;\r\n this.markAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"environmentIntensity\", {\r\n /**\r\n * Intensity of the environment in all pbr material.\r\n * This dims or reinforces the IBL lighting overall (reflection and diffuse).\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to reference from here than from all the materials.\r\n */\r\n get: function () {\r\n return this._environmentIntensity;\r\n },\r\n /**\r\n * Intensity of the environment in all pbr material.\r\n * This dims or reinforces the IBL lighting overall (reflection and diffuse).\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to set here than in all the materials.\r\n */\r\n set: function (value) {\r\n if (this._environmentIntensity === value) {\r\n return;\r\n }\r\n this._environmentIntensity = value;\r\n this.markAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Default image processing configuration used either in the rendering\r\n * Forward main pass or through the imageProcessingPostProcess if present.\r\n * As in the majority of the scene they are the same (exception for multi camera),\r\n * this is easier to reference from here than from all the materials and post process.\r\n *\r\n * No setter as we it is a shared configuration, you can set the values instead.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"forceWireframe\", {\r\n get: function () {\r\n return this._forceWireframe;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if all rendering must be done in wireframe\r\n */\r\n set: function (value) {\r\n if (this._forceWireframe === value) {\r\n return;\r\n }\r\n this._forceWireframe = value;\r\n this.markAllMaterialsAsDirty(16);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"skipFrustumClipping\", {\r\n get: function () {\r\n return this._skipFrustumClipping;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if we should skip the frustum clipping part of the active meshes selection\r\n */\r\n set: function (value) {\r\n if (this._skipFrustumClipping === value) {\r\n return;\r\n }\r\n this._skipFrustumClipping = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"forcePointsCloud\", {\r\n get: function () {\r\n return this._forcePointsCloud;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if all rendering must be done in point cloud\r\n */\r\n set: function (value) {\r\n if (this._forcePointsCloud === value) {\r\n return;\r\n }\r\n this._forcePointsCloud = value;\r\n this.markAllMaterialsAsDirty(16);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n get: function () {\r\n return this._animationPropertiesOverride;\r\n },\r\n set: function (value) {\r\n this._animationPropertiesOverride = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"onDispose\", {\r\n /** Sets a function to be executed when this scene is disposed. */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"beforeRender\", {\r\n /** Sets a function to be executed before rendering this scene */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n if (callback) {\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"afterRender\", {\r\n /** Sets a function to be executed after rendering this scene */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n if (callback) {\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"beforeCameraRender\", {\r\n /** Sets a function to be executed before rendering a camera*/\r\n set: function (callback) {\r\n if (this._onBeforeCameraRenderObserver) {\r\n this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\r\n }\r\n this._onBeforeCameraRenderObserver = this.onBeforeCameraRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"afterCameraRender\", {\r\n /** Sets a function to be executed after rendering a camera*/\r\n set: function (callback) {\r\n if (this._onAfterCameraRenderObserver) {\r\n this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver);\r\n }\r\n this._onAfterCameraRenderObserver = this.onAfterCameraRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"unTranslatedPointer\", {\r\n /**\r\n * Gets the pointer coordinates without any translation (ie. straight out of the pointer event)\r\n */\r\n get: function () {\r\n return this._inputManager.unTranslatedPointer;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"DragMovementThreshold\", {\r\n /**\r\n * Gets or sets the distance in pixel that you have to move to prevent some events. Default is 10 pixels\r\n */\r\n get: function () {\r\n return InputManager.DragMovementThreshold;\r\n },\r\n set: function (value) {\r\n InputManager.DragMovementThreshold = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"LongPressDelay\", {\r\n /**\r\n * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 500 ms\r\n */\r\n get: function () {\r\n return InputManager.LongPressDelay;\r\n },\r\n set: function (value) {\r\n InputManager.LongPressDelay = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"DoubleClickDelay\", {\r\n /**\r\n * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 300 ms\r\n */\r\n get: function () {\r\n return InputManager.DoubleClickDelay;\r\n },\r\n set: function (value) {\r\n InputManager.DoubleClickDelay = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene, \"ExclusiveDoubleClickMode\", {\r\n /** If you need to check double click without raising a single click at first click, enable this flag */\r\n get: function () {\r\n return InputManager.ExclusiveDoubleClickMode;\r\n },\r\n set: function (value) {\r\n InputManager.ExclusiveDoubleClickMode = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"useRightHandedSystem\", {\r\n get: function () {\r\n return this._useRightHandedSystem;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if the scene must use right-handed coordinates system\r\n */\r\n set: function (value) {\r\n if (this._useRightHandedSystem === value) {\r\n return;\r\n }\r\n this._useRightHandedSystem = value;\r\n this.markAllMaterialsAsDirty(16);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the step Id used by deterministic lock step\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @param newStepId defines the step Id\r\n */\r\n Scene.prototype.setStepId = function (newStepId) {\r\n this._currentStepId = newStepId;\r\n };\r\n /**\r\n * Gets the step Id used by deterministic lock step\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns the step Id\r\n */\r\n Scene.prototype.getStepId = function () {\r\n return this._currentStepId;\r\n };\r\n /**\r\n * Gets the internal step used by deterministic lock step\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n * @returns the internal step\r\n */\r\n Scene.prototype.getInternalStep = function () {\r\n return this._currentInternalStep;\r\n };\r\n Object.defineProperty(Scene.prototype, \"fogEnabled\", {\r\n get: function () {\r\n return this._fogEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if fog is enabled on this scene\r\n * @see https://doc.babylonjs.com/babylon101/environment#fog\r\n * (Default is true)\r\n */\r\n set: function (value) {\r\n if (this._fogEnabled === value) {\r\n return;\r\n }\r\n this._fogEnabled = value;\r\n this.markAllMaterialsAsDirty(16);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"fogMode\", {\r\n get: function () {\r\n return this._fogMode;\r\n },\r\n /**\r\n * Gets or sets the fog mode to use\r\n * @see https://doc.babylonjs.com/babylon101/environment#fog\r\n * | mode | value |\r\n * | --- | --- |\r\n * | FOGMODE_NONE | 0 |\r\n * | FOGMODE_EXP | 1 |\r\n * | FOGMODE_EXP2 | 2 |\r\n * | FOGMODE_LINEAR | 3 |\r\n */\r\n set: function (value) {\r\n if (this._fogMode === value) {\r\n return;\r\n }\r\n this._fogMode = value;\r\n this.markAllMaterialsAsDirty(16);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"shadowsEnabled\", {\r\n get: function () {\r\n return this._shadowsEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if shadows are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._shadowsEnabled === value) {\r\n return;\r\n }\r\n this._shadowsEnabled = value;\r\n this.markAllMaterialsAsDirty(2);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"lightsEnabled\", {\r\n get: function () {\r\n return this._lightsEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if lights are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._lightsEnabled === value) {\r\n return;\r\n }\r\n this._lightsEnabled = value;\r\n this.markAllMaterialsAsDirty(2);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"activeCamera\", {\r\n /** Gets or sets the current active camera */\r\n get: function () {\r\n return this._activeCamera;\r\n },\r\n set: function (value) {\r\n if (value === this._activeCamera) {\r\n return;\r\n }\r\n this._activeCamera = value;\r\n this.onActiveCameraChanged.notifyObservers(this);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"defaultMaterial\", {\r\n /** The default material used on meshes when no material is affected */\r\n get: function () {\r\n if (!this._defaultMaterial) {\r\n this._defaultMaterial = Scene.DefaultMaterialFactory(this);\r\n }\r\n return this._defaultMaterial;\r\n },\r\n /** The default material used on meshes when no material is affected */\r\n set: function (value) {\r\n this._defaultMaterial = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"texturesEnabled\", {\r\n get: function () {\r\n return this._texturesEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if textures are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._texturesEnabled === value) {\r\n return;\r\n }\r\n this._texturesEnabled = value;\r\n this.markAllMaterialsAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"skeletonsEnabled\", {\r\n get: function () {\r\n return this._skeletonsEnabled;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if skeletons are enabled on this scene\r\n */\r\n set: function (value) {\r\n if (this._skeletonsEnabled === value) {\r\n return;\r\n }\r\n this._skeletonsEnabled = value;\r\n this.markAllMaterialsAsDirty(8);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"collisionCoordinator\", {\r\n /** @hidden */\r\n get: function () {\r\n if (!this._collisionCoordinator) {\r\n this._collisionCoordinator = Scene.CollisionCoordinatorFactory();\r\n this._collisionCoordinator.init(this);\r\n }\r\n return this._collisionCoordinator;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"frustumPlanes\", {\r\n /**\r\n * Gets the list of frustum planes (built from the active camera)\r\n */\r\n get: function () {\r\n return this._frustumPlanes;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Registers the transient components if needed.\r\n */\r\n Scene.prototype._registerTransientComponents = function () {\r\n // Register components that have been associated lately to the scene.\r\n if (this._transientComponents.length > 0) {\r\n for (var _i = 0, _a = this._transientComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.register();\r\n }\r\n this._transientComponents = [];\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * Add a component to the scene.\r\n * Note that the ccomponent could be registered on th next frame if this is called after\r\n * the register component stage.\r\n * @param component Defines the component to add to the scene\r\n */\r\n Scene.prototype._addComponent = function (component) {\r\n this._components.push(component);\r\n this._transientComponents.push(component);\r\n var serializableComponent = component;\r\n if (serializableComponent.addFromContainer && serializableComponent.serialize) {\r\n this._serializableComponents.push(serializableComponent);\r\n }\r\n };\r\n /**\r\n * @hidden\r\n * Gets a component from the scene.\r\n * @param name defines the name of the component to retrieve\r\n * @returns the component or null if not present\r\n */\r\n Scene.prototype._getComponent = function (name) {\r\n for (var _i = 0, _a = this._components; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n if (component.name === name) {\r\n return component;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"Scene\" string\r\n */\r\n Scene.prototype.getClassName = function () {\r\n return \"Scene\";\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Scene.prototype._getDefaultMeshCandidates = function () {\r\n this._defaultMeshCandidates.data = this.meshes;\r\n this._defaultMeshCandidates.length = this.meshes.length;\r\n return this._defaultMeshCandidates;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n Scene.prototype._getDefaultSubMeshCandidates = function (mesh) {\r\n this._defaultSubMeshCandidates.data = mesh.subMeshes;\r\n this._defaultSubMeshCandidates.length = mesh.subMeshes.length;\r\n return this._defaultSubMeshCandidates;\r\n };\r\n /**\r\n * Sets the default candidate providers for the scene.\r\n * This sets the getActiveMeshCandidates, getActiveSubMeshCandidates, getIntersectingSubMeshCandidates\r\n * and getCollidingSubMeshCandidates to their default function\r\n */\r\n Scene.prototype.setDefaultCandidateProviders = function () {\r\n this.getActiveMeshCandidates = this._getDefaultMeshCandidates.bind(this);\r\n this.getActiveSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\r\n this.getIntersectingSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\r\n this.getCollidingSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\r\n };\r\n Object.defineProperty(Scene.prototype, \"meshUnderPointer\", {\r\n /**\r\n * Gets the mesh that is currently under the pointer\r\n */\r\n get: function () {\r\n return this._inputManager.meshUnderPointer;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"pointerX\", {\r\n /**\r\n * Gets or sets the current on-screen X position of the pointer\r\n */\r\n get: function () {\r\n return this._inputManager.pointerX;\r\n },\r\n set: function (value) {\r\n this._inputManager.pointerX = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Scene.prototype, \"pointerY\", {\r\n /**\r\n * Gets or sets the current on-screen Y position of the pointer\r\n */\r\n get: function () {\r\n return this._inputManager.pointerY;\r\n },\r\n set: function (value) {\r\n this._inputManager.pointerY = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the cached material (ie. the latest rendered one)\r\n * @returns the cached material\r\n */\r\n Scene.prototype.getCachedMaterial = function () {\r\n return this._cachedMaterial;\r\n };\r\n /**\r\n * Gets the cached effect (ie. the latest rendered one)\r\n * @returns the cached effect\r\n */\r\n Scene.prototype.getCachedEffect = function () {\r\n return this._cachedEffect;\r\n };\r\n /**\r\n * Gets the cached visibility state (ie. the latest rendered one)\r\n * @returns the cached visibility state\r\n */\r\n Scene.prototype.getCachedVisibility = function () {\r\n return this._cachedVisibility;\r\n };\r\n /**\r\n * Gets a boolean indicating if the current material / effect / visibility must be bind again\r\n * @param material defines the current material\r\n * @param effect defines the current effect\r\n * @param visibility defines the current visibility state\r\n * @returns true if one parameter is not cached\r\n */\r\n Scene.prototype.isCachedMaterialInvalid = function (material, effect, visibility) {\r\n if (visibility === void 0) { visibility = 1; }\r\n return this._cachedEffect !== effect || this._cachedMaterial !== material || this._cachedVisibility !== visibility;\r\n };\r\n /**\r\n * Gets the engine associated with the scene\r\n * @returns an Engine\r\n */\r\n Scene.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * Gets the total number of vertices rendered per frame\r\n * @returns the total number of vertices rendered per frame\r\n */\r\n Scene.prototype.getTotalVertices = function () {\r\n return this._totalVertices.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"totalVerticesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for total vertices\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._totalVertices;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the total number of active indices rendered per frame (You can deduce the number of rendered triangles by dividing this number by 3)\r\n * @returns the total number of active indices rendered per frame\r\n */\r\n Scene.prototype.getActiveIndices = function () {\r\n return this._activeIndices.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"totalActiveIndicesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for active indices\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._activeIndices;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the total number of active particles rendered per frame\r\n * @returns the total number of active particles rendered per frame\r\n */\r\n Scene.prototype.getActiveParticles = function () {\r\n return this._activeParticles.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"activeParticlesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for active particles\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._activeParticles;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the total number of active bones rendered per frame\r\n * @returns the total number of active bones rendered per frame\r\n */\r\n Scene.prototype.getActiveBones = function () {\r\n return this._activeBones.current;\r\n };\r\n Object.defineProperty(Scene.prototype, \"activeBonesPerfCounter\", {\r\n /**\r\n * Gets the performance counter for active bones\r\n * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#instrumentation\r\n */\r\n get: function () {\r\n return this._activeBones;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the array of active meshes\r\n * @returns an array of AbstractMesh\r\n */\r\n Scene.prototype.getActiveMeshes = function () {\r\n return this._activeMeshes;\r\n };\r\n /**\r\n * Gets the animation ratio (which is 1.0 is the scene renders at 60fps and 2 if the scene renders at 30fps, etc.)\r\n * @returns a number\r\n */\r\n Scene.prototype.getAnimationRatio = function () {\r\n return this._animationRatio !== undefined ? this._animationRatio : 1;\r\n };\r\n /**\r\n * Gets an unique Id for the current render phase\r\n * @returns a number\r\n */\r\n Scene.prototype.getRenderId = function () {\r\n return this._renderId;\r\n };\r\n /**\r\n * Gets an unique Id for the current frame\r\n * @returns a number\r\n */\r\n Scene.prototype.getFrameId = function () {\r\n return this._frameId;\r\n };\r\n /** Call this function if you want to manually increment the render Id*/\r\n Scene.prototype.incrementRenderId = function () {\r\n this._renderId++;\r\n };\r\n Scene.prototype._createUbo = function () {\r\n this._sceneUbo = new UniformBuffer(this._engine, undefined, true);\r\n this._sceneUbo.addUniform(\"viewProjection\", 16);\r\n this._sceneUbo.addUniform(\"view\", 16);\r\n };\r\n /**\r\n * Use this method to simulate a pointer move on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.simulatePointerMove = function (pickResult, pointerEventInit) {\r\n this._inputManager.simulatePointerMove(pickResult, pointerEventInit);\r\n return this;\r\n };\r\n /**\r\n * Use this method to simulate a pointer down on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.simulatePointerDown = function (pickResult, pointerEventInit) {\r\n this._inputManager.simulatePointerDown(pickResult, pointerEventInit);\r\n return this;\r\n };\r\n /**\r\n * Use this method to simulate a pointer up on a mesh\r\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\r\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\r\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\r\n * @param doubleTap indicates that the pointer up event should be considered as part of a double click (false by default)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.simulatePointerUp = function (pickResult, pointerEventInit, doubleTap) {\r\n this._inputManager.simulatePointerUp(pickResult, pointerEventInit, doubleTap);\r\n return this;\r\n };\r\n /**\r\n * Gets a boolean indicating if the current pointer event is captured (meaning that the scene has already handled the pointer down)\r\n * @param pointerId defines the pointer id to use in a multi-touch scenario (0 by default)\r\n * @returns true if the pointer was captured\r\n */\r\n Scene.prototype.isPointerCaptured = function (pointerId) {\r\n if (pointerId === void 0) { pointerId = 0; }\r\n return this._inputManager.isPointerCaptured(pointerId);\r\n };\r\n /**\r\n * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp\r\n * @param attachUp defines if you want to attach events to pointerup\r\n * @param attachDown defines if you want to attach events to pointerdown\r\n * @param attachMove defines if you want to attach events to pointermove\r\n */\r\n Scene.prototype.attachControl = function (attachUp, attachDown, attachMove) {\r\n if (attachUp === void 0) { attachUp = true; }\r\n if (attachDown === void 0) { attachDown = true; }\r\n if (attachMove === void 0) { attachMove = true; }\r\n this._inputManager.attachControl(attachUp, attachDown, attachMove);\r\n };\r\n /** Detaches all event handlers*/\r\n Scene.prototype.detachControl = function () {\r\n this._inputManager.detachControl();\r\n };\r\n /**\r\n * This function will check if the scene can be rendered (textures are loaded, shaders are compiled)\r\n * Delay loaded resources are not taking in account\r\n * @return true if all required resources are ready\r\n */\r\n Scene.prototype.isReady = function () {\r\n if (this._isDisposed) {\r\n return false;\r\n }\r\n var index;\r\n var engine = this.getEngine();\r\n // Effects\r\n if (!engine.areAllEffectsReady()) {\r\n return false;\r\n }\r\n // Pending data\r\n if (this._pendingData.length > 0) {\r\n return false;\r\n }\r\n // Meshes\r\n for (index = 0; index < this.meshes.length; index++) {\r\n var mesh = this.meshes[index];\r\n if (!mesh.isEnabled()) {\r\n continue;\r\n }\r\n if (!mesh.subMeshes || mesh.subMeshes.length === 0) {\r\n continue;\r\n }\r\n if (!mesh.isReady(true)) {\r\n return false;\r\n }\r\n var hardwareInstancedRendering = mesh.hasThinInstances || mesh.getClassName() === \"InstancedMesh\" || mesh.getClassName() === \"InstancedLinesMesh\" || engine.getCaps().instancedArrays && mesh.instances.length > 0;\r\n // Is Ready For Mesh\r\n for (var _i = 0, _a = this._isReadyForMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n if (!step.action(mesh, hardwareInstancedRendering)) {\r\n return false;\r\n }\r\n }\r\n }\r\n // Geometries\r\n for (index = 0; index < this.geometries.length; index++) {\r\n var geometry = this.geometries[index];\r\n if (geometry.delayLoadState === 2) {\r\n return false;\r\n }\r\n }\r\n // Post-processes\r\n if (this.activeCameras && this.activeCameras.length > 0) {\r\n for (var _b = 0, _c = this.activeCameras; _b < _c.length; _b++) {\r\n var camera = _c[_b];\r\n if (!camera.isReady(true)) {\r\n return false;\r\n }\r\n }\r\n }\r\n else if (this.activeCamera) {\r\n if (!this.activeCamera.isReady(true)) {\r\n return false;\r\n }\r\n }\r\n // Particles\r\n for (var _d = 0, _e = this.particleSystems; _d < _e.length; _d++) {\r\n var particleSystem = _e[_d];\r\n if (!particleSystem.isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n /** Resets all cached information relative to material (including effect and visibility) */\r\n Scene.prototype.resetCachedMaterial = function () {\r\n this._cachedMaterial = null;\r\n this._cachedEffect = null;\r\n this._cachedVisibility = null;\r\n };\r\n /**\r\n * Registers a function to be called before every frame render\r\n * @param func defines the function to register\r\n */\r\n Scene.prototype.registerBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.add(func);\r\n };\r\n /**\r\n * Unregisters a function called before every frame render\r\n * @param func defines the function to unregister\r\n */\r\n Scene.prototype.unregisterBeforeRender = function (func) {\r\n this.onBeforeRenderObservable.removeCallback(func);\r\n };\r\n /**\r\n * Registers a function to be called after every frame render\r\n * @param func defines the function to register\r\n */\r\n Scene.prototype.registerAfterRender = function (func) {\r\n this.onAfterRenderObservable.add(func);\r\n };\r\n /**\r\n * Unregisters a function called after every frame render\r\n * @param func defines the function to unregister\r\n */\r\n Scene.prototype.unregisterAfterRender = function (func) {\r\n this.onAfterRenderObservable.removeCallback(func);\r\n };\r\n Scene.prototype._executeOnceBeforeRender = function (func) {\r\n var _this = this;\r\n var execFunc = function () {\r\n func();\r\n setTimeout(function () {\r\n _this.unregisterBeforeRender(execFunc);\r\n });\r\n };\r\n this.registerBeforeRender(execFunc);\r\n };\r\n /**\r\n * The provided function will run before render once and will be disposed afterwards.\r\n * A timeout delay can be provided so that the function will be executed in N ms.\r\n * The timeout is using the browser's native setTimeout so time percision cannot be guaranteed.\r\n * @param func The function to be executed.\r\n * @param timeout optional delay in ms\r\n */\r\n Scene.prototype.executeOnceBeforeRender = function (func, timeout) {\r\n var _this = this;\r\n if (timeout !== undefined) {\r\n setTimeout(function () {\r\n _this._executeOnceBeforeRender(func);\r\n }, timeout);\r\n }\r\n else {\r\n this._executeOnceBeforeRender(func);\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._addPendingData = function (data) {\r\n this._pendingData.push(data);\r\n };\r\n /** @hidden */\r\n Scene.prototype._removePendingData = function (data) {\r\n var wasLoading = this.isLoading;\r\n var index = this._pendingData.indexOf(data);\r\n if (index !== -1) {\r\n this._pendingData.splice(index, 1);\r\n }\r\n if (wasLoading && !this.isLoading) {\r\n this.onDataLoadedObservable.notifyObservers(this);\r\n }\r\n };\r\n /**\r\n * Returns the number of items waiting to be loaded\r\n * @returns the number of items waiting to be loaded\r\n */\r\n Scene.prototype.getWaitingItemsCount = function () {\r\n return this._pendingData.length;\r\n };\r\n Object.defineProperty(Scene.prototype, \"isLoading\", {\r\n /**\r\n * Returns a boolean indicating if the scene is still loading data\r\n */\r\n get: function () {\r\n return this._pendingData.length > 0;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Registers a function to be executed when the scene is ready\r\n * @param {Function} func - the function to be executed\r\n */\r\n Scene.prototype.executeWhenReady = function (func) {\r\n var _this = this;\r\n this.onReadyObservable.add(func);\r\n if (this._executeWhenReadyTimeoutId !== -1) {\r\n return;\r\n }\r\n this._executeWhenReadyTimeoutId = setTimeout(function () {\r\n _this._checkIsReady();\r\n }, 150);\r\n };\r\n /**\r\n * Returns a promise that resolves when the scene is ready\r\n * @returns A promise that resolves when the scene is ready\r\n */\r\n Scene.prototype.whenReadyAsync = function () {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _this.executeWhenReady(function () {\r\n resolve();\r\n });\r\n });\r\n };\r\n /** @hidden */\r\n Scene.prototype._checkIsReady = function () {\r\n var _this = this;\r\n this._registerTransientComponents();\r\n if (this.isReady()) {\r\n this.onReadyObservable.notifyObservers(this);\r\n this.onReadyObservable.clear();\r\n this._executeWhenReadyTimeoutId = -1;\r\n return;\r\n }\r\n if (this._isDisposed) {\r\n this.onReadyObservable.clear();\r\n this._executeWhenReadyTimeoutId = -1;\r\n return;\r\n }\r\n this._executeWhenReadyTimeoutId = setTimeout(function () {\r\n _this._checkIsReady();\r\n }, 150);\r\n };\r\n Object.defineProperty(Scene.prototype, \"animatables\", {\r\n /**\r\n * Gets all animatable attached to the scene\r\n */\r\n get: function () {\r\n return this._activeAnimatables;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Resets the last animation time frame.\r\n * Useful to override when animations start running when loading a scene for the first time.\r\n */\r\n Scene.prototype.resetLastAnimationTimeFrame = function () {\r\n this._animationTimeLast = PrecisionDate.Now;\r\n };\r\n // Matrix\r\n /**\r\n * Gets the current view matrix\r\n * @returns a Matrix\r\n */\r\n Scene.prototype.getViewMatrix = function () {\r\n return this._viewMatrix;\r\n };\r\n /**\r\n * Gets the current projection matrix\r\n * @returns a Matrix\r\n */\r\n Scene.prototype.getProjectionMatrix = function () {\r\n return this._projectionMatrix;\r\n };\r\n /**\r\n * Gets the current transform matrix\r\n * @returns a Matrix made of View * Projection\r\n */\r\n Scene.prototype.getTransformMatrix = function () {\r\n return this._transformMatrix;\r\n };\r\n /**\r\n * Sets the current transform matrix\r\n * @param viewL defines the View matrix to use\r\n * @param projectionL defines the Projection matrix to use\r\n * @param viewR defines the right View matrix to use (if provided)\r\n * @param projectionR defines the right Projection matrix to use (if provided)\r\n */\r\n Scene.prototype.setTransformMatrix = function (viewL, projectionL, viewR, projectionR) {\r\n if (this._viewUpdateFlag === viewL.updateFlag && this._projectionUpdateFlag === projectionL.updateFlag) {\r\n return;\r\n }\r\n this._viewUpdateFlag = viewL.updateFlag;\r\n this._projectionUpdateFlag = projectionL.updateFlag;\r\n this._viewMatrix = viewL;\r\n this._projectionMatrix = projectionL;\r\n this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);\r\n // Update frustum\r\n if (!this._frustumPlanes) {\r\n this._frustumPlanes = Frustum.GetPlanes(this._transformMatrix);\r\n }\r\n else {\r\n Frustum.GetPlanesToRef(this._transformMatrix, this._frustumPlanes);\r\n }\r\n if (this._multiviewSceneUbo && this._multiviewSceneUbo.useUbo) {\r\n this._updateMultiviewUbo(viewR, projectionR);\r\n }\r\n else if (this._sceneUbo.useUbo) {\r\n this._sceneUbo.updateMatrix(\"viewProjection\", this._transformMatrix);\r\n this._sceneUbo.updateMatrix(\"view\", this._viewMatrix);\r\n this._sceneUbo.update();\r\n }\r\n };\r\n /**\r\n * Gets the uniform buffer used to store scene data\r\n * @returns a UniformBuffer\r\n */\r\n Scene.prototype.getSceneUniformBuffer = function () {\r\n return this._multiviewSceneUbo ? this._multiviewSceneUbo : this._sceneUbo;\r\n };\r\n /**\r\n * Gets an unique (relatively to the current scene) Id\r\n * @returns an unique number for the scene\r\n */\r\n Scene.prototype.getUniqueId = function () {\r\n return UniqueIdGenerator.UniqueId;\r\n };\r\n /**\r\n * Add a mesh to the list of scene's meshes\r\n * @param newMesh defines the mesh to add\r\n * @param recursive if all child meshes should also be added to the scene\r\n */\r\n Scene.prototype.addMesh = function (newMesh, recursive) {\r\n var _this = this;\r\n if (recursive === void 0) { recursive = false; }\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.meshes.push(newMesh);\r\n newMesh._resyncLightSources();\r\n if (!newMesh.parent) {\r\n newMesh._addToSceneRootNodes();\r\n }\r\n this.onNewMeshAddedObservable.notifyObservers(newMesh);\r\n if (recursive) {\r\n newMesh.getChildMeshes().forEach(function (m) {\r\n _this.addMesh(m);\r\n });\r\n }\r\n };\r\n /**\r\n * Remove a mesh for the list of scene's meshes\r\n * @param toRemove defines the mesh to remove\r\n * @param recursive if all child meshes should also be removed from the scene\r\n * @returns the index where the mesh was in the mesh list\r\n */\r\n Scene.prototype.removeMesh = function (toRemove, recursive) {\r\n var _this = this;\r\n if (recursive === void 0) { recursive = false; }\r\n var index = this.meshes.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if mesh found\r\n this.meshes[index] = this.meshes[this.meshes.length - 1];\r\n this.meshes.pop();\r\n if (!toRemove.parent) {\r\n toRemove._removeFromSceneRootNodes();\r\n }\r\n }\r\n this.onMeshRemovedObservable.notifyObservers(toRemove);\r\n if (recursive) {\r\n toRemove.getChildMeshes().forEach(function (m) {\r\n _this.removeMesh(m);\r\n });\r\n }\r\n return index;\r\n };\r\n /**\r\n * Add a transform node to the list of scene's transform nodes\r\n * @param newTransformNode defines the transform node to add\r\n */\r\n Scene.prototype.addTransformNode = function (newTransformNode) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n newTransformNode._indexInSceneTransformNodesArray = this.transformNodes.length;\r\n this.transformNodes.push(newTransformNode);\r\n if (!newTransformNode.parent) {\r\n newTransformNode._addToSceneRootNodes();\r\n }\r\n this.onNewTransformNodeAddedObservable.notifyObservers(newTransformNode);\r\n };\r\n /**\r\n * Remove a transform node for the list of scene's transform nodes\r\n * @param toRemove defines the transform node to remove\r\n * @returns the index where the transform node was in the transform node list\r\n */\r\n Scene.prototype.removeTransformNode = function (toRemove) {\r\n var index = toRemove._indexInSceneTransformNodesArray;\r\n if (index !== -1) {\r\n if (index !== this.transformNodes.length - 1) {\r\n var lastNode = this.transformNodes[this.transformNodes.length - 1];\r\n this.transformNodes[index] = lastNode;\r\n lastNode._indexInSceneTransformNodesArray = index;\r\n }\r\n toRemove._indexInSceneTransformNodesArray = -1;\r\n this.transformNodes.pop();\r\n if (!toRemove.parent) {\r\n toRemove._removeFromSceneRootNodes();\r\n }\r\n }\r\n this.onTransformNodeRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Remove a skeleton for the list of scene's skeletons\r\n * @param toRemove defines the skeleton to remove\r\n * @returns the index where the skeleton was in the skeleton list\r\n */\r\n Scene.prototype.removeSkeleton = function (toRemove) {\r\n var index = this.skeletons.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if found\r\n this.skeletons.splice(index, 1);\r\n this.onSkeletonRemovedObservable.notifyObservers(toRemove);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Remove a morph target for the list of scene's morph targets\r\n * @param toRemove defines the morph target to remove\r\n * @returns the index where the morph target was in the morph target list\r\n */\r\n Scene.prototype.removeMorphTargetManager = function (toRemove) {\r\n var index = this.morphTargetManagers.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if found\r\n this.morphTargetManagers.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Remove a light for the list of scene's lights\r\n * @param toRemove defines the light to remove\r\n * @returns the index where the light was in the light list\r\n */\r\n Scene.prototype.removeLight = function (toRemove) {\r\n var index = this.lights.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from meshes\r\n for (var _i = 0, _a = this.meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n mesh._removeLightSource(toRemove, false);\r\n }\r\n // Remove from the scene if mesh found\r\n this.lights.splice(index, 1);\r\n this.sortLightsByPriority();\r\n if (!toRemove.parent) {\r\n toRemove._removeFromSceneRootNodes();\r\n }\r\n }\r\n this.onLightRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Remove a camera for the list of scene's cameras\r\n * @param toRemove defines the camera to remove\r\n * @returns the index where the camera was in the camera list\r\n */\r\n Scene.prototype.removeCamera = function (toRemove) {\r\n var index = this.cameras.indexOf(toRemove);\r\n if (index !== -1) {\r\n // Remove from the scene if mesh found\r\n this.cameras.splice(index, 1);\r\n if (!toRemove.parent) {\r\n toRemove._removeFromSceneRootNodes();\r\n }\r\n }\r\n // Remove from activeCameras\r\n if (this.activeCameras) {\r\n var index2 = this.activeCameras.indexOf(toRemove);\r\n if (index2 !== -1) {\r\n // Remove from the scene if mesh found\r\n this.activeCameras.splice(index2, 1);\r\n }\r\n }\r\n // Reset the activeCamera\r\n if (this.activeCamera === toRemove) {\r\n if (this.cameras.length > 0) {\r\n this.activeCamera = this.cameras[0];\r\n }\r\n else {\r\n this.activeCamera = null;\r\n }\r\n }\r\n this.onCameraRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Remove a particle system for the list of scene's particle systems\r\n * @param toRemove defines the particle system to remove\r\n * @returns the index where the particle system was in the particle system list\r\n */\r\n Scene.prototype.removeParticleSystem = function (toRemove) {\r\n var index = this.particleSystems.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.particleSystems.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Remove a animation for the list of scene's animations\r\n * @param toRemove defines the animation to remove\r\n * @returns the index where the animation was in the animation list\r\n */\r\n Scene.prototype.removeAnimation = function (toRemove) {\r\n var index = this.animations.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.animations.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Will stop the animation of the given target\r\n * @param target - the target\r\n * @param animationName - the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)\r\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n */\r\n Scene.prototype.stopAnimation = function (target, animationName, targetMask) {\r\n // Do nothing as code will be provided by animation component\r\n };\r\n /**\r\n * Removes the given animation group from this scene.\r\n * @param toRemove The animation group to remove\r\n * @returns The index of the removed animation group\r\n */\r\n Scene.prototype.removeAnimationGroup = function (toRemove) {\r\n var index = this.animationGroups.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.animationGroups.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Removes the given multi-material from this scene.\r\n * @param toRemove The multi-material to remove\r\n * @returns The index of the removed multi-material\r\n */\r\n Scene.prototype.removeMultiMaterial = function (toRemove) {\r\n var index = this.multiMaterials.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.multiMaterials.splice(index, 1);\r\n }\r\n this.onMultiMaterialRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Removes the given material from this scene.\r\n * @param toRemove The material to remove\r\n * @returns The index of the removed material\r\n */\r\n Scene.prototype.removeMaterial = function (toRemove) {\r\n var index = toRemove._indexInSceneMaterialArray;\r\n if (index !== -1 && index < this.materials.length) {\r\n if (index !== this.materials.length - 1) {\r\n var lastMaterial = this.materials[this.materials.length - 1];\r\n this.materials[index] = lastMaterial;\r\n lastMaterial._indexInSceneMaterialArray = index;\r\n }\r\n toRemove._indexInSceneMaterialArray = -1;\r\n this.materials.pop();\r\n }\r\n this.onMaterialRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Removes the given action manager from this scene.\r\n * @param toRemove The action manager to remove\r\n * @returns The index of the removed action manager\r\n */\r\n Scene.prototype.removeActionManager = function (toRemove) {\r\n var index = this.actionManagers.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.actionManagers.splice(index, 1);\r\n }\r\n return index;\r\n };\r\n /**\r\n * Removes the given texture from this scene.\r\n * @param toRemove The texture to remove\r\n * @returns The index of the removed texture\r\n */\r\n Scene.prototype.removeTexture = function (toRemove) {\r\n var index = this.textures.indexOf(toRemove);\r\n if (index !== -1) {\r\n this.textures.splice(index, 1);\r\n }\r\n this.onTextureRemovedObservable.notifyObservers(toRemove);\r\n return index;\r\n };\r\n /**\r\n * Adds the given light to this scene\r\n * @param newLight The light to add\r\n */\r\n Scene.prototype.addLight = function (newLight) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.lights.push(newLight);\r\n this.sortLightsByPriority();\r\n if (!newLight.parent) {\r\n newLight._addToSceneRootNodes();\r\n }\r\n // Add light to all meshes (To support if the light is removed and then re-added)\r\n for (var _i = 0, _a = this.meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n if (mesh.lightSources.indexOf(newLight) === -1) {\r\n mesh.lightSources.push(newLight);\r\n mesh._resyncLightSources();\r\n }\r\n }\r\n this.onNewLightAddedObservable.notifyObservers(newLight);\r\n };\r\n /**\r\n * Sorts the list list based on light priorities\r\n */\r\n Scene.prototype.sortLightsByPriority = function () {\r\n if (this.requireLightSorting) {\r\n this.lights.sort(Light.CompareLightsPriority);\r\n }\r\n };\r\n /**\r\n * Adds the given camera to this scene\r\n * @param newCamera The camera to add\r\n */\r\n Scene.prototype.addCamera = function (newCamera) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.cameras.push(newCamera);\r\n this.onNewCameraAddedObservable.notifyObservers(newCamera);\r\n if (!newCamera.parent) {\r\n newCamera._addToSceneRootNodes();\r\n }\r\n };\r\n /**\r\n * Adds the given skeleton to this scene\r\n * @param newSkeleton The skeleton to add\r\n */\r\n Scene.prototype.addSkeleton = function (newSkeleton) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.skeletons.push(newSkeleton);\r\n this.onNewSkeletonAddedObservable.notifyObservers(newSkeleton);\r\n };\r\n /**\r\n * Adds the given particle system to this scene\r\n * @param newParticleSystem The particle system to add\r\n */\r\n Scene.prototype.addParticleSystem = function (newParticleSystem) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.particleSystems.push(newParticleSystem);\r\n };\r\n /**\r\n * Adds the given animation to this scene\r\n * @param newAnimation The animation to add\r\n */\r\n Scene.prototype.addAnimation = function (newAnimation) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.animations.push(newAnimation);\r\n };\r\n /**\r\n * Adds the given animation group to this scene.\r\n * @param newAnimationGroup The animation group to add\r\n */\r\n Scene.prototype.addAnimationGroup = function (newAnimationGroup) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.animationGroups.push(newAnimationGroup);\r\n };\r\n /**\r\n * Adds the given multi-material to this scene\r\n * @param newMultiMaterial The multi-material to add\r\n */\r\n Scene.prototype.addMultiMaterial = function (newMultiMaterial) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.multiMaterials.push(newMultiMaterial);\r\n this.onNewMultiMaterialAddedObservable.notifyObservers(newMultiMaterial);\r\n };\r\n /**\r\n * Adds the given material to this scene\r\n * @param newMaterial The material to add\r\n */\r\n Scene.prototype.addMaterial = function (newMaterial) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n newMaterial._indexInSceneMaterialArray = this.materials.length;\r\n this.materials.push(newMaterial);\r\n this.onNewMaterialAddedObservable.notifyObservers(newMaterial);\r\n };\r\n /**\r\n * Adds the given morph target to this scene\r\n * @param newMorphTargetManager The morph target to add\r\n */\r\n Scene.prototype.addMorphTargetManager = function (newMorphTargetManager) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.morphTargetManagers.push(newMorphTargetManager);\r\n };\r\n /**\r\n * Adds the given geometry to this scene\r\n * @param newGeometry The geometry to add\r\n */\r\n Scene.prototype.addGeometry = function (newGeometry) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n if (this.geometriesByUniqueId) {\r\n this.geometriesByUniqueId[newGeometry.uniqueId] = this.geometries.length;\r\n }\r\n this.geometries.push(newGeometry);\r\n };\r\n /**\r\n * Adds the given action manager to this scene\r\n * @param newActionManager The action manager to add\r\n */\r\n Scene.prototype.addActionManager = function (newActionManager) {\r\n this.actionManagers.push(newActionManager);\r\n };\r\n /**\r\n * Adds the given texture to this scene.\r\n * @param newTexture The texture to add\r\n */\r\n Scene.prototype.addTexture = function (newTexture) {\r\n if (this._blockEntityCollection) {\r\n return;\r\n }\r\n this.textures.push(newTexture);\r\n this.onNewTextureAddedObservable.notifyObservers(newTexture);\r\n };\r\n /**\r\n * Switch active camera\r\n * @param newCamera defines the new active camera\r\n * @param attachControl defines if attachControl must be called for the new active camera (default: true)\r\n */\r\n Scene.prototype.switchActiveCamera = function (newCamera, attachControl) {\r\n if (attachControl === void 0) { attachControl = true; }\r\n var canvas = this._engine.getInputElement();\r\n if (!canvas) {\r\n return;\r\n }\r\n if (this.activeCamera) {\r\n this.activeCamera.detachControl();\r\n }\r\n this.activeCamera = newCamera;\r\n if (attachControl) {\r\n newCamera.attachControl();\r\n }\r\n };\r\n /**\r\n * sets the active camera of the scene using its ID\r\n * @param id defines the camera's ID\r\n * @return the new active camera or null if none found.\r\n */\r\n Scene.prototype.setActiveCameraByID = function (id) {\r\n var camera = this.getCameraByID(id);\r\n if (camera) {\r\n this.activeCamera = camera;\r\n return camera;\r\n }\r\n return null;\r\n };\r\n /**\r\n * sets the active camera of the scene using its name\r\n * @param name defines the camera's name\r\n * @returns the new active camera or null if none found.\r\n */\r\n Scene.prototype.setActiveCameraByName = function (name) {\r\n var camera = this.getCameraByName(name);\r\n if (camera) {\r\n this.activeCamera = camera;\r\n return camera;\r\n }\r\n return null;\r\n };\r\n /**\r\n * get an animation group using its name\r\n * @param name defines the material's name\r\n * @return the animation group or null if none found.\r\n */\r\n Scene.prototype.getAnimationGroupByName = function (name) {\r\n for (var index = 0; index < this.animationGroups.length; index++) {\r\n if (this.animationGroups[index].name === name) {\r\n return this.animationGroups[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Get a material using its unique id\r\n * @param uniqueId defines the material's unique id\r\n * @return the material or null if none found.\r\n */\r\n Scene.prototype.getMaterialByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.materials.length; index++) {\r\n if (this.materials[index].uniqueId === uniqueId) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * get a material using its id\r\n * @param id defines the material's ID\r\n * @return the material or null if none found.\r\n */\r\n Scene.prototype.getMaterialByID = function (id) {\r\n for (var index = 0; index < this.materials.length; index++) {\r\n if (this.materials[index].id === id) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a the last added material using a given id\r\n * @param id defines the material's ID\r\n * @return the last material with the given id or null if none found.\r\n */\r\n Scene.prototype.getLastMaterialByID = function (id) {\r\n for (var index = this.materials.length - 1; index >= 0; index--) {\r\n if (this.materials[index].id === id) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a material using its name\r\n * @param name defines the material's name\r\n * @return the material or null if none found.\r\n */\r\n Scene.prototype.getMaterialByName = function (name) {\r\n for (var index = 0; index < this.materials.length; index++) {\r\n if (this.materials[index].name === name) {\r\n return this.materials[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Get a texture using its unique id\r\n * @param uniqueId defines the texture's unique id\r\n * @return the texture or null if none found.\r\n */\r\n Scene.prototype.getTextureByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.textures.length; index++) {\r\n if (this.textures[index].uniqueId === uniqueId) {\r\n return this.textures[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a camera using its id\r\n * @param id defines the id to look for\r\n * @returns the camera or null if not found\r\n */\r\n Scene.prototype.getCameraByID = function (id) {\r\n for (var index = 0; index < this.cameras.length; index++) {\r\n if (this.cameras[index].id === id) {\r\n return this.cameras[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a camera using its unique id\r\n * @param uniqueId defines the unique id to look for\r\n * @returns the camera or null if not found\r\n */\r\n Scene.prototype.getCameraByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.cameras.length; index++) {\r\n if (this.cameras[index].uniqueId === uniqueId) {\r\n return this.cameras[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a camera using its name\r\n * @param name defines the camera's name\r\n * @return the camera or null if none found.\r\n */\r\n Scene.prototype.getCameraByName = function (name) {\r\n for (var index = 0; index < this.cameras.length; index++) {\r\n if (this.cameras[index].name === name) {\r\n return this.cameras[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a bone using its id\r\n * @param id defines the bone's id\r\n * @return the bone or null if not found\r\n */\r\n Scene.prototype.getBoneByID = function (id) {\r\n for (var skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {\r\n var skeleton = this.skeletons[skeletonIndex];\r\n for (var boneIndex = 0; boneIndex < skeleton.bones.length; boneIndex++) {\r\n if (skeleton.bones[boneIndex].id === id) {\r\n return skeleton.bones[boneIndex];\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a bone using its id\r\n * @param name defines the bone's name\r\n * @return the bone or null if not found\r\n */\r\n Scene.prototype.getBoneByName = function (name) {\r\n for (var skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {\r\n var skeleton = this.skeletons[skeletonIndex];\r\n for (var boneIndex = 0; boneIndex < skeleton.bones.length; boneIndex++) {\r\n if (skeleton.bones[boneIndex].name === name) {\r\n return skeleton.bones[boneIndex];\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a light node using its name\r\n * @param name defines the the light's name\r\n * @return the light or null if none found.\r\n */\r\n Scene.prototype.getLightByName = function (name) {\r\n for (var index = 0; index < this.lights.length; index++) {\r\n if (this.lights[index].name === name) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a light node using its id\r\n * @param id defines the light's id\r\n * @return the light or null if none found.\r\n */\r\n Scene.prototype.getLightByID = function (id) {\r\n for (var index = 0; index < this.lights.length; index++) {\r\n if (this.lights[index].id === id) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a light node using its scene-generated unique ID\r\n * @param uniqueId defines the light's unique id\r\n * @return the light or null if none found.\r\n */\r\n Scene.prototype.getLightByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.lights.length; index++) {\r\n if (this.lights[index].uniqueId === uniqueId) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a particle system by id\r\n * @param id defines the particle system id\r\n * @return the corresponding system or null if none found\r\n */\r\n Scene.prototype.getParticleSystemByID = function (id) {\r\n for (var index = 0; index < this.particleSystems.length; index++) {\r\n if (this.particleSystems[index].id === id) {\r\n return this.particleSystems[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a geometry using its ID\r\n * @param id defines the geometry's id\r\n * @return the geometry or null if none found.\r\n */\r\n Scene.prototype.getGeometryByID = function (id) {\r\n for (var index = 0; index < this.geometries.length; index++) {\r\n if (this.geometries[index].id === id) {\r\n return this.geometries[index];\r\n }\r\n }\r\n return null;\r\n };\r\n Scene.prototype._getGeometryByUniqueID = function (uniqueId) {\r\n if (this.geometriesByUniqueId) {\r\n var index_1 = this.geometriesByUniqueId[uniqueId];\r\n if (index_1 !== undefined) {\r\n return this.geometries[index_1];\r\n }\r\n }\r\n else {\r\n for (var index = 0; index < this.geometries.length; index++) {\r\n if (this.geometries[index].uniqueId === uniqueId) {\r\n return this.geometries[index];\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Add a new geometry to this scene\r\n * @param geometry defines the geometry to be added to the scene.\r\n * @param force defines if the geometry must be pushed even if a geometry with this id already exists\r\n * @return a boolean defining if the geometry was added or not\r\n */\r\n Scene.prototype.pushGeometry = function (geometry, force) {\r\n if (!force && this._getGeometryByUniqueID(geometry.uniqueId)) {\r\n return false;\r\n }\r\n this.addGeometry(geometry);\r\n this.onNewGeometryAddedObservable.notifyObservers(geometry);\r\n return true;\r\n };\r\n /**\r\n * Removes an existing geometry\r\n * @param geometry defines the geometry to be removed from the scene\r\n * @return a boolean defining if the geometry was removed or not\r\n */\r\n Scene.prototype.removeGeometry = function (geometry) {\r\n var index;\r\n if (this.geometriesByUniqueId) {\r\n index = this.geometriesByUniqueId[geometry.uniqueId];\r\n if (index === undefined) {\r\n return false;\r\n }\r\n }\r\n else {\r\n index = this.geometries.indexOf(geometry);\r\n if (index < 0) {\r\n return false;\r\n }\r\n }\r\n if (index !== this.geometries.length - 1) {\r\n var lastGeometry = this.geometries[this.geometries.length - 1];\r\n if (lastGeometry) {\r\n this.geometries[index] = lastGeometry;\r\n if (this.geometriesByUniqueId) {\r\n this.geometriesByUniqueId[lastGeometry.uniqueId] = index;\r\n this.geometriesByUniqueId[geometry.uniqueId] = undefined;\r\n }\r\n }\r\n }\r\n this.geometries.pop();\r\n this.onGeometryRemovedObservable.notifyObservers(geometry);\r\n return true;\r\n };\r\n /**\r\n * Gets the list of geometries attached to the scene\r\n * @returns an array of Geometry\r\n */\r\n Scene.prototype.getGeometries = function () {\r\n return this.geometries;\r\n };\r\n /**\r\n * Gets the first added mesh found of a given ID\r\n * @param id defines the id to search for\r\n * @return the mesh found or null if not found at all\r\n */\r\n Scene.prototype.getMeshByID = function (id) {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n if (this.meshes[index].id === id) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a list of meshes using their id\r\n * @param id defines the id to search for\r\n * @returns a list of meshes\r\n */\r\n Scene.prototype.getMeshesByID = function (id) {\r\n return this.meshes.filter(function (m) {\r\n return m.id === id;\r\n });\r\n };\r\n /**\r\n * Gets the first added transform node found of a given ID\r\n * @param id defines the id to search for\r\n * @return the found transform node or null if not found at all.\r\n */\r\n Scene.prototype.getTransformNodeByID = function (id) {\r\n for (var index = 0; index < this.transformNodes.length; index++) {\r\n if (this.transformNodes[index].id === id) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a transform node with its auto-generated unique id\r\n * @param uniqueId efines the unique id to search for\r\n * @return the found transform node or null if not found at all.\r\n */\r\n Scene.prototype.getTransformNodeByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.transformNodes.length; index++) {\r\n if (this.transformNodes[index].uniqueId === uniqueId) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a list of transform nodes using their id\r\n * @param id defines the id to search for\r\n * @returns a list of transform nodes\r\n */\r\n Scene.prototype.getTransformNodesByID = function (id) {\r\n return this.transformNodes.filter(function (m) {\r\n return m.id === id;\r\n });\r\n };\r\n /**\r\n * Gets a mesh with its auto-generated unique id\r\n * @param uniqueId defines the unique id to search for\r\n * @return the found mesh or null if not found at all.\r\n */\r\n Scene.prototype.getMeshByUniqueID = function (uniqueId) {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n if (this.meshes[index].uniqueId === uniqueId) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a the last added mesh using a given id\r\n * @param id defines the id to search for\r\n * @return the found mesh or null if not found at all.\r\n */\r\n Scene.prototype.getLastMeshByID = function (id) {\r\n for (var index = this.meshes.length - 1; index >= 0; index--) {\r\n if (this.meshes[index].id === id) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a the last added node (Mesh, Camera, Light) using a given id\r\n * @param id defines the id to search for\r\n * @return the found node or null if not found at all\r\n */\r\n Scene.prototype.getLastEntryByID = function (id) {\r\n var index;\r\n for (index = this.meshes.length - 1; index >= 0; index--) {\r\n if (this.meshes[index].id === id) {\r\n return this.meshes[index];\r\n }\r\n }\r\n for (index = this.transformNodes.length - 1; index >= 0; index--) {\r\n if (this.transformNodes[index].id === id) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n for (index = this.cameras.length - 1; index >= 0; index--) {\r\n if (this.cameras[index].id === id) {\r\n return this.cameras[index];\r\n }\r\n }\r\n for (index = this.lights.length - 1; index >= 0; index--) {\r\n if (this.lights[index].id === id) {\r\n return this.lights[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a node (Mesh, Camera, Light) using a given id\r\n * @param id defines the id to search for\r\n * @return the found node or null if not found at all\r\n */\r\n Scene.prototype.getNodeByID = function (id) {\r\n var mesh = this.getMeshByID(id);\r\n if (mesh) {\r\n return mesh;\r\n }\r\n var transformNode = this.getTransformNodeByID(id);\r\n if (transformNode) {\r\n return transformNode;\r\n }\r\n var light = this.getLightByID(id);\r\n if (light) {\r\n return light;\r\n }\r\n var camera = this.getCameraByID(id);\r\n if (camera) {\r\n return camera;\r\n }\r\n var bone = this.getBoneByID(id);\r\n if (bone) {\r\n return bone;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a node (Mesh, Camera, Light) using a given name\r\n * @param name defines the name to search for\r\n * @return the found node or null if not found at all.\r\n */\r\n Scene.prototype.getNodeByName = function (name) {\r\n var mesh = this.getMeshByName(name);\r\n if (mesh) {\r\n return mesh;\r\n }\r\n var transformNode = this.getTransformNodeByName(name);\r\n if (transformNode) {\r\n return transformNode;\r\n }\r\n var light = this.getLightByName(name);\r\n if (light) {\r\n return light;\r\n }\r\n var camera = this.getCameraByName(name);\r\n if (camera) {\r\n return camera;\r\n }\r\n var bone = this.getBoneByName(name);\r\n if (bone) {\r\n return bone;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a mesh using a given name\r\n * @param name defines the name to search for\r\n * @return the found mesh or null if not found at all.\r\n */\r\n Scene.prototype.getMeshByName = function (name) {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n if (this.meshes[index].name === name) {\r\n return this.meshes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a transform node using a given name\r\n * @param name defines the name to search for\r\n * @return the found transform node or null if not found at all.\r\n */\r\n Scene.prototype.getTransformNodeByName = function (name) {\r\n for (var index = 0; index < this.transformNodes.length; index++) {\r\n if (this.transformNodes[index].name === name) {\r\n return this.transformNodes[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given id (if many are found, this function will pick the last one)\r\n * @param id defines the id to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getLastSkeletonByID = function (id) {\r\n for (var index = this.skeletons.length - 1; index >= 0; index--) {\r\n if (this.skeletons[index].id === id) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given auto generated unique id\r\n * @param uniqueId defines the unique id to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getSkeletonByUniqueId = function (uniqueId) {\r\n for (var index = 0; index < this.skeletons.length; index++) {\r\n if (this.skeletons[index].uniqueId === uniqueId) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given id (if many are found, this function will pick the first one)\r\n * @param id defines the id to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getSkeletonById = function (id) {\r\n for (var index = 0; index < this.skeletons.length; index++) {\r\n if (this.skeletons[index].id === id) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a skeleton using a given name\r\n * @param name defines the name to search for\r\n * @return the found skeleton or null if not found at all.\r\n */\r\n Scene.prototype.getSkeletonByName = function (name) {\r\n for (var index = 0; index < this.skeletons.length; index++) {\r\n if (this.skeletons[index].name === name) {\r\n return this.skeletons[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a morph target manager using a given id (if many are found, this function will pick the last one)\r\n * @param id defines the id to search for\r\n * @return the found morph target manager or null if not found at all.\r\n */\r\n Scene.prototype.getMorphTargetManagerById = function (id) {\r\n for (var index = 0; index < this.morphTargetManagers.length; index++) {\r\n if (this.morphTargetManagers[index].uniqueId === id) {\r\n return this.morphTargetManagers[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a morph target using a given id (if many are found, this function will pick the first one)\r\n * @param id defines the id to search for\r\n * @return the found morph target or null if not found at all.\r\n */\r\n Scene.prototype.getMorphTargetById = function (id) {\r\n for (var managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {\r\n var morphTargetManager = this.morphTargetManagers[managerIndex];\r\n for (var index = 0; index < morphTargetManager.numTargets; ++index) {\r\n var target = morphTargetManager.getTarget(index);\r\n if (target.id === id) {\r\n return target;\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a morph target using a given name (if many are found, this function will pick the first one)\r\n * @param name defines the name to search for\r\n * @return the found morph target or null if not found at all.\r\n */\r\n Scene.prototype.getMorphTargetByName = function (name) {\r\n for (var managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {\r\n var morphTargetManager = this.morphTargetManagers[managerIndex];\r\n for (var index = 0; index < morphTargetManager.numTargets; ++index) {\r\n var target = morphTargetManager.getTarget(index);\r\n if (target.name === name) {\r\n return target;\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a post process using a given name (if many are found, this function will pick the first one)\r\n * @param name defines the name to search for\r\n * @return the found post process or null if not found at all.\r\n */\r\n Scene.prototype.getPostProcessByName = function (name) {\r\n for (var postProcessIndex = 0; postProcessIndex < this.postProcesses.length; ++postProcessIndex) {\r\n var postProcess = this.postProcesses[postProcessIndex];\r\n if (postProcess.name === name) {\r\n return postProcess;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a boolean indicating if the given mesh is active\r\n * @param mesh defines the mesh to look for\r\n * @returns true if the mesh is in the active list\r\n */\r\n Scene.prototype.isActiveMesh = function (mesh) {\r\n return (this._activeMeshes.indexOf(mesh) !== -1);\r\n };\r\n Object.defineProperty(Scene.prototype, \"uid\", {\r\n /**\r\n * Return a unique id as a string which can serve as an identifier for the scene\r\n */\r\n get: function () {\r\n if (!this._uid) {\r\n this._uid = Tools.RandomId();\r\n }\r\n return this._uid;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Add an externaly attached data from its key.\r\n * This method call will fail and return false, if such key already exists.\r\n * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.\r\n * @param key the unique key that identifies the data\r\n * @param data the data object to associate to the key for this Engine instance\r\n * @return true if no such key were already present and the data was added successfully, false otherwise\r\n */\r\n Scene.prototype.addExternalData = function (key, data) {\r\n if (!this._externalData) {\r\n this._externalData = new StringDictionary();\r\n }\r\n return this._externalData.add(key, data);\r\n };\r\n /**\r\n * Get an externaly attached data from its key\r\n * @param key the unique key that identifies the data\r\n * @return the associated data, if present (can be null), or undefined if not present\r\n */\r\n Scene.prototype.getExternalData = function (key) {\r\n if (!this._externalData) {\r\n return null;\r\n }\r\n return this._externalData.get(key);\r\n };\r\n /**\r\n * Get an externaly attached data from its key, create it using a factory if it's not already present\r\n * @param key the unique key that identifies the data\r\n * @param factory the factory that will be called to create the instance if and only if it doesn't exists\r\n * @return the associated data, can be null if the factory returned null.\r\n */\r\n Scene.prototype.getOrAddExternalDataWithFactory = function (key, factory) {\r\n if (!this._externalData) {\r\n this._externalData = new StringDictionary();\r\n }\r\n return this._externalData.getOrAddWithFactory(key, factory);\r\n };\r\n /**\r\n * Remove an externaly attached data from the Engine instance\r\n * @param key the unique key that identifies the data\r\n * @return true if the data was successfully removed, false if it doesn't exist\r\n */\r\n Scene.prototype.removeExternalData = function (key) {\r\n return this._externalData.remove(key);\r\n };\r\n Scene.prototype._evaluateSubMesh = function (subMesh, mesh, initialMesh) {\r\n if (initialMesh.hasInstances || initialMesh.isAnInstance || this.dispatchAllSubMeshesOfActiveMeshes || this._skipFrustumClipping || mesh.alwaysSelectAsActiveMesh || mesh.subMeshes.length === 1 || subMesh.isInFrustum(this._frustumPlanes)) {\r\n for (var _i = 0, _a = this._evaluateSubMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(mesh, subMesh);\r\n }\r\n var material = subMesh.getMaterial();\r\n if (material !== null && material !== undefined) {\r\n // Render targets\r\n if (material.hasRenderTargetTextures && material.getRenderTargetTextures != null) {\r\n if (this._processedMaterials.indexOf(material) === -1) {\r\n this._processedMaterials.push(material);\r\n this._renderTargets.concatWithNoDuplicate(material.getRenderTargetTextures());\r\n }\r\n }\r\n // Dispatch\r\n this._renderingManager.dispatch(subMesh, mesh, material);\r\n }\r\n }\r\n };\r\n /**\r\n * Clear the processed materials smart array preventing retention point in material dispose.\r\n */\r\n Scene.prototype.freeProcessedMaterials = function () {\r\n this._processedMaterials.dispose();\r\n };\r\n Object.defineProperty(Scene.prototype, \"blockfreeActiveMeshesAndRenderingGroups\", {\r\n /** Gets or sets a boolean blocking all the calls to freeActiveMeshes and freeRenderingGroups\r\n * It can be used in order to prevent going through methods freeRenderingGroups and freeActiveMeshes several times to improve performance\r\n * when disposing several meshes in a row or a hierarchy of meshes.\r\n * When used, it is the responsability of the user to blockfreeActiveMeshesAndRenderingGroups back to false.\r\n */\r\n get: function () {\r\n return this._preventFreeActiveMeshesAndRenderingGroups;\r\n },\r\n set: function (value) {\r\n if (this._preventFreeActiveMeshesAndRenderingGroups === value) {\r\n return;\r\n }\r\n if (value) {\r\n this.freeActiveMeshes();\r\n this.freeRenderingGroups();\r\n }\r\n this._preventFreeActiveMeshesAndRenderingGroups = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Clear the active meshes smart array preventing retention point in mesh dispose.\r\n */\r\n Scene.prototype.freeActiveMeshes = function () {\r\n if (this.blockfreeActiveMeshesAndRenderingGroups) {\r\n return;\r\n }\r\n this._activeMeshes.dispose();\r\n if (this.activeCamera && this.activeCamera._activeMeshes) {\r\n this.activeCamera._activeMeshes.dispose();\r\n }\r\n if (this.activeCameras) {\r\n for (var i = 0; i < this.activeCameras.length; i++) {\r\n var activeCamera = this.activeCameras[i];\r\n if (activeCamera && activeCamera._activeMeshes) {\r\n activeCamera._activeMeshes.dispose();\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Clear the info related to rendering groups preventing retention points during dispose.\r\n */\r\n Scene.prototype.freeRenderingGroups = function () {\r\n if (this.blockfreeActiveMeshesAndRenderingGroups) {\r\n return;\r\n }\r\n if (this._renderingManager) {\r\n this._renderingManager.freeRenderingGroups();\r\n }\r\n if (this.textures) {\r\n for (var i = 0; i < this.textures.length; i++) {\r\n var texture = this.textures[i];\r\n if (texture && texture.renderList) {\r\n texture.freeRenderingGroups();\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._isInIntermediateRendering = function () {\r\n return this._intermediateRendering;\r\n };\r\n /**\r\n * Use this function to stop evaluating active meshes. The current list will be keep alive between frames\r\n * @param skipEvaluateActiveMeshes defines an optional boolean indicating that the evaluate active meshes step must be completely skipped\r\n * @param onSuccess optional success callback\r\n * @param onError optional error callback\r\n * @returns the current scene\r\n */\r\n Scene.prototype.freezeActiveMeshes = function (skipEvaluateActiveMeshes, onSuccess, onError) {\r\n var _this = this;\r\n if (skipEvaluateActiveMeshes === void 0) { skipEvaluateActiveMeshes = false; }\r\n this.executeWhenReady(function () {\r\n if (!_this.activeCamera) {\r\n onError && onError('No active camera found');\r\n return;\r\n }\r\n if (!_this._frustumPlanes) {\r\n _this.setTransformMatrix(_this.activeCamera.getViewMatrix(), _this.activeCamera.getProjectionMatrix());\r\n }\r\n _this._evaluateActiveMeshes();\r\n _this._activeMeshesFrozen = true;\r\n _this._skipEvaluateActiveMeshesCompletely = skipEvaluateActiveMeshes;\r\n for (var index = 0; index < _this._activeMeshes.length; index++) {\r\n _this._activeMeshes.data[index]._freeze();\r\n }\r\n onSuccess && onSuccess();\r\n });\r\n return this;\r\n };\r\n /**\r\n * Use this function to restart evaluating active meshes on every frame\r\n * @returns the current scene\r\n */\r\n Scene.prototype.unfreezeActiveMeshes = function () {\r\n for (var index = 0; index < this.meshes.length; index++) {\r\n var mesh = this.meshes[index];\r\n if (mesh._internalAbstractMeshDataInfo) {\r\n mesh._internalAbstractMeshDataInfo._isActive = false;\r\n }\r\n }\r\n for (var index = 0; index < this._activeMeshes.length; index++) {\r\n this._activeMeshes.data[index]._unFreeze();\r\n }\r\n this._activeMeshesFrozen = false;\r\n return this;\r\n };\r\n Scene.prototype._evaluateActiveMeshes = function () {\r\n if (this._activeMeshesFrozen && this._activeMeshes.length) {\r\n if (!this._skipEvaluateActiveMeshesCompletely) {\r\n var len_1 = this._activeMeshes.length;\r\n for (var i = 0; i < len_1; i++) {\r\n var mesh = this._activeMeshes.data[i];\r\n mesh.computeWorldMatrix();\r\n }\r\n }\r\n if (this._activeParticleSystems) {\r\n var psLength = this._activeParticleSystems.length;\r\n for (var i = 0; i < psLength; i++) {\r\n this._activeParticleSystems.data[i].animate();\r\n }\r\n }\r\n return;\r\n }\r\n if (!this.activeCamera) {\r\n return;\r\n }\r\n this.onBeforeActiveMeshesEvaluationObservable.notifyObservers(this);\r\n this.activeCamera._activeMeshes.reset();\r\n this._activeMeshes.reset();\r\n this._renderingManager.reset();\r\n this._processedMaterials.reset();\r\n this._activeParticleSystems.reset();\r\n this._activeSkeletons.reset();\r\n this._softwareSkinnedMeshes.reset();\r\n for (var _i = 0, _a = this._beforeEvaluateActiveMeshStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action();\r\n }\r\n // Determine mesh candidates\r\n var meshes = this.getActiveMeshCandidates();\r\n // Check each mesh\r\n var len = meshes.length;\r\n for (var i = 0; i < len; i++) {\r\n var mesh = meshes.data[i];\r\n mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate = false;\r\n if (mesh.isBlocked) {\r\n continue;\r\n }\r\n this._totalVertices.addCount(mesh.getTotalVertices(), false);\r\n if (!mesh.isReady() || !mesh.isEnabled() || mesh.scaling.lengthSquared() === 0) {\r\n continue;\r\n }\r\n mesh.computeWorldMatrix();\r\n // Intersections\r\n if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(12, 13)) {\r\n this._meshesForIntersections.pushNoDuplicate(mesh);\r\n }\r\n // Switch to current LOD\r\n var meshToRender = this.customLODSelector ? this.customLODSelector(mesh, this.activeCamera) : mesh.getLOD(this.activeCamera);\r\n mesh._internalAbstractMeshDataInfo._currentLOD = meshToRender;\r\n mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate = true;\r\n if (meshToRender === undefined || meshToRender === null) {\r\n continue;\r\n }\r\n // Compute world matrix if LOD is billboard\r\n if (meshToRender !== mesh && meshToRender.billboardMode !== TransformNode.BILLBOARDMODE_NONE) {\r\n meshToRender.computeWorldMatrix();\r\n }\r\n mesh._preActivate();\r\n if (mesh.isVisible && mesh.visibility > 0 && ((mesh.layerMask & this.activeCamera.layerMask) !== 0) && (this._skipFrustumClipping || mesh.alwaysSelectAsActiveMesh || mesh.isInFrustum(this._frustumPlanes))) {\r\n this._activeMeshes.push(mesh);\r\n this.activeCamera._activeMeshes.push(mesh);\r\n if (meshToRender !== mesh) {\r\n meshToRender._activate(this._renderId, false);\r\n }\r\n for (var _b = 0, _c = this._preActiveMeshStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action(mesh);\r\n }\r\n if (mesh._activate(this._renderId, false)) {\r\n if (!mesh.isAnInstance) {\r\n meshToRender._internalAbstractMeshDataInfo._onlyForInstances = false;\r\n }\r\n else {\r\n if (mesh._internalAbstractMeshDataInfo._actAsRegularMesh) {\r\n meshToRender = mesh;\r\n }\r\n }\r\n meshToRender._internalAbstractMeshDataInfo._isActive = true;\r\n this._activeMesh(mesh, meshToRender);\r\n }\r\n mesh._postActivate();\r\n }\r\n }\r\n this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this);\r\n // Particle systems\r\n if (this.particlesEnabled) {\r\n this.onBeforeParticlesRenderingObservable.notifyObservers(this);\r\n for (var particleIndex = 0; particleIndex < this.particleSystems.length; particleIndex++) {\r\n var particleSystem = this.particleSystems[particleIndex];\r\n if (!particleSystem.isStarted() || !particleSystem.emitter) {\r\n continue;\r\n }\r\n var emitter = particleSystem.emitter;\r\n if (!emitter.position || emitter.isEnabled()) {\r\n this._activeParticleSystems.push(particleSystem);\r\n particleSystem.animate();\r\n this._renderingManager.dispatchParticles(particleSystem);\r\n }\r\n }\r\n this.onAfterParticlesRenderingObservable.notifyObservers(this);\r\n }\r\n };\r\n Scene.prototype._activeMesh = function (sourceMesh, mesh) {\r\n if (this._skeletonsEnabled && mesh.skeleton !== null && mesh.skeleton !== undefined) {\r\n if (this._activeSkeletons.pushNoDuplicate(mesh.skeleton)) {\r\n mesh.skeleton.prepare();\r\n }\r\n if (!mesh.computeBonesUsingShaders) {\r\n this._softwareSkinnedMeshes.pushNoDuplicate(mesh);\r\n }\r\n }\r\n if (mesh !== undefined && mesh !== null\r\n && mesh.subMeshes !== undefined && mesh.subMeshes !== null && mesh.subMeshes.length > 0) {\r\n var subMeshes = this.getActiveSubMeshCandidates(mesh);\r\n var len = subMeshes.length;\r\n for (var i = 0; i < len; i++) {\r\n var subMesh = subMeshes.data[i];\r\n this._evaluateSubMesh(subMesh, mesh, sourceMesh);\r\n }\r\n }\r\n };\r\n /**\r\n * Update the transform matrix to update from the current active camera\r\n * @param force defines a boolean used to force the update even if cache is up to date\r\n */\r\n Scene.prototype.updateTransformMatrix = function (force) {\r\n if (!this.activeCamera) {\r\n return;\r\n }\r\n this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(force));\r\n };\r\n Scene.prototype._bindFrameBuffer = function () {\r\n if (this.activeCamera && this.activeCamera._multiviewTexture) {\r\n this.activeCamera._multiviewTexture._bindFrameBuffer();\r\n }\r\n else if (this.activeCamera && this.activeCamera.outputRenderTarget) {\r\n var useMultiview = this.getEngine().getCaps().multiview && this.activeCamera.outputRenderTarget && this.activeCamera.outputRenderTarget.getViewCount() > 1;\r\n if (useMultiview) {\r\n this.activeCamera.outputRenderTarget._bindFrameBuffer();\r\n }\r\n else {\r\n var internalTexture = this.activeCamera.outputRenderTarget.getInternalTexture();\r\n if (internalTexture) {\r\n this.getEngine().bindFramebuffer(internalTexture);\r\n }\r\n else {\r\n Logger.Error(\"Camera contains invalid customDefaultRenderTarget\");\r\n }\r\n }\r\n }\r\n else {\r\n this.getEngine().restoreDefaultFramebuffer(); // Restore back buffer if needed\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._renderForCamera = function (camera, rigParent) {\r\n if (camera && camera._skipRendering) {\r\n return;\r\n }\r\n var engine = this._engine;\r\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged\r\n this._activeCamera = camera;\r\n if (!this.activeCamera) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n // Viewport\r\n engine.setViewport(this.activeCamera.viewport);\r\n // Camera\r\n this.resetCachedMaterial();\r\n this._renderId++;\r\n var useMultiview = this.getEngine().getCaps().multiview && camera.outputRenderTarget && camera.outputRenderTarget.getViewCount() > 1;\r\n if (useMultiview) {\r\n this.setTransformMatrix(camera._rigCameras[0].getViewMatrix(), camera._rigCameras[0].getProjectionMatrix(), camera._rigCameras[1].getViewMatrix(), camera._rigCameras[1].getProjectionMatrix());\r\n }\r\n else {\r\n this.updateTransformMatrix();\r\n }\r\n this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera);\r\n // Meshes\r\n this._evaluateActiveMeshes();\r\n // Software skinning\r\n for (var softwareSkinnedMeshIndex = 0; softwareSkinnedMeshIndex < this._softwareSkinnedMeshes.length; softwareSkinnedMeshIndex++) {\r\n var mesh = this._softwareSkinnedMeshes.data[softwareSkinnedMeshIndex];\r\n mesh.applySkeleton(mesh.skeleton);\r\n }\r\n // Render targets\r\n this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);\r\n if (camera.customRenderTargets && camera.customRenderTargets.length > 0) {\r\n this._renderTargets.concatWithNoDuplicate(camera.customRenderTargets);\r\n }\r\n if (rigParent && rigParent.customRenderTargets && rigParent.customRenderTargets.length > 0) {\r\n this._renderTargets.concatWithNoDuplicate(rigParent.customRenderTargets);\r\n }\r\n // Collects render targets from external components.\r\n for (var _i = 0, _a = this._gatherActiveCameraRenderTargetsStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action(this._renderTargets);\r\n }\r\n var needRebind = false;\r\n if (this.renderTargetsEnabled) {\r\n this._intermediateRendering = true;\r\n if (this._renderTargets.length > 0) {\r\n Tools.StartPerformanceCounter(\"Render targets\", this._renderTargets.length > 0);\r\n for (var renderIndex = 0; renderIndex < this._renderTargets.length; renderIndex++) {\r\n var renderTarget = this._renderTargets.data[renderIndex];\r\n if (renderTarget._shouldRender()) {\r\n this._renderId++;\r\n var hasSpecialRenderTargetCamera = renderTarget.activeCamera && renderTarget.activeCamera !== this.activeCamera;\r\n renderTarget.render(hasSpecialRenderTargetCamera, this.dumpNextRenderTargets);\r\n needRebind = true;\r\n }\r\n }\r\n Tools.EndPerformanceCounter(\"Render targets\", this._renderTargets.length > 0);\r\n this._renderId++;\r\n }\r\n for (var _b = 0, _c = this._cameraDrawRenderTargetStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n needRebind = step.action(this.activeCamera) || needRebind;\r\n }\r\n this._intermediateRendering = false;\r\n // Need to bind if sub-camera has an outputRenderTarget eg. for webXR\r\n if (this.activeCamera && this.activeCamera.outputRenderTarget) {\r\n needRebind = true;\r\n }\r\n }\r\n // Restore framebuffer after rendering to targets\r\n if (needRebind && !this.prePass) {\r\n this._bindFrameBuffer();\r\n }\r\n this.onAfterRenderTargetsRenderObservable.notifyObservers(this);\r\n // Prepare Frame\r\n if (this.postProcessManager && !camera._multiviewTexture && !this.prePass) {\r\n this.postProcessManager._prepareFrame();\r\n }\r\n // Before Camera Draw\r\n for (var _d = 0, _e = this._beforeCameraDrawStage; _d < _e.length; _d++) {\r\n var step = _e[_d];\r\n step.action(this.activeCamera);\r\n }\r\n // Render\r\n this.onBeforeDrawPhaseObservable.notifyObservers(this);\r\n this._renderingManager.render(null, null, true, true);\r\n this.onAfterDrawPhaseObservable.notifyObservers(this);\r\n // After Camera Draw\r\n for (var _f = 0, _g = this._afterCameraDrawStage; _f < _g.length; _f++) {\r\n var step = _g[_f];\r\n step.action(this.activeCamera);\r\n }\r\n // Finalize frame\r\n if (this.postProcessManager && !camera._multiviewTexture) {\r\n // if the camera has an output render target, render the post process to the render target\r\n var texture = camera.outputRenderTarget ? camera.outputRenderTarget.getInternalTexture() : undefined;\r\n this.postProcessManager._finalizeFrame(camera.isIntermediate, texture);\r\n }\r\n // Reset some special arrays\r\n this._renderTargets.reset();\r\n this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera);\r\n };\r\n Scene.prototype._processSubCameras = function (camera) {\r\n if (camera.cameraRigMode === Camera.RIG_MODE_NONE || (camera.outputRenderTarget && camera.outputRenderTarget.getViewCount() > 1 && this.getEngine().getCaps().multiview)) {\r\n this._renderForCamera(camera);\r\n this.onAfterRenderCameraObservable.notifyObservers(camera);\r\n return;\r\n }\r\n if (camera._useMultiviewToSingleView) {\r\n this._renderMultiviewToSingleView(camera);\r\n }\r\n else {\r\n // rig cameras\r\n for (var index = 0; index < camera._rigCameras.length; index++) {\r\n this._renderForCamera(camera._rigCameras[index], camera);\r\n }\r\n }\r\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged\r\n this._activeCamera = camera;\r\n this.setTransformMatrix(this._activeCamera.getViewMatrix(), this._activeCamera.getProjectionMatrix());\r\n this.onAfterRenderCameraObservable.notifyObservers(camera);\r\n };\r\n Scene.prototype._checkIntersections = function () {\r\n for (var index = 0; index < this._meshesForIntersections.length; index++) {\r\n var sourceMesh = this._meshesForIntersections.data[index];\r\n if (!sourceMesh.actionManager) {\r\n continue;\r\n }\r\n for (var actionIndex = 0; sourceMesh.actionManager && actionIndex < sourceMesh.actionManager.actions.length; actionIndex++) {\r\n var action = sourceMesh.actionManager.actions[actionIndex];\r\n if (action.trigger === 12 || action.trigger === 13) {\r\n var parameters = action.getTriggerParameter();\r\n var otherMesh = parameters instanceof AbstractMesh ? parameters : parameters.mesh;\r\n var areIntersecting = otherMesh.intersectsMesh(sourceMesh, parameters.usePreciseIntersection);\r\n var currentIntersectionInProgress = sourceMesh._intersectionsInProgress.indexOf(otherMesh);\r\n if (areIntersecting && currentIntersectionInProgress === -1) {\r\n if (action.trigger === 12) {\r\n action._executeCurrent(ActionEvent.CreateNew(sourceMesh, undefined, otherMesh));\r\n sourceMesh._intersectionsInProgress.push(otherMesh);\r\n }\r\n else if (action.trigger === 13) {\r\n sourceMesh._intersectionsInProgress.push(otherMesh);\r\n }\r\n }\r\n else if (!areIntersecting && currentIntersectionInProgress > -1) {\r\n //They intersected, and now they don't.\r\n //is this trigger an exit trigger? execute an event.\r\n if (action.trigger === 13) {\r\n action._executeCurrent(ActionEvent.CreateNew(sourceMesh, undefined, otherMesh));\r\n }\r\n //if this is an exit trigger, or no exit trigger exists, remove the id from the intersection in progress array.\r\n if (!sourceMesh.actionManager.hasSpecificTrigger(13, function (parameter) {\r\n var parameterMesh = parameter instanceof AbstractMesh ? parameter : parameter.mesh;\r\n return otherMesh === parameterMesh;\r\n }) || action.trigger === 13) {\r\n sourceMesh._intersectionsInProgress.splice(currentIntersectionInProgress, 1);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._advancePhysicsEngineStep = function (step) {\r\n // Do nothing. Code will be replaced if physics engine component is referenced\r\n };\r\n /** @hidden */\r\n Scene.prototype._animate = function () {\r\n // Nothing to do as long as Animatable have not been imported.\r\n };\r\n /** Execute all animations (for a frame) */\r\n Scene.prototype.animate = function () {\r\n if (this._engine.isDeterministicLockStep()) {\r\n var deltaTime = Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime)) + this._timeAccumulator;\r\n var defaultFrameTime = this._engine.getTimeStep();\r\n var defaultFPS = (1000.0 / defaultFrameTime) / 1000.0;\r\n var stepsTaken = 0;\r\n var maxSubSteps = this._engine.getLockstepMaxSteps();\r\n var internalSteps = Math.floor(deltaTime / defaultFrameTime);\r\n internalSteps = Math.min(internalSteps, maxSubSteps);\r\n while (deltaTime > 0 && stepsTaken < internalSteps) {\r\n this.onBeforeStepObservable.notifyObservers(this);\r\n // Animations\r\n this._animationRatio = defaultFrameTime * defaultFPS;\r\n this._animate();\r\n this.onAfterAnimationsObservable.notifyObservers(this);\r\n // Physics\r\n if (this.physicsEnabled) {\r\n this._advancePhysicsEngineStep(defaultFrameTime);\r\n }\r\n this.onAfterStepObservable.notifyObservers(this);\r\n this._currentStepId++;\r\n stepsTaken++;\r\n deltaTime -= defaultFrameTime;\r\n }\r\n this._timeAccumulator = deltaTime < 0 ? 0 : deltaTime;\r\n }\r\n else {\r\n // Animations\r\n var deltaTime = this.useConstantAnimationDeltaTime ? 16 : Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime));\r\n this._animationRatio = deltaTime * (60.0 / 1000.0);\r\n this._animate();\r\n this.onAfterAnimationsObservable.notifyObservers(this);\r\n // Physics\r\n if (this.physicsEnabled) {\r\n this._advancePhysicsEngineStep(deltaTime);\r\n }\r\n }\r\n };\r\n /**\r\n * Render the scene\r\n * @param updateCameras defines a boolean indicating if cameras must update according to their inputs (true by default)\r\n * @param ignoreAnimations defines a boolean indicating if animations should not be executed (false by default)\r\n */\r\n Scene.prototype.render = function (updateCameras, ignoreAnimations) {\r\n if (updateCameras === void 0) { updateCameras = true; }\r\n if (ignoreAnimations === void 0) { ignoreAnimations = false; }\r\n if (this.isDisposed) {\r\n return;\r\n }\r\n if (this.onReadyObservable.hasObservers() && this._executeWhenReadyTimeoutId === -1) {\r\n this._checkIsReady();\r\n }\r\n this._frameId++;\r\n // Register components that have been associated lately to the scene.\r\n this._registerTransientComponents();\r\n this._activeParticles.fetchNewFrame();\r\n this._totalVertices.fetchNewFrame();\r\n this._activeIndices.fetchNewFrame();\r\n this._activeBones.fetchNewFrame();\r\n this._meshesForIntersections.reset();\r\n this.resetCachedMaterial();\r\n this.onBeforeAnimationsObservable.notifyObservers(this);\r\n // Actions\r\n if (this.actionManager) {\r\n this.actionManager.processTrigger(11);\r\n }\r\n // Animations\r\n if (!ignoreAnimations) {\r\n this.animate();\r\n }\r\n // Before camera update steps\r\n for (var _i = 0, _a = this._beforeCameraUpdateStage; _i < _a.length; _i++) {\r\n var step = _a[_i];\r\n step.action();\r\n }\r\n // Update Cameras\r\n if (updateCameras) {\r\n if (this.activeCameras && this.activeCameras.length > 0) {\r\n for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {\r\n var camera = this.activeCameras[cameraIndex];\r\n camera.update();\r\n if (camera.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n // rig cameras\r\n for (var index = 0; index < camera._rigCameras.length; index++) {\r\n camera._rigCameras[index].update();\r\n }\r\n }\r\n }\r\n }\r\n else if (this.activeCamera) {\r\n this.activeCamera.update();\r\n if (this.activeCamera.cameraRigMode !== Camera.RIG_MODE_NONE) {\r\n // rig cameras\r\n for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {\r\n this.activeCamera._rigCameras[index].update();\r\n }\r\n }\r\n }\r\n }\r\n // Before render\r\n this.onBeforeRenderObservable.notifyObservers(this);\r\n // Customs render targets\r\n this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);\r\n var engine = this.getEngine();\r\n var currentActiveCamera = this.activeCamera;\r\n if (this.renderTargetsEnabled) {\r\n Tools.StartPerformanceCounter(\"Custom render targets\", this.customRenderTargets.length > 0);\r\n this._intermediateRendering = true;\r\n for (var customIndex = 0; customIndex < this.customRenderTargets.length; customIndex++) {\r\n var renderTarget = this.customRenderTargets[customIndex];\r\n if (renderTarget._shouldRender()) {\r\n this._renderId++;\r\n this.activeCamera = renderTarget.activeCamera || this.activeCamera;\r\n if (!this.activeCamera) {\r\n throw new Error(\"Active camera not set\");\r\n }\r\n // Viewport\r\n engine.setViewport(this.activeCamera.viewport);\r\n // Camera\r\n this.updateTransformMatrix();\r\n renderTarget.render(currentActiveCamera !== this.activeCamera, this.dumpNextRenderTargets);\r\n }\r\n }\r\n Tools.EndPerformanceCounter(\"Custom render targets\", this.customRenderTargets.length > 0);\r\n this._intermediateRendering = false;\r\n this._renderId++;\r\n }\r\n // Restore back buffer\r\n this.activeCamera = currentActiveCamera;\r\n if (this._activeCamera && this._activeCamera.cameraRigMode !== Camera.RIG_MODE_CUSTOM && !this.prePass) {\r\n this._bindFrameBuffer();\r\n }\r\n this.onAfterRenderTargetsRenderObservable.notifyObservers(this);\r\n for (var _b = 0, _c = this._beforeClearStage; _b < _c.length; _b++) {\r\n var step = _c[_b];\r\n step.action();\r\n }\r\n // Clear\r\n if ((this.autoClearDepthAndStencil || this.autoClear) && !this.prePass) {\r\n this._engine.clear(this.clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil);\r\n }\r\n // Collects render targets from external components.\r\n for (var _d = 0, _e = this._gatherRenderTargetsStage; _d < _e.length; _d++) {\r\n var step = _e[_d];\r\n step.action(this._renderTargets);\r\n }\r\n // Multi-cameras?\r\n if (this.activeCameras && this.activeCameras.length > 0) {\r\n for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {\r\n if (cameraIndex > 0) {\r\n this._engine.clear(null, false, true, true);\r\n }\r\n this._processSubCameras(this.activeCameras[cameraIndex]);\r\n }\r\n }\r\n else {\r\n if (!this.activeCamera) {\r\n throw new Error(\"No camera defined\");\r\n }\r\n this._processSubCameras(this.activeCamera);\r\n }\r\n // Intersection checks\r\n this._checkIntersections();\r\n // Executes the after render stage actions.\r\n for (var _f = 0, _g = this._afterRenderStage; _f < _g.length; _f++) {\r\n var step = _g[_f];\r\n step.action();\r\n }\r\n // After render\r\n if (this.afterRender) {\r\n this.afterRender();\r\n }\r\n this.onAfterRenderObservable.notifyObservers(this);\r\n // Cleaning\r\n if (this._toBeDisposed.length) {\r\n for (var index = 0; index < this._toBeDisposed.length; index++) {\r\n var data = this._toBeDisposed[index];\r\n if (data) {\r\n data.dispose();\r\n }\r\n }\r\n this._toBeDisposed = [];\r\n }\r\n if (this.dumpNextRenderTargets) {\r\n this.dumpNextRenderTargets = false;\r\n }\r\n this._activeBones.addCount(0, true);\r\n this._activeIndices.addCount(0, true);\r\n this._activeParticles.addCount(0, true);\r\n };\r\n /**\r\n * Freeze all materials\r\n * A frozen material will not be updatable but should be faster to render\r\n */\r\n Scene.prototype.freezeMaterials = function () {\r\n for (var i = 0; i < this.materials.length; i++) {\r\n this.materials[i].freeze();\r\n }\r\n };\r\n /**\r\n * Unfreeze all materials\r\n * A frozen material will not be updatable but should be faster to render\r\n */\r\n Scene.prototype.unfreezeMaterials = function () {\r\n for (var i = 0; i < this.materials.length; i++) {\r\n this.materials[i].unfreeze();\r\n }\r\n };\r\n /**\r\n * Releases all held ressources\r\n */\r\n Scene.prototype.dispose = function () {\r\n this.beforeRender = null;\r\n this.afterRender = null;\r\n if (EngineStore._LastCreatedScene === this) {\r\n EngineStore._LastCreatedScene = null;\r\n }\r\n this.skeletons = [];\r\n this.morphTargetManagers = [];\r\n this._transientComponents = [];\r\n this._isReadyForMeshStage.clear();\r\n this._beforeEvaluateActiveMeshStage.clear();\r\n this._evaluateSubMeshStage.clear();\r\n this._preActiveMeshStage.clear();\r\n this._cameraDrawRenderTargetStage.clear();\r\n this._beforeCameraDrawStage.clear();\r\n this._beforeRenderTargetDrawStage.clear();\r\n this._beforeRenderingGroupDrawStage.clear();\r\n this._beforeRenderingMeshStage.clear();\r\n this._afterRenderingMeshStage.clear();\r\n this._afterRenderingGroupDrawStage.clear();\r\n this._afterCameraDrawStage.clear();\r\n this._afterRenderTargetDrawStage.clear();\r\n this._afterRenderStage.clear();\r\n this._beforeCameraUpdateStage.clear();\r\n this._beforeClearStage.clear();\r\n this._gatherRenderTargetsStage.clear();\r\n this._gatherActiveCameraRenderTargetsStage.clear();\r\n this._pointerMoveStage.clear();\r\n this._pointerDownStage.clear();\r\n this._pointerUpStage.clear();\r\n for (var _i = 0, _a = this._components; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.dispose();\r\n }\r\n this.importedMeshesFiles = new Array();\r\n if (this.stopAllAnimations) {\r\n this.stopAllAnimations();\r\n }\r\n this.resetCachedMaterial();\r\n // Smart arrays\r\n if (this.activeCamera) {\r\n this.activeCamera._activeMeshes.dispose();\r\n this.activeCamera = null;\r\n }\r\n this._activeMeshes.dispose();\r\n this._renderingManager.dispose();\r\n this._processedMaterials.dispose();\r\n this._activeParticleSystems.dispose();\r\n this._activeSkeletons.dispose();\r\n this._softwareSkinnedMeshes.dispose();\r\n this._renderTargets.dispose();\r\n this._registeredForLateAnimationBindings.dispose();\r\n this._meshesForIntersections.dispose();\r\n this._toBeDisposed = [];\r\n // Abort active requests\r\n for (var _b = 0, _c = this._activeRequests; _b < _c.length; _b++) {\r\n var request = _c[_b];\r\n request.abort();\r\n }\r\n // Events\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onBeforeRenderTargetsRenderObservable.clear();\r\n this.onAfterRenderTargetsRenderObservable.clear();\r\n this.onAfterStepObservable.clear();\r\n this.onBeforeStepObservable.clear();\r\n this.onBeforeActiveMeshesEvaluationObservable.clear();\r\n this.onAfterActiveMeshesEvaluationObservable.clear();\r\n this.onBeforeParticlesRenderingObservable.clear();\r\n this.onAfterParticlesRenderingObservable.clear();\r\n this.onBeforeDrawPhaseObservable.clear();\r\n this.onAfterDrawPhaseObservable.clear();\r\n this.onBeforeAnimationsObservable.clear();\r\n this.onAfterAnimationsObservable.clear();\r\n this.onDataLoadedObservable.clear();\r\n this.onBeforeRenderingGroupObservable.clear();\r\n this.onAfterRenderingGroupObservable.clear();\r\n this.onMeshImportedObservable.clear();\r\n this.onBeforeCameraRenderObservable.clear();\r\n this.onAfterCameraRenderObservable.clear();\r\n this.onReadyObservable.clear();\r\n this.onNewCameraAddedObservable.clear();\r\n this.onCameraRemovedObservable.clear();\r\n this.onNewLightAddedObservable.clear();\r\n this.onLightRemovedObservable.clear();\r\n this.onNewGeometryAddedObservable.clear();\r\n this.onGeometryRemovedObservable.clear();\r\n this.onNewTransformNodeAddedObservable.clear();\r\n this.onTransformNodeRemovedObservable.clear();\r\n this.onNewMeshAddedObservable.clear();\r\n this.onMeshRemovedObservable.clear();\r\n this.onNewSkeletonAddedObservable.clear();\r\n this.onSkeletonRemovedObservable.clear();\r\n this.onNewMaterialAddedObservable.clear();\r\n this.onNewMultiMaterialAddedObservable.clear();\r\n this.onMaterialRemovedObservable.clear();\r\n this.onMultiMaterialRemovedObservable.clear();\r\n this.onNewTextureAddedObservable.clear();\r\n this.onTextureRemovedObservable.clear();\r\n this.onPrePointerObservable.clear();\r\n this.onPointerObservable.clear();\r\n this.onPreKeyboardObservable.clear();\r\n this.onKeyboardObservable.clear();\r\n this.onActiveCameraChanged.clear();\r\n this.detachControl();\r\n // Detach cameras\r\n var canvas = this._engine.getInputElement();\r\n if (canvas) {\r\n var index;\r\n for (index = 0; index < this.cameras.length; index++) {\r\n this.cameras[index].detachControl();\r\n }\r\n }\r\n // Release animation groups\r\n while (this.animationGroups.length) {\r\n this.animationGroups[0].dispose();\r\n }\r\n // Release lights\r\n while (this.lights.length) {\r\n this.lights[0].dispose();\r\n }\r\n // Release meshes\r\n while (this.meshes.length) {\r\n this.meshes[0].dispose(true);\r\n }\r\n while (this.transformNodes.length) {\r\n this.transformNodes[0].dispose(true);\r\n }\r\n // Release cameras\r\n while (this.cameras.length) {\r\n this.cameras[0].dispose();\r\n }\r\n // Release materials\r\n if (this._defaultMaterial) {\r\n this._defaultMaterial.dispose();\r\n }\r\n while (this.multiMaterials.length) {\r\n this.multiMaterials[0].dispose();\r\n }\r\n while (this.materials.length) {\r\n this.materials[0].dispose();\r\n }\r\n // Release particles\r\n while (this.particleSystems.length) {\r\n this.particleSystems[0].dispose();\r\n }\r\n // Release postProcesses\r\n while (this.postProcesses.length) {\r\n this.postProcesses[0].dispose();\r\n }\r\n // Release textures\r\n while (this.textures.length) {\r\n this.textures[0].dispose();\r\n }\r\n // Release UBO\r\n this._sceneUbo.dispose();\r\n if (this._multiviewSceneUbo) {\r\n this._multiviewSceneUbo.dispose();\r\n }\r\n // Post-processes\r\n this.postProcessManager.dispose();\r\n // Remove from engine\r\n index = this._engine.scenes.indexOf(this);\r\n if (index > -1) {\r\n this._engine.scenes.splice(index, 1);\r\n }\r\n this._engine.wipeCaches(true);\r\n this._isDisposed = true;\r\n };\r\n Object.defineProperty(Scene.prototype, \"isDisposed\", {\r\n /**\r\n * Gets if the scene is already disposed\r\n */\r\n get: function () {\r\n return this._isDisposed;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Call this function to reduce memory footprint of the scene.\r\n * Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)\r\n */\r\n Scene.prototype.clearCachedVertexData = function () {\r\n for (var meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\r\n var mesh = this.meshes[meshIndex];\r\n var geometry = mesh.geometry;\r\n if (geometry) {\r\n geometry._indices = [];\r\n for (var vbName in geometry._vertexBuffers) {\r\n if (!geometry._vertexBuffers.hasOwnProperty(vbName)) {\r\n continue;\r\n }\r\n geometry._vertexBuffers[vbName]._buffer._data = null;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * This function will remove the local cached buffer data from texture.\r\n * It will save memory but will prevent the texture from being rebuilt\r\n */\r\n Scene.prototype.cleanCachedTextureBuffer = function () {\r\n for (var _i = 0, _a = this.textures; _i < _a.length; _i++) {\r\n var baseTexture = _a[_i];\r\n var buffer = baseTexture._buffer;\r\n if (buffer) {\r\n baseTexture._buffer = null;\r\n }\r\n }\r\n };\r\n /**\r\n * Get the world extend vectors with an optional filter\r\n *\r\n * @param filterPredicate the predicate - which meshes should be included when calculating the world size\r\n * @returns {{ min: Vector3; max: Vector3 }} min and max vectors\r\n */\r\n Scene.prototype.getWorldExtends = function (filterPredicate) {\r\n var min = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n var max = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n filterPredicate = filterPredicate || (function () { return true; });\r\n this.meshes.filter(filterPredicate).forEach(function (mesh) {\r\n mesh.computeWorldMatrix(true);\r\n if (!mesh.subMeshes || mesh.subMeshes.length === 0 || mesh.infiniteDistance) {\r\n return;\r\n }\r\n var boundingInfo = mesh.getBoundingInfo();\r\n var minBox = boundingInfo.boundingBox.minimumWorld;\r\n var maxBox = boundingInfo.boundingBox.maximumWorld;\r\n Vector3.CheckExtends(minBox, min, max);\r\n Vector3.CheckExtends(maxBox, min, max);\r\n });\r\n return {\r\n min: min,\r\n max: max\r\n };\r\n };\r\n // Picking\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\r\n * @param camera defines the camera to use for the picking\r\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\r\n * @returns a Ray\r\n */\r\n Scene.prototype.createPickingRay = function (x, y, world, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\r\n * @param result defines the ray where to store the picking ray\r\n * @param camera defines the camera to use for the picking\r\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\r\n * @returns the current scene\r\n */\r\n Scene.prototype.createPickingRayToRef = function (x, y, world, result, camera, cameraViewSpace) {\r\n if (cameraViewSpace === void 0) { cameraViewSpace = false; }\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param camera defines the camera to use for the picking\r\n * @returns a Ray\r\n */\r\n Scene.prototype.createPickingRayInCameraSpace = function (x, y, camera) {\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Creates a ray that can be used to pick in the scene\r\n * @param x defines the x coordinate of the origin (on-screen)\r\n * @param y defines the y coordinate of the origin (on-screen)\r\n * @param result defines the ray where to store the picking ray\r\n * @param camera defines the camera to use for the picking\r\n * @returns the current scene\r\n */\r\n Scene.prototype.createPickingRayInCameraSpaceToRef = function (x, y, result, camera) {\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /** Launch a ray to try to pick a mesh in the scene\r\n * @param x position on screen\r\n * @param y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns a PickingInfo\r\n */\r\n Scene.prototype.pick = function (x, y, predicate, fastCheck, camera, trianglePredicate) {\r\n // Dummy info if picking as not been imported\r\n var pi = new PickingInfo();\r\n pi._pickingUnavailable = true;\r\n return pi;\r\n };\r\n /** Launch a ray to try to pick a mesh in the scene using only bounding information of the main mesh (not using submeshes)\r\n * @param x position on screen\r\n * @param y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @returns a PickingInfo (Please note that some info will not be set like distance, bv, bu and everything that cannot be capture by only using bounding infos)\r\n */\r\n Scene.prototype.pickWithBoundingInfo = function (x, y, predicate, fastCheck, camera) {\r\n // Dummy info if picking as not been imported\r\n var pi = new PickingInfo();\r\n pi._pickingUnavailable = true;\r\n return pi;\r\n };\r\n /** Use the given ray to pick a mesh in the scene\r\n * @param ray The ray to use to pick meshes\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must have isPickable set to true\r\n * @param fastCheck defines if the first intersection will be used (and not the closest)\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns a PickingInfo\r\n */\r\n Scene.prototype.pickWithRay = function (ray, predicate, fastCheck, trianglePredicate) {\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Launch a ray to try to pick a mesh in the scene\r\n * @param x X position on screen\r\n * @param y Y position on screen\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\r\n * @param camera camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns an array of PickingInfo\r\n */\r\n Scene.prototype.multiPick = function (x, y, predicate, camera, trianglePredicate) {\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Launch a ray to try to pick a mesh in the scene\r\n * @param ray Ray to use\r\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\r\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\r\n * @returns an array of PickingInfo\r\n */\r\n Scene.prototype.multiPickWithRay = function (ray, predicate, trianglePredicate) {\r\n throw _DevTools.WarnImport(\"Ray\");\r\n };\r\n /**\r\n * Force the value of meshUnderPointer\r\n * @param mesh defines the mesh to use\r\n * @param pointerId optional pointer id when using more than one pointer\r\n */\r\n Scene.prototype.setPointerOverMesh = function (mesh, pointerId) {\r\n this._inputManager.setPointerOverMesh(mesh, pointerId);\r\n };\r\n /**\r\n * Gets the mesh under the pointer\r\n * @returns a Mesh or null if no mesh is under the pointer\r\n */\r\n Scene.prototype.getPointerOverMesh = function () {\r\n return this._inputManager.getPointerOverMesh();\r\n };\r\n // Misc.\r\n /** @hidden */\r\n Scene.prototype._rebuildGeometries = function () {\r\n for (var _i = 0, _a = this.geometries; _i < _a.length; _i++) {\r\n var geometry = _a[_i];\r\n geometry._rebuild();\r\n }\r\n for (var _b = 0, _c = this.meshes; _b < _c.length; _b++) {\r\n var mesh = _c[_b];\r\n mesh._rebuild();\r\n }\r\n if (this.postProcessManager) {\r\n this.postProcessManager._rebuild();\r\n }\r\n for (var _d = 0, _e = this._components; _d < _e.length; _d++) {\r\n var component = _e[_d];\r\n component.rebuild();\r\n }\r\n for (var _f = 0, _g = this.particleSystems; _f < _g.length; _f++) {\r\n var system = _g[_f];\r\n system.rebuild();\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._rebuildTextures = function () {\r\n for (var _i = 0, _a = this.textures; _i < _a.length; _i++) {\r\n var texture = _a[_i];\r\n texture._rebuild();\r\n }\r\n this.markAllMaterialsAsDirty(1);\r\n };\r\n // Tags\r\n Scene.prototype._getByTags = function (list, tagsQuery, forEach) {\r\n if (tagsQuery === undefined) {\r\n // returns the complete list (could be done with Tags.MatchesQuery but no need to have a for-loop here)\r\n return list;\r\n }\r\n var listByTags = [];\r\n forEach = forEach || (function (item) { return; });\r\n for (var i in list) {\r\n var item = list[i];\r\n if (Tags && Tags.MatchesQuery(item, tagsQuery)) {\r\n listByTags.push(item);\r\n forEach(item);\r\n }\r\n }\r\n return listByTags;\r\n };\r\n /**\r\n * Get a list of meshes by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Mesh\r\n */\r\n Scene.prototype.getMeshesByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.meshes, tagsQuery, forEach);\r\n };\r\n /**\r\n * Get a list of cameras by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Camera\r\n */\r\n Scene.prototype.getCamerasByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.cameras, tagsQuery, forEach);\r\n };\r\n /**\r\n * Get a list of lights by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Light\r\n */\r\n Scene.prototype.getLightsByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.lights, tagsQuery, forEach);\r\n };\r\n /**\r\n * Get a list of materials by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of Material\r\n */\r\n Scene.prototype.getMaterialByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.materials, tagsQuery, forEach).concat(this._getByTags(this.multiMaterials, tagsQuery, forEach));\r\n };\r\n /**\r\n * Get a list of transform nodes by tags\r\n * @param tagsQuery defines the tags query to use\r\n * @param forEach defines a predicate used to filter results\r\n * @returns an array of TransformNode\r\n */\r\n Scene.prototype.getTransformNodesByTags = function (tagsQuery, forEach) {\r\n return this._getByTags(this.transformNodes, tagsQuery, forEach);\r\n };\r\n /**\r\n * Overrides the default sort function applied in the renderging group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversly depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n Scene.prototype.setRenderingOrder = function (renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {\r\n if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }\r\n if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }\r\n if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }\r\n this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);\r\n };\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n * @param depth Automatically clears depth between groups if true and autoClear is true.\r\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\r\n */\r\n Scene.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil, depth, stencil) {\r\n if (depth === void 0) { depth = true; }\r\n if (stencil === void 0) { stencil = true; }\r\n this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil, depth, stencil);\r\n };\r\n /**\r\n * Gets the current auto clear configuration for one rendering group of the rendering\r\n * manager.\r\n * @param index the rendering group index to get the information for\r\n * @returns The auto clear setup for the requested rendering group\r\n */\r\n Scene.prototype.getAutoClearDepthStencilSetup = function (index) {\r\n return this._renderingManager.getAutoClearDepthStencilSetup(index);\r\n };\r\n Object.defineProperty(Scene.prototype, \"blockMaterialDirtyMechanism\", {\r\n /** Gets or sets a boolean blocking all the calls to markAllMaterialsAsDirty (ie. the materials won't be updated if they are out of sync) */\r\n get: function () {\r\n return this._blockMaterialDirtyMechanism;\r\n },\r\n set: function (value) {\r\n if (this._blockMaterialDirtyMechanism === value) {\r\n return;\r\n }\r\n this._blockMaterialDirtyMechanism = value;\r\n if (!value) { // Do a complete update\r\n this.markAllMaterialsAsDirty(63);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Will flag all materials as dirty to trigger new shader compilation\r\n * @param flag defines the flag used to specify which material part must be marked as dirty\r\n * @param predicate If not null, it will be used to specifiy if a material has to be marked as dirty\r\n */\r\n Scene.prototype.markAllMaterialsAsDirty = function (flag, predicate) {\r\n if (this._blockMaterialDirtyMechanism) {\r\n return;\r\n }\r\n for (var _i = 0, _a = this.materials; _i < _a.length; _i++) {\r\n var material = _a[_i];\r\n if (predicate && !predicate(material)) {\r\n continue;\r\n }\r\n material.markAsDirty(flag);\r\n }\r\n };\r\n /** @hidden */\r\n Scene.prototype._loadFile = function (url, onSuccess, onProgress, useOfflineSupport, useArrayBuffer, onError) {\r\n var _this = this;\r\n var request = FileTools.LoadFile(url, onSuccess, onProgress, useOfflineSupport ? this.offlineProvider : undefined, useArrayBuffer, onError);\r\n this._activeRequests.push(request);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._activeRequests.splice(_this._activeRequests.indexOf(request), 1);\r\n });\r\n return request;\r\n };\r\n /** @hidden */\r\n Scene.prototype._loadFileAsync = function (url, onProgress, useOfflineSupport, useArrayBuffer) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._loadFile(url, function (data) {\r\n resolve(data);\r\n }, onProgress, useOfflineSupport, useArrayBuffer, function (request, exception) {\r\n reject(exception);\r\n });\r\n });\r\n };\r\n /** @hidden */\r\n Scene.prototype._requestFile = function (url, onSuccess, onProgress, useOfflineSupport, useArrayBuffer, onError, onOpened) {\r\n var _this = this;\r\n var request = FileTools.RequestFile(url, onSuccess, onProgress, useOfflineSupport ? this.offlineProvider : undefined, useArrayBuffer, onError, onOpened);\r\n this._activeRequests.push(request);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._activeRequests.splice(_this._activeRequests.indexOf(request), 1);\r\n });\r\n return request;\r\n };\r\n /** @hidden */\r\n Scene.prototype._requestFileAsync = function (url, onProgress, useOfflineSupport, useArrayBuffer, onOpened) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._requestFile(url, function (data) {\r\n resolve(data);\r\n }, onProgress, useOfflineSupport, useArrayBuffer, function (error) {\r\n reject(error);\r\n }, onOpened);\r\n });\r\n };\r\n /** @hidden */\r\n Scene.prototype._readFile = function (file, onSuccess, onProgress, useArrayBuffer, onError) {\r\n var _this = this;\r\n var request = FileTools.ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError);\r\n this._activeRequests.push(request);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._activeRequests.splice(_this._activeRequests.indexOf(request), 1);\r\n });\r\n return request;\r\n };\r\n /** @hidden */\r\n Scene.prototype._readFileAsync = function (file, onProgress, useArrayBuffer) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._readFile(file, function (data) {\r\n resolve(data);\r\n }, onProgress, useArrayBuffer, function (error) {\r\n reject(error);\r\n });\r\n });\r\n };\r\n /** The fog is deactivated */\r\n Scene.FOGMODE_NONE = 0;\r\n /** The fog density is following an exponential function */\r\n Scene.FOGMODE_EXP = 1;\r\n /** The fog density is following an exponential function faster than FOGMODE_EXP */\r\n Scene.FOGMODE_EXP2 = 2;\r\n /** The fog density is following a linear function. */\r\n Scene.FOGMODE_LINEAR = 3;\r\n /**\r\n * Gets or sets the minimum deltatime when deterministic lock step is enabled\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n */\r\n Scene.MinDeltaTime = 1.0;\r\n /**\r\n * Gets or sets the maximum deltatime when deterministic lock step is enabled\r\n * @see https://doc.babylonjs.com/babylon101/animations#deterministic-lockstep\r\n */\r\n Scene.MaxDeltaTime = 1000.0;\r\n return Scene;\r\n}(AbstractScene));\r\nexport { Scene };\r\n//# sourceMappingURL=scene.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * Groups all the scene component constants in one place to ease maintenance.\r\n * @hidden\r\n */\r\nvar SceneComponentConstants = /** @class */ (function () {\r\n function SceneComponentConstants() {\r\n }\r\n SceneComponentConstants.NAME_EFFECTLAYER = \"EffectLayer\";\r\n SceneComponentConstants.NAME_LAYER = \"Layer\";\r\n SceneComponentConstants.NAME_LENSFLARESYSTEM = \"LensFlareSystem\";\r\n SceneComponentConstants.NAME_BOUNDINGBOXRENDERER = \"BoundingBoxRenderer\";\r\n SceneComponentConstants.NAME_PARTICLESYSTEM = \"ParticleSystem\";\r\n SceneComponentConstants.NAME_GAMEPAD = \"Gamepad\";\r\n SceneComponentConstants.NAME_SIMPLIFICATIONQUEUE = \"SimplificationQueue\";\r\n SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER = \"GeometryBufferRenderer\";\r\n SceneComponentConstants.NAME_PREPASSRENDERER = \"PrePassRenderer\";\r\n SceneComponentConstants.NAME_DEPTHRENDERER = \"DepthRenderer\";\r\n SceneComponentConstants.NAME_POSTPROCESSRENDERPIPELINEMANAGER = \"PostProcessRenderPipelineManager\";\r\n SceneComponentConstants.NAME_SPRITE = \"Sprite\";\r\n SceneComponentConstants.NAME_SUBSURFACE = \"SubSurface\";\r\n SceneComponentConstants.NAME_OUTLINERENDERER = \"Outline\";\r\n SceneComponentConstants.NAME_PROCEDURALTEXTURE = \"ProceduralTexture\";\r\n SceneComponentConstants.NAME_SHADOWGENERATOR = \"ShadowGenerator\";\r\n SceneComponentConstants.NAME_OCTREE = \"Octree\";\r\n SceneComponentConstants.NAME_PHYSICSENGINE = \"PhysicsEngine\";\r\n SceneComponentConstants.NAME_AUDIO = \"Audio\";\r\n SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER = 0;\r\n SceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0;\r\n SceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0;\r\n SceneComponentConstants.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER = 0;\r\n SceneComponentConstants.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER = 1;\r\n SceneComponentConstants.STEP_BEFORECAMERADRAW_EFFECTLAYER = 0;\r\n SceneComponentConstants.STEP_BEFORECAMERADRAW_LAYER = 1;\r\n SceneComponentConstants.STEP_BEFORECAMERADRAW_PREPASS = 2;\r\n SceneComponentConstants.STEP_BEFORERENDERTARGETDRAW_LAYER = 0;\r\n SceneComponentConstants.STEP_BEFORERENDERINGMESH_PREPASS = 0;\r\n SceneComponentConstants.STEP_BEFORERENDERINGMESH_OUTLINE = 1;\r\n SceneComponentConstants.STEP_AFTERRENDERINGMESH_PREPASS = 0;\r\n SceneComponentConstants.STEP_AFTERRENDERINGMESH_OUTLINE = 1;\r\n SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW = 0;\r\n SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER = 1;\r\n SceneComponentConstants.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE = 0;\r\n SceneComponentConstants.STEP_BEFORECAMERAUPDATE_GAMEPAD = 1;\r\n SceneComponentConstants.STEP_BEFORECLEAR_PROCEDURALTEXTURE = 0;\r\n SceneComponentConstants.STEP_AFTERRENDERTARGETDRAW_LAYER = 0;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER = 0;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM = 1;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 2;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_LAYER = 3;\r\n SceneComponentConstants.STEP_AFTERCAMERADRAW_PREPASS = 4;\r\n SceneComponentConstants.STEP_AFTERRENDER_AUDIO = 0;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 0;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 1;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR = 2;\r\n SceneComponentConstants.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 3;\r\n SceneComponentConstants.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER = 0;\r\n SceneComponentConstants.STEP_BEFORECLEARSTAGE_PREPASS = 0;\r\n SceneComponentConstants.STEP_POINTERMOVE_SPRITE = 0;\r\n SceneComponentConstants.STEP_POINTERDOWN_SPRITE = 0;\r\n SceneComponentConstants.STEP_POINTERUP_SPRITE = 0;\r\n return SceneComponentConstants;\r\n}());\r\nexport { SceneComponentConstants };\r\n/**\r\n * Representation of a stage in the scene (Basically a list of ordered steps)\r\n * @hidden\r\n */\r\nvar Stage = /** @class */ (function (_super) {\r\n __extends(Stage, _super);\r\n /**\r\n * Hide ctor from the rest of the world.\r\n * @param items The items to add.\r\n */\r\n function Stage(items) {\r\n return _super.apply(this, items) || this;\r\n }\r\n /**\r\n * Creates a new Stage.\r\n * @returns A new instance of a Stage\r\n */\r\n Stage.Create = function () {\r\n return Object.create(Stage.prototype);\r\n };\r\n /**\r\n * Registers a step in an ordered way in the targeted stage.\r\n * @param index Defines the position to register the step in\r\n * @param component Defines the component attached to the step\r\n * @param action Defines the action to launch during the step\r\n */\r\n Stage.prototype.registerStep = function (index, component, action) {\r\n var i = 0;\r\n var maxIndex = Number.MAX_VALUE;\r\n for (; i < this.length; i++) {\r\n var step = this[i];\r\n maxIndex = step.index;\r\n if (index < maxIndex) {\r\n break;\r\n }\r\n }\r\n this.splice(i, 0, { index: index, component: component, action: action.bind(component) });\r\n };\r\n /**\r\n * Clears all the steps from the stage.\r\n */\r\n Stage.prototype.clear = function () {\r\n this.length = 0;\r\n };\r\n return Stage;\r\n}(Array));\r\nexport { Stage };\r\n//# sourceMappingURL=sceneComponent.js.map","import { SceneComponentConstants } from \"../sceneComponent\";\r\n/**\r\n * Defines the layer scene component responsible to manage any layers\r\n * in a given scene.\r\n */\r\nvar LayerSceneComponent = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n function LayerSceneComponent(scene) {\r\n /**\r\n * The component name helpfull to identify the component in the list of scene components.\r\n */\r\n this.name = SceneComponentConstants.NAME_LAYER;\r\n this.scene = scene;\r\n this._engine = scene.getEngine();\r\n scene.layers = new Array();\r\n }\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n LayerSceneComponent.prototype.register = function () {\r\n this.scene._beforeCameraDrawStage.registerStep(SceneComponentConstants.STEP_BEFORECAMERADRAW_LAYER, this, this._drawCameraBackground);\r\n this.scene._afterCameraDrawStage.registerStep(SceneComponentConstants.STEP_AFTERCAMERADRAW_LAYER, this, this._drawCameraForeground);\r\n this.scene._beforeRenderTargetDrawStage.registerStep(SceneComponentConstants.STEP_BEFORERENDERTARGETDRAW_LAYER, this, this._drawRenderTargetBackground);\r\n this.scene._afterRenderTargetDrawStage.registerStep(SceneComponentConstants.STEP_AFTERRENDERTARGETDRAW_LAYER, this, this._drawRenderTargetForeground);\r\n };\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n LayerSceneComponent.prototype.rebuild = function () {\r\n var layers = this.scene.layers;\r\n for (var _i = 0, layers_1 = layers; _i < layers_1.length; _i++) {\r\n var layer = layers_1[_i];\r\n layer._rebuild();\r\n }\r\n };\r\n /**\r\n * Disposes the component and the associated ressources.\r\n */\r\n LayerSceneComponent.prototype.dispose = function () {\r\n var layers = this.scene.layers;\r\n while (layers.length) {\r\n layers[0].dispose();\r\n }\r\n };\r\n LayerSceneComponent.prototype._draw = function (predicate) {\r\n var layers = this.scene.layers;\r\n if (layers.length) {\r\n this._engine.setDepthBuffer(false);\r\n for (var _i = 0, layers_2 = layers; _i < layers_2.length; _i++) {\r\n var layer = layers_2[_i];\r\n if (predicate(layer)) {\r\n layer.render();\r\n }\r\n }\r\n this._engine.setDepthBuffer(true);\r\n }\r\n };\r\n LayerSceneComponent.prototype._drawCameraPredicate = function (layer, isBackground, cameraLayerMask) {\r\n return !layer.renderOnlyInRenderTargetTextures &&\r\n layer.isBackground === isBackground &&\r\n ((layer.layerMask & cameraLayerMask) !== 0);\r\n };\r\n LayerSceneComponent.prototype._drawCameraBackground = function (camera) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawCameraPredicate(layer, true, camera.layerMask);\r\n });\r\n };\r\n LayerSceneComponent.prototype._drawCameraForeground = function (camera) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawCameraPredicate(layer, false, camera.layerMask);\r\n });\r\n };\r\n LayerSceneComponent.prototype._drawRenderTargetPredicate = function (layer, isBackground, cameraLayerMask, renderTargetTexture) {\r\n return (layer.renderTargetTextures.length > 0) &&\r\n layer.isBackground === isBackground &&\r\n (layer.renderTargetTextures.indexOf(renderTargetTexture) > -1) &&\r\n ((layer.layerMask & cameraLayerMask) !== 0);\r\n };\r\n LayerSceneComponent.prototype._drawRenderTargetBackground = function (renderTarget) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawRenderTargetPredicate(layer, true, _this.scene.activeCamera.layerMask, renderTarget);\r\n });\r\n };\r\n LayerSceneComponent.prototype._drawRenderTargetForeground = function (renderTarget) {\r\n var _this = this;\r\n this._draw(function (layer) {\r\n return _this._drawRenderTargetPredicate(layer, false, _this.scene.activeCamera.layerMask, renderTarget);\r\n });\r\n };\r\n /**\r\n * Adds all the elements from the container to the scene\r\n * @param container the container holding the elements\r\n */\r\n LayerSceneComponent.prototype.addFromContainer = function (container) {\r\n var _this = this;\r\n if (!container.layers) {\r\n return;\r\n }\r\n container.layers.forEach(function (layer) {\r\n _this.scene.layers.push(layer);\r\n });\r\n };\r\n /**\r\n * Removes all the elements in the container from the scene\r\n * @param container contains the elements to remove\r\n * @param dispose if the removed element should be disposed (default: false)\r\n */\r\n LayerSceneComponent.prototype.removeFromContainer = function (container, dispose) {\r\n var _this = this;\r\n if (dispose === void 0) { dispose = false; }\r\n if (!container.layers) {\r\n return;\r\n }\r\n container.layers.forEach(function (layer) {\r\n var index = _this.scene.layers.indexOf(layer);\r\n if (index !== -1) {\r\n _this.scene.layers.splice(index, 1);\r\n }\r\n if (dispose) {\r\n layer.dispose();\r\n }\r\n });\r\n };\r\n return LayerSceneComponent;\r\n}());\r\nexport { LayerSceneComponent };\r\n//# sourceMappingURL=layerSceneComponent.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/helperFunctions\";\r\nvar name = 'layerPixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n\\nuniform vec4 color;\\n\\n#include\\nvoid main(void) {\\nvec4 baseColor=texture2D(textureSampler,vUV);\\n#ifdef LINEAR\\nbaseColor.rgb=toGammaSpace(baseColor.rgb);\\n#endif\\n#ifdef ALPHATEST\\nif (baseColor.a<0.4)\\ndiscard;\\n#endif\\ngl_FragColor=baseColor*color;\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var layerPixelShader = { name: name, shader: shader };\r\n//# sourceMappingURL=layer.fragment.js.map","import { Effect } from \"../Materials/effect\";\r\nvar name = 'layerVertexShader';\r\nvar shader = \"\\nattribute vec2 position;\\n\\nuniform vec2 scale;\\nuniform vec2 offset;\\nuniform mat4 textureMatrix;\\n\\nvarying vec2 vUV;\\nconst vec2 madd=vec2(0.5,0.5);\\nvoid main(void) {\\nvec2 shiftedPosition=position*scale+offset;\\nvUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));\\ngl_Position=vec4(shiftedPosition,0.0,1.0);\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var layerVertexShader = { name: name, shader: shader };\r\n//# sourceMappingURL=layer.vertex.js.map","import { Observable } from \"../Misc/observable\";\r\nimport { Vector2 } from \"../Maths/math.vector\";\r\nimport { Color4 } from '../Maths/math.color';\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { Material } from \"../Materials/material\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { LayerSceneComponent } from \"./layerSceneComponent\";\r\nimport \"../Shaders/layer.fragment\";\r\nimport \"../Shaders/layer.vertex\";\r\n/**\r\n * This represents a full screen 2d layer.\r\n * This can be useful to display a picture in the background of your scene for instance.\r\n * @see https://www.babylonjs-playground.com/#08A2BS#1\r\n */\r\nvar Layer = /** @class */ (function () {\r\n /**\r\n * Instantiates a new layer.\r\n * This represents a full screen 2d layer.\r\n * This can be useful to display a picture in the background of your scene for instance.\r\n * @see https://www.babylonjs-playground.com/#08A2BS#1\r\n * @param name Define the name of the layer in the scene\r\n * @param imgUrl Define the url of the texture to display in the layer\r\n * @param scene Define the scene the layer belongs to\r\n * @param isBackground Defines whether the layer is displayed in front or behind the scene\r\n * @param color Defines a color for the layer\r\n */\r\n function Layer(\r\n /**\r\n * Define the name of the layer.\r\n */\r\n name, imgUrl, scene, isBackground, color) {\r\n this.name = name;\r\n /**\r\n * Define the scale of the layer in order to zoom in out of the texture.\r\n */\r\n this.scale = new Vector2(1, 1);\r\n /**\r\n * Define an offset for the layer in order to shift the texture.\r\n */\r\n this.offset = new Vector2(0, 0);\r\n /**\r\n * Define the alpha blending mode used in the layer in case the texture or color has an alpha.\r\n */\r\n this.alphaBlendingMode = 2;\r\n /**\r\n * Define a mask to restrict the layer to only some of the scene cameras.\r\n */\r\n this.layerMask = 0x0FFFFFFF;\r\n /**\r\n * Define the list of render target the layer is visible into.\r\n */\r\n this.renderTargetTextures = [];\r\n /**\r\n * Define if the layer is only used in renderTarget or if it also\r\n * renders in the main frame buffer of the canvas.\r\n */\r\n this.renderOnlyInRenderTargetTextures = false;\r\n this._vertexBuffers = {};\r\n /**\r\n * An event triggered when the layer is disposed.\r\n */\r\n this.onDisposeObservable = new Observable();\r\n /**\r\n * An event triggered before rendering the scene\r\n */\r\n this.onBeforeRenderObservable = new Observable();\r\n /**\r\n * An event triggered after rendering the scene\r\n */\r\n this.onAfterRenderObservable = new Observable();\r\n this.texture = imgUrl ? new Texture(imgUrl, scene, true) : null;\r\n this.isBackground = isBackground === undefined ? true : isBackground;\r\n this.color = color === undefined ? new Color4(1, 1, 1, 1) : color;\r\n this._scene = (scene || EngineStore.LastCreatedScene);\r\n var layerComponent = this._scene._getComponent(SceneComponentConstants.NAME_LAYER);\r\n if (!layerComponent) {\r\n layerComponent = new LayerSceneComponent(this._scene);\r\n this._scene._addComponent(layerComponent);\r\n }\r\n this._scene.layers.push(this);\r\n var engine = this._scene.getEngine();\r\n // VBO\r\n var vertices = [];\r\n vertices.push(1, 1);\r\n vertices.push(-1, 1);\r\n vertices.push(-1, -1);\r\n vertices.push(1, -1);\r\n var vertexBuffer = new VertexBuffer(engine, vertices, VertexBuffer.PositionKind, false, false, 2);\r\n this._vertexBuffers[VertexBuffer.PositionKind] = vertexBuffer;\r\n this._createIndexBuffer();\r\n }\r\n Object.defineProperty(Layer.prototype, \"onDispose\", {\r\n /**\r\n * Back compatibility with callback before the onDisposeObservable existed.\r\n * The set callback will be triggered when the layer has been disposed.\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Layer.prototype, \"onBeforeRender\", {\r\n /**\r\n * Back compatibility with callback before the onBeforeRenderObservable existed.\r\n * The set callback will be triggered just before rendering the layer.\r\n */\r\n set: function (callback) {\r\n if (this._onBeforeRenderObserver) {\r\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n }\r\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Layer.prototype, \"onAfterRender\", {\r\n /**\r\n * Back compatibility with callback before the onAfterRenderObservable existed.\r\n * The set callback will be triggered just after rendering the layer.\r\n */\r\n set: function (callback) {\r\n if (this._onAfterRenderObserver) {\r\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\r\n }\r\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Layer.prototype._createIndexBuffer = function () {\r\n var engine = this._scene.getEngine();\r\n // Indices\r\n var indices = [];\r\n indices.push(0);\r\n indices.push(1);\r\n indices.push(2);\r\n indices.push(0);\r\n indices.push(2);\r\n indices.push(3);\r\n this._indexBuffer = engine.createIndexBuffer(indices);\r\n };\r\n /** @hidden */\r\n Layer.prototype._rebuild = function () {\r\n var vb = this._vertexBuffers[VertexBuffer.PositionKind];\r\n if (vb) {\r\n vb._rebuild();\r\n }\r\n this._createIndexBuffer();\r\n };\r\n /**\r\n * Renders the layer in the scene.\r\n */\r\n Layer.prototype.render = function () {\r\n var engine = this._scene.getEngine();\r\n var defines = \"\";\r\n if (this.alphaTest) {\r\n defines = \"#define ALPHATEST\";\r\n }\r\n if (this.texture && !this.texture.gammaSpace) {\r\n defines += \"\\r\\n#define LINEAR\";\r\n }\r\n if (this._previousDefines !== defines) {\r\n this._previousDefines = defines;\r\n this._effect = engine.createEffect(\"layer\", [VertexBuffer.PositionKind], [\"textureMatrix\", \"color\", \"scale\", \"offset\"], [\"textureSampler\"], defines);\r\n }\r\n var currentEffect = this._effect;\r\n // Check\r\n if (!currentEffect || !currentEffect.isReady() || !this.texture || !this.texture.isReady()) {\r\n return;\r\n }\r\n var engine = this._scene.getEngine();\r\n this.onBeforeRenderObservable.notifyObservers(this);\r\n // Render\r\n engine.enableEffect(currentEffect);\r\n engine.setState(false);\r\n // Texture\r\n currentEffect.setTexture(\"textureSampler\", this.texture);\r\n currentEffect.setMatrix(\"textureMatrix\", this.texture.getTextureMatrix());\r\n // Color\r\n currentEffect.setFloat4(\"color\", this.color.r, this.color.g, this.color.b, this.color.a);\r\n // Scale / offset\r\n currentEffect.setVector2(\"offset\", this.offset);\r\n currentEffect.setVector2(\"scale\", this.scale);\r\n // VBOs\r\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, currentEffect);\r\n // Draw order\r\n if (!this.alphaTest) {\r\n engine.setAlphaMode(this.alphaBlendingMode);\r\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\r\n engine.setAlphaMode(0);\r\n }\r\n else {\r\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\r\n }\r\n this.onAfterRenderObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Disposes and releases the associated ressources.\r\n */\r\n Layer.prototype.dispose = function () {\r\n var vertexBuffer = this._vertexBuffers[VertexBuffer.PositionKind];\r\n if (vertexBuffer) {\r\n vertexBuffer.dispose();\r\n this._vertexBuffers[VertexBuffer.PositionKind] = null;\r\n }\r\n if (this._indexBuffer) {\r\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\r\n this._indexBuffer = null;\r\n }\r\n if (this.texture) {\r\n this.texture.dispose();\r\n this.texture = null;\r\n }\r\n // Clean RTT list\r\n this.renderTargetTextures = [];\r\n // Remove from scene\r\n var index = this._scene.layers.indexOf(this);\r\n this._scene.layers.splice(index, 1);\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this.onAfterRenderObservable.clear();\r\n this.onBeforeRenderObservable.clear();\r\n };\r\n return Layer;\r\n}());\r\nexport { Layer };\r\n//# sourceMappingURL=layer.js.map","import { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { ValueAndUnit } from \"./valueAndUnit\";\r\n/**\r\n * Define a style used by control to automatically setup properties based on a template.\r\n * Only support font related properties so far\r\n */\r\nvar Style = /** @class */ (function () {\r\n /**\r\n * Creates a new style object\r\n * @param host defines the AdvancedDynamicTexture which hosts this style\r\n */\r\n function Style(host) {\r\n this._fontFamily = \"Arial\";\r\n this._fontStyle = \"\";\r\n this._fontWeight = \"\";\r\n /** @hidden */\r\n this._fontSize = new ValueAndUnit(18, ValueAndUnit.UNITMODE_PIXEL, false);\r\n /**\r\n * Observable raised when the style values are changed\r\n */\r\n this.onChangedObservable = new Observable();\r\n this._host = host;\r\n }\r\n Object.defineProperty(Style.prototype, \"fontSize\", {\r\n /**\r\n * Gets or sets the font size\r\n */\r\n get: function () {\r\n return this._fontSize.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._fontSize.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._fontSize.fromString(value)) {\r\n this.onChangedObservable.notifyObservers(this);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Style.prototype, \"fontFamily\", {\r\n /**\r\n * Gets or sets the font family\r\n */\r\n get: function () {\r\n return this._fontFamily;\r\n },\r\n set: function (value) {\r\n if (this._fontFamily === value) {\r\n return;\r\n }\r\n this._fontFamily = value;\r\n this.onChangedObservable.notifyObservers(this);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Style.prototype, \"fontStyle\", {\r\n /**\r\n * Gets or sets the font style\r\n */\r\n get: function () {\r\n return this._fontStyle;\r\n },\r\n set: function (value) {\r\n if (this._fontStyle === value) {\r\n return;\r\n }\r\n this._fontStyle = value;\r\n this.onChangedObservable.notifyObservers(this);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Style.prototype, \"fontWeight\", {\r\n /** Gets or sets font weight */\r\n get: function () {\r\n return this._fontWeight;\r\n },\r\n set: function (value) {\r\n if (this._fontWeight === value) {\r\n return;\r\n }\r\n this._fontWeight = value;\r\n this.onChangedObservable.notifyObservers(this);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** Dispose all associated resources */\r\n Style.prototype.dispose = function () {\r\n this.onChangedObservable.clear();\r\n };\r\n return Style;\r\n}());\r\nexport { Style };\r\n//# sourceMappingURL=style.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Vector2, Vector3 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { PointerEventTypes } from '@babylonjs/core/Events/pointerEvents';\r\nimport { ClipboardEventTypes, ClipboardInfo } from \"@babylonjs/core/Events/clipboardEvents\";\r\nimport { KeyboardEventTypes } from \"@babylonjs/core/Events/keyboardEvents\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\r\nimport { DynamicTexture } from \"@babylonjs/core/Materials/Textures/dynamicTexture\";\r\nimport { Layer } from \"@babylonjs/core/Layers/layer\";\r\nimport { Container } from \"./controls/container\";\r\nimport { Style } from \"./style\";\r\nimport { Measure } from \"./measure\";\r\nimport { Constants } from '@babylonjs/core/Engines/constants';\r\nimport { Viewport } from '@babylonjs/core/Maths/math.viewport';\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\n/**\r\n* Class used to create texture to support 2D GUI elements\r\n* @see https://doc.babylonjs.com/how_to/gui\r\n*/\r\nvar AdvancedDynamicTexture = /** @class */ (function (_super) {\r\n __extends(AdvancedDynamicTexture, _super);\r\n /**\r\n * Creates a new AdvancedDynamicTexture\r\n * @param name defines the name of the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param scene defines the hosting scene\r\n * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)\r\n * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\r\n */\r\n function AdvancedDynamicTexture(name, width, height, scene, generateMipMaps, samplingMode, invertY) {\r\n if (width === void 0) { width = 0; }\r\n if (height === void 0) { height = 0; }\r\n if (generateMipMaps === void 0) { generateMipMaps = false; }\r\n if (samplingMode === void 0) { samplingMode = Texture.NEAREST_SAMPLINGMODE; }\r\n var _this = _super.call(this, name, { width: width, height: height }, scene, generateMipMaps, samplingMode, Constants.TEXTUREFORMAT_RGBA, invertY) || this;\r\n _this._isDirty = false;\r\n /** @hidden */\r\n _this._rootContainer = new Container(\"root\");\r\n /** @hidden */\r\n _this._lastControlOver = {};\r\n /** @hidden */\r\n _this._lastControlDown = {};\r\n /** @hidden */\r\n _this._capturingControl = {};\r\n /** @hidden */\r\n _this._linkedControls = new Array();\r\n _this._isFullscreen = false;\r\n _this._fullscreenViewport = new Viewport(0, 0, 1, 1);\r\n _this._idealWidth = 0;\r\n _this._idealHeight = 0;\r\n _this._useSmallestIdeal = false;\r\n _this._renderAtIdealSize = false;\r\n _this._blockNextFocusCheck = false;\r\n _this._renderScale = 1;\r\n _this._cursorChanged = false;\r\n _this._defaultMousePointerId = 0;\r\n /** @hidden */\r\n _this._numLayoutCalls = 0;\r\n /** @hidden */\r\n _this._numRenderCalls = 0;\r\n /**\r\n * Define type to string to ensure compatibility across browsers\r\n * Safari doesn't support DataTransfer constructor\r\n */\r\n _this._clipboardData = \"\";\r\n /**\r\n * Observable event triggered each time an clipboard event is received from the rendering canvas\r\n */\r\n _this.onClipboardObservable = new Observable();\r\n /**\r\n * Observable event triggered each time a pointer down is intercepted by a control\r\n */\r\n _this.onControlPickedObservable = new Observable();\r\n /**\r\n * Observable event triggered before layout is evaluated\r\n */\r\n _this.onBeginLayoutObservable = new Observable();\r\n /**\r\n * Observable event triggered after the layout was evaluated\r\n */\r\n _this.onEndLayoutObservable = new Observable();\r\n /**\r\n * Observable event triggered before the texture is rendered\r\n */\r\n _this.onBeginRenderObservable = new Observable();\r\n /**\r\n * Observable event triggered after the texture was rendered\r\n */\r\n _this.onEndRenderObservable = new Observable();\r\n /**\r\n * Gets or sets a boolean defining if alpha is stored as premultiplied\r\n */\r\n _this.premulAlpha = false;\r\n /**\r\n * Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture\r\n */\r\n _this.applyYInversionOnUpdate = true;\r\n _this._useInvalidateRectOptimization = true;\r\n // Invalidated rectangle which is the combination of all invalidated controls after they have been rotated into absolute position\r\n _this._invalidatedRectangle = null;\r\n _this._clearMeasure = new Measure(0, 0, 0, 0);\r\n /** @hidden */\r\n _this.onClipboardCopy = function (rawEvt) {\r\n var evt = rawEvt;\r\n var ev = new ClipboardInfo(ClipboardEventTypes.COPY, evt);\r\n _this.onClipboardObservable.notifyObservers(ev);\r\n evt.preventDefault();\r\n };\r\n /** @hidden */\r\n _this.onClipboardCut = function (rawEvt) {\r\n var evt = rawEvt;\r\n var ev = new ClipboardInfo(ClipboardEventTypes.CUT, evt);\r\n _this.onClipboardObservable.notifyObservers(ev);\r\n evt.preventDefault();\r\n };\r\n /** @hidden */\r\n _this.onClipboardPaste = function (rawEvt) {\r\n var evt = rawEvt;\r\n var ev = new ClipboardInfo(ClipboardEventTypes.PASTE, evt);\r\n _this.onClipboardObservable.notifyObservers(ev);\r\n evt.preventDefault();\r\n };\r\n scene = _this.getScene();\r\n if (!scene || !_this._texture) {\r\n return _this;\r\n }\r\n _this._rootElement = scene.getEngine().getInputElement();\r\n _this._renderObserver = scene.onBeforeCameraRenderObservable.add(function (camera) { return _this._checkUpdate(camera); });\r\n _this._preKeyboardObserver = scene.onPreKeyboardObservable.add(function (info) {\r\n if (!_this._focusedControl) {\r\n return;\r\n }\r\n if (info.type === KeyboardEventTypes.KEYDOWN) {\r\n _this._focusedControl.processKeyboard(info.event);\r\n }\r\n info.skipOnPointerObservable = true;\r\n });\r\n _this._rootContainer._link(_this);\r\n _this.hasAlpha = true;\r\n if (!width || !height) {\r\n _this._resizeObserver = scene.getEngine().onResizeObservable.add(function () { return _this._onResize(); });\r\n _this._onResize();\r\n }\r\n _this._texture.isReady = true;\r\n return _this;\r\n }\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"numLayoutCalls\", {\r\n /** Gets the number of layout calls made the last time the ADT has been rendered */\r\n get: function () {\r\n return this._numLayoutCalls;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"numRenderCalls\", {\r\n /** Gets the number of render calls made the last time the ADT has been rendered */\r\n get: function () {\r\n return this._numRenderCalls;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"renderScale\", {\r\n /**\r\n * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).\r\n * Useful when you want more antialiasing\r\n */\r\n get: function () {\r\n return this._renderScale;\r\n },\r\n set: function (value) {\r\n if (value === this._renderScale) {\r\n return;\r\n }\r\n this._renderScale = value;\r\n this._onResize();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"background\", {\r\n /** Gets or sets the background color */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this.markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"idealWidth\", {\r\n /**\r\n * Gets or sets the ideal width used to design controls.\r\n * The GUI will then rescale everything accordingly\r\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\r\n */\r\n get: function () {\r\n return this._idealWidth;\r\n },\r\n set: function (value) {\r\n if (this._idealWidth === value) {\r\n return;\r\n }\r\n this._idealWidth = value;\r\n this.markAsDirty();\r\n this._rootContainer._markAllAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"idealHeight\", {\r\n /**\r\n * Gets or sets the ideal height used to design controls.\r\n * The GUI will then rescale everything accordingly\r\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\r\n */\r\n get: function () {\r\n return this._idealHeight;\r\n },\r\n set: function (value) {\r\n if (this._idealHeight === value) {\r\n return;\r\n }\r\n this._idealHeight = value;\r\n this.markAsDirty();\r\n this._rootContainer._markAllAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"useSmallestIdeal\", {\r\n /**\r\n * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set\r\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\r\n */\r\n get: function () {\r\n return this._useSmallestIdeal;\r\n },\r\n set: function (value) {\r\n if (this._useSmallestIdeal === value) {\r\n return;\r\n }\r\n this._useSmallestIdeal = value;\r\n this.markAsDirty();\r\n this._rootContainer._markAllAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"renderAtIdealSize\", {\r\n /**\r\n * Gets or sets a boolean indicating if adaptive scaling must be used\r\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\r\n */\r\n get: function () {\r\n return this._renderAtIdealSize;\r\n },\r\n set: function (value) {\r\n if (this._renderAtIdealSize === value) {\r\n return;\r\n }\r\n this._renderAtIdealSize = value;\r\n this._onResize();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"idealRatio\", {\r\n /**\r\n * Gets the ratio used when in \"ideal mode\"\r\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\r\n * */\r\n get: function () {\r\n var rwidth = 0;\r\n var rheight = 0;\r\n if (this._idealWidth) {\r\n rwidth = (this.getSize().width) / this._idealWidth;\r\n }\r\n if (this._idealHeight) {\r\n rheight = (this.getSize().height) / this._idealHeight;\r\n }\r\n if (this._useSmallestIdeal && this._idealWidth && this._idealHeight) {\r\n return window.innerWidth < window.innerHeight ? rwidth : rheight;\r\n }\r\n if (this._idealWidth) { // horizontal\r\n return rwidth;\r\n }\r\n if (this._idealHeight) { // vertical\r\n return rheight;\r\n }\r\n return 1;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"layer\", {\r\n /**\r\n * Gets the underlying layer used to render the texture when in fullscreen mode\r\n */\r\n get: function () {\r\n return this._layerToDispose;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"rootContainer\", {\r\n /**\r\n * Gets the root container control\r\n */\r\n get: function () {\r\n return this._rootContainer;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns an array containing the root container.\r\n * This is mostly used to let the Inspector introspects the ADT\r\n * @returns an array containing the rootContainer\r\n */\r\n AdvancedDynamicTexture.prototype.getChildren = function () {\r\n return [this._rootContainer];\r\n };\r\n /**\r\n * Will return all controls that are inside this texture\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @return all child controls\r\n */\r\n AdvancedDynamicTexture.prototype.getDescendants = function (directDescendantsOnly, predicate) {\r\n return this._rootContainer.getDescendants(directDescendantsOnly, predicate);\r\n };\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"focusedControl\", {\r\n /**\r\n * Gets or sets the current focused control\r\n */\r\n get: function () {\r\n return this._focusedControl;\r\n },\r\n set: function (control) {\r\n if (this._focusedControl == control) {\r\n return;\r\n }\r\n if (this._focusedControl) {\r\n this._focusedControl.onBlur();\r\n }\r\n if (control) {\r\n control.onFocus();\r\n }\r\n this._focusedControl = control;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"isForeground\", {\r\n /**\r\n * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode\r\n */\r\n get: function () {\r\n if (!this.layer) {\r\n return true;\r\n }\r\n return (!this.layer.isBackground);\r\n },\r\n set: function (value) {\r\n if (!this.layer) {\r\n return;\r\n }\r\n if (this.layer.isBackground === !value) {\r\n return;\r\n }\r\n this.layer.isBackground = !value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"clipboardData\", {\r\n /**\r\n * Gets or set information about clipboardData\r\n */\r\n get: function () {\r\n return this._clipboardData;\r\n },\r\n set: function (value) {\r\n this._clipboardData = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"AdvancedDynamicTexture\"\r\n */\r\n AdvancedDynamicTexture.prototype.getClassName = function () {\r\n return \"AdvancedDynamicTexture\";\r\n };\r\n /**\r\n * Function used to execute a function on all controls\r\n * @param func defines the function to execute\r\n * @param container defines the container where controls belong. If null the root container will be used\r\n */\r\n AdvancedDynamicTexture.prototype.executeOnAllControls = function (func, container) {\r\n if (!container) {\r\n container = this._rootContainer;\r\n }\r\n func(container);\r\n for (var _i = 0, _a = container.children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (child.children) {\r\n this.executeOnAllControls(func, child);\r\n continue;\r\n }\r\n func(child);\r\n }\r\n };\r\n Object.defineProperty(AdvancedDynamicTexture.prototype, \"useInvalidateRectOptimization\", {\r\n /**\r\n * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on\r\n */\r\n get: function () {\r\n return this._useInvalidateRectOptimization;\r\n },\r\n set: function (value) {\r\n this._useInvalidateRectOptimization = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Invalidates a rectangle area on the gui texture\r\n * @param invalidMinX left most position of the rectangle to invalidate in the texture\r\n * @param invalidMinY top most position of the rectangle to invalidate in the texture\r\n * @param invalidMaxX right most position of the rectangle to invalidate in the texture\r\n * @param invalidMaxY bottom most position of the rectangle to invalidate in the texture\r\n */\r\n AdvancedDynamicTexture.prototype.invalidateRect = function (invalidMinX, invalidMinY, invalidMaxX, invalidMaxY) {\r\n if (!this._useInvalidateRectOptimization) {\r\n return;\r\n }\r\n if (!this._invalidatedRectangle) {\r\n this._invalidatedRectangle = new Measure(invalidMinX, invalidMinY, invalidMaxX - invalidMinX + 1, invalidMaxY - invalidMinY + 1);\r\n }\r\n else {\r\n // Compute intersection\r\n var maxX = Math.ceil(Math.max(this._invalidatedRectangle.left + this._invalidatedRectangle.width - 1, invalidMaxX));\r\n var maxY = Math.ceil(Math.max(this._invalidatedRectangle.top + this._invalidatedRectangle.height - 1, invalidMaxY));\r\n this._invalidatedRectangle.left = Math.floor(Math.min(this._invalidatedRectangle.left, invalidMinX));\r\n this._invalidatedRectangle.top = Math.floor(Math.min(this._invalidatedRectangle.top, invalidMinY));\r\n this._invalidatedRectangle.width = maxX - this._invalidatedRectangle.left + 1;\r\n this._invalidatedRectangle.height = maxY - this._invalidatedRectangle.top + 1;\r\n }\r\n };\r\n /**\r\n * Marks the texture as dirty forcing a complete update\r\n */\r\n AdvancedDynamicTexture.prototype.markAsDirty = function () {\r\n this._isDirty = true;\r\n };\r\n /**\r\n * Helper function used to create a new style\r\n * @returns a new style\r\n * @see https://doc.babylonjs.com/how_to/gui#styles\r\n */\r\n AdvancedDynamicTexture.prototype.createStyle = function () {\r\n return new Style(this);\r\n };\r\n /**\r\n * Adds a new control to the root container\r\n * @param control defines the control to add\r\n * @returns the current texture\r\n */\r\n AdvancedDynamicTexture.prototype.addControl = function (control) {\r\n this._rootContainer.addControl(control);\r\n return this;\r\n };\r\n /**\r\n * Removes a control from the root container\r\n * @param control defines the control to remove\r\n * @returns the current texture\r\n */\r\n AdvancedDynamicTexture.prototype.removeControl = function (control) {\r\n this._rootContainer.removeControl(control);\r\n return this;\r\n };\r\n /**\r\n * Release all resources\r\n */\r\n AdvancedDynamicTexture.prototype.dispose = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._rootElement = null;\r\n scene.onBeforeCameraRenderObservable.remove(this._renderObserver);\r\n if (this._resizeObserver) {\r\n scene.getEngine().onResizeObservable.remove(this._resizeObserver);\r\n }\r\n if (this._pointerMoveObserver) {\r\n scene.onPrePointerObservable.remove(this._pointerMoveObserver);\r\n }\r\n if (this._pointerObserver) {\r\n scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n if (this._preKeyboardObserver) {\r\n scene.onPreKeyboardObservable.remove(this._preKeyboardObserver);\r\n }\r\n if (this._canvasPointerOutObserver) {\r\n scene.getEngine().onCanvasPointerOutObservable.remove(this._canvasPointerOutObserver);\r\n }\r\n if (this._canvasBlurObserver) {\r\n scene.getEngine().onCanvasBlurObservable.remove(this._canvasBlurObserver);\r\n }\r\n if (this._layerToDispose) {\r\n this._layerToDispose.texture = null;\r\n this._layerToDispose.dispose();\r\n this._layerToDispose = null;\r\n }\r\n this._rootContainer.dispose();\r\n this.onClipboardObservable.clear();\r\n this.onControlPickedObservable.clear();\r\n this.onBeginRenderObservable.clear();\r\n this.onEndRenderObservable.clear();\r\n this.onBeginLayoutObservable.clear();\r\n this.onEndLayoutObservable.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n AdvancedDynamicTexture.prototype._onResize = function () {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n // Check size\r\n var engine = scene.getEngine();\r\n var textureSize = this.getSize();\r\n var renderWidth = engine.getRenderWidth() * this._renderScale;\r\n var renderHeight = engine.getRenderHeight() * this._renderScale;\r\n if (this._renderAtIdealSize) {\r\n if (this._idealWidth) {\r\n renderHeight = (renderHeight * this._idealWidth) / renderWidth;\r\n renderWidth = this._idealWidth;\r\n }\r\n else if (this._idealHeight) {\r\n renderWidth = (renderWidth * this._idealHeight) / renderHeight;\r\n renderHeight = this._idealHeight;\r\n }\r\n }\r\n if (textureSize.width !== renderWidth || textureSize.height !== renderHeight) {\r\n this.scaleTo(renderWidth, renderHeight);\r\n this.markAsDirty();\r\n if (this._idealWidth || this._idealHeight) {\r\n this._rootContainer._markAllAsDirty();\r\n }\r\n }\r\n this.invalidateRect(0, 0, textureSize.width - 1, textureSize.height - 1);\r\n };\r\n /** @hidden */\r\n AdvancedDynamicTexture.prototype._getGlobalViewport = function (scene) {\r\n var engine = scene.getEngine();\r\n return this._fullscreenViewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight());\r\n };\r\n /**\r\n * Get screen coordinates for a vector3\r\n * @param position defines the position to project\r\n * @param worldMatrix defines the world matrix to use\r\n * @returns the projected position\r\n */\r\n AdvancedDynamicTexture.prototype.getProjectedPosition = function (position, worldMatrix) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return Vector2.Zero();\r\n }\r\n var globalViewport = this._getGlobalViewport(scene);\r\n var projectedPosition = Vector3.Project(position, worldMatrix, scene.getTransformMatrix(), globalViewport);\r\n projectedPosition.scaleInPlace(this.renderScale);\r\n return new Vector2(projectedPosition.x, projectedPosition.y);\r\n };\r\n /**\r\n * Get screen coordinates for a vector3\r\n * @param position defines the position to project\r\n * @param worldMatrix defines the world matrix to use\r\n * @returns the projected position with Z\r\n */\r\n AdvancedDynamicTexture.prototype.getProjectedPositionWithZ = function (position, worldMatrix) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return Vector3.Zero();\r\n }\r\n var globalViewport = this._getGlobalViewport(scene);\r\n var projectedPosition = Vector3.Project(position, worldMatrix, scene.getTransformMatrix(), globalViewport);\r\n projectedPosition.scaleInPlace(this.renderScale);\r\n return new Vector3(projectedPosition.x, projectedPosition.y, projectedPosition.z);\r\n };\r\n AdvancedDynamicTexture.prototype._checkUpdate = function (camera) {\r\n if (this._layerToDispose) {\r\n if ((camera.layerMask & this._layerToDispose.layerMask) === 0) {\r\n return;\r\n }\r\n }\r\n if (this._isFullscreen && this._linkedControls.length) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var globalViewport = this._getGlobalViewport(scene);\r\n var _loop_1 = function (control) {\r\n if (!control.isVisible) {\r\n return \"continue\";\r\n }\r\n var mesh = control._linkedMesh;\r\n if (!mesh || mesh.isDisposed()) {\r\n Tools.SetImmediate(function () {\r\n control.linkWithMesh(null);\r\n });\r\n return \"continue\";\r\n }\r\n var position = mesh.getBoundingInfo ? mesh.getBoundingInfo().boundingSphere.center : Vector3.ZeroReadOnly;\r\n var projectedPosition = Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);\r\n if (projectedPosition.z < 0 || projectedPosition.z > 1) {\r\n control.notRenderable = true;\r\n return \"continue\";\r\n }\r\n control.notRenderable = false;\r\n // Account for RenderScale.\r\n projectedPosition.scaleInPlace(this_1.renderScale);\r\n control._moveToProjectedPosition(projectedPosition);\r\n };\r\n var this_1 = this;\r\n for (var _i = 0, _a = this._linkedControls; _i < _a.length; _i++) {\r\n var control = _a[_i];\r\n _loop_1(control);\r\n }\r\n }\r\n if (!this._isDirty && !this._rootContainer.isDirty) {\r\n return;\r\n }\r\n this._isDirty = false;\r\n this._render();\r\n this.update(this.applyYInversionOnUpdate, this.premulAlpha);\r\n };\r\n AdvancedDynamicTexture.prototype._render = function () {\r\n var textureSize = this.getSize();\r\n var renderWidth = textureSize.width;\r\n var renderHeight = textureSize.height;\r\n var context = this.getContext();\r\n context.font = \"18px Arial\";\r\n context.strokeStyle = \"white\";\r\n // Layout\r\n this.onBeginLayoutObservable.notifyObservers(this);\r\n var measure = new Measure(0, 0, renderWidth, renderHeight);\r\n this._numLayoutCalls = 0;\r\n this._rootContainer._layout(measure, context);\r\n this.onEndLayoutObservable.notifyObservers(this);\r\n this._isDirty = false; // Restoring the dirty state that could have been set by controls during layout processing\r\n // Clear\r\n if (this._invalidatedRectangle) {\r\n this._clearMeasure.copyFrom(this._invalidatedRectangle);\r\n }\r\n else {\r\n this._clearMeasure.copyFromFloats(0, 0, renderWidth, renderHeight);\r\n }\r\n context.clearRect(this._clearMeasure.left, this._clearMeasure.top, this._clearMeasure.width, this._clearMeasure.height);\r\n if (this._background) {\r\n context.save();\r\n context.fillStyle = this._background;\r\n context.fillRect(this._clearMeasure.left, this._clearMeasure.top, this._clearMeasure.width, this._clearMeasure.height);\r\n context.restore();\r\n }\r\n // Render\r\n this.onBeginRenderObservable.notifyObservers(this);\r\n this._numRenderCalls = 0;\r\n this._rootContainer._render(context, this._invalidatedRectangle);\r\n this.onEndRenderObservable.notifyObservers(this);\r\n this._invalidatedRectangle = null;\r\n };\r\n /** @hidden */\r\n AdvancedDynamicTexture.prototype._changeCursor = function (cursor) {\r\n if (this._rootElement) {\r\n this._rootElement.style.cursor = cursor;\r\n this._cursorChanged = true;\r\n }\r\n };\r\n /** @hidden */\r\n AdvancedDynamicTexture.prototype._registerLastControlDown = function (control, pointerId) {\r\n this._lastControlDown[pointerId] = control;\r\n this.onControlPickedObservable.notifyObservers(control);\r\n };\r\n AdvancedDynamicTexture.prototype._doPicking = function (x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY) {\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var engine = scene.getEngine();\r\n var textureSize = this.getSize();\r\n if (this._isFullscreen) {\r\n var camera = scene.cameraToUseForPointers || scene.activeCamera;\r\n var viewport = camera.viewport;\r\n x = x * (textureSize.width / (engine.getRenderWidth() * viewport.width));\r\n y = y * (textureSize.height / (engine.getRenderHeight() * viewport.height));\r\n }\r\n if (this._capturingControl[pointerId]) {\r\n this._capturingControl[pointerId]._processObservables(type, x, y, pi, pointerId, buttonIndex);\r\n return;\r\n }\r\n this._cursorChanged = false;\r\n if (!this._rootContainer._processPicking(x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY)) {\r\n this._changeCursor(\"\");\r\n if (type === PointerEventTypes.POINTERMOVE) {\r\n if (this._lastControlOver[pointerId]) {\r\n this._lastControlOver[pointerId]._onPointerOut(this._lastControlOver[pointerId], pi);\r\n delete this._lastControlOver[pointerId];\r\n }\r\n }\r\n }\r\n if (!this._cursorChanged) {\r\n this._changeCursor(\"\");\r\n }\r\n this._manageFocus();\r\n };\r\n /** @hidden */\r\n AdvancedDynamicTexture.prototype._cleanControlAfterRemovalFromList = function (list, control) {\r\n for (var pointerId in list) {\r\n if (!list.hasOwnProperty(pointerId)) {\r\n continue;\r\n }\r\n var lastControlOver = list[pointerId];\r\n if (lastControlOver === control) {\r\n delete list[pointerId];\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n AdvancedDynamicTexture.prototype._cleanControlAfterRemoval = function (control) {\r\n this._cleanControlAfterRemovalFromList(this._lastControlDown, control);\r\n this._cleanControlAfterRemovalFromList(this._lastControlOver, control);\r\n };\r\n /** Attach to all scene events required to support pointer events */\r\n AdvancedDynamicTexture.prototype.attach = function () {\r\n var _this = this;\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n var tempViewport = new Viewport(0, 0, 0, 0);\r\n this._pointerMoveObserver = scene.onPrePointerObservable.add(function (pi, state) {\r\n if (scene.isPointerCaptured((pi.event).pointerId)) {\r\n return;\r\n }\r\n if (pi.type !== PointerEventTypes.POINTERMOVE\r\n && pi.type !== PointerEventTypes.POINTERUP\r\n && pi.type !== PointerEventTypes.POINTERDOWN\r\n && pi.type !== PointerEventTypes.POINTERWHEEL) {\r\n return;\r\n }\r\n if (!scene) {\r\n return;\r\n }\r\n if (pi.type === PointerEventTypes.POINTERMOVE && pi.event.pointerId) {\r\n _this._defaultMousePointerId = pi.event.pointerId; // This is required to make sure we have the correct pointer ID for wheel\r\n }\r\n var camera = scene.cameraToUseForPointers || scene.activeCamera;\r\n var engine = scene.getEngine();\r\n if (!camera) {\r\n tempViewport.x = 0;\r\n tempViewport.y = 0;\r\n tempViewport.width = engine.getRenderWidth();\r\n tempViewport.height = engine.getRenderHeight();\r\n }\r\n else {\r\n camera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), tempViewport);\r\n }\r\n var x = scene.pointerX / engine.getHardwareScalingLevel() - tempViewport.x;\r\n var y = scene.pointerY / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - tempViewport.y - tempViewport.height);\r\n _this._shouldBlockPointer = false;\r\n // Do picking modifies _shouldBlockPointer\r\n var pointerId = pi.event.pointerId || _this._defaultMousePointerId;\r\n _this._doPicking(x, y, pi, pi.type, pointerId, pi.event.button, pi.event.deltaX, pi.event.deltaY);\r\n // Avoid overwriting a true skipOnPointerObservable to false\r\n if (_this._shouldBlockPointer) {\r\n pi.skipOnPointerObservable = _this._shouldBlockPointer;\r\n }\r\n });\r\n this._attachToOnPointerOut(scene);\r\n this._attachToOnBlur(scene);\r\n };\r\n /**\r\n * Register the clipboard Events onto the canvas\r\n */\r\n AdvancedDynamicTexture.prototype.registerClipboardEvents = function () {\r\n self.addEventListener(\"copy\", this.onClipboardCopy, false);\r\n self.addEventListener(\"cut\", this.onClipboardCut, false);\r\n self.addEventListener(\"paste\", this.onClipboardPaste, false);\r\n };\r\n /**\r\n * Unregister the clipboard Events from the canvas\r\n */\r\n AdvancedDynamicTexture.prototype.unRegisterClipboardEvents = function () {\r\n self.removeEventListener(\"copy\", this.onClipboardCopy);\r\n self.removeEventListener(\"cut\", this.onClipboardCut);\r\n self.removeEventListener(\"paste\", this.onClipboardPaste);\r\n };\r\n /**\r\n * Connect the texture to a hosting mesh to enable interactions\r\n * @param mesh defines the mesh to attach to\r\n * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well\r\n */\r\n AdvancedDynamicTexture.prototype.attachToMesh = function (mesh, supportPointerMove) {\r\n var _this = this;\r\n if (supportPointerMove === void 0) { supportPointerMove = true; }\r\n var scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._pointerObserver = scene.onPointerObservable.add(function (pi, state) {\r\n if (pi.type !== PointerEventTypes.POINTERMOVE\r\n && pi.type !== PointerEventTypes.POINTERUP\r\n && pi.type !== PointerEventTypes.POINTERDOWN) {\r\n return;\r\n }\r\n var pointerId = pi.event.pointerId || _this._defaultMousePointerId;\r\n if (pi.pickInfo && pi.pickInfo.hit && pi.pickInfo.pickedMesh === mesh) {\r\n var uv = pi.pickInfo.getTextureCoordinates();\r\n if (uv) {\r\n var size = _this.getSize();\r\n _this._doPicking(uv.x * size.width, (_this.applyYInversionOnUpdate ? (1.0 - uv.y) : uv.y) * size.height, pi, pi.type, pointerId, pi.event.button);\r\n }\r\n }\r\n else if (pi.type === PointerEventTypes.POINTERUP) {\r\n if (_this._lastControlDown[pointerId]) {\r\n _this._lastControlDown[pointerId]._forcePointerUp(pointerId);\r\n }\r\n delete _this._lastControlDown[pointerId];\r\n if (_this.focusedControl) {\r\n var friendlyControls = _this.focusedControl.keepsFocusWith();\r\n var canMoveFocus = true;\r\n if (friendlyControls) {\r\n for (var _i = 0, friendlyControls_1 = friendlyControls; _i < friendlyControls_1.length; _i++) {\r\n var control = friendlyControls_1[_i];\r\n // Same host, no need to keep the focus\r\n if (_this === control._host) {\r\n continue;\r\n }\r\n // Different hosts\r\n var otherHost = control._host;\r\n if (otherHost._lastControlOver[pointerId] && otherHost._lastControlOver[pointerId].isAscendant(control)) {\r\n canMoveFocus = false;\r\n break;\r\n }\r\n }\r\n }\r\n if (canMoveFocus) {\r\n _this.focusedControl = null;\r\n }\r\n }\r\n }\r\n else if (pi.type === PointerEventTypes.POINTERMOVE) {\r\n if (_this._lastControlOver[pointerId]) {\r\n _this._lastControlOver[pointerId]._onPointerOut(_this._lastControlOver[pointerId], pi, true);\r\n }\r\n delete _this._lastControlOver[pointerId];\r\n }\r\n });\r\n mesh.enablePointerMoveEvents = supportPointerMove;\r\n this._attachToOnPointerOut(scene);\r\n this._attachToOnBlur(scene);\r\n };\r\n /**\r\n * Move the focus to a specific control\r\n * @param control defines the control which will receive the focus\r\n */\r\n AdvancedDynamicTexture.prototype.moveFocusToControl = function (control) {\r\n this.focusedControl = control;\r\n this._lastPickedControl = control;\r\n this._blockNextFocusCheck = true;\r\n };\r\n AdvancedDynamicTexture.prototype._manageFocus = function () {\r\n if (this._blockNextFocusCheck) {\r\n this._blockNextFocusCheck = false;\r\n this._lastPickedControl = this._focusedControl;\r\n return;\r\n }\r\n // Focus management\r\n if (this._focusedControl) {\r\n if (this._focusedControl !== this._lastPickedControl) {\r\n if (this._lastPickedControl.isFocusInvisible) {\r\n return;\r\n }\r\n this.focusedControl = null;\r\n }\r\n }\r\n };\r\n AdvancedDynamicTexture.prototype._attachToOnPointerOut = function (scene) {\r\n var _this = this;\r\n this._canvasPointerOutObserver = scene.getEngine().onCanvasPointerOutObservable.add(function (pointerEvent) {\r\n if (_this._lastControlOver[pointerEvent.pointerId]) {\r\n _this._lastControlOver[pointerEvent.pointerId]._onPointerOut(_this._lastControlOver[pointerEvent.pointerId], null);\r\n }\r\n delete _this._lastControlOver[pointerEvent.pointerId];\r\n if (_this._lastControlDown[pointerEvent.pointerId] && _this._lastControlDown[pointerEvent.pointerId] !== _this._capturingControl[pointerEvent.pointerId]) {\r\n _this._lastControlDown[pointerEvent.pointerId]._forcePointerUp();\r\n delete _this._lastControlDown[pointerEvent.pointerId];\r\n }\r\n });\r\n };\r\n AdvancedDynamicTexture.prototype._attachToOnBlur = function (scene) {\r\n var _this = this;\r\n this._canvasBlurObserver = scene.getEngine().onCanvasBlurObservable.add(function (pointerEvent) {\r\n Object.entries(_this._lastControlDown).forEach(function (_a) {\r\n var key = _a[0], value = _a[1];\r\n value._onCanvasBlur();\r\n });\r\n _this._lastControlDown = {};\r\n });\r\n };\r\n // Statics\r\n /**\r\n * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)\r\n * @param mesh defines the mesh which will receive the texture\r\n * @param width defines the texture width (1024 by default)\r\n * @param height defines the texture height (1024 by default)\r\n * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)\r\n * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\r\n * @returns a new AdvancedDynamicTexture\r\n */\r\n AdvancedDynamicTexture.CreateForMesh = function (mesh, width, height, supportPointerMove, onlyAlphaTesting, invertY) {\r\n if (width === void 0) { width = 1024; }\r\n if (height === void 0) { height = 1024; }\r\n if (supportPointerMove === void 0) { supportPointerMove = true; }\r\n if (onlyAlphaTesting === void 0) { onlyAlphaTesting = false; }\r\n var result = new AdvancedDynamicTexture(mesh.name + \" AdvancedDynamicTexture\", width, height, mesh.getScene(), true, Texture.TRILINEAR_SAMPLINGMODE, invertY);\r\n var material = new StandardMaterial(\"AdvancedDynamicTextureMaterial\", mesh.getScene());\r\n material.backFaceCulling = false;\r\n material.diffuseColor = Color3.Black();\r\n material.specularColor = Color3.Black();\r\n if (onlyAlphaTesting) {\r\n material.diffuseTexture = result;\r\n material.emissiveTexture = result;\r\n result.hasAlpha = true;\r\n }\r\n else {\r\n material.emissiveTexture = result;\r\n material.opacityTexture = result;\r\n }\r\n mesh.material = material;\r\n result.attachToMesh(mesh, supportPointerMove);\r\n return result;\r\n };\r\n /**\r\n * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh) BUT do not create a new material for the mesh. You will be responsible for connecting the texture\r\n * @param mesh defines the mesh which will receive the texture\r\n * @param width defines the texture width (1024 by default)\r\n * @param height defines the texture height (1024 by default)\r\n * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\r\n * @returns a new AdvancedDynamicTexture\r\n */\r\n AdvancedDynamicTexture.CreateForMeshTexture = function (mesh, width, height, supportPointerMove, invertY) {\r\n if (width === void 0) { width = 1024; }\r\n if (height === void 0) { height = 1024; }\r\n if (supportPointerMove === void 0) { supportPointerMove = true; }\r\n var result = new AdvancedDynamicTexture(mesh.name + \" AdvancedDynamicTexture\", width, height, mesh.getScene(), true, Texture.TRILINEAR_SAMPLINGMODE, invertY);\r\n result.attachToMesh(mesh, supportPointerMove);\r\n return result;\r\n };\r\n /**\r\n * Creates a new AdvancedDynamicTexture in fullscreen mode.\r\n * In this mode the texture will rely on a layer for its rendering.\r\n * This allows it to be treated like any other layer.\r\n * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.\r\n * LayerMask is set through advancedTexture.layer.layerMask\r\n * @param name defines name for the texture\r\n * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)\r\n * @param scene defines the hsoting scene\r\n * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)\r\n * @returns a new AdvancedDynamicTexture\r\n */\r\n AdvancedDynamicTexture.CreateFullscreenUI = function (name, foreground, scene, sampling) {\r\n if (foreground === void 0) { foreground = true; }\r\n if (scene === void 0) { scene = null; }\r\n if (sampling === void 0) { sampling = Texture.BILINEAR_SAMPLINGMODE; }\r\n var result = new AdvancedDynamicTexture(name, 0, 0, scene, false, sampling);\r\n // Display\r\n var layer = new Layer(name + \"_layer\", null, scene, !foreground);\r\n layer.texture = result;\r\n result._layerToDispose = layer;\r\n result._isFullscreen = true;\r\n // Attach\r\n result.attach();\r\n return result;\r\n };\r\n return AdvancedDynamicTexture;\r\n}(DynamicTexture));\r\nexport { AdvancedDynamicTexture };\r\n//# sourceMappingURL=advancedDynamicTexture.js.map","import { __extends } from \"tslib\";\r\nimport { Logger } from \"@babylonjs/core/Misc/logger\";\r\nimport { Control } from \"./control\";\r\nimport { Measure } from \"../measure\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Root class for 2D containers\r\n * @see https://doc.babylonjs.com/how_to/gui#containers\r\n */\r\nvar Container = /** @class */ (function (_super) {\r\n __extends(Container, _super);\r\n /**\r\n * Creates a new Container\r\n * @param name defines the name of the container\r\n */\r\n function Container(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n /** @hidden */\r\n _this._children = new Array();\r\n /** @hidden */\r\n _this._measureForChildren = Measure.Empty();\r\n /** @hidden */\r\n _this._background = \"\";\r\n /** @hidden */\r\n _this._adaptWidthToChildren = false;\r\n /** @hidden */\r\n _this._adaptHeightToChildren = false;\r\n /**\r\n * Gets or sets a boolean indicating that layout cycle errors should be displayed on the console\r\n */\r\n _this.logLayoutCycleErrors = false;\r\n /**\r\n * Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed\r\n */\r\n _this.maxLayoutCycle = 3;\r\n return _this;\r\n }\r\n Object.defineProperty(Container.prototype, \"adaptHeightToChildren\", {\r\n /** Gets or sets a boolean indicating if the container should try to adapt to its children height */\r\n get: function () {\r\n return this._adaptHeightToChildren;\r\n },\r\n set: function (value) {\r\n if (this._adaptHeightToChildren === value) {\r\n return;\r\n }\r\n this._adaptHeightToChildren = value;\r\n if (value) {\r\n this.height = \"100%\";\r\n }\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Container.prototype, \"adaptWidthToChildren\", {\r\n /** Gets or sets a boolean indicating if the container should try to adapt to its children width */\r\n get: function () {\r\n return this._adaptWidthToChildren;\r\n },\r\n set: function (value) {\r\n if (this._adaptWidthToChildren === value) {\r\n return;\r\n }\r\n this._adaptWidthToChildren = value;\r\n if (value) {\r\n this.width = \"100%\";\r\n }\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Container.prototype, \"background\", {\r\n /** Gets or sets background color */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Container.prototype, \"children\", {\r\n /** Gets the list of children */\r\n get: function () {\r\n return this._children;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Container.prototype._getTypeName = function () {\r\n return \"Container\";\r\n };\r\n Container.prototype._flagDescendantsAsMatrixDirty = function () {\r\n for (var _i = 0, _a = this.children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._markMatrixAsDirty();\r\n }\r\n };\r\n /**\r\n * Gets a child using its name\r\n * @param name defines the child name to look for\r\n * @returns the child control if found\r\n */\r\n Container.prototype.getChildByName = function (name) {\r\n for (var _i = 0, _a = this.children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (child.name === name) {\r\n return child;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets a child using its type and its name\r\n * @param name defines the child name to look for\r\n * @param type defines the child type to look for\r\n * @returns the child control if found\r\n */\r\n Container.prototype.getChildByType = function (name, type) {\r\n for (var _i = 0, _a = this.children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (child.typeName === type) {\r\n return child;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Search for a specific control in children\r\n * @param control defines the control to look for\r\n * @returns true if the control is in child list\r\n */\r\n Container.prototype.containsControl = function (control) {\r\n return this.children.indexOf(control) !== -1;\r\n };\r\n /**\r\n * Adds a new control to the current container\r\n * @param control defines the control to add\r\n * @returns the current container\r\n */\r\n Container.prototype.addControl = function (control) {\r\n if (!control) {\r\n return this;\r\n }\r\n var index = this._children.indexOf(control);\r\n if (index !== -1) {\r\n return this;\r\n }\r\n control._link(this._host);\r\n control._markAllAsDirty();\r\n this._reOrderControl(control);\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Removes all controls from the current container\r\n * @returns the current container\r\n */\r\n Container.prototype.clearControls = function () {\r\n var children = this.children.slice();\r\n for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\r\n var child = children_1[_i];\r\n this.removeControl(child);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Removes a control from the current container\r\n * @param control defines the control to remove\r\n * @returns the current container\r\n */\r\n Container.prototype.removeControl = function (control) {\r\n var index = this._children.indexOf(control);\r\n if (index !== -1) {\r\n this._children.splice(index, 1);\r\n control.parent = null;\r\n }\r\n control.linkWithMesh(null);\r\n if (this._host) {\r\n this._host._cleanControlAfterRemoval(control);\r\n }\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /** @hidden */\r\n Container.prototype._reOrderControl = function (control) {\r\n this.removeControl(control);\r\n var wasAdded = false;\r\n for (var index = 0; index < this._children.length; index++) {\r\n if (this._children[index].zIndex > control.zIndex) {\r\n this._children.splice(index, 0, control);\r\n wasAdded = true;\r\n break;\r\n }\r\n }\r\n if (!wasAdded) {\r\n this._children.push(control);\r\n }\r\n control.parent = this;\r\n this._markAsDirty();\r\n };\r\n /** @hidden */\r\n Container.prototype._offsetLeft = function (offset) {\r\n _super.prototype._offsetLeft.call(this, offset);\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._offsetLeft(offset);\r\n }\r\n };\r\n /** @hidden */\r\n Container.prototype._offsetTop = function (offset) {\r\n _super.prototype._offsetTop.call(this, offset);\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._offsetTop(offset);\r\n }\r\n };\r\n /** @hidden */\r\n Container.prototype._markAllAsDirty = function () {\r\n _super.prototype._markAllAsDirty.call(this);\r\n for (var index = 0; index < this._children.length; index++) {\r\n this._children[index]._markAllAsDirty();\r\n }\r\n };\r\n /** @hidden */\r\n Container.prototype._localDraw = function (context) {\r\n if (this._background) {\r\n context.save();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n context.fillStyle = this._background;\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n context.restore();\r\n }\r\n };\r\n /** @hidden */\r\n Container.prototype._link = function (host) {\r\n _super.prototype._link.call(this, host);\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._link(host);\r\n }\r\n };\r\n /** @hidden */\r\n Container.prototype._beforeLayout = function () {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n Container.prototype._processMeasures = function (parentMeasure, context) {\r\n if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {\r\n _super.prototype._processMeasures.call(this, parentMeasure, context);\r\n this._evaluateClippingState(parentMeasure);\r\n }\r\n };\r\n /** @hidden */\r\n Container.prototype._layout = function (parentMeasure, context) {\r\n if (!this.isDirty && (!this.isVisible || this.notRenderable)) {\r\n return false;\r\n }\r\n this.host._numLayoutCalls++;\r\n if (this._isDirty) {\r\n this._currentMeasure.transformToRef(this._transformMatrix, this._prevCurrentMeasureTransformedIntoGlobalSpace);\r\n }\r\n var rebuildCount = 0;\r\n context.save();\r\n this._applyStates(context);\r\n this._beforeLayout();\r\n do {\r\n var computedWidth = -1;\r\n var computedHeight = -1;\r\n this._rebuildLayout = false;\r\n this._processMeasures(parentMeasure, context);\r\n if (!this._isClipped) {\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._tempParentMeasure.copyFrom(this._measureForChildren);\r\n if (child._layout(this._measureForChildren, context)) {\r\n if (this.adaptWidthToChildren && child._width.isPixel) {\r\n computedWidth = Math.max(computedWidth, child._currentMeasure.width + child.paddingLeftInPixels + child.paddingRightInPixels);\r\n }\r\n if (this.adaptHeightToChildren && child._height.isPixel) {\r\n computedHeight = Math.max(computedHeight, child._currentMeasure.height + child.paddingTopInPixels + child.paddingBottomInPixels);\r\n }\r\n }\r\n }\r\n if (this.adaptWidthToChildren && computedWidth >= 0) {\r\n computedWidth += this.paddingLeftInPixels + this.paddingRightInPixels;\r\n if (this.width !== computedWidth + \"px\") {\r\n this.width = computedWidth + \"px\";\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n if (this.adaptHeightToChildren && computedHeight >= 0) {\r\n computedHeight += this.paddingTopInPixels + this.paddingBottomInPixels;\r\n if (this.height !== computedHeight + \"px\") {\r\n this.height = computedHeight + \"px\";\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n this._postMeasure();\r\n }\r\n rebuildCount++;\r\n } while (this._rebuildLayout && rebuildCount < this.maxLayoutCycle);\r\n if (rebuildCount >= 3 && this.logLayoutCycleErrors) {\r\n Logger.Error(\"Layout cycle detected in GUI (Container name=\" + this.name + \", uniqueId=\" + this.uniqueId + \")\");\r\n }\r\n context.restore();\r\n if (this._isDirty) {\r\n this.invalidateRect();\r\n this._isDirty = false;\r\n }\r\n return true;\r\n };\r\n Container.prototype._postMeasure = function () {\r\n // Do nothing by default\r\n };\r\n /** @hidden */\r\n Container.prototype._draw = function (context, invalidatedRectangle) {\r\n this._localDraw(context);\r\n if (this.clipChildren) {\r\n this._clipForChildren(context);\r\n }\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n // Only redraw parts of the screen that are invalidated\r\n if (invalidatedRectangle) {\r\n if (!child._intersectsRect(invalidatedRectangle)) {\r\n continue;\r\n }\r\n }\r\n child._render(context, invalidatedRectangle);\r\n }\r\n };\r\n Container.prototype.getDescendantsToRef = function (results, directDescendantsOnly, predicate) {\r\n if (directDescendantsOnly === void 0) { directDescendantsOnly = false; }\r\n if (!this.children) {\r\n return;\r\n }\r\n for (var index = 0; index < this.children.length; index++) {\r\n var item = this.children[index];\r\n if (!predicate || predicate(item)) {\r\n results.push(item);\r\n }\r\n if (!directDescendantsOnly) {\r\n item.getDescendantsToRef(results, false, predicate);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Container.prototype._processPicking = function (x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY) {\r\n if (!this._isEnabled || !this.isVisible || this.notRenderable) {\r\n return false;\r\n }\r\n if (!_super.prototype.contains.call(this, x, y)) {\r\n return false;\r\n }\r\n // Checking backwards to pick closest first\r\n for (var index = this._children.length - 1; index >= 0; index--) {\r\n var child = this._children[index];\r\n if (child._processPicking(x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY)) {\r\n if (child.hoverCursor) {\r\n this._host._changeCursor(child.hoverCursor);\r\n }\r\n return true;\r\n }\r\n }\r\n if (!this.isHitTestVisible) {\r\n return false;\r\n }\r\n return this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);\r\n };\r\n /** @hidden */\r\n Container.prototype._additionalProcessing = function (parentMeasure, context) {\r\n _super.prototype._additionalProcessing.call(this, parentMeasure, context);\r\n this._measureForChildren.copyFrom(this._currentMeasure);\r\n };\r\n /** Releases associated resources */\r\n Container.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n for (var index = this.children.length - 1; index >= 0; index--) {\r\n this.children[index].dispose();\r\n }\r\n };\r\n return Container;\r\n}(Control));\r\nexport { Container };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Container\"] = Container;\r\n//# sourceMappingURL=container.js.map","import { __extends } from \"tslib\";\r\nimport { Vector2 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Epsilon } from '@babylonjs/core/Maths/math.constants';\r\n/**\r\n * Class used to transport Vector2 information for pointer events\r\n */\r\nvar Vector2WithInfo = /** @class */ (function (_super) {\r\n __extends(Vector2WithInfo, _super);\r\n /**\r\n * Creates a new Vector2WithInfo\r\n * @param source defines the vector2 data to transport\r\n * @param buttonIndex defines the current mouse button index\r\n */\r\n function Vector2WithInfo(source, \r\n /** defines the current mouse button index */\r\n buttonIndex) {\r\n if (buttonIndex === void 0) { buttonIndex = 0; }\r\n var _this = _super.call(this, source.x, source.y) || this;\r\n _this.buttonIndex = buttonIndex;\r\n return _this;\r\n }\r\n return Vector2WithInfo;\r\n}(Vector2));\r\nexport { Vector2WithInfo };\r\n/** Class used to provide 2D matrix features */\r\nvar Matrix2D = /** @class */ (function () {\r\n /**\r\n * Creates a new matrix\r\n * @param m00 defines value for (0, 0)\r\n * @param m01 defines value for (0, 1)\r\n * @param m10 defines value for (1, 0)\r\n * @param m11 defines value for (1, 1)\r\n * @param m20 defines value for (2, 0)\r\n * @param m21 defines value for (2, 1)\r\n */\r\n function Matrix2D(m00, m01, m10, m11, m20, m21) {\r\n /** Gets the internal array of 6 floats used to store matrix data */\r\n this.m = new Float32Array(6);\r\n this.fromValues(m00, m01, m10, m11, m20, m21);\r\n }\r\n /**\r\n * Fills the matrix from direct values\r\n * @param m00 defines value for (0, 0)\r\n * @param m01 defines value for (0, 1)\r\n * @param m10 defines value for (1, 0)\r\n * @param m11 defines value for (1, 1)\r\n * @param m20 defines value for (2, 0)\r\n * @param m21 defines value for (2, 1)\r\n * @returns the current modified matrix\r\n */\r\n Matrix2D.prototype.fromValues = function (m00, m01, m10, m11, m20, m21) {\r\n this.m[0] = m00;\r\n this.m[1] = m01;\r\n this.m[2] = m10;\r\n this.m[3] = m11;\r\n this.m[4] = m20;\r\n this.m[5] = m21;\r\n return this;\r\n };\r\n /**\r\n * Gets matrix determinant\r\n * @returns the determinant\r\n */\r\n Matrix2D.prototype.determinant = function () {\r\n return this.m[0] * this.m[3] - this.m[1] * this.m[2];\r\n };\r\n /**\r\n * Inverses the matrix and stores it in a target matrix\r\n * @param result defines the target matrix\r\n * @returns the current matrix\r\n */\r\n Matrix2D.prototype.invertToRef = function (result) {\r\n var l0 = this.m[0];\r\n var l1 = this.m[1];\r\n var l2 = this.m[2];\r\n var l3 = this.m[3];\r\n var l4 = this.m[4];\r\n var l5 = this.m[5];\r\n var det = this.determinant();\r\n if (det < (Epsilon * Epsilon)) {\r\n result.m[0] = 0;\r\n result.m[1] = 0;\r\n result.m[2] = 0;\r\n result.m[3] = 0;\r\n result.m[4] = 0;\r\n result.m[5] = 0;\r\n return this;\r\n }\r\n var detDiv = 1 / det;\r\n var det4 = l2 * l5 - l3 * l4;\r\n var det5 = l1 * l4 - l0 * l5;\r\n result.m[0] = l3 * detDiv;\r\n result.m[1] = -l1 * detDiv;\r\n result.m[2] = -l2 * detDiv;\r\n result.m[3] = l0 * detDiv;\r\n result.m[4] = det4 * detDiv;\r\n result.m[5] = det5 * detDiv;\r\n return this;\r\n };\r\n /**\r\n * Multiplies the current matrix with another one\r\n * @param other defines the second operand\r\n * @param result defines the target matrix\r\n * @returns the current matrix\r\n */\r\n Matrix2D.prototype.multiplyToRef = function (other, result) {\r\n var l0 = this.m[0];\r\n var l1 = this.m[1];\r\n var l2 = this.m[2];\r\n var l3 = this.m[3];\r\n var l4 = this.m[4];\r\n var l5 = this.m[5];\r\n var r0 = other.m[0];\r\n var r1 = other.m[1];\r\n var r2 = other.m[2];\r\n var r3 = other.m[3];\r\n var r4 = other.m[4];\r\n var r5 = other.m[5];\r\n result.m[0] = l0 * r0 + l1 * r2;\r\n result.m[1] = l0 * r1 + l1 * r3;\r\n result.m[2] = l2 * r0 + l3 * r2;\r\n result.m[3] = l2 * r1 + l3 * r3;\r\n result.m[4] = l4 * r0 + l5 * r2 + r4;\r\n result.m[5] = l4 * r1 + l5 * r3 + r5;\r\n return this;\r\n };\r\n /**\r\n * Applies the current matrix to a set of 2 floats and stores the result in a vector2\r\n * @param x defines the x coordinate to transform\r\n * @param y defines the x coordinate to transform\r\n * @param result defines the target vector2\r\n * @returns the current matrix\r\n */\r\n Matrix2D.prototype.transformCoordinates = function (x, y, result) {\r\n result.x = x * this.m[0] + y * this.m[2] + this.m[4];\r\n result.y = x * this.m[1] + y * this.m[3] + this.m[5];\r\n return this;\r\n };\r\n // Statics\r\n /**\r\n * Creates an identity matrix\r\n * @returns a new matrix\r\n */\r\n Matrix2D.Identity = function () {\r\n return new Matrix2D(1, 0, 0, 1, 0, 0);\r\n };\r\n /**\r\n * Creates a translation matrix and stores it in a target matrix\r\n * @param x defines the x coordinate of the translation\r\n * @param y defines the y coordinate of the translation\r\n * @param result defines the target matrix\r\n */\r\n Matrix2D.TranslationToRef = function (x, y, result) {\r\n result.fromValues(1, 0, 0, 1, x, y);\r\n };\r\n /**\r\n * Creates a scaling matrix and stores it in a target matrix\r\n * @param x defines the x coordinate of the scaling\r\n * @param y defines the y coordinate of the scaling\r\n * @param result defines the target matrix\r\n */\r\n Matrix2D.ScalingToRef = function (x, y, result) {\r\n result.fromValues(x, 0, 0, y, 0, 0);\r\n };\r\n /**\r\n * Creates a rotation matrix and stores it in a target matrix\r\n * @param angle defines the rotation angle\r\n * @param result defines the target matrix\r\n */\r\n Matrix2D.RotationToRef = function (angle, result) {\r\n var s = Math.sin(angle);\r\n var c = Math.cos(angle);\r\n result.fromValues(c, s, -s, c, 0, 0);\r\n };\r\n /**\r\n * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix\r\n * @param tx defines the x coordinate of the translation\r\n * @param ty defines the y coordinate of the translation\r\n * @param angle defines the rotation angle\r\n * @param scaleX defines the x coordinate of the scaling\r\n * @param scaleY defines the y coordinate of the scaling\r\n * @param parentMatrix defines the parent matrix to multiply by (can be null)\r\n * @param result defines the target matrix\r\n */\r\n Matrix2D.ComposeToRef = function (tx, ty, angle, scaleX, scaleY, parentMatrix, result) {\r\n Matrix2D.TranslationToRef(tx, ty, Matrix2D._TempPreTranslationMatrix);\r\n Matrix2D.ScalingToRef(scaleX, scaleY, Matrix2D._TempScalingMatrix);\r\n Matrix2D.RotationToRef(angle, Matrix2D._TempRotationMatrix);\r\n Matrix2D.TranslationToRef(-tx, -ty, Matrix2D._TempPostTranslationMatrix);\r\n Matrix2D._TempPreTranslationMatrix.multiplyToRef(Matrix2D._TempScalingMatrix, Matrix2D._TempCompose0);\r\n Matrix2D._TempCompose0.multiplyToRef(Matrix2D._TempRotationMatrix, Matrix2D._TempCompose1);\r\n if (parentMatrix) {\r\n Matrix2D._TempCompose1.multiplyToRef(Matrix2D._TempPostTranslationMatrix, Matrix2D._TempCompose2);\r\n Matrix2D._TempCompose2.multiplyToRef(parentMatrix, result);\r\n }\r\n else {\r\n Matrix2D._TempCompose1.multiplyToRef(Matrix2D._TempPostTranslationMatrix, result);\r\n }\r\n };\r\n Matrix2D._TempPreTranslationMatrix = Matrix2D.Identity();\r\n Matrix2D._TempPostTranslationMatrix = Matrix2D.Identity();\r\n Matrix2D._TempRotationMatrix = Matrix2D.Identity();\r\n Matrix2D._TempScalingMatrix = Matrix2D.Identity();\r\n Matrix2D._TempCompose0 = Matrix2D.Identity();\r\n Matrix2D._TempCompose1 = Matrix2D.Identity();\r\n Matrix2D._TempCompose2 = Matrix2D.Identity();\r\n return Matrix2D;\r\n}());\r\nexport { Matrix2D };\r\n//# sourceMappingURL=math2D.js.map","import { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Vector2, Vector3, Matrix } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { PointerEventTypes } from '@babylonjs/core/Events/pointerEvents';\r\nimport { Logger } from \"@babylonjs/core/Misc/logger\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { Measure } from \"../measure\";\r\nimport { Matrix2D, Vector2WithInfo } from \"../math2D\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Root class used for all 2D controls\r\n * @see https://doc.babylonjs.com/how_to/gui#controls\r\n */\r\nvar Control = /** @class */ (function () {\r\n // Functions\r\n /**\r\n * Creates a new control\r\n * @param name defines the name of the control\r\n */\r\n function Control(\r\n /** defines the name of the control */\r\n name) {\r\n this.name = name;\r\n this._alpha = 1;\r\n this._alphaSet = false;\r\n this._zIndex = 0;\r\n /** @hidden */\r\n this._currentMeasure = Measure.Empty();\r\n this._fontFamily = \"Arial\";\r\n this._fontStyle = \"\";\r\n this._fontWeight = \"\";\r\n this._fontSize = new ValueAndUnit(18, ValueAndUnit.UNITMODE_PIXEL, false);\r\n /** @hidden */\r\n this._width = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);\r\n /** @hidden */\r\n this._height = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);\r\n this._color = \"\";\r\n this._style = null;\r\n /** @hidden */\r\n this._horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n /** @hidden */\r\n this._verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n /** @hidden */\r\n this._isDirty = true;\r\n /** @hidden */\r\n this._wasDirty = false;\r\n /** @hidden */\r\n this._tempParentMeasure = Measure.Empty();\r\n /** @hidden */\r\n this._prevCurrentMeasureTransformedIntoGlobalSpace = Measure.Empty();\r\n /** @hidden */\r\n this._cachedParentMeasure = Measure.Empty();\r\n this._paddingLeft = new ValueAndUnit(0);\r\n this._paddingRight = new ValueAndUnit(0);\r\n this._paddingTop = new ValueAndUnit(0);\r\n this._paddingBottom = new ValueAndUnit(0);\r\n /** @hidden */\r\n this._left = new ValueAndUnit(0);\r\n /** @hidden */\r\n this._top = new ValueAndUnit(0);\r\n this._scaleX = 1.0;\r\n this._scaleY = 1.0;\r\n this._rotation = 0;\r\n this._transformCenterX = 0.5;\r\n this._transformCenterY = 0.5;\r\n /** @hidden */\r\n this._transformMatrix = Matrix2D.Identity();\r\n /** @hidden */\r\n this._invertTransformMatrix = Matrix2D.Identity();\r\n /** @hidden */\r\n this._transformedPosition = Vector2.Zero();\r\n this._isMatrixDirty = true;\r\n this._isVisible = true;\r\n this._isHighlighted = false;\r\n this._fontSet = false;\r\n this._dummyVector2 = Vector2.Zero();\r\n this._downCount = 0;\r\n this._enterCount = -1;\r\n this._doNotRender = false;\r\n this._downPointerIds = {};\r\n this._isEnabled = true;\r\n this._disabledColor = \"#9a9a9a\";\r\n this._disabledColorItem = \"#6a6a6a\";\r\n /** @hidden */\r\n this._rebuildLayout = false;\r\n /** @hidden */\r\n this._customData = {};\r\n /** @hidden */\r\n this._isClipped = false;\r\n /** @hidden */\r\n this._automaticSize = false;\r\n /**\r\n * Gets or sets an object used to store user defined information for the node\r\n */\r\n this.metadata = null;\r\n /** Gets or sets a boolean indicating if the control can be hit with pointer events */\r\n this.isHitTestVisible = true;\r\n /** Gets or sets a boolean indicating if the control can block pointer events */\r\n this.isPointerBlocker = false;\r\n /** Gets or sets a boolean indicating if the control can be focusable */\r\n this.isFocusInvisible = false;\r\n /**\r\n * Gets or sets a boolean indicating if the children are clipped to the current control bounds.\r\n * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children\r\n */\r\n this.clipChildren = true;\r\n /**\r\n * Gets or sets a boolean indicating that control content must be clipped\r\n * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children\r\n */\r\n this.clipContent = true;\r\n /**\r\n * Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)\r\n */\r\n this.useBitmapCache = false;\r\n this._shadowOffsetX = 0;\r\n this._shadowOffsetY = 0;\r\n this._shadowBlur = 0;\r\n this._shadowColor = 'black';\r\n /** Gets or sets the cursor to use when the control is hovered */\r\n this.hoverCursor = \"\";\r\n /** @hidden */\r\n this._linkOffsetX = new ValueAndUnit(0);\r\n /** @hidden */\r\n this._linkOffsetY = new ValueAndUnit(0);\r\n /**\r\n * An event triggered when pointer wheel is scrolled\r\n */\r\n this.onWheelObservable = new Observable();\r\n /**\r\n * An event triggered when the pointer move over the control.\r\n */\r\n this.onPointerMoveObservable = new Observable();\r\n /**\r\n * An event triggered when the pointer move out of the control.\r\n */\r\n this.onPointerOutObservable = new Observable();\r\n /**\r\n * An event triggered when the pointer taps the control\r\n */\r\n this.onPointerDownObservable = new Observable();\r\n /**\r\n * An event triggered when pointer up\r\n */\r\n this.onPointerUpObservable = new Observable();\r\n /**\r\n * An event triggered when a control is clicked on\r\n */\r\n this.onPointerClickObservable = new Observable();\r\n /**\r\n * An event triggered when pointer enters the control\r\n */\r\n this.onPointerEnterObservable = new Observable();\r\n /**\r\n * An event triggered when the control is marked as dirty\r\n */\r\n this.onDirtyObservable = new Observable();\r\n /**\r\n * An event triggered before drawing the control\r\n */\r\n this.onBeforeDrawObservable = new Observable();\r\n /**\r\n * An event triggered after the control was drawn\r\n */\r\n this.onAfterDrawObservable = new Observable();\r\n /**\r\n * An event triggered when the control has been disposed\r\n */\r\n this.onDisposeObservable = new Observable();\r\n /**\r\n * Gets or sets a fixed ratio for this control.\r\n * When different from 0, the ratio is used to compute the \"second\" dimension.\r\n * The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the\r\n * second dimension is computed as first dimension * fixedRatio\r\n */\r\n this.fixedRatio = 0;\r\n this._fixedRatioMasterIsWidth = true;\r\n this._tmpMeasureA = new Measure(0, 0, 0, 0);\r\n }\r\n Object.defineProperty(Control.prototype, \"shadowOffsetX\", {\r\n /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */\r\n get: function () {\r\n return this._shadowOffsetX;\r\n },\r\n set: function (value) {\r\n if (this._shadowOffsetX === value) {\r\n return;\r\n }\r\n this._shadowOffsetX = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"shadowOffsetY\", {\r\n /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */\r\n get: function () {\r\n return this._shadowOffsetY;\r\n },\r\n set: function (value) {\r\n if (this._shadowOffsetY === value) {\r\n return;\r\n }\r\n this._shadowOffsetY = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"shadowBlur\", {\r\n /** Gets or sets a value indicating the amount of blur to use to render the shadow */\r\n get: function () {\r\n return this._shadowBlur;\r\n },\r\n set: function (value) {\r\n if (this._shadowBlur === value) {\r\n return;\r\n }\r\n this._shadowBlur = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"shadowColor\", {\r\n /** Gets or sets a value indicating the color of the shadow (black by default ie. \"#000\") */\r\n get: function () {\r\n return this._shadowColor;\r\n },\r\n set: function (value) {\r\n if (this._shadowColor === value) {\r\n return;\r\n }\r\n this._shadowColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"typeName\", {\r\n // Properties\r\n /** Gets the control type name */\r\n get: function () {\r\n return this._getTypeName();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Get the current class name of the control.\r\n * @returns current class name\r\n */\r\n Control.prototype.getClassName = function () {\r\n return this._getTypeName();\r\n };\r\n Object.defineProperty(Control.prototype, \"host\", {\r\n /**\r\n * Get the hosting AdvancedDynamicTexture\r\n */\r\n get: function () {\r\n return this._host;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"fontOffset\", {\r\n /** Gets or set information about font offsets (used to render and align text) */\r\n get: function () {\r\n return this._fontOffset;\r\n },\r\n set: function (offset) {\r\n this._fontOffset = offset;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"alpha\", {\r\n /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */\r\n get: function () {\r\n return this._alpha;\r\n },\r\n set: function (value) {\r\n if (this._alpha === value) {\r\n return;\r\n }\r\n this._alphaSet = true;\r\n this._alpha = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"isHighlighted\", {\r\n /**\r\n * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)\r\n */\r\n get: function () {\r\n return this._isHighlighted;\r\n },\r\n set: function (value) {\r\n if (this._isHighlighted === value) {\r\n return;\r\n }\r\n this._isHighlighted = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"scaleX\", {\r\n /** Gets or sets a value indicating the scale factor on X axis (1 by default)\r\n * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling\r\n */\r\n get: function () {\r\n return this._scaleX;\r\n },\r\n set: function (value) {\r\n if (this._scaleX === value) {\r\n return;\r\n }\r\n this._scaleX = value;\r\n this._markAsDirty();\r\n this._markMatrixAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"scaleY\", {\r\n /** Gets or sets a value indicating the scale factor on Y axis (1 by default)\r\n * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling\r\n */\r\n get: function () {\r\n return this._scaleY;\r\n },\r\n set: function (value) {\r\n if (this._scaleY === value) {\r\n return;\r\n }\r\n this._scaleY = value;\r\n this._markAsDirty();\r\n this._markMatrixAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"rotation\", {\r\n /** Gets or sets the rotation angle (0 by default)\r\n * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling\r\n */\r\n get: function () {\r\n return this._rotation;\r\n },\r\n set: function (value) {\r\n if (this._rotation === value) {\r\n return;\r\n }\r\n this._rotation = value;\r\n this._markAsDirty();\r\n this._markMatrixAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"transformCenterY\", {\r\n /** Gets or sets the transformation center on Y axis (0 by default)\r\n * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling\r\n */\r\n get: function () {\r\n return this._transformCenterY;\r\n },\r\n set: function (value) {\r\n if (this._transformCenterY === value) {\r\n return;\r\n }\r\n this._transformCenterY = value;\r\n this._markAsDirty();\r\n this._markMatrixAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"transformCenterX\", {\r\n /** Gets or sets the transformation center on X axis (0 by default)\r\n * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling\r\n */\r\n get: function () {\r\n return this._transformCenterX;\r\n },\r\n set: function (value) {\r\n if (this._transformCenterX === value) {\r\n return;\r\n }\r\n this._transformCenterX = value;\r\n this._markAsDirty();\r\n this._markMatrixAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"horizontalAlignment\", {\r\n /**\r\n * Gets or sets the horizontal alignment\r\n * @see https://doc.babylonjs.com/how_to/gui#alignments\r\n */\r\n get: function () {\r\n return this._horizontalAlignment;\r\n },\r\n set: function (value) {\r\n if (this._horizontalAlignment === value) {\r\n return;\r\n }\r\n this._horizontalAlignment = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"verticalAlignment\", {\r\n /**\r\n * Gets or sets the vertical alignment\r\n * @see https://doc.babylonjs.com/how_to/gui#alignments\r\n */\r\n get: function () {\r\n return this._verticalAlignment;\r\n },\r\n set: function (value) {\r\n if (this._verticalAlignment === value) {\r\n return;\r\n }\r\n this._verticalAlignment = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"width\", {\r\n /**\r\n * Gets or sets control width\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._width.toString(this._host);\r\n },\r\n set: function (value) {\r\n this._fixedRatioMasterIsWidth = true;\r\n if (this._width.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._width.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"widthInPixels\", {\r\n /**\r\n * Gets or sets the control width in pixel\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._width.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this._fixedRatioMasterIsWidth = true;\r\n this.width = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"height\", {\r\n /**\r\n * Gets or sets control height\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._height.toString(this._host);\r\n },\r\n set: function (value) {\r\n this._fixedRatioMasterIsWidth = false;\r\n if (this._height.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._height.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"heightInPixels\", {\r\n /**\r\n * Gets or sets control height in pixel\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this._fixedRatioMasterIsWidth = false;\r\n this.height = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"fontFamily\", {\r\n /** Gets or set font family */\r\n get: function () {\r\n if (!this._fontSet) {\r\n return \"\";\r\n }\r\n return this._fontFamily;\r\n },\r\n set: function (value) {\r\n if (this._fontFamily === value) {\r\n return;\r\n }\r\n this._fontFamily = value;\r\n this._resetFontCache();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"fontStyle\", {\r\n /** Gets or sets font style */\r\n get: function () {\r\n return this._fontStyle;\r\n },\r\n set: function (value) {\r\n if (this._fontStyle === value) {\r\n return;\r\n }\r\n this._fontStyle = value;\r\n this._resetFontCache();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"fontWeight\", {\r\n /** Gets or sets font weight */\r\n get: function () {\r\n return this._fontWeight;\r\n },\r\n set: function (value) {\r\n if (this._fontWeight === value) {\r\n return;\r\n }\r\n this._fontWeight = value;\r\n this._resetFontCache();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"style\", {\r\n /**\r\n * Gets or sets style\r\n * @see https://doc.babylonjs.com/how_to/gui#styles\r\n */\r\n get: function () {\r\n return this._style;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._style) {\r\n this._style.onChangedObservable.remove(this._styleObserver);\r\n this._styleObserver = null;\r\n }\r\n this._style = value;\r\n if (this._style) {\r\n this._styleObserver = this._style.onChangedObservable.add(function () {\r\n _this._markAsDirty();\r\n _this._resetFontCache();\r\n });\r\n }\r\n this._markAsDirty();\r\n this._resetFontCache();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"_isFontSizeInPercentage\", {\r\n /** @hidden */\r\n get: function () {\r\n return this._fontSize.isPercentage;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"fontSizeInPixels\", {\r\n /** Gets or sets font size in pixels */\r\n get: function () {\r\n var fontSizeToUse = this._style ? this._style._fontSize : this._fontSize;\r\n if (fontSizeToUse.isPixel) {\r\n return fontSizeToUse.getValue(this._host);\r\n }\r\n return fontSizeToUse.getValueInPixel(this._host, this._tempParentMeasure.height || this._cachedParentMeasure.height);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.fontSize = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"fontSize\", {\r\n /** Gets or sets font size */\r\n get: function () {\r\n return this._fontSize.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._fontSize.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._fontSize.fromString(value)) {\r\n this._markAsDirty();\r\n this._resetFontCache();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"color\", {\r\n /** Gets or sets foreground color */\r\n get: function () {\r\n return this._color;\r\n },\r\n set: function (value) {\r\n if (this._color === value) {\r\n return;\r\n }\r\n this._color = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"zIndex\", {\r\n /** Gets or sets z index which is used to reorder controls on the z axis */\r\n get: function () {\r\n return this._zIndex;\r\n },\r\n set: function (value) {\r\n if (this.zIndex === value) {\r\n return;\r\n }\r\n this._zIndex = value;\r\n if (this.parent) {\r\n this.parent._reOrderControl(this);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"notRenderable\", {\r\n /** Gets or sets a boolean indicating if the control can be rendered */\r\n get: function () {\r\n return this._doNotRender;\r\n },\r\n set: function (value) {\r\n if (this._doNotRender === value) {\r\n return;\r\n }\r\n this._doNotRender = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"isVisible\", {\r\n /** Gets or sets a boolean indicating if the control is visible */\r\n get: function () {\r\n return this._isVisible;\r\n },\r\n set: function (value) {\r\n if (this._isVisible === value) {\r\n return;\r\n }\r\n this._isVisible = value;\r\n this._markAsDirty(true);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"isDirty\", {\r\n /** Gets a boolean indicating that the control needs to update its rendering */\r\n get: function () {\r\n return this._isDirty;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"linkedMesh\", {\r\n /**\r\n * Gets the current linked mesh (or null if none)\r\n */\r\n get: function () {\r\n return this._linkedMesh;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingLeft\", {\r\n /**\r\n * Gets or sets a value indicating the padding to use on the left of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingLeft.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._paddingLeft.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingLeftInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the padding in pixels to use on the left of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingLeft.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.paddingLeft = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingRight\", {\r\n /**\r\n * Gets or sets a value indicating the padding to use on the right of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingRight.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._paddingRight.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingRightInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the padding in pixels to use on the right of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingRight.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.paddingRight = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingTop\", {\r\n /**\r\n * Gets or sets a value indicating the padding to use on the top of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingTop.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._paddingTop.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingTopInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the padding in pixels to use on the top of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingTop.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.paddingTop = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingBottom\", {\r\n /**\r\n * Gets or sets a value indicating the padding to use on the bottom of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingBottom.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._paddingBottom.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"paddingBottomInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the padding in pixels to use on the bottom of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._paddingBottom.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.paddingBottom = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"left\", {\r\n /**\r\n * Gets or sets a value indicating the left coordinate of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._left.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._left.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"leftInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the left coordinate in pixels of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._left.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.left = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"top\", {\r\n /**\r\n * Gets or sets a value indicating the top coordinate of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._top.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._top.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"topInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the top coordinate in pixels of the control\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._top.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.top = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"linkOffsetX\", {\r\n /**\r\n * Gets or sets a value indicating the offset on X axis to the linked mesh\r\n * @see https://doc.babylonjs.com/how_to/gui#tracking-positions\r\n */\r\n get: function () {\r\n return this._linkOffsetX.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._linkOffsetX.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"linkOffsetXInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the offset in pixels on X axis to the linked mesh\r\n * @see https://doc.babylonjs.com/how_to/gui#tracking-positions\r\n */\r\n get: function () {\r\n return this._linkOffsetX.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.linkOffsetX = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"linkOffsetY\", {\r\n /**\r\n * Gets or sets a value indicating the offset on Y axis to the linked mesh\r\n * @see https://doc.babylonjs.com/how_to/gui#tracking-positions\r\n */\r\n get: function () {\r\n return this._linkOffsetY.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._linkOffsetY.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"linkOffsetYInPixels\", {\r\n /**\r\n * Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh\r\n * @see https://doc.babylonjs.com/how_to/gui#tracking-positions\r\n */\r\n get: function () {\r\n return this._linkOffsetY.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n },\r\n set: function (value) {\r\n if (isNaN(value)) {\r\n return;\r\n }\r\n this.linkOffsetY = value + \"px\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"centerX\", {\r\n /** Gets the center coordinate on X axis */\r\n get: function () {\r\n return this._currentMeasure.left + this._currentMeasure.width / 2;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"centerY\", {\r\n /** Gets the center coordinate on Y axis */\r\n get: function () {\r\n return this._currentMeasure.top + this._currentMeasure.height / 2;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"isEnabled\", {\r\n /** Gets or sets if control is Enabled*/\r\n get: function () {\r\n return this._isEnabled;\r\n },\r\n set: function (value) {\r\n if (this._isEnabled === value) {\r\n return;\r\n }\r\n this._isEnabled = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"disabledColor\", {\r\n /** Gets or sets background color of control if it's disabled*/\r\n get: function () {\r\n return this._disabledColor;\r\n },\r\n set: function (value) {\r\n if (this._disabledColor === value) {\r\n return;\r\n }\r\n this._disabledColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control.prototype, \"disabledColorItem\", {\r\n /** Gets or sets front color of control if it's disabled*/\r\n get: function () {\r\n return this._disabledColorItem;\r\n },\r\n set: function (value) {\r\n if (this._disabledColorItem === value) {\r\n return;\r\n }\r\n this._disabledColorItem = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Control.prototype._getTypeName = function () {\r\n return \"Control\";\r\n };\r\n /**\r\n * Gets the first ascendant in the hierarchy of the given type\r\n * @param className defines the required type\r\n * @returns the ascendant or null if not found\r\n */\r\n Control.prototype.getAscendantOfClass = function (className) {\r\n if (!this.parent) {\r\n return null;\r\n }\r\n if (this.parent.getClassName() === className) {\r\n return this.parent;\r\n }\r\n return this.parent.getAscendantOfClass(className);\r\n };\r\n /** @hidden */\r\n Control.prototype._resetFontCache = function () {\r\n this._fontSet = true;\r\n this._markAsDirty();\r\n };\r\n /**\r\n * Determines if a container is an ascendant of the current control\r\n * @param container defines the container to look for\r\n * @returns true if the container is one of the ascendant of the control\r\n */\r\n Control.prototype.isAscendant = function (container) {\r\n if (!this.parent) {\r\n return false;\r\n }\r\n if (this.parent === container) {\r\n return true;\r\n }\r\n return this.parent.isAscendant(container);\r\n };\r\n /**\r\n * Gets coordinates in local control space\r\n * @param globalCoordinates defines the coordinates to transform\r\n * @returns the new coordinates in local space\r\n */\r\n Control.prototype.getLocalCoordinates = function (globalCoordinates) {\r\n var result = Vector2.Zero();\r\n this.getLocalCoordinatesToRef(globalCoordinates, result);\r\n return result;\r\n };\r\n /**\r\n * Gets coordinates in local control space\r\n * @param globalCoordinates defines the coordinates to transform\r\n * @param result defines the target vector2 where to store the result\r\n * @returns the current control\r\n */\r\n Control.prototype.getLocalCoordinatesToRef = function (globalCoordinates, result) {\r\n result.x = globalCoordinates.x - this._currentMeasure.left;\r\n result.y = globalCoordinates.y - this._currentMeasure.top;\r\n return this;\r\n };\r\n /**\r\n * Gets coordinates in parent local control space\r\n * @param globalCoordinates defines the coordinates to transform\r\n * @returns the new coordinates in parent local space\r\n */\r\n Control.prototype.getParentLocalCoordinates = function (globalCoordinates) {\r\n var result = Vector2.Zero();\r\n result.x = globalCoordinates.x - this._cachedParentMeasure.left;\r\n result.y = globalCoordinates.y - this._cachedParentMeasure.top;\r\n return result;\r\n };\r\n /**\r\n * Move the current control to a vector3 position projected onto the screen.\r\n * @param position defines the target position\r\n * @param scene defines the hosting scene\r\n */\r\n Control.prototype.moveToVector3 = function (position, scene) {\r\n if (!this._host || this.parent !== this._host._rootContainer) {\r\n Tools.Error(\"Cannot move a control to a vector3 if the control is not at root level\");\r\n return;\r\n }\r\n this.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n var globalViewport = this._host._getGlobalViewport(scene);\r\n var projectedPosition = Vector3.Project(position, Matrix.Identity(), scene.getTransformMatrix(), globalViewport);\r\n this._moveToProjectedPosition(projectedPosition);\r\n if (projectedPosition.z < 0 || projectedPosition.z > 1) {\r\n this.notRenderable = true;\r\n return;\r\n }\r\n this.notRenderable = false;\r\n };\r\n /**\r\n * Will store all controls that have this control as ascendant in a given array\r\n * @param results defines the array where to store the descendants\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n */\r\n Control.prototype.getDescendantsToRef = function (results, directDescendantsOnly, predicate) {\r\n if (directDescendantsOnly === void 0) { directDescendantsOnly = false; }\r\n // Do nothing by default\r\n };\r\n /**\r\n * Will return all controls that have this control as ascendant\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @return all child controls\r\n */\r\n Control.prototype.getDescendants = function (directDescendantsOnly, predicate) {\r\n var results = new Array();\r\n this.getDescendantsToRef(results, directDescendantsOnly, predicate);\r\n return results;\r\n };\r\n /**\r\n * Link current control with a target mesh\r\n * @param mesh defines the mesh to link with\r\n * @see https://doc.babylonjs.com/how_to/gui#tracking-positions\r\n */\r\n Control.prototype.linkWithMesh = function (mesh) {\r\n if (!this._host || this.parent && this.parent !== this._host._rootContainer) {\r\n if (mesh) {\r\n Tools.Error(\"Cannot link a control to a mesh if the control is not at root level\");\r\n }\r\n return;\r\n }\r\n var index = this._host._linkedControls.indexOf(this);\r\n if (index !== -1) {\r\n this._linkedMesh = mesh;\r\n if (!mesh) {\r\n this._host._linkedControls.splice(index, 1);\r\n }\r\n return;\r\n }\r\n else if (!mesh) {\r\n return;\r\n }\r\n this.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n this._linkedMesh = mesh;\r\n this._host._linkedControls.push(this);\r\n };\r\n /** @hidden */\r\n Control.prototype._moveToProjectedPosition = function (projectedPosition) {\r\n var oldLeft = this._left.getValue(this._host);\r\n var oldTop = this._top.getValue(this._host);\r\n var newLeft = ((projectedPosition.x + this._linkOffsetX.getValue(this._host)) - this._currentMeasure.width / 2);\r\n var newTop = ((projectedPosition.y + this._linkOffsetY.getValue(this._host)) - this._currentMeasure.height / 2);\r\n if (this._left.ignoreAdaptiveScaling && this._top.ignoreAdaptiveScaling) {\r\n if (Math.abs(newLeft - oldLeft) < 0.5) {\r\n newLeft = oldLeft;\r\n }\r\n if (Math.abs(newTop - oldTop) < 0.5) {\r\n newTop = oldTop;\r\n }\r\n }\r\n this.left = newLeft + \"px\";\r\n this.top = newTop + \"px\";\r\n this._left.ignoreAdaptiveScaling = true;\r\n this._top.ignoreAdaptiveScaling = true;\r\n this._markAsDirty();\r\n };\r\n /** @hidden */\r\n Control.prototype._offsetLeft = function (offset) {\r\n this._isDirty = true;\r\n this._currentMeasure.left += offset;\r\n };\r\n /** @hidden */\r\n Control.prototype._offsetTop = function (offset) {\r\n this._isDirty = true;\r\n this._currentMeasure.top += offset;\r\n };\r\n /** @hidden */\r\n Control.prototype._markMatrixAsDirty = function () {\r\n this._isMatrixDirty = true;\r\n this._flagDescendantsAsMatrixDirty();\r\n };\r\n /** @hidden */\r\n Control.prototype._flagDescendantsAsMatrixDirty = function () {\r\n // No child\r\n };\r\n /** @hidden */\r\n Control.prototype._intersectsRect = function (rect) {\r\n // Rotate the control's current measure into local space and check if it intersects the passed in rectangle\r\n this._currentMeasure.transformToRef(this._transformMatrix, this._tmpMeasureA);\r\n if (this._tmpMeasureA.left >= rect.left + rect.width) {\r\n return false;\r\n }\r\n if (this._tmpMeasureA.top >= rect.top + rect.height) {\r\n return false;\r\n }\r\n if (this._tmpMeasureA.left + this._tmpMeasureA.width <= rect.left) {\r\n return false;\r\n }\r\n if (this._tmpMeasureA.top + this._tmpMeasureA.height <= rect.top) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n Control.prototype.invalidateRect = function () {\r\n this._transform();\r\n if (this.host && this.host.useInvalidateRectOptimization) {\r\n // Rotate by transform to get the measure transformed to global space\r\n this._currentMeasure.transformToRef(this._transformMatrix, this._tmpMeasureA);\r\n // get the boudning box of the current measure and last frames measure in global space and invalidate it\r\n // the previous measure is used to properly clear a control that is scaled down\r\n Measure.CombineToRef(this._tmpMeasureA, this._prevCurrentMeasureTransformedIntoGlobalSpace, this._tmpMeasureA);\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n // Expand rect based on shadows\r\n var shadowOffsetX = this.shadowOffsetX;\r\n var shadowOffsetY = this.shadowOffsetY;\r\n var shadowBlur = this.shadowBlur;\r\n var leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);\r\n var rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);\r\n var topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);\r\n var bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);\r\n this.host.invalidateRect(Math.floor(this._tmpMeasureA.left + leftShadowOffset), Math.floor(this._tmpMeasureA.top + topShadowOffset), Math.ceil(this._tmpMeasureA.left + this._tmpMeasureA.width + rightShadowOffset), Math.ceil(this._tmpMeasureA.top + this._tmpMeasureA.height + bottomShadowOffset));\r\n }\r\n else {\r\n this.host.invalidateRect(Math.floor(this._tmpMeasureA.left), Math.floor(this._tmpMeasureA.top), Math.ceil(this._tmpMeasureA.left + this._tmpMeasureA.width), Math.ceil(this._tmpMeasureA.top + this._tmpMeasureA.height));\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._markAsDirty = function (force) {\r\n if (force === void 0) { force = false; }\r\n if (!this._isVisible && !force) {\r\n return;\r\n }\r\n this._isDirty = true;\r\n // Redraw only this rectangle\r\n if (this._host) {\r\n this._host.markAsDirty();\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._markAllAsDirty = function () {\r\n this._markAsDirty();\r\n if (this._font) {\r\n this._prepareFont();\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._link = function (host) {\r\n this._host = host;\r\n if (this._host) {\r\n this.uniqueId = this._host.getScene().getUniqueId();\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._transform = function (context) {\r\n if (!this._isMatrixDirty && this._scaleX === 1 && this._scaleY === 1 && this._rotation === 0) {\r\n return;\r\n }\r\n // postTranslate\r\n var offsetX = this._currentMeasure.width * this._transformCenterX + this._currentMeasure.left;\r\n var offsetY = this._currentMeasure.height * this._transformCenterY + this._currentMeasure.top;\r\n if (context) {\r\n context.translate(offsetX, offsetY);\r\n // rotate\r\n context.rotate(this._rotation);\r\n // scale\r\n context.scale(this._scaleX, this._scaleY);\r\n // preTranslate\r\n context.translate(-offsetX, -offsetY);\r\n }\r\n // Need to update matrices?\r\n if (this._isMatrixDirty || this._cachedOffsetX !== offsetX || this._cachedOffsetY !== offsetY) {\r\n this._cachedOffsetX = offsetX;\r\n this._cachedOffsetY = offsetY;\r\n this._isMatrixDirty = false;\r\n this._flagDescendantsAsMatrixDirty();\r\n Matrix2D.ComposeToRef(-offsetX, -offsetY, this._rotation, this._scaleX, this._scaleY, this.parent ? this.parent._transformMatrix : null, this._transformMatrix);\r\n this._transformMatrix.invertToRef(this._invertTransformMatrix);\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._renderHighlight = function (context) {\r\n if (!this.isHighlighted) {\r\n return;\r\n }\r\n context.save();\r\n context.strokeStyle = \"#4affff\";\r\n context.lineWidth = 2;\r\n this._renderHighlightSpecific(context);\r\n context.restore();\r\n };\r\n /** @hidden */\r\n Control.prototype._renderHighlightSpecific = function (context) {\r\n context.strokeRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n };\r\n /** @hidden */\r\n Control.prototype._applyStates = function (context) {\r\n if (this._isFontSizeInPercentage) {\r\n this._fontSet = true;\r\n }\r\n if (this._fontSet) {\r\n this._prepareFont();\r\n this._fontSet = false;\r\n }\r\n if (this._font) {\r\n context.font = this._font;\r\n }\r\n if (this._color) {\r\n context.fillStyle = this._color;\r\n }\r\n if (Control.AllowAlphaInheritance) {\r\n context.globalAlpha *= this._alpha;\r\n }\r\n else if (this._alphaSet) {\r\n context.globalAlpha = this.parent ? this.parent.alpha * this._alpha : this._alpha;\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._layout = function (parentMeasure, context) {\r\n if (!this.isDirty && (!this.isVisible || this.notRenderable)) {\r\n return false;\r\n }\r\n if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {\r\n this.host._numLayoutCalls++;\r\n this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this.paddingLeftInPixels | 0, -this.paddingTopInPixels | 0, this.paddingRightInPixels | 0, this.paddingBottomInPixels | 0, this._prevCurrentMeasureTransformedIntoGlobalSpace);\r\n context.save();\r\n this._applyStates(context);\r\n var rebuildCount = 0;\r\n do {\r\n this._rebuildLayout = false;\r\n this._processMeasures(parentMeasure, context);\r\n rebuildCount++;\r\n } while (this._rebuildLayout && rebuildCount < 3);\r\n if (rebuildCount >= 3) {\r\n Logger.Error(\"Layout cycle detected in GUI (Control name=\" + this.name + \", uniqueId=\" + this.uniqueId + \")\");\r\n }\r\n context.restore();\r\n this.invalidateRect();\r\n this._evaluateClippingState(parentMeasure);\r\n }\r\n this._wasDirty = this._isDirty;\r\n this._isDirty = false;\r\n return true;\r\n };\r\n /** @hidden */\r\n Control.prototype._processMeasures = function (parentMeasure, context) {\r\n this._currentMeasure.copyFrom(parentMeasure);\r\n // Let children take some pre-measurement actions\r\n this._preMeasure(parentMeasure, context);\r\n this._measure();\r\n this._computeAlignment(parentMeasure, context);\r\n // Convert to int values\r\n this._currentMeasure.left = this._currentMeasure.left | 0;\r\n this._currentMeasure.top = this._currentMeasure.top | 0;\r\n this._currentMeasure.width = this._currentMeasure.width | 0;\r\n this._currentMeasure.height = this._currentMeasure.height | 0;\r\n // Let children add more features\r\n this._additionalProcessing(parentMeasure, context);\r\n this._cachedParentMeasure.copyFrom(parentMeasure);\r\n if (this.onDirtyObservable.hasObservers()) {\r\n this.onDirtyObservable.notifyObservers(this);\r\n }\r\n };\r\n Control.prototype._evaluateClippingState = function (parentMeasure) {\r\n if (this.parent && this.parent.clipChildren) {\r\n // Early clip\r\n if (this._currentMeasure.left > parentMeasure.left + parentMeasure.width) {\r\n this._isClipped = true;\r\n return;\r\n }\r\n if (this._currentMeasure.left + this._currentMeasure.width < parentMeasure.left) {\r\n this._isClipped = true;\r\n return;\r\n }\r\n if (this._currentMeasure.top > parentMeasure.top + parentMeasure.height) {\r\n this._isClipped = true;\r\n return;\r\n }\r\n if (this._currentMeasure.top + this._currentMeasure.height < parentMeasure.top) {\r\n this._isClipped = true;\r\n return;\r\n }\r\n }\r\n this._isClipped = false;\r\n };\r\n /** @hidden */\r\n Control.prototype._measure = function () {\r\n // Width / Height\r\n if (this._width.isPixel) {\r\n this._currentMeasure.width = this._width.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.width *= this._width.getValue(this._host);\r\n }\r\n if (this._height.isPixel) {\r\n this._currentMeasure.height = this._height.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.height *= this._height.getValue(this._host);\r\n }\r\n if (this.fixedRatio !== 0) {\r\n if (this._fixedRatioMasterIsWidth) {\r\n this._currentMeasure.height = this._currentMeasure.width * this.fixedRatio;\r\n }\r\n else {\r\n this._currentMeasure.width = this._currentMeasure.height * this.fixedRatio;\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._computeAlignment = function (parentMeasure, context) {\r\n var width = this._currentMeasure.width;\r\n var height = this._currentMeasure.height;\r\n var parentWidth = parentMeasure.width;\r\n var parentHeight = parentMeasure.height;\r\n // Left / top\r\n var x = 0;\r\n var y = 0;\r\n switch (this.horizontalAlignment) {\r\n case Control.HORIZONTAL_ALIGNMENT_LEFT:\r\n x = 0;\r\n break;\r\n case Control.HORIZONTAL_ALIGNMENT_RIGHT:\r\n x = parentWidth - width;\r\n break;\r\n case Control.HORIZONTAL_ALIGNMENT_CENTER:\r\n x = (parentWidth - width) / 2;\r\n break;\r\n }\r\n switch (this.verticalAlignment) {\r\n case Control.VERTICAL_ALIGNMENT_TOP:\r\n y = 0;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_BOTTOM:\r\n y = parentHeight - height;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_CENTER:\r\n y = (parentHeight - height) / 2;\r\n break;\r\n }\r\n if (this._paddingLeft.isPixel) {\r\n this._currentMeasure.left += this._paddingLeft.getValue(this._host);\r\n this._currentMeasure.width -= this._paddingLeft.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.left += parentWidth * this._paddingLeft.getValue(this._host);\r\n this._currentMeasure.width -= parentWidth * this._paddingLeft.getValue(this._host);\r\n }\r\n if (this._paddingRight.isPixel) {\r\n this._currentMeasure.width -= this._paddingRight.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.width -= parentWidth * this._paddingRight.getValue(this._host);\r\n }\r\n if (this._paddingTop.isPixel) {\r\n this._currentMeasure.top += this._paddingTop.getValue(this._host);\r\n this._currentMeasure.height -= this._paddingTop.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.top += parentHeight * this._paddingTop.getValue(this._host);\r\n this._currentMeasure.height -= parentHeight * this._paddingTop.getValue(this._host);\r\n }\r\n if (this._paddingBottom.isPixel) {\r\n this._currentMeasure.height -= this._paddingBottom.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.height -= parentHeight * this._paddingBottom.getValue(this._host);\r\n }\r\n if (this._left.isPixel) {\r\n this._currentMeasure.left += this._left.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.left += parentWidth * this._left.getValue(this._host);\r\n }\r\n if (this._top.isPixel) {\r\n this._currentMeasure.top += this._top.getValue(this._host);\r\n }\r\n else {\r\n this._currentMeasure.top += parentHeight * this._top.getValue(this._host);\r\n }\r\n this._currentMeasure.left += x;\r\n this._currentMeasure.top += y;\r\n };\r\n /** @hidden */\r\n Control.prototype._preMeasure = function (parentMeasure, context) {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n Control.prototype._additionalProcessing = function (parentMeasure, context) {\r\n // Do nothing\r\n };\r\n /** @hidden */\r\n Control.prototype._clipForChildren = function (context) {\r\n // DO nothing\r\n };\r\n Control.prototype._clip = function (context, invalidatedRectangle) {\r\n context.beginPath();\r\n Control._ClipMeasure.copyFrom(this._currentMeasure);\r\n if (invalidatedRectangle) {\r\n // Rotate the invalidated rect into the control's space\r\n invalidatedRectangle.transformToRef(this._invertTransformMatrix, this._tmpMeasureA);\r\n // Get the intersection of the rect in context space and the current context\r\n var intersection = new Measure(0, 0, 0, 0);\r\n intersection.left = Math.max(this._tmpMeasureA.left, this._currentMeasure.left);\r\n intersection.top = Math.max(this._tmpMeasureA.top, this._currentMeasure.top);\r\n intersection.width = Math.min(this._tmpMeasureA.left + this._tmpMeasureA.width, this._currentMeasure.left + this._currentMeasure.width) - intersection.left;\r\n intersection.height = Math.min(this._tmpMeasureA.top + this._tmpMeasureA.height, this._currentMeasure.top + this._currentMeasure.height) - intersection.top;\r\n Control._ClipMeasure.copyFrom(intersection);\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n var shadowOffsetX = this.shadowOffsetX;\r\n var shadowOffsetY = this.shadowOffsetY;\r\n var shadowBlur = this.shadowBlur;\r\n var leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);\r\n var rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);\r\n var topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);\r\n var bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);\r\n context.rect(Control._ClipMeasure.left + leftShadowOffset, Control._ClipMeasure.top + topShadowOffset, Control._ClipMeasure.width + rightShadowOffset - leftShadowOffset, Control._ClipMeasure.height + bottomShadowOffset - topShadowOffset);\r\n }\r\n else {\r\n context.rect(Control._ClipMeasure.left, Control._ClipMeasure.top, Control._ClipMeasure.width, Control._ClipMeasure.height);\r\n }\r\n context.clip();\r\n };\r\n /** @hidden */\r\n Control.prototype._render = function (context, invalidatedRectangle) {\r\n if (!this.isVisible || this.notRenderable || this._isClipped) {\r\n this._isDirty = false;\r\n return false;\r\n }\r\n this.host._numRenderCalls++;\r\n context.save();\r\n this._applyStates(context);\r\n // Transform\r\n this._transform(context);\r\n // Clip\r\n if (this.clipContent) {\r\n this._clip(context, invalidatedRectangle);\r\n }\r\n if (this.onBeforeDrawObservable.hasObservers()) {\r\n this.onBeforeDrawObservable.notifyObservers(this);\r\n }\r\n if (this.useBitmapCache && !this._wasDirty && this._cacheData) {\r\n context.putImageData(this._cacheData, this._currentMeasure.left, this._currentMeasure.top);\r\n }\r\n else {\r\n this._draw(context, invalidatedRectangle);\r\n }\r\n if (this.useBitmapCache && this._wasDirty) {\r\n this._cacheData = context.getImageData(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n this._renderHighlight(context);\r\n if (this.onAfterDrawObservable.hasObservers()) {\r\n this.onAfterDrawObservable.notifyObservers(this);\r\n }\r\n context.restore();\r\n return true;\r\n };\r\n /** @hidden */\r\n Control.prototype._draw = function (context, invalidatedRectangle) {\r\n // Do nothing\r\n };\r\n /**\r\n * Tests if a given coordinates belong to the current control\r\n * @param x defines x coordinate to test\r\n * @param y defines y coordinate to test\r\n * @returns true if the coordinates are inside the control\r\n */\r\n Control.prototype.contains = function (x, y) {\r\n // Invert transform\r\n this._invertTransformMatrix.transformCoordinates(x, y, this._transformedPosition);\r\n x = this._transformedPosition.x;\r\n y = this._transformedPosition.y;\r\n // Check\r\n if (x < this._currentMeasure.left) {\r\n return false;\r\n }\r\n if (x > this._currentMeasure.left + this._currentMeasure.width) {\r\n return false;\r\n }\r\n if (y < this._currentMeasure.top) {\r\n return false;\r\n }\r\n if (y > this._currentMeasure.top + this._currentMeasure.height) {\r\n return false;\r\n }\r\n if (this.isPointerBlocker) {\r\n this._host._shouldBlockPointer = true;\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n Control.prototype._processPicking = function (x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY) {\r\n if (!this._isEnabled) {\r\n return false;\r\n }\r\n if (!this.isHitTestVisible || !this.isVisible || this._doNotRender) {\r\n return false;\r\n }\r\n if (!this.contains(x, y)) {\r\n return false;\r\n }\r\n this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);\r\n return true;\r\n };\r\n /** @hidden */\r\n Control.prototype._onPointerMove = function (target, coordinates, pointerId, pi) {\r\n var canNotify = this.onPointerMoveObservable.notifyObservers(coordinates, -1, target, this, pi);\r\n if (canNotify && this.parent != null) {\r\n this.parent._onPointerMove(target, coordinates, pointerId, pi);\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._onPointerEnter = function (target, pi) {\r\n if (!this._isEnabled) {\r\n return false;\r\n }\r\n if (this._enterCount > 0) {\r\n return false;\r\n }\r\n if (this._enterCount === -1) { // -1 is for touch input, we are now sure we are with a mouse or pencil\r\n this._enterCount = 0;\r\n }\r\n this._enterCount++;\r\n var canNotify = this.onPointerEnterObservable.notifyObservers(this, -1, target, this, pi);\r\n if (canNotify && this.parent != null) {\r\n this.parent._onPointerEnter(target, pi);\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n Control.prototype._onPointerOut = function (target, pi, force) {\r\n if (force === void 0) { force = false; }\r\n if (!force && (!this._isEnabled || target === this)) {\r\n return;\r\n }\r\n this._enterCount = 0;\r\n var canNotify = true;\r\n if (!target.isAscendant(this)) {\r\n canNotify = this.onPointerOutObservable.notifyObservers(this, -1, target, this, pi);\r\n }\r\n if (canNotify && this.parent != null) {\r\n this.parent._onPointerOut(target, pi, force);\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n // Prevent pointerout to lose control context.\r\n // Event redundancy is checked inside the function.\r\n this._onPointerEnter(this, pi);\r\n if (this._downCount !== 0) {\r\n return false;\r\n }\r\n this._downCount++;\r\n this._downPointerIds[pointerId] = true;\r\n var canNotify = this.onPointerDownObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);\r\n if (canNotify && this.parent != null) {\r\n this.parent._onPointerDown(target, coordinates, pointerId, buttonIndex, pi);\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n Control.prototype._onPointerUp = function (target, coordinates, pointerId, buttonIndex, notifyClick, pi) {\r\n if (!this._isEnabled) {\r\n return;\r\n }\r\n this._downCount = 0;\r\n delete this._downPointerIds[pointerId];\r\n var canNotifyClick = notifyClick;\r\n if (notifyClick && (this._enterCount > 0 || this._enterCount === -1)) {\r\n canNotifyClick = this.onPointerClickObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);\r\n }\r\n var canNotify = this.onPointerUpObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);\r\n if (canNotify && this.parent != null) {\r\n this.parent._onPointerUp(target, coordinates, pointerId, buttonIndex, canNotifyClick, pi);\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._forcePointerUp = function (pointerId) {\r\n if (pointerId === void 0) { pointerId = null; }\r\n if (pointerId !== null) {\r\n this._onPointerUp(this, Vector2.Zero(), pointerId, 0, true);\r\n }\r\n else {\r\n for (var key in this._downPointerIds) {\r\n this._onPointerUp(this, Vector2.Zero(), +key, 0, true);\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._onWheelScroll = function (deltaX, deltaY) {\r\n if (!this._isEnabled) {\r\n return;\r\n }\r\n var canNotify = this.onWheelObservable.notifyObservers(new Vector2(deltaX, deltaY));\r\n if (canNotify && this.parent != null) {\r\n this.parent._onWheelScroll(deltaX, deltaY);\r\n }\r\n };\r\n /** @hidden */\r\n Control.prototype._onCanvasBlur = function () { };\r\n /** @hidden */\r\n Control.prototype._processObservables = function (type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY) {\r\n if (!this._isEnabled) {\r\n return false;\r\n }\r\n this._dummyVector2.copyFromFloats(x, y);\r\n if (type === PointerEventTypes.POINTERMOVE) {\r\n this._onPointerMove(this, this._dummyVector2, pointerId, pi);\r\n var previousControlOver = this._host._lastControlOver[pointerId];\r\n if (previousControlOver && previousControlOver !== this) {\r\n previousControlOver._onPointerOut(this, pi);\r\n }\r\n if (previousControlOver !== this) {\r\n this._onPointerEnter(this, pi);\r\n }\r\n this._host._lastControlOver[pointerId] = this;\r\n return true;\r\n }\r\n if (type === PointerEventTypes.POINTERDOWN) {\r\n this._onPointerDown(this, this._dummyVector2, pointerId, buttonIndex, pi);\r\n this._host._registerLastControlDown(this, pointerId);\r\n this._host._lastPickedControl = this;\r\n return true;\r\n }\r\n if (type === PointerEventTypes.POINTERUP) {\r\n if (this._host._lastControlDown[pointerId]) {\r\n this._host._lastControlDown[pointerId]._onPointerUp(this, this._dummyVector2, pointerId, buttonIndex, true, pi);\r\n }\r\n delete this._host._lastControlDown[pointerId];\r\n return true;\r\n }\r\n if (type === PointerEventTypes.POINTERWHEEL) {\r\n if (this._host._lastControlOver[pointerId]) {\r\n this._host._lastControlOver[pointerId]._onWheelScroll(deltaX, deltaY);\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n Control.prototype._prepareFont = function () {\r\n if (!this._font && !this._fontSet) {\r\n return;\r\n }\r\n if (this._style) {\r\n this._font = this._style.fontStyle + \" \" + this._style.fontWeight + \" \" + this.fontSizeInPixels + \"px \" + this._style.fontFamily;\r\n }\r\n else {\r\n this._font = this._fontStyle + \" \" + this._fontWeight + \" \" + this.fontSizeInPixels + \"px \" + this._fontFamily;\r\n }\r\n this._fontOffset = Control._GetFontOffset(this._font);\r\n };\r\n /** Releases associated resources */\r\n Control.prototype.dispose = function () {\r\n this.onDirtyObservable.clear();\r\n this.onBeforeDrawObservable.clear();\r\n this.onAfterDrawObservable.clear();\r\n this.onPointerDownObservable.clear();\r\n this.onPointerEnterObservable.clear();\r\n this.onPointerMoveObservable.clear();\r\n this.onPointerOutObservable.clear();\r\n this.onPointerUpObservable.clear();\r\n this.onPointerClickObservable.clear();\r\n this.onWheelObservable.clear();\r\n if (this._styleObserver && this._style) {\r\n this._style.onChangedObservable.remove(this._styleObserver);\r\n this._styleObserver = null;\r\n }\r\n if (this.parent) {\r\n this.parent.removeControl(this);\r\n this.parent = null;\r\n }\r\n if (this._host) {\r\n var index = this._host._linkedControls.indexOf(this);\r\n if (index > -1) {\r\n this.linkWithMesh(null);\r\n }\r\n }\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n };\r\n Object.defineProperty(Control, \"HORIZONTAL_ALIGNMENT_LEFT\", {\r\n /** HORIZONTAL_ALIGNMENT_LEFT */\r\n get: function () {\r\n return Control._HORIZONTAL_ALIGNMENT_LEFT;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control, \"HORIZONTAL_ALIGNMENT_RIGHT\", {\r\n /** HORIZONTAL_ALIGNMENT_RIGHT */\r\n get: function () {\r\n return Control._HORIZONTAL_ALIGNMENT_RIGHT;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control, \"HORIZONTAL_ALIGNMENT_CENTER\", {\r\n /** HORIZONTAL_ALIGNMENT_CENTER */\r\n get: function () {\r\n return Control._HORIZONTAL_ALIGNMENT_CENTER;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control, \"VERTICAL_ALIGNMENT_TOP\", {\r\n /** VERTICAL_ALIGNMENT_TOP */\r\n get: function () {\r\n return Control._VERTICAL_ALIGNMENT_TOP;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control, \"VERTICAL_ALIGNMENT_BOTTOM\", {\r\n /** VERTICAL_ALIGNMENT_BOTTOM */\r\n get: function () {\r\n return Control._VERTICAL_ALIGNMENT_BOTTOM;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Control, \"VERTICAL_ALIGNMENT_CENTER\", {\r\n /** VERTICAL_ALIGNMENT_CENTER */\r\n get: function () {\r\n return Control._VERTICAL_ALIGNMENT_CENTER;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Control._GetFontOffset = function (font) {\r\n if (Control._FontHeightSizes[font]) {\r\n return Control._FontHeightSizes[font];\r\n }\r\n var text = document.createElement(\"span\");\r\n text.innerHTML = \"Hg\";\r\n text.style.font = font;\r\n var block = document.createElement(\"div\");\r\n block.style.display = \"inline-block\";\r\n block.style.width = \"1px\";\r\n block.style.height = \"0px\";\r\n block.style.verticalAlign = \"bottom\";\r\n var div = document.createElement(\"div\");\r\n div.style.whiteSpace = \"nowrap\";\r\n div.appendChild(text);\r\n div.appendChild(block);\r\n document.body.appendChild(div);\r\n var fontAscent = 0;\r\n var fontHeight = 0;\r\n try {\r\n fontHeight = block.getBoundingClientRect().top - text.getBoundingClientRect().top;\r\n block.style.verticalAlign = \"baseline\";\r\n fontAscent = block.getBoundingClientRect().top - text.getBoundingClientRect().top;\r\n }\r\n finally {\r\n document.body.removeChild(div);\r\n }\r\n var result = { ascent: fontAscent, height: fontHeight, descent: fontHeight - fontAscent };\r\n Control._FontHeightSizes[font] = result;\r\n return result;\r\n };\r\n /** @hidden */\r\n Control.drawEllipse = function (x, y, width, height, context) {\r\n context.translate(x, y);\r\n context.scale(width, height);\r\n context.beginPath();\r\n context.arc(0, 0, 1, 0, 2 * Math.PI);\r\n context.closePath();\r\n context.scale(1 / width, 1 / height);\r\n context.translate(-x, -y);\r\n };\r\n /**\r\n * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)\r\n */\r\n Control.AllowAlphaInheritance = false;\r\n Control._ClipMeasure = new Measure(0, 0, 0, 0);\r\n // Statics\r\n Control._HORIZONTAL_ALIGNMENT_LEFT = 0;\r\n Control._HORIZONTAL_ALIGNMENT_RIGHT = 1;\r\n Control._HORIZONTAL_ALIGNMENT_CENTER = 2;\r\n Control._VERTICAL_ALIGNMENT_TOP = 0;\r\n Control._VERTICAL_ALIGNMENT_BOTTOM = 1;\r\n Control._VERTICAL_ALIGNMENT_CENTER = 2;\r\n Control._FontHeightSizes = {};\r\n /**\r\n * Creates a stack panel that can be used to render headers\r\n * @param control defines the control to associate with the header\r\n * @param text defines the text of the header\r\n * @param size defines the size of the header\r\n * @param options defines options used to configure the header\r\n * @returns a new StackPanel\r\n * @ignore\r\n * @hidden\r\n */\r\n Control.AddHeader = function () { };\r\n return Control;\r\n}());\r\nexport { Control };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Control\"] = Control;\r\n//# sourceMappingURL=control.js.map","import { __extends } from \"tslib\";\r\nimport { Container } from \"./container\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/** Class used to create rectangle container */\r\nvar Rectangle = /** @class */ (function (_super) {\r\n __extends(Rectangle, _super);\r\n /**\r\n * Creates a new Rectangle\r\n * @param name defines the control name\r\n */\r\n function Rectangle(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._thickness = 1;\r\n _this._cornerRadius = 0;\r\n return _this;\r\n }\r\n Object.defineProperty(Rectangle.prototype, \"thickness\", {\r\n /** Gets or sets border thickness */\r\n get: function () {\r\n return this._thickness;\r\n },\r\n set: function (value) {\r\n if (this._thickness === value) {\r\n return;\r\n }\r\n this._thickness = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Rectangle.prototype, \"cornerRadius\", {\r\n /** Gets or sets the corner radius angle */\r\n get: function () {\r\n return this._cornerRadius;\r\n },\r\n set: function (value) {\r\n if (value < 0) {\r\n value = 0;\r\n }\r\n if (this._cornerRadius === value) {\r\n return;\r\n }\r\n this._cornerRadius = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Rectangle.prototype._getTypeName = function () {\r\n return \"Rectangle\";\r\n };\r\n Rectangle.prototype._localDraw = function (context) {\r\n context.save();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n if (this._background) {\r\n context.fillStyle = this._background;\r\n if (this._cornerRadius) {\r\n this._drawRoundedRect(context, this._thickness / 2);\r\n context.fill();\r\n }\r\n else {\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n }\r\n if (this._thickness) {\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n if (this.color) {\r\n context.strokeStyle = this.color;\r\n }\r\n context.lineWidth = this._thickness;\r\n if (this._cornerRadius) {\r\n this._drawRoundedRect(context, this._thickness / 2);\r\n context.stroke();\r\n }\r\n else {\r\n context.strokeRect(this._currentMeasure.left + this._thickness / 2, this._currentMeasure.top + this._thickness / 2, this._currentMeasure.width - this._thickness, this._currentMeasure.height - this._thickness);\r\n }\r\n }\r\n context.restore();\r\n };\r\n Rectangle.prototype._additionalProcessing = function (parentMeasure, context) {\r\n _super.prototype._additionalProcessing.call(this, parentMeasure, context);\r\n this._measureForChildren.width -= 2 * this._thickness;\r\n this._measureForChildren.height -= 2 * this._thickness;\r\n this._measureForChildren.left += this._thickness;\r\n this._measureForChildren.top += this._thickness;\r\n };\r\n Rectangle.prototype._drawRoundedRect = function (context, offset) {\r\n if (offset === void 0) { offset = 0; }\r\n var x = this._currentMeasure.left + offset;\r\n var y = this._currentMeasure.top + offset;\r\n var width = this._currentMeasure.width - offset * 2;\r\n var height = this._currentMeasure.height - offset * 2;\r\n var radius = Math.min(height / 2 - 2, Math.min(width / 2 - 2, this._cornerRadius));\r\n context.beginPath();\r\n context.moveTo(x + radius, y);\r\n context.lineTo(x + width - radius, y);\r\n context.quadraticCurveTo(x + width, y, x + width, y + radius);\r\n context.lineTo(x + width, y + height - radius);\r\n context.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);\r\n context.lineTo(x + radius, y + height);\r\n context.quadraticCurveTo(x, y + height, x, y + height - radius);\r\n context.lineTo(x, y + radius);\r\n context.quadraticCurveTo(x, y, x + radius, y);\r\n context.closePath();\r\n };\r\n Rectangle.prototype._clipForChildren = function (context) {\r\n if (this._cornerRadius) {\r\n this._drawRoundedRect(context, this._thickness);\r\n context.clip();\r\n }\r\n };\r\n return Rectangle;\r\n}(Container));\r\nexport { Rectangle };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Rectangle\"] = Rectangle;\r\n//# sourceMappingURL=rectangle.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { Control } from \"./control\";\r\nimport { _TypeStore } from \"@babylonjs/core/Misc/typeStore\";\r\n/**\r\n * Enum that determines the text-wrapping mode to use.\r\n */\r\nexport var TextWrapping;\r\n(function (TextWrapping) {\r\n /**\r\n * Clip the text when it's larger than Control.width; this is the default mode.\r\n */\r\n TextWrapping[TextWrapping[\"Clip\"] = 0] = \"Clip\";\r\n /**\r\n * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.\r\n */\r\n TextWrapping[TextWrapping[\"WordWrap\"] = 1] = \"WordWrap\";\r\n /**\r\n * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.\r\n */\r\n TextWrapping[TextWrapping[\"Ellipsis\"] = 2] = \"Ellipsis\";\r\n})(TextWrapping || (TextWrapping = {}));\r\n/**\r\n * Class used to create text block control\r\n */\r\nvar TextBlock = /** @class */ (function (_super) {\r\n __extends(TextBlock, _super);\r\n /**\r\n * Creates a new TextBlock object\r\n * @param name defines the name of the control\r\n * @param text defines the text to display (emptry string by default)\r\n */\r\n function TextBlock(\r\n /**\r\n * Defines the name of the control\r\n */\r\n name, text) {\r\n if (text === void 0) { text = \"\"; }\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._text = \"\";\r\n _this._textWrapping = TextWrapping.Clip;\r\n _this._textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n _this._textVerticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n _this._resizeToFit = false;\r\n _this._lineSpacing = new ValueAndUnit(0);\r\n _this._outlineWidth = 0;\r\n _this._outlineColor = \"white\";\r\n _this._underline = false;\r\n _this._lineThrough = false;\r\n /**\r\n * An event triggered after the text is changed\r\n */\r\n _this.onTextChangedObservable = new Observable();\r\n /**\r\n * An event triggered after the text was broken up into lines\r\n */\r\n _this.onLinesReadyObservable = new Observable();\r\n _this.text = text;\r\n return _this;\r\n }\r\n Object.defineProperty(TextBlock.prototype, \"lines\", {\r\n /**\r\n * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)\r\n */\r\n get: function () {\r\n return this._lines;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"resizeToFit\", {\r\n /**\r\n * Gets or sets an boolean indicating that the TextBlock will be resized to fit container\r\n */\r\n get: function () {\r\n return this._resizeToFit;\r\n },\r\n /**\r\n * Gets or sets an boolean indicating that the TextBlock will be resized to fit container\r\n */\r\n set: function (value) {\r\n if (this._resizeToFit === value) {\r\n return;\r\n }\r\n this._resizeToFit = value;\r\n if (this._resizeToFit) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"textWrapping\", {\r\n /**\r\n * Gets or sets a boolean indicating if text must be wrapped\r\n */\r\n get: function () {\r\n return this._textWrapping;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating if text must be wrapped\r\n */\r\n set: function (value) {\r\n if (this._textWrapping === value) {\r\n return;\r\n }\r\n this._textWrapping = +value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"text\", {\r\n /**\r\n * Gets or sets text to display\r\n */\r\n get: function () {\r\n return this._text;\r\n },\r\n /**\r\n * Gets or sets text to display\r\n */\r\n set: function (value) {\r\n if (this._text === value) {\r\n return;\r\n }\r\n this._text = value;\r\n this._markAsDirty();\r\n this.onTextChangedObservable.notifyObservers(this);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"textHorizontalAlignment\", {\r\n /**\r\n * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)\r\n */\r\n get: function () {\r\n return this._textHorizontalAlignment;\r\n },\r\n /**\r\n * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)\r\n */\r\n set: function (value) {\r\n if (this._textHorizontalAlignment === value) {\r\n return;\r\n }\r\n this._textHorizontalAlignment = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"textVerticalAlignment\", {\r\n /**\r\n * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)\r\n */\r\n get: function () {\r\n return this._textVerticalAlignment;\r\n },\r\n /**\r\n * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)\r\n */\r\n set: function (value) {\r\n if (this._textVerticalAlignment === value) {\r\n return;\r\n }\r\n this._textVerticalAlignment = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"lineSpacing\", {\r\n /**\r\n * Gets or sets line spacing value\r\n */\r\n get: function () {\r\n return this._lineSpacing.toString(this._host);\r\n },\r\n /**\r\n * Gets or sets line spacing value\r\n */\r\n set: function (value) {\r\n if (this._lineSpacing.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"outlineWidth\", {\r\n /**\r\n * Gets or sets outlineWidth of the text to display\r\n */\r\n get: function () {\r\n return this._outlineWidth;\r\n },\r\n /**\r\n * Gets or sets outlineWidth of the text to display\r\n */\r\n set: function (value) {\r\n if (this._outlineWidth === value) {\r\n return;\r\n }\r\n this._outlineWidth = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"underline\", {\r\n /**\r\n * Gets or sets a boolean indicating that text must have underline\r\n */\r\n get: function () {\r\n return this._underline;\r\n },\r\n /**\r\n * Gets or sets a boolean indicating that text must have underline\r\n */\r\n set: function (value) {\r\n if (this._underline === value) {\r\n return;\r\n }\r\n this._underline = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"lineThrough\", {\r\n /**\r\n * Gets or sets an boolean indicating that text must be crossed out\r\n */\r\n get: function () {\r\n return this._lineThrough;\r\n },\r\n /**\r\n * Gets or sets an boolean indicating that text must be crossed out\r\n */\r\n set: function (value) {\r\n if (this._lineThrough === value) {\r\n return;\r\n }\r\n this._lineThrough = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextBlock.prototype, \"outlineColor\", {\r\n /**\r\n * Gets or sets outlineColor of the text to display\r\n */\r\n get: function () {\r\n return this._outlineColor;\r\n },\r\n /**\r\n * Gets or sets outlineColor of the text to display\r\n */\r\n set: function (value) {\r\n if (this._outlineColor === value) {\r\n return;\r\n }\r\n this._outlineColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n TextBlock.prototype._getTypeName = function () {\r\n return \"TextBlock\";\r\n };\r\n TextBlock.prototype._processMeasures = function (parentMeasure, context) {\r\n if (!this._fontOffset) {\r\n this._fontOffset = Control._GetFontOffset(context.font);\r\n }\r\n _super.prototype._processMeasures.call(this, parentMeasure, context);\r\n // Prepare lines\r\n this._lines = this._breakLines(this._currentMeasure.width, context);\r\n this.onLinesReadyObservable.notifyObservers(this);\r\n var maxLineWidth = 0;\r\n for (var i = 0; i < this._lines.length; i++) {\r\n var line = this._lines[i];\r\n if (line.width > maxLineWidth) {\r\n maxLineWidth = line.width;\r\n }\r\n }\r\n if (this._resizeToFit) {\r\n if (this._textWrapping === TextWrapping.Clip) {\r\n var newWidth = (this.paddingLeftInPixels + this.paddingRightInPixels + maxLineWidth) | 0;\r\n if (newWidth !== this._width.internalValue) {\r\n this._width.updateInPlace(newWidth, ValueAndUnit.UNITMODE_PIXEL);\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n var newHeight = (this.paddingTopInPixels + this.paddingBottomInPixels + this._fontOffset.height * this._lines.length) | 0;\r\n if (this._lines.length > 0 && this._lineSpacing.internalValue !== 0) {\r\n var lineSpacing = 0;\r\n if (this._lineSpacing.isPixel) {\r\n lineSpacing = this._lineSpacing.getValue(this._host);\r\n }\r\n else {\r\n lineSpacing = this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n newHeight += (this._lines.length - 1) * lineSpacing;\r\n }\r\n if (newHeight !== this._height.internalValue) {\r\n this._height.updateInPlace(newHeight, ValueAndUnit.UNITMODE_PIXEL);\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n };\r\n TextBlock.prototype._drawText = function (text, textWidth, y, context) {\r\n var width = this._currentMeasure.width;\r\n var x = 0;\r\n switch (this._textHorizontalAlignment) {\r\n case Control.HORIZONTAL_ALIGNMENT_LEFT:\r\n x = 0;\r\n break;\r\n case Control.HORIZONTAL_ALIGNMENT_RIGHT:\r\n x = width - textWidth;\r\n break;\r\n case Control.HORIZONTAL_ALIGNMENT_CENTER:\r\n x = (width - textWidth) / 2;\r\n break;\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n if (this.outlineWidth) {\r\n context.strokeText(text, this._currentMeasure.left + x, y);\r\n }\r\n context.fillText(text, this._currentMeasure.left + x, y);\r\n if (this._underline) {\r\n context.beginPath();\r\n context.lineWidth = Math.round(this.fontSizeInPixels * 0.05);\r\n context.moveTo(this._currentMeasure.left + x, y + 3);\r\n context.lineTo(this._currentMeasure.left + x + textWidth, y + 3);\r\n context.stroke();\r\n context.closePath();\r\n }\r\n if (this._lineThrough) {\r\n context.beginPath();\r\n context.lineWidth = Math.round(this.fontSizeInPixels * 0.05);\r\n context.moveTo(this._currentMeasure.left + x, y - this.fontSizeInPixels / 3);\r\n context.lineTo(this._currentMeasure.left + x + textWidth, y - this.fontSizeInPixels / 3);\r\n context.stroke();\r\n context.closePath();\r\n }\r\n };\r\n /** @hidden */\r\n TextBlock.prototype._draw = function (context, invalidatedRectangle) {\r\n context.save();\r\n this._applyStates(context);\r\n // Render lines\r\n this._renderLines(context);\r\n context.restore();\r\n };\r\n TextBlock.prototype._applyStates = function (context) {\r\n _super.prototype._applyStates.call(this, context);\r\n if (this.outlineWidth) {\r\n context.lineWidth = this.outlineWidth;\r\n context.strokeStyle = this.outlineColor;\r\n context.lineJoin = 'miter';\r\n context.miterLimit = 2;\r\n }\r\n };\r\n TextBlock.prototype._breakLines = function (refWidth, context) {\r\n var lines = [];\r\n var _lines = this.text.split(\"\\n\");\r\n if (this._textWrapping === TextWrapping.Ellipsis) {\r\n for (var _i = 0, _lines_1 = _lines; _i < _lines_1.length; _i++) {\r\n var _line = _lines_1[_i];\r\n lines.push(this._parseLineEllipsis(_line, refWidth, context));\r\n }\r\n }\r\n else if (this._textWrapping === TextWrapping.WordWrap) {\r\n for (var _a = 0, _lines_2 = _lines; _a < _lines_2.length; _a++) {\r\n var _line = _lines_2[_a];\r\n lines.push.apply(lines, this._parseLineWordWrap(_line, refWidth, context));\r\n }\r\n }\r\n else {\r\n for (var _b = 0, _lines_3 = _lines; _b < _lines_3.length; _b++) {\r\n var _line = _lines_3[_b];\r\n lines.push(this._parseLine(_line, context));\r\n }\r\n }\r\n return lines;\r\n };\r\n TextBlock.prototype._parseLine = function (line, context) {\r\n if (line === void 0) { line = \"\"; }\r\n return { text: line, width: context.measureText(line).width };\r\n };\r\n TextBlock.prototype._parseLineEllipsis = function (line, width, context) {\r\n if (line === void 0) { line = \"\"; }\r\n var lineWidth = context.measureText(line).width;\r\n if (lineWidth > width) {\r\n line += \"…\";\r\n }\r\n // unicode support. split('') does not work with unicode!\r\n // make sure Array.from is available\r\n var characters = Array.from && Array.from(line);\r\n if (!characters) {\r\n // no array.from, use the old method\r\n while (line.length > 2 && lineWidth > width) {\r\n line = line.slice(0, -2) + \"…\";\r\n lineWidth = context.measureText(line).width;\r\n }\r\n }\r\n else {\r\n while (characters.length && lineWidth > width) {\r\n characters.pop();\r\n line = characters.join(\"\") + \"...\";\r\n lineWidth = context.measureText(line).width;\r\n }\r\n }\r\n return { text: line, width: lineWidth };\r\n };\r\n TextBlock.prototype._parseLineWordWrap = function (line, width, context) {\r\n if (line === void 0) { line = \"\"; }\r\n var lines = [];\r\n var words = this.wordSplittingFunction ? this.wordSplittingFunction(line) : line.split(\" \");\r\n var lineWidth = 0;\r\n for (var n = 0; n < words.length; n++) {\r\n var testLine = n > 0 ? line + \" \" + words[n] : words[0];\r\n var metrics = context.measureText(testLine);\r\n var testWidth = metrics.width;\r\n if (testWidth > width && n > 0) {\r\n lines.push({ text: line, width: lineWidth });\r\n line = words[n];\r\n lineWidth = context.measureText(line).width;\r\n }\r\n else {\r\n lineWidth = testWidth;\r\n line = testLine;\r\n }\r\n }\r\n lines.push({ text: line, width: lineWidth });\r\n return lines;\r\n };\r\n TextBlock.prototype._renderLines = function (context) {\r\n var height = this._currentMeasure.height;\r\n var rootY = 0;\r\n switch (this._textVerticalAlignment) {\r\n case Control.VERTICAL_ALIGNMENT_TOP:\r\n rootY = this._fontOffset.ascent;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_BOTTOM:\r\n rootY = height - this._fontOffset.height * (this._lines.length - 1) - this._fontOffset.descent;\r\n break;\r\n case Control.VERTICAL_ALIGNMENT_CENTER:\r\n rootY = this._fontOffset.ascent + (height - this._fontOffset.height * this._lines.length) / 2;\r\n break;\r\n }\r\n rootY += this._currentMeasure.top;\r\n for (var i = 0; i < this._lines.length; i++) {\r\n var line = this._lines[i];\r\n if (i !== 0 && this._lineSpacing.internalValue !== 0) {\r\n if (this._lineSpacing.isPixel) {\r\n rootY += this._lineSpacing.getValue(this._host);\r\n }\r\n else {\r\n rootY = rootY + this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n }\r\n this._drawText(line.text, line.width, rootY, context);\r\n rootY += this._fontOffset.height;\r\n }\r\n };\r\n /**\r\n * Given a width constraint applied on the text block, find the expected height\r\n * @returns expected height\r\n */\r\n TextBlock.prototype.computeExpectedHeight = function () {\r\n if (this.text && this.widthInPixels) {\r\n var context_1 = document.createElement(\"canvas\").getContext(\"2d\");\r\n if (context_1) {\r\n this._applyStates(context_1);\r\n if (!this._fontOffset) {\r\n this._fontOffset = Control._GetFontOffset(context_1.font);\r\n }\r\n var lines = this._lines ? this._lines : this._breakLines(this.widthInPixels - this.paddingLeftInPixels - this.paddingRightInPixels, context_1);\r\n var newHeight = this.paddingTopInPixels + this.paddingBottomInPixels + this._fontOffset.height * lines.length;\r\n if (lines.length > 0 && this._lineSpacing.internalValue !== 0) {\r\n var lineSpacing = 0;\r\n if (this._lineSpacing.isPixel) {\r\n lineSpacing = this._lineSpacing.getValue(this._host);\r\n }\r\n else {\r\n lineSpacing = this._lineSpacing.getValue(this._host) * this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);\r\n }\r\n newHeight += (lines.length - 1) * lineSpacing;\r\n }\r\n return newHeight;\r\n }\r\n }\r\n return 0;\r\n };\r\n TextBlock.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onTextChangedObservable.clear();\r\n };\r\n return TextBlock;\r\n}(Control));\r\nexport { TextBlock };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.TextBlock\"] = TextBlock;\r\n//# sourceMappingURL=textBlock.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Control } from \"./control\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create 2D images\r\n */\r\nvar Image = /** @class */ (function (_super) {\r\n __extends(Image, _super);\r\n /**\r\n * Creates a new Image\r\n * @param name defines the control name\r\n * @param url defines the image url\r\n */\r\n function Image(name, url) {\r\n if (url === void 0) { url = null; }\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._workingCanvas = null;\r\n _this._loaded = false;\r\n _this._stretch = Image.STRETCH_FILL;\r\n _this._autoScale = false;\r\n _this._sourceLeft = 0;\r\n _this._sourceTop = 0;\r\n _this._sourceWidth = 0;\r\n _this._sourceHeight = 0;\r\n _this._svgAttributesComputationCompleted = false;\r\n _this._isSVG = false;\r\n _this._cellWidth = 0;\r\n _this._cellHeight = 0;\r\n _this._cellId = -1;\r\n _this._populateNinePatchSlicesFromImage = false;\r\n _this._imageDataCache = { data: null, key: \"\" };\r\n /**\r\n * Observable notified when the content is loaded\r\n */\r\n _this.onImageLoadedObservable = new Observable();\r\n /**\r\n * Observable notified when _sourceLeft, _sourceTop, _sourceWidth and _sourceHeight are computed\r\n */\r\n _this.onSVGAttributesComputedObservable = new Observable();\r\n _this.source = url;\r\n return _this;\r\n }\r\n Object.defineProperty(Image.prototype, \"isLoaded\", {\r\n /**\r\n * Gets a boolean indicating that the content is loaded\r\n */\r\n get: function () {\r\n return this._loaded;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"populateNinePatchSlicesFromImage\", {\r\n /**\r\n * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data\r\n */\r\n get: function () {\r\n return this._populateNinePatchSlicesFromImage;\r\n },\r\n set: function (value) {\r\n if (this._populateNinePatchSlicesFromImage === value) {\r\n return;\r\n }\r\n this._populateNinePatchSlicesFromImage = value;\r\n if (this._populateNinePatchSlicesFromImage && this._loaded) {\r\n this._extractNinePatchSliceDataFromImage();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"detectPointerOnOpaqueOnly\", {\r\n /**\r\n * Gets or sets a boolean indicating if pointers should only be validated on pixels with alpha > 0.\r\n * Beware using this as this will comsume more memory as the image has to be stored twice\r\n */\r\n get: function () {\r\n return this._detectPointerOnOpaqueOnly;\r\n },\r\n set: function (value) {\r\n if (this._detectPointerOnOpaqueOnly === value) {\r\n return;\r\n }\r\n this._detectPointerOnOpaqueOnly = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sliceLeft\", {\r\n /**\r\n * Gets or sets the left value for slicing (9-patch)\r\n */\r\n get: function () {\r\n return this._sliceLeft;\r\n },\r\n set: function (value) {\r\n if (this._sliceLeft === value) {\r\n return;\r\n }\r\n this._sliceLeft = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sliceRight\", {\r\n /**\r\n * Gets or sets the right value for slicing (9-patch)\r\n */\r\n get: function () {\r\n return this._sliceRight;\r\n },\r\n set: function (value) {\r\n if (this._sliceRight === value) {\r\n return;\r\n }\r\n this._sliceRight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sliceTop\", {\r\n /**\r\n * Gets or sets the top value for slicing (9-patch)\r\n */\r\n get: function () {\r\n return this._sliceTop;\r\n },\r\n set: function (value) {\r\n if (this._sliceTop === value) {\r\n return;\r\n }\r\n this._sliceTop = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sliceBottom\", {\r\n /**\r\n * Gets or sets the bottom value for slicing (9-patch)\r\n */\r\n get: function () {\r\n return this._sliceBottom;\r\n },\r\n set: function (value) {\r\n if (this._sliceBottom === value) {\r\n return;\r\n }\r\n this._sliceBottom = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sourceLeft\", {\r\n /**\r\n * Gets or sets the left coordinate in the source image\r\n */\r\n get: function () {\r\n return this._sourceLeft;\r\n },\r\n set: function (value) {\r\n if (this._sourceLeft === value) {\r\n return;\r\n }\r\n this._sourceLeft = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sourceTop\", {\r\n /**\r\n * Gets or sets the top coordinate in the source image\r\n */\r\n get: function () {\r\n return this._sourceTop;\r\n },\r\n set: function (value) {\r\n if (this._sourceTop === value) {\r\n return;\r\n }\r\n this._sourceTop = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sourceWidth\", {\r\n /**\r\n * Gets or sets the width to capture in the source image\r\n */\r\n get: function () {\r\n return this._sourceWidth;\r\n },\r\n set: function (value) {\r\n if (this._sourceWidth === value) {\r\n return;\r\n }\r\n this._sourceWidth = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"sourceHeight\", {\r\n /**\r\n * Gets or sets the height to capture in the source image\r\n */\r\n get: function () {\r\n return this._sourceHeight;\r\n },\r\n set: function (value) {\r\n if (this._sourceHeight === value) {\r\n return;\r\n }\r\n this._sourceHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"isSVG\", {\r\n /** Indicates if the format of the image is SVG */\r\n get: function () {\r\n return this._isSVG;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"svgAttributesComputationCompleted\", {\r\n /** Gets the status of the SVG attributes computation (sourceLeft, sourceTop, sourceWidth, sourceHeight) */\r\n get: function () {\r\n return this._svgAttributesComputationCompleted;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"autoScale\", {\r\n /**\r\n * Gets or sets a boolean indicating if the image can force its container to adapt its size\r\n * @see https://doc.babylonjs.com/how_to/gui#image\r\n */\r\n get: function () {\r\n return this._autoScale;\r\n },\r\n set: function (value) {\r\n if (this._autoScale === value) {\r\n return;\r\n }\r\n this._autoScale = value;\r\n if (value && this._loaded) {\r\n this.synchronizeSizeWithContent();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"stretch\", {\r\n /** Gets or sets the streching mode used by the image */\r\n get: function () {\r\n return this._stretch;\r\n },\r\n set: function (value) {\r\n if (this._stretch === value) {\r\n return;\r\n }\r\n this._stretch = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n Image.prototype._rotate90 = function (n, preserveProperties) {\r\n if (preserveProperties === void 0) { preserveProperties = false; }\r\n var canvas = document.createElement('canvas');\r\n var context = canvas.getContext('2d');\r\n var width = this._domImage.width;\r\n var height = this._domImage.height;\r\n canvas.width = height;\r\n canvas.height = width;\r\n context.translate(canvas.width / 2, canvas.height / 2);\r\n context.rotate(n * Math.PI / 2);\r\n context.drawImage(this._domImage, 0, 0, width, height, -width / 2, -height / 2, width, height);\r\n var dataUrl = canvas.toDataURL(\"image/jpg\");\r\n var rotatedImage = new Image(this.name + \"rotated\", dataUrl);\r\n if (preserveProperties) {\r\n rotatedImage._stretch = this._stretch;\r\n rotatedImage._autoScale = this._autoScale;\r\n rotatedImage._cellId = this._cellId;\r\n rotatedImage._cellWidth = n % 1 ? this._cellHeight : this._cellWidth;\r\n rotatedImage._cellHeight = n % 1 ? this._cellWidth : this._cellHeight;\r\n }\r\n this._handleRotationForSVGImage(this, rotatedImage, n);\r\n this._imageDataCache.data = null;\r\n return rotatedImage;\r\n };\r\n Image.prototype._handleRotationForSVGImage = function (srcImage, dstImage, n) {\r\n var _this = this;\r\n if (!srcImage._isSVG) {\r\n return;\r\n }\r\n if (srcImage._svgAttributesComputationCompleted) {\r\n this._rotate90SourceProperties(srcImage, dstImage, n);\r\n this._markAsDirty();\r\n }\r\n else {\r\n srcImage.onSVGAttributesComputedObservable.addOnce(function () {\r\n _this._rotate90SourceProperties(srcImage, dstImage, n);\r\n _this._markAsDirty();\r\n });\r\n }\r\n };\r\n Image.prototype._rotate90SourceProperties = function (srcImage, dstImage, n) {\r\n var _a, _b;\r\n var srcLeft = srcImage.sourceLeft, srcTop = srcImage.sourceTop, srcWidth = srcImage.domImage.width, srcHeight = srcImage.domImage.height;\r\n var dstLeft = srcLeft, dstTop = srcTop, dstWidth = srcImage.sourceWidth, dstHeight = srcImage.sourceHeight;\r\n if (n != 0) {\r\n var mult = n < 0 ? -1 : 1;\r\n n = n % 4;\r\n for (var i = 0; i < Math.abs(n); ++i) {\r\n dstLeft = -(srcTop - srcHeight / 2) * mult + srcHeight / 2;\r\n dstTop = (srcLeft - srcWidth / 2) * mult + srcWidth / 2;\r\n _a = [dstHeight, dstWidth], dstWidth = _a[0], dstHeight = _a[1];\r\n if (n < 0) {\r\n dstTop -= dstHeight;\r\n }\r\n else {\r\n dstLeft -= dstWidth;\r\n }\r\n srcLeft = dstLeft;\r\n srcTop = dstTop;\r\n _b = [srcHeight, srcWidth], srcWidth = _b[0], srcHeight = _b[1];\r\n }\r\n }\r\n dstImage.sourceLeft = dstLeft;\r\n dstImage.sourceTop = dstTop;\r\n dstImage.sourceWidth = dstWidth;\r\n dstImage.sourceHeight = dstHeight;\r\n };\r\n Object.defineProperty(Image.prototype, \"domImage\", {\r\n get: function () {\r\n return this._domImage;\r\n },\r\n /**\r\n * Gets or sets the internal DOM image used to render the control\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n this._domImage = value;\r\n this._loaded = false;\r\n this._imageDataCache.data = null;\r\n if (this._domImage.width) {\r\n this._onImageLoaded();\r\n }\r\n else {\r\n this._domImage.onload = function () {\r\n _this._onImageLoaded();\r\n };\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Image.prototype._onImageLoaded = function () {\r\n this._imageDataCache.data = null;\r\n this._imageWidth = this._domImage.width;\r\n this._imageHeight = this._domImage.height;\r\n this._loaded = true;\r\n if (this._populateNinePatchSlicesFromImage) {\r\n this._extractNinePatchSliceDataFromImage();\r\n }\r\n if (this._autoScale) {\r\n this.synchronizeSizeWithContent();\r\n }\r\n this.onImageLoadedObservable.notifyObservers(this);\r\n this._markAsDirty();\r\n };\r\n Image.prototype._extractNinePatchSliceDataFromImage = function () {\r\n if (!this._workingCanvas) {\r\n this._workingCanvas = document.createElement('canvas');\r\n }\r\n var canvas = this._workingCanvas;\r\n var context = canvas.getContext('2d');\r\n var width = this._domImage.width;\r\n var height = this._domImage.height;\r\n canvas.width = width;\r\n canvas.height = height;\r\n context.drawImage(this._domImage, 0, 0, width, height);\r\n var imageData = context.getImageData(0, 0, width, height);\r\n // Left and right\r\n this._sliceLeft = -1;\r\n this._sliceRight = -1;\r\n for (var x = 0; x < width; x++) {\r\n var alpha = imageData.data[x * 4 + 3];\r\n if (alpha > 127 && this._sliceLeft === -1) {\r\n this._sliceLeft = x;\r\n continue;\r\n }\r\n if (alpha < 127 && this._sliceLeft > -1) {\r\n this._sliceRight = x;\r\n break;\r\n }\r\n }\r\n // top and bottom\r\n this._sliceTop = -1;\r\n this._sliceBottom = -1;\r\n for (var y = 0; y < height; y++) {\r\n var alpha = imageData.data[y * width * 4 + 3];\r\n if (alpha > 127 && this._sliceTop === -1) {\r\n this._sliceTop = y;\r\n continue;\r\n }\r\n if (alpha < 127 && this._sliceTop > -1) {\r\n this._sliceBottom = y;\r\n break;\r\n }\r\n }\r\n };\r\n Object.defineProperty(Image.prototype, \"source\", {\r\n /**\r\n * Gets or sets image source url\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (this._source === value) {\r\n return;\r\n }\r\n this._loaded = false;\r\n this._source = value;\r\n this._imageDataCache.data = null;\r\n if (value) {\r\n value = this._svgCheck(value);\r\n }\r\n this._domImage = document.createElement(\"img\");\r\n this._domImage.onload = function () {\r\n _this._onImageLoaded();\r\n };\r\n if (value) {\r\n Tools.SetCorsBehavior(value, this._domImage);\r\n this._domImage.src = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Checks for svg document with icon id present\r\n */\r\n Image.prototype._svgCheck = function (value) {\r\n var _this = this;\r\n if (window.SVGSVGElement && (value.search(/.svg#/gi) !== -1) && (value.indexOf(\"#\") === value.lastIndexOf(\"#\"))) {\r\n this._isSVG = true;\r\n var svgsrc = value.split('#')[0];\r\n var elemid = value.split('#')[1];\r\n // check if object alr exist in document\r\n var svgExist = document.body.querySelector('object[data=\"' + svgsrc + '\"]');\r\n if (svgExist) {\r\n var svgDoc = svgExist.contentDocument;\r\n // get viewbox width and height, get svg document width and height in px\r\n if (svgDoc && svgDoc.documentElement) {\r\n var vb = svgDoc.documentElement.getAttribute(\"viewBox\");\r\n var docwidth = Number(svgDoc.documentElement.getAttribute(\"width\"));\r\n var docheight = Number(svgDoc.documentElement.getAttribute(\"height\"));\r\n var elem = svgDoc.getElementById(elemid);\r\n if (elem && vb && docwidth && docheight) {\r\n this._getSVGAttribs(svgExist, elemid);\r\n return value;\r\n }\r\n }\r\n // wait for object to load\r\n svgExist.addEventListener(\"load\", function () {\r\n _this._getSVGAttribs(svgExist, elemid);\r\n });\r\n }\r\n else {\r\n // create document object\r\n var svgImage = document.createElement(\"object\");\r\n svgImage.data = svgsrc;\r\n svgImage.type = \"image/svg+xml\";\r\n svgImage.width = \"0%\";\r\n svgImage.height = \"0%\";\r\n document.body.appendChild(svgImage);\r\n // when the object has loaded, get the element attribs\r\n svgImage.onload = function () {\r\n var svgobj = document.body.querySelector('object[data=\"' + svgsrc + '\"]');\r\n if (svgobj) {\r\n _this._getSVGAttribs(svgobj, elemid);\r\n }\r\n };\r\n }\r\n return svgsrc;\r\n }\r\n else {\r\n return value;\r\n }\r\n };\r\n /**\r\n * Sets sourceLeft, sourceTop, sourceWidth, sourceHeight automatically\r\n * given external svg file and icon id\r\n */\r\n Image.prototype._getSVGAttribs = function (svgsrc, elemid) {\r\n var svgDoc = svgsrc.contentDocument;\r\n // get viewbox width and height, get svg document width and height in px\r\n if (svgDoc && svgDoc.documentElement) {\r\n var vb = svgDoc.documentElement.getAttribute(\"viewBox\");\r\n var docwidth = Number(svgDoc.documentElement.getAttribute(\"width\"));\r\n var docheight = Number(svgDoc.documentElement.getAttribute(\"height\"));\r\n // get element bbox and matrix transform\r\n var elem = svgDoc.getElementById(elemid);\r\n if (vb && docwidth && docheight && elem) {\r\n var vb_width = Number(vb.split(\" \")[2]);\r\n var vb_height = Number(vb.split(\" \")[3]);\r\n var elem_bbox = elem.getBBox();\r\n var elem_matrix_a = 1;\r\n var elem_matrix_d = 1;\r\n var elem_matrix_e = 0;\r\n var elem_matrix_f = 0;\r\n if (elem.transform && elem.transform.baseVal.consolidate()) {\r\n elem_matrix_a = elem.transform.baseVal.consolidate().matrix.a;\r\n elem_matrix_d = elem.transform.baseVal.consolidate().matrix.d;\r\n elem_matrix_e = elem.transform.baseVal.consolidate().matrix.e;\r\n elem_matrix_f = elem.transform.baseVal.consolidate().matrix.f;\r\n }\r\n // compute source coordinates and dimensions\r\n this.sourceLeft = ((elem_matrix_a * elem_bbox.x + elem_matrix_e) * docwidth) / vb_width;\r\n this.sourceTop = ((elem_matrix_d * elem_bbox.y + elem_matrix_f) * docheight) / vb_height;\r\n this.sourceWidth = (elem_bbox.width * elem_matrix_a) * (docwidth / vb_width);\r\n this.sourceHeight = (elem_bbox.height * elem_matrix_d) * (docheight / vb_height);\r\n this._svgAttributesComputationCompleted = true;\r\n this.onSVGAttributesComputedObservable.notifyObservers(this);\r\n }\r\n }\r\n };\r\n Object.defineProperty(Image.prototype, \"cellWidth\", {\r\n /**\r\n * Gets or sets the cell width to use when animation sheet is enabled\r\n * @see https://doc.babylonjs.com/how_to/gui#image\r\n */\r\n get: function () {\r\n return this._cellWidth;\r\n },\r\n set: function (value) {\r\n if (this._cellWidth === value) {\r\n return;\r\n }\r\n this._cellWidth = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"cellHeight\", {\r\n /**\r\n * Gets or sets the cell height to use when animation sheet is enabled\r\n * @see https://doc.babylonjs.com/how_to/gui#image\r\n */\r\n get: function () {\r\n return this._cellHeight;\r\n },\r\n set: function (value) {\r\n if (this._cellHeight === value) {\r\n return;\r\n }\r\n this._cellHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Image.prototype, \"cellId\", {\r\n /**\r\n * Gets or sets the cell id to use (this will turn on the animation sheet mode)\r\n * @see https://doc.babylonjs.com/how_to/gui#image\r\n */\r\n get: function () {\r\n return this._cellId;\r\n },\r\n set: function (value) {\r\n if (this._cellId === value) {\r\n return;\r\n }\r\n this._cellId = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Tests if a given coordinates belong to the current control\r\n * @param x defines x coordinate to test\r\n * @param y defines y coordinate to test\r\n * @returns true if the coordinates are inside the control\r\n */\r\n Image.prototype.contains = function (x, y) {\r\n if (!_super.prototype.contains.call(this, x, y)) {\r\n return false;\r\n }\r\n if (!this._detectPointerOnOpaqueOnly || !this._workingCanvas) {\r\n return true;\r\n }\r\n var width = this._currentMeasure.width | 0;\r\n var height = this._currentMeasure.height | 0;\r\n var key = width + \"_\" + height;\r\n var imageData = this._imageDataCache.data;\r\n if (!imageData || this._imageDataCache.key !== key) {\r\n var canvas = this._workingCanvas;\r\n var context_1 = canvas.getContext(\"2d\");\r\n this._imageDataCache.data = imageData = context_1.getImageData(0, 0, width, height).data;\r\n this._imageDataCache.key = key;\r\n }\r\n x = (x - this._currentMeasure.left) | 0;\r\n y = (y - this._currentMeasure.top) | 0;\r\n var pickedPixel = imageData[(x + y * width) * 4 + 3];\r\n return pickedPixel > 0;\r\n };\r\n Image.prototype._getTypeName = function () {\r\n return \"Image\";\r\n };\r\n /** Force the control to synchronize with its content */\r\n Image.prototype.synchronizeSizeWithContent = function () {\r\n if (!this._loaded) {\r\n return;\r\n }\r\n this.width = this._domImage.width + \"px\";\r\n this.height = this._domImage.height + \"px\";\r\n };\r\n Image.prototype._processMeasures = function (parentMeasure, context) {\r\n if (this._loaded) {\r\n switch (this._stretch) {\r\n case Image.STRETCH_NONE:\r\n break;\r\n case Image.STRETCH_FILL:\r\n break;\r\n case Image.STRETCH_UNIFORM:\r\n break;\r\n case Image.STRETCH_NINE_PATCH:\r\n break;\r\n case Image.STRETCH_EXTEND:\r\n if (this._autoScale) {\r\n this.synchronizeSizeWithContent();\r\n }\r\n if (this.parent && this.parent.parent) { // Will update root size if root is not the top root\r\n this.parent.adaptWidthToChildren = true;\r\n this.parent.adaptHeightToChildren = true;\r\n }\r\n break;\r\n }\r\n }\r\n _super.prototype._processMeasures.call(this, parentMeasure, context);\r\n };\r\n Image.prototype._prepareWorkingCanvasForOpaqueDetection = function () {\r\n if (!this._detectPointerOnOpaqueOnly) {\r\n return;\r\n }\r\n if (!this._workingCanvas) {\r\n this._workingCanvas = document.createElement('canvas');\r\n }\r\n var canvas = this._workingCanvas;\r\n var width = this._currentMeasure.width;\r\n var height = this._currentMeasure.height;\r\n var context = canvas.getContext(\"2d\");\r\n canvas.width = width;\r\n canvas.height = height;\r\n context.clearRect(0, 0, width, height);\r\n };\r\n Image.prototype._drawImage = function (context, sx, sy, sw, sh, tx, ty, tw, th) {\r\n context.drawImage(this._domImage, sx, sy, sw, sh, tx, ty, tw, th);\r\n if (!this._detectPointerOnOpaqueOnly) {\r\n return;\r\n }\r\n var canvas = this._workingCanvas;\r\n context = canvas.getContext(\"2d\");\r\n context.drawImage(this._domImage, sx, sy, sw, sh, tx - this._currentMeasure.left, ty - this._currentMeasure.top, tw, th);\r\n };\r\n Image.prototype._draw = function (context) {\r\n context.save();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n var x, y, width, height;\r\n if (this.cellId == -1) {\r\n x = this._sourceLeft;\r\n y = this._sourceTop;\r\n width = this._sourceWidth ? this._sourceWidth : this._imageWidth;\r\n height = this._sourceHeight ? this._sourceHeight : this._imageHeight;\r\n }\r\n else {\r\n var rowCount = this._domImage.naturalWidth / this.cellWidth;\r\n var column = (this.cellId / rowCount) >> 0;\r\n var row = this.cellId % rowCount;\r\n x = this.cellWidth * row;\r\n y = this.cellHeight * column;\r\n width = this.cellWidth;\r\n height = this.cellHeight;\r\n }\r\n this._prepareWorkingCanvasForOpaqueDetection();\r\n this._applyStates(context);\r\n if (this._loaded) {\r\n switch (this._stretch) {\r\n case Image.STRETCH_NONE:\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n break;\r\n case Image.STRETCH_FILL:\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n break;\r\n case Image.STRETCH_UNIFORM:\r\n var hRatio = this._currentMeasure.width / width;\r\n var vRatio = this._currentMeasure.height / height;\r\n var ratio = Math.min(hRatio, vRatio);\r\n var centerX = (this._currentMeasure.width - width * ratio) / 2;\r\n var centerY = (this._currentMeasure.height - height * ratio) / 2;\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left + centerX, this._currentMeasure.top + centerY, width * ratio, height * ratio);\r\n break;\r\n case Image.STRETCH_EXTEND:\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n break;\r\n case Image.STRETCH_NINE_PATCH:\r\n this._renderNinePatch(context);\r\n break;\r\n }\r\n }\r\n context.restore();\r\n };\r\n Image.prototype._renderCornerPatch = function (context, x, y, width, height, targetX, targetY) {\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left + targetX, this._currentMeasure.top + targetY, width, height);\r\n };\r\n Image.prototype._renderNinePatch = function (context) {\r\n var height = this._imageHeight;\r\n var leftWidth = this._sliceLeft;\r\n var topHeight = this._sliceTop;\r\n var bottomHeight = this._imageHeight - this._sliceBottom;\r\n var rightWidth = this._imageWidth - this._sliceRight;\r\n var left = 0;\r\n var top = 0;\r\n if (this._populateNinePatchSlicesFromImage) {\r\n left = 1;\r\n top = 1;\r\n height -= 2;\r\n leftWidth -= 1;\r\n topHeight -= 1;\r\n bottomHeight -= 1;\r\n rightWidth -= 1;\r\n }\r\n var centerWidth = this._sliceRight - this._sliceLeft;\r\n var targetCenterWidth = this._currentMeasure.width - rightWidth - this.sliceLeft;\r\n var targetTopHeight = this._currentMeasure.height - height + this._sliceBottom;\r\n // Corners\r\n this._renderCornerPatch(context, left, top, leftWidth, topHeight, 0, 0);\r\n this._renderCornerPatch(context, left, this._sliceBottom, leftWidth, height - this._sliceBottom, 0, targetTopHeight);\r\n this._renderCornerPatch(context, this._sliceRight, top, rightWidth, topHeight, this._currentMeasure.width - rightWidth, 0);\r\n this._renderCornerPatch(context, this._sliceRight, this._sliceBottom, rightWidth, height - this._sliceBottom, this._currentMeasure.width - rightWidth, targetTopHeight);\r\n // Center\r\n this._drawImage(context, this._sliceLeft, this._sliceTop, centerWidth, this._sliceBottom - this._sliceTop, this._currentMeasure.left + leftWidth, this._currentMeasure.top + topHeight, targetCenterWidth, targetTopHeight - topHeight);\r\n // Borders\r\n this._drawImage(context, left, this._sliceTop, leftWidth, this._sliceBottom - this._sliceTop, this._currentMeasure.left, this._currentMeasure.top + topHeight, leftWidth, targetTopHeight - topHeight);\r\n this._drawImage(context, this._sliceRight, this._sliceTop, leftWidth, this._sliceBottom - this._sliceTop, this._currentMeasure.left + this._currentMeasure.width - rightWidth, this._currentMeasure.top + topHeight, leftWidth, targetTopHeight - topHeight);\r\n this._drawImage(context, this._sliceLeft, top, centerWidth, topHeight, this._currentMeasure.left + leftWidth, this._currentMeasure.top, targetCenterWidth, topHeight);\r\n this._drawImage(context, this._sliceLeft, this._sliceBottom, centerWidth, bottomHeight, this._currentMeasure.left + leftWidth, this._currentMeasure.top + targetTopHeight, targetCenterWidth, bottomHeight);\r\n };\r\n Image.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onImageLoadedObservable.clear();\r\n this.onSVGAttributesComputedObservable.clear();\r\n };\r\n // Static\r\n /** STRETCH_NONE */\r\n Image.STRETCH_NONE = 0;\r\n /** STRETCH_FILL */\r\n Image.STRETCH_FILL = 1;\r\n /** STRETCH_UNIFORM */\r\n Image.STRETCH_UNIFORM = 2;\r\n /** STRETCH_EXTEND */\r\n Image.STRETCH_EXTEND = 3;\r\n /** NINE_PATCH */\r\n Image.STRETCH_NINE_PATCH = 4;\r\n return Image;\r\n}(Control));\r\nexport { Image };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Image\"] = Image;\r\n//# sourceMappingURL=image.js.map","import { __extends } from \"tslib\";\r\nimport { Rectangle } from \"./rectangle\";\r\nimport { Control } from \"./control\";\r\nimport { TextBlock } from \"./textBlock\";\r\nimport { Image } from \"./image\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create 2D buttons\r\n */\r\nvar Button = /** @class */ (function (_super) {\r\n __extends(Button, _super);\r\n /**\r\n * Creates a new Button\r\n * @param name defines the name of the button\r\n */\r\n function Button(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n /**\r\n * Gets or sets a boolean indicating that the button will let internal controls handle picking instead of doing it directly using its bounding info\r\n */\r\n _this.delegatePickingToChildren = false;\r\n _this.thickness = 1;\r\n _this.isPointerBlocker = true;\r\n var alphaStore = null;\r\n _this.pointerEnterAnimation = function () {\r\n alphaStore = _this.alpha;\r\n _this.alpha -= 0.1;\r\n };\r\n _this.pointerOutAnimation = function () {\r\n if (alphaStore !== null) {\r\n _this.alpha = alphaStore;\r\n }\r\n };\r\n _this.pointerDownAnimation = function () {\r\n _this.scaleX -= 0.05;\r\n _this.scaleY -= 0.05;\r\n };\r\n _this.pointerUpAnimation = function () {\r\n _this.scaleX += 0.05;\r\n _this.scaleY += 0.05;\r\n };\r\n return _this;\r\n }\r\n Object.defineProperty(Button.prototype, \"image\", {\r\n /**\r\n * Returns the image part of the button (if any)\r\n */\r\n get: function () {\r\n return this._image;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Button.prototype, \"textBlock\", {\r\n /**\r\n * Returns the image part of the button (if any)\r\n */\r\n get: function () {\r\n return this._textBlock;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Button.prototype._getTypeName = function () {\r\n return \"Button\";\r\n };\r\n // While being a container, the button behaves like a control.\r\n /** @hidden */\r\n Button.prototype._processPicking = function (x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY) {\r\n if (!this._isEnabled || !this.isHitTestVisible || !this.isVisible || this.notRenderable) {\r\n return false;\r\n }\r\n if (!_super.prototype.contains.call(this, x, y)) {\r\n return false;\r\n }\r\n if (this.delegatePickingToChildren) {\r\n var contains = false;\r\n for (var index = this._children.length - 1; index >= 0; index--) {\r\n var child = this._children[index];\r\n if (child.isEnabled && child.isHitTestVisible && child.isVisible && !child.notRenderable && child.contains(x, y)) {\r\n contains = true;\r\n break;\r\n }\r\n }\r\n if (!contains) {\r\n return false;\r\n }\r\n }\r\n this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);\r\n return true;\r\n };\r\n /** @hidden */\r\n Button.prototype._onPointerEnter = function (target, pi) {\r\n if (!_super.prototype._onPointerEnter.call(this, target, pi)) {\r\n return false;\r\n }\r\n if (this.pointerEnterAnimation) {\r\n this.pointerEnterAnimation();\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n Button.prototype._onPointerOut = function (target, pi, force) {\r\n if (force === void 0) { force = false; }\r\n if (this.pointerOutAnimation) {\r\n this.pointerOutAnimation();\r\n }\r\n _super.prototype._onPointerOut.call(this, target, pi, force);\r\n };\r\n /** @hidden */\r\n Button.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n if (!_super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n if (this.pointerDownAnimation) {\r\n this.pointerDownAnimation();\r\n }\r\n return true;\r\n };\r\n /** @hidden */\r\n Button.prototype._onPointerUp = function (target, coordinates, pointerId, buttonIndex, notifyClick, pi) {\r\n if (this.pointerUpAnimation) {\r\n this.pointerUpAnimation();\r\n }\r\n _super.prototype._onPointerUp.call(this, target, coordinates, pointerId, buttonIndex, notifyClick, pi);\r\n };\r\n // Statics\r\n /**\r\n * Creates a new button made with an image and a text\r\n * @param name defines the name of the button\r\n * @param text defines the text of the button\r\n * @param imageUrl defines the url of the image\r\n * @returns a new Button\r\n */\r\n Button.CreateImageButton = function (name, text, imageUrl) {\r\n var result = new Button(name);\r\n // Adding text\r\n var textBlock = new TextBlock(name + \"_button\", text);\r\n textBlock.textWrapping = true;\r\n textBlock.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n textBlock.paddingLeft = \"20%\";\r\n result.addControl(textBlock);\r\n // Adding image\r\n var iconImage = new Image(name + \"_icon\", imageUrl);\r\n iconImage.width = \"20%\";\r\n iconImage.stretch = Image.STRETCH_UNIFORM;\r\n iconImage.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n result.addControl(iconImage);\r\n // Store\r\n result._image = iconImage;\r\n result._textBlock = textBlock;\r\n return result;\r\n };\r\n /**\r\n * Creates a new button made with an image\r\n * @param name defines the name of the button\r\n * @param imageUrl defines the url of the image\r\n * @returns a new Button\r\n */\r\n Button.CreateImageOnlyButton = function (name, imageUrl) {\r\n var result = new Button(name);\r\n // Adding image\r\n var iconImage = new Image(name + \"_icon\", imageUrl);\r\n iconImage.stretch = Image.STRETCH_FILL;\r\n iconImage.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n result.addControl(iconImage);\r\n // Store\r\n result._image = iconImage;\r\n return result;\r\n };\r\n /**\r\n * Creates a new button made with a text\r\n * @param name defines the name of the button\r\n * @param text defines the text of the button\r\n * @returns a new Button\r\n */\r\n Button.CreateSimpleButton = function (name, text) {\r\n var result = new Button(name);\r\n // Adding text\r\n var textBlock = new TextBlock(name + \"_button\", text);\r\n textBlock.textWrapping = true;\r\n textBlock.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n result.addControl(textBlock);\r\n // Store\r\n result._textBlock = textBlock;\r\n return result;\r\n };\r\n /**\r\n * Creates a new button made with an image and a centered text\r\n * @param name defines the name of the button\r\n * @param text defines the text of the button\r\n * @param imageUrl defines the url of the image\r\n * @returns a new Button\r\n */\r\n Button.CreateImageWithCenterTextButton = function (name, text, imageUrl) {\r\n var result = new Button(name);\r\n // Adding image\r\n var iconImage = new Image(name + \"_icon\", imageUrl);\r\n iconImage.stretch = Image.STRETCH_FILL;\r\n result.addControl(iconImage);\r\n // Adding text\r\n var textBlock = new TextBlock(name + \"_button\", text);\r\n textBlock.textWrapping = true;\r\n textBlock.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n result.addControl(textBlock);\r\n // Store\r\n result._image = iconImage;\r\n result._textBlock = textBlock;\r\n return result;\r\n };\r\n return Button;\r\n}(Rectangle));\r\nexport { Button };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Button\"] = Button;\r\n//# sourceMappingURL=button.js.map","import { __extends } from \"tslib\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Container } from \"./container\";\r\nimport { Control } from \"./control\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create a 2D stack panel container\r\n */\r\nvar StackPanel = /** @class */ (function (_super) {\r\n __extends(StackPanel, _super);\r\n /**\r\n * Creates a new StackPanel\r\n * @param name defines control name\r\n */\r\n function StackPanel(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._isVertical = true;\r\n _this._manualWidth = false;\r\n _this._manualHeight = false;\r\n _this._doNotTrackManualChanges = false;\r\n /**\r\n * Gets or sets a boolean indicating that layou warnings should be ignored\r\n */\r\n _this.ignoreLayoutWarnings = false;\r\n return _this;\r\n }\r\n Object.defineProperty(StackPanel.prototype, \"isVertical\", {\r\n /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/\r\n get: function () {\r\n return this._isVertical;\r\n },\r\n set: function (value) {\r\n if (this._isVertical === value) {\r\n return;\r\n }\r\n this._isVertical = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StackPanel.prototype, \"width\", {\r\n get: function () {\r\n return this._width.toString(this._host);\r\n },\r\n /**\r\n * Gets or sets panel width.\r\n * This value should not be set when in horizontal mode as it will be computed automatically\r\n */\r\n set: function (value) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualWidth = true;\r\n }\r\n if (this._width.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._width.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(StackPanel.prototype, \"height\", {\r\n get: function () {\r\n return this._height.toString(this._host);\r\n },\r\n /**\r\n * Gets or sets panel height.\r\n * This value should not be set when in vertical mode as it will be computed automatically\r\n */\r\n set: function (value) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualHeight = true;\r\n }\r\n if (this._height.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._height.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n StackPanel.prototype._getTypeName = function () {\r\n return \"StackPanel\";\r\n };\r\n /** @hidden */\r\n StackPanel.prototype._preMeasure = function (parentMeasure, context) {\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (this._isVertical) {\r\n child.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n }\r\n else {\r\n child.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n }\r\n }\r\n _super.prototype._preMeasure.call(this, parentMeasure, context);\r\n };\r\n StackPanel.prototype._additionalProcessing = function (parentMeasure, context) {\r\n _super.prototype._additionalProcessing.call(this, parentMeasure, context);\r\n this._measureForChildren.copyFrom(parentMeasure);\r\n this._measureForChildren.left = this._currentMeasure.left;\r\n this._measureForChildren.top = this._currentMeasure.top;\r\n if (!this.isVertical || this._manualWidth) {\r\n this._measureForChildren.width = this._currentMeasure.width;\r\n }\r\n if (this.isVertical || this._manualHeight) {\r\n this._measureForChildren.height = this._currentMeasure.height;\r\n }\r\n };\r\n StackPanel.prototype._postMeasure = function () {\r\n var stackWidth = 0;\r\n var stackHeight = 0;\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (!child.isVisible || child.notRenderable) {\r\n continue;\r\n }\r\n if (this._isVertical) {\r\n if (child.top !== stackHeight + \"px\") {\r\n child.top = stackHeight + \"px\";\r\n this._rebuildLayout = true;\r\n child._top.ignoreAdaptiveScaling = true;\r\n }\r\n if (child._height.isPercentage && !child._automaticSize) {\r\n if (!this.ignoreLayoutWarnings) {\r\n Tools.Warn(\"Control (Name:\" + child.name + \", UniqueId:\" + child.uniqueId + \") is using height in percentage mode inside a vertical StackPanel\");\r\n }\r\n }\r\n else {\r\n stackHeight += child._currentMeasure.height + child.paddingTopInPixels + child.paddingBottomInPixels;\r\n }\r\n }\r\n else {\r\n if (child.left !== stackWidth + \"px\") {\r\n child.left = stackWidth + \"px\";\r\n this._rebuildLayout = true;\r\n child._left.ignoreAdaptiveScaling = true;\r\n }\r\n if (child._width.isPercentage && !child._automaticSize) {\r\n if (!this.ignoreLayoutWarnings) {\r\n Tools.Warn(\"Control (Name:\" + child.name + \", UniqueId:\" + child.uniqueId + \") is using width in percentage mode inside a horizontal StackPanel\");\r\n }\r\n }\r\n else {\r\n stackWidth += child._currentMeasure.width + child.paddingLeftInPixels + child.paddingRightInPixels;\r\n }\r\n }\r\n }\r\n stackWidth += this.paddingLeftInPixels + this.paddingRightInPixels;\r\n stackHeight += this.paddingTopInPixels + this.paddingBottomInPixels;\r\n this._doNotTrackManualChanges = true;\r\n // Let stack panel width or height default to stackHeight and stackWidth if dimensions are not specified.\r\n // User can now define their own height and width for stack panel.\r\n var panelWidthChanged = false;\r\n var panelHeightChanged = false;\r\n if (!this._manualHeight && this._isVertical) { // do not specify height if strictly defined by user\r\n var previousHeight = this.height;\r\n this.height = stackHeight + \"px\";\r\n panelHeightChanged = previousHeight !== this.height || !this._height.ignoreAdaptiveScaling;\r\n }\r\n if (!this._manualWidth && !this._isVertical) { // do not specify width if strictly defined by user\r\n var previousWidth = this.width;\r\n this.width = stackWidth + \"px\";\r\n panelWidthChanged = previousWidth !== this.width || !this._width.ignoreAdaptiveScaling;\r\n }\r\n if (panelHeightChanged) {\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n if (panelWidthChanged) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n }\r\n this._doNotTrackManualChanges = false;\r\n if (panelWidthChanged || panelHeightChanged) {\r\n this._rebuildLayout = true;\r\n }\r\n _super.prototype._postMeasure.call(this);\r\n };\r\n return StackPanel;\r\n}(Container));\r\nexport { StackPanel };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.StackPanel\"] = StackPanel;\r\n//# sourceMappingURL=stackPanel.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Control } from \"./control\";\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { TextBlock } from \"./textBlock\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to represent a 2D checkbox\r\n */\r\nvar Checkbox = /** @class */ (function (_super) {\r\n __extends(Checkbox, _super);\r\n /**\r\n * Creates a new CheckBox\r\n * @param name defines the control name\r\n */\r\n function Checkbox(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._isChecked = false;\r\n _this._background = \"black\";\r\n _this._checkSizeRatio = 0.8;\r\n _this._thickness = 1;\r\n /**\r\n * Observable raised when isChecked property changes\r\n */\r\n _this.onIsCheckedChangedObservable = new Observable();\r\n _this.isPointerBlocker = true;\r\n return _this;\r\n }\r\n Object.defineProperty(Checkbox.prototype, \"thickness\", {\r\n /** Gets or sets border thickness */\r\n get: function () {\r\n return this._thickness;\r\n },\r\n set: function (value) {\r\n if (this._thickness === value) {\r\n return;\r\n }\r\n this._thickness = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Checkbox.prototype, \"checkSizeRatio\", {\r\n /** Gets or sets a value indicating the ratio between overall size and check size */\r\n get: function () {\r\n return this._checkSizeRatio;\r\n },\r\n set: function (value) {\r\n value = Math.max(Math.min(1, value), 0);\r\n if (this._checkSizeRatio === value) {\r\n return;\r\n }\r\n this._checkSizeRatio = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Checkbox.prototype, \"background\", {\r\n /** Gets or sets background color */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Checkbox.prototype, \"isChecked\", {\r\n /** Gets or sets a boolean indicating if the checkbox is checked or not */\r\n get: function () {\r\n return this._isChecked;\r\n },\r\n set: function (value) {\r\n if (this._isChecked === value) {\r\n return;\r\n }\r\n this._isChecked = value;\r\n this._markAsDirty();\r\n this.onIsCheckedChangedObservable.notifyObservers(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Checkbox.prototype._getTypeName = function () {\r\n return \"Checkbox\";\r\n };\r\n /** @hidden */\r\n Checkbox.prototype._draw = function (context, invalidatedRectangle) {\r\n context.save();\r\n this._applyStates(context);\r\n var actualWidth = this._currentMeasure.width - this._thickness;\r\n var actualHeight = this._currentMeasure.height - this._thickness;\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n context.fillStyle = this._isEnabled ? this._background : this._disabledColor;\r\n context.fillRect(this._currentMeasure.left + this._thickness / 2, this._currentMeasure.top + this._thickness / 2, actualWidth, actualHeight);\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n if (this._isChecked) {\r\n context.fillStyle = this._isEnabled ? this.color : this._disabledColorItem;\r\n var offsetWidth = actualWidth * this._checkSizeRatio;\r\n var offseHeight = actualHeight * this._checkSizeRatio;\r\n context.fillRect(this._currentMeasure.left + this._thickness / 2 + (actualWidth - offsetWidth) / 2, this._currentMeasure.top + this._thickness / 2 + (actualHeight - offseHeight) / 2, offsetWidth, offseHeight);\r\n }\r\n context.strokeStyle = this.color;\r\n context.lineWidth = this._thickness;\r\n context.strokeRect(this._currentMeasure.left + this._thickness / 2, this._currentMeasure.top + this._thickness / 2, actualWidth, actualHeight);\r\n context.restore();\r\n };\r\n // Events\r\n /** @hidden */\r\n Checkbox.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n if (!_super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n this.isChecked = !this.isChecked;\r\n return true;\r\n };\r\n /**\r\n * Utility function to easily create a checkbox with a header\r\n * @param title defines the label to use for the header\r\n * @param onValueChanged defines the callback to call when value changes\r\n * @returns a StackPanel containing the checkbox and a textBlock\r\n */\r\n Checkbox.AddCheckBoxWithHeader = function (title, onValueChanged) {\r\n var panel = new StackPanel();\r\n panel.isVertical = false;\r\n panel.height = \"30px\";\r\n var checkbox = new Checkbox();\r\n checkbox.width = \"20px\";\r\n checkbox.height = \"20px\";\r\n checkbox.isChecked = true;\r\n checkbox.color = \"green\";\r\n checkbox.onIsCheckedChangedObservable.add(onValueChanged);\r\n panel.addControl(checkbox);\r\n var header = new TextBlock();\r\n header.text = title;\r\n header.width = \"180px\";\r\n header.paddingLeft = \"5px\";\r\n header.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n header.color = \"white\";\r\n panel.addControl(header);\r\n return panel;\r\n };\r\n return Checkbox;\r\n}(Control));\r\nexport { Checkbox };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Checkbox\"] = Checkbox;\r\n//# sourceMappingURL=checkbox.js.map","import { __spreadArrays } from \"tslib\";\r\n/** @hidden */\r\nvar TextWrapper = /** @class */ (function () {\r\n function TextWrapper() {\r\n }\r\n Object.defineProperty(TextWrapper.prototype, \"text\", {\r\n get: function () {\r\n return this._characters ? this._characters.join(\"\") : this._text;\r\n },\r\n set: function (txt) {\r\n this._text = txt;\r\n this._characters = Array.from && Array.from(txt);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TextWrapper.prototype, \"length\", {\r\n get: function () {\r\n return this._characters ? this._characters.length : this._text.length;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n TextWrapper.prototype.removePart = function (idxStart, idxEnd, insertTxt) {\r\n var _a;\r\n this._text = this._text.slice(0, idxStart) + (insertTxt ? insertTxt : \"\") + this._text.slice(idxEnd);\r\n if (this._characters) {\r\n var newCharacters = insertTxt ? Array.from(insertTxt) : [];\r\n (_a = this._characters).splice.apply(_a, __spreadArrays([idxStart, idxEnd - idxStart], newCharacters));\r\n }\r\n };\r\n TextWrapper.prototype.charAt = function (idx) {\r\n return this._characters ? this._characters[idx] : this._text.charAt(idx);\r\n };\r\n TextWrapper.prototype.substr = function (from, length) {\r\n if (this._characters) {\r\n if (isNaN(from)) {\r\n from = 0;\r\n }\r\n else if (from >= 0) {\r\n from = Math.min(from, this._characters.length);\r\n }\r\n else {\r\n from = this._characters.length + Math.max(from, -this._characters.length);\r\n }\r\n if (length === undefined) {\r\n length = this._characters.length - from;\r\n }\r\n else if (isNaN(length)) {\r\n length = 0;\r\n }\r\n else if (length < 0) {\r\n length = 0;\r\n }\r\n var temp = [];\r\n while (--length >= 0) {\r\n temp[length] = this._characters[from + length];\r\n }\r\n return temp.join(\"\");\r\n }\r\n return this._text.substr(from, length);\r\n };\r\n TextWrapper.prototype.substring = function (from, to) {\r\n if (this._characters) {\r\n if (isNaN(from)) {\r\n from = 0;\r\n }\r\n else if (from > this._characters.length) {\r\n from = this._characters.length;\r\n }\r\n else if (from < 0) {\r\n from = 0;\r\n }\r\n if (to === undefined) {\r\n to = this._characters.length;\r\n }\r\n else if (isNaN(to)) {\r\n to = 0;\r\n }\r\n else if (to > this._characters.length) {\r\n to = this._characters.length;\r\n }\r\n else if (to < 0) {\r\n to = 0;\r\n }\r\n var temp = [];\r\n var idx = 0;\r\n while (from < to) {\r\n temp[idx++] = this._characters[from++];\r\n }\r\n return temp.join(\"\");\r\n }\r\n return this._text.substring(from, to);\r\n };\r\n TextWrapper.prototype.isWord = function (index) {\r\n var rWord = /\\w/g;\r\n return this._characters ? this._characters[index].search(rWord) !== -1 : this._text.search(rWord) !== -1;\r\n };\r\n return TextWrapper;\r\n}());\r\nexport { TextWrapper };\r\n//# sourceMappingURL=textWrapper.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { ClipboardEventTypes } from \"@babylonjs/core/Events/clipboardEvents\";\r\nimport { PointerEventTypes } from '@babylonjs/core/Events/pointerEvents';\r\nimport { Control } from \"./control\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\nimport { TextWrapper } from './textWrapper';\r\n/**\r\n * Class used to create input text control\r\n */\r\nvar InputText = /** @class */ (function (_super) {\r\n __extends(InputText, _super);\r\n /**\r\n * Creates a new InputText\r\n * @param name defines the control name\r\n * @param text defines the text of the control\r\n */\r\n function InputText(name, text) {\r\n if (text === void 0) { text = \"\"; }\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._placeholderText = \"\";\r\n _this._background = \"#222222\";\r\n _this._focusedBackground = \"#000000\";\r\n _this._focusedColor = \"white\";\r\n _this._placeholderColor = \"gray\";\r\n _this._thickness = 1;\r\n _this._margin = new ValueAndUnit(10, ValueAndUnit.UNITMODE_PIXEL);\r\n _this._autoStretchWidth = true;\r\n _this._maxWidth = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);\r\n _this._isFocused = false;\r\n _this._blinkIsEven = false;\r\n _this._cursorOffset = 0;\r\n _this._deadKey = false;\r\n _this._addKey = true;\r\n _this._currentKey = \"\";\r\n _this._isTextHighlightOn = false;\r\n _this._textHighlightColor = \"#d5e0ff\";\r\n _this._highligherOpacity = 0.4;\r\n _this._highlightedText = \"\";\r\n _this._startHighlightIndex = 0;\r\n _this._endHighlightIndex = 0;\r\n _this._cursorIndex = -1;\r\n _this._onFocusSelectAll = false;\r\n _this._isPointerDown = false;\r\n /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */\r\n _this.promptMessage = \"Please enter text:\";\r\n /** Force disable prompt on mobile device */\r\n _this.disableMobilePrompt = false;\r\n /** Observable raised when the text changes */\r\n _this.onTextChangedObservable = new Observable();\r\n /** Observable raised just before an entered character is to be added */\r\n _this.onBeforeKeyAddObservable = new Observable();\r\n /** Observable raised when the control gets the focus */\r\n _this.onFocusObservable = new Observable();\r\n /** Observable raised when the control loses the focus */\r\n _this.onBlurObservable = new Observable();\r\n /**Observable raised when the text is highlighted */\r\n _this.onTextHighlightObservable = new Observable();\r\n /**Observable raised when copy event is triggered */\r\n _this.onTextCopyObservable = new Observable();\r\n /** Observable raised when cut event is triggered */\r\n _this.onTextCutObservable = new Observable();\r\n /** Observable raised when paste event is triggered */\r\n _this.onTextPasteObservable = new Observable();\r\n /** Observable raised when a key event was processed */\r\n _this.onKeyboardEventProcessedObservable = new Observable();\r\n _this.text = text;\r\n _this.isPointerBlocker = true;\r\n return _this;\r\n }\r\n Object.defineProperty(InputText.prototype, \"maxWidth\", {\r\n /** Gets or sets the maximum width allowed by the control */\r\n get: function () {\r\n return this._maxWidth.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._maxWidth.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._maxWidth.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"maxWidthInPixels\", {\r\n /** Gets the maximum width allowed by the control in pixels */\r\n get: function () {\r\n return this._maxWidth.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"highligherOpacity\", {\r\n /** Gets or sets the text highlighter transparency; default: 0.4 */\r\n get: function () {\r\n return this._highligherOpacity;\r\n },\r\n set: function (value) {\r\n if (this._highligherOpacity === value) {\r\n return;\r\n }\r\n this._highligherOpacity = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"onFocusSelectAll\", {\r\n /** Gets or sets a boolean indicating whether to select complete text by default on input focus */\r\n get: function () {\r\n return this._onFocusSelectAll;\r\n },\r\n set: function (value) {\r\n if (this._onFocusSelectAll === value) {\r\n return;\r\n }\r\n this._onFocusSelectAll = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"textHighlightColor\", {\r\n /** Gets or sets the text hightlight color */\r\n get: function () {\r\n return this._textHighlightColor;\r\n },\r\n set: function (value) {\r\n if (this._textHighlightColor === value) {\r\n return;\r\n }\r\n this._textHighlightColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"margin\", {\r\n /** Gets or sets control margin */\r\n get: function () {\r\n return this._margin.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._margin.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._margin.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"marginInPixels\", {\r\n /** Gets control margin in pixels */\r\n get: function () {\r\n return this._margin.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"autoStretchWidth\", {\r\n /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */\r\n get: function () {\r\n return this._autoStretchWidth;\r\n },\r\n set: function (value) {\r\n if (this._autoStretchWidth === value) {\r\n return;\r\n }\r\n this._autoStretchWidth = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"thickness\", {\r\n /** Gets or sets border thickness */\r\n get: function () {\r\n return this._thickness;\r\n },\r\n set: function (value) {\r\n if (this._thickness === value) {\r\n return;\r\n }\r\n this._thickness = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"focusedBackground\", {\r\n /** Gets or sets the background color when focused */\r\n get: function () {\r\n return this._focusedBackground;\r\n },\r\n set: function (value) {\r\n if (this._focusedBackground === value) {\r\n return;\r\n }\r\n this._focusedBackground = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"focusedColor\", {\r\n /** Gets or sets the background color when focused */\r\n get: function () {\r\n return this._focusedColor;\r\n },\r\n set: function (value) {\r\n if (this._focusedColor === value) {\r\n return;\r\n }\r\n this._focusedColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"background\", {\r\n /** Gets or sets the background color */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"placeholderColor\", {\r\n /** Gets or sets the placeholder color */\r\n get: function () {\r\n return this._placeholderColor;\r\n },\r\n set: function (value) {\r\n if (this._placeholderColor === value) {\r\n return;\r\n }\r\n this._placeholderColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"placeholderText\", {\r\n /** Gets or sets the text displayed when the control is empty */\r\n get: function () {\r\n return this._placeholderText;\r\n },\r\n set: function (value) {\r\n if (this._placeholderText === value) {\r\n return;\r\n }\r\n this._placeholderText = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"deadKey\", {\r\n /** Gets or sets the dead key flag */\r\n get: function () {\r\n return this._deadKey;\r\n },\r\n set: function (flag) {\r\n this._deadKey = flag;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"highlightedText\", {\r\n /** Gets or sets the highlight text */\r\n get: function () {\r\n return this._highlightedText;\r\n },\r\n set: function (text) {\r\n if (this._highlightedText === text) {\r\n return;\r\n }\r\n this._highlightedText = text;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"addKey\", {\r\n /** Gets or sets if the current key should be added */\r\n get: function () {\r\n return this._addKey;\r\n },\r\n set: function (flag) {\r\n this._addKey = flag;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"currentKey\", {\r\n /** Gets or sets the value of the current key being entered */\r\n get: function () {\r\n return this._currentKey;\r\n },\r\n set: function (key) {\r\n this._currentKey = key;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(InputText.prototype, \"text\", {\r\n /** Gets or sets the text displayed in the control */\r\n get: function () {\r\n return this._textWrapper.text;\r\n },\r\n set: function (value) {\r\n var valueAsString = value.toString(); // Forcing convertion\r\n if (!this._textWrapper) {\r\n this._textWrapper = new TextWrapper();\r\n }\r\n if (this._textWrapper.text === valueAsString) {\r\n return;\r\n }\r\n this._textWrapper.text = valueAsString;\r\n this._textHasChanged();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n InputText.prototype._textHasChanged = function () {\r\n this._markAsDirty();\r\n this.onTextChangedObservable.notifyObservers(this);\r\n };\r\n Object.defineProperty(InputText.prototype, \"width\", {\r\n /** Gets or sets control width */\r\n get: function () {\r\n return this._width.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._width.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._width.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n this.autoStretchWidth = false;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n InputText.prototype.onBlur = function () {\r\n this._isFocused = false;\r\n this._scrollLeft = null;\r\n this._cursorOffset = 0;\r\n clearTimeout(this._blinkTimeout);\r\n this._markAsDirty();\r\n this.onBlurObservable.notifyObservers(this);\r\n this._host.unRegisterClipboardEvents();\r\n if (this._onClipboardObserver) {\r\n this._host.onClipboardObservable.remove(this._onClipboardObserver);\r\n }\r\n var scene = this._host.getScene();\r\n if (this._onPointerDblTapObserver && scene) {\r\n scene.onPointerObservable.remove(this._onPointerDblTapObserver);\r\n }\r\n };\r\n /** @hidden */\r\n InputText.prototype.onFocus = function () {\r\n var _this = this;\r\n if (!this._isEnabled) {\r\n return;\r\n }\r\n this._scrollLeft = null;\r\n this._isFocused = true;\r\n this._blinkIsEven = false;\r\n this._cursorOffset = 0;\r\n this._markAsDirty();\r\n this.onFocusObservable.notifyObservers(this);\r\n if (navigator.userAgent.indexOf(\"Mobile\") !== -1 && !this.disableMobilePrompt) {\r\n var value = prompt(this.promptMessage);\r\n if (value !== null) {\r\n this.text = value;\r\n }\r\n this._host.focusedControl = null;\r\n return;\r\n }\r\n this._host.registerClipboardEvents();\r\n this._onClipboardObserver = this._host.onClipboardObservable.add(function (clipboardInfo) {\r\n // process clipboard event, can be configured.\r\n switch (clipboardInfo.type) {\r\n case ClipboardEventTypes.COPY:\r\n _this._onCopyText(clipboardInfo.event);\r\n _this.onTextCopyObservable.notifyObservers(_this);\r\n break;\r\n case ClipboardEventTypes.CUT:\r\n _this._onCutText(clipboardInfo.event);\r\n _this.onTextCutObservable.notifyObservers(_this);\r\n break;\r\n case ClipboardEventTypes.PASTE:\r\n _this._onPasteText(clipboardInfo.event);\r\n _this.onTextPasteObservable.notifyObservers(_this);\r\n break;\r\n default: return;\r\n }\r\n });\r\n var scene = this._host.getScene();\r\n if (scene) {\r\n //register the pointer double tap event\r\n this._onPointerDblTapObserver = scene.onPointerObservable.add(function (pointerInfo) {\r\n if (!_this._isFocused) {\r\n return;\r\n }\r\n if (pointerInfo.type === PointerEventTypes.POINTERDOUBLETAP) {\r\n _this._processDblClick(pointerInfo);\r\n }\r\n });\r\n }\r\n if (this._onFocusSelectAll) {\r\n this._selectAllText();\r\n }\r\n };\r\n InputText.prototype._getTypeName = function () {\r\n return \"InputText\";\r\n };\r\n /**\r\n * Function called to get the list of controls that should not steal the focus from this control\r\n * @returns an array of controls\r\n */\r\n InputText.prototype.keepsFocusWith = function () {\r\n if (!this._connectedVirtualKeyboard) {\r\n return null;\r\n }\r\n return [this._connectedVirtualKeyboard];\r\n };\r\n /** @hidden */\r\n InputText.prototype.processKey = function (keyCode, key, evt) {\r\n //return if clipboard event keys (i.e -ctr/cmd + c,v,x)\r\n if (evt && (evt.ctrlKey || evt.metaKey) && (keyCode === 67 || keyCode === 86 || keyCode === 88)) {\r\n return;\r\n }\r\n //select all\r\n if (evt && (evt.ctrlKey || evt.metaKey) && keyCode === 65) {\r\n this._selectAllText();\r\n evt.preventDefault();\r\n return;\r\n }\r\n // Specific cases\r\n switch (keyCode) {\r\n case 32: //SPACE\r\n key = \" \"; //ie11 key for space is \"Spacebar\"\r\n break;\r\n case 191: //SLASH\r\n if (evt) {\r\n evt.preventDefault();\r\n }\r\n break;\r\n case 8: // BACKSPACE\r\n if (this._textWrapper.text && this._textWrapper.length > 0) {\r\n //delete the highlighted text\r\n if (this._isTextHighlightOn) {\r\n this._textWrapper.removePart(this._startHighlightIndex, this._endHighlightIndex);\r\n this._textHasChanged();\r\n this._isTextHighlightOn = false;\r\n this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;\r\n this._blinkIsEven = false;\r\n if (evt) {\r\n evt.preventDefault();\r\n }\r\n return;\r\n }\r\n //delete single character\r\n if (this._cursorOffset === 0) {\r\n this.text = this._textWrapper.substr(0, this._textWrapper.length - 1);\r\n }\r\n else {\r\n var deletePosition = this._textWrapper.length - this._cursorOffset;\r\n if (deletePosition > 0) {\r\n this._textWrapper.removePart(deletePosition - 1, deletePosition);\r\n this._textHasChanged();\r\n }\r\n }\r\n }\r\n if (evt) {\r\n evt.preventDefault();\r\n }\r\n return;\r\n case 46: // DELETE\r\n if (this._isTextHighlightOn) {\r\n this._textWrapper.removePart(this._startHighlightIndex, this._endHighlightIndex);\r\n this._textHasChanged();\r\n this._isTextHighlightOn = false;\r\n this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;\r\n if (evt) {\r\n evt.preventDefault();\r\n }\r\n return;\r\n }\r\n if (this._textWrapper.text && this._textWrapper.length > 0 && this._cursorOffset > 0) {\r\n var deletePosition = this._textWrapper.length - this._cursorOffset;\r\n this._textWrapper.removePart(deletePosition, deletePosition + 1);\r\n this._textHasChanged();\r\n this._cursorOffset--;\r\n }\r\n if (evt) {\r\n evt.preventDefault();\r\n }\r\n return;\r\n case 13: // RETURN\r\n this._host.focusedControl = null;\r\n this._isTextHighlightOn = false;\r\n return;\r\n case 35: // END\r\n this._cursorOffset = 0;\r\n this._blinkIsEven = false;\r\n this._isTextHighlightOn = false;\r\n this._markAsDirty();\r\n return;\r\n case 36: // HOME\r\n this._cursorOffset = this._textWrapper.length;\r\n this._blinkIsEven = false;\r\n this._isTextHighlightOn = false;\r\n this._markAsDirty();\r\n return;\r\n case 37: // LEFT\r\n this._cursorOffset++;\r\n if (this._cursorOffset > this._textWrapper.length) {\r\n this._cursorOffset = this._textWrapper.length;\r\n }\r\n if (evt && evt.shiftKey) {\r\n // update the cursor\r\n this._blinkIsEven = false;\r\n // shift + ctrl/cmd + <-\r\n if (evt.ctrlKey || evt.metaKey) {\r\n if (!this._isTextHighlightOn) {\r\n if (this._textWrapper.length === this._cursorOffset) {\r\n return;\r\n }\r\n else {\r\n this._endHighlightIndex = this._textWrapper.length - this._cursorOffset + 1;\r\n }\r\n }\r\n this._startHighlightIndex = 0;\r\n this._cursorIndex = this._textWrapper.length - this._endHighlightIndex;\r\n this._cursorOffset = this._textWrapper.length;\r\n this._isTextHighlightOn = true;\r\n this._markAsDirty();\r\n return;\r\n }\r\n //store the starting point\r\n if (!this._isTextHighlightOn) {\r\n this._isTextHighlightOn = true;\r\n this._cursorIndex = (this._cursorOffset >= this._textWrapper.length) ? this._textWrapper.length : this._cursorOffset - 1;\r\n }\r\n //if text is already highlighted\r\n else if (this._cursorIndex === -1) {\r\n this._cursorIndex = this._textWrapper.length - this._endHighlightIndex;\r\n this._cursorOffset = (this._startHighlightIndex === 0) ? this._textWrapper.length : this._textWrapper.length - this._startHighlightIndex + 1;\r\n }\r\n //set the highlight indexes\r\n if (this._cursorIndex < this._cursorOffset) {\r\n this._endHighlightIndex = this._textWrapper.length - this._cursorIndex;\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorOffset;\r\n }\r\n else if (this._cursorIndex > this._cursorOffset) {\r\n this._endHighlightIndex = this._textWrapper.length - this._cursorOffset;\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorIndex;\r\n }\r\n else {\r\n this._isTextHighlightOn = false;\r\n }\r\n this._markAsDirty();\r\n return;\r\n }\r\n if (this._isTextHighlightOn) {\r\n this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;\r\n this._isTextHighlightOn = false;\r\n }\r\n if (evt && (evt.ctrlKey || evt.metaKey)) {\r\n this._cursorOffset = this._textWrapper.length;\r\n evt.preventDefault();\r\n }\r\n this._blinkIsEven = false;\r\n this._isTextHighlightOn = false;\r\n this._cursorIndex = -1;\r\n this._markAsDirty();\r\n return;\r\n case 39: // RIGHT\r\n this._cursorOffset--;\r\n if (this._cursorOffset < 0) {\r\n this._cursorOffset = 0;\r\n }\r\n if (evt && evt.shiftKey) {\r\n //update the cursor\r\n this._blinkIsEven = false;\r\n //shift + ctrl/cmd + ->\r\n if (evt.ctrlKey || evt.metaKey) {\r\n if (!this._isTextHighlightOn) {\r\n if (this._cursorOffset === 0) {\r\n return;\r\n }\r\n else {\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorOffset - 1;\r\n }\r\n }\r\n this._endHighlightIndex = this._textWrapper.length;\r\n this._isTextHighlightOn = true;\r\n this._cursorIndex = this._textWrapper.length - this._startHighlightIndex;\r\n this._cursorOffset = 0;\r\n this._markAsDirty();\r\n return;\r\n }\r\n if (!this._isTextHighlightOn) {\r\n this._isTextHighlightOn = true;\r\n this._cursorIndex = (this._cursorOffset <= 0) ? 0 : this._cursorOffset + 1;\r\n }\r\n //if text is already highlighted\r\n else if (this._cursorIndex === -1) {\r\n this._cursorIndex = this._textWrapper.length - this._startHighlightIndex;\r\n this._cursorOffset = (this._textWrapper.length === this._endHighlightIndex) ? 0 : this._textWrapper.length - this._endHighlightIndex - 1;\r\n }\r\n //set the highlight indexes\r\n if (this._cursorIndex < this._cursorOffset) {\r\n this._endHighlightIndex = this._textWrapper.length - this._cursorIndex;\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorOffset;\r\n }\r\n else if (this._cursorIndex > this._cursorOffset) {\r\n this._endHighlightIndex = this._textWrapper.length - this._cursorOffset;\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorIndex;\r\n }\r\n else {\r\n this._isTextHighlightOn = false;\r\n }\r\n this._markAsDirty();\r\n return;\r\n }\r\n if (this._isTextHighlightOn) {\r\n this._cursorOffset = this._textWrapper.length - this._endHighlightIndex;\r\n this._isTextHighlightOn = false;\r\n }\r\n //ctr + ->\r\n if (evt && (evt.ctrlKey || evt.metaKey)) {\r\n this._cursorOffset = 0;\r\n evt.preventDefault();\r\n }\r\n this._blinkIsEven = false;\r\n this._isTextHighlightOn = false;\r\n this._cursorIndex = -1;\r\n this._markAsDirty();\r\n return;\r\n case 222: // Dead\r\n if (evt) {\r\n evt.preventDefault();\r\n }\r\n this._cursorIndex = -1;\r\n this.deadKey = true;\r\n break;\r\n }\r\n // Printable characters\r\n if (key &&\r\n ((keyCode === -1) || // Direct access\r\n (keyCode === 32) || // Space\r\n (keyCode > 47 && keyCode < 64) || // Numbers\r\n (keyCode > 64 && keyCode < 91) || // Letters\r\n (keyCode > 159 && keyCode < 193) || // Special characters\r\n (keyCode > 218 && keyCode < 223) || // Special characters\r\n (keyCode > 95 && keyCode < 112))) { // Numpad\r\n this._currentKey = key;\r\n this.onBeforeKeyAddObservable.notifyObservers(this);\r\n key = this._currentKey;\r\n if (this._addKey) {\r\n if (this._isTextHighlightOn) {\r\n this._textWrapper.removePart(this._startHighlightIndex, this._endHighlightIndex, key);\r\n this._textHasChanged();\r\n this._cursorOffset = this._textWrapper.length - (this._startHighlightIndex + 1);\r\n this._isTextHighlightOn = false;\r\n this._blinkIsEven = false;\r\n this._markAsDirty();\r\n }\r\n else if (this._cursorOffset === 0) {\r\n this.text += key;\r\n }\r\n else {\r\n var insertPosition = this._textWrapper.length - this._cursorOffset;\r\n this._textWrapper.removePart(insertPosition, insertPosition, key);\r\n this._textHasChanged();\r\n }\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n InputText.prototype._updateValueFromCursorIndex = function (offset) {\r\n //update the cursor\r\n this._blinkIsEven = false;\r\n if (this._cursorIndex === -1) {\r\n this._cursorIndex = offset;\r\n }\r\n else {\r\n if (this._cursorIndex < this._cursorOffset) {\r\n this._endHighlightIndex = this._textWrapper.length - this._cursorIndex;\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorOffset;\r\n }\r\n else if (this._cursorIndex > this._cursorOffset) {\r\n this._endHighlightIndex = this._textWrapper.length - this._cursorOffset;\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorIndex;\r\n }\r\n else {\r\n this._isTextHighlightOn = false;\r\n this._markAsDirty();\r\n return;\r\n }\r\n }\r\n this._isTextHighlightOn = true;\r\n this._markAsDirty();\r\n };\r\n /** @hidden */\r\n InputText.prototype._processDblClick = function (evt) {\r\n //pre-find the start and end index of the word under cursor, speeds up the rendering\r\n this._startHighlightIndex = this._textWrapper.length - this._cursorOffset;\r\n this._endHighlightIndex = this._startHighlightIndex;\r\n var moveLeft, moveRight;\r\n do {\r\n moveRight = this._endHighlightIndex < this._textWrapper.length && this._textWrapper.isWord(this._endHighlightIndex) ? ++this._endHighlightIndex : 0;\r\n moveLeft = this._startHighlightIndex > 0 && this._textWrapper.isWord(this._startHighlightIndex - 1) ? --this._startHighlightIndex : 0;\r\n } while (moveLeft || moveRight);\r\n this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;\r\n this.onTextHighlightObservable.notifyObservers(this);\r\n this._isTextHighlightOn = true;\r\n this._clickedCoordinate = null;\r\n this._blinkIsEven = true;\r\n this._cursorIndex = -1;\r\n this._markAsDirty();\r\n };\r\n /** @hidden */\r\n InputText.prototype._selectAllText = function () {\r\n this._blinkIsEven = true;\r\n this._isTextHighlightOn = true;\r\n this._startHighlightIndex = 0;\r\n this._endHighlightIndex = this._textWrapper.length;\r\n this._cursorOffset = this._textWrapper.length;\r\n this._cursorIndex = -1;\r\n this._markAsDirty();\r\n };\r\n /**\r\n * Handles the keyboard event\r\n * @param evt Defines the KeyboardEvent\r\n */\r\n InputText.prototype.processKeyboard = function (evt) {\r\n // process pressed key\r\n this.processKey(evt.keyCode, evt.key, evt);\r\n this.onKeyboardEventProcessedObservable.notifyObservers(evt);\r\n };\r\n /** @hidden */\r\n InputText.prototype._onCopyText = function (ev) {\r\n this._isTextHighlightOn = false;\r\n //when write permission to clipbaord data is denied\r\n try {\r\n ev.clipboardData && ev.clipboardData.setData(\"text/plain\", this._highlightedText);\r\n }\r\n catch (_a) { } //pass\r\n this._host.clipboardData = this._highlightedText;\r\n };\r\n /** @hidden */\r\n InputText.prototype._onCutText = function (ev) {\r\n if (!this._highlightedText) {\r\n return;\r\n }\r\n this._textWrapper.removePart(this._startHighlightIndex, this._endHighlightIndex);\r\n this._textHasChanged();\r\n this._isTextHighlightOn = false;\r\n this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;\r\n //when write permission to clipbaord data is denied\r\n try {\r\n ev.clipboardData && ev.clipboardData.setData(\"text/plain\", this._highlightedText);\r\n }\r\n catch (_a) { } //pass\r\n this._host.clipboardData = this._highlightedText;\r\n this._highlightedText = \"\";\r\n };\r\n /** @hidden */\r\n InputText.prototype._onPasteText = function (ev) {\r\n var data = \"\";\r\n if (ev.clipboardData && ev.clipboardData.types.indexOf(\"text/plain\") !== -1) {\r\n data = ev.clipboardData.getData(\"text/plain\");\r\n }\r\n else {\r\n //get the cached data; returns blank string by default\r\n data = this._host.clipboardData;\r\n }\r\n var insertPosition = this._textWrapper.length - this._cursorOffset;\r\n this._textWrapper.removePart(insertPosition, insertPosition, data);\r\n this._textHasChanged();\r\n };\r\n InputText.prototype._draw = function (context, invalidatedRectangle) {\r\n var _this = this;\r\n context.save();\r\n this._applyStates(context);\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n // Background\r\n if (this._isFocused) {\r\n if (this._focusedBackground) {\r\n context.fillStyle = this._isEnabled ? this._focusedBackground : this._disabledColor;\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n }\r\n else if (this._background) {\r\n context.fillStyle = this._isEnabled ? this._background : this._disabledColor;\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n if (!this._fontOffset) {\r\n this._fontOffset = Control._GetFontOffset(context.font);\r\n }\r\n // Text\r\n var clipTextLeft = this._currentMeasure.left + this._margin.getValueInPixel(this._host, this._tempParentMeasure.width);\r\n if (this.color) {\r\n context.fillStyle = this.color;\r\n }\r\n var text = this._beforeRenderText(this._textWrapper);\r\n if (!this._isFocused && !this._textWrapper.text && this._placeholderText) {\r\n text = new TextWrapper();\r\n text.text = this._placeholderText;\r\n if (this._placeholderColor) {\r\n context.fillStyle = this._placeholderColor;\r\n }\r\n }\r\n this._textWidth = context.measureText(text.text).width;\r\n var marginWidth = this._margin.getValueInPixel(this._host, this._tempParentMeasure.width) * 2;\r\n if (this._autoStretchWidth) {\r\n this.width = Math.min(this._maxWidth.getValueInPixel(this._host, this._tempParentMeasure.width), this._textWidth + marginWidth) + \"px\";\r\n }\r\n var rootY = this._fontOffset.ascent + (this._currentMeasure.height - this._fontOffset.height) / 2;\r\n var availableWidth = this._width.getValueInPixel(this._host, this._tempParentMeasure.width) - marginWidth;\r\n context.save();\r\n context.beginPath();\r\n context.rect(clipTextLeft, this._currentMeasure.top + (this._currentMeasure.height - this._fontOffset.height) / 2, availableWidth + 2, this._currentMeasure.height);\r\n context.clip();\r\n if (this._isFocused && this._textWidth > availableWidth) {\r\n var textLeft = clipTextLeft - this._textWidth + availableWidth;\r\n if (!this._scrollLeft) {\r\n this._scrollLeft = textLeft;\r\n }\r\n }\r\n else {\r\n this._scrollLeft = clipTextLeft;\r\n }\r\n context.fillText(text.text, this._scrollLeft, this._currentMeasure.top + rootY);\r\n // Cursor\r\n if (this._isFocused) {\r\n // Need to move cursor\r\n if (this._clickedCoordinate) {\r\n var rightPosition = this._scrollLeft + this._textWidth;\r\n var absoluteCursorPosition = rightPosition - this._clickedCoordinate;\r\n var currentSize = 0;\r\n this._cursorOffset = 0;\r\n var previousDist = 0;\r\n do {\r\n if (this._cursorOffset) {\r\n previousDist = Math.abs(absoluteCursorPosition - currentSize);\r\n }\r\n this._cursorOffset++;\r\n currentSize = context.measureText(text.substr(text.length - this._cursorOffset, this._cursorOffset)).width;\r\n } while (currentSize < absoluteCursorPosition && (text.length >= this._cursorOffset));\r\n // Find closest move\r\n if (Math.abs(absoluteCursorPosition - currentSize) > previousDist) {\r\n this._cursorOffset--;\r\n }\r\n this._blinkIsEven = false;\r\n this._clickedCoordinate = null;\r\n }\r\n // Render cursor\r\n if (!this._blinkIsEven) {\r\n var cursorOffsetText = text.substr(text.length - this._cursorOffset);\r\n var cursorOffsetWidth = context.measureText(cursorOffsetText).width;\r\n var cursorLeft = this._scrollLeft + this._textWidth - cursorOffsetWidth;\r\n if (cursorLeft < clipTextLeft) {\r\n this._scrollLeft += (clipTextLeft - cursorLeft);\r\n cursorLeft = clipTextLeft;\r\n this._markAsDirty();\r\n }\r\n else if (cursorLeft > clipTextLeft + availableWidth) {\r\n this._scrollLeft += (clipTextLeft + availableWidth - cursorLeft);\r\n cursorLeft = clipTextLeft + availableWidth;\r\n this._markAsDirty();\r\n }\r\n if (!this._isTextHighlightOn) {\r\n context.fillRect(cursorLeft, this._currentMeasure.top + (this._currentMeasure.height - this._fontOffset.height) / 2, 2, this._fontOffset.height);\r\n }\r\n }\r\n clearTimeout(this._blinkTimeout);\r\n this._blinkTimeout = setTimeout(function () {\r\n _this._blinkIsEven = !_this._blinkIsEven;\r\n _this._markAsDirty();\r\n }, 500);\r\n //show the highlighted text\r\n if (this._isTextHighlightOn) {\r\n clearTimeout(this._blinkTimeout);\r\n var highlightCursorOffsetWidth = context.measureText(text.substring(this._startHighlightIndex)).width;\r\n var highlightCursorLeft = this._scrollLeft + this._textWidth - highlightCursorOffsetWidth;\r\n this._highlightedText = text.substring(this._startHighlightIndex, this._endHighlightIndex);\r\n var width = context.measureText(text.substring(this._startHighlightIndex, this._endHighlightIndex)).width;\r\n if (highlightCursorLeft < clipTextLeft) {\r\n width = width - (clipTextLeft - highlightCursorLeft);\r\n if (!width) {\r\n // when using left arrow on text.length > availableWidth;\r\n // assigns the width of the first letter after clipTextLeft\r\n width = context.measureText(text.charAt(text.length - this._cursorOffset)).width;\r\n }\r\n highlightCursorLeft = clipTextLeft;\r\n }\r\n //for transparancy\r\n context.globalAlpha = this._highligherOpacity;\r\n context.fillStyle = this._textHighlightColor;\r\n context.fillRect(highlightCursorLeft, this._currentMeasure.top + (this._currentMeasure.height - this._fontOffset.height) / 2, width, this._fontOffset.height);\r\n context.globalAlpha = 1.0;\r\n }\r\n }\r\n context.restore();\r\n // Border\r\n if (this._thickness) {\r\n if (this._isFocused) {\r\n if (this.focusedColor) {\r\n context.strokeStyle = this.focusedColor;\r\n }\r\n }\r\n else {\r\n if (this.color) {\r\n context.strokeStyle = this.color;\r\n }\r\n }\r\n context.lineWidth = this._thickness;\r\n context.strokeRect(this._currentMeasure.left + this._thickness / 2, this._currentMeasure.top + this._thickness / 2, this._currentMeasure.width - this._thickness, this._currentMeasure.height - this._thickness);\r\n }\r\n context.restore();\r\n };\r\n InputText.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n if (!_super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n this._clickedCoordinate = coordinates.x;\r\n this._isTextHighlightOn = false;\r\n this._highlightedText = \"\";\r\n this._cursorIndex = -1;\r\n this._isPointerDown = true;\r\n this._host._capturingControl[pointerId] = this;\r\n if (this._host.focusedControl === this) {\r\n // Move cursor\r\n clearTimeout(this._blinkTimeout);\r\n this._markAsDirty();\r\n return true;\r\n }\r\n if (!this._isEnabled) {\r\n return false;\r\n }\r\n this._host.focusedControl = this;\r\n return true;\r\n };\r\n InputText.prototype._onPointerMove = function (target, coordinates, pointerId, pi) {\r\n if (this._host.focusedControl === this && this._isPointerDown) {\r\n this._clickedCoordinate = coordinates.x;\r\n this._markAsDirty();\r\n this._updateValueFromCursorIndex(this._cursorOffset);\r\n }\r\n _super.prototype._onPointerMove.call(this, target, coordinates, pointerId, pi);\r\n };\r\n InputText.prototype._onPointerUp = function (target, coordinates, pointerId, buttonIndex, notifyClick) {\r\n this._isPointerDown = false;\r\n delete this._host._capturingControl[pointerId];\r\n _super.prototype._onPointerUp.call(this, target, coordinates, pointerId, buttonIndex, notifyClick);\r\n };\r\n InputText.prototype._beforeRenderText = function (textWrapper) {\r\n return textWrapper;\r\n };\r\n InputText.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.onBlurObservable.clear();\r\n this.onFocusObservable.clear();\r\n this.onTextChangedObservable.clear();\r\n this.onTextCopyObservable.clear();\r\n this.onTextCutObservable.clear();\r\n this.onTextPasteObservable.clear();\r\n this.onTextHighlightObservable.clear();\r\n this.onKeyboardEventProcessedObservable.clear();\r\n };\r\n return InputText;\r\n}(Control));\r\nexport { InputText };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.InputText\"] = InputText;\r\n//# sourceMappingURL=inputText.js.map","import { __extends } from \"tslib\";\r\nimport { Container } from \"./container\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { Control } from \"./control\";\r\nimport { Tools } from '@babylonjs/core/Misc/tools';\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create a 2D grid container\r\n */\r\nvar Grid = /** @class */ (function (_super) {\r\n __extends(Grid, _super);\r\n /**\r\n * Creates a new Grid\r\n * @param name defines control name\r\n */\r\n function Grid(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._rowDefinitions = new Array();\r\n _this._columnDefinitions = new Array();\r\n _this._cells = {};\r\n _this._childControls = new Array();\r\n return _this;\r\n }\r\n Object.defineProperty(Grid.prototype, \"columnCount\", {\r\n /**\r\n * Gets the number of columns\r\n */\r\n get: function () {\r\n return this._columnDefinitions.length;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Grid.prototype, \"rowCount\", {\r\n /**\r\n * Gets the number of rows\r\n */\r\n get: function () {\r\n return this._rowDefinitions.length;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Grid.prototype, \"children\", {\r\n /** Gets the list of children */\r\n get: function () {\r\n return this._childControls;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Grid.prototype, \"cells\", {\r\n /** Gets the list of cells (e.g. the containers) */\r\n get: function () {\r\n return this._cells;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the definition of a specific row\r\n * @param index defines the index of the row\r\n * @returns the row definition\r\n */\r\n Grid.prototype.getRowDefinition = function (index) {\r\n if (index < 0 || index >= this._rowDefinitions.length) {\r\n return null;\r\n }\r\n return this._rowDefinitions[index];\r\n };\r\n /**\r\n * Gets the definition of a specific column\r\n * @param index defines the index of the column\r\n * @returns the column definition\r\n */\r\n Grid.prototype.getColumnDefinition = function (index) {\r\n if (index < 0 || index >= this._columnDefinitions.length) {\r\n return null;\r\n }\r\n return this._columnDefinitions[index];\r\n };\r\n /**\r\n * Adds a new row to the grid\r\n * @param height defines the height of the row (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the height is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n Grid.prototype.addRowDefinition = function (height, isPixel) {\r\n if (isPixel === void 0) { isPixel = false; }\r\n this._rowDefinitions.push(new ValueAndUnit(height, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE));\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Adds a new column to the grid\r\n * @param width defines the width of the column (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the width is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n Grid.prototype.addColumnDefinition = function (width, isPixel) {\r\n if (isPixel === void 0) { isPixel = false; }\r\n this._columnDefinitions.push(new ValueAndUnit(width, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE));\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Update a row definition\r\n * @param index defines the index of the row to update\r\n * @param height defines the height of the row (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the weight is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n Grid.prototype.setRowDefinition = function (index, height, isPixel) {\r\n if (isPixel === void 0) { isPixel = false; }\r\n if (index < 0 || index >= this._rowDefinitions.length) {\r\n return this;\r\n }\r\n var current = this._rowDefinitions[index];\r\n if (current && current.isPixel === isPixel && current.internalValue === height) {\r\n return this;\r\n }\r\n this._rowDefinitions[index] = new ValueAndUnit(height, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE);\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Update a column definition\r\n * @param index defines the index of the column to update\r\n * @param width defines the width of the column (either in pixel or a value between 0 and 1)\r\n * @param isPixel defines if the width is expressed in pixel (or in percentage)\r\n * @returns the current grid\r\n */\r\n Grid.prototype.setColumnDefinition = function (index, width, isPixel) {\r\n if (isPixel === void 0) { isPixel = false; }\r\n if (index < 0 || index >= this._columnDefinitions.length) {\r\n return this;\r\n }\r\n var current = this._columnDefinitions[index];\r\n if (current && current.isPixel === isPixel && current.internalValue === width) {\r\n return this;\r\n }\r\n this._columnDefinitions[index] = new ValueAndUnit(width, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE);\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Gets the list of children stored in a specific cell\r\n * @param row defines the row to check\r\n * @param column defines the column to check\r\n * @returns the list of controls\r\n */\r\n Grid.prototype.getChildrenAt = function (row, column) {\r\n var cell = this._cells[row + \":\" + column];\r\n if (!cell) {\r\n return null;\r\n }\r\n return cell.children;\r\n };\r\n /**\r\n * Gets a string representing the child cell info (row x column)\r\n * @param child defines the control to get info from\r\n * @returns a string containing the child cell info (row x column)\r\n */\r\n Grid.prototype.getChildCellInfo = function (child) {\r\n return child._tag;\r\n };\r\n Grid.prototype._removeCell = function (cell, key) {\r\n if (!cell) {\r\n return;\r\n }\r\n _super.prototype.removeControl.call(this, cell);\r\n for (var _i = 0, _a = cell.children; _i < _a.length; _i++) {\r\n var control = _a[_i];\r\n var childIndex = this._childControls.indexOf(control);\r\n if (childIndex !== -1) {\r\n this._childControls.splice(childIndex, 1);\r\n }\r\n }\r\n delete this._cells[key];\r\n };\r\n Grid.prototype._offsetCell = function (previousKey, key) {\r\n if (!this._cells[key]) {\r\n return;\r\n }\r\n this._cells[previousKey] = this._cells[key];\r\n for (var _i = 0, _a = this._cells[previousKey].children; _i < _a.length; _i++) {\r\n var control = _a[_i];\r\n control._tag = previousKey;\r\n }\r\n delete this._cells[key];\r\n };\r\n /**\r\n * Remove a column definition at specified index\r\n * @param index defines the index of the column to remove\r\n * @returns the current grid\r\n */\r\n Grid.prototype.removeColumnDefinition = function (index) {\r\n if (index < 0 || index >= this._columnDefinitions.length) {\r\n return this;\r\n }\r\n for (var x = 0; x < this._rowDefinitions.length; x++) {\r\n var key = x + \":\" + index;\r\n var cell = this._cells[key];\r\n this._removeCell(cell, key);\r\n }\r\n for (var x = 0; x < this._rowDefinitions.length; x++) {\r\n for (var y = index + 1; y < this._columnDefinitions.length; y++) {\r\n var previousKey = x + \":\" + (y - 1);\r\n var key = x + \":\" + y;\r\n this._offsetCell(previousKey, key);\r\n }\r\n }\r\n this._columnDefinitions.splice(index, 1);\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Remove a row definition at specified index\r\n * @param index defines the index of the row to remove\r\n * @returns the current grid\r\n */\r\n Grid.prototype.removeRowDefinition = function (index) {\r\n if (index < 0 || index >= this._rowDefinitions.length) {\r\n return this;\r\n }\r\n for (var y = 0; y < this._columnDefinitions.length; y++) {\r\n var key = index + \":\" + y;\r\n var cell = this._cells[key];\r\n this._removeCell(cell, key);\r\n }\r\n for (var y = 0; y < this._columnDefinitions.length; y++) {\r\n for (var x = index + 1; x < this._rowDefinitions.length; x++) {\r\n var previousKey = x - 1 + \":\" + y;\r\n var key = x + \":\" + y;\r\n this._offsetCell(previousKey, key);\r\n }\r\n }\r\n this._rowDefinitions.splice(index, 1);\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Adds a new control to the current grid\r\n * @param control defines the control to add\r\n * @param row defines the row where to add the control (0 by default)\r\n * @param column defines the column where to add the control (0 by default)\r\n * @returns the current grid\r\n */\r\n Grid.prototype.addControl = function (control, row, column) {\r\n if (row === void 0) { row = 0; }\r\n if (column === void 0) { column = 0; }\r\n if (this._rowDefinitions.length === 0) {\r\n // Add default row definition\r\n this.addRowDefinition(1, false);\r\n }\r\n if (this._columnDefinitions.length === 0) {\r\n // Add default column definition\r\n this.addColumnDefinition(1, false);\r\n }\r\n if (this._childControls.indexOf(control) !== -1) {\r\n Tools.Warn(\"Control (Name:\" + control.name + \", UniqueId:\" + control.uniqueId + \") is already associated with this grid. You must remove it before reattaching it\");\r\n return this;\r\n }\r\n var x = Math.min(row, this._rowDefinitions.length - 1);\r\n var y = Math.min(column, this._columnDefinitions.length - 1);\r\n var key = x + \":\" + y;\r\n var goodContainer = this._cells[key];\r\n if (!goodContainer) {\r\n goodContainer = new Container(key);\r\n this._cells[key] = goodContainer;\r\n goodContainer.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n goodContainer.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n _super.prototype.addControl.call(this, goodContainer);\r\n }\r\n goodContainer.addControl(control);\r\n this._childControls.push(control);\r\n control._tag = key;\r\n control.parent = this;\r\n this._markAsDirty();\r\n return this;\r\n };\r\n /**\r\n * Removes a control from the current container\r\n * @param control defines the control to remove\r\n * @returns the current container\r\n */\r\n Grid.prototype.removeControl = function (control) {\r\n var index = this._childControls.indexOf(control);\r\n if (index !== -1) {\r\n this._childControls.splice(index, 1);\r\n }\r\n var cell = this._cells[control._tag];\r\n if (cell) {\r\n cell.removeControl(control);\r\n control._tag = null;\r\n }\r\n this._markAsDirty();\r\n return this;\r\n };\r\n Grid.prototype._getTypeName = function () {\r\n return \"Grid\";\r\n };\r\n Grid.prototype._getGridDefinitions = function (definitionCallback) {\r\n var widths = [];\r\n var heights = [];\r\n var lefts = [];\r\n var tops = [];\r\n var availableWidth = this._currentMeasure.width;\r\n var globalWidthPercentage = 0;\r\n var availableHeight = this._currentMeasure.height;\r\n var globalHeightPercentage = 0;\r\n // Heights\r\n var index = 0;\r\n for (var _i = 0, _a = this._rowDefinitions; _i < _a.length; _i++) {\r\n var value = _a[_i];\r\n if (value.isPixel) {\r\n var height = value.getValue(this._host);\r\n availableHeight -= height;\r\n heights[index] = height;\r\n }\r\n else {\r\n globalHeightPercentage += value.internalValue;\r\n }\r\n index++;\r\n }\r\n var top = 0;\r\n index = 0;\r\n for (var _b = 0, _c = this._rowDefinitions; _b < _c.length; _b++) {\r\n var value = _c[_b];\r\n tops.push(top);\r\n if (!value.isPixel) {\r\n var height = (value.internalValue / globalHeightPercentage) * availableHeight;\r\n top += height;\r\n heights[index] = height;\r\n }\r\n else {\r\n top += value.getValue(this._host);\r\n }\r\n index++;\r\n }\r\n // Widths\r\n index = 0;\r\n for (var _d = 0, _e = this._columnDefinitions; _d < _e.length; _d++) {\r\n var value = _e[_d];\r\n if (value.isPixel) {\r\n var width = value.getValue(this._host);\r\n availableWidth -= width;\r\n widths[index] = width;\r\n }\r\n else {\r\n globalWidthPercentage += value.internalValue;\r\n }\r\n index++;\r\n }\r\n var left = 0;\r\n index = 0;\r\n for (var _f = 0, _g = this._columnDefinitions; _f < _g.length; _f++) {\r\n var value = _g[_f];\r\n lefts.push(left);\r\n if (!value.isPixel) {\r\n var width = (value.internalValue / globalWidthPercentage) * availableWidth;\r\n left += width;\r\n widths[index] = width;\r\n }\r\n else {\r\n left += value.getValue(this._host);\r\n }\r\n index++;\r\n }\r\n definitionCallback(lefts, tops, widths, heights);\r\n };\r\n Grid.prototype._additionalProcessing = function (parentMeasure, context) {\r\n var _this = this;\r\n this._getGridDefinitions(function (lefts, tops, widths, heights) {\r\n // Setting child sizes\r\n for (var key in _this._cells) {\r\n if (!_this._cells.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n var split = key.split(\":\");\r\n var x = parseInt(split[0]);\r\n var y = parseInt(split[1]);\r\n var cell = _this._cells[key];\r\n cell.left = lefts[y] + \"px\";\r\n cell.top = tops[x] + \"px\";\r\n cell.width = widths[y] + \"px\";\r\n cell.height = heights[x] + \"px\";\r\n cell._left.ignoreAdaptiveScaling = true;\r\n cell._top.ignoreAdaptiveScaling = true;\r\n cell._width.ignoreAdaptiveScaling = true;\r\n cell._height.ignoreAdaptiveScaling = true;\r\n }\r\n });\r\n _super.prototype._additionalProcessing.call(this, parentMeasure, context);\r\n };\r\n Grid.prototype._flagDescendantsAsMatrixDirty = function () {\r\n for (var key in this._cells) {\r\n if (!this._cells.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n var child = this._cells[key];\r\n child._markMatrixAsDirty();\r\n }\r\n };\r\n Grid.prototype._renderHighlightSpecific = function (context) {\r\n var _this = this;\r\n _super.prototype._renderHighlightSpecific.call(this, context);\r\n this._getGridDefinitions(function (lefts, tops, widths, heights) {\r\n // Columns\r\n for (var index = 0; index < lefts.length; index++) {\r\n var left = _this._currentMeasure.left + lefts[index] + widths[index];\r\n context.beginPath();\r\n context.moveTo(left, _this._currentMeasure.top);\r\n context.lineTo(left, _this._currentMeasure.top + _this._currentMeasure.height);\r\n context.stroke();\r\n }\r\n // Rows\r\n for (var index = 0; index < tops.length; index++) {\r\n var top_1 = _this._currentMeasure.top + tops[index] + heights[index];\r\n context.beginPath();\r\n context.moveTo(_this._currentMeasure.left, top_1);\r\n context.lineTo(_this._currentMeasure.left + _this._currentMeasure.width, top_1);\r\n context.stroke();\r\n }\r\n });\r\n context.restore();\r\n };\r\n /** Releases associated resources */\r\n Grid.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n for (var _i = 0, _a = this._childControls; _i < _a.length; _i++) {\r\n var control = _a[_i];\r\n control.dispose();\r\n }\r\n this._childControls = [];\r\n };\r\n return Grid;\r\n}(Container));\r\nexport { Grid };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Grid\"] = Grid;\r\n//# sourceMappingURL=grid.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Control } from \"./control\";\r\nimport { InputText } from \"./inputText\";\r\nimport { Rectangle } from \"./rectangle\";\r\nimport { Button } from \"./button\";\r\nimport { Grid } from \"./grid\";\r\nimport { TextBlock } from \"../controls/textBlock\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\n/** Class used to create color pickers */\r\nvar ColorPicker = /** @class */ (function (_super) {\r\n __extends(ColorPicker, _super);\r\n /**\r\n * Creates a new ColorPicker\r\n * @param name defines the control name\r\n */\r\n function ColorPicker(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._value = Color3.Red();\r\n _this._tmpColor = new Color3();\r\n _this._pointerStartedOnSquare = false;\r\n _this._pointerStartedOnWheel = false;\r\n _this._squareLeft = 0;\r\n _this._squareTop = 0;\r\n _this._squareSize = 0;\r\n _this._h = 360;\r\n _this._s = 1;\r\n _this._v = 1;\r\n _this._lastPointerDownID = -1;\r\n /**\r\n * Observable raised when the value changes\r\n */\r\n _this.onValueChangedObservable = new Observable();\r\n // Events\r\n _this._pointerIsDown = false;\r\n _this.value = new Color3(.88, .1, .1);\r\n _this.size = \"200px\";\r\n _this.isPointerBlocker = true;\r\n return _this;\r\n }\r\n Object.defineProperty(ColorPicker.prototype, \"value\", {\r\n /** Gets or sets the color of the color picker */\r\n get: function () {\r\n return this._value;\r\n },\r\n set: function (value) {\r\n if (this._value.equals(value)) {\r\n return;\r\n }\r\n this._value.copyFrom(value);\r\n this._value.toHSVToRef(this._tmpColor);\r\n this._h = this._tmpColor.r;\r\n this._s = Math.max(this._tmpColor.g, 0.00001);\r\n this._v = Math.max(this._tmpColor.b, 0.00001);\r\n this._markAsDirty();\r\n if (this._value.r <= ColorPicker._Epsilon) {\r\n this._value.r = 0;\r\n }\r\n if (this._value.g <= ColorPicker._Epsilon) {\r\n this._value.g = 0;\r\n }\r\n if (this._value.b <= ColorPicker._Epsilon) {\r\n this._value.b = 0;\r\n }\r\n if (this._value.r >= 1.0 - ColorPicker._Epsilon) {\r\n this._value.r = 1.0;\r\n }\r\n if (this._value.g >= 1.0 - ColorPicker._Epsilon) {\r\n this._value.g = 1.0;\r\n }\r\n if (this._value.b >= 1.0 - ColorPicker._Epsilon) {\r\n this._value.b = 1.0;\r\n }\r\n this.onValueChangedObservable.notifyObservers(this._value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorPicker.prototype, \"width\", {\r\n /**\r\n * Gets or sets control width\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._width.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._width.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._width.fromString(value)) {\r\n this._height.fromString(value);\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorPicker.prototype, \"height\", {\r\n /**\r\n * Gets or sets control height\r\n * @see https://doc.babylonjs.com/how_to/gui#position-and-size\r\n */\r\n get: function () {\r\n return this._height.toString(this._host);\r\n },\r\n /** Gets or sets control height */\r\n set: function (value) {\r\n if (this._height.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._height.fromString(value)) {\r\n this._width.fromString(value);\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ColorPicker.prototype, \"size\", {\r\n /** Gets or sets control size */\r\n get: function () {\r\n return this.width;\r\n },\r\n set: function (value) {\r\n this.width = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ColorPicker.prototype._getTypeName = function () {\r\n return \"ColorPicker\";\r\n };\r\n /** @hidden */\r\n ColorPicker.prototype._preMeasure = function (parentMeasure, context) {\r\n if (parentMeasure.width < parentMeasure.height) {\r\n this._currentMeasure.height = parentMeasure.width;\r\n }\r\n else {\r\n this._currentMeasure.width = parentMeasure.height;\r\n }\r\n };\r\n ColorPicker.prototype._updateSquareProps = function () {\r\n var radius = Math.min(this._currentMeasure.width, this._currentMeasure.height) * .5;\r\n var wheelThickness = radius * .2;\r\n var innerDiameter = (radius - wheelThickness) * 2;\r\n var squareSize = innerDiameter / (Math.sqrt(2));\r\n var offset = radius - squareSize * .5;\r\n this._squareLeft = this._currentMeasure.left + offset;\r\n this._squareTop = this._currentMeasure.top + offset;\r\n this._squareSize = squareSize;\r\n };\r\n ColorPicker.prototype._drawGradientSquare = function (hueValue, left, top, width, height, context) {\r\n var lgh = context.createLinearGradient(left, top, width + left, top);\r\n lgh.addColorStop(0, '#fff');\r\n lgh.addColorStop(1, 'hsl(' + hueValue + ', 100%, 50%)');\r\n context.fillStyle = lgh;\r\n context.fillRect(left, top, width, height);\r\n var lgv = context.createLinearGradient(left, top, left, height + top);\r\n lgv.addColorStop(0, 'rgba(0,0,0,0)');\r\n lgv.addColorStop(1, '#000');\r\n context.fillStyle = lgv;\r\n context.fillRect(left, top, width, height);\r\n };\r\n ColorPicker.prototype._drawCircle = function (centerX, centerY, radius, context) {\r\n context.beginPath();\r\n context.arc(centerX, centerY, radius + 1, 0, 2 * Math.PI, false);\r\n context.lineWidth = 3;\r\n context.strokeStyle = '#333333';\r\n context.stroke();\r\n context.beginPath();\r\n context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);\r\n context.lineWidth = 3;\r\n context.strokeStyle = '#ffffff';\r\n context.stroke();\r\n };\r\n ColorPicker.prototype._createColorWheelCanvas = function (radius, thickness) {\r\n var canvas = document.createElement(\"canvas\");\r\n canvas.width = radius * 2;\r\n canvas.height = radius * 2;\r\n var context = canvas.getContext(\"2d\");\r\n var image = context.getImageData(0, 0, radius * 2, radius * 2);\r\n var data = image.data;\r\n var color = this._tmpColor;\r\n var maxDistSq = radius * radius;\r\n var innerRadius = radius - thickness;\r\n var minDistSq = innerRadius * innerRadius;\r\n for (var x = -radius; x < radius; x++) {\r\n for (var y = -radius; y < radius; y++) {\r\n var distSq = x * x + y * y;\r\n if (distSq > maxDistSq || distSq < minDistSq) {\r\n continue;\r\n }\r\n var dist = Math.sqrt(distSq);\r\n var ang = Math.atan2(y, x);\r\n Color3.HSVtoRGBToRef(ang * 180 / Math.PI + 180, dist / radius, 1, color);\r\n var index = ((x + radius) + ((y + radius) * 2 * radius)) * 4;\r\n data[index] = color.r * 255;\r\n data[index + 1] = color.g * 255;\r\n data[index + 2] = color.b * 255;\r\n var alphaRatio = (dist - innerRadius) / (radius - innerRadius);\r\n //apply less alpha to bigger color pickers\r\n var alphaAmount = .2;\r\n var maxAlpha = .2;\r\n var minAlpha = .04;\r\n var lowerRadius = 50;\r\n var upperRadius = 150;\r\n if (radius < lowerRadius) {\r\n alphaAmount = maxAlpha;\r\n }\r\n else if (radius > upperRadius) {\r\n alphaAmount = minAlpha;\r\n }\r\n else {\r\n alphaAmount = (minAlpha - maxAlpha) * (radius - lowerRadius) / (upperRadius - lowerRadius) + maxAlpha;\r\n }\r\n var alphaRatio = (dist - innerRadius) / (radius - innerRadius);\r\n if (alphaRatio < alphaAmount) {\r\n data[index + 3] = 255 * (alphaRatio / alphaAmount);\r\n }\r\n else if (alphaRatio > 1 - alphaAmount) {\r\n data[index + 3] = 255 * (1.0 - ((alphaRatio - (1 - alphaAmount)) / alphaAmount));\r\n }\r\n else {\r\n data[index + 3] = 255;\r\n }\r\n }\r\n }\r\n context.putImageData(image, 0, 0);\r\n return canvas;\r\n };\r\n /** @hidden */\r\n ColorPicker.prototype._draw = function (context) {\r\n context.save();\r\n this._applyStates(context);\r\n var radius = Math.min(this._currentMeasure.width, this._currentMeasure.height) * .5;\r\n var wheelThickness = radius * .2;\r\n var left = this._currentMeasure.left;\r\n var top = this._currentMeasure.top;\r\n if (!this._colorWheelCanvas || this._colorWheelCanvas.width != radius * 2) {\r\n this._colorWheelCanvas = this._createColorWheelCanvas(radius, wheelThickness);\r\n }\r\n this._updateSquareProps();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n context.fillRect(this._squareLeft, this._squareTop, this._squareSize, this._squareSize);\r\n }\r\n context.drawImage(this._colorWheelCanvas, left, top);\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n this._drawGradientSquare(this._h, this._squareLeft, this._squareTop, this._squareSize, this._squareSize, context);\r\n var cx = this._squareLeft + this._squareSize * this._s;\r\n var cy = this._squareTop + this._squareSize * (1 - this._v);\r\n this._drawCircle(cx, cy, radius * .04, context);\r\n var dist = radius - wheelThickness * .5;\r\n cx = left + radius + Math.cos((this._h - 180) * Math.PI / 180) * dist;\r\n cy = top + radius + Math.sin((this._h - 180) * Math.PI / 180) * dist;\r\n this._drawCircle(cx, cy, wheelThickness * .35, context);\r\n context.restore();\r\n };\r\n ColorPicker.prototype._updateValueFromPointer = function (x, y) {\r\n if (this._pointerStartedOnWheel) {\r\n var radius = Math.min(this._currentMeasure.width, this._currentMeasure.height) * .5;\r\n var centerX = radius + this._currentMeasure.left;\r\n var centerY = radius + this._currentMeasure.top;\r\n this._h = Math.atan2(y - centerY, x - centerX) * 180 / Math.PI + 180;\r\n }\r\n else if (this._pointerStartedOnSquare) {\r\n this._updateSquareProps();\r\n this._s = (x - this._squareLeft) / this._squareSize;\r\n this._v = 1 - (y - this._squareTop) / this._squareSize;\r\n this._s = Math.min(this._s, 1);\r\n this._s = Math.max(this._s, ColorPicker._Epsilon);\r\n this._v = Math.min(this._v, 1);\r\n this._v = Math.max(this._v, ColorPicker._Epsilon);\r\n }\r\n Color3.HSVtoRGBToRef(this._h, this._s, this._v, this._tmpColor);\r\n this.value = this._tmpColor;\r\n };\r\n ColorPicker.prototype._isPointOnSquare = function (x, y) {\r\n this._updateSquareProps();\r\n var left = this._squareLeft;\r\n var top = this._squareTop;\r\n var size = this._squareSize;\r\n if (x >= left && x <= left + size &&\r\n y >= top && y <= top + size) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n ColorPicker.prototype._isPointOnWheel = function (x, y) {\r\n var radius = Math.min(this._currentMeasure.width, this._currentMeasure.height) * .5;\r\n var centerX = radius + this._currentMeasure.left;\r\n var centerY = radius + this._currentMeasure.top;\r\n var wheelThickness = radius * .2;\r\n var innerRadius = radius - wheelThickness;\r\n var radiusSq = radius * radius;\r\n var innerRadiusSq = innerRadius * innerRadius;\r\n var dx = x - centerX;\r\n var dy = y - centerY;\r\n var distSq = dx * dx + dy * dy;\r\n if (distSq <= radiusSq && distSq >= innerRadiusSq) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n ColorPicker.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n if (!_super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n this._pointerIsDown = true;\r\n this._pointerStartedOnSquare = false;\r\n this._pointerStartedOnWheel = false;\r\n // Invert transform\r\n this._invertTransformMatrix.transformCoordinates(coordinates.x, coordinates.y, this._transformedPosition);\r\n var x = this._transformedPosition.x;\r\n var y = this._transformedPosition.y;\r\n if (this._isPointOnSquare(x, y)) {\r\n this._pointerStartedOnSquare = true;\r\n }\r\n else if (this._isPointOnWheel(x, y)) {\r\n this._pointerStartedOnWheel = true;\r\n }\r\n this._updateValueFromPointer(x, y);\r\n this._host._capturingControl[pointerId] = this;\r\n this._lastPointerDownID = pointerId;\r\n return true;\r\n };\r\n ColorPicker.prototype._onPointerMove = function (target, coordinates, pointerId, pi) {\r\n // Only listen to pointer move events coming from the last pointer to click on the element (To support dual vr controller interaction)\r\n if (pointerId != this._lastPointerDownID) {\r\n return;\r\n }\r\n // Invert transform\r\n this._invertTransformMatrix.transformCoordinates(coordinates.x, coordinates.y, this._transformedPosition);\r\n var x = this._transformedPosition.x;\r\n var y = this._transformedPosition.y;\r\n if (this._pointerIsDown) {\r\n this._updateValueFromPointer(x, y);\r\n }\r\n _super.prototype._onPointerMove.call(this, target, coordinates, pointerId, pi);\r\n };\r\n ColorPicker.prototype._onPointerUp = function (target, coordinates, pointerId, buttonIndex, notifyClick, pi) {\r\n this._pointerIsDown = false;\r\n delete this._host._capturingControl[pointerId];\r\n _super.prototype._onPointerUp.call(this, target, coordinates, pointerId, buttonIndex, notifyClick, pi);\r\n };\r\n ColorPicker.prototype._onCanvasBlur = function () {\r\n this._forcePointerUp();\r\n _super.prototype._onCanvasBlur.call(this);\r\n };\r\n /**\r\n * This function expands the color picker by creating a color picker dialog with manual\r\n * color value input and the ability to save colors into an array to be used later in\r\n * subsequent launches of the dialogue.\r\n * @param advancedTexture defines the AdvancedDynamicTexture the dialog is assigned to\r\n * @param options defines size for dialog and options for saved colors. Also accepts last color picked as hex string and saved colors array as hex strings.\r\n * @returns picked color as a hex string and the saved colors array as hex strings.\r\n */\r\n ColorPicker.ShowPickerDialogAsync = function (advancedTexture, options) {\r\n return new Promise(function (resolve, reject) {\r\n // Default options\r\n options.pickerWidth = options.pickerWidth || \"640px\";\r\n options.pickerHeight = options.pickerHeight || \"400px\";\r\n options.headerHeight = options.headerHeight || \"35px\";\r\n options.lastColor = options.lastColor || \"#000000\";\r\n options.swatchLimit = options.swatchLimit || 20;\r\n options.numSwatchesPerLine = options.numSwatchesPerLine || 10;\r\n // Window size settings\r\n var drawerMaxRows = options.swatchLimit / options.numSwatchesPerLine;\r\n var rawSwatchSize = parseFloat(options.pickerWidth) / options.numSwatchesPerLine;\r\n var gutterSize = Math.floor(rawSwatchSize * 0.25);\r\n var colGutters = gutterSize * (options.numSwatchesPerLine + 1);\r\n var swatchSize = Math.floor((parseFloat(options.pickerWidth) - colGutters) / options.numSwatchesPerLine);\r\n var drawerMaxSize = (swatchSize * drawerMaxRows) + (gutterSize * (drawerMaxRows + 1));\r\n var containerSize = (parseInt(options.pickerHeight) + drawerMaxSize + Math.floor(swatchSize * 0.25)).toString() + \"px\";\r\n // Button Colors\r\n var buttonColor = \"#c0c0c0\";\r\n var buttonBackgroundColor = \"#535353\";\r\n var buttonBackgroundHoverColor = \"#414141\";\r\n var buttonBackgroundClickColor = \"515151\";\r\n var buttonDisabledColor = \"#555555\";\r\n var buttonDisabledBackgroundColor = \"#454545\";\r\n var currentSwatchesOutlineColor = \"#404040\";\r\n var luminanceLimitColor = Color3.FromHexString(\"#dddddd\");\r\n var luminanceLimit = luminanceLimitColor.r + luminanceLimitColor.g + luminanceLimitColor.b;\r\n var iconColorDark = \"#aaaaaa\";\r\n var iconColorLight = \"#ffffff\";\r\n var closeIconColor;\r\n // Button settings\r\n var buttonFontSize;\r\n var butEdit;\r\n var buttonWidth;\r\n var buttonHeight;\r\n // Input Text Colors\r\n var inputFieldLabels = [\"R\", \"G\", \"B\"];\r\n var inputTextBackgroundColor = \"#454545\";\r\n var inputTextColor = \"#f0f0f0\";\r\n // This is the current color as set by either the picker or by entering a value\r\n var currentColor;\r\n // This int is used for naming swatches and serves as the index for calling them from the list\r\n var swatchNumber;\r\n // Menu Panel options. We need to know if the swatchDrawer exists so we can create it if needed.\r\n var swatchDrawer;\r\n var editSwatchMode = false;\r\n // Color InputText fields that will be updated upon value change\r\n var picker;\r\n var rValInt;\r\n var gValInt;\r\n var bValInt;\r\n var rValDec;\r\n var gValDec;\r\n var bValDec;\r\n var hexVal;\r\n var newSwatch;\r\n var lastVal;\r\n var activeField;\r\n /**\r\n * Will update all values for InputText and ColorPicker controls based on the BABYLON.Color3 passed to this function.\r\n * Each InputText control and the ColorPicker control will be tested to see if they are the activeField and if they\r\n * are will receive no update. This is to prevent the input from the user being overwritten.\r\n */\r\n function updateValues(value, inputField) {\r\n activeField = inputField;\r\n var pickedColor = value.toHexString();\r\n newSwatch.background = pickedColor;\r\n if (rValInt.name != activeField) {\r\n rValInt.text = Math.floor(value.r * 255).toString();\r\n }\r\n if (gValInt.name != activeField) {\r\n gValInt.text = Math.floor(value.g * 255).toString();\r\n }\r\n if (bValInt.name != activeField) {\r\n bValInt.text = Math.floor(value.b * 255).toString();\r\n }\r\n if (rValDec.name != activeField) {\r\n rValDec.text = value.r.toString();\r\n }\r\n if (gValDec.name != activeField) {\r\n gValDec.text = value.g.toString();\r\n }\r\n if (bValDec.name != activeField) {\r\n bValDec.text = value.b.toString();\r\n }\r\n if (hexVal.name != activeField) {\r\n var minusPound = pickedColor.split(\"#\");\r\n hexVal.text = minusPound[1];\r\n }\r\n if (picker.name != activeField) {\r\n picker.value = value;\r\n }\r\n }\r\n // When the user enters an integer for R, G, or B we check to make sure it is a valid number and replace if not.\r\n function updateInt(field, channel) {\r\n var newValue = field.text;\r\n var checkVal = /[^0-9]/g.test(newValue);\r\n if (checkVal) {\r\n field.text = lastVal;\r\n return;\r\n }\r\n else {\r\n if (newValue != \"\") {\r\n if (Math.floor(parseInt(newValue)) < 0) {\r\n newValue = \"0\";\r\n }\r\n else if (Math.floor(parseInt(newValue)) > 255) {\r\n newValue = \"255\";\r\n }\r\n else if (isNaN(parseInt(newValue))) {\r\n newValue = \"0\";\r\n }\r\n }\r\n if (activeField == field.name) {\r\n lastVal = newValue;\r\n }\r\n }\r\n if (newValue != \"\") {\r\n newValue = parseInt(newValue).toString();\r\n field.text = newValue;\r\n var newSwatchRGB = Color3.FromHexString(newSwatch.background);\r\n if (activeField == field.name) {\r\n if (channel == \"r\") {\r\n updateValues(new Color3((parseInt(newValue)) / 255, newSwatchRGB.g, newSwatchRGB.b), field.name);\r\n }\r\n else if (channel == \"g\") {\r\n updateValues(new Color3(newSwatchRGB.r, (parseInt(newValue)) / 255, newSwatchRGB.b), field.name);\r\n }\r\n else {\r\n updateValues(new Color3(newSwatchRGB.r, newSwatchRGB.g, (parseInt(newValue)) / 255), field.name);\r\n }\r\n }\r\n }\r\n }\r\n // When the user enters a float for R, G, or B we check to make sure it is a valid number and replace if not.\r\n function updateFloat(field, channel) {\r\n var newValue = field.text;\r\n var checkVal = /[^0-9\\.]/g.test(newValue);\r\n if (checkVal) {\r\n field.text = lastVal;\r\n return;\r\n }\r\n else {\r\n if (newValue != \"\" && newValue != \".\" && parseFloat(newValue) != 0) {\r\n if (parseFloat(newValue) < 0.0) {\r\n newValue = \"0.0\";\r\n }\r\n else if (parseFloat(newValue) > 1.0) {\r\n newValue = \"1.0\";\r\n }\r\n else if (isNaN(parseFloat(newValue))) {\r\n newValue = \"0.0\";\r\n }\r\n }\r\n if (activeField == field.name) {\r\n lastVal = newValue;\r\n }\r\n }\r\n if (newValue != \"\" && newValue != \".\" && parseFloat(newValue) != 0) {\r\n newValue = parseFloat(newValue).toString();\r\n field.text = newValue;\r\n }\r\n else {\r\n newValue = \"0.0\";\r\n }\r\n var newSwatchRGB = Color3.FromHexString(newSwatch.background);\r\n if (activeField == field.name) {\r\n if (channel == \"r\") {\r\n updateValues(new Color3(parseFloat(newValue), newSwatchRGB.g, newSwatchRGB.b), field.name);\r\n }\r\n else if (channel == \"g\") {\r\n updateValues(new Color3(newSwatchRGB.r, parseFloat(newValue), newSwatchRGB.b), field.name);\r\n }\r\n else {\r\n updateValues(new Color3(newSwatchRGB.r, newSwatchRGB.g, parseFloat(newValue)), field.name);\r\n }\r\n }\r\n }\r\n // Removes the current index from the savedColors array. Drawer can then be regenerated.\r\n function deleteSwatch(index) {\r\n if (options.savedColors) {\r\n options.savedColors.splice(index, 1);\r\n }\r\n if (options.savedColors && options.savedColors.length == 0) {\r\n setEditButtonVisibility(false);\r\n editSwatchMode = false;\r\n }\r\n }\r\n // Creates and styles an individual swatch when updateSwatches is called.\r\n function createSwatch() {\r\n if (options.savedColors && options.savedColors[swatchNumber]) {\r\n if (editSwatchMode) {\r\n var icon = \"b\";\r\n }\r\n else {\r\n var icon = \"\";\r\n }\r\n var swatch = Button.CreateSimpleButton(\"Swatch_\" + swatchNumber, icon);\r\n swatch.fontFamily = \"BabylonJSglyphs\";\r\n var swatchColor = Color3.FromHexString(options.savedColors[swatchNumber]);\r\n var swatchLuminence = swatchColor.r + swatchColor.g + swatchColor.b;\r\n // Set color of outline and textBlock based on luminance of the color swatch so feedback always visible\r\n if (swatchLuminence > luminanceLimit) {\r\n swatch.color = iconColorDark;\r\n }\r\n else {\r\n swatch.color = iconColorLight;\r\n }\r\n swatch.fontSize = Math.floor(swatchSize * 0.7);\r\n swatch.textBlock.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n swatch.height = swatch.width = (swatchSize).toString() + \"px\";\r\n swatch.background = options.savedColors[swatchNumber];\r\n swatch.thickness = 2;\r\n var metadata_1 = swatchNumber;\r\n swatch.pointerDownAnimation = function () {\r\n swatch.thickness = 4;\r\n };\r\n swatch.pointerUpAnimation = function () {\r\n swatch.thickness = 3;\r\n };\r\n swatch.pointerEnterAnimation = function () {\r\n swatch.thickness = 3;\r\n };\r\n swatch.pointerOutAnimation = function () {\r\n swatch.thickness = 2;\r\n };\r\n swatch.onPointerClickObservable.add(function () {\r\n if (!editSwatchMode) {\r\n if (options.savedColors) {\r\n updateValues(Color3.FromHexString(options.savedColors[metadata_1]), swatch.name);\r\n }\r\n }\r\n else {\r\n deleteSwatch(metadata_1);\r\n updateSwatches(\"\", butSave);\r\n }\r\n });\r\n return swatch;\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n // Mode switch to render button text and close symbols on swatch controls\r\n function editSwatches(mode) {\r\n if (mode !== undefined) {\r\n editSwatchMode = mode;\r\n }\r\n if (editSwatchMode) {\r\n for (var i = 0; i < swatchDrawer.children.length; i++) {\r\n var thisButton = swatchDrawer.children[i];\r\n thisButton.textBlock.text = \"b\";\r\n }\r\n if (butEdit !== undefined) {\r\n butEdit.textBlock.text = \"Done\";\r\n }\r\n }\r\n else {\r\n for (var i = 0; i < swatchDrawer.children.length; i++) {\r\n var thisButton = swatchDrawer.children[i];\r\n thisButton.textBlock.text = \"\";\r\n }\r\n if (butEdit !== undefined) {\r\n butEdit.textBlock.text = \"Edit\";\r\n }\r\n }\r\n }\r\n /**\r\n * When Save Color button is pressed this function will first create a swatch drawer if one is not already\r\n * made. Then all controls are removed from the drawer and we step through the savedColors array and\r\n * creates one swatch per color. It will also set the height of the drawer control based on how many\r\n * saved colors there are and how many can be stored per row.\r\n */\r\n function updateSwatches(color, button) {\r\n if (options.savedColors) {\r\n if (color != \"\") {\r\n options.savedColors.push(color);\r\n }\r\n swatchNumber = 0;\r\n swatchDrawer.clearControls();\r\n var rowCount = Math.ceil(options.savedColors.length / options.numSwatchesPerLine);\r\n if (rowCount == 0) {\r\n var gutterCount = 0;\r\n }\r\n else {\r\n var gutterCount = rowCount + 1;\r\n }\r\n if (swatchDrawer.rowCount != rowCount + gutterCount) {\r\n var currentRows = swatchDrawer.rowCount;\r\n for (var i = 0; i < currentRows; i++) {\r\n swatchDrawer.removeRowDefinition(0);\r\n }\r\n for (var i = 0; i < rowCount + gutterCount; i++) {\r\n if (i % 2) {\r\n swatchDrawer.addRowDefinition(swatchSize, true);\r\n }\r\n else {\r\n swatchDrawer.addRowDefinition(gutterSize, true);\r\n }\r\n }\r\n }\r\n swatchDrawer.height = ((swatchSize * rowCount) + (gutterCount * gutterSize)).toString() + \"px\";\r\n for (var y = 1, thisRow = 1; y < rowCount + gutterCount; y += 2, thisRow++) {\r\n // Determine number of buttons to create per row based on the button limit per row and number of saved colors\r\n if (options.savedColors.length > thisRow * options.numSwatchesPerLine) {\r\n var totalButtonsThisRow = options.numSwatchesPerLine;\r\n }\r\n else {\r\n var totalButtonsThisRow = options.savedColors.length - ((thisRow - 1) * options.numSwatchesPerLine);\r\n }\r\n var buttonIterations = (Math.min(Math.max(totalButtonsThisRow, 0), options.numSwatchesPerLine));\r\n for (var x = 0, w = 1; x < buttonIterations; x++) {\r\n if (x > options.numSwatchesPerLine) {\r\n continue;\r\n }\r\n var swatch = createSwatch();\r\n if (swatch != null) {\r\n swatchDrawer.addControl(swatch, y, w);\r\n w += 2;\r\n swatchNumber++;\r\n }\r\n else {\r\n continue;\r\n }\r\n }\r\n }\r\n if (options.savedColors.length >= options.swatchLimit) {\r\n disableButton(button, true);\r\n }\r\n else {\r\n disableButton(button, false);\r\n }\r\n }\r\n }\r\n // Shows or hides edit swatches button depending on if there are saved swatches\r\n function setEditButtonVisibility(enableButton) {\r\n if (enableButton) {\r\n butEdit = Button.CreateSimpleButton(\"butEdit\", \"Edit\");\r\n butEdit.width = buttonWidth;\r\n butEdit.height = buttonHeight;\r\n butEdit.left = (Math.floor(parseInt(buttonWidth) * 0.1)).toString() + \"px\";\r\n butEdit.top = (parseFloat(butEdit.left) * -1).toString() + \"px\";\r\n butEdit.verticalAlignment = Control.VERTICAL_ALIGNMENT_BOTTOM;\r\n butEdit.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n butEdit.thickness = 2;\r\n butEdit.color = buttonColor;\r\n butEdit.fontSize = buttonFontSize;\r\n butEdit.background = buttonBackgroundColor;\r\n butEdit.onPointerEnterObservable.add(function () {\r\n butEdit.background = buttonBackgroundHoverColor;\r\n });\r\n butEdit.onPointerOutObservable.add(function () {\r\n butEdit.background = buttonBackgroundColor;\r\n });\r\n butEdit.pointerDownAnimation = function () {\r\n butEdit.background = buttonBackgroundClickColor;\r\n };\r\n butEdit.pointerUpAnimation = function () {\r\n butEdit.background = buttonBackgroundHoverColor;\r\n };\r\n butEdit.onPointerClickObservable.add(function () {\r\n if (editSwatchMode) {\r\n editSwatchMode = false;\r\n }\r\n else {\r\n editSwatchMode = true;\r\n }\r\n editSwatches();\r\n });\r\n pickerGrid.addControl(butEdit, 1, 0);\r\n }\r\n else {\r\n pickerGrid.removeControl(butEdit);\r\n }\r\n }\r\n // Called when the user hits the limit of saved colors in the drawer.\r\n function disableButton(button, disabled) {\r\n if (disabled) {\r\n button.color = buttonDisabledColor;\r\n button.background = buttonDisabledBackgroundColor;\r\n }\r\n else {\r\n button.color = buttonColor;\r\n button.background = buttonBackgroundColor;\r\n }\r\n }\r\n // Passes last chosen color back to scene and kills dialog by removing from AdvancedDynamicTexture\r\n function closePicker(color) {\r\n if (options.savedColors && options.savedColors.length > 0) {\r\n resolve({\r\n savedColors: options.savedColors,\r\n pickedColor: color\r\n });\r\n }\r\n else {\r\n resolve({\r\n pickedColor: color\r\n });\r\n }\r\n advancedTexture.removeControl(dialogContainer);\r\n }\r\n // Dialogue menu container which will contain both the main dialogue window and the swatch drawer which opens once a color is saved.\r\n var dialogContainer = new Grid();\r\n dialogContainer.name = \"Dialog Container\";\r\n dialogContainer.width = options.pickerWidth;\r\n if (options.savedColors) {\r\n dialogContainer.height = containerSize;\r\n var topRow = parseInt(options.pickerHeight) / parseInt(containerSize);\r\n dialogContainer.addRowDefinition(topRow, false);\r\n dialogContainer.addRowDefinition(1.0 - topRow, false);\r\n }\r\n else {\r\n dialogContainer.height = options.pickerHeight;\r\n dialogContainer.addRowDefinition(1.0, false);\r\n }\r\n advancedTexture.addControl(dialogContainer);\r\n // Swatch drawer which contains all saved color buttons\r\n if (options.savedColors) {\r\n swatchDrawer = new Grid();\r\n swatchDrawer.name = \"Swatch Drawer\";\r\n swatchDrawer.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n swatchDrawer.background = buttonBackgroundColor;\r\n swatchDrawer.width = options.pickerWidth;\r\n var initialRows = options.savedColors.length / options.numSwatchesPerLine;\r\n if (initialRows == 0) {\r\n var gutterCount = 0;\r\n }\r\n else {\r\n var gutterCount = initialRows + 1;\r\n }\r\n swatchDrawer.height = ((swatchSize * initialRows) + (gutterCount * gutterSize)).toString() + \"px\";\r\n swatchDrawer.top = Math.floor(swatchSize * 0.25).toString() + \"px\";\r\n for (var i = 0; i < (Math.ceil(options.savedColors.length / options.numSwatchesPerLine) * 2) + 1; i++) {\r\n if (i % 2 != 0) {\r\n swatchDrawer.addRowDefinition(swatchSize, true);\r\n }\r\n else {\r\n swatchDrawer.addRowDefinition(gutterSize, true);\r\n }\r\n }\r\n for (var i = 0; i < options.numSwatchesPerLine * 2 + 1; i++) {\r\n if (i % 2 != 0) {\r\n swatchDrawer.addColumnDefinition(swatchSize, true);\r\n }\r\n else {\r\n swatchDrawer.addColumnDefinition(gutterSize, true);\r\n }\r\n }\r\n dialogContainer.addControl(swatchDrawer, 1, 0);\r\n }\r\n // Picker container\r\n var pickerPanel = new Grid();\r\n pickerPanel.name = \"Picker Panel\";\r\n pickerPanel.height = options.pickerHeight;\r\n var panelHead = parseInt(options.headerHeight) / parseInt(options.pickerHeight);\r\n var pickerPanelRows = [panelHead, 1.0 - panelHead];\r\n pickerPanel.addRowDefinition(pickerPanelRows[0], false);\r\n pickerPanel.addRowDefinition(pickerPanelRows[1], false);\r\n dialogContainer.addControl(pickerPanel, 0, 0);\r\n // Picker container header\r\n var header = new Rectangle();\r\n header.name = \"Dialogue Header Bar\";\r\n header.background = \"#cccccc\";\r\n header.thickness = 0;\r\n pickerPanel.addControl(header, 0, 0);\r\n // Header close button\r\n var closeButton = Button.CreateSimpleButton(\"closeButton\", \"a\");\r\n closeButton.fontFamily = \"BabylonJSglyphs\";\r\n var headerColor3 = Color3.FromHexString(header.background);\r\n closeIconColor = new Color3(1.0 - headerColor3.r, 1.0 - headerColor3.g, 1.0 - headerColor3.b);\r\n closeButton.color = closeIconColor.toHexString();\r\n closeButton.fontSize = Math.floor(parseInt(options.headerHeight) * 0.6);\r\n closeButton.textBlock.textVerticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n closeButton.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_RIGHT;\r\n closeButton.height = closeButton.width = options.headerHeight;\r\n closeButton.background = header.background;\r\n closeButton.thickness = 0;\r\n closeButton.pointerDownAnimation = function () {\r\n };\r\n closeButton.pointerUpAnimation = function () {\r\n closeButton.background = header.background;\r\n };\r\n closeButton.pointerEnterAnimation = function () {\r\n closeButton.color = header.background;\r\n closeButton.background = \"red\";\r\n };\r\n closeButton.pointerOutAnimation = function () {\r\n closeButton.color = closeIconColor.toHexString();\r\n closeButton.background = header.background;\r\n };\r\n closeButton.onPointerClickObservable.add(function () {\r\n closePicker(currentSwatch.background);\r\n });\r\n pickerPanel.addControl(closeButton, 0, 0);\r\n // Dialog container body\r\n var dialogBody = new Grid();\r\n dialogBody.name = \"Dialogue Body\";\r\n dialogBody.background = buttonBackgroundColor;\r\n var dialogBodyCols = [0.4375, 0.5625];\r\n dialogBody.addRowDefinition(1.0, false);\r\n dialogBody.addColumnDefinition(dialogBodyCols[0], false);\r\n dialogBody.addColumnDefinition(dialogBodyCols[1], false);\r\n pickerPanel.addControl(dialogBody, 1, 0);\r\n // Picker grid\r\n var pickerGrid = new Grid();\r\n pickerGrid.name = \"Picker Grid\";\r\n pickerGrid.addRowDefinition(0.85, false);\r\n pickerGrid.addRowDefinition(0.15, false);\r\n dialogBody.addControl(pickerGrid, 0, 0);\r\n // Picker control\r\n picker = new ColorPicker();\r\n picker.name = \"GUI Color Picker\";\r\n if (options.pickerHeight < options.pickerWidth) {\r\n picker.width = 0.89;\r\n }\r\n else {\r\n picker.height = 0.89;\r\n }\r\n picker.value = Color3.FromHexString(options.lastColor);\r\n picker.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n picker.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n picker.onPointerDownObservable.add(function () {\r\n activeField = picker.name;\r\n lastVal = \"\";\r\n editSwatches(false);\r\n });\r\n picker.onValueChangedObservable.add(function (value) {\r\n if (activeField == picker.name) {\r\n updateValues(value, picker.name);\r\n }\r\n });\r\n pickerGrid.addControl(picker, 0, 0);\r\n // Picker body right quarant\r\n var pickerBodyRight = new Grid();\r\n pickerBodyRight.name = \"Dialogue Right Half\";\r\n pickerBodyRight.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n var pickerBodyRightRows = [0.514, 0.486];\r\n pickerBodyRight.addRowDefinition(pickerBodyRightRows[0], false);\r\n pickerBodyRight.addRowDefinition(pickerBodyRightRows[1], false);\r\n dialogBody.addControl(pickerBodyRight, 1, 1);\r\n // Picker container swatches and buttons\r\n var pickerSwatchesButtons = new Grid();\r\n pickerSwatchesButtons.name = \"Swatches and Buttons\";\r\n var pickerButtonsCol = [0.417, 0.583];\r\n pickerSwatchesButtons.addRowDefinition(1.0, false);\r\n pickerSwatchesButtons.addColumnDefinition(pickerButtonsCol[0], false);\r\n pickerSwatchesButtons.addColumnDefinition(pickerButtonsCol[1], false);\r\n pickerBodyRight.addControl(pickerSwatchesButtons, 0, 0);\r\n // Picker Swatches quadrant\r\n var pickerSwatches = new Grid();\r\n pickerSwatches.name = \"New and Current Swatches\";\r\n var pickeSwatchesRows = [0.04, 0.16, 0.64, 0.16];\r\n pickerSwatches.addRowDefinition(pickeSwatchesRows[0], false);\r\n pickerSwatches.addRowDefinition(pickeSwatchesRows[1], false);\r\n pickerSwatches.addRowDefinition(pickeSwatchesRows[2], false);\r\n pickerSwatches.addRowDefinition(pickeSwatchesRows[3], false);\r\n pickerSwatchesButtons.addControl(pickerSwatches, 0, 0);\r\n // Active swatches\r\n var activeSwatches = new Grid();\r\n activeSwatches.name = \"Active Swatches\";\r\n activeSwatches.width = 0.67;\r\n activeSwatches.addRowDefinition(0.5, false);\r\n activeSwatches.addRowDefinition(0.5, false);\r\n pickerSwatches.addControl(activeSwatches, 2, 0);\r\n var labelWidth = (Math.floor(parseInt(options.pickerWidth) * dialogBodyCols[1] * pickerButtonsCol[0] * 0.11));\r\n var labelHeight = (Math.floor(parseInt(options.pickerHeight) * pickerPanelRows[1] * pickerBodyRightRows[0] * pickeSwatchesRows[1] * 0.5));\r\n if (options.pickerWidth > options.pickerHeight) {\r\n var labelTextSize = labelHeight;\r\n }\r\n else {\r\n var labelTextSize = labelWidth;\r\n }\r\n // New color swatch and previous color button\r\n var newText = new TextBlock();\r\n newText.text = \"new\";\r\n newText.name = \"New Color Label\";\r\n newText.color = buttonColor;\r\n newText.fontSize = labelTextSize;\r\n pickerSwatches.addControl(newText, 1, 0);\r\n newSwatch = new Rectangle();\r\n newSwatch.name = \"New Color Swatch\";\r\n newSwatch.background = options.lastColor;\r\n newSwatch.thickness = 0;\r\n activeSwatches.addControl(newSwatch, 0, 0);\r\n var currentSwatch = Button.CreateSimpleButton(\"currentSwatch\", \"\");\r\n currentSwatch.background = options.lastColor;\r\n currentSwatch.thickness = 0;\r\n currentSwatch.onPointerClickObservable.add(function () {\r\n var revertColor = Color3.FromHexString(currentSwatch.background);\r\n updateValues(revertColor, currentSwatch.name);\r\n editSwatches(false);\r\n });\r\n currentSwatch.pointerDownAnimation = function () { };\r\n currentSwatch.pointerUpAnimation = function () { };\r\n currentSwatch.pointerEnterAnimation = function () { };\r\n currentSwatch.pointerOutAnimation = function () { };\r\n activeSwatches.addControl(currentSwatch, 1, 0);\r\n var swatchOutline = new Rectangle();\r\n swatchOutline.name = \"Swatch Outline\";\r\n swatchOutline.width = 0.67;\r\n swatchOutline.thickness = 2;\r\n swatchOutline.color = currentSwatchesOutlineColor;\r\n swatchOutline.isHitTestVisible = false;\r\n pickerSwatches.addControl(swatchOutline, 2, 0);\r\n var currentText = new TextBlock();\r\n currentText.name = \"Current Color Label\";\r\n currentText.text = \"current\";\r\n currentText.color = buttonColor;\r\n currentText.fontSize = labelTextSize;\r\n pickerSwatches.addControl(currentText, 3, 0);\r\n // Buttons grid\r\n var buttonGrid = new Grid();\r\n buttonGrid.name = \"Button Grid\";\r\n buttonGrid.height = 0.8;\r\n var buttonGridRows = 1 / 3;\r\n buttonGrid.addRowDefinition(buttonGridRows, false);\r\n buttonGrid.addRowDefinition(buttonGridRows, false);\r\n buttonGrid.addRowDefinition(buttonGridRows, false);\r\n pickerSwatchesButtons.addControl(buttonGrid, 0, 1);\r\n // Determine pixel width and height for all buttons from overall panel dimensions\r\n buttonWidth = (Math.floor(parseInt(options.pickerWidth) * dialogBodyCols[1] * pickerButtonsCol[1] * 0.67)).toString() + \"px\";\r\n buttonHeight = (Math.floor(parseInt(options.pickerHeight) * pickerPanelRows[1] * pickerBodyRightRows[0] * (parseFloat(buttonGrid.height.toString()) / 100) * buttonGridRows * 0.7)).toString() + \"px\";\r\n // Determine button type size\r\n if (parseFloat(buttonWidth) > parseFloat(buttonHeight)) {\r\n buttonFontSize = Math.floor(parseFloat(buttonHeight) * 0.45);\r\n }\r\n else {\r\n buttonFontSize = Math.floor(parseFloat(buttonWidth) * 0.11);\r\n }\r\n // Panel Buttons\r\n var butOK = Button.CreateSimpleButton(\"butOK\", \"OK\");\r\n butOK.width = buttonWidth;\r\n butOK.height = buttonHeight;\r\n butOK.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n butOK.thickness = 2;\r\n butOK.color = buttonColor;\r\n butOK.fontSize = buttonFontSize;\r\n butOK.background = buttonBackgroundColor;\r\n butOK.onPointerEnterObservable.add(function () { butOK.background = buttonBackgroundHoverColor; });\r\n butOK.onPointerOutObservable.add(function () { butOK.background = buttonBackgroundColor; });\r\n butOK.pointerDownAnimation = function () {\r\n butOK.background = buttonBackgroundClickColor;\r\n };\r\n butOK.pointerUpAnimation = function () {\r\n butOK.background = buttonBackgroundHoverColor;\r\n };\r\n butOK.onPointerClickObservable.add(function () {\r\n editSwatches(false);\r\n closePicker(newSwatch.background);\r\n });\r\n buttonGrid.addControl(butOK, 0, 0);\r\n var butCancel = Button.CreateSimpleButton(\"butCancel\", \"Cancel\");\r\n butCancel.width = buttonWidth;\r\n butCancel.height = buttonHeight;\r\n butCancel.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n butCancel.thickness = 2;\r\n butCancel.color = buttonColor;\r\n butCancel.fontSize = buttonFontSize;\r\n butCancel.background = buttonBackgroundColor;\r\n butCancel.onPointerEnterObservable.add(function () { butCancel.background = buttonBackgroundHoverColor; });\r\n butCancel.onPointerOutObservable.add(function () { butCancel.background = buttonBackgroundColor; });\r\n butCancel.pointerDownAnimation = function () {\r\n butCancel.background = buttonBackgroundClickColor;\r\n };\r\n butCancel.pointerUpAnimation = function () {\r\n butCancel.background = buttonBackgroundHoverColor;\r\n };\r\n butCancel.onPointerClickObservable.add(function () {\r\n editSwatches(false);\r\n closePicker(currentSwatch.background);\r\n });\r\n buttonGrid.addControl(butCancel, 1, 0);\r\n if (options.savedColors) {\r\n var butSave = Button.CreateSimpleButton(\"butSave\", \"Save\");\r\n butSave.width = buttonWidth;\r\n butSave.height = buttonHeight;\r\n butSave.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n butSave.thickness = 2;\r\n butSave.fontSize = buttonFontSize;\r\n if (options.savedColors.length < options.swatchLimit) {\r\n butSave.color = buttonColor;\r\n butSave.background = buttonBackgroundColor;\r\n }\r\n else {\r\n disableButton(butSave, true);\r\n }\r\n butSave.onPointerEnterObservable.add(function () {\r\n if (options.savedColors) {\r\n if (options.savedColors.length < options.swatchLimit) {\r\n butSave.background = buttonBackgroundHoverColor;\r\n }\r\n }\r\n });\r\n butSave.onPointerOutObservable.add(function () {\r\n if (options.savedColors) {\r\n if (options.savedColors.length < options.swatchLimit) {\r\n butSave.background = buttonBackgroundColor;\r\n }\r\n }\r\n });\r\n butSave.pointerDownAnimation = function () {\r\n if (options.savedColors) {\r\n if (options.savedColors.length < options.swatchLimit) {\r\n butSave.background = buttonBackgroundClickColor;\r\n }\r\n }\r\n };\r\n butSave.pointerUpAnimation = function () {\r\n if (options.savedColors) {\r\n if (options.savedColors.length < options.swatchLimit) {\r\n butSave.background = buttonBackgroundHoverColor;\r\n }\r\n }\r\n };\r\n butSave.onPointerClickObservable.add(function () {\r\n if (options.savedColors) {\r\n if (options.savedColors.length == 0) {\r\n setEditButtonVisibility(true);\r\n }\r\n if (options.savedColors.length < options.swatchLimit) {\r\n updateSwatches(newSwatch.background, butSave);\r\n }\r\n editSwatches(false);\r\n }\r\n });\r\n if (options.savedColors.length > 0) {\r\n setEditButtonVisibility(true);\r\n }\r\n buttonGrid.addControl(butSave, 2, 0);\r\n }\r\n // Picker color values input\r\n var pickerColorValues = new Grid();\r\n pickerColorValues.name = \"Dialog Lower Right\";\r\n pickerColorValues.addRowDefinition(0.02, false);\r\n pickerColorValues.addRowDefinition(0.63, false);\r\n pickerColorValues.addRowDefinition(0.21, false);\r\n pickerColorValues.addRowDefinition(0.14, false);\r\n pickerBodyRight.addControl(pickerColorValues, 1, 0);\r\n // RGB values text boxes\r\n currentColor = Color3.FromHexString(options.lastColor);\r\n var rgbValuesQuadrant = new Grid();\r\n rgbValuesQuadrant.name = \"RGB Values\";\r\n rgbValuesQuadrant.width = 0.82;\r\n rgbValuesQuadrant.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n rgbValuesQuadrant.addRowDefinition(1 / 3, false);\r\n rgbValuesQuadrant.addRowDefinition(1 / 3, false);\r\n rgbValuesQuadrant.addRowDefinition(1 / 3, false);\r\n rgbValuesQuadrant.addColumnDefinition(0.1, false);\r\n rgbValuesQuadrant.addColumnDefinition(0.2, false);\r\n rgbValuesQuadrant.addColumnDefinition(0.7, false);\r\n pickerColorValues.addControl(rgbValuesQuadrant, 1, 0);\r\n for (var i = 0; i < inputFieldLabels.length; i++) {\r\n var labelText = new TextBlock();\r\n labelText.text = inputFieldLabels[i];\r\n labelText.color = buttonColor;\r\n labelText.fontSize = buttonFontSize;\r\n rgbValuesQuadrant.addControl(labelText, i, 0);\r\n }\r\n // Input fields for RGB values\r\n rValInt = new InputText();\r\n rValInt.width = 0.83;\r\n rValInt.height = 0.72;\r\n rValInt.name = \"rIntField\";\r\n rValInt.fontSize = buttonFontSize;\r\n rValInt.text = (currentColor.r * 255).toString();\r\n rValInt.color = inputTextColor;\r\n rValInt.background = inputTextBackgroundColor;\r\n rValInt.onFocusObservable.add(function () {\r\n activeField = rValInt.name;\r\n lastVal = rValInt.text;\r\n editSwatches(false);\r\n });\r\n rValInt.onBlurObservable.add(function () {\r\n if (rValInt.text == \"\") {\r\n rValInt.text = \"0\";\r\n }\r\n updateInt(rValInt, \"r\");\r\n if (activeField == rValInt.name) {\r\n activeField = \"\";\r\n }\r\n });\r\n rValInt.onTextChangedObservable.add(function () {\r\n if (activeField == rValInt.name) {\r\n updateInt(rValInt, \"r\");\r\n }\r\n });\r\n rgbValuesQuadrant.addControl(rValInt, 0, 1);\r\n gValInt = new InputText();\r\n gValInt.width = 0.83;\r\n gValInt.height = 0.72;\r\n gValInt.name = \"gIntField\";\r\n gValInt.fontSize = buttonFontSize;\r\n gValInt.text = (currentColor.g * 255).toString();\r\n gValInt.color = inputTextColor;\r\n gValInt.background = inputTextBackgroundColor;\r\n gValInt.onFocusObservable.add(function () {\r\n activeField = gValInt.name;\r\n lastVal = gValInt.text;\r\n editSwatches(false);\r\n });\r\n gValInt.onBlurObservable.add(function () {\r\n if (gValInt.text == \"\") {\r\n gValInt.text = \"0\";\r\n }\r\n updateInt(gValInt, \"g\");\r\n if (activeField == gValInt.name) {\r\n activeField = \"\";\r\n }\r\n });\r\n gValInt.onTextChangedObservable.add(function () {\r\n if (activeField == gValInt.name) {\r\n updateInt(gValInt, \"g\");\r\n }\r\n });\r\n rgbValuesQuadrant.addControl(gValInt, 1, 1);\r\n bValInt = new InputText();\r\n bValInt.width = 0.83;\r\n bValInt.height = 0.72;\r\n bValInt.name = \"bIntField\";\r\n bValInt.fontSize = buttonFontSize;\r\n bValInt.text = (currentColor.b * 255).toString();\r\n bValInt.color = inputTextColor;\r\n bValInt.background = inputTextBackgroundColor;\r\n bValInt.onFocusObservable.add(function () {\r\n activeField = bValInt.name;\r\n lastVal = bValInt.text;\r\n editSwatches(false);\r\n });\r\n bValInt.onBlurObservable.add(function () {\r\n if (bValInt.text == \"\") {\r\n bValInt.text = \"0\";\r\n }\r\n updateInt(bValInt, \"b\");\r\n if (activeField == bValInt.name) {\r\n activeField = \"\";\r\n }\r\n });\r\n bValInt.onTextChangedObservable.add(function () {\r\n if (activeField == bValInt.name) {\r\n updateInt(bValInt, \"b\");\r\n }\r\n });\r\n rgbValuesQuadrant.addControl(bValInt, 2, 1);\r\n rValDec = new InputText();\r\n rValDec.width = 0.95;\r\n rValDec.height = 0.72;\r\n rValDec.name = \"rDecField\";\r\n rValDec.fontSize = buttonFontSize;\r\n rValDec.text = currentColor.r.toString();\r\n rValDec.color = inputTextColor;\r\n rValDec.background = inputTextBackgroundColor;\r\n rValDec.onFocusObservable.add(function () {\r\n activeField = rValDec.name;\r\n lastVal = rValDec.text;\r\n editSwatches(false);\r\n });\r\n rValDec.onBlurObservable.add(function () {\r\n if (parseFloat(rValDec.text) == 0 || rValDec.text == \"\") {\r\n rValDec.text = \"0\";\r\n updateFloat(rValDec, \"r\");\r\n }\r\n if (activeField == rValDec.name) {\r\n activeField = \"\";\r\n }\r\n });\r\n rValDec.onTextChangedObservable.add(function () {\r\n if (activeField == rValDec.name) {\r\n updateFloat(rValDec, \"r\");\r\n }\r\n });\r\n rgbValuesQuadrant.addControl(rValDec, 0, 2);\r\n gValDec = new InputText();\r\n gValDec.width = 0.95;\r\n gValDec.height = 0.72;\r\n gValDec.name = \"gDecField\";\r\n gValDec.fontSize = buttonFontSize;\r\n gValDec.text = currentColor.g.toString();\r\n gValDec.color = inputTextColor;\r\n gValDec.background = inputTextBackgroundColor;\r\n gValDec.onFocusObservable.add(function () {\r\n activeField = gValDec.name;\r\n lastVal = gValDec.text;\r\n editSwatches(false);\r\n });\r\n gValDec.onBlurObservable.add(function () {\r\n if (parseFloat(gValDec.text) == 0 || gValDec.text == \"\") {\r\n gValDec.text = \"0\";\r\n updateFloat(gValDec, \"g\");\r\n }\r\n if (activeField == gValDec.name) {\r\n activeField = \"\";\r\n }\r\n });\r\n gValDec.onTextChangedObservable.add(function () {\r\n if (activeField == gValDec.name) {\r\n updateFloat(gValDec, \"g\");\r\n }\r\n });\r\n rgbValuesQuadrant.addControl(gValDec, 1, 2);\r\n bValDec = new InputText();\r\n bValDec.width = 0.95;\r\n bValDec.height = 0.72;\r\n bValDec.name = \"bDecField\";\r\n bValDec.fontSize = buttonFontSize;\r\n bValDec.text = currentColor.b.toString();\r\n bValDec.color = inputTextColor;\r\n bValDec.background = inputTextBackgroundColor;\r\n bValDec.onFocusObservable.add(function () {\r\n activeField = bValDec.name;\r\n lastVal = bValDec.text;\r\n editSwatches(false);\r\n });\r\n bValDec.onBlurObservable.add(function () {\r\n if (parseFloat(bValDec.text) == 0 || bValDec.text == \"\") {\r\n bValDec.text = \"0\";\r\n updateFloat(bValDec, \"b\");\r\n }\r\n if (activeField == bValDec.name) {\r\n activeField = \"\";\r\n }\r\n });\r\n bValDec.onTextChangedObservable.add(function () {\r\n if (activeField == bValDec.name) {\r\n updateFloat(bValDec, \"b\");\r\n }\r\n });\r\n rgbValuesQuadrant.addControl(bValDec, 2, 2);\r\n // Hex value input\r\n var hexValueQuadrant = new Grid();\r\n hexValueQuadrant.name = \"Hex Value\";\r\n hexValueQuadrant.width = 0.82;\r\n hexValueQuadrant.addRowDefinition(1.0, false);\r\n hexValueQuadrant.addColumnDefinition(0.1, false);\r\n hexValueQuadrant.addColumnDefinition(0.9, false);\r\n pickerColorValues.addControl(hexValueQuadrant, 2, 0);\r\n var labelText = new TextBlock();\r\n labelText.text = \"#\";\r\n labelText.color = buttonColor;\r\n labelText.fontSize = buttonFontSize;\r\n hexValueQuadrant.addControl(labelText, 0, 0);\r\n hexVal = new InputText();\r\n hexVal.width = 0.96;\r\n hexVal.height = 0.72;\r\n hexVal.name = \"hexField\";\r\n hexVal.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n hexVal.fontSize = buttonFontSize;\r\n var minusPound = options.lastColor.split(\"#\");\r\n hexVal.text = minusPound[1];\r\n hexVal.color = inputTextColor;\r\n hexVal.background = inputTextBackgroundColor;\r\n hexVal.onFocusObservable.add(function () {\r\n activeField = hexVal.name;\r\n lastVal = hexVal.text;\r\n editSwatches(false);\r\n });\r\n hexVal.onBlurObservable.add(function () {\r\n if (hexVal.text.length == 3) {\r\n var val = hexVal.text.split(\"\");\r\n hexVal.text = val[0] + val[0] + val[1] + val[1] + val[2] + val[2];\r\n }\r\n if (hexVal.text == \"\") {\r\n hexVal.text = \"000000\";\r\n updateValues(Color3.FromHexString(hexVal.text), \"b\");\r\n }\r\n if (activeField == hexVal.name) {\r\n activeField = \"\";\r\n }\r\n });\r\n hexVal.onTextChangedObservable.add(function () {\r\n var newHexValue = hexVal.text;\r\n var checkHex = /[^0-9A-F]/i.test(newHexValue);\r\n if ((hexVal.text.length > 6 || checkHex) && activeField == hexVal.name) {\r\n hexVal.text = lastVal;\r\n }\r\n else {\r\n if (hexVal.text.length < 6) {\r\n var leadingZero = 6 - hexVal.text.length;\r\n for (var i = 0; i < leadingZero; i++) {\r\n newHexValue = \"0\" + newHexValue;\r\n }\r\n }\r\n if (hexVal.text.length == 3) {\r\n var val = hexVal.text.split(\"\");\r\n newHexValue = val[0] + val[0] + val[1] + val[1] + val[2] + val[2];\r\n }\r\n newHexValue = \"#\" + newHexValue;\r\n if (activeField == hexVal.name) {\r\n lastVal = hexVal.text;\r\n updateValues(Color3.FromHexString(newHexValue), hexVal.name);\r\n }\r\n }\r\n });\r\n hexValueQuadrant.addControl(hexVal, 0, 1);\r\n if (options.savedColors && options.savedColors.length > 0) {\r\n updateSwatches(\"\", butSave);\r\n }\r\n });\r\n };\r\n ColorPicker._Epsilon = 0.000001;\r\n return ColorPicker;\r\n}(Control));\r\nexport { ColorPicker };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.ColorPicker\"] = ColorPicker;\r\n//# sourceMappingURL=colorpicker.js.map","import { __extends } from \"tslib\";\r\nimport { Container } from \"./container\";\r\nimport { Control } from \"./control\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/** Class used to create 2D ellipse containers */\r\nvar Ellipse = /** @class */ (function (_super) {\r\n __extends(Ellipse, _super);\r\n /**\r\n * Creates a new Ellipse\r\n * @param name defines the control name\r\n */\r\n function Ellipse(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._thickness = 1;\r\n return _this;\r\n }\r\n Object.defineProperty(Ellipse.prototype, \"thickness\", {\r\n /** Gets or sets border thickness */\r\n get: function () {\r\n return this._thickness;\r\n },\r\n set: function (value) {\r\n if (this._thickness === value) {\r\n return;\r\n }\r\n this._thickness = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Ellipse.prototype._getTypeName = function () {\r\n return \"Ellipse\";\r\n };\r\n Ellipse.prototype._localDraw = function (context) {\r\n context.save();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n Control.drawEllipse(this._currentMeasure.left + this._currentMeasure.width / 2, this._currentMeasure.top + this._currentMeasure.height / 2, this._currentMeasure.width / 2 - this._thickness / 2, this._currentMeasure.height / 2 - this._thickness / 2, context);\r\n if (this._background) {\r\n context.fillStyle = this._background;\r\n context.fill();\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n if (this._thickness) {\r\n if (this.color) {\r\n context.strokeStyle = this.color;\r\n }\r\n context.lineWidth = this._thickness;\r\n context.stroke();\r\n }\r\n context.restore();\r\n };\r\n Ellipse.prototype._additionalProcessing = function (parentMeasure, context) {\r\n _super.prototype._additionalProcessing.call(this, parentMeasure, context);\r\n this._measureForChildren.width -= 2 * this._thickness;\r\n this._measureForChildren.height -= 2 * this._thickness;\r\n this._measureForChildren.left += this._thickness;\r\n this._measureForChildren.top += this._thickness;\r\n };\r\n Ellipse.prototype._clipForChildren = function (context) {\r\n Control.drawEllipse(this._currentMeasure.left + this._currentMeasure.width / 2, this._currentMeasure.top + this._currentMeasure.height / 2, this._currentMeasure.width / 2, this._currentMeasure.height / 2, context);\r\n context.clip();\r\n };\r\n return Ellipse;\r\n}(Container));\r\nexport { Ellipse };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Ellipse\"] = Ellipse;\r\n//# sourceMappingURL=ellipse.js.map","import { __extends } from \"tslib\";\r\nimport { InputText } from \"./inputText\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\nimport { TextWrapper } from './textWrapper';\r\n/**\r\n * Class used to create a password control\r\n */\r\nvar InputPassword = /** @class */ (function (_super) {\r\n __extends(InputPassword, _super);\r\n function InputPassword() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n InputPassword.prototype._beforeRenderText = function (textWrapper) {\r\n var pwdTextWrapper = new TextWrapper();\r\n var txt = \"\";\r\n for (var i = 0; i < textWrapper.length; i++) {\r\n txt += \"\\u2022\";\r\n }\r\n pwdTextWrapper.text = txt;\r\n return pwdTextWrapper;\r\n };\r\n return InputPassword;\r\n}(InputText));\r\nexport { InputPassword };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.InputPassword\"] = InputPassword;\r\n//# sourceMappingURL=inputPassword.js.map","import { __extends } from \"tslib\";\r\nimport { Vector3, Matrix } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Control } from \"./control\";\r\nimport { ValueAndUnit } from \"../valueAndUnit\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/** Class used to render 2D lines */\r\nvar Line = /** @class */ (function (_super) {\r\n __extends(Line, _super);\r\n /**\r\n * Creates a new Line\r\n * @param name defines the control name\r\n */\r\n function Line(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._lineWidth = 1;\r\n _this._x1 = new ValueAndUnit(0);\r\n _this._y1 = new ValueAndUnit(0);\r\n _this._x2 = new ValueAndUnit(0);\r\n _this._y2 = new ValueAndUnit(0);\r\n _this._dash = new Array();\r\n _this._automaticSize = true;\r\n _this.isHitTestVisible = false;\r\n _this._horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _this._verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n return _this;\r\n }\r\n Object.defineProperty(Line.prototype, \"dash\", {\r\n /** Gets or sets the dash pattern */\r\n get: function () {\r\n return this._dash;\r\n },\r\n set: function (value) {\r\n if (this._dash === value) {\r\n return;\r\n }\r\n this._dash = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"connectedControl\", {\r\n /** Gets or sets the control connected with the line end */\r\n get: function () {\r\n return this._connectedControl;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._connectedControl === value) {\r\n return;\r\n }\r\n if (this._connectedControlDirtyObserver && this._connectedControl) {\r\n this._connectedControl.onDirtyObservable.remove(this._connectedControlDirtyObserver);\r\n this._connectedControlDirtyObserver = null;\r\n }\r\n if (value) {\r\n this._connectedControlDirtyObserver = value.onDirtyObservable.add(function () { return _this._markAsDirty(); });\r\n }\r\n this._connectedControl = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"x1\", {\r\n /** Gets or sets start coordinates on X axis */\r\n get: function () {\r\n return this._x1.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._x1.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._x1.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"y1\", {\r\n /** Gets or sets start coordinates on Y axis */\r\n get: function () {\r\n return this._y1.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._y1.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._y1.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"x2\", {\r\n /** Gets or sets end coordinates on X axis */\r\n get: function () {\r\n return this._x2.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._x2.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._x2.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"y2\", {\r\n /** Gets or sets end coordinates on Y axis */\r\n get: function () {\r\n return this._y2.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._y2.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._y2.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"lineWidth\", {\r\n /** Gets or sets line width */\r\n get: function () {\r\n return this._lineWidth;\r\n },\r\n set: function (value) {\r\n if (this._lineWidth === value) {\r\n return;\r\n }\r\n this._lineWidth = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"horizontalAlignment\", {\r\n /** Gets or sets horizontal alignment */\r\n set: function (value) {\r\n return;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"verticalAlignment\", {\r\n /** Gets or sets vertical alignment */\r\n set: function (value) {\r\n return;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"_effectiveX2\", {\r\n get: function () {\r\n return (this._connectedControl ? this._connectedControl.centerX : 0) + this._x2.getValue(this._host);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Line.prototype, \"_effectiveY2\", {\r\n get: function () {\r\n return (this._connectedControl ? this._connectedControl.centerY : 0) + this._y2.getValue(this._host);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Line.prototype._getTypeName = function () {\r\n return \"Line\";\r\n };\r\n Line.prototype._draw = function (context) {\r\n context.save();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n this._applyStates(context);\r\n context.strokeStyle = this.color;\r\n context.lineWidth = this._lineWidth;\r\n context.setLineDash(this._dash);\r\n context.beginPath();\r\n context.moveTo(this._cachedParentMeasure.left + this._x1.getValue(this._host), this._cachedParentMeasure.top + this._y1.getValue(this._host));\r\n context.lineTo(this._cachedParentMeasure.left + this._effectiveX2, this._cachedParentMeasure.top + this._effectiveY2);\r\n context.stroke();\r\n context.restore();\r\n };\r\n Line.prototype._measure = function () {\r\n // Width / Height\r\n this._currentMeasure.width = Math.abs(this._x1.getValue(this._host) - this._effectiveX2) + this._lineWidth;\r\n this._currentMeasure.height = Math.abs(this._y1.getValue(this._host) - this._effectiveY2) + this._lineWidth;\r\n };\r\n Line.prototype._computeAlignment = function (parentMeasure, context) {\r\n this._currentMeasure.left = parentMeasure.left + Math.min(this._x1.getValue(this._host), this._effectiveX2) - this._lineWidth / 2;\r\n this._currentMeasure.top = parentMeasure.top + Math.min(this._y1.getValue(this._host), this._effectiveY2) - this._lineWidth / 2;\r\n };\r\n /**\r\n * Move one end of the line given 3D cartesian coordinates.\r\n * @param position Targeted world position\r\n * @param scene Scene\r\n * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.\r\n */\r\n Line.prototype.moveToVector3 = function (position, scene, end) {\r\n if (end === void 0) { end = false; }\r\n if (!this._host || this.parent !== this._host._rootContainer) {\r\n Tools.Error(\"Cannot move a control to a vector3 if the control is not at root level\");\r\n return;\r\n }\r\n var globalViewport = this._host._getGlobalViewport(scene);\r\n var projectedPosition = Vector3.Project(position, Matrix.Identity(), scene.getTransformMatrix(), globalViewport);\r\n this._moveToProjectedPosition(projectedPosition, end);\r\n if (projectedPosition.z < 0 || projectedPosition.z > 1) {\r\n this.notRenderable = true;\r\n return;\r\n }\r\n this.notRenderable = false;\r\n };\r\n /**\r\n * Move one end of the line to a position in screen absolute space.\r\n * @param projectedPosition Position in screen absolute space (X, Y)\r\n * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.\r\n */\r\n Line.prototype._moveToProjectedPosition = function (projectedPosition, end) {\r\n if (end === void 0) { end = false; }\r\n var x = (projectedPosition.x + this._linkOffsetX.getValue(this._host)) + \"px\";\r\n var y = (projectedPosition.y + this._linkOffsetY.getValue(this._host)) + \"px\";\r\n if (end) {\r\n this.x2 = x;\r\n this.y2 = y;\r\n this._x2.ignoreAdaptiveScaling = true;\r\n this._y2.ignoreAdaptiveScaling = true;\r\n }\r\n else {\r\n this.x1 = x;\r\n this.y1 = y;\r\n this._x1.ignoreAdaptiveScaling = true;\r\n this._y1.ignoreAdaptiveScaling = true;\r\n }\r\n };\r\n return Line;\r\n}(Control));\r\nexport { Line };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Line\"] = Line;\r\n//# sourceMappingURL=line.js.map","import { Vector3 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Epsilon } from '@babylonjs/core/Maths/math.constants';\r\nimport { ValueAndUnit } from \"./valueAndUnit\";\r\n/**\r\n * Class used to store a point for a MultiLine object.\r\n * The point can be pure 2D coordinates, a mesh or a control\r\n */\r\nvar MultiLinePoint = /** @class */ (function () {\r\n /**\r\n * Creates a new MultiLinePoint\r\n * @param multiLine defines the source MultiLine object\r\n */\r\n function MultiLinePoint(multiLine) {\r\n this._multiLine = multiLine;\r\n this._x = new ValueAndUnit(0);\r\n this._y = new ValueAndUnit(0);\r\n this._point = new Vector3(0, 0, 0);\r\n }\r\n Object.defineProperty(MultiLinePoint.prototype, \"x\", {\r\n /** Gets or sets x coordinate */\r\n get: function () {\r\n return this._x.toString(this._multiLine._host);\r\n },\r\n set: function (value) {\r\n if (this._x.toString(this._multiLine._host) === value) {\r\n return;\r\n }\r\n if (this._x.fromString(value)) {\r\n this._multiLine._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiLinePoint.prototype, \"y\", {\r\n /** Gets or sets y coordinate */\r\n get: function () {\r\n return this._y.toString(this._multiLine._host);\r\n },\r\n set: function (value) {\r\n if (this._y.toString(this._multiLine._host) === value) {\r\n return;\r\n }\r\n if (this._y.fromString(value)) {\r\n this._multiLine._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiLinePoint.prototype, \"control\", {\r\n /** Gets or sets the control associated with this point */\r\n get: function () {\r\n return this._control;\r\n },\r\n set: function (value) {\r\n if (this._control === value) {\r\n return;\r\n }\r\n if (this._control && this._controlObserver) {\r\n this._control.onDirtyObservable.remove(this._controlObserver);\r\n this._controlObserver = null;\r\n }\r\n this._control = value;\r\n if (this._control) {\r\n this._controlObserver = this._control.onDirtyObservable.add(this._multiLine.onPointUpdate);\r\n }\r\n this._multiLine._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiLinePoint.prototype, \"mesh\", {\r\n /** Gets or sets the mesh associated with this point */\r\n get: function () {\r\n return this._mesh;\r\n },\r\n set: function (value) {\r\n if (this._mesh === value) {\r\n return;\r\n }\r\n if (this._mesh && this._meshObserver) {\r\n this._mesh.getScene().onAfterCameraRenderObservable.remove(this._meshObserver);\r\n }\r\n this._mesh = value;\r\n if (this._mesh) {\r\n this._meshObserver = this._mesh.getScene().onAfterCameraRenderObservable.add(this._multiLine.onPointUpdate);\r\n }\r\n this._multiLine._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** Resets links */\r\n MultiLinePoint.prototype.resetLinks = function () {\r\n this.control = null;\r\n this.mesh = null;\r\n };\r\n /**\r\n * Gets a translation vector with Z component\r\n * @returns the translation vector\r\n */\r\n MultiLinePoint.prototype.translate = function () {\r\n this._point = this._translatePoint();\r\n return this._point;\r\n };\r\n MultiLinePoint.prototype._translatePoint = function () {\r\n if (this._mesh != null) {\r\n return this._multiLine._host.getProjectedPositionWithZ(this._mesh.getBoundingInfo().boundingSphere.center, this._mesh.getWorldMatrix());\r\n }\r\n else if (this._control != null) {\r\n return new Vector3(this._control.centerX, this._control.centerY, 1. - Epsilon);\r\n }\r\n else {\r\n var host = this._multiLine._host;\r\n var xValue = this._x.getValueInPixel(host, Number(host._canvas.width));\r\n var yValue = this._y.getValueInPixel(host, Number(host._canvas.height));\r\n return new Vector3(xValue, yValue, 1. - Epsilon);\r\n }\r\n };\r\n /** Release associated resources */\r\n MultiLinePoint.prototype.dispose = function () {\r\n this.resetLinks();\r\n };\r\n return MultiLinePoint;\r\n}());\r\nexport { MultiLinePoint };\r\n//# sourceMappingURL=multiLinePoint.js.map","import { __extends } from \"tslib\";\r\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\r\nimport { Control } from \"./control\";\r\nimport { MultiLinePoint } from \"../multiLinePoint\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create multi line control\r\n */\r\nvar MultiLine = /** @class */ (function (_super) {\r\n __extends(MultiLine, _super);\r\n /**\r\n * Creates a new MultiLine\r\n * @param name defines the control name\r\n */\r\n function MultiLine(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._lineWidth = 1;\r\n /** Function called when a point is updated */\r\n _this.onPointUpdate = function () {\r\n _this._markAsDirty();\r\n };\r\n _this._automaticSize = true;\r\n _this.isHitTestVisible = false;\r\n _this._horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _this._verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n _this._dash = [];\r\n _this._points = [];\r\n return _this;\r\n }\r\n Object.defineProperty(MultiLine.prototype, \"dash\", {\r\n /** Gets or sets dash pattern */\r\n get: function () {\r\n return this._dash;\r\n },\r\n set: function (value) {\r\n if (this._dash === value) {\r\n return;\r\n }\r\n this._dash = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets point stored at specified index\r\n * @param index defines the index to look for\r\n * @returns the requested point if found\r\n */\r\n MultiLine.prototype.getAt = function (index) {\r\n if (!this._points[index]) {\r\n this._points[index] = new MultiLinePoint(this);\r\n }\r\n return this._points[index];\r\n };\r\n /**\r\n * Adds new points to the point collection\r\n * @param items defines the list of items (mesh, control or 2d coordiantes) to add\r\n * @returns the list of created MultiLinePoint\r\n */\r\n MultiLine.prototype.add = function () {\r\n var _this = this;\r\n var items = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n items[_i] = arguments[_i];\r\n }\r\n return items.map(function (item) { return _this.push(item); });\r\n };\r\n /**\r\n * Adds a new point to the point collection\r\n * @param item defines the item (mesh, control or 2d coordiantes) to add\r\n * @returns the created MultiLinePoint\r\n */\r\n MultiLine.prototype.push = function (item) {\r\n var point = this.getAt(this._points.length);\r\n if (item == null) {\r\n return point;\r\n }\r\n if (item instanceof AbstractMesh) {\r\n point.mesh = item;\r\n }\r\n else if (item instanceof Control) {\r\n point.control = item;\r\n }\r\n else if (item.x != null && item.y != null) {\r\n point.x = item.x;\r\n point.y = item.y;\r\n }\r\n return point;\r\n };\r\n /**\r\n * Remove a specific value or point from the active point collection\r\n * @param value defines the value or point to remove\r\n */\r\n MultiLine.prototype.remove = function (value) {\r\n var index;\r\n if (value instanceof MultiLinePoint) {\r\n index = this._points.indexOf(value);\r\n if (index === -1) {\r\n return;\r\n }\r\n }\r\n else {\r\n index = value;\r\n }\r\n var point = this._points[index];\r\n if (!point) {\r\n return;\r\n }\r\n point.dispose();\r\n this._points.splice(index, 1);\r\n };\r\n /**\r\n * Resets this object to initial state (no point)\r\n */\r\n MultiLine.prototype.reset = function () {\r\n while (this._points.length > 0) {\r\n this.remove(this._points.length - 1);\r\n }\r\n };\r\n /**\r\n * Resets all links\r\n */\r\n MultiLine.prototype.resetLinks = function () {\r\n this._points.forEach(function (point) {\r\n if (point != null) {\r\n point.resetLinks();\r\n }\r\n });\r\n };\r\n Object.defineProperty(MultiLine.prototype, \"lineWidth\", {\r\n /** Gets or sets line width */\r\n get: function () {\r\n return this._lineWidth;\r\n },\r\n set: function (value) {\r\n if (this._lineWidth === value) {\r\n return;\r\n }\r\n this._lineWidth = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiLine.prototype, \"horizontalAlignment\", {\r\n set: function (value) {\r\n return;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MultiLine.prototype, \"verticalAlignment\", {\r\n set: function (value) {\r\n return;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n MultiLine.prototype._getTypeName = function () {\r\n return \"MultiLine\";\r\n };\r\n MultiLine.prototype._draw = function (context, invalidatedRectangle) {\r\n context.save();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n this._applyStates(context);\r\n context.strokeStyle = this.color;\r\n context.lineWidth = this._lineWidth;\r\n context.setLineDash(this._dash);\r\n context.beginPath();\r\n var first = true; //first index is not necessarily 0\r\n var previousPoint;\r\n this._points.forEach(function (point) {\r\n if (!point) {\r\n return;\r\n }\r\n if (first) {\r\n context.moveTo(point._point.x, point._point.y);\r\n first = false;\r\n }\r\n else {\r\n if (point._point.z < 1 && previousPoint.z < 1) {\r\n context.lineTo(point._point.x, point._point.y);\r\n }\r\n else {\r\n context.moveTo(point._point.x, point._point.y);\r\n }\r\n }\r\n previousPoint = point._point;\r\n });\r\n context.stroke();\r\n context.restore();\r\n };\r\n MultiLine.prototype._additionalProcessing = function (parentMeasure, context) {\r\n var _this = this;\r\n this._minX = null;\r\n this._minY = null;\r\n this._maxX = null;\r\n this._maxY = null;\r\n this._points.forEach(function (point, index) {\r\n if (!point) {\r\n return;\r\n }\r\n point.translate();\r\n if (_this._minX == null || point._point.x < _this._minX) {\r\n _this._minX = point._point.x;\r\n }\r\n if (_this._minY == null || point._point.y < _this._minY) {\r\n _this._minY = point._point.y;\r\n }\r\n if (_this._maxX == null || point._point.x > _this._maxX) {\r\n _this._maxX = point._point.x;\r\n }\r\n if (_this._maxY == null || point._point.y > _this._maxY) {\r\n _this._maxY = point._point.y;\r\n }\r\n });\r\n if (this._minX == null) {\r\n this._minX = 0;\r\n }\r\n if (this._minY == null) {\r\n this._minY = 0;\r\n }\r\n if (this._maxX == null) {\r\n this._maxX = 0;\r\n }\r\n if (this._maxY == null) {\r\n this._maxY = 0;\r\n }\r\n };\r\n MultiLine.prototype._measure = function () {\r\n if (this._minX == null || this._maxX == null || this._minY == null || this._maxY == null) {\r\n return;\r\n }\r\n this._currentMeasure.width = Math.abs(this._maxX - this._minX) + this._lineWidth;\r\n this._currentMeasure.height = Math.abs(this._maxY - this._minY) + this._lineWidth;\r\n };\r\n MultiLine.prototype._computeAlignment = function (parentMeasure, context) {\r\n if (this._minX == null || this._minY == null) {\r\n return;\r\n }\r\n this._currentMeasure.left = this._minX - this._lineWidth / 2;\r\n this._currentMeasure.top = this._minY - this._lineWidth / 2;\r\n };\r\n MultiLine.prototype.dispose = function () {\r\n this.reset();\r\n _super.prototype.dispose.call(this);\r\n };\r\n return MultiLine;\r\n}(Control));\r\nexport { MultiLine };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.MultiLine\"] = MultiLine;\r\n//# sourceMappingURL=multiLine.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Control } from \"./control\";\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { TextBlock } from \"./textBlock\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create radio button controls\r\n */\r\nvar RadioButton = /** @class */ (function (_super) {\r\n __extends(RadioButton, _super);\r\n /**\r\n * Creates a new RadioButton\r\n * @param name defines the control name\r\n */\r\n function RadioButton(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._isChecked = false;\r\n _this._background = \"black\";\r\n _this._checkSizeRatio = 0.8;\r\n _this._thickness = 1;\r\n /** Gets or sets group name */\r\n _this.group = \"\";\r\n /** Observable raised when isChecked is changed */\r\n _this.onIsCheckedChangedObservable = new Observable();\r\n _this.isPointerBlocker = true;\r\n return _this;\r\n }\r\n Object.defineProperty(RadioButton.prototype, \"thickness\", {\r\n /** Gets or sets border thickness */\r\n get: function () {\r\n return this._thickness;\r\n },\r\n set: function (value) {\r\n if (this._thickness === value) {\r\n return;\r\n }\r\n this._thickness = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadioButton.prototype, \"checkSizeRatio\", {\r\n /** Gets or sets a value indicating the ratio between overall size and check size */\r\n get: function () {\r\n return this._checkSizeRatio;\r\n },\r\n set: function (value) {\r\n value = Math.max(Math.min(1, value), 0);\r\n if (this._checkSizeRatio === value) {\r\n return;\r\n }\r\n this._checkSizeRatio = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadioButton.prototype, \"background\", {\r\n /** Gets or sets background color */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RadioButton.prototype, \"isChecked\", {\r\n /** Gets or sets a boolean indicating if the checkbox is checked or not */\r\n get: function () {\r\n return this._isChecked;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._isChecked === value) {\r\n return;\r\n }\r\n this._isChecked = value;\r\n this._markAsDirty();\r\n this.onIsCheckedChangedObservable.notifyObservers(value);\r\n if (this._isChecked && this._host) {\r\n // Update all controls from same group\r\n this._host.executeOnAllControls(function (control) {\r\n if (control === _this) {\r\n return;\r\n }\r\n if (control.group === undefined) {\r\n return;\r\n }\r\n var childRadio = control;\r\n if (childRadio.group === _this.group) {\r\n childRadio.isChecked = false;\r\n }\r\n });\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n RadioButton.prototype._getTypeName = function () {\r\n return \"RadioButton\";\r\n };\r\n RadioButton.prototype._draw = function (context) {\r\n context.save();\r\n this._applyStates(context);\r\n var actualWidth = this._currentMeasure.width - this._thickness;\r\n var actualHeight = this._currentMeasure.height - this._thickness;\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n // Outer\r\n Control.drawEllipse(this._currentMeasure.left + this._currentMeasure.width / 2, this._currentMeasure.top + this._currentMeasure.height / 2, this._currentMeasure.width / 2 - this._thickness / 2, this._currentMeasure.height / 2 - this._thickness / 2, context);\r\n context.fillStyle = this._isEnabled ? this._background : this._disabledColor;\r\n context.fill();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n context.strokeStyle = this.color;\r\n context.lineWidth = this._thickness;\r\n context.stroke();\r\n // Inner\r\n if (this._isChecked) {\r\n context.fillStyle = this._isEnabled ? this.color : this._disabledColor;\r\n var offsetWidth = actualWidth * this._checkSizeRatio;\r\n var offseHeight = actualHeight * this._checkSizeRatio;\r\n Control.drawEllipse(this._currentMeasure.left + this._currentMeasure.width / 2, this._currentMeasure.top + this._currentMeasure.height / 2, offsetWidth / 2 - this._thickness / 2, offseHeight / 2 - this._thickness / 2, context);\r\n context.fill();\r\n }\r\n context.restore();\r\n };\r\n // Events\r\n RadioButton.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n if (!_super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n if (!this.isChecked) {\r\n this.isChecked = true;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Utility function to easily create a radio button with a header\r\n * @param title defines the label to use for the header\r\n * @param group defines the group to use for the radio button\r\n * @param isChecked defines the initial state of the radio button\r\n * @param onValueChanged defines the callback to call when value changes\r\n * @returns a StackPanel containing the radio button and a textBlock\r\n */\r\n RadioButton.AddRadioButtonWithHeader = function (title, group, isChecked, onValueChanged) {\r\n var panel = new StackPanel();\r\n panel.isVertical = false;\r\n panel.height = \"30px\";\r\n var radio = new RadioButton();\r\n radio.width = \"20px\";\r\n radio.height = \"20px\";\r\n radio.isChecked = isChecked;\r\n radio.color = \"green\";\r\n radio.group = group;\r\n radio.onIsCheckedChangedObservable.add(function (value) { return onValueChanged(radio, value); });\r\n panel.addControl(radio);\r\n var header = new TextBlock();\r\n header.text = title;\r\n header.width = \"180px\";\r\n header.paddingLeft = \"5px\";\r\n header.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n header.color = \"white\";\r\n panel.addControl(header);\r\n return panel;\r\n };\r\n return RadioButton;\r\n}(Control));\r\nexport { RadioButton };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.RadioButton\"] = RadioButton;\r\n//# sourceMappingURL=radioButton.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Control } from \"../control\";\r\nimport { ValueAndUnit } from \"../../valueAndUnit\";\r\n/**\r\n * Class used to create slider controls\r\n */\r\nvar BaseSlider = /** @class */ (function (_super) {\r\n __extends(BaseSlider, _super);\r\n /**\r\n * Creates a new BaseSlider\r\n * @param name defines the control name\r\n */\r\n function BaseSlider(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._thumbWidth = new ValueAndUnit(20, ValueAndUnit.UNITMODE_PIXEL, false);\r\n _this._minimum = 0;\r\n _this._maximum = 100;\r\n _this._value = 50;\r\n _this._isVertical = false;\r\n _this._barOffset = new ValueAndUnit(5, ValueAndUnit.UNITMODE_PIXEL, false);\r\n _this._isThumbClamped = false;\r\n _this._displayThumb = true;\r\n _this._step = 0;\r\n _this._lastPointerDownID = -1;\r\n // Shared rendering info\r\n _this._effectiveBarOffset = 0;\r\n /** Observable raised when the sldier value changes */\r\n _this.onValueChangedObservable = new Observable();\r\n // Events\r\n _this._pointerIsDown = false;\r\n _this.isPointerBlocker = true;\r\n return _this;\r\n }\r\n Object.defineProperty(BaseSlider.prototype, \"displayThumb\", {\r\n /** Gets or sets a boolean indicating if the thumb must be rendered */\r\n get: function () {\r\n return this._displayThumb;\r\n },\r\n set: function (value) {\r\n if (this._displayThumb === value) {\r\n return;\r\n }\r\n this._displayThumb = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"step\", {\r\n /** Gets or sets a step to apply to values (0 by default) */\r\n get: function () {\r\n return this._step;\r\n },\r\n set: function (value) {\r\n if (this._step === value) {\r\n return;\r\n }\r\n this._step = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"barOffset\", {\r\n /** Gets or sets main bar offset (ie. the margin applied to the value bar) */\r\n get: function () {\r\n return this._barOffset.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._barOffset.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._barOffset.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"barOffsetInPixels\", {\r\n /** Gets main bar offset in pixels*/\r\n get: function () {\r\n return this._barOffset.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"thumbWidth\", {\r\n /** Gets or sets thumb width */\r\n get: function () {\r\n return this._thumbWidth.toString(this._host);\r\n },\r\n set: function (value) {\r\n if (this._thumbWidth.toString(this._host) === value) {\r\n return;\r\n }\r\n if (this._thumbWidth.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"thumbWidthInPixels\", {\r\n /** Gets thumb width in pixels */\r\n get: function () {\r\n return this._thumbWidth.getValueInPixel(this._host, this._cachedParentMeasure.width);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"minimum\", {\r\n /** Gets or sets minimum value */\r\n get: function () {\r\n return this._minimum;\r\n },\r\n set: function (value) {\r\n if (this._minimum === value) {\r\n return;\r\n }\r\n this._minimum = value;\r\n this._markAsDirty();\r\n this.value = Math.max(Math.min(this.value, this._maximum), this._minimum);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"maximum\", {\r\n /** Gets or sets maximum value */\r\n get: function () {\r\n return this._maximum;\r\n },\r\n set: function (value) {\r\n if (this._maximum === value) {\r\n return;\r\n }\r\n this._maximum = value;\r\n this._markAsDirty();\r\n this.value = Math.max(Math.min(this.value, this._maximum), this._minimum);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"value\", {\r\n /** Gets or sets current value */\r\n get: function () {\r\n return this._value;\r\n },\r\n set: function (value) {\r\n value = Math.max(Math.min(value, this._maximum), this._minimum);\r\n if (this._value === value) {\r\n return;\r\n }\r\n this._value = value;\r\n this._markAsDirty();\r\n this.onValueChangedObservable.notifyObservers(this._value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"isVertical\", {\r\n /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */\r\n get: function () {\r\n return this._isVertical;\r\n },\r\n set: function (value) {\r\n if (this._isVertical === value) {\r\n return;\r\n }\r\n this._isVertical = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(BaseSlider.prototype, \"isThumbClamped\", {\r\n /** Gets or sets a value indicating if the thumb can go over main bar extends */\r\n get: function () {\r\n return this._isThumbClamped;\r\n },\r\n set: function (value) {\r\n if (this._isThumbClamped === value) {\r\n return;\r\n }\r\n this._isThumbClamped = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n BaseSlider.prototype._getTypeName = function () {\r\n return \"BaseSlider\";\r\n };\r\n BaseSlider.prototype._getThumbPosition = function () {\r\n if (this.isVertical) {\r\n return ((this.maximum - this.value) / (this.maximum - this.minimum)) * this._backgroundBoxLength;\r\n }\r\n return ((this.value - this.minimum) / (this.maximum - this.minimum)) * this._backgroundBoxLength;\r\n };\r\n BaseSlider.prototype._getThumbThickness = function (type) {\r\n var thumbThickness = 0;\r\n switch (type) {\r\n case \"circle\":\r\n if (this._thumbWidth.isPixel) {\r\n thumbThickness = Math.max(this._thumbWidth.getValue(this._host), this._backgroundBoxThickness);\r\n }\r\n else {\r\n thumbThickness = this._backgroundBoxThickness * this._thumbWidth.getValue(this._host);\r\n }\r\n break;\r\n case \"rectangle\":\r\n if (this._thumbWidth.isPixel) {\r\n thumbThickness = Math.min(this._thumbWidth.getValue(this._host), this._backgroundBoxThickness);\r\n }\r\n else {\r\n thumbThickness = this._backgroundBoxThickness * this._thumbWidth.getValue(this._host);\r\n }\r\n }\r\n return thumbThickness;\r\n };\r\n BaseSlider.prototype._prepareRenderingData = function (type) {\r\n // Main bar\r\n this._effectiveBarOffset = 0;\r\n this._renderLeft = this._currentMeasure.left;\r\n this._renderTop = this._currentMeasure.top;\r\n this._renderWidth = this._currentMeasure.width;\r\n this._renderHeight = this._currentMeasure.height;\r\n this._backgroundBoxLength = Math.max(this._currentMeasure.width, this._currentMeasure.height);\r\n this._backgroundBoxThickness = Math.min(this._currentMeasure.width, this._currentMeasure.height);\r\n this._effectiveThumbThickness = this._getThumbThickness(type);\r\n if (this.displayThumb) {\r\n this._backgroundBoxLength -= this._effectiveThumbThickness;\r\n }\r\n //throw error when height is less than width for vertical slider\r\n if ((this.isVertical && this._currentMeasure.height < this._currentMeasure.width)) {\r\n console.error(\"Height should be greater than width\");\r\n return;\r\n }\r\n if (this._barOffset.isPixel) {\r\n this._effectiveBarOffset = Math.min(this._barOffset.getValue(this._host), this._backgroundBoxThickness);\r\n }\r\n else {\r\n this._effectiveBarOffset = this._backgroundBoxThickness * this._barOffset.getValue(this._host);\r\n }\r\n this._backgroundBoxThickness -= (this._effectiveBarOffset * 2);\r\n if (this.isVertical) {\r\n this._renderLeft += this._effectiveBarOffset;\r\n if (!this.isThumbClamped && this.displayThumb) {\r\n this._renderTop += (this._effectiveThumbThickness / 2);\r\n }\r\n this._renderHeight = this._backgroundBoxLength;\r\n this._renderWidth = this._backgroundBoxThickness;\r\n }\r\n else {\r\n this._renderTop += this._effectiveBarOffset;\r\n if (!this.isThumbClamped && this.displayThumb) {\r\n this._renderLeft += (this._effectiveThumbThickness / 2);\r\n }\r\n this._renderHeight = this._backgroundBoxThickness;\r\n this._renderWidth = this._backgroundBoxLength;\r\n }\r\n };\r\n /** @hidden */\r\n BaseSlider.prototype._updateValueFromPointer = function (x, y) {\r\n if (this.rotation != 0) {\r\n this._invertTransformMatrix.transformCoordinates(x, y, this._transformedPosition);\r\n x = this._transformedPosition.x;\r\n y = this._transformedPosition.y;\r\n }\r\n var value;\r\n if (this._isVertical) {\r\n value = this._minimum + (1 - ((y - this._currentMeasure.top) / this._currentMeasure.height)) * (this._maximum - this._minimum);\r\n }\r\n else {\r\n value = this._minimum + ((x - this._currentMeasure.left) / this._currentMeasure.width) * (this._maximum - this._minimum);\r\n }\r\n var mult = (1 / this._step) | 0;\r\n this.value = this._step ? ((value * mult) | 0) / mult : value;\r\n };\r\n BaseSlider.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n if (!_super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n this._pointerIsDown = true;\r\n this._updateValueFromPointer(coordinates.x, coordinates.y);\r\n this._host._capturingControl[pointerId] = this;\r\n this._lastPointerDownID = pointerId;\r\n return true;\r\n };\r\n BaseSlider.prototype._onPointerMove = function (target, coordinates, pointerId, pi) {\r\n // Only listen to pointer move events coming from the last pointer to click on the element (To support dual vr controller interaction)\r\n if (pointerId != this._lastPointerDownID) {\r\n return;\r\n }\r\n if (this._pointerIsDown) {\r\n this._updateValueFromPointer(coordinates.x, coordinates.y);\r\n }\r\n _super.prototype._onPointerMove.call(this, target, coordinates, pointerId, pi);\r\n };\r\n BaseSlider.prototype._onPointerUp = function (target, coordinates, pointerId, buttonIndex, notifyClick) {\r\n this._pointerIsDown = false;\r\n delete this._host._capturingControl[pointerId];\r\n _super.prototype._onPointerUp.call(this, target, coordinates, pointerId, buttonIndex, notifyClick);\r\n };\r\n BaseSlider.prototype._onCanvasBlur = function () {\r\n this._forcePointerUp();\r\n _super.prototype._onCanvasBlur.call(this);\r\n };\r\n return BaseSlider;\r\n}(Control));\r\nexport { BaseSlider };\r\n//# sourceMappingURL=baseSlider.js.map","import { __extends } from \"tslib\";\r\nimport { BaseSlider } from \"./baseSlider\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create slider controls\r\n */\r\nvar Slider = /** @class */ (function (_super) {\r\n __extends(Slider, _super);\r\n /**\r\n * Creates a new Slider\r\n * @param name defines the control name\r\n */\r\n function Slider(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._background = \"black\";\r\n _this._borderColor = \"white\";\r\n _this._thumbColor = \"\";\r\n _this._isThumbCircle = false;\r\n _this._displayValueBar = true;\r\n return _this;\r\n }\r\n Object.defineProperty(Slider.prototype, \"displayValueBar\", {\r\n /** Gets or sets a boolean indicating if the value bar must be rendered */\r\n get: function () {\r\n return this._displayValueBar;\r\n },\r\n set: function (value) {\r\n if (this._displayValueBar === value) {\r\n return;\r\n }\r\n this._displayValueBar = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slider.prototype, \"borderColor\", {\r\n /** Gets or sets border color */\r\n get: function () {\r\n return this._borderColor;\r\n },\r\n set: function (value) {\r\n if (this._borderColor === value) {\r\n return;\r\n }\r\n this._borderColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slider.prototype, \"background\", {\r\n /** Gets or sets background color */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slider.prototype, \"thumbColor\", {\r\n /** Gets or sets thumb's color */\r\n get: function () {\r\n return this._thumbColor;\r\n },\r\n set: function (value) {\r\n if (this._thumbColor === value) {\r\n return;\r\n }\r\n this._thumbColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Slider.prototype, \"isThumbCircle\", {\r\n /** Gets or sets a boolean indicating if the thumb should be round or square */\r\n get: function () {\r\n return this._isThumbCircle;\r\n },\r\n set: function (value) {\r\n if (this._isThumbCircle === value) {\r\n return;\r\n }\r\n this._isThumbCircle = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Slider.prototype._getTypeName = function () {\r\n return \"Slider\";\r\n };\r\n Slider.prototype._draw = function (context, invalidatedRectangle) {\r\n context.save();\r\n this._applyStates(context);\r\n this._prepareRenderingData(this.isThumbCircle ? \"circle\" : \"rectangle\");\r\n var left = this._renderLeft;\r\n var top = this._renderTop;\r\n var width = this._renderWidth;\r\n var height = this._renderHeight;\r\n var radius = 0;\r\n if (this.isThumbClamped && this.isThumbCircle) {\r\n if (this.isVertical) {\r\n top += (this._effectiveThumbThickness / 2);\r\n }\r\n else {\r\n left += (this._effectiveThumbThickness / 2);\r\n }\r\n radius = this._backgroundBoxThickness / 2;\r\n }\r\n else {\r\n radius = (this._effectiveThumbThickness - this._effectiveBarOffset) / 2;\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n var thumbPosition = this._getThumbPosition();\r\n context.fillStyle = this._background;\r\n if (this.isVertical) {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left + this._backgroundBoxThickness / 2, top, radius, Math.PI, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top, width, height);\r\n }\r\n else {\r\n context.fillRect(left, top, width, height + this._effectiveThumbThickness);\r\n }\r\n }\r\n else {\r\n context.fillRect(left, top, width, height);\r\n }\r\n }\r\n else {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left + this._backgroundBoxLength, top + (this._backgroundBoxThickness / 2), radius, 0, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top, width, height);\r\n }\r\n else {\r\n context.fillRect(left, top, width + this._effectiveThumbThickness, height);\r\n }\r\n }\r\n else {\r\n context.fillRect(left, top, width, height);\r\n }\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n // Value bar\r\n context.fillStyle = this.color;\r\n if (this._displayValueBar) {\r\n if (this.isVertical) {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left + this._backgroundBoxThickness / 2, top + this._backgroundBoxLength, radius, 0, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top + thumbPosition, width, height - thumbPosition);\r\n }\r\n else {\r\n context.fillRect(left, top + thumbPosition, width, height - thumbPosition + this._effectiveThumbThickness);\r\n }\r\n }\r\n else {\r\n context.fillRect(left, top + thumbPosition, width, height - thumbPosition);\r\n }\r\n }\r\n else {\r\n if (this.isThumbClamped) {\r\n if (this.isThumbCircle) {\r\n context.beginPath();\r\n context.arc(left, top + this._backgroundBoxThickness / 2, radius, 0, 2 * Math.PI);\r\n context.fill();\r\n context.fillRect(left, top, thumbPosition, height);\r\n }\r\n else {\r\n context.fillRect(left, top, thumbPosition, height);\r\n }\r\n }\r\n else {\r\n context.fillRect(left, top, thumbPosition, height);\r\n }\r\n }\r\n }\r\n // Thumb\r\n context.fillStyle = this._thumbColor || this.color;\r\n if (this.displayThumb) {\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n if (this._isThumbCircle) {\r\n context.beginPath();\r\n if (this.isVertical) {\r\n context.arc(left + this._backgroundBoxThickness / 2, top + thumbPosition, radius, 0, 2 * Math.PI);\r\n }\r\n else {\r\n context.arc(left + thumbPosition, top + (this._backgroundBoxThickness / 2), radius, 0, 2 * Math.PI);\r\n }\r\n context.fill();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n context.strokeStyle = this._borderColor;\r\n context.stroke();\r\n }\r\n else {\r\n if (this.isVertical) {\r\n context.fillRect(left - this._effectiveBarOffset, this._currentMeasure.top + thumbPosition, this._currentMeasure.width, this._effectiveThumbThickness);\r\n }\r\n else {\r\n context.fillRect(this._currentMeasure.left + thumbPosition, this._currentMeasure.top, this._effectiveThumbThickness, this._currentMeasure.height);\r\n }\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n context.strokeStyle = this._borderColor;\r\n if (this.isVertical) {\r\n context.strokeRect(left - this._effectiveBarOffset, this._currentMeasure.top + thumbPosition, this._currentMeasure.width, this._effectiveThumbThickness);\r\n }\r\n else {\r\n context.strokeRect(this._currentMeasure.left + thumbPosition, this._currentMeasure.top, this._effectiveThumbThickness, this._currentMeasure.height);\r\n }\r\n }\r\n }\r\n context.restore();\r\n };\r\n return Slider;\r\n}(BaseSlider));\r\nexport { Slider };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.Slider\"] = Slider;\r\n//# sourceMappingURL=slider.js.map","import { __extends } from \"tslib\";\r\nimport { Rectangle } from \"./rectangle\";\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { Control } from \"./control\";\r\nimport { TextBlock } from \"./textBlock\";\r\nimport { Checkbox } from \"./checkbox\";\r\nimport { RadioButton } from \"./radioButton\";\r\nimport { Slider } from \"./sliders/slider\";\r\nimport { Container } from \"./container\";\r\n/** Class used to create a RadioGroup\r\n * which contains groups of radio buttons\r\n*/\r\nvar SelectorGroup = /** @class */ (function () {\r\n /**\r\n * Creates a new SelectorGroup\r\n * @param name of group, used as a group heading\r\n */\r\n function SelectorGroup(\r\n /** name of SelectorGroup */\r\n name) {\r\n this.name = name;\r\n this._groupPanel = new StackPanel();\r\n this._selectors = new Array();\r\n this._groupPanel.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n this._groupPanel.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._groupHeader = this._addGroupHeader(name);\r\n }\r\n Object.defineProperty(SelectorGroup.prototype, \"groupPanel\", {\r\n /** Gets the groupPanel of the SelectorGroup */\r\n get: function () {\r\n return this._groupPanel;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SelectorGroup.prototype, \"selectors\", {\r\n /** Gets the selectors array */\r\n get: function () {\r\n return this._selectors;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SelectorGroup.prototype, \"header\", {\r\n /** Gets and sets the group header */\r\n get: function () {\r\n return this._groupHeader.text;\r\n },\r\n set: function (label) {\r\n if (this._groupHeader.text === \"label\") {\r\n return;\r\n }\r\n this._groupHeader.text = label;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n SelectorGroup.prototype._addGroupHeader = function (text) {\r\n var groupHeading = new TextBlock(\"groupHead\", text);\r\n groupHeading.width = 0.9;\r\n groupHeading.height = \"30px\";\r\n groupHeading.textWrapping = true;\r\n groupHeading.color = \"black\";\r\n groupHeading.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n groupHeading.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n groupHeading.left = \"2px\";\r\n this._groupPanel.addControl(groupHeading);\r\n return groupHeading;\r\n };\r\n /** @hidden*/\r\n SelectorGroup.prototype._getSelector = function (selectorNb) {\r\n if (selectorNb < 0 || selectorNb >= this._selectors.length) {\r\n return;\r\n }\r\n return this._selectors[selectorNb];\r\n };\r\n /** Removes the selector at the given position\r\n * @param selectorNb the position of the selector within the group\r\n */\r\n SelectorGroup.prototype.removeSelector = function (selectorNb) {\r\n if (selectorNb < 0 || selectorNb >= this._selectors.length) {\r\n return;\r\n }\r\n this._groupPanel.removeControl(this._selectors[selectorNb]);\r\n this._selectors.splice(selectorNb, 1);\r\n };\r\n return SelectorGroup;\r\n}());\r\nexport { SelectorGroup };\r\n/** Class used to create a CheckboxGroup\r\n * which contains groups of checkbox buttons\r\n*/\r\nvar CheckboxGroup = /** @class */ (function (_super) {\r\n __extends(CheckboxGroup, _super);\r\n function CheckboxGroup() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /** Adds a checkbox as a control\r\n * @param text is the label for the selector\r\n * @param func is the function called when the Selector is checked\r\n * @param checked is true when Selector is checked\r\n */\r\n CheckboxGroup.prototype.addCheckbox = function (text, func, checked) {\r\n if (func === void 0) { func = function (s) { }; }\r\n if (checked === void 0) { checked = false; }\r\n var checked = checked || false;\r\n var button = new Checkbox();\r\n button.width = \"20px\";\r\n button.height = \"20px\";\r\n button.color = \"#364249\";\r\n button.background = \"#CCCCCC\";\r\n button.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n button.onIsCheckedChangedObservable.add(function (state) {\r\n func(state);\r\n });\r\n var _selector = Control.AddHeader(button, text, \"200px\", { isHorizontal: true, controlFirst: true });\r\n _selector.height = \"30px\";\r\n _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _selector.left = \"4px\";\r\n this.groupPanel.addControl(_selector);\r\n this.selectors.push(_selector);\r\n button.isChecked = checked;\r\n if (this.groupPanel.parent && this.groupPanel.parent.parent) {\r\n button.color = this.groupPanel.parent.parent.buttonColor;\r\n button.background = this.groupPanel.parent.parent.buttonBackground;\r\n }\r\n };\r\n /** @hidden */\r\n CheckboxGroup.prototype._setSelectorLabel = function (selectorNb, label) {\r\n this.selectors[selectorNb].children[1].text = label;\r\n };\r\n /** @hidden */\r\n CheckboxGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[1].color = color;\r\n };\r\n /** @hidden */\r\n CheckboxGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[0].color = color;\r\n };\r\n /** @hidden */\r\n CheckboxGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[0].background = color;\r\n };\r\n return CheckboxGroup;\r\n}(SelectorGroup));\r\nexport { CheckboxGroup };\r\n/** Class used to create a RadioGroup\r\n * which contains groups of radio buttons\r\n*/\r\nvar RadioGroup = /** @class */ (function (_super) {\r\n __extends(RadioGroup, _super);\r\n function RadioGroup() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._selectNb = 0;\r\n return _this;\r\n }\r\n /** Adds a radio button as a control\r\n * @param label is the label for the selector\r\n * @param func is the function called when the Selector is checked\r\n * @param checked is true when Selector is checked\r\n */\r\n RadioGroup.prototype.addRadio = function (label, func, checked) {\r\n if (func === void 0) { func = function (n) { }; }\r\n if (checked === void 0) { checked = false; }\r\n var nb = this._selectNb++;\r\n var button = new RadioButton();\r\n button.name = label;\r\n button.width = \"20px\";\r\n button.height = \"20px\";\r\n button.color = \"#364249\";\r\n button.background = \"#CCCCCC\";\r\n button.group = this.name;\r\n button.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n button.onIsCheckedChangedObservable.add(function (state) {\r\n if (state) {\r\n func(nb);\r\n }\r\n });\r\n var _selector = Control.AddHeader(button, label, \"200px\", { isHorizontal: true, controlFirst: true });\r\n _selector.height = \"30px\";\r\n _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _selector.left = \"4px\";\r\n this.groupPanel.addControl(_selector);\r\n this.selectors.push(_selector);\r\n button.isChecked = checked;\r\n if (this.groupPanel.parent && this.groupPanel.parent.parent) {\r\n button.color = this.groupPanel.parent.parent.buttonColor;\r\n button.background = this.groupPanel.parent.parent.buttonBackground;\r\n }\r\n };\r\n /** @hidden */\r\n RadioGroup.prototype._setSelectorLabel = function (selectorNb, label) {\r\n this.selectors[selectorNb].children[1].text = label;\r\n };\r\n /** @hidden */\r\n RadioGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[1].color = color;\r\n };\r\n /** @hidden */\r\n RadioGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[0].color = color;\r\n };\r\n /** @hidden */\r\n RadioGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[0].background = color;\r\n };\r\n return RadioGroup;\r\n}(SelectorGroup));\r\nexport { RadioGroup };\r\n/** Class used to create a SliderGroup\r\n * which contains groups of slider buttons\r\n*/\r\nvar SliderGroup = /** @class */ (function (_super) {\r\n __extends(SliderGroup, _super);\r\n function SliderGroup() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Adds a slider to the SelectorGroup\r\n * @param label is the label for the SliderBar\r\n * @param func is the function called when the Slider moves\r\n * @param unit is a string describing the units used, eg degrees or metres\r\n * @param min is the minimum value for the Slider\r\n * @param max is the maximum value for the Slider\r\n * @param value is the start value for the Slider between min and max\r\n * @param onValueChange is the function used to format the value displayed, eg radians to degrees\r\n */\r\n SliderGroup.prototype.addSlider = function (label, func, unit, min, max, value, onValueChange) {\r\n if (func === void 0) { func = function (v) { }; }\r\n if (unit === void 0) { unit = \"Units\"; }\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 0; }\r\n if (value === void 0) { value = 0; }\r\n if (onValueChange === void 0) { onValueChange = function (v) { return v | 0; }; }\r\n var button = new Slider();\r\n button.name = unit;\r\n button.value = value;\r\n button.minimum = min;\r\n button.maximum = max;\r\n button.width = 0.9;\r\n button.height = \"20px\";\r\n button.color = \"#364249\";\r\n button.background = \"#CCCCCC\";\r\n button.borderColor = \"black\";\r\n button.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n button.left = \"4px\";\r\n button.paddingBottom = \"4px\";\r\n button.onValueChangedObservable.add(function (value) {\r\n button.parent.children[0].text = button.parent.children[0].name + \": \" + onValueChange(value) + \" \" + button.name;\r\n func(value);\r\n });\r\n var _selector = Control.AddHeader(button, label + \": \" + onValueChange(value) + \" \" + unit, \"30px\", { isHorizontal: false, controlFirst: false });\r\n _selector.height = \"60px\";\r\n _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _selector.left = \"4px\";\r\n _selector.children[0].name = label;\r\n this.groupPanel.addControl(_selector);\r\n this.selectors.push(_selector);\r\n if (this.groupPanel.parent && this.groupPanel.parent.parent) {\r\n button.color = this.groupPanel.parent.parent.buttonColor;\r\n button.background = this.groupPanel.parent.parent.buttonBackground;\r\n }\r\n };\r\n /** @hidden */\r\n SliderGroup.prototype._setSelectorLabel = function (selectorNb, label) {\r\n this.selectors[selectorNb].children[0].name = label;\r\n this.selectors[selectorNb].children[0].text = label + \": \" + this.selectors[selectorNb].children[1].value + \" \" + this.selectors[selectorNb].children[1].name;\r\n };\r\n /** @hidden */\r\n SliderGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[0].color = color;\r\n };\r\n /** @hidden */\r\n SliderGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[1].color = color;\r\n };\r\n /** @hidden */\r\n SliderGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {\r\n this.selectors[selectorNb].children[1].background = color;\r\n };\r\n return SliderGroup;\r\n}(SelectorGroup));\r\nexport { SliderGroup };\r\n/** Class used to hold the controls for the checkboxes, radio buttons and sliders\r\n * @see https://doc.babylonjs.com/how_to/selector\r\n*/\r\nvar SelectionPanel = /** @class */ (function (_super) {\r\n __extends(SelectionPanel, _super);\r\n /**\r\n * Creates a new SelectionPanel\r\n * @param name of SelectionPanel\r\n * @param groups is an array of SelectionGroups\r\n */\r\n function SelectionPanel(\r\n /** name of SelectionPanel */\r\n name, \r\n /** an array of SelectionGroups */\r\n groups) {\r\n if (groups === void 0) { groups = []; }\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this.groups = groups;\r\n _this._buttonColor = \"#364249\";\r\n _this._buttonBackground = \"#CCCCCC\";\r\n _this._headerColor = \"black\";\r\n _this._barColor = \"white\";\r\n _this._barHeight = \"2px\";\r\n _this._spacerHeight = \"20px\";\r\n _this._bars = new Array();\r\n _this._groups = groups;\r\n _this.thickness = 2;\r\n _this._panel = new StackPanel();\r\n _this._panel.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n _this._panel.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _this._panel.top = 5;\r\n _this._panel.left = 5;\r\n _this._panel.width = 0.95;\r\n if (groups.length > 0) {\r\n for (var i = 0; i < groups.length - 1; i++) {\r\n _this._panel.addControl(groups[i].groupPanel);\r\n _this._addSpacer();\r\n }\r\n _this._panel.addControl(groups[groups.length - 1].groupPanel);\r\n }\r\n _this.addControl(_this._panel);\r\n return _this;\r\n }\r\n SelectionPanel.prototype._getTypeName = function () {\r\n return \"SelectionPanel\";\r\n };\r\n Object.defineProperty(SelectionPanel.prototype, \"panel\", {\r\n /** Gets the (stack) panel of the SelectionPanel */\r\n get: function () {\r\n return this._panel;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SelectionPanel.prototype, \"headerColor\", {\r\n /** Gets or sets the headerColor */\r\n get: function () {\r\n return this._headerColor;\r\n },\r\n set: function (color) {\r\n if (this._headerColor === color) {\r\n return;\r\n }\r\n this._headerColor = color;\r\n this._setHeaderColor();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SelectionPanel.prototype._setHeaderColor = function () {\r\n for (var i = 0; i < this._groups.length; i++) {\r\n this._groups[i].groupPanel.children[0].color = this._headerColor;\r\n }\r\n };\r\n Object.defineProperty(SelectionPanel.prototype, \"buttonColor\", {\r\n /** Gets or sets the button color */\r\n get: function () {\r\n return this._buttonColor;\r\n },\r\n set: function (color) {\r\n if (this._buttonColor === color) {\r\n return;\r\n }\r\n this._buttonColor = color;\r\n this._setbuttonColor();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SelectionPanel.prototype._setbuttonColor = function () {\r\n for (var i = 0; i < this._groups.length; i++) {\r\n for (var j = 0; j < this._groups[i].selectors.length; j++) {\r\n this._groups[i]._setSelectorButtonColor(j, this._buttonColor);\r\n }\r\n }\r\n };\r\n Object.defineProperty(SelectionPanel.prototype, \"labelColor\", {\r\n /** Gets or sets the label color */\r\n get: function () {\r\n return this._labelColor;\r\n },\r\n set: function (color) {\r\n if (this._labelColor === color) {\r\n return;\r\n }\r\n this._labelColor = color;\r\n this._setLabelColor();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SelectionPanel.prototype._setLabelColor = function () {\r\n for (var i = 0; i < this._groups.length; i++) {\r\n for (var j = 0; j < this._groups[i].selectors.length; j++) {\r\n this._groups[i]._setSelectorLabelColor(j, this._labelColor);\r\n }\r\n }\r\n };\r\n Object.defineProperty(SelectionPanel.prototype, \"buttonBackground\", {\r\n /** Gets or sets the button background */\r\n get: function () {\r\n return this._buttonBackground;\r\n },\r\n set: function (color) {\r\n if (this._buttonBackground === color) {\r\n return;\r\n }\r\n this._buttonBackground = color;\r\n this._setButtonBackground();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SelectionPanel.prototype._setButtonBackground = function () {\r\n for (var i = 0; i < this._groups.length; i++) {\r\n for (var j = 0; j < this._groups[i].selectors.length; j++) {\r\n this._groups[i]._setSelectorButtonBackground(j, this._buttonBackground);\r\n }\r\n }\r\n };\r\n Object.defineProperty(SelectionPanel.prototype, \"barColor\", {\r\n /** Gets or sets the color of separator bar */\r\n get: function () {\r\n return this._barColor;\r\n },\r\n set: function (color) {\r\n if (this._barColor === color) {\r\n return;\r\n }\r\n this._barColor = color;\r\n this._setBarColor();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SelectionPanel.prototype._setBarColor = function () {\r\n for (var i = 0; i < this._bars.length; i++) {\r\n this._bars[i].children[0].background = this._barColor;\r\n }\r\n };\r\n Object.defineProperty(SelectionPanel.prototype, \"barHeight\", {\r\n /** Gets or sets the height of separator bar */\r\n get: function () {\r\n return this._barHeight;\r\n },\r\n set: function (value) {\r\n if (this._barHeight === value) {\r\n return;\r\n }\r\n this._barHeight = value;\r\n this._setBarHeight();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SelectionPanel.prototype._setBarHeight = function () {\r\n for (var i = 0; i < this._bars.length; i++) {\r\n this._bars[i].children[0].height = this._barHeight;\r\n }\r\n };\r\n Object.defineProperty(SelectionPanel.prototype, \"spacerHeight\", {\r\n /** Gets or sets the height of spacers*/\r\n get: function () {\r\n return this._spacerHeight;\r\n },\r\n set: function (value) {\r\n if (this._spacerHeight === value) {\r\n return;\r\n }\r\n this._spacerHeight = value;\r\n this._setSpacerHeight();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SelectionPanel.prototype._setSpacerHeight = function () {\r\n for (var i = 0; i < this._bars.length; i++) {\r\n this._bars[i].height = this._spacerHeight;\r\n }\r\n };\r\n /** Adds a bar between groups */\r\n SelectionPanel.prototype._addSpacer = function () {\r\n var separator = new Container();\r\n separator.width = 1;\r\n separator.height = this._spacerHeight;\r\n separator.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n var bar = new Rectangle();\r\n bar.width = 1;\r\n bar.height = this._barHeight;\r\n bar.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n bar.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n bar.background = this._barColor;\r\n bar.color = \"transparent\";\r\n separator.addControl(bar);\r\n this._panel.addControl(separator);\r\n this._bars.push(separator);\r\n };\r\n /** Add a group to the selection panel\r\n * @param group is the selector group to add\r\n */\r\n SelectionPanel.prototype.addGroup = function (group) {\r\n if (this._groups.length > 0) {\r\n this._addSpacer();\r\n }\r\n this._panel.addControl(group.groupPanel);\r\n this._groups.push(group);\r\n group.groupPanel.children[0].color = this._headerColor;\r\n for (var j = 0; j < group.selectors.length; j++) {\r\n group._setSelectorButtonColor(j, this._buttonColor);\r\n group._setSelectorButtonBackground(j, this._buttonBackground);\r\n }\r\n };\r\n /** Remove the group from the given position\r\n * @param groupNb is the position of the group in the list\r\n */\r\n SelectionPanel.prototype.removeGroup = function (groupNb) {\r\n if (groupNb < 0 || groupNb >= this._groups.length) {\r\n return;\r\n }\r\n var group = this._groups[groupNb];\r\n this._panel.removeControl(group.groupPanel);\r\n this._groups.splice(groupNb, 1);\r\n if (groupNb < this._bars.length) {\r\n this._panel.removeControl(this._bars[groupNb]);\r\n this._bars.splice(groupNb, 1);\r\n }\r\n };\r\n /** Change a group header label\r\n * @param label is the new group header label\r\n * @param groupNb is the number of the group to relabel\r\n * */\r\n SelectionPanel.prototype.setHeaderName = function (label, groupNb) {\r\n if (groupNb < 0 || groupNb >= this._groups.length) {\r\n return;\r\n }\r\n var group = this._groups[groupNb];\r\n group.groupPanel.children[0].text = label;\r\n };\r\n /** Change selector label to the one given\r\n * @param label is the new selector label\r\n * @param groupNb is the number of the groupcontaining the selector\r\n * @param selectorNb is the number of the selector within a group to relabel\r\n * */\r\n SelectionPanel.prototype.relabel = function (label, groupNb, selectorNb) {\r\n if (groupNb < 0 || groupNb >= this._groups.length) {\r\n return;\r\n }\r\n var group = this._groups[groupNb];\r\n if (selectorNb < 0 || selectorNb >= group.selectors.length) {\r\n return;\r\n }\r\n group._setSelectorLabel(selectorNb, label);\r\n };\r\n /** For a given group position remove the selector at the given position\r\n * @param groupNb is the number of the group to remove the selector from\r\n * @param selectorNb is the number of the selector within the group\r\n */\r\n SelectionPanel.prototype.removeFromGroupSelector = function (groupNb, selectorNb) {\r\n if (groupNb < 0 || groupNb >= this._groups.length) {\r\n return;\r\n }\r\n var group = this._groups[groupNb];\r\n if (selectorNb < 0 || selectorNb >= group.selectors.length) {\r\n return;\r\n }\r\n group.removeSelector(selectorNb);\r\n };\r\n /** For a given group position of correct type add a checkbox button\r\n * @param groupNb is the number of the group to remove the selector from\r\n * @param label is the label for the selector\r\n * @param func is the function called when the Selector is checked\r\n * @param checked is true when Selector is checked\r\n */\r\n SelectionPanel.prototype.addToGroupCheckbox = function (groupNb, label, func, checked) {\r\n if (func === void 0) { func = function () { }; }\r\n if (checked === void 0) { checked = false; }\r\n if (groupNb < 0 || groupNb >= this._groups.length) {\r\n return;\r\n }\r\n var group = this._groups[groupNb];\r\n group.addCheckbox(label, func, checked);\r\n };\r\n /** For a given group position of correct type add a radio button\r\n * @param groupNb is the number of the group to remove the selector from\r\n * @param label is the label for the selector\r\n * @param func is the function called when the Selector is checked\r\n * @param checked is true when Selector is checked\r\n */\r\n SelectionPanel.prototype.addToGroupRadio = function (groupNb, label, func, checked) {\r\n if (func === void 0) { func = function () { }; }\r\n if (checked === void 0) { checked = false; }\r\n if (groupNb < 0 || groupNb >= this._groups.length) {\r\n return;\r\n }\r\n var group = this._groups[groupNb];\r\n group.addRadio(label, func, checked);\r\n };\r\n /**\r\n * For a given slider group add a slider\r\n * @param groupNb is the number of the group to add the slider to\r\n * @param label is the label for the Slider\r\n * @param func is the function called when the Slider moves\r\n * @param unit is a string describing the units used, eg degrees or metres\r\n * @param min is the minimum value for the Slider\r\n * @param max is the maximum value for the Slider\r\n * @param value is the start value for the Slider between min and max\r\n * @param onVal is the function used to format the value displayed, eg radians to degrees\r\n */\r\n SelectionPanel.prototype.addToGroupSlider = function (groupNb, label, func, unit, min, max, value, onVal) {\r\n if (func === void 0) { func = function () { }; }\r\n if (unit === void 0) { unit = \"Units\"; }\r\n if (min === void 0) { min = 0; }\r\n if (max === void 0) { max = 0; }\r\n if (value === void 0) { value = 0; }\r\n if (onVal === void 0) { onVal = function (v) { return v | 0; }; }\r\n if (groupNb < 0 || groupNb >= this._groups.length) {\r\n return;\r\n }\r\n var group = this._groups[groupNb];\r\n group.addSlider(label, func, unit, min, max, value, onVal);\r\n };\r\n return SelectionPanel;\r\n}(Rectangle));\r\nexport { SelectionPanel };\r\n//# sourceMappingURL=selector.js.map","import { __extends } from \"tslib\";\r\nimport { Measure } from \"../../measure\";\r\nimport { Container } from \"../container\";\r\nimport { ValueAndUnit } from \"../../valueAndUnit\";\r\nimport { Control } from \"../control\";\r\n/**\r\n * Class used to hold a the container for ScrollViewer\r\n * @hidden\r\n*/\r\nvar _ScrollViewerWindow = /** @class */ (function (_super) {\r\n __extends(_ScrollViewerWindow, _super);\r\n /**\r\n * Creates a new ScrollViewerWindow\r\n * @param name of ScrollViewerWindow\r\n */\r\n function _ScrollViewerWindow(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this._freezeControls = false;\r\n _this._bucketWidth = 0;\r\n _this._bucketHeight = 0;\r\n _this._buckets = {};\r\n return _this;\r\n }\r\n Object.defineProperty(_ScrollViewerWindow.prototype, \"freezeControls\", {\r\n get: function () {\r\n return this._freezeControls;\r\n },\r\n set: function (value) {\r\n if (this._freezeControls === value) {\r\n return;\r\n }\r\n if (!value) {\r\n this._restoreMeasures();\r\n }\r\n // trigger a full normal layout calculation to be sure all children have their measures up to date\r\n this._freezeControls = false;\r\n var textureSize = this.host.getSize();\r\n var renderWidth = textureSize.width;\r\n var renderHeight = textureSize.height;\r\n var context = this.host.getContext();\r\n var measure = new Measure(0, 0, renderWidth, renderHeight);\r\n this.host._numLayoutCalls = 0;\r\n this.host._rootContainer._layout(measure, context);\r\n // in freeze mode, prepare children measures accordingly\r\n if (value) {\r\n this._updateMeasures();\r\n if (this._useBuckets()) {\r\n this._makeBuckets();\r\n }\r\n }\r\n this._freezeControls = value;\r\n this.host.markAsDirty(); // redraw with the (new) current settings\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ScrollViewerWindow.prototype, \"bucketWidth\", {\r\n get: function () {\r\n return this._bucketWidth;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(_ScrollViewerWindow.prototype, \"bucketHeight\", {\r\n get: function () {\r\n return this._bucketHeight;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n _ScrollViewerWindow.prototype.setBucketSizes = function (width, height) {\r\n this._bucketWidth = width;\r\n this._bucketHeight = height;\r\n if (this._useBuckets()) {\r\n if (this._freezeControls) {\r\n this._makeBuckets();\r\n }\r\n }\r\n else {\r\n this._buckets = {};\r\n }\r\n };\r\n _ScrollViewerWindow.prototype._useBuckets = function () {\r\n return this._bucketWidth > 0 && this._bucketHeight > 0;\r\n };\r\n _ScrollViewerWindow.prototype._makeBuckets = function () {\r\n this._buckets = {};\r\n this._bucketLen = Math.ceil(this.widthInPixels / this._bucketWidth);\r\n this._dispatchInBuckets(this._children);\r\n this._oldLeft = null;\r\n this._oldTop = null;\r\n };\r\n _ScrollViewerWindow.prototype._dispatchInBuckets = function (children) {\r\n for (var i = 0; i < children.length; ++i) {\r\n var child = children[i];\r\n var bStartX = Math.max(0, Math.floor((child._customData._origLeft - this._customData.origLeft) / this._bucketWidth)), bEndX = Math.floor((child._customData._origLeft - this._customData.origLeft + child._currentMeasure.width - 1) / this._bucketWidth), bStartY = Math.max(0, Math.floor((child._customData._origTop - this._customData.origTop) / this._bucketHeight)), bEndY = Math.floor((child._customData._origTop - this._customData.origTop + child._currentMeasure.height - 1) / this._bucketHeight);\r\n while (bStartY <= bEndY) {\r\n for (var x = bStartX; x <= bEndX; ++x) {\r\n var bucket = bStartY * this._bucketLen + x, lstc = this._buckets[bucket];\r\n if (!lstc) {\r\n lstc = [];\r\n this._buckets[bucket] = lstc;\r\n }\r\n lstc.push(child);\r\n }\r\n bStartY++;\r\n }\r\n if (child instanceof Container && child._children.length > 0) {\r\n this._dispatchInBuckets(child._children);\r\n }\r\n }\r\n };\r\n // reset left and top measures for the window and all its children\r\n _ScrollViewerWindow.prototype._updateMeasures = function () {\r\n var left = this.leftInPixels | 0, top = this.topInPixels | 0;\r\n this._measureForChildren.left -= left;\r\n this._measureForChildren.top -= top;\r\n this._currentMeasure.left -= left;\r\n this._currentMeasure.top -= top;\r\n this._customData.origLeftForChildren = this._measureForChildren.left;\r\n this._customData.origTopForChildren = this._measureForChildren.top;\r\n this._customData.origLeft = this._currentMeasure.left;\r\n this._customData.origTop = this._currentMeasure.top;\r\n this._updateChildrenMeasures(this._children, left, top);\r\n };\r\n _ScrollViewerWindow.prototype._updateChildrenMeasures = function (children, left, top) {\r\n for (var i = 0; i < children.length; ++i) {\r\n var child = children[i];\r\n child._currentMeasure.left -= left;\r\n child._currentMeasure.top -= top;\r\n child._customData._origLeft = child._currentMeasure.left; // save the original left and top values for each child\r\n child._customData._origTop = child._currentMeasure.top;\r\n if (child instanceof Container && child._children.length > 0) {\r\n this._updateChildrenMeasures(child._children, left, top);\r\n }\r\n }\r\n };\r\n _ScrollViewerWindow.prototype._restoreMeasures = function () {\r\n var left = this.leftInPixels | 0, top = this.topInPixels | 0;\r\n this._measureForChildren.left = this._customData.origLeftForChildren + left;\r\n this._measureForChildren.top = this._customData.origTopForChildren + top;\r\n this._currentMeasure.left = this._customData.origLeft + left;\r\n this._currentMeasure.top = this._customData.origTop + top;\r\n };\r\n _ScrollViewerWindow.prototype._getTypeName = function () {\r\n return \"ScrollViewerWindow\";\r\n };\r\n /** @hidden */\r\n _ScrollViewerWindow.prototype._additionalProcessing = function (parentMeasure, context) {\r\n _super.prototype._additionalProcessing.call(this, parentMeasure, context);\r\n this._parentMeasure = parentMeasure;\r\n this._measureForChildren.left = this._currentMeasure.left;\r\n this._measureForChildren.top = this._currentMeasure.top;\r\n this._measureForChildren.width = parentMeasure.width;\r\n this._measureForChildren.height = parentMeasure.height;\r\n };\r\n /** @hidden */\r\n _ScrollViewerWindow.prototype._layout = function (parentMeasure, context) {\r\n if (this._freezeControls) {\r\n this.invalidateRect(); // will trigger a redraw of the window\r\n return false;\r\n }\r\n return _super.prototype._layout.call(this, parentMeasure, context);\r\n };\r\n _ScrollViewerWindow.prototype._scrollChildren = function (children, left, top) {\r\n for (var i = 0; i < children.length; ++i) {\r\n var child = children[i];\r\n child._currentMeasure.left = child._customData._origLeft + left;\r\n child._currentMeasure.top = child._customData._origTop + top;\r\n child._isClipped = false; // clipping will be handled by _draw and the call to _intersectsRect()\r\n if (child instanceof Container && child._children.length > 0) {\r\n this._scrollChildren(child._children, left, top);\r\n }\r\n }\r\n };\r\n _ScrollViewerWindow.prototype._scrollChildrenWithBuckets = function (left, top, scrollLeft, scrollTop) {\r\n var bStartX = Math.max(0, Math.floor(-left / this._bucketWidth)), bEndX = Math.floor((-left + this._parentMeasure.width - 1) / this._bucketWidth), bStartY = Math.max(0, Math.floor(-top / this._bucketHeight)), bEndY = Math.floor((-top + this._parentMeasure.height - 1) / this._bucketHeight);\r\n while (bStartY <= bEndY) {\r\n for (var x = bStartX; x <= bEndX; ++x) {\r\n var bucket = bStartY * this._bucketLen + x, lstc = this._buckets[bucket];\r\n if (lstc) {\r\n for (var i = 0; i < lstc.length; ++i) {\r\n var child = lstc[i];\r\n child._currentMeasure.left = child._customData._origLeft + scrollLeft;\r\n child._currentMeasure.top = child._customData._origTop + scrollTop;\r\n child._isClipped = false; // clipping will be handled by _draw and the call to _intersectsRect()\r\n }\r\n }\r\n }\r\n bStartY++;\r\n }\r\n };\r\n /** @hidden */\r\n _ScrollViewerWindow.prototype._draw = function (context, invalidatedRectangle) {\r\n if (!this._freezeControls) {\r\n _super.prototype._draw.call(this, context, invalidatedRectangle);\r\n return;\r\n }\r\n this._localDraw(context);\r\n if (this.clipChildren) {\r\n this._clipForChildren(context);\r\n }\r\n var left = this.leftInPixels | 0, top = this.topInPixels | 0;\r\n if (this._useBuckets()) {\r\n if (this._oldLeft !== null && this._oldTop !== null) {\r\n this._scrollChildrenWithBuckets(this._oldLeft, this._oldTop, left, top);\r\n this._scrollChildrenWithBuckets(left, top, left, top);\r\n }\r\n else {\r\n this._scrollChildren(this._children, left, top);\r\n }\r\n }\r\n else {\r\n this._scrollChildren(this._children, left, top);\r\n }\r\n this._oldLeft = left;\r\n this._oldTop = top;\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (!child._intersectsRect(this._parentMeasure)) {\r\n continue;\r\n }\r\n child._render(context, this._parentMeasure);\r\n }\r\n };\r\n _ScrollViewerWindow.prototype._postMeasure = function () {\r\n if (this._freezeControls) {\r\n _super.prototype._postMeasure.call(this);\r\n return;\r\n }\r\n var maxWidth = this.parentClientWidth;\r\n var maxHeight = this.parentClientHeight;\r\n for (var _i = 0, _a = this.children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n if (!child.isVisible || child.notRenderable) {\r\n continue;\r\n }\r\n if (child.horizontalAlignment === Control.HORIZONTAL_ALIGNMENT_CENTER) {\r\n child._offsetLeft(this._currentMeasure.left - child._currentMeasure.left);\r\n }\r\n if (child.verticalAlignment === Control.VERTICAL_ALIGNMENT_CENTER) {\r\n child._offsetTop(this._currentMeasure.top - child._currentMeasure.top);\r\n }\r\n maxWidth = Math.max(maxWidth, child._currentMeasure.left - this._currentMeasure.left + child._currentMeasure.width + child.paddingRightInPixels);\r\n maxHeight = Math.max(maxHeight, child._currentMeasure.top - this._currentMeasure.top + child._currentMeasure.height + child.paddingBottomInPixels);\r\n }\r\n if (this._currentMeasure.width !== maxWidth) {\r\n this._width.updateInPlace(maxWidth, ValueAndUnit.UNITMODE_PIXEL);\r\n this._currentMeasure.width = maxWidth;\r\n this._rebuildLayout = true;\r\n this._isDirty = true;\r\n }\r\n if (this._currentMeasure.height !== maxHeight) {\r\n this._height.updateInPlace(maxHeight, ValueAndUnit.UNITMODE_PIXEL);\r\n this._currentMeasure.height = maxHeight;\r\n this._rebuildLayout = true;\r\n this._isDirty = true;\r\n }\r\n _super.prototype._postMeasure.call(this);\r\n };\r\n return _ScrollViewerWindow;\r\n}(Container));\r\nexport { _ScrollViewerWindow };\r\n//# sourceMappingURL=scrollViewerWindow.js.map","import { __extends } from \"tslib\";\r\nimport { BaseSlider } from \"./baseSlider\";\r\nimport { Measure } from \"../../measure\";\r\n/**\r\n * Class used to create slider controls\r\n */\r\nvar ScrollBar = /** @class */ (function (_super) {\r\n __extends(ScrollBar, _super);\r\n /**\r\n * Creates a new Slider\r\n * @param name defines the control name\r\n */\r\n function ScrollBar(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._background = \"black\";\r\n _this._borderColor = \"white\";\r\n _this._tempMeasure = new Measure(0, 0, 0, 0);\r\n return _this;\r\n }\r\n Object.defineProperty(ScrollBar.prototype, \"borderColor\", {\r\n /** Gets or sets border color */\r\n get: function () {\r\n return this._borderColor;\r\n },\r\n set: function (value) {\r\n if (this._borderColor === value) {\r\n return;\r\n }\r\n this._borderColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollBar.prototype, \"background\", {\r\n /** Gets or sets background color */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ScrollBar.prototype._getTypeName = function () {\r\n return \"Scrollbar\";\r\n };\r\n ScrollBar.prototype._getThumbThickness = function () {\r\n var thumbThickness = 0;\r\n if (this._thumbWidth.isPixel) {\r\n thumbThickness = this._thumbWidth.getValue(this._host);\r\n }\r\n else {\r\n thumbThickness = this._backgroundBoxThickness * this._thumbWidth.getValue(this._host);\r\n }\r\n return thumbThickness;\r\n };\r\n ScrollBar.prototype._draw = function (context) {\r\n context.save();\r\n this._applyStates(context);\r\n this._prepareRenderingData(\"rectangle\");\r\n var left = this._renderLeft;\r\n var thumbPosition = this._getThumbPosition();\r\n context.fillStyle = this._background;\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n // Value bar\r\n context.fillStyle = this.color;\r\n // Thumb\r\n if (this.isVertical) {\r\n this._tempMeasure.left = left - this._effectiveBarOffset;\r\n this._tempMeasure.top = this._currentMeasure.top + thumbPosition;\r\n this._tempMeasure.width = this._currentMeasure.width;\r\n this._tempMeasure.height = this._effectiveThumbThickness;\r\n }\r\n else {\r\n this._tempMeasure.left = this._currentMeasure.left + thumbPosition;\r\n this._tempMeasure.top = this._currentMeasure.top;\r\n this._tempMeasure.width = this._effectiveThumbThickness;\r\n this._tempMeasure.height = this._currentMeasure.height;\r\n }\r\n context.fillRect(this._tempMeasure.left, this._tempMeasure.top, this._tempMeasure.width, this._tempMeasure.height);\r\n context.restore();\r\n };\r\n /** @hidden */\r\n ScrollBar.prototype._updateValueFromPointer = function (x, y) {\r\n if (this.rotation != 0) {\r\n this._invertTransformMatrix.transformCoordinates(x, y, this._transformedPosition);\r\n x = this._transformedPosition.x;\r\n y = this._transformedPosition.y;\r\n }\r\n if (this._first) {\r\n this._first = false;\r\n this._originX = x;\r\n this._originY = y;\r\n // Check if move is required\r\n if (x < this._tempMeasure.left || x > this._tempMeasure.left + this._tempMeasure.width || y < this._tempMeasure.top || y > this._tempMeasure.top + this._tempMeasure.height) {\r\n if (this.isVertical) {\r\n this.value = this.minimum + (1 - ((y - this._currentMeasure.top) / this._currentMeasure.height)) * (this.maximum - this.minimum);\r\n }\r\n else {\r\n this.value = this.minimum + ((x - this._currentMeasure.left) / this._currentMeasure.width) * (this.maximum - this.minimum);\r\n }\r\n }\r\n }\r\n // Delta mode\r\n var delta = 0;\r\n if (this.isVertical) {\r\n delta = -((y - this._originY) / (this._currentMeasure.height - this._effectiveThumbThickness));\r\n }\r\n else {\r\n delta = (x - this._originX) / (this._currentMeasure.width - this._effectiveThumbThickness);\r\n }\r\n this.value += delta * (this.maximum - this.minimum);\r\n this._originX = x;\r\n this._originY = y;\r\n };\r\n ScrollBar.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n this._first = true;\r\n return _super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi);\r\n };\r\n return ScrollBar;\r\n}(BaseSlider));\r\nexport { ScrollBar };\r\n//# sourceMappingURL=scrollBar.js.map","import { __extends } from \"tslib\";\r\nimport { BaseSlider } from \"./baseSlider\";\r\nimport { Measure } from \"../../measure\";\r\n/**\r\n * Class used to create slider controls\r\n */\r\nvar ImageScrollBar = /** @class */ (function (_super) {\r\n __extends(ImageScrollBar, _super);\r\n /**\r\n * Creates a new ImageScrollBar\r\n * @param name defines the control name\r\n */\r\n function ImageScrollBar(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._thumbLength = 0.5;\r\n _this._thumbHeight = 1;\r\n _this._barImageHeight = 1;\r\n _this._tempMeasure = new Measure(0, 0, 0, 0);\r\n /** Number of 90° rotation to apply on the images when in vertical mode */\r\n _this.num90RotationInVerticalMode = 1;\r\n return _this;\r\n }\r\n Object.defineProperty(ImageScrollBar.prototype, \"backgroundImage\", {\r\n /**\r\n * Gets or sets the image used to render the background for horizontal bar\r\n */\r\n get: function () {\r\n return this._backgroundBaseImage;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._backgroundBaseImage === value) {\r\n return;\r\n }\r\n this._backgroundBaseImage = value;\r\n if (this.isVertical && this.num90RotationInVerticalMode !== 0) {\r\n if (!value.isLoaded) {\r\n value.onImageLoadedObservable.addOnce(function () {\r\n var rotatedValue = value._rotate90(_this.num90RotationInVerticalMode, true);\r\n _this._backgroundImage = rotatedValue;\r\n if (!rotatedValue.isLoaded) {\r\n rotatedValue.onImageLoadedObservable.addOnce(function () {\r\n _this._markAsDirty();\r\n });\r\n }\r\n _this._markAsDirty();\r\n });\r\n }\r\n else {\r\n this._backgroundImage = value._rotate90(this.num90RotationInVerticalMode, true);\r\n this._markAsDirty();\r\n }\r\n }\r\n else {\r\n this._backgroundImage = value;\r\n if (value && !value.isLoaded) {\r\n value.onImageLoadedObservable.addOnce(function () {\r\n _this._markAsDirty();\r\n });\r\n }\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageScrollBar.prototype, \"thumbImage\", {\r\n /**\r\n * Gets or sets the image used to render the thumb\r\n */\r\n get: function () {\r\n return this._thumbBaseImage;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._thumbBaseImage === value) {\r\n return;\r\n }\r\n this._thumbBaseImage = value;\r\n if (this.isVertical && this.num90RotationInVerticalMode !== 0) {\r\n if (!value.isLoaded) {\r\n value.onImageLoadedObservable.addOnce(function () {\r\n var rotatedValue = value._rotate90(-_this.num90RotationInVerticalMode, true);\r\n _this._thumbImage = rotatedValue;\r\n if (!rotatedValue.isLoaded) {\r\n rotatedValue.onImageLoadedObservable.addOnce(function () {\r\n _this._markAsDirty();\r\n });\r\n }\r\n _this._markAsDirty();\r\n });\r\n }\r\n else {\r\n this._thumbImage = value._rotate90(-this.num90RotationInVerticalMode, true);\r\n this._markAsDirty();\r\n }\r\n }\r\n else {\r\n this._thumbImage = value;\r\n if (value && !value.isLoaded) {\r\n value.onImageLoadedObservable.addOnce(function () {\r\n _this._markAsDirty();\r\n });\r\n }\r\n this._markAsDirty();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageScrollBar.prototype, \"thumbLength\", {\r\n /**\r\n * Gets or sets the length of the thumb\r\n */\r\n get: function () {\r\n return this._thumbLength;\r\n },\r\n set: function (value) {\r\n if (this._thumbLength === value) {\r\n return;\r\n }\r\n this._thumbLength = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageScrollBar.prototype, \"thumbHeight\", {\r\n /**\r\n * Gets or sets the height of the thumb\r\n */\r\n get: function () {\r\n return this._thumbHeight;\r\n },\r\n set: function (value) {\r\n if (this._thumbLength === value) {\r\n return;\r\n }\r\n this._thumbHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageScrollBar.prototype, \"barImageHeight\", {\r\n /**\r\n * Gets or sets the height of the bar image\r\n */\r\n get: function () {\r\n return this._barImageHeight;\r\n },\r\n set: function (value) {\r\n if (this._barImageHeight === value) {\r\n return;\r\n }\r\n this._barImageHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ImageScrollBar.prototype._getTypeName = function () {\r\n return \"ImageScrollBar\";\r\n };\r\n ImageScrollBar.prototype._getThumbThickness = function () {\r\n var thumbThickness = 0;\r\n if (this._thumbWidth.isPixel) {\r\n thumbThickness = this._thumbWidth.getValue(this._host);\r\n }\r\n else {\r\n thumbThickness = this._backgroundBoxThickness * this._thumbWidth.getValue(this._host);\r\n }\r\n return thumbThickness;\r\n };\r\n ImageScrollBar.prototype._draw = function (context) {\r\n context.save();\r\n this._applyStates(context);\r\n this._prepareRenderingData(\"rectangle\");\r\n var thumbPosition = this._getThumbPosition();\r\n var left = this._renderLeft;\r\n var top = this._renderTop;\r\n var width = this._renderWidth;\r\n var height = this._renderHeight;\r\n // Background\r\n if (this._backgroundImage) {\r\n this._tempMeasure.copyFromFloats(left, top, width, height);\r\n if (this.isVertical) {\r\n this._tempMeasure.copyFromFloats(left + width * (1 - this._barImageHeight) * 0.5, this._currentMeasure.top, width * this._barImageHeight, height);\r\n this._tempMeasure.height += this._effectiveThumbThickness;\r\n this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure);\r\n }\r\n else {\r\n this._tempMeasure.copyFromFloats(this._currentMeasure.left, top + height * (1 - this._barImageHeight) * 0.5, width, height * this._barImageHeight);\r\n this._tempMeasure.width += this._effectiveThumbThickness;\r\n this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure);\r\n }\r\n this._backgroundImage._draw(context);\r\n }\r\n // Thumb\r\n if (this.isVertical) {\r\n this._tempMeasure.copyFromFloats(left - this._effectiveBarOffset + this._currentMeasure.width * (1 - this._thumbHeight) * 0.5, this._currentMeasure.top + thumbPosition, this._currentMeasure.width * this._thumbHeight, this._effectiveThumbThickness);\r\n }\r\n else {\r\n this._tempMeasure.copyFromFloats(this._currentMeasure.left + thumbPosition, this._currentMeasure.top + this._currentMeasure.height * (1 - this._thumbHeight) * 0.5, this._effectiveThumbThickness, this._currentMeasure.height * this._thumbHeight);\r\n }\r\n if (this._thumbImage) {\r\n this._thumbImage._currentMeasure.copyFrom(this._tempMeasure);\r\n this._thumbImage._draw(context);\r\n }\r\n context.restore();\r\n };\r\n /** @hidden */\r\n ImageScrollBar.prototype._updateValueFromPointer = function (x, y) {\r\n if (this.rotation != 0) {\r\n this._invertTransformMatrix.transformCoordinates(x, y, this._transformedPosition);\r\n x = this._transformedPosition.x;\r\n y = this._transformedPosition.y;\r\n }\r\n if (this._first) {\r\n this._first = false;\r\n this._originX = x;\r\n this._originY = y;\r\n // Check if move is required\r\n if (x < this._tempMeasure.left || x > this._tempMeasure.left + this._tempMeasure.width || y < this._tempMeasure.top || y > this._tempMeasure.top + this._tempMeasure.height) {\r\n if (this.isVertical) {\r\n this.value = this.minimum + (1 - ((y - this._currentMeasure.top) / this._currentMeasure.height)) * (this.maximum - this.minimum);\r\n }\r\n else {\r\n this.value = this.minimum + ((x - this._currentMeasure.left) / this._currentMeasure.width) * (this.maximum - this.minimum);\r\n }\r\n }\r\n }\r\n // Delta mode\r\n var delta = 0;\r\n if (this.isVertical) {\r\n delta = -((y - this._originY) / (this._currentMeasure.height - this._effectiveThumbThickness));\r\n }\r\n else {\r\n delta = (x - this._originX) / (this._currentMeasure.width - this._effectiveThumbThickness);\r\n }\r\n this.value += delta * (this.maximum - this.minimum);\r\n this._originX = x;\r\n this._originY = y;\r\n };\r\n ImageScrollBar.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {\r\n this._first = true;\r\n return _super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi);\r\n };\r\n return ImageScrollBar;\r\n}(BaseSlider));\r\nexport { ImageScrollBar };\r\n//# sourceMappingURL=imageScrollBar.js.map","import { __extends } from \"tslib\";\r\nimport { Rectangle } from \"../rectangle\";\r\nimport { Grid } from \"../grid\";\r\nimport { Control } from \"../control\";\r\nimport { _ScrollViewerWindow } from \"./scrollViewerWindow\";\r\nimport { ScrollBar } from \"../sliders/scrollBar\";\r\nimport { ImageScrollBar } from \"../sliders/imageScrollBar\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to hold a viewer window and sliders in a grid\r\n*/\r\nvar ScrollViewer = /** @class */ (function (_super) {\r\n __extends(ScrollViewer, _super);\r\n /**\r\n * Creates a new ScrollViewer\r\n * @param name of ScrollViewer\r\n */\r\n function ScrollViewer(name, isImageBased) {\r\n var _this = _super.call(this, name) || this;\r\n _this._barSize = 20;\r\n _this._pointerIsOver = false;\r\n _this._wheelPrecision = 0.05;\r\n _this._thumbLength = 0.5;\r\n _this._thumbHeight = 1;\r\n _this._barImageHeight = 1;\r\n _this._horizontalBarImageHeight = 1;\r\n _this._verticalBarImageHeight = 1;\r\n _this._oldWindowContentsWidth = 0;\r\n _this._oldWindowContentsHeight = 0;\r\n _this._forceHorizontalBar = false;\r\n _this._forceVerticalBar = false;\r\n _this._useImageBar = isImageBased ? isImageBased : false;\r\n _this.onDirtyObservable.add(function () {\r\n _this._horizontalBarSpace.color = _this.color;\r\n _this._verticalBarSpace.color = _this.color;\r\n _this._dragSpace.color = _this.color;\r\n });\r\n _this.onPointerEnterObservable.add(function () {\r\n _this._pointerIsOver = true;\r\n });\r\n _this.onPointerOutObservable.add(function () {\r\n _this._pointerIsOver = false;\r\n });\r\n _this._grid = new Grid();\r\n if (_this._useImageBar) {\r\n _this._horizontalBar = new ImageScrollBar();\r\n _this._verticalBar = new ImageScrollBar();\r\n }\r\n else {\r\n _this._horizontalBar = new ScrollBar();\r\n _this._verticalBar = new ScrollBar();\r\n }\r\n _this._window = new _ScrollViewerWindow(\"scrollViewer_window\");\r\n _this._window.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _this._window.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n _this._grid.addColumnDefinition(1);\r\n _this._grid.addColumnDefinition(0, true);\r\n _this._grid.addRowDefinition(1);\r\n _this._grid.addRowDefinition(0, true);\r\n _super.prototype.addControl.call(_this, _this._grid);\r\n _this._grid.addControl(_this._window, 0, 0);\r\n _this._verticalBarSpace = new Rectangle();\r\n _this._verticalBarSpace.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _this._verticalBarSpace.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n _this._verticalBarSpace.thickness = 1;\r\n _this._grid.addControl(_this._verticalBarSpace, 0, 1);\r\n _this._addBar(_this._verticalBar, _this._verticalBarSpace, true, Math.PI);\r\n _this._horizontalBarSpace = new Rectangle();\r\n _this._horizontalBarSpace.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n _this._horizontalBarSpace.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n _this._horizontalBarSpace.thickness = 1;\r\n _this._grid.addControl(_this._horizontalBarSpace, 1, 0);\r\n _this._addBar(_this._horizontalBar, _this._horizontalBarSpace, false, 0);\r\n _this._dragSpace = new Rectangle();\r\n _this._dragSpace.thickness = 1;\r\n _this._grid.addControl(_this._dragSpace, 1, 1);\r\n // Colors\r\n if (!_this._useImageBar) {\r\n _this.barColor = \"grey\";\r\n _this.barBackground = \"transparent\";\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(ScrollViewer.prototype, \"horizontalBar\", {\r\n /**\r\n * Gets the horizontal scrollbar\r\n */\r\n get: function () {\r\n return this._horizontalBar;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"verticalBar\", {\r\n /**\r\n * Gets the vertical scrollbar\r\n */\r\n get: function () {\r\n return this._verticalBar;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Adds a new control to the current container\r\n * @param control defines the control to add\r\n * @returns the current container\r\n */\r\n ScrollViewer.prototype.addControl = function (control) {\r\n if (!control) {\r\n return this;\r\n }\r\n this._window.addControl(control);\r\n return this;\r\n };\r\n /**\r\n * Removes a control from the current container\r\n * @param control defines the control to remove\r\n * @returns the current container\r\n */\r\n ScrollViewer.prototype.removeControl = function (control) {\r\n this._window.removeControl(control);\r\n return this;\r\n };\r\n Object.defineProperty(ScrollViewer.prototype, \"children\", {\r\n /** Gets the list of children */\r\n get: function () {\r\n return this._window.children;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ScrollViewer.prototype._flagDescendantsAsMatrixDirty = function () {\r\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n child._markMatrixAsDirty();\r\n }\r\n };\r\n Object.defineProperty(ScrollViewer.prototype, \"freezeControls\", {\r\n /**\r\n * Freezes or unfreezes the controls in the window.\r\n * When controls are frozen, the scroll viewer can render a lot more quickly but updates to positions/sizes of controls\r\n * are not taken into account. If you want to change positions/sizes, unfreeze, perform the changes then freeze again\r\n */\r\n get: function () {\r\n return this._window.freezeControls;\r\n },\r\n set: function (value) {\r\n this._window.freezeControls = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"bucketWidth\", {\r\n /** Gets the bucket width */\r\n get: function () {\r\n return this._window.bucketWidth;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"bucketHeight\", {\r\n /** Gets the bucket height */\r\n get: function () {\r\n return this._window.bucketHeight;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the bucket sizes.\r\n * When freezeControls is true, setting a non-zero bucket size will improve performances by updating only\r\n * controls that are visible. The bucket sizes is used to subdivide (internally) the window area to smaller areas into which\r\n * controls are dispatched. So, the size should be roughly equals to the mean size of all the controls of\r\n * the window. To disable the usage of buckets, sets either width or height (or both) to 0.\r\n * Please note that using this option will raise the memory usage (the higher the bucket sizes, the less memory\r\n * used), that's why it is not enabled by default.\r\n * @param width width of the bucket\r\n * @param height height of the bucket\r\n */\r\n ScrollViewer.prototype.setBucketSizes = function (width, height) {\r\n this._window.setBucketSizes(width, height);\r\n };\r\n Object.defineProperty(ScrollViewer.prototype, \"forceHorizontalBar\", {\r\n /**\r\n * Forces the horizontal scroll bar to be displayed\r\n */\r\n get: function () {\r\n return this._forceHorizontalBar;\r\n },\r\n set: function (value) {\r\n this._grid.setRowDefinition(1, value ? this._barSize : 0, true);\r\n this._horizontalBar.isVisible = value;\r\n this._forceHorizontalBar = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"forceVerticalBar\", {\r\n /**\r\n * Forces the vertical scroll bar to be displayed\r\n */\r\n get: function () {\r\n return this._forceVerticalBar;\r\n },\r\n set: function (value) {\r\n this._grid.setColumnDefinition(1, value ? this._barSize : 0, true);\r\n this._verticalBar.isVisible = value;\r\n this._forceVerticalBar = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** Reset the scroll viewer window to initial size */\r\n ScrollViewer.prototype.resetWindow = function () {\r\n this._window.width = \"100%\";\r\n this._window.height = \"100%\";\r\n };\r\n ScrollViewer.prototype._getTypeName = function () {\r\n return \"ScrollViewer\";\r\n };\r\n ScrollViewer.prototype._buildClientSizes = function () {\r\n var ratio = this.host.idealRatio;\r\n this._window.parentClientWidth = this._currentMeasure.width - (this._verticalBar.isVisible || this.forceVerticalBar ? this._barSize * ratio : 0) - 2 * this.thickness;\r\n this._window.parentClientHeight = this._currentMeasure.height - (this._horizontalBar.isVisible || this.forceHorizontalBar ? this._barSize * ratio : 0) - 2 * this.thickness;\r\n this._clientWidth = this._window.parentClientWidth;\r\n this._clientHeight = this._window.parentClientHeight;\r\n };\r\n ScrollViewer.prototype._additionalProcessing = function (parentMeasure, context) {\r\n _super.prototype._additionalProcessing.call(this, parentMeasure, context);\r\n this._buildClientSizes();\r\n };\r\n ScrollViewer.prototype._postMeasure = function () {\r\n _super.prototype._postMeasure.call(this);\r\n this._updateScroller();\r\n this._setWindowPosition(false);\r\n };\r\n Object.defineProperty(ScrollViewer.prototype, \"wheelPrecision\", {\r\n /**\r\n * Gets or sets the mouse wheel precision\r\n * from 0 to 1 with a default value of 0.05\r\n * */\r\n get: function () {\r\n return this._wheelPrecision;\r\n },\r\n set: function (value) {\r\n if (this._wheelPrecision === value) {\r\n return;\r\n }\r\n if (value < 0) {\r\n value = 0;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._wheelPrecision = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"scrollBackground\", {\r\n /** Gets or sets the scroll bar container background color */\r\n get: function () {\r\n return this._horizontalBarSpace.background;\r\n },\r\n set: function (color) {\r\n if (this._horizontalBarSpace.background === color) {\r\n return;\r\n }\r\n this._horizontalBarSpace.background = color;\r\n this._verticalBarSpace.background = color;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"barColor\", {\r\n /** Gets or sets the bar color */\r\n get: function () {\r\n return this._barColor;\r\n },\r\n set: function (color) {\r\n if (this._barColor === color) {\r\n return;\r\n }\r\n this._barColor = color;\r\n this._horizontalBar.color = color;\r\n this._verticalBar.color = color;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"thumbImage\", {\r\n /** Gets or sets the bar image */\r\n get: function () {\r\n return this._barImage;\r\n },\r\n set: function (value) {\r\n if (this._barImage === value) {\r\n return;\r\n }\r\n this._barImage = value;\r\n var hb = this._horizontalBar;\r\n var vb = this._verticalBar;\r\n hb.thumbImage = value;\r\n vb.thumbImage = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"horizontalThumbImage\", {\r\n /** Gets or sets the horizontal bar image */\r\n get: function () {\r\n return this._horizontalBarImage;\r\n },\r\n set: function (value) {\r\n if (this._horizontalBarImage === value) {\r\n return;\r\n }\r\n this._horizontalBarImage = value;\r\n var hb = this._horizontalBar;\r\n hb.thumbImage = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"verticalThumbImage\", {\r\n /** Gets or sets the vertical bar image */\r\n get: function () {\r\n return this._verticalBarImage;\r\n },\r\n set: function (value) {\r\n if (this._verticalBarImage === value) {\r\n return;\r\n }\r\n this._verticalBarImage = value;\r\n var vb = this._verticalBar;\r\n vb.thumbImage = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"barSize\", {\r\n /** Gets or sets the size of the bar */\r\n get: function () {\r\n return this._barSize;\r\n },\r\n set: function (value) {\r\n if (this._barSize === value) {\r\n return;\r\n }\r\n this._barSize = value;\r\n this._markAsDirty();\r\n if (this._horizontalBar.isVisible) {\r\n this._grid.setRowDefinition(1, this._barSize, true);\r\n }\r\n if (this._verticalBar.isVisible) {\r\n this._grid.setColumnDefinition(1, this._barSize, true);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"thumbLength\", {\r\n /** Gets or sets the length of the thumb */\r\n get: function () {\r\n return this._thumbLength;\r\n },\r\n set: function (value) {\r\n if (this._thumbLength === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._thumbLength = value;\r\n var hb = this._horizontalBar;\r\n var vb = this._verticalBar;\r\n hb.thumbLength = value;\r\n vb.thumbLength = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"thumbHeight\", {\r\n /** Gets or sets the height of the thumb */\r\n get: function () {\r\n return this._thumbHeight;\r\n },\r\n set: function (value) {\r\n if (this._thumbHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._thumbHeight = value;\r\n var hb = this._horizontalBar;\r\n var vb = this._verticalBar;\r\n hb.thumbHeight = value;\r\n vb.thumbHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"barImageHeight\", {\r\n /** Gets or sets the height of the bar image */\r\n get: function () {\r\n return this._barImageHeight;\r\n },\r\n set: function (value) {\r\n if (this._barImageHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._barImageHeight = value;\r\n var hb = this._horizontalBar;\r\n var vb = this._verticalBar;\r\n hb.barImageHeight = value;\r\n vb.barImageHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"horizontalBarImageHeight\", {\r\n /** Gets or sets the height of the horizontal bar image */\r\n get: function () {\r\n return this._horizontalBarImageHeight;\r\n },\r\n set: function (value) {\r\n if (this._horizontalBarImageHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._horizontalBarImageHeight = value;\r\n var hb = this._horizontalBar;\r\n hb.barImageHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"verticalBarImageHeight\", {\r\n /** Gets or sets the height of the vertical bar image */\r\n get: function () {\r\n return this._verticalBarImageHeight;\r\n },\r\n set: function (value) {\r\n if (this._verticalBarImageHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._verticalBarImageHeight = value;\r\n var vb = this._verticalBar;\r\n vb.barImageHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"barBackground\", {\r\n /** Gets or sets the bar background */\r\n get: function () {\r\n return this._barBackground;\r\n },\r\n set: function (color) {\r\n if (this._barBackground === color) {\r\n return;\r\n }\r\n this._barBackground = color;\r\n var hb = this._horizontalBar;\r\n var vb = this._verticalBar;\r\n hb.background = color;\r\n vb.background = color;\r\n this._dragSpace.background = color;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"barImage\", {\r\n /** Gets or sets the bar background image */\r\n get: function () {\r\n return this._barBackgroundImage;\r\n },\r\n set: function (value) {\r\n if (this._barBackgroundImage === value) {\r\n }\r\n this._barBackgroundImage = value;\r\n var hb = this._horizontalBar;\r\n var vb = this._verticalBar;\r\n hb.backgroundImage = value;\r\n vb.backgroundImage = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"horizontalBarImage\", {\r\n /** Gets or sets the horizontal bar background image */\r\n get: function () {\r\n return this._horizontalBarBackgroundImage;\r\n },\r\n set: function (value) {\r\n if (this._horizontalBarBackgroundImage === value) {\r\n }\r\n this._horizontalBarBackgroundImage = value;\r\n var hb = this._horizontalBar;\r\n hb.backgroundImage = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ScrollViewer.prototype, \"verticalBarImage\", {\r\n /** Gets or sets the vertical bar background image */\r\n get: function () {\r\n return this._verticalBarBackgroundImage;\r\n },\r\n set: function (value) {\r\n if (this._verticalBarBackgroundImage === value) {\r\n }\r\n this._verticalBarBackgroundImage = value;\r\n var vb = this._verticalBar;\r\n vb.backgroundImage = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ScrollViewer.prototype._setWindowPosition = function (force) {\r\n if (force === void 0) { force = true; }\r\n var ratio = this.host.idealRatio;\r\n var windowContentsWidth = this._window._currentMeasure.width;\r\n var windowContentsHeight = this._window._currentMeasure.height;\r\n if (!force && this._oldWindowContentsWidth === windowContentsWidth && this._oldWindowContentsHeight === windowContentsHeight) {\r\n return;\r\n }\r\n this._oldWindowContentsWidth = windowContentsWidth;\r\n this._oldWindowContentsHeight = windowContentsHeight;\r\n var _endLeft = this._clientWidth - windowContentsWidth;\r\n var _endTop = this._clientHeight - windowContentsHeight;\r\n var newLeft = (this._horizontalBar.value / ratio) * _endLeft + \"px\";\r\n var newTop = (this._verticalBar.value / ratio) * _endTop + \"px\";\r\n if (newLeft !== this._window.left) {\r\n this._window.left = newLeft;\r\n if (!this.freezeControls) {\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n if (newTop !== this._window.top) {\r\n this._window.top = newTop;\r\n if (!this.freezeControls) {\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n ScrollViewer.prototype._updateScroller = function () {\r\n var windowContentsWidth = this._window._currentMeasure.width;\r\n var windowContentsHeight = this._window._currentMeasure.height;\r\n if (this._horizontalBar.isVisible && windowContentsWidth <= this._clientWidth && !this.forceHorizontalBar) {\r\n this._grid.setRowDefinition(1, 0, true);\r\n this._horizontalBar.isVisible = false;\r\n this._horizontalBar.value = 0;\r\n this._rebuildLayout = true;\r\n }\r\n else if (!this._horizontalBar.isVisible && (windowContentsWidth > this._clientWidth || this.forceHorizontalBar)) {\r\n this._grid.setRowDefinition(1, this._barSize, true);\r\n this._horizontalBar.isVisible = true;\r\n this._rebuildLayout = true;\r\n }\r\n if (this._verticalBar.isVisible && windowContentsHeight <= this._clientHeight && !this.forceVerticalBar) {\r\n this._grid.setColumnDefinition(1, 0, true);\r\n this._verticalBar.isVisible = false;\r\n this._verticalBar.value = 0;\r\n this._rebuildLayout = true;\r\n }\r\n else if (!this._verticalBar.isVisible && (windowContentsHeight > this._clientHeight || this.forceVerticalBar)) {\r\n this._grid.setColumnDefinition(1, this._barSize, true);\r\n this._verticalBar.isVisible = true;\r\n this._rebuildLayout = true;\r\n }\r\n this._buildClientSizes();\r\n var ratio = this.host.idealRatio;\r\n this._horizontalBar.thumbWidth = this._thumbLength * 0.9 * (this._clientWidth / ratio) + \"px\";\r\n this._verticalBar.thumbWidth = this._thumbLength * 0.9 * (this._clientHeight / ratio) + \"px\";\r\n };\r\n ScrollViewer.prototype._link = function (host) {\r\n _super.prototype._link.call(this, host);\r\n this._attachWheel();\r\n };\r\n /** @hidden */\r\n ScrollViewer.prototype._addBar = function (barControl, barContainer, isVertical, rotation) {\r\n var _this = this;\r\n barControl.paddingLeft = 0;\r\n barControl.width = \"100%\";\r\n barControl.height = \"100%\";\r\n barControl.barOffset = 0;\r\n barControl.value = 0;\r\n barControl.maximum = 1;\r\n barControl.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n barControl.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n barControl.isVertical = isVertical;\r\n barControl.rotation = rotation;\r\n barControl.isVisible = false;\r\n barContainer.addControl(barControl);\r\n barControl.onValueChangedObservable.add(function (value) {\r\n _this._setWindowPosition();\r\n });\r\n };\r\n /** @hidden */\r\n ScrollViewer.prototype._attachWheel = function () {\r\n var _this = this;\r\n if (!this._host || this._onWheelObserver) {\r\n return;\r\n }\r\n this._onWheelObserver = this.onWheelObservable.add(function (pi) {\r\n if (!_this._pointerIsOver) {\r\n return;\r\n }\r\n if (_this._verticalBar.isVisible == true) {\r\n if (pi.y < 0 && _this._verticalBar.value > 0) {\r\n _this._verticalBar.value -= _this._wheelPrecision;\r\n }\r\n else if (pi.y > 0 && _this._verticalBar.value < _this._verticalBar.maximum) {\r\n _this._verticalBar.value += _this._wheelPrecision;\r\n }\r\n }\r\n if (_this._horizontalBar.isVisible == true) {\r\n if (pi.x < 0 && _this._horizontalBar.value < _this._horizontalBar.maximum) {\r\n _this._horizontalBar.value += _this._wheelPrecision;\r\n }\r\n else if (pi.x > 0 && _this._horizontalBar.value > 0) {\r\n _this._horizontalBar.value -= _this._wheelPrecision;\r\n }\r\n }\r\n });\r\n };\r\n ScrollViewer.prototype._renderHighlightSpecific = function (context) {\r\n if (!this.isHighlighted) {\r\n return;\r\n }\r\n _super.prototype._renderHighlightSpecific.call(this, context);\r\n this._grid._renderHighlightSpecific(context);\r\n context.restore();\r\n };\r\n /** Releases associated resources */\r\n ScrollViewer.prototype.dispose = function () {\r\n this.onWheelObservable.remove(this._onWheelObserver);\r\n this._onWheelObserver = null;\r\n _super.prototype.dispose.call(this);\r\n };\r\n return ScrollViewer;\r\n}(Rectangle));\r\nexport { ScrollViewer };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.ScrollViewer\"] = ScrollViewer;\r\n//# sourceMappingURL=scrollViewer.js.map","import { __extends } from \"tslib\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { Button } from \"./button\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to store key control properties\r\n */\r\nvar KeyPropertySet = /** @class */ (function () {\r\n function KeyPropertySet() {\r\n }\r\n return KeyPropertySet;\r\n}());\r\nexport { KeyPropertySet };\r\n/**\r\n * Class used to create virtual keyboard\r\n */\r\nvar VirtualKeyboard = /** @class */ (function (_super) {\r\n __extends(VirtualKeyboard, _super);\r\n function VirtualKeyboard() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /** Observable raised when a key is pressed */\r\n _this.onKeyPressObservable = new Observable();\r\n /** Gets or sets default key button width */\r\n _this.defaultButtonWidth = \"40px\";\r\n /** Gets or sets default key button height */\r\n _this.defaultButtonHeight = \"40px\";\r\n /** Gets or sets default key button left padding */\r\n _this.defaultButtonPaddingLeft = \"2px\";\r\n /** Gets or sets default key button right padding */\r\n _this.defaultButtonPaddingRight = \"2px\";\r\n /** Gets or sets default key button top padding */\r\n _this.defaultButtonPaddingTop = \"2px\";\r\n /** Gets or sets default key button bottom padding */\r\n _this.defaultButtonPaddingBottom = \"2px\";\r\n /** Gets or sets default key button foreground color */\r\n _this.defaultButtonColor = \"#DDD\";\r\n /** Gets or sets default key button background color */\r\n _this.defaultButtonBackground = \"#070707\";\r\n /** Gets or sets shift button foreground color */\r\n _this.shiftButtonColor = \"#7799FF\";\r\n /** Gets or sets shift button thickness*/\r\n _this.selectedShiftThickness = 1;\r\n /** Gets shift key state */\r\n _this.shiftState = 0;\r\n _this._currentlyConnectedInputText = null;\r\n _this._connectedInputTexts = [];\r\n _this._onKeyPressObserver = null;\r\n return _this;\r\n }\r\n VirtualKeyboard.prototype._getTypeName = function () {\r\n return \"VirtualKeyboard\";\r\n };\r\n VirtualKeyboard.prototype._createKey = function (key, propertySet) {\r\n var _this = this;\r\n var button = Button.CreateSimpleButton(key, key);\r\n button.width = propertySet && propertySet.width ? propertySet.width : this.defaultButtonWidth;\r\n button.height = propertySet && propertySet.height ? propertySet.height : this.defaultButtonHeight;\r\n button.color = propertySet && propertySet.color ? propertySet.color : this.defaultButtonColor;\r\n button.background = propertySet && propertySet.background ? propertySet.background : this.defaultButtonBackground;\r\n button.paddingLeft = propertySet && propertySet.paddingLeft ? propertySet.paddingLeft : this.defaultButtonPaddingLeft;\r\n button.paddingRight = propertySet && propertySet.paddingRight ? propertySet.paddingRight : this.defaultButtonPaddingRight;\r\n button.paddingTop = propertySet && propertySet.paddingTop ? propertySet.paddingTop : this.defaultButtonPaddingTop;\r\n button.paddingBottom = propertySet && propertySet.paddingBottom ? propertySet.paddingBottom : this.defaultButtonPaddingBottom;\r\n button.thickness = 0;\r\n button.isFocusInvisible = true;\r\n button.shadowColor = this.shadowColor;\r\n button.shadowBlur = this.shadowBlur;\r\n button.shadowOffsetX = this.shadowOffsetX;\r\n button.shadowOffsetY = this.shadowOffsetY;\r\n button.onPointerUpObservable.add(function () {\r\n _this.onKeyPressObservable.notifyObservers(key);\r\n });\r\n return button;\r\n };\r\n /**\r\n * Adds a new row of keys\r\n * @param keys defines the list of keys to add\r\n * @param propertySets defines the associated property sets\r\n */\r\n VirtualKeyboard.prototype.addKeysRow = function (keys, propertySets) {\r\n var panel = new StackPanel();\r\n panel.isVertical = false;\r\n panel.isFocusInvisible = true;\r\n var maxKey = null;\r\n for (var i = 0; i < keys.length; i++) {\r\n var properties = null;\r\n if (propertySets && propertySets.length === keys.length) {\r\n properties = propertySets[i];\r\n }\r\n var key = this._createKey(keys[i], properties);\r\n if (!maxKey || key.heightInPixels > maxKey.heightInPixels) {\r\n maxKey = key;\r\n }\r\n panel.addControl(key);\r\n }\r\n panel.height = maxKey ? maxKey.height : this.defaultButtonHeight;\r\n this.addControl(panel);\r\n };\r\n /**\r\n * Set the shift key to a specific state\r\n * @param shiftState defines the new shift state\r\n */\r\n VirtualKeyboard.prototype.applyShiftState = function (shiftState) {\r\n if (!this.children) {\r\n return;\r\n }\r\n for (var i = 0; i < this.children.length; i++) {\r\n var row = this.children[i];\r\n if (!row || !row.children) {\r\n continue;\r\n }\r\n var rowContainer = row;\r\n for (var j = 0; j < rowContainer.children.length; j++) {\r\n var button = rowContainer.children[j];\r\n if (!button || !button.children[0]) {\r\n continue;\r\n }\r\n var button_tblock = button.children[0];\r\n if (button_tblock.text === \"\\u21E7\") {\r\n button.color = (shiftState ? this.shiftButtonColor : this.defaultButtonColor);\r\n button.thickness = (shiftState > 1 ? this.selectedShiftThickness : 0);\r\n }\r\n button_tblock.text = (shiftState > 0 ? button_tblock.text.toUpperCase() : button_tblock.text.toLowerCase());\r\n }\r\n }\r\n };\r\n Object.defineProperty(VirtualKeyboard.prototype, \"connectedInputText\", {\r\n /** Gets the input text control currently attached to the keyboard */\r\n get: function () {\r\n return this._currentlyConnectedInputText;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Connects the keyboard with an input text control\r\n *\r\n * @param input defines the target control\r\n */\r\n VirtualKeyboard.prototype.connect = function (input) {\r\n var _this = this;\r\n var inputTextAlreadyConnected = this._connectedInputTexts.some(function (a) { return a.input === input; });\r\n if (inputTextAlreadyConnected) {\r\n return;\r\n }\r\n if (this._onKeyPressObserver === null) {\r\n this._onKeyPressObserver = this.onKeyPressObservable.add(function (key) {\r\n if (!_this._currentlyConnectedInputText) {\r\n return;\r\n }\r\n _this._currentlyConnectedInputText._host.focusedControl = _this._currentlyConnectedInputText;\r\n switch (key) {\r\n case \"\\u21E7\":\r\n _this.shiftState++;\r\n if (_this.shiftState > 2) {\r\n _this.shiftState = 0;\r\n }\r\n _this.applyShiftState(_this.shiftState);\r\n return;\r\n case \"\\u2190\":\r\n _this._currentlyConnectedInputText.processKey(8);\r\n return;\r\n case \"\\u21B5\":\r\n _this._currentlyConnectedInputText.processKey(13);\r\n return;\r\n }\r\n _this._currentlyConnectedInputText.processKey(-1, (_this.shiftState ? key.toUpperCase() : key));\r\n if (_this.shiftState === 1) {\r\n _this.shiftState = 0;\r\n _this.applyShiftState(_this.shiftState);\r\n }\r\n });\r\n }\r\n this.isVisible = false;\r\n this._currentlyConnectedInputText = input;\r\n input._connectedVirtualKeyboard = this;\r\n // Events hooking\r\n var onFocusObserver = input.onFocusObservable.add(function () {\r\n _this._currentlyConnectedInputText = input;\r\n input._connectedVirtualKeyboard = _this;\r\n _this.isVisible = true;\r\n });\r\n var onBlurObserver = input.onBlurObservable.add(function () {\r\n input._connectedVirtualKeyboard = null;\r\n _this._currentlyConnectedInputText = null;\r\n _this.isVisible = false;\r\n });\r\n this._connectedInputTexts.push({\r\n input: input,\r\n onBlurObserver: onBlurObserver,\r\n onFocusObserver: onFocusObserver\r\n });\r\n };\r\n /**\r\n * Disconnects the keyboard from connected InputText controls\r\n *\r\n * @param input optionally defines a target control, otherwise all are disconnected\r\n */\r\n VirtualKeyboard.prototype.disconnect = function (input) {\r\n var _this = this;\r\n if (input) {\r\n // .find not available on IE\r\n var filtered = this._connectedInputTexts.filter(function (a) { return a.input === input; });\r\n if (filtered.length === 1) {\r\n this._removeConnectedInputObservables(filtered[0]);\r\n this._connectedInputTexts = this._connectedInputTexts.filter(function (a) { return a.input !== input; });\r\n if (this._currentlyConnectedInputText === input) {\r\n this._currentlyConnectedInputText = null;\r\n }\r\n }\r\n }\r\n else {\r\n this._connectedInputTexts.forEach(function (connectedInputText) {\r\n _this._removeConnectedInputObservables(connectedInputText);\r\n });\r\n this._connectedInputTexts = [];\r\n }\r\n if (this._connectedInputTexts.length === 0) {\r\n this._currentlyConnectedInputText = null;\r\n this.onKeyPressObservable.remove(this._onKeyPressObserver);\r\n this._onKeyPressObserver = null;\r\n }\r\n };\r\n VirtualKeyboard.prototype._removeConnectedInputObservables = function (connectedInputText) {\r\n connectedInputText.input._connectedVirtualKeyboard = null;\r\n connectedInputText.input.onFocusObservable.remove(connectedInputText.onFocusObserver);\r\n connectedInputText.input.onBlurObservable.remove(connectedInputText.onBlurObserver);\r\n };\r\n /**\r\n * Release all resources\r\n */\r\n VirtualKeyboard.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n this.disconnect();\r\n };\r\n // Statics\r\n /**\r\n * Creates a new keyboard using a default layout\r\n *\r\n * @param name defines control name\r\n * @returns a new VirtualKeyboard\r\n */\r\n VirtualKeyboard.CreateDefaultLayout = function (name) {\r\n var returnValue = new VirtualKeyboard(name);\r\n returnValue.addKeysRow([\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\", \"\\u2190\"]);\r\n returnValue.addKeysRow([\"q\", \"w\", \"e\", \"r\", \"t\", \"y\", \"u\", \"i\", \"o\", \"p\"]);\r\n returnValue.addKeysRow([\"a\", \"s\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \";\", \"'\", \"\\u21B5\"]);\r\n returnValue.addKeysRow([\"\\u21E7\", \"z\", \"x\", \"c\", \"v\", \"b\", \"n\", \"m\", \",\", \".\", \"/\"]);\r\n returnValue.addKeysRow([\" \"], [{ width: \"200px\" }]);\r\n return returnValue;\r\n };\r\n return VirtualKeyboard;\r\n}(StackPanel));\r\nexport { VirtualKeyboard };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.VirtualKeyboard\"] = VirtualKeyboard;\r\n//# sourceMappingURL=virtualKeyboard.js.map","import { __extends } from \"tslib\";\r\nimport { Control } from \"./control\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/** Class used to render a grid */\r\nvar DisplayGrid = /** @class */ (function (_super) {\r\n __extends(DisplayGrid, _super);\r\n /**\r\n * Creates a new GridDisplayRectangle\r\n * @param name defines the control name\r\n */\r\n function DisplayGrid(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._cellWidth = 20;\r\n _this._cellHeight = 20;\r\n _this._minorLineTickness = 1;\r\n _this._minorLineColor = \"DarkGray\";\r\n _this._majorLineTickness = 2;\r\n _this._majorLineColor = \"White\";\r\n _this._majorLineFrequency = 5;\r\n _this._background = \"Black\";\r\n _this._displayMajorLines = true;\r\n _this._displayMinorLines = true;\r\n return _this;\r\n }\r\n Object.defineProperty(DisplayGrid.prototype, \"displayMinorLines\", {\r\n /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */\r\n get: function () {\r\n return this._displayMinorLines;\r\n },\r\n set: function (value) {\r\n if (this._displayMinorLines === value) {\r\n return;\r\n }\r\n this._displayMinorLines = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"displayMajorLines\", {\r\n /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */\r\n get: function () {\r\n return this._displayMajorLines;\r\n },\r\n set: function (value) {\r\n if (this._displayMajorLines === value) {\r\n return;\r\n }\r\n this._displayMajorLines = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"background\", {\r\n /** Gets or sets background color (Black by default) */\r\n get: function () {\r\n return this._background;\r\n },\r\n set: function (value) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"cellWidth\", {\r\n /** Gets or sets the width of each cell (20 by default) */\r\n get: function () {\r\n return this._cellWidth;\r\n },\r\n set: function (value) {\r\n this._cellWidth = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"cellHeight\", {\r\n /** Gets or sets the height of each cell (20 by default) */\r\n get: function () {\r\n return this._cellHeight;\r\n },\r\n set: function (value) {\r\n this._cellHeight = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"minorLineTickness\", {\r\n /** Gets or sets the tickness of minor lines (1 by default) */\r\n get: function () {\r\n return this._minorLineTickness;\r\n },\r\n set: function (value) {\r\n this._minorLineTickness = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"minorLineColor\", {\r\n /** Gets or sets the color of minor lines (DarkGray by default) */\r\n get: function () {\r\n return this._minorLineColor;\r\n },\r\n set: function (value) {\r\n this._minorLineColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"majorLineTickness\", {\r\n /** Gets or sets the tickness of major lines (2 by default) */\r\n get: function () {\r\n return this._majorLineTickness;\r\n },\r\n set: function (value) {\r\n this._majorLineTickness = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"majorLineColor\", {\r\n /** Gets or sets the color of major lines (White by default) */\r\n get: function () {\r\n return this._majorLineColor;\r\n },\r\n set: function (value) {\r\n this._majorLineColor = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DisplayGrid.prototype, \"majorLineFrequency\", {\r\n /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/\r\n get: function () {\r\n return this._majorLineFrequency;\r\n },\r\n set: function (value) {\r\n this._majorLineFrequency = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n DisplayGrid.prototype._draw = function (context, invalidatedRectangle) {\r\n context.save();\r\n this._applyStates(context);\r\n if (this._isEnabled) {\r\n if (this._background) {\r\n context.fillStyle = this._background;\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n var cellCountX = this._currentMeasure.width / this._cellWidth;\r\n var cellCountY = this._currentMeasure.height / this._cellHeight;\r\n // Minor lines\r\n var left = this._currentMeasure.left + this._currentMeasure.width / 2;\r\n var top_1 = this._currentMeasure.top + this._currentMeasure.height / 2;\r\n if (this._displayMinorLines) {\r\n context.strokeStyle = this._minorLineColor;\r\n context.lineWidth = this._minorLineTickness;\r\n for (var x = -cellCountX / 2; x < cellCountX / 2; x++) {\r\n var cellX = left + x * this.cellWidth;\r\n context.beginPath();\r\n context.moveTo(cellX, this._currentMeasure.top);\r\n context.lineTo(cellX, this._currentMeasure.top + this._currentMeasure.height);\r\n context.stroke();\r\n }\r\n for (var y = -cellCountY / 2; y < cellCountY / 2; y++) {\r\n var cellY = top_1 + y * this.cellHeight;\r\n context.beginPath();\r\n context.moveTo(this._currentMeasure.left, cellY);\r\n context.lineTo(this._currentMeasure.left + this._currentMeasure.width, cellY);\r\n context.stroke();\r\n }\r\n }\r\n // Major lines\r\n if (this._displayMajorLines) {\r\n context.strokeStyle = this._majorLineColor;\r\n context.lineWidth = this._majorLineTickness;\r\n for (var x = -cellCountX / 2 + this._majorLineFrequency; x < cellCountX / 2; x += this._majorLineFrequency) {\r\n var cellX = left + x * this.cellWidth;\r\n context.beginPath();\r\n context.moveTo(cellX, this._currentMeasure.top);\r\n context.lineTo(cellX, this._currentMeasure.top + this._currentMeasure.height);\r\n context.stroke();\r\n }\r\n for (var y = -cellCountY / 2 + this._majorLineFrequency; y < cellCountY / 2; y += this._majorLineFrequency) {\r\n var cellY = top_1 + y * this.cellHeight;\r\n context.moveTo(this._currentMeasure.left, cellY);\r\n context.lineTo(this._currentMeasure.left + this._currentMeasure.width, cellY);\r\n context.closePath();\r\n context.stroke();\r\n }\r\n }\r\n }\r\n context.restore();\r\n };\r\n DisplayGrid.prototype._getTypeName = function () {\r\n return \"DisplayGrid\";\r\n };\r\n return DisplayGrid;\r\n}(Control));\r\nexport { DisplayGrid };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.DisplayGrid\"] = DisplayGrid;\r\n//# sourceMappingURL=displayGrid.js.map","import { __extends } from \"tslib\";\r\nimport { BaseSlider } from \"./baseSlider\";\r\nimport { Measure } from \"../../measure\";\r\nimport { _TypeStore } from '@babylonjs/core/Misc/typeStore';\r\n/**\r\n * Class used to create slider controls based on images\r\n */\r\nvar ImageBasedSlider = /** @class */ (function (_super) {\r\n __extends(ImageBasedSlider, _super);\r\n /**\r\n * Creates a new ImageBasedSlider\r\n * @param name defines the control name\r\n */\r\n function ImageBasedSlider(name) {\r\n var _this = _super.call(this, name) || this;\r\n _this.name = name;\r\n _this._tempMeasure = new Measure(0, 0, 0, 0);\r\n return _this;\r\n }\r\n Object.defineProperty(ImageBasedSlider.prototype, \"displayThumb\", {\r\n get: function () {\r\n return this._displayThumb && this.thumbImage != null;\r\n },\r\n set: function (value) {\r\n if (this._displayThumb === value) {\r\n return;\r\n }\r\n this._displayThumb = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageBasedSlider.prototype, \"backgroundImage\", {\r\n /**\r\n * Gets or sets the image used to render the background\r\n */\r\n get: function () {\r\n return this._backgroundImage;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._backgroundImage === value) {\r\n return;\r\n }\r\n this._backgroundImage = value;\r\n if (value && !value.isLoaded) {\r\n value.onImageLoadedObservable.addOnce(function () { return _this._markAsDirty(); });\r\n }\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageBasedSlider.prototype, \"valueBarImage\", {\r\n /**\r\n * Gets or sets the image used to render the value bar\r\n */\r\n get: function () {\r\n return this._valueBarImage;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._valueBarImage === value) {\r\n return;\r\n }\r\n this._valueBarImage = value;\r\n if (value && !value.isLoaded) {\r\n value.onImageLoadedObservable.addOnce(function () { return _this._markAsDirty(); });\r\n }\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ImageBasedSlider.prototype, \"thumbImage\", {\r\n /**\r\n * Gets or sets the image used to render the thumb\r\n */\r\n get: function () {\r\n return this._thumbImage;\r\n },\r\n set: function (value) {\r\n var _this = this;\r\n if (this._thumbImage === value) {\r\n return;\r\n }\r\n this._thumbImage = value;\r\n if (value && !value.isLoaded) {\r\n value.onImageLoadedObservable.addOnce(function () { return _this._markAsDirty(); });\r\n }\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ImageBasedSlider.prototype._getTypeName = function () {\r\n return \"ImageBasedSlider\";\r\n };\r\n ImageBasedSlider.prototype._draw = function (context, invalidatedRectangle) {\r\n context.save();\r\n this._applyStates(context);\r\n this._prepareRenderingData(\"rectangle\");\r\n var thumbPosition = this._getThumbPosition();\r\n var left = this._renderLeft;\r\n var top = this._renderTop;\r\n var width = this._renderWidth;\r\n var height = this._renderHeight;\r\n // Background\r\n if (this._backgroundImage) {\r\n this._tempMeasure.copyFromFloats(left, top, width, height);\r\n if (this.isThumbClamped && this.displayThumb) {\r\n if (this.isVertical) {\r\n this._tempMeasure.height += this._effectiveThumbThickness;\r\n }\r\n else {\r\n this._tempMeasure.width += this._effectiveThumbThickness;\r\n }\r\n }\r\n this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure);\r\n this._backgroundImage._draw(context);\r\n }\r\n // Bar\r\n if (this._valueBarImage) {\r\n if (this.isVertical) {\r\n if (this.isThumbClamped && this.displayThumb) {\r\n this._tempMeasure.copyFromFloats(left, top + thumbPosition, width, height - thumbPosition + this._effectiveThumbThickness);\r\n }\r\n else {\r\n this._tempMeasure.copyFromFloats(left, top + thumbPosition, width, height - thumbPosition);\r\n }\r\n }\r\n else {\r\n if (this.isThumbClamped && this.displayThumb) {\r\n this._tempMeasure.copyFromFloats(left, top, thumbPosition + this._effectiveThumbThickness / 2, height);\r\n }\r\n else {\r\n this._tempMeasure.copyFromFloats(left, top, thumbPosition, height);\r\n }\r\n }\r\n this._valueBarImage._currentMeasure.copyFrom(this._tempMeasure);\r\n this._valueBarImage._draw(context);\r\n }\r\n // Thumb\r\n if (this.displayThumb) {\r\n if (this.isVertical) {\r\n this._tempMeasure.copyFromFloats(left - this._effectiveBarOffset, this._currentMeasure.top + thumbPosition, this._currentMeasure.width, this._effectiveThumbThickness);\r\n }\r\n else {\r\n this._tempMeasure.copyFromFloats(this._currentMeasure.left + thumbPosition, this._currentMeasure.top, this._effectiveThumbThickness, this._currentMeasure.height);\r\n }\r\n this._thumbImage._currentMeasure.copyFrom(this._tempMeasure);\r\n this._thumbImage._draw(context);\r\n }\r\n context.restore();\r\n };\r\n return ImageBasedSlider;\r\n}(BaseSlider));\r\nexport { ImageBasedSlider };\r\n_TypeStore.RegisteredTypes[\"BABYLON.GUI.ImageBasedSlider\"] = ImageBasedSlider;\r\n//# sourceMappingURL=imageBasedSlider.js.map","import { Control } from \"./control\";\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { TextBlock } from \"./textBlock\";\r\n/**\r\n * Forcing an export so that this code will execute\r\n * @hidden\r\n */\r\nvar name = \"Statics\";\r\nexport { name };\r\n/**\r\n * Creates a stack panel that can be used to render headers\r\n * @param control defines the control to associate with the header\r\n * @param text defines the text of the header\r\n * @param size defines the size of the header\r\n * @param options defines options used to configure the header\r\n * @returns a new StackPanel\r\n */\r\nControl.AddHeader = function (control, text, size, options) {\r\n var panel = new StackPanel(\"panel\");\r\n var isHorizontal = options ? options.isHorizontal : true;\r\n var controlFirst = options ? options.controlFirst : true;\r\n panel.isVertical = !isHorizontal;\r\n var header = new TextBlock(\"header\");\r\n header.text = text;\r\n header.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n if (isHorizontal) {\r\n header.width = size;\r\n }\r\n else {\r\n header.height = size;\r\n }\r\n if (controlFirst) {\r\n panel.addControl(control);\r\n panel.addControl(header);\r\n header.paddingLeft = \"5px\";\r\n }\r\n else {\r\n panel.addControl(header);\r\n panel.addControl(control);\r\n header.paddingRight = \"5px\";\r\n }\r\n header.shadowBlur = control.shadowBlur;\r\n header.shadowColor = control.shadowColor;\r\n header.shadowOffsetX = control.shadowOffsetX;\r\n header.shadowOffsetY = control.shadowOffsetY;\r\n return panel;\r\n};\r\n//# sourceMappingURL=statics.js.map","import { Vector2 } from \"@babylonjs/core/Maths/math.vector\";\r\nvar tmpRect = [\r\n new Vector2(0, 0),\r\n new Vector2(0, 0),\r\n new Vector2(0, 0),\r\n new Vector2(0, 0),\r\n];\r\nvar tmpRect2 = [\r\n new Vector2(0, 0),\r\n new Vector2(0, 0),\r\n new Vector2(0, 0),\r\n new Vector2(0, 0),\r\n];\r\nvar tmpV1 = new Vector2(0, 0);\r\nvar tmpV2 = new Vector2(0, 0);\r\n/**\r\n * Class used to store 2D control sizes\r\n */\r\nvar Measure = /** @class */ (function () {\r\n /**\r\n * Creates a new measure\r\n * @param left defines left coordinate\r\n * @param top defines top coordinate\r\n * @param width defines width dimension\r\n * @param height defines height dimension\r\n */\r\n function Measure(\r\n /** defines left coordinate */\r\n left, \r\n /** defines top coordinate */\r\n top, \r\n /** defines width dimension */\r\n width, \r\n /** defines height dimension */\r\n height) {\r\n this.left = left;\r\n this.top = top;\r\n this.width = width;\r\n this.height = height;\r\n }\r\n /**\r\n * Copy from another measure\r\n * @param other defines the other measure to copy from\r\n */\r\n Measure.prototype.copyFrom = function (other) {\r\n this.left = other.left;\r\n this.top = other.top;\r\n this.width = other.width;\r\n this.height = other.height;\r\n };\r\n /**\r\n * Copy from a group of 4 floats\r\n * @param left defines left coordinate\r\n * @param top defines top coordinate\r\n * @param width defines width dimension\r\n * @param height defines height dimension\r\n */\r\n Measure.prototype.copyFromFloats = function (left, top, width, height) {\r\n this.left = left;\r\n this.top = top;\r\n this.width = width;\r\n this.height = height;\r\n };\r\n /**\r\n * Computes the axis aligned bounding box measure for two given measures\r\n * @param a Input measure\r\n * @param b Input measure\r\n * @param result the resulting bounding measure\r\n */\r\n Measure.CombineToRef = function (a, b, result) {\r\n var left = Math.min(a.left, b.left);\r\n var top = Math.min(a.top, b.top);\r\n var right = Math.max(a.left + a.width, b.left + b.width);\r\n var bottom = Math.max(a.top + a.height, b.top + b.height);\r\n result.left = left;\r\n result.top = top;\r\n result.width = right - left;\r\n result.height = bottom - top;\r\n };\r\n /**\r\n * Computes the axis aligned bounding box of the measure after it is modified by a given transform\r\n * @param transform the matrix to transform the measure before computing the AABB\r\n * @param addX number to add to left\r\n * @param addY number to add to top\r\n * @param addWidth number to add to width\r\n * @param addHeight number to add to height\r\n * @param result the resulting AABB\r\n */\r\n Measure.prototype.addAndTransformToRef = function (transform, addX, addY, addWidth, addHeight, result) {\r\n var left = this.left + addX;\r\n var top = this.top + addY;\r\n var width = this.width + addWidth;\r\n var height = this.height + addHeight;\r\n tmpRect[0].copyFromFloats(left, top);\r\n tmpRect[1].copyFromFloats(left + width, top);\r\n tmpRect[2].copyFromFloats(left + width, top + height);\r\n tmpRect[3].copyFromFloats(left, top + height);\r\n tmpV1.copyFromFloats(Number.MAX_VALUE, Number.MAX_VALUE);\r\n tmpV2.copyFromFloats(0, 0);\r\n for (var i = 0; i < 4; i++) {\r\n transform.transformCoordinates(tmpRect[i].x, tmpRect[i].y, tmpRect2[i]);\r\n tmpV1.x = Math.floor(Math.min(tmpV1.x, tmpRect2[i].x));\r\n tmpV1.y = Math.floor(Math.min(tmpV1.y, tmpRect2[i].y));\r\n tmpV2.x = Math.ceil(Math.max(tmpV2.x, tmpRect2[i].x));\r\n tmpV2.y = Math.ceil(Math.max(tmpV2.y, tmpRect2[i].y));\r\n }\r\n result.left = tmpV1.x;\r\n result.top = tmpV1.y;\r\n result.width = tmpV2.x - tmpV1.x;\r\n result.height = tmpV2.y - tmpV1.y;\r\n };\r\n /**\r\n * Computes the axis aligned bounding box of the measure after it is modified by a given transform\r\n * @param transform the matrix to transform the measure before computing the AABB\r\n * @param result the resulting AABB\r\n */\r\n Measure.prototype.transformToRef = function (transform, result) {\r\n this.addAndTransformToRef(transform, 0, 0, 0, 0, result);\r\n };\r\n /**\r\n * Check equality between this measure and another one\r\n * @param other defines the other measures\r\n * @returns true if both measures are equals\r\n */\r\n Measure.prototype.isEqualsTo = function (other) {\r\n if (this.left !== other.left) {\r\n return false;\r\n }\r\n if (this.top !== other.top) {\r\n return false;\r\n }\r\n if (this.width !== other.width) {\r\n return false;\r\n }\r\n if (this.height !== other.height) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Creates an empty measure\r\n * @returns a new measure\r\n */\r\n Measure.Empty = function () {\r\n return new Measure(0, 0, 0, 0);\r\n };\r\n return Measure;\r\n}());\r\nexport { Measure };\r\n//# sourceMappingURL=measure.js.map","/**\r\n * Class used to specific a value and its associated unit\r\n */\r\nvar ValueAndUnit = /** @class */ (function () {\r\n /**\r\n * Creates a new ValueAndUnit\r\n * @param value defines the value to store\r\n * @param unit defines the unit to store\r\n * @param negativeValueAllowed defines a boolean indicating if the value can be negative\r\n */\r\n function ValueAndUnit(value, \r\n /** defines the unit to store */\r\n unit, \r\n /** defines a boolean indicating if the value can be negative */\r\n negativeValueAllowed) {\r\n if (unit === void 0) { unit = ValueAndUnit.UNITMODE_PIXEL; }\r\n if (negativeValueAllowed === void 0) { negativeValueAllowed = true; }\r\n this.unit = unit;\r\n this.negativeValueAllowed = negativeValueAllowed;\r\n this._value = 1;\r\n /**\r\n * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property\r\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\r\n */\r\n this.ignoreAdaptiveScaling = false;\r\n this._value = value;\r\n this._originalUnit = unit;\r\n }\r\n Object.defineProperty(ValueAndUnit.prototype, \"isPercentage\", {\r\n /** Gets a boolean indicating if the value is a percentage */\r\n get: function () {\r\n return this.unit === ValueAndUnit.UNITMODE_PERCENTAGE;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAndUnit.prototype, \"isPixel\", {\r\n /** Gets a boolean indicating if the value is store as pixel */\r\n get: function () {\r\n return this.unit === ValueAndUnit.UNITMODE_PIXEL;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAndUnit.prototype, \"internalValue\", {\r\n /** Gets direct internal value */\r\n get: function () {\r\n return this._value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets value as pixel\r\n * @param host defines the root host\r\n * @param refValue defines the reference value for percentages\r\n * @returns the value as pixel\r\n */\r\n ValueAndUnit.prototype.getValueInPixel = function (host, refValue) {\r\n if (this.isPixel) {\r\n return this.getValue(host);\r\n }\r\n return this.getValue(host) * refValue;\r\n };\r\n /**\r\n * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.\r\n * @param value defines the value to store\r\n * @param unit defines the unit to store\r\n * @returns the current ValueAndUnit\r\n */\r\n ValueAndUnit.prototype.updateInPlace = function (value, unit) {\r\n if (unit === void 0) { unit = ValueAndUnit.UNITMODE_PIXEL; }\r\n this._value = value;\r\n this.unit = unit;\r\n return this;\r\n };\r\n /**\r\n * Gets the value accordingly to its unit\r\n * @param host defines the root host\r\n * @returns the value\r\n */\r\n ValueAndUnit.prototype.getValue = function (host) {\r\n if (host && !this.ignoreAdaptiveScaling && this.unit !== ValueAndUnit.UNITMODE_PERCENTAGE) {\r\n var width = 0;\r\n var height = 0;\r\n if (host.idealWidth) {\r\n width = (this._value * host.getSize().width) / host.idealWidth;\r\n }\r\n if (host.idealHeight) {\r\n height = (this._value * host.getSize().height) / host.idealHeight;\r\n }\r\n if (host.useSmallestIdeal && host.idealWidth && host.idealHeight) {\r\n return window.innerWidth < window.innerHeight ? width : height;\r\n }\r\n if (host.idealWidth) { // horizontal\r\n return width;\r\n }\r\n if (host.idealHeight) { // vertical\r\n return height;\r\n }\r\n }\r\n return this._value;\r\n };\r\n /**\r\n * Gets a string representation of the value\r\n * @param host defines the root host\r\n * @param decimals defines an optional number of decimals to display\r\n * @returns a string\r\n */\r\n ValueAndUnit.prototype.toString = function (host, decimals) {\r\n switch (this.unit) {\r\n case ValueAndUnit.UNITMODE_PERCENTAGE:\r\n var percentage = this.getValue(host) * 100;\r\n return (decimals ? percentage.toFixed(decimals) : percentage) + \"%\";\r\n case ValueAndUnit.UNITMODE_PIXEL:\r\n var pixels = this.getValue(host);\r\n return (decimals ? pixels.toFixed(decimals) : pixels) + \"px\";\r\n }\r\n return this.unit.toString();\r\n };\r\n /**\r\n * Store a value parsed from a string\r\n * @param source defines the source string\r\n * @returns true if the value was successfully parsed\r\n */\r\n ValueAndUnit.prototype.fromString = function (source) {\r\n var match = ValueAndUnit._Regex.exec(source.toString());\r\n if (!match || match.length === 0) {\r\n return false;\r\n }\r\n var sourceValue = parseFloat(match[1]);\r\n var sourceUnit = this._originalUnit;\r\n if (!this.negativeValueAllowed) {\r\n if (sourceValue < 0) {\r\n sourceValue = 0;\r\n }\r\n }\r\n if (match.length === 4) {\r\n switch (match[3]) {\r\n case \"px\":\r\n sourceUnit = ValueAndUnit.UNITMODE_PIXEL;\r\n break;\r\n case \"%\":\r\n sourceUnit = ValueAndUnit.UNITMODE_PERCENTAGE;\r\n sourceValue /= 100.0;\r\n break;\r\n }\r\n }\r\n if (sourceValue === this._value && sourceUnit === this.unit) {\r\n return false;\r\n }\r\n this._value = sourceValue;\r\n this.unit = sourceUnit;\r\n return true;\r\n };\r\n Object.defineProperty(ValueAndUnit, \"UNITMODE_PERCENTAGE\", {\r\n /** UNITMODE_PERCENTAGE */\r\n get: function () {\r\n return ValueAndUnit._UNITMODE_PERCENTAGE;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ValueAndUnit, \"UNITMODE_PIXEL\", {\r\n /** UNITMODE_PIXEL */\r\n get: function () {\r\n return ValueAndUnit._UNITMODE_PIXEL;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Static\r\n ValueAndUnit._Regex = /(^-?\\d*(\\.\\d+)?)(%|px)?/;\r\n ValueAndUnit._UNITMODE_PERCENTAGE = 0;\r\n ValueAndUnit._UNITMODE_PIXEL = 1;\r\n return ValueAndUnit;\r\n}());\r\nexport { ValueAndUnit };\r\n//# sourceMappingURL=valueAndUnit.js.map","import { __extends } from \"tslib\";\r\nimport { AbstractScene } from \"./abstractScene\";\r\nimport { Mesh } from \"./Meshes/mesh\";\r\nimport { Logger } from './Misc/logger';\r\nimport { EngineStore } from './Engines/engineStore';\r\n/**\r\n * Set of assets to keep when moving a scene into an asset container.\r\n */\r\nvar KeepAssets = /** @class */ (function (_super) {\r\n __extends(KeepAssets, _super);\r\n function KeepAssets() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n return KeepAssets;\r\n}(AbstractScene));\r\nexport { KeepAssets };\r\n/**\r\n * Class used to store the output of the AssetContainer.instantiateAllMeshesToScene function\r\n */\r\nvar InstantiatedEntries = /** @class */ (function () {\r\n function InstantiatedEntries() {\r\n /**\r\n * List of new root nodes (eg. nodes with no parent)\r\n */\r\n this.rootNodes = [];\r\n /**\r\n * List of new skeletons\r\n */\r\n this.skeletons = [];\r\n /**\r\n * List of new animation groups\r\n */\r\n this.animationGroups = [];\r\n }\r\n return InstantiatedEntries;\r\n}());\r\nexport { InstantiatedEntries };\r\n/**\r\n * Container with a set of assets that can be added or removed from a scene.\r\n */\r\nvar AssetContainer = /** @class */ (function (_super) {\r\n __extends(AssetContainer, _super);\r\n /**\r\n * Instantiates an AssetContainer.\r\n * @param scene The scene the AssetContainer belongs to.\r\n */\r\n function AssetContainer(scene) {\r\n var _this = _super.call(this) || this;\r\n _this._wasAddedToScene = false;\r\n _this.scene = scene;\r\n _this[\"sounds\"] = [];\r\n _this[\"effectLayers\"] = [];\r\n _this[\"layers\"] = [];\r\n _this[\"lensFlareSystems\"] = [];\r\n _this[\"proceduralTextures\"] = [];\r\n _this[\"reflectionProbes\"] = [];\r\n scene.onDisposeObservable.add(function () {\r\n if (!_this._wasAddedToScene) {\r\n _this.dispose();\r\n }\r\n });\r\n return _this;\r\n }\r\n /**\r\n * Instantiate or clone all meshes and add the new ones to the scene.\r\n * Skeletons and animation groups will all be cloned\r\n * @param nameFunction defines an optional function used to get new names for clones\r\n * @param cloneMaterials defines an optional boolean that defines if materials must be cloned as well (false by default)\r\n * @returns a list of rootNodes, skeletons and aniamtion groups that were duplicated\r\n */\r\n AssetContainer.prototype.instantiateModelsToScene = function (nameFunction, cloneMaterials) {\r\n var _this = this;\r\n if (cloneMaterials === void 0) { cloneMaterials = false; }\r\n var convertionMap = {};\r\n var storeMap = {};\r\n var result = new InstantiatedEntries();\r\n var alreadySwappedSkeletons = [];\r\n var alreadySwappedMaterials = [];\r\n var options = {\r\n doNotInstantiate: true\r\n };\r\n var onClone = function (source, clone) {\r\n convertionMap[source.uniqueId] = clone.uniqueId;\r\n storeMap[clone.uniqueId] = clone;\r\n if (nameFunction) {\r\n clone.name = nameFunction(source.name);\r\n }\r\n if (clone instanceof Mesh) {\r\n var clonedMesh = clone;\r\n if (clonedMesh.morphTargetManager) {\r\n var oldMorphTargetManager = source.morphTargetManager;\r\n clonedMesh.morphTargetManager = oldMorphTargetManager.clone();\r\n for (var index = 0; index < oldMorphTargetManager.numTargets; index++) {\r\n var oldTarget = oldMorphTargetManager.getTarget(index);\r\n var newTarget = clonedMesh.morphTargetManager.getTarget(index);\r\n convertionMap[oldTarget.uniqueId] = newTarget.uniqueId;\r\n storeMap[newTarget.uniqueId] = newTarget;\r\n }\r\n }\r\n }\r\n };\r\n this.transformNodes.forEach(function (o) {\r\n if (!o.parent) {\r\n var newOne = o.instantiateHierarchy(null, options, function (source, clone) {\r\n onClone(source, clone);\r\n });\r\n if (newOne) {\r\n result.rootNodes.push(newOne);\r\n }\r\n }\r\n });\r\n this.meshes.forEach(function (o) {\r\n if (!o.parent) {\r\n var newOne = o.instantiateHierarchy(null, options, function (source, clone) {\r\n onClone(source, clone);\r\n if (clone.material) {\r\n var mesh = clone;\r\n if (mesh.material) {\r\n if (cloneMaterials) {\r\n var sourceMaterial = source.material;\r\n if (alreadySwappedMaterials.indexOf(sourceMaterial) === -1) {\r\n var swap = sourceMaterial.clone(nameFunction ? nameFunction(sourceMaterial.name) : \"Clone of \" + sourceMaterial.name);\r\n alreadySwappedMaterials.push(sourceMaterial);\r\n convertionMap[sourceMaterial.uniqueId] = swap.uniqueId;\r\n storeMap[swap.uniqueId] = swap;\r\n if (sourceMaterial.getClassName() === \"MultiMaterial\") {\r\n var multi = sourceMaterial;\r\n for (var _i = 0, _a = multi.subMaterials; _i < _a.length; _i++) {\r\n var material = _a[_i];\r\n if (!material) {\r\n continue;\r\n }\r\n swap = material.clone(nameFunction ? nameFunction(material.name) : \"Clone of \" + material.name);\r\n alreadySwappedMaterials.push(material);\r\n convertionMap[material.uniqueId] = swap.uniqueId;\r\n storeMap[swap.uniqueId] = swap;\r\n }\r\n multi.subMaterials = multi.subMaterials.map(function (m) { return m && storeMap[convertionMap[m.uniqueId]]; });\r\n }\r\n }\r\n mesh.material = storeMap[convertionMap[sourceMaterial.uniqueId]];\r\n }\r\n else {\r\n if (mesh.material.getClassName() === \"MultiMaterial\") {\r\n if (_this.scene.multiMaterials.indexOf(mesh.material) === -1) {\r\n _this.scene.addMultiMaterial(mesh.material);\r\n }\r\n }\r\n else {\r\n if (_this.scene.materials.indexOf(mesh.material) === -1) {\r\n _this.scene.addMaterial(mesh.material);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n });\r\n if (newOne) {\r\n result.rootNodes.push(newOne);\r\n }\r\n }\r\n });\r\n this.skeletons.forEach(function (s) {\r\n var clone = s.clone(nameFunction ? nameFunction(s.name) : \"Clone of \" + s.name);\r\n if (s.overrideMesh) {\r\n clone.overrideMesh = storeMap[convertionMap[s.overrideMesh.uniqueId]];\r\n }\r\n for (var _i = 0, _a = _this.meshes; _i < _a.length; _i++) {\r\n var m = _a[_i];\r\n if (m.skeleton === s && !m.isAnInstance) {\r\n var copy = storeMap[convertionMap[m.uniqueId]];\r\n copy.skeleton = clone;\r\n if (alreadySwappedSkeletons.indexOf(clone) !== -1) {\r\n continue;\r\n }\r\n alreadySwappedSkeletons.push(clone);\r\n // Check if bones are mesh linked\r\n for (var _b = 0, _c = clone.bones; _b < _c.length; _b++) {\r\n var bone = _c[_b];\r\n if (bone._linkedTransformNode) {\r\n bone._linkedTransformNode = storeMap[convertionMap[bone._linkedTransformNode.uniqueId]];\r\n }\r\n }\r\n }\r\n }\r\n result.skeletons.push(clone);\r\n });\r\n this.animationGroups.forEach(function (o) {\r\n var clone = o.clone(o.name, function (oldTarget) {\r\n var newTarget = storeMap[convertionMap[oldTarget.uniqueId]];\r\n return newTarget || oldTarget;\r\n });\r\n result.animationGroups.push(clone);\r\n });\r\n return result;\r\n };\r\n /**\r\n * Adds all the assets from the container to the scene.\r\n */\r\n AssetContainer.prototype.addAllToScene = function () {\r\n var _this = this;\r\n this._wasAddedToScene = true;\r\n this.cameras.forEach(function (o) {\r\n _this.scene.addCamera(o);\r\n });\r\n this.lights.forEach(function (o) {\r\n _this.scene.addLight(o);\r\n });\r\n this.meshes.forEach(function (o) {\r\n _this.scene.addMesh(o);\r\n });\r\n this.skeletons.forEach(function (o) {\r\n _this.scene.addSkeleton(o);\r\n });\r\n this.animations.forEach(function (o) {\r\n _this.scene.addAnimation(o);\r\n });\r\n this.animationGroups.forEach(function (o) {\r\n _this.scene.addAnimationGroup(o);\r\n });\r\n this.multiMaterials.forEach(function (o) {\r\n _this.scene.addMultiMaterial(o);\r\n });\r\n this.materials.forEach(function (o) {\r\n _this.scene.addMaterial(o);\r\n });\r\n this.morphTargetManagers.forEach(function (o) {\r\n _this.scene.addMorphTargetManager(o);\r\n });\r\n this.geometries.forEach(function (o) {\r\n _this.scene.addGeometry(o);\r\n });\r\n this.transformNodes.forEach(function (o) {\r\n _this.scene.addTransformNode(o);\r\n });\r\n this.actionManagers.forEach(function (o) {\r\n _this.scene.addActionManager(o);\r\n });\r\n this.textures.forEach(function (o) {\r\n _this.scene.addTexture(o);\r\n });\r\n this.reflectionProbes.forEach(function (o) {\r\n _this.scene.addReflectionProbe(o);\r\n });\r\n if (this.environmentTexture) {\r\n this.scene.environmentTexture = this.environmentTexture;\r\n }\r\n for (var _i = 0, _a = this.scene._serializableComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.addFromContainer(this);\r\n }\r\n };\r\n /**\r\n * Removes all the assets in the container from the scene\r\n */\r\n AssetContainer.prototype.removeAllFromScene = function () {\r\n var _this = this;\r\n this._wasAddedToScene = false;\r\n this.cameras.forEach(function (o) {\r\n _this.scene.removeCamera(o);\r\n });\r\n this.lights.forEach(function (o) {\r\n _this.scene.removeLight(o);\r\n });\r\n this.meshes.forEach(function (o) {\r\n _this.scene.removeMesh(o);\r\n });\r\n this.skeletons.forEach(function (o) {\r\n _this.scene.removeSkeleton(o);\r\n });\r\n this.animations.forEach(function (o) {\r\n _this.scene.removeAnimation(o);\r\n });\r\n this.animationGroups.forEach(function (o) {\r\n _this.scene.removeAnimationGroup(o);\r\n });\r\n this.multiMaterials.forEach(function (o) {\r\n _this.scene.removeMultiMaterial(o);\r\n });\r\n this.materials.forEach(function (o) {\r\n _this.scene.removeMaterial(o);\r\n });\r\n this.morphTargetManagers.forEach(function (o) {\r\n _this.scene.removeMorphTargetManager(o);\r\n });\r\n this.geometries.forEach(function (o) {\r\n _this.scene.removeGeometry(o);\r\n });\r\n this.transformNodes.forEach(function (o) {\r\n _this.scene.removeTransformNode(o);\r\n });\r\n this.actionManagers.forEach(function (o) {\r\n _this.scene.removeActionManager(o);\r\n });\r\n this.textures.forEach(function (o) {\r\n _this.scene.removeTexture(o);\r\n });\r\n this.reflectionProbes.forEach(function (o) {\r\n _this.scene.removeReflectionProbe(o);\r\n });\r\n if (this.environmentTexture === this.scene.environmentTexture) {\r\n this.scene.environmentTexture = null;\r\n }\r\n for (var _i = 0, _a = this.scene._serializableComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.removeFromContainer(this);\r\n }\r\n };\r\n /**\r\n * Disposes all the assets in the container\r\n */\r\n AssetContainer.prototype.dispose = function () {\r\n this.cameras.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.cameras = [];\r\n this.lights.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.lights = [];\r\n this.meshes.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.meshes = [];\r\n this.skeletons.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.skeletons = [];\r\n this.animationGroups.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.animationGroups = [];\r\n this.multiMaterials.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.multiMaterials = [];\r\n this.materials.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.materials = [];\r\n this.geometries.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.geometries = [];\r\n this.transformNodes.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.transformNodes = [];\r\n this.actionManagers.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.actionManagers = [];\r\n this.textures.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.textures = [];\r\n this.reflectionProbes.forEach(function (o) {\r\n o.dispose();\r\n });\r\n this.reflectionProbes = [];\r\n if (this.environmentTexture) {\r\n this.environmentTexture.dispose();\r\n this.environmentTexture = null;\r\n }\r\n for (var _i = 0, _a = this.scene._serializableComponents; _i < _a.length; _i++) {\r\n var component = _a[_i];\r\n component.removeFromContainer(this, true);\r\n }\r\n };\r\n AssetContainer.prototype._moveAssets = function (sourceAssets, targetAssets, keepAssets) {\r\n if (!sourceAssets) {\r\n return;\r\n }\r\n for (var _i = 0, sourceAssets_1 = sourceAssets; _i < sourceAssets_1.length; _i++) {\r\n var asset = sourceAssets_1[_i];\r\n var move = true;\r\n if (keepAssets) {\r\n for (var _a = 0, keepAssets_1 = keepAssets; _a < keepAssets_1.length; _a++) {\r\n var keepAsset = keepAssets_1[_a];\r\n if (asset === keepAsset) {\r\n move = false;\r\n break;\r\n }\r\n }\r\n }\r\n if (move) {\r\n targetAssets.push(asset);\r\n }\r\n }\r\n };\r\n /**\r\n * Removes all the assets contained in the scene and adds them to the container.\r\n * @param keepAssets Set of assets to keep in the scene. (default: empty)\r\n */\r\n AssetContainer.prototype.moveAllFromScene = function (keepAssets) {\r\n this._wasAddedToScene = false;\r\n if (keepAssets === undefined) {\r\n keepAssets = new KeepAssets();\r\n }\r\n for (var key in this) {\r\n if (this.hasOwnProperty(key)) {\r\n this[key] = this[key] || (key === \"environmentTexture\" ? null : []);\r\n this._moveAssets(this.scene[key], this[key], keepAssets[key]);\r\n }\r\n }\r\n this.environmentTexture = this.scene.environmentTexture;\r\n this.removeAllFromScene();\r\n };\r\n /**\r\n * Adds all meshes in the asset container to a root mesh that can be used to position all the contained meshes. The root mesh is then added to the front of the meshes in the assetContainer.\r\n * @returns the root mesh\r\n */\r\n AssetContainer.prototype.createRootMesh = function () {\r\n var rootMesh = new Mesh(\"assetContainerRootMesh\", this.scene);\r\n this.meshes.forEach(function (m) {\r\n if (!m.parent) {\r\n rootMesh.addChild(m);\r\n }\r\n });\r\n this.meshes.unshift(rootMesh);\r\n return rootMesh;\r\n };\r\n /**\r\n * Merge animations (direct and animation groups) from this asset container into a scene\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param animatables set of animatables to retarget to a node from the scene\r\n * @param targetConverter defines a function used to convert animation targets from the asset container to the scene (default: search node by name)\r\n * @returns an array of the new AnimationGroup added to the scene (empty array if none)\r\n */\r\n AssetContainer.prototype.mergeAnimationsTo = function (scene, animatables, targetConverter) {\r\n if (scene === void 0) { scene = EngineStore.LastCreatedScene; }\r\n if (targetConverter === void 0) { targetConverter = null; }\r\n if (!scene) {\r\n Logger.Error(\"No scene available to merge animations to\");\r\n return [];\r\n }\r\n var _targetConverter = targetConverter ? targetConverter : function (target) {\r\n var node = null;\r\n var targetProperty = target.animations.length ? target.animations[0].targetProperty : \"\";\r\n /*\r\n BabylonJS adds special naming to targets that are children of nodes.\r\n This name attempts to remove that special naming to get the parent nodes name in case the target\r\n can't be found in the node tree\r\n\r\n Ex: Torso_primitive0 likely points to a Mesh primitive. We take away primitive0 and are left with \"Torso\" which is the name\r\n of the primitive's parent.\r\n */\r\n var name = target.name.split(\".\").join(\"\").split(\"_primitive\")[0];\r\n switch (targetProperty) {\r\n case \"position\":\r\n case \"rotationQuaternion\":\r\n node = scene.getTransformNodeByName(target.name) || scene.getTransformNodeByName(name);\r\n break;\r\n case \"influence\":\r\n node = scene.getMorphTargetByName(target.name) || scene.getMorphTargetByName(name);\r\n break;\r\n default:\r\n node = scene.getNodeByName(target.name) || scene.getNodeByName(name);\r\n }\r\n return node;\r\n };\r\n // Copy new node animations\r\n var nodesInAC = this.getNodes();\r\n nodesInAC.forEach(function (nodeInAC) {\r\n var nodeInScene = _targetConverter(nodeInAC);\r\n if (nodeInScene !== null) {\r\n var _loop_1 = function (animationInAC) {\r\n // Doing treatment on an array for safety measure\r\n var animationsWithSameProperty = nodeInScene.animations.filter(function (animationInScene) {\r\n return animationInScene.targetProperty === animationInAC.targetProperty;\r\n });\r\n for (var _i = 0, animationsWithSameProperty_1 = animationsWithSameProperty; _i < animationsWithSameProperty_1.length; _i++) {\r\n var animationWithSameProperty = animationsWithSameProperty_1[_i];\r\n var index = nodeInScene.animations.indexOf(animationWithSameProperty, 0);\r\n if (index > -1) {\r\n nodeInScene.animations.splice(index, 1);\r\n }\r\n }\r\n };\r\n // Remove old animations with same target property as a new one\r\n for (var _i = 0, _a = nodeInAC.animations; _i < _a.length; _i++) {\r\n var animationInAC = _a[_i];\r\n _loop_1(animationInAC);\r\n }\r\n // Append new animations\r\n nodeInScene.animations = nodeInScene.animations.concat(nodeInAC.animations);\r\n }\r\n });\r\n var newAnimationGroups = new Array();\r\n // Copy new animation groups\r\n this.animationGroups.slice().forEach(function (animationGroupInAC) {\r\n // Clone the animation group and all its animatables\r\n newAnimationGroups.push(animationGroupInAC.clone(animationGroupInAC.name, _targetConverter));\r\n // Remove animatables related to the asset container\r\n animationGroupInAC.animatables.forEach(function (animatable) {\r\n animatable.stop();\r\n });\r\n });\r\n // Retarget animatables\r\n animatables.forEach(function (animatable) {\r\n var target = _targetConverter(animatable.target);\r\n if (target) {\r\n // Clone the animatable and retarget it\r\n scene.beginAnimation(target, animatable.fromFrame, animatable.toFrame, animatable.loopAnimation, animatable.speedRatio, animatable.onAnimationEnd ? animatable.onAnimationEnd : undefined, undefined, true, undefined, animatable.onAnimationLoop ? animatable.onAnimationLoop : undefined);\r\n // Stop animation for the target in the asset container\r\n scene.stopAnimation(animatable.target);\r\n }\r\n });\r\n return newAnimationGroups;\r\n };\r\n return AssetContainer;\r\n}(AbstractScene));\r\nexport { AssetContainer };\r\n//# sourceMappingURL=assetContainer.js.map","import { StringTools } from './stringTools';\r\n/**\r\n * Utility class for reading from a data buffer\r\n */\r\nvar DataReader = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param buffer The buffer to read\r\n */\r\n function DataReader(buffer) {\r\n /**\r\n * The current byte offset from the beginning of the data buffer.\r\n */\r\n this.byteOffset = 0;\r\n this.buffer = buffer;\r\n }\r\n /**\r\n * Loads the given byte length.\r\n * @param byteLength The byte length to load\r\n * @returns A promise that resolves when the load is complete\r\n */\r\n DataReader.prototype.loadAsync = function (byteLength) {\r\n var _this = this;\r\n return this.buffer.readAsync(this.byteOffset, byteLength).then(function (data) {\r\n _this._dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);\r\n _this._dataByteOffset = 0;\r\n });\r\n };\r\n /**\r\n * Read a unsigned 32-bit integer from the currently loaded data range.\r\n * @returns The 32-bit integer read\r\n */\r\n DataReader.prototype.readUint32 = function () {\r\n var value = this._dataView.getUint32(this._dataByteOffset, true);\r\n this._dataByteOffset += 4;\r\n this.byteOffset += 4;\r\n return value;\r\n };\r\n /**\r\n * Read a byte array from the currently loaded data range.\r\n * @param byteLength The byte length to read\r\n * @returns The byte array read\r\n */\r\n DataReader.prototype.readUint8Array = function (byteLength) {\r\n var value = new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + this._dataByteOffset, byteLength);\r\n this._dataByteOffset += byteLength;\r\n this.byteOffset += byteLength;\r\n return value;\r\n };\r\n /**\r\n * Read a string from the currently loaded data range.\r\n * @param byteLength The byte length to read\r\n * @returns The string read\r\n */\r\n DataReader.prototype.readString = function (byteLength) {\r\n return StringTools.Decode(this.readUint8Array(byteLength));\r\n };\r\n /**\r\n * Skips the given byte length the currently loaded data range.\r\n * @param byteLength The byte length to skip\r\n */\r\n DataReader.prototype.skipBytes = function (byteLength) {\r\n this._dataByteOffset += byteLength;\r\n this.byteOffset += byteLength;\r\n };\r\n return DataReader;\r\n}());\r\nexport { DataReader };\r\n//# sourceMappingURL=dataReader.js.map","import { Tools } from '@babylonjs/core/Misc/tools';\r\nfunction validateAsync(data, rootUrl, fileName, getExternalResource) {\r\n var options = {\r\n externalResourceFunction: function (uri) { return getExternalResource(uri).then(function (value) { return new Uint8Array(value); }); }\r\n };\r\n if (fileName) {\r\n options.uri = (rootUrl === \"file:\" ? fileName : rootUrl + fileName);\r\n }\r\n return (data instanceof ArrayBuffer)\r\n ? GLTFValidator.validateBytes(new Uint8Array(data), options)\r\n : GLTFValidator.validateString(data, options);\r\n}\r\n/**\r\n * The worker function that gets converted to a blob url to pass into a worker.\r\n */\r\nfunction workerFunc() {\r\n var pendingExternalResources = [];\r\n onmessage = function (message) {\r\n var data = message.data;\r\n switch (data.id) {\r\n case \"init\": {\r\n importScripts(data.url);\r\n break;\r\n }\r\n case \"validate\": {\r\n validateAsync(data.data, data.rootUrl, data.fileName, function (uri) { return new Promise(function (resolve, reject) {\r\n var index = pendingExternalResources.length;\r\n pendingExternalResources.push({ resolve: resolve, reject: reject });\r\n postMessage({ id: \"getExternalResource\", index: index, uri: uri });\r\n }); }).then(function (value) {\r\n postMessage({ id: \"validate.resolve\", value: value });\r\n }, function (reason) {\r\n postMessage({ id: \"validate.reject\", reason: reason });\r\n });\r\n break;\r\n }\r\n case \"getExternalResource.resolve\": {\r\n pendingExternalResources[data.index].resolve(data.value);\r\n break;\r\n }\r\n case \"getExternalResource.reject\": {\r\n pendingExternalResources[data.index].reject(data.reason);\r\n break;\r\n }\r\n }\r\n };\r\n}\r\n/**\r\n * glTF validation\r\n */\r\nvar GLTFValidation = /** @class */ (function () {\r\n function GLTFValidation() {\r\n }\r\n /**\r\n * Validate a glTF asset using the glTF-Validator.\r\n * @param data The JSON of a glTF or the array buffer of a binary glTF\r\n * @param rootUrl The root url for the glTF\r\n * @param fileName The file name for the glTF\r\n * @param getExternalResource The callback to get external resources for the glTF validator\r\n * @returns A promise that resolves with the glTF validation results once complete\r\n */\r\n GLTFValidation.ValidateAsync = function (data, rootUrl, fileName, getExternalResource) {\r\n var _this = this;\r\n if (typeof Worker === \"function\") {\r\n return new Promise(function (resolve, reject) {\r\n var workerContent = validateAsync + \"(\" + workerFunc + \")()\";\r\n var workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: \"application/javascript\" }));\r\n var worker = new Worker(workerBlobUrl);\r\n var onError = function (error) {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n };\r\n var onMessage = function (message) {\r\n var data = message.data;\r\n switch (data.id) {\r\n case \"getExternalResource\": {\r\n getExternalResource(data.uri).then(function (value) {\r\n worker.postMessage({ id: \"getExternalResource.resolve\", index: data.index, value: value }, [value]);\r\n }, function (reason) {\r\n worker.postMessage({ id: \"getExternalResource.reject\", index: data.index, reason: reason });\r\n });\r\n break;\r\n }\r\n case \"validate.resolve\": {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(data.value);\r\n break;\r\n }\r\n case \"validate.reject\": {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(data.reason);\r\n }\r\n }\r\n };\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n worker.postMessage({ id: \"init\", url: Tools.GetAbsoluteUrl(_this.Configuration.url) });\r\n worker.postMessage({ id: \"validate\", data: data, rootUrl: rootUrl, fileName: fileName });\r\n });\r\n }\r\n else {\r\n if (!this._LoadScriptPromise) {\r\n this._LoadScriptPromise = Tools.LoadScriptAsync(this.Configuration.url);\r\n }\r\n return this._LoadScriptPromise.then(function () {\r\n return validateAsync(data, rootUrl, fileName, getExternalResource);\r\n });\r\n }\r\n };\r\n /**\r\n * The configuration. Defaults to `{ url: \"https://preview.babylonjs.com/gltf_validator.js\" }`.\r\n */\r\n GLTFValidation.Configuration = {\r\n url: \"https://preview.babylonjs.com/gltf_validator.js\"\r\n };\r\n return GLTFValidation;\r\n}());\r\nexport { GLTFValidation };\r\n//# sourceMappingURL=glTFValidation.js.map","import { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { SceneLoader } from \"@babylonjs/core/Loading/sceneLoader\";\r\nimport { AssetContainer } from \"@babylonjs/core/assetContainer\";\r\nimport { Logger } from '@babylonjs/core/Misc/logger';\r\nimport { DataReader } from '@babylonjs/core/Misc/dataReader';\r\nimport { GLTFValidation } from './glTFValidation';\r\nimport { StringTools } from '@babylonjs/core/Misc/stringTools';\r\n/**\r\n * Mode that determines the coordinate system to use.\r\n */\r\nexport var GLTFLoaderCoordinateSystemMode;\r\n(function (GLTFLoaderCoordinateSystemMode) {\r\n /**\r\n * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.\r\n */\r\n GLTFLoaderCoordinateSystemMode[GLTFLoaderCoordinateSystemMode[\"AUTO\"] = 0] = \"AUTO\";\r\n /**\r\n * Sets the useRightHandedSystem flag on the scene.\r\n */\r\n GLTFLoaderCoordinateSystemMode[GLTFLoaderCoordinateSystemMode[\"FORCE_RIGHT_HANDED\"] = 1] = \"FORCE_RIGHT_HANDED\";\r\n})(GLTFLoaderCoordinateSystemMode || (GLTFLoaderCoordinateSystemMode = {}));\r\n/**\r\n * Mode that determines what animations will start.\r\n */\r\nexport var GLTFLoaderAnimationStartMode;\r\n(function (GLTFLoaderAnimationStartMode) {\r\n /**\r\n * No animation will start.\r\n */\r\n GLTFLoaderAnimationStartMode[GLTFLoaderAnimationStartMode[\"NONE\"] = 0] = \"NONE\";\r\n /**\r\n * The first animation will start.\r\n */\r\n GLTFLoaderAnimationStartMode[GLTFLoaderAnimationStartMode[\"FIRST\"] = 1] = \"FIRST\";\r\n /**\r\n * All animations will start.\r\n */\r\n GLTFLoaderAnimationStartMode[GLTFLoaderAnimationStartMode[\"ALL\"] = 2] = \"ALL\";\r\n})(GLTFLoaderAnimationStartMode || (GLTFLoaderAnimationStartMode = {}));\r\n/**\r\n * Loader state.\r\n */\r\nexport var GLTFLoaderState;\r\n(function (GLTFLoaderState) {\r\n /**\r\n * The asset is loading.\r\n */\r\n GLTFLoaderState[GLTFLoaderState[\"LOADING\"] = 0] = \"LOADING\";\r\n /**\r\n * The asset is ready for rendering.\r\n */\r\n GLTFLoaderState[GLTFLoaderState[\"READY\"] = 1] = \"READY\";\r\n /**\r\n * The asset is completely loaded.\r\n */\r\n GLTFLoaderState[GLTFLoaderState[\"COMPLETE\"] = 2] = \"COMPLETE\";\r\n})(GLTFLoaderState || (GLTFLoaderState = {}));\r\n/**\r\n * File loader for loading glTF files into a scene.\r\n */\r\nvar GLTFFileLoader = /** @class */ (function () {\r\n function GLTFFileLoader() {\r\n // --------------\r\n // Common options\r\n // --------------\r\n /**\r\n * Raised when the asset has been parsed\r\n */\r\n this.onParsedObservable = new Observable();\r\n // ----------\r\n // V2 options\r\n // ----------\r\n /**\r\n * The coordinate system mode. Defaults to AUTO.\r\n */\r\n this.coordinateSystemMode = GLTFLoaderCoordinateSystemMode.AUTO;\r\n /**\r\n * The animation start mode. Defaults to FIRST.\r\n */\r\n this.animationStartMode = GLTFLoaderAnimationStartMode.FIRST;\r\n /**\r\n * Defines if the loader should compile materials before raising the success callback. Defaults to false.\r\n */\r\n this.compileMaterials = false;\r\n /**\r\n * Defines if the loader should also compile materials with clip planes. Defaults to false.\r\n */\r\n this.useClipPlane = false;\r\n /**\r\n * Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.\r\n */\r\n this.compileShadowGenerators = false;\r\n /**\r\n * Defines if the Alpha blended materials are only applied as coverage.\r\n * If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials.\r\n * If true, no extra effects are applied to transparent pixels.\r\n */\r\n this.transparencyAsCoverage = false;\r\n /**\r\n * Defines if the loader should use range requests when load binary glTF files from HTTP.\r\n * Enabling will disable offline support and glTF validator.\r\n * Defaults to false.\r\n */\r\n this.useRangeRequests = false;\r\n /**\r\n * Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.\r\n */\r\n this.createInstances = true;\r\n /**\r\n * Defines if the loader should always compute the bounding boxes of meshes and not use the min/max values from the position accessor. Defaults to false.\r\n */\r\n this.alwaysComputeBoundingBox = false;\r\n /**\r\n * If true, load all materials defined in the file, even if not used by any mesh. Defaults to false.\r\n */\r\n this.loadAllMaterials = false;\r\n /**\r\n * Function called before loading a url referenced by the asset.\r\n */\r\n this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };\r\n /**\r\n * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.\r\n * Note that the observable is raised as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)\r\n */\r\n this.onMeshLoadedObservable = new Observable();\r\n /**\r\n * Observable raised when the loader creates a texture after parsing the glTF properties of the texture.\r\n */\r\n this.onTextureLoadedObservable = new Observable();\r\n /**\r\n * Observable raised when the loader creates a material after parsing the glTF properties of the material.\r\n */\r\n this.onMaterialLoadedObservable = new Observable();\r\n /**\r\n * Observable raised when the loader creates a camera after parsing the glTF properties of the camera.\r\n */\r\n this.onCameraLoadedObservable = new Observable();\r\n /**\r\n * Observable raised when the asset is completely loaded, immediately before the loader is disposed.\r\n * For assets with LODs, raised when all of the LODs are complete.\r\n * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.\r\n */\r\n this.onCompleteObservable = new Observable();\r\n /**\r\n * Observable raised when an error occurs.\r\n */\r\n this.onErrorObservable = new Observable();\r\n /**\r\n * Observable raised after the loader is disposed.\r\n */\r\n this.onDisposeObservable = new Observable();\r\n /**\r\n * Observable raised after a loader extension is created.\r\n * Set additional options for a loader extension in this event.\r\n */\r\n this.onExtensionLoadedObservable = new Observable();\r\n /**\r\n * Defines if the loader should validate the asset.\r\n */\r\n this.validate = false;\r\n /**\r\n * Observable raised after validation when validate is set to true. The event data is the result of the validation.\r\n */\r\n this.onValidatedObservable = new Observable();\r\n this._loader = null;\r\n this._requests = new Array();\r\n /**\r\n * Name of the loader (\"gltf\")\r\n */\r\n this.name = \"gltf\";\r\n /** @hidden */\r\n this.extensions = {\r\n \".gltf\": { isBinary: false },\r\n \".glb\": { isBinary: true }\r\n };\r\n this._logIndentLevel = 0;\r\n this._loggingEnabled = false;\r\n /** @hidden */\r\n this._log = this._logDisabled;\r\n this._capturePerformanceCounters = false;\r\n /** @hidden */\r\n this._startPerformanceCounter = this._startPerformanceCounterDisabled;\r\n /** @hidden */\r\n this._endPerformanceCounter = this._endPerformanceCounterDisabled;\r\n }\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onParsed\", {\r\n /**\r\n * Raised when the asset has been parsed\r\n */\r\n set: function (callback) {\r\n if (this._onParsedObserver) {\r\n this.onParsedObservable.remove(this._onParsedObserver);\r\n }\r\n this._onParsedObserver = this.onParsedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onMeshLoaded\", {\r\n /**\r\n * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.\r\n * Note that the callback is called as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)\r\n */\r\n set: function (callback) {\r\n if (this._onMeshLoadedObserver) {\r\n this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver);\r\n }\r\n this._onMeshLoadedObserver = this.onMeshLoadedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onTextureLoaded\", {\r\n /**\r\n * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.\r\n */\r\n set: function (callback) {\r\n if (this._onTextureLoadedObserver) {\r\n this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver);\r\n }\r\n this._onTextureLoadedObserver = this.onTextureLoadedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onMaterialLoaded\", {\r\n /**\r\n * Callback raised when the loader creates a material after parsing the glTF properties of the material.\r\n */\r\n set: function (callback) {\r\n if (this._onMaterialLoadedObserver) {\r\n this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver);\r\n }\r\n this._onMaterialLoadedObserver = this.onMaterialLoadedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onCameraLoaded\", {\r\n /**\r\n * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.\r\n */\r\n set: function (callback) {\r\n if (this._onCameraLoadedObserver) {\r\n this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver);\r\n }\r\n this._onCameraLoadedObserver = this.onCameraLoadedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onComplete\", {\r\n /**\r\n * Callback raised when the asset is completely loaded, immediately before the loader is disposed.\r\n * For assets with LODs, raised when all of the LODs are complete.\r\n * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.\r\n */\r\n set: function (callback) {\r\n if (this._onCompleteObserver) {\r\n this.onCompleteObservable.remove(this._onCompleteObserver);\r\n }\r\n this._onCompleteObserver = this.onCompleteObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onError\", {\r\n /**\r\n * Callback raised when an error occurs.\r\n */\r\n set: function (callback) {\r\n if (this._onErrorObserver) {\r\n this.onErrorObservable.remove(this._onErrorObserver);\r\n }\r\n this._onErrorObserver = this.onErrorObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onDispose\", {\r\n /**\r\n * Callback raised after the loader is disposed.\r\n */\r\n set: function (callback) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onExtensionLoaded\", {\r\n /**\r\n * Callback raised after a loader extension is created.\r\n */\r\n set: function (callback) {\r\n if (this._onExtensionLoadedObserver) {\r\n this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver);\r\n }\r\n this._onExtensionLoadedObserver = this.onExtensionLoadedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"loggingEnabled\", {\r\n /**\r\n * Defines if the loader logging is enabled.\r\n */\r\n get: function () {\r\n return this._loggingEnabled;\r\n },\r\n set: function (value) {\r\n if (this._loggingEnabled === value) {\r\n return;\r\n }\r\n this._loggingEnabled = value;\r\n if (this._loggingEnabled) {\r\n this._log = this._logEnabled;\r\n }\r\n else {\r\n this._log = this._logDisabled;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"capturePerformanceCounters\", {\r\n /**\r\n * Defines if the loader should capture performance counters.\r\n */\r\n get: function () {\r\n return this._capturePerformanceCounters;\r\n },\r\n set: function (value) {\r\n if (this._capturePerformanceCounters === value) {\r\n return;\r\n }\r\n this._capturePerformanceCounters = value;\r\n if (this._capturePerformanceCounters) {\r\n this._startPerformanceCounter = this._startPerformanceCounterEnabled;\r\n this._endPerformanceCounter = this._endPerformanceCounterEnabled;\r\n }\r\n else {\r\n this._startPerformanceCounter = this._startPerformanceCounterDisabled;\r\n this._endPerformanceCounter = this._endPerformanceCounterDisabled;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFFileLoader.prototype, \"onValidated\", {\r\n /**\r\n * Callback raised after a loader extension is created.\r\n */\r\n set: function (callback) {\r\n if (this._onValidatedObserver) {\r\n this.onValidatedObservable.remove(this._onValidatedObserver);\r\n }\r\n this._onValidatedObserver = this.onValidatedObservable.add(callback);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Disposes the loader, releases resources during load, and cancels any outstanding requests.\r\n */\r\n GLTFFileLoader.prototype.dispose = function () {\r\n if (this._loader) {\r\n this._loader.dispose();\r\n this._loader = null;\r\n }\r\n for (var _i = 0, _a = this._requests; _i < _a.length; _i++) {\r\n var request = _a[_i];\r\n request.abort();\r\n }\r\n this._requests.length = 0;\r\n delete this._progressCallback;\r\n this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };\r\n this.onMeshLoadedObservable.clear();\r\n this.onTextureLoadedObservable.clear();\r\n this.onMaterialLoadedObservable.clear();\r\n this.onCameraLoadedObservable.clear();\r\n this.onCompleteObservable.clear();\r\n this.onExtensionLoadedObservable.clear();\r\n this.onDisposeObservable.notifyObservers(undefined);\r\n this.onDisposeObservable.clear();\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.requestFile = function (scene, url, onSuccess, onProgress, useArrayBuffer, onError) {\r\n var _this = this;\r\n this._progressCallback = onProgress;\r\n if (useArrayBuffer) {\r\n if (this.useRangeRequests) {\r\n if (this.validate) {\r\n Logger.Warn(\"glTF validation is not supported when range requests are enabled\");\r\n }\r\n var fileRequest_1 = {\r\n abort: function () { },\r\n onCompleteObservable: new Observable()\r\n };\r\n var dataBuffer = {\r\n readAsync: function (byteOffset, byteLength) {\r\n return new Promise(function (resolve, reject) {\r\n _this._requestFile(url, scene, function (data) {\r\n resolve(new Uint8Array(data));\r\n }, true, function (error) {\r\n reject(error);\r\n }, function (webRequest) {\r\n webRequest.setRequestHeader(\"Range\", \"bytes=\" + byteOffset + \"-\" + (byteOffset + byteLength - 1));\r\n });\r\n });\r\n },\r\n byteLength: 0\r\n };\r\n this._unpackBinaryAsync(new DataReader(dataBuffer)).then(function (loaderData) {\r\n fileRequest_1.onCompleteObservable.notifyObservers(fileRequest_1);\r\n onSuccess(loaderData);\r\n }, onError);\r\n return fileRequest_1;\r\n }\r\n return this._requestFile(url, scene, function (data, request) {\r\n var arrayBuffer = data;\r\n _this._unpackBinaryAsync(new DataReader({\r\n readAsync: function (byteOffset, byteLength) { return Promise.resolve(new Uint8Array(arrayBuffer, byteOffset, byteLength)); },\r\n byteLength: arrayBuffer.byteLength\r\n })).then(function (loaderData) {\r\n onSuccess(loaderData, request);\r\n }, onError);\r\n }, true, onError);\r\n }\r\n return this._requestFile(url, scene, function (data, request) {\r\n _this._validate(scene, data, Tools.GetFolderPath(url), Tools.GetFilename(url));\r\n onSuccess({ json: _this._parseJson(data) }, request);\r\n }, useArrayBuffer, onError);\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.readFile = function (scene, file, onSuccess, onProgress, useArrayBuffer, onError) {\r\n var _this = this;\r\n return scene._readFile(file, function (data) {\r\n _this._validate(scene, data, \"file:\", file.name);\r\n if (useArrayBuffer) {\r\n var arrayBuffer_1 = data;\r\n _this._unpackBinaryAsync(new DataReader({\r\n readAsync: function (byteOffset, byteLength) { return Promise.resolve(new Uint8Array(arrayBuffer_1, byteOffset, byteLength)); },\r\n byteLength: arrayBuffer_1.byteLength\r\n })).then(onSuccess, onError);\r\n }\r\n else {\r\n onSuccess({ json: _this._parseJson(data) });\r\n }\r\n }, onProgress, useArrayBuffer, onError);\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.importMeshAsync = function (meshesNames, scene, data, rootUrl, onProgress, fileName) {\r\n var _this = this;\r\n return Promise.resolve().then(function () {\r\n _this.onParsedObservable.notifyObservers(data);\r\n _this.onParsedObservable.clear();\r\n _this._log(\"Loading \" + (fileName || \"\"));\r\n _this._loader = _this._getLoader(data);\r\n return _this._loader.importMeshAsync(meshesNames, scene, false, data, rootUrl, onProgress, fileName);\r\n });\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress, fileName) {\r\n var _this = this;\r\n return Promise.resolve().then(function () {\r\n _this.onParsedObservable.notifyObservers(data);\r\n _this.onParsedObservable.clear();\r\n _this._log(\"Loading \" + (fileName || \"\"));\r\n _this._loader = _this._getLoader(data);\r\n return _this._loader.loadAsync(scene, data, rootUrl, onProgress, fileName);\r\n });\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.loadAssetContainerAsync = function (scene, data, rootUrl, onProgress, fileName) {\r\n var _this = this;\r\n return Promise.resolve().then(function () {\r\n _this.onParsedObservable.notifyObservers(data);\r\n _this.onParsedObservable.clear();\r\n _this._log(\"Loading \" + (fileName || \"\"));\r\n _this._loader = _this._getLoader(data);\r\n // Prepare the asset container.\r\n var container = new AssetContainer(scene);\r\n // Get materials/textures when loading to add to container\r\n var materials = [];\r\n _this.onMaterialLoadedObservable.add(function (material) {\r\n materials.push(material);\r\n material.onDisposeObservable.addOnce(function () {\r\n var index = container.materials.indexOf(material);\r\n if (index > -1) {\r\n container.materials.splice(index, 1);\r\n }\r\n index = materials.indexOf(material);\r\n if (index > -1) {\r\n materials.splice(index, 1);\r\n }\r\n });\r\n });\r\n var textures = [];\r\n _this.onTextureLoadedObservable.add(function (texture) {\r\n textures.push(texture);\r\n texture.onDisposeObservable.addOnce(function () {\r\n var index = container.textures.indexOf(texture);\r\n if (index > -1) {\r\n container.textures.splice(index, 1);\r\n }\r\n index = textures.indexOf(texture);\r\n if (index > -1) {\r\n textures.splice(index, 1);\r\n }\r\n });\r\n });\r\n var cameras = [];\r\n _this.onCameraLoadedObservable.add(function (camera) {\r\n cameras.push(camera);\r\n });\r\n return _this._loader.importMeshAsync(null, scene, true, data, rootUrl, onProgress, fileName).then(function (result) {\r\n Array.prototype.push.apply(container.geometries, result.geometries);\r\n Array.prototype.push.apply(container.meshes, result.meshes);\r\n Array.prototype.push.apply(container.particleSystems, result.particleSystems);\r\n Array.prototype.push.apply(container.skeletons, result.skeletons);\r\n Array.prototype.push.apply(container.animationGroups, result.animationGroups);\r\n Array.prototype.push.apply(container.materials, materials);\r\n Array.prototype.push.apply(container.textures, textures);\r\n Array.prototype.push.apply(container.lights, result.lights);\r\n Array.prototype.push.apply(container.transformNodes, result.transformNodes);\r\n Array.prototype.push.apply(container.cameras, cameras);\r\n return container;\r\n });\r\n });\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.canDirectLoad = function (data) {\r\n return (data.indexOf(\"asset\") !== -1 && data.indexOf(\"version\") !== -1)\r\n || StringTools.StartsWith(data, \"data:base64,\" + GLTFFileLoader.magicBase64Encoded)\r\n || StringTools.StartsWith(data, \"data:application/octet-stream;base64,\" + GLTFFileLoader.magicBase64Encoded)\r\n || StringTools.StartsWith(data, \"data:model/gltf-binary;base64,\" + GLTFFileLoader.magicBase64Encoded);\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.directLoad = function (scene, data) {\r\n if (StringTools.StartsWith(data, \"base64,\" + GLTFFileLoader.magicBase64Encoded) ||\r\n StringTools.StartsWith(data, \"application/octet-stream;base64,\" + GLTFFileLoader.magicBase64Encoded) ||\r\n StringTools.StartsWith(data, \"model/gltf-binary;base64,\" + GLTFFileLoader.magicBase64Encoded)) {\r\n var arrayBuffer_2 = Tools.DecodeBase64(data);\r\n this._validate(scene, arrayBuffer_2);\r\n return this._unpackBinaryAsync(new DataReader({\r\n readAsync: function (byteOffset, byteLength) { return Promise.resolve(new Uint8Array(arrayBuffer_2, byteOffset, byteLength)); },\r\n byteLength: arrayBuffer_2.byteLength\r\n }));\r\n }\r\n this._validate(scene, data);\r\n return Promise.resolve({ json: this._parseJson(data) });\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype.createPlugin = function () {\r\n return new GLTFFileLoader();\r\n };\r\n Object.defineProperty(GLTFFileLoader.prototype, \"loaderState\", {\r\n /**\r\n * The loader state or null if the loader is not active.\r\n */\r\n get: function () {\r\n return this._loader ? this._loader.state : null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a promise that resolves when the asset is completely loaded.\r\n * @returns a promise that resolves when the asset is completely loaded.\r\n */\r\n GLTFFileLoader.prototype.whenCompleteAsync = function () {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this.onCompleteObservable.addOnce(function () {\r\n resolve();\r\n });\r\n _this.onErrorObservable.addOnce(function (reason) {\r\n reject(reason);\r\n });\r\n });\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype._loadFile = function (url, scene, onSuccess, useArrayBuffer, onError) {\r\n var _this = this;\r\n var request = scene._loadFile(url, onSuccess, function (event) {\r\n _this._onProgress(event, request);\r\n }, undefined, useArrayBuffer, onError);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._requests.splice(_this._requests.indexOf(request), 1);\r\n });\r\n this._requests.push(request);\r\n return request;\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype._requestFile = function (url, scene, onSuccess, useArrayBuffer, onError, onOpened) {\r\n var _this = this;\r\n var request = scene._requestFile(url, onSuccess, function (event) {\r\n _this._onProgress(event, request);\r\n }, undefined, useArrayBuffer, onError, onOpened);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._requests.splice(_this._requests.indexOf(request), 1);\r\n });\r\n this._requests.push(request);\r\n return request;\r\n };\r\n GLTFFileLoader.prototype._onProgress = function (event, request) {\r\n if (!this._progressCallback) {\r\n return;\r\n }\r\n request._lengthComputable = event.lengthComputable;\r\n request._loaded = event.loaded;\r\n request._total = event.total;\r\n var lengthComputable = true;\r\n var loaded = 0;\r\n var total = 0;\r\n for (var _i = 0, _a = this._requests; _i < _a.length; _i++) {\r\n var request_1 = _a[_i];\r\n if (request_1._lengthComputable === undefined || request_1._loaded === undefined || request_1._total === undefined) {\r\n return;\r\n }\r\n lengthComputable = lengthComputable && request_1._lengthComputable;\r\n loaded += request_1._loaded;\r\n total += request_1._total;\r\n }\r\n this._progressCallback({\r\n lengthComputable: lengthComputable,\r\n loaded: loaded,\r\n total: lengthComputable ? total : 0\r\n });\r\n };\r\n GLTFFileLoader.prototype._validate = function (scene, data, rootUrl, fileName) {\r\n var _this = this;\r\n if (rootUrl === void 0) { rootUrl = \"\"; }\r\n if (fileName === void 0) { fileName = \"\"; }\r\n if (!this.validate) {\r\n return;\r\n }\r\n this._startPerformanceCounter(\"Validate JSON\");\r\n GLTFValidation.ValidateAsync(data, rootUrl, fileName, function (uri) {\r\n return _this.preprocessUrlAsync(rootUrl + uri).then(function (url) { return scene._loadFileAsync(url, undefined, true, true); });\r\n }).then(function (result) {\r\n _this._endPerformanceCounter(\"Validate JSON\");\r\n _this.onValidatedObservable.notifyObservers(result);\r\n _this.onValidatedObservable.clear();\r\n }, function (reason) {\r\n _this._endPerformanceCounter(\"Validate JSON\");\r\n Tools.Warn(\"Failed to validate: \" + reason.message);\r\n _this.onValidatedObservable.clear();\r\n });\r\n };\r\n GLTFFileLoader.prototype._getLoader = function (loaderData) {\r\n var asset = loaderData.json.asset || {};\r\n this._log(\"Asset version: \" + asset.version);\r\n asset.minVersion && this._log(\"Asset minimum version: \" + asset.minVersion);\r\n asset.generator && this._log(\"Asset generator: \" + asset.generator);\r\n var version = GLTFFileLoader._parseVersion(asset.version);\r\n if (!version) {\r\n throw new Error(\"Invalid version: \" + asset.version);\r\n }\r\n if (asset.minVersion !== undefined) {\r\n var minVersion = GLTFFileLoader._parseVersion(asset.minVersion);\r\n if (!minVersion) {\r\n throw new Error(\"Invalid minimum version: \" + asset.minVersion);\r\n }\r\n if (GLTFFileLoader._compareVersion(minVersion, { major: 2, minor: 0 }) > 0) {\r\n throw new Error(\"Incompatible minimum version: \" + asset.minVersion);\r\n }\r\n }\r\n var createLoaders = {\r\n 1: GLTFFileLoader._CreateGLTF1Loader,\r\n 2: GLTFFileLoader._CreateGLTF2Loader\r\n };\r\n var createLoader = createLoaders[version.major];\r\n if (!createLoader) {\r\n throw new Error(\"Unsupported version: \" + asset.version);\r\n }\r\n return createLoader(this);\r\n };\r\n GLTFFileLoader.prototype._parseJson = function (json) {\r\n this._startPerformanceCounter(\"Parse JSON\");\r\n this._log(\"JSON length: \" + json.length);\r\n var parsed = JSON.parse(json);\r\n this._endPerformanceCounter(\"Parse JSON\");\r\n return parsed;\r\n };\r\n GLTFFileLoader.prototype._unpackBinaryAsync = function (dataReader) {\r\n var _this = this;\r\n this._startPerformanceCounter(\"Unpack Binary\");\r\n // Read magic + version + length + json length + json format\r\n return dataReader.loadAsync(20).then(function () {\r\n var Binary = {\r\n Magic: 0x46546C67\r\n };\r\n var magic = dataReader.readUint32();\r\n if (magic !== Binary.Magic) {\r\n throw new Error(\"Unexpected magic: \" + magic);\r\n }\r\n var version = dataReader.readUint32();\r\n if (_this.loggingEnabled) {\r\n _this._log(\"Binary version: \" + version);\r\n }\r\n var length = dataReader.readUint32();\r\n if (dataReader.buffer.byteLength !== 0 && length !== dataReader.buffer.byteLength) {\r\n throw new Error(\"Length in header does not match actual data length: \" + length + \" != \" + dataReader.buffer.byteLength);\r\n }\r\n var unpacked;\r\n switch (version) {\r\n case 1: {\r\n unpacked = _this._unpackBinaryV1Async(dataReader, length);\r\n break;\r\n }\r\n case 2: {\r\n unpacked = _this._unpackBinaryV2Async(dataReader, length);\r\n break;\r\n }\r\n default: {\r\n throw new Error(\"Unsupported version: \" + version);\r\n }\r\n }\r\n _this._endPerformanceCounter(\"Unpack Binary\");\r\n return unpacked;\r\n });\r\n };\r\n GLTFFileLoader.prototype._unpackBinaryV1Async = function (dataReader, length) {\r\n var ContentFormat = {\r\n JSON: 0\r\n };\r\n var contentLength = dataReader.readUint32();\r\n var contentFormat = dataReader.readUint32();\r\n if (contentFormat !== ContentFormat.JSON) {\r\n throw new Error(\"Unexpected content format: \" + contentFormat);\r\n }\r\n var bodyLength = length - dataReader.byteOffset;\r\n var data = { json: this._parseJson(dataReader.readString(contentLength)), bin: null };\r\n if (bodyLength !== 0) {\r\n var startByteOffset_1 = dataReader.byteOffset;\r\n data.bin = {\r\n readAsync: function (byteOffset, byteLength) { return dataReader.buffer.readAsync(startByteOffset_1 + byteOffset, byteLength); },\r\n byteLength: bodyLength\r\n };\r\n }\r\n return Promise.resolve(data);\r\n };\r\n GLTFFileLoader.prototype._unpackBinaryV2Async = function (dataReader, length) {\r\n var _this = this;\r\n var ChunkFormat = {\r\n JSON: 0x4E4F534A,\r\n BIN: 0x004E4942\r\n };\r\n // Read the JSON chunk header.\r\n var chunkLength = dataReader.readUint32();\r\n var chunkFormat = dataReader.readUint32();\r\n if (chunkFormat !== ChunkFormat.JSON) {\r\n throw new Error(\"First chunk format is not JSON\");\r\n }\r\n // Bail if there are no other chunks.\r\n if (dataReader.byteOffset + chunkLength === length) {\r\n return dataReader.loadAsync(chunkLength).then(function () {\r\n return { json: _this._parseJson(dataReader.readString(chunkLength)), bin: null };\r\n });\r\n }\r\n // Read the JSON chunk and the length and type of the next chunk.\r\n return dataReader.loadAsync(chunkLength + 8).then(function () {\r\n var data = { json: _this._parseJson(dataReader.readString(chunkLength)), bin: null };\r\n var readAsync = function () {\r\n var chunkLength = dataReader.readUint32();\r\n var chunkFormat = dataReader.readUint32();\r\n switch (chunkFormat) {\r\n case ChunkFormat.JSON: {\r\n throw new Error(\"Unexpected JSON chunk\");\r\n }\r\n case ChunkFormat.BIN: {\r\n var startByteOffset_2 = dataReader.byteOffset;\r\n data.bin = {\r\n readAsync: function (byteOffset, byteLength) { return dataReader.buffer.readAsync(startByteOffset_2 + byteOffset, byteLength); },\r\n byteLength: chunkLength\r\n };\r\n dataReader.skipBytes(chunkLength);\r\n break;\r\n }\r\n default: {\r\n // ignore unrecognized chunkFormat\r\n dataReader.skipBytes(chunkLength);\r\n break;\r\n }\r\n }\r\n if (dataReader.byteOffset !== length) {\r\n return dataReader.loadAsync(8).then(readAsync);\r\n }\r\n return Promise.resolve(data);\r\n };\r\n return readAsync();\r\n });\r\n };\r\n GLTFFileLoader._parseVersion = function (version) {\r\n if (version === \"1.0\" || version === \"1.0.1\") {\r\n return {\r\n major: 1,\r\n minor: 0\r\n };\r\n }\r\n var match = (version + \"\").match(/^(\\d+)\\.(\\d+)/);\r\n if (!match) {\r\n return null;\r\n }\r\n return {\r\n major: parseInt(match[1]),\r\n minor: parseInt(match[2])\r\n };\r\n };\r\n GLTFFileLoader._compareVersion = function (a, b) {\r\n if (a.major > b.major) {\r\n return 1;\r\n }\r\n if (a.major < b.major) {\r\n return -1;\r\n }\r\n if (a.minor > b.minor) {\r\n return 1;\r\n }\r\n if (a.minor < b.minor) {\r\n return -1;\r\n }\r\n return 0;\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype._logOpen = function (message) {\r\n this._log(message);\r\n this._logIndentLevel++;\r\n };\r\n /** @hidden */\r\n GLTFFileLoader.prototype._logClose = function () {\r\n --this._logIndentLevel;\r\n };\r\n GLTFFileLoader.prototype._logEnabled = function (message) {\r\n var spaces = GLTFFileLoader._logSpaces.substr(0, this._logIndentLevel * 2);\r\n Logger.Log(\"\" + spaces + message);\r\n };\r\n GLTFFileLoader.prototype._logDisabled = function (message) {\r\n };\r\n GLTFFileLoader.prototype._startPerformanceCounterEnabled = function (counterName) {\r\n Tools.StartPerformanceCounter(counterName);\r\n };\r\n GLTFFileLoader.prototype._startPerformanceCounterDisabled = function (counterName) {\r\n };\r\n GLTFFileLoader.prototype._endPerformanceCounterEnabled = function (counterName) {\r\n Tools.EndPerformanceCounter(counterName);\r\n };\r\n GLTFFileLoader.prototype._endPerformanceCounterDisabled = function (counterName) {\r\n };\r\n // ----------\r\n // V1 options\r\n // ----------\r\n /**\r\n * Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders.\r\n * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.\r\n * Defaults to true.\r\n * @hidden\r\n */\r\n GLTFFileLoader.IncrementalLoading = true;\r\n /**\r\n * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.\r\n * Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.\r\n * @hidden\r\n */\r\n GLTFFileLoader.HomogeneousCoordinates = false;\r\n GLTFFileLoader.magicBase64Encoded = \"Z2xURg\"; // \"glTF\" base64 encoded (without the quotes!)\r\n GLTFFileLoader._logSpaces = \" \";\r\n return GLTFFileLoader;\r\n}());\r\nexport { GLTFFileLoader };\r\nif (SceneLoader) {\r\n SceneLoader.RegisterPlugin(new GLTFFileLoader());\r\n}\r\n//# sourceMappingURL=glTFFileLoader.js.map","/**\r\n* Enums\r\n* @hidden\r\n*/\r\nexport var EComponentType;\r\n(function (EComponentType) {\r\n EComponentType[EComponentType[\"BYTE\"] = 5120] = \"BYTE\";\r\n EComponentType[EComponentType[\"UNSIGNED_BYTE\"] = 5121] = \"UNSIGNED_BYTE\";\r\n EComponentType[EComponentType[\"SHORT\"] = 5122] = \"SHORT\";\r\n EComponentType[EComponentType[\"UNSIGNED_SHORT\"] = 5123] = \"UNSIGNED_SHORT\";\r\n EComponentType[EComponentType[\"FLOAT\"] = 5126] = \"FLOAT\";\r\n})(EComponentType || (EComponentType = {}));\r\n/** @hidden */\r\nexport var EShaderType;\r\n(function (EShaderType) {\r\n EShaderType[EShaderType[\"FRAGMENT\"] = 35632] = \"FRAGMENT\";\r\n EShaderType[EShaderType[\"VERTEX\"] = 35633] = \"VERTEX\";\r\n})(EShaderType || (EShaderType = {}));\r\n/** @hidden */\r\nexport var EParameterType;\r\n(function (EParameterType) {\r\n EParameterType[EParameterType[\"BYTE\"] = 5120] = \"BYTE\";\r\n EParameterType[EParameterType[\"UNSIGNED_BYTE\"] = 5121] = \"UNSIGNED_BYTE\";\r\n EParameterType[EParameterType[\"SHORT\"] = 5122] = \"SHORT\";\r\n EParameterType[EParameterType[\"UNSIGNED_SHORT\"] = 5123] = \"UNSIGNED_SHORT\";\r\n EParameterType[EParameterType[\"INT\"] = 5124] = \"INT\";\r\n EParameterType[EParameterType[\"UNSIGNED_INT\"] = 5125] = \"UNSIGNED_INT\";\r\n EParameterType[EParameterType[\"FLOAT\"] = 5126] = \"FLOAT\";\r\n EParameterType[EParameterType[\"FLOAT_VEC2\"] = 35664] = \"FLOAT_VEC2\";\r\n EParameterType[EParameterType[\"FLOAT_VEC3\"] = 35665] = \"FLOAT_VEC3\";\r\n EParameterType[EParameterType[\"FLOAT_VEC4\"] = 35666] = \"FLOAT_VEC4\";\r\n EParameterType[EParameterType[\"INT_VEC2\"] = 35667] = \"INT_VEC2\";\r\n EParameterType[EParameterType[\"INT_VEC3\"] = 35668] = \"INT_VEC3\";\r\n EParameterType[EParameterType[\"INT_VEC4\"] = 35669] = \"INT_VEC4\";\r\n EParameterType[EParameterType[\"BOOL\"] = 35670] = \"BOOL\";\r\n EParameterType[EParameterType[\"BOOL_VEC2\"] = 35671] = \"BOOL_VEC2\";\r\n EParameterType[EParameterType[\"BOOL_VEC3\"] = 35672] = \"BOOL_VEC3\";\r\n EParameterType[EParameterType[\"BOOL_VEC4\"] = 35673] = \"BOOL_VEC4\";\r\n EParameterType[EParameterType[\"FLOAT_MAT2\"] = 35674] = \"FLOAT_MAT2\";\r\n EParameterType[EParameterType[\"FLOAT_MAT3\"] = 35675] = \"FLOAT_MAT3\";\r\n EParameterType[EParameterType[\"FLOAT_MAT4\"] = 35676] = \"FLOAT_MAT4\";\r\n EParameterType[EParameterType[\"SAMPLER_2D\"] = 35678] = \"SAMPLER_2D\";\r\n})(EParameterType || (EParameterType = {}));\r\n/** @hidden */\r\nexport var ETextureWrapMode;\r\n(function (ETextureWrapMode) {\r\n ETextureWrapMode[ETextureWrapMode[\"CLAMP_TO_EDGE\"] = 33071] = \"CLAMP_TO_EDGE\";\r\n ETextureWrapMode[ETextureWrapMode[\"MIRRORED_REPEAT\"] = 33648] = \"MIRRORED_REPEAT\";\r\n ETextureWrapMode[ETextureWrapMode[\"REPEAT\"] = 10497] = \"REPEAT\";\r\n})(ETextureWrapMode || (ETextureWrapMode = {}));\r\n/** @hidden */\r\nexport var ETextureFilterType;\r\n(function (ETextureFilterType) {\r\n ETextureFilterType[ETextureFilterType[\"NEAREST\"] = 9728] = \"NEAREST\";\r\n ETextureFilterType[ETextureFilterType[\"LINEAR\"] = 9728] = \"LINEAR\";\r\n ETextureFilterType[ETextureFilterType[\"NEAREST_MIPMAP_NEAREST\"] = 9984] = \"NEAREST_MIPMAP_NEAREST\";\r\n ETextureFilterType[ETextureFilterType[\"LINEAR_MIPMAP_NEAREST\"] = 9985] = \"LINEAR_MIPMAP_NEAREST\";\r\n ETextureFilterType[ETextureFilterType[\"NEAREST_MIPMAP_LINEAR\"] = 9986] = \"NEAREST_MIPMAP_LINEAR\";\r\n ETextureFilterType[ETextureFilterType[\"LINEAR_MIPMAP_LINEAR\"] = 9987] = \"LINEAR_MIPMAP_LINEAR\";\r\n})(ETextureFilterType || (ETextureFilterType = {}));\r\n/** @hidden */\r\nexport var ETextureFormat;\r\n(function (ETextureFormat) {\r\n ETextureFormat[ETextureFormat[\"ALPHA\"] = 6406] = \"ALPHA\";\r\n ETextureFormat[ETextureFormat[\"RGB\"] = 6407] = \"RGB\";\r\n ETextureFormat[ETextureFormat[\"RGBA\"] = 6408] = \"RGBA\";\r\n ETextureFormat[ETextureFormat[\"LUMINANCE\"] = 6409] = \"LUMINANCE\";\r\n ETextureFormat[ETextureFormat[\"LUMINANCE_ALPHA\"] = 6410] = \"LUMINANCE_ALPHA\";\r\n})(ETextureFormat || (ETextureFormat = {}));\r\n/** @hidden */\r\nexport var ECullingType;\r\n(function (ECullingType) {\r\n ECullingType[ECullingType[\"FRONT\"] = 1028] = \"FRONT\";\r\n ECullingType[ECullingType[\"BACK\"] = 1029] = \"BACK\";\r\n ECullingType[ECullingType[\"FRONT_AND_BACK\"] = 1032] = \"FRONT_AND_BACK\";\r\n})(ECullingType || (ECullingType = {}));\r\n/** @hidden */\r\nexport var EBlendingFunction;\r\n(function (EBlendingFunction) {\r\n EBlendingFunction[EBlendingFunction[\"ZERO\"] = 0] = \"ZERO\";\r\n EBlendingFunction[EBlendingFunction[\"ONE\"] = 1] = \"ONE\";\r\n EBlendingFunction[EBlendingFunction[\"SRC_COLOR\"] = 768] = \"SRC_COLOR\";\r\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_SRC_COLOR\"] = 769] = \"ONE_MINUS_SRC_COLOR\";\r\n EBlendingFunction[EBlendingFunction[\"DST_COLOR\"] = 774] = \"DST_COLOR\";\r\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_DST_COLOR\"] = 775] = \"ONE_MINUS_DST_COLOR\";\r\n EBlendingFunction[EBlendingFunction[\"SRC_ALPHA\"] = 770] = \"SRC_ALPHA\";\r\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_SRC_ALPHA\"] = 771] = \"ONE_MINUS_SRC_ALPHA\";\r\n EBlendingFunction[EBlendingFunction[\"DST_ALPHA\"] = 772] = \"DST_ALPHA\";\r\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_DST_ALPHA\"] = 773] = \"ONE_MINUS_DST_ALPHA\";\r\n EBlendingFunction[EBlendingFunction[\"CONSTANT_COLOR\"] = 32769] = \"CONSTANT_COLOR\";\r\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_CONSTANT_COLOR\"] = 32770] = \"ONE_MINUS_CONSTANT_COLOR\";\r\n EBlendingFunction[EBlendingFunction[\"CONSTANT_ALPHA\"] = 32771] = \"CONSTANT_ALPHA\";\r\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_CONSTANT_ALPHA\"] = 32772] = \"ONE_MINUS_CONSTANT_ALPHA\";\r\n EBlendingFunction[EBlendingFunction[\"SRC_ALPHA_SATURATE\"] = 776] = \"SRC_ALPHA_SATURATE\";\r\n})(EBlendingFunction || (EBlendingFunction = {}));\r\n//# sourceMappingURL=glTFLoaderInterfaces.js.map","import { __decorate } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport { KeyboardEventTypes } from \"../../Events/keyboardEvents\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Tools } from \"../../Misc/tools\";\r\n/**\r\n * Manage the keyboard inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraKeyboardMoveInput = /** @class */ (function () {\r\n function FreeCameraKeyboardMoveInput() {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the forward move of the camera.\r\n */\r\n this.keysUp = [38];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the upward move of the camera.\r\n */\r\n this.keysUpward = [33];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the backward move of the camera.\r\n */\r\n this.keysDown = [40];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the downward move of the camera.\r\n */\r\n this.keysDownward = [34];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the left strafe move of the camera.\r\n */\r\n this.keysLeft = [37];\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the right strafe move of the camera.\r\n */\r\n this.keysRight = [39];\r\n this._keys = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.attachControl = function (noPreventDefault) {\r\n var _this = this;\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n if (this._onCanvasBlurObserver) {\r\n return;\r\n }\r\n this._scene = this.camera.getScene();\r\n this._engine = this._scene.getEngine();\r\n this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(function () {\r\n _this._keys = [];\r\n });\r\n this._onKeyboardObserver = this._scene.onKeyboardObservable.add(function (info) {\r\n var evt = info.event;\r\n if (!evt.metaKey) {\r\n if (info.type === KeyboardEventTypes.KEYDOWN) {\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1 || _this.keysUpward.indexOf(evt.keyCode) !== -1 || _this.keysDownward.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index === -1) {\r\n _this._keys.push(evt.keyCode);\r\n }\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n else {\r\n if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1 || _this.keysUpward.indexOf(evt.keyCode) !== -1 || _this.keysDownward.indexOf(evt.keyCode) !== -1) {\r\n var index = _this._keys.indexOf(evt.keyCode);\r\n if (index >= 0) {\r\n _this._keys.splice(index, 1);\r\n }\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.detachControl = function (ignored) {\r\n if (this._scene) {\r\n if (this._onKeyboardObserver) {\r\n this._scene.onKeyboardObservable.remove(this._onKeyboardObserver);\r\n }\r\n if (this._onCanvasBlurObserver) {\r\n this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\r\n }\r\n this._onKeyboardObserver = null;\r\n this._onCanvasBlurObserver = null;\r\n }\r\n this._keys = [];\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.checkInputs = function () {\r\n if (this._onKeyboardObserver) {\r\n var camera = this.camera;\r\n // Keyboard\r\n for (var index = 0; index < this._keys.length; index++) {\r\n var keyCode = this._keys[index];\r\n var speed = camera._computeLocalCameraSpeed();\r\n if (this.keysLeft.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(-speed, 0, 0);\r\n }\r\n else if (this.keysUp.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, 0, speed);\r\n }\r\n else if (this.keysRight.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(speed, 0, 0);\r\n }\r\n else if (this.keysDown.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, 0, -speed);\r\n }\r\n else if (this.keysUpward.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, speed, 0);\r\n }\r\n else if (this.keysDownward.indexOf(keyCode) !== -1) {\r\n camera._localDirection.copyFromFloats(0, -speed, 0);\r\n }\r\n if (camera.getScene().useRightHandedSystem) {\r\n camera._localDirection.z *= -1;\r\n }\r\n camera.getViewMatrix().invertToRef(camera._cameraTransformMatrix);\r\n Vector3.TransformNormalToRef(camera._localDirection, camera._cameraTransformMatrix, camera._transformedDirection);\r\n camera.cameraDirection.addInPlace(camera._transformedDirection);\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.getClassName = function () {\r\n return \"FreeCameraKeyboardMoveInput\";\r\n };\r\n /** @hidden */\r\n FreeCameraKeyboardMoveInput.prototype._onLostFocus = function () {\r\n this._keys = [];\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraKeyboardMoveInput.prototype.getSimpleName = function () {\r\n return \"keyboard\";\r\n };\r\n __decorate([\r\n serialize()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysUp\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysUpward\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysDown\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysDownward\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysLeft\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraKeyboardMoveInput.prototype, \"keysRight\", void 0);\r\n return FreeCameraKeyboardMoveInput;\r\n}());\r\nexport { FreeCameraKeyboardMoveInput };\r\nCameraInputTypes[\"FreeCameraKeyboardMoveInput\"] = FreeCameraKeyboardMoveInput;\r\n//# sourceMappingURL=freeCameraKeyboardMoveInput.js.map","import { __decorate } from \"tslib\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Tools } from \"../../Misc/tools\";\r\n/**\r\n * Manage the mouse inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraMouseInput = /** @class */ (function () {\r\n /**\r\n * Manage the mouse inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n * @param touchEnabled Defines if touch is enabled or not\r\n */\r\n function FreeCameraMouseInput(\r\n /**\r\n * Define if touch is enabled in the mouse input\r\n */\r\n touchEnabled) {\r\n if (touchEnabled === void 0) { touchEnabled = true; }\r\n this.touchEnabled = touchEnabled;\r\n /**\r\n * Defines the buttons associated with the input to handle camera move.\r\n */\r\n this.buttons = [0, 1, 2];\r\n /**\r\n * Defines the pointer angular sensibility along the X and Y axis or how fast is the camera rotating.\r\n */\r\n this.angularSensibility = 2000.0;\r\n this.previousPosition = null;\r\n /**\r\n * Observable for when a pointer move event occurs containing the move offset\r\n */\r\n this.onPointerMovedObservable = new Observable();\r\n /**\r\n * @hidden\r\n * If the camera should be rotated automatically based on pointer movement\r\n */\r\n this._allowCameraRotation = true;\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraMouseInput.prototype.attachControl = function (noPreventDefault) {\r\n var _this = this;\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n var engine = this.camera.getEngine();\r\n var element = engine.getInputElement();\r\n if (!this._pointerInput) {\r\n this._pointerInput = function (p) {\r\n var evt = p.event;\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n if (!_this.touchEnabled && evt.pointerType === \"touch\") {\r\n return;\r\n }\r\n if (p.type !== PointerEventTypes.POINTERMOVE && _this.buttons.indexOf(evt.button) === -1) {\r\n return;\r\n }\r\n var srcElement = (evt.srcElement || evt.target);\r\n if (p.type === PointerEventTypes.POINTERDOWN && srcElement) {\r\n try {\r\n srcElement.setPointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error. Execution will continue.\r\n }\r\n _this.previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY,\r\n };\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n element && element.focus();\r\n }\r\n // This is required to move while pointer button is down\r\n if (engine.isPointerLock && _this._onMouseMove) {\r\n _this._onMouseMove(p.event);\r\n }\r\n }\r\n else if (p.type === PointerEventTypes.POINTERUP && srcElement) {\r\n try {\r\n srcElement.releasePointerCapture(evt.pointerId);\r\n }\r\n catch (e) {\r\n //Nothing to do with the error.\r\n }\r\n _this.previousPosition = null;\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n else if (p.type === PointerEventTypes.POINTERMOVE) {\r\n if (!_this.previousPosition) {\r\n if (engine.isPointerLock && _this._onMouseMove) {\r\n _this._onMouseMove(p.event);\r\n }\r\n return;\r\n }\r\n var offsetX = evt.clientX - _this.previousPosition.x;\r\n var offsetY = evt.clientY - _this.previousPosition.y;\r\n if (_this.camera.getScene().useRightHandedSystem) {\r\n offsetX *= -1;\r\n }\r\n if (_this.camera.parent && _this.camera.parent._getWorldMatrixDeterminant() < 0) {\r\n offsetX *= -1;\r\n }\r\n if (_this._allowCameraRotation) {\r\n _this.camera.cameraRotation.y += offsetX / _this.angularSensibility;\r\n _this.camera.cameraRotation.x += offsetY / _this.angularSensibility;\r\n }\r\n _this.onPointerMovedObservable.notifyObservers({ offsetX: offsetX, offsetY: offsetY });\r\n _this.previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY,\r\n };\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n };\r\n }\r\n this._onMouseMove = function (evt) {\r\n if (!engine.isPointerLock) {\r\n return;\r\n }\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n var offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;\r\n if (_this.camera.getScene().useRightHandedSystem) {\r\n offsetX *= -1;\r\n }\r\n if (_this.camera.parent && _this.camera.parent._getWorldMatrixDeterminant() < 0) {\r\n offsetX *= -1;\r\n }\r\n _this.camera.cameraRotation.y += offsetX / _this.angularSensibility;\r\n var offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;\r\n _this.camera.cameraRotation.x += offsetY / _this.angularSensibility;\r\n _this.previousPosition = null;\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE);\r\n element && element.addEventListener(\"contextmenu\", this.onContextMenu.bind(this), false);\r\n };\r\n /**\r\n * Called on JS contextmenu event.\r\n * Override this method to provide functionality.\r\n */\r\n FreeCameraMouseInput.prototype.onContextMenu = function (evt) {\r\n evt.preventDefault();\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n FreeCameraMouseInput.prototype.detachControl = function (ignored) {\r\n if (this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n if (this.onContextMenu) {\r\n var engine = this.camera.getEngine();\r\n var element = engine.getInputElement();\r\n element && element.removeEventListener(\"contextmenu\", this.onContextMenu);\r\n }\r\n if (this.onPointerMovedObservable) {\r\n this.onPointerMovedObservable.clear();\r\n }\r\n this._observer = null;\r\n this._onMouseMove = null;\r\n this.previousPosition = null;\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraMouseInput.prototype.getClassName = function () {\r\n return \"FreeCameraMouseInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraMouseInput.prototype.getSimpleName = function () {\r\n return \"mouse\";\r\n };\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseInput.prototype, \"buttons\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseInput.prototype, \"angularSensibility\", void 0);\r\n return FreeCameraMouseInput;\r\n}());\r\nexport { FreeCameraMouseInput };\r\nCameraInputTypes[\"FreeCameraMouseInput\"] = FreeCameraMouseInput;\r\n//# sourceMappingURL=freeCameraMouseInput.js.map","import { __decorate } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Tools } from \"../../Misc/tools\";\r\n/**\r\n * Base class for mouse wheel input..\r\n * See FollowCameraMouseWheelInput in src/Cameras/Inputs/freeCameraMouseWheelInput.ts\r\n * for example usage.\r\n */\r\nvar BaseCameraMouseWheelInput = /** @class */ (function () {\r\n function BaseCameraMouseWheelInput() {\r\n /**\r\n * How fast is the camera moves in relation to X axis mouseWheel events.\r\n * Use negative value to reverse direction.\r\n */\r\n this.wheelPrecisionX = 3.0;\r\n /**\r\n * How fast is the camera moves in relation to Y axis mouseWheel events.\r\n * Use negative value to reverse direction.\r\n */\r\n this.wheelPrecisionY = 3.0;\r\n /**\r\n * How fast is the camera moves in relation to Z axis mouseWheel events.\r\n * Use negative value to reverse direction.\r\n */\r\n this.wheelPrecisionZ = 3.0;\r\n /**\r\n * Observable for when a mouse wheel move event occurs.\r\n */\r\n this.onChangedObservable = new Observable();\r\n /**\r\n * Incremental value of multiple mouse wheel movements of the X axis.\r\n * Should be zero-ed when read.\r\n */\r\n this._wheelDeltaX = 0;\r\n /**\r\n * Incremental value of multiple mouse wheel movements of the Y axis.\r\n * Should be zero-ed when read.\r\n */\r\n this._wheelDeltaY = 0;\r\n /**\r\n * Incremental value of multiple mouse wheel movements of the Z axis.\r\n * Should be zero-ed when read.\r\n */\r\n this._wheelDeltaZ = 0;\r\n /**\r\n * Firefox uses a different scheme to report scroll distances to other\r\n * browsers. Rather than use complicated methods to calculate the exact\r\n * multiple we need to apply, let's just cheat and use a constant.\r\n * https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaMode\r\n * https://stackoverflow.com/questions/20110224/what-is-the-height-of-a-line-in-a-wheel-event-deltamode-dom-delta-line\r\n */\r\n this._ffMultiplier = 12;\r\n /**\r\n * Different event attributes for wheel data fall into a few set ranges.\r\n * Some relevant but dated date here:\r\n * https://stackoverflow.com/questions/5527601/normalizing-mousewheel-speed-across-browsers\r\n */\r\n this._normalize = 120;\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls\r\n * should call preventdefault().\r\n * (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n BaseCameraMouseWheelInput.prototype.attachControl = function (noPreventDefault) {\r\n var _this = this;\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n this._wheel = function (pointer) {\r\n // sanity check - this should be a PointerWheel event.\r\n if (pointer.type !== PointerEventTypes.POINTERWHEEL) {\r\n return;\r\n }\r\n var event = pointer.event;\r\n var platformScale = event.deltaMode === WheelEvent.DOM_DELTA_LINE ? _this._ffMultiplier : 1;\r\n if (event.deltaY !== undefined) {\r\n // Most recent browsers versions have delta properties.\r\n // Firefox >= v17 (Has WebGL >= v4)\r\n // Chrome >= v31 (Has WebGL >= v8)\r\n // Edge >= v12 (Has WebGl >= v12)\r\n // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\r\n _this._wheelDeltaX += (_this.wheelPrecisionX * platformScale * event.deltaX) / _this._normalize;\r\n _this._wheelDeltaY -= (_this.wheelPrecisionY * platformScale * event.deltaY) / _this._normalize;\r\n _this._wheelDeltaZ += (_this.wheelPrecisionZ * platformScale * event.deltaZ) / _this._normalize;\r\n }\r\n else if (event.wheelDeltaY !== undefined) {\r\n // Unsure whether these catch anything more. Documentation\r\n // online is contradictory.\r\n _this._wheelDeltaX += (_this.wheelPrecisionX * platformScale * event.wheelDeltaX) / _this._normalize;\r\n _this._wheelDeltaY -= (_this.wheelPrecisionY * platformScale * event.wheelDeltaY) / _this._normalize;\r\n _this._wheelDeltaZ += (_this.wheelPrecisionZ * platformScale * event.wheelDeltaZ) / _this._normalize;\r\n }\r\n else if (event.wheelDelta) {\r\n // IE >= v9 (Has WebGL >= v11)\r\n // Maybe others?\r\n _this._wheelDeltaY -= (_this.wheelPrecisionY * event.wheelDelta) / _this._normalize;\r\n }\r\n if (event.preventDefault) {\r\n if (!noPreventDefault) {\r\n event.preventDefault();\r\n }\r\n }\r\n };\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, PointerEventTypes.POINTERWHEEL);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n BaseCameraMouseWheelInput.prototype.detachControl = function (ignored) {\r\n if (this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n this._wheel = null;\r\n }\r\n if (this.onChangedObservable) {\r\n this.onChangedObservable.clear();\r\n }\r\n };\r\n /**\r\n * Called for each rendered frame.\r\n */\r\n BaseCameraMouseWheelInput.prototype.checkInputs = function () {\r\n this.onChangedObservable.notifyObservers({\r\n wheelDeltaX: this._wheelDeltaX,\r\n wheelDeltaY: this._wheelDeltaY,\r\n wheelDeltaZ: this._wheelDeltaZ,\r\n });\r\n // Clear deltas.\r\n this._wheelDeltaX = 0;\r\n this._wheelDeltaY = 0;\r\n this._wheelDeltaZ = 0;\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n BaseCameraMouseWheelInput.prototype.getClassName = function () {\r\n return \"BaseCameraMouseWheelInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n BaseCameraMouseWheelInput.prototype.getSimpleName = function () {\r\n return \"mousewheel\";\r\n };\r\n __decorate([\r\n serialize()\r\n ], BaseCameraMouseWheelInput.prototype, \"wheelPrecisionX\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseCameraMouseWheelInput.prototype, \"wheelPrecisionY\", void 0);\r\n __decorate([\r\n serialize()\r\n ], BaseCameraMouseWheelInput.prototype, \"wheelPrecisionZ\", void 0);\r\n return BaseCameraMouseWheelInput;\r\n}());\r\nexport { BaseCameraMouseWheelInput };\r\n//# sourceMappingURL=BaseCameraMouseWheelInput.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport { BaseCameraMouseWheelInput } from \"../../Cameras/Inputs/BaseCameraMouseWheelInput\";\r\nimport { Matrix, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Coordinate } from \"../../Maths/math.axis\";\r\nvar _CameraProperty;\r\n(function (_CameraProperty) {\r\n _CameraProperty[_CameraProperty[\"MoveRelative\"] = 0] = \"MoveRelative\";\r\n _CameraProperty[_CameraProperty[\"RotateRelative\"] = 1] = \"RotateRelative\";\r\n _CameraProperty[_CameraProperty[\"MoveScene\"] = 2] = \"MoveScene\";\r\n})(_CameraProperty || (_CameraProperty = {}));\r\n/**\r\n * Manage the mouse wheel inputs to control a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraMouseWheelInput = /** @class */ (function (_super) {\r\n __extends(FreeCameraMouseWheelInput, _super);\r\n function FreeCameraMouseWheelInput() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._moveRelative = Vector3.Zero();\r\n _this._rotateRelative = Vector3.Zero();\r\n _this._moveScene = Vector3.Zero();\r\n /**\r\n * These are set to the desired default behaviour.\r\n */\r\n _this._wheelXAction = _CameraProperty.MoveRelative;\r\n _this._wheelXActionCoordinate = Coordinate.X;\r\n _this._wheelYAction = _CameraProperty.MoveRelative;\r\n _this._wheelYActionCoordinate = Coordinate.Z;\r\n _this._wheelZAction = null;\r\n _this._wheelZActionCoordinate = null;\r\n return _this;\r\n }\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n FreeCameraMouseWheelInput.prototype.getClassName = function () {\r\n return \"FreeCameraMouseWheelInput\";\r\n };\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelXMoveRelative\", {\r\n /**\r\n * Get the configured movement axis (relative to camera's orientation) the\r\n * mouse wheel's X axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelXAction !== _CameraProperty.MoveRelative) {\r\n return null;\r\n }\r\n return this._wheelXActionCoordinate;\r\n },\r\n /**\r\n * Set which movement axis (relative to camera's orientation) the mouse\r\n * wheel's X axis controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelXAction !== _CameraProperty.MoveRelative) {\r\n // Attempting to clear different _wheelXAction.\r\n return;\r\n }\r\n this._wheelXAction = _CameraProperty.MoveRelative;\r\n this._wheelXActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelYMoveRelative\", {\r\n /**\r\n * Get the configured movement axis (relative to camera's orientation) the\r\n * mouse wheel's Y axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelYAction !== _CameraProperty.MoveRelative) {\r\n return null;\r\n }\r\n return this._wheelYActionCoordinate;\r\n },\r\n /**\r\n * Set which movement axis (relative to camera's orientation) the mouse\r\n * wheel's Y axis controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelYAction !== _CameraProperty.MoveRelative) {\r\n // Attempting to clear different _wheelYAction.\r\n return;\r\n }\r\n this._wheelYAction = _CameraProperty.MoveRelative;\r\n this._wheelYActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelZMoveRelative\", {\r\n /**\r\n * Get the configured movement axis (relative to camera's orientation) the\r\n * mouse wheel's Z axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelZAction !== _CameraProperty.MoveRelative) {\r\n return null;\r\n }\r\n return this._wheelZActionCoordinate;\r\n },\r\n /**\r\n * Set which movement axis (relative to camera's orientation) the mouse\r\n * wheel's Z axis controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelZAction !== _CameraProperty.MoveRelative) {\r\n // Attempting to clear different _wheelZAction.\r\n return;\r\n }\r\n this._wheelZAction = _CameraProperty.MoveRelative;\r\n this._wheelZActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelXRotateRelative\", {\r\n /**\r\n * Get the configured rotation axis (relative to camera's orientation) the\r\n * mouse wheel's X axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelXAction !== _CameraProperty.RotateRelative) {\r\n return null;\r\n }\r\n return this._wheelXActionCoordinate;\r\n },\r\n /**\r\n * Set which rotation axis (relative to camera's orientation) the mouse\r\n * wheel's X axis controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelXAction !== _CameraProperty.RotateRelative) {\r\n // Attempting to clear different _wheelXAction.\r\n return;\r\n }\r\n this._wheelXAction = _CameraProperty.RotateRelative;\r\n this._wheelXActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelYRotateRelative\", {\r\n /**\r\n * Get the configured rotation axis (relative to camera's orientation) the\r\n * mouse wheel's Y axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelYAction !== _CameraProperty.RotateRelative) {\r\n return null;\r\n }\r\n return this._wheelYActionCoordinate;\r\n },\r\n /**\r\n * Set which rotation axis (relative to camera's orientation) the mouse\r\n * wheel's Y axis controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelYAction !== _CameraProperty.RotateRelative) {\r\n // Attempting to clear different _wheelYAction.\r\n return;\r\n }\r\n this._wheelYAction = _CameraProperty.RotateRelative;\r\n this._wheelYActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelZRotateRelative\", {\r\n /**\r\n * Get the configured rotation axis (relative to camera's orientation) the\r\n * mouse wheel's Z axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelZAction !== _CameraProperty.RotateRelative) {\r\n return null;\r\n }\r\n return this._wheelZActionCoordinate;\r\n },\r\n /**\r\n * Set which rotation axis (relative to camera's orientation) the mouse\r\n * wheel's Z axis controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelZAction !== _CameraProperty.RotateRelative) {\r\n // Attempting to clear different _wheelZAction.\r\n return;\r\n }\r\n this._wheelZAction = _CameraProperty.RotateRelative;\r\n this._wheelZActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelXMoveScene\", {\r\n /**\r\n * Get the configured movement axis (relative to the scene) the mouse wheel's\r\n * X axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelXAction !== _CameraProperty.MoveScene) {\r\n return null;\r\n }\r\n return this._wheelXActionCoordinate;\r\n },\r\n /**\r\n * Set which movement axis (relative to the scene) the mouse wheel's X axis\r\n * controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelXAction !== _CameraProperty.MoveScene) {\r\n // Attempting to clear different _wheelXAction.\r\n return;\r\n }\r\n this._wheelXAction = _CameraProperty.MoveScene;\r\n this._wheelXActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelYMoveScene\", {\r\n /**\r\n * Get the configured movement axis (relative to the scene) the mouse wheel's\r\n * Y axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelYAction !== _CameraProperty.MoveScene) {\r\n return null;\r\n }\r\n return this._wheelYActionCoordinate;\r\n },\r\n /**\r\n * Set which movement axis (relative to the scene) the mouse wheel's Y axis\r\n * controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelYAction !== _CameraProperty.MoveScene) {\r\n // Attempting to clear different _wheelYAction.\r\n return;\r\n }\r\n this._wheelYAction = _CameraProperty.MoveScene;\r\n this._wheelYActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCameraMouseWheelInput.prototype, \"wheelZMoveScene\", {\r\n /**\r\n * Get the configured movement axis (relative to the scene) the mouse wheel's\r\n * Z axis controls.\r\n * @returns The configured axis or null if none.\r\n */\r\n get: function () {\r\n if (this._wheelZAction !== _CameraProperty.MoveScene) {\r\n return null;\r\n }\r\n return this._wheelZActionCoordinate;\r\n },\r\n /**\r\n * Set which movement axis (relative to the scene) the mouse wheel's Z axis\r\n * controls.\r\n * @param axis The axis to be moved. Set null to clear.\r\n */\r\n set: function (axis) {\r\n if (axis === null && this._wheelZAction !== _CameraProperty.MoveScene) {\r\n // Attempting to clear different _wheelZAction.\r\n return;\r\n }\r\n this._wheelZAction = _CameraProperty.MoveScene;\r\n this._wheelZActionCoordinate = axis;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Called for each rendered frame.\r\n */\r\n FreeCameraMouseWheelInput.prototype.checkInputs = function () {\r\n if (this._wheelDeltaX === 0 &&\r\n this._wheelDeltaY === 0 &&\r\n this._wheelDeltaZ == 0) {\r\n return;\r\n }\r\n // Clear the camera properties that we might be updating.\r\n this._moveRelative.setAll(0);\r\n this._rotateRelative.setAll(0);\r\n this._moveScene.setAll(0);\r\n // Set the camera properties that are to be updated.\r\n this._updateCamera();\r\n if (this.camera.getScene().useRightHandedSystem) {\r\n // TODO: Does this need done for worldUpdate too?\r\n this._moveRelative.z *= -1;\r\n }\r\n // Convert updates relative to camera to world position update.\r\n var cameraTransformMatrix = Matrix.Zero();\r\n this.camera.getViewMatrix().invertToRef(cameraTransformMatrix);\r\n var transformedDirection = Vector3.Zero();\r\n Vector3.TransformNormalToRef(this._moveRelative, cameraTransformMatrix, transformedDirection);\r\n // Apply updates to camera position.\r\n this.camera.cameraRotation.x += this._rotateRelative.x / 200;\r\n this.camera.cameraRotation.y += this._rotateRelative.y / 200;\r\n this.camera.cameraDirection.addInPlace(transformedDirection);\r\n this.camera.cameraDirection.addInPlace(this._moveScene);\r\n // Call the base class implementation to handle observers and do cleanup.\r\n _super.prototype.checkInputs.call(this);\r\n };\r\n /**\r\n * Update the camera according to any configured properties for the 3\r\n * mouse-wheel axis.\r\n */\r\n FreeCameraMouseWheelInput.prototype._updateCamera = function () {\r\n var moveRelative = this._moveRelative;\r\n var rotateRelative = this._rotateRelative;\r\n var moveScene = this._moveScene;\r\n var updateCameraProperty = function (/* Mouse-wheel delta. */ value, \r\n /* Camera property to be changed. */\r\n cameraProperty, \r\n /* Axis of Camera property to be changed. */\r\n coordinate) {\r\n if (value === 0) {\r\n // Mouse wheel has not moved.\r\n return;\r\n }\r\n if (cameraProperty === null || coordinate === null) {\r\n // Mouse wheel axis not configured.\r\n return;\r\n }\r\n var action = null;\r\n switch (cameraProperty) {\r\n case _CameraProperty.MoveRelative:\r\n action = moveRelative;\r\n break;\r\n case _CameraProperty.RotateRelative:\r\n action = rotateRelative;\r\n break;\r\n case _CameraProperty.MoveScene:\r\n action = moveScene;\r\n break;\r\n }\r\n switch (coordinate) {\r\n case Coordinate.X:\r\n action.set(value, 0, 0);\r\n break;\r\n case Coordinate.Y:\r\n action.set(0, value, 0);\r\n break;\r\n case Coordinate.Z:\r\n action.set(0, 0, value);\r\n break;\r\n }\r\n };\r\n // Do the camera updates for each of the 3 touch-wheel axis.\r\n updateCameraProperty(this._wheelDeltaX, this._wheelXAction, this._wheelXActionCoordinate);\r\n updateCameraProperty(this._wheelDeltaY, this._wheelYAction, this._wheelYActionCoordinate);\r\n updateCameraProperty(this._wheelDeltaZ, this._wheelZAction, this._wheelZActionCoordinate);\r\n };\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelXMoveRelative\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelYMoveRelative\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelZMoveRelative\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelXRotateRelative\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelYRotateRelative\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelZRotateRelative\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelXMoveScene\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelYMoveScene\", null);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraMouseWheelInput.prototype, \"wheelZMoveScene\", null);\r\n return FreeCameraMouseWheelInput;\r\n}(BaseCameraMouseWheelInput));\r\nexport { FreeCameraMouseWheelInput };\r\nCameraInputTypes[\"FreeCameraMouseWheelInput\"] = FreeCameraMouseWheelInput;\r\n//# sourceMappingURL=freeCameraMouseWheelInput.js.map","import { __decorate } from \"tslib\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Matrix, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Tools } from \"../../Misc/tools\";\r\n/**\r\n * Manage the touch inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraTouchInput = /** @class */ (function () {\r\n /**\r\n * Manage the touch inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n * @param allowMouse Defines if mouse events can be treated as touch events\r\n */\r\n function FreeCameraTouchInput(\r\n /**\r\n * Define if mouse events can be treated as touch events\r\n */\r\n allowMouse) {\r\n if (allowMouse === void 0) { allowMouse = false; }\r\n this.allowMouse = allowMouse;\r\n /**\r\n * Defines the touch sensibility for rotation.\r\n * The higher the faster.\r\n */\r\n this.touchAngularSensibility = 200000.0;\r\n /**\r\n * Defines the touch sensibility for move.\r\n * The higher the faster.\r\n */\r\n this.touchMoveSensibility = 250.0;\r\n this._offsetX = null;\r\n this._offsetY = null;\r\n this._pointerPressed = new Array();\r\n }\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCameraTouchInput.prototype.attachControl = function (noPreventDefault) {\r\n var _this = this;\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n var previousPosition = null;\r\n if (this._pointerInput === undefined) {\r\n this._onLostFocus = function () {\r\n _this._offsetX = null;\r\n _this._offsetY = null;\r\n };\r\n this._pointerInput = function (p) {\r\n var evt = p.event;\r\n var isMouseEvent = !_this.camera.getEngine().hostInformation.isMobile && evt instanceof MouseEvent;\r\n if (!_this.allowMouse && (evt.pointerType === \"mouse\" || isMouseEvent)) {\r\n return;\r\n }\r\n if (p.type === PointerEventTypes.POINTERDOWN) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n _this._pointerPressed.push(evt.pointerId);\r\n if (_this._pointerPressed.length !== 1) {\r\n return;\r\n }\r\n previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY,\r\n };\r\n }\r\n else if (p.type === PointerEventTypes.POINTERUP) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n var index = _this._pointerPressed.indexOf(evt.pointerId);\r\n if (index === -1) {\r\n return;\r\n }\r\n _this._pointerPressed.splice(index, 1);\r\n if (index != 0) {\r\n return;\r\n }\r\n previousPosition = null;\r\n _this._offsetX = null;\r\n _this._offsetY = null;\r\n }\r\n else if (p.type === PointerEventTypes.POINTERMOVE) {\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n if (!previousPosition) {\r\n return;\r\n }\r\n var index = _this._pointerPressed.indexOf(evt.pointerId);\r\n if (index != 0) {\r\n return;\r\n }\r\n _this._offsetX = evt.clientX - previousPosition.x;\r\n _this._offsetY = -(evt.clientY - previousPosition.y);\r\n }\r\n };\r\n }\r\n this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE);\r\n if (this._onLostFocus) {\r\n var engine = this.camera.getEngine();\r\n var element = engine.getInputElement();\r\n element && element.addEventListener(\"blur\", this._onLostFocus);\r\n }\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n FreeCameraTouchInput.prototype.detachControl = function (ignored) {\r\n if (this._pointerInput) {\r\n if (this._observer) {\r\n this.camera.getScene().onPointerObservable.remove(this._observer);\r\n this._observer = null;\r\n }\r\n if (this._onLostFocus) {\r\n var engine = this.camera.getEngine();\r\n var element = engine.getInputElement();\r\n element && element.removeEventListener(\"blur\", this._onLostFocus);\r\n this._onLostFocus = null;\r\n }\r\n this._pointerPressed = [];\r\n this._offsetX = null;\r\n this._offsetY = null;\r\n }\r\n };\r\n /**\r\n * Update the current camera state depending on the inputs that have been used this frame.\r\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\r\n */\r\n FreeCameraTouchInput.prototype.checkInputs = function () {\r\n if (this._offsetX === null || this._offsetY === null) {\r\n return;\r\n }\r\n if (this._offsetX === 0 && this._offsetY === 0) {\r\n return;\r\n }\r\n var camera = this.camera;\r\n camera.cameraRotation.y = this._offsetX / this.touchAngularSensibility;\r\n if (this._pointerPressed.length > 1) {\r\n camera.cameraRotation.x = -this._offsetY / this.touchAngularSensibility;\r\n }\r\n else {\r\n var speed = camera._computeLocalCameraSpeed();\r\n var direction = new Vector3(0, 0, (speed * this._offsetY) / this.touchMoveSensibility);\r\n Matrix.RotationYawPitchRollToRef(camera.rotation.y, camera.rotation.x, 0, camera._cameraRotationMatrix);\r\n camera.cameraDirection.addInPlace(Vector3.TransformCoordinates(direction, camera._cameraRotationMatrix));\r\n }\r\n };\r\n /**\r\n * Gets the class name of the current intput.\r\n * @returns the class name\r\n */\r\n FreeCameraTouchInput.prototype.getClassName = function () {\r\n return \"FreeCameraTouchInput\";\r\n };\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n FreeCameraTouchInput.prototype.getSimpleName = function () {\r\n return \"touch\";\r\n };\r\n __decorate([\r\n serialize()\r\n ], FreeCameraTouchInput.prototype, \"touchAngularSensibility\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCameraTouchInput.prototype, \"touchMoveSensibility\", void 0);\r\n return FreeCameraTouchInput;\r\n}());\r\nexport { FreeCameraTouchInput };\r\nCameraInputTypes[\"FreeCameraTouchInput\"] = FreeCameraTouchInput;\r\n//# sourceMappingURL=freeCameraTouchInput.js.map","import { __extends } from \"tslib\";\r\nimport { CameraInputsManager } from \"./cameraInputsManager\";\r\nimport { FreeCameraKeyboardMoveInput } from \"../Cameras/Inputs/freeCameraKeyboardMoveInput\";\r\nimport { FreeCameraMouseInput } from \"../Cameras/Inputs/freeCameraMouseInput\";\r\nimport { FreeCameraMouseWheelInput } from \"../Cameras/Inputs/freeCameraMouseWheelInput\";\r\nimport { FreeCameraTouchInput } from \"../Cameras/Inputs/freeCameraTouchInput\";\r\n/**\r\n * Default Inputs manager for the FreeCamera.\r\n * It groups all the default supported inputs for ease of use.\r\n * @see https://doc.babylonjs.com/how_to/customizing_camera_inputs\r\n */\r\nvar FreeCameraInputsManager = /** @class */ (function (_super) {\r\n __extends(FreeCameraInputsManager, _super);\r\n /**\r\n * Instantiates a new FreeCameraInputsManager.\r\n * @param camera Defines the camera the inputs belong to\r\n */\r\n function FreeCameraInputsManager(camera) {\r\n var _this = _super.call(this, camera) || this;\r\n /**\r\n * @hidden\r\n */\r\n _this._mouseInput = null;\r\n /**\r\n * @hidden\r\n */\r\n _this._mouseWheelInput = null;\r\n return _this;\r\n }\r\n /**\r\n * Add keyboard input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.addKeyboard = function () {\r\n this.add(new FreeCameraKeyboardMoveInput());\r\n return this;\r\n };\r\n /**\r\n * Add mouse input support to the input manager.\r\n * @param touchEnabled if the FreeCameraMouseInput should support touch (default: true)\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.addMouse = function (touchEnabled) {\r\n if (touchEnabled === void 0) { touchEnabled = true; }\r\n if (!this._mouseInput) {\r\n this._mouseInput = new FreeCameraMouseInput(touchEnabled);\r\n this.add(this._mouseInput);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Removes the mouse input support from the manager\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.removeMouse = function () {\r\n if (this._mouseInput) {\r\n this.remove(this._mouseInput);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Add mouse wheel input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.addMouseWheel = function () {\r\n if (!this._mouseWheelInput) {\r\n this._mouseWheelInput = new FreeCameraMouseWheelInput();\r\n this.add(this._mouseWheelInput);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Removes the mouse wheel input support from the manager\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.removeMouseWheel = function () {\r\n if (this._mouseWheelInput) {\r\n this.remove(this._mouseWheelInput);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Add touch input support to the input manager.\r\n * @returns the current input manager\r\n */\r\n FreeCameraInputsManager.prototype.addTouch = function () {\r\n this.add(new FreeCameraTouchInput());\r\n return this;\r\n };\r\n /**\r\n * Remove all attached input methods from a camera\r\n */\r\n FreeCameraInputsManager.prototype.clear = function () {\r\n _super.prototype.clear.call(this);\r\n this._mouseInput = null;\r\n };\r\n return FreeCameraInputsManager;\r\n}(CameraInputsManager));\r\nexport { FreeCameraInputsManager };\r\n//# sourceMappingURL=freeCameraInputsManager.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serializeAsVector3, serialize } from \"../Misc/decorators\";\r\nimport { Vector3, Vector2 } from \"../Maths/math.vector\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { TargetCamera } from \"./targetCamera\";\r\nimport { FreeCameraInputsManager } from \"./freeCameraInputsManager\";\r\nimport { Tools } from '../Misc/tools';\r\n/**\r\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\r\n * Please consider using the new UniversalCamera instead as it adds more functionality like the gamepad.\r\n * @see https://doc.babylonjs.com/features/cameras#universal-camera\r\n */\r\nvar FreeCamera = /** @class */ (function (_super) {\r\n __extends(FreeCamera, _super);\r\n /**\r\n * Instantiates a Free Camera.\r\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\r\n * Please consider using the new UniversalCamera instead as it adds more functionality like touch to this camera.\r\n * @see https://doc.babylonjs.com/features/cameras#universal-camera\r\n * @param name Define the name of the camera in the scene\r\n * @param position Define the start position of the camera in the scene\r\n * @param scene Define the scene the camera belongs to\r\n * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active if not other active cameras have been defined\r\n */\r\n function FreeCamera(name, position, scene, setActiveOnSceneIfNoneActive) {\r\n if (setActiveOnSceneIfNoneActive === void 0) { setActiveOnSceneIfNoneActive = true; }\r\n var _this = _super.call(this, name, position, scene, setActiveOnSceneIfNoneActive) || this;\r\n /**\r\n * Define the collision ellipsoid of the camera.\r\n * This is helpful to simulate a camera body like the player body around the camera\r\n * @see https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#arcrotatecamera\r\n */\r\n _this.ellipsoid = new Vector3(0.5, 1, 0.5);\r\n /**\r\n * Define an offset for the position of the ellipsoid around the camera.\r\n * This can be helpful to determine the center of the body near the gravity center of the body\r\n * instead of its head.\r\n */\r\n _this.ellipsoidOffset = new Vector3(0, 0, 0);\r\n /**\r\n * Enable or disable collisions of the camera with the rest of the scene objects.\r\n */\r\n _this.checkCollisions = false;\r\n /**\r\n * Enable or disable gravity on the camera.\r\n */\r\n _this.applyGravity = false;\r\n _this._needMoveForGravity = false;\r\n _this._oldPosition = Vector3.Zero();\r\n _this._diffPosition = Vector3.Zero();\r\n _this._newPosition = Vector3.Zero();\r\n // Collisions\r\n _this._collisionMask = -1;\r\n _this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {\r\n if (collidedMesh === void 0) { collidedMesh = null; }\r\n var updatePosition = function (newPos) {\r\n _this._newPosition.copyFrom(newPos);\r\n _this._newPosition.subtractToRef(_this._oldPosition, _this._diffPosition);\r\n if (_this._diffPosition.length() > Engine.CollisionsEpsilon) {\r\n _this.position.addInPlace(_this._diffPosition);\r\n if (_this.onCollide && collidedMesh) {\r\n _this.onCollide(collidedMesh);\r\n }\r\n }\r\n };\r\n updatePosition(newPosition);\r\n };\r\n _this.inputs = new FreeCameraInputsManager(_this);\r\n _this.inputs.addKeyboard().addMouse();\r\n return _this;\r\n }\r\n Object.defineProperty(FreeCamera.prototype, \"angularSensibility\", {\r\n /**\r\n * Gets the input sensibility for a mouse input. (default is 2000.0)\r\n * Higher values reduce sensitivity.\r\n */\r\n get: function () {\r\n var mouse = this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n return mouse.angularSensibility;\r\n }\r\n return 0;\r\n },\r\n /**\r\n * Sets the input sensibility for a mouse input. (default is 2000.0)\r\n * Higher values reduce sensitivity.\r\n */\r\n set: function (value) {\r\n var mouse = this.inputs.attached[\"mouse\"];\r\n if (mouse) {\r\n mouse.angularSensibility = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysUp\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the forward move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUp;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUp = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysUpward\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the upward move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysUpward;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysUpward = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysDown\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the backward move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDown;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDown = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysDownward\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the downward move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysDownward;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysDownward = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysLeft\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the left strafe move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysLeft;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysLeft = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(FreeCamera.prototype, \"keysRight\", {\r\n /**\r\n * Gets or Set the list of keyboard keys used to control the right strafe move of the camera.\r\n */\r\n get: function () {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n return keyboard.keysRight;\r\n }\r\n return [];\r\n },\r\n set: function (value) {\r\n var keyboard = this.inputs.attached[\"keyboard\"];\r\n if (keyboard) {\r\n keyboard.keysRight = value;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Attached controls to the current camera.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n FreeCamera.prototype.attachControl = function (ignored, noPreventDefault) {\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n this.inputs.attachElement(noPreventDefault);\r\n };\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n * @param ignored defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl\r\n */\r\n FreeCamera.prototype.detachControl = function (ignored) {\r\n this.inputs.detachElement();\r\n this.cameraDirection = new Vector3(0, 0, 0);\r\n this.cameraRotation = new Vector2(0, 0);\r\n };\r\n Object.defineProperty(FreeCamera.prototype, \"collisionMask\", {\r\n /**\r\n * Define a collision mask to limit the list of object the camera can collide with\r\n */\r\n get: function () {\r\n return this._collisionMask;\r\n },\r\n set: function (mask) {\r\n this._collisionMask = !isNaN(mask) ? mask : -1;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n FreeCamera.prototype._collideWithWorld = function (displacement) {\r\n var globalPosition;\r\n if (this.parent) {\r\n globalPosition = Vector3.TransformCoordinates(this.position, this.parent.getWorldMatrix());\r\n }\r\n else {\r\n globalPosition = this.position;\r\n }\r\n globalPosition.subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition);\r\n this._oldPosition.addInPlace(this.ellipsoidOffset);\r\n var coordinator = this.getScene().collisionCoordinator;\r\n if (!this._collider) {\r\n this._collider = coordinator.createCollider();\r\n }\r\n this._collider._radius = this.ellipsoid;\r\n this._collider.collisionMask = this._collisionMask;\r\n //no need for clone, as long as gravity is not on.\r\n var actualDisplacement = displacement;\r\n //add gravity to the direction to prevent the dual-collision checking\r\n if (this.applyGravity) {\r\n //this prevents mending with cameraDirection, a global variable of the free camera class.\r\n actualDisplacement = displacement.add(this.getScene().gravity);\r\n }\r\n coordinator.getNewPosition(this._oldPosition, actualDisplacement, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);\r\n };\r\n /** @hidden */\r\n FreeCamera.prototype._checkInputs = function () {\r\n if (!this._localDirection) {\r\n this._localDirection = Vector3.Zero();\r\n this._transformedDirection = Vector3.Zero();\r\n }\r\n this.inputs.checkInputs();\r\n _super.prototype._checkInputs.call(this);\r\n };\r\n /** @hidden */\r\n FreeCamera.prototype._decideIfNeedsToMove = function () {\r\n return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\r\n };\r\n /** @hidden */\r\n FreeCamera.prototype._updatePosition = function () {\r\n if (this.checkCollisions && this.getScene().collisionsEnabled) {\r\n this._collideWithWorld(this.cameraDirection);\r\n }\r\n else {\r\n _super.prototype._updatePosition.call(this);\r\n }\r\n };\r\n /**\r\n * Destroy the camera and release the current resources hold by it.\r\n */\r\n FreeCamera.prototype.dispose = function () {\r\n this.inputs.clear();\r\n _super.prototype.dispose.call(this);\r\n };\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n FreeCamera.prototype.getClassName = function () {\r\n return \"FreeCamera\";\r\n };\r\n __decorate([\r\n serializeAsVector3()\r\n ], FreeCamera.prototype, \"ellipsoid\", void 0);\r\n __decorate([\r\n serializeAsVector3()\r\n ], FreeCamera.prototype, \"ellipsoidOffset\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCamera.prototype, \"checkCollisions\", void 0);\r\n __decorate([\r\n serialize()\r\n ], FreeCamera.prototype, \"applyGravity\", void 0);\r\n return FreeCamera;\r\n}(TargetCamera));\r\nexport { FreeCamera };\r\n//# sourceMappingURL=freeCamera.js.map","import { __extends } from \"tslib\";\r\nimport { Vector3, Quaternion, Matrix } from \"../Maths/math.vector\";\r\nimport { ArrayTools } from \"../Misc/arrayTools\";\r\nimport { Node } from \"../node\";\r\nimport { Space } from '../Maths/math.axis';\r\n/**\r\n * Class used to store bone information\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\nvar Bone = /** @class */ (function (_super) {\r\n __extends(Bone, _super);\r\n /**\r\n * Create a new bone\r\n * @param name defines the bone name\r\n * @param skeleton defines the parent skeleton\r\n * @param parentBone defines the parent (can be null if the bone is the root)\r\n * @param localMatrix defines the local matrix\r\n * @param restPose defines the rest pose matrix\r\n * @param baseMatrix defines the base matrix\r\n * @param index defines index of the bone in the hiearchy\r\n */\r\n function Bone(\r\n /**\r\n * defines the bone name\r\n */\r\n name, skeleton, parentBone, localMatrix, restPose, baseMatrix, index) {\r\n if (parentBone === void 0) { parentBone = null; }\r\n if (localMatrix === void 0) { localMatrix = null; }\r\n if (restPose === void 0) { restPose = null; }\r\n if (baseMatrix === void 0) { baseMatrix = null; }\r\n if (index === void 0) { index = null; }\r\n var _this = _super.call(this, name, skeleton.getScene()) || this;\r\n _this.name = name;\r\n /**\r\n * Gets the list of child bones\r\n */\r\n _this.children = new Array();\r\n /** Gets the animations associated with this bone */\r\n _this.animations = new Array();\r\n /**\r\n * @hidden Internal only\r\n * Set this value to map this bone to a different index in the transform matrices\r\n * Set this value to -1 to exclude the bone from the transform matrices\r\n */\r\n _this._index = null;\r\n _this._absoluteTransform = new Matrix();\r\n _this._invertedAbsoluteTransform = new Matrix();\r\n _this._scalingDeterminant = 1;\r\n _this._worldTransform = new Matrix();\r\n _this._needToDecompose = true;\r\n _this._needToCompose = false;\r\n /** @hidden */\r\n _this._linkedTransformNode = null;\r\n /** @hidden */\r\n _this._waitingTransformNodeId = null;\r\n _this._skeleton = skeleton;\r\n _this._localMatrix = localMatrix ? localMatrix.clone() : Matrix.Identity();\r\n _this._restPose = restPose ? restPose : _this._localMatrix.clone();\r\n _this._bindPose = _this._localMatrix.clone();\r\n _this._baseMatrix = baseMatrix ? baseMatrix : _this._localMatrix.clone();\r\n _this._index = index;\r\n skeleton.bones.push(_this);\r\n _this.setParent(parentBone, false);\r\n if (baseMatrix || localMatrix) {\r\n _this._updateDifferenceMatrix();\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(Bone.prototype, \"_matrix\", {\r\n /** @hidden */\r\n get: function () {\r\n this._compose();\r\n return this._localMatrix;\r\n },\r\n /** @hidden */\r\n set: function (value) {\r\n this._localMatrix.copyFrom(value);\r\n this._needToDecompose = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n Bone.prototype.getClassName = function () {\r\n return \"Bone\";\r\n };\r\n // Members\r\n /**\r\n * Gets the parent skeleton\r\n * @returns a skeleton\r\n */\r\n Bone.prototype.getSkeleton = function () {\r\n return this._skeleton;\r\n };\r\n /**\r\n * Gets parent bone\r\n * @returns a bone or null if the bone is the root of the bone hierarchy\r\n */\r\n Bone.prototype.getParent = function () {\r\n return this._parent;\r\n };\r\n /**\r\n * Returns an array containing the root bones\r\n * @returns an array containing the root bones\r\n */\r\n Bone.prototype.getChildren = function () {\r\n return this.children;\r\n };\r\n /**\r\n * Gets the node index in matrix array generated for rendering\r\n * @returns the node index\r\n */\r\n Bone.prototype.getIndex = function () {\r\n return this._index === null ? this.getSkeleton().bones.indexOf(this) : this._index;\r\n };\r\n /**\r\n * Sets the parent bone\r\n * @param parent defines the parent (can be null if the bone is the root)\r\n * @param updateDifferenceMatrix defines if the difference matrix must be updated\r\n */\r\n Bone.prototype.setParent = function (parent, updateDifferenceMatrix) {\r\n if (updateDifferenceMatrix === void 0) { updateDifferenceMatrix = true; }\r\n if (this._parent === parent) {\r\n return;\r\n }\r\n if (this._parent) {\r\n var index = this._parent.children.indexOf(this);\r\n if (index !== -1) {\r\n this._parent.children.splice(index, 1);\r\n }\r\n }\r\n this._parent = parent;\r\n if (this._parent) {\r\n this._parent.children.push(this);\r\n }\r\n if (updateDifferenceMatrix) {\r\n this._updateDifferenceMatrix();\r\n }\r\n this.markAsDirty();\r\n };\r\n /**\r\n * Gets the local matrix\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getLocalMatrix = function () {\r\n this._compose();\r\n return this._localMatrix;\r\n };\r\n /**\r\n * Gets the base matrix (initial matrix which remains unchanged)\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getBaseMatrix = function () {\r\n return this._baseMatrix;\r\n };\r\n /**\r\n * Gets the rest pose matrix\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getRestPose = function () {\r\n return this._restPose;\r\n };\r\n /**\r\n * Sets the rest pose matrix\r\n * @param matrix the local-space rest pose to set for this bone\r\n */\r\n Bone.prototype.setRestPose = function (matrix) {\r\n this._restPose.copyFrom(matrix);\r\n };\r\n /**\r\n * Gets the bind pose matrix\r\n * @returns the bind pose matrix\r\n */\r\n Bone.prototype.getBindPose = function () {\r\n return this._bindPose;\r\n };\r\n /**\r\n * Sets the bind pose matrix\r\n * @param matrix the local-space bind pose to set for this bone\r\n */\r\n Bone.prototype.setBindPose = function (matrix) {\r\n this._bindPose.copyFrom(matrix);\r\n };\r\n /**\r\n * Gets a matrix used to store world matrix (ie. the matrix sent to shaders)\r\n */\r\n Bone.prototype.getWorldMatrix = function () {\r\n return this._worldTransform;\r\n };\r\n /**\r\n * Sets the local matrix to rest pose matrix\r\n */\r\n Bone.prototype.returnToRest = function () {\r\n if (this._skeleton._numBonesWithLinkedTransformNode > 0) {\r\n this.updateMatrix(this._restPose, false, false);\r\n }\r\n else {\r\n this.updateMatrix(this._restPose, false, true);\r\n }\r\n };\r\n /**\r\n * Gets the inverse of the absolute transform matrix.\r\n * This matrix will be multiplied by local matrix to get the difference matrix (ie. the difference between original state and current state)\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getInvertedAbsoluteTransform = function () {\r\n return this._invertedAbsoluteTransform;\r\n };\r\n /**\r\n * Gets the absolute transform matrix (ie base matrix * parent world matrix)\r\n * @returns a matrix\r\n */\r\n Bone.prototype.getAbsoluteTransform = function () {\r\n return this._absoluteTransform;\r\n };\r\n /**\r\n * Links with the given transform node.\r\n * The local matrix of this bone is copied from the transform node every frame.\r\n * @param transformNode defines the transform node to link to\r\n */\r\n Bone.prototype.linkTransformNode = function (transformNode) {\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode--;\r\n }\r\n this._linkedTransformNode = transformNode;\r\n if (this._linkedTransformNode) {\r\n this._skeleton._numBonesWithLinkedTransformNode++;\r\n }\r\n };\r\n // Properties (matches AbstractMesh properties)\r\n /**\r\n * Gets the node used to drive the bone's transformation\r\n * @returns a transform node or null\r\n */\r\n Bone.prototype.getTransformNode = function () {\r\n return this._linkedTransformNode;\r\n };\r\n Object.defineProperty(Bone.prototype, \"position\", {\r\n /** Gets or sets current position (in local space) */\r\n get: function () {\r\n this._decompose();\r\n return this._localPosition;\r\n },\r\n set: function (newPosition) {\r\n this._decompose();\r\n this._localPosition.copyFrom(newPosition);\r\n this._markAsDirtyAndCompose();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"rotation\", {\r\n /** Gets or sets current rotation (in local space) */\r\n get: function () {\r\n return this.getRotation();\r\n },\r\n set: function (newRotation) {\r\n this.setRotation(newRotation);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"rotationQuaternion\", {\r\n /** Gets or sets current rotation quaternion (in local space) */\r\n get: function () {\r\n this._decompose();\r\n return this._localRotation;\r\n },\r\n set: function (newRotation) {\r\n this.setRotationQuaternion(newRotation);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"scaling\", {\r\n /** Gets or sets current scaling (in local space) */\r\n get: function () {\r\n return this.getScale();\r\n },\r\n set: function (newScaling) {\r\n this.setScale(newScaling);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Bone.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets the animation properties override\r\n */\r\n get: function () {\r\n return this._skeleton.animationPropertiesOverride;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Methods\r\n Bone.prototype._decompose = function () {\r\n if (!this._needToDecompose) {\r\n return;\r\n }\r\n this._needToDecompose = false;\r\n if (!this._localScaling) {\r\n this._localScaling = Vector3.Zero();\r\n this._localRotation = Quaternion.Zero();\r\n this._localPosition = Vector3.Zero();\r\n }\r\n this._localMatrix.decompose(this._localScaling, this._localRotation, this._localPosition);\r\n };\r\n Bone.prototype._compose = function () {\r\n if (!this._needToCompose) {\r\n return;\r\n }\r\n if (!this._localScaling) {\r\n this._needToCompose = false;\r\n return;\r\n }\r\n this._needToCompose = false;\r\n Matrix.ComposeToRef(this._localScaling, this._localRotation, this._localPosition, this._localMatrix);\r\n };\r\n /**\r\n * Update the base and local matrices\r\n * @param matrix defines the new base or local matrix\r\n * @param updateDifferenceMatrix defines if the difference matrix must be updated\r\n * @param updateLocalMatrix defines if the local matrix should be updated\r\n */\r\n Bone.prototype.updateMatrix = function (matrix, updateDifferenceMatrix, updateLocalMatrix) {\r\n if (updateDifferenceMatrix === void 0) { updateDifferenceMatrix = true; }\r\n if (updateLocalMatrix === void 0) { updateLocalMatrix = true; }\r\n this._baseMatrix.copyFrom(matrix);\r\n if (updateDifferenceMatrix) {\r\n this._updateDifferenceMatrix();\r\n }\r\n if (updateLocalMatrix) {\r\n this._needToCompose = false; // in case there was a pending compose\r\n this._localMatrix.copyFrom(matrix);\r\n this._markAsDirtyAndDecompose();\r\n }\r\n else {\r\n this.markAsDirty();\r\n }\r\n };\r\n /** @hidden */\r\n Bone.prototype._updateDifferenceMatrix = function (rootMatrix, updateChildren) {\r\n if (updateChildren === void 0) { updateChildren = true; }\r\n if (!rootMatrix) {\r\n rootMatrix = this._baseMatrix;\r\n }\r\n if (this._parent) {\r\n rootMatrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform);\r\n }\r\n else {\r\n this._absoluteTransform.copyFrom(rootMatrix);\r\n }\r\n this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform);\r\n if (updateChildren) {\r\n for (var index = 0; index < this.children.length; index++) {\r\n this.children[index]._updateDifferenceMatrix();\r\n }\r\n }\r\n this._scalingDeterminant = (this._absoluteTransform.determinant() < 0 ? -1 : 1);\r\n };\r\n /**\r\n * Flag the bone as dirty (Forcing it to update everything)\r\n */\r\n Bone.prototype.markAsDirty = function () {\r\n this._currentRenderId++;\r\n this._childUpdateId++;\r\n this._skeleton._markAsDirty();\r\n };\r\n /** @hidden */\r\n Bone.prototype._markAsDirtyAndCompose = function () {\r\n this.markAsDirty();\r\n this._needToCompose = true;\r\n };\r\n Bone.prototype._markAsDirtyAndDecompose = function () {\r\n this.markAsDirty();\r\n this._needToDecompose = true;\r\n };\r\n /**\r\n * Translate the bone in local or world space\r\n * @param vec The amount to translate the bone\r\n * @param space The space that the translation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.translate = function (vec, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n var lm = this.getLocalMatrix();\r\n if (space == Space.LOCAL) {\r\n lm.addAtIndex(12, vec.x);\r\n lm.addAtIndex(13, vec.y);\r\n lm.addAtIndex(14, vec.z);\r\n }\r\n else {\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n var tvec = Bone._tmpVecs[0];\r\n if (this._parent) {\r\n if (mesh && wm) {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n }\r\n }\r\n else {\r\n Matrix.IdentityToRef(tmat);\r\n }\r\n tmat.setTranslationFromFloats(0, 0, 0);\r\n tmat.invert();\r\n Vector3.TransformCoordinatesToRef(vec, tmat, tvec);\r\n lm.addAtIndex(12, tvec.x);\r\n lm.addAtIndex(13, tvec.y);\r\n lm.addAtIndex(14, tvec.z);\r\n }\r\n this._markAsDirtyAndDecompose();\r\n };\r\n /**\r\n * Set the postion of the bone in local or world space\r\n * @param position The position to set the bone\r\n * @param space The space that the position is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setPosition = function (position, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n var lm = this.getLocalMatrix();\r\n if (space == Space.LOCAL) {\r\n lm.setTranslationFromFloats(position.x, position.y, position.z);\r\n }\r\n else {\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n var vec = Bone._tmpVecs[0];\r\n if (this._parent) {\r\n if (mesh && wm) {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat.copyFrom(this._parent.getAbsoluteTransform());\r\n }\r\n tmat.invert();\r\n }\r\n else {\r\n Matrix.IdentityToRef(tmat);\r\n }\r\n Vector3.TransformCoordinatesToRef(position, tmat, vec);\r\n lm.setTranslationFromFloats(vec.x, vec.y, vec.z);\r\n }\r\n this._markAsDirtyAndDecompose();\r\n };\r\n /**\r\n * Set the absolute position of the bone (world space)\r\n * @param position The position to set the bone\r\n * @param mesh The mesh that this bone is attached to\r\n */\r\n Bone.prototype.setAbsolutePosition = function (position, mesh) {\r\n this.setPosition(position, Space.WORLD, mesh);\r\n };\r\n /**\r\n * Scale the bone on the x, y and z axes (in local space)\r\n * @param x The amount to scale the bone on the x axis\r\n * @param y The amount to scale the bone on the y axis\r\n * @param z The amount to scale the bone on the z axis\r\n * @param scaleChildren sets this to true if children of the bone should be scaled as well (false by default)\r\n */\r\n Bone.prototype.scale = function (x, y, z, scaleChildren) {\r\n if (scaleChildren === void 0) { scaleChildren = false; }\r\n var locMat = this.getLocalMatrix();\r\n // Apply new scaling on top of current local matrix\r\n var scaleMat = Bone._tmpMats[0];\r\n Matrix.ScalingToRef(x, y, z, scaleMat);\r\n scaleMat.multiplyToRef(locMat, locMat);\r\n // Invert scaling matrix and apply the inverse to all children\r\n scaleMat.invert();\r\n for (var _i = 0, _a = this.children; _i < _a.length; _i++) {\r\n var child = _a[_i];\r\n var cm = child.getLocalMatrix();\r\n cm.multiplyToRef(scaleMat, cm);\r\n cm.multiplyAtIndex(12, x);\r\n cm.multiplyAtIndex(13, y);\r\n cm.multiplyAtIndex(14, z);\r\n child._markAsDirtyAndDecompose();\r\n }\r\n this._markAsDirtyAndDecompose();\r\n if (scaleChildren) {\r\n for (var _b = 0, _c = this.children; _b < _c.length; _b++) {\r\n var child = _c[_b];\r\n child.scale(x, y, z, scaleChildren);\r\n }\r\n }\r\n };\r\n /**\r\n * Set the bone scaling in local space\r\n * @param scale defines the scaling vector\r\n */\r\n Bone.prototype.setScale = function (scale) {\r\n this._decompose();\r\n this._localScaling.copyFrom(scale);\r\n this._markAsDirtyAndCompose();\r\n };\r\n /**\r\n * Gets the current scaling in local space\r\n * @returns the current scaling vector\r\n */\r\n Bone.prototype.getScale = function () {\r\n this._decompose();\r\n return this._localScaling;\r\n };\r\n /**\r\n * Gets the current scaling in local space and stores it in a target vector\r\n * @param result defines the target vector\r\n */\r\n Bone.prototype.getScaleToRef = function (result) {\r\n this._decompose();\r\n result.copyFrom(this._localScaling);\r\n };\r\n /**\r\n * Set the yaw, pitch, and roll of the bone in local or world space\r\n * @param yaw The rotation of the bone on the y axis\r\n * @param pitch The rotation of the bone on the x axis\r\n * @param roll The rotation of the bone on the z axis\r\n * @param space The space that the axes of rotation are in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setYawPitchRoll = function (yaw, pitch, roll, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (space === Space.LOCAL) {\r\n var quat = Bone._tmpQuat;\r\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, quat);\r\n this.setRotationQuaternion(quat, space, mesh);\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat = Bone._tmpMats[1];\r\n Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, mesh);\r\n };\r\n /**\r\n * Add a rotation to the bone on an axis in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param amount The amount to rotate the bone\r\n * @param space The space that the axis is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.rotate = function (axis, amount, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n var rmat = Bone._tmpMats[0];\r\n rmat.setTranslationFromFloats(0, 0, 0);\r\n Matrix.RotationAxisToRef(axis, amount, rmat);\r\n this._rotateWithMatrix(rmat, space, mesh);\r\n };\r\n /**\r\n * Set the rotation of the bone to a particular axis angle in local or world space\r\n * @param axis The axis to rotate the bone on\r\n * @param angle The angle that the bone should be rotated to\r\n * @param space The space that the axis is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setAxisAngle = function (axis, angle, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (space === Space.LOCAL) {\r\n var quat = Bone._tmpQuat;\r\n Quaternion.RotationAxisToRef(axis, angle, quat);\r\n this.setRotationQuaternion(quat, space, mesh);\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat = Bone._tmpMats[1];\r\n Matrix.RotationAxisToRef(axis, angle, rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, mesh);\r\n };\r\n /**\r\n * Set the euler rotation of the bone in local or world space\r\n * @param rotation The euler rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setRotation = function (rotation, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n this.setYawPitchRoll(rotation.y, rotation.x, rotation.z, space, mesh);\r\n };\r\n /**\r\n * Set the quaternion rotation of the bone in local or world space\r\n * @param quat The quaternion rotation that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setRotationQuaternion = function (quat, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (space === Space.LOCAL) {\r\n this._decompose();\r\n this._localRotation.copyFrom(quat);\r\n this._markAsDirtyAndCompose();\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat = Bone._tmpMats[1];\r\n Matrix.FromQuaternionToRef(quat, rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat);\r\n this._rotateWithMatrix(rotMat, space, mesh);\r\n };\r\n /**\r\n * Set the rotation matrix of the bone in local or world space\r\n * @param rotMat The rotation matrix that the bone should be set to\r\n * @param space The space that the rotation is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n */\r\n Bone.prototype.setRotationMatrix = function (rotMat, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (space === Space.LOCAL) {\r\n var quat = Bone._tmpQuat;\r\n Quaternion.FromRotationMatrixToRef(rotMat, quat);\r\n this.setRotationQuaternion(quat, space, mesh);\r\n return;\r\n }\r\n var rotMatInv = Bone._tmpMats[0];\r\n if (!this._getNegativeRotationToRef(rotMatInv, mesh)) {\r\n return;\r\n }\r\n var rotMat2 = Bone._tmpMats[1];\r\n rotMat2.copyFrom(rotMat);\r\n rotMatInv.multiplyToRef(rotMat, rotMat2);\r\n this._rotateWithMatrix(rotMat2, space, mesh);\r\n };\r\n Bone.prototype._rotateWithMatrix = function (rmat, space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n var lmat = this.getLocalMatrix();\r\n var lx = lmat.m[12];\r\n var ly = lmat.m[13];\r\n var lz = lmat.m[14];\r\n var parent = this.getParent();\r\n var parentScale = Bone._tmpMats[3];\r\n var parentScaleInv = Bone._tmpMats[4];\r\n if (parent && space == Space.WORLD) {\r\n if (mesh) {\r\n parentScale.copyFrom(mesh.getWorldMatrix());\r\n parent.getAbsoluteTransform().multiplyToRef(parentScale, parentScale);\r\n }\r\n else {\r\n parentScale.copyFrom(parent.getAbsoluteTransform());\r\n }\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n }\r\n else {\r\n if (space == Space.WORLD && mesh) {\r\n parentScale.copyFrom(mesh.getWorldMatrix());\r\n parentScaleInv.copyFrom(parentScale);\r\n parentScaleInv.invert();\r\n lmat.multiplyToRef(parentScale, lmat);\r\n lmat.multiplyToRef(rmat, lmat);\r\n lmat.multiplyToRef(parentScaleInv, lmat);\r\n }\r\n else {\r\n lmat.multiplyToRef(rmat, lmat);\r\n }\r\n }\r\n lmat.setTranslationFromFloats(lx, ly, lz);\r\n this.computeAbsoluteTransforms();\r\n this._markAsDirtyAndDecompose();\r\n };\r\n Bone.prototype._getNegativeRotationToRef = function (rotMatInv, mesh) {\r\n var scaleMatrix = Bone._tmpMats[2];\r\n rotMatInv.copyFrom(this.getAbsoluteTransform());\r\n if (mesh) {\r\n rotMatInv.multiplyToRef(mesh.getWorldMatrix(), rotMatInv);\r\n Matrix.ScalingToRef(mesh.scaling.x, mesh.scaling.y, mesh.scaling.z, scaleMatrix);\r\n }\r\n rotMatInv.invert();\r\n if (isNaN(rotMatInv.m[0])) {\r\n // Matrix failed to invert.\r\n // This can happen if scale is zero for example.\r\n return false;\r\n }\r\n scaleMatrix.multiplyAtIndex(0, this._scalingDeterminant);\r\n rotMatInv.multiplyToRef(scaleMatrix, rotMatInv);\r\n return true;\r\n };\r\n /**\r\n * Get the position of the bone in local or world space\r\n * @param space The space that the returned position is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The position of the bone\r\n */\r\n Bone.prototype.getPosition = function (space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var pos = Vector3.Zero();\r\n this.getPositionToRef(space, mesh, pos);\r\n return pos;\r\n };\r\n /**\r\n * Copy the position of the bone to a vector3 in local or world space\r\n * @param space The space that the returned position is in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The vector3 to copy the position to\r\n */\r\n Bone.prototype.getPositionToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (space == Space.LOCAL) {\r\n var lm = this.getLocalMatrix();\r\n result.x = lm.m[12];\r\n result.y = lm.m[13];\r\n result.z = lm.m[14];\r\n }\r\n else {\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n if (mesh && wm) {\r\n tmat.copyFrom(this.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat = this.getAbsoluteTransform();\r\n }\r\n result.x = tmat.m[12];\r\n result.y = tmat.m[13];\r\n result.z = tmat.m[14];\r\n }\r\n };\r\n /**\r\n * Get the absolute position of the bone (world space)\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The absolute position of the bone\r\n */\r\n Bone.prototype.getAbsolutePosition = function (mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var pos = Vector3.Zero();\r\n this.getPositionToRef(Space.WORLD, mesh, pos);\r\n return pos;\r\n };\r\n /**\r\n * Copy the absolute position of the bone (world space) to the result param\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 to copy the absolute position to\r\n */\r\n Bone.prototype.getAbsolutePositionToRef = function (mesh, result) {\r\n this.getPositionToRef(Space.WORLD, mesh, result);\r\n };\r\n /**\r\n * Compute the absolute transforms of this bone and its children\r\n */\r\n Bone.prototype.computeAbsoluteTransforms = function () {\r\n this._compose();\r\n if (this._parent) {\r\n this._localMatrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform);\r\n }\r\n else {\r\n this._absoluteTransform.copyFrom(this._localMatrix);\r\n var poseMatrix = this._skeleton.getPoseMatrix();\r\n if (poseMatrix) {\r\n this._absoluteTransform.multiplyToRef(poseMatrix, this._absoluteTransform);\r\n }\r\n }\r\n var children = this.children;\r\n var len = children.length;\r\n for (var i = 0; i < len; i++) {\r\n children[i].computeAbsoluteTransforms();\r\n }\r\n };\r\n /**\r\n * Get the world direction from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The world direction\r\n */\r\n Bone.prototype.getDirection = function (localAxis, mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var result = Vector3.Zero();\r\n this.getDirectionToRef(localAxis, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the world direction to a vector3 from an axis that is in the local space of the bone\r\n * @param localAxis The local direction that is used to compute the world direction\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 that the world direction will be copied to\r\n */\r\n Bone.prototype.getDirectionToRef = function (localAxis, mesh, result) {\r\n if (mesh === void 0) { mesh = null; }\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var mat = Bone._tmpMats[0];\r\n mat.copyFrom(this.getAbsoluteTransform());\r\n if (mesh && wm) {\r\n mat.multiplyToRef(wm, mat);\r\n }\r\n Vector3.TransformNormalToRef(localAxis, mat, result);\r\n result.normalize();\r\n };\r\n /**\r\n * Get the euler rotation of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The euler rotation\r\n */\r\n Bone.prototype.getRotation = function (space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var result = Vector3.Zero();\r\n this.getRotationToRef(space, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the euler rotation of the bone to a vector3. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The vector3 that the rotation should be copied to\r\n */\r\n Bone.prototype.getRotationToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var quat = Bone._tmpQuat;\r\n this.getRotationQuaternionToRef(space, mesh, quat);\r\n quat.toEulerAnglesToRef(result);\r\n };\r\n /**\r\n * Get the quaternion rotation of the bone in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The quaternion rotation\r\n */\r\n Bone.prototype.getRotationQuaternion = function (space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n var result = Quaternion.Identity();\r\n this.getRotationQuaternionToRef(space, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the quaternion rotation of the bone to a quaternion. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n Bone.prototype.getRotationQuaternionToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (mesh === void 0) { mesh = null; }\r\n if (space == Space.LOCAL) {\r\n this._decompose();\r\n result.copyFrom(this._localRotation);\r\n }\r\n else {\r\n var mat = Bone._tmpMats[0];\r\n var amat = this.getAbsoluteTransform();\r\n if (mesh) {\r\n amat.multiplyToRef(mesh.getWorldMatrix(), mat);\r\n }\r\n else {\r\n mat.copyFrom(amat);\r\n }\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n mat.decompose(undefined, result, undefined);\r\n }\r\n };\r\n /**\r\n * Get the rotation matrix of the bone in local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @returns The rotation matrix\r\n */\r\n Bone.prototype.getRotationMatrix = function (space, mesh) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n var result = Matrix.Identity();\r\n this.getRotationMatrixToRef(space, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space\r\n * @param space The space that the rotation should be in\r\n * @param mesh The mesh that this bone is attached to. This is only used in world space\r\n * @param result The quaternion that the rotation should be copied to\r\n */\r\n Bone.prototype.getRotationMatrixToRef = function (space, mesh, result) {\r\n if (space === void 0) { space = Space.LOCAL; }\r\n if (space == Space.LOCAL) {\r\n this.getLocalMatrix().getRotationMatrixToRef(result);\r\n }\r\n else {\r\n var mat = Bone._tmpMats[0];\r\n var amat = this.getAbsoluteTransform();\r\n if (mesh) {\r\n amat.multiplyToRef(mesh.getWorldMatrix(), mat);\r\n }\r\n else {\r\n mat.copyFrom(amat);\r\n }\r\n mat.multiplyAtIndex(0, this._scalingDeterminant);\r\n mat.multiplyAtIndex(1, this._scalingDeterminant);\r\n mat.multiplyAtIndex(2, this._scalingDeterminant);\r\n mat.getRotationMatrixToRef(result);\r\n }\r\n };\r\n /**\r\n * Get the world position of a point that is in the local space of the bone\r\n * @param position The local position\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The world position\r\n */\r\n Bone.prototype.getAbsolutePositionFromLocal = function (position, mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var result = Vector3.Zero();\r\n this.getAbsolutePositionFromLocalToRef(position, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Get the world position of a point that is in the local space of the bone and copy it to the result param\r\n * @param position The local position\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 that the world position should be copied to\r\n */\r\n Bone.prototype.getAbsolutePositionFromLocalToRef = function (position, mesh, result) {\r\n if (mesh === void 0) { mesh = null; }\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n if (mesh && wm) {\r\n tmat.copyFrom(this.getAbsoluteTransform());\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n else {\r\n tmat = this.getAbsoluteTransform();\r\n }\r\n Vector3.TransformCoordinatesToRef(position, tmat, result);\r\n };\r\n /**\r\n * Get the local position of a point that is in world space\r\n * @param position The world position\r\n * @param mesh The mesh that this bone is attached to\r\n * @returns The local position\r\n */\r\n Bone.prototype.getLocalPositionFromAbsolute = function (position, mesh) {\r\n if (mesh === void 0) { mesh = null; }\r\n var result = Vector3.Zero();\r\n this.getLocalPositionFromAbsoluteToRef(position, mesh, result);\r\n return result;\r\n };\r\n /**\r\n * Get the local position of a point that is in world space and copy it to the result param\r\n * @param position The world position\r\n * @param mesh The mesh that this bone is attached to\r\n * @param result The vector3 that the local position should be copied to\r\n */\r\n Bone.prototype.getLocalPositionFromAbsoluteToRef = function (position, mesh, result) {\r\n if (mesh === void 0) { mesh = null; }\r\n var wm = null;\r\n //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()\r\n if (mesh) {\r\n wm = mesh.getWorldMatrix();\r\n }\r\n this._skeleton.computeAbsoluteTransforms();\r\n var tmat = Bone._tmpMats[0];\r\n tmat.copyFrom(this.getAbsoluteTransform());\r\n if (mesh && wm) {\r\n tmat.multiplyToRef(wm, tmat);\r\n }\r\n tmat.invert();\r\n Vector3.TransformCoordinatesToRef(position, tmat, result);\r\n };\r\n /**\r\n * Set the current local matrix as the restPose for this bone.\r\n */\r\n Bone.prototype.setCurrentPoseAsRest = function () {\r\n this.setRestPose(this.getLocalMatrix());\r\n };\r\n Bone._tmpVecs = ArrayTools.BuildArray(2, Vector3.Zero);\r\n Bone._tmpQuat = Quaternion.Identity();\r\n Bone._tmpMats = ArrayTools.BuildArray(5, Matrix.Identity);\r\n return Bone;\r\n}(Node));\r\nexport { Bone };\r\n//# sourceMappingURL=bone.js.map","import { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';\r\nimport { Logger } from '../../Misc/logger';\r\nimport { Tools } from '../../Misc/tools';\r\nimport { ThinEngine } from '../thinEngine';\r\nThinEngine.prototype.updateRawTexture = function (texture, data, format, invertY, compression, type) {\r\n if (compression === void 0) { compression = null; }\r\n if (type === void 0) { type = 0; }\r\n if (!texture) {\r\n return;\r\n }\r\n // Babylon's internalSizedFomat but gl's texImage2D internalFormat\r\n var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type, format);\r\n // Babylon's internalFormat but gl's texImage2D format\r\n var internalFormat = this._getInternalFormat(format);\r\n var textureType = this._getWebGLTextureType(type);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n if (compression && data) {\r\n this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, this.getCaps().s3tc[compression], texture.width, texture.height, 0, data);\r\n }\r\n else {\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, data);\r\n }\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\nThinEngine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression, type) {\r\n if (compression === void 0) { compression = null; }\r\n if (type === void 0) { type = 0; }\r\n var texture = new InternalTexture(this, InternalTextureSource.Raw);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.format = format;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n texture.type = type;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n this.updateRawTexture(texture, data, format, invertY, compression, type);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n // Filters\r\n var filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\nThinEngine.prototype.createRawCubeTexture = function (data, size, format, type, generateMipMaps, invertY, samplingMode, compression) {\r\n if (compression === void 0) { compression = null; }\r\n var gl = this._gl;\r\n var texture = new InternalTexture(this, InternalTextureSource.CubeRaw);\r\n texture.isCube = true;\r\n texture.format = format;\r\n texture.type = type;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferViewArray = data;\r\n }\r\n var textureType = this._getWebGLTextureType(type);\r\n var internalFormat = this._getInternalFormat(format);\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n }\r\n // Mipmap generation needs a sized internal format that is both color-renderable and texture-filterable\r\n if (textureType === gl.FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = 1;\r\n Logger.Warn(\"Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n }\r\n else if (textureType === this._gl.HALF_FLOAT_OES && !this._caps.textureHalfFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = 1;\r\n Logger.Warn(\"Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n }\r\n else if (textureType === gl.FLOAT && !this._caps.textureFloatRender) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to float textures is not supported. Mipmap generation forced to false.\");\r\n }\r\n else if (textureType === gl.HALF_FLOAT && !this._caps.colorBufferFloat) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to half float textures is not supported. Mipmap generation forced to false.\");\r\n }\r\n var width = size;\r\n var height = width;\r\n texture.width = width;\r\n texture.height = height;\r\n // Double check on POT to generate Mips.\r\n var isPot = !this.needPOTTextures || (Tools.IsExponentOfTwo(texture.width) && Tools.IsExponentOfTwo(texture.height));\r\n if (!isPot) {\r\n generateMipMaps = false;\r\n }\r\n // Upload data if needed. The texture won't be ready until then.\r\n if (data) {\r\n this.updateRawCubeTexture(texture, data, format, type, invertY, compression);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);\r\n // Filters\r\n if (data && generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n var filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n texture.generateMipMaps = generateMipMaps;\r\n return texture;\r\n};\r\nThinEngine.prototype.updateRawCubeTexture = function (texture, data, format, type, invertY, compression, level) {\r\n if (compression === void 0) { compression = null; }\r\n if (level === void 0) { level = 0; }\r\n texture._bufferViewArray = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(type);\r\n var internalFormat = this._getInternalFormat(format);\r\n var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\r\n var needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n if (texture.width % 4 !== 0) {\r\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n // Data are known to be in +X +Y +Z -X -Y -Z\r\n for (var faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n var faceData = data[faceIndex];\r\n if (compression) {\r\n gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, (this.getCaps().s3tc)[compression], texture.width, texture.height, 0, faceData);\r\n }\r\n else {\r\n if (needConversion) {\r\n faceData = _convertRGBtoRGBATextureData(faceData, texture.width, texture.height, type);\r\n }\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, faceData);\r\n }\r\n }\r\n var isPot = !this.needPOTTextures || (Tools.IsExponentOfTwo(texture.width) && Tools.IsExponentOfTwo(texture.height));\r\n if (isPot && texture.generateMipMaps && level === 0) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\nThinEngine.prototype.createRawCubeTextureFromUrl = function (url, scene, size, format, type, noMipmap, callback, mipmapGenerator, onLoad, onError, samplingMode, invertY) {\r\n var _this = this;\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (invertY === void 0) { invertY = false; }\r\n var gl = this._gl;\r\n var texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode, null);\r\n scene === null || scene === void 0 ? void 0 : scene._addPendingData(texture);\r\n texture.url = url;\r\n this._internalTexturesCache.push(texture);\r\n var onerror = function (request, exception) {\r\n scene === null || scene === void 0 ? void 0 : scene._removePendingData(texture);\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n var internalCallback = function (data) {\r\n var width = texture.width;\r\n var faceDataArrays = callback(data);\r\n if (!faceDataArrays) {\r\n return;\r\n }\r\n if (mipmapGenerator) {\r\n var textureType = _this._getWebGLTextureType(type);\r\n var internalFormat = _this._getInternalFormat(format);\r\n var internalSizedFomat = _this._getRGBABufferInternalSizedFormat(type);\r\n var needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n _this._unpackFlipY(false);\r\n var mipData = mipmapGenerator(faceDataArrays);\r\n for (var level = 0; level < mipData.length; level++) {\r\n var mipSize = width >> level;\r\n for (var faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n var mipFaceData = mipData[level][faceIndex];\r\n if (needConversion) {\r\n mipFaceData = _convertRGBtoRGBATextureData(mipFaceData, mipSize, mipSize, type);\r\n }\r\n gl.texImage2D(faceIndex, level, internalSizedFomat, mipSize, mipSize, 0, internalFormat, textureType, mipFaceData);\r\n }\r\n }\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n else {\r\n _this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);\r\n }\r\n texture.isReady = true;\r\n // this.resetTextureCache();\r\n scene === null || scene === void 0 ? void 0 : scene._removePendingData(texture);\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n this._loadFile(url, function (data) {\r\n internalCallback(data);\r\n }, undefined, scene === null || scene === void 0 ? void 0 : scene.offlineProvider, true, onerror);\r\n return texture;\r\n};\r\n/** @hidden */\r\nfunction _convertRGBtoRGBATextureData(rgbData, width, height, textureType) {\r\n // Create new RGBA data container.\r\n var rgbaData;\r\n if (textureType === 1) {\r\n rgbaData = new Float32Array(width * height * 4);\r\n }\r\n else {\r\n rgbaData = new Uint32Array(width * height * 4);\r\n }\r\n // Convert each pixel.\r\n for (var x = 0; x < width; x++) {\r\n for (var y = 0; y < height; y++) {\r\n var index = (y * width + x) * 3;\r\n var newIndex = (y * width + x) * 4;\r\n // Map Old Value to new value.\r\n rgbaData[newIndex + 0] = rgbData[index + 0];\r\n rgbaData[newIndex + 1] = rgbData[index + 1];\r\n rgbaData[newIndex + 2] = rgbData[index + 2];\r\n // Add fully opaque alpha channel.\r\n rgbaData[newIndex + 3] = 1;\r\n }\r\n }\r\n return rgbaData;\r\n}\r\n/**\r\n * Create a function for createRawTexture3D/createRawTexture2DArray\r\n * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY\r\n * @hidden\r\n */\r\nfunction _makeCreateRawTextureFunction(is3D) {\r\n return function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = 0; }\r\n var target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;\r\n var source = is3D ? InternalTextureSource.Raw3D : InternalTextureSource.Raw2DArray;\r\n var texture = new InternalTexture(this, source);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.baseDepth = depth;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.depth = depth;\r\n texture.format = format;\r\n texture.type = textureType;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n if (is3D) {\r\n texture.is3D = true;\r\n }\r\n else {\r\n texture.is2DArray = true;\r\n }\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n if (is3D) {\r\n this.updateRawTexture3D(texture, data, format, invertY, compression, textureType);\r\n }\r\n else {\r\n this.updateRawTexture2DArray(texture, data, format, invertY, compression, textureType);\r\n }\r\n this._bindTextureDirectly(target, texture, true);\r\n // Filters\r\n var filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n this._gl.texParameteri(target, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(target, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(target);\r\n }\r\n this._bindTextureDirectly(target, null);\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n };\r\n}\r\nThinEngine.prototype.createRawTexture2DArray = _makeCreateRawTextureFunction(false);\r\nThinEngine.prototype.createRawTexture3D = _makeCreateRawTextureFunction(true);\r\n/**\r\n * Create a function for updateRawTexture3D/updateRawTexture2DArray\r\n * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY\r\n * @hidden\r\n */\r\nfunction _makeUpdateRawTextureFunction(is3D) {\r\n return function (texture, data, format, invertY, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = 0; }\r\n var target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;\r\n var internalType = this._getWebGLTextureType(textureType);\r\n var internalFormat = this._getInternalFormat(format);\r\n var internalSizedFomat = this._getRGBABufferInternalSizedFormat(textureType, format);\r\n this._bindTextureDirectly(target, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n if (compression && data) {\r\n this._gl.compressedTexImage3D(target, 0, this.getCaps().s3tc[compression], texture.width, texture.height, texture.depth, 0, data);\r\n }\r\n else {\r\n this._gl.texImage3D(target, 0, internalSizedFomat, texture.width, texture.height, texture.depth, 0, internalFormat, internalType, data);\r\n }\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(target);\r\n }\r\n this._bindTextureDirectly(target, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n };\r\n}\r\nThinEngine.prototype.updateRawTexture2DArray = _makeUpdateRawTextureFunction(false);\r\nThinEngine.prototype.updateRawTexture3D = _makeUpdateRawTextureFunction(true);\r\n//# sourceMappingURL=engine.rawTexture.js.map","import { __extends } from \"tslib\";\r\nimport { Texture } from \"./texture\";\r\nimport \"../../Engines/Extensions/engine.rawTexture\";\r\n/**\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n */\r\nvar RawTexture = /** @class */ (function (_super) {\r\n __extends(RawTexture, _super);\r\n /**\r\n * Instantiates a new RawTexture.\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n * @param data define the array of data to use to create the texture\r\n * @param width define the width of the texture\r\n * @param height define the height of the texture\r\n * @param format define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps define whether mip maps should be generated or not\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n */\r\n function RawTexture(data, width, height, \r\n /**\r\n * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n */\r\n format, sceneOrEngine, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (type === void 0) { type = 0; }\r\n var _this = _super.call(this, null, sceneOrEngine, !generateMipMaps, invertY) || this;\r\n _this.format = format;\r\n if (!_this._engine) {\r\n return _this;\r\n }\r\n _this._texture = _this._engine.createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type);\r\n _this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n _this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n return _this;\r\n }\r\n /**\r\n * Updates the texture underlying data.\r\n * @param data Define the new data of the texture\r\n */\r\n RawTexture.prototype.update = function (data) {\r\n this._getEngine().updateRawTexture(this._texture, data, this._texture.format, this._texture.invertY, null, this._texture.type);\r\n };\r\n /**\r\n * Creates a luminance texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance texture\r\n */\r\n RawTexture.CreateLuminanceTexture = function (data, width, height, sceneOrEngine, generateMipMaps, invertY, samplingMode) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n return new RawTexture(data, width, height, 1, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n };\r\n /**\r\n * Creates a luminance alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance alpha texture\r\n */\r\n RawTexture.CreateLuminanceAlphaTexture = function (data, width, height, sceneOrEngine, generateMipMaps, invertY, samplingMode) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n return new RawTexture(data, width, height, 2, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n };\r\n /**\r\n * Creates an alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the alpha texture\r\n */\r\n RawTexture.CreateAlphaTexture = function (data, width, height, sceneOrEngine, generateMipMaps, invertY, samplingMode) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n return new RawTexture(data, width, height, 0, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n };\r\n /**\r\n * Creates a RGB texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the RGB alpha texture\r\n */\r\n RawTexture.CreateRGBTexture = function (data, width, height, sceneOrEngine, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (type === void 0) { type = 0; }\r\n return new RawTexture(data, width, height, 4, sceneOrEngine, generateMipMaps, invertY, samplingMode, type);\r\n };\r\n /**\r\n * Creates a RGBA texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the RGBA texture\r\n */\r\n RawTexture.CreateRGBATexture = function (data, width, height, sceneOrEngine, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (type === void 0) { type = 0; }\r\n return new RawTexture(data, width, height, 5, sceneOrEngine, generateMipMaps, invertY, samplingMode, type);\r\n };\r\n /**\r\n * Creates a R texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the R texture\r\n */\r\n RawTexture.CreateRTexture = function (data, width, height, sceneOrEngine, generateMipMaps, invertY, samplingMode, type) {\r\n if (generateMipMaps === void 0) { generateMipMaps = true; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }\r\n if (type === void 0) { type = 1; }\r\n return new RawTexture(data, width, height, 6, sceneOrEngine, generateMipMaps, invertY, samplingMode, type);\r\n };\r\n return RawTexture;\r\n}(Texture));\r\nexport { RawTexture };\r\n//# sourceMappingURL=rawTexture.js.map","import { Bone } from \"./bone\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Vector3, Matrix, TmpVectors } from \"../Maths/math.vector\";\r\nimport { RawTexture } from \"../Materials/Textures/rawTexture\";\r\nimport { Animation } from \"../Animations/animation\";\r\nimport { AnimationRange } from \"../Animations/animationRange\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { DeepCopier } from \"../Misc/deepCopier\";\r\n/**\r\n * Class used to handle skinning animations\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\nvar Skeleton = /** @class */ (function () {\r\n /**\r\n * Creates a new skeleton\r\n * @param name defines the skeleton name\r\n * @param id defines the skeleton Id\r\n * @param scene defines the hosting scene\r\n */\r\n function Skeleton(\r\n /** defines the skeleton name */\r\n name, \r\n /** defines the skeleton Id */\r\n id, scene) {\r\n this.name = name;\r\n this.id = id;\r\n /**\r\n * Defines the list of child bones\r\n */\r\n this.bones = new Array();\r\n /**\r\n * Defines a boolean indicating if the root matrix is provided by meshes or by the current skeleton (this is the default value)\r\n */\r\n this.needInitialSkinMatrix = false;\r\n /**\r\n * Defines a mesh that override the matrix used to get the world matrix (null by default).\r\n */\r\n this.overrideMesh = null;\r\n this._isDirty = true;\r\n this._meshesWithPoseMatrix = new Array();\r\n this._identity = Matrix.Identity();\r\n this._ranges = {};\r\n this._lastAbsoluteTransformsUpdateId = -1;\r\n this._canUseTextureForBones = false;\r\n this._uniqueId = 0;\r\n /** @hidden */\r\n this._numBonesWithLinkedTransformNode = 0;\r\n /** @hidden */\r\n this._hasWaitingData = null;\r\n /** @hidden */\r\n this._waitingOverrideMeshId = null;\r\n /**\r\n * Specifies if the skeleton should be serialized\r\n */\r\n this.doNotSerialize = false;\r\n this._useTextureToStoreBoneMatrices = true;\r\n this._animationPropertiesOverride = null;\r\n // Events\r\n /**\r\n * An observable triggered before computing the skeleton's matrices\r\n */\r\n this.onBeforeComputeObservable = new Observable();\r\n this.bones = [];\r\n this._scene = scene || EngineStore.LastCreatedScene;\r\n this._uniqueId = this._scene.getUniqueId();\r\n this._scene.addSkeleton(this);\r\n //make sure it will recalculate the matrix next time prepare is called.\r\n this._isDirty = true;\r\n var engineCaps = this._scene.getEngine().getCaps();\r\n this._canUseTextureForBones = engineCaps.textureFloat && engineCaps.maxVertexTextureImageUnits > 0;\r\n }\r\n Object.defineProperty(Skeleton.prototype, \"useTextureToStoreBoneMatrices\", {\r\n /**\r\n * Gets or sets a boolean indicating that bone matrices should be stored as a texture instead of using shader uniforms (default is true).\r\n * Please note that this option is not available if the hardware does not support it\r\n */\r\n get: function () {\r\n return this._useTextureToStoreBoneMatrices;\r\n },\r\n set: function (value) {\r\n this._useTextureToStoreBoneMatrices = value;\r\n this._markAsDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Skeleton.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n get: function () {\r\n if (!this._animationPropertiesOverride) {\r\n return this._scene.animationPropertiesOverride;\r\n }\r\n return this._animationPropertiesOverride;\r\n },\r\n set: function (value) {\r\n this._animationPropertiesOverride = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Skeleton.prototype, \"isUsingTextureForMatrices\", {\r\n /**\r\n * Gets a boolean indicating that the skeleton effectively stores matrices into a texture\r\n */\r\n get: function () {\r\n return this.useTextureToStoreBoneMatrices && this._canUseTextureForBones;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Skeleton.prototype, \"uniqueId\", {\r\n /**\r\n * Gets the unique ID of this skeleton\r\n */\r\n get: function () {\r\n return this._uniqueId;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the current object class name.\r\n * @return the class name\r\n */\r\n Skeleton.prototype.getClassName = function () {\r\n return \"Skeleton\";\r\n };\r\n /**\r\n * Returns an array containing the root bones\r\n * @returns an array containing the root bones\r\n */\r\n Skeleton.prototype.getChildren = function () {\r\n return this.bones.filter(function (b) { return !b.getParent(); });\r\n };\r\n // Members\r\n /**\r\n * Gets the list of transform matrices to send to shaders (one matrix per bone)\r\n * @param mesh defines the mesh to use to get the root matrix (if needInitialSkinMatrix === true)\r\n * @returns a Float32Array containing matrices data\r\n */\r\n Skeleton.prototype.getTransformMatrices = function (mesh) {\r\n if (this.needInitialSkinMatrix && mesh._bonesTransformMatrices) {\r\n return mesh._bonesTransformMatrices;\r\n }\r\n if (!this._transformMatrices) {\r\n this.prepare();\r\n }\r\n return this._transformMatrices;\r\n };\r\n /**\r\n * Gets the list of transform matrices to send to shaders inside a texture (one matrix per bone)\r\n * @param mesh defines the mesh to use to get the root matrix (if needInitialSkinMatrix === true)\r\n * @returns a raw texture containing the data\r\n */\r\n Skeleton.prototype.getTransformMatrixTexture = function (mesh) {\r\n if (this.needInitialSkinMatrix && mesh._transformMatrixTexture) {\r\n return mesh._transformMatrixTexture;\r\n }\r\n return this._transformMatrixTexture;\r\n };\r\n /**\r\n * Gets the current hosting scene\r\n * @returns a scene object\r\n */\r\n Skeleton.prototype.getScene = function () {\r\n return this._scene;\r\n };\r\n // Methods\r\n /**\r\n * Gets a string representing the current skeleton data\r\n * @param fullDetails defines a boolean indicating if we want a verbose version\r\n * @returns a string representing the current skeleton data\r\n */\r\n Skeleton.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name + \", nBones: \" + this.bones.length;\r\n ret += \", nAnimationRanges: \" + (this._ranges ? Object.keys(this._ranges).length : \"none\");\r\n if (fullDetails) {\r\n ret += \", Ranges: {\";\r\n var first = true;\r\n for (var name_1 in this._ranges) {\r\n if (first) {\r\n ret += \", \";\r\n first = false;\r\n }\r\n ret += name_1;\r\n }\r\n ret += \"}\";\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Get bone's index searching by name\r\n * @param name defines bone's name to search for\r\n * @return the indice of the bone. Returns -1 if not found\r\n */\r\n Skeleton.prototype.getBoneIndexByName = function (name) {\r\n for (var boneIndex = 0, cache = this.bones.length; boneIndex < cache; boneIndex++) {\r\n if (this.bones[boneIndex].name === name) {\r\n return boneIndex;\r\n }\r\n }\r\n return -1;\r\n };\r\n /**\r\n * Creater a new animation range\r\n * @param name defines the name of the range\r\n * @param from defines the start key\r\n * @param to defines the end key\r\n */\r\n Skeleton.prototype.createAnimationRange = function (name, from, to) {\r\n // check name not already in use\r\n if (!this._ranges[name]) {\r\n this._ranges[name] = new AnimationRange(name, from, to);\r\n for (var i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n if (this.bones[i].animations[0]) {\r\n this.bones[i].animations[0].createRange(name, from, to);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Delete a specific animation range\r\n * @param name defines the name of the range\r\n * @param deleteFrames defines if frames must be removed as well\r\n */\r\n Skeleton.prototype.deleteAnimationRange = function (name, deleteFrames) {\r\n if (deleteFrames === void 0) { deleteFrames = true; }\r\n for (var i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n if (this.bones[i].animations[0]) {\r\n this.bones[i].animations[0].deleteRange(name, deleteFrames);\r\n }\r\n }\r\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\r\n };\r\n /**\r\n * Gets a specific animation range\r\n * @param name defines the name of the range to look for\r\n * @returns the requested animation range or null if not found\r\n */\r\n Skeleton.prototype.getAnimationRange = function (name) {\r\n return this._ranges[name] || null;\r\n };\r\n /**\r\n * Gets the list of all animation ranges defined on this skeleton\r\n * @returns an array\r\n */\r\n Skeleton.prototype.getAnimationRanges = function () {\r\n var animationRanges = [];\r\n var name;\r\n for (name in this._ranges) {\r\n animationRanges.push(this._ranges[name]);\r\n }\r\n return animationRanges;\r\n };\r\n /**\r\n * Copy animation range from a source skeleton.\r\n * This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences\r\n * @param source defines the source skeleton\r\n * @param name defines the name of the range to copy\r\n * @param rescaleAsRequired defines if rescaling must be applied if required\r\n * @returns true if operation was successful\r\n */\r\n Skeleton.prototype.copyAnimationRange = function (source, name, rescaleAsRequired) {\r\n if (rescaleAsRequired === void 0) { rescaleAsRequired = false; }\r\n if (this._ranges[name] || !source.getAnimationRange(name)) {\r\n return false;\r\n }\r\n var ret = true;\r\n var frameOffset = this._getHighestAnimationFrame() + 1;\r\n // make a dictionary of source skeleton's bones, so exact same order or doublely nested loop is not required\r\n var boneDict = {};\r\n var sourceBones = source.bones;\r\n var nBones;\r\n var i;\r\n for (i = 0, nBones = sourceBones.length; i < nBones; i++) {\r\n boneDict[sourceBones[i].name] = sourceBones[i];\r\n }\r\n if (this.bones.length !== sourceBones.length) {\r\n Logger.Warn(\"copyAnimationRange: this rig has \" + this.bones.length + \" bones, while source as \" + sourceBones.length);\r\n ret = false;\r\n }\r\n var skelDimensionsRatio = (rescaleAsRequired && this.dimensionsAtRest && source.dimensionsAtRest) ? this.dimensionsAtRest.divide(source.dimensionsAtRest) : null;\r\n for (i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n var boneName = this.bones[i].name;\r\n var sourceBone = boneDict[boneName];\r\n if (sourceBone) {\r\n ret = ret && this.bones[i].copyAnimationRange(sourceBone, name, frameOffset, rescaleAsRequired, skelDimensionsRatio);\r\n }\r\n else {\r\n Logger.Warn(\"copyAnimationRange: not same rig, missing source bone \" + boneName);\r\n ret = false;\r\n }\r\n }\r\n // do not call createAnimationRange(), since it also is done to bones, which was already done\r\n var range = source.getAnimationRange(name);\r\n if (range) {\r\n this._ranges[name] = new AnimationRange(name, range.from + frameOffset, range.to + frameOffset);\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Forces the skeleton to go to rest pose\r\n */\r\n Skeleton.prototype.returnToRest = function () {\r\n var _localScaling = TmpVectors.Vector3[0];\r\n var _localRotation = TmpVectors.Quaternion[0];\r\n var _localPosition = TmpVectors.Vector3[1];\r\n for (var index = 0; index < this.bones.length; index++) {\r\n var bone = this.bones[index];\r\n if (bone._index !== -1) {\r\n bone.returnToRest();\r\n if (bone._linkedTransformNode) {\r\n bone.getRestPose().decompose(_localScaling, _localRotation, _localPosition);\r\n bone._linkedTransformNode.position = _localPosition.clone();\r\n bone._linkedTransformNode.rotationQuaternion = _localRotation.clone();\r\n bone._linkedTransformNode.scaling = _localScaling.clone();\r\n }\r\n }\r\n }\r\n };\r\n Skeleton.prototype._getHighestAnimationFrame = function () {\r\n var ret = 0;\r\n for (var i = 0, nBones = this.bones.length; i < nBones; i++) {\r\n if (this.bones[i].animations[0]) {\r\n var highest = this.bones[i].animations[0].getHighestFrame();\r\n if (ret < highest) {\r\n ret = highest;\r\n }\r\n }\r\n }\r\n return ret;\r\n };\r\n /**\r\n * Begin a specific animation range\r\n * @param name defines the name of the range to start\r\n * @param loop defines if looping must be turned on (false by default)\r\n * @param speedRatio defines the speed ratio to apply (1 by default)\r\n * @param onAnimationEnd defines a callback which will be called when animation will end\r\n * @returns a new animatable\r\n */\r\n Skeleton.prototype.beginAnimation = function (name, loop, speedRatio, onAnimationEnd) {\r\n var range = this.getAnimationRange(name);\r\n if (!range) {\r\n return null;\r\n }\r\n return this._scene.beginAnimation(this, range.from, range.to, loop, speedRatio, onAnimationEnd);\r\n };\r\n /**\r\n * Convert the keyframes for a range of animation on a skeleton to be relative to a given reference frame.\r\n * @param skeleton defines the Skeleton containing the animation range to convert\r\n * @param referenceFrame defines the frame that keyframes in the range will be relative to\r\n * @param range defines the name of the AnimationRange belonging to the Skeleton to convert\r\n * @returns the original skeleton\r\n */\r\n Skeleton.MakeAnimationAdditive = function (skeleton, referenceFrame, range) {\r\n if (referenceFrame === void 0) { referenceFrame = 0; }\r\n var rangeValue = skeleton.getAnimationRange(range);\r\n // We can't make a range additive if it doesn't exist\r\n if (!rangeValue) {\r\n return null;\r\n }\r\n // Find any current scene-level animatable belonging to the target that matches the range\r\n var sceneAnimatables = skeleton._scene.getAllAnimatablesByTarget(skeleton);\r\n var rangeAnimatable = null;\r\n for (var index = 0; index < sceneAnimatables.length; index++) {\r\n var sceneAnimatable = sceneAnimatables[index];\r\n if (sceneAnimatable.fromFrame === (rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.from) && sceneAnimatable.toFrame === (rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.to)) {\r\n rangeAnimatable = sceneAnimatable;\r\n break;\r\n }\r\n }\r\n // Convert the animations belonging to the skeleton to additive keyframes\r\n var animatables = skeleton.getAnimatables();\r\n for (var index = 0; index < animatables.length; index++) {\r\n var animatable = animatables[index];\r\n var animations = animatable.animations;\r\n if (!animations) {\r\n continue;\r\n }\r\n for (var animIndex = 0; animIndex < animations.length; animIndex++) {\r\n Animation.MakeAnimationAdditive(animations[animIndex], referenceFrame, range);\r\n }\r\n }\r\n // Mark the scene-level animatable as additive\r\n if (rangeAnimatable) {\r\n rangeAnimatable.isAdditive = true;\r\n }\r\n return skeleton;\r\n };\r\n /** @hidden */\r\n Skeleton.prototype._markAsDirty = function () {\r\n this._isDirty = true;\r\n };\r\n /** @hidden */\r\n Skeleton.prototype._registerMeshWithPoseMatrix = function (mesh) {\r\n this._meshesWithPoseMatrix.push(mesh);\r\n };\r\n /** @hidden */\r\n Skeleton.prototype._unregisterMeshWithPoseMatrix = function (mesh) {\r\n var index = this._meshesWithPoseMatrix.indexOf(mesh);\r\n if (index > -1) {\r\n this._meshesWithPoseMatrix.splice(index, 1);\r\n }\r\n };\r\n Skeleton.prototype._computeTransformMatrices = function (targetMatrix, initialSkinMatrix) {\r\n this.onBeforeComputeObservable.notifyObservers(this);\r\n for (var index = 0; index < this.bones.length; index++) {\r\n var bone = this.bones[index];\r\n bone._childUpdateId++;\r\n var parentBone = bone.getParent();\r\n if (parentBone) {\r\n bone.getLocalMatrix().multiplyToRef(parentBone.getWorldMatrix(), bone.getWorldMatrix());\r\n }\r\n else {\r\n if (initialSkinMatrix) {\r\n bone.getLocalMatrix().multiplyToRef(initialSkinMatrix, bone.getWorldMatrix());\r\n }\r\n else {\r\n bone.getWorldMatrix().copyFrom(bone.getLocalMatrix());\r\n }\r\n }\r\n if (bone._index !== -1) {\r\n var mappedIndex = bone._index === null ? index : bone._index;\r\n bone.getInvertedAbsoluteTransform().multiplyToArray(bone.getWorldMatrix(), targetMatrix, mappedIndex * 16);\r\n }\r\n }\r\n this._identity.copyToArray(targetMatrix, this.bones.length * 16);\r\n };\r\n /**\r\n * Build all resources required to render a skeleton\r\n */\r\n Skeleton.prototype.prepare = function () {\r\n // Update the local matrix of bones with linked transform nodes.\r\n if (this._numBonesWithLinkedTransformNode > 0) {\r\n for (var _i = 0, _a = this.bones; _i < _a.length; _i++) {\r\n var bone_1 = _a[_i];\r\n if (bone_1._linkedTransformNode) {\r\n // Computing the world matrix also computes the local matrix.\r\n bone_1._linkedTransformNode.computeWorldMatrix();\r\n bone_1._matrix = bone_1._linkedTransformNode._localMatrix;\r\n bone_1.markAsDirty();\r\n }\r\n }\r\n }\r\n if (!this._isDirty) {\r\n return;\r\n }\r\n if (this.needInitialSkinMatrix) {\r\n for (var index = 0; index < this._meshesWithPoseMatrix.length; index++) {\r\n var mesh = this._meshesWithPoseMatrix[index];\r\n var poseMatrix = mesh.getPoseMatrix();\r\n if (!mesh._bonesTransformMatrices || mesh._bonesTransformMatrices.length !== 16 * (this.bones.length + 1)) {\r\n mesh._bonesTransformMatrices = new Float32Array(16 * (this.bones.length + 1));\r\n }\r\n if (this._synchronizedWithMesh !== mesh) {\r\n this._synchronizedWithMesh = mesh;\r\n // Prepare bones\r\n for (var boneIndex = 0; boneIndex < this.bones.length; boneIndex++) {\r\n var bone = this.bones[boneIndex];\r\n if (!bone.getParent()) {\r\n var matrix = bone.getBaseMatrix();\r\n matrix.multiplyToRef(poseMatrix, TmpVectors.Matrix[1]);\r\n bone._updateDifferenceMatrix(TmpVectors.Matrix[1]);\r\n }\r\n }\r\n if (this.isUsingTextureForMatrices) {\r\n var textureWidth = (this.bones.length + 1) * 4;\r\n if (!mesh._transformMatrixTexture || mesh._transformMatrixTexture.getSize().width !== textureWidth) {\r\n if (mesh._transformMatrixTexture) {\r\n mesh._transformMatrixTexture.dispose();\r\n }\r\n mesh._transformMatrixTexture = RawTexture.CreateRGBATexture(mesh._bonesTransformMatrices, (this.bones.length + 1) * 4, 1, this._scene, false, false, 1, 1);\r\n }\r\n }\r\n }\r\n this._computeTransformMatrices(mesh._bonesTransformMatrices, poseMatrix);\r\n if (this.isUsingTextureForMatrices && mesh._transformMatrixTexture) {\r\n mesh._transformMatrixTexture.update(mesh._bonesTransformMatrices);\r\n }\r\n }\r\n }\r\n else {\r\n if (!this._transformMatrices || this._transformMatrices.length !== 16 * (this.bones.length + 1)) {\r\n this._transformMatrices = new Float32Array(16 * (this.bones.length + 1));\r\n if (this.isUsingTextureForMatrices) {\r\n if (this._transformMatrixTexture) {\r\n this._transformMatrixTexture.dispose();\r\n }\r\n this._transformMatrixTexture = RawTexture.CreateRGBATexture(this._transformMatrices, (this.bones.length + 1) * 4, 1, this._scene, false, false, 1, 1);\r\n }\r\n }\r\n this._computeTransformMatrices(this._transformMatrices, null);\r\n if (this.isUsingTextureForMatrices && this._transformMatrixTexture) {\r\n this._transformMatrixTexture.update(this._transformMatrices);\r\n }\r\n }\r\n this._isDirty = false;\r\n this._scene._activeBones.addCount(this.bones.length, false);\r\n };\r\n /**\r\n * Gets the list of animatables currently running for this skeleton\r\n * @returns an array of animatables\r\n */\r\n Skeleton.prototype.getAnimatables = function () {\r\n if (!this._animatables || this._animatables.length !== this.bones.length) {\r\n this._animatables = [];\r\n for (var index = 0; index < this.bones.length; index++) {\r\n this._animatables.push(this.bones[index]);\r\n }\r\n }\r\n return this._animatables;\r\n };\r\n /**\r\n * Clone the current skeleton\r\n * @param name defines the name of the new skeleton\r\n * @param id defines the id of the new skeleton\r\n * @returns the new skeleton\r\n */\r\n Skeleton.prototype.clone = function (name, id) {\r\n var result = new Skeleton(name, id || name, this._scene);\r\n result.needInitialSkinMatrix = this.needInitialSkinMatrix;\r\n result.overrideMesh = this.overrideMesh;\r\n for (var index = 0; index < this.bones.length; index++) {\r\n var source = this.bones[index];\r\n var parentBone = null;\r\n var parent_1 = source.getParent();\r\n if (parent_1) {\r\n var parentIndex = this.bones.indexOf(parent_1);\r\n parentBone = result.bones[parentIndex];\r\n }\r\n var bone = new Bone(source.name, result, parentBone, source.getBaseMatrix().clone(), source.getRestPose().clone());\r\n bone._index = source._index;\r\n if (source._linkedTransformNode) {\r\n bone.linkTransformNode(source._linkedTransformNode);\r\n }\r\n DeepCopier.DeepCopy(source.animations, bone.animations);\r\n }\r\n if (this._ranges) {\r\n result._ranges = {};\r\n for (var rangeName in this._ranges) {\r\n var range = this._ranges[rangeName];\r\n if (range) {\r\n result._ranges[rangeName] = range.clone();\r\n }\r\n }\r\n }\r\n this._isDirty = true;\r\n return result;\r\n };\r\n /**\r\n * Enable animation blending for this skeleton\r\n * @param blendingSpeed defines the blending speed to apply\r\n * @see https://doc.babylonjs.com/babylon101/animations#animation-blending\r\n */\r\n Skeleton.prototype.enableBlending = function (blendingSpeed) {\r\n if (blendingSpeed === void 0) { blendingSpeed = 0.01; }\r\n this.bones.forEach(function (bone) {\r\n bone.animations.forEach(function (animation) {\r\n animation.enableBlending = true;\r\n animation.blendingSpeed = blendingSpeed;\r\n });\r\n });\r\n };\r\n /**\r\n * Releases all resources associated with the current skeleton\r\n */\r\n Skeleton.prototype.dispose = function () {\r\n this._meshesWithPoseMatrix = [];\r\n // Animations\r\n this.getScene().stopAnimation(this);\r\n // Remove from scene\r\n this.getScene().removeSkeleton(this);\r\n if (this._transformMatrixTexture) {\r\n this._transformMatrixTexture.dispose();\r\n this._transformMatrixTexture = null;\r\n }\r\n };\r\n /**\r\n * Serialize the skeleton in a JSON object\r\n * @returns a JSON object\r\n */\r\n Skeleton.prototype.serialize = function () {\r\n var _a, _b;\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.id = this.id;\r\n if (this.dimensionsAtRest) {\r\n serializationObject.dimensionsAtRest = this.dimensionsAtRest.asArray();\r\n }\r\n serializationObject.bones = [];\r\n serializationObject.needInitialSkinMatrix = this.needInitialSkinMatrix;\r\n serializationObject.overrideMeshId = (_a = this.overrideMesh) === null || _a === void 0 ? void 0 : _a.id;\r\n for (var index = 0; index < this.bones.length; index++) {\r\n var bone = this.bones[index];\r\n var parent_2 = bone.getParent();\r\n var serializedBone = {\r\n parentBoneIndex: parent_2 ? this.bones.indexOf(parent_2) : -1,\r\n index: bone.getIndex(),\r\n name: bone.name,\r\n matrix: bone.getBaseMatrix().toArray(),\r\n rest: bone.getRestPose().toArray(),\r\n linkedTransformNodeId: (_b = bone.getTransformNode()) === null || _b === void 0 ? void 0 : _b.id\r\n };\r\n serializationObject.bones.push(serializedBone);\r\n if (bone.length) {\r\n serializedBone.length = bone.length;\r\n }\r\n if (bone.metadata) {\r\n serializedBone.metadata = bone.metadata;\r\n }\r\n if (bone.animations && bone.animations.length > 0) {\r\n serializedBone.animation = bone.animations[0].serialize();\r\n }\r\n serializationObject.ranges = [];\r\n for (var name in this._ranges) {\r\n var source = this._ranges[name];\r\n if (!source) {\r\n continue;\r\n }\r\n var range = {};\r\n range.name = name;\r\n range.from = source.from;\r\n range.to = source.to;\r\n serializationObject.ranges.push(range);\r\n }\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Creates a new skeleton from serialized data\r\n * @param parsedSkeleton defines the serialized data\r\n * @param scene defines the hosting scene\r\n * @returns a new skeleton\r\n */\r\n Skeleton.Parse = function (parsedSkeleton, scene) {\r\n var skeleton = new Skeleton(parsedSkeleton.name, parsedSkeleton.id, scene);\r\n if (parsedSkeleton.dimensionsAtRest) {\r\n skeleton.dimensionsAtRest = Vector3.FromArray(parsedSkeleton.dimensionsAtRest);\r\n }\r\n skeleton.needInitialSkinMatrix = parsedSkeleton.needInitialSkinMatrix;\r\n if (parsedSkeleton.overrideMeshId) {\r\n skeleton._hasWaitingData = true;\r\n skeleton._waitingOverrideMeshId = parsedSkeleton.overrideMeshId;\r\n }\r\n var index;\r\n for (index = 0; index < parsedSkeleton.bones.length; index++) {\r\n var parsedBone = parsedSkeleton.bones[index];\r\n var parsedBoneIndex = parsedSkeleton.bones[index].index;\r\n var parentBone = null;\r\n if (parsedBone.parentBoneIndex > -1) {\r\n parentBone = skeleton.bones[parsedBone.parentBoneIndex];\r\n }\r\n var rest = parsedBone.rest ? Matrix.FromArray(parsedBone.rest) : null;\r\n var bone = new Bone(parsedBone.name, skeleton, parentBone, Matrix.FromArray(parsedBone.matrix), rest, null, parsedBoneIndex);\r\n if (parsedBone.id !== undefined && parsedBone.id !== null) {\r\n bone.id = parsedBone.id;\r\n }\r\n if (parsedBone.length) {\r\n bone.length = parsedBone.length;\r\n }\r\n if (parsedBone.metadata) {\r\n bone.metadata = parsedBone.metadata;\r\n }\r\n if (parsedBone.animation) {\r\n bone.animations.push(Animation.Parse(parsedBone.animation));\r\n }\r\n if (parsedBone.linkedTransformNodeId !== undefined && parsedBone.linkedTransformNodeId !== null) {\r\n skeleton._hasWaitingData = true;\r\n bone._waitingTransformNodeId = parsedBone.linkedTransformNodeId;\r\n }\r\n }\r\n // placed after bones, so createAnimationRange can cascade down\r\n if (parsedSkeleton.ranges) {\r\n for (index = 0; index < parsedSkeleton.ranges.length; index++) {\r\n var data = parsedSkeleton.ranges[index];\r\n skeleton.createAnimationRange(data.name, data.from, data.to);\r\n }\r\n }\r\n return skeleton;\r\n };\r\n /**\r\n * Compute all node absolute transforms\r\n * @param forceUpdate defines if computation must be done even if cache is up to date\r\n */\r\n Skeleton.prototype.computeAbsoluteTransforms = function (forceUpdate) {\r\n if (forceUpdate === void 0) { forceUpdate = false; }\r\n var renderId = this._scene.getRenderId();\r\n if (this._lastAbsoluteTransformsUpdateId != renderId || forceUpdate) {\r\n this.bones[0].computeAbsoluteTransforms();\r\n this._lastAbsoluteTransformsUpdateId = renderId;\r\n }\r\n };\r\n /**\r\n * Gets the root pose matrix\r\n * @returns a matrix\r\n */\r\n Skeleton.prototype.getPoseMatrix = function () {\r\n var poseMatrix = null;\r\n if (this._meshesWithPoseMatrix.length > 0) {\r\n poseMatrix = this._meshesWithPoseMatrix[0].getPoseMatrix();\r\n }\r\n return poseMatrix;\r\n };\r\n /**\r\n * Sorts bones per internal index\r\n */\r\n Skeleton.prototype.sortBones = function () {\r\n var bones = new Array();\r\n var visited = new Array(this.bones.length);\r\n for (var index = 0; index < this.bones.length; index++) {\r\n this._sortBones(index, bones, visited);\r\n }\r\n this.bones = bones;\r\n };\r\n Skeleton.prototype._sortBones = function (index, bones, visited) {\r\n if (visited[index]) {\r\n return;\r\n }\r\n visited[index] = true;\r\n var bone = this.bones[index];\r\n if (bone._index === undefined) {\r\n bone._index = index;\r\n }\r\n var parentBone = bone.getParent();\r\n if (parentBone) {\r\n this._sortBones(this.bones.indexOf(parentBone), bones, visited);\r\n }\r\n bones.push(bone);\r\n };\r\n /**\r\n * Set the current local matrix as the restPose for all bones in the skeleton.\r\n */\r\n Skeleton.prototype.setCurrentPoseAsRest = function () {\r\n this.bones.forEach(function (b) {\r\n b.setCurrentPoseAsRest();\r\n });\r\n };\r\n return Skeleton;\r\n}());\r\nexport { Skeleton };\r\n//# sourceMappingURL=skeleton.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, serializeAsVector3 } from \"../Misc/decorators\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Light } from \"./light\";\r\nimport { Axis } from '../Maths/math.axis';\r\n/**\r\n * Base implementation IShadowLight\r\n * It groups all the common behaviour in order to reduce dupplication and better follow the DRY pattern.\r\n */\r\nvar ShadowLight = /** @class */ (function (_super) {\r\n __extends(ShadowLight, _super);\r\n function ShadowLight() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this._needProjectionMatrixCompute = true;\r\n return _this;\r\n }\r\n ShadowLight.prototype._setPosition = function (value) {\r\n this._position = value;\r\n };\r\n Object.defineProperty(ShadowLight.prototype, \"position\", {\r\n /**\r\n * Sets the position the shadow will be casted from. Also use as the light position for both\r\n * point and spot lights.\r\n */\r\n get: function () {\r\n return this._position;\r\n },\r\n /**\r\n * Sets the position the shadow will be casted from. Also use as the light position for both\r\n * point and spot lights.\r\n */\r\n set: function (value) {\r\n this._setPosition(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n ShadowLight.prototype._setDirection = function (value) {\r\n this._direction = value;\r\n };\r\n Object.defineProperty(ShadowLight.prototype, \"direction\", {\r\n /**\r\n * In 2d mode (needCube being false), gets the direction used to cast the shadow.\r\n * Also use as the light direction on spot and directional lights.\r\n */\r\n get: function () {\r\n return this._direction;\r\n },\r\n /**\r\n * In 2d mode (needCube being false), sets the direction used to cast the shadow.\r\n * Also use as the light direction on spot and directional lights.\r\n */\r\n set: function (value) {\r\n this._setDirection(value);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowLight.prototype, \"shadowMinZ\", {\r\n /**\r\n * Gets the shadow projection clipping minimum z value.\r\n */\r\n get: function () {\r\n return this._shadowMinZ;\r\n },\r\n /**\r\n * Sets the shadow projection clipping minimum z value.\r\n */\r\n set: function (value) {\r\n this._shadowMinZ = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShadowLight.prototype, \"shadowMaxZ\", {\r\n /**\r\n * Sets the shadow projection clipping maximum z value.\r\n */\r\n get: function () {\r\n return this._shadowMaxZ;\r\n },\r\n /**\r\n * Gets the shadow projection clipping maximum z value.\r\n */\r\n set: function (value) {\r\n this._shadowMaxZ = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Computes the transformed information (transformedPosition and transformedDirection in World space) of the current light\r\n * @returns true if the information has been computed, false if it does not need to (no parenting)\r\n */\r\n ShadowLight.prototype.computeTransformedInformation = function () {\r\n if (this.parent && this.parent.getWorldMatrix) {\r\n if (!this.transformedPosition) {\r\n this.transformedPosition = Vector3.Zero();\r\n }\r\n Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition);\r\n // In case the direction is present.\r\n if (this.direction) {\r\n if (!this.transformedDirection) {\r\n this.transformedDirection = Vector3.Zero();\r\n }\r\n Vector3.TransformNormalToRef(this.direction, this.parent.getWorldMatrix(), this.transformedDirection);\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Return the depth scale used for the shadow map.\r\n * @returns the depth scale.\r\n */\r\n ShadowLight.prototype.getDepthScale = function () {\r\n return 50.0;\r\n };\r\n /**\r\n * Get the direction to use to render the shadow map. In case of cube texture, the face index can be passed.\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n ShadowLight.prototype.getShadowDirection = function (faceIndex) {\r\n return this.transformedDirection ? this.transformedDirection : this.direction;\r\n };\r\n /**\r\n * Returns the ShadowLight absolute position in the World.\r\n * @returns the position vector in world space\r\n */\r\n ShadowLight.prototype.getAbsolutePosition = function () {\r\n return this.transformedPosition ? this.transformedPosition : this.position;\r\n };\r\n /**\r\n * Sets the ShadowLight direction toward the passed target.\r\n * @param target The point to target in local space\r\n * @returns the updated ShadowLight direction\r\n */\r\n ShadowLight.prototype.setDirectionToTarget = function (target) {\r\n this.direction = Vector3.Normalize(target.subtract(this.position));\r\n return this.direction;\r\n };\r\n /**\r\n * Returns the light rotation in euler definition.\r\n * @returns the x y z rotation in local space.\r\n */\r\n ShadowLight.prototype.getRotation = function () {\r\n this.direction.normalize();\r\n var xaxis = Vector3.Cross(this.direction, Axis.Y);\r\n var yaxis = Vector3.Cross(xaxis, this.direction);\r\n return Vector3.RotationFromAxis(xaxis, yaxis, this.direction);\r\n };\r\n /**\r\n * Returns whether or not the shadow generation require a cube texture or a 2d texture.\r\n * @returns true if a cube texture needs to be use\r\n */\r\n ShadowLight.prototype.needCube = function () {\r\n return false;\r\n };\r\n /**\r\n * Detects if the projection matrix requires to be recomputed this frame.\r\n * @returns true if it requires to be recomputed otherwise, false.\r\n */\r\n ShadowLight.prototype.needProjectionMatrixCompute = function () {\r\n return this._needProjectionMatrixCompute;\r\n };\r\n /**\r\n * Forces the shadow generator to recompute the projection matrix even if position and direction did not changed.\r\n */\r\n ShadowLight.prototype.forceProjectionMatrixCompute = function () {\r\n this._needProjectionMatrixCompute = true;\r\n };\r\n /** @hidden */\r\n ShadowLight.prototype._initCache = function () {\r\n _super.prototype._initCache.call(this);\r\n this._cache.position = Vector3.Zero();\r\n };\r\n /** @hidden */\r\n ShadowLight.prototype._isSynchronized = function () {\r\n if (!this._cache.position.equals(this.position)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Computes the world matrix of the node\r\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\r\n * @returns the world matrix\r\n */\r\n ShadowLight.prototype.computeWorldMatrix = function (force) {\r\n if (!force && this.isSynchronized()) {\r\n this._currentRenderId = this.getScene().getRenderId();\r\n return this._worldMatrix;\r\n }\r\n this._updateCache();\r\n this._cache.position.copyFrom(this.position);\r\n if (!this._worldMatrix) {\r\n this._worldMatrix = Matrix.Identity();\r\n }\r\n Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);\r\n if (this.parent && this.parent.getWorldMatrix) {\r\n this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);\r\n this._markSyncedWithParent();\r\n }\r\n // Cache the determinant\r\n this._worldMatrixDeterminantIsDirty = true;\r\n return this._worldMatrix;\r\n };\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n ShadowLight.prototype.getDepthMinZ = function (activeCamera) {\r\n return this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\r\n };\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n ShadowLight.prototype.getDepthMaxZ = function (activeCamera) {\r\n return this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\r\n };\r\n /**\r\n * Sets the shadow projection matrix in parameter to the generated projection matrix.\r\n * @param matrix The materix to updated with the projection information\r\n * @param viewMatrix The transform matrix of the light\r\n * @param renderList The list of mesh to render in the map\r\n * @returns The current light\r\n */\r\n ShadowLight.prototype.setShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n if (this.customProjectionMatrixBuilder) {\r\n this.customProjectionMatrixBuilder(viewMatrix, renderList, matrix);\r\n }\r\n else {\r\n this._setDefaultShadowProjectionMatrix(matrix, viewMatrix, renderList);\r\n }\r\n return this;\r\n };\r\n __decorate([\r\n serializeAsVector3()\r\n ], ShadowLight.prototype, \"position\", null);\r\n __decorate([\r\n serializeAsVector3()\r\n ], ShadowLight.prototype, \"direction\", null);\r\n __decorate([\r\n serialize()\r\n ], ShadowLight.prototype, \"shadowMinZ\", null);\r\n __decorate([\r\n serialize()\r\n ], ShadowLight.prototype, \"shadowMaxZ\", null);\r\n return ShadowLight;\r\n}(Light));\r\nexport { ShadowLight };\r\n//# sourceMappingURL=shadowLight.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nNode.AddNodeConstructor(\"Light_Type_1\", function (name, scene) {\r\n return function () { return new DirectionalLight(name, Vector3.Zero(), scene); };\r\n});\r\n/**\r\n * A directional light is defined by a direction (what a surprise!).\r\n * The light is emitted from everywhere in the specified direction, and has an infinite range.\r\n * An example of a directional light is when a distance planet is lit by the apparently parallel lines of light from its sun. Light in a downward direction will light the top of an object.\r\n * Documentation: https://doc.babylonjs.com/babylon101/lights\r\n */\r\nvar DirectionalLight = /** @class */ (function (_super) {\r\n __extends(DirectionalLight, _super);\r\n /**\r\n * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).\r\n * The directional light is emitted from everywhere in the given direction.\r\n * It can cast shadows.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The friendly name of the light\r\n * @param direction The direction of the light\r\n * @param scene The scene the light belongs to\r\n */\r\n function DirectionalLight(name, direction, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._shadowFrustumSize = 0;\r\n _this._shadowOrthoScale = 0.1;\r\n /**\r\n * Automatically compute the projection matrix to best fit (including all the casters)\r\n * on each frame.\r\n */\r\n _this.autoUpdateExtends = true;\r\n /**\r\n * Automatically compute the shadowMinZ and shadowMaxZ for the projection matrix to best fit (including all the casters)\r\n * on each frame. autoUpdateExtends must be set to true for this to work\r\n */\r\n _this.autoCalcShadowZBounds = false;\r\n // Cache\r\n _this._orthoLeft = Number.MAX_VALUE;\r\n _this._orthoRight = Number.MIN_VALUE;\r\n _this._orthoTop = Number.MIN_VALUE;\r\n _this._orthoBottom = Number.MAX_VALUE;\r\n _this.position = direction.scale(-1.0);\r\n _this.direction = direction;\r\n return _this;\r\n }\r\n Object.defineProperty(DirectionalLight.prototype, \"shadowFrustumSize\", {\r\n /**\r\n * Fix frustum size for the shadow generation. This is disabled if the value is 0.\r\n */\r\n get: function () {\r\n return this._shadowFrustumSize;\r\n },\r\n /**\r\n * Specifies a fix frustum size for the shadow generation.\r\n */\r\n set: function (value) {\r\n this._shadowFrustumSize = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(DirectionalLight.prototype, \"shadowOrthoScale\", {\r\n /**\r\n * Gets the shadow projection scale against the optimal computed one.\r\n * 0.1 by default which means that the projection window is increase by 10% from the optimal size.\r\n * This does not impact in fixed frustum size (shadowFrustumSize being set)\r\n */\r\n get: function () {\r\n return this._shadowOrthoScale;\r\n },\r\n /**\r\n * Sets the shadow projection scale against the optimal computed one.\r\n * 0.1 by default which means that the projection window is increase by 10% from the optimal size.\r\n * This does not impact in fixed frustum size (shadowFrustumSize being set)\r\n */\r\n set: function (value) {\r\n this._shadowOrthoScale = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"DirectionalLight\".\r\n * @return The class name\r\n */\r\n DirectionalLight.prototype.getClassName = function () {\r\n return \"DirectionalLight\";\r\n };\r\n /**\r\n * Returns the integer 1.\r\n * @return The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n DirectionalLight.prototype.getTypeID = function () {\r\n return Light.LIGHTTYPEID_DIRECTIONALLIGHT;\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n */\r\n DirectionalLight.prototype._setDefaultShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n if (this.shadowFrustumSize > 0) {\r\n this._setDefaultFixedFrustumShadowProjectionMatrix(matrix);\r\n }\r\n else {\r\n this._setDefaultAutoExtendShadowProjectionMatrix(matrix, viewMatrix, renderList);\r\n }\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as fixed frustum projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n */\r\n DirectionalLight.prototype._setDefaultFixedFrustumShadowProjectionMatrix = function (matrix) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n Matrix.OrthoLHToRef(this.shadowFrustumSize, this.shadowFrustumSize, this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ, matrix);\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.\r\n * Returns the DirectionalLight Shadow projection matrix.\r\n */\r\n DirectionalLight.prototype._setDefaultAutoExtendShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n // Check extends\r\n if (this.autoUpdateExtends || this._orthoLeft === Number.MAX_VALUE) {\r\n var tempVector3 = Vector3.Zero();\r\n this._orthoLeft = Number.MAX_VALUE;\r\n this._orthoRight = Number.MIN_VALUE;\r\n this._orthoTop = Number.MIN_VALUE;\r\n this._orthoBottom = Number.MAX_VALUE;\r\n var shadowMinZ = Number.MAX_VALUE;\r\n var shadowMaxZ = Number.MIN_VALUE;\r\n for (var meshIndex = 0; meshIndex < renderList.length; meshIndex++) {\r\n var mesh = renderList[meshIndex];\r\n if (!mesh) {\r\n continue;\r\n }\r\n var boundingInfo = mesh.getBoundingInfo();\r\n var boundingBox = boundingInfo.boundingBox;\r\n for (var index = 0; index < boundingBox.vectorsWorld.length; index++) {\r\n Vector3.TransformCoordinatesToRef(boundingBox.vectorsWorld[index], viewMatrix, tempVector3);\r\n if (tempVector3.x < this._orthoLeft) {\r\n this._orthoLeft = tempVector3.x;\r\n }\r\n if (tempVector3.y < this._orthoBottom) {\r\n this._orthoBottom = tempVector3.y;\r\n }\r\n if (tempVector3.x > this._orthoRight) {\r\n this._orthoRight = tempVector3.x;\r\n }\r\n if (tempVector3.y > this._orthoTop) {\r\n this._orthoTop = tempVector3.y;\r\n }\r\n if (this.autoCalcShadowZBounds) {\r\n if (tempVector3.z < shadowMinZ) {\r\n shadowMinZ = tempVector3.z;\r\n }\r\n if (tempVector3.z > shadowMaxZ) {\r\n shadowMaxZ = tempVector3.z;\r\n }\r\n }\r\n }\r\n }\r\n if (this.autoCalcShadowZBounds) {\r\n this._shadowMinZ = shadowMinZ;\r\n this._shadowMaxZ = shadowMaxZ;\r\n }\r\n }\r\n var xOffset = this._orthoRight - this._orthoLeft;\r\n var yOffset = this._orthoTop - this._orthoBottom;\r\n Matrix.OrthoOffCenterLHToRef(this._orthoLeft - xOffset * this.shadowOrthoScale, this._orthoRight + xOffset * this.shadowOrthoScale, this._orthoBottom - yOffset * this.shadowOrthoScale, this._orthoTop + yOffset * this.shadowOrthoScale, this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ, matrix);\r\n };\r\n DirectionalLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n /**\r\n * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The directional light\r\n */\r\n DirectionalLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z, 1, lightIndex);\r\n return this;\r\n }\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.direction.x, this.direction.y, this.direction.z, 1, lightIndex);\r\n return this;\r\n };\r\n DirectionalLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n if (this.computeTransformedInformation()) {\r\n effect.setFloat3(lightDataUniformName, this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z);\r\n return this;\r\n }\r\n effect.setFloat3(lightDataUniformName, this.direction.x, this.direction.y, this.direction.z);\r\n return this;\r\n };\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n *\r\n * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being\r\n * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n DirectionalLight.prototype.getDepthMinZ = function (activeCamera) {\r\n return 1;\r\n };\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n *\r\n * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being\r\n * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n DirectionalLight.prototype.getDepthMaxZ = function (activeCamera) {\r\n return 1;\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n DirectionalLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"DIRLIGHT\" + lightIndex] = true;\r\n };\r\n __decorate([\r\n serialize()\r\n ], DirectionalLight.prototype, \"shadowFrustumSize\", null);\r\n __decorate([\r\n serialize()\r\n ], DirectionalLight.prototype, \"shadowOrthoScale\", null);\r\n __decorate([\r\n serialize()\r\n ], DirectionalLight.prototype, \"autoUpdateExtends\", void 0);\r\n __decorate([\r\n serialize()\r\n ], DirectionalLight.prototype, \"autoCalcShadowZBounds\", void 0);\r\n return DirectionalLight;\r\n}(ShadowLight));\r\nexport { DirectionalLight };\r\n//# sourceMappingURL=directionalLight.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nNode.AddNodeConstructor(\"Light_Type_0\", function (name, scene) {\r\n return function () { return new PointLight(name, Vector3.Zero(), scene); };\r\n});\r\n/**\r\n * A point light is a light defined by an unique point in world space.\r\n * The light is emitted in every direction from this point.\r\n * A good example of a point light is a standard light bulb.\r\n * Documentation: https://doc.babylonjs.com/babylon101/lights\r\n */\r\nvar PointLight = /** @class */ (function (_super) {\r\n __extends(PointLight, _super);\r\n /**\r\n * Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.\r\n * A PointLight emits the light in every direction.\r\n * It can cast shadows.\r\n * If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :\r\n * ```javascript\r\n * var pointLight = new PointLight(\"pl\", camera.position, scene);\r\n * ```\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The light friendly name\r\n * @param position The position of the point light in the scene\r\n * @param scene The scene the lights belongs to\r\n */\r\n function PointLight(name, position, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._shadowAngle = Math.PI / 2;\r\n _this.position = position;\r\n return _this;\r\n }\r\n Object.defineProperty(PointLight.prototype, \"shadowAngle\", {\r\n /**\r\n * Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n get: function () {\r\n return this._shadowAngle;\r\n },\r\n /**\r\n * Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n set: function (value) {\r\n this._shadowAngle = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PointLight.prototype, \"direction\", {\r\n /**\r\n * Gets the direction if it has been set.\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n get: function () {\r\n return this._direction;\r\n },\r\n /**\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n set: function (value) {\r\n var previousNeedCube = this.needCube();\r\n this._direction = value;\r\n if (this.needCube() !== previousNeedCube && this._shadowGenerator) {\r\n this._shadowGenerator.recreateShadowMap();\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the string \"PointLight\"\r\n * @returns the class name\r\n */\r\n PointLight.prototype.getClassName = function () {\r\n return \"PointLight\";\r\n };\r\n /**\r\n * Returns the integer 0.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n PointLight.prototype.getTypeID = function () {\r\n return Light.LIGHTTYPEID_POINTLIGHT;\r\n };\r\n /**\r\n * Specifies wether or not the shadowmap should be a cube texture.\r\n * @returns true if the shadowmap needs to be a cube texture.\r\n */\r\n PointLight.prototype.needCube = function () {\r\n return !this.direction;\r\n };\r\n /**\r\n * Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n PointLight.prototype.getShadowDirection = function (faceIndex) {\r\n if (this.direction) {\r\n return _super.prototype.getShadowDirection.call(this, faceIndex);\r\n }\r\n else {\r\n switch (faceIndex) {\r\n case 0:\r\n return new Vector3(1.0, 0.0, 0.0);\r\n case 1:\r\n return new Vector3(-1.0, 0.0, 0.0);\r\n case 2:\r\n return new Vector3(0.0, -1.0, 0.0);\r\n case 3:\r\n return new Vector3(0.0, 1.0, 0.0);\r\n case 4:\r\n return new Vector3(0.0, 0.0, 1.0);\r\n case 5:\r\n return new Vector3(0.0, 0.0, -1.0);\r\n }\r\n }\r\n return Vector3.Zero();\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as a left-handed perspective projection matrix with the following settings :\r\n * - fov = PI / 2\r\n * - aspect ratio : 1.0\r\n * - z-near and far equal to the active camera minZ and maxZ.\r\n * Returns the PointLight.\r\n */\r\n PointLight.prototype._setDefaultShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n Matrix.PerspectiveFovLHToRef(this.shadowAngle, 1.0, this.getDepthMinZ(activeCamera), this.getDepthMaxZ(activeCamera), matrix);\r\n };\r\n PointLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n /**\r\n * Sets the passed Effect \"effect\" with the PointLight transformed position (or position, if none) and passed name (string).\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The point light\r\n */\r\n PointLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0.0, lightIndex);\r\n }\r\n else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, 0, lightIndex);\r\n }\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, 0, 0, lightIndex);\r\n return this;\r\n };\r\n PointLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n if (this.computeTransformedInformation()) {\r\n effect.setFloat3(lightDataUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z);\r\n }\r\n else {\r\n effect.setFloat3(lightDataUniformName, this.position.x, this.position.y, this.position.z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n PointLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"POINTLIGHT\" + lightIndex] = true;\r\n };\r\n __decorate([\r\n serialize()\r\n ], PointLight.prototype, \"shadowAngle\", null);\r\n return PointLight;\r\n}(ShadowLight));\r\nexport { PointLight };\r\n//# sourceMappingURL=pointLight.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, serializeAsTexture } from \"../Misc/decorators\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nimport { Texture } from '../Materials/Textures/texture';\r\nNode.AddNodeConstructor(\"Light_Type_2\", function (name, scene) {\r\n return function () { return new SpotLight(name, Vector3.Zero(), Vector3.Zero(), 0, 0, scene); };\r\n});\r\n/**\r\n * A spot light is defined by a position, a direction, an angle, and an exponent.\r\n * These values define a cone of light starting from the position, emitting toward the direction.\r\n * The angle, in radians, defines the size (field of illumination) of the spotlight's conical beam,\r\n * and the exponent defines the speed of the decay of the light with distance (reach).\r\n * Documentation: https://doc.babylonjs.com/babylon101/lights\r\n */\r\nvar SpotLight = /** @class */ (function (_super) {\r\n __extends(SpotLight, _super);\r\n /**\r\n * Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.\r\n * It can cast shadows.\r\n * Documentation : https://doc.babylonjs.com/babylon101/lights\r\n * @param name The light friendly name\r\n * @param position The position of the spot light in the scene\r\n * @param direction The direction of the light in the scene\r\n * @param angle The cone angle of the light in Radians\r\n * @param exponent The light decay speed with the distance from the emission spot\r\n * @param scene The scene the lights belongs to\r\n */\r\n function SpotLight(name, position, direction, angle, exponent, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n _this._innerAngle = 0;\r\n _this._projectionTextureMatrix = Matrix.Zero();\r\n _this._projectionTextureLightNear = 1e-6;\r\n _this._projectionTextureLightFar = 1000.0;\r\n _this._projectionTextureUpDirection = Vector3.Up();\r\n _this._projectionTextureViewLightDirty = true;\r\n _this._projectionTextureProjectionLightDirty = true;\r\n _this._projectionTextureDirty = true;\r\n _this._projectionTextureViewTargetVector = Vector3.Zero();\r\n _this._projectionTextureViewLightMatrix = Matrix.Zero();\r\n _this._projectionTextureProjectionLightMatrix = Matrix.Zero();\r\n _this._projectionTextureScalingMatrix = Matrix.FromValues(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);\r\n _this.position = position;\r\n _this.direction = direction;\r\n _this.angle = angle;\r\n _this.exponent = exponent;\r\n return _this;\r\n }\r\n Object.defineProperty(SpotLight.prototype, \"angle\", {\r\n /**\r\n * Gets the cone angle of the spot light in Radians.\r\n */\r\n get: function () {\r\n return this._angle;\r\n },\r\n /**\r\n * Sets the cone angle of the spot light in Radians.\r\n */\r\n set: function (value) {\r\n this._angle = value;\r\n this._cosHalfAngle = Math.cos(value * 0.5);\r\n this._projectionTextureProjectionLightDirty = true;\r\n this.forceProjectionMatrixCompute();\r\n this._computeAngleValues();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"innerAngle\", {\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n get: function () {\r\n return this._innerAngle;\r\n },\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n set: function (value) {\r\n this._innerAngle = value;\r\n this._computeAngleValues();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"shadowAngleScale\", {\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n get: function () {\r\n return this._shadowAngleScale;\r\n },\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n set: function (value) {\r\n this._shadowAngleScale = value;\r\n this.forceProjectionMatrixCompute();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureMatrix\", {\r\n /**\r\n * Allows reading the projecton texture\r\n */\r\n get: function () {\r\n return this._projectionTextureMatrix;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureLightNear\", {\r\n /**\r\n * Gets the near clip of the Spotlight for texture projection.\r\n */\r\n get: function () {\r\n return this._projectionTextureLightNear;\r\n },\r\n /**\r\n * Sets the near clip of the Spotlight for texture projection.\r\n */\r\n set: function (value) {\r\n this._projectionTextureLightNear = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureLightFar\", {\r\n /**\r\n * Gets the far clip of the Spotlight for texture projection.\r\n */\r\n get: function () {\r\n return this._projectionTextureLightFar;\r\n },\r\n /**\r\n * Sets the far clip of the Spotlight for texture projection.\r\n */\r\n set: function (value) {\r\n this._projectionTextureLightFar = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTextureUpDirection\", {\r\n /**\r\n * Gets the Up vector of the Spotlight for texture projection.\r\n */\r\n get: function () {\r\n return this._projectionTextureUpDirection;\r\n },\r\n /**\r\n * Sets the Up vector of the Spotlight for texture projection.\r\n */\r\n set: function (value) {\r\n this._projectionTextureUpDirection = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(SpotLight.prototype, \"projectionTexture\", {\r\n /**\r\n * Gets the projection texture of the light.\r\n */\r\n get: function () {\r\n return this._projectionTexture;\r\n },\r\n /**\r\n * Sets the projection texture of the light.\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (this._projectionTexture === value) {\r\n return;\r\n }\r\n this._projectionTexture = value;\r\n this._projectionTextureDirty = true;\r\n if (this._projectionTexture && !this._projectionTexture.isReady()) {\r\n if (SpotLight._IsProceduralTexture(this._projectionTexture)) {\r\n this._projectionTexture.getEffect().executeWhenCompiled(function () {\r\n _this._markMeshesAsLightDirty();\r\n });\r\n }\r\n else if (SpotLight._IsTexture(this._projectionTexture)) {\r\n this._projectionTexture.onLoadObservable.addOnce(function () {\r\n _this._markMeshesAsLightDirty();\r\n });\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n SpotLight._IsProceduralTexture = function (texture) {\r\n return texture.onGeneratedObservable !== undefined;\r\n };\r\n SpotLight._IsTexture = function (texture) {\r\n return texture.onLoadObservable !== undefined;\r\n };\r\n /**\r\n * Returns the string \"SpotLight\".\r\n * @returns the class name\r\n */\r\n SpotLight.prototype.getClassName = function () {\r\n return \"SpotLight\";\r\n };\r\n /**\r\n * Returns the integer 2.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n SpotLight.prototype.getTypeID = function () {\r\n return Light.LIGHTTYPEID_SPOTLIGHT;\r\n };\r\n /**\r\n * Overrides the direction setter to recompute the projection texture view light Matrix.\r\n */\r\n SpotLight.prototype._setDirection = function (value) {\r\n _super.prototype._setDirection.call(this, value);\r\n this._projectionTextureViewLightDirty = true;\r\n };\r\n /**\r\n * Overrides the position setter to recompute the projection texture view light Matrix.\r\n */\r\n SpotLight.prototype._setPosition = function (value) {\r\n _super.prototype._setPosition.call(this, value);\r\n this._projectionTextureViewLightDirty = true;\r\n };\r\n /**\r\n * Sets the passed matrix \"matrix\" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.\r\n * Returns the SpotLight.\r\n */\r\n SpotLight.prototype._setDefaultShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {\r\n var activeCamera = this.getScene().activeCamera;\r\n if (!activeCamera) {\r\n return;\r\n }\r\n this._shadowAngleScale = this._shadowAngleScale || 1;\r\n var angle = this._shadowAngleScale * this._angle;\r\n Matrix.PerspectiveFovLHToRef(angle, 1.0, this.getDepthMinZ(activeCamera), this.getDepthMaxZ(activeCamera), matrix);\r\n };\r\n SpotLight.prototype._computeProjectionTextureViewLightMatrix = function () {\r\n this._projectionTextureViewLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n this.position.addToRef(this.direction, this._projectionTextureViewTargetVector);\r\n Matrix.LookAtLHToRef(this.position, this._projectionTextureViewTargetVector, this._projectionTextureUpDirection, this._projectionTextureViewLightMatrix);\r\n };\r\n SpotLight.prototype._computeProjectionTextureProjectionLightMatrix = function () {\r\n this._projectionTextureProjectionLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n var light_far = this.projectionTextureLightFar;\r\n var light_near = this.projectionTextureLightNear;\r\n var P = light_far / (light_far - light_near);\r\n var Q = -P * light_near;\r\n var S = 1.0 / Math.tan(this._angle / 2.0);\r\n var A = 1.0;\r\n Matrix.FromValuesToRef(S / A, 0.0, 0.0, 0.0, 0.0, S, 0.0, 0.0, 0.0, 0.0, P, 1.0, 0.0, 0.0, Q, 0.0, this._projectionTextureProjectionLightMatrix);\r\n };\r\n /**\r\n * Main function for light texture projection matrix computing.\r\n */\r\n SpotLight.prototype._computeProjectionTextureMatrix = function () {\r\n this._projectionTextureDirty = false;\r\n this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix, this._projectionTextureMatrix);\r\n if (this._projectionTexture instanceof Texture) {\r\n var u = this._projectionTexture.uScale / 2.0;\r\n var v = this._projectionTexture.vScale / 2.0;\r\n Matrix.FromValuesToRef(u, 0.0, 0.0, 0.0, 0.0, v, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0, this._projectionTextureScalingMatrix);\r\n }\r\n this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix, this._projectionTextureMatrix);\r\n };\r\n SpotLight.prototype._buildUniformLayout = function () {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDirection\", 3);\r\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n };\r\n SpotLight.prototype._computeAngleValues = function () {\r\n this._lightAngleScale = 1.0 / Math.max(0.001, (Math.cos(this._innerAngle * 0.5) - this._cosHalfAngle));\r\n this._lightAngleOffset = -this._cosHalfAngle * this._lightAngleScale;\r\n };\r\n /**\r\n * Sets the passed Effect \"effect\" with the Light textures.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The light\r\n */\r\n SpotLight.prototype.transferTexturesToEffect = function (effect, lightIndex) {\r\n if (this.projectionTexture && this.projectionTexture.isReady()) {\r\n if (this._projectionTextureViewLightDirty) {\r\n this._computeProjectionTextureViewLightMatrix();\r\n }\r\n if (this._projectionTextureProjectionLightDirty) {\r\n this._computeProjectionTextureProjectionLightMatrix();\r\n }\r\n if (this._projectionTextureDirty) {\r\n this._computeProjectionTextureMatrix();\r\n }\r\n effect.setMatrix(\"textureProjectionMatrix\" + lightIndex, this._projectionTextureMatrix);\r\n effect.setTexture(\"projectionLightSampler\" + lightIndex, this.projectionTexture);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets the passed Effect object with the SpotLight transfomed position (or position if not parented) and normalized direction.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The spot light\r\n */\r\n SpotLight.prototype.transferToEffect = function (effect, lightIndex) {\r\n var normalizeDirection;\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, this.exponent, lightIndex);\r\n normalizeDirection = Vector3.Normalize(this.transformedDirection);\r\n }\r\n else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, this.exponent, lightIndex);\r\n normalizeDirection = Vector3.Normalize(this.direction);\r\n }\r\n this._uniformBuffer.updateFloat4(\"vLightDirection\", normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, this._cosHalfAngle, lightIndex);\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, this._lightAngleScale, this._lightAngleOffset, lightIndex);\r\n return this;\r\n };\r\n SpotLight.prototype.transferToNodeMaterialEffect = function (effect, lightDataUniformName) {\r\n var normalizeDirection;\r\n if (this.computeTransformedInformation()) {\r\n normalizeDirection = Vector3.Normalize(this.transformedDirection);\r\n }\r\n else {\r\n normalizeDirection = Vector3.Normalize(this.direction);\r\n }\r\n if (this.getScene().useRightHandedSystem) {\r\n effect.setFloat3(lightDataUniformName, -normalizeDirection.x, -normalizeDirection.y, -normalizeDirection.z);\r\n }\r\n else {\r\n effect.setFloat3(lightDataUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Disposes the light and the associated resources.\r\n */\r\n SpotLight.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n if (this._projectionTexture) {\r\n this._projectionTexture.dispose();\r\n }\r\n };\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n SpotLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {\r\n defines[\"SPOTLIGHT\" + lightIndex] = true;\r\n defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex] = this.projectionTexture && this.projectionTexture.isReady() ? true : false;\r\n };\r\n __decorate([\r\n serialize()\r\n ], SpotLight.prototype, \"angle\", null);\r\n __decorate([\r\n serialize()\r\n ], SpotLight.prototype, \"innerAngle\", null);\r\n __decorate([\r\n serialize()\r\n ], SpotLight.prototype, \"shadowAngleScale\", null);\r\n __decorate([\r\n serialize()\r\n ], SpotLight.prototype, \"exponent\", void 0);\r\n __decorate([\r\n serialize()\r\n ], SpotLight.prototype, \"projectionTextureLightNear\", null);\r\n __decorate([\r\n serialize()\r\n ], SpotLight.prototype, \"projectionTextureLightFar\", null);\r\n __decorate([\r\n serialize()\r\n ], SpotLight.prototype, \"projectionTextureUpDirection\", null);\r\n __decorate([\r\n serializeAsTexture(\"projectedLightTexture\")\r\n ], SpotLight.prototype, \"_projectionTexture\", void 0);\r\n return SpotLight;\r\n}(ShadowLight));\r\nexport { SpotLight };\r\n//# sourceMappingURL=spotLight.js.map","import { EParameterType, ETextureFilterType, ECullingType, EBlendingFunction, EShaderType } from \"./glTFLoaderInterfaces\";\r\nimport { Quaternion, Vector3, Matrix } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Camera } from \"@babylonjs/core/Cameras/camera\";\r\nimport { FreeCamera } from \"@babylonjs/core/Cameras/freeCamera\";\r\nimport { Animation } from \"@babylonjs/core/Animations/animation\";\r\nimport { Bone } from \"@babylonjs/core/Bones/bone\";\r\nimport { Skeleton } from \"@babylonjs/core/Bones/skeleton\";\r\nimport { Effect } from \"@babylonjs/core/Materials/effect\";\r\nimport { Material } from \"@babylonjs/core/Materials/material\";\r\nimport { MultiMaterial } from \"@babylonjs/core/Materials/multiMaterial\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { ShaderMaterial } from \"@babylonjs/core/Materials/shaderMaterial\";\r\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\r\nimport { VertexData } from \"@babylonjs/core/Meshes/mesh.vertexData\";\r\nimport { VertexBuffer } from \"@babylonjs/core/Meshes/buffer\";\r\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry\";\r\nimport { SubMesh } from \"@babylonjs/core/Meshes/subMesh\";\r\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { HemisphericLight } from \"@babylonjs/core/Lights/hemisphericLight\";\r\nimport { DirectionalLight } from \"@babylonjs/core/Lights/directionalLight\";\r\nimport { PointLight } from \"@babylonjs/core/Lights/pointLight\";\r\nimport { SpotLight } from \"@babylonjs/core/Lights/spotLight\";\r\nimport { GLTFUtils } from \"./glTFLoaderUtils\";\r\nimport { GLTFFileLoader } from \"../glTFFileLoader\";\r\nimport { Constants } from '@babylonjs/core/Engines/constants';\r\n/**\r\n* Tokenizer. Used for shaders compatibility\r\n* Automatically map world, view, projection, worldViewProjection, attributes and so on\r\n*/\r\nvar ETokenType;\r\n(function (ETokenType) {\r\n ETokenType[ETokenType[\"IDENTIFIER\"] = 1] = \"IDENTIFIER\";\r\n ETokenType[ETokenType[\"UNKNOWN\"] = 2] = \"UNKNOWN\";\r\n ETokenType[ETokenType[\"END_OF_INPUT\"] = 3] = \"END_OF_INPUT\";\r\n})(ETokenType || (ETokenType = {}));\r\nvar Tokenizer = /** @class */ (function () {\r\n function Tokenizer(toParse) {\r\n this._pos = 0;\r\n this.currentToken = ETokenType.UNKNOWN;\r\n this.currentIdentifier = \"\";\r\n this.currentString = \"\";\r\n this.isLetterOrDigitPattern = /^[a-zA-Z0-9]+$/;\r\n this._toParse = toParse;\r\n this._maxPos = toParse.length;\r\n }\r\n Tokenizer.prototype.getNextToken = function () {\r\n if (this.isEnd()) {\r\n return ETokenType.END_OF_INPUT;\r\n }\r\n this.currentString = this.read();\r\n this.currentToken = ETokenType.UNKNOWN;\r\n if (this.currentString === \"_\" || this.isLetterOrDigitPattern.test(this.currentString)) {\r\n this.currentToken = ETokenType.IDENTIFIER;\r\n this.currentIdentifier = this.currentString;\r\n while (!this.isEnd() && (this.isLetterOrDigitPattern.test(this.currentString = this.peek()) || this.currentString === \"_\")) {\r\n this.currentIdentifier += this.currentString;\r\n this.forward();\r\n }\r\n }\r\n return this.currentToken;\r\n };\r\n Tokenizer.prototype.peek = function () {\r\n return this._toParse[this._pos];\r\n };\r\n Tokenizer.prototype.read = function () {\r\n return this._toParse[this._pos++];\r\n };\r\n Tokenizer.prototype.forward = function () {\r\n this._pos++;\r\n };\r\n Tokenizer.prototype.isEnd = function () {\r\n return this._pos >= this._maxPos;\r\n };\r\n return Tokenizer;\r\n}());\r\n/**\r\n* Values\r\n*/\r\nvar glTFTransforms = [\"MODEL\", \"VIEW\", \"PROJECTION\", \"MODELVIEW\", \"MODELVIEWPROJECTION\", \"JOINTMATRIX\"];\r\nvar babylonTransforms = [\"world\", \"view\", \"projection\", \"worldView\", \"worldViewProjection\", \"mBones\"];\r\nvar glTFAnimationPaths = [\"translation\", \"rotation\", \"scale\"];\r\nvar babylonAnimationPaths = [\"position\", \"rotationQuaternion\", \"scaling\"];\r\n/**\r\n* Parse\r\n*/\r\nvar parseBuffers = function (parsedBuffers, gltfRuntime) {\r\n for (var buf in parsedBuffers) {\r\n var parsedBuffer = parsedBuffers[buf];\r\n gltfRuntime.buffers[buf] = parsedBuffer;\r\n gltfRuntime.buffersCount++;\r\n }\r\n};\r\nvar parseShaders = function (parsedShaders, gltfRuntime) {\r\n for (var sha in parsedShaders) {\r\n var parsedShader = parsedShaders[sha];\r\n gltfRuntime.shaders[sha] = parsedShader;\r\n gltfRuntime.shaderscount++;\r\n }\r\n};\r\nvar parseObject = function (parsedObjects, runtimeProperty, gltfRuntime) {\r\n for (var object in parsedObjects) {\r\n var parsedObject = parsedObjects[object];\r\n gltfRuntime[runtimeProperty][object] = parsedObject;\r\n }\r\n};\r\n/**\r\n* Utils\r\n*/\r\nvar normalizeUVs = function (buffer) {\r\n if (!buffer) {\r\n return;\r\n }\r\n for (var i = 0; i < buffer.length / 2; i++) {\r\n buffer[i * 2 + 1] = 1.0 - buffer[i * 2 + 1];\r\n }\r\n};\r\nvar getAttribute = function (attributeParameter) {\r\n if (attributeParameter.semantic === \"NORMAL\") {\r\n return \"normal\";\r\n }\r\n else if (attributeParameter.semantic === \"POSITION\") {\r\n return \"position\";\r\n }\r\n else if (attributeParameter.semantic === \"JOINT\") {\r\n return \"matricesIndices\";\r\n }\r\n else if (attributeParameter.semantic === \"WEIGHT\") {\r\n return \"matricesWeights\";\r\n }\r\n else if (attributeParameter.semantic === \"COLOR\") {\r\n return \"color\";\r\n }\r\n else if (attributeParameter.semantic && attributeParameter.semantic.indexOf(\"TEXCOORD_\") !== -1) {\r\n var channel = Number(attributeParameter.semantic.split(\"_\")[1]);\r\n return \"uv\" + (channel === 0 ? \"\" : channel + 1);\r\n }\r\n return null;\r\n};\r\n/**\r\n* Loads and creates animations\r\n*/\r\nvar loadAnimations = function (gltfRuntime) {\r\n for (var anim in gltfRuntime.animations) {\r\n var animation = gltfRuntime.animations[anim];\r\n if (!animation.channels || !animation.samplers) {\r\n continue;\r\n }\r\n var lastAnimation = null;\r\n for (var i = 0; i < animation.channels.length; i++) {\r\n // Get parameters and load buffers\r\n var channel = animation.channels[i];\r\n var sampler = animation.samplers[channel.sampler];\r\n if (!sampler) {\r\n continue;\r\n }\r\n var inputData = null;\r\n var outputData = null;\r\n if (animation.parameters) {\r\n inputData = animation.parameters[sampler.input];\r\n outputData = animation.parameters[sampler.output];\r\n }\r\n else {\r\n inputData = sampler.input;\r\n outputData = sampler.output;\r\n }\r\n var bufferInput = GLTFUtils.GetBufferFromAccessor(gltfRuntime, gltfRuntime.accessors[inputData]);\r\n var bufferOutput = GLTFUtils.GetBufferFromAccessor(gltfRuntime, gltfRuntime.accessors[outputData]);\r\n var targetID = channel.target.id;\r\n var targetNode = gltfRuntime.scene.getNodeByID(targetID);\r\n if (targetNode === null) {\r\n targetNode = gltfRuntime.scene.getNodeByName(targetID);\r\n }\r\n if (targetNode === null) {\r\n Tools.Warn(\"Creating animation named \" + anim + \". But cannot find node named \" + targetID + \" to attach to\");\r\n continue;\r\n }\r\n var isBone = targetNode instanceof Bone;\r\n // Get target path (position, rotation or scaling)\r\n var targetPath = channel.target.path;\r\n var targetPathIndex = glTFAnimationPaths.indexOf(targetPath);\r\n if (targetPathIndex !== -1) {\r\n targetPath = babylonAnimationPaths[targetPathIndex];\r\n }\r\n // Determine animation type\r\n var animationType = Animation.ANIMATIONTYPE_MATRIX;\r\n if (!isBone) {\r\n if (targetPath === \"rotationQuaternion\") {\r\n animationType = Animation.ANIMATIONTYPE_QUATERNION;\r\n targetNode.rotationQuaternion = new Quaternion();\r\n }\r\n else {\r\n animationType = Animation.ANIMATIONTYPE_VECTOR3;\r\n }\r\n }\r\n // Create animation and key frames\r\n var babylonAnimation = null;\r\n var keys = [];\r\n var arrayOffset = 0;\r\n var modifyKey = false;\r\n if (isBone && lastAnimation && lastAnimation.getKeys().length === bufferInput.length) {\r\n babylonAnimation = lastAnimation;\r\n modifyKey = true;\r\n }\r\n if (!modifyKey) {\r\n gltfRuntime.scene._blockEntityCollection = gltfRuntime.forAssetContainer;\r\n babylonAnimation = new Animation(anim, isBone ? \"_matrix\" : targetPath, 1, animationType, Animation.ANIMATIONLOOPMODE_CYCLE);\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n }\r\n // For each frame\r\n for (var j = 0; j < bufferInput.length; j++) {\r\n var value = null;\r\n if (targetPath === \"rotationQuaternion\") { // VEC4\r\n value = Quaternion.FromArray([bufferOutput[arrayOffset], bufferOutput[arrayOffset + 1], bufferOutput[arrayOffset + 2], bufferOutput[arrayOffset + 3]]);\r\n arrayOffset += 4;\r\n }\r\n else { // Position and scaling are VEC3\r\n value = Vector3.FromArray([bufferOutput[arrayOffset], bufferOutput[arrayOffset + 1], bufferOutput[arrayOffset + 2]]);\r\n arrayOffset += 3;\r\n }\r\n if (isBone) {\r\n var bone = targetNode;\r\n var translation = Vector3.Zero();\r\n var rotationQuaternion = new Quaternion();\r\n var scaling = Vector3.Zero();\r\n // Warning on decompose\r\n var mat = bone.getBaseMatrix();\r\n if (modifyKey && lastAnimation) {\r\n mat = lastAnimation.getKeys()[j].value;\r\n }\r\n mat.decompose(scaling, rotationQuaternion, translation);\r\n if (targetPath === \"position\") {\r\n translation = value;\r\n }\r\n else if (targetPath === \"rotationQuaternion\") {\r\n rotationQuaternion = value;\r\n }\r\n else {\r\n scaling = value;\r\n }\r\n value = Matrix.Compose(scaling, rotationQuaternion, translation);\r\n }\r\n if (!modifyKey) {\r\n keys.push({\r\n frame: bufferInput[j],\r\n value: value\r\n });\r\n }\r\n else if (lastAnimation) {\r\n lastAnimation.getKeys()[j].value = value;\r\n }\r\n }\r\n // Finish\r\n if (!modifyKey && babylonAnimation) {\r\n babylonAnimation.setKeys(keys);\r\n targetNode.animations.push(babylonAnimation);\r\n }\r\n lastAnimation = babylonAnimation;\r\n gltfRuntime.scene.stopAnimation(targetNode);\r\n gltfRuntime.scene.beginAnimation(targetNode, 0, bufferInput[bufferInput.length - 1], true, 1.0);\r\n }\r\n }\r\n};\r\n/**\r\n* Returns the bones transformation matrix\r\n*/\r\nvar configureBoneTransformation = function (node) {\r\n var mat = null;\r\n if (node.translation || node.rotation || node.scale) {\r\n var scale = Vector3.FromArray(node.scale || [1, 1, 1]);\r\n var rotation = Quaternion.FromArray(node.rotation || [0, 0, 0, 1]);\r\n var position = Vector3.FromArray(node.translation || [0, 0, 0]);\r\n mat = Matrix.Compose(scale, rotation, position);\r\n }\r\n else {\r\n mat = Matrix.FromArray(node.matrix);\r\n }\r\n return mat;\r\n};\r\n/**\r\n* Returns the parent bone\r\n*/\r\nvar getParentBone = function (gltfRuntime, skins, jointName, newSkeleton) {\r\n // Try to find\r\n for (var i = 0; i < newSkeleton.bones.length; i++) {\r\n if (newSkeleton.bones[i].name === jointName) {\r\n return newSkeleton.bones[i];\r\n }\r\n }\r\n // Not found, search in gltf nodes\r\n var nodes = gltfRuntime.nodes;\r\n for (var nde in nodes) {\r\n var node = nodes[nde];\r\n if (!node.jointName) {\r\n continue;\r\n }\r\n var children = node.children;\r\n for (var i = 0; i < children.length; i++) {\r\n var child = gltfRuntime.nodes[children[i]];\r\n if (!child.jointName) {\r\n continue;\r\n }\r\n if (child.jointName === jointName) {\r\n var mat = configureBoneTransformation(node);\r\n var bone = new Bone(node.name || \"\", newSkeleton, getParentBone(gltfRuntime, skins, node.jointName, newSkeleton), mat);\r\n bone.id = nde;\r\n return bone;\r\n }\r\n }\r\n }\r\n return null;\r\n};\r\n/**\r\n* Returns the appropriate root node\r\n*/\r\nvar getNodeToRoot = function (nodesToRoot, id) {\r\n for (var i = 0; i < nodesToRoot.length; i++) {\r\n var nodeToRoot = nodesToRoot[i];\r\n for (var j = 0; j < nodeToRoot.node.children.length; j++) {\r\n var child = nodeToRoot.node.children[j];\r\n if (child === id) {\r\n return nodeToRoot.bone;\r\n }\r\n }\r\n }\r\n return null;\r\n};\r\n/**\r\n* Returns the node with the joint name\r\n*/\r\nvar getJointNode = function (gltfRuntime, jointName) {\r\n var nodes = gltfRuntime.nodes;\r\n var node = nodes[jointName];\r\n if (node) {\r\n return {\r\n node: node,\r\n id: jointName\r\n };\r\n }\r\n for (var nde in nodes) {\r\n node = nodes[nde];\r\n if (node.jointName === jointName) {\r\n return {\r\n node: node,\r\n id: nde\r\n };\r\n }\r\n }\r\n return null;\r\n};\r\n/**\r\n* Checks if a nodes is in joints\r\n*/\r\nvar nodeIsInJoints = function (skins, id) {\r\n for (var i = 0; i < skins.jointNames.length; i++) {\r\n if (skins.jointNames[i] === id) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\r\n/**\r\n* Fills the nodes to root for bones and builds hierarchy\r\n*/\r\nvar getNodesToRoot = function (gltfRuntime, newSkeleton, skins, nodesToRoot) {\r\n // Creates nodes for root\r\n for (var nde in gltfRuntime.nodes) {\r\n var node = gltfRuntime.nodes[nde];\r\n var id = nde;\r\n if (!node.jointName || nodeIsInJoints(skins, node.jointName)) {\r\n continue;\r\n }\r\n // Create node to root bone\r\n var mat = configureBoneTransformation(node);\r\n var bone = new Bone(node.name || \"\", newSkeleton, null, mat);\r\n bone.id = id;\r\n nodesToRoot.push({ bone: bone, node: node, id: id });\r\n }\r\n // Parenting\r\n for (var i = 0; i < nodesToRoot.length; i++) {\r\n var nodeToRoot = nodesToRoot[i];\r\n var children = nodeToRoot.node.children;\r\n for (var j = 0; j < children.length; j++) {\r\n var child = null;\r\n for (var k = 0; k < nodesToRoot.length; k++) {\r\n if (nodesToRoot[k].id === children[j]) {\r\n child = nodesToRoot[k];\r\n break;\r\n }\r\n }\r\n if (child) {\r\n child.bone._parent = nodeToRoot.bone;\r\n nodeToRoot.bone.children.push(child.bone);\r\n }\r\n }\r\n }\r\n};\r\n/**\r\n* Imports a skeleton\r\n*/\r\nvar importSkeleton = function (gltfRuntime, skins, mesh, newSkeleton, id) {\r\n if (!newSkeleton) {\r\n newSkeleton = new Skeleton(skins.name || \"\", \"\", gltfRuntime.scene);\r\n }\r\n if (!skins.babylonSkeleton) {\r\n return newSkeleton;\r\n }\r\n // Find the root bones\r\n var nodesToRoot = [];\r\n var nodesToRootToAdd = [];\r\n getNodesToRoot(gltfRuntime, newSkeleton, skins, nodesToRoot);\r\n newSkeleton.bones = [];\r\n // Joints\r\n for (var i = 0; i < skins.jointNames.length; i++) {\r\n var jointNode = getJointNode(gltfRuntime, skins.jointNames[i]);\r\n if (!jointNode) {\r\n continue;\r\n }\r\n var node = jointNode.node;\r\n if (!node) {\r\n Tools.Warn(\"Joint named \" + skins.jointNames[i] + \" does not exist\");\r\n continue;\r\n }\r\n var id = jointNode.id;\r\n // Optimize, if the bone already exists...\r\n var existingBone = gltfRuntime.scene.getBoneByID(id);\r\n if (existingBone) {\r\n newSkeleton.bones.push(existingBone);\r\n continue;\r\n }\r\n // Search for parent bone\r\n var foundBone = false;\r\n var parentBone = null;\r\n for (var j = 0; j < i; j++) {\r\n var jointNode_1 = getJointNode(gltfRuntime, skins.jointNames[j]);\r\n if (!jointNode_1) {\r\n continue;\r\n }\r\n var joint = jointNode_1.node;\r\n if (!joint) {\r\n Tools.Warn(\"Joint named \" + skins.jointNames[j] + \" does not exist when looking for parent\");\r\n continue;\r\n }\r\n var children = joint.children;\r\n if (!children) {\r\n continue;\r\n }\r\n foundBone = false;\r\n for (var k = 0; k < children.length; k++) {\r\n if (children[k] === id) {\r\n parentBone = getParentBone(gltfRuntime, skins, skins.jointNames[j], newSkeleton);\r\n foundBone = true;\r\n break;\r\n }\r\n }\r\n if (foundBone) {\r\n break;\r\n }\r\n }\r\n // Create bone\r\n var mat = configureBoneTransformation(node);\r\n if (!parentBone && nodesToRoot.length > 0) {\r\n parentBone = getNodeToRoot(nodesToRoot, id);\r\n if (parentBone) {\r\n if (nodesToRootToAdd.indexOf(parentBone) === -1) {\r\n nodesToRootToAdd.push(parentBone);\r\n }\r\n }\r\n }\r\n var bone = new Bone(node.jointName || \"\", newSkeleton, parentBone, mat);\r\n bone.id = id;\r\n }\r\n // Polish\r\n var bones = newSkeleton.bones;\r\n newSkeleton.bones = [];\r\n for (var i = 0; i < skins.jointNames.length; i++) {\r\n var jointNode = getJointNode(gltfRuntime, skins.jointNames[i]);\r\n if (!jointNode) {\r\n continue;\r\n }\r\n for (var j = 0; j < bones.length; j++) {\r\n if (bones[j].id === jointNode.id) {\r\n newSkeleton.bones.push(bones[j]);\r\n break;\r\n }\r\n }\r\n }\r\n newSkeleton.prepare();\r\n // Finish\r\n for (var i = 0; i < nodesToRootToAdd.length; i++) {\r\n newSkeleton.bones.push(nodesToRootToAdd[i]);\r\n }\r\n return newSkeleton;\r\n};\r\n/**\r\n* Imports a mesh and its geometries\r\n*/\r\nvar importMesh = function (gltfRuntime, node, meshes, id, newMesh) {\r\n if (!newMesh) {\r\n gltfRuntime.scene._blockEntityCollection = gltfRuntime.forAssetContainer;\r\n newMesh = new Mesh(node.name || \"\", gltfRuntime.scene);\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n newMesh.id = id;\r\n }\r\n if (!node.babylonNode) {\r\n return newMesh;\r\n }\r\n var subMaterials = [];\r\n var vertexData = null;\r\n var verticesStarts = new Array();\r\n var verticesCounts = new Array();\r\n var indexStarts = new Array();\r\n var indexCounts = new Array();\r\n for (var meshIndex = 0; meshIndex < meshes.length; meshIndex++) {\r\n var meshID = meshes[meshIndex];\r\n var mesh = gltfRuntime.meshes[meshID];\r\n if (!mesh) {\r\n continue;\r\n }\r\n // Positions, normals and UVs\r\n for (var i = 0; i < mesh.primitives.length; i++) {\r\n // Temporary vertex data\r\n var tempVertexData = new VertexData();\r\n var primitive = mesh.primitives[i];\r\n if (primitive.mode !== 4) {\r\n // continue;\r\n }\r\n var attributes = primitive.attributes;\r\n var accessor = null;\r\n var buffer = null;\r\n // Set positions, normal and uvs\r\n for (var semantic in attributes) {\r\n // Link accessor and buffer view\r\n accessor = gltfRuntime.accessors[attributes[semantic]];\r\n buffer = GLTFUtils.GetBufferFromAccessor(gltfRuntime, accessor);\r\n if (semantic === \"NORMAL\") {\r\n tempVertexData.normals = new Float32Array(buffer.length);\r\n tempVertexData.normals.set(buffer);\r\n }\r\n else if (semantic === \"POSITION\") {\r\n if (GLTFFileLoader.HomogeneousCoordinates) {\r\n tempVertexData.positions = new Float32Array(buffer.length - buffer.length / 4);\r\n for (var j = 0; j < buffer.length; j += 4) {\r\n tempVertexData.positions[j] = buffer[j];\r\n tempVertexData.positions[j + 1] = buffer[j + 1];\r\n tempVertexData.positions[j + 2] = buffer[j + 2];\r\n }\r\n }\r\n else {\r\n tempVertexData.positions = new Float32Array(buffer.length);\r\n tempVertexData.positions.set(buffer);\r\n }\r\n verticesCounts.push(tempVertexData.positions.length);\r\n }\r\n else if (semantic.indexOf(\"TEXCOORD_\") !== -1) {\r\n var channel = Number(semantic.split(\"_\")[1]);\r\n var uvKind = VertexBuffer.UVKind + (channel === 0 ? \"\" : (channel + 1));\r\n var uvs = new Float32Array(buffer.length);\r\n uvs.set(buffer);\r\n normalizeUVs(uvs);\r\n tempVertexData.set(uvs, uvKind);\r\n }\r\n else if (semantic === \"JOINT\") {\r\n tempVertexData.matricesIndices = new Float32Array(buffer.length);\r\n tempVertexData.matricesIndices.set(buffer);\r\n }\r\n else if (semantic === \"WEIGHT\") {\r\n tempVertexData.matricesWeights = new Float32Array(buffer.length);\r\n tempVertexData.matricesWeights.set(buffer);\r\n }\r\n else if (semantic === \"COLOR\") {\r\n tempVertexData.colors = new Float32Array(buffer.length);\r\n tempVertexData.colors.set(buffer);\r\n }\r\n }\r\n // Indices\r\n accessor = gltfRuntime.accessors[primitive.indices];\r\n if (accessor) {\r\n buffer = GLTFUtils.GetBufferFromAccessor(gltfRuntime, accessor);\r\n tempVertexData.indices = new Int32Array(buffer.length);\r\n tempVertexData.indices.set(buffer);\r\n indexCounts.push(tempVertexData.indices.length);\r\n }\r\n else {\r\n // Set indices on the fly\r\n var indices = [];\r\n for (var j = 0; j < tempVertexData.positions.length / 3; j++) {\r\n indices.push(j);\r\n }\r\n tempVertexData.indices = new Int32Array(indices);\r\n indexCounts.push(tempVertexData.indices.length);\r\n }\r\n if (!vertexData) {\r\n vertexData = tempVertexData;\r\n }\r\n else {\r\n vertexData.merge(tempVertexData);\r\n }\r\n // Sub material\r\n var material_1 = gltfRuntime.scene.getMaterialByID(primitive.material);\r\n subMaterials.push(material_1 === null ? GLTFUtils.GetDefaultMaterial(gltfRuntime.scene) : material_1);\r\n // Update vertices start and index start\r\n verticesStarts.push(verticesStarts.length === 0 ? 0 : verticesStarts[verticesStarts.length - 1] + verticesCounts[verticesCounts.length - 2]);\r\n indexStarts.push(indexStarts.length === 0 ? 0 : indexStarts[indexStarts.length - 1] + indexCounts[indexCounts.length - 2]);\r\n }\r\n }\r\n var material;\r\n gltfRuntime.scene._blockEntityCollection = gltfRuntime.forAssetContainer;\r\n if (subMaterials.length > 1) {\r\n material = new MultiMaterial(\"multimat\" + id, gltfRuntime.scene);\r\n material.subMaterials = subMaterials;\r\n }\r\n else {\r\n material = new StandardMaterial(\"multimat\" + id, gltfRuntime.scene);\r\n }\r\n if (subMaterials.length === 1) {\r\n material = subMaterials[0];\r\n }\r\n if (!newMesh.material) {\r\n newMesh.material = material;\r\n }\r\n // Apply geometry\r\n new Geometry(id, gltfRuntime.scene, vertexData, false, newMesh);\r\n newMesh.computeWorldMatrix(true);\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n // Apply submeshes\r\n newMesh.subMeshes = [];\r\n var index = 0;\r\n for (var meshIndex = 0; meshIndex < meshes.length; meshIndex++) {\r\n var meshID = meshes[meshIndex];\r\n var mesh = gltfRuntime.meshes[meshID];\r\n if (!mesh) {\r\n continue;\r\n }\r\n for (var i = 0; i < mesh.primitives.length; i++) {\r\n if (mesh.primitives[i].mode !== 4) {\r\n //continue;\r\n }\r\n SubMesh.AddToMesh(index, verticesStarts[index], verticesCounts[index], indexStarts[index], indexCounts[index], newMesh, newMesh, true);\r\n index++;\r\n }\r\n }\r\n // Finish\r\n return newMesh;\r\n};\r\n/**\r\n* Configure node transformation from position, rotation and scaling\r\n*/\r\nvar configureNode = function (newNode, position, rotation, scaling) {\r\n if (newNode.position) {\r\n newNode.position = position;\r\n }\r\n if (newNode.rotationQuaternion || newNode.rotation) {\r\n newNode.rotationQuaternion = rotation;\r\n }\r\n if (newNode.scaling) {\r\n newNode.scaling = scaling;\r\n }\r\n};\r\n/**\r\n* Configures node from transformation matrix\r\n*/\r\nvar configureNodeFromMatrix = function (newNode, node, parent) {\r\n if (node.matrix) {\r\n var position = new Vector3(0, 0, 0);\r\n var rotation = new Quaternion();\r\n var scaling = new Vector3(0, 0, 0);\r\n var mat = Matrix.FromArray(node.matrix);\r\n mat.decompose(scaling, rotation, position);\r\n configureNode(newNode, position, rotation, scaling);\r\n }\r\n else if (node.translation && node.rotation && node.scale) {\r\n configureNode(newNode, Vector3.FromArray(node.translation), Quaternion.FromArray(node.rotation), Vector3.FromArray(node.scale));\r\n }\r\n newNode.computeWorldMatrix(true);\r\n};\r\n/**\r\n* Imports a node\r\n*/\r\nvar importNode = function (gltfRuntime, node, id, parent) {\r\n var lastNode = null;\r\n if (gltfRuntime.importOnlyMeshes && (node.skin || node.meshes)) {\r\n if (gltfRuntime.importMeshesNames && gltfRuntime.importMeshesNames.length > 0 && gltfRuntime.importMeshesNames.indexOf(node.name || \"\") === -1) {\r\n return null;\r\n }\r\n }\r\n // Meshes\r\n if (node.skin) {\r\n if (node.meshes) {\r\n var skin = gltfRuntime.skins[node.skin];\r\n var newMesh = importMesh(gltfRuntime, node, node.meshes, id, node.babylonNode);\r\n newMesh.skeleton = gltfRuntime.scene.getLastSkeletonByID(node.skin);\r\n if (newMesh.skeleton === null) {\r\n newMesh.skeleton = importSkeleton(gltfRuntime, skin, newMesh, skin.babylonSkeleton, node.skin);\r\n if (!skin.babylonSkeleton) {\r\n skin.babylonSkeleton = newMesh.skeleton;\r\n }\r\n }\r\n lastNode = newMesh;\r\n }\r\n }\r\n else if (node.meshes) {\r\n /**\r\n * Improve meshes property\r\n */\r\n var newMesh = importMesh(gltfRuntime, node, node.mesh ? [node.mesh] : node.meshes, id, node.babylonNode);\r\n lastNode = newMesh;\r\n }\r\n // Lights\r\n else if (node.light && !node.babylonNode && !gltfRuntime.importOnlyMeshes) {\r\n var light = gltfRuntime.lights[node.light];\r\n if (light) {\r\n if (light.type === \"ambient\") {\r\n var ambienLight = light[light.type];\r\n var hemiLight = new HemisphericLight(node.light, Vector3.Zero(), gltfRuntime.scene);\r\n hemiLight.name = node.name || \"\";\r\n if (ambienLight.color) {\r\n hemiLight.diffuse = Color3.FromArray(ambienLight.color);\r\n }\r\n lastNode = hemiLight;\r\n }\r\n else if (light.type === \"directional\") {\r\n var directionalLight = light[light.type];\r\n var dirLight = new DirectionalLight(node.light, Vector3.Zero(), gltfRuntime.scene);\r\n dirLight.name = node.name || \"\";\r\n if (directionalLight.color) {\r\n dirLight.diffuse = Color3.FromArray(directionalLight.color);\r\n }\r\n lastNode = dirLight;\r\n }\r\n else if (light.type === \"point\") {\r\n var pointLight = light[light.type];\r\n var ptLight = new PointLight(node.light, Vector3.Zero(), gltfRuntime.scene);\r\n ptLight.name = node.name || \"\";\r\n if (pointLight.color) {\r\n ptLight.diffuse = Color3.FromArray(pointLight.color);\r\n }\r\n lastNode = ptLight;\r\n }\r\n else if (light.type === \"spot\") {\r\n var spotLight = light[light.type];\r\n var spLight = new SpotLight(node.light, Vector3.Zero(), Vector3.Zero(), 0, 0, gltfRuntime.scene);\r\n spLight.name = node.name || \"\";\r\n if (spotLight.color) {\r\n spLight.diffuse = Color3.FromArray(spotLight.color);\r\n }\r\n if (spotLight.fallOfAngle) {\r\n spLight.angle = spotLight.fallOfAngle;\r\n }\r\n if (spotLight.fallOffExponent) {\r\n spLight.exponent = spotLight.fallOffExponent;\r\n }\r\n lastNode = spLight;\r\n }\r\n }\r\n }\r\n // Cameras\r\n else if (node.camera && !node.babylonNode && !gltfRuntime.importOnlyMeshes) {\r\n var camera = gltfRuntime.cameras[node.camera];\r\n if (camera) {\r\n gltfRuntime.scene._blockEntityCollection = gltfRuntime.forAssetContainer;\r\n if (camera.type === \"orthographic\") {\r\n var orthoCamera = new FreeCamera(node.camera, Vector3.Zero(), gltfRuntime.scene, false);\r\n orthoCamera.name = node.name || \"\";\r\n orthoCamera.mode = Camera.ORTHOGRAPHIC_CAMERA;\r\n orthoCamera.attachControl();\r\n lastNode = orthoCamera;\r\n }\r\n else if (camera.type === \"perspective\") {\r\n var perspectiveCamera = camera[camera.type];\r\n var persCamera = new FreeCamera(node.camera, Vector3.Zero(), gltfRuntime.scene, false);\r\n persCamera.name = node.name || \"\";\r\n persCamera.attachControl();\r\n if (!perspectiveCamera.aspectRatio) {\r\n perspectiveCamera.aspectRatio = gltfRuntime.scene.getEngine().getRenderWidth() / gltfRuntime.scene.getEngine().getRenderHeight();\r\n }\r\n if (perspectiveCamera.znear && perspectiveCamera.zfar) {\r\n persCamera.maxZ = perspectiveCamera.zfar;\r\n persCamera.minZ = perspectiveCamera.znear;\r\n }\r\n lastNode = persCamera;\r\n }\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n }\r\n }\r\n // Empty node\r\n if (!node.jointName) {\r\n if (node.babylonNode) {\r\n return node.babylonNode;\r\n }\r\n else if (lastNode === null) {\r\n gltfRuntime.scene._blockEntityCollection = gltfRuntime.forAssetContainer;\r\n var dummy = new Mesh(node.name || \"\", gltfRuntime.scene);\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n node.babylonNode = dummy;\r\n lastNode = dummy;\r\n }\r\n }\r\n if (lastNode !== null) {\r\n if (node.matrix && lastNode instanceof Mesh) {\r\n configureNodeFromMatrix(lastNode, node, parent);\r\n }\r\n else {\r\n var translation = node.translation || [0, 0, 0];\r\n var rotation = node.rotation || [0, 0, 0, 1];\r\n var scale = node.scale || [1, 1, 1];\r\n configureNode(lastNode, Vector3.FromArray(translation), Quaternion.FromArray(rotation), Vector3.FromArray(scale));\r\n }\r\n lastNode.updateCache(true);\r\n node.babylonNode = lastNode;\r\n }\r\n return lastNode;\r\n};\r\n/**\r\n* Traverses nodes and creates them\r\n*/\r\nvar traverseNodes = function (gltfRuntime, id, parent, meshIncluded) {\r\n if (meshIncluded === void 0) { meshIncluded = false; }\r\n var node = gltfRuntime.nodes[id];\r\n var newNode = null;\r\n if (gltfRuntime.importOnlyMeshes && !meshIncluded && gltfRuntime.importMeshesNames) {\r\n if (gltfRuntime.importMeshesNames.indexOf(node.name || \"\") !== -1 || gltfRuntime.importMeshesNames.length === 0) {\r\n meshIncluded = true;\r\n }\r\n else {\r\n meshIncluded = false;\r\n }\r\n }\r\n else {\r\n meshIncluded = true;\r\n }\r\n if (!node.jointName && meshIncluded) {\r\n newNode = importNode(gltfRuntime, node, id, parent);\r\n if (newNode !== null) {\r\n newNode.id = id;\r\n newNode.parent = parent;\r\n }\r\n }\r\n if (node.children) {\r\n for (var i = 0; i < node.children.length; i++) {\r\n traverseNodes(gltfRuntime, node.children[i], newNode, meshIncluded);\r\n }\r\n }\r\n};\r\n/**\r\n* do stuff after buffers, shaders are loaded (e.g. hook up materials, load animations, etc.)\r\n*/\r\nvar postLoad = function (gltfRuntime) {\r\n // Nodes\r\n var currentScene = gltfRuntime.currentScene;\r\n if (currentScene) {\r\n for (var i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n }\r\n else {\r\n for (var thing in gltfRuntime.scenes) {\r\n currentScene = gltfRuntime.scenes[thing];\r\n for (var i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n }\r\n }\r\n // Set animations\r\n loadAnimations(gltfRuntime);\r\n for (var i = 0; i < gltfRuntime.scene.skeletons.length; i++) {\r\n var skeleton = gltfRuntime.scene.skeletons[i];\r\n gltfRuntime.scene.beginAnimation(skeleton, 0, Number.MAX_VALUE, true, 1.0);\r\n }\r\n};\r\n/**\r\n* onBind shaderrs callback to set uniforms and matrices\r\n*/\r\nvar onBindShaderMaterial = function (mesh, gltfRuntime, unTreatedUniforms, shaderMaterial, technique, material, onSuccess) {\r\n var materialValues = material.values || technique.parameters;\r\n for (var unif in unTreatedUniforms) {\r\n var uniform = unTreatedUniforms[unif];\r\n var type = uniform.type;\r\n if (type === EParameterType.FLOAT_MAT2 || type === EParameterType.FLOAT_MAT3 || type === EParameterType.FLOAT_MAT4) {\r\n if (uniform.semantic && !uniform.source && !uniform.node) {\r\n GLTFUtils.SetMatrix(gltfRuntime.scene, mesh, uniform, unif, shaderMaterial.getEffect());\r\n }\r\n else if (uniform.semantic && (uniform.source || uniform.node)) {\r\n var source = gltfRuntime.scene.getNodeByName(uniform.source || uniform.node || \"\");\r\n if (source === null) {\r\n source = gltfRuntime.scene.getNodeByID(uniform.source || uniform.node || \"\");\r\n }\r\n if (source === null) {\r\n continue;\r\n }\r\n GLTFUtils.SetMatrix(gltfRuntime.scene, source, uniform, unif, shaderMaterial.getEffect());\r\n }\r\n }\r\n else {\r\n var value = materialValues[technique.uniforms[unif]];\r\n if (!value) {\r\n continue;\r\n }\r\n if (type === EParameterType.SAMPLER_2D) {\r\n var texture = gltfRuntime.textures[material.values ? value : uniform.value].babylonTexture;\r\n if (texture === null || texture === undefined) {\r\n continue;\r\n }\r\n shaderMaterial.getEffect().setTexture(unif, texture);\r\n }\r\n else {\r\n GLTFUtils.SetUniform((shaderMaterial.getEffect()), unif, value, type);\r\n }\r\n }\r\n }\r\n onSuccess(shaderMaterial);\r\n};\r\n/**\r\n* Prepare uniforms to send the only one time\r\n* Loads the appropriate textures\r\n*/\r\nvar prepareShaderMaterialUniforms = function (gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms) {\r\n var materialValues = material.values || technique.parameters;\r\n var techniqueUniforms = technique.uniforms;\r\n /**\r\n * Prepare values here (not matrices)\r\n */\r\n for (var unif in unTreatedUniforms) {\r\n var uniform = unTreatedUniforms[unif];\r\n var type = uniform.type;\r\n var value = materialValues[techniqueUniforms[unif]];\r\n if (value === undefined) {\r\n // In case the value is the same for all materials\r\n value = uniform.value;\r\n }\r\n if (!value) {\r\n continue;\r\n }\r\n var onLoadTexture = function (uniformName) {\r\n return function (texture) {\r\n if (uniform.value && uniformName) {\r\n // Static uniform\r\n shaderMaterial.setTexture(uniformName, texture);\r\n delete unTreatedUniforms[uniformName];\r\n }\r\n };\r\n };\r\n // Texture (sampler2D)\r\n if (type === EParameterType.SAMPLER_2D) {\r\n GLTFLoaderExtension.LoadTextureAsync(gltfRuntime, material.values ? value : uniform.value, onLoadTexture(unif), function () { return onLoadTexture(null); });\r\n }\r\n // Others\r\n else {\r\n if (uniform.value && GLTFUtils.SetUniform(shaderMaterial, unif, material.values ? value : uniform.value, type)) {\r\n // Static uniform\r\n delete unTreatedUniforms[unif];\r\n }\r\n }\r\n }\r\n};\r\n/**\r\n* Shader compilation failed\r\n*/\r\nvar onShaderCompileError = function (program, shaderMaterial, onError) {\r\n return function (effect, error) {\r\n shaderMaterial.dispose(true);\r\n onError(\"Cannot compile program named \" + program.name + \". Error: \" + error + \". Default material will be applied\");\r\n };\r\n};\r\n/**\r\n* Shader compilation success\r\n*/\r\nvar onShaderCompileSuccess = function (gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms, onSuccess) {\r\n return function (_) {\r\n prepareShaderMaterialUniforms(gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms);\r\n shaderMaterial.onBind = function (mesh) {\r\n onBindShaderMaterial(mesh, gltfRuntime, unTreatedUniforms, shaderMaterial, technique, material, onSuccess);\r\n };\r\n };\r\n};\r\n/**\r\n* Returns the appropriate uniform if already handled by babylon\r\n*/\r\nvar parseShaderUniforms = function (tokenizer, technique, unTreatedUniforms) {\r\n for (var unif in technique.uniforms) {\r\n var uniform = technique.uniforms[unif];\r\n var uniformParameter = technique.parameters[uniform];\r\n if (tokenizer.currentIdentifier === unif) {\r\n if (uniformParameter.semantic && !uniformParameter.source && !uniformParameter.node) {\r\n var transformIndex = glTFTransforms.indexOf(uniformParameter.semantic);\r\n if (transformIndex !== -1) {\r\n delete unTreatedUniforms[unif];\r\n return babylonTransforms[transformIndex];\r\n }\r\n }\r\n }\r\n }\r\n return tokenizer.currentIdentifier;\r\n};\r\n/**\r\n* All shaders loaded. Create materials one by one\r\n*/\r\nvar importMaterials = function (gltfRuntime) {\r\n // Create materials\r\n for (var mat in gltfRuntime.materials) {\r\n GLTFLoaderExtension.LoadMaterialAsync(gltfRuntime, mat, function (material) { }, function () { });\r\n }\r\n};\r\n/**\r\n* Implementation of the base glTF spec\r\n* @hidden\r\n*/\r\nvar GLTFLoaderBase = /** @class */ (function () {\r\n function GLTFLoaderBase() {\r\n }\r\n GLTFLoaderBase.CreateRuntime = function (parsedData, scene, rootUrl) {\r\n var gltfRuntime = {\r\n extensions: {},\r\n accessors: {},\r\n buffers: {},\r\n bufferViews: {},\r\n meshes: {},\r\n lights: {},\r\n cameras: {},\r\n nodes: {},\r\n images: {},\r\n textures: {},\r\n shaders: {},\r\n programs: {},\r\n samplers: {},\r\n techniques: {},\r\n materials: {},\r\n animations: {},\r\n skins: {},\r\n extensionsUsed: [],\r\n scenes: {},\r\n buffersCount: 0,\r\n shaderscount: 0,\r\n scene: scene,\r\n rootUrl: rootUrl,\r\n loadedBufferCount: 0,\r\n loadedBufferViews: {},\r\n loadedShaderCount: 0,\r\n importOnlyMeshes: false,\r\n dummyNodes: [],\r\n forAssetContainer: false\r\n };\r\n // Parse\r\n if (parsedData.extensions) {\r\n parseObject(parsedData.extensions, \"extensions\", gltfRuntime);\r\n }\r\n if (parsedData.extensionsUsed) {\r\n parseObject(parsedData.extensionsUsed, \"extensionsUsed\", gltfRuntime);\r\n }\r\n if (parsedData.buffers) {\r\n parseBuffers(parsedData.buffers, gltfRuntime);\r\n }\r\n if (parsedData.bufferViews) {\r\n parseObject(parsedData.bufferViews, \"bufferViews\", gltfRuntime);\r\n }\r\n if (parsedData.accessors) {\r\n parseObject(parsedData.accessors, \"accessors\", gltfRuntime);\r\n }\r\n if (parsedData.meshes) {\r\n parseObject(parsedData.meshes, \"meshes\", gltfRuntime);\r\n }\r\n if (parsedData.lights) {\r\n parseObject(parsedData.lights, \"lights\", gltfRuntime);\r\n }\r\n if (parsedData.cameras) {\r\n parseObject(parsedData.cameras, \"cameras\", gltfRuntime);\r\n }\r\n if (parsedData.nodes) {\r\n parseObject(parsedData.nodes, \"nodes\", gltfRuntime);\r\n }\r\n if (parsedData.images) {\r\n parseObject(parsedData.images, \"images\", gltfRuntime);\r\n }\r\n if (parsedData.textures) {\r\n parseObject(parsedData.textures, \"textures\", gltfRuntime);\r\n }\r\n if (parsedData.shaders) {\r\n parseShaders(parsedData.shaders, gltfRuntime);\r\n }\r\n if (parsedData.programs) {\r\n parseObject(parsedData.programs, \"programs\", gltfRuntime);\r\n }\r\n if (parsedData.samplers) {\r\n parseObject(parsedData.samplers, \"samplers\", gltfRuntime);\r\n }\r\n if (parsedData.techniques) {\r\n parseObject(parsedData.techniques, \"techniques\", gltfRuntime);\r\n }\r\n if (parsedData.materials) {\r\n parseObject(parsedData.materials, \"materials\", gltfRuntime);\r\n }\r\n if (parsedData.animations) {\r\n parseObject(parsedData.animations, \"animations\", gltfRuntime);\r\n }\r\n if (parsedData.skins) {\r\n parseObject(parsedData.skins, \"skins\", gltfRuntime);\r\n }\r\n if (parsedData.scenes) {\r\n gltfRuntime.scenes = parsedData.scenes;\r\n }\r\n if (parsedData.scene && parsedData.scenes) {\r\n gltfRuntime.currentScene = parsedData.scenes[parsedData.scene];\r\n }\r\n return gltfRuntime;\r\n };\r\n GLTFLoaderBase.LoadBufferAsync = function (gltfRuntime, id, onSuccess, onError, onProgress) {\r\n var buffer = gltfRuntime.buffers[id];\r\n if (Tools.IsBase64(buffer.uri)) {\r\n setTimeout(function () { return onSuccess(new Uint8Array(Tools.DecodeBase64(buffer.uri))); });\r\n }\r\n else {\r\n Tools.LoadFile(gltfRuntime.rootUrl + buffer.uri, function (data) { return onSuccess(new Uint8Array(data)); }, onProgress, undefined, true, function (request) {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText);\r\n }\r\n });\r\n }\r\n };\r\n GLTFLoaderBase.LoadTextureBufferAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n var texture = gltfRuntime.textures[id];\r\n if (!texture || !texture.source) {\r\n onError(\"\");\r\n return;\r\n }\r\n if (texture.babylonTexture) {\r\n onSuccess(null);\r\n return;\r\n }\r\n var source = gltfRuntime.images[texture.source];\r\n if (Tools.IsBase64(source.uri)) {\r\n setTimeout(function () { return onSuccess(new Uint8Array(Tools.DecodeBase64(source.uri))); });\r\n }\r\n else {\r\n Tools.LoadFile(gltfRuntime.rootUrl + source.uri, function (data) { return onSuccess(new Uint8Array(data)); }, undefined, undefined, true, function (request) {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText);\r\n }\r\n });\r\n }\r\n };\r\n GLTFLoaderBase.CreateTextureAsync = function (gltfRuntime, id, buffer, onSuccess, onError) {\r\n var texture = gltfRuntime.textures[id];\r\n if (texture.babylonTexture) {\r\n onSuccess(texture.babylonTexture);\r\n return;\r\n }\r\n var sampler = gltfRuntime.samplers[texture.sampler];\r\n var createMipMaps = (sampler.minFilter === ETextureFilterType.NEAREST_MIPMAP_NEAREST) ||\r\n (sampler.minFilter === ETextureFilterType.NEAREST_MIPMAP_LINEAR) ||\r\n (sampler.minFilter === ETextureFilterType.LINEAR_MIPMAP_NEAREST) ||\r\n (sampler.minFilter === ETextureFilterType.LINEAR_MIPMAP_LINEAR);\r\n var samplingMode = Texture.BILINEAR_SAMPLINGMODE;\r\n var blob = buffer == null ? new Blob() : new Blob([buffer]);\r\n var blobURL = URL.createObjectURL(blob);\r\n var revokeBlobURL = function () { return URL.revokeObjectURL(blobURL); };\r\n var newTexture = new Texture(blobURL, gltfRuntime.scene, !createMipMaps, true, samplingMode, revokeBlobURL, revokeBlobURL);\r\n if (sampler.wrapS !== undefined) {\r\n newTexture.wrapU = GLTFUtils.GetWrapMode(sampler.wrapS);\r\n }\r\n if (sampler.wrapT !== undefined) {\r\n newTexture.wrapV = GLTFUtils.GetWrapMode(sampler.wrapT);\r\n }\r\n newTexture.name = id;\r\n texture.babylonTexture = newTexture;\r\n onSuccess(newTexture);\r\n };\r\n GLTFLoaderBase.LoadShaderStringAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n var shader = gltfRuntime.shaders[id];\r\n if (Tools.IsBase64(shader.uri)) {\r\n var shaderString = atob(shader.uri.split(\",\")[1]);\r\n if (onSuccess) {\r\n onSuccess(shaderString);\r\n }\r\n }\r\n else {\r\n Tools.LoadFile(gltfRuntime.rootUrl + shader.uri, onSuccess, undefined, undefined, false, function (request) {\r\n if (request && onError) {\r\n onError(request.status + \" \" + request.statusText);\r\n }\r\n });\r\n }\r\n };\r\n GLTFLoaderBase.LoadMaterialAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n var material = gltfRuntime.materials[id];\r\n if (!material.technique) {\r\n if (onError) {\r\n onError(\"No technique found.\");\r\n }\r\n return;\r\n }\r\n var technique = gltfRuntime.techniques[material.technique];\r\n if (!technique) {\r\n gltfRuntime.scene._blockEntityCollection = gltfRuntime.forAssetContainer;\r\n var defaultMaterial = new StandardMaterial(id, gltfRuntime.scene);\r\n gltfRuntime.scene._blockEntityCollection = false;\r\n defaultMaterial.diffuseColor = new Color3(0.5, 0.5, 0.5);\r\n defaultMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n onSuccess(defaultMaterial);\r\n return;\r\n }\r\n var program = gltfRuntime.programs[technique.program];\r\n var states = technique.states;\r\n var vertexShader = Effect.ShadersStore[program.vertexShader + \"VertexShader\"];\r\n var pixelShader = Effect.ShadersStore[program.fragmentShader + \"PixelShader\"];\r\n var newVertexShader = \"\";\r\n var newPixelShader = \"\";\r\n var vertexTokenizer = new Tokenizer(vertexShader);\r\n var pixelTokenizer = new Tokenizer(pixelShader);\r\n var unTreatedUniforms = {};\r\n var uniforms = [];\r\n var attributes = [];\r\n var samplers = [];\r\n // Fill uniform, sampler2D and attributes\r\n for (var unif in technique.uniforms) {\r\n var uniform = technique.uniforms[unif];\r\n var uniformParameter = technique.parameters[uniform];\r\n unTreatedUniforms[unif] = uniformParameter;\r\n if (uniformParameter.semantic && !uniformParameter.node && !uniformParameter.source) {\r\n var transformIndex = glTFTransforms.indexOf(uniformParameter.semantic);\r\n if (transformIndex !== -1) {\r\n uniforms.push(babylonTransforms[transformIndex]);\r\n delete unTreatedUniforms[unif];\r\n }\r\n else {\r\n uniforms.push(unif);\r\n }\r\n }\r\n else if (uniformParameter.type === EParameterType.SAMPLER_2D) {\r\n samplers.push(unif);\r\n }\r\n else {\r\n uniforms.push(unif);\r\n }\r\n }\r\n for (var attr in technique.attributes) {\r\n var attribute = technique.attributes[attr];\r\n var attributeParameter = technique.parameters[attribute];\r\n if (attributeParameter.semantic) {\r\n var name_1 = getAttribute(attributeParameter);\r\n if (name_1) {\r\n attributes.push(name_1);\r\n }\r\n }\r\n }\r\n // Configure vertex shader\r\n while (!vertexTokenizer.isEnd() && vertexTokenizer.getNextToken()) {\r\n var tokenType = vertexTokenizer.currentToken;\r\n if (tokenType !== ETokenType.IDENTIFIER) {\r\n newVertexShader += vertexTokenizer.currentString;\r\n continue;\r\n }\r\n var foundAttribute = false;\r\n for (var attr in technique.attributes) {\r\n var attribute = technique.attributes[attr];\r\n var attributeParameter = technique.parameters[attribute];\r\n if (vertexTokenizer.currentIdentifier === attr && attributeParameter.semantic) {\r\n newVertexShader += getAttribute(attributeParameter);\r\n foundAttribute = true;\r\n break;\r\n }\r\n }\r\n if (foundAttribute) {\r\n continue;\r\n }\r\n newVertexShader += parseShaderUniforms(vertexTokenizer, technique, unTreatedUniforms);\r\n }\r\n // Configure pixel shader\r\n while (!pixelTokenizer.isEnd() && pixelTokenizer.getNextToken()) {\r\n var tokenType = pixelTokenizer.currentToken;\r\n if (tokenType !== ETokenType.IDENTIFIER) {\r\n newPixelShader += pixelTokenizer.currentString;\r\n continue;\r\n }\r\n newPixelShader += parseShaderUniforms(pixelTokenizer, technique, unTreatedUniforms);\r\n }\r\n // Create shader material\r\n var shaderPath = {\r\n vertex: program.vertexShader + id,\r\n fragment: program.fragmentShader + id\r\n };\r\n var options = {\r\n attributes: attributes,\r\n uniforms: uniforms,\r\n samplers: samplers,\r\n needAlphaBlending: states && states.enable && states.enable.indexOf(3042) !== -1\r\n };\r\n Effect.ShadersStore[program.vertexShader + id + \"VertexShader\"] = newVertexShader;\r\n Effect.ShadersStore[program.fragmentShader + id + \"PixelShader\"] = newPixelShader;\r\n var shaderMaterial = new ShaderMaterial(id, gltfRuntime.scene, shaderPath, options);\r\n shaderMaterial.onError = onShaderCompileError(program, shaderMaterial, onError);\r\n shaderMaterial.onCompiled = onShaderCompileSuccess(gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms, onSuccess);\r\n shaderMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n if (states && states.functions) {\r\n var functions = states.functions;\r\n if (functions.cullFace && functions.cullFace[0] !== ECullingType.BACK) {\r\n shaderMaterial.backFaceCulling = false;\r\n }\r\n var blendFunc = functions.blendFuncSeparate;\r\n if (blendFunc) {\r\n if (blendFunc[0] === EBlendingFunction.SRC_ALPHA && blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_ALPHA && blendFunc[2] === EBlendingFunction.ONE && blendFunc[3] === EBlendingFunction.ONE) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_COMBINE;\r\n }\r\n else if (blendFunc[0] === EBlendingFunction.ONE && blendFunc[1] === EBlendingFunction.ONE && blendFunc[2] === EBlendingFunction.ZERO && blendFunc[3] === EBlendingFunction.ONE) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_ONEONE;\r\n }\r\n else if (blendFunc[0] === EBlendingFunction.SRC_ALPHA && blendFunc[1] === EBlendingFunction.ONE && blendFunc[2] === EBlendingFunction.ZERO && blendFunc[3] === EBlendingFunction.ONE) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_ADD;\r\n }\r\n else if (blendFunc[0] === EBlendingFunction.ZERO && blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_COLOR && blendFunc[2] === EBlendingFunction.ONE && blendFunc[3] === EBlendingFunction.ONE) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_SUBTRACT;\r\n }\r\n else if (blendFunc[0] === EBlendingFunction.DST_COLOR && blendFunc[1] === EBlendingFunction.ZERO && blendFunc[2] === EBlendingFunction.ONE && blendFunc[3] === EBlendingFunction.ONE) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_MULTIPLY;\r\n }\r\n else if (blendFunc[0] === EBlendingFunction.SRC_ALPHA && blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_COLOR && blendFunc[2] === EBlendingFunction.ONE && blendFunc[3] === EBlendingFunction.ONE) {\r\n shaderMaterial.alphaMode = Constants.ALPHA_MAXIMIZED;\r\n }\r\n }\r\n }\r\n };\r\n return GLTFLoaderBase;\r\n}());\r\nexport { GLTFLoaderBase };\r\n/**\r\n* glTF V1 Loader\r\n* @hidden\r\n*/\r\nvar GLTFLoader = /** @class */ (function () {\r\n function GLTFLoader() {\r\n this.state = null;\r\n }\r\n GLTFLoader.RegisterExtension = function (extension) {\r\n if (GLTFLoader.Extensions[extension.name]) {\r\n Tools.Error(\"Tool with the same name \\\"\" + extension.name + \"\\\" already exists\");\r\n return;\r\n }\r\n GLTFLoader.Extensions[extension.name] = extension;\r\n };\r\n GLTFLoader.prototype.dispose = function () {\r\n // do nothing\r\n };\r\n GLTFLoader.prototype._importMeshAsync = function (meshesNames, scene, data, rootUrl, forAssetContainer, onSuccess, onProgress, onError) {\r\n var _this = this;\r\n scene.useRightHandedSystem = true;\r\n GLTFLoaderExtension.LoadRuntimeAsync(scene, data, rootUrl, function (gltfRuntime) {\r\n gltfRuntime.forAssetContainer = forAssetContainer;\r\n gltfRuntime.importOnlyMeshes = true;\r\n if (meshesNames === \"\") {\r\n gltfRuntime.importMeshesNames = [];\r\n }\r\n else if (typeof meshesNames === \"string\") {\r\n gltfRuntime.importMeshesNames = [meshesNames];\r\n }\r\n else if (meshesNames && !(meshesNames instanceof Array)) {\r\n gltfRuntime.importMeshesNames = [meshesNames];\r\n }\r\n else {\r\n gltfRuntime.importMeshesNames = [];\r\n Tools.Warn(\"Argument meshesNames must be of type string or string[]\");\r\n }\r\n // Create nodes\r\n _this._createNodes(gltfRuntime);\r\n var meshes = new Array();\r\n var skeletons = new Array();\r\n // Fill arrays of meshes and skeletons\r\n for (var nde in gltfRuntime.nodes) {\r\n var node = gltfRuntime.nodes[nde];\r\n if (node.babylonNode instanceof AbstractMesh) {\r\n meshes.push(node.babylonNode);\r\n }\r\n }\r\n for (var skl in gltfRuntime.skins) {\r\n var skin = gltfRuntime.skins[skl];\r\n if (skin.babylonSkeleton instanceof Skeleton) {\r\n skeletons.push(skin.babylonSkeleton);\r\n }\r\n }\r\n // Load buffers, shaders, materials, etc.\r\n _this._loadBuffersAsync(gltfRuntime, function () {\r\n _this._loadShadersAsync(gltfRuntime, function () {\r\n importMaterials(gltfRuntime);\r\n postLoad(gltfRuntime);\r\n if (!GLTFFileLoader.IncrementalLoading && onSuccess) {\r\n onSuccess(meshes, skeletons);\r\n }\r\n });\r\n }, onProgress);\r\n if (GLTFFileLoader.IncrementalLoading && onSuccess) {\r\n onSuccess(meshes, skeletons);\r\n }\r\n }, onError);\r\n return true;\r\n };\r\n /**\r\n * Imports one or more meshes from a loaded gltf file and adds them to the scene\r\n * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file\r\n * @param scene the scene the meshes should be added to\r\n * @param forAssetContainer defines if the entities must be stored in the scene\r\n * @param data gltf data containing information of the meshes in a loaded file\r\n * @param rootUrl root url to load from\r\n * @param onProgress event that fires when loading progress has occured\r\n * @returns a promise containg the loaded meshes, particles, skeletons and animations\r\n */\r\n GLTFLoader.prototype.importMeshAsync = function (meshesNames, scene, forAssetContainer, data, rootUrl, onProgress) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._importMeshAsync(meshesNames, scene, data, rootUrl, forAssetContainer, function (meshes, skeletons) {\r\n resolve({\r\n meshes: meshes,\r\n particleSystems: [],\r\n skeletons: skeletons,\r\n animationGroups: [],\r\n lights: [],\r\n transformNodes: [],\r\n geometries: []\r\n });\r\n }, onProgress, function (message) {\r\n reject(new Error(message));\r\n });\r\n });\r\n };\r\n GLTFLoader.prototype._loadAsync = function (scene, data, rootUrl, forAssetContainer, onSuccess, onProgress, onError) {\r\n var _this = this;\r\n scene.useRightHandedSystem = true;\r\n GLTFLoaderExtension.LoadRuntimeAsync(scene, data, rootUrl, function (gltfRuntime) {\r\n // Load runtime extensios\r\n GLTFLoaderExtension.LoadRuntimeExtensionsAsync(gltfRuntime, function () {\r\n // Create nodes\r\n _this._createNodes(gltfRuntime);\r\n // Load buffers, shaders, materials, etc.\r\n _this._loadBuffersAsync(gltfRuntime, function () {\r\n _this._loadShadersAsync(gltfRuntime, function () {\r\n importMaterials(gltfRuntime);\r\n postLoad(gltfRuntime);\r\n if (!GLTFFileLoader.IncrementalLoading) {\r\n onSuccess();\r\n }\r\n });\r\n });\r\n if (GLTFFileLoader.IncrementalLoading) {\r\n onSuccess();\r\n }\r\n }, onError);\r\n }, onError);\r\n };\r\n /**\r\n * Imports all objects from a loaded gltf file and adds them to the scene\r\n * @param scene the scene the objects should be added to\r\n * @param data gltf data containing information of the meshes in a loaded file\r\n * @param rootUrl root url to load from\r\n * @param onProgress event that fires when loading progress has occured\r\n * @returns a promise which completes when objects have been loaded to the scene\r\n */\r\n GLTFLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this._loadAsync(scene, data, rootUrl, false, function () {\r\n resolve();\r\n }, onProgress, function (message) {\r\n reject(new Error(message));\r\n });\r\n });\r\n };\r\n GLTFLoader.prototype._loadShadersAsync = function (gltfRuntime, onload) {\r\n var hasShaders = false;\r\n var processShader = function (sha, shader) {\r\n GLTFLoaderExtension.LoadShaderStringAsync(gltfRuntime, sha, function (shaderString) {\r\n if (shaderString instanceof ArrayBuffer) {\r\n return;\r\n }\r\n gltfRuntime.loadedShaderCount++;\r\n if (shaderString) {\r\n Effect.ShadersStore[sha + (shader.type === EShaderType.VERTEX ? \"VertexShader\" : \"PixelShader\")] = shaderString;\r\n }\r\n if (gltfRuntime.loadedShaderCount === gltfRuntime.shaderscount) {\r\n onload();\r\n }\r\n }, function () {\r\n Tools.Error(\"Error when loading shader program named \" + sha + \" located at \" + shader.uri);\r\n });\r\n };\r\n for (var sha in gltfRuntime.shaders) {\r\n hasShaders = true;\r\n var shader = gltfRuntime.shaders[sha];\r\n if (shader) {\r\n processShader.bind(this, sha, shader)();\r\n }\r\n else {\r\n Tools.Error(\"No shader named: \" + sha);\r\n }\r\n }\r\n if (!hasShaders) {\r\n onload();\r\n }\r\n };\r\n GLTFLoader.prototype._loadBuffersAsync = function (gltfRuntime, onLoad, onProgress) {\r\n var hasBuffers = false;\r\n var processBuffer = function (buf, buffer) {\r\n GLTFLoaderExtension.LoadBufferAsync(gltfRuntime, buf, function (bufferView) {\r\n gltfRuntime.loadedBufferCount++;\r\n if (bufferView) {\r\n if (bufferView.byteLength != gltfRuntime.buffers[buf].byteLength) {\r\n Tools.Error(\"Buffer named \" + buf + \" is length \" + bufferView.byteLength + \". Expected: \" + buffer.byteLength); // Improve error message\r\n }\r\n gltfRuntime.loadedBufferViews[buf] = bufferView;\r\n }\r\n if (gltfRuntime.loadedBufferCount === gltfRuntime.buffersCount) {\r\n onLoad();\r\n }\r\n }, function () {\r\n Tools.Error(\"Error when loading buffer named \" + buf + \" located at \" + buffer.uri);\r\n });\r\n };\r\n for (var buf in gltfRuntime.buffers) {\r\n hasBuffers = true;\r\n var buffer = gltfRuntime.buffers[buf];\r\n if (buffer) {\r\n processBuffer.bind(this, buf, buffer)();\r\n }\r\n else {\r\n Tools.Error(\"No buffer named: \" + buf);\r\n }\r\n }\r\n if (!hasBuffers) {\r\n onLoad();\r\n }\r\n };\r\n GLTFLoader.prototype._createNodes = function (gltfRuntime) {\r\n var currentScene = gltfRuntime.currentScene;\r\n if (currentScene) {\r\n // Only one scene even if multiple scenes are defined\r\n for (var i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n }\r\n else {\r\n // Load all scenes\r\n for (var thing in gltfRuntime.scenes) {\r\n currentScene = gltfRuntime.scenes[thing];\r\n for (var i = 0; i < currentScene.nodes.length; i++) {\r\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\r\n }\r\n }\r\n }\r\n };\r\n GLTFLoader.Extensions = {};\r\n return GLTFLoader;\r\n}());\r\nexport { GLTFLoader };\r\n/** @hidden */\r\nvar GLTFLoaderExtension = /** @class */ (function () {\r\n function GLTFLoaderExtension(name) {\r\n this._name = name;\r\n }\r\n Object.defineProperty(GLTFLoaderExtension.prototype, \"name\", {\r\n get: function () {\r\n return this._name;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Defines an override for loading the runtime\r\n * Return true to stop further extensions from loading the runtime\r\n */\r\n GLTFLoaderExtension.prototype.loadRuntimeAsync = function (scene, data, rootUrl, onSuccess, onError) {\r\n return false;\r\n };\r\n /**\r\n * Defines an onverride for creating gltf runtime\r\n * Return true to stop further extensions from creating the runtime\r\n */\r\n GLTFLoaderExtension.prototype.loadRuntimeExtensionsAsync = function (gltfRuntime, onSuccess, onError) {\r\n return false;\r\n };\r\n /**\r\n * Defines an override for loading buffers\r\n * Return true to stop further extensions from loading this buffer\r\n */\r\n GLTFLoaderExtension.prototype.loadBufferAsync = function (gltfRuntime, id, onSuccess, onError, onProgress) {\r\n return false;\r\n };\r\n /**\r\n * Defines an override for loading texture buffers\r\n * Return true to stop further extensions from loading this texture data\r\n */\r\n GLTFLoaderExtension.prototype.loadTextureBufferAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n return false;\r\n };\r\n /**\r\n * Defines an override for creating textures\r\n * Return true to stop further extensions from loading this texture\r\n */\r\n GLTFLoaderExtension.prototype.createTextureAsync = function (gltfRuntime, id, buffer, onSuccess, onError) {\r\n return false;\r\n };\r\n /**\r\n * Defines an override for loading shader strings\r\n * Return true to stop further extensions from loading this shader data\r\n */\r\n GLTFLoaderExtension.prototype.loadShaderStringAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n return false;\r\n };\r\n /**\r\n * Defines an override for loading materials\r\n * Return true to stop further extensions from loading this material\r\n */\r\n GLTFLoaderExtension.prototype.loadMaterialAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n return false;\r\n };\r\n // ---------\r\n // Utilities\r\n // ---------\r\n GLTFLoaderExtension.LoadRuntimeAsync = function (scene, data, rootUrl, onSuccess, onError) {\r\n GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {\r\n return loaderExtension.loadRuntimeAsync(scene, data, rootUrl, onSuccess, onError);\r\n }, function () {\r\n setTimeout(function () {\r\n if (!onSuccess) {\r\n return;\r\n }\r\n onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));\r\n });\r\n });\r\n };\r\n GLTFLoaderExtension.LoadRuntimeExtensionsAsync = function (gltfRuntime, onSuccess, onError) {\r\n GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {\r\n return loaderExtension.loadRuntimeExtensionsAsync(gltfRuntime, onSuccess, onError);\r\n }, function () {\r\n setTimeout(function () {\r\n onSuccess();\r\n });\r\n });\r\n };\r\n GLTFLoaderExtension.LoadBufferAsync = function (gltfRuntime, id, onSuccess, onError, onProgress) {\r\n GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {\r\n return loaderExtension.loadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress);\r\n }, function () {\r\n GLTFLoaderBase.LoadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress);\r\n });\r\n };\r\n GLTFLoaderExtension.LoadTextureAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n GLTFLoaderExtension.LoadTextureBufferAsync(gltfRuntime, id, function (buffer) {\r\n if (buffer) {\r\n GLTFLoaderExtension.CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);\r\n }\r\n }, onError);\r\n };\r\n GLTFLoaderExtension.LoadShaderStringAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {\r\n return loaderExtension.loadShaderStringAsync(gltfRuntime, id, onSuccess, onError);\r\n }, function () {\r\n GLTFLoaderBase.LoadShaderStringAsync(gltfRuntime, id, onSuccess, onError);\r\n });\r\n };\r\n GLTFLoaderExtension.LoadMaterialAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {\r\n return loaderExtension.loadMaterialAsync(gltfRuntime, id, onSuccess, onError);\r\n }, function () {\r\n GLTFLoaderBase.LoadMaterialAsync(gltfRuntime, id, onSuccess, onError);\r\n });\r\n };\r\n GLTFLoaderExtension.LoadTextureBufferAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {\r\n return loaderExtension.loadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);\r\n }, function () {\r\n GLTFLoaderBase.LoadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);\r\n });\r\n };\r\n GLTFLoaderExtension.CreateTextureAsync = function (gltfRuntime, id, buffer, onSuccess, onError) {\r\n GLTFLoaderExtension.ApplyExtensions(function (loaderExtension) {\r\n return loaderExtension.createTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);\r\n }, function () {\r\n GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);\r\n });\r\n };\r\n GLTFLoaderExtension.ApplyExtensions = function (func, defaultFunc) {\r\n for (var extensionName in GLTFLoader.Extensions) {\r\n var loaderExtension = GLTFLoader.Extensions[extensionName];\r\n if (func(loaderExtension)) {\r\n return;\r\n }\r\n }\r\n defaultFunc();\r\n };\r\n return GLTFLoaderExtension;\r\n}());\r\nexport { GLTFLoaderExtension };\r\nGLTFFileLoader._CreateGLTF1Loader = function () { return new GLTFLoader(); };\r\n//# sourceMappingURL=glTFLoader.js.map","import { EParameterType, ETextureWrapMode, ETextureFilterType, EComponentType } from \"./glTFLoaderInterfaces\";\r\nimport { Vector2, Vector3, Vector4, Matrix } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Color4 } from '@babylonjs/core/Maths/math.color';\r\nimport { Effect } from \"@babylonjs/core/Materials/effect\";\r\nimport { ShaderMaterial } from \"@babylonjs/core/Materials/shaderMaterial\";\r\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\r\n/**\r\n* Utils functions for GLTF\r\n* @hidden\r\n*/\r\nvar GLTFUtils = /** @class */ (function () {\r\n function GLTFUtils() {\r\n }\r\n /**\r\n * Sets the given \"parameter\" matrix\r\n * @param scene: the Scene object\r\n * @param source: the source node where to pick the matrix\r\n * @param parameter: the GLTF technique parameter\r\n * @param uniformName: the name of the shader's uniform\r\n * @param shaderMaterial: the shader material\r\n */\r\n GLTFUtils.SetMatrix = function (scene, source, parameter, uniformName, shaderMaterial) {\r\n var mat = null;\r\n if (parameter.semantic === \"MODEL\") {\r\n mat = source.getWorldMatrix();\r\n }\r\n else if (parameter.semantic === \"PROJECTION\") {\r\n mat = scene.getProjectionMatrix();\r\n }\r\n else if (parameter.semantic === \"VIEW\") {\r\n mat = scene.getViewMatrix();\r\n }\r\n else if (parameter.semantic === \"MODELVIEWINVERSETRANSPOSE\") {\r\n mat = Matrix.Transpose(source.getWorldMatrix().multiply(scene.getViewMatrix()).invert());\r\n }\r\n else if (parameter.semantic === \"MODELVIEW\") {\r\n mat = source.getWorldMatrix().multiply(scene.getViewMatrix());\r\n }\r\n else if (parameter.semantic === \"MODELVIEWPROJECTION\") {\r\n mat = source.getWorldMatrix().multiply(scene.getTransformMatrix());\r\n }\r\n else if (parameter.semantic === \"MODELINVERSE\") {\r\n mat = source.getWorldMatrix().invert();\r\n }\r\n else if (parameter.semantic === \"VIEWINVERSE\") {\r\n mat = scene.getViewMatrix().invert();\r\n }\r\n else if (parameter.semantic === \"PROJECTIONINVERSE\") {\r\n mat = scene.getProjectionMatrix().invert();\r\n }\r\n else if (parameter.semantic === \"MODELVIEWINVERSE\") {\r\n mat = source.getWorldMatrix().multiply(scene.getViewMatrix()).invert();\r\n }\r\n else if (parameter.semantic === \"MODELVIEWPROJECTIONINVERSE\") {\r\n mat = source.getWorldMatrix().multiply(scene.getTransformMatrix()).invert();\r\n }\r\n else if (parameter.semantic === \"MODELINVERSETRANSPOSE\") {\r\n mat = Matrix.Transpose(source.getWorldMatrix().invert());\r\n }\r\n else {\r\n debugger;\r\n }\r\n if (mat) {\r\n switch (parameter.type) {\r\n case EParameterType.FLOAT_MAT2:\r\n shaderMaterial.setMatrix2x2(uniformName, Matrix.GetAsMatrix2x2(mat));\r\n break;\r\n case EParameterType.FLOAT_MAT3:\r\n shaderMaterial.setMatrix3x3(uniformName, Matrix.GetAsMatrix3x3(mat));\r\n break;\r\n case EParameterType.FLOAT_MAT4:\r\n shaderMaterial.setMatrix(uniformName, mat);\r\n break;\r\n default: break;\r\n }\r\n }\r\n };\r\n /**\r\n * Sets the given \"parameter\" matrix\r\n * @param shaderMaterial: the shader material\r\n * @param uniform: the name of the shader's uniform\r\n * @param value: the value of the uniform\r\n * @param type: the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)\r\n */\r\n GLTFUtils.SetUniform = function (shaderMaterial, uniform, value, type) {\r\n switch (type) {\r\n case EParameterType.FLOAT:\r\n shaderMaterial.setFloat(uniform, value);\r\n return true;\r\n case EParameterType.FLOAT_VEC2:\r\n shaderMaterial.setVector2(uniform, Vector2.FromArray(value));\r\n return true;\r\n case EParameterType.FLOAT_VEC3:\r\n shaderMaterial.setVector3(uniform, Vector3.FromArray(value));\r\n return true;\r\n case EParameterType.FLOAT_VEC4:\r\n shaderMaterial.setVector4(uniform, Vector4.FromArray(value));\r\n return true;\r\n default: return false;\r\n }\r\n };\r\n /**\r\n * Returns the wrap mode of the texture\r\n * @param mode: the mode value\r\n */\r\n GLTFUtils.GetWrapMode = function (mode) {\r\n switch (mode) {\r\n case ETextureWrapMode.CLAMP_TO_EDGE: return Texture.CLAMP_ADDRESSMODE;\r\n case ETextureWrapMode.MIRRORED_REPEAT: return Texture.MIRROR_ADDRESSMODE;\r\n case ETextureWrapMode.REPEAT: return Texture.WRAP_ADDRESSMODE;\r\n default: return Texture.WRAP_ADDRESSMODE;\r\n }\r\n };\r\n /**\r\n * Returns the byte stride giving an accessor\r\n * @param accessor: the GLTF accessor objet\r\n */\r\n GLTFUtils.GetByteStrideFromType = function (accessor) {\r\n // Needs this function since \"byteStride\" isn't requiered in glTF format\r\n var type = accessor.type;\r\n switch (type) {\r\n case \"VEC2\": return 2;\r\n case \"VEC3\": return 3;\r\n case \"VEC4\": return 4;\r\n case \"MAT2\": return 4;\r\n case \"MAT3\": return 9;\r\n case \"MAT4\": return 16;\r\n default: return 1;\r\n }\r\n };\r\n /**\r\n * Returns the texture filter mode giving a mode value\r\n * @param mode: the filter mode value\r\n */\r\n GLTFUtils.GetTextureFilterMode = function (mode) {\r\n switch (mode) {\r\n case ETextureFilterType.LINEAR:\r\n case ETextureFilterType.LINEAR_MIPMAP_NEAREST:\r\n case ETextureFilterType.LINEAR_MIPMAP_LINEAR: return Texture.TRILINEAR_SAMPLINGMODE;\r\n case ETextureFilterType.NEAREST:\r\n case ETextureFilterType.NEAREST_MIPMAP_NEAREST: return Texture.NEAREST_SAMPLINGMODE;\r\n default: return Texture.BILINEAR_SAMPLINGMODE;\r\n }\r\n };\r\n GLTFUtils.GetBufferFromBufferView = function (gltfRuntime, bufferView, byteOffset, byteLength, componentType) {\r\n var byteOffset = bufferView.byteOffset + byteOffset;\r\n var loadedBufferView = gltfRuntime.loadedBufferViews[bufferView.buffer];\r\n if (byteOffset + byteLength > loadedBufferView.byteLength) {\r\n throw new Error(\"Buffer access is out of range\");\r\n }\r\n var buffer = loadedBufferView.buffer;\r\n byteOffset += loadedBufferView.byteOffset;\r\n switch (componentType) {\r\n case EComponentType.BYTE: return new Int8Array(buffer, byteOffset, byteLength);\r\n case EComponentType.UNSIGNED_BYTE: return new Uint8Array(buffer, byteOffset, byteLength);\r\n case EComponentType.SHORT: return new Int16Array(buffer, byteOffset, byteLength);\r\n case EComponentType.UNSIGNED_SHORT: return new Uint16Array(buffer, byteOffset, byteLength);\r\n default: return new Float32Array(buffer, byteOffset, byteLength);\r\n }\r\n };\r\n /**\r\n * Returns a buffer from its accessor\r\n * @param gltfRuntime: the GLTF runtime\r\n * @param accessor: the GLTF accessor\r\n */\r\n GLTFUtils.GetBufferFromAccessor = function (gltfRuntime, accessor) {\r\n var bufferView = gltfRuntime.bufferViews[accessor.bufferView];\r\n var byteLength = accessor.count * GLTFUtils.GetByteStrideFromType(accessor);\r\n return GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, accessor.byteOffset, byteLength, accessor.componentType);\r\n };\r\n /**\r\n * Decodes a buffer view into a string\r\n * @param view: the buffer view\r\n */\r\n GLTFUtils.DecodeBufferToText = function (view) {\r\n var result = \"\";\r\n var length = view.byteLength;\r\n for (var i = 0; i < length; ++i) {\r\n result += String.fromCharCode(view[i]);\r\n }\r\n return result;\r\n };\r\n /**\r\n * Returns the default material of gltf. Related to\r\n * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material\r\n * @param scene: the Babylon.js scene\r\n */\r\n GLTFUtils.GetDefaultMaterial = function (scene) {\r\n if (!GLTFUtils._DefaultMaterial) {\r\n Effect.ShadersStore[\"GLTFDefaultMaterialVertexShader\"] = [\r\n \"precision highp float;\",\r\n \"\",\r\n \"uniform mat4 worldView;\",\r\n \"uniform mat4 projection;\",\r\n \"\",\r\n \"attribute vec3 position;\",\r\n \"\",\r\n \"void main(void)\",\r\n \"{\",\r\n \" gl_Position = projection * worldView * vec4(position, 1.0);\",\r\n \"}\"\r\n ].join(\"\\n\");\r\n Effect.ShadersStore[\"GLTFDefaultMaterialPixelShader\"] = [\r\n \"precision highp float;\",\r\n \"\",\r\n \"uniform vec4 u_emission;\",\r\n \"\",\r\n \"void main(void)\",\r\n \"{\",\r\n \" gl_FragColor = u_emission;\",\r\n \"}\"\r\n ].join(\"\\n\");\r\n var shaderPath = {\r\n vertex: \"GLTFDefaultMaterial\",\r\n fragment: \"GLTFDefaultMaterial\"\r\n };\r\n var options = {\r\n attributes: [\"position\"],\r\n uniforms: [\"worldView\", \"projection\", \"u_emission\"],\r\n samplers: new Array(),\r\n needAlphaBlending: false\r\n };\r\n GLTFUtils._DefaultMaterial = new ShaderMaterial(\"GLTFDefaultMaterial\", scene, shaderPath, options);\r\n GLTFUtils._DefaultMaterial.setColor4(\"u_emission\", new Color4(0.5, 0.5, 0.5, 1.0));\r\n }\r\n return GLTFUtils._DefaultMaterial;\r\n };\r\n // The GLTF default material\r\n GLTFUtils._DefaultMaterial = null;\r\n return GLTFUtils;\r\n}());\r\nexport { GLTFUtils };\r\n//# sourceMappingURL=glTFLoaderUtils.js.map","import { __extends } from \"tslib\";\r\nimport { GLTFLoaderExtension } from \"./glTFLoader\";\r\nimport { GLTFUtils } from \"./glTFLoaderUtils\";\r\nimport { EComponentType } from \"./glTFLoaderInterfaces\";\r\nimport { GLTFLoader, GLTFLoaderBase } from \"./glTFLoader\";\r\nvar BinaryExtensionBufferName = \"binary_glTF\";\r\n/** @hidden */\r\nvar GLTFBinaryExtension = /** @class */ (function (_super) {\r\n __extends(GLTFBinaryExtension, _super);\r\n function GLTFBinaryExtension() {\r\n return _super.call(this, \"KHR_binary_glTF\") || this;\r\n }\r\n GLTFBinaryExtension.prototype.loadRuntimeAsync = function (scene, data, rootUrl, onSuccess, onError) {\r\n var extensionsUsed = data.json.extensionsUsed;\r\n if (!extensionsUsed || extensionsUsed.indexOf(this.name) === -1 || !data.bin) {\r\n return false;\r\n }\r\n this._bin = data.bin;\r\n onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));\r\n return true;\r\n };\r\n GLTFBinaryExtension.prototype.loadBufferAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n if (gltfRuntime.extensionsUsed.indexOf(this.name) === -1) {\r\n return false;\r\n }\r\n if (id !== BinaryExtensionBufferName) {\r\n return false;\r\n }\r\n this._bin.readAsync(0, this._bin.byteLength).then(onSuccess, function (error) { return onError(error.message); });\r\n return true;\r\n };\r\n GLTFBinaryExtension.prototype.loadTextureBufferAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n var texture = gltfRuntime.textures[id];\r\n var source = gltfRuntime.images[texture.source];\r\n if (!source.extensions || !(this.name in source.extensions)) {\r\n return false;\r\n }\r\n var sourceExt = source.extensions[this.name];\r\n var bufferView = gltfRuntime.bufferViews[sourceExt.bufferView];\r\n var buffer = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);\r\n onSuccess(buffer);\r\n return true;\r\n };\r\n GLTFBinaryExtension.prototype.loadShaderStringAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n var shader = gltfRuntime.shaders[id];\r\n if (!shader.extensions || !(this.name in shader.extensions)) {\r\n return false;\r\n }\r\n var binaryExtensionShader = shader.extensions[this.name];\r\n var bufferView = gltfRuntime.bufferViews[binaryExtensionShader.bufferView];\r\n var shaderBytes = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);\r\n setTimeout(function () {\r\n var shaderString = GLTFUtils.DecodeBufferToText(shaderBytes);\r\n onSuccess(shaderString);\r\n });\r\n return true;\r\n };\r\n return GLTFBinaryExtension;\r\n}(GLTFLoaderExtension));\r\nexport { GLTFBinaryExtension };\r\nGLTFLoader.RegisterExtension(new GLTFBinaryExtension());\r\n//# sourceMappingURL=glTFBinaryExtension.js.map","import { __extends } from \"tslib\";\r\nimport { GLTFLoaderExtension } from \"./glTFLoader\";\r\nimport { GLTFLoaderBase } from \"./glTFLoader\";\r\nimport { Vector3 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Material } from \"@babylonjs/core/Materials/material\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { HemisphericLight } from \"@babylonjs/core/Lights/hemisphericLight\";\r\nimport { DirectionalLight } from \"@babylonjs/core/Lights/directionalLight\";\r\nimport { PointLight } from \"@babylonjs/core/Lights/pointLight\";\r\nimport { SpotLight } from \"@babylonjs/core/Lights/spotLight\";\r\nimport { GLTFLoader } from \"./glTFLoader\";\r\n/** @hidden */\r\nvar GLTFMaterialsCommonExtension = /** @class */ (function (_super) {\r\n __extends(GLTFMaterialsCommonExtension, _super);\r\n function GLTFMaterialsCommonExtension() {\r\n return _super.call(this, \"KHR_materials_common\") || this;\r\n }\r\n GLTFMaterialsCommonExtension.prototype.loadRuntimeExtensionsAsync = function (gltfRuntime, onSuccess, onError) {\r\n if (!gltfRuntime.extensions) {\r\n return false;\r\n }\r\n var extension = gltfRuntime.extensions[this.name];\r\n if (!extension) {\r\n return false;\r\n }\r\n // Create lights\r\n var lights = extension.lights;\r\n if (lights) {\r\n for (var thing in lights) {\r\n var light = lights[thing];\r\n switch (light.type) {\r\n case \"ambient\":\r\n var ambientLight = new HemisphericLight(light.name, new Vector3(0, 1, 0), gltfRuntime.scene);\r\n var ambient = light.ambient;\r\n if (ambient) {\r\n ambientLight.diffuse = Color3.FromArray(ambient.color || [1, 1, 1]);\r\n }\r\n break;\r\n case \"point\":\r\n var pointLight = new PointLight(light.name, new Vector3(10, 10, 10), gltfRuntime.scene);\r\n var point = light.point;\r\n if (point) {\r\n pointLight.diffuse = Color3.FromArray(point.color || [1, 1, 1]);\r\n }\r\n break;\r\n case \"directional\":\r\n var dirLight = new DirectionalLight(light.name, new Vector3(0, -1, 0), gltfRuntime.scene);\r\n var directional = light.directional;\r\n if (directional) {\r\n dirLight.diffuse = Color3.FromArray(directional.color || [1, 1, 1]);\r\n }\r\n break;\r\n case \"spot\":\r\n var spot = light.spot;\r\n if (spot) {\r\n var spotLight = new SpotLight(light.name, new Vector3(0, 10, 0), new Vector3(0, -1, 0), spot.fallOffAngle || Math.PI, spot.fallOffExponent || 0.0, gltfRuntime.scene);\r\n spotLight.diffuse = Color3.FromArray(spot.color || [1, 1, 1]);\r\n }\r\n break;\r\n default:\r\n Tools.Warn(\"GLTF Material Common extension: light type \\\"\" + light.type + \"\\” not supported\");\r\n break;\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n GLTFMaterialsCommonExtension.prototype.loadMaterialAsync = function (gltfRuntime, id, onSuccess, onError) {\r\n var material = gltfRuntime.materials[id];\r\n if (!material || !material.extensions) {\r\n return false;\r\n }\r\n var extension = material.extensions[this.name];\r\n if (!extension) {\r\n return false;\r\n }\r\n var standardMaterial = new StandardMaterial(id, gltfRuntime.scene);\r\n standardMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\r\n if (extension.technique === \"CONSTANT\") {\r\n standardMaterial.disableLighting = true;\r\n }\r\n standardMaterial.backFaceCulling = extension.doubleSided === undefined ? false : !extension.doubleSided;\r\n standardMaterial.alpha = extension.values.transparency === undefined ? 1.0 : extension.values.transparency;\r\n standardMaterial.specularPower = extension.values.shininess === undefined ? 0.0 : extension.values.shininess;\r\n // Ambient\r\n if (typeof extension.values.ambient === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.ambient, standardMaterial, \"ambientTexture\", onError);\r\n }\r\n else {\r\n standardMaterial.ambientColor = Color3.FromArray(extension.values.ambient || [0, 0, 0]);\r\n }\r\n // Diffuse\r\n if (typeof extension.values.diffuse === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.diffuse, standardMaterial, \"diffuseTexture\", onError);\r\n }\r\n else {\r\n standardMaterial.diffuseColor = Color3.FromArray(extension.values.diffuse || [0, 0, 0]);\r\n }\r\n // Emission\r\n if (typeof extension.values.emission === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.emission, standardMaterial, \"emissiveTexture\", onError);\r\n }\r\n else {\r\n standardMaterial.emissiveColor = Color3.FromArray(extension.values.emission || [0, 0, 0]);\r\n }\r\n // Specular\r\n if (typeof extension.values.specular === \"string\") {\r\n this._loadTexture(gltfRuntime, extension.values.specular, standardMaterial, \"specularTexture\", onError);\r\n }\r\n else {\r\n standardMaterial.specularColor = Color3.FromArray(extension.values.specular || [0, 0, 0]);\r\n }\r\n return true;\r\n };\r\n GLTFMaterialsCommonExtension.prototype._loadTexture = function (gltfRuntime, id, material, propertyPath, onError) {\r\n // Create buffer from texture url\r\n GLTFLoaderBase.LoadTextureBufferAsync(gltfRuntime, id, function (buffer) {\r\n // Create texture from buffer\r\n GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, function (texture) { return material[propertyPath] = texture; }, onError);\r\n }, onError);\r\n };\r\n return GLTFMaterialsCommonExtension;\r\n}(GLTFLoaderExtension));\r\nexport { GLTFMaterialsCommonExtension };\r\nGLTFLoader.RegisterExtension(new GLTFMaterialsCommonExtension());\r\n//# sourceMappingURL=glTFMaterialsCommonExtension.js.map","/**\r\n * Wrapper class for promise with external resolve and reject.\r\n */\r\nvar Deferred = /** @class */ (function () {\r\n /**\r\n * Constructor for this deferred object.\r\n */\r\n function Deferred() {\r\n var _this = this;\r\n this.promise = new Promise(function (resolve, reject) {\r\n _this._resolve = resolve;\r\n _this._reject = reject;\r\n });\r\n }\r\n Object.defineProperty(Deferred.prototype, \"resolve\", {\r\n /**\r\n * The resolve method of the promise associated with this deferred object.\r\n */\r\n get: function () {\r\n return this._resolve;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Deferred.prototype, \"reject\", {\r\n /**\r\n * The reject method of the promise associated with this deferred object.\r\n */\r\n get: function () {\r\n return this._reject;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return Deferred;\r\n}());\r\nexport { Deferred };\r\n//# sourceMappingURL=deferred.js.map","import { Quaternion, Vector3, Vector2, Matrix } from \"../Maths/math.vector\";\r\nimport { Color3 } from '../Maths/math.color';\r\nimport { Animation } from \"./animation\";\r\nimport { Size } from '../Maths/math.size';\r\n// Static values to help the garbage collector\r\n// Quaternion\r\nvar _staticOffsetValueQuaternion = Object.freeze(new Quaternion(0, 0, 0, 0));\r\n// Vector3\r\nvar _staticOffsetValueVector3 = Object.freeze(Vector3.Zero());\r\n// Vector2\r\nvar _staticOffsetValueVector2 = Object.freeze(Vector2.Zero());\r\n// Size\r\nvar _staticOffsetValueSize = Object.freeze(Size.Zero());\r\n// Color3\r\nvar _staticOffsetValueColor3 = Object.freeze(Color3.Black());\r\n/**\r\n * Defines a runtime animation\r\n */\r\nvar RuntimeAnimation = /** @class */ (function () {\r\n /**\r\n * Create a new RuntimeAnimation object\r\n * @param target defines the target of the animation\r\n * @param animation defines the source animation object\r\n * @param scene defines the hosting scene\r\n * @param host defines the initiating Animatable\r\n */\r\n function RuntimeAnimation(target, animation, scene, host) {\r\n var _this = this;\r\n this._events = new Array();\r\n /**\r\n * The current frame of the runtime animation\r\n */\r\n this._currentFrame = 0;\r\n /**\r\n * The original value of the runtime animation\r\n */\r\n this._originalValue = new Array();\r\n /**\r\n * The original blend value of the runtime animation\r\n */\r\n this._originalBlendValue = null;\r\n /**\r\n * The offsets cache of the runtime animation\r\n */\r\n this._offsetsCache = {};\r\n /**\r\n * The high limits cache of the runtime animation\r\n */\r\n this._highLimitsCache = {};\r\n /**\r\n * Specifies if the runtime animation has been stopped\r\n */\r\n this._stopped = false;\r\n /**\r\n * The blending factor of the runtime animation\r\n */\r\n this._blendingFactor = 0;\r\n /**\r\n * The current value of the runtime animation\r\n */\r\n this._currentValue = null;\r\n this._currentActiveTarget = null;\r\n this._directTarget = null;\r\n /**\r\n * The target path of the runtime animation\r\n */\r\n this._targetPath = \"\";\r\n /**\r\n * The weight of the runtime animation\r\n */\r\n this._weight = 1.0;\r\n /**\r\n * The ratio offset of the runtime animation\r\n */\r\n this._ratioOffset = 0;\r\n /**\r\n * The previous delay of the runtime animation\r\n */\r\n this._previousDelay = 0;\r\n /**\r\n * The previous ratio of the runtime animation\r\n */\r\n this._previousRatio = 0;\r\n this._targetIsArray = false;\r\n this._animation = animation;\r\n this._target = target;\r\n this._scene = scene;\r\n this._host = host;\r\n this._activeTargets = [];\r\n animation._runtimeAnimations.push(this);\r\n // State\r\n this._animationState = {\r\n key: 0,\r\n repeatCount: 0,\r\n loopMode: this._getCorrectLoopMode()\r\n };\r\n if (this._animation.dataType === Animation.ANIMATIONTYPE_MATRIX) {\r\n this._animationState.workValue = Matrix.Zero();\r\n }\r\n // Limits\r\n this._keys = this._animation.getKeys();\r\n this._minFrame = this._keys[0].frame;\r\n this._maxFrame = this._keys[this._keys.length - 1].frame;\r\n this._minValue = this._keys[0].value;\r\n this._maxValue = this._keys[this._keys.length - 1].value;\r\n // Add a start key at frame 0 if missing\r\n if (this._minFrame !== 0) {\r\n var newKey = { frame: 0, value: this._minValue };\r\n this._keys.splice(0, 0, newKey);\r\n }\r\n // Check data\r\n if (this._target instanceof Array) {\r\n var index = 0;\r\n for (var _i = 0, _a = this._target; _i < _a.length; _i++) {\r\n var target_1 = _a[_i];\r\n this._preparePath(target_1, index);\r\n this._getOriginalValues(index);\r\n index++;\r\n }\r\n this._targetIsArray = true;\r\n }\r\n else {\r\n this._preparePath(this._target);\r\n this._getOriginalValues();\r\n this._targetIsArray = false;\r\n this._directTarget = this._activeTargets[0];\r\n }\r\n // Cloning events locally\r\n var events = animation.getEvents();\r\n if (events && events.length > 0) {\r\n events.forEach(function (e) {\r\n _this._events.push(e._clone());\r\n });\r\n }\r\n this._enableBlending = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;\r\n }\r\n Object.defineProperty(RuntimeAnimation.prototype, \"currentFrame\", {\r\n /**\r\n * Gets the current frame of the runtime animation\r\n */\r\n get: function () {\r\n return this._currentFrame;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"weight\", {\r\n /**\r\n * Gets the weight of the runtime animation\r\n */\r\n get: function () {\r\n return this._weight;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"currentValue\", {\r\n /**\r\n * Gets the current value of the runtime animation\r\n */\r\n get: function () {\r\n return this._currentValue;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"targetPath\", {\r\n /**\r\n * Gets the target path of the runtime animation\r\n */\r\n get: function () {\r\n return this._targetPath;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"target\", {\r\n /**\r\n * Gets the actual target of the runtime animation\r\n */\r\n get: function () {\r\n return this._currentActiveTarget;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(RuntimeAnimation.prototype, \"isAdditive\", {\r\n /**\r\n * Gets the additive state of the runtime animation\r\n */\r\n get: function () {\r\n return this._host && this._host.isAdditive;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n RuntimeAnimation.prototype._preparePath = function (target, targetIndex) {\r\n if (targetIndex === void 0) { targetIndex = 0; }\r\n var targetPropertyPath = this._animation.targetPropertyPath;\r\n if (targetPropertyPath.length > 1) {\r\n var property = target[targetPropertyPath[0]];\r\n for (var index = 1; index < targetPropertyPath.length - 1; index++) {\r\n property = property[targetPropertyPath[index]];\r\n }\r\n this._targetPath = targetPropertyPath[targetPropertyPath.length - 1];\r\n this._activeTargets[targetIndex] = property;\r\n }\r\n else {\r\n this._targetPath = targetPropertyPath[0];\r\n this._activeTargets[targetIndex] = target;\r\n }\r\n };\r\n Object.defineProperty(RuntimeAnimation.prototype, \"animation\", {\r\n /**\r\n * Gets the animation from the runtime animation\r\n */\r\n get: function () {\r\n return this._animation;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Resets the runtime animation to the beginning\r\n * @param restoreOriginal defines whether to restore the target property to the original value\r\n */\r\n RuntimeAnimation.prototype.reset = function (restoreOriginal) {\r\n if (restoreOriginal === void 0) { restoreOriginal = false; }\r\n if (restoreOriginal) {\r\n if (this._target instanceof Array) {\r\n var index = 0;\r\n for (var _i = 0, _a = this._target; _i < _a.length; _i++) {\r\n var target = _a[_i];\r\n if (this._originalValue[index] !== undefined) {\r\n this._setValue(target, this._activeTargets[index], this._originalValue[index], -1, index);\r\n }\r\n index++;\r\n }\r\n }\r\n else {\r\n if (this._originalValue[0] !== undefined) {\r\n this._setValue(this._target, this._directTarget, this._originalValue[0], -1, 0);\r\n }\r\n }\r\n }\r\n this._offsetsCache = {};\r\n this._highLimitsCache = {};\r\n this._currentFrame = 0;\r\n this._blendingFactor = 0;\r\n // Events\r\n for (var index = 0; index < this._events.length; index++) {\r\n this._events[index].isDone = false;\r\n }\r\n };\r\n /**\r\n * Specifies if the runtime animation is stopped\r\n * @returns Boolean specifying if the runtime animation is stopped\r\n */\r\n RuntimeAnimation.prototype.isStopped = function () {\r\n return this._stopped;\r\n };\r\n /**\r\n * Disposes of the runtime animation\r\n */\r\n RuntimeAnimation.prototype.dispose = function () {\r\n var index = this._animation.runtimeAnimations.indexOf(this);\r\n if (index > -1) {\r\n this._animation.runtimeAnimations.splice(index, 1);\r\n }\r\n };\r\n /**\r\n * Apply the interpolated value to the target\r\n * @param currentValue defines the value computed by the animation\r\n * @param weight defines the weight to apply to this value (Defaults to 1.0)\r\n */\r\n RuntimeAnimation.prototype.setValue = function (currentValue, weight) {\r\n if (this._targetIsArray) {\r\n for (var index = 0; index < this._target.length; index++) {\r\n var target = this._target[index];\r\n this._setValue(target, this._activeTargets[index], currentValue, weight, index);\r\n }\r\n return;\r\n }\r\n this._setValue(this._target, this._directTarget, currentValue, weight, 0);\r\n };\r\n RuntimeAnimation.prototype._getOriginalValues = function (targetIndex) {\r\n if (targetIndex === void 0) { targetIndex = 0; }\r\n var originalValue;\r\n var target = this._activeTargets[targetIndex];\r\n if (target.getRestPose && this._targetPath === \"_matrix\") { // For bones\r\n originalValue = target.getRestPose();\r\n }\r\n else {\r\n originalValue = target[this._targetPath];\r\n }\r\n if (originalValue && originalValue.clone) {\r\n this._originalValue[targetIndex] = originalValue.clone();\r\n }\r\n else {\r\n this._originalValue[targetIndex] = originalValue;\r\n }\r\n };\r\n RuntimeAnimation.prototype._setValue = function (target, destination, currentValue, weight, targetIndex) {\r\n // Set value\r\n this._currentActiveTarget = destination;\r\n this._weight = weight;\r\n if (this._enableBlending && this._blendingFactor <= 1.0) {\r\n if (!this._originalBlendValue) {\r\n var originalValue = destination[this._targetPath];\r\n if (originalValue.clone) {\r\n this._originalBlendValue = originalValue.clone();\r\n }\r\n else {\r\n this._originalBlendValue = originalValue;\r\n }\r\n }\r\n if (this._originalBlendValue.m) { // Matrix\r\n if (Animation.AllowMatrixDecomposeForInterpolation) {\r\n if (this._currentValue) {\r\n Matrix.DecomposeLerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);\r\n }\r\n else {\r\n this._currentValue = Matrix.DecomposeLerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n }\r\n else {\r\n if (this._currentValue) {\r\n Matrix.LerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);\r\n }\r\n else {\r\n this._currentValue = Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n }\r\n }\r\n else {\r\n this._currentValue = Animation._UniversalLerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n var blendingSpeed = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;\r\n this._blendingFactor += blendingSpeed;\r\n }\r\n else {\r\n this._currentValue = currentValue;\r\n }\r\n if (weight !== -1.0) {\r\n this._scene._registerTargetForLateAnimationBinding(this, this._originalValue[targetIndex]);\r\n }\r\n else {\r\n destination[this._targetPath] = this._currentValue;\r\n }\r\n if (target.markAsDirty) {\r\n target.markAsDirty(this._animation.targetProperty);\r\n }\r\n };\r\n /**\r\n * Gets the loop pmode of the runtime animation\r\n * @returns Loop Mode\r\n */\r\n RuntimeAnimation.prototype._getCorrectLoopMode = function () {\r\n if (this._target && this._target.animationPropertiesOverride) {\r\n return this._target.animationPropertiesOverride.loopMode;\r\n }\r\n return this._animation.loopMode;\r\n };\r\n /**\r\n * Move the current animation to a given frame\r\n * @param frame defines the frame to move to\r\n */\r\n RuntimeAnimation.prototype.goToFrame = function (frame) {\r\n var keys = this._animation.getKeys();\r\n if (frame < keys[0].frame) {\r\n frame = keys[0].frame;\r\n }\r\n else if (frame > keys[keys.length - 1].frame) {\r\n frame = keys[keys.length - 1].frame;\r\n }\r\n // Need to reset animation events\r\n var events = this._events;\r\n if (events.length) {\r\n for (var index = 0; index < events.length; index++) {\r\n if (!events[index].onlyOnce) {\r\n // reset events in the future\r\n events[index].isDone = events[index].frame < frame;\r\n }\r\n }\r\n }\r\n this._currentFrame = frame;\r\n var currentValue = this._animation._interpolate(frame, this._animationState);\r\n this.setValue(currentValue, -1);\r\n };\r\n /**\r\n * @hidden Internal use only\r\n */\r\n RuntimeAnimation.prototype._prepareForSpeedRatioChange = function (newSpeedRatio) {\r\n var newRatio = this._previousDelay * (this._animation.framePerSecond * newSpeedRatio) / 1000.0;\r\n this._ratioOffset = this._previousRatio - newRatio;\r\n };\r\n /**\r\n * Execute the current animation\r\n * @param delay defines the delay to add to the current frame\r\n * @param from defines the lower bound of the animation range\r\n * @param to defines the upper bound of the animation range\r\n * @param loop defines if the current animation must loop\r\n * @param speedRatio defines the current speed ratio\r\n * @param weight defines the weight of the animation (default is -1 so no weight)\r\n * @param onLoop optional callback called when animation loops\r\n * @returns a boolean indicating if the animation is running\r\n */\r\n RuntimeAnimation.prototype.animate = function (delay, from, to, loop, speedRatio, weight) {\r\n if (weight === void 0) { weight = -1.0; }\r\n var animation = this._animation;\r\n var targetPropertyPath = animation.targetPropertyPath;\r\n if (!targetPropertyPath || targetPropertyPath.length < 1) {\r\n this._stopped = true;\r\n return false;\r\n }\r\n var returnValue = true;\r\n // Check limits\r\n if (from < this._minFrame || from > this._maxFrame) {\r\n from = this._minFrame;\r\n }\r\n if (to < this._minFrame || to > this._maxFrame) {\r\n to = this._maxFrame;\r\n }\r\n var range = to - from;\r\n var offsetValue;\r\n // Compute ratio which represents the frame delta between from and to\r\n var ratio = (delay * (animation.framePerSecond * speedRatio) / 1000.0) + this._ratioOffset;\r\n var highLimitValue = 0;\r\n this._previousDelay = delay;\r\n this._previousRatio = ratio;\r\n if (!loop && (to >= from && ratio >= range)) { // If we are out of range and not looping get back to caller\r\n returnValue = false;\r\n highLimitValue = animation._getKeyValue(this._maxValue);\r\n }\r\n else if (!loop && (from >= to && ratio <= range)) {\r\n returnValue = false;\r\n highLimitValue = animation._getKeyValue(this._minValue);\r\n }\r\n else if (this._animationState.loopMode !== Animation.ANIMATIONLOOPMODE_CYCLE) {\r\n var keyOffset = to.toString() + from.toString();\r\n if (!this._offsetsCache[keyOffset]) {\r\n this._animationState.repeatCount = 0;\r\n this._animationState.loopMode = Animation.ANIMATIONLOOPMODE_CYCLE;\r\n var fromValue = animation._interpolate(from, this._animationState);\r\n var toValue = animation._interpolate(to, this._animationState);\r\n this._animationState.loopMode = this._getCorrectLoopMode();\r\n switch (animation.dataType) {\r\n // Float\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n this._offsetsCache[keyOffset] = toValue - fromValue;\r\n break;\r\n // Quaternion\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n break;\r\n // Vector3\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n // Vector2\r\n case Animation.ANIMATIONTYPE_VECTOR2:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n // Size\r\n case Animation.ANIMATIONTYPE_SIZE:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n // Color3\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n default:\r\n break;\r\n }\r\n this._highLimitsCache[keyOffset] = toValue;\r\n }\r\n highLimitValue = this._highLimitsCache[keyOffset];\r\n offsetValue = this._offsetsCache[keyOffset];\r\n }\r\n if (offsetValue === undefined) {\r\n switch (animation.dataType) {\r\n // Float\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n offsetValue = 0;\r\n break;\r\n // Quaternion\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n offsetValue = _staticOffsetValueQuaternion;\r\n break;\r\n // Vector3\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n offsetValue = _staticOffsetValueVector3;\r\n break;\r\n // Vector2\r\n case Animation.ANIMATIONTYPE_VECTOR2:\r\n offsetValue = _staticOffsetValueVector2;\r\n break;\r\n // Size\r\n case Animation.ANIMATIONTYPE_SIZE:\r\n offsetValue = _staticOffsetValueSize;\r\n break;\r\n // Color3\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n offsetValue = _staticOffsetValueColor3;\r\n }\r\n }\r\n // Compute value\r\n var currentFrame;\r\n if (this._host && this._host.syncRoot) {\r\n var syncRoot = this._host.syncRoot;\r\n var hostNormalizedFrame = (syncRoot.masterFrame - syncRoot.fromFrame) / (syncRoot.toFrame - syncRoot.fromFrame);\r\n currentFrame = from + (to - from) * hostNormalizedFrame;\r\n }\r\n else {\r\n currentFrame = (returnValue && range !== 0) ? from + ratio % range : to;\r\n }\r\n // Reset events if looping\r\n var events = this._events;\r\n if (range > 0 && this.currentFrame > currentFrame ||\r\n range < 0 && this.currentFrame < currentFrame) {\r\n this._onLoop();\r\n // Need to reset animation events\r\n if (events.length) {\r\n for (var index = 0; index < events.length; index++) {\r\n if (!events[index].onlyOnce) {\r\n // reset event, the animation is looping\r\n events[index].isDone = false;\r\n }\r\n }\r\n }\r\n }\r\n this._currentFrame = currentFrame;\r\n this._animationState.repeatCount = range === 0 ? 0 : (ratio / range) >> 0;\r\n this._animationState.highLimitValue = highLimitValue;\r\n this._animationState.offsetValue = offsetValue;\r\n var currentValue = animation._interpolate(currentFrame, this._animationState);\r\n // Set value\r\n this.setValue(currentValue, weight);\r\n // Check events\r\n if (events.length) {\r\n for (var index = 0; index < events.length; index++) {\r\n // Make sure current frame has passed event frame and that event frame is within the current range\r\n // Also, handle both forward and reverse animations\r\n if ((range > 0 && currentFrame >= events[index].frame && events[index].frame >= from) ||\r\n (range < 0 && currentFrame <= events[index].frame && events[index].frame <= from)) {\r\n var event = events[index];\r\n if (!event.isDone) {\r\n // If event should be done only once, remove it.\r\n if (event.onlyOnce) {\r\n events.splice(index, 1);\r\n index--;\r\n }\r\n event.isDone = true;\r\n event.action(currentFrame);\r\n } // Don't do anything if the event has already be done.\r\n }\r\n }\r\n }\r\n if (!returnValue) {\r\n this._stopped = true;\r\n }\r\n return returnValue;\r\n };\r\n return RuntimeAnimation;\r\n}());\r\nexport { RuntimeAnimation };\r\n//# sourceMappingURL=runtimeAnimation.js.map","import { Animation } from \"./animation\";\r\nimport { RuntimeAnimation } from \"./runtimeAnimation\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Scene } from \"../scene\";\r\nimport { Matrix, Quaternion, Vector3, TmpVectors } from '../Maths/math.vector';\r\nimport { PrecisionDate } from '../Misc/precisionDate';\r\nimport { Bone } from '../Bones/bone';\r\n/**\r\n * Class used to store an actual running animation\r\n */\r\nvar Animatable = /** @class */ (function () {\r\n /**\r\n * Creates a new Animatable\r\n * @param scene defines the hosting scene\r\n * @param target defines the target object\r\n * @param fromFrame defines the starting frame number (default is 0)\r\n * @param toFrame defines the ending frame number (default is 100)\r\n * @param loopAnimation defines if the animation must loop (default is false)\r\n * @param speedRatio defines the factor to apply to animation speed (default is 1)\r\n * @param onAnimationEnd defines a callback to call when animation ends if it is not looping\r\n * @param animations defines a group of animation to add to the new Animatable\r\n * @param onAnimationLoop defines a callback to call when animation loops\r\n * @param isAdditive defines whether the animation should be evaluated additively\r\n */\r\n function Animatable(scene, \r\n /** defines the target object */\r\n target, \r\n /** defines the starting frame number (default is 0) */\r\n fromFrame, \r\n /** defines the ending frame number (default is 100) */\r\n toFrame, \r\n /** defines if the animation must loop (default is false) */\r\n loopAnimation, speedRatio, \r\n /** defines a callback to call when animation ends if it is not looping */\r\n onAnimationEnd, animations, \r\n /** defines a callback to call when animation loops */\r\n onAnimationLoop, \r\n /** defines whether the animation should be evaluated additively */\r\n isAdditive) {\r\n if (fromFrame === void 0) { fromFrame = 0; }\r\n if (toFrame === void 0) { toFrame = 100; }\r\n if (loopAnimation === void 0) { loopAnimation = false; }\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n if (isAdditive === void 0) { isAdditive = false; }\r\n this.target = target;\r\n this.fromFrame = fromFrame;\r\n this.toFrame = toFrame;\r\n this.loopAnimation = loopAnimation;\r\n this.onAnimationEnd = onAnimationEnd;\r\n this.onAnimationLoop = onAnimationLoop;\r\n this.isAdditive = isAdditive;\r\n this._localDelayOffset = null;\r\n this._pausedDelay = null;\r\n this._runtimeAnimations = new Array();\r\n this._paused = false;\r\n this._speedRatio = 1;\r\n this._weight = -1.0;\r\n this._syncRoot = null;\r\n /**\r\n * Gets or sets a boolean indicating if the animatable must be disposed and removed at the end of the animation.\r\n * This will only apply for non looping animation (default is true)\r\n */\r\n this.disposeOnEnd = true;\r\n /**\r\n * Gets a boolean indicating if the animation has started\r\n */\r\n this.animationStarted = false;\r\n /**\r\n * Observer raised when the animation ends\r\n */\r\n this.onAnimationEndObservable = new Observable();\r\n /**\r\n * Observer raised when the animation loops\r\n */\r\n this.onAnimationLoopObservable = new Observable();\r\n this._scene = scene;\r\n if (animations) {\r\n this.appendAnimations(target, animations);\r\n }\r\n this._speedRatio = speedRatio;\r\n scene._activeAnimatables.push(this);\r\n }\r\n Object.defineProperty(Animatable.prototype, \"syncRoot\", {\r\n /**\r\n * Gets the root Animatable used to synchronize and normalize animations\r\n */\r\n get: function () {\r\n return this._syncRoot;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animatable.prototype, \"masterFrame\", {\r\n /**\r\n * Gets the current frame of the first RuntimeAnimation\r\n * Used to synchronize Animatables\r\n */\r\n get: function () {\r\n if (this._runtimeAnimations.length === 0) {\r\n return 0;\r\n }\r\n return this._runtimeAnimations[0].currentFrame;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animatable.prototype, \"weight\", {\r\n /**\r\n * Gets or sets the animatable weight (-1.0 by default meaning not weighted)\r\n */\r\n get: function () {\r\n return this._weight;\r\n },\r\n set: function (value) {\r\n if (value === -1) { // -1 is ok and means no weight\r\n this._weight = -1;\r\n return;\r\n }\r\n // Else weight must be in [0, 1] range\r\n this._weight = Math.min(Math.max(value, 0), 1.0);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Animatable.prototype, \"speedRatio\", {\r\n /**\r\n * Gets or sets the speed ratio to apply to the animatable (1.0 by default)\r\n */\r\n get: function () {\r\n return this._speedRatio;\r\n },\r\n set: function (value) {\r\n for (var index = 0; index < this._runtimeAnimations.length; index++) {\r\n var animation = this._runtimeAnimations[index];\r\n animation._prepareForSpeedRatioChange(value);\r\n }\r\n this._speedRatio = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Methods\r\n /**\r\n * Synchronize and normalize current Animatable with a source Animatable\r\n * This is useful when using animation weights and when animations are not of the same length\r\n * @param root defines the root Animatable to synchronize with\r\n * @returns the current Animatable\r\n */\r\n Animatable.prototype.syncWith = function (root) {\r\n this._syncRoot = root;\r\n if (root) {\r\n // Make sure this animatable will animate after the root\r\n var index = this._scene._activeAnimatables.indexOf(this);\r\n if (index > -1) {\r\n this._scene._activeAnimatables.splice(index, 1);\r\n this._scene._activeAnimatables.push(this);\r\n }\r\n }\r\n return this;\r\n };\r\n /**\r\n * Gets the list of runtime animations\r\n * @returns an array of RuntimeAnimation\r\n */\r\n Animatable.prototype.getAnimations = function () {\r\n return this._runtimeAnimations;\r\n };\r\n /**\r\n * Adds more animations to the current animatable\r\n * @param target defines the target of the animations\r\n * @param animations defines the new animations to add\r\n */\r\n Animatable.prototype.appendAnimations = function (target, animations) {\r\n var _this = this;\r\n for (var index = 0; index < animations.length; index++) {\r\n var animation = animations[index];\r\n var newRuntimeAnimation = new RuntimeAnimation(target, animation, this._scene, this);\r\n newRuntimeAnimation._onLoop = function () {\r\n _this.onAnimationLoopObservable.notifyObservers(_this);\r\n if (_this.onAnimationLoop) {\r\n _this.onAnimationLoop();\r\n }\r\n };\r\n this._runtimeAnimations.push(newRuntimeAnimation);\r\n }\r\n };\r\n /**\r\n * Gets the source animation for a specific property\r\n * @param property defines the propertyu to look for\r\n * @returns null or the source animation for the given property\r\n */\r\n Animatable.prototype.getAnimationByTargetProperty = function (property) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n if (runtimeAnimations[index].animation.targetProperty === property) {\r\n return runtimeAnimations[index].animation;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets the runtime animation for a specific property\r\n * @param property defines the propertyu to look for\r\n * @returns null or the runtime animation for the given property\r\n */\r\n Animatable.prototype.getRuntimeAnimationByTargetProperty = function (property) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n if (runtimeAnimations[index].animation.targetProperty === property) {\r\n return runtimeAnimations[index];\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Resets the animatable to its original state\r\n */\r\n Animatable.prototype.reset = function () {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].reset(true);\r\n }\r\n this._localDelayOffset = null;\r\n this._pausedDelay = null;\r\n };\r\n /**\r\n * Allows the animatable to blend with current running animations\r\n * @see https://doc.babylonjs.com/babylon101/animations#animation-blending\r\n * @param blendingSpeed defines the blending speed to use\r\n */\r\n Animatable.prototype.enableBlending = function (blendingSpeed) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].animation.enableBlending = true;\r\n runtimeAnimations[index].animation.blendingSpeed = blendingSpeed;\r\n }\r\n };\r\n /**\r\n * Disable animation blending\r\n * @see https://doc.babylonjs.com/babylon101/animations#animation-blending\r\n */\r\n Animatable.prototype.disableBlending = function () {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].animation.enableBlending = false;\r\n }\r\n };\r\n /**\r\n * Jump directly to a given frame\r\n * @param frame defines the frame to jump to\r\n */\r\n Animatable.prototype.goToFrame = function (frame) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n if (runtimeAnimations[0]) {\r\n var fps = runtimeAnimations[0].animation.framePerSecond;\r\n var currentFrame = runtimeAnimations[0].currentFrame;\r\n var delay = this.speedRatio === 0 ? 0 : ((frame - currentFrame) / fps * 1000) / this.speedRatio;\r\n if (this._localDelayOffset === null) {\r\n this._localDelayOffset = 0;\r\n }\r\n this._localDelayOffset -= delay;\r\n }\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].goToFrame(frame);\r\n }\r\n };\r\n /**\r\n * Pause the animation\r\n */\r\n Animatable.prototype.pause = function () {\r\n if (this._paused) {\r\n return;\r\n }\r\n this._paused = true;\r\n };\r\n /**\r\n * Restart the animation\r\n */\r\n Animatable.prototype.restart = function () {\r\n this._paused = false;\r\n };\r\n Animatable.prototype._raiseOnAnimationEnd = function () {\r\n if (this.onAnimationEnd) {\r\n this.onAnimationEnd();\r\n }\r\n this.onAnimationEndObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Stop and delete the current animation\r\n * @param animationName defines a string used to only stop some of the runtime animations instead of all\r\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n */\r\n Animatable.prototype.stop = function (animationName, targetMask) {\r\n if (animationName || targetMask) {\r\n var idx = this._scene._activeAnimatables.indexOf(this);\r\n if (idx > -1) {\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = runtimeAnimations.length - 1; index >= 0; index--) {\r\n var runtimeAnimation = runtimeAnimations[index];\r\n if (animationName && runtimeAnimation.animation.name != animationName) {\r\n continue;\r\n }\r\n if (targetMask && !targetMask(runtimeAnimation.target)) {\r\n continue;\r\n }\r\n runtimeAnimation.dispose();\r\n runtimeAnimations.splice(index, 1);\r\n }\r\n if (runtimeAnimations.length == 0) {\r\n this._scene._activeAnimatables.splice(idx, 1);\r\n this._raiseOnAnimationEnd();\r\n }\r\n }\r\n }\r\n else {\r\n var index = this._scene._activeAnimatables.indexOf(this);\r\n if (index > -1) {\r\n this._scene._activeAnimatables.splice(index, 1);\r\n var runtimeAnimations = this._runtimeAnimations;\r\n for (var index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].dispose();\r\n }\r\n this._raiseOnAnimationEnd();\r\n }\r\n }\r\n };\r\n /**\r\n * Wait asynchronously for the animation to end\r\n * @returns a promise which will be fullfilled when the animation ends\r\n */\r\n Animatable.prototype.waitAsync = function () {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n _this.onAnimationEndObservable.add(function () {\r\n resolve(_this);\r\n }, undefined, undefined, _this, true);\r\n });\r\n };\r\n /** @hidden */\r\n Animatable.prototype._animate = function (delay) {\r\n if (this._paused) {\r\n this.animationStarted = false;\r\n if (this._pausedDelay === null) {\r\n this._pausedDelay = delay;\r\n }\r\n return true;\r\n }\r\n if (this._localDelayOffset === null) {\r\n this._localDelayOffset = delay;\r\n this._pausedDelay = null;\r\n }\r\n else if (this._pausedDelay !== null) {\r\n this._localDelayOffset += delay - this._pausedDelay;\r\n this._pausedDelay = null;\r\n }\r\n if (this._weight === 0) { // We consider that an animation with a weight === 0 is \"actively\" paused\r\n return true;\r\n }\r\n // Animating\r\n var running = false;\r\n var runtimeAnimations = this._runtimeAnimations;\r\n var index;\r\n for (index = 0; index < runtimeAnimations.length; index++) {\r\n var animation = runtimeAnimations[index];\r\n var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio, this._weight);\r\n running = running || isRunning;\r\n }\r\n this.animationStarted = running;\r\n if (!running) {\r\n if (this.disposeOnEnd) {\r\n // Remove from active animatables\r\n index = this._scene._activeAnimatables.indexOf(this);\r\n this._scene._activeAnimatables.splice(index, 1);\r\n // Dispose all runtime animations\r\n for (index = 0; index < runtimeAnimations.length; index++) {\r\n runtimeAnimations[index].dispose();\r\n }\r\n }\r\n this._raiseOnAnimationEnd();\r\n if (this.disposeOnEnd) {\r\n this.onAnimationEnd = null;\r\n this.onAnimationLoop = null;\r\n this.onAnimationLoopObservable.clear();\r\n this.onAnimationEndObservable.clear();\r\n }\r\n }\r\n return running;\r\n };\r\n return Animatable;\r\n}());\r\nexport { Animatable };\r\nScene.prototype._animate = function () {\r\n if (!this.animationsEnabled) {\r\n return;\r\n }\r\n // Getting time\r\n var now = PrecisionDate.Now;\r\n if (!this._animationTimeLast) {\r\n if (this._pendingData.length > 0) {\r\n return;\r\n }\r\n this._animationTimeLast = now;\r\n }\r\n this.deltaTime = this.useConstantAnimationDeltaTime ? 16.0 : (now - this._animationTimeLast) * this.animationTimeScale;\r\n this._animationTimeLast = now;\r\n var animatables = this._activeAnimatables;\r\n if (animatables.length === 0) {\r\n return;\r\n }\r\n this._animationTime += this.deltaTime;\r\n var animationTime = this._animationTime;\r\n for (var index = 0; index < animatables.length; index++) {\r\n var animatable = animatables[index];\r\n if (!animatable._animate(animationTime) && animatable.disposeOnEnd) {\r\n index--; // Array was updated\r\n }\r\n }\r\n // Late animation bindings\r\n this._processLateAnimationBindings();\r\n};\r\nScene.prototype.beginWeightedAnimation = function (target, from, to, weight, loop, speedRatio, onAnimationEnd, animatable, targetMask, onAnimationLoop, isAdditive) {\r\n if (weight === void 0) { weight = 1.0; }\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n if (isAdditive === void 0) { isAdditive = false; }\r\n var returnedAnimatable = this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, false, targetMask, onAnimationLoop, isAdditive);\r\n returnedAnimatable.weight = weight;\r\n return returnedAnimatable;\r\n};\r\nScene.prototype.beginAnimation = function (target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop, isAdditive) {\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n if (stopCurrent === void 0) { stopCurrent = true; }\r\n if (isAdditive === void 0) { isAdditive = false; }\r\n if (from > to && speedRatio > 0) {\r\n speedRatio *= -1;\r\n }\r\n if (stopCurrent) {\r\n this.stopAnimation(target, undefined, targetMask);\r\n }\r\n if (!animatable) {\r\n animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, undefined, onAnimationLoop, isAdditive);\r\n }\r\n var shouldRunTargetAnimations = targetMask ? targetMask(target) : true;\r\n // Local animations\r\n if (target.animations && shouldRunTargetAnimations) {\r\n animatable.appendAnimations(target, target.animations);\r\n }\r\n // Children animations\r\n if (target.getAnimatables) {\r\n var animatables = target.getAnimatables();\r\n for (var index = 0; index < animatables.length; index++) {\r\n this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop);\r\n }\r\n }\r\n animatable.reset();\r\n return animatable;\r\n};\r\nScene.prototype.beginHierarchyAnimation = function (target, directDescendantsOnly, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop, isAdditive) {\r\n if (speedRatio === void 0) { speedRatio = 1.0; }\r\n if (stopCurrent === void 0) { stopCurrent = true; }\r\n if (isAdditive === void 0) { isAdditive = false; }\r\n var children = target.getDescendants(directDescendantsOnly);\r\n var result = [];\r\n result.push(this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, undefined, isAdditive));\r\n for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\r\n var child = children_1[_i];\r\n result.push(this.beginAnimation(child, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, undefined, isAdditive));\r\n }\r\n return result;\r\n};\r\nScene.prototype.beginDirectAnimation = function (target, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive) {\r\n if (isAdditive === void 0) { isAdditive = false; }\r\n if (speedRatio === undefined) {\r\n speedRatio = 1.0;\r\n }\r\n if (from > to && speedRatio > 0) {\r\n speedRatio *= -1;\r\n }\r\n var animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, animations, onAnimationLoop, isAdditive);\r\n return animatable;\r\n};\r\nScene.prototype.beginDirectHierarchyAnimation = function (target, directDescendantsOnly, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive) {\r\n if (isAdditive === void 0) { isAdditive = false; }\r\n var children = target.getDescendants(directDescendantsOnly);\r\n var result = [];\r\n result.push(this.beginDirectAnimation(target, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive));\r\n for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {\r\n var child = children_2[_i];\r\n result.push(this.beginDirectAnimation(child, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive));\r\n }\r\n return result;\r\n};\r\nScene.prototype.getAnimatableByTarget = function (target) {\r\n for (var index = 0; index < this._activeAnimatables.length; index++) {\r\n if (this._activeAnimatables[index].target === target) {\r\n return this._activeAnimatables[index];\r\n }\r\n }\r\n return null;\r\n};\r\nScene.prototype.getAllAnimatablesByTarget = function (target) {\r\n var result = [];\r\n for (var index = 0; index < this._activeAnimatables.length; index++) {\r\n if (this._activeAnimatables[index].target === target) {\r\n result.push(this._activeAnimatables[index]);\r\n }\r\n }\r\n return result;\r\n};\r\n/**\r\n * Will stop the animation of the given target\r\n * @param target - the target\r\n * @param animationName - the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)\r\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\r\n */\r\nScene.prototype.stopAnimation = function (target, animationName, targetMask) {\r\n var animatables = this.getAllAnimatablesByTarget(target);\r\n for (var _i = 0, animatables_1 = animatables; _i < animatables_1.length; _i++) {\r\n var animatable = animatables_1[_i];\r\n animatable.stop(animationName, targetMask);\r\n }\r\n};\r\n/**\r\n * Stops and removes all animations that have been applied to the scene\r\n */\r\nScene.prototype.stopAllAnimations = function () {\r\n if (this._activeAnimatables) {\r\n for (var i = 0; i < this._activeAnimatables.length; i++) {\r\n this._activeAnimatables[i].stop();\r\n }\r\n this._activeAnimatables = [];\r\n }\r\n for (var _i = 0, _a = this.animationGroups; _i < _a.length; _i++) {\r\n var group = _a[_i];\r\n group.stop();\r\n }\r\n};\r\nScene.prototype._registerTargetForLateAnimationBinding = function (runtimeAnimation, originalValue) {\r\n var target = runtimeAnimation.target;\r\n this._registeredForLateAnimationBindings.pushNoDuplicate(target);\r\n if (!target._lateAnimationHolders) {\r\n target._lateAnimationHolders = {};\r\n }\r\n if (!target._lateAnimationHolders[runtimeAnimation.targetPath]) {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath] = {\r\n totalWeight: 0,\r\n totalAdditiveWeight: 0,\r\n animations: [],\r\n additiveAnimations: [],\r\n originalValue: originalValue\r\n };\r\n }\r\n if (runtimeAnimation.isAdditive) {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].additiveAnimations.push(runtimeAnimation);\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalAdditiveWeight += runtimeAnimation.weight;\r\n }\r\n else {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].animations.push(runtimeAnimation);\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;\r\n }\r\n};\r\nScene.prototype._processLateAnimationBindingsForMatrices = function (holder) {\r\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight === 0) {\r\n return holder.originalValue;\r\n }\r\n var normalizer = 1.0;\r\n var finalPosition = TmpVectors.Vector3[0];\r\n var finalScaling = TmpVectors.Vector3[1];\r\n var finalQuaternion = TmpVectors.Quaternion[0];\r\n var startIndex = 0;\r\n var originalAnimation = holder.animations[0];\r\n var originalValue = holder.originalValue;\r\n var scale = 1;\r\n var skipOverride = false;\r\n if (holder.totalWeight < 1.0) {\r\n // We need to mix the original value in\r\n scale = 1.0 - holder.totalWeight;\r\n originalValue.decompose(finalScaling, finalQuaternion, finalPosition);\r\n }\r\n else {\r\n startIndex = 1;\r\n // We need to normalize the weights\r\n normalizer = holder.totalWeight;\r\n scale = originalAnimation.weight / normalizer;\r\n if (scale == 1) {\r\n if (holder.totalAdditiveWeight) {\r\n skipOverride = true;\r\n }\r\n else {\r\n return originalAnimation.currentValue;\r\n }\r\n }\r\n originalAnimation.currentValue.decompose(finalScaling, finalQuaternion, finalPosition);\r\n }\r\n // Add up the override animations\r\n if (!skipOverride) {\r\n finalScaling.scaleInPlace(scale);\r\n finalPosition.scaleInPlace(scale);\r\n finalQuaternion.scaleInPlace(scale);\r\n for (var animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {\r\n var runtimeAnimation = holder.animations[animIndex];\r\n if (runtimeAnimation.weight === 0) {\r\n continue;\r\n }\r\n var scale = runtimeAnimation.weight / normalizer;\r\n var currentPosition = TmpVectors.Vector3[2];\r\n var currentScaling = TmpVectors.Vector3[3];\r\n var currentQuaternion = TmpVectors.Quaternion[1];\r\n runtimeAnimation.currentValue.decompose(currentScaling, currentQuaternion, currentPosition);\r\n currentScaling.scaleAndAddToRef(scale, finalScaling);\r\n currentQuaternion.scaleAndAddToRef(scale, finalQuaternion);\r\n currentPosition.scaleAndAddToRef(scale, finalPosition);\r\n }\r\n }\r\n // Add up the additive animations\r\n for (var animIndex_1 = 0; animIndex_1 < holder.additiveAnimations.length; animIndex_1++) {\r\n var runtimeAnimation = holder.additiveAnimations[animIndex_1];\r\n if (runtimeAnimation.weight === 0) {\r\n continue;\r\n }\r\n var currentPosition = TmpVectors.Vector3[2];\r\n var currentScaling = TmpVectors.Vector3[3];\r\n var currentQuaternion = TmpVectors.Quaternion[1];\r\n runtimeAnimation.currentValue.decompose(currentScaling, currentQuaternion, currentPosition);\r\n currentScaling.multiplyToRef(finalScaling, currentScaling);\r\n Vector3.LerpToRef(finalScaling, currentScaling, runtimeAnimation.weight, finalScaling);\r\n finalQuaternion.multiplyToRef(currentQuaternion, currentQuaternion);\r\n Quaternion.SlerpToRef(finalQuaternion, currentQuaternion, runtimeAnimation.weight, finalQuaternion);\r\n currentPosition.scaleAndAddToRef(runtimeAnimation.weight, finalPosition);\r\n }\r\n var workValue = originalAnimation ? originalAnimation._animationState.workValue : TmpVectors.Matrix[0].clone();\r\n Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, workValue);\r\n return workValue;\r\n};\r\nScene.prototype._processLateAnimationBindingsForQuaternions = function (holder, refQuaternion) {\r\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight === 0) {\r\n return refQuaternion;\r\n }\r\n var originalAnimation = holder.animations[0];\r\n var originalValue = holder.originalValue;\r\n var cumulativeQuaternion = refQuaternion;\r\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight > 0) {\r\n cumulativeQuaternion.copyFrom(originalValue);\r\n }\r\n else if (holder.animations.length === 1) {\r\n Quaternion.SlerpToRef(originalValue, originalAnimation.currentValue, Math.min(1.0, holder.totalWeight), cumulativeQuaternion);\r\n if (holder.totalAdditiveWeight === 0) {\r\n return cumulativeQuaternion;\r\n }\r\n }\r\n else if (holder.animations.length > 1) {\r\n // Add up the override animations\r\n var normalizer = 1.0;\r\n var quaternions = void 0;\r\n var weights = void 0;\r\n if (holder.totalWeight < 1.0) {\r\n var scale = 1.0 - holder.totalWeight;\r\n quaternions = [];\r\n weights = [];\r\n quaternions.push(originalValue);\r\n weights.push(scale);\r\n }\r\n else {\r\n if (holder.animations.length === 2) { // Slerp as soon as we can\r\n Quaternion.SlerpToRef(holder.animations[0].currentValue, holder.animations[1].currentValue, holder.animations[1].weight / holder.totalWeight, refQuaternion);\r\n if (holder.totalAdditiveWeight === 0) {\r\n return refQuaternion;\r\n }\r\n }\r\n quaternions = [];\r\n weights = [];\r\n normalizer = holder.totalWeight;\r\n }\r\n for (var animIndex = 0; animIndex < holder.animations.length; animIndex++) {\r\n var runtimeAnimation = holder.animations[animIndex];\r\n quaternions.push(runtimeAnimation.currentValue);\r\n weights.push(runtimeAnimation.weight / normalizer);\r\n }\r\n // https://gamedev.stackexchange.com/questions/62354/method-for-interpolation-between-3-quaternions\r\n var cumulativeAmount = 0;\r\n for (var index = 0; index < quaternions.length;) {\r\n if (!index) {\r\n Quaternion.SlerpToRef(quaternions[index], quaternions[index + 1], weights[index + 1] / (weights[index] + weights[index + 1]), refQuaternion);\r\n cumulativeQuaternion = refQuaternion;\r\n cumulativeAmount = weights[index] + weights[index + 1];\r\n index += 2;\r\n continue;\r\n }\r\n cumulativeAmount += weights[index];\r\n Quaternion.SlerpToRef(cumulativeQuaternion, quaternions[index], weights[index] / cumulativeAmount, cumulativeQuaternion);\r\n index++;\r\n }\r\n }\r\n // Add up the additive animations\r\n for (var animIndex_2 = 0; animIndex_2 < holder.additiveAnimations.length; animIndex_2++) {\r\n var runtimeAnimation = holder.additiveAnimations[animIndex_2];\r\n if (runtimeAnimation.weight === 0) {\r\n continue;\r\n }\r\n cumulativeQuaternion.multiplyToRef(runtimeAnimation.currentValue, TmpVectors.Quaternion[0]);\r\n Quaternion.SlerpToRef(cumulativeQuaternion, TmpVectors.Quaternion[0], runtimeAnimation.weight, cumulativeQuaternion);\r\n }\r\n return cumulativeQuaternion;\r\n};\r\nScene.prototype._processLateAnimationBindings = function () {\r\n if (!this._registeredForLateAnimationBindings.length) {\r\n return;\r\n }\r\n for (var index = 0; index < this._registeredForLateAnimationBindings.length; index++) {\r\n var target = this._registeredForLateAnimationBindings.data[index];\r\n for (var path in target._lateAnimationHolders) {\r\n var holder = target._lateAnimationHolders[path];\r\n var originalAnimation = holder.animations[0];\r\n var originalValue = holder.originalValue;\r\n var matrixDecomposeMode = Animation.AllowMatrixDecomposeForInterpolation && originalValue.m; // ie. data is matrix\r\n var finalValue = target[path];\r\n if (matrixDecomposeMode) {\r\n finalValue = this._processLateAnimationBindingsForMatrices(holder);\r\n }\r\n else {\r\n var quaternionMode = originalValue.w !== undefined;\r\n if (quaternionMode) {\r\n finalValue = this._processLateAnimationBindingsForQuaternions(holder, finalValue || Quaternion.Identity());\r\n }\r\n else {\r\n var startIndex = 0;\r\n var normalizer = 1.0;\r\n if (holder.totalWeight < 1.0) {\r\n // We need to mix the original value in\r\n if (originalAnimation && originalValue.scale) {\r\n finalValue = originalValue.scale(1.0 - holder.totalWeight);\r\n }\r\n else if (originalAnimation) {\r\n finalValue = originalValue * (1.0 - holder.totalWeight);\r\n }\r\n else if (originalValue.clone) {\r\n finalValue = originalValue.clone();\r\n }\r\n else {\r\n finalValue = originalValue;\r\n }\r\n }\r\n else if (originalAnimation) {\r\n // We need to normalize the weights\r\n normalizer = holder.totalWeight;\r\n var scale_1 = originalAnimation.weight / normalizer;\r\n if (scale_1 !== 1) {\r\n if (originalAnimation.currentValue.scale) {\r\n finalValue = originalAnimation.currentValue.scale(scale_1);\r\n }\r\n else {\r\n finalValue = originalAnimation.currentValue * scale_1;\r\n }\r\n }\r\n else {\r\n finalValue = originalAnimation.currentValue;\r\n }\r\n startIndex = 1;\r\n }\r\n // Add up the override animations\r\n for (var animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {\r\n var runtimeAnimation = holder.animations[animIndex];\r\n var scale = runtimeAnimation.weight / normalizer;\r\n if (!scale) {\r\n continue;\r\n }\r\n else if (runtimeAnimation.currentValue.scaleAndAddToRef) {\r\n runtimeAnimation.currentValue.scaleAndAddToRef(scale, finalValue);\r\n }\r\n else {\r\n finalValue += runtimeAnimation.currentValue * scale;\r\n }\r\n }\r\n // Add up the additive animations\r\n for (var animIndex_3 = 0; animIndex_3 < holder.additiveAnimations.length; animIndex_3++) {\r\n var runtimeAnimation = holder.additiveAnimations[animIndex_3];\r\n var scale = runtimeAnimation.weight;\r\n if (!scale) {\r\n continue;\r\n }\r\n else if (runtimeAnimation.currentValue.scaleAndAddToRef) {\r\n runtimeAnimation.currentValue.scaleAndAddToRef(scale, finalValue);\r\n }\r\n else {\r\n finalValue += runtimeAnimation.currentValue * scale;\r\n }\r\n }\r\n }\r\n }\r\n target[path] = finalValue;\r\n }\r\n target._lateAnimationHolders = {};\r\n }\r\n this._registeredForLateAnimationBindings.reset();\r\n};\r\nBone.prototype.copyAnimationRange = function (source, rangeName, frameOffset, rescaleAsRequired, skelDimensionsRatio) {\r\n if (rescaleAsRequired === void 0) { rescaleAsRequired = false; }\r\n if (skelDimensionsRatio === void 0) { skelDimensionsRatio = null; }\r\n // all animation may be coming from a library skeleton, so may need to create animation\r\n if (this.animations.length === 0) {\r\n this.animations.push(new Animation(this.name, \"_matrix\", source.animations[0].framePerSecond, Animation.ANIMATIONTYPE_MATRIX, 0));\r\n this.animations[0].setKeys([]);\r\n }\r\n // get animation info / verify there is such a range from the source bone\r\n var sourceRange = source.animations[0].getRange(rangeName);\r\n if (!sourceRange) {\r\n return false;\r\n }\r\n var from = sourceRange.from;\r\n var to = sourceRange.to;\r\n var sourceKeys = source.animations[0].getKeys();\r\n // rescaling prep\r\n var sourceBoneLength = source.length;\r\n var sourceParent = source.getParent();\r\n var parent = this.getParent();\r\n var parentScalingReqd = rescaleAsRequired && sourceParent && sourceBoneLength && this.length && sourceBoneLength !== this.length;\r\n var parentRatio = parentScalingReqd && parent && sourceParent ? parent.length / sourceParent.length : 1;\r\n var dimensionsScalingReqd = rescaleAsRequired && !parent && skelDimensionsRatio && (skelDimensionsRatio.x !== 1 || skelDimensionsRatio.y !== 1 || skelDimensionsRatio.z !== 1);\r\n var destKeys = this.animations[0].getKeys();\r\n // loop vars declaration\r\n var orig;\r\n var origTranslation;\r\n var mat;\r\n for (var key = 0, nKeys = sourceKeys.length; key < nKeys; key++) {\r\n orig = sourceKeys[key];\r\n if (orig.frame >= from && orig.frame <= to) {\r\n if (rescaleAsRequired) {\r\n mat = orig.value.clone();\r\n // scale based on parent ratio, when bone has parent\r\n if (parentScalingReqd) {\r\n origTranslation = mat.getTranslation();\r\n mat.setTranslation(origTranslation.scaleInPlace(parentRatio));\r\n // scale based on skeleton dimension ratio when root bone, and value is passed\r\n }\r\n else if (dimensionsScalingReqd && skelDimensionsRatio) {\r\n origTranslation = mat.getTranslation();\r\n mat.setTranslation(origTranslation.multiplyInPlace(skelDimensionsRatio));\r\n // use original when root bone, and no data for skelDimensionsRatio\r\n }\r\n else {\r\n mat = orig.value;\r\n }\r\n }\r\n else {\r\n mat = orig.value;\r\n }\r\n destKeys.push({ frame: orig.frame + frameOffset, value: mat });\r\n }\r\n }\r\n this.animations[0].createRange(rangeName, from + frameOffset, to + frameOffset);\r\n return true;\r\n};\r\n//# sourceMappingURL=animatable.js.map","import { Animation } from \"./animation\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport \"./animatable\";\r\n/**\r\n * This class defines the direct association between an animation and a target\r\n */\r\nvar TargetedAnimation = /** @class */ (function () {\r\n function TargetedAnimation() {\r\n }\r\n /**\r\n * Returns the string \"TargetedAnimation\"\r\n * @returns \"TargetedAnimation\"\r\n */\r\n TargetedAnimation.prototype.getClassName = function () {\r\n return \"TargetedAnimation\";\r\n };\r\n /**\r\n * Serialize the object\r\n * @returns the JSON object representing the current entity\r\n */\r\n TargetedAnimation.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.animation = this.animation.serialize();\r\n serializationObject.targetId = this.target.id;\r\n return serializationObject;\r\n };\r\n return TargetedAnimation;\r\n}());\r\nexport { TargetedAnimation };\r\n/**\r\n * Use this class to create coordinated animations on multiple targets\r\n */\r\nvar AnimationGroup = /** @class */ (function () {\r\n /**\r\n * Instantiates a new Animation Group.\r\n * This helps managing several animations at once.\r\n * @see https://doc.babylonjs.com/how_to/group\r\n * @param name Defines the name of the group\r\n * @param scene Defines the scene the group belongs to\r\n */\r\n function AnimationGroup(\r\n /** The name of the animation group */\r\n name, scene) {\r\n if (scene === void 0) { scene = null; }\r\n this.name = name;\r\n this._targetedAnimations = new Array();\r\n this._animatables = new Array();\r\n this._from = Number.MAX_VALUE;\r\n this._to = -Number.MAX_VALUE;\r\n this._speedRatio = 1;\r\n this._loopAnimation = false;\r\n this._isAdditive = false;\r\n /**\r\n * This observable will notify when one animation have ended\r\n */\r\n this.onAnimationEndObservable = new Observable();\r\n /**\r\n * Observer raised when one animation loops\r\n */\r\n this.onAnimationLoopObservable = new Observable();\r\n /**\r\n * Observer raised when all animations have looped\r\n */\r\n this.onAnimationGroupLoopObservable = new Observable();\r\n /**\r\n * This observable will notify when all animations have ended.\r\n */\r\n this.onAnimationGroupEndObservable = new Observable();\r\n /**\r\n * This observable will notify when all animations have paused.\r\n */\r\n this.onAnimationGroupPauseObservable = new Observable();\r\n /**\r\n * This observable will notify when all animations are playing.\r\n */\r\n this.onAnimationGroupPlayObservable = new Observable();\r\n this._scene = scene || EngineStore.LastCreatedScene;\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._scene.addAnimationGroup(this);\r\n }\r\n Object.defineProperty(AnimationGroup.prototype, \"from\", {\r\n /**\r\n * Gets the first frame\r\n */\r\n get: function () {\r\n return this._from;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"to\", {\r\n /**\r\n * Gets the last frame\r\n */\r\n get: function () {\r\n return this._to;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"isStarted\", {\r\n /**\r\n * Define if the animations are started\r\n */\r\n get: function () {\r\n return this._isStarted;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"isPlaying\", {\r\n /**\r\n * Gets a value indicating that the current group is playing\r\n */\r\n get: function () {\r\n return this._isStarted && !this._isPaused;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"speedRatio\", {\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n get: function () {\r\n return this._speedRatio;\r\n },\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n set: function (value) {\r\n if (this._speedRatio === value) {\r\n return;\r\n }\r\n this._speedRatio = value;\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.speedRatio = this._speedRatio;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"loopAnimation\", {\r\n /**\r\n * Gets or sets if all animations should loop or not\r\n */\r\n get: function () {\r\n return this._loopAnimation;\r\n },\r\n set: function (value) {\r\n if (this._loopAnimation === value) {\r\n return;\r\n }\r\n this._loopAnimation = value;\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.loopAnimation = this._loopAnimation;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"isAdditive\", {\r\n /**\r\n * Gets or sets if all animations should be evaluated additively\r\n */\r\n get: function () {\r\n return this._isAdditive;\r\n },\r\n set: function (value) {\r\n if (this._isAdditive === value) {\r\n return;\r\n }\r\n this._isAdditive = value;\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.isAdditive = this._isAdditive;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"targetedAnimations\", {\r\n /**\r\n * Gets the targeted animations for this animation group\r\n */\r\n get: function () {\r\n return this._targetedAnimations;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"animatables\", {\r\n /**\r\n * returning the list of animatables controlled by this animation group.\r\n */\r\n get: function () {\r\n return this._animatables;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AnimationGroup.prototype, \"children\", {\r\n /**\r\n * Gets the list of target animations\r\n */\r\n get: function () {\r\n return this._targetedAnimations;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Add an animation (with its target) in the group\r\n * @param animation defines the animation we want to add\r\n * @param target defines the target of the animation\r\n * @returns the TargetedAnimation object\r\n */\r\n AnimationGroup.prototype.addTargetedAnimation = function (animation, target) {\r\n var targetedAnimation = new TargetedAnimation();\r\n targetedAnimation.animation = animation;\r\n targetedAnimation.target = target;\r\n var keys = animation.getKeys();\r\n if (this._from > keys[0].frame) {\r\n this._from = keys[0].frame;\r\n }\r\n if (this._to < keys[keys.length - 1].frame) {\r\n this._to = keys[keys.length - 1].frame;\r\n }\r\n this._targetedAnimations.push(targetedAnimation);\r\n return targetedAnimation;\r\n };\r\n /**\r\n * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame\r\n * It can add constant keys at begin or end\r\n * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)\r\n * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.normalize = function (beginFrame, endFrame) {\r\n if (beginFrame === void 0) { beginFrame = null; }\r\n if (endFrame === void 0) { endFrame = null; }\r\n if (beginFrame == null) {\r\n beginFrame = this._from;\r\n }\r\n if (endFrame == null) {\r\n endFrame = this._to;\r\n }\r\n for (var index = 0; index < this._targetedAnimations.length; index++) {\r\n var targetedAnimation = this._targetedAnimations[index];\r\n var keys = targetedAnimation.animation.getKeys();\r\n var startKey = keys[0];\r\n var endKey = keys[keys.length - 1];\r\n if (startKey.frame > beginFrame) {\r\n var newKey = {\r\n frame: beginFrame,\r\n value: startKey.value,\r\n inTangent: startKey.inTangent,\r\n outTangent: startKey.outTangent,\r\n interpolation: startKey.interpolation\r\n };\r\n keys.splice(0, 0, newKey);\r\n }\r\n if (endKey.frame < endFrame) {\r\n var newKey = {\r\n frame: endFrame,\r\n value: endKey.value,\r\n inTangent: endKey.inTangent,\r\n outTangent: endKey.outTangent,\r\n interpolation: endKey.interpolation\r\n };\r\n keys.push(newKey);\r\n }\r\n }\r\n this._from = beginFrame;\r\n this._to = endFrame;\r\n return this;\r\n };\r\n AnimationGroup.prototype._processLoop = function (animatable, targetedAnimation, index) {\r\n var _this = this;\r\n animatable.onAnimationLoop = function () {\r\n _this.onAnimationLoopObservable.notifyObservers(targetedAnimation);\r\n if (_this._animationLoopFlags[index]) {\r\n return;\r\n }\r\n _this._animationLoopFlags[index] = true;\r\n _this._animationLoopCount++;\r\n if (_this._animationLoopCount === _this._targetedAnimations.length) {\r\n _this.onAnimationGroupLoopObservable.notifyObservers(_this);\r\n _this._animationLoopCount = 0;\r\n _this._animationLoopFlags = [];\r\n }\r\n };\r\n };\r\n /**\r\n * Start all animations on given targets\r\n * @param loop defines if animations must loop\r\n * @param speedRatio defines the ratio to apply to animation speed (1 by default)\r\n * @param from defines the from key (optional)\r\n * @param to defines the to key (optional)\r\n * @param isAdditive defines the additive state for the resulting animatables (optional)\r\n * @returns the current animation group\r\n */\r\n AnimationGroup.prototype.start = function (loop, speedRatio, from, to, isAdditive) {\r\n var _this = this;\r\n if (loop === void 0) { loop = false; }\r\n if (speedRatio === void 0) { speedRatio = 1; }\r\n if (this._isStarted || this._targetedAnimations.length === 0) {\r\n return this;\r\n }\r\n this._loopAnimation = loop;\r\n this._animationLoopCount = 0;\r\n this._animationLoopFlags = [];\r\n var _loop_1 = function () {\r\n var targetedAnimation = this_1._targetedAnimations[index];\r\n var animatable = this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this_1._from, to !== undefined ? to : this_1._to, loop, speedRatio, undefined, undefined, isAdditive !== undefined ? isAdditive : this_1._isAdditive);\r\n animatable.onAnimationEnd = function () {\r\n _this.onAnimationEndObservable.notifyObservers(targetedAnimation);\r\n _this._checkAnimationGroupEnded(animatable);\r\n };\r\n this_1._processLoop(animatable, targetedAnimation, index);\r\n this_1._animatables.push(animatable);\r\n };\r\n var this_1 = this;\r\n for (var index = 0; index < this._targetedAnimations.length; index++) {\r\n _loop_1();\r\n }\r\n this._speedRatio = speedRatio;\r\n if (from !== undefined && to !== undefined) {\r\n if (from < to && this._speedRatio < 0) {\r\n var temp = to;\r\n to = from;\r\n from = temp;\r\n }\r\n else if (from > to && this._speedRatio > 0) {\r\n this._speedRatio = -speedRatio;\r\n }\r\n }\r\n this._isStarted = true;\r\n this._isPaused = false;\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n return this;\r\n };\r\n /**\r\n * Pause all animations\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.pause = function () {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n this._isPaused = true;\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.pause();\r\n }\r\n this.onAnimationGroupPauseObservable.notifyObservers(this);\r\n return this;\r\n };\r\n /**\r\n * Play all animations to initial state\r\n * This function will start() the animations if they were not started or will restart() them if they were paused\r\n * @param loop defines if animations must loop\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.play = function (loop) {\r\n // only if all animatables are ready and exist\r\n if (this.isStarted && this._animatables.length === this._targetedAnimations.length) {\r\n if (loop !== undefined) {\r\n this.loopAnimation = loop;\r\n }\r\n this.restart();\r\n }\r\n else {\r\n this.stop();\r\n this.start(loop, this._speedRatio);\r\n }\r\n this._isPaused = false;\r\n return this;\r\n };\r\n /**\r\n * Reset all animations to initial state\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.reset = function () {\r\n if (!this._isStarted) {\r\n this.play();\r\n this.goToFrame(0);\r\n this.stop();\r\n return this;\r\n }\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.reset();\r\n }\r\n return this;\r\n };\r\n /**\r\n * Restart animations from key 0\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.restart = function () {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.restart();\r\n }\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n return this;\r\n };\r\n /**\r\n * Stop all animations\r\n * @returns the animation group\r\n */\r\n AnimationGroup.prototype.stop = function () {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n var list = this._animatables.slice();\r\n for (var index = 0; index < list.length; index++) {\r\n list[index].stop();\r\n }\r\n this._isStarted = false;\r\n return this;\r\n };\r\n /**\r\n * Set animation weight for all animatables\r\n * @param weight defines the weight to use\r\n * @return the animationGroup\r\n * @see https://doc.babylonjs.com/babylon101/animations#animation-weights\r\n */\r\n AnimationGroup.prototype.setWeightForAllAnimatables = function (weight) {\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.weight = weight;\r\n }\r\n return this;\r\n };\r\n /**\r\n * Synchronize and normalize all animatables with a source animatable\r\n * @param root defines the root animatable to synchronize with\r\n * @return the animationGroup\r\n * @see https://doc.babylonjs.com/babylon101/animations#animation-weights\r\n */\r\n AnimationGroup.prototype.syncAllAnimationsWith = function (root) {\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.syncWith(root);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Goes to a specific frame in this animation group\r\n * @param frame the frame number to go to\r\n * @return the animationGroup\r\n */\r\n AnimationGroup.prototype.goToFrame = function (frame) {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n for (var index = 0; index < this._animatables.length; index++) {\r\n var animatable = this._animatables[index];\r\n animatable.goToFrame(frame);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Dispose all associated resources\r\n */\r\n AnimationGroup.prototype.dispose = function () {\r\n this._targetedAnimations = [];\r\n this._animatables = [];\r\n var index = this._scene.animationGroups.indexOf(this);\r\n if (index > -1) {\r\n this._scene.animationGroups.splice(index, 1);\r\n }\r\n this.onAnimationEndObservable.clear();\r\n this.onAnimationGroupEndObservable.clear();\r\n this.onAnimationGroupPauseObservable.clear();\r\n this.onAnimationGroupPlayObservable.clear();\r\n this.onAnimationLoopObservable.clear();\r\n this.onAnimationGroupLoopObservable.clear();\r\n };\r\n AnimationGroup.prototype._checkAnimationGroupEnded = function (animatable) {\r\n // animatable should be taken out of the array\r\n var idx = this._animatables.indexOf(animatable);\r\n if (idx > -1) {\r\n this._animatables.splice(idx, 1);\r\n }\r\n // all animatables were removed? animation group ended!\r\n if (this._animatables.length === 0) {\r\n this._isStarted = false;\r\n this.onAnimationGroupEndObservable.notifyObservers(this);\r\n }\r\n };\r\n /**\r\n * Clone the current animation group and returns a copy\r\n * @param newName defines the name of the new group\r\n * @param targetConverter defines an optional function used to convert current animation targets to new ones\r\n * @returns the new aniamtion group\r\n */\r\n AnimationGroup.prototype.clone = function (newName, targetConverter) {\r\n var newGroup = new AnimationGroup(newName || this.name, this._scene);\r\n for (var _i = 0, _a = this._targetedAnimations; _i < _a.length; _i++) {\r\n var targetAnimation = _a[_i];\r\n newGroup.addTargetedAnimation(targetAnimation.animation.clone(), targetConverter ? targetConverter(targetAnimation.target) : targetAnimation.target);\r\n }\r\n return newGroup;\r\n };\r\n /**\r\n * Serializes the animationGroup to an object\r\n * @returns Serialized object\r\n */\r\n AnimationGroup.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.from = this.from;\r\n serializationObject.to = this.to;\r\n serializationObject.targetedAnimations = [];\r\n for (var targetedAnimationIndex = 0; targetedAnimationIndex < this.targetedAnimations.length; targetedAnimationIndex++) {\r\n var targetedAnimation = this.targetedAnimations[targetedAnimationIndex];\r\n serializationObject.targetedAnimations[targetedAnimationIndex] = targetedAnimation.serialize();\r\n }\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Returns a new AnimationGroup object parsed from the source provided.\r\n * @param parsedAnimationGroup defines the source\r\n * @param scene defines the scene that will receive the animationGroup\r\n * @returns a new AnimationGroup\r\n */\r\n AnimationGroup.Parse = function (parsedAnimationGroup, scene) {\r\n var animationGroup = new AnimationGroup(parsedAnimationGroup.name, scene);\r\n for (var i = 0; i < parsedAnimationGroup.targetedAnimations.length; i++) {\r\n var targetedAnimation = parsedAnimationGroup.targetedAnimations[i];\r\n var animation = Animation.Parse(targetedAnimation.animation);\r\n var id = targetedAnimation.targetId;\r\n if (targetedAnimation.animation.property === \"influence\") { // morph target animation\r\n var morphTarget = scene.getMorphTargetById(id);\r\n if (morphTarget) {\r\n animationGroup.addTargetedAnimation(animation, morphTarget);\r\n }\r\n }\r\n else {\r\n var targetNode = scene.getNodeByID(id);\r\n if (targetNode != null) {\r\n animationGroup.addTargetedAnimation(animation, targetNode);\r\n }\r\n }\r\n }\r\n if (parsedAnimationGroup.from !== null && parsedAnimationGroup.to !== null) {\r\n animationGroup.normalize(parsedAnimationGroup.from, parsedAnimationGroup.to);\r\n }\r\n return animationGroup;\r\n };\r\n /**\r\n * Convert the keyframes for all animations belonging to the group to be relative to a given reference frame.\r\n * @param sourceAnimationGroup defines the AnimationGroup containing animations to convert\r\n * @param referenceFrame defines the frame that keyframes in the range will be relative to\r\n * @param range defines the name of the AnimationRange belonging to the animations in the group to convert\r\n * @param cloneOriginal defines whether or not to clone the group and convert the clone or convert the original group (default is false)\r\n * @param clonedName defines the name of the resulting cloned AnimationGroup if cloneOriginal is true\r\n * @returns a new AnimationGroup if cloneOriginal is true or the original AnimationGroup if cloneOriginal is false\r\n */\r\n AnimationGroup.MakeAnimationAdditive = function (sourceAnimationGroup, referenceFrame, range, cloneOriginal, clonedName) {\r\n if (referenceFrame === void 0) { referenceFrame = 0; }\r\n if (cloneOriginal === void 0) { cloneOriginal = false; }\r\n var animationGroup = sourceAnimationGroup;\r\n if (cloneOriginal) {\r\n animationGroup = sourceAnimationGroup.clone(clonedName || animationGroup.name);\r\n }\r\n var targetedAnimations = animationGroup.targetedAnimations;\r\n for (var index = 0; index < targetedAnimations.length; index++) {\r\n var targetedAnimation = targetedAnimations[index];\r\n Animation.MakeAnimationAdditive(targetedAnimation.animation, referenceFrame, range);\r\n }\r\n animationGroup.isAdditive = true;\r\n return animationGroup;\r\n };\r\n /**\r\n * Returns the string \"AnimationGroup\"\r\n * @returns \"AnimationGroup\"\r\n */\r\n AnimationGroup.prototype.getClassName = function () {\r\n return \"AnimationGroup\";\r\n };\r\n /**\r\n * Creates a detailled string about the object\r\n * @param fullDetails defines if the output string will support multiple levels of logging within scene loading\r\n * @returns a string representing the object\r\n */\r\n AnimationGroup.prototype.toString = function (fullDetails) {\r\n var ret = \"Name: \" + this.name;\r\n ret += \", type: \" + this.getClassName();\r\n if (fullDetails) {\r\n ret += \", from: \" + this._from;\r\n ret += \", to: \" + this._to;\r\n ret += \", isStarted: \" + this._isStarted;\r\n ret += \", speedRatio: \" + this._speedRatio;\r\n ret += \", targetedAnimations length: \" + this._targetedAnimations.length;\r\n ret += \", animatables length: \" + this._animatables;\r\n }\r\n return ret;\r\n };\r\n return AnimationGroup;\r\n}());\r\nexport { AnimationGroup };\r\n//# sourceMappingURL=animationGroup.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/helperFunctions\";\r\nvar name = 'rgbdDecodePixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n#include\\nvoid main(void)\\n{\\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var rgbdDecodePixelShader = { name: name, shader: shader };\r\n//# sourceMappingURL=rgbdDecode.fragment.js.map","import { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport \"../Shaders/rgbdDecode.fragment\";\r\nimport \"../Engines/Extensions/engine.renderTarget\";\r\n/**\r\n * Class used to host RGBD texture specific utilities\r\n */\r\nvar RGBDTextureTools = /** @class */ (function () {\r\n function RGBDTextureTools() {\r\n }\r\n /**\r\n * Expand the RGBD Texture from RGBD to Half Float if possible.\r\n * @param texture the texture to expand.\r\n */\r\n RGBDTextureTools.ExpandRGBDTexture = function (texture) {\r\n var internalTexture = texture._texture;\r\n if (!internalTexture || !texture.isRGBD) {\r\n return;\r\n }\r\n // Gets everything ready.\r\n var engine = internalTexture.getEngine();\r\n var caps = engine.getCaps();\r\n var expandTexture = false;\r\n // If half float available we can uncompress the texture\r\n if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\r\n expandTexture = true;\r\n internalTexture.type = 2;\r\n }\r\n // If full float available we can uncompress the texture\r\n else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\r\n expandTexture = true;\r\n internalTexture.type = 1;\r\n }\r\n if (expandTexture) {\r\n // Do not use during decode.\r\n internalTexture.isReady = false;\r\n internalTexture._isRGBD = false;\r\n internalTexture.invertY = false;\r\n }\r\n texture.onLoadObservable.addOnce(function () {\r\n // Expand the texture if possible\r\n if (expandTexture) {\r\n // Simply run through the decode PP.\r\n var rgbdPostProcess_1 = new PostProcess(\"rgbdDecode\", \"rgbdDecode\", null, null, 1, null, 3, engine, false, undefined, internalTexture.type, undefined, null, false);\r\n // Hold the output of the decoding.\r\n var expandedTexture_1 = engine.createRenderTargetTexture(internalTexture.width, {\r\n generateDepthBuffer: false,\r\n generateMipMaps: false,\r\n generateStencilBuffer: false,\r\n samplingMode: internalTexture.samplingMode,\r\n type: internalTexture.type,\r\n format: 5\r\n });\r\n rgbdPostProcess_1.getEffect().executeWhenCompiled(function () {\r\n // PP Render Pass\r\n rgbdPostProcess_1.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", internalTexture);\r\n effect.setFloat2(\"scale\", 1, 1);\r\n };\r\n texture.getScene().postProcessManager.directRender([rgbdPostProcess_1], expandedTexture_1, true);\r\n // Cleanup\r\n engine.restoreDefaultFramebuffer();\r\n engine._releaseTexture(internalTexture);\r\n engine._releaseFramebufferObjects(expandedTexture_1);\r\n if (rgbdPostProcess_1) {\r\n rgbdPostProcess_1.dispose();\r\n }\r\n // Internal Swap\r\n expandedTexture_1._swapAndDie(internalTexture);\r\n // Ready to get rolling again.\r\n internalTexture.isReady = true;\r\n });\r\n }\r\n });\r\n };\r\n return RGBDTextureTools;\r\n}());\r\nexport { RGBDTextureTools };\r\n//# sourceMappingURL=rgbdTextureTools.js.map","import { Texture } from \"../Materials/Textures/texture\";\r\nimport { RGBDTextureTools } from \"./rgbdTextureTools\";\r\n/**\r\n * Class used to host texture specific utilities\r\n */\r\nvar BRDFTextureTools = /** @class */ (function () {\r\n function BRDFTextureTools() {\r\n }\r\n /**\r\n * Gets a default environment BRDF for MS-BRDF Height Correlated BRDF\r\n * @param scene defines the hosting scene\r\n * @returns the environment BRDF texture\r\n */\r\n BRDFTextureTools.GetEnvironmentBRDFTexture = function (scene) {\r\n if (!scene.environmentBRDFTexture) {\r\n // Forces Delayed Texture Loading to prevent undefined error whilst setting RGBD values.\r\n var useDelayedTextureLoading = scene.useDelayedTextureLoading;\r\n scene.useDelayedTextureLoading = false;\r\n var previousState = scene._blockEntityCollection;\r\n scene._blockEntityCollection = false;\r\n var texture = Texture.CreateFromBase64String(this._environmentBRDFBase64Texture, \"EnvironmentBRDFTexture\" + this._instanceNumber++, scene, true, false, Texture.BILINEAR_SAMPLINGMODE);\r\n scene._blockEntityCollection = previousState;\r\n // BRDF Texture should not be cached here due to pre processing and redundant scene caches.\r\n var texturesCache = scene.getEngine().getLoadedTexturesCache();\r\n var index = texturesCache.indexOf(texture.getInternalTexture());\r\n if (index !== -1) {\r\n texturesCache.splice(index, 1);\r\n }\r\n texture.isRGBD = true;\r\n texture.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n texture.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n scene.environmentBRDFTexture = texture;\r\n scene.useDelayedTextureLoading = useDelayedTextureLoading;\r\n RGBDTextureTools.ExpandRGBDTexture(texture);\r\n }\r\n return scene.environmentBRDFTexture;\r\n };\r\n /**\r\n * Prevents texture cache collision\r\n */\r\n BRDFTextureTools._instanceNumber = 0;\r\n BRDFTextureTools._environmentBRDFBase64Texture = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR42u29yY5tWXIlZnbuiSaTbZFUkZRKrCKhElASQA0EoQABgn6hJvoXzfUP+gP9hWb6Bg00IgRoQJaKqUxmZmTEe8/v0uB2u7Fm2T7HIyIrnz88uPvt3f2a2WrMbOvf/u3PvvzP/sUf/N6//i8vf/lv/3v5H//d//Sb//Uq/5u8yf8hV/m/5Cp/L1f5hVzlG7nKJ7mKyJuIXN/hPwqXI/g++zq6rPI5u8z+WqfLre+zy7PrVv9L8brsMiGvk8XLmM/sdfHXal4e3ad6GXPdyu2ij8u/+uv/5cuf/OSLfdtEfvUr+dnf/d0X//t3H/7bf/hP//N/928h/0Yg/4VA/kogfyGQP5Wr/IFAvhbIlwK5CGQTPP+9z5uPeePJSW+yo2+s/GtN30Rnv1E+f5zxof9R/lSXv/nr//mrr3+i+5dfyX7ZZQP07Tffys//8R/l/9TtX7790T/7r/8G8pdy+/8XAvnnAvkzgfwzgfyxQP5AIL8vkJ8K5KsmMVzu1U7p5PA5AXxOAJ8TwPf7sX/51ZeXfcemqnp9w/W77/S7X/6T/vzf/7383RWCX3/z05/9i3/13/0PX//eX/2FyP8tIv+PiPy9iPy/IvIzEfm5iPxCRH4lIt/c/393//9BRD6KyKf7f488fP74/PH544dJAF9cLl98IZfLBZtuqterX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5mGIzLB1JJC5WhzYjhJ7IWmLDpA8jzsAafUPkB2WnFBF4iSxkq1ty7f25rv/+EQLOxs2oUdTSA9HIR9swdBlCcFe9owPC3XWDDC0ISVzsEVbSCF/sWdA5Fu4HJqankp2SeQCYYrImNalfmhpVxYrGkUS4LeSUjg8dD7+D7w/ybIfy7vlB9/HJ978zr7/45Qgajzj+4EjIK/ULHPRAOlKr/aG0AFcqCyu0GcW45Igh6JMJmhA49/U+cEssHNJhtXDC1MOya3j/sAiAGcrEtqtgjBD6wEzSDc7D8o6C8rIqAZyPk+NQoNLAZ1hR64Yl1FBY648smUYKnSg1Xwk/0DyRyArByMUobyByhCcPnOaPyoegREFS4jNfYAw+IHCjdC1J2WDZBke/OyN85J24WiXwDYPoJyYuCD238ulvuzwt6KgHf0shWKsqCFFGjB/w8HU8eeTED9wAAAAABJRU5ErkJggg==\";\r\n return BRDFTextureTools;\r\n}());\r\nexport { BRDFTextureTools };\r\n//# sourceMappingURL=brdfTextureTools.js.map","import { __decorate } from \"tslib\";\r\nimport { SerializationHelper, serialize, serializeAsTexture, expandToProperty, serializeAsColor3 } from \"../../Misc/decorators\";\r\nimport { Color3 } from '../../Maths/math.color';\r\nimport { MaterialFlags } from \"../materialFlags\";\r\nimport { MaterialHelper } from \"../../Materials/materialHelper\";\r\n/**\r\n * Define the code related to the clear coat parameters of the pbr material.\r\n */\r\nvar PBRClearCoatConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of clear coat configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function PBRClearCoatConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._isEnabled = false;\r\n /**\r\n * Defines if the clear coat is enabled in the material.\r\n */\r\n this.isEnabled = false;\r\n /**\r\n * Defines the clear coat layer strength (between 0 and 1) it defaults to 1.\r\n */\r\n this.intensity = 1;\r\n /**\r\n * Defines the clear coat layer roughness.\r\n */\r\n this.roughness = 0;\r\n this._indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n /**\r\n * Defines the index of refraction of the clear coat.\r\n * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence\r\n * The default fits with a polyurethane material.\r\n * Changing the default value is more performance intensive.\r\n */\r\n this.indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n this._texture = null;\r\n /**\r\n * Stores the clear coat values in a texture (red channel is intensity and green channel is roughness)\r\n * If useRoughnessFromMainTexture is false, the green channel of texture is not used and the green channel of textureRoughness is used instead\r\n * if textureRoughness is not empty, else no texture roughness is used\r\n */\r\n this.texture = null;\r\n this._useRoughnessFromMainTexture = true;\r\n /**\r\n * Indicates that the green channel of the texture property will be used for roughness (default: true)\r\n * If false, the green channel from textureRoughness is used for roughness\r\n */\r\n this.useRoughnessFromMainTexture = true;\r\n this._textureRoughness = null;\r\n /**\r\n * Stores the clear coat roughness in a texture (green channel)\r\n * Not used if useRoughnessFromMainTexture is true\r\n */\r\n this.textureRoughness = null;\r\n this._remapF0OnInterfaceChange = true;\r\n /**\r\n * Defines if the F0 value should be remapped to account for the interface change in the material.\r\n */\r\n this.remapF0OnInterfaceChange = true;\r\n this._bumpTexture = null;\r\n /**\r\n * Define the clear coat specific bump texture.\r\n */\r\n this.bumpTexture = null;\r\n this._isTintEnabled = false;\r\n /**\r\n * Defines if the clear coat tint is enabled in the material.\r\n */\r\n this.isTintEnabled = false;\r\n /**\r\n * Defines the clear coat tint of the material.\r\n * This is only use if tint is enabled\r\n */\r\n this.tintColor = Color3.White();\r\n /**\r\n * Defines the distance at which the tint color should be found in the\r\n * clear coat media.\r\n * This is only use if tint is enabled\r\n */\r\n this.tintColorAtDistance = 1;\r\n /**\r\n * Defines the clear coat layer thickness.\r\n * This is only use if tint is enabled\r\n */\r\n this.tintThickness = 1;\r\n this._tintTexture = null;\r\n /**\r\n * Stores the clear tint values in a texture.\r\n * rgb is tint\r\n * a is a thickness factor\r\n */\r\n this.tintTexture = null;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n PBRClearCoatConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Gets wehter the submesh is ready to be used or not.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @param engine defines the engine the material belongs to.\r\n * @param disableBumpMap defines wether the material disables bump or not.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRClearCoatConfiguration.prototype.isReadyForSubMesh = function (defines, scene, engine, disableBumpMap) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._textureRoughness && MaterialFlags.ClearCoatTextureEnabled) {\r\n if (!this._textureRoughness.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (engine.getCaps().standardDerivatives && this._bumpTexture && MaterialFlags.ClearCoatBumpTextureEnabled && !disableBumpMap) {\r\n // Bump texture cannot be not blocking.\r\n if (!this._bumpTexture.isReady()) {\r\n return false;\r\n }\r\n }\r\n if (this._isTintEnabled && this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n if (!this._tintTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene to the material belongs to.\r\n */\r\n PBRClearCoatConfiguration.prototype.prepareDefines = function (defines, scene) {\r\n var _a;\r\n if (this._isEnabled) {\r\n defines.CLEARCOAT = true;\r\n defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = this._useRoughnessFromMainTexture;\r\n defines.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL = this._texture !== null && this._texture._texture === ((_a = this._textureRoughness) === null || _a === void 0 ? void 0 : _a._texture) && this._texture.checkTransformsAreIdentical(this._textureRoughness);\r\n defines.CLEARCOAT_REMAP_F0 = this._remapF0OnInterfaceChange;\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._texture, defines, \"CLEARCOAT_TEXTURE\");\r\n }\r\n else {\r\n defines.CLEARCOAT_TEXTURE = false;\r\n }\r\n if (this._textureRoughness && MaterialFlags.ClearCoatTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._textureRoughness, defines, \"CLEARCOAT_TEXTURE_ROUGHNESS\");\r\n }\r\n else {\r\n defines.CLEARCOAT_TEXTURE_ROUGHNESS = false;\r\n }\r\n if (this._bumpTexture && MaterialFlags.ClearCoatBumpTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._bumpTexture, defines, \"CLEARCOAT_BUMP\");\r\n }\r\n else {\r\n defines.CLEARCOAT_BUMP = false;\r\n }\r\n defines.CLEARCOAT_DEFAULTIOR = this._indexOfRefraction === PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n if (this._isTintEnabled) {\r\n defines.CLEARCOAT_TINT = true;\r\n if (this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._tintTexture, defines, \"CLEARCOAT_TINT_TEXTURE\");\r\n }\r\n else {\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n }\r\n }\r\n else {\r\n defines.CLEARCOAT_TINT = false;\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n defines.CLEARCOAT = false;\r\n defines.CLEARCOAT_TEXTURE = false;\r\n defines.CLEARCOAT_TEXTURE_ROUGHNESS = false;\r\n defines.CLEARCOAT_BUMP = false;\r\n defines.CLEARCOAT_TINT = false;\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\r\n defines.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL = false;\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param engine defines the engine the material belongs to.\r\n * @param disableBumpMap defines wether the material disables bump or not.\r\n * @param isFrozen defines wether the material is frozen or not.\r\n * @param invertNormalMapX If sets to true, x component of normal map value will be inverted (x = 1.0 - x).\r\n * @param invertNormalMapY If sets to true, y component of normal map value will be inverted (y = 1.0 - y).\r\n * @param subMesh the submesh to bind data for\r\n */\r\n PBRClearCoatConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, engine, disableBumpMap, isFrozen, invertNormalMapX, invertNormalMapY, subMesh) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h;\r\n var defines = subMesh._materialDefines;\r\n var identicalTextures = defines.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL;\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (identicalTextures && MaterialFlags.ClearCoatTextureEnabled) {\r\n uniformBuffer.updateFloat4(\"vClearCoatInfos\", this._texture.coordinatesIndex, this._texture.level, -1, -1);\r\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"clearCoat\");\r\n }\r\n else if ((this._texture || this._textureRoughness) && MaterialFlags.ClearCoatTextureEnabled) {\r\n uniformBuffer.updateFloat4(\"vClearCoatInfos\", (_b = (_a = this._texture) === null || _a === void 0 ? void 0 : _a.coordinatesIndex) !== null && _b !== void 0 ? _b : 0, (_d = (_c = this._texture) === null || _c === void 0 ? void 0 : _c.level) !== null && _d !== void 0 ? _d : 0, (_f = (_e = this._textureRoughness) === null || _e === void 0 ? void 0 : _e.coordinatesIndex) !== null && _f !== void 0 ? _f : 0, (_h = (_g = this._textureRoughness) === null || _g === void 0 ? void 0 : _g.level) !== null && _h !== void 0 ? _h : 0);\r\n if (this._texture) {\r\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"clearCoat\");\r\n }\r\n if (this._textureRoughness && !identicalTextures && !defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE) {\r\n MaterialHelper.BindTextureMatrix(this._textureRoughness, uniformBuffer, \"clearCoatRoughness\");\r\n }\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.ClearCoatTextureEnabled && !disableBumpMap) {\r\n uniformBuffer.updateFloat2(\"vClearCoatBumpInfos\", this._bumpTexture.coordinatesIndex, this._bumpTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._bumpTexture, uniformBuffer, \"clearCoatBump\");\r\n if (scene._mirroredCameraPosition) {\r\n uniformBuffer.updateFloat2(\"vClearCoatTangentSpaceParams\", invertNormalMapX ? 1.0 : -1.0, invertNormalMapY ? 1.0 : -1.0);\r\n }\r\n else {\r\n uniformBuffer.updateFloat2(\"vClearCoatTangentSpaceParams\", invertNormalMapX ? -1.0 : 1.0, invertNormalMapY ? -1.0 : 1.0);\r\n }\r\n }\r\n if (this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vClearCoatTintInfos\", this._tintTexture.coordinatesIndex, this._tintTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._tintTexture, uniformBuffer, \"clearCoatTint\");\r\n }\r\n // Clear Coat General params\r\n uniformBuffer.updateFloat2(\"vClearCoatParams\", this.intensity, this.roughness);\r\n // Clear Coat Refraction params\r\n var a = 1 - this._indexOfRefraction;\r\n var b = 1 + this._indexOfRefraction;\r\n var f0 = Math.pow((-a / b), 2); // Schlicks approx: (ior1 - ior2) / (ior1 + ior2) where ior2 for air is close to vacuum = 1.\r\n var eta = 1 / this._indexOfRefraction;\r\n uniformBuffer.updateFloat4(\"vClearCoatRefractionParams\", f0, eta, a, b);\r\n if (this._isTintEnabled) {\r\n uniformBuffer.updateFloat4(\"vClearCoatTintParams\", this.tintColor.r, this.tintColor.g, this.tintColor.b, Math.max(0.00001, this.tintThickness));\r\n uniformBuffer.updateFloat(\"clearCoatColorAtDistance\", Math.max(0.00001, this.tintColorAtDistance));\r\n }\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatSampler\", this._texture);\r\n }\r\n if (this._textureRoughness && !identicalTextures && !defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE && MaterialFlags.ClearCoatTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatRoughnessSampler\", this._textureRoughness);\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.ClearCoatBumpTextureEnabled && !disableBumpMap) {\r\n uniformBuffer.setTexture(\"clearCoatBumpSampler\", this._bumpTexture);\r\n }\r\n if (this._isTintEnabled && this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatTintSampler\", this._tintTexture);\r\n }\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRClearCoatConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n if (this._textureRoughness === texture) {\r\n return true;\r\n }\r\n if (this._bumpTexture === texture) {\r\n return true;\r\n }\r\n if (this._tintTexture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRClearCoatConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n if (this._textureRoughness) {\r\n activeTextures.push(this._textureRoughness);\r\n }\r\n if (this._bumpTexture) {\r\n activeTextures.push(this._bumpTexture);\r\n }\r\n if (this._tintTexture) {\r\n activeTextures.push(this._tintTexture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRClearCoatConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n if (this._textureRoughness && this._textureRoughness.animations && this._textureRoughness.animations.length > 0) {\r\n animatables.push(this._textureRoughness);\r\n }\r\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\r\n animatables.push(this._bumpTexture);\r\n }\r\n if (this._tintTexture && this._tintTexture.animations && this._tintTexture.animations.length > 0) {\r\n animatables.push(this._tintTexture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRClearCoatConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n var _a, _b, _c, _d;\r\n if (forceDisposeTextures) {\r\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.dispose();\r\n (_b = this._textureRoughness) === null || _b === void 0 ? void 0 : _b.dispose();\r\n (_c = this._bumpTexture) === null || _c === void 0 ? void 0 : _c.dispose();\r\n (_d = this._tintTexture) === null || _d === void 0 ? void 0 : _d.dispose();\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRClearCoatConfiguration\"\r\n */\r\n PBRClearCoatConfiguration.prototype.getClassName = function () {\r\n return \"PBRClearCoatConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRClearCoatConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.CLEARCOAT_BUMP) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT_BUMP\");\r\n }\r\n if (defines.CLEARCOAT_TINT) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT_TINT\");\r\n }\r\n if (defines.CLEARCOAT) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRClearCoatConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vClearCoatTangentSpaceParams\", \"vClearCoatParams\", \"vClearCoatRefractionParams\", \"vClearCoatTintParams\", \"clearCoatColorAtDistance\", \"clearCoatMatrix\", \"clearCoatRoughnessMatrix\", \"clearCoatBumpMatrix\", \"clearCoatTintMatrix\", \"vClearCoatInfos\", \"vClearCoatBumpInfos\", \"vClearCoatTintInfos\");\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRClearCoatConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"clearCoatSampler\", \"clearCoatRoughnessSampler\", \"clearCoatBumpSampler\", \"clearCoatTintSampler\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRClearCoatConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vClearCoatParams\", 2);\r\n uniformBuffer.addUniform(\"vClearCoatRefractionParams\", 4);\r\n uniformBuffer.addUniform(\"vClearCoatInfos\", 4);\r\n uniformBuffer.addUniform(\"clearCoatMatrix\", 16);\r\n uniformBuffer.addUniform(\"clearCoatRoughnessMatrix\", 16);\r\n uniformBuffer.addUniform(\"vClearCoatBumpInfos\", 2);\r\n uniformBuffer.addUniform(\"vClearCoatTangentSpaceParams\", 2);\r\n uniformBuffer.addUniform(\"clearCoatBumpMatrix\", 16);\r\n uniformBuffer.addUniform(\"vClearCoatTintParams\", 4);\r\n uniformBuffer.addUniform(\"clearCoatColorAtDistance\", 1);\r\n uniformBuffer.addUniform(\"vClearCoatTintInfos\", 2);\r\n uniformBuffer.addUniform(\"clearCoatTintMatrix\", 16);\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param clearCoatConfiguration define the config where to copy the info\r\n */\r\n PBRClearCoatConfiguration.prototype.copyTo = function (clearCoatConfiguration) {\r\n SerializationHelper.Clone(function () { return clearCoatConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this clear coat configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRClearCoatConfiguration.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRClearCoatConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n SerializationHelper.Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n /**\r\n * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence\r\n * The default fits with a polyurethane material.\r\n * @hidden\r\n */\r\n PBRClearCoatConfiguration._DefaultIndexOfRefraction = 1.5;\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"isEnabled\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRClearCoatConfiguration.prototype, \"intensity\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRClearCoatConfiguration.prototype, \"roughness\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"indexOfRefraction\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"texture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"useRoughnessFromMainTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"textureRoughness\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"remapF0OnInterfaceChange\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"bumpTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"isTintEnabled\", void 0);\r\n __decorate([\r\n serializeAsColor3()\r\n ], PBRClearCoatConfiguration.prototype, \"tintColor\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRClearCoatConfiguration.prototype, \"tintColorAtDistance\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRClearCoatConfiguration.prototype, \"tintThickness\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRClearCoatConfiguration.prototype, \"tintTexture\", void 0);\r\n return PBRClearCoatConfiguration;\r\n}());\r\nexport { PBRClearCoatConfiguration };\r\n//# sourceMappingURL=pbrClearCoatConfiguration.js.map","import { __decorate } from \"tslib\";\r\nimport { SerializationHelper, serialize, expandToProperty, serializeAsVector2, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { VertexBuffer } from \"../../Meshes/buffer\";\r\nimport { Vector2 } from \"../../Maths/math.vector\";\r\nimport { MaterialFlags } from \"../../Materials/materialFlags\";\r\nimport { MaterialHelper } from \"../../Materials/materialHelper\";\r\n/**\r\n * Define the code related to the anisotropic parameters of the pbr material.\r\n */\r\nvar PBRAnisotropicConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of anisotropy configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function PBRAnisotropicConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._isEnabled = false;\r\n /**\r\n * Defines if the anisotropy is enabled in the material.\r\n */\r\n this.isEnabled = false;\r\n /**\r\n * Defines the anisotropy strength (between 0 and 1) it defaults to 1.\r\n */\r\n this.intensity = 1;\r\n /**\r\n * Defines if the effect is along the tangents, bitangents or in between.\r\n * By default, the effect is \"strectching\" the highlights along the tangents.\r\n */\r\n this.direction = new Vector2(1, 0);\r\n this._texture = null;\r\n /**\r\n * Stores the anisotropy values in a texture.\r\n * rg is direction (like normal from -1 to 1)\r\n * b is a intensity\r\n */\r\n this.texture = null;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n PBRAnisotropicConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRAnisotropicConfiguration.prototype.isReadyForSubMesh = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.AnisotropicTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param mesh the mesh we are preparing the defines for.\r\n * @param scene defines the scene the material belongs to.\r\n */\r\n PBRAnisotropicConfiguration.prototype.prepareDefines = function (defines, mesh, scene) {\r\n if (this._isEnabled) {\r\n defines.ANISOTROPIC = this._isEnabled;\r\n if (this._isEnabled && !mesh.isVerticesDataPresent(VertexBuffer.TangentKind)) {\r\n defines._needUVs = true;\r\n defines.MAINUV1 = true;\r\n }\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.AnisotropicTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._texture, defines, \"ANISOTROPIC_TEXTURE\");\r\n }\r\n else {\r\n defines.ANISOTROPIC_TEXTURE = false;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n defines.ANISOTROPIC = false;\r\n defines.ANISOTROPIC_TEXTURE = false;\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param isFrozen defines wether the material is frozen or not.\r\n */\r\n PBRAnisotropicConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, isFrozen) {\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (this._texture && MaterialFlags.AnisotropicTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vAnisotropyInfos\", this._texture.coordinatesIndex, this._texture.level);\r\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"anisotropy\");\r\n }\r\n // Anisotropy\r\n uniformBuffer.updateFloat3(\"vAnisotropy\", this.direction.x, this.direction.y, this.intensity);\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.AnisotropicTextureEnabled) {\r\n uniformBuffer.setTexture(\"anisotropySampler\", this._texture);\r\n }\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRAnisotropicConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRAnisotropicConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRAnisotropicConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRAnisotropicConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._texture) {\r\n this._texture.dispose();\r\n }\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRAnisotropicConfiguration\"\r\n */\r\n PBRAnisotropicConfiguration.prototype.getClassName = function () {\r\n return \"PBRAnisotropicConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRAnisotropicConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.ANISOTROPIC) {\r\n fallbacks.addFallback(currentRank++, \"ANISOTROPIC\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRAnisotropicConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vAnisotropy\", \"vAnisotropyInfos\", \"anisotropyMatrix\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRAnisotropicConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vAnisotropy\", 3);\r\n uniformBuffer.addUniform(\"vAnisotropyInfos\", 2);\r\n uniformBuffer.addUniform(\"anisotropyMatrix\", 16);\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRAnisotropicConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"anisotropySampler\");\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param anisotropicConfiguration define the config where to copy the info\r\n */\r\n PBRAnisotropicConfiguration.prototype.copyTo = function (anisotropicConfiguration) {\r\n SerializationHelper.Clone(function () { return anisotropicConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this anisotropy configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRAnisotropicConfiguration.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRAnisotropicConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n SerializationHelper.Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRAnisotropicConfiguration.prototype, \"isEnabled\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRAnisotropicConfiguration.prototype, \"intensity\", void 0);\r\n __decorate([\r\n serializeAsVector2()\r\n ], PBRAnisotropicConfiguration.prototype, \"direction\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRAnisotropicConfiguration.prototype, \"texture\", void 0);\r\n return PBRAnisotropicConfiguration;\r\n}());\r\nexport { PBRAnisotropicConfiguration };\r\n//# sourceMappingURL=pbrAnisotropicConfiguration.js.map","import { __decorate } from \"tslib\";\r\nimport { SerializationHelper, serialize, expandToProperty } from \"../../Misc/decorators\";\r\n/**\r\n * Define the code related to the BRDF parameters of the pbr material.\r\n */\r\nvar PBRBRDFConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of clear coat configuration.\r\n * @param markAllSubMeshesAsMiscDirty Callback to flag the material to dirty\r\n */\r\n function PBRBRDFConfiguration(markAllSubMeshesAsMiscDirty) {\r\n this._useEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION;\r\n /**\r\n * Defines if the material uses energy conservation.\r\n */\r\n this.useEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION;\r\n this._useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED;\r\n /**\r\n * LEGACY Mode set to false\r\n * Defines if the material uses height smith correlated visibility term.\r\n * If you intent to not use our default BRDF, you need to load a separate BRDF Texture for the PBR\r\n * You can either load https://assets.babylonjs.com/environments/uncorrelatedBRDF.png\r\n * or https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds to have more precision\r\n * Not relying on height correlated will also disable energy conservation.\r\n */\r\n this.useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED;\r\n this._useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS;\r\n /**\r\n * LEGACY Mode set to false\r\n * Defines if the material uses spherical harmonics vs spherical polynomials for the\r\n * diffuse part of the IBL.\r\n * The harmonics despite a tiny bigger cost has been proven to provide closer results\r\n * to the ground truth.\r\n */\r\n this.useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS;\r\n this._useSpecularGlossinessInputEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION;\r\n /**\r\n * Defines if the material uses energy conservation, when the specular workflow is active.\r\n * If activated, the albedo color is multiplied with (1. - maxChannel(specular color)).\r\n * If deactivated, a material is only physically plausible, when (albedo color + specular color) < 1.\r\n * In the deactivated case, the material author has to ensure energy conservation, for a physically plausible rendering.\r\n */\r\n this.useSpecularGlossinessInputEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION;\r\n this._internalMarkAllSubMeshesAsMiscDirty = markAllSubMeshesAsMiscDirty;\r\n }\r\n /** @hidden */\r\n PBRBRDFConfiguration.prototype._markAllSubMeshesAsMiscDirty = function () {\r\n this._internalMarkAllSubMeshesAsMiscDirty();\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n */\r\n PBRBRDFConfiguration.prototype.prepareDefines = function (defines) {\r\n defines.BRDF_V_HEIGHT_CORRELATED = this._useSmithVisibilityHeightCorrelated;\r\n defines.MS_BRDF_ENERGY_CONSERVATION = this._useEnergyConservation && this._useSmithVisibilityHeightCorrelated;\r\n defines.SPHERICAL_HARMONICS = this._useSphericalHarmonics;\r\n defines.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION = this._useSpecularGlossinessInputEnergyConservation;\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRClearCoatConfiguration\"\r\n */\r\n PBRBRDFConfiguration.prototype.getClassName = function () {\r\n return \"PBRBRDFConfiguration\";\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param brdfConfiguration define the config where to copy the info\r\n */\r\n PBRBRDFConfiguration.prototype.copyTo = function (brdfConfiguration) {\r\n SerializationHelper.Clone(function () { return brdfConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this BRDF configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRBRDFConfiguration.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRBRDFConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n SerializationHelper.Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n /**\r\n * Default value used for the energy conservation.\r\n * This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.\r\n */\r\n PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION = true;\r\n /**\r\n * Default value used for the Smith Visibility Height Correlated mode.\r\n * This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.\r\n */\r\n PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED = true;\r\n /**\r\n * Default value used for the IBL diffuse part.\r\n * This can help switching back to the polynomials mode globally which is a tiny bit\r\n * less GPU intensive at the drawback of a lower quality.\r\n */\r\n PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS = true;\r\n /**\r\n * Default value used for activating energy conservation for the specular workflow.\r\n * If activated, the albedo color is multiplied with (1. - maxChannel(specular color)).\r\n * If deactivated, a material is only physically plausible, when (albedo color + specular color) < 1.\r\n */\r\n PBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION = true;\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBRDFConfiguration.prototype, \"useEnergyConservation\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBRDFConfiguration.prototype, \"useSmithVisibilityHeightCorrelated\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBRDFConfiguration.prototype, \"useSphericalHarmonics\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBRDFConfiguration.prototype, \"useSpecularGlossinessInputEnergyConservation\", void 0);\r\n return PBRBRDFConfiguration;\r\n}());\r\nexport { PBRBRDFConfiguration };\r\n//# sourceMappingURL=pbrBRDFConfiguration.js.map","import { __decorate } from \"tslib\";\r\nimport { SerializationHelper, serialize, expandToProperty, serializeAsColor3, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { Color3 } from '../../Maths/math.color';\r\nimport { MaterialFlags } from \"../../Materials/materialFlags\";\r\nimport { MaterialHelper } from \"../../Materials/materialHelper\";\r\n/**\r\n * Define the code related to the Sheen parameters of the pbr material.\r\n */\r\nvar PBRSheenConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of clear coat configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n */\r\n function PBRSheenConfiguration(markAllSubMeshesAsTexturesDirty) {\r\n this._isEnabled = false;\r\n /**\r\n * Defines if the material uses sheen.\r\n */\r\n this.isEnabled = false;\r\n this._linkSheenWithAlbedo = false;\r\n /**\r\n * Defines if the sheen is linked to the sheen color.\r\n */\r\n this.linkSheenWithAlbedo = false;\r\n /**\r\n * Defines the sheen intensity.\r\n */\r\n this.intensity = 1;\r\n /**\r\n * Defines the sheen color.\r\n */\r\n this.color = Color3.White();\r\n this._texture = null;\r\n /**\r\n * Stores the sheen tint values in a texture.\r\n * rgb is tint\r\n * a is a intensity or roughness if the roughness property has been defined and useRoughnessFromTexture is true (in that case, textureRoughness won't be used)\r\n * If the roughness property has been defined and useRoughnessFromTexture is false then the alpha channel is not used to modulate roughness\r\n */\r\n this.texture = null;\r\n this._useRoughnessFromMainTexture = true;\r\n /**\r\n * Indicates that the alpha channel of the texture property will be used for roughness.\r\n * Has no effect if the roughness (and texture!) property is not defined\r\n */\r\n this.useRoughnessFromMainTexture = true;\r\n this._roughness = null;\r\n /**\r\n * Defines the sheen roughness.\r\n * It is not taken into account if linkSheenWithAlbedo is true.\r\n * To stay backward compatible, material roughness is used instead if sheen roughness = null\r\n */\r\n this.roughness = null;\r\n this._textureRoughness = null;\r\n /**\r\n * Stores the sheen roughness in a texture.\r\n * alpha channel is the roughness. This texture won't be used if the texture property is not empty and useRoughnessFromTexture is true\r\n */\r\n this.textureRoughness = null;\r\n this._albedoScaling = false;\r\n /**\r\n * If true, the sheen effect is layered above the base BRDF with the albedo-scaling technique.\r\n * It allows the strength of the sheen effect to not depend on the base color of the material,\r\n * making it easier to setup and tweak the effect\r\n */\r\n this.albedoScaling = false;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n }\r\n /** @hidden */\r\n PBRSheenConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRSheenConfiguration.prototype.isReadyForSubMesh = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.SheenTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._textureRoughness && MaterialFlags.SheenTextureEnabled) {\r\n if (!this._textureRoughness.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n */\r\n PBRSheenConfiguration.prototype.prepareDefines = function (defines, scene) {\r\n var _a;\r\n if (this._isEnabled) {\r\n defines.SHEEN = this._isEnabled;\r\n defines.SHEEN_LINKWITHALBEDO = this._linkSheenWithAlbedo;\r\n defines.SHEEN_ROUGHNESS = this._roughness !== null;\r\n defines.SHEEN_ALBEDOSCALING = this._albedoScaling;\r\n defines.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = this._useRoughnessFromMainTexture;\r\n defines.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL = this._texture !== null && this._texture._texture === ((_a = this._textureRoughness) === null || _a === void 0 ? void 0 : _a._texture) && this._texture.checkTransformsAreIdentical(this._textureRoughness);\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.SheenTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._texture, defines, \"SHEEN_TEXTURE\");\r\n }\r\n else {\r\n defines.SHEEN_TEXTURE = false;\r\n }\r\n if (this._textureRoughness && MaterialFlags.SheenTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._textureRoughness, defines, \"SHEEN_TEXTURE_ROUGHNESS\");\r\n }\r\n else {\r\n defines.SHEEN_TEXTURE_ROUGHNESS = false;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n defines.SHEEN = false;\r\n defines.SHEEN_TEXTURE = false;\r\n defines.SHEEN_TEXTURE_ROUGHNESS = false;\r\n defines.SHEEN_LINKWITHALBEDO = false;\r\n defines.SHEEN_ROUGHNESS = false;\r\n defines.SHEEN_ALBEDOSCALING = false;\r\n defines.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\r\n defines.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL = false;\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param isFrozen defines wether the material is frozen or not.\r\n * @param subMesh the submesh to bind data for\r\n */\r\n PBRSheenConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, isFrozen, subMesh) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h;\r\n var defines = subMesh._materialDefines;\r\n var identicalTextures = defines.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL;\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (identicalTextures && MaterialFlags.SheenTextureEnabled) {\r\n uniformBuffer.updateFloat4(\"vSheenInfos\", this._texture.coordinatesIndex, this._texture.level, -1, -1);\r\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"sheen\");\r\n }\r\n else if ((this._texture || this._textureRoughness) && MaterialFlags.SheenTextureEnabled) {\r\n uniformBuffer.updateFloat4(\"vSheenInfos\", (_b = (_a = this._texture) === null || _a === void 0 ? void 0 : _a.coordinatesIndex) !== null && _b !== void 0 ? _b : 0, (_d = (_c = this._texture) === null || _c === void 0 ? void 0 : _c.level) !== null && _d !== void 0 ? _d : 0, (_f = (_e = this._textureRoughness) === null || _e === void 0 ? void 0 : _e.coordinatesIndex) !== null && _f !== void 0 ? _f : 0, (_h = (_g = this._textureRoughness) === null || _g === void 0 ? void 0 : _g.level) !== null && _h !== void 0 ? _h : 0);\r\n if (this._texture) {\r\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"sheen\");\r\n }\r\n if (this._textureRoughness && !identicalTextures && !defines.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE) {\r\n MaterialHelper.BindTextureMatrix(this._textureRoughness, uniformBuffer, \"sheenRoughness\");\r\n }\r\n }\r\n // Sheen\r\n uniformBuffer.updateFloat4(\"vSheenColor\", this.color.r, this.color.g, this.color.b, this.intensity);\r\n if (this._roughness !== null) {\r\n uniformBuffer.updateFloat(\"vSheenRoughness\", this._roughness);\r\n }\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.SheenTextureEnabled) {\r\n uniformBuffer.setTexture(\"sheenSampler\", this._texture);\r\n }\r\n if (this._textureRoughness && !identicalTextures && !defines.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE && MaterialFlags.SheenTextureEnabled) {\r\n uniformBuffer.setTexture(\"sheenRoughnessSampler\", this._textureRoughness);\r\n }\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRSheenConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n if (this._textureRoughness === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRSheenConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n if (this._textureRoughness) {\r\n activeTextures.push(this._textureRoughness);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRSheenConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n if (this._textureRoughness && this._textureRoughness.animations && this._textureRoughness.animations.length > 0) {\r\n animatables.push(this._textureRoughness);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRSheenConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n var _a, _b;\r\n if (forceDisposeTextures) {\r\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.dispose();\r\n (_b = this._textureRoughness) === null || _b === void 0 ? void 0 : _b.dispose();\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRSheenConfiguration\"\r\n */\r\n PBRSheenConfiguration.prototype.getClassName = function () {\r\n return \"PBRSheenConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRSheenConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.SHEEN) {\r\n fallbacks.addFallback(currentRank++, \"SHEEN\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRSheenConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vSheenColor\", \"vSheenRoughness\", \"vSheenInfos\", \"sheenMatrix\", \"sheenRoughnessMatrix\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRSheenConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vSheenColor\", 4);\r\n uniformBuffer.addUniform(\"vSheenRoughness\", 1);\r\n uniformBuffer.addUniform(\"vSheenInfos\", 4);\r\n uniformBuffer.addUniform(\"sheenMatrix\", 16);\r\n uniformBuffer.addUniform(\"sheenRoughnessMatrix\", 16);\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRSheenConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"sheenSampler\");\r\n samplers.push(\"sheenRoughnessSampler\");\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param sheenConfiguration define the config where to copy the info\r\n */\r\n PBRSheenConfiguration.prototype.copyTo = function (sheenConfiguration) {\r\n SerializationHelper.Clone(function () { return sheenConfiguration; }, this);\r\n };\r\n /**\r\n * Serializes this BRDF configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRSheenConfiguration.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRSheenConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n SerializationHelper.Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"isEnabled\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"linkSheenWithAlbedo\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSheenConfiguration.prototype, \"intensity\", void 0);\r\n __decorate([\r\n serializeAsColor3()\r\n ], PBRSheenConfiguration.prototype, \"color\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"texture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"useRoughnessFromMainTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"roughness\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"textureRoughness\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSheenConfiguration.prototype, \"albedoScaling\", void 0);\r\n return PBRSheenConfiguration;\r\n}());\r\nexport { PBRSheenConfiguration };\r\n//# sourceMappingURL=pbrSheenConfiguration.js.map","import { __decorate } from \"tslib\";\r\nimport { SerializationHelper, serialize, serializeAsTexture, expandToProperty, serializeAsColor3 } from \"../../Misc/decorators\";\r\nimport { Color3 } from '../../Maths/math.color';\r\nimport { MaterialFlags } from \"../materialFlags\";\r\nimport { MaterialHelper } from \"../../Materials/materialHelper\";\r\nimport { Scalar } from \"../../Maths/math.scalar\";\r\n/**\r\n * Define the code related to the sub surface parameters of the pbr material.\r\n */\r\nvar PBRSubSurfaceConfiguration = /** @class */ (function () {\r\n /**\r\n * Instantiate a new istance of sub surface configuration.\r\n * @param markAllSubMeshesAsTexturesDirty Callback to flag the material to dirty\r\n * @param markScenePrePassDirty Callback to flag the scene as prepass dirty\r\n * @param scene The scene\r\n */\r\n function PBRSubSurfaceConfiguration(markAllSubMeshesAsTexturesDirty, markScenePrePassDirty, scene) {\r\n this._isRefractionEnabled = false;\r\n /**\r\n * Defines if the refraction is enabled in the material.\r\n */\r\n this.isRefractionEnabled = false;\r\n this._isTranslucencyEnabled = false;\r\n /**\r\n * Defines if the translucency is enabled in the material.\r\n */\r\n this.isTranslucencyEnabled = false;\r\n this._isScatteringEnabled = false;\r\n /**\r\n * Defines if the sub surface scattering is enabled in the material.\r\n */\r\n this.isScatteringEnabled = false;\r\n this._scatteringDiffusionProfileIndex = 0;\r\n /**\r\n * Defines the refraction intensity of the material.\r\n * The refraction when enabled replaces the Diffuse part of the material.\r\n * The intensity helps transitionning between diffuse and refraction.\r\n */\r\n this.refractionIntensity = 1;\r\n /**\r\n * Defines the translucency intensity of the material.\r\n * When translucency has been enabled, this defines how much of the \"translucency\"\r\n * is addded to the diffuse part of the material.\r\n */\r\n this.translucencyIntensity = 1;\r\n /**\r\n * When enabled, transparent surfaces will be tinted with the albedo colour (independent of thickness)\r\n */\r\n this.useAlbedoToTintRefraction = false;\r\n this._thicknessTexture = null;\r\n /**\r\n * Stores the average thickness of a mesh in a texture (The texture is holding the values linearly).\r\n * The red channel of the texture should contain the thickness remapped between 0 and 1.\r\n * 0 would mean minimumThickness\r\n * 1 would mean maximumThickness\r\n * The other channels might be use as a mask to vary the different effects intensity.\r\n */\r\n this.thicknessTexture = null;\r\n this._refractionTexture = null;\r\n /**\r\n * Defines the texture to use for refraction.\r\n */\r\n this.refractionTexture = null;\r\n this._indexOfRefraction = 1.5;\r\n /**\r\n * Index of refraction of the material base layer.\r\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\r\n *\r\n * This does not only impact refraction but also the Base F0 of Dielectric Materials.\r\n *\r\n * From dielectric fresnel rules: F0 = square((iorT - iorI) / (iorT + iorI))\r\n */\r\n this.indexOfRefraction = 1.5;\r\n this._volumeIndexOfRefraction = -1.0;\r\n this._invertRefractionY = false;\r\n /**\r\n * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.\r\n */\r\n this.invertRefractionY = false;\r\n this._linkRefractionWithTransparency = false;\r\n /**\r\n * This parameters will make the material used its opacity to control how much it is refracting aginst not.\r\n * Materials half opaque for instance using refraction could benefit from this control.\r\n */\r\n this.linkRefractionWithTransparency = false;\r\n /**\r\n * Defines the minimum thickness stored in the thickness map.\r\n * If no thickness map is defined, this value will be used to simulate thickness.\r\n */\r\n this.minimumThickness = 0;\r\n /**\r\n * Defines the maximum thickness stored in the thickness map.\r\n */\r\n this.maximumThickness = 1;\r\n /**\r\n * Defines the volume tint of the material.\r\n * This is used for both translucency and scattering.\r\n */\r\n this.tintColor = Color3.White();\r\n /**\r\n * Defines the distance at which the tint color should be found in the media.\r\n * This is used for refraction only.\r\n */\r\n this.tintColorAtDistance = 1;\r\n /**\r\n * Defines how far each channel transmit through the media.\r\n * It is defined as a color to simplify it selection.\r\n */\r\n this.diffusionDistance = Color3.White();\r\n this._useMaskFromThicknessTexture = false;\r\n /**\r\n * Stores the intensity of the different subsurface effects in the thickness texture.\r\n * * the green channel is the translucency intensity.\r\n * * the blue channel is the scattering intensity.\r\n * * the alpha channel is the refraction intensity.\r\n */\r\n this.useMaskFromThicknessTexture = false;\r\n this._useMaskFromThicknessTextureGltf = false;\r\n /**\r\n * Stores the intensity of the different subsurface effects in the thickness texture. This variation\r\n * matches the channel-packing that is used by glTF.\r\n * * the red channel is the transmission/translucency intensity.\r\n * * the green channel is the thickness.\r\n */\r\n this.useMaskFromThicknessTextureGltf = false;\r\n this._internalMarkAllSubMeshesAsTexturesDirty = markAllSubMeshesAsTexturesDirty;\r\n this._internalMarkScenePrePassDirty = markScenePrePassDirty;\r\n this._scene = scene;\r\n }\r\n Object.defineProperty(PBRSubSurfaceConfiguration.prototype, \"scatteringDiffusionProfile\", {\r\n /**\r\n * Diffusion profile for subsurface scattering.\r\n * Useful for better scattering in the skins or foliages.\r\n */\r\n get: function () {\r\n if (!this._scene.subSurfaceConfiguration) {\r\n return null;\r\n }\r\n return this._scene.subSurfaceConfiguration.ssDiffusionProfileColors[this._scatteringDiffusionProfileIndex];\r\n },\r\n set: function (c) {\r\n if (!this._scene.enableSubSurfaceForPrePass()) {\r\n // Not supported\r\n return;\r\n }\r\n // addDiffusionProfile automatically checks for doubles\r\n if (c) {\r\n this._scatteringDiffusionProfileIndex = this._scene.subSurfaceConfiguration.addDiffusionProfile(c);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRSubSurfaceConfiguration.prototype, \"volumeIndexOfRefraction\", {\r\n /**\r\n * Index of refraction of the material's volume.\r\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\r\n *\r\n * This ONLY impacts refraction. If not provided or given a non-valid value,\r\n * the volume will use the same IOR as the surface.\r\n */\r\n get: function () {\r\n if (this._volumeIndexOfRefraction >= 1.0) {\r\n return this._volumeIndexOfRefraction;\r\n }\r\n return this._indexOfRefraction;\r\n },\r\n set: function (value) {\r\n if (value >= 1.0) {\r\n this._volumeIndexOfRefraction = value;\r\n }\r\n else {\r\n this._volumeIndexOfRefraction = -1.0;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n PBRSubSurfaceConfiguration.prototype._markAllSubMeshesAsTexturesDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n };\r\n /** @hidden */\r\n PBRSubSurfaceConfiguration.prototype._markScenePrePassDirty = function () {\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n this._internalMarkScenePrePassDirty();\r\n };\r\n /**\r\n * Gets wehter the submesh is ready to be used or not.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.isReadyForSubMesh = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._thicknessTexture && MaterialFlags.ThicknessTextureEnabled) {\r\n if (!this._thicknessTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n var refractionTexture = this._getRefractionTexture(scene);\r\n if (refractionTexture && MaterialFlags.RefractionTextureEnabled) {\r\n if (!refractionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param defines the list of \"defines\" to update.\r\n * @param scene defines the scene to the material belongs to.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.prepareDefines = function (defines, scene) {\r\n if (defines._areTexturesDirty) {\r\n defines.SUBSURFACE = false;\r\n defines.SS_TRANSLUCENCY = this._isTranslucencyEnabled;\r\n defines.SS_SCATTERING = this._isScatteringEnabled;\r\n defines.SS_THICKNESSANDMASK_TEXTURE = false;\r\n defines.SS_MASK_FROM_THICKNESS_TEXTURE = false;\r\n defines.SS_MASK_FROM_THICKNESS_TEXTURE_GLTF = false;\r\n defines.SS_REFRACTION = false;\r\n defines.SS_REFRACTIONMAP_3D = false;\r\n defines.SS_GAMMAREFRACTION = false;\r\n defines.SS_RGBDREFRACTION = false;\r\n defines.SS_LINEARSPECULARREFRACTION = false;\r\n defines.SS_REFRACTIONMAP_OPPOSITEZ = false;\r\n defines.SS_LODINREFRACTIONALPHA = false;\r\n defines.SS_LINKREFRACTIONTOTRANSPARENCY = false;\r\n defines.SS_ALBEDOFORREFRACTIONTINT = false;\r\n if (this._isRefractionEnabled || this._isTranslucencyEnabled || this._isScatteringEnabled) {\r\n defines.SUBSURFACE = true;\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._thicknessTexture && MaterialFlags.ThicknessTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._thicknessTexture, defines, \"SS_THICKNESSANDMASK_TEXTURE\");\r\n }\r\n }\r\n }\r\n defines.SS_MASK_FROM_THICKNESS_TEXTURE = this._useMaskFromThicknessTexture;\r\n defines.SS_MASK_FROM_THICKNESS_TEXTURE_GLTF = this._useMaskFromThicknessTextureGltf;\r\n }\r\n if (this._isRefractionEnabled) {\r\n if (scene.texturesEnabled) {\r\n var refractionTexture = this._getRefractionTexture(scene);\r\n if (refractionTexture && MaterialFlags.RefractionTextureEnabled) {\r\n defines.SS_REFRACTION = true;\r\n defines.SS_REFRACTIONMAP_3D = refractionTexture.isCube;\r\n defines.SS_GAMMAREFRACTION = refractionTexture.gammaSpace;\r\n defines.SS_RGBDREFRACTION = refractionTexture.isRGBD;\r\n defines.SS_LINEARSPECULARREFRACTION = refractionTexture.linearSpecularLOD;\r\n defines.SS_REFRACTIONMAP_OPPOSITEZ = refractionTexture.invertZ;\r\n defines.SS_LODINREFRACTIONALPHA = refractionTexture.lodLevelInAlpha;\r\n defines.SS_LINKREFRACTIONTOTRANSPARENCY = this._linkRefractionWithTransparency;\r\n defines.SS_ALBEDOFORREFRACTIONTINT = this.useAlbedoToTintRefraction;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Binds the material data.\r\n * @param uniformBuffer defines the Uniform buffer to fill in.\r\n * @param scene defines the scene the material belongs to.\r\n * @param engine defines the engine the material belongs to.\r\n * @param isFrozen defines whether the material is frozen or not.\r\n * @param lodBasedMicrosurface defines whether the material relies on lod based microsurface or not.\r\n * @param realTimeFiltering defines whether the textures should be filtered on the fly.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.bindForSubMesh = function (uniformBuffer, scene, engine, isFrozen, lodBasedMicrosurface, realTimeFiltering) {\r\n var refractionTexture = this._getRefractionTexture(scene);\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if (this._thicknessTexture && MaterialFlags.ThicknessTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vThicknessInfos\", this._thicknessTexture.coordinatesIndex, this._thicknessTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._thicknessTexture, uniformBuffer, \"thickness\");\r\n }\r\n uniformBuffer.updateFloat2(\"vThicknessParam\", this.minimumThickness, this.maximumThickness - this.minimumThickness);\r\n if (refractionTexture && MaterialFlags.RefractionTextureEnabled) {\r\n uniformBuffer.updateMatrix(\"refractionMatrix\", refractionTexture.getReflectionTextureMatrix());\r\n var depth = 1.0;\r\n if (!refractionTexture.isCube) {\r\n if (refractionTexture.depth) {\r\n depth = refractionTexture.depth;\r\n }\r\n }\r\n var width = refractionTexture.getSize().width;\r\n var refractionIor = this.volumeIndexOfRefraction;\r\n uniformBuffer.updateFloat4(\"vRefractionInfos\", refractionTexture.level, 1 / refractionIor, depth, this._invertRefractionY ? -1 : 1);\r\n uniformBuffer.updateFloat3(\"vRefractionMicrosurfaceInfos\", width, refractionTexture.lodGenerationScale, refractionTexture.lodGenerationOffset);\r\n if (realTimeFiltering) {\r\n uniformBuffer.updateFloat2(\"vRefractionFilteringInfo\", width, Scalar.Log2(width));\r\n }\r\n }\r\n if (this.isScatteringEnabled) {\r\n uniformBuffer.updateFloat(\"scatteringDiffusionProfile\", this._scatteringDiffusionProfileIndex);\r\n }\r\n uniformBuffer.updateColor3(\"vDiffusionDistance\", this.diffusionDistance);\r\n uniformBuffer.updateFloat4(\"vTintColor\", this.tintColor.r, this.tintColor.g, this.tintColor.b, this.tintColorAtDistance);\r\n uniformBuffer.updateFloat3(\"vSubSurfaceIntensity\", this.refractionIntensity, this.translucencyIntensity, 0);\r\n }\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._thicknessTexture && MaterialFlags.ThicknessTextureEnabled) {\r\n uniformBuffer.setTexture(\"thicknessSampler\", this._thicknessTexture);\r\n }\r\n if (refractionTexture && MaterialFlags.RefractionTextureEnabled) {\r\n if (lodBasedMicrosurface) {\r\n uniformBuffer.setTexture(\"refractionSampler\", refractionTexture);\r\n }\r\n else {\r\n uniformBuffer.setTexture(\"refractionSampler\", refractionTexture._lodTextureMid || refractionTexture);\r\n uniformBuffer.setTexture(\"refractionSamplerLow\", refractionTexture._lodTextureLow || refractionTexture);\r\n uniformBuffer.setTexture(\"refractionSamplerHigh\", refractionTexture._lodTextureHigh || refractionTexture);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Unbinds the material from the mesh.\r\n * @param activeEffect defines the effect that should be unbound from.\r\n * @returns true if unbound, otherwise false\r\n */\r\n PBRSubSurfaceConfiguration.prototype.unbind = function (activeEffect) {\r\n if (this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n activeEffect.setTexture(\"refractionSampler\", null);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns the texture used for refraction or null if none is used.\r\n * @param scene defines the scene the material belongs to.\r\n * @returns - Refraction texture if present. If no refraction texture and refraction\r\n * is linked with transparency, returns environment texture. Otherwise, returns null.\r\n */\r\n PBRSubSurfaceConfiguration.prototype._getRefractionTexture = function (scene) {\r\n if (this._refractionTexture) {\r\n return this._refractionTexture;\r\n }\r\n if (this._isRefractionEnabled) {\r\n return scene.environmentTexture;\r\n }\r\n return null;\r\n };\r\n Object.defineProperty(PBRSubSurfaceConfiguration.prototype, \"disableAlphaBlending\", {\r\n /**\r\n * Returns true if alpha blending should be disabled.\r\n */\r\n get: function () {\r\n return this.isRefractionEnabled && this._linkRefractionWithTransparency;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Fills the list of render target textures.\r\n * @param renderTargets the list of render targets to update\r\n */\r\n PBRSubSurfaceConfiguration.prototype.fillRenderTargetTextures = function (renderTargets) {\r\n if (MaterialFlags.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n renderTargets.push(this._refractionTexture);\r\n }\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.hasTexture = function (texture) {\r\n if (this._thicknessTexture === texture) {\r\n return true;\r\n }\r\n if (this._refractionTexture === texture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n * @returns true if this uses a render target otherwise false.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.hasRenderTargetTextures = function () {\r\n if (MaterialFlags.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @param activeTextures Array of BaseTextures\r\n */\r\n PBRSubSurfaceConfiguration.prototype.getActiveTextures = function (activeTextures) {\r\n if (this._thicknessTexture) {\r\n activeTextures.push(this._thicknessTexture);\r\n }\r\n if (this._refractionTexture) {\r\n activeTextures.push(this._refractionTexture);\r\n }\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @param animatables Array of animatable textures.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.getAnimatables = function (animatables) {\r\n if (this._thicknessTexture && this._thicknessTexture.animations && this._thicknessTexture.animations.length > 0) {\r\n animatables.push(this._thicknessTexture);\r\n }\r\n if (this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0) {\r\n animatables.push(this._refractionTexture);\r\n }\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.dispose = function (forceDisposeTextures) {\r\n if (forceDisposeTextures) {\r\n if (this._thicknessTexture) {\r\n this._thicknessTexture.dispose();\r\n }\r\n if (this._refractionTexture) {\r\n this._refractionTexture.dispose();\r\n }\r\n }\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"PBRSubSurfaceConfiguration\"\r\n */\r\n PBRSubSurfaceConfiguration.prototype.getClassName = function () {\r\n return \"PBRSubSurfaceConfiguration\";\r\n };\r\n /**\r\n * Add fallbacks to the effect fallbacks list.\r\n * @param defines defines the Base texture to use.\r\n * @param fallbacks defines the current fallback list.\r\n * @param currentRank defines the current fallback rank.\r\n * @returns the new fallback rank.\r\n */\r\n PBRSubSurfaceConfiguration.AddFallbacks = function (defines, fallbacks, currentRank) {\r\n if (defines.SS_SCATTERING) {\r\n fallbacks.addFallback(currentRank++, \"SS_SCATTERING\");\r\n }\r\n if (defines.SS_TRANSLUCENCY) {\r\n fallbacks.addFallback(currentRank++, \"SS_TRANSLUCENCY\");\r\n }\r\n return currentRank;\r\n };\r\n /**\r\n * Add the required uniforms to the current list.\r\n * @param uniforms defines the current uniform list.\r\n */\r\n PBRSubSurfaceConfiguration.AddUniforms = function (uniforms) {\r\n uniforms.push(\"vDiffusionDistance\", \"vTintColor\", \"vSubSurfaceIntensity\", \"vRefractionMicrosurfaceInfos\", \"vRefractionFilteringInfo\", \"vRefractionInfos\", \"vThicknessInfos\", \"vThicknessParam\", \"refractionMatrix\", \"thicknessMatrix\", \"scatteringDiffusionProfile\");\r\n };\r\n /**\r\n * Add the required samplers to the current list.\r\n * @param samplers defines the current sampler list.\r\n */\r\n PBRSubSurfaceConfiguration.AddSamplers = function (samplers) {\r\n samplers.push(\"thicknessSampler\", \"refractionSampler\", \"refractionSamplerLow\", \"refractionSamplerHigh\");\r\n };\r\n /**\r\n * Add the required uniforms to the current buffer.\r\n * @param uniformBuffer defines the current uniform buffer.\r\n */\r\n PBRSubSurfaceConfiguration.PrepareUniformBuffer = function (uniformBuffer) {\r\n uniformBuffer.addUniform(\"vRefractionMicrosurfaceInfos\", 3);\r\n uniformBuffer.addUniform(\"vRefractionFilteringInfo\", 2);\r\n uniformBuffer.addUniform(\"vRefractionInfos\", 4);\r\n uniformBuffer.addUniform(\"refractionMatrix\", 16);\r\n uniformBuffer.addUniform(\"vThicknessInfos\", 2);\r\n uniformBuffer.addUniform(\"thicknessMatrix\", 16);\r\n uniformBuffer.addUniform(\"vThicknessParam\", 2);\r\n uniformBuffer.addUniform(\"vDiffusionDistance\", 3);\r\n uniformBuffer.addUniform(\"vTintColor\", 4);\r\n uniformBuffer.addUniform(\"vSubSurfaceIntensity\", 3);\r\n uniformBuffer.addUniform(\"scatteringDiffusionProfile\", 1);\r\n };\r\n /**\r\n * Makes a duplicate of the current configuration into another one.\r\n * @param configuration define the config where to copy the info\r\n */\r\n PBRSubSurfaceConfiguration.prototype.copyTo = function (configuration) {\r\n SerializationHelper.Clone(function () { return configuration; }, this);\r\n };\r\n /**\r\n * Serializes this Sub Surface configuration.\r\n * @returns - An object with the serialized config.\r\n */\r\n PBRSubSurfaceConfiguration.prototype.serialize = function () {\r\n return SerializationHelper.Serialize(this);\r\n };\r\n /**\r\n * Parses a anisotropy Configuration from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene Defines the scene we are parsing for\r\n * @param rootUrl Defines the rootUrl to load from\r\n */\r\n PBRSubSurfaceConfiguration.prototype.parse = function (source, scene, rootUrl) {\r\n var _this = this;\r\n SerializationHelper.Parse(function () { return _this; }, source, scene, rootUrl);\r\n };\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"isRefractionEnabled\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"isTranslucencyEnabled\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markScenePrePassDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"isScatteringEnabled\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"_scatteringDiffusionProfileIndex\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"refractionIntensity\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"translucencyIntensity\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"useAlbedoToTintRefraction\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"thicknessTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"refractionTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"indexOfRefraction\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"_volumeIndexOfRefraction\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"volumeIndexOfRefraction\", null);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"invertRefractionY\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"linkRefractionWithTransparency\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"minimumThickness\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"maximumThickness\", void 0);\r\n __decorate([\r\n serializeAsColor3()\r\n ], PBRSubSurfaceConfiguration.prototype, \"tintColor\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRSubSurfaceConfiguration.prototype, \"tintColorAtDistance\", void 0);\r\n __decorate([\r\n serializeAsColor3()\r\n ], PBRSubSurfaceConfiguration.prototype, \"diffusionDistance\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"useMaskFromThicknessTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRSubSurfaceConfiguration.prototype, \"useMaskFromThicknessTextureGltf\", void 0);\r\n return PBRSubSurfaceConfiguration;\r\n}());\r\nexport { PBRSubSurfaceConfiguration };\r\n//# sourceMappingURL=pbrSubSurfaceConfiguration.js.map","import { Vector3 } from \"../Maths/math.vector\";\r\n// https://dickyjim.wordpress.com/2013/09/04/spherical-harmonics-for-beginners/\r\n// http://silviojemma.com/public/papers/lighting/spherical-harmonic-lighting.pdf\r\n// https://www.ppsloan.org/publications/StupidSH36.pdf\r\n// http://cseweb.ucsd.edu/~ravir/papers/envmap/envmap.pdf\r\n// https://www.ppsloan.org/publications/SHJCGT.pdf\r\n// https://www.ppsloan.org/publications/shdering.pdf\r\n// https://google.github.io/filament/Filament.md.html#annex/sphericalharmonics\r\n// https://patapom.com/blog/SHPortal/\r\n// https://imdoingitwrong.wordpress.com/2011/04/14/spherical-harmonics-wtf/\r\n// Using real SH basis:\r\n// m>0 m m\r\n// y = sqrt(2) * K * P * cos(m*phi) * cos(theta)\r\n// l l l\r\n//\r\n// m<0 m |m|\r\n// y = sqrt(2) * K * P * sin(m*phi) * cos(theta)\r\n// l l l\r\n//\r\n// m=0 0 0\r\n// y = K * P * trigono terms\r\n// l l l\r\n//\r\n// m (2l + 1)(l - |m|)!\r\n// K = sqrt(------------------)\r\n// l 4pi(l + |m|)!\r\n//\r\n// and P by recursion:\r\n//\r\n// P00(x) = 1\r\n// P01(x) = x\r\n// Pll(x) = (-1^l)(2l - 1)!!(1-x*x)^(1/2)\r\n// ((2l - 1)x[Pl-1/m]-(l + m - 1)[Pl-2/m])\r\n// Plm(x) = ---------------------------------------\r\n// l - m\r\n// Leaving the trigonometric terms aside we can precompute the constants to :\r\nvar SH3ylmBasisConstants = [\r\n Math.sqrt(1 / (4 * Math.PI)),\r\n -Math.sqrt(3 / (4 * Math.PI)),\r\n Math.sqrt(3 / (4 * Math.PI)),\r\n -Math.sqrt(3 / (4 * Math.PI)),\r\n Math.sqrt(15 / (4 * Math.PI)),\r\n -Math.sqrt(15 / (4 * Math.PI)),\r\n Math.sqrt(5 / (16 * Math.PI)),\r\n -Math.sqrt(15 / (4 * Math.PI)),\r\n Math.sqrt(15 / (16 * Math.PI)),\r\n];\r\n// cm = cos(m * phi)\r\n// sm = sin(m * phi)\r\n// {x,y,z} = {cos(phi)sin(theta), sin(phi)sin(theta), cos(theta)}\r\n// By recursion on using trigo identities:\r\nvar SH3ylmBasisTrigonometricTerms = [\r\n function (direction) { return 1; },\r\n function (direction) { return direction.y; },\r\n function (direction) { return direction.z; },\r\n function (direction) { return direction.x; },\r\n function (direction) { return direction.x * direction.y; },\r\n function (direction) { return direction.y * direction.z; },\r\n function (direction) { return 3 * direction.z * direction.z - 1; },\r\n function (direction) { return direction.x * direction.z; },\r\n function (direction) { return direction.x * direction.x - direction.y * direction.y; },\r\n];\r\n// Wrap the full compute\r\nvar applySH3 = function (lm, direction) {\r\n return SH3ylmBasisConstants[lm] * SH3ylmBasisTrigonometricTerms[lm](direction);\r\n};\r\n// Derived from the integration of the a kernel convolution to SH.\r\n// Great explanation here: https://patapom.com/blog/SHPortal/#about-distant-radiance-and-irradiance-environments\r\nvar SHCosKernelConvolution = [\r\n Math.PI,\r\n 2 * Math.PI / 3,\r\n 2 * Math.PI / 3,\r\n 2 * Math.PI / 3,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n Math.PI / 4,\r\n];\r\n/**\r\n * Class representing spherical harmonics coefficients to the 3rd degree\r\n */\r\nvar SphericalHarmonics = /** @class */ (function () {\r\n function SphericalHarmonics() {\r\n /**\r\n * Defines whether or not the harmonics have been prescaled for rendering.\r\n */\r\n this.preScaled = false;\r\n /**\r\n * The l0,0 coefficients of the spherical harmonics\r\n */\r\n this.l00 = Vector3.Zero();\r\n /**\r\n * The l1,-1 coefficients of the spherical harmonics\r\n */\r\n this.l1_1 = Vector3.Zero();\r\n /**\r\n * The l1,0 coefficients of the spherical harmonics\r\n */\r\n this.l10 = Vector3.Zero();\r\n /**\r\n * The l1,1 coefficients of the spherical harmonics\r\n */\r\n this.l11 = Vector3.Zero();\r\n /**\r\n * The l2,-2 coefficients of the spherical harmonics\r\n */\r\n this.l2_2 = Vector3.Zero();\r\n /**\r\n * The l2,-1 coefficients of the spherical harmonics\r\n */\r\n this.l2_1 = Vector3.Zero();\r\n /**\r\n * The l2,0 coefficients of the spherical harmonics\r\n */\r\n this.l20 = Vector3.Zero();\r\n /**\r\n * The l2,1 coefficients of the spherical harmonics\r\n */\r\n this.l21 = Vector3.Zero();\r\n /**\r\n * The l2,2 coefficients of the spherical harmonics\r\n */\r\n this.l22 = Vector3.Zero();\r\n }\r\n /**\r\n * Adds a light to the spherical harmonics\r\n * @param direction the direction of the light\r\n * @param color the color of the light\r\n * @param deltaSolidAngle the delta solid angle of the light\r\n */\r\n SphericalHarmonics.prototype.addLight = function (direction, color, deltaSolidAngle) {\r\n var colorVector = new Vector3(color.r, color.g, color.b);\r\n var c = colorVector.scale(deltaSolidAngle);\r\n this.l00 = this.l00.add(c.scale(applySH3(0, direction)));\r\n this.l1_1 = this.l1_1.add(c.scale(applySH3(1, direction)));\r\n this.l10 = this.l10.add(c.scale(applySH3(2, direction)));\r\n this.l11 = this.l11.add(c.scale(applySH3(3, direction)));\r\n this.l2_2 = this.l2_2.add(c.scale(applySH3(4, direction)));\r\n this.l2_1 = this.l2_1.add(c.scale(applySH3(5, direction)));\r\n this.l20 = this.l20.add(c.scale(applySH3(6, direction)));\r\n this.l21 = this.l21.add(c.scale(applySH3(7, direction)));\r\n this.l22 = this.l22.add(c.scale(applySH3(8, direction)));\r\n };\r\n /**\r\n * Scales the spherical harmonics by the given amount\r\n * @param scale the amount to scale\r\n */\r\n SphericalHarmonics.prototype.scaleInPlace = function (scale) {\r\n this.l00.scaleInPlace(scale);\r\n this.l1_1.scaleInPlace(scale);\r\n this.l10.scaleInPlace(scale);\r\n this.l11.scaleInPlace(scale);\r\n this.l2_2.scaleInPlace(scale);\r\n this.l2_1.scaleInPlace(scale);\r\n this.l20.scaleInPlace(scale);\r\n this.l21.scaleInPlace(scale);\r\n this.l22.scaleInPlace(scale);\r\n };\r\n /**\r\n * Convert from incident radiance (Li) to irradiance (E) by applying convolution with the cosine-weighted hemisphere.\r\n *\r\n * ```\r\n * E_lm = A_l * L_lm\r\n * ```\r\n *\r\n * In spherical harmonics this convolution amounts to scaling factors for each frequency band.\r\n * This corresponds to equation 5 in \"An Efficient Representation for Irradiance Environment Maps\", where\r\n * the scaling factors are given in equation 9.\r\n */\r\n SphericalHarmonics.prototype.convertIncidentRadianceToIrradiance = function () {\r\n // Constant (Band 0)\r\n this.l00.scaleInPlace(SHCosKernelConvolution[0]);\r\n // Linear (Band 1)\r\n this.l1_1.scaleInPlace(SHCosKernelConvolution[1]);\r\n this.l10.scaleInPlace(SHCosKernelConvolution[2]);\r\n this.l11.scaleInPlace(SHCosKernelConvolution[3]);\r\n // Quadratic (Band 2)\r\n this.l2_2.scaleInPlace(SHCosKernelConvolution[4]);\r\n this.l2_1.scaleInPlace(SHCosKernelConvolution[5]);\r\n this.l20.scaleInPlace(SHCosKernelConvolution[6]);\r\n this.l21.scaleInPlace(SHCosKernelConvolution[7]);\r\n this.l22.scaleInPlace(SHCosKernelConvolution[8]);\r\n };\r\n /**\r\n * Convert from irradiance to outgoing radiance for Lambertian BDRF, suitable for efficient shader evaluation.\r\n *\r\n * ```\r\n * L = (1/pi) * E * rho\r\n * ```\r\n *\r\n * This is done by an additional scale by 1/pi, so is a fairly trivial operation but important conceptually.\r\n */\r\n SphericalHarmonics.prototype.convertIrradianceToLambertianRadiance = function () {\r\n this.scaleInPlace(1.0 / Math.PI);\r\n // The resultant SH now represents outgoing radiance, so includes the Lambert 1/pi normalisation factor but without albedo (rho) applied\r\n // (The pixel shader must apply albedo after texture fetches, etc).\r\n };\r\n /**\r\n * Integrates the reconstruction coefficients directly in to the SH preventing further\r\n * required operations at run time.\r\n *\r\n * This is simply done by scaling back the SH with Ylm constants parameter.\r\n * The trigonometric part being applied by the shader at run time.\r\n */\r\n SphericalHarmonics.prototype.preScaleForRendering = function () {\r\n this.preScaled = true;\r\n this.l00.scaleInPlace(SH3ylmBasisConstants[0]);\r\n this.l1_1.scaleInPlace(SH3ylmBasisConstants[1]);\r\n this.l10.scaleInPlace(SH3ylmBasisConstants[2]);\r\n this.l11.scaleInPlace(SH3ylmBasisConstants[3]);\r\n this.l2_2.scaleInPlace(SH3ylmBasisConstants[4]);\r\n this.l2_1.scaleInPlace(SH3ylmBasisConstants[5]);\r\n this.l20.scaleInPlace(SH3ylmBasisConstants[6]);\r\n this.l21.scaleInPlace(SH3ylmBasisConstants[7]);\r\n this.l22.scaleInPlace(SH3ylmBasisConstants[8]);\r\n };\r\n /**\r\n * Constructs a spherical harmonics from an array.\r\n * @param data defines the 9x3 coefficients (l00, l1-1, l10, l11, l2-2, l2-1, l20, l21, l22)\r\n * @returns the spherical harmonics\r\n */\r\n SphericalHarmonics.FromArray = function (data) {\r\n var sh = new SphericalHarmonics();\r\n Vector3.FromArrayToRef(data[0], 0, sh.l00);\r\n Vector3.FromArrayToRef(data[1], 0, sh.l1_1);\r\n Vector3.FromArrayToRef(data[2], 0, sh.l10);\r\n Vector3.FromArrayToRef(data[3], 0, sh.l11);\r\n Vector3.FromArrayToRef(data[4], 0, sh.l2_2);\r\n Vector3.FromArrayToRef(data[5], 0, sh.l2_1);\r\n Vector3.FromArrayToRef(data[6], 0, sh.l20);\r\n Vector3.FromArrayToRef(data[7], 0, sh.l21);\r\n Vector3.FromArrayToRef(data[8], 0, sh.l22);\r\n return sh;\r\n };\r\n // Keep for references.\r\n /**\r\n * Gets the spherical harmonics from polynomial\r\n * @param polynomial the spherical polynomial\r\n * @returns the spherical harmonics\r\n */\r\n SphericalHarmonics.FromPolynomial = function (polynomial) {\r\n var result = new SphericalHarmonics();\r\n result.l00 = polynomial.xx.scale(0.376127).add(polynomial.yy.scale(0.376127)).add(polynomial.zz.scale(0.376126));\r\n result.l1_1 = polynomial.y.scale(0.977204);\r\n result.l10 = polynomial.z.scale(0.977204);\r\n result.l11 = polynomial.x.scale(0.977204);\r\n result.l2_2 = polynomial.xy.scale(1.16538);\r\n result.l2_1 = polynomial.yz.scale(1.16538);\r\n result.l20 = polynomial.zz.scale(1.34567).subtract(polynomial.xx.scale(0.672834)).subtract(polynomial.yy.scale(0.672834));\r\n result.l21 = polynomial.zx.scale(1.16538);\r\n result.l22 = polynomial.xx.scale(1.16538).subtract(polynomial.yy.scale(1.16538));\r\n result.l1_1.scaleInPlace(-1);\r\n result.l11.scaleInPlace(-1);\r\n result.l2_1.scaleInPlace(-1);\r\n result.l21.scaleInPlace(-1);\r\n result.scaleInPlace(Math.PI);\r\n return result;\r\n };\r\n return SphericalHarmonics;\r\n}());\r\nexport { SphericalHarmonics };\r\n/**\r\n * Class representing spherical polynomial coefficients to the 3rd degree\r\n */\r\nvar SphericalPolynomial = /** @class */ (function () {\r\n function SphericalPolynomial() {\r\n /**\r\n * The x coefficients of the spherical polynomial\r\n */\r\n this.x = Vector3.Zero();\r\n /**\r\n * The y coefficients of the spherical polynomial\r\n */\r\n this.y = Vector3.Zero();\r\n /**\r\n * The z coefficients of the spherical polynomial\r\n */\r\n this.z = Vector3.Zero();\r\n /**\r\n * The xx coefficients of the spherical polynomial\r\n */\r\n this.xx = Vector3.Zero();\r\n /**\r\n * The yy coefficients of the spherical polynomial\r\n */\r\n this.yy = Vector3.Zero();\r\n /**\r\n * The zz coefficients of the spherical polynomial\r\n */\r\n this.zz = Vector3.Zero();\r\n /**\r\n * The xy coefficients of the spherical polynomial\r\n */\r\n this.xy = Vector3.Zero();\r\n /**\r\n * The yz coefficients of the spherical polynomial\r\n */\r\n this.yz = Vector3.Zero();\r\n /**\r\n * The zx coefficients of the spherical polynomial\r\n */\r\n this.zx = Vector3.Zero();\r\n }\r\n Object.defineProperty(SphericalPolynomial.prototype, \"preScaledHarmonics\", {\r\n /**\r\n * The spherical harmonics used to create the polynomials.\r\n */\r\n get: function () {\r\n if (!this._harmonics) {\r\n this._harmonics = SphericalHarmonics.FromPolynomial(this);\r\n }\r\n if (!this._harmonics.preScaled) {\r\n this._harmonics.preScaleForRendering();\r\n }\r\n return this._harmonics;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Adds an ambient color to the spherical polynomial\r\n * @param color the color to add\r\n */\r\n SphericalPolynomial.prototype.addAmbient = function (color) {\r\n var colorVector = new Vector3(color.r, color.g, color.b);\r\n this.xx = this.xx.add(colorVector);\r\n this.yy = this.yy.add(colorVector);\r\n this.zz = this.zz.add(colorVector);\r\n };\r\n /**\r\n * Scales the spherical polynomial by the given amount\r\n * @param scale the amount to scale\r\n */\r\n SphericalPolynomial.prototype.scaleInPlace = function (scale) {\r\n this.x.scaleInPlace(scale);\r\n this.y.scaleInPlace(scale);\r\n this.z.scaleInPlace(scale);\r\n this.xx.scaleInPlace(scale);\r\n this.yy.scaleInPlace(scale);\r\n this.zz.scaleInPlace(scale);\r\n this.yz.scaleInPlace(scale);\r\n this.zx.scaleInPlace(scale);\r\n this.xy.scaleInPlace(scale);\r\n };\r\n /**\r\n * Gets the spherical polynomial from harmonics\r\n * @param harmonics the spherical harmonics\r\n * @returns the spherical polynomial\r\n */\r\n SphericalPolynomial.FromHarmonics = function (harmonics) {\r\n var result = new SphericalPolynomial();\r\n result._harmonics = harmonics;\r\n result.x = harmonics.l11.scale(1.02333).scale(-1);\r\n result.y = harmonics.l1_1.scale(1.02333).scale(-1);\r\n result.z = harmonics.l10.scale(1.02333);\r\n result.xx = harmonics.l00.scale(0.886277).subtract(harmonics.l20.scale(0.247708)).add(harmonics.l22.scale(0.429043));\r\n result.yy = harmonics.l00.scale(0.886277).subtract(harmonics.l20.scale(0.247708)).subtract(harmonics.l22.scale(0.429043));\r\n result.zz = harmonics.l00.scale(0.886277).add(harmonics.l20.scale(0.495417));\r\n result.yz = harmonics.l2_1.scale(0.858086).scale(-1);\r\n result.zx = harmonics.l21.scale(0.858086).scale(-1);\r\n result.xy = harmonics.l2_2.scale(0.858086);\r\n result.scaleInPlace(1.0 / Math.PI);\r\n return result;\r\n };\r\n /**\r\n * Constructs a spherical polynomial from an array.\r\n * @param data defines the 9x3 coefficients (x, y, z, xx, yy, zz, yz, zx, xy)\r\n * @returns the spherical polynomial\r\n */\r\n SphericalPolynomial.FromArray = function (data) {\r\n var sp = new SphericalPolynomial();\r\n Vector3.FromArrayToRef(data[0], 0, sp.x);\r\n Vector3.FromArrayToRef(data[1], 0, sp.y);\r\n Vector3.FromArrayToRef(data[2], 0, sp.z);\r\n Vector3.FromArrayToRef(data[3], 0, sp.xx);\r\n Vector3.FromArrayToRef(data[4], 0, sp.yy);\r\n Vector3.FromArrayToRef(data[5], 0, sp.zz);\r\n Vector3.FromArrayToRef(data[6], 0, sp.yz);\r\n Vector3.FromArrayToRef(data[7], 0, sp.zx);\r\n Vector3.FromArrayToRef(data[8], 0, sp.xy);\r\n return sp;\r\n };\r\n return SphericalPolynomial;\r\n}());\r\nexport { SphericalPolynomial };\r\n//# sourceMappingURL=sphericalPolynomial.js.map","import { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Scalar } from \"../../Maths/math.scalar\";\r\nimport { SphericalPolynomial, SphericalHarmonics } from \"../../Maths/sphericalPolynomial\";\r\nimport { ToLinearSpace } from '../../Maths/math.constants';\r\nimport { Color3 } from '../../Maths/math.color';\r\nvar FileFaceOrientation = /** @class */ (function () {\r\n function FileFaceOrientation(name, worldAxisForNormal, worldAxisForFileX, worldAxisForFileY) {\r\n this.name = name;\r\n this.worldAxisForNormal = worldAxisForNormal;\r\n this.worldAxisForFileX = worldAxisForFileX;\r\n this.worldAxisForFileY = worldAxisForFileY;\r\n }\r\n return FileFaceOrientation;\r\n}());\r\n/**\r\n * Helper class dealing with the extraction of spherical polynomial dataArray\r\n * from a cube map.\r\n */\r\nvar CubeMapToSphericalPolynomialTools = /** @class */ (function () {\r\n function CubeMapToSphericalPolynomialTools() {\r\n }\r\n /**\r\n * Converts a texture to the according Spherical Polynomial data.\r\n * This extracts the first 3 orders only as they are the only one used in the lighting.\r\n *\r\n * @param texture The texture to extract the information from.\r\n * @return The Spherical Polynomial data.\r\n */\r\n CubeMapToSphericalPolynomialTools.ConvertCubeMapTextureToSphericalPolynomial = function (texture) {\r\n if (!texture.isCube) {\r\n // Only supports cube Textures currently.\r\n return null;\r\n }\r\n var size = texture.getSize().width;\r\n var right = texture.readPixels(0);\r\n var left = texture.readPixels(1);\r\n var up;\r\n var down;\r\n if (texture.isRenderTarget) {\r\n up = texture.readPixels(3);\r\n down = texture.readPixels(2);\r\n }\r\n else {\r\n up = texture.readPixels(2);\r\n down = texture.readPixels(3);\r\n }\r\n var front = texture.readPixels(4);\r\n var back = texture.readPixels(5);\r\n var gammaSpace = texture.gammaSpace;\r\n // Always read as RGBA.\r\n var format = 5;\r\n var type = 0;\r\n if (texture.textureType == 1 || texture.textureType == 2) {\r\n type = 1;\r\n }\r\n var cubeInfo = {\r\n size: size,\r\n right: right,\r\n left: left,\r\n up: up,\r\n down: down,\r\n front: front,\r\n back: back,\r\n format: format,\r\n type: type,\r\n gammaSpace: gammaSpace,\r\n };\r\n return this.ConvertCubeMapToSphericalPolynomial(cubeInfo);\r\n };\r\n /**\r\n * Converts a cubemap to the according Spherical Polynomial data.\r\n * This extracts the first 3 orders only as they are the only one used in the lighting.\r\n *\r\n * @param cubeInfo The Cube map to extract the information from.\r\n * @return The Spherical Polynomial data.\r\n */\r\n CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial = function (cubeInfo) {\r\n var sphericalHarmonics = new SphericalHarmonics();\r\n var totalSolidAngle = 0.0;\r\n // The (u,v) range is [-1,+1], so the distance between each texel is 2/Size.\r\n var du = 2.0 / cubeInfo.size;\r\n var dv = du;\r\n // The (u,v) of the first texel is half a texel from the corner (-1,-1).\r\n var minUV = du * 0.5 - 1.0;\r\n for (var faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n var fileFace = this.FileFaces[faceIndex];\r\n var dataArray = cubeInfo[fileFace.name];\r\n var v = minUV;\r\n // TODO: we could perform the summation directly into a SphericalPolynomial (SP), which is more efficient than SphericalHarmonic (SH).\r\n // This is possible because during the summation we do not need the SH-specific properties, e.g. orthogonality.\r\n // Because SP is still linear, so summation is fine in that basis.\r\n var stride = cubeInfo.format === 5 ? 4 : 3;\r\n for (var y = 0; y < cubeInfo.size; y++) {\r\n var u = minUV;\r\n for (var x = 0; x < cubeInfo.size; x++) {\r\n // World direction (not normalised)\r\n var worldDirection = fileFace.worldAxisForFileX.scale(u).add(fileFace.worldAxisForFileY.scale(v)).add(fileFace.worldAxisForNormal);\r\n worldDirection.normalize();\r\n var deltaSolidAngle = Math.pow(1.0 + u * u + v * v, -3.0 / 2.0);\r\n var r = dataArray[(y * cubeInfo.size * stride) + (x * stride) + 0];\r\n var g = dataArray[(y * cubeInfo.size * stride) + (x * stride) + 1];\r\n var b = dataArray[(y * cubeInfo.size * stride) + (x * stride) + 2];\r\n // Prevent NaN harmonics with extreme HDRI data.\r\n if (isNaN(r)) {\r\n r = 0;\r\n }\r\n if (isNaN(g)) {\r\n g = 0;\r\n }\r\n if (isNaN(b)) {\r\n b = 0;\r\n }\r\n // Handle Integer types.\r\n if (cubeInfo.type === 0) {\r\n r /= 255;\r\n g /= 255;\r\n b /= 255;\r\n }\r\n // Handle Gamma space textures.\r\n if (cubeInfo.gammaSpace) {\r\n r = Math.pow(Scalar.Clamp(r), ToLinearSpace);\r\n g = Math.pow(Scalar.Clamp(g), ToLinearSpace);\r\n b = Math.pow(Scalar.Clamp(b), ToLinearSpace);\r\n }\r\n // Prevent to explode in case of really high dynamic ranges.\r\n // sh 3 would not be enough to accurately represent it.\r\n var max = 4096;\r\n r = Scalar.Clamp(r, 0, max);\r\n g = Scalar.Clamp(g, 0, max);\r\n b = Scalar.Clamp(b, 0, max);\r\n var color = new Color3(r, g, b);\r\n sphericalHarmonics.addLight(worldDirection, color, deltaSolidAngle);\r\n totalSolidAngle += deltaSolidAngle;\r\n u += du;\r\n }\r\n v += dv;\r\n }\r\n }\r\n // Solid angle for entire sphere is 4*pi\r\n var sphereSolidAngle = 4.0 * Math.PI;\r\n // Adjust the solid angle to allow for how many faces we processed.\r\n var facesProcessed = 6.0;\r\n var expectedSolidAngle = sphereSolidAngle * facesProcessed / 6.0;\r\n // Adjust the harmonics so that the accumulated solid angle matches the expected solid angle.\r\n // This is needed because the numerical integration over the cube uses a\r\n // small angle approximation of solid angle for each texel (see deltaSolidAngle),\r\n // and also to compensate for accumulative error due to float precision in the summation.\r\n var correctionFactor = expectedSolidAngle / totalSolidAngle;\r\n sphericalHarmonics.scaleInPlace(correctionFactor);\r\n sphericalHarmonics.convertIncidentRadianceToIrradiance();\r\n sphericalHarmonics.convertIrradianceToLambertianRadiance();\r\n return SphericalPolynomial.FromHarmonics(sphericalHarmonics);\r\n };\r\n CubeMapToSphericalPolynomialTools.FileFaces = [\r\n new FileFaceOrientation(\"right\", new Vector3(1, 0, 0), new Vector3(0, 0, -1), new Vector3(0, -1, 0)),\r\n new FileFaceOrientation(\"left\", new Vector3(-1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, -1, 0)),\r\n new FileFaceOrientation(\"up\", new Vector3(0, 1, 0), new Vector3(1, 0, 0), new Vector3(0, 0, 1)),\r\n new FileFaceOrientation(\"down\", new Vector3(0, -1, 0), new Vector3(1, 0, 0), new Vector3(0, 0, -1)),\r\n new FileFaceOrientation(\"front\", new Vector3(0, 0, 1), new Vector3(1, 0, 0), new Vector3(0, -1, 0)),\r\n new FileFaceOrientation(\"back\", new Vector3(0, 0, -1), new Vector3(-1, 0, 0), new Vector3(0, -1, 0)) // -Z bottom\r\n ];\r\n return CubeMapToSphericalPolynomialTools;\r\n}());\r\nexport { CubeMapToSphericalPolynomialTools };\r\n//# sourceMappingURL=cubemapToSphericalPolynomial.js.map","import { CubeMapToSphericalPolynomialTools } from \"../../Misc/HighDynamicRange/cubemapToSphericalPolynomial\";\r\nimport { BaseTexture } from \"./baseTexture\";\r\nObject.defineProperty(BaseTexture.prototype, \"sphericalPolynomial\", {\r\n get: function () {\r\n if (this._texture) {\r\n if (this._texture._sphericalPolynomial) {\r\n return this._texture._sphericalPolynomial;\r\n }\r\n if (this._texture.isReady) {\r\n this._texture._sphericalPolynomial =\r\n CubeMapToSphericalPolynomialTools.ConvertCubeMapTextureToSphericalPolynomial(this);\r\n return this._texture._sphericalPolynomial;\r\n }\r\n }\r\n return null;\r\n },\r\n set: function (value) {\r\n if (this._texture) {\r\n this._texture._sphericalPolynomial = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n});\r\n//# sourceMappingURL=baseTexture.polynomial.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrFragmentDeclaration';\r\nvar shader = \"uniform vec3 vReflectionColor;\\nuniform vec4 vAlbedoColor;\\n\\nuniform vec4 vLightingIntensity;\\nuniform vec4 vReflectivityColor;\\nuniform vec4 vMetallicReflectanceFactors;\\nuniform vec3 vEmissiveColor;\\nuniform float visibility;\\n\\n#ifdef ALBEDO\\nuniform vec2 vAlbedoInfos;\\n#endif\\n#ifdef AMBIENT\\nuniform vec4 vAmbientInfos;\\n#endif\\n#ifdef BUMP\\nuniform vec3 vBumpInfos;\\nuniform vec2 vTangentSpaceParams;\\n#endif\\n#ifdef OPACITY\\nuniform vec2 vOpacityInfos;\\n#endif\\n#ifdef EMISSIVE\\nuniform vec2 vEmissiveInfos;\\n#endif\\n#ifdef LIGHTMAP\\nuniform vec2 vLightmapInfos;\\n#endif\\n#ifdef REFLECTIVITY\\nuniform vec3 vReflectivityInfos;\\n#endif\\n#ifdef MICROSURFACEMAP\\nuniform vec2 vMicroSurfaceSamplerInfos;\\n#endif\\n\\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(SS_REFRACTION)\\nuniform mat4 view;\\n#endif\\n\\n#ifdef REFLECTION\\nuniform vec2 vReflectionInfos;\\n#ifdef REALTIME_FILTERING\\nuniform vec2 vReflectionFilteringInfo;\\n#endif\\nuniform mat4 reflectionMatrix;\\nuniform vec3 vReflectionMicrosurfaceInfos;\\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\\nuniform vec3 vReflectionPosition;\\nuniform vec3 vReflectionSize;\\n#endif\\n#endif\\n\\n#ifdef CLEARCOAT\\nuniform vec2 vClearCoatParams;\\nuniform vec4 vClearCoatRefractionParams;\\n#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)\\nuniform vec4 vClearCoatInfos;\\n#endif\\n#ifdef CLEARCOAT_TEXTURE\\nuniform mat4 clearCoatMatrix;\\n#endif\\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS\\nuniform mat4 clearCoatRoughnessMatrix;\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nuniform vec2 vClearCoatBumpInfos;\\nuniform vec2 vClearCoatTangentSpaceParams;\\nuniform mat4 clearCoatBumpMatrix;\\n#endif\\n#ifdef CLEARCOAT_TINT\\nuniform vec4 vClearCoatTintParams;\\nuniform float clearCoatColorAtDistance;\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nuniform vec2 vClearCoatTintInfos;\\nuniform mat4 clearCoatTintMatrix;\\n#endif\\n#endif\\n#endif\\n\\n#ifdef ANISOTROPIC\\nuniform vec3 vAnisotropy;\\n#ifdef ANISOTROPIC_TEXTURE\\nuniform vec2 vAnisotropyInfos;\\nuniform mat4 anisotropyMatrix;\\n#endif\\n#endif\\n\\n#ifdef SHEEN\\nuniform vec4 vSheenColor;\\n#ifdef SHEEN_ROUGHNESS\\nuniform float vSheenRoughness;\\n#endif\\n#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)\\nuniform vec4 vSheenInfos;\\n#endif\\n#ifdef SHEEN_TEXTURE\\nuniform mat4 sheenMatrix;\\n#endif\\n#ifdef SHEEN_TEXTURE_ROUGHNESS\\nuniform mat4 sheenRoughnessMatrix;\\n#endif\\n#endif\\n\\n#ifdef SUBSURFACE\\n#ifdef SS_REFRACTION\\nuniform vec3 vRefractionMicrosurfaceInfos;\\nuniform vec4 vRefractionInfos;\\nuniform mat4 refractionMatrix;\\n#ifdef REALTIME_FILTERING\\nuniform vec2 vRefractionFilteringInfo;\\n#endif\\n#endif\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nuniform vec2 vThicknessInfos;\\nuniform mat4 thicknessMatrix;\\n#endif\\nuniform vec2 vThicknessParam;\\nuniform vec3 vDiffusionDistance;\\nuniform vec4 vTintColor;\\nuniform vec3 vSubSurfaceIntensity;\\n#endif\\n#ifdef PREPASS\\n#ifdef PREPASS_IRRADIANCE\\nuniform float scatteringDiffusionProfile;\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrFragmentDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrFragmentDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrUboDeclaration';\r\nvar shader = \"layout(std140,column_major) uniform;\\nuniform Material\\n{\\nuniform vec2 vAlbedoInfos;\\nuniform vec4 vAmbientInfos;\\nuniform vec2 vOpacityInfos;\\nuniform vec2 vEmissiveInfos;\\nuniform vec2 vLightmapInfos;\\nuniform vec3 vReflectivityInfos;\\nuniform vec2 vMicroSurfaceSamplerInfos;\\nuniform vec2 vReflectionInfos;\\nuniform vec2 vReflectionFilteringInfo;\\nuniform vec3 vReflectionPosition;\\nuniform vec3 vReflectionSize;\\nuniform vec3 vBumpInfos;\\nuniform mat4 albedoMatrix;\\nuniform mat4 ambientMatrix;\\nuniform mat4 opacityMatrix;\\nuniform mat4 emissiveMatrix;\\nuniform mat4 lightmapMatrix;\\nuniform mat4 reflectivityMatrix;\\nuniform mat4 microSurfaceSamplerMatrix;\\nuniform mat4 bumpMatrix;\\nuniform vec2 vTangentSpaceParams;\\nuniform mat4 reflectionMatrix;\\nuniform vec3 vReflectionColor;\\nuniform vec4 vAlbedoColor;\\nuniform vec4 vLightingIntensity;\\nuniform vec3 vReflectionMicrosurfaceInfos;\\nuniform float pointSize;\\nuniform vec4 vReflectivityColor;\\nuniform vec3 vEmissiveColor;\\nuniform float visibility;\\nuniform vec4 vMetallicReflectanceFactors;\\nuniform vec2 vMetallicReflectanceInfos;\\nuniform mat4 metallicReflectanceMatrix;\\nuniform vec2 vClearCoatParams;\\nuniform vec4 vClearCoatRefractionParams;\\nuniform vec4 vClearCoatInfos;\\nuniform mat4 clearCoatMatrix;\\nuniform mat4 clearCoatRoughnessMatrix;\\nuniform vec2 vClearCoatBumpInfos;\\nuniform vec2 vClearCoatTangentSpaceParams;\\nuniform mat4 clearCoatBumpMatrix;\\nuniform vec4 vClearCoatTintParams;\\nuniform float clearCoatColorAtDistance;\\nuniform vec2 vClearCoatTintInfos;\\nuniform mat4 clearCoatTintMatrix;\\nuniform vec3 vAnisotropy;\\nuniform vec2 vAnisotropyInfos;\\nuniform mat4 anisotropyMatrix;\\nuniform vec4 vSheenColor;\\nuniform float vSheenRoughness;\\nuniform vec4 vSheenInfos;\\nuniform mat4 sheenMatrix;\\nuniform mat4 sheenRoughnessMatrix;\\nuniform vec3 vRefractionMicrosurfaceInfos;\\nuniform vec2 vRefractionFilteringInfo;\\nuniform vec4 vRefractionInfos;\\nuniform mat4 refractionMatrix;\\nuniform vec2 vThicknessInfos;\\nuniform mat4 thicknessMatrix;\\nuniform vec2 vThicknessParam;\\nuniform vec3 vDiffusionDistance;\\nuniform vec4 vTintColor;\\nuniform vec3 vSubSurfaceIntensity;\\nuniform float scatteringDiffusionProfile;\\nuniform vec4 vDetailInfos;\\nuniform mat4 detailMatrix;\\n};\\nuniform Scene {\\nmat4 viewProjection;\\n#ifdef MULTIVIEW\\nmat4 viewProjectionR;\\n#endif\\nmat4 view;\\n};\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrUboDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrUboDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrFragmentExtraDeclaration';\r\nvar shader = \"uniform vec4 vEyePosition;\\nuniform vec3 vAmbientColor;\\nuniform vec4 vCameraInfos;\\n\\nvarying vec3 vPositionW;\\n#if DEBUGMODE>0\\nuniform vec2 vDebugMode;\\nvarying vec4 vClipSpacePosition;\\n#endif\\n#ifdef MAINUV1\\nvarying vec2 vMainUV1;\\n#endif\\n#ifdef MAINUV2\\nvarying vec2 vMainUV2;\\n#endif\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\\nvarying vec3 vEnvironmentIrradiance;\\n#endif\\n#endif\\n#ifdef VERTEXCOLOR\\nvarying vec4 vColor;\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrFragmentExtraDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrFragmentExtraDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrFragmentSamplersDeclaration';\r\nvar shader = \"#ifdef ALBEDO\\n#if ALBEDODIRECTUV == 1\\n#define vAlbedoUV vMainUV1\\n#elif ALBEDODIRECTUV == 2\\n#define vAlbedoUV vMainUV2\\n#else\\nvarying vec2 vAlbedoUV;\\n#endif\\nuniform sampler2D albedoSampler;\\n#endif\\n#ifdef AMBIENT\\n#if AMBIENTDIRECTUV == 1\\n#define vAmbientUV vMainUV1\\n#elif AMBIENTDIRECTUV == 2\\n#define vAmbientUV vMainUV2\\n#else\\nvarying vec2 vAmbientUV;\\n#endif\\nuniform sampler2D ambientSampler;\\n#endif\\n#ifdef OPACITY\\n#if OPACITYDIRECTUV == 1\\n#define vOpacityUV vMainUV1\\n#elif OPACITYDIRECTUV == 2\\n#define vOpacityUV vMainUV2\\n#else\\nvarying vec2 vOpacityUV;\\n#endif\\nuniform sampler2D opacitySampler;\\n#endif\\n#ifdef EMISSIVE\\n#if EMISSIVEDIRECTUV == 1\\n#define vEmissiveUV vMainUV1\\n#elif EMISSIVEDIRECTUV == 2\\n#define vEmissiveUV vMainUV2\\n#else\\nvarying vec2 vEmissiveUV;\\n#endif\\nuniform sampler2D emissiveSampler;\\n#endif\\n#ifdef LIGHTMAP\\n#if LIGHTMAPDIRECTUV == 1\\n#define vLightmapUV vMainUV1\\n#elif LIGHTMAPDIRECTUV == 2\\n#define vLightmapUV vMainUV2\\n#else\\nvarying vec2 vLightmapUV;\\n#endif\\nuniform sampler2D lightmapSampler;\\n#endif\\n#ifdef REFLECTIVITY\\n#if REFLECTIVITYDIRECTUV == 1\\n#define vReflectivityUV vMainUV1\\n#elif REFLECTIVITYDIRECTUV == 2\\n#define vReflectivityUV vMainUV2\\n#else\\nvarying vec2 vReflectivityUV;\\n#endif\\nuniform sampler2D reflectivitySampler;\\n#endif\\n#ifdef MICROSURFACEMAP\\n#if MICROSURFACEMAPDIRECTUV == 1\\n#define vMicroSurfaceSamplerUV vMainUV1\\n#elif MICROSURFACEMAPDIRECTUV == 2\\n#define vMicroSurfaceSamplerUV vMainUV2\\n#else\\nvarying vec2 vMicroSurfaceSamplerUV;\\n#endif\\nuniform sampler2D microSurfaceSampler;\\n#endif\\n#ifdef METALLIC_REFLECTANCE\\n#if METALLIC_REFLECTANCEDIRECTUV == 1\\n#define vMetallicReflectanceUV vMainUV1\\n#elif METALLIC_REFLECTANCEDIRECTUV == 2\\n#define vMetallicReflectanceUV vMainUV2\\n#else\\nvarying vec2 vMetallicReflectanceUV;\\n#endif\\nuniform sampler2D metallicReflectanceSampler;\\n#endif\\n#ifdef CLEARCOAT\\n#if defined(CLEARCOAT_TEXTURE)\\n#if CLEARCOAT_TEXTUREDIRECTUV == 1\\n#define vClearCoatUV vMainUV1\\n#elif CLEARCOAT_TEXTUREDIRECTUV == 2\\n#define vClearCoatUV vMainUV2\\n#else\\nvarying vec2 vClearCoatUV;\\n#endif\\n#endif\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS)\\n#if CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV == 1\\n#define vClearCoatRoughnessUV vMainUV1\\n#elif CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV == 2\\n#define vClearCoatRoughnessUV vMainUV2\\n#else\\nvarying vec2 vClearCoatRoughnessUV;\\n#endif\\n#endif\\n#ifdef CLEARCOAT_TEXTURE\\nuniform sampler2D clearCoatSampler;\\n#endif\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL)\\nuniform sampler2D clearCoatRoughnessSampler;\\n#endif\\n#ifdef CLEARCOAT_BUMP\\n#if CLEARCOAT_BUMPDIRECTUV == 1\\n#define vClearCoatBumpUV vMainUV1\\n#elif CLEARCOAT_BUMPDIRECTUV == 2\\n#define vClearCoatBumpUV vMainUV2\\n#else\\nvarying vec2 vClearCoatBumpUV;\\n#endif\\nuniform sampler2D clearCoatBumpSampler;\\n#endif\\n#ifdef CLEARCOAT_TINT_TEXTURE\\n#if CLEARCOAT_TINT_TEXTUREDIRECTUV == 1\\n#define vClearCoatTintUV vMainUV1\\n#elif CLEARCOAT_TINT_TEXTUREDIRECTUV == 2\\n#define vClearCoatTintUV vMainUV2\\n#else\\nvarying vec2 vClearCoatTintUV;\\n#endif\\nuniform sampler2D clearCoatTintSampler;\\n#endif\\n#endif\\n#ifdef SHEEN\\n#ifdef SHEEN_TEXTURE\\n#if SHEEN_TEXTUREDIRECTUV == 1\\n#define vSheenUV vMainUV1\\n#elif SHEEN_TEXTUREDIRECTUV == 2\\n#define vSheenUV vMainUV2\\n#else\\nvarying vec2 vSheenUV;\\n#endif\\n#endif\\n#ifdef SHEEN_TEXTURE_ROUGHNESS\\n#if SHEEN_TEXTURE_ROUGHNESSDIRECTUV == 1\\n#define vSheenRoughnessUV vMainUV1\\n#elif SHEEN_TEXTURE_ROUGHNESSDIRECTUV == 2\\n#define vSheenRoughnessUV vMainUV2\\n#else\\nvarying vec2 vSheenRoughnessUV;\\n#endif\\n#endif\\n#ifdef SHEEN_TEXTURE\\nuniform sampler2D sheenSampler;\\n#endif\\n#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL)\\nuniform sampler2D sheenRoughnessSampler;\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\n#ifdef ANISOTROPIC_TEXTURE\\n#if ANISOTROPIC_TEXTUREDIRECTUV == 1\\n#define vAnisotropyUV vMainUV1\\n#elif ANISOTROPIC_TEXTUREDIRECTUV == 2\\n#define vAnisotropyUV vMainUV2\\n#else\\nvarying vec2 vAnisotropyUV;\\n#endif\\nuniform sampler2D anisotropySampler;\\n#endif\\n#endif\\n\\n#ifdef REFLECTION\\n#ifdef REFLECTIONMAP_3D\\n#define sampleReflection(s,c) textureCube(s,c)\\nuniform samplerCube reflectionSampler;\\n#ifdef LODBASEDMICROSFURACE\\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\\n#else\\nuniform samplerCube reflectionSamplerLow;\\nuniform samplerCube reflectionSamplerHigh;\\n#endif\\n#ifdef USEIRRADIANCEMAP\\nuniform samplerCube irradianceSampler;\\n#endif\\n#else\\n#define sampleReflection(s,c) texture2D(s,c)\\nuniform sampler2D reflectionSampler;\\n#ifdef LODBASEDMICROSFURACE\\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\\n#else\\nuniform sampler2D reflectionSamplerLow;\\nuniform sampler2D reflectionSamplerHigh;\\n#endif\\n#ifdef USEIRRADIANCEMAP\\nuniform sampler2D irradianceSampler;\\n#endif\\n#endif\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#else\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\n#endif\\n#endif\\n#ifdef ENVIRONMENTBRDF\\nuniform sampler2D environmentBrdfSampler;\\n#endif\\n\\n#ifdef SUBSURFACE\\n#ifdef SS_REFRACTION\\n#ifdef SS_REFRACTIONMAP_3D\\n#define sampleRefraction(s,c) textureCube(s,c)\\nuniform samplerCube refractionSampler;\\n#ifdef LODBASEDMICROSFURACE\\n#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)\\n#else\\nuniform samplerCube refractionSamplerLow;\\nuniform samplerCube refractionSamplerHigh;\\n#endif\\n#else\\n#define sampleRefraction(s,c) texture2D(s,c)\\nuniform sampler2D refractionSampler;\\n#ifdef LODBASEDMICROSFURACE\\n#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)\\n#else\\nuniform sampler2D refractionSamplerLow;\\nuniform sampler2D refractionSamplerHigh;\\n#endif\\n#endif\\n#endif\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\n#if SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 1\\n#define vThicknessUV vMainUV1\\n#elif SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 2\\n#define vThicknessUV vMainUV2\\n#else\\nvarying vec2 vThicknessUV;\\n#endif\\nuniform sampler2D thicknessSampler;\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrFragmentSamplersDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrFragmentSamplersDeclaration.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'subSurfaceScatteringFunctions';\r\nvar shader = \"bool testLightingForSSS(float diffusionProfile)\\n{\\nreturn diffusionProfile<1.;\\n}\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var subSurfaceScatteringFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=subSurfaceScatteringFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'importanceSampling';\r\nvar shader = \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec3 hemisphereCosSample(vec2 u) {\\n\\nfloat phi=2.*PI*u.x;\\nfloat cosTheta2=1.-u.y;\\nfloat cosTheta=sqrt(cosTheta2);\\nfloat sinTheta=sqrt(1.-cosTheta2);\\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\\n}\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec3 hemisphereImportanceSampleDggx(vec2 u,float a) {\\n\\nfloat phi=2.*PI*u.x;\\n\\nfloat cosTheta2=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));\\nfloat cosTheta=sqrt(cosTheta2);\\nfloat sinTheta=sqrt(1.-cosTheta2);\\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\\n}\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec3 hemisphereImportanceSampleDCharlie(vec2 u,float a) {\\n\\nfloat phi=2.*PI*u.x;\\nfloat sinTheta=pow(u.y,a/(2.*a+1.));\\nfloat cosTheta=sqrt(1.-sinTheta*sinTheta);\\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\\n}\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var importanceSampling = { name: name, shader: shader };\r\n//# sourceMappingURL=importanceSampling.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrHelperFunctions';\r\nvar shader = \"\\n#define RECIPROCAL_PI2 0.15915494\\n#define RECIPROCAL_PI 0.31830988618\\n\\n#define MINIMUMVARIANCE 0.0005\\nfloat convertRoughnessToAverageSlope(float roughness)\\n{\\n\\nreturn square(roughness)+MINIMUMVARIANCE;\\n}\\nfloat fresnelGrazingReflectance(float reflectance0) {\\n\\n\\nfloat reflectance90=saturate(reflectance0*25.0);\\nreturn reflectance90;\\n}\\nvec2 getAARoughnessFactors(vec3 normalVector) {\\n#ifdef SPECULARAA\\nvec3 nDfdx=dFdx(normalVector.xyz);\\nvec3 nDfdy=dFdy(normalVector.xyz);\\nfloat slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));\\n\\nfloat geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);\\n\\nfloat geometricAlphaGFactor=sqrt(slopeSquare);\\n\\ngeometricAlphaGFactor*=0.75;\\nreturn vec2(geometricRoughnessFactor,geometricAlphaGFactor);\\n#else\\nreturn vec2(0.);\\n#endif\\n}\\n#ifdef ANISOTROPIC\\n\\n\\nvec2 getAnisotropicRoughness(float alphaG,float anisotropy) {\\nfloat alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);\\nfloat alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);\\nreturn vec2(alphaT,alphaB);\\n}\\n\\n\\nvec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy) {\\nvec3 anisotropicFrameDirection=anisotropy>=0.0 ? B : T;\\nvec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);\\nvec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);\\nvec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));\\nreturn anisotropicNormal;\\n\\n}\\n#endif\\n#if defined(CLEARCOAT) || defined(SS_REFRACTION)\\n\\n\\n\\nvec3 cocaLambert(vec3 alpha,float distance) {\\nreturn exp(-alpha*distance);\\n}\\n\\nvec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {\\nreturn cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));\\n}\\n\\nvec3 computeColorAtDistanceInMedia(vec3 color,float distance) {\\nreturn -log(color)/distance;\\n}\\nvec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\\nvec3 clearCoatAbsorption=mix(vec3(1.0),\\ncocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),\\nclearCoatIntensity);\\nreturn clearCoatAbsorption;\\n}\\n#endif\\n\\n\\n\\n\\n#ifdef MICROSURFACEAUTOMATIC\\nfloat computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)\\n{\\nconst float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;\\nfloat reflectivityLuminance=getLuminance(reflectivityColor);\\nfloat reflectivityLuma=sqrt(reflectivityLuminance);\\nmicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;\\nreturn microSurface;\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrHelperFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrHelperFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'harmonicsFunctions';\r\nvar shader = \"#ifdef USESPHERICALFROMREFLECTIONMAP\\n#ifdef SPHERICAL_HARMONICS\\nuniform vec3 vSphericalL00;\\nuniform vec3 vSphericalL1_1;\\nuniform vec3 vSphericalL10;\\nuniform vec3 vSphericalL11;\\nuniform vec3 vSphericalL2_2;\\nuniform vec3 vSphericalL2_1;\\nuniform vec3 vSphericalL20;\\nuniform vec3 vSphericalL21;\\nuniform vec3 vSphericalL22;\\n\\n\\n\\n\\n\\n\\n\\nvec3 computeEnvironmentIrradiance(vec3 normal) {\\nreturn vSphericalL00\\n+vSphericalL1_1*(normal.y)\\n+vSphericalL10*(normal.z)\\n+vSphericalL11*(normal.x)\\n+vSphericalL2_2*(normal.y*normal.x)\\n+vSphericalL2_1*(normal.y*normal.z)\\n+vSphericalL20*((3.0*normal.z*normal.z)-1.0)\\n+vSphericalL21*(normal.z*normal.x)\\n+vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));\\n}\\n#else\\nuniform vec3 vSphericalX;\\nuniform vec3 vSphericalY;\\nuniform vec3 vSphericalZ;\\nuniform vec3 vSphericalXX_ZZ;\\nuniform vec3 vSphericalYY_ZZ;\\nuniform vec3 vSphericalZZ;\\nuniform vec3 vSphericalXY;\\nuniform vec3 vSphericalYZ;\\nuniform vec3 vSphericalZX;\\n\\nvec3 computeEnvironmentIrradiance(vec3 normal) {\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfloat Nx=normal.x;\\nfloat Ny=normal.y;\\nfloat Nz=normal.z;\\nvec3 C1=vSphericalZZ.rgb;\\nvec3 Cx=vSphericalX.rgb;\\nvec3 Cy=vSphericalY.rgb;\\nvec3 Cz=vSphericalZ.rgb;\\nvec3 Cxx_zz=vSphericalXX_ZZ.rgb;\\nvec3 Cyy_zz=vSphericalYY_ZZ.rgb;\\nvec3 Cxy=vSphericalXY.rgb;\\nvec3 Cyz=vSphericalYZ.rgb;\\nvec3 Czx=vSphericalZX.rgb;\\nvec3 a1=Cyy_zz*Ny+Cy;\\nvec3 a2=Cyz*Nz+a1;\\nvec3 b1=Czx*Nz+Cx;\\nvec3 b2=Cxy*Ny+b1;\\nvec3 b3=Cxx_zz*Nx+b2;\\nvec3 t1=Cz*Nz+C1;\\nvec3 t2=a2*Ny+t1;\\nvec3 t3=b3*Nx+t2;\\nreturn t3;\\n}\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var harmonicsFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=harmonicsFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrDirectLightingSetupFunctions';\r\nvar shader = \"\\nstruct preLightingInfo\\n{\\n\\nvec3 lightOffset;\\nfloat lightDistanceSquared;\\nfloat lightDistance;\\n\\nfloat attenuation;\\n\\nvec3 L;\\nvec3 H;\\nfloat NdotV;\\nfloat NdotLUnclamped;\\nfloat NdotL;\\nfloat VdotH;\\nfloat roughness;\\n};\\npreLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\\npreLightingInfo result;\\n\\nresult.lightOffset=lightData.xyz-vPositionW;\\nresult.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);\\n\\nresult.lightDistance=sqrt(result.lightDistanceSquared);\\n\\nresult.L=normalize(result.lightOffset);\\nresult.H=normalize(V+result.L);\\nresult.VdotH=saturate(dot(V,result.H));\\nresult.NdotLUnclamped=dot(N,result.L);\\nresult.NdotL=saturateEps(result.NdotLUnclamped);\\nreturn result;\\n}\\npreLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\\npreLightingInfo result;\\n\\nresult.lightDistance=length(-lightData.xyz);\\n\\nresult.L=normalize(-lightData.xyz);\\nresult.H=normalize(V+result.L);\\nresult.VdotH=saturate(dot(V,result.H));\\nresult.NdotLUnclamped=dot(N,result.L);\\nresult.NdotL=saturateEps(result.NdotLUnclamped);\\nreturn result;\\n}\\npreLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\\npreLightingInfo result;\\n\\n\\nresult.NdotL=dot(N,lightData.xyz)*0.5+0.5;\\nresult.NdotL=saturateEps(result.NdotL);\\nresult.NdotLUnclamped=result.NdotL;\\n#ifdef SPECULARTERM\\nresult.L=normalize(lightData.xyz);\\nresult.H=normalize(V+result.L);\\nresult.VdotH=saturate(dot(V,result.H));\\n#endif\\nreturn result;\\n}\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrDirectLightingSetupFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrDirectLightingSetupFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrDirectLightingFalloffFunctions';\r\nvar shader = \"float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)\\n{\\nreturn max(0.,1.0-length(lightOffset)/range);\\n}\\nfloat computeDistanceLightFalloff_Physical(float lightDistanceSquared)\\n{\\nreturn 1.0/maxEps(lightDistanceSquared);\\n}\\nfloat computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)\\n{\\nfloat lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);\\nfloat factor=lightDistanceSquared*inverseSquaredRange;\\nfloat attenuation=saturate(1.0-factor*factor);\\nattenuation*=attenuation;\\n\\nlightDistanceFalloff*=attenuation;\\nreturn lightDistanceFalloff;\\n}\\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)\\n{\\n#ifdef USEPHYSICALLIGHTFALLOFF\\nreturn computeDistanceLightFalloff_Physical(lightDistanceSquared);\\n#elif defined(USEGLTFLIGHTFALLOFF)\\nreturn computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);\\n#else\\nreturn computeDistanceLightFalloff_Standard(lightOffset,range);\\n#endif\\n}\\nfloat computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)\\n{\\nfloat falloff=0.0;\\nfloat cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));\\nif (cosAngle>=cosHalfAngle)\\n{\\nfalloff=max(0.,pow(cosAngle,exponent));\\n}\\nreturn falloff;\\n}\\nfloat computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)\\n{\\nconst float kMinusLog2ConeAngleIntensityRatio=6.64385618977;\\n\\n\\n\\n\\n\\nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);\\n\\n\\nvec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);\\nfloat falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));\\nreturn falloff;\\n}\\nfloat computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)\\n{\\n\\n\\n\\nfloat cd=dot(-lightDirection,directionToLightCenterW);\\nfloat falloff=saturate(cd*lightAngleScale+lightAngleOffset);\\n\\nfalloff*=falloff;\\nreturn falloff;\\n}\\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)\\n{\\n#ifdef USEPHYSICALLIGHTFALLOFF\\nreturn computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);\\n#elif defined(USEGLTFLIGHTFALLOFF)\\nreturn computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);\\n#else\\nreturn computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);\\n#endif\\n}\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrDirectLightingFalloffFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrDirectLightingFalloffFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBRDFFunctions';\r\nvar shader = \"\\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\\n\\n\\n\\n\\n#ifdef MS_BRDF_ENERGY_CONSERVATION\\n\\n\\nvec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\\nreturn 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);\\n}\\n#endif\\n#ifdef ENVIRONMENTBRDF\\nvec3 getBRDFLookup(float NdotV,float perceptualRoughness) {\\n\\nvec2 UV=vec2(NdotV,perceptualRoughness);\\n\\nvec4 brdfLookup=texture2D(environmentBrdfSampler,UV);\\n#ifdef ENVIRONMENTBRDF_RGBD\\nbrdfLookup.rgb=fromRGBD(brdfLookup.rgba);\\n#endif\\nreturn brdfLookup.rgb;\\n}\\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 specularEnvironmentR90,const vec3 environmentBrdf) {\\n#ifdef BRDF_V_HEIGHT_CORRELATED\\nvec3 reflectance=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;\\n\\n#else\\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;\\n#endif\\nreturn reflectance;\\n}\\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\\n#ifdef BRDF_V_HEIGHT_CORRELATED\\nvec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);\\n#else\\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;\\n#endif\\nreturn reflectance;\\n}\\n#endif\\n\\n#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)\\nvec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\\n{\\n\\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\\n}\\n#endif\\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\\n\\nvec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {\\nvec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;\\nreturn sheenEnvironmentReflectance;\\n}\\n#endif\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)\\n{\\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\\n}\\nfloat fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)\\n{\\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\\n}\\n#ifdef CLEARCOAT\\n\\n\\n\\n\\n\\nvec3 getR0RemappedForClearCoat(vec3 f0) {\\n#ifdef CLEARCOAT_DEFAULTIOR\\n#ifdef MOBILE\\nreturn saturate(f0*(f0*0.526868+0.529324)-0.0482256);\\n#else\\nreturn saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);\\n#endif\\n#else\\nvec3 s=sqrt(f0);\\nvec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);\\nreturn t*t;\\n#endif\\n}\\n#endif\\n\\n\\n\\n\\n\\n\\nfloat normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)\\n{\\n\\n\\n\\nfloat a2=square(alphaG);\\nfloat d=NdotH*NdotH*(a2-1.0)+1.0;\\nreturn a2/(PI*d*d);\\n}\\n#ifdef SHEEN\\n\\n\\nfloat normalDistributionFunction_CharlieSheen(float NdotH,float alphaG)\\n{\\nfloat invR=1./alphaG;\\nfloat cos2h=NdotH*NdotH;\\nfloat sin2h=1.-cos2h;\\nreturn (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);\\n}\\n#endif\\n#ifdef ANISOTROPIC\\n\\n\\nfloat normalDistributionFunction_BurleyGGX_Anisotropic(float NdotH,float TdotH,float BdotH,const vec2 alphaTB) {\\nfloat a2=alphaTB.x*alphaTB.y;\\nvec3 v=vec3(alphaTB.y*TdotH,alphaTB.x*BdotH,a2*NdotH);\\nfloat v2=dot(v,v);\\nfloat w2=a2/v2;\\nreturn a2*w2*w2*RECIPROCAL_PI;\\n}\\n#endif\\n\\n\\n\\n\\n#ifdef BRDF_V_HEIGHT_CORRELATED\\n\\n\\n\\nfloat smithVisibility_GGXCorrelated(float NdotL,float NdotV,float alphaG) {\\n#ifdef MOBILE\\n\\nfloat GGXV=NdotL*(NdotV*(1.0-alphaG)+alphaG);\\nfloat GGXL=NdotV*(NdotL*(1.0-alphaG)+alphaG);\\nreturn 0.5/(GGXV+GGXL);\\n#else\\nfloat a2=alphaG*alphaG;\\nfloat GGXV=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);\\nfloat GGXL=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);\\nreturn 0.5/(GGXV+GGXL);\\n#endif\\n}\\n#else\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfloat smithVisibilityG1_TrowbridgeReitzGGXFast(float dot,float alphaG)\\n{\\n#ifdef MOBILE\\n\\nreturn 1.0/(dot+alphaG+(1.0-alphaG)*dot ));\\n#else\\nfloat alphaSquared=alphaG*alphaG;\\nreturn 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));\\n#endif\\n}\\nfloat smithVisibility_TrowbridgeReitzGGXFast(float NdotL,float NdotV,float alphaG)\\n{\\nfloat visibility=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);\\n\\nreturn visibility;\\n}\\n#endif\\n#ifdef ANISOTROPIC\\n\\n\\nfloat smithVisibility_GGXCorrelated_Anisotropic(float NdotL,float NdotV,float TdotV,float BdotV,float TdotL,float BdotL,const vec2 alphaTB) {\\nfloat lambdaV=NdotL*length(vec3(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));\\nfloat lambdaL=NdotV*length(vec3(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));\\nfloat v=0.5/(lambdaV+lambdaL);\\nreturn v;\\n}\\n#endif\\n#ifdef CLEARCOAT\\nfloat visibility_Kelemen(float VdotH) {\\n\\n\\n\\nreturn 0.25/(VdotH*VdotH);\\n}\\n#endif\\n#ifdef SHEEN\\n\\n\\n\\nfloat visibility_Ashikhmin(float NdotL,float NdotV)\\n{\\nreturn 1./(4.*(NdotL+NdotV-NdotL*NdotV));\\n}\\n\\n#endif\\n\\n\\n\\n\\n\\n\\n\\nfloat diffuseBRDF_Burley(float NdotL,float NdotV,float VdotH,float roughness) {\\n\\n\\nfloat diffuseFresnelNV=pow5(saturateEps(1.0-NdotL));\\nfloat diffuseFresnelNL=pow5(saturateEps(1.0-NdotV));\\nfloat diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;\\nfloat fresnel =\\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *\\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);\\nreturn fresnel/PI;\\n}\\n#ifdef SS_TRANSLUCENCY\\n\\n\\nvec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,float thickness) {\\nvec3 S=1./maxEps(diffusionDistance);\\nvec3 temp=exp((-0.333333333*thickness)*S);\\nreturn tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);\\n}\\n\\n\\nfloat computeWrappedDiffuseNdotL(float NdotL,float w) {\\nfloat t=1.0+w;\\nfloat invt2=1.0/square(t);\\nreturn saturate((NdotL+w)*invt2);\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBRDFFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBRDFFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'hdrFilteringFunctions';\r\nvar shader = \"#ifdef NUM_SAMPLES\\n#if NUM_SAMPLES>0\\n#ifdef WEBGL2\\n\\n\\nfloat radicalInverse_VdC(uint bits)\\n{\\nbits=(bits << 16u) | (bits >> 16u);\\nbits=((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\\nbits=((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\\nbits=((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\\nbits=((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\\nreturn float(bits)*2.3283064365386963e-10;\\n}\\nvec2 hammersley(uint i,uint N)\\n{\\nreturn vec2(float(i)/float(N),radicalInverse_VdC(i));\\n}\\n#else\\nfloat vanDerCorpus(int n,int base)\\n{\\nfloat invBase=1.0/float(base);\\nfloat denom=1.0;\\nfloat result=0.0;\\nfor(int i=0; i<32; ++i)\\n{\\nif(n>0)\\n{\\ndenom=mod(float(n),2.0);\\nresult+=denom*invBase;\\ninvBase=invBase/2.0;\\nn=int(float(n)/2.0);\\n}\\n}\\nreturn result;\\n}\\nvec2 hammersley(int i,int N)\\n{\\nreturn vec2(float(i)/float(N),vanDerCorpus(i,2));\\n}\\n#endif\\nfloat log4(float x) {\\nreturn log2(x)/2.;\\n}\\nconst float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);\\nconst float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;\\nconst float K=4.;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n#define inline\\nvec3 irradiance(samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\\n{\\nvec3 n=normalize(inputN);\\nvec3 result=vec3(0.0);\\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);\\ntangent=normalize(cross(tangent,n));\\nvec3 bitangent=cross(n,tangent);\\nmat3 tbn=mat3(tangent,bitangent,n);\\nfloat maxLevel=filteringInfo.y;\\nfloat dim0=filteringInfo.x;\\nfloat omegaP=(4.*PI)/(6.*dim0*dim0);\\n#ifdef WEBGL2\\nfor(uint i=0u; i0.) {\\nfloat pdf_inversed=PI/NoL;\\nfloat omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;\\nfloat l=log4(omegaS)-log4(omegaP)+log4(K);\\nfloat mipLevel=clamp(l,0.0,maxLevel);\\nvec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;\\n#ifdef GAMMA_INPUT\\nc=toLinearSpace(c);\\n#endif\\nresult+=c;\\n}\\n}\\nresult=result*NUM_SAMPLES_FLOAT_INVERSED;\\nreturn result;\\n}\\n#define inline\\nvec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\\n{\\nvec3 n=normalize(inputN);\\nif (alphaG == 0.) {\\nvec3 c=textureCube(inputTexture,n).rgb;\\n#ifdef GAMMA_INPUT\\nc=toLinearSpace(c);\\n#endif\\nreturn c;\\n}\\nvec3 result=vec3(0.);\\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);\\ntangent=normalize(cross(tangent,n));\\nvec3 bitangent=cross(n,tangent);\\nmat3 tbn=mat3(tangent,bitangent,n);\\nfloat maxLevel=filteringInfo.y;\\nfloat dim0=filteringInfo.x;\\nfloat omegaP=(4.*PI)/(6.*dim0*dim0);\\nfloat weight=0.;\\n#ifdef WEBGL2\\nfor(uint i=0u; i0.) {\\nfloat pdf_inversed=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);\\nfloat omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;\\nfloat l=log4(omegaS)-log4(omegaP)+log4(K);\\nfloat mipLevel=clamp(float(l),0.0,maxLevel);\\nweight+=NoL;\\nvec3 c=textureCubeLodEXT(inputTexture,tbn*L,mipLevel).rgb;\\n#ifdef GAMMA_INPUT\\nc=toLinearSpace(c);\\n#endif\\nresult+=c*NoL;\\n}\\n}\\nresult=result/weight;\\nreturn result;\\n}\\n#endif\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var hdrFilteringFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=hdrFilteringFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrDirectLightingFunctions';\r\nvar shader = \"#define CLEARCOATREFLECTANCE90 1.0\\n\\nstruct lightingInfo\\n{\\nvec3 diffuse;\\n#ifdef SPECULARTERM\\nvec3 specular;\\n#endif\\n#ifdef CLEARCOAT\\n\\n\\nvec4 clearCoat;\\n#endif\\n#ifdef SHEEN\\nvec3 sheen;\\n#endif\\n};\\n\\nfloat adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {\\n#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)\\n\\nfloat lightRoughness=lightRadius/lightDistance;\\n\\nfloat totalRoughness=saturate(lightRoughness+roughness);\\nreturn totalRoughness;\\n#else\\nreturn roughness;\\n#endif\\n}\\nvec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {\\nreturn mix(groundColor,lightColor,info.NdotL);\\n}\\nvec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {\\nfloat diffuseTerm=diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness);\\nreturn diffuseTerm*info.attenuation*info.NdotL*lightColor;\\n}\\n#define inline\\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\\nstrq/=strq.w;\\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\\nreturn toLinearSpace(textureColor);\\n}\\n#ifdef SS_TRANSLUCENCY\\nvec3 computeDiffuseAndTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {\\nfloat NdotL=absEps(info.NdotLUnclamped);\\n\\nfloat wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);\\n\\nfloat trAdapt=step(0.,info.NdotLUnclamped);\\nvec3 transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);\\nfloat diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);\\nreturn diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;\\n}\\n#endif\\n#ifdef SPECULARTERM\\nvec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\\nfloat NdotH=saturateEps(dot(N,info.H));\\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\\n#ifdef BRDF_V_HEIGHT_CORRELATED\\nfloat smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);\\n#else\\nfloat smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);\\n#endif\\nvec3 specTerm=fresnel*distribution*smithVisibility;\\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\\n}\\n#endif\\n#ifdef ANISOTROPIC\\nvec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\\nfloat NdotH=saturateEps(dot(N,info.H));\\nfloat TdotH=dot(T,info.H);\\nfloat BdotH=dot(B,info.H);\\nfloat TdotV=dot(T,V);\\nfloat BdotV=dot(B,V);\\nfloat TdotL=dot(T,info.L);\\nfloat BdotL=dot(B,info.L);\\nfloat alphaG=convertRoughnessToAverageSlope(info.roughness);\\nvec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);\\nalphaTB=max(alphaTB,square(geometricRoughnessFactor));\\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\\nfloat distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);\\nfloat smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);\\nvec3 specTerm=fresnel*distribution*smithVisibility;\\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\\n}\\n#endif\\n#ifdef CLEARCOAT\\nvec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {\\nfloat NccdotL=saturateEps(dot(Ncc,info.L));\\nfloat NccdotH=saturateEps(dot(Ncc,info.H));\\nfloat clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);\\nfloat alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\\nfloat fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\\nfresnel*=clearCoatIntensity;\\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);\\nfloat kelemenVisibility=visibility_Kelemen(info.VdotH);\\nfloat clearCoatTerm=fresnel*distribution*kelemenVisibility;\\nreturn vec4(\\nclearCoatTerm*info.attenuation*NccdotL*lightColor,\\n1.0-fresnel\\n);\\n}\\nvec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\\nvec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);\\nfloat NdotLRefract=saturateEps(dot(Ncc,LRefract));\\nvec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);\\nreturn absorption;\\n}\\n#endif\\n#ifdef SHEEN\\nvec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\\nfloat NdotH=saturateEps(dot(N,info.H));\\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\\n\\n\\nfloat fresnel=1.;\\nfloat distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);\\n\\nfloat visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);\\n\\nfloat sheenTerm=fresnel*distribution*visibility;\\nreturn sheenTerm*info.attenuation*info.NdotL*lightColor;\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrDirectLightingFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrDirectLightingFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrIBLFunctions';\r\nvar shader = \"#if defined(REFLECTION) || defined(SS_REFRACTION)\\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {\\nfloat microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;\\nfloat lod=log2(microsurfaceAverageSlopeTexels);\\nreturn lod;\\n}\\nfloat getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {\\nfloat lod=log2(cubeMapDimensionPixels)*roughness;\\nreturn lod;\\n}\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)\\nfloat environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {\\n\\n\\nfloat temp=NdotVUnclamped+ambientOcclusion;\\nreturn saturate(square(temp)-1.0+ambientOcclusion);\\n}\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)\\nfloat environmentHorizonOcclusion(vec3 view,vec3 normal,vec3 geometricNormal) {\\n\\nvec3 reflection=reflect(view,normal);\\nfloat temp=saturate(1.0+1.1*dot(reflection,geometricNormal));\\nreturn square(temp);\\n}\\n#endif\\n\\n\\n\\n\\n#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)\\n\\n\\n#define UNPACK_LOD(x) (1.0-x)*255.0\\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {\\nfloat microsurfaceAverageSlope=alphaG;\\n\\n\\n\\n\\n\\n\\nmicrosurfaceAverageSlope*=sqrt(abs(NdotV));\\nreturn getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrIBLFunctions = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrIBLFunctions.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockAlbedoOpacity';\r\nvar shader = \"struct albedoOpacityOutParams\\n{\\nvec3 surfaceAlbedo;\\nfloat alpha;\\n};\\n#define pbr_inline\\nvoid albedoOpacityBlock(\\nconst in vec4 vAlbedoColor,\\n#ifdef ALBEDO\\nconst in vec4 albedoTexture,\\nconst in vec2 albedoInfos,\\n#endif\\n#ifdef OPACITY\\nconst in vec4 opacityMap,\\nconst in vec2 vOpacityInfos,\\n#endif\\n#ifdef DETAIL\\nconst in vec4 detailColor,\\nconst in vec4 vDetailInfos,\\n#endif\\nout albedoOpacityOutParams outParams\\n)\\n{\\n\\nvec3 surfaceAlbedo=vAlbedoColor.rgb;\\nfloat alpha=vAlbedoColor.a;\\n#ifdef ALBEDO\\n#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)\\nalpha*=albedoTexture.a;\\n#endif\\n#ifdef GAMMAALBEDO\\nsurfaceAlbedo*=toLinearSpace(albedoTexture.rgb);\\n#else\\nsurfaceAlbedo*=albedoTexture.rgb;\\n#endif\\nsurfaceAlbedo*=albedoInfos.y;\\n#endif\\n#ifdef VERTEXCOLOR\\nsurfaceAlbedo*=vColor.rgb;\\n#endif\\n#ifdef DETAIL\\nfloat detailAlbedo=2.0*mix(0.5,detailColor.r,vDetailInfos.y);\\nsurfaceAlbedo.rgb=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo;\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_ALBEDO\\n\\n#ifdef OPACITY\\n#ifdef OPACITYRGB\\nalpha=getLuminance(opacityMap.rgb);\\n#else\\nalpha*=opacityMap.a;\\n#endif\\nalpha*=vOpacityInfos.y;\\n#endif\\n#ifdef VERTEXALPHA\\nalpha*=vColor.a;\\n#endif\\n#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)\\n#ifdef ALPHATEST\\nif (alpha0\\nvec4 surfaceMetallicColorMap;\\nvec4 surfaceReflectivityColorMap;\\nvec2 metallicRoughness;\\nvec3 metallicF0;\\n#endif\\n};\\n#define pbr_inline\\nvoid reflectivityBlock(\\nconst in vec4 vReflectivityColor,\\n#ifdef METALLICWORKFLOW\\nconst in vec3 surfaceAlbedo,\\nconst in vec4 metallicReflectanceFactors,\\n#endif\\n#ifdef REFLECTIVITY\\nconst in vec3 reflectivityInfos,\\nconst in vec4 surfaceMetallicOrReflectivityColorMap,\\n#endif\\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\\nconst in vec3 ambientOcclusionColorIn,\\n#endif\\n#ifdef MICROSURFACEMAP\\nconst in vec4 microSurfaceTexel,\\n#endif\\n#ifdef DETAIL\\nconst in vec4 detailColor,\\nconst in vec4 vDetailInfos,\\n#endif\\nout reflectivityOutParams outParams\\n)\\n{\\nfloat microSurface=vReflectivityColor.a;\\nvec3 surfaceReflectivityColor=vReflectivityColor.rgb;\\n#ifdef METALLICWORKFLOW\\nvec2 metallicRoughness=surfaceReflectivityColor.rg;\\n#ifdef REFLECTIVITY\\n#if DEBUGMODE>0\\noutParams.surfaceMetallicColorMap=surfaceMetallicOrReflectivityColorMap;\\n#endif\\n#ifdef AOSTOREINMETALMAPRED\\nvec3 aoStoreInMetalMap=vec3(surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r);\\noutParams.ambientOcclusionColor=mix(ambientOcclusionColorIn,aoStoreInMetalMap,reflectivityInfos.z);\\n#endif\\n#ifdef METALLNESSSTOREINMETALMAPBLUE\\nmetallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.b;\\n#else\\nmetallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.r;\\n#endif\\n#ifdef ROUGHNESSSTOREINMETALMAPALPHA\\nmetallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.a;\\n#else\\n#ifdef ROUGHNESSSTOREINMETALMAPGREEN\\nmetallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.g;\\n#endif\\n#endif\\n#endif\\n#ifdef DETAIL\\nfloat detailRoughness=mix(0.5,detailColor.b,vDetailInfos.w);\\nfloat loLerp=mix(0.,metallicRoughness.g,detailRoughness*2.);\\nfloat hiLerp=mix(metallicRoughness.g,1.,(detailRoughness-0.5)*2.);\\nmetallicRoughness.g=mix(loLerp,hiLerp,step(detailRoughness,0.5));\\n#endif\\n#ifdef MICROSURFACEMAP\\nmetallicRoughness.g*=microSurfaceTexel.r;\\n#endif\\n#if DEBUGMODE>0\\noutParams.metallicRoughness=metallicRoughness;\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS\\n\\nmicroSurface=1.0-metallicRoughness.g;\\n\\nvec3 baseColor=surfaceAlbedo;\\n#ifdef FROSTBITE_REFLECTANCE\\n\\n\\n\\n\\n\\n\\noutParams.surfaceAlbedo=baseColor.rgb*(1.0-metallicRoughness.r);\\n\\nsurfaceReflectivityColor=mix(0.16*reflectance*reflectance,baseColor,metallicRoughness.r);\\n#else\\nvec3 metallicF0=metallicReflectanceFactors.rgb;\\n#if DEBUGMODE>0\\noutParams.metallicF0=metallicF0;\\n#endif\\n\\noutParams.surfaceAlbedo=mix(baseColor.rgb*(1.0-metallicF0),vec3(0.,0.,0.),metallicRoughness.r);\\n\\nsurfaceReflectivityColor=mix(metallicF0,baseColor,metallicRoughness.r);\\n#endif\\n#else\\n#ifdef REFLECTIVITY\\nsurfaceReflectivityColor*=surfaceMetallicOrReflectivityColorMap.rgb;\\n#if DEBUGMODE>0\\noutParams.surfaceReflectivityColorMap=surfaceMetallicOrReflectivityColorMap;\\n#endif\\n#ifdef MICROSURFACEFROMREFLECTIVITYMAP\\nmicroSurface*=surfaceMetallicOrReflectivityColorMap.a;\\nmicroSurface*=reflectivityInfos.z;\\n#else\\n#ifdef MICROSURFACEAUTOMATIC\\nmicroSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);\\n#endif\\n#ifdef MICROSURFACEMAP\\nmicroSurface*=microSurfaceTexel.r;\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE\\n#endif\\n#endif\\n#endif\\n\\nmicroSurface=saturate(microSurface);\\n\\nfloat roughness=1.-microSurface;\\noutParams.microSurface=microSurface;\\noutParams.roughness=roughness;\\noutParams.surfaceReflectivityColor=surfaceReflectivityColor;\\n}\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockReflectivity = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockReflectivity.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockAmbientOcclusion';\r\nvar shader = \"struct ambientOcclusionOutParams\\n{\\nvec3 ambientOcclusionColor;\\n#if DEBUGMODE>0\\nvec3 ambientOcclusionColorMap;\\n#endif\\n};\\n#define pbr_inline\\nvoid ambientOcclusionBlock(\\n#ifdef AMBIENT\\nconst in vec3 ambientOcclusionColorMap_,\\nconst in vec4 vAmbientInfos,\\n#endif\\nout ambientOcclusionOutParams outParams\\n)\\n{\\nvec3 ambientOcclusionColor=vec3(1.,1.,1.);\\n#ifdef AMBIENT\\nvec3 ambientOcclusionColorMap=ambientOcclusionColorMap_*vAmbientInfos.y;\\n#ifdef AMBIENTINGRAYSCALE\\nambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);\\n#endif\\nambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);\\n#if DEBUGMODE>0\\noutParams.ambientOcclusionColorMap=ambientOcclusionColorMap;\\n#endif\\n#endif\\noutParams.ambientOcclusionColor=ambientOcclusionColor;\\n}\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockAmbientOcclusion = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockAmbientOcclusion.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockAlphaFresnel';\r\nvar shader = \"#ifdef ALPHAFRESNEL\\n#if defined(ALPHATEST) || defined(ALPHABLEND)\\nstruct alphaFresnelOutParams\\n{\\nfloat alpha;\\n};\\n#define pbr_inline\\nvoid alphaFresnelBlock(\\nconst in vec3 normalW,\\nconst in vec3 viewDirectionW,\\nconst in float alpha,\\nconst in float microSurface,\\nout alphaFresnelOutParams outParams\\n)\\n{\\n\\n\\n\\nfloat opacityPerceptual=alpha;\\n#ifdef LINEARALPHAFRESNEL\\nfloat opacity0=opacityPerceptual;\\n#else\\nfloat opacity0=opacityPerceptual*opacityPerceptual;\\n#endif\\nfloat opacity90=fresnelGrazingReflectance(opacity0);\\nvec3 normalForward=faceforward(normalW,-viewDirectionW,normalW);\\n\\noutParams.alpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)),vec3(opacity0),vec3(opacity90),sqrt(microSurface)).x;\\n#ifdef ALPHATEST\\nif (outParams.alpha0\\nvec3 anisotropyMapData;\\n#endif\\n};\\n#define pbr_inline\\nvoid anisotropicBlock(\\nconst in vec3 vAnisotropy,\\n#ifdef ANISOTROPIC_TEXTURE\\nconst in vec3 anisotropyMapData,\\n#endif\\nconst in mat3 TBN,\\nconst in vec3 normalW,\\nconst in vec3 viewDirectionW,\\nout anisotropicOutParams outParams\\n)\\n{\\nfloat anisotropy=vAnisotropy.b;\\nvec3 anisotropyDirection=vec3(vAnisotropy.xy,0.);\\n#ifdef ANISOTROPIC_TEXTURE\\nanisotropy*=anisotropyMapData.b;\\nanisotropyDirection.rg*=anisotropyMapData.rg*2.0-1.0;\\n#if DEBUGMODE>0\\noutParams.anisotropyMapData=anisotropyMapData;\\n#endif\\n#endif\\nmat3 anisoTBN=mat3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));\\nvec3 anisotropicTangent=normalize(anisoTBN*anisotropyDirection);\\nvec3 anisotropicBitangent=normalize(cross(anisoTBN[2],anisotropicTangent));\\noutParams.anisotropy=anisotropy;\\noutParams.anisotropicTangent=anisotropicTangent;\\noutParams.anisotropicBitangent=anisotropicBitangent;\\noutParams.anisotropicNormal=getAnisotropicBentNormals(anisotropicTangent,anisotropicBitangent,normalW,viewDirectionW,anisotropy);\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockAnisotropic = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockAnisotropic.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockReflection';\r\nvar shader = \"#ifdef REFLECTION\\nstruct reflectionOutParams\\n{\\nvec4 environmentRadiance;\\nvec3 environmentIrradiance;\\n#ifdef REFLECTIONMAP_3D\\nvec3 reflectionCoords;\\n#else\\nvec2 reflectionCoords;\\n#endif\\n#ifdef SS_TRANSLUCENCY\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nvec3 irradianceVector;\\n#endif\\n#endif\\n#endif\\n};\\n#define pbr_inline\\nvoid createReflectionCoords(\\nconst in vec3 vPositionW,\\nconst in vec3 normalW,\\n#ifdef ANISOTROPIC\\nconst in anisotropicOutParams anisotropicOut,\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nout vec3 reflectionCoords\\n#else\\nout vec2 reflectionCoords\\n#endif\\n)\\n{\\n#ifdef ANISOTROPIC\\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),anisotropicOut.anisotropicNormal);\\n#else\\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\\n#endif\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nreflectionVector.z*=-1.0;\\n#endif\\n\\n#ifdef REFLECTIONMAP_3D\\nreflectionCoords=reflectionVector;\\n#else\\nreflectionCoords=reflectionVector.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\nreflectionCoords/=reflectionVector.z;\\n#endif\\nreflectionCoords.y=1.0-reflectionCoords.y;\\n#endif\\n}\\n#define pbr_inline\\n#define inline\\nvoid sampleReflectionTexture(\\nconst in float alphaG,\\nconst in vec3 vReflectionMicrosurfaceInfos,\\nconst in vec2 vReflectionInfos,\\nconst in vec3 vReflectionColor,\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nconst in float NdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nconst in float roughness,\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSampler,\\nconst vec3 reflectionCoords,\\n#else\\nconst in sampler2D reflectionSampler,\\nconst vec2 reflectionCoords,\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSamplerLow,\\nconst in samplerCube reflectionSamplerHigh,\\n#else\\nconst in sampler2D reflectionSamplerLow,\\nconst in sampler2D reflectionSamplerHigh,\\n#endif\\n#endif\\n#ifdef REALTIME_FILTERING\\nconst in vec2 vReflectionFilteringInfo,\\n#endif\\nout vec4 environmentRadiance\\n)\\n{\\n\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);\\n#elif defined(LINEARSPECULARREFLECTION)\\nfloat reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);\\n#else\\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);\\n#endif\\n#ifdef LODBASEDMICROSFURACE\\n\\nreflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\\n#ifdef LODINREFLECTIONALPHA\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfloat automaticReflectionLOD=UNPACK_LOD(sampleReflection(reflectionSampler,reflectionCoords).a);\\nfloat requestedReflectionLOD=max(automaticReflectionLOD,reflectionLOD);\\n#else\\nfloat requestedReflectionLOD=reflectionLOD;\\n#endif\\n#ifdef REALTIME_FILTERING\\nenvironmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0);\\n#else\\nenvironmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\\n#endif\\n#else\\nfloat lodReflectionNormalized=saturate(reflectionLOD/log2(vReflectionMicrosurfaceInfos.x));\\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\\nvec4 environmentMid=sampleReflection(reflectionSampler,reflectionCoords);\\nif (lodReflectionNormalizedDoubled<1.0){\\nenvironmentRadiance=mix(\\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\\nenvironmentMid,\\nlodReflectionNormalizedDoubled\\n);\\n} else {\\nenvironmentRadiance=mix(\\nenvironmentMid,\\nsampleReflection(reflectionSamplerLow,reflectionCoords),\\nlodReflectionNormalizedDoubled-1.0\\n);\\n}\\n#endif\\n#ifdef RGBDREFLECTION\\nenvironmentRadiance.rgb=fromRGBD(environmentRadiance);\\n#endif\\n#ifdef GAMMAREFLECTION\\nenvironmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);\\n#endif\\n\\nenvironmentRadiance.rgb*=vReflectionInfos.x;\\nenvironmentRadiance.rgb*=vReflectionColor.rgb;\\n}\\n#define pbr_inline\\n#define inline\\nvoid reflectionBlock(\\nconst in vec3 vPositionW,\\nconst in vec3 normalW,\\nconst in float alphaG,\\nconst in vec3 vReflectionMicrosurfaceInfos,\\nconst in vec2 vReflectionInfos,\\nconst in vec3 vReflectionColor,\\n#ifdef ANISOTROPIC\\nconst in anisotropicOutParams anisotropicOut,\\n#endif\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nconst in float NdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nconst in float roughness,\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSampler,\\n#else\\nconst in sampler2D reflectionSampler,\\n#endif\\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\\nconst in vec3 vEnvironmentIrradiance,\\n#endif\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nconst in mat4 reflectionMatrix,\\n#endif\\n#endif\\n#ifdef USEIRRADIANCEMAP\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube irradianceSampler,\\n#else\\nconst in sampler2D irradianceSampler,\\n#endif\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSamplerLow,\\nconst in samplerCube reflectionSamplerHigh,\\n#else\\nconst in sampler2D reflectionSamplerLow,\\nconst in sampler2D reflectionSamplerHigh,\\n#endif\\n#endif\\n#ifdef REALTIME_FILTERING\\nconst in vec2 vReflectionFilteringInfo,\\n#endif\\nout reflectionOutParams outParams\\n)\\n{\\n\\nvec4 environmentRadiance=vec4(0.,0.,0.,0.);\\n#ifdef REFLECTIONMAP_3D\\nvec3 reflectionCoords=vec3(0.);\\n#else\\nvec2 reflectionCoords=vec2(0.);\\n#endif\\ncreateReflectionCoords(\\nvPositionW,\\nnormalW,\\n#ifdef ANISOTROPIC\\nanisotropicOut,\\n#endif\\nreflectionCoords\\n);\\nsampleReflectionTexture(\\nalphaG,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nNdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nroughness,\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nreflectionSampler,\\nreflectionCoords,\\n#else\\nreflectionSampler,\\nreflectionCoords,\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\nenvironmentRadiance\\n);\\n\\nvec3 environmentIrradiance=vec3(0.,0.,0.);\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\\nenvironmentIrradiance=vEnvironmentIrradiance;\\n#else\\n#ifdef ANISOTROPIC\\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(anisotropicOut.anisotropicNormal,0)).xyz;\\n#else\\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\\n#endif\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nirradianceVector.z*=-1.0;\\n#endif\\n#ifdef INVERTCUBICMAP\\nirradianceVector.y*=-1.0;\\n#endif\\n#if defined(REALTIME_FILTERING)\\nenvironmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo);\\n#else\\nenvironmentIrradiance=computeEnvironmentIrradiance(irradianceVector);\\n#endif\\n#ifdef SS_TRANSLUCENCY\\noutParams.irradianceVector=irradianceVector;\\n#endif\\n#endif\\n#elif defined(USEIRRADIANCEMAP)\\nvec4 environmentIrradiance4=sampleReflection(irradianceSampler,reflectionCoords);\\nenvironmentIrradiance=environmentIrradiance4.rgb;\\n#ifdef RGBDREFLECTION\\nenvironmentIrradiance.rgb=fromRGBD(environmentIrradiance4);\\n#endif\\n#ifdef GAMMAREFLECTION\\nenvironmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb);\\n#endif\\n#endif\\nenvironmentIrradiance*=vReflectionColor.rgb;\\noutParams.environmentRadiance=environmentRadiance;\\noutParams.environmentIrradiance=environmentIrradiance;\\noutParams.reflectionCoords=reflectionCoords;\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockReflection = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockReflection.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockSheen';\r\nvar shader = \"#ifdef SHEEN\\nstruct sheenOutParams\\n{\\nfloat sheenIntensity;\\nvec3 sheenColor;\\nfloat sheenRoughness;\\n#ifdef SHEEN_LINKWITHALBEDO\\nvec3 surfaceAlbedo;\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\\nfloat sheenAlbedoScaling;\\n#endif\\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nvec3 finalSheenRadianceScaled;\\n#endif\\n#if DEBUGMODE>0\\nvec4 sheenMapData;\\nvec3 sheenEnvironmentReflectance;\\n#endif\\n};\\n#define pbr_inline\\n#define inline\\nvoid sheenBlock(\\nconst in vec4 vSheenColor,\\n#ifdef SHEEN_ROUGHNESS\\nconst in float vSheenRoughness,\\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nconst in vec4 sheenMapRoughnessData,\\n#endif\\n#endif\\nconst in float roughness,\\n#ifdef SHEEN_TEXTURE\\nconst in vec4 sheenMapData,\\n#endif\\nconst in float reflectance,\\n#ifdef SHEEN_LINKWITHALBEDO\\nconst in vec3 baseColor,\\nconst in vec3 surfaceAlbedo,\\n#endif\\n#ifdef ENVIRONMENTBRDF\\nconst in float NdotV,\\nconst in vec3 environmentBrdf,\\n#endif\\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nconst in vec2 AARoughnessFactors,\\nconst in vec3 vReflectionMicrosurfaceInfos,\\nconst in vec2 vReflectionInfos,\\nconst in vec3 vReflectionColor,\\nconst in vec4 vLightingIntensity,\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSampler,\\nconst in vec3 reflectionCoords,\\n#else\\nconst in sampler2D reflectionSampler,\\nconst in vec2 reflectionCoords,\\n#endif\\nconst in float NdotVUnclamped,\\n#ifndef LODBASEDMICROSFURACE\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSamplerLow,\\nconst in samplerCube reflectionSamplerHigh,\\n#else\\nconst in sampler2D reflectionSamplerLow,\\nconst in sampler2D reflectionSamplerHigh,\\n#endif\\n#endif\\n#ifdef REALTIME_FILTERING\\nconst in vec2 vReflectionFilteringInfo,\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\\nconst in float seo,\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\\nconst in float eho,\\n#endif\\n#endif\\nout sheenOutParams outParams\\n)\\n{\\nfloat sheenIntensity=vSheenColor.a;\\n#ifdef SHEEN_TEXTURE\\n#if DEBUGMODE>0\\noutParams.sheenMapData=sheenMapData;\\n#endif\\n#endif\\n#ifdef SHEEN_LINKWITHALBEDO\\nfloat sheenFactor=pow5(1.0-sheenIntensity);\\nvec3 sheenColor=baseColor.rgb*(1.0-sheenFactor);\\nfloat sheenRoughness=sheenIntensity;\\noutParams.surfaceAlbedo=surfaceAlbedo*sheenFactor;\\n#ifdef SHEEN_TEXTURE\\nsheenIntensity*=sheenMapData.a;\\n#endif\\n#else\\nvec3 sheenColor=vSheenColor.rgb;\\n#ifdef SHEEN_TEXTURE\\nsheenColor.rgb*=sheenMapData.rgb;\\n#endif\\n#ifdef SHEEN_ROUGHNESS\\nfloat sheenRoughness=vSheenRoughness;\\n#ifdef SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE\\n#if defined(SHEEN_TEXTURE)\\nsheenRoughness*=sheenMapData.a;\\n#endif\\n#elif defined(SHEEN_TEXTURE_ROUGHNESS)\\n#ifdef SHEEN_TEXTURE_ROUGHNESS_IDENTICAL\\nsheenRoughness*=sheenMapData.a;\\n#else\\nsheenRoughness*=sheenMapRoughnessData.a;\\n#endif\\n#endif\\n#else\\nfloat sheenRoughness=roughness;\\n#ifdef SHEEN_TEXTURE\\nsheenIntensity*=sheenMapData.a;\\n#endif\\n#endif\\n\\n#if !defined(SHEEN_ALBEDOSCALING)\\nsheenIntensity*=(1.-reflectance);\\n#endif\\n\\nsheenColor*=sheenIntensity;\\n#endif\\n\\n#ifdef ENVIRONMENTBRDF\\n\\n#ifdef SHEEN_ROUGHNESS\\nvec3 environmentSheenBrdf=getBRDFLookup(NdotV,sheenRoughness);\\n#else\\nvec3 environmentSheenBrdf=environmentBrdf;\\n#endif\\n\\n#endif\\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nfloat sheenAlphaG=convertRoughnessToAverageSlope(sheenRoughness);\\n#ifdef SPECULARAA\\n\\nsheenAlphaG+=AARoughnessFactors.y;\\n#endif\\nvec4 environmentSheenRadiance=vec4(0.,0.,0.,0.);\\nsampleReflectionTexture(\\nsheenAlphaG,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nNdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nsheenRoughness,\\n#endif\\nreflectionSampler,\\nreflectionCoords,\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\nenvironmentSheenRadiance\\n);\\nvec3 sheenEnvironmentReflectance=getSheenReflectanceFromBRDFLookup(sheenColor,environmentSheenBrdf);\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\\nsheenEnvironmentReflectance*=seo;\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\\nsheenEnvironmentReflectance*=eho;\\n#endif\\n#if DEBUGMODE>0\\noutParams.sheenEnvironmentReflectance=sheenEnvironmentReflectance;\\n#endif\\noutParams.finalSheenRadianceScaled=\\nenvironmentSheenRadiance.rgb *\\nsheenEnvironmentReflectance *\\nvLightingIntensity.z;\\n\\n\\n\\n\\n\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\\n\\n\\n\\noutParams.sheenAlbedoScaling=1.0-sheenIntensity*max(max(sheenColor.r,sheenColor.g),sheenColor.b)*environmentSheenBrdf.b;\\n#endif\\n\\noutParams.sheenIntensity=sheenIntensity;\\noutParams.sheenColor=sheenColor;\\noutParams.sheenRoughness=sheenRoughness;\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockSheen = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockSheen.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockClearcoat';\r\nvar shader = \"struct clearcoatOutParams\\n{\\nvec3 specularEnvironmentR0;\\nfloat conservationFactor;\\nvec3 clearCoatNormalW;\\nvec2 clearCoatAARoughnessFactors;\\nfloat clearCoatIntensity;\\nfloat clearCoatRoughness;\\n#ifdef REFLECTION\\nvec3 finalClearCoatRadianceScaled;\\n#endif\\n#ifdef CLEARCOAT_TINT\\nvec3 absorption;\\nfloat clearCoatNdotVRefract;\\nvec3 clearCoatColor;\\nfloat clearCoatThickness;\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nvec3 energyConservationFactorClearCoat;\\n#endif\\n#if DEBUGMODE>0\\nmat3 TBNClearCoat;\\nvec2 clearCoatMapData;\\nvec4 clearCoatTintMapData;\\nvec4 environmentClearCoatRadiance;\\nfloat clearCoatNdotV;\\nvec3 clearCoatEnvironmentReflectance;\\n#endif\\n};\\n#ifdef CLEARCOAT\\n#define pbr_inline\\n#define inline\\nvoid clearcoatBlock(\\nconst in vec3 vPositionW,\\nconst in vec3 geometricNormalW,\\nconst in vec3 viewDirectionW,\\nconst in vec2 vClearCoatParams,\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nconst in vec4 clearCoatMapRoughnessData,\\n#endif\\nconst in vec3 specularEnvironmentR0,\\n#ifdef CLEARCOAT_TEXTURE\\nconst in vec2 clearCoatMapData,\\n#endif\\n#ifdef CLEARCOAT_TINT\\nconst in vec4 vClearCoatTintParams,\\nconst in float clearCoatColorAtDistance,\\nconst in vec4 vClearCoatRefractionParams,\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nconst in vec4 clearCoatTintMapData,\\n#endif\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nconst in vec2 vClearCoatBumpInfos,\\nconst in vec4 clearCoatBumpMapData,\\nconst in vec2 vClearCoatBumpUV,\\n#if defined(TANGENT) && defined(NORMAL)\\nconst in mat3 vTBN,\\n#else\\nconst in vec2 vClearCoatTangentSpaceParams,\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\nconst in mat4 normalMatrix,\\n#endif\\n#endif\\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\\nconst in vec3 faceNormal,\\n#endif\\n#ifdef REFLECTION\\nconst in vec3 vReflectionMicrosurfaceInfos,\\nconst in vec2 vReflectionInfos,\\nconst in vec3 vReflectionColor,\\nconst in vec4 vLightingIntensity,\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSampler,\\n#else\\nconst in sampler2D reflectionSampler,\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube reflectionSamplerLow,\\nconst in samplerCube reflectionSamplerHigh,\\n#else\\nconst in sampler2D reflectionSamplerLow,\\nconst in sampler2D reflectionSamplerHigh,\\n#endif\\n#endif\\n#ifdef REALTIME_FILTERING\\nconst in vec2 vReflectionFilteringInfo,\\n#endif\\n#endif\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\n#ifdef RADIANCEOCCLUSION\\nconst in float ambientMonochrome,\\n#endif\\n#endif\\nout clearcoatOutParams outParams\\n)\\n{\\n\\nfloat clearCoatIntensity=vClearCoatParams.x;\\nfloat clearCoatRoughness=vClearCoatParams.y;\\n#ifdef CLEARCOAT_TEXTURE\\nclearCoatIntensity*=clearCoatMapData.x;\\n#ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE\\nclearCoatRoughness*=clearCoatMapData.y;\\n#endif\\n#if DEBUGMODE>0\\noutParams.clearCoatMapData=clearCoatMapData;\\n#endif\\n#endif\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL\\nclearCoatRoughness*=clearCoatMapData.y;\\n#else\\nclearCoatRoughness*=clearCoatMapRoughnessData.y;\\n#endif\\n#endif\\noutParams.clearCoatIntensity=clearCoatIntensity;\\noutParams.clearCoatRoughness=clearCoatRoughness;\\n#ifdef CLEARCOAT_TINT\\nvec3 clearCoatColor=vClearCoatTintParams.rgb;\\nfloat clearCoatThickness=vClearCoatTintParams.a;\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nclearCoatColor*=clearCoatTintMapData.rgb;\\nclearCoatThickness*=clearCoatTintMapData.a;\\n#if DEBUGMODE>0\\noutParams.clearCoatTintMapData=clearCoatTintMapData;\\n#endif\\n#endif\\noutParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);\\noutParams.clearCoatThickness=clearCoatThickness;\\n#endif\\n\\n\\n\\n\\n#ifdef CLEARCOAT_REMAP_F0\\nvec3 specularEnvironmentR0Updated=getR0RemappedForClearCoat(specularEnvironmentR0);\\n#else\\nvec3 specularEnvironmentR0Updated=specularEnvironmentR0;\\n#endif\\noutParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);\\n\\nvec3 clearCoatNormalW=geometricNormalW;\\n#ifdef CLEARCOAT_BUMP\\n#ifdef NORMALXYSCALE\\nfloat clearCoatNormalScale=1.0;\\n#else\\nfloat clearCoatNormalScale=vClearCoatBumpInfos.y;\\n#endif\\n#if defined(TANGENT) && defined(NORMAL)\\nmat3 TBNClearCoat=vTBN;\\n#else\\nmat3 TBNClearCoat=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,vClearCoatBumpUV,vClearCoatTangentSpaceParams);\\n#endif\\n#if DEBUGMODE>0\\noutParams.TBNClearCoat=TBNClearCoat;\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\nclearCoatNormalW=normalize(clearCoatBumpMapData.xyz*2.0-1.0);\\nclearCoatNormalW=normalize(mat3(normalMatrix)*clearCoatNormalW);\\n#else\\nclearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y);\\n#endif\\n#endif\\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\\nclearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal));\\n#endif\\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\\nclearCoatNormalW=gl_FrontFacing ? clearCoatNormalW : -clearCoatNormalW;\\n#endif\\noutParams.clearCoatNormalW=clearCoatNormalW;\\n\\noutParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);\\n\\nfloat clearCoatNdotVUnclamped=dot(clearCoatNormalW,viewDirectionW);\\n\\nfloat clearCoatNdotV=absEps(clearCoatNdotVUnclamped);\\n#if DEBUGMODE>0\\noutParams.clearCoatNdotV=clearCoatNdotV;\\n#endif\\n#ifdef CLEARCOAT_TINT\\n\\nvec3 clearCoatVRefract=-refract(vPositionW,clearCoatNormalW,vClearCoatRefractionParams.y);\\n\\noutParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract));\\n#endif\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\n\\nvec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);\\n#endif\\n\\n#if defined(REFLECTION)\\nfloat clearCoatAlphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\\n#ifdef SPECULARAA\\n\\nclearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y;\\n#endif\\nvec4 environmentClearCoatRadiance=vec4(0.,0.,0.,0.);\\nvec3 clearCoatReflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),clearCoatNormalW);\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nclearCoatReflectionVector.z*=-1.0;\\n#endif\\n\\n#ifdef REFLECTIONMAP_3D\\nvec3 clearCoatReflectionCoords=clearCoatReflectionVector;\\n#else\\nvec2 clearCoatReflectionCoords=clearCoatReflectionVector.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\nclearCoatReflectionCoords/=clearCoatReflectionVector.z;\\n#endif\\nclearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y;\\n#endif\\nsampleReflectionTexture(\\nclearCoatAlphaG,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nclearCoatNdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nclearCoatRoughness,\\n#endif\\nreflectionSampler,\\nclearCoatReflectionCoords,\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\nenvironmentClearCoatRadiance\\n);\\n#if DEBUGMODE>0\\noutParams.environmentClearCoatRadiance=environmentClearCoatRadiance;\\n#endif\\n\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf);\\n#ifdef RADIANCEOCCLUSION\\nfloat clearCoatSeo=environmentRadianceOcclusion(ambientMonochrome,clearCoatNdotVUnclamped);\\nclearCoatEnvironmentReflectance*=clearCoatSeo;\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nfloat clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);\\nclearCoatEnvironmentReflectance*=clearCoatEho;\\n#endif\\n#endif\\n#endif\\n#else\\n\\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness));\\n#endif\\nclearCoatEnvironmentReflectance*=clearCoatIntensity;\\n#if DEBUGMODE>0\\noutParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance;\\n#endif\\noutParams.finalClearCoatRadianceScaled=\\nenvironmentClearCoatRadiance.rgb *\\nclearCoatEnvironmentReflectance *\\nvLightingIntensity.z;\\n#endif\\n#if defined(CLEARCOAT_TINT)\\n\\noutParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity);\\n#endif\\n\\nfloat fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\\nfresnelIBLClearCoat*=clearCoatIntensity;\\noutParams.conservationFactor=(1.-fresnelIBLClearCoat);\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\noutParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf);\\n#endif\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockClearcoat = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockClearcoat.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockSubSurface';\r\nvar shader = \"struct subSurfaceOutParams\\n{\\nvec3 specularEnvironmentReflectance;\\n#ifdef SS_REFRACTION\\nvec3 finalRefraction;\\nvec3 surfaceAlbedo;\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nfloat alpha;\\n#endif\\n#ifdef REFLECTION\\nfloat refractionFactorForIrradiance;\\n#endif\\n#endif\\n#ifdef SS_TRANSLUCENCY\\nvec3 transmittance;\\nfloat translucencyIntensity;\\n#ifdef REFLECTION\\nvec3 refractionIrradiance;\\n#endif\\n#endif\\n#if DEBUGMODE>0\\nvec4 thicknessMap;\\nvec4 environmentRefraction;\\nvec3 refractionTransmittance;\\n#endif\\n};\\n#ifdef SUBSURFACE\\n#define pbr_inline\\n#define inline\\nvoid subSurfaceBlock(\\nconst in vec3 vSubSurfaceIntensity,\\nconst in vec2 vThicknessParam,\\nconst in vec4 vTintColor,\\nconst in vec3 normalW,\\nconst in vec3 specularEnvironmentReflectance,\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nconst in vec4 thicknessMap,\\n#endif\\n#ifdef REFLECTION\\n#ifdef SS_TRANSLUCENCY\\nconst in mat4 reflectionMatrix,\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nconst in vec3 irradianceVector_,\\n#endif\\n#if defined(REALTIME_FILTERING)\\nconst in samplerCube reflectionSampler,\\nconst in vec2 vReflectionFilteringInfo,\\n#endif\\n#endif\\n#ifdef USEIRRADIANCEMAP\\n#ifdef REFLECTIONMAP_3D\\nconst in samplerCube irradianceSampler,\\n#else\\nconst in sampler2D irradianceSampler,\\n#endif\\n#endif\\n#endif\\n#endif\\n#ifdef SS_REFRACTION\\nconst in vec3 vPositionW,\\nconst in vec3 viewDirectionW,\\nconst in mat4 view,\\nconst in vec3 surfaceAlbedo,\\nconst in vec4 vRefractionInfos,\\nconst in mat4 refractionMatrix,\\nconst in vec3 vRefractionMicrosurfaceInfos,\\nconst in vec4 vLightingIntensity,\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nconst in float alpha,\\n#endif\\n#ifdef SS_LODINREFRACTIONALPHA\\nconst in float NdotVUnclamped,\\n#endif\\n#ifdef SS_LINEARSPECULARREFRACTION\\nconst in float roughness,\\n#else\\nconst in float alphaG,\\n#endif\\n#ifdef SS_REFRACTIONMAP_3D\\nconst in samplerCube refractionSampler,\\n#ifndef LODBASEDMICROSFURACE\\nconst in samplerCube refractionSamplerLow,\\nconst in samplerCube refractionSamplerHigh,\\n#endif\\n#else\\nconst in sampler2D refractionSampler,\\n#ifndef LODBASEDMICROSFURACE\\nconst in sampler2D refractionSamplerLow,\\nconst in sampler2D refractionSamplerHigh,\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\nconst in anisotropicOutParams anisotropicOut,\\n#endif\\n#ifdef REALTIME_FILTERING\\nconst in vec2 vRefractionFilteringInfo,\\n#endif\\n#endif\\n#ifdef SS_TRANSLUCENCY\\nconst in vec3 vDiffusionDistance,\\n#endif\\nout subSurfaceOutParams outParams\\n)\\n{\\noutParams.specularEnvironmentReflectance=specularEnvironmentReflectance;\\n\\n\\n\\n#ifdef SS_REFRACTION\\nfloat refractionIntensity=vSubSurfaceIntensity.x;\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nrefractionIntensity*=(1.0-alpha);\\n\\noutParams.alpha=1.0;\\n#endif\\n#endif\\n#ifdef SS_TRANSLUCENCY\\nfloat translucencyIntensity=vSubSurfaceIntensity.y;\\n#endif\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nfloat thickness=thicknessMap.r*vThicknessParam.y+vThicknessParam.x;\\n#if DEBUGMODE>0\\noutParams.thicknessMap=thicknessMap;\\n#endif\\n#ifdef SS_MASK_FROM_THICKNESS_TEXTURE\\n#ifdef SS_REFRACTION\\nrefractionIntensity*=thicknessMap.g;\\n#endif\\n#ifdef SS_TRANSLUCENCY\\ntranslucencyIntensity*=thicknessMap.b;\\n#endif\\n#elif defined(SS_MASK_FROM_THICKNESS_TEXTURE_GLTF)\\n#ifdef SS_REFRACTION\\nrefractionIntensity*=thicknessMap.r;\\n#elif defined(SS_TRANSLUCENCY)\\ntranslucencyIntensity*=thicknessMap.r;\\n#endif\\nthickness=thicknessMap.g*vThicknessParam.y+vThicknessParam.x;\\n#endif\\n#else\\nfloat thickness=vThicknessParam.y;\\n#endif\\n\\n\\n\\n#ifdef SS_TRANSLUCENCY\\nthickness=maxEps(thickness);\\nvec3 transmittance=transmittanceBRDF_Burley(vTintColor.rgb,vDiffusionDistance,thickness);\\ntransmittance*=translucencyIntensity;\\noutParams.transmittance=transmittance;\\noutParams.translucencyIntensity=translucencyIntensity;\\n#endif\\n\\n\\n\\n#ifdef SS_REFRACTION\\nvec4 environmentRefraction=vec4(0.,0.,0.,0.);\\n#ifdef ANISOTROPIC\\nvec3 refractionVector=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,vRefractionInfos.y);\\n#else\\nvec3 refractionVector=refract(-viewDirectionW,normalW,vRefractionInfos.y);\\n#endif\\n#ifdef SS_REFRACTIONMAP_OPPOSITEZ\\nrefractionVector.z*=-1.0;\\n#endif\\n\\n#ifdef SS_REFRACTIONMAP_3D\\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\\nvec3 refractionCoords=refractionVector;\\nrefractionCoords=vec3(refractionMatrix*vec4(refractionCoords,0));\\n#else\\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\\nrefractionCoords.y=1.0-refractionCoords.y;\\n#endif\\n#ifdef SS_LODINREFRACTIONALPHA\\nfloat refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);\\n#elif defined(SS_LINEARSPECULARREFRACTION)\\nfloat refractionLOD=getLinearLodFromRoughness(vRefractionMicrosurfaceInfos.x,roughness);\\n#else\\nfloat refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,alphaG);\\n#endif\\n#ifdef LODBASEDMICROSFURACE\\n\\nrefractionLOD=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z;\\n#ifdef SS_LODINREFRACTIONALPHA\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfloat automaticRefractionLOD=UNPACK_LOD(sampleRefraction(refractionSampler,refractionCoords).a);\\nfloat requestedRefractionLOD=max(automaticRefractionLOD,refractionLOD);\\n#else\\nfloat requestedRefractionLOD=refractionLOD;\\n#endif\\n#ifdef REALTIME_FILTERING\\nenvironmentRefraction=vec4(radiance(alphaG,refractionSampler,refractionCoords,vRefractionFilteringInfo),1.0);\\n#else\\nenvironmentRefraction=sampleRefractionLod(refractionSampler,refractionCoords,requestedRefractionLOD);\\n#endif\\n#else\\nfloat lodRefractionNormalized=saturate(refractionLOD/log2(vRefractionMicrosurfaceInfos.x));\\nfloat lodRefractionNormalizedDoubled=lodRefractionNormalized*2.0;\\nvec4 environmentRefractionMid=sampleRefraction(refractionSampler,refractionCoords);\\nif (lodRefractionNormalizedDoubled<1.0){\\nenvironmentRefraction=mix(\\nsampleRefraction(refractionSamplerHigh,refractionCoords),\\nenvironmentRefractionMid,\\nlodRefractionNormalizedDoubled\\n);\\n} else {\\nenvironmentRefraction=mix(\\nenvironmentRefractionMid,\\nsampleRefraction(refractionSamplerLow,refractionCoords),\\nlodRefractionNormalizedDoubled-1.0\\n);\\n}\\n#endif\\n#ifdef SS_RGBDREFRACTION\\nenvironmentRefraction.rgb=fromRGBD(environmentRefraction);\\n#endif\\n#ifdef SS_GAMMAREFRACTION\\nenvironmentRefraction.rgb=toLinearSpace(environmentRefraction.rgb);\\n#endif\\n\\nenvironmentRefraction.rgb*=vRefractionInfos.x;\\n#endif\\n\\n\\n\\n#ifdef SS_REFRACTION\\nvec3 refractionTransmittance=vec3(refractionIntensity);\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\\n\\n\\n\\n\\n\\nrefractionTransmittance*=cocaLambert(volumeAlbedo,thickness);\\n#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)\\n\\nfloat maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);\\nvec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);\\n\\nenvironmentRefraction.rgb*=volumeAlbedo;\\n#else\\n\\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\\nrefractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y);\\n#endif\\n#ifdef SS_ALBEDOFORREFRACTIONTINT\\n\\nenvironmentRefraction.rgb*=surfaceAlbedo.rgb;\\n#endif\\n\\noutParams.surfaceAlbedo=surfaceAlbedo*(1.-refractionIntensity);\\n#ifdef REFLECTION\\n\\noutParams.refractionFactorForIrradiance=(1.-refractionIntensity);\\n\\n#endif\\n\\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);\\noutParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);\\n\\nrefractionTransmittance*=1.0-outParams.specularEnvironmentReflectance;\\n#if DEBUGMODE>0\\noutParams.refractionTransmittance=refractionTransmittance;\\n#endif\\noutParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;\\n#if DEBUGMODE>0\\noutParams.environmentRefraction=environmentRefraction;\\n#endif\\n#endif\\n\\n\\n\\n#if defined(REFLECTION) && defined(SS_TRANSLUCENCY)\\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP)\\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nirradianceVector.z*=-1.0;\\n#endif\\n#ifdef INVERTCUBICMAP\\nirradianceVector.y*=-1.0;\\n#endif\\n#else\\nvec3 irradianceVector=irradianceVector_;\\n#endif\\n#if defined(USESPHERICALFROMREFLECTIONMAP)\\n#if defined(REALTIME_FILTERING)\\nvec3 refractionIrradiance=irradiance(reflectionSampler,-irradianceVector,vReflectionFilteringInfo);\\n#else\\nvec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector);\\n#endif\\n#elif defined(USEIRRADIANCEMAP)\\n#ifdef REFLECTIONMAP_3D\\nvec3 irradianceCoords=irradianceVector;\\n#else\\nvec2 irradianceCoords=irradianceVector.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\nirradianceCoords/=irradianceVector.z;\\n#endif\\nirradianceCoords.y=1.0-irradianceCoords.y;\\n#endif\\nvec4 refractionIrradiance=sampleReflection(irradianceSampler,-irradianceCoords);\\n#ifdef RGBDREFLECTION\\nrefractionIrradiance.rgb=fromRGBD(refractionIrradiance);\\n#endif\\n#ifdef GAMMAREFLECTION\\nrefractionIrradiance.rgb=toLinearSpace(refractionIrradiance.rgb);\\n#endif\\n#else\\nvec4 refractionIrradiance=vec4(0.);\\n#endif\\nrefractionIrradiance.rgb*=transmittance;\\noutParams.refractionIrradiance=refractionIrradiance.rgb;\\n#endif\\n}\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockSubSurface = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockSubSurface.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockNormalGeometric';\r\nvar shader = \"vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\\n#ifdef NORMAL\\nvec3 normalW=normalize(vNormalW);\\n#else\\nvec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\\n#endif\\nvec3 geometricNormalW=normalW;\\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\\ngeometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW;\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockNormalGeometric = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockNormalGeometric.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockNormalFinal';\r\nvar shader = \"#if defined(FORCENORMALFORWARD) && defined(NORMAL)\\nvec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\\n#if defined(TWOSIDEDLIGHTING)\\nfaceNormal=gl_FrontFacing ? faceNormal : -faceNormal;\\n#endif\\nnormalW*=sign(dot(normalW,faceNormal));\\n#endif\\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\\nnormalW=gl_FrontFacing ? normalW : -normalW;\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockNormalFinal = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockNormalFinal.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockLightmapInit';\r\nvar shader = \"#ifdef LIGHTMAP\\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\\n#ifdef RGBDLIGHTMAP\\nlightmapColor.rgb=fromRGBD(lightmapColor);\\n#endif\\n#ifdef GAMMALIGHTMAP\\nlightmapColor.rgb=toLinearSpace(lightmapColor.rgb);\\n#endif\\nlightmapColor.rgb*=vLightmapInfos.y;\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockLightmapInit = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockLightmapInit.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockGeometryInfo';\r\nvar shader = \"float NdotVUnclamped=dot(normalW,viewDirectionW);\\n\\nfloat NdotV=absEps(NdotVUnclamped);\\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\\nvec2 AARoughnessFactors=getAARoughnessFactors(normalW.xyz);\\n#ifdef SPECULARAA\\n\\nalphaG+=AARoughnessFactors.y;\\n#endif\\n#if defined(ENVIRONMENTBRDF)\\n\\nvec3 environmentBrdf=getBRDFLookup(NdotV,roughness);\\n#endif\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\n#ifdef RADIANCEOCCLUSION\\n#ifdef AMBIENTINGRAYSCALE\\nfloat ambientMonochrome=aoOut.ambientOcclusionColor.r;\\n#else\\nfloat ambientMonochrome=getLuminance(aoOut.ambientOcclusionColor);\\n#endif\\nfloat seo=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nfloat eho=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);\\n#endif\\n#endif\\n#endif\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockGeometryInfo = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockGeometryInfo.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockReflectance0';\r\nvar shader = \"float reflectance=max(max(reflectivityOut.surfaceReflectivityColor.r,reflectivityOut.surfaceReflectivityColor.g),reflectivityOut.surfaceReflectivityColor.b);\\nvec3 specularEnvironmentR0=reflectivityOut.surfaceReflectivityColor.rgb;\\n#ifdef METALLICWORKFLOW\\nvec3 specularEnvironmentR90=vec3(metallicReflectanceFactors.a);\\n#else\\nvec3 specularEnvironmentR90=vec3(1.0,1.0,1.0);\\n#endif\\n\\n#ifdef ALPHAFRESNEL\\nfloat reflectance90=fresnelGrazingReflectance(reflectance);\\nspecularEnvironmentR90=specularEnvironmentR90*reflectance90;\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockReflectance0 = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockReflectance0.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockReflectance';\r\nvar shader = \"#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\nvec3 specularEnvironmentReflectance=getReflectanceFromBRDFLookup(clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,environmentBrdf);\\n#ifdef RADIANCEOCCLUSION\\nspecularEnvironmentReflectance*=seo;\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nspecularEnvironmentReflectance*=eho;\\n#endif\\n#endif\\n#endif\\n#else\\n\\nvec3 specularEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));\\n#endif\\n#ifdef CLEARCOAT\\nspecularEnvironmentReflectance*=clearcoatOut.conservationFactor;\\n#if defined(CLEARCOAT_TINT)\\nspecularEnvironmentReflectance*=clearcoatOut.absorption;\\n#endif\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockReflectance = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockReflectance.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockDirectLighting';\r\nvar shader = \"vec3 diffuseBase=vec3(0.,0.,0.);\\n#ifdef SPECULARTERM\\nvec3 specularBase=vec3(0.,0.,0.);\\n#endif\\n#ifdef CLEARCOAT\\nvec3 clearCoatBase=vec3(0.,0.,0.);\\n#endif\\n#ifdef SHEEN\\nvec3 sheenBase=vec3(0.,0.,0.);\\n#endif\\n\\npreLightingInfo preInfo;\\nlightingInfo info;\\nfloat shadow=1.;\\n#if defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\\nvec3 absorption=vec3(0.);\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockDirectLighting = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockDirectLighting.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockFinalLitComponents';\r\nvar shader = \"\\n\\n\\n\\n#if defined(ENVIRONMENTBRDF)\\n#ifdef MS_BRDF_ENERGY_CONSERVATION\\nvec3 energyConservationFactor=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf);\\n#endif\\n#endif\\n#ifndef METALLICWORKFLOW\\n#ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION\\nsurfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;\\n#endif\\n#endif\\n#if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF)\\nsurfaceAlbedo.rgb=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb;\\n#endif\\n\\n#ifdef REFLECTION\\nvec3 finalIrradiance=reflectionOut.environmentIrradiance;\\n#if defined(CLEARCOAT)\\nfinalIrradiance*=clearcoatOut.conservationFactor;\\n#if defined(CLEARCOAT_TINT)\\nfinalIrradiance*=clearcoatOut.absorption;\\n#endif\\n#endif\\n#if defined(SS_REFRACTION)\\nfinalIrradiance*=subSurfaceOut.refractionFactorForIrradiance;\\n#endif\\n#if defined(SS_TRANSLUCENCY)\\nfinalIrradiance*=(1.0-subSurfaceOut.translucencyIntensity);\\nfinalIrradiance+=subSurfaceOut.refractionIrradiance;\\n#endif\\nfinalIrradiance*=surfaceAlbedo.rgb;\\nfinalIrradiance*=vLightingIntensity.z;\\nfinalIrradiance*=aoOut.ambientOcclusionColor;\\n#endif\\n\\n#ifdef SPECULARTERM\\nvec3 finalSpecular=specularBase;\\nfinalSpecular=max(finalSpecular,0.0);\\nvec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalSpecularScaled*=energyConservationFactor;\\n#endif\\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\\nfinalSpecularScaled*=sheenOut.sheenAlbedoScaling;\\n#endif\\n#endif\\n\\n#ifdef REFLECTION\\nvec3 finalRadiance=reflectionOut.environmentRadiance.rgb;\\nfinalRadiance*=subSurfaceOut.specularEnvironmentReflectance;\\nvec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalRadianceScaled*=energyConservationFactor;\\n#endif\\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\\nfinalRadianceScaled*=sheenOut.sheenAlbedoScaling;\\n#endif\\n#endif\\n\\n#ifdef SHEEN\\nvec3 finalSheen=sheenBase*sheenOut.sheenColor;\\nfinalSheen=max(finalSheen,0.0);\\nvec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w;\\n#if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor;\\n#if defined(CLEARCOAT_TINT)\\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption;\\n#endif\\n#endif\\n#endif\\n\\n#ifdef CLEARCOAT\\nvec3 finalClearCoat=clearCoatBase;\\nfinalClearCoat=max(finalClearCoat,0.0);\\nvec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat;\\n#endif\\n#ifdef SS_REFRACTION\\nsubSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor;\\n#ifdef CLEARCOAT_TINT\\nsubSurfaceOut.finalRefraction*=clearcoatOut.absorption;\\n#endif\\n#endif\\n#endif\\n\\n#ifdef ALPHABLEND\\nfloat luminanceOverAlpha=0.0;\\n#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalRadianceScaled);\\n#if defined(CLEARCOAT)\\nluminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled);\\n#endif\\n#endif\\n#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalSpecularScaled);\\n#endif\\n#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalClearCoatScaled);\\n#endif\\n#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA) || defined(CLEARCOATOVERALPHA)\\nalpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);\\n#endif\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockFinalLitComponents = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockFinalLitComponents.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockFinalUnlitComponents';\r\nvar shader = \"\\nvec3 finalDiffuse=diffuseBase;\\nfinalDiffuse*=surfaceAlbedo.rgb;\\nfinalDiffuse=max(finalDiffuse,0.0);\\nfinalDiffuse*=vLightingIntensity.x;\\n\\nvec3 finalAmbient=vAmbientColor;\\nfinalAmbient*=surfaceAlbedo.rgb;\\n\\nvec3 finalEmissive=vEmissiveColor;\\n#ifdef EMISSIVE\\nvec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;\\nfinalEmissive*=toLinearSpace(emissiveColorTex.rgb);\\nfinalEmissive*=vEmissiveInfos.y;\\n#endif\\nfinalEmissive*=vLightingIntensity.y;\\n\\n#ifdef AMBIENT\\nvec3 ambientOcclusionForDirectDiffuse=mix(vec3(1.),aoOut.ambientOcclusionColor,vAmbientInfos.w);\\n#else\\nvec3 ambientOcclusionForDirectDiffuse=aoOut.ambientOcclusionColor;\\n#endif\\nfinalAmbient*=aoOut.ambientOcclusionColor;\\nfinalDiffuse*=ambientOcclusionForDirectDiffuse;\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockFinalUnlitComponents = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockFinalUnlitComponents.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockFinalColorComposition';\r\nvar shader = \"vec4 finalColor=vec4(\\nfinalAmbient +\\nfinalDiffuse +\\n#ifndef UNLIT\\n#ifdef REFLECTION\\nfinalIrradiance +\\n#endif\\n#ifdef SPECULARTERM\\nfinalSpecularScaled +\\n#endif\\n#ifdef SHEEN\\nfinalSheenScaled +\\n#endif\\n#ifdef CLEARCOAT\\nfinalClearCoatScaled +\\n#endif\\n#ifdef REFLECTION\\nfinalRadianceScaled +\\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\\nsheenOut.finalSheenRadianceScaled +\\n#endif\\n#ifdef CLEARCOAT\\nclearcoatOut.finalClearCoatRadianceScaled +\\n#endif\\n#endif\\n#ifdef SS_REFRACTION\\nsubSurfaceOut.finalRefraction +\\n#endif\\n#endif\\nfinalEmissive,\\nalpha);\\n\\n#ifdef LIGHTMAP\\n#ifndef LIGHTMAPEXCLUDED\\n#ifdef USELIGHTMAPASSHADOWMAP\\nfinalColor.rgb*=lightmapColor.rgb;\\n#else\\nfinalColor.rgb+=lightmapColor.rgb;\\n#endif\\n#endif\\n#endif\\n#define CUSTOM_FRAGMENT_BEFORE_FOG\\n\\nfinalColor=max(finalColor,0.0);\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockFinalColorComposition = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockFinalColorComposition.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrBlockImageProcessing';\r\nvar shader = \"#ifdef IMAGEPROCESSINGPOSTPROCESS\\n\\n\\nfinalColor.rgb=clamp(finalColor.rgb,0.,30.0);\\n#else\\n\\nfinalColor=applyImageProcessing(finalColor);\\n#endif\\nfinalColor.a*=visibility;\\n#ifdef PREMULTIPLYALPHA\\n\\nfinalColor.rgb*=finalColor.a;\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrBlockImageProcessing = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrBlockImageProcessing.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrDebug';\r\nvar shader = \"#if DEBUGMODE>0\\nif (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) {\\n\\n#if DEBUGMODE == 1\\ngl_FragColor.rgb=vPositionW.rgb;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 2 && defined(NORMAL)\\ngl_FragColor.rgb=vNormalW.rgb;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 3 && defined(BUMP) || DEBUGMODE == 3 && defined(PARALLAX) || DEBUGMODE == 3 && defined(ANISOTROPIC)\\n\\ngl_FragColor.rgb=TBN[0];\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 4 && defined(BUMP) || DEBUGMODE == 4 && defined(PARALLAX) || DEBUGMODE == 4 && defined(ANISOTROPIC)\\n\\ngl_FragColor.rgb=TBN[1];\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 5\\n\\ngl_FragColor.rgb=normalW;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 6 && defined(MAINUV1)\\ngl_FragColor.rgb=vec3(vMainUV1,0.0);\\n#elif DEBUGMODE == 7 && defined(MAINUV2)\\ngl_FragColor.rgb=vec3(vMainUV2,0.0);\\n#elif DEBUGMODE == 8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\\n\\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[0];\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\\n\\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[1];\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 10 && defined(CLEARCOAT)\\n\\ngl_FragColor.rgb=clearcoatOut.clearCoatNormalW;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 11 && defined(ANISOTROPIC)\\ngl_FragColor.rgb=anisotropicOut.anisotropicNormal;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 12 && defined(ANISOTROPIC)\\ngl_FragColor.rgb=anisotropicOut.anisotropicTangent;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE == 13 && defined(ANISOTROPIC)\\ngl_FragColor.rgb=anisotropicOut.anisotropicBitangent;\\n#define DEBUGMODE_NORMALIZE\\n\\n#elif DEBUGMODE == 20 && defined(ALBEDO)\\ngl_FragColor.rgb=albedoTexture.rgb;\\n#elif DEBUGMODE == 21 && defined(AMBIENT)\\ngl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb;\\n#elif DEBUGMODE == 22 && defined(OPACITY)\\ngl_FragColor.rgb=opacityMap.rgb;\\n#elif DEBUGMODE == 23 && defined(EMISSIVE)\\ngl_FragColor.rgb=emissiveColorTex.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 24 && defined(LIGHTMAP)\\ngl_FragColor.rgb=lightmapColor.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)\\ngl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb;\\n#elif DEBUGMODE == 26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)\\ngl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)\\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0);\\n#elif DEBUGMODE == 28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\\ngl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb;\\n#elif DEBUGMODE == 29 && defined(SHEEN) && defined(SHEEN_TEXTURE)\\ngl_FragColor.rgb=sheenOut.sheenMapData.rgb;\\n#elif DEBUGMODE == 30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)\\ngl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb;\\n#elif DEBUGMODE == 31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)\\ngl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb;\\n\\n#elif DEBUGMODE == 40 && defined(SS_REFRACTION)\\n\\ngl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 41 && defined(REFLECTION)\\ngl_FragColor.rgb=reflectionOut.environmentRadiance.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 42 && defined(CLEARCOAT) && defined(REFLECTION)\\ngl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb;\\n#define DEBUGMODE_GAMMA\\n\\n#elif DEBUGMODE == 50\\ngl_FragColor.rgb=diffuseBase.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 51 && defined(SPECULARTERM)\\ngl_FragColor.rgb=specularBase.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 52 && defined(CLEARCOAT)\\ngl_FragColor.rgb=clearCoatBase.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 53 && defined(SHEEN)\\ngl_FragColor.rgb=sheenBase.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 54 && defined(REFLECTION)\\ngl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb;\\n#define DEBUGMODE_GAMMA\\n\\n#elif DEBUGMODE == 60\\ngl_FragColor.rgb=surfaceAlbedo.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 61\\ngl_FragColor.rgb=clearcoatOut.specularEnvironmentR0;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 62 && defined(METALLICWORKFLOW)\\ngl_FragColor.rgb=vec3(reflectivityOut.metallicRoughness.r);\\n#elif DEBUGMODE == 71 && defined(METALLICWORKFLOW)\\ngl_FragColor.rgb=reflectivityOut.metallicF0;\\n#elif DEBUGMODE == 63\\ngl_FragColor.rgb=vec3(roughness);\\n#elif DEBUGMODE == 64\\ngl_FragColor.rgb=vec3(alphaG);\\n#elif DEBUGMODE == 65\\ngl_FragColor.rgb=vec3(NdotV);\\n#elif DEBUGMODE == 66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\\ngl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 67 && defined(CLEARCOAT)\\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness);\\n#elif DEBUGMODE == 68 && defined(CLEARCOAT)\\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV);\\n#elif DEBUGMODE == 69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)\\ngl_FragColor.rgb=subSurfaceOut.transmittance;\\n#elif DEBUGMODE == 70 && defined(SUBSURFACE) && defined(SS_REFRACTION)\\ngl_FragColor.rgb=subSurfaceOut.refractionTransmittance;\\n\\n#elif DEBUGMODE == 80 && defined(RADIANCEOCCLUSION)\\ngl_FragColor.rgb=vec3(seo);\\n#elif DEBUGMODE == 81 && defined(HORIZONOCCLUSION)\\ngl_FragColor.rgb=vec3(eho);\\n#elif DEBUGMODE == 82 && defined(MS_BRDF_ENERGY_CONSERVATION)\\ngl_FragColor.rgb=vec3(energyConservationFactor);\\n#elif DEBUGMODE == 83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\ngl_FragColor.rgb=specularEnvironmentReflectance;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\ngl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 85 && defined(SHEEN) && defined(REFLECTION)\\ngl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE == 86 && defined(ALPHABLEND)\\ngl_FragColor.rgb=vec3(luminanceOverAlpha);\\n#elif DEBUGMODE == 87\\ngl_FragColor.rgb=vec3(alpha);\\n#endif\\ngl_FragColor.rgb*=vDebugMode.y;\\n#ifdef DEBUGMODE_NORMALIZE\\ngl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5;\\n#endif\\n#ifdef DEBUGMODE_GAMMA\\ngl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb);\\n#endif\\ngl_FragColor.a=1.0;\\n#ifdef PREPASS\\ngl_FragData[0]=toLinearSpace(gl_FragColor);\\ngl_FragData[1]=vec4(0.,0.,0.,0.);\\n#endif\\nreturn;\\n}\\n#endif\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrDebug = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrDebug.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/prePassDeclaration\";\r\nimport \"./ShadersInclude/pbrFragmentDeclaration\";\r\nimport \"./ShadersInclude/pbrUboDeclaration\";\r\nimport \"./ShadersInclude/pbrFragmentExtraDeclaration\";\r\nimport \"./ShadersInclude/lightFragmentDeclaration\";\r\nimport \"./ShadersInclude/lightUboDeclaration\";\r\nimport \"./ShadersInclude/pbrFragmentSamplersDeclaration\";\r\nimport \"./ShadersInclude/imageProcessingDeclaration\";\r\nimport \"./ShadersInclude/clipPlaneFragmentDeclaration\";\r\nimport \"./ShadersInclude/logDepthDeclaration\";\r\nimport \"./ShadersInclude/fogFragmentDeclaration\";\r\nimport \"./ShadersInclude/helperFunctions\";\r\nimport \"./ShadersInclude/subSurfaceScatteringFunctions\";\r\nimport \"./ShadersInclude/importanceSampling\";\r\nimport \"./ShadersInclude/pbrHelperFunctions\";\r\nimport \"./ShadersInclude/imageProcessingFunctions\";\r\nimport \"./ShadersInclude/shadowsFragmentFunctions\";\r\nimport \"./ShadersInclude/harmonicsFunctions\";\r\nimport \"./ShadersInclude/pbrDirectLightingSetupFunctions\";\r\nimport \"./ShadersInclude/pbrDirectLightingFalloffFunctions\";\r\nimport \"./ShadersInclude/pbrBRDFFunctions\";\r\nimport \"./ShadersInclude/hdrFilteringFunctions\";\r\nimport \"./ShadersInclude/pbrDirectLightingFunctions\";\r\nimport \"./ShadersInclude/pbrIBLFunctions\";\r\nimport \"./ShadersInclude/bumpFragmentMainFunctions\";\r\nimport \"./ShadersInclude/bumpFragmentFunctions\";\r\nimport \"./ShadersInclude/reflectionFunction\";\r\nimport \"./ShadersInclude/pbrBlockAlbedoOpacity\";\r\nimport \"./ShadersInclude/pbrBlockReflectivity\";\r\nimport \"./ShadersInclude/pbrBlockAmbientOcclusion\";\r\nimport \"./ShadersInclude/pbrBlockAlphaFresnel\";\r\nimport \"./ShadersInclude/pbrBlockAnisotropic\";\r\nimport \"./ShadersInclude/pbrBlockReflection\";\r\nimport \"./ShadersInclude/pbrBlockSheen\";\r\nimport \"./ShadersInclude/pbrBlockClearcoat\";\r\nimport \"./ShadersInclude/pbrBlockSubSurface\";\r\nimport \"./ShadersInclude/clipPlaneFragment\";\r\nimport \"./ShadersInclude/pbrBlockNormalGeometric\";\r\nimport \"./ShadersInclude/bumpFragment\";\r\nimport \"./ShadersInclude/pbrBlockNormalFinal\";\r\nimport \"./ShadersInclude/depthPrePass\";\r\nimport \"./ShadersInclude/pbrBlockLightmapInit\";\r\nimport \"./ShadersInclude/pbrBlockGeometryInfo\";\r\nimport \"./ShadersInclude/pbrBlockReflectance0\";\r\nimport \"./ShadersInclude/pbrBlockReflectance\";\r\nimport \"./ShadersInclude/pbrBlockDirectLighting\";\r\nimport \"./ShadersInclude/lightFragment\";\r\nimport \"./ShadersInclude/pbrBlockFinalLitComponents\";\r\nimport \"./ShadersInclude/pbrBlockFinalUnlitComponents\";\r\nimport \"./ShadersInclude/pbrBlockFinalColorComposition\";\r\nimport \"./ShadersInclude/logDepthFragment\";\r\nimport \"./ShadersInclude/fogFragment\";\r\nimport \"./ShadersInclude/pbrBlockImageProcessing\";\r\nimport \"./ShadersInclude/pbrDebug\";\r\nvar name = 'pbrPixelShader';\r\nvar shader = \"#if defined(BUMP) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\n#ifdef LODBASEDMICROSFURACE\\n#extension GL_EXT_shader_texture_lod : enable\\n#endif\\n#define CUSTOM_FRAGMENT_BEGIN\\n#ifdef LOGARITHMICDEPTH\\n#extension GL_EXT_frag_depth : enable\\n#endif\\n#include[SCENE_MRT_COUNT]\\nprecision highp float;\\n\\n#ifndef FROMLINEARSPACE\\n#define FROMLINEARSPACE\\n#endif\\n\\n#include<__decl__pbrFragment>\\n#include\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#include\\n#include\\n#include\\n#include\\n#include\\n\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#ifdef REFLECTION\\n#include\\n#endif\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\n#include\\n\\n#include\\n#include\\n#include\\n\\nalbedoOpacityOutParams albedoOpacityOut;\\n#ifdef ALBEDO\\nvec4 albedoTexture=texture2D(albedoSampler,vAlbedoUV+uvOffset);\\n#endif\\n#ifdef OPACITY\\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\\n#endif\\nalbedoOpacityBlock(\\nvAlbedoColor,\\n#ifdef ALBEDO\\nalbedoTexture,\\nvAlbedoInfos,\\n#endif\\n#ifdef OPACITY\\nopacityMap,\\nvOpacityInfos,\\n#endif\\n#ifdef DETAIL\\ndetailColor,\\nvDetailInfos,\\n#endif\\nalbedoOpacityOut\\n);\\nvec3 surfaceAlbedo=albedoOpacityOut.surfaceAlbedo;\\nfloat alpha=albedoOpacityOut.alpha;\\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\\n#include\\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\\n\\nambientOcclusionOutParams aoOut;\\n#ifdef AMBIENT\\nvec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb;\\n#endif\\nambientOcclusionBlock(\\n#ifdef AMBIENT\\nambientOcclusionColorMap,\\nvAmbientInfos,\\n#endif\\naoOut\\n);\\n#include\\n#ifdef UNLIT\\nvec3 diffuseBase=vec3(1.,1.,1.);\\n#else\\n\\nvec3 baseColor=surfaceAlbedo;\\nreflectivityOutParams reflectivityOut;\\n#if defined(REFLECTIVITY)\\nvec4 surfaceMetallicOrReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\\nvec4 baseReflectivity=surfaceMetallicOrReflectivityColorMap;\\n#ifndef METALLICWORKFLOW\\nsurfaceMetallicOrReflectivityColorMap=toLinearSpace(surfaceMetallicOrReflectivityColorMap);\\nsurfaceMetallicOrReflectivityColorMap.rgb*=vReflectivityInfos.y;\\n#endif\\n#endif\\n#if defined(MICROSURFACEMAP)\\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\\n#endif\\n#ifdef METALLICWORKFLOW\\nvec4 metallicReflectanceFactors=vMetallicReflectanceFactors;\\n#ifdef METALLIC_REFLECTANCE\\nvec4 metallicReflectanceFactorsMap=texture2D(metallicReflectanceSampler,vMetallicReflectanceUV+uvOffset);\\nmetallicReflectanceFactorsMap=toLinearSpace(metallicReflectanceFactorsMap);\\nmetallicReflectanceFactors*=metallicReflectanceFactorsMap;\\n#endif\\n#endif\\nreflectivityBlock(\\nvReflectivityColor,\\n#ifdef METALLICWORKFLOW\\nsurfaceAlbedo,\\nmetallicReflectanceFactors,\\n#endif\\n#ifdef REFLECTIVITY\\nvReflectivityInfos,\\nsurfaceMetallicOrReflectivityColorMap,\\n#endif\\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\\naoOut.ambientOcclusionColor,\\n#endif\\n#ifdef MICROSURFACEMAP\\nmicroSurfaceTexel,\\n#endif\\n#ifdef DETAIL\\ndetailColor,\\nvDetailInfos,\\n#endif\\nreflectivityOut\\n);\\nfloat microSurface=reflectivityOut.microSurface;\\nfloat roughness=reflectivityOut.roughness;\\n#ifdef METALLICWORKFLOW\\nsurfaceAlbedo=reflectivityOut.surfaceAlbedo;\\n#endif\\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\\naoOut.ambientOcclusionColor=reflectivityOut.ambientOcclusionColor;\\n#endif\\n\\n#ifdef ALPHAFRESNEL\\n#if defined(ALPHATEST) || defined(ALPHABLEND)\\nalphaFresnelOutParams alphaFresnelOut;\\nalphaFresnelBlock(\\nnormalW,\\nviewDirectionW,\\nalpha,\\nmicroSurface,\\nalphaFresnelOut\\n);\\nalpha=alphaFresnelOut.alpha;\\n#endif\\n#endif\\n\\n#include\\n\\n#ifdef ANISOTROPIC\\nanisotropicOutParams anisotropicOut;\\n#ifdef ANISOTROPIC_TEXTURE\\nvec3 anisotropyMapData=texture2D(anisotropySampler,vAnisotropyUV+uvOffset).rgb*vAnisotropyInfos.y;\\n#endif\\nanisotropicBlock(\\nvAnisotropy,\\n#ifdef ANISOTROPIC_TEXTURE\\nanisotropyMapData,\\n#endif\\nTBN,\\nnormalW,\\nviewDirectionW,\\nanisotropicOut\\n);\\n#endif\\n\\n#ifdef REFLECTION\\nreflectionOutParams reflectionOut;\\nreflectionBlock(\\nvPositionW,\\nnormalW,\\nalphaG,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\n#ifdef ANISOTROPIC\\nanisotropicOut,\\n#endif\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nNdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nroughness,\\n#endif\\nreflectionSampler,\\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\\nvEnvironmentIrradiance,\\n#endif\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nreflectionMatrix,\\n#endif\\n#endif\\n#ifdef USEIRRADIANCEMAP\\nirradianceSampler,\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\nreflectionOut\\n);\\n#endif\\n\\n#include\\n\\n#ifdef SHEEN\\nsheenOutParams sheenOut;\\n#ifdef SHEEN_TEXTURE\\nvec4 sheenMapData=toLinearSpace(texture2D(sheenSampler,vSheenUV+uvOffset))*vSheenInfos.y;\\n#endif\\n#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nvec4 sheenMapRoughnessData=texture2D(sheenRoughnessSampler,vSheenRoughnessUV+uvOffset)*vSheenInfos.w;\\n#endif\\nsheenBlock(\\nvSheenColor,\\n#ifdef SHEEN_ROUGHNESS\\nvSheenRoughness,\\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nsheenMapRoughnessData,\\n#endif\\n#endif\\nroughness,\\n#ifdef SHEEN_TEXTURE\\nsheenMapData,\\n#endif\\nreflectance,\\n#ifdef SHEEN_LINKWITHALBEDO\\nbaseColor,\\nsurfaceAlbedo,\\n#endif\\n#ifdef ENVIRONMENTBRDF\\nNdotV,\\nenvironmentBrdf,\\n#endif\\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nAARoughnessFactors,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\nvLightingIntensity,\\nreflectionSampler,\\nreflectionOut.reflectionCoords,\\nNdotVUnclamped,\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\\nseo,\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\\neho,\\n#endif\\n#endif\\nsheenOut\\n);\\n#ifdef SHEEN_LINKWITHALBEDO\\nsurfaceAlbedo=sheenOut.surfaceAlbedo;\\n#endif\\n#endif\\n\\nclearcoatOutParams clearcoatOut;\\n#ifdef CLEARCOAT\\n#ifdef CLEARCOAT_TEXTURE\\nvec2 clearCoatMapData=texture2D(clearCoatSampler,vClearCoatUV+uvOffset).rg*vClearCoatInfos.y;\\n#endif\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nvec4 clearCoatMapRoughnessData=texture2D(clearCoatRoughnessSampler,vClearCoatRoughnessUV+uvOffset)*vClearCoatInfos.w;\\n#endif\\n#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\\nvec4 clearCoatTintMapData=toLinearSpace(texture2D(clearCoatTintSampler,vClearCoatTintUV+uvOffset));\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nvec4 clearCoatBumpMapData=texture2D(clearCoatBumpSampler,vClearCoatBumpUV+uvOffset);\\n#endif\\nclearcoatBlock(\\nvPositionW,\\ngeometricNormalW,\\nviewDirectionW,\\nvClearCoatParams,\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nclearCoatMapRoughnessData,\\n#endif\\nspecularEnvironmentR0,\\n#ifdef CLEARCOAT_TEXTURE\\nclearCoatMapData,\\n#endif\\n#ifdef CLEARCOAT_TINT\\nvClearCoatTintParams,\\nclearCoatColorAtDistance,\\nvClearCoatRefractionParams,\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nclearCoatTintMapData,\\n#endif\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nvClearCoatBumpInfos,\\nclearCoatBumpMapData,\\nvClearCoatBumpUV,\\n#if defined(TANGENT) && defined(NORMAL)\\nvTBN,\\n#else\\nvClearCoatTangentSpaceParams,\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\nnormalMatrix,\\n#endif\\n#endif\\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\\nfaceNormal,\\n#endif\\n#ifdef REFLECTION\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\nvLightingIntensity,\\nreflectionSampler,\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\n#endif\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\n#ifdef RADIANCEOCCLUSION\\nambientMonochrome,\\n#endif\\n#endif\\nclearcoatOut\\n);\\n#else\\nclearcoatOut.specularEnvironmentR0=specularEnvironmentR0;\\n#endif\\n\\n#include\\n\\nsubSurfaceOutParams subSurfaceOut;\\n#ifdef SUBSURFACE\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nvec4 thicknessMap=texture2D(thicknessSampler,vThicknessUV+uvOffset);\\n#endif\\nsubSurfaceBlock(\\nvSubSurfaceIntensity,\\nvThicknessParam,\\nvTintColor,\\nnormalW,\\nspecularEnvironmentReflectance,\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nthicknessMap,\\n#endif\\n#ifdef REFLECTION\\n#ifdef SS_TRANSLUCENCY\\nreflectionMatrix,\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nreflectionOut.irradianceVector,\\n#endif\\n#if defined(REALTIME_FILTERING)\\nreflectionSampler,\\nvReflectionFilteringInfo,\\n#endif\\n#endif\\n#ifdef USEIRRADIANCEMAP\\nirradianceSampler,\\n#endif\\n#endif\\n#endif\\n#ifdef SS_REFRACTION\\nvPositionW,\\nviewDirectionW,\\nview,\\nsurfaceAlbedo,\\nvRefractionInfos,\\nrefractionMatrix,\\nvRefractionMicrosurfaceInfos,\\nvLightingIntensity,\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nalpha,\\n#endif\\n#ifdef SS_LODINREFRACTIONALPHA\\nNdotVUnclamped,\\n#endif\\n#ifdef SS_LINEARSPECULARREFRACTION\\nroughness,\\n#else\\nalphaG,\\n#endif\\nrefractionSampler,\\n#ifndef LODBASEDMICROSFURACE\\nrefractionSamplerLow,\\nrefractionSamplerHigh,\\n#endif\\n#ifdef ANISOTROPIC\\nanisotropicOut,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvRefractionFilteringInfo,\\n#endif\\n#endif\\n#ifdef SS_TRANSLUCENCY\\nvDiffusionDistance,\\n#endif\\nsubSurfaceOut\\n);\\n#ifdef SS_REFRACTION\\nsurfaceAlbedo=subSurfaceOut.surfaceAlbedo;\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nalpha=subSurfaceOut.alpha;\\n#endif\\n#endif\\n#else\\nsubSurfaceOut.specularEnvironmentReflectance=specularEnvironmentReflectance;\\n#endif\\n\\n#include\\n#include[0..maxSimultaneousLights]\\n\\n#include\\n#endif\\n#include\\n#include\\n#include\\n#include(color,finalColor)\\n#include\\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\\n#ifdef PREPASS\\n#ifdef PREPASS_POSITION\\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,1.0);\\n#endif\\n#ifdef PREPASS_VELOCITY\\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\\nvec2 velocity=abs(a-b);\\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\\ngl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\\n#endif\\n#ifdef PREPASS_IRRADIANCE\\nvec3 irradiance=finalDiffuse;\\n#ifndef UNLIT\\n#ifdef REFLECTION\\nirradiance+=finalIrradiance;\\n#endif\\n#endif\\nvec3 sqAlbedo=sqrt(surfaceAlbedo);\\n#ifdef SS_SCATTERING\\ngl_FragData[0]=vec4(finalColor.rgb-irradiance,finalColor.a);\\nirradiance/=sqAlbedo;\\n#else\\ngl_FragData[0]=finalColor;\\nfloat scatteringDiffusionProfile=255.;\\n#endif\\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(irradiance,scatteringDiffusionProfile/255.);\\n#else\\ngl_FragData[0]=vec4(finalColor.rgb,finalColor.a);\\n#endif\\n#ifdef PREPASS_DEPTHNORMAL\\ngl_FragData[PREPASS_DEPTHNORMAL_INDEX]=vec4(vViewPos.z,(view*vec4(normalW,0.0)).rgb);\\n#endif\\n#ifdef PREPASS_ALBEDO\\ngl_FragData[PREPASS_ALBEDO_INDEX]=vec4(sqAlbedo,1.0);\\n#endif\\n#ifdef PREPASS_REFLECTIVITY\\n#if defined(REFLECTIVITY)\\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(baseReflectivity.rgb,1.0);\\n#else\\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(0.0,0.0,0.0,1.0);\\n#endif\\n#endif\\n#endif\\n#if !defined(PREPASS) || defined(WEBGL2)\\ngl_FragColor=finalColor;\\n#endif\\n#include\\n}\\n\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrPixelShader = { name: name, shader: shader };\r\n//# sourceMappingURL=pbr.fragment.js.map","import { Effect } from \"../../Materials/effect\";\r\nvar name = 'pbrVertexDeclaration';\r\nvar shader = \"uniform mat4 view;\\nuniform mat4 viewProjection;\\n#ifdef ALBEDO\\nuniform mat4 albedoMatrix;\\nuniform vec2 vAlbedoInfos;\\n#endif\\n#ifdef AMBIENT\\nuniform mat4 ambientMatrix;\\nuniform vec4 vAmbientInfos;\\n#endif\\n#ifdef OPACITY\\nuniform mat4 opacityMatrix;\\nuniform vec2 vOpacityInfos;\\n#endif\\n#ifdef EMISSIVE\\nuniform vec2 vEmissiveInfos;\\nuniform mat4 emissiveMatrix;\\n#endif\\n#ifdef LIGHTMAP\\nuniform vec2 vLightmapInfos;\\nuniform mat4 lightmapMatrix;\\n#endif\\n#ifdef REFLECTIVITY\\nuniform vec3 vReflectivityInfos;\\nuniform mat4 reflectivityMatrix;\\n#endif\\n#ifdef METALLIC_REFLECTANCE\\nuniform vec2 vMetallicReflectanceInfos;\\nuniform mat4 metallicReflectanceMatrix;\\n#endif\\n#ifdef MICROSURFACEMAP\\nuniform vec2 vMicroSurfaceSamplerInfos;\\nuniform mat4 microSurfaceSamplerMatrix;\\n#endif\\n#ifdef BUMP\\nuniform vec3 vBumpInfos;\\nuniform mat4 bumpMatrix;\\n#endif\\n#ifdef POINTSIZE\\nuniform float pointSize;\\n#endif\\n\\n#ifdef REFLECTION\\nuniform vec2 vReflectionInfos;\\nuniform mat4 reflectionMatrix;\\n#endif\\n\\n#ifdef CLEARCOAT\\n#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)\\nuniform vec4 vClearCoatInfos;\\n#endif\\n#ifdef CLEARCOAT_TEXTURE\\nuniform mat4 clearCoatMatrix;\\n#endif\\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS\\nuniform mat4 clearCoatRoughnessMatrix;\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nuniform vec2 vClearCoatBumpInfos;\\nuniform mat4 clearCoatBumpMatrix;\\n#endif\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nuniform vec2 vClearCoatTintInfos;\\nuniform mat4 clearCoatTintMatrix;\\n#endif\\n#endif\\n\\n#ifdef ANISOTROPIC\\n#ifdef ANISOTROPIC_TEXTURE\\nuniform vec2 vAnisotropyInfos;\\nuniform mat4 anisotropyMatrix;\\n#endif\\n#endif\\n\\n#ifdef SHEEN\\n#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)\\nuniform vec4 vSheenInfos;\\n#endif\\n#ifdef SHEEN_TEXTURE\\nuniform mat4 sheenMatrix;\\n#endif\\n#ifdef SHEEN_TEXTURE_ROUGHNESS\\nuniform mat4 sheenRoughnessMatrix;\\n#endif\\n#endif\\n\\n#ifdef SUBSURFACE\\n#ifdef SS_REFRACTION\\nuniform vec4 vRefractionInfos;\\nuniform mat4 refractionMatrix;\\n#endif\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nuniform vec2 vThicknessInfos;\\nuniform mat4 thicknessMatrix;\\n#endif\\n#endif\\n\";\r\nEffect.IncludesShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrVertexDeclaration = { name: name, shader: shader };\r\n//# sourceMappingURL=pbrVertexDeclaration.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/pbrVertexDeclaration\";\r\nimport \"./ShadersInclude/pbrUboDeclaration\";\r\nimport \"./ShadersInclude/helperFunctions\";\r\nimport \"./ShadersInclude/bonesDeclaration\";\r\nimport \"./ShadersInclude/instancesDeclaration\";\r\nimport \"./ShadersInclude/prePassVertexDeclaration\";\r\nimport \"./ShadersInclude/harmonicsFunctions\";\r\nimport \"./ShadersInclude/bumpVertexDeclaration\";\r\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\r\nimport \"./ShadersInclude/fogVertexDeclaration\";\r\nimport \"./ShadersInclude/lightFragmentDeclaration\";\r\nimport \"./ShadersInclude/lightUboDeclaration\";\r\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration\";\r\nimport \"./ShadersInclude/morphTargetsVertexDeclaration\";\r\nimport \"./ShadersInclude/logDepthDeclaration\";\r\nimport \"./ShadersInclude/morphTargetsVertex\";\r\nimport \"./ShadersInclude/instancesVertex\";\r\nimport \"./ShadersInclude/bonesVertex\";\r\nimport \"./ShadersInclude/prePassVertex\";\r\nimport \"./ShadersInclude/bumpVertex\";\r\nimport \"./ShadersInclude/clipPlaneVertex\";\r\nimport \"./ShadersInclude/fogVertex\";\r\nimport \"./ShadersInclude/shadowsVertex\";\r\nimport \"./ShadersInclude/logDepthVertex\";\r\nvar name = 'pbrVertexShader';\r\nvar shader = \"precision highp float;\\n#include<__decl__pbrVertex>\\n#define CUSTOM_VERTEX_BEGIN\\n\\nattribute vec3 position;\\n#ifdef NORMAL\\nattribute vec3 normal;\\n#endif\\n#ifdef TANGENT\\nattribute vec4 tangent;\\n#endif\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\n#ifdef MAINUV1\\nvarying vec2 vMainUV1;\\n#endif\\n#ifdef MAINUV2\\nvarying vec2 vMainUV2;\\n#endif\\n#ifdef VERTEXCOLOR\\nattribute vec4 color;\\n#endif\\n#include\\n#include\\n\\n#include\\n#include\\n#if defined(ALBEDO) && ALBEDODIRECTUV == 0\\nvarying vec2 vAlbedoUV;\\n#endif\\n#if defined(DETAIL) && DETAILDIRECTUV == 0\\nvarying vec2 vDetailUV;\\n#endif\\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\\nvarying vec2 vAmbientUV;\\n#endif\\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\\nvarying vec2 vOpacityUV;\\n#endif\\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\\nvarying vec2 vEmissiveUV;\\n#endif\\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\\nvarying vec2 vLightmapUV;\\n#endif\\n#if defined(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\\nvarying vec2 vReflectivityUV;\\n#endif\\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\\nvarying vec2 vMicroSurfaceSamplerUV;\\n#endif\\n#if defined(METALLIC_REFLECTANCE) && METALLIC_REFLECTANCEDIRECTUV == 0\\nvarying vec2 vMetallicReflectanceUV;\\n#endif\\n#if defined(BUMP) && BUMPDIRECTUV == 0\\nvarying vec2 vBumpUV;\\n#endif\\n#ifdef CLEARCOAT\\n#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0\\nvarying vec2 vClearCoatUV;\\n#endif\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV == 0\\nvarying vec2 vClearCoatRoughnessUV;\\n#endif\\n#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0\\nvarying vec2 vClearCoatBumpUV;\\n#endif\\n#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0\\nvarying vec2 vClearCoatTintUV;\\n#endif\\n#endif\\n#ifdef SHEEN\\n#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0\\nvarying vec2 vSheenUV;\\n#endif\\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && SHEEN_TEXTURE_ROUGHNESSDIRECTUV == 0\\nvarying vec2 vSheenRoughnessUV;\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\n#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0\\nvarying vec2 vAnisotropyUV;\\n#endif\\n#endif\\n#ifdef SUBSURFACE\\n#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0\\nvarying vec2 vThicknessUV;\\n#endif\\n#endif\\n\\nvarying vec3 vPositionW;\\n#if DEBUGMODE>0\\nvarying vec4 vClipSpacePosition;\\n#endif\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\\nvarying vec3 vEnvironmentIrradiance;\\n#include\\n#endif\\n#endif\\n#ifdef VERTEXCOLOR\\nvarying vec4 vColor;\\n#endif\\n#include\\n#include\\n#include\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\n#include\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\nvec3 positionUpdated=position;\\n#ifdef NORMAL\\nvec3 normalUpdated=normal;\\n#endif\\n#ifdef TANGENT\\nvec4 tangentUpdated=tangent;\\n#endif\\n#ifdef UV1\\nvec2 uvUpdated=uv;\\n#endif\\n#include[0..maxSimultaneousMorphTargets]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvPositionUVW=positionUpdated;\\n#endif\\n#define CUSTOM_VERTEX_UPDATE_POSITION\\n#define CUSTOM_VERTEX_UPDATE_NORMAL\\n#include\\n#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\\n\\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\\n#endif\\n#include\\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\\nvPositionW=vec3(worldPos);\\n#include\\n#ifdef NORMAL\\nmat3 normalWorld=mat3(finalWorld);\\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));\\nvNormalW=normalize(normalWorld*vNormalW);\\n#else\\n#ifdef NONUNIFORMSCALING\\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\\n#endif\\nvNormalW=normalize(normalWorld*normalUpdated);\\n#endif\\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\\nvec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nreflectionVector.z*=-1.0;\\n#endif\\nvEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\\n#endif\\n#endif\\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR == 0u) {\\ngl_Position=viewProjection*worldPos;\\n} else {\\ngl_Position=viewProjectionR*worldPos;\\n}\\n#else\\ngl_Position=viewProjection*worldPos;\\n#endif\\n#if DEBUGMODE>0\\nvClipSpacePosition=gl_Position;\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\\n#endif\\n\\n#ifndef UV1\\nvec2 uvUpdated=vec2(0.,0.);\\n#endif\\n#ifndef UV2\\nvec2 uv2=vec2(0.,0.);\\n#endif\\n#ifdef MAINUV1\\nvMainUV1=uvUpdated;\\n#endif\\n#ifdef MAINUV2\\nvMainUV2=uv2;\\n#endif\\n#if defined(ALBEDO) && ALBEDODIRECTUV == 0\\nif (vAlbedoInfos.x == 0.)\\n{\\nvAlbedoUV=vec2(albedoMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvAlbedoUV=vec2(albedoMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(DETAIL) && DETAILDIRECTUV == 0\\nif (vDetailInfos.x == 0.)\\n{\\nvDetailUV=vec2(detailMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvDetailUV=vec2(detailMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\\nif (vAmbientInfos.x == 0.)\\n{\\nvAmbientUV=vec2(ambientMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\\nif (vOpacityInfos.x == 0.)\\n{\\nvOpacityUV=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\\nif (vEmissiveInfos.x == 0.)\\n{\\nvEmissiveUV=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\\nif (vLightmapInfos.x == 0.)\\n{\\nvLightmapUV=vec2(lightmapMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\\nif (vReflectivityInfos.x == 0.)\\n{\\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\\nif (vMicroSurfaceSamplerInfos.x == 0.)\\n{\\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(METALLIC_REFLECTANCE) && METALLIC_REFLECTANCEDIRECTUV == 0\\nif (vMetallicReflectanceInfos.x == 0.)\\n{\\nvMetallicReflectanceUV=vec2(metallicReflectanceMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvMetallicReflectanceUV=vec2(metallicReflectanceMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(BUMP) && BUMPDIRECTUV == 0\\nif (vBumpInfos.x == 0.)\\n{\\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#ifdef CLEARCOAT\\n#if defined(CLEARCOAT_TEXTURE) && CLEARCOAT_TEXTUREDIRECTUV == 0\\nif (vClearCoatInfos.x == 0.)\\n{\\nvClearCoatUV=vec2(clearCoatMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvClearCoatUV=vec2(clearCoatMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV == 0\\nif (vClearCoatInfos.z == 0.)\\n{\\nvClearCoatRoughnessUV=vec2(clearCoatRoughnessMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvClearCoatRoughnessUV=vec2(clearCoatRoughnessMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(CLEARCOAT_BUMP) && CLEARCOAT_BUMPDIRECTUV == 0\\nif (vClearCoatBumpInfos.x == 0.)\\n{\\nvClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvClearCoatBumpUV=vec2(clearCoatBumpMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(CLEARCOAT_TINT_TEXTURE) && CLEARCOAT_TINT_TEXTUREDIRECTUV == 0\\nif (vClearCoatTintInfos.x == 0.)\\n{\\nvClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvClearCoatTintUV=vec2(clearCoatTintMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n#ifdef SHEEN\\n#if defined(SHEEN_TEXTURE) && SHEEN_TEXTUREDIRECTUV == 0\\nif (vSheenInfos.x == 0.)\\n{\\nvSheenUV=vec2(sheenMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvSheenUV=vec2(sheenMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && SHEEN_TEXTURE_ROUGHNESSDIRECTUV == 0\\nif (vSheenInfos.z == 0.)\\n{\\nvSheenRoughnessUV=vec2(sheenRoughnessMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvSheenRoughnessUV=vec2(sheenRoughnessMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\n#if defined(ANISOTROPIC_TEXTURE) && ANISOTROPIC_TEXTUREDIRECTUV == 0\\nif (vAnisotropyInfos.x == 0.)\\n{\\nvAnisotropyUV=vec2(anisotropyMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvAnisotropyUV=vec2(anisotropyMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n#ifdef SUBSURFACE\\n#if defined(SS_THICKNESSANDMASK_TEXTURE) && SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 0\\nif (vThicknessInfos.x == 0.)\\n{\\nvThicknessUV=vec2(thicknessMatrix*vec4(uvUpdated,1.0,0.0));\\n}\\nelse\\n{\\nvThicknessUV=vec2(thicknessMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#endif\\n\\n#include\\n\\n#include\\n\\n#include\\n\\n#include[0..maxSimultaneousLights]\\n\\n#ifdef VERTEXCOLOR\\nvColor=color;\\n#endif\\n\\n#ifdef POINTSIZE\\ngl_PointSize=pointSize;\\n#endif\\n\\n#include\\n#define CUSTOM_VERTEX_MAIN_END\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var pbrVertexShader = { name: name, shader: shader };\r\n//# sourceMappingURL=pbr.vertex.js.map","import { __assign, __decorate, __extends } from \"tslib\";\r\nimport { serialize, serializeAsImageProcessingConfiguration, expandToProperty } from \"../../Misc/decorators\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { SmartArray } from \"../../Misc/smartArray\";\r\nimport { BRDFTextureTools } from \"../../Misc/brdfTextureTools\";\r\nimport { Scene } from \"../../scene\";\r\nimport { Vector4 } from \"../../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../../Meshes/buffer\";\r\nimport { PBRClearCoatConfiguration } from \"./pbrClearCoatConfiguration\";\r\nimport { PBRAnisotropicConfiguration } from \"./pbrAnisotropicConfiguration\";\r\nimport { PBRBRDFConfiguration } from \"./pbrBRDFConfiguration\";\r\nimport { PBRSheenConfiguration } from \"./pbrSheenConfiguration\";\r\nimport { PBRSubSurfaceConfiguration } from \"./pbrSubSurfaceConfiguration\";\r\nimport { PrePassConfiguration } from \"../prePassConfiguration\";\r\nimport { Color3, TmpColors } from '../../Maths/math.color';\r\nimport { Scalar } from \"../../Maths/math.scalar\";\r\nimport { ImageProcessingConfiguration } from \"../../Materials/imageProcessingConfiguration\";\r\nimport { Material } from \"../../Materials/material\";\r\nimport { MaterialDefines } from \"../../Materials/materialDefines\";\r\nimport { PushMaterial } from \"../../Materials/pushMaterial\";\r\nimport { MaterialHelper } from \"../../Materials/materialHelper\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { MaterialFlags } from \"../materialFlags\";\r\nimport \"../../Materials/Textures/baseTexture.polynomial\";\r\nimport \"../../Shaders/pbr.fragment\";\r\nimport \"../../Shaders/pbr.vertex\";\r\nimport { EffectFallbacks } from '../effectFallbacks';\r\nimport { DetailMapConfiguration } from '../material.detailMapConfiguration';\r\nvar onCreatedEffectParameters = { effect: null, subMesh: null };\r\n/**\r\n * Manages the defines for the PBR Material.\r\n * @hidden\r\n */\r\nvar PBRMaterialDefines = /** @class */ (function (_super) {\r\n __extends(PBRMaterialDefines, _super);\r\n /**\r\n * Initializes the PBR Material defines.\r\n */\r\n function PBRMaterialDefines() {\r\n var _this = _super.call(this) || this;\r\n _this.PBR = true;\r\n _this.NUM_SAMPLES = \"0\";\r\n _this.REALTIME_FILTERING = false;\r\n _this.MAINUV1 = false;\r\n _this.MAINUV2 = false;\r\n _this.UV1 = false;\r\n _this.UV2 = false;\r\n _this.ALBEDO = false;\r\n _this.GAMMAALBEDO = false;\r\n _this.ALBEDODIRECTUV = 0;\r\n _this.VERTEXCOLOR = false;\r\n _this.DETAIL = false;\r\n _this.DETAILDIRECTUV = 0;\r\n _this.DETAIL_NORMALBLENDMETHOD = 0;\r\n _this.AMBIENT = false;\r\n _this.AMBIENTDIRECTUV = 0;\r\n _this.AMBIENTINGRAYSCALE = false;\r\n _this.OPACITY = false;\r\n _this.VERTEXALPHA = false;\r\n _this.OPACITYDIRECTUV = 0;\r\n _this.OPACITYRGB = false;\r\n _this.ALPHATEST = false;\r\n _this.DEPTHPREPASS = false;\r\n _this.ALPHABLEND = false;\r\n _this.ALPHAFROMALBEDO = false;\r\n _this.ALPHATESTVALUE = \"0.5\";\r\n _this.SPECULAROVERALPHA = false;\r\n _this.RADIANCEOVERALPHA = false;\r\n _this.ALPHAFRESNEL = false;\r\n _this.LINEARALPHAFRESNEL = false;\r\n _this.PREMULTIPLYALPHA = false;\r\n _this.EMISSIVE = false;\r\n _this.EMISSIVEDIRECTUV = 0;\r\n _this.REFLECTIVITY = false;\r\n _this.REFLECTIVITYDIRECTUV = 0;\r\n _this.SPECULARTERM = false;\r\n _this.MICROSURFACEFROMREFLECTIVITYMAP = false;\r\n _this.MICROSURFACEAUTOMATIC = false;\r\n _this.LODBASEDMICROSFURACE = false;\r\n _this.MICROSURFACEMAP = false;\r\n _this.MICROSURFACEMAPDIRECTUV = 0;\r\n _this.METALLICWORKFLOW = false;\r\n _this.ROUGHNESSSTOREINMETALMAPALPHA = false;\r\n _this.ROUGHNESSSTOREINMETALMAPGREEN = false;\r\n _this.METALLNESSSTOREINMETALMAPBLUE = false;\r\n _this.AOSTOREINMETALMAPRED = false;\r\n _this.METALLIC_REFLECTANCE = false;\r\n _this.METALLIC_REFLECTANCEDIRECTUV = 0;\r\n _this.ENVIRONMENTBRDF = false;\r\n _this.ENVIRONMENTBRDF_RGBD = false;\r\n _this.NORMAL = false;\r\n _this.TANGENT = false;\r\n _this.BUMP = false;\r\n _this.BUMPDIRECTUV = 0;\r\n _this.OBJECTSPACE_NORMALMAP = false;\r\n _this.PARALLAX = false;\r\n _this.PARALLAXOCCLUSION = false;\r\n _this.NORMALXYSCALE = true;\r\n _this.LIGHTMAP = false;\r\n _this.LIGHTMAPDIRECTUV = 0;\r\n _this.USELIGHTMAPASSHADOWMAP = false;\r\n _this.GAMMALIGHTMAP = false;\r\n _this.RGBDLIGHTMAP = false;\r\n _this.REFLECTION = false;\r\n _this.REFLECTIONMAP_3D = false;\r\n _this.REFLECTIONMAP_SPHERICAL = false;\r\n _this.REFLECTIONMAP_PLANAR = false;\r\n _this.REFLECTIONMAP_CUBIC = false;\r\n _this.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\r\n _this.REFLECTIONMAP_PROJECTION = false;\r\n _this.REFLECTIONMAP_SKYBOX = false;\r\n _this.REFLECTIONMAP_EXPLICIT = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n _this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n _this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n _this.INVERTCUBICMAP = false;\r\n _this.USESPHERICALFROMREFLECTIONMAP = false;\r\n _this.USEIRRADIANCEMAP = false;\r\n _this.SPHERICAL_HARMONICS = false;\r\n _this.USESPHERICALINVERTEX = false;\r\n _this.REFLECTIONMAP_OPPOSITEZ = false;\r\n _this.LODINREFLECTIONALPHA = false;\r\n _this.GAMMAREFLECTION = false;\r\n _this.RGBDREFLECTION = false;\r\n _this.LINEARSPECULARREFLECTION = false;\r\n _this.RADIANCEOCCLUSION = false;\r\n _this.HORIZONOCCLUSION = false;\r\n _this.INSTANCES = false;\r\n _this.THIN_INSTANCES = false;\r\n _this.PREPASS = false;\r\n _this.PREPASS_IRRADIANCE = false;\r\n _this.PREPASS_IRRADIANCE_INDEX = -1;\r\n _this.PREPASS_ALBEDO = false;\r\n _this.PREPASS_ALBEDO_INDEX = -1;\r\n _this.PREPASS_DEPTHNORMAL = false;\r\n _this.PREPASS_DEPTHNORMAL_INDEX = -1;\r\n _this.PREPASS_POSITION = false;\r\n _this.PREPASS_POSITION_INDEX = -1;\r\n _this.PREPASS_VELOCITY = false;\r\n _this.PREPASS_VELOCITY_INDEX = -1;\r\n _this.PREPASS_REFLECTIVITY = false;\r\n _this.PREPASS_REFLECTIVITY_INDEX = -1;\r\n _this.SCENE_MRT_COUNT = 0;\r\n _this.NUM_BONE_INFLUENCERS = 0;\r\n _this.BonesPerMesh = 0;\r\n _this.BONETEXTURE = false;\r\n _this.BONES_VELOCITY_ENABLED = false;\r\n _this.NONUNIFORMSCALING = false;\r\n _this.MORPHTARGETS = false;\r\n _this.MORPHTARGETS_NORMAL = false;\r\n _this.MORPHTARGETS_TANGENT = false;\r\n _this.MORPHTARGETS_UV = false;\r\n _this.NUM_MORPH_INFLUENCERS = 0;\r\n _this.IMAGEPROCESSING = false;\r\n _this.VIGNETTE = false;\r\n _this.VIGNETTEBLENDMODEMULTIPLY = false;\r\n _this.VIGNETTEBLENDMODEOPAQUE = false;\r\n _this.TONEMAPPING = false;\r\n _this.TONEMAPPING_ACES = false;\r\n _this.CONTRAST = false;\r\n _this.COLORCURVES = false;\r\n _this.COLORGRADING = false;\r\n _this.COLORGRADING3D = false;\r\n _this.SAMPLER3DGREENDEPTH = false;\r\n _this.SAMPLER3DBGRMAP = false;\r\n _this.IMAGEPROCESSINGPOSTPROCESS = false;\r\n _this.EXPOSURE = false;\r\n _this.MULTIVIEW = false;\r\n _this.USEPHYSICALLIGHTFALLOFF = false;\r\n _this.USEGLTFLIGHTFALLOFF = false;\r\n _this.TWOSIDEDLIGHTING = false;\r\n _this.SHADOWFLOAT = false;\r\n _this.CLIPPLANE = false;\r\n _this.CLIPPLANE2 = false;\r\n _this.CLIPPLANE3 = false;\r\n _this.CLIPPLANE4 = false;\r\n _this.CLIPPLANE5 = false;\r\n _this.CLIPPLANE6 = false;\r\n _this.POINTSIZE = false;\r\n _this.FOG = false;\r\n _this.LOGARITHMICDEPTH = false;\r\n _this.FORCENORMALFORWARD = false;\r\n _this.SPECULARAA = false;\r\n _this.CLEARCOAT = false;\r\n _this.CLEARCOAT_DEFAULTIOR = false;\r\n _this.CLEARCOAT_TEXTURE = false;\r\n _this.CLEARCOAT_TEXTURE_ROUGHNESS = false;\r\n _this.CLEARCOAT_TEXTUREDIRECTUV = 0;\r\n _this.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV = 0;\r\n _this.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\r\n _this.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL = false;\r\n _this.CLEARCOAT_BUMP = false;\r\n _this.CLEARCOAT_BUMPDIRECTUV = 0;\r\n _this.CLEARCOAT_REMAP_F0 = true;\r\n _this.CLEARCOAT_TINT = false;\r\n _this.CLEARCOAT_TINT_TEXTURE = false;\r\n _this.CLEARCOAT_TINT_TEXTUREDIRECTUV = 0;\r\n _this.ANISOTROPIC = false;\r\n _this.ANISOTROPIC_TEXTURE = false;\r\n _this.ANISOTROPIC_TEXTUREDIRECTUV = 0;\r\n _this.BRDF_V_HEIGHT_CORRELATED = false;\r\n _this.MS_BRDF_ENERGY_CONSERVATION = false;\r\n _this.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION = false;\r\n _this.SHEEN = false;\r\n _this.SHEEN_TEXTURE = false;\r\n _this.SHEEN_TEXTURE_ROUGHNESS = false;\r\n _this.SHEEN_TEXTUREDIRECTUV = 0;\r\n _this.SHEEN_TEXTURE_ROUGHNESSDIRECTUV = 0;\r\n _this.SHEEN_LINKWITHALBEDO = false;\r\n _this.SHEEN_ROUGHNESS = false;\r\n _this.SHEEN_ALBEDOSCALING = false;\r\n _this.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\r\n _this.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL = false;\r\n _this.SUBSURFACE = false;\r\n _this.SS_REFRACTION = false;\r\n _this.SS_TRANSLUCENCY = false;\r\n _this.SS_SCATTERING = false;\r\n _this.SS_THICKNESSANDMASK_TEXTURE = false;\r\n _this.SS_THICKNESSANDMASK_TEXTUREDIRECTUV = 0;\r\n _this.SS_REFRACTIONMAP_3D = false;\r\n _this.SS_REFRACTIONMAP_OPPOSITEZ = false;\r\n _this.SS_LODINREFRACTIONALPHA = false;\r\n _this.SS_GAMMAREFRACTION = false;\r\n _this.SS_RGBDREFRACTION = false;\r\n _this.SS_LINEARSPECULARREFRACTION = false;\r\n _this.SS_LINKREFRACTIONTOTRANSPARENCY = false;\r\n _this.SS_ALBEDOFORREFRACTIONTINT = false;\r\n _this.SS_MASK_FROM_THICKNESS_TEXTURE = false;\r\n _this.SS_MASK_FROM_THICKNESS_TEXTURE_GLTF = false;\r\n _this.UNLIT = false;\r\n _this.DEBUGMODE = 0;\r\n _this.rebuild();\r\n return _this;\r\n }\r\n /**\r\n * Resets the PBR Material defines.\r\n */\r\n PBRMaterialDefines.prototype.reset = function () {\r\n _super.prototype.reset.call(this);\r\n this.ALPHATESTVALUE = \"0.5\";\r\n this.PBR = true;\r\n };\r\n return PBRMaterialDefines;\r\n}(MaterialDefines));\r\nexport { PBRMaterialDefines };\r\n/**\r\n * The Physically based material base class of BJS.\r\n *\r\n * This offers the main features of a standard PBR material.\r\n * For more information, please refer to the documentation :\r\n * https://doc.babylonjs.com/how_to/physically_based_rendering\r\n */\r\nvar PBRBaseMaterial = /** @class */ (function (_super) {\r\n __extends(PBRBaseMaterial, _super);\r\n /**\r\n * Instantiates a new PBRMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n function PBRBaseMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Intensity of the direct lights e.g. the four lights available in your scene.\r\n * This impacts both the direct diffuse and specular highlights.\r\n */\r\n _this._directIntensity = 1.0;\r\n /**\r\n * Intensity of the emissive part of the material.\r\n * This helps controlling the emissive effect without modifying the emissive color.\r\n */\r\n _this._emissiveIntensity = 1.0;\r\n /**\r\n * Intensity of the environment e.g. how much the environment will light the object\r\n * either through harmonics for rough material or through the refelction for shiny ones.\r\n */\r\n _this._environmentIntensity = 1.0;\r\n /**\r\n * This is a special control allowing the reduction of the specular highlights coming from the\r\n * four lights of the scene. Those highlights may not be needed in full environment lighting.\r\n */\r\n _this._specularIntensity = 1.0;\r\n /**\r\n * This stores the direct, emissive, environment, and specular light intensities into a Vector4.\r\n */\r\n _this._lightingInfos = new Vector4(_this._directIntensity, _this._emissiveIntensity, _this._environmentIntensity, _this._specularIntensity);\r\n /**\r\n * Debug Control allowing disabling the bump map on this material.\r\n */\r\n _this._disableBumpMap = false;\r\n /**\r\n * AKA Diffuse Texture in standard nomenclature.\r\n */\r\n _this._albedoTexture = null;\r\n /**\r\n * AKA Occlusion Texture in other nomenclature.\r\n */\r\n _this._ambientTexture = null;\r\n /**\r\n * AKA Occlusion Texture Intensity in other nomenclature.\r\n */\r\n _this._ambientTextureStrength = 1.0;\r\n /**\r\n * Defines how much the AO map is occluding the analytical lights (point spot...).\r\n * 1 means it completely occludes it\r\n * 0 mean it has no impact\r\n */\r\n _this._ambientTextureImpactOnAnalyticalLights = PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n /**\r\n * Stores the alpha values in a texture.\r\n */\r\n _this._opacityTexture = null;\r\n /**\r\n * Stores the reflection values in a texture.\r\n */\r\n _this._reflectionTexture = null;\r\n /**\r\n * Stores the emissive values in a texture.\r\n */\r\n _this._emissiveTexture = null;\r\n /**\r\n * AKA Specular texture in other nomenclature.\r\n */\r\n _this._reflectivityTexture = null;\r\n /**\r\n * Used to switch from specular/glossiness to metallic/roughness workflow.\r\n */\r\n _this._metallicTexture = null;\r\n /**\r\n * Specifies the metallic scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the metalness values of the metallic texture.\r\n */\r\n _this._metallic = null;\r\n /**\r\n * Specifies the roughness scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the roughness values of the metallic texture.\r\n */\r\n _this._roughness = null;\r\n /**\r\n * In metallic workflow, specifies an F0 factor to help configuring the material F0.\r\n * By default the indexOfrefraction is used to compute F0;\r\n *\r\n * This is used as a factor against the default reflectance at normal incidence to tweak it.\r\n *\r\n * F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor;\r\n * F90 = metallicReflectanceColor;\r\n */\r\n _this._metallicF0Factor = 1;\r\n /**\r\n * In metallic workflow, specifies an F90 color to help configuring the material F90.\r\n * By default the F90 is always 1;\r\n *\r\n * Please note that this factor is also used as a factor against the default reflectance at normal incidence.\r\n *\r\n * F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor\r\n * F90 = metallicReflectanceColor;\r\n */\r\n _this._metallicReflectanceColor = Color3.White();\r\n /**\r\n * Defines to store metallicReflectanceColor in RGB and metallicF0Factor in A\r\n * This is multiply against the scalar values defined in the material.\r\n */\r\n _this._metallicReflectanceTexture = null;\r\n /**\r\n * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.\r\n * Gray Scale represents roughness in metallic mode and glossiness in specular mode.\r\n */\r\n _this._microSurfaceTexture = null;\r\n /**\r\n * Stores surface normal data used to displace a mesh in a texture.\r\n */\r\n _this._bumpTexture = null;\r\n /**\r\n * Stores the pre-calculated light information of a mesh in a texture.\r\n */\r\n _this._lightmapTexture = null;\r\n /**\r\n * The color of a material in ambient lighting.\r\n */\r\n _this._ambientColor = new Color3(0, 0, 0);\r\n /**\r\n * AKA Diffuse Color in other nomenclature.\r\n */\r\n _this._albedoColor = new Color3(1, 1, 1);\r\n /**\r\n * AKA Specular Color in other nomenclature.\r\n */\r\n _this._reflectivityColor = new Color3(1, 1, 1);\r\n /**\r\n * The color applied when light is reflected from a material.\r\n */\r\n _this._reflectionColor = new Color3(1, 1, 1);\r\n /**\r\n * The color applied when light is emitted from a material.\r\n */\r\n _this._emissiveColor = new Color3(0, 0, 0);\r\n /**\r\n * AKA Glossiness in other nomenclature.\r\n */\r\n _this._microSurface = 0.9;\r\n /**\r\n * Specifies that the material will use the light map as a show map.\r\n */\r\n _this._useLightmapAsShadowmap = false;\r\n /**\r\n * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal\r\n * makes the reflect vector face the model (under horizon).\r\n */\r\n _this._useHorizonOcclusion = true;\r\n /**\r\n * This parameters will enable/disable radiance occlusion by preventing the radiance to lit\r\n * too much the area relying on ambient texture to define their ambient occlusion.\r\n */\r\n _this._useRadianceOcclusion = true;\r\n /**\r\n * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.\r\n */\r\n _this._useAlphaFromAlbedoTexture = false;\r\n /**\r\n * Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.\r\n */\r\n _this._useSpecularOverAlpha = true;\r\n /**\r\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\r\n */\r\n _this._useMicroSurfaceFromReflectivityMapAlpha = false;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its alpha channel.\r\n */\r\n _this._useRoughnessFromMetallicTextureAlpha = true;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its green channel.\r\n */\r\n _this._useRoughnessFromMetallicTextureGreen = false;\r\n /**\r\n * Specifies if the metallic texture contains the metallness information in its blue channel.\r\n */\r\n _this._useMetallnessFromMetallicTextureBlue = false;\r\n /**\r\n * Specifies if the metallic texture contains the ambient occlusion information in its red channel.\r\n */\r\n _this._useAmbientOcclusionFromMetallicTextureRed = false;\r\n /**\r\n * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.\r\n */\r\n _this._useAmbientInGrayScale = false;\r\n /**\r\n * In case the reflectivity map does not contain the microsurface information in its alpha channel,\r\n * The material will try to infer what glossiness each pixel should be.\r\n */\r\n _this._useAutoMicroSurfaceFromReflectivityMap = false;\r\n /**\r\n * Defines the falloff type used in this material.\r\n * It by default is Physical.\r\n */\r\n _this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n /**\r\n * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.\r\n */\r\n _this._useRadianceOverAlpha = true;\r\n /**\r\n * Allows using an object space normal map (instead of tangent space).\r\n */\r\n _this._useObjectSpaceNormalMap = false;\r\n /**\r\n * Allows using the bump map in parallax mode.\r\n */\r\n _this._useParallax = false;\r\n /**\r\n * Allows using the bump map in parallax occlusion mode.\r\n */\r\n _this._useParallaxOcclusion = false;\r\n /**\r\n * Controls the scale bias of the parallax mode.\r\n */\r\n _this._parallaxScaleBias = 0.05;\r\n /**\r\n * If sets to true, disables all the lights affecting the material.\r\n */\r\n _this._disableLighting = false;\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n _this._maxSimultaneousLights = 4;\r\n /**\r\n * If sets to true, x component of normal map value will be inverted (x = 1.0 - x).\r\n */\r\n _this._invertNormalMapX = false;\r\n /**\r\n * If sets to true, y component of normal map value will be inverted (y = 1.0 - y).\r\n */\r\n _this._invertNormalMapY = false;\r\n /**\r\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\r\n */\r\n _this._twoSidedLighting = false;\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n _this._alphaCutOff = 0.4;\r\n /**\r\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\r\n */\r\n _this._forceAlphaTest = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)\r\n */\r\n _this._useAlphaFresnel = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)\r\n */\r\n _this._useLinearAlphaFresnel = false;\r\n /**\r\n * Specifies the environment BRDF texture used to comput the scale and offset roughness values\r\n * from cos thetav and roughness:\r\n * http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf\r\n */\r\n _this._environmentBRDFTexture = null;\r\n /**\r\n * Force the shader to compute irradiance in the fragment shader in order to take bump in account.\r\n */\r\n _this._forceIrradianceInFragment = false;\r\n _this._realTimeFiltering = false;\r\n _this._realTimeFilteringQuality = 8;\r\n /**\r\n * Force normal to face away from face.\r\n */\r\n _this._forceNormalForward = false;\r\n /**\r\n * Enables specular anti aliasing in the PBR shader.\r\n * It will both interacts on the Geometry for analytical and IBL lighting.\r\n * It also prefilter the roughness map based on the bump values.\r\n */\r\n _this._enableSpecularAntiAliasing = false;\r\n /**\r\n * Keep track of the image processing observer to allow dispose and replace.\r\n */\r\n _this._imageProcessingObserver = null;\r\n /**\r\n * Stores the available render targets.\r\n */\r\n _this._renderTargets = new SmartArray(16);\r\n /**\r\n * Sets the global ambient color for the material used in lighting calculations.\r\n */\r\n _this._globalAmbientColor = new Color3(0, 0, 0);\r\n /**\r\n * Enables the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n _this._useLogarithmicDepth = false;\r\n /**\r\n * If set to true, no lighting calculations will be applied.\r\n */\r\n _this._unlit = false;\r\n _this._debugMode = 0;\r\n /**\r\n * @hidden\r\n * This is reserved for the inspector.\r\n * Defines the material debug mode.\r\n * It helps seeing only some components of the material while troubleshooting.\r\n */\r\n _this.debugMode = 0;\r\n /**\r\n * @hidden\r\n * This is reserved for the inspector.\r\n * Specify from where on screen the debug mode should start.\r\n * The value goes from -1 (full screen) to 1 (not visible)\r\n * It helps with side by side comparison against the final render\r\n * This defaults to -1\r\n */\r\n _this.debugLimit = -1;\r\n /**\r\n * @hidden\r\n * This is reserved for the inspector.\r\n * As the default viewing range might not be enough (if the ambient is really small for instance)\r\n * You can use the factor to better multiply the final value.\r\n */\r\n _this.debugFactor = 1;\r\n /**\r\n * Defines the clear coat layer parameters for the material.\r\n */\r\n _this.clearCoat = new PBRClearCoatConfiguration(_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n /**\r\n * Defines the anisotropic parameters for the material.\r\n */\r\n _this.anisotropy = new PBRAnisotropicConfiguration(_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n /**\r\n * Defines the BRDF parameters for the material.\r\n */\r\n _this.brdf = new PBRBRDFConfiguration(_this._markAllSubMeshesAsMiscDirty.bind(_this));\r\n /**\r\n * Defines the Sheen parameters for the material.\r\n */\r\n _this.sheen = new PBRSheenConfiguration(_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n /**\r\n * Defines the detail map parameters for the material.\r\n */\r\n _this.detailMap = new DetailMapConfiguration(_this._markAllSubMeshesAsTexturesDirty.bind(_this));\r\n _this._rebuildInParallel = false;\r\n // Setup the default processing configuration to the scene.\r\n _this._attachImageProcessingConfiguration(null);\r\n _this.getRenderTargetTextures = function () {\r\n _this._renderTargets.reset();\r\n if (MaterialFlags.ReflectionTextureEnabled && _this._reflectionTexture && _this._reflectionTexture.isRenderTarget) {\r\n _this._renderTargets.push(_this._reflectionTexture);\r\n }\r\n _this.subSurface.fillRenderTargetTextures(_this._renderTargets);\r\n return _this._renderTargets;\r\n };\r\n _this._environmentBRDFTexture = BRDFTextureTools.GetEnvironmentBRDFTexture(scene);\r\n _this.subSurface = new PBRSubSurfaceConfiguration(_this._markAllSubMeshesAsTexturesDirty.bind(_this), _this._markScenePrePassDirty.bind(_this), scene);\r\n _this.prePassConfiguration = new PrePassConfiguration();\r\n return _this;\r\n }\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"realTimeFiltering\", {\r\n /**\r\n * Enables realtime filtering on the texture.\r\n */\r\n get: function () {\r\n return this._realTimeFiltering;\r\n },\r\n set: function (b) {\r\n this._realTimeFiltering = b;\r\n this.markAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"realTimeFilteringQuality\", {\r\n /**\r\n * Quality switch for realtime filtering\r\n */\r\n get: function () {\r\n return this._realTimeFilteringQuality;\r\n },\r\n set: function (n) {\r\n this._realTimeFilteringQuality = n;\r\n this.markAsDirty(1);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"canRenderToMRT\", {\r\n /**\r\n * Can this material render to several textures at once\r\n */\r\n get: function () {\r\n return true;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Attaches a new image processing configuration to the PBR Material.\r\n * @param configuration\r\n */\r\n PBRBaseMaterial.prototype._attachImageProcessingConfiguration = function (configuration) {\r\n var _this = this;\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n // Detaches observer.\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n // Pick the scene configuration if needed.\r\n if (!configuration) {\r\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\r\n }\r\n else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n // Attaches observer.\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(function () {\r\n _this._markAllSubMeshesAsImageProcessingDirty();\r\n });\r\n }\r\n };\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"hasRenderTargetTextures\", {\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n get: function () {\r\n if (MaterialFlags.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n return true;\r\n }\r\n return this.subSurface.hasRenderTargetTextures();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the name of the material class.\r\n */\r\n PBRBaseMaterial.prototype.getClassName = function () {\r\n return \"PBRBaseMaterial\";\r\n };\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"useLogarithmicDepth\", {\r\n /**\r\n * Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n get: function () {\r\n return this._useLogarithmicDepth;\r\n },\r\n /**\r\n * Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n set: function (value) {\r\n this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRBaseMaterial.prototype, \"_disableAlphaBlending\", {\r\n /**\r\n * Returns true if alpha blending should be disabled.\r\n */\r\n get: function () {\r\n return (this.subSurface.disableAlphaBlending ||\r\n this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_OPAQUE ||\r\n this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_ALPHATEST);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha blend mode.\r\n */\r\n PBRBaseMaterial.prototype.needAlphaBlending = function () {\r\n if (this._disableAlphaBlending) {\r\n return false;\r\n }\r\n return (this.alpha < 1.0) || (this._opacityTexture != null) || this._shouldUseAlphaFromAlbedoTexture();\r\n };\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha test mode.\r\n */\r\n PBRBaseMaterial.prototype.needAlphaTesting = function () {\r\n if (this._forceAlphaTest) {\r\n return true;\r\n }\r\n if (this.subSurface.disableAlphaBlending) {\r\n return false;\r\n }\r\n return this._hasAlphaChannel() && (this._transparencyMode == null || this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_ALPHATEST);\r\n };\r\n /**\r\n * Specifies whether or not the alpha value of the albedo texture should be used for alpha blending.\r\n */\r\n PBRBaseMaterial.prototype._shouldUseAlphaFromAlbedoTexture = function () {\r\n return this._albedoTexture != null && this._albedoTexture.hasAlpha && this._useAlphaFromAlbedoTexture && this._transparencyMode !== PBRBaseMaterial.PBRMATERIAL_OPAQUE;\r\n };\r\n /**\r\n * Specifies whether or not there is a usable alpha channel for transparency.\r\n */\r\n PBRBaseMaterial.prototype._hasAlphaChannel = function () {\r\n return (this._albedoTexture != null && this._albedoTexture.hasAlpha) || this._opacityTexture != null;\r\n };\r\n /**\r\n * Gets the texture used for the alpha test.\r\n */\r\n PBRBaseMaterial.prototype.getAlphaTestTexture = function () {\r\n return this._albedoTexture;\r\n };\r\n /**\r\n * Specifies that the submesh is ready to be used.\r\n * @param mesh - BJS mesh.\r\n * @param subMesh - A submesh of the BJS mesh. Used to check if it is ready.\r\n * @param useInstances - Specifies that instances should be used.\r\n * @returns - boolean indicating that the submesh is ready or not.\r\n */\r\n PBRBaseMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {\r\n if (subMesh.effect && this.isFrozen) {\r\n if (subMesh.effect._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n if (!subMesh._materialDefines) {\r\n subMesh._materialDefines = new PBRMaterialDefines();\r\n }\r\n var defines = subMesh._materialDefines;\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this._albedoTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) {\r\n if (!this._ambientTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n if (!this._opacityTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n var reflectionTexture = this._getReflectionTexture();\r\n if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {\r\n if (!reflectionTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n if (reflectionTexture.irradianceTexture && !reflectionTexture.irradianceTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._lightmapTexture && MaterialFlags.LightmapTextureEnabled) {\r\n if (!this._lightmapTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._emissiveTexture && MaterialFlags.EmissiveTextureEnabled) {\r\n if (!this._emissiveTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (MaterialFlags.SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n if (!this._metallicTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n else if (this._reflectivityTexture) {\r\n if (!this._reflectivityTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._metallicReflectanceTexture) {\r\n if (!this._metallicReflectanceTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n if (this._microSurfaceTexture) {\r\n if (!this._microSurfaceTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n if (engine.getCaps().standardDerivatives && this._bumpTexture && MaterialFlags.BumpTextureEnabled && !this._disableBumpMap) {\r\n // Bump texture cannot be not blocking.\r\n if (!this._bumpTexture.isReady()) {\r\n return false;\r\n }\r\n }\r\n if (this._environmentBRDFTexture && MaterialFlags.ReflectionTextureEnabled) {\r\n // This is blocking.\r\n if (!this._environmentBRDFTexture.isReady()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n if (!this.subSurface.isReadyForSubMesh(defines, scene) ||\r\n !this.clearCoat.isReadyForSubMesh(defines, scene, engine, this._disableBumpMap) ||\r\n !this.sheen.isReadyForSubMesh(defines, scene) ||\r\n !this.anisotropy.isReadyForSubMesh(defines, scene) ||\r\n !this.detailMap.isReadyForSubMesh(defines, scene)) {\r\n return false;\r\n }\r\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\r\n if (!this._imageProcessingConfiguration.isReady()) {\r\n return false;\r\n }\r\n }\r\n if (!engine.getCaps().standardDerivatives && !mesh.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n mesh.createNormals(true);\r\n Logger.Warn(\"PBRMaterial: Normals have been created for the mesh: \" + mesh.name);\r\n }\r\n var previousEffect = subMesh.effect;\r\n var lightDisposed = defines._areLightsDisposed;\r\n var effect = this._prepareEffect(mesh, defines, this.onCompiled, this.onError, useInstances, null, subMesh.getRenderingMesh().hasThinInstances);\r\n if (effect) {\r\n if (this._onEffectCreatedObservable) {\r\n onCreatedEffectParameters.effect = effect;\r\n onCreatedEffectParameters.subMesh = subMesh;\r\n this._onEffectCreatedObservable.notifyObservers(onCreatedEffectParameters);\r\n }\r\n // Use previous effect while new one is compiling\r\n if (this.allowShaderHotSwapping && previousEffect && !effect.isReady()) {\r\n effect = previousEffect;\r\n this._rebuildInParallel = true;\r\n defines.markAsUnprocessed();\r\n if (lightDisposed) {\r\n // re register in case it takes more than one frame.\r\n defines._areLightsDisposed = true;\r\n return false;\r\n }\r\n }\r\n else {\r\n this._rebuildInParallel = false;\r\n scene.resetCachedMaterial();\r\n subMesh.setEffect(effect, defines);\r\n this.buildUniformLayout();\r\n }\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n defines._renderId = scene.getRenderId();\r\n subMesh.effect._wasPreviouslyReady = true;\r\n return true;\r\n };\r\n /**\r\n * Specifies if the material uses metallic roughness workflow.\r\n * @returns boolean specifiying if the material uses metallic roughness workflow.\r\n */\r\n PBRBaseMaterial.prototype.isMetallicWorkflow = function () {\r\n if (this._metallic != null || this._roughness != null || this._metallicTexture) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n PBRBaseMaterial.prototype._prepareEffect = function (mesh, defines, onCompiled, onError, useInstances, useClipPlane, useThinInstances) {\r\n if (onCompiled === void 0) { onCompiled = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (useInstances === void 0) { useInstances = null; }\r\n if (useClipPlane === void 0) { useClipPlane = null; }\r\n this._prepareDefines(mesh, defines, useInstances, useClipPlane, useThinInstances);\r\n if (!defines.isDirty) {\r\n return null;\r\n }\r\n defines.markAsProcessed();\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n // Fallbacks\r\n var fallbacks = new EffectFallbacks();\r\n var fallbackRank = 0;\r\n if (defines.USESPHERICALINVERTEX) {\r\n fallbacks.addFallback(fallbackRank++, \"USESPHERICALINVERTEX\");\r\n }\r\n if (defines.FOG) {\r\n fallbacks.addFallback(fallbackRank, \"FOG\");\r\n }\r\n if (defines.SPECULARAA) {\r\n fallbacks.addFallback(fallbackRank, \"SPECULARAA\");\r\n }\r\n if (defines.POINTSIZE) {\r\n fallbacks.addFallback(fallbackRank, \"POINTSIZE\");\r\n }\r\n if (defines.LOGARITHMICDEPTH) {\r\n fallbacks.addFallback(fallbackRank, \"LOGARITHMICDEPTH\");\r\n }\r\n if (defines.PARALLAX) {\r\n fallbacks.addFallback(fallbackRank, \"PARALLAX\");\r\n }\r\n if (defines.PARALLAXOCCLUSION) {\r\n fallbacks.addFallback(fallbackRank++, \"PARALLAXOCCLUSION\");\r\n }\r\n fallbackRank = PBRAnisotropicConfiguration.AddFallbacks(defines, fallbacks, fallbackRank);\r\n fallbackRank = PBRAnisotropicConfiguration.AddFallbacks(defines, fallbacks, fallbackRank);\r\n fallbackRank = PBRSubSurfaceConfiguration.AddFallbacks(defines, fallbacks, fallbackRank);\r\n fallbackRank = PBRSheenConfiguration.AddFallbacks(defines, fallbacks, fallbackRank);\r\n if (defines.ENVIRONMENTBRDF) {\r\n fallbacks.addFallback(fallbackRank++, \"ENVIRONMENTBRDF\");\r\n }\r\n if (defines.TANGENT) {\r\n fallbacks.addFallback(fallbackRank++, \"TANGENT\");\r\n }\r\n if (defines.BUMP) {\r\n fallbacks.addFallback(fallbackRank++, \"BUMP\");\r\n }\r\n fallbackRank = MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this._maxSimultaneousLights, fallbackRank++);\r\n if (defines.SPECULARTERM) {\r\n fallbacks.addFallback(fallbackRank++, \"SPECULARTERM\");\r\n }\r\n if (defines.USESPHERICALFROMREFLECTIONMAP) {\r\n fallbacks.addFallback(fallbackRank++, \"USESPHERICALFROMREFLECTIONMAP\");\r\n }\r\n if (defines.USEIRRADIANCEMAP) {\r\n fallbacks.addFallback(fallbackRank++, \"USEIRRADIANCEMAP\");\r\n }\r\n if (defines.LIGHTMAP) {\r\n fallbacks.addFallback(fallbackRank++, \"LIGHTMAP\");\r\n }\r\n if (defines.NORMAL) {\r\n fallbacks.addFallback(fallbackRank++, \"NORMAL\");\r\n }\r\n if (defines.AMBIENT) {\r\n fallbacks.addFallback(fallbackRank++, \"AMBIENT\");\r\n }\r\n if (defines.EMISSIVE) {\r\n fallbacks.addFallback(fallbackRank++, \"EMISSIVE\");\r\n }\r\n if (defines.VERTEXCOLOR) {\r\n fallbacks.addFallback(fallbackRank++, \"VERTEXCOLOR\");\r\n }\r\n if (defines.MORPHTARGETS) {\r\n fallbacks.addFallback(fallbackRank++, \"MORPHTARGETS\");\r\n }\r\n if (defines.MULTIVIEW) {\r\n fallbacks.addFallback(0, \"MULTIVIEW\");\r\n }\r\n //Attributes\r\n var attribs = [VertexBuffer.PositionKind];\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n if (defines.TANGENT) {\r\n attribs.push(VertexBuffer.TangentKind);\r\n }\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\r\n MaterialHelper.PrepareAttributesForMorphTargets(attribs, mesh, defines);\r\n var shaderName = \"pbr\";\r\n var uniforms = [\"world\", \"view\", \"viewProjection\", \"vEyePosition\", \"vLightsType\", \"vAmbientColor\", \"vAlbedoColor\", \"vReflectivityColor\", \"vMetallicReflectanceFactors\", \"vEmissiveColor\", \"visibility\", \"vReflectionColor\",\r\n \"vFogInfos\", \"vFogColor\", \"pointSize\",\r\n \"vAlbedoInfos\", \"vAmbientInfos\", \"vOpacityInfos\", \"vReflectionInfos\", \"vReflectionPosition\", \"vReflectionSize\", \"vEmissiveInfos\", \"vReflectivityInfos\", \"vReflectionFilteringInfo\", \"vMetallicReflectanceInfos\",\r\n \"vMicroSurfaceSamplerInfos\", \"vBumpInfos\", \"vLightmapInfos\",\r\n \"mBones\",\r\n \"vClipPlane\", \"vClipPlane2\", \"vClipPlane3\", \"vClipPlane4\", \"vClipPlane5\", \"vClipPlane6\", \"albedoMatrix\", \"ambientMatrix\", \"opacityMatrix\", \"reflectionMatrix\", \"emissiveMatrix\", \"reflectivityMatrix\", \"normalMatrix\", \"microSurfaceSamplerMatrix\", \"bumpMatrix\", \"lightmapMatrix\", \"metallicReflectanceMatrix\",\r\n \"vLightingIntensity\",\r\n \"logarithmicDepthConstant\",\r\n \"vSphericalX\", \"vSphericalY\", \"vSphericalZ\",\r\n \"vSphericalXX_ZZ\", \"vSphericalYY_ZZ\", \"vSphericalZZ\",\r\n \"vSphericalXY\", \"vSphericalYZ\", \"vSphericalZX\",\r\n \"vSphericalL00\",\r\n \"vSphericalL1_1\", \"vSphericalL10\", \"vSphericalL11\",\r\n \"vSphericalL2_2\", \"vSphericalL2_1\", \"vSphericalL20\", \"vSphericalL21\", \"vSphericalL22\",\r\n \"vReflectionMicrosurfaceInfos\",\r\n \"vTangentSpaceParams\", \"boneTextureWidth\",\r\n \"vDebugMode\"\r\n ];\r\n var samplers = [\"albedoSampler\", \"reflectivitySampler\", \"ambientSampler\", \"emissiveSampler\",\r\n \"bumpSampler\", \"lightmapSampler\", \"opacitySampler\",\r\n \"reflectionSampler\", \"reflectionSamplerLow\", \"reflectionSamplerHigh\", \"irradianceSampler\",\r\n \"microSurfaceSampler\", \"environmentBrdfSampler\", \"boneSampler\", \"metallicReflectanceSampler\"];\r\n var uniformBuffers = [\"Material\", \"Scene\"];\r\n DetailMapConfiguration.AddUniforms(uniforms);\r\n DetailMapConfiguration.AddSamplers(samplers);\r\n PBRSubSurfaceConfiguration.AddUniforms(uniforms);\r\n PBRSubSurfaceConfiguration.AddSamplers(samplers);\r\n PBRClearCoatConfiguration.AddUniforms(uniforms);\r\n PBRClearCoatConfiguration.AddSamplers(samplers);\r\n PBRAnisotropicConfiguration.AddUniforms(uniforms);\r\n PBRAnisotropicConfiguration.AddSamplers(samplers);\r\n PBRSheenConfiguration.AddUniforms(uniforms);\r\n PBRSheenConfiguration.AddSamplers(samplers);\r\n PrePassConfiguration.AddUniforms(uniforms);\r\n PrePassConfiguration.AddSamplers(uniforms);\r\n if (ImageProcessingConfiguration) {\r\n ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);\r\n ImageProcessingConfiguration.PrepareSamplers(samplers, defines);\r\n }\r\n MaterialHelper.PrepareUniformsAndSamplersList({\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: this._maxSimultaneousLights\r\n });\r\n var csnrOptions = {};\r\n if (this.customShaderNameResolve) {\r\n shaderName = this.customShaderNameResolve(shaderName, uniforms, uniformBuffers, samplers, defines, attribs, csnrOptions);\r\n }\r\n var join = defines.toString();\r\n return engine.createEffect(shaderName, {\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: onCompiled,\r\n onError: onError,\r\n indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: defines.NUM_MORPH_INFLUENCERS },\r\n processFinalCode: csnrOptions.processFinalCode,\r\n multiTarget: defines.PREPASS\r\n }, engine);\r\n };\r\n PBRBaseMaterial.prototype._prepareDefines = function (mesh, defines, useInstances, useClipPlane, useThinInstances) {\r\n if (useInstances === void 0) { useInstances = null; }\r\n if (useClipPlane === void 0) { useClipPlane = null; }\r\n if (useThinInstances === void 0) { useThinInstances = false; }\r\n var scene = this.getScene();\r\n var engine = scene.getEngine();\r\n // Lights\r\n MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);\r\n defines._needNormals = true;\r\n // Multiview\r\n MaterialHelper.PrepareDefinesForMultiview(scene, defines);\r\n // PrePass\r\n MaterialHelper.PrepareDefinesForPrePass(scene, defines, this.canRenderToMRT);\r\n // Textures\r\n defines.METALLICWORKFLOW = this.isMetallicWorkflow();\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (scene.getEngine().getCaps().textureLOD) {\r\n defines.LODBASEDMICROSFURACE = true;\r\n }\r\n if (this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._albedoTexture, defines, \"ALBEDO\");\r\n defines.GAMMAALBEDO = this._albedoTexture.gammaSpace;\r\n }\r\n else {\r\n defines.ALBEDO = false;\r\n }\r\n if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._ambientTexture, defines, \"AMBIENT\");\r\n defines.AMBIENTINGRAYSCALE = this._useAmbientInGrayScale;\r\n }\r\n else {\r\n defines.AMBIENT = false;\r\n }\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._opacityTexture, defines, \"OPACITY\");\r\n defines.OPACITYRGB = this._opacityTexture.getAlphaFromRGB;\r\n }\r\n else {\r\n defines.OPACITY = false;\r\n }\r\n var reflectionTexture = this._getReflectionTexture();\r\n if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {\r\n defines.REFLECTION = true;\r\n defines.GAMMAREFLECTION = reflectionTexture.gammaSpace;\r\n defines.RGBDREFLECTION = reflectionTexture.isRGBD;\r\n defines.REFLECTIONMAP_OPPOSITEZ = this.getScene().useRightHandedSystem ? !reflectionTexture.invertZ : reflectionTexture.invertZ;\r\n defines.LODINREFLECTIONALPHA = reflectionTexture.lodLevelInAlpha;\r\n defines.LINEARSPECULARREFLECTION = reflectionTexture.linearSpecularLOD;\r\n if (this.realTimeFiltering && this.realTimeFilteringQuality > 0) {\r\n defines.NUM_SAMPLES = \"\" + this.realTimeFilteringQuality;\r\n if (engine.webGLVersion > 1) {\r\n defines.NUM_SAMPLES = defines.NUM_SAMPLES + \"u\";\r\n }\r\n defines.REALTIME_FILTERING = true;\r\n }\r\n else {\r\n defines.REALTIME_FILTERING = false;\r\n }\r\n if (reflectionTexture.coordinatesMode === Texture.INVCUBIC_MODE) {\r\n defines.INVERTCUBICMAP = true;\r\n }\r\n defines.REFLECTIONMAP_3D = reflectionTexture.isCube;\r\n defines.REFLECTIONMAP_CUBIC = false;\r\n defines.REFLECTIONMAP_EXPLICIT = false;\r\n defines.REFLECTIONMAP_PLANAR = false;\r\n defines.REFLECTIONMAP_PROJECTION = false;\r\n defines.REFLECTIONMAP_SKYBOX = false;\r\n defines.REFLECTIONMAP_SPHERICAL = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n switch (reflectionTexture.coordinatesMode) {\r\n case Texture.EXPLICIT_MODE:\r\n defines.REFLECTIONMAP_EXPLICIT = true;\r\n break;\r\n case Texture.PLANAR_MODE:\r\n defines.REFLECTIONMAP_PLANAR = true;\r\n break;\r\n case Texture.PROJECTION_MODE:\r\n defines.REFLECTIONMAP_PROJECTION = true;\r\n break;\r\n case Texture.SKYBOX_MODE:\r\n defines.REFLECTIONMAP_SKYBOX = true;\r\n break;\r\n case Texture.SPHERICAL_MODE:\r\n defines.REFLECTIONMAP_SPHERICAL = true;\r\n break;\r\n case Texture.EQUIRECTANGULAR_MODE:\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = true;\r\n break;\r\n case Texture.FIXED_EQUIRECTANGULAR_MODE:\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true;\r\n break;\r\n case Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true;\r\n break;\r\n case Texture.CUBIC_MODE:\r\n case Texture.INVCUBIC_MODE:\r\n default:\r\n defines.REFLECTIONMAP_CUBIC = true;\r\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = reflectionTexture.boundingBoxSize ? true : false;\r\n break;\r\n }\r\n if (reflectionTexture.coordinatesMode !== Texture.SKYBOX_MODE) {\r\n if (reflectionTexture.irradianceTexture) {\r\n defines.USEIRRADIANCEMAP = true;\r\n defines.USESPHERICALFROMREFLECTIONMAP = false;\r\n }\r\n // Assume using spherical polynomial if the reflection texture is a cube map\r\n else if (reflectionTexture.isCube) {\r\n defines.USESPHERICALFROMREFLECTIONMAP = true;\r\n defines.USEIRRADIANCEMAP = false;\r\n if (this._forceIrradianceInFragment || this.realTimeFiltering || scene.getEngine().getCaps().maxVaryingVectors <= 8) {\r\n defines.USESPHERICALINVERTEX = false;\r\n }\r\n else {\r\n defines.USESPHERICALINVERTEX = true;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n defines.REFLECTION = false;\r\n defines.REFLECTIONMAP_3D = false;\r\n defines.REFLECTIONMAP_SPHERICAL = false;\r\n defines.REFLECTIONMAP_PLANAR = false;\r\n defines.REFLECTIONMAP_CUBIC = false;\r\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\r\n defines.REFLECTIONMAP_PROJECTION = false;\r\n defines.REFLECTIONMAP_SKYBOX = false;\r\n defines.REFLECTIONMAP_EXPLICIT = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR = false;\r\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\r\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\r\n defines.INVERTCUBICMAP = false;\r\n defines.USESPHERICALFROMREFLECTIONMAP = false;\r\n defines.USEIRRADIANCEMAP = false;\r\n defines.USESPHERICALINVERTEX = false;\r\n defines.REFLECTIONMAP_OPPOSITEZ = false;\r\n defines.LODINREFLECTIONALPHA = false;\r\n defines.GAMMAREFLECTION = false;\r\n defines.RGBDREFLECTION = false;\r\n defines.LINEARSPECULARREFLECTION = false;\r\n }\r\n if (this._lightmapTexture && MaterialFlags.LightmapTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._lightmapTexture, defines, \"LIGHTMAP\");\r\n defines.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap;\r\n defines.GAMMALIGHTMAP = this._lightmapTexture.gammaSpace;\r\n defines.RGBDLIGHTMAP = this._lightmapTexture.isRGBD;\r\n }\r\n else {\r\n defines.LIGHTMAP = false;\r\n }\r\n if (this._emissiveTexture && MaterialFlags.EmissiveTextureEnabled) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._emissiveTexture, defines, \"EMISSIVE\");\r\n }\r\n else {\r\n defines.EMISSIVE = false;\r\n }\r\n if (MaterialFlags.SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._metallicTexture, defines, \"REFLECTIVITY\");\r\n defines.ROUGHNESSSTOREINMETALMAPALPHA = this._useRoughnessFromMetallicTextureAlpha;\r\n defines.ROUGHNESSSTOREINMETALMAPGREEN = !this._useRoughnessFromMetallicTextureAlpha && this._useRoughnessFromMetallicTextureGreen;\r\n defines.METALLNESSSTOREINMETALMAPBLUE = this._useMetallnessFromMetallicTextureBlue;\r\n defines.AOSTOREINMETALMAPRED = this._useAmbientOcclusionFromMetallicTextureRed;\r\n }\r\n else if (this._reflectivityTexture) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._reflectivityTexture, defines, \"REFLECTIVITY\");\r\n defines.MICROSURFACEFROMREFLECTIVITYMAP = this._useMicroSurfaceFromReflectivityMapAlpha;\r\n defines.MICROSURFACEAUTOMATIC = this._useAutoMicroSurfaceFromReflectivityMap;\r\n }\r\n else {\r\n defines.REFLECTIVITY = false;\r\n }\r\n if (this._metallicReflectanceTexture) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._metallicReflectanceTexture, defines, \"METALLIC_REFLECTANCE\");\r\n }\r\n else {\r\n defines.METALLIC_REFLECTANCE = false;\r\n }\r\n if (this._microSurfaceTexture) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._microSurfaceTexture, defines, \"MICROSURFACEMAP\");\r\n }\r\n else {\r\n defines.MICROSURFACEMAP = false;\r\n }\r\n }\r\n else {\r\n defines.REFLECTIVITY = false;\r\n defines.MICROSURFACEMAP = false;\r\n }\r\n if (scene.getEngine().getCaps().standardDerivatives && this._bumpTexture && MaterialFlags.BumpTextureEnabled && !this._disableBumpMap) {\r\n MaterialHelper.PrepareDefinesForMergedUV(this._bumpTexture, defines, \"BUMP\");\r\n if (this._useParallax && this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n defines.PARALLAX = true;\r\n defines.PARALLAXOCCLUSION = !!this._useParallaxOcclusion;\r\n }\r\n else {\r\n defines.PARALLAX = false;\r\n }\r\n defines.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap;\r\n }\r\n else {\r\n defines.BUMP = false;\r\n }\r\n if (this._environmentBRDFTexture && MaterialFlags.ReflectionTextureEnabled) {\r\n defines.ENVIRONMENTBRDF = true;\r\n // Not actual true RGBD, only the B chanel is encoded as RGBD for sheen.\r\n defines.ENVIRONMENTBRDF_RGBD = this._environmentBRDFTexture.isRGBD;\r\n }\r\n else {\r\n defines.ENVIRONMENTBRDF = false;\r\n defines.ENVIRONMENTBRDF_RGBD = false;\r\n }\r\n if (this._shouldUseAlphaFromAlbedoTexture()) {\r\n defines.ALPHAFROMALBEDO = true;\r\n }\r\n else {\r\n defines.ALPHAFROMALBEDO = false;\r\n }\r\n }\r\n defines.SPECULAROVERALPHA = this._useSpecularOverAlpha;\r\n if (this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_STANDARD) {\r\n defines.USEPHYSICALLIGHTFALLOFF = false;\r\n defines.USEGLTFLIGHTFALLOFF = false;\r\n }\r\n else if (this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_GLTF) {\r\n defines.USEPHYSICALLIGHTFALLOFF = false;\r\n defines.USEGLTFLIGHTFALLOFF = true;\r\n }\r\n else {\r\n defines.USEPHYSICALLIGHTFALLOFF = true;\r\n defines.USEGLTFLIGHTFALLOFF = false;\r\n }\r\n defines.RADIANCEOVERALPHA = this._useRadianceOverAlpha;\r\n if (!this.backFaceCulling && this._twoSidedLighting) {\r\n defines.TWOSIDEDLIGHTING = true;\r\n }\r\n else {\r\n defines.TWOSIDEDLIGHTING = false;\r\n }\r\n defines.SPECULARAA = scene.getEngine().getCaps().standardDerivatives && this._enableSpecularAntiAliasing;\r\n }\r\n if (defines._areTexturesDirty || defines._areMiscDirty) {\r\n defines.ALPHATESTVALUE = \"\" + this._alphaCutOff + (this._alphaCutOff % 1 === 0 ? \".\" : \"\");\r\n defines.PREMULTIPLYALPHA = (this.alphaMode === 7 || this.alphaMode === 8);\r\n defines.ALPHABLEND = this.needAlphaBlendingForMesh(mesh);\r\n defines.ALPHAFRESNEL = this._useAlphaFresnel || this._useLinearAlphaFresnel;\r\n defines.LINEARALPHAFRESNEL = this._useLinearAlphaFresnel;\r\n }\r\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\r\n this._imageProcessingConfiguration.prepareDefines(defines);\r\n }\r\n defines.FORCENORMALFORWARD = this._forceNormalForward;\r\n defines.RADIANCEOCCLUSION = this._useRadianceOcclusion;\r\n defines.HORIZONOCCLUSION = this._useHorizonOcclusion;\r\n // Misc.\r\n if (defines._areMiscDirty) {\r\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh) || this._forceAlphaTest, defines);\r\n defines.UNLIT = this._unlit || ((this.pointsCloud || this.wireframe) && !mesh.isVerticesDataPresent(VertexBuffer.NormalKind));\r\n defines.DEBUGMODE = this._debugMode;\r\n }\r\n // External config\r\n this.detailMap.prepareDefines(defines, scene);\r\n this.subSurface.prepareDefines(defines, scene);\r\n this.clearCoat.prepareDefines(defines, scene);\r\n this.anisotropy.prepareDefines(defines, mesh, scene);\r\n this.brdf.prepareDefines(defines);\r\n this.sheen.prepareDefines(defines, scene);\r\n // Values that need to be evaluated on every frame\r\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false, useClipPlane, useThinInstances);\r\n // Attribs\r\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true, this._transparencyMode !== PBRBaseMaterial.PBRMATERIAL_OPAQUE);\r\n };\r\n /**\r\n * Force shader compilation\r\n */\r\n PBRBaseMaterial.prototype.forceCompilation = function (mesh, onCompiled, options) {\r\n var _this = this;\r\n var localOptions = __assign({ clipPlane: false, useInstances: false }, options);\r\n var defines = new PBRMaterialDefines();\r\n var effect = this._prepareEffect(mesh, defines, undefined, undefined, localOptions.useInstances, localOptions.clipPlane, mesh.hasThinInstances);\r\n if (this._onEffectCreatedObservable) {\r\n onCreatedEffectParameters.effect = effect;\r\n onCreatedEffectParameters.subMesh = null;\r\n this._onEffectCreatedObservable.notifyObservers(onCreatedEffectParameters);\r\n }\r\n if (effect.isReady()) {\r\n if (onCompiled) {\r\n onCompiled(this);\r\n }\r\n }\r\n else {\r\n effect.onCompileObservable.add(function () {\r\n if (onCompiled) {\r\n onCompiled(_this);\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Initializes the uniform buffer layout for the shader.\r\n */\r\n PBRBaseMaterial.prototype.buildUniformLayout = function () {\r\n // Order is important !\r\n var ubo = this._uniformBuffer;\r\n ubo.addUniform(\"vAlbedoInfos\", 2);\r\n ubo.addUniform(\"vAmbientInfos\", 4);\r\n ubo.addUniform(\"vOpacityInfos\", 2);\r\n ubo.addUniform(\"vEmissiveInfos\", 2);\r\n ubo.addUniform(\"vLightmapInfos\", 2);\r\n ubo.addUniform(\"vReflectivityInfos\", 3);\r\n ubo.addUniform(\"vMicroSurfaceSamplerInfos\", 2);\r\n ubo.addUniform(\"vReflectionInfos\", 2);\r\n ubo.addUniform(\"vReflectionFilteringInfo\", 2);\r\n ubo.addUniform(\"vReflectionPosition\", 3);\r\n ubo.addUniform(\"vReflectionSize\", 3);\r\n ubo.addUniform(\"vBumpInfos\", 3);\r\n ubo.addUniform(\"albedoMatrix\", 16);\r\n ubo.addUniform(\"ambientMatrix\", 16);\r\n ubo.addUniform(\"opacityMatrix\", 16);\r\n ubo.addUniform(\"emissiveMatrix\", 16);\r\n ubo.addUniform(\"lightmapMatrix\", 16);\r\n ubo.addUniform(\"reflectivityMatrix\", 16);\r\n ubo.addUniform(\"microSurfaceSamplerMatrix\", 16);\r\n ubo.addUniform(\"bumpMatrix\", 16);\r\n ubo.addUniform(\"vTangentSpaceParams\", 2);\r\n ubo.addUniform(\"reflectionMatrix\", 16);\r\n ubo.addUniform(\"vReflectionColor\", 3);\r\n ubo.addUniform(\"vAlbedoColor\", 4);\r\n ubo.addUniform(\"vLightingIntensity\", 4);\r\n ubo.addUniform(\"vReflectionMicrosurfaceInfos\", 3);\r\n ubo.addUniform(\"pointSize\", 1);\r\n ubo.addUniform(\"vReflectivityColor\", 4);\r\n ubo.addUniform(\"vEmissiveColor\", 3);\r\n ubo.addUniform(\"visibility\", 1);\r\n ubo.addUniform(\"vMetallicReflectanceFactors\", 4);\r\n ubo.addUniform(\"vMetallicReflectanceInfos\", 2);\r\n ubo.addUniform(\"metallicReflectanceMatrix\", 16);\r\n PBRClearCoatConfiguration.PrepareUniformBuffer(ubo);\r\n PBRAnisotropicConfiguration.PrepareUniformBuffer(ubo);\r\n PBRSheenConfiguration.PrepareUniformBuffer(ubo);\r\n PBRSubSurfaceConfiguration.PrepareUniformBuffer(ubo);\r\n DetailMapConfiguration.PrepareUniformBuffer(ubo);\r\n ubo.create();\r\n };\r\n /**\r\n * Unbinds the material from the mesh\r\n */\r\n PBRBaseMaterial.prototype.unbind = function () {\r\n if (this._activeEffect) {\r\n var needFlag = false;\r\n if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\r\n this._activeEffect.setTexture(\"reflection2DSampler\", null);\r\n needFlag = true;\r\n }\r\n if (this.subSurface.unbind(this._activeEffect)) {\r\n needFlag = true;\r\n }\r\n if (needFlag) {\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\r\n }\r\n _super.prototype.unbind.call(this);\r\n };\r\n /**\r\n * Binds the submesh data.\r\n * @param world - The world matrix.\r\n * @param mesh - The BJS mesh.\r\n * @param subMesh - A submesh of the BJS mesh.\r\n */\r\n PBRBaseMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {\r\n var scene = this.getScene();\r\n var defines = subMesh._materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n var effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n // Matrices\r\n if (!defines.INSTANCES || defines.THIN_INSTANCES) {\r\n this.bindOnlyWorldMatrix(world);\r\n }\r\n // PrePass\r\n this.prePassConfiguration.bindForSubMesh(this._activeEffect, scene, mesh, world, this.isFrozen);\r\n // Normal Matrix\r\n if (defines.OBJECTSPACE_NORMALMAP) {\r\n world.toNormalMatrix(this._normalMatrix);\r\n this.bindOnlyNormalMatrix(this._normalMatrix);\r\n }\r\n var mustRebind = this._mustRebind(scene, effect, mesh.visibility);\r\n // Bones\r\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect, this.prePassConfiguration);\r\n var reflectionTexture = null;\r\n var ubo = this._uniformBuffer;\r\n if (mustRebind) {\r\n var engine = scene.getEngine();\r\n ubo.bindToEffect(effect, \"Material\");\r\n this.bindViewProjection(effect);\r\n reflectionTexture = this._getReflectionTexture();\r\n if (!ubo.useUbo || !this.isFrozen || !ubo.isSync) {\r\n // Texture uniforms\r\n if (scene.texturesEnabled) {\r\n if (this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n ubo.updateFloat2(\"vAlbedoInfos\", this._albedoTexture.coordinatesIndex, this._albedoTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._albedoTexture, ubo, \"albedo\");\r\n }\r\n if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) {\r\n ubo.updateFloat4(\"vAmbientInfos\", this._ambientTexture.coordinatesIndex, this._ambientTexture.level, this._ambientTextureStrength, this._ambientTextureImpactOnAnalyticalLights);\r\n MaterialHelper.BindTextureMatrix(this._ambientTexture, ubo, \"ambient\");\r\n }\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n ubo.updateFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._opacityTexture, ubo, \"opacity\");\r\n }\r\n if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {\r\n ubo.updateMatrix(\"reflectionMatrix\", reflectionTexture.getReflectionTextureMatrix());\r\n ubo.updateFloat2(\"vReflectionInfos\", reflectionTexture.level, 0);\r\n if (reflectionTexture.boundingBoxSize) {\r\n var cubeTexture = reflectionTexture;\r\n ubo.updateVector3(\"vReflectionPosition\", cubeTexture.boundingBoxPosition);\r\n ubo.updateVector3(\"vReflectionSize\", cubeTexture.boundingBoxSize);\r\n }\r\n if (this.realTimeFiltering) {\r\n var width = reflectionTexture.getSize().width;\r\n ubo.updateFloat2(\"vReflectionFilteringInfo\", width, Scalar.Log2(width));\r\n }\r\n if (!defines.USEIRRADIANCEMAP) {\r\n var polynomials = reflectionTexture.sphericalPolynomial;\r\n if (defines.USESPHERICALFROMREFLECTIONMAP && polynomials) {\r\n if (defines.SPHERICAL_HARMONICS) {\r\n var preScaledHarmonics = polynomials.preScaledHarmonics;\r\n this._activeEffect.setVector3(\"vSphericalL00\", preScaledHarmonics.l00);\r\n this._activeEffect.setVector3(\"vSphericalL1_1\", preScaledHarmonics.l1_1);\r\n this._activeEffect.setVector3(\"vSphericalL10\", preScaledHarmonics.l10);\r\n this._activeEffect.setVector3(\"vSphericalL11\", preScaledHarmonics.l11);\r\n this._activeEffect.setVector3(\"vSphericalL2_2\", preScaledHarmonics.l2_2);\r\n this._activeEffect.setVector3(\"vSphericalL2_1\", preScaledHarmonics.l2_1);\r\n this._activeEffect.setVector3(\"vSphericalL20\", preScaledHarmonics.l20);\r\n this._activeEffect.setVector3(\"vSphericalL21\", preScaledHarmonics.l21);\r\n this._activeEffect.setVector3(\"vSphericalL22\", preScaledHarmonics.l22);\r\n }\r\n else {\r\n this._activeEffect.setFloat3(\"vSphericalX\", polynomials.x.x, polynomials.x.y, polynomials.x.z);\r\n this._activeEffect.setFloat3(\"vSphericalY\", polynomials.y.x, polynomials.y.y, polynomials.y.z);\r\n this._activeEffect.setFloat3(\"vSphericalZ\", polynomials.z.x, polynomials.z.y, polynomials.z.z);\r\n this._activeEffect.setFloat3(\"vSphericalXX_ZZ\", polynomials.xx.x - polynomials.zz.x, polynomials.xx.y - polynomials.zz.y, polynomials.xx.z - polynomials.zz.z);\r\n this._activeEffect.setFloat3(\"vSphericalYY_ZZ\", polynomials.yy.x - polynomials.zz.x, polynomials.yy.y - polynomials.zz.y, polynomials.yy.z - polynomials.zz.z);\r\n this._activeEffect.setFloat3(\"vSphericalZZ\", polynomials.zz.x, polynomials.zz.y, polynomials.zz.z);\r\n this._activeEffect.setFloat3(\"vSphericalXY\", polynomials.xy.x, polynomials.xy.y, polynomials.xy.z);\r\n this._activeEffect.setFloat3(\"vSphericalYZ\", polynomials.yz.x, polynomials.yz.y, polynomials.yz.z);\r\n this._activeEffect.setFloat3(\"vSphericalZX\", polynomials.zx.x, polynomials.zx.y, polynomials.zx.z);\r\n }\r\n }\r\n }\r\n ubo.updateFloat3(\"vReflectionMicrosurfaceInfos\", reflectionTexture.getSize().width, reflectionTexture.lodGenerationScale, reflectionTexture.lodGenerationOffset);\r\n }\r\n if (this._emissiveTexture && MaterialFlags.EmissiveTextureEnabled) {\r\n ubo.updateFloat2(\"vEmissiveInfos\", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._emissiveTexture, ubo, \"emissive\");\r\n }\r\n if (this._lightmapTexture && MaterialFlags.LightmapTextureEnabled) {\r\n ubo.updateFloat2(\"vLightmapInfos\", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._lightmapTexture, ubo, \"lightmap\");\r\n }\r\n if (MaterialFlags.SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n ubo.updateFloat3(\"vReflectivityInfos\", this._metallicTexture.coordinatesIndex, this._metallicTexture.level, this._ambientTextureStrength);\r\n MaterialHelper.BindTextureMatrix(this._metallicTexture, ubo, \"reflectivity\");\r\n }\r\n else if (this._reflectivityTexture) {\r\n ubo.updateFloat3(\"vReflectivityInfos\", this._reflectivityTexture.coordinatesIndex, this._reflectivityTexture.level, 1.0);\r\n MaterialHelper.BindTextureMatrix(this._reflectivityTexture, ubo, \"reflectivity\");\r\n }\r\n if (this._metallicReflectanceTexture) {\r\n ubo.updateFloat2(\"vMetallicReflectanceInfos\", this._metallicReflectanceTexture.coordinatesIndex, this._metallicReflectanceTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._metallicReflectanceTexture, ubo, \"metallicReflectance\");\r\n }\r\n if (this._microSurfaceTexture) {\r\n ubo.updateFloat2(\"vMicroSurfaceSamplerInfos\", this._microSurfaceTexture.coordinatesIndex, this._microSurfaceTexture.level);\r\n MaterialHelper.BindTextureMatrix(this._microSurfaceTexture, ubo, \"microSurfaceSampler\");\r\n }\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.BumpTextureEnabled && !this._disableBumpMap) {\r\n ubo.updateFloat3(\"vBumpInfos\", this._bumpTexture.coordinatesIndex, this._bumpTexture.level, this._parallaxScaleBias);\r\n MaterialHelper.BindTextureMatrix(this._bumpTexture, ubo, \"bump\");\r\n if (scene._mirroredCameraPosition) {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? 1.0 : -1.0, this._invertNormalMapY ? 1.0 : -1.0);\r\n }\r\n else {\r\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? -1.0 : 1.0, this._invertNormalMapY ? -1.0 : 1.0);\r\n }\r\n }\r\n }\r\n // Point size\r\n if (this.pointsCloud) {\r\n ubo.updateFloat(\"pointSize\", this.pointSize);\r\n }\r\n // Colors\r\n if (defines.METALLICWORKFLOW) {\r\n TmpColors.Color3[0].r = (this._metallic === undefined || this._metallic === null) ? 1 : this._metallic;\r\n TmpColors.Color3[0].g = (this._roughness === undefined || this._roughness === null) ? 1 : this._roughness;\r\n ubo.updateColor4(\"vReflectivityColor\", TmpColors.Color3[0], 1);\r\n var ior = this.subSurface.indexOfRefraction;\r\n var outside_ior = 1; // consider air as clear coat and other layaers would remap in the shader.\r\n // We are here deriving our default reflectance from a common value for none metallic surface.\r\n // Based of the schlick fresnel approximation model\r\n // for dielectrics.\r\n var f0 = Math.pow((ior - outside_ior) / (ior + outside_ior), 2);\r\n // Tweak the default F0 and F90 based on our given setup\r\n this._metallicReflectanceColor.scaleToRef(f0 * this._metallicF0Factor, TmpColors.Color3[0]);\r\n var metallicF90 = this._metallicF0Factor;\r\n ubo.updateColor4(\"vMetallicReflectanceFactors\", TmpColors.Color3[0], metallicF90);\r\n }\r\n else {\r\n ubo.updateColor4(\"vReflectivityColor\", this._reflectivityColor, this._microSurface);\r\n }\r\n ubo.updateColor3(\"vEmissiveColor\", MaterialFlags.EmissiveTextureEnabled ? this._emissiveColor : Color3.BlackReadOnly);\r\n ubo.updateColor3(\"vReflectionColor\", this._reflectionColor);\r\n if (!defines.SS_REFRACTION && this.subSurface.linkRefractionWithTransparency) {\r\n ubo.updateColor4(\"vAlbedoColor\", this._albedoColor, 1);\r\n }\r\n else {\r\n ubo.updateColor4(\"vAlbedoColor\", this._albedoColor, this.alpha);\r\n }\r\n // Misc\r\n this._lightingInfos.x = this._directIntensity;\r\n this._lightingInfos.y = this._emissiveIntensity;\r\n this._lightingInfos.z = this._environmentIntensity * scene.environmentIntensity;\r\n this._lightingInfos.w = this._specularIntensity;\r\n ubo.updateVector4(\"vLightingIntensity\", this._lightingInfos);\r\n }\r\n // Visibility\r\n ubo.updateFloat(\"visibility\", mesh.visibility);\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n ubo.setTexture(\"albedoSampler\", this._albedoTexture);\r\n }\r\n if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) {\r\n ubo.setTexture(\"ambientSampler\", this._ambientTexture);\r\n }\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n ubo.setTexture(\"opacitySampler\", this._opacityTexture);\r\n }\r\n if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {\r\n if (defines.LODBASEDMICROSFURACE) {\r\n ubo.setTexture(\"reflectionSampler\", reflectionTexture);\r\n }\r\n else {\r\n ubo.setTexture(\"reflectionSampler\", reflectionTexture._lodTextureMid || reflectionTexture);\r\n ubo.setTexture(\"reflectionSamplerLow\", reflectionTexture._lodTextureLow || reflectionTexture);\r\n ubo.setTexture(\"reflectionSamplerHigh\", reflectionTexture._lodTextureHigh || reflectionTexture);\r\n }\r\n if (defines.USEIRRADIANCEMAP) {\r\n ubo.setTexture(\"irradianceSampler\", reflectionTexture.irradianceTexture);\r\n }\r\n }\r\n if (defines.ENVIRONMENTBRDF) {\r\n ubo.setTexture(\"environmentBrdfSampler\", this._environmentBRDFTexture);\r\n }\r\n if (this._emissiveTexture && MaterialFlags.EmissiveTextureEnabled) {\r\n ubo.setTexture(\"emissiveSampler\", this._emissiveTexture);\r\n }\r\n if (this._lightmapTexture && MaterialFlags.LightmapTextureEnabled) {\r\n ubo.setTexture(\"lightmapSampler\", this._lightmapTexture);\r\n }\r\n if (MaterialFlags.SpecularTextureEnabled) {\r\n if (this._metallicTexture) {\r\n ubo.setTexture(\"reflectivitySampler\", this._metallicTexture);\r\n }\r\n else if (this._reflectivityTexture) {\r\n ubo.setTexture(\"reflectivitySampler\", this._reflectivityTexture);\r\n }\r\n if (this._metallicReflectanceTexture) {\r\n ubo.setTexture(\"metallicReflectanceSampler\", this._metallicReflectanceTexture);\r\n }\r\n if (this._microSurfaceTexture) {\r\n ubo.setTexture(\"microSurfaceSampler\", this._microSurfaceTexture);\r\n }\r\n }\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.BumpTextureEnabled && !this._disableBumpMap) {\r\n ubo.setTexture(\"bumpSampler\", this._bumpTexture);\r\n }\r\n }\r\n this.detailMap.bindForSubMesh(ubo, scene, this.isFrozen);\r\n this.subSurface.bindForSubMesh(ubo, scene, engine, this.isFrozen, defines.LODBASEDMICROSFURACE, this.realTimeFiltering);\r\n this.clearCoat.bindForSubMesh(ubo, scene, engine, this._disableBumpMap, this.isFrozen, this._invertNormalMapX, this._invertNormalMapY, subMesh);\r\n this.anisotropy.bindForSubMesh(ubo, scene, this.isFrozen);\r\n this.sheen.bindForSubMesh(ubo, scene, this.isFrozen, subMesh);\r\n // Clip plane\r\n MaterialHelper.BindClipPlane(this._activeEffect, scene);\r\n // Colors\r\n scene.ambientColor.multiplyToRef(this._ambientColor, this._globalAmbientColor);\r\n var eyePosition = scene._forcedViewPosition ? scene._forcedViewPosition : (scene._mirroredCameraPosition ? scene._mirroredCameraPosition : scene.activeCamera.globalPosition);\r\n var invertNormal = (scene.useRightHandedSystem === (scene._mirroredCameraPosition != null));\r\n effect.setFloat4(\"vEyePosition\", eyePosition.x, eyePosition.y, eyePosition.z, invertNormal ? -1 : 1);\r\n effect.setColor3(\"vAmbientColor\", this._globalAmbientColor);\r\n effect.setFloat2(\"vDebugMode\", this.debugLimit, this.debugFactor);\r\n }\r\n if (mustRebind || !this.isFrozen) {\r\n // Lights\r\n if (scene.lightsEnabled && !this._disableLighting) {\r\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights, this._rebuildInParallel);\r\n }\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE || reflectionTexture) {\r\n this.bindView(effect);\r\n }\r\n // Fog\r\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect, true);\r\n // Morph targets\r\n if (defines.NUM_MORPH_INFLUENCERS) {\r\n MaterialHelper.BindMorphTargetParameters(mesh, this._activeEffect);\r\n }\r\n // image processing\r\n this._imageProcessingConfiguration.bind(this._activeEffect);\r\n // Log. depth\r\n MaterialHelper.BindLogDepth(defines, this._activeEffect, scene);\r\n }\r\n ubo.update();\r\n this._afterBind(mesh, this._activeEffect);\r\n };\r\n /**\r\n * Returns the animatable textures.\r\n * @returns - Array of animatable textures.\r\n */\r\n PBRBaseMaterial.prototype.getAnimatables = function () {\r\n var results = [];\r\n if (this._albedoTexture && this._albedoTexture.animations && this._albedoTexture.animations.length > 0) {\r\n results.push(this._albedoTexture);\r\n }\r\n if (this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0) {\r\n results.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0) {\r\n results.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0) {\r\n results.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0) {\r\n results.push(this._emissiveTexture);\r\n }\r\n if (this._metallicTexture && this._metallicTexture.animations && this._metallicTexture.animations.length > 0) {\r\n results.push(this._metallicTexture);\r\n }\r\n else if (this._reflectivityTexture && this._reflectivityTexture.animations && this._reflectivityTexture.animations.length > 0) {\r\n results.push(this._reflectivityTexture);\r\n }\r\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\r\n results.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0) {\r\n results.push(this._lightmapTexture);\r\n }\r\n this.detailMap.getAnimatables(results);\r\n this.subSurface.getAnimatables(results);\r\n this.clearCoat.getAnimatables(results);\r\n this.sheen.getAnimatables(results);\r\n this.anisotropy.getAnimatables(results);\r\n return results;\r\n };\r\n /**\r\n * Returns the texture used for reflections.\r\n * @returns - Reflection texture if present. Otherwise, returns the environment texture.\r\n */\r\n PBRBaseMaterial.prototype._getReflectionTexture = function () {\r\n if (this._reflectionTexture) {\r\n return this._reflectionTexture;\r\n }\r\n return this.getScene().environmentTexture;\r\n };\r\n /**\r\n * Returns an array of the actively used textures.\r\n * @returns - Array of BaseTextures\r\n */\r\n PBRBaseMaterial.prototype.getActiveTextures = function () {\r\n var activeTextures = _super.prototype.getActiveTextures.call(this);\r\n if (this._albedoTexture) {\r\n activeTextures.push(this._albedoTexture);\r\n }\r\n if (this._ambientTexture) {\r\n activeTextures.push(this._ambientTexture);\r\n }\r\n if (this._opacityTexture) {\r\n activeTextures.push(this._opacityTexture);\r\n }\r\n if (this._reflectionTexture) {\r\n activeTextures.push(this._reflectionTexture);\r\n }\r\n if (this._emissiveTexture) {\r\n activeTextures.push(this._emissiveTexture);\r\n }\r\n if (this._reflectivityTexture) {\r\n activeTextures.push(this._reflectivityTexture);\r\n }\r\n if (this._metallicTexture) {\r\n activeTextures.push(this._metallicTexture);\r\n }\r\n if (this._metallicReflectanceTexture) {\r\n activeTextures.push(this._metallicReflectanceTexture);\r\n }\r\n if (this._microSurfaceTexture) {\r\n activeTextures.push(this._microSurfaceTexture);\r\n }\r\n if (this._bumpTexture) {\r\n activeTextures.push(this._bumpTexture);\r\n }\r\n if (this._lightmapTexture) {\r\n activeTextures.push(this._lightmapTexture);\r\n }\r\n this.detailMap.getActiveTextures(activeTextures);\r\n this.subSurface.getActiveTextures(activeTextures);\r\n this.clearCoat.getActiveTextures(activeTextures);\r\n this.sheen.getActiveTextures(activeTextures);\r\n this.anisotropy.getActiveTextures(activeTextures);\r\n return activeTextures;\r\n };\r\n /**\r\n * Checks to see if a texture is used in the material.\r\n * @param texture - Base texture to use.\r\n * @returns - Boolean specifying if a texture is used in the material.\r\n */\r\n PBRBaseMaterial.prototype.hasTexture = function (texture) {\r\n if (_super.prototype.hasTexture.call(this, texture)) {\r\n return true;\r\n }\r\n if (this._albedoTexture === texture) {\r\n return true;\r\n }\r\n if (this._ambientTexture === texture) {\r\n return true;\r\n }\r\n if (this._opacityTexture === texture) {\r\n return true;\r\n }\r\n if (this._reflectionTexture === texture) {\r\n return true;\r\n }\r\n if (this._reflectivityTexture === texture) {\r\n return true;\r\n }\r\n if (this._metallicTexture === texture) {\r\n return true;\r\n }\r\n if (this._metallicReflectanceTexture === texture) {\r\n return true;\r\n }\r\n if (this._microSurfaceTexture === texture) {\r\n return true;\r\n }\r\n if (this._bumpTexture === texture) {\r\n return true;\r\n }\r\n if (this._lightmapTexture === texture) {\r\n return true;\r\n }\r\n return this.detailMap.hasTexture(texture) ||\r\n this.subSurface.hasTexture(texture) ||\r\n this.clearCoat.hasTexture(texture) ||\r\n this.sheen.hasTexture(texture) ||\r\n this.anisotropy.hasTexture(texture);\r\n };\r\n /**\r\n * Sets the required values to the prepass renderer.\r\n * @param prePassRenderer defines the prepass renderer to setup\r\n */\r\n PBRBaseMaterial.prototype.setPrePassRenderer = function (prePassRenderer) {\r\n if (this.subSurface.isScatteringEnabled) {\r\n var subSurfaceConfiguration = this.getScene().enableSubSurfaceForPrePass();\r\n if (subSurfaceConfiguration) {\r\n subSurfaceConfiguration.enabled = true;\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Disposes the resources of the material.\r\n * @param forceDisposeEffect - Forces the disposal of effects.\r\n * @param forceDisposeTextures - Forces the disposal of all textures.\r\n */\r\n PBRBaseMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\r\n if (forceDisposeTextures) {\r\n if (this._environmentBRDFTexture && this.getScene().environmentBRDFTexture !== this._environmentBRDFTexture) {\r\n this._environmentBRDFTexture.dispose();\r\n }\r\n (_a = this._albedoTexture) === null || _a === void 0 ? void 0 : _a.dispose();\r\n (_b = this._ambientTexture) === null || _b === void 0 ? void 0 : _b.dispose();\r\n (_c = this._opacityTexture) === null || _c === void 0 ? void 0 : _c.dispose();\r\n (_d = this._reflectionTexture) === null || _d === void 0 ? void 0 : _d.dispose();\r\n (_e = this._emissiveTexture) === null || _e === void 0 ? void 0 : _e.dispose();\r\n (_f = this._metallicTexture) === null || _f === void 0 ? void 0 : _f.dispose();\r\n (_g = this._reflectivityTexture) === null || _g === void 0 ? void 0 : _g.dispose();\r\n (_h = this._bumpTexture) === null || _h === void 0 ? void 0 : _h.dispose();\r\n (_j = this._lightmapTexture) === null || _j === void 0 ? void 0 : _j.dispose();\r\n (_k = this._metallicReflectanceTexture) === null || _k === void 0 ? void 0 : _k.dispose();\r\n (_l = this._microSurfaceTexture) === null || _l === void 0 ? void 0 : _l.dispose();\r\n }\r\n this.detailMap.dispose(forceDisposeTextures);\r\n this.subSurface.dispose(forceDisposeTextures);\r\n this.clearCoat.dispose(forceDisposeTextures);\r\n this.sheen.dispose(forceDisposeTextures);\r\n this.anisotropy.dispose(forceDisposeTextures);\r\n this._renderTargets.dispose();\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);\r\n };\r\n /**\r\n * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_OPAQUE = Material.MATERIAL_OPAQUE;\r\n /**\r\n * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_ALPHATEST = Material.MATERIAL_ALPHATEST;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_ALPHABLEND = Material.MATERIAL_ALPHABLEND;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n * They are also discarded below the alpha cutoff threshold to improve performances.\r\n */\r\n PBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND = Material.MATERIAL_ALPHATESTANDBLEND;\r\n /**\r\n * Defines the default value of how much AO map is occluding the analytical lights\r\n * (point spot...).\r\n */\r\n PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = 0;\r\n /**\r\n * PBRMaterialLightFalloff Physical: light is falling off following the inverse squared distance law.\r\n */\r\n PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL = 0;\r\n /**\r\n * PBRMaterialLightFalloff gltf: light is falling off as described in the gltf moving to PBR document\r\n * to enhance interoperability with other engines.\r\n */\r\n PBRBaseMaterial.LIGHTFALLOFF_GLTF = 1;\r\n /**\r\n * PBRMaterialLightFalloff Standard: light is falling off like in the standard material\r\n * to enhance interoperability with other materials.\r\n */\r\n PBRBaseMaterial.LIGHTFALLOFF_STANDARD = 2;\r\n __decorate([\r\n serializeAsImageProcessingConfiguration()\r\n ], PBRBaseMaterial.prototype, \"_imageProcessingConfiguration\", void 0);\r\n __decorate([\r\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRBaseMaterial.prototype, \"debugMode\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRBaseMaterial.prototype, \"useLogarithmicDepth\", null);\r\n return PBRBaseMaterial;\r\n}(PushMaterial));\r\nexport { PBRBaseMaterial };\r\n//# sourceMappingURL=pbrBaseMaterial.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, SerializationHelper, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { BRDFTextureTools } from \"../../Misc/brdfTextureTools\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { PBRBaseMaterial } from \"./pbrBaseMaterial\";\r\nimport { _TypeStore } from '../../Misc/typeStore';\r\n/**\r\n * The Physically based material of BJS.\r\n *\r\n * This offers the main features of a standard PBR material.\r\n * For more information, please refer to the documentation :\r\n * https://doc.babylonjs.com/how_to/physically_based_rendering\r\n */\r\nvar PBRMaterial = /** @class */ (function (_super) {\r\n __extends(PBRMaterial, _super);\r\n /**\r\n * Instantiates a new PBRMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n function PBRMaterial(name, scene) {\r\n var _this = _super.call(this, name, scene) || this;\r\n /**\r\n * Intensity of the direct lights e.g. the four lights available in your scene.\r\n * This impacts both the direct diffuse and specular highlights.\r\n */\r\n _this.directIntensity = 1.0;\r\n /**\r\n * Intensity of the emissive part of the material.\r\n * This helps controlling the emissive effect without modifying the emissive color.\r\n */\r\n _this.emissiveIntensity = 1.0;\r\n /**\r\n * Intensity of the environment e.g. how much the environment will light the object\r\n * either through harmonics for rough material or through the refelction for shiny ones.\r\n */\r\n _this.environmentIntensity = 1.0;\r\n /**\r\n * This is a special control allowing the reduction of the specular highlights coming from the\r\n * four lights of the scene. Those highlights may not be needed in full environment lighting.\r\n */\r\n _this.specularIntensity = 1.0;\r\n /**\r\n * Debug Control allowing disabling the bump map on this material.\r\n */\r\n _this.disableBumpMap = false;\r\n /**\r\n * AKA Occlusion Texture Intensity in other nomenclature.\r\n */\r\n _this.ambientTextureStrength = 1.0;\r\n /**\r\n * Defines how much the AO map is occluding the analytical lights (point spot...).\r\n * 1 means it completely occludes it\r\n * 0 mean it has no impact\r\n */\r\n _this.ambientTextureImpactOnAnalyticalLights = PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n /**\r\n * In metallic workflow, specifies an F0 factor to help configuring the material F0.\r\n * By default the indexOfrefraction is used to compute F0;\r\n *\r\n * This is used as a factor against the default reflectance at normal incidence to tweak it.\r\n *\r\n * F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor;\r\n * F90 = metallicReflectanceColor;\r\n */\r\n _this.metallicF0Factor = 1;\r\n /**\r\n * In metallic workflow, specifies an F90 color to help configuring the material F90.\r\n * By default the F90 is always 1;\r\n *\r\n * Please note that this factor is also used as a factor against the default reflectance at normal incidence.\r\n *\r\n * F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor\r\n * F90 = metallicReflectanceColor;\r\n */\r\n _this.metallicReflectanceColor = Color3.White();\r\n /**\r\n * The color of a material in ambient lighting.\r\n */\r\n _this.ambientColor = new Color3(0, 0, 0);\r\n /**\r\n * AKA Diffuse Color in other nomenclature.\r\n */\r\n _this.albedoColor = new Color3(1, 1, 1);\r\n /**\r\n * AKA Specular Color in other nomenclature.\r\n */\r\n _this.reflectivityColor = new Color3(1, 1, 1);\r\n /**\r\n * The color reflected from the material.\r\n */\r\n _this.reflectionColor = new Color3(1.0, 1.0, 1.0);\r\n /**\r\n * The color emitted from the material.\r\n */\r\n _this.emissiveColor = new Color3(0, 0, 0);\r\n /**\r\n * AKA Glossiness in other nomenclature.\r\n */\r\n _this.microSurface = 1.0;\r\n /**\r\n * If true, the light map contains occlusion information instead of lighting info.\r\n */\r\n _this.useLightmapAsShadowmap = false;\r\n /**\r\n * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.\r\n */\r\n _this.useAlphaFromAlbedoTexture = false;\r\n /**\r\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\r\n */\r\n _this.forceAlphaTest = false;\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n _this.alphaCutOff = 0.4;\r\n /**\r\n * Specifies that the material will keep the specular highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.\r\n */\r\n _this.useSpecularOverAlpha = true;\r\n /**\r\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\r\n */\r\n _this.useMicroSurfaceFromReflectivityMapAlpha = false;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its alpha channel.\r\n */\r\n _this.useRoughnessFromMetallicTextureAlpha = true;\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its green channel.\r\n */\r\n _this.useRoughnessFromMetallicTextureGreen = false;\r\n /**\r\n * Specifies if the metallic texture contains the metallness information in its blue channel.\r\n */\r\n _this.useMetallnessFromMetallicTextureBlue = false;\r\n /**\r\n * Specifies if the metallic texture contains the ambient occlusion information in its red channel.\r\n */\r\n _this.useAmbientOcclusionFromMetallicTextureRed = false;\r\n /**\r\n * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.\r\n */\r\n _this.useAmbientInGrayScale = false;\r\n /**\r\n * In case the reflectivity map does not contain the microsurface information in its alpha channel,\r\n * The material will try to infer what glossiness each pixel should be.\r\n */\r\n _this.useAutoMicroSurfaceFromReflectivityMap = false;\r\n /**\r\n * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones).\r\n * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.\r\n */\r\n _this.useRadianceOverAlpha = true;\r\n /**\r\n * Allows using an object space normal map (instead of tangent space).\r\n */\r\n _this.useObjectSpaceNormalMap = false;\r\n /**\r\n * Allows using the bump map in parallax mode.\r\n */\r\n _this.useParallax = false;\r\n /**\r\n * Allows using the bump map in parallax occlusion mode.\r\n */\r\n _this.useParallaxOcclusion = false;\r\n /**\r\n * Controls the scale bias of the parallax mode.\r\n */\r\n _this.parallaxScaleBias = 0.05;\r\n /**\r\n * If sets to true, disables all the lights affecting the material.\r\n */\r\n _this.disableLighting = false;\r\n /**\r\n * Force the shader to compute irradiance in the fragment shader in order to take bump in account.\r\n */\r\n _this.forceIrradianceInFragment = false;\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n _this.maxSimultaneousLights = 4;\r\n /**\r\n * If sets to true, x component of normal map value will invert (x = 1.0 - x).\r\n */\r\n _this.invertNormalMapX = false;\r\n /**\r\n * If sets to true, y component of normal map value will invert (y = 1.0 - y).\r\n */\r\n _this.invertNormalMapY = false;\r\n /**\r\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\r\n */\r\n _this.twoSidedLighting = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)\r\n */\r\n _this.useAlphaFresnel = false;\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)\r\n */\r\n _this.useLinearAlphaFresnel = false;\r\n /**\r\n * Let user defines the brdf lookup texture used for IBL.\r\n * A default 8bit version is embedded but you could point at :\r\n * * Default texture: https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png\r\n * * Default 16bit pixel depth texture: https://assets.babylonjs.com/environments/correlatedMSBRDF.dds\r\n * * LEGACY Default None correlated https://assets.babylonjs.com/environments/uncorrelatedBRDF_RGBD.png\r\n * * LEGACY Default None correlated 16bit pixel depth https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds\r\n */\r\n _this.environmentBRDFTexture = null;\r\n /**\r\n * Force normal to face away from face.\r\n */\r\n _this.forceNormalForward = false;\r\n /**\r\n * Enables specular anti aliasing in the PBR shader.\r\n * It will both interacts on the Geometry for analytical and IBL lighting.\r\n * It also prefilter the roughness map based on the bump values.\r\n */\r\n _this.enableSpecularAntiAliasing = false;\r\n /**\r\n * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal\r\n * makes the reflect vector face the model (under horizon).\r\n */\r\n _this.useHorizonOcclusion = true;\r\n /**\r\n * This parameters will enable/disable radiance occlusion by preventing the radiance to lit\r\n * too much the area relying on ambient texture to define their ambient occlusion.\r\n */\r\n _this.useRadianceOcclusion = true;\r\n /**\r\n * If set to true, no lighting calculations will be applied.\r\n */\r\n _this.unlit = false;\r\n _this._environmentBRDFTexture = BRDFTextureTools.GetEnvironmentBRDFTexture(scene);\r\n return _this;\r\n }\r\n Object.defineProperty(PBRMaterial.prototype, \"refractionTexture\", {\r\n /**\r\n * Stores the refracted light information in a texture.\r\n */\r\n get: function () {\r\n return this.subSurface.refractionTexture;\r\n },\r\n set: function (value) {\r\n this.subSurface.refractionTexture = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n }\r\n else if (!this.subSurface.linkRefractionWithTransparency) {\r\n this.subSurface.isRefractionEnabled = false;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"indexOfRefraction\", {\r\n /**\r\n * Index of refraction of the material base layer.\r\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\r\n *\r\n * This does not only impact refraction but also the Base F0 of Dielectric Materials.\r\n *\r\n * From dielectric fresnel rules: F0 = square((iorT - iorI) / (iorT + iorI))\r\n */\r\n get: function () {\r\n return this.subSurface.indexOfRefraction;\r\n },\r\n set: function (value) {\r\n this.subSurface.indexOfRefraction = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"invertRefractionY\", {\r\n /**\r\n * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.\r\n */\r\n get: function () {\r\n return this.subSurface.invertRefractionY;\r\n },\r\n set: function (value) {\r\n this.subSurface.invertRefractionY = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"linkRefractionWithTransparency\", {\r\n /**\r\n * This parameters will make the material used its opacity to control how much it is refracting aginst not.\r\n * Materials half opaque for instance using refraction could benefit from this control.\r\n */\r\n get: function () {\r\n return this.subSurface.linkRefractionWithTransparency;\r\n },\r\n set: function (value) {\r\n this.subSurface.linkRefractionWithTransparency = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"usePhysicalLightFalloff\", {\r\n /**\r\n * BJS is using an harcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n get: function () {\r\n return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n },\r\n /**\r\n * BJS is using an harcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the fallof is to use the inverse squared root algorythm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n set: function (value) {\r\n if (value !== this.usePhysicalLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n if (value) {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n }\r\n else {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"useGLTFLightFalloff\", {\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n get: function () {\r\n return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_GLTF;\r\n },\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n set: function (value) {\r\n if (value !== this.useGLTFLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n if (value) {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_GLTF;\r\n }\r\n else {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"imageProcessingConfiguration\", {\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration;\r\n },\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n set: function (value) {\r\n this._attachImageProcessingConfiguration(value);\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorCurvesEnabled\", {\r\n /**\r\n * Gets wether the color curves effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n },\r\n /**\r\n * Sets wether the color curves effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorGradingEnabled\", {\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n get: function () {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n },\r\n /**\r\n * Gets wether the color grading effect is enabled.\r\n */\r\n set: function (value) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraToneMappingEnabled\", {\r\n /**\r\n * Gets wether tonemapping is enabled or not.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n },\r\n /**\r\n * Sets wether tonemapping is enabled or not\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraExposure\", {\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.exposure;\r\n },\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.exposure = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraContrast\", {\r\n /**\r\n * Gets The camera contrast used on this material.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.contrast;\r\n },\r\n /**\r\n * Sets The camera contrast used on this material.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.contrast = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorGradingTexture\", {\r\n /**\r\n * Gets the Color Grading 2D Lookup Texture.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorGradingTexture;\r\n },\r\n /**\r\n * Sets the Color Grading 2D Lookup Texture.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorGradingTexture = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(PBRMaterial.prototype, \"cameraColorCurves\", {\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n get: function () {\r\n return this._imageProcessingConfiguration.colorCurves;\r\n },\r\n /**\r\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n set: function (value) {\r\n this._imageProcessingConfiguration.colorCurves = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns the name of this material class.\r\n */\r\n PBRMaterial.prototype.getClassName = function () {\r\n return \"PBRMaterial\";\r\n };\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n */\r\n PBRMaterial.prototype.clone = function (name) {\r\n var _this = this;\r\n var clone = SerializationHelper.Clone(function () { return new PBRMaterial(name, _this.getScene()); }, this);\r\n clone.id = name;\r\n clone.name = name;\r\n this.clearCoat.copyTo(clone.clearCoat);\r\n this.anisotropy.copyTo(clone.anisotropy);\r\n this.brdf.copyTo(clone.brdf);\r\n this.sheen.copyTo(clone.sheen);\r\n this.subSurface.copyTo(clone.subSurface);\r\n return clone;\r\n };\r\n /**\r\n * Serializes this PBR Material.\r\n * @returns - An object with the serialized material.\r\n */\r\n PBRMaterial.prototype.serialize = function () {\r\n var serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.PBRMaterial\";\r\n serializationObject.clearCoat = this.clearCoat.serialize();\r\n serializationObject.anisotropy = this.anisotropy.serialize();\r\n serializationObject.brdf = this.brdf.serialize();\r\n serializationObject.sheen = this.sheen.serialize();\r\n serializationObject.subSurface = this.subSurface.serialize();\r\n return serializationObject;\r\n };\r\n // Statics\r\n /**\r\n * Parses a PBR Material from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene - BJS scene instance.\r\n * @param rootUrl - url for the scene object\r\n * @returns - PBRMaterial\r\n */\r\n PBRMaterial.Parse = function (source, scene, rootUrl) {\r\n var material = SerializationHelper.Parse(function () { return new PBRMaterial(source.name, scene); }, source, scene, rootUrl);\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n return material;\r\n };\r\n /**\r\n * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.\r\n */\r\n PBRMaterial.PBRMATERIAL_OPAQUE = PBRBaseMaterial.PBRMATERIAL_OPAQUE;\r\n /**\r\n * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\r\n */\r\n PBRMaterial.PBRMATERIAL_ALPHATEST = PBRBaseMaterial.PBRMATERIAL_ALPHATEST;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n */\r\n PBRMaterial.PBRMATERIAL_ALPHABLEND = PBRBaseMaterial.PBRMATERIAL_ALPHABLEND;\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n * They are also discarded below the alpha cutoff threshold to improve performances.\r\n */\r\n PBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND = PBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND;\r\n /**\r\n * Defines the default value of how much AO map is occluding the analytical lights\r\n * (point spot...).\r\n */\r\n PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"directIntensity\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"emissiveIntensity\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"environmentIntensity\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"specularIntensity\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"disableBumpMap\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"albedoTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientTextureStrength\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientTextureImpactOnAnalyticalLights\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"opacityTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectionTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"emissiveTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectivityTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"metallicTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"metallic\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"roughness\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"metallicF0Factor\", void 0);\r\n __decorate([\r\n serializeAsColor3(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"metallicReflectanceColor\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"metallicReflectanceTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"microSurfaceTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"bumpTexture\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", null)\r\n ], PBRMaterial.prototype, \"lightmapTexture\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"ambient\"),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"ambientColor\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"albedo\"),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"albedoColor\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"reflectivity\"),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectivityColor\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"reflection\"),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"reflectionColor\", void 0);\r\n __decorate([\r\n serializeAsColor3(\"emissive\"),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"emissiveColor\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"microSurface\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useLightmapAsShadowmap\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"useAlphaFromAlbedoTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"forceAlphaTest\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n ], PBRMaterial.prototype, \"alphaCutOff\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useSpecularOverAlpha\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useMicroSurfaceFromReflectivityMapAlpha\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRoughnessFromMetallicTextureAlpha\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRoughnessFromMetallicTextureGreen\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useMetallnessFromMetallicTextureBlue\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAmbientOcclusionFromMetallicTextureRed\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAmbientInGrayScale\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAutoMicroSurfaceFromReflectivityMap\", void 0);\r\n __decorate([\r\n serialize()\r\n ], PBRMaterial.prototype, \"usePhysicalLightFalloff\", null);\r\n __decorate([\r\n serialize()\r\n ], PBRMaterial.prototype, \"useGLTFLightFalloff\", null);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRadianceOverAlpha\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useObjectSpaceNormalMap\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useParallax\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useParallaxOcclusion\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"parallaxScaleBias\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n ], PBRMaterial.prototype, \"disableLighting\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"forceIrradianceInFragment\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n ], PBRMaterial.prototype, \"maxSimultaneousLights\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"invertNormalMapX\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"invertNormalMapY\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"twoSidedLighting\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useAlphaFresnel\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useLinearAlphaFresnel\", void 0);\r\n __decorate([\r\n serializeAsTexture(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"environmentBRDFTexture\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"forceNormalForward\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"enableSpecularAntiAliasing\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useHorizonOcclusion\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n ], PBRMaterial.prototype, \"useRadianceOcclusion\", void 0);\r\n __decorate([\r\n serialize(),\r\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n ], PBRMaterial.prototype, \"unlit\", void 0);\r\n return PBRMaterial;\r\n}(PBRBaseMaterial));\r\nexport { PBRMaterial };\r\n_TypeStore.RegisteredTypes[\"BABYLON.PBRMaterial\"] = PBRMaterial;\r\n//# sourceMappingURL=pbrMaterial.js.map","import { __decorate } from \"tslib\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { VertexBuffer } from \"../Meshes/buffer\";\r\nimport { serialize, SerializationHelper } from \"../Misc/decorators\";\r\nimport { _TypeStore } from '../Misc/typeStore';\r\n/**\r\n * Defines a target to use with MorphTargetManager\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_morphtargets\r\n */\r\nvar MorphTarget = /** @class */ (function () {\r\n /**\r\n * Creates a new MorphTarget\r\n * @param name defines the name of the target\r\n * @param influence defines the influence to use\r\n * @param scene defines the scene the morphtarget belongs to\r\n */\r\n function MorphTarget(\r\n /** defines the name of the target */\r\n name, influence, scene) {\r\n if (influence === void 0) { influence = 0; }\r\n if (scene === void 0) { scene = null; }\r\n this.name = name;\r\n /**\r\n * Gets or sets the list of animations\r\n */\r\n this.animations = new Array();\r\n this._positions = null;\r\n this._normals = null;\r\n this._tangents = null;\r\n this._uvs = null;\r\n this._uniqueId = 0;\r\n /**\r\n * Observable raised when the influence changes\r\n */\r\n this.onInfluenceChanged = new Observable();\r\n /** @hidden */\r\n this._onDataLayoutChanged = new Observable();\r\n this._animationPropertiesOverride = null;\r\n this._scene = scene || EngineStore.LastCreatedScene;\r\n this.influence = influence;\r\n if (this._scene) {\r\n this._uniqueId = this._scene.getUniqueId();\r\n }\r\n }\r\n Object.defineProperty(MorphTarget.prototype, \"influence\", {\r\n /**\r\n * Gets or sets the influence of this target (ie. its weight in the overall morphing)\r\n */\r\n get: function () {\r\n return this._influence;\r\n },\r\n set: function (influence) {\r\n if (this._influence === influence) {\r\n return;\r\n }\r\n var previous = this._influence;\r\n this._influence = influence;\r\n if (this.onInfluenceChanged.hasObservers()) {\r\n this.onInfluenceChanged.notifyObservers(previous === 0 || influence === 0);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"animationPropertiesOverride\", {\r\n /**\r\n * Gets or sets the animation properties override\r\n */\r\n get: function () {\r\n if (!this._animationPropertiesOverride && this._scene) {\r\n return this._scene.animationPropertiesOverride;\r\n }\r\n return this._animationPropertiesOverride;\r\n },\r\n set: function (value) {\r\n this._animationPropertiesOverride = value;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"uniqueId\", {\r\n /**\r\n * Gets the unique ID of this manager\r\n */\r\n get: function () {\r\n return this._uniqueId;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasPositions\", {\r\n /**\r\n * Gets a boolean defining if the target contains position data\r\n */\r\n get: function () {\r\n return !!this._positions;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasNormals\", {\r\n /**\r\n * Gets a boolean defining if the target contains normal data\r\n */\r\n get: function () {\r\n return !!this._normals;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasTangents\", {\r\n /**\r\n * Gets a boolean defining if the target contains tangent data\r\n */\r\n get: function () {\r\n return !!this._tangents;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTarget.prototype, \"hasUVs\", {\r\n /**\r\n * Gets a boolean defining if the target contains texture coordinates data\r\n */\r\n get: function () {\r\n return !!this._uvs;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Affects position data to this target\r\n * @param data defines the position data to use\r\n */\r\n MorphTarget.prototype.setPositions = function (data) {\r\n var hadPositions = this.hasPositions;\r\n this._positions = data;\r\n if (hadPositions !== this.hasPositions) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the position data stored in this target\r\n * @returns a FloatArray containing the position data (or null if not present)\r\n */\r\n MorphTarget.prototype.getPositions = function () {\r\n return this._positions;\r\n };\r\n /**\r\n * Affects normal data to this target\r\n * @param data defines the normal data to use\r\n */\r\n MorphTarget.prototype.setNormals = function (data) {\r\n var hadNormals = this.hasNormals;\r\n this._normals = data;\r\n if (hadNormals !== this.hasNormals) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the normal data stored in this target\r\n * @returns a FloatArray containing the normal data (or null if not present)\r\n */\r\n MorphTarget.prototype.getNormals = function () {\r\n return this._normals;\r\n };\r\n /**\r\n * Affects tangent data to this target\r\n * @param data defines the tangent data to use\r\n */\r\n MorphTarget.prototype.setTangents = function (data) {\r\n var hadTangents = this.hasTangents;\r\n this._tangents = data;\r\n if (hadTangents !== this.hasTangents) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the tangent data stored in this target\r\n * @returns a FloatArray containing the tangent data (or null if not present)\r\n */\r\n MorphTarget.prototype.getTangents = function () {\r\n return this._tangents;\r\n };\r\n /**\r\n * Affects texture coordinates data to this target\r\n * @param data defines the texture coordinates data to use\r\n */\r\n MorphTarget.prototype.setUVs = function (data) {\r\n var hadUVs = this.hasUVs;\r\n this._uvs = data;\r\n if (hadUVs !== this.hasUVs) {\r\n this._onDataLayoutChanged.notifyObservers(undefined);\r\n }\r\n };\r\n /**\r\n * Gets the texture coordinates data stored in this target\r\n * @returns a FloatArray containing the texture coordinates data (or null if not present)\r\n */\r\n MorphTarget.prototype.getUVs = function () {\r\n return this._uvs;\r\n };\r\n /**\r\n * Clone the current target\r\n * @returns a new MorphTarget\r\n */\r\n MorphTarget.prototype.clone = function () {\r\n var _this = this;\r\n var newOne = SerializationHelper.Clone(function () { return new MorphTarget(_this.name, _this.influence, _this._scene); }, this);\r\n newOne._positions = this._positions;\r\n newOne._normals = this._normals;\r\n newOne._tangents = this._tangents;\r\n newOne._uvs = this._uvs;\r\n return newOne;\r\n };\r\n /**\r\n * Serializes the current target into a Serialization object\r\n * @returns the serialized object\r\n */\r\n MorphTarget.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.name = this.name;\r\n serializationObject.influence = this.influence;\r\n serializationObject.positions = Array.prototype.slice.call(this.getPositions());\r\n if (this.id != null) {\r\n serializationObject.id = this.id;\r\n }\r\n if (this.hasNormals) {\r\n serializationObject.normals = Array.prototype.slice.call(this.getNormals());\r\n }\r\n if (this.hasTangents) {\r\n serializationObject.tangents = Array.prototype.slice.call(this.getTangents());\r\n }\r\n if (this.hasUVs) {\r\n serializationObject.uvs = Array.prototype.slice.call(this.getUVs());\r\n }\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n return serializationObject;\r\n };\r\n /**\r\n * Returns the string \"MorphTarget\"\r\n * @returns \"MorphTarget\"\r\n */\r\n MorphTarget.prototype.getClassName = function () {\r\n return \"MorphTarget\";\r\n };\r\n // Statics\r\n /**\r\n * Creates a new target from serialized data\r\n * @param serializationObject defines the serialized data to use\r\n * @returns a new MorphTarget\r\n */\r\n MorphTarget.Parse = function (serializationObject) {\r\n var result = new MorphTarget(serializationObject.name, serializationObject.influence);\r\n result.setPositions(serializationObject.positions);\r\n if (serializationObject.id != null) {\r\n result.id = serializationObject.id;\r\n }\r\n if (serializationObject.normals) {\r\n result.setNormals(serializationObject.normals);\r\n }\r\n if (serializationObject.tangents) {\r\n result.setTangents(serializationObject.tangents);\r\n }\r\n if (serializationObject.uvs) {\r\n result.setUVs(serializationObject.uvs);\r\n }\r\n // Animations\r\n if (serializationObject.animations) {\r\n for (var animationIndex = 0; animationIndex < serializationObject.animations.length; animationIndex++) {\r\n var parsedAnimation = serializationObject.animations[animationIndex];\r\n var internalClass = _TypeStore.GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n result.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n /**\r\n * Creates a MorphTarget from mesh data\r\n * @param mesh defines the source mesh\r\n * @param name defines the name to use for the new target\r\n * @param influence defines the influence to attach to the target\r\n * @returns a new MorphTarget\r\n */\r\n MorphTarget.FromMesh = function (mesh, name, influence) {\r\n if (!name) {\r\n name = mesh.name;\r\n }\r\n var result = new MorphTarget(name, influence, mesh.getScene());\r\n result.setPositions(mesh.getVerticesData(VertexBuffer.PositionKind));\r\n if (mesh.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n result.setNormals(mesh.getVerticesData(VertexBuffer.NormalKind));\r\n }\r\n if (mesh.isVerticesDataPresent(VertexBuffer.TangentKind)) {\r\n result.setTangents(mesh.getVerticesData(VertexBuffer.TangentKind));\r\n }\r\n if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n result.setUVs(mesh.getVerticesData(VertexBuffer.UVKind));\r\n }\r\n return result;\r\n };\r\n __decorate([\r\n serialize()\r\n ], MorphTarget.prototype, \"id\", void 0);\r\n return MorphTarget;\r\n}());\r\nexport { MorphTarget };\r\n//# sourceMappingURL=morphTarget.js.map","import { SmartArray } from \"../Misc/smartArray\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { MorphTarget } from \"./morphTarget\";\r\n/**\r\n * This class is used to deform meshes using morphing between different targets\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_morphtargets\r\n */\r\nvar MorphTargetManager = /** @class */ (function () {\r\n /**\r\n * Creates a new MorphTargetManager\r\n * @param scene defines the current scene\r\n */\r\n function MorphTargetManager(scene) {\r\n if (scene === void 0) { scene = null; }\r\n this._targets = new Array();\r\n this._targetInfluenceChangedObservers = new Array();\r\n this._targetDataLayoutChangedObservers = new Array();\r\n this._activeTargets = new SmartArray(16);\r\n this._supportsNormals = false;\r\n this._supportsTangents = false;\r\n this._supportsUVs = false;\r\n this._vertexCount = 0;\r\n this._uniqueId = 0;\r\n this._tempInfluences = new Array();\r\n /**\r\n * Gets or sets a boolean indicating if normals must be morphed\r\n */\r\n this.enableNormalMorphing = true;\r\n /**\r\n * Gets or sets a boolean indicating if tangents must be morphed\r\n */\r\n this.enableTangentMorphing = true;\r\n /**\r\n * Gets or sets a boolean indicating if UV must be morphed\r\n */\r\n this.enableUVMorphing = true;\r\n if (!scene) {\r\n scene = EngineStore.LastCreatedScene;\r\n }\r\n this._scene = scene;\r\n if (this._scene) {\r\n this._scene.morphTargetManagers.push(this);\r\n this._uniqueId = this._scene.getUniqueId();\r\n }\r\n }\r\n Object.defineProperty(MorphTargetManager.prototype, \"uniqueId\", {\r\n /**\r\n * Gets the unique ID of this manager\r\n */\r\n get: function () {\r\n return this._uniqueId;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"vertexCount\", {\r\n /**\r\n * Gets the number of vertices handled by this manager\r\n */\r\n get: function () {\r\n return this._vertexCount;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"supportsNormals\", {\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of normals\r\n */\r\n get: function () {\r\n return this._supportsNormals && this.enableNormalMorphing;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"supportsTangents\", {\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of tangents\r\n */\r\n get: function () {\r\n return this._supportsTangents && this.enableTangentMorphing;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"supportsUVs\", {\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of texture coordinates\r\n */\r\n get: function () {\r\n return this._supportsUVs && this.enableUVMorphing;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"numTargets\", {\r\n /**\r\n * Gets the number of targets stored in this manager\r\n */\r\n get: function () {\r\n return this._targets.length;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"numInfluencers\", {\r\n /**\r\n * Gets the number of influencers (ie. the number of targets with influences > 0)\r\n */\r\n get: function () {\r\n return this._activeTargets.length;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(MorphTargetManager.prototype, \"influences\", {\r\n /**\r\n * Gets the list of influences (one per target)\r\n */\r\n get: function () {\r\n return this._influences;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Gets the active target at specified index. An active target is a target with an influence > 0\r\n * @param index defines the index to check\r\n * @returns the requested target\r\n */\r\n MorphTargetManager.prototype.getActiveTarget = function (index) {\r\n return this._activeTargets.data[index];\r\n };\r\n /**\r\n * Gets the target at specified index\r\n * @param index defines the index to check\r\n * @returns the requested target\r\n */\r\n MorphTargetManager.prototype.getTarget = function (index) {\r\n return this._targets[index];\r\n };\r\n /**\r\n * Add a new target to this manager\r\n * @param target defines the target to add\r\n */\r\n MorphTargetManager.prototype.addTarget = function (target) {\r\n var _this = this;\r\n this._targets.push(target);\r\n this._targetInfluenceChangedObservers.push(target.onInfluenceChanged.add(function (needUpdate) {\r\n _this._syncActiveTargets(needUpdate);\r\n }));\r\n this._targetDataLayoutChangedObservers.push(target._onDataLayoutChanged.add(function () {\r\n _this._syncActiveTargets(true);\r\n }));\r\n this._syncActiveTargets(true);\r\n };\r\n /**\r\n * Removes a target from the manager\r\n * @param target defines the target to remove\r\n */\r\n MorphTargetManager.prototype.removeTarget = function (target) {\r\n var index = this._targets.indexOf(target);\r\n if (index >= 0) {\r\n this._targets.splice(index, 1);\r\n target.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(index, 1)[0]);\r\n target._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(index, 1)[0]);\r\n this._syncActiveTargets(true);\r\n }\r\n };\r\n /**\r\n * Clone the current manager\r\n * @returns a new MorphTargetManager\r\n */\r\n MorphTargetManager.prototype.clone = function () {\r\n var copy = new MorphTargetManager(this._scene);\r\n for (var _i = 0, _a = this._targets; _i < _a.length; _i++) {\r\n var target = _a[_i];\r\n copy.addTarget(target.clone());\r\n }\r\n copy.enableNormalMorphing = this.enableNormalMorphing;\r\n copy.enableTangentMorphing = this.enableTangentMorphing;\r\n copy.enableUVMorphing = this.enableUVMorphing;\r\n return copy;\r\n };\r\n /**\r\n * Serializes the current manager into a Serialization object\r\n * @returns the serialized object\r\n */\r\n MorphTargetManager.prototype.serialize = function () {\r\n var serializationObject = {};\r\n serializationObject.id = this.uniqueId;\r\n serializationObject.targets = [];\r\n for (var _i = 0, _a = this._targets; _i < _a.length; _i++) {\r\n var target = _a[_i];\r\n serializationObject.targets.push(target.serialize());\r\n }\r\n return serializationObject;\r\n };\r\n MorphTargetManager.prototype._syncActiveTargets = function (needUpdate) {\r\n var influenceCount = 0;\r\n this._activeTargets.reset();\r\n this._supportsNormals = true;\r\n this._supportsTangents = true;\r\n this._supportsUVs = true;\r\n this._vertexCount = 0;\r\n for (var _i = 0, _a = this._targets; _i < _a.length; _i++) {\r\n var target = _a[_i];\r\n if (target.influence === 0) {\r\n continue;\r\n }\r\n this._activeTargets.push(target);\r\n this._tempInfluences[influenceCount++] = target.influence;\r\n this._supportsNormals = this._supportsNormals && target.hasNormals;\r\n this._supportsTangents = this._supportsTangents && target.hasTangents;\r\n this._supportsUVs = this._supportsUVs && target.hasUVs;\r\n var positions = target.getPositions();\r\n if (positions) {\r\n var vertexCount = positions.length / 3;\r\n if (this._vertexCount === 0) {\r\n this._vertexCount = vertexCount;\r\n }\r\n else if (this._vertexCount !== vertexCount) {\r\n Logger.Error(\"Incompatible target. Targets must all have the same vertices count.\");\r\n return;\r\n }\r\n }\r\n }\r\n if (!this._influences || this._influences.length !== influenceCount) {\r\n this._influences = new Float32Array(influenceCount);\r\n }\r\n for (var index = 0; index < influenceCount; index++) {\r\n this._influences[index] = this._tempInfluences[index];\r\n }\r\n if (needUpdate) {\r\n this.synchronize();\r\n }\r\n };\r\n /**\r\n * Syncrhonize the targets with all the meshes using this morph target manager\r\n */\r\n MorphTargetManager.prototype.synchronize = function () {\r\n if (!this._scene) {\r\n return;\r\n }\r\n // Flag meshes as dirty to resync with the active targets\r\n for (var _i = 0, _a = this._scene.meshes; _i < _a.length; _i++) {\r\n var mesh = _a[_i];\r\n if (mesh.morphTargetManager === this) {\r\n mesh._syncGeometryWithMorphTargetManager();\r\n }\r\n }\r\n };\r\n // Statics\r\n /**\r\n * Creates a new MorphTargetManager from serialized data\r\n * @param serializationObject defines the serialized data\r\n * @param scene defines the hosting scene\r\n * @returns the new MorphTargetManager\r\n */\r\n MorphTargetManager.Parse = function (serializationObject, scene) {\r\n var result = new MorphTargetManager(scene);\r\n result._uniqueId = serializationObject.id;\r\n for (var _i = 0, _a = serializationObject.targets; _i < _a.length; _i++) {\r\n var targetData = _a[_i];\r\n result.addTarget(MorphTarget.Parse(targetData));\r\n }\r\n return result;\r\n };\r\n return MorphTargetManager;\r\n}());\r\nexport { MorphTargetManager };\r\n//# sourceMappingURL=morphTargetManager.js.map","import { Deferred } from \"@babylonjs/core/Misc/deferred\";\r\nimport { Quaternion, Vector3, Matrix } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { Camera } from \"@babylonjs/core/Cameras/camera\";\r\nimport { FreeCamera } from \"@babylonjs/core/Cameras/freeCamera\";\r\nimport { AnimationGroup } from \"@babylonjs/core/Animations/animationGroup\";\r\nimport { Animation } from \"@babylonjs/core/Animations/animation\";\r\nimport { Bone } from \"@babylonjs/core/Bones/bone\";\r\nimport { Skeleton } from \"@babylonjs/core/Bones/skeleton\";\r\nimport { Material } from \"@babylonjs/core/Materials/material\";\r\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\r\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\r\nimport { Buffer, VertexBuffer } from \"@babylonjs/core/Meshes/buffer\";\r\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { MorphTarget } from \"@babylonjs/core/Morph/morphTarget\";\r\nimport { MorphTargetManager } from \"@babylonjs/core/Morph/morphTargetManager\";\r\nimport { GLTFFileLoader, GLTFLoaderState, GLTFLoaderCoordinateSystemMode, GLTFLoaderAnimationStartMode } from \"../glTFFileLoader\";\r\nimport { AnimationKeyInterpolation } from '@babylonjs/core/Animations/animationKey';\r\nimport { LoadFileError } from '@babylonjs/core/Misc/fileTools';\r\nimport { Logger } from '@babylonjs/core/Misc/logger';\r\nimport { TmpVectors } from '@babylonjs/core/Maths/math.vector';\r\nimport { BoundingInfo } from '@babylonjs/core/Culling/boundingInfo';\r\n/**\r\n * Helper class for working with arrays when loading the glTF asset\r\n */\r\nvar ArrayItem = /** @class */ (function () {\r\n function ArrayItem() {\r\n }\r\n /**\r\n * Gets an item from the given array.\r\n * @param context The context when loading the asset\r\n * @param array The array to get the item from\r\n * @param index The index to the array\r\n * @returns The array item\r\n */\r\n ArrayItem.Get = function (context, array, index) {\r\n if (!array || index == undefined || !array[index]) {\r\n throw new Error(context + \": Failed to find index (\" + index + \")\");\r\n }\r\n return array[index];\r\n };\r\n /**\r\n * Assign an `index` field to each item of the given array.\r\n * @param array The array of items\r\n */\r\n ArrayItem.Assign = function (array) {\r\n if (array) {\r\n for (var index = 0; index < array.length; index++) {\r\n array[index].index = index;\r\n }\r\n }\r\n };\r\n return ArrayItem;\r\n}());\r\nexport { ArrayItem };\r\n/**\r\n * The glTF 2.0 loader\r\n */\r\nvar GLTFLoader = /** @class */ (function () {\r\n /** @hidden */\r\n function GLTFLoader(parent) {\r\n /** @hidden */\r\n this._completePromises = new Array();\r\n /** @hidden */\r\n this._forAssetContainer = false;\r\n /** Storage */\r\n this._babylonLights = [];\r\n /** @hidden */\r\n this._disableInstancedMesh = 0;\r\n this._disposed = false;\r\n this._state = null;\r\n this._extensions = new Array();\r\n this._defaultBabylonMaterialData = {};\r\n this._parent = parent;\r\n }\r\n /**\r\n * Registers a loader extension.\r\n * @param name The name of the loader extension.\r\n * @param factory The factory function that creates the loader extension.\r\n */\r\n GLTFLoader.RegisterExtension = function (name, factory) {\r\n if (GLTFLoader.UnregisterExtension(name)) {\r\n Logger.Warn(\"Extension with the name '\" + name + \"' already exists\");\r\n }\r\n GLTFLoader._RegisteredExtensions[name] = {\r\n factory: factory\r\n };\r\n };\r\n /**\r\n * Unregisters a loader extension.\r\n * @param name The name of the loader extension.\r\n * @returns A boolean indicating whether the extension has been unregistered\r\n */\r\n GLTFLoader.UnregisterExtension = function (name) {\r\n if (!GLTFLoader._RegisteredExtensions[name]) {\r\n return false;\r\n }\r\n delete GLTFLoader._RegisteredExtensions[name];\r\n return true;\r\n };\r\n Object.defineProperty(GLTFLoader.prototype, \"state\", {\r\n /**\r\n * The loader state.\r\n */\r\n get: function () {\r\n return this._state;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFLoader.prototype, \"gltf\", {\r\n /**\r\n * The object that represents the glTF JSON.\r\n */\r\n get: function () {\r\n return this._gltf;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFLoader.prototype, \"bin\", {\r\n /**\r\n * The BIN chunk of a binary glTF.\r\n */\r\n get: function () {\r\n return this._bin;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFLoader.prototype, \"parent\", {\r\n /**\r\n * The parent file loader.\r\n */\r\n get: function () {\r\n return this._parent;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFLoader.prototype, \"babylonScene\", {\r\n /**\r\n * The Babylon scene when loading the asset.\r\n */\r\n get: function () {\r\n return this._babylonScene;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(GLTFLoader.prototype, \"rootBabylonMesh\", {\r\n /**\r\n * The root Babylon mesh when loading the asset.\r\n */\r\n get: function () {\r\n return this._rootBabylonMesh;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n GLTFLoader.prototype.dispose = function () {\r\n if (this._disposed) {\r\n return;\r\n }\r\n this._disposed = true;\r\n this._completePromises.length = 0;\r\n for (var name_1 in this._extensions) {\r\n var extension = this._extensions[name_1];\r\n extension.dispose && extension.dispose();\r\n delete this._extensions[name_1];\r\n }\r\n this._gltf = null;\r\n this._babylonScene = null;\r\n this._rootBabylonMesh = null;\r\n this._parent.dispose();\r\n };\r\n /** @hidden */\r\n GLTFLoader.prototype.importMeshAsync = function (meshesNames, scene, forAssetContainer, data, rootUrl, onProgress, fileName) {\r\n var _this = this;\r\n return Promise.resolve().then(function () {\r\n _this._babylonScene = scene;\r\n _this._rootUrl = rootUrl;\r\n _this._fileName = fileName || \"scene\";\r\n _this._forAssetContainer = forAssetContainer;\r\n _this._loadData(data);\r\n var nodes = null;\r\n if (meshesNames) {\r\n var nodeMap_1 = {};\r\n if (_this._gltf.nodes) {\r\n for (var _i = 0, _a = _this._gltf.nodes; _i < _a.length; _i++) {\r\n var node = _a[_i];\r\n if (node.name) {\r\n nodeMap_1[node.name] = node.index;\r\n }\r\n }\r\n }\r\n var names = (meshesNames instanceof Array) ? meshesNames : [meshesNames];\r\n nodes = names.map(function (name) {\r\n var node = nodeMap_1[name];\r\n if (node === undefined) {\r\n throw new Error(\"Failed to find node '\" + name + \"'\");\r\n }\r\n return node;\r\n });\r\n }\r\n return _this._loadAsync(nodes, function () {\r\n return {\r\n meshes: _this._getMeshes(),\r\n particleSystems: [],\r\n skeletons: _this._getSkeletons(),\r\n animationGroups: _this._getAnimationGroups(),\r\n lights: _this._babylonLights,\r\n transformNodes: _this._getTransformNodes(),\r\n geometries: _this._getGeometries()\r\n };\r\n });\r\n });\r\n };\r\n /** @hidden */\r\n GLTFLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress, fileName) {\r\n var _this = this;\r\n return Promise.resolve().then(function () {\r\n _this._babylonScene = scene;\r\n _this._rootUrl = rootUrl;\r\n _this._fileName = fileName || \"scene\";\r\n _this._loadData(data);\r\n return _this._loadAsync(null, function () { return undefined; });\r\n });\r\n };\r\n GLTFLoader.prototype._loadAsync = function (nodes, resultFunc) {\r\n var _this = this;\r\n return Promise.resolve().then(function () {\r\n _this._uniqueRootUrl = (_this._rootUrl.indexOf(\"file:\") === -1 && _this._fileName) ? _this._rootUrl : \"\" + _this._rootUrl + Date.now() + \"/\";\r\n _this._loadExtensions();\r\n _this._checkExtensions();\r\n var loadingToReadyCounterName = GLTFLoaderState[GLTFLoaderState.LOADING] + \" => \" + GLTFLoaderState[GLTFLoaderState.READY];\r\n var loadingToCompleteCounterName = GLTFLoaderState[GLTFLoaderState.LOADING] + \" => \" + GLTFLoaderState[GLTFLoaderState.COMPLETE];\r\n _this._parent._startPerformanceCounter(loadingToReadyCounterName);\r\n _this._parent._startPerformanceCounter(loadingToCompleteCounterName);\r\n _this._setState(GLTFLoaderState.LOADING);\r\n _this._extensionsOnLoading();\r\n var promises = new Array();\r\n // Block the marking of materials dirty until the scene is loaded.\r\n var oldBlockMaterialDirtyMechanism = _this._babylonScene.blockMaterialDirtyMechanism;\r\n _this._babylonScene.blockMaterialDirtyMechanism = true;\r\n if (nodes) {\r\n promises.push(_this.loadSceneAsync(\"/nodes\", { nodes: nodes, index: -1 }));\r\n }\r\n else if (_this._gltf.scene != undefined || (_this._gltf.scenes && _this._gltf.scenes[0])) {\r\n var scene = ArrayItem.Get(\"/scene\", _this._gltf.scenes, _this._gltf.scene || 0);\r\n promises.push(_this.loadSceneAsync(\"/scenes/\" + scene.index, scene));\r\n }\r\n if (_this.parent.loadAllMaterials && _this._gltf.materials) {\r\n for (var m = 0; m < _this._gltf.materials.length; ++m) {\r\n var material = _this._gltf.materials[m];\r\n var context_1 = \"/materials/\" + m;\r\n var babylonDrawMode = Material.TriangleFillMode;\r\n promises.push(_this._loadMaterialAsync(context_1, material, null, babylonDrawMode, function (material) { }));\r\n }\r\n }\r\n // Restore the blocking of material dirty.\r\n _this._babylonScene.blockMaterialDirtyMechanism = oldBlockMaterialDirtyMechanism;\r\n if (_this._parent.compileMaterials) {\r\n promises.push(_this._compileMaterialsAsync());\r\n }\r\n if (_this._parent.compileShadowGenerators) {\r\n promises.push(_this._compileShadowGeneratorsAsync());\r\n }\r\n var resultPromise = Promise.all(promises).then(function () {\r\n if (_this._rootBabylonMesh) {\r\n _this._rootBabylonMesh.setEnabled(true);\r\n }\r\n _this._extensionsOnReady();\r\n _this._setState(GLTFLoaderState.READY);\r\n _this._startAnimations();\r\n return resultFunc();\r\n });\r\n resultPromise.then(function () {\r\n _this._parent._endPerformanceCounter(loadingToReadyCounterName);\r\n Tools.SetImmediate(function () {\r\n if (!_this._disposed) {\r\n Promise.all(_this._completePromises).then(function () {\r\n _this._parent._endPerformanceCounter(loadingToCompleteCounterName);\r\n _this._setState(GLTFLoaderState.COMPLETE);\r\n _this._parent.onCompleteObservable.notifyObservers(undefined);\r\n _this._parent.onCompleteObservable.clear();\r\n _this.dispose();\r\n }, function (error) {\r\n _this._parent.onErrorObservable.notifyObservers(error);\r\n _this._parent.onErrorObservable.clear();\r\n _this.dispose();\r\n });\r\n }\r\n });\r\n });\r\n return resultPromise;\r\n }).catch(function (error) {\r\n if (!_this._disposed) {\r\n _this._parent.onErrorObservable.notifyObservers(error);\r\n _this._parent.onErrorObservable.clear();\r\n _this.dispose();\r\n }\r\n throw error;\r\n });\r\n };\r\n GLTFLoader.prototype._loadData = function (data) {\r\n this._gltf = data.json;\r\n this._setupData();\r\n if (data.bin) {\r\n var buffers = this._gltf.buffers;\r\n if (buffers && buffers[0] && !buffers[0].uri) {\r\n var binaryBuffer = buffers[0];\r\n if (binaryBuffer.byteLength < data.bin.byteLength - 3 || binaryBuffer.byteLength > data.bin.byteLength) {\r\n Logger.Warn(\"Binary buffer length (\" + binaryBuffer.byteLength + \") from JSON does not match chunk length (\" + data.bin.byteLength + \")\");\r\n }\r\n this._bin = data.bin;\r\n }\r\n else {\r\n Logger.Warn(\"Unexpected BIN chunk\");\r\n }\r\n }\r\n };\r\n GLTFLoader.prototype._setupData = function () {\r\n ArrayItem.Assign(this._gltf.accessors);\r\n ArrayItem.Assign(this._gltf.animations);\r\n ArrayItem.Assign(this._gltf.buffers);\r\n ArrayItem.Assign(this._gltf.bufferViews);\r\n ArrayItem.Assign(this._gltf.cameras);\r\n ArrayItem.Assign(this._gltf.images);\r\n ArrayItem.Assign(this._gltf.materials);\r\n ArrayItem.Assign(this._gltf.meshes);\r\n ArrayItem.Assign(this._gltf.nodes);\r\n ArrayItem.Assign(this._gltf.samplers);\r\n ArrayItem.Assign(this._gltf.scenes);\r\n ArrayItem.Assign(this._gltf.skins);\r\n ArrayItem.Assign(this._gltf.textures);\r\n if (this._gltf.nodes) {\r\n var nodeParents = {};\r\n for (var _i = 0, _a = this._gltf.nodes; _i < _a.length; _i++) {\r\n var node = _a[_i];\r\n if (node.children) {\r\n for (var _b = 0, _c = node.children; _b < _c.length; _b++) {\r\n var index = _c[_b];\r\n nodeParents[index] = node.index;\r\n }\r\n }\r\n }\r\n var rootNode = this._createRootNode();\r\n for (var _d = 0, _e = this._gltf.nodes; _d < _e.length; _d++) {\r\n var node = _e[_d];\r\n var parentIndex = nodeParents[node.index];\r\n node.parent = parentIndex === undefined ? rootNode : this._gltf.nodes[parentIndex];\r\n }\r\n }\r\n };\r\n GLTFLoader.prototype._loadExtensions = function () {\r\n for (var name_2 in GLTFLoader._RegisteredExtensions) {\r\n var extension = GLTFLoader._RegisteredExtensions[name_2].factory(this);\r\n if (extension.name !== name_2) {\r\n Logger.Warn(\"The name of the glTF loader extension instance does not match the registered name: \" + extension.name + \" !== \" + name_2);\r\n }\r\n this._extensions.push(extension);\r\n this._parent.onExtensionLoadedObservable.notifyObservers(extension);\r\n }\r\n this._extensions.sort(function (a, b) { return (a.order || Number.MAX_VALUE) - (b.order || Number.MAX_VALUE); });\r\n this._parent.onExtensionLoadedObservable.clear();\r\n };\r\n GLTFLoader.prototype._checkExtensions = function () {\r\n if (this._gltf.extensionsRequired) {\r\n var _loop_1 = function (name_3) {\r\n var available = this_1._extensions.some(function (extension) { return extension.name === name_3 && extension.enabled; });\r\n if (!available) {\r\n throw new Error(\"Require extension \" + name_3 + \" is not available\");\r\n }\r\n };\r\n var this_1 = this;\r\n for (var _i = 0, _a = this._gltf.extensionsRequired; _i < _a.length; _i++) {\r\n var name_3 = _a[_i];\r\n _loop_1(name_3);\r\n }\r\n }\r\n };\r\n GLTFLoader.prototype._setState = function (state) {\r\n this._state = state;\r\n this.log(GLTFLoaderState[this._state]);\r\n };\r\n GLTFLoader.prototype._createRootNode = function () {\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n this._rootBabylonMesh = new Mesh(\"__root__\", this._babylonScene);\r\n this._babylonScene._blockEntityCollection = false;\r\n this._rootBabylonMesh.setEnabled(false);\r\n var rootNode = {\r\n _babylonTransformNode: this._rootBabylonMesh,\r\n index: -1\r\n };\r\n switch (this._parent.coordinateSystemMode) {\r\n case GLTFLoaderCoordinateSystemMode.AUTO: {\r\n if (!this._babylonScene.useRightHandedSystem) {\r\n rootNode.rotation = [0, 1, 0, 0];\r\n rootNode.scale = [1, 1, -1];\r\n GLTFLoader._LoadTransform(rootNode, this._rootBabylonMesh);\r\n }\r\n break;\r\n }\r\n case GLTFLoaderCoordinateSystemMode.FORCE_RIGHT_HANDED: {\r\n this._babylonScene.useRightHandedSystem = true;\r\n break;\r\n }\r\n default: {\r\n throw new Error(\"Invalid coordinate system mode (\" + this._parent.coordinateSystemMode + \")\");\r\n }\r\n }\r\n this._parent.onMeshLoadedObservable.notifyObservers(this._rootBabylonMesh);\r\n return rootNode;\r\n };\r\n /**\r\n * Loads a glTF scene.\r\n * @param context The context when loading the asset\r\n * @param scene The glTF scene property\r\n * @returns A promise that resolves when the load is complete\r\n */\r\n GLTFLoader.prototype.loadSceneAsync = function (context, scene) {\r\n var _this = this;\r\n var extensionPromise = this._extensionsLoadSceneAsync(context, scene);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n var promises = new Array();\r\n this.logOpen(context + \" \" + (scene.name || \"\"));\r\n if (scene.nodes) {\r\n for (var _i = 0, _a = scene.nodes; _i < _a.length; _i++) {\r\n var index = _a[_i];\r\n var node = ArrayItem.Get(context + \"/nodes/\" + index, this._gltf.nodes, index);\r\n promises.push(this.loadNodeAsync(\"/nodes/\" + node.index, node, function (babylonMesh) {\r\n babylonMesh.parent = _this._rootBabylonMesh;\r\n }));\r\n }\r\n }\r\n // Link all Babylon bones for each glTF node with the corresponding Babylon transform node.\r\n // A glTF joint is a pointer to a glTF node in the glTF node hierarchy similar to Unity3D.\r\n if (this._gltf.nodes) {\r\n for (var _b = 0, _c = this._gltf.nodes; _b < _c.length; _b++) {\r\n var node = _c[_b];\r\n if (node._babylonTransformNode && node._babylonBones) {\r\n for (var _d = 0, _e = node._babylonBones; _d < _e.length; _d++) {\r\n var babylonBone = _e[_d];\r\n babylonBone.linkTransformNode(node._babylonTransformNode);\r\n }\r\n }\r\n }\r\n }\r\n promises.push(this._loadAnimationsAsync());\r\n this.logClose();\r\n return Promise.all(promises).then(function () { });\r\n };\r\n GLTFLoader.prototype._forEachPrimitive = function (node, callback) {\r\n if (node._primitiveBabylonMeshes) {\r\n for (var _i = 0, _a = node._primitiveBabylonMeshes; _i < _a.length; _i++) {\r\n var babylonMesh = _a[_i];\r\n callback(babylonMesh);\r\n }\r\n }\r\n };\r\n GLTFLoader.prototype._getGeometries = function () {\r\n var geometries = new Array();\r\n var nodes = this._gltf.nodes;\r\n if (nodes) {\r\n for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {\r\n var node = nodes_1[_i];\r\n this._forEachPrimitive(node, function (babylonMesh) {\r\n var geometry = babylonMesh.geometry;\r\n if (geometry && geometries.indexOf(geometry) === -1) {\r\n geometries.push(geometry);\r\n }\r\n });\r\n }\r\n }\r\n return geometries;\r\n };\r\n GLTFLoader.prototype._getMeshes = function () {\r\n var meshes = new Array();\r\n // Root mesh is always first.\r\n meshes.push(this._rootBabylonMesh);\r\n var nodes = this._gltf.nodes;\r\n if (nodes) {\r\n for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {\r\n var node = nodes_2[_i];\r\n this._forEachPrimitive(node, function (babylonMesh) {\r\n meshes.push(babylonMesh);\r\n });\r\n }\r\n }\r\n return meshes;\r\n };\r\n GLTFLoader.prototype._getTransformNodes = function () {\r\n var transformNodes = new Array();\r\n var nodes = this._gltf.nodes;\r\n if (nodes) {\r\n for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {\r\n var node = nodes_3[_i];\r\n if (node._babylonTransformNode && node._babylonTransformNode.getClassName() === \"TransformNode\") {\r\n transformNodes.push(node._babylonTransformNode);\r\n }\r\n }\r\n }\r\n return transformNodes;\r\n };\r\n GLTFLoader.prototype._getSkeletons = function () {\r\n var skeletons = new Array();\r\n var skins = this._gltf.skins;\r\n if (skins) {\r\n for (var _i = 0, skins_1 = skins; _i < skins_1.length; _i++) {\r\n var skin = skins_1[_i];\r\n if (skin._data) {\r\n skeletons.push(skin._data.babylonSkeleton);\r\n }\r\n }\r\n }\r\n return skeletons;\r\n };\r\n GLTFLoader.prototype._getAnimationGroups = function () {\r\n var animationGroups = new Array();\r\n var animations = this._gltf.animations;\r\n if (animations) {\r\n for (var _i = 0, animations_1 = animations; _i < animations_1.length; _i++) {\r\n var animation = animations_1[_i];\r\n if (animation._babylonAnimationGroup) {\r\n animationGroups.push(animation._babylonAnimationGroup);\r\n }\r\n }\r\n }\r\n return animationGroups;\r\n };\r\n GLTFLoader.prototype._startAnimations = function () {\r\n switch (this._parent.animationStartMode) {\r\n case GLTFLoaderAnimationStartMode.NONE: {\r\n // do nothing\r\n break;\r\n }\r\n case GLTFLoaderAnimationStartMode.FIRST: {\r\n var babylonAnimationGroups = this._getAnimationGroups();\r\n if (babylonAnimationGroups.length !== 0) {\r\n babylonAnimationGroups[0].start(true);\r\n }\r\n break;\r\n }\r\n case GLTFLoaderAnimationStartMode.ALL: {\r\n var babylonAnimationGroups = this._getAnimationGroups();\r\n for (var _i = 0, babylonAnimationGroups_1 = babylonAnimationGroups; _i < babylonAnimationGroups_1.length; _i++) {\r\n var babylonAnimationGroup = babylonAnimationGroups_1[_i];\r\n babylonAnimationGroup.start(true);\r\n }\r\n break;\r\n }\r\n default: {\r\n Logger.Error(\"Invalid animation start mode (\" + this._parent.animationStartMode + \")\");\r\n return;\r\n }\r\n }\r\n };\r\n /**\r\n * Loads a glTF node.\r\n * @param context The context when loading the asset\r\n * @param node The glTF node property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon mesh when the load is complete\r\n */\r\n GLTFLoader.prototype.loadNodeAsync = function (context, node, assign) {\r\n var _this = this;\r\n if (assign === void 0) { assign = function () { }; }\r\n var extensionPromise = this._extensionsLoadNodeAsync(context, node, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n if (node._babylonTransformNode) {\r\n throw new Error(context + \": Invalid recursive node hierarchy\");\r\n }\r\n var promises = new Array();\r\n this.logOpen(context + \" \" + (node.name || \"\"));\r\n var loadNode = function (babylonTransformNode) {\r\n GLTFLoader.AddPointerMetadata(babylonTransformNode, context);\r\n GLTFLoader._LoadTransform(node, babylonTransformNode);\r\n if (node.camera != undefined) {\r\n var camera = ArrayItem.Get(context + \"/camera\", _this._gltf.cameras, node.camera);\r\n promises.push(_this.loadCameraAsync(\"/cameras/\" + camera.index, camera, function (babylonCamera) {\r\n babylonCamera.parent = babylonTransformNode;\r\n }));\r\n }\r\n if (node.children) {\r\n for (var _i = 0, _a = node.children; _i < _a.length; _i++) {\r\n var index = _a[_i];\r\n var childNode = ArrayItem.Get(context + \"/children/\" + index, _this._gltf.nodes, index);\r\n promises.push(_this.loadNodeAsync(\"/nodes/\" + childNode.index, childNode, function (childBabylonMesh) {\r\n childBabylonMesh.parent = babylonTransformNode;\r\n }));\r\n }\r\n }\r\n assign(babylonTransformNode);\r\n };\r\n if (node.mesh == undefined) {\r\n var nodeName = node.name || \"node\" + node.index;\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n node._babylonTransformNode = new TransformNode(nodeName, this._babylonScene);\r\n this._babylonScene._blockEntityCollection = false;\r\n loadNode(node._babylonTransformNode);\r\n }\r\n else {\r\n var mesh = ArrayItem.Get(context + \"/mesh\", this._gltf.meshes, node.mesh);\r\n promises.push(this._loadMeshAsync(\"/meshes/\" + mesh.index, node, mesh, loadNode));\r\n }\r\n this.logClose();\r\n return Promise.all(promises).then(function () {\r\n _this._forEachPrimitive(node, function (babylonMesh) {\r\n if (babylonMesh.geometry && babylonMesh.geometry.useBoundingInfoFromGeometry) {\r\n // simply apply the world matrices to the bounding info - the extends are already ok\r\n babylonMesh._updateBoundingInfo();\r\n }\r\n else {\r\n babylonMesh.refreshBoundingInfo(true);\r\n }\r\n });\r\n return node._babylonTransformNode;\r\n });\r\n };\r\n GLTFLoader.prototype._loadMeshAsync = function (context, node, mesh, assign) {\r\n var primitives = mesh.primitives;\r\n if (!primitives || !primitives.length) {\r\n throw new Error(context + \": Primitives are missing\");\r\n }\r\n if (primitives[0].index == undefined) {\r\n ArrayItem.Assign(primitives);\r\n }\r\n var promises = new Array();\r\n this.logOpen(context + \" \" + (mesh.name || \"\"));\r\n var name = node.name || \"node\" + node.index;\r\n if (primitives.length === 1) {\r\n var primitive = mesh.primitives[0];\r\n promises.push(this._loadMeshPrimitiveAsync(context + \"/primitives/\" + primitive.index, name, node, mesh, primitive, function (babylonMesh) {\r\n node._babylonTransformNode = babylonMesh;\r\n node._primitiveBabylonMeshes = [babylonMesh];\r\n }));\r\n }\r\n else {\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n node._babylonTransformNode = new TransformNode(name, this._babylonScene);\r\n this._babylonScene._blockEntityCollection = false;\r\n node._primitiveBabylonMeshes = [];\r\n for (var _i = 0, primitives_1 = primitives; _i < primitives_1.length; _i++) {\r\n var primitive = primitives_1[_i];\r\n promises.push(this._loadMeshPrimitiveAsync(context + \"/primitives/\" + primitive.index, name + \"_primitive\" + primitive.index, node, mesh, primitive, function (babylonMesh) {\r\n babylonMesh.parent = node._babylonTransformNode;\r\n node._primitiveBabylonMeshes.push(babylonMesh);\r\n }));\r\n }\r\n }\r\n if (node.skin != undefined) {\r\n var skin = ArrayItem.Get(context + \"/skin\", this._gltf.skins, node.skin);\r\n promises.push(this._loadSkinAsync(\"/skins/\" + skin.index, node, skin));\r\n }\r\n assign(node._babylonTransformNode);\r\n this.logClose();\r\n return Promise.all(promises).then(function () {\r\n return node._babylonTransformNode;\r\n });\r\n };\r\n /**\r\n * @hidden Define this method to modify the default behavior when loading data for mesh primitives.\r\n * @param context The context when loading the asset\r\n * @param name The mesh name when loading the asset\r\n * @param node The glTF node when loading the asset\r\n * @param mesh The glTF mesh when loading the asset\r\n * @param primitive The glTF mesh primitive property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled\r\n */\r\n GLTFLoader.prototype._loadMeshPrimitiveAsync = function (context, name, node, mesh, primitive, assign) {\r\n var _this = this;\r\n var extensionPromise = this._extensionsLoadMeshPrimitiveAsync(context, name, node, mesh, primitive, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n this.logOpen(\"\" + context);\r\n var shouldInstance = (this._disableInstancedMesh === 0) && this._parent.createInstances && (node.skin == undefined && !mesh.primitives[0].targets);\r\n var babylonAbstractMesh;\r\n var promise;\r\n if (shouldInstance && primitive._instanceData) {\r\n babylonAbstractMesh = primitive._instanceData.babylonSourceMesh.createInstance(name);\r\n promise = primitive._instanceData.promise;\r\n }\r\n else {\r\n var promises = new Array();\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n var babylonMesh_1 = new Mesh(name, this._babylonScene);\r\n this._babylonScene._blockEntityCollection = false;\r\n babylonMesh_1.overrideMaterialSideOrientation = this._babylonScene.useRightHandedSystem ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\r\n this._createMorphTargets(context, node, mesh, primitive, babylonMesh_1);\r\n promises.push(this._loadVertexDataAsync(context, primitive, babylonMesh_1).then(function (babylonGeometry) {\r\n return _this._loadMorphTargetsAsync(context, primitive, babylonMesh_1, babylonGeometry).then(function () {\r\n _this._babylonScene._blockEntityCollection = _this._forAssetContainer;\r\n babylonGeometry.applyToMesh(babylonMesh_1);\r\n _this._babylonScene._blockEntityCollection = false;\r\n });\r\n }));\r\n var babylonDrawMode = GLTFLoader._GetDrawMode(context, primitive.mode);\r\n if (primitive.material == undefined) {\r\n var babylonMaterial = this._defaultBabylonMaterialData[babylonDrawMode];\r\n if (!babylonMaterial) {\r\n babylonMaterial = this._createDefaultMaterial(\"__GLTFLoader._default\", babylonDrawMode);\r\n this._parent.onMaterialLoadedObservable.notifyObservers(babylonMaterial);\r\n this._defaultBabylonMaterialData[babylonDrawMode] = babylonMaterial;\r\n }\r\n babylonMesh_1.material = babylonMaterial;\r\n }\r\n else {\r\n var material = ArrayItem.Get(context + \"/material\", this._gltf.materials, primitive.material);\r\n promises.push(this._loadMaterialAsync(\"/materials/\" + material.index, material, babylonMesh_1, babylonDrawMode, function (babylonMaterial) {\r\n babylonMesh_1.material = babylonMaterial;\r\n }));\r\n }\r\n promise = Promise.all(promises);\r\n if (shouldInstance) {\r\n primitive._instanceData = {\r\n babylonSourceMesh: babylonMesh_1,\r\n promise: promise\r\n };\r\n }\r\n babylonAbstractMesh = babylonMesh_1;\r\n }\r\n GLTFLoader.AddPointerMetadata(babylonAbstractMesh, context);\r\n this._parent.onMeshLoadedObservable.notifyObservers(babylonAbstractMesh);\r\n assign(babylonAbstractMesh);\r\n this.logClose();\r\n return promise.then(function () {\r\n return babylonAbstractMesh;\r\n });\r\n };\r\n GLTFLoader.prototype._loadVertexDataAsync = function (context, primitive, babylonMesh) {\r\n var _this = this;\r\n var extensionPromise = this._extensionsLoadVertexDataAsync(context, primitive, babylonMesh);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n var attributes = primitive.attributes;\r\n if (!attributes) {\r\n throw new Error(context + \": Attributes are missing\");\r\n }\r\n var promises = new Array();\r\n var babylonGeometry = new Geometry(babylonMesh.name, this._babylonScene);\r\n if (primitive.indices == undefined) {\r\n babylonMesh.isUnIndexed = true;\r\n }\r\n else {\r\n var accessor = ArrayItem.Get(context + \"/indices\", this._gltf.accessors, primitive.indices);\r\n promises.push(this._loadIndicesAccessorAsync(\"/accessors/\" + accessor.index, accessor).then(function (data) {\r\n babylonGeometry.setIndices(data);\r\n }));\r\n }\r\n var loadAttribute = function (attribute, kind, callback) {\r\n if (attributes[attribute] == undefined) {\r\n return;\r\n }\r\n babylonMesh._delayInfo = babylonMesh._delayInfo || [];\r\n if (babylonMesh._delayInfo.indexOf(kind) === -1) {\r\n babylonMesh._delayInfo.push(kind);\r\n }\r\n var accessor = ArrayItem.Get(context + \"/attributes/\" + attribute, _this._gltf.accessors, attributes[attribute]);\r\n promises.push(_this._loadVertexAccessorAsync(\"/accessors/\" + accessor.index, accessor, kind).then(function (babylonVertexBuffer) {\r\n if (babylonVertexBuffer.getKind() === VertexBuffer.PositionKind && !_this.parent.alwaysComputeBoundingBox && !babylonMesh.skeleton) {\r\n var mmin = accessor.min, mmax = accessor.max;\r\n if (mmin !== undefined && mmax !== undefined) {\r\n var min = TmpVectors.Vector3[0], max = TmpVectors.Vector3[1];\r\n min.copyFromFloats.apply(min, mmin);\r\n max.copyFromFloats.apply(max, mmax);\r\n babylonGeometry._boundingInfo = new BoundingInfo(min, max);\r\n babylonGeometry.useBoundingInfoFromGeometry = true;\r\n }\r\n }\r\n babylonGeometry.setVerticesBuffer(babylonVertexBuffer, accessor.count);\r\n }));\r\n if (kind == VertexBuffer.MatricesIndicesExtraKind) {\r\n babylonMesh.numBoneInfluencers = 8;\r\n }\r\n if (callback) {\r\n callback(accessor);\r\n }\r\n };\r\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind);\r\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind);\r\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind);\r\n loadAttribute(\"TEXCOORD_0\", VertexBuffer.UVKind);\r\n loadAttribute(\"TEXCOORD_1\", VertexBuffer.UV2Kind);\r\n loadAttribute(\"JOINTS_0\", VertexBuffer.MatricesIndicesKind);\r\n loadAttribute(\"WEIGHTS_0\", VertexBuffer.MatricesWeightsKind);\r\n loadAttribute(\"JOINTS_1\", VertexBuffer.MatricesIndicesExtraKind);\r\n loadAttribute(\"WEIGHTS_1\", VertexBuffer.MatricesWeightsExtraKind);\r\n loadAttribute(\"COLOR_0\", VertexBuffer.ColorKind, function (accessor) {\r\n if (accessor.type === \"VEC4\" /* VEC4 */) {\r\n babylonMesh.hasVertexAlpha = true;\r\n }\r\n });\r\n return Promise.all(promises).then(function () {\r\n return babylonGeometry;\r\n });\r\n };\r\n GLTFLoader.prototype._createMorphTargets = function (context, node, mesh, primitive, babylonMesh) {\r\n if (!primitive.targets) {\r\n return;\r\n }\r\n if (node._numMorphTargets == undefined) {\r\n node._numMorphTargets = primitive.targets.length;\r\n }\r\n else if (primitive.targets.length !== node._numMorphTargets) {\r\n throw new Error(context + \": Primitives do not have the same number of targets\");\r\n }\r\n var targetNames = mesh.extras ? mesh.extras.targetNames : null;\r\n babylonMesh.morphTargetManager = new MorphTargetManager(babylonMesh.getScene());\r\n for (var index = 0; index < primitive.targets.length; index++) {\r\n var weight = node.weights ? node.weights[index] : mesh.weights ? mesh.weights[index] : 0;\r\n var name_4 = targetNames ? targetNames[index] : \"morphTarget\" + index;\r\n babylonMesh.morphTargetManager.addTarget(new MorphTarget(name_4, weight, babylonMesh.getScene()));\r\n // TODO: tell the target whether it has positions, normals, tangents\r\n }\r\n };\r\n GLTFLoader.prototype._loadMorphTargetsAsync = function (context, primitive, babylonMesh, babylonGeometry) {\r\n if (!primitive.targets) {\r\n return Promise.resolve();\r\n }\r\n var promises = new Array();\r\n var morphTargetManager = babylonMesh.morphTargetManager;\r\n for (var index = 0; index < morphTargetManager.numTargets; index++) {\r\n var babylonMorphTarget = morphTargetManager.getTarget(index);\r\n promises.push(this._loadMorphTargetVertexDataAsync(context + \"/targets/\" + index, babylonGeometry, primitive.targets[index], babylonMorphTarget));\r\n }\r\n return Promise.all(promises).then(function () { });\r\n };\r\n GLTFLoader.prototype._loadMorphTargetVertexDataAsync = function (context, babylonGeometry, attributes, babylonMorphTarget) {\r\n var _this = this;\r\n var promises = new Array();\r\n var loadAttribute = function (attribute, kind, setData) {\r\n if (attributes[attribute] == undefined) {\r\n return;\r\n }\r\n var babylonVertexBuffer = babylonGeometry.getVertexBuffer(kind);\r\n if (!babylonVertexBuffer) {\r\n return;\r\n }\r\n var accessor = ArrayItem.Get(context + \"/\" + attribute, _this._gltf.accessors, attributes[attribute]);\r\n promises.push(_this._loadFloatAccessorAsync(\"/accessors/\" + accessor.index, accessor).then(function (data) {\r\n setData(babylonVertexBuffer, data);\r\n }));\r\n };\r\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind, function (babylonVertexBuffer, data) {\r\n var positions = new Float32Array(data.length);\r\n babylonVertexBuffer.forEach(data.length, function (value, index) {\r\n positions[index] = data[index] + value;\r\n });\r\n babylonMorphTarget.setPositions(positions);\r\n });\r\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind, function (babylonVertexBuffer, data) {\r\n var normals = new Float32Array(data.length);\r\n babylonVertexBuffer.forEach(normals.length, function (value, index) {\r\n normals[index] = data[index] + value;\r\n });\r\n babylonMorphTarget.setNormals(normals);\r\n });\r\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind, function (babylonVertexBuffer, data) {\r\n var tangents = new Float32Array(data.length / 3 * 4);\r\n var dataIndex = 0;\r\n babylonVertexBuffer.forEach(data.length / 3 * 4, function (value, index) {\r\n // Tangent data for morph targets is stored as xyz delta.\r\n // The vertexData.tangent is stored as xyzw.\r\n // So we need to skip every fourth vertexData.tangent.\r\n if (((index + 1) % 4) !== 0) {\r\n tangents[dataIndex] = data[dataIndex] + value;\r\n dataIndex++;\r\n }\r\n });\r\n babylonMorphTarget.setTangents(tangents);\r\n });\r\n return Promise.all(promises).then(function () { });\r\n };\r\n GLTFLoader._LoadTransform = function (node, babylonNode) {\r\n // Ignore the TRS of skinned nodes.\r\n // See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins (second implementation note)\r\n if (node.skin != undefined) {\r\n return;\r\n }\r\n var position = Vector3.Zero();\r\n var rotation = Quaternion.Identity();\r\n var scaling = Vector3.One();\r\n if (node.matrix) {\r\n var matrix = Matrix.FromArray(node.matrix);\r\n matrix.decompose(scaling, rotation, position);\r\n }\r\n else {\r\n if (node.translation) {\r\n position = Vector3.FromArray(node.translation);\r\n }\r\n if (node.rotation) {\r\n rotation = Quaternion.FromArray(node.rotation);\r\n }\r\n if (node.scale) {\r\n scaling = Vector3.FromArray(node.scale);\r\n }\r\n }\r\n babylonNode.position = position;\r\n babylonNode.rotationQuaternion = rotation;\r\n babylonNode.scaling = scaling;\r\n };\r\n GLTFLoader.prototype._loadSkinAsync = function (context, node, skin) {\r\n var _this = this;\r\n var extensionPromise = this._extensionsLoadSkinAsync(context, node, skin);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n var assignSkeleton = function (skeleton) {\r\n _this._forEachPrimitive(node, function (babylonMesh) {\r\n babylonMesh.skeleton = skeleton;\r\n });\r\n };\r\n if (skin._data) {\r\n assignSkeleton(skin._data.babylonSkeleton);\r\n return skin._data.promise;\r\n }\r\n var skeletonId = \"skeleton\" + skin.index;\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n var babylonSkeleton = new Skeleton(skin.name || skeletonId, skeletonId, this._babylonScene);\r\n this._babylonScene._blockEntityCollection = false;\r\n // See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins (second implementation note)\r\n babylonSkeleton.overrideMesh = this._rootBabylonMesh;\r\n this._loadBones(context, skin, babylonSkeleton);\r\n assignSkeleton(babylonSkeleton);\r\n var promise = this._loadSkinInverseBindMatricesDataAsync(context, skin).then(function (inverseBindMatricesData) {\r\n _this._updateBoneMatrices(babylonSkeleton, inverseBindMatricesData);\r\n });\r\n skin._data = {\r\n babylonSkeleton: babylonSkeleton,\r\n promise: promise\r\n };\r\n return promise;\r\n };\r\n GLTFLoader.prototype._loadBones = function (context, skin, babylonSkeleton) {\r\n var babylonBones = {};\r\n for (var _i = 0, _a = skin.joints; _i < _a.length; _i++) {\r\n var index = _a[_i];\r\n var node = ArrayItem.Get(context + \"/joints/\" + index, this._gltf.nodes, index);\r\n this._loadBone(node, skin, babylonSkeleton, babylonBones);\r\n }\r\n };\r\n GLTFLoader.prototype._loadBone = function (node, skin, babylonSkeleton, babylonBones) {\r\n var babylonBone = babylonBones[node.index];\r\n if (babylonBone) {\r\n return babylonBone;\r\n }\r\n var babylonParentBone = null;\r\n if (node.parent && node.parent._babylonTransformNode !== this._rootBabylonMesh) {\r\n babylonParentBone = this._loadBone(node.parent, skin, babylonSkeleton, babylonBones);\r\n }\r\n var boneIndex = skin.joints.indexOf(node.index);\r\n babylonBone = new Bone(node.name || \"joint\" + node.index, babylonSkeleton, babylonParentBone, this._getNodeMatrix(node), null, null, boneIndex);\r\n babylonBones[node.index] = babylonBone;\r\n node._babylonBones = node._babylonBones || [];\r\n node._babylonBones.push(babylonBone);\r\n return babylonBone;\r\n };\r\n GLTFLoader.prototype._loadSkinInverseBindMatricesDataAsync = function (context, skin) {\r\n if (skin.inverseBindMatrices == undefined) {\r\n return Promise.resolve(null);\r\n }\r\n var accessor = ArrayItem.Get(context + \"/inverseBindMatrices\", this._gltf.accessors, skin.inverseBindMatrices);\r\n return this._loadFloatAccessorAsync(\"/accessors/\" + accessor.index, accessor);\r\n };\r\n GLTFLoader.prototype._updateBoneMatrices = function (babylonSkeleton, inverseBindMatricesData) {\r\n for (var _i = 0, _a = babylonSkeleton.bones; _i < _a.length; _i++) {\r\n var babylonBone = _a[_i];\r\n var baseMatrix = Matrix.Identity();\r\n var boneIndex = babylonBone._index;\r\n if (inverseBindMatricesData && boneIndex !== -1) {\r\n Matrix.FromArrayToRef(inverseBindMatricesData, boneIndex * 16, baseMatrix);\r\n baseMatrix.invertToRef(baseMatrix);\r\n }\r\n var babylonParentBone = babylonBone.getParent();\r\n if (babylonParentBone) {\r\n baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);\r\n }\r\n babylonBone.setBindPose(baseMatrix);\r\n babylonBone.updateMatrix(baseMatrix, false, false);\r\n babylonBone._updateDifferenceMatrix(undefined, false);\r\n }\r\n };\r\n GLTFLoader.prototype._getNodeMatrix = function (node) {\r\n return node.matrix ?\r\n Matrix.FromArray(node.matrix) :\r\n Matrix.Compose(node.scale ? Vector3.FromArray(node.scale) : Vector3.One(), node.rotation ? Quaternion.FromArray(node.rotation) : Quaternion.Identity(), node.translation ? Vector3.FromArray(node.translation) : Vector3.Zero());\r\n };\r\n /**\r\n * Loads a glTF camera.\r\n * @param context The context when loading the asset\r\n * @param camera The glTF camera property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon camera when the load is complete\r\n */\r\n GLTFLoader.prototype.loadCameraAsync = function (context, camera, assign) {\r\n if (assign === void 0) { assign = function () { }; }\r\n var extensionPromise = this._extensionsLoadCameraAsync(context, camera, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n var promises = new Array();\r\n this.logOpen(context + \" \" + (camera.name || \"\"));\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n var babylonCamera = new FreeCamera(camera.name || \"camera\" + camera.index, Vector3.Zero(), this._babylonScene, false);\r\n this._babylonScene._blockEntityCollection = false;\r\n babylonCamera.ignoreParentScaling = true;\r\n babylonCamera.rotation = new Vector3(0, Math.PI, 0);\r\n switch (camera.type) {\r\n case \"perspective\" /* PERSPECTIVE */: {\r\n var perspective = camera.perspective;\r\n if (!perspective) {\r\n throw new Error(context + \": Camera perspective properties are missing\");\r\n }\r\n babylonCamera.fov = perspective.yfov;\r\n babylonCamera.minZ = perspective.znear;\r\n babylonCamera.maxZ = perspective.zfar || Number.MAX_VALUE;\r\n break;\r\n }\r\n case \"orthographic\" /* ORTHOGRAPHIC */: {\r\n if (!camera.orthographic) {\r\n throw new Error(context + \": Camera orthographic properties are missing\");\r\n }\r\n babylonCamera.mode = Camera.ORTHOGRAPHIC_CAMERA;\r\n babylonCamera.orthoLeft = -camera.orthographic.xmag;\r\n babylonCamera.orthoRight = camera.orthographic.xmag;\r\n babylonCamera.orthoBottom = -camera.orthographic.ymag;\r\n babylonCamera.orthoTop = camera.orthographic.ymag;\r\n babylonCamera.minZ = camera.orthographic.znear;\r\n babylonCamera.maxZ = camera.orthographic.zfar;\r\n break;\r\n }\r\n default: {\r\n throw new Error(context + \": Invalid camera type (\" + camera.type + \")\");\r\n }\r\n }\r\n GLTFLoader.AddPointerMetadata(babylonCamera, context);\r\n this._parent.onCameraLoadedObservable.notifyObservers(babylonCamera);\r\n assign(babylonCamera);\r\n this.logClose();\r\n return Promise.all(promises).then(function () {\r\n return babylonCamera;\r\n });\r\n };\r\n GLTFLoader.prototype._loadAnimationsAsync = function () {\r\n var animations = this._gltf.animations;\r\n if (!animations) {\r\n return Promise.resolve();\r\n }\r\n var promises = new Array();\r\n for (var index = 0; index < animations.length; index++) {\r\n var animation = animations[index];\r\n promises.push(this.loadAnimationAsync(\"/animations/\" + animation.index, animation));\r\n }\r\n return Promise.all(promises).then(function () { });\r\n };\r\n /**\r\n * Loads a glTF animation.\r\n * @param context The context when loading the asset\r\n * @param animation The glTF animation property\r\n * @returns A promise that resolves with the loaded Babylon animation group when the load is complete\r\n */\r\n GLTFLoader.prototype.loadAnimationAsync = function (context, animation) {\r\n var promise = this._extensionsLoadAnimationAsync(context, animation);\r\n if (promise) {\r\n return promise;\r\n }\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n var babylonAnimationGroup = new AnimationGroup(animation.name || \"animation\" + animation.index, this._babylonScene);\r\n this._babylonScene._blockEntityCollection = false;\r\n animation._babylonAnimationGroup = babylonAnimationGroup;\r\n var promises = new Array();\r\n ArrayItem.Assign(animation.channels);\r\n ArrayItem.Assign(animation.samplers);\r\n for (var _i = 0, _a = animation.channels; _i < _a.length; _i++) {\r\n var channel = _a[_i];\r\n promises.push(this._loadAnimationChannelAsync(context + \"/channels/\" + channel.index, context, animation, channel, babylonAnimationGroup));\r\n }\r\n return Promise.all(promises).then(function () {\r\n babylonAnimationGroup.normalize(0);\r\n return babylonAnimationGroup;\r\n });\r\n };\r\n /**\r\n * @hidden Loads a glTF animation channel.\r\n * @param context The context when loading the asset\r\n * @param animationContext The context of the animation when loading the asset\r\n * @param animation The glTF animation property\r\n * @param channel The glTF animation channel property\r\n * @param babylonAnimationGroup The babylon animation group property\r\n * @param animationTargetOverride The babylon animation channel target override property. My be null.\r\n * @returns A void promise when the channel load is complete\r\n */\r\n GLTFLoader.prototype._loadAnimationChannelAsync = function (context, animationContext, animation, channel, babylonAnimationGroup, animationTargetOverride) {\r\n var _this = this;\r\n if (animationTargetOverride === void 0) { animationTargetOverride = null; }\r\n if (channel.target.node == undefined) {\r\n return Promise.resolve();\r\n }\r\n var targetNode = ArrayItem.Get(context + \"/target/node\", this._gltf.nodes, channel.target.node);\r\n // Ignore animations that have no animation targets.\r\n if ((channel.target.path === \"weights\" /* WEIGHTS */ && !targetNode._numMorphTargets) ||\r\n (channel.target.path !== \"weights\" /* WEIGHTS */ && !targetNode._babylonTransformNode)) {\r\n return Promise.resolve();\r\n }\r\n var sampler = ArrayItem.Get(context + \"/sampler\", animation.samplers, channel.sampler);\r\n return this._loadAnimationSamplerAsync(animationContext + \"/samplers/\" + channel.sampler, sampler).then(function (data) {\r\n var targetPath;\r\n var animationType;\r\n switch (channel.target.path) {\r\n case \"translation\" /* TRANSLATION */: {\r\n targetPath = \"position\";\r\n animationType = Animation.ANIMATIONTYPE_VECTOR3;\r\n break;\r\n }\r\n case \"rotation\" /* ROTATION */: {\r\n targetPath = \"rotationQuaternion\";\r\n animationType = Animation.ANIMATIONTYPE_QUATERNION;\r\n break;\r\n }\r\n case \"scale\" /* SCALE */: {\r\n targetPath = \"scaling\";\r\n animationType = Animation.ANIMATIONTYPE_VECTOR3;\r\n break;\r\n }\r\n case \"weights\" /* WEIGHTS */: {\r\n targetPath = \"influence\";\r\n animationType = Animation.ANIMATIONTYPE_FLOAT;\r\n break;\r\n }\r\n default: {\r\n throw new Error(context + \"/target/path: Invalid value (\" + channel.target.path + \")\");\r\n }\r\n }\r\n var outputBufferOffset = 0;\r\n var getNextOutputValue;\r\n switch (targetPath) {\r\n case \"position\": {\r\n getNextOutputValue = function () {\r\n var value = Vector3.FromArray(data.output, outputBufferOffset);\r\n outputBufferOffset += 3;\r\n return value;\r\n };\r\n break;\r\n }\r\n case \"rotationQuaternion\": {\r\n getNextOutputValue = function () {\r\n var value = Quaternion.FromArray(data.output, outputBufferOffset);\r\n outputBufferOffset += 4;\r\n return value;\r\n };\r\n break;\r\n }\r\n case \"scaling\": {\r\n getNextOutputValue = function () {\r\n var value = Vector3.FromArray(data.output, outputBufferOffset);\r\n outputBufferOffset += 3;\r\n return value;\r\n };\r\n break;\r\n }\r\n case \"influence\": {\r\n getNextOutputValue = function () {\r\n var value = new Array(targetNode._numMorphTargets);\r\n for (var i = 0; i < targetNode._numMorphTargets; i++) {\r\n value[i] = data.output[outputBufferOffset++];\r\n }\r\n return value;\r\n };\r\n break;\r\n }\r\n }\r\n var getNextKey;\r\n switch (data.interpolation) {\r\n case \"STEP\" /* STEP */: {\r\n getNextKey = function (frameIndex) { return ({\r\n frame: data.input[frameIndex],\r\n value: getNextOutputValue(),\r\n interpolation: AnimationKeyInterpolation.STEP\r\n }); };\r\n break;\r\n }\r\n case \"LINEAR\" /* LINEAR */: {\r\n getNextKey = function (frameIndex) { return ({\r\n frame: data.input[frameIndex],\r\n value: getNextOutputValue()\r\n }); };\r\n break;\r\n }\r\n case \"CUBICSPLINE\" /* CUBICSPLINE */: {\r\n getNextKey = function (frameIndex) { return ({\r\n frame: data.input[frameIndex],\r\n inTangent: getNextOutputValue(),\r\n value: getNextOutputValue(),\r\n outTangent: getNextOutputValue()\r\n }); };\r\n break;\r\n }\r\n }\r\n var keys = new Array(data.input.length);\r\n for (var frameIndex = 0; frameIndex < data.input.length; frameIndex++) {\r\n keys[frameIndex] = getNextKey(frameIndex);\r\n }\r\n if (targetPath === \"influence\") {\r\n var _loop_2 = function (targetIndex) {\r\n var animationName = babylonAnimationGroup.name + \"_channel\" + babylonAnimationGroup.targetedAnimations.length;\r\n var babylonAnimation = new Animation(animationName, targetPath, 1, animationType);\r\n babylonAnimation.setKeys(keys.map(function (key) { return ({\r\n frame: key.frame,\r\n inTangent: key.inTangent ? key.inTangent[targetIndex] : undefined,\r\n value: key.value[targetIndex],\r\n outTangent: key.outTangent ? key.outTangent[targetIndex] : undefined\r\n }); }));\r\n _this._forEachPrimitive(targetNode, function (babylonAbstractMesh) {\r\n var babylonMesh = babylonAbstractMesh;\r\n var morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);\r\n var babylonAnimationClone = babylonAnimation.clone();\r\n morphTarget.animations.push(babylonAnimationClone);\r\n babylonAnimationGroup.addTargetedAnimation(babylonAnimationClone, morphTarget);\r\n });\r\n };\r\n for (var targetIndex = 0; targetIndex < targetNode._numMorphTargets; targetIndex++) {\r\n _loop_2(targetIndex);\r\n }\r\n }\r\n else {\r\n var animationName = babylonAnimationGroup.name + \"_channel\" + babylonAnimationGroup.targetedAnimations.length;\r\n var babylonAnimation = new Animation(animationName, targetPath, 1, animationType);\r\n babylonAnimation.setKeys(keys);\r\n if (animationTargetOverride != null && animationTargetOverride.animations != null) {\r\n animationTargetOverride.animations.push(babylonAnimation);\r\n babylonAnimationGroup.addTargetedAnimation(babylonAnimation, animationTargetOverride);\r\n }\r\n else {\r\n targetNode._babylonTransformNode.animations.push(babylonAnimation);\r\n babylonAnimationGroup.addTargetedAnimation(babylonAnimation, targetNode._babylonTransformNode);\r\n }\r\n }\r\n });\r\n };\r\n GLTFLoader.prototype._loadAnimationSamplerAsync = function (context, sampler) {\r\n if (sampler._data) {\r\n return sampler._data;\r\n }\r\n var interpolation = sampler.interpolation || \"LINEAR\" /* LINEAR */;\r\n switch (interpolation) {\r\n case \"STEP\" /* STEP */:\r\n case \"LINEAR\" /* LINEAR */:\r\n case \"CUBICSPLINE\" /* CUBICSPLINE */: {\r\n break;\r\n }\r\n default: {\r\n throw new Error(context + \"/interpolation: Invalid value (\" + sampler.interpolation + \")\");\r\n }\r\n }\r\n var inputAccessor = ArrayItem.Get(context + \"/input\", this._gltf.accessors, sampler.input);\r\n var outputAccessor = ArrayItem.Get(context + \"/output\", this._gltf.accessors, sampler.output);\r\n sampler._data = Promise.all([\r\n this._loadFloatAccessorAsync(\"/accessors/\" + inputAccessor.index, inputAccessor),\r\n this._loadFloatAccessorAsync(\"/accessors/\" + outputAccessor.index, outputAccessor)\r\n ]).then(function (_a) {\r\n var inputData = _a[0], outputData = _a[1];\r\n return {\r\n input: inputData,\r\n interpolation: interpolation,\r\n output: outputData,\r\n };\r\n });\r\n return sampler._data;\r\n };\r\n GLTFLoader.prototype._loadBufferAsync = function (context, buffer, byteOffset, byteLength) {\r\n var extensionPromise = this._extensionsLoadBufferAsync(context, buffer, byteOffset, byteLength);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n if (!buffer._data) {\r\n if (buffer.uri) {\r\n buffer._data = this.loadUriAsync(context + \"/uri\", buffer, buffer.uri);\r\n }\r\n else {\r\n if (!this._bin) {\r\n throw new Error(context + \": Uri is missing or the binary glTF is missing its binary chunk\");\r\n }\r\n buffer._data = this._bin.readAsync(0, buffer.byteLength);\r\n }\r\n }\r\n return buffer._data.then(function (data) {\r\n try {\r\n return new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);\r\n }\r\n catch (e) {\r\n throw new Error(context + \": \" + e.message);\r\n }\r\n });\r\n };\r\n /**\r\n * Loads a glTF buffer view.\r\n * @param context The context when loading the asset\r\n * @param bufferView The glTF buffer view property\r\n * @returns A promise that resolves with the loaded data when the load is complete\r\n */\r\n GLTFLoader.prototype.loadBufferViewAsync = function (context, bufferView) {\r\n var extensionPromise = this._extensionsLoadBufferViewAsync(context, bufferView);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n if (bufferView._data) {\r\n return bufferView._data;\r\n }\r\n var buffer = ArrayItem.Get(context + \"/buffer\", this._gltf.buffers, bufferView.buffer);\r\n bufferView._data = this._loadBufferAsync(\"/buffers/\" + buffer.index, buffer, (bufferView.byteOffset || 0), bufferView.byteLength);\r\n return bufferView._data;\r\n };\r\n GLTFLoader.prototype._loadAccessorAsync = function (context, accessor, constructor) {\r\n var _this = this;\r\n if (accessor._data) {\r\n return accessor._data;\r\n }\r\n var numComponents = GLTFLoader._GetNumComponents(context, accessor.type);\r\n var byteStride = numComponents * VertexBuffer.GetTypeByteLength(accessor.componentType);\r\n var length = numComponents * accessor.count;\r\n if (accessor.bufferView == undefined) {\r\n accessor._data = Promise.resolve(new constructor(length));\r\n }\r\n else {\r\n var bufferView_1 = ArrayItem.Get(context + \"/bufferView\", this._gltf.bufferViews, accessor.bufferView);\r\n accessor._data = this.loadBufferViewAsync(\"/bufferViews/\" + bufferView_1.index, bufferView_1).then(function (data) {\r\n if (accessor.componentType === 5126 /* FLOAT */ && !accessor.normalized && (!bufferView_1.byteStride || bufferView_1.byteStride === byteStride)) {\r\n return GLTFLoader._GetTypedArray(context, accessor.componentType, data, accessor.byteOffset, length);\r\n }\r\n else {\r\n var typedArray_1 = new constructor(length);\r\n VertexBuffer.ForEach(data, accessor.byteOffset || 0, bufferView_1.byteStride || byteStride, numComponents, accessor.componentType, typedArray_1.length, accessor.normalized || false, function (value, index) {\r\n typedArray_1[index] = value;\r\n });\r\n return typedArray_1;\r\n }\r\n });\r\n }\r\n if (accessor.sparse) {\r\n var sparse_1 = accessor.sparse;\r\n accessor._data = accessor._data.then(function (data) {\r\n var typedArray = data;\r\n var indicesBufferView = ArrayItem.Get(context + \"/sparse/indices/bufferView\", _this._gltf.bufferViews, sparse_1.indices.bufferView);\r\n var valuesBufferView = ArrayItem.Get(context + \"/sparse/values/bufferView\", _this._gltf.bufferViews, sparse_1.values.bufferView);\r\n return Promise.all([\r\n _this.loadBufferViewAsync(\"/bufferViews/\" + indicesBufferView.index, indicesBufferView),\r\n _this.loadBufferViewAsync(\"/bufferViews/\" + valuesBufferView.index, valuesBufferView)\r\n ]).then(function (_a) {\r\n var indicesData = _a[0], valuesData = _a[1];\r\n var indices = GLTFLoader._GetTypedArray(context + \"/sparse/indices\", sparse_1.indices.componentType, indicesData, sparse_1.indices.byteOffset, sparse_1.count);\r\n var sparseLength = numComponents * sparse_1.count;\r\n var values;\r\n if (accessor.componentType === 5126 /* FLOAT */ && !accessor.normalized) {\r\n values = GLTFLoader._GetTypedArray(context + \"/sparse/values\", accessor.componentType, valuesData, sparse_1.values.byteOffset, sparseLength);\r\n }\r\n else {\r\n var sparseData = GLTFLoader._GetTypedArray(context + \"/sparse/values\", accessor.componentType, valuesData, sparse_1.values.byteOffset, sparseLength);\r\n values = new constructor(sparseLength);\r\n VertexBuffer.ForEach(sparseData, 0, byteStride, numComponents, accessor.componentType, values.length, accessor.normalized || false, function (value, index) {\r\n values[index] = value;\r\n });\r\n }\r\n var valuesIndex = 0;\r\n for (var indicesIndex = 0; indicesIndex < indices.length; indicesIndex++) {\r\n var dataIndex = indices[indicesIndex] * numComponents;\r\n for (var componentIndex = 0; componentIndex < numComponents; componentIndex++) {\r\n typedArray[dataIndex++] = values[valuesIndex++];\r\n }\r\n }\r\n return typedArray;\r\n });\r\n });\r\n }\r\n return accessor._data;\r\n };\r\n /** @hidden */\r\n GLTFLoader.prototype._loadFloatAccessorAsync = function (context, accessor) {\r\n return this._loadAccessorAsync(context, accessor, Float32Array);\r\n };\r\n GLTFLoader.prototype._loadIndicesAccessorAsync = function (context, accessor) {\r\n if (accessor.type !== \"SCALAR\" /* SCALAR */) {\r\n throw new Error(context + \"/type: Invalid value \" + accessor.type);\r\n }\r\n if (accessor.componentType !== 5121 /* UNSIGNED_BYTE */ &&\r\n accessor.componentType !== 5123 /* UNSIGNED_SHORT */ &&\r\n accessor.componentType !== 5125 /* UNSIGNED_INT */) {\r\n throw new Error(context + \"/componentType: Invalid value \" + accessor.componentType);\r\n }\r\n if (accessor._data) {\r\n return accessor._data;\r\n }\r\n if (accessor.sparse) {\r\n var constructor = GLTFLoader._GetTypedArrayConstructor(context + \"/componentType\", accessor.componentType);\r\n accessor._data = this._loadAccessorAsync(context, accessor, constructor);\r\n }\r\n else {\r\n var bufferView = ArrayItem.Get(context + \"/bufferView\", this._gltf.bufferViews, accessor.bufferView);\r\n accessor._data = this.loadBufferViewAsync(\"/bufferViews/\" + bufferView.index, bufferView).then(function (data) {\r\n return GLTFLoader._GetTypedArray(context, accessor.componentType, data, accessor.byteOffset, accessor.count);\r\n });\r\n }\r\n return accessor._data;\r\n };\r\n GLTFLoader.prototype._loadVertexBufferViewAsync = function (bufferView, kind) {\r\n var _this = this;\r\n if (bufferView._babylonBuffer) {\r\n return bufferView._babylonBuffer;\r\n }\r\n bufferView._babylonBuffer = this.loadBufferViewAsync(\"/bufferViews/\" + bufferView.index, bufferView).then(function (data) {\r\n return new Buffer(_this._babylonScene.getEngine(), data, false);\r\n });\r\n return bufferView._babylonBuffer;\r\n };\r\n GLTFLoader.prototype._loadVertexAccessorAsync = function (context, accessor, kind) {\r\n var _this = this;\r\n if (accessor._babylonVertexBuffer) {\r\n return accessor._babylonVertexBuffer;\r\n }\r\n if (accessor.sparse) {\r\n accessor._babylonVertexBuffer = this._loadFloatAccessorAsync(\"/accessors/\" + accessor.index, accessor).then(function (data) {\r\n return new VertexBuffer(_this._babylonScene.getEngine(), data, kind, false);\r\n });\r\n }\r\n // HACK: If byte offset is not a multiple of component type byte length then load as a float array instead of using Babylon buffers.\r\n else if (accessor.byteOffset && accessor.byteOffset % VertexBuffer.GetTypeByteLength(accessor.componentType) !== 0) {\r\n Logger.Warn(\"Accessor byte offset is not a multiple of component type byte length\");\r\n accessor._babylonVertexBuffer = this._loadFloatAccessorAsync(\"/accessors/\" + accessor.index, accessor).then(function (data) {\r\n return new VertexBuffer(_this._babylonScene.getEngine(), data, kind, false);\r\n });\r\n }\r\n // Load joint indices as a float array since the shaders expect float data but glTF uses unsigned byte/short.\r\n // This prevents certain platforms (e.g. D3D) from having to convert the data to float on the fly.\r\n else if (kind === VertexBuffer.MatricesIndicesKind || kind === VertexBuffer.MatricesIndicesExtraKind) {\r\n accessor._babylonVertexBuffer = this._loadFloatAccessorAsync(\"/accessors/\" + accessor.index, accessor).then(function (data) {\r\n return new VertexBuffer(_this._babylonScene.getEngine(), data, kind, false);\r\n });\r\n }\r\n else {\r\n var bufferView_2 = ArrayItem.Get(context + \"/bufferView\", this._gltf.bufferViews, accessor.bufferView);\r\n accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync(bufferView_2, kind).then(function (babylonBuffer) {\r\n var size = GLTFLoader._GetNumComponents(context, accessor.type);\r\n return new VertexBuffer(_this._babylonScene.getEngine(), babylonBuffer, kind, false, false, bufferView_2.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true, 1, true);\r\n });\r\n }\r\n return accessor._babylonVertexBuffer;\r\n };\r\n GLTFLoader.prototype._loadMaterialMetallicRoughnessPropertiesAsync = function (context, properties, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var promises = new Array();\r\n if (properties) {\r\n if (properties.baseColorFactor) {\r\n babylonMaterial.albedoColor = Color3.FromArray(properties.baseColorFactor);\r\n babylonMaterial.alpha = properties.baseColorFactor[3];\r\n }\r\n else {\r\n babylonMaterial.albedoColor = Color3.White();\r\n }\r\n babylonMaterial.metallic = properties.metallicFactor == undefined ? 1 : properties.metallicFactor;\r\n babylonMaterial.roughness = properties.roughnessFactor == undefined ? 1 : properties.roughnessFactor;\r\n if (properties.baseColorTexture) {\r\n promises.push(this.loadTextureInfoAsync(context + \"/baseColorTexture\", properties.baseColorTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Base Color)\";\r\n babylonMaterial.albedoTexture = texture;\r\n }));\r\n }\r\n if (properties.metallicRoughnessTexture) {\r\n properties.metallicRoughnessTexture.nonColorData = true;\r\n promises.push(this.loadTextureInfoAsync(context + \"/metallicRoughnessTexture\", properties.metallicRoughnessTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Metallic Roughness)\";\r\n babylonMaterial.metallicTexture = texture;\r\n }));\r\n babylonMaterial.useMetallnessFromMetallicTextureBlue = true;\r\n babylonMaterial.useRoughnessFromMetallicTextureGreen = true;\r\n babylonMaterial.useRoughnessFromMetallicTextureAlpha = false;\r\n }\r\n }\r\n return Promise.all(promises).then(function () { });\r\n };\r\n /** @hidden */\r\n GLTFLoader.prototype._loadMaterialAsync = function (context, material, babylonMesh, babylonDrawMode, assign) {\r\n if (assign === void 0) { assign = function () { }; }\r\n var extensionPromise = this._extensionsLoadMaterialAsync(context, material, babylonMesh, babylonDrawMode, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n material._data = material._data || {};\r\n var babylonData = material._data[babylonDrawMode];\r\n if (!babylonData) {\r\n this.logOpen(context + \" \" + (material.name || \"\"));\r\n var babylonMaterial = this.createMaterial(context, material, babylonDrawMode);\r\n babylonData = {\r\n babylonMaterial: babylonMaterial,\r\n babylonMeshes: [],\r\n promise: this.loadMaterialPropertiesAsync(context, material, babylonMaterial)\r\n };\r\n material._data[babylonDrawMode] = babylonData;\r\n GLTFLoader.AddPointerMetadata(babylonMaterial, context);\r\n this._parent.onMaterialLoadedObservable.notifyObservers(babylonMaterial);\r\n this.logClose();\r\n }\r\n if (babylonMesh) {\r\n babylonData.babylonMeshes.push(babylonMesh);\r\n babylonMesh.onDisposeObservable.addOnce(function () {\r\n var index = babylonData.babylonMeshes.indexOf(babylonMesh);\r\n if (index !== -1) {\r\n babylonData.babylonMeshes.splice(index, 1);\r\n }\r\n });\r\n }\r\n assign(babylonData.babylonMaterial);\r\n return babylonData.promise.then(function () {\r\n return babylonData.babylonMaterial;\r\n });\r\n };\r\n GLTFLoader.prototype._createDefaultMaterial = function (name, babylonDrawMode) {\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n var babylonMaterial = new PBRMaterial(name, this._babylonScene);\r\n this._babylonScene._blockEntityCollection = false;\r\n // Moved to mesh so user can change materials on gltf meshes: babylonMaterial.sideOrientation = this._babylonScene.useRightHandedSystem ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\r\n babylonMaterial.fillMode = babylonDrawMode;\r\n babylonMaterial.enableSpecularAntiAliasing = true;\r\n babylonMaterial.useRadianceOverAlpha = !this._parent.transparencyAsCoverage;\r\n babylonMaterial.useSpecularOverAlpha = !this._parent.transparencyAsCoverage;\r\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_OPAQUE;\r\n babylonMaterial.metallic = 1;\r\n babylonMaterial.roughness = 1;\r\n return babylonMaterial;\r\n };\r\n /**\r\n * Creates a Babylon material from a glTF material.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonDrawMode The draw mode for the Babylon material\r\n * @returns The Babylon material\r\n */\r\n GLTFLoader.prototype.createMaterial = function (context, material, babylonDrawMode) {\r\n var extensionPromise = this._extensionsCreateMaterial(context, material, babylonDrawMode);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n var name = material.name || \"material\" + material.index;\r\n var babylonMaterial = this._createDefaultMaterial(name, babylonDrawMode);\r\n return babylonMaterial;\r\n };\r\n /**\r\n * Loads properties from a glTF material into a Babylon material.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonMaterial The Babylon material\r\n * @returns A promise that resolves when the load is complete\r\n */\r\n GLTFLoader.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var extensionPromise = this._extensionsLoadMaterialPropertiesAsync(context, material, babylonMaterial);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n var promises = new Array();\r\n promises.push(this.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\r\n if (material.pbrMetallicRoughness) {\r\n promises.push(this._loadMaterialMetallicRoughnessPropertiesAsync(context + \"/pbrMetallicRoughness\", material.pbrMetallicRoughness, babylonMaterial));\r\n }\r\n this.loadMaterialAlphaProperties(context, material, babylonMaterial);\r\n return Promise.all(promises).then(function () { });\r\n };\r\n /**\r\n * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonMaterial The Babylon material\r\n * @returns A promise that resolves when the load is complete\r\n */\r\n GLTFLoader.prototype.loadMaterialBasePropertiesAsync = function (context, material, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var promises = new Array();\r\n babylonMaterial.emissiveColor = material.emissiveFactor ? Color3.FromArray(material.emissiveFactor) : new Color3(0, 0, 0);\r\n if (material.doubleSided) {\r\n babylonMaterial.backFaceCulling = false;\r\n babylonMaterial.twoSidedLighting = true;\r\n }\r\n if (material.normalTexture) {\r\n material.normalTexture.nonColorData = true;\r\n promises.push(this.loadTextureInfoAsync(context + \"/normalTexture\", material.normalTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Normal)\";\r\n babylonMaterial.bumpTexture = texture;\r\n }));\r\n babylonMaterial.invertNormalMapX = !this._babylonScene.useRightHandedSystem;\r\n babylonMaterial.invertNormalMapY = this._babylonScene.useRightHandedSystem;\r\n if (material.normalTexture.scale != undefined) {\r\n babylonMaterial.bumpTexture.level = material.normalTexture.scale;\r\n }\r\n babylonMaterial.forceIrradianceInFragment = true;\r\n }\r\n if (material.occlusionTexture) {\r\n material.occlusionTexture.nonColorData = true;\r\n promises.push(this.loadTextureInfoAsync(context + \"/occlusionTexture\", material.occlusionTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Occlusion)\";\r\n babylonMaterial.ambientTexture = texture;\r\n }));\r\n babylonMaterial.useAmbientInGrayScale = true;\r\n if (material.occlusionTexture.strength != undefined) {\r\n babylonMaterial.ambientTextureStrength = material.occlusionTexture.strength;\r\n }\r\n }\r\n if (material.emissiveTexture) {\r\n promises.push(this.loadTextureInfoAsync(context + \"/emissiveTexture\", material.emissiveTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Emissive)\";\r\n babylonMaterial.emissiveTexture = texture;\r\n }));\r\n }\r\n return Promise.all(promises).then(function () { });\r\n };\r\n /**\r\n * Loads the alpha properties from a glTF material into a Babylon material.\r\n * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.\r\n * @param context The context when loading the asset\r\n * @param material The glTF material property\r\n * @param babylonMaterial The Babylon material\r\n */\r\n GLTFLoader.prototype.loadMaterialAlphaProperties = function (context, material, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var alphaMode = material.alphaMode || \"OPAQUE\" /* OPAQUE */;\r\n switch (alphaMode) {\r\n case \"OPAQUE\" /* OPAQUE */: {\r\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_OPAQUE;\r\n break;\r\n }\r\n case \"MASK\" /* MASK */: {\r\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_ALPHATEST;\r\n babylonMaterial.alphaCutOff = (material.alphaCutoff == undefined ? 0.5 : material.alphaCutoff);\r\n if (babylonMaterial.albedoTexture) {\r\n babylonMaterial.albedoTexture.hasAlpha = true;\r\n }\r\n break;\r\n }\r\n case \"BLEND\" /* BLEND */: {\r\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_ALPHABLEND;\r\n if (babylonMaterial.albedoTexture) {\r\n babylonMaterial.albedoTexture.hasAlpha = true;\r\n babylonMaterial.useAlphaFromAlbedoTexture = true;\r\n }\r\n break;\r\n }\r\n default: {\r\n throw new Error(context + \"/alphaMode: Invalid value (\" + material.alphaMode + \")\");\r\n }\r\n }\r\n };\r\n /**\r\n * Loads a glTF texture info.\r\n * @param context The context when loading the asset\r\n * @param textureInfo The glTF texture info property\r\n * @param assign A function called synchronously after parsing the glTF properties\r\n * @returns A promise that resolves with the loaded Babylon texture when the load is complete\r\n */\r\n GLTFLoader.prototype.loadTextureInfoAsync = function (context, textureInfo, assign) {\r\n var _this = this;\r\n if (assign === void 0) { assign = function () { }; }\r\n var extensionPromise = this._extensionsLoadTextureInfoAsync(context, textureInfo, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n this.logOpen(\"\" + context);\r\n if (textureInfo.texCoord >= 2) {\r\n throw new Error(context + \"/texCoord: Invalid value (\" + textureInfo.texCoord + \")\");\r\n }\r\n var texture = ArrayItem.Get(context + \"/index\", this._gltf.textures, textureInfo.index);\r\n texture._textureInfo = textureInfo;\r\n var promise = this._loadTextureAsync(\"/textures/\" + textureInfo.index, texture, function (babylonTexture) {\r\n babylonTexture.coordinatesIndex = textureInfo.texCoord || 0;\r\n GLTFLoader.AddPointerMetadata(babylonTexture, context);\r\n _this._parent.onTextureLoadedObservable.notifyObservers(babylonTexture);\r\n assign(babylonTexture);\r\n });\r\n this.logClose();\r\n return promise;\r\n };\r\n /** @hidden */\r\n GLTFLoader.prototype._loadTextureAsync = function (context, texture, assign) {\r\n if (assign === void 0) { assign = function () { }; }\r\n var extensionPromise = this._extensionsLoadTextureAsync(context, texture, assign);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n this.logOpen(context + \" \" + (texture.name || \"\"));\r\n var sampler = (texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(context + \"/sampler\", this._gltf.samplers, texture.sampler));\r\n var image = ArrayItem.Get(context + \"/source\", this._gltf.images, texture.source);\r\n var promise = this._createTextureAsync(context, sampler, image, assign);\r\n this.logClose();\r\n return promise;\r\n };\r\n /** @hidden */\r\n GLTFLoader.prototype._createTextureAsync = function (context, sampler, image, assign, textureLoaderOptions) {\r\n var _this = this;\r\n if (assign === void 0) { assign = function () { }; }\r\n var samplerData = this._loadSampler(\"/samplers/\" + sampler.index, sampler);\r\n var promises = new Array();\r\n var deferred = new Deferred();\r\n this._babylonScene._blockEntityCollection = this._forAssetContainer;\r\n var babylonTexture = new Texture(null, this._babylonScene, samplerData.noMipMaps, false, samplerData.samplingMode, function () {\r\n if (!_this._disposed) {\r\n deferred.resolve();\r\n }\r\n }, function (message, exception) {\r\n if (!_this._disposed) {\r\n deferred.reject(new Error(context + \": \" + ((exception && exception.message) ? exception.message : message || \"Failed to load texture\")));\r\n }\r\n }, undefined, undefined, undefined, image.mimeType, textureLoaderOptions);\r\n this._babylonScene._blockEntityCollection = false;\r\n promises.push(deferred.promise);\r\n promises.push(this.loadImageAsync(\"/images/\" + image.index, image).then(function (data) {\r\n var name = image.uri || _this._fileName + \"#image\" + image.index;\r\n var dataUrl = \"data:\" + _this._uniqueRootUrl + name;\r\n babylonTexture.updateURL(dataUrl, data);\r\n }));\r\n babylonTexture.wrapU = samplerData.wrapU;\r\n babylonTexture.wrapV = samplerData.wrapV;\r\n assign(babylonTexture);\r\n return Promise.all(promises).then(function () {\r\n return babylonTexture;\r\n });\r\n };\r\n GLTFLoader.prototype._loadSampler = function (context, sampler) {\r\n if (!sampler._data) {\r\n sampler._data = {\r\n noMipMaps: (sampler.minFilter === 9728 /* NEAREST */ || sampler.minFilter === 9729 /* LINEAR */),\r\n samplingMode: GLTFLoader._GetTextureSamplingMode(context, sampler),\r\n wrapU: GLTFLoader._GetTextureWrapMode(context + \"/wrapS\", sampler.wrapS),\r\n wrapV: GLTFLoader._GetTextureWrapMode(context + \"/wrapT\", sampler.wrapT)\r\n };\r\n }\r\n return sampler._data;\r\n };\r\n /**\r\n * Loads a glTF image.\r\n * @param context The context when loading the asset\r\n * @param image The glTF image property\r\n * @returns A promise that resolves with the loaded data when the load is complete\r\n */\r\n GLTFLoader.prototype.loadImageAsync = function (context, image) {\r\n if (!image._data) {\r\n this.logOpen(context + \" \" + (image.name || \"\"));\r\n if (image.uri) {\r\n image._data = this.loadUriAsync(context + \"/uri\", image, image.uri);\r\n }\r\n else {\r\n var bufferView = ArrayItem.Get(context + \"/bufferView\", this._gltf.bufferViews, image.bufferView);\r\n image._data = this.loadBufferViewAsync(\"/bufferViews/\" + bufferView.index, bufferView);\r\n }\r\n this.logClose();\r\n }\r\n return image._data;\r\n };\r\n /**\r\n * Loads a glTF uri.\r\n * @param context The context when loading the asset\r\n * @param property The glTF property associated with the uri\r\n * @param uri The base64 or relative uri\r\n * @returns A promise that resolves with the loaded data when the load is complete\r\n */\r\n GLTFLoader.prototype.loadUriAsync = function (context, property, uri) {\r\n var _this = this;\r\n var extensionPromise = this._extensionsLoadUriAsync(context, property, uri);\r\n if (extensionPromise) {\r\n return extensionPromise;\r\n }\r\n if (!GLTFLoader._ValidateUri(uri)) {\r\n throw new Error(context + \": '\" + uri + \"' is invalid\");\r\n }\r\n if (Tools.IsBase64(uri)) {\r\n var data = new Uint8Array(Tools.DecodeBase64(uri));\r\n this.log(\"Decoded \" + uri.substr(0, 64) + \"... (\" + data.length + \" bytes)\");\r\n return Promise.resolve(data);\r\n }\r\n this.log(\"Loading \" + uri);\r\n return this._parent.preprocessUrlAsync(this._rootUrl + uri).then(function (url) {\r\n return new Promise(function (resolve, reject) {\r\n _this._parent._loadFile(url, _this._babylonScene, function (data) {\r\n if (!_this._disposed) {\r\n _this.log(\"Loaded \" + uri + \" (\" + data.byteLength + \" bytes)\");\r\n resolve(new Uint8Array(data));\r\n }\r\n }, true, function (request) {\r\n reject(new LoadFileError(context + \": Failed to load '\" + uri + \"'\" + (request ? \": \" + request.status + \" \" + request.statusText : \"\"), request));\r\n });\r\n });\r\n });\r\n };\r\n /**\r\n * Adds a JSON pointer to the metadata of the Babylon object at `.metadata.gltf.pointers`.\r\n * @param babylonObject the Babylon object with metadata\r\n * @param pointer the JSON pointer\r\n */\r\n GLTFLoader.AddPointerMetadata = function (babylonObject, pointer) {\r\n var metadata = (babylonObject.metadata = babylonObject.metadata || {});\r\n var gltf = (metadata.gltf = metadata.gltf || {});\r\n var pointers = (gltf.pointers = gltf.pointers || []);\r\n pointers.push(pointer);\r\n };\r\n GLTFLoader._GetTextureWrapMode = function (context, mode) {\r\n // Set defaults if undefined\r\n mode = mode == undefined ? 10497 /* REPEAT */ : mode;\r\n switch (mode) {\r\n case 33071 /* CLAMP_TO_EDGE */: return Texture.CLAMP_ADDRESSMODE;\r\n case 33648 /* MIRRORED_REPEAT */: return Texture.MIRROR_ADDRESSMODE;\r\n case 10497 /* REPEAT */: return Texture.WRAP_ADDRESSMODE;\r\n default:\r\n Logger.Warn(context + \": Invalid value (\" + mode + \")\");\r\n return Texture.WRAP_ADDRESSMODE;\r\n }\r\n };\r\n GLTFLoader._GetTextureSamplingMode = function (context, sampler) {\r\n // Set defaults if undefined\r\n var magFilter = sampler.magFilter == undefined ? 9729 /* LINEAR */ : sampler.magFilter;\r\n var minFilter = sampler.minFilter == undefined ? 9987 /* LINEAR_MIPMAP_LINEAR */ : sampler.minFilter;\r\n if (magFilter === 9729 /* LINEAR */) {\r\n switch (minFilter) {\r\n case 9728 /* NEAREST */: return Texture.LINEAR_NEAREST;\r\n case 9729 /* LINEAR */: return Texture.LINEAR_LINEAR;\r\n case 9984 /* NEAREST_MIPMAP_NEAREST */: return Texture.LINEAR_NEAREST_MIPNEAREST;\r\n case 9985 /* LINEAR_MIPMAP_NEAREST */: return Texture.LINEAR_LINEAR_MIPNEAREST;\r\n case 9986 /* NEAREST_MIPMAP_LINEAR */: return Texture.LINEAR_NEAREST_MIPLINEAR;\r\n case 9987 /* LINEAR_MIPMAP_LINEAR */: return Texture.LINEAR_LINEAR_MIPLINEAR;\r\n default:\r\n Logger.Warn(context + \"/minFilter: Invalid value (\" + minFilter + \")\");\r\n return Texture.LINEAR_LINEAR_MIPLINEAR;\r\n }\r\n }\r\n else {\r\n if (magFilter !== 9728 /* NEAREST */) {\r\n Logger.Warn(context + \"/magFilter: Invalid value (\" + magFilter + \")\");\r\n }\r\n switch (minFilter) {\r\n case 9728 /* NEAREST */: return Texture.NEAREST_NEAREST;\r\n case 9729 /* LINEAR */: return Texture.NEAREST_LINEAR;\r\n case 9984 /* NEAREST_MIPMAP_NEAREST */: return Texture.NEAREST_NEAREST_MIPNEAREST;\r\n case 9985 /* LINEAR_MIPMAP_NEAREST */: return Texture.NEAREST_LINEAR_MIPNEAREST;\r\n case 9986 /* NEAREST_MIPMAP_LINEAR */: return Texture.NEAREST_NEAREST_MIPLINEAR;\r\n case 9987 /* LINEAR_MIPMAP_LINEAR */: return Texture.NEAREST_LINEAR_MIPLINEAR;\r\n default:\r\n Logger.Warn(context + \"/minFilter: Invalid value (\" + minFilter + \")\");\r\n return Texture.NEAREST_NEAREST_MIPNEAREST;\r\n }\r\n }\r\n };\r\n GLTFLoader._GetTypedArrayConstructor = function (context, componentType) {\r\n switch (componentType) {\r\n case 5120 /* BYTE */: return Int8Array;\r\n case 5121 /* UNSIGNED_BYTE */: return Uint8Array;\r\n case 5122 /* SHORT */: return Int16Array;\r\n case 5123 /* UNSIGNED_SHORT */: return Uint16Array;\r\n case 5125 /* UNSIGNED_INT */: return Uint32Array;\r\n case 5126 /* FLOAT */: return Float32Array;\r\n default: throw new Error(context + \": Invalid component type \" + componentType);\r\n }\r\n };\r\n GLTFLoader._GetTypedArray = function (context, componentType, bufferView, byteOffset, length) {\r\n var buffer = bufferView.buffer;\r\n byteOffset = bufferView.byteOffset + (byteOffset || 0);\r\n var constructor = GLTFLoader._GetTypedArrayConstructor(context + \"/componentType\", componentType);\r\n try {\r\n return new constructor(buffer, byteOffset, length);\r\n }\r\n catch (e) {\r\n throw new Error(context + \": \" + e);\r\n }\r\n };\r\n GLTFLoader._GetNumComponents = function (context, type) {\r\n switch (type) {\r\n case \"SCALAR\": return 1;\r\n case \"VEC2\": return 2;\r\n case \"VEC3\": return 3;\r\n case \"VEC4\": return 4;\r\n case \"MAT2\": return 4;\r\n case \"MAT3\": return 9;\r\n case \"MAT4\": return 16;\r\n }\r\n throw new Error(context + \": Invalid type (\" + type + \")\");\r\n };\r\n GLTFLoader._ValidateUri = function (uri) {\r\n return (Tools.IsBase64(uri) || uri.indexOf(\"..\") === -1);\r\n };\r\n /** @hidden */\r\n GLTFLoader._GetDrawMode = function (context, mode) {\r\n if (mode == undefined) {\r\n mode = 4 /* TRIANGLES */;\r\n }\r\n switch (mode) {\r\n case 0 /* POINTS */: return Material.PointListDrawMode;\r\n case 1 /* LINES */: return Material.LineListDrawMode;\r\n case 2 /* LINE_LOOP */: return Material.LineLoopDrawMode;\r\n case 3 /* LINE_STRIP */: return Material.LineStripDrawMode;\r\n case 4 /* TRIANGLES */: return Material.TriangleFillMode;\r\n case 5 /* TRIANGLE_STRIP */: return Material.TriangleStripDrawMode;\r\n case 6 /* TRIANGLE_FAN */: return Material.TriangleFanDrawMode;\r\n }\r\n throw new Error(context + \": Invalid mesh primitive mode (\" + mode + \")\");\r\n };\r\n GLTFLoader.prototype._compileMaterialsAsync = function () {\r\n var _this = this;\r\n this._parent._startPerformanceCounter(\"Compile materials\");\r\n var promises = new Array();\r\n if (this._gltf.materials) {\r\n for (var _i = 0, _a = this._gltf.materials; _i < _a.length; _i++) {\r\n var material = _a[_i];\r\n if (material._data) {\r\n for (var babylonDrawMode in material._data) {\r\n var babylonData = material._data[babylonDrawMode];\r\n for (var _b = 0, _c = babylonData.babylonMeshes; _b < _c.length; _b++) {\r\n var babylonMesh = _c[_b];\r\n // Ensure nonUniformScaling is set if necessary.\r\n babylonMesh.computeWorldMatrix(true);\r\n var babylonMaterial = babylonData.babylonMaterial;\r\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh));\r\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { useInstances: true }));\r\n if (this._parent.useClipPlane) {\r\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { clipPlane: true }));\r\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { clipPlane: true, useInstances: true }));\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return Promise.all(promises).then(function () {\r\n _this._parent._endPerformanceCounter(\"Compile materials\");\r\n });\r\n };\r\n GLTFLoader.prototype._compileShadowGeneratorsAsync = function () {\r\n var _this = this;\r\n this._parent._startPerformanceCounter(\"Compile shadow generators\");\r\n var promises = new Array();\r\n var lights = this._babylonScene.lights;\r\n for (var _i = 0, lights_1 = lights; _i < lights_1.length; _i++) {\r\n var light = lights_1[_i];\r\n var generator = light.getShadowGenerator();\r\n if (generator) {\r\n promises.push(generator.forceCompilationAsync());\r\n }\r\n }\r\n return Promise.all(promises).then(function () {\r\n _this._parent._endPerformanceCounter(\"Compile shadow generators\");\r\n });\r\n };\r\n GLTFLoader.prototype._forEachExtensions = function (action) {\r\n for (var _i = 0, _a = this._extensions; _i < _a.length; _i++) {\r\n var extension = _a[_i];\r\n if (extension.enabled) {\r\n action(extension);\r\n }\r\n }\r\n };\r\n GLTFLoader.prototype._applyExtensions = function (property, functionName, actionAsync) {\r\n for (var _i = 0, _a = this._extensions; _i < _a.length; _i++) {\r\n var extension = _a[_i];\r\n if (extension.enabled) {\r\n var id = extension.name + \".\" + functionName;\r\n var loaderProperty = property;\r\n loaderProperty._activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions || {};\r\n var activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions;\r\n if (!activeLoaderExtensionFunctions[id]) {\r\n activeLoaderExtensionFunctions[id] = true;\r\n try {\r\n var result = actionAsync(extension);\r\n if (result) {\r\n return result;\r\n }\r\n }\r\n finally {\r\n delete activeLoaderExtensionFunctions[id];\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n GLTFLoader.prototype._extensionsOnLoading = function () {\r\n this._forEachExtensions(function (extension) { return extension.onLoading && extension.onLoading(); });\r\n };\r\n GLTFLoader.prototype._extensionsOnReady = function () {\r\n this._forEachExtensions(function (extension) { return extension.onReady && extension.onReady(); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadSceneAsync = function (context, scene) {\r\n return this._applyExtensions(scene, \"loadScene\", function (extension) { return extension.loadSceneAsync && extension.loadSceneAsync(context, scene); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadNodeAsync = function (context, node, assign) {\r\n return this._applyExtensions(node, \"loadNode\", function (extension) { return extension.loadNodeAsync && extension.loadNodeAsync(context, node, assign); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadCameraAsync = function (context, camera, assign) {\r\n return this._applyExtensions(camera, \"loadCamera\", function (extension) { return extension.loadCameraAsync && extension.loadCameraAsync(context, camera, assign); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadVertexDataAsync = function (context, primitive, babylonMesh) {\r\n return this._applyExtensions(primitive, \"loadVertexData\", function (extension) { return extension._loadVertexDataAsync && extension._loadVertexDataAsync(context, primitive, babylonMesh); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadMeshPrimitiveAsync = function (context, name, node, mesh, primitive, assign) {\r\n return this._applyExtensions(primitive, \"loadMeshPrimitive\", function (extension) { return extension._loadMeshPrimitiveAsync && extension._loadMeshPrimitiveAsync(context, name, node, mesh, primitive, assign); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadMaterialAsync = function (context, material, babylonMesh, babylonDrawMode, assign) {\r\n return this._applyExtensions(material, \"loadMaterial\", function (extension) { return extension._loadMaterialAsync && extension._loadMaterialAsync(context, material, babylonMesh, babylonDrawMode, assign); });\r\n };\r\n GLTFLoader.prototype._extensionsCreateMaterial = function (context, material, babylonDrawMode) {\r\n return this._applyExtensions(material, \"createMaterial\", function (extension) { return extension.createMaterial && extension.createMaterial(context, material, babylonDrawMode); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n return this._applyExtensions(material, \"loadMaterialProperties\", function (extension) { return extension.loadMaterialPropertiesAsync && extension.loadMaterialPropertiesAsync(context, material, babylonMaterial); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadTextureInfoAsync = function (context, textureInfo, assign) {\r\n return this._applyExtensions(textureInfo, \"loadTextureInfo\", function (extension) { return extension.loadTextureInfoAsync && extension.loadTextureInfoAsync(context, textureInfo, assign); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadTextureAsync = function (context, texture, assign) {\r\n return this._applyExtensions(texture, \"loadTexture\", function (extension) { return extension._loadTextureAsync && extension._loadTextureAsync(context, texture, assign); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadAnimationAsync = function (context, animation) {\r\n return this._applyExtensions(animation, \"loadAnimation\", function (extension) { return extension.loadAnimationAsync && extension.loadAnimationAsync(context, animation); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadSkinAsync = function (context, node, skin) {\r\n return this._applyExtensions(skin, \"loadSkin\", function (extension) { return extension._loadSkinAsync && extension._loadSkinAsync(context, node, skin); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadUriAsync = function (context, property, uri) {\r\n return this._applyExtensions(property, \"loadUri\", function (extension) { return extension._loadUriAsync && extension._loadUriAsync(context, property, uri); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadBufferViewAsync = function (context, bufferView) {\r\n return this._applyExtensions(bufferView, \"loadBufferView\", function (extension) { return extension.loadBufferViewAsync && extension.loadBufferViewAsync(context, bufferView); });\r\n };\r\n GLTFLoader.prototype._extensionsLoadBufferAsync = function (context, buffer, byteOffset, byteLength) {\r\n return this._applyExtensions(buffer, \"loadBuffer\", function (extension) { return extension.loadBufferAsync && extension.loadBufferAsync(context, buffer, byteOffset, byteLength); });\r\n };\r\n /**\r\n * Helper method called by a loader extension to load an glTF extension.\r\n * @param context The context when loading the asset\r\n * @param property The glTF property to load the extension from\r\n * @param extensionName The name of the extension to load\r\n * @param actionAsync The action to run\r\n * @returns The promise returned by actionAsync or null if the extension does not exist\r\n */\r\n GLTFLoader.LoadExtensionAsync = function (context, property, extensionName, actionAsync) {\r\n if (!property.extensions) {\r\n return null;\r\n }\r\n var extensions = property.extensions;\r\n var extension = extensions[extensionName];\r\n if (!extension) {\r\n return null;\r\n }\r\n return actionAsync(context + \"/extensions/\" + extensionName, extension);\r\n };\r\n /**\r\n * Helper method called by a loader extension to load a glTF extra.\r\n * @param context The context when loading the asset\r\n * @param property The glTF property to load the extra from\r\n * @param extensionName The name of the extension to load\r\n * @param actionAsync The action to run\r\n * @returns The promise returned by actionAsync or null if the extra does not exist\r\n */\r\n GLTFLoader.LoadExtraAsync = function (context, property, extensionName, actionAsync) {\r\n if (!property.extras) {\r\n return null;\r\n }\r\n var extras = property.extras;\r\n var extra = extras[extensionName];\r\n if (!extra) {\r\n return null;\r\n }\r\n return actionAsync(context + \"/extras/\" + extensionName, extra);\r\n };\r\n /**\r\n * Checks for presence of an extension.\r\n * @param name The name of the extension to check\r\n * @returns A boolean indicating the presence of the given extension name in `extensionsUsed`\r\n */\r\n GLTFLoader.prototype.isExtensionUsed = function (name) {\r\n return !!this._gltf.extensionsUsed && this._gltf.extensionsUsed.indexOf(name) !== -1;\r\n };\r\n /**\r\n * Increments the indentation level and logs a message.\r\n * @param message The message to log\r\n */\r\n GLTFLoader.prototype.logOpen = function (message) {\r\n this._parent._logOpen(message);\r\n };\r\n /**\r\n * Decrements the indentation level.\r\n */\r\n GLTFLoader.prototype.logClose = function () {\r\n this._parent._logClose();\r\n };\r\n /**\r\n * Logs a message\r\n * @param message The message to log\r\n */\r\n GLTFLoader.prototype.log = function (message) {\r\n this._parent._log(message);\r\n };\r\n /**\r\n * Starts a performance counter.\r\n * @param counterName The name of the performance counter\r\n */\r\n GLTFLoader.prototype.startPerformanceCounter = function (counterName) {\r\n this._parent._startPerformanceCounter(counterName);\r\n };\r\n /**\r\n * Ends a performance counter.\r\n * @param counterName The name of the performance counter\r\n */\r\n GLTFLoader.prototype.endPerformanceCounter = function (counterName) {\r\n this._parent._endPerformanceCounter(counterName);\r\n };\r\n GLTFLoader._RegisteredExtensions = {};\r\n /**\r\n * The default glTF sampler.\r\n */\r\n GLTFLoader.DefaultSampler = { index: -1 };\r\n return GLTFLoader;\r\n}());\r\nexport { GLTFLoader };\r\nGLTFFileLoader._CreateGLTF2Loader = function (parent) { return new GLTFLoader(parent); };\r\n//# sourceMappingURL=glTFLoader.js.map","import { Effect } from \"../Materials/effect\";\r\nimport \"./ShadersInclude/helperFunctions\";\r\nvar name = 'rgbdEncodePixelShader';\r\nvar shader = \"\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\n#include\\nvoid main(void)\\n{\\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\\n}\";\r\nEffect.ShadersStore[name] = shader;\r\n/** @hidden */\r\nexport var rgbdEncodePixelShader = { name: name, shader: shader };\r\n//# sourceMappingURL=rgbdEncode.fragment.js.map","import { Tools } from \"./tools\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { Scalar } from \"../Maths/math.scalar\";\r\nimport { SphericalPolynomial } from \"../Maths/sphericalPolynomial\";\r\nimport { InternalTexture, InternalTextureSource } from \"../Materials/Textures/internalTexture\";\r\nimport { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Scene } from \"../scene\";\r\nimport { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport \"../Engines/Extensions/engine.renderTargetCube\";\r\nimport \"../Engines/Extensions/engine.readTexture\";\r\nimport \"../Materials/Textures/baseTexture.polynomial\";\r\nimport \"../Shaders/rgbdEncode.fragment\";\r\nimport \"../Shaders/rgbdDecode.fragment\";\r\n/**\r\n * Sets of helpers addressing the serialization and deserialization of environment texture\r\n * stored in a BabylonJS env file.\r\n * Those files are usually stored as .env files.\r\n */\r\nvar EnvironmentTextureTools = /** @class */ (function () {\r\n function EnvironmentTextureTools() {\r\n }\r\n /**\r\n * Gets the environment info from an env file.\r\n * @param data The array buffer containing the .env bytes.\r\n * @returns the environment file info (the json header) if successfully parsed.\r\n */\r\n EnvironmentTextureTools.GetEnvInfo = function (data) {\r\n var dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);\r\n var pos = 0;\r\n for (var i = 0; i < EnvironmentTextureTools._MagicBytes.length; i++) {\r\n if (dataView.getUint8(pos++) !== EnvironmentTextureTools._MagicBytes[i]) {\r\n Logger.Error('Not a babylon environment map');\r\n return null;\r\n }\r\n }\r\n // Read json manifest - collect characters up to null terminator\r\n var manifestString = '';\r\n var charCode = 0x00;\r\n while ((charCode = dataView.getUint8(pos++))) {\r\n manifestString += String.fromCharCode(charCode);\r\n }\r\n var manifest = JSON.parse(manifestString);\r\n if (manifest.specular) {\r\n // Extend the header with the position of the payload.\r\n manifest.specular.specularDataPosition = pos;\r\n // Fallback to 0.8 exactly if lodGenerationScale is not defined for backward compatibility.\r\n manifest.specular.lodGenerationScale = manifest.specular.lodGenerationScale || 0.8;\r\n }\r\n return manifest;\r\n };\r\n /**\r\n * Creates an environment texture from a loaded cube texture.\r\n * @param texture defines the cube texture to convert in env file\r\n * @return a promise containing the environment data if succesfull.\r\n */\r\n EnvironmentTextureTools.CreateEnvTextureAsync = function (texture) {\r\n var _this = this;\r\n var internalTexture = texture.getInternalTexture();\r\n if (!internalTexture) {\r\n return Promise.reject(\"The cube texture is invalid.\");\r\n }\r\n var engine = internalTexture.getEngine();\r\n if (engine && engine.premultipliedAlpha) {\r\n return Promise.reject(\"Env texture can only be created when the engine is created with the premultipliedAlpha option set to false.\");\r\n }\r\n if (texture.textureType === 0) {\r\n return Promise.reject(\"The cube texture should allow HDR (Full Float or Half Float).\");\r\n }\r\n var canvas = engine.getRenderingCanvas();\r\n if (!canvas) {\r\n return Promise.reject(\"Env texture can only be created when the engine is associated to a canvas.\");\r\n }\r\n var textureType = 1;\r\n if (!engine.getCaps().textureFloatRender) {\r\n textureType = 2;\r\n if (!engine.getCaps().textureHalfFloatRender) {\r\n return Promise.reject(\"Env texture can only be created when the browser supports half float or full float rendering.\");\r\n }\r\n }\r\n var cubeWidth = internalTexture.width;\r\n var hostingScene = new Scene(engine);\r\n var specularTextures = {};\r\n var promises = [];\r\n // Read and collect all mipmaps data from the cube.\r\n var mipmapsCount = Scalar.Log2(internalTexture.width);\r\n mipmapsCount = Math.round(mipmapsCount);\r\n var _loop_1 = function (i) {\r\n var faceWidth = Math.pow(2, mipmapsCount - i);\r\n var _loop_2 = function (face) {\r\n var data = texture.readPixels(face, i);\r\n // Creates a temp texture with the face data.\r\n var tempTexture = engine.createRawTexture(data, faceWidth, faceWidth, 5, false, false, 1, null, textureType);\r\n // And rgbdEncode them.\r\n var promise = new Promise(function (resolve, reject) {\r\n var rgbdPostProcess = new PostProcess(\"rgbdEncode\", \"rgbdEncode\", null, null, 1, null, 1, engine, false, undefined, 0, undefined, null, false);\r\n rgbdPostProcess.getEffect().executeWhenCompiled(function () {\r\n rgbdPostProcess.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", tempTexture);\r\n };\r\n // As the process needs to happen on the main canvas, keep track of the current size\r\n var currentW = engine.getRenderWidth();\r\n var currentH = engine.getRenderHeight();\r\n // Set the desired size for the texture\r\n engine.setSize(faceWidth, faceWidth);\r\n hostingScene.postProcessManager.directRender([rgbdPostProcess], null);\r\n // Reading datas from WebGL\r\n Tools.ToBlob(canvas, function (blob) {\r\n var fileReader = new FileReader();\r\n fileReader.onload = function (event) {\r\n var arrayBuffer = event.target.result;\r\n specularTextures[i * 6 + face] = arrayBuffer;\r\n resolve();\r\n };\r\n fileReader.readAsArrayBuffer(blob);\r\n });\r\n // Reapply the previous canvas size\r\n engine.setSize(currentW, currentH);\r\n });\r\n });\r\n promises.push(promise);\r\n };\r\n // All faces of the cube.\r\n for (var face = 0; face < 6; face++) {\r\n _loop_2(face);\r\n }\r\n };\r\n for (var i = 0; i <= mipmapsCount; i++) {\r\n _loop_1(i);\r\n }\r\n // Once all the textures haves been collected as RGBD stored in PNGs\r\n return Promise.all(promises).then(function () {\r\n // We can delete the hosting scene keeping track of all the creation objects\r\n hostingScene.dispose();\r\n // Creates the json header for the env texture\r\n var info = {\r\n version: 1,\r\n width: cubeWidth,\r\n irradiance: _this._CreateEnvTextureIrradiance(texture),\r\n specular: {\r\n mipmaps: [],\r\n lodGenerationScale: texture.lodGenerationScale\r\n }\r\n };\r\n // Sets the specular image data information\r\n var position = 0;\r\n for (var i = 0; i <= mipmapsCount; i++) {\r\n for (var face = 0; face < 6; face++) {\r\n var byteLength = specularTextures[i * 6 + face].byteLength;\r\n info.specular.mipmaps.push({\r\n length: byteLength,\r\n position: position\r\n });\r\n position += byteLength;\r\n }\r\n }\r\n // Encode the JSON as an array buffer\r\n var infoString = JSON.stringify(info);\r\n var infoBuffer = new ArrayBuffer(infoString.length + 1);\r\n var infoView = new Uint8Array(infoBuffer); // Limited to ascii subset matching unicode.\r\n for (var i = 0, strLen = infoString.length; i < strLen; i++) {\r\n infoView[i] = infoString.charCodeAt(i);\r\n }\r\n // Ends up with a null terminator for easier parsing\r\n infoView[infoString.length] = 0x00;\r\n // Computes the final required size and creates the storage\r\n var totalSize = EnvironmentTextureTools._MagicBytes.length + position + infoBuffer.byteLength;\r\n var finalBuffer = new ArrayBuffer(totalSize);\r\n var finalBufferView = new Uint8Array(finalBuffer);\r\n var dataView = new DataView(finalBuffer);\r\n // Copy the magic bytes identifying the file in\r\n var pos = 0;\r\n for (var i = 0; i < EnvironmentTextureTools._MagicBytes.length; i++) {\r\n dataView.setUint8(pos++, EnvironmentTextureTools._MagicBytes[i]);\r\n }\r\n // Add the json info\r\n finalBufferView.set(new Uint8Array(infoBuffer), pos);\r\n pos += infoBuffer.byteLength;\r\n // Finally inserts the texture data\r\n for (var i = 0; i <= mipmapsCount; i++) {\r\n for (var face = 0; face < 6; face++) {\r\n var dataBuffer = specularTextures[i * 6 + face];\r\n finalBufferView.set(new Uint8Array(dataBuffer), pos);\r\n pos += dataBuffer.byteLength;\r\n }\r\n }\r\n // Voila\r\n return finalBuffer;\r\n });\r\n };\r\n /**\r\n * Creates a JSON representation of the spherical data.\r\n * @param texture defines the texture containing the polynomials\r\n * @return the JSON representation of the spherical info\r\n */\r\n EnvironmentTextureTools._CreateEnvTextureIrradiance = function (texture) {\r\n var polynmials = texture.sphericalPolynomial;\r\n if (polynmials == null) {\r\n return null;\r\n }\r\n return {\r\n x: [polynmials.x.x, polynmials.x.y, polynmials.x.z],\r\n y: [polynmials.y.x, polynmials.y.y, polynmials.y.z],\r\n z: [polynmials.z.x, polynmials.z.y, polynmials.z.z],\r\n xx: [polynmials.xx.x, polynmials.xx.y, polynmials.xx.z],\r\n yy: [polynmials.yy.x, polynmials.yy.y, polynmials.yy.z],\r\n zz: [polynmials.zz.x, polynmials.zz.y, polynmials.zz.z],\r\n yz: [polynmials.yz.x, polynmials.yz.y, polynmials.yz.z],\r\n zx: [polynmials.zx.x, polynmials.zx.y, polynmials.zx.z],\r\n xy: [polynmials.xy.x, polynmials.xy.y, polynmials.xy.z]\r\n };\r\n };\r\n /**\r\n * Creates the ArrayBufferViews used for initializing environment texture image data.\r\n * @param data the image data\r\n * @param info parameters that determine what views will be created for accessing the underlying buffer\r\n * @return the views described by info providing access to the underlying buffer\r\n */\r\n EnvironmentTextureTools.CreateImageDataArrayBufferViews = function (data, info) {\r\n if (info.version !== 1) {\r\n throw new Error(\"Unsupported babylon environment map version \\\"\" + info.version + \"\\\"\");\r\n }\r\n var specularInfo = info.specular;\r\n // Double checks the enclosed info\r\n var mipmapsCount = Scalar.Log2(info.width);\r\n mipmapsCount = Math.round(mipmapsCount) + 1;\r\n if (specularInfo.mipmaps.length !== 6 * mipmapsCount) {\r\n throw new Error(\"Unsupported specular mipmaps number \\\"\" + specularInfo.mipmaps.length + \"\\\"\");\r\n }\r\n var imageData = new Array(mipmapsCount);\r\n for (var i = 0; i < mipmapsCount; i++) {\r\n imageData[i] = new Array(6);\r\n for (var face = 0; face < 6; face++) {\r\n var imageInfo = specularInfo.mipmaps[i * 6 + face];\r\n imageData[i][face] = new Uint8Array(data.buffer, data.byteOffset + specularInfo.specularDataPosition + imageInfo.position, imageInfo.length);\r\n }\r\n }\r\n return imageData;\r\n };\r\n /**\r\n * Uploads the texture info contained in the env file to the GPU.\r\n * @param texture defines the internal texture to upload to\r\n * @param data defines the data to load\r\n * @param info defines the texture info retrieved through the GetEnvInfo method\r\n * @returns a promise\r\n */\r\n EnvironmentTextureTools.UploadEnvLevelsAsync = function (texture, data, info) {\r\n if (info.version !== 1) {\r\n throw new Error(\"Unsupported babylon environment map version \\\"\" + info.version + \"\\\"\");\r\n }\r\n var specularInfo = info.specular;\r\n if (!specularInfo) {\r\n // Nothing else parsed so far\r\n return Promise.resolve();\r\n }\r\n texture._lodGenerationScale = specularInfo.lodGenerationScale;\r\n var imageData = EnvironmentTextureTools.CreateImageDataArrayBufferViews(data, info);\r\n return EnvironmentTextureTools.UploadLevelsAsync(texture, imageData);\r\n };\r\n EnvironmentTextureTools._OnImageReadyAsync = function (image, engine, expandTexture, rgbdPostProcess, url, face, i, generateNonLODTextures, lodTextures, cubeRtt, texture) {\r\n return new Promise(function (resolve, reject) {\r\n if (expandTexture) {\r\n var tempTexture_1 = engine.createTexture(null, true, true, null, 1, null, function (message) {\r\n reject(message);\r\n }, image);\r\n rgbdPostProcess.getEffect().executeWhenCompiled(function () {\r\n // Uncompress the data to a RTT\r\n rgbdPostProcess.onApply = function (effect) {\r\n effect._bindTexture(\"textureSampler\", tempTexture_1);\r\n effect.setFloat2(\"scale\", 1, 1);\r\n };\r\n engine.scenes[0].postProcessManager.directRender([rgbdPostProcess], cubeRtt, true, face, i);\r\n // Cleanup\r\n engine.restoreDefaultFramebuffer();\r\n tempTexture_1.dispose();\r\n URL.revokeObjectURL(url);\r\n resolve();\r\n });\r\n }\r\n else {\r\n engine._uploadImageToTexture(texture, image, face, i);\r\n // Upload the face to the non lod texture support\r\n if (generateNonLODTextures) {\r\n var lodTexture = lodTextures[i];\r\n if (lodTexture) {\r\n engine._uploadImageToTexture(lodTexture._texture, image, face, 0);\r\n }\r\n }\r\n resolve();\r\n }\r\n });\r\n };\r\n /**\r\n * Uploads the levels of image data to the GPU.\r\n * @param texture defines the internal texture to upload to\r\n * @param imageData defines the array buffer views of image data [mipmap][face]\r\n * @returns a promise\r\n */\r\n EnvironmentTextureTools.UploadLevelsAsync = function (texture, imageData) {\r\n var _this = this;\r\n if (!Tools.IsExponentOfTwo(texture.width)) {\r\n throw new Error(\"Texture size must be a power of two\");\r\n }\r\n var mipmapsCount = Math.round(Scalar.Log2(texture.width)) + 1;\r\n // Gets everything ready.\r\n var engine = texture.getEngine();\r\n var expandTexture = false;\r\n var generateNonLODTextures = false;\r\n var rgbdPostProcess = null;\r\n var cubeRtt = null;\r\n var lodTextures = null;\r\n var caps = engine.getCaps();\r\n texture.format = 5;\r\n texture.type = 0;\r\n texture.generateMipMaps = true;\r\n texture._cachedAnisotropicFilteringLevel = null;\r\n engine.updateTextureSamplingMode(3, texture);\r\n // Add extra process if texture lod is not supported\r\n if (!caps.textureLOD) {\r\n expandTexture = false;\r\n generateNonLODTextures = true;\r\n lodTextures = {};\r\n }\r\n // in webgl 1 there are no ways to either render or copy lod level information for float textures.\r\n else if (engine.webGLVersion < 2) {\r\n expandTexture = false;\r\n }\r\n // If half float available we can uncompress the texture\r\n else if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\r\n expandTexture = true;\r\n texture.type = 2;\r\n }\r\n // If full float available we can uncompress the texture\r\n else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\r\n expandTexture = true;\r\n texture.type = 1;\r\n }\r\n // Expand the texture if possible\r\n if (expandTexture) {\r\n // Simply run through the decode PP\r\n rgbdPostProcess = new PostProcess(\"rgbdDecode\", \"rgbdDecode\", null, null, 1, null, 3, engine, false, undefined, texture.type, undefined, null, false);\r\n texture._isRGBD = false;\r\n texture.invertY = false;\r\n cubeRtt = engine.createRenderTargetCubeTexture(texture.width, {\r\n generateDepthBuffer: false,\r\n generateMipMaps: true,\r\n generateStencilBuffer: false,\r\n samplingMode: 3,\r\n type: texture.type,\r\n format: 5\r\n });\r\n }\r\n else {\r\n texture._isRGBD = true;\r\n texture.invertY = true;\r\n // In case of missing support, applies the same patch than DDS files.\r\n if (generateNonLODTextures) {\r\n var mipSlices = 3;\r\n var scale = texture._lodGenerationScale;\r\n var offset = texture._lodGenerationOffset;\r\n for (var i = 0; i < mipSlices; i++) {\r\n //compute LOD from even spacing in smoothness (matching shader calculation)\r\n var smoothness = i / (mipSlices - 1);\r\n var roughness = 1 - smoothness;\r\n var minLODIndex = offset; // roughness = 0\r\n var maxLODIndex = (mipmapsCount - 1) * scale + offset; // roughness = 1 (mipmaps start from 0)\r\n var lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;\r\n var mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));\r\n var glTextureFromLod = new InternalTexture(engine, InternalTextureSource.Temp);\r\n glTextureFromLod.isCube = true;\r\n glTextureFromLod.invertY = true;\r\n glTextureFromLod.generateMipMaps = false;\r\n engine.updateTextureSamplingMode(2, glTextureFromLod);\r\n // Wrap in a base texture for easy binding.\r\n var lodTexture = new BaseTexture(null);\r\n lodTexture.isCube = true;\r\n lodTexture._texture = glTextureFromLod;\r\n lodTextures[mipmapIndex] = lodTexture;\r\n switch (i) {\r\n case 0:\r\n texture._lodTextureLow = lodTexture;\r\n break;\r\n case 1:\r\n texture._lodTextureMid = lodTexture;\r\n break;\r\n case 2:\r\n texture._lodTextureHigh = lodTexture;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n var promises = [];\r\n var _loop_3 = function (i) {\r\n var _loop_4 = function (face) {\r\n // Constructs an image element from image data\r\n var bytes = imageData[i][face];\r\n var blob = new Blob([bytes], { type: 'image/png' });\r\n var url = URL.createObjectURL(blob);\r\n var promise = void 0;\r\n if (typeof Image === \"undefined\") {\r\n promise = createImageBitmap(blob).then(function (img) {\r\n return _this._OnImageReadyAsync(img, engine, expandTexture, rgbdPostProcess, url, face, i, generateNonLODTextures, lodTextures, cubeRtt, texture);\r\n });\r\n }\r\n else {\r\n var image_1 = new Image();\r\n image_1.src = url;\r\n // Enqueue promise to upload to the texture.\r\n promise = new Promise(function (resolve, reject) {\r\n image_1.onload = function () {\r\n _this._OnImageReadyAsync(image_1, engine, expandTexture, rgbdPostProcess, url, face, i, generateNonLODTextures, lodTextures, cubeRtt, texture)\r\n .then(function () { return resolve(); })\r\n .catch(function (reason) {\r\n reject(reason);\r\n });\r\n };\r\n image_1.onerror = function (error) {\r\n reject(error);\r\n };\r\n });\r\n }\r\n promises.push(promise);\r\n };\r\n // All faces\r\n for (var face = 0; face < 6; face++) {\r\n _loop_4(face);\r\n }\r\n };\r\n // All mipmaps up to provided number of images\r\n for (var i = 0; i < imageData.length; i++) {\r\n _loop_3(i);\r\n }\r\n // Fill remaining mipmaps with black textures.\r\n if (imageData.length < mipmapsCount) {\r\n var data = void 0;\r\n var size = Math.pow(2, mipmapsCount - 1 - imageData.length);\r\n var dataLength = size * size * 4;\r\n switch (texture.type) {\r\n case 0: {\r\n data = new Uint8Array(dataLength);\r\n break;\r\n }\r\n case 2: {\r\n data = new Uint16Array(dataLength);\r\n break;\r\n }\r\n case 1: {\r\n data = new Float32Array(dataLength);\r\n break;\r\n }\r\n }\r\n for (var i = imageData.length; i < mipmapsCount; i++) {\r\n for (var face = 0; face < 6; face++) {\r\n engine._uploadArrayBufferViewToTexture(texture, data, face, i);\r\n }\r\n }\r\n }\r\n // Once all done, finishes the cleanup and return\r\n return Promise.all(promises).then(function () {\r\n // Release temp RTT.\r\n if (cubeRtt) {\r\n engine._releaseFramebufferObjects(cubeRtt);\r\n engine._releaseTexture(texture);\r\n cubeRtt._swapAndDie(texture);\r\n }\r\n // Release temp Post Process.\r\n if (rgbdPostProcess) {\r\n rgbdPostProcess.dispose();\r\n }\r\n // Flag internal texture as ready in case they are in use.\r\n if (generateNonLODTextures) {\r\n if (texture._lodTextureHigh && texture._lodTextureHigh._texture) {\r\n texture._lodTextureHigh._texture.isReady = true;\r\n }\r\n if (texture._lodTextureMid && texture._lodTextureMid._texture) {\r\n texture._lodTextureMid._texture.isReady = true;\r\n }\r\n if (texture._lodTextureLow && texture._lodTextureLow._texture) {\r\n texture._lodTextureLow._texture.isReady = true;\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Uploads spherical polynomials information to the texture.\r\n * @param texture defines the texture we are trying to upload the information to\r\n * @param info defines the environment texture info retrieved through the GetEnvInfo method\r\n */\r\n EnvironmentTextureTools.UploadEnvSpherical = function (texture, info) {\r\n if (info.version !== 1) {\r\n Logger.Warn('Unsupported babylon environment map version \"' + info.version + '\"');\r\n }\r\n var irradianceInfo = info.irradiance;\r\n if (!irradianceInfo) {\r\n return;\r\n }\r\n var sp = new SphericalPolynomial();\r\n Vector3.FromArrayToRef(irradianceInfo.x, 0, sp.x);\r\n Vector3.FromArrayToRef(irradianceInfo.y, 0, sp.y);\r\n Vector3.FromArrayToRef(irradianceInfo.z, 0, sp.z);\r\n Vector3.FromArrayToRef(irradianceInfo.xx, 0, sp.xx);\r\n Vector3.FromArrayToRef(irradianceInfo.yy, 0, sp.yy);\r\n Vector3.FromArrayToRef(irradianceInfo.zz, 0, sp.zz);\r\n Vector3.FromArrayToRef(irradianceInfo.yz, 0, sp.yz);\r\n Vector3.FromArrayToRef(irradianceInfo.zx, 0, sp.zx);\r\n Vector3.FromArrayToRef(irradianceInfo.xy, 0, sp.xy);\r\n texture._sphericalPolynomial = sp;\r\n };\r\n /** @hidden */\r\n EnvironmentTextureTools._UpdateRGBDAsync = function (internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\r\n internalTexture._source = InternalTextureSource.CubeRawRGBD;\r\n internalTexture._bufferViewArrayArray = data;\r\n internalTexture._lodGenerationScale = lodScale;\r\n internalTexture._lodGenerationOffset = lodOffset;\r\n internalTexture._sphericalPolynomial = sphericalPolynomial;\r\n return EnvironmentTextureTools.UploadLevelsAsync(internalTexture, data).then(function () {\r\n internalTexture.isReady = true;\r\n });\r\n };\r\n /**\r\n * Magic number identifying the env file.\r\n */\r\n EnvironmentTextureTools._MagicBytes = [0x86, 0x16, 0x87, 0x96, 0xf6, 0xd6, 0x96, 0x36];\r\n return EnvironmentTextureTools;\r\n}());\r\nexport { EnvironmentTextureTools };\r\n// References the dependencies.\r\nInternalTexture._UpdateRGBDAsync = EnvironmentTextureTools._UpdateRGBDAsync;\r\n//# sourceMappingURL=environmentTextureTools.js.map","import { __assign } from \"tslib\";\r\nimport { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport { InternalTexture, InternalTextureSource } from '../../Materials/Textures/internalTexture';\r\nimport { Logger } from '../../Misc/logger';\r\nimport { FileTools } from '../../Misc/fileTools';\r\nThinEngine.prototype._createDepthStencilCubeTexture = function (size, options) {\r\n var internalTexture = new InternalTexture(this, InternalTextureSource.Unknown);\r\n internalTexture.isCube = true;\r\n if (this.webGLVersion === 1) {\r\n Logger.Error(\"Depth cube texture is not supported by WebGL 1.\");\r\n return internalTexture;\r\n }\r\n var internalOptions = __assign({ bilinearFiltering: false, comparisonFunction: 0, generateStencil: false }, options);\r\n var gl = this._gl;\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, internalTexture, true);\r\n this._setupDepthStencilTexture(internalTexture, size, internalOptions.generateStencil, internalOptions.bilinearFiltering, internalOptions.comparisonFunction);\r\n // Create the depth/stencil buffer\r\n for (var face = 0; face < 6; face++) {\r\n if (internalOptions.generateStencil) {\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.DEPTH24_STENCIL8, size, size, 0, gl.DEPTH_STENCIL, gl.UNSIGNED_INT_24_8, null);\r\n }\r\n else {\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.DEPTH_COMPONENT24, size, size, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null);\r\n }\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n return internalTexture;\r\n};\r\nThinEngine.prototype._partialLoadFile = function (url, index, loadedFiles, onfinish, onErrorCallBack) {\r\n if (onErrorCallBack === void 0) { onErrorCallBack = null; }\r\n var onload = function (data) {\r\n loadedFiles[index] = data;\r\n loadedFiles._internalCount++;\r\n if (loadedFiles._internalCount === 6) {\r\n onfinish(loadedFiles);\r\n }\r\n };\r\n var onerror = function (request, exception) {\r\n if (onErrorCallBack && request) {\r\n onErrorCallBack(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n this._loadFile(url, onload, undefined, undefined, true, onerror);\r\n};\r\nThinEngine.prototype._cascadeLoadFiles = function (scene, onfinish, files, onError) {\r\n if (onError === void 0) { onError = null; }\r\n var loadedFiles = [];\r\n loadedFiles._internalCount = 0;\r\n for (var index = 0; index < 6; index++) {\r\n this._partialLoadFile(files[index], index, loadedFiles, onfinish, onError);\r\n }\r\n};\r\nThinEngine.prototype._cascadeLoadImgs = function (scene, onfinish, files, onError, mimeType) {\r\n if (onError === void 0) { onError = null; }\r\n var loadedImages = [];\r\n loadedImages._internalCount = 0;\r\n for (var index = 0; index < 6; index++) {\r\n this._partialLoadImg(files[index], index, loadedImages, scene, onfinish, onError, mimeType);\r\n }\r\n};\r\nThinEngine.prototype._partialLoadImg = function (url, index, loadedImages, scene, onfinish, onErrorCallBack, mimeType) {\r\n if (onErrorCallBack === void 0) { onErrorCallBack = null; }\r\n var img;\r\n var onload = function () {\r\n if (img) {\r\n loadedImages[index] = img;\r\n loadedImages._internalCount++;\r\n if (scene) {\r\n scene._removePendingData(img);\r\n }\r\n }\r\n if (loadedImages._internalCount === 6) {\r\n onfinish(loadedImages);\r\n }\r\n };\r\n var onerror = function (message, exception) {\r\n if (scene) {\r\n scene._removePendingData(img);\r\n }\r\n if (onErrorCallBack) {\r\n onErrorCallBack(message, exception);\r\n }\r\n };\r\n img = FileTools.LoadImage(url, onload, onerror, scene ? scene.offlineProvider : null, mimeType);\r\n if (scene && img) {\r\n scene._addPendingData(img);\r\n }\r\n};\r\nThinEngine.prototype._setCubeMapTextureParams = function (texture, loadMipmap) {\r\n var gl = this._gl;\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, loadMipmap ? gl.LINEAR_MIPMAP_LINEAR : gl.LINEAR);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n texture.samplingMode = loadMipmap ? 3 : 2;\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n};\r\nThinEngine.prototype.createCubeTexture = function (rootUrl, scene, files, noMipmap, onLoad, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset, fallback, loaderOptions) {\r\n var _this = this;\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = false; }\r\n if (lodScale === void 0) { lodScale = 0; }\r\n if (lodOffset === void 0) { lodOffset = 0; }\r\n if (fallback === void 0) { fallback = null; }\r\n var gl = this._gl;\r\n var texture = fallback ? fallback : new InternalTexture(this, InternalTextureSource.Cube);\r\n texture.isCube = true;\r\n texture.url = rootUrl;\r\n texture.generateMipMaps = !noMipmap;\r\n texture._lodGenerationScale = lodScale;\r\n texture._lodGenerationOffset = lodOffset;\r\n if (!this._doNotHandleContextLost) {\r\n texture._extension = forcedExtension;\r\n texture._files = files;\r\n }\r\n var originalRootUrl = rootUrl;\r\n if (this._transformTextureUrl && !fallback) {\r\n rootUrl = this._transformTextureUrl(rootUrl);\r\n }\r\n var lastDot = rootUrl.lastIndexOf('.');\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? rootUrl.substring(lastDot).toLowerCase() : \"\");\r\n var loader = null;\r\n for (var _i = 0, _a = ThinEngine._TextureLoaders; _i < _a.length; _i++) {\r\n var availableLoader = _a[_i];\r\n if (availableLoader.canLoad(extension)) {\r\n loader = availableLoader;\r\n break;\r\n }\r\n }\r\n var onInternalError = function (request, exception) {\r\n if (rootUrl === originalRootUrl) {\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n }\r\n else {\r\n // fall back to the original url if the transformed url fails to load\r\n Logger.Warn(\"Failed to load \" + rootUrl + \", falling back to the \" + originalRootUrl);\r\n _this.createCubeTexture(originalRootUrl, scene, files, noMipmap, onLoad, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset, texture, loaderOptions);\r\n }\r\n };\r\n if (loader) {\r\n var onloaddata_1 = function (data) {\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n loader.loadCubeData(data, texture, createPolynomials, onLoad, onError);\r\n };\r\n if (files && files.length === 6) {\r\n if (loader.supportCascades) {\r\n this._cascadeLoadFiles(scene, function (images) { return onloaddata_1(images.map(function (image) { return new Uint8Array(image); })); }, files, onError);\r\n }\r\n else {\r\n if (onError) {\r\n onError(\"Textures type does not support cascades.\");\r\n }\r\n else {\r\n Logger.Warn(\"Texture loader does not support cascades.\");\r\n }\r\n }\r\n }\r\n else {\r\n this._loadFile(rootUrl, function (data) { return onloaddata_1(new Uint8Array(data)); }, undefined, undefined, true, onInternalError);\r\n }\r\n }\r\n else {\r\n if (!files) {\r\n throw new Error(\"Cannot load cubemap because files were not defined\");\r\n }\r\n this._cascadeLoadImgs(scene, function (imgs) {\r\n var width = _this.needPOTTextures ? ThinEngine.GetExponentOfTwo(imgs[0].width, _this._caps.maxCubemapTextureSize) : imgs[0].width;\r\n var height = width;\r\n var faces = [\r\n gl.TEXTURE_CUBE_MAP_POSITIVE_X, gl.TEXTURE_CUBE_MAP_POSITIVE_Y, gl.TEXTURE_CUBE_MAP_POSITIVE_Z,\r\n gl.TEXTURE_CUBE_MAP_NEGATIVE_X, gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, gl.TEXTURE_CUBE_MAP_NEGATIVE_Z\r\n ];\r\n _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n _this._unpackFlipY(false);\r\n var internalFormat = format ? _this._getInternalFormat(format) : _this._gl.RGBA;\r\n for (var index = 0; index < faces.length; index++) {\r\n if (imgs[index].width !== width || imgs[index].height !== height) {\r\n _this._prepareWorkingCanvas();\r\n if (!_this._workingCanvas || !_this._workingContext) {\r\n Logger.Warn(\"Cannot create canvas to resize texture.\");\r\n return;\r\n }\r\n _this._workingCanvas.width = width;\r\n _this._workingCanvas.height = height;\r\n _this._workingContext.drawImage(imgs[index], 0, 0, imgs[index].width, imgs[index].height, 0, 0, width, height);\r\n gl.texImage2D(faces[index], 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, _this._workingCanvas);\r\n }\r\n else {\r\n gl.texImage2D(faces[index], 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, imgs[index]);\r\n }\r\n }\r\n if (!noMipmap) {\r\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\r\n }\r\n _this._setCubeMapTextureParams(texture, !noMipmap);\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n if (format) {\r\n texture.format = format;\r\n }\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n }, files, onError);\r\n }\r\n this._internalTexturesCache.push(texture);\r\n return texture;\r\n};\r\n//# sourceMappingURL=engine.cubeTexture.js.map","import { __decorate, __extends } from \"tslib\";\r\nimport { serialize, serializeAsMatrix, SerializationHelper } from \"../../Misc/decorators\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { Matrix, Vector3 } from \"../../Maths/math.vector\";\r\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { _TypeStore } from '../../Misc/typeStore';\r\nimport \"../../Engines/Extensions/engine.cubeTexture\";\r\nimport { StringTools } from '../../Misc/stringTools';\r\nimport { Observable } from '../../Misc/observable';\r\n/**\r\n * Class for creating a cube texture\r\n */\r\nvar CubeTexture = /** @class */ (function (_super) {\r\n __extends(CubeTexture, _super);\r\n /**\r\n * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well\r\n * as prefiltered data.\r\n * @param rootUrl defines the url of the texture or the root name of the six images\r\n * @param null defines the scene or engine the texture is attached to\r\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\r\n * @param noMipmap defines if mipmaps should be created or not\r\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\r\n * @param onLoad defines a callback triggered at the end of the file load if no errors occured\r\n * @param onError defines a callback triggered in case of error during load\r\n * @param format defines the internal format to use for the texture once loaded\r\n * @param prefiltered defines whether or not the texture is created from prefiltered data\r\n * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @param loaderOptions options to be passed to the loader\r\n * @return the cube texture\r\n */\r\n function CubeTexture(rootUrl, sceneOrEngine, extensions, noMipmap, files, onLoad, onError, format, prefiltered, forcedExtension, createPolynomials, lodScale, lodOffset, loaderOptions) {\r\n if (extensions === void 0) { extensions = null; }\r\n if (noMipmap === void 0) { noMipmap = false; }\r\n if (files === void 0) { files = null; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (format === void 0) { format = 5; }\r\n if (prefiltered === void 0) { prefiltered = false; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = false; }\r\n if (lodScale === void 0) { lodScale = 0.8; }\r\n if (lodOffset === void 0) { lodOffset = 0; }\r\n var _a;\r\n var _this = _super.call(this, sceneOrEngine) || this;\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n _this.onLoadObservable = new Observable();\r\n /**\r\n * Gets or sets the center of the bounding box associated with the cube texture.\r\n * It must define where the camera used to render the texture was set\r\n * @see https://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode\r\n */\r\n _this.boundingBoxPosition = Vector3.Zero();\r\n _this._rotationY = 0;\r\n _this._files = null;\r\n _this._forcedExtension = null;\r\n _this._extensions = null;\r\n _this.name = rootUrl;\r\n _this.url = rootUrl;\r\n _this._noMipmap = noMipmap;\r\n _this.hasAlpha = false;\r\n _this._format = format;\r\n _this.isCube = true;\r\n _this._textureMatrix = Matrix.Identity();\r\n _this._createPolynomials = createPolynomials;\r\n _this.coordinatesMode = Texture.CUBIC_MODE;\r\n _this._extensions = extensions;\r\n _this._files = files;\r\n _this._forcedExtension = forcedExtension;\r\n _this._loaderOptions = loaderOptions;\r\n if (!rootUrl && !files) {\r\n return _this;\r\n }\r\n var lastDot = rootUrl.lastIndexOf(\".\");\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? rootUrl.substring(lastDot).toLowerCase() : \"\");\r\n var isDDS = (extension === \".dds\");\r\n var isEnv = (extension === \".env\");\r\n if (isEnv) {\r\n _this.gammaSpace = false;\r\n _this._prefiltered = false;\r\n _this.anisotropicFilteringLevel = 1;\r\n }\r\n else {\r\n _this._prefiltered = prefiltered;\r\n if (prefiltered) {\r\n _this.gammaSpace = false;\r\n _this.anisotropicFilteringLevel = 1;\r\n }\r\n }\r\n _this._texture = _this._getFromCache(rootUrl, noMipmap);\r\n if (!files) {\r\n if (!isEnv && !isDDS && !extensions) {\r\n extensions = [\"_px.jpg\", \"_py.jpg\", \"_pz.jpg\", \"_nx.jpg\", \"_ny.jpg\", \"_nz.jpg\"];\r\n }\r\n files = [];\r\n if (extensions) {\r\n for (var index = 0; index < extensions.length; index++) {\r\n files.push(rootUrl + extensions[index]);\r\n }\r\n }\r\n }\r\n _this._files = files;\r\n var onLoadProcessing = function () {\r\n _this.onLoadObservable.notifyObservers(_this);\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n if (!_this._texture) {\r\n var scene = _this.getScene();\r\n if (!(scene === null || scene === void 0 ? void 0 : scene.useDelayedTextureLoading)) {\r\n if (prefiltered) {\r\n _this._texture = _this._getEngine().createPrefilteredCubeTexture(rootUrl, scene, lodScale, lodOffset, onLoad, onError, format, forcedExtension, _this._createPolynomials);\r\n }\r\n else {\r\n _this._texture = _this._getEngine().createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError, _this._format, forcedExtension, false, lodScale, lodOffset, null, loaderOptions);\r\n }\r\n (_a = _this._texture) === null || _a === void 0 ? void 0 : _a.onLoadedObservable.add(function () { return _this.onLoadObservable.notifyObservers(_this); });\r\n }\r\n else {\r\n _this.delayLoadState = 4;\r\n }\r\n }\r\n else {\r\n if (_this._texture.isReady) {\r\n Tools.SetImmediate(function () { return onLoadProcessing(); });\r\n }\r\n else {\r\n _this._texture.onLoadedObservable.add(function () { return onLoadProcessing(); });\r\n }\r\n }\r\n return _this;\r\n }\r\n Object.defineProperty(CubeTexture.prototype, \"boundingBoxSize\", {\r\n /**\r\n * Returns the bounding box size\r\n * @see https://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode\r\n */\r\n get: function () {\r\n return this._boundingBoxSize;\r\n },\r\n /**\r\n * Gets or sets the size of the bounding box associated with the cube texture\r\n * When defined, the cubemap will switch to local mode\r\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\r\n * @example https://www.babylonjs-playground.com/#RNASML\r\n */\r\n set: function (value) {\r\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\r\n return;\r\n }\r\n this._boundingBoxSize = value;\r\n var scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(1);\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(CubeTexture.prototype, \"rotationY\", {\r\n /**\r\n * Gets texture matrix rotation angle around Y axis radians.\r\n */\r\n get: function () {\r\n return this._rotationY;\r\n },\r\n /**\r\n * Sets texture matrix rotation angle around Y axis in radians.\r\n */\r\n set: function (value) {\r\n this._rotationY = value;\r\n this.setReflectionTextureMatrix(Matrix.RotationY(this._rotationY));\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(CubeTexture.prototype, \"noMipmap\", {\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n get: function () {\r\n return this._noMipmap;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Creates a cube texture from an array of image urls\r\n * @param files defines an array of image urls\r\n * @param scene defines the hosting scene\r\n * @param noMipmap specifies if mip maps are not used\r\n * @returns a cube texture\r\n */\r\n CubeTexture.CreateFromImages = function (files, scene, noMipmap) {\r\n var rootUrlKey = \"\";\r\n files.forEach(function (url) { return rootUrlKey += url; });\r\n return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);\r\n };\r\n /**\r\n * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.\r\n * @param url defines the url of the prefiltered texture\r\n * @param scene defines the scene the texture is attached to\r\n * @param forcedExtension defines the extension of the file if different from the url\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @return the prefiltered texture\r\n */\r\n CubeTexture.CreateFromPrefilteredData = function (url, scene, forcedExtension, createPolynomials) {\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (createPolynomials === void 0) { createPolynomials = true; }\r\n var oldValue = scene.useDelayedTextureLoading;\r\n scene.useDelayedTextureLoading = false;\r\n var result = new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);\r\n scene.useDelayedTextureLoading = oldValue;\r\n return result;\r\n };\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"CubeTexture\"\r\n */\r\n CubeTexture.prototype.getClassName = function () {\r\n return \"CubeTexture\";\r\n };\r\n /**\r\n * Update the url (and optional buffer) of this texture if url was null during construction.\r\n * @param url the url of the texture\r\n * @param forcedExtension defines the extension to use\r\n * @param onLoad callback called when the texture is loaded (defaults to null)\r\n * @param prefiltered Defines whether the updated texture is prefiltered or not\r\n */\r\n CubeTexture.prototype.updateURL = function (url, forcedExtension, onLoad, prefiltered) {\r\n var _a;\r\n if (prefiltered === void 0) { prefiltered = false; }\r\n if (this.url) {\r\n this.releaseInternalTexture();\r\n (_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.markAllMaterialsAsDirty(1);\r\n }\r\n if (!this.name || StringTools.StartsWith(this.name, \"data:\")) {\r\n this.name = url;\r\n }\r\n this.url = url;\r\n this.delayLoadState = 4;\r\n this._prefiltered = prefiltered;\r\n if (this._prefiltered) {\r\n this.gammaSpace = false;\r\n this.anisotropicFilteringLevel = 1;\r\n }\r\n this._forcedExtension = forcedExtension || null;\r\n if (onLoad) {\r\n this._delayedOnLoad = onLoad;\r\n }\r\n this.delayLoad(forcedExtension);\r\n };\r\n /**\r\n * Delays loading of the cube texture\r\n * @param forcedExtension defines the extension to use\r\n */\r\n CubeTexture.prototype.delayLoad = function (forcedExtension) {\r\n var _this = this;\r\n var _a;\r\n if (this.delayLoadState !== 4) {\r\n return;\r\n }\r\n this.delayLoadState = 1;\r\n this._texture = this._getFromCache(this.url, this._noMipmap);\r\n if (!this._texture) {\r\n var scene = this.getScene();\r\n if (this._prefiltered) {\r\n this._texture = this._getEngine().createPrefilteredCubeTexture(this.url, scene, 0.8, 0, this._delayedOnLoad, undefined, this._format, forcedExtension, this._createPolynomials);\r\n }\r\n else {\r\n this._texture = this._getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, null, this._format, forcedExtension, false, 0, 0, null, this._loaderOptions);\r\n }\r\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.onLoadedObservable.add(function () { return _this.onLoadObservable.notifyObservers(_this); });\r\n }\r\n };\r\n /**\r\n * Returns the reflection texture matrix\r\n * @returns the reflection texture matrix\r\n */\r\n CubeTexture.prototype.getReflectionTextureMatrix = function () {\r\n return this._textureMatrix;\r\n };\r\n /**\r\n * Sets the reflection texture matrix\r\n * @param value Reflection texture matrix\r\n */\r\n CubeTexture.prototype.setReflectionTextureMatrix = function (value) {\r\n var _this = this;\r\n var _a;\r\n if (value.updateFlag === this._textureMatrix.updateFlag) {\r\n return;\r\n }\r\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\r\n (_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.markAllMaterialsAsDirty(1, function (mat) { return mat.getActiveTextures().indexOf(_this) !== -1; });\r\n }\r\n this._textureMatrix = value;\r\n };\r\n /**\r\n * Parses text to create a cube texture\r\n * @param parsedTexture define the serialized text to read from\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url of the cube texture\r\n * @returns a cube texture\r\n */\r\n CubeTexture.Parse = function (parsedTexture, scene, rootUrl) {\r\n var texture = SerializationHelper.Parse(function () {\r\n var prefiltered = false;\r\n if (parsedTexture.prefiltered) {\r\n prefiltered = parsedTexture.prefiltered;\r\n }\r\n return new CubeTexture(rootUrl + parsedTexture.name, scene, parsedTexture.extensions, false, parsedTexture.files || null, null, null, undefined, prefiltered, parsedTexture.forcedExtension);\r\n }, parsedTexture, scene);\r\n // Local Cubemaps\r\n if (parsedTexture.boundingBoxPosition) {\r\n texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);\r\n }\r\n if (parsedTexture.boundingBoxSize) {\r\n texture.boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);\r\n }\r\n // Animations\r\n if (parsedTexture.animations) {\r\n for (var animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\r\n var parsedAnimation = parsedTexture.animations[animationIndex];\r\n var internalClass = _TypeStore.GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n texture.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Makes a clone, or deep copy, of the cube texture\r\n * @returns a new cube texture\r\n */\r\n CubeTexture.prototype.clone = function () {\r\n var _this = this;\r\n var uniqueId = 0;\r\n var newCubeTexture = SerializationHelper.Clone(function () {\r\n var cubeTexture = new CubeTexture(_this.url, _this.getScene() || _this._getEngine(), _this._extensions, _this._noMipmap, _this._files);\r\n uniqueId = cubeTexture.uniqueId;\r\n return cubeTexture;\r\n }, this);\r\n newCubeTexture.uniqueId = uniqueId;\r\n return newCubeTexture;\r\n };\r\n __decorate([\r\n serialize()\r\n ], CubeTexture.prototype, \"url\", void 0);\r\n __decorate([\r\n serialize(\"rotationY\")\r\n ], CubeTexture.prototype, \"rotationY\", null);\r\n __decorate([\r\n serialize(\"files\")\r\n ], CubeTexture.prototype, \"_files\", void 0);\r\n __decorate([\r\n serialize(\"forcedExtension\")\r\n ], CubeTexture.prototype, \"_forcedExtension\", void 0);\r\n __decorate([\r\n serialize(\"extensions\")\r\n ], CubeTexture.prototype, \"_extensions\", void 0);\r\n __decorate([\r\n serializeAsMatrix(\"textureMatrix\")\r\n ], CubeTexture.prototype, \"_textureMatrix\", void 0);\r\n return CubeTexture;\r\n}(BaseTexture));\r\nexport { CubeTexture };\r\nTexture._CubeTextureParser = CubeTexture.Parse;\r\n// Some exporters relies on Tools.Instantiate\r\n_TypeStore.RegisteredTypes[\"BABYLON.CubeTexture\"] = CubeTexture;\r\n//# sourceMappingURL=cubeTexture.js.map","import { __extends } from \"tslib\";\r\nimport { SerializationHelper } from \"../../Misc/decorators\";\r\nimport { EnvironmentTextureTools } from \"../../Misc/environmentTextureTools\";\r\nimport { InternalTextureSource } from \"./internalTexture\";\r\nimport { CubeTexture } from \"./cubeTexture\";\r\nimport \"../../Engines/Extensions/engine.rawTexture\";\r\n/**\r\n * Raw cube texture where the raw buffers are passed in\r\n */\r\nvar RawCubeTexture = /** @class */ (function (_super) {\r\n __extends(RawCubeTexture, _super);\r\n /**\r\n * Creates a cube texture where the raw buffers are passed in.\r\n * @param scene defines the scene the texture is attached to\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n */\r\n function RawCubeTexture(scene, data, size, format, type, generateMipMaps, invertY, samplingMode, compression) {\r\n if (format === void 0) { format = 5; }\r\n if (type === void 0) { type = 0; }\r\n if (generateMipMaps === void 0) { generateMipMaps = false; }\r\n if (invertY === void 0) { invertY = false; }\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (compression === void 0) { compression = null; }\r\n var _this = _super.call(this, \"\", scene) || this;\r\n _this._texture = scene.getEngine().createRawCubeTexture(data, size, format, type, generateMipMaps, invertY, samplingMode, compression);\r\n return _this;\r\n }\r\n /**\r\n * Updates the raw cube texture.\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param level defines which level of the texture to update\r\n */\r\n RawCubeTexture.prototype.update = function (data, format, type, invertY, compression) {\r\n if (compression === void 0) { compression = null; }\r\n this._texture.getEngine().updateRawCubeTexture(this._texture, data, format, type, invertY, compression);\r\n };\r\n /**\r\n * Updates a raw cube texture with RGBD encoded data.\r\n * @param data defines the array of data [mipmap][face] to use to create each face\r\n * @param sphericalPolynomial defines the spherical polynomial for irradiance\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @returns a promsie that resolves when the operation is complete\r\n */\r\n RawCubeTexture.prototype.updateRGBDAsync = function (data, sphericalPolynomial, lodScale, lodOffset) {\r\n if (sphericalPolynomial === void 0) { sphericalPolynomial = null; }\r\n if (lodScale === void 0) { lodScale = 0.8; }\r\n if (lodOffset === void 0) { lodOffset = 0; }\r\n return RawCubeTexture._UpdateRGBDAsync(this._texture, data, sphericalPolynomial, lodScale, lodOffset);\r\n };\r\n /**\r\n * Clones the raw cube texture.\r\n * @return a new cube texture\r\n */\r\n RawCubeTexture.prototype.clone = function () {\r\n var _this = this;\r\n return SerializationHelper.Clone(function () {\r\n var scene = _this.getScene();\r\n var internalTexture = _this._texture;\r\n var texture = new RawCubeTexture(scene, internalTexture._bufferViewArray, internalTexture.width, internalTexture.format, internalTexture.type, internalTexture.generateMipMaps, internalTexture.invertY, internalTexture.samplingMode, internalTexture._compression);\r\n if (internalTexture.source === InternalTextureSource.CubeRawRGBD) {\r\n texture.updateRGBDAsync(internalTexture._bufferViewArrayArray, internalTexture._sphericalPolynomial, internalTexture._lodGenerationScale, internalTexture._lodGenerationOffset);\r\n }\r\n return texture;\r\n }, this);\r\n };\r\n /** @hidden */\r\n RawCubeTexture._UpdateRGBDAsync = function (internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\r\n internalTexture._source = InternalTextureSource.CubeRawRGBD;\r\n internalTexture._bufferViewArrayArray = data;\r\n internalTexture._lodGenerationScale = lodScale;\r\n internalTexture._lodGenerationOffset = lodOffset;\r\n internalTexture._sphericalPolynomial = sphericalPolynomial;\r\n return EnvironmentTextureTools.UploadLevelsAsync(internalTexture, data).then(function () {\r\n internalTexture.isReady = true;\r\n });\r\n };\r\n return RawCubeTexture;\r\n}(CubeTexture));\r\nexport { RawCubeTexture };\r\n//# sourceMappingURL=rawCubeTexture.js.map","import { Scalar } from \"@babylonjs/core/Maths/math.scalar\";\r\nimport { SphericalHarmonics, SphericalPolynomial } from \"@babylonjs/core/Maths/sphericalPolynomial\";\r\nimport { Quaternion, Matrix } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { RawCubeTexture } from \"@babylonjs/core/Materials/Textures/rawCubeTexture\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nvar NAME = \"EXT_lights_image_based\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_lights_image_based/README.md)\r\n */\r\nvar EXT_lights_image_based = /** @class */ (function () {\r\n /** @hidden */\r\n function EXT_lights_image_based(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n EXT_lights_image_based.prototype.dispose = function () {\r\n this._loader = null;\r\n delete this._lights;\r\n };\r\n /** @hidden */\r\n EXT_lights_image_based.prototype.onLoading = function () {\r\n var extensions = this._loader.gltf.extensions;\r\n if (extensions && extensions[this.name]) {\r\n var extension = extensions[this.name];\r\n this._lights = extension.lights;\r\n }\r\n };\r\n /** @hidden */\r\n EXT_lights_image_based.prototype.loadSceneAsync = function (context, scene) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, scene, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadSceneAsync(context, scene));\r\n _this._loader.logOpen(\"\" + extensionContext);\r\n var light = ArrayItem.Get(extensionContext + \"/light\", _this._lights, extension.light);\r\n promises.push(_this._loadLightAsync(\"/extensions/\" + _this.name + \"/lights/\" + extension.light, light).then(function (texture) {\r\n _this._loader.babylonScene.environmentTexture = texture;\r\n }));\r\n _this._loader.logClose();\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n EXT_lights_image_based.prototype._loadLightAsync = function (context, light) {\r\n var _this = this;\r\n if (!light._loaded) {\r\n var promises = new Array();\r\n this._loader.logOpen(\"\" + context);\r\n var imageData_1 = new Array(light.specularImages.length);\r\n var _loop_1 = function (mipmap) {\r\n var faces = light.specularImages[mipmap];\r\n imageData_1[mipmap] = new Array(faces.length);\r\n var _loop_2 = function (face) {\r\n var specularImageContext = context + \"/specularImages/\" + mipmap + \"/\" + face;\r\n this_1._loader.logOpen(\"\" + specularImageContext);\r\n var index = faces[face];\r\n var image = ArrayItem.Get(specularImageContext, this_1._loader.gltf.images, index);\r\n promises.push(this_1._loader.loadImageAsync(\"/images/\" + index, image).then(function (data) {\r\n imageData_1[mipmap][face] = data;\r\n }));\r\n this_1._loader.logClose();\r\n };\r\n for (var face = 0; face < faces.length; face++) {\r\n _loop_2(face);\r\n }\r\n };\r\n var this_1 = this;\r\n for (var mipmap = 0; mipmap < light.specularImages.length; mipmap++) {\r\n _loop_1(mipmap);\r\n }\r\n this._loader.logClose();\r\n light._loaded = Promise.all(promises).then(function () {\r\n var babylonTexture = new RawCubeTexture(_this._loader.babylonScene, null, light.specularImageSize);\r\n babylonTexture.name = light.name || \"environment\";\r\n light._babylonTexture = babylonTexture;\r\n if (light.intensity != undefined) {\r\n babylonTexture.level = light.intensity;\r\n }\r\n if (light.rotation) {\r\n var rotation = Quaternion.FromArray(light.rotation);\r\n // Invert the rotation so that positive rotation is counter-clockwise.\r\n if (!_this._loader.babylonScene.useRightHandedSystem) {\r\n rotation = Quaternion.Inverse(rotation);\r\n }\r\n Matrix.FromQuaternionToRef(rotation, babylonTexture.getReflectionTextureMatrix());\r\n }\r\n var sphericalHarmonics = SphericalHarmonics.FromArray(light.irradianceCoefficients);\r\n sphericalHarmonics.scaleInPlace(light.intensity);\r\n sphericalHarmonics.convertIrradianceToLambertianRadiance();\r\n var sphericalPolynomial = SphericalPolynomial.FromHarmonics(sphericalHarmonics);\r\n // Compute the lod generation scale to fit exactly to the number of levels available.\r\n var lodGenerationScale = (imageData_1.length - 1) / Scalar.Log2(light.specularImageSize);\r\n return babylonTexture.updateRGBDAsync(imageData_1, sphericalPolynomial, lodGenerationScale);\r\n });\r\n }\r\n return light._loaded.then(function () {\r\n return light._babylonTexture;\r\n });\r\n };\r\n return EXT_lights_image_based;\r\n}());\r\nexport { EXT_lights_image_based };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_lights_image_based(loader); });\r\n//# sourceMappingURL=EXT_lights_image_based.js.map","import { Vector3, Quaternion, Matrix } from '@babylonjs/core/Maths/math.vector';\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport { TmpVectors } from '@babylonjs/core/Maths/math.vector';\r\nvar NAME = \"EXT_mesh_gpu_instancing\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1691)\r\n * [Playground Sample](https://playground.babylonjs.com/#QFIGLW#9)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar EXT_mesh_gpu_instancing = /** @class */ (function () {\r\n /** @hidden */\r\n function EXT_mesh_gpu_instancing(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n EXT_mesh_gpu_instancing.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n EXT_mesh_gpu_instancing.prototype.loadNodeAsync = function (context, node, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {\r\n _this._loader._disableInstancedMesh++;\r\n var promise = _this._loader.loadNodeAsync(\"/nodes/\" + node.index, node, assign);\r\n _this._loader._disableInstancedMesh--;\r\n if (!node._primitiveBabylonMeshes) {\r\n return promise;\r\n }\r\n var promises = new Array();\r\n var instanceCount = 0;\r\n var loadAttribute = function (attribute) {\r\n if (extension.attributes[attribute] == undefined) {\r\n promises.push(Promise.resolve(null));\r\n return;\r\n }\r\n var accessor = ArrayItem.Get(extensionContext + \"/attributes/\" + attribute, _this._loader.gltf.accessors, extension.attributes[attribute]);\r\n promises.push(_this._loader._loadFloatAccessorAsync(\"/accessors/\" + accessor.bufferView, accessor));\r\n if (instanceCount === 0) {\r\n instanceCount = accessor.count;\r\n }\r\n else if (instanceCount !== accessor.count) {\r\n throw new Error(extensionContext + \"/attributes: Instance buffer accessors do not have the same count.\");\r\n }\r\n };\r\n loadAttribute(\"TRANSLATION\");\r\n loadAttribute(\"ROTATION\");\r\n loadAttribute(\"SCALE\");\r\n return promise.then(function (babylonTransformNode) {\r\n return Promise.all(promises).then(function (_a) {\r\n var translationBuffer = _a[0], rotationBuffer = _a[1], scaleBuffer = _a[2];\r\n var matrices = new Float32Array(instanceCount * 16);\r\n TmpVectors.Vector3[0].copyFromFloats(0, 0, 0); // translation\r\n TmpVectors.Quaternion[0].copyFromFloats(0, 0, 0, 1); // rotation\r\n TmpVectors.Vector3[1].copyFromFloats(1, 1, 1); // scale\r\n for (var i = 0; i < instanceCount; ++i) {\r\n translationBuffer && Vector3.FromArrayToRef(translationBuffer, i * 3, TmpVectors.Vector3[0]);\r\n rotationBuffer && Quaternion.FromArrayToRef(rotationBuffer, i * 4, TmpVectors.Quaternion[0]);\r\n scaleBuffer && Vector3.FromArrayToRef(scaleBuffer, i * 3, TmpVectors.Vector3[1]);\r\n Matrix.ComposeToRef(TmpVectors.Vector3[1], TmpVectors.Quaternion[0], TmpVectors.Vector3[0], TmpVectors.Matrix[0]);\r\n TmpVectors.Matrix[0].copyToArray(matrices, i * 16);\r\n }\r\n for (var _i = 0, _b = node._primitiveBabylonMeshes; _i < _b.length; _i++) {\r\n var babylonMesh = _b[_i];\r\n babylonMesh.thinInstanceSetBuffer(\"matrix\", matrices, 16, true);\r\n }\r\n return babylonTransformNode;\r\n });\r\n });\r\n });\r\n };\r\n return EXT_mesh_gpu_instancing;\r\n}());\r\nexport { EXT_mesh_gpu_instancing };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_mesh_gpu_instancing(loader); });\r\n//# sourceMappingURL=EXT_mesh_gpu_instancing.js.map","import { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nvar NAME = \"EXT_texture_webp\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_texture_webp/)\r\n */\r\nvar EXT_texture_webp = /** @class */ (function () {\r\n /** @hidden */\r\n function EXT_texture_webp(loader) {\r\n /** The name of this extension. */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n EXT_texture_webp.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n EXT_texture_webp.prototype._loadTextureAsync = function (context, texture, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, texture, this.name, function (extensionContext, extension) {\r\n var sampler = (texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(context + \"/sampler\", _this._loader.gltf.samplers, texture.sampler));\r\n var image = ArrayItem.Get(extensionContext + \"/source\", _this._loader.gltf.images, extension.source);\r\n return _this._loader._createTextureAsync(context, sampler, image, function (babylonTexture) {\r\n assign(babylonTexture);\r\n });\r\n });\r\n };\r\n return EXT_texture_webp;\r\n}());\r\nexport { EXT_texture_webp };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new EXT_texture_webp(loader); });\r\n//# sourceMappingURL=EXT_texture_webp.js.map","/**\r\n * Helper class to push actions to a pool of workers.\r\n */\r\nvar WorkerPool = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param workers Array of workers to use for actions\r\n */\r\n function WorkerPool(workers) {\r\n this._pendingActions = new Array();\r\n this._workerInfos = workers.map(function (worker) { return ({\r\n worker: worker,\r\n active: false\r\n }); });\r\n }\r\n /**\r\n * Terminates all workers and clears any pending actions.\r\n */\r\n WorkerPool.prototype.dispose = function () {\r\n for (var _i = 0, _a = this._workerInfos; _i < _a.length; _i++) {\r\n var workerInfo = _a[_i];\r\n workerInfo.worker.terminate();\r\n }\r\n this._workerInfos = [];\r\n this._pendingActions = [];\r\n };\r\n /**\r\n * Pushes an action to the worker pool. If all the workers are active, the action will be\r\n * pended until a worker has completed its action.\r\n * @param action The action to perform. Call onComplete when the action is complete.\r\n */\r\n WorkerPool.prototype.push = function (action) {\r\n for (var _i = 0, _a = this._workerInfos; _i < _a.length; _i++) {\r\n var workerInfo = _a[_i];\r\n if (!workerInfo.active) {\r\n this._execute(workerInfo, action);\r\n return;\r\n }\r\n }\r\n this._pendingActions.push(action);\r\n };\r\n WorkerPool.prototype._execute = function (workerInfo, action) {\r\n var _this = this;\r\n workerInfo.active = true;\r\n action(workerInfo.worker, function () {\r\n workerInfo.active = false;\r\n var nextAction = _this._pendingActions.shift();\r\n if (nextAction) {\r\n _this._execute(workerInfo, nextAction);\r\n }\r\n });\r\n };\r\n return WorkerPool;\r\n}());\r\nexport { WorkerPool };\r\n//# sourceMappingURL=workerPool.js.map","import { Tools } from \"../../Misc/tools\";\r\nimport { WorkerPool } from '../../Misc/workerPool';\r\nimport { VertexData } from \"../../Meshes/mesh.vertexData\";\r\nfunction createDecoderAsync(wasmBinary) {\r\n return new Promise(function (resolve) {\r\n DracoDecoderModule({ wasmBinary: wasmBinary }).then(function (module) {\r\n resolve({ module: module });\r\n });\r\n });\r\n}\r\nfunction decodeMesh(decoderModule, dataView, attributes, onIndicesData, onAttributeData) {\r\n var buffer = new decoderModule.DecoderBuffer();\r\n buffer.Init(dataView, dataView.byteLength);\r\n var decoder = new decoderModule.Decoder();\r\n var geometry;\r\n var status;\r\n try {\r\n var type = decoder.GetEncodedGeometryType(buffer);\r\n switch (type) {\r\n case decoderModule.TRIANGULAR_MESH:\r\n geometry = new decoderModule.Mesh();\r\n status = decoder.DecodeBufferToMesh(buffer, geometry);\r\n break;\r\n case decoderModule.POINT_CLOUD:\r\n geometry = new decoderModule.PointCloud();\r\n status = decoder.DecodeBufferToPointCloud(buffer, geometry);\r\n break;\r\n default:\r\n throw new Error(\"Invalid geometry type \" + type);\r\n }\r\n if (!status.ok() || !geometry.ptr) {\r\n throw new Error(status.error_msg());\r\n }\r\n if (type === decoderModule.TRIANGULAR_MESH) {\r\n var numFaces = geometry.num_faces();\r\n var numIndices = numFaces * 3;\r\n var byteLength = numIndices * 4;\r\n var ptr = decoderModule._malloc(byteLength);\r\n try {\r\n decoder.GetTrianglesUInt32Array(geometry, byteLength, ptr);\r\n var indices = new Uint32Array(numIndices);\r\n indices.set(new Uint32Array(decoderModule.HEAPF32.buffer, ptr, numIndices));\r\n onIndicesData(indices);\r\n }\r\n finally {\r\n decoderModule._free(ptr);\r\n }\r\n }\r\n var processAttribute = function (kind, attribute) {\r\n var numComponents = attribute.num_components();\r\n var numPoints = geometry.num_points();\r\n var numValues = numPoints * numComponents;\r\n var byteLength = numValues * Float32Array.BYTES_PER_ELEMENT;\r\n var ptr = decoderModule._malloc(byteLength);\r\n try {\r\n decoder.GetAttributeDataArrayForAllPoints(geometry, attribute, decoderModule.DT_FLOAT32, byteLength, ptr);\r\n var values = new Float32Array(decoderModule.HEAPF32.buffer, ptr, numValues);\r\n if (kind === \"color\" && numComponents === 3) {\r\n var babylonData = new Float32Array(numPoints * 4);\r\n for (var i = 0, j = 0; i < babylonData.length; i += 4, j += numComponents) {\r\n babylonData[i + 0] = values[j + 0];\r\n babylonData[i + 1] = values[j + 1];\r\n babylonData[i + 2] = values[j + 2];\r\n babylonData[i + 3] = 1;\r\n }\r\n onAttributeData(kind, babylonData);\r\n }\r\n else {\r\n var babylonData = new Float32Array(numValues);\r\n babylonData.set(new Float32Array(decoderModule.HEAPF32.buffer, ptr, numValues));\r\n onAttributeData(kind, babylonData);\r\n }\r\n }\r\n finally {\r\n decoderModule._free(ptr);\r\n }\r\n };\r\n if (attributes) {\r\n for (var kind in attributes) {\r\n var id = attributes[kind];\r\n var attribute = decoder.GetAttributeByUniqueId(geometry, id);\r\n processAttribute(kind, attribute);\r\n }\r\n }\r\n else {\r\n var nativeAttributeTypes = {\r\n \"position\": \"POSITION\",\r\n \"normal\": \"NORMAL\",\r\n \"color\": \"COLOR\",\r\n \"uv\": \"TEX_COORD\"\r\n };\r\n for (var kind in nativeAttributeTypes) {\r\n var id = decoder.GetAttributeId(geometry, decoderModule[nativeAttributeTypes[kind]]);\r\n if (id !== -1) {\r\n var attribute = decoder.GetAttribute(geometry, id);\r\n processAttribute(kind, attribute);\r\n }\r\n }\r\n }\r\n }\r\n finally {\r\n if (geometry) {\r\n decoderModule.destroy(geometry);\r\n }\r\n decoderModule.destroy(decoder);\r\n decoderModule.destroy(buffer);\r\n }\r\n}\r\n/**\r\n * The worker function that gets converted to a blob url to pass into a worker.\r\n */\r\nfunction worker() {\r\n var decoderPromise;\r\n onmessage = function (event) {\r\n var data = event.data;\r\n switch (data.id) {\r\n case \"init\": {\r\n var decoder = data.decoder;\r\n if (decoder.url) {\r\n importScripts(decoder.url);\r\n decoderPromise = DracoDecoderModule({ wasmBinary: decoder.wasmBinary });\r\n }\r\n postMessage(\"done\");\r\n break;\r\n }\r\n case \"decodeMesh\": {\r\n if (!decoderPromise) {\r\n throw new Error(\"Draco decoder module is not available\");\r\n }\r\n decoderPromise.then(function (decoder) {\r\n decodeMesh(decoder, data.dataView, data.attributes, function (indices) {\r\n postMessage({ id: \"indices\", value: indices }, [indices.buffer]);\r\n }, function (kind, data) {\r\n postMessage({ id: kind, value: data }, [data.buffer]);\r\n });\r\n postMessage(\"done\");\r\n });\r\n break;\r\n }\r\n }\r\n };\r\n}\r\nfunction getAbsoluteUrl(url) {\r\n if (typeof document !== \"object\" || typeof url !== \"string\") {\r\n return url;\r\n }\r\n return Tools.GetAbsoluteUrl(url);\r\n}\r\n/**\r\n * Draco compression (https://google.github.io/draco/)\r\n *\r\n * This class wraps the Draco module.\r\n *\r\n * **Encoder**\r\n *\r\n * The encoder is not currently implemented.\r\n *\r\n * **Decoder**\r\n *\r\n * By default, the configuration points to a copy of the Draco decoder files for glTF from the babylon.js preview cdn https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js.\r\n *\r\n * To update the configuration, use the following code:\r\n * ```javascript\r\n * DracoCompression.Configuration = {\r\n * decoder: {\r\n * wasmUrl: \"\",\r\n * wasmBinaryUrl: \"\",\r\n * fallbackUrl: \"\",\r\n * }\r\n * };\r\n * ```\r\n *\r\n * Draco has two versions, one for WebAssembly and one for JavaScript. The decoder configuration can be set to only support Webssembly or only support the JavaScript version.\r\n * Decoding will automatically fallback to the JavaScript version if WebAssembly version is not configured or if WebAssembly is not supported by the browser.\r\n * Use `DracoCompression.DecoderAvailable` to determine if the decoder configuration is available for the current context.\r\n *\r\n * To decode Draco compressed data, get the default DracoCompression object and call decodeMeshAsync:\r\n * ```javascript\r\n * var vertexData = await DracoCompression.Default.decodeMeshAsync(data);\r\n * ```\r\n *\r\n * @see https://www.babylonjs-playground.com/#N3EK4B#0\r\n */\r\nvar DracoCompression = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n * @param numWorkers The number of workers for async operations. Specify `0` to disable web workers and run synchronously in the current context.\r\n */\r\n function DracoCompression(numWorkers) {\r\n if (numWorkers === void 0) { numWorkers = DracoCompression.DefaultNumWorkers; }\r\n var decoder = DracoCompression.Configuration.decoder;\r\n var decoderInfo = (decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === \"object\") ? {\r\n url: decoder.wasmUrl,\r\n wasmBinaryPromise: Tools.LoadFileAsync(getAbsoluteUrl(decoder.wasmBinaryUrl))\r\n } : {\r\n url: decoder.fallbackUrl,\r\n wasmBinaryPromise: Promise.resolve(undefined)\r\n };\r\n if (numWorkers && typeof Worker === \"function\") {\r\n this._workerPoolPromise = decoderInfo.wasmBinaryPromise.then(function (decoderWasmBinary) {\r\n var workerContent = decodeMesh + \"(\" + worker + \")()\";\r\n var workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: \"application/javascript\" }));\r\n var workerPromises = new Array(numWorkers);\r\n for (var i = 0; i < workerPromises.length; i++) {\r\n workerPromises[i] = new Promise(function (resolve, reject) {\r\n var worker = new Worker(workerBlobUrl);\r\n var onError = function (error) {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n };\r\n var onMessage = function (message) {\r\n if (message.data === \"done\") {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(worker);\r\n }\r\n };\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n worker.postMessage({\r\n id: \"init\",\r\n decoder: {\r\n url: getAbsoluteUrl(decoderInfo.url),\r\n wasmBinary: decoderWasmBinary,\r\n }\r\n });\r\n });\r\n }\r\n return Promise.all(workerPromises).then(function (workers) {\r\n return new WorkerPool(workers);\r\n });\r\n });\r\n }\r\n else {\r\n this._decoderModulePromise = decoderInfo.wasmBinaryPromise.then(function (decoderWasmBinary) {\r\n if (!decoderInfo.url) {\r\n throw new Error(\"Draco decoder module is not available\");\r\n }\r\n return Tools.LoadScriptAsync(decoderInfo.url).then(function () {\r\n return createDecoderAsync(decoderWasmBinary);\r\n });\r\n });\r\n }\r\n }\r\n Object.defineProperty(DracoCompression, \"DecoderAvailable\", {\r\n /**\r\n * Returns true if the decoder configuration is available.\r\n */\r\n get: function () {\r\n var decoder = DracoCompression.Configuration.decoder;\r\n return !!((decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === \"object\") || decoder.fallbackUrl);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n DracoCompression.GetDefaultNumWorkers = function () {\r\n if (typeof navigator !== \"object\" || !navigator.hardwareConcurrency) {\r\n return 1;\r\n }\r\n // Use 50% of the available logical processors but capped at 4.\r\n return Math.min(Math.floor(navigator.hardwareConcurrency * 0.5), 4);\r\n };\r\n Object.defineProperty(DracoCompression, \"Default\", {\r\n /**\r\n * Default instance for the draco compression object.\r\n */\r\n get: function () {\r\n if (!DracoCompression._Default) {\r\n DracoCompression._Default = new DracoCompression();\r\n }\r\n return DracoCompression._Default;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Stop all async operations and release resources.\r\n */\r\n DracoCompression.prototype.dispose = function () {\r\n if (this._workerPoolPromise) {\r\n this._workerPoolPromise.then(function (workerPool) {\r\n workerPool.dispose();\r\n });\r\n }\r\n delete this._workerPoolPromise;\r\n delete this._decoderModulePromise;\r\n };\r\n /**\r\n * Returns a promise that resolves when ready. Call this manually to ensure draco compression is ready before use.\r\n * @returns a promise that resolves when ready\r\n */\r\n DracoCompression.prototype.whenReadyAsync = function () {\r\n if (this._workerPoolPromise) {\r\n return this._workerPoolPromise.then(function () { });\r\n }\r\n if (this._decoderModulePromise) {\r\n return this._decoderModulePromise.then(function () { });\r\n }\r\n return Promise.resolve();\r\n };\r\n /**\r\n * Decode Draco compressed mesh data to vertex data.\r\n * @param data The ArrayBuffer or ArrayBufferView for the Draco compression data\r\n * @param attributes A map of attributes from vertex buffer kinds to Draco unique ids\r\n * @returns A promise that resolves with the decoded vertex data\r\n */\r\n DracoCompression.prototype.decodeMeshAsync = function (data, attributes) {\r\n var dataView = data instanceof ArrayBuffer ? new Uint8Array(data) : data;\r\n if (this._workerPoolPromise) {\r\n return this._workerPoolPromise.then(function (workerPool) {\r\n return new Promise(function (resolve, reject) {\r\n workerPool.push(function (worker, onComplete) {\r\n var vertexData = new VertexData();\r\n var onError = function (error) {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n reject(error);\r\n onComplete();\r\n };\r\n var onMessage = function (message) {\r\n if (message.data === \"done\") {\r\n worker.removeEventListener(\"error\", onError);\r\n worker.removeEventListener(\"message\", onMessage);\r\n resolve(vertexData);\r\n onComplete();\r\n }\r\n else if (message.data.id === \"indices\") {\r\n vertexData.indices = message.data.value;\r\n }\r\n else {\r\n vertexData.set(message.data.value, message.data.id);\r\n }\r\n };\r\n worker.addEventListener(\"error\", onError);\r\n worker.addEventListener(\"message\", onMessage);\r\n var dataViewCopy = new Uint8Array(dataView.byteLength);\r\n dataViewCopy.set(new Uint8Array(dataView.buffer, dataView.byteOffset, dataView.byteLength));\r\n worker.postMessage({ id: \"decodeMesh\", dataView: dataViewCopy, attributes: attributes }, [dataViewCopy.buffer]);\r\n });\r\n });\r\n });\r\n }\r\n if (this._decoderModulePromise) {\r\n return this._decoderModulePromise.then(function (decoder) {\r\n var vertexData = new VertexData();\r\n decodeMesh(decoder.module, dataView, attributes, function (indices) {\r\n vertexData.indices = indices;\r\n }, function (kind, data) {\r\n vertexData.set(data, kind);\r\n });\r\n return vertexData;\r\n });\r\n }\r\n throw new Error(\"Draco decoder module is not available\");\r\n };\r\n /**\r\n * The configuration. Defaults to the following urls:\r\n * - wasmUrl: \"https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js\"\r\n * - wasmBinaryUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.wasm\"\r\n * - fallbackUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.js\"\r\n */\r\n DracoCompression.Configuration = {\r\n decoder: {\r\n wasmUrl: \"https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js\",\r\n wasmBinaryUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.wasm\",\r\n fallbackUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.js\"\r\n }\r\n };\r\n /**\r\n * Default number of workers to create when creating the draco compression object.\r\n */\r\n DracoCompression.DefaultNumWorkers = DracoCompression.GetDefaultNumWorkers();\r\n DracoCompression._Default = null;\r\n return DracoCompression;\r\n}());\r\nexport { DracoCompression };\r\n//# sourceMappingURL=dracoCompression.js.map","import { DracoCompression } from \"@babylonjs/core/Meshes/Compression/dracoCompression\";\r\nimport { VertexBuffer } from \"@babylonjs/core/Meshes/buffer\";\r\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nvar NAME = \"KHR_draco_mesh_compression\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)\r\n */\r\nvar KHR_draco_mesh_compression = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_draco_mesh_compression(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = DracoCompression.DecoderAvailable && this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_draco_mesh_compression.prototype.dispose = function () {\r\n delete this.dracoCompression;\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_draco_mesh_compression.prototype._loadVertexDataAsync = function (context, primitive, babylonMesh) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, primitive, this.name, function (extensionContext, extension) {\r\n if (primitive.mode != undefined) {\r\n if (primitive.mode !== 5 /* TRIANGLE_STRIP */ &&\r\n primitive.mode !== 4 /* TRIANGLES */) {\r\n throw new Error(context + \": Unsupported mode \" + primitive.mode);\r\n }\r\n // TODO: handle triangle strips\r\n if (primitive.mode === 5 /* TRIANGLE_STRIP */) {\r\n throw new Error(context + \": Mode \" + primitive.mode + \" is not currently supported\");\r\n }\r\n }\r\n var attributes = {};\r\n var loadAttribute = function (name, kind) {\r\n var uniqueId = extension.attributes[name];\r\n if (uniqueId == undefined) {\r\n return;\r\n }\r\n babylonMesh._delayInfo = babylonMesh._delayInfo || [];\r\n if (babylonMesh._delayInfo.indexOf(kind) === -1) {\r\n babylonMesh._delayInfo.push(kind);\r\n }\r\n attributes[kind] = uniqueId;\r\n };\r\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind);\r\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind);\r\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind);\r\n loadAttribute(\"TEXCOORD_0\", VertexBuffer.UVKind);\r\n loadAttribute(\"TEXCOORD_1\", VertexBuffer.UV2Kind);\r\n loadAttribute(\"JOINTS_0\", VertexBuffer.MatricesIndicesKind);\r\n loadAttribute(\"WEIGHTS_0\", VertexBuffer.MatricesWeightsKind);\r\n loadAttribute(\"COLOR_0\", VertexBuffer.ColorKind);\r\n var bufferView = ArrayItem.Get(extensionContext, _this._loader.gltf.bufferViews, extension.bufferView);\r\n if (!bufferView._dracoBabylonGeometry) {\r\n bufferView._dracoBabylonGeometry = _this._loader.loadBufferViewAsync(\"/bufferViews/\" + bufferView.index, bufferView).then(function (data) {\r\n var dracoCompression = _this.dracoCompression || DracoCompression.Default;\r\n return dracoCompression.decodeMeshAsync(data, attributes).then(function (babylonVertexData) {\r\n var babylonGeometry = new Geometry(babylonMesh.name, _this._loader.babylonScene);\r\n babylonVertexData.applyToGeometry(babylonGeometry);\r\n return babylonGeometry;\r\n }).catch(function (error) {\r\n throw new Error(context + \": \" + error.message);\r\n });\r\n });\r\n }\r\n return bufferView._dracoBabylonGeometry;\r\n });\r\n };\r\n return KHR_draco_mesh_compression;\r\n}());\r\nexport { KHR_draco_mesh_compression };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_draco_mesh_compression(loader); });\r\n//# sourceMappingURL=KHR_draco_mesh_compression.js.map","import { Vector3 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\nimport { DirectionalLight } from \"@babylonjs/core/Lights/directionalLight\";\r\nimport { PointLight } from \"@babylonjs/core/Lights/pointLight\";\r\nimport { SpotLight } from \"@babylonjs/core/Lights/spotLight\";\r\nimport { Light } from \"@babylonjs/core/Lights/light\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nvar NAME = \"KHR_lights_punctual\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual)\r\n */\r\nvar KHR_lights = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_lights(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_lights.prototype.dispose = function () {\r\n this._loader = null;\r\n delete this._lights;\r\n };\r\n /** @hidden */\r\n KHR_lights.prototype.onLoading = function () {\r\n var extensions = this._loader.gltf.extensions;\r\n if (extensions && extensions[this.name]) {\r\n var extension = extensions[this.name];\r\n this._lights = extension.lights;\r\n }\r\n };\r\n /** @hidden */\r\n KHR_lights.prototype.loadNodeAsync = function (context, node, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {\r\n return _this._loader.loadNodeAsync(context, node, function (babylonMesh) {\r\n var babylonLight;\r\n var light = ArrayItem.Get(extensionContext, _this._lights, extension.light);\r\n var name = light.name || babylonMesh.name;\r\n _this._loader.babylonScene._blockEntityCollection = _this._loader._forAssetContainer;\r\n switch (light.type) {\r\n case \"directional\" /* DIRECTIONAL */: {\r\n babylonLight = new DirectionalLight(name, Vector3.Backward(), _this._loader.babylonScene);\r\n break;\r\n }\r\n case \"point\" /* POINT */: {\r\n babylonLight = new PointLight(name, Vector3.Zero(), _this._loader.babylonScene);\r\n break;\r\n }\r\n case \"spot\" /* SPOT */: {\r\n var babylonSpotLight = new SpotLight(name, Vector3.Zero(), Vector3.Backward(), 0, 1, _this._loader.babylonScene);\r\n babylonSpotLight.angle = ((light.spot && light.spot.outerConeAngle) || Math.PI / 4) * 2;\r\n babylonSpotLight.innerAngle = ((light.spot && light.spot.innerConeAngle) || 0) * 2;\r\n babylonLight = babylonSpotLight;\r\n break;\r\n }\r\n default: {\r\n _this._loader.babylonScene._blockEntityCollection = false;\r\n throw new Error(extensionContext + \": Invalid light type (\" + light.type + \")\");\r\n }\r\n }\r\n _this._loader.babylonScene._blockEntityCollection = false;\r\n babylonLight.falloffType = Light.FALLOFF_GLTF;\r\n babylonLight.diffuse = light.color ? Color3.FromArray(light.color) : Color3.White();\r\n babylonLight.intensity = light.intensity == undefined ? 1 : light.intensity;\r\n babylonLight.range = light.range == undefined ? Number.MAX_VALUE : light.range;\r\n babylonLight.parent = babylonMesh;\r\n _this._loader._babylonLights.push(babylonLight);\r\n GLTFLoader.AddPointerMetadata(babylonLight, extensionContext);\r\n assign(babylonMesh);\r\n });\r\n });\r\n };\r\n return KHR_lights;\r\n}());\r\nexport { KHR_lights };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_lights(loader); });\r\n//# sourceMappingURL=KHR_lights_punctual.js.map","import { Color3 } from \"@babylonjs/core/Maths/math.color\";\r\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"KHR_materials_pbrSpecularGlossiness\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)\r\n */\r\nvar KHR_materials_pbrSpecularGlossiness = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_pbrSpecularGlossiness(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 200;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_materials_pbrSpecularGlossiness.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_pbrSpecularGlossiness.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loadSpecularGlossinessPropertiesAsync(extensionContext, material, extension, babylonMaterial));\r\n _this._loader.loadMaterialAlphaProperties(context, material, babylonMaterial);\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n KHR_materials_pbrSpecularGlossiness.prototype._loadSpecularGlossinessPropertiesAsync = function (context, material, properties, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var promises = new Array();\r\n babylonMaterial.metallic = null;\r\n babylonMaterial.roughness = null;\r\n if (properties.diffuseFactor) {\r\n babylonMaterial.albedoColor = Color3.FromArray(properties.diffuseFactor);\r\n babylonMaterial.alpha = properties.diffuseFactor[3];\r\n }\r\n else {\r\n babylonMaterial.albedoColor = Color3.White();\r\n }\r\n babylonMaterial.reflectivityColor = properties.specularFactor ? Color3.FromArray(properties.specularFactor) : Color3.White();\r\n babylonMaterial.microSurface = properties.glossinessFactor == undefined ? 1 : properties.glossinessFactor;\r\n if (properties.diffuseTexture) {\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/diffuseTexture\", properties.diffuseTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Diffuse)\";\r\n babylonMaterial.albedoTexture = texture;\r\n }));\r\n }\r\n if (properties.specularGlossinessTexture) {\r\n properties.specularGlossinessTexture.nonColorData = true;\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/specularGlossinessTexture\", properties.specularGlossinessTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Specular Glossiness)\";\r\n babylonMaterial.reflectivityTexture = texture;\r\n }));\r\n babylonMaterial.reflectivityTexture.hasAlpha = true;\r\n babylonMaterial.useMicroSurfaceFromReflectivityMapAlpha = true;\r\n }\r\n return Promise.all(promises).then(function () { });\r\n };\r\n return KHR_materials_pbrSpecularGlossiness;\r\n}());\r\nexport { KHR_materials_pbrSpecularGlossiness };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_pbrSpecularGlossiness(loader); });\r\n//# sourceMappingURL=KHR_materials_pbrSpecularGlossiness.js.map","import { Color3 } from \"@babylonjs/core/Maths/math.color\";\r\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"KHR_materials_unlit\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)\r\n */\r\nvar KHR_materials_unlit = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_unlit(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 210;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_materials_unlit.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_unlit.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function () {\r\n return _this._loadUnlitPropertiesAsync(context, material, babylonMaterial);\r\n });\r\n };\r\n KHR_materials_unlit.prototype._loadUnlitPropertiesAsync = function (context, material, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var promises = new Array();\r\n babylonMaterial.unlit = true;\r\n var properties = material.pbrMetallicRoughness;\r\n if (properties) {\r\n if (properties.baseColorFactor) {\r\n babylonMaterial.albedoColor = Color3.FromArray(properties.baseColorFactor);\r\n babylonMaterial.alpha = properties.baseColorFactor[3];\r\n }\r\n else {\r\n babylonMaterial.albedoColor = Color3.White();\r\n }\r\n if (properties.baseColorTexture) {\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/baseColorTexture\", properties.baseColorTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Base Color)\";\r\n babylonMaterial.albedoTexture = texture;\r\n }));\r\n }\r\n }\r\n if (material.doubleSided) {\r\n babylonMaterial.backFaceCulling = false;\r\n babylonMaterial.twoSidedLighting = true;\r\n }\r\n this._loader.loadMaterialAlphaProperties(context, material, babylonMaterial);\r\n return Promise.all(promises).then(function () { });\r\n };\r\n return KHR_materials_unlit;\r\n}());\r\nexport { KHR_materials_unlit };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_unlit(loader); });\r\n//# sourceMappingURL=KHR_materials_unlit.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"KHR_materials_clearcoat\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_clearcoat/README.md)\r\n * [Playground Sample](https://www.babylonjs-playground.com/frame.html#7F7PN6#8)\r\n */\r\nvar KHR_materials_clearcoat = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_clearcoat(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 190;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_materials_clearcoat.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_clearcoat.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loadClearCoatPropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n KHR_materials_clearcoat.prototype._loadClearCoatPropertiesAsync = function (context, properties, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var promises = new Array();\r\n babylonMaterial.clearCoat.isEnabled = true;\r\n babylonMaterial.clearCoat.useRoughnessFromMainTexture = false;\r\n babylonMaterial.clearCoat.remapF0OnInterfaceChange = false;\r\n if (properties.clearcoatFactor != undefined) {\r\n babylonMaterial.clearCoat.intensity = properties.clearcoatFactor;\r\n }\r\n else {\r\n babylonMaterial.clearCoat.intensity = 0;\r\n }\r\n if (properties.clearcoatTexture) {\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/clearcoatTexture\", properties.clearcoatTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (ClearCoat Intensity)\";\r\n babylonMaterial.clearCoat.texture = texture;\r\n }));\r\n }\r\n if (properties.clearcoatRoughnessFactor != undefined) {\r\n babylonMaterial.clearCoat.roughness = properties.clearcoatRoughnessFactor;\r\n }\r\n else {\r\n babylonMaterial.clearCoat.roughness = 0;\r\n }\r\n if (properties.clearcoatRoughnessTexture) {\r\n properties.clearcoatRoughnessTexture.nonColorData = true;\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/clearcoatRoughnessTexture\", properties.clearcoatRoughnessTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (ClearCoat Roughness)\";\r\n babylonMaterial.clearCoat.textureRoughness = texture;\r\n }));\r\n }\r\n if (properties.clearcoatNormalTexture) {\r\n properties.clearcoatNormalTexture.nonColorData = true;\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/clearcoatNormalTexture\", properties.clearcoatNormalTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (ClearCoat Normal)\";\r\n babylonMaterial.clearCoat.bumpTexture = texture;\r\n }));\r\n babylonMaterial.invertNormalMapX = !babylonMaterial.getScene().useRightHandedSystem;\r\n babylonMaterial.invertNormalMapY = babylonMaterial.getScene().useRightHandedSystem;\r\n if (properties.clearcoatNormalTexture.scale != undefined) {\r\n babylonMaterial.clearCoat.bumpTexture.level = properties.clearcoatNormalTexture.scale;\r\n }\r\n }\r\n return Promise.all(promises).then(function () { });\r\n };\r\n return KHR_materials_clearcoat;\r\n}());\r\nexport { KHR_materials_clearcoat };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_clearcoat(loader); });\r\n//# sourceMappingURL=KHR_materials_clearcoat.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\nvar NAME = \"KHR_materials_sheen\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1688)\r\n * [Playground Sample](https://www.babylonjs-playground.com/frame.html#BNIZX6#4)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar KHR_materials_sheen = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_sheen(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 190;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_materials_sheen.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_sheen.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loadSheenPropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n KHR_materials_sheen.prototype._loadSheenPropertiesAsync = function (context, properties, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var promises = new Array();\r\n babylonMaterial.sheen.isEnabled = true;\r\n babylonMaterial.sheen.intensity = 1;\r\n if (properties.sheenColorFactor != undefined) {\r\n babylonMaterial.sheen.color = Color3.FromArray(properties.sheenColorFactor);\r\n }\r\n else {\r\n babylonMaterial.sheen.color = Color3.Black();\r\n }\r\n if (properties.sheenColorTexture) {\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/sheenColorTexture\", properties.sheenColorTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Sheen Color)\";\r\n babylonMaterial.sheen.texture = texture;\r\n }));\r\n }\r\n if (properties.sheenRoughnessFactor !== undefined) {\r\n babylonMaterial.sheen.roughness = properties.sheenRoughnessFactor;\r\n }\r\n else {\r\n babylonMaterial.sheen.roughness = 0;\r\n }\r\n if (properties.sheenRoughnessTexture) {\r\n properties.sheenRoughnessTexture.nonColorData = true;\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/sheenRoughnessTexture\", properties.sheenRoughnessTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Sheen Roughness)\";\r\n babylonMaterial.sheen.textureRoughness = texture;\r\n }));\r\n }\r\n babylonMaterial.sheen.albedoScaling = true;\r\n babylonMaterial.sheen.useRoughnessFromMainTexture = false;\r\n return Promise.all(promises).then(function () { });\r\n };\r\n return KHR_materials_sheen;\r\n}());\r\nexport { KHR_materials_sheen };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_sheen(loader); });\r\n//# sourceMappingURL=KHR_materials_sheen.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\nvar NAME = \"KHR_materials_specular\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1719)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar KHR_materials_specular = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_specular(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 190;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_materials_specular.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_specular.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loadSpecularPropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n KHR_materials_specular.prototype._loadSpecularPropertiesAsync = function (context, properties, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var promises = new Array();\r\n if (properties.specularFactor !== undefined) {\r\n babylonMaterial.metallicF0Factor = properties.specularFactor;\r\n }\r\n if (properties.specularColorFactor !== undefined) {\r\n babylonMaterial.metallicReflectanceColor = Color3.FromArray(properties.specularColorFactor);\r\n }\r\n if (properties.specularTexture) {\r\n properties.specularTexture.nonColorData = true;\r\n promises.push(this._loader.loadTextureInfoAsync(context + \"/specularTexture\", properties.specularTexture, function (texture) {\r\n texture.name = babylonMaterial.name + \" (Specular F0 Color)\";\r\n babylonMaterial.metallicReflectanceTexture = texture;\r\n }));\r\n }\r\n return Promise.all(promises).then(function () { });\r\n };\r\n return KHR_materials_specular;\r\n}());\r\nexport { KHR_materials_specular };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_specular(loader); });\r\n//# sourceMappingURL=KHR_materials_specular.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"KHR_materials_ior\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1718)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar KHR_materials_ior = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_ior(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 180;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_materials_ior.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_ior.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loadIorPropertiesAsync(extensionContext, extension, babylonMaterial));\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n KHR_materials_ior.prototype._loadIorPropertiesAsync = function (context, properties, babylonMaterial) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n if (properties.ior !== undefined) {\r\n babylonMaterial.indexOfRefraction = properties.ior;\r\n }\r\n else {\r\n babylonMaterial.indexOfRefraction = KHR_materials_ior._DEFAULT_IOR;\r\n }\r\n return Promise.resolve();\r\n };\r\n /**\r\n * Default ior Value from the spec.\r\n */\r\n KHR_materials_ior._DEFAULT_IOR = 1.5;\r\n return KHR_materials_ior;\r\n}());\r\nexport { KHR_materials_ior };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_ior(loader); });\r\n//# sourceMappingURL=KHR_materials_ior.js.map","import { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nimport { Mesh } from '@babylonjs/core/Meshes/mesh';\r\nvar NAME = \"KHR_materials_variants\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1681)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar KHR_materials_variants = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_variants(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_materials_variants.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /**\r\n * Gets the list of available variant names for this asset.\r\n * @param rootMesh The glTF root mesh\r\n * @returns the list of all the variant names for this model\r\n */\r\n KHR_materials_variants.GetAvailableVariants = function (rootMesh) {\r\n var extensionMetadata = this._GetExtensionMetadata(rootMesh);\r\n if (!extensionMetadata) {\r\n return [];\r\n }\r\n return Object.keys(extensionMetadata.variants);\r\n };\r\n /**\r\n * Gets the list of available variant names for this asset.\r\n * @param rootMesh The glTF root mesh\r\n * @returns the list of all the variant names for this model\r\n */\r\n KHR_materials_variants.prototype.getAvailableVariants = function (rootMesh) {\r\n return KHR_materials_variants.GetAvailableVariants(rootMesh);\r\n };\r\n /**\r\n * Select a variant given a variant name or a list of variant names.\r\n * @param rootMesh The glTF root mesh\r\n * @param variantName The variant name(s) to select.\r\n */\r\n KHR_materials_variants.SelectVariant = function (rootMesh, variantName) {\r\n var extensionMetadata = this._GetExtensionMetadata(rootMesh);\r\n if (!extensionMetadata) {\r\n throw new Error(\"Cannot select variant on a glTF mesh that does not have the \" + NAME + \" extension\");\r\n }\r\n var select = function (variantName) {\r\n var entries = extensionMetadata.variants[variantName];\r\n if (entries) {\r\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\r\n var entry = entries_1[_i];\r\n entry.mesh.material = entry.material;\r\n }\r\n }\r\n };\r\n if (variantName instanceof Array) {\r\n for (var _i = 0, variantName_1 = variantName; _i < variantName_1.length; _i++) {\r\n var name_1 = variantName_1[_i];\r\n select(name_1);\r\n }\r\n }\r\n else {\r\n select(variantName);\r\n }\r\n extensionMetadata.lastSelected = variantName;\r\n };\r\n /**\r\n * Select a variant given a variant name or a list of variant names.\r\n * @param rootMesh The glTF root mesh\r\n * @param variantName The variant name(s) to select.\r\n */\r\n KHR_materials_variants.prototype.selectVariant = function (rootMesh, variantName) {\r\n return KHR_materials_variants.SelectVariant(rootMesh, variantName);\r\n };\r\n /**\r\n * Reset back to the original before selecting a variant.\r\n * @param rootMesh The glTF root mesh\r\n */\r\n KHR_materials_variants.Reset = function (rootMesh) {\r\n var extensionMetadata = this._GetExtensionMetadata(rootMesh);\r\n if (!extensionMetadata) {\r\n throw new Error(\"Cannot reset on a glTF mesh that does not have the \" + NAME + \" extension\");\r\n }\r\n for (var _i = 0, _a = extensionMetadata.original; _i < _a.length; _i++) {\r\n var entry = _a[_i];\r\n entry.mesh.material = entry.material;\r\n }\r\n extensionMetadata.lastSelected = null;\r\n };\r\n /**\r\n * Reset back to the original before selecting a variant.\r\n * @param rootMesh The glTF root mesh\r\n */\r\n KHR_materials_variants.prototype.reset = function (rootMesh) {\r\n return KHR_materials_variants.Reset(rootMesh);\r\n };\r\n /**\r\n * Gets the last selected variant name(s) or null if original.\r\n * @param rootMesh The glTF root mesh\r\n * @returns The selected variant name(s).\r\n */\r\n KHR_materials_variants.GetLastSelectedVariant = function (rootMesh) {\r\n var extensionMetadata = this._GetExtensionMetadata(rootMesh);\r\n if (!extensionMetadata) {\r\n throw new Error(\"Cannot get the last selected variant on a glTF mesh that does not have the \" + NAME + \" extension\");\r\n }\r\n return extensionMetadata.lastSelected;\r\n };\r\n /**\r\n * Gets the last selected variant name(s) or null if original.\r\n * @param rootMesh The glTF root mesh\r\n * @returns The selected variant name(s).\r\n */\r\n KHR_materials_variants.prototype.getLastSelectedVariant = function (rootMesh) {\r\n return KHR_materials_variants.GetLastSelectedVariant(rootMesh);\r\n };\r\n KHR_materials_variants._GetExtensionMetadata = function (rootMesh) {\r\n var _a, _b;\r\n return ((_b = (_a = rootMesh === null || rootMesh === void 0 ? void 0 : rootMesh.metadata) === null || _a === void 0 ? void 0 : _a.gltf) === null || _b === void 0 ? void 0 : _b[NAME]) || null;\r\n };\r\n /** @hidden */\r\n KHR_materials_variants.prototype.onLoading = function () {\r\n var extensions = this._loader.gltf.extensions;\r\n if (extensions && extensions[this.name]) {\r\n var extension = extensions[this.name];\r\n this._variants = extension.variants;\r\n }\r\n };\r\n /** @hidden */\r\n KHR_materials_variants.prototype._loadMeshPrimitiveAsync = function (context, name, node, mesh, primitive, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, primitive, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader._loadMeshPrimitiveAsync(context, name, node, mesh, primitive, function (babylonMesh) {\r\n assign(babylonMesh);\r\n if (babylonMesh instanceof Mesh) {\r\n var babylonDrawMode = GLTFLoader._GetDrawMode(context, primitive.mode);\r\n var root = _this._loader.rootBabylonMesh;\r\n var metadata = (root.metadata = root.metadata || {});\r\n var gltf = (metadata.gltf = metadata.gltf || {});\r\n var extensionMetadata = (gltf[NAME] = gltf[NAME] || { lastSelected: null, original: [], variants: {} });\r\n // Store the original material.\r\n extensionMetadata.original.push({ mesh: babylonMesh, material: babylonMesh.material });\r\n // For each mapping, look at the variants and make a new entry for them.\r\n var variants_1 = extensionMetadata.variants;\r\n for (var _i = 0, _a = extension.mappings; _i < _a.length; _i++) {\r\n var mapping = _a[_i];\r\n var _loop_1 = function (variantIndex) {\r\n var variant = ArrayItem.Get(extensionContext + \"/mapping/\" + variantIndex, _this._variants, variantIndex);\r\n var material = ArrayItem.Get(\"#/materials/\", _this._loader.gltf.materials, mapping.material);\r\n promises.push(_this._loader._loadMaterialAsync(\"#/materials/\" + mapping.material, material, babylonMesh, babylonDrawMode, function (babylonMaterial) {\r\n variants_1[variant.name] = variants_1[variant.name] || [];\r\n variants_1[variant.name].push({\r\n mesh: babylonMesh,\r\n material: babylonMaterial\r\n });\r\n }));\r\n };\r\n for (var _b = 0, _c = mapping.variants; _b < _c.length; _b++) {\r\n var variantIndex = _c[_b];\r\n _loop_1(variantIndex);\r\n }\r\n }\r\n }\r\n }));\r\n return Promise.all(promises).then(function (_a) {\r\n var babylonMesh = _a[0];\r\n return babylonMesh;\r\n });\r\n });\r\n };\r\n return KHR_materials_variants;\r\n}());\r\nexport { KHR_materials_variants };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_variants(loader); });\r\n//# sourceMappingURL=KHR_materials_variants.js.map","import { __assign } from \"tslib\";\r\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { RenderTargetTexture } from \"@babylonjs/core/Materials/Textures/renderTargetTexture\";\r\nimport { Observable } from \"@babylonjs/core/Misc/observable\";\r\n/**\r\n * A class to handle setting up the rendering of opaque objects to be shown through transmissive objects.\r\n */\r\nvar TransmissionHelper = /** @class */ (function () {\r\n /**\r\n * constructor\r\n * @param options Defines the options we want to customize the helper\r\n * @param scene The scene to add the material to\r\n */\r\n function TransmissionHelper(options, scene) {\r\n var _this = this;\r\n this._opaqueRenderTarget = null;\r\n this._opaqueMeshesCache = [];\r\n this._transparentMeshesCache = [];\r\n this._options = __assign(__assign({}, TransmissionHelper._getDefaultOptions()), options);\r\n this._scene = scene;\r\n this._scene._transmissionHelper = this;\r\n this.onErrorObservable = new Observable();\r\n this._scene.onDisposeObservable.addOnce(function (scene) {\r\n _this.dispose();\r\n });\r\n this._parseScene();\r\n this._setupRenderTargets();\r\n }\r\n /**\r\n * Creates the default options for the helper.\r\n */\r\n TransmissionHelper._getDefaultOptions = function () {\r\n return {\r\n renderSize: 512\r\n };\r\n };\r\n /**\r\n * Updates the background according to the new options\r\n * @param options\r\n */\r\n TransmissionHelper.prototype.updateOptions = function (options) {\r\n var _this = this;\r\n // First check if any options are actually being changed. If not, exit.\r\n var newValues = Object.keys(options).filter(function (key) { return _this._options[key] !== options[key]; });\r\n if (!newValues.length) {\r\n return;\r\n }\r\n var newOptions = __assign(__assign({}, this._options), options);\r\n var oldOptions = this._options;\r\n this._options = newOptions;\r\n // If size changes, recreate everything\r\n if (newOptions.renderSize !== oldOptions.renderSize) {\r\n this._setupRenderTargets();\r\n }\r\n };\r\n TransmissionHelper.prototype.getOpaqueTarget = function () {\r\n return this._opaqueRenderTarget;\r\n };\r\n TransmissionHelper.prototype.shouldRenderAsTransmission = function (material) {\r\n if (!material) {\r\n return false;\r\n }\r\n if (material instanceof PBRMaterial && (material.subSurface.isRefractionEnabled)) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n TransmissionHelper.prototype._addMesh = function (mesh) {\r\n if (mesh instanceof Mesh) {\r\n mesh.onMaterialChangedObservable.add(this.onMeshMaterialChanged.bind(this));\r\n if (this.shouldRenderAsTransmission(mesh.material)) {\r\n this._transparentMeshesCache.push(mesh);\r\n }\r\n else {\r\n this._opaqueMeshesCache.push(mesh);\r\n }\r\n }\r\n };\r\n TransmissionHelper.prototype._removeMesh = function (mesh) {\r\n if (mesh instanceof Mesh) {\r\n mesh.onMaterialChangedObservable.remove(this.onMeshMaterialChanged.bind(this));\r\n var idx = this._transparentMeshesCache.indexOf(mesh);\r\n if (idx !== -1) {\r\n this._transparentMeshesCache.splice(idx, 1);\r\n }\r\n idx = this._opaqueMeshesCache.indexOf(mesh);\r\n if (idx !== -1) {\r\n this._opaqueMeshesCache.splice(idx, 1);\r\n }\r\n }\r\n };\r\n TransmissionHelper.prototype._parseScene = function () {\r\n this._scene.meshes.forEach(this._addMesh.bind(this));\r\n // Listen for when a mesh is added to the scene and add it to our cache lists.\r\n this._scene.onNewMeshAddedObservable.add(this._addMesh.bind(this));\r\n // Listen for when a mesh is removed from to the scene and remove it from our cache lists.\r\n this._scene.onMeshRemovedObservable.add(this._removeMesh.bind(this));\r\n };\r\n // When one of the meshes in the scene has its material changed, make sure that it's in the correct cache list.\r\n TransmissionHelper.prototype.onMeshMaterialChanged = function (mesh) {\r\n if (mesh instanceof Mesh) {\r\n var transparentIdx = this._transparentMeshesCache.indexOf(mesh);\r\n var opaqueIdx = this._opaqueMeshesCache.indexOf(mesh);\r\n // If the material is transparent, make sure that it's added to the transparent list and removed from the opaque list\r\n var useTransmission = this.shouldRenderAsTransmission(mesh.material);\r\n if (useTransmission) {\r\n if (mesh.material instanceof PBRMaterial) {\r\n mesh.material.subSurface.refractionTexture = this._opaqueRenderTarget;\r\n }\r\n if (opaqueIdx !== -1) {\r\n this._opaqueMeshesCache.splice(opaqueIdx, 1);\r\n this._transparentMeshesCache.push(mesh);\r\n }\r\n else if (transparentIdx === -1) {\r\n this._transparentMeshesCache.push(mesh);\r\n }\r\n // If the material is opaque, make sure that it's added to the opaque list and removed from the transparent list\r\n }\r\n else {\r\n if (transparentIdx !== -1) {\r\n this._transparentMeshesCache.splice(transparentIdx, 1);\r\n this._opaqueMeshesCache.push(mesh);\r\n }\r\n else if (opaqueIdx === -1) {\r\n this._opaqueMeshesCache.push(mesh);\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Setup the render targets according to the specified options.\r\n */\r\n TransmissionHelper.prototype._setupRenderTargets = function () {\r\n var _this = this;\r\n var opaqueRTIndex = -1;\r\n // Remove any layers rendering to the opaque scene.\r\n if (this._scene.layers && this._opaqueRenderTarget) {\r\n for (var _i = 0, _a = this._scene.layers; _i < _a.length; _i++) {\r\n var layer = _a[_i];\r\n var idx = layer.renderTargetTextures.indexOf(this._opaqueRenderTarget);\r\n if (idx >= 0) {\r\n layer.renderTargetTextures.splice(idx, 1);\r\n }\r\n }\r\n }\r\n // Remove opaque render target\r\n if (this._opaqueRenderTarget) {\r\n opaqueRTIndex = this._scene.customRenderTargets.indexOf(this._opaqueRenderTarget);\r\n this._opaqueRenderTarget.dispose();\r\n }\r\n this._opaqueRenderTarget = new RenderTargetTexture(\"opaqueSceneTexture\", this._options.renderSize, this._scene, true);\r\n this._opaqueRenderTarget.renderList = this._opaqueMeshesCache;\r\n // this._opaqueRenderTarget.clearColor = new Color4(0.0, 0.0, 0.0, 0.0);\r\n this._opaqueRenderTarget.gammaSpace = true;\r\n this._opaqueRenderTarget.lodGenerationScale = 1;\r\n this._opaqueRenderTarget.lodGenerationOffset = -4;\r\n if (opaqueRTIndex >= 0) {\r\n this._scene.customRenderTargets.splice(opaqueRTIndex, 0, this._opaqueRenderTarget);\r\n }\r\n else {\r\n opaqueRTIndex = this._scene.customRenderTargets.length;\r\n this._scene.customRenderTargets.push(this._opaqueRenderTarget);\r\n }\r\n // If there are other layers, they should be included in the render of the opaque background.\r\n if (this._scene.layers && this._opaqueRenderTarget) {\r\n for (var _b = 0, _c = this._scene.layers; _b < _c.length; _b++) {\r\n var layer = _c[_b];\r\n layer.renderTargetTextures.push(this._opaqueRenderTarget);\r\n }\r\n }\r\n this._transparentMeshesCache.forEach(function (mesh) {\r\n if (_this.shouldRenderAsTransmission(mesh.material) && mesh.material instanceof PBRMaterial) {\r\n mesh.material.refractionTexture = _this._opaqueRenderTarget;\r\n }\r\n });\r\n };\r\n /**\r\n * Dispose all the elements created by the Helper.\r\n */\r\n TransmissionHelper.prototype.dispose = function () {\r\n this._scene._transmissionHelper = undefined;\r\n if (this._opaqueRenderTarget) {\r\n this._opaqueRenderTarget.dispose();\r\n this._opaqueRenderTarget = null;\r\n }\r\n this._transparentMeshesCache = [];\r\n this._opaqueMeshesCache = [];\r\n };\r\n return TransmissionHelper;\r\n}());\r\nvar NAME = \"KHR_materials_transmission\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1698)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar KHR_materials_transmission = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_transmission(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 175;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n if (this.enabled) {\r\n loader.parent.transparencyAsCoverage = true;\r\n }\r\n }\r\n /** @hidden */\r\n KHR_materials_transmission.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_transmission.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loadTransparentPropertiesAsync(extensionContext, material, babylonMaterial, extension));\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n KHR_materials_transmission.prototype._loadTransparentPropertiesAsync = function (context, material, babylonMaterial, extension) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var pbrMaterial = babylonMaterial;\r\n // Enables \"refraction\" texture which represents transmitted light.\r\n pbrMaterial.subSurface.isRefractionEnabled = true;\r\n // Since this extension models thin-surface transmission only, we must make IOR = 1.0\r\n pbrMaterial.subSurface.volumeIndexOfRefraction = 1.0;\r\n // Albedo colour will tint transmission.\r\n pbrMaterial.subSurface.useAlbedoToTintRefraction = true;\r\n if (extension.transmissionFactor !== undefined) {\r\n pbrMaterial.subSurface.refractionIntensity = extension.transmissionFactor;\r\n var scene = pbrMaterial.getScene();\r\n if (pbrMaterial.subSurface.refractionIntensity && !scene._transmissionHelper) {\r\n new TransmissionHelper({}, pbrMaterial.getScene());\r\n }\r\n }\r\n else {\r\n pbrMaterial.subSurface.refractionIntensity = 0.0;\r\n pbrMaterial.subSurface.isRefractionEnabled = false;\r\n return Promise.resolve();\r\n }\r\n if (extension.transmissionTexture) {\r\n extension.transmissionTexture.nonColorData = true;\r\n return this._loader.loadTextureInfoAsync(context + \"/transmissionTexture\", extension.transmissionTexture, undefined)\r\n .then(function (texture) {\r\n pbrMaterial.subSurface.thicknessTexture = texture;\r\n pbrMaterial.subSurface.useMaskFromThicknessTextureGltf = true;\r\n });\r\n }\r\n else {\r\n return Promise.resolve();\r\n }\r\n };\r\n return KHR_materials_transmission;\r\n}());\r\nexport { KHR_materials_transmission };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_transmission(loader); });\r\n//# sourceMappingURL=KHR_materials_transmission.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"KHR_materials_translucency\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1825)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar KHR_materials_translucency = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_materials_translucency(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 175;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n if (this.enabled) {\r\n loader.parent.transparencyAsCoverage = true;\r\n }\r\n }\r\n /** @hidden */\r\n KHR_materials_translucency.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_materials_translucency.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\r\n promises.push(_this._loadTranslucentPropertiesAsync(extensionContext, material, babylonMaterial, extension));\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n KHR_materials_translucency.prototype._loadTranslucentPropertiesAsync = function (context, material, babylonMaterial, extension) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(context + \": Material type not supported\");\r\n }\r\n var pbrMaterial = babylonMaterial;\r\n // Enables \"translucency\" texture which represents diffusely-transmitted light.\r\n pbrMaterial.subSurface.isTranslucencyEnabled = true;\r\n // Since this extension models thin-surface transmission only, we must make the\r\n // internal IOR == 1.0 and set the thickness to 0.\r\n pbrMaterial.subSurface.volumeIndexOfRefraction = 1.0;\r\n pbrMaterial.subSurface.minimumThickness = 0.0;\r\n pbrMaterial.subSurface.maximumThickness = 0.0;\r\n // Albedo colour will tint transmission.\r\n pbrMaterial.subSurface.useAlbedoToTintRefraction = true;\r\n if (extension.translucencyFactor !== undefined) {\r\n pbrMaterial.subSurface.translucencyIntensity = extension.translucencyFactor;\r\n }\r\n else {\r\n pbrMaterial.subSurface.translucencyIntensity = 0.0;\r\n pbrMaterial.subSurface.isTranslucencyEnabled = false;\r\n return Promise.resolve();\r\n }\r\n if (extension.translucencyTexture) {\r\n return this._loader.loadTextureInfoAsync(context + \"/translucencyTexture\", extension.translucencyTexture)\r\n .then(function (texture) {\r\n pbrMaterial.subSurface.thicknessTexture = texture;\r\n pbrMaterial.subSurface.useMaskFromThicknessTextureGltf = true;\r\n });\r\n }\r\n else {\r\n return Promise.resolve();\r\n }\r\n };\r\n return KHR_materials_translucency;\r\n}());\r\nexport { KHR_materials_translucency };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_materials_translucency(loader); });\r\n//# sourceMappingURL=KHR_materials_translucency.js.map","import { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"KHR_mesh_quantization\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization)\r\n */\r\nvar KHR_mesh_quantization = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_mesh_quantization(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_mesh_quantization.prototype.dispose = function () {\r\n };\r\n return KHR_mesh_quantization;\r\n}());\r\nexport { KHR_mesh_quantization };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_mesh_quantization(loader); });\r\n//# sourceMappingURL=KHR_mesh_quantization.js.map","import { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nvar NAME = \"KHR_texture_basisu\";\r\n/**\r\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1751)\r\n * !!! Experimental Extension Subject to Changes !!!\r\n */\r\nvar KHR_texture_basisu = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_texture_basisu(loader) {\r\n /** The name of this extension. */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_texture_basisu.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_texture_basisu.prototype._loadTextureAsync = function (context, texture, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, texture, this.name, function (extensionContext, extension) {\r\n var sampler = (texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(context + \"/sampler\", _this._loader.gltf.samplers, texture.sampler));\r\n var image = ArrayItem.Get(extensionContext + \"/source\", _this._loader.gltf.images, extension.source);\r\n return _this._loader._createTextureAsync(context, sampler, image, function (babylonTexture) {\r\n assign(babylonTexture);\r\n }, texture._textureInfo.nonColorData ? { useRGBAIfASTCBC7NotAvailableWhenUASTC: true } : undefined);\r\n });\r\n };\r\n return KHR_texture_basisu;\r\n}());\r\nexport { KHR_texture_basisu };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_texture_basisu(loader); });\r\n//# sourceMappingURL=KHR_texture_basisu.js.map","import { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"KHR_texture_transform\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_texture_transform)\r\n */\r\nvar KHR_texture_transform = /** @class */ (function () {\r\n /** @hidden */\r\n function KHR_texture_transform(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n KHR_texture_transform.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n KHR_texture_transform.prototype.loadTextureInfoAsync = function (context, textureInfo, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, textureInfo, this.name, function (extensionContext, extension) {\r\n return _this._loader.loadTextureInfoAsync(context, textureInfo, function (babylonTexture) {\r\n if (!(babylonTexture instanceof Texture)) {\r\n throw new Error(extensionContext + \": Texture type not supported\");\r\n }\r\n if (extension.offset) {\r\n babylonTexture.uOffset = extension.offset[0];\r\n babylonTexture.vOffset = extension.offset[1];\r\n }\r\n // Always rotate around the origin.\r\n babylonTexture.uRotationCenter = 0;\r\n babylonTexture.vRotationCenter = 0;\r\n if (extension.rotation) {\r\n babylonTexture.wAng = -extension.rotation;\r\n }\r\n if (extension.scale) {\r\n babylonTexture.uScale = extension.scale[0];\r\n babylonTexture.vScale = extension.scale[1];\r\n }\r\n if (extension.texCoord != undefined) {\r\n babylonTexture.coordinatesIndex = extension.texCoord;\r\n }\r\n assign(babylonTexture);\r\n });\r\n });\r\n };\r\n return KHR_texture_transform;\r\n}());\r\nexport { KHR_texture_transform };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new KHR_texture_transform(loader); });\r\n//# sourceMappingURL=KHR_texture_transform.js.map","/**\r\n * Composed of a frame, and an action function\r\n */\r\nvar AnimationEvent = /** @class */ (function () {\r\n /**\r\n * Initializes the animation event\r\n * @param frame The frame for which the event is triggered\r\n * @param action The event to perform when triggered\r\n * @param onlyOnce Specifies if the event should be triggered only once\r\n */\r\n function AnimationEvent(\r\n /** The frame for which the event is triggered **/\r\n frame, \r\n /** The event to perform when triggered **/\r\n action, \r\n /** Specifies if the event should be triggered only once**/\r\n onlyOnce) {\r\n this.frame = frame;\r\n this.action = action;\r\n this.onlyOnce = onlyOnce;\r\n /**\r\n * Specifies if the animation event is done\r\n */\r\n this.isDone = false;\r\n }\r\n /** @hidden */\r\n AnimationEvent.prototype._clone = function () {\r\n return new AnimationEvent(this.frame, this.action, this.onlyOnce);\r\n };\r\n return AnimationEvent;\r\n}());\r\nexport { AnimationEvent };\r\n//# sourceMappingURL=animationEvent.js.map","import { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { _DevTools } from \"../Misc/devTools\";\r\n/**\r\n * Defines a sound that can be played in the application.\r\n * The sound can either be an ambient track or a simple sound played in reaction to a user action.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music\r\n */\r\nvar Sound = /** @class */ (function () {\r\n /**\r\n * Create a sound and attach it to a scene\r\n * @param name Name of your sound\r\n * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer, it also works with MediaStreams\r\n * @param scene defines the scene the sound belongs to\r\n * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played\r\n * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming\r\n */\r\n function Sound(name, urlOrArrayBuffer, scene, readyToPlayCallback, options) {\r\n var _this = this;\r\n if (readyToPlayCallback === void 0) { readyToPlayCallback = null; }\r\n var _a, _b, _c, _d;\r\n /**\r\n * Does the sound autoplay once loaded.\r\n */\r\n this.autoplay = false;\r\n /**\r\n * Does the sound loop after it finishes playing once.\r\n */\r\n this.loop = false;\r\n /**\r\n * Does the sound use a custom attenuation curve to simulate the falloff\r\n * happening when the source gets further away from the camera.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-your-own-custom-attenuation-function\r\n */\r\n this.useCustomAttenuation = false;\r\n /**\r\n * Is this sound currently played.\r\n */\r\n this.isPlaying = false;\r\n /**\r\n * Is this sound currently paused.\r\n */\r\n this.isPaused = false;\r\n /**\r\n * Does this sound enables spatial sound.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.spatialSound = false;\r\n /**\r\n * Define the reference distance the sound should be heard perfectly.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.refDistance = 1;\r\n /**\r\n * Define the roll off factor of spatial sounds.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.rolloffFactor = 1;\r\n /**\r\n * Define the max distance the sound should be heard (intensity just became 0 at this point).\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.maxDistance = 100;\r\n /**\r\n * Define the distance attenuation model the sound will follow.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n this.distanceModel = \"linear\";\r\n /**\r\n * Gets or sets an object used to store user defined information for the sound.\r\n */\r\n this.metadata = null;\r\n /**\r\n * Observable event when the current playing sound finishes.\r\n */\r\n this.onEndedObservable = new Observable();\r\n this._panningModel = \"equalpower\";\r\n this._playbackRate = 1;\r\n this._streaming = false;\r\n this._startTime = 0;\r\n this._startOffset = 0;\r\n this._position = Vector3.Zero();\r\n /** @hidden */\r\n this._positionInEmitterSpace = false;\r\n this._localDirection = new Vector3(1, 0, 0);\r\n this._volume = 1;\r\n this._isReadyToPlay = false;\r\n this._isDirectional = false;\r\n // Used if you'd like to create a directional sound.\r\n // If not set, the sound will be omnidirectional\r\n this._coneInnerAngle = 360;\r\n this._coneOuterAngle = 360;\r\n this._coneOuterGain = 0;\r\n this._isOutputConnected = false;\r\n this._urlType = \"Unknown\";\r\n this.name = name;\r\n this._scene = scene;\r\n Sound._SceneComponentInitialization(scene);\r\n this._readyToPlayCallback = readyToPlayCallback;\r\n // Default custom attenuation function is a linear attenuation\r\n this._customAttenuationFunction = function (currentVolume, currentDistance, maxDistance, refDistance, rolloffFactor) {\r\n if (currentDistance < maxDistance) {\r\n return currentVolume * (1 - currentDistance / maxDistance);\r\n }\r\n else {\r\n return 0;\r\n }\r\n };\r\n if (options) {\r\n this.autoplay = options.autoplay || false;\r\n this.loop = options.loop || false;\r\n // if volume === 0, we need another way to check this option\r\n if (options.volume !== undefined) {\r\n this._volume = options.volume;\r\n }\r\n this.spatialSound = (_a = options.spatialSound) !== null && _a !== void 0 ? _a : false;\r\n this.maxDistance = (_b = options.maxDistance) !== null && _b !== void 0 ? _b : 100;\r\n this.useCustomAttenuation = (_c = options.useCustomAttenuation) !== null && _c !== void 0 ? _c : false;\r\n this.rolloffFactor = options.rolloffFactor || 1;\r\n this.refDistance = options.refDistance || 1;\r\n this.distanceModel = options.distanceModel || \"linear\";\r\n this._playbackRate = options.playbackRate || 1;\r\n this._streaming = (_d = options.streaming) !== null && _d !== void 0 ? _d : false;\r\n this._length = options.length;\r\n this._offset = options.offset;\r\n }\r\n if (Engine.audioEngine.canUseWebAudio && Engine.audioEngine.audioContext) {\r\n this._soundGain = Engine.audioEngine.audioContext.createGain();\r\n this._soundGain.gain.value = this._volume;\r\n this._inputAudioNode = this._soundGain;\r\n this._outputAudioNode = this._soundGain;\r\n if (this.spatialSound) {\r\n this._createSpatialParameters();\r\n }\r\n this._scene.mainSoundTrack.addSound(this);\r\n var validParameter = true;\r\n // if no parameter is passed, you need to call setAudioBuffer yourself to prepare the sound\r\n if (urlOrArrayBuffer) {\r\n try {\r\n if (typeof urlOrArrayBuffer === \"string\") {\r\n this._urlType = \"String\";\r\n }\r\n else if (urlOrArrayBuffer instanceof ArrayBuffer) {\r\n this._urlType = \"ArrayBuffer\";\r\n }\r\n else if (urlOrArrayBuffer instanceof MediaStream) {\r\n this._urlType = \"MediaStream\";\r\n }\r\n else if (Array.isArray(urlOrArrayBuffer)) {\r\n this._urlType = \"Array\";\r\n }\r\n var urls = [];\r\n var codecSupportedFound = false;\r\n switch (this._urlType) {\r\n case \"MediaStream\":\r\n this._streaming = true;\r\n this._isReadyToPlay = true;\r\n this._streamingSource = Engine.audioEngine.audioContext.createMediaStreamSource(urlOrArrayBuffer);\r\n if (this.autoplay) {\r\n this.play(0, this._offset, this._length);\r\n }\r\n if (this._readyToPlayCallback) {\r\n this._readyToPlayCallback();\r\n }\r\n break;\r\n case \"ArrayBuffer\":\r\n if (urlOrArrayBuffer.byteLength > 0) {\r\n codecSupportedFound = true;\r\n this._soundLoaded(urlOrArrayBuffer);\r\n }\r\n break;\r\n case \"String\":\r\n urls.push(urlOrArrayBuffer);\r\n case \"Array\":\r\n if (urls.length === 0) {\r\n urls = urlOrArrayBuffer;\r\n }\r\n // If we found a supported format, we load it immediately and stop the loop\r\n for (var i = 0; i < urls.length; i++) {\r\n var url = urls[i];\r\n codecSupportedFound =\r\n (options && options.skipCodecCheck) ||\r\n (url.indexOf(\".mp3\", url.length - 4) !== -1 && Engine.audioEngine.isMP3supported) ||\r\n (url.indexOf(\".ogg\", url.length - 4) !== -1 && Engine.audioEngine.isOGGsupported) ||\r\n url.indexOf(\".wav\", url.length - 4) !== -1 ||\r\n url.indexOf(\".m4a\", url.length - 4) !== -1 ||\r\n url.indexOf(\"blob:\") !== -1;\r\n if (codecSupportedFound) {\r\n // Loading sound using XHR2\r\n if (!this._streaming) {\r\n this._scene._loadFile(url, function (data) {\r\n _this._soundLoaded(data);\r\n }, undefined, true, true, function (exception) {\r\n if (exception) {\r\n Logger.Error(\"XHR \" + exception.status + \" error on: \" + url + \".\");\r\n }\r\n Logger.Error(\"Sound creation aborted.\");\r\n _this._scene.mainSoundTrack.removeSound(_this);\r\n });\r\n }\r\n // Streaming sound using HTML5 Audio tag\r\n else {\r\n this._htmlAudioElement = new Audio(url);\r\n this._htmlAudioElement.controls = false;\r\n this._htmlAudioElement.loop = this.loop;\r\n Tools.SetCorsBehavior(url, this._htmlAudioElement);\r\n this._htmlAudioElement.preload = \"auto\";\r\n this._htmlAudioElement.addEventListener(\"canplaythrough\", function () {\r\n _this._isReadyToPlay = true;\r\n if (_this.autoplay) {\r\n _this.play(0, _this._offset, _this._length);\r\n }\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n });\r\n document.body.appendChild(this._htmlAudioElement);\r\n this._htmlAudioElement.load();\r\n }\r\n break;\r\n }\r\n }\r\n break;\r\n default:\r\n validParameter = false;\r\n break;\r\n }\r\n if (!validParameter) {\r\n Logger.Error(\"Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.\");\r\n }\r\n else {\r\n if (!codecSupportedFound) {\r\n this._isReadyToPlay = true;\r\n // Simulating a ready to play event to avoid breaking code path\r\n if (this._readyToPlayCallback) {\r\n window.setTimeout(function () {\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n }, 1000);\r\n }\r\n }\r\n }\r\n }\r\n catch (ex) {\r\n Logger.Error(\"Unexpected error. Sound creation aborted.\");\r\n this._scene.mainSoundTrack.removeSound(this);\r\n }\r\n }\r\n }\r\n else {\r\n // Adding an empty sound to avoid breaking audio calls for non Web Audio browsers\r\n this._scene.mainSoundTrack.addSound(this);\r\n if (!Engine.audioEngine.WarnedWebAudioUnsupported) {\r\n Logger.Error(\"Web Audio is not supported by your browser.\");\r\n Engine.audioEngine.WarnedWebAudioUnsupported = true;\r\n }\r\n // Simulating a ready to play event to avoid breaking code for non web audio browsers\r\n if (this._readyToPlayCallback) {\r\n window.setTimeout(function () {\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n }, 1000);\r\n }\r\n }\r\n }\r\n Object.defineProperty(Sound.prototype, \"currentTime\", {\r\n /**\r\n * Gets the current time for the sound.\r\n */\r\n get: function () {\r\n if (this._htmlAudioElement) {\r\n return this._htmlAudioElement.currentTime;\r\n }\r\n var currentTime = this._startOffset;\r\n if (this.isPlaying && Engine.audioEngine.audioContext) {\r\n currentTime += Engine.audioEngine.audioContext.currentTime - this._startTime;\r\n }\r\n return currentTime;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Release the sound and its associated resources\r\n */\r\n Sound.prototype.dispose = function () {\r\n if (Engine.audioEngine.canUseWebAudio) {\r\n if (this.isPlaying) {\r\n this.stop();\r\n }\r\n this._isReadyToPlay = false;\r\n if (this.soundTrackId === -1) {\r\n this._scene.mainSoundTrack.removeSound(this);\r\n }\r\n else if (this._scene.soundTracks) {\r\n this._scene.soundTracks[this.soundTrackId].removeSound(this);\r\n }\r\n if (this._soundGain) {\r\n this._soundGain.disconnect();\r\n this._soundGain = null;\r\n }\r\n if (this._soundPanner) {\r\n this._soundPanner.disconnect();\r\n this._soundPanner = null;\r\n }\r\n if (this._soundSource) {\r\n this._soundSource.disconnect();\r\n this._soundSource = null;\r\n }\r\n this._audioBuffer = null;\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n this._htmlAudioElement.src = \"\";\r\n document.body.removeChild(this._htmlAudioElement);\r\n }\r\n if (this._streamingSource) {\r\n this._streamingSource.disconnect();\r\n }\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._connectedTransformNode = null;\r\n }\r\n }\r\n };\r\n /**\r\n * Gets if the sounds is ready to be played or not.\r\n * @returns true if ready, otherwise false\r\n */\r\n Sound.prototype.isReady = function () {\r\n return this._isReadyToPlay;\r\n };\r\n Sound.prototype._soundLoaded = function (audioData) {\r\n var _this = this;\r\n if (!Engine.audioEngine.audioContext) {\r\n return;\r\n }\r\n Engine.audioEngine.audioContext.decodeAudioData(audioData, function (buffer) {\r\n _this._audioBuffer = buffer;\r\n _this._isReadyToPlay = true;\r\n if (_this.autoplay) {\r\n _this.play(0, _this._offset, _this._length);\r\n }\r\n if (_this._readyToPlayCallback) {\r\n _this._readyToPlayCallback();\r\n }\r\n }, function (err) {\r\n Logger.Error(\"Error while decoding audio data for: \" + _this.name + \" / Error: \" + err);\r\n });\r\n };\r\n /**\r\n * Sets the data of the sound from an audiobuffer\r\n * @param audioBuffer The audioBuffer containing the data\r\n */\r\n Sound.prototype.setAudioBuffer = function (audioBuffer) {\r\n if (Engine.audioEngine.canUseWebAudio) {\r\n this._audioBuffer = audioBuffer;\r\n this._isReadyToPlay = true;\r\n }\r\n };\r\n /**\r\n * Updates the current sounds options such as maxdistance, loop...\r\n * @param options A JSON object containing values named as the object properties\r\n */\r\n Sound.prototype.updateOptions = function (options) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n if (options) {\r\n this.loop = (_a = options.loop) !== null && _a !== void 0 ? _a : this.loop;\r\n this.maxDistance = (_b = options.maxDistance) !== null && _b !== void 0 ? _b : this.maxDistance;\r\n this.useCustomAttenuation = (_c = options.useCustomAttenuation) !== null && _c !== void 0 ? _c : this.useCustomAttenuation;\r\n this.rolloffFactor = (_d = options.rolloffFactor) !== null && _d !== void 0 ? _d : this.rolloffFactor;\r\n this.refDistance = (_e = options.refDistance) !== null && _e !== void 0 ? _e : this.refDistance;\r\n this.distanceModel = (_f = options.distanceModel) !== null && _f !== void 0 ? _f : this.distanceModel;\r\n this._playbackRate = (_g = options.playbackRate) !== null && _g !== void 0 ? _g : this._playbackRate;\r\n this._length = (_h = options.length) !== null && _h !== void 0 ? _h : undefined;\r\n this._offset = (_j = options.offset) !== null && _j !== void 0 ? _j : undefined;\r\n this._updateSpatialParameters();\r\n if (this.isPlaying) {\r\n if (this._streaming && this._htmlAudioElement) {\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n if (this._htmlAudioElement.loop !== this.loop) {\r\n this._htmlAudioElement.loop = this.loop;\r\n }\r\n }\r\n else {\r\n if (this._soundSource) {\r\n this._soundSource.playbackRate.value = this._playbackRate;\r\n if (this._soundSource.loop !== this.loop) {\r\n this._soundSource.loop = this.loop;\r\n }\r\n if (this._offset !== undefined && this._soundSource.loopStart !== this._offset) {\r\n this._soundSource.loopStart = this._offset;\r\n }\r\n if (this._length !== undefined && this._length !== this._soundSource.loopEnd) {\r\n this._soundSource.loopEnd = (this._offset | 0) + this._length;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n Sound.prototype._createSpatialParameters = function () {\r\n if (Engine.audioEngine.canUseWebAudio && Engine.audioEngine.audioContext) {\r\n if (this._scene.headphone) {\r\n this._panningModel = \"HRTF\";\r\n }\r\n this._soundPanner = Engine.audioEngine.audioContext.createPanner();\r\n if (this._soundPanner && this._outputAudioNode) {\r\n this._updateSpatialParameters();\r\n this._soundPanner.connect(this._outputAudioNode);\r\n this._inputAudioNode = this._soundPanner;\r\n }\r\n }\r\n };\r\n Sound.prototype._updateSpatialParameters = function () {\r\n if (this.spatialSound && this._soundPanner) {\r\n if (this.useCustomAttenuation) {\r\n // Tricks to disable in a way embedded Web Audio attenuation\r\n this._soundPanner.distanceModel = \"linear\";\r\n this._soundPanner.maxDistance = Number.MAX_VALUE;\r\n this._soundPanner.refDistance = 1;\r\n this._soundPanner.rolloffFactor = 1;\r\n this._soundPanner.panningModel = this._panningModel;\r\n }\r\n else {\r\n this._soundPanner.distanceModel = this.distanceModel;\r\n this._soundPanner.maxDistance = this.maxDistance;\r\n this._soundPanner.refDistance = this.refDistance;\r\n this._soundPanner.rolloffFactor = this.rolloffFactor;\r\n this._soundPanner.panningModel = this._panningModel;\r\n }\r\n }\r\n };\r\n /**\r\n * Switch the panning model to HRTF:\r\n * Renders a stereo output of higher quality than equalpower — it uses a convolution with measured impulse responses from human subjects.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n Sound.prototype.switchPanningModelToHRTF = function () {\r\n this._panningModel = \"HRTF\";\r\n this._switchPanningModel();\r\n };\r\n /**\r\n * Switch the panning model to Equal Power:\r\n * Represents the equal-power panning algorithm, generally regarded as simple and efficient. equalpower is the default value.\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-a-spatial-3d-sound\r\n */\r\n Sound.prototype.switchPanningModelToEqualPower = function () {\r\n this._panningModel = \"equalpower\";\r\n this._switchPanningModel();\r\n };\r\n Sound.prototype._switchPanningModel = function () {\r\n if (Engine.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner) {\r\n this._soundPanner.panningModel = this._panningModel;\r\n }\r\n };\r\n /**\r\n * Connect this sound to a sound track audio node like gain...\r\n * @param soundTrackAudioNode the sound track audio node to connect to\r\n */\r\n Sound.prototype.connectToSoundTrackAudioNode = function (soundTrackAudioNode) {\r\n if (Engine.audioEngine.canUseWebAudio && this._outputAudioNode) {\r\n if (this._isOutputConnected) {\r\n this._outputAudioNode.disconnect();\r\n }\r\n this._outputAudioNode.connect(soundTrackAudioNode);\r\n this._isOutputConnected = true;\r\n }\r\n };\r\n /**\r\n * Transform this sound into a directional source\r\n * @param coneInnerAngle Size of the inner cone in degree\r\n * @param coneOuterAngle Size of the outer cone in degree\r\n * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)\r\n */\r\n Sound.prototype.setDirectionalCone = function (coneInnerAngle, coneOuterAngle, coneOuterGain) {\r\n if (coneOuterAngle < coneInnerAngle) {\r\n Logger.Error(\"setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneInnerAngle = coneInnerAngle;\r\n this._coneOuterAngle = coneOuterAngle;\r\n this._coneOuterGain = coneOuterGain;\r\n this._isDirectional = true;\r\n if (this.isPlaying && this.loop) {\r\n this.stop();\r\n this.play(0, this._offset, this._length);\r\n }\r\n };\r\n Object.defineProperty(Sound.prototype, \"directionalConeInnerAngle\", {\r\n /**\r\n * Gets or sets the inner angle for the directional cone.\r\n */\r\n get: function () {\r\n return this._coneInnerAngle;\r\n },\r\n /**\r\n * Gets or sets the inner angle for the directional cone.\r\n */\r\n set: function (value) {\r\n if (value != this._coneInnerAngle) {\r\n if (this._coneOuterAngle < value) {\r\n Logger.Error(\"directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneInnerAngle = value;\r\n if (Engine.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner) {\r\n this._soundPanner.coneInnerAngle = this._coneInnerAngle;\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Sound.prototype, \"directionalConeOuterAngle\", {\r\n /**\r\n * Gets or sets the outer angle for the directional cone.\r\n */\r\n get: function () {\r\n return this._coneOuterAngle;\r\n },\r\n /**\r\n * Gets or sets the outer angle for the directional cone.\r\n */\r\n set: function (value) {\r\n if (value != this._coneOuterAngle) {\r\n if (value < this._coneInnerAngle) {\r\n Logger.Error(\"directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneOuterAngle = value;\r\n if (Engine.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner) {\r\n this._soundPanner.coneOuterAngle = this._coneOuterAngle;\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Sets the position of the emitter if spatial sound is enabled\r\n * @param newPosition Defines the new posisiton\r\n */\r\n Sound.prototype.setPosition = function (newPosition) {\r\n this._position = newPosition;\r\n if (Engine.audioEngine.canUseWebAudio && this.spatialSound && this._soundPanner && !isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z)) {\r\n this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);\r\n }\r\n };\r\n /**\r\n * Sets the local direction of the emitter if spatial sound is enabled\r\n * @param newLocalDirection Defines the new local direction\r\n */\r\n Sound.prototype.setLocalDirectionToMesh = function (newLocalDirection) {\r\n this._localDirection = newLocalDirection;\r\n if (Engine.audioEngine.canUseWebAudio && this._connectedTransformNode && this.isPlaying) {\r\n this._updateDirection();\r\n }\r\n };\r\n Sound.prototype._updateDirection = function () {\r\n if (!this._connectedTransformNode || !this._soundPanner) {\r\n return;\r\n }\r\n var mat = this._connectedTransformNode.getWorldMatrix();\r\n var direction = Vector3.TransformNormal(this._localDirection, mat);\r\n direction.normalize();\r\n this._soundPanner.setOrientation(direction.x, direction.y, direction.z);\r\n };\r\n /** @hidden */\r\n Sound.prototype.updateDistanceFromListener = function () {\r\n if (Engine.audioEngine.canUseWebAudio && this._connectedTransformNode && this.useCustomAttenuation && this._soundGain && this._scene.activeCamera) {\r\n var distance = this._connectedTransformNode.getDistanceToCamera(this._scene.activeCamera);\r\n this._soundGain.gain.value = this._customAttenuationFunction(this._volume, distance, this.maxDistance, this.refDistance, this.rolloffFactor);\r\n }\r\n };\r\n /**\r\n * Sets a new custom attenuation function for the sound.\r\n * @param callback Defines the function used for the attenuation\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#creating-your-own-custom-attenuation-function\r\n */\r\n Sound.prototype.setAttenuationFunction = function (callback) {\r\n this._customAttenuationFunction = callback;\r\n };\r\n /**\r\n * Play the sound\r\n * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.\r\n * @param offset (optional) Start the sound at a specific time in seconds\r\n * @param length (optional) Sound duration (in seconds)\r\n */\r\n Sound.prototype.play = function (time, offset, length) {\r\n var _this = this;\r\n if (this._isReadyToPlay && this._scene.audioEnabled && Engine.audioEngine.audioContext) {\r\n try {\r\n if (this._startOffset < 0) {\r\n time = -this._startOffset;\r\n this._startOffset = 0;\r\n }\r\n var startTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;\r\n if (!this._soundSource || !this._streamingSource) {\r\n if (this.spatialSound && this._soundPanner) {\r\n if (!isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z)) {\r\n this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);\r\n }\r\n if (this._isDirectional) {\r\n this._soundPanner.coneInnerAngle = this._coneInnerAngle;\r\n this._soundPanner.coneOuterAngle = this._coneOuterAngle;\r\n this._soundPanner.coneOuterGain = this._coneOuterGain;\r\n if (this._connectedTransformNode) {\r\n this._updateDirection();\r\n }\r\n else {\r\n this._soundPanner.setOrientation(this._localDirection.x, this._localDirection.y, this._localDirection.z);\r\n }\r\n }\r\n }\r\n }\r\n if (this._streaming) {\r\n if (!this._streamingSource) {\r\n this._streamingSource = Engine.audioEngine.audioContext.createMediaElementSource(this._htmlAudioElement);\r\n this._htmlAudioElement.onended = function () {\r\n _this._onended();\r\n };\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n }\r\n this._streamingSource.disconnect();\r\n if (this._inputAudioNode) {\r\n this._streamingSource.connect(this._inputAudioNode);\r\n }\r\n if (this._htmlAudioElement) {\r\n // required to manage properly the new suspended default state of Chrome\r\n // When the option 'streaming: true' is used, we need first to wait for\r\n // the audio engine to be unlocked by a user gesture before trying to play\r\n // an HTML Audio elememt\r\n var tryToPlay = function () {\r\n if (Engine.audioEngine.unlocked) {\r\n var playPromise = _this._htmlAudioElement.play();\r\n // In browsers that don’t yet support this functionality,\r\n // playPromise won’t be defined.\r\n if (playPromise !== undefined) {\r\n playPromise.catch(function (error) {\r\n // Automatic playback failed.\r\n // Waiting for the audio engine to be unlocked by user click on unmute\r\n Engine.audioEngine.lock();\r\n if (_this.loop || _this.autoplay) {\r\n Engine.audioEngine.onAudioUnlockedObservable.addOnce(function () {\r\n tryToPlay();\r\n });\r\n }\r\n });\r\n }\r\n }\r\n else {\r\n if (_this.loop || _this.autoplay) {\r\n Engine.audioEngine.onAudioUnlockedObservable.addOnce(function () {\r\n tryToPlay();\r\n });\r\n }\r\n }\r\n };\r\n tryToPlay();\r\n }\r\n }\r\n else {\r\n var tryToPlay = function () {\r\n if (Engine.audioEngine.audioContext) {\r\n length = length || _this._length;\r\n offset = offset || _this._offset;\r\n if (_this._soundSource) {\r\n var oldSource_1 = _this._soundSource;\r\n oldSource_1.onended = function () {\r\n oldSource_1.disconnect();\r\n };\r\n }\r\n _this._soundSource = Engine.audioEngine.audioContext.createBufferSource();\r\n if (_this._soundSource && _this._inputAudioNode) {\r\n _this._soundSource.buffer = _this._audioBuffer;\r\n _this._soundSource.connect(_this._inputAudioNode);\r\n _this._soundSource.loop = _this.loop;\r\n if (offset !== undefined) {\r\n _this._soundSource.loopStart = offset;\r\n }\r\n if (length !== undefined) {\r\n _this._soundSource.loopEnd = (offset | 0) + length;\r\n }\r\n _this._soundSource.playbackRate.value = _this._playbackRate;\r\n _this._soundSource.onended = function () {\r\n _this._onended();\r\n };\r\n startTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;\r\n var actualOffset = _this.isPaused ? _this._startOffset % _this._soundSource.buffer.duration : offset ? offset : 0;\r\n _this._soundSource.start(startTime, actualOffset, _this.loop ? undefined : length);\r\n }\r\n }\r\n };\r\n if (Engine.audioEngine.audioContext.state === \"suspended\") {\r\n // Wait a bit for FF as context seems late to be ready.\r\n setTimeout(function () {\r\n if (Engine.audioEngine.audioContext.state === \"suspended\") {\r\n // Automatic playback failed.\r\n // Waiting for the audio engine to be unlocked by user click on unmute\r\n Engine.audioEngine.lock();\r\n if (_this.loop || _this.autoplay) {\r\n Engine.audioEngine.onAudioUnlockedObservable.addOnce(function () {\r\n tryToPlay();\r\n });\r\n }\r\n }\r\n else {\r\n tryToPlay();\r\n }\r\n }, 500);\r\n }\r\n else {\r\n tryToPlay();\r\n }\r\n }\r\n this._startTime = startTime;\r\n this.isPlaying = true;\r\n this.isPaused = false;\r\n }\r\n catch (ex) {\r\n Logger.Error(\"Error while trying to play audio: \" + this.name + \", \" + ex.message);\r\n }\r\n }\r\n };\r\n Sound.prototype._onended = function () {\r\n this.isPlaying = false;\r\n this._startOffset = 0;\r\n if (this.onended) {\r\n this.onended();\r\n }\r\n this.onEndedObservable.notifyObservers(this);\r\n };\r\n /**\r\n * Stop the sound\r\n * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.\r\n */\r\n Sound.prototype.stop = function (time) {\r\n var _this = this;\r\n if (this.isPlaying) {\r\n if (this._streaming) {\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n // Test needed for Firefox or it will generate an Invalid State Error\r\n if (this._htmlAudioElement.currentTime > 0) {\r\n this._htmlAudioElement.currentTime = 0;\r\n }\r\n }\r\n else {\r\n this._streamingSource.disconnect();\r\n }\r\n this.isPlaying = false;\r\n }\r\n else if (Engine.audioEngine.audioContext && this._soundSource) {\r\n var stopTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;\r\n this._soundSource.stop(stopTime);\r\n this._soundSource.onended = function () {\r\n _this.isPlaying = false;\r\n };\r\n if (!this.isPaused) {\r\n this._startOffset = 0;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Put the sound in pause\r\n */\r\n Sound.prototype.pause = function () {\r\n if (this.isPlaying) {\r\n this.isPaused = true;\r\n if (this._streaming) {\r\n if (this._htmlAudioElement) {\r\n this._htmlAudioElement.pause();\r\n }\r\n else {\r\n this._streamingSource.disconnect();\r\n }\r\n }\r\n else if (Engine.audioEngine.audioContext) {\r\n this.stop(0);\r\n this._startOffset += Engine.audioEngine.audioContext.currentTime - this._startTime;\r\n }\r\n }\r\n };\r\n /**\r\n * Sets a dedicated volume for this sounds\r\n * @param newVolume Define the new volume of the sound\r\n * @param time Define time for gradual change to new volume\r\n */\r\n Sound.prototype.setVolume = function (newVolume, time) {\r\n if (Engine.audioEngine.canUseWebAudio && this._soundGain) {\r\n if (time && Engine.audioEngine.audioContext) {\r\n this._soundGain.gain.cancelScheduledValues(Engine.audioEngine.audioContext.currentTime);\r\n this._soundGain.gain.setValueAtTime(this._soundGain.gain.value, Engine.audioEngine.audioContext.currentTime);\r\n this._soundGain.gain.linearRampToValueAtTime(newVolume, Engine.audioEngine.audioContext.currentTime + time);\r\n }\r\n else {\r\n this._soundGain.gain.value = newVolume;\r\n }\r\n }\r\n this._volume = newVolume;\r\n };\r\n /**\r\n * Set the sound play back rate\r\n * @param newPlaybackRate Define the playback rate the sound should be played at\r\n */\r\n Sound.prototype.setPlaybackRate = function (newPlaybackRate) {\r\n this._playbackRate = newPlaybackRate;\r\n if (this.isPlaying) {\r\n if (this._streaming && this._htmlAudioElement) {\r\n this._htmlAudioElement.playbackRate = this._playbackRate;\r\n }\r\n else if (this._soundSource) {\r\n this._soundSource.playbackRate.value = this._playbackRate;\r\n }\r\n }\r\n };\r\n /**\r\n * Gets the volume of the sound.\r\n * @returns the volume of the sound\r\n */\r\n Sound.prototype.getVolume = function () {\r\n return this._volume;\r\n };\r\n /**\r\n * Attach the sound to a dedicated mesh\r\n * @param transformNode The transform node to connect the sound with\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#attaching-a-sound-to-a-mesh\r\n */\r\n Sound.prototype.attachToMesh = function (transformNode) {\r\n var _this = this;\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._registerFunc = null;\r\n }\r\n this._connectedTransformNode = transformNode;\r\n if (!this.spatialSound) {\r\n this.spatialSound = true;\r\n this._createSpatialParameters();\r\n if (this.isPlaying && this.loop) {\r\n this.stop();\r\n this.play(0, this._offset, this._length);\r\n }\r\n }\r\n this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode);\r\n this._registerFunc = function (transformNode) { return _this._onRegisterAfterWorldMatrixUpdate(transformNode); };\r\n this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc);\r\n };\r\n /**\r\n * Detach the sound from the previously attached mesh\r\n * @see https://doc.babylonjs.com/how_to/playing_sounds_and_music#attaching-a-sound-to-a-mesh\r\n */\r\n Sound.prototype.detachFromMesh = function () {\r\n if (this._connectedTransformNode && this._registerFunc) {\r\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\r\n this._registerFunc = null;\r\n this._connectedTransformNode = null;\r\n }\r\n };\r\n Sound.prototype._onRegisterAfterWorldMatrixUpdate = function (node) {\r\n if (this._positionInEmitterSpace) {\r\n node.worldMatrixFromCache.invertToRef(TmpVectors.Matrix[0]);\r\n this.setPosition(TmpVectors.Matrix[0].getTranslation());\r\n }\r\n else {\r\n if (!node.getBoundingInfo) {\r\n this.setPosition(node.absolutePosition);\r\n }\r\n else {\r\n var mesh = node;\r\n var boundingInfo = mesh.getBoundingInfo();\r\n this.setPosition(boundingInfo.boundingSphere.centerWorld);\r\n }\r\n }\r\n if (Engine.audioEngine.canUseWebAudio && this._isDirectional && this.isPlaying) {\r\n this._updateDirection();\r\n }\r\n };\r\n /**\r\n * Clone the current sound in the scene.\r\n * @returns the new sound clone\r\n */\r\n Sound.prototype.clone = function () {\r\n var _this = this;\r\n if (!this._streaming) {\r\n var setBufferAndRun = function () {\r\n if (_this._isReadyToPlay) {\r\n clonedSound._audioBuffer = _this.getAudioBuffer();\r\n clonedSound._isReadyToPlay = true;\r\n if (clonedSound.autoplay) {\r\n clonedSound.play(0, _this._offset, _this._length);\r\n }\r\n }\r\n else {\r\n window.setTimeout(setBufferAndRun, 300);\r\n }\r\n };\r\n var currentOptions = {\r\n autoplay: this.autoplay,\r\n loop: this.loop,\r\n volume: this._volume,\r\n spatialSound: this.spatialSound,\r\n maxDistance: this.maxDistance,\r\n useCustomAttenuation: this.useCustomAttenuation,\r\n rolloffFactor: this.rolloffFactor,\r\n refDistance: this.refDistance,\r\n distanceModel: this.distanceModel,\r\n };\r\n var clonedSound = new Sound(this.name + \"_cloned\", new ArrayBuffer(0), this._scene, null, currentOptions);\r\n if (this.useCustomAttenuation) {\r\n clonedSound.setAttenuationFunction(this._customAttenuationFunction);\r\n }\r\n clonedSound.setPosition(this._position);\r\n clonedSound.setPlaybackRate(this._playbackRate);\r\n setBufferAndRun();\r\n return clonedSound;\r\n }\r\n // Can't clone a streaming sound\r\n else {\r\n return null;\r\n }\r\n };\r\n /**\r\n * Gets the current underlying audio buffer containing the data\r\n * @returns the audio buffer\r\n */\r\n Sound.prototype.getAudioBuffer = function () {\r\n return this._audioBuffer;\r\n };\r\n /**\r\n * Gets the WebAudio AudioBufferSourceNode, lets you keep track of and stop instances of this Sound.\r\n * @returns the source node\r\n */\r\n Sound.prototype.getSoundSource = function () {\r\n return this._soundSource;\r\n };\r\n /**\r\n * Gets the WebAudio GainNode, gives you precise control over the gain of instances of this Sound.\r\n * @returns the gain node\r\n */\r\n Sound.prototype.getSoundGain = function () {\r\n return this._soundGain;\r\n };\r\n /**\r\n * Serializes the Sound in a JSON representation\r\n * @returns the JSON representation of the sound\r\n */\r\n Sound.prototype.serialize = function () {\r\n var serializationObject = {\r\n name: this.name,\r\n url: this.name,\r\n autoplay: this.autoplay,\r\n loop: this.loop,\r\n volume: this._volume,\r\n spatialSound: this.spatialSound,\r\n maxDistance: this.maxDistance,\r\n rolloffFactor: this.rolloffFactor,\r\n refDistance: this.refDistance,\r\n distanceModel: this.distanceModel,\r\n playbackRate: this._playbackRate,\r\n panningModel: this._panningModel,\r\n soundTrackId: this.soundTrackId,\r\n metadata: this.metadata,\r\n };\r\n if (this.spatialSound) {\r\n if (this._connectedTransformNode) {\r\n serializationObject.connectedMeshId = this._connectedTransformNode.id;\r\n }\r\n serializationObject.position = this._position.asArray();\r\n serializationObject.refDistance = this.refDistance;\r\n serializationObject.distanceModel = this.distanceModel;\r\n serializationObject.isDirectional = this._isDirectional;\r\n serializationObject.localDirectionToMesh = this._localDirection.asArray();\r\n serializationObject.coneInnerAngle = this._coneInnerAngle;\r\n serializationObject.coneOuterAngle = this._coneOuterAngle;\r\n serializationObject.coneOuterGain = this._coneOuterGain;\r\n }\r\n return serializationObject;\r\n };\r\n /**\r\n * Parse a JSON representation of a sound to innstantiate in a given scene\r\n * @param parsedSound Define the JSON representation of the sound (usually coming from the serialize method)\r\n * @param scene Define the scene the new parsed sound should be created in\r\n * @param rootUrl Define the rooturl of the load in case we need to fetch relative dependencies\r\n * @param sourceSound Define a cound place holder if do not need to instantiate a new one\r\n * @returns the newly parsed sound\r\n */\r\n Sound.Parse = function (parsedSound, scene, rootUrl, sourceSound) {\r\n var soundName = parsedSound.name;\r\n var soundUrl;\r\n if (parsedSound.url) {\r\n soundUrl = rootUrl + parsedSound.url;\r\n }\r\n else {\r\n soundUrl = rootUrl + soundName;\r\n }\r\n var options = {\r\n autoplay: parsedSound.autoplay,\r\n loop: parsedSound.loop,\r\n volume: parsedSound.volume,\r\n spatialSound: parsedSound.spatialSound,\r\n maxDistance: parsedSound.maxDistance,\r\n rolloffFactor: parsedSound.rolloffFactor,\r\n refDistance: parsedSound.refDistance,\r\n distanceModel: parsedSound.distanceModel,\r\n playbackRate: parsedSound.playbackRate,\r\n };\r\n var newSound;\r\n if (!sourceSound) {\r\n newSound = new Sound(soundName, soundUrl, scene, function () {\r\n scene._removePendingData(newSound);\r\n }, options);\r\n scene._addPendingData(newSound);\r\n }\r\n else {\r\n var setBufferAndRun = function () {\r\n if (sourceSound._isReadyToPlay) {\r\n newSound._audioBuffer = sourceSound.getAudioBuffer();\r\n newSound._isReadyToPlay = true;\r\n if (newSound.autoplay) {\r\n newSound.play(0, newSound._offset, newSound._length);\r\n }\r\n }\r\n else {\r\n window.setTimeout(setBufferAndRun, 300);\r\n }\r\n };\r\n newSound = new Sound(soundName, new ArrayBuffer(0), scene, null, options);\r\n setBufferAndRun();\r\n }\r\n if (parsedSound.position) {\r\n var soundPosition = Vector3.FromArray(parsedSound.position);\r\n newSound.setPosition(soundPosition);\r\n }\r\n if (parsedSound.isDirectional) {\r\n newSound.setDirectionalCone(parsedSound.coneInnerAngle || 360, parsedSound.coneOuterAngle || 360, parsedSound.coneOuterGain || 0);\r\n if (parsedSound.localDirectionToMesh) {\r\n var localDirectionToMesh = Vector3.FromArray(parsedSound.localDirectionToMesh);\r\n newSound.setLocalDirectionToMesh(localDirectionToMesh);\r\n }\r\n }\r\n if (parsedSound.connectedMeshId) {\r\n var connectedMesh = scene.getMeshByID(parsedSound.connectedMeshId);\r\n if (connectedMesh) {\r\n newSound.attachToMesh(connectedMesh);\r\n }\r\n }\r\n if (parsedSound.metadata) {\r\n newSound.metadata = parsedSound.metadata;\r\n }\r\n return newSound;\r\n };\r\n /** @hidden */\r\n Sound._SceneComponentInitialization = function (_) {\r\n throw _DevTools.WarnImport(\"AudioSceneComponent\");\r\n };\r\n return Sound;\r\n}());\r\nexport { Sound };\r\n//# sourceMappingURL=sound.js.map","import { Logger } from \"../Misc/logger\";\r\n/**\r\n * Wraps one or more Sound objects and selects one with random weight for playback.\r\n */\r\nvar WeightedSound = /** @class */ (function () {\r\n /**\r\n * Creates a new WeightedSound from the list of sounds given.\r\n * @param loop When true a Sound will be selected and played when the current playing Sound completes.\r\n * @param sounds Array of Sounds that will be selected from.\r\n * @param weights Array of number values for selection weights; length must equal sounds, values will be normalized to 1\r\n */\r\n function WeightedSound(loop, sounds, weights) {\r\n var _this = this;\r\n /** When true a Sound will be selected and played when the current playing Sound completes. */\r\n this.loop = false;\r\n this._coneInnerAngle = 360;\r\n this._coneOuterAngle = 360;\r\n this._volume = 1;\r\n /** A Sound is currently playing. */\r\n this.isPlaying = false;\r\n /** A Sound is currently paused. */\r\n this.isPaused = false;\r\n this._sounds = [];\r\n this._weights = [];\r\n if (sounds.length !== weights.length) {\r\n throw new Error('Sounds length does not equal weights length');\r\n }\r\n this.loop = loop;\r\n this._weights = weights;\r\n // Normalize the weights\r\n var weightSum = 0;\r\n for (var _i = 0, weights_1 = weights; _i < weights_1.length; _i++) {\r\n var weight = weights_1[_i];\r\n weightSum += weight;\r\n }\r\n var invWeightSum = weightSum > 0 ? 1 / weightSum : 0;\r\n for (var i = 0; i < this._weights.length; i++) {\r\n this._weights[i] *= invWeightSum;\r\n }\r\n this._sounds = sounds;\r\n for (var _a = 0, _b = this._sounds; _a < _b.length; _a++) {\r\n var sound = _b[_a];\r\n sound.onEndedObservable.add(function () { _this._onended(); });\r\n }\r\n }\r\n Object.defineProperty(WeightedSound.prototype, \"directionalConeInnerAngle\", {\r\n /**\r\n * The size of cone in degrees for a directional sound in which there will be no attenuation.\r\n */\r\n get: function () {\r\n return this._coneInnerAngle;\r\n },\r\n /**\r\n * The size of cone in degress for a directional sound in which there will be no attenuation.\r\n */\r\n set: function (value) {\r\n if (value !== this._coneInnerAngle) {\r\n if (this._coneOuterAngle < value) {\r\n Logger.Error(\"directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneInnerAngle = value;\r\n for (var _i = 0, _a = this._sounds; _i < _a.length; _i++) {\r\n var sound = _a[_i];\r\n sound.directionalConeInnerAngle = value;\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WeightedSound.prototype, \"directionalConeOuterAngle\", {\r\n /**\r\n * Size of cone in degrees for a directional sound outside of which there will be no sound.\r\n * Listener angles between innerAngle and outerAngle will falloff linearly.\r\n */\r\n get: function () {\r\n return this._coneOuterAngle;\r\n },\r\n /**\r\n * Size of cone in degrees for a directional sound outside of which there will be no sound.\r\n * Listener angles between innerAngle and outerAngle will falloff linearly.\r\n */\r\n set: function (value) {\r\n if (value !== this._coneOuterAngle) {\r\n if (value < this._coneInnerAngle) {\r\n Logger.Error(\"directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.\");\r\n return;\r\n }\r\n this._coneOuterAngle = value;\r\n for (var _i = 0, _a = this._sounds; _i < _a.length; _i++) {\r\n var sound = _a[_i];\r\n sound.directionalConeOuterAngle = value;\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(WeightedSound.prototype, \"volume\", {\r\n /**\r\n * Playback volume.\r\n */\r\n get: function () {\r\n return this._volume;\r\n },\r\n /**\r\n * Playback volume.\r\n */\r\n set: function (value) {\r\n if (value !== this._volume) {\r\n for (var _i = 0, _a = this._sounds; _i < _a.length; _i++) {\r\n var sound = _a[_i];\r\n sound.setVolume(value);\r\n }\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n WeightedSound.prototype._onended = function () {\r\n if (this._currentIndex !== undefined) {\r\n this._sounds[this._currentIndex].autoplay = false;\r\n }\r\n if (this.loop && this.isPlaying) {\r\n this.play();\r\n }\r\n else {\r\n this.isPlaying = false;\r\n }\r\n };\r\n /**\r\n * Suspend playback\r\n */\r\n WeightedSound.prototype.pause = function () {\r\n this.isPaused = true;\r\n if (this._currentIndex !== undefined) {\r\n this._sounds[this._currentIndex].pause();\r\n }\r\n };\r\n /**\r\n * Stop playback\r\n */\r\n WeightedSound.prototype.stop = function () {\r\n this.isPlaying = false;\r\n if (this._currentIndex !== undefined) {\r\n this._sounds[this._currentIndex].stop();\r\n }\r\n };\r\n /**\r\n * Start playback.\r\n * @param startOffset Position the clip head at a specific time in seconds.\r\n */\r\n WeightedSound.prototype.play = function (startOffset) {\r\n if (!this.isPaused) {\r\n this.stop();\r\n var randomValue = Math.random();\r\n var total = 0;\r\n for (var i = 0; i < this._weights.length; i++) {\r\n total += this._weights[i];\r\n if (randomValue <= total) {\r\n this._currentIndex = i;\r\n break;\r\n }\r\n }\r\n }\r\n var sound = this._sounds[this._currentIndex];\r\n if (sound.isReady()) {\r\n sound.play(0, this.isPaused ? undefined : startOffset);\r\n }\r\n else {\r\n sound.autoplay = true;\r\n }\r\n this.isPlaying = true;\r\n this.isPaused = false;\r\n };\r\n return WeightedSound;\r\n}());\r\nexport { WeightedSound };\r\n//# sourceMappingURL=weightedsound.js.map","import { Vector3 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\r\nimport { AnimationEvent } from \"@babylonjs/core/Animations/animationEvent\";\r\nimport { Sound } from \"@babylonjs/core/Audio/sound\";\r\nimport { WeightedSound } from \"@babylonjs/core/Audio/weightedsound\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nvar NAME = \"MSFT_audio_emitter\";\r\n/**\r\n * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)\r\n */\r\nvar MSFT_audio_emitter = /** @class */ (function () {\r\n /** @hidden */\r\n function MSFT_audio_emitter(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n MSFT_audio_emitter.prototype.dispose = function () {\r\n this._loader = null;\r\n this._clips = null;\r\n this._emitters = null;\r\n };\r\n /** @hidden */\r\n MSFT_audio_emitter.prototype.onLoading = function () {\r\n var extensions = this._loader.gltf.extensions;\r\n if (extensions && extensions[this.name]) {\r\n var extension = extensions[this.name];\r\n this._clips = extension.clips;\r\n this._emitters = extension.emitters;\r\n ArrayItem.Assign(this._clips);\r\n ArrayItem.Assign(this._emitters);\r\n }\r\n };\r\n /** @hidden */\r\n MSFT_audio_emitter.prototype.loadSceneAsync = function (context, scene) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, scene, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n promises.push(_this._loader.loadSceneAsync(context, scene));\r\n for (var _i = 0, _a = extension.emitters; _i < _a.length; _i++) {\r\n var emitterIndex = _a[_i];\r\n var emitter = ArrayItem.Get(extensionContext + \"/emitters\", _this._emitters, emitterIndex);\r\n if (emitter.refDistance != undefined || emitter.maxDistance != undefined || emitter.rolloffFactor != undefined ||\r\n emitter.distanceModel != undefined || emitter.innerAngle != undefined || emitter.outerAngle != undefined) {\r\n throw new Error(extensionContext + \": Direction or Distance properties are not allowed on emitters attached to a scene\");\r\n }\r\n promises.push(_this._loadEmitterAsync(extensionContext + \"/emitters/\" + emitter.index, emitter));\r\n }\r\n return Promise.all(promises).then(function () { });\r\n });\r\n };\r\n /** @hidden */\r\n MSFT_audio_emitter.prototype.loadNodeAsync = function (context, node, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {\r\n var promises = new Array();\r\n return _this._loader.loadNodeAsync(extensionContext, node, function (babylonMesh) {\r\n var _loop_1 = function (emitterIndex) {\r\n var emitter = ArrayItem.Get(extensionContext + \"/emitters\", _this._emitters, emitterIndex);\r\n promises.push(_this._loadEmitterAsync(extensionContext + \"/emitters/\" + emitter.index, emitter).then(function () {\r\n for (var _i = 0, _a = emitter._babylonSounds; _i < _a.length; _i++) {\r\n var sound = _a[_i];\r\n sound.attachToMesh(babylonMesh);\r\n if (emitter.innerAngle != undefined || emitter.outerAngle != undefined) {\r\n sound.setLocalDirectionToMesh(Vector3.Forward());\r\n sound.setDirectionalCone(2 * Tools.ToDegrees(emitter.innerAngle == undefined ? Math.PI : emitter.innerAngle), 2 * Tools.ToDegrees(emitter.outerAngle == undefined ? Math.PI : emitter.outerAngle), 0);\r\n }\r\n }\r\n }));\r\n };\r\n for (var _i = 0, _a = extension.emitters; _i < _a.length; _i++) {\r\n var emitterIndex = _a[_i];\r\n _loop_1(emitterIndex);\r\n }\r\n assign(babylonMesh);\r\n }).then(function (babylonMesh) {\r\n return Promise.all(promises).then(function () {\r\n return babylonMesh;\r\n });\r\n });\r\n });\r\n };\r\n /** @hidden */\r\n MSFT_audio_emitter.prototype.loadAnimationAsync = function (context, animation) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, animation, this.name, function (extensionContext, extension) {\r\n return _this._loader.loadAnimationAsync(context, animation).then(function (babylonAnimationGroup) {\r\n var promises = new Array();\r\n ArrayItem.Assign(extension.events);\r\n for (var _i = 0, _a = extension.events; _i < _a.length; _i++) {\r\n var event_1 = _a[_i];\r\n promises.push(_this._loadAnimationEventAsync(extensionContext + \"/events/\" + event_1.index, context, animation, event_1, babylonAnimationGroup));\r\n }\r\n return Promise.all(promises).then(function () {\r\n return babylonAnimationGroup;\r\n });\r\n });\r\n });\r\n };\r\n MSFT_audio_emitter.prototype._loadClipAsync = function (context, clip) {\r\n if (clip._objectURL) {\r\n return clip._objectURL;\r\n }\r\n var promise;\r\n if (clip.uri) {\r\n promise = this._loader.loadUriAsync(context, clip, clip.uri);\r\n }\r\n else {\r\n var bufferView = ArrayItem.Get(context + \"/bufferView\", this._loader.gltf.bufferViews, clip.bufferView);\r\n promise = this._loader.loadBufferViewAsync(\"/bufferViews/\" + bufferView.index, bufferView);\r\n }\r\n clip._objectURL = promise.then(function (data) {\r\n return URL.createObjectURL(new Blob([data], { type: clip.mimeType }));\r\n });\r\n return clip._objectURL;\r\n };\r\n MSFT_audio_emitter.prototype._loadEmitterAsync = function (context, emitter) {\r\n var _this = this;\r\n emitter._babylonSounds = emitter._babylonSounds || [];\r\n if (!emitter._babylonData) {\r\n var clipPromises = new Array();\r\n var name_1 = emitter.name || \"emitter\" + emitter.index;\r\n var options_1 = {\r\n loop: false,\r\n autoplay: false,\r\n volume: emitter.volume == undefined ? 1 : emitter.volume,\r\n };\r\n var _loop_2 = function (i) {\r\n var clipContext = \"/extensions/\" + this_1.name + \"/clips\";\r\n var clip = ArrayItem.Get(clipContext, this_1._clips, emitter.clips[i].clip);\r\n clipPromises.push(this_1._loadClipAsync(clipContext + \"/\" + emitter.clips[i].clip, clip).then(function (objectURL) {\r\n var sound = emitter._babylonSounds[i] = new Sound(name_1, objectURL, _this._loader.babylonScene, null, options_1);\r\n sound.refDistance = emitter.refDistance || 1;\r\n sound.maxDistance = emitter.maxDistance || 256;\r\n sound.rolloffFactor = emitter.rolloffFactor || 1;\r\n sound.distanceModel = emitter.distanceModel || 'exponential';\r\n sound._positionInEmitterSpace = true;\r\n }));\r\n };\r\n var this_1 = this;\r\n for (var i = 0; i < emitter.clips.length; i++) {\r\n _loop_2(i);\r\n }\r\n var promise = Promise.all(clipPromises).then(function () {\r\n var weights = emitter.clips.map(function (clip) { return clip.weight || 1; });\r\n var weightedSound = new WeightedSound(emitter.loop || false, emitter._babylonSounds, weights);\r\n if (emitter.innerAngle) {\r\n weightedSound.directionalConeInnerAngle = 2 * Tools.ToDegrees(emitter.innerAngle);\r\n }\r\n if (emitter.outerAngle) {\r\n weightedSound.directionalConeOuterAngle = 2 * Tools.ToDegrees(emitter.outerAngle);\r\n }\r\n if (emitter.volume) {\r\n weightedSound.volume = emitter.volume;\r\n }\r\n emitter._babylonData.sound = weightedSound;\r\n });\r\n emitter._babylonData = {\r\n loaded: promise\r\n };\r\n }\r\n return emitter._babylonData.loaded;\r\n };\r\n MSFT_audio_emitter.prototype._getEventAction = function (context, sound, action, time, startOffset) {\r\n switch (action) {\r\n case \"play\" /* play */: {\r\n return function (currentFrame) {\r\n var frameOffset = (startOffset || 0) + (currentFrame - time);\r\n sound.play(frameOffset);\r\n };\r\n }\r\n case \"stop\" /* stop */: {\r\n return function (currentFrame) {\r\n sound.stop();\r\n };\r\n }\r\n case \"pause\" /* pause */: {\r\n return function (currentFrame) {\r\n sound.pause();\r\n };\r\n }\r\n default: {\r\n throw new Error(context + \": Unsupported action \" + action);\r\n }\r\n }\r\n };\r\n MSFT_audio_emitter.prototype._loadAnimationEventAsync = function (context, animationContext, animation, event, babylonAnimationGroup) {\r\n var _this = this;\r\n if (babylonAnimationGroup.targetedAnimations.length == 0) {\r\n return Promise.resolve();\r\n }\r\n var babylonAnimation = babylonAnimationGroup.targetedAnimations[0];\r\n var emitterIndex = event.emitter;\r\n var emitter = ArrayItem.Get(\"/extensions/\" + this.name + \"/emitters\", this._emitters, emitterIndex);\r\n return this._loadEmitterAsync(context, emitter).then(function () {\r\n var sound = emitter._babylonData.sound;\r\n if (sound) {\r\n var babylonAnimationEvent = new AnimationEvent(event.time, _this._getEventAction(context, sound, event.action, event.time, event.startOffset));\r\n babylonAnimation.animation.addEvent(babylonAnimationEvent);\r\n // Make sure all started audio stops when this animation is terminated.\r\n babylonAnimationGroup.onAnimationGroupEndObservable.add(function () {\r\n sound.stop();\r\n });\r\n babylonAnimationGroup.onAnimationGroupPauseObservable.add(function () {\r\n sound.pause();\r\n });\r\n }\r\n });\r\n };\r\n return MSFT_audio_emitter;\r\n}());\r\nexport { MSFT_audio_emitter };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_audio_emitter(loader); });\r\n//# sourceMappingURL=MSFT_audio_emitter.js.map","import { Observable } from \"@babylonjs/core/Misc/observable\";\r\nimport { Deferred } from \"@babylonjs/core/Misc/deferred\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader\";\r\nvar NAME = \"MSFT_lod\";\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)\r\n */\r\nvar MSFT_lod = /** @class */ (function () {\r\n /** @hidden */\r\n function MSFT_lod(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines a number that determines the order the extensions are applied.\r\n */\r\n this.order = 100;\r\n /**\r\n * Maximum number of LODs to load, starting from the lowest LOD.\r\n */\r\n this.maxLODsToLoad = 10;\r\n /**\r\n * Observable raised when all node LODs of one level are loaded.\r\n * The event data is the index of the loaded LOD starting from zero.\r\n * Dispose the loader to cancel the loading of the next level of LODs.\r\n */\r\n this.onNodeLODsLoadedObservable = new Observable();\r\n /**\r\n * Observable raised when all material LODs of one level are loaded.\r\n * The event data is the index of the loaded LOD starting from zero.\r\n * Dispose the loader to cancel the loading of the next level of LODs.\r\n */\r\n this.onMaterialLODsLoadedObservable = new Observable();\r\n this._bufferLODs = new Array();\r\n this._nodeIndexLOD = null;\r\n this._nodeSignalLODs = new Array();\r\n this._nodePromiseLODs = new Array();\r\n this._nodeBufferLODs = new Array();\r\n this._materialIndexLOD = null;\r\n this._materialSignalLODs = new Array();\r\n this._materialPromiseLODs = new Array();\r\n this._materialBufferLODs = new Array();\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n /** @hidden */\r\n MSFT_lod.prototype.dispose = function () {\r\n this._loader = null;\r\n this._nodeIndexLOD = null;\r\n this._nodeSignalLODs.length = 0;\r\n this._nodePromiseLODs.length = 0;\r\n this._nodeBufferLODs.length = 0;\r\n this._materialIndexLOD = null;\r\n this._materialSignalLODs.length = 0;\r\n this._materialPromiseLODs.length = 0;\r\n this._materialBufferLODs.length = 0;\r\n this.onMaterialLODsLoadedObservable.clear();\r\n this.onNodeLODsLoadedObservable.clear();\r\n };\r\n /** @hidden */\r\n MSFT_lod.prototype.onReady = function () {\r\n var _this = this;\r\n var _loop_1 = function (indexLOD) {\r\n var promise = Promise.all(this_1._nodePromiseLODs[indexLOD]).then(function () {\r\n if (indexLOD !== 0) {\r\n _this._loader.endPerformanceCounter(\"Node LOD \" + indexLOD);\r\n _this._loader.log(\"Loaded node LOD \" + indexLOD);\r\n }\r\n _this.onNodeLODsLoadedObservable.notifyObservers(indexLOD);\r\n if (indexLOD !== _this._nodePromiseLODs.length - 1) {\r\n _this._loader.startPerformanceCounter(\"Node LOD \" + (indexLOD + 1));\r\n _this._loadBufferLOD(_this._nodeBufferLODs, indexLOD + 1);\r\n if (_this._nodeSignalLODs[indexLOD]) {\r\n _this._nodeSignalLODs[indexLOD].resolve();\r\n }\r\n }\r\n });\r\n this_1._loader._completePromises.push(promise);\r\n };\r\n var this_1 = this;\r\n for (var indexLOD = 0; indexLOD < this._nodePromiseLODs.length; indexLOD++) {\r\n _loop_1(indexLOD);\r\n }\r\n var _loop_2 = function (indexLOD) {\r\n var promise = Promise.all(this_2._materialPromiseLODs[indexLOD]).then(function () {\r\n if (indexLOD !== 0) {\r\n _this._loader.endPerformanceCounter(\"Material LOD \" + indexLOD);\r\n _this._loader.log(\"Loaded material LOD \" + indexLOD);\r\n }\r\n _this.onMaterialLODsLoadedObservable.notifyObservers(indexLOD);\r\n if (indexLOD !== _this._materialPromiseLODs.length - 1) {\r\n _this._loader.startPerformanceCounter(\"Material LOD \" + (indexLOD + 1));\r\n _this._loadBufferLOD(_this._materialBufferLODs, indexLOD + 1);\r\n if (_this._materialSignalLODs[indexLOD]) {\r\n _this._materialSignalLODs[indexLOD].resolve();\r\n }\r\n }\r\n });\r\n this_2._loader._completePromises.push(promise);\r\n };\r\n var this_2 = this;\r\n for (var indexLOD = 0; indexLOD < this._materialPromiseLODs.length; indexLOD++) {\r\n _loop_2(indexLOD);\r\n }\r\n };\r\n /** @hidden */\r\n MSFT_lod.prototype.loadSceneAsync = function (context, scene) {\r\n var promise = this._loader.loadSceneAsync(context, scene);\r\n this._loadBufferLOD(this._bufferLODs, 0);\r\n return promise;\r\n };\r\n /** @hidden */\r\n MSFT_lod.prototype.loadNodeAsync = function (context, node, assign) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtensionAsync(context, node, this.name, function (extensionContext, extension) {\r\n var firstPromise;\r\n var nodeLODs = _this._getLODs(extensionContext, node, _this._loader.gltf.nodes, extension.ids);\r\n _this._loader.logOpen(\"\" + extensionContext);\r\n var _loop_3 = function (indexLOD) {\r\n var nodeLOD = nodeLODs[indexLOD];\r\n if (indexLOD !== 0) {\r\n _this._nodeIndexLOD = indexLOD;\r\n _this._nodeSignalLODs[indexLOD] = _this._nodeSignalLODs[indexLOD] || new Deferred();\r\n }\r\n var assign_1 = function (babylonTransformNode) { babylonTransformNode.setEnabled(false); };\r\n var promise = _this._loader.loadNodeAsync(\"/nodes/\" + nodeLOD.index, nodeLOD, assign_1).then(function (babylonMesh) {\r\n if (indexLOD !== 0) {\r\n // TODO: should not rely on _babylonTransformNode\r\n var previousNodeLOD = nodeLODs[indexLOD - 1];\r\n if (previousNodeLOD._babylonTransformNode) {\r\n _this._disposeTransformNode(previousNodeLOD._babylonTransformNode);\r\n delete previousNodeLOD._babylonTransformNode;\r\n }\r\n }\r\n babylonMesh.setEnabled(true);\r\n return babylonMesh;\r\n });\r\n _this._nodePromiseLODs[indexLOD] = _this._nodePromiseLODs[indexLOD] || [];\r\n if (indexLOD === 0) {\r\n firstPromise = promise;\r\n }\r\n else {\r\n _this._nodeIndexLOD = null;\r\n _this._nodePromiseLODs[indexLOD].push(promise);\r\n }\r\n };\r\n for (var indexLOD = 0; indexLOD < nodeLODs.length; indexLOD++) {\r\n _loop_3(indexLOD);\r\n }\r\n _this._loader.logClose();\r\n return firstPromise;\r\n });\r\n };\r\n /** @hidden */\r\n MSFT_lod.prototype._loadMaterialAsync = function (context, material, babylonMesh, babylonDrawMode, assign) {\r\n var _this = this;\r\n // Don't load material LODs if already loading a node LOD.\r\n if (this._nodeIndexLOD) {\r\n return null;\r\n }\r\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, function (extensionContext, extension) {\r\n var firstPromise;\r\n var materialLODs = _this._getLODs(extensionContext, material, _this._loader.gltf.materials, extension.ids);\r\n _this._loader.logOpen(\"\" + extensionContext);\r\n var _loop_4 = function (indexLOD) {\r\n var materialLOD = materialLODs[indexLOD];\r\n if (indexLOD !== 0) {\r\n _this._materialIndexLOD = indexLOD;\r\n }\r\n var promise = _this._loader._loadMaterialAsync(\"/materials/\" + materialLOD.index, materialLOD, babylonMesh, babylonDrawMode, function (babylonMaterial) {\r\n if (indexLOD === 0) {\r\n assign(babylonMaterial);\r\n }\r\n }).then(function (babylonMaterial) {\r\n if (indexLOD !== 0) {\r\n assign(babylonMaterial);\r\n // TODO: should not rely on _data\r\n var previousDataLOD = materialLODs[indexLOD - 1]._data;\r\n if (previousDataLOD[babylonDrawMode]) {\r\n _this._disposeMaterials([previousDataLOD[babylonDrawMode].babylonMaterial]);\r\n delete previousDataLOD[babylonDrawMode];\r\n }\r\n }\r\n return babylonMaterial;\r\n });\r\n _this._materialPromiseLODs[indexLOD] = _this._materialPromiseLODs[indexLOD] || [];\r\n if (indexLOD === 0) {\r\n firstPromise = promise;\r\n }\r\n else {\r\n _this._materialIndexLOD = null;\r\n _this._materialPromiseLODs[indexLOD].push(promise);\r\n }\r\n };\r\n for (var indexLOD = 0; indexLOD < materialLODs.length; indexLOD++) {\r\n _loop_4(indexLOD);\r\n }\r\n _this._loader.logClose();\r\n return firstPromise;\r\n });\r\n };\r\n /** @hidden */\r\n MSFT_lod.prototype._loadUriAsync = function (context, property, uri) {\r\n var _this = this;\r\n // Defer the loading of uris if loading a node or material LOD.\r\n if (this._nodeIndexLOD !== null) {\r\n this._loader.log(\"deferred\");\r\n var previousIndexLOD = this._nodeIndexLOD - 1;\r\n this._nodeSignalLODs[previousIndexLOD] = this._nodeSignalLODs[previousIndexLOD] || new Deferred();\r\n return this._nodeSignalLODs[this._nodeIndexLOD - 1].promise.then(function () {\r\n return _this._loader.loadUriAsync(context, property, uri);\r\n });\r\n }\r\n else if (this._materialIndexLOD !== null) {\r\n this._loader.log(\"deferred\");\r\n var previousIndexLOD = this._materialIndexLOD - 1;\r\n this._materialSignalLODs[previousIndexLOD] = this._materialSignalLODs[previousIndexLOD] || new Deferred();\r\n return this._materialSignalLODs[previousIndexLOD].promise.then(function () {\r\n return _this._loader.loadUriAsync(context, property, uri);\r\n });\r\n }\r\n return null;\r\n };\r\n /** @hidden */\r\n MSFT_lod.prototype.loadBufferAsync = function (context, buffer, byteOffset, byteLength) {\r\n if (this._loader.parent.useRangeRequests && !buffer.uri) {\r\n if (!this._loader.bin) {\r\n throw new Error(context + \": Uri is missing or the binary glTF is missing its binary chunk\");\r\n }\r\n var loadAsync = function (bufferLODs, indexLOD) {\r\n var start = byteOffset;\r\n var end = start + byteLength - 1;\r\n var bufferLOD = bufferLODs[indexLOD];\r\n if (bufferLOD) {\r\n bufferLOD.start = Math.min(bufferLOD.start, start);\r\n bufferLOD.end = Math.max(bufferLOD.end, end);\r\n }\r\n else {\r\n bufferLOD = { start: start, end: end, loaded: new Deferred() };\r\n bufferLODs[indexLOD] = bufferLOD;\r\n }\r\n return bufferLOD.loaded.promise.then(function (data) {\r\n return new Uint8Array(data.buffer, data.byteOffset + byteOffset - bufferLOD.start, byteLength);\r\n });\r\n };\r\n this._loader.log(\"deferred\");\r\n if (this._nodeIndexLOD !== null) {\r\n return loadAsync(this._nodeBufferLODs, this._nodeIndexLOD);\r\n }\r\n else if (this._materialIndexLOD !== null) {\r\n return loadAsync(this._materialBufferLODs, this._materialIndexLOD);\r\n }\r\n else {\r\n return loadAsync(this._bufferLODs, 0);\r\n }\r\n }\r\n return null;\r\n };\r\n MSFT_lod.prototype._loadBufferLOD = function (bufferLODs, indexLOD) {\r\n var bufferLOD = bufferLODs[indexLOD];\r\n if (bufferLOD) {\r\n this._loader.log(\"Loading buffer range [\" + bufferLOD.start + \"-\" + bufferLOD.end + \"]\");\r\n this._loader.bin.readAsync(bufferLOD.start, bufferLOD.end - bufferLOD.start + 1).then(function (data) {\r\n bufferLOD.loaded.resolve(data);\r\n }, function (error) {\r\n bufferLOD.loaded.reject(error);\r\n });\r\n }\r\n };\r\n /**\r\n * Gets an array of LOD properties from lowest to highest.\r\n */\r\n MSFT_lod.prototype._getLODs = function (context, property, array, ids) {\r\n if (this.maxLODsToLoad <= 0) {\r\n throw new Error(\"maxLODsToLoad must be greater than zero\");\r\n }\r\n var properties = new Array();\r\n for (var i = ids.length - 1; i >= 0; i--) {\r\n properties.push(ArrayItem.Get(context + \"/ids/\" + ids[i], array, ids[i]));\r\n if (properties.length === this.maxLODsToLoad) {\r\n return properties;\r\n }\r\n }\r\n properties.push(property);\r\n return properties;\r\n };\r\n MSFT_lod.prototype._disposeTransformNode = function (babylonTransformNode) {\r\n var _this = this;\r\n var babylonMaterials = new Array();\r\n var babylonMaterial = babylonTransformNode.material;\r\n if (babylonMaterial) {\r\n babylonMaterials.push(babylonMaterial);\r\n }\r\n for (var _i = 0, _a = babylonTransformNode.getChildMeshes(); _i < _a.length; _i++) {\r\n var babylonMesh = _a[_i];\r\n if (babylonMesh.material) {\r\n babylonMaterials.push(babylonMesh.material);\r\n }\r\n }\r\n babylonTransformNode.dispose();\r\n var babylonMaterialsToDispose = babylonMaterials.filter(function (babylonMaterial) { return _this._loader.babylonScene.meshes.every(function (mesh) { return mesh.material != babylonMaterial; }); });\r\n this._disposeMaterials(babylonMaterialsToDispose);\r\n };\r\n MSFT_lod.prototype._disposeMaterials = function (babylonMaterials) {\r\n var babylonTextures = {};\r\n for (var _i = 0, babylonMaterials_1 = babylonMaterials; _i < babylonMaterials_1.length; _i++) {\r\n var babylonMaterial = babylonMaterials_1[_i];\r\n for (var _a = 0, _b = babylonMaterial.getActiveTextures(); _a < _b.length; _a++) {\r\n var babylonTexture = _b[_a];\r\n babylonTextures[babylonTexture.uniqueId] = babylonTexture;\r\n }\r\n babylonMaterial.dispose();\r\n }\r\n for (var uniqueId in babylonTextures) {\r\n for (var _c = 0, _d = this._loader.babylonScene.materials; _c < _d.length; _c++) {\r\n var babylonMaterial = _d[_c];\r\n if (babylonMaterial.hasTexture(babylonTextures[uniqueId])) {\r\n delete babylonTextures[uniqueId];\r\n }\r\n }\r\n }\r\n for (var uniqueId in babylonTextures) {\r\n babylonTextures[uniqueId].dispose();\r\n }\r\n };\r\n return MSFT_lod;\r\n}());\r\nexport { MSFT_lod };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_lod(loader); });\r\n//# sourceMappingURL=MSFT_lod.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"MSFT_minecraftMesh\";\r\n/** @hidden */\r\nvar MSFT_minecraftMesh = /** @class */ (function () {\r\n function MSFT_minecraftMesh(loader) {\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n MSFT_minecraftMesh.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n MSFT_minecraftMesh.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtraAsync(context, material, this.name, function (extraContext, extra) {\r\n if (extra) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(extraContext + \": Material type not supported\");\r\n }\r\n var promise = _this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);\r\n if (babylonMaterial.needAlphaBlending()) {\r\n babylonMaterial.forceDepthWrite = true;\r\n babylonMaterial.separateCullingPass = true;\r\n }\r\n babylonMaterial.backFaceCulling = babylonMaterial.forceDepthWrite;\r\n babylonMaterial.twoSidedLighting = true;\r\n return promise;\r\n }\r\n return null;\r\n });\r\n };\r\n return MSFT_minecraftMesh;\r\n}());\r\nexport { MSFT_minecraftMesh };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_minecraftMesh(loader); });\r\n//# sourceMappingURL=MSFT_minecraftMesh.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\r\nimport { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"MSFT_sRGBFactors\";\r\n/** @hidden */\r\nvar MSFT_sRGBFactors = /** @class */ (function () {\r\n function MSFT_sRGBFactors(loader) {\r\n this.name = NAME;\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n MSFT_sRGBFactors.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n MSFT_sRGBFactors.prototype.loadMaterialPropertiesAsync = function (context, material, babylonMaterial) {\r\n var _this = this;\r\n return GLTFLoader.LoadExtraAsync(context, material, this.name, function (extraContext, extra) {\r\n if (extra) {\r\n if (!(babylonMaterial instanceof PBRMaterial)) {\r\n throw new Error(extraContext + \": Material type not supported\");\r\n }\r\n var promise = _this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);\r\n if (!babylonMaterial.albedoTexture) {\r\n babylonMaterial.albedoColor.toLinearSpaceToRef(babylonMaterial.albedoColor);\r\n }\r\n if (!babylonMaterial.reflectivityTexture) {\r\n babylonMaterial.reflectivityColor.toLinearSpaceToRef(babylonMaterial.reflectivityColor);\r\n }\r\n return promise;\r\n }\r\n return null;\r\n });\r\n };\r\n return MSFT_sRGBFactors;\r\n}());\r\nexport { MSFT_sRGBFactors };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new MSFT_sRGBFactors(loader); });\r\n//# sourceMappingURL=MSFT_sRGBFactors.js.map","import { GLTFLoader } from \"../glTFLoader\";\r\nvar NAME = \"ExtrasAsMetadata\";\r\n/**\r\n * Store glTF extras (if present) in BJS objects' metadata\r\n */\r\nvar ExtrasAsMetadata = /** @class */ (function () {\r\n /** @hidden */\r\n function ExtrasAsMetadata(loader) {\r\n /**\r\n * The name of this extension.\r\n */\r\n this.name = NAME;\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n this.enabled = true;\r\n this._loader = loader;\r\n }\r\n ExtrasAsMetadata.prototype._assignExtras = function (babylonObject, gltfProp) {\r\n if (gltfProp.extras && Object.keys(gltfProp.extras).length > 0) {\r\n var metadata = (babylonObject.metadata = babylonObject.metadata || {});\r\n var gltf = (metadata.gltf = metadata.gltf || {});\r\n gltf.extras = gltfProp.extras;\r\n }\r\n };\r\n /** @hidden */\r\n ExtrasAsMetadata.prototype.dispose = function () {\r\n this._loader = null;\r\n };\r\n /** @hidden */\r\n ExtrasAsMetadata.prototype.loadNodeAsync = function (context, node, assign) {\r\n var _this = this;\r\n return this._loader.loadNodeAsync(context, node, function (babylonTransformNode) {\r\n _this._assignExtras(babylonTransformNode, node);\r\n assign(babylonTransformNode);\r\n });\r\n };\r\n /** @hidden */\r\n ExtrasAsMetadata.prototype.loadCameraAsync = function (context, camera, assign) {\r\n var _this = this;\r\n return this._loader.loadCameraAsync(context, camera, function (babylonCamera) {\r\n _this._assignExtras(babylonCamera, camera);\r\n assign(babylonCamera);\r\n });\r\n };\r\n /** @hidden */\r\n ExtrasAsMetadata.prototype.createMaterial = function (context, material, babylonDrawMode) {\r\n var babylonMaterial = this._loader.createMaterial(context, material, babylonDrawMode);\r\n this._assignExtras(babylonMaterial, material);\r\n return babylonMaterial;\r\n };\r\n return ExtrasAsMetadata;\r\n}());\r\nexport { ExtrasAsMetadata };\r\nGLTFLoader.RegisterExtension(NAME, function (loader) { return new ExtrasAsMetadata(loader); });\r\n//# sourceMappingURL=ExtrasAsMetadata.js.map","module.exports = require('./lib/axios');","'use strict';\n\nvar utils = require('./../utils');\nvar settle = require('./../core/settle');\nvar cookies = require('./../helpers/cookies');\nvar buildURL = require('./../helpers/buildURL');\nvar buildFullPath = require('../core/buildFullPath');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar createError = require('../core/createError');\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n var responseType = config.responseType;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n var fullPath = buildFullPath(config.baseURL, config.url);\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(createError(\n timeoutErrorMessage,\n config,\n config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = config.responseType;\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (!requestData) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n","'use strict';\n\nvar utils = require('./utils');\nvar bind = require('./helpers/bind');\nvar Axios = require('./core/Axios');\nvar mergeConfig = require('./core/mergeConfig');\nvar defaults = require('./defaults');\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = require('./cancel/Cancel');\naxios.CancelToken = require('./cancel/CancelToken');\naxios.isCancel = require('./cancel/isCancel');\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\n// Expose isAxiosError\naxios.isAxiosError = require('./helpers/isAxiosError');\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n","'use strict';\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n","'use strict';\n\nvar Cancel = require('./Cancel');\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n","'use strict';\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n","'use strict';\n\nvar utils = require('./../utils');\nvar buildURL = require('../helpers/buildURL');\nvar InterceptorManager = require('./InterceptorManager');\nvar dispatchRequest = require('./dispatchRequest');\nvar mergeConfig = require('./mergeConfig');\nvar validator = require('../helpers/validator');\n\nvar validators = validator.validators;\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n // Set config.method\n if (config.method) {\n config.method = config.method.toLowerCase();\n } else if (this.defaults.method) {\n config.method = this.defaults.method.toLowerCase();\n } else {\n config.method = 'get';\n }\n\n var transitional = config.transitional;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean, '1.0.0'),\n forcedJSONParsing: validators.transitional(validators.boolean, '1.0.0'),\n clarifyTimeoutError: validators.transitional(validators.boolean, '1.0.0')\n }, false);\n }\n\n // filter out skipped interceptors\n var requestInterceptorChain = [];\n var synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n var responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n var promise;\n\n if (!synchronousRequestInterceptors) {\n var chain = [dispatchRequest, undefined];\n\n Array.prototype.unshift.apply(chain, requestInterceptorChain);\n chain.concat(responseInterceptorChain);\n\n promise = Promise.resolve(config);\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n }\n\n\n var newConfig = config;\n while (requestInterceptorChain.length) {\n var onFulfilled = requestInterceptorChain.shift();\n var onRejected = requestInterceptorChain.shift();\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected(error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest(newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n while (responseInterceptorChain.length) {\n promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n","'use strict';\n\nvar isAbsoluteURL = require('../helpers/isAbsoluteURL');\nvar combineURLs = require('../helpers/combineURLs');\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n * @returns {string} The combined full path\n */\nmodule.exports = function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n};\n","'use strict';\n\nvar enhanceError = require('./enhanceError');\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n","'use strict';\n\nvar utils = require('./../utils');\nvar transformData = require('./transformData');\nvar isCancel = require('../cancel/isCancel');\nvar defaults = require('../defaults');\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n","'use strict';\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n","'use strict';\n\nvar utils = require('../utils');\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n var valueFromConfig2Keys = ['url', 'method', 'data'];\n var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];\n var defaultToConfig2Keys = [\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',\n 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',\n 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'\n ];\n var directMergeKeys = ['validateStatus'];\n\n function getMergedValue(target, source) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge(target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n function mergeDeepProperties(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n }\n\n utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n }\n });\n\n utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);\n\n utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n utils.forEach(directMergeKeys, function merge(prop) {\n if (prop in config2) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (prop in config1) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n var axiosKeys = valueFromConfig2Keys\n .concat(mergeDeepPropertiesKeys)\n .concat(defaultToConfig2Keys)\n .concat(directMergeKeys);\n\n var otherKeys = Object\n .keys(config1)\n .concat(Object.keys(config2))\n .filter(function filterAxiosKeys(key) {\n return axiosKeys.indexOf(key) === -1;\n });\n\n utils.forEach(otherKeys, mergeDeepProperties);\n\n return config;\n};\n","'use strict';\n\nvar createError = require('./createError');\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n","'use strict';\n\nvar utils = require('./../utils');\nvar defaults = require('./../defaults');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n var context = this || defaults;\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn.call(context, data, headers);\n });\n\n return data;\n};\n","'use strict';\n\nvar utils = require('./utils');\nvar normalizeHeaderName = require('./helpers/normalizeHeaderName');\nvar enhanceError = require('./core/enhanceError');\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('./adapters/xhr');\n } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = require('./adapters/http');\n }\n return adapter;\n}\n\nvar defaults = {\n\n transitional: {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n },\n\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {\n setContentTypeIfUnset(headers, 'application/json');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n var transitional = this.transitional;\n var silentJSONParsing = transitional && transitional.silentJSONParsing;\n var forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';\n\n if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw enhanceError(e, this, 'E_JSON_PARSE');\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n","'use strict';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nmodule.exports = function isAxiosError(payload) {\n return (typeof payload === 'object') && (payload.isAxiosError === true);\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n","'use strict';\n\nvar utils = require('../utils');\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n","'use strict';\n\nvar pkg = require('./../../package.json');\n\nvar validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nvar deprecatedWarnings = {};\nvar currentVerArr = pkg.version.split('.');\n\n/**\n * Compare package versions\n * @param {string} version\n * @param {string?} thanVersion\n * @returns {boolean}\n */\nfunction isOlderVersion(version, thanVersion) {\n var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr;\n var destVer = version.split('.');\n for (var i = 0; i < 3; i++) {\n if (pkgVersionArr[i] > destVer[i]) {\n return true;\n } else if (pkgVersionArr[i] < destVer[i]) {\n return false;\n }\n }\n return false;\n}\n\n/**\n * Transitional option validator\n * @param {function|boolean?} validator\n * @param {string?} version\n * @param {string} message\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n var isDeprecated = version && isOlderVersion(version);\n\n function formatMessage(opt, desc) {\n return '[Axios v' + pkg.version + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return function(value, opt, opts) {\n if (validator === false) {\n throw new Error(formatMessage(opt, ' has been removed in ' + version));\n }\n\n if (isDeprecated && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new TypeError('options must be an object');\n }\n var keys = Object.keys(options);\n var i = keys.length;\n while (i-- > 0) {\n var opt = keys[i];\n var validator = schema[opt];\n if (validator) {\n var value = options[opt];\n var result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new TypeError('option ' + opt + ' must be ' + result);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw Error('Unknown option ' + opt);\n }\n }\n}\n\nmodule.exports = {\n isOlderVersion: isOlderVersion,\n assertOptions: assertOptions,\n validators: validators\n};\n","'use strict';\n\nvar bind = require('./helpers/bind');\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return (typeof FormData !== 'undefined') && (val instanceof FormData);\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {Object} val The value to test\n * @return {boolean} True if value is a plain Object, otherwise false\n */\nfunction isPlainObject(val) {\n if (toString.call(val) !== '[object Object]') {\n return false;\n }\n\n var prototype = Object.getPrototypeOf(val);\n return prototype === null || prototype === Object.prototype;\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Determine if a value is a Function\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nfunction isFunction(val) {\n return toString.call(val) === '[object Function]';\n}\n\n/**\n * Determine if a value is a Stream\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nfunction isStream(val) {\n return isObject(val) && isFunction(val.pipe);\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nfunction isURLSearchParams(val) {\n return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.trim ? str.trim() : str.replace(/^\\s+|\\s+$/g, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (isPlainObject(result[key]) && isPlainObject(val)) {\n result[key] = merge(result[key], val);\n } else if (isPlainObject(val)) {\n result[key] = merge({}, val);\n } else if (isArray(val)) {\n result[key] = val.slice();\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n * @return {string} content value without BOM\n */\nfunction stripBOM(content) {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isPlainObject: isPlainObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n extend: extend,\n trim: trim,\n stripBOM: stripBOM\n};\n","/**\n * chroma.js - JavaScript library for color conversions\n *\n * Copyright (c) 2011-2019, Gregor Aisch\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * 3. The name Gregor Aisch may not be used to endorse or promote products\n * derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * -------------------------------------------------------\n *\n * chroma.js includes colors from colorbrewer2.org, which are released under\n * the following license:\n *\n * Copyright (c) 2002 Cynthia Brewer, Mark Harrower,\n * and The Pennsylvania State University.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n * either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n *\n * ------------------------------------------------------\n *\n * Named colors are taken from X11 Color Names.\n * http://www.w3.org/TR/css3-color/#svg-color\n *\n * @preserve\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.chroma = factory());\n}(this, (function () { 'use strict';\n\n var limit = function (x, min, max) {\n if ( min === void 0 ) min=0;\n if ( max === void 0 ) max=1;\n\n return x < min ? min : x > max ? max : x;\n };\n\n var clip_rgb = function (rgb) {\n rgb._clipped = false;\n rgb._unclipped = rgb.slice(0);\n for (var i=0; i<=3; i++) {\n if (i < 3) {\n if (rgb[i] < 0 || rgb[i] > 255) { rgb._clipped = true; }\n rgb[i] = limit(rgb[i], 0, 255);\n } else if (i === 3) {\n rgb[i] = limit(rgb[i], 0, 1);\n }\n }\n return rgb;\n };\n\n // ported from jQuery's $.type\n var classToType = {};\n for (var i = 0, list = ['Boolean', 'Number', 'String', 'Function', 'Array', 'Date', 'RegExp', 'Undefined', 'Null']; i < list.length; i += 1) {\n var name = list[i];\n\n classToType[(\"[object \" + name + \"]\")] = name.toLowerCase();\n }\n var type = function(obj) {\n return classToType[Object.prototype.toString.call(obj)] || \"object\";\n };\n\n var unpack = function (args, keyOrder) {\n if ( keyOrder === void 0 ) keyOrder=null;\n\n \t// if called with more than 3 arguments, we return the arguments\n if (args.length >= 3) { return Array.prototype.slice.call(args); }\n // with less than 3 args we check if first arg is object\n // and use the keyOrder string to extract and sort properties\n \tif (type(args[0]) == 'object' && keyOrder) {\n \t\treturn keyOrder.split('')\n \t\t\t.filter(function (k) { return args[0][k] !== undefined; })\n \t\t\t.map(function (k) { return args[0][k]; });\n \t}\n \t// otherwise we just return the first argument\n \t// (which we suppose is an array of args)\n return args[0];\n };\n\n var last = function (args) {\n if (args.length < 2) { return null; }\n var l = args.length-1;\n if (type(args[l]) == 'string') { return args[l].toLowerCase(); }\n return null;\n };\n\n var PI = Math.PI;\n\n var utils = {\n \tclip_rgb: clip_rgb,\n \tlimit: limit,\n \ttype: type,\n \tunpack: unpack,\n \tlast: last,\n \tPI: PI,\n \tTWOPI: PI*2,\n \tPITHIRD: PI/3,\n \tDEG2RAD: PI / 180,\n \tRAD2DEG: 180 / PI\n };\n\n var input = {\n \tformat: {},\n \tautodetect: []\n };\n\n var last$1 = utils.last;\n var clip_rgb$1 = utils.clip_rgb;\n var type$1 = utils.type;\n\n\n var Color = function Color() {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var me = this;\n if (type$1(args[0]) === 'object' &&\n args[0].constructor &&\n args[0].constructor === this.constructor) {\n // the argument is already a Color instance\n return args[0];\n }\n\n // last argument could be the mode\n var mode = last$1(args);\n var autodetect = false;\n\n if (!mode) {\n autodetect = true;\n if (!input.sorted) {\n input.autodetect = input.autodetect.sort(function (a,b) { return b.p - a.p; });\n input.sorted = true;\n }\n // auto-detect format\n for (var i = 0, list = input.autodetect; i < list.length; i += 1) {\n var chk = list[i];\n\n mode = chk.test.apply(chk, args);\n if (mode) { break; }\n }\n }\n\n if (input.format[mode]) {\n var rgb = input.format[mode].apply(null, autodetect ? args : args.slice(0,-1));\n me._rgb = clip_rgb$1(rgb);\n } else {\n throw new Error('unknown format: '+args);\n }\n\n // add alpha channel\n if (me._rgb.length === 3) { me._rgb.push(1); }\n };\n\n Color.prototype.toString = function toString () {\n if (type$1(this.hex) == 'function') { return this.hex(); }\n return (\"[\" + (this._rgb.join(',')) + \"]\");\n };\n\n var Color_1 = Color;\n\n var chroma = function () {\n \tvar args = [], len = arguments.length;\n \twhile ( len-- ) args[ len ] = arguments[ len ];\n\n \treturn new (Function.prototype.bind.apply( chroma.Color, [ null ].concat( args) ));\n };\n\n chroma.Color = Color_1;\n chroma.version = '2.1.0';\n\n var chroma_1 = chroma;\n\n var unpack$1 = utils.unpack;\n var max = Math.max;\n\n var rgb2cmyk = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var ref = unpack$1(args, 'rgb');\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n r = r / 255;\n g = g / 255;\n b = b / 255;\n var k = 1 - max(r,max(g,b));\n var f = k < 1 ? 1 / (1-k) : 0;\n var c = (1-r-k) * f;\n var m = (1-g-k) * f;\n var y = (1-b-k) * f;\n return [c,m,y,k];\n };\n\n var rgb2cmyk_1 = rgb2cmyk;\n\n var unpack$2 = utils.unpack;\n\n var cmyk2rgb = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$2(args, 'cmyk');\n var c = args[0];\n var m = args[1];\n var y = args[2];\n var k = args[3];\n var alpha = args.length > 4 ? args[4] : 1;\n if (k === 1) { return [0,0,0,alpha]; }\n return [\n c >= 1 ? 0 : 255 * (1-c) * (1-k), // r\n m >= 1 ? 0 : 255 * (1-m) * (1-k), // g\n y >= 1 ? 0 : 255 * (1-y) * (1-k), // b\n alpha\n ];\n };\n\n var cmyk2rgb_1 = cmyk2rgb;\n\n var unpack$3 = utils.unpack;\n var type$2 = utils.type;\n\n\n\n Color_1.prototype.cmyk = function() {\n return rgb2cmyk_1(this._rgb);\n };\n\n chroma_1.cmyk = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['cmyk']) ));\n };\n\n input.format.cmyk = cmyk2rgb_1;\n\n input.autodetect.push({\n p: 2,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$3(args, 'cmyk');\n if (type$2(args) === 'array' && args.length === 4) {\n return 'cmyk';\n }\n }\n });\n\n var unpack$4 = utils.unpack;\n var last$2 = utils.last;\n var rnd = function (a) { return Math.round(a*100)/100; };\n\n /*\n * supported arguments:\n * - hsl2css(h,s,l)\n * - hsl2css(h,s,l,a)\n * - hsl2css([h,s,l], mode)\n * - hsl2css([h,s,l,a], mode)\n * - hsl2css({h,s,l,a}, mode)\n */\n var hsl2css = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var hsla = unpack$4(args, 'hsla');\n var mode = last$2(args) || 'lsa';\n hsla[0] = rnd(hsla[0] || 0);\n hsla[1] = rnd(hsla[1]*100) + '%';\n hsla[2] = rnd(hsla[2]*100) + '%';\n if (mode === 'hsla' || (hsla.length > 3 && hsla[3]<1)) {\n hsla[3] = hsla.length > 3 ? hsla[3] : 1;\n mode = 'hsla';\n } else {\n hsla.length = 3;\n }\n return (mode + \"(\" + (hsla.join(',')) + \")\");\n };\n\n var hsl2css_1 = hsl2css;\n\n var unpack$5 = utils.unpack;\n\n /*\n * supported arguments:\n * - rgb2hsl(r,g,b)\n * - rgb2hsl(r,g,b,a)\n * - rgb2hsl([r,g,b])\n * - rgb2hsl([r,g,b,a])\n * - rgb2hsl({r,g,b,a})\n */\n var rgb2hsl = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$5(args, 'rgba');\n var r = args[0];\n var g = args[1];\n var b = args[2];\n\n r /= 255;\n g /= 255;\n b /= 255;\n\n var min = Math.min(r, g, b);\n var max = Math.max(r, g, b);\n\n var l = (max + min) / 2;\n var s, h;\n\n if (max === min){\n s = 0;\n h = Number.NaN;\n } else {\n s = l < 0.5 ? (max - min) / (max + min) : (max - min) / (2 - max - min);\n }\n\n if (r == max) { h = (g - b) / (max - min); }\n else if (g == max) { h = 2 + (b - r) / (max - min); }\n else if (b == max) { h = 4 + (r - g) / (max - min); }\n\n h *= 60;\n if (h < 0) { h += 360; }\n if (args.length>3 && args[3]!==undefined) { return [h,s,l,args[3]]; }\n return [h,s,l];\n };\n\n var rgb2hsl_1 = rgb2hsl;\n\n var unpack$6 = utils.unpack;\n var last$3 = utils.last;\n\n\n var round = Math.round;\n\n /*\n * supported arguments:\n * - rgb2css(r,g,b)\n * - rgb2css(r,g,b,a)\n * - rgb2css([r,g,b], mode)\n * - rgb2css([r,g,b,a], mode)\n * - rgb2css({r,g,b,a}, mode)\n */\n var rgb2css = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var rgba = unpack$6(args, 'rgba');\n var mode = last$3(args) || 'rgb';\n if (mode.substr(0,3) == 'hsl') {\n return hsl2css_1(rgb2hsl_1(rgba), mode);\n }\n rgba[0] = round(rgba[0]);\n rgba[1] = round(rgba[1]);\n rgba[2] = round(rgba[2]);\n if (mode === 'rgba' || (rgba.length > 3 && rgba[3]<1)) {\n rgba[3] = rgba.length > 3 ? rgba[3] : 1;\n mode = 'rgba';\n }\n return (mode + \"(\" + (rgba.slice(0,mode==='rgb'?3:4).join(',')) + \")\");\n };\n\n var rgb2css_1 = rgb2css;\n\n var unpack$7 = utils.unpack;\n var round$1 = Math.round;\n\n var hsl2rgb = function () {\n var assign;\n\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n args = unpack$7(args, 'hsl');\n var h = args[0];\n var s = args[1];\n var l = args[2];\n var r,g,b;\n if (s === 0) {\n r = g = b = l*255;\n } else {\n var t3 = [0,0,0];\n var c = [0,0,0];\n var t2 = l < 0.5 ? l * (1+s) : l+s-l*s;\n var t1 = 2 * l - t2;\n var h_ = h / 360;\n t3[0] = h_ + 1/3;\n t3[1] = h_;\n t3[2] = h_ - 1/3;\n for (var i=0; i<3; i++) {\n if (t3[i] < 0) { t3[i] += 1; }\n if (t3[i] > 1) { t3[i] -= 1; }\n if (6 * t3[i] < 1)\n { c[i] = t1 + (t2 - t1) * 6 * t3[i]; }\n else if (2 * t3[i] < 1)\n { c[i] = t2; }\n else if (3 * t3[i] < 2)\n { c[i] = t1 + (t2 - t1) * ((2 / 3) - t3[i]) * 6; }\n else\n { c[i] = t1; }\n }\n (assign = [round$1(c[0]*255),round$1(c[1]*255),round$1(c[2]*255)], r = assign[0], g = assign[1], b = assign[2]);\n }\n if (args.length > 3) {\n // keep alpha channel\n return [r,g,b,args[3]];\n }\n return [r,g,b,1];\n };\n\n var hsl2rgb_1 = hsl2rgb;\n\n var RE_RGB = /^rgb\\(\\s*(-?\\d+),\\s*(-?\\d+)\\s*,\\s*(-?\\d+)\\s*\\)$/;\n var RE_RGBA = /^rgba\\(\\s*(-?\\d+),\\s*(-?\\d+)\\s*,\\s*(-?\\d+)\\s*,\\s*([01]|[01]?\\.\\d+)\\)$/;\n var RE_RGB_PCT = /^rgb\\(\\s*(-?\\d+(?:\\.\\d+)?)%,\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*(-?\\d+(?:\\.\\d+)?)%\\s*\\)$/;\n var RE_RGBA_PCT = /^rgba\\(\\s*(-?\\d+(?:\\.\\d+)?)%,\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*([01]|[01]?\\.\\d+)\\)$/;\n var RE_HSL = /^hsl\\(\\s*(-?\\d+(?:\\.\\d+)?),\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*(-?\\d+(?:\\.\\d+)?)%\\s*\\)$/;\n var RE_HSLA = /^hsla\\(\\s*(-?\\d+(?:\\.\\d+)?),\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*(-?\\d+(?:\\.\\d+)?)%\\s*,\\s*([01]|[01]?\\.\\d+)\\)$/;\n\n var round$2 = Math.round;\n\n var css2rgb = function (css) {\n css = css.toLowerCase().trim();\n var m;\n\n if (input.format.named) {\n try {\n return input.format.named(css);\n } catch (e) {\n // eslint-disable-next-line\n }\n }\n\n // rgb(250,20,0)\n if ((m = css.match(RE_RGB))) {\n var rgb = m.slice(1,4);\n for (var i=0; i<3; i++) {\n rgb[i] = +rgb[i];\n }\n rgb[3] = 1; // default alpha\n return rgb;\n }\n\n // rgba(250,20,0,0.4)\n if ((m = css.match(RE_RGBA))) {\n var rgb$1 = m.slice(1,5);\n for (var i$1=0; i$1<4; i$1++) {\n rgb$1[i$1] = +rgb$1[i$1];\n }\n return rgb$1;\n }\n\n // rgb(100%,0%,0%)\n if ((m = css.match(RE_RGB_PCT))) {\n var rgb$2 = m.slice(1,4);\n for (var i$2=0; i$2<3; i$2++) {\n rgb$2[i$2] = round$2(rgb$2[i$2] * 2.55);\n }\n rgb$2[3] = 1; // default alpha\n return rgb$2;\n }\n\n // rgba(100%,0%,0%,0.4)\n if ((m = css.match(RE_RGBA_PCT))) {\n var rgb$3 = m.slice(1,5);\n for (var i$3=0; i$3<3; i$3++) {\n rgb$3[i$3] = round$2(rgb$3[i$3] * 2.55);\n }\n rgb$3[3] = +rgb$3[3];\n return rgb$3;\n }\n\n // hsl(0,100%,50%)\n if ((m = css.match(RE_HSL))) {\n var hsl = m.slice(1,4);\n hsl[1] *= 0.01;\n hsl[2] *= 0.01;\n var rgb$4 = hsl2rgb_1(hsl);\n rgb$4[3] = 1;\n return rgb$4;\n }\n\n // hsla(0,100%,50%,0.5)\n if ((m = css.match(RE_HSLA))) {\n var hsl$1 = m.slice(1,4);\n hsl$1[1] *= 0.01;\n hsl$1[2] *= 0.01;\n var rgb$5 = hsl2rgb_1(hsl$1);\n rgb$5[3] = +m[4]; // default alpha = 1\n return rgb$5;\n }\n };\n\n css2rgb.test = function (s) {\n return RE_RGB.test(s) ||\n RE_RGBA.test(s) ||\n RE_RGB_PCT.test(s) ||\n RE_RGBA_PCT.test(s) ||\n RE_HSL.test(s) ||\n RE_HSLA.test(s);\n };\n\n var css2rgb_1 = css2rgb;\n\n var type$3 = utils.type;\n\n\n\n\n Color_1.prototype.css = function(mode) {\n return rgb2css_1(this._rgb, mode);\n };\n\n chroma_1.css = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['css']) ));\n };\n\n input.format.css = css2rgb_1;\n\n input.autodetect.push({\n p: 5,\n test: function (h) {\n var rest = [], len = arguments.length - 1;\n while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];\n\n if (!rest.length && type$3(h) === 'string' && css2rgb_1.test(h)) {\n return 'css';\n }\n }\n });\n\n var unpack$8 = utils.unpack;\n\n input.format.gl = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var rgb = unpack$8(args, 'rgba');\n rgb[0] *= 255;\n rgb[1] *= 255;\n rgb[2] *= 255;\n return rgb;\n };\n\n chroma_1.gl = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['gl']) ));\n };\n\n Color_1.prototype.gl = function() {\n var rgb = this._rgb;\n return [rgb[0]/255, rgb[1]/255, rgb[2]/255, rgb[3]];\n };\n\n var unpack$9 = utils.unpack;\n\n var rgb2hcg = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var ref = unpack$9(args, 'rgb');\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n var min = Math.min(r, g, b);\n var max = Math.max(r, g, b);\n var delta = max - min;\n var c = delta * 100 / 255;\n var _g = min / (255 - delta) * 100;\n var h;\n if (delta === 0) {\n h = Number.NaN;\n } else {\n if (r === max) { h = (g - b) / delta; }\n if (g === max) { h = 2+(b - r) / delta; }\n if (b === max) { h = 4+(r - g) / delta; }\n h *= 60;\n if (h < 0) { h += 360; }\n }\n return [h, c, _g];\n };\n\n var rgb2hcg_1 = rgb2hcg;\n\n var unpack$a = utils.unpack;\n var floor = Math.floor;\n\n /*\n * this is basically just HSV with some minor tweaks\n *\n * hue.. [0..360]\n * chroma .. [0..1]\n * grayness .. [0..1]\n */\n\n var hcg2rgb = function () {\n var assign, assign$1, assign$2, assign$3, assign$4, assign$5;\n\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n args = unpack$a(args, 'hcg');\n var h = args[0];\n var c = args[1];\n var _g = args[2];\n var r,g,b;\n _g = _g * 255;\n var _c = c * 255;\n if (c === 0) {\n r = g = b = _g;\n } else {\n if (h === 360) { h = 0; }\n if (h > 360) { h -= 360; }\n if (h < 0) { h += 360; }\n h /= 60;\n var i = floor(h);\n var f = h - i;\n var p = _g * (1 - c);\n var q = p + _c * (1 - f);\n var t = p + _c * f;\n var v = p + _c;\n switch (i) {\n case 0: (assign = [v, t, p], r = assign[0], g = assign[1], b = assign[2]); break\n case 1: (assign$1 = [q, v, p], r = assign$1[0], g = assign$1[1], b = assign$1[2]); break\n case 2: (assign$2 = [p, v, t], r = assign$2[0], g = assign$2[1], b = assign$2[2]); break\n case 3: (assign$3 = [p, q, v], r = assign$3[0], g = assign$3[1], b = assign$3[2]); break\n case 4: (assign$4 = [t, p, v], r = assign$4[0], g = assign$4[1], b = assign$4[2]); break\n case 5: (assign$5 = [v, p, q], r = assign$5[0], g = assign$5[1], b = assign$5[2]); break\n }\n }\n return [r, g, b, args.length > 3 ? args[3] : 1];\n };\n\n var hcg2rgb_1 = hcg2rgb;\n\n var unpack$b = utils.unpack;\n var type$4 = utils.type;\n\n\n\n\n\n\n Color_1.prototype.hcg = function() {\n return rgb2hcg_1(this._rgb);\n };\n\n chroma_1.hcg = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hcg']) ));\n };\n\n input.format.hcg = hcg2rgb_1;\n\n input.autodetect.push({\n p: 1,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$b(args, 'hcg');\n if (type$4(args) === 'array' && args.length === 3) {\n return 'hcg';\n }\n }\n });\n\n var unpack$c = utils.unpack;\n var last$4 = utils.last;\n var round$3 = Math.round;\n\n var rgb2hex = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var ref = unpack$c(args, 'rgba');\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n var a = ref[3];\n var mode = last$4(args) || 'auto';\n if (a === undefined) { a = 1; }\n if (mode === 'auto') {\n mode = a < 1 ? 'rgba' : 'rgb';\n }\n r = round$3(r);\n g = round$3(g);\n b = round$3(b);\n var u = r << 16 | g << 8 | b;\n var str = \"000000\" + u.toString(16); //#.toUpperCase();\n str = str.substr(str.length - 6);\n var hxa = '0' + round$3(a * 255).toString(16);\n hxa = hxa.substr(hxa.length - 2);\n switch (mode.toLowerCase()) {\n case 'rgba': return (\"#\" + str + hxa);\n case 'argb': return (\"#\" + hxa + str);\n default: return (\"#\" + str);\n }\n };\n\n var rgb2hex_1 = rgb2hex;\n\n var RE_HEX = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;\n var RE_HEXA = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/;\n\n var hex2rgb = function (hex) {\n if (hex.match(RE_HEX)) {\n // remove optional leading #\n if (hex.length === 4 || hex.length === 7) {\n hex = hex.substr(1);\n }\n // expand short-notation to full six-digit\n if (hex.length === 3) {\n hex = hex.split('');\n hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];\n }\n var u = parseInt(hex, 16);\n var r = u >> 16;\n var g = u >> 8 & 0xFF;\n var b = u & 0xFF;\n return [r,g,b,1];\n }\n\n // match rgba hex format, eg #FF000077\n if (hex.match(RE_HEXA)) {\n if (hex.length === 5 || hex.length === 9) {\n // remove optional leading #\n hex = hex.substr(1);\n }\n // expand short-notation to full eight-digit\n if (hex.length === 4) {\n hex = hex.split('');\n hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]+hex[3]+hex[3];\n }\n var u$1 = parseInt(hex, 16);\n var r$1 = u$1 >> 24 & 0xFF;\n var g$1 = u$1 >> 16 & 0xFF;\n var b$1 = u$1 >> 8 & 0xFF;\n var a = Math.round((u$1 & 0xFF) / 0xFF * 100) / 100;\n return [r$1,g$1,b$1,a];\n }\n\n // we used to check for css colors here\n // if _input.css? and rgb = _input.css hex\n // return rgb\n\n throw new Error((\"unknown hex color: \" + hex));\n };\n\n var hex2rgb_1 = hex2rgb;\n\n var type$5 = utils.type;\n\n\n\n\n Color_1.prototype.hex = function(mode) {\n return rgb2hex_1(this._rgb, mode);\n };\n\n chroma_1.hex = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hex']) ));\n };\n\n input.format.hex = hex2rgb_1;\n input.autodetect.push({\n p: 4,\n test: function (h) {\n var rest = [], len = arguments.length - 1;\n while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];\n\n if (!rest.length && type$5(h) === 'string' && [3,4,5,6,7,8,9].indexOf(h.length) >= 0) {\n return 'hex';\n }\n }\n });\n\n var unpack$d = utils.unpack;\n var TWOPI = utils.TWOPI;\n var min = Math.min;\n var sqrt = Math.sqrt;\n var acos = Math.acos;\n\n var rgb2hsi = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n /*\n borrowed from here:\n http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/rgb2hsi.cpp\n */\n var ref = unpack$d(args, 'rgb');\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n r /= 255;\n g /= 255;\n b /= 255;\n var h;\n var min_ = min(r,g,b);\n var i = (r+g+b) / 3;\n var s = i > 0 ? 1 - min_/i : 0;\n if (s === 0) {\n h = NaN;\n } else {\n h = ((r-g)+(r-b)) / 2;\n h /= sqrt((r-g)*(r-g) + (r-b)*(g-b));\n h = acos(h);\n if (b > g) {\n h = TWOPI - h;\n }\n h /= TWOPI;\n }\n return [h*360,s,i];\n };\n\n var rgb2hsi_1 = rgb2hsi;\n\n var unpack$e = utils.unpack;\n var limit$1 = utils.limit;\n var TWOPI$1 = utils.TWOPI;\n var PITHIRD = utils.PITHIRD;\n var cos = Math.cos;\n\n /*\n * hue [0..360]\n * saturation [0..1]\n * intensity [0..1]\n */\n var hsi2rgb = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n /*\n borrowed from here:\n http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/hsi2rgb.cpp\n */\n args = unpack$e(args, 'hsi');\n var h = args[0];\n var s = args[1];\n var i = args[2];\n var r,g,b;\n\n if (isNaN(h)) { h = 0; }\n if (isNaN(s)) { s = 0; }\n // normalize hue\n if (h > 360) { h -= 360; }\n if (h < 0) { h += 360; }\n h /= 360;\n if (h < 1/3) {\n b = (1-s)/3;\n r = (1+s*cos(TWOPI$1*h)/cos(PITHIRD-TWOPI$1*h))/3;\n g = 1 - (b+r);\n } else if (h < 2/3) {\n h -= 1/3;\n r = (1-s)/3;\n g = (1+s*cos(TWOPI$1*h)/cos(PITHIRD-TWOPI$1*h))/3;\n b = 1 - (r+g);\n } else {\n h -= 2/3;\n g = (1-s)/3;\n b = (1+s*cos(TWOPI$1*h)/cos(PITHIRD-TWOPI$1*h))/3;\n r = 1 - (g+b);\n }\n r = limit$1(i*r*3);\n g = limit$1(i*g*3);\n b = limit$1(i*b*3);\n return [r*255, g*255, b*255, args.length > 3 ? args[3] : 1];\n };\n\n var hsi2rgb_1 = hsi2rgb;\n\n var unpack$f = utils.unpack;\n var type$6 = utils.type;\n\n\n\n\n\n\n Color_1.prototype.hsi = function() {\n return rgb2hsi_1(this._rgb);\n };\n\n chroma_1.hsi = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hsi']) ));\n };\n\n input.format.hsi = hsi2rgb_1;\n\n input.autodetect.push({\n p: 2,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$f(args, 'hsi');\n if (type$6(args) === 'array' && args.length === 3) {\n return 'hsi';\n }\n }\n });\n\n var unpack$g = utils.unpack;\n var type$7 = utils.type;\n\n\n\n\n\n\n Color_1.prototype.hsl = function() {\n return rgb2hsl_1(this._rgb);\n };\n\n chroma_1.hsl = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hsl']) ));\n };\n\n input.format.hsl = hsl2rgb_1;\n\n input.autodetect.push({\n p: 2,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$g(args, 'hsl');\n if (type$7(args) === 'array' && args.length === 3) {\n return 'hsl';\n }\n }\n });\n\n var unpack$h = utils.unpack;\n var min$1 = Math.min;\n var max$1 = Math.max;\n\n /*\n * supported arguments:\n * - rgb2hsv(r,g,b)\n * - rgb2hsv([r,g,b])\n * - rgb2hsv({r,g,b})\n */\n var rgb2hsl$1 = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$h(args, 'rgb');\n var r = args[0];\n var g = args[1];\n var b = args[2];\n var min_ = min$1(r, g, b);\n var max_ = max$1(r, g, b);\n var delta = max_ - min_;\n var h,s,v;\n v = max_ / 255.0;\n if (max_ === 0) {\n h = Number.NaN;\n s = 0;\n } else {\n s = delta / max_;\n if (r === max_) { h = (g - b) / delta; }\n if (g === max_) { h = 2+(b - r) / delta; }\n if (b === max_) { h = 4+(r - g) / delta; }\n h *= 60;\n if (h < 0) { h += 360; }\n }\n return [h, s, v]\n };\n\n var rgb2hsv = rgb2hsl$1;\n\n var unpack$i = utils.unpack;\n var floor$1 = Math.floor;\n\n var hsv2rgb = function () {\n var assign, assign$1, assign$2, assign$3, assign$4, assign$5;\n\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n args = unpack$i(args, 'hsv');\n var h = args[0];\n var s = args[1];\n var v = args[2];\n var r,g,b;\n v *= 255;\n if (s === 0) {\n r = g = b = v;\n } else {\n if (h === 360) { h = 0; }\n if (h > 360) { h -= 360; }\n if (h < 0) { h += 360; }\n h /= 60;\n\n var i = floor$1(h);\n var f = h - i;\n var p = v * (1 - s);\n var q = v * (1 - s * f);\n var t = v * (1 - s * (1 - f));\n\n switch (i) {\n case 0: (assign = [v, t, p], r = assign[0], g = assign[1], b = assign[2]); break\n case 1: (assign$1 = [q, v, p], r = assign$1[0], g = assign$1[1], b = assign$1[2]); break\n case 2: (assign$2 = [p, v, t], r = assign$2[0], g = assign$2[1], b = assign$2[2]); break\n case 3: (assign$3 = [p, q, v], r = assign$3[0], g = assign$3[1], b = assign$3[2]); break\n case 4: (assign$4 = [t, p, v], r = assign$4[0], g = assign$4[1], b = assign$4[2]); break\n case 5: (assign$5 = [v, p, q], r = assign$5[0], g = assign$5[1], b = assign$5[2]); break\n }\n }\n return [r,g,b,args.length > 3?args[3]:1];\n };\n\n var hsv2rgb_1 = hsv2rgb;\n\n var unpack$j = utils.unpack;\n var type$8 = utils.type;\n\n\n\n\n\n\n Color_1.prototype.hsv = function() {\n return rgb2hsv(this._rgb);\n };\n\n chroma_1.hsv = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hsv']) ));\n };\n\n input.format.hsv = hsv2rgb_1;\n\n input.autodetect.push({\n p: 2,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$j(args, 'hsv');\n if (type$8(args) === 'array' && args.length === 3) {\n return 'hsv';\n }\n }\n });\n\n var labConstants = {\n // Corresponds roughly to RGB brighter/darker\n Kn: 18,\n\n // D65 standard referent\n Xn: 0.950470,\n Yn: 1,\n Zn: 1.088830,\n\n t0: 0.137931034, // 4 / 29\n t1: 0.206896552, // 6 / 29\n t2: 0.12841855, // 3 * t1 * t1\n t3: 0.008856452, // t1 * t1 * t1\n };\n\n var unpack$k = utils.unpack;\n var pow = Math.pow;\n\n var rgb2lab = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var ref = unpack$k(args, 'rgb');\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n var ref$1 = rgb2xyz(r,g,b);\n var x = ref$1[0];\n var y = ref$1[1];\n var z = ref$1[2];\n var l = 116 * y - 16;\n return [l < 0 ? 0 : l, 500 * (x - y), 200 * (y - z)];\n };\n\n var rgb_xyz = function (r) {\n if ((r /= 255) <= 0.04045) { return r / 12.92; }\n return pow((r + 0.055) / 1.055, 2.4);\n };\n\n var xyz_lab = function (t) {\n if (t > labConstants.t3) { return pow(t, 1 / 3); }\n return t / labConstants.t2 + labConstants.t0;\n };\n\n var rgb2xyz = function (r,g,b) {\n r = rgb_xyz(r);\n g = rgb_xyz(g);\n b = rgb_xyz(b);\n var x = xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / labConstants.Xn);\n var y = xyz_lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / labConstants.Yn);\n var z = xyz_lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / labConstants.Zn);\n return [x,y,z];\n };\n\n var rgb2lab_1 = rgb2lab;\n\n var unpack$l = utils.unpack;\n var pow$1 = Math.pow;\n\n /*\n * L* [0..100]\n * a [-100..100]\n * b [-100..100]\n */\n var lab2rgb = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$l(args, 'lab');\n var l = args[0];\n var a = args[1];\n var b = args[2];\n var x,y,z, r,g,b_;\n\n y = (l + 16) / 116;\n x = isNaN(a) ? y : y + a / 500;\n z = isNaN(b) ? y : y - b / 200;\n\n y = labConstants.Yn * lab_xyz(y);\n x = labConstants.Xn * lab_xyz(x);\n z = labConstants.Zn * lab_xyz(z);\n\n r = xyz_rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z); // D65 -> sRGB\n g = xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z);\n b_ = xyz_rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z);\n\n return [r,g,b_,args.length > 3 ? args[3] : 1];\n };\n\n var xyz_rgb = function (r) {\n return 255 * (r <= 0.00304 ? 12.92 * r : 1.055 * pow$1(r, 1 / 2.4) - 0.055)\n };\n\n var lab_xyz = function (t) {\n return t > labConstants.t1 ? t * t * t : labConstants.t2 * (t - labConstants.t0)\n };\n\n var lab2rgb_1 = lab2rgb;\n\n var unpack$m = utils.unpack;\n var type$9 = utils.type;\n\n\n\n\n\n\n Color_1.prototype.lab = function() {\n return rgb2lab_1(this._rgb);\n };\n\n chroma_1.lab = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['lab']) ));\n };\n\n input.format.lab = lab2rgb_1;\n\n input.autodetect.push({\n p: 2,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$m(args, 'lab');\n if (type$9(args) === 'array' && args.length === 3) {\n return 'lab';\n }\n }\n });\n\n var unpack$n = utils.unpack;\n var RAD2DEG = utils.RAD2DEG;\n var sqrt$1 = Math.sqrt;\n var atan2 = Math.atan2;\n var round$4 = Math.round;\n\n var lab2lch = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var ref = unpack$n(args, 'lab');\n var l = ref[0];\n var a = ref[1];\n var b = ref[2];\n var c = sqrt$1(a * a + b * b);\n var h = (atan2(b, a) * RAD2DEG + 360) % 360;\n if (round$4(c*10000) === 0) { h = Number.NaN; }\n return [l, c, h];\n };\n\n var lab2lch_1 = lab2lch;\n\n var unpack$o = utils.unpack;\n\n\n\n var rgb2lch = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var ref = unpack$o(args, 'rgb');\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n var ref$1 = rgb2lab_1(r,g,b);\n var l = ref$1[0];\n var a = ref$1[1];\n var b_ = ref$1[2];\n return lab2lch_1(l,a,b_);\n };\n\n var rgb2lch_1 = rgb2lch;\n\n var unpack$p = utils.unpack;\n var DEG2RAD = utils.DEG2RAD;\n var sin = Math.sin;\n var cos$1 = Math.cos;\n\n var lch2lab = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n /*\n Convert from a qualitative parameter h and a quantitative parameter l to a 24-bit pixel.\n These formulas were invented by David Dalrymple to obtain maximum contrast without going\n out of gamut if the parameters are in the range 0-1.\n\n A saturation multiplier was added by Gregor Aisch\n */\n var ref = unpack$p(args, 'lch');\n var l = ref[0];\n var c = ref[1];\n var h = ref[2];\n if (isNaN(h)) { h = 0; }\n h = h * DEG2RAD;\n return [l, cos$1(h) * c, sin(h) * c]\n };\n\n var lch2lab_1 = lch2lab;\n\n var unpack$q = utils.unpack;\n\n\n\n var lch2rgb = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$q(args, 'lch');\n var l = args[0];\n var c = args[1];\n var h = args[2];\n var ref = lch2lab_1 (l,c,h);\n var L = ref[0];\n var a = ref[1];\n var b_ = ref[2];\n var ref$1 = lab2rgb_1 (L,a,b_);\n var r = ref$1[0];\n var g = ref$1[1];\n var b = ref$1[2];\n return [r, g, b, args.length > 3 ? args[3] : 1];\n };\n\n var lch2rgb_1 = lch2rgb;\n\n var unpack$r = utils.unpack;\n\n\n var hcl2rgb = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var hcl = unpack$r(args, 'hcl').reverse();\n return lch2rgb_1.apply(void 0, hcl);\n };\n\n var hcl2rgb_1 = hcl2rgb;\n\n var unpack$s = utils.unpack;\n var type$a = utils.type;\n\n\n\n\n\n\n Color_1.prototype.lch = function() { return rgb2lch_1(this._rgb); };\n Color_1.prototype.hcl = function() { return rgb2lch_1(this._rgb).reverse(); };\n\n chroma_1.lch = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['lch']) ));\n };\n chroma_1.hcl = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hcl']) ));\n };\n\n input.format.lch = lch2rgb_1;\n input.format.hcl = hcl2rgb_1;\n\n ['lch','hcl'].forEach(function (m) { return input.autodetect.push({\n p: 2,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$s(args, m);\n if (type$a(args) === 'array' && args.length === 3) {\n return m;\n }\n }\n }); });\n\n /**\n \tX11 color names\n\n \thttp://www.w3.org/TR/css3-color/#svg-color\n */\n\n var w3cx11 = {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflower: '#6495ed',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkgrey: '#a9a9a9',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkslategrey: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dimgrey: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n grey: '#808080',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n indianred: '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n laserlemon: '#ffff54',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrod: '#fafad2',\n lightgoldenrodyellow: '#fafad2',\n lightgray: '#d3d3d3',\n lightgreen: '#90ee90',\n lightgrey: '#d3d3d3',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightslategrey: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n maroon2: '#7f0000',\n maroon3: '#b03060',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370db',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#db7093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n purple2: '#7f007f',\n purple3: '#a020f0',\n rebeccapurple: '#663399',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n slategrey: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32'\n };\n\n var w3cx11_1 = w3cx11;\n\n var type$b = utils.type;\n\n\n\n\n\n Color_1.prototype.name = function() {\n var hex = rgb2hex_1(this._rgb, 'rgb');\n for (var i = 0, list = Object.keys(w3cx11_1); i < list.length; i += 1) {\n var n = list[i];\n\n if (w3cx11_1[n] === hex) { return n.toLowerCase(); }\n }\n return hex;\n };\n\n input.format.named = function (name) {\n name = name.toLowerCase();\n if (w3cx11_1[name]) { return hex2rgb_1(w3cx11_1[name]); }\n throw new Error('unknown color name: '+name);\n };\n\n input.autodetect.push({\n p: 5,\n test: function (h) {\n var rest = [], len = arguments.length - 1;\n while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];\n\n if (!rest.length && type$b(h) === 'string' && w3cx11_1[h.toLowerCase()]) {\n return 'named';\n }\n }\n });\n\n var unpack$t = utils.unpack;\n\n var rgb2num = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var ref = unpack$t(args, 'rgb');\n var r = ref[0];\n var g = ref[1];\n var b = ref[2];\n return (r << 16) + (g << 8) + b;\n };\n\n var rgb2num_1 = rgb2num;\n\n var type$c = utils.type;\n\n var num2rgb = function (num) {\n if (type$c(num) == \"number\" && num >= 0 && num <= 0xFFFFFF) {\n var r = num >> 16;\n var g = (num >> 8) & 0xFF;\n var b = num & 0xFF;\n return [r,g,b,1];\n }\n throw new Error(\"unknown num color: \"+num);\n };\n\n var num2rgb_1 = num2rgb;\n\n var type$d = utils.type;\n\n\n\n Color_1.prototype.num = function() {\n return rgb2num_1(this._rgb);\n };\n\n chroma_1.num = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['num']) ));\n };\n\n input.format.num = num2rgb_1;\n\n input.autodetect.push({\n p: 5,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n if (args.length === 1 && type$d(args[0]) === 'number' && args[0] >= 0 && args[0] <= 0xFFFFFF) {\n return 'num';\n }\n }\n });\n\n var unpack$u = utils.unpack;\n var type$e = utils.type;\n var round$5 = Math.round;\n\n Color_1.prototype.rgb = function(rnd) {\n if ( rnd === void 0 ) rnd=true;\n\n if (rnd === false) { return this._rgb.slice(0,3); }\n return this._rgb.slice(0,3).map(round$5);\n };\n\n Color_1.prototype.rgba = function(rnd) {\n if ( rnd === void 0 ) rnd=true;\n\n return this._rgb.slice(0,4).map(function (v,i) {\n return i<3 ? (rnd === false ? v : round$5(v)) : v;\n });\n };\n\n chroma_1.rgb = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['rgb']) ));\n };\n\n input.format.rgb = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var rgba = unpack$u(args, 'rgba');\n if (rgba[3] === undefined) { rgba[3] = 1; }\n return rgba;\n };\n\n input.autodetect.push({\n p: 3,\n test: function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n args = unpack$u(args, 'rgba');\n if (type$e(args) === 'array' && (args.length === 3 ||\n args.length === 4 && type$e(args[3]) == 'number' && args[3] >= 0 && args[3] <= 1)) {\n return 'rgb';\n }\n }\n });\n\n /*\n * Based on implementation by Neil Bartlett\n * https://github.com/neilbartlett/color-temperature\n */\n\n var log = Math.log;\n\n var temperature2rgb = function (kelvin) {\n var temp = kelvin / 100;\n var r,g,b;\n if (temp < 66) {\n r = 255;\n g = -155.25485562709179 - 0.44596950469579133 * (g = temp-2) + 104.49216199393888 * log(g);\n b = temp < 20 ? 0 : -254.76935184120902 + 0.8274096064007395 * (b = temp-10) + 115.67994401066147 * log(b);\n } else {\n r = 351.97690566805693 + 0.114206453784165 * (r = temp-55) - 40.25366309332127 * log(r);\n g = 325.4494125711974 + 0.07943456536662342 * (g = temp-50) - 28.0852963507957 * log(g);\n b = 255;\n }\n return [r,g,b,1];\n };\n\n var temperature2rgb_1 = temperature2rgb;\n\n /*\n * Based on implementation by Neil Bartlett\n * https://github.com/neilbartlett/color-temperature\n **/\n\n\n var unpack$v = utils.unpack;\n var round$6 = Math.round;\n\n var rgb2temperature = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n var rgb = unpack$v(args, 'rgb');\n var r = rgb[0], b = rgb[2];\n var minTemp = 1000;\n var maxTemp = 40000;\n var eps = 0.4;\n var temp;\n while (maxTemp - minTemp > eps) {\n temp = (maxTemp + minTemp) * 0.5;\n var rgb$1 = temperature2rgb_1(temp);\n if ((rgb$1[2] / rgb$1[0]) >= (b / r)) {\n maxTemp = temp;\n } else {\n minTemp = temp;\n }\n }\n return round$6(temp);\n };\n\n var rgb2temperature_1 = rgb2temperature;\n\n Color_1.prototype.temp =\n Color_1.prototype.kelvin =\n Color_1.prototype.temperature = function() {\n return rgb2temperature_1(this._rgb);\n };\n\n chroma_1.temp =\n chroma_1.kelvin =\n chroma_1.temperature = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['temp']) ));\n };\n\n input.format.temp =\n input.format.kelvin =\n input.format.temperature = temperature2rgb_1;\n\n var type$f = utils.type;\n\n Color_1.prototype.alpha = function(a, mutate) {\n if ( mutate === void 0 ) mutate=false;\n\n if (a !== undefined && type$f(a) === 'number') {\n if (mutate) {\n this._rgb[3] = a;\n return this;\n }\n return new Color_1([this._rgb[0], this._rgb[1], this._rgb[2], a], 'rgb');\n }\n return this._rgb[3];\n };\n\n Color_1.prototype.clipped = function() {\n return this._rgb._clipped || false;\n };\n\n Color_1.prototype.darken = function(amount) {\n \tif ( amount === void 0 ) amount=1;\n\n \tvar me = this;\n \tvar lab = me.lab();\n \tlab[0] -= labConstants.Kn * amount;\n \treturn new Color_1(lab, 'lab').alpha(me.alpha(), true);\n };\n\n Color_1.prototype.brighten = function(amount) {\n \tif ( amount === void 0 ) amount=1;\n\n \treturn this.darken(-amount);\n };\n\n Color_1.prototype.darker = Color_1.prototype.darken;\n Color_1.prototype.brighter = Color_1.prototype.brighten;\n\n Color_1.prototype.get = function(mc) {\n var ref = mc.split('.');\n var mode = ref[0];\n var channel = ref[1];\n var src = this[mode]();\n if (channel) {\n var i = mode.indexOf(channel);\n if (i > -1) { return src[i]; }\n throw new Error((\"unknown channel \" + channel + \" in mode \" + mode));\n } else {\n return src;\n }\n };\n\n var type$g = utils.type;\n var pow$2 = Math.pow;\n\n var EPS = 1e-7;\n var MAX_ITER = 20;\n\n Color_1.prototype.luminance = function(lum) {\n if (lum !== undefined && type$g(lum) === 'number') {\n if (lum === 0) {\n // return pure black\n return new Color_1([0,0,0,this._rgb[3]], 'rgb');\n }\n if (lum === 1) {\n // return pure white\n return new Color_1([255,255,255,this._rgb[3]], 'rgb');\n }\n // compute new color using...\n var cur_lum = this.luminance();\n var mode = 'rgb';\n var max_iter = MAX_ITER;\n\n var test = function (low, high) {\n var mid = low.interpolate(high, 0.5, mode);\n var lm = mid.luminance();\n if (Math.abs(lum - lm) < EPS || !max_iter--) {\n // close enough\n return mid;\n }\n return lm > lum ? test(low, mid) : test(mid, high);\n };\n\n var rgb = (cur_lum > lum ? test(new Color_1([0,0,0]), this) : test(this, new Color_1([255,255,255]))).rgb();\n return new Color_1(rgb.concat( [this._rgb[3]]));\n }\n return rgb2luminance.apply(void 0, (this._rgb).slice(0,3));\n };\n\n\n var rgb2luminance = function (r,g,b) {\n // relative luminance\n // see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\n r = luminance_x(r);\n g = luminance_x(g);\n b = luminance_x(b);\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n };\n\n var luminance_x = function (x) {\n x /= 255;\n return x <= 0.03928 ? x/12.92 : pow$2((x+0.055)/1.055, 2.4);\n };\n\n var interpolator = {};\n\n var type$h = utils.type;\n\n\n var mix = function (col1, col2, f) {\n if ( f === void 0 ) f=0.5;\n var rest = [], len = arguments.length - 3;\n while ( len-- > 0 ) rest[ len ] = arguments[ len + 3 ];\n\n var mode = rest[0] || 'lrgb';\n if (!interpolator[mode] && !rest.length) {\n // fall back to the first supported mode\n mode = Object.keys(interpolator)[0];\n }\n if (!interpolator[mode]) {\n throw new Error((\"interpolation mode \" + mode + \" is not defined\"));\n }\n if (type$h(col1) !== 'object') { col1 = new Color_1(col1); }\n if (type$h(col2) !== 'object') { col2 = new Color_1(col2); }\n return interpolator[mode](col1, col2, f)\n .alpha(col1.alpha() + f * (col2.alpha() - col1.alpha()));\n };\n\n Color_1.prototype.mix =\n Color_1.prototype.interpolate = function(col2, f) {\n \tif ( f === void 0 ) f=0.5;\n \tvar rest = [], len = arguments.length - 2;\n \twhile ( len-- > 0 ) rest[ len ] = arguments[ len + 2 ];\n\n \treturn mix.apply(void 0, [ this, col2, f ].concat( rest ));\n };\n\n Color_1.prototype.premultiply = function(mutate) {\n \tif ( mutate === void 0 ) mutate=false;\n\n \tvar rgb = this._rgb;\n \tvar a = rgb[3];\n \tif (mutate) {\n \t\tthis._rgb = [rgb[0]*a, rgb[1]*a, rgb[2]*a, a];\n \t\treturn this;\n \t} else {\n \t\treturn new Color_1([rgb[0]*a, rgb[1]*a, rgb[2]*a, a], 'rgb');\n \t}\n };\n\n Color_1.prototype.saturate = function(amount) {\n \tif ( amount === void 0 ) amount=1;\n\n \tvar me = this;\n \tvar lch = me.lch();\n \tlch[1] += labConstants.Kn * amount;\n \tif (lch[1] < 0) { lch[1] = 0; }\n \treturn new Color_1(lch, 'lch').alpha(me.alpha(), true);\n };\n\n Color_1.prototype.desaturate = function(amount) {\n \tif ( amount === void 0 ) amount=1;\n\n \treturn this.saturate(-amount);\n };\n\n var type$i = utils.type;\n\n Color_1.prototype.set = function(mc, value, mutate) {\n if ( mutate === void 0 ) mutate=false;\n\n var ref = mc.split('.');\n var mode = ref[0];\n var channel = ref[1];\n var src = this[mode]();\n if (channel) {\n var i = mode.indexOf(channel);\n if (i > -1) {\n if (type$i(value) == 'string') {\n switch(value.charAt(0)) {\n case '+': src[i] += +value; break;\n case '-': src[i] += +value; break;\n case '*': src[i] *= +(value.substr(1)); break;\n case '/': src[i] /= +(value.substr(1)); break;\n default: src[i] = +value;\n }\n } else if (type$i(value) === 'number') {\n src[i] = value;\n } else {\n throw new Error(\"unsupported value for Color.set\");\n }\n var out = new Color_1(src, mode);\n if (mutate) {\n this._rgb = out._rgb;\n return this;\n }\n return out;\n }\n throw new Error((\"unknown channel \" + channel + \" in mode \" + mode));\n } else {\n return src;\n }\n };\n\n var rgb$1 = function (col1, col2, f) {\n var xyz0 = col1._rgb;\n var xyz1 = col2._rgb;\n return new Color_1(\n xyz0[0] + f * (xyz1[0]-xyz0[0]),\n xyz0[1] + f * (xyz1[1]-xyz0[1]),\n xyz0[2] + f * (xyz1[2]-xyz0[2]),\n 'rgb'\n )\n };\n\n // register interpolator\n interpolator.rgb = rgb$1;\n\n var sqrt$2 = Math.sqrt;\n var pow$3 = Math.pow;\n\n var lrgb = function (col1, col2, f) {\n var ref = col1._rgb;\n var x1 = ref[0];\n var y1 = ref[1];\n var z1 = ref[2];\n var ref$1 = col2._rgb;\n var x2 = ref$1[0];\n var y2 = ref$1[1];\n var z2 = ref$1[2];\n return new Color_1(\n sqrt$2(pow$3(x1,2) * (1-f) + pow$3(x2,2) * f),\n sqrt$2(pow$3(y1,2) * (1-f) + pow$3(y2,2) * f),\n sqrt$2(pow$3(z1,2) * (1-f) + pow$3(z2,2) * f),\n 'rgb'\n )\n };\n\n // register interpolator\n interpolator.lrgb = lrgb;\n\n var lab$1 = function (col1, col2, f) {\n var xyz0 = col1.lab();\n var xyz1 = col2.lab();\n return new Color_1(\n xyz0[0] + f * (xyz1[0]-xyz0[0]),\n xyz0[1] + f * (xyz1[1]-xyz0[1]),\n xyz0[2] + f * (xyz1[2]-xyz0[2]),\n 'lab'\n )\n };\n\n // register interpolator\n interpolator.lab = lab$1;\n\n var _hsx = function (col1, col2, f, m) {\n var assign, assign$1;\n\n var xyz0, xyz1;\n if (m === 'hsl') {\n xyz0 = col1.hsl();\n xyz1 = col2.hsl();\n } else if (m === 'hsv') {\n xyz0 = col1.hsv();\n xyz1 = col2.hsv();\n } else if (m === 'hcg') {\n xyz0 = col1.hcg();\n xyz1 = col2.hcg();\n } else if (m === 'hsi') {\n xyz0 = col1.hsi();\n xyz1 = col2.hsi();\n } else if (m === 'lch' || m === 'hcl') {\n m = 'hcl';\n xyz0 = col1.hcl();\n xyz1 = col2.hcl();\n }\n\n var hue0, hue1, sat0, sat1, lbv0, lbv1;\n if (m.substr(0, 1) === 'h') {\n (assign = xyz0, hue0 = assign[0], sat0 = assign[1], lbv0 = assign[2]);\n (assign$1 = xyz1, hue1 = assign$1[0], sat1 = assign$1[1], lbv1 = assign$1[2]);\n }\n\n var sat, hue, lbv, dh;\n\n if (!isNaN(hue0) && !isNaN(hue1)) {\n // both colors have hue\n if (hue1 > hue0 && hue1 - hue0 > 180) {\n dh = hue1-(hue0+360);\n } else if (hue1 < hue0 && hue0 - hue1 > 180) {\n dh = hue1+360-hue0;\n } else{\n dh = hue1 - hue0;\n }\n hue = hue0 + f * dh;\n } else if (!isNaN(hue0)) {\n hue = hue0;\n if ((lbv1 == 1 || lbv1 == 0) && m != 'hsv') { sat = sat0; }\n } else if (!isNaN(hue1)) {\n hue = hue1;\n if ((lbv0 == 1 || lbv0 == 0) && m != 'hsv') { sat = sat1; }\n } else {\n hue = Number.NaN;\n }\n\n if (sat === undefined) { sat = sat0 + f * (sat1 - sat0); }\n lbv = lbv0 + f * (lbv1-lbv0);\n return new Color_1([hue, sat, lbv], m);\n };\n\n var lch$1 = function (col1, col2, f) {\n \treturn _hsx(col1, col2, f, 'lch');\n };\n\n // register interpolator\n interpolator.lch = lch$1;\n interpolator.hcl = lch$1;\n\n var num$1 = function (col1, col2, f) {\n var c1 = col1.num();\n var c2 = col2.num();\n return new Color_1(c1 + f * (c2-c1), 'num')\n };\n\n // register interpolator\n interpolator.num = num$1;\n\n var hcg$1 = function (col1, col2, f) {\n \treturn _hsx(col1, col2, f, 'hcg');\n };\n\n // register interpolator\n interpolator.hcg = hcg$1;\n\n var hsi$1 = function (col1, col2, f) {\n \treturn _hsx(col1, col2, f, 'hsi');\n };\n\n // register interpolator\n interpolator.hsi = hsi$1;\n\n var hsl$1 = function (col1, col2, f) {\n \treturn _hsx(col1, col2, f, 'hsl');\n };\n\n // register interpolator\n interpolator.hsl = hsl$1;\n\n var hsv$1 = function (col1, col2, f) {\n \treturn _hsx(col1, col2, f, 'hsv');\n };\n\n // register interpolator\n interpolator.hsv = hsv$1;\n\n var clip_rgb$2 = utils.clip_rgb;\n var pow$4 = Math.pow;\n var sqrt$3 = Math.sqrt;\n var PI$1 = Math.PI;\n var cos$2 = Math.cos;\n var sin$1 = Math.sin;\n var atan2$1 = Math.atan2;\n\n var average = function (colors, mode, weights) {\n if ( mode === void 0 ) mode='lrgb';\n if ( weights === void 0 ) weights=null;\n\n var l = colors.length;\n if (!weights) { weights = Array.from(new Array(l)).map(function () { return 1; }); }\n // normalize weights\n var k = l / weights.reduce(function(a, b) { return a + b; });\n weights.forEach(function (w,i) { weights[i] *= k; });\n // convert colors to Color objects\n colors = colors.map(function (c) { return new Color_1(c); });\n if (mode === 'lrgb') {\n return _average_lrgb(colors, weights)\n }\n var first = colors.shift();\n var xyz = first.get(mode);\n var cnt = [];\n var dx = 0;\n var dy = 0;\n // initial color\n for (var i=0; i= 360) { A$1 -= 360; }\n xyz[i$1] = A$1;\n } else {\n xyz[i$1] = xyz[i$1]/cnt[i$1];\n }\n }\n alpha /= l;\n return (new Color_1(xyz, mode)).alpha(alpha > 0.99999 ? 1 : alpha, true);\n };\n\n\n var _average_lrgb = function (colors, weights) {\n var l = colors.length;\n var xyz = [0,0,0,0];\n for (var i=0; i < colors.length; i++) {\n var col = colors[i];\n var f = weights[i] / l;\n var rgb = col._rgb;\n xyz[0] += pow$4(rgb[0],2) * f;\n xyz[1] += pow$4(rgb[1],2) * f;\n xyz[2] += pow$4(rgb[2],2) * f;\n xyz[3] += rgb[3] * f;\n }\n xyz[0] = sqrt$3(xyz[0]);\n xyz[1] = sqrt$3(xyz[1]);\n xyz[2] = sqrt$3(xyz[2]);\n if (xyz[3] > 0.9999999) { xyz[3] = 1; }\n return new Color_1(clip_rgb$2(xyz));\n };\n\n // minimal multi-purpose interface\n\n // @requires utils color analyze\n\n\n var type$j = utils.type;\n\n var pow$5 = Math.pow;\n\n var scale = function(colors) {\n\n // constructor\n var _mode = 'rgb';\n var _nacol = chroma_1('#ccc');\n var _spread = 0;\n // const _fixed = false;\n var _domain = [0, 1];\n var _pos = [];\n var _padding = [0,0];\n var _classes = false;\n var _colors = [];\n var _out = false;\n var _min = 0;\n var _max = 1;\n var _correctLightness = false;\n var _colorCache = {};\n var _useCache = true;\n var _gamma = 1;\n\n // private methods\n\n var setColors = function(colors) {\n colors = colors || ['#fff', '#000'];\n if (colors && type$j(colors) === 'string' && chroma_1.brewer &&\n chroma_1.brewer[colors.toLowerCase()]) {\n colors = chroma_1.brewer[colors.toLowerCase()];\n }\n if (type$j(colors) === 'array') {\n // handle single color\n if (colors.length === 1) {\n colors = [colors[0], colors[0]];\n }\n // make a copy of the colors\n colors = colors.slice(0);\n // convert to chroma classes\n for (var c=0; c= _classes[i]) {\n i++;\n }\n return i-1;\n }\n return 0;\n };\n\n var tMapLightness = function (t) { return t; };\n var tMapDomain = function (t) { return t; };\n\n // const classifyValue = function(value) {\n // let val = value;\n // if (_classes.length > 2) {\n // const n = _classes.length-1;\n // const i = getClass(value);\n // const minc = _classes[0] + ((_classes[1]-_classes[0]) * (0 + (_spread * 0.5))); // center of 1st class\n // const maxc = _classes[n-1] + ((_classes[n]-_classes[n-1]) * (1 - (_spread * 0.5))); // center of last class\n // val = _min + ((((_classes[i] + ((_classes[i+1] - _classes[i]) * 0.5)) - minc) / (maxc-minc)) * (_max - _min));\n // }\n // return val;\n // };\n\n var getColor = function(val, bypassMap) {\n var col, t;\n if (bypassMap == null) { bypassMap = false; }\n if (isNaN(val) || (val === null)) { return _nacol; }\n if (!bypassMap) {\n if (_classes && (_classes.length > 2)) {\n // find the class\n var c = getClass(val);\n t = c / (_classes.length-2);\n } else if (_max !== _min) {\n // just interpolate between min/max\n t = (val - _min) / (_max - _min);\n } else {\n t = 1;\n }\n } else {\n t = val;\n }\n\n // domain map\n t = tMapDomain(t);\n\n if (!bypassMap) {\n t = tMapLightness(t); // lightness correction\n }\n\n if (_gamma !== 1) { t = pow$5(t, _gamma); }\n\n t = _padding[0] + (t * (1 - _padding[0] - _padding[1]));\n\n t = Math.min(1, Math.max(0, t));\n\n var k = Math.floor(t * 10000);\n\n if (_useCache && _colorCache[k]) {\n col = _colorCache[k];\n } else {\n if (type$j(_colors) === 'array') {\n //for i in [0.._pos.length-1]\n for (var i=0; i<_pos.length; i++) {\n var p = _pos[i];\n if (t <= p) {\n col = _colors[i];\n break;\n }\n if ((t >= p) && (i === (_pos.length-1))) {\n col = _colors[i];\n break;\n }\n if (t > p && t < _pos[i+1]) {\n t = (t-p)/(_pos[i+1]-p);\n col = chroma_1.interpolate(_colors[i], _colors[i+1], t, _mode);\n break;\n }\n }\n } else if (type$j(_colors) === 'function') {\n col = _colors(t);\n }\n if (_useCache) { _colorCache[k] = col; }\n }\n return col;\n };\n\n var resetCache = function () { return _colorCache = {}; };\n\n setColors(colors);\n\n // public interface\n\n var f = function(v) {\n var c = chroma_1(getColor(v));\n if (_out && c[_out]) { return c[_out](); } else { return c; }\n };\n\n f.classes = function(classes) {\n if (classes != null) {\n if (type$j(classes) === 'array') {\n _classes = classes;\n _domain = [classes[0], classes[classes.length-1]];\n } else {\n var d = chroma_1.analyze(_domain);\n if (classes === 0) {\n _classes = [d.min, d.max];\n } else {\n _classes = chroma_1.limits(d, 'e', classes);\n }\n }\n return f;\n }\n return _classes;\n };\n\n\n f.domain = function(domain) {\n if (!arguments.length) {\n return _domain;\n }\n _min = domain[0];\n _max = domain[domain.length-1];\n _pos = [];\n var k = _colors.length;\n if ((domain.length === k) && (_min !== _max)) {\n // update positions\n for (var i = 0, list = Array.from(domain); i < list.length; i += 1) {\n var d = list[i];\n\n _pos.push((d-_min) / (_max-_min));\n }\n } else {\n for (var c=0; c 2) {\n // set domain map\n var tOut = domain.map(function (d,i) { return i/(domain.length-1); });\n var tBreaks = domain.map(function (d) { return (d - _min) / (_max - _min); });\n if (!tBreaks.every(function (val, i) { return tOut[i] === val; })) {\n tMapDomain = function (t) {\n if (t <= 0 || t >= 1) { return t; }\n var i = 0;\n while (t >= tBreaks[i+1]) { i++; }\n var f = (t - tBreaks[i]) / (tBreaks[i+1] - tBreaks[i]);\n var out = tOut[i] + f * (tOut[i+1] - tOut[i]);\n return out;\n };\n }\n\n }\n }\n _domain = [_min, _max];\n return f;\n };\n\n f.mode = function(_m) {\n if (!arguments.length) {\n return _mode;\n }\n _mode = _m;\n resetCache();\n return f;\n };\n\n f.range = function(colors, _pos) {\n setColors(colors, _pos);\n return f;\n };\n\n f.out = function(_o) {\n _out = _o;\n return f;\n };\n\n f.spread = function(val) {\n if (!arguments.length) {\n return _spread;\n }\n _spread = val;\n return f;\n };\n\n f.correctLightness = function(v) {\n if (v == null) { v = true; }\n _correctLightness = v;\n resetCache();\n if (_correctLightness) {\n tMapLightness = function(t) {\n var L0 = getColor(0, true).lab()[0];\n var L1 = getColor(1, true).lab()[0];\n var pol = L0 > L1;\n var L_actual = getColor(t, true).lab()[0];\n var L_ideal = L0 + ((L1 - L0) * t);\n var L_diff = L_actual - L_ideal;\n var t0 = 0;\n var t1 = 1;\n var max_iter = 20;\n while ((Math.abs(L_diff) > 1e-2) && (max_iter-- > 0)) {\n (function() {\n if (pol) { L_diff *= -1; }\n if (L_diff < 0) {\n t0 = t;\n t += (t1 - t) * 0.5;\n } else {\n t1 = t;\n t += (t0 - t) * 0.5;\n }\n L_actual = getColor(t, true).lab()[0];\n return L_diff = L_actual - L_ideal;\n })();\n }\n return t;\n };\n } else {\n tMapLightness = function (t) { return t; };\n }\n return f;\n };\n\n f.padding = function(p) {\n if (p != null) {\n if (type$j(p) === 'number') {\n p = [p,p];\n }\n _padding = p;\n return f;\n } else {\n return _padding;\n }\n };\n\n f.colors = function(numColors, out) {\n // If no arguments are given, return the original colors that were provided\n if (arguments.length < 2) { out = 'hex'; }\n var result = [];\n\n if (arguments.length === 0) {\n result = _colors.slice(0);\n\n } else if (numColors === 1) {\n result = [f(0.5)];\n\n } else if (numColors > 1) {\n var dm = _domain[0];\n var dd = _domain[1] - dm;\n result = __range__(0, numColors, false).map(function (i) { return f( dm + ((i/(numColors-1)) * dd) ); });\n\n } else { // returns all colors based on the defined classes\n colors = [];\n var samples = [];\n if (_classes && (_classes.length > 2)) {\n for (var i = 1, end = _classes.length, asc = 1 <= end; asc ? i < end : i > end; asc ? i++ : i--) {\n samples.push((_classes[i-1]+_classes[i])*0.5);\n }\n } else {\n samples = _domain;\n }\n result = samples.map(function (v) { return f(v); });\n }\n\n if (chroma_1[out]) {\n result = result.map(function (c) { return c[out](); });\n }\n return result;\n };\n\n f.cache = function(c) {\n if (c != null) {\n _useCache = c;\n return f;\n } else {\n return _useCache;\n }\n };\n\n f.gamma = function(g) {\n if (g != null) {\n _gamma = g;\n return f;\n } else {\n return _gamma;\n }\n };\n\n f.nodata = function(d) {\n if (d != null) {\n _nacol = chroma_1(d);\n return f;\n } else {\n return _nacol;\n }\n };\n\n return f;\n };\n\n function __range__(left, right, inclusive) {\n var range = [];\n var ascending = left < right;\n var end = !inclusive ? right : ascending ? right + 1 : right - 1;\n for (var i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {\n range.push(i);\n }\n return range;\n }\n\n //\n // interpolates between a set of colors uzing a bezier spline\n //\n\n // @requires utils lab\n\n\n\n\n var bezier = function(colors) {\n var assign, assign$1, assign$2;\n\n var I, lab0, lab1, lab2;\n colors = colors.map(function (c) { return new Color_1(c); });\n if (colors.length === 2) {\n // linear interpolation\n (assign = colors.map(function (c) { return c.lab(); }), lab0 = assign[0], lab1 = assign[1]);\n I = function(t) {\n var lab = ([0, 1, 2].map(function (i) { return lab0[i] + (t * (lab1[i] - lab0[i])); }));\n return new Color_1(lab, 'lab');\n };\n } else if (colors.length === 3) {\n // quadratic bezier interpolation\n (assign$1 = colors.map(function (c) { return c.lab(); }), lab0 = assign$1[0], lab1 = assign$1[1], lab2 = assign$1[2]);\n I = function(t) {\n var lab = ([0, 1, 2].map(function (i) { return ((1-t)*(1-t) * lab0[i]) + (2 * (1-t) * t * lab1[i]) + (t * t * lab2[i]); }));\n return new Color_1(lab, 'lab');\n };\n } else if (colors.length === 4) {\n // cubic bezier interpolation\n var lab3;\n (assign$2 = colors.map(function (c) { return c.lab(); }), lab0 = assign$2[0], lab1 = assign$2[1], lab2 = assign$2[2], lab3 = assign$2[3]);\n I = function(t) {\n var lab = ([0, 1, 2].map(function (i) { return ((1-t)*(1-t)*(1-t) * lab0[i]) + (3 * (1-t) * (1-t) * t * lab1[i]) + (3 * (1-t) * t * t * lab2[i]) + (t*t*t * lab3[i]); }));\n return new Color_1(lab, 'lab');\n };\n } else if (colors.length === 5) {\n var I0 = bezier(colors.slice(0, 3));\n var I1 = bezier(colors.slice(2, 5));\n I = function(t) {\n if (t < 0.5) {\n return I0(t*2);\n } else {\n return I1((t-0.5)*2);\n }\n };\n }\n return I;\n };\n\n var bezier_1 = function (colors) {\n var f = bezier(colors);\n f.scale = function () { return scale(f); };\n return f;\n };\n\n /*\n * interpolates between a set of colors uzing a bezier spline\n * blend mode formulas taken from http://www.venture-ware.com/kevin/coding/lets-learn-math-photoshop-blend-modes/\n */\n\n\n\n\n var blend = function (bottom, top, mode) {\n if (!blend[mode]) {\n throw new Error('unknown blend mode ' + mode);\n }\n return blend[mode](bottom, top);\n };\n\n var blend_f = function (f) { return function (bottom,top) {\n var c0 = chroma_1(top).rgb();\n var c1 = chroma_1(bottom).rgb();\n return chroma_1.rgb(f(c0, c1));\n }; };\n\n var each = function (f) { return function (c0, c1) {\n var out = [];\n out[0] = f(c0[0], c1[0]);\n out[1] = f(c0[1], c1[1]);\n out[2] = f(c0[2], c1[2]);\n return out;\n }; };\n\n var normal = function (a) { return a; };\n var multiply = function (a,b) { return a * b / 255; };\n var darken$1 = function (a,b) { return a > b ? b : a; };\n var lighten = function (a,b) { return a > b ? a : b; };\n var screen = function (a,b) { return 255 * (1 - (1-a/255) * (1-b/255)); };\n var overlay = function (a,b) { return b < 128 ? 2 * a * b / 255 : 255 * (1 - 2 * (1 - a / 255 ) * ( 1 - b / 255 )); };\n var burn = function (a,b) { return 255 * (1 - (1 - b / 255) / (a/255)); };\n var dodge = function (a,b) {\n if (a === 255) { return 255; }\n a = 255 * (b / 255) / (1 - a / 255);\n return a > 255 ? 255 : a\n };\n\n // # add = (a,b) ->\n // # if (a + b > 255) then 255 else a + b\n\n blend.normal = blend_f(each(normal));\n blend.multiply = blend_f(each(multiply));\n blend.screen = blend_f(each(screen));\n blend.overlay = blend_f(each(overlay));\n blend.darken = blend_f(each(darken$1));\n blend.lighten = blend_f(each(lighten));\n blend.dodge = blend_f(each(dodge));\n blend.burn = blend_f(each(burn));\n // blend.add = blend_f(each(add));\n\n var blend_1 = blend;\n\n // cubehelix interpolation\n // based on D.A. Green \"A colour scheme for the display of astronomical intensity images\"\n // http://astron-soc.in/bulletin/11June/289392011.pdf\n\n var type$k = utils.type;\n var clip_rgb$3 = utils.clip_rgb;\n var TWOPI$2 = utils.TWOPI;\n var pow$6 = Math.pow;\n var sin$2 = Math.sin;\n var cos$3 = Math.cos;\n\n\n var cubehelix = function(start, rotations, hue, gamma, lightness) {\n if ( start === void 0 ) start=300;\n if ( rotations === void 0 ) rotations=-1.5;\n if ( hue === void 0 ) hue=1;\n if ( gamma === void 0 ) gamma=1;\n if ( lightness === void 0 ) lightness=[0,1];\n\n var dh = 0, dl;\n if (type$k(lightness) === 'array') {\n dl = lightness[1] - lightness[0];\n } else {\n dl = 0;\n lightness = [lightness, lightness];\n }\n\n var f = function(fract) {\n var a = TWOPI$2 * (((start+120)/360) + (rotations * fract));\n var l = pow$6(lightness[0] + (dl * fract), gamma);\n var h = dh !== 0 ? hue[0] + (fract * dh) : hue;\n var amp = (h * l * (1-l)) / 2;\n var cos_a = cos$3(a);\n var sin_a = sin$2(a);\n var r = l + (amp * ((-0.14861 * cos_a) + (1.78277* sin_a)));\n var g = l + (amp * ((-0.29227 * cos_a) - (0.90649* sin_a)));\n var b = l + (amp * (+1.97294 * cos_a));\n return chroma_1(clip_rgb$3([r*255,g*255,b*255,1]));\n };\n\n f.start = function(s) {\n if ((s == null)) { return start; }\n start = s;\n return f;\n };\n\n f.rotations = function(r) {\n if ((r == null)) { return rotations; }\n rotations = r;\n return f;\n };\n\n f.gamma = function(g) {\n if ((g == null)) { return gamma; }\n gamma = g;\n return f;\n };\n\n f.hue = function(h) {\n if ((h == null)) { return hue; }\n hue = h;\n if (type$k(hue) === 'array') {\n dh = hue[1] - hue[0];\n if (dh === 0) { hue = hue[1]; }\n } else {\n dh = 0;\n }\n return f;\n };\n\n f.lightness = function(h) {\n if ((h == null)) { return lightness; }\n if (type$k(h) === 'array') {\n lightness = h;\n dl = h[1] - h[0];\n } else {\n lightness = [h,h];\n dl = 0;\n }\n return f;\n };\n\n f.scale = function () { return chroma_1.scale(f); };\n\n f.hue(hue);\n\n return f;\n };\n\n var digits = '0123456789abcdef';\n\n var floor$2 = Math.floor;\n var random = Math.random;\n\n var random_1 = function () {\n var code = '#';\n for (var i=0; i<6; i++) {\n code += digits.charAt(floor$2(random() * 16));\n }\n return new Color_1(code, 'hex');\n };\n\n var log$1 = Math.log;\n var pow$7 = Math.pow;\n var floor$3 = Math.floor;\n var abs = Math.abs;\n\n\n var analyze = function (data, key) {\n if ( key === void 0 ) key=null;\n\n var r = {\n min: Number.MAX_VALUE,\n max: Number.MAX_VALUE*-1,\n sum: 0,\n values: [],\n count: 0\n };\n if (type(data) === 'object') {\n data = Object.values(data);\n }\n data.forEach(function (val) {\n if (key && type(val) === 'object') { val = val[key]; }\n if (val !== undefined && val !== null && !isNaN(val)) {\n r.values.push(val);\n r.sum += val;\n if (val < r.min) { r.min = val; }\n if (val > r.max) { r.max = val; }\n r.count += 1;\n }\n });\n\n r.domain = [r.min, r.max];\n\n r.limits = function (mode, num) { return limits(r, mode, num); };\n\n return r;\n };\n\n\n var limits = function (data, mode, num) {\n if ( mode === void 0 ) mode='equal';\n if ( num === void 0 ) num=7;\n\n if (type(data) == 'array') {\n data = analyze(data);\n }\n var min = data.min;\n var max = data.max;\n var values = data.values.sort(function (a,b) { return a-b; });\n\n if (num === 1) { return [min,max]; }\n\n var limits = [];\n\n if (mode.substr(0,1) === 'c') { // continuous\n limits.push(min);\n limits.push(max);\n }\n\n if (mode.substr(0,1) === 'e') { // equal interval\n limits.push(min);\n for (var i=1; i 0');\n }\n var min_log = Math.LOG10E * log$1(min);\n var max_log = Math.LOG10E * log$1(max);\n limits.push(min);\n for (var i$1=1; i$1 pb\n var pr = p - pb;\n limits.push((values[pb]*(1-pr)) + (values[pb+1]*pr));\n }\n }\n limits.push(max);\n\n }\n\n else if (mode.substr(0,1) === 'k') { // k-means clustering\n /*\n implementation based on\n http://code.google.com/p/figue/source/browse/trunk/figue.js#336\n simplified for 1-d input values\n */\n var cluster;\n var n = values.length;\n var assignments = new Array(n);\n var clusterSizes = new Array(num);\n var repeat = true;\n var nb_iters = 0;\n var centroids = null;\n\n // get seed values\n centroids = [];\n centroids.push(min);\n for (var i$3=1; i$3 200) {\n repeat = false;\n }\n }\n\n // finished k-means clustering\n // the next part is borrowed from gabrielflor.it\n var kClusters = {};\n for (var j$5=0; j$5 l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05);\n };\n\n var sqrt$4 = Math.sqrt;\n var atan2$2 = Math.atan2;\n var abs$1 = Math.abs;\n var cos$4 = Math.cos;\n var PI$2 = Math.PI;\n\n var deltaE = function(a, b, L, C) {\n if ( L === void 0 ) L=1;\n if ( C === void 0 ) C=1;\n\n // Delta E (CMC)\n // see http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CMC.html\n a = new Color_1(a);\n b = new Color_1(b);\n var ref = Array.from(a.lab());\n var L1 = ref[0];\n var a1 = ref[1];\n var b1 = ref[2];\n var ref$1 = Array.from(b.lab());\n var L2 = ref$1[0];\n var a2 = ref$1[1];\n var b2 = ref$1[2];\n var c1 = sqrt$4((a1 * a1) + (b1 * b1));\n var c2 = sqrt$4((a2 * a2) + (b2 * b2));\n var sl = L1 < 16.0 ? 0.511 : (0.040975 * L1) / (1.0 + (0.01765 * L1));\n var sc = ((0.0638 * c1) / (1.0 + (0.0131 * c1))) + 0.638;\n var h1 = c1 < 0.000001 ? 0.0 : (atan2$2(b1, a1) * 180.0) / PI$2;\n while (h1 < 0) { h1 += 360; }\n while (h1 >= 360) { h1 -= 360; }\n var t = (h1 >= 164.0) && (h1 <= 345.0) ? (0.56 + abs$1(0.2 * cos$4((PI$2 * (h1 + 168.0)) / 180.0))) : (0.36 + abs$1(0.4 * cos$4((PI$2 * (h1 + 35.0)) / 180.0)));\n var c4 = c1 * c1 * c1 * c1;\n var f = sqrt$4(c4 / (c4 + 1900.0));\n var sh = sc * (((f * t) + 1.0) - f);\n var delL = L1 - L2;\n var delC = c1 - c2;\n var delA = a1 - a2;\n var delB = b1 - b2;\n var dH2 = ((delA * delA) + (delB * delB)) - (delC * delC);\n var v1 = delL / (L * sl);\n var v2 = delC / (C * sc);\n var v3 = sh;\n return sqrt$4((v1 * v1) + (v2 * v2) + (dH2 / (v3 * v3)));\n };\n\n // simple Euclidean distance\n var distance = function(a, b, mode) {\n if ( mode === void 0 ) mode='lab';\n\n // Delta E (CIE 1976)\n // see http://www.brucelindbloom.com/index.html?Equations.html\n a = new Color_1(a);\n b = new Color_1(b);\n var l1 = a.get(mode);\n var l2 = b.get(mode);\n var sum_sq = 0;\n for (var i in l1) {\n var d = (l1[i] || 0) - (l2[i] || 0);\n sum_sq += d*d;\n }\n return Math.sqrt(sum_sq);\n };\n\n var valid = function () {\n var args = [], len = arguments.length;\n while ( len-- ) args[ len ] = arguments[ len ];\n\n try {\n new (Function.prototype.bind.apply( Color_1, [ null ].concat( args) ));\n return true;\n } catch (e) {\n return false;\n }\n };\n\n // some pre-defined color scales:\n\n\n\n\n var scales = {\n \tcool: function cool() { return scale([chroma_1.hsl(180,1,.9), chroma_1.hsl(250,.7,.4)]) },\n \thot: function hot() { return scale(['#000','#f00','#ff0','#fff'], [0,.25,.75,1]).mode('rgb') }\n };\n\n /**\n ColorBrewer colors for chroma.js\n\n Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The\n Pennsylvania State University.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software distributed\n under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n CONDITIONS OF ANY KIND, either express or implied. See the License for the\n specific language governing permissions and limitations under the License.\n */\n\n var colorbrewer = {\n // sequential\n OrRd: ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'],\n PuBu: ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'],\n BuPu: ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'],\n Oranges: ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'],\n BuGn: ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'],\n YlOrBr: ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'],\n YlGn: ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'],\n Reds: ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'],\n RdPu: ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'],\n Greens: ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'],\n YlGnBu: ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'],\n Purples: ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'],\n GnBu: ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'],\n Greys: ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'],\n YlOrRd: ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'],\n PuRd: ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'],\n Blues: ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'],\n PuBuGn: ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'],\n Viridis: ['#440154', '#482777', '#3f4a8a', '#31678e', '#26838f', '#1f9d8a', '#6cce5a', '#b6de2b', '#fee825'],\n\n // diverging\n\n Spectral: ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'],\n RdYlGn: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'],\n RdBu: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'],\n PiYG: ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'],\n PRGn: ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'],\n RdYlBu: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'],\n BrBG: ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'],\n RdGy: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'],\n PuOr: ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'],\n\n // qualitative\n\n Set2: ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494', '#b3b3b3'],\n Accent: ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17', '#666666'],\n Set1: ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf', '#999999'],\n Set3: ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5', '#ffed6f'],\n Dark2: ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666666'],\n Paired: ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'],\n Pastel2: ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc'],\n Pastel1: ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2'],\n };\n\n // add lowercase aliases for case-insensitive matches\n for (var i$1 = 0, list$1 = Object.keys(colorbrewer); i$1 < list$1.length; i$1 += 1) {\n var key = list$1[i$1];\n\n colorbrewer[key.toLowerCase()] = colorbrewer[key];\n }\n\n var colorbrewer_1 = colorbrewer;\n\n // feel free to comment out anything to rollup\n // a smaller chroma.js built\n\n // io --> convert colors\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n // operators --> modify existing Colors\n\n\n\n\n\n\n\n\n\n\n // interpolators\n\n\n\n\n\n\n\n\n\n\n // generators -- > create new colors\n chroma_1.average = average;\n chroma_1.bezier = bezier_1;\n chroma_1.blend = blend_1;\n chroma_1.cubehelix = cubehelix;\n chroma_1.mix = chroma_1.interpolate = mix;\n chroma_1.random = random_1;\n chroma_1.scale = scale;\n\n // other utility methods\n chroma_1.analyze = analyze_1.analyze;\n chroma_1.contrast = contrast;\n chroma_1.deltaE = deltaE;\n chroma_1.distance = distance;\n chroma_1.limits = analyze_1.limits;\n chroma_1.valid = valid;\n\n // scale\n chroma_1.scales = scales;\n\n // colors\n chroma_1.colors = w3cx11_1;\n chroma_1.brewer = colorbrewer_1;\n\n var chroma_js = chroma_1;\n\n return chroma_js;\n\n})));\n","//download.js v4.2, by dandavis; 2008-2016. [MIT] see http://danml.com/download.html for tests/usage\n// v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime\n// v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs\n// v3 added dataURL and Blob Input, bind-toggle arity, and legacy dataURL fallback was improved with force-download mime and base64 support. 3.1 improved safari handling.\n// v4 adds AMD/UMD, commonJS, and plain browser support\n// v4.1 adds url download capability via solo URL argument (same domain/CORS only)\n// v4.2 adds semantic variable names, long (over 2MB) dataURL support, and hidden by default temp anchors\n// https://github.com/rndme/download\n\n(function (root, factory) {\n\tif (typeof define === 'function' && define.amd) {\n\t\t// AMD. Register as an anonymous module.\n\t\tdefine([], factory);\n\t} else if (typeof exports === 'object') {\n\t\t// Node. Does not work with strict CommonJS, but\n\t\t// only CommonJS-like environments that support module.exports,\n\t\t// like Node.\n\t\tmodule.exports = factory();\n\t} else {\n\t\t// Browser globals (root is window)\n\t\troot.download = factory();\n }\n}(this, function () {\n\n\treturn function download(data, strFileName, strMimeType) {\n\n\t\tvar self = window, // this script is only for browsers anyway...\n\t\t\tdefaultMime = \"application/octet-stream\", // this default mime also triggers iframe downloads\n\t\t\tmimeType = strMimeType || defaultMime,\n\t\t\tpayload = data,\n\t\t\turl = !strFileName && !strMimeType && payload,\n\t\t\tanchor = document.createElement(\"a\"),\n\t\t\ttoString = function(a){return String(a);},\n\t\t\tmyBlob = (self.Blob || self.MozBlob || self.WebKitBlob || toString),\n\t\t\tfileName = strFileName || \"download\",\n\t\t\tblob,\n\t\t\treader;\n\t\t\tmyBlob= myBlob.call ? myBlob.bind(self) : Blob ;\n\t \n\t\tif(String(this)===\"true\"){ //reverse arguments, allowing download.bind(true, \"text/xml\", \"export.xml\") to act as a callback\n\t\t\tpayload=[payload, mimeType];\n\t\t\tmimeType=payload[0];\n\t\t\tpayload=payload[1];\n\t\t}\n\n\n\t\tif(url && url.length< 2048){ // if no filename and no mime, assume a url was passed as the only argument\n\t\t\tfileName = url.split(\"/\").pop().split(\"?\")[0];\n\t\t\tanchor.href = url; // assign href prop to temp anchor\n\t\t \tif(anchor.href.indexOf(url) !== -1){ // if the browser determines that it's a potentially valid url path:\n \t\tvar ajax=new XMLHttpRequest();\n \t\tajax.open( \"GET\", url, true);\n \t\tajax.responseType = 'blob';\n \t\tajax.onload= function(e){ \n\t\t\t\t download(e.target.response, fileName, defaultMime);\n\t\t\t\t};\n \t\tsetTimeout(function(){ ajax.send();}, 0); // allows setting custom ajax headers using the return:\n\t\t\t return ajax;\n\t\t\t} // end if valid url?\n\t\t} // end if url?\n\n\n\t\t//go ahead and download dataURLs right away\n\t\tif(/^data:([\\w+-]+\\/[\\w+.-]+)?[,;]/.test(payload)){\n\t\t\n\t\t\tif(payload.length > (1024*1024*1.999) && myBlob !== toString ){\n\t\t\t\tpayload=dataUrlToBlob(payload);\n\t\t\t\tmimeType=payload.type || defaultMime;\n\t\t\t}else{\t\t\t\n\t\t\t\treturn navigator.msSaveBlob ? // IE10 can't do a[download], only Blobs:\n\t\t\t\t\tnavigator.msSaveBlob(dataUrlToBlob(payload), fileName) :\n\t\t\t\t\tsaver(payload) ; // everyone else can save dataURLs un-processed\n\t\t\t}\n\t\t\t\n\t\t}else{//not data url, is it a string with special needs?\n\t\t\tif(/([\\x80-\\xff])/.test(payload)){\t\t\t \n\t\t\t\tvar i=0, tempUiArr= new Uint8Array(payload.length), mx=tempUiArr.length;\n\t\t\t\tfor(i;i {\r\n min(): number;\r\n max(): number;\r\n }\r\n}\r\n\r\nArray.prototype.min = function (): number {\r\n if (this.length > 65536) {\r\n let r = this[0];\r\n this.forEach(function (v: number, _i: any, _a: any) { if (v < r) r = v; });\r\n return r;\r\n } else {\r\n return Math.min.apply(null, this);\r\n }\r\n}\r\n\r\nArray.prototype.max = function (): number {\r\n if (this.length > 65536) {\r\n let r = this[0];\r\n this.forEach(function (v: number, _i: any, _a: any) { if (v > r) r = v; });\r\n return r;\r\n } else {\r\n return Math.max.apply(null, this);\r\n }\r\n}\r\n\r\nexport function matrixMax(matrix: number[][]): number {\r\n let maxRow = matrix.map(function (row) { return row.max(); });\r\n let max = maxRow.max();\r\n return max\r\n}\r\n\r\nexport function matrixMin(matrix: number[][]): number {\r\n let minRow = matrix.map(function (row) { return row.min(); });\r\n let min = minRow.min();\r\n return min\r\n}\r\n\r\nexport function getUniqueVals(source: string[]): string[] {\r\n let length = source.length;\r\n let result: string[] = [];\r\n let seen = new Set();\r\n\r\n outer:\r\n for (let index = 0; index < length; index++) {\r\n let value = source[index];\r\n if (seen.has(value)) continue outer;\r\n seen.add(value);\r\n result.push(value);\r\n }\r\n\r\n return result;\r\n}\r\n\r\nimport { ImgStack } from \"./plotTypes/ImgStack\";\r\nimport { ShapeCloud } from \"./plotTypes/ShapeCloud\";\r\nimport { PointCloud } from \"./plotTypes/PointCloud\";\r\nimport { Surface } from \"./plotTypes/Surface\";\r\nimport { HeatMap } from \"./plotTypes/HeatMap\";\r\nimport { MeshStream } from \"./plotTypes/MeshStream\";\r\nimport { MeshObject } from \"./plotTypes/MeshObject\";\r\nimport { Line } from \"./plotTypes/Line\";\r\nimport { BoundingBox } from \"@babylonjs/core/Culling/boundingBox\";\r\nimport { styleText } from \"./utils/styleText\";\r\nimport { buttonSVGs, legendSVGs } from \"./utils/SVGs\";\r\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\r\nimport { ILoadingScreen } from \"@babylonjs/core/Loading/loadingScreen\";\r\n\r\nexport const PLOTTYPES = {\r\n 'pointCloud': ['coordinates', 'colorBy', 'colorVar'],\r\n 'shapeCloud': ['coordinates', 'colorBy', 'colorVar'],\r\n 'surface': ['coordinates', 'colorBy', 'colorVar'],\r\n 'heatMap': ['coordinates', 'colorBy', 'colorVar'],\r\n 'imageStack': ['values', 'indices', 'attributes'],\r\n 'meshObject': ['meshString'],\r\n 'Line': ['coordinates', 'colorBy', 'colorVar']\r\n}\r\n\r\n/**\r\n * Takes a reasonable guess if a plot can be created from the provided object\r\n * @param plotData Object containing data to be checked for valid plot information\r\n */\r\nexport function isValidPlot(plotData: {}): boolean {\r\n for (let plotIdx = 0; plotIdx < plotData[\"plots\"].length; plotIdx++) {\r\n const plot = plotData[\"plots\"][plotIdx];\r\n let pltType = plot[\"plotType\"]\r\n if (PLOTTYPES.hasOwnProperty(pltType)) {\r\n for (let i = 0; i < PLOTTYPES[pltType].length; i++) {\r\n const prop = PLOTTYPES[pltType][i];\r\n if (plot[prop] === undefined) {\r\n console.log('Plot ' + plotIdx + ' is missing property:' + prop);\r\n return false;\r\n }\r\n }\r\n } else {\r\n console.log('Unrecognized plot type')\r\n return false;\r\n }\r\n }\r\n return true;\r\n}\r\n\r\nexport class Plots {\r\n private _engine: Engine;\r\n private _hl1: HemisphericLight;\r\n private _hl2: HemisphericLight;\r\n protected _legend: AdvancedDynamicTexture;\r\n protected _showLegend: boolean = true;\r\n private _hasAnim: boolean = false;\r\n private _loopingAnim: boolean = false;\r\n private _buttonBar: HTMLDivElement;\r\n private _turntableBtn: HTMLDivElement;\r\n private _loopBtn: HTMLElement;\r\n private _streamControlBtn: HTMLDivElement;\r\n private _animationSlider: HTMLInputElement;\r\n private _axes: Axes[] = [];\r\n private _downloadObj: {} = {};\r\n private _annotationManager: AnnotationManager;\r\n private _backgroundColor: string;\r\n private _recording: boolean = false;\r\n private _turned: number = 0;\r\n private _capturer: CCapture;\r\n private _wasTurning: boolean = false;\r\n private _xScale: number = 1;\r\n private _yScale: number = 1;\r\n private _zScale: number = 1;\r\n private _publishFormOverlay: HTMLDivElement;\r\n private _uniqID: string;\r\n private _shapeLegendPosition: string;\r\n private _fsUIDirty: boolean = true;\r\n private _upAxis: string = \"+y\";\r\n\r\n /** HTML canvas element for this babyplots visualization. */\r\n canvas: HTMLCanvasElement;\r\n /** Babylonjs scene object. */\r\n scene: Scene;\r\n /** Camera of the visualization */\r\n camera: ArcRotateCamera;\r\n /** Array of plots in this visualization. */\r\n plots: Plot[] = [];\r\n /** Turn the camera around the plots. */\r\n turntable: boolean;\r\n /** Rotation speed of the turntable camera. */\r\n rotationRate: number;\r\n /** Highest point on the y axis of any plot. Used for positioning the camera and labels. */\r\n ymax: number = 0;\r\n /** This variable should be exclusively set by the babyplots R package. It controls some specific options for babyplots behavior in the RStudio viewer. */\r\n R: boolean = false;\r\n /** This variable should be exclusively set by the babyplots Python package. It controls some specific options for babyplots behavior in the Jupyter notebook. */\r\n Python: boolean = false;\r\n /** Title of the legend showing the names and plot types of multiple plots, if at least one plot has showShape enabled. */\r\n shapeLegendTitle: string = \"\";\r\n /** AdvancedDynamicTexture for the full screen UI */\r\n uiLayer: AdvancedDynamicTexture;\r\n /** Play or pause state of all animations */\r\n animPaused: boolean = false;\r\n\r\n\r\n /**\r\n * Initialize the 3d visualization\r\n * \r\n * @param canvasElement ID of the canvas element in the DOM\r\n * @param options Object with general options. See a list of possible options [here](https://bp.bleb.li/documentation/js#plotsObject).\r\n */\r\n constructor(canvasElement: string, options = {}) {\r\n // create unique id, needed if multiple babyplots canvases are on the same page.\r\n this._uniqID = uuidv4();\r\n\r\n // apply options\r\n // default settings\r\n let opts = {\r\n backgroundColor: \"#ffffffff\",\r\n xScale: 1,\r\n yScale: 1,\r\n zScale: 1,\r\n turntable: false,\r\n rotationRate: 0.01,\r\n shapeLegendTitle: \"\",\r\n upAxis: \"+y\",\r\n }\r\n Object.assign(opts, options);\r\n\r\n this.turntable = opts.turntable;\r\n this.rotationRate = opts.rotationRate;\r\n this.shapeLegendTitle = opts.shapeLegendTitle;\r\n\r\n // setup enginge and scene\r\n this._backgroundColor = opts.backgroundColor;\r\n this.canvas = document.getElementById(canvasElement) as HTMLCanvasElement;\r\n this._engine = new Engine(this.canvas, true, { preserveDrawingBuffer: true, stencil: true });\r\n this.scene = new Scene(this._engine);\r\n\r\n // camera\r\n this.camera = new ArcRotateCamera(\"Camera\", 0, 0, 10, Vector3.Zero(), this.scene);\r\n this.camera.attachControl(this.canvas, true);\r\n this.scene.activeCamera = this.camera;\r\n this.camera.inputs.attached.keyboard.detachControl();\r\n this.camera.wheelPrecision = 50;\r\n this._upAxis = opts.upAxis;\r\n this._updateCameraUpVector();\r\n\r\n // background color\r\n this.scene.clearColor = Color4.FromHexString(opts.backgroundColor);\r\n\r\n // Loading screen\r\n var loadingScreen = new CustomLoadingScreen(\"Loading\");\r\n this._engine.loadingScreen = loadingScreen;\r\n\r\n // Axis scales\r\n this._xScale = opts.xScale;\r\n this._yScale = opts.yScale;\r\n this._zScale = opts.zScale;\r\n\r\n // two lights to illuminate the plot uniformly (top and bottom)\r\n this._hl1 = new HemisphericLight(\"HemiLight\", new Vector3(0, 1, 0), this.scene);\r\n this._hl1.diffuse = new Color3(1, 1, 1);\r\n this._hl1.specular = new Color3(0.01, 0.01, 0.01);\r\n // bottom light slightly weaker for better depth perception and orientation\r\n this._hl2 = new HemisphericLight(\"HemiLight\", new Vector3(0, -1, 0), this.scene);\r\n this._hl2.diffuse = new Color3(0.8, 0.8, 0.8);\r\n this._hl2.specular = new Color3(0.01, 0.01, 0.01);\r\n\r\n // create fullscreen GUI texture\r\n this.uiLayer = AdvancedDynamicTexture.CreateFullscreenUI(\"UI\", true, this.scene);\r\n\r\n this._annotationManager = new AnnotationManager(this.canvas, this.scene, this.ymax, this.camera, this._backgroundColor, this.uiLayer, this._uniqID);\r\n\r\n this.scene.registerBeforeRender(this._prepRender.bind(this));\r\n\r\n this.scene.registerAfterRender(this._afterRender.bind(this));\r\n\r\n // create container for buttons\r\n // create css style\r\n let styleElem = document.createElement(\"style\");\r\n styleElem.appendChild(document.createTextNode(styleText));\r\n document.getElementsByTagName('head')[0].appendChild(styleElem);\r\n\r\n // create ui elements\r\n let buttonBar = document.createElement(\"div\");\r\n buttonBar.id = \"buttonBar_\" + this._uniqID;\r\n buttonBar.className = \"bbp button-bar\"\r\n buttonBar.style.top = this.canvas.clientTop + 5 + \"px\";\r\n buttonBar.style.left = this.canvas.clientLeft + 5 + \"px\";\r\n this.canvas.parentNode.appendChild(buttonBar);\r\n this._buttonBar = buttonBar;\r\n\r\n // animation and streaming buttons\r\n let streamCtrlBtn = document.createElement(\"div\");\r\n streamCtrlBtn.className = \"button streamctrl loading hidden\";\r\n streamCtrlBtn.onclick = () => (this._streamControlBtn.className === \"button streamctrl pause\") ? this.pauseAnimation() : this.playAnimation();\r\n let streamCtrlLoading = document.createElement(\"div\");\r\n streamCtrlLoading.className = \"btn-label loading\";\r\n streamCtrlLoading.innerHTML = buttonSVGs.loading;\r\n streamCtrlBtn.appendChild(streamCtrlLoading);\r\n let streamCtrlPlay = document.createElement(\"div\");\r\n streamCtrlPlay.className = \"btn-label play\";\r\n streamCtrlPlay.innerHTML = buttonSVGs.play;\r\n streamCtrlBtn.appendChild(streamCtrlPlay);\r\n let streamCtrlPause = document.createElement(\"div\");\r\n streamCtrlPause.className = \"btn-label pause\";\r\n streamCtrlPause.innerHTML = buttonSVGs.pause;\r\n streamCtrlBtn.appendChild(streamCtrlPause);\r\n this._buttonBar.appendChild(streamCtrlBtn);\r\n let animRange = document.createElement(\"input\");\r\n animRange.type = \"range\";\r\n animRange.min = \"0\";\r\n animRange.max = \"0\";\r\n animRange.value = \"0\";\r\n animRange.step = \"1\";\r\n animRange.className = \"anim-slider hidden\";\r\n animRange.disabled = true;\r\n animRange.onchange = () => this.setAnimationFrame();\r\n this._animationSlider = animRange;\r\n this._buttonBar.appendChild(animRange);\r\n\r\n this._streamControlBtn = streamCtrlBtn;\r\n\r\n // prepare download object\r\n this._downloadObj = {\r\n plots: []\r\n };\r\n\r\n this.scene.onPointerDown = (function (_evt: any, pickResult: PickingInfo) {\r\n // (this as Plots)._annotationManager.clearInfo();\r\n for (let i = 0; i < (this as Plots).plots.length; i++) {\r\n let plot = (this as Plots).plots[i];\r\n if (!plot.pickable) {\r\n continue;\r\n }\r\n if (pickResult.pickedMesh === plot.mesh && (plot as CoordinatePlot).dpInfo) {\r\n let pick = (plot as CoordinatePlot).getPick(pickResult);\r\n (this as Plots)._annotationManager.displayInfo(pick.info, pick.target);\r\n }\r\n }\r\n }).bind(this);\r\n }\r\n\r\n private _updateCameraUpVector() {\r\n switch (this._upAxis) {\r\n case \"+x\":\r\n this.camera.upVector = new Vector3(1, 0, 0);\r\n break;\r\n case \"-x\":\r\n this.camera.upVector = new Vector3(-1, 0, 0);\r\n break;\r\n case \"+z\":\r\n this.camera.upVector = new Vector3(0, 0, 1);\r\n break;\r\n case \"-z\":\r\n this.camera.upVector = new Vector3(0, 0, -1);\r\n break;\r\n case \"-y\":\r\n this.camera.upVector = new Vector3(0, -1, 0);\r\n break;\r\n case \"+y\":\r\n default:\r\n this.camera.upVector = new Vector3(0, 1, 0);\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Load a visualization from a saved JSON object. The R, JavaScript and Python implementations of babyplots as well as the NPC allow the export of visualizations as JSON files. Loading of a saved visualization using fromJSON() overwrites previously set properties of the Plots object.\r\n * \r\n * @param plotData Javascript Object with plot data.\r\n */\r\n fromJSON(plotData: {}): void {\r\n if (plotData[\"turntable\"] !== undefined) {\r\n this.turntable = plotData[\"turntable\"];\r\n }\r\n if (plotData[\"rotationRate\"] !== undefined) {\r\n this.rotationRate = plotData[\"rotationRate\"];\r\n }\r\n if (plotData[\"backgroundColor\"]) {\r\n this._backgroundColor = plotData[\"backgroundColor\"];\r\n this.scene.clearColor = Color4.FromHexString(this._backgroundColor);\r\n }\r\n if (plotData[\"xScale\"] !== undefined) {\r\n this._xScale = plotData[\"xScale\"];\r\n }\r\n if (plotData[\"yScale\"] !== undefined) {\r\n this._yScale = plotData[\"yScale\"];\r\n }\r\n if (plotData[\"zScale\"] !== undefined) {\r\n this._zScale = plotData[\"zScale\"];\r\n }\r\n if (plotData[\"shapeLegendTitle\"] !== undefined) {\r\n this.shapeLegendTitle = plotData[\"shapeLegendTitle\"];\r\n }\r\n if (plotData[\"upAxis\"] !== undefined) {\r\n this._upAxis = plotData[\"upAxis\"];\r\n this._updateCameraUpVector();\r\n }\r\n for (let plotIdx = 0; plotIdx < plotData[\"plots\"].length; plotIdx++) {\r\n const plot = plotData[\"plots\"][plotIdx];\r\n if (plot[\"plotType\"] === \"imageStack\") {\r\n this.addImgStack(\r\n plot[\"values\"],\r\n plot[\"indices\"],\r\n plot[\"attributes\"],\r\n {\r\n name: plot[\"name\"],\r\n size: plot[\"size\"],\r\n colorScale: plot[\"colorScale\"],\r\n showLegend: plot[\"showLegend\"],\r\n fontSize: plot[\"fontSize\"],\r\n fontColor: plot[\"fontColor\"],\r\n legendTitle: plot[\"legendTitle\"],\r\n legendTitleFontSize: plot[\"legendTitleFontSize\"],\r\n legendTitleFontColor: plot[\"legendTitleFontColor\"],\r\n legendPosition: plot[\"legendPosition\"],\r\n showAxes: plot[\"showAxes\"],\r\n axisLabels: plot[\"axisLabels\"],\r\n axisColors: plot[\"axisColors\"],\r\n tickBreaks: plot[\"tickBreaks\"],\r\n showTickLines: plot[\"showTickLines\"],\r\n tickLineColors: plot[\"tickLineColors\"],\r\n intensityMode: plot[\"intensityMode\"],\r\n channelColors: plot[\"channelColors\"],\r\n channelOpacities: plot[\"channelOpacities\"]\r\n }\r\n )\r\n } else if (plot[\"plotType\"] === \"meshObject\") {\r\n this.addMeshObject(\r\n plot[\"meshString\"],\r\n {\r\n meshScaling: plot[\"meshScaling\"],\r\n meshRotation: plot[\"meshRotation\"],\r\n meshOffset: plot[\"meshOffset\"]\r\n }\r\n )\r\n } else if (plot[\"plotType\"] === \"meshStream\") {\r\n this.addMeshStream(\r\n plot[\"rootUrl\"],\r\n plot[\"filePrefix\"],\r\n plot[\"fileSuffix\"],\r\n plot[\"fileIteratorStart\"],\r\n plot[\"fileIteratorEnd\"],\r\n plot[\"frameDelay\"],\r\n {\r\n meshRotation: plot[\"meshRotation\"],\r\n meshOffset: plot[\"meshOffset\"]\r\n }\r\n )\r\n } else if ([\"pointCloud\", \"heatMap\", \"surface\", \"shapeCloud\", \"line\"].indexOf(plot[\"plotType\"]) !== -1) {\r\n this.addPlot(\r\n plot[\"coordinates\"],\r\n plot[\"plotType\"],\r\n plot[\"colorBy\"],\r\n plot[\"colorVar\"],\r\n {\r\n name: plot[\"name\"],\r\n size: plot[\"size\"],\r\n colorScale: plot[\"colorScale\"],\r\n customColorScale: plot[\"customColorScale\"],\r\n colorScaleInverted: plot[\"colorScaleInverted\"],\r\n sortedCategories: plot[\"sortedCategories\"],\r\n showLegend: plot[\"showLegend\"],\r\n legendShowShape: plot[\"legendShowShape\"],\r\n fontSize: plot[\"fontSize\"],\r\n fontColor: plot[\"fontColor\"],\r\n legendTitle: plot[\"legendTitle\"],\r\n legendTitleFontSize: plot[\"legendTitleFontSize\"],\r\n legendTitleFontColor: plot[\"legendTitleFontColor\"],\r\n legendPosition: plot[\"legendPosition\"],\r\n showAxes: plot[\"showAxes\"],\r\n axisLabels: plot[\"axisLabels\"],\r\n axisColors: plot[\"axisColors\"],\r\n tickBreaks: plot[\"tickBreaks\"],\r\n showTickLines: plot[\"showTickLines\"],\r\n tickLineColors: plot[\"tickLineColors\"],\r\n hasAnimation: plot[\"hasAnimation\"],\r\n animationTargets: plot[\"animationTargets\"],\r\n animationDelay: plot[\"animationDelay\"],\r\n animationDuration: plot[\"animationDuration\"],\r\n animationLoop: plot[\"animationLoop\"],\r\n folded: plot[\"folded\"],\r\n foldedEmbedding: plot[\"foldedEmbedding\"],\r\n foldAnimDelay: plot[\"foldAnimDelay\"],\r\n foldAnimDuration: plot[\"foldAnimDuration\"],\r\n foldAnimLoop: plot[\"foldAnimLoop\"],\r\n colnames: plot[\"colnames\"],\r\n rownames: plot[\"rownames\"],\r\n shape: plot[\"shape\"],\r\n shading: plot[\"shading\"],\r\n dpInfo: plot[\"dpInfo\"],\r\n addClusterLabels: plot[\"addClusterLabels\"],\r\n labels: plot[\"labels\"],\r\n labelSize: plot[\"labelSize\"],\r\n labelColor: plot[\"labelColor\"]\r\n }\r\n )\r\n }\r\n }\r\n if (plotData[\"labels\"]) {\r\n this._annotationManager.fixedLabels = true;\r\n let labelData = plotData[\"labels\"];\r\n if (labelData.length > 0) {\r\n if (Array.isArray(labelData[0])) {\r\n this._annotationManager.addLabels(labelData);\r\n } else {\r\n // legacy label saving\r\n for (let i = 0; i < labelData.length; i++) {\r\n const label = labelData[i];\r\n if (label[\"text\"] && label[\"position\"]) {\r\n this._annotationManager.addLabel(label[\"text\"], label[\"position\"]);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n if (plotData[\"cameraAlpha\"] !== undefined) {\r\n this.camera.alpha = plotData[\"cameraAlpha\"];\r\n }\r\n if (plotData[\"cameraBeta\"] !== undefined) {\r\n this.camera.beta = plotData[\"cameraBeta\"];\r\n }\r\n if (plotData[\"cameraRadius\"] !== undefined) {\r\n this.camera.radius = plotData[\"cameraRadius\"];\r\n }\r\n }\r\n\r\n /**\r\n * Create UI buttons to control certain babyplots features.\r\n * \r\n * @param whichBtns Array of buttons to create. Any combination of [\"json\", \"label\", \"publish\", \"record\"] is allowed.\r\n * \r\n * \"json\": creates a button that triggers the download of the plot data in .json file format.\r\n * \r\n * \"label\": creates a button that opens the label manager that allows creation and editing of labels.\r\n * \r\n * \"publish\": creates a button that opens the publish to bp.bleb.li form.\r\n * \r\n * \"record\": creates a button to record the plot as a gif. (Requires inclusion of CCapture.js and its gif.worker.js).\r\n */\r\n createButtons(whichBtns = [\"json\", \"label\", \"publish\", \"record\", \"turntable\"]): void {\r\n if (whichBtns.indexOf(\"turntable\") !== -1) {\r\n let turntableBtn = document.createElement(\"div\");\r\n turntableBtn.className = \"button\";\r\n turntableBtn.onclick = () => this.toggleTurntable();\r\n turntableBtn.innerHTML = buttonSVGs.turntable;\r\n turntableBtn.title = \"Toggle turntable animation.\"\r\n this._buttonBar.appendChild(turntableBtn);\r\n this._turntableBtn = turntableBtn;\r\n if (this.turntable) {\r\n turntableBtn.className = \"button active\";\r\n }\r\n }\r\n if (whichBtns.indexOf(\"json\") !== -1) {\r\n let jsonBtn = document.createElement(\"div\");\r\n jsonBtn.className = \"button\";\r\n jsonBtn.onclick = this._downloadJson.bind(this);\r\n jsonBtn.innerHTML = buttonSVGs.toJson;\r\n jsonBtn.title = \"Download the plot as json file.\";\r\n this._buttonBar.appendChild(jsonBtn);\r\n }\r\n if (whichBtns.indexOf(\"label\") !== -1) {\r\n let labelBtn = document.createElement(\"div\");\r\n labelBtn.className = \"button\";\r\n labelBtn.onclick = this._annotationManager.toggleLabelControl.bind(this._annotationManager);\r\n labelBtn.innerHTML = buttonSVGs.labels;\r\n labelBtn.title = \"Show or hide the label manager.\";\r\n this._buttonBar.appendChild(labelBtn);\r\n }\r\n if (whichBtns.indexOf(\"record\") !== -1) {\r\n let recordBtn = document.createElement(\"div\");\r\n recordBtn.className = \"button\";\r\n recordBtn.onclick = this._startRecording.bind(this);\r\n recordBtn.innerHTML = buttonSVGs.record;\r\n recordBtn.title = \"Record the plot as a gif.\";\r\n this._buttonBar.appendChild(recordBtn);\r\n }\r\n if (whichBtns.indexOf(\"publish\") !== -1) {\r\n let publishBtn = document.createElement(\"div\");\r\n publishBtn.className = \"button\";\r\n publishBtn.onclick = this._createPublishForm.bind(this);\r\n publishBtn.innerHTML = buttonSVGs.publish;\r\n publishBtn.title = \"Publish the plot to bp.bleb.li.\";\r\n this._buttonBar.appendChild(publishBtn);\r\n }\r\n }\r\n\r\n private _prepDownloadObj() {\r\n this._downloadObj[\"turntable\"] = this.turntable;\r\n this._downloadObj[\"rotationRate\"] = this.rotationRate;\r\n this._downloadObj[\"backgroundColor\"] = this._backgroundColor;\r\n this._downloadObj[\"xScale\"] = this._xScale;\r\n this._downloadObj[\"yScale\"] = this._yScale;\r\n this._downloadObj[\"zScale\"] = this._zScale;\r\n this._downloadObj[\"shapeLegendTitle\"] = this.shapeLegendTitle;\r\n this._downloadObj[\"cameraAlpha\"] = this.camera.alpha;\r\n this._downloadObj[\"cameraBeta\"] = this.camera.beta;\r\n this._downloadObj[\"cameraRadius\"] = this.camera.radius;\r\n this._downloadObj[\"labels\"] = this._annotationManager.exportLabels();\r\n this._downloadObj[\"cameraAlpha\"] = this.camera.alpha;\r\n this._downloadObj[\"cameraBeta\"] = this.camera.beta;\r\n this._downloadObj[\"cameraRadius\"] = this.camera.radius;\r\n this._downloadObj[\"upAxis\"] = this._upAxis;\r\n }\r\n\r\n private _downloadJson() {\r\n let dlElement = document.createElement(\"a\");\r\n this._prepDownloadObj();\r\n let dlContent = encodeURIComponent(JSON.stringify(this._downloadObj));\r\n dlElement.setAttribute(\"href\", \"data:text/plain;charset=utf-8,\" + dlContent);\r\n dlElement.setAttribute(\"download\", \"babyplots_export.json\");\r\n dlElement.style.display = \"none\";\r\n document.body.appendChild(dlElement);\r\n dlElement.click();\r\n document.body.removeChild(dlElement);\r\n }\r\n\r\n private _createPublishForm() {\r\n\r\n if (this._publishFormOverlay !== undefined) {\r\n return\r\n }\r\n\r\n let formOverlay = document.createElement(\"div\");\r\n\r\n formOverlay.id = \"publishOverlay_\" + this._uniqID;\r\n formOverlay.style.position = \"absolute\";\r\n let r = this.canvas.getBoundingClientRect();\r\n if (this.Python) {\r\n formOverlay.style.top = \"0px\";\r\n formOverlay.style.left = \"0px\";\r\n formOverlay.style.width = \"100%\";\r\n formOverlay.style.height = \"100%\";\r\n } else {\r\n formOverlay.style.top = r.y + \"px\";\r\n formOverlay.style.left = r.x + \"px\";\r\n formOverlay.style.width = r.width + \"px\";\r\n formOverlay.style.height = r.height + \"px\";\r\n }\r\n formOverlay.style.backgroundColor = \"#ffffff66\";\r\n let formBox = document.createElement(\"div\");\r\n formBox.style.width = \"275px\";\r\n formBox.style.margin = \"42px auto\";\r\n formBox.style.backgroundColor = \"white\";\r\n formBox.style.padding = \"15px 30px\";\r\n formBox.style.borderRadius = \"10px\";\r\n formBox.style.boxShadow = \"0 0 10px #0003\";\r\n formBox.className = \"bbp publish-form\"\r\n formOverlay.appendChild(formBox);\r\n // Upload description text\r\n let formInfo = document.createElement(\"p\");\r\n formInfo.innerText = \"Upload the plot to your account on https://bp.bleb.li. Only you will be able to see it. You can change the access settings in your account.\";\r\n formInfo.className = \"form-info\";\r\n formBox.appendChild(formInfo);\r\n // Inputs and their labels\r\n let usernameLabel = document.createElement(\"label\");\r\n usernameLabel.id = \"publishUsernameLabel_\" + this._uniqID;\r\n usernameLabel.innerText = \"Username:\";\r\n let usernameInput = document.createElement(\"input\");\r\n usernameInput.type = \"text\";\r\n usernameInput.id = \"publishUsername_\" + this._uniqID;\r\n let passwordLabel = document.createElement(\"label\");\r\n passwordLabel.id = \"publishPasswordLabel_\" + this._uniqID;\r\n passwordLabel.innerText = \"Password:\"\r\n let passwordInput = document.createElement(\"input\");\r\n passwordInput.type = \"password\";\r\n passwordInput.id = \"publishPassword_\" + this._uniqID;\r\n let titleLabel = document.createElement(\"label\");\r\n titleLabel.id = \"publishTitleLabel_\" + this._uniqID;\r\n titleLabel.innerText = \"Plot title:\";\r\n let titleInput = document.createElement(\"input\");\r\n titleInput.type = \"text\";\r\n titleInput.id = \"publishTitle_\" + this._uniqID;\r\n // message placeholder\r\n let msg = document.createElement(\"p\");\r\n msg.id = \"publishMessage_\" + this._uniqID;\r\n // Buttons\r\n let publishBtn = document.createElement(\"button\");\r\n publishBtn.className = \"publish-btn\";\r\n publishBtn.id = \"publishBtn_\" + this._uniqID;\r\n publishBtn.onclick = this._tryPublish.bind(this);\r\n publishBtn.innerText = \"Login and publish\";\r\n let cancelBtn = document.createElement(\"button\");\r\n cancelBtn.className = \"cancel-btn\";\r\n cancelBtn.id = \"cancelBtn_\" + this._uniqID;\r\n cancelBtn.onclick = this._cancelPublish.bind(this);\r\n cancelBtn.innerText = \"Cancel\";\r\n let closeBtn = document.createElement(\"button\");\r\n closeBtn.className = \"close-btn\";\r\n closeBtn.id = \"closeBtn_\" + this._uniqID;\r\n closeBtn.onclick = this._cancelPublish.bind(this);\r\n closeBtn.innerText = \"Close\";\r\n closeBtn.style.display = \"none\";\r\n\r\n // Add all form elements to the form\r\n formBox.appendChild(usernameLabel);\r\n formBox.appendChild(usernameInput);\r\n formBox.appendChild(passwordLabel);\r\n formBox.appendChild(passwordInput);\r\n formBox.appendChild(titleLabel);\r\n formBox.appendChild(titleInput);\r\n formBox.appendChild(msg);\r\n formBox.appendChild(publishBtn);\r\n formBox.appendChild(cancelBtn);\r\n formBox.appendChild(closeBtn);\r\n this._publishFormOverlay = formOverlay;\r\n this.canvas.parentNode.appendChild(formOverlay);\r\n }\r\n\r\n private _resizePublishOverlay() {\r\n if (this._publishFormOverlay === undefined) {\r\n return\r\n }\r\n let r = this.canvas.getBoundingClientRect();\r\n this._publishFormOverlay.style.left = r.x + \"px\";\r\n this._publishFormOverlay.style.top = r.y + \"px\";\r\n this._publishFormOverlay.style.width = r.width + \"px\";\r\n this._publishFormOverlay.style.height = r.height + \"px\";\r\n }\r\n\r\n private _tryPublish() {\r\n this.thumbnail(80, (function (thumb_data) {\r\n this._prepDownloadObj();\r\n axios({\r\n method: 'post',\r\n url: 'https://bp.bleb.li/api/publish',\r\n headers: {\r\n 'Content-Type': \"application/json;charset=UTF-8\"\r\n },\r\n data: {\r\n username: (document.getElementById(\"publishUsername_\" + this._uniqID) as HTMLInputElement).value,\r\n password: (document.getElementById(\"publishPassword_\" + this._uniqID) as HTMLInputElement).value,\r\n plotData: JSON.stringify(this._downloadObj),\r\n plotName: (document.getElementById(\"publishTitle_\" + this._uniqID) as HTMLInputElement).value,\r\n thumb: thumb_data\r\n },\r\n\r\n })\r\n .then((function (response) {\r\n let msg = document.getElementById(\"publishMessage_\" + this._uniqID);\r\n msg.innerText = \"Successfully published plot!\";\r\n msg.className = \"message success\";\r\n document.getElementById(\"publishUsername_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"publishUsernameLabel_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"publishPassword_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"publishPasswordLabel_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"publishTitle_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"publishTitleLabel_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"publishBtn_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"cancelBtn_\" + this._uniqID).style.display = \"none\";\r\n document.getElementById(\"closeBtn_\" + this._uniqID).style.display = \"block\";\r\n\r\n }).bind(this))\r\n .catch((function (response) {\r\n if (response.response.data[\"status\"] === \"not authorized\") {\r\n console.log(\"wrong credentials\");\r\n let msg = document.getElementById(\"publishMessage_\" + this._uniqID);\r\n msg.innerText = \"Invalid username or password.\";\r\n msg.className = \"message warning\";\r\n }\r\n console.log(response);\r\n }).bind(this))\r\n }).bind(this));\r\n }\r\n\r\n private _cancelPublish() {\r\n this._publishFormOverlay.remove();\r\n this._publishFormOverlay = undefined;\r\n }\r\n\r\n private _resetAnimation() {\r\n this._hasAnim = true;\r\n for (let idx = 0; idx < this.plots.length; idx++) {\r\n this.plots[idx].resetAnimation();\r\n }\r\n let boundingBox = this.plots[0].mesh.getBoundingInfo().boundingBox;\r\n let rangeX = [\r\n boundingBox.minimumWorld.x,\r\n boundingBox.maximumWorld.x\r\n ]\r\n let rangeY = [\r\n boundingBox.minimumWorld.y,\r\n boundingBox.maximumWorld.y\r\n ]\r\n let rangeZ = [\r\n boundingBox.minimumWorld.z,\r\n boundingBox.maximumWorld.z\r\n ]\r\n this._axes[0].axisData.range = [rangeX, rangeY, rangeZ]\r\n this._axes[0].update(this.camera, true);\r\n }\r\n\r\n pauseAnimation() {\r\n this.animPaused = true;\r\n this._streamControlBtn.className = \"button streamctrl play\";\r\n }\r\n\r\n playAnimation() {\r\n this.animPaused = false;\r\n this._streamControlBtn.className = \"button streamctrl pause\";\r\n }\r\n\r\n toggleTurntable() {\r\n this.turntable = !this.turntable;\r\n if (this.turntable) {\r\n this._turntableBtn.className = \"button active\";\r\n } else {\r\n this._turntableBtn.className = \"button\";\r\n }\r\n }\r\n\r\n setAnimationFrame() {\r\n for (let idx = 0; idx < this.plots.length; idx++) {\r\n const animPlot = this.plots[idx];\r\n if (animPlot.allLoaded) {\r\n animPlot.goToFrame(parseInt(this._animationSlider.value));\r\n }\r\n }\r\n }\r\n\r\n private _toggleLoopAnimation() {\r\n if (this._loopingAnim) {\r\n this._loopingAnim = false;\r\n for (let idx = 0; idx < this.plots.length; idx++) {\r\n this.plots[idx].setLooping(false);\r\n }\r\n this._loopBtn.className = \"button\";\r\n } else {\r\n this._loopingAnim = true;\r\n for (let idx = 0; idx < this.plots.length; idx++) {\r\n this.plots[idx].setLooping(true);\r\n }\r\n this._loopBtn.className = \"button active\";\r\n }\r\n if (!this._hasAnim) {\r\n this._resetAnimation();\r\n }\r\n\r\n }\r\n\r\n private _startRecording() {\r\n this._recording = true;\r\n }\r\n\r\n /**\r\n * Register before render\r\n */\r\n private _prepRender(): void {\r\n // rotate camera around plot if turntable is true\r\n if (this.turntable) {\r\n this.camera.alpha += this.rotationRate;\r\n }\r\n // update plots with animations\r\n if (this._hasAnim && !this.animPaused) {\r\n let anyAnim = false;\r\n for (let idx = 0; idx < this.plots.length; idx++) {\r\n const animPlot = this.plots[idx];\r\n let animState = animPlot.update();\r\n if (animState) {\r\n anyAnim = true;\r\n if (animPlot.allLoaded && this._streamControlBtn.className === \"button streamctrl loading\") {\r\n this._streamControlBtn.className = \"button streamctrl pause\";\r\n this._animationSlider.disabled = false;\r\n }\r\n if (animPlot.hasOwnProperty(\"frameIndex\")) {\r\n this._animationSlider.value = (animPlot as MeshStream).frameIndex.toString();\r\n }\r\n }\r\n }\r\n this._hasAnim = anyAnim;\r\n if (!this._hasAnim) {\r\n let boundingBox = this.plots[0].mesh.getBoundingInfo().boundingBox;\r\n let rangeX = [\r\n boundingBox.minimumWorld.x,\r\n boundingBox.maximumWorld.x\r\n ]\r\n let rangeY = [\r\n boundingBox.minimumWorld.y,\r\n boundingBox.maximumWorld.y\r\n ]\r\n let rangeZ = [\r\n boundingBox.minimumWorld.z,\r\n boundingBox.maximumWorld.z\r\n ]\r\n this._axes[0].axisData.range = [rangeX, rangeY, rangeZ]\r\n this._axes[0].update(this.camera, true);\r\n }\r\n }\r\n // update axis drawing\r\n if (this._axes) {\r\n for (let i = 0; i < this._axes.length; i++) {\r\n this._axes[i].update(this.camera);\r\n }\r\n }\r\n\r\n if (this._fsUIDirty) {\r\n // create fullscreen GUI texture\r\n this.uiLayer = AdvancedDynamicTexture.CreateFullscreenUI(\"UI\", true, this.scene);\r\n this._updateLegend(this.uiLayer);\r\n this._annotationManager.redrawInfo();\r\n this._fsUIDirty = false;\r\n }\r\n\r\n // update labels\r\n this._annotationManager.update();\r\n\r\n // for (let pltIdx = 0; pltIdx < this.plots.length; pltIdx++) {\r\n // const plot = this.plots[pltIdx];\r\n // plot.update(); \r\n // }\r\n // if (this._mouseOverCheck) {\r\n // const pickResult = this._scene.pick(this._scene.pointerX, this._scene.pointerY);\r\n // const faceId = pickResult.faceId;\r\n // if (faceId == -1) {\r\n // return;\r\n // }\r\n // const idx = this._SPS.pickedParticles[faceId].idx;\r\n // this._mouseOverCallback(idx);\r\n // }\r\n }\r\n\r\n\r\n private _afterRender(): void {\r\n if (this._recording) {\r\n // start recording:\r\n if (this._turned === 0) {\r\n let worker = \"./\";\r\n if (this.R) {\r\n worker = \"lib/babyplots-1/\";\r\n }\r\n this._capturer = new CCapture({\r\n format: \"gif\",\r\n framerate: 30,\r\n verbose: false,\r\n display: false,\r\n quality: 50,\r\n workersPath: worker\r\n });\r\n // create capturer, enable turning\r\n this._capturer.start();\r\n this.rotationRate = 0.02;\r\n // to return turntable option to its initial state after recording\r\n if (this.turntable) {\r\n this._wasTurning = true;\r\n } else {\r\n this.turntable = true;\r\n }\r\n let loadingOverlay = document.createElement(\"div\");\r\n loadingOverlay.className = \"bbp overlay\";\r\n loadingOverlay.id = \"GIFloadingOverlay_\" + this._uniqID;\r\n let loadingText = document.createElement(\"h5\");\r\n loadingText.className = \".loading-message\";\r\n loadingText.innerText = \"Recording GIF...\";\r\n loadingText.id = \"GIFloadingText_\" + this._uniqID;\r\n loadingOverlay.appendChild(loadingText);\r\n this.canvas.parentNode.appendChild(loadingOverlay);\r\n }\r\n // recording in progress:\r\n if (this._turned < 2 * Math.PI) {\r\n // while recording, count rotation and capture screenshots\r\n this._turned += this.rotationRate;\r\n this._capturer.capture(this.canvas);\r\n } else {\r\n // after capturing 360°, stop capturing and save gif\r\n this._recording = false;\r\n this._capturer.stop();\r\n let loadingText = document.getElementById(\"GIFloadingText_\" + this._uniqID);\r\n loadingText.innerText = \"Saving GIF...\";\r\n this._capturer.save((function (blob) {\r\n download(blob, \"babyplots.gif\", 'image/gif');\r\n document.getElementById(\"GIFloadingText_\" + this._uniqID).remove();\r\n document.getElementById(\"GIFloadingOverlay_\" + this._uniqID).remove();\r\n }).bind(this));\r\n this._turned = 0;\r\n this.rotationRate = 0.01;\r\n this._hl2.diffuse = new Color3(0.8, 0.8, 0.8);\r\n if (!this._wasTurning) {\r\n this.turntable = false;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Zoom camera to fit the complete SPS into the field of view\r\n */\r\n private _cameraFitPlot(xRange: number[], yRange: number[], zRange: number[]): void {\r\n let xSize = xRange[1] - xRange[0];\r\n let ySize = yRange[1] - yRange[0];\r\n let zSize = zRange[1] - zRange[0];\r\n let box = BoxBuilder.CreateBox('bdbx', {\r\n width: xSize, height: ySize, depth: zSize\r\n }, this.scene);\r\n let xCenter = xRange[1] - xSize / 2;\r\n let yCenter = yRange[1] - ySize / 2;\r\n let zCenter = zRange[1] - zSize / 2;\r\n box.position = new Vector3(xCenter, yCenter, zCenter);\r\n this.camera.position = new Vector3(xCenter, ySize, zCenter);\r\n this.camera.target = new Vector3(xCenter, yCenter, zCenter);\r\n let radius = box.getBoundingInfo().boundingSphere.radiusWorld;\r\n let aspectRatio = this._engine.getAspectRatio(this.camera);\r\n let halfMinFov = this.camera.fov / 2;\r\n if (aspectRatio < 1) {\r\n halfMinFov = Math.atan(aspectRatio * Math.tan(this.camera.fov / 2));\r\n }\r\n let viewRadius = Math.abs(radius / Math.sin(halfMinFov));\r\n this.camera.radius = viewRadius;\r\n box.dispose();\r\n this.camera.alpha = 0;\r\n this.camera.beta = 1; // 0 is top view, Pi is bottom\r\n this.ymax = yRange[1];\r\n }\r\n\r\n /**\r\n * Creates a 3-dimensional visualization of an RGB image stack, as generated from e.g. a fluorescent microscope, and adds it to the Plots object to visualize it in a canvas. The data must be in a special format for this function which is optimized for size. The easiest way to create this visualization is using the R implementation of babyplots, which includes a function to directly read .tif files.\r\n * \r\n * @param values An array of intensity values. Currently only 8-bit images are supported (0-255).\r\n * @param indices Indices of the values in the original image.\r\n * @param attributes Image attributes. Only a \"dim\" attribute is needed containing the dimensions (x, y, c, z) of the image.\r\n * @param options An object with options to customize the visualization.\r\n * \r\n * Find a list of possible options [here](https://bp.bleb.li/documentation/js#addImgStack).\r\n */\r\n addImgStack(\r\n values: number[],\r\n indices: number[],\r\n attributes: { dim: number[] },\r\n options: {}\r\n ) {\r\n // default options\r\n let opts = {\r\n size: 1,\r\n colorScale: null,\r\n showLegend: false,\r\n fontSize: 11,\r\n fontColor: \"black\",\r\n legendTitle: null,\r\n legendTitleFontSize: 16,\r\n legendTitleFontColor: \"black\",\r\n legendPosition: null,\r\n showAxes: [false, false, false],\r\n axisLabels: [\"X\", \"Y\", \"Z\"],\r\n axisColors: [\"#666666\", \"#666666\", \"#666666\"],\r\n tickBreaks: [2, 2, 2],\r\n showTickLines: [[false, false], [false, false], [false, false]],\r\n tickLineColors: [[\"#aaaaaa\", \"#aaaaaa\"], [\"#aaaaaa\", \"#aaaaaa\"], [\"#aaaaaa\", \"#aaaaaa\"]],\r\n intensityMode: \"alpha\",\r\n channelColors: [\"#ff0000\", \"#00ff00\", \"#0000ff\"],\r\n channelOpacities: [1, 1, 1]\r\n }\r\n // apply user options\r\n Object.assign(opts, options);\r\n // prepare object for download as json button\r\n this._downloadObj[\"plots\"].push({\r\n plotType: \"imageStack\",\r\n values: values,\r\n indices: indices,\r\n attributes: attributes,\r\n size: opts.size,\r\n colorScale: opts.colorScale,\r\n showLegend: opts.showLegend,\r\n fontSize: opts.fontSize,\r\n fontColor: opts.fontColor,\r\n legendTitle: opts.legendTitle,\r\n legendTitleFontSize: opts.legendTitleFontSize,\r\n legendTitleFontColor: opts.legendTitleFontColor,\r\n legendPosition: opts.legendPosition,\r\n showAxes: opts.showAxes,\r\n axisLabels: opts.axisLabels,\r\n axisColors: opts.axisColors,\r\n tickBreaks: opts.tickBreaks,\r\n showTickLines: opts.showTickLines,\r\n tickLineColors: opts.tickLineColors,\r\n intensityMode: opts.intensityMode,\r\n channelColors: opts.channelColors,\r\n channelOpacities: [1, 1, 1]\r\n })\r\n let legendData: LegendData = {\r\n showLegend: false,\r\n discrete: false,\r\n breaks: [],\r\n colorScale: \"\",\r\n inverted: false,\r\n position: opts.legendPosition\r\n }\r\n legendData.fontSize = opts.fontSize;\r\n legendData.fontColor = opts.fontColor;\r\n legendData.legendTitle = opts.legendTitle;\r\n legendData.legendTitleFontSize = opts.legendTitleFontSize;\r\n legendData.legendTitleFontColor = opts.legendTitleFontColor;\r\n\r\n let plot = new ImgStack(\r\n this.scene,\r\n values,\r\n indices,\r\n attributes,\r\n legendData,\r\n opts.size,\r\n this._backgroundColor,\r\n opts.intensityMode,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n opts.channelColors,\r\n opts.channelOpacities\r\n );\r\n this.plots.push(plot);\r\n this._updateLegend(this.uiLayer);\r\n this._cameraFitPlot([0, attributes.dim[2]], [0, attributes.dim[0]], [0, attributes.dim[1]]);\r\n this.camera.wheelPrecision = 1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Creates a plot and adds it to the Plots object to visualize it in a canvas. The plot types section below enumerates the different kinds of visualizations that can be created using this method.\r\n * \r\n * @param coordinates An array of arrays with coordinates of data points.\r\n * @param plotType The name of one of the plot types. Either \"pointCloud\", \"heatMap\", or \"surface\".\r\n * @param colorBy How to interpret the colorVar parameter, either \"direct\", \"categories\", or \"values\". If colorVar is an array of hex strings, colorBy should be \"direct\". If colorVar is an array of discrete values (e.g. category names), colorBy should be \"categories\". If colorVar is an array of continuous values, colorBy should be \"values\".\r\n * @param colorVar an array of hex strings, category names, or values, corresponding to the data points in the coordinates parameter.\r\n * @param options An object with general and plot type specific options.\r\n * \r\n * Find a list of possible options [here](https://bp.bleb.li/documentation/js#addPlot).\r\n */\r\n addPlot(\r\n coordinates: number[][],\r\n plotType: string,\r\n colorBy: string,\r\n colorVar: string[] | number[],\r\n options = {}\r\n ): Plots {\r\n // default options\r\n let opts = {\r\n name: null,\r\n size: 1,\r\n xScale: 1,\r\n yScale: 1,\r\n zScale: 1,\r\n colorScale: \"Oranges\",\r\n customColorScale: [],\r\n colorScaleInverted: false,\r\n sortedCategories: [],\r\n showLegend: false,\r\n fontSize: 11,\r\n fontColor: \"black\",\r\n legendTitle: null,\r\n legendTitleFontSize: 16,\r\n legendTitleFontColor: \"black\",\r\n legendPosition: null,\r\n legendShowShape: false,\r\n showAxes: [false, false, false],\r\n axisLabels: [\"X\", \"Y\", \"Z\"],\r\n axisColors: [\"#666666\", \"#666666\", \"#666666\"],\r\n tickBreaks: [2, 2, 2],\r\n showTickLines: [[false, false], [false, false], [false, false]],\r\n tickLineColors: [[\"#aaaaaa\", \"#aaaaaa\"], [\"#aaaaaa\", \"#aaaaaa\"], [\"#aaaaaa\", \"#aaaaaa\"]],\r\n hasAnimation: false,\r\n animationTargets: null,\r\n animationDelay: null,\r\n animationDuration: null,\r\n animationLoop: false,\r\n foldAnimLoop: null,\r\n colnames: null,\r\n rownames: null,\r\n shape: null,\r\n shading: true,\r\n dpInfo: null,\r\n addClusterLabels: false,\r\n labels: null,\r\n labelSize: undefined,\r\n labelColor: undefined,\r\n // deprecated animation option names:\r\n folded: null,\r\n foldedEmbedding: null,\r\n foldAnimDelay: null,\r\n foldAnimDuration: null,\r\n }\r\n // apply user options\r\n Object.assign(opts, options);\r\n // warnings for deprecated animation option names\r\n // keeping these for a while to not break compatibility, but suggest using the new option names\r\n if (opts.folded) {\r\n deprecationWarning(\"folded\", \"hasAnimation\");\r\n if (!opts.hasAnimation) {\r\n opts.hasAnimation = opts.folded;\r\n }\r\n }\r\n if (opts.foldedEmbedding) {\r\n deprecationWarning(\"foldedEmbedding\", \"animationTargets\");\r\n if (!opts.animationTargets) {\r\n opts.animationTargets = opts.foldedEmbedding;\r\n }\r\n }\r\n if (opts.foldAnimDelay) {\r\n deprecationWarning(\"foldAnimDelay\", \"animationDelay\");\r\n if (!opts.animationDelay) {\r\n opts.animationDelay = opts.foldAnimDelay;\r\n }\r\n }\r\n if (opts.foldAnimDuration) {\r\n deprecationWarning(\"foldAnimDuration\", \"animationDuration\");\r\n if (!opts.animationDuration) {\r\n opts.animationDuration = opts.foldAnimDuration;\r\n }\r\n }\r\n if (opts.foldAnimLoop) {\r\n deprecationWarning(\"foldAnimLoop\", \"animationLoop\");\r\n if (!opts.animationLoop) {\r\n opts.animationLoop = opts.foldAnimLoop;\r\n }\r\n }\r\n // create plot data object for download as json button\r\n this._downloadObj[\"plots\"].push({\r\n plotType: plotType,\r\n coordinates: coordinates,\r\n colorBy: colorBy,\r\n colorVar: colorVar,\r\n name: opts.name,\r\n size: opts.size,\r\n colorScale: opts.colorScale,\r\n customColorScale: opts.customColorScale,\r\n colorScaleInverted: opts.colorScaleInverted,\r\n sortedCategories: opts.sortedCategories,\r\n showLegend: opts.showLegend,\r\n fontSize: opts.fontSize,\r\n fontColor: opts.fontColor,\r\n legendTitle: opts.legendTitle,\r\n legendTitleFontSize: opts.legendTitleFontSize,\r\n legendTitleFontColor: opts.legendTitleFontColor,\r\n legendPosition: opts.legendPosition,\r\n legendShowShape: opts.legendShowShape,\r\n showAxes: opts.showAxes,\r\n axisLabels: opts.axisLabels,\r\n axisColors: opts.axisColors,\r\n tickBreaks: opts.tickBreaks,\r\n showTickLines: opts.showTickLines,\r\n tickLineColors: opts.tickLineColors,\r\n hasAnimation: opts.hasAnimation,\r\n animationTargets: opts.animationTargets,\r\n animationDelay: opts.animationDelay,\r\n animationDuration: opts.animationDuration,\r\n animationLoop: opts.animationLoop,\r\n colnames: opts.colnames,\r\n rownames: opts.rownames,\r\n shape: opts.shape,\r\n shading: opts.shading,\r\n dpInfo: opts.dpInfo,\r\n addClusterLabels: opts.addClusterLabels,\r\n labels: opts.labels,\r\n labelSize: opts.labelSize,\r\n labelColor: opts.labelColor\r\n })\r\n\r\n let coordColors: string[] = [];\r\n var legendData: LegendData;\r\n let rangeX: number[];\r\n let rangeY: number[];\r\n let rangeZ: number[];\r\n this._hasAnim = opts.hasAnimation;\r\n if (opts.hasAnimation) {\r\n let replayBtn = document.createElement(\"div\");\r\n replayBtn.className = \"button\"\r\n replayBtn.innerHTML = buttonSVGs.replay;\r\n replayBtn.onclick = this._resetAnimation.bind(this);\r\n this._buttonBar.appendChild(replayBtn);\r\n let loopBtn = document.createElement(\"div\");\r\n if (opts.animationLoop) {\r\n loopBtn.className = \"button active\"\r\n } else {\r\n loopBtn.className = \"button\"\r\n }\r\n loopBtn.innerHTML = buttonSVGs.loop;\r\n loopBtn.onclick = this._toggleLoopAnimation.bind(this);\r\n this._buttonBar.appendChild(loopBtn);\r\n this._loopBtn = loopBtn;\r\n }\r\n\r\n switch (colorBy) {\r\n case \"categories\":\r\n // color plot by discrete categories\r\n let groups = colorVar as string[];\r\n let uniqueGroups = getUniqueVals(groups);\r\n // sortedCategories can contain an array of category names to order the groups for coloring.\r\n // sortedCategories must be of same length as unique groups in colorVar.\r\n // if no custom ordering is performed through sortedCategories, groups will be sorted alphabetically.\r\n uniqueGroups.sort();\r\n if (opts.sortedCategories) {\r\n if (uniqueGroups.length === opts.sortedCategories.length) {\r\n // sortedCategories must contain the same category names as those present in colorVar.\r\n if (JSON.stringify(uniqueGroups) === JSON.stringify(opts.sortedCategories.slice(0).sort())) {\r\n uniqueGroups = opts.sortedCategories;\r\n }\r\n }\r\n }\r\n let nColors = uniqueGroups.length;\r\n // Paired is default color scale for discrete variable coloring\r\n let colors = chroma.scale(chroma.brewer.Paired).mode('lch').colors(nColors);\r\n // check if color scale should be custom\r\n if (opts.colorScale === \"custom\") {\r\n if (opts.customColorScale !== undefined && opts.customColorScale.length !== 0) {\r\n if (opts.colorScaleInverted) {\r\n colors = chroma.scale(opts.customColorScale).domain([1, 0]).mode('lch').colors(nColors);\r\n } else {\r\n colors = chroma.scale(opts.customColorScale).mode('lch').colors(nColors);\r\n }\r\n } else {\r\n // set colorScale variable to default for legend if custom color scale is invalid\r\n opts.colorScale = \"Paired\";\r\n }\r\n } else {\r\n // check if user selected color scale is a valid chromajs color brewer name\r\n if (opts.colorScale && chroma.brewer.hasOwnProperty(opts.colorScale)) {\r\n if (opts.colorScaleInverted) {\r\n colors = chroma.scale(chroma.brewer[opts.colorScale]).domain([1, 0]).mode('lch').colors(nColors);\r\n } else {\r\n colors = chroma.scale(chroma.brewer[opts.colorScale]).mode('lch').colors(nColors);\r\n }\r\n } else {\r\n // set colorScale variable to default for legend if user selected is not valid\r\n opts.colorScale = \"Paired\";\r\n }\r\n }\r\n for (let i = 0; i < nColors; i++) {\r\n colors[i] += \"ff\";\r\n }\r\n // apply colors to plot points\r\n for (let i = 0; i < colorVar.length; i++) {\r\n let colorIndex = uniqueGroups.indexOf(groups[i]);\r\n coordColors.push(colors[colorIndex]);\r\n }\r\n // prepare object for legend drawing\r\n legendData = {\r\n showLegend: opts.showLegend,\r\n discrete: true,\r\n breaks: uniqueGroups,\r\n colorScale: opts.colorScale,\r\n customColorScale: opts.customColorScale,\r\n inverted: false,\r\n position: opts.legendPosition\r\n }\r\n break;\r\n case \"values\":\r\n // color by a continuous variable\r\n let min = colorVar.min();\r\n let max = colorVar.max();\r\n // Oranges is default color scale for continuous variable coloring\r\n let colorfunc = chroma.scale(chroma.brewer.Oranges).mode('lch');\r\n // check if color scale should be custom\r\n if (opts.colorScale === \"custom\") {\r\n // check if custom color scale is valid\r\n if (opts.customColorScale !== undefined && opts.customColorScale.length !== 0) {\r\n if (opts.colorScaleInverted) {\r\n colorfunc = chroma.scale(opts.customColorScale).domain([1, 0]).mode('lch');\r\n } else {\r\n colorfunc = chroma.scale(opts.customColorScale).mode('lch');\r\n }\r\n } else {\r\n // set colorScale variable to default for legend if custom color scale is invalid\r\n opts.colorScale = \"Oranges\";\r\n }\r\n } else {\r\n // check if user selected color scale is a valid chromajs color brewer name\r\n if (opts.colorScale && chroma.brewer.hasOwnProperty(opts.colorScale)) {\r\n if (opts.colorScaleInverted) {\r\n colorfunc = chroma.scale(chroma.brewer[opts.colorScale]).domain([1, 0]).mode('lch');\r\n } else {\r\n colorfunc = chroma.scale(chroma.brewer[opts.colorScale]).mode('lch');\r\n }\r\n } else {\r\n // set colorScale variable to default for legend if user selected is not valid\r\n opts.colorScale = \"Oranges\";\r\n }\r\n }\r\n // normalize the values to 0-1 range\r\n let norm = (colorVar as number[]).slice().map(v => (v - min) / (max - min));\r\n // apply colors to plot points\r\n coordColors = norm.map(v => colorfunc(v).alpha(1).hex(\"rgba\"));\r\n // prepare object for legend drawing\r\n legendData = {\r\n showLegend: opts.showLegend,\r\n discrete: false,\r\n breaks: [min.toString(), max.toString()],\r\n colorScale: opts.colorScale,\r\n customColorScale: opts.customColorScale,\r\n inverted: opts.colorScaleInverted,\r\n position: opts.legendPosition\r\n }\r\n break;\r\n case \"direct\":\r\n // color by color hex strings in colorVar\r\n for (let i = 0; i < colorVar.length; i++) {\r\n let cl = colorVar[i];\r\n cl = chroma(cl).hex();\r\n if (cl.length == 7) {\r\n cl += \"ff\";\r\n }\r\n coordColors.push(cl);\r\n }\r\n // prepare object for legend drawing\r\n legendData = {\r\n showLegend: false,\r\n discrete: false,\r\n breaks: [],\r\n colorScale: \"\",\r\n customColorScale: opts.customColorScale,\r\n inverted: false,\r\n position: opts.legendPosition\r\n }\r\n break;\r\n }\r\n // add remaining properties to legend object\r\n legendData.fontSize = opts.fontSize;\r\n legendData.fontColor = opts.fontColor;\r\n legendData.legendTitle = opts.legendTitle;\r\n legendData.legendTitleFontSize = opts.legendTitleFontSize;\r\n legendData.legendTitleFontColor = opts.legendTitleFontColor;\r\n legendData.showShape = opts.legendShowShape;\r\n\r\n let plot: Plot;\r\n let scale: number[];\r\n let boundingBox: BoundingBox;\r\n switch (plotType) {\r\n case \"pointCloud\":\r\n plot = new PointCloud(\r\n this.scene,\r\n coordinates,\r\n coordColors,\r\n opts.size,\r\n legendData,\r\n opts.hasAnimation,\r\n opts.animationTargets,\r\n opts.animationDelay,\r\n opts.animationDuration,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n opts.name,\r\n opts.addClusterLabels,\r\n this._annotationManager\r\n );\r\n boundingBox = plot.mesh.getBoundingInfo().boundingBox;\r\n rangeX = [\r\n boundingBox.minimumWorld.x,\r\n boundingBox.maximumWorld.x\r\n ]\r\n rangeY = [\r\n boundingBox.minimumWorld.y,\r\n boundingBox.maximumWorld.y\r\n ]\r\n rangeZ = [\r\n boundingBox.minimumWorld.z,\r\n boundingBox.maximumWorld.z\r\n ]\r\n scale = [\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n ]\r\n break;\r\n case \"surface\":\r\n plot = new Surface(\r\n this.scene,\r\n coordinates,\r\n coordColors,\r\n opts.size,\r\n legendData,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n opts.name\r\n );\r\n rangeX = [0, coordinates.length * this._xScale];\r\n rangeZ = [0, coordinates[0].length * this._zScale];\r\n rangeY = [\r\n matrixMin(coordinates) * this._yScale,\r\n matrixMax(coordinates) * this._yScale\r\n ];\r\n scale = [\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n ]\r\n break\r\n case \"shapeCloud\":\r\n plot = new ShapeCloud(\r\n this.scene,\r\n coordinates,\r\n coordColors,\r\n opts.shape,\r\n opts.shading,\r\n opts.size,\r\n legendData,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n opts.name,\r\n opts.dpInfo\r\n );\r\n boundingBox = plot.mesh.getBoundingInfo().boundingBox;\r\n rangeX = [\r\n boundingBox.minimumWorld.x,\r\n boundingBox.maximumWorld.x\r\n ]\r\n rangeY = [\r\n boundingBox.minimumWorld.y,\r\n boundingBox.maximumWorld.y\r\n ]\r\n rangeZ = [\r\n boundingBox.minimumWorld.z,\r\n boundingBox.maximumWorld.z\r\n ]\r\n scale = [\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n ]\r\n break;\r\n case \"heatMap\":\r\n plot = new HeatMap(\r\n this.scene,\r\n coordinates,\r\n coordColors,\r\n opts.size,\r\n legendData,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n opts.name\r\n );\r\n rangeX = [0, coordinates.length * this._xScale];\r\n rangeZ = [0, coordinates[0].length * this._zScale];\r\n rangeY = [\r\n matrixMin(coordinates) * this._yScale,\r\n matrixMax(coordinates) * this._yScale\r\n ];\r\n scale = [\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n ]\r\n break\r\n case \"line\":\r\n plot = new Line(\r\n this.scene,\r\n coordinates,\r\n coordColors,\r\n opts.size,\r\n legendData,\r\n opts.hasAnimation,\r\n opts.animationDelay,\r\n opts.animationDuration,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n opts.name,\r\n opts.labels,\r\n opts.labelSize,\r\n opts.labelColor,\r\n this._annotationManager\r\n )\r\n boundingBox = plot.mesh.getBoundingInfo().boundingBox;\r\n rangeX = [\r\n boundingBox.minimumWorld.x,\r\n boundingBox.maximumWorld.x\r\n ]\r\n rangeY = [\r\n boundingBox.minimumWorld.y,\r\n boundingBox.maximumWorld.y\r\n ]\r\n rangeZ = [\r\n boundingBox.minimumWorld.z,\r\n boundingBox.maximumWorld.z\r\n ]\r\n scale = [\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n ]\r\n break;\r\n }\r\n\r\n if (opts.animationLoop) {\r\n this._loopingAnim = true;\r\n plot.setLooping(true);\r\n }\r\n this.plots.push(plot);\r\n this._fsUIDirty = true;\r\n let axisData: AxisData = {\r\n showAxes: opts.showAxes,\r\n static: true,\r\n axisLabels: opts.axisLabels,\r\n range: [rangeX, rangeY, rangeZ],\r\n color: opts.axisColors,\r\n scale: scale,\r\n tickBreaks: opts.tickBreaks,\r\n showTickLines: opts.showTickLines,\r\n tickLineColor: opts.tickLineColors,\r\n showPlanes: [false, false, false],\r\n planeColor: [\"#cccccc88\", \"#cccccc88\", \"#cccccc88\"],\r\n plotType: plotType,\r\n colnames: opts.colnames,\r\n rownames: opts.rownames\r\n }\r\n this._axes.push(new Axes(axisData, this.scene, plotType == \"heatMap\"));\r\n this._cameraFitPlot(rangeX, rangeY, rangeZ);\r\n return this\r\n }\r\n\r\n /**\r\n * \r\n * @param meshString A glTF object string\r\n * @param options An object with general and plot type specific options.\r\n * \r\n * Find a list of possible options [here](https://bp.bleb.li/documentation/js#addMeshStream).\r\n */\r\n addMeshObject(\r\n meshString: string,\r\n options: {}\r\n ): Plots {\r\n // default options\r\n let opts = {\r\n meshScaling: [1, 1, 1],\r\n meshRotation: [0, 0, 0],\r\n meshOffset: [0, 0, 0]\r\n }\r\n // apply user options\r\n Object.assign(opts, options);\r\n // prepare object for download as json button\r\n this._downloadObj[\"plots\"].push({\r\n plotType: \"meshObject\",\r\n meshString: meshString,\r\n meshScaling: opts.meshScaling,\r\n meshRotation: opts.meshRotation,\r\n meshOffset: opts.meshOffset\r\n });\r\n\r\n let legendData: LegendData = {\r\n showLegend: false,\r\n discrete: false,\r\n breaks: [],\r\n colorScale: \"\",\r\n inverted: false,\r\n position: undefined\r\n };\r\n\r\n let plot = new MeshObject(\r\n this.scene,\r\n meshString,\r\n legendData,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n opts.meshScaling,\r\n opts.meshRotation,\r\n opts.meshOffset\r\n );\r\n\r\n this.plots.push(plot);\r\n return this\r\n }\r\n\r\n /**\r\n * Streams meshes from a url and displays them sequentially.\r\n * \r\n * @param rootUrl \r\n * @param filePrefix \r\n * @param fileSuffix \r\n * @param fileIteratorStart \r\n * @param fileIteratorEnd \r\n * @param options An object with general and plot type specific options.\r\n * \r\n * Find a list of possible options [here](https://bp.bleb.li/documentation/js#addMeshStream).\r\n */\r\n addMeshStream(\r\n rootUrl: string,\r\n filePrefix: string,\r\n fileSuffix: string,\r\n fileIteratorStart: number,\r\n fileIteratorEnd: number,\r\n frameDelay: number,\r\n options: {}\r\n ): Plots {\r\n // default options\r\n let opts = {\r\n meshRotation: [0, 0, 0],\r\n meshOffset: [0, 0, 0],\r\n clearCoat: false,\r\n clearCoatIntensity: 1,\r\n }\r\n // apply user options\r\n Object.assign(opts, options);\r\n // prepare object for download as json button\r\n this._downloadObj[\"plots\"].push({\r\n plotType: \"meshStream\",\r\n rootUrl: rootUrl,\r\n filePrefix: filePrefix,\r\n fileSuffix: fileSuffix,\r\n fileIteratorStart: fileIteratorStart,\r\n fileIteratorEnd: fileIteratorEnd,\r\n frameDelay: frameDelay,\r\n meshRotation: opts.meshRotation,\r\n meshOffset: opts.meshOffset,\r\n clearCoat: opts.clearCoat,\r\n clearCoatIntensity: opts.clearCoatIntensity\r\n });\r\n\r\n let legendData: LegendData = {\r\n showLegend: false,\r\n discrete: false,\r\n breaks: [],\r\n colorScale: \"\",\r\n inverted: false,\r\n position: undefined\r\n };\r\n\r\n let plot = new MeshStream(\r\n this.scene,\r\n rootUrl,\r\n filePrefix,\r\n fileSuffix,\r\n fileIteratorStart,\r\n fileIteratorEnd,\r\n legendData,\r\n this._xScale,\r\n this._yScale,\r\n this._zScale,\r\n frameDelay,\r\n opts.meshRotation,\r\n opts.meshOffset,\r\n opts.clearCoat,\r\n opts.clearCoatIntensity\r\n );\r\n this._hasAnim = true;\r\n this.plots.push(plot);\r\n // this._updateLegend(this.uiLayer);\r\n // this._cameraFitPlot([0, attributes.dim[2]], [0, attributes.dim[0]], [0, attributes.dim[1]]);\r\n this.camera.wheelPrecision = 1;\r\n\r\n this._streamControlBtn.className = \"button streamctrl loading\";\r\n this._animationSlider.max = (plot.frameTotal - 1).toString();\r\n this._animationSlider.className = \"anim-slider\";\r\n\r\n // let replayBtn = document.createElement(\"div\");\r\n // replayBtn.className = \"button\"\r\n // replayBtn.innerHTML = buttonSVGs.replay;\r\n // replayBtn.onclick = this._resetAnimation.bind(this);\r\n // let loopBtn = document.createElement(\"div\");\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Creates a color legend for the plots\r\n */\r\n private _updateLegend(uiLayer: AdvancedDynamicTexture): void {\r\n if (this._legend) { this._legend.dispose(); }\r\n\r\n let rightFree = true;\r\n let leftFree = true;\r\n let spaceLeft: number;\r\n let spaceRight: number;\r\n let shapeSpace = 0;\r\n let shapes = [];\r\n for (let i = 0; i < this.plots.length; i++) {\r\n const plot = this.plots[i];\r\n let legendData = plot.legendData;\r\n if (!legendData.legendTitleFontSize) {\r\n legendData.legendTitleFontSize = 16;\r\n }\r\n if (!legendData.fontSize) {\r\n legendData.fontSize = 12;\r\n }\r\n if ([\"right\", \"left\"].indexOf(legendData.position) === -1) {\r\n legendData.position = null;\r\n }\r\n if (legendData.showShape) {\r\n shapeSpace += legendData.fontSize + 5;\r\n shapes.push([plot.name, plot.shape]);\r\n }\r\n if (legendData.showLegend) {\r\n if (legendData.position === null) {\r\n if (rightFree) {\r\n legendData.position = \"right\";\r\n rightFree = false;\r\n if (legendData.discrete) {\r\n spaceRight = legendData.breaks.length * (legendData.fontSize + 2);\r\n } else {\r\n spaceRight = 115;\r\n }\r\n } else if (leftFree) {\r\n legendData.position = \"left\";\r\n leftFree = false;\r\n if (legendData.discrete) {\r\n spaceLeft = legendData.breaks.length * (legendData.fontSize + 2);\r\n } else {\r\n spaceLeft = 115;\r\n }\r\n } else {\r\n legendData.showLegend = false;\r\n }\r\n } else {\r\n if (legendData.position === \"right\") {\r\n rightFree = false;\r\n if (legendData.discrete) {\r\n spaceRight = legendData.breaks.length * (legendData.fontSize + 2);\r\n } else {\r\n spaceRight = 115;\r\n }\r\n } else {\r\n leftFree = false;\r\n if (legendData.discrete) {\r\n spaceRight = legendData.breaks.length * (legendData.fontSize + 2);\r\n } else {\r\n spaceRight = 115;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // if shape legend is requested, decide on which side it should be placed:\r\n if (shapeSpace > 0) {\r\n if (this.shapeLegendTitle && this.shapeLegendTitle !== \"\") {\r\n shapeSpace += 100;\r\n }\r\n if (rightFree) {\r\n this._shapeLegendPosition = \"right\";\r\n } else if (leftFree) {\r\n this._shapeLegendPosition = \"left\";\r\n } else {\r\n if (spaceRight <= spaceLeft) {\r\n this._shapeLegendPosition = \"right\";\r\n } else {\r\n this._shapeLegendPosition = \"left\";\r\n }\r\n }\r\n }\r\n\r\n\r\n let shapeLegendData: shapeLegendData = {\r\n title: this.shapeLegendTitle,\r\n spacing: shapeSpace,\r\n shapes: shapes\r\n }\r\n\r\n let shapeLegendDrawn = false;\r\n for (let i = 0; i < this.plots.length; i++) {\r\n const lgndData = this.plots[i].legendData;\r\n if (lgndData.showLegend) {\r\n if (lgndData.position === this._shapeLegendPosition) {\r\n uiLayer = this._createPlotLegend(lgndData, uiLayer, shapeLegendData);\r\n shapeLegendDrawn = true;\r\n } else {\r\n uiLayer = this._createPlotLegend(lgndData, uiLayer);\r\n }\r\n }\r\n }\r\n\r\n if (!shapeLegendDrawn) {\r\n this._drawStandaloneShapeLegend(uiLayer, shapeSpace, shapeLegendData);\r\n }\r\n\r\n this._legend = uiLayer;\r\n }\r\n\r\n private _drawStandaloneShapeLegend(uiLayer: AdvancedDynamicTexture, shapeSpace: number, shapeLegendData: shapeLegendData) {\r\n let grid = new Grid();\r\n uiLayer.addControl(grid);\r\n\r\n let padding = (this.canvas.height - shapeSpace / 2) / 2;\r\n grid.addRowDefinition(padding, true);\r\n grid.addRowDefinition(shapeSpace, true);\r\n grid.addRowDefinition(padding, true);\r\n\r\n let legendWidth = 0.2;\r\n let legendColumn = 1;\r\n if (this._shapeLegendPosition === \"right\") {\r\n grid.addColumnDefinition(1 - legendWidth);\r\n grid.addColumnDefinition(legendWidth);\r\n } else {\r\n grid.addColumnDefinition(legendWidth);\r\n grid.addColumnDefinition(1 - legendWidth);\r\n legendColumn = 0;\r\n }\r\n\r\n let shapeLegendGrid = this._createShapeLegend(this.plots[0].legendData, shapeLegendData);\r\n\r\n grid.addControl(shapeLegendGrid, 1, legendColumn);\r\n }\r\n\r\n private _createPlotLegend(legendData: LegendData, uiLayer: AdvancedDynamicTexture, shapeLegendData?: shapeLegendData): AdvancedDynamicTexture {\r\n if (!legendData.showLegend) {\r\n return uiLayer;\r\n }\r\n // create grid for placing legend in correct position\r\n let grid = new Grid();\r\n uiLayer.addControl(grid);\r\n\r\n let n = legendData.breaks.length;\r\n let breakN: number;\r\n let legendWidth = 0.2;\r\n let nCols = 1;\r\n\r\n let legendBodyHeight = 0.9;\r\n let legendMinPixels: number;\r\n if (legendData.discrete) {\r\n legendMinPixels = legendData.breaks.length * (legendData.fontSize + 2);\r\n } else {\r\n legendMinPixels = 115;\r\n }\r\n if (legendData.legendTitle && legendData.legendTitle !== \"\") {\r\n legendMinPixels += legendData.legendTitleFontSize + 5;\r\n }\r\n\r\n // main position of legend (right middle)\r\n if (shapeLegendData !== undefined) {\r\n grid.addRowDefinition(0.05);\r\n let totalReqPixels = legendMinPixels + shapeLegendData.spacing;\r\n legendBodyHeight = legendMinPixels / totalReqPixels;\r\n let shapeBodyHeight = shapeLegendData.spacing / totalReqPixels;\r\n grid.addRowDefinition(legendBodyHeight - 0.05);\r\n grid.addRowDefinition(shapeBodyHeight - 0.05);\r\n grid.addRowDefinition(0.05);\r\n }\r\n else {\r\n grid.addRowDefinition(0.05);\r\n grid.addRowDefinition(legendBodyHeight);\r\n grid.addRowDefinition(0.05);\r\n }\r\n\r\n if (legendData.discrete) {\r\n legendData.fontSize;\r\n nCols = Math.ceil(((legendData.fontSize + 2) * n) / (legendBodyHeight * this.canvas.height * 0.7));\r\n\r\n breakN = Math.ceil(n / nCols);\r\n\r\n legendWidth = 0.1 + (0.1 * nCols);\r\n }\r\n\r\n let legendColumn = 1;\r\n if (legendData.position === \"right\") {\r\n grid.addColumnDefinition(1 - legendWidth);\r\n grid.addColumnDefinition(legendWidth);\r\n } else {\r\n grid.addColumnDefinition(legendWidth);\r\n grid.addColumnDefinition(1 - legendWidth);\r\n legendColumn = 0;\r\n }\r\n\r\n // create shape legend\r\n\r\n if (shapeLegendData) {\r\n\r\n let shapeLegendGrid = this._createShapeLegend(legendData, shapeLegendData);\r\n\r\n grid.addControl(shapeLegendGrid, 2, legendColumn);\r\n }\r\n\r\n let legendBody = new Grid();\r\n\r\n legendBody.paddingLeftInPixels = 10;\r\n legendBody.paddingRightInPixels = 10;\r\n\r\n legendBody.addRowDefinition(0.2);\r\n legendBody.addRowDefinition(0.7);\r\n legendBody.addRowDefinition(0.1);\r\n\r\n grid.addControl(legendBody, 1, legendColumn);\r\n\r\n if (legendData.legendTitle && legendData.legendTitle !== \"\") {\r\n let legendTitle = new TextBlock();\r\n legendTitle.text = legendData.legendTitle;\r\n legendTitle.color = legendData.legendTitleFontColor;\r\n legendTitle.fontWeight = \"bold\";\r\n legendTitle.fontSize = legendData.legendTitleFontSize + \"px\";\r\n legendTitle.verticalAlignment = Control.VERTICAL_ALIGNMENT_BOTTOM;\r\n legendTitle.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n legendTitle.textWrapping = true;\r\n legendBody.addControl(legendTitle, 0, legendColumn);\r\n }\r\n\r\n // for continuous measures display color bar and max and min values.\r\n if (!legendData.discrete) {\r\n\r\n let innerGrid = new Grid();\r\n innerGrid.addColumnDefinition(0.2);\r\n innerGrid.addColumnDefinition(0.8);\r\n legendBody.addControl(innerGrid, 1, 0);\r\n\r\n let nBreaks = 115;\r\n let labelSpace = 0.15;\r\n if (legendBodyHeight * this.canvas.height * 0.7 < 100) {\r\n nBreaks = 10;\r\n labelSpace = 0.45;\r\n innerGrid.addRowDefinition(1);\r\n }\r\n else if (legendBodyHeight * this.canvas.height * 0.7 < 150) {\r\n nBreaks = 50;\r\n labelSpace = 0.3;\r\n innerGrid.addRowDefinition(1);\r\n }\r\n else {\r\n let padding = ((legendBodyHeight * this.canvas.height * 0.7) - 115) / 2;\r\n innerGrid.addRowDefinition(padding, true);\r\n innerGrid.addRowDefinition(115, true);\r\n innerGrid.addRowDefinition(padding, true);\r\n }\r\n // color bar\r\n let colors: string[];\r\n if (legendData.colorScale === \"custom\") {\r\n colors = chroma.scale(legendData.customColorScale).mode('lch').colors(nBreaks);\r\n }\r\n else {\r\n colors = chroma.scale(chroma.brewer[legendData.colorScale]).mode('lch').colors(nBreaks);\r\n }\r\n let scaleGrid = new Grid();\r\n for (let i = 0; i < nBreaks; i++) {\r\n scaleGrid.addRowDefinition(1 / nBreaks);\r\n let legendColor = new Rectangle();\r\n if (legendData.inverted) {\r\n legendColor.background = colors[i];\r\n }\r\n else {\r\n legendColor.background = colors[colors.length - i - 1];\r\n }\r\n legendColor.thickness = 0;\r\n legendColor.width = 0.5;\r\n legendColor.height = 1;\r\n scaleGrid.addControl(legendColor, i, 0);\r\n }\r\n\r\n // label text\r\n let labelGrid = new Grid();\r\n labelGrid.addColumnDefinition(1);\r\n labelGrid.addRowDefinition(labelSpace);\r\n labelGrid.addRowDefinition(1 - labelSpace * 2);\r\n labelGrid.addRowDefinition(labelSpace);\r\n\r\n if (this.canvas.height < 130) {\r\n innerGrid.addControl(scaleGrid, 0, 0);\r\n innerGrid.addControl(labelGrid, 0, 1);\r\n }\r\n else {\r\n innerGrid.addControl(scaleGrid, 1, 0);\r\n innerGrid.addControl(labelGrid, 1, 1);\r\n }\r\n\r\n let minText = new TextBlock();\r\n minText.text = parseFloat(legendData.breaks[0]).toFixed(2);\r\n minText.color = legendData.fontColor;\r\n minText.fontSize = legendData.fontSize + \"px\";\r\n minText.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n labelGrid.addControl(minText, 2, 0);\r\n\r\n let maxText = new TextBlock();\r\n maxText.text = parseFloat(legendData.breaks[1]).toFixed(2);\r\n maxText.color = legendData.fontColor;\r\n maxText.fontSize = legendData.fontSize + \"px\";\r\n maxText.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n labelGrid.addControl(maxText, 0, 0);\r\n }\r\n else {\r\n // inner Grid contains legend rows and columns for color and text\r\n let innerGrid = new Grid();\r\n // define number of columns by the number of categories.\r\n if (nCols > 1) {\r\n for (let i = 0; i < nCols; i++) {\r\n innerGrid.addColumnDefinition(0.1);\r\n innerGrid.addColumnDefinition(0.4);\r\n }\r\n }\r\n else {\r\n innerGrid.addColumnDefinition(0.1);\r\n innerGrid.addColumnDefinition(0.9);\r\n }\r\n for (let i = 0; i < n && i < breakN; i++) {\r\n if (n > breakN) {\r\n innerGrid.addRowDefinition(1 / breakN);\r\n }\r\n else {\r\n innerGrid.addRowDefinition(1 / n);\r\n }\r\n }\r\n legendBody.addControl(innerGrid, 1, 0);\r\n\r\n let colors: string[];\r\n if (legendData.colorScale === \"custom\") {\r\n colors = chroma.scale(legendData.customColorScale).mode('lch').colors(n);\r\n }\r\n else {\r\n colors = chroma.scale(chroma.brewer[legendData.colorScale]).mode('lch').colors(n);\r\n }\r\n\r\n // add color box and legend text\r\n for (let i = 0; i < n; i++) {\r\n // color\r\n let legendColor = new Rectangle();\r\n legendColor.background = colors[i];\r\n legendColor.thickness = 0;\r\n legendColor.width = legendData.fontSize + \"px\";\r\n legendColor.height = legendData.fontSize + \"px\";\r\n\r\n let column = Math.floor(i / breakN);\r\n let row = i - column * breakN;\r\n\r\n innerGrid.addControl(legendColor, row, column * 2);\r\n\r\n // text\r\n let legendText = new TextBlock();\r\n legendText.text = legendData.breaks[i].toString();\r\n legendText.color = legendData.fontColor;\r\n legendText.fontSize = legendData.fontSize + \"px\";\r\n legendText.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n\r\n innerGrid.addControl(legendText, row, column * 2 + 1);\r\n }\r\n }\r\n return uiLayer;\r\n }\r\n\r\n private _createShapeLegend(legendData: LegendData, shapeLegendData: shapeLegendData) {\r\n let shapeLegendGrid = new Grid();\r\n legendData.fontColor = legendData.fontColor || \"black\";\r\n legendData.fontSize = legendData.fontSize || 11;\r\n legendData.legendTitleFontColor = legendData.legendTitleFontColor || \"black\";\r\n legendData.legendTitleFontSize = legendData.legendTitleFontSize || 16;\r\n if (shapeLegendData.title && shapeLegendData.title !== \"\") {\r\n shapeLegendGrid.paddingLeftInPixels = 10;\r\n shapeLegendGrid.paddingRightInPixels = 10;\r\n shapeLegendGrid.addRowDefinition(legendData.legendTitleFontSize + 5, true);\r\n shapeLegendGrid.addRowDefinition(shapeLegendData.spacing - (legendData.legendTitleFontSize + 5), true);\r\n shapeLegendGrid.addRowDefinition(0.05);\r\n // shape legend title\r\n let shapeLegendTitle = new TextBlock();\r\n shapeLegendTitle.text = shapeLegendData.title;\r\n shapeLegendTitle.color = legendData.legendTitleFontColor;\r\n shapeLegendTitle.fontWeight = \"bold\";\r\n if (legendData.legendTitleFontSize) {\r\n shapeLegendTitle.fontSize = legendData.legendTitleFontSize + \"px\";\r\n }\r\n else {\r\n shapeLegendTitle.fontSize = \"16px\";\r\n }\r\n shapeLegendTitle.verticalAlignment = Control.VERTICAL_ALIGNMENT_BOTTOM;\r\n shapeLegendTitle.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n shapeLegendTitle.textWrapping = true;\r\n shapeLegendGrid.addControl(shapeLegendTitle, 0, 0);\r\n } else {\r\n shapeLegendGrid.addRowDefinition(0.05);\r\n shapeLegendGrid.addRowDefinition(shapeLegendData.spacing, true);\r\n shapeLegendGrid.addRowDefinition(0.05);\r\n }\r\n let shapeLegendBody = new Grid();\r\n shapeLegendBody.addColumnDefinition(legendData.fontSize + 6, true);\r\n shapeLegendBody.addColumnDefinition(0.9);\r\n let rowHeight = 1 / shapeLegendData.shapes.length;\r\n for (let i = 0; i < shapeLegendData.shapes.length; i++) {\r\n const shapeDef = shapeLegendData.shapes[i];\r\n shapeLegendBody.addRowDefinition(rowHeight);\r\n // shape\r\n let url = \"data:image/svg+xml;base64,\" + window.btoa(legendSVGs[shapeDef[1]]);\r\n let shapeIcon = new Image(shapeDef[0], url);\r\n shapeIcon.width = legendData.fontSize + 2 + \"px\";\r\n shapeIcon.height = legendData.fontSize + 2 + \"px\";\r\n\r\n shapeLegendBody.addControl(shapeIcon, i, 0);\r\n\r\n // text\r\n let shapeText = new TextBlock();\r\n shapeText.text = shapeDef[0];\r\n shapeText.color = legendData.fontColor;\r\n shapeText.fontSize = legendData.fontSize + \"px\";\r\n shapeText.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n\r\n shapeLegendBody.addControl(shapeText, i, 1);\r\n }\r\n\r\n shapeLegendGrid.addControl(shapeLegendBody, 1, 0);\r\n return shapeLegendGrid;\r\n }\r\n\r\n /**\r\n * Start rendering the scene\r\n */\r\n doRender(): Plots {\r\n this._engine.runRenderLoop(() => {\r\n this.scene.render();\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Resizes the visualization to the current size of the canvas. This method should be bound to a resize event of the canvas. It is also recommended to call the resize() method once after the doRender() call.\r\n * \r\n * @param width Optional: Width of the canvas\r\n * @param height Optional: Height of the canvas\r\n */\r\n resize(width?: number, height?: number): Plots {\r\n if (width !== undefined && height !== undefined) {\r\n if (this.R) {\r\n let pad = parseInt(document.body.style.padding.substring(0, document.body.style.padding.length - 2));\r\n this.canvas.width = width - 2 * pad;\r\n this.canvas.height = height - 2 * pad;\r\n } else {\r\n this.canvas.width = width;\r\n this.canvas.height = height;\r\n }\r\n }\r\n this._fsUIDirty = true;\r\n this._resizePublishOverlay();\r\n this._engine.resize();\r\n return this\r\n }\r\n\r\n /**\r\n * Saves a screenshot of the visualization.\r\n * \r\n * @param size Width and height of square thumbnail in pixels\r\n * @param saveCallback Function that takes the created screenshot as base64 encoded string.\r\n */\r\n thumbnail(size: number, saveCallback: (data: string) => void): void {\r\n ScreenshotTools.CreateScreenshot(this._engine, this.camera, size, saveCallback);\r\n }\r\n\r\n /**\r\n * Releases all held resources of the Plots visualization. Useful to clear memory, after a visualization is no longer needed.\r\n */\r\n dispose(): void {\r\n this.scene.dispose();\r\n this._engine.dispose();\r\n // remove UI\r\n let btnbar = document.getElementById(\"buttonBar_\" + this._uniqID);\r\n btnbar.remove();\r\n let lblCntrl = document.getElementById(\"labelControl_\" + this._uniqID);\r\n lblCntrl.remove();\r\n }\r\n\r\n /**\r\n * Add labels from a list of labels.\r\n * \r\n * @param labelList List of lists with the first three elements of the inner lists being the x, y and z coordinates, and the fourth the label text.\r\n */\r\n addLabels(labelList: [[number, number, number, string, string?, number?]]): void {\r\n this._annotationManager.addLabels(labelList);\r\n }\r\n\r\n}\r\n","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { Color3, Vector3 } from \"@babylonjs/core/Maths/math\";\r\nimport { BoxBuilder } from \"@babylonjs/core/Meshes/Builders/boxBuilder\";\r\nimport { PlaneBuilder } from \"@babylonjs/core/Meshes/Builders/planeBuilder\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { CoordinatePlot, LegendData} from \"../babyplots\";\r\n\r\nexport class HeatMap extends CoordinatePlot {\r\n constructor(\r\n scene: Scene,\r\n coordinates: number[][],\r\n colorVar: string[],\r\n size: number,\r\n legendData: LegendData,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n name: string = \"heat map\"\r\n ) {\r\n super(name, \"heatmap\", scene, coordinates, colorVar, size, legendData, xScale, yScale, zScale);\r\n this._createHeatMap();\r\n this.allLoaded = true;\r\n }\r\n private _createHeatMap(): void {\r\n let boxes = [];\r\n for (let row = 0; row < this._coords.length; row++) {\r\n const rowCoords = this._coords[row];\r\n for (let column = 0; column < rowCoords.length; column++) {\r\n const coord = rowCoords[column];\r\n if (coord > 0) {\r\n let height = coord * this.yScale;\r\n let box = BoxBuilder.CreateBox(\"box_\" + row + \"-\" + column, {\r\n height: height,\r\n width: this.xScale * this._size,\r\n depth: this.zScale * this._size\r\n }, this._scene);\r\n box.position = new Vector3(\r\n row * this.xScale + 0.5 * this.xScale,\r\n height / 2,\r\n column * this.zScale + 0.5 * this.zScale\r\n );\r\n let mat = new StandardMaterial(\"box_\" + row + \"-\" + column + \"_color\", this._scene);\r\n mat.alpha = 1;\r\n mat.diffuseColor = Color3.FromHexString(\r\n this._coordColors[column + row * rowCoords.length].substring(0, 7)\r\n );\r\n box.material = mat;\r\n boxes.push(box);\r\n }\r\n else {\r\n let box = PlaneBuilder.CreatePlane(\r\n \"box_\" + row + \"-\" + column,\r\n {\r\n width: this.xScale * this._size,\r\n height: this.zScale * this._size\r\n }, this._scene);\r\n box.position = new Vector3(\r\n row * this.xScale + 0.5 * this.xScale,\r\n 0,\r\n column * this.zScale + 0.5 * this.zScale\r\n );\r\n box.rotation.x = Math.PI / 2;\r\n let mat = new StandardMaterial(\"box_\" + row + \"-\" + column + \"_color\", this._scene);\r\n mat.alpha = 1;\r\n mat.diffuseColor = Color3.FromHexString(\r\n this._coordColors[column + row * rowCoords.length].substring(0, 7)\r\n );\r\n mat.backFaceCulling = false;\r\n box.material = mat;\r\n boxes.push(box);\r\n }\r\n }\r\n }\r\n this.meshes = boxes;\r\n Object.defineProperty(this, \"alpha\", {\r\n set(newAlpha) {\r\n for (let i = 0; i < this.meshes.length; i++) {\r\n const box = this.meshes[i] as Mesh;\r\n box.material.alpha = newAlpha;\r\n }\r\n }\r\n });\r\n }\r\n}\r\n","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { Color3 } from \"@babylonjs/core/Maths/math\";\r\nimport { VertexData } from \"@babylonjs/core/Meshes/mesh.vertexData\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { Plot, LegendData } from \"../babyplots\";\r\nimport chroma from \"chroma-js\";\r\n\r\n\r\n\r\nexport class ImgStack extends Plot {\r\n private _backgroundColor: string;\r\n private _intensityMode: string;\r\n private _channelCoords: number[][][];\r\n private _channelCoordIntensities: number[][];\r\n private _channelColors: string[];\r\n private _channelOpacities: number[];\r\n\r\n size: number;\r\n\r\n constructor(\r\n scene: Scene,\r\n values: number[],\r\n indices: number[],\r\n attributes: { dim: number[] },\r\n legendData: LegendData,\r\n size: number,\r\n backgroundColor: string,\r\n intensityMode: string,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n channelColors: string[] = [\"#ff0000\", \"#00ff00\", \"#0000ff\"],\r\n channelOpacities: number[] = [1, 1, 1],\r\n name: string = \"image stack\"\r\n ) {\r\n let colSize = attributes.dim[0];\r\n let rowSize = attributes.dim[1];\r\n let channels = attributes.dim[2];\r\n let slices = attributes.dim[3];\r\n let channelSize = colSize * rowSize;\r\n let sliceSize = channelSize * channels;\r\n let coords = [];\r\n let Intensities = [];\r\n for (let i = 0; i < channels; i++) {\r\n coords.push([]);\r\n Intensities.push([]);\r\n }\r\n for (let i = 0; i < indices.length; i++) {\r\n const index = indices[i];\r\n let slice = Math.floor(index / sliceSize);\r\n let sliceIndex = index - sliceSize * slice;\r\n let channel = Math.floor(sliceIndex / channelSize);\r\n let channelIndex = sliceIndex - channelSize * channel;\r\n let row = Math.floor(channelIndex / colSize);\r\n let col = channelIndex % colSize;\r\n coords[channel].push([\r\n col * xScale,\r\n row * yScale,\r\n slice * zScale\r\n ]);\r\n Intensities[channel].push(values[i]);\r\n }\r\n super(name, \"imgStack\", scene, legendData, xScale, yScale, zScale);\r\n this.size = size;\r\n this.legendData\r\n this._channelCoords = coords;\r\n this._channelCoordIntensities = Intensities;\r\n this._backgroundColor = backgroundColor;\r\n this._intensityMode = intensityMode;\r\n this._channelColors = channelColors;\r\n this._channelOpacities = channelOpacities;\r\n this.meshes = [];\r\n this._createImgStack();\r\n this.allLoaded = true;\r\n }\r\n\r\n private _createImgStack(): void {\r\n let positions = [];\r\n let colors = [];\r\n for (let c = 0; c < this._channelCoords.length; c++) {\r\n const channelIntensities = this._channelCoordIntensities[c];\r\n if (channelIntensities.length === 0) {\r\n continue;\r\n }\r\n const channelCoords = this._channelCoords[c];\r\n let channelColor = this._channelColors[c];\r\n let channelColorRGB = chroma(channelColor).rgb();\r\n channelColorRGB[0] = channelColorRGB[0] / 255;\r\n channelColorRGB[1] = channelColorRGB[1] / 255;\r\n channelColorRGB[2] = channelColorRGB[2] / 255;\r\n if (this._intensityMode === \"alpha\") {\r\n let alphaLevels = 10;\r\n let minIntensity = channelIntensities.min();\r\n let alphaPositions: number[][] = [];\r\n let alphaColors: number[][] = [];\r\n let alphaIntensities: number[] = [];\r\n for (let i = 0; i < alphaLevels; i++) {\r\n alphaPositions.push([]);\r\n alphaColors.push([]);\r\n alphaIntensities.push((i + 1) * (1 / alphaLevels) * this._channelOpacities[c]);\r\n }\r\n\r\n for (let p = 0; p < channelCoords.length; p++) {\r\n for (let intens = 0; intens < alphaIntensities.length; intens++) {\r\n const testIntensity = alphaIntensities[intens];\r\n if ((channelIntensities[p] - minIntensity) / (1 - minIntensity) <= testIntensity) {\r\n alphaPositions[intens].push(\r\n channelCoords[p][2],\r\n channelCoords[p][0],\r\n channelCoords[p][1]\r\n );\r\n alphaColors[intens].push(\r\n channelColorRGB[0],\r\n channelColorRGB[1],\r\n channelColorRGB[2],\r\n 1\r\n );\r\n break;\r\n }\r\n }\r\n }\r\n\r\n for (let intensIdx = 0; intensIdx < alphaIntensities.length; intensIdx++) {\r\n if (alphaColors[intensIdx].length <= 4) {\r\n continue;\r\n }\r\n let customMesh = new Mesh(`custom-${c}_${intensIdx}`, this._scene);\r\n const intensity = alphaIntensities[intensIdx];\r\n let vertexData = new VertexData();\r\n vertexData.positions = alphaPositions[intensIdx];\r\n vertexData.colors = alphaColors[intensIdx];\r\n vertexData.applyToMesh(customMesh, true);\r\n let mat = new StandardMaterial(`mat-${c}_${intensIdx}`, this._scene);\r\n mat.emissiveColor = new Color3(1, 1, 1);\r\n mat.disableLighting = true;\r\n mat.pointsCloud = true;\r\n mat.pointSize = this.size;\r\n mat.alpha = intensity;\r\n customMesh.material = mat;\r\n this.meshes.push(customMesh);\r\n }\r\n\r\n } else {\r\n for (let p = 0; p < channelCoords.length; p++) {\r\n positions.push(channelCoords[p][2], channelCoords[p][0], channelCoords[p][1]);\r\n if (this._intensityMode === \"mix\") {\r\n let colormix = chroma.mix(this._backgroundColor, channelColor, channelIntensities[p]).rgb();\r\n colors.push(colormix[0] / 255, colormix[1] / 255, colormix[2] / 255, 1);\r\n } else {\r\n colors.push(channelColorRGB[0], channelColorRGB[1], channelColorRGB[2], 1);\r\n }\r\n }\r\n let customMesh = new Mesh(`custom-${c}`, this._scene);\r\n let vertexData = new VertexData();\r\n vertexData.positions = positions;\r\n vertexData.colors = colors;\r\n vertexData.applyToMesh(customMesh, true);\r\n let mat = new StandardMaterial(`mat-${c}`, this._scene);\r\n mat.emissiveColor = new Color3(1, 1, 1);\r\n mat.disableLighting = true;\r\n mat.pointsCloud = true;\r\n mat.pointSize = this.size;\r\n customMesh.material = mat;\r\n this.meshes.push(customMesh);\r\n }\r\n }\r\n }\r\n}","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { Vector3, Color4 } from \"@babylonjs/core/Maths/math\";\r\nimport { LegendData, CoordinatePlot } from \"../babyplots\";\r\nimport { AnnotationManager } from \"../utils/Label\";\r\nimport { LinesBuilder } from \"@babylonjs/core/Meshes/Builders/linesBuilder\";\r\n\r\nexport class Line extends CoordinatePlot {\r\n labels: string[]\r\n labelSize: number\r\n labelColor: string\r\n\r\n private _hasAnimation: boolean;\r\n private _looping: boolean = false;\r\n private _animDirection: number = 1;\r\n private _animationFrames: number = 200;\r\n private _animationDelay: number = 100;\r\n constructor(\r\n scene: Scene,\r\n coordinates: number[][],\r\n colorVar: string[],\r\n size: number,\r\n legendData: LegendData,\r\n hasAnimation?: boolean,\r\n animationDelay?: number,\r\n animationDuration?: number,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n name: string = \"line\",\r\n labels?: string[],\r\n labelSize?: number,\r\n labelColor?: string,\r\n annotationManager?: AnnotationManager\r\n ) {\r\n super(name, \"line\", scene, coordinates, colorVar, size, legendData, xScale, yScale, zScale);\r\n this._hasAnimation = hasAnimation;\r\n if (labels && labels.length === coordinates.length && annotationManager) {\r\n this.labels = labels;\r\n this.labelSize = labelSize;\r\n this.labelColor = labelColor;\r\n this._addLabels(annotationManager);\r\n }\r\n this._createLine();\r\n this.allLoaded = true;\r\n }\r\n /**\r\n * Positions spheres according to coordinates in a SPS\r\n */\r\n private _createLine(): void {\r\n let lineCoords: Vector3[] = [];\r\n for (let i = 0; i < this._coords.length; i++) {\r\n const point = this._coords[i];\r\n lineCoords.push(new Vector3(point[0], point[1], point[2]));\r\n }\r\n let lineColors: Color4[] = [];\r\n for (let i = 0; i < this._coordColors.length; i++) {\r\n const pointColor = this._coordColors[i];\r\n lineColors.push(Color4.FromHexString(pointColor));\r\n }\r\n let lines = LinesBuilder.CreateLines(\r\n \"lines\",\r\n { points: lineCoords, colors: lineColors }\r\n )\r\n\r\n this.mesh = lines;\r\n }\r\n\r\n private _addLabels(annotationManager: AnnotationManager): void {\r\n for (let i = 0; i < this.labels.length; i++) {\r\n let col = this.labelColor;\r\n if (this.labelColor === \"match\") {\r\n col = this._coordColors[i];\r\n }\r\n annotationManager.addLabel(this.labels[i], this._coords[i], col, this.labelSize, true);\r\n }\r\n annotationManager.fixLabels();\r\n }\r\n}","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\n\r\n\r\nimport { Axis, Space, Vector3 } from \"@babylonjs/core/Maths/math\";\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { SceneLoader } from \"@babylonjs/core/Loading/sceneLoader\";\r\n\r\nimport { LegendData, Plot } from \"../babyplots\";\r\n\r\nimport \"@babylonjs/loaders/glTF\";\r\n\r\nexport class MeshObject extends Plot {\r\n\r\n\r\n worldextends: { min: Vector3; max: Vector3}\r\n\r\n constructor(\r\n scene: Scene,\r\n meshString: string,\r\n legendData: LegendData,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n scaling: number[] = [],\r\n rotation: number[] = [],\r\n offset: number[] = [],\r\n name: string = \"mesh object\"\r\n ) {\r\n super(name, \"meshObject\", scene, legendData, xScale, yScale, zScale);\r\n SceneLoader.ImportMesh(\"\", \"\", \"data:\" + meshString, scene, (meshes, _, __) => {\r\n let rootMesh = meshes[0]\r\n if (scaling.length === 3) {\r\n rootMesh.scaling = new Vector3(\r\n scaling[0],\r\n scaling[1],\r\n scaling[2]\r\n );\r\n }\r\n if (rotation.length === 3) {\r\n rootMesh.rotationQuaternion = null;\r\n rootMesh.rotate(Axis.X, rotation[0], Space.LOCAL);\r\n rootMesh.rotate(Axis.Y, rotation[1], Space.LOCAL);\r\n rootMesh.rotate(Axis.Z, rotation[2], Space.LOCAL);\r\n }\r\n if (offset.length === 3) {\r\n meshes[0].position = new Vector3(\r\n offset[0],\r\n offset[1],\r\n offset[2]\r\n );\r\n }\r\n });\r\n }\r\n}","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { AssetContainer } from \"@babylonjs/core/assetContainer\";\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { SceneLoader } from \"@babylonjs/core/Loading/sceneLoader\";\r\nimport { LegendData, Plot } from \"../babyplots\";\r\nimport { Axis, Space, Vector3 } from \"@babylonjs/core/Maths/math\";\r\n\r\nimport \"@babylonjs/loaders/glTF\";\r\nimport { PBRMaterial } from \"@babylonjs/core\";\r\n\r\n\r\nexport class MeshStream extends Plot {\r\n private _rootUrl: string;\r\n private _filenames: string[] = [];\r\n private _prevTime: number = performance.now();\r\n private _containers: AssetContainer[] = [];\r\n private _rotation: number[];\r\n private _offset: number[];\r\n private _clearCoat: boolean;\r\n private _clearCoatIntensity: number;\r\n\r\n frameIndex: number = 0;\r\n frameTotal: number;\r\n frameDelay: number;\r\n worldextends: { min: Vector3; max: Vector3; };\r\n\r\n constructor(\r\n scene: Scene,\r\n rootUrl: string,\r\n filePrefix: string,\r\n fileSuffix: string,\r\n fileIteratorStart: number,\r\n fileIteratorEnd: number,\r\n legendData: LegendData,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n frameDelay: number = 200,\r\n rotation: number[] = [],\r\n offset: number[] = [],\r\n clearCoat: boolean = false,\r\n clearCoatIntensity: number = 1,\r\n name: string = \"mesh stream\"\r\n ) {\r\n super(name, \"meshStream\", scene, legendData, xScale, yScale, zScale);\r\n this._rootUrl = rootUrl;\r\n this.frameDelay = frameDelay;\r\n this._rotation = rotation;\r\n this._offset = offset;\r\n this._clearCoat = clearCoat;\r\n this._clearCoatIntensity = clearCoatIntensity;\r\n for (let iter = fileIteratorStart; iter <= fileIteratorEnd; iter++) {\r\n this._filenames.push(filePrefix + iter.toString() + fileSuffix);\r\n }\r\n this.frameTotal = this._filenames.length;\r\n this._createMeshStream();\r\n }\r\n\r\n async _createMeshStream(): Promise {\r\n // load meshes one by one, store them and display them as they come in\r\n\r\n let loadingContainers: Promise[] = [];\r\n // load containers\r\n for (let idx = 0; idx < this._filenames.length; idx++) {\r\n const filename = this._filenames[idx];\r\n // start loading container\r\n loadingContainers.push(this._loadMesh(filename));\r\n }\r\n const firstScene = await loadingContainers[0];\r\n firstScene.addAllToScene();\r\n this._containers.push(firstScene)\r\n this._containers = this._containers.concat(await Promise.all(loadingContainers));\r\n this.allLoaded = true;\r\n this.frameIndex = 0;\r\n firstScene.removeAllFromScene();\r\n }\r\n\r\n async _loadMesh(filename: string): Promise {\r\n let container = SceneLoader.LoadAssetContainerAsync(\r\n this._rootUrl, filename, this._scene\r\n ).then(container => {\r\n if (this._rotation.length === 3) {\r\n let rootMesh = container.meshes[0];\r\n rootMesh.rotationQuaternion = null;\r\n rootMesh.rotate(Axis.X, this._rotation[0], Space.LOCAL);\r\n rootMesh.rotate(Axis.Y, this._rotation[1], Space.LOCAL);\r\n rootMesh.rotate(Axis.Z, this._rotation[2], Space.LOCAL);\r\n }\r\n if (this._offset.length === 3) {\r\n let rootMesh = container.meshes[0];\r\n rootMesh.position = new Vector3(\r\n this._offset[0],\r\n this._offset[1],\r\n this._offset[2]\r\n );\r\n }\r\n if (this._clearCoat) {\r\n let materials = container.materials;\r\n materials.forEach((mat, _) => {\r\n (mat as PBRMaterial).clearCoat.isEnabled = true;\r\n (mat as PBRMaterial).clearCoat.intensity = this._clearCoatIntensity;\r\n });\r\n }\r\n this.frameIndex++;\r\n return container;\r\n });\r\n return container;\r\n }\r\n\r\n goToFrame(n: number): void {\r\n if (this.allLoaded && n >= 0 && n < this.frameTotal) {\r\n for (let fi = 0; fi < this._containers.length; fi++) {\r\n this._containers[fi].removeAllFromScene();\r\n }\r\n this._containers[n].addAllToScene();\r\n this.frameIndex = n + 1;\r\n if (this.frameIndex === this._containers.length) {\r\n this.frameIndex = 0;\r\n }\r\n }\r\n }\r\n\r\n update(): boolean {\r\n if (this.allLoaded) {\r\n let timeNow = performance.now();\r\n if (timeNow - this._prevTime > this.frameDelay) {\r\n this._prevTime = timeNow;\r\n if (this.frameIndex === 0) {\r\n this._containers[this._containers.length - 1].removeAllFromScene();\r\n } else {\r\n this._containers[this.frameIndex - 1].removeAllFromScene();\r\n }\r\n this._containers[this.frameIndex].addAllToScene();\r\n if (this.frameIndex === this._containers.length - 1) {\r\n this.frameIndex = 0;\r\n } else {\r\n this.frameIndex++;\r\n }\r\n }\r\n // go through the loaded meshes sequentially, then reset.\r\n }\r\n return true;\r\n }\r\n}\r\n","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { Vector3, Color4, Color3 } from \"@babylonjs/core/Maths/math\";\r\nimport { VertexData } from \"@babylonjs/core/Meshes/mesh.vertexData\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { FloatArray } from \"@babylonjs/core/types\";\r\nimport { LegendData, CoordinatePlot } from \"../babyplots\";\r\nimport { AnnotationManager } from \"../utils/Label\";\r\nimport chroma from \"chroma-js\";\r\n\r\nexport class PointCloud extends CoordinatePlot {\r\n private _hasAnimation: boolean;\r\n private _looping: boolean = false;\r\n private _animDirection: number = 1;\r\n private _animationTargets: number[][];\r\n private _animationVectors: Vector3[] = [];\r\n private _animationCounter: number = 0;\r\n private _animationFrames: number = 200;\r\n private _animationVectorFract: Vector3[] = [];\r\n private _animationDelay: number = 100;\r\n constructor(\r\n scene: Scene,\r\n coordinates: number[][],\r\n colorVar: string[],\r\n size: number,\r\n legendData: LegendData,\r\n hasAnimation?: boolean,\r\n animationTargets?: number[][],\r\n animationDelay?: number,\r\n animationDuration?: number,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n name: string = \"point cloud\",\r\n addLabels: boolean = false,\r\n annotationManager?: AnnotationManager\r\n ) {\r\n super(name, \"point\", scene, coordinates, colorVar, size, legendData, xScale, yScale, zScale);\r\n this._hasAnimation = hasAnimation;\r\n if (animationDelay) {\r\n this._animationDelay = animationDelay;\r\n }\r\n if (animationDuration) {\r\n this._animationFrames = animationDuration;\r\n }\r\n if (hasAnimation) {\r\n if (animationTargets) {\r\n for (let i = 0; i < animationTargets.length; i++) {\r\n if (animationTargets[i].length === 2) {\r\n animationTargets[i].splice(1, 0, 0);\r\n }\r\n let fv = new Vector3(\r\n coordinates[i][0] * this.xScale,\r\n coordinates[i][1] * this.yScale,\r\n coordinates[i][2] * this.zScale\r\n ).subtractFromFloats(\r\n animationTargets[i][0] * this.xScale,\r\n animationTargets[i][1] * this.yScale,\r\n animationTargets[i][2] * this.zScale\r\n );\r\n this._animationVectors.push(fv);\r\n this._animationVectorFract.push(fv.divide(new Vector3(this._animationFrames, this._animationFrames, this._animationFrames)));\r\n }\r\n this._animationTargets = animationTargets;\r\n } else {\r\n animationTargets = JSON.parse(JSON.stringify(coordinates));\r\n for (let i = 0; i < animationTargets.length; i++) {\r\n animationTargets[i][1] = 0;\r\n let fv = new Vector3(\r\n coordinates[i][0] * this.xScale,\r\n coordinates[i][1] * this.yScale,\r\n coordinates[i][2] * this.zScale\r\n ).subtractFromFloats(\r\n animationTargets[i][0] * this.xScale,\r\n animationTargets[i][1] * this.yScale,\r\n animationTargets[i][2] * this.zScale\r\n );\r\n this._animationVectors.push(fv);\r\n this._animationVectorFract.push(fv.divide(new Vector3(this._animationFrames, this._animationFrames, this._animationFrames)));\r\n }\r\n this._animationTargets = animationTargets;\r\n }\r\n }\r\n this._createPointCloud();\r\n if (addLabels && annotationManager) {\r\n this._addLabels(annotationManager);\r\n }\r\n this.allLoaded = true;\r\n }\r\n /**\r\n * Positions spheres according to coordinates in a SPS\r\n */\r\n private _createPointCloud(): void {\r\n // prototype cell\r\n let customMesh = new Mesh(\"custom\", this._scene);\r\n // Set arrays for positions and indices\r\n let positions = [];\r\n let colors = [];\r\n if (this._hasAnimation) {\r\n for (let p = 0; p < this._coords.length; p++) {\r\n positions.push(\r\n this._animationTargets[p][0] * this.xScale,\r\n this._animationTargets[p][1] * this.yScale,\r\n this._animationTargets[p][2] * this.zScale\r\n );\r\n let col = Color4.FromHexString(this._coordColors[p]);\r\n colors.push(col.r, col.g, col.b, col.a);\r\n }\r\n } else {\r\n for (let p = 0; p < this._coords.length; p++) {\r\n positions.push(\r\n this._coords[p][0] * this.xScale,\r\n this._coords[p][1] * this.yScale,\r\n this._coords[p][2] * this.zScale\r\n );\r\n let col = Color4.FromHexString(this._coordColors[p]);\r\n colors.push(col.r, col.g, col.b, col.a);\r\n }\r\n }\r\n var vertexData = new VertexData();\r\n // Assign positions\r\n vertexData.positions = positions;\r\n vertexData.colors = colors;\r\n // Apply vertexData to custom mesh\r\n vertexData.applyToMesh(customMesh, true);\r\n var mat = new StandardMaterial(\"mat\", this._scene);\r\n mat.emissiveColor = new Color3(1, 1, 1);\r\n mat.disableLighting = true;\r\n mat.pointsCloud = true;\r\n mat.pointSize = this._size;\r\n customMesh.material = mat;\r\n this.mesh = customMesh;\r\n Object.defineProperty(this, \"alpha\", {\r\n set(newAlpha) {\r\n this.mesh.material.alpha = newAlpha;\r\n }\r\n });\r\n }\r\n\r\n private _addLabels(annotationManager: AnnotationManager): void {\r\n if (!this.legendData.discrete) return;\r\n let colors: string[];\r\n if (this.legendData.colorScale === \"custom\") {\r\n colors = chroma.scale(this.legendData.customColorScale).mode('lch').colors(this.legendData.breaks.length);\r\n }\r\n else {\r\n colors = chroma.scale(chroma.brewer[this.legendData.colorScale]).mode('lch').colors(this.legendData.breaks.length);\r\n }\r\n let pointGroups: number[][][] = [];\r\n let pointGroupColors: string[] = [];\r\n let pointGroupNames: string[] = [];\r\n for (let i = 0; i < this._coordColors.length; i++) {\r\n const color = this._coordColors[i];\r\n let colorIdx = pointGroupColors.indexOf(color);\r\n if (colorIdx === -1) {\r\n colorIdx = pointGroupColors.length;\r\n pointGroupColors.push(color);\r\n let colorNameIdx = colors.indexOf(color.slice(0, -2));\r\n if (colorNameIdx === -1) {\r\n colorNameIdx = colors.indexOf(color);\r\n if (colorNameIdx === -1) continue;\r\n };\r\n pointGroupNames.push(this.legendData.breaks[colorNameIdx]);\r\n pointGroups.push([]);\r\n }\r\n pointGroups[colorIdx].push(this._coords[i]);\r\n }\r\n let pointGroupCentroids = [];\r\n const sumFun = (prev: number[], curr: number[]) => [prev[0] + curr[0], prev[1] + curr[1], prev[2] + curr[2]];\r\n for (let i = 0; i < pointGroups.length; i++) {\r\n const pointGroup = pointGroups[i];\r\n const sum = pointGroup.reduce(sumFun);\r\n const centroid = [sum[0] / pointGroup.length, sum[1] / pointGroup.length, sum[2] / pointGroup.length];\r\n annotationManager.addLabel(pointGroupNames[i], centroid, undefined, undefined, true);\r\n }\r\n annotationManager.fixLabels();\r\n }\r\n\r\n resetAnimation(): void {\r\n this._hasAnimation = true;\r\n let positionFunction = function (this: PointCloud, positions: FloatArray) {\r\n let numberOfVertices = positions.length / 3;\r\n for (let i = 0; i < numberOfVertices; i++) {\r\n positions[i * 3] = this._animationTargets[i][0] * this.xScale;\r\n positions[i * 3 + 1] = this._animationTargets[i][1] * this.zScale;\r\n positions[i * 3 + 2] = this._animationTargets[i][2] * this.yScale;\r\n }\r\n }\r\n this.mesh.updateMeshPositions(positionFunction.bind(this), true);\r\n this.mesh.refreshBoundingInfo();\r\n this._animationCounter = 0;\r\n this._animDirection = 1;\r\n }\r\n\r\n setLooping(looping: boolean): void {\r\n this._looping = looping;\r\n this.resetAnimation();\r\n }\r\n\r\n update(): boolean {\r\n if (this.mesh && this._hasAnimation) {\r\n if (this._animationCounter < this._animationDelay) {\r\n this._animationCounter += 1;\r\n } else if (this._animationCounter < this._animationFrames + this._animationDelay) {\r\n let positionFunction = function (this: PointCloud, positions: FloatArray) {\r\n let numberOfVertices = positions.length / 3;\r\n for (let i = 0; i < numberOfVertices; i++) {\r\n let posVector = new Vector3(\r\n positions[i * 3],\r\n positions[i * 3 + 1],\r\n positions[i * 3 + 2]\r\n );\r\n let vectorFractDir = this._animationVectorFract[i].multiplyByFloats(\r\n this._animDirection,\r\n this._animDirection,\r\n this._animDirection\r\n )\r\n posVector = posVector.addInPlace(vectorFractDir);\r\n positions[i * 3] = posVector.x;\r\n positions[i * 3 + 1] = posVector.y;\r\n positions[i * 3 + 2] = posVector.z;\r\n }\r\n }\r\n this.mesh.updateMeshPositions(positionFunction.bind(this), true);\r\n this._animationCounter += 1;\r\n } else {\r\n if (this._looping) {\r\n this._animationCounter = 0;\r\n this._animDirection *= -1;\r\n } else {\r\n this._hasAnimation = false;\r\n let positionFunction = function (positions: FloatArray) {\r\n let numberOfVertices = positions.length / 3;\r\n for (let i = 0; i < numberOfVertices; i++) {\r\n positions[i * 3] = this._coords[i][0] * this.xScale;\r\n positions[i * 3 + 1] = this._coords[i][1] * this.yScale;\r\n positions[i * 3 + 2] = this._coords[i][2] * this.zScale;\r\n }\r\n }\r\n this.mesh.updateMeshPositions(positionFunction.bind(this), true);\r\n }\r\n this.mesh.refreshBoundingInfo();\r\n }\r\n }\r\n return this._hasAnimation;\r\n }\r\n}\r\n","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport \"@babylonjs/core/Meshes/thinInstanceMesh\";\r\nimport { SphereBuilder } from \"@babylonjs/core/Meshes/Builders/sphereBuilder\";\r\nimport { BoxBuilder } from \"@babylonjs/core/Meshes/Builders/boxBuilder\";\r\nimport { TorusBuilder } from \"@babylonjs/core/Meshes/Builders/torusBuilder\";\r\nimport { CylinderBuilder } from \"@babylonjs/core/Meshes/Builders/cylinderBuilder\";\r\nimport { Color3, Color4, Matrix, Vector3 } from \"@babylonjs/core/Maths/math\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { CoordinatePlot, LegendData } from \"../babyplots\";\r\nimport { v4 as uuidv4 } from \"uuid\";\r\nimport { PickingInfo } from \"@babylonjs/core/Collisions/pickingInfo\";\r\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\r\n\r\nexport class ShapeCloud extends CoordinatePlot {\r\n private _shading: boolean;\r\n private _shape: string;\r\n private _tNodes: TransformNode[] = [];\r\n \r\n dpInfo: string[];\r\n \r\n constructor(\r\n scene: Scene,\r\n coordinates: number[][],\r\n colorVar: string[],\r\n shape: string,\r\n shading: boolean,\r\n size: number,\r\n legendData: LegendData,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n name: string = \"shape cloud\",\r\n dpInfo?: string[]\r\n ) {\r\n super(name, \"shape_\" + shape, scene, coordinates, colorVar, size * 0.1, legendData, xScale, yScale, zScale);\r\n this._shape = shape;\r\n this._shading = shading;\r\n if (dpInfo && dpInfo.length === coordinates.length) {\r\n this.dpInfo = dpInfo;\r\n }\r\n this._createShapeCloud();\r\n this.allLoaded = true;\r\n }\r\n /**\r\n * Creates shapes at coordinates\r\n */\r\n private _createShapeCloud(): void {\r\n let instanceCount = this._coords.length;\r\n\r\n let matricesData = new Float32Array(16 * instanceCount);\r\n let colorData = new Float32Array(4 * instanceCount);\r\n\r\n // set position and color data for shapes\r\n for (let i = 0; i < instanceCount; i++) {\r\n let matrix = Matrix.Translation(\r\n this._coords[i][0] * this.xScale,\r\n this._coords[i][1] * this.zScale,\r\n this._coords[i][2] * this.yScale\r\n );\r\n\r\n matrix.copyToArray(matricesData, i * 16);\r\n\r\n let col = Color4.FromHexString(this._coordColors[i]);\r\n\r\n colorData.set(col.asArray(), i * 4);\r\n }\r\n\r\n let origMesh: Mesh;\r\n let mid = \"root:\" + uuidv4()\r\n\r\n switch (this._shape) {\r\n case \"box\":\r\n origMesh = BoxBuilder.CreateBox(mid, { size: this._size });\r\n break;\r\n case \"sphere\":\r\n origMesh = SphereBuilder.CreateSphere(mid, { diameter: this._size });\r\n break;\r\n case \"cone\":\r\n origMesh = CylinderBuilder.CreateCylinder(mid, { height: this._size, diameterBottom: this._size, diameterTop: 0 }, this._scene);\r\n break;\r\n case \"torus\":\r\n origMesh = TorusBuilder.CreateTorus(mid, { diameter: this._size, thickness: this._size * 0.5 }, this._scene);\r\n break;\r\n case \"cylinder\":\r\n origMesh = CylinderBuilder.CreateCylinder(mid, { height: this._size, diameter: this._size }, this._scene);\r\n break;\r\n default:\r\n origMesh = BoxBuilder.CreateBox(mid, { size: this._size });\r\n break;\r\n }\r\n \r\n origMesh.thinInstanceSetBuffer(\"matrix\", matricesData, 16, true);\r\n origMesh.thinInstanceSetBuffer(\"color\", colorData, 4, true);\r\n\r\n \r\n let mat = new StandardMaterial(\"shapeMat\", this._scene);\r\n if (!this._shading) {\r\n mat.disableLighting = true;\r\n mat.emissiveColor = Color3.White();\r\n }\r\n origMesh.material = mat;\r\n \r\n this.mesh = origMesh;\r\n Object.defineProperty(this, \"alpha\", {\r\n set(newAlpha) {\r\n this.mesh.material.alpha = newAlpha;\r\n }\r\n });\r\n \r\n if (this.dpInfo) {\r\n origMesh.thinInstanceEnablePicking = true;\r\n }\r\n\r\n }\r\n getPick(pickResult: PickingInfo) {\r\n let pickCoords = Vector3.FromArray(this._coords[pickResult.thinInstanceIndex]);\r\n let target: TransformNode;\r\n for (let i = 0; i < this._tNodes.length; i++) {\r\n const tNode = this._tNodes[i];\r\n if (pickCoords.equals(tNode.position)) {\r\n target = tNode;\r\n }\r\n }\r\n if (target === undefined) {\r\n target = new TransformNode(\"pickNode\");\r\n target.position = pickCoords\r\n this._tNodes.push(target);\r\n }\r\n let pick = {\r\n target: target,\r\n info: this.dpInfo[pickResult.thinInstanceIndex]\r\n }\r\n return pick;\r\n }\r\n}\r\n","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { VertexData } from \"@babylonjs/core/Meshes/mesh.vertexData\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { LegendData, CoordinatePlot } from \"../babyplots\";\r\nimport chroma from \"chroma-js\";\r\n\r\n\r\nexport class Surface extends CoordinatePlot {\r\n constructor(\r\n scene: Scene,\r\n coordinates: number[][],\r\n colorVar: string[],\r\n size: number,\r\n legendData: LegendData,\r\n xScale: number = 1,\r\n yScale: number = 1,\r\n zScale: number = 1,\r\n name: string = \"surface\"\r\n ) {\r\n super(name, \"surface\", scene, coordinates, colorVar, size, legendData, xScale, yScale, zScale);\r\n this._createSurface();\r\n this.allLoaded = true;\r\n }\r\n private _createSurface(): void {\r\n var surface = new Mesh(\"surface\", this._scene);\r\n var positions = [];\r\n var indices = [];\r\n for (let row = 0; row < this._coords.length; row++) {\r\n const rowCoords = this._coords[row];\r\n for (let column = 0; column < rowCoords.length; column++) {\r\n const coord = rowCoords[column];\r\n positions.push(\r\n column * this.xScale,\r\n coord * this.yScale,\r\n row * this.zScale\r\n );\r\n if (row < this._coords.length - 1 && column < rowCoords.length - 1) {\r\n indices.push(\r\n column + row * rowCoords.length,\r\n rowCoords.length + row * rowCoords.length + column,\r\n column + row * rowCoords.length + 1,\r\n column + row * rowCoords.length + 1,\r\n rowCoords.length + row * rowCoords.length + column,\r\n rowCoords.length + row * rowCoords.length + column + 1\r\n );\r\n }\r\n }\r\n }\r\n var colors = [];\r\n for (let i = 0; i < this._coordColors.length; i++) {\r\n const hex = this._coordColors[i];\r\n let rgba = chroma(hex).rgba();\r\n colors.push(rgba[0] / 255, rgba[1] / 255, rgba[2] / 255, rgba[3]);\r\n }\r\n var normals = [];\r\n var vertexData = new VertexData();\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n vertexData.colors = colors;\r\n vertexData.normals = normals;\r\n vertexData.applyToMesh(surface);\r\n var mat = new StandardMaterial(\"surfaceMat\", this._scene);\r\n mat.backFaceCulling = false;\r\n mat.alpha = 1;\r\n surface.material = mat;\r\n this.mesh = surface;\r\n Object.defineProperty(this, \"alpha\", {\r\n set(newAlpha) {\r\n this.mesh.material.alpha = newAlpha;\r\n }\r\n });\r\n }\r\n}\r\n","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { ArcRotateCamera } from \"@babylonjs/core/Cameras/arcRotateCamera\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { LinesBuilder } from \"@babylonjs/core/Meshes/Builders/linesBuilder\";\r\nimport { LinesMesh } from \"@babylonjs/core/Meshes/linesMesh\";\r\nimport { Vector3, Axis, Color3} from \"@babylonjs/core/Maths/math\";\r\nimport { DynamicTexture } from \"@babylonjs/core/Materials/Textures/dynamicTexture\";\r\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\r\nimport { AxisData } from \"../babyplots\";\r\n\r\n/**\r\n * Class to store and update plot axes.\r\n */\r\nexport class Axes {\r\n private _axes: LinesMesh[] = [];\r\n private _axisLabels: Mesh[] = [];\r\n private _ticks: LinesMesh[] = [];\r\n private _tickLabels: Mesh[] = [];\r\n private _tickLines: LinesMesh[] = [];\r\n private _scene: Scene;\r\n axisData: AxisData;\r\n /**\r\n * Create axes for plot.\r\n * @param axisData object containing all information about axis setup.\r\n * @param scene BABYLON scene.\r\n */\r\n constructor(axisData: AxisData, scene: Scene, heatmap: boolean = false) {\r\n this.axisData = axisData;\r\n this._scene = scene;\r\n this._createAxes(heatmap);\r\n }\r\n private _roundTicks(num: number, scale: number = 2): number {\r\n if (!(\"\" + num).includes(\"e\")) {\r\n return +(Math.round(parseFloat(num.toString() + \"e+\" + scale.toString())) + \"e-\" + scale);\r\n }\r\n else {\r\n var arr = (\"\" + num).split(\"e\");\r\n var sig = \"\";\r\n if (+arr[1] + scale > 0) {\r\n sig = \"+\";\r\n }\r\n return +(Math.round(parseFloat(+arr[0].toString() + \"e\" + sig.toString() + (+arr[1].toString() + scale.toString()))) + \"e-\" + scale);\r\n }\r\n }\r\n private _createAxes(heatmap: boolean = false): void {\r\n if (heatmap) {\r\n // Tick breaks for heat map on x and z coordinates have to match columns and rows\r\n this.axisData.tickBreaks[0] = 1;\r\n this.axisData.tickBreaks[2] = 1;\r\n }\r\n // Apply scaling factor to tick break interval to get distance between ticks\r\n let xtickBreaks = this.axisData.tickBreaks[0] * this.axisData.scale[0];\r\n let ytickBreaks = this.axisData.tickBreaks[1] * this.axisData.scale[1];\r\n let ztickBreaks = this.axisData.tickBreaks[2] * this.axisData.scale[2];\r\n // Find minima and maxima of the axes as a multiple of the tick interval distance\r\n let xmin = Math.floor(this.axisData.range[0][0] / xtickBreaks) * xtickBreaks;\r\n let ymin = Math.floor(this.axisData.range[1][0] / ytickBreaks) * ytickBreaks;\r\n let zmin = Math.floor(this.axisData.range[2][0] / ztickBreaks) * ztickBreaks;\r\n let xmax = Math.ceil(this.axisData.range[0][1] / xtickBreaks) * xtickBreaks;\r\n let ymax = Math.ceil(this.axisData.range[1][1] / ytickBreaks) * ytickBreaks;\r\n let zmax = Math.ceil(this.axisData.range[2][1] / ztickBreaks) * ztickBreaks;\r\n // Create X axis\r\n if (this.axisData.showAxes[0]) {\r\n // Create axis line\r\n let axisX = LinesBuilder.CreateLines(\"axisX\", {\r\n points: [\r\n new Vector3(xmin, ymin, zmin),\r\n new Vector3(xmax, ymin, zmin)\r\n ]\r\n }, this._scene);\r\n // Apply axis color\r\n axisX.color = Color3.FromHexString(this.axisData.color[0]);\r\n axisX.isPickable = false;\r\n this._axes.push(axisX);\r\n // Create axis label\r\n let xChar = this._makeTextPlane(this.axisData.axisLabels[0], 1, this.axisData.color[0]);\r\n // Place label near end of the axis\r\n xChar.position = new Vector3(xmax / 2, ymin - 0.5 * ymax, zmin);\r\n xChar.isPickable = false;\r\n this._axisLabels.push(xChar);\r\n // Create ticks and tick lines\r\n let xTicks = [];\r\n // Find x coordinates for ticks\r\n // Negative ticks\r\n for (let i = 0; i < -Math.ceil(this.axisData.range[0][0] / xtickBreaks); i++) {\r\n xTicks.push(-(i + 1) * xtickBreaks);\r\n }\r\n // Positive ticks\r\n for (let i = 0; i <= Math.ceil(this.axisData.range[0][1] / xtickBreaks); i++) {\r\n xTicks.push(i * xtickBreaks);\r\n }\r\n // Usually ticks start with 0, heat map starts with 1\r\n let startTick = 0;\r\n if (heatmap) {\r\n startTick = 1;\r\n }\r\n // Create all ticks\r\n for (let i = startTick; i < xTicks.length; i++) {\r\n let tickPos = xTicks[i];\r\n if (heatmap) {\r\n tickPos = tickPos - 0.5 * this.axisData.scale[0];\r\n }\r\n let tick = LinesBuilder.CreateLines(\"xTicks\", {\r\n points: [\r\n new Vector3(tickPos, ymin, zmin + 0.05 * xmax),\r\n new Vector3(tickPos, ymin, zmin),\r\n new Vector3(tickPos, ymin + 0.05 * ymax, zmin)\r\n ]\r\n }, this._scene);\r\n tick.color = Color3.FromHexString(this.axisData.color[0]);\r\n tick.isPickable = false;\r\n this._ticks.push(tick);\r\n let tickLabel = this._roundTicks(tickPos / this.axisData.scale[0]).toString();\r\n if (heatmap) {\r\n tickLabel = this.axisData.colnames[i - 1];\r\n }\r\n if (tickLabel === undefined) {\r\n continue;\r\n }\r\n let tickChar = this._makeTextPlane(tickLabel, 0.6, this.axisData.color[0]);\r\n tickChar.position = new Vector3(tickPos, ymin - 0.1 * ymax, zmin);\r\n tickChar.isPickable = false;\r\n this._tickLabels.push(tickChar);\r\n if (this.axisData.showTickLines[0][0]) {\r\n let tickLine = LinesBuilder.CreateLines(\"xTickLines\", {\r\n points: [\r\n new Vector3(tickPos, ymax, zmin),\r\n new Vector3(tickPos, ymin, zmin)\r\n ]\r\n }, this._scene);\r\n tickLine.color = Color3.FromHexString(this.axisData.tickLineColor[0][0]);\r\n tickLine.isPickable = false;\r\n this._tickLines.push(tickLine);\r\n }\r\n if (this.axisData.showTickLines[0][1]) {\r\n let tickLine = LinesBuilder.CreateLines(\"xTickLines\", {\r\n points: [\r\n new Vector3(tickPos, ymin, zmax),\r\n new Vector3(tickPos, ymin, zmin)\r\n ]\r\n }, this._scene);\r\n tickLine.color = Color3.FromHexString(this.axisData.tickLineColor[0][1]);\r\n tickLine.isPickable = false;\r\n this._tickLines.push(tickLine);\r\n }\r\n }\r\n }\r\n // create Y axis\r\n if (this.axisData.showAxes[1]) {\r\n // axis\r\n let axisY = LinesBuilder.CreateLines(\"axisY\", {\r\n points: [\r\n new Vector3(xmin, ymin, zmin),\r\n new Vector3(xmin, ymax, zmin)\r\n ]\r\n }, this._scene);\r\n axisY.color = Color3.FromHexString(this.axisData.color[1]);\r\n axisY.isPickable = false;\r\n this._axes.push(axisY);\r\n // label\r\n let yChar = this._makeTextPlane(this.axisData.axisLabels[1], 1, this.axisData.color[1]);\r\n yChar.position = new Vector3(xmin, ymax / 2, zmin - 0.5 * ymax);\r\n yChar.isPickable = false;\r\n this._axisLabels.push(yChar);\r\n // y ticks and tick lines\r\n let yTicks = [];\r\n for (let i = 0; i < -Math.ceil(this.axisData.range[1][0] / ytickBreaks); i++) {\r\n yTicks.push(-(i + 1) * ytickBreaks);\r\n }\r\n for (let i = 0; i <= Math.ceil(this.axisData.range[1][1] / ytickBreaks); i++) {\r\n yTicks.push(i * ytickBreaks);\r\n }\r\n for (let i = 0; i < yTicks.length; i++) {\r\n let tickPos = yTicks[i];\r\n let tick = LinesBuilder.CreateLines(\"yTicks\", {\r\n points: [\r\n new Vector3(xmin, tickPos, zmin + 0.05 * zmax),\r\n new Vector3(xmin, tickPos, zmin),\r\n new Vector3(xmin + 0.05 * xmax, tickPos, zmin)\r\n ]\r\n }, this._scene);\r\n tick.color = Color3.FromHexString(this.axisData.color[1]);\r\n tick.isPickable = false;\r\n this._ticks.push(tick);\r\n let tickLabel = this._roundTicks(tickPos / this.axisData.scale[1]);\r\n let tickChar = this._makeTextPlane(tickLabel.toString(), 0.6, this.axisData.color[1]);\r\n tickChar.position = new Vector3(xmin, tickPos, zmin - 0.05 * ymax);\r\n tickChar.isPickable = false;\r\n this._tickLabels.push(tickChar);\r\n // tick lines\r\n if (this.axisData.showTickLines[1][0]) {\r\n let tickLine = LinesBuilder.CreateLines(\"yTicksLines\", {\r\n points: [\r\n new Vector3(xmax, tickPos, zmin),\r\n new Vector3(xmin, tickPos, zmin)\r\n ]\r\n }, this._scene);\r\n tickLine.color = Color3.FromHexString(this.axisData.tickLineColor[1][0]);\r\n tickLine.isPickable = false;\r\n this._tickLines.push(tickLine);\r\n }\r\n if (this.axisData.showTickLines[1][1]) {\r\n let tickLine = LinesBuilder.CreateLines(\"yTickLines\", {\r\n points: [\r\n new Vector3(xmin, tickPos, zmax),\r\n new Vector3(xmin, tickPos, zmin)\r\n ]\r\n }, this._scene);\r\n tickLine.color = Color3.FromHexString(this.axisData.tickLineColor[1][1]);\r\n tickLine.isPickable = false;\r\n this._tickLines.push(tickLine);\r\n }\r\n }\r\n }\r\n // create Z axis\r\n if (this.axisData.showAxes[2]) {\r\n // axis\r\n let axisZ = LinesBuilder.CreateLines(\"axisZ\", {\r\n points: [\r\n new Vector3(xmin, ymin, zmin),\r\n new Vector3(xmin, ymin, zmax)\r\n ]\r\n }, this._scene);\r\n axisZ.color = Color3.FromHexString(this.axisData.color[2]);\r\n axisZ.isPickable = false;\r\n this._axes.push(axisZ);\r\n // label\r\n let zChar = this._makeTextPlane(this.axisData.axisLabels[2], 1, this.axisData.color[2]);\r\n zChar.position = new Vector3(xmin, ymin - 0.5 * ymax, zmax / 2);\r\n zChar.isPickable = false;\r\n this._axisLabels.push(zChar);\r\n // z ticks and tick lines\r\n let zTicks = [];\r\n for (let i = 0; i < -Math.ceil(this.axisData.range[2][0] / ztickBreaks); i++) {\r\n zTicks.push(-(i + 1) * ztickBreaks);\r\n }\r\n for (let i = 0; i <= Math.ceil(this.axisData.range[2][1] / ztickBreaks); i++) {\r\n zTicks.push(i * ztickBreaks);\r\n }\r\n let startTick = 0;\r\n if (heatmap) {\r\n startTick = 1;\r\n }\r\n for (let i = startTick; i < zTicks.length; i++) {\r\n let tickPos = zTicks[i];\r\n if (heatmap) {\r\n tickPos = tickPos - 0.5 * this.axisData.scale[2];\r\n }\r\n let tick = LinesBuilder.CreateLines(\"zTicks\", {\r\n points: [\r\n new Vector3(xmin + 0.05 * xmax, ymin, tickPos),\r\n new Vector3(xmin, ymin, tickPos),\r\n new Vector3(xmin, ymin + 0.05 * ymax, tickPos)\r\n ]\r\n }, this._scene);\r\n tick.color = Color3.FromHexString(this.axisData.color[2]);\r\n tick.isPickable = false;\r\n this._ticks.push(tick);\r\n let tickLabel = this._roundTicks(tickPos / this.axisData.scale[2]).toString();\r\n if (heatmap) {\r\n tickLabel = this.axisData.rownames[i - 1];\r\n }\r\n if (tickLabel === undefined) {\r\n continue;\r\n }\r\n let tickChar = this._makeTextPlane(tickLabel, 0.6, this.axisData.color[2]);\r\n tickChar.position = new Vector3(xmin, ymin - 0.1 * ymax, tickPos);\r\n tickChar.isPickable = false;\r\n this._tickLabels.push(tickChar);\r\n // tick lines\r\n if (this.axisData.showTickLines[2][0]) {\r\n let tickLine = LinesBuilder.CreateLines(\"zTickLines\", {\r\n points: [\r\n new Vector3(xmax, ymin, tickPos),\r\n new Vector3(xmin, ymin, tickPos)\r\n ]\r\n }, this._scene);\r\n tickLine.color = Color3.FromHexString(this.axisData.tickLineColor[2][0]);\r\n tickLine.isPickable = false;\r\n this._tickLines.push(tickLine);\r\n }\r\n if (this.axisData.showTickLines[2][1]) {\r\n let tickLine = LinesBuilder.CreateLines(\"zTickLines\", {\r\n points: [\r\n new Vector3(xmin, ymax, tickPos),\r\n new Vector3(xmin, ymin, tickPos)\r\n ]\r\n }, this._scene);\r\n tickLine.color = Color3.FromHexString(this.axisData.tickLineColor[2][1]);\r\n tickLine.isPickable = false;\r\n this._tickLines.push(tickLine);\r\n }\r\n }\r\n }\r\n }\r\n private _makeTextPlane(text: string, size: number, color: string): Mesh {\r\n var dynamicTexture = new DynamicTexture(\"DynamicTexture\", 75, this._scene, true);\r\n dynamicTexture.hasAlpha = true;\r\n dynamicTexture.drawText(text, 5, 40, (40 - text.length * 4) + \"px Arial\", color, \"transparent\", true);\r\n var plane = Mesh.CreatePlane(\"TextPlane\", size, this._scene, true);\r\n var material = new StandardMaterial(\"TextPlaneMaterial\", this._scene);\r\n material.backFaceCulling = false;\r\n material.specularColor = new Color3(0, 0, 0);\r\n material.diffuseTexture = dynamicTexture;\r\n plane.material = material;\r\n return plane;\r\n }\r\n update(camera: ArcRotateCamera, updateAxisData?: boolean): void {\r\n if (updateAxisData) {\r\n for (let i = 0; i < this._axes.length; i++) {\r\n this._axes[i].dispose();\r\n }\r\n for (let i = 0; i < this._axisLabels.length; i++) {\r\n this._axisLabels[i].dispose();\r\n }\r\n for (let i = 0; i < this._ticks.length; i++) {\r\n this._ticks[i].dispose();\r\n }\r\n for (let i = 0; i < this._tickLabels.length; i++) {\r\n this._tickLabels[i].dispose();\r\n }\r\n for (let i = 0; i < this._tickLines.length; i++) {\r\n this._tickLines[i].dispose();\r\n }\r\n this._createAxes();\r\n }\r\n if (this.axisData.showAxes) {\r\n let axis1 = Vector3.Cross(camera.position, Axis.Y);\r\n let axis2 = Vector3.Cross(axis1, camera.position);\r\n let axis3 = Vector3.Cross(axis1, axis2);\r\n for (let i = 0; i < this._axisLabels.length; i++) {\r\n this._axisLabels[i].rotation = Vector3.RotationFromAxis(axis1, axis2, axis3);\r\n }\r\n for (let i = 0; i < this._tickLabels.length; i++) {\r\n this._tickLabels[i].rotation = Vector3.RotationFromAxis(axis1, axis2, axis3);\r\n }\r\n }\r\n }\r\n}\r\n","/**\r\n * Babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n */\r\n\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { ArcRotateCamera } from \"@babylonjs/core/Cameras/arcRotateCamera\";\r\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\r\nimport { Vector3, Axis, Color3 } from \"@babylonjs/core/Maths/math\";\r\nimport { PlaneBuilder } from \"@babylonjs/core/Meshes/Builders/planeBuilder\";\r\nimport { PointerDragBehavior } from \"@babylonjs/core/Behaviors/Meshes/pointerDragBehavior\";\r\nimport { AdvancedDynamicTexture } from \"@babylonjs/gui/2D/advancedDynamicTexture\";\r\nimport { Button, Rectangle, TextBlock } from \"@babylonjs/gui/2D/controls\";\r\nimport { LinesBuilder } from \"@babylonjs/core/Meshes/Builders/linesBuilder\";\r\nimport { LinesMesh } from \"@babylonjs/core/Meshes/linesMesh\";\r\nimport { CylinderBuilder } from \"@babylonjs/core/Meshes/Builders/cylinderBuilder\";\r\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode\";\r\nimport chroma from \"chroma-js\";\r\n\r\nclass Arrow {\r\n private _lines: LinesMesh;\r\n private _tip: Mesh;\r\n\r\n size: number = 1;\r\n\r\n constructor(from: Vector3, to: Vector3, scene: Scene, color?: string) {\r\n let lines = LinesBuilder.CreateLineSystem('ls', {\r\n lines: [[from, to]],\r\n updatable: true\r\n }, scene);\r\n\r\n lines.color = new Color3(0, 0, 0);\r\n if (color !== undefined) {\r\n lines.color = Color3.FromHexString(color);\r\n }\r\n this._lines = lines;\r\n let tip = CylinderBuilder.CreateCylinder(\"tip\", {\r\n diameterTop: 0,\r\n diameterBottom: this.size,\r\n tessellation: 36\r\n }, scene);\r\n tip.position = to;\r\n this._tip = tip;\r\n\r\n }\r\n}\r\n\r\nclass dpInfo {\r\n private _background: Rectangle;\r\n private _textBlock: TextBlock;\r\n private _text: string;\r\n private _bgColor: string;\r\n private _txtColor: string;\r\n private _uiLayer: AdvancedDynamicTexture;\r\n private _closeBtn: Button;\r\n \r\n target: TransformNode;\r\n disposed: boolean = false;\r\n\r\n constructor(text: string, target: TransformNode, uiLayer: AdvancedDynamicTexture, backgroundColor: string, color: string) {\r\n this._bgColor = backgroundColor;\r\n this._txtColor = color;\r\n this.target = target;\r\n this._uiLayer = uiLayer;\r\n this._text = text;\r\n this.draw();\r\n }\r\n\r\n draw() {\r\n this.disposed = false;\r\n this._background = new Rectangle();\r\n this._uiLayer.addControl(this._background);\r\n let rows = this._text.split(\"\\n\");\r\n let maxRowLen = 0;\r\n for (let i = 0; i < rows.length; i++) {\r\n const row = rows[i];\r\n if (row.length > maxRowLen) {\r\n maxRowLen = row.length;\r\n }\r\n }\r\n let fontSize = 12;\r\n this._background.widthInPixels = maxRowLen * fontSize + 6;\r\n this._background.heightInPixels = rows.length * (fontSize + 4) + 6;\r\n this._background.linkWithMesh(this.target);\r\n this._background.background = this._bgColor;\r\n this._background.alpha = 0.8;\r\n this._background.linkOffsetY = -10;\r\n this._textBlock = new TextBlock();\r\n this._textBlock.text = this._text;\r\n this._textBlock.fontSize = fontSize;\r\n this._textBlock.color = this._txtColor;\r\n this._background.addControl(this._textBlock);\r\n this._closeBtn = Button.CreateSimpleButton(\"close\", \"x\");\r\n this._background.addControl(this._closeBtn);\r\n this._closeBtn.topInPixels = -this._background.heightInPixels/2 + 10;\r\n this._closeBtn.leftInPixels = this._background.widthInPixels/2 - 10;\r\n this._closeBtn.widthInPixels = 20;\r\n this._closeBtn.heightInPixels = 20;\r\n this._closeBtn.fontSize = 10;\r\n this._closeBtn.background = this._txtColor;\r\n this._closeBtn.color = this._bgColor\r\n this._closeBtn.onPointerClickObservable.add((function () {\r\n this.dispose();\r\n }).bind(this));\r\n\r\n }\r\n\r\n dispose() {\r\n if (this._textBlock) {\r\n this._textBlock.dispose();\r\n this._textBlock = undefined;\r\n }\r\n if (this._background) {\r\n this._background.dispose();\r\n this._background = undefined;\r\n }\r\n if (this._closeBtn) {\r\n this._closeBtn.dispose();\r\n this._closeBtn = undefined;\r\n }\r\n this.disposed = true;\r\n }\r\n}\r\n\r\nclass Label {\r\n private _label: Mesh;\r\n private _background: Rectangle;\r\n private _text: TextBlock;\r\n\r\n size: number = 100;\r\n color: string = \"black\";\r\n fixed: boolean = false;\r\n plotCreated: boolean;\r\n\r\n constructor(text: string, position: Vector3, scene: Scene, color?: string, size?: number, plotCreated = false) {\r\n if (size !== undefined) {\r\n this.size = size;\r\n }\r\n let plane = PlaneBuilder.CreatePlane('label', {\r\n width: this.size * 0.05,\r\n height: this.size * 0.05\r\n }, scene);\r\n\r\n if (color !== undefined) {\r\n this.color = color;\r\n }\r\n\r\n this.plotCreated = plotCreated\r\n\r\n plane.position = position;\r\n\r\n let advancedTexture = AdvancedDynamicTexture.CreateForMesh(plane);\r\n\r\n let background = new Rectangle();\r\n background.color = \"red\";\r\n background.alpha = 0\r\n advancedTexture.addControl(background);\r\n this._background = background;\r\n\r\n let textBlock = new TextBlock();\r\n textBlock.text = text;\r\n textBlock.color = this.color;\r\n textBlock.fontSize = this.size;\r\n advancedTexture.addControl(textBlock);\r\n this._text = textBlock;\r\n\r\n if (!this.fixed) {\r\n makeDraggable(plane);\r\n }\r\n\r\n this._label = plane;\r\n }\r\n\r\n setText(text: string) {\r\n this._text.text = text;\r\n }\r\n\r\n update(camera: ArcRotateCamera, scene: Scene) {\r\n // draw 3d labels in plot\r\n let axis1 = Vector3.Cross(camera.position, Axis.Y);\r\n let axis2 = Vector3.Cross(axis1, camera.position);\r\n let axis3 = Vector3.Cross(axis1, axis2);\r\n this._label.rotation = Vector3.RotationFromAxis(axis1, axis2, axis3);\r\n\r\n if (!this.fixed) {\r\n // highlighting label under mouse cursor\r\n const meshUnderPointer = scene.meshUnderPointer as Mesh;\r\n if (this._label === meshUnderPointer) {\r\n this._background.alpha = 1;\r\n } else {\r\n this._background.alpha = 0;\r\n }\r\n }\r\n }\r\n\r\n fix() {\r\n this._label.removeBehavior(this._label.getBehaviorByName(\"PointerDrag\"));\r\n this.fixed = true;\r\n }\r\n\r\n unfix() {\r\n makeDraggable(this._label);\r\n this.fixed = false;\r\n }\r\n\r\n dispose() {\r\n this._text.dispose();\r\n this._background.dispose();\r\n this._label.dispose();\r\n }\r\n\r\n export(): [number, number, number, string, string, number] {\r\n return [\r\n this._label.position.x,\r\n this._label.position.y,\r\n this._label.position.z,\r\n this._text.text,\r\n this.color,\r\n this.size\r\n ]\r\n }\r\n}\r\n\r\nexport class AnnotationManager {\r\n private _canvas: HTMLCanvasElement;\r\n private _scene: Scene;\r\n private _ymax: number;\r\n private _camera: ArcRotateCamera;\r\n private _labelControlBox: HTMLDivElement;\r\n private _editLabelContainer: HTMLDivElement;\r\n private _editLabelForms: HTMLDivElement[] = [];\r\n private _addLabelTextInput: HTMLInputElement;\r\n private _showLabels: boolean = false;\r\n private _arrows: Arrow[] = [];\r\n private _showArrows: boolean = false;\r\n private _bgColor: string;\r\n private _fgColor: string;\r\n private _fullScreenUI: AdvancedDynamicTexture;\r\n private _uniqID: string;\r\n \r\n dpInfos: dpInfo[] = [];\r\n labels: Label[] = [];\r\n fixedLabels: boolean = false;\r\n fixedArrows: boolean = false;\r\n\r\n constructor(canvas: HTMLCanvasElement, scene: Scene, ymax: number, camera: ArcRotateCamera, backgroundColor: string, fullScreenUI: AdvancedDynamicTexture, uniqID: string) {\r\n this._canvas = canvas;\r\n this._scene = scene;\r\n this._ymax = ymax;\r\n this._camera = camera;\r\n this._bgColor = backgroundColor;\r\n this._fgColor = \"white\";\r\n this._fullScreenUI = fullScreenUI;\r\n this._uniqID = uniqID;\r\n if (chroma(backgroundColor).luminance() > 0.5) {\r\n this._fgColor = \"black\";\r\n }\r\n this._createLabelForms();\r\n }\r\n\r\n private _createLabelForms() {\r\n let labelBox = document.createElement(\"div\");\r\n labelBox.id = \"labelControl_\" + this._uniqID;\r\n labelBox.className = \"bbp label-control\";\r\n labelBox.style.display = \"none\";\r\n labelBox.style.top = this._canvas.clientTop + 40 + \"px\";\r\n labelBox.style.left = this._canvas.clientTop + 5 + \"px\";\r\n let addLabelForm = document.createElement(\"div\");\r\n addLabelForm.className = \"label-form\";\r\n let addLabelLabel = document.createElement(\"label\");\r\n addLabelLabel.innerText = \"Label Text:\";\r\n addLabelLabel.htmlFor = \"addLabelInput\";\r\n let addLabelInput = document.createElement(\"input\");\r\n addLabelInput.name = \"addLabelInput\";\r\n addLabelInput.type = \"text\";\r\n this._addLabelTextInput = addLabelInput;\r\n let addLabelBtn = document.createElement(\"button\");\r\n addLabelBtn.innerText = \"Add Label\";\r\n addLabelBtn.onclick = this._addLabelBtnClick.bind(this);\r\n addLabelForm.appendChild(addLabelLabel);\r\n addLabelForm.appendChild(addLabelInput);\r\n addLabelForm.appendChild(addLabelBtn);\r\n labelBox.appendChild(addLabelForm);\r\n let editLabelContainer = document.createElement(\"div\");\r\n editLabelContainer.className = \"edit-container\";\r\n editLabelContainer.style.maxHeight = (this._canvas.height - 100).toString() + \"px\";\r\n labelBox.appendChild(editLabelContainer);\r\n this._editLabelContainer = editLabelContainer;\r\n this._labelControlBox = labelBox;\r\n this._canvas.parentNode.appendChild(labelBox);\r\n }\r\n\r\n update() {\r\n if (this._showArrows) {\r\n\r\n }\r\n if (this._showLabels) {\r\n for (let i = 0; i < this.labels.length; i++) {\r\n const label = this.labels[i];\r\n label.update(this._camera, this._scene);\r\n }\r\n }\r\n }\r\n\r\n toggleLabelControl() {\r\n if (this._labelControlBox.style.display == \"none\") {\r\n this._labelControlBox.style.display = \"block\";\r\n this.unfixLabels();\r\n } else {\r\n this._labelControlBox.style.display = \"none\";\r\n this.fixLabels();\r\n }\r\n }\r\n\r\n private _addLabelBtnClick(event: Event) {\r\n event.preventDefault();\r\n this.addLabel(this._addLabelTextInput.value);\r\n }\r\n\r\n addArrow(from: number[], to: number[]) {\r\n this._arrows.push(new Arrow(\r\n Vector3.FromArray(from),\r\n Vector3.FromArray(to),\r\n this._scene\r\n ));\r\n }\r\n\r\n redrawInfo() {\r\n for (let i = this.dpInfos.length - 1; i >= 0; i--) {\r\n const dpInfo = this.dpInfos[i];\r\n if (dpInfo.disposed) {\r\n this.dpInfos.splice(i, 1);\r\n } else {\r\n dpInfo.dispose();\r\n dpInfo.draw();\r\n }\r\n }\r\n }\r\n\r\n displayInfo(text: string, target: TransformNode) {\r\n let alreadyShown = false;\r\n for (let i = 0; i < this.dpInfos.length; i++) {\r\n const dpInfo = this.dpInfos[i];\r\n if (dpInfo.target === target) {\r\n alreadyShown = true;\r\n if (dpInfo.disposed) {\r\n dpInfo.draw();\r\n }\r\n }\r\n }\r\n if (!alreadyShown) {\r\n this.dpInfos.push(new dpInfo(text, target, this._fullScreenUI, this._bgColor, this._fgColor));\r\n }\r\n }\r\n\r\n clearInfo() {\r\n for (let i = 0; i < this.dpInfos.length; i++) {\r\n this.dpInfos[i].dispose();\r\n }\r\n this.dpInfos = [];\r\n }\r\n\r\n /**\r\n * Add a 3d label to the plot\r\n * @param text Label title\r\n * @param [moveCallback] On dragging of label in 3d plot, the final position will be passed to this function\r\n */\r\n addLabel(text: string, position?: number[], color?: string, size?: number, plotCreated = false): number {\r\n this._addLabelTextInput.value = \"\";\r\n let labelIdx = this.labels.length;\r\n\r\n let pos: Vector3;\r\n if (position) {\r\n pos = Vector3.FromArray(position)\r\n } else {\r\n pos = new Vector3(0, this._ymax + 2, 0);\r\n }\r\n\r\n text = text.replace(/[\\s\\.]/g, \"\\n\");\r\n text = text.replace(/_/g, \" \");\r\n let col = this._fgColor;\r\n if (color !== undefined) {\r\n col = color;\r\n }\r\n let newLabel = new Label(text, pos, this._scene, col, size, plotCreated);\r\n\r\n this.labels.push(newLabel);\r\n\r\n let editLabelForm = document.createElement(\"div\");\r\n editLabelForm.className = \"label-form\";\r\n let editLabelLabel = document.createElement(\"label\");\r\n editLabelLabel.innerText = \"Edit Label Text:\";\r\n editLabelLabel.htmlFor = \"editLabelInput\";\r\n editLabelForm.appendChild(editLabelLabel);\r\n let editLabelInput = document.createElement(\"input\");\r\n editLabelInput.name = \"editLabelInput\";\r\n editLabelInput.type = \"text\";\r\n editLabelInput.value = text;\r\n editLabelInput.dataset.labelnum = labelIdx.toString();\r\n editLabelInput.onkeyup = this._editLabelText.bind(this);\r\n editLabelForm.appendChild(editLabelInput);\r\n let rmvLabelBtn = document.createElement(\"button\");\r\n rmvLabelBtn.innerText = \"Remove Label\"\r\n rmvLabelBtn.onclick = this._removeLabel.bind(this);\r\n rmvLabelBtn.dataset.labelnum = labelIdx.toString();\r\n editLabelForm.appendChild(rmvLabelBtn);\r\n editLabelForm.dataset.labelnum = labelIdx.toString();\r\n this._editLabelForms.push(editLabelForm);\r\n this._editLabelContainer.appendChild(editLabelForm);\r\n\r\n this._showLabels = true;\r\n return labelIdx;\r\n }\r\n\r\n /**\r\n * Add multiple labels from a list of labels.\r\n * \r\n * @param labelList List of lists with the first three elements of the inner lists being the x, y and z coordinates, and the fourth the label text.\r\n */\r\n addLabels(labelList: [number, number, number, string, string?, number?][]): void {\r\n for (let i = 0; i < labelList.length; i++) {\r\n const label = labelList[i];\r\n let text = label[3];\r\n let position = label.slice(0, 3) as number[];\r\n this.addLabel(text, position, label[4], label[5]);\r\n }\r\n }\r\n\r\n private _editLabelText(ev: Event): void {\r\n let inputElem = ev.target as HTMLInputElement;\r\n this.labels[parseInt(inputElem.dataset.labelnum)].setText(inputElem.value);\r\n }\r\n\r\n private _removeLabel(ev: Event) {\r\n let btn = ev.target as HTMLButtonElement;\r\n let labelNum = parseInt(btn.dataset.labelnum);\r\n this.labels[labelNum].dispose();\r\n this.labels.splice(labelNum, 1);\r\n let thisForm: HTMLDivElement;\r\n this._editLabelForms.forEach(eLabelForm => {\r\n if (parseInt(eLabelForm.dataset.labelnum) == labelNum) {\r\n thisForm = eLabelForm;\r\n } else if (parseInt(eLabelForm.dataset.labelnum) > labelNum) {\r\n let oldNum = parseInt(eLabelForm.dataset.labelnum)\r\n let newNum = (oldNum - 1).toString()\r\n eLabelForm.dataset.labelnum = newNum;\r\n let oInput = eLabelForm.querySelector('input[data-labelnum=\"' + oldNum + '\"]') as HTMLInputElement;\r\n oInput.dataset.labelnum = newNum;\r\n let oBtn = eLabelForm.querySelector('button[data-labelnum=\"' + oldNum + '\"]') as HTMLButtonElement;\r\n oBtn.dataset.labelnum = newNum;\r\n }\r\n });\r\n thisForm.parentNode.removeChild(thisForm);\r\n }\r\n\r\n exportLabels(): [number, number, number, string, string, number][] {\r\n let labels: [number, number, number, string, string, number][] = [];\r\n for (let i = 0; i < this.labels.length; i++) {\r\n const l = this.labels[i];\r\n if (l.plotCreated) {\r\n continue\r\n }\r\n labels.push(this.labels[i].export());\r\n }\r\n return labels;\r\n }\r\n\r\n fixLabels(): void {\r\n for (let i = 0; i < this.labels.length; i++) {\r\n this.labels[i].fix();\r\n }\r\n this.fixedLabels = true;\r\n }\r\n\r\n unfixLabels(): void {\r\n for (let i = 0; i < this.labels.length; i++) {\r\n this.labels[i].unfix();\r\n }\r\n this.fixedLabels = false;\r\n }\r\n}\r\n\r\nfunction makeDraggable(label: Mesh) {\r\n let labelDragBehavior = new PointerDragBehavior();\r\n label.addBehavior(labelDragBehavior);\r\n}","\r\nexport const buttonSVGs = {\r\n logo: '',\r\n toJson: '',\r\n labels: '',\r\n publish: '',\r\n replay: '',\r\n loop: '',\r\n record: '',\r\n play: '',\r\n pause: '',\r\n loading: '',\r\n turntable: '',\r\n};\r\n\r\nexport const legendSVGs = {\r\n heatmap: '',\r\n point: '',\r\n surface: '',\r\n shape_box: '',\r\n shape_cone: '',\r\n shape_cylinder: '',\r\n shape_sphere: '',\r\n shape_torus: '',\r\n};\r\n","/*!\r\n * babyplots - Easy, fast, interactive 3D visualizations\r\n *\r\n * Copyright (c) 2020, Nils Jonathan Trost. All rights reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * \r\n * ---------------------------------------------\r\n * \r\n * babyplots includes CCapture.js, released under the following license:\r\n * \r\n * CCapture - A library to capture canvas-based animations\r\n * \r\n * The MIT License\r\n * \r\n * Copyright (c) 2012 Jaume Sanchez Elias\r\n * \r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n * \r\n * ---------------------------------------------\r\n * \r\n * babyplots includes axios, released under the following license:\r\n * \r\n * Copyright (c) 2014-present Matt Zabriskie\r\n * \r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in\r\n * all copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n * \r\n * ---------------------------------------------\r\n * \r\n * babyplots includes uuid, released under the following license:\r\n * \r\n * The MIT License (MIT)\r\n * \r\n * Copyright (c) 2010-2020 Robert Kieffer and other contributors\r\n * \r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is furnished\r\n * to do so, subject to the following conditions:\r\n * \r\n * The above copyright notice and this permission notice shall be included in all\r\n * copies or substantial portions of the Software.\r\n * \r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n * THE SOFTWARE.\r\n * \r\n */\r\n\r\n/**\r\n * Logs a warning to the console, formatted with orange text.\r\n * @param text The warning text.\r\n */\r\nexport function warn(text:string) {\r\n console.log(`%c${text}`, \"color:orange;\");\r\n}\r\n\r\nexport function deprecationWarning(deprecated:string, alternative?: string) {\r\n if (alternative) {\r\n warn(`The use of \"${deprecated}\" is deprecated and might be removed in a future version. Please use \"${alternative}\" instead.`);\r\n } else {\r\n warn(`The use of \"${deprecated}\" is deprecated and might be removed in a future version.`);\r\n }\r\n}","\r\nexport const styleText = [\r\n \".bbp.button-bar { position: absolute; z-index: 2; overflow: hidden; padding: 0 10px 4px 0; }\",\r\n \".bbp.button-bar>.button.hidden { display: none; }\",\r\n \".bbp.button-bar>.anim-slider { display: block; float: right; width: 150px; height: 30px }\",\r\n \".bbp.button-bar>.anim-slider.hidden { display: none; }\",\r\n \".bbp.button-bar>.button { float: right; width: 75px; height: 30px; cursor: pointer; border-radius: 2px; background-color: #f0f0f0; margin: 0 4px 0 0; }\",\r\n \".bbp.button-bar>.button:hover { background-color: #ddd; }\",\r\n \".bbp.button-bar>.button>svg { width: 75px; height: 30px; }\",\r\n \".bbp.button-bar>.button.active { background-color: #afafaf; }\",\r\n \".bbp.button-bar>.button.active:hover { background-color: #9f9f9f; }\",\r\n \".bbp.button-bar>.button.streamctrl.loading { cursor: progress; }\",\r\n \".bbp.button-bar>.button.streamctrl.loading:hover { background-color: #f0f0f0; }\",\r\n \".bbp.button-bar>.button.streamctrl.loading>.btn-label.play,.bbp.button-bar>.button.streamctrl.loading>.btn-label.pause {display: none; }\",\r\n \".bbp.button-bar>.button.streamctrl.loading>.btn-label.loading {display: block; }\",\r\n \".bbp.button-bar>.button.streamctrl.play>.btn-label.pause,.bbp.button-bar>.button.streamctrl.play>.btn-label.loading {display: none; }\",\r\n \".bbp.button-bar>.button.streamctrl.play>.btn-label.play {display: block; }\",\r\n \".bbp.button-bar>.button.streamctrl.pause>.btn-label.play,.bbp.button-bar>.button.streamctrl.pause>.btn-label.loading {display: none; }\",\r\n \".bbp.button-bar>.button.streamctrl.pause>.btn-label.pause {display: block; }\",\r\n \".bbp.label-control { position: absolute; z-index: 3; font-family: sans-serif; width: 200px; background-color: #f0f0f0; padding: 5px; border-radius: 2px; }\",\r\n \".bbp.label-control>label { font-size: 11pt; }\",\r\n \".bbp.label-control>.edit-container { overflow: auto; }\",\r\n \".bbp.label-control>.edit-container>.label-form { margin-top: 5px; padding-top: 20px; border-top: solid thin #ccc; }\",\r\n \".bbp.label-control .label-form>input { width: 100%; box-sizing: border-box; }\",\r\n \".bbp.label-control .label-form>button { border: none; font-weight: bold; background-color: white; padding: 5px 10px; margin: 5px 0 2px 0; width: 100%; cursor: pointer; }\",\r\n \".bbp.label-control .label-form>button:hover { background-color: #ddd; }\",\r\n \".bbp.overlay { position: absolute; z-index: 3; overflow: hidden; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; background-color: #fff5; display: flex; justify-content: center; align-items: center;}\",\r\n \".bbp.overlay>h5.loading-message { color: #000; font-family: Verdana, sans-serif;}\",\r\n \".bbp.publish-form>label { display: block; text-align: left; font-family: Verdana, sans-serif; }\",\r\n \".bbp.publish-form>input { width: 100%; margin-bottom: 15px; box-sizing: border-box; }\",\r\n \".bbp.publish-form>.publish-btn { border: none; font-weight: bold; background-color: #e95420; color: white; padding: 5px 10px; margin: 5px 0 2px 0; width: 100%; cursor: pointer; }\",\r\n \".bbp.publish-form>.publish-btn:hover { background-color: #ca491a }\",\r\n \".bbp.publish-form>.close-btn, .bbp.publish-form>.cancel-btn { border: none; font-weight: bold; background-color: white; padding: 5px 10px; margin: 5px 0 2px 0; width: 100%; cursor: pointer; }\",\r\n \".bbp.publish-form>.close-btn:hover, .bbp.publish-form>.cancel-btn:hover { background-color: #ddd }\",\r\n \".bbp.publish-form>p.form-info { font-size: 8pt; font-family: Verdana, sans-serif; }\",\r\n \".bbp.publish-form>p.message { font-size: 10pt; font-family: Verdana, sans-serif; }\",\r\n \".bbp.publish-form>p.message.warning { color: red; margin-top: 0px; }\",\r\n \".bbp.publish-form>p.message.success { color: green; }\",\r\n].join(\" \");\r\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation. Also,\n// find the complete implementation of crypto (msCrypto) on IE11.\nvar getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);\nvar rnds8 = new Uint8Array(16);\nexport default function rng() {\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n\n return getRandomValues(rnds8);\n}","export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;","import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction stringify(arr) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import rng from './rng.js';\nimport stringify from './stringify.js'; // **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\n\nvar _clockseq; // Previous uuid creation time\n\n\nvar _lastMSecs = 0;\nvar _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details\n\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || new Array(16);\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n\n if (node == null || clockseq == null) {\n var seedBytes = options.random || (options.rng || rng)();\n\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];\n }\n\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n } // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n\n\n var msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)\n\n var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression\n\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n\n\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n } // Per 4.2.1.2 Throw error if too many uuids are requested\n\n\n if (nsecs >= 10000) {\n throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n\n msecs += 12219292800000; // `time_low`\n\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff; // `time_mid`\n\n var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff; // `time_high_and_version`\n\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n\n b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n\n b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`\n\n b[i++] = clockseq & 0xff; // `node`\n\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf || stringify(b);\n}\n\nexport default v1;","import validate from './validate.js';\n\nfunction parse(uuid) {\n if (!validate(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n var v;\n var arr = new Uint8Array(16); // Parse ########-....-....-....-............\n\n arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;\n arr[1] = v >>> 16 & 0xff;\n arr[2] = v >>> 8 & 0xff;\n arr[3] = v & 0xff; // Parse ........-####-....-....-............\n\n arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;\n arr[5] = v & 0xff; // Parse ........-....-####-....-............\n\n arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;\n arr[7] = v & 0xff; // Parse ........-....-....-####-............\n\n arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;\n arr[9] = v & 0xff; // Parse ........-....-....-....-############\n // (Use \"/\" to avoid 32-bit truncation when bit-shifting high-order bytes)\n\n arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;\n arr[11] = v / 0x100000000 & 0xff;\n arr[12] = v >>> 24 & 0xff;\n arr[13] = v >>> 16 & 0xff;\n arr[14] = v >>> 8 & 0xff;\n arr[15] = v & 0xff;\n return arr;\n}\n\nexport default parse;","import stringify from './stringify.js';\nimport parse from './parse.js';\n\nfunction stringToBytes(str) {\n str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n var bytes = [];\n\n for (var i = 0; i < str.length; ++i) {\n bytes.push(str.charCodeAt(i));\n }\n\n return bytes;\n}\n\nexport var DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexport var URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\nexport default function (name, version, hashfunc) {\n function generateUUID(value, namespace, buf, offset) {\n if (typeof value === 'string') {\n value = stringToBytes(value);\n }\n\n if (typeof namespace === 'string') {\n namespace = parse(namespace);\n }\n\n if (namespace.length !== 16) {\n throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n } // Compute hash of namespace and value, Per 4.3\n // Future: Use spread syntax when supported on all platforms, e.g. `bytes =\n // hashfunc([...namespace, ... value])`\n\n\n var bytes = new Uint8Array(16 + value.length);\n bytes.set(namespace);\n bytes.set(value, namespace.length);\n bytes = hashfunc(bytes);\n bytes[6] = bytes[6] & 0x0f | version;\n bytes[8] = bytes[8] & 0x3f | 0x80;\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = bytes[i];\n }\n\n return buf;\n }\n\n return stringify(bytes);\n } // Function#name is not settable on some platforms (#270)\n\n\n try {\n generateUUID.name = name; // eslint-disable-next-line no-empty\n } catch (err) {} // For CommonJS default export support\n\n\n generateUUID.DNS = DNS;\n generateUUID.URL = URL;\n return generateUUID;\n}","/*\n * Browser-compatible JavaScript MD5\n *\n * Modification of JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\nfunction md5(bytes) {\n if (typeof bytes === 'string') {\n var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = new Uint8Array(msg.length);\n\n for (var i = 0; i < msg.length; ++i) {\n bytes[i] = msg.charCodeAt(i);\n }\n }\n\n return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));\n}\n/*\n * Convert an array of little-endian words to an array of bytes\n */\n\n\nfunction md5ToHexEncodedArray(input) {\n var output = [];\n var length32 = input.length * 32;\n var hexTab = '0123456789abcdef';\n\n for (var i = 0; i < length32; i += 8) {\n var x = input[i >> 5] >>> i % 32 & 0xff;\n var hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);\n output.push(hex);\n }\n\n return output;\n}\n/**\n * Calculate output length with padding and bit length\n */\n\n\nfunction getOutputLength(inputLength8) {\n return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;\n}\n/*\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n */\n\n\nfunction wordsToMd5(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << len % 32;\n x[getOutputLength(len) - 1] = len;\n var a = 1732584193;\n var b = -271733879;\n var c = -1732584194;\n var d = 271733878;\n\n for (var i = 0; i < x.length; i += 16) {\n var olda = a;\n var oldb = b;\n var oldc = c;\n var oldd = d;\n a = md5ff(a, b, c, d, x[i], 7, -680876936);\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n b = md5gg(b, c, d, a, x[i], 20, -373897302);\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n d = md5hh(d, a, b, c, x[i], 11, -358537222);\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n a = md5ii(a, b, c, d, x[i], 6, -198630844);\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n a = safeAdd(a, olda);\n b = safeAdd(b, oldb);\n c = safeAdd(c, oldc);\n d = safeAdd(d, oldd);\n }\n\n return [a, b, c, d];\n}\n/*\n * Convert an array bytes to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n */\n\n\nfunction bytesToWords(input) {\n if (input.length === 0) {\n return [];\n }\n\n var length8 = input.length * 8;\n var output = new Uint32Array(getOutputLength(length8));\n\n for (var i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;\n }\n\n return output;\n}\n/*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\n\n\nfunction safeAdd(x, y) {\n var lsw = (x & 0xffff) + (y & 0xffff);\n var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return msw << 16 | lsw & 0xffff;\n}\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\n\n\nfunction bitRotateLeft(num, cnt) {\n return num << cnt | num >>> 32 - cnt;\n}\n/*\n * These functions implement the four basic operations the algorithm uses.\n */\n\n\nfunction md5cmn(q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\n\nfunction md5ff(a, b, c, d, x, s, t) {\n return md5cmn(b & c | ~b & d, a, b, x, s, t);\n}\n\nfunction md5gg(a, b, c, d, x, s, t) {\n return md5cmn(b & d | c & ~d, a, b, x, s, t);\n}\n\nfunction md5hh(a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\n\nfunction md5ii(a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\nexport default md5;","import v35 from './v35.js';\nimport md5 from './md5.js';\nvar v3 = v35('v3', 0x30, md5);\nexport default v3;","import rng from './rng.js';\nimport stringify from './stringify.js';\n\nfunction v4(options, buf, offset) {\n options = options || {};\n var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return stringify(rnds);\n}\n\nexport default v4;","// Adapted from Chris Veness' SHA1 code at\n// http://www.movable-type.co.uk/scripts/sha1.html\nfunction f(s, x, y, z) {\n switch (s) {\n case 0:\n return x & y ^ ~x & z;\n\n case 1:\n return x ^ y ^ z;\n\n case 2:\n return x & y ^ x & z ^ y & z;\n\n case 3:\n return x ^ y ^ z;\n }\n}\n\nfunction ROTL(x, n) {\n return x << n | x >>> 32 - n;\n}\n\nfunction sha1(bytes) {\n var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n\n if (typeof bytes === 'string') {\n var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = [];\n\n for (var i = 0; i < msg.length; ++i) {\n bytes.push(msg.charCodeAt(i));\n }\n } else if (!Array.isArray(bytes)) {\n // Convert Array-like to Array\n bytes = Array.prototype.slice.call(bytes);\n }\n\n bytes.push(0x80);\n var l = bytes.length / 4 + 2;\n var N = Math.ceil(l / 16);\n var M = new Array(N);\n\n for (var _i = 0; _i < N; ++_i) {\n var arr = new Uint32Array(16);\n\n for (var j = 0; j < 16; ++j) {\n arr[j] = bytes[_i * 64 + j * 4] << 24 | bytes[_i * 64 + j * 4 + 1] << 16 | bytes[_i * 64 + j * 4 + 2] << 8 | bytes[_i * 64 + j * 4 + 3];\n }\n\n M[_i] = arr;\n }\n\n M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);\n M[N - 1][14] = Math.floor(M[N - 1][14]);\n M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;\n\n for (var _i2 = 0; _i2 < N; ++_i2) {\n var W = new Uint32Array(80);\n\n for (var t = 0; t < 16; ++t) {\n W[t] = M[_i2][t];\n }\n\n for (var _t = 16; _t < 80; ++_t) {\n W[_t] = ROTL(W[_t - 3] ^ W[_t - 8] ^ W[_t - 14] ^ W[_t - 16], 1);\n }\n\n var a = H[0];\n var b = H[1];\n var c = H[2];\n var d = H[3];\n var e = H[4];\n\n for (var _t2 = 0; _t2 < 80; ++_t2) {\n var s = Math.floor(_t2 / 20);\n var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[_t2] >>> 0;\n e = d;\n d = c;\n c = ROTL(b, 30) >>> 0;\n b = a;\n a = T;\n }\n\n H[0] = H[0] + a >>> 0;\n H[1] = H[1] + b >>> 0;\n H[2] = H[2] + c >>> 0;\n H[3] = H[3] + d >>> 0;\n H[4] = H[4] + e >>> 0;\n }\n\n return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];\n}\n\nexport default sha1;","import v35 from './v35.js';\nimport sha1 from './sha1.js';\nvar v5 = v35('v5', 0x50, sha1);\nexport default v5;","export default '00000000-0000-0000-0000-000000000000';","import validate from './validate.js';\n\nfunction version(uuid) {\n if (!validate(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n return parseInt(uuid.substr(14, 1), 16);\n}\n\nexport default version;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(5420);\n"],"sourceRoot":""} \ No newline at end of file diff --git a/package.json b/package.json index bcd8321..abb1147 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "babyplots", - "version": "1.5.0", + "version": "1.5.1", "description": "Easy interactive 3d plots.", "main": "build/babyplots.js", "scripts": { diff --git a/src/babyplots.d.ts b/src/babyplots.d.ts index ad8524c..01e73e0 100644 --- a/src/babyplots.d.ts +++ b/src/babyplots.d.ts @@ -271,5 +271,5 @@ export declare class Plots { resize(width?: number, height?: number): Plots; thumbnail(size: number, saveCallback: (data: string) => void): void; dispose(): void; - addLabels(labelList: [[number, number, number, string]]): void; + addLabels(labelList: [[number, number, number, string, string?, number?]]): void; } diff --git a/src/babyplots.ts b/src/babyplots.ts index 597228b..3a078e4 100644 --- a/src/babyplots.ts +++ b/src/babyplots.ts @@ -662,7 +662,7 @@ export class Plots { meshOffset: plot["meshOffset"] } ) - } else if (["pointCloud", "heatMap", "surface", "shapeCloud"].indexOf(plot["plotType"]) !== -1) { + } else if (["pointCloud", "heatMap", "surface", "shapeCloud", "line"].indexOf(plot["plotType"]) !== -1) { this.addPlot( plot["coordinates"], plot["plotType"], @@ -704,7 +704,10 @@ export class Plots { shape: plot["shape"], shading: plot["shading"], dpInfo: plot["dpInfo"], - addClusterLabels: plot["addClusterLabels"] + addClusterLabels: plot["addClusterLabels"], + labels: plot["labels"], + labelSize: plot["labelSize"], + labelColor: plot["labelColor"] } ) } @@ -2452,7 +2455,7 @@ export class Plots { * * @param labelList List of lists with the first three elements of the inner lists being the x, y and z coordinates, and the fourth the label text. */ - addLabels(labelList: [[number, number, number, string]]): void { + addLabels(labelList: [[number, number, number, string, string?, number?]]): void { this._annotationManager.addLabels(labelList); } diff --git a/src/plotTypes/Line.ts b/src/plotTypes/Line.ts index 8a59d7f..cb713c1 100644 --- a/src/plotTypes/Line.ts +++ b/src/plotTypes/Line.ts @@ -90,7 +90,7 @@ export class Line extends CoordinatePlot { if (this.labelColor === "match") { col = this._coordColors[i]; } - annotationManager.addLabel(this.labels[i], this._coords[i], col, this.labelSize); + annotationManager.addLabel(this.labels[i], this._coords[i], col, this.labelSize, true); } annotationManager.fixLabels(); } diff --git a/src/plotTypes/PointCloud.ts b/src/plotTypes/PointCloud.ts index e2ccdc5..87e8ac2 100644 --- a/src/plotTypes/PointCloud.ts +++ b/src/plotTypes/PointCloud.ts @@ -190,7 +190,7 @@ export class PointCloud extends CoordinatePlot { const pointGroup = pointGroups[i]; const sum = pointGroup.reduce(sumFun); const centroid = [sum[0] / pointGroup.length, sum[1] / pointGroup.length, sum[2] / pointGroup.length]; - annotationManager.addLabel(pointGroupNames[i], centroid); + annotationManager.addLabel(pointGroupNames[i], centroid, undefined, undefined, true); } annotationManager.fixLabels(); } diff --git a/src/utils/Label.d.ts b/src/utils/Label.d.ts index e846721..34c41ce 100644 --- a/src/utils/Label.d.ts +++ b/src/utils/Label.d.ts @@ -24,13 +24,14 @@ declare class Label { size: number; color: string; fixed: boolean; - constructor(text: string, position: Vector3, scene: Scene, color?: string, size?: number); + plotCreated: boolean; + constructor(text: string, position: Vector3, scene: Scene, color?: string, size?: number, plotCreated?: boolean); setText(text: string): void; update(camera: ArcRotateCamera, scene: Scene): void; fix(): void; unfix(): void; dispose(): void; - export(): [number, number, number, string]; + export(): [number, number, number, string, string, number]; } export declare class AnnotationManager { private _canvas; @@ -61,11 +62,11 @@ export declare class AnnotationManager { redrawInfo(): void; displayInfo(text: string, target: TransformNode): void; clearInfo(): void; - addLabel(text: string, position?: number[], color?: string, size?: number): number; - addLabels(labelList: [[number, number, number, string]]): void; + addLabel(text: string, position?: number[], color?: string, size?: number, plotCreated?: boolean): number; + addLabels(labelList: [number, number, number, string, string?, number?][]): void; private _editLabelText; private _removeLabel; - exportLabels(): any[]; + exportLabels(): [number, number, number, string, string, number][]; fixLabels(): void; unfixLabels(): void; } diff --git a/src/utils/Label.ts b/src/utils/Label.ts index 70ffa73..d3a43a8 100644 --- a/src/utils/Label.ts +++ b/src/utils/Label.ts @@ -144,8 +144,9 @@ class Label { size: number = 100; color: string = "black"; fixed: boolean = false; + plotCreated: boolean; - constructor(text: string, position: Vector3, scene: Scene, color?: string, size?: number) { + constructor(text: string, position: Vector3, scene: Scene, color?: string, size?: number, plotCreated = false) { if (size !== undefined) { this.size = size; } @@ -158,6 +159,8 @@ class Label { this.color = color; } + this.plotCreated = plotCreated + plane.position = position; let advancedTexture = AdvancedDynamicTexture.CreateForMesh(plane); @@ -220,12 +223,14 @@ class Label { this._label.dispose(); } - export(): [number, number, number, string] { + export(): [number, number, number, string, string, number] { return [ this._label.position.x, this._label.position.y, this._label.position.z, - this._text.text + this._text.text, + this.color, + this.size ] } } @@ -374,7 +379,7 @@ export class AnnotationManager { * @param text Label title * @param [moveCallback] On dragging of label in 3d plot, the final position will be passed to this function */ - addLabel(text: string, position?: number[], color?: string, size?: number): number { + addLabel(text: string, position?: number[], color?: string, size?: number, plotCreated = false): number { this._addLabelTextInput.value = ""; let labelIdx = this.labels.length; @@ -391,7 +396,7 @@ export class AnnotationManager { if (color !== undefined) { col = color; } - let newLabel = new Label(text, pos, this._scene, col, size); + let newLabel = new Label(text, pos, this._scene, col, size, plotCreated); this.labels.push(newLabel); @@ -426,12 +431,12 @@ export class AnnotationManager { * * @param labelList List of lists with the first three elements of the inner lists being the x, y and z coordinates, and the fourth the label text. */ - addLabels(labelList: [[number, number, number, string]]): void { + addLabels(labelList: [number, number, number, string, string?, number?][]): void { for (let i = 0; i < labelList.length; i++) { const label = labelList[i]; let text = label[3]; let position = label.slice(0, 3) as number[]; - this.addLabel(text, position); + this.addLabel(text, position, label[4], label[5]); } } @@ -462,22 +467,26 @@ export class AnnotationManager { thisForm.parentNode.removeChild(thisForm); } - exportLabels(): any[] { - let labels = []; + exportLabels(): [number, number, number, string, string, number][] { + let labels: [number, number, number, string, string, number][] = []; for (let i = 0; i < this.labels.length; i++) { + const l = this.labels[i]; + if (l.plotCreated) { + continue + } labels.push(this.labels[i].export()); } return labels; } - fixLabels() { + fixLabels(): void { for (let i = 0; i < this.labels.length; i++) { this.labels[i].fix(); } this.fixedLabels = true; } - unfixLabels() { + unfixLabels(): void { for (let i = 0; i < this.labels.length; i++) { this.labels[i].unfix(); }